Exemplo n.º 1
0
/*************************************************************************************************************************/
        public void flybywire(FlightCtrlState state)
        {
            entry temp_entry;

            Log.info("flybywire, state: " + state.ToString());
            if (!replay && !EOF)
            {
                start_replay();
            }

            while (true)
            {
                if (Throttle_Replay.Count < 10 && !EOF)
                {
                    read_throttle_values();
                }
                if (Throttle_Replay.Count < 1)
                {
                    EndReplay();
                    break;
                }
                temp_entry = Throttle_Replay.Dequeue();
                if (temp_entry.time < Planetarium.GetUniversalTime())
                {
                    continue;
                }
                state.mainThrottle = temp_entry.value;
                debug_message      = Math.Round(temp_entry.value, 2).ToString() + " : " + Math.Round(temp_entry.time, 2).ToString() + " @ " + Math.Round(Planetarium.GetUniversalTime(), 2).ToString() + " left " + Throttle_Replay.Count.ToString();
                break;
            }
        }
Exemplo n.º 2
0
/*************************************************************************************************************************/
        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()");
        }