Exemple #1
0
        public static Stream EnsureUnpacked(Stream s)
        {
            var reader      = new StructReader(s, System.Text.Encoding.ASCII, true);
            var streamStart = s.Position;

            var version = reader.ReadSingle(); //read just version

            s.Position = streamStart;          //back to start for further processing
            if (version >= 1.44f)
            {
                var header = reader.ReadStruct <DLF_IO_HEADER>(); //read full header

                MemoryStream ms = new MemoryStream();

                StructWriter writer = new StructWriter(ms, System.Text.Encoding.ASCII, true);
                writer.WriteStruct(header); //write header

                byte[] restOfFile = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
                byte[] unpacked   = ArxIO.Unpack(restOfFile);

                writer.Write(unpacked); //write unpacked rest
                s.Dispose();            //close old stream
                ms.Position = 0;
                return(ms);
            }
            return(s); //no need to unpack, return input stream
        }
Exemple #2
0
        public string[] Import()
        {
            StructReader Reader = new StructReader(new MemoryStream(Script), false, Encoding.UTF8);

            Reader.ReadStruct(ref Header);
            if (Header.Signature != "CSTL")
            {
                throw new Exception("Invalid Format");
            }

            Langs = new string[ReadNum(Reader)];
            for (long i = 0; i < Langs.Length; i++)
            {
                Langs[i] = ReadString(Reader);
            }

            long Count = (ReadNum(Reader) * 2) * Langs.Length;

            string[] Strings = new string[Count];
            for (long i = 0; i < Count; i++)
            {
                Strings[i] = ReadString(Reader);
            }

            Reader.Close();
            return(Strings);
        }
        public string Import()
        {
            if (Header.IsBinary || Header.Entries != 1)
            {
                throw new Exception("Not Suported.");
            }

            if (Header.IsEncrypted)
            {
                Decrypt();
            }
            if (Header.IsCompressed)
            {
                Decompress();
            }

            Content = new VLContent();
            StructReader Reader = new StructReader(new MemoryStream(Script), true, Encoding);

            Reader.Seek(0x50, 0);

            if (Reader.PeekUInt32() == 3557938853)  //English Script from KoiChoco
            {
                Reader.Seek(0x4C, 0);
                Header.Unk = 0;
                NoUnk14    = true;
            }

            Reader.ReadStruct(ref Content);

            return(Content.Content);
        }
Exemple #4
0
        private string ReadString(StructReader Stream)
        {
            byte[] Buffer = new byte[ReadNum(Stream)];
            Stream.Read(Buffer, 0, Buffer.Length);

            return(Encoding.UTF8.GetString(Buffer));
        }
        //uint vfptr;
        //int _nIDStart;
        //int _nIDCnt;
        //int _nUnusedIndex;
        //uint _dwReleaseInterval;
        //int _nMaxRawDataCnt;
        //int _nLoadedRawDataCnt;
        //uint _dwMaxFrameRawDataSize;
        //int _bEnablePack;
        //[MarshalAs(UnmanagedType.ByValArray,SizeConst=64)]
        //char[] _szPackName;
        //int _bBinary;
        //CRawDataInfo[] _RawDataArray;
        ////std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,CRawDataInfo *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,CRawDataInfo *> > > _IDIdx;
        //List<int> _RequestList;
        //int _bEnableRequest;
        //int _nIDLast;
        //int _nMaxFieldCnt;

        public static T[] LoadBin(string Filename)
        {
            FileStream   fs = new FileStream(Filename, FileMode.Open, FileAccess.Read);
            BinaryReader fp = new BinaryReader(fs);

            long filesize = fs.Length;
            uint infoSize = fp.ReadUInt32();
            int  sizeOf   = Marshal.SizeOf(typeof(T));

            if ((uint)sizeOf != infoSize)
            {
                ;//System.Windows.Forms.MessageBox.Show("sizeof struct not equal with sizeof in rawData");
            }
            int resCount = (int)filesize / (int)infoSize;

            T[] returnSet = new T[resCount];

            for (int i = 0; i < resCount; i++)
            {
                byte[] data = fp.ReadBytes((int)infoSize);

                returnSet[i] = StructReader.ReadStructFromArray <T>(data);
            }

            fp.Close();
            fs.Close();

            return(returnSet);
        }
