Skip to content

Commit 6ec42dc

Browse files
format
1 parent 09c45a6 commit 6ec42dc

17 files changed

Lines changed: 133 additions & 144 deletions
0 Bytes
Loading
0 Bytes
Loading

CoreBuilder/StringLiteralRewrite.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ internal string Rewrite(string code)
2424

2525
public override SyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node)
2626
{
27-
if (node == null) return null;
27+
if (node == null)
28+
{
29+
return null;
30+
}
2831

2932
if (!node.IsKind(SyntaxKind.StringLiteralExpression))
3033
{

CoreConsole/ConResources.cs

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,57 @@ internal static class ConResources
4141
/// </summary>
4242
internal const int Analyzer = 3;
4343

44+
/// <summary>
45+
/// The resource1
46+
/// </summary>
47+
internal const string ResourceHeader = "header";
48+
49+
internal const string ResourceEventTriggered = "Event triggered. Processing...";
50+
51+
internal const string ResourceEventProcessing = "Event processing completed.";
52+
53+
internal const string ResourceCsExtension = "*.cs";
54+
55+
internal const string ResourceListCmd = "list";
56+
57+
internal const string ResourceInput = "Enter something: ";
58+
59+
internal const string ResourceResxtract = "resxtract";
60+
61+
internal const string ResourceResxtractOutput = "Resxtract operation completed successfully: {0} created.{1}";
62+
63+
internal const string ResourceEventWait = "Event is processing. Please wait...";
64+
65+
internal const string ResourceUsingCmd = "using";
66+
67+
internal const string ErrorDirectory = "Error: Directory path '{0}' does not exist.";
68+
69+
internal const string ErrorProjectPath = "Error: The project path '{0}' does not exist.";
70+
71+
internal const string ErrorDirectoryOutput =
72+
"Error: The directory for output resource file '{0}' does not exist.";
73+
74+
internal const string ErrorAccessFile = "Error accessing output resource file: {0}";
75+
76+
internal const string Resource12 = "The application will close after a short delay.";
77+
internal const string Resource13 = "Error: Command not found.";
78+
internal const string Resource14 = "Directory path is required.";
79+
internal const string Resource15 = "Error: Project path is required.";
80+
internal const string Resource16 = "Resxtract operation completed: No string literals found to extract.";
81+
internal const string Resource17 = " - ";
82+
83+
internal const string Resource19 = "\"";
84+
85+
internal const string Resource20 = "Loaded {0} files to ignore.";
86+
internal const string Resource21 = "Error loading regex pattern: {0}. Exception: {1}";
87+
internal const string Resource22 = "Loaded {0} ignore patterns.";
88+
89+
90+
internal const string Resource28 = "Changed files:{0} - {1}";
91+
internal const string Resource3 = "Invalid arguments or operation.";
92+
internal const string Resource4 = "Press any key to exit...";
93+
internal const string Resource5 = "Core Console Application";
94+
4495
/// <summary>
4596
/// The available commands
4697
/// </summary>
@@ -96,7 +147,7 @@ internal static class ConResources
96147
{
97148
Command = "dryrun",
98149
ParameterCount = 0,
99-
FeedbackId =1,
150+
FeedbackId = 1,
100151
Description =
101152
"Show results and optional run commands"
102153
}
@@ -113,56 +164,5 @@ internal static class ConResources
113164
{ AvailableFeedback.No, " If you want to stop executing the Command type no." }
114165
}
115166
};
116-
117-
/// <summary>
118-
/// The resource1
119-
/// </summary>
120-
internal const string ResourceHeader = "header";
121-
122-
internal const string ResourceEventTriggered = "Event triggered. Processing...";
123-
124-
internal const string ResourceEventProcessing = "Event processing completed.";
125-
126-
internal const string ResourceCsExtension = "*.cs";
127-
128-
internal const string ResourceListCmd = "list";
129-
130-
internal const string ResourceInput = "Enter something: ";
131-
132-
internal const string ResourceResxtract = "resxtract";
133-
134-
internal const string ResourceResxtractOutput = "Resxtract operation completed successfully: {0} created.{1}";
135-
136-
internal const string ResourceEventWait = "Event is processing. Please wait...";
137-
138-
internal const string ResourceUsingCmd = "using";
139-
140-
internal const string ErrorDirectory = "Error: Directory path '{0}' does not exist.";
141-
142-
internal const string ErrorProjectPath = "Error: The project path '{0}' does not exist.";
143-
144-
internal const string ErrorDirectoryOutput = "Error: The directory for output resource file '{0}' does not exist.";
145-
146-
internal const string ErrorAccessFile = "Error accessing output resource file: {0}";
147-
148-
internal const string Resource12 = "The application will close after a short delay.";
149-
internal const string Resource13 = "Error: Command not found.";
150-
internal const string Resource14 = "Directory path is required.";
151-
internal const string Resource15 = "Error: Project path is required.";
152-
internal const string Resource16 = "Resxtract operation completed: No string literals found to extract.";
153-
internal const string Resource17 = " - ";
154-
155-
internal const string Resource19 = "\"";
156-
157-
internal const string Resource20 = "Loaded {0} files to ignore.";
158-
internal const string Resource21 = "Error loading regex pattern: {0}. Exception: {1}";
159-
internal const string Resource22 = "Loaded {0} ignore patterns.";
160-
161-
162-
internal const string Resource28 = "Changed files:{0} - {1}";
163-
internal const string Resource3 = "Invalid arguments or operation.";
164-
internal const string Resource4 = "Press any key to exit...";
165-
internal const string Resource5 = "Core Console Application";
166-
167167
}
168168
}

