aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/Program.cs
blob: 97a9ca2b9ccb459a074ba66b70a5ce8075e115ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Drawing.Text;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
using System.Net;
using Newtonsoft.Json;
using TimeHACK.OS;
using TimeHACK.OS.Win95;
using TimeHACK.OS.Win95.Win95Apps;
using TimeHACK.Engine;
using TimeHACK.Engine.Template;

namespace TimeHACK
{
    static class Program
    {
        internal static bool nightly = true;
        internal static string gameID;
        internal static TitleScreen title = null;
        public static string AddressBookSelectedFolderName;
        public static AddressBookContact AddressBookSelectedContact;
        public static string WindowsExplorerReturnPath;
        static WindowManager wm = new WindowManager();

        /// <summary>
        /// The main entry point for the application.
        /// Run TitleScreen.cs at launch.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            if (nightly == true)
            {
                try
                {
                    WebClient wc = new WebClient();

                    // Set the GameID
                    string json = wc.DownloadString("http://ci.appveyor.com/api/projects/timehack/timehack");
                    JObject j = JObject.Parse(JObject.Parse(json)["build"].ToString());
                    gameID = "AppVeyor-" + j["buildNumber"].ToString();
                }
                catch (WebException)
                {
                    gameID = "AppVeyor";
                }
            }
            else
            {
                gameID = "TimeHACK 1.1";
            }

            //TimeHACK.Engine.GameSave.SaveData MySaveData = new TimeHACK.Engine.GameSave.SaveData()
            //{
            //    OS = 60,
            //    MyStringList = new List<string>
            //    {
            //        "Item1",
            //        "Item2"
            //    }
            //};

            //string TheJSON = JsonConvert.SerializeObject(MySaveData, Formatting.Indented);
            //MessageBox.Show(TheJSON);
            //MySaveData.OS = 40;
            //MessageBox.Show(MySaveData.OS.ToString());

            //MySaveData = (TimeHACK.Engine.GameSave.SaveData)JsonConvert.DeserializeObject(TheJSON, MySaveData.GetType());
            //MessageBox.Show(MySaveData.OS.ToString());
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(title = new TitleScreen());
        }

        public static String OpenFileExplorerAsDialogAndReturnGivenPath()
        {
            WinClassicWindowsExplorer we = new WinClassicWindowsExplorer();
            WinClassic app = wm.startWin95(we, "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true, true);
            TitleScreen.frm95.AddTaskBarItem(app, app.Tag.ToString(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer);

            TitleScreen.frm95.nonimportantapps.Add(app);
            TitleScreen.frm95.nonimportantapps[TitleScreen.frm95.nonimportantapps.Count - 1].BringToFront();
            TitleScreen.frm95.nonimportantapps[TitleScreen.frm95.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(TitleScreen.frm95.NonImportantApp_Closing);

            app.BringToFront();
            try
            {
                return WindowsExplorerReturnPath;
            } catch {
                return "";
            }           
        }
    }
}