コード例 #1
0
        public static FPF_File Parse(string path, bool writeXml)
        {
            FPF_File fpfFile = Parse(File.ReadAllBytes(path));

            if (writeXml)
            {
                YAXSerializer serializer = new YAXSerializer(typeof(FPF_File));
                serializer.SerializeToFile(fpfFile, path + ".xml");
            }

            return(fpfFile);
        }
コード例 #2
0
        public static FPF_File Parse(byte[] rawBytes)
        {
            FPF_File fpfFile = new FPF_File();

            //Header
            fpfFile.I_06  = BitConverter.ToUInt16(rawBytes, 6);
            fpfFile.I_08  = BitConverter.ToInt32(rawBytes, 8);
            fpfFile.I_12  = BitConverter.ToInt32(rawBytes, 12);
            fpfFile.F_16  = BitConverter.ToSingle(rawBytes, 16);
            fpfFile.F_20  = BitConverter.ToSingle(rawBytes, 20);
            fpfFile.F_24  = BitConverter.ToSingle(rawBytes, 24);
            fpfFile.F_28  = BitConverter.ToSingle(rawBytes, 28);
            fpfFile.F_32  = BitConverter.ToSingle(rawBytes, 32);
            fpfFile.F_36  = BitConverter.ToSingle(rawBytes, 36);
            fpfFile.I_40  = BitConverter.ToInt32(rawBytes, 40);
            fpfFile.I_44  = BitConverter.ToInt32(rawBytes, 44);
            fpfFile.F_48  = BitConverter.ToSingle(rawBytes, 48);
            fpfFile.F_52  = BitConverter.ToSingle(rawBytes, 52);
            fpfFile.F_56  = BitConverter.ToSingle(rawBytes, 56);
            fpfFile.I_60  = BitConverter.ToInt32(rawBytes, 60);
            fpfFile.I_64  = BitConverter.ToInt32(rawBytes, 64);
            fpfFile.I_68  = BitConverter.ToInt32(rawBytes, 68);
            fpfFile.I_72  = BitConverter.ToInt32(rawBytes, 72);
            fpfFile.I_76  = BitConverter.ToInt32(rawBytes, 76);
            fpfFile.I_80  = BitConverter.ToInt32(rawBytes, 80);
            fpfFile.I_84  = BitConverter.ToInt32(rawBytes, 84);
            fpfFile.I_88  = BitConverter.ToInt32(rawBytes, 88);
            fpfFile.I_92  = BitConverter.ToInt32(rawBytes, 92);
            fpfFile.F_96  = BitConverter.ToSingle(rawBytes, 96);
            fpfFile.I_100 = BitConverter.ToInt32(rawBytes, 100);
            fpfFile.F_104 = BitConverter.ToSingle(rawBytes, 104);
            fpfFile.I_108 = BitConverter.ToInt32(rawBytes, 108);

            //Unknown indexes
            fpfFile.UnknownIndexes = Unknown_Indexes.Read(rawBytes, UnknownIndexListOffset);

            //Entries
            fpfFile.FpfEntries = new List <FPF_Entry>();
            int offset = EntryPointerListOffset;

            for (int i = 0; i < EntryPointerListEntryCount; i++)
            {
                if (BitConverter.ToInt32(rawBytes, offset) != 0)
                {
                    fpfFile.FpfEntries.Add(FPF_Entry.Read(rawBytes, BitConverter.ToInt32(rawBytes, offset), i));
                }
                offset += EntryPointerListEntrySize;
            }

            //Return
            return(fpfFile);
        }