public MockPluginRepository() { Count = 0; PluginsByType = new IPlugin[0]; DiscReaderPlugins = new IDiscReaderPlugin[0]; MetadataProviderPlugins = new IMetadataProviderPlugin[0]; AutoDetectorPlugins = new IAutoDetectorPlugin[0]; NameProviderPlugins = new INameProviderPlugin[0]; MuxerPlugins = new IMuxerPlugin[0]; PostProcessorPlugins = new IPostProcessorPlugin[0]; }
private bool ReadBDROM(CancellationToken cancellationToken, string bdromPath) { IDiscReaderPlugin discReader = _pluginRepository.DiscReaderPlugins.First(plugin => plugin.Enabled); var pluginTask = RunPluginSync(cancellationToken, discReader, delegate(CancellationToken token) { var disc = discReader.ReadBDROM(token, bdromPath); if (!token.IsCancellationRequested) { Job = new Job(disc); } }); return(pluginTask.IsCompleted && pluginTask.Result); }
private bool ReadBDROM(CancellationToken cancellationToken, string bdromPath) { IDiscReaderPlugin discReader = _pluginRepository.DiscReaderPlugins.First(plugin => plugin.Enabled); var pluginTask = RunPluginSync(cancellationToken, discReader, delegate(CancellationToken token) { var disc = discReader.ReadBDROM(token, bdromPath); if (!token.IsCancellationRequested) { var prevJob = Job; // Create a new job for the current disc Job = new Job(disc); // Restore the previous job if the current one is canceled cancellationToken.Register(() => Job = prevJob); } }); return(pluginTask.IsCompleted && pluginTask.Result); }