mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-25 04:39:25 +01:00
Console logging improvements, implement Equals/GetHashCode for QueryInfo
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user