Exemplo n.º 1
0
        // standard process option (excepting -optionsfile and -appfolder)
        private void ProcessOption(string optname, BaseUtils.CommandArgs ca, bool toeol)
        {
            optname = optname.ToLowerInvariant();
            //System.Diagnostics.Debug.WriteLine("     Option " + optname);

            if (optname == "-optionsfile" || optname == "-appfolder") // not processed thru this function
            {
                ca.Remove();                                          // waste it
            }
            else if (optname == "-translationfolder")
            {
                translationfolder = ca.NextEmpty();
                TranslatorDirectoryIncludeSearchUpDepth = ca.Int();
            }
            else if (optname == "-userdbpath")
            {
                UserDatabasePath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-cmdr" || optname == "-commander")
            {
                Commander = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-profile")
            {
                Profile = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-systemsdbpath")
            {
                SystemDatabasePath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-iconspath")
            {
                IconsPath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-notificationfolder")
            {
                NotificationFolderOverride = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-tracelog")
            {
                TraceLog = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-fontsize")
            {
                FontSize = (toeol ? ca.Rest() : ca.NextEmpty()).InvariantParseFloat(0);
            }
            else if (optname == "-font")
            {
                Font = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-language")
            {
                SelectLanguage = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-webserverfolder" || optname == "-wsf")
            {
                WebServerFolder = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-outputeventhelp")
            {
                OutputEventHelp = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-defaultjournalfolder")
            {
                DefaultJournalFolder = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-journalfilematch")
            {
                DefaultJournalMatchFilename = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-minjournaldateutc")
            {
                string s = toeol ? ca.Rest() : ca.NextEmpty();
                MinJournalDateUTC = s.ParseDateTime(DateTime.MinValue, System.Globalization.CultureInfo.CurrentCulture);
            }
            else if (optname == "-historyloaddaylimit")
            {
                string s = (toeol ? ca.Rest() : ca.NextEmpty());
                if (DateTime.TryParse(s, out DateTime t))
                {
                    var delta = DateTime.UtcNow - t;
                    HistoryLoadDayLimit = (int)((delta.TotalHours + 23.999) / 24);
                }
                else
                {
                    HistoryLoadDayLimit = s.InvariantParseInt(0);
                }
            }
            else if (optname.StartsWith("-"))
            {
                string opt = optname.Substring(1);

                switch (opt)
                {
                case "safemode": SafeMode = true; break;

                case "norepositionwindow": NoWindowReposition = true; break;

                case "minimize":
                case "minimise": MinimiseOnOpen = true; break;

                case "maximise":
                case "maximize": MaximiseOnOpen = true; break;

                case "portable": StoreDataInProgramDirectory = true; break;

                case "nrw": NoWindowReposition = true; break;

                case "showactionbutton": ActionButton = true; break;

                case "noload": NoLoad = true; break;

                case "nosystems": NoSystemsLoad = true; break;

                case "logexceptions": LogExceptions = true; break;

                case "nogithubpacks": DontAskGithubForPacks = true; break;

                case "checkrelease": CheckRelease = true; break;

                case "checkgithub": CheckGithubFiles = true; break;

                case "nocheckrelease": CheckRelease = false; break;

                case "nocheckgithub": CheckGithubFiles = false; break;

                case "disablemerge": DisableMerge = true; break;

                case "edsmbeta":
                    EDSMClass.ServerAddress = "http://beta.edsm.net:8080/";
                    break;

                case "edsmnull":
                    EDSMClass.ServerAddress = "";
                    break;

                case "disablebetacheck":
                    DisableBetaCommanderCheck = true;
                    break;

                case "forcebeta":           // use to move logs to a beta commander for testing
                    ForceBetaOnCommander = true;
                    break;

                case "notheme": NoTheme = true; break;

                case "notabs": NoTabs = true; break;

                case "tabsreset": TabsReset = true; break;

                case "nosound": NoSound = true; break;

                case "no3dmap": No3DMap = true; break;

                case "notitleinfo": DisableShowDebugInfoInTitle = true; break;

                case "resetlanguage": ResetLanguage = true; break;

                case "tempdirindatadir": TempDirInDataDir = true; break;

                case "notempdirindatadir": TempDirInDataDir = false; break;

                case "lowpriority": ProcessPriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal; break;

                case "backgroundpriority": ProcessPriorityClass = System.Diagnostics.ProcessPriorityClass.Idle; break;

                case "highpriority": ProcessPriorityClass = System.Diagnostics.ProcessPriorityClass.High; break;

                case "abovenormalpriority": ProcessPriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal; break;

                case "realtimepriority": ProcessPriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime; break;

                case "forcetls12": ForceTLS12 = true; break;

                case "disabletimedisplay": DisableTimeDisplay = true; break;

                case "disablecommanderselect": DisableCommanderSelect = true; break;

                case "disableversiondisplay": DisableVersionDisplay = true; break;

                case "enabletgrightclicks": EnableTGRightDebugClicks = true; break;

                default:
                    System.Diagnostics.Debug.WriteLine($"Unrecognized option -{opt}");
                    break;
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine($"Unrecognized non option {optname}");
            }
        }
Exemplo n.º 2
0
        private void ProcessOption(string optname, BaseUtils.CommandArgs ca, bool toeol)
        {
            optname = optname.ToLowerInvariant();
            //System.Diagnostics.Debug.WriteLine("     Option " + optname);

            if (optname == "-optionsfile" || optname == "-appfolder")
            {
                ca.Remove();   // waste it
            }
            else if (optname == "-translationfolder")
            {
                translationfolder = ca.NextEmpty();
                TranslatorDirectoryIncludeSearchUpDepth = ca.Int();
            }
            else if (optname == "-userdbpath")
            {
                UserDatabasePath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-cmdr" || optname == "-commander")
            {
                Commander = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-profile")
            {
                Profile = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-systemsdbpath")
            {
                SystemDatabasePath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-iconspath")
            {
                IconsPath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-notificationfolder")
            {
                NotificationFolderOverride = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-tracelog")
            {
                TraceLog = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-fontsize")
            {
                FontSize = (toeol ? ca.Rest() : ca.NextEmpty()).InvariantParseFloat(0);
            }
            else if (optname == "-font")
            {
                Font = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-language")
            {
                SelectLanguage = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname.StartsWith("-"))
            {
                string opt = optname.Substring(1);

                switch (opt)
                {
                case "safemode": SafeMode = true; break;

                case "norepositionwindow": NoWindowReposition = true; break;

                case "portable": StoreDataInProgramDirectory = true; break;

                case "nrw": NoWindowReposition = true; break;

                case "showactionbutton": ActionButton = true; break;

                case "noload": NoLoad = true; break;

                case "nosystems": NoSystemsLoad = true; break;

                case "logexceptions": LogExceptions = true; break;

                case "nogithubpacks": DontAskGithubForPacks = true; break;

                case "checkrelease": CheckRelease = true; break;

                case "checkgithub": CheckGithubFiles = true; break;

                case "nocheckrelease": CheckRelease = false; break;

                case "nocheckgithub": CheckGithubFiles = false; break;

                case "disablemerge": DisableMerge = true; break;

                case "edsmbeta":
                    EDSMClass.ServerAddress = "http://beta.edsm.net:8080/";
                    break;

                case "edsmnull":
                    EDSMClass.ServerAddress = "";
                    break;

                case "disablebetacheck":
                    DisableBetaCommanderCheck = true;
                    break;

                case "forcebeta":           // use to move logs to a beta commander for testing
                    ForceBetaOnCommander = true;
                    break;

                case "notheme": NoTheme = true; break;

                case "notabs": NoTabs = true; break;

                case "tabsreset": TabsReset = true; break;

                case "nosound": NoSound = true; break;

                case "no3dmap": No3DMap = true; break;

                case "notitleinfo": DisableShowDebugInfoInTitle = true; break;

                case "resetlanguage": ResetLanguage = true; break;

                default:
                    System.Diagnostics.Debug.WriteLine($"Unrecognized option -{opt}");
                    break;
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine($"Unrecognized non option {optname}");
            }
        }
Exemplo n.º 3
0
        private void ProcessOption(string optname, BaseUtils.CommandArgs ca, bool toeol)
        {
            optname = optname.ToLowerInvariant();
            //System.Diagnostics.Debug.WriteLine("     Option " + optname);

            if (optname == "-optionsfile" || optname == "-appfolder")
            {
                ca.Remove();   // waste it
            }
            else if (optname == "-translationfolder")
            {
                translationfolder = ca.NextEmpty();
                TranslatorDirectoryIncludeSearchUpDepth = ca.Int();
            }
            else if (optname == "-userdbpath")
            {
                UserDatabasePath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-cmdr" || optname == "-commander")
            {
                Commander = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-systemsdbpath")
            {
                SystemDatabasePath = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-tracelog")
            {
                TraceLog = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-fontsize")
            {
                FontSize = (toeol ? ca.Rest() : ca.NextEmpty()).InvariantParseFloat(0);
            }
            else if (optname == "-font")
            {
                Font = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-language")
            {
                SelectLanguage = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname == "-outputeventhelp")
            {
                OutputEventHelp = toeol ? ca.Rest() : ca.NextEmpty();
            }
            else if (optname.StartsWith("-"))
            {
                string opt = optname.Substring(1);

                switch (opt)
                {
                case "norepositionwindow": NoWindowReposition = true; break;

                case "nrw": NoWindowReposition = true; break;

                case "safemode": SafeMode = true; break;

                case "portable": StoreDataInProgramDirectory = true; break;

                case "logexceptions": LogExceptions = true; break;

                case "checkrelease": CheckRelease = true; break;

                case "nocheckrelease": CheckRelease = false; break;

                case "disablemerge": DisableMerge = true; break;

                case "edsmbeta":
                    EDSMClass.ServerAddress = "http://beta.edsm.net:8080/";
                    break;

                case "edsmnull":
                    EDSMClass.ServerAddress = "";
                    break;

                case "disablebetacheck":
                    DisableBetaCommanderCheck = true;
                    break;

                case "forcebeta":           // use to move logs to a beta commander for testing
                    ForceBetaOnCommander = true;
                    break;

                case "resetlanguage": ResetLanguage = true; break;

                case "tempdirindatadir": TempDirInDataDir = true; break;

                case "notempdirindatadir": TempDirInDataDir = false; break;

                case "lowpriority": LowPriority = true; break;

                case "nolowpriority": LowPriority = false; break;

                case "backgroundpriority": BackgroundPriority = true; break;

                case "nobackgroundpriority": BackgroundPriority = false; break;

                case "forcetls12": ForceTLS12 = true; break;

                case "disabletimedisplay": DisableTimeDisplay = true; break;

                default:
                    System.Diagnostics.Debug.WriteLine($"Unrecognized option -{opt}");
                    break;
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine($"Unrecognized non option {optname}");
            }
        }