CoreConsole/Program.cs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* PURPOSE: Basic Console app, to get my own tools running
66
* PROGRAMMER: Peter Geinitz (Wayfarer)
77
*/
8+
89
using System;
910
using System.Collections.Generic;
1011
using System.IO;
@@ -25,22 +26,26 @@ internal static class Program
2526
/// The prompt
2627
/// </summary>
2728
private static Prompt _prompt;
29+
2830
/// <summary>
2931
/// The console lock
3032
/// </summary>
3133
private static readonly object ConsoleLock = new();
34+
3235
/// <summary>
3336
/// The is event triggered
3437
/// </summary>
3538
private static bool _isEventTriggered;
39+
3640
/// <summary>
3741
/// The analyzers
3842
/// </summary>
3943
private static readonly List<ICodeAnalyzer> Analyzers = new();
44+
4045
/// <summary>
4146
/// Defines the entry point of the application.
4247
/// </summary>
43-
/// <param name = "args">The arguments.</param>
48+
/// <param name="args">The arguments.</param>
4449
private static void Main(string[] args)
4550
{
4651
//add our analyzers
@@ -69,7 +74,7 @@ private static void Main(string[] args)
6974
if (args.Length > 3 && File.Exists(args[3]))
7075
{
7176
ignoreList = new List<string>(File.ReadAllLines(args[3]));
72-
Console.WriteLine(string.Format(ConResources.Resource20, ignoreList.Count));
77+
Console.WriteLine(ConResources.Resource20, ignoreList.Count);
7378
}
7479

7580
if (args.Length > 4 && File.Exists(args[4]))
@@ -82,11 +87,11 @@ private static void Main(string[] args)
8287
}
8388
catch (Exception ex)
8489
{
85-
Console.WriteLine(string.Format(ConResources.Resource21, pattern, ex.Message));
90+
Console.WriteLine(ConResources.Resource21, pattern, ex.Message);
8691
}
8792
}
8893

89-
Console.WriteLine(string.Format(ConResources.Resource22, ignorePatterns.Count));
94+
Console.WriteLine(ConResources.Resource22, ignorePatterns.Count);
9095
}
9196

