static public int getBuiltInTypeByteCount(BuiltInDataType builtInType) { if (builtInType == BuiltInDataType.AnsiChar8 || builtInType == BuiltInDataType.Int8 || builtInType == BuiltInDataType.Uint8) { return(1); } else if (builtInType == BuiltInDataType.Int16 || builtInType == BuiltInDataType.Uint16) { return(2); } else if (builtInType == BuiltInDataType.Int32 || builtInType == BuiltInDataType.Uint32 || builtInType == BuiltInDataType.Float) { return(4); } else if (builtInType == BuiltInDataType.Int64 || builtInType == BuiltInDataType.Uint64 || builtInType == BuiltInDataType.Double) { return(8); } return(-1); // 가변 길이!! }
private void constructDocumentTree(XmlNode xmlNode, ref TreeNode currTreeNode) { if (xmlNode != null) { for (int i = 0; i < xmlNode.ChildNodes.Count; ++i) { XmlNode childNode = xmlNode.ChildNodes[i]; if (childNode.Attributes.Count == 0) { MessageBox.Show("속성이 없는 노드입니다. xml 파일을 확인해 주세요", "Document 파싱 실패"); continue; } TreeNode newChildNode = currTreeNode.appendChild(new NodeData()); for (int j = 0; j < childNode.Attributes.Count; ++j) { XmlNode currAttr = childNode.Attributes[j]; if (currAttr.Name == "Name") { newChildNode.Data.Name = currAttr.Value; } else if (currAttr.Name == "Type") { BuiltInDataType builtInType = HexViewDataType.stringToBuiltInDataType(currAttr.Value); if (builtInType == BuiltInDataType.Wrapper) { HexViewDataType found = findDataType(currAttr.Value); newChildNode.Data.Type = found; } else { newChildNode.Data.Type = new HexViewDataType(builtInType); } } else if (currAttr.Name == "Content") { newChildNode.Data.Tip = currAttr.Value; } } constructDocumentTree(childNode, ref newChildNode); } } }
public Method(AccessModifier accessModifier, KeyWord singleKeyWord, BuiltInDataType builtInDataType, string name) : base(builtInDataType, name) { this.AccessModifier = accessModifier; this.KeyWords.Add(singleKeyWord); }
public Method(BuiltInDataType builtInDataType, string name) : base(builtInDataType, name) { }
public Property(BuiltInDataType builtInDataType, string name) : base(builtInDataType, name) { }
public BaseElement(BuiltInDataType builtInDataType, string name) { this.BuiltInDataType = builtInDataType; this.Name = name; }
public HexViewDataType(BuiltInDataType builtInDataType) { Name = builtInDataType.ToString(); ByteCount = HexViewDataType.getBuiltInTypeByteCount(builtInDataType); }
private bool constructDataTypeInternal(ref HexViewDataType currDataType, XmlNode xmlNode) { XmlNode attrName = xmlNode.Attributes.GetNamedItem("Name"); if (attrName != null) { currDataType.Alias = attrName.Value; } XmlNode attrType = xmlNode.Attributes.GetNamedItem("Type"); if (attrType != null) { BuiltInDataType builtInType = HexViewDataType.stringToBuiltInDataType(attrType.Value); if (builtInType == BuiltInDataType.Wrapper) { HexViewDataType found = findDataType(attrType.Value); if (found == null) { MessageBox.Show("해당 데이터 타입이 선언되지 않았습니다. 선언 순서를 지켰습니까?", "사용자 정의 자료형 파싱 실패"); return(false); } else { currDataType.Name = found.Name; currDataType.Children = found.Children; currDataType.ByteCount = found.ByteCount; } } else { currDataType.Name = builtInType.ToString(); currDataType.ByteCount = HexViewDataType.getBuiltInTypeByteCount(builtInType); } } // 자식이 있는 경우 자식의 ByteCount 를 누적한 게 내 ByteCount 가 된다! if (currDataType.Children != null) { foreach (HexViewDataType childNode in currDataType.Children) { currDataType.ByteCount += childNode.ByteCount; } } XmlNode attrContent = xmlNode.Attributes.GetNamedItem("Content"); if (attrContent != null) { currDataType.Content = attrContent.Value; } XmlNode attrFormat = xmlNode.Attributes.GetNamedItem("Format"); if (attrFormat != null) { currDataType.Format = attrFormat.Value; } return(true); }
public bool isBuiltInDataType() { BuiltInDataType result = stringToBuiltInDataType(Name); return(result != BuiltInDataType.Wrapper); }
public Parameter(BuiltInDataType builtInDataType, string name) { this.BuiltInDataType = builtInDataType; this.Name = name; }
public Field(BuiltInDataType builtInDataType, string name) : base(builtInDataType, name) { }