Exemple #6
0
        private static void ContinueTL()
        {
            Console.WriteLine("Loading Translation...");
            StructReader Reader       = new StructReader(Setup);
            Config       CurrentSetup = new Config();

            Reader.ReadStruct(ref CurrentSetup);
            Reader.Close();

            for (uint i = 0; i < CurrentSetup.Strings.LongLength; i++)
            {
                Dumper.Texts.Add(CurrentSetup.Strings[i]);
                Dumper.Tls.Add(CurrentSetup.TLs[i]);
            }

            Dumper.Delay      = CurrentSetup.Delay;
            Dumper.Exe        = CurrentSetup.Executable;
            Dumper.Invalidate = CurrentSetup.Invalidate > 0;


            File.Delete(Setup);

            Dumper.SetupLauncher(null);

            Process.GetCurrentProcess().Kill();
        }
Exemple #7
0
        public string[] Import()
        {
            MemoryStream Script = new MemoryStream(Data);

            BlockPos = new List <long>();

            string[] Array = new string[0];
            using (StructReader Reader = new StructReader(Script, Encoding: Encoding)) {
                while (Reader.Peek() != -1)
                {
                    if (!IsValid(Reader))
                    {
                        Reader.ReadByte();
                        continue;
                    }
                    BINv2Struct Struct = new BINv2Struct();
                    long        Pos    = Reader.BaseStream.Position;
                    try {
                        Reader.ReadStruct(ref Struct);
                    } catch {
                        try {
                            Reader.Seek(Pos + 1, SeekOrigin.Begin);
                        } catch {
                            break;
                        }
                        continue;
                    }
                    BlockPos.Add(Pos);
                    AppendArray(ref Array, Struct.Strings);
                }

                return(Array);
            }
        }
