/// <summary> /// Gets the file size in bytes. /// </summary> /// <param name="file">The file.</param> /// <returns></returns> public static async Task <ulong> GetSize(this IStorageItem file) { var props = await file.GetBasicPropertiesAsync(); ulong sizeInB = props.Size; return(sizeInB); }
public BasicProperties getBasicProperties() { if (basicProperties == null) { basicProperties = storageItem.GetBasicPropertiesAsync().DoSynchronously(); } return(basicProperties); }
public async Task GetEntrySizeAsyncIfNeed() { if (_size == 0) { var properties = await _storageItem.GetBasicPropertiesAsync(); _size = properties.Size; } }
/// <summary> /// Returns the free space of the storage associate with the given storage item. /// </summary> /// <param name="sf">Storage item</param> /// <returns>Free space.</returns> public static async Task <UInt64> GetFreeSpace(this IStorageItem sf) { var properties = await sf.GetBasicPropertiesAsync(); var filteredProperties = await properties.RetrievePropertiesAsync(new[] { "System.FreeSpace" }); var freeSpace = filteredProperties["System.FreeSpace"]; return((UInt64)freeSpace); }
private static async Task <DateTimeOffset> GetLastAccessTimeAsync(IStorageItem item) { BasicProperties properties = await item.GetBasicPropertiesAsync().TranslateWinRTTask(item.Path); var propertyMap = await properties.RetrievePropertiesAsync(s_dateAccessedKey).TranslateWinRTTask(item.Path); // shell doesn't expose this metadata on all item types if (propertyMap.ContainsKey(s_dateAccessedKey[0])) { return((DateTimeOffset)propertyMap[s_dateAccessedKey[0]]); } // fallback to modified date return(properties.DateModified); }
/// <summary> /// Restituisce la dimensione di File o di una Cartella /// </summary> public static async Task<string> GetItemSize(IStorageItem item) { if(item.IsOfType(StorageItemTypes.File)) { BasicProperties bp = await item.GetBasicPropertiesAsync(); ulong peso = bp.Size; return SizeConvert(peso); } else if(item.IsOfType(StorageItemTypes.Folder)) { StorageHelper total =new StorageHelper(); await total.FilesNumber((StorageFolder)item); return SizeConvert(total.GetFilesSize()); } else { return SizeConvert(0); } }
public async Task <bool> Reload1(StorageFolder folder, string relativePath, RPAssetsManager RPAssetsManager, ProcessingList processingList) { this.relativePath = relativePath; this.folder = folder; Mark(GraphicsObjectStatus.loading); IStorageItem storageItem = await folder.TryGetItemAsync(relativePath); try { var attr = await storageItem.GetBasicPropertiesAsync(); lastModifiedTime = attr.DateModified; } catch { Mark(GraphicsObjectStatus.error); return(false); } return(await Reload(storageItem, RPAssetsManager, processingList)); }
private Task LoadMemoryData() { IStorageItem sf = ApplicationData.Current.LocalFolder; var properties = sf.GetBasicPropertiesAsync().Completed += (es, t) => { es.GetResults().RetrievePropertiesAsync(new[] { "System.FreeSpace" }).Completed += async(ex, tx) => { var freeSpace = ex.GetResults()["System.FreeSpace"]; await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { float freeSpaceGB = (float)Double.Parse((freeSpace.ToString())) / 1000000000; //FreeSpace.Text = Math.Round(freeSpaceGB, 2).ToString(); //sdProgbar.Maximum = 16.00; //sdProgbar.Value = 16.00 - freeSpaceGB; }); }; }; return(null); }
// NOTE: This constructor was commented out when the PInvoke method was abandoned //internal MonitoredFolderItem(MonitoredFolderItemType type, string name) //{ // Type = type; // Name = name; //} /// Actions public void DoPopulateProperties() { _ = PopulateProperties(); return; /// Local Functions async Task PopulateProperties() { var properties = await _item.GetBasicPropertiesAsync(); this.DateModified = properties.DateModified; this.Size = properties.Size; this.ItemDate = properties.ItemDate; IsPropertiesPopulated = true; } }
private static async Task SetAttributesAsync(IStorageItem item, FileAttributes attributes) { BasicProperties basicProperties = await item.GetBasicPropertiesAsync().TranslateWinRTTask(item.Path); // This works for only a subset of attributes, unsupported attributes are ignored. // We don't mask the attributes since WinRT just ignores the unsupported ones and flowing // them enables possible lightup in the future. var property = new KeyValuePair <string, object>("System.FileAttributes", (UInt32)ConvertFileAttributes(attributes)); try { await basicProperties.SavePropertiesAsync(new[] { property }).AsTask().ConfigureAwait(false); } catch (Exception exception) { if (exception.HResult != HResults.ERROR_INVALID_PARAMETER) { throw new ArgumentException(SR.Arg_InvalidFileAttrs); } throw exception.TranslateWinRTException(item.Path); } }
private static async Task <DateTimeOffset> GetLastWriteTimeAsync(IStorageItem item) { BasicProperties properties = await item.GetBasicPropertiesAsync().TranslateWinRTTask(item.Path); return(properties.DateModified); }
private async Task <ulong> GetLengthAsync() { BasicProperties properties = await _item.GetBasicPropertiesAsync().TranslateWinRTTask(_fullPath, _asDirectory); return(properties.Size); }
public static async Task <IDictionary <string, object> > GetSpace(this IStorageItem sf) { var properties = await sf.GetBasicPropertiesAsync(); return(await properties.RetrievePropertiesAsync(new[] { "System.FreeSpace", "System.Capacity" })); }
private async Task<BasicProperties> getPhotoBasicPropertiesAsync(IStorageItem file) { return await file.GetBasicPropertiesAsync(); }
private async Task <long> GetLastDateModified(IStorageItem item) { return((await item.GetBasicPropertiesAsync()).DateModified.ToUnixTimeSeconds()); }