Skip to content

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
laolarou726 committed Jan 24, 2025
1 parent b0f6494 commit c8399fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ProjBobcat/ProjBobcat/Class/Helper/DownloadHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static async Task<double> ReceiveFromRemoteStreamAsync(
await destStream.FlushAsync(ct);

var duration = Stopwatch.GetElapsedTime(startTime);
var elapsedTime = duration.TotalSeconds == 0 ? 1 : duration.TotalSeconds;
var elapsedTime = duration.TotalSeconds < 0.0001 ? 1 : duration.TotalSeconds;

return elapsedTime;
}
Expand Down
13 changes: 12 additions & 1 deletion ProjBobcat/ProjBobcat/Class/Model/Downloading/DownloadRange.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace ProjBobcat.Class.Model.Downloading;

/// <summary>
/// 下载范围类
/// </summary>
[DebuggerDisplay("[{Start}-{End}]")]
public readonly struct DownloadRange : IComparable<DownloadRange>
public readonly struct DownloadRange : IComparable<DownloadRange>, IEquatable<DownloadRange>
{
/// <summary>
/// 开始字节
Expand Down Expand Up @@ -39,4 +40,14 @@ public int CompareTo(DownloadRange other)

return string.Compare(this.TempFileName, other.TempFileName, StringComparison.Ordinal);
}

public override bool Equals([NotNullWhen(true)] object? obj)
{
return obj is DownloadRange other && this.Equals(other);
}

public bool Equals(DownloadRange other)
{
return this.Start == other.Start && this.End == other.End && this.TempFileName == other.TempFileName;
}
}

0 comments on commit c8399fc

Please sign in to comment.