|
|
@ -1,6 +1,7 @@
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Model
|
|
|
|
namespace Model
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -8,33 +9,33 @@ namespace Model
|
|
|
|
public class Game : INotifyPropertyChanged
|
|
|
|
public class Game : INotifyPropertyChanged
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string Name
|
|
|
|
public string? Name
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return name; }
|
|
|
|
get => name;
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
name = value;
|
|
|
|
name = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string name;
|
|
|
|
private string? name;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string Description
|
|
|
|
public string? Description
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return description; }
|
|
|
|
get => description;
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
if (string.IsNullOrWhiteSpace(value)) return;
|
|
|
|
description = value;
|
|
|
|
description = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string description;
|
|
|
|
private string? description;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public int Year
|
|
|
|
public int Year
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return year; }
|
|
|
|
get => year;
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value < 1957 || value > 2023) return;
|
|
|
|
if (value < 1957 || value > 2023) return;
|
|
|
@ -44,7 +45,7 @@ namespace Model
|
|
|
|
private int year;
|
|
|
|
private int year;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public string Cover
|
|
|
|
public string? Cover
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => cover;
|
|
|
|
get => cover;
|
|
|
|
set
|
|
|
|
set
|
|
|
@ -53,7 +54,7 @@ namespace Model
|
|
|
|
cover = value;
|
|
|
|
cover = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string cover;
|
|
|
|
private string? cover;
|
|
|
|
|
|
|
|
|
|
|
|
[DataMember]
|
|
|
|
[DataMember]
|
|
|
|
public ObservableCollection<string> Tags
|
|
|
|
public ObservableCollection<string> Tags
|
|
|
@ -75,6 +76,7 @@ namespace Model
|
|
|
|
|
|
|
|
|
|
|
|
public Game()
|
|
|
|
public Game()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
tags = new ObservableCollection<string>();
|
|
|
|
Reviews = new List<Review>();
|
|
|
|
Reviews = new List<Review>();
|
|
|
|
Average = 0;
|
|
|
|
Average = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -101,19 +103,20 @@ namespace Model
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((obj == null) || !this.GetType().Equals(obj.GetType())) return false;
|
|
|
|
if ((obj == null) || !this.GetType().Equals(obj.GetType())) return false;
|
|
|
|
return this.Name.Equals((obj as Game).Name) && this.Year.Equals((obj as Game).Year);
|
|
|
|
return Name.Equals(((Game)obj).Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string s = $"{Name} : {Description} : {Year} : {Cover}\n";
|
|
|
|
StringBuilder builder = new();
|
|
|
|
|
|
|
|
builder.Append($"{Name} : {Description} : {Year} : {Cover}\n");
|
|
|
|
|
|
|
|
|
|
|
|
foreach(Review review in Reviews)
|
|
|
|
foreach (Review review in Reviews)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
s += review;
|
|
|
|
builder.Append($"{review}\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return s+"\n";
|
|
|
|
return builder.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public float GetAvgRate()
|
|
|
|
public float GetAvgRate()
|
|
|
|