コード例 #1
0
        public MainForm(string[] args)
        {
            InitializeComponent();
            this.Shown += MainForm_Shown;

            var ci     = new CultureInfo("en-US");
            var thread = System.Threading.Thread.CurrentThread;

            Application.CurrentCulture       = thread.CurrentCulture = thread.CurrentUICulture = ci;
            Application.CurrentInputLanguage = InputLanguage.FromCulture(ci);

            if (args.Length > 0 && File.Exists(args[0]))
            {
                LoadTemplate(args[0]);
            }

            // get the user's attention that this is a special beta release
            var errMsg = "This is a special beta release of the toolkit so there could be some bugs." + Environment.NewLine +
                         "The 'Techniques' array has been removed from CDLC JSON Manifest files for testing." + Environment.NewLine +
                         "There are no other revision in this beta release." + Environment.NewLine + Environment.NewLine +
                         "Please let the toolkit devs know if experience any in game issues or not as a result." + Environment.NewLine;

            BetterDialog2.ShowDialog(errMsg, "SPECIAL TOOLKIT BETA RELEASE MESSAGE ... 100% BUG ISSUES", null, null, "Ok", Bitmap.FromHicon(SystemIcons.Information.Handle), "Information", 150, 150);

            InitMainForm();
        }
コード例 #2
0
        private void installButton_Click(object sender, EventArgs e)
        {
            var updaterApp  = Path.Combine(RootDirectory, APP_UPDATER);
            var updatingApp = Path.Combine(RootDirectory, APP_UPDATING);

            if (File.Exists(updaterApp))
            {
                // COPY TO NOT LOCK PROCESS ON UPDATE
                File.Copy(updaterApp, updatingApp, true);
                try
                {
                    // START AUTO UPDATE
                    GeneralExtensions.RunExternalExecutable(updatingApp);
                }
                catch (Exception)
                {
                    throw new FileLoadException("Could not run " + updatingApp);
                }

                // EXIT TOOLKIT
                Application.Exit();
            }
            else
            {
                var errMsg = "Could not find " + updaterApp + Environment.NewLine + "Please reinstall/update the toolkit manually.";
                BetterDialog2.ShowDialog(errMsg, "Toolkit Updater Error", null, null, "Ok", Bitmap.FromHicon(SystemIcons.Error.Handle), "Error", 150, 150);
            }
        }
コード例 #3
0
        //  hackery used as class library entry point
        public static void Start()
        {
            if (!ToolkitVersion.IsRSTKLibValid())
            {
                // throw new ApplicationException("This version of RocksmithToolkitLib.dll has expired.  " + Environment.NewLine +
                //    "Please download and install the latest toolkit library.  " + Environment.NewLine);

                var diaMsg = "This version of RocksmithToolkitLib.dll is no longer supported." + Environment.NewLine +
                             "Please download and install the latest version of the toolkit.";
                BetterDialog2.ShowDialog(diaMsg, "Time To Update ...", null, null, "Ok", Bitmap.FromHicon(SystemIcons.Warning.Handle), "WARNING ...", 0, 150);
            }
        }
コード例 #4
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            btnInstall.Enabled = false;
            // reset to display the revision note on next restart
            ConfigRepository.Instance()["general_showrevnote"] = "true";

            var tempToolkitDir  = Path.Combine(Path.GetTempPath(), "RocksmithToolkit");
            var updaterAppPath  = Path.Combine(localToolkitDir, APP_UPDATER);
            var updatingAppPath = Path.Combine(tempToolkitDir, APP_UPDATING);

            if (!File.Exists(updaterAppPath))
            {
                var errMsg = "Could not find file: " + APP_UPDATER + Environment.NewLine + "Please reinstall the toolkit manually.";
                BetterDialog2.ShowDialog(errMsg, "Toolkit Updater Error", null, null, "Ok", Bitmap.FromHicon(SystemIcons.Error.Handle), "Error", 150, 150);
                return;
            }

            // create temp process backup folder
            if (Directory.Exists(tempToolkitDir))
            {
                Directory.Delete(tempToolkitDir, true);
            }

            Directory.CreateDirectory(tempToolkitDir);

            try
            {
                // make a copy of AutoUpdater to prevent locking the process during update
                File.Copy(updaterAppPath, updatingAppPath, true);

                if (GeneralExtensions.IsInDesignMode) // allow updater to be run in design mode for developers
                {
                    var args = new string[] { localToolkitDir, tempToolkitDir };
                    using (var autoUpdater = new AutoUpdaterForm(args))
                        autoUpdater.Show();
                }
                else
                {
                    // passing args for process and backup directories to RocksmithToolkitUpdating.exe (Primary Usage Mode)
                    var cmdArgs = String.Format("\"{0}\" \"{1}\"", localToolkitDir, tempToolkitDir);

                    try // different AutoUpdater shells for MacWine testing
                    {
                        GeneralExtensions.RunExternalExecutable(updatingAppPath, arguments: cmdArgs);
                    }
                    catch (Exception ex)
                    {
                        // changed external process call for MacWine debugging
                        MessageBox.Show("Report hit updater try #2 to the developers: " + Environment.NewLine + ex.Message);

                        var startInfo = new ProcessStartInfo
                        {
                            FileName        = updatingAppPath,
                            Arguments       = cmdArgs,
                            UseShellExecute = false,
                            CreateNoWindow  = true, // hide command window
                        };

                        using (var updater = new Process())
                        {
                            updater.StartInfo = startInfo;
                            updater.Start();
                        }
                    }

                    // Kill current toolkit process now that AutoUpdater process is started
                    Environment.Exit(0);
                }
            }
            catch (ObjectDisposedException)
            {
                /* Do nothing  - user cancelled the download */
            }
            catch (Exception ex)
            {
                var errMsg = "Could not run file: " + APP_UPDATING + Environment.NewLine +
                             "Please reinstall the toolkit manually." + Environment.NewLine +
                             ex.Message;
                BetterDialog2.ShowDialog(errMsg, "Toolkit Updater Error", null, null, "Ok", Bitmap.FromHicon(SystemIcons.Error.Handle), "Error", 150, 150);
            }

            btnInstall.Enabled = true;
        }