Skip to content

Commit d5840e9

Browse files
authored
Merge pull request #496 from TheJoeFin/dev
4.6.0 from dev
2 parents 8020978 + 7a1e6f1 commit d5840e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+757
-497
lines changed

.editorconfig

+76-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1-
# Remove the line below if you want to inherit .editorconfig settings from higher directories
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# Remove the line below if you want to inherit '.editorconfig' settings from higher directories
24
root = true
35

6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
12+
tab_width = 4
13+
end_of_line = crlf
14+
dotnet_style_coalesce_expression = true:suggestion
15+
dotnet_style_null_propagation = true:suggestion
16+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
17+
dotnet_style_prefer_auto_properties = true:silent
18+
dotnet_style_object_initializer = true:suggestion
19+
20+
[*.{yml,yaml,appxmanifest,manifest,config}]
21+
indent_style = space
22+
indent_size = 2
23+
24+
# Files that require CRLF line endings
25+
[*.{bat,cmd,wapproj}]
26+
end_of_line = crlf
27+
indent_style = space
28+
indent_size = 4
29+
30+
[*.{sln,props}]
31+
indent_style = tab
32+
indent_size = 8
33+
434
# C# files
535
[*.cs]
636

@@ -13,7 +43,6 @@ tab_width = 4
1343

1444
# New line preferences
1545
end_of_line = crlf
16-
insert_final_newline = false
1746

1847
#### .NET Coding Conventions ####
1948

@@ -82,14 +111,14 @@ csharp_style_var_for_built_in_types = false:suggestion
82111
csharp_style_var_when_type_is_apparent = false:suggestion
83112

84113
# Expression-bodied members
85-
csharp_style_expression_bodied_accessors = true
86-
csharp_style_expression_bodied_constructors = false
87-
csharp_style_expression_bodied_indexers = true
88-
csharp_style_expression_bodied_lambdas = true
89-
csharp_style_expression_bodied_local_functions = false
90-
csharp_style_expression_bodied_methods = false
91-
csharp_style_expression_bodied_operators = false
92-
csharp_style_expression_bodied_properties = true
114+
csharp_style_expression_bodied_accessors = true:silent
115+
csharp_style_expression_bodied_constructors = false:silent
116+
csharp_style_expression_bodied_indexers = true:silent
117+
csharp_style_expression_bodied_lambdas = true:silent
118+
csharp_style_expression_bodied_local_functions = false:silent
119+
csharp_style_expression_bodied_methods = false:silent
120+
csharp_style_expression_bodied_operators = false:silent
121+
csharp_style_expression_bodied_properties = true:silent
93122

94123
# Pattern matching preferences
95124
csharp_style_pattern_matching_over_as_with_null_check = true
@@ -109,12 +138,12 @@ csharp_style_prefer_readonly_struct = true
109138
csharp_style_prefer_readonly_struct_member = true
110139

111140
# Code-block preferences
112-
csharp_prefer_braces = when_multiline
113-
csharp_prefer_simple_using_statement = true
114-
csharp_style_namespace_declarations = file_scoped
115-
csharp_style_prefer_method_group_conversion = true
116-
csharp_style_prefer_primary_constructors = true
117-
csharp_style_prefer_top_level_statements = true
141+
csharp_prefer_braces = when_multiline:silent
142+
csharp_prefer_simple_using_statement = true:suggestion
143+
csharp_style_namespace_declarations = file_scoped:silent
144+
csharp_style_prefer_method_group_conversion = true:silent
145+
csharp_style_prefer_primary_constructors = true:suggestion
146+
csharp_style_prefer_top_level_statements = true:silent
118147

119148
# Expression-level preferences
120149
csharp_prefer_simple_default_expression = true
@@ -132,7 +161,7 @@ csharp_style_unused_value_assignment_preference = discard_variable
132161
csharp_style_unused_value_expression_statement_preference = discard_variable
133162

134163
# 'using' directive preferences
135-
csharp_using_directive_placement = outside_namespace
164+
csharp_using_directive_placement = outside_namespace:silent
136165

