Пример #1
0
        public void SaveTestInfo(TestInfoData data)
        {
            var json = JObject.FromObject(data).ToString();

            TestMetrics.CheckAndCreateFolder();
            File.WriteAllText(TestMetrics.PathTo("tests.json"), json);
        }
Пример #2
0
        public void SaveFPS(string tag)
        {
            FPSMetrics metrics = new FPSMetrics();
            string     textData;

            if (File.Exists(FPSMettricsFileFullPath))
            {
                try
                {
                    textData = File.ReadAllText(FPSMettricsFileFullPath);
                    metrics  = JObject.Parse(textData).ToObject <FPSMetrics>();
                }
                catch (Exception ex)
                {
                    Debug.LogWarning("file with fps metrics exists but can't be read " + ex.Message);
                }
            }

            metrics.Build = Application.version;
            var buildVersion = ConsoleArgumentHelper.GetArg("-buildNumber");

            if (!string.IsNullOrEmpty(buildVersion))
            {
                metrics.Build = metrics.Build + ":" + buildVersion;
            }

            if (metrics.Fps == null)
            {
                metrics.Fps = new Dictionary <string, FPSData>();
            }

            if (metrics.Fps.ContainsKey(tag))
            {
                tag = tag + "_" + Time.realtimeSinceStartup;
            }

            metrics.Fps.Add(tag, new FPSData
            {
                Min = MixFPS,
                Avg = AverageFPS,
                Max = MaxFPS
            });

            TestMetrics.CheckAndCreateFolder();

            textData = JObject.FromObject(metrics).ToString();
            File.WriteAllText(FPSMettricsFileFullPath, textData);
        }