コード例 #1
0
        public static async Task <DateTime> GetLastWriteTimeUtcAsync(ContentURI uri,
                                                                     string fileURIPath)
        {
            DateTime date = GeneralHelpers.GetDateShortNow();

            if (await URIAbsoluteExists(uri, fileURIPath) == true)
            {
                if (Path.IsPathRooted(fileURIPath))
                {
                    date = File.GetLastWriteTimeUtc(fileURIPath);
                }
                else
                {
                    PLATFORM_TYPES ePlatform
                        = uri.URIDataManager.PlatformType;
                    if (ePlatform == PLATFORM_TYPES.azure)
                    {
                        AzureIOAsync   azureIO = new AzureIOAsync(uri);
                        CloudBlockBlob blob    = await azureIO.GetBlobAsync(fileURIPath);

                        if (blob != null)
                        {
                            //have to fetch the attributes prior to reading them
                            await blob.FetchAttributesAsync();

                            DateTimeOffset blobdate = blob.Properties.LastModified.Value;
                            //165 fix
                            date = blobdate.UtcDateTime;
                        }
                    }
                }
            }
            return(date);
        }