Parse() public method

Parses the reg file for reg keys and reg values
public Parse ( string content ) : Dictionary>
content string
return Dictionary>
Beispiel #1
0
        static public RegValue[] ImportFrom(string regFile)
        {
            var result = new List <RegValue>();

            string content = System.IO.File.ReadAllText(regFile);

            var parser = new RegParser();

            char[] delimiter = new[] { '\\' };

            foreach (KeyValuePair <string, Dictionary <string, string> > entry in parser.Parse(content))
            {
                foreach (KeyValuePair <string, string> item in entry.Value)
                {
                    string path = entry.Key;

                    var regval = new RegValue();
                    regval.Root  = GetHive(path);
                    regval.Key   = path.Split(delimiter, 2).Last();
                    regval.Name  = item.Key;
                    regval.Value = Deserialize(item.Value, parser.Encoding);

                    if (regval.Value != null)
                    {
                        result.Add(regval);
                    }
                }
            }

            return(result.ToArray());
        }
        static public RegValue[] ImportFrom(string regFile)
        {
            var result = new List<RegValue>();

            string content = System.IO.File.ReadAllText(regFile);

            var parser = new RegParser();

            char[] delimiter = new[] { '\\' };

            foreach (KeyValuePair<string, Dictionary<string, string>> entry in parser.Parse(content))
                foreach (KeyValuePair<string, string> item in entry.Value)
                {
                    string path = entry.Key;

                    var regval = new RegValue();
                    regval.Root = GetHive(path);
                    regval.Key = path.Split(delimiter, 2).Last();
                    regval.Name = item.Key;
                    regval.Value = Deserialize(item.Value, parser.Encoding);

                    if (regval.Value != null)
                        result.Add(regval);
                }

            return result.ToArray();
        }