コード例 #1
0
        private static string GetMessage(ProjectItemRenameError error, Exception innerException)
        {
            switch (error)
            {
            case ProjectItemRenameError.EmptyString:
            {
                return(StringTable.RenameProjectItemFileNameEmptyError);
            }

            case ProjectItemRenameError.StartsWithPeriod:
            {
                return(StringTable.RenameProjectItemFileNameStartsWithPeriodError);
            }

            case ProjectItemRenameError.ContainsInvalidCharacters:
            {
                return(StringTable.RenameProjectItemFileNameContainsInvalidCharactersError);
            }

            case ProjectItemRenameError.IsReservedName:
            {
                return(StringTable.RenameProjectItemFileNameIsReservedNameError);
            }

            case ProjectItemRenameError.DuplicateName:
            {
                return(StringTable.RenameProjectItemDuplicateName);
            }

            case ProjectItemRenameError.Exception:
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                string      renameProjectItemRenameFailed = StringTable.RenameProjectItemRenameFailed;
                object[]    message = new object[] { innerException.Message };
                return(string.Format(currentCulture, renameProjectItemRenameFailed, message));
            }
            }
            return(string.Empty);
        }
コード例 #2
0
 private void Init(ProjectItemRenameError error, IProjectItem projectItem, string attemptedName)
 {
     this.Error         = error;
     this.ProjectItem   = projectItem;
     this.AttemptedName = attemptedName;
 }
コード例 #3
0
 public ProjectItemRenameException(Exception innerException, ProjectItemRenameError error, IProjectItem projectItem, string attemptedName) : base(ProjectItemRenameException.GetMessage(error, innerException), innerException)
 {
     this.Init(error, projectItem, attemptedName);
 }
コード例 #4
0
 public ProjectItemRenameException(ProjectItemRenameError error, IProjectItem projectItem, string attemptedName) : this(null, error, projectItem, attemptedName)
 {
 }