Example #1
0
    public void LogLine(LogPlatform platform, string log)
    {
        switch (platform)
        {
        case LogPlatform.Windows:
            win_log += log + "\n";
            break;

        case LogPlatform.Mac:
            mac_log += log + "\n";
            break;

        case LogPlatform.Linux:
            lin_log += log + "\n";
            break;
        }
        logChanged = true;
    }
Example #2
0
    public void ClearLog(LogPlatform platform, string log)
    {
        return;

        switch (platform)
        {
        case LogPlatform.Windows:
            win_log = "";
            break;

        case LogPlatform.Mac:
            mac_log = "";
            break;

        case LogPlatform.Linux:
            lin_log = "";
            break;
        }
        logChanged = true;
    }
Example #3
0
    private static Process SpawnHelper(string helperPath, string helperName, LogPlatform pl, params object[] args)
    {
        ProcessStartInfo ps = new ProcessStartInfo();

        ps.FileName = Path.Combine(helperPath, helperName + ".exe");
        ps.RedirectStandardOutput = true;
        ps.UseShellExecute        = false;
        ps.CreateNoWindow         = true;

        ps.Arguments = string.Join(" ", args);

        Process p = new Process();

        p.StartInfo = ps;

        p.OutputDataReceived += (sender, e) => { HelperDataHandler(sender, e, pl); };
        //p.Exited += (sender, e) => { Debug.Log("HELPER EXIT"); foreach (var s in p.StandardOutput.ReadToEnd().Split('\n')) { HelperDataHandler(null, s, pl); } EditorApplication.UnlockReloadAssemblies(); };
        p.Start();

        p.BeginOutputReadLine();
        return(null);
    }
Example #4
0
 private static void ZipperThread(string fn, string df, bool r, string flt, string bld, string ufn, LogPlatform pl)
 {
     try
     {
         Debug.Log($"[{bld}] Starting zip for build");
         lock (zipMutex)
         {
             zipper.CreateZip(fn, df, r, flt);
             Debug.Log($"[{bld}] Zip finished for build");
         }
         Debug.Log($"[{bld}] Starting upload for build");
         //UploadFile(fn, "", bld, ufn, pl); //TODO: Make this shit work
         Debug.Log($"[{bld}] Upload started for build");
     }
     catch (ThreadAbortException e)
     {
         //F**k you unity :P
         Debug.LogError($"[{bld}] Unity pls stop cancelling my GOD DAMNED THREADS YOU ASSHOLE : {e.ToString()}");
     }
     catch (Exception e)
     {
         Debug.LogError($"[{bld}] Error zipping file: {e.ToString()}");
     }
 }
Example #5
0
 private static Thread ZipInNewThread(string fileName, string fileDir, bool recurse, string filter, string build, string uploadFilename, LogPlatform platform)
 {
     return(ThreadFactory.CreateAndRun(() => { ZipperThread(fileName, fileDir, recurse, filter, build, uploadFilename, platform); }));
 }
Example #6
0
 private static void HelperDataHandler(object sender, string e, LogPlatform p)
 {
     win.LogLine(p, e);
     Debug.Log(e);
 }
Example #7
0
 private static void HelperDataHandler(object sender, DataReceivedEventArgs e, LogPlatform p)
 {
     win.LogLine(p, e.Data);
     Debug.Log(e.Data);
 }
Example #8
0
 private static Process UploadFile(string fileName, string token, string bld, string dest, LogPlatform platform)
 {
     return(SpawnHelper(HELPER_PATH, UPLOAD_HELPER, platform, "-build", bld, "-file", fileName, "-dest", dest));
 }
Example #9
0
        /// <summary>
        /// Log
        /// </summary>
        /// <param name="strLog">Log内容</param>
        /// <param name="ErrorType">Log错误类型</param>
        /// <param name="bAddTime">是否加入时间戳</param>
        /// <param name="bSave">是否缓存Log</param>
        /// <param name="logPlatform">Log平台</param>
        public static void LogAndSave(string strLog, LogErrorType ErrorType = LogErrorType.Normal, bool bAddTime = true, bool bSave = true, LogPlatform logPlatform = LogPlatform.UnityDebug)
        {
            strLog = string.Format("Log : [{0}] {1}", strLog, bAddTime ? DateTime.Now.ToString("yy-MM-dd HH:mm:ss:fff") : "");

            if (bSave)
            {
                arrLog.Add(strLog);
            }

            switch (logPlatform)
            {
            case LogPlatform.UnityDebug:
                if (MyApplication.IsEditorRuntime())
                {
                    UnityEngine.Debug.Log(strLog);
                }
                break;

            case LogPlatform.Console:
                Console.WriteLine(strLog);
                break;

            default:

                break;
            }
        }
Example #10
0
        static string AdjustStrLogAtErrorType(string strLog, LogErrorType LogErrorType, LogPlatform logPlatform = LogPlatform.UnityDebug)
        {
            if (string.IsNullOrEmpty(strLog))
            {
                return(null);
            }

            strLog = string.Format("[ErrorType: {0}] {1}", LogErrorType, strLog);


            return(strLog);
        }
Example #11
0
 public Logger(LogPlatform logPlatform, string name)
 {
     this.LogPlatform = logPlatform;
     this.Name = name;
 }