sdbd-demo.git

git clone https://git.crispbyte.dev/sdbd-demo.git

commit
3cc7d54
parent
3cc7d54
author
CheddarCrisp
date
2024-01-09 23:32:46 +0100 CET
Initial commit
9 files changed,  +605, -0
A .gitignore
+484, -0
  1@@ -0,0 +1,484 @@
  2+## Ignore Visual Studio temporary files, build results, and
  3+## files generated by popular Visual Studio add-ons.
  4+##
  5+## Get latest from `dotnet new gitignore`
  6+
  7+# dotenv files
  8+.env
  9+
 10+# User-specific files
 11+*.rsuser
 12+*.suo
 13+*.user
 14+*.userosscache
 15+*.sln.docstates
 16+
 17+# User-specific files (MonoDevelop/Xamarin Studio)
 18+*.userprefs
 19+
 20+# Mono auto generated files
 21+mono_crash.*
 22+
 23+# Build results
 24+[Dd]ebug/
 25+[Dd]ebugPublic/
 26+[Rr]elease/
 27+[Rr]eleases/
 28+x64/
 29+x86/
 30+[Ww][Ii][Nn]32/
 31+[Aa][Rr][Mm]/
 32+[Aa][Rr][Mm]64/
 33+bld/
 34+[Bb]in/
 35+[Oo]bj/
 36+[Ll]og/
 37+[Ll]ogs/
 38+
 39+# Visual Studio 2015/2017 cache/options directory
 40+.vs/
 41+# Uncomment if you have tasks that create the project's static files in wwwroot
 42+#wwwroot/
 43+
 44+# Visual Studio 2017 auto generated files
 45+Generated\ Files/
 46+
 47+# MSTest test Results
 48+[Tt]est[Rr]esult*/
 49+[Bb]uild[Ll]og.*
 50+
 51+# NUnit
 52+*.VisualState.xml
 53+TestResult.xml
 54+nunit-*.xml
 55+
 56+# Build Results of an ATL Project
 57+[Dd]ebugPS/
 58+[Rr]eleasePS/
 59+dlldata.c
 60+
 61+# Benchmark Results
 62+BenchmarkDotNet.Artifacts/
 63+
 64+# .NET
 65+project.lock.json
 66+project.fragment.lock.json
 67+artifacts/
 68+
 69+# Tye
 70+.tye/
 71+
 72+# ASP.NET Scaffolding
 73+ScaffoldingReadMe.txt
 74+
 75+# StyleCop
 76+StyleCopReport.xml
 77+
 78+# Files built by Visual Studio
 79+*_i.c
 80+*_p.c
 81+*_h.h
 82+*.ilk
 83+*.meta
 84+*.obj
 85+*.iobj
 86+*.pch
 87+*.pdb
 88+*.ipdb
 89+*.pgc
 90+*.pgd
 91+*.rsp
 92+*.sbr
 93+*.tlb
 94+*.tli
 95+*.tlh
 96+*.tmp
 97+*.tmp_proj
 98+*_wpftmp.csproj
 99+*.log
