internal static void WriteProfileTrackerOutput(ref Stats stats)
{
string outputPath = FolderPaths.LoggingFolderPath + @"\ProfileStats.log";
//Copy last profile stats file _old_
if (!stats._createdOldFile)
{
if (File.Exists(outputPath))
{
if (File.Exists(FolderPaths.LoggingFolderPath + @"\old_ProfileStats.log"))
File.Delete(FolderPaths.LoggingFolderPath + @"\old_ProfileStats.log");
File.Copy(outputPath, FolderPaths.LoggingFolderPath + @"\old_ProfileStats.log");
}
stats._createdOldFile = true;
}
try
{
try
{
using (StreamWriter LogWriter = new StreamWriter(outputPath, false))
{
LogWriter.WriteLine("====================");
LogWriter.WriteLine("== TOTAL SUMMARY ==");
LogWriter.WriteLine(stats.GenerateOutputString());
//LogWriter.WriteLine("Total Games:{0} -- Total Unique Profiles:{1}\r\nDeaths:{2} TotalTime:{3} TotalGold:{4} TotalXP:{5}\r\n{6}",
// all.GameCount, all.Profiles.Count, all.TotalDeaths, all.TotalTimeRunning.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), all.TotalGold, all.TotalXP, all.TotalLootTracker);
LogWriter.WriteLine("====================");
LogWriter.WriteLine("== PROFILE SUMMARY ==");
foreach (var item in stats.Profiles)
{
LogWriter.WriteLine(item.GenerateOutput());
//LogWriter.WriteLine("{0}\r\nDeaths:{1} TotalTime:{2} TotalGold:{3} TotalXP:{4}\r\n{5}",
// item.ProfileName, item.DeathCount, item.TotalTimeSpan.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), item.TotalGold, item.TotalXP, item.LootTracker);
}
}
}
catch (IOException)
{
Logger.DBLog.Info("Fatal Error: File access error for Stats log file.");
}
}
catch (Exception ex)
{
Logger.DBLog.InfoFormat("Fatal Error:Stats log file\r\n{0}\r\n{1}",
ex.Message, ex.StackTrace);
}
}