Beispiel #1
0
 static void Main(string[] args)
 {
     if (args.Length == 2)
     {
         HGPack read = HGPack.ReadArc(args[0]);
         if (read != null)
         {
             string dir = args[1];
             Directory.CreateDirectory(dir);
             foreach (string key in read.toc.Keys)
             {
                 Console.Write("Reading {0}... ", key);
                 byte[] data = read.Data(key);
                 Console.WriteLine("Done.");
                 string file = Path.Combine(dir, key);
                 Console.Write("Writing {0}...", file);
                 Directory.CreateDirectory(new FileInfo(file).DirectoryName);
                 using (FileStream fs = File.Create(file)) {
                     fs.Write(data, 0, data.Length);
                 }
                 Console.WriteLine("Done.");
             }
         }
         else
         {
             Console.WriteLine("Could not find specified file.");
         }
     }
     else
     {
         Console.WriteLine("<infile> <outdir>");
     }
 }
Beispiel #2
0
        public static HGPack ParsePack(string path)
        {
            HGPack inst = null;

            if (File.Exists(path))
            {
                try {
                    inst = new HGPack(path);
                }
                catch {
                }
            }
            return(inst);
        }