100+*.tlog
101+*.vspscc
102+*.vssscc
103+.builds
104+*.pidb
105+*.svclog
106+*.scc
107+
108+# Chutzpah Test files
109+_Chutzpah*
110+
111+# Visual C++ cache files
112+ipch/
113+*.aps
114+*.ncb
115+*.opendb
116+*.opensdf
117+*.sdf
118+*.cachefile
119+*.VC.db
120+*.VC.VC.opendb
121+
122+# Visual Studio profiler
123+*.psess
124+*.vsp
125+*.vspx
126+*.sap
127+
128+# Visual Studio Trace Files
129+*.e2e
130+
131+# TFS 2012 Local Workspace
132+$tf/
133+
134+# Guidance Automation Toolkit
135+*.gpState
136+
137+# ReSharper is a .NET coding add-in
138+_ReSharper*/
139+*.[Rr]e[Ss]harper
140+*.DotSettings.user
141+
142+# TeamCity is a build add-in
143+_TeamCity*
144+
145+# DotCover is a Code Coverage Tool
146+*.dotCover
147+
148+# AxoCover is a Code Coverage Tool
149+.axoCover/*
150+!.axoCover/settings.json
151+
152+# Coverlet is a free, cross platform Code Coverage Tool
153+coverage*.json
154+coverage*.xml
155+coverage*.info
156+
157+# Visual Studio code coverage results
158+*.coverage
159+*.coveragexml
160+
161+# NCrunch
162+_NCrunch_*
163+.*crunch*.local.xml
164+nCrunchTemp_*
165+
166+# MightyMoose
167+*.mm.*
168+AutoTest.Net/
169+
170+# Web workbench (sass)
171+.sass-cache/
172+
173+# Installshield output folder
174+[Ee]xpress/
175+
176+# DocProject is a documentation generator add-in
177+DocProject/buildhelp/
178+DocProject/Help/*.HxT
179+DocProject/Help/*.HxC
180+DocProject/Help/*.hhc
181+DocProject/Help/*.hhk
182+DocProject/Help/*.hhp
183+DocProject/Help/Html2
184+DocProject/Help/html
185+
186+# Click-Once directory
187+publish/
188+
189+# Publish Web Output
190+*.[Pp]ublish.xml
191+*.azurePubxml
192+# Note: Comment the next line if you want to checkin your web deploy settings,
193+# but database connection strings (with potential passwords) will be unencrypted
194+*.pubxml
195+*.publishproj
196+
197+# Microsoft Azure Web App publish settings. Comment the next line if you want to
198+# checkin your Azure Web App publish settings, but sensitive information contained
199+# in these scripts will be unencrypted
200+PublishScripts/
201+
202+# NuGet Packages
203+*.nupkg
204+# NuGet Symbol Packages
205+*.snupkg
206+# The packages folder can be ignored because of Package Restore
207+**/[Pp]ackages/*
208+# except build/, which is used as an MSBuild target.
209+!**/[Pp]ackages/build/
210+# Uncomment if necessary however generally it will be regenerated when needed
211+#!**/[Pp]ackages/repositories.config
212+# NuGet v3's project.json files produces more ignorable files
213+*.nuget.props
214+*.nuget.targets
215+
216+# Microsoft Azure Build Output
217+csx/
218+*.build.csdef
219+
220+# Microsoft Azure Emulator
221+ecf/
222+rcf/
223+
224+# Windows Store app package directories and files
225+AppPackages/
226+BundleArtifacts/
227+Package.StoreAssociation.xml
228+_pkginfo.txt
229+*.appx
230+*.appxbundle
231+*.appxupload
232+
233+# Visual Studio cache files
234+# files ending in .cache can be ignored
235+*.[Cc]ache
236+# but keep track of directories ending in .cache
237+!?*.[Cc]ache/
238+
239+# Others
240+ClientBin/
241+~$*
242+*~
243+*.dbmdl
244+*.dbproj.schemaview
245+*.jfm
246+*.pfx
247+*.publishsettings
248+orleans.codegen.cs
249+
250+# Including strong name files can present a security risk
251+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
252+#*.snk
253+
254+# Since there are multiple workflows, uncomment next line to ignore bower_components
255+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
256+#bower_components/
257+
258+# RIA/Silverlight projects
259+Generated_Code/
260+
261+# Backup & report files from converting an old project file
262+# to a newer Visual Studio version. Backup files are not needed,
263+# because we have git ;-)
264+_UpgradeReport_Files/
265+Backup*/
266+UpgradeLog*.XML
267+UpgradeLog*.htm
268+ServiceFabricBackup/
269+*.rptproj.bak
270+
271+# SQL Server files
272+*.mdf
273+*.ldf
274+*.ndf
275+
276+# Business Intelligence projects
277+*.rdl.data
278+*.bim.layout
279+*.bim_*.settings
280+*.rptproj.rsuser
281+*- [Bb]ackup.rdl
282+*- [Bb]ackup ([0-9]).rdl
283+*- [Bb]ackup ([0-9][0-9]).rdl
284+
285+# Microsoft Fakes
286+FakesAssemblies/
287+
288+# GhostDoc plugin setting file
289+*.GhostDoc.xml
290+
291+# Node.js Tools for Visual Studio
292+.ntvs_analysis.dat
293+node_modules/
294+
295+# Visual Studio 6 build log
296+*.plg
297+
298+# Visual Studio 6 workspace options file
299+*.opt
300+
301+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
302+*.vbw
303+
304+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
305+*.vbp
306+
307+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
308+*.dsw
309+*.dsp
310+
311+# Visual Studio 6 technical files
312+*.ncb
313+*.aps
314+
315+# Visual Studio LightSwitch build output
316+**/*.HTMLClient/GeneratedArtifacts
317+**/*.DesktopClient/GeneratedArtifacts
318+**/*.DesktopClient/ModelManifest.xml
319+**/*.Server/GeneratedArtifacts
320+**/*.Server/ModelManifest.xml
321+_Pvt_Extensions
322+
323+# Paket dependency manager
324+.paket/paket.exe
325+paket-files/
326+
327+# FAKE - F# Make
328+.fake/
329+
330+# CodeRush personal settings
331+.cr/personal
332+
333+# Python Tools for Visual Studio (PTVS)
334+__pycache__/
335+*.pyc
336+
337+# Cake - Uncomment if you are using it
338+# tools/**
339+# !tools/packages.config
340+
341+# Tabs Studio
342+*.tss
343+
344+# Telerik's JustMock configuration file
345+*.jmconfig
346+
347+# BizTalk build output
348+*.btp.cs
349+*.btm.cs
350+*.odx.cs
351+*.xsd.cs
352+
353+# OpenCover UI analysis results
354+OpenCover/
355+
356+# Azure Stream Analytics local run output
357+ASALocalRun/
358+
359+# MSBuild Binary and Structured Log
360+*.binlog
361+
362+# NVidia Nsight GPU debugger configuration file
363+*.nvuser
364+
365+# MFractors (Xamarin productivity tool) working folder
366+.mfractor/
367+
368+# Local History for Visual Studio
369+.localhistory/
370+
371+# Visual Studio History (VSHistory) files
372+.vshistory/
373+
374+# BeatPulse healthcheck temp database
375+healthchecksdb
376+
377+# Backup folder for Package Reference Convert tool in Visual Studio 2017
378+MigrationBackup/
379+
380+# Ionide (cross platform F# VS Code tools) working folder
381+.ionide/
382+
383+# Fody - auto-generated XML schema
384+FodyWeavers.xsd
385+
386+# VS Code files for those working on multiple tools
387+.vscode/*
388+!.vscode/settings.json
389+!.vscode/tasks.json
390+!.vscode/launch.json
391+!.vscode/extensions.json
392+*.code-workspace
393+
394+# Local History for Visual Studio Code
395+.history/
396+
397+# Windows Installer files from build outputs
398+*.cab
399+*.msi
400+*.msix
401+*.msm
402+*.msp
403+
404+# JetBrains Rider
405+*.sln.iml
406+.idea
407+
408+##
409+## Visual studio for Mac
410+##
411+
412+
413+# globs
414+Makefile.in
415+*.userprefs
416+*.usertasks
417+config.make
418+config.status
419+aclocal.m4
420+install-sh
421+autom4te.cache/
422+*.tar.gz
423+tarballs/
424+test-results/
425+
426+# Mac bundle stuff
427+*.dmg
428+*.app
429+
430+# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
431+# General
432+.DS_Store
433+.AppleDouble
434+.LSOverride
435+
436+# Icon must end with two \r
437+Icon
438+
439+
440+# Thumbnails
441+._*
442+
443+# Files that might appear in the root of a volume
444+.DocumentRevisions-V100
445+.fseventsd
446+.Spotlight-V100
447+.TemporaryItems
448+.Trashes
449+.VolumeIcon.icns
450+.com.apple.timemachine.donotpresent
451+
452+# Directories potentially created on remote AFP share
453+.AppleDB
454+.AppleDesktop
455+Network Trash Folder
456+Temporary Items
457+.apdisk
458+
459+# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
460+# Windows thumbnail cache files
461+Thumbs.db
462+ehthumbs.db
463+ehthumbs_vista.db
464+
465+# Dump file
466+*.stackdump
467+
468+# Folder config file
469+[Dd]esktop.ini
470+
471+# Recycle Bin used on file shares
472+$RECYCLE.BIN/
473+
474+# Windows Installer files
475+*.cab
476+*.msi
477+*.msix
478+*.msm
479+*.msp
480+
481+# Windows shortcuts
482+*.lnk
483+
484+# Vim temporary swap files
485+*.swp
A SDBD.Codec/Codec.cs
+11, -0
 1@@ -0,0 +1,11 @@
 2+namespace SDBD;
 3+
 4+public class Codec : ICodec {
 5+  public Document Decode(byte[] data) {
 6+    return new(new (), new byte[0]);
 7+  }
 8+
 9+  public byte[] Encode(Document document) {
10+    return new byte[0];
11+  }
12+}
A SDBD.Codec/SDBD.Codec.csproj
+13, -0
 1@@ -0,0 +1,13 @@
 2+<Project Sdk="Microsoft.NET.Sdk">
 3+
 4+  <ItemGroup>
 5+    <ProjectReference Include="..\SDBD.Contract\SDBD.Contract.csproj" />
 6+  </ItemGroup>
 7+
 8+  <PropertyGroup>
 9+    <TargetFramework>net8.0</TargetFramework>
10+    <ImplicitUsings>enable</ImplicitUsings>
11+    <Nullable>enable</Nullable>
12+  </PropertyGroup>
13+
14+</Project>
A SDBD.Contract/Document.cs
+6, -0
1@@ -0,0 +1,6 @@
2+namespace SDBD;
3+
4+public record Document(
5+    Dictionary<string, string> Metadata,
6+    byte[] Data
7+);
A SDBD.Contract/ICodec.cs
+6, -0
1@@ -0,0 +1,6 @@
2+namespace SDBD;
3+
4+public interface ICodec {
5+  Document Decode(byte[] data);
6+  byte[] Encode(Document document);
7+}
A SDBD.Contract/SDBD.Contract.csproj
+9, -0
 1@@ -0,0 +1,9 @@
 2+<Project Sdk="Microsoft.NET.Sdk">
 3+
 4+  <PropertyGroup>
 5+    <TargetFramework>net8.0</TargetFramework>
 6+    <ImplicitUsings>enable</ImplicitUsings>
 7+    <Nullable>enable</Nullable>
 8+  </PropertyGroup>
 9+
10+</Project>
A SDBD.Demo/Program.cs
+27, -0
 1@@ -0,0 +1,27 @@
 2+SDBD.ICodec codec = new SDBD.Codec();
 3+
 4+var (encode, filename) = ParseArgs(args);
 5+var inputData = File.ReadAllBytes(filename);
 6+
 7+if(encode) {
 8+  SDBD.Document document = new (
 9+    new() {
10+      { "content-name", filename }
11+    },
12+    inputData
13+  );
14+  var outputData = codec.Encode(document);
15+  File.WriteAllBytes($"{filename}.sbdb", outputData);
16+} else {
17+  var document = codec.Decode(inputData);
18+  File.WriteAllBytes(document.Metadata["content-name"], document.Data);
19+}
20+
21+(bool encode, string filename) ParseArgs(string[] args) {
22+  return args switch {
23+    [var filename] => (true, filename),
24+    ["-d", var filename] => (false, filename),
25+    ["-e", var filename] => (true, filename),
26+    _ => throw new Exception("I don't like those arguments")
27+  };
28+}
A SDBD.Demo/SDBD.Demo.csproj
+15, -0
 1@@ -0,0 +1,15 @@
 2+<Project Sdk="Microsoft.NET.Sdk">
 3+
 4+  <ItemGroup>
 5+    <ProjectReference Include="..\SDBD.Contract\SDBD.Contract.csproj" />
 6+    <ProjectReference Include="..\SDBD.Codec\SDBD.Codec.csproj" />
 7+  </ItemGroup>
 8+
 9+  <PropertyGroup>
10+    <OutputType>Exe</OutputType>
11+    <TargetFramework>net8.0</TargetFramework>
12+    <ImplicitUsings>enable</ImplicitUsings>
13+    <Nullable>enable</Nullable>
14+  </PropertyGroup>
15+
16+</Project>
A SDBD.sln
+34, -0
 1@@ -0,0 +1,34 @@
 2+
 3+Microsoft Visual Studio Solution File, Format Version 12.00
 4+# Visual Studio Version 17
 5+VisualStudioVersion = 17.0.31903.59
 6+MinimumVisualStudioVersion = 10.0.40219.1
 7+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDBD.Contract", "SDBD.Contract\SDBD.Contract.csproj", "{FC62D4AB-CAA4-4100-BB60-93ED06524C55}"
 8+EndProject
 9+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDBD.Codec", "SDBD.Codec\SDBD.Codec.csproj", "{E8476003-D889-4E79-B64A-0A132CCD76B7}"
10+EndProject
11+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDBD.Demo", "SDBD.Demo\SDBD.Demo.csproj", "{0E422F50-9FDF-4B0A-992D-445C9785BA6F}"
12+EndProject
13+Global
14+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+		Debug|Any CPU = Debug|Any CPU
16+		Release|Any CPU = Release|Any CPU
17+	EndGlobalSection
18+	GlobalSection(SolutionProperties) = preSolution
19+		HideSolutionNode = FALSE
20+	EndGlobalSection
21+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+		{FC62D4AB-CAA4-4100-BB60-93ED06524C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+		{FC62D4AB-CAA4-4100-BB60-93ED06524C55}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+		{FC62D4AB-CAA4-4100-BB60-93ED06524C55}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+		{FC62D4AB-CAA4-4100-BB60-93ED06524C55}.Release|Any CPU.Build.0 = Release|Any CPU
26+		{E8476003-D889-4E79-B64A-0A132CCD76B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+		{E8476003-D889-4E79-B64A-0A132CCD76B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+		{E8476003-D889-4E79-B64A-0A132CCD76B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+		{E8476003-D889-4E79-B64A-0A132CCD76B7}.Release|Any CPU.Build.0 = Release|Any CPU
30+		{0E422F50-9FDF-4B0A-992D-445C9785BA6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+		{0E422F50-9FDF-4B0A-992D-445C9785BA6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+		{0E422F50-9FDF-4B0A-992D-445C9785BA6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+		{0E422F50-9FDF-4B0A-992D-445C9785BA6F}.Release|Any CPU.Build.0 = Release|Any CPU
34+	EndGlobalSection
35+EndGlobal