本文整理汇总了C#中IExecutionContext.QueueAttachFile方法的典型用法代码示例。如果您正苦于以下问题:C# IExecutionContext.QueueAttachFile方法的具体用法?C# IExecutionContext.QueueAttachFile怎么用?C# IExecutionContext.QueueAttachFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExecutionContext
的用法示例。
在下文中一共展示了IExecutionContext.QueueAttachFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessBuildUploadLogCommand
private void ProcessBuildUploadLogCommand(IExecutionContext context, string data)
{
if (!string.IsNullOrEmpty(data) && File.Exists(data))
{
context.QueueAttachFile(CoreAttachmentType.Log, "CustomToolLog", data);
}
else
{
throw new Exception(StringUtil.Loc("CustomLogDoesNotExist", data ?? string.Empty));
}
}
示例2: ProcessBuildUploadSummaryCommand
// ##VSO[build.uploadsummary] command has been deprecated
// Leave the implementation on agent for back compat
private void ProcessBuildUploadSummaryCommand(IExecutionContext context, string data)
{
if (!string.IsNullOrEmpty(data) && File.Exists(data))
{
var fileName = Path.GetFileName(data);
context.QueueAttachFile(CoreAttachmentType.Summary, StringUtil.Format($"CustomMarkDownSummary-{fileName}"), data);
}
else
{
throw new Exception(StringUtil.Loc("CustomMarkDownSummaryDoesNotExist", data ?? string.Empty));
}
}
示例3: ProcessTaskAddAttachmentCommand
private void ProcessTaskAddAttachmentCommand(IExecutionContext context, Dictionary<string, string> eventProperties, string data)
{
String type;
if (!eventProperties.TryGetValue(TaskAddAttachmentEventProperties.Type, out type) || String.IsNullOrEmpty(type))
{
throw new Exception(StringUtil.Loc("MissingAttachmentType"));
}
String name;
if (!eventProperties.TryGetValue(TaskAddAttachmentEventProperties.Name, out name) || String.IsNullOrEmpty(name))
{
throw new Exception(StringUtil.Loc("MissingAttachmentName"));
}
char[] s_invalidFileChars = Path.GetInvalidFileNameChars();
if (type.IndexOfAny(s_invalidFileChars) != -1)
{
throw new Exception($"Type contain invalid characters. ({String.Join(",", s_invalidFileChars)})");
}
if (name.IndexOfAny(s_invalidFileChars) != -1)
{
throw new Exception($"Name contain invalid characters. ({String.Join(", ", s_invalidFileChars)})");
}
string filePath = data;
if (!String.IsNullOrEmpty(filePath) && File.Exists(filePath))
{
// Upload attachment
context.QueueAttachFile(type, name, filePath);
}
else
{
throw new Exception(StringUtil.Loc("MissingAttachmentFile"));
}
}