Skip to content

Commit 37cda18

Browse files
author
aafent
committed
Usings cleanup
1 parent a63f549 commit 37cda18

9 files changed

Lines changed: 121 additions & 128 deletions

File tree

FAST.FBasic.InteractiveConsole/FBasicIC.cs

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,6 @@ internal partial class FBasicIC
1616
Interpreter basic= null!;
1717
ExecutionResult result = null!;
1818

19-
public FBasicIC(IConfiguration config)
20-
{
21-
this.iCommand = "RUN";
22-
this.config=config;
23-
this.programsFolder=getProgramsFolder();
24-
this.startupName = config.GetValue<string>("Settings:Startup")!;
25-
if (string.IsNullOrEmpty(startupName)) startupName = "helloWorld.bas";
26-
}
27-
28-
29-
public void welcome()
30-
{
31-
Console.WriteLine("FBASIC Interpreter Interactive Console");
32-
Console.WriteLine("......................................");
33-
}
34-
35-
public void help()
36-
{
37-
Console.WriteLine("Help on FBASIC test console");
38-
Console.WriteLine("---------------------------");
39-
Console.WriteLine("RUN | R :: Run the last loaded program");
40-
Console.WriteLine("LOAD | L :: Load a program from the tests folder");
41-
Console.WriteLine("INFO | I :: Get information about the execution, errors, etc");
42-
Console.WriteLine("LIST | :: List the last loaded program");
43-
Console.WriteLine("DIR | :: List all .BAS files in the tests folder");
44-
Console.WriteLine("S | :: Show the reversed source of the last loaded program");
45-
Console.WriteLine("DUMP | D :: Dump the interpreter state");
46-
Console.WriteLine("HELP | ? :: Show this help");
47-
Console.WriteLine("QUIT | Q :: Exit of the test console program");
48-
Console.WriteLine("CLS | :: Clear the screen");
49-
Console.WriteLine();
50-
Console.WriteLine("BC1 | :: Run Business Case 1 - Credit Scoring");
51-
Console.WriteLine();
52-
Console.WriteLine("TP | :: Run Experiment and test programs. Make sense only to the developers of the FBasic");
53-
54-
}
55-
56-
public void ClearScreen()
57-
{
58-
//for (int i = 0; i < 50; i++) Console.WriteLine();
59-
Console.Clear();
60-
}
61-
62-
6319
public void run(string iCommandArg)
6420
{
6521
if (env == null ) setupEnvironment(); // run once
@@ -159,40 +115,6 @@ public void run(string iCommandArg)
159115

160116
}
161117

162-
163-
private void internalInfo()
164-
{
165-
Console.WriteLine($"Folder: {programsFolder}");
166-
Console.WriteLine($"Program: {startupName}");
167-
if (result!=null)
168-
{
169-
var diff= result.programEndWhen - result.programStartWhen;
170-
Console.WriteLine($"Run duration: {diff.ToString("c")} seconds");
171-
}
172-
Console.WriteLine();
173-
#if DEBUG
174-
if (result!=null && result.exception!= null)
175-
{
176-
Console.WriteLine($"Exception:");
177-
string modifiedTrace = StackTraceProcessor.ReplaceFilePathWithFileName(result.exception.StackTrace);
178-
Console.WriteLine(modifiedTrace);
179-
}
180-
#endif
181-
}
182-
183-
184-
private string getProgramsFolder()
185-
{
186-
var progFolder = config.GetValue<string>("Settings:ProgramsFolder")!;
187-
if (string.IsNullOrEmpty(progFolder)) progFolder = @"~\\..\\..\\..\\..\\FAST.FBasic.InteractiveConsole\\Tests";
188-
if (progFolder.Contains("~"))
189-
progFolder = progFolder.Replace("~", Environment.CurrentDirectory);
190-
//return progFolder;
191-
return Path.GetFullPath(progFolder);
192-
}
193-
194-
195-
196118
private void runFBasicProgram()
197119
{
198120

@@ -246,35 +168,5 @@ private void runFBasicProgram()
246168

247169
}
248170

