コード例 #1
0
        public static void Birth(FileInfo exe, SmartFeedback feedback, bool execute)
        {
            feedback.Text("Start process '" + exe.FullName + "'");
            if (!exe.Exists)
            {
                feedback.Text(" file not found", null, feedback.ErrorColor);
            }
            else
            {
                if (execute)
                {
                    Process.Start(exe.FullName);
                    feedback.Text(" started", null, Colors.Green);
                }
            }

            feedback.LineBreak();
        }
コード例 #2
0
        public static string ExecuteProcess(SmartFeedback feedback, string exePath, string args, bool execute)
        {
            string result = null;
            if (!File.Exists(exePath))
            {
                feedback.Text("file not found:" + exePath, null, feedback.ErrorColor).LineBreak();
                result = "sln file not found";
            }
            else
            {
                //    const string msBuild = @"c:\windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe";
                //    slnFullName += " /t:rebuild /verbosity:minimal "; // /verbosity:quiet  /verbosity:minimal /verbosity:detailed, 
                //    feedback.LineBreak().Text(msBuild + " " + slnFullName, null, Colors.Gray).LineBreak();
                //    if (execute)
                //    {
                //        var proc = new Process
                //        {
                //            StartInfo = new ProcessStartInfo
                //            {
                //                FileName = msBuild,
                //                Arguments = slnFullName,
                //                UseShellExecute = false,
                //                RedirectStandardOutput = true,
                //                CreateNoWindow = true
                //            }
                //        };
                //        proc.Start();
                //        string all = null;
                //        while (!proc.StandardOutput.EndOfStream)
                //        {
                //            string line = proc.StandardOutput.ReadLine();
                //            all += line + "\n";
                //            feedback.Text(line, null, Colors.Blue).LineBreak();
                //        }
                //        if (all != null && all.Contains(": error M"))
                //        {
                //            buildResult = all;
                //        }
                //        else
                //        {
                //            buildResult = null;
                //        }

                //        proc.WaitForExit();
                //        Thread.Sleep(200);

                //        feedback.Text("BUILD DONE", null, Colors.Black, true).LineBreak();

                //    }
                //    else
                //    {
                //        buildResult = null;
                //    }
            }

            return result;
        }
コード例 #3
0
        public static void Kill(SmartFeedback feedback, bool execute, string processName)
        {
            feedback.Text("kill process '" + processName + "'").LineBreak();

            Process p = GetProcessByName(processName);

            if (p != null)
            {
                if (execute)
                {
                    p.Kill();
                    feedback.Text(" killed", null, Colors.Green);
                }
            }
            else
            {
                feedback.Text(" no process by that name", null, Colors.Green);
            }
            feedback.LineBreak();
        }
コード例 #4
0
        public void DisplayDatabaseInfo(SmartFeedback feedback, bool execute)
        {
            const string cnn = "mongodb://localhost";
            const string dataFolder = @"c:\mongodb\data";
            const string logFolder = @"c:\mongodb\log\mongod.log";
            const string mongoConfigFile = @"c:\mongodb\mongod.cfg";

            feedback.LineBreak().LineBreak().LineBreak();
            feedback.Text("STEP - Display MongoDB Info", feedback.HeaderFontSize, feedback.HeaderColor).LineBreak();
            feedback.Text("MongoDB connection:").Text(cnn, null, Colors.Blue).LineBreak();
            feedback.Text("MongoDB data folder:").Text(dataFolder, null, Colors.Blue).LineBreak();
            feedback.Text("MongoDB log folder:").Text(logFolder, null, Colors.Blue).LineBreak();
            feedback.Text("MongoDB config file:").Text(mongoConfigFile, null, Colors.Blue).LineBreak();

            string dbName = "";
            if (execute)
            {
                dbName = MongoCnn.GetDbConnection().Name;
            }
            feedback.Text("MongoDB database:").Text(dbName, null, Colors.Blue).LineBreak();
            feedback.LineBreak();
        }