Removed AudioEncoderSettings/AudioDecoderSettings classes, all of their functionality is now in IAudioEncoderSettings/IAudioDecoderSettings interfaces.

This commit is contained in:
Grigory Chudov
2018-03-25 17:24:27 -04:00
parent 50fcd93ab9
commit 320e75d709
98 changed files with 5274 additions and 4863 deletions

View File

@@ -15,45 +15,17 @@ namespace CUETools.Codecs
Type DecoderType { get; }
bool Lossless { get; }
int Priority { get; }
IAudioDecoderSettings Clone();
}
[JsonObject(MemberSerialization.OptIn)]
public class AudioDecoderSettings: IAudioDecoderSettings
public static class IAudioDecoderSettingsExtensions
{
[Browsable(false)]
public virtual string Name => null;
[Browsable(false)]
public virtual string Extension => null;
[Browsable(false)]
public virtual Type DecoderType => null;
[Browsable(false)]
public virtual bool Lossless => true;
[Browsable(false)]
public virtual int Priority => 0;
public AudioDecoderSettings()
{
// Iterate through each property and call ResetValue()
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(this))
property.ResetValue(this);
}
public AudioDecoderSettings Clone()
{
return this.MemberwiseClone() as AudioDecoderSettings;
}
public bool HasBrowsableAttributes()
public static bool HasBrowsableAttributes(this IAudioDecoderSettings settings)
{
bool hasBrowsable = false;
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(this))
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(settings))
{
bool isBrowsable = true;
foreach (var attribute in property.Attributes)
@@ -65,5 +37,12 @@ namespace CUETools.Codecs
}
return hasBrowsable;
}
public static void Init(this IAudioDecoderSettings settings)
{
// Iterate through each property and call ResetValue()
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(settings))
property.ResetValue(settings);
}
}
}