Skip to content

Commit

Permalink
Add GetFileSize method
Browse files Browse the repository at this point in the history
Signed-off-by: virtual <1185513330@qq.com>
  • Loading branch information
cocosip committed Nov 2, 2021
1 parent 3cdcbc7 commit c9487a0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<VersionMajor>4</VersionMajor>
<VersionMinor>3</VersionMinor>
<VersionPatch>0</VersionPatch>
<VersionPatch>1</VersionPatch>
<VersionQuality></VersionQuality>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionSuffix></VersionSuffix>
Expand Down
2 changes: 1 addition & 1 deletion src/DotCommon.Caching/DotCommon.Caching.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nito.AsyncEx" Version="5.1.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
</ItemGroup>

Expand Down
18 changes: 15 additions & 3 deletions src/DotCommon/IO/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ public static class FileHelper
/// <summary>
/// 如果文件存在就删除文件
/// </summary>
public static void DeleteIfExists(string filePath)
/// <param name="fileName">文件名</param>
public static void DeleteIfExists(string fileName)
{
if (File.Exists(filePath))
if (File.Exists(fileName))
{
File.Delete(filePath);
File.Delete(fileName);
}
}

/// <summary>
/// 获取文件的大小
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static long GetFileSize(string fileName)
{
var fileInfo = new FileInfo(fileName);
return fileInfo.Length;
}
}
}
2 changes: 1 addition & 1 deletion test/DotCommon.Test/DotCommon.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
Expand Down

0 comments on commit c9487a0

Please sign in to comment.