Skip to content

Commit 7f4400b

Browse files
committed
Merge branch 'Development' into removed_configManager_from_paintHelper
# Conflicts: # src/LogExpert.UI/Extensions/Forms/LineToolStripSeparatorExtension.cs # src/LogExpert.UI/Extensions/Win32.cs # src/LogExpert/Program.cs
2 parents f8e884e + 2783962 commit 7f4400b

Some content is hidden

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

52 files changed

+378
-123
lines changed

src/.editorconfig

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
5050
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
5151

5252
# Modifier preferences
53-
dotnet_style_require_accessibility_modifiers = always:warning
53+
dotnet_style_require_accessibility_modifiers = for_non_interface_members
5454

5555
# Expression-level preferences
5656
dotnet_prefer_system_hash_code = true
@@ -89,7 +89,7 @@ dotnet_style_allow_statement_immediately_after_block_experimental = false:warnin
8989
#### C# Coding Conventions ####
9090

9191
# var preferences
92-
csharp_style_var_elsewhere = false:suggestion
92+
csharp_style_var_elsewhere = true:suggestion
9393
csharp_style_var_for_built_in_types = true:warning
9494
csharp_style_var_when_type_is_apparent = true:warning
9595

@@ -219,8 +219,14 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
219219
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
220220
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
221221

222+
dotnet_naming_rule.no_single_letter_names.severity = error
223+
dotnet_naming_rule.no_single_letter_names.symbols = parameters_and_variables
224+
dotnet_naming_rule.no_single_letter_names.style = descriptive_names
225+
222226
# Symbol specifications
223227

228+
dotnet_naming_symbols.parameters_and_variables.applicable_kinds = parameter, local
229+
224230
dotnet_naming_symbols.interface.applicable_kinds = interface
225231
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
226232
dotnet_naming_symbols.interface.required_modifiers =
@@ -235,6 +241,9 @@ dotnet_naming_symbols.non_field_members.required_modifiers =
235241

236242
# Naming styles
237243

244+
dotnet_naming_style.descriptive_names.capitalization = camel_case
245+
dotnet_naming_style.descriptive_names.minimum_word_length = 2
246+
238247
dotnet_naming_style.pascal_case.required_prefix =
239248
dotnet_naming_style.pascal_case.required_suffix =
240249
dotnet_naming_style.pascal_case.word_separator =
@@ -277,7 +286,7 @@ dotnet_diagnostic.IDE0003.severity = warning
277286
dotnet_diagnostic.IDE0004.severity = warning
278287

279288
# IDE0005: Remove unnecessary import
280-
dotnet_diagnostic.IDE0005.severity = warning
289+
dotnet_diagnostic.IDE0005.severity = none
281290

282291
# IDE0005_gen: Remove unnecessary import (NotConfigurable)
283292
#dotnet_diagnostic.IDE0005_gen.severity = silent
@@ -388,7 +397,7 @@ dotnet_diagnostic.IDE0044.severity = warning
388397
dotnet_diagnostic.IDE0045.severity = warning
389398

390399
# IDE0046: Use conditional expression for return
391-
dotnet_diagnostic.IDE0046.severity = warning
400+
dotnet_diagnostic.IDE0046.severity = suggestion
392401

393402
# IDE0047: Remove unnecessary parentheses
394403
dotnet_diagnostic.IDE0047.severity = warning
@@ -415,7 +424,7 @@ dotnet_diagnostic.IDE0053.severity = suggestion
415424
dotnet_diagnostic.IDE0054.severity = warning
416425

417426
# IDE0055: Fix formatting
418-
dotnet_diagnostic.IDE0055.severity = warning
427+
dotnet_diagnostic.IDE0055.severity = none
419428

420429
# IDE0056: Use index operator
421430
dotnet_diagnostic.IDE0056.severity = warning
@@ -571,7 +580,7 @@ dotnet_code_quality.CA1001.excluded_type_names_with_derived_types =
571580

572581
# CA1002: Do not expose generic lists
573582
dotnet_diagnostic.CA1002.severity = suggestion
574-
dotnet_code_quality.CA1002.api_surface = all
583+
dotnet_code_quality.CA1002.api_surface = public, internal
575584

576585
# CA1003: Use generic event handler instances
577586
dotnet_diagnostic.CA1003.severity = warning
@@ -4865,3 +4874,4 @@ dotnet_diagnostic.xUnit3000.severity = warning
48654874

