summary refs log tree commit diff
path: root/ReferenceClientProxyImplementation/Tasks/Startup/PatchClientAssetsTask.cs
blob: 60e7ddcfb14078a69fdbffafd34e4e72242e7619 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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));
//         // }
//     }
// }