Exemple #1
0
        public virtual IEnumerable <string> GetSubKeys(string root, string path)
        {
            string value = null;
            var    hr    = native.GetSubKeys(root, path, out value);

            if (hr != ERROR_SUCCESS)
            {
                if (hr == 1260)
                {
                    throw new UnauthorizedAccessException();
                }
                if (hr == 2)
                {
                    throw new KeyNotFoundException();
                }
                throw new ArgumentException("Error getting subkeys: " + hr);
            }

            if (value.Length > 0)
            {
                return(value.Split('|').Where(s => s.Length > 0).OrderBy(s => s).ToList());
            }
            else
            {
                return(new List <string>());
            }
        }