diff --git a/SabreTools.Skippers/Rule.cs b/SabreTools.Skippers/Rule.cs index fdf65cb2..4f4f1bb7 100644 --- a/SabreTools.Skippers/Rule.cs +++ b/SabreTools.Skippers/Rule.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Xml.Serialization; -using SabreTools.Logging; using SabreTools.Skippers.Tests; namespace SabreTools.Skippers @@ -85,20 +84,6 @@ namespace SabreTools.Skippers #endregion - #region Logging - - /// - /// Logging object - /// - private readonly Logger logger; - - #endregion - - public Rule() - { - logger = new Logger(this); - } - /// /// Check if a Stream passes all tests in the Rule /// @@ -131,17 +116,11 @@ namespace SabreTools.Skippers { // If the input file doesn't exist if (string.IsNullOrEmpty(input) || !File.Exists(input)) - { - logger.Error($"'{input}' doesn't exist and cannot be transformed!"); return false; - } // If we have an invalid output directory name if (string.IsNullOrEmpty(output)) - { - logger.Error($"Output path was null or empty, cannot write transformed file!"); return false; - } // Create the output directory if it doesn't already string parentDirectory = Path.GetDirectoryName(output) ?? string.Empty; @@ -174,10 +153,7 @@ namespace SabreTools.Skippers // If the input stream isn't valid if (input == null || !input.CanRead) - { - logger.Error("The stream was invalid!"); return false; - } // If the sizes are wrong for the values, fail long extsize = input.Length; @@ -185,7 +161,6 @@ namespace SabreTools.Skippers || (Operation > HeaderSkipOperation.Byteswap && (extsize % 4) != 0) || (Operation > HeaderSkipOperation.Bitswap && (_startOffset == null || _startOffset % 2 != 0))) { - logger.Error("The stream did not have the correct size to be transformed!"); return false; } @@ -194,7 +169,6 @@ namespace SabreTools.Skippers BinaryReader? br = null; try { - logger.User("Applying found rule to input stream"); bw = new BinaryWriter(output); br = new BinaryReader(input); @@ -277,30 +251,21 @@ namespace SabreTools.Skippers } } } - catch (Exception ex) + catch { - logger.Error(ex); return false; } finally { +#if NET40_OR_GREATER // If we're not keeping the read stream open, dispose of the binary reader if (!keepReadOpen) - { -#if NET40_OR_GREATER br?.Dispose(); -#endif - } - // If we're not keeping the write stream open, dispose of the binary reader if (!keepWriteOpen) - { -#if NET40_OR_GREATER bw?.Dispose(); #endif - } - } return success; diff --git a/SabreTools.Skippers/SabreTools.Skippers.csproj b/SabreTools.Skippers/SabreTools.Skippers.csproj index 324a48a7..8186922a 100644 --- a/SabreTools.Skippers/SabreTools.Skippers.csproj +++ b/SabreTools.Skippers/SabreTools.Skippers.csproj @@ -20,10 +20,6 @@ git - - - - diff --git a/SabreTools.Skippers/SkipperMatch.cs b/SabreTools.Skippers/SkipperMatch.cs index aa819ae1..3a801310 100644 --- a/SabreTools.Skippers/SkipperMatch.cs +++ b/SabreTools.Skippers/SkipperMatch.cs @@ -4,7 +4,6 @@ using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using SabreTools.IO; -using SabreTools.Logging; namespace SabreTools.Skippers { @@ -35,15 +34,6 @@ namespace SabreTools.Skippers /// private static readonly string LocalPath = Path.Combine(PathTool.GetRuntimeDirectory(), "Skippers") + Path.DirectorySeparatorChar; - #region Logging - - /// - /// Logging object - /// - private static readonly Logger logger = new(); - - #endregion - /// /// Initialize static fields /// @@ -162,10 +152,7 @@ namespace SabreTools.Skippers { // If the file doesn't exist, return a blank skipper rule if (!File.Exists(input)) - { - logger.Error($"The file '{input}' does not exist so it cannot be tested"); return new Rule(); - } return GetMatchingRule(File.OpenRead(input), skipperName); } @@ -189,9 +176,6 @@ namespace SabreTools.Skippers if (Skippers == null || skipperName == null) return skipperRule; - // Loop through and find a Skipper that has the right name - logger.Verbose("Beginning search for matching header skip rules"); - // Loop through all known Detectors foreach (Detector? skipper in Skippers) { @@ -210,13 +194,6 @@ namespace SabreTools.Skippers // If the Rule is null, make it empty skipperRule ??= new Rule(); - - // If we have a blank rule, inform the user - if (skipperRule.Tests == null) - logger.Verbose("No matching rule found!"); - else - logger.User("Matching rule found!"); - return skipperRule; } }