Beispiel #1
0
        public void init()
        {
            //
            //Init ExceptionHandler
            //
            ConcreteExceptionHandlerInitializer.initThisExceptionHandler(
                ExceptionHandler.Concrete.ExceptionHandler.getInstance());
            //
            //Read ini-files
            //
            ConfigReader configReader = new ConfigReader();

            configReader.read();
            components.config = configReader.getConfig();
            //
            //Read computers name
            //
            string command = @"/C hostname";
            WorkWithWindowsCommandLine wwwcl = new WorkWithWindowsCommandLine();

            components.config.serversHost = wwwcl.Run_command(command);
            components.config.serversHost = components.config.serversHost.Remove(components.config.serversHost.Length - 2, 2);
            //
            //CommandStore
            //
            components.commandsStore = new ConcreteCommandStore();
            //
            //Model
            //
            components.model = new ParseModel();
        }
        public void createTaskForTasksManadger(int timeModificator, bool horly, string programsPath)
        {
            string command;

            if (!horly)
            {
                command = @"/C SCHTASKS /Create /SC MINUTE /MO " + timeModificator +
                          " /TR " + programsPath +
                          "\\RunServerKeyLogsParser.bat /TN FlexLMParser";
            }
            else
            {
                command = @"/C SCHTASKS /Create /SC HOURLY /MO " + timeModificator +
                          " /TR " + programsPath +
                          "\\RunServerKeyLogsParser.bat /TN FlexLMParser";
            }
            //в переменную check записываю значение только чтобы не создавать
            //новую переменную, здесь просто лежит ответ командной строки
            WorkWithWindowsCommandLine wwwcl = new WorkWithWindowsCommandLine();
            string check = wwwcl.Run_command(command);

            if (check == "")
            {
                string       message = "Не удалось создать задание для планировщика заданий.";
                string       caption = "Ошибка";
                DialogResult result;
                result = MessageBox.Show(message, caption);
            }
        }