From 1af0e3c4aab5567a7c42f9a6033ef6a39c12fbbd Mon Sep 17 00:00:00 2001 From: Enkidu93 Date: Thu, 1 Aug 2024 12:40:05 -0400 Subject: [PATCH] Remove constructor --- .../Corpora/ParatextProjectTextUpdaterBase.cs | 17 +++++++---------- .../ZipParatextProjectTextUpdaterBase.cs | 3 --- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/SIL.Machine/Corpora/ParatextProjectTextUpdaterBase.cs b/src/SIL.Machine/Corpora/ParatextProjectTextUpdaterBase.cs index 1e08242e..7cacc7df 100644 --- a/src/SIL.Machine/Corpora/ParatextProjectTextUpdaterBase.cs +++ b/src/SIL.Machine/Corpora/ParatextProjectTextUpdaterBase.cs @@ -5,16 +5,11 @@ namespace SIL.Machine.Corpora { public abstract class ParatextProjectTextUpdaterBase { - private readonly ParatextProjectSettings _settings; + private readonly ParatextProjectSettingsParserBase _settingsParser; protected ParatextProjectTextUpdaterBase(ParatextProjectSettingsParserBase settingsParser) { - _settings = settingsParser.Parse(); - } - - protected ParatextProjectTextUpdaterBase(ParatextProjectSettings settings) - { - _settings = settings; + _settingsParser = settingsParser; } public string UpdateUsfm( @@ -25,7 +20,9 @@ public string UpdateUsfm( bool preferExistingText = true ) { - string fileName = _settings.GetBookFileName(bookId); + ParatextProjectSettings settings = _settingsParser.Parse(); + + string fileName = settings.GetBookFileName(bookId); if (!Exists(fileName)) return null; @@ -41,8 +38,8 @@ public string UpdateUsfm( stripAllText, preferExistingText: preferExistingText ); - UsfmParser.Parse(usfm, handler, _settings.Stylesheet, _settings.Versification); - return handler.GetUsfm(_settings.Stylesheet); + UsfmParser.Parse(usfm, handler, settings.Stylesheet, settings.Versification); + return handler.GetUsfm(settings.Stylesheet); } protected abstract bool Exists(string fileName); diff --git a/src/SIL.Machine/Corpora/ZipParatextProjectTextUpdaterBase.cs b/src/SIL.Machine/Corpora/ZipParatextProjectTextUpdaterBase.cs index 3cf16a6e..9004d421 100644 --- a/src/SIL.Machine/Corpora/ZipParatextProjectTextUpdaterBase.cs +++ b/src/SIL.Machine/Corpora/ZipParatextProjectTextUpdaterBase.cs @@ -4,8 +4,5 @@ public abstract class ZipParatextProjectTextUpdaterBase : ParatextProjectTextUpd { protected ZipParatextProjectTextUpdaterBase(ZipParatextProjectSettingsParserBase settingsParser) : base(settingsParser) { } - - protected ZipParatextProjectTextUpdaterBase(ParatextProjectSettings settings) - : base(settings) { } } }