Skip to content

Commit a0f0f32

Browse files
author
Sébastien Geiser
committed
refactoring
1 parent 9dce12f commit a0f0f32

17 files changed

+159
-159
lines changed

CSharpRegexTools4Npp/Main.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ internal static void SetToolBarIcon()
8181
&& int.TryParse(Npp.NotepadPP.NppBinVersion.Split('.')[0], out int majorVersion)
8282
&& majorVersion >= 8)
8383
{
84-
toolbarIconsWithDarkMode tbIcons = new toolbarIconsWithDarkMode
84+
toolbarIconsWithDarkMode tbIcons = new()
8585
{
8686
hToolbarBmp = tbBmp.GetHbitmap(),
8787
hToolbarIcon = tbBmp.GetHicon(),
@@ -95,7 +95,7 @@ internal static void SetToolBarIcon()
9595
}
9696
else
9797
{
98-
toolbarIcons tbIcons = new toolbarIcons
98+
toolbarIcons tbIcons = new()
9999
{
100100
hToolbarBmp = tbBmp.GetHbitmap(),
101101
hToolbarIcon = tbBmp.GetHicon(),
@@ -120,7 +120,7 @@ private static async void CheckUpdates(RegExToolDialog dialog)
120120

121121
try
122122
{
123-
HttpClient client = new HttpClient();
123+
HttpClient client = new();
124124
client.DefaultRequestHeaders.Add("Accept-Language", "en-US;q=0.5,en;q=0.3");
125125
client.DefaultRequestHeaders.Add("User-Agent", "C# App");
126126

CSharpRegexTools4Npp/Npp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class Npp
88
{
99
public static NotepadPPGateway NotepadPP { get; } = new NotepadPPGateway();
1010

11-
public static ScintillaGateway Scintilla => new ScintillaGateway(PluginBase.GetCurrentScintilla());
11+
public static ScintillaGateway Scintilla => new(PluginBase.GetCurrentScintilla());
1212

1313
/// <summary>
1414
/// Récupère les caractères de fin de lignes courant

CSharpRegexTools4Npp/PluginInfrastructure/ClikeStringArray.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ClikeStringArray(List<string> lstStrings)
4141
public List<string> ManagedStringsUnicode { get { return _getManagedItems(true); } }
4242
List<string> _getManagedItems(bool unicode)
4343
{
44-
List<string> _managedItems = new List<string>();
44+
List<string> _managedItems = new();
4545
for (int i = 0; i < _nativeItems.Count; i++)
4646
{
4747
if (unicode) _managedItems.Add(Marshal.PtrToStringUni(_nativeItems[i]));

CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace CSharpRegexTools4Npp.PluginInfrastructure
66
public class PluginBase
77
{
88
public static NppData nppData;
9-
public static FuncItems _funcItems = new FuncItems();
9+
public static FuncItems _funcItems = new();
1010

1111
public static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer)
1212
{
@@ -25,7 +25,7 @@ public static void SetCommand(int index, string commandName, NppFuncItemDelegate
2525

2626
public static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut, bool checkOnInit)
2727
{
28-
FuncItem funcItem = new FuncItem
28+
FuncItem funcItem = new()
2929
{
3030
_cmdID = index,
3131
_itemName = commandName

CSharpRegexTools4Npp/PluginInfrastructure/NppPluginNETHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void RefreshItems()
125125
IntPtr ptrPosItem = _nativePointer;
126126
for (int i = 0; i < _funcItems.Count; i++)
127127
{
128-
FuncItem updatedItem = new FuncItem();
128+
FuncItem updatedItem = new();
129129
updatedItem._itemName = _funcItems[i]._itemName;
130130
ptrPosItem = (IntPtr)(ptrPosItem.ToInt64() + 128);
131131
updatedItem._pFunc = _funcItems[i]._pFunc;

CSharpRegexTools4Npp/PluginInfrastructure/ScintillaGateway.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public int GetCurrentLineNumber()
7676
/// <returns>A ScrollInfo struct with information of the current scroll state</returns>
7777
public ScrollInfo GetScrollInfo(ScrollInfoMask mask = ScrollInfoMask.SIF_ALL, ScrollInfoBar scrollBar = ScrollInfoBar.SB_BOTH)
7878
{
79-
ScrollInfo scrollInfo = new ScrollInfo();
79+
ScrollInfo scrollInfo = new();
8080
scrollInfo.cbSize = (uint)Marshal.SizeOf(scrollInfo);
8181
scrollInfo.fMask = (uint)mask;
8282
Win32.GetScrollInfo(scintilla, (int)scrollBar, ref scrollInfo);

RegexDialog/Model/ExcelSheetSelection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ namespace RegexDialog
1212
{
1313
public class ExcelSheetSelection : NotifyPropertyChangedBaseClass
1414
{
15-
private readonly static Regex simpleCellRegex = new Regex("^[A-Z]+[1-9][0-9]*$", RegexOptions.Compiled);
16-
private readonly static Regex simpleColumnRegex = new Regex("^[A-Z]+$", RegexOptions.Compiled);
17-
private readonly static Regex simpleRowRegex = new Regex("^[1-9][0-9]*$", RegexOptions.Compiled);
18-
private readonly static Regex rangeRegex = new Regex("^[A-Z]+([1-9][0-9]*)?:[A-Z]+([1-9][0-9]*)?|[1-9][0-9]*:[1-9][0-9]*$", RegexOptions.Compiled);
19-
private readonly static Regex evaluatedExpressionRegex = new Regex(@"\{(?<expression>[^\}]*)\}", RegexOptions.Compiled);
15+
private readonly static Regex simpleCellRegex = new("^[A-Z]+[1-9][0-9]*$", RegexOptions.Compiled);
16+
private readonly static Regex simpleColumnRegex = new("^[A-Z]+$", RegexOptions.Compiled);
17+
private readonly static Regex simpleRowRegex = new("^[1-9][0-9]*$", RegexOptions.Compiled);
18+
private readonly static Regex rangeRegex = new("^[A-Z]+([1-9][0-9]*)?:[A-Z]+([1-9][0-9]*)?|[1-9][0-9]*:[1-9][0-9]*$", RegexOptions.Compiled);
19+
private readonly static Regex evaluatedExpressionRegex = new(@"\{(?<expression>[^\}]*)\}", RegexOptions.Compiled);
2020

2121
public bool IsSelected { get; set; } = true;
2222
public string Name { get; set; } = string.Empty;
@@ -78,7 +78,7 @@ public IEnumerable<IXLCell> GetCells(IXLWorksheet sheet)
7878

7979
private string InterpretStuffInFilter(string filter, IXLWorksheet sheet)
8080
{
81-
ExpressionEvaluator evaluator = new ExpressionEvaluator(new Dictionary<string, object>()
81+
ExpressionEvaluator evaluator = new(new Dictionary<string, object>()
8282
{
8383
{ "FR", sheet.FirstRowUsed().RangeAddress.FirstAddress.RowNumber },
8484
{ "LR", sheet.LastRowUsed().RangeAddress.FirstAddress.RowNumber },

0 commit comments

Comments
 (0)