Skip to content

Commit f0548cc

Browse files
authored
Merge pull request #3 from RTUITLab/develop
v5.0
2 parents eec17da + cf8853c commit f0548cc

23 files changed

+481
-335
lines changed

.config/dotnet-tools.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"isRoot": true,
44
"tools": {
55
"nuke.globaltool": {
6-
"version": "5.0.2",
6+
"version": "8.0.0",
77
"commands": [
88
"nuke"
9-
]
9+
],
10+
"rollForward": false
1011
}
1112
}
1213
}

.editorconfig

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,85 @@ dotnet_analyzer_diagnostic.category-Globalization.severity = suggestion
55

66
# CA1031: Do not catch general exception types
77
dotnet_diagnostic.CA1031.severity = suggestion
8+
csharp_indent_labels = one_less_than_current
9+
csharp_using_directive_placement = outside_namespace:silent
10+
csharp_prefer_simple_using_statement = true:suggestion
11+
csharp_prefer_braces = true:silent
12+
csharp_style_namespace_declarations = file_scoped:silent
13+
csharp_style_prefer_method_group_conversion = true:silent
14+
csharp_style_prefer_top_level_statements = true:silent
15+
csharp_style_prefer_primary_constructors = true:suggestion
16+
csharp_style_expression_bodied_methods = false:silent
17+
csharp_style_expression_bodied_constructors = false:silent
18+
csharp_style_expression_bodied_operators = false:silent
19+
csharp_style_expression_bodied_properties = true:silent
20+
csharp_style_expression_bodied_indexers = true:silent
21+
csharp_style_expression_bodied_accessors = true:silent
22+
csharp_style_expression_bodied_lambdas = true:silent
23+
csharp_style_expression_bodied_local_functions = false:silent
24+
25+
[*.{cs,vb}]
26+
#### Naming styles ####
27+
28+
# Naming rules
29+
30+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
31+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
32+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
33+
34+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
35+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
36+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
37+
38+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
39+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
40+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
41+
42+
# Symbol specifications
43+
44+
dotnet_naming_symbols.interface.applicable_kinds = interface
45+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
46+
dotnet_naming_symbols.interface.required_modifiers =
47+
48+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
49+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
50+
dotnet_naming_symbols.types.required_modifiers =
51+
52+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
53+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
54+
dotnet_naming_symbols.non_field_members.required_modifiers =
55+
56+
# Naming styles
57+
58+
dotnet_naming_style.begins_with_i.required_prefix = I
59+
dotnet_naming_style.begins_with_i.required_suffix =
60+
dotnet_naming_style.begins_with_i.word_separator =
61+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
62+
63+
dotnet_naming_style.pascal_case.required_prefix =
64+
dotnet_naming_style.pascal_case.required_suffix =
65+
dotnet_naming_style.pascal_case.word_separator =
66+
dotnet_naming_style.pascal_case.capitalization = pascal_case
67+
68+
dotnet_naming_style.pascal_case.required_prefix =
69+
dotnet_naming_style.pascal_case.required_suffix =
70+
dotnet_naming_style.pascal_case.word_separator =
71+
dotnet_naming_style.pascal_case.capitalization = pascal_case
72+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
73+
tab_width = 4
74+
indent_size = 4
75+
end_of_line = crlf
76+
dotnet_style_coalesce_expression = true:suggestion
77+
dotnet_style_null_propagation = true:suggestion
78+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
79+
dotnet_style_prefer_auto_properties = true:silent
80+
dotnet_style_object_initializer = true:suggestion
81+
dotnet_style_collection_initializer = true:suggestion
82+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
83+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
84+
dotnet_style_prefer_conditional_expression_over_return = true:silent
85+
dotnet_style_explicit_tuple_names = true:suggestion
86+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
87+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
88+
dotnet_style_prefer_compound_assignment = true:suggestion
89+
dotnet_style_namespace_match_folder = true:suggestion

.nuke

Lines changed: 0 additions & 1 deletion
This file was deleted.

