コード例 #1
0
        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);
        }
コード例 #2
0
 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);
     }
 }