/*************************************************************************************************************************/ public void flush_record_file() { Log.PushStackInfo("FMRS_THL.flush_record_file", "FMRS_THL_Log: entering flush_record_file()"); Log.dbg("FMRS_THL_Log: flush record file"); IO.TextWriter writer = IO.File.CreateText(FMRS.FILES.RECORD_TXT); writer.Flush(); writer.Close(); Throttle_Log_Buffer.Clear(); temp_buffer.Clear(); Log.PopStackInfo("FMRS_THL_Log: leave flush_record_file()"); }
/*************************************************************************************************************************/ public void start_replay() { entry temp_entry; string temp_string; Log.info("start_replay"); Log.PushStackInfo("FMS_THL.start_replay", "FMRS_THL_Rep: entering start_replay()"); Log.dbg("FMRS_THL_Rep: Start Replay"); if (replay || EOF) { return; } Throttle_Replay.Clear(); reader = IO.File.OpenText(FMRS.FILES.RECORD_TXT); while (true) { temp_string = reader.ReadLine(); //sithilfe check data /end of file if (temp_string.Contains("EOF")) { Log.dbg("FMRS_THL_Rep: EOF"); EOF = true; break; } if (temp_string.Contains("#")) { continue; } temp_entry = new entry(temp_string); if (temp_entry.time > Planetarium.GetUniversalTime()) { Log.dbg("FMRS_THL_Rep: start time found: {0}", temp_entry.time); read_throttle_values(); replay = true; break; } } FMRS.Log.PopStackInfo("FMRS_THL_Rep: leave start_replay()"); }
/*************************************************************************************************************************/ public void EndReplay() { Log.PushStackInfo("FMRS_THL.EndReply", "FMRS_THL_Rep: entering end_replay()"); if (!replay) { return; } Log.dbg("FMRS_THL_Rep: End Replay"); try { reader.Close(); } catch (Exception) {} replay = false; debug_message = "replay ended"; Log.PopStackInfo("FMRS_THL_Rep: leave end_replay()"); }
/*************************************************************************************************************************/ public void init() { Log.PushStackInfo("FMRS_THL.init", "FMRS_THL_Log: entering linit()"); Log.dbg("FMRS_THL_Log: init"); if (init_done) { return; } if (!IO.File.Exists(FMRS.FILES.RECORD_TXT)) { IO.TextWriter file = IO.File.CreateText(FMRS.FILES.RECORD_TXT); file.Close(); } init_done = true; Log.PopStackInfo("FMRS_THL_Log: leave linit()"); }
/*************************************************************************************************************************/ public void Update(bool Debug_Active = false, bool Debug_Level_1_Active = false) { if (replay) { if (!EOF) { if (Throttle_Replay.Count < 25) { Log.dbg("FMRS_THL_Rep: update read_throttle_values() call"); read_throttle_values(); } } else { if (Throttle_Replay.Count == 0) { Log.dbg("FMRS_THL_Rep: update EndReplay() call"); EndReplay(); } } } }
/*************************************************************************************************************************/ public FMRS_THL_Rep(bool Debug_Active = false, bool Debug_Level_1_Active = false) { Log.detail("### FMRS_THL_Rep: constructor"); }