예제 #1
0
        internal WindowsServiceInfoUpdate(Model.WindowsServiceInfo service, IWindowsServiceShell windowsShell, IWindowsServiceModelManager manager)
        {
            _shell   = windowsShell;
            _service = service;
            _manager = manager;

            _cache = new ConfigurationCache();
        }
        public WindowsServiceConfigurationForUpdate CreateBackupConfig(Model.WindowsServiceInfo originalService, ConfigurationCache cachedChanges)
        {
            var config = new WindowsServiceConfigurationForUpdate();

            if (cachedChanges.Description != null)
            {
                config.Description = originalService.Description ?? String.Empty;
            }
            if (cachedChanges.DisplayName != null)
            {
                config.DisplayName = originalService.DisplayName;
            }
            if (cachedChanges.Path != null)
            {
                config.Path = originalService.Path;
            }
            if (cachedChanges.ServiceDependencies != null)
            {
                config.ServiceDependencies = originalService.ServiceDependencies;
            }
            if (cachedChanges.ErrorControl != null)
            {
                config.ErrorControl = originalService.ErrorControl;
            }
            if (cachedChanges.InteractWithDesktop != null)
            {
                config.InteractWithDesktop = originalService.InteractWithDesktop;
            }
            if (cachedChanges.StartMode != null)
            {
                config.StartMode = originalService.StartMode;
            }
            if (cachedChanges.Type != null)
            {
                config.Type = originalService.Type;
            }

            return(config);
        }