Exemple #1
0
 public static void RegisterDataIdentifier(
     StatisticsDataIdentifier value,
     StatisticsDataIdentifier parent)
 {
     if (parent == null)
     {
         parent = StatisticsDataLogger._rootData.Identifier;
     }
     StatisticsDataLogger.StatData statData = new StatisticsDataLogger.StatData(value, StatisticsDataLogger._logTypes[parent.UniqueId]);
     StatisticsDataLogger._logTypes.Add(value.UniqueId, statData);
 }
Exemple #2
0
 public StatData(StatisticsDataIdentifier id, StatisticsDataLogger.StatData parent)
 {
     this.Identifier = id;
     this.Parent     = parent;
     this.Children   = new List <StatisticsDataLogger.StatData>();
     this.Details    = new List <string>();
     if (this.Parent != null)
     {
         this.Parent.Children.Add(this);
     }
     this.Number = 0;
 }
Exemple #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;
     }
 }
Exemple #4
0
 public static void AddStat(StatisticsDataIdentifier id, int amount, string detail)
 {
     if (!StatisticsDataLogger._logTypes.ContainsKey(id.UniqueId))
     {
         return;
     }
     StatisticsDataLogger.StatData statData = StatisticsDataLogger._logTypes[id.UniqueId];
     if (detail != null)
     {
         statData.Details.Add(detail);
     }
     for (; statData != null; statData = statData.Parent)
     {
         statData.Number += amount;
     }
 }
Exemple #5
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);
         }
     }
 }