Exemplo n.º 1
0
        /// <summary>
        /// Initialize the screen
        /// </summary>
        /// <param name="mgr">KSP manager containing the instances, needed for saving changes</param>
        /// <param name="initName">Initial value of name field</param>
        /// <param name="initPath">Initial value of path field</param>
        protected KSPScreen(KSPManager mgr, string initName = "", string initPath = "") : base()
        {
            manager = mgr;

            AddTip("F2", "Accept");
            AddBinding(Keys.F2, (object sender) => {
                if (Valid())
                {
                    Save();
                    // Close screen
                    return(false);
                }
                else
                {
                    // Keep running the screen
                    return(true);
                }
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender) => {
                // Discard changes
                return(false);
            });

            name = new ConsoleField(labelWidth, nameRow, -1, initName);
            path = new ConsoleField(labelWidth, pathRow, -1, initPath);

            AddObject(new ConsoleLabel(1, nameRow, labelWidth, () => "Name:"));
            AddObject(name);
            AddObject(new ConsoleLabel(1, pathRow, labelWidth, () => "Path to KSP:"));
            AddObject(path);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize the popup
        /// </summary>
        public InstallFilterAddDialog() : base()
        {
            int l = GetLeft(),
                r = GetRight();
            int t = GetTop(),
                b = t + 4;

            SetDimensions(l, t, r, b);

            manualEntry = new ConsoleField(
                l + 2, b - 2, r - 2
                )
            {
                GhostText = () => "<Enter a filter>"
            };
            AddObject(manualEntry);
            manualEntry.AddTip("Enter", "Accept value");
            manualEntry.AddBinding(Keys.Enter, (object sender, ConsoleTheme theme) => {
                choice = manualEntry.Value;
                return(false);
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender, ConsoleTheme theme) => {
                choice = null;
                return(false);
            });

            CenterHeader = () => "Add Filter";
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize the popup.
        /// </summary>
        public AuthTokenAddDialog() : base()
        {
            CenterHeader = () => "Create Authentication Key";

            int top = (Console.WindowHeight - height) / 2;

            SetDimensions(6, top, -6, top + height - 1);

            int l = GetLeft(),
                r = GetRight(),
                t = GetTop(),
                b = GetBottom();

            AddObject(new ConsoleLabel(
                          l + 2, t + 2, l + 2 + labelW,
                          () => "Host:",
                          th => th.PopupBg,
                          th => th.PopupFg
                          ));

            hostEntry = new ConsoleField(
                l + 2 + labelW + wPad, t + 2, r - 3
                )
            {
                GhostText = () => "<Enter a host name>"
            };
            AddObject(hostEntry);

            AddObject(new ConsoleLabel(
                          l + 2, t + 4, l + 2 + labelW,
                          () => "Token:",
                          th => th.PopupBg,
                          th => th.PopupFg
                          ));

            tokenEntry = new ConsoleField(
                l + 2 + labelW + wPad, t + 4, r - 3
                )
            {
                GhostText = () => "<Enter an authentication token>"
            };
            AddObject(tokenEntry);

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender, ConsoleTheme theme) => false);

            AddTip("Enter", "Accept", validKey);
            AddBinding(Keys.Enter, (object sender, ConsoleTheme theme) => {
                if (validKey())
                {
                    ServiceLocator.Container.Resolve <IConfiguration>().SetAuthToken(hostEntry.Value, tokenEntry.Value);
                    return(false);
                }
                else
                {
                    // Don't close window on Enter unless adding a key
                    return(true);
                }
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// Construct the screens
        /// </summary>
        /// <param name="game">Game from which to get repos</param>
        /// <param name="reps">Collection of Repository objects</param>
        /// <param name="initName">Initial value of the Name field</param>
        /// <param name="initUrl">Iniital value of the URL field</param>
        protected RepoScreen(IGame game, SortedDictionary <string, Repository> reps, string initName, string initUrl) : base()
        {
            editList     = reps;
            defaultRepos = RepositoryList.DefaultRepositories(game);

            name = new ConsoleField(labelWidth, nameRow, -1, initName)
            {
                GhostText = () => "<Enter the name to use for this repository>"
            };
            url = new ConsoleField(labelWidth, urlRow, -1, initUrl)
            {
                GhostText = () => "<Enter the URL of this repository>"
            };

            AddObject(new ConsoleLabel(1, nameRow, labelWidth, () => "Name:"));
            AddObject(name);
            AddObject(new ConsoleLabel(1, urlRow, labelWidth, () => "URL:"));
            AddObject(url);

            AddTip("F2", "Accept");
            AddBinding(Keys.F2, (object sender, ConsoleTheme theme) => {
                if (Valid())
                {
                    Save();
                    return(false);
                }
                else
                {
                    return(true);
                }
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender, ConsoleTheme theme) => {
                return(false);
            });

            // mainMenu = list of default options
            if (defaultRepos.repositories != null && defaultRepos.repositories.Length > 0)
            {
                List <ConsoleMenuOption> opts = new List <ConsoleMenuOption>();
                foreach (Repository r in defaultRepos.repositories)
                {
                    // This variable will be remembered correctly in our lambdas later
                    Repository repo = r;
                    opts.Add(new ConsoleMenuOption(
                                 repo.name, "", $"Import values from default mod list source {repo.name}",
                                 true, (ConsoleTheme theme) => {
                        name.Value    = repo.name;
                        name.Position = name.Value.Length;
                        url.Value     = repo.uri.ToString();
                        url.Position  = url.Value.Length;
                        return(true);
                    }
                                 ));
                }
                mainMenu = new ConsolePopupMenu(opts);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initialize the popup
        /// </summary>
        public CompatibleVersionDialog(IGame game) : base()
        {
            int l = GetLeft(),
                r = GetRight();
            int t = GetTop(),
                b = GetBottom();

            loadOptions(game);
            choices = new ConsoleListBox <GameVersion>(
                l + 2, t + 2, r - 2, b - 4,
                options,
                new List <ConsoleListBoxColumn <GameVersion> >()
            {
                new ConsoleListBoxColumn <GameVersion>()
                {
                    Header   = "Predefined Version",
                    Width    = r - l - 5,
                    Renderer = v => v.ToString(),
                    Comparer = (v1, v2) => v1.CompareTo(v2)
                }
            },
                0, 0, ListSortDirection.Descending
                );
            AddObject(choices);
            choices.AddTip("Enter", "Select version");
            choices.AddBinding(Keys.Enter, (object sender, ConsoleTheme theme) => {
                choice = choices.Selection;
                return(false);
            });

            manualEntry = new ConsoleField(
                l + 2, b - 2, r - 2
                )
            {
                GhostText = () => "<Enter a version>"
            };
            AddObject(manualEntry);
            manualEntry.AddTip("Enter", "Accept value", () => GameVersion.TryParse(manualEntry.Value, out choice));
            manualEntry.AddBinding(Keys.Enter, (object sender, ConsoleTheme theme) => {
                if (GameVersion.TryParse(manualEntry.Value, out choice))
                {
                    // Good value, done running
                    return(false);
                }
                else
                {
                    // Not valid, so they can't even see the key binding
                    return(true);
                }
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender, ConsoleTheme theme) => {
                choice = null;
                return(false);
            });

            CenterHeader = () => "Select Compatible Version";
        }
Exemplo n.º 6
0
 static void Main(string[] args)
 {
     ConsoleField field = new ConsoleField();
     while (field.Start())
     {
         field = new ConsoleField();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Construct the screens
        /// </summary>
        /// <param name="reps">Collection of Repository objects</param>
        /// <param name="initName">Initial value of the Name field</param>
        /// <param name="initUrl">Iniital value of the URL field</param>
        protected RepoScreen(SortedDictionary <string, Repository> reps, string initName, string initUrl) : base()
        {
            editList = reps;

            name = new ConsoleField(labelWidth, nameRow, -1, initName);
            url  = new ConsoleField(labelWidth, urlRow, -1, initUrl);

            AddObject(new ConsoleLabel(1, nameRow, labelWidth, () => "Name:"));
            AddObject(name);
            AddObject(new ConsoleLabel(1, urlRow, labelWidth, () => "URL:"));
            AddObject(url);

            AddTip("F2", "Accept");
            AddBinding(Keys.F2, (object sender) => {
                if (Valid())
                {
                    Save();
                    return(false);
                }
                else
                {
                    return(true);
                }
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender) => {
                return(false);
            });

            // mainMenu = list of default options
            if (defaultRepos.repositories != null && defaultRepos.repositories.Length > 0)
            {
                List <ConsoleMenuOption> opts = new List <ConsoleMenuOption>();
                foreach (Repository r in defaultRepos.repositories)
                {
                    // This variable will be remembered correctly in our lambdas later
                    Repository repo = r;
                    opts.Add(new ConsoleMenuOption(
                                 repo.name, "", $"Import values from default mod list source {repo.name}",
                                 true, () => {
                        name.Value    = repo.name;
                        name.Position = name.Value.Length;
                        url.Value     = repo.uri.ToString();
                        url.Position  = url.Value.Length;
                        return(true);
                    }
                                 ));
                }
                mainMenu = new ConsolePopupMenu(opts);
            }

            LeftHeader   = () => $"CKAN {Meta.GetVersion()}";
            CenterHeader = () => "Edit Mod List Source";
        }
Exemplo n.º 8
0
        private static ConsoleClass ReadClass(StringReader SR, string line, string classComment)
        {
            ConsoleClass retClass = new ConsoleClass();
            // Make sure that we are actually able to parse the class and fetch the className and parentClassName
            Match declarationMatch = Patterns.MatchClassDeclaration(line);

            if (!declarationMatch.Success)
            {
                declarationMatch = Patterns.MatchSimObjectClassDeclaration(line);
                if (!declarationMatch.Success)
                {
                    Console.WriteLine("Error parsing class: " + line);
                    throw new ArgumentException("Error parsing class: " + line);
                }
                retClass.ClassName = declarationMatch.Groups[1].Value.Trim();
            }
            else
            {
                retClass.ClassName       = declarationMatch.Groups[1].Value.Trim();
                retClass.ParentClassName = declarationMatch.Groups[3].Value.Trim();
            }
            // Set the comment
            retClass.Comment = classComment;
            string currentComment = null;

            line = SR.ReadLine();
            // Until we come to the end of the class
            while (!Patterns.LineEndsABody(line))
            {
                // Read class comments, methods and fields
                if (Patterns.LineStartsAMultilineComment(line))
                {
                    currentComment = ReadComment(SR, line);
                }
                else if (Patterns.LineContainsAFunction(line))
                {
                    ConsoleFunction method = ReadFunction(SR, line, currentComment);
                    currentComment = null;
                    retClass.Methods.Add(method);
                }
                else if (Patterns.LineContainsACallback(line))
                {
                    //TODO Read callback here
                }
                else if (Patterns.LineContainsAField(line))
                {
                    ConsoleField field = ReadField(SR, line, currentComment);
                    currentComment = null;
                    retClass.Fields.Add(field);
                }
                line = SR.ReadLine();
            }
            return(retClass);
        }
Exemplo n.º 9
0
        private static ConsoleField ReadField(StringReader sr, string line, string fieldComment)
        {
            ConsoleField field        = new ConsoleField();
            Match        fieldMatches = Patterns.MatchField(line);
            string       type         = fieldMatches.Groups[1].Value.Trim();
            string       name         = fieldMatches.Groups[2].Value.Trim();

            if (fieldMatches.Groups[3].Value != string.Empty)
            {
                field.ElementCount = int.Parse(fieldMatches.Groups[3].Value);
            }
            field.Type = type;
            field.Name = name;
            return(field);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initialize the screen
        /// </summary>
        /// <param name="mgr">Game instance manager containing the instances, needed for saving changes</param>
        /// <param name="initName">Initial value of name field</param>
        /// <param name="initPath">Initial value of path field</param>
        protected GameInstanceScreen(GameInstanceManager mgr, string initName = "", string initPath = "") : base()
        {
            manager = mgr;

            AddTip("F2", "Accept");
            AddBinding(Keys.F2, (object sender) => {
                if (Valid())
                {
                    Save();
                    // Close screen
                    return(false);
                }
                else
                {
                    // Keep running the screen
                    return(true);
                }
            });

            AddTip("Esc", "Cancel");
            AddBinding(Keys.Escape, (object sender) => {
                // Discard changes
                return(false);
            });

            name = new ConsoleField(labelWidth, nameRow, -1, initName)
            {
                GhostText = () => "<Enter the name to use for this game instance>"
            };
            path = new ConsoleField(labelWidth, pathRow, -1, initPath)
            {
                GhostText = () => "<Enter the location of this game instance on disk>"
            };

            AddObject(new ConsoleLabel(1, nameRow, labelWidth, () => "Name:"));
            AddObject(name);
            AddObject(new ConsoleLabel(1, pathRow, labelWidth, () => "Path to game instance:"));
            AddObject(path);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initialize the screen
        /// </summary>
        /// <param name="mgr">Game instance manager object containing the current instance</param>
        /// <param name="dbg">True if debug options should be available, false otherwise</param>
        public ModListScreen(GameInstanceManager mgr, bool dbg)
        {
            debug    = dbg;
            manager  = mgr;
            registry = RegistryManager.Instance(manager.CurrentInstance).registry;

            moduleList = new ConsoleListBox <CkanModule>(
                1, 4, -1, -2,
                GetAllMods(),
                new List <ConsoleListBoxColumn <CkanModule> >()
            {
                new ConsoleListBoxColumn <CkanModule>()
                {
                    Header   = "",
                    Width    = 1,
                    Renderer = StatusSymbol
                }, new ConsoleListBoxColumn <CkanModule>()
                {
                    Header   = "Name",
                    Width    = 44,
                    Renderer = m => m.name ?? ""
                }, new ConsoleListBoxColumn <CkanModule>()
                {
                    Header   = "Version",
                    Width    = 10,
                    Renderer = m => ModuleInstaller.StripEpoch(m.version?.ToString() ?? ""),
                    Comparer = (a, b) => a.version.CompareTo(b.version)
                }, new ConsoleListBoxColumn <CkanModule>()
                {
                    Header   = "Max game version",
                    Width    = 17,
                    Renderer = m => registry.LatestCompatibleKSP(m.identifier)?.ToString() ?? "",
                    Comparer = (a, b) => registry.LatestCompatibleKSP(a.identifier).CompareTo(registry.LatestCompatibleKSP(b.identifier))
                }
            },
                1, 0, ListSortDirection.Descending,
                (CkanModule m, string filter) => {
                // Search for author
                if (filter.StartsWith("@"))
                {
                    string authorFilt = filter.Substring(1);
                    if (string.IsNullOrEmpty(authorFilt))
                    {
                        return(true);
                    }
                    else
                    {
                        // Remove special characters from search term
                        authorFilt = CkanModule.nonAlphaNums.Replace(authorFilt, "");
                        return(m.SearchableAuthors.Any((author) => author.IndexOf(authorFilt, StringComparison.CurrentCultureIgnoreCase) == 0));
                    }
                    // Other special search params: installed, updatable, new, conflicting and dependends
                }
                else if (filter.StartsWith("~"))
                {
                    if (filter.Length <= 1)
                    {
                        // Don't blank the list for just "~" by itself
                        return(true);
                    }
                    else
                    {
                        switch (filter.Substring(1, 1))
                        {
                        case "i":
                            return(registry.IsInstalled(m.identifier, false));

                        case "u":
                            return(registry.HasUpdate(m.identifier, manager.CurrentInstance.VersionCriteria()));

                        case "n":
                            // Filter new
                            return(recent.Contains(m.identifier));

                        case "c":
                            if (m.conflicts != null)
                            {
                                string conflictsWith = filter.Substring(2);
                                // Search for mods depending on a given mod
                                foreach (var rel in m.conflicts)
                                {
                                    if (rel.StartsWith(conflictsWith))
                                    {
                                        return(true);
                                    }
                                }
                            }
                            return(false);

                        case "d":
                            if (m.depends != null)
                            {
                                string dependsOn = filter.Substring(2);
                                // Search for mods depending on a given mod
                                foreach (var rel in m.depends)
                                {
                                    if (rel.StartsWith(dependsOn))
                                    {
                                        return(true);
                                    }
                                }
                            }
                            return(false);
                        }
                    }
                    return(false);
                }
                else
                {
                    filter = CkanModule.nonAlphaNums.Replace(filter, "");

                    return(m.SearchableIdentifier.IndexOf(filter, StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                           m.SearchableName.IndexOf(filter, StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                           m.SearchableAbstract.IndexOf(filter, StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                           m.SearchableDescription.IndexOf(filter, StringComparison.CurrentCultureIgnoreCase) >= 0);
                }
            }
                );

            searchBox = new ConsoleField(-searchWidth, 2, -1)
            {
                GhostText = () => Focused() == searchBox
                    ? "<Type to search>"
                    : "<Ctrl+F to search>"
            };
            searchBox.OnChange += (ConsoleField sender, string newValue) => {
                moduleList.FilterString = newValue;
            };

            AddObject(new ConsoleLabel(
                          1, 2, -searchWidth - 2,
                          () => $"{moduleList.VisibleRowCount()} mods"
                          ));
            AddObject(searchBox);
            AddObject(moduleList);

            AddBinding(Keys.CtrlQ, (object sender, ConsoleTheme theme) => false);
            AddBinding(Keys.AltX, (object sender, ConsoleTheme theme) => false);
            AddBinding(Keys.F1, (object sender, ConsoleTheme theme) => Help(theme));
            AddBinding(Keys.AltH, (object sender, ConsoleTheme theme) => Help(theme));
            AddBinding(Keys.F5, (object sender, ConsoleTheme theme) => UpdateRegistry(theme));
            AddBinding(Keys.CtrlR, (object sender, ConsoleTheme theme) => UpdateRegistry(theme));
            AddBinding(Keys.CtrlU, (object sender, ConsoleTheme theme) => UpgradeAll(theme));

            // Now a bunch of convenience shortcuts so you don't get stuck in the search box
            searchBox.AddBinding(Keys.PageUp, (object sender, ConsoleTheme theme) => {
                SetFocus(moduleList);
                return(true);
            });
            searchBox.AddBinding(Keys.PageDown, (object sender, ConsoleTheme theme) => {
                SetFocus(moduleList);
                return(true);
            });
            searchBox.AddBinding(Keys.Enter, (object sender, ConsoleTheme theme) => {
                SetFocus(moduleList);
                return(true);
            });

            moduleList.AddBinding(Keys.CtrlF, (object sender, ConsoleTheme theme) => {
                SetFocus(searchBox);
                return(true);
            });
            moduleList.AddBinding(Keys.Escape, (object sender, ConsoleTheme theme) => {
                searchBox.Clear();
                return(true);
            });

            moduleList.AddTip("Enter", "Details",
                              () => moduleList.Selection != null
                              );
            moduleList.AddBinding(Keys.Enter, (object sender, ConsoleTheme theme) => {
                if (moduleList.Selection != null)
                {
                    LaunchSubScreen(theme, new ModInfoScreen(manager, plan, moduleList.Selection, debug));
                }
                return(true);
            });

            // Conditionally show only one of these based on selected mod status

            moduleList.AddTip("+", "Install",
                              () => moduleList.Selection != null && !moduleList.Selection.IsDLC &&
                              !registry.IsInstalled(moduleList.Selection.identifier, false)
                              );
            moduleList.AddTip("+", "Upgrade",
                              () => moduleList.Selection != null && !moduleList.Selection.IsDLC &&
                              registry.HasUpdate(moduleList.Selection.identifier, manager.CurrentInstance.VersionCriteria())
                              );
            moduleList.AddTip("+", "Replace",
                              () => moduleList.Selection != null &&
                              registry.GetReplacement(moduleList.Selection.identifier, manager.CurrentInstance.VersionCriteria()) != null
                              );
            moduleList.AddBinding(Keys.Plus, (object sender, ConsoleTheme theme) => {
                if (moduleList.Selection != null && !moduleList.Selection.IsDLC)
                {
                    if (!registry.IsInstalled(moduleList.Selection.identifier, false))
                    {
                        plan.ToggleInstall(moduleList.Selection);
                    }
                    else if (registry.IsInstalled(moduleList.Selection.identifier, false) &&
                             registry.HasUpdate(moduleList.Selection.identifier, manager.CurrentInstance.VersionCriteria()))
                    {
                        plan.ToggleUpgrade(moduleList.Selection);
                    }
                    else if (registry.GetReplacement(moduleList.Selection.identifier, manager.CurrentInstance.VersionCriteria()) != null)
                    {
                        plan.ToggleReplace(moduleList.Selection.identifier);
                    }
                }
                return(true);
            });

            moduleList.AddTip("-", "Remove",
                              () => moduleList.Selection != null && !moduleList.Selection.IsDLC &&
                              registry.IsInstalled(moduleList.Selection.identifier, false) &&
                              !registry.IsAutodetected(moduleList.Selection.identifier)
                              );
            moduleList.AddBinding(Keys.Minus, (object sender, ConsoleTheme theme) => {
                if (moduleList.Selection != null && !moduleList.Selection.IsDLC &&
                    registry.IsInstalled(moduleList.Selection.identifier, false) &&
                    !registry.IsAutodetected(moduleList.Selection.identifier))
                {
                    plan.ToggleRemove(moduleList.Selection);
                }
                return(true);
            });

            moduleList.AddTip("F8", "Mark auto-installed",
                              () => moduleList.Selection != null && !moduleList.Selection.IsDLC &&
                              (!registry.InstalledModule(moduleList.Selection.identifier)?.AutoInstalled ?? false)
                              );
            moduleList.AddTip("F8", "Mark user-selected",
                              () => moduleList.Selection != null && !moduleList.Selection.IsDLC &&
                              (registry.InstalledModule(moduleList.Selection.identifier)?.AutoInstalled ?? false)
                              );
            moduleList.AddBinding(Keys.F8, (object sender, ConsoleTheme theme) => {
                InstalledModule im = registry.InstalledModule(moduleList.Selection.identifier);
                if (im != null && !moduleList.Selection.IsDLC)
                {
                    im.AutoInstalled = !im.AutoInstalled;
                    RegistryManager.Instance(manager.CurrentInstance).Save(false);
                }
                return(true);
            });

            AddTip("F9", "Apply changes", plan.NonEmpty);
            AddBinding(Keys.F9, (object sender, ConsoleTheme theme) => {
                ApplyChanges(theme);
                return(true);
            });

            // Show total download size of all installed mods
            AddObject(new ConsoleLabel(
                          1, -1, searchWidth,
                          () => $"{CkanModule.FmtSize(totalInstalledDownloadSize())} installed",
                          null,
                          th => th.DimLabelFg
                          ));

            AddObject(new ConsoleLabel(
                          -searchWidth, -1, -2,
                          () => {
                int days = daysSinceUpdated(registryFilePath());
                return(days < 1 ? ""
                        :  days == 1 ? $"Updated at least {days} day ago"
                        :              $"Updated at least {days} days ago");
            },
                          null,
                          (ConsoleTheme th) => {
                int daysSince = daysSinceUpdated(registryFilePath());
                if (daysSince < daysTillStale)
                {
                    return(th.RegistryUpToDate);
                }
                else if (daysSince < daystillVeryStale)
                {
                    return(th.RegistryStale);
                }
                else
                {
                    return(th.RegistryVeryStale);
                }
            }
                          ));

            List <ConsoleMenuOption> opts = new List <ConsoleMenuOption>()
            {
                new ConsoleMenuOption("Sort...", "",
                                      "Change the sorting of the list of mods",
                                      true, null, null, moduleList.SortMenu()),
                null,
                new ConsoleMenuOption("Refresh mod list", "F5, Ctrl+R",
                                      "Refresh the list of mods",
                                      true, UpdateRegistry),
                new ConsoleMenuOption("Upgrade all", "Ctrl+U",
                                      "Mark all available updates for installation",
                                      true, UpgradeAll, null, null, HasAnyUpgradeable()),
                new ConsoleMenuOption("Audit recommendations", "",
                                      "List mods suggested and recommended by installed mods",
                                      true, ViewSuggestions),
                new ConsoleMenuOption("Import downloads...", "",
                                      "Select manually downloaded mods to import into CKAN",
                                      true, ImportDownloads),
                new ConsoleMenuOption("Export installed...", "",
                                      "Save your mod list",
                                      true, ExportInstalled),
                null,
                new ConsoleMenuOption("Select game instance...", "",
                                      "Switch to a different game instance",
                                      true, SelectInstall),
                new ConsoleMenuOption("Authentication tokens...", "",
                                      "Edit authentication tokens sent to download servers",
                                      true, EditAuthTokens),
                null,
                new ConsoleMenuOption("Help", helpKey,
                                      "Tips & tricks",
                                      true, Help),
                null,
                new ConsoleMenuOption("Quit", "Ctrl+Q",
                                      "Exit to DOS",
                                      true, (ConsoleTheme th) => false)
            };

            if (debug)
            {
                opts.Add(null);
                opts.Add(new ConsoleMenuOption("DEBUG: Capture key...", "",
                                               "Print details of how your system reports a keystroke for debugging",
                                               true, CaptureKey));
            }
            mainMenu = new ConsolePopupMenu(opts);
        }
Exemplo n.º 12
0
 public void Log(string s)
 {
     ConsoleField.AppendText(s + "\n");
 }