Beispiel #1
0
        /// <summary>
        /// Loads all extensions in the given directory
        /// </summary>
        /// <param name="directory"></param>
        public void LoadAllExtensions(string directory)
        {
            var gameFiles = Directory.GetFiles(directory, GameFileSearchPattern);
            var files     = Directory.GetFiles(directory, ExtFileSearchPattern).Concat(gameFiles);

            foreach (var file in files)
            {
                if (file.Contains(".Ext.") && Array.IndexOf(gameFiles, file.Replace(".Ext.", ".Game.")) != -1)
                {
                    //Logger.Write(LogType.Warning, "Found old game extension '{0}'. Please remove it!", Path.GetFileName(file));
                    Cleanup.Add(file);
                    continue;
                }
                LoadExtension(Path.Combine(directory, file));
            }
            foreach (var ext in extensions.ToArray())
            {
                try
                {
                    ext.OnModLoad();
                }
                catch (Exception ex)
                {
                    extensions.Remove(ext);
                    Logger.WriteException($"Failed OnModLoad extension {ext.Name} v{ext.Version}", ex);
                    RemoteLogger.Exception($"Failed OnModLoad extension {ext.Name} v{ext.Version}", ex);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Loads all extensions in the given directory
        /// </summary>
        /// <param name="directory"></param>
        public void LoadAllExtensions(string directory)
        {
            var foundExtensions = Directory.GetFiles(directory, extSearchPattern);

            foreach (var ext in foundExtensions.Where(e => !e.Equals("Oxide.Core.dll")))
            {
                if (ext.Contains(".Core.") && Array.IndexOf(foundExtensions, ext.Replace(".Core.", "")) != -1)
                {
                    Cleanup.Add(ext);
                    continue;
                }

                if (ext.Contains(".Ext.") && Array.IndexOf(foundExtensions, ext.Replace(".Ext.", "")) != -1)
                {
                    Cleanup.Add(ext);
                    continue;
                }

                LoadExtension(Path.Combine(directory, ext));
            }

            foreach (var ext in extensions.ToArray())
            {
                try
                {
                    ext.OnModLoad();
                }
                catch (Exception ex)
                {
                    extensions.Remove(ext);
                    Logger.WriteException($"Failed OnModLoad extension {ext.Name} v{ext.Version}", ex);
                    RemoteLogger.Exception($"Failed OnModLoad extension {ext.Name} v{ext.Version}", ex);
                }
            }
        }
Beispiel #3
0
            internal Function AddFunction(string funcName, string returnType, string args)
            {
                if (funcName == "Init")
                {
                    funcName = "DoInit";
                }
                if (funcName == "Shutdown")
                {
                    funcName = "DoShutdown";
                }

                var f = new Function
                {
                    Name       = funcName,
                    ReturnType = returnType
                };

                args = Regex.Replace(args, "", "");

                foreach (var arg in args.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    var m = Regex.Match(arg.Trim(), @"(.+?[ |\*|\&])?([a-zA-Z0-9_]+?)( = (.+?))?$");

                    var t = m.Groups[1].Value.Trim();
                    var n = m.Groups[2].Value.Trim();

                    t = Cleanup.ConvertType(t);

                    f.Arguments.Add(n, t);
                }

                Functions.Add(f);

                return(f);
            }
        public void Setup()
        {
            Cleanup.CleanCache();
            cached   = Generate.CachedWord();
            expected = Generate.HtmlWord();

            Generate.ConfigureFeedService();
        }
Beispiel #5
0
        async Task IShutdownSource.Shutdown()
        {
            tokenSource.Cancel();
            Cleanup?.Invoke(this, EventArgs.Empty);
            await Task.WhenAll(cleanupTasks.Select(IgnoreTimeout));

            Phase2Cleanup?.Invoke(this, EventArgs.Empty);
        }
Beispiel #6
0
 protected static void TearDownDatabase()
 {
     using (var command = connection.CreateCommand())
     {
         command.CommandText = Cleanup.FormatWith(DbName);
         command.ExecuteNonQuery();
     }
 }
 public void AssemblyRegistration()
 {
     Cleanup.SafeMethod(() => tests.AssemblyRegistration.Initialize(null));
     Cleanup.SafeMethod(() => bad.AssemblyRegistration.Initialize(null));
     Cleanup.SafeMethod(() => morebad.AssemblyRegistration.Initialize(null, null));
     Cleanup.SafeMethod(() => evenmorebad.AssemblyRegistration.Init());
     Cleanup.SafeMethod(() => new yetevenmorebad.AssemblyRegistration().Initialize(null));
 }
Beispiel #8
0
        public void Language_SavesAfterChange()
        {
            Cleanup.CleanCache();
            var vm = new HomeViewModel(null);

            vm.SelectedLanguage = "German";
            vm.LastLanguage.Should().Be(Language.German);
        }
Beispiel #9
0
 internal void WriteXML(XmlTextWriter Writer)
 {
     Writer.WriteAttributeString(conManuallyAssessParm, ManuallyAssess.ToString());
     Writer.WriteAttributeString(conCleanupParm, Cleanup.ToString());
     Writer.WriteAttributeString(conSkipBadTagsParm, SkipBadTags.ToString());
     Writer.WriteAttributeString(conSkipWhenNoChangeParm, SkipWhenNoChange.ToString());
     Writer.WriteAttributeString(conAssessmentsAlwaysLeaveACommentParm, AssessmentsAlwaysLeaveAComment.ToString());
     Writer.WriteAttributeString(conOpenBadInBrowser, OpenBadInBrowser.ToString());
 }
Beispiel #10
0
        // Same as Resize(), with an additional delegate to do any cleanup on the potentially freed slots
        public void Resize(uint size, Cleanup cleanupDelegate)
        {
            for (uint i = size; i < m_count; ++i)
            {
                cleanupDelegate(this[i]);
            }

            Resize(size);
        }
        public bool IsCallback(string name)
        {
            if (def.callback_structs.Any(x => x.Name == name || Cleanup.ConvertType(x.Name) == name))
            {
                return(true);
            }

            return(false);
        }
Beispiel #12
0
 internal void WriteXML(XmlTextWriter writer)
 {
     writer.WriteAttributeString(ManuallyAssessParm, ManuallyAssess.ToString());
     writer.WriteAttributeString(CleanupParm, Cleanup.ToString());
     writer.WriteAttributeString(SkipBadTagsParm, SkipBadTags.ToString());
     writer.WriteAttributeString(SkipWhenNoChangeParm, SkipWhenNoChange.ToString());
     writer.WriteAttributeString(AssessmentsAlwaysLeaveACommentParm, AssessmentsAlwaysLeaveAComment.ToString());
     writer.WriteAttributeString(OpenBadInBrowserText, OpenBadInBrowser.ToString());
 }
Beispiel #13
0
        // Same as Reset(), with an additional delegate to do any cleanup on the potentially freed slots
        public void Reset(Cleanup cleanupDelegate)
        {
            for (uint i = 0; i < m_count; ++i)
            {
                cleanupDelegate(this[i]);
            }

            Reset();
        }
Beispiel #14
0
 public async Task TearDown()
 {
     using (sqs)
         using (sns)
             using (s3)
             {
                 await Cleanup.DeleteAllResourcesWithPrefix(sqs, sns, s3, prefix).ConfigureAwait(false);
             }
 }
Beispiel #15
0
        // Same as Reset( uint capacity ), with an additional delegate to do any cleanup on the potentially freed slots
        public void Reset(uint capacity, Cleanup cleanupDelegate)
        {
            for (uint i = 0; i < m_count; ++i)
            {
                cleanupDelegate(this[i]);
            }

            Reset(capacity);
        }
        public bool IsEnum(string name)
        {
            if (def.enums.Any(x => x.Name == name || Cleanup.ConvertType(x.Name) == name))
            {
                return(true);
            }

            return(false);
        }
        public bool IsTypeDef(string name)
        {
            if (def.typedefs.Any(x => x.Name == name || Cleanup.ConvertType(x.Name) == name))
            {
                return(true);
            }

            return(false);
        }
        public void ShouldExitGracefullyIfNoGitInitialized()
        {
            var workingDirectory = TempDir.Create();

            Should.Throw <CommandLineExitException>(() => WorkingCopy.Discover(workingDirectory));

            _testPlatformAbstractions.Messages[0].ShouldBe($"Directory {workingDirectory} or any parent directory do not contain a git working copy");

            Cleanup.DeleteDirectory(workingDirectory);
        }
Beispiel #19
0
 public Task Clean(CommandContext ctx)
 {
     ctx.Client.DebugLogger.LogMessage(LogLevel.Info, "DiscHax", "Cleaning...", DateTime.Now);
     Cleanup.Clean(CommandArr.GetCommandNames(),
                   ctx.Client.Guilds.Select(s =>
                                            new Tuple <string, IEnumerable <string> >(s.Key.ToString(),
                                                                                      s.Value.Members.Select(u => u.Key.ToString()))),
                   ctx.Client.Guilds.SelectMany(s => s.Value.Channels).Select(s => s.Key.ToString()));
     return(ctx.RespondAsync("Complete"));
 }
Beispiel #20
0
        public static void Main(string[] args)
        {
            Cleanup cleanup = new Cleanup();

            cleanup.Clean();

            Sorter sort = new Sorter(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            sort.Sort();
        }
Beispiel #21
0
        /// <summary>
        /// start auto update after download
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                GithubRelease release = Newtonsoft.Json.JsonConvert.DeserializeObject <GithubRelease>(e.Result);

                // generate update information object
                UpdaterXml.item update = new UpdaterXml.item();
                update.url       = release.assets.Where(w => w.browser_download_url.EndsWith(".zip", StringComparison.OrdinalIgnoreCase)).First().browser_download_url;
                update.version   = release.tag_name;
                update.changelog = releaseUrl;
                update.mandatory = false;

                // generate xml file
                string updateUrl = null;
                do
                {
                    updateUrl = System.IO.Path.Combine(System.IO.Path.GetTempPath(), string.Format("{0}.xml", Guid.NewGuid().ToString("N")));
                } while (System.IO.File.Exists(updateUrl));

                // add file to cleanup job
                Cleanup.GetInstance().FilesToDelete.AddIfNotExist <string>(updateUrl);

                // serialize to file
                using (TextWriter writer = new StreamWriter(updateUrl, false))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(UpdaterXml.item));
                    serializer.Serialize(writer, update);
                    writer.Close();
                }

                // start update procedure
                if (Properties.Settings.Default.CheckForUpdates)
                {
                    Logging.WriteLine("AutoUpdater feature enabled - checking for update in the background.");

                    AutoUpdater.ShowRemindLaterButton = true;
                    AutoUpdater.ReportErrors          = false;
                    AutoUpdater.Mandatory             = false;
                    AutoUpdater.ShowSkipButton        = true;
                    AutoUpdater.Start(updateUrl);
                }

                // we cannot delete the xml file because we have no idea when the check is done by the auto updater
                //try
                //{
                //    System.IO.File.Delete(updateUrl);
                //}
                //catch { }
            }
            catch (Exception ex)
            {
                Logging.WriteLine(string.Format("Unable to start update procedure:{0}{1}", Environment.NewLine, ex.ToString()));
            }
        }
