Esempio n. 1
0
        private static void WriteToFile(
            StreamWriter file,
            StatisticsDataLogger.StatData data,
            int height)
        {
            string str1 = "";

            for (int index = 0; index < height; ++index)
            {
                str1 += "|  ";
            }
            if (!data.Identifier.IsFiltered && data.Details.Count > 0)
            {
                string str2 = str1 + " -";
                foreach (string detail in data.Details)
                {
                    file.WriteLine(str2 + detail);
                }
            }
            foreach (StatisticsDataLogger.StatData child in data.Children)
            {
                file.WriteLine(str1 + child.Identifier.Description + "  : " + (object)child.Number);
                StatisticsDataLogger.WriteToFile(file, child, height + 1);
            }
        }
Esempio n. 2
0
 static StatisticsDataLogger()
 {
     StatisticsDataLogger._logTypes = new Dictionary <uint, StatisticsDataLogger.StatData>();
     StatisticsDataLogger._rootData = new StatisticsDataLogger.StatData(new StatisticsDataIdentifier("LOG"), (StatisticsDataLogger.StatData)null);
     StatisticsDataLogger._logTypes.Add(StatisticsDataLogger._rootData.Identifier.UniqueId, StatisticsDataLogger._rootData);
     StatisticsDataLogger._versionNo = 0;
     StatisticsDataLogger.ClearLogs();
 }
Esempio n. 3
0
 public static void ClearLogs(StatisticsDataIdentifier clearCategory = null)
 {
     StatisticsDataLogger.StatData statData = StatisticsDataLogger._rootData;
     if (clearCategory != null)
     {
         statData = StatisticsDataLogger._logTypes[clearCategory.UniqueId];
     }
     statData.Clear();
     while (File.Exists(StatisticsDataLogger.GetFileName()))
     {
         ++StatisticsDataLogger._versionNo;
     }
 }
Esempio n. 4
0
 public static void Save(StatisticsDataIdentifier mask = null, string header = "")
 {
     using (StreamWriter file = new StreamWriter(StatisticsDataLogger.GetFileName()))
     {
         file.WriteLine("Application Time: " + (DateTime.Now - StatisticsDataLogger._applicationStartTime).ToString("G"));
         file.WriteLine("------------------------------------------");
         file.WriteLine(header);
         file.WriteLine("------------------------------------------");
         file.WriteLine("------------------------------------------");
         if (mask != null)
         {
             StatisticsDataLogger.WriteToFile(file, StatisticsDataLogger._logTypes[mask.UniqueId], 0);
         }
         else
         {
             StatisticsDataLogger.WriteToFile(file, StatisticsDataLogger._rootData, 0);
         }
     }
 }
Esempio n. 5
0
 public static string GetFileName() => StatisticsDataLogger.GetPath() + "Stats_" + StatisticsDataLogger._applicationStartTime.ToString("yyyy_MM_dd_HH_mm_ss") + "_v" + (object)StatisticsDataLogger._versionNo + ".txt";