Ejemplo n.º 1
0
        public RFFile(string filename)
        {
            DataSource cmpSource = new DataSource(FileMap.FromFile(filename));
            byte[] header = cmpSource.Slice(0, 0x80);
            byte[] filedata = Util.DeCompress(cmpSource.Slice(0x80, cmpSource.Length - 0x80));
            File.WriteAllBytes($"{filename}.dec", header.Concat(filedata).ToArray());
            cmpSource.Close();

            Parse($"{filename}.dec");
        }
Ejemplo n.º 2
0
        static unsafe void Main(string[] args)
        {
            if (args.Length > 0)
            {
                List<string> strings = new List<string>();
                List<int> stringOffsets = new List<int>();
                List<int> dataOffsets = new List<int>();
                List<int> sizes = new List<int>();

                DataSource source = new DataSource(FileMap.FromFile(args[0]));
                string magic = new String((sbyte*)source.Address);
                Endianness endian = Endianness.little;

                if (magic == "PACK")
                    endian = Endianness.little;
                else if (magic == "KCAP")
                    endian = Endianness.big;
                else
                    Console.WriteLine("Not a valid PACK file");

                    try
                    {
                        if (args.Length == 2)
                            new Unpacker(source).Unpack(endian,args[1]);
                        else { new Unpacker(source).Unpack(endian); }

                        Console.WriteLine("Files successfully unpacked.");
                    }
                    catch (Exception x) { Console.WriteLine(x.Message); }

                source.Close();
            }
            else
            {
                Console.WriteLine("\n \n Usage: 'unpacker.exe <File Path> <Output Path>' \n If no output path"+
                    " is specified, files will be extracted to 'Output'.");
            }
        }