137166
# New line preferences
138167
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
@@ -208,24 +237,46 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
208237

209238
dotnet_naming_symbols.interface.applicable_kinds = interface
210239
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
211-
dotnet_naming_symbols.interface.required_modifiers =
240+
dotnet_naming_symbols.interface.required_modifiers =
212241

213242
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
214243
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
215-
dotnet_naming_symbols.types.required_modifiers =
244+
dotnet_naming_symbols.types.required_modifiers =
216245

217246
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
218247
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
219-
dotnet_naming_symbols.non_field_members.required_modifiers =
248+
dotnet_naming_symbols.non_field_members.required_modifiers =
220249

221250
# Naming styles
222251

223-
dotnet_naming_style.pascal_case.required_prefix =
224-
dotnet_naming_style.pascal_case.required_suffix =
225-
dotnet_naming_style.pascal_case.word_separator =
252+
dotnet_naming_style.pascal_case.required_prefix =
253+
dotnet_naming_style.pascal_case.required_suffix =
254+
dotnet_naming_style.pascal_case.word_separator =
226255
dotnet_naming_style.pascal_case.capitalization = pascal_case
227256

228257
dotnet_naming_style.begins_with_i.required_prefix = I
229-
dotnet_naming_style.begins_with_i.required_suffix =
230-
dotnet_naming_style.begins_with_i.word_separator =
258+
dotnet_naming_style.begins_with_i.required_suffix =
259+
dotnet_naming_style.begins_with_i.word_separator =
231260
dotnet_naming_style.begins_with_i.capitalization = pascal_case
261+
262+
dotnet_diagnostic.CA1069.severity = none # CA1069: Enums values should not be duplicated
263+
dotnet_diagnostic.CA2211.severity = none
264+
dotnet_diagnostic.CA1806.severity = none
265+
dotnet_diagnostic.CA1016.severity = none
266+
dotnet_diagnostic.CA1806.severity = none
267+
dotnet_diagnostic.CA1822.severity = none
268+
dotnet_diagnostic.CA1845.severity = none
269+
dotnet_diagnostic.CA1513.severity = none
270+
dotnet_diagnostic.CA1859.severity = none
271+
dotnet_diagnostic.CA1854.severity = none
272+
dotnet_diagnostic.NU1503.severity = none
273+
dotnet_diagnostic.CA1869.severity = none
274+
dotnet_diagnostic.CA1067.severity = none
275+
dotnet_diagnostic.IDE0011.severity = none
276+
dotnet_diagnostic.IDE0060.severity = none
277+
dotnet_diagnostic.IDE0059.severity = none
278+
dotnet_diagnostic.IDE0055.severity = none
279+
dotnet_diagnostic.CA2263.severity = none
280+
dotnet_diagnostic.IDE0051.severity = none
281+
dotnet_diagnostic.IDE0052.severity = none
282+
dotnet_diagnostic.CS1591.severity = none

Tests/FilesIoTests.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Drawing;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
1+
using System.Drawing;
72
using Text_Grab;
83
using Text_Grab.Utilities;
94

