37 lines
919 B
C#
37 lines
919 B
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace View_by_Distance.Shared.Models;
|
|
|
|
public class Container : Properties.IContainer
|
|
{
|
|
|
|
protected readonly int _G;
|
|
protected readonly List<Item> _Items;
|
|
protected readonly string _SourceDirectory;
|
|
public int G => _G;
|
|
public List<Item> Items => _Items;
|
|
public string SourceDirectory => _SourceDirectory;
|
|
|
|
[JsonConstructor]
|
|
public Container(int g, List<Item> items, string sourceDirectory)
|
|
{
|
|
_G = g;
|
|
_Items = items;
|
|
_SourceDirectory = sourceDirectory;
|
|
}
|
|
|
|
public Container(int g, string sourceDirectory)
|
|
{
|
|
_G = g;
|
|
_Items = new();
|
|
_SourceDirectory = sourceDirectory;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
|
return result;
|
|
}
|
|
|
|
} |