本文整理汇总了C#中Dev2.DataList.Contract.ErrorResultTO类的典型用法代码示例。如果您正苦于以下问题:C# ErrorResultTO类的具体用法?C# ErrorResultTO怎么用?C# ErrorResultTO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorResultTO类属于Dev2.DataList.Contract命名空间,在下文中一共展示了ErrorResultTO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GenerateUserFriendlyModel
public string GenerateUserFriendlyModel(IExecutionEnvironment env, Dev2DecisionMode mode, out ErrorResultTO errors)
{
StringBuilder result = new StringBuilder("");
int cnt = 0;
errors = new ErrorResultTO();
// build the output for decisions
foreach(Dev2Decision dd in TheStack)
{
result.Append(dd.GenerateUserFriendlyModel(env, Mode, out errors));
// append mode if not at end
if((cnt + 1) < TheStack.Count)
{
result.Append(Mode);
}
result.AppendLine();
cnt++;
}
// append the arms
result.Append("THEN " + TrueArmText);
result.AppendLine();
result.Append("ELSE " + FalseArmText);
return result.ToString();
}
开发者ID:ndubul,项目名称:Chillas,代码行数:27,代码来源:Dev2DecisionStack.cs
示例2: MockExecutionImpl
public System.Guid MockExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out DataList.Contract.ErrorResultTO tmpErrors)
{
tmpErrors = new ErrorResultTO();
tmpErrors.AddError("Something bad happened");
return Guid.Empty;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:7,代码来源:MockDsfPluginActivity.cs
示例3: Webservice_Test_WhenRequestShouldTimeout_ExpectTimeoutMessage
public void Webservice_Test_WhenRequestShouldTimeout_ExpectTimeoutMessage()
{
//------------Setup for test--------------------------
var serviceXml = XmlResource.Fetch("WebService");
var sourceXml = XmlResource.Fetch("WebSource");
var response = JsonResource.Fetch("cryptsy_all_markets");
var service = new WebService(serviceXml) { Source = new WebSource(sourceXml) };
foreach(var parameter in service.Method.Parameters)
{
parameter.Value = parameter.DefaultValue;
}
var webExecuteHitCount = 0;
var resourceCatalog = new Mock<IResourceCatalog>();
var services = new WebServicesMock(resourceCatalog.Object,
(WebSource source, WebRequestMethod method, string uri, string data, bool error, out ErrorResultTO errors, string[] headers) =>
{
webExecuteHitCount++;
errors = new ErrorResultTO();
return response;
});
//------------Execute Test---------------------------
var result = services.Test(service.ToString(), Guid.Empty, Guid.Empty);
//------------Assert Results-------------------------
Assert.AreEqual(1, webExecuteHitCount);
Assert.AreEqual(GlobalConstants.WebServiceTimeoutMessage, result.RequestMessage);
}
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:31,代码来源:WebServicesTest.cs
示例4: ExecutionImpl
protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO errors, int update)
{
var execErrors = new ErrorResultTO();
errors = new ErrorResultTO();
errors.MergeErrors(execErrors);
var databaseServiceExecution = ServiceExecution as DatabaseServiceExecution;
if(databaseServiceExecution != null)
{
databaseServiceExecution.InstanceInputDefinitions = inputs; // set the output mapping for the instance ;)
databaseServiceExecution.InstanceOutputDefintions = outputs; // set the output mapping for the instance ;)
}
//ServiceExecution.DataObj = dataObject;
var result = ServiceExecution.Execute(out execErrors, update);
var fetchErrors = execErrors.FetchErrors();
foreach(var error in fetchErrors)
{
dataObject.Environment.Errors.Add(error);
}
errors.MergeErrors(execErrors);
// Adjust the remaining output mappings ;)
return result;
}
开发者ID:Robin--,项目名称:Warewolf,代码行数:26,代码来源:DsfDatabaseActivity.cs
示例5: GenerateRequestDictionaryFromDataObject
private void GenerateRequestDictionaryFromDataObject(out ErrorResultTO errors)
{
var compiler = DataListFactory.CreateDataListCompiler();
errors = new ErrorResultTO();
ErrorResultTO invokeErrors;
IBinaryDataList bdl = compiler.FetchBinaryDataList(DataObject.DataListID, out invokeErrors);
errors.MergeErrors(invokeErrors);
if(!invokeErrors.HasErrors())
{
foreach(IBinaryDataListEntry entry in bdl.FetchScalarEntries())
{
IBinaryDataListItem itm = entry.FetchScalar();
if(!DataListUtil.IsSystemTag(itm.FieldName))
{
var stringBuilder = new StringBuilder("");
try
{
stringBuilder = new StringBuilder(itm.TheValue);
}
// ReSharper disable EmptyGeneralCatchClause
catch(Exception)
// ReSharper restore EmptyGeneralCatchClause
{
}
Request.AddArgument(itm.FieldName, stringBuilder);
}
}
}
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:32,代码来源:InternalServiceContainer.cs
示例6: Execute
public override Guid Execute(out ErrorResultTO errors, int update)
{
WebserviceExecution.InstanceInputDefinitions = InstanceInputDefinition;
WebserviceExecution.InstanceOutputDefintions = InstanceOutputDefinition;
var result = WebserviceExecution.Execute(out errors, update);
return result;
}
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:7,代码来源:WebServiceContainer.cs
示例7: ConvertToDataTable
public DataTable ConvertToDataTable(IBinaryDataList input, string recsetName, out ErrorResultTO errors, PopulateOptions populateOptions)
{
if(String.IsNullOrEmpty(recsetName))
{
throw new ArgumentNullException("recsetName");
}
if(input == null)
{
throw new ArgumentNullException("input");
}
var dbData = new DataTable();
IBinaryDataListEntry entry;
errors = null;
string error;
if(input.TryGetEntry(recsetName, out entry, out error))
{
if(entry.IsRecordset)
{
var cols = entry.Columns;
var dataColumns = cols.ToList().ConvertAll(column => new DataColumn(column.ColumnName));
dbData.Columns.AddRange(dataColumns.ToArray());
var fetchRecordsetIndexes = entry.FetchRecordsetIndexes();
while(fetchRecordsetIndexes.HasMore())
{
var binaryDataListItems = entry.FetchRowAt(fetchRecordsetIndexes.FetchNextIndex(), out error);
if(populateOptions == PopulateOptions.IgnoreBlankRows && binaryDataListItems.All(item =>
{
string theValue;
try
{
theValue = item.TheValue;
}
catch(Exception)
{
theValue = null;
}
return String.IsNullOrEmpty(theValue);
}))
{
continue;
}
dbData.LoadDataRow(binaryDataListItems.Select(item =>
{
string theValue;
try
{
theValue = item.TheValue;
}
catch(Exception)
{
theValue = null;
}
return theValue as object;
}).ToArray(), LoadOption.OverwriteChanges);
}
}
}
return dbData;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:59,代码来源:DataListDataTableTranslator.cs
示例8: Execute
public override Guid Execute(out ErrorResultTO errors)
{
_pluginServiceExecution.InstanceInputDefinitions = InstanceInputDefinition;
_pluginServiceExecution.InstanceOutputDefintions = InstanceOutputDefinition;
var result = _pluginServiceExecution.Execute(out errors);
return result;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:8,代码来源:PluginServiceContainer.cs
示例9: ExecuteConcreteAction
protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
{
IList<OutputTO> outputs = new List<OutputTO>();
allErrors = new ErrorResultTO();
var colItr = new WarewolfListIterator();
//get all the possible paths for all the string variables
var outputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update));
colItr.AddVariableToIterateOn(outputItr);
var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));
colItr.AddVariableToIterateOn(unameItr);
var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword,update));
colItr.AddVariableToIterateOn(passItr);
var privateKeyItr = new WarewolfIterator(dataObject.Environment.Eval(PrivateKeyFile, update));
colItr.AddVariableToIterateOn(privateKeyItr);
if(dataObject.IsDebugMode())
{
AddDebugInputItem(new DebugEvalResult(OutputPath, "File or Folder", dataObject.Environment, update));
AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite"));
AddDebugInputItemUserNamePassword(dataObject.Environment, update);
if (!string.IsNullOrEmpty(PrivateKeyFile))
{
AddDebugInputItem(PrivateKeyFile, "Destination Private Key File", dataObject.Environment, update);
}
}
while(colItr.HasMoreData())
{
IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
Dev2CRUDOperationTO opTo = new Dev2CRUDOperationTO(Overwrite);
try
{
IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(outputItr),
colItr.FetchNextValue(unameItr),
colItr.FetchNextValue(passItr),
true, colItr.FetchNextValue(privateKeyItr));
IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
string result = broker.Create(dstEndPoint, opTo, true);
outputs.Add(DataListFactory.CreateOutputTO(Result, result));
}
catch(Exception e)
{
outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
allErrors.AddError(e.Message);
break;
}
}
return outputs;
}
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:58,代码来源:DsfPathCreate.cs
示例10: ExecuteConcreteAction
protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
{
IList<OutputTO> outputs = new List<OutputTO>();
allErrors = new ErrorResultTO();
var colItr = new WarewolfListIterator();
//get all the possible paths for all the string variables
var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath, update));
colItr.AddVariableToIterateOn(inputItr);
var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));
colItr.AddVariableToIterateOn(unameItr);
var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword,update));
colItr.AddVariableToIterateOn(passItr);
var privateKeyItr = new WarewolfIterator(dataObject.Environment.Eval(PrivateKeyFile, update));
colItr.AddVariableToIterateOn(privateKeyItr);
outputs.Add(DataListFactory.CreateOutputTO(Result));
if(dataObject.IsDebugMode())
{
AddDebugInputItem(InputPath, "Input Path", dataObject.Environment, update);
AddDebugInputItemUserNamePassword(dataObject.Environment, update);
if(!string.IsNullOrEmpty(PrivateKeyFile))
{
AddDebugInputItem(PrivateKeyFile, "Private Key File", dataObject.Environment, update);
}
}
while(colItr.HasMoreData())
{
IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
IActivityIOPath ioPath = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
colItr.FetchNextValue(unameItr),
colItr.FetchNextValue(passItr),
true, colItr.FetchNextValue(privateKeyItr));
IActivityIOOperationsEndPoint endpoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ioPath);
try
{
string result = broker.Get(endpoint);
outputs[0].OutputStrings.Add(result);
}
catch(Exception e)
{
outputs[0].OutputStrings.Add(null);
allErrors.AddError(e.Message);
break;
}
}
return outputs;
}
开发者ID:Robin--,项目名称:Warewolf,代码行数:57,代码来源:DsfFileRead.cs
示例11: ExecuteConcreteAction
protected override IList<OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors)
{
IList<OutputTO> outputs = new List<OutputTO>();
allErrors = new ErrorResultTO();
var colItr = new WarewolfListIterator();
//get all the possible paths for all the string variables
var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath));
colItr.AddVariableToIterateOn(inputItr);
var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username));
colItr.AddVariableToIterateOn(unameItr);
var passItr = new WarewolfIterator(dataObject.Environment.Eval(Password));
colItr.AddVariableToIterateOn(passItr);
outputs.Add(DataListFactory.CreateOutputTO(Result));
if(dataObject.IsDebugMode())
{
AddDebugInputItem(InputPath, "Input Path", dataObject.Environment);
AddDebugInputItemUserNamePassword(dataObject.Environment);
}
while(colItr.HasMoreData())
{
IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
try
{
IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
colItr.FetchNextValue(unameItr),
colItr.FetchNextValue(passItr),
true);
IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
string result = broker.Delete(dstEndPoint);
outputs[0].OutputStrings.Add(result);
}
catch(Exception e)
{
outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure"));
//outputs[0].OutputStrings.Add(null);
allErrors.AddError(e.Message);
break;
}
}
return outputs;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:56,代码来源:DsfPathDelete.cs
示例12: WriteDataList
public bool WriteDataList(Guid datalistID, IBinaryDataList datalist, ErrorResultTO errors) {
bool result = false;
if (datalistID != GlobalConstants.NullDataListID)
{
Repo[datalistID] = datalist;
result = true;
}
return result;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:11,代码来源:DataListTemporalProvider.cs
示例13: ExecutionImpl
protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
{
_errorsTo = new ErrorResultTO();
var pluginServiceExecution = GetNewPluginServiceExecution(dataObject);
pluginServiceExecution.InstanceInputDefinitions = inputs;
pluginServiceExecution.InstanceOutputDefintions = outputs;
tmpErrors = new ErrorResultTO();
tmpErrors.MergeErrors(_errorsTo);
var result = ExecutePluginService(pluginServiceExecution, update);
tmpErrors.MergeErrors(_errorsTo);
return result;
}
开发者ID:Robin--,项目名称:Warewolf,代码行数:12,代码来源:DsfPluginActivity.cs
示例14: ConvertFrom
public DataListTranslatedPayloadTO ConvertFrom(IBinaryDataList payload, out ErrorResultTO errors)
{
if(payload == null)
{
throw new ArgumentNullException("payload");
}
StringBuilder result = new StringBuilder("<" + RootTag + ">");
errors = new ErrorResultTO();
var entries = payload.FetchAllEntries();
foreach(var entry in entries)
{
if(entry.IsRecordset)
{
AddEntryToBuilder(result, entry);
result.Append(">");
foreach(var col in entry.Columns)
{
result.Append("<");
result.Append(col.ColumnName);
result.Append(" " + Description + "=\"");
result.Append(col.ColumnDescription);
result.Append("\" ");
result.Append(IsEditable + "=\"");
result.Append(col.IsEditable);
result.Append("\" ");
// Travis.Frisinger - Added Column direction
result.Append(GlobalConstants.DataListIoColDirection + "=\"");
result.Append(col.ColumnIODirection);
result.Append("\" ");
result.Append("/>");
}
result.Append("</");
result.Append(entry.Namespace);
result.Append(">");
}
else
{
AddEntryToBuilder(result, entry);
result.Append("/>");
}
}
result.Append("</" + RootTag + ">");
DataListTranslatedPayloadTO tmp = new DataListTranslatedPayloadTO(result.ToString());
return tmp;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:52,代码来源:StudioDataListXMLTranslator.cs
示例15: DoRecordSetAppending
internal static void DoRecordSetAppending(ErrorResultTO errors, IBinaryDataListEntry entry, StringBuilder result)
{
var cnt = entry.FetchLastRecordsetIndex();
var cols = entry.Columns;
if(!cols.Any(c => c.ColumnIODirection == enDev2ColumnArgumentDirection.Both || c.ColumnIODirection == enDev2ColumnArgumentDirection.Input))
{
return;
}
for(var i = 1; i <= cnt; i++)
{
string error;
var rowData = entry.FetchRecordAt(i, out error);
errors.AddError(error);
result.Append("<");
result.Append(entry.Namespace);
result.Append(">");
foreach(var col in rowData)
{
var fName = col.FieldName;
if(cols.Any(c => c.ColumnName == fName &&
(c.ColumnIODirection == enDev2ColumnArgumentDirection.Both || c.ColumnIODirection == enDev2ColumnArgumentDirection.Input)))
{
result.Append("<");
result.Append(fName);
result.Append(">");
try
{
result.Append(col.TheValue);
}
// ReSharper disable EmptyGeneralCatchClause
catch (Exception)
{
}
result.Append("</");
result.Append(fName);
result.Append(">");
}
}
result.Append("</");
result.Append(entry.Namespace);
result.Append(">");
}
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:49,代码来源:StudioTranslator.cs
示例16: DsfPluginActivity_DsfPluginActivityUnitTest_ExecutePluginService_ServiceExecuted
// ReSharper disable InconsistentNaming
public void DsfPluginActivity_DsfPluginActivityUnitTest_ExecutePluginService_ServiceExecuted()
// ReSharper restore InconsistentNaming
{
//init
var pluginActivity = new MockDsfPluginActivity();
var errors = new ErrorResultTO();
var mockContainer = new Mock<PluginServiceExecution>(new DsfDataObject(It.IsAny<string>(), It.IsAny<Guid>()), It.IsAny<bool>());
mockContainer.Setup(c => c.Execute(out errors, 0)).Verifiable();
//exe
pluginActivity.MockExecutePluginService(mockContainer.Object);
//assert
Assert.IsFalse(errors.HasErrors(), "Errors where thrown while executing a plugin service");
mockContainer.Verify(c => c.Execute(out errors, 0), Times.Once());
}
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:17,代码来源:DsfPluginActivityTests.cs
示例17: Execute
public override Guid Execute(out ErrorResultTO errors)
{
errors = new ErrorResultTO();
_databaseServiceExecution.BeforeExecution(errors);
var databaseServiceExecution = _databaseServiceExecution as DatabaseServiceExecution;
if(databaseServiceExecution != null)
{
databaseServiceExecution.InstanceInputDefinitions = InstanceInputDefinition;
databaseServiceExecution.InstanceOutputDefintions = InstanceOutputDefinition;
}
var result = _databaseServiceExecution.Execute(out errors);
_databaseServiceExecution.AfterExecution(errors);
return result;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:16,代码来源:DatabaseServiceContainer.cs
示例18: Execute
/// <summary>
/// Executes the specified errors.
/// </summary>
/// <param name="errors">The errors.</param>
/// <param name="update"></param>
/// <returns></returns>
public override Guid Execute(out ErrorResultTO errors, int update)
{
errors = new ErrorResultTO();
// WorkflowApplicationFactory wfFactor = new WorkflowApplicationFactory();
Guid result = GlobalConstants.NullDataListID;
Dev2Logger.Log.Debug("Entered Wf Container");
// Set Service Name
DataObject.ServiceName = ServiceAction.ServiceName;
// Set server ID, only if not set yet - original server;
if(DataObject.ServerID == Guid.Empty)
DataObject.ServerID = HostSecurityProvider.Instance.ServerID;
// Set resource ID, only if not set yet - original resource;
if(DataObject.ResourceID == Guid.Empty && ServiceAction != null && ServiceAction.Service != null)
DataObject.ResourceID = ServiceAction.Service.ID;
// Travis : Now set Data List
DataObject.DataList = ServiceAction.DataListSpecification;
// Set original instance ID, only if not set yet - original resource;
if(DataObject.OriginalInstanceID == Guid.Empty)
DataObject.OriginalInstanceID = DataObject.DataListID;
Dev2Logger.Log.Info(String.Format("Started Execution for Service Name:{0} Resource Id:{1} Mode:{2}",DataObject.ServiceName,DataObject.ResourceID,DataObject.IsDebug?"Debug":"Execute"));
//Set execution origin
if(!string.IsNullOrWhiteSpace(DataObject.ParentServiceName))
{
DataObject.ExecutionOrigin = ExecutionOrigin.Workflow;
DataObject.ExecutionOriginDescription = DataObject.ParentServiceName;
}
else if(DataObject.IsDebug)
{
DataObject.ExecutionOrigin = ExecutionOrigin.Debug;
}
else
{
DataObject.ExecutionOrigin = ExecutionOrigin.External;
}
var userPrinciple = Thread.CurrentPrincipal;
ErrorResultTO to = errors;
Common.Utilities.PerformActionInsideImpersonatedContext(userPrinciple,()=>{result = ExecuteWf(to);});
Dev2Logger.Log.Info(String.Format("Completed Execution for Service Name:{0} Resource Id: {1} Mode:{2}",DataObject.ServiceName,DataObject.ResourceID,DataObject.IsDebug?"Debug":"Execute"));
return result;
}
开发者ID:Robin--,项目名称:Warewolf,代码行数:53,代码来源:WfExecutionContainer.cs
示例19: ConvertFrom
/// <summary>
/// Converts from a binary representation in the standard format to the specified <see cref="Format" />.
/// </summary>
/// <param name="input">The binary representation of the datalist.</param>
/// <param name="errors">The errors.</param>
/// <returns>
/// An array of bytes that represent the datalist in the specified <see cref="Format" />
/// </returns>
/// <exception cref="System.ArgumentNullException">input</exception>
public DataListTranslatedPayloadTO ConvertFrom(IBinaryDataList input, out ErrorResultTO errors)
{
errors = new ErrorResultTO();
if(input == null) throw new ArgumentNullException("input");
IList<string> itemKeys = input.FetchAllUserKeys();
errors = new ErrorResultTO();
StringBuilder result = new StringBuilder("{");
int keyCnt = 0;
foreach(string key in itemKeys)
{
IBinaryDataListEntry entry;
// This check was never here - this means this method has no testing and was never sane ;)
string error;
if(input.TryGetEntry(key, out entry, out error))
{
if(entry.IsRecordset)
{
result.Append(ProcessRecordSet(entry, out error));
errors.AddError(error);
}
else
{
result.Append(ProcessScalar(entry));
}
}
errors.AddError(error);
// wack in , for field separator ;)
keyCnt++;
if(keyCnt < itemKeys.Count)
{
result.Append(",");
}
}
result.Append("}");
DataListTranslatedPayloadTO tmp = new DataListTranslatedPayloadTO(result.ToString());
return tmp;
}
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:56,代码来源:DataListJSONTranslator.cs
示例20: Replace
/// <summary>
/// Replaces a value in and entry with a new value.
/// </summary>
/// <param name="stringToSearch">The old string.</param>
/// <param name="findString">The old string.</param>
/// <param name="replacementString">The new string.</param>
/// <param name="caseMatch">if set to <c>true</c> [case match].</param>
/// <param name="errors">The errors.</param>
/// <param name="replaceCount">The replace count.</param>
/// <returns></returns>
public string Replace(string stringToSearch, string findString, string replacementString, bool caseMatch, out ErrorResultTO errors, ref int replaceCount)
{
var oldString = stringToSearch;
ErrorResultTO allErrors = new ErrorResultTO();
errors = new ErrorResultTO();
allErrors.MergeErrors(errors);
var regexOptions = caseMatch ? NoneCompiled : IgnoreCaseCompiled;
Regex regex = new Regex(Regex.Escape(findString), regexOptions);
string tmpVal = oldString;
replaceCount += regex.Matches(tmpVal).Count;
var replaceValue = regex.Replace(tmpVal, replacementString);
errors = allErrors;
return replaceValue;
}
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:27,代码来源:Dev2ReplaceOperation.cs
注:本文中的Dev2.DataList.Contract.ErrorResultTO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论