Skip to content

Commit 2ee32f4

Browse files
committed
Add project files.
1 parent 5154ca2 commit 2ee32f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5715
-0
lines changed

.editorconfig

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Suppress: EC112
2+
# editorconfig.org
3+
4+
# top-most EditorConfig file
5+
root = true
6+
7+
# Default settings:
8+
# A newline ending every file
9+
# Use 4 spaces as indentation
10+
[*]
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.json]
15+
indent_size = 2
16+
17+
# C# and VB files
18+
[*.{cs,vb}]
19+
charset = utf-8-bom
20+
insert_final_newline = true
21+
trim_trailing_whitespace = true
22+
23+
# avoid this. unless absolutely necessary
24+
dotnet_style_qualification_for_field = false:suggestion
25+
dotnet_style_qualification_for_property = false:suggestion
26+
dotnet_style_qualification_for_method = false:suggestion
27+
dotnet_style_qualification_for_event = false:suggestion
28+
# use language keywords instead of BCL types
29+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
30+
dotnet_style_predefined_type_for_member_access = true:suggestion
31+
32+
# name all constant fields using PascalCase
33+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
34+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
35+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
36+
37+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
38+
dotnet_naming_symbols.constant_fields.required_modifiers = const
39+
40+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
41+
42+
# static fields should have s_ prefix
43+
dotnet_naming_rule.static_fields_should_have_prefix.severity = silent
44+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
45+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
46+
47+
dotnet_naming_symbols.static_fields.applicable_kinds = field
48+
dotnet_naming_symbols.static_fields.required_modifiers = static
49+
50+
dotnet_naming_style.static_prefix_style.required_prefix = s_
51+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
52+
53+
# internal and private fields should be _camelCase
54+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
55+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
56+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
57+
58+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
59+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
60+
61+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
62+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
63+
64+
# Code style defaults
65+
dotnet_sort_system_directives_first = true
66+
67+
# Expression-level preferences
68+
dotnet_style_object_initializer = true:suggestion
69+
dotnet_style_collection_initializer = true:suggestion
70+
dotnet_style_explicit_tuple_names = true:suggestion
71+
dotnet_style_coalesce_expression = true:suggestion
72+
dotnet_style_null_propagation = true:suggestion
73+
74+
# C# files
75+
[*.cs]
76+
# New line preferences
77+
csharp_new_line_before_open_brace = all
78+
csharp_new_line_before_else = true
79+
csharp_new_line_before_catch = true
80+
csharp_new_line_before_finally = true
81+
csharp_new_line_before_members_in_object_initializers = true
82+
csharp_new_line_before_members_in_anonymous_types = true
83+
csharp_new_line_between_query_expression_clauses = true
84+
85+
# Indentation preferences
86+
csharp_indent_block_contents = true
87+
csharp_indent_braces = false
88+
csharp_indent_case_contents = true
89+
csharp_indent_switch_labels = true
90+
csharp_indent_labels = one_less_than_current
91+
92+
# only use var when it's obvious what the variable type is
93+
csharp_style_var_for_built_in_types = false:none
94+
csharp_style_var_when_type_is_apparent = false:none
95+
csharp_style_var_elsewhere = false:suggestion
96+
97+
98+
# Code style defaults
99+
csharp_preserve_single_line_blocks = true
100+
csharp_preserve_single_line_statements = false
101+
102+
# Expression-bodied members
103+
csharp_style_expression_bodied_methods = false:none
104+
csharp_style_expression_bodied_constructors = false:none
105+
csharp_style_expression_bodied_operators = false:none
106+
csharp_style_expression_bodied_properties = true:none
107+
csharp_style_expression_bodied_indexers = true:none
108+
csharp_style_expression_bodied_accessors = true:none
109+
110+
# Pattern matching
111+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
112+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
113+
csharp_style_inlined_variable_declaration = true:suggestion
114+
115+
# Null checking preferences
116+
csharp_style_throw_expression = true:suggestion
117+
csharp_style_conditional_delegate_call = true:suggestion
118+
119+
# Space preferences
120+
csharp_space_after_cast = false
121+
csharp_space_after_colon_in_inheritance_clause = true
122+
csharp_space_after_comma = true
123+
csharp_space_after_dot = false
124+
csharp_space_after_keywords_in_control_flow_statements = true
125+
csharp_space_after_semicolon_in_for_statement = true
126+
csharp_space_around_binary_operators = before_and_after
127+
csharp_space_around_declaration_statements = do_not_ignore
128+
csharp_space_before_colon_in_inheritance_clause = true
129+
csharp_space_before_comma = false
130+
csharp_space_before_dot = false
131+
csharp_space_before_open_square_brackets = false
132+
csharp_space_before_semicolon_in_for_statement = false
133+
csharp_space_between_empty_square_brackets = false
134+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
135+
csharp_space_between_method_call_name_and_opening_parenthesis = false
136+
csharp_space_between_method_call_parameter_list_parentheses = false
137+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
138+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
139+
csharp_space_between_method_declaration_parameter_list_parentheses = false
140+
csharp_space_between_parentheses = false
141+
csharp_space_between_square_brackets = false
142+
143+
# Visual Basic files
144+
[*.vb]
145+
# Modifier preferences
146+
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
147+
148+
# CA1031: Do not catch general exception types
149+
dotnet_diagnostic.CA1031.severity = silent
150+
151+
# CA1303: Do not pass literals as localized parameters
152+
dotnet_diagnostic.CA1303.severity = silent
153+
154+
# Xml project files
155+
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
156+
indent_size = 2
157+
158+
# Xml config files
159+
[*.{props,targets,config,nuspec}]
160+
indent_size = 2
161+
162+
# resx Files
163+
[*.{resx,xlf}]
164+
indent_size = 2
165+
charset = utf-8-bom
166+
insert_final_newline = true
167+
168+
# batch files
169+
#[*.{cmd,bat}]
170+
#end_of_line = crlf
171+
#

