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


C# IStorageFile.GetBasicPropertiesAsync方法代码示例

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


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

示例1: DoCreateEntryFromFile

        private static async Task<ZipArchiveEntry> DoCreateEntryFromFile(ZipArchive destination, IStorageFile sourceFile, string entryName, CompressionLevel? compressionLevel)
        {
            if (destination == null)
                throw new ArgumentNullException("destination");
            if (sourceFile == null)
                throw new ArgumentNullException("sourceFile");
            if (entryName == null)
                throw new ArgumentNullException("entryName");
            using (Stream stream = (await sourceFile.OpenReadAsync()).AsStream())
            {
                ZipArchiveEntry zipArchiveEntry = compressionLevel.HasValue ? destination.CreateEntry(entryName, compressionLevel.Value) : destination.CreateEntry(entryName);

                var props = await sourceFile.GetBasicPropertiesAsync();

                DateTime dateTime = props.DateModified.UtcDateTime;
                if (dateTime.Year < 1980 || dateTime.Year > 2107)
                    dateTime = new DateTime(1980, 1, 1, 0, 0, 0);
                zipArchiveEntry.LastWriteTime = (DateTimeOffset)dateTime;
                using (Stream destination1 = zipArchiveEntry.Open())
                {
                    await stream.CopyToAsync(destination1);
                }
                return zipArchiveEntry;
            }
        }
开发者ID:mqmanpsy,项目名称:MetroLog,代码行数:25,代码来源:ZipFile.cs

示例2: UpdateBoundSize

 private async void UpdateBoundSize(IStorageFile _backingFile)
 {
     var props = await _backingFile.GetBasicPropertiesAsync();
     FileSize = GetHumanReadableSize(props.Size);
 }
开发者ID:pingzing,项目名称:Codeco,代码行数:5,代码来源:BindableStorageFile.cs

示例3: CreateAttachmentObject

 private static async Task<EmailMessage> CreateAttachmentObject(IStorageFile attachmentTempFile, Unity.Core.AttachmentData attachment, EmailMessage mail)
 {
     await (FileIO.WriteBytesAsync(attachmentTempFile, attachment.Data).AsTask());
     var properties = await attachmentTempFile.GetBasicPropertiesAsync();
     if (properties.Size < (ulong)(attachment.DataSize))
     {
         mail.Attachments.Add(new EmailAttachment(attachment.FileName, RandomAccessStreamReference.CreateFromFile(attachmentTempFile)));
     }
     return mail;
 }
开发者ID:Appverse,项目名称:appverse-mobile,代码行数:10,代码来源:WindowsPhoneMessaging.cs

示例4: GetSizeAsync

 /// <summary>
 /// Gets a file's size.
 /// </summary>
 private async Task<long> GetSizeAsync(IStorageFile file)
 {
     BasicProperties fileProperties = await file.GetBasicPropertiesAsync().AsTask().ConfigureAwait(false);
     return (long)fileProperties.Size;
 }
开发者ID:iusafaro,项目名称:ApplicationInsights-dotnet,代码行数:8,代码来源:Storage.cs


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