Skip to content

Commit bda7fae

Browse files
committed
Prepared public release of OrviboConsole.
Sorry, no Git history on this one!
1 parent ba40dd1 commit bda7fae

34 files changed

+2333
-0
lines changed

.editorconfig

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
6+
#--------------------------------------------------------------------------------------------------
7+
# XML and JSON files
8+
#--------------------------------------------------------------------------------------------------
9+
[*.{xml,csproj,vcxproj,vcxproj.filters,proj,projitems,shproj,props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,manifest}]
10+
indent_size = 2
11+
12+
[*.json]
13+
indent_size = 2
14+
15+
#--------------------------------------------------------------------------------------------------
16+
# C++
17+
#--------------------------------------------------------------------------------------------------
18+
[*.{c,cpp,h,hpp,ixx}]
19+
indent_size = 4
20+
charset = utf-8-bom
21+
trim_trailing_whitespace = true
22+
insert_final_newline = true
23+
24+
#--------------------------------------------------------------------------------------------------
25+
# Shaders
26+
#--------------------------------------------------------------------------------------------------
27+
[*.{hlsl,hlsli}]
28+
indent_size = 4
29+
charset = utf-8
30+
trim_trailing_whitespace = true
31+
insert_final_newline = true
32+
33+
#--------------------------------------------------------------------------------------------------
34+
# C#
35+
#--------------------------------------------------------------------------------------------------
36+
# See the following documentation for the C#/.NET-specific rules to follow:
37+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
38+
[*.{cs,csx}]
39+
indent_size = 4
40+
charset = utf-8-bom
41+
trim_trailing_whitespace = true
42+
insert_final_newline = true
43+
44+
#------------------------------------------------------------------------------
45+
# Code style rules
46+
#------------------------------------------------------------------------------
47+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
48+
49+
#----------------------------------------------------------
50+
# Language Rules
51+
#----------------------------------------------------------
52+
53+
# Self access qualification
54+
dotnet_style_qualification_for_field = false:none
55+
dotnet_style_qualification_for_property = false:none
56+
dotnet_style_qualification_for_method = false:none
57+
dotnet_style_qualification_for_event = false:none
58+
59+
# Language keyword vs full type name
60+
# Predefined for members, etc does not create a message because the explicitly sized types are conveient in interop scenarios where the bit size matters.
61+
dotnet_style_predefined_type_for_locals_parameters_members = true:none
62+
dotnet_style_predefined_type_for_member_access = false:suggestion
63+
64+
# Modifiers
65+
# csharp_preferred_modifier_order = # Default is fine. It isn't expected this would be overriden in the IDE.
66+
# We'd like this to be a warning, but it complains on partials in non-primary files.
67+
dotnet_style_require_accessibility_modifiers = always:none
68+
dotnet_style_readonly_field = true:suggestion
69+
csharp_prefer_static_local_function = true:suggestion
70+
71+
# Parentheses
72+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
73+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
74+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
75+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none
76+
77+
# Expression-level preferences
78+
dotnet_style_object_initializer = true:suggestion
79+
# This is not enforced because there's too many situations where this hides the variable declaration in a way that harms understanding of the code.
80+
csharp_style_inlined_variable_declaration = true:none
81+
dotnet_style_collection_initializer = true:suggestion
82+
dotnet_style_prefer_auto_properties = true:none
83+
dotnet_style_explicit_tuple_names = true:warning
84+
csharp_prefer_simple_default_expression = true:suggestion
85+
dotnet_style_prefer_inferred_tuple_names = true:none
86+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:none
87+
csharp_style_pattern_local_over_anonymous_function = true:warning
88+
csharp_style_deconstructed_variable_declaration = true:suggestion
89+
dotnet_style_prefer_conditional_expression_over_assignment = true:none
90+
dotnet_style_prefer_conditional_expression_over_return = true:none
91+
dotnet_style_prefer_compound_assignment = true:suggestion
92+
dotnet_style_prefer_simplified_boolean_expressions = true:none
93+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
94+
95+
# Null checking
96+
csharp_style_throw_expression = true:none
97+
dotnet_style_coalesce_expression = true:suggestion
98+
dotnet_style_null_propagation = true:suggestion
99+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
100+
# Not using safe navigation for event invocation has thread safety problems.
101+
csharp_style_conditional_delegate_call = true:warning
102+
103+
# Use of `var`
104+
csharp_style_var_for_built_in_types = false:warning
105+
# Use target-typed new instead.
106+
csharp_style_var_when_type_is_apparent = false:warning
107+
csharp_style_var_elsewhere = false:warning
108+
109+
# Expression-bodied members
110+
csharp_style_expression_bodied_constructors = true:suggestion
111+
csharp_style_expression_bodied_methods = true:suggestion
112+
csharp_style_expression_bodied_operators = true:suggestion
113+
csharp_style_expression_bodied_properties = true:suggestion
114+
csharp_style_expression_bodied_indexers = true:suggestion
115+
csharp_style_expression_bodied_accessors = true:suggestion
116+
csharp_style_expression_bodied_lambdas = true:suggestion
117+
csharp_style_expression_bodied_local_functions = true:suggestion
118+
119+
# Pattern matching
120+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
121+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
122+
csharp_style_prefer_switch_expression = true:suggestion
123+
csharp_style_prefer_pattern_matching = true:none
124+
csharp_style_prefer_not_pattern = true:suggestion
125+
126+
# Code block preferences
127+
csharp_prefer_braces = true:warning
128+
csharp_prefer_simple_using_statement = true:none
129+
130+
# Using directive placement
131+
csharp_using_directive_placement = outside_namespace:warning
132+
133+
# File header
134+
file_header_template = unset
135+
136+
#----------------------------------------------------------
137+
# Unnecessary code rules
138+
#----------------------------------------------------------
139+
# Simplify member access -- These tend to be more annoying than anything
140+
dotnet_diagnostic.IDE0002.severity = none
141+
# Remove unnecessary cast -- Sometimes these clarify the intent of the code.
142+
dotnet_diagnostic.IDE0004.severity = none
143+
csharp_style_unused_value_expression_statement_preference = discard_variable
144+
csharp_style_unused_value_assignment_preference = discard_variable
145+
dotnet_code_quality_unused_parameters = all
146+
# Remove unnecessary equality operator -- This covers things like `x == true`, sometimes these clarify the intent of the code.
147+
dotnet_diagnostic.IDE0100.severity = none
148+
149+
#----------------------------------------------------------
150+
# Formatting rules
151+
#----------------------------------------------------------
152+
# (These are mostly Visual Studio defaults, and are simply here to enforce consistency.)
153+
dotnet_sort_system_directives_first = false
154+
dotnet_separate_import_directive_groups = false
155+
156+
# Newlines
157+
csharp_new_line_before_open_brace = all
158+
csharp_new_line_before_else = true
159+
csharp_new_line_before_catch = true
160+
csharp_new_line_before_finally = true
161+
csharp_new_line_before_members_in_object_initializers = true
162+
csharp_new_line_before_members_in_anonymous_types = true
163+
csharp_new_line_between_query_expression_clauses = true
164+
165+
# Indentation
166+
csharp_indent_case_contents = true
167+
csharp_indent_switch_labels = true
168+
csharp_indent_labels = flush_left
169+
csharp_indent_block_contents = true
170+
csharp_indent_braces = false
171+
csharp_indent_case_contents_when_block = false
172+
173+
# Spacing
174+
csharp_space_after_cast = false
175+
csharp_space_after_keywords_in_control_flow_statements = true
176+
csharp_space_between_parentheses = false
177+
csharp_space_before_colon_in_inheritance_clause = true
178+
csharp_space_after_colon_in_inheritance_clause = true
179+
csharp_space_around_binary_operators = before_and_after
180+
csharp_space_between_method_declaration_parameter_list_parentheses = false
181+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
182+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
183+
csharp_space_between_method_call_parameter_list_parentheses = false
184+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
185+
csharp_space_between_method_call_name_and_opening_parenthesis = false
186+
csharp_space_after_comma = true
187+
csharp_space_before_comma = false
188+
csharp_space_after_dot = false
189+
csharp_space_before_dot = false
190+
csharp_space_after_semicolon_in_for_statement = true
191+
csharp_space_before_semicolon_in_for_statement = false
192+
csharp_space_around_declaration_statements = false
193+
csharp_space_before_open_square_brackets = false
194+
csharp_space_between_empty_square_brackets = false
195+
csharp_space_between_square_brackets = false
196+
197+
# Wrapping
198+
csharp_preserve_single_line_statements = false
199+
csharp_preserve_single_line_blocks = true
200+
201+
#------------------------------------------------------------------------------
202+
# Naming Conventions
203+
#------------------------------------------------------------------------------
204+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/naming-rules
205+
206+
#----------------------------------------------------------
207+
# Interfaces
208+
#----------------------------------------------------------
209+
dotnet_naming_style.interface_style.capitalization = pascal_case
210+
dotnet_naming_style.interface_style.required_prefix = I
211+
212+
dotnet_naming_symbols.interface_symbols.applicable_kinds = interface
213+
dotnet_naming_symbols.interface_symbols.applicable_accessibilities = *
214+
215+
dotnet_naming_rule.interface_rule.symbols = interface_symbols
216+
dotnet_naming_rule.interface_rule.style = interface_style
217+
dotnet_naming_rule.interface_rule.severity = suggestion
218+
219+
#----------------------------------------------------------
220+
# Type Parameters
221+
#----------------------------------------------------------
222+
dotnet_naming_style.type_parameter_style.capitalization = pascal_case
223+
dotnet_naming_style.type_parameter_style.required_prefix = T
224+
225+
dotnet_naming_symbols.type_parameter_symbols.applicable_kinds = type_parameter
226+
dotnet_naming_symbols.type_parameter_symbols.applicable_accessibilities = *
227+
228+
dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_symbols
229+
dotnet_naming_rule.type_parameter_rule.style = type_parameter_style
230+
dotnet_naming_rule.type_parameter_rule.severity = suggestion
231+
232+
#----------------------------------------------------------
233+
# Async Methods
234+
#----------------------------------------------------------
235+
dotnet_naming_style.async_method_style.capitalization = pascal_case
236+
dotnet_naming_style.async_method_style.required_suffix = Async
237+
238+
dotnet_naming_symbols.async_method_symbols.applicable_kinds = method, local_function
239+
dotnet_naming_symbols.async_method_symbols.applicable_accessibilities = *
240+
dotnet_naming_symbols.async_method_symbols.required_modifiers = async
241+
242+
dotnet_naming_rule.async_method_rule.symbols = async_method_symbols
243+
dotnet_naming_rule.async_method_rule.style = async_method_style
244+
dotnet_naming_rule.async_method_rule.severity = suggestion
245+
246+
#----------------------------------------------------------
247+
# General PascalCase Symbols
248+
#----------------------------------------------------------
249+
dotnet_naming_style.pascal_style.capitalization = pascal_case
250+
251+
dotnet_naming_symbols.pascal_symbols.applicable_kinds = namespace, class, struct, interface, enum, property, method, field, event, delegate, type_parameter, local_function
252+
dotnet_naming_symbols.pascal_symbols.applicable_accessibilities = *
253+
254+
dotnet_naming_rule.pascal_rule.symbols = pascal_symbols
255+
dotnet_naming_rule.pascal_rule.style = pascal_style
256+
dotnet_naming_rule.pascal_rule.severity = suggestion
257+
258+
#----------------------------------------------------------
259+
# General camelCase Symbols
260+
#----------------------------------------------------------
261+
dotnet_naming_style.camel_style.capitalization = camel_case
262+
263+
dotnet_naming_symbols.camel_symbols.applicable_kinds = parameter, local
264+
dotnet_naming_symbols.camel_symbols.applicable_accessibilities = *
265+
266+
dotnet_naming_rule.camel_rule.symbols = camel_symbols
267+
dotnet_naming_rule.camel_rule.style = camel_style
268+
dotnet_naming_rule.camel_rule.severity = suggestion
269+
270+
#----------------------------------------------------------
271+
# Disabled style analyzers
272+
#----------------------------------------------------------
273+
# This is at the end so that suppressions added via the GUI go here
274+
275+
# IDE0057: Use range operator
276+
dotnet_diagnostic.IDE0057.severity = none

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.vs/
2+
bin/
3+
obj/
4+
*.pubxml
5+
*.user

