public void Write(MvdDocument document, BinaryWriter bw) { bw.WriteSizedBuffer(document.Encoding.GetBytes(this.ObjectName)); bw.WriteSizedBuffer(document.Encoding.GetBytes(this.EnglishObjectName)); bw.Write(this.KeyFps); bw.WriteSizedBuffer(new byte[0]); foreach (var i in this.Sections) i.Write(document, bw); bw.Write((byte)MvdTag.Eof); bw.Write((byte)0); }
public void Write(BinaryWriter bw, PmxDocument doc) { bw.WriteSizedBuffer(doc.Header.Encoding.GetBytes(this.Name)); bw.WriteSizedBuffer(doc.Header.Encoding.GetBytes(this.EnglishName)); this.Diffuse.ForEach(bw.Write); this.Specular.ForEach(bw.Write); bw.Write(this.Power); this.Ambient.ForEach(bw.Write); bw.Write((byte)this.Options); this.EdgeColor.ForEach(bw.Write); bw.Write(this.EdgeSize); doc.WriteIndex(bw, PmxIndexKind.Texture, this.MainTexture); doc.WriteIndex(bw, PmxIndexKind.Texture, this.SubTexture); bw.Write((byte)this.SubTextureMode); bw.Write(this.UseSharedToonTexture); if (this.UseSharedToonTexture) bw.Write((byte)this.ToonTexture); else doc.WriteIndex(bw, PmxIndexKind.Texture, this.ToonTexture); bw.WriteSizedBuffer(doc.Header.Encoding.GetBytes(this.Comment)); bw.Write(this.IndexCount); }
internal void WriteString(BinaryWriter bw, string value) { bw.WriteSizedBuffer(this.Header.Encoding.GetBytes(value)); }
public void Write(Stream stream) { // leave open var bw = new BinaryWriter(stream); var buf = new byte[30]; Encoding.GetEncoding(932).GetBytes(DisplayName, 0, DisplayName.Length, buf, 0); bw.Write(buf); bw.Write(this.Version); bw.Write((byte)(this.Encoding.CodePage == Encoding.Unicode.CodePage ? 0 : 1)); bw.WriteSizedBuffer(this.Encoding.GetBytes(this.ObjectName)); bw.WriteSizedBuffer(this.Encoding.GetBytes(this.ObjectName)); bw.Write(this.KeyFps); bw.WriteSizedBuffer(new byte[0]); foreach (var i in this.Sections) i.Write(this, bw); bw.Write((byte)MvdTag.Eof); bw.Write((byte)0); }
public virtual void Write(MvdDocument document, BinaryWriter bw) { bw.Write((byte)this.Tag); bw.Write(this.MinorType); bw.Write(this.RawKey); bw.Write(this.RawItemSize); bw.Write(this.RawCount); using (var ms = new MemoryStream()) { using (var exw = new BinaryWriter(ms)) WriteExtensionRegion(document, exw); bw.WriteSizedBuffer(ms.ToArray()); } }