├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── custom.md
│ └── feature_request.md
└── workflows
│ ├── codeql-analysis.yml
│ ├── dotnet-demo.yml
│ └── dotnet.yml
├── .gitignore
├── .gitmodules
├── HACC-Demo.sln
├── HACC.sln
├── HACC.sln.DotSettings
├── LICENSE
├── README.md
├── SECURITY.md
├── blazor-canvas-editorconfig
├── old-blazor-canvas-github-workflows
├── ci.yml
└── publish.yml
├── setupKeybase.sh
└── src
├── Directory.Build.props
├── Directory.Build.targets
└── HACC
├── .editorconfig
├── .gitignore
├── Applications
└── WebApplication.cs
├── Components
├── WebConsole.razor
└── WebConsole.razor.cs
├── Configuration
└── Defaults.cs
├── Directory.Build.props
├── Enumerations
├── BeepType.cs
├── CursorType.cs
├── RuneDataType.cs
└── WebGLEnums.cs
├── Extensions
├── HaccExtensions.cs
└── LoggingExtensions.cs
├── HACC.csproj
├── HACC.nuspec
├── LICENSE
├── Logging
├── CustomLogger.cs
├── LoggingConfiguration.cs
└── LoggingProvider.cs
├── Models
├── DirtySegment.cs
├── Drivers
│ ├── WebConsoleDriver.Color.cs
│ ├── WebConsoleDriver.Cursor.cs
│ ├── WebConsoleDriver.IO.Read.cs
│ ├── WebConsoleDriver.IO.Write.cs
│ ├── WebConsoleDriver.IO.WriteLine.cs
│ ├── WebConsoleDriver.IO.cs
│ ├── WebConsoleDriver.TerminalGuiConsoleDriver.cs
│ ├── WebConsoleDriver.Window.cs
│ └── WebConsoleDriver.cs
├── Enums
│ ├── WebEventType.cs
│ └── WebMouseButtonState.cs
├── EventArgs
│ ├── NewFrameEventArgs.cs
│ └── VirtualConsoleEventArgs.cs
├── SetLineResponse.cs
├── Spectre
│ └── BrowserExclusivityMode.cs
├── Structs
│ ├── WebInputResult.cs
│ ├── WebKeyEvent.cs
│ ├── WebMouseEvent.cs
│ └── WebResizeEvent.cs
├── TerminalSettings.cs
├── WebClipboard.cs
└── WebMainLoopDriver.cs
├── README.md
├── Resources
├── WebStrings.Designer.cs
├── WebStrings.fr-FR.resx
├── WebStrings.ja-JP.resx
├── WebStrings.pt-PT.resx
└── WebStrings.resx
├── _Imports.razor
└── wwwroot
└── JavaScript
├── beep.js
├── clipboard.js
└── consoleInterop.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*]
2 | charset = utf-8
3 | end_of_line = crlf
4 | trim_trailing_whitespace = false
5 | insert_final_newline = false
6 | indent_style = space
7 | indent_size = 4
8 |
9 | # Microsoft .NET properties
10 | csharp_new_line_before_members_in_object_initializers = false
11 | csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
12 | csharp_space_after_cast = true
13 | csharp_style_var_elsewhere = true:suggestion
14 | csharp_style_var_for_built_in_types = true:suggestion
15 | csharp_style_var_when_type_is_apparent = true:suggestion
16 | dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
17 | dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
18 | dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
19 | dotnet_naming_rule.unity_serialized_field_rule.severity = warning
20 | dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
21 | dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
22 | dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
23 | dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
24 | dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
25 | dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
26 | dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
27 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
28 | dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
29 | dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
30 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
31 | dotnet_style_predefined_type_for_member_access = true:suggestion
32 | dotnet_style_qualification_for_event = true:suggestion
33 | dotnet_style_qualification_for_field = true:suggestion
34 | dotnet_style_qualification_for_method = true:suggestion
35 | dotnet_style_qualification_for_property = true:suggestion
36 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
37 |
38 | # ReSharper properties
39 | resharper_arguments_anonymous_function = named
40 | resharper_arguments_literal = named
41 | resharper_arguments_named = named
42 | resharper_arguments_other = named
43 | resharper_arguments_string_literal = named
44 | resharper_autodetect_indent_settings = true
45 | resharper_csharp_place_type_constraints_on_same_line = false
46 | resharper_csharp_wrap_arguments_style = chop_always
47 | resharper_csharp_wrap_before_first_type_parameter_constraint = true
48 | resharper_show_autodetect_configure_formatting_tip = false
49 | resharper_space_within_single_line_array_initializer_braces = false
50 | resharper_trailing_comma_in_multiline_lists = true
51 | resharper_use_indent_from_vs = false
52 | resharper_wrap_before_arrow_with_expressions = true
53 |
54 | # ReSharper inspection severities
55 | resharper_arrange_redundant_parentheses_highlighting = hint
56 | resharper_arrange_this_qualifier_highlighting = hint
57 | resharper_arrange_type_member_modifiers_highlighting = hint
58 | resharper_arrange_type_modifiers_highlighting = hint
59 | resharper_built_in_type_reference_style_for_member_access_highlighting = hint
60 | resharper_built_in_type_reference_style_highlighting = hint
61 | resharper_suggest_var_or_type_built_in_types_highlighting = hint
62 | resharper_suggest_var_or_type_elsewhere_highlighting = hint
63 | resharper_suggest_var_or_type_simple_types_highlighting = hint
64 | resharper_web_config_module_not_resolved_highlighting = warning
65 | resharper_web_config_type_not_resolved_highlighting = warning
66 | resharper_web_config_wrong_module_highlighting = warning
67 |
68 | [{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}]
69 | indent_style = space
70 | indent_size = 2
71 |
72 | [*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,paml,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
73 | indent_style = space
74 | indent_size = 4
75 | tab_width = 4
76 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/custom.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Custom issue template
3 | about: Describe this issue template's purpose here.
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ main ]
20 | schedule:
21 | - cron: '36 4 * * 1'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'csharp', 'javascript' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support
38 |
39 | steps:
40 | - name: Checkout repository
41 | uses: actions/checkout@v3
42 | with:
43 | submodules: recursive
44 |
45 | # Initializes the CodeQL tools for scanning.
46 | - name: Initialize CodeQL
47 | uses: github/codeql-action/init@v2
48 | with:
49 | languages: ${{ matrix.language }}
50 | # If you wish to specify custom queries, you can do so here or in a config file.
51 | # By default, queries listed here will override any specified in a config file.
52 | # Prefix the list here with "+" to use these queries and those in the config file.
53 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
54 |
55 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
56 | # If this step fails, then you should remove it and run the build manually (see below)
57 | - name: Autobuild
58 | uses: github/codeql-action/autobuild@v2
59 |
60 | # ℹ️ Command-line programs to run using the OS shell.
61 | # 📚 https://git.io/JvXDl
62 |
63 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
64 | # and modify them (or add more) to build your code if your project
65 | # uses a compiled language
66 |
67 | #- run: |
68 | # make bootstrap
69 | # make release
70 |
71 | - name: Perform CodeQL Analysis
72 | uses: github/codeql-action/analyze@v2
73 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet-demo.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v3
16 | with:
17 | submodules: recursive
18 | - name: Setup .NET
19 | uses: actions/setup-dotnet@v3
20 | with:
21 | dotnet-version: 6.x
22 | - name: Restore dependencies
23 | run: dotnet restore HACC-Demo.sln
24 | - name: Build
25 | run: dotnet build --no-restore HACC-Demo.sln
26 | - name: Test
27 | run: dotnet test --no-build --verbosity normal HACC-Demo.sln
28 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v3
16 | with:
17 | submodules: recursive
18 | - name: Setup .NET
19 | uses: actions/setup-dotnet@v3
20 | with:
21 | dotnet-version: 6.x
22 | - name: Restore dependencies
23 | run: dotnet restore HACC.sln
24 | - name: Build
25 | run: dotnet build --no-restore HACC.sln
26 | - name: Test
27 | run: dotnet test --no-build --verbosity normal HACC.sln
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # Rider
7 | .idea/
8 |
9 | # User-specific files
10 | *.rsuser
11 | *.suo
12 | *.user
13 | *.userosscache
14 | *.sln.docstates
15 |
16 | # User-specific files (MonoDevelop/Xamarin Studio)
17 | *.userprefs
18 |
19 | # Mono auto generated files
20 | mono_crash.*
21 |
22 | # Build results
23 | [Dd]ebug/
24 | [Dd]ebugPublic/
25 | [Rr]elease/
26 | [Rr]eleases/
27 | x64/
28 | x86/
29 | [Aa][Rr][Mm]/
30 | [Aa][Rr][Mm]64/
31 | bld/
32 | [Bb]in/
33 | [Oo]bj/
34 | [Ll]og/
35 | [Ll]ogs/
36 |
37 | # Visual Studio 2015/2017 cache/options directory
38 | .vs/
39 | # Uncomment if you have tasks that create the project's static files in wwwroot
40 | #wwwroot/
41 |
42 | # Visual Studio 2017 auto generated files
43 | Generated\ Files/
44 |
45 | # MSTest test Results
46 | [Tt]est[Rr]esult*/
47 | [Bb]uild[Ll]og.*
48 |
49 | # NUnit
50 | *.VisualState.xml
51 | TestResult.xml
52 | nunit-*.xml
53 |
54 | # Build Results of an ATL Project
55 | [Dd]ebugPS/
56 | [Rr]eleasePS/
57 | dlldata.c
58 |
59 | # Benchmark Results
60 | BenchmarkDotNet.Artifacts/
61 |
62 | # .NET Core
63 | project.lock.json
64 | project.fragment.lock.json
65 | artifacts/
66 |
67 | # StyleCop
68 | StyleCopReport.xml
69 |
70 | # Files built by Visual Studio
71 | *_i.c
72 | *_p.c
73 | *_h.h
74 | *.ilk
75 | *.meta
76 | *.obj
77 | *.iobj
78 | *.pch
79 | *.pdb
80 | *.ipdb
81 | *.pgc
82 | *.pgd
83 | *.rsp
84 | *.sbr
85 | *.tlb
86 | *.tli
87 | *.tlh
88 | *.tmp
89 | *.tmp_proj
90 | *_wpftmp.csproj
91 | *.log
92 | *.vspscc
93 | *.vssscc
94 | .builds
95 | *.pidb
96 | *.svclog
97 | *.scc
98 |
99 | # Chutzpah Test files
100 | _Chutzpah*
101 |
102 | # Visual C++ cache files
103 | ipch/
104 | *.aps
105 | *.ncb
106 | *.opendb
107 | *.opensdf
108 | *.sdf
109 | *.cachefile
110 | *.VC.db
111 | *.VC.VC.opendb
112 |
113 | # Visual Studio profiler
114 | *.psess
115 | *.vsp
116 | *.vspx
117 | *.sap
118 |
119 | # Visual Studio Trace Files
120 | *.e2e
121 |
122 | # TFS 2012 Local Workspace
123 | $tf/
124 |
125 | # Guidance Automation Toolkit
126 | *.gpState
127 |
128 | # ReSharper is a .NET coding add-in
129 | _ReSharper*/
130 | *.[Rr]e[Ss]harper
131 | *.DotSettings.user
132 |
133 | # TeamCity is a build add-in
134 | _TeamCity*
135 |
136 | # DotCover is a Code Coverage Tool
137 | *.dotCover
138 |
139 | # AxoCover is a Code Coverage Tool
140 | .axoCover/*
141 | !.axoCover/settings.json
142 |
143 | # Visual Studio code coverage results
144 | *.coverage
145 | *.coveragexml
146 |
147 | # NCrunch
148 | _NCrunch_*
149 | .*crunch*.local.xml
150 | nCrunchTemp_*
151 |
152 | # MightyMoose
153 | *.mm.*
154 | AutoTest.Net/
155 |
156 | # Web workbench (sass)
157 | .sass-cache/
158 |
159 | # Installshield output folder
160 | [Ee]xpress/
161 |
162 | # DocProject is a documentation generator add-in
163 | DocProject/buildhelp/
164 | DocProject/Help/*.HxT
165 | DocProject/Help/*.HxC
166 | DocProject/Help/*.hhc
167 | DocProject/Help/*.hhk
168 | DocProject/Help/*.hhp
169 | DocProject/Help/Html2
170 | DocProject/Help/html
171 |
172 | # Click-Once directory
173 | publish/
174 |
175 | # Publish Web Output
176 | *.[Pp]ublish.xml
177 | *.azurePubxml
178 | # Note: Comment the next line if you want to checkin your web deploy settings,
179 | # but database connection strings (with potential passwords) will be unencrypted
180 | *.pubxml
181 | *.publishproj
182 |
183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
184 | # checkin your Azure Web App publish settings, but sensitive information contained
185 | # in these scripts will be unencrypted
186 | PublishScripts/
187 |
188 | # NuGet Packages
189 | *.nupkg
190 | # NuGet Symbol Packages
191 | *.snupkg
192 | # The packages folder can be ignored because of Package Restore
193 | **/[Pp]ackages/*
194 | # except build/, which is used as an MSBuild target.
195 | !**/[Pp]ackages/build/
196 | # Uncomment if necessary however generally it will be regenerated when needed
197 | #!**/[Pp]ackages/repositories.config
198 | # NuGet v3's project.json files produces more ignorable files
199 | *.nuget.props
200 | *.nuget.targets
201 |
202 | # Microsoft Azure Build Output
203 | csx/
204 | *.build.csdef
205 |
206 | # Microsoft Azure Emulator
207 | ecf/
208 | rcf/
209 |
210 | # Windows Store app package directories and files
211 | AppPackages/
212 | BundleArtifacts/
213 | Package.StoreAssociation.xml
214 | _pkginfo.txt
215 | *.appx
216 | *.appxbundle
217 | *.appxupload
218 |
219 | # Visual Studio cache files
220 | # files ending in .cache can be ignored
221 | *.[Cc]ache
222 | # but keep track of directories ending in .cache
223 | !?*.[Cc]ache/
224 |
225 | # Others
226 | ClientBin/
227 | ~$*
228 | *~
229 | *.dbmdl
230 | *.dbproj.schemaview
231 | *.jfm
232 | *.pfx
233 | *.publishsettings
234 | orleans.codegen.cs
235 |
236 | # Including strong name files can present a security risk
237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
238 | #*.snk
239 |
240 | # Since there are multiple workflows, uncomment next line to ignore bower_components
241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
242 | #bower_components/
243 |
244 | # RIA/Silverlight projects
245 | Generated_Code/
246 |
247 | # Backup & report files from converting an old project file
248 | # to a newer Visual Studio version. Backup files are not needed,
249 | # because we have git ;-)
250 | _UpgradeReport_Files/
251 | Backup*/
252 | UpgradeLog*.XML
253 | UpgradeLog*.htm
254 | ServiceFabricBackup/
255 | *.rptproj.bak
256 |
257 | # SQL Server files
258 | *.mdf
259 | *.ldf
260 | *.ndf
261 |
262 | # Business Intelligence projects
263 | *.rdl.data
264 | *.bim.layout
265 | *.bim_*.settings
266 | *.rptproj.rsuser
267 | *- [Bb]ackup.rdl
268 | *- [Bb]ackup ([0-9]).rdl
269 | *- [Bb]ackup ([0-9][0-9]).rdl
270 |
271 | # Microsoft Fakes
272 | FakesAssemblies/
273 |
274 | # GhostDoc plugin setting file
275 | *.GhostDoc.xml
276 |
277 | # Node.js Tools for Visual Studio
278 | .ntvs_analysis.dat
279 | node_modules/
280 |
281 | # Visual Studio 6 build log
282 | *.plg
283 |
284 | # Visual Studio 6 workspace options file
285 | *.opt
286 |
287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
288 | *.vbw
289 |
290 | # Visual Studio LightSwitch build output
291 | **/*.HTMLClient/GeneratedArtifacts
292 | **/*.DesktopClient/GeneratedArtifacts
293 | **/*.DesktopClient/ModelManifest.xml
294 | **/*.Server/GeneratedArtifacts
295 | **/*.Server/ModelManifest.xml
296 | _Pvt_Extensions
297 |
298 | # Paket dependency manager
299 | .paket/paket.exe
300 | paket-files/
301 |
302 | # FAKE - F# Make
303 | .fake/
304 |
305 | # CodeRush personal settings
306 | .cr/personal
307 |
308 | # Python Tools for Visual Studio (PTVS)
309 | __pycache__/
310 | *.pyc
311 |
312 | # Cake - Uncomment if you are using it
313 | # tools/**
314 | # !tools/packages.config
315 |
316 | # Tabs Studio
317 | *.tss
318 |
319 | # Telerik's JustMock configuration file
320 | *.jmconfig
321 |
322 | # BizTalk build output
323 | *.btp.cs
324 | *.btm.cs
325 | *.odx.cs
326 | *.xsd.cs
327 |
328 | # OpenCover UI analysis results
329 | OpenCover/
330 |
331 | # Azure Stream Analytics local run output
332 | ASALocalRun/
333 |
334 | # MSBuild Binary and Structured Log
335 | *.binlog
336 |
337 | # NVidia Nsight GPU debugger configuration file
338 | *.nvuser
339 |
340 | # MFractors (Xamarin productivity tool) working folder
341 | .mfractor/
342 |
343 | # Local History for Visual Studio
344 | .localhistory/
345 |
346 | # BeatPulse healthcheck temp database
347 | healthchecksdb
348 |
349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
350 | MigrationBackup/
351 |
352 | # Ionide (cross platform F# VS Code tools) working folder
353 | .ionide/
354 |
355 | ## ---- gitignore from Canvas, mostly duplicate now
356 |
357 | ## Ignore Visual Studio temporary files, build results, and
358 | ## files generated by popular Visual Studio add-ons.
359 | ##
360 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
361 |
362 | # User-specific files
363 | *.suo
364 | *.user
365 | *.userosscache
366 | *.sln.docstates
367 |
368 | # User-specific files (MonoDevelop/Xamarin Studio)
369 | *.userprefs
370 |
371 | # Build results
372 | [Dd]ebug/
373 | [Dd]ebugPublic/
374 | [Rr]elease/
375 | [Rr]eleases/
376 | [Pp]ublish[Oo]utput/
377 | x64/
378 | x86/
379 | bld/
380 | [Bb]in/
381 | [Oo]bj/
382 | [Ll]og/
383 | dist/
384 |
385 | # Visual Studio 2015 cache/options directory
386 | .vs/
387 | # Uncomment if you have tasks that create the project's static files in wwwroot
388 | #wwwroot/
389 |
390 | # MSTest test Results
391 | [Tt]est[Rr]esult*/
392 | [Bb]uild[Ll]og.*
393 |
394 | # NUNIT
395 | *.VisualState.xml
396 | TestResult.xml
397 |
398 | # Build Results of an ATL Project
399 | [Dd]ebugPS/
400 | [Rr]eleasePS/
401 | dlldata.c
402 |
403 | # .NET Core
404 | project.lock.json
405 | project.fragment.lock.json
406 | artifacts/
407 | **/Properties/launchSettings.json
408 |
409 | *_i.c
410 | *_p.c
411 | *_i.h
412 | *.ilk
413 | *.meta
414 | *.obj
415 | *.pch
416 | *.pdb
417 | *.pgc
418 | *.pgd
419 | *.rsp
420 | *.sbr
421 | *.tlb
422 | *.tli
423 | *.tlh
424 | *.tmp
425 | *.tmp_proj
426 | *.log
427 | *.vspscc
428 | *.vssscc
429 | .builds
430 | *.pidb
431 | *.svclog
432 | *.scc
433 |
434 | # Chutzpah Test files
435 | _Chutzpah*
436 |
437 | # Visual C++ cache files
438 | ipch/
439 | *.aps
440 | *.ncb
441 | *.opendb
442 | *.opensdf
443 | *.sdf
444 | *.cachefile
445 | *.VC.db
446 | *.VC.VC.opendb
447 |
448 | # Visual Studio profiler
449 | *.psess
450 | *.vsp
451 | *.vspx
452 | *.sap
453 |
454 | # TFS 2012 Local Workspace
455 | $tf/
456 |
457 | # Guidance Automation Toolkit
458 | *.gpState
459 |
460 | # ReSharper is a .NET coding add-in
461 | _ReSharper*/
462 | *.[Rr]e[Ss]harper
463 | *.DotSettings.user
464 |
465 | # JustCode is a .NET coding add-in
466 | .JustCode
467 |
468 | # TeamCity is a build add-in
469 | _TeamCity*
470 |
471 | # DotCover is a Code Coverage Tool
472 | *.dotCover
473 |
474 | # Visual Studio code coverage results
475 | *.coverage
476 | *.coveragexml
477 |
478 | # NCrunch
479 | _NCrunch_*
480 | .*crunch*.local.xml
481 | nCrunchTemp_*
482 |
483 | # MightyMoose
484 | *.mm.*
485 | AutoTest.Net/
486 |
487 | # Web workbench (sass)
488 | .sass-cache/
489 |
490 | # Installshield output folder
491 | [Ee]xpress/
492 |
493 | # DocProject is a documentation generator add-in
494 | DocProject/buildhelp/
495 | DocProject/Help/*.HxT
496 | DocProject/Help/*.HxC
497 | DocProject/Help/*.hhc
498 | DocProject/Help/*.hhk
499 | DocProject/Help/*.hhp
500 | DocProject/Help/Html2
501 | DocProject/Help/html
502 |
503 | # Click-Once directory
504 | publish/
505 |
506 | # Publish Web Output
507 | *.[Pp]ublish.xml
508 | *.azurePubxml
509 | # TODO: Comment the next line if you want to checkin your web deploy settings
510 | # but database connection strings (with potential passwords) will be unencrypted
511 | *.pubxml
512 | *.publishproj
513 |
514 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
515 | # checkin your Azure Web App publish settings, but sensitive information contained
516 | # in these scripts will be unencrypted
517 | PublishScripts/
518 |
519 | # NuGet Packages
520 | *.nupkg
521 | # The packages folder can be ignored because of Package Restore
522 | **/packages/*
523 | # except build/, which is used as an MSBuild target.
524 | !**/packages/build/
525 | # Uncomment if necessary however generally it will be regenerated when needed
526 | #!**/packages/repositories.config
527 | # NuGet v3's project.json files produces more ignorable files
528 | *.nuget.props
529 | *.nuget.targets
530 |
531 | # Microsoft Azure Build Output
532 | csx/
533 | *.build.csdef
534 |
535 | # Microsoft Azure Emulator
536 | ecf/
537 | rcf/
538 |
539 | # Windows Store app package directories and files
540 | AppPackages/
541 | BundleArtifacts/
542 | Package.StoreAssociation.xml
543 | _pkginfo.txt
544 |
545 | # Visual Studio cache files
546 | # files ending in .cache can be ignored
547 | *.[Cc]ache
548 | # but keep track of directories ending in .cache
549 | !*.[Cc]ache/
550 |
551 | # Others
552 | ClientBin/
553 | ~$*
554 | *~
555 | *.dbmdl
556 | *.dbproj.schemaview
557 | *.jfm
558 | *.pfx
559 | *.publishsettings
560 | orleans.codegen.cs
561 |
562 | # Since there are multiple workflows, uncomment next line to ignore bower_components
563 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
564 | #bower_components/
565 |
566 | # RIA/Silverlight projects
567 | Generated_Code/
568 |
569 | # Backup & report files from converting an old project file
570 | # to a newer Visual Studio version. Backup files are not needed,
571 | # because we have git ;-)
572 | _UpgradeReport_Files/
573 | Backup*/
574 | UpgradeLog*.XML
575 | UpgradeLog*.htm
576 |
577 | # SQL Server files
578 | *.mdf
579 | *.ldf
580 | *.ndf
581 |
582 | # Business Intelligence projects
583 | *.rdl.data
584 | *.bim.layout
585 | *.bim_*.settings
586 |
587 | # Microsoft Fakes
588 | FakesAssemblies/
589 |
590 | # GhostDoc plugin setting file
591 | *.GhostDoc.xml
592 |
593 | # Node.js Tools for Visual Studio
594 | .ntvs_analysis.dat
595 | node_modules/
596 |
597 | # Typescript v1 declaration files
598 | typings/
599 |
600 | # Visual Studio 6 build log
601 | *.plg
602 |
603 | # Visual Studio 6 workspace options file
604 | *.opt
605 |
606 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
607 | *.vbw
608 |
609 | # Visual Studio LightSwitch build output
610 | **/*.HTMLClient/GeneratedArtifacts
611 | **/*.DesktopClient/GeneratedArtifacts
612 | **/*.DesktopClient/ModelManifest.xml
613 | **/*.Server/GeneratedArtifacts
614 | **/*.Server/ModelManifest.xml
615 | _Pvt_Extensions
616 |
617 | # Paket dependency manager
618 | .paket/paket.exe
619 | paket-files/
620 |
621 | # FAKE - F# Make
622 | .fake/
623 |
624 | # JetBrains Rider
625 | .idea/
626 | *.sln.iml
627 |
628 | # CodeRush
629 | .cr/
630 |
631 | # Python Tools for Visual Studio (PTVS)
632 | __pycache__/
633 | *.pyc
634 |
635 | # Cake - Uncomment if you are using it
636 | # tools/**
637 | # !tools/packages.config
638 |
639 | # Telerik's JustMock configuration file
640 | *.jmconfig
641 |
642 | # BizTalk build output
643 | *.btp.cs
644 | *.btm.cs
645 | *.odx.cs
646 | *.xsd.cs
647 | dist/
648 | node_modules/
649 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/HACC.Demo"]
2 | path = src/HACC.Demo
3 | url = https://github.com/Blazor-Console/HACC.Demo.git
4 | branch = main
5 | [submodule "src/HACC.Blazor.Extensions.Canvas"]
6 | path = src/HACC.Blazor.Extensions.Canvas
7 | url = https://github.com/Blazor-Console/HACC.Blazor.Extensions.Canvas.git
8 | branch = main
9 |
--------------------------------------------------------------------------------
/HACC-Demo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC", "src\HACC\HACC.csproj", "{1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Demo", "src\HACC.Demo\HACC.Demo.csproj", "{A129D6E9-274B-4E5C-81E5-79A36F1D6ED6}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas", "src\HACC.Blazor.Extensions.Canvas\src\HACC.Blazor.Extensions.Canvas\HACC.Blazor.Extensions.Canvas.csproj", "{9451E28E-8B00-4624-A0A3-6610D54FFA55}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas.Test.ClientSide", "src\HACC.Blazor.Extensions.Canvas\test\HACC.Blazor.Extensions.Canvas.Test.ClientSide\HACC.Blazor.Extensions.Canvas.Test.ClientSide.csproj", "{46FB7FB0-470B-455F-B9BA-3E0F95A8AE3C}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas.Test.ServerSide", "src\HACC.Blazor.Extensions.Canvas\test\HACC.Blazor.Extensions.Canvas.Test.ServerSide\HACC.Blazor.Extensions.Canvas.Test.ServerSide.csproj", "{9A9AB208-10CB-42F7-B05A-8CB1F0F2A1F2}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas.JS", "src\HACC.Blazor.Extensions.Canvas\src\HACC.Blazor.Extensions.Canvas.JS\HACC.Blazor.Extensions.Canvas.JS.csproj", "{27AAE2DB-36FA-45B4-8063-32AFD0EA77AE}"
17 | EndProject
18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17851D8D-94F3-4532-B227-96D608EF27CB}"
19 | ProjectSection(SolutionItems) = preProject
20 | .github\workflows\dotnet.yml = .github\workflows\dotnet.yml
21 | LICENSE = LICENSE
22 | README.md = README.md
23 | SECURITY.md = SECURITY.md
24 | EndProjectSection
25 | EndProject
26 | Global
27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
28 | Debug|Any CPU = Debug|Any CPU
29 | Release|Any CPU = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
32 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {A129D6E9-274B-4E5C-81E5-79A36F1D6ED6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {A129D6E9-274B-4E5C-81E5-79A36F1D6ED6}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {A129D6E9-274B-4E5C-81E5-79A36F1D6ED6}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 | {A129D6E9-274B-4E5C-81E5-79A36F1D6ED6}.Release|Any CPU.Build.0 = Release|Any CPU
40 | {9451E28E-8B00-4624-A0A3-6610D54FFA55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {9451E28E-8B00-4624-A0A3-6610D54FFA55}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {9451E28E-8B00-4624-A0A3-6610D54FFA55}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {9451E28E-8B00-4624-A0A3-6610D54FFA55}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {46FB7FB0-470B-455F-B9BA-3E0F95A8AE3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {46FB7FB0-470B-455F-B9BA-3E0F95A8AE3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {46FB7FB0-470B-455F-B9BA-3E0F95A8AE3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {46FB7FB0-470B-455F-B9BA-3E0F95A8AE3C}.Release|Any CPU.Build.0 = Release|Any CPU
48 | {9A9AB208-10CB-42F7-B05A-8CB1F0F2A1F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {9A9AB208-10CB-42F7-B05A-8CB1F0F2A1F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {9A9AB208-10CB-42F7-B05A-8CB1F0F2A1F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {9A9AB208-10CB-42F7-B05A-8CB1F0F2A1F2}.Release|Any CPU.Build.0 = Release|Any CPU
52 | {27AAE2DB-36FA-45B4-8063-32AFD0EA77AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53 | {27AAE2DB-36FA-45B4-8063-32AFD0EA77AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
54 | {27AAE2DB-36FA-45B4-8063-32AFD0EA77AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 | {27AAE2DB-36FA-45B4-8063-32AFD0EA77AE}.Release|Any CPU.Build.0 = Release|Any CPU
56 | EndGlobalSection
57 | GlobalSection(SolutionProperties) = preSolution
58 | HideSolutionNode = FALSE
59 | EndGlobalSection
60 | GlobalSection(ExtensibilityGlobals) = postSolution
61 | SolutionGuid = {C53630DB-CA65-4ADF-ACB2-2843F5F6A6BA}
62 | EndGlobalSection
63 | EndGlobal
64 |
--------------------------------------------------------------------------------
/HACC.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC", "src\HACC\HACC.csproj", "{1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas", "src\HACC.Blazor.Extensions.Canvas\src\HACC.Blazor.Extensions.Canvas\HACC.Blazor.Extensions.Canvas.csproj", "{5152081F-6837-40CD-9A98-D4F05AC8AC19}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas.JS", "src\HACC.Blazor.Extensions.Canvas\src\HACC.Blazor.Extensions.Canvas.JS\HACC.Blazor.Extensions.Canvas.JS.csproj", "{5C839EC5-2449-4EFE-BB9D-992275D4C8F8}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas.Test.ClientSide", "src\HACC.Blazor.Extensions.Canvas\test\HACC.Blazor.Extensions.Canvas.Test.ClientSide\HACC.Blazor.Extensions.Canvas.Test.ClientSide.csproj", "{CD81725C-C979-4D26-AC4F-18EB86E7F4E7}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Blazor.Extensions.Canvas.Test.ServerSide", "src\HACC.Blazor.Extensions.Canvas\test\HACC.Blazor.Extensions.Canvas.Test.ServerSide\HACC.Blazor.Extensions.Canvas.Test.ServerSide.csproj", "{4AB80082-6306-4282-B937-098E8ECB8537}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HACC.Demo", "src\HACC.Demo\HACC.Demo.csproj", "{C071EFA3-2EDE-4EC4-A6A0-F205F4694C67}"
17 | EndProject
18 | Global
19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
20 | Debug|Any CPU = Debug|Any CPU
21 | Release|Any CPU = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {1A9BF377-DB0B-4A72-8912-F99F1B26DCEE}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {5152081F-6837-40CD-9A98-D4F05AC8AC19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {5152081F-6837-40CD-9A98-D4F05AC8AC19}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {5152081F-6837-40CD-9A98-D4F05AC8AC19}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {5152081F-6837-40CD-9A98-D4F05AC8AC19}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {5C839EC5-2449-4EFE-BB9D-992275D4C8F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {5C839EC5-2449-4EFE-BB9D-992275D4C8F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {5C839EC5-2449-4EFE-BB9D-992275D4C8F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {5C839EC5-2449-4EFE-BB9D-992275D4C8F8}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {CD81725C-C979-4D26-AC4F-18EB86E7F4E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {CD81725C-C979-4D26-AC4F-18EB86E7F4E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {CD81725C-C979-4D26-AC4F-18EB86E7F4E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 | {CD81725C-C979-4D26-AC4F-18EB86E7F4E7}.Release|Any CPU.Build.0 = Release|Any CPU
40 | {4AB80082-6306-4282-B937-098E8ECB8537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {4AB80082-6306-4282-B937-098E8ECB8537}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {4AB80082-6306-4282-B937-098E8ECB8537}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {4AB80082-6306-4282-B937-098E8ECB8537}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {C071EFA3-2EDE-4EC4-A6A0-F205F4694C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {C071EFA3-2EDE-4EC4-A6A0-F205F4694C67}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {C071EFA3-2EDE-4EC4-A6A0-F205F4694C67}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {C071EFA3-2EDE-4EC4-A6A0-F205F4694C67}.Release|Any CPU.Build.0 = Release|Any CPU
48 | EndGlobalSection
49 | GlobalSection(SolutionProperties) = preSolution
50 | HideSolutionNode = FALSE
51 | EndGlobalSection
52 | GlobalSection(ExtensibilityGlobals) = postSolution
53 | SolutionGuid = {C53630DB-CA65-4ADF-ACB2-2843F5F6A6BA}
54 | EndGlobalSection
55 | EndGlobal
56 |
--------------------------------------------------------------------------------
/HACC.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Jessica Mulein, Digital Defiance and other collaborators
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HACC
2 |
3 | C# DotNet 6 HTML ANSI Console Canvas.
4 |
5 | This has been rendered inoperable with developments in terminal.gui, and the spectre.console driver is HACC 2.0.
6 |
7 | This is my final contribution to open source due to health reasons.
8 |
9 | https://github.com/spectreconsole/spectre.console/issues/1817
10 |
11 | -----
12 |
13 | * Contains a virtual terminal character buffer with text and appearance kept separately.
14 | * Contains a HTML component that renders the character buffer contents.
15 | * Contains driver code to create a System.Console compatible ANSI Console on an HTML5 Canvas.
16 | - Primary driver [Terminal.Gui](https://github.com/gui-cs/Terminal.Gui)
17 | - Secondary driver (in progress) for [Spectre.Console](https://github.com/spectreconsole/spectre.console)
18 | * Was formerly using the [BlazorExtensions/Canvas](https://github.com/Blazor-Console/HACC.Blazor.Extensions.Canvas) project, which has been somewhat stagnant.
19 | - We absorbed the library, also under MIT license, and brought it up to .net 6 and newer typescript, webpack and other npm libraries.
20 | - We're about to bring in some of the other improvements other forks had developed but not merged into the stagnant project.
21 |
22 | ## Beta!
23 | 
24 |
25 |
26 | ### Features
27 | - Builtin PNG frame-grabber
28 | - Can be triggered manually in console mode with window.canvasToPNG() which returns a data string with the frame at the time.
29 | - Can be integrated into an app with JSInterop calls such that the console application can have a "save to png" option, etc
30 | - 
31 |
32 |
33 | ## Tests
34 |
35 |
36 | - https://github.com/Blazor-Console/HACC.Tests
37 |
38 | ## Development
39 |
40 | * https://github.com/Blazor-Console/HACC/wiki/Developing
41 |
42 | ## Future
43 |
44 | * Terminal.Gui v2 / DotNet v7 support
45 | * Spectre.Console driver
46 |
47 | # About
48 | This project was built and is maintained by the [Digital Defiance](https://digitaldefiance.org) ([GitHub page](https://github.com/Digital-Defiance)) - a group of like-minded engineers working together to improve the world and have fun in the process.
49 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | These versions are currently being supported with security updates.
6 |
7 | | Version | Supported |
8 | | ------- | ------------------ |
9 | | 1.x.x | :white_check_mark: |
10 |
11 | ## Reporting a Vulnerability
12 |
13 | Please create an issue in the appropriate repository.
14 |
15 | We'll do our best to acknowledge and repair the issue as needed and as is prudent. We are a volunteer team.
16 |
--------------------------------------------------------------------------------
/blazor-canvas-editorconfig:
--------------------------------------------------------------------------------
1 | # http://EditorConfig.org
2 |
3 | # This file is the top-most EditorConfig file
4 | root = true
5 |
6 | # All Files
7 | [*]
8 | charset = utf-8
9 | end_of_line = crlf
10 | indent_style = space
11 | indent_size = 4
12 | insert_final_newline = false
13 | trim_trailing_whitespace = true
14 |
15 | # Solution Files
16 | [*.sln]
17 | indent_style = tab
18 |
19 | # XML Project Files
20 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
21 | indent_size = 2
22 |
23 | # Configuration Files
24 | [*.{json,xml,yml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
25 | indent_size = 2
26 |
27 | # Markdown Files
28 | [*.md]
29 | trim_trailing_whitespace = false
30 |
31 | # Web Files
32 | [*.{htm,html,js,ts,css,scss,less}]
33 | indent_size = 2
34 | insert_final_newline = true
35 |
36 | # Bash Files
37 | [*.sh]
38 | end_of_line = lf
39 |
40 | # Dotnet Code Style Settings
41 | # See https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
42 | # See http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
43 | [*.{cs,csx,cake,vb}]
44 | dotnet_sort_system_directives_first = true:warning
45 | dotnet_style_coalesce_expression = true:warning
46 | dotnet_style_collection_initializer = true:warning
47 | dotnet_style_explicit_tuple_names = true:warning
48 | dotnet_style_null_propagation = true:warning
49 | dotnet_style_object_initializer = true:warning
50 | dotnet_style_predefined_type_for_locals_parameters_members = true:warning
51 | dotnet_style_predefined_type_for_member_access = true:warning
52 | dotnet_style_qualification_for_event = true:warning
53 | dotnet_style_qualification_for_field = true:warning
54 | dotnet_style_qualification_for_method = true:warning
55 | dotnet_style_qualification_for_property = true:warning
56 |
57 | # Naming Symbols
58 | # constant_fields - Define constant fields
59 | dotnet_naming_symbols.constant_fields.applicable_kinds = field
60 | dotnet_naming_symbols.constant_fields.required_modifiers = const
61 | # non_private_readonly_fields - Define public, internal and protected readonly fields
62 | dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, internal, protected
63 | dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
64 | dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
65 | # static_readonly_fields - Define static and readonly fields
66 | dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
67 | dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
68 | # private_readonly_fields - Define private readonly fields
69 | dotnet_naming_symbols.private_readonly_fields.applicable_accessibilities = private
70 | dotnet_naming_symbols.private_readonly_fields.applicable_kinds = field
71 | dotnet_naming_symbols.private_readonly_fields.required_modifiers = readonly
72 | # public_internal_fields - Define public and internal fields
73 | dotnet_naming_symbols.public_internal_fields.applicable_accessibilities = public, internal
74 | dotnet_naming_symbols.public_internal_fields.applicable_kinds = field
75 | # private_protected_fields - Define private and protected fields
76 | dotnet_naming_symbols.private_protected_fields.applicable_accessibilities = private, protected
77 | dotnet_naming_symbols.private_protected_fields.applicable_kinds = field
78 | # public_symbols - Define any public symbol
79 | dotnet_naming_symbols.public_symbols.applicable_accessibilities = public, internal, protected, protected_internal
80 | dotnet_naming_symbols.public_symbols.applicable_kinds = method, property, event, delegate
81 | # parameters - Defines any parameter
82 | dotnet_naming_symbols.parameters.applicable_kinds = parameter
83 | # non_interface_types - Defines class, struct, enum and delegate types
84 | dotnet_naming_symbols.non_interface_types.applicable_kinds = class, struct, enum, delegate
85 | # interface_types - Defines interfaces
86 | dotnet_naming_symbols.interface_types.applicable_kinds = interface
87 |
88 | # Naming Styles
89 | # camel_case - Define the camelCase style
90 | dotnet_naming_style.camel_case.capitalization = camel_case
91 | # pascal_case - Define the Pascal_case style
92 | dotnet_naming_style.pascal_case.capitalization = pascal_case
93 | # first_upper - The first character must start with an upper-case character
94 | dotnet_naming_style.first_upper.capitalization = first_word_upper
95 | # prefix_interface_interface_with_i - Interfaces must be PascalCase and the first character of an interface must be an 'I'
96 | dotnet_naming_style.prefix_interface_interface_with_i.capitalization = pascal_case
97 | dotnet_naming_style.prefix_interface_interface_with_i.required_prefix = I
98 | # underscore_camel_case - Define the _camelCase style
99 | dotnet_naming_style.underscore_camel_case.capitalization = camel_case
100 | dotnet_naming_style.underscore_camel_case.required_prefix = _
101 |
102 | # Naming Rules
103 | # Constant fields must be PascalCase
104 | dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = warning
105 | dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields
106 | dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case
107 | # Public, internal and protected readonly fields must be PascalCase
108 | dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = warning
109 | dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.symbols = non_private_readonly_fields
110 | dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case
111 | # Static readonly fields must be PascalCase
112 | dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = warning
113 | dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields
114 | dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case
115 | # Private readonly fields must be _camelCase
116 | dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = warning
117 | dotnet_naming_rule.private_readonly_fields_must_be_camel_case.symbols = private_readonly_fields
118 | dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = underscore_camel_case
119 | # Public and internal fields must be PascalCase
120 | dotnet_naming_rule.public_internal_fields_must_be_pascal_case.severity = warning
121 | dotnet_naming_rule.public_internal_fields_must_be_pascal_case.symbols = public_internal_fields
122 | dotnet_naming_rule.public_internal_fields_must_be_pascal_case.style = pascal_case
123 | # Private and protected fields must be _camelCase
124 | dotnet_naming_rule.private_protected_fields_must_be_camel_case.severity = warning
125 | dotnet_naming_rule.private_protected_fields_must_be_camel_case.symbols = private_protected_fields
126 | dotnet_naming_rule.private_protected_fields_must_be_camel_case.style = underscore_camel_case
127 | # Public members must be capitalized
128 | dotnet_naming_rule.public_members_must_be_capitalized.severity = warning
129 | dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
130 | dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper
131 | # Parameters must be camelCase
132 | dotnet_naming_rule.parameters_must_be_camel_case.severity = warning
133 | dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters
134 | dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case
135 | # Class, struct, enum and delegates must be PascalCase
136 | dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = warning
137 | dotnet_naming_rule.non_interface_types_must_be_pascal_case.symbols = non_interface_types
138 | dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case
139 | # Interfaces must be PascalCase and start with an 'I'
140 | dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = warning
141 | dotnet_naming_rule.interface_types_must_be_prefixed_with_i.symbols = interface_types
142 | dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i
143 |
144 | # C# Code Style Settings
145 | # See https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
146 | # See http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
147 | [*.cs,csx,cake]
148 | # Indentation Options
149 | csharp_indent_block_contents = true:warning
150 | csharp_indent_braces = false:warning
151 | csharp_indent_case_contents = true:warning
152 | csharp_indent_labels = no_change:warning
153 | csharp_indent_switch_labels = true:warning
154 | # Style Options
155 | csharp_style_conditional_delegate_call = true:warning
156 | csharp_style_expression_bodied_accessors = true:warning
157 | csharp_style_expression_bodied_constructors = true:warning
158 | csharp_style_expression_bodied_indexers = true:warning
159 | csharp_style_expression_bodied_methods = true:warning
160 | csharp_style_expression_bodied_operators = true:warning
161 | csharp_style_expression_bodied_properties = true:warning
162 | csharp_style_inlined_variable_declaration = true:warning
163 | csharp_style_pattern_matching_over_as_with_null_check = true:warning
164 | csharp_style_pattern_matching_over_is_with_cast_check = true:warning
165 | csharp_style_throw_expression = true:warning
166 | csharp_style_var_elsewhere = true:warning
167 | csharp_style_var_for_built_in_types = true:warning
168 | csharp_style_var_when_type_is_apparent = true:warning
169 | # New Line Options
170 | csharp_new_line_before_catch = true:warning
171 | csharp_new_line_before_else = true:warning
172 | csharp_new_line_before_finally = true:warning
173 | csharp_new_line_before_members_in_anonymous_types = true:warning
174 | csharp_new_line_before_members_in_object_initializers = true:warning
175 | # BUG: Warning level cannot be set https://github.com/dotnet/roslyn/issues/18010
176 | csharp_new_line_before_open_brace = all
177 | csharp_new_line_between_query_expression_clauses = true:warning
178 | # Spacing Options
179 | csharp_space_after_cast = false:warning
180 | csharp_space_after_colon_in_inheritance_clause = true:warning
181 | csharp_space_after_comma = true:warning
182 | csharp_space_after_dot = false:warning
183 | csharp_space_after_keywords_in_control_flow_statements = true:warning
184 | csharp_space_after_semicolon_in_for_statement = true:warning
185 | csharp_space_around_binary_operators = before_and_after:warning
186 | csharp_space_around_declaration_statements = do_not_ignore:warning
187 | csharp_space_before_colon_in_inheritance_clause = true:warning
188 | csharp_space_before_comma = false:warning
189 | csharp_space_before_dot = false:warning
190 | csharp_space_before_semicolon_in_for_statement = false:warning
191 | csharp_space_before_open_square_brackets = false:warning
192 | csharp_space_between_empty_square_brackets = false:warning
193 | csharp_space_between_method_declaration_name_and_open_parenthesis = false:warning
194 | csharp_space_between_method_declaration_parameter_list_parentheses = false:warning
195 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false:warning
196 | csharp_space_between_method_call_name_and_opening_parenthesis = false:warning
197 | csharp_space_between_method_call_parameter_list_parentheses = false:warning
198 | csharp_space_between_method_call_empty_parameter_list_parentheses = false:warning
199 | csharp_space_between_parentheses = expressions:warning
200 | csharp_space_between_square_brackets = false:warning
201 | # Wrapping Options
202 | csharp_preserve_single_line_blocks = true:warning
203 | csharp_preserve_single_line_statements = false:warning
--------------------------------------------------------------------------------
/old-blazor-canvas-github-workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | build:
10 |
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/checkout@v1
15 | - name: Setup .NET Core
16 | uses: actions/setup-dotnet@v1
17 | with:
18 | dotnet-version: 3.1.301
19 | - name: Build
20 | run: dotnet build --configuration Release
--------------------------------------------------------------------------------
/old-blazor-canvas-github-workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish
2 |
3 | on:
4 | push:
5 | tags:
6 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7 |
8 | jobs:
9 | build:
10 |
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - uses: actions/checkout@v1
15 | - name: Setup .NET Core
16 | uses: actions/setup-dotnet@v1
17 | with:
18 | dotnet-version: 3.1.301
19 | - name: Build
20 | run: dotnet build --configuration Release
21 | - name: Pack
22 | working-directory: src/Blazor.Extensions.Canvas
23 | run: dotnet pack --configuration Release
24 | - name: Push
25 | working-directory: src/Blazor.Extensions.Canvas/bin/Release
26 | run: |
27 | dotnet nuget push Blazor.Extensions.Canvas.*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
28 | - name: Create Release
29 | uses: actions/create-release@master
30 | env:
31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 | with:
33 | tag_name: ${{ github.ref }}
34 | release_name: Release ${{ github.ref }}
35 | draft: false
36 | prerelease: false
--------------------------------------------------------------------------------
/setupKeybase.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | hasRemote() {
3 | status=$(git remote show | grep "keybase" | wc -l)
4 | return [[ status -eq 1 ]];
5 | }
6 |
7 | setupRemote() {
8 | if [[ ! hasRemote ]]; then
9 | git remote add keybase "$1"
10 | fi
11 | }
12 |
13 | # make sure we're at toplevel
14 | SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
15 | OPWD=$(pwd)
16 | cd "${SCRIPT_DIR}"
17 | setupRemote keybase://team/digitalrebellion/HACC.Development
18 | cd "${SCRIPT_DIR}/src/HACC"
19 | setupRemote keybase://team/digitalrebellion/HACC
20 | cd "${SCRIPT_DIR}/src/HACC.Demo"
21 | setupRemote keybase://team/digitalrebellion/HACC.Demo
22 | cd "${SCRIPT_DIR}/test/HACC.Tests"
23 | setupRemote keybase://team/digitalrebellion/HACC.Tests
24 | cd "${OPWD}"
25 |
--------------------------------------------------------------------------------
/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Digital Defiance Contributors
5 | Blazor Console Canvas
6 | (c) Digital Defiance and HACC Blazor Extensions Contributors. All rights reserved.
7 | MIT
8 | https://github.com/Blazor-Console/HACC
9 | Microsoft ASP.NET Core HACC Blazor Extensions Canvas HTML5 ansi console canvas
10 |
11 | https://github.com/Blazor-Console/HACC
12 | git
13 | true
14 |
15 |
16 |
17 |
18 | latest
19 | true
20 | true
21 |
22 | full
23 |
24 |
25 |
26 | net6.0
27 | net6.0
28 |
29 |
30 |
31 |
32 | 0.1.0
33 | dev
34 |
35 |
36 |
37 |
38 |
42 |
43 | <developer build>
44 |
45 |
46 |
47 |
48 | $(BUILD_SOURCEVERSION)
49 |
50 |
51 |
52 |
53 | $(GIT_COMMIT)
54 |
55 |
56 |
57 |
58 | Not found
59 | $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory).git'))
60 | $([System.IO.File]::ReadAllText('$(DotGitDir)/HEAD').Trim())
61 | $(DotGitDir)/$(HeadFileContent.Substring(5))
62 | $([System.IO.File]::ReadAllText('$(RefPath)').Trim())
63 | $(HeadFileContent)
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/src/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(Version). Commit Hash: $(GitHeadSha)
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/HACC/.editorconfig:
--------------------------------------------------------------------------------
1 |
2 | [*]
3 | charset = utf-8
4 | end_of_line = crlf
5 | trim_trailing_whitespace = false
6 | insert_final_newline = false
7 | indent_style = space
8 | indent_size = 4
9 |
10 | # Microsoft .NET properties
11 | csharp_new_line_before_members_in_object_initializers = false
12 | csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
13 | csharp_space_after_cast = true
14 | csharp_style_var_elsewhere = true:suggestion
15 | csharp_style_var_for_built_in_types = true:suggestion
16 | csharp_style_var_when_type_is_apparent = true:suggestion
17 | dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
18 | dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
19 | dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
20 | dotnet_naming_rule.unity_serialized_field_rule.severity = warning
21 | dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
22 | dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
23 | dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
24 | dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
25 | dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
26 | dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
27 | dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
28 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
29 | dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
30 | dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
31 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
32 | dotnet_style_predefined_type_for_member_access = true:suggestion
33 | dotnet_style_qualification_for_event = true:suggestion
34 | dotnet_style_qualification_for_field = true:suggestion
35 | dotnet_style_qualification_for_method = true:suggestion
36 | dotnet_style_qualification_for_property = true:suggestion
37 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
38 |
39 | # ReSharper properties
40 | resharper_arguments_anonymous_function = named
41 | resharper_arguments_literal = named
42 | resharper_arguments_named = named
43 | resharper_arguments_other = named
44 | resharper_arguments_string_literal = named
45 | resharper_autodetect_indent_settings = true
46 | resharper_csharp_place_type_constraints_on_same_line = false
47 | resharper_csharp_wrap_arguments_style = chop_always
48 | resharper_csharp_wrap_before_first_type_parameter_constraint = true
49 | resharper_show_autodetect_configure_formatting_tip = false
50 | resharper_space_within_single_line_array_initializer_braces = false
51 | resharper_trailing_comma_in_multiline_lists = true
52 | resharper_use_indent_from_vs = false
53 | resharper_wrap_before_arrow_with_expressions = true
54 |
55 | # ReSharper inspection severities
56 | resharper_arrange_redundant_parentheses_highlighting = hint
57 | resharper_arrange_this_qualifier_highlighting = hint
58 | resharper_arrange_type_member_modifiers_highlighting = hint
59 | resharper_arrange_type_modifiers_highlighting = hint
60 | resharper_built_in_type_reference_style_for_member_access_highlighting = hint
61 | resharper_built_in_type_reference_style_highlighting = hint
62 | resharper_suggest_var_or_type_built_in_types_highlighting = hint
63 | resharper_suggest_var_or_type_elsewhere_highlighting = hint
64 | resharper_suggest_var_or_type_simple_types_highlighting = hint
65 | resharper_web_config_module_not_resolved_highlighting = warning
66 | resharper_web_config_type_not_resolved_highlighting = warning
67 | resharper_web_config_wrong_module_highlighting = warning
68 |
69 | [{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}]
70 | indent_style = space
71 | indent_size = 2
72 |
73 | [*.{appxmanifest,asax,ascx,aspx,axaml,build,cg,cginc,compute,cs,cshtml,dtd,fs,fsi,fsscript,fsx,hlsl,hlsli,hlslinc,master,ml,mli,nuspec,paml,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}]
74 | indent_style = space
75 | indent_size = 4
76 | tab_width = 4
77 |
78 | # Visual Studio XML project files
79 | [*.{csproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
80 | indent_size = 2
81 |
--------------------------------------------------------------------------------
/src/HACC/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # Rider
7 | .idea/
8 |
9 | # User-specific files
10 | *.rsuser
11 | *.suo
12 | *.user
13 | *.userosscache
14 | *.sln.docstates
15 |
16 | # User-specific files (MonoDevelop/Xamarin Studio)
17 | *.userprefs
18 |
19 | # Mono auto generated files
20 | mono_crash.*
21 |
22 | # Build results
23 | [Dd]ebug/
24 | [Dd]ebugPublic/
25 | [Rr]elease/
26 | [Rr]eleases/
27 | x64/
28 | x86/
29 | [Aa][Rr][Mm]/
30 | [Aa][Rr][Mm]64/
31 | bld/
32 | [Bb]in/
33 | [Oo]bj/
34 | [Ll]og/
35 | [Ll]ogs/
36 |
37 | # Visual Studio 2015/2017 cache/options directory
38 | .vs/
39 | # Uncomment if you have tasks that create the project's static files in wwwroot
40 | #wwwroot/
41 |
42 | # Visual Studio 2017 auto generated files
43 | Generated\ Files/
44 |
45 | # MSTest test Results
46 | [Tt]est[Rr]esult*/
47 | [Bb]uild[Ll]og.*
48 |
49 | # NUnit
50 | *.VisualState.xml
51 | TestResult.xml
52 | nunit-*.xml
53 |
54 | # Build Results of an ATL Project
55 | [Dd]ebugPS/
56 | [Rr]eleasePS/
57 | dlldata.c
58 |
59 | # Benchmark Results
60 | BenchmarkDotNet.Artifacts/
61 |
62 | # .NET Core
63 | project.lock.json
64 | project.fragment.lock.json
65 | artifacts/
66 |
67 | # StyleCop
68 | StyleCopReport.xml
69 |
70 | # Files built by Visual Studio
71 | *_i.c
72 | *_p.c
73 | *_h.h
74 | *.ilk
75 | *.meta
76 | *.obj
77 | *.iobj
78 | *.pch
79 | *.pdb
80 | *.ipdb
81 | *.pgc
82 | *.pgd
83 | *.rsp
84 | *.sbr
85 | *.tlb
86 | *.tli
87 | *.tlh
88 | *.tmp
89 | *.tmp_proj
90 | *_wpftmp.csproj
91 | *.log
92 | *.vspscc
93 | *.vssscc
94 | .builds
95 | *.pidb
96 | *.svclog
97 | *.scc
98 |
99 | # Chutzpah Test files
100 | _Chutzpah*
101 |
102 | # Visual C++ cache files
103 | ipch/
104 | *.aps
105 | *.ncb
106 | *.opendb
107 | *.opensdf
108 | *.sdf
109 | *.cachefile
110 | *.VC.db
111 | *.VC.VC.opendb
112 |
113 | # Visual Studio profiler
114 | *.psess
115 | *.vsp
116 | *.vspx
117 | *.sap
118 |
119 | # Visual Studio Trace Files
120 | *.e2e
121 |
122 | # TFS 2012 Local Workspace
123 | $tf/
124 |
125 | # Guidance Automation Toolkit
126 | *.gpState
127 |
128 | # ReSharper is a .NET coding add-in
129 | _ReSharper*/
130 | *.[Rr]e[Ss]harper
131 | *.DotSettings.user
132 |
133 | # TeamCity is a build add-in
134 | _TeamCity*
135 |
136 | # DotCover is a Code Coverage Tool
137 | *.dotCover
138 |
139 | # AxoCover is a Code Coverage Tool
140 | .axoCover/*
141 | !.axoCover/settings.json
142 |
143 | # Visual Studio code coverage results
144 | *.coverage
145 | *.coveragexml
146 |
147 | # NCrunch
148 | _NCrunch_*
149 | .*crunch*.local.xml
150 | nCrunchTemp_*
151 |
152 | # MightyMoose
153 | *.mm.*
154 | AutoTest.Net/
155 |
156 | # Web workbench (sass)
157 | .sass-cache/
158 |
159 | # Installshield output folder
160 | [Ee]xpress/
161 |
162 | # DocProject is a documentation generator add-in
163 | DocProject/buildhelp/
164 | DocProject/Help/*.HxT
165 | DocProject/Help/*.HxC
166 | DocProject/Help/*.hhc
167 | DocProject/Help/*.hhk
168 | DocProject/Help/*.hhp
169 | DocProject/Help/Html2
170 | DocProject/Help/html
171 |
172 | # Click-Once directory
173 | publish/
174 |
175 | # Publish Web Output
176 | *.[Pp]ublish.xml
177 | *.azurePubxml
178 | # Note: Comment the next line if you want to checkin your web deploy settings,
179 | # but database connection strings (with potential passwords) will be unencrypted
180 | *.pubxml
181 | *.publishproj
182 |
183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
184 | # checkin your Azure Web App publish settings, but sensitive information contained
185 | # in these scripts will be unencrypted
186 | PublishScripts/
187 |
188 | # NuGet Packages
189 | *.nupkg
190 | # NuGet Symbol Packages
191 | *.snupkg
192 | # The packages folder can be ignored because of Package Restore
193 | **/[Pp]ackages/*
194 | # except build/, which is used as an MSBuild target.
195 | !**/[Pp]ackages/build/
196 | # Uncomment if necessary however generally it will be regenerated when needed
197 | #!**/[Pp]ackages/repositories.config
198 | # NuGet v3's project.json files produces more ignorable files
199 | *.nuget.props
200 | *.nuget.targets
201 |
202 | # Microsoft Azure Build Output
203 | csx/
204 | *.build.csdef
205 |
206 | # Microsoft Azure Emulator
207 | ecf/
208 | rcf/
209 |
210 | # Windows Store app package directories and files
211 | AppPackages/
212 | BundleArtifacts/
213 | Package.StoreAssociation.xml
214 | _pkginfo.txt
215 | *.appx
216 | *.appxbundle
217 | *.appxupload
218 |
219 | # Visual Studio cache files
220 | # files ending in .cache can be ignored
221 | *.[Cc]ache
222 | # but keep track of directories ending in .cache
223 | !?*.[Cc]ache/
224 |
225 | # Others
226 | ClientBin/
227 | ~$*
228 | *~
229 | *.dbmdl
230 | *.dbproj.schemaview
231 | *.jfm
232 | *.pfx
233 | *.publishsettings
234 | orleans.codegen.cs
235 |
236 | # Including strong name files can present a security risk
237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
238 | #*.snk
239 |
240 | # Since there are multiple workflows, uncomment next line to ignore bower_components
241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
242 | #bower_components/
243 |
244 | # RIA/Silverlight projects
245 | Generated_Code/
246 |
247 | # Backup & report files from converting an old project file
248 | # to a newer Visual Studio version. Backup files are not needed,
249 | # because we have git ;-)
250 | _UpgradeReport_Files/
251 | Backup*/
252 | UpgradeLog*.XML
253 | UpgradeLog*.htm
254 | ServiceFabricBackup/
255 | *.rptproj.bak
256 |
257 | # SQL Server files
258 | *.mdf
259 | *.ldf
260 | *.ndf
261 |
262 | # Business Intelligence projects
263 | *.rdl.data
264 | *.bim.layout
265 | *.bim_*.settings
266 | *.rptproj.rsuser
267 | *- [Bb]ackup.rdl
268 | *- [Bb]ackup ([0-9]).rdl
269 | *- [Bb]ackup ([0-9][0-9]).rdl
270 |
271 | # Microsoft Fakes
272 | FakesAssemblies/
273 |
274 | # GhostDoc plugin setting file
275 | *.GhostDoc.xml
276 |
277 | # Node.js Tools for Visual Studio
278 | .ntvs_analysis.dat
279 | node_modules/
280 |
281 | # Visual Studio 6 build log
282 | *.plg
283 |
284 | # Visual Studio 6 workspace options file
285 | *.opt
286 |
287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
288 | *.vbw
289 |
290 | # Visual Studio LightSwitch build output
291 | **/*.HTMLClient/GeneratedArtifacts
292 | **/*.DesktopClient/GeneratedArtifacts
293 | **/*.DesktopClient/ModelManifest.xml
294 | **/*.Server/GeneratedArtifacts
295 | **/*.Server/ModelManifest.xml
296 | _Pvt_Extensions
297 |
298 | # Paket dependency manager
299 | .paket/paket.exe
300 | paket-files/
301 |
302 | # FAKE - F# Make
303 | .fake/
304 |
305 | # CodeRush personal settings
306 | .cr/personal
307 |
308 | # Python Tools for Visual Studio (PTVS)
309 | __pycache__/
310 | *.pyc
311 |
312 | # Cake - Uncomment if you are using it
313 | # tools/**
314 | # !tools/packages.config
315 |
316 | # Tabs Studio
317 | *.tss
318 |
319 | # Telerik's JustMock configuration file
320 | *.jmconfig
321 |
322 | # BizTalk build output
323 | *.btp.cs
324 | *.btm.cs
325 | *.odx.cs
326 | *.xsd.cs
327 |
328 | # OpenCover UI analysis results
329 | OpenCover/
330 |
331 | # Azure Stream Analytics local run output
332 | ASALocalRun/
333 |
334 | # MSBuild Binary and Structured Log
335 | *.binlog
336 |
337 | # NVidia Nsight GPU debugger configuration file
338 | *.nvuser
339 |
340 | # MFractors (Xamarin productivity tool) working folder
341 | .mfractor/
342 |
343 | # Local History for Visual Studio
344 | .localhistory/
345 |
346 | # BeatPulse healthcheck temp database
347 | healthchecksdb
348 |
349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
350 | MigrationBackup/
351 |
352 | # Ionide (cross platform F# VS Code tools) working folder
353 | .ionide/
354 |
--------------------------------------------------------------------------------
/src/HACC/Applications/WebApplication.cs:
--------------------------------------------------------------------------------
1 | using HACC.Components;
2 | using HACC.Models;
3 | using HACC.Models.Drivers;
4 | using Terminal.Gui;
5 |
6 | namespace HACC.Applications;
7 |
8 | public class WebApplication : IAsyncDisposable
9 | {
10 | private readonly bool _wait = true;
11 | private bool _initialized;
12 | private Application.RunState? _currentRunState;
13 | private List _runStates = new();
14 | private Timer? _timer;
15 | private Application.RunState? _stoppingRunState;
16 | private bool _running;
17 | private CancellationTokenSource? _cancellationTokenSource;
18 | private CancellationToken _cancellationToken;
19 | private readonly List _disposables = new();
20 |
21 | public WebConsole? WebConsole { get; private set; }
22 | public WebConsoleDriver? WebConsoleDriver { get; private set; }
23 | public WebMainLoopDriver? WebMainLoopDriver { get; private set; }
24 |
25 | public event Action? RunStateEnding;
26 |
27 | public event Action? WebVisibilityChanged;
28 |
29 | public event Action? WebFocusChanged;
30 |
31 | public event Action? WebPageClosing;
32 |
33 | public virtual async Task Init(ConsoleDriver? webConsoleDriver = null,
34 | IMainLoopDriver? webMainLoopDriver = null, WebConsole? webConsole = null)
35 | {
36 | if (this._initialized) return;
37 |
38 | if (webConsoleDriver == null)
39 | throw new ArgumentNullException(nameof(webConsoleDriver));
40 | if (webMainLoopDriver == null)
41 | throw new ArgumentNullException(nameof(webMainLoopDriver));
42 | if (webConsole == null)
43 | throw new ArgumentNullException(nameof(webConsole));
44 | this.WebConsoleDriver = (WebConsoleDriver?) webConsoleDriver;
45 | this.WebMainLoopDriver = (WebMainLoopDriver?) webMainLoopDriver;
46 | this.WebConsole = webConsole;
47 | Application.ExitRunLoopAfterFirstIteration = true;
48 | await Task.Run(() => Application.Init(
49 | driver: this.WebConsoleDriver,
50 | mainLoopDriver: this.WebMainLoopDriver));
51 |
52 | this.WebConsole.RunIterationNeeded += this.WebConsole_RunIterationNeeded;
53 | this._cancellationTokenSource = new CancellationTokenSource();
54 | this._cancellationToken = this._cancellationTokenSource.Token;
55 | this._cancellationToken.ThrowIfCancellationRequested();
56 | Application.NotifyNewRunState += this.Application_NotifyNewRunState;
57 | Application.NotifyStopRunState += this.Application_NotifyStopRunState;
58 | //Application.MainLoop.TimeoutAdded += this.MainLoop_TimeoutAdded;
59 | this._initialized = true;
60 | this._timer = new Timer((_) => this.ProcessTimer(), null, 1000, 1000);
61 | }
62 |
63 | private void ProcessTimer()
64 | {
65 | if (this._running)
66 | return;
67 |
68 | try
69 | {
70 | if (Application.MainLoop.Timeouts.Count > 0)
71 | {
72 | var now = DateTime.UtcNow.Ticks;
73 | var waitTimeout = (int) ((Application.MainLoop.Timeouts.Keys[index: 0] - now) / TimeSpan.TicksPerMillisecond);
74 | if (waitTimeout < 0)
75 | this.WebConsole!.OnTimeout();
76 | }
77 | else
78 | {
79 | this.WebConsoleDriver!.UpdateCursor();
80 | }
81 | }
82 | catch (Exception ex)
83 | {
84 | Console.WriteLine($"ProcessTimer: {ex.Message}");
85 | }
86 | }
87 |
88 | //private void MainLoop_TimeoutAdded(long obj)
89 | //{
90 | // var now = DateTime.UtcNow.Ticks;
91 | // var waitTimeout = Math.Max((int) ((obj - now) / TimeSpan.TicksPerMillisecond), 0);
92 | //_timer = new Timer(_ => this.WebConsole.OnTimeout(),
93 | // null, waitTimeout, Timeout.Infinite);
94 | //}
95 |
96 | private async Task WebConsole_RunIterationNeeded()
97 | {
98 | if (this._currentRunState == null) return;
99 |
100 | this._running = true;
101 | var firstIteration = false;
102 | await Task.Run(() => Application.RunMainLoopIteration(state: ref this._currentRunState,
103 | wait: this._wait,
104 | firstIteration: ref firstIteration));
105 | if (this._currentRunState.Toplevel != Application.Top && (!this._currentRunState.Toplevel.Running
106 | || this._stoppingRunState != null))
107 | {
108 | Application.RunState? runState;
109 | if (this._stoppingRunState != null && this._stoppingRunState.Toplevel != this._currentRunState.Toplevel)
110 | {
111 | runState = this._runStates.Find(rs => rs.Toplevel == this._stoppingRunState.Toplevel);
112 | }
113 | else
114 | {
115 | runState = this._currentRunState;
116 | }
117 | Application.End(runState);
118 | this._runStates.Remove(runState!);
119 | this._stoppingRunState = null;
120 | if (this._currentRunState.Toplevel != Application.Current)
121 | {
122 | this._currentRunState = new Application.RunState(Application.Current);
123 | }
124 | }
125 | this._running = false;
126 | }
127 |
128 | private void Application_NotifyStopRunState(Toplevel obj)
129 | {
130 | this._stoppingRunState = new Application.RunState(obj);
131 | this.RunStateEnding?.Invoke(obj);
132 | }
133 |
134 | private void Application_NotifyNewRunState(Application.RunState obj)
135 | {
136 | this._runStates.Add(new Application.RunState(obj.Toplevel));
137 | View view = obj.Toplevel;
138 | var task = Task.Run(async () => await this.RunLoop(obj));
139 | task.ContinueWith(async _ =>
140 | {
141 | this._disposables.Remove(task);
142 | await this.WebConsole_RunIterationNeeded();
143 | });
144 | this._disposables.Add(task);
145 | task.Start();
146 | } // this line is never hit
147 |
148 | private async Task RunLoop(Application.RunState runToken)
149 | {
150 | if (!this._initialized) await this.Init();
151 |
152 | var view = runToken.Toplevel;
153 | var firstIteration = true;
154 | this._currentRunState = runToken;
155 | this.WebConsole!.OnReadConsoleInput();
156 |
157 | try
158 | {
159 | for (view.Running = true; view.Running;)
160 | {
161 | if (firstIteration)
162 | Application.RunMainLoopIteration(state: ref this._currentRunState,
163 | wait: this._wait,
164 | firstIteration: ref firstIteration);
165 |
166 | await Task.Delay(1000);
167 | }
168 | }
169 | catch (OperationCanceledException)
170 | {
171 | await this.Shutdown();
172 | return;
173 | }
174 | }
175 |
176 | public virtual async Task Run(Func? errorHandler = null)
177 | {
178 | await this.Run(view: Application.Top,
179 | errorHandler: errorHandler);
180 | }
181 |
182 | public virtual async Task Run(Func? errorHandler = null)
183 | where T : Toplevel, new()
184 | {
185 | if (this._initialized && Application.Driver != null)
186 | {
187 | var top = new T();
188 | if (top.GetType().BaseType != typeof(Toplevel))
189 | throw new ArgumentException(message: top.GetType().BaseType?.Name);
190 | await this.Run(view: top,
191 | errorHandler: errorHandler);
192 | }
193 | else
194 | {
195 | await this.Init();
196 | await this.Run(view: Application.Top,
197 | errorHandler: errorHandler);
198 | }
199 | }
200 |
201 | public virtual async Task Run(Toplevel view, Func? errorHandler = null)
202 | {
203 | try
204 | {
205 | if (!this._initialized) await this.Init();
206 |
207 | var runToken = Application.Begin(toplevel: view ?? Application.Top);
208 | this._runStates.Add(new Application.RunState(runToken.Toplevel));
209 | var firstIteration = true;
210 | this._currentRunState = runToken;
211 | this.WebConsole!.OnReadConsoleInput();
212 |
213 | try
214 | {
215 | for (view!.Running = true; view.Running;)
216 | {
217 | if (firstIteration)
218 | {
219 | Application.RunMainLoopIteration(state: ref this._currentRunState,
220 | wait: this._wait,
221 | firstIteration: ref firstIteration);
222 | }
223 |
224 | await Task.Delay(1000, this._cancellationToken);
225 | }
226 | }
227 | catch (OperationCanceledException)
228 | {
229 | return;
230 | }
231 | if (!this._cancellationToken.IsCancellationRequested)
232 | {
233 | if (view == Application.Top)
234 | {
235 | await this.End(new Application.RunState(view));
236 | await this.Shutdown();
237 | await this.DisposeAsync();
238 | }
239 | return;
240 | }
241 | }
242 | catch (Exception error) when (errorHandler != null)
243 | {
244 | if (!errorHandler(arg: error)) await this.Shutdown();
245 | }
246 | }
247 |
248 | public virtual async Task End(Application.RunState? runState = null)
249 | {
250 | if (!this._initialized) return;
251 |
252 | if (runState != null || this._currentRunState != null)
253 | await Task.Run(() => Application.End(runState: runState ?? this._currentRunState));
254 | }
255 |
256 | public virtual Task Shutdown()
257 | {
258 | return Task.Run(() =>
259 | {
260 | if (this._timer != null)
261 | _ = this._timer!.DisposeAsync();
262 | Application.Shutdown();
263 | this._initialized = false;
264 | });
265 | }
266 |
267 | internal void OnWebFocusChanged(bool hasFocus)
268 | {
269 | this.WebFocusChanged?.Invoke(hasFocus);
270 | }
271 |
272 | internal void OnWebVisibilityChanged(bool visible)
273 | {
274 | this.WebVisibilityChanged?.Invoke(visible);
275 | }
276 |
277 | internal void OnWebPageClosing()
278 | {
279 | this.WebPageClosing?.Invoke();
280 | }
281 |
282 | public async ValueTask DisposeAsync()
283 | {
284 | await this._timer!.DisposeAsync();
285 | this._timer = null;
286 | this._cancellationTokenSource!.Cancel();
287 | this._cancellationTokenSource.Dispose();
288 | this._cancellationTokenSource = null;
289 | this.RunStateEnding = null;
290 | this._currentRunState = null;
291 | this._runStates = new();
292 | this._stoppingRunState = null;
293 | GC.SuppressFinalize(this);
294 | }
295 | }
--------------------------------------------------------------------------------
/src/HACC/Components/WebConsole.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/HACC/Configuration/Defaults.cs:
--------------------------------------------------------------------------------
1 | using HACC.Enumerations;
2 |
3 | namespace HACC.Configuration;
4 |
5 | ///
6 | /// Default values for terminal settings and canvas
7 | ///
8 | public static class Defaults
9 | {
10 | public const int MaximumColumns = 1000;
11 | public const int MaximumRows = 1000;
12 | public const int InitialTerminalWidth = 640;
13 | public const int InitialTerminalHeight = 480;
14 | public const int InitialBufferRows = 25;
15 | public const int InitialBufferColumns = 80;
16 | public const int InitialColumns = 80;
17 | public const int InitialRows = 25;
18 | public const CursorType CursorShape = CursorType.Block;
19 | public const ConsoleColor CursorColor = ConsoleColor.Red;
20 | public const ConsoleColor CursorAlternateColor = ConsoleColor.Yellow;
21 | public const int CursorSize = 100;
22 | public const int CursorHeight = 100;
23 | public const bool CursorVisibility = true;
24 | public const bool StatusVisibility = true;
25 | public const bool TitleVisibility = true;
26 | public const ConsoleColor BackgroundColor = ConsoleColor.Black;
27 | public const ConsoleColor ForegroundColor = ConsoleColor.White;
28 | public const float BeepFrequency = 800.0f;
29 | public const float BeepDurationMsec = 50.0f;
30 | public const float BeepVolume = 1.0f;
31 | public const BeepType BeepType = Enumerations.BeepType.Sine;
32 | public const int FontSize = 16;
33 | public const int FontSpace = FontSize / 2;
34 | public const string FontType = "Courier";
35 | }
--------------------------------------------------------------------------------
/src/HACC/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Digital Defiance Contributors
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/HACC/Enumerations/BeepType.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Enumerations;
2 |
3 | public enum BeepType
4 | {
5 | Sine,
6 | Square,
7 | Sawtooth,
8 | Triangle,
9 | Custom,
10 | }
--------------------------------------------------------------------------------
/src/HACC/Enumerations/CursorType.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Enumerations;
2 |
3 | public enum CursorType
4 | {
5 | Block,
6 | Underline,
7 | Bar,
8 | }
--------------------------------------------------------------------------------
/src/HACC/Enumerations/RuneDataType.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Enumerations;
2 |
3 | public enum RuneDataType
4 | {
5 | Rune = 0,
6 | Attribute = 1,
7 | DirtyFlag = 2,
8 | }
--------------------------------------------------------------------------------
/src/HACC/Enumerations/WebGLEnums.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Enumerations;
2 |
3 | public enum BufferBits
4 | {
5 | COLOR_BUFFER_BIT = 0x4000,
6 | DEPTH_BUFFER_BIT = 0x100,
7 | STENCIL_BUFFER_BIT = 0x400,
8 | }
9 |
10 | public enum Primitive
11 | {
12 | POINTS = 0,
13 | LINES = 1,
14 | LINE_LOOP = 2,
15 | LINE_STRIP = 3,
16 | TRIANGLES = 4,
17 | TRIANGLE_STRIP = 5,
18 | TRIANGLE_FAN = 6,
19 | }
20 |
21 | public enum BlendingMode
22 | {
23 | ZERO = 0,
24 | ONE = 1,
25 | SRC_COLOR = 0x300,
26 | ONE_MINUS_SRC_COLOR = 0x301,
27 | SRC_ALPHA = 0x302,
28 | ONE_MINUS_SRC_ALPHA = 0x303,
29 | DST_ALPHA = 0x304,
30 | ONE_MINUS_DST_ALPHA = 0x305,
31 | DST_COLOR = 0x306,
32 | ONE_MINUS_DST_COLOR = 0x307,
33 | SRC_ALPHA_SATURATE = 0x308,
34 | CONSTANT_COLOR = 0x8001,
35 | ONE_MINUS_CONSTANT_COLOR = 0x8002,
36 | CONSTANT_ALPHA = 0x8003,
37 | ONE_MINUS_CONSTANT_ALPHA = 0x8004,
38 | }
39 |
40 | public enum BlendingEquation
41 | {
42 | FUNC_ADD = 0x8006,
43 | FUNC_SUBTRACT = 0x800A,
44 | FUNC_REVERSE_SUBTRACT = 0x800B,
45 | }
46 |
47 | public enum Parameter
48 | {
49 | BLEND_EQUATION = 0x8009,
50 | BLEND_EQUATION_RGB = 0x8009,
51 | BLEND_EQUATION_ALPHA = 0x883D,
52 | BLEND_DST_RGB = 0x80C8,
53 | BLEND_SRC_RBG = 0x80C9,
54 | BLEND_DST_ALPHA = 0x80CA,
55 | BLEND_SRC_ALPHA = 0x80CB,
56 | BLEND_COLOR = 0x8005,
57 | ARRAY_BUFFER_BINDING = 0x8894,
58 | ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
59 | LINE_WIDTH = 0x0B21,
60 | ALIASED_POINT_SIZE_RANGE = 0x846D,
61 | ALIASED_LINE_WIDTH_RANGE = 0x846E,
62 | CULL_FACE_MODE = 0x0B45,
63 | FRONT_FACE = 0x0B46,
64 | DEPTH_RANGE = 0x0B70,
65 | DEPTH_WRITEMASK = 0x0B72,
66 | DEPTH_CLEAR_VALUE = 0x0B73,
67 | DEPTH_FUNC = 0x0B74,
68 | STENCIL_CLEAR_VALUE = 0x0B91,
69 | STENCIL_FUNC = 0x0B92,
70 | STENCIL_FAIL = 0x0B94,
71 | STENCIL_PASS_DEPTH_FAIL = 0x0B95,
72 | STENCIL_PASS_DEPTH_PASS = 0x0B96,
73 | STENCIL_REF = 0x0B97,
74 | STENCIL_VALUE_MASK = 0x0B93,
75 | STENCIL_WRITEMASK = 0x0B98,
76 | STENCIL_BACK_FUNC = 0x8800,
77 | STENCIL_BACK_FAIL = 0x8801,
78 | STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,
79 | STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,
80 | STENCIL_BACK_REF = 0x8CA3,
81 | STENCIL_BACK_VALUE_MASK = 0x8CA4,
82 | STENCIL_BACK_WRITEMASK = 0x8CA5,
83 | VIEWPORT = 0x0BA2,
84 | SCISSOR_BOX = 0x0C10,
85 | COLOR_CLEAR_VALUE = 0x0C22,
86 | COLOR_WRITEMASK = 0x0C23,
87 | UNPACK_ALIGNMENT = 0x0CF5,
88 | PACK_ALIGNMENT = 0x0D05,
89 | MAX_TEXTURE_SIZE = 0x0D33,
90 | MAX_VIEWPORT_DIMS = 0x0D3A,
91 | SUBPIXEL_BITS = 0x0D50,
92 | RED_BITS = 0x0D52,
93 | GREEN_BITS = 0x0D53,
94 | BLUE_BITS = 0x0D54,
95 | ALPHA_BITS = 0x0D55,
96 | DEPTH_BITS = 0x0D56,
97 | STENCIL_BITS = 0x0D57,
98 | POLYGON_OFFSET_UNITS = 0x2A00,
99 | POLYGON_OFFSET_FACTOR = 0x8038,
100 | TEXTURE_BINDING_2D = 0x8069,
101 | SAMPLE_BUFFERS = 0x80A8,
102 | SAMPLES = 0x80A9,
103 | SAMPLE_COVERAGE_VALUE = 0x80AA,
104 | SAMPLE_COVERAGE_INVERT = 0x80AB,
105 | COMPRESSED_TEXTURE_FORMATS = 0x86A3,
106 | VENDOR = 0x1F00,
107 | RENDERER = 0x1F01,
108 | VERSION = 0x1F02,
109 | IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
110 | IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B,
111 | BROWSER_DEFAULT_WEBGL = 0x9244,
112 | MAX_VERTEX_ATTRIBS = 0x8869,
113 | MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB,
114 | MAX_VARYING_VECTORS = 0x8DFC,
115 | MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D,
116 | MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C,
117 | MAX_TEXTURE_IMAGE_UNITS = 0x8872,
118 | MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD,
119 | SHADING_LANGUAGE_VERSION = 0x8B8C,
120 | CURRENT_PROGRAM = 0x8B8D,
121 | MAX_RENDERBUFFER_SIZE = 0x84E8,
122 | FRAMEBUFFER_BINDING = 0x8CA6,
123 | RENDERBUFFER_BINDING = 0x8CA7,
124 | ACTIVE_TEXTURE = 0x84E0,
125 | }
126 |
127 | public enum BufferUsageHint
128 | {
129 | STATIC_DRAW = 0x88E4,
130 | STREAM_DRAW = 0x88E0,
131 | DYNAMIC_DRAW = 0x88E8,
132 | }
133 |
134 | public enum BufferType
135 | {
136 | ARRAY_BUFFER = 0x8892,
137 | ELEMENT_ARRAY_BUFFER = 0x8893,
138 | }
139 |
140 | public enum BufferParameter
141 | {
142 | BUFFER_SIZE = 0x8764,
143 | BUFFER_USAGE = 0x8765,
144 | }
145 |
146 | public enum VertexAttribute
147 | {
148 | CURRENT_VERTEX_ATTRIB = 0x8626,
149 | VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,
150 | VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,
151 | VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,
152 | VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,
153 | VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A,
154 | VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
155 | }
156 |
157 | public enum VertexAttributePointer
158 | {
159 | VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
160 | }
161 |
162 | public enum Face
163 | {
164 | FRONT = 0x0404,
165 | BACK = 0x0405,
166 | FRONT_AND_BACK = 0x0408,
167 | }
168 |
169 | public enum EnableCap
170 | {
171 | CULL_FACE = 0x0B44,
172 | BLEND = 0x0BE2,
173 | DEPTH_TEST = 0x0B71,
174 | DITHER = 0x0BD0,
175 | POLYGON_OFFSET_FILL = 0x8037,
176 | SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
177 | SAMPLE_COVERAGE = 0x80A0,
178 | SCISSOR_TEST = 0x0C11,
179 | STENCIL_TEST = 0x0B90,
180 | }
181 |
182 | public enum Error
183 | {
184 | NO_ERROR = 0,
185 | INVALID_ENUM = 0x0500,
186 | INVALID_VALUE = 0x0501,
187 | INVALID_OPERATION = 0x0502,
188 | OUT_OF_MEMORY = 0x0505,
189 | CONTEXT_LOST_WEBGL = 0x9242,
190 | }
191 |
192 | public enum FrontFaceDirection
193 | {
194 | CW = 0x0900,
195 | CCW = 0x0901,
196 | }
197 |
198 | public enum HintMode
199 | {
200 | DONT_CARE = 0x1100,
201 | FASTEST = 0x1101,
202 | NICEST = 0x1102,
203 | }
204 |
205 | public enum HintTarget
206 | {
207 | GENERATE_MIPMAP_HINT = 0x8192,
208 | }
209 |
210 | public enum PixelFormat
211 | {
212 | ALPHA = 0x1906,
213 | RGB = 0x1907,
214 | RGBA = 0x1908,
215 | LUMINANCE = 0x1909,
216 | LUMINANCE_ALPHA = 0x190A,
217 | }
218 |
219 | public enum PixelType
220 | {
221 | UNSIGNED_BYTE = 0x1401,
222 | UNSIGNED_SHORT_4_4_4_4 = 0x8033,
223 | UNSIGNED_SHORT_5_5_5_1 = 0x8034,
224 | UNSIGNED_SHORT_5_6_5 = 0x8363,
225 | FLOAT = 0x1406,
226 | }
227 |
228 | public enum ShaderType
229 | {
230 | FRAGMENT_SHADER = 0x8B30,
231 | VERTEX_SHADER = 0x8B31,
232 | }
233 |
234 | public enum ShaderParameter
235 | {
236 | COMPILE_STATUS = 0x8B81,
237 | DELETE_STATUS = 0x8B80,
238 | SHADER_TYPE = 0x8B4F,
239 | }
240 |
241 | public enum ProgramParameter
242 | {
243 | DELETE_STATUS = 0x8B80,
244 | LINK_STATUS = 0x8B82,
245 | VALIDATE_STATUS = 0x8B83,
246 | ATTACHED_SHADERS = 0x8B85,
247 | ACTIVE_ATTRIBUTES = 0x8B89,
248 | ACTIVE_UNIFORMS = 0x8B86,
249 | }
250 |
251 | public enum CompareFunction
252 | {
253 | NEVER = 0x0200,
254 | ALWAYS = 0x0207,
255 | LESS = 0x0201,
256 | EQUAL = 0x0202,
257 | LEQUAL = 0x0203,
258 | GREATER = 0x0204,
259 | GEQUAL = 0x0206,
260 | NOTEQUAL = 0x0205,
261 | }
262 |
263 | public enum StencilFunction
264 | {
265 | KEEP = 0x1E00,
266 | REPLACE = 0x1E01,
267 | INCR = 0x1E02,
268 | DECR = 0x1E03,
269 | INVERT = 0x150A,
270 | INCR_WRAP = 0x8507,
271 | DECR_WRAP = 0x8508,
272 | }
273 |
274 | public enum TextureType
275 | {
276 | TEXTURE_2D = 0x0DE1,
277 | TEXTURE_CUBE_MAP = 0x8513,
278 | }
279 |
280 | public enum Texture2DType
281 | {
282 | TEXTURE_2D = 0x0DE1,
283 | TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
284 | TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
285 | TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
286 | TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
287 | TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
288 | TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
289 | }
290 |
291 | public enum TextureParameter
292 | {
293 | TEXTURE_MAG_FILTER = 0x2800,
294 | TEXTURE_MIN_FILTER = 0x2801,
295 | TEXTURE_WRAP_S = 0x2802,
296 | TEXTURE_WRAP_T = 0x2803,
297 | }
298 |
299 | public enum TextureParameterValue
300 | {
301 | NEAREST = 0x2600,
302 | LINEAR = 0x2601,
303 | NEAREST_MIPMAP_NEAREST = 0x2700,
304 | LINEAR_MIPMAP_NEAREST = 0x2701,
305 | NEAREST_MIPMAP_LINEAR = 0x2702,
306 | LINEAR_MIPMAP_LINEAR = 0x2703,
307 | REPEAT = 0x2901,
308 | CLAMP_TO_EDGE = 0x812F,
309 | MIRRORED_REPEAT = 0x8370,
310 | }
311 |
312 | public enum UniformType
313 | {
314 | FLOAT_VEC2 = 0x8B50,
315 | FLOAT_VEC3 = 0x8B51,
316 | FLOAT_VEC4 = 0x8B52,
317 | INT_VEC2 = 0x8B53,
318 | INT_VEC3 = 0x8B54,
319 | INT_VEC4 = 0x8B55,
320 | BOOL = 0x8B56,
321 | BOOL_VEC2 = 0x8B57,
322 | BOOL_VEC3 = 0x8B58,
323 | BOOL_VEC4 = 0x8B59,
324 | FLOAT_MAT2 = 0x8B5A,
325 | FLOAT_MAT3 = 0x8B5B,
326 | FLOAT_MAT4 = 0x8B5C,
327 | SAMPLER_2D = 0x8B5E,
328 | SAMPLER_CUBE = 0x8B60,
329 | }
330 |
331 | public enum ShaderPrecision
332 | {
333 | LOW_FLOAT = 0x8DF0,
334 | MEDIUM_FLOAT = 0x8DF1,
335 | HIGH_FLOAT = 0x8DF2,
336 | LOW_INT = 0x8DF3,
337 | MEDIUM_INT = 0x8DF4,
338 | HIGH_INT = 0x8DF5,
339 | }
340 |
341 | public enum RenderbufferType
342 | {
343 | RENDERBUFFER = 0x8D41,
344 | }
345 |
346 | public enum FramebufferType
347 | {
348 | FRAMEBUFFER = 0x8D40,
349 | }
350 |
351 | public enum RenderbufferParameter
352 | {
353 | RENDERBUFFER_WIDTH = 0x8D42,
354 | RENDERBUFFER_HEIGHT = 0x8D43,
355 | RENDERBUFFER_INTERNAL_FORMAT = 0x8D44,
356 | RENDERBUFFER_RED_SIZE = 0x8D50,
357 | RENDERBUFFER_GREEN_SIZE = 0x8D51,
358 | RENDERBUFFER_BLUE_SIZE = 0x8D52,
359 | RENDERBUFFER_ALPHA_SIZE = 0x8D53,
360 | RENDERBUFFER_DEPTH_SIZE = 0x8D54,
361 | RENDERBUFFER_STENCIL_SIZE = 0x8D55,
362 | }
363 |
364 | public enum FramebufferAttachment
365 | {
366 | COLOR_ATTACHMENT0 = 0x8CE0,
367 | DEPTH_ATTACHMENT = 0x8D00,
368 | STENCIL_ATTACHMENT = 0x8D20,
369 | DEPTH_STENCIL_ATTACHMENT = 0x821A,
370 | }
371 |
372 | public enum FramebufferAttachmentParameter
373 | {
374 | FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0,
375 | FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1,
376 | FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2,
377 | FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3,
378 | }
379 |
380 | public enum FramebufferStatus
381 | {
382 | NONE = 0,
383 | FRAMEBUFFER_COMPLETE = 0x8CD5,
384 | FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6,
385 | FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7,
386 | FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9,
387 | FRAMEBUFFER_UNSUPPORTED = 0x8CDD,
388 | }
389 |
390 | public enum PixelStorageMode
391 | {
392 | UNPACK_FLIP_Y_WEBGL = 0x9240,
393 | UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,
394 | UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243,
395 | }
396 |
397 | public enum RenderbufferFormat
398 | {
399 | RGBA4 = 0x8056,
400 | RGB5_A1 = 0x8057,
401 | RGB565 = 0x8D62,
402 | DEPTH_COMPONENT16 = 0x81A5,
403 | STENCIL_INDEX8 = 0x8D48,
404 | DEPTH_STENCIL = 0x84F9,
405 | }
406 |
407 | public enum DataType
408 | {
409 | BYTE = 0x1400,
410 | UNSIGNED_BYTE = 0x1401,
411 | SHORT = 0x1402,
412 | UNSIGNED_SHORT = 0x1403,
413 | INT = 0x1404,
414 | UNSIGNED_INT = 0x1405,
415 | FLOAT = 0x1406,
416 | }
417 |
418 | public enum Texture
419 | {
420 | TEXTURE0 = 0x84C0,
421 | TEXTURE1,
422 | TEXTURE2,
423 | TEXTURE3,
424 | TEXTURE4,
425 | TEXTURE5,
426 | TEXTURE6,
427 | TEXTURE7,
428 | TEXTURE8,
429 | TEXTURE9,
430 | TEXTURE10,
431 | TEXTURE11,
432 | TEXTURE12,
433 | TEXTURE13,
434 | TEXTURE14,
435 | TEXTURE15,
436 | TEXTURE16,
437 | TEXTURE17,
438 | TEXTURE18,
439 | TEXTURE19,
440 | TEXTURE20,
441 | TEXTURE21,
442 | TEXTURE22,
443 | TEXTURE23,
444 | TEXTURE24,
445 | TEXTURE25,
446 | TEXTURE26,
447 | TEXTURE27,
448 | TEXTURE28,
449 | TEXTURE29,
450 | TEXTURE30,
451 | TEXTURE31,
452 | }
--------------------------------------------------------------------------------
/src/HACC/Extensions/HaccExtensions.cs:
--------------------------------------------------------------------------------
1 | using HACC.Applications;
2 | using HACC.Models;
3 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Logging;
6 |
7 | namespace HACC.Extensions;
8 |
9 | public static class HaccExtensions
10 | {
11 | private const string DefaultError = "Call UseHacc() first";
12 | private static ServiceProvider? _serviceProvider;
13 | private static ILoggerFactory? _loggerFactory;
14 |
15 | private static WebApplication? _webApplication;
16 | private static WebClipboard? _webClipboard;
17 |
18 | public static WebApplication WebApplication =>
19 | _webApplication ?? throw new InvalidOperationException(message: DefaultError);
20 |
21 | public static WebClipboard WebClipboard =>
22 | _webClipboard ?? throw new InvalidOperationException(message: DefaultError);
23 |
24 | public static ServiceProvider ServiceProvider =>
25 | _serviceProvider ?? throw new InvalidOperationException(message: DefaultError);
26 |
27 | public static ILoggerFactory LoggerFactory =>
28 | _loggerFactory ?? throw new InvalidOperationException(message: DefaultError);
29 |
30 | public static ILogger CreateLogger()
31 | {
32 | return LoggerFactory.CreateLogger();
33 | }
34 |
35 | public static WebAssemblyHostBuilder UseHacc(this WebAssemblyHostBuilder builder)
36 | {
37 | builder.Logging.ClearProviders();
38 | builder.Logging.AddCustomLogging(configure: configuration =>
39 | {
40 | configuration.LogLevels.Add(
41 | key: LogLevel.Warning,
42 | value: ConsoleColor.DarkMagenta);
43 | configuration.LogLevels.Add(
44 | key: LogLevel.Error,
45 | value: ConsoleColor.Red);
46 | });
47 | builder.Logging.SetMinimumLevel(level: LogLevel.Debug);
48 |
49 | _serviceProvider = builder.Services.BuildServiceProvider();
50 | _loggerFactory = _serviceProvider.GetService()!;
51 | _webApplication = new WebApplication();
52 | _webClipboard = new WebClipboard();
53 |
54 | return builder;
55 | }
56 |
57 | public static T GetService()
58 | {
59 | return ServiceProvider.GetService()!;
60 | }
61 | }
--------------------------------------------------------------------------------
/src/HACC/Extensions/LoggingExtensions.cs:
--------------------------------------------------------------------------------
1 | using HACC.Logging;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.DependencyInjection.Extensions;
4 | using Microsoft.Extensions.Logging;
5 | using Microsoft.Extensions.Logging.Configuration;
6 |
7 | namespace HACC.Extensions;
8 |
9 | public static class LoggingExtensions
10 | {
11 | public static ILoggingBuilder AddCustomLogging(
12 | this ILoggingBuilder builder)
13 | {
14 | builder.AddConfiguration();
15 |
16 | builder.Services.TryAddEnumerable(
17 | descriptor: ServiceDescriptor.Singleton());
18 |
19 | LoggerProviderOptions.RegisterProviderOptions
20 | (services: builder.Services);
21 |
22 | return builder;
23 | }
24 |
25 | public static ILoggingBuilder AddCustomLogging(
26 | this ILoggingBuilder builder,
27 | Action configure)
28 | {
29 | builder.AddCustomLogging();
30 | builder.Services.Configure(configureOptions: configure);
31 |
32 | return builder;
33 | }
34 | }
--------------------------------------------------------------------------------
/src/HACC/HACC.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | HTML5 Canvas Console and HACC Blazor Extensions
4 | HTML5 Canvas API implementation and Gui-cs/Terminal.Gui and Spectre.Console components for ASP.NET Core Blazor
5 | HACC
6 | 0.1.1
7 | true
8 | false
9 |
10 |
11 |
12 | net6.0
13 | enable
14 | enable
15 | HACC
16 | HACC
17 | Library
18 | MIT
19 | README.md
20 | Digital Defiance contributors
21 | https://github.com/Blazor-Console/HACC
22 | https://github.com/Blazor-Console/HACC
23 | html5 ansi hacc blazor canvas console extension js
24 | 0.1.1
25 |
26 |
27 |
28 | 0.1.1
29 | $(VersionPrefix)-$(VersionSuffix)
30 | $(VersionPrefix)
31 |
32 |
33 |
34 |
35 | True
36 | \
37 |
38 |
39 |
40 |
41 |
42 | false
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | True
73 | True
74 | Strings.resx
75 |
76 |
77 | True
78 | True
79 | WebStrings.resx
80 |
81 |
82 |
83 |
84 |
85 | ResXFileCodeGenerator
86 | WebStrings.Designer.cs
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/HACC/HACC.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | HTML5 ANSI Console Canvas
7 | Digital Defiance contributors
8 | false
9 | MIT
10 |
11 | https://github.com/Blazor-Console/HACC
12 | HTML5 ANSI Console Canvas (Blazor Component)
13 | alpha
14 | (c) 2022 Digital Defiance contributors
15 | html5 ansi console canvas blazor
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/HACC/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Jessica Mulein
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/HACC/Logging/CustomLogger.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 |
3 | namespace HACC.Logging;
4 |
5 | public class CustomLogger : ILogger
6 | {
7 | private readonly Func _getCurrentConfig;
8 | private readonly string _name;
9 |
10 | public CustomLogger(
11 | string name,
12 | Func getCurrentConfig)
13 | {
14 | (this._name, this._getCurrentConfig) = (name, getCurrentConfig);
15 | }
16 |
17 | public IDisposable BeginScope(TState state)
18 | {
19 | return default!;
20 | }
21 |
22 | public bool IsEnabled(LogLevel logLevel)
23 | {
24 | return this._getCurrentConfig().LogLevels.ContainsKey(key: logLevel);
25 | }
26 |
27 | public void Log(
28 | LogLevel logLevel,
29 | EventId eventId,
30 | TState state,
31 | Exception? exception,
32 | Func formatter)
33 | {
34 | if (!this.IsEnabled(logLevel: logLevel)) return;
35 |
36 | var config = this._getCurrentConfig();
37 | if (config.EventId == 0 || config.EventId == eventId.Id)
38 | {
39 | //ConsoleColor originalColor = Console.ForegroundColor;
40 |
41 | //Console.ForegroundColor = config.LogLevels[logLevel];
42 | //Console.WriteLine($"[{eventId.Id,2}: {logLevel,-12}]");
43 |
44 | //Console.ForegroundColor = originalColor;
45 | //Console.WriteLine($" {_name} - {formatter(state, exception)}");
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/HACC/Logging/LoggingConfiguration.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 |
3 | namespace HACC.Logging;
4 |
5 | public class LoggingConfiguration
6 | {
7 | public int EventId { get; set; }
8 |
9 | public Dictionary LogLevels { get; set; } = new()
10 | {
11 | [key: LogLevel.Information] = ConsoleColor.Green,
12 | };
13 | }
--------------------------------------------------------------------------------
/src/HACC/Logging/LoggingProvider.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Logging;
2 | using Microsoft.Extensions.Options;
3 | using System.Collections.Concurrent;
4 |
5 | namespace HACC.Logging;
6 |
7 | public sealed class LoggingProvider : ILoggerProvider
8 | {
9 | private readonly ConcurrentDictionary _loggers = new();
10 | private readonly IDisposable _onChangeToken;
11 | private LoggingConfiguration _currentConfig;
12 |
13 | public LoggingProvider(
14 | IOptionsMonitor config)
15 | {
16 | this._currentConfig = config.CurrentValue;
17 | this._onChangeToken = config.OnChange(listener: updatedConfig => this._currentConfig = updatedConfig);
18 | }
19 |
20 | public ILogger CreateLogger(string categoryName)
21 | {
22 | return this._loggers.GetOrAdd(key: categoryName,
23 | valueFactory: name => new CustomLogger(name: name,
24 | getCurrentConfig: this.GetCurrentConfig));
25 | }
26 |
27 | public void Dispose()
28 | {
29 | this._loggers.Clear();
30 | this._onChangeToken.Dispose();
31 | }
32 |
33 | private LoggingConfiguration GetCurrentConfig()
34 | {
35 | return this._currentConfig;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/HACC/Models/DirtySegment.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Models;
2 |
3 | public record DirtySegment(ConsoleColor BackgroundColor, ConsoleColor ForegroundColor, int Row, int Column, string Text);
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.Color.cs:
--------------------------------------------------------------------------------
1 | using HACC.Configuration;
2 | using Terminal.Gui;
3 |
4 | namespace HACC.Models.Drivers;
5 |
6 | //
7 | // Summary:
8 | // Represents the standard input, output, and error streams for console applications.
9 | // This class cannot be inherited.
10 | public partial class WebConsoleDriver
11 | {
12 | //
13 | // Summary:
14 | // Gets or sets the background color of the console.
15 | //
16 | // Returns:
17 | // A value that specifies the background color of the console; that is, the color
18 | // that appears behind each character. The default is black.
19 | //
20 | // Exceptions:
21 | // T:System.ArgumentException:
22 | // The color specified in a set operation is not a valid member of System.ConsoleColor.
23 | //
24 | // T:System.Security.SecurityException:
25 | // The user does not have permission to perform this action.
26 | //
27 | // T:System.IO.IOException:
28 | // An I/O error occurred.
29 | public ConsoleColor BackgroundColor
30 | {
31 | get => this.TerminalSettings.TerminalBackground;
32 | set => this.TerminalSettings.TerminalBackground = value;
33 | }
34 |
35 | //
36 | // Summary:
37 | // Gets or sets the foreground color of the console.
38 | //
39 | // Returns:
40 | // A System.ConsoleColor that specifies the foreground color of the console; that
41 | // is, the color of each character that is displayed. The default is gray.
42 | //
43 | // Exceptions:
44 | // T:System.ArgumentException:
45 | // The color specified in a set operation is not a valid member of System.ConsoleColor.
46 | //
47 | // T:System.Security.SecurityException:
48 | // The user does not have permission to perform this action.
49 | //
50 | // T:System.IO.IOException:
51 | // An I/O error occurred.
52 | public ConsoleColor ForegroundColor
53 | {
54 | get => this.TerminalSettings.TerminalForeground;
55 | set => this.TerminalSettings.TerminalForeground = value;
56 | }
57 |
58 | //
59 | // Summary:
60 | // Sets the foreground and background console colors to their defaults.
61 | //
62 | // Exceptions:
63 | // T:System.Security.SecurityException:
64 | // The user does not have permission to perform this action.
65 | //
66 | // T:System.IO.IOException:
67 | // An I/O error occurred.
68 | public void ResetColor()
69 | {
70 | this.ForegroundColor = Defaults.ForegroundColor;
71 | this.BackgroundColor = Defaults.BackgroundColor;
72 | }
73 |
74 | public override Terminal.Gui.Attribute MakeColor(Color foreground, Color background)
75 | {
76 | this.ForegroundColor = (ConsoleColor)foreground;
77 | this.BackgroundColor = (ConsoleColor) background;
78 |
79 | return new Terminal.Gui.Attribute(foreground, background);
80 | }
81 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.Cursor.cs:
--------------------------------------------------------------------------------
1 | using Spectre.Console;
2 | using System.Drawing;
3 |
4 | namespace HACC.Models.Drivers;
5 |
6 | //
7 | // Summary:
8 | // Represents the standard input, output, and error streams for console applications.
9 | // This class cannot be inherited.
10 | public partial class WebConsoleDriver
11 | {
12 | //
13 | // Summary:
14 | // Gets or sets the column position of the cursor within the buffer area.
15 | //
16 | // Returns:
17 | // The current position, in columns, of the cursor.
18 | //
19 | // Exceptions:
20 | // T:System.ArgumentOutOfRangeException:
21 | // The value in a set operation is less than zero. -or- The value in a set operation
22 | // is greater than or equal to System.ConsoleDriver.BufferWidth.
23 | //
24 | // T:System.Security.SecurityException:
25 | // The user does not have permission to perform this action.
26 | //
27 | // T:System.IO.IOException:
28 | // An I/O error occurred.
29 | public int CursorLeft
30 | {
31 | get => this.TerminalSettings.CursorPosition.X;
32 | set
33 | {
34 | if (value < 0 || value > this.TerminalSettings.BufferColumns)
35 | throw new ArgumentOutOfRangeException(paramName: nameof(value));
36 |
37 | this.TerminalSettings.CursorPosition = new Point(
38 | x: value,
39 | y: this.TerminalSettings.CursorPosition.Y);
40 | }
41 | }
42 |
43 | //
44 | // Summary:
45 | // Gets or sets the height of the cursor within a character cell.
46 | //
47 | // Returns:
48 | // The size of the cursor expressed as a percentage of the height of a character
49 | // cell. The property value ranges from 1 to 100.
50 | //
51 | // Exceptions:
52 | // T:System.ArgumentOutOfRangeException:
53 | // The value specified in a set operation is less than 1 or greater than 100.
54 | //
55 | // T:System.Security.SecurityException:
56 | // The user does not have permission to perform this action.
57 | //
58 | // T:System.IO.IOException:
59 | // An I/O error occurred.
60 | //
61 | // T:System.PlatformNotSupportedException:
62 | // The set operation is invoked on an operating system other than Windows.
63 | public int CursorSize
64 | {
65 | get => this.TerminalSettings.CursorSize;
66 | set => this.TerminalSettings.CursorSize = value;
67 | }
68 |
69 | public Point CursorPosition
70 | {
71 | get => this.TerminalSettings.CursorPosition;
72 | set
73 | {
74 | if (value.X < 0 || value.X > this.TerminalSettings.BufferColumns)
75 | throw new ArgumentOutOfRangeException(paramName: nameof(value.X));
76 | if (value.Y < 0 || value.Y > this.TerminalSettings.BufferRows)
77 | throw new ArgumentOutOfRangeException(paramName: nameof(value.Y));
78 | this.TerminalSettings.CursorPosition = value;
79 | }
80 | }
81 |
82 | //
83 | // Summary:
84 | // Gets or sets the row position of the cursor within the buffer area.
85 | //
86 | // Returns:
87 | // The current position, in rows, of the cursor.
88 | //
89 | // Exceptions:
90 | // T:System.ArgumentOutOfRangeException:
91 | // The value in a set operation is less than zero. -or- The value in a set operation
92 | // is greater than or equal to System.ConsoleDriver.BufferHeight.
93 | //
94 | // T:System.Security.SecurityException:
95 | // The user does not have permission to perform this action.
96 | //
97 | // T:System.IO.IOException:
98 | // An I/O error occurred.
99 | public int CursorTop
100 | {
101 | get => this.TerminalSettings.CursorPosition.Y;
102 | set
103 | {
104 | if (value < 0 || value > this.TerminalSettings.BufferRows)
105 | throw new ArgumentOutOfRangeException(paramName: nameof(value));
106 |
107 | this.TerminalSettings.CursorPosition = new Point(
108 | x: this.TerminalSettings.CursorPosition.X,
109 | y: value);
110 | }
111 | }
112 |
113 | //
114 | // Summary:
115 | // Gets or sets a value indicating whether the cursor is visible.
116 | //
117 | // Returns:
118 | // true if the cursor is visible; otherwise, false.
119 | //
120 | // Exceptions:
121 | // T:System.Security.SecurityException:
122 | // The user does not have permission to perform this action.
123 | //
124 | // T:System.IO.IOException:
125 | // An I/O error occurred.
126 | //
127 | // T:System.PlatformNotSupportedException:
128 | // The get operation is invoked on an operating system other than Windows.
129 | public bool CursorVisible
130 | {
131 | get => this.TerminalSettings.CursorVisible;
132 | set => this.TerminalSettings.CursorVisible = value;
133 | }
134 |
135 |
136 | public IAnsiConsoleCursor Cursor => throw new NotImplementedException();
137 |
138 | //
139 | // Summary:
140 | // Gets the position of the cursor.
141 | // Decomposed from CursorPosition
142 | //
143 | // Returns:
144 | // The column and row position of the cursor.
145 | public (int Left, int Top) GetCursorPosition()
146 | {
147 | return (
148 | Left: this.TerminalSettings.CursorPosition.X,
149 | Top: this.TerminalSettings.CursorPosition.Y
150 | );
151 | }
152 |
153 | //
154 | // Summary:
155 | // Sets the position of the cursor.
156 | //
157 | // Parameters:
158 | // left:
159 | // The column position of the cursor. WindowColumns are numbered from left to right starting
160 | // at 0.
161 | //
162 | // top:
163 | // The row position of the cursor. WindowRows are numbered from top to bottom starting
164 | // at 0.
165 | //
166 | // Exceptions:
167 | // T:System.ArgumentOutOfRangeException:
168 | // left or top is less than zero. -or- left is greater than or equal to System.ConsoleDriver.BufferWidth.
169 | // -or- top is greater than or equal to System.ConsoleDriver.BufferHeight.
170 | //
171 | // T:System.Security.SecurityException:
172 | // The user does not have permission to perform this action.
173 | //
174 | // T:System.IO.IOException:
175 | // An I/O error occurred.
176 | public void SetCursorPosition(int left, int top)
177 | {
178 | this.TerminalSettings.SetCursorPosition(x: left,
179 | y: top);
180 | }
181 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.IO.Read.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Models.Drivers;
2 |
3 | //
4 | // Summary:
5 | // Represents the standard input, output, and error streams for console applications.
6 | // This class cannot be inherited.
7 | public partial class WebConsoleDriver
8 | {
9 | //
10 | // Summary:
11 | // Reads the next character from the standard input stream.
12 | //
13 | // Returns:
14 | // The next character from the input stream, or negative one (-1) if there are currently
15 | // no more characters to be read.
16 | //
17 | // Exceptions:
18 | // T:System.IO.IOException:
19 | // An I/O error occurred.
20 | public int Read()
21 | {
22 | throw new NotImplementedException();
23 | }
24 |
25 | //
26 | // Summary:
27 | // Obtains the next character or function key pressed by the user. The pressed key
28 | // is displayed in the console window.
29 | //
30 | // Returns:
31 | // An object that describes the System.ConsoleKey constant and Unicode character,
32 | // if any, that correspond to the pressed console key. The System.ConsoleKeyInfo
33 | // object also describes, in a bitwise combination of System.ConsoleModifiers values,
34 | // whether one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously
35 | // with the console key.
36 | //
37 | // Exceptions:
38 | // T:System.InvalidOperationException:
39 | // The System.ConsoleDriver.In property is redirected from some stream other than the
40 | // console.
41 | public ConsoleKeyInfo ReadKey()
42 | {
43 | throw new NotImplementedException();
44 | }
45 |
46 | //
47 | // Summary:
48 | // Obtains the next character or function key pressed by the user. The pressed key
49 | // is optionally displayed in the console window.
50 | //
51 | // Parameters:
52 | // intercept:
53 | // Determines whether to display the pressed key in the console window. true to
54 | // not display the pressed key; otherwise, false.
55 | //
56 | // Returns:
57 | // An object that describes the System.ConsoleKey constant and Unicode character,
58 | // if any, that correspond to the pressed console key. The System.ConsoleKeyInfo
59 | // object also describes, in a bitwise combination of System.ConsoleModifiers values,
60 | // whether one or more Shift, Alt, or Ctrl modifier keys was pressed simultaneously
61 | // with the console key.
62 | //
63 | // Exceptions:
64 | // T:System.InvalidOperationException:
65 | // The System.ConsoleDriver.In property is redirected from some stream other than the
66 | // console.
67 | public ConsoleKeyInfo ReadKey(bool intercept)
68 | {
69 | throw new NotImplementedException();
70 | }
71 |
72 | //
73 | // Summary:
74 | // Reads the next line of characters from the standard input stream.
75 | //
76 | // Returns:
77 | // The next line of characters from the input stream, or null if no more lines are
78 | // available.
79 | //
80 | // Exceptions:
81 | // T:System.IO.IOException:
82 | // An I/O error occurred.
83 | //
84 | // T:System.OutOfMemoryException:
85 | // There is insufficient memory to allocate a buffer for the returned string.
86 | //
87 | // T:System.ArgumentOutOfRangeException:
88 | // The number of characters in the next line of characters is greater than System.Int32.MaxValue.
89 | public string? ReadLine()
90 | {
91 | throw new NotImplementedException();
92 | }
93 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.IO.Write.cs:
--------------------------------------------------------------------------------
1 | using NStack;
2 | using Spectre.Console.Rendering;
3 | using System.Globalization;
4 |
5 | namespace HACC.Models.Drivers;
6 |
7 | //
8 | // Summary:
9 | // Represents the standard input, output, and error streams for console applications.
10 | // This class cannot be inherited.
11 | public partial class WebConsoleDriver
12 | {
13 | public void Write(IRenderable renderable)
14 | {
15 | throw new NotImplementedException();
16 | }
17 |
18 | //
19 | // Summary:
20 | // Writes the text representation of the specified Boolean value to the standard
21 | // output stream.
22 | //
23 | // Parameters:
24 | // value:
25 | // The value to write.
26 | //
27 | // Exceptions:
28 | // T:System.IO.IOException:
29 | // An I/O error occurred.
30 | public void Write(bool value)
31 | {
32 | this.Write(value: Convert.ToString(value: value));
33 | }
34 |
35 | //
36 | // Summary:
37 | // Writes the specified Unicode character value to the standard output stream.
38 | //
39 | // Parameters:
40 | // value:
41 | // The value to write.
42 | //
43 | // Exceptions:
44 | // T:System.IO.IOException:
45 | // An I/O error occurred.
46 | public void Write(char value)
47 | {
48 | this.Write(value: Convert.ToString(value: value));
49 | }
50 |
51 | //
52 | // Summary:
53 | // Writes the specified array of Unicode characters to the standard output stream.
54 | //
55 | // Parameters:
56 | // buffer:
57 | // A Unicode character array.
58 | //
59 | // Exceptions:
60 | // T:System.IO.IOException:
61 | // An I/O error occurred.
62 | public void Write(char[]? buffer)
63 | {
64 | var value = buffer is null ? string.Empty : Convert.ToString(value: buffer);
65 | this.Write(value: Convert.ToString(value: value));
66 | }
67 |
68 | //
69 | // Summary:
70 | // Writes the specified subarray of Unicode characters to the standard output stream.
71 | //
72 | // Parameters:
73 | // buffer:
74 | // An array of Unicode characters.
75 | //
76 | // index:
77 | // The starting position in buffer.
78 | //
79 | // count:
80 | // The number of characters to write.
81 | //
82 | // Exceptions:
83 | // T:System.ArgumentNullException:
84 | // buffer is null.
85 | //
86 | // T:System.ArgumentOutOfRangeException:
87 | // index or count is less than zero.
88 | //
89 | // T:System.ArgumentException:
90 | // index plus count specify a position that is not within buffer.
91 | //
92 | // T:System.IO.IOException:
93 | // An I/O error occurred.
94 | public void Write(char[] buffer, int index, int count)
95 | {
96 | var value = Convert.ToString(value: buffer)?.Substring(
97 | startIndex: index,
98 | length: count);
99 | this.Write(value: Convert.ToString(value: value));
100 | }
101 |
102 | //
103 | // Summary:
104 | // Writes the text representation of the specified System.Decimal value to the standard
105 | // output stream.
106 | //
107 | // Parameters:
108 | // value:
109 | // The value to write.
110 | //
111 | // Exceptions:
112 | // T:System.IO.IOException:
113 | // An I/O error occurred.
114 | public void Write(decimal value)
115 | {
116 | this.Write(value: Convert.ToString(value: value));
117 | }
118 |
119 | //
120 | // Summary:
121 | // Writes the text representation of the specified double-precision floating-point
122 | // value to the standard output stream.
123 | //
124 | // Parameters:
125 | // value:
126 | // The value to write.
127 | //
128 | // Exceptions:
129 | // T:System.IO.IOException:
130 | // An I/O error occurred.
131 | public void Write(double value)
132 | {
133 | this.Write(value: Convert.ToString(value: value,
134 | provider: CultureInfo.InvariantCulture));
135 | }
136 |
137 | //
138 | // Summary:
139 | // Writes the text representation of the specified 32-bit signed integer value to
140 | // the standard output stream.
141 | //
142 | // Parameters:
143 | // value:
144 | // The value to write.
145 | //
146 | // Exceptions:
147 | // T:System.IO.IOException:
148 | // An I/O error occurred.
149 | public void Write(int value)
150 | {
151 | this.Write(value: Convert.ToString(value: value));
152 | }
153 |
154 | //
155 | // Summary:
156 | // Writes the text representation of the specified 64-bit signed integer value to
157 | // the standard output stream.
158 | //
159 | // Parameters:
160 | // value:
161 | // The value to write.
162 | //
163 | // Exceptions:
164 | // T:System.IO.IOException:
165 | // An I/O error occurred.
166 | public void Write(long value)
167 | {
168 | this.Write(value: Convert.ToString(value: value));
169 | }
170 |
171 | //
172 | // Summary:
173 | // Writes the text representation of the specified object to the standard output
174 | // stream.
175 | //
176 | // Parameters:
177 | // value:
178 | // The value to write, or null.
179 | //
180 | // Exceptions:
181 | // T:System.IO.IOException:
182 | // An I/O error occurred.
183 | public void Write(object? value)
184 | {
185 | this.Write(value: Convert.ToString(value: value));
186 | }
187 |
188 | //
189 | // Summary:
190 | // Writes the text representation of the specified single-precision floating-point
191 | // value to the standard output stream.
192 | //
193 | // Parameters:
194 | // value:
195 | // The value to write.
196 | //
197 | // Exceptions:
198 | // T:System.IO.IOException:
199 | // An I/O error occurred.
200 | public void Write(float value)
201 | {
202 | this.Write(value: Convert.ToString(value: value,
203 | provider: CultureInfo.InvariantCulture));
204 | }
205 |
206 | //
207 | // Summary:
208 | // Writes the specified string value to the standard output stream.
209 | //
210 | // Parameters:
211 | // value:
212 | // The value to write.
213 | //
214 | // Exceptions:
215 | // T:System.IO.IOException:
216 | // An I/O error occurred.
217 | public void Write(string? value)
218 | {
219 | var ustr = value is null ? ustring.Empty : ustring.Make(str: value);
220 | //this.AddStr(str: ustr);
221 | var currentPosition = this.CursorPosition;
222 | this.SetCursorPosition(left: currentPosition.X + ustr.RuneCount,
223 | top: currentPosition.Y);
224 | }
225 |
226 | //
227 | // Summary:
228 | // Writes the text representation of the specified object to the standard output
229 | // stream using the specified format information.
230 | //
231 | // Parameters:
232 | // format:
233 | // A composite format string.
234 | //
235 | // arg0:
236 | // An object to write using format.
237 | //
238 | // Exceptions:
239 | // T:System.IO.IOException:
240 | // An I/O error occurred.
241 | //
242 | // T:System.ArgumentNullException:
243 | // format is null.
244 | //
245 | // T:System.FormatException:
246 | // The format specification in format is invalid.
247 | public void Write(string format, object? arg0)
248 | {
249 | this.Write(value: string.Format(format: format,
250 | arg0: arg0));
251 | }
252 |
253 | //
254 | // Summary:
255 | // Writes the text representation of the specified objects to the standard output
256 | // stream using the specified format information.
257 | //
258 | // Parameters:
259 | // format:
260 | // A composite format string.
261 | //
262 | // arg0:
263 | // The first object to write using format.
264 | //
265 | // arg1:
266 | // The second object to write using format.
267 | //
268 | // Exceptions:
269 | // T:System.IO.IOException:
270 | // An I/O error occurred.
271 | //
272 | // T:System.ArgumentNullException:
273 | // format is null.
274 | //
275 | // T:System.FormatException:
276 | // The format specification in format is invalid.
277 | public void Write(string format, object? arg0, object? arg1)
278 | {
279 | this.Write(value: string.Format(format: format,
280 | arg0: arg0,
281 | arg1: arg1));
282 | }
283 |
284 | //
285 | // Summary:
286 | // Writes the text representation of the specified objects to the standard output
287 | // stream using the specified format information.
288 | //
289 | // Parameters:
290 | // format:
291 | // A composite format string.
292 | //
293 | // arg0:
294 | // The first object to write using format.
295 | //
296 | // arg1:
297 | // The second object to write using format.
298 | //
299 | // arg2:
300 | // The third object to write using format.
301 | //
302 | // Exceptions:
303 | // T:System.IO.IOException:
304 | // An I/O error occurred.
305 | //
306 | // T:System.ArgumentNullException:
307 | // format is null.
308 | //
309 | // T:System.FormatException:
310 | // The format specification in format is invalid.
311 | public void Write(string format, object? arg0, object? arg1, object? arg2)
312 | {
313 | this.Write(value: string.Format(format: format,
314 | arg0: arg0,
315 | arg1: arg1,
316 | arg2: arg2));
317 | }
318 |
319 | //
320 | // Summary:
321 | // Writes the text representation of the specified array of objects to the standard
322 | // output stream using the specified format information.
323 | //
324 | // Parameters:
325 | // format:
326 | // A composite format string.
327 | //
328 | // arg:
329 | // An array of objects to write using format.
330 | //
331 | // Exceptions:
332 | // T:System.IO.IOException:
333 | // An I/O error occurred.
334 | //
335 | // T:System.ArgumentNullException:
336 | // format or arg is null.
337 | //
338 | // T:System.FormatException:
339 | // The format specification in format is invalid.
340 | public void Write(string format, params object?[]? arg)
341 | {
342 | this.Write(value: string.Format(format: format,
343 | arg0: arg));
344 | }
345 |
346 | //
347 | // Summary:
348 | // Writes the text representation of the specified 32-bit unsigned integer value
349 | // to the standard output stream.
350 | //
351 | // Parameters:
352 | // value:
353 | // The value to write.
354 | //
355 | // Exceptions:
356 | // T:System.IO.IOException:
357 | // An I/O error occurred.
358 | public void Write(uint value)
359 | {
360 | this.Write(value: Convert.ToString(value: value));
361 | }
362 |
363 | //
364 | // Summary:
365 | // Writes the text representation of the specified 64-bit unsigned integer value
366 | // to the standard output stream.
367 | //
368 | // Parameters:
369 | // value:
370 | // The value to write.
371 | //
372 | // Exceptions:
373 | // T:System.IO.IOException:
374 | // An I/O error occurred.
375 | public void Write(ulong value)
376 | {
377 | this.Write(value: Convert.ToString(value: value));
378 | }
379 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.IO.WriteLine.cs:
--------------------------------------------------------------------------------
1 | using NStack;
2 | using System.Drawing;
3 | using System.Globalization;
4 |
5 | namespace HACC.Models.Drivers;
6 |
7 | //
8 | // Summary:
9 | // Represents the standard input, output, and error streams for console applications.
10 | // This class cannot be inherited.
11 | public partial class WebConsoleDriver
12 | {
13 | //
14 | // Summary:
15 | // Writes the current line terminator to the standard output stream.
16 | //
17 | // Exceptions:
18 | // T:System.IO.IOException:
19 | // An I/O error occurred.
20 | public void WriteLine()
21 | {
22 | var currentPosition = this.CursorPosition;
23 | this.TerminalSettings.SetCursorPosition(x: currentPosition.X,
24 | y: currentPosition.Y + 1);
25 | }
26 |
27 | //
28 | // Summary:
29 | // Writes the text representation of the specified Boolean value, followed by the
30 | // current line terminator, to the standard output stream.
31 | //
32 | // Parameters:
33 | // value:
34 | // The value to write.
35 | //
36 | // Exceptions:
37 | // T:System.IO.IOException:
38 | // An I/O error occurred.
39 | public void WriteLine(bool value)
40 | {
41 | this.WriteLine(value: Convert.ToString(value: value));
42 | }
43 |
44 | //
45 | // Summary:
46 | // Writes the specified Unicode character, followed by the current line terminator,
47 | // value to the standard output stream.
48 | //
49 | // Parameters:
50 | // value:
51 | // The value to write.
52 | //
53 | // Exceptions:
54 | // T:System.IO.IOException:
55 | // An I/O error occurred.
56 | public void WriteLine(char value)
57 | {
58 | this.WriteLine(value: Convert.ToString(value: value));
59 | }
60 |
61 | //
62 | // Summary:
63 | // Writes the specified array of Unicode characters, followed by the current line
64 | // terminator, to the standard output stream.
65 | //
66 | // Parameters:
67 | // buffer:
68 | // A Unicode character array.
69 | //
70 | // Exceptions:
71 | // T:System.IO.IOException:
72 | // An I/O error occurred.
73 | public void WriteLine(char[]? buffer)
74 | {
75 | this.WriteLine(value: buffer is null ? string.Empty : Convert.ToString(value: buffer));
76 | }
77 |
78 | //
79 | // Summary:
80 | // Writes the specified subarray of Unicode characters, followed by the current
81 | // line terminator, to the standard output stream.
82 | //
83 | // Parameters:
84 | // buffer:
85 | // An array of Unicode characters.
86 | //
87 | // index:
88 | // The starting position in buffer.
89 | //
90 | // count:
91 | // The number of characters to write.
92 | //
93 | // Exceptions:
94 | // T:System.ArgumentNullException:
95 | // buffer is null.
96 | //
97 | // T:System.ArgumentOutOfRangeException:
98 | // index or count is less than zero.
99 | //
100 | // T:System.ArgumentException:
101 | // index plus count specify a position that is not within buffer.
102 | //
103 | // T:System.IO.IOException:
104 | // An I/O error occurred.
105 | public void WriteLine(char[] buffer, int index, int count)
106 | {
107 | var value = Convert.ToString(value: buffer)
108 | ?.Substring(
109 | startIndex: index,
110 | length: count);
111 | this.WriteLine(value: value);
112 | }
113 |
114 | //
115 | // Summary:
116 | // Writes the text representation of the specified System.Decimal value, followed
117 | // by the current line terminator, to the standard output stream.
118 | //
119 | // Parameters:
120 | // value:
121 | // The value to write.
122 | //
123 | // Exceptions:
124 | // T:System.IO.IOException:
125 | // An I/O error occurred.
126 | public void WriteLine(decimal value)
127 | {
128 | this.WriteLine(value: Convert.ToString(value: value,
129 | provider: CultureInfo.InvariantCulture));
130 | }
131 |
132 | //
133 | // Summary:
134 | // Writes the text representation of the specified double-precision floating-point
135 | // value, followed by the current line terminator, to the standard output stream.
136 | //
137 | // Parameters:
138 | // value:
139 | // The value to write.
140 | //
141 | // Exceptions:
142 | // T:System.IO.IOException:
143 | // An I/O error occurred.
144 | public void WriteLine(double value)
145 | {
146 | this.WriteLine(value: Convert.ToString(value: value,
147 | provider: CultureInfo.InvariantCulture));
148 | }
149 |
150 | //
151 | // Summary:
152 | // Writes the text representation of the specified 32-bit signed integer value,
153 | // followed by the current line terminator, to the standard output stream.
154 | //
155 | // Parameters:
156 | // value:
157 | // The value to write.
158 | //
159 | // Exceptions:
160 | // T:System.IO.IOException:
161 | // An I/O error occurred.
162 | public void WriteLine(int value)
163 | {
164 | this.WriteLine(value: Convert.ToString(value: value));
165 | }
166 |
167 | //
168 | // Summary:
169 | // Writes the text representation of the specified 64-bit signed integer value,
170 | // followed by the current line terminator, to the standard output stream.
171 | //
172 | // Parameters:
173 | // value:
174 | // The value to write.
175 | //
176 | // Exceptions:
177 | // T:System.IO.IOException:
178 | // An I/O error occurred.
179 | public void WriteLine(long value)
180 | {
181 | this.WriteLine(value: Convert.ToString(value: value));
182 | }
183 |
184 | //
185 | // Summary:
186 | // Writes the text representation of the specified object, followed by the current
187 | // line terminator, to the standard output stream.
188 | //
189 | // Parameters:
190 | // value:
191 | // The value to write.
192 | //
193 | // Exceptions:
194 | // T:System.IO.IOException:
195 | // An I/O error occurred.
196 | public void WriteLine(object? value)
197 | {
198 | this.WriteLine(value: Convert.ToString(value: value));
199 | }
200 |
201 | //
202 | // Summary:
203 | // Writes the text representation of the specified single-precision floating-point
204 | // value, followed by the current line terminator, to the standard output stream.
205 | //
206 | // Parameters:
207 | // value:
208 | // The value to write.
209 | //
210 | // Exceptions:
211 | // T:System.IO.IOException:
212 | // An I/O error occurred.
213 | public void WriteLine(float value)
214 | {
215 | this.WriteLine(value: Convert.ToString(value: value,
216 | provider: CultureInfo.InvariantCulture));
217 | }
218 |
219 | //
220 | // Summary:
221 | // Writes the specified string value, followed by the current line terminator, to
222 | // the standard output stream.
223 | //
224 | // Parameters:
225 | // value:
226 | // The value to write.
227 | //
228 | // Exceptions:
229 | // T:System.IO.IOException:
230 | // An I/O error occurred.
231 | public void WriteLine(string? value)
232 | {
233 | this.AddStr(str: value is null ? ustring.Empty : ustring.Make(str: value));
234 | var currentPosition = this.CursorPosition;
235 | this.CursorPosition = new Point(x: 0,
236 | y: currentPosition.Y + 1);
237 | }
238 |
239 | //
240 | // Summary:
241 | // Writes the text representation of the specified object, followed by the current
242 | // line terminator, to the standard output stream using the specified format information.
243 | //
244 | // Parameters:
245 | // format:
246 | // A composite format string.
247 | //
248 | // arg0:
249 | // An object to write using format.
250 | //
251 | // Exceptions:
252 | // T:System.IO.IOException:
253 | // An I/O error occurred.
254 | //
255 | // T:System.ArgumentNullException:
256 | // format is null.
257 | //
258 | // T:System.FormatException:
259 | // The format specification in format is invalid.
260 | public void WriteLine(string format, object? arg0)
261 | {
262 | this.WriteLine(value: string.Format(
263 | format: format,
264 | arg0: arg0));
265 | }
266 |
267 | //
268 | // Summary:
269 | // Writes the text representation of the specified objects, followed by the current
270 | // line terminator, to the standard output stream using the specified format information.
271 | //
272 | // Parameters:
273 | // format:
274 | // A composite format string.
275 | //
276 | // arg0:
277 | // The first object to write using format.
278 | //
279 | // arg1:
280 | // The second object to write using format.
281 | //
282 | // Exceptions:
283 | // T:System.IO.IOException:
284 | // An I/O error occurred.
285 | //
286 | // T:System.ArgumentNullException:
287 | // format is null.
288 | //
289 | // T:System.FormatException:
290 | // The format specification in format is invalid.
291 | public void WriteLine(string format, object? arg0, object? arg1)
292 | {
293 | this.WriteLine(value: string.Format(
294 | format: format,
295 | arg0: arg0,
296 | arg1: arg1));
297 | }
298 |
299 | //
300 | // Summary:
301 | // Writes the text representation of the specified objects, followed by the current
302 | // line terminator, to the standard output stream using the specified format information.
303 | //
304 | // Parameters:
305 | // format:
306 | // A composite format string.
307 | //
308 | // arg0:
309 | // The first object to write using format.
310 | //
311 | // arg1:
312 | // The second object to write using format.
313 | //
314 | // arg2:
315 | // The third object to write using format.
316 | //
317 | // Exceptions:
318 | // T:System.IO.IOException:
319 | // An I/O error occurred.
320 | //
321 | // T:System.ArgumentNullException:
322 | // format is null.
323 | //
324 | // T:System.FormatException:
325 | // The format specification in format is invalid.
326 | public void WriteLine(string format, object? arg0, object? arg1, object? arg2)
327 | {
328 | this.WriteLine(value: string.Format(
329 | format: format,
330 | arg0: arg0,
331 | arg1: arg1,
332 | arg2: arg2));
333 | }
334 |
335 | //
336 | // Summary:
337 | // Writes the text representation of the specified array of objects, followed by
338 | // the current line terminator, to the standard output stream using the specified
339 | // format information.
340 | //
341 | // Parameters:
342 | // format:
343 | // A composite format string.
344 | //
345 | // arg:
346 | // An array of objects to write using format.
347 | //
348 | // Exceptions:
349 | // T:System.IO.IOException:
350 | // An I/O error occurred.
351 | //
352 | // T:System.ArgumentNullException:
353 | // format or arg is null.
354 | //
355 | // T:System.FormatException:
356 | // The format specification in format is invalid.
357 | public void WriteLine(string format, params object?[]? arg)
358 | {
359 | this.WriteLine(value: string.Format(
360 | format: format,
361 | arg0: arg));
362 | }
363 |
364 | //
365 | // Summary:
366 | // Writes the text representation of the specified 32-bit unsigned integer value,
367 | // followed by the current line terminator, to the standard output stream.
368 | //
369 | // Parameters:
370 | // value:
371 | // The value to write.
372 | //
373 | // Exceptions:
374 | // T:System.IO.IOException:
375 | // An I/O error occurred.
376 | public void WriteLine(uint value)
377 | {
378 | this.WriteLine(value: Convert.ToString(value: value));
379 | }
380 |
381 | //
382 | // Summary:
383 | // Writes the text representation of the specified 64-bit unsigned integer value,
384 | // followed by the current line terminator, to the standard output stream.
385 | //
386 | // Parameters:
387 | // value:
388 | // The value to write.
389 | //
390 | // Exceptions:
391 | // T:System.IO.IOException:
392 | // An I/O error occurred.
393 | public void WriteLine(ulong value)
394 | {
395 | this.WriteLine(value: Convert.ToString(value: value));
396 | }
397 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.IO.cs:
--------------------------------------------------------------------------------
1 | using HACC.Configuration;
2 | using HACC.Enumerations;
3 | using Spectre.Console;
4 | using System.Text;
5 |
6 | namespace HACC.Models.Drivers;
7 |
8 | //
9 | // Summary:
10 | // Represents the standard input, output, and error streams for console applications.
11 | // This class cannot be inherited.
12 | public partial class WebConsoleDriver
13 | {
14 | //
15 | // Summary:
16 | // Gets a value indicating whether the CAPS LOCK keyboard toggle is turned on or
17 | // turned off.
18 | //
19 | // Returns:
20 | // true if CAPS LOCK is turned on; false if CAPS LOCK is turned off.
21 | //
22 | // Exceptions:
23 | // T:System.PlatformNotSupportedException:
24 | // The get operation is invoked on an operating system other than Windows.
25 | public bool CapsLock => throw new NotImplementedException();
26 |
27 | //
28 | // Summary:
29 | // Gets the standard error output stream.
30 | //
31 | // Returns:
32 | // A System.IO.TextWriter that represents the standard error output stream.
33 | public TextWriter Error => throw new NotImplementedException();
34 |
35 | //
36 | // Summary:
37 | // Gets the standard input stream.
38 | //
39 | // Returns:
40 | // A System.IO.TextReader that represents the standard input stream.
41 | public TextReader In => throw new NotImplementedException();
42 |
43 | //
44 | // Summary:
45 | // Gets a value that indicates whether the error output stream has been redirected
46 | // from the standard error stream.
47 | //
48 | // Returns:
49 | // true if error output is redirected; otherwise, false.
50 | public bool IsErrorRedirected => throw new NotImplementedException();
51 |
52 | //
53 | // Summary:
54 | // Gets a value that indicates whether input has been redirected from the standard
55 | // input stream.
56 | //
57 | // Returns:
58 | // true if input is redirected; otherwise, false.
59 | public bool IsInputRedirected => throw new NotImplementedException();
60 |
61 | //
62 | // Summary:
63 | // Gets a value that indicates whether output has been redirected from the standard
64 | // output stream.
65 | //
66 | // Returns:
67 | // true if output is redirected; otherwise, false.
68 | public bool IsOutputRedirected => throw new NotImplementedException();
69 |
70 | //
71 | // Summary:
72 | // Gets a value indicating whether a key press is available in the input stream.
73 | //
74 | // Returns:
75 | // true if a key press is available; otherwise, false.
76 | //
77 | // Exceptions:
78 | // T:System.IO.IOException:
79 | // An I/O error occurred.
80 | //
81 | // T:System.InvalidOperationException:
82 | // Standard input is redirected to a file instead of the keyboard.
83 | public bool KeyAvailable => throw new NotImplementedException();
84 |
85 | //
86 | // Summary:
87 | // Gets a value indicating whether the NUM LOCK keyboard toggle is turned on or
88 | // turned off.
89 | //
90 | // Returns:
91 | // true if NUM LOCK is turned on; false if NUM LOCK is turned off.
92 | //
93 | // Exceptions:
94 | // T:System.PlatformNotSupportedException:
95 | // The get operation is invoked on an operating system other than Windows.
96 | public bool NumberLock => throw new NotImplementedException();
97 |
98 | //
99 | // Summary:
100 | // Gets the standard output stream.
101 | //
102 | // Returns:
103 | // A System.IO.TextWriter that represents the standard output stream.
104 | public TextWriter Out => throw new NotImplementedException();
105 |
106 | //
107 | // Summary:
108 | // Gets or sets the encoding the console uses to read input.
109 | //
110 | // Returns:
111 | // The encoding used to read console input.
112 | //
113 | // Exceptions:
114 | // T:System.ArgumentNullException:
115 | // The property value in a set operation is null.
116 | //
117 | // T:System.IO.IOException:
118 | // An error occurred during the execution of this operation.
119 | //
120 | // T:System.Security.SecurityException:
121 | // Your application does not have permission to perform this operation.
122 | public Encoding InputEncoding
123 | {
124 | get => throw new NotImplementedException();
125 | set { }
126 | }
127 |
128 | //
129 | // Summary:
130 | // Gets or sets a value indicating whether the combination of the System.ConsoleModifiers.Control
131 | // modifier key and System.ConsoleKey.C console key (Ctrl+C) is treated as ordinary
132 | // input or as an interruption that is handled by the operating system.
133 | //
134 | // Returns:
135 | // true if Ctrl+C is treated as ordinary input; otherwise, false.
136 | //
137 | // Exceptions:
138 | // T:System.IO.IOException:
139 | // Unable to get or set the input mode of the console input buffer.
140 | public bool TreatControlCAsInput
141 | {
142 | get => throw new NotImplementedException();
143 | set => throw new NotImplementedException();
144 | }
145 |
146 | //
147 | // Summary:
148 | // Gets or sets the encoding the console uses to write output.
149 | //
150 | // Returns:
151 | // The encoding used to write console output.
152 | //
153 | // Exceptions:
154 | // T:System.ArgumentNullException:
155 | // The property value in a set operation is null.
156 | //
157 | // T:System.IO.IOException:
158 | // An error occurred during the execution of this operation.
159 | //
160 | // T:System.Security.SecurityException:
161 | // Your application does not have permission to perform this operation.
162 | public Encoding OutputEncoding
163 | {
164 | get => throw new NotImplementedException();
165 | set => throw new NotImplementedException();
166 | }
167 |
168 | public IAnsiConsoleInput Input => throw new NotImplementedException();
169 |
170 | //
171 | // Summary:
172 | // Occurs when the System.ConsoleModifiers.Control modifier key (Ctrl) and either
173 | // the System.ConsoleKey.C console key (C) or the Break key are pressed simultaneously
174 | // (Ctrl+C or Ctrl+Break).
175 | public event EventHandler CancelKeyPress
176 | {
177 | //[System.Runtime.CompilerServices.NullableContext(2)]
178 | add => throw new NotImplementedException();
179 | //[System.Runtime.CompilerServices.NullableContext(2)]
180 | remove => throw new NotImplementedException();
181 | }
182 |
183 | //
184 | // Summary:
185 | // Plays the sound of a beep of a specified frequency and duration through the console
186 | // speaker.
187 | //
188 | // Parameters:
189 | // frequency:
190 | // The frequency of the beep, ranging from 37 to 32767 hertz.
191 | //
192 | // duration:
193 | // The duration of the beep measured in milliseconds.
194 | //
195 | // Exceptions:
196 | // T:System.ArgumentOutOfRangeException:
197 | // frequency is less than 37 or more than 32767 hertz. -or- duration is less than
198 | // or equal to zero.
199 | //
200 | // T:System.Security.HostProtectionException:
201 | // This method was executed on a server, such as SQL Server, that does not permit
202 | // access to the console.
203 | //
204 | // T:System.PlatformNotSupportedException:
205 | // The current operating system is not Windows.
206 | public async Task Beep(BeepType? beepType = Defaults.BeepType, float? duration = Defaults.BeepDurationMsec,
207 | float? frequency = Defaults.BeepFrequency, float? volume = Defaults.BeepVolume)
208 | {
209 | // ReSharper disable once HeapView.BoxingAllocation
210 | var type = beepType == null ? null : Enum.GetName(
211 | enumType: typeof(BeepType),
212 | value: beepType)!.ToLowerInvariant();
213 | await this._webConsole.Beep(
214 | duration: duration,
215 | frequency: frequency,
216 | volume: volume,
217 | type: type);
218 | }
219 |
220 | //
221 | // Summary:
222 | // Acquires the standard error stream.
223 | //
224 | // Returns:
225 | // The standard error stream.
226 | public Stream OpenStandardError()
227 | {
228 | throw new NotImplementedException();
229 | }
230 |
231 | //
232 | // Summary:
233 | // Acquires the standard error stream, which is set to a specified buffer size.
234 | //
235 | // Parameters:
236 | // bufferSize:
237 | // This parameter has no effect, but its value must be greater than or equal to
238 | // zero.
239 | //
240 | // Returns:
241 | // The standard error stream.
242 | //
243 | // Exceptions:
244 | // T:System.ArgumentOutOfRangeException:
245 | // bufferSize is less than or equal to zero.
246 | public Stream OpenStandardError(int bufferSize)
247 | {
248 | throw new NotImplementedException();
249 | }
250 |
251 | //
252 | // Summary:
253 | // Acquires the standard input stream.
254 | //
255 | // Returns:
256 | // The standard input stream.
257 | public Stream OpenStandardInput()
258 | {
259 | throw new NotImplementedException();
260 | }
261 |
262 | //
263 | // Summary:
264 | // Acquires the standard input stream, which is set to a specified buffer size.
265 | //
266 | // Parameters:
267 | // bufferSize:
268 | // This parameter has no effect, but its value must be greater than or equal to
269 | // zero.
270 | //
271 | // Returns:
272 | // The standard input stream.
273 | //
274 | // Exceptions:
275 | // T:System.ArgumentOutOfRangeException:
276 | // bufferSize is less than or equal to zero.
277 | public Stream OpenStandardInput(int bufferSize)
278 | {
279 | throw new NotImplementedException();
280 | }
281 |
282 | //
283 | // Summary:
284 | // Acquires the standard output stream.
285 | //
286 | // Returns:
287 | // The standard output stream.
288 | public Stream OpenStandardOutput()
289 | {
290 | throw new NotImplementedException();
291 | }
292 |
293 | //
294 | // Summary:
295 | // Acquires the standard output stream, which is set to a specified buffer size.
296 | //
297 | // Parameters:
298 | // bufferSize:
299 | // This parameter has no effect, but its value must be greater than or equal to
300 | // zero.
301 | //
302 | // Returns:
303 | // The standard output stream.
304 | //
305 | // Exceptions:
306 | // T:System.ArgumentOutOfRangeException:
307 | // bufferSize is less than or equal to zero.
308 | public Stream OpenStandardOutput(int bufferSize)
309 | {
310 | throw new NotImplementedException();
311 | }
312 |
313 | //
314 | // Summary:
315 | // Sets the System.ConsoleDriver.Error property to the specified System.IO.TextWriter
316 | // object.
317 | //
318 | // Parameters:
319 | // newError:
320 | // A stream that is the new standard error output.
321 | //
322 | // Exceptions:
323 | // T:System.ArgumentNullException:
324 | // newError is null.
325 | //
326 | // T:System.Security.SecurityException:
327 | // The caller does not have the required permission.
328 | public void SetError(TextWriter newError)
329 | {
330 | throw new NotImplementedException();
331 | }
332 |
333 | //
334 | // Summary:
335 | // Sets the System.ConsoleDriver.In property to the specified System.IO.TextReader object.
336 | //
337 | // Parameters:
338 | // newIn:
339 | // A stream that is the new standard input.
340 | //
341 | // Exceptions:
342 | // T:System.ArgumentNullException:
343 | // newIn is null.
344 | //
345 | // T:System.Security.SecurityException:
346 | // The caller does not have the required permission.
347 | public void SetIn(TextReader newIn)
348 | {
349 | throw new NotImplementedException();
350 | }
351 |
352 | //
353 | // Summary:
354 | // Sets the System.ConsoleDriver.Out property to target the System.IO.TextWriter object.
355 | //
356 | // Parameters:
357 | // newOut:
358 | // A text writer to be used as the new standard output.
359 | //
360 | // Exceptions:
361 | // T:System.ArgumentNullException:
362 | // newOut is null.
363 | //
364 | // T:System.Security.SecurityException:
365 | // The caller does not have the required permission.
366 | public void SetOut(TextWriter newOut)
367 | {
368 | throw new NotImplementedException();
369 | }
370 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Drivers/WebConsoleDriver.cs:
--------------------------------------------------------------------------------
1 | using HACC.Components;
2 | using HACC.Extensions;
3 | using HACC.Models.Spectre;
4 | using Microsoft.Extensions.Logging;
5 | using Spectre.Console;
6 | using Spectre.Console.Rendering;
7 | using Terminal.Gui;
8 |
9 | namespace HACC.Models.Drivers;
10 |
11 | ///
12 | /// Represents the standard input, output, and error streams for console applications.
13 | /// This class cannot be inherited.
14 | ///
15 | public sealed partial class WebConsoleDriver : ConsoleDriver, IAnsiConsole
16 | {
17 | private readonly WebConsole _webConsole;
18 |
19 | public readonly ILogger Logger;
20 |
21 | ///
22 | /// Initializes a web console driver.
23 | ///
24 | ///
25 | ///
26 | public WebConsoleDriver(WebClipboard webClipboard, WebConsole webConsole)
27 | {
28 | this.Logger = HaccExtensions.CreateLogger();
29 | this.Clipboard = webClipboard;
30 | this.ExclusivityMode = new BrowserExclusivityMode();
31 | this._webConsole = webConsole;
32 | this.TerminalSettings = new TerminalSettings();
33 | this.contents = new int[this.BufferRows, this.BufferColumns, 3];
34 | this._dirtyLine = new bool[this.BufferRows];
35 | }
36 |
37 | // TODO: resize, etc if terminal settings updated
38 | public TerminalSettings TerminalSettings { get; private set; }
39 |
40 | public Profile Profile => throw new NotImplementedException();
41 |
42 | public IExclusivityMode ExclusivityMode { get; }
43 | public RenderPipeline Pipeline => throw new NotImplementedException();
44 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Enums/WebEventType.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Models.Enums;
2 |
3 | public enum WebEventType
4 | {
5 | Key = 1,
6 | Mouse = 2,
7 | Resize = 3,
8 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Enums/WebMouseButtonState.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Models.Enums;
2 |
3 | [Flags]
4 | public enum WebMouseButtonState
5 | {
6 | Button1Pressed = 0x1,
7 | Button1Released = 0x2,
8 | Button1Clicked = 0x4,
9 | Button1DoubleClicked = 0x8,
10 | Button1TripleClicked = 0x10,
11 | Button2Pressed = 0x20,
12 | Button2Released = 0x40,
13 | Button2Clicked = 0x80,
14 | Button2DoubleClicked = 0x100,
15 | Button2TrippleClicked = 0x200,
16 | Button3Pressed = 0x400,
17 | Button3Released = 0x800,
18 | Button3Clicked = 0x1000,
19 | Button3DoubleClicked = 0x2000,
20 | Button3TripleClicked = 0x4000,
21 | ButtonWheeledUp = 0x8000,
22 | ButtonWheeledDown = 0x10000,
23 | ButtonWheeledLeft = 0x20000,
24 | ButtonWheeledRight = 0x40000,
25 | Button4Pressed = 0x80000,
26 | Button4Released = 0x100000,
27 | Button4Clicked = 0x200000,
28 | Button4DoubleClicked = 0x400000,
29 | Button4TripleClicked = 0x800000,
30 | ButtonShift = 0x1000000,
31 | ButtonCtrl = 0x2000000,
32 | ButtonAlt = 0x4000000,
33 | ReportMousePosition = 0x8000000,
34 |
35 | AllEvents = Button1Pressed | Button1Released | Button1Clicked | Button1DoubleClicked | Button1TripleClicked |
36 | Button2Pressed | Button2Released | Button2Clicked | Button2DoubleClicked | Button2TrippleClicked |
37 | Button3Pressed | Button3Released | Button3Clicked | Button3DoubleClicked | Button3TripleClicked |
38 | ButtonWheeledUp | ButtonWheeledDown | ButtonWheeledLeft | ButtonWheeledRight | Button4Pressed |
39 | Button4Released | Button4Clicked | Button4DoubleClicked | Button4TripleClicked | ReportMousePosition,
40 | }
--------------------------------------------------------------------------------
/src/HACC/Models/EventArgs/NewFrameEventArgs.cs:
--------------------------------------------------------------------------------
1 | using HACC.Models.Drivers;
2 |
3 | namespace HACC.Models.EventArgs;
4 |
5 | public record NewFrameEventArgs : VirtualConsoleEventArgs
6 | {
7 | public NewFrameEventArgs(WebConsoleDriver sender) : base(sender: sender)
8 | {
9 | throw new NotImplementedException();
10 | }
11 | }
--------------------------------------------------------------------------------
/src/HACC/Models/EventArgs/VirtualConsoleEventArgs.cs:
--------------------------------------------------------------------------------
1 | using HACC.Models.Drivers;
2 |
3 | namespace HACC.Models.EventArgs;
4 |
5 | public record VirtualConsoleEventArgs
6 | {
7 | public readonly WebConsoleDriver ConsoleDriver;
8 |
9 | public VirtualConsoleEventArgs(WebConsoleDriver sender)
10 | {
11 | this.ConsoleDriver = sender;
12 | }
13 | }
--------------------------------------------------------------------------------
/src/HACC/Models/SetLineResponse.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Models;
2 |
3 | public struct SetLineResponse
4 | {
5 | public readonly string TextReplaced;
6 | public readonly int LengthWritten;
7 | public readonly string TextOverflow;
8 |
9 | public SetLineResponse(string textReplaced, int lengthWritten, string textOverflow)
10 | {
11 | this.TextReplaced = textReplaced;
12 | this.LengthWritten = lengthWritten;
13 | this.TextOverflow = textOverflow;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Spectre/BrowserExclusivityMode.cs:
--------------------------------------------------------------------------------
1 | using Spectre.Console;
2 |
3 | namespace HACC.Models.Spectre;
4 |
5 | internal sealed class BrowserExclusivityMode : IExclusivityMode
6 | {
7 | public T Run(Func func)
8 | {
9 | return func();
10 | }
11 |
12 | public async Task RunAsync(Func> func)
13 | {
14 | return await func().ConfigureAwait(continueOnCapturedContext: false);
15 | }
16 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Structs/WebInputResult.cs:
--------------------------------------------------------------------------------
1 | using HACC.Models.Enums;
2 |
3 | namespace HACC.Models.Structs;
4 |
5 | public struct WebInputResult
6 | {
7 | public WebEventType EventType;
8 | public WebKeyEvent KeyEvent;
9 | public WebMouseEvent MouseEvent;
10 | public WebResizeEvent ResizeEvent;
11 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Structs/WebKeyEvent.cs:
--------------------------------------------------------------------------------
1 | namespace HACC.Models.Structs;
2 |
3 | public struct WebKeyEvent
4 | {
5 | public bool KeyDown;
6 | public ConsoleKeyInfo ConsoleKeyInfo;
7 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Structs/WebMouseEvent.cs:
--------------------------------------------------------------------------------
1 | using HACC.Models.Enums;
2 | using System.Drawing;
3 |
4 | namespace HACC.Models.Structs;
5 |
6 | public struct WebMouseEvent
7 | {
8 | public Point Position;
9 | public WebMouseButtonState ButtonState;
10 | }
--------------------------------------------------------------------------------
/src/HACC/Models/Structs/WebResizeEvent.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace HACC.Models.Structs;
4 |
5 | public struct WebResizeEvent
6 | {
7 | public Size Size;
8 | }
--------------------------------------------------------------------------------
/src/HACC/Models/TerminalSettings.cs:
--------------------------------------------------------------------------------
1 | using HACC.Configuration;
2 | using HACC.Enumerations;
3 | using System.Drawing;
4 |
5 | namespace HACC.Models;
6 |
7 | public record TerminalSettings
8 | {
9 | ///
10 | /// Terminal window width in characters
11 | ///
12 | public int BufferColumns;
13 |
14 | ///
15 | /// Terminal window height in characters
16 | ///
17 | public int BufferRows;
18 |
19 | ///
20 | /// Cursor color.
21 | ///
22 | public ConsoleColor CursorColor;
23 |
24 | ///
25 | /// Alternate blinking cursor color.
26 | ///
27 | public ConsoleColor CursorAlternateColor;
28 |
29 | ///
30 | /// Cursor height in percentage of character
31 | ///
32 | public int CursorHeight;
33 |
34 | ///
35 | /// Cursor position in characters
36 | ///
37 | public Point CursorPosition;
38 |
39 | ///
40 | /// Summary:
41 | /// Gets or sets the height of the cursor within a character cell.
42 | /// Returns:
43 | /// The size of the cursor expressed as a percentage of the height of a character
44 | /// cell. The property value ranges from 1 to 100.
45 | ///
46 | public int CursorSize;
47 |
48 | ///
49 | /// Cursor display shape/type
50 | ///
51 | public CursorType CursorType;
52 |
53 | ///
54 | /// Whether cursor is visible
55 | ///
56 | public bool CursorVisible;
57 |
58 | ///
59 | /// Terminal font size in pixels
60 | ///
61 | public int FontSizePixels;
62 |
63 | ///
64 | /// Terminal font space in pixels
65 | ///
66 | public int FontSpacePixels;
67 |
68 | ///
69 | /// Terminal font type
70 | ///
71 | public string FontType;
72 |
73 | ///
74 | /// Whether the status bar is visible
75 | ///
76 | public bool StatusVisible;
77 |
78 | ///
79 | /// Terminal default background color
80 | ///
81 | public ConsoleColor TerminalBackground;
82 |
83 | ///
84 | /// Terminal default foreground color
85 | ///
86 | public ConsoleColor TerminalForeground;
87 |
88 | ///
89 | /// Window/Terminal title
90 | ///
91 | public string Title;
92 |
93 | ///
94 | /// Whether the title bar is visible
95 | ///
96 | public bool TitleVisible;
97 |
98 | ///
99 | /// Terminal window width in characters
100 | ///
101 | public int WindowColumns;
102 |
103 | ///
104 | /// Terminal window height in pixels
105 | ///
106 | public int WindowHeightPixels;
107 |
108 | ///
109 | /// Terminal window height in characters
110 | ///
111 | public int WindowRows;
112 |
113 | ///
114 | /// Terminal window width in pixels
115 | ///
116 | public int WindowWidthPixels;
117 |
118 | public TerminalSettings(
119 | string title = "",
120 | int windowWidthPixels = Defaults.InitialTerminalWidth,
121 | int windowHeightPixels = Defaults.InitialTerminalHeight,
122 | int bufferColumns = Defaults.InitialBufferColumns,
123 | int bufferRows = Defaults.InitialBufferRows,
124 | int windowColumns = Defaults.InitialColumns,
125 | int windowRows = Defaults.InitialRows,
126 | bool cursorVisible = Defaults.CursorVisibility,
127 | bool statusVisible = Defaults.StatusVisibility,
128 | bool titleVisible = Defaults.TitleVisibility,
129 | Point? cursorPosition = null,
130 | CursorType cursorType = Defaults.CursorShape,
131 | int cursorHeight = Defaults.CursorHeight,
132 | int cursorSize = Defaults.CursorSize,
133 | ConsoleColor terminalBackground = Defaults.BackgroundColor,
134 | ConsoleColor terminalForeground = Defaults.ForegroundColor,
135 | int fontSizePixels = Defaults.FontSize,
136 | int fontSpacePixels = Defaults.FontSpace,
137 | string fontType = Defaults.FontType,
138 | ConsoleColor cursorColor = Defaults.CursorColor,
139 | ConsoleColor cursorAlternateColor = Defaults.CursorAlternateColor)
140 | {
141 | this.Title = title;
142 | this.WindowWidthPixels = windowWidthPixels;
143 | this.WindowHeightPixels = windowHeightPixels;
144 | this.BufferColumns = bufferColumns;
145 | this.BufferRows = bufferRows;
146 | this.WindowColumns = windowColumns;
147 | this.WindowRows = windowRows;
148 | this.CursorVisible = cursorVisible;
149 | this.StatusVisible = statusVisible;
150 | this.TitleVisible = titleVisible;
151 | this.CursorPosition = cursorPosition ?? new Point(
152 | x: 0,
153 | y: 0);
154 | this.CursorType = cursorType;
155 | this.CursorHeight = cursorHeight;
156 | this.CursorSize = cursorSize;
157 | this.TerminalBackground = terminalBackground;
158 | this.TerminalForeground = terminalForeground;
159 | this.FontSizePixels = fontSizePixels;
160 | this.FontSpacePixels = fontSpacePixels;
161 | this.FontType = fontType;
162 | this.CursorColor = cursorColor;
163 | this.CursorAlternateColor = cursorAlternateColor;
164 | }
165 |
166 | public void SetCursorPosition(int x, int y)
167 | {
168 | this.CursorPosition = new Point(x: x,
169 | y: y);
170 | }
171 | }
--------------------------------------------------------------------------------
/src/HACC/Models/WebClipboard.cs:
--------------------------------------------------------------------------------
1 | using HACC.Extensions;
2 | using Microsoft.AspNetCore.Components;
3 | using Microsoft.JSInterop;
4 | using Terminal.Gui;
5 |
6 | namespace HACC.Models;
7 |
8 | ///
9 | /// Blazor based clipboard
10 | ///
11 | public class WebClipboard : ClipboardBase
12 | {
13 | private readonly IJSRuntime _jsRuntime;
14 |
15 | public WebClipboard()
16 | {
17 | this._jsRuntime = HaccExtensions.GetService();
18 | }
19 |
20 | [Parameter] public string? Text { get; set; } = string.Empty;
21 |
22 | public override bool IsSupported => true;
23 |
24 | protected override string GetClipboardDataImpl()
25 | {
26 | Task.Run(async () => await this.ReadFromClipboardAsync());
27 | return this.Text!;
28 | }
29 |
30 | private async Task ReadFromClipboardAsync()
31 | {
32 | // Reading from the clipboard may be denied, so you must handle the exception
33 | try
34 | {
35 | this.Text = await ReadTextAsync();
36 | }
37 | catch
38 | {
39 | Console.WriteLine("Cannot read from clipboard");
40 | this.Text = null;
41 | }
42 | }
43 |
44 | private ValueTask ReadTextAsync()
45 | {
46 | return _jsRuntime.InvokeAsync("navigator.clipboard.readText");
47 | }
48 |
49 | protected override void SetClipboardDataImpl(string text)
50 | {
51 | Task.Run(async () => await this.CopyToClipboardAsync(text));
52 | this.Text = text;
53 | }
54 |
55 | private async Task CopyToClipboardAsync(string text)
56 | {
57 | // Writing to the clipboard may be denied, so you must handle the exception
58 | try
59 | {
60 | await WriteTextAsync(text);
61 | this.Text = text;
62 | }
63 | catch
64 | {
65 | Console.WriteLine("Cannot write text to clipboard");
66 | this.Text = null;
67 | }
68 | }
69 |
70 | private ValueTask WriteTextAsync(string text)
71 | {
72 | return _jsRuntime.InvokeVoidAsync("navigator.clipboard.writeText", text);
73 | }
74 | }
--------------------------------------------------------------------------------
/src/HACC/Models/WebMainLoopDriver.cs:
--------------------------------------------------------------------------------
1 | using HACC.Components;
2 | using HACC.Models.Structs;
3 | using Terminal.Gui;
4 |
5 | namespace HACC.Models;
6 |
7 | //
8 | // MainLoop.cs: IMainLoopDriver and MainLoop for Terminal.Gui
9 | //
10 | // Authors:
11 | // Miguel de Icaza (miguel@gnome.org)
12 | //
13 |
14 | ///
15 | /// Simple main loop implementation that can be used to monitor
16 | /// file descriptor, run timers and idle handlers.
17 | ///
18 | ///
19 | /// Monitoring of file descriptors is only available on Unix, there
20 | /// does not seem to be a way of supporting this on Windows.
21 | ///
22 | public class WebMainLoopDriver : IMainLoopDriver
23 | {
24 | private readonly Queue _inputResult = new();
25 | private readonly WebConsole _webConsole;
26 | private MainLoop? _mainLoop;
27 |
28 | ///
29 | /// Invoked when a Key is pressed, mouse is clicked or on resizing.
30 | ///
31 | public Action? ProcessInput;
32 |
33 |
34 | ///
35 | /// Creates a new Mainloop.
36 | ///
37 | ///
38 | public WebMainLoopDriver(WebConsole webConsole)
39 | {
40 | this._webConsole = webConsole ??
41 | throw new ArgumentNullException(paramName: "Console driver instance must be provided.");
42 | }
43 |
44 | void IMainLoopDriver.Setup(MainLoop mainLoop)
45 | {
46 | this._mainLoop = mainLoop ?? throw new ArgumentException(message: "MainLoop must be provided");
47 | this._webConsole.ReadConsoleInput += this.WebConsole_ReadConsoleInput;
48 | }
49 |
50 | void IMainLoopDriver.Wakeup()
51 | {
52 | this._webConsole.OnWakeup();
53 | }
54 |
55 | bool IMainLoopDriver.EventsPending(bool wait)
56 | {
57 | //return this._inputResult.Count > 0 || this.CheckTimers(wait: wait,
58 | // waitTimeout: out _);
59 | return true;
60 | }
61 |
62 | void IMainLoopDriver.MainIteration()
63 | {
64 | while (this._inputResult.Count > 0) this.ProcessInput?.Invoke(obj: this._inputResult.Dequeue());
65 | }
66 |
67 | private Task WebConsole_ReadConsoleInput(WebInputResult obj)
68 | {
69 | this._inputResult.Enqueue(item: obj);
70 | return Task.CompletedTask;
71 | }
72 |
73 | private bool CheckTimers(bool wait, out int waitTimeout)
74 | {
75 | var now = DateTime.UtcNow.Ticks;
76 |
77 | if (this._mainLoop!.Timeouts.Count > 0)
78 | {
79 | waitTimeout = (int) ((this._mainLoop.Timeouts.Keys[index: 0] - now) / TimeSpan.TicksPerMillisecond);
80 | if (waitTimeout < 0)
81 | return true;
82 | }
83 | else
84 | {
85 | waitTimeout = -1;
86 | }
87 |
88 | if (!wait)
89 | waitTimeout = 0;
90 |
91 | int ic;
92 | lock (this._mainLoop.IdleHandlers)
93 | {
94 | ic = this._mainLoop.IdleHandlers.Count;
95 | }
96 |
97 | return ic > 0;
98 | }
99 | }
--------------------------------------------------------------------------------
/src/HACC/README.md:
--------------------------------------------------------------------------------
1 | # HACC
2 |
3 | C# DotNet 6 HTML ANSI Console Canvas.
4 |
5 | * Contains a virtual terminal character buffer with text and appearance kept separately.
6 | * Contains a HTML component that renders the character buffer contents.
7 | * Contains glue code to create a System.Console compatible ANSI Console on an HTML5 Canvas.
8 |
9 | ## Work in progress.
10 |
11 | Will update readme once alpha is attained.
12 |
13 | ## Tests
14 |
15 | - https://github.com/Blazor-Console/HACC.Tests
16 |
17 | ## Development
18 |
19 | * https://github.com/Blazor-Console/HACC.Development/wiki/Developing
20 |
21 | ## Future
22 |
23 | * https://github.com/JessicaMulein/PlayZMachine will be based on this
24 | * A possible BBS with door games like ZMachine and a sea-faring game I'm writing in a private repo, (top secret!) which
25 | used to have the only test harness solution containing both the source and test repos.
26 |
--------------------------------------------------------------------------------
/src/HACC/Resources/WebStrings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HACC.Resources {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class WebStrings {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal WebStrings() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HACC.Resources.WebStrings", typeof(WebStrings).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized string similar to ConsoleDriver must be provided..
65 | ///
66 | internal static string ConsoleDriverRequired {
67 | get {
68 | return ResourceManager.GetString("ConsoleDriverRequired", resourceCulture);
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/HACC/Resources/WebStrings.fr-FR.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | ConsolerDriver doit être fourni.
122 |
123 |
--------------------------------------------------------------------------------
/src/HACC/Resources/WebStrings.ja-JP.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | text/microsoft-resx
90 |
91 |
92 | 1.3
93 |
94 |
95 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
96 |
97 |
98 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
99 |
100 |
101 | ConsoleDriverを提供する必要があります。
102 |
103 |
--------------------------------------------------------------------------------
/src/HACC/Resources/WebStrings.pt-PT.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | ConsoleDriver deve ser fornecido.
122 |
123 |
--------------------------------------------------------------------------------
/src/HACC/Resources/WebStrings.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | text/microsoft-resx
90 |
91 |
92 | 1.3
93 |
94 |
95 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
96 |
97 |
98 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
99 |
100 |
101 | ConsoleDriver must be provided.
102 |
103 |
--------------------------------------------------------------------------------
/src/HACC/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Components.Web
2 | @using HACC.Extensions
3 | @using HACC.Blazor.Extensions
4 | @using HACC.Blazor.Extensions.Canvas
--------------------------------------------------------------------------------
/src/HACC/wwwroot/JavaScript/beep.js:
--------------------------------------------------------------------------------
1 | // from: https://stackoverflow.com/a/29641185
2 | //if you have another AudioContext class use that one, as some browsers have a limit
3 | //All arguments are optional:
4 |
5 | //duration of the tone in milliseconds. Default is 500
6 | //frequency of the tone in hertz. default is 440
7 | //volume of the tone. Default is 1, off is 0.
8 | //type of tone. Possible values are sine, square, sawtooth, triangle, and custom. Default is sine.
9 | //callback to use on end of tone
10 | window.audioContextBeep = (duration, frequency, volume, type, callback) => {
11 | //if you have another AudioContext class use that one, as some browsers have a limit
12 | var audioCtx = new (window.AudioContext || window.webkitAudioContext || window.audioContext);
13 |
14 | var oscillator = audioCtx.createOscillator();
15 | var gainNode = audioCtx.createGain();
16 |
17 | oscillator.connect(gainNode);
18 | gainNode.connect(audioCtx.destination);
19 |
20 | if (volume) {
21 | gainNode.gain.value = parseFloat(volume);
22 | }
23 | if (frequency) {
24 | oscillator.frequency.value = parseFloat(frequency);
25 | }
26 | if (type) {
27 | oscillator.type = type;
28 | }
29 | if (callback) {
30 | oscillator.onended = callback;
31 | }
32 |
33 | oscillator.start(audioCtx.currentTime);
34 | oscillator.stop(audioCtx.currentTime + ((parseFloat(duration) || 500) / 1000));
35 | };
--------------------------------------------------------------------------------
/src/HACC/wwwroot/JavaScript/clipboard.js:
--------------------------------------------------------------------------------
1 | window.clipboardFunctions = {
2 | setText: function (clipboardText) {
3 | navigator.clipboard.writeText(clipboardText).then(function () {
4 | return true;
5 | })
6 | .catch(function (error) {
7 | return false;
8 | });
9 | },
10 | getText: function () {
11 | navigator.clipboard.readText().then(function (text) {
12 | return text;
13 | })
14 | .catch(function (error) {
15 | return null;
16 | });
17 | }
18 | }
--------------------------------------------------------------------------------
/src/HACC/wwwroot/JavaScript/consoleInterop.js:
--------------------------------------------------------------------------------
1 | function canvasHasFocus() {
2 | if (!window.consoleJs.canvas)
3 | return false;
4 |
5 | const elem = document.querySelector('canvas');
6 |
7 | if (elem === document.activeElement) {
8 | return true;
9 | } else {
10 | return false;
11 | }
12 | }
13 |
14 | function onResize() {
15 | if (!window.consoleJs.canvas)
16 | return;
17 |
18 | var canvasContainer = document.getElementById('_divCanvas');
19 | if (canvasContainer) {
20 | window.consoleJs.canvas.width = canvasContainer.offsetWidth - canvasContainer.offsetLeft;
21 | window.consoleJs.canvas.height = canvasContainer.offsetHeight - canvasContainer.offsetTop;
22 |
23 | window.consoleJs.instance.invokeMethodAsync('OnResize', window.consoleJs.canvas.width, window.consoleJs.canvas.height);
24 | }
25 | }
26 |
27 | function onFocus() {
28 | if (!window.consoleJs.canvas)
29 | return;
30 |
31 | window.consoleJs.instance.invokeMethodAsync('OnFocus');
32 | }
33 |
34 | function onBlur() {
35 | if (!window.consoleJs.canvas)
36 | return;
37 |
38 | window.consoleJs.instance.invokeMethodAsync('OnBlur');
39 | }
40 |
41 | function onBeforeUnload() {
42 | if (!window.consoleJs.canvas)
43 | return;
44 |
45 | window.consoleJs.instance.invokeMethodAsync('OnBeforeUnload');
46 | }
47 |
48 | function onVisibilityChange() {
49 | if (!window.consoleJs.canvas)
50 | return;
51 |
52 | var visible = document.visibilityState === 'visible' ? true : false;
53 | if (visible) {
54 | console.log("user is focused on the page")
55 | } else {
56 | console.log("user left the page")
57 | }
58 | window.consoleJs.instance.invokeMethodAsync('OnVisibilityChange', visible);
59 | }
60 |
61 | window.consoleWindowResize = (instance) => {
62 | onResize();
63 | };
64 |
65 | window.consoleWindowFocus = (instance) => {
66 | onFocus();
67 | }
68 |
69 | window.consoleWindowBlur = (instance) => {
70 | onBlur();
71 | }
72 |
73 | window.consoleWindowBeforeUnload = (instance) => {
74 | onBeforeUnload();
75 | }
76 |
77 | document.consoleWindowVisibilityChange = (instance) => {
78 | onVisibilityChange();
79 | }
80 |
81 | window.canvasToPng = () => {
82 | return window.consoleJs.canvas.toDataURL("image/png");
83 | };
84 |
85 | window.initConsole = (instance) => {
86 | var canvasContainer = document.getElementById('_divCanvas'),
87 | canvases = canvasContainer.getElementsByTagName('canvas') || [];
88 | window.consoleJs = {
89 | instance: instance,
90 | canvas: canvases.length ? canvases[0] : null
91 | };
92 |
93 | if (window.consoleJs.canvas) {
94 | window.consoleJs.canvas.onmousemove = (e) => {
95 | if (!canvasHasFocus)
96 | return;
97 | var me = getMouseEvent(e);
98 | window.consoleJs.instance.invokeMethodAsync('OnCanvasMouse', me);
99 | return false;
100 | };
101 | window.consoleJs.canvas.onmousedown = (e) => {
102 | if (!canvasHasFocus)
103 | return;
104 | var me = getMouseEvent(e);
105 | window.consoleJs.instance.invokeMethodAsync('OnCanvasMouse', me);
106 | return false;
107 | };
108 | window.consoleJs.canvas.onmouseup = (e) => {
109 | if (!canvasHasFocus)
110 | return;
111 | var me = getMouseEvent(e);
112 | window.consoleJs.instance.invokeMethodAsync('OnCanvasMouse', me);
113 | return false;
114 | };
115 | window.consoleJs.canvas.onmousewheel = (e) => {
116 | if (!canvasHasFocus)
117 | return;
118 | var we = getWheelEvent(e);
119 | window.consoleJs.instance.invokeMethodAsync('OnCanvasWheel', we);
120 | return false;
121 | };
122 | window.consoleJs.canvas.oncontextmenu = function () {
123 | return false;
124 | }
125 |
126 | window.consoleJs.canvas.onkeydown = (e) => {
127 | if (!canvasHasFocus)
128 | return;
129 | var ke = getKeyEvent(e);
130 | window.consoleJs.instance.invokeMethodAsync('OnCanvasKey', ke);
131 | };
132 | window.consoleJs.canvas.onkeyup = (e) => {
133 | if (!canvasHasFocus)
134 | return;
135 | var ke = getKeyEvent(e);
136 | window.consoleJs.instance.invokeMethodAsync('OnCanvasKey', ke);
137 | };
138 | window.consoleJs.canvas.onblur = (e) => {
139 | if (!canvasHasFocus)
140 | return;
141 | window.consoleJs.instance.invokeMethodAsync('OnBlur');
142 | };
143 | window.consoleJs.canvas.tabIndex = 0;
144 | window.consoleJs.canvas.focus();
145 | }
146 |
147 | window.addEventListener("resize", onResize);
148 | window.addEventListener("focus", onFocus);
149 | window.addEventListener("blur", onBlur);
150 | window.addEventListener("beforeunload", onBeforeUnload);
151 | document.addEventListener('visibilitychange', onVisibilityChange);
152 | };
153 |
154 | function getKeyEvent(e) {
155 | var ke = {};
156 | ke.AltKey = e.altKey;
157 | ke.Code = e.code;
158 | ke.CtrlKey = e.ctrlKey;
159 | ke.Key = e.key;
160 | ke.Location = e.location;
161 | ke.MetaKey = e.metaKey;
162 | ke.Repeat = e.repeat;
163 | ke.ShiftKey = e.shiftKey;
164 | ke.Type = e.type;
165 | return ke;
166 | }
167 |
168 | function getWheelEvent(e) {
169 | var we = {};
170 | we.AltKey = e.altKey;
171 | we.Button = e.button;
172 | we.Buttons = e.buttons;
173 | we.ClientX = e.clientX;
174 | we.ClientY = e.clientY;
175 | we.CtrlKey = e.ctrlKey;
176 | we.DeltaMode = e.deltaMode;
177 | we.DeltaX = e.deltaX;
178 | we.DeltaY = e.deltaY;
179 | we.DeltaZ = e.deltaZ;
180 | we.Detail = e.detail;
181 | we.MetaKey = e.metaKey;
182 | we.OffsetX = e.offsetX;
183 | we.OffsetY = e.offsetY;
184 | we.PageX = e.pageX;
185 | we.PageY = e.pageY;
186 | we.ScreenX = e.screenX;
187 | we.ScreenY = e.screenY;
188 | we.ShiftKey = e.shiftKey;
189 | we.Type = e.type;
190 | return we;
191 | }
192 |
193 | function getMouseEvent(e) {
194 | var me = {};
195 | me.AltKey = e.altKey;
196 | me.Button = e.button;
197 | me.Buttons = e.buttons;
198 | me.ClientX = e.clientX;
199 | me.ClientY = e.clientY;
200 | me.CtrlKey = e.ctrlKey;
201 | me.Detail = e.detail;
202 | me.MetaKey = e.metaKey;
203 | me.OffsetX = e.offsetX;
204 | me.OffsetY = e.offsetY;
205 | me.PageX = e.pageX;
206 | me.PageY = e.pageY;
207 | me.ScreenX = e.screenX;
208 | me.ScreenY = e.screenY;
209 | me.ShiftKey = e.shiftKey;
210 | me.Type = e.type;
211 | return me;
212 | }
213 |
--------------------------------------------------------------------------------