-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finishing 'cleanup Wellbia's XignCode' feature.
- Properly show console log - Optimize memory allocation for downloading the "xuninstaller".
- Loading branch information
Showing
27 changed files
with
194 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Leayal.PSO2Launcher.Toolbox; | ||
using System.Buffers; | ||
using System.IO; | ||
using System.Threading; | ||
|
||
namespace Leayal.PSO2Launcher.Core.Classes | ||
{ | ||
sealed class MemoryStreamPooledBackBuffer : MemoryStream | ||
{ | ||
private readonly bool isfromArrayPool; | ||
private byte[]? buffer; | ||
|
||
public MemoryStreamPooledBackBuffer(byte[] buffer, int index, int count, bool isfromArrayPool) : base(buffer, index, count, false, true) | ||
{ | ||
this.isfromArrayPool = isfromArrayPool; | ||
this.Position = 0; | ||
this.buffer = buffer; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (isfromArrayPool) | ||
{ | ||
var borrowed = Interlocked.Exchange(ref this.buffer, null); | ||
if (borrowed != null) | ||
{ | ||
ArrayPool<byte>.Shared.Return(borrowed); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.