|
1 | | -using System.Text.Json; |
2 | | -using System.Text.Json.Nodes; |
3 | | -using TACTSharp.Interfaces; |
| 1 | +using TACTSharp.Interfaces; |
4 | 2 |
|
5 | 3 | namespace TACTSharp |
6 | 4 | { |
@@ -76,15 +74,18 @@ public void LoadConfigs(string buildConfig, string cdnConfig, string productConf |
76 | 74 |
|
77 | 75 | try |
78 | 76 | { |
79 | | - var parsedJSON = JsonSerializer.Deserialize<JsonNode>(ProductConfig); |
80 | | - if (parsedJSON == null || parsedJSON["all"] == null || parsedJSON["all"]!["config"] == null) |
81 | | - throw new Exception("Product config has missing keys"); |
82 | | - |
83 | | - if (parsedJSON["all"]!["config"]!["decryption_key_name"] != null && !string.IsNullOrEmpty(parsedJSON["all"]!["config"]!["decryption_key_name"]!.GetValue<string>())) |
| 77 | + if (ProductConfig.Contains("decryption_key_name")) |
84 | 78 | { |
85 | | - cdn.ArmadilloKeyName = parsedJSON["all"]!["config"]!["decryption_key_name"]!.GetValue<string>(); |
86 | | - if (Settings.LogLevel <= TSLogLevel.Info) |
87 | | - Console.WriteLine("Set Armadillo key name to " + cdn.ArmadilloKeyName); |
| 79 | + var valueStart = ProductConfig.IndexOf("decryption_key_name") + 22; // +22 goes to start of value |
| 80 | + var valueEnd = ProductConfig.IndexOf('"', valueStart); // get next quote after value start |
| 81 | + var decryptionKeyName = ProductConfig[valueStart..valueEnd]; |
| 82 | + |
| 83 | + if (!string.IsNullOrEmpty(decryptionKeyName)) |
| 84 | + { |
| 85 | + cdn.ArmadilloKeyName = decryptionKeyName; |
| 86 | + if (Settings.LogLevel <= TSLogLevel.Info) |
| 87 | + Console.WriteLine("Set Armadillo key name to " + cdn.ArmadilloKeyName); |
| 88 | + } |
88 | 89 | } |
89 | 90 | } |
90 | 91 | catch (Exception ex) |
@@ -202,7 +203,7 @@ public void Load() |
202 | 203 |
|
203 | 204 | if (!useTVFS) |
204 | 205 | { |
205 | | - var rootEncodingKeys = Encoding.FindContentKey(Convert.FromHexString(rootKey[0])); |
| 206 | + var rootEncodingKeys = Encoding.FindContentKey(Convert.FromHexString(rootKey![0])); |
206 | 207 | if (!rootEncodingKeys) |
207 | 208 | throw new Exception("Root key not found in encoding"); |
208 | 209 |
|
@@ -245,9 +246,9 @@ public void Load() |
245 | 246 | if (Settings.LogLevel <= TSLogLevel.Info) |
246 | 247 | Console.WriteLine("TVFS loaded in " + Math.Ceiling(timer.Elapsed.TotalMilliseconds) + "ms"); |
247 | 248 | } |
248 | | - |
| 249 | + |
249 | 250 | timer.Stop(); |
250 | | - |
| 251 | + |
251 | 252 |
|
252 | 253 | timer.Restart(); |
253 | 254 | if (!BuildConfig.Values.TryGetValue("install", out var installKey)) |
|
0 commit comments