Exemple #1
0
        private static Dictionary <string, ItemPropData> ReadFlaggedPropertyList(string path)
        {
            Dictionary <string, ItemPropData> flaggedProperties = new Dictionary <string, ItemPropData>();

            using (StreamReader sr = new StreamReader(File.OpenRead(path)))
            {
                Regex reg = new Regex(@"(?<propName>\w+)\s+(?<comparer>\W+)\s+(?<value>[-]*\d+)");

                while (!sr.EndOfStream)
                {
                    string currentLine = sr.ReadLine().Trim();

                    Match match = reg.Match(currentLine);
                    if (match.Success)
                    {
                        ItemPropData newPropData = new ItemPropData();
                        newPropData.PropertyName     = match.Groups["propName"].Value;
                        newPropData.ComparisonString = match.Groups["comparer"].Value;
                        newPropData.Value            = int.Parse(match.Groups["value"].Value);
                        flaggedProperties.Add(newPropData.PropertyName, newPropData);
                    }
                }
            }

            return(flaggedProperties);
        }
        private static Dictionary<string, ItemPropData> ReadFlaggedPropertyList(string path)
        {
            Dictionary<string, ItemPropData> flaggedProperties = new Dictionary<string, ItemPropData>();

            using (StreamReader sr = new StreamReader(File.OpenRead(path)))
            {
                Regex reg = new Regex(@"(?<propName>\w+)\s+(?<comparer>\W+)\s+(?<value>[-]*\d+)");

                while (!sr.EndOfStream)
                {
                    string currentLine = sr.ReadLine().Trim();

                    Match match = reg.Match(currentLine);
                    if (match.Success)
                    {
                        ItemPropData newPropData = new ItemPropData();
                        newPropData.PropertyName = match.Groups["propName"].Value;
                        newPropData.ComparisonString = match.Groups["comparer"].Value;
                        newPropData.Value = int.Parse(match.Groups["value"].Value);
                        flaggedProperties.Add(newPropData.PropertyName, newPropData);
                    }
                }
            }

            return flaggedProperties;
        }