This is a simple file sizing library.
Goto https://www.nuget.org/packages/SquirrelSizer/
To use it is simple.
long number = 1234500;
Sizer.Suffix(number);
// This will output 1kb
or
long number = 1234500;
Sizer.SuffixName(number);
// This will output 1 Kilobyte
long number = 1234500;
Sizer.Suffix(number, includeNumber: false)
// This will output kb
long number = 1234500;
Sizer.SuffixName(number, 4)
// This will output 1.1773 Kilobyte
long number = 1234500;
Sizer.SuffixName(number, 4, false)
// This will output Kilobyte
Sizer.Suffix("C:\\Path\\To\\File\\file.txt");
// This will output the converted size of the file.
or
Sizer.SuffixName("C:\\Path\\To\\File\\file.txt");
// This will output the converted size of the file.
List<string> files = new List<string>() {
"C:\\Path\\To\\File\\file1.txt",
"C:\\Path\\To\\File\\file2.txt",
"C:\\Path\\To\\File\\file3.txt"
};
Sizer.AllSuffix(files);
// This will output the size of all the files in the list
or
List<string> files = new List<string>() {
"C:\\Path\\To\\File\\file1.txt",
"C:\\Path\\To\\File\\file2.txt",
"C:\\Path\\To\\File\\file3.txt"
};
Sizer.AllSuffixName(files);
// This will output the size of all the files in the list