-
Notifications
You must be signed in to change notification settings - Fork 3
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
90249cd
commit 9a11225
Showing
15 changed files
with
451 additions
and
232 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,59 @@ | ||
using System.Diagnostics; | ||
using Meddle.Utils.Skeletons.Havok; | ||
using Meddle.Utils.Skeletons.Havok.Models; | ||
|
||
namespace Meddle.UI.Util; | ||
|
||
public class SkeletonUtil | ||
{ | ||
public static string ParseHavokInput(byte[] data) | ||
{ | ||
if (Program.Configuration.AssetCcResolve) | ||
{ | ||
return ParseHavokInputCc(data); | ||
} | ||
else | ||
{ | ||
return ParseHavokInputInterop(data); | ||
} | ||
} | ||
|
||
public static (string, HavokSkeleton) ProcessHavokInput(byte[] data) | ||
{ | ||
if (Program.Configuration.AssetCcResolve) | ||
{ | ||
var str = ParseHavokInputCc(data); | ||
var skeleton = HavokCCUtils.ParseHavokXml(str); | ||
return (str, skeleton); | ||
} | ||
else | ||
{ | ||
var str = ParseHavokInputInterop(data); | ||
var skeleton = HavokUtils.ParseHavokXml(str); | ||
return (str, skeleton); | ||
} | ||
} | ||
|
||
public static string ParseHavokInputCc(byte[] data) | ||
{ | ||
File.WriteAllBytes("./data/input.pap", data); | ||
var program = Process.Start("./data/NotAssetCc.exe", new[] {"./data/input.pap", "./data/output.pap"}); | ||
program.WaitForExit(); | ||
var parseResult = File.ReadAllText("./data/output.pap"); | ||
return parseResult; | ||
} | ||
|
||
public static string ParseHavokInputInterop(byte[] data) | ||
{ | ||
var tempPath = Path.GetTempFileName(); | ||
File.WriteAllBytes(tempPath, data); | ||
|
||
using var message = new HttpRequestMessage(HttpMethod.Post, $"http://localhost:{Program.Configuration.InteropPort}/parsesklb"); | ||
using var content = new StringContent(tempPath); | ||
message.Content = content; | ||
using var client = new HttpClient(); | ||
var response = client.SendAsync(message).GetAwaiter().GetResult(); | ||
var result = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); | ||
return result; | ||
} | ||
} |
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.