コード例 #1
0
 // Called from thwargfilter
 private static string RecordHeartbeatStatusToString(HeartbeatGameStatus status)
 {
     using (var stream = new StringWriter())
     {
         TimeSpan span = DateTime.Now - System.Diagnostics.Process.GetCurrentProcess().StartTime;
         stream.WriteLine("FileVersion:{0}", HeartbeatGameStatus.MASTER_FILE_VERSION);
         stream.WriteLine("UptimeSeconds:{0}", (int)span.TotalSeconds);
         stream.WriteLine("ServerName:{0}", status.ServerName);
         stream.WriteLine("AccountName:{0}", status.AccountName);
         stream.WriteLine("CharacterName:{0}", status.CharacterName);
         stream.WriteLine("LogFilepath:{0}", log.GetLogFilepath());
         stream.WriteLine("ProcessId:{0}", System.Diagnostics.Process.GetCurrentProcess().Id);
         stream.WriteLine("TeamList:{0}", status.TeamList);
         var assembly = System.Reflection.Assembly.GetExecutingAssembly();
         stream.WriteLine("ThwargFilterVersion:{0}", assembly.GetName().Version);
         stream.WriteLine("ThwargFilterFilePath:{0}", assembly.Location);
         stream.WriteLine("IsOnline:{0}", status.IsOnline);
         stream.WriteLine("LastServerDispatchSecondsAgo:{0}", status.LastServerDispatchSecondsAgo);
         stream.WriteLine("CurrentTimeLocal:{0}", DateTime.Now.ToString("o"));
         stream.WriteLine("CurrentTimeUtc:{0}", DateTime.UtcNow.ToString("o"));
         stream.WriteLine("CurrentExecutingAssembly:{0}", System.Reflection.Assembly.GetExecutingAssembly().Location);
         stream.WriteLine("ActualServerName:{0}", GameRepo.Game.Server);
         stream.WriteLine("ActualAccountName:{0}", GameRepo.Game.Account);
         stream.WriteLine("ActualCharacterName:{0}", GameRepo.Game.Character);
         var text = stream.ToString();
         return(text);
     }
 }
コード例 #2
0
        internal static void RecordHeartbeatStatus(string filepath, HeartbeatGameStatus status)
        {
            string contents = RecordHeartbeatStatusToString(status);

            WriteTextToFile(contents, filepath);
        }