Exemplo n.º 1
0
        /// <summary>
        /// Saves the ID settings to the configuration file
        /// </summary>
        public static void SaveIDInfo()
        {
            StringBuilder output = new StringBuilder();

            // Write a new xml document to the 'output' StringBuilder
            using (XmlWriter writer = XmlWriter.Create(output, Settings.XmlWriterSettings)) {
                writer.WriteStartDocument();
                // Write the root node
                writer.WriteStartElement("ID");
                // Write the 'PlayerID' node
                writer.WriteStartElement("PlayerID");

                writer.WriteElementString("LastPlayerStringID", lastPlayerStringID);
                writer.WriteElementString("LastPlayerIntID", lastPlayerIntID.ToString());
                // Close the 'PlayerID' node
                writer.WriteEndElement();
                // Write the 'AccountID' node
                writer.WriteStartElement("AccountID");

                writer.WriteElementString("LastAccountStringID", lastAccountStringID);
                writer.WriteElementString("LastAccountIntID", lastAccountIntID.ToString());
                // Close the 'AccountID' node
                writer.WriteEndElement();

                // Close the root node
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
            // Encrypt the xml string and write the encrypted value to the file
            Security.Encryption crypt = new Security.Encryption(ENCRYPTION_KEY);
            System.IO.File.WriteAllBytes(IO.Paths.DataFolder + "playerid.dat", crypt.EncryptBytes(System.Text.Encoding.Unicode.GetBytes(output.ToString())));
        }
Exemplo n.º 2
0
 public byte[] EncryptPacket(byte[] packet)
 {
     return(crypt.EncryptBytes(packet));
 }
Exemplo n.º 3
0
 internal static byte[] EncryptSurface(byte[] imageBytes)
 {
     Security.Encryption encryption = new Security.Encryption(gfxEncryptionKey);
     byte[] encryptedSurface = encryption.EncryptBytes(imageBytes);
     return encryptedSurface;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the ID settings to the configuration file
        /// </summary>
        public static void SaveIDInfo()
        {
            StringBuilder output = new StringBuilder();
            // Write a new xml document to the 'output' StringBuilder
            using (XmlWriter writer = XmlWriter.Create(output, Settings.XmlWriterSettings)) {
                writer.WriteStartDocument();
                // Write the root node
                writer.WriteStartElement("ID");
                // Write the 'PlayerID' node
                writer.WriteStartElement("PlayerID");

                writer.WriteElementString("LastPlayerStringID", lastPlayerStringID);
                writer.WriteElementString("LastPlayerIntID", lastPlayerIntID.ToString());
                // Close the 'PlayerID' node
                writer.WriteEndElement();
                // Write the 'AccountID' node
                writer.WriteStartElement("AccountID");

                writer.WriteElementString("LastAccountStringID", lastAccountStringID);
                writer.WriteElementString("LastAccountIntID", lastAccountIntID.ToString());
                // Close the 'AccountID' node
                writer.WriteEndElement();

                // Close the root node
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
            // Encrypt the xml string and write the encrypted value to the file
            Security.Encryption crypt = new Security.Encryption(ENCRYPTION_KEY);
            System.IO.File.WriteAllBytes(IO.Paths.DataFolder + "playerid.dat", crypt.EncryptBytes(System.Text.Encoding.Unicode.GetBytes(output.ToString())));
        }
Exemplo n.º 5
0
 internal static byte[] EncryptSurface(byte[] imageBytes)
 {
     Security.Encryption encryption = new Security.Encryption(gfxEncryptionKey);
     byte[] encryptedSurface        = encryption.EncryptBytes(imageBytes);
     return(encryptedSurface);
 }