Exemple #8
0
        private static void Worker_Open(object sender, DoWorkEventArgs e)
        {
            var          Worker = (BackgroundWorker)sender;
            var          Input  = (Stream)e.Argument;
            StructReader Reader = new StructReader(Input);

            if (Reader.PeekInt() != 0x414E46)
            {
                throw new Exception("The Input file isn't a FNA File");
            }

            FNAHeader FontInfo = new FNAHeader();

            Reader.ReadStruct(ref FontInfo);

            if (FontInfo.Version != 0)
            {
                throw new Exception("Unsupported FNA Version");
            }

            int LastReportedProgress = -1;
            int Current = 0;
            int Steps   = (from a in FontInfo.Fonts select(from b in a.Tables select b.Gylphs.Length).Sum()).Sum();

            for (int a = 0; a < FontInfo.Fonts.Length; a++)
            {
                ref var Font = ref FontInfo.Fonts[a];
                for (int b = 0; b < Font.Tables.Length; b++)
                {
                    ref var Table = ref Font.Tables[b];
                    for (uint i = 0; i < Table.Gylphs.Length; i++)
                    {
                        if (Worker.CancellationPending)
                        {
                            e.Cancel = true;
                            return;
                        }


                        int Progress = (int)Math.Abs(((double)(100 * ++Current)) / Steps);
                        if (Progress != LastReportedProgress)
                        {
                            LastReportedProgress = Progress;
                            Worker.ReportProgress(Progress);
                        }

                        ref var Glyph = ref Table.Gylphs[i];

                        if (Glyph.TextureOffset != 0)
                        {
                            Glyph.Data = new VirtStream(Input, Glyph.TextureOffset, Glyph.TextureSize);
                        }
                        else
                        {
                            Glyph.Data = null;
                        }

                        Glyph.Char = IndexToChar(i);
                        Glyph.CreateTexture(Table.Height);
                    }
Exemple #9
0
        public string[] Import()
        {
            dynamic OHeader = new ATFHeader();

            Tools.ReadStruct(Script, ref OHeader);
            Header = OHeader;
            if (Header.Signature != 0x00465441)
            {
                throw new Exception("Invalid Input File.");
            }
            Entries = new List <Entry>();
            List <string> Strings = new List <string>();
            StructReader  Reader  = new StructReader(new MemoryStream(Script), Encoding.Unicode);

            Reader.Seek(Header.ByteCodeLength + Header.ByteCodeStart, SeekOrigin.Begin);
            while (Entries.Count < Header.Count)
            {
                dynamic Entry = new Entry()
                {
                    Header   = Header,
                    TextWork = EntryText
                };
                Reader.ReadStruct(ref Entry);
                Entries.Add(Entry);
                Strings.Add(Entry.Text);
            }
            return(Strings.ToArray());
        }
        public void ReadFrom(StructReader reader)
        {
            header            = reader.ReadStruct <FTL_IO_3D_DATA_HEADER>();
            vertexList        = new EERIE_OLD_VERTEX[header.nb_vertex];
            faceList          = new EERIE_FACE_FTL[header.nb_faces];
            textureContainers = new FTL_IO_TEXTURE_CONTAINER[header.nb_maps];
            groups            = new FTL_IO_3D_DATA_GROUP[header.nb_groups];
            actionList        = new EERIE_ACTIONLIST_FTL[header.nb_action];
            selections        = new FTL_IO_3D_DATA_SELECTION[header.nb_selections];

            for (int i = 0; i < vertexList.Length; i++)
            {
                vertexList[i] = reader.ReadStruct <EERIE_OLD_VERTEX>();
            }

            for (int i = 0; i < faceList.Length; i++)
            {
                faceList[i] = reader.ReadStruct <EERIE_FACE_FTL>();
            }

            for (int i = 0; i < textureContainers.Length; i++)
            {
                textureContainers[i] = reader.ReadStruct <FTL_IO_TEXTURE_CONTAINER>();
            }

            //groups have to read in two steps
            for (int i = 0; i < groups.Length; i++)
            {
                groups[i].group = reader.ReadStruct <EERIE_GROUP_FTL>();
            }

            for (int i = 0; i < groups.Length; i++)
            {
                var indices = groups[i].indices = new int[groups[i].group.nb_index];
                for (int j = 0; j < indices.Length; j++)
                {
                    indices[j] = reader.ReadInt32();
                }
            }

            for (int i = 0; i < actionList.Length; i++)
            {
                actionList[i] = reader.ReadStruct <EERIE_ACTIONLIST_FTL>();
            }

            //same as with groups
            for (int i = 0; i < selections.Length; i++)
            {
                selections[i].selection = reader.ReadStruct <EERIE_SELECTIONS_FTL>();
            }

            for (int i = 0; i < selections.Length; i++)
            {
                var selected = selections[i].selected = new int[selections[i].selection.nb_selected];
                for (int j = 0; j < selected.Length; j++)
                {
                    selected[j] = reader.ReadInt32();
                }
            }
        }
Exemple #11
0
        public static File[] Extract(Stream Packget)
        {
            StructReader Reader = new StructReader(Packget, Encoding: Encoding.ASCII);//not sure
            PACHeader    Header = new PACHeader();

            Reader.ReadStruct(ref Header);

            if (Header.Signature != "PAC ")
            {
                throw new Exception("Bad Signature");
            }

            File[] Files = new File[Header.FileCount + 1];

            Files[0] = new File()
            {
                FileName = HeaderInfo,
                Content  = new MemoryStream(Header.Dummy)
            };

            for (int i = 1; i < Files.Length; i++)
            {
                Files[i] = new File();
                Reader.ReadStruct(ref Files[i]);

                Files[i].FileName = Files[i].FileName.TrimEnd('\x0');
                Files[i].Content  = new VirtStream(Reader.BaseStream, Files[i].Offset, Files[i].Length);
            }

            return(Files);
        }
Exemple #12
0
        public Bitmap Import()
        {
            StructReader Reader = new StructReader(new MemoryStream(Texture));
            CZ0Header    Header = new CZ0Header();

            Reader.ReadStruct(ref Header);

            if (Header.Signature != "CZ0\x0")
            {
                throw new BadImageFormatException();
            }

            Reader.Seek(Header.HeaderLength, SeekOrigin.Begin);

            Bitmap Picture = new Bitmap(Header.Width, Header.Heigth, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            for (int y = 0; y < Header.Heigth; y++)
            {
                for (int x = 0; x < Header.Width; x++)
                {
                    Pixel Pixel = new Pixel();
                    Reader.ReadStruct(ref Pixel);
                    Picture.SetPixel(x, y, Color.FromArgb(Pixel.A, Pixel.R, Pixel.G, Pixel.B));
                }
            }

            Reader.Close();

            return(Picture);
        }
Exemple #13
0
        public StringEntry[] Import()
        {
            if (!Decompressed)
            {
                Decompress();
            }

            Header = new ScriptHeader();
            StructReader Reader = new StructReader(new MemoryStream(Script), false, Encoding);

            Reader.ReadStruct(ref Header);

            if (Header.ScriptLength + 0x10 != Script.Length)
            {
                throw new Exception("Corrupted Script");
            }

            List <StringEntry> Strings = new List <StringEntry>();

            for (uint i = 0; i < EntryCount; i++)
            {
                Reader.Seek(Header.OffsetTable + HeaderLen + (i * 4), SeekOrigin.Begin);
                uint Offset = Reader.ReadUInt32() + Header.StringTable + HeaderLen;

                Reader.Seek(Offset, SeekOrigin.Begin);
                StringEntry Entry = new StringEntry();
                Reader.ReadStruct(ref Entry);
                Strings.Add(Entry);
            }

            Reader.Close();
            return(Strings.ToArray());
        }
Exemple #14
0
        public static Stream EnsurePacked(Stream s)
        {
            s.Position = 0;
            StructReader reader = new StructReader(s);
            MemoryStream ms     = new MemoryStream();
            StructWriter writer = new StructWriter(ms, System.Text.Encoding.ASCII, true);

            var header = reader.ReadStruct <FTS_IO_UNIQUE_HEADER>();

            writer.WriteStruct(header);

            for (int i = 0; i < header.count; i++)
            {
                writer.WriteStruct(reader.ReadStruct <FTS_IO_UNIQUE_HEADER2>());
            }

            byte[] restOfFile = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
            byte[] packed     = ArxIO.Pack(restOfFile);

            ms.Write(packed, 0, packed.Length);
            ms.Position = 0;

            s.Dispose();
            return(ms);
        }
Exemple #15
0
        private Bitmap Export(byte[] Texture)
        {

            StructReader Reader = new StructReader(new MemoryStream(Texture));
            CZ3Header Header = new CZ3Header();
            Reader.ReadStruct(ref Header);
         
            if (Header.Signature != "CZ3\x0")
                throw new BadImageFormatException();

            Reader.Seek(Header.HeaderLength, SeekOrigin.Begin);
            Bitmap Picture = new Bitmap(Header.Width, Header.Heigth, PixelFormat.Format32bppArgb);
            if (Header.Colorbits == 4)//4bit
            {
                
            }
            else if (Header.Colorbits == 8)//8bit
            {
               

            }
            else if (Header.Colorbits == 32)//32
            {
                var bytes = Decompress(Reader);
                byte[] data = bytes.ToArray();
                int PixelByteCount = 4;
                ImageFillPartten.LineDiffPattern(ref Picture, Header.Colorblock, PixelByteCount, data,null);
            }
            Reader.Close();
            return Picture;
        }
Exemple #16
0
        public static FileEntry[] Open(Stream Input)
        {
            StructReader Reader = new StructReader(Input, false, Encoding.GetEncoding(932));
            IntHeader    Header = new IntHeader();

            Reader.ReadStruct(ref Header);
            if (Header.Signature != "KIF\x0")
            {
                throw new Exception("Invalid Packget");
            }

            FileEntry[] Entries = new FileEntry[Header.FileCount];
            for (uint i = 0; i < Entries.Length; i++)
            {
                FileEntry Entry = new FileEntry();
                Reader.ReadStruct(ref Entry);
                Entry.Content  = new VirtStream(Input, Entry.Postion, Entry.Length);
                Entry.FileName = Entry.FileName.TrimEnd('\x0');
                if (Entry.FileName == "__key__.dat")
                {
                    throw new Exception("Encrypted Packget Not Supported.");
                }
                Entries[i] = Entry;
            }

            return(Entries);
        }
Exemple #17
0
        public IEnumerable <byte> Decompress(StructReader Reader)
        {
            List <byte>            output             = new List <byte>();
            uint                   fileCount          = Reader.ReadUInt32();
            Dictionary <int, uint> rawSizeList        = new Dictionary <int, uint>();
            Dictionary <int, uint> compressedSizeList = new Dictionary <int, uint>();

            for (int i = 0; i < fileCount; i++)
            {
                uint fileCompressedSize = Reader.ReadUInt32();
                uint fileRawSize        = Reader.ReadUInt32();
                rawSizeList.Add(i, fileRawSize);
                compressedSizeList.Add(i, fileCompressedSize);
            }

            for (int i = 0; i < fileCount; i++)
            {
                List <int> lmzBytes   = new List <int>();
                int        totalcount = (int)compressedSizeList[i];
                for (int j = 0; j < totalcount; j++)
                {
                    lmzBytes.Add(Reader.ReadUInt16());
                }
                //解压lzw

                /*byte[] re = unlzw(lmzBytes.ToArray());
                 * output.AddRange(re);*/
                string str = LzwUtil.Decompress(lmzBytes);
                foreach (var c in str)
                {
                    output.Add((byte)c);
                }
            }
            return(output);
        }
Exemple #18
0
        private HEDFormat LoadHeader()
        {
            int Bak = Open;

            Open = -1;
            foreach (string FileName in ListFiles())
            {
                Stream       File = OpenFile(FileName);
                StructReader Temp = new StructReader(File);
                Temp.BaseStream.Position = 0;
                if (Temp.ReadString(StringStyle.CString) != "HED")
                {
                    continue;
                }
                Temp.BaseStream.Position = 0;

                var Header = new HEDFormat();
                Temp.ReadStruct(ref Header);

                if (LBA[Bak].BaseStream.Length == Header.LBALength)
                {
                    Open = Bak;
                    return(Header);
                }
            }
            Open = Bak;
            throw new Exception("Failed to Open LBA Header");
        }
Exemple #19
0
        public void read(DataReader i_reader)
        {
            int i;

            //szName
            this.szBoneName = i_reader.readAscii(15);
            this.ulFrameNo  = i_reader.readInt();
            StructReader.read(this.vec3Position, i_reader);
            StructReader.read(this.vec4Rotate, i_reader);
            for (i = 0; i < 16; i++)
            {
                this.cInterpolation1[i] = i_reader.readByte();
            }
            for (i = 0; i < 16; i++)
            {
                this.cInterpolation2[i] = i_reader.readByte();
            }
            for (i = 0; i < 16; i++)
            {
                this.cInterpolation3[i] = i_reader.readByte();
            }
            for (i = 0; i < 16; i++)
            {
                this.cInterpolation4[i] = i_reader.readByte();
            }
            return;
        }
Exemple #20
0
        private void Decompress()
        {
            CatHeader    CompHeader = new CatHeader();
            StructReader Reader     = new StructReader(new MemoryStream(Script), false, Encoding);

            Reader.ReadStruct(ref CompHeader);

            if (CompHeader.Singnature != "CatScene")
            {
                throw new Exception("This isn't a valid CatSystem2 Script");
            }
            MemoryStream Decompressed = new MemoryStream();

            Algo.DecompressData(Reader.BaseStream, Decompressed);

            if (CompHeader.DecompressedSize != Decompressed.Length)
            {
                throw new Exception("Corrupted Script");
            }

            Reader.Close();
            Script = Decompressed.ToArray();
            Decompressed.Close();
            this.Decompressed = true;
        }
 public string[] Import()
 {
     using (var Stream = new MemoryStream(Script))
         using (var Reader = new StructReader(Stream, Encoding: Encoding.Unicode)) {
             Reader.ReadStruct(ref Resource);
         }
     return((from x in Resource.Localizations select x.Content).ToArray());
 }
Exemple #22
0
        /// <summary>
        /// Convert SRL2 Database to the SRL3 Format
        /// </summary>
        /// <param name="Reader">Input Stream</param>
        private static void SRL2Parser(StructReader Reader)
        {
            Log("SRL2 Database Detected... Rebuilding...");
            var DB = new SRLData2();

            Reader.ReadStruct(ref DB);
            Reader.Close();

            if (File.Exists(TLMapSrc))
            {
                File.Delete(TLMapSrc);
            }

            for (ushort x = 0; x < DB.Databases.Length; x++)
            {
                Log("Dumping Database Id: {0}", true, x);
                SRLDatabase Database = DB.Databases[x];
                for (uint i = 0; i < Database.Original.Length; i++)
                {
                    AppendLst(Database.Original[i], Database.Replace[i], string.Format(TLMapSrcMsk, x));
                }
            }

            if (DB.OriLetters.LongLength + DB.UnkReps.LongLength != 0)
            {
                Log("Dumping Char Reloads...", true);
                using (TextWriter Output = File.CreateText(CharMapSrc)) {
                    for (uint i = 0; i < DB.OriLetters.LongLength; i++)
                    {
                        Output.WriteLine("{0}={1}", DB.OriLetters[i], DB.MemoryLetters[i]);
                    }
                    for (uint i = 0; i < DB.UnkReps.LongLength; i++)
                    {
                        Output.WriteLine("{0}=0x{1:X4}", DB.UnkReps[i], DB.UnkChars[i]);
                    }
                    Output.Close();
                }
            }

            if (DB.OriLetters.LongLength != 0)
            {
                Log("Dumping Replaces...", true);

                for (uint i = 0; i < DB.OriLetters.LongLength; i++)
                {
                    try {
                        string L1 = DB.RepOri[i];
                        string L2 = DB.RepTrg[i];
                        AppendLst(L1, L2, ReplLst);
                    } catch { }
                }
            }


            File.Delete(TLMap);
            Log("Restarting...");
            Init();
        }
Exemple #23
0
 public void ReadFrom(StructReader reader)
 {
     header = reader.ReadStruct <DLF_IO_PATH_HEADER>();
     paths  = new DLF_IO_PATHWAYS[header.numPathways];
     for (int i = 0; i < header.numPathways; i++)
     {
         paths[i] = reader.ReadStruct <DLF_IO_PATHWAYS>();
     }
 }
Exemple #24
0
        public string[] Import()
        {
            DataFormat = new List <bool>();
            int DFID = 0;

            Database Header = new Database();

            Tools.ReadStruct(Script, ref Header);
            List <string> Strings = new List <string>();

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                File.WriteAllBytes("decrypted.dbs", Script);
            }
#endif

            using (Stream tmp = new MemoryStream(Script))
                using (StructReader Reader = new StructReader(tmp, false, Encoding: GetEncoding())) {
                    //List All Data Types
                    Reader.Seek(Header.ValueTypeList, SeekOrigin.Begin);
                    while (Reader.BaseStream.Position < Header.ValueList)
                    {
                        TypeHeader THeader = new TypeHeader();
                        Reader.ReadStruct(ref THeader);
                        DataFormat.Add(THeader.IsString);
                    }

                    //Foreach Inside all Data Values
                    Reader.Seek(Header.ValueList, SeekOrigin.Begin);
                    while (Reader.BaseStream.Position < Header.StringTable)
                    {
                        uint Value = Reader.ReadUInt32();

                        //Check if is a string
                        if (DataFormat[DFID])
                        {
                            uint StrPos = Value + Header.StringTable;
                            long Pos    = Reader.BaseStream.Position;

                            Reader.Seek(StrPos, SeekOrigin.Begin);
                            Strings.Add(Reader.ReadString(GetStrEnd()));

                            Reader.Seek(Pos, SeekOrigin.Begin);
                        }

                        //Adv Type Pointer
                        DFID++;
                        if (DFID >= DataFormat.Count)
                        {
                            DFID = 0;
                        }
                    }
                }

            return(Strings.ToArray());
        }
Exemple #25
0
        public MmdVector3 vec3Position = new MmdVector3(); // モデル原点からの位置

        public void read(DataReader i_reader)
        {
            this.szName     = i_reader.readAscii(20);
            this.nParentNo  = i_reader.readShort();
            this.nChildNo   = i_reader.readShort();
            this.cbKind     = i_reader.readByte();
            this.unIKTarget = i_reader.readShort();
            StructReader.read(this.vec3Position, i_reader);
            return;
        }
Exemple #26
0
        public void ReadFrom(StructReader reader)
        {
            data = reader.ReadStruct <FTS_IO_ANCHOR_DATA>();

            linkedAnchors = new int[data.nb_linked];
            for (int i = 0; i < data.nb_linked; i++)
            {
                linkedAnchors[i] = reader.ReadInt32();
            }
        }
Exemple #27
0
        public static void ReadStruct <T>(byte[] Array, ref T Struct, bool IsBigEnddian = false, Encoding Encoding = null, long BaseOffset = 0)
        {
            MemoryStream Stream = new MemoryStream(Array);
            StructReader Reader = new StructReader(Stream, IsBigEnddian, Encoding);

            Reader.Seek(BaseOffset, SeekOrigin.Begin);
            Reader.ReadStruct(ref Struct);
            Reader.Close();
            Stream?.Close();
        }
Exemple #28
0
        public int cbEdge;                               // エッジフラグ

        public void read(DataReader i_reader)
        {
            StructReader.read(this.vec3Pos, i_reader);
            StructReader.read(this.vec3Normal, i_reader);
            StructReader.read(this.uvTex, i_reader);
            this.unBoneNo[0] = i_reader.readUnsignedShort();
            this.unBoneNo[1] = i_reader.readUnsignedShort();
            this.cbWeight    = (byte)i_reader.read();
            this.cbEdge      = (byte)i_reader.read();
            return;
        }
Exemple #29
0
        public void LoadFrom(Stream unpackedStream)
        {
            using (StructReader reader = new StructReader(unpackedStream, System.Text.Encoding.ASCII, true))
            {
                header = reader.ReadStruct <DLF_IO_HEADER>();

                scenes = new DLF_IO_SCENE[header.numScenes];
                for (int i = 0; i < header.numScenes; i++)
                {
                    scenes[i] = reader.ReadStruct <DLF_IO_SCENE>();
                }

                inters = new DLF_IO_INTER[header.numInters];
                for (int i = 0; i < header.numInters; i++)
                {
                    inters[i] = reader.ReadStruct <DLF_IO_INTER>();
                }

                if (header.lighting != 0)
                {
                    lightingHeader = reader.ReadStruct <DANAE_IO_LIGHTINGHEADER>();

                    lightColors = new uint[lightingHeader.numLights];
                    for (int i = 0; i < lightingHeader.numLights; i++)
                    {
                        lightColors[i] = reader.ReadUInt32(); //TODO is apparently BGRA if its in compact mode.
                    }
                }

                lights = new DANAE_IO_LIGHT[header.numLights];
                for (int i = 0; i < header.numLights; i++)
                {
                    lights[i] = reader.ReadStruct <DANAE_IO_LIGHT>();
                }

                fogs = new DLF_IO_FOG[header.numFogs];
                for (int i = 0; i < header.numFogs; i++)
                {
                    fogs[i] = reader.ReadStruct <DLF_IO_FOG>();
                }

                // Skip nodes, dont know why
                //save in var so we can write it back later
                nodesData = reader.ReadBytes(header.numNodes * (204 + header.numNodelinks * 64));

                paths = new DLF_IO_PATH[header.numPaths];
                for (int i = 0; i < header.numPaths; i++)
                {
                    var path = new DLF_IO_PATH();
                    path.ReadFrom(reader);
                    paths[i] = path;
                }
            }
        }
Exemple #30
0
 public String szTextureFileName;        // テクスチャファイル名
 public void read(DataReader i_reader)
 {
     StructReader.read(this.col4Diffuse, i_reader);
     this.fShininess = i_reader.readFloat();
     StructReader.read(this.col3Specular, i_reader);
     StructReader.read(this.col3Ambient, i_reader);
     this.unknown           = i_reader.readUnsignedShort();
     this.ulNumIndices      = i_reader.readInt();
     this.szTextureFileName = i_reader.readAscii(20);
     return;
 }