/// <summary> /// 给族添加comtype信息 /// </summary> /// <param name="fi"></param> /// <param name="type"></param> /// <param name="isCheck">对添加是否成功的检查的标志位,默认不检查,并返回true</param> /// <returns></returns> public static bool WriteParm(this Element fi, PmComTypeEnum type, bool isCheck = false) { if (fi == null || !fi.IsValidObject) { return(false); } MepDevParm parm = new MepDevParm() { comtype = 0 }; parm.comtype = (int)type; parm.WriteTo(fi); if (isCheck) { MepDevParm checkParm = new MepDevParm() { comtype = 0 }; checkParm.ReadFrom(fi); return(checkParm.comtype == (int)type ? true : false); } return(true); }
/// <summary> /// 获取element的comtype /// </summary> /// <param name="fi"></param> /// <returns></returns> public static int ReadRarm(this Element fi) { MepDevParm parm = new MepDevParm() { comtype = 0 }; parm.ReadFrom(fi); return(parm.comtype); }
/// <summary> /// 检测element的comtype /// </summary> /// <param name="fi"></param> /// <param name="type"></param> /// <returns></returns> public static bool CheckTypeParam(this Element fi, int type) { MepDevParm parm = new MepDevParm() { comtype = 0 }; parm.ReadFrom(fi); return(parm.comtype == (int)type ? true : false); }