diff --git a/src/Delta.CertXplorer.Common/UI/ChooseDocumentHandlerDialog.cs b/src/Delta.CertXplorer.Common/UI/ChooseDocumentHandlerDialog.cs index 99d2b8c..cc258ca 100644 --- a/src/Delta.CertXplorer.Common/UI/ChooseDocumentHandlerDialog.cs +++ b/src/Delta.CertXplorer.Common/UI/ChooseDocumentHandlerDialog.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; +using System.Collections.Generic; using System.Drawing; using System.Linq; -using System.Text; using System.Windows.Forms; using Delta.CertXplorer.DocumentModel; @@ -13,22 +9,16 @@ namespace Delta.CertXplorer.UI internal partial class ChooseDocumentHandlerDialog : Form { private IEnumerable handlers; - private List buttons = new List(); + private readonly List buttons = new(); public ChooseDocumentHandlerDialog() { InitializeComponent(); - okButton.Enabled = false; } - public IDocumentHandler SelectedDocumentHandler - { - get - { - return buttons.SingleOrDefault(b => b.Checked).Tag as IDocumentHandler; - } - } + public IDocumentHandler SelectedDocumentHandler => + buttons.SingleOrDefault(b => b.Checked)?.Tag as IDocumentHandler; public void SetDocumentHandlers(IEnumerable documentHandlers) { diff --git a/src/Delta.CertXplorer.Common/UI/HexViewer.cs b/src/Delta.CertXplorer.Common/UI/HexViewer.cs index 15f988d..cb15b73 100644 --- a/src/Delta.CertXplorer.Common/UI/HexViewer.cs +++ b/src/Delta.CertXplorer.Common/UI/HexViewer.cs @@ -1396,13 +1396,8 @@ public long Find(byte[] bytes, long startIndex) int match = 0; int bytesLength = bytes.Length; - abortFind = false; - - for (long pos = startIndex; pos < _byteProvider.Length; pos++) + for (var pos = startIndex; pos < _byteProvider.Length; pos++) { - if (abortFind) - return -2; - if (pos % 1000 == 0) // for performance reasons: DoEvents only 1 times per 1000 loops Application.DoEvents(); @@ -1430,11 +1425,6 @@ public long Find(byte[] bytes, long startIndex) return -1; } - /// - /// Aborts a working Find method. - /// - public void AbortFind() { abortFind = true; } - #endregion #region Copy, Cut and Paste methods diff --git a/src/Delta.CertXplorer.Core/Logging/log4net/Log4NetService.MultiSource.cs b/src/Delta.CertXplorer.Core/Logging/log4net/Log4NetService.MultiSource.cs index 7ee2fa8..78ee494 100644 --- a/src/Delta.CertXplorer.Core/Logging/log4net/Log4NetService.MultiSource.cs +++ b/src/Delta.CertXplorer.Core/Logging/log4net/Log4NetService.MultiSource.cs @@ -7,11 +7,12 @@ partial class Log4NetService : IMultiSourceLogService private string currentSourceName = DefaultSourceName; - public ILogService this[string sourceName] => string.IsNullOrEmpty(sourceName) || sourceName == currentSourceName ? - this : new Log4NetService(configurationFileInfo, false) { currentSourceName = sourceName }; + public ILogService this[LogSource source] => this[source?.Name]; + public ILogService this[string sourceName] => + string.IsNullOrEmpty(sourceName) || sourceName == currentSourceName + ? this + : new Log4NetService(configurationFileInfo, false) { currentSourceName = sourceName }; - public ILogService this[LogSource source] => source != null && source.Name == currentSourceName ? this : this[source.Name]; - - public LogSource CurrentSource => new LogSource(currentSourceName); + public LogSource CurrentSource => new(currentSourceName); } }