示例#1
0
        /// <summary>
        /// Returns the path that is stored in the specified key.
        /// </summary>
        /// <param name="regKey">the key in the Windows registry.</param>
        private static string GetVerifiedPathFromRegistry(string regKey)
        {
            if (string.IsNullOrWhiteSpace(regKey))
            {
                throw new ArgumentNullException(nameof(regKey));
            }

            var dir = OeEnvironment.GetRegistryKey(regKey);

            if (!Directory.Exists(dir))
            {
                throw new ArgumentException($"Directory '{dir}' does not exist or is inaccessible");
            }

            return(dir);
        }
示例#2
0
        /// <summary>
        /// Returns the value for the specified key.
        /// Determines 32-bit or 64-bit, and get's the key from the related path.
        /// </summary>
        /// <param name="key">The key to get the value for.</param>
        private static string GetRegistryKey(string key)
        {
#if V122
            // In OE 12.2 there is no 64-bit key.
            var path = OeEnvironment._RegKey32;
#else
            //Determin 32 or 64 bit
            var path = System.Environment.Is64BitOperatingSystem
                ? OeEnvironment._RegKey64
                : OeEnvironment._RegKey32;
#endif
            //Get registry key
            var value = OeEnvironment.GetOsRegistryKey(path, key);
            if (value == null)
            {
                throw new ArgumentException("OpenEdge not installed");
            }

            return(value);
        }