Beispiel #22
0
        public async Task Loading_DataSourceShouldNotBeDefault()
        {
            Cleanup.CleanCache();

            var app = Generate.GetApp();
            var vm  = new HomeViewModel(app);

            await vm.Loading(app.MainPage);

            vm.DataSource.CompareTo(new Word()).Should().NotBe(0);
        }
Beispiel #23
0
        public static void RunOnce(string source, string target, int trainingPercent = 30, int amount = -1)
        {
            Console.WriteLine($"Starting processing for {source} data path: {target}");
            Stopwatch w = new Stopwatch();

            w.Start();
            Cleanup.ProcessCsv(source, target, amount);
            Console.WriteLine($"Completed transformation in {w.ElapsedMilliseconds} ms");
            Cleanup.SeperateData <Transformed>(trainingPercent, $"{target}transformed.csv", target);
            Console.WriteLine($"Completed training data sepratation in {w.ElapsedMilliseconds} ms");
        }
        public void TestThatGetXDocumentFromFileReturnsExpectedXDocument()
        {
            var filepath = Constants.TestFileName;

            Tests.Common.Setup.CreateFileWithText(filepath, Constants.XmlFileText);

            var xDocument = xmlService.GetXDocumentFromFile(filepath);

            Cleanup.DeleteFileIfExists(filepath);
            Assert.IsNotNull(xDocument);
        }
