Пример #1
0
	public static void Main (string[] args) {
		if (args.Length != 1) {
			Console.WriteLine ("usage:  lsmpq.exe <mpq-file>");
			Environment.Exit (0);
		}

		Mpq mpq = new MpqArchive (args[0]);

		StreamReader sr = new StreamReader (Assembly.GetExecutingAssembly().GetManifestResourceStream ("list.txt"));

		string entry;
		while ((entry = sr.ReadLine()) != null) {
			entry = entry.ToLower ();
			Stream mpq_stream = mpq.GetStreamForResource (entry);
			if (mpq_stream == null)
				continue;

			Console.WriteLine ("{0} {1}", entry, mpq_stream.Length);
			mpq_stream.Dispose();
		}
	}
Пример #2
0
	public static void Main (string[] args) {
		if (args.Length < 3) {
			Console.WriteLine ("usage:  extract.exe <mpq-file> <mpq-file-path> <output-file>");
			Console.WriteLine (" e.g.:  extract.exe StarDat.mpq arr\\\\units.dat stardat-units.dat");
			Environment.Exit (0);
		}

		Mpq mpq = new MpqArchive (args[0]);
		Stream stream = mpq.GetStreamForResource (args[1]);
		Stream outStream = File.OpenWrite (args[2]);

		byte[] buf = new byte[4096];
		int position = 0;

		while (position < stream.Length) {
			int read_length = stream.Read (buf, 0, buf.Length);

			outStream.Write (buf, 0, read_length);
			position += read_length;
		}

		outStream.Close ();
	}