Exemplo n.º 1
0
        /// <summary>
        /// Parses the wz list file
        /// </summary>
        public void ParseWzFile()
        {
            //WzTools.CreateWzKey(WzMapleVersion.GMS);//what?
            WzBinaryReader wzParser = new WzBinaryReader(new MemoryStream(wzFileBytes), WzIv);

            while (wzParser.PeekChar() != -1)
            {
                int    Len  = wzParser.ReadInt32();
                char[] List = new char[Len];
                for (int i = 0; i < Len; i++)
                {
                    List[i] = (char)wzParser.ReadInt16();
                }
                wzParser.ReadUInt16();
                string Decrypted = wzParser.DecryptString(List);
                if (wzParser.PeekChar() == -1)
                {
                    if (Decrypted[Decrypted.Length - 1] == '/')
                    {
                        Decrypted = Decrypted.TrimEnd("/".ToCharArray()) + "g";                         // Last char should always be a g (.img)
                    }
                }
                listEntries.Add(Decrypted);
            }
            wzParser.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses a wz list file on the disk
        /// </summary>
        /// <param name="filePath">Path to the wz file</param>
        /// <param name="wzIv"></param>
        public static List <string> ParseListFile(string filePath, byte[] wzIv)
        {
            var listEntries = new List <string>();
            var wzFileBytes = File.ReadAllBytes(filePath);
            var wzParser    = new WzBinaryReader(new MemoryStream(wzFileBytes), wzIv);

            while (wzParser.PeekChar() != -1)
            {
                var len     = wzParser.ReadInt32();
                var strChrs = new char[len];
                for (var i = 0; i < len; i++)
                {
                    strChrs[i] = (char)wzParser.ReadInt16();
                }

                wzParser.ReadUInt16(); //encrypted null
                var decryptedStr = wzParser.DecryptString(strChrs);
                listEntries.Add(decryptedStr);
            }

            wzParser.Close();
            var lastIndex = listEntries.Count - 1;
            var lastEntry = listEntries[lastIndex];

            listEntries[lastIndex] = lastEntry.Substring(0, lastEntry.Length - 1) + "g";
            return(listEntries);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Parses the wz list file
 /// </summary>
 public void ParseWzFile()
 {
     using (WzBinaryReader wzParser = new WzBinaryReader(new MemoryStream(mWzFileBytes), mWzIv)) {
         while (wzParser.PeekChar() != -1)
         {
             int    Len  = wzParser.ReadInt32();
             char[] List = new char[Len];
             for (int i = 0; i < Len; i++)
             {
                 List[i] = (char)wzParser.ReadInt16();
             }
             wzParser.ReadUInt16();
             string Decrypted = wzParser.DecryptString(List);
             if (wzParser.PeekChar() == -1)
             {
                 if (Decrypted[Decrypted.Length - 1] == '/')
                 {
                     Decrypted = Decrypted.TrimEnd("/".ToCharArray()) + "g"; // Last char should always be a g (.img)
                 }
             }
             mListEntries.Add(Decrypted);
         }
     }
 }