コード例 #1
0
 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("SteelFilterVersion:{0}", assembly.GetName().Version);
         stream.WriteLine("SteelFilterFilePath:{0}", assembly.Location);
         stream.WriteLine("IsOnline:{0}", status.IsOnline);
         stream.WriteLine("LastServerDispatchSecondsAgo:{0}", status.LastServerDispatchSecondsAgo);
         var text = stream.ToString();
         return(text);
     }
 }
コード例 #2
0
        internal static void RecordHeartbeatStatus(string filepath, HeartbeatGameStatus status)
        {
            string contents = RecordHeartbeatStatusToString(status);

            WriteTextToFile(contents, filepath);
        }