New Image prosperity: Size

This commit is contained in:
mashed-potatoes 2020-06-29 11:06:56 +05:00
parent 6a2741526b
commit 4a43da3685

View file

@ -14,12 +14,14 @@ namespace PotatoNV_next.Utils
public class Image public class Image
{ {
private bool? valid = null; private bool? valid = null;
private int? size = null;
public string Path { get; } public string Path { get; }
public string Role { get; } public string Role { get; }
public uint Address { get; } public uint Address { get; }
private string Hash { get; } private string Hash { get; }
public bool IsValid { get => valid ?? Validate(); } public bool IsValid { get => valid ?? Validate(); }
public int Size { get => size ?? GetSize(); }
private bool Validate() private bool Validate()
{ {
@ -41,6 +43,13 @@ namespace PotatoNV_next.Utils
return valid.Value; return valid.Value;
} }
private int GetSize()
{
size = (int)new FileInfo(Path).Length;
return size.Value;
}
public Image(string path, string role, uint address, string hash = null) public Image(string path, string role, uint address, string hash = null)
{ {
Path = path; Path = path;