Exemple #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();
		}
Exemple #2
0
 /// <summary>
 /// Parses a wz list file on the disk
 /// </summary>
 /// <param name="filePath">Path to the wz file</param>
 public static List<string> ParseListFile(string filePath, byte[] WzIv)
 {
     List<string> listEntries = new List<string>();
     byte[] wzFileBytes = File.ReadAllBytes(filePath);
     WzBinaryReader wzParser = new WzBinaryReader(new MemoryStream(wzFileBytes), WzIv);
     while (wzParser.PeekChar() != -1)
     {
         int len = wzParser.ReadInt32();
         char[] strChrs = new char[len];
         for (int i = 0; i < len; i++)
             strChrs[i] = (char)wzParser.ReadInt16();
         wzParser.ReadUInt16(); //encrypted null
         string decryptedStr = wzParser.DecryptString(strChrs);
         listEntries.Add(decryptedStr);
     }
     wzParser.Close();
     int lastIndex= listEntries.Count - 1;
     string lastEntry = listEntries[lastIndex];
     listEntries[lastIndex] = lastEntry.Substring(0, lastEntry.Length - 1) + "g";
     return listEntries;
 }