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


C# FileInfo.GetCreationTimeUtc方法代码示例

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


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

示例1: GetFileCharacteristics

 /// <summary>
 /// Gets the information about a file.
 /// </summary>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="fileHandle">The file handle.</param>
 /// <returns>The file characteristics, if the file information was retrieved successfully, otherwise null.</returns>
 public override FileCharacteristics GetFileCharacteristics(string fileName, IntPtr fileHandle)
 {
     var fileInfo = new FileInfo(fileName);
     if (fileInfo.Exists)
     {
         return new FileCharacteristics(fileInfo.GetCreationTimeUtc(), fileInfo.GetLastWriteTimeUtc(), fileInfo.Length);
     }
     else
         return null;
 }
开发者ID:daniefer,项目名称:NLog,代码行数:16,代码来源:PortableFileCharacteristicsHelper.cs

示例2: GetFileCharacteristics

 /// <summary>
 /// Gets the information about a file.
 /// </summary>
 /// <param name="fileName">Name of the file.</param>
 /// <param name="fileStream">The file stream.</param>
 /// <returns>The file characteristics, if the file information was retrieved successfully, otherwise null.</returns>
 public override FileCharacteristics GetFileCharacteristics(string fileName, FileStream fileStream)
 {
     if (!string.IsNullOrEmpty(fileName))
     {
         var fileInfo = new FileInfo(fileName);
         if (fileInfo.Exists)
         {
             return new FileCharacteristics(fileInfo.GetCreationTimeUtc(), fileInfo.GetLastWriteTimeUtc(), fileInfo.Length);
         }
     }
     return null;
 }
开发者ID:NLog,项目名称:NLog,代码行数:18,代码来源:PortableFileCharacteristicsHelper.cs

示例3: GetFileCreationTimeUtc

        public DateTime? GetFileCreationTimeUtc(string filePath, bool fallback)
        {
            var appender = GetAppender(filePath);
            DateTime? result = null;
            if (appender != null)
            {
                try
                {
                    result = appender.GetFileCreationTimeUtc();
                }
                catch (Exception ex)
                {
                    InternalLogger.Error(ex, "Failed to get file creation time for file '{0}'.", appender.FileName);
                    InvalidateAppender(appender.FileName);
                    throw;
                }
            }                
            if (result == null && fallback)
            {
                var fileInfo = new FileInfo(filePath);
                if (fileInfo.Exists)
                {
                    return fileInfo.GetCreationTimeUtc();
                }
            }

            return result;
        }
开发者ID:NLog,项目名称:NLog,代码行数:28,代码来源:FileAppenderCache.cs

示例4: GetFileCreationTimeUtc

        public DateTime? GetFileCreationTimeUtc(string filePath, bool fallback)
        {
            var appender = GetAppender(filePath);
            DateTime? result = null;
            if (appender != null)
                result = appender.GetFileCreationTimeUtc();
            if (result == null && fallback)
            {
                var fileInfo = new FileInfo(filePath);
                if (fileInfo.Exists)
                {
                    return fileInfo.GetCreationTimeUtc();
                }
            }

            return result;
        }
开发者ID:ie-zero,项目名称:NLog,代码行数:17,代码来源:FileAppenderCache.cs

示例5: GetFileCreationTimeUtc

 /// <summary>
 /// Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal 
 /// Time [UTC] standard.
 /// </summary>
 /// <returns>The file creation time.</returns>
 public override DateTime? GetFileCreationTimeUtc()
 {
     FileInfo fileInfo = new FileInfo(FileName);
     if (fileInfo.Exists)
     {
         return fileInfo.GetCreationTimeUtc();
     }
     return null;
 }
开发者ID:NLog,项目名称:NLog,代码行数:14,代码来源:RetryingMultiProcessFileAppender.cs


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