Example #1
0
        public void TestConsoleCallerPython()
        {
            var process = new Process();

            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardInput  = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.WorkingDirectory       = @"C:\";
            process.StartInfo.FileName  = Path.Combine(Environment.SystemDirectory, "cmd.exe");
            process.StartInfo.Arguments = @"/c ""C:\python27\python.exe -i""";
            using (ProcessLauncher launcher = new ProcessLauncher(this, process))
            {
                launcher.consoleOutlineEvent += this.onConsoleOutputDataReceived;
                launcher.consoleErrorEvent   += this.onConsoleErrortDataReceived;
                try
                {
                    launcher.Start();
                    launcher.SendInput("import sys;\n");
                    launcher.SendInput("print \"Test.\";\n");
                }
                finally
                {
                    launcher.SendInput("exit()");
                }
            }
        }
Example #2
0
        public void Start(string Domain, string UserName, string Password, bool CreateWindow)
        {
            // Create the worker shell...
#if true
            CommandPrompt.StartInfo.UseShellExecute = false;        // Required to enable RedirectStandard...
            CommandPrompt.StartInfo.CreateNoWindow  = !CreateWindow;
            CommandPrompt.StartInfo.FileName        = "cmd.exe";
            CommandPrompt.StartInfo.Arguments       = "";
            //CommandPrompt.StartInfo.RedirectStandardError = true;
            //CommandPrompt.StartInfo.RedirectStandardInput = true;
            //CommandPrompt.StartInfo.RedirectStandardOutput = true;
            CommandPrompt.StartInfo.RedirectStandardInput  = false;
            CommandPrompt.StartInfo.RedirectStandardOutput = false;
            CommandPrompt.StartInfo.RedirectStandardError  = false;

            CommandPrompt.StartInfo.Domain              = Domain;
            CommandPrompt.StartInfo.UserName            = UserName;
            CommandPrompt.StartInfo.PasswordInClearText = Password;

            CommandPrompt.StartInfo.LoadUserProfile = true;         // Instructs the launcher to load the user's profile into HKEY_CURRENT_USER.
#else
            CommandPrompt = new TrimProcessLauncher();
#endif

            CommandPrompt.Start();
            //StandardOutput = new PipeReader(CommandPrompt.StandardOutput, "StdOut");
            //StandardError = new PipeReader(CommandPrompt.StandardError, "StdErr");
        }
Example #3
0
        public void TestConsoleCaller()
        {
            var process = new Process();

            process.StartInfo.CreateNoWindow         = false;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.RedirectStandardInput  = true;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.WorkingDirectory       = @"d:\IpmiTool-1.8.11.i4-win";
            process.StartInfo.FileName = Path.Combine(Environment.SystemDirectory, "cmd.exe");

            //process.StartInfo.FileName = Path.Combine(@"d:\IpmiTool-1.8.11.i4-win", "ipmitool.exe");
            //process.StartInfo.Arguments = " -I lanplus -H 10.23.60.3 -U root -P superuser -b 6 -t 44 raw 6 1";

            using (ProcessLauncher launcher = new ProcessLauncher(this, process))
            {
                launcher.consoleOutlineEvent += this.onConsoleOutputDataReceived;
                launcher.consoleErrorEvent   += this.onConsoleErrortDataReceived;
                try
                {
                    launcher.Start();
                    //launcher.SendInput(string.Format(" -I lanplus -H 10.23.60.3 -U root -P superuser -b 6 -t 44 raw 6 1{0}", Convert.ToChar(0x0d)));
                    //launcher.SendInput(string.Format("d:{0}", Convert.ToChar(0x0d)));
                    //launcher.SendInput(string.Format(@"cd d:\IpmiTool-1.8.11.i4-win{0}", Convert.ToChar(0x0d)));
                    //launcher.SendInput(string.Format("dir{0}", Convert.ToChar(0x0d)));
                }
                finally
                {
                    //launcher.SendInput("exit()");
                }
            }
        }
        private static void InstallNpmPackage(string packageName)
        {
            Trace.WriteLine($"Attempting to install {packageName} through NPM");

            var processLauncher = new ProcessLauncher();
            var npmPath         = NpmHelper.GetNpmPath();

            processLauncher.Start(
                npmPath,
                $"install -g {packageName}");

            Trace.WriteLine($"{packageName} installed successfully through NPM");
        }
Example #5
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine(AppResources.ApplicationName);

                using (IChromiumUpdateEngine updateEngine = ChromiumUpdateEngineFactory.CreateInstance(new ChromiumUpdateEngineConfiguration()
                {
                    WebProxyType = ProxyType.None
                }))
                {
                    ChromiumRegistryInfo chromiumRegistryInfo = updateEngine.GetChromiumRegistryInfo();
                    String     latestVersion    = updateEngine.GetChromiumLatestVersionString();
                    changelogs releaseChangeLog = updateEngine.GetChromiumVersionChangeLogData(latestVersion);

                    Console.WriteLine(AppResources.LatestChromiumVersion, latestVersion);
                    Console.WriteLine(AppResources.CurrentInstalledChromiumVersion, chromiumRegistryInfo != null ? chromiumRegistryInfo.ToString() : AppResources.None);

                    Console.WriteLine(AppResources.DownloadingChromium, latestVersion);

                    String targetFileName = null;
                    updateEngine.DownloadChromiumInstaller(Path.GetTempPath(), latestVersion, false, (x) =>
                    {
                        if (x.FileDownloadState == FileDownloadState.Starting)
                        {
                            targetFileName = x.FileName;
                        }

                        switch (x.FileDownloadState)
                        {
                        case FileDownloadState.Starting:
                            break;

                        case FileDownloadState.Downloading:
                            DrawTextProgressBar(x.BytesReceived, x.TotalBytesToReceive);
                            break;

                        case FileDownloadState.Completed:
                            break;

                        default:
                            break;
                        }

                        return(true);
                    });

                    Console.WriteLine();
                    Console.WriteLine(AppResources.LaunchingInstaller);
                    Console.WriteLine();

                    using (ProcessLauncher processLauncher = new ProcessLauncher())
                    {
                        processLauncher.FileName = targetFileName;
                        if (!processLauncher.Start(true, TimeSpan.FromSeconds(60 * 2)))
                        {
                            Console.WriteLine(AppResources.ChildProcessFailure);
                        }
                    }

                    ChromiumRegistryInfo updatedChromiumRegistryInfo = updateEngine.GetChromiumRegistryInfo();

                    if (updatedChromiumRegistryInfo != null)
                    {
                        Console.WriteLine(updatedChromiumRegistryInfo.ToString());
                    }

                    Console.WriteLine(AppResources.Done);


                    if (releaseChangeLog != null)
                    {
                        Console.WriteLine(releaseChangeLog.ConcatenatedText);
                        Console.WriteLine();

                        releaseChangeLog.log.ForEach(x =>
                        {
                            Console.WriteLine("{0}: {1}@{2}", x.revision, x.author.Trim(), x.date);
                            Console.WriteLine("{0}", x.msg.Trim());
                        }
                                                     );
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(AppResources.Error, ex.Message);
            }
        }