Exemple #1
0
        static void Main()
        {
            // Startup
            #if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            #endif

            Properties.Resources.Culture = CultureInfo.CurrentCulture;
            InfoManager = new WzInformationManager();
            SettingsManager = new WzSettingsManager(GetLocalSettingsPath(), typeof(UserSettings), typeof(ApplicationSettings), typeof(Microsoft.Xna.Framework.Color));
            SettingsManager.Load();
            MultiBoard.RecalculateSettings();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Program run here
            GUI.Initialization initForm = new GUI.Initialization();
            Application.Run(initForm);

            // Shutdown
            if (initForm.editor != null)
                initForm.editor.hcsm.backupMan.ClearBackups();
            SettingsManager.Save();
            if (Restarting)
            {
                Application.Restart();
            }
        }
Exemple #2
0
 static void Main()
 {
     SettingsManager = new WzSettingsManager(System.IO.Path.Combine(Application.StartupPath, "TraPC_Settings.wz"), typeof(UserSettings), typeof(AppSettings));
     SettingsManager.Load();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Main());
     SettingsManager.Save();
 }
Exemple #3
0
 public static bool PrepareApplication()
 {
     SettingsManager = new WzSettingsManager(System.IO.Path.Combine(Application.StartupPath, "HRSettings.wz"), typeof(UserSettings), typeof(ApplicationSettings));
     int tryCount = 0;
     tryagain:
     try
     {
         SettingsManager.Load();
     }
     catch
     {
         tryCount++;
         if (tryCount < 5)
         {
             Thread.Sleep(1000);
             goto tryagain;
         }
         else
         {
             Warning.Error("Could not load settings file, make sure it is not in use. If it is not, delete it and try again.");
             return true;
         }
     }
     bool firstRun = ApplicationSettings.FirstRun;
     if (ApplicationSettings.FirstRun)
     {
         new FirstRunForm().ShowDialog();
         ApplicationSettings.FirstRun = false;
         SettingsManager.Save();
     }
     if (UserSettings.AutoAssociate)
     {
         string path = Application.ExecutablePath;
         Registry.ClassesRoot.CreateSubKey(".wz").SetValue("", "WzFile");
         RegistryKey wzKey = Registry.ClassesRoot.CreateSubKey("WzFile");
         wzKey.SetValue("", "Wz File");
         wzKey.CreateSubKey("DefaultIcon").SetValue("", path + ",1");
         wzKey.CreateSubKey("shell\\open\\command").SetValue("", "\"" + path + "\" \"%1\"");
     }
     return firstRun;
 }
Exemple #4
0
        static void Main()
        {
            SelfCheck();
            InfoManager = new WzInformationManager();
            SettingsManager = new WzSettingsManager(System.IO.Path.Combine(Application.StartupPath, "HCSettings.wz"), typeof(UserSettings), typeof(ApplicationSettings), typeof(Microsoft.Xna.Framework.Color));
            SettingsManager.Load();
            MultiBoard.RecalculateSettings();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#if !DEBUG
            try
            {
                Application.Run(new GUI.Initialization());
            }
            catch (Exception e)
            {
                Application.Run(new ExceptionHandler(e));
            }
#else
            Application.Run(new GUI.Initialization());
#endif
            SettingsManager.Save();
        }
Exemple #5
0
 static void Main()
 {
     SettingsManager = new WzSettingsManager(System.IO.Path.Combine(Application.StartupPath, "PatcherSettings.wz"), typeof(Patcher_UserSettings), typeof(Patcher_AppSettings));
     SettingsManager.Load();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     try { Application.Run(new Form1()); }
     catch { } //Just because sometimes an error about Form1 already being disposed happens, for some reason. -DeathRight
     if (Directory.Exists(Application.StartupPath + @"\Patches")) Directory.Delete(Application.StartupPath + @"\Patches", true);
     SettingsManager.Save();
     /*try
     {
         Application.Run(new Form1());
     }
     catch
     {
         SettingsManager.Save();
         Directory.Delete(Application.StartupPath + @"\Patches",true);
         Application.Exit();
     }
     SettingsManager.Save();
     Directory.Delete(Application.StartupPath + @"\Patches",true);
     Application.Exit();*/
 }
