示例#1
0
        protected override AcceptanceReport NameIsValid(string name)
        {
            // any name given?
            if (name.Length < 1)
            {
                return(I18n.NameTooShort);
            }

            // check invalid characters
            var invalidChars = Path.GetInvalidFileNameChars();

            foreach (var invalidChar in invalidChars)
            {
                if (name.Contains(invalidChar))
                {
                    return(I18n.InvalidName(name, new string( invalidChars )));
                }
            }

            // check if file exists
            if (File.Exists(ModListManager.FilePath(name)))
            {
                return(I18n.ModListExists(name));
            }

            return(true);
        }