示例#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())));
        }
示例#2
0
 public byte[] EncryptPacket(byte[] packet)
 {
     return(crypt.EncryptBytes(packet));
 }
示例#3
0
 internal static byte[] EncryptSurface(byte[] imageBytes)
 {
     Security.Encryption encryption = new Security.Encryption(gfxEncryptionKey);
     byte[] encryptedSurface = encryption.EncryptBytes(imageBytes);
     return encryptedSurface;
 }
示例#4
0
文件: PlayerID.cs 项目: pzaps/Server
        /// <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())));
        }
示例#5
0
 internal static byte[] EncryptSurface(byte[] imageBytes)
 {
     Security.Encryption encryption = new Security.Encryption(gfxEncryptionKey);
     byte[] encryptedSurface        = encryption.EncryptBytes(imageBytes);
     return(encryptedSurface);
 }