Skip to content

Commit 1e21144

Browse files
authored
refactor: use primitif bool type instead of Object
1 parent 930d3ef commit 1e21144

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/FileSizeFromBase64.NET/FileSizeHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public static class FileSizeHelpers
1414
/// <param name="applyPaddingsRules">Indicate if the padding management is required or not. Default is false</param>
1515
/// <param name="unitsOfMeasurement">The unit of measure of the file size returned by the method. The default unit of measure is Byte.</param>
1616
/// <returns>The size of the file represented by the base64 string.</returns>
17-
public static double GetFileSizeFromBase64String(string base64String, Boolean applyPaddingsRules = false, UnitsOfMeasurement unitsOfMeasurement = UnitsOfMeasurement.Byte)
17+
public static double GetFileSizeFromBase64String(string base64String, bool applyPaddingsRules = false, UnitsOfMeasurement unitsOfMeasurement = UnitsOfMeasurement.Byte)
1818
{
1919
if (string.IsNullOrEmpty(base64String)) return 0;
2020

21-
// Remove MIME-type from the base64 if exists
21+
// Remove MIME-type from the base64 string if exists and get the string length
2222
var base64Length = base64String.Contains("base64,") ? base64String.Split(',')[1].Length : base64String.Length;
2323

24-
var fileSizeInByte = Math.Ceiling((double)base64Length /4) * 3;
24+
var fileSizeInByte = Math.Ceiling((double)base64Length / 4) * 3;
2525

2626
if(applyPaddingsRules && base64Length >= 2)
2727
{
@@ -49,6 +49,6 @@ public enum UnitsOfMeasurement
4949
/// <summary>
5050
/// MB.
5151
/// </summary>
52-
MegaByte = 1_048_576,
52+
MegaByte = 1_048_576
5353
}
5454
}

0 commit comments

Comments
 (0)