示例#1
0
        public string RunPython(string args)
        {
            string pythonExePath = Ini.IniFile.GetValue("Python", "ExePath");

            if (System.IO.File.Exists(pythonExePath))
            {
                return(DOSPrompt.CMDAutomate(args, pythonExePath));
            }
            else
            {
                return("error: " + pythonExePath + " not correct.");
            }
        }
示例#2
0
        public static string RunPythonFile(string fileName, string args)
        {
            string pythonExePath = Ini.IniFile.GetValue("Python", "ExePath");

            if (System.IO.File.Exists(pythonExePath))
            {
                string pythonFilePath  = "\"" + System.Windows.Forms.Application.StartupPath + "\\PythonFiles\\" + fileName + "\" ";
                string pythonFilePath2 = System.Windows.Forms.Application.StartupPath + "\\PythonFiles\\" + fileName;
                if (System.IO.File.Exists(pythonFilePath2))
                {
                    return(DOSPrompt.CMDAutomate(pythonFilePath + args, pythonExePath));
                }
                else
                {
                    return("error : " + pythonExePath + " not found.");
                }
            }
            else
            {
                return("error : " + pythonExePath + " not found.");
            }
        }
示例#3
0
        private void shellControl1_CommandEntered(object sender, CommandEnteredEventArgs e)
        {
            if (!ProcessInternalCommand(e.Command))
            {
                if (rbDos.Checked)
                {
                    string s = DOSPrompt.CMDAutomate(e.Command);
                    shellControl1.WriteText(s);
                    txtLastOutput.Text = s;
                }

                if (rbASCII.Checked)
                {
                    byte[] r = Common.SendBytes(txtIP.Text, txtPort.Text, ASCIIEncoding.ASCII.GetBytes(e.Command));
                    shellControl1.WriteText(ASCIIEncoding.ASCII.GetString(r));
                }

                if (rbHEX.Checked)
                {
                    byte[] r = Common.SendBytes(txtIP.Text, txtPort.Text, Common.GetBytesFromHex(e.Command));
                    shellControl1.WriteText(ASCIIEncoding.ASCII.GetString(r));
                }
            }
        }