예제 #1
0
 public Boolean TryRemoveTitle(ModTitle titleToRemove)
 {
     if (this.Titles.Count <= 1)
     {
         throw new InvalidOperationException("A mod must always have at least one title. You may not remove the last title from a mod's list of titles.");
     }
     return(this.Titles.Remove(titleToRemove));
 }
예제 #2
0
        public void TryAddTitle(ModTitle newModTitle)
        {
            ObjectValidator.ValidateRequiredObject(newModTitle, nameof(newModTitle));

            if (this.Titles.Exists(t => t.Language.Id == newModTitle.Language.Id && t.Language.Id == newModTitle.LanguageId))
            {
                throw new InvalidOperationException("A title with the specified language already exists for this mod.");
            }

            this.Titles.Add(new ModTitle(newModTitle));
        }