Skip to content

new type: Patterns.IO.FileSize #71

@jbatte47

Description

@jbatte47

AC: the following code has been added to Patterns along with features supplying coverage of each helper method

/// <summary>
///     Provides quick access to Windows-compliant file size measurements.
/// </summary>
public static class FileSize
{
   private const long _kb = 1024;
   private const long _mb = _kb*_kb;
   private const long _gb = _mb*_kb;
   private const long _tb = _gb*_kb;
   private const long _pb = _tb*_kb;

   /// <summary>
   ///  Gets the specified number of kilobytes.
   /// </summary>
   /// <param name = "kilobytes">The kilobytes.</param>
   /// <returns></returns>
   public static long FromKilobytes(int kilobytes)
   {
      return _kb*kilobytes;
   }

   /// <summary>
   ///  Gets the specified number of megabytes.
   /// </summary>
   /// <param name = "megabytes">The megabytes.</param>
   /// <returns></returns>
   public static long FromMegabytes(int megabytes)
   {
      return _mb*megabytes;
   }

   /// <summary>
   ///  Gets the specified number of gigabytes.
   /// </summary>
   /// <param name = "gigabytes">The gigabytes.</param>
   /// <returns></returns>
   public static long FromGigabytes(int gigabytes)
   {
      return _gb*gigabytes;
   }

   /// <summary>
   ///  Gets the specified number of terabytes.
   /// </summary>
   /// <param name = "terabytes">The terabytes.</param>
   /// <returns></returns>
   public static long FromTerabytes(int terabytes)
   {
      return _tb*terabytes;
   }

   /// <summary>
   ///  Gets the specified number of petabytes.
   /// </summary>
   /// <param name = "petabytes">The petabytes.</param>
   /// <returns></returns>
   public static long FromPetabytes(int petabytes)
   {
      return _pb*petabytes;
   }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions