mirror of
https://github.com/nsnail/dot.git
synced 2025-06-19 13:58:16 +08:00
<fix>
This commit is contained in:
@ -85,14 +85,14 @@ internal partial class Main : ToolBase<Option>
|
||||
}
|
||||
}
|
||||
|
||||
private void WritePart(HttpResponseMessage rsp, string mainFilePath //
|
||||
, long startPos, long endPos //
|
||||
private void WritePart(HttpResponseMessage rsp, string mainFilePath //
|
||||
, int no, long startPos, long endPos //
|
||||
, Action<int> rateHandle)
|
||||
{
|
||||
Span<byte> buf = stackalloc byte[Opt.BufferSize];
|
||||
using var stream = rsp.Content.ReadAsStream();
|
||||
int read;
|
||||
var file = $"{mainFilePath}.{startPos}-{endPos}.{_PART}";
|
||||
var file = $"{mainFilePath}.{no}.{startPos}-{endPos}.{_PART}";
|
||||
using var fs = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
while ((read = stream.Read(buf)) != 0) {
|
||||
fs.Write(read == Opt.BufferSize ? buf : buf[..read]);
|
||||
@ -169,7 +169,7 @@ internal partial class Main : ToolBase<Option>
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
using var getRsp
|
||||
= http.Send(getReq, HttpCompletionOption.ResponseHeadersRead);
|
||||
WritePart(getRsp, mainFilePath, startPos, endPos, x => {
|
||||
WritePart(getRsp, mainFilePath, i, startPos, endPos, x => {
|
||||
tChild.Increment(x);
|
||||
tParent.Increment(x);
|
||||
});
|
||||
|
@ -12,7 +12,9 @@
|
||||
<DefineConstants>$(DefineConstants);NET7_0_WINDOWS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Spectre.Console" Version="0.45.1-preview.0.46"/>
|
||||
<PackageReference Include="NSExt" Version="1.0.9-alpha.0.1"/>
|
||||
<PackageReference Include="Spectre.Console.Cli.NS" Version="0.45.1-preview.0.48"/>
|
||||
<PackageReference Include="Spectre.Console.NS" Version="0.45.1-preview.0.48"/>
|
||||
<PackageReference Condition="'$(TargetFramework)' == 'net7.0-windows'" Include="TextCopy" Version="6.2.0"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -21,10 +23,6 @@
|
||||
<LastGenOutput>Str.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\ForkedGitReps\ns-ext\src\NSExt.csproj"/>
|
||||
<ProjectReference Include="..\..\..\..\..\ForkedGitReps\spectre.console\src\Spectre.Console.Cli\Spectre.Console.Cli.csproj"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Spectre.Console">
|
||||
<HintPath>..\..\..\..\..\ForkedGitReps\spectre.console\src\Spectre.Console\bin\Debug\net6.0\Spectre.Console.dll</HintPath>
|
||||
|
Reference in New Issue
Block a user