private static void WriteLoader(Device device, HexInfo loaderInfo)
		{
			WriteRomConfiguration(device, loaderInfo.Bytes, loaderInfo.Offset); // Запись прошивки с 00 00 по 00 2F
			ConfirmLongTermOperation(device);
			ClearAvrSector(device);
			ConfirmLongTermOperation(device);
		}
		private static void WriteAvr(Device device, HexInfo avrInfo)
		{
			WriteAVRConfiguration(device, avrInfo.Bytes, 0x7D000);
			ConfirmLongTermOperation(device);
			ClearAvrSector(device);
			ConfirmLongTermOperation(device);
		}
		private static void WriteSoftWare(Device device, HexInfo softWareInfo)
		{
			WriteRomConfiguration(device, softWareInfo.Bytes, 0x5000); // Запись прошивки с 50 00 по 07 CF
			USBManager.Send(device, "Запись версии базы", 0x02, 0x12, 0x02, 0x30);// 02 12 version(For Example 02 30)
			// 01 12
			StopUpdating(device);
			ConfirmLongTermOperation(device);
		}
		// Записать временный загрузчик
		private static void WriteTempLoader(Device device, HexInfo tempLoaderInfo)
		{
			// 01 01, 01 03, 37 02, 37 03, 37 01
			BeginUpdateFirmWare(device);
			ConfirmLongTermOperation(device);
			// 3D
			WriteRomConfiguration(device, tempLoaderInfo.Bytes, tempLoaderInfo.Offset);
			BeginUpdateRom(device);
			ConfirmLongTermOperation(device);
			// 3D, 01 01
		}
		public static HexInfo GetHexInfo(string fileName, string hexFileName = "firmware.hex")
		{
			var hexInfo = new HexInfo();
			var zipFile = new ZipFile(fileName, Encoding.GetEncoding("cp866"))
			{
				Password = "******"
			};
			var tempFolder = AppDataFolderHelper.GetTempFolder();
			zipFile.ExtractAll(tempFolder);

			hexFileName = Path.Combine(tempFolder, hexFileName);
			var strings = File.ReadAllLines(hexFileName).ToList();
			hexInfo.Offset = Convert.ToInt32(strings[strings.Count - 2].Substring(9, 8), 16);
			//strings.RemoveAt(0);
			strings.RemoveRange(strings.Count - 2, 2);
			var pattern = @"[:][0][2]+.*";
			var regex = new Regex(pattern);
			var mathes = new List<string>();
			foreach (var str in strings)
			{
				var match = regex.Match(str);
				if (match.Value != "")
				{
					mathes.Add(match.Value);
					continue;
				}
				var count = Convert.ToInt32(str.Substring(1, 2), 16);
				for (var i = 9; i < count * 2 + 9; i += 2)
				{
					hexInfo.Bytes.Add(Convert.ToByte(str.Substring(i, 2), 16));
				}
			}

			if (Directory.Exists(tempFolder))
				Directory.Delete(tempFolder, true);

			return hexInfo;
		}