-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Please download this and use it without "Online Mode" for direct manu…
…al patch testing
- Loading branch information
1 parent
0cab08d
commit 70dbfc4
Showing
7 changed files
with
276 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
public class HexUtility | ||
{ | ||
public static bool EqualsBytes(byte[] b1, params byte[] b2) | ||
{ | ||
if (b1.Length != b2.Length) | ||
return false; | ||
for (int i = 0; i < b1.Length; i++) | ||
{ | ||
if (b1[i] != b2[i]) | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public static byte[] Replace(byte[] sourceByteArray, List<HexReplaceEntity> replaces) | ||
{ | ||
byte[] newByteArray = new byte[sourceByteArray.Length]; | ||
Buffer.BlockCopy(sourceByteArray, 0, newByteArray, 0, sourceByteArray.Length); | ||
int offset = 0; | ||
foreach (HexReplaceEntity rep in replaces) | ||
{ | ||
if (EqualsBytes(rep.oldValue, rep.newValue)) | ||
{ | ||
continue; | ||
} | ||
|
||
for (; offset < sourceByteArray.Length; offset++) | ||
{ | ||
if (sourceByteArray[offset] == rep.oldValue[0]) | ||
{ | ||
if (sourceByteArray.Length - offset < rep.oldValue.Length) | ||
break; | ||
|
||
bool find = true; | ||
for (int i = 1; i < rep.oldValue.Length - 1; i++) | ||
{ | ||
if (sourceByteArray[offset + i] != rep.oldValue[i]) | ||
{ | ||
find = false; | ||
break; | ||
} | ||
} | ||
if (find) | ||
{ | ||
Buffer.BlockCopy(rep.newValue, 0, newByteArray, offset, rep.newValue.Length); | ||
offset += (rep.newValue.Length - 1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
return newByteArray; | ||
} | ||
} | ||
|
||
public class HexReplaceEntity | ||
{ | ||
public byte[] oldValue { get; set; } | ||
|
||
public byte[] newValue { get; set; } | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
namespace YuukiPS_Launcher.Json.GameClient | ||
{ | ||
public class Cn | ||
{ | ||
public string userassembly { get; set; } | ||
public string metadata { get; set; } | ||
} | ||
|
||
public class KeyFind | ||
{ | ||
public string cn { get; set; } | ||
public string os { get; set; } | ||
} | ||
|
||
public class Md5Check | ||
{ | ||
public Os os { get; set; } | ||
public Cn cn { get; set; } | ||
} | ||
|
||
public class Md5Vaild | ||
{ | ||
public string os { get; set; } | ||
public string cn { get; set; } | ||
} | ||
|
||
public class Original | ||
{ | ||
public string resources { get; set; } | ||
public KeyFind key_find { get; set; } | ||
public Md5Check md5_check { get; set; } | ||
} | ||
|
||
public class Os | ||
{ | ||
public string userassembly { get; set; } | ||
public string metadata { get; set; } | ||
} | ||
|
||
public class Patched | ||
{ | ||
public string metode { get; set; } | ||
public string resources { get; set; } | ||
public string key_patch { get; set; } | ||
public Md5Vaild md5_vaild { get; set; } | ||
} | ||
|
||
public class Patch | ||
{ | ||
public string version { get; set; } = "0.0.0"; | ||
public string channel { get; set; } = "Global"; | ||
public string release { get; set; } = "Official"; | ||
public Patched? patched { get; set; } | ||
public Original? original { get; set; } | ||
} | ||
} |
Oops, something went wrong.