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