// Token: 0x060000FF RID: 255 RVA: 0x0000E160 File Offset: 0x0000C360 public byte[] GetBytesFromFile(long offset, int size, out int n, out float percent) { byte[] array; if (MemImg.isHighSpeed && this.filePath.ToLower().IndexOf(MiAppConfig.Get("noquick")) < 0) { array = MemImg.GetBytesFromFile(this.filePath, offset, size, out percent); n = array.Length; } else { long length = this.fileStream.Length; array = new byte[size]; this.fileStream.Seek(offset, SeekOrigin.Begin); n = this.fileStream.Read(array, 0, size); percent = (float)offset / (float)length; } FlashingDevice.UpdateDeviceStatus(this.portName, new float?(percent), null, "flashing", false); return(array); }
// Token: 0x060000FA RID: 250 RVA: 0x0000D9CC File Offset: 0x0000BBCC private bool openFile(string filePath) { this.filePath = filePath; bool result = false; if (MemImg.isHighSpeed && filePath.ToLower().IndexOf(MiAppConfig.Get("noquick")) < 0) { this.fileLength = MemImg.mapImg(filePath); Log.w(this.portName, string.Format("Image {0} ,quick transfer", filePath)); } try { FileInfo fileInfo = new FileInfo(filePath); this.fileLength = fileInfo.Length; this.fileStream = File.OpenRead(filePath); result = true; } catch (Exception ex) { result = false; throw new Exception(ex.Message); } return(result); }