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());
        }
Ejemplo n.º 2
0
 public void LogLineHighlight(string text)
 {
     TraceLog.WriteLine(text);
     LogLineColor(text, GetHighlightTextColour());
 }
Ejemplo n.º 3
0
 public void LogLineHighlight(string text)
 {
     TraceLog.WriteLine(text);
     LogLineColor(text, ExtendedControls.Theme.Current.TextBlockHighlightColor);
 }