コード例 #1
0
ファイル: lsmpq.cs プロジェクト: carriercomm/scsharp
	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
ファイル: extract.cs プロジェクト: carriercomm/scsharp
	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 ();
	}
コード例 #3
0
ファイル: dump-iscript.cs プロジェクト: carriercomm/scsharp
	public static void Main (string[] args)
	{
		string entry_name = args[1];
		int entry = Int32.Parse (args[2]);

		Mpq mpq = new MpqArchive (args[0]);
		DumpIScript dumper = new DumpIScript (mpq);
		dumper.Dump (entry_name, entry);
	}