249-
// static void spBuilder()
250-
// {
251-
// var folder = Path.Combine(Environment.CurrentDirectory, @"..\..\..", "FBasicInterpreter", "Tests");
252-
// Console.WriteLine($"Folder: {folder}");
253-
// string name = "lets.bas";
254-
255-
// string cs = "<your CS here>";
256-
// //connectionAdapterForODBC connection = new(cs, dbDialectDetails.sql);
257-
258-
// ExecutionEnvironment env = new();
259-
// env.printHandler += Console.WriteLine;
260-
// env.inputHandler += Console.ReadLine;
261-
// env.callHandler += (name) => { var filepath = Path.Combine(folder, name); return File.ReadAllText(filepath); };
262-
// env.requestForObjectHandler += (context, group, name) =>
263-
// {
264-
// // if ($"{context}.{group}.{name}" == "SQL.CONNECTION.ADAPTER") return connection;
265-
// return null;
266-
// };
267-
268-
// foreach (string file in Directory.GetFiles(folder, name))
269-
// {
270-
// Console.WriteLine("SP BUILDER:");
271-
// Console.WriteLine("---------------------------");
272-
// var program = FBasicSource.ToProgram(file);
273-
// IsourceCodeBuilder builder = new storedProcedureBuilder();
274-
// builder.Build(program);
275-
// var src = builder.GetSource();
276-
// Console.WriteLine(src);
277-
// }
278-
// }
279171
}
280172
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
using Microsoft.Extensions.Configuration;
2+
3+
namespace FAST.FBasic.InteractiveConsole
4+
{
5+
internal partial class FBasicIC
6+
{
7+
public FBasicIC(IConfiguration config)
8+
{
9+
this.iCommand = "RUN";
10+
this.config=config;
11+
this.programsFolder=getProgramsFolder();
12+
this.startupName = config.GetValue<string>("Settings:Startup")!;
13+
if (string.IsNullOrEmpty(startupName)) startupName = "helloWorld.bas";
14+
}
15+
16+
17+
public void welcome()
18+
{
19+
Console.WriteLine("FBASIC Interpreter Interactive Console");
20+
Console.WriteLine("......................................");
21+
}
22+
23+
public void help()
24+
{
25+
Console.WriteLine("Help on FBASIC test console");
26+
Console.WriteLine("---------------------------");
27+
Console.WriteLine("RUN | R :: Run the last loaded program");
28+
Console.WriteLine("LOAD | L :: Load a program from the tests folder");
29+
Console.WriteLine("INFO | I :: Get information about the execution, errors, etc");
30+
Console.WriteLine("LIST | :: List the last loaded program");
31+
Console.WriteLine("DIR | :: List all .BAS files in the tests folder");
32+
Console.WriteLine("S | :: Show the reversed source of the last loaded program");
33+
Console.WriteLine("DUMP | D :: Dump the interpreter state");
34+
Console.WriteLine("HELP | ? :: Show this help");
35+
Console.WriteLine("QUIT | Q :: Exit of the test console program");
36+
Console.WriteLine("CLS | :: Clear the screen");
37+
Console.WriteLine();
38+
Console.WriteLine("BC1 | :: Run Business Case 1 - Credit Scoring");
39+
Console.WriteLine();
40+
Console.WriteLine("TP | :: Run Experiment and test programs. Make sense only to the developers of the FBasic");
41+
42+
}
43+
44+
public void ClearScreen()
45+
{
46+
//for (int i = 0; i < 50; i++) Console.WriteLine();
47+
Console.Clear();
48+
}
49+
50+
51+
52+
53+
private void internalInfo()
54+
{
55+
Console.WriteLine($"Folder: {programsFolder}");
56+
Console.WriteLine($"Program: {startupName}");
57+
if (result!=null)
58+
{
59+
var diff= result.programEndWhen - result.programStartWhen;
60+
Console.WriteLine($"Run duration: {diff.ToString("c")} seconds");
61+
}
62+
Console.WriteLine();
63+
#if DEBUG
64+
if (result!=null && result.exception!= null)
65+
{
66+
Console.WriteLine($"Exception:");
67+
string modifiedTrace = StackTraceProcessor.ReplaceFilePathWithFileName(result.exception.StackTrace);
68+
Console.WriteLine(modifiedTrace);
69+
}
70+
#endif
71+
}
72+
73+
74+
private string getProgramsFolder()
75+
{
76+
var progFolder = config.GetValue<string>("Settings:ProgramsFolder")!;
77+
if (string.IsNullOrEmpty(progFolder)) progFolder = @"~\\..\\..\\..\\..\\FAST.FBasic.InteractiveConsole\\Tests";
78+
if (progFolder.Contains("~"))
79+
progFolder = progFolder.Replace("~", Environment.CurrentDirectory);
80+
//return progFolder;
81+
return Path.GetFullPath(progFolder);
82+
}
83+
84+
85+
// static void spBuilder()
86+
// {
87+
// var folder = Path.Combine(Environment.CurrentDirectory, @"..\..\..", "FBasicInterpreter", "Tests");
88+
// Console.WriteLine($"Folder: {folder}");
89+
// string name = "lets.bas";
90+
91+
// string cs = "<your CS here>";
92+
// //connectionAdapterForODBC connection = new(cs, dbDialectDetails.sql);
93+
94+
// ExecutionEnvironment env = new();
95+
// env.printHandler += Console.WriteLine;
96+
// env.inputHandler += Console.ReadLine;
97+
// env.callHandler += (name) => { var filepath = Path.Combine(folder, name); return File.ReadAllText(filepath); };
98+
// env.requestForObjectHandler += (context, group, name) =>
99+
// {
100+
// // if ($"{context}.{group}.{name}" == "SQL.CONNECTION.ADAPTER") return connection;
101+
// return null;
102+
// };
103+
104+
// foreach (string file in Directory.GetFiles(folder, name))
105+
// {
106+
// Console.WriteLine("SP BUILDER:");
107+
// Console.WriteLine("---------------------------");
108+
// var program = FBasicSource.ToProgram(file);
109+
// IsourceCodeBuilder builder = new storedProcedureBuilder();
110+
// builder.Build(program);
111+
// var src = builder.GetSource();
112+
// Console.WriteLine(src);
113+
// }
114+
// }
115+
}
116+
}

