mirror of
https://github.com/mashed-potatoes/PotatoNV.git
synced 2024-11-10 01:02:20 +01:00
New Image prosperity: Size
This commit is contained in:
parent
6a2741526b
commit
4a43da3685
1 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue