private void ProcessAudio(IAudioSource file, string displayPath, string displayFilename) { this.Dispatcher.BeginInvokeAction(() => { this.textStatus.Text = this.processedFiles + " / " + this.totalFiles; this.progressChecksum.Value = 0; }); AudioChecksumCalculator calculator = new AudioChecksumCalculator(file); calculator.ProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.progressChecksum, () => this.shouldCancel); calculator.ComputeHashes(); uint crc32 = calculator.CRC32; ++this.processedFiles; file.Close(); this.Dispatcher.BeginInvokeAction(() => { this.textStatus.Text = this.processedFiles + " / " + this.totalFiles; this.listChecksums.Items.Add(new AudioChecksumItem() { Path = displayPath, Filename = displayFilename, Checksum = crc32.ToString("X8") }); }); }
public AudioFormatAnalysisWindow(ICollectionSessionFactory factory) : base(factory) { this.bucketCollection = new FormatBucketCollection(); this.localBuckets = new FormatBucketCollection(); this.fileBuckets = new ObservableCollection <FileBucket>(); this.localFileBuckets = new ObservableCollection <FileBucket>(); InitializeComponent(); this.listFormats.ItemsSource = this.bucketCollection; this.listFiles.ItemsSource = this.fileBuckets; this.ProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.busyIndicator, () => false, p => { this.bucketCollection.Add(this.localBuckets); this.localBuckets.Clear(); this.fileBuckets.AddRange(this.localFileBuckets); this.localFileBuckets.Clear(); }); new Task(this.CalculateAudioFormats).Start(); }
private void WorkerTask() { EncodingTargetScanner scanner = new EncodingTargetScanner(this.CollectionManager, this.encodingTarget); scanner.ProgressChanged += ProgressBarUpdater.CreateHandler(this.Dispatcher, this.progressScan, () => this.cancelScanning); this.scanResult = scanner.Scan(); if (!this.cancelScanning) { this.Dispatcher.InvokeAction(() => { this.groupTracksToEncode.Header = "Tracks To Encode (" + scanResult.ReleasesToEncodeTrackCount + ")"; this.groupFilesToDelete.Header = "Files To Delete (" + scanResult.FilesToDelete.Length + ")"; List <TrackToEncodeListViewItem> tracksToEncode = new List <TrackToEncodeListViewItem>(); foreach (var releaseToEncode in this.scanResult.ReleasesToEncode) { foreach (var trackToEncode in releaseToEncode.Tracklist) { tracksToEncode.Add(new TrackToEncodeListViewItem() { Release = releaseToEncode.JoinedAlbumArtists + " - " + releaseToEncode.Title, Title = trackToEncode.Title }); } } this.listTracksToEncode.ItemsSource = tracksToEncode; this.listFilesToDelete.ItemsSource = this.scanResult.FilesToDelete.ToArray(); this.btnSync.IsEnabled = this.scanResult.ReleasesToEncodeTrackCount > 0 || this.scanResult.FilesToDelete.Length > 0; }); } }