Console logging improvements, implement Equals/GetHashCode for QueryInfo

This commit is contained in:
n00mkrad
2025-12-20 23:13:26 +01:00
parent 4c0202edb2
commit 8a0e181f8d
10 changed files with 109 additions and 89 deletions

View File

@@ -101,7 +101,7 @@ namespace Flowframes.Data
public async Task Initialize(bool progressBar = true, bool countFrames = true)
{
Logger.Log($"MediaFile {Name}: Initializing", true);
Logger.Log($"Analyzing media '{Name}'", true);
try
{
@@ -116,11 +116,10 @@ namespace Flowframes.Data
DataStreams = AllStreams.Where(x => x.Type == Stream.StreamType.Data).Select(x => (DataStream)x).ToList();
AttachmentStreams = AllStreams.Where(x => x.Type == Stream.StreamType.Attachment).Select(x => (AttachmentStream)x).ToList();
MayHaveAlpha = VideoStreams.Any(vs => vs.CanHaveAlpha);
Logger.Log($"Loaded and sorted streams for {Name}", true);
}
catch (Exception e)
{
Logger.Log($"Failed to initialized MediaFile: {e.Message}", true);
Logger.Log($"Failed to initialize MediaFile: {e.Message}", true);
}
Initialized = true;

View File

@@ -2,15 +2,33 @@
{
class QueryInfo
{
public string path;
public long filesize;
public string cmd = null;
public string Path;
public long SizeBytes;
public string Command = "";
public QueryInfo(string path, long filesize, string cmd = null)
public QueryInfo(string path, long filesize = 0, string cmd = "")
{
this.path = path;
this.filesize = filesize;
this.cmd = cmd;
Path = path;
SizeBytes = filesize;
Command = cmd;
}
public override bool Equals(object obj)
{
if (obj is QueryInfo other)
return Path == other.Path && SizeBytes == other.SizeBytes;
return false;
}
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 31 + (Path?.GetHashCode() ?? 0);
hash = hash * 31 + SizeBytes.GetHashCode();
return hash;
}
}
}
}