示例#1
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     DebugLog("Next Button Clicked");
     if (InstallerEngine.CurrentPhase() == InstallerPhase.Initialized)
     {
         InstallerEngine.InstallAsync();
     }
     else
     {
         InstallerEngine.EndInstallation();
     }
 }
示例#2
0
 private void InstallerDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (InstallerEngine.CurrentPhase() == InstallerPhase.Complete || InstallerEngine.CurrentPhase() == InstallerPhase.Success)
     {
         // Do nothing; everything finished successfully.
     }
     else
     {
         DebugLog("InstallerDialog_FormClosing starting");
         InstallerEngine.CancelInstallation();
         DebugLog("InstallerDialog_FormClosing ending");
     }
 }
示例#3
0
文件: Program.cs 项目: Crae/rhiexec
        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);
        }