Exemplo n.º 1
0
        private void EditAndGenerateNewRecipe(ObservableFolder <Recipe> folder)
        {
            tempFilePath = Path.GetTempFileName();
            RecipeCreator newRecipe = new RecipeCreator(tempFilePath)
            {
                Name = "NewRecipe",
            };

            newRecipe.Ingredients.Add(new Ingredient("", ""));
            newRecipe.IsDirty           = false;
            newRecipe.ValidateProperty += (sender, propertyName) => ValidateRecipe(sender, folder.Files, propertyName);
            RecipeValidator.SetDefaultRepository(folder.Files);
            EditorForm.OpenItemEditor(newRecipe);
        }
        private void CreateNewCommand(ObservableFolder <Command> folder)
        {
            tempFilePath = Path.GetTempFileName();
            Command newCommand = new Command(tempFilePath)
            {
                ClassName       = "NewCommand",
                Name            = "newcommand",
                Usage           = "/newcommand",
                Permission      = $"{SessionContext.SelectedMod.ModInfo.Name.ToLower()}.newcommand",
                PermissionLevel = 4
            };

            newCommand.IsDirty           = false;
            newCommand.ValidateProperty += (sender, propertyName) => ValidateCommand(sender, folder.Files, propertyName);
            CommandValidator.SetDefaultRepository(folder.Files);
            EditorForm.OpenItemEditor(newCommand);
        }