public ecConnStateTag(ecTagInt tag) { m_tag = tag; //m_tag_val = (Int32)tag.Value64(); m_tag_val = 0xfff; }
// // Parsing ctor // ecTag ReadTag(BinaryReader br) { ecTag t = null; Int16 tag_name16 = System.Net.IPAddress.NetworkToHostOrder(br.ReadInt16()); bool have_subtags = ((tag_name16 & 1) != 0); ECTagNames tag_name = (ECTagNames)(tag_name16 >> 1); byte tag_type8 = br.ReadByte(); Int32 tag_size32 = System.Net.IPAddress.NetworkToHostOrder(br.ReadInt32()); LinkedList <ecTag> subtags = null; if (have_subtags) { subtags = ReadSubtags(br); } EcTagTypes tag_type = (EcTagTypes)tag_type8; switch (tag_type) { case EcTagTypes.EC_TAGTYPE_UNKNOWN: break; case EcTagTypes.EC_TAGTYPE_CUSTOM: t = new ecTagCustom(tag_name, tag_size32, br, subtags); break; case EcTagTypes.EC_TAGTYPE_UINT8: t = new ecTagInt(tag_name, 1, br, subtags); break; case EcTagTypes.EC_TAGTYPE_UINT16: t = new ecTagInt(tag_name, 2, br, subtags); break; case EcTagTypes.EC_TAGTYPE_UINT32: t = new ecTagInt(tag_name, 4, br, subtags); break; case EcTagTypes.EC_TAGTYPE_UINT64: t = new ecTagInt(tag_name, 8, br, subtags); break; case EcTagTypes.EC_TAGTYPE_STRING: t = new ecTagString(tag_name, tag_size32, br, subtags); break; case EcTagTypes.EC_TAGTYPE_DOUBLE: break; case EcTagTypes.EC_TAGTYPE_IPV4: t = new ecTagIPv4(tag_name, br, subtags); break; case EcTagTypes.EC_TAGTYPE_HASH16: t = new ecTagMD5(tag_name, br, subtags); break; default: break; } if (t == null) { throw new Exception("Unexpected tag type"); } return(t); }