예제 #1
0
        public static void Main()
        {
            //Check if the FlashHelper and FlashUpdater are available
            if (!File.Exists("FlashHelper.exe") || (!File.Exists("FlashReboot.exe")))
            {
                //Show message
                MessageBox.Show("The FlashHelper.exe or the FlashReboot.exe is missing!\n" +
                                "Please copy those two files to the same folder than the updater.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                //End program execution
                return;
            }

            //Check if we can get the version file
            if (CheckVersionFile())
            {
                //Delete old local file if new one downloaded
                if (File.Exists("Versions.dat") && File.Exists("Versions_new.dat"))
                {
                    File.Delete("Versions.dat");
                }

                //Rename the new file to use ist
                if (File.Exists("Versions_new.dat"))
                {
                    File.Move("Versions_new.dat", "Versions.dat");
                }

                //Start the updater
                UpdaterLogic.Start();
            }

            //If no version file is available, show message and end program
            else
            {
                MessageBox.Show("Unable to download version file and no old copy found, exit!\n" +
                                "Please connect to the internet and try again.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }