public static CLabtype FromStream(System.IO.BinaryReader br) { CLabtype lab = new CLabtype(); lab.attrVal = br.ReadInt16(); if (lab.attr == Type.Model) { CModType mod = new CModType(); mod.Name = ViewerUtils.ConvertCharArrayToString(br.ReadBytes(30)); lab.Tag = mod; } else if (lab.attr == Type.String) { CStgType stg = new CStgType(); stg.label = ViewerUtils.ConvertCharArrayToString(br.ReadBytes(20)); lab.Tag = stg; } else if (lab.attr == Type.Point) { CPTStype pts = CPTStype.FromStream(br); lab.Tag = pts; } else if (lab.attr == Type.Text) { CTXTtype txt = CTXTtype.FromStream(br); lab.Tag = txt; } return(lab); }
public static CTXTtype FromStream(BinaryReader br) { CTXTtype txt = new CTXTtype(); txt.tx = br.ReadDouble(); txt.ty = br.ReadDouble(); txt.tz = br.ReadDouble(); txt.ts = br.ReadDouble(); txt.tr = br.ReadDouble(); txt.tg = ViewerUtils.ConvertCharArrayToString(br.ReadBytes(60)); return(txt); }
public void ToStream(BinaryWriter bw) { bw.Write(this.attrVal); if (this.attr == Type.Model) { CModType mod = (CModType)this.Tag; bw.Write(ViewerUtils.ConvertStringToByteArray(mod.Name, 30)); } else if (this.attr == Type.String) { CStgType stg = (CStgType)this.Tag; bw.Write(ViewerUtils.ConvertStringToByteArray(stg.label, 20)); } else if (this.attr == Type.Point) { CPTStype pts = (CPTStype)this.Tag; pts.ToStream(bw); } else if (this.attr == Type.Text) { CTXTtype txt = (CTXTtype)this.Tag; txt.ToStream(bw); } }