Beispiel #1
0
        private void runPython()
        {
            PipeClient client;

            python = new PythonExecutor();

            if (!python.CanRun)
            {
                if (System.IO.File.Exists("Python35\\python.exe"))
                {
                    python = new PythonExecutor("Python35\\python.exe");
                }
                else if (MessageBox.Show("Unable to find python.\nDo you want to download an example interpreter from cheonghyun.com?", "IpcPythonCS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                         == System.Windows.Forms.DialogResult.Yes)
                {
                    PythonDownloader down = new PythonDownloader();
                    down.DownloadAndUnzip();

                    python = new PythonExecutor(down.PythonInterpreter.FullName);
                }
                else
                {
                    MessageBox.Show("This application cannot run without Python.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            python.RunScript("main.py");

            client = new PipeClient();
            client.Connect("calculator");

            calculator = new PyCalculator(client);
        }
Beispiel #2
0
        public void DownloadTest()
        {
            PythonDownloader downloder = new PythonDownloader();
            string           txt;

            downloder.DownloadAndUnzip("https://www.cheonghyun.com/download/test.zip");

            txt = System.IO.File.ReadAllText("test\\test.txt");

            Assert.AreEqual("test", txt, "Unable to download and extract the specified file from url.");
        }