Exemple #6
0
 public static bool PrepareApplication(bool from_internal)
 {
     SettingsManager = new WzSettingsManager(GetLocalSettingsPath(), typeof(UserSettings), typeof(ApplicationSettings));
     bool loaded = false;
     for (int i = 0; i < 5; i++)
     {
         try
         {
             SettingsManager.Load();
             loaded = true;
             break;
         }
         catch
         {
             Thread.Sleep(1000);
         }
     }
     if (!loaded)
     {
         Warning.Error(HaRepacker.Properties.Resources.ProgramLoadSettingsError);
         return true;
     }
     bool firstRun = ApplicationSettings.FirstRun;
     if (ApplicationSettings.FirstRun)
     {
         //new FirstRunForm().ShowDialog();
         ApplicationSettings.FirstRun = false;
         SettingsManager.Save();
     }
     if (UserSettings.AutoAssociate && from_internal && IsUserAdministrator())
     {
         string path = Application.ExecutablePath;
         Registry.ClassesRoot.CreateSubKey(".wz").SetValue("", "WzFile");
         RegistryKey wzKey = Registry.ClassesRoot.CreateSubKey("WzFile");
         wzKey.SetValue("", "Wz File");
         wzKey.CreateSubKey("DefaultIcon").SetValue("", path + ",1");
         wzKey.CreateSubKey("shell\\open\\command").SetValue("", "\"" + path + "\" \"%1\"");
     }
     return firstRun;
 }
Exemple #7
0
        private void genBtn_Click(object sender, EventArgs e)
        {
            WebClient client = new WebClient();
            try
            {
                client.DownloadString(webUrl.Text);
            }
            catch (Exception WTFBBQ) //Yes, I know WTFBBQ is never used, tysm VS! Now shut up. -DeathRight
            {
                client.Dispose();
                MessageBox.Show("The URL specified, \"" + webUrl.Text + "\" does not exist.", "Why did you give me a invalid URL?!");
                return;
            }
            client.Dispose();

            /*if (String.IsNullOrWhiteSpace(serverName.Text))
            {
                MessageBox.Show("Sorry, but I don't think that \"" + serverName.Text + "\" is a very good name.\r\nTry again, only this time, do it properly, noob.", "Interesting choice of a server name");
                return;
            }
            else*/ if (serverName.Text == "MapleStory")
            {
                MessageBox.Show("Is Nexon using my Patch Creator?", "...Nexon?");
            }
            else if (serverName.Text == "MapleSEA")
            {
                MessageBox.Show("¿Está utilizando Nexon mi Creador Parche?", "...Nexon?");
            }

            if (String.IsNullOrWhiteSpace(startVer.Text))
            {
                MessageBox.Show("Enter a valid number, noob.", "Enter a valid number");
                return;
            }
            try
            {
                int test = Convert.ToInt32(startVer.Text);
            }
            catch (Exception WTFBBQ)
            {
                MessageBox.Show("Enter a valid number, noob.", "Enter a valid number");
                return;
            }

            WzSettingsManager SettingsMngr = new WzSettingsManager(System.IO.Path.Combine(Application.StartupPath, "PatcherSettings.wz"), typeof(Patcher_UserSettings), typeof(Patcher_AppSettings));
            SettingsMngr.Load();
            Patcher_UserSettings.CurrentVersion = Convert.ToInt32(startVer.Text);
            Patcher_AppSettings.PatchURL = webUrl.Text;
            Patcher_AppSettings.ServerName = serverName.Text;
            Patcher_AppSettings.PatcherLogo = new Bitmap(logoPicture.Image);
            AppSettings.Logo = new Bitmap(logoPicture.Image);
            SettingsMngr.Save();
            MessageBox.Show("It was saved to: "+Application.StartupPath+"\\PatcherSettings.wz","Patcher settings file generated successfully!");
        }