mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-01-20 01:22:45 +00:00
sanity checks
This commit is contained in:
parent
14f317ffdc
commit
8794d29976
@ -15,6 +15,12 @@ namespace CompatBot.Utils
|
||||
|
||||
public BufferCopyStream(Stream baseStream, int bufferSize = 4096)
|
||||
{
|
||||
if (baseStream == null)
|
||||
throw new ArgumentNullException(nameof(baseStream));
|
||||
|
||||
if (bufferSize < 1)
|
||||
throw new ArgumentException("Buffer size cannot be non-positive", nameof(bufferSize));
|
||||
|
||||
this.baseStream = baseStream;
|
||||
bufSize = bufferSize;
|
||||
buf = new byte[bufSize];
|
||||
|
@ -471,7 +471,7 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
else
|
||||
msg = $"Log from {member.DisplayName.Sanitize()} | {member.Id}\n";
|
||||
msg += " | " + (source?.SourceType ?? "Unknown source");
|
||||
if (state?.ReadBytes > 0 && source?.LogFileSize > 0)
|
||||
if (state?.ReadBytes > 0 && source?.LogFileSize > 0 && source.LogFileSize < 2L*1024*1024*1024)
|
||||
msg += $" | Parsed {state.ReadBytes * 100.0 / source.LogFileSize:0.##}%";
|
||||
else if (source?.SourceFilePosition > 0 && source.SourceFileSize > 0)
|
||||
msg += $" | Read {source.SourceFilePosition * 100.0 / source.SourceFileSize:0.##}%";
|
||||
|
Loading…
x
Reference in New Issue
Block a user