mirror of
https://github.com/mashed-potatoes/PotatoNV.git
synced 2024-09-19 20:51:20 +02: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
|
||||
{
|
||||
private bool? valid = null;
|
||||
private int? size = null;
|
||||
|
||||
public string Path { get; }
|
||||
public string Role { get; }
|
||||
public uint Address { get; }
|
||||
private string Hash { get; }
|
||||
public bool IsValid { get => valid ?? Validate(); }
|
||||
public int Size { get => size ?? GetSize(); }
|
||||
|
||||
private bool Validate()
|
||||
{
|
||||
|
@ -41,6 +43,13 @@ namespace PotatoNV_next.Utils
|
|||
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)
|
||||
{
|
||||
Path = path;
|
||||
|
|
Loading…
Reference in a new issue