Skip to content

Commit 7981287

Browse files
committed
General code cleanup.
1 parent ab50034 commit 7981287

File tree

4 files changed

+58
-14
lines changed

4 files changed

+58
-14
lines changed

GunWin/Program.cs

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,42 @@
1-
using System;
1+
#region BSD 3-Clause License
2+
3+
// <copyright file="Program.cs" company="Edgerunner.org">
4+
// Copyright 2020
5+
// </copyright>
6+
//
7+
// BSD 3-Clause License
8+
//
9+
// Copyright (c) 2020,
10+
// All rights reserved.
11+
//
12+
// Redistribution and use in source and binary forms, with or without
13+
// modification, are permitted provided that the following conditions are met:
14+
//
15+
// 1. Redistributions of source code must retain the above copyright notice, this
16+
// list of conditions and the following disclaimer.
17+
//
18+
// 2. Redistributions in binary form must reproduce the above copyright notice,
19+
// this list of conditions and the following disclaimer in the documentation
20+
// and/or other materials provided with the distribution.
21+
//
22+
// 3. Neither the name of the copyright holder nor the names of its
23+
// contributors may be used to endorse or promote products derived from
24+
// this software without specific prior written permission.
25+
//
26+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
37+
#endregion
38+
39+
using System;
240
using System.IO;
341
using System.Text;
442
using System.Windows.Forms;
@@ -7,17 +45,18 @@
745

846
using Org.Edgerunner.ANTLR4.Tools.Testing.Exceptions;
947
using Org.Edgerunner.ANTLR4.Tools.Testing.Grammar;
48+
using Org.Edgerunner.ANTLR4.Tools.Testing.GrunWin.Properties;
1049

1150
namespace Org.Edgerunner.ANTLR4.Tools.Testing.GrunWin
1251
{
13-
static class Program
52+
internal static class Program
1453
{
1554
/// <summary>
1655
/// The main entry point for the application.
1756
/// </summary>
1857
/// <param name="args">The arguments.</param>
1958
[STAThread]
20-
static void Main(string[] args)
59+
private static void Main(string[] args)
2160
{
2261
Application.EnableVisualStyles();
2362
Application.SetCompatibleTextRenderingDefault(false);
@@ -69,7 +108,7 @@ static void Main(string[] args)
69108
}
70109
catch (Exception ex)
71110
{
72-
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
111+
MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
73112
}
74113
}
75114
}

GunWin/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GunWin/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,7 @@
180180
<data name="SourceLoadErrorTitle" xml:space="preserve">
181181
<value>An error occurred while loading the source</value>
182182
</data>
183+
<data name="Error" xml:space="preserve">
184+
<value>Error</value>
185+
</data>
183186
</root>

GunWin/VisualAnalyzer.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
using System;
4040
using System.Collections.Generic;
41-
using System.Configuration;
4241
using System.Drawing;
4342
using System.IO;
4443
using System.Linq;
@@ -59,7 +58,6 @@
5958
using Microsoft.Msagl.GraphViewerGdi;
6059
using Microsoft.Msagl.Layout.Layered;
6160

62-
using Org.Edgerunner.ANTLR4.Tools.Common;
6361
using Org.Edgerunner.ANTLR4.Tools.Common.Editor;
6462
using Org.Edgerunner.ANTLR4.Tools.Graphing;
6563
using Org.Edgerunner.ANTLR4.Tools.Graphing.Extensions;
@@ -74,7 +72,6 @@
7472
using Org.Edgerunner.ANTLR4.Tools.Testing.GrunWin.Tracing;
7573
using Org.Edgerunner.ANTLR4.Tools.Testing.Monitors;
7674

77-
using Place = FastColoredTextBoxNS.Place;
7875
using Settings = Org.Edgerunner.ANTLR4.Tools.Testing.Configuration.Settings;
7976

8077
namespace Org.Edgerunner.ANTLR4.Tools.Testing.GrunWin
@@ -110,8 +107,6 @@ public partial class VisualAnalyzer : Form
110107

111108
private EditorGuideMonitor _GuideMonitor;
112109

113-
private List<IToken> _HighlightedErrors;
114-
115110
#region Constructors And Finalizers
116111

117112
/// <summary>
@@ -122,7 +117,6 @@ public VisualAnalyzer()
122117
InitializeComponent();
123118

124119
LoadApplicationSettings();
125-
_HighlightedErrors = new List<IToken>();
126120
}
127121

128122
#endregion
@@ -423,6 +417,8 @@ private void SetNewWorkingDirectoryUsingFile(string fileName)
423417
}
424418
}
425419

420+
// ReSharper disable once TooManyDeclarations
421+
// ReSharper disable once ExcessiveIndentation
426422
private void CodeEditor_DragDrop(object sender, DragEventArgs e)
427423
{
428424
if (e.Data.GetDataPresent(DataFormats.Text))
@@ -543,7 +539,7 @@ private IList<SyntaxToken> FindTokensInRange(IList<SyntaxToken> tokens, Range ra
543539
private void GraphZoomTrackBar_ValueChanged(object sender, EventArgs e)
544540
{
545541
if (_Viewer != null)
546-
_Viewer.ZoomF = GraphZoomTrackBar.Value * 0.1 + 1.0;
542+
_Viewer.ZoomF = (GraphZoomTrackBar.Value * 0.1) + 1.0;
547543
}
548544

549545
private void HeuristicHighlightingToolStripMenuItem_Click(object sender, EventArgs e)
@@ -553,10 +549,7 @@ private void HeuristicHighlightingToolStripMenuItem_Click(object sender, EventAr
553549
ColorizeTokens(null);
554550
}
555551
else
556-
{
557552
CodeEditor.ClearStyle(StyleIndex.All);
558-
_HighlightedErrors.Clear();
559-
}
560553
}
561554

562555
private void InitializeGraphCanvas()

0 commit comments

Comments
 (0)