mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add static logging to FileTypeTool
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using SabreTools.FileTypes.Aaru;
|
using SabreTools.FileTypes.Aaru;
|
||||||
using SabreTools.FileTypes.Archives;
|
using SabreTools.FileTypes.Archives;
|
||||||
using SabreTools.FileTypes.CHD;
|
using SabreTools.FileTypes.CHD;
|
||||||
using SabreTools.Hashing;
|
using SabreTools.Hashing;
|
||||||
using SabreTools.IO.Extensions;
|
using SabreTools.IO.Extensions;
|
||||||
|
using SabreTools.IO.Logging;
|
||||||
using SabreTools.Matching;
|
using SabreTools.Matching;
|
||||||
using SabreTools.Skippers;
|
using SabreTools.Skippers;
|
||||||
using static SabreTools.FileTypes.Constants;
|
using static SabreTools.FileTypes.Constants;
|
||||||
@@ -12,6 +14,15 @@ namespace SabreTools.FileTypes
|
|||||||
{
|
{
|
||||||
public static class FileTypeTool
|
public static class FileTypeTool
|
||||||
{
|
{
|
||||||
|
#region Logging
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logging object
|
||||||
|
/// </summary>
|
||||||
|
private static readonly Logger _logger = new();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region File Info
|
#region File Info
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -52,10 +63,9 @@ namespace SabreTools.FileTypes
|
|||||||
|
|
||||||
return baseFile;
|
return baseFile;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Exceptions are currently not logged
|
_logger.Error(ex);
|
||||||
// TODO: Log exceptions
|
|
||||||
return new BaseFile();
|
return new BaseFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,10 +106,9 @@ namespace SabreTools.FileTypes
|
|||||||
input.SeekIfPossible();
|
input.SeekIfPossible();
|
||||||
return baseFile;
|
return baseFile;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Exceptions are currently not logged
|
_logger.Error(ex);
|
||||||
// TODO: Log exceptions
|
|
||||||
return new BaseFile();
|
return new BaseFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,10 +254,9 @@ namespace SabreTools.FileTypes
|
|||||||
using Stream stream = File.Open(input, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
using Stream stream = File.Open(input, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
magic = stream.ReadBytes(8);
|
magic = stream.ReadBytes(8);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Exceptions are currently not logged
|
_logger.Error(ex);
|
||||||
// TODO: Log exceptions
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user