Skip to content

Commit

Permalink
Code Quality
Browse files Browse the repository at this point in the history
  • Loading branch information
odalet-addup committed Nov 15, 2023
1 parent 591221f commit 43e0795
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
18 changes: 4 additions & 14 deletions src/Delta.CertXplorer.Common/UI/ChooseDocumentHandlerDialog.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -13,22 +9,16 @@ namespace Delta.CertXplorer.UI
internal partial class ChooseDocumentHandlerDialog : Form
{
private IEnumerable<IDocumentHandler> handlers;
private List<RadioButton> buttons = new List<RadioButton>();
private readonly List<RadioButton> 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<IDocumentHandler> documentHandlers)
{
Expand Down
12 changes: 1 addition & 11 deletions src/Delta.CertXplorer.Common/UI/HexViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -1430,11 +1425,6 @@ public long Find(byte[] bytes, long startIndex)
return -1;
}

/// <summary>
/// Aborts a working Find method.
/// </summary>
public void AbortFind() { abortFind = true; }

#endregion

#region Copy, Cut and Paste methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 43e0795

Please sign in to comment.