You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using PetaPoco;
|
|
|
|
namespace NzbDrone.Core.Repository.Quality
|
|
{
|
|
[TableName("QualityProfiles")]
|
|
[PrimaryKey("QualityProfileId", autoIncrement = true)]
|
|
public class QualityProfile
|
|
{
|
|
public virtual int QualityProfileId { get; set; }
|
|
public string Name { get; set; }
|
|
|
|
[Ignore]
|
|
public List<QualityTypes> Allowed { get; set; }
|
|
|
|
[Ignore]
|
|
public string AllowedString { get; set; }
|
|
public QualityTypes Cutoff { get; set; }
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public string SonicAllowed
|
|
{
|
|
get
|
|
{
|
|
string result = String.Empty;
|
|
if (Allowed == null) return result;
|
|
|
|
foreach (var q in Allowed)
|
|
{
|
|
result += (int)q + "|";
|
|
}
|
|
return result.Trim('|');
|
|
}
|
|
private set
|
|
{
|
|
var qualities = value.Split('|');
|
|
Allowed = new List<QualityTypes>(qualities.Length);
|
|
foreach (var quality in qualities.Where(q => !String.IsNullOrWhiteSpace(q)))
|
|
{
|
|
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |