35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
namespace Млаумчерб.Клиент.классы;
|
||
|
||
public class GameVersionProps
|
||
{
|
||
public string Name { get; }
|
||
public IOPath LocalDescriptorPath { get; }
|
||
public string? RemoteDescriptorUrl { get; }
|
||
private bool _isDownloaded;
|
||
public bool IsDownloaded
|
||
{
|
||
get => _isDownloaded;
|
||
set
|
||
{
|
||
bool downloadCompleted = value && !_isDownloaded;
|
||
_isDownloaded = value;
|
||
if(downloadCompleted)
|
||
OnDownloadCompleted?.Invoke();
|
||
}
|
||
}
|
||
public event Action? OnDownloadCompleted;
|
||
|
||
public GameVersionProps(string name, string? url, IOPath descriptorPath)
|
||
{
|
||
Name = name;
|
||
LocalDescriptorPath = descriptorPath;
|
||
RemoteDescriptorUrl = url;
|
||
IsDownloaded = File.Exists(Пути.GetVersionJarFilePath(name));
|
||
}
|
||
|
||
public GameVersionProps(string name, string? url) :
|
||
this(name, url, Пути.GetVersionDescriptorPath(name)) { }
|
||
|
||
public override string ToString() => Name;
|
||
}
|