public static void GetConfiguration(string configurationFolderName)
		{
			try
			{
				var stream = FiresecManager.FiresecService.GetConfig();
				FiresecConfiguration = new FiresecConfiguration();

				var folderName = AppDataFolderHelper.GetLocalFolder(configurationFolderName);
				var configFileName = Path.Combine(folderName, "Config.fscp");
				if (Directory.Exists(folderName))
					Directory.Delete(folderName, true);
				Directory.CreateDirectory(folderName);
				if (ServiceFactoryBase.ContentService != null)
					ServiceFactoryBase.ContentService.Invalidate();

				var configFileStream = File.Create(configFileName);
				CopyStream(stream, configFileStream);
				bool isFullConfiguration;
				LoadFromZipFile(configFileName, out isFullConfiguration);

				UpdateConfiguration();
				FiresecConfiguration.CreateStates();
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecManager.GetConfiguration");
				LoadingErrorManager.Add(e);
			}
		}
Example #2
0
		public Validator(FiresecConfiguration firesecConfiguration)
		{
			_firesecConfiguration = firesecConfiguration;
		}
        public static void GetConfiguration(bool updateFiles = true)
        {
            if (updateFiles)
                FileHelper.Synchronize();

            SystemConfiguration = FiresecService.GetSystemConfiguration();
            LibraryConfiguration = FiresecService.GetLibraryConfiguration();
            PlansConfiguration = FiresecService.GetPlansConfiguration();
            SecurityConfiguration = FiresecService.GetSecurityConfiguration();
            var drivers = FiresecService.GetDrivers();
            if ((drivers == null) || (drivers.Count == 0))
            {
                MessageBox.Show("Ошибка. Список драйверов пуст");
            }
            var deviceConfiguration = FiresecService.GetDeviceConfiguration();
            FiresecConfiguration = new FiresecConfiguration()
            {
                Drivers = drivers,
                DeviceConfiguration = deviceConfiguration
            };

            UpdateConfiguration();
        }