GetPythonPath() 정적인 개인적인 메소드

static private GetPythonPath ( ) : string
리턴 string
예제 #1
0
        public static void HeartBeat(string apiKey, string file, bool write = false)
        {
            if (!PythonManager.IsPythonInstalled())
            {
                return;
            }

            string arguments = "--key " + apiKey +
                               " --file " + "\"" + file + "\"" +
                               " --plugin " + WakaTimeConstants.PLUGIN_NAME +
                               " --project " + Main.GetProjectName() +
                               " --verbose";

            if (Main.IsDebug)
            {
                UnityEngine.Debug.Log("Sending file: " + PythonManager.GetPythonPath() + " " + GetClientPath() +
                                      " " + arguments);
            }

            Process p = new Process {
                StartInfo =
                {
                    FileName               = PythonManager.GetPythonPath(),
                    Arguments              = "\"" + GetClientPath() + "\" " + arguments,
                    CreateNoWindow         = true,
                    WindowStyle            = ProcessWindowStyle.Hidden,
                    WorkingDirectory       = Application.dataPath,
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError  = true
                }
            };

            p.Start();

            if (Main.IsDebug)
            {
                var output = p.StandardOutput.ReadToEnd();
                if (output.Length > 0)
                {
                    UnityEngine.Debug.Log("Wakatime Output: " + output);
                }

                var errors = p.StandardError.ReadToEnd();
                if (errors.Length > 0)
                {
                    UnityEngine.Debug.LogError("Wakatime Error: " + errors);
                }
            }

            p.Close();
        }
예제 #2
0
        /// <summary>
        /// Sends a heart-beat to wakatime.
        /// Only works if the client is not installed.
        /// </summary>
        /// <param name="apiKey"></param>
        /// <param name="projectName"></param>
        /// <param name="file"></param>
        /// <param name="dataPath"></param>
        /// <param name="clientPath"></param>
        protected static void MakeRequest(string apiKey, string file, string projectName, string dataPath, string clientPath)
        {
            try
            {
                string arguments = "--key " + apiKey +
                                   " --file " + "\"" + file + "\"" +
                                   " --plugin " + WakaTimeConstants.PLUGIN_NAME +
                                   " --project " + "\"" + projectName + "\"" +
                                   " --verbose";

                if (Main.IsDebug)
                {
                    UnityEngine.Debug.Log("[wakatime] Sending file: " + file);
                }

                Process p = new Process
                {
                    StartInfo =
                    {
                        FileName               = PythonManager.GetPythonPath(),
                        Arguments              = "\"" + clientPath + "\" " + arguments,
                        CreateNoWindow         = true,
                        WindowStyle            = ProcessWindowStyle.Hidden,
                        WorkingDirectory       = dataPath,
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        RedirectStandardError  = true,
                    }
                };

                p.Start();
                p.WaitForExit(5000);

                UnityEngine.Debug.Log("[wakatime] Finished sending file " + file);
            }
            catch (Exception ex)
            {
                if (Main.IsDebug)
                {
                    UnityEngine.Debug.LogError("[wakatime] Error found while sending heartbeat to wakatime for file " + file + ": " + ex);
                }
            }
        }
        public static void HeartBeat(string apiKey, string file, bool write = false)
        {
            if (PythonManager.IsPythonInstalled())
            {
                string arguments = "--key " + apiKey
                                   + " --file " + file
                                   + " --plugin " + WakaTimeConstants.PLUGIN_NAME
                                   + " --project " + Main.GetProjectName()
                                   + " --verbose";

                if (Main.IsDebug)
                {
                    UnityEngine.Debug.Log("Sending file: " + PythonManager.GetPythonPath() + " " + GetClientPath() + " " + arguments);
                }

                Process p = new Process();
                p.StartInfo.FileName  = PythonManager.GetPythonPath();
                p.StartInfo.Arguments = GetClientPath() + " " + arguments;

                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;

                p.StartInfo.WorkingDirectory = Application.dataPath;

#if UNITY_EDITOR_WIN
                p.StartInfo.UseShellExecute = true;
#else
                p.StartInfo.UseShellExecute = false;
#endif


                p.Start();

//			UnityEngine.Debug.Log (p.StandardOutput.ReadToEnd ());
//			UnityEngine.Debug.Log (p.StandardError.ReadToEnd ());

                p.Close();
            }
        }