int[] _bitArea; //bit의 시작점이 어디인지를 알려준다. bitItem의 영역이 아니라면 -1이다. //int _bitSize; public BitItemCollection(CPacketItem parent) { _parent = parent; EventEnabled = true; //SetBitSize(byteSizes); //_bitSize = bitSize; }
public CPacketItem(CPacketItem cloneBase, bool copyBitItems) { Init(cloneBase.Name, cloneBase.TypeString, cloneBase.Length, cloneBase.Description, cloneBase.Parent); PassCondition = cloneBase.PassCondition; if (copyBitItems) { foreach (BitItem bItem in cloneBase.BitItems) { _bitItems.Add(bItem.Clone(this)); } } }
public BitItem Clone(CPacketItem parentItem = null) { BitItem clone = new BitItem(parentItem == null? _parent :parentItem); clone.StartOffset = StartOffset; clone.BitSize = BitSize; clone.BitName = BitName; clone.condFunc = condFunc;//.PassCondition = PassCondition; clone.PassCondition = _passCondition; //clone.Visible = Visible; clone.ShowOnReport = ShowOnReport; return(clone); }
/// <summary> /// 같은 이름이 존재하는지 알아본다. 없으면 true를 리턴한다. /// item을 넣는 이유는 이 아이템을 제외하고 검색해야 하기 때문이다. /// </summary> /// <param name="item">이름을 셋팅할 item. null이면 모든 item에서 같은 이름을 찾음..</param> /// <param name="name">setting할 이름</param> /// <returns>같은 이름 없을 시 true리턴.</returns> public bool IsNewName(CPacketItem item, String name) { foreach (CPacketItem citem in this.Items) { if (item != null && citem.Equals(item)) { continue; //같은 item 제외 } if (citem.Name.Equals(name)) { return(false);//같은 이름이 있으므로 newName이 아니다. } } return(true); }
/// <summary> /// value의 string을 Hex로 리턴하고, 그 값이 들어간 int 배열을 리턴한다. /// </summary> /// <param name="cPacketItem"></param> /// <param name="bufferToGetData"></param> /// <param name="values">값이 들어간 value들을 리턴한다.</param> /// <returns></returns> public static string GetValueHex(CPacketItem cPacketItem, Byte[] bufferToGetData, int startOffset, int limitSize, out int[] values, string spliter = ",") { string valueString; int typeSize = Marshal.SizeOf(cPacketItem.RealType); values = new int[cPacketItem.Length]; if (cPacketItem.IsSwap) { valueString = ""; int value; int len = 0; for (int i = 0; i < cPacketItem.Length; i++) { if (i != 0) { valueString += spliter; } int start = cPacketItem.ByteOffset + i * typeSize; int offset = startOffset + start; value = TypeArrayConverter.GetVariableSwapFromBuffer <int>(bufferToGetData, offset, cPacketItem.IsSwap, typeSize, typeSize); values[i] = value; valueString += value.ToString("X" + (typeSize * 2) + ""); } } else { valueString = ""; int value; for (int i = 0; i < cPacketItem.Length; i++) { if (i != 0) { valueString += spliter; } int offset = startOffset + cPacketItem.ByteOffset + i * typeSize; value = TypeArrayConverter.CopyBufferToVariable <int>(bufferToGetData, offset, typeSize, true, cPacketItem.IsSwap); // TypeArrayConverter.GetVariableSwapFromBuffer<int>(bufferToGetData, cPacketItem.ByteOffset + i * typeSize, cPacketItem.IsSwap, typeSize, typeSize); values[i] = value; valueString += value.ToString("X" + (typeSize * 2) + "");; } } return(valueString); }
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); }
/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="trueCondition">true가 될 조건..</param> public BitItem(CPacketItem parent, string trueCondition) { _parent = parent; PassCondition = trueCondition; }
/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="trueCondition">true가 될 조건..</param> public BitItem(CPacketItem parent, int trueCondition) { _parent = parent; PassCondition = trueCondition.ToString(); }
/// <summary> /// default로 true가될 조건은 없다. 무조건 true이다. /// </summary> /// <param name="parent"></param> public BitItem(CPacketItem parent) { _parent = parent; PassCondition = ""; }