public static List<Guid> WriteAll(List<Guid> deviceUIDs)
		{
			var failedDevices = new List<Guid>();
			CallbackManager.AddProgress(new FS2ProgressInfo("Формирование базы данных устройств"));
			var systemDatabaseCreator = new SystemDatabaseCreator();
			systemDatabaseCreator.Create(0x3000);

			foreach (var panelDatabase in systemDatabaseCreator.PanelDatabases)
			{
				var parentPanel = panelDatabase.ParentPanel;
				if (deviceUIDs == null || deviceUIDs.Contains(parentPanel.UID))
				{
					var bytes1 = panelDatabase.RomDatabase.BytesDatabase.GetBytes();
					var bytes2 = panelDatabase.FlashDatabase.BytesDatabase.GetBytes();
					CallbackManager.AddProgress(new FS2ProgressInfo("Запись базы данных в прибор " + panelDatabase.ParentPanel.PresentationAddressAndName));
					var result = SetConfigurationOperationHelper.WriteDeviceConfiguration(parentPanel, bytes2, bytes1);
					if (!result)
					{
						failedDevices.Add(parentPanel.UID);
					}
				}
			}

			return failedDevices;
		}
		public static bool Write(Device device)
		{
			CallbackManager.AddProgress(new FS2ProgressInfo("Формирование базы данных устройств"));
			var systemDatabaseCreator = new SystemDatabaseCreator();
			systemDatabaseCreator.Create(0x3000);
			Device parentPanel;
			if ((device.Driver.DriverType == DriverType.IndicationBlock) || (device.Driver.DriverType == DriverType.PDU) || (device.Driver.DriverType == DriverType.PDU_PT))
			{
				var nonPanelDatabase = systemDatabaseCreator.NonPanelDatabases.FirstOrDefault(x => x.ParentPanel.UID == device.UID);
				if (nonPanelDatabase == null)
					throw new FS2Exception("Не найдена сформированная для устройства база данных");
				parentPanel = nonPanelDatabase.ParentPanel;
				var bytes = nonPanelDatabase.BytesDatabase.GetBytes();
				CallbackManager.AddProgress(new FS2ProgressInfo("Запись базы данных в прибор"));
				return SetConfigurationOperationHelper.WriteNonPanelDeviceConfiguration(parentPanel, bytes);
			}
			var panelDatabase = systemDatabaseCreator.PanelDatabases.FirstOrDefault(x => x.ParentPanel.UID == device.UID);
			if (panelDatabase == null)
				throw new FS2Exception("Не найдена сформированная для устройства база данных");
			parentPanel = panelDatabase.ParentPanel;
			var bytes1 = panelDatabase.RomDatabase.BytesDatabase.GetBytes();
			var bytes2 = panelDatabase.FlashDatabase.BytesDatabase.GetBytes();
			CallbackManager.AddProgress(new FS2ProgressInfo("Запись базы данных в прибор"));
			return SetConfigurationOperationHelper.WriteDeviceConfiguration(parentPanel, bytes2, bytes1);
		}
Exemple #3
0
		private void OnWriteConfiguration()
		{
			var dateTime = DateTime.Now;
			var configurationWriterHelper = new SystemDatabaseCreator();
			configurationWriterHelper.Create(0x2000);
			Trace.WriteLine("SystemDatabaseCreator TotalMilliseconds = " + (DateTime.Now - dateTime).TotalMilliseconds.ToString());

			var configurationDatabaseViewModel = new ConfigurationDatabaseViewModel(configurationWriterHelper);
			DialogService.ShowModalWindow(configurationDatabaseViewModel);
		}
		public ConfigurationDatabaseViewModel(SystemDatabaseCreator configurationWriterHelper)
		{
			Title = "Структура распределения памяти";

			PanelDatabases = new List<PanelDatabaseViewModel>();
			foreach (var panelDatabase in configurationWriterHelper.PanelDatabases)
			{
				PanelDatabases.Add(new PanelDatabaseViewModel(panelDatabase));
			}

			NonPanelDatabases = new List<NonPanelDatabaseViewModel>();
			foreach (var nonPanelDatabase in configurationWriterHelper.NonPanelDatabases)
			{
				NonPanelDatabases.Add(new NonPanelDatabaseViewModel(nonPanelDatabase));
			}
		}
Exemple #5
0
		public BIDatabase(Device device, SystemDatabaseCreator configurationWriterHelper)
		{
			IndicatorItems = new List<IndicatorItem>();

			ConfigurationWriterHelper = configurationWriterHelper;
			ParentPanel = device;
			BytesDatabase = new BytesDatabase();

			Initialize();
			CreateTables();
			CreateRootBytes();

			var crcBytes = BytesDatabase.GetBytes().ToList();
			crcBytes.RemoveRange(0, 0x4000);
			crcBytes.RemoveRange(0, 74);
			var crc16Value = Crc16Helper.ComputeChecksum(crcBytes);
			BytesDatabase.SetShort(Crc16ByteDescription, crc16Value);

			CreateRootBytes();
		}