Exemplo n.º 1
0
 private void StopDatabase(StarcounterDB db)
 {
     backgroundWorker.Enqueue($"Stopping db {db.Name}", () =>
     {
         Run("staradmin", $"stop db {db.Name}");
         db.Running = false;
     });
 }
Exemplo n.º 2
0
 private void DeleteDB(StarcounterDB db, Action after = null)
 {
     backgroundWorker.Enqueue($"Deleting db {db.Name}", () =>
     {
         Run("staradmin", $"delete db {db.Name} --force");
         after?.Invoke();
     });
 }
Exemplo n.º 3
0
        public void UpdateRunningDBs()
        {
            try
            {
                ProcessStartInfo processStartInfo = ProcessHelper.CreateStartInfo("staradmin", "list db");
                Process          process          = new Process();
                process.StartInfo = processStartInfo;
                bool processStarted = process.Start();

                if (processStarted)
                {
                    //Get the output stream
                    process.WaitForExit();

                    //Display the result
                    StarcounterDB currentDB = null;
                    while (process.StandardOutput.Peek() > -1)
                    {
                        String line = process.StandardOutput.ReadLine().ToLower();
                        if (currentDB == null)
                        {
                            foreach (StarcounterDB db in All)
                            {
                                if (line.Contains(db.Name.ToLower()))
                                {
                                    currentDB = db;
                                }
                            }
                        }
                        else
                        {
                            if (line.Contains("running"))
                            {
                                currentDB.Running = line.Contains("true");
                                currentDB         = null;
                            }
                        }
                    }
                }
            }
            catch (Exception) {}
        }