Пример #1
0
 /// <summary>
 /// Creates the row given the directory name.
 /// </summary>
 /// <param name="bucket">The bucket that owns the directory.</param>
 /// <param name="name">The name (path) to the directory.</param>
 /// <returns>The newly created <seealso cref="GcsRow"/>.</returns>
 public static GcsRow CreateDirectoryRow(string bucket, string name) =>
 new GcsRow
 {
     Bucket        = bucket,
     BlobName      = name,
     LeafName      = GcsPathUtils.GetFileName(name),
     FormattedSize = NoValuePlaceholder,
     LastModified  = NoValuePlaceholder,
     ContentType   = NoValuePlaceholder,
     IsDirectory   = true,
 };
Пример #2
0
 /// <summary>
 /// Creates a file row from the given GCS <seealso cref="Object"/>.
 /// </summary>
 /// <param name="obj">The GCS <seealso cref="Object"/></param>
 /// <returns>The newly created <seealso cref="GcsRow"/>.</returns>
 public static GcsRow CreateFileRow(Object obj) =>
 new GcsRow
 {
     Bucket        = obj.Bucket,
     BlobName      = obj.Name,
     IsFile        = true,
     Size          = obj.Size.HasValue ? obj.Size.Value : 0L,
     FormattedSize = obj.Size.HasValue ? FormatSize(obj.Size.Value) : NoValuePlaceholder,
     LastModified  = obj.Updated?.ToString() ?? NoValuePlaceholder,
     LeafName      = GcsPathUtils.GetFileName(obj.Name),
     ContentType   = obj.ContentType ?? DefaultContentType,
 };