Beispiel #25
0
        /// <summary>
        /// Loads this extension
        /// </summary>
        public override void Load()
        {
            // Register our loader
            loader = new CSharpPluginLoader(this);
            Manager.RegisterPluginLoader(loader);

            // Register engine frame callback
            Interface.Oxide.OnFrame(OnFrame);

            Cleanup.Add(Path.Combine(Interface.Oxide.RootDirectory, "mono-2.0.dll"));
            Cleanup.Add(Path.Combine(Interface.Oxide.RootDirectory, "msvcr120.dll"));
        }
Beispiel #26
0
        public async Task Loading_ShouldSetNewWord()
        {
            Cleanup.CleanCache();

            var app      = Generate.GetApp();
            var vm       = new HomeViewModel(app);
            var expected = Generate.HtmlWord();

            await vm.Loading(app.MainPage);

            vm.DataSource.CompareTo(expected).Should().Be(0);
        }
Beispiel #27
0
        public async Task Loading_ShouldResetBools()
        {
            Cleanup.CleanCache();

            var app = Generate.GetApp();
            var vm  = new HomeViewModel(app);

            await vm.Loading(app.MainPage);

            vm.IsBusy.Should().BeFalse();
            vm.ShowLabels.Should().BeTrue();
        }
Beispiel #28
0
        /// <summary>
        /// Loads this extension
        /// </summary>
        public override void Load()
        {
            // Setup Lua instance
            InitializeLua();

            // Register the loader
            loader = new LuaPluginLoader(LuaEnvironment, this);
            Manager.RegisterPluginLoader(loader);

            Cleanup.Add(Path.Combine(Interface.Oxide.ExtensionDirectory, "x64/lua51.dll"));
            Cleanup.Add(Path.Combine(Interface.Oxide.ExtensionDirectory, "x86/lua51.dll"));
        }
        public CSharpExtension(ExtensionManager manager) : base(manager)
        {
            string str  = Path.Combine(Interface.Oxide.RootDirectory, "CSharpCompiler");
            string str1 = Path.Combine(Interface.Oxide.RootDirectory, "Compiler");

            if (Environment.OSVersion.Platform != PlatformID.Unix)
            {
                str = string.Concat(str, ".exe");
                if (File.Exists(str))
                {
                    str1 = string.Concat(str1, ".exe");
                    if (!File.Exists(str1))
                    {
                        File.Move(str, str1);
                    }
                    Cleanup.Add(str);
                }
                return;
            }
            Cleanup.Add(Path.Combine(Interface.Oxide.ExtensionDirectory, "Mono.Posix.dll.config"));
            str = string.Concat(str, ".x86");
            if (File.Exists(str))
            {
                str1 = string.Concat(str1, ".x86");
                if (!File.Exists(str1))
                {
                    File.Move(str, str1);
                }
                Cleanup.Add(str);
            }
            str = string.Concat(str, "_x64");
            if (File.Exists(str))
            {
                str1 = string.Concat(str1, "_x64");
                if (!File.Exists(str1))
                {
                    File.Move(str, str1);
                }
                Cleanup.Add(str);
            }
            string extensionDirectory = Interface.Oxide.ExtensionDirectory;
            string str2 = Path.Combine(extensionDirectory, "Oxide.References.dll.config");

            if (File.Exists(str2))
            {
                if (!(new string[] { "target=\"x64", "target=\"./x64" }).Any <string>(new Func <string, bool>(File.ReadAllText(str2).Contains)))
                {
                    return;
                }
            }
            File.WriteAllText(str2, string.Concat(new string[] { "<configuration>\n<dllmap dll=\"MonoPosixHelper\" target=\"", extensionDirectory, "/x86/libMonoPosixHelper.so\" os=\"!windows,osx\" wordsize=\"32\" />\n<dllmap dll=\"MonoPosixHelper\" target=\"", extensionDirectory, "/x64/libMonoPosixHelper.so\" os=\"!windows,osx\" wordsize=\"64\" />\n</configuration>" }));
        }
