Exemple #1
0
        /// <summary>
        /// Выполнить программу и сохранить результаты выполнения
        /// </summary>
        /// <param name="path">Путь к директории, в которой находится exe-файл</param>
        /// <param name="exeName">Имя исполняемого файла, который нужно исполнить</param>
        public Executor(string path, string exeName)
        {
            string _fullPathDirectory = FileSystemInspector.getFullPathDirectory(path);
            string _fullPathExe       = _fullPathDirectory + Settings.delimiter + exeName;

            // Исполняем exe-файл
            using (ProcessDriver pd = new ProcessDriver(_fullPathExe))
            {
                pd.execute();
                _output     = pd.standardOutput;
                _returnCode = pd.returnCode;
            }

            // Записываем  вывод программы в файл
            File.WriteAllText(_fullPathDirectory + Settings.delimiter + executionLogName, _output);
            _operationCompleted = true;
        }
Exemple #2
0
        public Compiler(string path, string programm)
        {
            _path     = path;
            _fullPath = FileSystemInspector.getFullPathDirectory(_path);

            // Записываем текст программы в файл
            File.WriteAllText(_path + Settings.delimiter + textOfProgrammName, programm);

            // Делаем компиляцию
            using (ProcessDriver pd = new ProcessDriver(Settings.compilerPath, _fullPath, textOfProgrammName))
            {
                pd.execute();
                _output = pd.standardOutput;
            }

            // Записываем в compilation log логи компиляции
            File.WriteAllText(_path + Settings.delimiter + compilationNameLog, _output);

            if (File.Exists(_path + Settings.delimiter + exeName))
            {
                _name = exeName;
                _operationCompleted = true;
            }
        }