public static MvdSection Parse(MvdDocument document, BinaryReader br) { var tag = (MvdTag)br.ReadByte(); MvdSection rt = null; switch (tag) { case MvdTag.NameList: rt = new MvdNameList(); break; case MvdTag.Bone: rt = new MvdBoneData(); break; case MvdTag.Morph: rt = new MvdMorphData(); break; case MvdTag.ModelProperty: rt = new MvdModelPropertyData(); break; case MvdTag.AccessoryProperty: rt = new MvdAccessoryPropertyData(); break; case MvdTag.EffectProperty: rt = new MvdEffectPropertyData(); break; case MvdTag.Camera: rt = new MvdCameraData(); break; case MvdTag.Light: rt = new MvdLightData(); break; case MvdTag.Project: rt = new MvdProjectData(); break; case MvdTag.Eof: return null; } rt.MinorType = br.ReadByte(); rt.RawKey = br.ReadInt32(); rt.RawItemSize = br.ReadInt32(); rt.RawCount = br.ReadInt32(); using (var exr = br.CreateSizedBufferReader()) rt.ReadExtensionRegion(document, exr); rt.Read(document, br); return rt; }
public static MvdSection Parse(MvdDocument document, BinaryReader br) { var tag = (MvdTag)br.ReadByte(); MvdSection rt = null; switch (tag) { case MvdTag.NameList: rt = new MvdNameList(); break; case MvdTag.Bone: rt = new MvdBoneData(); break; case MvdTag.Morph: rt = new MvdMorphData(); break; case MvdTag.ModelProperty: rt = new MvdModelPropertyData(); break; case MvdTag.AccessoryProperty: rt = new MvdAccessoryPropertyData(); break; case MvdTag.EffectProperty: rt = new MvdEffectPropertyData(); break; case MvdTag.Camera: rt = new MvdCameraData(); break; case MvdTag.Light: rt = new MvdLightData(); break; case MvdTag.Project: rt = new MvdProjectData(); break; case MvdTag.Eof: return(null); } rt.MinorType = br.ReadByte(); rt.RawKey = br.ReadInt32(); rt.RawItemSize = br.ReadInt32(); rt.RawCount = br.ReadInt32(); using (var exr = br.CreateSizedBufferReader()) rt.ReadExtensionRegion(document, exr); rt.Read(document, br); return(rt); }