Пример #1
0
        /// <summary>
        /// Function bound to LoadInstallerBtn
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadInstallerBtn_Click(object sender, EventArgs e)
        {
            CleanINFFile();
            CleanSetupFile();
            InstallerDialog.InitialDirectory = WorkingDir;
            InstallerDialog.Filter           = "Aslain's Modpack Installer |*.exe";
            InstallerDialog.DefaultExt       = ".exe";
            InstallerDialog.FileName         = "";
            DialogResult result = InstallerDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                installer_label.ForeColor = Color.Green;
                installer_label.Text      = "LOADED";
                InstallerFileName         = InstallerDialog.FileName.Substring(InstallerDialog.FileName.LastIndexOf('\\') + 1);
                Logger.AppendText($"{InstallerFileName}\nSuccessfully loaded!\n\n");
                loadInfBtn.Enabled = true;
                if (InstallerFileName.Contains("WoT"))
                {
                    GameName = "WoT";
                }
                else if (InstallerFileName.Contains("WoWs"))
                {
                    GameName = "WoWs";
                }
                RepaintLogger();
                File.Copy(InstallerDialog.FileName, WorkingDir + "\\LOADINF_temp\\aslains_installer.exe", true);
            }
        }
Пример #2
0
 /// <summary>
 /// Public methods are called from the Form that implements all UI.
 /// </summary>
 #region Public Methods
 public static void StartEngine(InstallerDialog ui)
 {
     DebugLog("StartEngine starting");
     m_user_interface = ui;
     InitializeAsync(Program.m_options.InstallerFile);
     m_user_interface.ShowInitializationDialog();
     DebugLog("StartEngine ending");
 }
Пример #3
0
        static int Main(string[] args)
        {
//#if DEBUG
//      StringBuilder sb = new StringBuilder();
//      foreach (string s in args)
//        sb.Append(s).Append("\n");
//      MessageBox.Show("Attach Debugger\n\n"+sb.ToString());
//#endif

            // Initialize Logger
            string logfile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            logfile = Path.Combine(logfile, @"McNeel\Rhinoceros\5.0\logs\RhinoInstallerLog.log");

            InstallerPhase returnCode = InstallerPhase.Unknown;

            Logger.LogFile = logfile;
            Logger.SetLogLevel(LogLevel.Debug);

            try
            {
                m_options.SetOptions(args);
                Logger.LogFile = m_options.LogFilePath;
                Logger.SetLogLevel(m_options.LogLevel);
                WriteVersionInfoToLog(args);

                while (true)
                {
                    if (m_options.InspectRhinoPath != null)
                    {
                        returnCode = RhinoInfo.InspectRhinoAndWriteXml(m_options.InspectRhinoPath, m_options.InspectWorkingDirectory);
                        break;
                    }

                    if (m_options.InspectPluginPath != null)
                    {
                        returnCode = PackageInstallerPlugin.InspectPlugin(m_options.InspectPluginPath);
                        break;
                    }

                    if (m_options.Locale != null)
                    {
                        Rhino.UI.Localization.SetLanguageId(m_options.Locale.LCID);
                    }

                    if (m_options.InstallPackagesForRhino)
                    {
                        RhinoInitializer init = new RhinoInitializer(m_options.Locale, m_options.RhinoSdkVersionNumber);
                        init.SetPackageFolder(m_options.PackageFolder);
                        returnCode = (InstallerPhase)init.InstallPackages();
                        break;
                    }

                    // At this point, we're going to actually execute an .rhi file.
                    // Make sure we have one to execute, lest we throw an exception later.
                    if (string.IsNullOrEmpty(m_options.InstallerFile))
                    {
                        Logger.Log(LogLevel.Error, "Package not specified on command line.");
                        returnCode = InstallerPhase.PackageNotSpecified;
                        break;
                    }
                    if (!File.Exists(m_options.InstallerFile))
                    {
                        Logger.Log(LogLevel.Error, string.Format("Package not found: '{0}'", m_options.InstallerFile));
                        returnCode = InstallerPhase.PackageNotFound;
                        break;
                    }

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    //var fake = new InitializingRhinoDialog();
                    //fake.ShowDialog();

                    m_dlg = new InstallerDialog();

                    if (m_options.SilentInstall)
                    {
                        m_dlg.ShowInTaskbar = false;
                        m_dlg.Size          = new System.Drawing.Size(0, 0);
                        m_dlg.StartPosition = FormStartPosition.Manual;
                        m_dlg.Location      = new System.Drawing.Point(-5000, -5000);
                    }
                    else
                    {
                        m_dlg.StartPosition = FormStartPosition.CenterScreen;
                    }
                    Application.Run(m_dlg);

                    returnCode = InstallerEngine.CurrentPhase();

                    break;
                }
            }
            catch (PackageNotCompatibleException ex)
            {
                Logger.Log(LogLevel.Error, ex);
                returnCode = InstallerPhase.InspctPkgNotCompatible;
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Error, ex);
                returnCode = InstallerPhase.Exception;
            }

            Logger.Log(LogLevel.Debug, string.Format("FinalExit\tExiting installation with return code {0}", returnCode));
            WriteFooterToLog();

            switch (returnCode)
            {
            case InstallerPhase.Success:
            case InstallerPhase.AlreadyInstalled:
            case InstallerPhase.AlreadyRunning:
            case InstallerPhase.PackageNotSpecified:
                break;

            default:
#if !DEBUG
                UploadErrorReport();
#endif
                break;
            }

            return((int)returnCode);
        }