public void SetRegistryAccess(RootKey rootKey, string pathWithoutRoot)
        {
            WindowsRegistryAccess windowsRegistryAccess = GetAsWindowsRegistryAccess(rootKey, pathWithoutRoot);

            _windowsRegistryWriter.InitializeRegistryAccess(windowsRegistryAccess);
            _windowsRegistryReader.InitializeRegistryAccess(windowsRegistryAccess);
        }
Beispiel #2
0
        public WindowsRegistryWriter(WindowsRegistryAccess windowsRegistryAccess, RegistryKey registryKey)
        {
            _registryKey         = registryKey;
            _byteArraySerializer = new ByteArraySerializer();

            InitializeRegistryAccess(windowsRegistryAccess);
        }
Beispiel #3
0
        public RegistryKey InitializeRegistryKey(WindowsRegistryAccess windowsRegistryAccess)
        {
            _rootKey = windowsRegistryAccess.RootKey;
            _registryKeyInitializer = _implementationFactory.Create <IRegistryKeyInitializer, RegistryAccessAttribute>(IdentifierFunc);

            return(_registryKeyInitializer.InitializeRegistryKey(windowsRegistryAccess));
        }
        public WindowsRegistryService(RootKey rootKey, string pathWithoutRoot)
        {
            _registryKeyInitializerFactory = new RegistryKeyInitializerFactory();
            WindowsRegistryAccess windowsRegistryAccess = GetAsWindowsRegistryAccess(rootKey, pathWithoutRoot);

            RegistryKey registryKey = _registryKeyInitializerFactory.InitializeRegistryKey(windowsRegistryAccess);

            _windowsRegistryWriter = new WindowsRegistryWriter(windowsRegistryAccess, registryKey);
            _windowsRegistryReader = new WindowsRegistryReader(windowsRegistryAccess, registryKey);
        }
        public override RegistryKey InitializeRegistryKey(WindowsRegistryAccess windowsRegistryAccess)
        {
            RegistryKey registryKey = null;

            try
            {
                registryKey = Registry.CurrentConfig.CreateSubKey(windowsRegistryAccess?.PathWithoutRoot, true);
            }
            catch (Exception e) when(e is ArgumentNullException || e is SecurityException ||
                                     e is ObjectDisposedException || e is UnauthorizedAccessException || e is IOException)
            {
                Console.WriteLine(e.ToString());
            }

            return(registryKey);
        }
 public abstract RegistryKey InitializeRegistryKey(WindowsRegistryAccess windowsRegistryAccess);
Beispiel #7
0
 public void InitializeRegistryAccess(WindowsRegistryAccess windowsRegistryAccess)
 {
     _windowsRegistryAccess = windowsRegistryAccess;
 }