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


C# FilePath.GetFilename方法代码示例

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


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

示例1: Parse

        public static BlogFilename Parse(FilePath path)
        {
            var match = FilenameRegex.Match(path.GetFilename().FullPath);
            if (!match.Success)
            {
                return null;
            }

            var year = match.Groups["year"].Value;
            var month = match.Groups["month"].Value;
            var day = match.Groups["day"].Value;

            return new BlogFilename
            {
                Slug = match.Groups["slug"].Value.ToSlug(),
                PostedAt = DateTime.ParseExact(year + month + day, "yyyyMMdd", CultureInfo.InvariantCulture)
            };
        }
开发者ID:CharliePoole,项目名称:website,代码行数:18,代码来源:BlogFilename.cs

示例2: File

 public ReleaseBuilder File(FilePath file)
 {
     FileSettings.FilePath = file;
     if (string.IsNullOrWhiteSpace(FileSettings.FileName))
         FileSettings.FileName = file.GetFilename().FullPath;
     return this;
 }
开发者ID:RichiCoder1,项目名称:Cake.GitHub,代码行数:7,代码来源:ReleaseBuilder.cs

示例3: Upload

            /// <summary>
            /// Uploads the specified file. For large uploads, the file will be divided and uploaded in parts 
            /// using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.
            /// </summary>
            /// <param name="filePath">The file path of the file to upload.</param>
            /// <param name="key">The key under which the Amazon S3 object is stored.</param>
            /// <param name="settings">The <see cref="UploadSettings"/> required to upload to Amazon S3.</param>
            public void Upload(FilePath filePath, string key, UploadSettings settings)
            {
                TransferUtility utility = this.GetUtility(settings);
                TransferUtilityUploadRequest request = this.CreateUploadRequest(settings);

                this.SetWorkingDirectory(settings);
                string fullPath = filePath.MakeAbsolute(settings.WorkingDirectory).FullPath;

                request.FilePath = fullPath;
                request.Key = key;



                //Set ContentType
                if (settings.GenerateContentType && String.IsNullOrEmpty(request.Headers.ContentType))
                {
                    request.Headers.ContentType = new Mime().Lookup(filePath.GetFilename().FullPath);
                }



                //Set Hash Tag
                string hash = "";

                if (!String.IsNullOrEmpty(request.Headers["ETag"]))
                {
                    hash = request.Headers["ETag"];
                }
                else if (settings.GenerateETag || settings.GenerateHashTag)
                {
                    hash = this.GetHash(_FileSystem.GetFile(fullPath));
                    request.Headers["ETag"] = hash;
                }

                if (settings.GenerateHashTag)
                {
                    request.Metadata.Add("HashTag", hash);
                }

                request.UploadProgressEvent += new EventHandler<UploadProgressArgs>(UploadProgressEvent);

                _Log.Verbose("Uploading file {0} to bucket {1}...", key, settings.BucketName);
                utility.Upload(request);
            }
开发者ID:SharpeRAD,项目名称:Cake.AWS.S3,代码行数:51,代码来源:S3Manager.cs


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