Ejemplo n.º 1
0
        public static void LoadXml(string filename)
        {
            XDocument doc   = XDocument.Load(filename);
            var       root  = doc.Root;
            int       count = int.Parse(root.Attribute("Count").Value);

            Attributes = new NetAttribute[count];

            foreach (var e in root.Elements())
            {
                NetAttribute a = new NetAttribute();
                a.Id = int.Parse(e.Attribute("Id").Value);
                a.U2 = int.Parse(e.Attribute("U2").Value);
                a.U3 = int.Parse(e.Attribute("U3").Value);
                a.U4 = int.Parse(e.Attribute("U4").Value);
                a.U5 = int.Parse(e.Attribute("U5").Value);

                a.ScriptA = e.Attribute("ScriptA").Value;
                a.ScriptB = e.Attribute("ScriptB").Value;
                a.Name    = e.Attribute("Name").Value;

                a.EncodingType = (NetAttributeEncoding)Enum.Parse(typeof(NetAttributeEncoding), e.Attribute("EncodingType").Value);

                a.U10      = (byte)int.Parse(e.Attribute("U10").Value);
                a.Min      = int.Parse(e.Attribute("Min").Value);
                a.Max      = int.Parse(e.Attribute("Max").Value);
                a.BitCount = int.Parse(e.Attribute("BitCount").Value);

                Attributes[a.Id] = a;
            }
        }
Ejemplo n.º 2
0
        public static void LoadXml(string filename)
        {
            XDocument doc = XDocument.Load(filename);
            var root = doc.Root;
            int count = int.Parse(root.Attribute("Count").Value);
            Attributes = new NetAttribute[count];

            foreach (var e in root.Elements())
            {
                NetAttribute a = new NetAttribute();
                a.Id = int.Parse(e.Attribute("Id").Value);
                a.U2 = int.Parse(e.Attribute("U2").Value);
                a.U3 = int.Parse(e.Attribute("U3").Value);
                a.U4 = int.Parse(e.Attribute("U4").Value);
                a.U5 = int.Parse(e.Attribute("U5").Value);

                a.ScriptA = e.Attribute("ScriptA").Value;
                a.ScriptB = e.Attribute("ScriptB").Value;
                a.Name = e.Attribute("Name").Value;

                a.EncodingType = (NetAttributeEncoding)Enum.Parse(typeof(NetAttributeEncoding), e.Attribute("EncodingType").Value);

                a.U10 = (byte)int.Parse(e.Attribute("U10").Value);
                a.Min = int.Parse(e.Attribute("Min").Value);
                a.Max = int.Parse(e.Attribute("Max").Value);
                a.BitCount = int.Parse(e.Attribute("BitCount").Value);

                Attributes[a.Id] = a;
            }
        }