mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move cuetools.net codec locally.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CUETools.Codecs
|
||||
{
|
||||
public class DecoderListViewModel : BindingList<AudioDecoderSettingsViewModel>
|
||||
{
|
||||
private List<IAudioDecoderSettings> model;
|
||||
|
||||
public DecoderListViewModel(List<IAudioDecoderSettings> model)
|
||||
: base()
|
||||
{
|
||||
this.model = model;
|
||||
model.ForEach(item => Add(new AudioDecoderSettingsViewModel(item)));
|
||||
AddingNew += OnAddingNew;
|
||||
}
|
||||
|
||||
private void OnAddingNew(object sender, AddingNewEventArgs e)
|
||||
{
|
||||
var item = new CommandLine.DecoderSettings("new", "wav", "", "");
|
||||
model.Add(item);
|
||||
e.NewObject = new AudioDecoderSettingsViewModel(item);
|
||||
}
|
||||
|
||||
public bool TryGetValue(string extension, string name, out AudioDecoderSettingsViewModel result)
|
||||
{
|
||||
foreach (AudioDecoderSettingsViewModel udc in this)
|
||||
{
|
||||
if (udc.Settings.Extension == extension && udc.Settings.Name == name)
|
||||
{
|
||||
result = udc;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public AudioDecoderSettingsViewModel GetDefault(string extension)
|
||||
{
|
||||
AudioDecoderSettingsViewModel result = null;
|
||||
foreach (AudioDecoderSettingsViewModel udc in this)
|
||||
{
|
||||
if (udc.Settings.Extension == extension && (result == null || result.Settings.Priority < udc.Settings.Priority))
|
||||
{
|
||||
result = udc;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user