Esempio n. 1
0
        public void Read(Stream stream)
        {
            var doc = new XmlDocument();

            doc.Load(stream);

            var tables = doc.GetElementsByTagName("T");

            Tables = new OTFTable[tables.Count];

            for (var i = 0; i < tables.Count; i++)
            {
                var table      = tables.Item(i);
                var tableEntry = new OTFTable();
                tableEntry.ID   = int.Parse(table.Attributes["i"].Value);
                tableEntry.Name = table.Attributes["n"].Value;

                var numKeys = table.ChildNodes.Count;
                tableEntry.Keys = new OTFTableKey[numKeys];

                for (var x = 0; x < numKeys; x++)
                {
                    var key      = table.ChildNodes[x];
                    var keyEntry = new OTFTableKey();
                    keyEntry.ID        = int.Parse(key.Attributes["i"].Value);
                    keyEntry.Label     = key.Attributes["l"].Value;
                    keyEntry.Value     = int.Parse(key.Attributes["v"].Value);
                    tableEntry.Keys[x] = keyEntry;
                }
                Tables[i] = tableEntry;
            }
        }
Esempio n. 2
0
        public void Read(Stream stream)
        {
            var doc = new XmlDocument();
            doc.Load(stream);

            var tables = doc.GetElementsByTagName("T");
            Tables = new OTFTable[tables.Count];

            for (var i = 0; i < tables.Count; i++)
            {
                var table = tables.Item(i);
                var tableEntry = new OTFTable();
                tableEntry.ID = int.Parse(table.Attributes["i"].Value);
                tableEntry.Name = table.Attributes["n"].Value;

                var numKeys = table.ChildNodes.Count;
                tableEntry.Keys = new OTFTableKey[numKeys];

                for (var x = 0; x < numKeys; x++)
                {
                    var key = table.ChildNodes[x];
                    var keyEntry = new OTFTableKey();
                    keyEntry.ID = int.Parse(key.Attributes["i"].Value);
                    keyEntry.Label = key.Attributes["l"].Value;
                    keyEntry.Value = int.Parse(key.Attributes["v"].Value);
                    tableEntry.Keys[x] = keyEntry;
                }
                Tables[i] = tableEntry;
            }
        }