protected void FireValueDescChangedEvent(VdfValueDesc valDesc) { if (VdfBox != null) { VdfBox.FireValueDescriptionChangedEvent(valDesc); } }
public void FireValueDescriptionChangedEvent(VdfValueDesc valDesc) { ValueDescriptionChangedEventArgs e = new ValueDescriptionChangedEventArgs(); e.ValueDesc = valDesc; OnValueDescriptionChanged?.Invoke(e); }
public static void Load(XmlNode valueDescNode, Dictionary <string, VdfValueDesc> valueDescTable) { VdfAsciiValueDesc valueDesc = VdfValueDesc.Load <VdfAsciiValueDesc>(valueDescNode, valueDescTable); if (valueDesc == null) { return; } valueDescTable.Add(valueDesc.Name, valueDesc); }
public static void Load(XmlNode valueDescNode, Dictionary <string, VdfValueDesc> valueDescTable) { VdfBcdValueDesc valueDesc = VdfValueDesc.Load <VdfBcdValueDesc>(valueDescNode, valueDescTable); if (valueDesc == null) { return; } valueDescTable.Add(valueDesc.Name, valueDesc); int ival; if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.FactorAttrName, out ival)) { valueDesc.Factor = ival; } if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.OffsetAttrName, out ival)) { valueDesc.Offset = ival; } bool bval; if (XmlUtils.TryGetBoolAttrValue(valueDescNode, VdfTag.FillAttrName, out bval)) { valueDesc.Fill = bval; } if (XmlUtils.TryGetBoolAttrValue(valueDescNode, VdfTag.CanFillAlphaAttrName, out bval)) { valueDesc.CanFillAlpha = bval; } if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.MaximumAttrName, out ival)) { valueDesc.Maximum = ival; } if (XmlUtils.TryGetIntAttrValue(valueDescNode, VdfTag.MinimumAttrName, out ival)) { valueDesc.Minimum = ival; } if (XmlUtils.TryGetStringAttrValue(valueDescNode, VdfTag.SeparatorAttrName, out string sval)) { valueDesc.Separator = sval; } }
public static void Load(XmlNode valueDescNode, Dictionary <string, VdfValueDesc> valueDescTable) { VdfXncodeValueDesc xncodeValueDesc = VdfValueDesc.Load <VdfXncodeValueDesc>(valueDescNode, valueDescTable); if (xncodeValueDesc == null) { return; } valueDescTable.Add(xncodeValueDesc.Name, xncodeValueDesc); xncodeValueDesc.EntryTable = new Dictionary <int, string>(); //解析所有Entry var entryNodes = valueDescNode.SelectNodes(VdfTag.EntryElemName); foreach (XmlNode entryNode in entryNodes) { // 获取值 int value; if (!XmlUtils.TryGetIntAttrValue(entryNode, VdfTag.ValueAttrName, out value)) //首先尝试10进制解析 { // 失败时候使用十六进制解析 if (!XmlUtils.TryGetHexIntAttrValue(entryNode, VdfTag.ValueAttrName, out value)) { continue; } } // 获取描述 string desc; if (!XmlUtils.TryGetStringAttrValue(entryNode, VdfTag.DescriptionAttrName, out desc)) { continue; } try { xncodeValueDesc.EntryTable.Add(value, desc); } catch (Exception) { throw new VdfException(string.Format("Value Description [{0}] already exist " + "[Decimal:{1}, Hex:0x{1:X}] key", xncodeValueDesc.Name, value)); } } }
private static void LoadValueDesc(XmlNode valueDescNode, Dictionary <string, VdfValueDesc> valueDescTable) { string type = null; if (valueDescNode.Attributes[VdfTag.TypeAttrName] != null) { type = valueDescNode.Attributes[VdfTag.TypeAttrName].Value; } if (string.IsNullOrEmpty(type)) { throw new VdfException(string.Format("{0} Element Missing {1} Attribute", VdfTag.ValueDescElemName, VdfTag.TypeAttrName)); } VdfValueDesc.Load(type, valueDescNode, valueDescTable); }
public static void Load(XmlNode valueDescNode, Dictionary <string, VdfValueDesc> valueDescTable) { VdfPhyValueDesc valueDesc = VdfValueDesc.Load <VdfPhyValueDesc>(valueDescNode, valueDescTable); if (valueDesc == null) { return; } double dval; if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.FactorAttrName, out dval)) { valueDesc.Factor = dval; } if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.OffsetAttrName, out dval)) { valueDesc.Offset = dval; } if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.MaximumAttrName, out dval)) { valueDesc.Maximum = dval; } if (XmlUtils.TryGetDoubleAttrValue(valueDescNode, VdfTag.MinimumAttrName, out dval)) { valueDesc.Minimum = dval; } string sval; if (XmlUtils.TryGetStringAttrValue(valueDescNode, VdfTag.UnitAttrName, out sval)) { valueDesc.Unit = sval; } valueDescTable.Add(valueDesc.Name, valueDesc); }
public void RemoveValueDescription(VdfValueDesc valDesc) { RemoveValueDescription(valDesc.Name); }