示例#1
0
文件: Utils.cs 项目: shtspk/raskroy
        public void Read(out CutInfoDescription cid)
        {
            bool exists;

            Read(out exists);
            if (!exists)
            {
                cid = null;
                return;
            }
            DataType dataType;

            Read(out dataType);
            switch (dataType)
            {
            case DataType.c_CutInfoDescription:
                cid = new CutInfoDescription();
                break;

            case DataType.c_GrooveDescription:
                cid = new GrooveDescription();
                break;

            case DataType.c_SingleGroove:
                cid = new SingleGroove();
                break;

            case DataType.c_DistancedGroove:
                cid = new DistancedGroove();
                break;

            case DataType.c_FilledGroove:
                cid = new FilledGroove();
                break;

            case DataType.c_CutOutDescription:
                cid = new CutOutDescription();
                break;

            case DataType.c_SinglePartArrayDescription:
                cid = new SinglePartArrayDescription();
                break;

            case DataType.c_AngularCutDescription:
                cid = new AngularCutDescription();
                break;

            default:
                throw new ApplicationException("Unknown CutInfoDescription");
            }
            cid.Read(this);
        }
示例#2
0
文件: Utils.cs 项目: shtspk/raskroy
 public void Write(CutInfoDescription cid)
 {
     if (cid == null)
     {
         Write(false);
         return;
     }
     Write(true);
     if (cid is GrooveDescription)
     {
         Write(DataType.c_GrooveDescription);
     }
     else if (cid is SingleGroove)
     {
         Write(DataType.c_SingleGroove);
     }
     else if (cid is DistancedGroove)
     {
         Write(DataType.c_DistancedGroove);
     }
     else if (cid is FilledGroove)
     {
         Write(DataType.c_FilledGroove);
     }
     else if (cid is CutOutDescription)
     {
         Write(DataType.c_CutOutDescription);
     }
     else if (cid is SinglePartArrayDescription)
     {
         Write(DataType.c_SinglePartArrayDescription);
     }
     else if (cid is AngularCutDescription)
     {
         Write(DataType.c_AngularCutDescription);
     }
     else if (cid is CutInfoDescription)
     {
         Write(DataType.c_CutInfoDescription);
     }
     cid.Write(this);
 }