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


C# ITaskItem.RequireTitle方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:automatonic,项目名称:exult,代码行数:31,代码来源:PathMapping.cs

示例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);
        }
开发者ID:automatonic,项目名称:exult,代码行数:31,代码来源:Download.cs


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