CodeCoverage.sln

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29123.89
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CodeCoverage", "CodeCoverage\CodeCoverage.vbproj", "{8F9CD4CE-0BD5-49EF-8689-294F7AB95E59}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{28CB705E-2BEC-4BA6-83FE-0298DCE93F7E}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
ReadMe.md = ReadMe.md
12+
EndProjectSection
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Release|Any CPU = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{8F9CD4CE-0BD5-49EF-8689-294F7AB95E59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{8F9CD4CE-0BD5-49EF-8689-294F7AB95E59}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{8F9CD4CE-0BD5-49EF-8689-294F7AB95E59}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{8F9CD4CE-0BD5-49EF-8689-294F7AB95E59}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {33D25664-5EFB-43A2-83DC-00B625E7843A}
30+
EndGlobalSection
31+
EndGlobal

CodeCoverage/.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.vb]
2+
3+
# CA1031: Do not catch general exception types
4+
dotnet_diagnostic.CA1031.severity = none

CodeCoverage/App.config

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
5+
<section name="CodeCoverage.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
6+
</sectionGroup>
7+
</configSections>
8+
<startup>
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
10+
</startup>
11+
<userSettings>
12+
<CodeCoverage.My.MySettings>
13+
<setting name="Last_jsonFile" serializeAs="String">
14+
<value />
15+
</setting>
16+
<setting name="UpgradeRequired" serializeAs="String">
17+
<value>True</value>
18+
</setting>
19+
<setting name="DefaultProjectDirectory" serializeAs="String">
20+
<value />
21+
</setting>
22+
</CodeCoverage.My.MySettings>
23+
</userSettings>
24+
</configuration>

