// Helper function for show_locals command. // If no error ocurred then result is xml string (first char is '<') // otherwise the error message is returned. public static String ShowLocals() { try { StringBuilder sb = new StringBuilder("<LocalVariables>\n"); LocalWatch watch = locals; while (watch != null) { sb.AppendFormat( @" <LocalVariable Name=""{0}"" Value=""{1}""> <Type Name=""{2}"" /> </LocalVariable> ", watch.Name, ObjectToString(watch.Value), watch.Type.Name); watch = watch.Next; } sb.Append("</LocalVariables>"); return(sb.ToString()); } catch (Exception ex) { return(Error("unable to show locals, " + ex.Message)); } }
// Append watch to the end of the list. public void Append(LocalWatch watch) { LocalWatch tail = this; while (tail.Next != null) { tail = tail.Next; } tail.next = watch; }
// Return watch count in the watch list. public static int CountWatches(LocalWatch watch) { int count = 0; while (watch != null) { watch = watch.Next; count++; } return(count); }
// Return value of local variable with given name. private static Object GetLocal(String name) { LocalWatch current = locals; while (current != null) { if (current.Name == name) { return(current.Value); } else { current = current.Next; } } return(ExpressionNotFoundError()); }
// Add local variable or parameter to the list of locals. public static void AddLocal(String name, Type type, Object value) { // Assign name if it is null if (name == null) { int index = LocalWatch.CountWatches(locals); name = String.Format("var{0}", index); } // Create new watch and append it to the end of the watch list. LocalWatch watch = new LocalWatch(name, type, value); if (locals == null) { locals = watch; } else { locals.Append(watch); } }
// Clear list of locals. public static void ClearLocals() { locals = null; }
public Questor(frmMain form1) { m_Parent = form1; _lastPulse = DateTime.MinValue; _random = new Random(); //_debugmodule = new DebugModule(); //_scoop = new Scoop(); _salvage = new Salvage(); _defense = new Defense(); _localwatch = new LocalWatch(); _scanInteraction = new ScanInteraction(); _combat = new Combat(); _traveler = new Traveler(); _unloadLoot = new UnloadLoot(); _agentInteraction = new AgentInteraction(); _arm = new Arm(); _courier = new CourierMission(); _switch = new SwitchShip(); _missionController = new MissionController(); _drones = new Drones(); _panic = new Panic(); _storyline = new Storyline(); Settings.Instance.SettingsLoaded += SettingsLoaded; // State fixed on ExecuteMission State = QuestorState.Idle; _directEve = new DirectEve(); Cache.Instance.DirectEve = _directEve; Cache.Instance.StopTimeSpecified = Program.stopTimeSpecified; Cache.Instance.MaxRuntime = Program.maxRuntime; Cache.Instance.StopTime = Program._stopTime; _questorStarted = DateTime.Now; _directEve.OnFrame += OnFrame; }
public Questor(QuestorfrmMain form1) { m_Parent = form1; _lastPulse = DateTime.Now; _defense = new Defense(); _localwatch = new LocalWatch(); _combatMissionsBehavior = new CombatMissionsBehavior(); _combatHelperBehavior = new CombatHelperBehavior(); _dedicatedBookmarkSalvagerBehavior = new DedicatedBookmarkSalvagerBehavior(); _directionalScannerBehavior = new DirectionalScannerBehavior(); _cleanup = new Cleanup(); _watch = new Stopwatch(); // State fixed on ExecuteMission _States.CurrentQuestorState = QuestorState.Idle; try { _directEve = new DirectEve(); } catch (Exception ex) { Logging.Log("Startup", "Error on Loading DirectEve, maybe server is down", Logging.orange); Logging.Log("Startup", string.Format("DirectEVE: Exception {0}...", ex), Logging.white); Cache.Instance.CloseQuestorCMDLogoff = false; Cache.Instance.CloseQuestorCMDExitGame = true; Cache.Instance.CloseQuestorEndProcess = true; Settings.Instance.AutoStart = true; Cache.Instance.ReasonToStopQuestor = "Error on Loading DirectEve, maybe lic server is down"; Cache.Instance.SessionState = "Quitting"; Cleanup.CloseQuestor(); } Cache.Instance.DirectEve = _directEve; Cache.Instance.StopTimeSpecified = Program.StopTimeSpecified; Cache.Instance.MaxRuntime = Program.MaxRuntime; if (Program.StartTime.AddMinutes(10) < Program.StopTime) { Cache.Instance.StopTime = Program.StopTime; Logging.Log("Questor", "Schedule: setup correctly: stoptime is [" + Cache.Instance.StopTime.ToShortTimeString() + "]", Logging.orange); } else { Cache.Instance.StopTime = DateTime.Now.AddHours(Time.Instance.QuestorScheduleNotUsed_Hours); Logging.Log("Questor", "Schedule: NOT setup correctly: stoptime set to [" + (int)Time.Instance.QuestorScheduleNotUsed_Hours + "] hours from now at [" + Cache.Instance.StopTime.ToShortTimeString() + "]", Logging.orange); Logging.Log("Questor", "You can correct this by editing schedules.xml to have an entry for this toon", Logging.orange); Logging.Log("Questor", "Ex: <char user=\"" + Settings.Instance.CharacterName + "\" pw=\"MyPasswordForEVEHere\" name=\"MyLoginNameForEVEHere\" start=\"06:45\" stop=\"08:10\" start2=\"09:05\" stop2=\"14:20\"/>", Logging.orange); Logging.Log("Questor", "make sure each toon has its own innerspace profile and specify the following startup program line:", Logging.orange); Logging.Log("Questor", "dotnet questor questor -x -c \"MyEVECharacterName\"", Logging.orange); } Cache.Instance.StartTime = Program.StartTime; Cache.Instance.QuestorStarted_DateTime = DateTime.Now; // get the current process Process currentProcess = System.Diagnostics.Process.GetCurrentProcess(); // get the physical mem usage Cache.Instance.TotalMegaBytesOfMemoryUsed = ((currentProcess.WorkingSet64 / 1024) / 1024); Logging.Log("Questor", "EVE instance: totalMegaBytesOfMemoryUsed - " + Cache.Instance.TotalMegaBytesOfMemoryUsed + " MB", Logging.white); Cache.Instance.SessionIskGenerated = 0; Cache.Instance.SessionLootGenerated = 0; Cache.Instance.SessionLPGenerated = 0; Settings.Instance.CharacterMode = "none"; try { _directEve.OnFrame += OnFrame; } catch (Exception ex) { Logging.Log("Startup", string.Format("DirectEVE.OnFrame: Exception {0}...", ex), Logging.white); Cache.Instance.CloseQuestorCMDLogoff = false; Cache.Instance.CloseQuestorCMDExitGame = true; Cache.Instance.CloseQuestorEndProcess = true; Settings.Instance.AutoStart = true; Cache.Instance.ReasonToStopQuestor = "Error on DirectEve.OnFrame, maybe lic server is down"; Cache.Instance.SessionState = "Quitting"; Cleanup.CloseQuestor(); } }