Пример #1
0
        private static void InitializeConfig()
        {
            EDDOptions.Instance.Init();

            if (EDDOptions.Instance.ReadJournal != null && File.Exists(EDDOptions.Instance.ReadJournal))
            {
                DebugCode.ReadCmdLineJournal(EDDOptions.Instance.ReadJournal);
            }

            string logpath = "";

            try
            {
                logpath = Path.Combine(EDDOptions.Instance.AppDataDirectory, "Log");
                if (!Directory.Exists(logpath))
                {
                    Directory.CreateDirectory(logpath);
                }

                TraceLog.logroot     = EDDOptions.Instance.AppDataDirectory;
                TraceLog.urlfeedback = Properties.Resources.URLProjectFeedback;

                if (!Debugger.IsAttached || EDDOptions.Instance.TraceLog)
                {
                    TraceLog.Init();
                }

                if (EDDOptions.Instance.LogExceptions)
                {
                    TraceLog.RegisterFirstChanceExceptionHandler();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"Unable to create the folder '{logpath}'");
                Trace.WriteLine($"Exception: {ex.Message}");
            }

            SQLiteConnectionUser.EarlyReadRegister();

            Debug.WriteLine(BaseUtils.AppTicks.TickCount100 + " Init config finished");
        }
Пример #2
0
        private static void InitializeConfig(bool noreposition)
        {
            EDDConfig.Options.Init(noreposition);

            if (EDDConfig.Options.ReadJournal != null && File.Exists(EDDConfig.Options.ReadJournal))
            {
                DebugCode.ReadCmdLineJournal(EDDConfig.Options.ReadJournal);
            }

            string logpath = "";

            try
            {
                logpath = Path.Combine(Tools.GetAppDataDirectory(), "Log");
                if (!Directory.Exists(logpath))
                {
                    Directory.CreateDirectory(logpath);
                }

                if (!Debugger.IsAttached || EDDConfig.Options.TraceLog)
                {
                    TraceLog.Init();
                }

                if (EDDConfig.Options.LogExceptions)
                {
                    TraceLog.RegisterFirstChanceExceptionHandler();
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"Unable to create the folder '{logpath}'");
                Trace.WriteLine($"Exception: {ex.Message}");
            }

            SQLiteConnectionUser.EarlyReadRegister();
            EDDConfig.Instance.Update(false);
        }