From 77a609758bb80bac9497d2e3988550f8be578407 Mon Sep 17 00:00:00 2001 From: Rory& Date: Mon, 23 Feb 2026 02:03:20 +0100 Subject: Initial commit --- .../Tasks/Startup/PatchClientAssetsTask.cs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ReferenceClientProxyImplementation/Tasks/Startup/PatchClientAssetsTask.cs (limited to 'ReferenceClientProxyImplementation/Tasks/Startup/PatchClientAssetsTask.cs') diff --git a/ReferenceClientProxyImplementation/Tasks/Startup/PatchClientAssetsTask.cs b/ReferenceClientProxyImplementation/Tasks/Startup/PatchClientAssetsTask.cs new file mode 100644 index 0000000..60e7ddc --- /dev/null +++ b/ReferenceClientProxyImplementation/Tasks/Startup/PatchClientAssetsTask.cs @@ -0,0 +1,37 @@ +// using ReferenceClientProxyImplementation.Configuration; +// +// namespace ReferenceClientProxyImplementation.Tasks.Startup; +// +// public class PatchClientAssetsTask(ProxyConfiguration proxyConfig) : ITask { +// public int GetOrder() => 100; +// +// public string GetName() => "Patch client assets"; +// +// public async Task Execute() { +// // foreach (var file in Directory.GetFiles(proxyConfig.AssetCache.DiskCachePath).Where(x => x.EndsWith(".js"))) +// // { +// // var start = DateTime.Now; +// // if(proxyConfig.Logging.LogClientPatching) Console.Write($"[Client Patcher] Patching file {file}..."); +// // var contents = File.ReadAllText(file); +// // contents = AssetsController.PatchClient(contents); +// // File.WriteAllText(file, contents); +// // if(proxyConfig.Logging.LogClientPatching) Console.WriteLine($" Done in {DateTime.Now - start}!"); +// // } +// // +// // if (proxyConfig.Debug.ReformatAssets) +// // { +// // Console.WriteLine("[Client Patcher] Reformatting assets..."); +// // foreach (var file in Directory.GetFiles(proxyConfig.AssetCache.DiskCachePath)) +// // { +// // var target = file.Replace(proxyConfig.AssetCache.DiskCachePath, proxyConfig.TestClient.DebugOptions.FormattedAssetPath); +// // if(!File.Exists(target)) +// // File.Copy(file, target, false); +// // } +// // +// // Process.Start("npx", "prettier -w " + proxyConfig.Debug.FormattedAssetPath).WaitForExit(); +// // Console.WriteLine("[Client Patcher] Done!"); +// // if (proxyConfig.Debug.OpenFormattedDirAfterReformat) +// // Process.Start(proxyConfig.Debug.OpenFormattedDirCommand.Command, proxyConfig.Debug.OpenFormattedDirCommand.Args.Replace("$dir", proxyConfig.Debug.FormattedAssetPath)); +// // } +// } +// } \ No newline at end of file -- cgit 1.5.1