当前位置: 首页>>代码示例>>C#>>正文


C# PluginProfileErrorCollection.Add方法代码示例

本文整理汇总了C#中PluginProfileErrorCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PluginProfileErrorCollection.Add方法的具体用法?C# PluginProfileErrorCollection.Add怎么用?C# PluginProfileErrorCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginProfileErrorCollection的用法示例。


在下文中一共展示了PluginProfileErrorCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleConnectionError

		public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Mercurial").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is MercurialExecutionException)
			{
                errors.Add(new PluginProfileError { FieldName = "Login", Message = ExtractValidErrorMessage(exception)});
                errors.Add(new PluginProfileError { FieldName = "Password", Message = ExtractValidErrorMessage(exception) });
                errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = ExtractValidErrorMessage(exception) });
				return;
			}

            if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
			{
				errors.Add(new PluginProfileError{ FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
			}

            if (exception is MercurialMissingException)
            {
                errors.Add(new PluginProfileError { Message = MERCURIAL_IS_NOT_INSTALLED_ERROR_MESSAGE });
            }

			var fieldName = string.Empty;
			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:31,代码来源:MercurialCheckConnectionErrorResolver.cs

示例2: HandleConnectionError

		public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Tfs").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is TeamFoundationServiceException)
			{
				errors.Add(new PluginProfileError { FieldName = "Login", Message = exception.Message });
				errors.Add(new PluginProfileError { FieldName = "Password", Message = exception.Message });
				errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = exception.Message });
				return;
			}

			if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
			{
				errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
			}

			var fieldName = string.Empty;
			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError { FieldName = fieldName, Message = exception.Message });
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:26,代码来源:TfsCheckConnectionErrorResolver.cs

示例3: HandleConnectionError

		public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Git").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is TransportException)
			{
				errors.Add(new PluginProfileError {FieldName = "Login", Message = exception.Message});
				errors.Add(new PluginProfileError {FieldName = "Password", Message = exception.Message});
				errors.Add(new PluginProfileError {FieldName = uriFieldName, Message = exception.Message});
				return;
			}

			if (exception is ArgumentNullException)
			{
				errors.Add(new PluginProfileError{FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE});
			}

			var fieldName = string.Empty;
			if (exception is JGitInternalException)
			{
				if (exception.Message.ToLower().Contains("invalid remote") || exception.Message.ToLower().Contains("uri"))
				{
					fieldName = uriFieldName;
				}
			}

			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:34,代码来源:GitCheckConnectionErrorResolver.cs

示例4: HandleConnectionError

		private static void HandleConnectionError(SvnException e, PluginProfileErrorCollection errors)
		{
			if (e is SvnAuthorizationException)
			{
				errors.Add(ErrorFor(ConnectionSettings.LoginField, "Authorization failed"));
				errors.Add(ErrorFor(ConnectionSettings.PasswordField));
			}
			else if (e is SvnAuthenticationException || e.RootCause is SvnAuthenticationException)
			{
				errors.Add(ErrorFor(ConnectionSettings.LoginField, "Authentication failed"));
				errors.Add(ErrorFor(ConnectionSettings.PasswordField));
			}
			else if (e.Message.Contains("200 OK"))
			{
				errors.Add(ErrorFor(ConnectionSettings.UriField, "Invalid path to repository"));
			}
			else if (e is SvnRepositoryIOException)
			{
				errors.Add(ErrorFor(ConnectionSettings.UriField, "Could not connect to server"));
			}
			else if (e is SvnFileSystemException || e is SvnClientUnrelatedResourcesException)
			{
				errors.Add(ErrorFor(SubversionPluginProfile.StartRevisionField));
			}
			else
			{
				errors.Add(ErrorFor(ConnectionSettings.UriField, e.Message.Fmt("Connection failed. {0}")));
			}
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:29,代码来源:SubversionErrorResolver.cs

示例5: ValidateCommand

		private void ValidateCommand(PluginProfileErrorCollection errors)
		{
			if(CommandName.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "CommandName", Message = "Command name shoud not be empty" });
			}
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:7,代码来源:TaskCreatorProfile.cs

示例6: ValidateTasksList

		private void ValidateTasksList(PluginProfileErrorCollection errors)
		{
			if(TasksList.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "TasksList", Message = "Task list shoud not be empty" });
			}
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:7,代码来源:TaskCreatorProfile.cs

示例7: ValidateNameIsNotEmpty

 private void ValidateNameIsNotEmpty(PluginProfileErrorCollection errors)
 {
     if (_dto.Name.IsNullOrWhitespace())
     {
         errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile Name is required"});
     }
 }
开发者ID:FarReachJason,项目名称:Target-Process-Plugins,代码行数:7,代码来源:ProfileDtoValidator.cs

示例8: ValidatePassword

		private void ValidatePassword(PluginProfileErrorCollection errors)
		{
			if (Password.IsNullOrWhitespace())
			{
				errors.Add(new PluginProfileError { FieldName = "Password", Message = "Password should not be empty" });
			}
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:7,代码来源:ConnectionSettings.cs

示例9: ValidateAuthTokenUserId

		private void ValidateAuthTokenUserId(PluginProfileErrorCollection errors)
		{
			if (AuthTokenUserId <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "AuthTokenUserId", Message = "User for authentication should be specified" });
			}
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:7,代码来源:TestRunImportPluginProfile.cs

示例10: ValidateProject

		private void ValidateProject(PluginProfileErrorCollection errors)
		{
			if (Project <= 0)
			{
				errors.Add(new PluginProfileError { FieldName = "Project", Message = "Project should be specified" });
			}
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:7,代码来源:TestRunImportPluginProfile.cs

示例11: Add

		private static PluginProfileErrorCollection Add(PluginProfileErrorCollection errors, Exception e)
		{
			errors.Add(new PluginProfileError
			{
				Message = e.Message
			});
			return errors;
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:8,代码来源:MashupScriptStorageOperations.cs

示例12: ValidateUniqueness

		private void ValidateUniqueness(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
		{
			if (
				ProfileCollection.Any(
					x => string.Equals(x.Name.Value, pluginProfile.Name, StringComparison.InvariantCultureIgnoreCase)))
			{
				errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile name should be unique for plugin"});
			}
		}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:9,代码来源:EditProfileCommandBase.cs

示例13: ValidateNameContainsOnlyValidChars

		protected void ValidateNameContainsOnlyValidChars(PluginProfileErrorCollection errors)
		{
			if (!ProfileDtoValidator.IsValid(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "You can only use letters, numbers, space and underscore symbol in Mashup name"
				});
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:9,代码来源:Mashup.cs

示例14: ValidateNameNotEmpty

		protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
		{
			if (string.IsNullOrWhiteSpace(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "Mashup name cannot be empty or consist of whitespace characters only"
				});
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:9,代码来源:Mashup.cs

示例15: ValidateNameNotEmpty

		protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
		{
			if (string.IsNullOrEmpty(Name))
				errors.Add(new PluginProfileError
				{
					FieldName = NameField,
					Message = "Mashup name should be specified"
				});
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:9,代码来源:MashupDto.cs


注:本文中的PluginProfileErrorCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。