FAST.FBasic.LibraryToolkit/Core/DefaultFileManagementLayer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
namespace FAST.FBasicInterpreter
1+
namespace FAST.FBasicInterpreter
32
{
43
public class DefaultFileManagementLayer : IFBasicFileManagementLayer
54
{

FAST.FBasic.LibraryToolkit/Core/Errors.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System.ComponentModel.Design;
2-
using System.Reflection.Metadata;
3-
4-
namespace FAST.FBasicInterpreter
1+
namespace FAST.FBasicInterpreter
52
{
63
public static class Errors
74
{

FAST.FBasic.LibraryToolkit/Core/InterpreterHelper.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Runtime.CompilerServices;
2-
3-
namespace FAST.FBasicInterpreter
1+
namespace FAST.FBasicInterpreter
42
{
53
/// <summary>
64
/// Helper for the FBasic Interpreter

FAST.FBasic.LibraryToolkit/Interfaces/IFBasicFileManagementLayer.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Runtime.InteropServices;
2-
3-
namespace FAST.FBasicInterpreter
1+
namespace FAST.FBasicInterpreter
42
{
53
public interface IFBasicFileManagementLayer
64
{

FAST.FBasic.TemplatingLibrary/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
This library is depending of the package: DocumentFormat.OpenXml
44

55

6-
7-
8-
9-
106
## Supported Markdown Elements:
117

128
1. **Headings** (H1-H6): `# Heading 1` through `###### Heading 6`

FAST.FBasic.TemplatingLibrary/WordPlaceHolder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using DocumentFormat.OpenXml;
22
using DocumentFormat.OpenXml.Packaging;
33
using DocumentFormat.OpenXml.Wordprocessing;
4-
using System.Text;
54

65
namespace FAST.FBasic.TemplatingLibrary
76
{

FAST.FBasicInterpreter/Core/Interpreter_Extensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Reflection.Emit;
2-
3-
namespace FAST.FBasicInterpreter
1+
namespace FAST.FBasicInterpreter
42
{
53
/// <summary>
64
/// Extensions to the class Interpreter

0 commit comments

Comments
 (0)