/// <summary> /// Loads the ID settings from the configuration file /// </summary> public static void LoadIDInfo() { // Check if the configuration file exists, if not, create it if (IO.IO.FileExists(Path.Combine(IO.Paths.DataFolder, "playerid.dat")) == false) { SaveIDInfo(); } // Decrypt the configuration file into a string Security.Encryption crypt = new Security.Encryption(ENCRYPTION_KEY); string xmlData = System.Text.Encoding.Unicode.GetString(crypt.DecryptBytes(System.IO.File.ReadAllBytes(Path.Combine(IO.Paths.DataFolder, "playerid.dat")))); using (XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlData))) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "LastPlayerStringID": { lastPlayerStringID = reader.ReadString(); } break; case "LastPlayerIntID": { lastPlayerIntID = reader.ReadString().ToUlng(); } break; case "LastAccountStringID": { lastAccountStringID = reader.ReadString(); } break; case "LastAccountIntID": { lastAccountIntID = reader.ReadString().ToUlng(); } break; } } } } }
public byte[] DecryptPacket(byte[] packet) { return(crypt.DecryptBytes(packet)); }
internal static byte[] DecryptSurface(byte[] imageBytes) { Security.Encryption encryption = new Security.Encryption(gfxEncryptionKey); byte[] decryptedSurface = encryption.DecryptBytes(imageBytes); return decryptedSurface; }
/// <summary> /// Loads the ID settings from the configuration file /// </summary> public static void LoadIDInfo() { // Check if the configuration file exists, if not, create it if (IO.IO.FileExists(IO.Paths.DataFolder + "playerid.dat") == false) { SaveIDInfo(); } // Decrypt the configuration file into a string Security.Encryption crypt = new Security.Encryption(ENCRYPTION_KEY); string xmlData = System.Text.Encoding.Unicode.GetString(crypt.DecryptBytes(System.IO.File.ReadAllBytes(IO.Paths.DataFolder + "playerid.dat"))); using (XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlData))) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "LastPlayerStringID": { lastPlayerStringID = reader.ReadString(); } break; case "LastPlayerIntID": { lastPlayerIntID = reader.ReadString().ToUlng(); } break; case "LastAccountStringID": { lastAccountStringID = reader.ReadString(); } break; case "LastAccountIntID": { lastAccountIntID = reader.ReadString().ToUlng(); } break; } } } } }
internal static byte[] DecryptSurface(byte[] imageBytes) { Security.Encryption encryption = new Security.Encryption(gfxEncryptionKey); byte[] decryptedSurface = encryption.DecryptBytes(imageBytes); return(decryptedSurface); }