5 namespace HKI.Core.Variables
18 public override void Save(XmlNode parentNode)
20 XmlNode node = parentNode.OwnerDocument.CreateElement(name.Replace(
" ",
""));
21 parentNode.AppendChild(node);
23 XmlAttribute valueWidthAttribute = parentNode.OwnerDocument.CreateAttribute(
"ValueWidth");
24 valueWidthAttribute.Value = Value.Width.ToString();
25 node.Attributes.Append(valueWidthAttribute);
27 XmlAttribute valueHeightAttribute = parentNode.OwnerDocument.CreateAttribute(
"ValueHeight");
28 valueHeightAttribute.Value = Value.Height.ToString();
29 node.Attributes.Append(valueHeightAttribute);
32 public override void Load(XmlNode node)
34 if (node.Attributes == null)
36 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because this XmlNode has not attributes!");
40 XmlAttribute valueWidthAttribute = node.Attributes[
"ValueWidth"];
41 if (valueWidthAttribute == null)
43 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because this XmlNode has not an attribute with the name >ValueWidth<!");
47 XmlAttribute valueHeightAttribute = node.Attributes[
"ValueHeight"];
48 if (valueHeightAttribute == null)
50 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because this XmlNode has not an attribute with the name >ValueHeight<!");
55 if (!
int.TryParse(valueWidthAttribute.Value, out parsedWidthValue))
56 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because parsing of >" + valueWidthAttribute.Value +
"< failed!");
58 int parsedHeightValue;
59 if (!
int.TryParse(valueHeightAttribute.Value, out parsedHeightValue))
60 Debug.LogError(
"(FloatWidthHeight) >" + name +
"< Loading failed because parsing of >" + valueHeightAttribute.Value +
"< failed!");
62 SetValue =
new IntWidthHeight { Width = parsedWidthValue, Height = parsedHeightValue };
This is a data type that combines a int width and a int height value into one value. This can be used for storing resolution information.
override void Load(XmlNode node)
override void Save(XmlNode parentNode)
This class adds a generic implementation to HKIVar. This reduces the repetitive implementation of thi...
Implementation of a IntegerWidthHeight value as a HKIVar via HKIVarGeneric.