本文整理汇总了C#中ITaskItem.RequireTitle方法的典型用法代码示例。如果您正苦于以下问题:C# ITaskItem.RequireTitle方法的具体用法?C# ITaskItem.RequireTitle怎么用?C# ITaskItem.RequireTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITaskItem
的用法示例。
在下文中一共展示了ITaskItem.RequireTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PathMapping
public PathMapping(PathMapping parentMapping, ITaskItem model)
{
if (parentMapping != null)
{
if (parentMapping.DocumentType != Document.DocumentType.Folder)
{
throw new ArgumentException("Path should have 'Folder' Document Type", "folderPath");
}
ParentMapping = parentMapping;
}
ResourceType = GetResourceType(model.RequireResourceId());
Title = model.RequireTitle();
switch (ResourceType)
{
case ResourceType.file:
MappedFilename = SanitizeTitle(Path.GetFileNameWithoutExtension(Title));
MappedExtension = String.Concat(".", ResourceType.ToString(), "_", SanitizeTitle(Path.GetExtension(Title).TrimStart('.')));
break;
case ResourceType.folder:
MappedFilename = SanitizeTitle(Title);
MappedExtension = null;
break;
default:
MappedFilename = SanitizeTitle(Title);
MappedExtension = string.Concat(".",ResourceType.ToString());
break;
}
}
示例2: DoDownload
private void DoDownload(Request documentsRequest, ITaskItem document, ITaskItem download)
{
string sourceFile = document.ItemSpec;
string targetFile = download.ItemSpec;
string targetDirectory = Path.GetDirectoryName(targetFile);
Log.LogMessage(MessageImportance.High,"Downloading \"{0}\"", document.RequireTitle());
Log.LogMessage(MessageImportance.Normal, "To \"{0}\"", targetDirectory);
download.RequireParentDirectory(Log);
if (!File.Exists(sourceFile))
{
throw new FileNotFoundException("Cannot find", sourceFile);
}
ResourceType resourceType = document.RequireResourceType();
switch (resourceType)
{
case ResourceType.file:
DoFileDownload(documentsRequest, document, targetFile);
break;
case ResourceType.document:
DoDocumentDownload(documentsRequest, document, targetFile);
break;
default:
throw new NotImplementedException(string.Format("Resource Type '{0}' is unsupported", resourceType));
}
DateTime updated = document.GetTimestamp();
File.SetLastWriteTime(download.ItemSpec, updated);
document.CopyMetadataTo(download);
}