Exemplo n.º 1
0
 /// <summary>
 /// Set possibly file extension properties from a FileInfo object:
 /// - size
 /// - checksum
 /// </summary>
 /// <returns></returns>
 public static async Task SetFileExtensionProperties(this FileStacExtension fileStacExtension,
                                                     Stream stream,
                                                     HashType hashType          = HashType.SHA1,
                                                     MultibaseEncoding encoding = MultibaseEncoding.Base16Lower)
 {
     await fileStacExtension.SetFileCheckSum(hashType, encoding, uri => stream);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Set possibly file extension properties from a FileInfo object:
 /// - size
 /// - checksum
 /// </summary>
 /// <returns></returns>
 public static async Task SetFileExtensionProperties(this FileStacExtension fileStacExtension,
                                                     FileInfo file,
                                                     HashType hashType          = HashType.SHA1,
                                                     MultibaseEncoding encoding = MultibaseEncoding.Base16Lower)
 {
     fileStacExtension.Size = Convert.ToUInt64(file.Length);
     await fileStacExtension.SetFileCheckSum(hashType, encoding, uri => file.OpenRead());
 }