GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixing StyleCop issues. Removing StyleCop form tests. Also adding Sty… · scriptcs/scriptcs@7d1d9b6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • ScriptCs.Contracts
      • Printers.cs
      • ScriptCs.Contracts.csproj
    • ScriptCs.Hosting
      • ScriptConsole.cs
      • ScriptCs.Hosting.csproj
      • VisualStudioSolution.cs
      • VisualStudioSolutionWriter.cs
    • ScriptCs
      • Command
        • ExecuteLooseScriptCommand.cs
        • ExecuteScriptCommand.cs
      • ExecuteScriptCommandBase.cs
  • test
    • ScriptCs.Core.Tests
      • ScriptCs.Core.Tests.csproj
    • ScriptCs.Engine.Mono.Tests
      • ScriptCs.Engine.Mono.Tests.csproj
    • ScriptCs.Engine.Roslyn.Tests
      • ScriptCs.Engine.Roslyn.Tests.csproj
    • ScriptCs.Hosting.Tests
      • ScriptCs.Hosting.Tests.csproj
      • VisualStudioSolutionTests.cs
      • VisualStudioSolutionWriterTests.cs
    • ScriptCs.Tests.Acceptance
      • ScriptCs.Tests.Acceptance.csproj
    • ScriptCs.Tests
      • ScriptCs.Tests.csproj
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/ScriptCs.Contracts/Printers.cs‎

Copy file name to clipboardExpand all lines: src/ScriptCs.Contracts/Printers.cs
+17-15Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,38 @@ namespace ScriptCs.Contracts
55
{
66
public class Printers
77
{
8-
private readonly IObjectSerializer _serializer;
9-
private readonly Dictionary<Type, Func<object, string>> _dictionary = new Dictionary<Type, Func<object, string>>();
10-
public Printers(IObjectSerializer serializer)
11-
{
12-
_serializer = serializer;
13-
}
8+
private readonly IObjectSerializer _serializer;
9+
private readonly Dictionary<Type, Func<object, string>> _dictionary = new Dictionary<Type, Func<object, string>>();
10+
public Printers(IObjectSerializer serializer)
11+
{
12+
_serializer = serializer;
13+
}
1414

1515
public void AddCustomPrinter<T>(Func<T, string> printer)
1616
{
17-
_dictionary[typeof(T)] = x => printer((T) x);
17+
_dictionary[typeof(T)] = x => printer((T)x);
1818
}
1919

20-
private string GetStringFor(Type t, object obj)
20+
private string GetStringFor(Type t, object obj)
2121
{
22-
Func<object, string> printer;
23-
if(_dictionary.TryGetValue(t, out printer)) {
22+
Func<object, string> printer;
23+
if (_dictionary.TryGetValue(t, out printer))
24+
{
2425
return printer(obj);
25-
} else {
26-
return _serializer.Serialize(obj);
27-
}
26+
}
27+
else {
28+
return _serializer.Serialize(obj);
29+
}
2830
}
2931

3032
public string GetStringFor(object obj)
3133
{
32-
return GetStringFor(obj.GetType(), obj);
34+
return GetStringFor(obj.GetType(), obj);
3335
}
3436

3537
public string GetStringFor<T>(T obj)
3638
{
37-
return GetStringFor(typeof(T), obj);
39+
return GetStringFor(typeof(T), obj);
3840
}
3941
}
4042
}
Collapse file

‎src/ScriptCs.Contracts/ScriptCs.Contracts.csproj‎

Copy file name to clipboardExpand all lines: src/ScriptCs.Contracts/ScriptCs.Contracts.csproj
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
<Reference Include="System.Xml" />
4646
</ItemGroup>
4747
<ItemGroup>
48-
<Compile Include="App_Packages\LibLog.4.2\LibLog.cs" />
48+
<Compile Include="App_Packages\LibLog.4.2\LibLog.cs">
49+
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
50+
</Compile>
4951
<Compile Include="AssemblyReferences.cs" />
5052
<Compile Include="BehaviorAfterCode.cs" />
5153
<Compile Include="..\ScriptCs.Core\Guard.cs">
Collapse file

‎src/ScriptCs.Hosting/ScriptConsole.cs‎