@@ -16,7 +11,7 @@ public class FilesIoTests
1611
[WpfFact]
1712
public async Task CanSaveImagesWithHistory()
1813
{
19-
Bitmap fontSampleBitmap = new Bitmap(FileUtilities.GetPathToLocalFile(fontSamplePath));
14+
Bitmap fontSampleBitmap = new(FileUtilities.GetPathToLocalFile(fontSamplePath));
2015

2116
bool couldSave = await FileUtilities.SaveImageFile(fontSampleBitmap, "newTest.png", FileStorageKind.WithHistory);
2217

Tests/Images/GUIDs.png

62.2 KB
Loading

Tests/OcrTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ public async Task GetTessLanguages()
256256
Assert.Contains(tag, actualStrings);
257257
}
258258
}
259-
260-
[WpfFact(Skip ="fails GitHub actions")]
259+
260+
[WpfFact(Skip = "fails GitHub actions")]
261261
public async Task GetTesseractStrongLanguages()
262262
{
263263
List<ILanguage> expectedList = new()

Tests/QrCodeTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class QrCodeTests
99
public void generateSvgImage()
1010
{
1111
string testString = "This is only a test";
12-
var svg = BarcodeUtilities.GetSvgQrCodeForText(testString, ErrorCorrectionLevel.L);
12+
ZXing.Rendering.SvgRenderer.SvgImage svg = BarcodeUtilities.GetSvgQrCodeForText(testString, ErrorCorrectionLevel.L);
1313

1414
Assert.NotNull(svg);
1515
}

Tests/StringMethodTests.cs

+35-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Text;
22
using Text_Grab;
3-
using System.Linq;
43
using Text_Grab.Utilities;
54

65
namespace Tests;
@@ -95,7 +94,7 @@ public void TryFixToLetters_ReplacesDigitsWithLetters_AsExpected(string input, s
9594
}
9695

9796
[Theory]
98-
[InlineData("","")]
97+
[InlineData("", "")]
9998
[InlineData("he11o there", "hello there")]
10099
[InlineData("my number is l23456789o", "my number is 1234567890")]
101100
public void TryFixNumOrLetters(string input, string expected)
@@ -412,4 +411,37 @@ public void TestLimitEachLine(string inputString, string expected, int charLimit
412411
{
413412
Assert.Equal(expected, inputString.LimitCharactersPerLine(charLimit, spotInLine));
414413
}
415-
}
414+
415+
private string actualGuids = """
416+
97a56312-d8e8-4ca5-87fa-18e35266d31e
417+
bdc5a5f2-d6ff-403d-a632-f9006387e149
418+
aeef14aa-9aff-4f0d-8ca5-e5df1b399c20
419+
c702f24c-e51b-4ebd-bb45-56df08266e80
420+
a87f9201-a046-425d-b92b-b488667a5d92
421+
bc656414-4f2a-4219-b763-810632a535e2
422+
11c5ecc4-0c0a-4606-a54f-16df976637d1
423+
5cec5cc9-782d-47aa-bff3-c84e13a81604
424+
8501db7b-ee04-4fb2-8516-f5e2f0bc71bf
425+
8da03c16-6d3f-4750-831b-c3866af85551
426+
03d82c33-489c-41b2-8222-cc489d00b1bf
427+
edf3b5ee-658e-41ea-8f7a-494a07beb322
428+
4418874a-30c7-4a16-aba5-0f2a0c49b4f9
429+
d4144186-4fad-40a0-bda9-7e3a2ea58a48
430+
486d81d0-0d56-466b-856c-0bc37e897b7b
431+
935155d5-1a96-4901-8b7d-23854fceb32d
432+
ff826fac-d166-441e-8040-05218989e805
433+
0a4ed755-f236-4e10-8b0b-592a527bb560
434+
9be83ad8-5e2d-4e37-a9f5-9b728cd9b934
435+
926ef504-264d-4762-b781-8813156eaa86
436+
""";
437+
438+
439+
[Theory]
440+
[InlineData("g7a56312-d8e8-4ca5-87fa-18e3S266d3le", "97a56312-d8e8-4ca5-87fa-18e35266d31e")]
441+
[InlineData("g7a56312-d8e 8-4ca5-87fa-18e3S2 66d3le", "97a56312-d8e8-4ca5-87fa-18e35266d31e")]
442+
[InlineData("g7a56312-\r\nd8e8\r\n-4ca5-87fa-18e3S266d3le", "97a56312-d8e8-4ca5-87fa-18e35266d31e")]
443+
public void TestGuidCorrections(string input, string expected)
444+
{
445+
Assert.Equal(expected, input.CorrectCommonGuidErrors());
446+
}
447+
}

Tests/Tests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
13-
<PackageReference Include="xunit" Version="2.9.0" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.24">
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
13+
<PackageReference Include="xunit" Version="2.9.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.42">
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
<PrivateAssets>all</PrivateAssets>
1717
</PackageReference>

