mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-23 04:52:22 +00:00
Add project files.
This commit is contained in:
62
Lantean.QBTMudBlade/Models/ContentItem.cs
Normal file
62
Lantean.QBTMudBlade/Models/ContentItem.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
namespace Lantean.QBTMudBlade.Models
|
||||
{
|
||||
public class ContentItem
|
||||
{
|
||||
public ContentItem(
|
||||
string name,
|
||||
string displayName,
|
||||
int index,
|
||||
Priority priority,
|
||||
float progress,
|
||||
long size,
|
||||
float availability,
|
||||
bool isFolder = false,
|
||||
int level = 0)
|
||||
{
|
||||
Name = name;
|
||||
DisplayName = displayName;
|
||||
Index = index;
|
||||
Priority = priority;
|
||||
Progress = progress;
|
||||
Size = size;
|
||||
Availability = availability;
|
||||
IsFolder = isFolder;
|
||||
Level = level;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Path => IsFolder ? Name : Name.GetDirectoryPath();
|
||||
|
||||
public string DisplayName { get; }
|
||||
|
||||
public int Index { get; }
|
||||
|
||||
public Priority Priority { get; set; }
|
||||
|
||||
public float Progress { get; set; }
|
||||
|
||||
public long Size { get; set; }
|
||||
|
||||
public float Availability { get; set; }
|
||||
|
||||
public long Downloaded => (long)Math.Round(Size * Progress, 0);
|
||||
|
||||
public long Remaining => Size - Downloaded;
|
||||
|
||||
public bool IsFolder { get; }
|
||||
|
||||
public int Level { get; }
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is null) return false;
|
||||
return ((ContentItem)obj).Name == Name;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user