Exemple #1
0
        public Questor(QuestorfrmMain form1)
        {
            _mParent          = form1;
            _lastQuestorPulse = DateTime.UtcNow;

            _defense = new Defense();
            _combatMissionsBehavior            = new CombatMissionsBehavior();
            _combatHelperBehavior              = new CombatHelperBehavior();
            _dedicatedBookmarkSalvagerBehavior = new DedicatedBookmarkSalvagerBehavior();
            _directionalScannerBehavior        = new DirectionalScannerBehavior();
            _debugHangarsBehavior              = new DebugHangarsBehavior();
            _miningBehavior = new MiningBehavior();
            //_backgroundbehavior = new BackgroundBehavior();
            _cleanup            = new Cleanup();
            _watch              = new Stopwatch();
            _innerspaceCommands = new InnerspaceCommands();
            _statistics         = new Statistics();

            Cache.Instance.ScheduleCharacterName = Logging._character;
            Cache.Instance.NextStartupAction     = DateTime.UtcNow;
            // State fixed on ExecuteMission
            _States.CurrentQuestorState = QuestorState.Idle;

            if (Cache.Instance.DirectEve == null)
            {
                Logging.Log("Startup", "Error on Loading DirectEve, maybe server is down", Logging.Orange);
                Cache.Instance.CloseQuestorCMDLogoff   = false;
                Cache.Instance.CloseQuestorCMDExitGame = true;
                Cache.Instance.CloseQuestorEndProcess  = true;
                Settings.Instance.AutoStart            = true;
                Cache.Instance.ReasonToStopQuestor     = "Error on Loading DirectEve, maybe server is down";
                Cache.Instance.SessionState            = "Quitting";
                Cleanup.CloseQuestor(Cache.Instance.ReasonToStopQuestor);
                return;
            }

            try
            {
                if (Cache.Instance.DirectEve.HasSupportInstances())
                {
                    //Logging.Log("Questor", "You have a valid directeve.lic file and have instances available", Logging.Orange);
                }
                else
                {
                    //Logging.Log("Questor", "You have 0 Support Instances available [ _directEve.HasSupportInstances() is false ]", Logging.Orange);
                }
            }
            catch (Exception exception)
            {
                Logging.Log("Questor", "Exception while checking: _directEve.HasSupportInstances() in questor.cs - exception was: [" + exception + "]", Logging.Orange);
            }

            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 [" + 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.UtcNow;

            // 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
            {
                Cache.Instance.DirectEve.OnFrame += EVEOnFrame;
            }
            catch (Exception ex)
            {
                Logging.Log("Questor", 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 the DirectEVE license server is down";
                Cache.Instance.SessionState            = "Quitting";
                Cleanup.CloseQuestor(Cache.Instance.ReasonToStopQuestor);
            }
        }
Exemple #2
0
        public Questor(QuestorfrmMain form1)
        {
            _mParent = form1;
            _lastQuestorPulse = DateTime.UtcNow;

            _defense = new Defense();
            _combatMissionsBehavior = new CombatMissionsBehavior();
            _combatHelperBehavior = new CombatHelperBehavior();
            _dedicatedBookmarkSalvagerBehavior = new DedicatedBookmarkSalvagerBehavior();
            _directionalScannerBehavior = new DirectionalScannerBehavior();
            _debugHangarsBehavior = new DebugHangarsBehavior();
            _miningBehavior = new MiningBehavior();
            //_backgroundbehavior = new BackgroundBehavior();
            _cleanup = new Cleanup();
            _watch = new Stopwatch();
            _innerspaceCommands = new InnerspaceCommands();
            _statistics = new Statistics();

            Cache.Instance.ScheduleCharacterName = Logging._character;
            Cache.Instance.NextStartupAction = DateTime.UtcNow;
            // State fixed on ExecuteMission
            _States.CurrentQuestorState = QuestorState.Idle;

            if (Cache.Instance.DirectEve == null)
            {
                Logging.Log("Startup", "Error on Loading DirectEve, maybe server is down", Logging.Orange);
                Cache.Instance.CloseQuestorCMDLogoff = false;
                Cache.Instance.CloseQuestorCMDExitGame = true;
                Cache.Instance.CloseQuestorEndProcess = true;
                Settings.Instance.AutoStart = true;
                Cache.Instance.ReasonToStopQuestor = "Error on Loading DirectEve, maybe server is down";
                Cache.Instance.SessionState = "Quitting";
                Cleanup.CloseQuestor(Cache.Instance.ReasonToStopQuestor);
                return;
            }

            try
            {
                if (Cache.Instance.DirectEve.HasSupportInstances())
                {
                    //Logging.Log("Questor", "You have a valid directeve.lic file and have instances available", Logging.Orange);
                }
                else
                {
                    //Logging.Log("Questor", "You have 0 Support Instances available [ _directEve.HasSupportInstances() is false ]", Logging.Orange);
                }

            }
            catch (Exception exception)
            {
                Logging.Log("Questor", "Exception while checking: _directEve.HasSupportInstances() in questor.cs - exception was: [" + exception + "]", Logging.Orange);
            }

            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 [" + 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.UtcNow;

            // 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
            {
                Cache.Instance.DirectEve.OnFrame += EVEOnFrame;
            }
            catch (Exception ex)
            {
                Logging.Log("Questor", 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 the DirectEVE license server is down";
                Cache.Instance.SessionState = "Quitting";
                Cleanup.CloseQuestor(Cache.Instance.ReasonToStopQuestor);
            }
        }
Exemple #3
0
        public Questor()
        {
            //Logging.tryToLogToFile = true;
            _lastQuestorPulse = DateTime.UtcNow;

            _combatMissionsBehavior = new CombatMissionsBehavior();
            _combatHelperBehavior = new CombatHelperBehavior();
            _dedicatedBookmarkSalvagerBehavior = new DedicatedBookmarkSalvagerBehavior();
            _debugHangarsBehavior = new DebugHangarsBehavior();
            //_backgroundbehavior = new BackgroundBehavior();
            _watch = new Stopwatch();
            _innerspaceCommands = new InnerspaceCommands();

            Time.Instance.NextStartupAction = DateTime.UtcNow;
            // State fixed on ExecuteMission
            _States.CurrentQuestorState = QuestorState.Idle;

            if (!EveCom.EVEFrame.SubLicenses.Any())
            {
                Logging.Log("Startup", "Error on Loading EveCom, no licenses! maybe server is down?", Logging.Orange);
                QuestorCache.Instance.CloseQuestorCMDLogoff = false;
                QuestorCache.Instance.CloseQuestorCMDExitGame = true;
                QuestorCache.Instance.CloseQuestorEndProcess = true;
                QuestorSettings.Instance.AutoStart = true;
                Cleanup.ReasonToStopQuestor = "Error on Loading EveCom, no licenses! maybe server is down?";
                Cleanup.SignalToQuitQuestorAndEveAndRestartInAMoment = true;
                Cleanup.CloseQuestor(Cleanup.ReasonToStopQuestor);
                return;
            }

            if (LoginToEVE.StartTime.AddMinutes(10) < LoginToEVE.StopTime)
            {
                Time.Instance.StopTime = LoginToEVE.StopTime;
                Logging.Log("Questor", "Schedule: setup correctly: stoptime is [" + Time.Instance.StopTime.ToShortTimeString() + "]", Logging.Orange);
            }
            else
            {
                Time.Instance.StopTime = DateTime.Now.AddHours(Time.Instance.QuestorScheduleNotUsed_Hours);
                Logging.Log("Questor", "Schedule: NOT setup correctly: stoptime  set to [" + Time.Instance.QuestorScheduleNotUsed_Hours + "] hours from now at [" + Time.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=\"" + QuestorSettings.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);
            }

            Time.Instance.StartTime = LoginToEVE.StartTime;
            Time.Instance.QuestorStarted_DateTime = DateTime.UtcNow;

            // get the current process
            Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();

            // get the physical mem usage
            QuestorCache.Instance.TotalMegaBytesOfMemoryUsed = ((currentProcess.WorkingSet64 + 1 / 1024) / 1024);
            Logging.Log("Questor", "EVE instance: totalMegaBytesOfMemoryUsed - " + QuestorCache.Instance.TotalMegaBytesOfMemoryUsed + " MB", Logging.White);
            Statistics.SessionIskGenerated = 0;
            Statistics.SessionLootGenerated = 0;
            Statistics.SessionLPGenerated = 0;
            QuestorSettings.Instance.CharacterMode = "none";

            try
            {
                EveCom.EVEFrame.OnFrame += QuestorPulse; //the onframe routine is now located in evecomframework.core (thus triggered by our queing QuestorPulse)

                //Logging.Log("Questor", "Queue QuestorPulse using EVEComFramework.States", Logging.White);
                //QueueState(QuestorPulse);

            }
            catch (Exception ex)
            {
                Logging.Log("Questor", "EVECom.OnFrame: Exception [" + ex + "]", Logging.White);
                QuestorCache.Instance.CloseQuestorCMDLogoff = false;
                QuestorCache.Instance.CloseQuestorCMDExitGame = true;
                QuestorCache.Instance.CloseQuestorEndProcess = true;
                QuestorSettings.Instance.AutoStart = true;
                Cleanup.ReasonToStopQuestor = "Error on EVECom.OnFrame, maybe the EVECom license server is down";
                Cleanup.SignalToQuitQuestorAndEveAndRestartInAMoment = true;
                Cleanup.CloseQuestor(Cleanup.ReasonToStopQuestor);
            }

            Logging.Log("Questor", "Questor.", Logging.White);
        }