Text-Grab-Package/Package.appxmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Identity
1212
Name="40087JoeFinApps.TextGrab"
1313
Publisher="CN=153F3B0F-BA3D-4964-8098-71AC78A1DF6A"
14-
Version="4.5.1.0" />
14+
Version="4.6.0.0" />
1515

1616
<Properties>
1717
<DisplayName>Text Grab</DisplayName>

Text-Grab-Package/Text-Grab-Package.wapproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
6464
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
6565
<GenerateTestArtifacts>True</GenerateTestArtifacts>
66-
<AppxBundlePlatforms>x86|x64</AppxBundlePlatforms>
66+
<AppxBundlePlatforms>x86|x64|arm64</AppxBundlePlatforms>
6767
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
6868
</PropertyGroup>
6969
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">

Text-Grab/App.xaml.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public partial class App : System.Windows.Application
2727
{
2828
#region Fields
2929

30-
readonly static Settings _defaultSettings = AppUtilities.TextGrabSettings;
30+
private static readonly Settings _defaultSettings = AppUtilities.TextGrabSettings;
3131

3232
#endregion Fields
3333

@@ -232,7 +232,7 @@ private void appExit(object sender, ExitEventArgs e)
232232
Singleton<HistoryService>.Instance.WriteHistory();
233233
}
234234

235-
async void appStartup(object sender, StartupEventArgs e)
235+
private async void appStartup(object sender, StartupEventArgs e)
236236
{
237237
NumberOfRunningInstances = Process.GetProcessesByName("Text-Grab").Length;
238238
Current.DispatcherUnhandledException += CurrentDispatcherUnhandledException;

Text-Grab/Controls/AddOrRemoveWindow.xaml.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Windows;
33
using System.Windows.Controls;
44
using System.Windows.Input;
5-
using Windows.Graphics.Printing.Workflow;
65

76
namespace Text_Grab.Controls;
87

Text-Grab/Controls/CollapsibleButton.xaml.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.ComponentModel;
22
using System.Runtime.CompilerServices;
33
using System.Windows;
4-
using System.Windows.Controls;
54
using Text_Grab.Models;
65
using Wpf.Ui.Controls;
76

Text-Grab/Controls/FindAndReplaceWindow.xaml.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4-
using System.Linq;
54
using System.Text;
65
using System.Text.RegularExpressions;
76
using System.Threading.Tasks;
@@ -28,7 +27,7 @@ public partial class FindAndReplaceWindow : FluentWindow
2827
public static RoutedCommand ReplaceAllCmd = new();
2928
public static RoutedCommand ReplaceOneCmd = new();
3029
public static RoutedCommand TextSearchCmd = new();
31-
DispatcherTimer ChangeFindTextTimer = new();
30+
private DispatcherTimer ChangeFindTextTimer = new();
3231
private MatchCollection? Matches;
3332
private string stringFromWindow = "";
3433
private EditTextWindow? textEditWindow;
@@ -171,11 +170,11 @@ private void CopyMatchesCmd_Executed(object sender, ExecutedRoutedEventArgs e)
171170

172171
StringBuilder stringBuilder = new();
173172

174-
var selection = ResultsListView.SelectedItems;
173+
IList selection = ResultsListView.SelectedItems;
175174
if (selection.Count < 2)
176175
selection = ResultsListView.Items;
177176

178-
foreach (var item in selection)
177+
foreach (object? item in selection)
179178
if (item is FindResult findResult)
180179
stringBuilder.AppendLine(findResult.Text);
181180

Text-Grab/Controls/PreviousGrabWindow.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public PreviousGrabWindow(Rect rect)
2020
Left = rect.Left - borderThickness;
2121
Top = rect.Top - borderThickness;
2222

23-
DispatcherTimer timer = new DispatcherTimer();
23+
DispatcherTimer timer = new();
2424
timer.Interval = TimeSpan.FromMilliseconds(500);
2525
timer.Tick += (s, e) => { timer.Stop(); Close(); };
2626
timer.Start();

0 commit comments

Comments
 (0)