48664875
# xUnit3001: Classes that implement Xunit.Abstractions.IXunitSerializable must have a public parameterless constructor
48674876
dotnet_diagnostic.xUnit3001.severity = warning
4877+

src/LogExpert.UI/Controls/BufferedDataGridView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace LogExpert.Dialogs;
1111

1212
[SupportedOSPlatform("windows")]
13-
public partial class BufferedDataGridView : DataGridView
13+
internal partial class BufferedDataGridView : DataGridView
1414
{
1515
#region Fields
1616

src/LogExpert.UI/Controls/ColorComboBox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace LogExpert.UI.Controls;
55

66
[SupportedOSPlatform("windows")]
7-
public class ColorComboBox : ComboBox
7+
internal class ColorComboBox : ComboBox
88
{
99
#region Fields
1010

src/LogExpert.UI/Controls/DateTimeDragControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace LogExpert.Dialogs;
1515
/// The control raises events (ValueChanged, ValueDragged) when the date/time changes so that owner can react accordingly.
1616
/// </summary>
1717
[SupportedOSPlatform("windows")]
18-
public partial class DateTimeDragControl : UserControl
18+
internal partial class DateTimeDragControl : UserControl
1919
{
2020
#region Fields
2121

src/LogExpert.UI/Controls/KnobControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace LogExpert.UI.Controls;
66

77
[SupportedOSPlatform("windows")]
8-
public partial class KnobControl : UserControl
8+
internal partial class KnobControl : UserControl
99
{
1010
#region Fields
1111

src/LogExpert.UI/Controls/LogCellEditingControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace LogExpert.UI.Controls;
44

55
[SupportedOSPlatform("windows")]
6-
public class LogCellEditingControl : DataGridViewTextBoxEditingControl
6+
internal class LogCellEditingControl : DataGridViewTextBoxEditingControl
77
{
88
#region Public methods
99

src/LogExpert.UI/Controls/LogGridCell.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace LogExpert.UI.Controls;
55

6-
public class LogGridCell : DataGridViewTextBoxCell
6+
internal class LogGridCell : DataGridViewTextBoxCell
77
{
88
#region Properties
99

src/LogExpert.UI/Controls/LogTextColumn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace LogExpert.UI.Controls;
44

5-
public class LogTextColumn : DataGridViewColumn
5+
internal class LogTextColumn : DataGridViewColumn
66
{
77
#region cTor
88

src/LogExpert.UI/Controls/LogWindow/LogWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace LogExpert.UI.Controls.LogWindow;
2525

2626
//TODO: Implemented 4 interfaces explicitly. Find them by searching: ILogWindow.<method name>
2727
[SupportedOSPlatform("windows")]
28-
public partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, ILogWindow
28+
internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, ILogWindow
2929
{
3030
#region Fields
3131

src/LogExpert.UI/Controls/LogWindow/LogWindowPublic.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Text;
22

33
using LogExpert.Core.Classes;
4-
using LogExpert.Core.Classes.Bookmark;
54
using LogExpert.Core.Classes.Columnizer;
65
using LogExpert.Core.Classes.Filter;
76
using LogExpert.Core.Classes.Highlight;
@@ -11,6 +10,7 @@
1110
using LogExpert.Core.EventArguments;
1211
using LogExpert.Dialogs;
1312
using LogExpert.UI.Entities;
13+
using LogExpert.UI.Extensions;
1414

1515
namespace LogExpert.UI.Controls.LogWindow;
1616

@@ -585,6 +585,28 @@ public void FollowTailChanged (bool isChecked, bool byTrigger)
585585
SendGuiStateUpdate();
586586
}
587587

588+
public void TryToTruncate ()
589+
{
590+
try
591+
{
592+
if (LockFinder.CheckIfFileIsLocked(Title))
593+
{
594+
var name = LockFinder.FindLockedProcessName(Title);
595+
StatusLineText($"Truncate failed: file is locked by {name}");
596+
}
597+
else
598+
{
599+
File.WriteAllText(Title, "");
600+
}
601+
}
602+
catch (Exception ex)
603+
{
604+
_logger.Warn($"Unexpected issue truncating file: {ex.Message}");
605+
StatusLineText("Unexpected issue truncating file");
606+
throw;
607+
}
608+
}
609+
588610
public void GotoLine (int line)
589611
{
590612
if (line >= 0)

0 commit comments

Comments
 (0)