Ejemplo n.º 1
0
        public void WriteToStream(Stream stream)
        {
            if (Entries == null)
                return;

            Count = Entries.Length;

            BinaryWriter bw = new BinaryWriter(stream);
            bw.Write(MagicNumber);
            bw.WriteBig(Count);
            bw.Write(0L);

            if (Count < 1)
                return;

            for (int i = 0; i < Count; i++)
            {
                WpdEntry entry = Entries[i];

                byte[] bytes = Encoding.ASCII.GetBytes(entry.NameWithoutExtension);
                Array.Resize(ref bytes, 16);
                bw.Write(bytes, 0, bytes.Length);

                bw.WriteBig(entry.Offset);
                bw.WriteBig(entry.Length);

                bytes = Encoding.ASCII.GetBytes(entry.Extension);
                Array.Resize(ref bytes, 8);
                bw.Write(bytes, 0, bytes.Length);
            }
        }
Ejemplo n.º 2
0
 public void WriteToStream(Stream stream)
 {
     BinaryWriter bw = new BinaryWriter(stream);
     bw.WriteBig(Unknown1);
     bw.WriteBig(Unknown2);
     bw.WriteBig(Unknown3);
     bw.WriteBig(Unknown4);
 }
Ejemplo n.º 3
0
 public void WriteToStream(Stream stream)
 {
     BinaryWriter bw = new BinaryWriter(stream);
     bw.WriteBig(PackageNameOffset);
     bw.WriteBig(Length);
     bw.WriteBig(Dummy);
     bw.WriteBig(Offset);
 }
Ejemplo n.º 4
0
 public void WriteToStream(Stream stream)
 {
     BinaryWriter bw = new BinaryWriter(stream);
     bw.Write(Magic);
     bw.Write((int)Type);
     bw.WriteBig(Version);
     bw.WriteBig(Unknown2);
     bw.WriteBig(SectionLength);
     stream.Write(Junk, 0, Junk.Length);
 }
Ejemplo n.º 5
0
 public void WriteToStream(Stream stream)
 {
     BinaryWriter bw = new BinaryWriter(stream);
     bw.WriteBig(Magic);
     bw.Write(Unknown1);
     bw.Write(Unknown2);
     bw.Write((byte)Format);
     bw.Write(MipMapCount);
     bw.Write(Unknown3);
     bw.Write((byte)(IsCubeMap ? 1 : 0));
     bw.WriteBig(Width);
     bw.WriteBig(Height);
     bw.WriteBig(Depth);
     bw.WriteBig(LinerSize);
     bw.WriteBig(DataOffset);
 }
Ejemplo n.º 6
0
        public void Save(string fileName)
        {
            FileStream fs = File.Create(fileName);
            BinaryWriter bw = new BinaryWriter(fs);

            const int FONT_INFO_VERSION = 42;
            //const int FONT_INFO_MAGIC = (FONT_INFO_VERSION | ('i' << 24) | ('d' << 16) | ('f' << 8));

            ASCIIEncoding asen = new ASCIIEncoding();
            byte[] ascii = asen.GetBytes("idf1");
            ascii[3] = FONT_INFO_VERSION;
            bw.Write(ascii);

            bw.WriteBig(pointSize);
            bw.WriteBig(ascender);
            bw.WriteBig(descender);

            short numGlyphs = (short)glyphs.Count();
            bw.WriteBig(numGlyphs);

            foreach (var glyph in glyphs)
            {
                bw.Write(glyph.width);
                bw.Write(glyph.height);
                bw.Write(glyph.top);
                bw.Write(glyph.left);
                bw.Write(glyph.xSkip);
                byte padding = 0;
                bw.Write(padding);
                bw.Write(glyph.s);
                bw.Write(glyph.t);
            }

            foreach (var glyph in glyphs)
            {
                bw.Write(glyph.id);
            }

            bw.Close();
            fs.Close();
        }
Ejemplo n.º 7
0
        public void WriteToStream(Stream stream)
        {
            BinaryWriter bw = new BinaryWriter(stream);

            bw.Write(Type);
            bw.Write(Index);
            bw.Write(AssociatedIndex);
            bw.Write(Unknown);

            for (int i = 0; i < TransformationMatrix.Length; i++)
                bw.WriteBig(TransformationMatrix[i]);

            YkdOffsets.WriteToStream(stream, ref Offsets, ref Entries, b => b.CalcSize());
            stream.WriteContent(Entries);

            if (ZeroTail != null)
                stream.WriteContent(ZeroTail);
            else if (Tails4 != null)
                stream.WriteContent(Tails4);
            else if (Tail56 != null)
                for (int i = 0; i < Tail56.Length; i++)
                    bw.Write(Tail56[i]);
        }
Ejemplo n.º 8
0
        public unsafe void WriteToStream(Stream output)
        {
            BinaryWriter bw = new BinaryWriter(output);
            bw.WriteBig(BlockSize);

            if (BlockSize > 0)
                throw new NotImplementedException();
        }
Ejemplo n.º 9
0
 public void WriteToStream(Stream stream)
 {
     BinaryWriter bw = new BinaryWriter(stream);
     bw.WriteBig(Offset);
     bw.WriteBig(Length);
 }