-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bac22e
commit 8463009
Showing
44 changed files
with
2,252 additions
and
1,073 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,37 @@ | ||
name: NuGet Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore ./src | ||
|
||
- name: Build | ||
run: dotnet build ./src --no-restore --configuration Release | ||
|
||
- name: Pack NuGet Package(s) | ||
run: dotnet pack ./src --no-restore --no-build --configuration Release --output ./nuget-packages | ||
|
||
- name: Upload Build Artifact(s) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: nuget-packages | ||
path: ./nuget-packages | ||
|
||
- name: Push NuGet Package(s) | ||
run: dotnet nuget push ./nuget-packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate | ||
env: | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |
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
20 changes: 20 additions & 0 deletions
20
src/EpicManifestParser.Playground/EpicManifestParser.Playground.csproj
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,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
<Platforms>AnyCPU;x64</Platforms> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\EpicManifestParser\EpicManifestParser.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,120 @@ | ||
| ||
using System.Diagnostics; | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
using EpicManifestParser; | ||
using EpicManifestParser.Api; | ||
using EpicManifestParser.UE; | ||
|
||
using ZlibngDotNet; | ||
|
||
//BenchmarkDotNet.Running.BenchmarkRunner.Run<Benchmarks>(); | ||
//return; | ||
|
||
var client = new HttpClient(new HttpClientHandler | ||
{ | ||
UseProxy = false, | ||
UseCookies = false | ||
}); | ||
|
||
using var manifestResponse = await client.GetAsync("https://media.wtf/XlQk.json"); | ||
var manifestInfo1 = await manifestResponse.Content.ReadManifestInfoAsync(); | ||
var manifestInfo2 = await ManifestInfo.DeserializeFileAsync(Benchmarks.ManifestInfoPath); | ||
|
||
var randomGuid = FGuid.Random(); | ||
var chunkGuid = new FGuid("A76EAD354E9F6F06D0E75CAC2AB1B56C"); | ||
|
||
var zlibng = new Zlibng(Benchmarks.ZlibngPath); | ||
var manifestBuffer = await File.ReadAllBytesAsync(Benchmarks.ManifestPath); | ||
|
||
var sw = Stopwatch.StartNew(); | ||
var manifest = FBuildPatchAppManifest.Deserialize(manifestBuffer, options => | ||
{ | ||
options.Zlibng = zlibng; | ||
options.Client = client; | ||
options.ChunkBaseUrl = "http://epicgames-download1.akamaized.net/Builds/Fortnite/CloudDir/"; | ||
options.ChunkCacheDirectory = Path.Combine(Benchmarks.DownloadsDir, "chunks_v2"); | ||
}); | ||
sw.Stop(); | ||
Console.WriteLine(Math.Round(sw.Elapsed.TotalMilliseconds, 0)); | ||
|
||
var testChunk = manifest.ChunkDataList[69]; | ||
var testBuffer = new byte[testChunk.WindowSize]; | ||
await testChunk.ReadDataAsync(testBuffer, manifest); | ||
sw.Restart(); | ||
await testChunk.ReadDataAsync(testBuffer, manifest); | ||
sw.Stop(); | ||
Console.WriteLine(Math.Round(sw.Elapsed.TotalMilliseconds, 0)); | ||
|
||
{ | ||
var fileManifest = manifest.FileManifestList.First(x => | ||
x.Filename.EndsWith("/pakchunk0optional-WindowsClient.ucas", StringComparison.Ordinal)); | ||
var fileManifestStream = fileManifest.GetStream(); | ||
await fileManifestStream.SaveFileAsync(Path.Combine(Benchmarks.DownloadsDir, "pakchunk0optional-WindowsClient.ucas")); | ||
var fileBuffer = await fileManifestStream.SaveBytesAsync(); | ||
FSHAHash.TryCompute(fileBuffer, out var hash); | ||
} | ||
|
||
var chunkUrl = $"http://epicgames-download1.akamaized.net/Builds/Fortnite/CloudDir/ChunksV4/{testChunk.GroupNumber:D2}/{testChunk.Hash:X16}_{testChunk.Guid}.chunk"; | ||
Console.WriteLine(chunkUrl); | ||
await Task.Delay(-1); | ||
|
||
[MemoryDiagnoser(false)] | ||
public class Benchmarks | ||
{ | ||
public static string DownloadsDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"); | ||
public static string DocumentsDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Documents"); | ||
|
||
public static string ManifestPath = Path.Combine(DownloadsDir, "jDihDvwDD4VfI5Ss7Uy-BNIY91lqSw.manifest"); | ||
//public static string ManifestPath = Path.Combine(DownloadsDir, "apk_manifest.json"); | ||
//public static string ManifestPath = Path.Combine(DownloadsDir, "last_pc_manifest.json"); | ||
public static string ZlibngPath = Path.Combine(DocumentsDir, @"Libraries\zlib-ng2.dll"); | ||
public static string ManifestInfoPath = Path.Combine(DownloadsDir, "manifestinfo.json"); | ||
|
||
private byte[] _manifestBuffer = null!; | ||
private Zlibng _zlibng = null!; | ||
private byte[] _manifestInfoBuffer = null!; | ||
private FFileManifestStream _fileManifestStream = null!; | ||
private byte[] _fileBuffer = null!; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_manifestBuffer = File.ReadAllBytes(ManifestPath); | ||
_zlibng = new Zlibng(ZlibngPath); | ||
_manifestInfoBuffer = File.ReadAllBytes(ManifestInfoPath); | ||
|
||
var manifest = FBuildPatchAppManifest.Deserialize(_manifestBuffer, options => | ||
{ | ||
options.Zlibng = _zlibng; | ||
options.ChunkBaseUrl = "http://epicgames-download1.akamaized.net/Builds/Fortnite/CloudDir/"; | ||
options.ChunkCacheDirectory = Path.Combine(DownloadsDir, "chunks_v2"); | ||
}); | ||
var fileManifest = manifest.FileManifestList.First(x => | ||
x.Filename.EndsWith("/pakchunk0optional-WindowsClient.ucas", StringComparison.Ordinal)); | ||
_fileManifestStream = fileManifest.GetStream(); | ||
_fileBuffer = new byte[fileManifest.FileSize]; | ||
} | ||
|
||
[Benchmark] | ||
public FBuildPatchAppManifest FBuildPatchAppManifest_Deserialize() | ||
{ | ||
return FBuildPatchAppManifest.Deserialize(_manifestBuffer, options => | ||
{ | ||
options.Zlibng = _zlibng; | ||
}); | ||
} | ||
|
||
[Benchmark] | ||
public ManifestInfo? ManifestInfo_Deserialize() | ||
{ | ||
return ManifestInfo.Deserialize(_manifestInfoBuffer); | ||
} | ||
|
||
[Benchmark] | ||
public async Task FFileManifestStream_Save() | ||
{ | ||
await _fileManifestStream.SaveBytesAsync(_fileBuffer); | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
src/EpicManifestParser.Test/EpicManifestParser.Test.csproj
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.