2018-08-05 14:28:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.CustomFormats
|
|
|
|
|
{
|
|
|
|
|
public class CustomFormat : ModelBase, IEquatable<CustomFormat>
|
|
|
|
|
{
|
|
|
|
|
public CustomFormat()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-18 21:03:05 +00:00
|
|
|
|
public CustomFormat(string name, params ICustomFormatSpecification[] specs)
|
2018-08-05 14:28:05 +00:00
|
|
|
|
{
|
|
|
|
|
Name = name;
|
2020-02-18 21:03:05 +00:00
|
|
|
|
Specifications = specs.ToList();
|
2018-08-05 14:28:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-22 21:47:33 +00:00
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
2020-02-25 22:10:52 +00:00
|
|
|
|
public bool IncludeCustomFormatWhenRenaming { get; set; }
|
|
|
|
|
|
2020-02-18 21:03:05 +00:00
|
|
|
|
public List<ICustomFormatSpecification> Specifications { get; set; }
|
2018-08-05 14:28:05 +00:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return Name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Equals(CustomFormat other)
|
|
|
|
|
{
|
2020-01-22 21:47:33 +00:00
|
|
|
|
if (other is null)
|
2019-12-22 22:08:53 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ReferenceEquals(this, other))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-05 14:28:05 +00:00
|
|
|
|
return int.Equals(Id, other.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
2020-01-22 21:47:33 +00:00
|
|
|
|
if (obj is null)
|
2019-12-22 22:08:53 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ReferenceEquals(this, obj))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj.GetType() != GetType())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Equals((CustomFormat)obj);
|
2018-08-05 14:28:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
2020-01-22 21:47:33 +00:00
|
|
|
|
return Id;
|
2018-09-10 19:25:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-05 14:28:05 +00:00
|
|
|
|
}
|