public void ReadRecordsFromStreamTest() { var fs = File.OpenRead(UsnFileName); var records = UsnRecordV2.ReadRecordsFromStream(fs); foreach (var record in records) { Trace.WriteLine($"{record.FileName}"); } fs.Dispose(); }
public void LoadRecords() { if (_loaded) { return; } _loaded = true; IsBusy = true; ThreadInvoker.BackInvoke(() => { //通知进度; var opStream = new OperatebleStream(Stream); //释放中断处理; _dispoingActions.Add(opStream.Break); var percentage = 0; //通知进度; opStream.PositionChanged += (sender, e) => { if (percentage == (int)(e * 100 / opStream.Length)) { return; } percentage = (int)(e * 100 / opStream.Length); BusyWord = $"{percentage}%"; }; try { Records = UsnRecordV2.ReadRecordsFromStream(opStream).ToList(); IsBusy = false; } catch (Exception ex) { LoggerService.WriteException(ex); BusyWord = ex.Message; } //取消释放中断处理; _dispoingActions.Remove(opStream.Break); }); }