blob: 277bf8a72cc85c700ce53d781f6901669e9b4376 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
using System.Text;
using System.Text.RegularExpressions;
namespace ReferenceClientProxyImplementation.Patches.Implementations.JSPatches;
public partial class WhileTruePatch : IPatch {
public int GetOrder() => 1;
public string GetName() => "Patch while(true) expressions in JS";
public bool Applies(string relativeName, byte[] content) => relativeName.EndsWith(".js");
public async Task<byte[]> Execute(string relativePath, byte[] content) {
var stringContent = Encoding.UTF8.GetString(content);
stringContent = stringContent.Replace("for (;;)", "while (true)");
return Encoding.UTF8.GetBytes(stringContent);
}
}
|