Beispiel #30
0
        public async Task Loading_ShouldRaiseDataSource()
        {
            Cleanup.CleanCache();

            var app = Generate.GetApp();
            var vm  = new HomeViewModel(app);

            vm.MonitorEvents();

            await vm.Loading(app.MainPage);

            vm.ShouldRaisePropertyChangeFor(x => x.DataSource);
        }
Beispiel #31
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);
            }
        }
Beispiel #32
0
        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();
            }
        }
Beispiel #33
0
        public void RegisterCleanup(CleanupFunction function, object arg1, object arg2)
        {
            Debug.Assert(function != null);
            Cleanup c;

            if (cleanup_.Function == null)
            {
                c = cleanup_;
            }
            else
            {
                c = new Cleanup();
                c.Next = cleanup_.Next;
                cleanup_.Next = c;
            }
            c.Function = function;
            c.Arg1 = arg1;
            c.Arg2 = arg2;
        }
Beispiel #34
0
 public Iterator()
 {
     cleanup_ = new Cleanup();
     cleanup_.Function = null;
     cleanup_.Next = null;
 }
Beispiel #35
0
        public Questor(frmMain form1)
        {
            m_Parent = form1;
            _lastPulse = DateTime.MinValue;

            _random = new Random();

            //_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();
            _cleanup = new Cleanup();
            _statistics = new Statistics();

            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;
            Cache.Instance.StartTime = Program.startTime;
            _questorStarted = DateTime.Now;

            _directEve.OnFrame += OnFrame;
        }