Copy file name to clipboardExpand all lines: src/ScriptCs.Hosting/ScriptConsole.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace ScriptCs.Hosting
66
{
77
public class ScriptConsole : IConsole
88
{
9-
LineEditor _editor;
9+
private LineEditor _editor;
1010

1111
public ScriptConsole()
1212
{
Collapse file

‎src/ScriptCs.Hosting/ScriptCs.Hosting.csproj‎

Copy file name to clipboardExpand all lines: src/ScriptCs.Hosting/ScriptCs.Hosting.csproj
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@
9797
<Compile Include="ServiceOverrides.cs" />
9898
<Compile Include="ObjectSerializer.cs" />
9999
<Compile Include="TypeResolver.cs" />
100-
<Compile Include="LineEditor.cs" />
100+
<Compile Include="LineEditor.cs">
101+
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
102+
</Compile>
101103
<Compile Include="VisualStudioSolution.cs" />
102104
<Compile Include="VisualStudioSolutionWriter.cs" />
103105
</ItemGroup>
Collapse file

‎src/ScriptCs.Hosting/VisualStudioSolution.cs‎

Copy file name to clipboardExpand all lines: src/ScriptCs.Hosting/VisualStudioSolution.cs
+47-47Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,103 +9,103 @@ namespace ScriptCs.Hosting
99
{
1010
public class VisualStudioSolution : IVisualStudioSolution
1111
{
12-
internal StringBuilder _header;
13-
internal StringBuilder _projects;
14-
internal StringBuilder _global;
12+
internal StringBuilder Header { get; set; }
13+
internal StringBuilder Projects { get; set; }
14+
internal StringBuilder Global { get; set; }
1515

1616
public VisualStudioSolution()
1717
{
18-
_header = new StringBuilder();
19-
_projects = new StringBuilder();
20-
_global = new StringBuilder();
18+
Header = new StringBuilder();
19+
Projects = new StringBuilder();
20+
Global = new StringBuilder();
2121
AddHeader();
2222
}
2323

2424
public void AddHeader()
2525
{
26-
_header.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
27-
_header.AppendLine("# Visual Studio 2013");
28-
_header.AppendLine("VisualStudioVersion = 12.0.30501.0");
29-
_header.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");
26+
Header.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
27+
Header.AppendLine("# Visual Studio 2013");
28+
Header.AppendLine("VisualStudioVersion = 12.0.30501.0");
29+
Header.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");
3030
}
3131

3232
public void AddScriptcsProject(string scriptcsPath, string workingPath, string args, bool attach, Guid projectGuid)
3333
{
34-
_projects.AppendFormat(@"Project(""{{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}}"") = ""scriptcs"", ""{0}"", ""{{{1}}}""{2}", scriptcsPath, projectGuid, Environment.NewLine);
35-
_projects.AppendLine("\tProjectSection(DebuggerProjectSystem) = preProject");
36-
_projects.AppendLine("\t\tPortSupplier = 00000000-0000-0000-0000-000000000000");
37-
_projects.AppendFormat("\t\tExecutable = {0}{1}", scriptcsPath, Environment.NewLine);
38-
_projects.AppendLine("\t\tRemoteMachine = localhost");
39-
_projects.AppendFormat("\t\tStartingDirectory = {0}{1}", workingPath, Environment.NewLine);
40-
_projects.AppendFormat("\t\tArguments = {0}{1}", args, Environment.NewLine);
41-
_projects.AppendLine("\t\tEnvironment = Default");
42-
_projects.AppendLine("\t\tLaunchingEngine = 00000000-0000-0000-0000-000000000000");
43-
_projects.AppendLine("\t\tUseLegacyDebugEngines = No");
44-
_projects.AppendLine("\t\tLaunchSQLEngine = No");
45-
_projects.AppendFormat("\t\tAttachLaunchAction = {0}{1}", attach == true ? "Yes" : "No", Environment.NewLine);
46-
_projects.AppendLine("\tEndProjectSection");
47-
_projects.AppendLine("EndProject");
34+
Projects.AppendFormat(@"Project(""{{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}}"") = ""scriptcs"", ""{0}"", ""{{{1}}}""{2}", scriptcsPath, projectGuid, Environment.NewLine);
35+
Projects.AppendLine("\tProjectSection(DebuggerProjectSystem) = preProject");
36+
Projects.AppendLine("\t\tPortSupplier = 00000000-0000-0000-0000-000000000000");
37+
Projects.AppendFormat("\t\tExecutable = {0}{1}", scriptcsPath, Environment.NewLine);
38+
Projects.AppendLine("\t\tRemoteMachine = localhost");
39+
Projects.AppendFormat("\t\tStartingDirectory = {0}{1}", workingPath, Environment.NewLine);
40+
Projects.AppendFormat("\t\tArguments = {0}{1}", args, Environment.NewLine);
41+
Projects.AppendLine("\t\tEnvironment = Default");
42+
Projects.AppendLine("\t\tLaunchingEngine = 00000000-0000-0000-0000-000000000000");
43+
Projects.AppendLine("\t\tUseLegacyDebugEngines = No");
44+
Projects.AppendLine("\t\tLaunchSQLEngine = No");
45+
Projects.AppendFormat("\t\tAttachLaunchAction = {0}{1}", attach == true ? "Yes" : "No", Environment.NewLine);
46+
Projects.AppendLine("\tEndProjectSection");
47+
Projects.AppendLine("EndProject");
4848
}
4949

5050
public void AddProject(string path, string name, Guid guid, string[] files)
5151
{
52-
_projects.AppendFormat(@"Project(""{{2150E333-8FDC-42A3-9474-1A3956D46DE8}}"") = ""{0}"", ""{0}"", ""{{{1}}}""{2}", name, guid, Environment.NewLine);
53-
_projects.AppendLine("\tProjectSection(SolutionItems) = preProject");
52+
Projects.AppendFormat(@"Project(""{{2150E333-8FDC-42A3-9474-1A3956D46DE8}}"") = ""{0}"", ""{0}"", ""{{{1}}}""{2}", name, guid, Environment.NewLine);
53+
Projects.AppendLine("\tProjectSection(SolutionItems) = preProject");
5454
foreach (var file in files)
5555
{
5656
if (path == null)
5757
{
58-
_projects.AppendFormat("\t\t{0} = {0}{1}", file, Environment.NewLine);
58+
Projects.AppendFormat("\t\t{0} = {0}{1}", file, Environment.NewLine);
5959
}
6060
else
6161
{
62-
_projects.AppendFormat("\t\t{0}\\{1} = {0}\\{1}{2}", path, file, Environment.NewLine);
62+
Projects.AppendFormat("\t\t{0}\\{1} = {0}\\{1}{2}", path, file, Environment.NewLine);
6363
}
6464
}
65-
_projects.AppendLine("\tEndProjectSection");
66-
_projects.AppendLine("EndProject");
65+
Projects.AppendLine("\tEndProjectSection");
66+
Projects.AppendLine("EndProject");
6767
}
6868

6969
public void AddGlobalHeader(Guid projectGuid)
7070
{
71-
_global.AppendLine ("Global");
72-
_global.AppendLine ("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
73-
_global.AppendLine ("\t\tDebug|Any CPU = Debug|Any CPU");
74-
_global.AppendLine ("\tEndGlobalSection");
75-
_global.AppendLine ("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
76-
_global.AppendFormat("\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU{1}", projectGuid, Environment.NewLine);
77-
_global.AppendLine ("\tEndGlobalSection");
78-
_global.AppendLine ("\tGlobalSection(SolutionProperties) = preSolution");
79-
_global.AppendLine ("\t\tHideSolutionNode = FALSE");
80-
_global.AppendLine ("\tEndGlobalSection");
71+
Global.AppendLine("Global");
72+
Global.AppendLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
73+
Global.AppendLine("\t\tDebug|Any CPU = Debug|Any CPU");
74+
Global.AppendLine("\tEndGlobalSection");
75+
Global.AppendLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
76+
Global.AppendFormat("\t\t{{{0}}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU{1}", projectGuid, Environment.NewLine);
77+
Global.AppendLine("\tEndGlobalSection");
78+
Global.AppendLine("\tGlobalSection(SolutionProperties) = preSolution");
79+
Global.AppendLine("\t\tHideSolutionNode = FALSE");
80+
Global.AppendLine("\tEndGlobalSection");
8181
}
8282

8383
public void AddGlobalNestedProjects(IList<ProjectItem> nestedItems)
8484
{
8585
if (nestedItems.Any())
8686
{
87-
_global.AppendLine("\tGlobalSection(NestedProjects) = preSolution");
87+
Global.AppendLine("\tGlobalSection(NestedProjects) = preSolution");
8888
foreach (var item in nestedItems)
8989
{
90-
_global.AppendFormat("\t\t{{{0}}} = {{{1}}}{2}", item.Project, item.Parent, Environment.NewLine);
90+
Global.AppendFormat("\t\t{{{0}}} = {{{1}}}{2}", item.Project, item.Parent, Environment.NewLine);
9191
}
92-
_global.AppendLine("\tEndGlobalSection");
92+
Global.AppendLine("\tEndGlobalSection");
9393
}
9494
}
9595

9696
public void AddGlobal(Guid projectGuid, IList<ProjectItem> nestedItems)
9797
{
9898
AddGlobalHeader(projectGuid);
9999
AddGlobalNestedProjects(nestedItems);
100-
_global.AppendLine("EndGlobal");
100+
Global.AppendLine("EndGlobal");
101101
}
102102

103103
public override string ToString()
104104
{
105105
var solutionBuilder = new StringBuilder();
106-
solutionBuilder.Append(_header);
107-
solutionBuilder.Append(_projects);
108-
solutionBuilder.Append(_global);
106+
solutionBuilder.Append(Header);
107+
solutionBuilder.Append(Projects);
108+
solutionBuilder.Append(Global);
109109
return solutionBuilder.ToString();
110110
}
111111
}
Collapse file

‎src/ScriptCs.Hosting/VisualStudioSolutionWriter.cs‎

Copy file name to clipboardExpand all lines: src/ScriptCs.Hosting/VisualStudioSolutionWriter.cs
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ScriptCs.Hosting
1010
{
1111
public class VisualStudioSolutionWriter : IVisualStudioSolutionWriter
1212
{
13-
internal DirectoryInfo _root;
13+
internal DirectoryInfo Root { get; set; }
1414
private Guid _nullGuid = new Guid();
1515

1616
public string WriteSolution(IFileSystem fs, string script, IVisualStudioSolution solution, IList<ProjectItem> nestedItems = null)
@@ -30,12 +30,12 @@ public string WriteSolution(IFileSystem fs, string script, IVisualStudioSolution
3030
var currentDir = fs.CurrentDirectory;
3131
var scriptcsPath = Path.Combine(fs.HostBin, "scriptcs.exe");
3232
var scriptcsArgs = string.Format("{0} -debug -loglevel info", script);
33-
_root = new DirectoryInfo { Name = "Solution Items", FullPath = currentDir};
33+
Root = new DirectoryInfo { Name = "Solution Items", FullPath = currentDir};
3434
var projectGuid = Guid.NewGuid();
3535

3636
solution.AddScriptcsProject(scriptcsPath, currentDir, scriptcsArgs, false, projectGuid);
37-
GetDirectoryInfo(fs, currentDir, _root);
38-
AddDirectoryProject(solution, fs, _root, _nullGuid, nestedItems);
37+
GetDirectoryInfo(fs, currentDir, Root);
38+
AddDirectoryProject(solution, fs, Root, _nullGuid, nestedItems);
3939
solution.AddGlobal(projectGuid, nestedItems);
4040
fs.WriteToFile(launcher, solution.ToString());
4141
return launcher;
Collapse file

‎src/ScriptCs/Command/ExecuteLooseScriptCommand.cs‎

Copy file name to clipboardExpand all lines: src/ScriptCs/Command/ExecuteLooseScriptCommand.cs
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ public override CommandResult Execute()
2323
{
2424
try
2525
{
26-
_fileSystemMigrator.Migrate();
26+
FileSystemMigrator.Migrate();
2727

2828
var assemblyPaths = Enumerable.Empty<string>();
29-
var workingDirectory = _fileSystem.CurrentDirectory;
30-
assemblyPaths = _assemblyResolver.GetAssemblyPaths(workingDirectory);
31-
_composer.Compose(workingDirectory);
29+
var workingDirectory = FileSystem.CurrentDirectory;
30+
assemblyPaths = AssemblyResolver.GetAssemblyPaths(workingDirectory);
31+
Composer.Compose(workingDirectory);
3232

33-
_scriptExecutor.Initialize(assemblyPaths, _scriptPackResolver.GetPacks());
33+
ScriptExecutor.Initialize(assemblyPaths, _scriptPackResolver.GetPacks());
3434

3535
// HACK: This is a (dirty) fix for #1086. This might be a temporary solution until some further refactoring can be done.
36-
_scriptExecutor.ScriptEngine.CacheDirectory = Path.Combine(workingDirectory ?? _fileSystem.CurrentDirectory, _fileSystem.DllCacheFolder);
37-
var scriptResult = _scriptExecutor.ExecuteScript(_script, ScriptArgs);
36+
ScriptExecutor.ScriptEngine.CacheDirectory = Path.Combine(workingDirectory ?? FileSystem.CurrentDirectory, FileSystem.DllCacheFolder);
37+
var scriptResult = ScriptExecutor.ExecuteScript(Script, ScriptArgs);
3838
var commandResult = Inspect(scriptResult);
39-
_scriptExecutor.Terminate();
39+
ScriptExecutor.Terminate();
4040
return commandResult;
4141
}
4242
catch (Exception ex)
4343
{
44-
_logger.ErrorException("Error executing script '{0}'", ex, _script);
44+
Logger.ErrorException("Error executing script '{0}'", ex, Script);
4545
return CommandResult.Error;
4646
}
4747
}
Collapse file

‎src/ScriptCs/Command/ExecuteScriptCommand.cs‎

Copy file name to clipboardExpand all lines: src/ScriptCs/Command/ExecuteScriptCommand.cs
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,30 @@ public override CommandResult Execute()
2323
{
2424
try
2525
{
26-
_fileSystemMigrator.Migrate();
26+
FileSystemMigrator.Migrate();
2727

2828
var assemblyPaths = Enumerable.Empty<string>();
29-
var workingDirectory = _fileSystem.GetWorkingDirectory(_script);
29+
var workingDirectory = FileSystem.GetWorkingDirectory(Script);
3030
if (workingDirectory != null)
3131
{
32-
assemblyPaths = _assemblyResolver.GetAssemblyPaths(workingDirectory);
32+
assemblyPaths = AssemblyResolver.GetAssemblyPaths(workingDirectory);
3333
}
3434

35-
_composer.Compose(workingDirectory);
35+
Composer.Compose(workingDirectory);
3636

37-
_scriptExecutor.Initialize(assemblyPaths, _scriptPackResolver.GetPacks(), ScriptArgs);
37+
ScriptExecutor.Initialize(assemblyPaths, _scriptPackResolver.GetPacks(), ScriptArgs);
3838

3939
// HACK: This is a (dirty) fix for #1086. This might be a temporary solution until some further refactoring can be done.
40-
_scriptExecutor.ScriptEngine.CacheDirectory = Path.Combine(workingDirectory ?? _fileSystem.CurrentDirectory, _fileSystem.DllCacheFolder);
41-
var scriptResult = _scriptExecutor.Execute(_script, ScriptArgs);
40+
ScriptExecutor.ScriptEngine.CacheDirectory = Path.Combine(workingDirectory ?? FileSystem.CurrentDirectory, FileSystem.DllCacheFolder);
41+
var scriptResult = ScriptExecutor.Execute(Script, ScriptArgs);
4242

4343
var commandResult = Inspect(scriptResult);
44-
_scriptExecutor.Terminate();
44+
ScriptExecutor.Terminate();
4545
return commandResult;
4646
}
4747
catch (Exception ex)
4848
{
49-
_logger.ErrorException("Error executing script '{0}'", ex, _script);
49+
Logger.ErrorException("Error executing script '{0}'", ex, Script);
5050
return CommandResult.Error;
5151
}
5252
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.