Ejemplo n.º 1
0
        public static string ToCSV(UnityScripsCompileTimeKeyframe keyframe)
        {
            if (keyframe == null)
            {
                return("");
            }

            return(string.Format("{0},{1},{2}", keyframe._computedDate, keyframe.elapsedCompileTimeInMS, keyframe.hadErrors));
        }
Ejemplo n.º 2
0
        public static string Serialize(UnityScripsCompileTimeKeyframe keyframe)
        {
            if (keyframe == null)
            {
                return("");
            }

            return(string.Format("{1}{0}{2}{0}{3}", UnityScripsCompileTimeKeyframe.kKeyframeDelimiter, keyframe.elapsedCompileTimeInMS, keyframe.serializedDate, keyframe.hadErrors));
        }
Ejemplo n.º 3
0
        private static void LogCompileTimeKeyframe(UnityScripsCompileTimeKeyframe keyframe)
        {
            string compilationFinishedLog = "Compilation Finished, Elapsed time : " + TrackingUtils.FormatMSTime(keyframe.elapsedCompileTimeInMS);

            if (keyframe.hadErrors)
            {
                compilationFinishedLog += " (error)";
            }
            Debug.Log("<color=green>Unity Scripts Compiling Completed. </color>" + compilationFinishedLog);
        }
Ejemplo n.º 4
0
        private void Save()
        {
            while (this._compileTimeHistory.Count > UnityScripsCompileTimeTrackerData.kHistoryKeyframeMaxCount)
            {
                this._compileTimeHistory.RemoveAt(0);
            }

            EditorPrefs.SetInt(this._editorPrefKey + "._startTime", this._startTime);
            EditorPrefs.SetString(this._editorPrefKey + "._compileTimeHistory", UnityScripsCompileTimeKeyframe.SerializeList(this._compileTimeHistory));
        }
Ejemplo n.º 5
0
        public static List <UnityScripsCompileTimeKeyframe> DeserializeList(string serialized)
        {
            if (String.IsNullOrEmpty(serialized))
            {
                return(new List <UnityScripsCompileTimeKeyframe>());
            }

            string[] serializedKeyframes = serialized.Split(UnityScripsCompileTimeKeyframe.kListDelimiterArray, StringSplitOptions.None);

            return(serializedKeyframes.Select(s => UnityScripsCompileTimeKeyframe.Deserialize(s)).Where(k => k != null).ToList());
        }
        private static void HandleEditorFinishedCompiling()
        {
            int elapsedTime = TrackingUtils.GetMilliseconds() - UnityScripsCompileTimeTracker._Data.StartTime;

            UnityConsoleCountsByType countsByType = UnityEditorConsoleUtils.GetCountsByType();
            bool hasErrors = (countsByType.errorCount - UnityScripsCompileTimeTracker.StoredErrorCount) > 0;

            UnityScripsCompileTimeKeyframe keyframe = new UnityScripsCompileTimeKeyframe(elapsedTime, hasErrors);

            UnityScripsCompileTimeTracker._Data.AddCompileTimeKeyframe(keyframe);
            UnityScripsCompileTimeTracker.KeyframeAdded.Invoke(keyframe);
        }
Ejemplo n.º 7
0
        private void Load()
        {
            this._startTime = EditorPrefs.GetInt(this._editorPrefKey + "._startTime");
            string key = this._editorPrefKey + "._compileTimeHistory";

            if (EditorPrefs.HasKey(key))
            {
                this._compileTimeHistory = UnityScripsCompileTimeKeyframe.DeserializeList(EditorPrefs.GetString(key));
            }
            else
            {
                this._compileTimeHistory = new List <UnityScripsCompileTimeKeyframe>();
            }
        }
Ejemplo n.º 8
0
        public static UnityScripsCompileTimeKeyframe Deserialize(string serialized)
        {
            string[] tokens = serialized.Split(UnityScripsCompileTimeKeyframe.kKeyframeDelimiterArray, StringSplitOptions.None);
            if (tokens.Length != 3)
            {
                Debug.LogError("Failed to deserialize CompileTimeKeyframe because splitting by " + UnityScripsCompileTimeKeyframe.kKeyframeDelimiter + " did not result in 3 tokens!");
                return(null);
            }

            UnityScripsCompileTimeKeyframe keyframe = new UnityScripsCompileTimeKeyframe();

            keyframe.elapsedCompileTimeInMS = Convert.ToInt32(tokens[0]);
            keyframe.serializedDate         = tokens[1];
            keyframe.hadErrors = Convert.ToBoolean(tokens[2]);

            return(keyframe);
        }
Ejemplo n.º 9
0
 public void AddCompileTimeKeyframe(UnityScripsCompileTimeKeyframe keyframe)
 {
     this._compileTimeHistory.Add(keyframe);
     this.Save();
 }
Ejemplo n.º 10
0
        public static string ToCSV(List <UnityScripsCompileTimeKeyframe> keyframes)
        {
            string[] serializedKeyframes = keyframes.Where(k => k != null).Select(k => UnityScripsCompileTimeKeyframe.ToCSV(k)).ToArray();
            string   fields = "date,compile_time,had_errors\n";

            return(fields + string.Join("\n", serializedKeyframes));
        }
Ejemplo n.º 11
0
 public static string SerializeList(List <UnityScripsCompileTimeKeyframe> keyframes)
 {
     string[] serializedKeyframes = keyframes.Where(k => k != null).Select(k => UnityScripsCompileTimeKeyframe.Serialize(k)).ToArray();
     return(string.Join(UnityScripsCompileTimeKeyframe.kListDelimiter, serializedKeyframes));
 }