Lidarr/NzbDrone.Core/Repository/Quality/QualityProfile.cs

62 lines
1.9 KiB
C#
Raw Normal View History

2010-09-29 17:19:18 +00:00
using System;
using System.Collections.Generic;
2010-09-30 06:59:00 +00:00
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
2010-09-30 06:59:00 +00:00
using SubSonic.SqlGeneration.Schema;
2010-09-29 17:19:18 +00:00
namespace NzbDrone.Core.Repository.Quality
2010-09-29 17:19:18 +00:00
{
public class QualityProfile
{
2011-04-06 03:14:43 +00:00
[SubSonicPrimaryKey]
public virtual int QualityProfileId { get; set; }
[Required(ErrorMessage = "A Name is Required")]
[DisplayName("Name")]
[DisplayFormat(ConvertEmptyStringToNull = false)]
public string Name { get; set; }
public bool UserProfile { get; set; } //Allows us to tell the difference between default and user profiles
2010-09-30 06:59:00 +00:00
2011-02-03 20:09:19 +00:00
[SubSonicIgnore]
[DisplayName("Allowed Qualities")]
public List<QualityTypes> Allowed { get; set; }
[SubSonicIgnore]
[DisplayName("Allowed Qualities String")]
[DisplayFormat(ConvertEmptyStringToNull = false)]
public string AllowedString { get; set; }
[DisplayName("Cut-off")]
[Required(ErrorMessage = "Valid Cut-off is Required")]
2011-02-03 20:09:19 +00:00
public QualityTypes Cutoff { get; set; }
2010-09-30 06:59:00 +00:00
2011-02-03 20:09:19 +00:00
[EditorBrowsable(EditorBrowsableState.Never)]
public string SonicAllowed
{
get
{
string result = String.Empty;
2011-04-05 05:30:13 +00:00
if (Allowed == null) return result;
2011-02-03 20:09:19 +00:00
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)
{
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
}
}
}
[SubSonicToManyRelation]
public virtual List<string> Series { get; private set; }
2010-09-29 17:19:18 +00:00
}
}