public static ArgumentProcessor Compile(string[] args)
        {
            ArgumentProcessor argProc = new ArgumentProcessor(args);

            return argProc;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            argsProc = ArgumentProcessor.Compile(args);
            process  = Process.GetCurrentProcess();
            assembly = Assembly.GetEntryAssembly();

            string mutexName = "RunUO: GDK";

            using (Mutex instanceMutex = new Mutex(false, mutexName))
            {
                if (instanceMutex.WaitOne(1, true) == false)
                {
                    MessageBox.Show("You may only run 1 instance of RunUO: GDK at a time.", "RunUO: GDK");
                    return;
                }

                try
                {
                    WebClient client = new WebClient();
                    byte[]    buffer = client.DownloadData(new Uri("http://www.fallingdownstairs.net/runuogdk/version.php"));

                    string  version = Encoding.ASCII.GetString(buffer);
                    Version latest  = new Version(version);
                    Version current = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;

                    if (current.CompareTo(latest) == -1 &&
                        MessageBox.Show("A newer version of RunUO: GDK is available!\nDo you wish to update?",
                                        "RunUO: GDK", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start(Path.Combine(BaseDirectory, "Updater.exe"));
                        Application.Exit();
                    }
                }
                catch (Exception e)
                {
                }

                string updateNew = Path.Combine(BaseDirectory, "Updater.exe.new");
                if (File.Exists(updateNew))
                {
                    try
                    {
                        File.Move(updateNew, Path.GetFileNameWithoutExtension(updateNew));
                    }
                    catch { }
                }

                string unrarNew = Path.Combine(BaseDirectory, "unrar.dll.new");
                if (File.Exists(unrarNew))
                {
                    try
                    {
                        File.Move(unrarNew, Path.GetFileNameWithoutExtension(unrarNew));
                    }
                    catch { }
                }

                if (File.Exists(SettingsPath))
                {
                    settings = GdkSettings.Load(SettingsPath);
                }
                else
                {
                    settings = new GdkSettings();
                    settings.Save(SettingsPath);
                }

                uint id = Settings.GetValue <uint>("user_id", (uint)(Utility.Rand.Next() + Utility.Rand.Next()));

                Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new SplashScreen());
            }
        }
Exemple #3
0
        public static ArgumentProcessor Compile(string[] args)
        {
            ArgumentProcessor argProc = new ArgumentProcessor(args);

            return(argProc);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            argsProc = ArgumentProcessor.Compile(args);
            process = Process.GetCurrentProcess();
            assembly = Assembly.GetEntryAssembly();

            string mutexName = "RunUO: GDK";

            using (Mutex instanceMutex = new Mutex(false, mutexName))
            {
                if (instanceMutex.WaitOne(1, true) == false)
                {
                    MessageBox.Show("You may only run 1 instance of RunUO: GDK at a time.", "RunUO: GDK");
                    return;
                }

                try
                {
                    WebClient client = new WebClient();
                    byte[] buffer = client.DownloadData(new Uri("http://www.fallingdownstairs.net/runuogdk/version.php"));

                    string version = Encoding.ASCII.GetString(buffer);
                    Version latest = new Version(version);
                    Version current = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;

                    if (current.CompareTo(latest) == -1 &&
                        MessageBox.Show("A newer version of RunUO: GDK is available!\nDo you wish to update?",
                        "RunUO: GDK", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start(Path.Combine(BaseDirectory, "Updater.exe"));
                        Application.Exit();
                    }
                }
                catch(Exception e)
                {

                }

                string updateNew = Path.Combine(BaseDirectory, "Updater.exe.new");
                if(File.Exists(updateNew))
                {
                    try
                    {
                        File.Move(updateNew, Path.GetFileNameWithoutExtension(updateNew));
                    }
                    catch { }
                }

                string unrarNew = Path.Combine(BaseDirectory, "unrar.dll.new");
                if(File.Exists(unrarNew))
                {
                    try
                    {
                        File.Move(unrarNew, Path.GetFileNameWithoutExtension(unrarNew));
                    }
                    catch { }
                }

                if (File.Exists(SettingsPath))
                {
                    settings = GdkSettings.Load(SettingsPath);
                }
                else
                {
                    settings = new GdkSettings();
                    settings.Save(SettingsPath);
                }

                uint id = Settings.GetValue<uint>("user_id", (uint)(Utility.Rand.Next() + Utility.Rand.Next()));

                Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new SplashScreen());
            }
        }