Example #1
0
        public void ParseConfig(string file)
        {
            Common.SendStatus(string.Format("Parsing {0}", file));
            Common.Types.Clear();
            using (var xml = XmlReader.Create(file)) {
                var  dataCheckKey = 0;
                var  dataCheckOk  = false;
                var  skUkey       = 0;
                long size         = 0;
                var  skuWarn      = false;
                var  skuName      = "";
                var  skuWarnMsg   = "";
                var  skuMinVer    = "";
                while (xml.Read())
                {
                    if (!xml.IsStartElement())
                    {
                        continue;
                    }
                    switch (xml.Name.ToLower())
                    {
                    case "type":
                        if (long.TryParse(xml["size"], out size))
                        {
                            if (!Common.Types.ContainsKey(size))
                            {
                                Common.Types.Add(size, new Common.TypeData());
                            }
                            Common.Types[size].Name.Value = xml["name"];
                        }
                        break;

                        #region Statistics part

                    case "stats":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        xml.Read();
                        Common.Types[size].StatDescription.Value = xml.Value;
                        if (!string.IsNullOrEmpty(Common.Types[size].StatDescription.Value))
                        {
                            Common.Types[size].StatDescription.Value  = Common.Types[size].StatDescription.Value.Trim();
                            Common.Types[size].StatDescription.Value += Environment.NewLine;
                            Common.Types[size].StatDescription.Value.Replace("\\n", Environment.NewLine);
                        }
                        break;

                    case "statspart":
                        var key = xml["key"];
                        if (key == null)
                        {
                            break;
                        }
                        if (string.IsNullOrEmpty(key))
                        {
                            key = "*";
                        }
                        key = key.ToUpper();
                        if (!Common.Types[size].Statlist.Value.ContainsKey(key))
                        {
                            double low;
                            double high;
                            var    lowtxt = xml["low"];
                            if (lowtxt != null)
                            {
                                lowtxt = Regex.Replace(lowtxt, @"\s+", "");
                                lowtxt = lowtxt.Replace('.', ',');
                            }
                            var hightxt = xml["high"];
                            if (hightxt != null)
                            {
                                hightxt = Regex.Replace(hightxt, @"\s+", "");
                                hightxt = hightxt.Replace('.', ',');
                            }
                            if (!double.TryParse(lowtxt, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out low))
                            {
                                low = 0;
                            }
                            else if (low < 0 || low > 100)
                            {
                                low = 0;
                            }
                            if (!double.TryParse(hightxt, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out high))
                            {
                                high = 100;
                            }
                            else if (high > 100 || low > high || high < 0)
                            {
                                high = 100;
                            }
                            Common.Types[size].Statlist.Value.Add(key, new Holder <Common.StatCheck>(new Common.StatCheck(low, high)));
                        }
                        break;

                        #endregion Statistics part

                        #region Binary Check Entry

                    case "binentry":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        key = xml["name"];
                        if (String.IsNullOrEmpty(key))
                        {
                            break;
                        }
                        if (!Common.Types[size].Bincheck.Value.ContainsKey(key))
                        {
                            if (xml["ismulti"] != null && xml["ismulti"].Equals("true", StringComparison.CurrentCultureIgnoreCase))
                            {
                                Common.Types[size].Bincheck.Value.Add(key, new Holder <Common.BinCheck>(new Common.BinCheck(new List <Common.MultiBin>(), true, xml["offset"], xml["description"], xml["ascii"])));
                                var id = xml["id"];
                                xml.Read();
                                Common.Types[size].Bincheck.Value[key].Value.ExpectedList.Value.Add(new Common.MultiBin(Regex.Replace(xml.Value, @"\s+", ""), id));
                            }
                            else
                            {
                                var offset      = xml["offset"];
                                var description = xml["description"];
                                var ascii       = xml["ascii"];
                                xml.Read();
                                Common.Types[size].Bincheck.Value.Add(key, new Holder <Common.BinCheck>(new Common.BinCheck(null, false, offset, description, ascii, xml.Value)));
                            }
                        }
                        else if (xml["ismulti"] != null && xml["ismulti"].Equals("true", StringComparison.CurrentCultureIgnoreCase))
                        {
                            var id           = xml["id"];
                            var disablepatch = !string.IsNullOrEmpty(xml["disablepatch"]) && xml["disablepatch"].Equals("true", StringComparison.CurrentCultureIgnoreCase);
                            xml.Read();
                            var explist = Common.Types[size].Bincheck.Value[key].Value;
                            explist.ExpectedList.Value.Add(new Common.MultiBin(Regex.Replace(xml.Value, @"\s+", ""), id, disablepatch));
                        }
                        break;

                        #endregion Binary Check Entry

                        #region Data Check list

                    case "datalist":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var dataCheckList = new Common.DataCheck {
                            Name          = xml["name"],
                            ThresholdList = new Dictionary <string, double>()
                        };
                        if (long.TryParse(xml["offset"], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out dataCheckList.Offset))
                        {
                            dataCheckOk = long.TryParse(xml["size"], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out dataCheckList.Size);
                            if (!dataCheckOk)
                            {
                                dataCheckOk = long.TryParse(xml["ldrsize"], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out dataCheckList.LdrSize);
                            }
                            if (dataCheckOk)
                            {
                                dataCheckKey++;
                                dataCheckList.DataKey = dataCheckKey;
                                Common.Types[size].DataCheckList.Value.Add(dataCheckList);
                            }
                        }
                        break;

                        #region Data treshold

                    case "datatreshold":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        if (!dataCheckOk)
                        {
                            break;
                        }
                        foreach (var entry in Common.Types[size].DataCheckList.Value)
                        {
                            if (entry.DataKey != dataCheckKey)
                            {
                                continue;
                            }
                            var dkey = xml["key"];
                            if (dkey == null)
                            {
                                break;
                            }
                            if (string.IsNullOrEmpty(dkey))
                            {
                                dkey = "*";
                            }
                            dkey = dkey.ToUpper();
                            xml.Read();
                            var tmptxt = xml.Value;
                            if (tmptxt != null)
                            {
                                tmptxt = Regex.Replace(tmptxt, @"\s+", "");
                                tmptxt = tmptxt.Replace('.', ',');
                            }
                            double tmpval;
                            if (!double.TryParse(tmptxt, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out tmpval))
                            {
                                tmpval = 49;
                            }
                            else if (tmpval < 0 || tmpval > 100)
                            {
                                tmpval = 49;
                            }
                            entry.ThresholdList.Add(dkey, tmpval);
                            break;
                        }
                        break;

                        #endregion Data treshold

                        #endregion Data Check List

                        #region SKU Data List

                    case "skudataentry":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var skuDataEntry = new Common.SKUDataEntry();
                        var skuoffset    = xml["offset"];
                        var isok         = (uint.TryParse(skuoffset, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out skuDataEntry.Offset));
                        if (isok)
                        {
                            var skusize = xml["size"];
                            isok = (uint.TryParse(skusize, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out skuDataEntry.Size));
                        }
                        xml.Read();
                        skuDataEntry.Type = xml.Value;
                        if (isok)
                        {
                            Common.Types[size].SKUDataList.Value.Add(skuDataEntry);
                        }
                        break;

                        #endregion SKU Data List

                        #region SKU List

                    case "skulist":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        skUkey++;
                        skuWarn    = xml["warn"] != null && xml["warn"].Equals("true", StringComparison.CurrentCultureIgnoreCase);
                        skuName    = xml["name"];
                        skuWarnMsg = xml["warnmsg"];
                        skuMinVer  = xml["minver"];
                        break;

                    case "skuentry":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var exists = false;
                        foreach (var entry in Common.Types[size].SKUList.Value)
                        {
                            if (entry.SKUKey != skUkey)
                            {
                                continue;
                            }
                            exists = true;
                            break;
                        }
                        var skuEntry = new Common.SKUEntry();
                        if (!exists)
                        {
                            skuEntry.Warn    = skuWarn;
                            skuEntry.WarnMsg = skuWarnMsg;
                        }
                        skuEntry.SKUKey = skUkey;
                        skuEntry.Name   = skuName;
                        skuEntry.Type   = xml["type"];
                        skuEntry.MinVer = skuMinVer;
                        xml.Read();
                        skuEntry.Data = Regex.Replace(xml.Value, @"\s+", "");
                        Common.Types[size].SKUList.Value.Add(skuEntry);
                        break;

                        #endregion SKU List

                        #region RepCheck Entry

                    case "repcheck":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var tmp = new Common.RepCheckData {
                            Name = xml["name"]
                        };
                        if (!int.TryParse(xml["offset"], NumberStyles.HexNumber, null, out tmp.Offset))
                        {
                            break;     // It's broken!
                        }
                        xml.Read();
                        if (!string.IsNullOrEmpty(xml.Value))
                        {
                            var data = Encoding.Unicode.GetString(Common.HexToArray(Regex.Replace(xml.Value, @"\s+", "").ToUpper()));
                            Common.Types[size].RepCheck.Value.Add(data, new Holder <Common.RepCheckData>(tmp));
                        }
                        break;

                        #endregion

                        #region Datamatches Entries

                    case "datamatchid":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var tmpid = xml["id"];
                        if (string.IsNullOrEmpty(tmpid))
                        {
                            break;
                        }
                        if (!Common.Types[size].DataMatchList.Value.ContainsKey(tmpid))
                        {
                            Common.Types[size].DataMatchList.Value.Add(tmpid, new Holder <Common.DataMatchID>(new Common.DataMatchID()));
                        }
                        xml.Read();
                        if (string.IsNullOrEmpty(xml.Value))
                        {
                            break;
                        }
                        Common.Types[size].DataMatchList.Value[tmpid].Value.Name = xml.Value;
                        break;

                    case "datamatch":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var tmpid2 = xml["id"];
                        if (string.IsNullOrEmpty(tmpid2))
                        {
                            break;
                        }
                        if (!Common.Types[size].DataMatchList.Value.ContainsKey(tmpid2))
                        {
                            break;
                        }
                        var tmpmatch = new Common.DataMatch();
                        if (!int.TryParse(xml["offset"], NumberStyles.HexNumber, null, out tmpmatch.Offset))
                        {
                            break;
                        }
                        if (!int.TryParse(xml["length"], NumberStyles.HexNumber, null, out tmpmatch.Length))
                        {
                            break;
                        }
                        if (!int.TryParse(xml["seqrep"], NumberStyles.HexNumber, null, out tmpmatch.SequenceRepetitions))
                        {
                            tmpmatch.SequenceRepetitions = 0;
                        }
                        tmpmatch.DisableDisplay = !string.IsNullOrEmpty(xml["nodisp"]) && xml["nodisp"].Equals("true", StringComparison.CurrentCultureIgnoreCase);                            xml.Read();
                        if (string.IsNullOrEmpty(xml.Value))
                        {
                            break;
                        }
                        tmpmatch.Name = xml.Value;
                        Common.Types[size].DataMatchList.Value[tmpid2].Value.Data.Add(tmpmatch);
                        break;

                        #endregion

                        #region Datafill Entry

                    case "datafill":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        var datafill = new Common.DataFillEntry
                        {
                            Name = xml["name"]
                        };
                        int.TryParse(xml["offset"], NumberStyles.HexNumber, null, out datafill.Offset);
                        int.TryParse(xml["size"], NumberStyles.HexNumber, null, out datafill.Length);
                        int.TryParse(xml["sizefrom"], NumberStyles.HexNumber, null, out datafill.Sizefrom);
                        int.TryParse(xml["ldrsize"], NumberStyles.HexNumber, null, out datafill.LdrSize);
                        int.TryParse(xml["regionsize"], NumberStyles.HexNumber, null, out datafill.RegionSize);
                        int.TryParse(xml["regionstart"], NumberStyles.HexNumber, null, out datafill.RegionStart);
                        int.TryParse(xml["vtrmentrycount_offset"], NumberStyles.HexNumber, null, out datafill.vtrmentrycount_offset);
                        xml.Read();
                        if (!byte.TryParse(xml.Value, NumberStyles.HexNumber, null, out datafill.Data))
                        {
                            break;
                        }
                        Common.Types[size].DataFillEntries.Value.Add(datafill);
                        break;

                        #endregion

                        #region ROS#Offset

                    case "ros0offset":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        xml.Read();
                        if (!int.TryParse(xml.Value, NumberStyles.HexNumber, null, out Common.Types[size].ROS0Offset))
                        {
                            Common.Types[size].ROS0Offset = -1;
                        }
                        break;

                    case "ros1offset":
                        if (!Common.Types.ContainsKey(size))
                        {
                            break;
                        }
                        xml.Read();
                        if (!int.TryParse(xml.Value, NumberStyles.HexNumber, null, out Common.Types[size].ROS1Offset))
                        {
                            Common.Types[size].ROS1Offset = -1;
                        }
                        break;

                        #endregion
                    }
                }
            }
            Common.SendStatus("Parsing done!");
            checkbtn.Enabled = true;
        }
