• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# InstallerLib.SetupConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestConfigLangID

 public void TestConfigLangID()
 {
     ConfigFile configFile = new ConfigFile();
     SetupConfiguration configuration = new SetupConfiguration();
     configFile.Children.Add(configuration);
     ComponentCmd cmd = new ComponentCmd();
     cmd.command = "cmd.exe /C exit /b #LANGID";
     cmd.required_install = true;
     configuration.language_id = "1234";
     configuration.Children.Add(cmd);
     string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
     Console.WriteLine("Writing '{0}'", configFilename);
     configFile.SaveAs(configFilename);
     Assert.AreEqual(1234, dotNetInstallerExeUtils.Run(configFilename));
     File.Delete(configFilename);
 }
开发者ID:ramiklein,项目名称:dotnetinstaller,代码行数:16,代码来源:LanguageUnitTests.cs


示例17: TestNoComponentsSuccess

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

            // a configuration with no components
            ConfigFile configFile = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();
            configFile.Children.Add(setupConfiguration);
            // 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);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:16,代码来源:ExitCodeUnitTests.cs


示例18: TestContinueOnError

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

            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);
            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;
            // 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(1, dotNetInstallerExeUtils.Run(configFilename));
            Assert.IsTrue(File.Exists(markerFilename1));
            Assert.IsFalse(File.Exists(markerFilename2));
            File.Delete(markerFilename1);
            // allow continue on error (user prompted) -> no effect, this is a prompt that defaults to false in silent mode
            cmd1.allow_continue_on_error = true;
            cmd2.allow_continue_on_error = true;
            configFile.SaveAs(configFilename);
            Assert.AreEqual(1, dotNetInstallerExeUtils.Run(configFilename));
            Assert.IsTrue(File.Exists(markerFilename1));
            Assert.IsFalse(File.Exists(markerFilename2));
            File.Delete(markerFilename1);
            // 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;
            configFile.SaveAs(configFilename);
            // the return code of the first failure is saved
            Assert.AreEqual(1, dotNetInstallerExeUtils.Run(configFilename));
            Assert.IsTrue(File.Exists(markerFilename1));
            Assert.IsTrue(File.Exists(markerFilename2));
            File.Delete(markerFilename1);
            File.Delete(markerFilename2);
            File.Delete(configFilename);
        }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:47,代码来源:ContinueOnErrorUnitTests.cs


示例19: TestLoadClear

 public void TestLoadClear()
 {
     ConfigFile configFile = new ConfigFile();
     SetupConfiguration setupConfiguration = new SetupConfiguration();
     ComponentCmd cmd = new ComponentCmd();
     setupConfiguration.Children.Add(cmd);
     setupConfiguration.Children.Add(cmd);
     configFile.Children.Add(setupConfiguration);
     string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
     configFile.SaveAs(configFilename);
     int previousConfigurationCount = configFile.ConfigurationCount;
     XmlDocument xmlConfigFile = new XmlDocument();
     xmlConfigFile.Load(configFilename);
     configFile.LoadXml(xmlConfigFile);
     Assert.AreEqual(previousConfigurationCount, configFile.ConfigurationCount);
     File.Delete(configFilename);
 }
开发者ID:Jairajp1992,项目名称:dotnetinstaller,代码行数:17,代码来源:ConfigFileTests.cs


示例20: TestControlLicenseResources

 public void TestControlLicenseResources()
 {
     InstallerLinkerArguments args = new InstallerLinkerArguments();
     string licenseFile = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".txt");
     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);
         ControlLicense license = new ControlLicense();
         license.LicenseFile = licenseFile;
         Console.WriteLine("Writing '{0}'", license.LicenseFile);
         File.WriteAllText(license.LicenseFile, "Lorem ipsum");
         setupConfiguration.Children.Add(license);
         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;
         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); 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cryptography.HashAlgorithmName类代码示例发布时间:2022-05-26
下一篇:
C# InstallerLib.ConfigFile类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap