added new projects and some base code for persistence

This commit is contained in:
2018-12-10 00:20:33 +01:00
parent e5ed4a6ccc
commit 4480e219fa
12 changed files with 118 additions and 9 deletions

View File

@@ -0,0 +1,51 @@
using System;
using System.Diagnostics;
namespace Tv7Playlist.Core.Parsers
{
[DebuggerDisplay("ParsedTrack-{Id}(Name:{Name}, Url:{Url})")]
public class ParsedTrack
{
public ParsedTrack(int id, string name, string url)
{
Id = id;
Name = name;
Url = url ?? throw new ArgumentNullException(nameof(url));
}
public int Id { get; }
public string Name { get; }
public string Url { get; }
protected bool Equals(ParsedTrack other)
{
return Id == other.Id && string.Equals(Name, other.Name) && string.Equals(Url, other.Url);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((ParsedTrack) obj);
}
public override int GetHashCode()
{
unchecked
{
var hashCode = Id;
hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Url != null ? Url.GetHashCode() : 0);
return hashCode;
}
}
public override string ToString()
{
return $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}, {nameof(Url)}: {Url}";
}
}
}