CodeCoverage/CodeColorSelector.vb

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
' Licensed to the .NET Foundation under one or more agreements.
2+
' The .NET Foundation licenses this file to you under the MIT license.
3+
' See the LICENSE file in the project root for more information.
4+
Option Explicit On
5+
Option Infer Off
6+
Option Strict On
7+
8+
Imports System.IO
9+
10+
Public Module CodeColorSelector
11+
12+
Private ReadOnly ColorMappingDictionary As New Dictionary(Of String, Color) From {
13+
{"class name", Color.FromArgb(0, 128, 128)},
14+
{"comment", Color.FromArgb(0, 100, 0)},
15+
{"constant name", Color.Black},
16+
{"default", Color.Black},
17+
{"delegate name", Color.FromArgb(0, 128, 128)},
18+
{"enum name", Color.FromArgb(0, 128, 128)},
19+
{"enum member name", Color.FromArgb(0, 128, 128)},
20+
{"error", Color.Red},
21+
{"excluded code", Color.FromArgb(128, 128, 128)},
22+
{"event name", Color.Black},
23+
{"extension method name", Color.Black},
24+
{"field name", Color.Black},
25+
{"identifier", Color.Black},
26+
{"interface name", Color.FromArgb(0, 128, 128)},
27+
{"keyword", Color.FromArgb(0, 0, 255)},
28+
{"keyword - control", Color.FromArgb(143, 8, 196)},
29+
{"label name", Color.Black},
30+
{"local name", Color.Black},
31+
{"method name", Color.Black},
32+
{"module name", Color.FromArgb(0, 128, 128)},
33+
{"namespace name", Color.Black},
34+
{"number", Color.Black},
35+
{"operator", Color.Black},
36+
{"operator - overloaded", Color.Black},
37+
{"parameter name", Color.Black},
38+
{"preprocessor keyword", Color.Gray},
39+
{"preprocessor text", Color.Black},
40+
{"property name", Color.Black},
41+
{"punctuation", Color.Black},
42+
{"static symbol", Color.Black},
43+
{"string - escape character", Color.Yellow},
44+
{"string - verbatim", Color.FromArgb(128, 0, 0)},
45+
{"string", Color.FromArgb(163, 21, 21)},
46+
{"struct name", Color.FromArgb(43, 145, 175)},
47+
{"text", Color.Black},
48+
{"type parameter name", Color.DarkGray},
49+
{"xml doc comment - attribute name", Color.FromArgb(128, 128, 128)},
50+
{"xml doc comment - attribute quotes", Color.FromArgb(128, 128, 128)},
51+
{"xml doc comment - attribute value", Color.FromArgb(128, 128, 128)},
52+
{"xml doc comment - cdata section", Color.FromArgb(128, 128, 128)},
53+
{"xml doc comment - comment", Color.FromArgb(128, 128, 128)},
54+
{"xml doc comment - delimiter", Color.FromArgb(128, 128, 128)},
55+
{"xml doc comment - entity reference", Color.FromArgb(0, 128, 0)},
56+
{"xml doc comment - name", Color.FromArgb(128, 128, 128)},
57+
{"xml doc comment - processing instruction", Color.FromArgb(128, 128, 128)},
58+
{"xml doc comment - text", Color.FromArgb(0, 128, 0)},
59+
{"xml literal - attribute name", Color.FromArgb(128, 128, 128)},
60+
{"xml literal - attribute quotes", Color.FromArgb(128, 128, 128)},
61+
{"xml literal - attribute value", Color.FromArgb(128, 128, 128)},
62+
{"xml literal - cdata section", Color.FromArgb(128, 128, 128)},
63+
{"xml literal - comment", Color.FromArgb(128, 128, 128)},
64+
{"xml literal - delimiter", Color.FromArgb(100, 100, 185)},
65+
{"xml literal - embedded expression", Color.FromArgb(128, 128, 128)},
66+
{"xml literal - entity reference", Color.FromArgb(185, 100, 100)},
67+
{"xml literal - name", Color.FromArgb(132, 70, 70)},
68+
{"xml literal - processing instruction", Color.FromArgb(128, 128, 128)},
69+
{"xml literal - text", Color.FromArgb(85, 85, 85)}
70+
}
71+
72+
Private ReadOnly FullPath As String = Path.Combine(FileIO.SpecialDirectories.MyDocuments, "CodeHighlightingColorDictionary.csv")
73+
74+
Private Sub UpdateColorDictionaryFromFile(FPath As String)
75+
If Not File.Exists(FPath) Then
76+
WriteColorDictionaryToFile(FPath)
77+
Exit Sub
78+
End If
79+
Dim FileStream As FileStream = File.OpenRead(FPath)
80+
Dim sr As New IO.StreamReader(FileStream)
81+
sr.ReadLine()
82+
While (sr.Peek() <> -1)
83+
Dim line As String = sr.ReadLine()
84+
Dim Split() As String = line.Split(","c)
85+
Dim key As String = Split(0)
86+
Dim A As Integer = Convert.ToInt32(Split(1), Globalization.CultureInfo.InvariantCulture)
87+
Dim R As Integer = Convert.ToInt32(Split(2), Globalization.CultureInfo.InvariantCulture)
88+
Dim G As Integer = Convert.ToInt32(Split(3), Globalization.CultureInfo.InvariantCulture)
89+
Dim B As Integer = Convert.ToInt32(Split(4), Globalization.CultureInfo.InvariantCulture)
90+
ColorMappingDictionary(key) = Color.FromArgb(A, R, G, B)
91+
End While
92+
sr.Close()
93+
FileStream.Close()
94+
End Sub
95+
96+
Private Sub WriteColorDictionaryToFile(FPath As String)
97+
Dim FileStream As FileStream = File.OpenWrite(FPath)
98+
Dim sw As New IO.StreamWriter(FileStream)
99+
sw.WriteLine($"Key,A,R,G,B")
100+
For Each kvp As KeyValuePair(Of String, Color) In ColorMappingDictionary
101+
sw.WriteLine($"{kvp.Key},{kvp.Value.A},{kvp.Value.R},{kvp.Value.G},{kvp.Value.B}")
102+
Next
103+
sw.Flush()
104+
sw.Close()
105+
FileStream.Close()
106+
End Sub
107+
108+
Friend Function GetColorFromName(Name As String) As Color
109+
Try
110+
If String.IsNullOrWhiteSpace(Name) Then
111+
Return ColorMappingDictionary("default")
112+
End If
113+
Return ColorMappingDictionary(Name)
114+
Catch ex As Exception
115+
Debug.Print($"GetColorFromName missing({Name})")
116+
Stop
117+
Return ColorMappingDictionary("error")
118+
End Try
119+
End Function
120+
121+
Public Function GetColorNameList() As Dictionary(Of String, Color).KeyCollection
122+
Return ColorMappingDictionary.Keys
123+
End Function
124+
125+
Public Sub SetColor(name As String, value As Color)
126+
ColorMappingDictionary(name) = value
127+
WriteColorDictionaryToFile(FullPath)
128+
End Sub
129+
130+
Public Sub UpdateColorDictionaryFromFile()
131+
UpdateColorDictionaryFromFile(FullPath)
132+
End Sub
133+
134+
Public Sub WriteColorDictionaryToFile()
135+
WriteColorDictionaryToFile(FullPath)
136+
End Sub
137+
138+
End Module

0 commit comments

Comments
 (0)