public static bool WriteDeviceConfiguration(Device device, List<byte> Flash, List<byte> Rom)
		{
			var panelDatabaseReader = new ReadPanelDatabaseOperationHelper(device, false);
			var romDBFirstIndex = panelDatabaseReader.GetRomFirstIndex(device);
			ConfirmLongTermOperation(device);
			GetOsStatus(device); // 00 - прибор находится в состояние прикладного ПО
			BlockBD(device);
			GetAddressList(device);
			WriteFlashConfiguration(device, Flash);
			GetOsStatus(device);
			BeginUpdateFirmWare(device);
			ConfirmLongTermOperation(device);
			RequestError(device);
			GetOsStatus2(device); // 01 - сервисный режим (считает CRC прикладного ПО)
			var firmwareFileName = Path.Combine(AppDataFolderHelper.GetFolder("Server"), "frm.fscf");
			var hexInfo = FirmwareUpdateOperationHelper.GetHexInfo(firmwareFileName, device.Driver.ShortName + ".hex");
			WriteRomConfiguration(device, hexInfo.Bytes, hexInfo.Offset);
			BeginUpdateRom(device);
			ConfirmLongTermOperation(device); 
			RequestError(device);
			GetOsStatus3(device); // 08 - Ram загрузчик
			ClearSector(device, 0x03, 0x04);
			ConfirmLongTermOperation(device);
			RequestError(device);
			WriteRomConfiguration(device, Rom, romDBFirstIndex);
			StopUpdating(device);
			ConfirmLongTermOperation(device);
			GetOsStatus(device);
			ServerHelper.SynchronizeTime(device);
			return true;
		}
		public DeviceConfiguration GetDeviceConfiguration(Device panelDevice)
		{
			PanelDevice = (Device)panelDevice.Clone();
			shleifCount = PanelDevice.Driver.ShleifCount;
			PanelDevice.Children = new List<Device>();
			Zones = new List<Zone>();
			remoteDeviceConfiguration = new DeviceConfiguration();
			remoteDeviceConfiguration.RootDevice = PanelDevice;
			remoteDeviceConfiguration.Devices.Add(PanelDevice);
			var panelDatabaseReader = new ReadPanelDatabaseOperationHelper(PanelDevice, CheckMonitoringSuspend);
			panelDatabaseReader.RomDBFirstIndex = panelDatabaseReader.GetRomFirstIndex(PanelDevice);
			if (panelDatabaseReader.RomDBFirstIndex == -1)
				return null;
			panelDatabaseReader.FlashDBLastIndex = panelDatabaseReader.GetFlashLastIndex(PanelDevice);
			if (panelDatabaseReader.FlashDBLastIndex == -1)
				return null;
			DeviceRom = panelDatabaseReader.GetRomDBBytes(PanelDevice);
			if (DeviceRom == null)
				return null;
			DeviceFlash = panelDatabaseReader.GetFlashDBBytes(PanelDevice);
			if (DeviceFlash == null)
				return null;

			zonePanelRelationsInfo = new ZonePanelRelationsInfo();
			ParseZonesRom(1542, panelDatabaseReader.RomDBFirstIndex);

			outZonesBegin = DeviceRom[1548] * 256 * 256 + DeviceRom[1549] * 256 + DeviceRom[1550];
			outZonesCount = DeviceRom[1552] * 256 + DeviceRom[1553];
			outZonesEnd = outZonesBegin + outZonesCount * 9;

			ParseUIDevicesRom(DriverType.MDU);
			ParseNoUIDevicesRom(DriverType.AM1_T);

			ParseUIDevicesRom(DriverType.RM_1);
			ParseUIDevicesRom(DriverType.MPT);
			ParseUIDevicesRom(DriverType.MRO);
			ParseUIDevicesRom(DriverType.MRO_2);
			ParseUIDevicesRom(DriverType.Exit);

			ParseNoUIDevicesRom(DriverType.SmokeDetector);
			ParseNoUIDevicesRom(DriverType.HeatDetector);
			ParseNoUIDevicesRom(DriverType.CombinedDetector);
			ParseNoUIDevicesRom(DriverType.HandDetector);
			ParseNoUIDevicesRom(DriverType.AM_1);
			ParseNoUIDevicesRom(DriverType.AMP_4);
			ParseNoUIDevicesRom(DriverType.AM1_O);
			ParseNoUIDevicesRom(DriverType.RadioHandDetector);
			ParseNoUIDevicesRom(DriverType.RadioSmokeDetector);
			ParseUIDevicesRom(DriverType.Valve);

			foreach (var childDevice in PanelDevice.Children)
			{
				childDevice.Parent = PanelDevice;
				remoteDeviceConfiguration.Devices.Add(childDevice);
			}
			foreach (var device in remoteDeviceConfiguration.Devices)
			{
				GetCurrentDeviceState(device);
			}
			return remoteDeviceConfiguration;
		}