Beispiel #1
0
        public static void Initialize(Action <string> msg)    // called from EDDApplicationContext to initialize config and dbs
        {
            Thread.CurrentThread.Name = "EDD Main Thread";
            msg.Invoke("Checking Config");

            string logpath = EDDOptions.Instance.LogAppDirectory();

            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.hlog", 2, 256);        // Remove hlogs faster
            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.log", 10, 256);

            if (!Debugger.IsAttached || EDDOptions.Instance.TraceLog != null)
            {
                TraceLog.RedirectTrace(logpath, EDDOptions.Instance.TraceLog);
            }

            if (!Debugger.IsAttached || EDDOptions.Instance.LogExceptions)
            {
                ExceptionCatcher.RedirectExceptions(Properties.Resources.URLProjectFeedback);
            }

            if (EDDOptions.Instance.LogExceptions)
            {
                FirstChanceExceptionCatcher.RegisterFirstChanceExceptionHandler();
            }

            msg.Invoke("Checking Databases");

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Initializing database");

            UserDatabase.Instance.Start("UserDB");
            SystemsDatabase.Instance.Start("SystemDB");
            UserDatabase.Instance.Initialize();
            SystemsDatabase.Instance.Initialize();

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Database initialization complete");

            HttpCom.LogPath = logpath;

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Init config finished");

            Trace.WriteLine($"*** Elite Dangerous Discovery Initializing - {EDDOptions.Instance.VersionDisplayString}, Platform: {Environment.OSVersion.Platform.ToString()}");

            GlobalBookMarkList.LoadBookmarks();
            GlobalCaptainsLogList.LoadLog();

            msg.Invoke("Loading Icons");
            Icons.IconSet.ResetIcons();     // start with a clean slate loaded up from default icons

            msg.Invoke("Loading Configuration");
            EDDConfig.Instance.Update(false);
            EDDProfiles.Instance.LoadProfiles(EDDOptions.Instance.Profile);

            string path = EDDOptions.Instance.IconsPath ?? System.IO.Path.Combine(EDDOptions.Instance.IconsAppDirectory(), "*.zip");

            Icons.IconSet.LoadIconPack(path, EDDOptions.Instance.AppDataDirectory, EDDOptions.ExeDirectory());
        }
Beispiel #2
0
        public static void Initialize(Action <string> msg)    // called from EDDApplicationContext to initialize config and dbs
        {
            msg.Invoke("Checking Config");

            EDDOptions.Instance.Init();

            string logpath = EDDOptions.Instance.LogAppDirectory();

            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.hlog", 2, 256);        // Remove hlogs faster
            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.log", 10, 256);

            if (!Debugger.IsAttached || EDDOptions.Instance.TraceLog != null)
            {
                TraceLog.RedirectTrace(logpath, EDDOptions.Instance.TraceLog);
            }

            if (!Debugger.IsAttached || EDDOptions.Instance.LogExceptions)
            {
                ExceptionCatcher.RedirectExceptions(Properties.Resources.URLProjectFeedback);
            }

            if (EDDOptions.Instance.LogExceptions)
            {
                FirstChanceExceptionCatcher.RegisterFirstChanceExceptionHandler();
            }

            HttpCom.LogPath = logpath;

            SQLiteConnectionUser.EarlyReadRegister();

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Init config finished");

            Trace.WriteLine($"*** Elite Dangerous Discovery Initializing - {EDDOptions.Instance.VersionDisplayString}, Platform: {Environment.OSVersion.Platform.ToString()}");

            msg.Invoke("Scanning Memory Banks");
            InitializeDatabases();

            GlobalBookMarkList.LoadBookmarks();

            msg.Invoke("Locating Crew Members");
            EDDConfig.Instance.Update(false);
            EDDProfiles.Instance.LoadProfiles();

            msg.Invoke("Decoding Symbols");
            Icons.IconSet.ResetIcons();     // start with a clean slate loaded up from default icons

            string path = EDDOptions.Instance.IconsPath ?? (EDDOptions.Instance.IconsAppDirectory() + "\\*.zip");

            Icons.IconSet.LoadIconPack(path, EDDOptions.Instance.AppDataDirectory, EDDOptions.ExeDirectory());
        }
Beispiel #3
0
        public static void Initialize(Action <string> msg)    // called from EDDApplicationContext to initialize config and dbs
        {
            Thread.CurrentThread.Name = "EDD Main Thread";
            msg.Invoke("Checking Config");

            string logpath = EDDOptions.Instance.LogAppDirectory();

            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.hlog", 2, 256);        // Remove hlogs faster
            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.log", 10, 256);

            if (!Debugger.IsAttached || EDDOptions.Instance.TraceLog != null)
            {
                TraceLog.RedirectTrace(logpath, EDDOptions.Instance.TraceLog);
            }

            if (!Debugger.IsAttached || EDDOptions.Instance.LogExceptions)
            {
                ExceptionCatcher.RedirectExceptions(Properties.Resources.URLProjectFeedback);
            }

            if (EDDOptions.Instance.LogExceptions)
            {
                FirstChanceExceptionCatcher.RegisterFirstChanceExceptionHandler();
            }

            if (EDDOptions.Instance.BackgroundPriority)
            {
                Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
            }
            else if (EDDOptions.Instance.LowPriority)
            {
                Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
            }

            if (EDDOptions.Instance.ForceTLS12)
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls11;
            }

            msg.Invoke("Checking Databases");

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Initializing database");

            UserDatabase.Instance.Start("UserDB");
            SystemsDatabase.Instance.Start("SystemDB");
            UserDatabase.Instance.Initialize();
            SystemsDatabase.Instance.Initialize();

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Database initialization complete");

            HttpCom.LogPath = logpath;

            Trace.WriteLine(BaseUtils.AppTicks.TickCountLap() + " Init config finished");

            Trace.WriteLine($"*** Elite Dangerous Discovery Initializing - {EDDOptions.Instance.VersionDisplayString}, Platform: {Environment.OSVersion.Platform.ToString()}");

            GlobalBookMarkList.LoadBookmarks();
            GlobalCaptainsLogList.LoadLog();

            msg.Invoke("Loading Icons");
            EDDiscovery.Icons.ForceInclusion.Include();      // Force the assembly into the project by a empty call
            BaseUtils.Icons.IconSet.CreateSingleton();
            System.Reflection.Assembly iconasm = BaseUtils.ResourceHelpers.GetAssemblyByName("EDDiscovery.Icons");
            BaseUtils.Icons.IconSet.Instance.LoadIconsFromAssembly(iconasm);
            BaseUtils.Icons.IconSet.Instance.AddAlias("settings", "Controls.Main.Tools.Settings");             // from use by action system..
            BaseUtils.Icons.IconSet.Instance.AddAlias("missioncompleted", "Journal.MissionCompleted");
            BaseUtils.Icons.IconSet.Instance.AddAlias("speaker", "Legacy.speaker");
            BaseUtils.Icons.IconSet.Instance.AddAlias("Default", "Legacy.star");        // MUST be present

            msg.Invoke("Loading Configuration");
            EDDConfig.Instance.Update(false);
            EDDProfiles.Instance.LoadProfiles(EDDOptions.Instance.Profile);

            string path = EDDOptions.Instance.IconsPath ?? System.IO.Path.Combine(EDDOptions.Instance.IconsAppDirectory(), "*.zip");

            BaseUtils.Icons.IconSet.Instance.LoadIconPack(path, EDDOptions.Instance.AppDataDirectory, EDDOptions.ExeDirectory());
        }