.nuke/build.schema.json

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"$ref": "#/definitions/build",
4+
"title": "Build Schema",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Configuration": {
10+
"type": "string",
11+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
12+
"enum": [
13+
"Debug",
14+
"Release"
15+
]
16+
},
17+
"Continue": {
18+
"type": "boolean",
19+
"description": "Indicates to continue a previously failed build attempt"
20+
},
21+
"Help": {
22+
"type": "boolean",
23+
"description": "Shows the help text for this build assembly"
24+
},
25+
"Host": {
26+
"type": "string",
27+
"description": "Host for execution. Default is 'automatic'",
28+
"enum": [
29+
"AppVeyor",
30+
"AzurePipelines",
31+
"Bamboo",
32+
"Bitbucket",
33+
"Bitrise",
34+
"GitHubActions",
35+
"GitLab",
36+
"Jenkins",
37+
"Rider",
38+
"SpaceAutomation",
39+
"TeamCity",
40+
"Terminal",
41+
"TravisCI",
42+
"VisualStudio",
43+
"VSCode"
44+
]
45+
},
46+
"NoLogo": {
47+
"type": "boolean",
48+
"description": "Disables displaying the NUKE logo"
49+
},
50+
"Partition": {
51+
"type": "string",
52+
"description": "Partition to use on CI"
53+
},
54+
"Plan": {
55+
"type": "boolean",
56+
"description": "Shows the execution plan (HTML)"
57+
},
58+
"Profile": {
59+
"type": "array",
60+
"description": "Defines the profiles to load",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"Root": {
66+
"type": "string",
67+
"description": "Root directory during build execution"
68+
},
69+
"Runtime": {
70+
"type": "string"
71+
},
72+
"Skip": {
73+
"type": "array",
74+
"description": "List of targets to be skipped. Empty list skips all dependencies",
75+
"items": {
76+
"type": "string",
77+
"enum": [
78+
"Clean",
79+
"Compile",
80+
"Publish",
81+
"Restore"
82+
]
83+
}
84+
},
85+
"Solution": {
86+
"type": "string",
87+
"description": "Path to a solution file that is automatically loaded"
88+
},
89+
"Target": {
90+
"type": "array",
91+
"description": "List of targets to be invoked. Default is '{default_target}'",
92+
"items": {
93+
"type": "string",
94+
"enum": [
95+
"Clean",
96+
"Compile",
97+
"Publish",
98+
"Restore"
99+
]
100+
}
101+
},
102+
"Verbosity": {
103+
"type": "string",
104+
"description": "Logging verbosity during build execution. Default is 'Normal'",
105+
"enum": [
106+
"Minimal",
107+
"Normal",
108+
"Quiet",
109+
"Verbose"
110+
]
111+
}
112+
}
113+
}
114+
}
115+
}

.nuke/parameters.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"Solution": "Excursion360.Desktop.sln"
4+
}

Excursion360.Desktop/ConsoleHelper.cs

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,36 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
1+
namespace Excursion360.Desktop;
52

