private static string HelpConsoleCommand(string param) { if (string.IsNullOrEmpty(param)) { return("Type " + Color("help list [description]", "33EE33") + " for a list of possible commands, or " + Color("help <command>", "33EE33") + " for a description of a certain command."); } if (param == "list description" || param == "list [description]") { return(GetHelpList(true)); } else if (param == "list") { return(GetHelpList(false)); } else if (commands.ContainsKey(param)) { DevConsoleCommand command = commands[param]; return(Color(param, "33EE33") + " " + command.description + "\n" + (command.helpText == null ? string.Empty : (Color(command.helpText, "DDDDDD")))); } else { return("Help not found for " + Color(param, "33EE33")); } }
public static bool AddCommand(string command, string description, Func <string, string> method, string helpText = null) { //Check if string is valid if (string.IsNullOrEmpty(command)) { Debug.LogError("Could not add ConsoleCommand -" + command + "-. It is empty!"); return(false); } if (commands.ContainsKey(command)) { Debug.LogError("Could not add ConsoleCommand -" + command + "-. It already exists!"); return(false); } //Add command to dictionary DevConsoleCommand consoleCommand = new DevConsoleCommand(description, method, helpText); commands.Add(command, consoleCommand); SortCommands(); return(true); }
public ProjectViewModel(SolutionViewModel solutionViewModel, IProject model) : base(model) { shell = IoC.Get <IShell>(); Items = new ObservableCollection <ProjectItemViewModel>(); Items.BindCollections(model.Items, p => { return(ProjectItemViewModel.Create(p)); }, (pivm, p) => pivm.Model == p); ConfigureCommand = ReactiveCommand.Create(); ConfigureCommand.Subscribe(o => { if (configuration == null) { configuration = new ProjectConfigurationDialogViewModel(model, () => { configuration = null; }); shell.AddDocument(configuration); } else { shell.SelectedDocument = configuration; } //shell.ModalDialog.ShowDialog(); }); DebugCommand = ReactiveCommand.Create(); DebugCommand.Subscribe(_ => { //shell.Debug(model); }); BuildCommand = ReactiveCommand.Create(); BuildCommand.Subscribe(o => { shell.Build(model); }); CleanCommand = ReactiveCommand.Create(); CleanCommand.Subscribe(o => { shell.Clean(model); }); ManageReferencesCommand = ReactiveCommand.Create(); ManageReferencesCommand.Subscribe(o => { }); SetProjectCommand = ReactiveCommand.Create(); SetProjectCommand.Subscribe(o => { model.Solution.StartupProject = model; model.Solution.Save(); shell.InvalidateCodeAnalysis(); foreach (var project in solutionViewModel.Projects) { project.Invalidate(); } }); OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { Platform.OpenFolderInExplorer(Model.CurrentDirectory); }); NewItemCommand = ReactiveCommand.Create(); NewItemCommand.Subscribe(_ => { shell.ModalDialog = new NewItemDialogViewModel(model); shell.ModalDialog.ShowDialog(); }); RemoveCommand = ReactiveCommand.Create(); RemoveCommand.Subscribe(async o => { await shell.CloseDocumentsForProjectAsync(Model); Model.Solution.RemoveProject(Model); Model.Solution.Save(); }); DevConsoleCommand = ReactiveCommand.Create(); DevConsoleCommand.Subscribe(_ => { PlatformSupport.LaunchShell(Model.CurrentDirectory, Model.ToolChain?.BinDirectory, Model.Debugger2?.BinDirectory); }); }