当前位置: 首页>>代码示例>>C#>>正文


C# InstallerLib.SetupConfiguration类代码示例

本文整理汇总了C#中InstallerLib.SetupConfiguration的典型用法代码示例。如果您正苦于以下问题:C# SetupConfiguration类的具体用法?C# SetupConfiguration怎么用?C# SetupConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SetupConfiguration类属于InstallerLib命名空间,在下文中一共展示了SetupConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestLoadMSLU

        public void TestLoadMSLU()
        {
            Console.WriteLine("TestLoadUnicows");

            if (File.Exists(dotNetInstallerExeUtils.RunOptions.DefaultLogFile))
                File.Delete(dotNetInstallerExeUtils.RunOptions.DefaultLogFile);
            ConfigFile configFile = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            options.loadMSLU = true;
            Assert.AreEqual(0, dotNetInstallerExeUtils.Run(options));
            File.Delete(configFilename);
            string[] logLines = File.ReadAllLines(dotNetInstallerExeUtils.RunOptions.DefaultLogFile);
            Console.WriteLine(logLines[0]);
            Assert.IsTrue(logLines[0].Contains("Loaded MSLU:"));
            string[] msluLine = logLines[0].Split(":".ToCharArray());
            string msluAddress = msluLine[msluLine.Length - 1].Trim();
            Console.WriteLine("MSLU loaded at: " + msluAddress);
            Assert.IsTrue(Int32.Parse(msluAddress, System.Globalization.NumberStyles.HexNumber) > 0);
            File.Delete(dotNetInstallerExeUtils.RunOptions.DefaultLogFile);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:25,代码来源:MSLUUnitTests.cs

示例2: TestRebootExitCode

        public void TestRebootExitCode()
        {
            Console.WriteLine("TestRebootExitCode");

            // reboot exit code doesn't override a previous error
            ConfigFile configFile = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            ComponentCmd cmd_error = new ComponentCmd();
            cmd_error.command = "cmd.exe /C exit /b 42";
            cmd_error.required_install = true;
            cmd_error.allow_continue_on_error = true;
            cmd_error.default_continue_on_error = true;
            setupConfiguration.Children.Add(cmd_error);
            ComponentCmd cmd_reboot = new ComponentCmd();
            cmd_reboot.command = "cmd.exe /C exit /b 3010";
            cmd_error.required_install = true;
            cmd_reboot.returncodes_reboot = "3010";
            setupConfiguration.Children.Add(cmd_reboot);
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            Assert.AreEqual(42, dotNetInstallerExeUtils.Run(configFilename));
            File.Delete(configFilename);
            dotNetInstallerExeUtils.DisableRunOnReboot();
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:26,代码来源:RebootUnitTests.cs

示例3: TestAutoStart

        public void TestAutoStart()
        {
            Console.WriteLine("TestAutoStart");

            ConfigFile configFile = new ConfigFile();
            // setup configuration
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            setupConfiguration.auto_start = true;
            setupConfiguration.auto_close_if_installed = true;
            setupConfiguration.installation_completed = string.Empty;
            setupConfiguration.installation_none = string.Empty;
            configFile.Children.Add(setupConfiguration);
            // marker that makes installed check succeeed after installation
            string markerFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            // dummy component
            ComponentCmd component = new ComponentCmd();
            setupConfiguration.Children.Add(component);
            component.command = string.Format("cmd.exe /C dir > \"{0}\"", markerFilename);
            InstalledCheckFile check = new InstalledCheckFile();
            check.filename = markerFilename;
            check.comparison = installcheckfile_comparison.exists;
            component.Children.Add(check);
            // configuration
            component.installcompletemessage = string.Empty;
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            options.quiet = false;
            options.reboot = false;
            Assert.AreEqual(0, dotNetInstallerExeUtils.Run(options));
            Assert.IsTrue(File.Exists(markerFilename));
            File.Delete(configFilename);
            File.Delete(markerFilename);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:35,代码来源:AutoStartUnitTests.cs

示例4: TestAllArgCmd

        public void TestAllArgCmd()
        {
            Console.WriteLine("TestAllArgCmd");

            ConfigFile configFile = new ConfigFile();
            // setup configuration
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            ComponentCmd component1 = new ComponentCmd();
            setupConfiguration.Children.Add(component1);
            component1.id = "cmd1";
            component1.display_name = "command 1";
            component1.command = "cmd.exe /C exit /b ";
            component1.required_install = true;
            ComponentCmd component2 = new ComponentCmd();
            setupConfiguration.Children.Add(component2);
            component2.id = "cmd2";
            component2.display_name = "command 2";
            component2.command = "cmd.exe /C exit /b ";
            component2.required_install = true;
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            options.args = "/ComponentArgs *:\"23\"";
            Assert.AreEqual(23, dotNetInstallerExeUtils.Run(options));
            File.Delete(configFilename);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:28,代码来源:ComponentArgsUnitTests.cs

示例5: TestFailingComponent

        public void TestFailingComponent()
        {
            Console.WriteLine("TestFailingComponent");

            // a configuration with a component that fails, complete command is not executed
            ConfigFile configFile = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            string markerFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".tmp");
            setupConfiguration.complete_command = string.Format("cmd.exe /C dir > \"{0}\"", markerFilename);
            setupConfiguration.complete_command_basic = setupConfiguration.complete_command;
            setupConfiguration.complete_command_silent = setupConfiguration.complete_command;
            ComponentCmd component = new ComponentCmd();
            setupConfiguration.Children.Add(component);
            component.command = "cmd.exe /C exit /b 123";
            component.required_install = true;
            // save config file
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            // execute dotNetInstaller
            Assert.AreEqual(123, dotNetInstallerExeUtils.Run(configFilename));
            File.Delete(configFilename);
            Assert.IsFalse(File.Exists(markerFilename));
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:25,代码来源:CompleteCommandUnitTests.cs

示例6: TestDisplayCab

        public void TestDisplayCab()
        {
            Console.WriteLine("TestDisplayCab");

            // create a self-extracting bootstrapper
            ConfigFile configFile = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            InstallerLinkerArguments args = new InstallerLinkerArguments();
            args.config = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", args.config);
            configFile.SaveAs(args.config);
            args.embed = true;
            args.apppath = Path.GetTempPath();
            // args.embedFiles = new string[] { Path.GetFileName(args.config) };
            args.output = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".exe");
            args.template = dotNetInstallerExeUtils.Executable;
            Console.WriteLine("Linking '{0}'", args.output);
            InstallerLinkerExeUtils.CreateInstaller(args);
            Assert.IsTrue(File.Exists(args.output));
            // execute dotNetInstaller
            Assert.AreEqual(0, dotNetInstallerExeUtils.Run(args.output, "/DisplayCab /qb"));
            File.Delete(args.config);
            File.Delete(args.output);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:25,代码来源:CabUnitTests.cs

示例7: TestLogConfigSpecified

        public void TestLogConfigSpecified()
        {
            Console.WriteLine("TestLogConfigSpecified");

            if (File.Exists(dotNetInstallerExeUtils.RunOptions.DefaultLogFile))
                File.Delete(dotNetInstallerExeUtils.RunOptions.DefaultLogFile);
            ConfigFile configFile = new ConfigFile();
            configFile.log_enabled = true;
            configFile.log_file = Path.Combine(Path.GetTempPath(), "TestLogConfigSpecified.log");
            if (File.Exists(configFile.log_file))
                File.Delete(configFile.log_file);
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            options.log = false;
            options.logfile = string.Empty;
            Assert.AreEqual(0, dotNetInstallerExeUtils.Run(options));
            File.Delete(configFilename);
            Assert.IsFalse(File.Exists(dotNetInstallerExeUtils.RunOptions.DefaultLogFile));
            Assert.IsTrue(File.Exists(configFile.log_file));
            File.Delete(configFile.log_file);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:25,代码来源:LoggingUnitTests.cs

示例8: TestDefaultSelectionInstall

        public void TestDefaultSelectionInstall()
        {
            Console.WriteLine("TestDefaultSelectionInstall");

            ConfigFile configFile = new ConfigFile();
            // setup configuration
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            // dummy component 1
            ComponentCmd component1 = new ComponentCmd();
            setupConfiguration.Children.Add(component1);
            component1.command = "cmd.exe /C exit /b 57";
            component1.required_install = true;
            component1.selected_install = false;
            // dummy component 2
            ComponentCmd component2 = new ComponentCmd();
            setupConfiguration.Children.Add(component2);
            component2.command = "cmd.exe /C exit /b 42";
            component2.required_install = true;
            component2.selected_install = true;
            // second component is selected and runs, not the first one
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            Assert.AreEqual(42, dotNetInstallerExeUtils.Run(options));
            // first component is selected and runs
            component1.selected_install = true;
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            Assert.AreEqual(57, dotNetInstallerExeUtils.Run(options));
            File.Delete(configFilename);
        }
开发者ID:ramiklein,项目名称:dotnetinstaller,代码行数:33,代码来源:SelectionUnitTests.cs

示例9: HideComponentIfInstalled_WithComponentAlreadyInstalledDuringInstallSequence_HidesComponent

        public void HideComponentIfInstalled_WithComponentAlreadyInstalledDuringInstallSequence_HidesComponent()
        {
            string dotNetInstallerExeFilePath = dotNetInstallerExeUtils.Executable;

            bool usingHtmlInstaller = dotNetInstallerExeFilePath.EndsWith("htmlInstaller.exe");

            // create configuration file
            ConfigFile configFile = new ConfigFile();

            // add a setup configuration
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);

            // add a component that is hidden if it's already installed
            ComponentCmd componentAlreadyInstalled = new ComponentCmd();
            componentAlreadyInstalled.hide_component_if_installed = true;
            setupConfiguration.Children.Add(componentAlreadyInstalled);

            // make the component appear to be already installed
            InstalledCheckFile existsCheck = new InstalledCheckFile();
            existsCheck.filename = dotNetInstallerExeUtils.Executable;
            existsCheck.comparison = installcheckfile_comparison.exists;
            componentAlreadyInstalled.Children.Add(existsCheck);

            // add another component that is not already installed
            ComponentCmd componentNotInstalled = new ComponentCmd();
            setupConfiguration.Children.Add(componentNotInstalled);

            // save the configuration file
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            configFile.SaveAs(configFilename);

            // execute dotNetInstaller
            string arguments = string.Format("/ConfigFile {0}", configFilename);
            using (Application dotNetInstaller = Application.Launch(new ProcessStartInfo(dotNetInstallerExeFilePath, arguments)))
            {
                // get the main install window
                Window mainWindow = dotNetInstaller.GetWindow("APPLICATION_NAME Installer", InitializeOption.NoCache);

                if (usingHtmlInstaller)
                {
                    // get all the checkboxes in the window
                    IUIItem[] checkBoxes = mainWindow.GetMultiple(SearchCriteria.ByControlType(typeof(CheckBox)));

                    // assert that there's only one checkbox
                    Assert.AreEqual(1, checkBoxes.Length);
                    Assert.AreEqual("command1 ", checkBoxes[0].Name);
                }
                else
                {
                    // using dotNetInstaller
                    // get the components list box
                    ListBox componentsList = mainWindow.Get<ListBox>();

                    // assert that only one component is in the list
                    Assert.AreEqual(1, componentsList.Items.Count);
                    Assert.AreEqual("command1 ", componentsList.Items[0].Name);
                }
            }
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:60,代码来源:UIUnitTests.cs

示例10: TestRunFileConfiguration

 public void TestRunFileConfiguration()
 {
     ConfigFile configFile = new ConfigFile();
     SetupConfiguration setupConfiguration = new SetupConfiguration();
     configFile.Children.Add(setupConfiguration);
     string configFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
     Console.WriteLine("Writing '{0}'", configFileName);
     configFile.SaveAs(configFileName);
     try
     {
         ProcessStartInfo pi = new ProcessStartInfo(InstallerEditorExeUtils.Executable, "\"" + configFileName + "\"");
         using (Application installerEditor = Application.Launch(pi))
         {
             string title = string.Format("Installer Editor - {0}", configFileName);
             Window mainWindow = installerEditor.GetWindow(title, InitializeOption.NoCache);
             Tree configurationTree = UIAutomation.Find<Tree>(mainWindow, "configurationTree");
             Assert.AreEqual("Config File", configurationTree.SelectedNode.Name);
             StatusStrip statusStrip = UIAutomation.Find<StatusStrip>(mainWindow, "statusStrip");
             WinFormTextBox statusLabel = (WinFormTextBox)statusStrip.Items[0];
             Assert.AreEqual(string.Format("Loaded {0}", configFileName), statusLabel.Text);
         }
     }
     finally
     {
         File.Delete(configFileName);
     }
 }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:27,代码来源:CommandLineParametersUnitTests.cs

示例11: TestLogAcceptsPathVariables

        public void TestLogAcceptsPathVariables()
        {
            Console.WriteLine("TestLogAcceptsPathVariables");

            string resolved_logfile = Path.Combine(Path.GetTempPath(), "TestLogAcceptsPathVariables.log");
            if (File.Exists(dotNetInstallerExeUtils.RunOptions.DefaultLogFile))
                File.Delete(dotNetInstallerExeUtils.RunOptions.DefaultLogFile);
            if (File.Exists(resolved_logfile))
                File.Delete(resolved_logfile);
            ConfigFile configFile = new ConfigFile();
            configFile.log_enabled = true;
            configFile.log_file = @"#TEMPPATH\TestLogAcceptsPathVariables.log";
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            options.log = false;
            options.logfile = string.Empty;
            Assert.AreEqual(0, dotNetInstallerExeUtils.Run(options));
            File.Delete(configFilename);
            Assert.IsTrue(File.Exists(resolved_logfile), string.Format("Missing {0}", resolved_logfile));
            Assert.IsFalse(File.Exists(dotNetInstallerExeUtils.RunOptions.DefaultLogFile));
            File.Delete(resolved_logfile);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:26,代码来源:LoggingUnitTests.cs

示例12: TestComponentWithoutCheck

 public void TestComponentWithoutCheck()
 {
     // a configuration with an optional component, complete command is executed
     ConfigFile configFile = new ConfigFile();
     SetupConfiguration setupConfiguration = new SetupConfiguration();
     string markerFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
     setupConfiguration.supports_uninstall = false; // otherwise would automatically switch to uninstall
     setupConfiguration.complete_command = string.Format("cmd.exe /C dir > \"{0}.ui\"", markerFilename);
     setupConfiguration.complete_command_basic = string.Format("cmd.exe /C dir > \"{0}.basic\"", markerFilename);
     setupConfiguration.complete_command_silent = string.Format("cmd.exe /C dir > \"{0}.silent\"", markerFilename);
     configFile.Children.Add(setupConfiguration);
     // required component that will run, but has no installed check
     ComponentCmd cmd1 = new ComponentCmd();
     setupConfiguration.Children.Add(cmd1);
     cmd1.command = "cmd.exe /C exit /b 0";
     // save config file
     string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
     Console.WriteLine("Writing '{0}'", configFilename);
     configFile.SaveAs(configFilename);
     // execute dotNetInstaller
     Assert.AreEqual(0, dotNetInstallerExeUtils.Run(configFilename));
     File.Delete(configFilename);
     Assert.IsFalse(File.Exists(markerFilename + ".silent"));
     File.Delete(markerFilename);
 }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:25,代码来源:CompleteCommandUnitTests.cs

示例13: TestPromptForOptionalNotSet

        public void TestPromptForOptionalNotSet()
        {
            Console.WriteLine("TestPromptForOptionalNotSet");

            // configuration with a required and optional component that will auto-start
            // and won't prompt or execute the optional component

            string markerFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            ConfigFile configFile = new ConfigFile();

            SetupConfiguration setupConfiguration = new SetupConfiguration();
            setupConfiguration.auto_start = true;
            setupConfiguration.auto_close_if_installed = true;
            setupConfiguration.prompt_for_optional_components = false;
            setupConfiguration.installation_completed = "";
            setupConfiguration.installation_none = "";
            configFile.Children.Add(setupConfiguration);

            // dummy required component
            ComponentCmd component_required = new ComponentCmd();
            setupConfiguration.Children.Add(component_required);
            component_required.required_install = true;
            component_required.supports_install = true;
            component_required.command = "dummy";

            InstalledCheckRegistry check_required = new InstalledCheckRegistry();
            check_required.fieldname = "";
            check_required.path = "SOFTWARE";
            check_required.comparison = installcheckregistry_comparison.exists;
            component_required.Children.Add(check_required);

            // dummy optional component
            ComponentCmd component_optional = new ComponentCmd();
            setupConfiguration.Children.Add(component_optional);
            component_optional.required_install = false;
            component_optional.supports_install = true;
            component_optional.command = string.Format("cmd.exe /C dir > \"{0}\"", markerFilename);

            InstalledCheckFile check_optional = new InstalledCheckFile();
            check_optional.filename = markerFilename;
            check_optional.comparison = installcheckfile_comparison.exists;
            component_optional.Children.Add(check_optional);

            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);

            // will not auto close since all components installed successfully
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            options.quiet = false;
            options.autostart = true;
            Assert.AreEqual(0, dotNetInstallerExeUtils.Run(options));

            Assert.IsFalse(File.Exists(markerFilename));

            File.Delete(configFilename);
        }
开发者ID:ramiklein,项目名称:dotnetinstaller,代码行数:58,代码来源:PromptForOptionalUnitTests.cs

示例14: TestEmbedSplashScreen

        public void TestEmbedSplashScreen()
        {
            InstallerLinkerArguments args = new InstallerLinkerArguments();
            try
            {
                Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
                string binPath = Path.GetDirectoryName(HttpUtility.UrlDecode(uri.AbsolutePath));
                ConfigFile configFile = new ConfigFile();
                SetupConfiguration setupConfiguration = new SetupConfiguration();
                configFile.Children.Add(setupConfiguration);
                ComponentCmd cmd = new ComponentCmd();
                cmd.command = "cmd.exe /C exit /b 0";
                setupConfiguration.Children.Add(cmd);
                args.config = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
                Console.WriteLine("Writing '{0}'", args.config);
                configFile.SaveAs(args.config);
                args.output = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".exe");
                Console.WriteLine("Linking '{0}'", args.output);
                args.template = dotNetInstallerExeUtils.Executable;

                string relativePathName = "res";
                bool usingHtmlInstaller = dotNetInstallerExeUtils.Executable.EndsWith("htmlInstaller.exe");
                if (usingHtmlInstaller)
                {
                    relativePathName = "Html";
                }

                args.splash = Path.Combine(dotNetInstallerExeUtils.Location, string.Format(@"..\{0}\banner.bmp", relativePathName));
                InstallerLib.InstallerLinker.CreateInstaller(args);
                // check that the linker generated output
                Assert.IsTrue(File.Exists(args.output));
                Assert.IsTrue(new FileInfo(args.output).Length > 0);
                using (ResourceInfo ri = new ResourceInfo())
                {
                    ri.Load(args.output);
                    Assert.IsTrue(ri.Resources.ContainsKey(new ResourceId("CUSTOM")));
                    List<Resource> custom = ri.Resources[new ResourceId("CUSTOM")];
                    Assert.AreEqual("RES_BANNER", custom[0].Name.Name);
                    Assert.AreEqual("RES_CONFIGURATION", custom[1].Name.ToString());
                    Assert.AreEqual("RES_SPLASH", custom[2].Name.ToString());
                }
                // execute with and without splash
                dotNetInstallerExeUtils.Run(args.output, "/qb");
                dotNetInstallerExeUtils.Run(args.output, "/qb /nosplash");
            }
            finally
            {
                if (File.Exists(args.config))
                    File.Delete(args.config);
                if (File.Exists(args.output))
                    File.Delete(args.output);
            }
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:53,代码来源:InstallerLinkerUnitTests.cs

示例15: TestContinueOnErrorNoMessage

        public void TestContinueOnErrorNoMessage()
        {
            Console.WriteLine("TestContinueOnErrorNoMessage");

            // test that with all failed_exec_command_continue blanked,
            // user is never asked a question in full UI mode (not blocked)
            ConfigFile configFile = new ConfigFile();
            string markerFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            string markerFilename1 = string.Format("{0}.1", markerFilename);
            string markerFilename2 = string.Format("{0}.2", markerFilename);
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            // running in full UI mode, auto-start
            setupConfiguration.auto_start = true;
            // running in full UI mode, installation is expected to fail, auto-close
            setupConfiguration.auto_close_on_error = true;
            setupConfiguration.installation_none = string.Empty;
            setupConfiguration.installation_completed = string.Empty;
            ComponentCmd cmd1 = new ComponentCmd();
            setupConfiguration.Children.Add(cmd1);
            cmd1.command = string.Format("cmd.exe /C dir > \"{0}\" & exit /b 1", markerFilename1);
            cmd1.required_install = true;
            ComponentCmd cmd2 = new ComponentCmd();
            setupConfiguration.Children.Add(cmd2);
            cmd2.command = string.Format("cmd.exe /C dir > \"{0}\" & exit /b 2", markerFilename2);
            cmd2.required_install = true;
            // continue on error by default -> continues on the first and the second component, returns the last error code
            cmd1.default_continue_on_error = true;
            cmd2.default_continue_on_error = true;
            // remove all continue or stop error messages
            setupConfiguration.failed_exec_command_continue = "";
            cmd1.failed_exec_command_continue = "";
            cmd1.failed_exec_command_continue = "";
            cmd2.failed_exec_command_continue = "";
            // save config file
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);
            // the return code of the first failure is saved
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename);
            // all continue error messages are blank, nothing should popup to block the test
            options.quiet = false;
            Assert.AreEqual(1, dotNetInstallerExeUtils.Run(options));
            Assert.IsTrue(File.Exists(markerFilename1));
            Assert.IsTrue(File.Exists(markerFilename2));
            File.Delete(markerFilename1);
            File.Delete(markerFilename2);
            File.Delete(configFilename);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:49,代码来源:ContinueOnErrorUnitTests.cs


注:本文中的InstallerLib.SetupConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。