Example #2
0
        public void ParseConfig(string file)
        {
            Common.SendStatus(string.Format("Parsing {0}", file));
            Common.Types.Clear();
            using (var xml = XmlReader.Create(file)) {
                var dataCheckKey = 0;
                var dataCheckOk = false;
                var skUkey = 0;
                long size = 0;
                var skuWarn = false;
                var skuName = "";
                var skuWarnMsg = "";
                var skuMinVer = "";
                while (xml.Read()) {
                    if (!xml.IsStartElement())
                        continue;
                    switch (xml.Name.ToLower()) {
                        case "type":
                            if (long.TryParse(xml["size"], out size)) {
                                if (!Common.Types.ContainsKey(size))
                                    Common.Types.Add(size, new Common.TypeData());
                                Common.Types[size].Name.Value = xml["name"];
                            }
                            break;

                            #region Statistics part

                        case "stats":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            xml.Read();
                            Common.Types[size].StatDescription.Value = xml.Value;
                            if (!string.IsNullOrEmpty(Common.Types[size].StatDescription.Value)) {
                                Common.Types[size].StatDescription.Value = Common.Types[size].StatDescription.Value.Trim();
                                Common.Types[size].StatDescription.Value += Environment.NewLine;
                                Common.Types[size].StatDescription.Value.Replace("\\n", Environment.NewLine);
                            }
                            break;
                        case "statspart":
                            var key = xml["key"];
                            if (key == null)
                                break;
                            if (string.IsNullOrEmpty(key))
                                key = "*";
                            key = key.ToUpper();
                            if (!Common.Types[size].Statlist.Value.ContainsKey(key)) {
                                double low;
                                double high;
                                var lowtxt = xml["low"];
                                if (lowtxt != null) {
                                    lowtxt = Regex.Replace(lowtxt, @"\s+", "");
                                    lowtxt = lowtxt.Replace('.', ',');
                                }
                                var hightxt = xml["high"];
                                if (hightxt != null) {
                                    hightxt = Regex.Replace(hightxt, @"\s+", "");
                                    hightxt = hightxt.Replace('.', ',');
                                }
                                if (!double.TryParse(lowtxt, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out low))
                                    low = 0;
                                else if (low < 0 || low > 100)
                                    low = 0;
                                if (!double.TryParse(hightxt, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out high))
                                    high = 100;
                                else if (high > 100 || low > high || high < 0)
                                    high = 100;
                                Common.Types[size].Statlist.Value.Add(key, new Holder <Common.StatCheck>(new Common.StatCheck(low, high)));
                            }
                            break;

                            #endregion Statistics part

                            #region Binary Check Entry

                        case "binentry":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            key = xml["name"];
                            if (String.IsNullOrEmpty(key))
                                break;
                            if (!Common.Types[size].Bincheck.Value.ContainsKey(key)) {
                                if (xml["ismulti"] != null && xml["ismulti"].Equals("true", StringComparison.CurrentCultureIgnoreCase)) {
                                    Common.Types[size].Bincheck.Value.Add(key, new Holder <Common.BinCheck>(new Common.BinCheck(new List <Common.MultiBin>(), true, xml["offset"], xml["description"], xml["ascii"])));
                                    var id = xml["id"];
                                    xml.Read();
                                    Common.Types[size].Bincheck.Value[key].Value.ExpectedList.Value.Add(new Common.MultiBin(Regex.Replace(xml.Value, @"\s+", ""), id));
                                }
                                else {
                                    var offset = xml["offset"];
                                    var description = xml["description"];
                                    var ascii = xml["ascii"];
                                    xml.Read();
                                    Common.Types[size].Bincheck.Value.Add(key, new Holder <Common.BinCheck>(new Common.BinCheck(null, false, offset, description, ascii, xml.Value)));
                                }
                            }
                            else if (xml["ismulti"] != null && xml["ismulti"].Equals("true", StringComparison.CurrentCultureIgnoreCase)) {
                                var id = xml["id"];
                                var disablepatch = !string.IsNullOrEmpty(xml["disablepatch"]) && xml["disablepatch"].Equals("true", StringComparison.CurrentCultureIgnoreCase);
                                xml.Read();
                                var explist = Common.Types[size].Bincheck.Value[key].Value;
                                explist.ExpectedList.Value.Add(new Common.MultiBin(Regex.Replace(xml.Value, @"\s+", ""), id, disablepatch));
                            }
                            break;

                            #endregion Binary Check Entry

                            #region Data Check list

                        case "datalist":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var dataCheckList = new Common.DataCheck {
                                Name = xml["name"],
                                ThresholdList = new Dictionary <string, double>()
                            };
                            if (long.TryParse(xml["offset"], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out dataCheckList.Offset)) {
                                dataCheckOk = long.TryParse(xml["size"], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out dataCheckList.Size);
                                if (!dataCheckOk)
                                    dataCheckOk = long.TryParse(xml["ldrsize"], NumberStyles.HexNumber, CultureInfo.CurrentCulture, out dataCheckList.LdrSize);
                                if (dataCheckOk) {
                                    dataCheckKey++;
                                    dataCheckList.DataKey = dataCheckKey;
                                    Common.Types[size].DataCheckList.Value.Add(dataCheckList);
                                }
                            }
                            break;

                            #region Data treshold

                        case "datatreshold":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            if (!dataCheckOk)
                                break;
                            foreach (var entry in Common.Types[size].DataCheckList.Value) {
                                if (entry.DataKey != dataCheckKey)
                                    continue;
                                var dkey = xml["key"];
                                if (dkey == null)
                                    break;
                                if (string.IsNullOrEmpty(dkey))
                                    dkey = "*";
                                dkey = dkey.ToUpper();
                                xml.Read();
                                var tmptxt = xml.Value;
                                if (tmptxt != null) {
                                    tmptxt = Regex.Replace(tmptxt, @"\s+", "");
                                    tmptxt = tmptxt.Replace('.', ',');
                                }
                                double tmpval;
                                if (!double.TryParse(tmptxt, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands, CultureInfo.CurrentCulture, out tmpval))
                                    tmpval = 49;
                                else if (tmpval < 0 || tmpval > 100)
                                    tmpval = 49;
                                entry.ThresholdList.Add(dkey, tmpval);
                                break;
                            }
                            break;

                            #endregion Data treshold

                            #endregion Data Check List

                            #region SKU Data List

                        case "skudataentry":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var skuDataEntry = new Common.SKUDataEntry();
                            var skuoffset = xml["offset"];
                            var isok = (uint.TryParse(skuoffset, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out skuDataEntry.Offset));
                            if (isok) {
                                var skusize = xml["size"];
                                isok = (uint.TryParse(skusize, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out skuDataEntry.Size));
                            }
                            xml.Read();
                            skuDataEntry.Type = xml.Value;
                            if (isok)
                                Common.Types[size].SKUDataList.Value.Add(skuDataEntry);
                            break;

                            #endregion SKU Data List

                            #region SKU List

                        case "skulist":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            skUkey++;
                            skuWarn = xml["warn"] != null && xml["warn"].Equals("true", StringComparison.CurrentCultureIgnoreCase);
                            skuName = xml["name"];
                            skuWarnMsg = xml["warnmsg"];
                            skuMinVer = xml["minver"];
                            break;
                        case "skuentry":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var exists = false;
                            foreach (var entry in Common.Types[size].SKUList.Value) {
                                if (entry.SKUKey != skUkey)
                                    continue;
                                exists = true;
                                break;
                            }
                            var skuEntry = new Common.SKUEntry();
                            if (!exists) {
                                skuEntry.Warn = skuWarn;
                                skuEntry.WarnMsg = skuWarnMsg;
                            }
                            skuEntry.SKUKey = skUkey;
                            skuEntry.Name = skuName;
                            skuEntry.Type = xml["type"];
                            skuEntry.MinVer = skuMinVer;
                            xml.Read();
                            skuEntry.Data = Regex.Replace(xml.Value, @"\s+", "");
                            Common.Types[size].SKUList.Value.Add(skuEntry);
                            break;

                            #endregion SKU List

                            #region RepCheck Entry

                        case "repcheck":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var tmp = new Common.RepCheckData {
                                Name = xml["name"]
                            };
                            if (!int.TryParse(xml["offset"], NumberStyles.HexNumber, null, out tmp.Offset))
                                break; // It's broken!
                            xml.Read();
                            if (!string.IsNullOrEmpty(xml.Value)) {
                                var data = Encoding.Unicode.GetString(Common.HexToArray(Regex.Replace(xml.Value, @"\s+", "").ToUpper()));
                                Common.Types[size].RepCheck.Value.Add(data, new Holder <Common.RepCheckData>(tmp));
                            }
                            break;

                            #endregion

                            #region Datamatches Entries

                        case "datamatchid":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var tmpid = xml["id"];
                            if (string.IsNullOrEmpty(tmpid))
                                break;
                            if (!Common.Types[size].DataMatchList.Value.ContainsKey(tmpid))
                                Common.Types[size].DataMatchList.Value.Add(tmpid, new Holder <Common.DataMatchID>(new Common.DataMatchID()));
                            xml.Read();
                            if (string.IsNullOrEmpty(xml.Value))
                                break;
                            Common.Types[size].DataMatchList.Value[tmpid].Value.Name = xml.Value;
                            break;

                        case "datamatch":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var tmpid2 = xml["id"];
                            if (string.IsNullOrEmpty(tmpid2))
                                break;
                            if (!Common.Types[size].DataMatchList.Value.ContainsKey(tmpid2))
                                break;
                            var tmpmatch = new Common.DataMatch();
                            if (!int.TryParse(xml["offset"], NumberStyles.HexNumber, null, out tmpmatch.Offset))
                                break;
                            if (!int.TryParse(xml["length"], NumberStyles.HexNumber, null, out tmpmatch.Length))
                                break;
                            if (!int.TryParse(xml["seqrep"], NumberStyles.HexNumber, null, out tmpmatch.SequenceRepetitions))
                                tmpmatch.SequenceRepetitions = 0;
                            tmpmatch.DisableDisplay = !string.IsNullOrEmpty(xml["nodisp"]) && xml["nodisp"].Equals("true", StringComparison.CurrentCultureIgnoreCase);                            xml.Read();
                            if (string.IsNullOrEmpty(xml.Value))
                                break;
                            tmpmatch.Name = xml.Value;
                            Common.Types[size].DataMatchList.Value[tmpid2].Value.Data.Add(tmpmatch);
                            break;

                            #endregion

                            #region Datafill Entry

                        case "datafill":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            var datafill = new Common.DataFillEntry
                            {
                                Name = xml["name"]
                            };
                            int.TryParse(xml["offset"], NumberStyles.HexNumber, null, out datafill.Offset);
                            int.TryParse(xml["size"], NumberStyles.HexNumber, null, out datafill.Length);
                            int.TryParse(xml["ldrsize"], NumberStyles.HexNumber, null, out datafill.LdrSize);
                            int.TryParse(xml["regionsize"], NumberStyles.HexNumber, null, out datafill.RegionSize);
                            int.TryParse(xml["regionstart"], NumberStyles.HexNumber, null, out datafill.RegionStart);
                            int.TryParse(xml["vtrmentrycount_offset"], NumberStyles.HexNumber, null, out datafill.vtrmentrycount_offset);
                            xml.Read();
                            if (!byte.TryParse(xml.Value, NumberStyles.HexNumber, null, out datafill.Data))
                                break;
                            Common.Types[size].DataFillEntries.Value.Add(datafill);
                            break;

                            #endregion

                            #region ROS#Offset

                        case "ros0offset":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            xml.Read();
                            if (!int.TryParse(xml.Value, NumberStyles.HexNumber, null, out Common.Types[size].ROS0Offset))
                                Common.Types[size].ROS0Offset = -1;
                            break;
                        case "ros1offset":
                            if (!Common.Types.ContainsKey(size))
                                break;
                            xml.Read();
                            if (!int.TryParse(xml.Value, NumberStyles.HexNumber, null, out Common.Types[size].ROS1Offset))
                                Common.Types[size].ROS1Offset = -1;
                            break;

                            #endregion
                    }
                }
            }
            Common.SendStatus("Parsing done!");
            checkbtn.Enabled = true;
        }