string CommandSet(string name, string input) { var path = IniAdapter.NameToPath(input); if (path == null) { return("ERROR Invalid Option path"); } var value = IniAdapter.GetValue(input); if (value == null) { return("ERROR Invalid Option value"); } var option = RuntimeProfile.Main.GetOption(path); if (option == null) { return("ERROR Option not found"); } option.Load(value); option.ApplyFromRoot(); return(option.Save()); }
string CommandGet(string name, string input) { var path = IniAdapter.NameToPath(input); if (path == null) { return("ERROR Invalid Option path"); } var option = RuntimeProfile.Main.GetOption(path); if (option == null) { return("ERROR Option not found"); } return(option.Save()); }
protected void ExecutePrompt() { // Enter on empty prompt closes it if (input.Length == 0) { StopPrompt(); // Set a option value } else if (input.Contains("=")) { var path = IniAdapter.NameToPath(input); if (path != null) { var option = RuntimeProfile.Main.GetOption(path); var value = IniAdapter.GetValue(input); if (option != null && value != null) { option.Load(value); option.ApplyFromRoot(); input = ""; } } // Enter on an option shows it's value } else { var path = IniAdapter.NameToPath(input); if (path != null) { var option = RuntimeProfile.Main.GetOption(path); if (option != null) { input += " = " + option.Save(); } } } }
protected void CompletePrompt(int moveIndex = 0) { // Generate completions list if (completions.Count == 0 || moveIndex == 0) { completions.Clear(); var path = IniAdapter.NameToPath(input); if (path != null) { foreach (var option in RuntimeProfile.Main) { if (option.Path.StartsWith(path, StringComparison.OrdinalIgnoreCase)) { CompleteOptionRecursive(path, option, ""); } } } if (completions.Count > 0) { completions.Sort(); completions.Insert(0, input); completions.Add(""); completionIndex = 1; } // Move completions index } else { completionIndex = Mathf.Max(Mathf.Min(completionIndex + moveIndex, completions.Count - 1), 0); } // Show new completion if (completionIndex < completions.Count) { input = completions[completionIndex]; } }