public CPacketItem(CPacketStruct parent = null) { Init("Undefined", "uchar", 1, "", parent); _parent = parent; _bitItems = new BitItemCollection(this); this.Length = 1; InitValues = new String[] { "0" }; }
/// <summary> /// 배열타입이지만 size를 우선하여 크기지정. values 안의 내용이 적으면 0으로 채움.. /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <param name="size"></param> /// <param name="values"></param> /// <param name="parent"></param> /// <param name="comment"></param> public CPacketItem(String name, String type, int size, String[] values, CPacketStruct parent = null, string comment = "") { string[] initValueClone = new string[size]; values.CopyTo(initValueClone, 0); Init(name, type, size, comment, parent); this.InitValues = initValueClone; // = values.Clone(); }
public CPacketStruct Clone() { CPacketStruct clone = new CPacketStruct(new byte[this.PacketBuffer.Length]); foreach (CPacketItem item in Items) { clone.Items.Add(item.Clone()); } return(clone); }
/// <summary> /// 배열타입. initString으로 모든 배열의내용을 채움. /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <param name="initString"></param> /// <param name="parent"></param> /// <param name="comment"></param> public CPacketItem(String name, String type, int size, String initString, CPacketStruct parent, string comment = "") { Init(name, type, size, comment, parent); string[] initValueClone = new string[size]; this.InitValues = initValueClone; // = values.Clone(); for (int i = 0; i < size; i++) { this.InitValues[i] = initString; } }
void Init(String name, String type, int length, string comment, CPacketStruct parent) { this._parent = parent; this._nameStr = name; if (length == 0) { throw new Exception("CPacketItem:: it's length cannot be 0!!"); } //_size = length; _bitItems = new BitItemCollection(this); SetType(type, true); Length = length; //this.TypeString = type; _comment = comment; }
public CPacketItem Clone(CPacketStruct parent = null) { CPacketItem clone = new CPacketItem((parent == null)?_parent : parent); clone.Init(_nameStr, _typeString, Length, _comment, _parent); clone._byteOffset = _byteOffset; //clone._initValueArray = _initValueArray; //clone._initValues = _initValues; clone._isSelected = _isSelected; clone._selectedCells = new List <int>(); //clone.ShowOnReport = ShowOnReport; clone._showOnReport = _showOnReport; clone.BitItems.EventEnabled = false; clone.InitString = InitString; clone.PassCondition = PassCondition; foreach (BitItem item in _bitItems) { BitItem bitClone = item.Clone(); clone._bitItems.Insert(bitClone); } clone.BitItems.EventEnabled = true; return(clone); }
internal void SetParent(CPacketStruct parent) { _parent = parent; }
/// <summary> /// 배열 타입 Item /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <param name="length"></param> /// <param name="func"></param> /// <param name="parent"></param> /// <param name="comment"></param> public CPacketItem(String name, String type, int length, FunctionInfo func, CPacketStruct parent, string comment = "") { Init(name, type, length, comment, parent); this.Function = func; }
/// <summary> /// 단일 type의 Item. /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <param name="initString"></param> /// <param name="parent"></param> /// <param name="comment"></param> public CPacketItem(String name, String type, String initString, CPacketStruct parent, string comment = "") { Init(name, type, 1, comment, parent); this.InitString = initString; }
internal PacketItemCollection(CPacketStruct parent) { _parent = parent; _totalSize = 0; }