LICENSE.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) David Maas
4+
5+
All rights reserved.
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

OrviboBlazor/App.razor

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<LayoutView Layout="@typeof(MainLayout)">
8+
<p role="alert">Sorry, there's nothing at this address.</p>
9+
</LayoutView>
10+
</NotFound>
11+
</Router>

OrviboBlazor/OrviboBlazor.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\OrviboControl\OrviboControl.csproj" />
10+
</ItemGroup>
11+
12+
</Project>

OrviboBlazor/Pages/Error.cshtml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@page
2+
@model OrviboBlazor.Pages.ErrorModel
3+
4+
<!DOCTYPE html>
5+
<html>
6+
<head>
7+
<meta charset="utf-8" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
9+
<title>Error</title>
10+
</head>
11+
<body>
12+
<div>
13+
<div>
14+
<h1>Error.</h1>
15+
<h2>An error occurred while processing your request.</h2>
16+
17+
@if (Model.RequestId is not null)
18+
{
19+
<p>
20+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
21+
</p>
22+
}
23+
24+
<h3>Development Mode</h3>
25+
<p>
26+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
27+
</p>
28+
<p>
29+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
30+
It can result in displaying sensitive information from exceptions to end users.
31+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
32+
and restarting the app.
33+
</p>
34+
</div>
35+
</div>
36+
</body>
37+
</html>

OrviboBlazor/Pages/Error.cshtml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
4+
5+
namespace OrviboBlazor.Pages;
6+
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
13+
14+
public void OnGet()
15+
=> RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
16+
}

0 commit comments

Comments
 (0)