Exemple #1
0
        protected override AcceptanceReport NameIsValid(string newName)
        {
            // always ok if we didn't change anything
            if (newName == _blueprint.name)
            {
                return(true);
            }

            // otherwise check for used symbols and uniqueness
            AcceptanceReport validName = Blueprint.IsValidBlueprintName(newName);

            if (!validName.Accepted)
            {
                return(validName);
            }

            // finally, if we're renaming an already exported blueprint, check if the new name doesn't already exist
            if (_blueprint.exported && !Controller.TryRenameFile(_blueprint, newName))
            {
                return(new AcceptanceReport("Fluffy.Blueprints.ExportedBlueprintWithThatNameAlreadyExists".Translate(newName)));
            }

            // if all checks are passed, return true.
            return(true);
        }