6-
namespace Excursion360.Desktop
3+
public static class ConsoleHelper
74
{
8-
public static class ConsoleHelper
5+
public static int SelectOneFromArray(string headerLine, string[] values)
96
{
10-
public static int SelectOneFromArray(string headerLine, string[] values)
7+
values = values ?? throw new ArgumentNullException(nameof(values));
8+
var index = 0;
9+
while (true)
1110
{
12-
values = values ?? throw new ArgumentNullException(nameof(values));
13-
var index = 0;
14-
while (true)
11+
Console.Clear();
12+
Console.WriteLine(headerLine);
13+
for (int i = 0; i < values.Length; i++)
1514
{
16-
Console.Clear();
17-
Console.WriteLine(headerLine);
18-
for (int i = 0; i < values.Length; i++)
19-
{
20-
Console.BackgroundColor = index == i ? ConsoleColor.White : ConsoleColor.Black;
21-
Console.ForegroundColor = index == i ? ConsoleColor.Black : ConsoleColor.White;
22-
Console.WriteLine(values[i]);
23-
}
24-
Console.BackgroundColor = ConsoleColor.Black;
25-
Console.ForegroundColor = ConsoleColor.White;
26-
var key = Console.ReadKey();
27-
switch (key.Key)
28-
{
29-
case ConsoleKey.UpArrow:
30-
index = index <= 0 ? 0 : index - 1;
31-
break;
32-
case ConsoleKey.DownArrow:
33-
index = index + 1 >= values.Length ? values.Length - 1 : index + 1;
34-
break;
35-
case ConsoleKey.Enter:
36-
return index;
37-
default:
38-
break;
39-
}
15+
Console.BackgroundColor = index == i ? ConsoleColor.White : ConsoleColor.Black;
16+
Console.ForegroundColor = index == i ? ConsoleColor.Black : ConsoleColor.White;
17+
Console.WriteLine(values[i]);
18+
}
19+
Console.BackgroundColor = ConsoleColor.Black;
20+
Console.ForegroundColor = ConsoleColor.White;
21+
var key = Console.ReadKey();
22+
switch (key.Key)
23+
{
24+
case ConsoleKey.UpArrow:
25+
index = index <= 0 ? 0 : index - 1;
26+
break;
27+
case ConsoleKey.DownArrow:
28+
index = index + 1 >= values.Length ? values.Length - 1 : index + 1;
29+
break;
30+
case ConsoleKey.Enter:
31+
return index;
32+
default:
33+
break;
4034
}
4135
}
4236
}

Excursion360.Desktop/Excursion360.Desktop.csproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<TargetFramework>net8.0-windows</TargetFramework>
66
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
79
</PropertyGroup>
810

911
<ItemGroup>
@@ -20,13 +22,13 @@
2022

2123
<ItemGroup>
2224

23-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
25+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
2426
<PrivateAssets>all</PrivateAssets>
2527
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2628
</PackageReference>
27-
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.0" />
28-
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
29-
<PackageReference Include="MintPlayer.PlatformBrowser" Version="1.1.2" />
29+
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
30+
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
31+
<PackageReference Include="MintPlayer.PlatformBrowser" Version="8.0.0" />
3032
</ItemGroup>
3133

3234
</Project>

Excursion360.Desktop/Extensions.cs

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,23 @@
1-
using Microsoft.AspNetCore.Hosting;
2-
using Microsoft.Extensions.Logging;
3-
using Microsoft.Extensions.DependencyInjection;
4-
using System;
5-
using System.Collections.Generic;
6-
using System.Text;
7-
using Microsoft.Extensions.Hosting;
8-
using Microsoft.AspNetCore.Hosting.Server;
1+
using Microsoft.AspNetCore.Hosting.Server;
92
using Microsoft.AspNetCore.Hosting.Server.Features;
10-
using System.Linq;
3+
using Microsoft.AspNetCore.Http.Features;
114

12-
namespace Excursion360.Desktop
5+
namespace Excursion360.Desktop;
6+
7+
static class Extensions
138
{
14-
static class Extensions
9+
public static ILogger CreateLogger(this IWebHost host, string categoryName)
10+
=> host.Services.GetRequiredService<ILoggerFactory>().CreateLogger(categoryName);
11+
public static Uri GetListeningUri(this IHost host)
1512
{
16-
public static ILogger CreateLogger(this IWebHost host, string categoryName)
17-
{
18-
return host.Services.GetService<ILoggerFactory>().CreateLogger(categoryName);
19-
}
20-
public static Uri GetListeningUri(this IHost host)
21-
{
22-
return new Uri(host.Services
23-
.GetRequiredService<IServer>()
24-
.Features
25-
.Get<IServerAddressesFeature>()
26-
.Addresses
27-
.Single(a => a.StartsWith("http:", StringComparison.Ordinal)));
28-
}
29-
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
30-
{
31-
HashSet<TKey> seenKeys = new HashSet<TKey>();
32-
foreach (TSource element in source)
33-
{
34-
if (seenKeys.Add(keySelector(element)))
35-
{
36-
yield return element;
37-
}
38-
}
39-
}
13+
return new Uri(host.Services
14+
.GetRequiredService<IServer>()
15+
.Features
16+
.GetRequiredFeature<IServerAddressesFeature>()
17+
.Addresses
18+
.Single(a => a.StartsWith("http:", StringComparison.Ordinal)));
4019
}
20+
21+
public static string ExcursionDirectoryPath(this IConfiguration configuration)
22+
=> configuration.GetValue<string?>("excursionsPath", null) ?? Directory.GetCurrentDirectory();
4123
}

0 commit comments

Comments
 (0)