9297
IResourceExtractor resXtractExtractor = new ResXtract(ignoreList, ignorePatterns);
@@ -116,6 +121,7 @@ private static void Initiate()
116121
_prompt.ConsoleInput(ConResources.ResourceUsingCmd);
117122
_prompt.Callback(Environment.NewLine);
118123
_prompt.ConsoleInput(ConResources.ResourceListCmd);
124+
119125
while (true)
120126
{
121127
lock (ConsoleLock)
@@ -139,8 +145,8 @@ private static void Initiate()
139145
/// <summary>
140146
/// Sends the commands.
141147
/// </summary>
142-
/// <param name = "sender">The sender.</param>
143-
/// <param name = "e">The e.</param>
148+
/// <param name="sender">The sender.</param>
149+
/// <param name="e">The e.</param>
144150
private static void SendCommands(object sender, OutCommand e)
145151
{
146152
lock (ConsoleLock)
@@ -157,7 +163,7 @@ private static void SendCommands(object sender, OutCommand e)
157163
/// <summary>
158164
/// Handles the commands.
159165
/// </summary>
160-
/// <param name = "outCommand">The out command.</param>
166+
/// <param name="outCommand">The out command.</param>
161167
private static void HandleCommands(OutCommand outCommand)
162168
{
163169
if (outCommand.Command == -1)
@@ -205,7 +211,7 @@ private static void HandleCommands(OutCommand outCommand)
205211
/// <summary>
206212
/// Handles the header.
207213
/// </summary>
208-
/// <param name = "package">The package.</param>
214+
/// <param name="package">The package.</param>
209215
/// <returns>Added headers.</returns>
210216
private static string HandleHeader(OutCommand package)
211217
{
@@ -227,7 +233,7 @@ private static string HandleHeader(OutCommand package)
227233
/// <summary>
228234
/// Handles the resource xtract.
229235
/// </summary>
230-
/// <param name = "package">The package.</param>
236+
/// <param name="package">The package.</param>
231237
/// <returns>Result of the extraction.</returns>
232238
private static string HandleResxtract(OutCommand package)
233239
{
@@ -262,7 +268,7 @@ private static string HandleResxtract(OutCommand package)
262268
// Optional: warn if file exists
263269
if (File.Exists(outputResourceFile))
264270
{
265-
// Could add a warning here
271+
// Could add a warning here
266272
}
267273
}
268274
catch (Exception ex)
@@ -274,21 +280,24 @@ private static string HandleResxtract(OutCommand package)
274280
var ignoreList = new List<string>();
275281
var ignorePatterns = new List<string>();
276282
IResourceExtractor extractor = new ResXtract(ignoreList, ignorePatterns);
277-
var changedFiles = extractor.ProcessProject(projectPath, outputResourceFile, replace: true); // `null` is okay here
283+
var changedFiles =
284+
extractor.ProcessProject(projectPath, outputResourceFile, replace: true); // `null` is okay here
278285
if (changedFiles.Count == 0)
279286
{
280287
return ConResources.Resource16;
281288
}
282289

283290
var actualOutputFile = changedFiles.Last(); // Last item is outputResourceFile (by design)
284-
var changedFilesList = string.Join(Environment.NewLine + ConResources.Resource17, changedFiles.Take(changedFiles.Count - 1));
285-
return string.Format(ConResources.ResourceResxtractOutput, actualOutputFile, Environment.NewLine) + string.Format(ConResources.Resource28, Environment.NewLine, changedFilesList);
291+
var changedFilesList = string.Join(Environment.NewLine + ConResources.Resource17,
292+
changedFiles.Take(changedFiles.Count - 1));
293+
return string.Format(ConResources.ResourceResxtractOutput, actualOutputFile, Environment.NewLine) +
294+
string.Format(ConResources.Resource28, Environment.NewLine, changedFilesList);
286295
}
287296

288297
/// <summary>
289298
/// Runs the analyzers.
290299
/// </summary>
291-
/// <param name = "package">The package.</param>
300+
/// <param name="package">The package.</param>
292301
/// <returns>Result of code analysis.</returns>
293302
private static string RunAnalyzers(OutCommand package)
294303
{
@@ -338,8 +347,8 @@ private static string CleanPath(string path)
338347
/// <summary>
339348
/// Listen to Messages
340349
/// </summary>
341-
/// <param name = "sender">Object</param>
342-
/// <param name = "e">Type</param>
350+
/// <param name="sender">Object</param>
351+
/// <param name="e">Type</param>
343352
private static void SendLogs(object sender, string e)
344353
{
345354
lock (ConsoleLock)

Imaging/ColorHsv.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public ColorHsv(string hex, int a)
144144
/// <value>
145145
/// The color of the open tk.
146146
/// </value>
147-
public float[] OpenTKColor { get; private set; }
147+
public float[] OpenTkColor { get; private set; }
148148

149149
/// <inheritdoc />
150150
/// <summary>
@@ -505,7 +505,7 @@ private void GetFloatArray()
505505
var normalizedA = Normalize(A);
506506

507507
// Return as float[] in the range [0.0f, 1.0f]
508-
OpenTKColor = new[] { normalizedR, normalizedG, normalizedB, normalizedA };
508+
OpenTkColor = new[] { normalizedR, normalizedG, normalizedB, normalizedA };
509509
}
510510

511511
/// <summary>

Imaging/TextureStream.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ internal static Bitmap GenerateCloudsBitmap(
116116
var turbulenceValue = noiseGen.Turbulence(x, y, turbulenceSize);
117117

118118
// Adjust turbulence value like in the C code (divide by 4)
119-
var L = (byte)Math.Clamp(192 + (int)(turbulenceValue / 4), 192, 230); // Lightness adjustment
119+
var l = (byte)Math.Clamp(192 + (int)(turbulenceValue / 4), 192, 230); // Lightness adjustment
120120

121121
// Set Hue and Saturation (H = 190 for light blue, S = 200 for muted saturation)
122-
var H = 190; // Adjusted Hue value closer to light blue
123-
var S = 200; // Reduced Saturation for a more muted, light blue
122+
var h = 190; // Adjusted Hue value closer to light blue
123+
var s = 200; // Reduced Saturation for a more muted, light blue
124124

125125
// Convert HSL to RGB
126-
var color = HsLtoRgb(H, S, L);
126+
var color = HsLtoRgb(h, s, l);
127127

128128
// Add the pixel data for SIMD processing
129129
pixelData.Add((x, y, color));

InterpreteTests/FeedbackTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
using System.Collections.Generic;
1010
using System.Diagnostics;
11-
using System.Reflection.PortableExecutable;
1211
using Interpreter;
1312
using Microsoft.VisualStudio.TestTools.UnitTesting;
1413

@@ -36,7 +35,7 @@ public sealed class FeedbackTests
3635
internal static readonly Dictionary<int, UserFeedback> Feedback = new() { { 1, ReplaceFeedback } };
3736

3837
/// <summary>
39-
/// The replace feedback
38+
/// The replace feedback
4039
/// </summary>
4140
private static readonly UserFeedback ReplaceFeedback = new()
4241
{
@@ -117,10 +116,12 @@ public void FeedbackExtensionExternal()
117116
{
118117
{ 0, new InCommand { Command = "com1", ParameterCount = 2, Description = "Help com1" } },
119118
{
120-
1, new InCommand { Command = "com2", ParameterCount = 0, Description = "com2 Command Namespace 1" }
119+
1,
120+
new InCommand { Command = "com2", ParameterCount = 0, Description = "com2 Command Namespace 1" }
121121
},
122122
{
123-
2, new InCommand
123+
2,
124+
new InCommand
124125
{
125126
Command = "com3", ParameterCount = 0, Description = "Special case no Parameter"
126127
}
@@ -145,7 +146,7 @@ public void FeedbackExtensionExternal()
145146
var prompt = new Prompt();
146147
prompt.SendLogs += SendLogs;
147148
prompt.SendCommands += SendCommands;
148-
prompt.Initiate(dctCommandOne, "UserSpace 1", extension: extensionCommands, Feedback);
149+
prompt.Initiate(dctCommandOne, "UserSpace 1", extensionCommands, Feedback);
149150
prompt.ConsoleInput("coM1(1,2).Dryrun()");
150151
prompt.ConsoleInput("");
151152

0 commit comments

Comments
 (0)