Move cuetools.net codec locally.

This commit is contained in:
2022-12-16 18:20:23 +00:00
parent 631bbfdbd0
commit 93b833c5bc
69 changed files with 11306 additions and 28 deletions

View File

@@ -0,0 +1,97 @@
using Newtonsoft.Json;
using System;
using System.ComponentModel;
namespace CUETools.Codecs
{
[JsonObject(MemberSerialization.OptIn)]
public class AudioDecoderSettingsViewModel : INotifyPropertyChanged
{
[JsonProperty]
public IAudioDecoderSettings Settings = null;
public event PropertyChangedEventHandler PropertyChanged;
[JsonConstructor]
private AudioDecoderSettingsViewModel()
{
}
public AudioDecoderSettingsViewModel(IAudioDecoderSettings settings)
{
this.Settings = settings;
}
public override string ToString()
{
return Name;
}
public string FullName => Name + " [" + Extension + "]";
public string Path
{
get
{
if (Settings is CommandLine.DecoderSettings)
return (Settings as CommandLine.DecoderSettings).Path;
return "";
}
set
{
if (Settings is CommandLine.DecoderSettings)
(Settings as CommandLine.DecoderSettings).Path = value;
else throw new InvalidOperationException();
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Path"));
}
}
public string Parameters
{
get
{
if (Settings is CommandLine.DecoderSettings)
return (Settings as CommandLine.DecoderSettings).Parameters;
return "";
}
set
{
if (Settings is CommandLine.DecoderSettings)
(Settings as CommandLine.DecoderSettings).Parameters = value;
else throw new InvalidOperationException();
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Parameters"));
}
}
public string Name
{
get => Settings.Name;
set
{
if (Settings is CommandLine.DecoderSettings)
(Settings as CommandLine.DecoderSettings).Name = value;
else throw new InvalidOperationException();
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Name"));
}
}
public string Extension
{
get => Settings.Extension;
set
{
if (Settings is CommandLine.DecoderSettings)
(Settings as CommandLine.DecoderSettings).Extension = value;
else throw new InvalidOperationException();
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Extension"));
}
}
public string DotExtension => "." + Extension;
public bool CanBeDeleted => Settings is CommandLine.DecoderSettings;
public bool IsValid =>
(Settings != null)
&& (Settings is CommandLine.DecoderSettings ? (Settings as CommandLine.DecoderSettings).Path != "" : true);
}
}