|
1 | 1 | using Microsoft.Win32;
|
2 |
| -using Mono.Cecil; |
3 |
| -using Mono.Cecil.Cil; |
4 | 2 | using System;
|
5 | 3 | using System.Diagnostics;
|
6 | 4 | using System.IO;
|
7 | 5 | using System.Linq;
|
8 | 6 | using System.Security.Principal;
|
| 7 | +using Mono.Cecil; |
| 8 | +using Mono.Cecil.Cil; |
9 | 9 |
|
10 | 10 | namespace OverwolfInsiderPatcher
|
11 | 11 | {
|
12 | 12 | class Program
|
13 | 13 | {
|
| 14 | + static string Log(string text, int length = 73) |
| 15 | + { |
| 16 | + text = "|| " + text; |
| 17 | + for (int i = 0; text.Length < length; i++) |
| 18 | + { |
| 19 | + text += " "; |
| 20 | + } |
| 21 | + text = text + " ||"; |
| 22 | + Console.WriteLine(text); |
| 23 | + return text; |
| 24 | + } |
| 25 | + |
14 | 26 | static void Main()
|
15 | 27 | {
|
16 |
| - Console.Title = "Overwolf patcher by Decode 1.2"; |
| 28 | + Console.Title = "Overwolf patcher by Decode 1.3"; |
17 | 29 |
|
18 | 30 | const string outplayedId = "cghphpbjeabdkomiphingnegihoigeggcfphdofo";
|
| 31 | + const string porofessorId = "pibhbkkgefgheeglaeemkkfjlhidhcedalapdggh"; |
19 | 32 |
|
20 | 33 | string overwolfPath = "";
|
21 | 34 | string overwolfDataPath = "";
|
@@ -240,22 +253,93 @@ static void Main()
|
240 | 253 | Console.WriteLine("|| ||");
|
241 | 254 | string[] outplayedVersionsPath = Directory.GetDirectories(overwolfExtensionsPath + outplayedId);
|
242 | 255 | string outplayedPath = outplayedVersionsPath.LastOrDefault();
|
243 |
| - if(String.IsNullOrEmpty(outplayedPath) == false) |
| 256 | + if (String.IsNullOrEmpty(outplayedPath) == false) |
244 | 257 | {
|
245 | 258 | string indexScripts = File.ReadAllText(outplayedPath + "\\indexScripts.js");
|
246 |
| - indexScripts = indexScripts.Replace("null !== (e = null == t ? void 0 : t.includes(this._subscriptionPlan)) && void 0 !== e && e", "true"); // Делает "premium" |
247 |
| - indexScripts = indexScripts.Replace("className: \"app-aside\"", "className: \"app-aside1\""); // Удаляет на главной странице пустое место от рекламы |
248 |
| - File.WriteAllText(outplayedPath + "\\indexScripts.js", indexScripts); |
249 |
| - Console.WriteLine("|| -- [indexScripts.js] Patched successfully ||"); |
| 259 | + if (indexScripts.Contains("null !== (e = null == t ? void 0 : t.includes(this._subscriptionPlan)) && void 0 !== e && e")) |
| 260 | + { |
| 261 | + indexScripts = indexScripts.Replace("null !== (e = null == t ? void 0 : t.includes(this._subscriptionPlan)) && void 0 !== e && e", "true"); // Делает "premium" |
| 262 | + //indexScripts = indexScripts.Replace("className: \"app-aside\"", "className: \"app-aside1\""); // Удаляет на главной странице пустое место от рекламы // Оказывается там есть переключатель и это лишнее |
| 263 | + File.WriteAllText(outplayedPath + "\\indexScripts.js", indexScripts); |
| 264 | + Console.WriteLine("|| -- [indexScripts.js] Patched successfully ||"); |
| 265 | + } |
| 266 | + else |
| 267 | + { |
| 268 | + Console.WriteLine("|| -- [indexScripts.js] Patch failed or already patched ||"); |
| 269 | + } |
250 | 270 |
|
251 | 271 | string backgroundScripts = File.ReadAllText(outplayedPath + "\\backgroundScripts.js");
|
252 |
| - backgroundScripts = backgroundScripts.Replace("return 0 !== t.length;", "return true;"); // Делает "premium" |
253 |
| - File.WriteAllText(outplayedPath + "\\backgroundScripts.js", backgroundScripts); |
254 |
| - Console.WriteLine("|| -- [backgroundScripts.js] Patched successfully ||"); |
| 272 | + if (backgroundScripts.Contains("return 0 !== t.length;")) |
| 273 | + { |
| 274 | + backgroundScripts = backgroundScripts.Replace("return 0 !== t.length;", "return true;"); // Делает "premium" |
| 275 | + File.WriteAllText(outplayedPath + "\\backgroundScripts.js", backgroundScripts); |
| 276 | + Console.WriteLine("|| -- [backgroundScripts.js] Patched successfully ||"); |
| 277 | + } |
| 278 | + else |
| 279 | + { |
| 280 | + Console.WriteLine("|| -- [backgroundScripts.js] Patch failed or already patched ||"); |
| 281 | + } |
| 282 | + |
255 | 283 | Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
|
256 | 284 | }
|
257 | 285 | }
|
258 | 286 |
|
| 287 | + if (Directory.Exists(overwolfExtensionsPath + porofessorId)) |
| 288 | + { |
| 289 | + Console.WriteLine(); |
| 290 | + Console.WriteLine(); |
| 291 | + Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"); |
| 292 | + Console.WriteLine("|| Porofessor ||"); |
| 293 | + Console.WriteLine("|| ||"); |
| 294 | + string[] porofessorVersionsPath = Directory.GetDirectories(overwolfExtensionsPath + porofessorId); |
| 295 | + string porofessorPath = porofessorVersionsPath.LastOrDefault(); |
| 296 | + if (String.IsNullOrEmpty(porofessorPath) == false) |
| 297 | + { |
| 298 | + string[] windows = Directory.GetFiles(porofessorPath + "\\windows\\"); |
| 299 | + foreach (string window in windows) |
| 300 | + { |
| 301 | + string file = File.ReadAllText(window); |
| 302 | + const string adContainer = "<div id=\"ad-container\"><div id=\"ad-div\" class=\"ad\"></div></div>"; |
| 303 | + if (file.Contains("<div id=\"ad-container\">")) |
| 304 | + { |
| 305 | + file = file.Replace(adContainer, "<!-- Ad Patched -->"); |
| 306 | + |
| 307 | + if (!file.Contains("<!-- Ad Patched -->")) |
| 308 | + { |
| 309 | + string adBegin = "<div id=\"ad-container\">"; |
| 310 | + string adEnd = " </div>"; |
| 311 | + |
| 312 | + int adBeginIndex = file.IndexOf(adBegin); |
| 313 | + if (adBeginIndex > 0) |
| 314 | + { |
| 315 | + int adEndIndex = file.Substring(adBeginIndex).IndexOf(adEnd); |
| 316 | + |
| 317 | + string firstPart = file.Substring(0, adBeginIndex); |
| 318 | + string secondPart = file.Substring(adBeginIndex + adEndIndex + adEnd.Length); |
| 319 | + file = firstPart + secondPart; |
| 320 | + } |
| 321 | + |
| 322 | + } |
| 323 | + |
| 324 | + File.WriteAllText(window, file); |
| 325 | + Log("-- [" + Path.GetFileName(window) + "] Patched successfuly"); |
| 326 | + } |
| 327 | + else |
| 328 | + { |
| 329 | + if (file.Contains("<!-- Ad Patched -->")) |
| 330 | + { |
| 331 | + Log("-- [" + Path.GetFileName(window) + "] Already patched"); |
| 332 | + } |
| 333 | + else |
| 334 | + { |
| 335 | + Log("-- [" + Path.GetFileName(window) + "] Not patched"); |
| 336 | + } |
| 337 | + } |
| 338 | + } |
| 339 | + } |
| 340 | + Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"); |
| 341 | + } |
| 342 | + |
259 | 343 |
|
260 | 344 |
|
261 | 345 |
|
|
0 commit comments