Пример #1
0
        private void cleanseTxlGrammar()
        {
            string txlCommand = _txlcommand + _quiet + _fileOperations.GetTxlFilePath() + _parserFile + _stackSize + _toTempFile;

            if (_cmdRunner.ExecuteCommand(txlCommand))
            {
                _logger.LogMessage(_txlCleanseSuccess);
            }
            else
            {
                _logger.LogMessage(_txlCleanseFailed);
            }
        }
Пример #2
0
        internal bool InitProgram()
        {
            bool isPythonInstalled = CheckPythonInstall();

            if (!isPythonInstalled)
            {
                var message = "Для работы программы необходим Python3" +
                              Environment.NewLine +
                              "Установите Python3 и/или добавьте его в PATH" +
                              Environment.NewLine +
                              "Установить?" +
                              Environment.NewLine +
                              "После установки потребуется заново запустить приложение.";

                DialogResult dr = MessageBox.Show(message, mainForm.Text, MessageBoxButtons.OKCancel);

                if (dr == DialogResult.OK)
                {
                    CommandRunner.ExecuteCommand("python-3.7.3-amd64-webinstall.exe", string.Empty);
                }

                Application.Exit();

                return(false);
            }

            if (Settings.Default.IsFirstStart)
            {
                string message = "Подождите, идет установка" +
                                 Environment.NewLine +
                                 "библиотеки bezier";
                var action = new Action(() => CommandRunner.ExecuteCommand("pip", "install -U bezier"));
                mainForm.DoActionWithProgressBar(message, action);

                message = "Подождите, идет установка" +
                          Environment.NewLine +
                          "библиотеки scikit-fuzzy";
                action = new Action(() => CommandRunner.ExecuteCommand("pip", "install -U scikit-fuzzy"));
                mainForm.DoActionWithProgressBar(message, action);

                Settings.Default.IsFirstStart = false;
                Settings.Default.Save();
            }

            return(true);
        }
Пример #3
0
        internal IEnumerable <IDrawable> DoRequest(ImitationRequest imitationRequest)
        {
            var pythonScriptFilename = Settings.Default.PythonScriptFilename;
            var tempPath             = string.Empty;

            Reset();

            if (pythonScriptFilename == string.Empty)
            {
                pythonScriptFilename = ChangePythonScriptFilename();
            }

            if (isFirstRun)
            {
                tempPath = CreateTempDir();
            }

            string requestFilename  = Path.Combine(tempPath, RequestFilename);
            string responseFilename = Path.Combine(tempPath, ResponseFilename);

            JsonSaverLoader.Save(imitationRequest, requestFilename);

            string args = pythonScriptFilename + " " + requestFilename + " " + responseFilename;

            string[] result = CommandRunner.ExecuteCommand(PythonFilename, args);

            if (result[0] != PythonSuccessMessage)
            {
                mainForm.ShowError(result[1]);
                return(null);
            }

#if (!DEBUG)
            File.Delete(requestFilename);
#endif

            GetResponse(responseFilename, sceneObjects);
            return(sceneObjects as IEnumerable <IDrawable>);
        }