static Exclusions() { string folder = Path.GetDirectoryName(typeof(Exclusions).Assembly.Location); string exclusionsList = Path.Combine(folder, ExclusionsList); ExcludedResources = new List<MatchRK>(); if (!File.Exists(exclusionsList)) return; using (TextReader tr = new StreamReader(exclusionsList)) { string line = null; while ((line = tr.ReadLine()) != null) { string[] split = line.Split(new char[] { '#', ';', }, 2); if (split[0].Length == 0) continue; line = split[0]; split = line.Split(new char[] { ',', }, 4); if (split.Length != 4) continue; MatchRK mrk = new MatchRK(); uint tg = 0; ulong i = 0; if (split[0].Trim() == "*") mrk.ResourceType = null; else { if (!split[0].Trim().ToLower().StartsWith("0x") || !uint.TryParse(split[0].Trim().Substring(2), System.Globalization.NumberStyles.HexNumber, null, out tg)) continue; mrk.ResourceType = tg; } if (split[1].Trim() == "*") mrk.ResourceGroup = null; else { if (!split[1].Trim().ToLower().StartsWith("0x") || !uint.TryParse(split[1].Trim().Substring(2), System.Globalization.NumberStyles.HexNumber, null, out tg)) continue; mrk.ResourceGroup = tg; } if (split[2] == "*") mrk.Instance = null; else { if (!split[2].Trim().ToLower().StartsWith("0x") || !ulong.TryParse(split[2].Trim().Substring(2), System.Globalization.NumberStyles.HexNumber, null, out i)) continue; mrk.Instance = i; } ExcludedResources.Add(mrk); } tr.Close(); } }
static Exclusions() { string folder = Path.GetDirectoryName(typeof(Exclusions).Assembly.Location); string exclusionsList = Path.Combine(folder, ExclusionsList); ExcludedResources = new List <MatchRK>(); if (!File.Exists(exclusionsList)) { return; } using (TextReader tr = new StreamReader(exclusionsList)) { string line = null; while ((line = tr.ReadLine()) != null) { string[] split = line.Split(new char[] { '#', ';', }, 2); if (split[0].Length == 0) { continue; } line = split[0]; split = line.Split(new char[] { ',', }, 4); if (split.Length != 4) { continue; } MatchRK mrk = new MatchRK(); uint tg = 0; ulong i = 0; if (split[0].Trim() == "*") { mrk.ResourceType = null; } else { if (!split[0].Trim().ToLower().StartsWith("0x") || !uint.TryParse(split[0].Trim().Substring(2), System.Globalization.NumberStyles.HexNumber, null, out tg)) { continue; } mrk.ResourceType = tg; } if (split[1].Trim() == "*") { mrk.ResourceGroup = null; } else { if (!split[1].Trim().ToLower().StartsWith("0x") || !uint.TryParse(split[1].Trim().Substring(2), System.Globalization.NumberStyles.HexNumber, null, out tg)) { continue; } mrk.ResourceGroup = tg; } if (split[2] == "*") { mrk.Instance = null; } else { if (!split[2].Trim().ToLower().StartsWith("0x") || !ulong.TryParse(split[2].Trim().Substring(2), System.Globalization.NumberStyles.HexNumber, null, out i)) { continue; } mrk.Instance = i; } ExcludedResources.Add(mrk); } tr.Close(); } }