├── CodeGenerators ├── CodeTemplate │ ├── README.md │ ├── files │ │ ├── .gitignore │ │ ├── gen.sh │ │ └── gen.bat │ ├── examples │ │ ├── .gitignore │ │ └── example.yaml │ ├── setup.sh │ ├── setup.bat │ ├── simple_codegen.bat │ ├── .gitattributes │ ├── templates │ │ ├── usecase │ │ │ ├── request.cs │ │ │ ├── response.cs │ │ │ ├── usecase.cs │ │ │ ├── usecase.yaml │ │ │ ├── presenter.cs │ │ │ └── interactor.cs │ │ └── examples │ │ │ ├── example.cs │ │ │ └── example.yaml │ ├── simple_codegen.sh │ ├── Pipfile │ ├── schema │ │ └── template_info.yaml │ └── LICENSE.txt └── ProjectTemplate │ ├── cli.sh │ ├── module.sh │ ├── storage.sh │ ├── usecase.sh │ ├── Template.cliapp.csproj │ ├── Template.module.csproj │ └── Template.module.Testing.csproj ├── KeySwitchManager ├── .nuget │ ├── local-packages │ │ └── .gitignore │ └── NuGet.Config ├── Sources │ ├── Tests │ │ ├── Infrastructures │ │ │ ├── Storage.Yaml │ │ │ │ ├── .gitignore │ │ │ │ ├── KeySwitches │ │ │ │ │ ├── TestData │ │ │ │ │ │ └── ImportTestData.yaml │ │ │ │ │ └── YamlImportTest.cs │ │ │ │ └── Storage.Yaml.csproj │ │ │ ├── Storage.Spreadsheet.ClosedXml │ │ │ │ ├── .gitignore │ │ │ │ └── TestData │ │ │ │ │ └── ImportTestData.xlsx │ │ │ ├── Storage.Xml │ │ │ │ └── Storage.Xml.csproj │ │ │ ├── Storage.Plist │ │ │ │ └── Storage.Plist.csproj │ │ │ └── Storage.Json │ │ │ │ └── Storage.Json.csproj │ │ ├── Commons │ │ │ └── Commons.csproj │ │ └── Domain │ │ │ ├── Domain.csproj │ │ │ └── MidiMessages │ │ │ └── Models │ │ │ └── Values │ │ │ ├── VelocityTest.cs │ │ │ ├── NoteNumberTest.cs │ │ │ ├── StatusCodeTest.cs │ │ │ ├── ControlNumberTest.cs │ │ │ ├── MostSignificantByteTest.cs │ │ │ └── ControlValueTest.cs │ └── Runtime │ │ ├── Applications │ │ ├── Xamarin.Mac │ │ │ ├── .idea │ │ │ │ └── .idea.Applications.Xamarin.Mac │ │ │ │ │ └── .idea │ │ │ │ │ ├── .name │ │ │ │ │ ├── encodings.xml │ │ │ │ │ ├── vcs.xml │ │ │ │ │ ├── projectSettingsUpdater.xml │ │ │ │ │ ├── indexLayout.xml │ │ │ │ │ ├── misc.xml │ │ │ │ │ └── .gitignore │ │ │ ├── .gitignore │ │ │ ├── Assets.xcassets │ │ │ │ └── Contents.json │ │ │ ├── README.md │ │ │ ├── README.ja.md │ │ │ ├── Entitlements.plist │ │ │ ├── Sources │ │ │ │ ├── Main.cs │ │ │ │ └── AppDelegate.cs │ │ │ ├── Applications.Xamarin.Mac.csproj.DotSettings │ │ │ ├── Applications.Xamarin.Mac.sln │ │ │ ├── GenerateVersion.msbuild │ │ │ ├── Info.plist │ │ │ └── LICENSE │ │ ├── CLI │ │ │ ├── .gitignore │ │ │ ├── publish.bat │ │ │ ├── Sources │ │ │ │ ├── Commands │ │ │ │ │ ├── ICommandOption.cs │ │ │ │ │ ├── ICommand.cs │ │ │ │ │ ├── ExportXlsx.cs │ │ │ │ │ ├── ExportYaml.cs │ │ │ │ │ ├── ExportDawLogicArticulation.cs │ │ │ │ │ ├── ExportDawCubaseArticulation.cs │ │ │ │ │ ├── ExportDawCakewalkArticulation.cs │ │ │ │ │ └── ExportDawStudioOneArticulation.cs │ │ │ │ └── Views │ │ │ │ │ └── ConsoleLogView.cs │ │ │ ├── README.ja.md │ │ │ ├── CHANGELOG.md │ │ │ ├── README.md │ │ │ ├── publish.sh │ │ │ ├── GenerateLauncher.msbuild │ │ │ ├── GenerateVersion.msbuild │ │ │ └── LICENSE │ │ ├── WPF │ │ │ ├── .gitignore │ │ │ ├── publish.bat │ │ │ ├── Sources │ │ │ │ ├── App.xaml.cs │ │ │ │ ├── App.xaml │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── README.ja.md │ │ │ ├── README.md │ │ │ ├── Applications.WPF.csproj.DotSettings │ │ │ ├── GenerateVersion.msbuild │ │ │ ├── LICENSE │ │ │ └── WPF.sln │ │ ├── Blazor │ │ │ ├── wwwroot │ │ │ │ ├── favicon.ico │ │ │ │ ├── sample-data │ │ │ │ │ └── weather.json │ │ │ │ ├── index.html │ │ │ │ └── download.js │ │ │ ├── Pages │ │ │ │ ├── Index.razor │ │ │ │ └── Counter.razor │ │ │ ├── App.razor │ │ │ ├── _Imports.razor │ │ │ ├── Shared │ │ │ │ └── NavMenu.razor │ │ │ ├── Services │ │ │ │ └── FileDownloadService.cs │ │ │ ├── Program.cs │ │ │ ├── Applications.Blazor.csproj │ │ │ └── Properties │ │ │ │ └── launchSettings.json │ │ └── Standalone │ │ │ └── KeySwitches │ │ │ ├── ExportFormat.cs │ │ │ └── Helpers │ │ │ └── KeySwitchRepositoryFactory.cs │ │ ├── Commons │ │ ├── Data │ │ │ ├── IText.cs │ │ │ ├── IDictionaryKey.cs │ │ │ ├── IDictionaryValue.cs │ │ │ ├── IDataTranslator.cs │ │ │ ├── IDirectoryPath.cs │ │ │ ├── IDataList.cs │ │ │ ├── IDataDictionary.cs │ │ │ ├── PlainText.cs │ │ │ ├── IFilePath.cs │ │ │ ├── Count.cs │ │ │ ├── IPath.cs │ │ │ ├── Extensions │ │ │ │ └── UtcDateTimeExtension.cs │ │ │ ├── DirectoryPath.cs │ │ │ └── FilePath.cs │ │ ├── Helpers │ │ │ └── EncodingHelper.cs │ │ ├── Unit.cs │ │ └── Commons.csproj │ │ ├── Infrastructures │ │ ├── Storage.Spreadsheet.ClosedXml │ │ │ ├── Template.xlsx │ │ │ └── KeySwitches │ │ │ │ ├── Helper │ │ │ │ └── CellContext.cs │ │ │ │ ├── Translators │ │ │ │ ├── Helpers │ │ │ │ │ └── NoMoreDuplicateSheetNameException.cs │ │ │ │ └── KeySwitchClosedXmlExportTranslator.cs │ │ │ │ └── Export │ │ │ │ └── ClosedXmlExportContentFileWriterFactory.cs │ │ ├── Storage.Yaml │ │ │ ├── KeySwitches │ │ │ │ ├── Models │ │ │ │ │ ├── Aggregations │ │ │ │ │ │ ├── IMidiChannelVoiceMessageModel.cs │ │ │ │ │ │ ├── IMidiMessageModel.cs │ │ │ │ │ │ ├── MidiMessageModel.cs │ │ │ │ │ │ ├── MidiProgramChangeModel.cs │ │ │ │ │ │ ├── ArticulationModel.cs │ │ │ │ │ │ ├── MidiControlChangeModel.cs │ │ │ │ │ │ └── MidiModel.cs │ │ │ │ │ ├── YamlModel.cs │ │ │ │ │ └── Factory │ │ │ │ │ │ ├── IMidiMessageModelFactory.cs │ │ │ │ │ │ ├── IMidiChannelVoiceMessageModelFactory.cs │ │ │ │ │ │ ├── IMidiNoteOnModelFactory.cs │ │ │ │ │ │ └── IMidiControlChangeModelFactory.cs │ │ │ │ ├── Export │ │ │ │ │ ├── YamlExportContentFileWriterFactory.cs │ │ │ │ │ └── YamlExportContentFactory.cs │ │ │ │ ├── YamlFileRepository.cs │ │ │ │ ├── Import │ │ │ │ │ └── YamlImportContentReader.cs │ │ │ │ └── Translators │ │ │ │ │ └── YamlKeySwitchImportTranslator.cs │ │ │ └── Storage.Yaml.csproj │ │ ├── Storage.Spreadsheet │ │ │ ├── KeySwitches │ │ │ │ ├── Models │ │ │ │ │ ├── CellConstants.cs │ │ │ │ │ ├── Values │ │ │ │ │ │ ├── ProductNameCell.cs │ │ │ │ │ │ ├── DeveloperNameCell.cs │ │ │ │ │ │ ├── GuidCell.cs │ │ │ │ │ │ ├── InstrumentNameCell.cs │ │ │ │ │ │ ├── MidiChannelCell.cs │ │ │ │ │ │ ├── ArticulationNameCell.cs │ │ │ │ │ │ ├── MidiNoteVelocityCell.cs │ │ │ │ │ │ ├── MidiProgramChangeCell.cs │ │ │ │ │ │ ├── MidiControlChangeValueCell.cs │ │ │ │ │ │ ├── MidiControlChangeNumberCell.cs │ │ │ │ │ │ ├── AuthorCell.cs │ │ │ │ │ │ ├── DescriptionCell.cs │ │ │ │ │ │ └── MidiNoteNumberCell.cs │ │ │ │ │ ├── Workbook.cs │ │ │ │ │ └── ExtraDataCell.cs │ │ │ │ └── Helpers │ │ │ │ │ └── InvalidCellValueException.cs │ │ │ └── Storage.Spreadsheet.csproj │ │ ├── Storage.Json │ │ │ ├── KeySwitches │ │ │ │ └── Cakewalk │ │ │ │ │ ├── Models │ │ │ │ │ ├── CakewalkArticulationMap.cs │ │ │ │ │ ├── Group.cs │ │ │ │ │ └── ArticulationMap.cs │ │ │ │ │ ├── CakewalkExportContentFileWriterFactory.cs │ │ │ │ │ ├── Translators │ │ │ │ │ └── CakewalkExportTranslator.cs │ │ │ │ │ └── CakewalkExportContentFactory.cs │ │ │ └── Storage.Json.csproj │ │ ├── Storage.Xml │ │ │ ├── KeySwitches │ │ │ │ ├── StudioOne │ │ │ │ │ ├── Models │ │ │ │ │ │ ├── RootElement.cs │ │ │ │ │ │ └── ExtraDataKeys.cs │ │ │ │ │ ├── StudioOneGroupedExportPathBuilder.cs │ │ │ │ │ └── StudioOneExportContentFileWriterFactory.cs │ │ │ │ └── Cubase │ │ │ │ │ ├── Models │ │ │ │ │ ├── ExtraDataKeys.cs │ │ │ │ │ ├── IntElement.cs │ │ │ │ │ ├── FloatElement.cs │ │ │ │ │ ├── XmlClasses │ │ │ │ │ │ ├── PSlotThruTrigger.cs │ │ │ │ │ │ └── POutputEvent.cs │ │ │ │ │ ├── StringElement.cs │ │ │ │ │ ├── ListElement.cs │ │ │ │ │ └── RootElement.cs │ │ │ │ │ ├── Translators │ │ │ │ │ └── CubaseExportTranslator.cs │ │ │ │ │ ├── CubaseExportContentFileWriterFactory.cs │ │ │ │ │ └── CubaseExportContentFactory.cs │ │ │ └── Storage.Xml.csproj │ │ ├── Storage │ │ │ ├── KeySwitches │ │ │ │ ├── ExportLeaveOpenedStreamContentWriterFactory.cs │ │ │ │ ├── KeepOpenedStreamExportContentWriter.cs │ │ │ │ ├── StreamExportContentWriter.cs │ │ │ │ ├── Import │ │ │ │ │ └── FileContent.cs │ │ │ │ ├── FileExportContentWriter.cs │ │ │ │ ├── AbstractStreamExportContentWriter.cs │ │ │ │ ├── SpecificExportPathBuilder.cs │ │ │ │ ├── DefaultExportPathBuilder.cs │ │ │ │ ├── IKeySwitchFileNameFormatter.cs │ │ │ │ ├── ExportStreamContentWriterFactory.cs │ │ │ │ ├── Helper │ │ │ │ │ └── KeySwitchValidateHelper.cs │ │ │ │ └── ZipExportContentWriter.cs │ │ │ └── Storage.csproj │ │ └── Storage.Plist │ │ │ ├── KeySwitches │ │ │ └── Logic │ │ │ │ ├── Translators │ │ │ │ └── LogicExportTranslator.cs │ │ │ │ └── LogicExportContentFileWriterFactory.cs │ │ │ └── Storage.Plist.csproj │ │ ├── UseCases │ │ ├── KeySwitches │ │ │ ├── Dump │ │ │ │ ├── IDumpUseCase.cs │ │ │ │ ├── IDumpPresenter.cs │ │ │ │ ├── DumpOutputValuea.cs │ │ │ │ └── DumpOutputData.cs │ │ │ ├── Find │ │ │ │ ├── IFindUseCase.cs │ │ │ │ ├── IFindPresenter.cs │ │ │ │ ├── FindOutputData.cs │ │ │ │ ├── FindOutputValue.cs │ │ │ │ └── FindInputData.cs │ │ │ ├── Create │ │ │ │ ├── ICreateUseCase.cs │ │ │ │ ├── ICreatePresenter.cs │ │ │ │ ├── CreateInputData.cs │ │ │ │ └── CreateOutputData.cs │ │ │ ├── Delete │ │ │ │ ├── IDeleteUseCase.cs │ │ │ │ ├── DeleteOutputValue.cs │ │ │ │ ├── DeleteInputData.cs │ │ │ │ ├── DeleteInputValue.cs │ │ │ │ ├── IDeletePresenter.cs │ │ │ │ └── DeleteOutputData.cs │ │ │ ├── Import │ │ │ │ ├── IImportUseCase.cs │ │ │ │ ├── ImportInputData.cs │ │ │ │ ├── ImportOutputData.cs │ │ │ │ ├── IContent.cs │ │ │ │ ├── IImportContentReader.cs │ │ │ │ ├── ImportOutputValue.cs │ │ │ │ ├── ImportInputValue.cs │ │ │ │ └── ImportFilePresenter.cs │ │ │ └── Export │ │ │ │ ├── IExportFileUseCase.cs │ │ │ │ ├── ExportInputData.cs │ │ │ │ ├── IExportContentWriter.cs │ │ │ │ ├── IContent.cs │ │ │ │ ├── ExportOutputData.cs │ │ │ │ ├── IExportPathBuilder.cs │ │ │ │ ├── IExportStrategy.cs │ │ │ │ ├── ExportContentWriter.cs │ │ │ │ ├── ExportFilePresenter.cs │ │ │ │ ├── IExportContentFactory.cs │ │ │ │ ├── ExportInputValue.cs │ │ │ │ ├── ExportOutputValue.cs │ │ │ │ ├── IExportContentWriterFactory.cs │ │ │ │ ├── ExportPathBuilder.cs │ │ │ │ ├── BinaryContent.cs │ │ │ │ └── StringContent.cs │ │ ├── Commons │ │ │ ├── IInputPort.cs │ │ │ ├── IOutputPort.cs │ │ │ ├── IInputData.cs │ │ │ └── IOutputData.cs │ │ └── UseCases.csproj │ │ ├── Domain │ │ ├── KeySwitches │ │ │ ├── IKeySwitchRepositoryFactory.cs │ │ │ ├── Models │ │ │ │ └── Values │ │ │ │ │ ├── ExtraDataKey.cs │ │ │ │ │ ├── ArticulationName.cs │ │ │ │ │ ├── KeySwitchId.cs │ │ │ │ │ ├── ProductName.cs │ │ │ │ │ ├── DeveloperName.cs │ │ │ │ │ ├── InstrumentName.cs │ │ │ │ │ ├── GenericMidiData.cs │ │ │ │ │ ├── ExtraDataValue.cs │ │ │ │ │ ├── Author.cs │ │ │ │ │ ├── Description.cs │ │ │ │ │ ├── ExtraData.cs │ │ │ │ │ └── Extensions │ │ │ │ │ └── ExtraDataExtension.cs │ │ │ └── Helpers │ │ │ │ └── KeySwitchInfo.cs │ │ ├── MidiMessages │ │ │ └── Models │ │ │ │ ├── Values │ │ │ │ ├── MidiChannel.cs │ │ │ │ ├── MidiNoteNumber.cs │ │ │ │ ├── MidiVelocity.cs │ │ │ │ ├── MidiControlChangeNumber.cs │ │ │ │ ├── MidiControlChangeValue.cs │ │ │ │ ├── MidiLeastSignificantByte.cs │ │ │ │ ├── MidiMostSignificantByte.cs │ │ │ │ ├── MidiProgramChangeNumber.cs │ │ │ │ ├── IMidiMessageData.cs │ │ │ │ └── MidiStatus.cs │ │ │ │ ├── Aggregations │ │ │ │ ├── IMidiChannelVoiceMessage.cs │ │ │ │ ├── GenericMidiMessage.cs │ │ │ │ ├── MidiNoteOn.cs │ │ │ │ ├── MidiProgramChange.cs │ │ │ │ └── MidiControlChange.cs │ │ │ │ ├── Factory │ │ │ │ ├── IMidiMessageFactory.cs │ │ │ │ ├── IMidiChannelVoiceMessageFactory.cs │ │ │ │ └── IGenericMidiMessageFactory.cs │ │ │ │ └── Helpers │ │ │ │ └── MidiStatusHelper.cs │ │ └── Domain.csproj │ │ ├── Views │ │ ├── Views.csproj │ │ └── LogView │ │ │ └── ILogTextView.cs │ │ ├── Presenters │ │ ├── Presenters.csproj │ │ └── KeySwitches │ │ │ └── DumpPresenter.cs │ │ ├── Interactors │ │ └── Interactors.csproj │ │ └── Controllers │ │ ├── Controllers.csproj │ │ └── KeySwitches │ │ └── CreateController.cs └── .idea │ └── .idea.KeySwitchManager │ └── .idea │ ├── codeStyles │ └── codeStyleConfig.xml │ ├── vcs.xml │ ├── projectSettingsUpdater.xml │ ├── indexLayout.xml │ └── misc.xml ├── .gitignore ├── .gitattributes ├── .github └── workflows │ └── build_develop.yml ├── README.md └── LICENSE /CodeGenerators/CodeTemplate/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/files/.gitignore: -------------------------------------------------------------------------------- 1 | out/ -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/examples/.gitignore: -------------------------------------------------------------------------------- 1 | out/ -------------------------------------------------------------------------------- /KeySwitchManager/.nuget/local-packages/.gitignore: -------------------------------------------------------------------------------- 1 | !*.nupkg -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Yaml/.gitignore: -------------------------------------------------------------------------------- 1 | !*.yaml 2 | !*.yml 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | [O|o]ut/ 3 | [P|p]ublish/ 4 | [B|b]uild/ 5 | .[T|t]emp/ 6 | .org 7 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python ./gen_project.py cliapp $1 4 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/module.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python ./gen_project.py module $1 4 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/storage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python ./gen_project.py module Storage.$1 -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Spreadsheet.ClosedXml/.gitignore: -------------------------------------------------------------------------------- 1 | !*.xlsx 2 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python -m pip install pipenv 4 | pipenv sync 5 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | python -m pip install pipenv 4 | pipenv sync 5 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/simple_codegen.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | pipenv run python %~dp0\simple_codegen.py %* 4 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.bat text eol=crlf 3 | *.sh text eol=lf 4 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/.name: -------------------------------------------------------------------------------- 1 | Applications.Xamarin.Mac -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.bat text encoding=sjis eol=crlf 4 | *.sh text eol=lf 5 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/.gitignore: -------------------------------------------------------------------------------- 1 | # Automatically generated during the build and publish process 2 | /VERSION.md 3 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/.gitignore: -------------------------------------------------------------------------------- 1 | # Automatically generated during the build and publish process 2 | /VERSION.md 3 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.gitignore: -------------------------------------------------------------------------------- 1 | # Automatically generated during the build and publish process 2 | /VERSION.md 3 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/usecase.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python ./gen_project.py module UseCase.$1 4 | python ./gen_project.py module Interactor.$1 5 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/README.md: -------------------------------------------------------------------------------- 1 | # KeySwitchManager (GUI Version) 2 | 3 | ## Documents 4 | 5 | https://keyswitchmanager.readthedocs.io/ -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/README.ja.md: -------------------------------------------------------------------------------- 1 | # KeySwitchManager (GUI バージョン) 2 | 3 | ## ドキュメント 4 | 5 | https://ja-keyswitchmanager.readthedocs.io/ 6 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/usecase/request.cs: -------------------------------------------------------------------------------- 1 | namespace ${namespace} 2 | { 3 | public class ${classname} 4 | { 5 | public ${classname}() {} 6 | } 7 | } -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/usecase/response.cs: -------------------------------------------------------------------------------- 1 | namespace ${namespace} 2 | { 3 | public class ${classname} 4 | { 5 | public ${classname}() {} 6 | } 7 | } -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/files/gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | args="" 4 | 5 | for x in *.yaml ;do 6 | args="${args} ${x}" 7 | done 8 | 9 | ../simple_codegen.sh $args 10 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/publish.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | dotnet msbuild /nologo /t:Archive /p:Configuration=Release /p:PublishDir=.\publish publish.msbuild 4 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/simple_codegen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pushd `dirname $0` > /dev/null 4 | this_dir=`pwd` 5 | popd > /dev/null 6 | 7 | pipenv run python $this_dir/simple_codegen.py "${@}" -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IText.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Commons.Data 2 | { 3 | public interface IText 4 | { 5 | public string Value { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ICommandOption.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Applications.CLI.Commands 2 | { 3 | public interface ICommandOption 4 | {} 5 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-koubou/KeySwitchManager/HEAD/KeySwitchManager/Sources/Runtime/Applications/Blazor/wwwroot/favicon.ico -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/publish.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | dotnet msbuild /nologo /t:Archive /p:Configuration=Release /p:PublishDir=.\publish publish.msbuild /p:EnableArchive=true 4 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/examples/example.cs: -------------------------------------------------------------------------------- 1 | namespace ${namespace} 2 | { 3 | /// 4 | /// ${description} 5 | /// 6 | public class ${classname} 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/usecase/usecase.cs: -------------------------------------------------------------------------------- 1 | namespace ${namespace} 2 | { 3 | public interface ${classname} 4 | { 5 | public ${name}Response Execute( ${name}Request request ); 6 | } 7 | } -------------------------------------------------------------------------------- /KeySwitchManager/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IDictionaryKey.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Commons.Data 2 | { 3 | public interface IDictionaryKey 4 | { 5 | public TKey Value { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IDictionaryValue.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Commons.Data 2 | { 3 | public interface IDictionaryValue 4 | { 5 | public TValue Value { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet.ClosedXml/Template.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-koubou/KeySwitchManager/HEAD/KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet.ClosedXml/Template.xlsx -------------------------------------------------------------------------------- /KeySwitchManager/.idea/.idea.KeySwitchManager/.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ICommand.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Applications.CLI.Commands 2 | { 3 | public interface ICommand 4 | { 5 | public int Execute( ICommandOption option ); 6 | } 7 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IDataTranslator.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Commons.Data 2 | { 3 | public interface IDataTranslator 4 | { 5 | TTarget Translate( TSource source ); 6 | } 7 | } -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/examples/example.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | - PREFIX: MyPrefix 3 | - SUFFIX: _Suffix 4 | 5 | templates: 6 | - name: example 7 | path: "examples/example.cs" 8 | prefix: ${PREFIX} 9 | suffix: ${SUFFIX} 10 | -------------------------------------------------------------------------------- /KeySwitchManager/.idea/.idea.KeySwitchManager/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Dump/IDumpUseCase.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Dump 4 | { 5 | public interface IDumpUseCase : IInputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/IFindUseCase.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Find 4 | { 5 | public interface IFindUseCase : IInputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/files/gen.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal EnableDelayedExpansion 4 | 5 | for %%i in (*.yaml) do ( 6 | set LISTFILES=!LISTFILES! "%%i" 7 | ) 8 | 9 | call ..\simple_codegen.bat !LISTFILES! 10 | 11 | endlocal 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/Sources/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Applications.WPF 2 | { 3 | /// 4 | /// Interaction logic for App.xaml 5 | /// 6 | public partial class App 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/IKeySwitchRepositoryFactory.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Domain.KeySwitches 2 | { 3 | public interface IKeySwitchRepositoryFactory 4 | { 5 | public IKeySwitchRepository Create(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Dump/IDumpPresenter.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Dump 4 | { 5 | public interface IDumpPresenter : IOutputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/IFindPresenter.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Find 4 | { 5 | public interface IFindPresenter : IOutputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IDirectoryPath.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Commons.Data 2 | { 3 | public interface IDirectoryPath : IPath 4 | { 5 | bool IPath.IsFile => false; 6 | bool IPath.IsDirectory => true; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Create/ICreateUseCase.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Create 4 | { 5 | public interface ICreateUseCase : IInputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Delete/IDeleteUseCase.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Delete 4 | { 5 | public interface IDeleteUseCase : IInputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/IImportUseCase.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Import 4 | { 5 | public interface IImportUseCase : IInputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Spreadsheet.ClosedXml/TestData/ImportTestData.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/r-koubou/KeySwitchManager/HEAD/KeySwitchManager/Sources/Tests/Infrastructures/Storage.Spreadsheet.ClosedXml/TestData/ImportTestData.xlsx -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Create/ICreatePresenter.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Create 4 | { 5 | public interface ICreatePresenter : IOutputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IExportFileUseCase.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Export 4 | { 5 | public interface IExportFileUseCase : IInputPort {} 6 | } 7 | -------------------------------------------------------------------------------- /KeySwitchManager/.idea/.idea.KeySwitchManager/.idea/projectSettingsUpdater.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | pyyaml = "*" 8 | munch = "*" 9 | jsonschema = "*" 10 | 11 | [dev-packages] 12 | 13 | [requires] 14 | python_version = "3.9" 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IDataList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace KeySwitchManager.Commons.Data 4 | { 5 | public interface IDataList : IReadOnlyList 6 | { 7 | public IReadOnlyCollection ToList(); 8 | } 9 | } -------------------------------------------------------------------------------- /KeySwitchManager/.idea/.idea.KeySwitchManager/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/ExtraDataKey.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( string ) )] 6 | [NotEmpty] 7 | public partial class ExtraDataKey {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/.idea/.idea.KeySwitchManager/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/README.ja.md: -------------------------------------------------------------------------------- 1 | # KeySwitchManager (コマンドラインバージョン) 2 | 3 | ## 動作要件 4 | 5 | - Windows 10 以降 6 | - .NET Runtime 7.x 7 | - https://dotnet.microsoft.com/ja-jp/download/dotnet/7.0 8 | 9 | ## ドキュメント 10 | 11 | https://ja-keyswitchmanager.readthedocs.io/ 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/README.ja.md: -------------------------------------------------------------------------------- 1 | # KeySwitchManager (GUI バージョン) 2 | 3 | ## 動作要件 4 | 5 | - Windows 10 以降 6 | - .NET Runtime 7.x 7 | - https://dotnet.microsoft.com/ja-jp/download/dotnet/7.0 8 | 9 | ## ドキュメント 10 | 11 | https://ja-keyswitchmanager.readthedocs.io/ 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/README.md: -------------------------------------------------------------------------------- 1 | # KeySwitchManager (GUI Version) 2 | 3 | ## Requirements 4 | 5 | - Windows 10 or higher 6 | - .NET Runtime 7.x 7 | - https://dotnet.microsoft.com/ja-jp/download/dotnet/7.0 8 | 9 | 10 | ## Documents 11 | 12 | https://keyswitchmanager.readthedocs.io/ -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IDataDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace KeySwitchManager.Commons.Data 4 | { 5 | public interface IDataDictionary : IReadOnlyDictionary 6 | where TKey : notnull 7 | where TValue : notnull 8 | {} 9 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ================ 3 | 4 | ## Version 0.1.1 5 | 6 | - Supported exporting spreadsheet from DB to edit 7 | - Supported generating spreadsheet template 8 | - Bug fixes 9 | 10 | ## Version 0.1.0 11 | 12 | - 1st Release 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/README.md: -------------------------------------------------------------------------------- 1 | # KeySwitchManager (Commandline Version) 2 | 3 | ## Requirements 4 | 5 | - Windows 10 or higher 6 | - .NET Runtime 7.x 7 | - https://dotnet.microsoft.com/ja-jp/download/dotnet/7.0 8 | 9 | 10 | ## Documents 11 | 12 | https://keyswitchmanager.readthedocs.io/ -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/projectSettingsUpdater.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiChannel.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x0F )] 7 | public partial class MidiChannel : IMidiMessageData {} 8 | } 9 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiNoteNumber.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x7F )] 7 | public partial class MidiNoteNumber : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiVelocity.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x7F )] 7 | public partial class MidiVelocity : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiControlChangeNumber.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject(typeof(int))] 6 | [ValueRange(0x00,0x7F)] 7 | public partial class MidiControlChangeNumber : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiControlChangeValue.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x7F )] 7 | public partial class MidiControlChangeValue : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiLeastSignificantByte.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x7F )] 7 | public partial class MidiLeastSignificantByte : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiMostSignificantByte.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x7F )] 7 | public partial class MidiMostSignificantByte : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiProgramChangeNumber.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( 0x00, 0x7F )] 7 | public partial class MidiProgramChangeNumber : IMidiMessageData {} 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/IMidiChannelVoiceMessageModel.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 2 | { 3 | public interface IMidiChannelVoiceMessageModel : IMidiMessageModel 4 | { 5 | public int Channel { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/PlainText.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Commons.Data 4 | { 5 | [ValueObject( typeof( string ), Option = ValueOption.NonValidating )] 6 | public partial class PlainText : IText 7 | { 8 | public static IText Empty { get; } = new PlainText( "" ); 9 | } 10 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/FindOutputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Find 4 | { 5 | public sealed class FindOutputData : InputData 6 | { 7 | public FindOutputData( FindOutputValue value ) : base( value ) {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Standalone/KeySwitches/ExportFormat.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Applications.Standalone.KeySwitches 2 | { 3 | public enum ExportFormat 4 | { 5 | Yaml, 6 | Xlsx, 7 | XlsxCombined, 8 | Cubase, 9 | StudioOne, 10 | Cakewalk, 11 | Logic 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/examples/example.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | - NAME: MyClass 3 | 4 | namespace: com.example.hoge 5 | suffix: ".cs" 6 | output_dir: out/examples 7 | 8 | classes: 9 | - name: ${NAME} 10 | description: This is an example class 11 | templates: 12 | - name: example 13 | user_variables: 14 | hoge: Hoge 15 | huga: Huga 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportInputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Export 4 | { 5 | public sealed class ExportInputData : InputData 6 | { 7 | public ExportInputData( ExportInputValue value ) : base( value ) {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/ImportInputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Import 4 | { 5 | public sealed class ImportInputData : InputData 6 | { 7 | public ImportInputData( ImportInputValue value ) : base( value ) {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/.idea/.idea.Applications.Xamarin.Mac/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /modules.xml 6 | /contentModel.xml 7 | /projectSettingsUpdater.xml 8 | /.idea.Applications.Xamarin.Mac.csproj.iml 9 | # Editor-based HTTP Client requests 10 | /httpRequests/ 11 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Sources/Main.cs: -------------------------------------------------------------------------------- 1 | using AppKit; 2 | 3 | namespace KeySwitchManager.Xamarin.Mac 4 | { 5 | public static class MainClass 6 | { 7 | public static void Main( string[] args ) 8 | { 9 | NSApplication.Init(); 10 | NSApplication.Main( args ); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.github/workflows/build_develop.yml: -------------------------------------------------------------------------------- 1 | name: develop 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | paths-ignore: 8 | - "**.md" 9 | 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | uses: ./.github/workflows/build.yml 15 | secrets: inherit 16 | with: 17 | build-app-kind: "CLI, WPF" 18 | build-configuration: Debug 19 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/ArticulationName.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 4 | { 5 | /// 6 | /// An Articulation name 7 | /// 8 | [ValueObject( typeof( string ) )] 9 | [NotEmpty] 10 | public partial class ArticulationName {} 11 | } 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Aggregations/IMidiChannelVoiceMessage.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Aggregations 4 | { 5 | public interface IMidiChannelVoiceMessage : IMidiMessage 6 | { 7 | public IMidiMessageData Channel { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/CellConstants.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models 2 | { 3 | static class CellConstants 4 | { 5 | public static readonly string EmptyCellValue = string.Empty; 6 | public static readonly string NotAvailableCellValue = "n/a"; 7 | } 8 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Dump/DumpOutputValuea.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.UseCase.KeySwitches.Dump 2 | { 3 | public class DumpOutputValue 4 | { 5 | public int DumpDataCount { get; } 6 | 7 | public DumpOutputValue( int dumpDataCount ) 8 | { 9 | DumpDataCount = dumpDataCount; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace KeySwitchManager.UseCase.KeySwitches.Export 5 | { 6 | public interface IExportContentWriter 7 | { 8 | Task WriteAsync( IContent content, CancellationToken cancellationToken = default ); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/IMidiMessageModel.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 2 | { 3 | public interface IMidiMessageModel 4 | { 5 | public int Status { get; } 6 | public int Data1 { get; set; } 7 | public int Data2 { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Delete/DeleteOutputValue.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.UseCase.KeySwitches.Delete 2 | { 3 | public class DeleteOutputValue 4 | { 5 | public int RemovedCount { get; } 6 | 7 | public DeleteOutputValue( int removedCount ) 8 | { 9 | RemovedCount = removedCount; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet.ClosedXml/KeySwitches/Helper/CellContext.cs: -------------------------------------------------------------------------------- 1 | using ClosedXML.Excel; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.ClosedXml.KeySwitches.Helper 4 | { 5 | internal struct CellContext 6 | { 7 | public int RowIndex; 8 | public IXLWorksheet Sheet; 9 | public IXLRow Row; 10 | } 11 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # dotnet msbuild /nologo /t:Archive /p:Configuration=Release /p:RID=osx-x64 /p:PublishDir=./publish publish.msbuild 4 | # dotnet msbuild /nologo /t:Archive /p:Configuration=Release /p:RID=win-x64 /p:PublishDir=./publish publish.msbuild 5 | dotnet msbuild /nologo /t:Archive /p:Configuration=Release /p:PublishDir=./publish publish.msbuild 6 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/Sources/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Factory/IMidiMessageFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Aggregations; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Factory 4 | { 5 | public interface IMidiMessageFactory where TMidiMessage : IMidiMessage 6 | { 7 | public TMidiMessage Create( int status, int data1, int data2 ); 8 | } 9 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IContent.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | 4 | namespace KeySwitchManager.UseCase.KeySwitches.Export 5 | { 6 | public interface IContent 7 | { 8 | Stream GetContentStream() 9 | => GetContentStreamAsync().GetAwaiter().GetResult(); 10 | 11 | Task GetContentStreamAsync(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Dump/DumpOutputData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.UseCase.Commons; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Dump 6 | { 7 | public sealed class DumpOutputData : OutputData 8 | { 9 | public DumpOutputData( bool result, DumpOutputValue value, Exception? error = null ) : base( result, value, error ) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/KeySwitchId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 6 | { 7 | [ValueObject(typeof(Guid), Option = ValueOption.NonValidating | ValueOption.ToString)] 8 | public partial class KeySwitchId 9 | { 10 | private partial string ToStringImpl() => Value.ToString( "D" ); 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/ProductNameCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( string ) )] 6 | [NotEmpty] 7 | public partial class ProductNameCell 8 | { 9 | public static readonly ProductNameCell Empty = new("Product Name"); 10 | } 11 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportOutputData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.UseCase.Commons; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Export 6 | { 7 | public sealed class ExportOutputData : OutputData 8 | { 9 | public ExportOutputData( bool result, ExportOutputValue value, Exception? error = null ) : base( result, value, error ) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/ImportOutputData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.UseCase.Commons; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Import 6 | { 7 | public sealed class ImportOutputData : OutputData 8 | { 9 | public ImportOutputData( bool result, ImportOutputValue value, Exception? error = null ) : base( result, value, error ) {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Helpers/EncodingHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace KeySwitchManager.Commons.Helpers 4 | { 5 | public static class EncodingHelper 6 | { 7 | // ReSharper disable InconsistentNaming 8 | public static Encoding UTF8 => Encoding.UTF8; 9 | public static Encoding UTF8N { get; } = new UTF8Encoding( false ); 10 | // ReSharper restore InconsistentNaming 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/DeveloperNameCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( string ) )] 6 | [NotEmpty] 7 | public partial class DeveloperNameCell 8 | { 9 | public static readonly DeveloperNameCell Empty = new ( "Developer Name" ); 10 | } 11 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/GuidCell.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 6 | { 7 | [ValueObject(typeof(Guid), Option = ValueOption.NonValidating)] 8 | public partial class GuidCell 9 | { 10 | public static readonly GuidCell Empty = new(Guid.Empty); 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Workbook.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Aggregations; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models 6 | { 7 | public class Workbook 8 | { 9 | public readonly List Worksheets = new List(); 10 | } 11 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/ProductName.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 4 | { 5 | /// 6 | /// A ProductName name 7 | /// 8 | [ValueObject( typeof( string ) )] 9 | [NotEmpty] 10 | public partial class ProductName 11 | { 12 | public static readonly ProductName Any = new ProductName( "*" ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/InstrumentNameCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( string ) )] 6 | [NotEmpty] 7 | public partial class InstrumentNameCell 8 | { 9 | public static readonly InstrumentNameCell Empty = new("Instrument Name"); 10 | } 11 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/YamlModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models 6 | { 7 | public class YamlModel 8 | { 9 | public List KeySwitches { get; set; } = new List(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Factory/IMidiChannelVoiceMessageFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Aggregations; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Factory 4 | { 5 | public interface IMidiChannelVoiceMessageFactory 6 | where TMidiMessage : IMidiChannelVoiceMessage 7 | { 8 | public TMidiMessage Create( int channel, int data1, int data2 ); 9 | } 10 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/IMidiMessageData.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 2 | { 3 | /// 4 | /// An interface for MIDI Event data byte 5 | /// 6 | public interface IMidiMessageData 7 | { 8 | /// 9 | /// MIDI event data values presented as integer values. 10 | /// 11 | public int Value { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Delete/DeleteInputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Delete 4 | { 5 | public sealed class DeleteInputData : IInputData 6 | { 7 | public DeleteInputValue Value { get; } 8 | 9 | public DeleteInputData( DeleteInputValue value ) 10 | { 11 | Value = value; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/DeveloperName.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 4 | { 5 | /// 6 | /// A DeveloperName name 7 | /// 8 | [ValueObject( typeof( string ) )] 9 | [NotEmpty] 10 | public partial class DeveloperName 11 | { 12 | public static readonly DeveloperName Any = new DeveloperName( "*" ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/InstrumentName.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 4 | { 5 | /// 6 | /// An Instrument name 7 | /// 8 | [ValueObject( typeof( string ) )] 9 | [NotEmpty] 10 | public partial class InstrumentName 11 | { 12 | public static readonly InstrumentName Any = new InstrumentName( "*" ); 13 | } 14 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/GenericMidiData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 6 | { 7 | /// 8 | /// Generic MIDI message data. 9 | /// 10 | [ValueObject( typeof( int ) )] 11 | [ValueRange( 0x00, 0xFF )] 12 | public partial class GenericMidiData : IMidiMessageData {} 13 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/Commons/IInputPort.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace KeySwitchManager.UseCase.Commons 5 | { 6 | public interface IInputPort 7 | { 8 | void Handle( TInputData inputData ) 9 | => HandleAsync( inputData ).GetAwaiter().GetResult(); 10 | 11 | Task HandleAsync( TInputData inputData, CancellationToken cancellationToken = default ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/MidiChannelCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( MinValue, MaxValue )] 7 | public partial class MidiChannelCell 8 | { 9 | public const int MinValue = 0x00; 10 | public const int MaxValue = 0x0F; 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 | Index 4 | 5 | Hello, world! 6 | Welcome to your new app, powered by MudBlazor! 7 | You can find documentation and examples on our website here: www.mudblazor.com 8 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/ArticulationNameCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( string ) )] 6 | [NotEmpty] 7 | public partial class ArticulationNameCell 8 | { 9 | public static readonly ArticulationNameCell Empty = new ( CellConstants.NotAvailableCellValue ); 10 | } 11 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Factory/IMidiMessageModelFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Factory 4 | { 5 | public interface IMidiMessageModelFactory where TMidiMessage : IMidiMessageModel 6 | { 7 | public TMidiMessage Create( int status, int data1, int data2 ); 8 | } 9 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/Commons/IOutputPort.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace KeySwitchManager.UseCase.Commons 5 | { 6 | public interface IOutputPort 7 | { 8 | void Handle( TOutputData outputData ) 9 | => HandleAsync( outputData ).GetAwaiter().GetResult(); 10 | 11 | Task HandleAsync( TOutputData outputData, CancellationToken cancellationToken = default ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/IContent.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Import 6 | { 7 | public interface IContent 8 | { 9 | Stream GetContentStream() 10 | => GetContentStreamAsync().GetAwaiter().GetResult(); 11 | 12 | Task GetContentStreamAsync( CancellationToken cancellationToken = default ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/App.razor: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Not found 7 | 8 |

Sorry, there's nothing at this address.

9 |
10 |
11 |
-------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/MidiNoteVelocityCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( MinValue, MaxValue )] 7 | public partial class MidiNoteVelocityCell 8 | { 9 | public const int MinValue = 0x00; 10 | public const int MaxValue = 0x7F; 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/MidiProgramChangeCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( MinValue, MaxValue )] 7 | public partial class MidiProgramChangeCell 8 | { 9 | public const int MinValue = 0x00; 10 | public const int MaxValue = 0x7F; 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/Applications.WPF.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/ExtraDataValue.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( string ) )] 6 | [NotEmpty] 7 | public partial class ExtraDataValue 8 | { 9 | public static readonly ExtraDataValue Empty = new ExtraDataValue(); 10 | 11 | private ExtraDataValue() 12 | { 13 | Value = string.Empty; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/KeySwitches/Cakewalk/Models/CakewalkArticulationMap.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using Newtonsoft.Json; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk.Models 6 | { 7 | public class CakewalkArticulationMap 8 | { 9 | [JsonProperty( "ArticulationMaps")] 10 | public IList ArticulationMaps { get; set; } = new List(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/MidiControlChangeValueCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( MinValue, MaxValue )] 7 | public partial class MidiControlChangeValueCell 8 | { 9 | public const int MinValue = 0x00; 10 | public const int MaxValue = 0x7F; 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/MidiControlChangeNumberCell.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 4 | { 5 | [ValueObject( typeof( int ) )] 6 | [ValueRange( MinValue, MaxValue )] 7 | public partial class MidiControlChangeNumberCell 8 | { 9 | public const int MinValue = 0x00; 10 | public const int MaxValue = 0x7F; 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/IImportContentReader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Domain.KeySwitches.Models; 6 | 7 | namespace KeySwitchManager.UseCase.KeySwitches.Import 8 | { 9 | public interface IImportContentReader 10 | { 11 | Task> ReadAsync( IContent content, CancellationToken cancellationToken = default ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/ImportOutputValue.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.UseCase.KeySwitches.Import 2 | { 3 | public sealed class ImportOutputValue 4 | { 5 | public int InsertedCount { get; } 6 | public int UpdatedCount { get; } 7 | 8 | public ImportOutputValue( int insertedCount, int updatedCount ) 9 | { 10 | InsertedCount = insertedCount; 11 | UpdatedCount = updatedCount; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IFilePath.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace KeySwitchManager.Commons.Data 4 | { 5 | public interface IFilePath : IPath 6 | { 7 | bool IPath.IsFile => true; 8 | bool IPath.IsDirectory => true; 9 | 10 | Stream OpenStream( FileMode mode, FileAccess access ); 11 | Stream OpenReadStream(); 12 | Stream OpenWriteStream(bool overWrite = true); 13 | Stream OpenReadWriteStream(bool overWrite = true); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Applications.Xamarin.Mac.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IExportPathBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | 6 | namespace KeySwitchManager.UseCase.KeySwitches.Export 7 | { 8 | public interface IExportPathBuilder 9 | { 10 | string Suffix { get; } 11 | IDirectoryPath OutputDirectory { get; } 12 | IFilePath Build( IReadOnlyCollection keySwitches ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Create/CreateInputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | using KeySwitchManager.UseCase.KeySwitches.Export; 3 | 4 | namespace KeySwitchManager.UseCase.KeySwitches.Create 5 | { 6 | public sealed class CreateInputData : IInputData 7 | { 8 | public IExportStrategy Value { get; } 9 | 10 | public CreateInputData( IExportStrategy strategy ) 11 | { 12 | Value = strategy; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 | Counter 4 | 5 | Counter 6 | Current count: @currentCount 7 | Click me 8 | 9 | 10 | @code { 11 | private int currentCount = 0; 12 | 13 | private void IncrementCount() 14 | { 15 | currentCount++; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/Count.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Commons.Data 6 | { 7 | [ValueObject(typeof(int))] 8 | public partial class Count 9 | { 10 | private static partial int Validate( int value ) 11 | { 12 | if( value < 0 ) 13 | { 14 | throw new ArgumentException( $"value must be > 0 (={value})" ); 15 | } 16 | return value; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/ImportInputValue.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.UseCase.KeySwitches.Import 2 | { 3 | public sealed class ImportInputValue 4 | { 5 | public IImportContentReader ContentReader { get; } 6 | public IContent Content { get; } 7 | 8 | public ImportInputValue( IImportContentReader contentReader, IContent content ) 9 | { 10 | ContentReader = contentReader; 11 | Content = content; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/Author.cs: -------------------------------------------------------------------------------- 1 | using RkHelper.Primitives; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 6 | { 7 | /// 8 | /// A created author name 9 | /// 10 | [ValueObject(typeof(string))] 11 | public partial class Author 12 | { 13 | private static partial string Validate( string value ) 14 | => StringHelper.IsEmpty( value ) ? string.Empty : value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Values/MidiStatus.cs: -------------------------------------------------------------------------------- 1 | using ValueObjectGenerator; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Values 4 | { 5 | /// 6 | /// Represents a MIDI status byte 7 | /// 8 | [ValueObject( typeof( int ) )] 9 | [ValueRange( 0x00, 0xFF )] 10 | public partial class MidiStatus : IMidiMessageData 11 | { 12 | public MidiStatus( int value, MidiChannel channel ) : this( value | channel.Value ) 13 | {} 14 | } 15 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using System.Net.Http.Json 3 | @using Microsoft.AspNetCore.Components.Forms 4 | @using Microsoft.AspNetCore.Components.Routing 5 | @using Microsoft.AspNetCore.Components.Web 6 | @using Microsoft.AspNetCore.Components.Web.Virtualization 7 | @using Microsoft.AspNetCore.Components.WebAssembly.Http 8 | @using Microsoft.JSInterop 9 | @using MudBlazor 10 | @using KeySwitchManager.Applications.Blazor 11 | @using KeySwitchManager.Applications.Blazor.Shared 12 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/Sources/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Factory/IMidiChannelVoiceMessageModelFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Factory 4 | { 5 | public interface IMidiChannelVoiceMessageModelFactory 6 | where TMidiMessage : IMidiChannelVoiceMessageModel 7 | { 8 | public TMidiMessage Create( int channel, int data1, int data2 ); 9 | } 10 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/Description.cs: -------------------------------------------------------------------------------- 1 | using RkHelper.Primitives; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 6 | { 7 | /// 8 | /// A description of keyswitch 9 | /// 10 | [ValueObject( typeof( string ) )] 11 | public partial class Description 12 | { 13 | private static partial string Validate( string value ) 14 | => StringHelper.IsEmpty( value ) ? string.Empty : value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 | 2 | Home 3 | Create 4 | Counter 5 | Fetch data 6 | 7 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ExportXlsx.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | using KeySwitchManager.Applications.Standalone.KeySwitches; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Commands 6 | { 7 | public class ExportXlsx : ExportDawArticulation 8 | { 9 | [Verb( "xlsx", HelpText = "export a xlsx format from database")] 10 | public new class CommandOption : ExportDawArticulation.CommandOption 11 | {} 12 | 13 | protected override ExportFormat Format => ExportFormat.Xlsx; 14 | } 15 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ExportYaml.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | using KeySwitchManager.Applications.Standalone.KeySwitches; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Commands 6 | { 7 | public class ExportYaml : ExportDawArticulation 8 | { 9 | [Verb( "yaml", HelpText = "export a yaml format from database")] 10 | public new class CommandOption : ExportDawArticulation.CommandOption 11 | {} 12 | 13 | protected override ExportFormat Format => ExportFormat.Yaml; 14 | } 15 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/KeySwitches/Cakewalk/Models/Group.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk.Models 4 | { 5 | public class Group 6 | { 7 | [JsonProperty( "id" )] 8 | public int Id { get; } 9 | [JsonProperty( "name" )] 10 | public string Name { get; } 11 | 12 | public Group( int id, string name ) 13 | { 14 | Id = id; 15 | Name = name; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet.ClosedXml/KeySwitches/Translators/Helpers/NoMoreDuplicateSheetNameException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.ClosedXml.KeySwitches.Translators.Helpers 4 | { 5 | public class NoMoreDuplicateSheetNameException : Exception 6 | { 7 | public NoMoreDuplicateSheetNameException( string message ) : base( message ) {} 8 | public NoMoreDuplicateSheetNameException( int duplicatedCount ) : base( $"{duplicatedCount}" ) {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IExportStrategy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | using KeySwitchManager.Domain.KeySwitches.Models; 7 | 8 | namespace KeySwitchManager.UseCase.KeySwitches.Export 9 | { 10 | public interface IExportStrategy 11 | { 12 | IObservable OnExported { get; } 13 | 14 | Task ExportAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/Template.cliapp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Exe 6 | $$LANGVER$$ 7 | $$FRAMEWORK$$ 8 | $$PROJECT_NAME$$ 9 | $$PROJECT_NAME$$ 10 | $$AUTHOR$$ 11 | $$PROJECT_NAME$$ 12 | enable 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ExportDawLogicArticulation.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | using KeySwitchManager.Applications.Standalone.KeySwitches; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Commands 6 | { 7 | public class ExportDawLogicArticulation : ExportDawArticulation 8 | { 9 | [Verb( "logic", HelpText = "export to Logic format")] 10 | public new class CommandOption : ExportDawArticulation.CommandOption 11 | {} 12 | 13 | protected override ExportFormat Format => ExportFormat.Logic; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/Template.module.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $$LANGVER$$ 5 | $$FRAMEWORK$$ 6 | 7 | $$AUTHOR$$ 8 | $$AUTHOR$$ 9 | $$PROJECT_NAME$$ 10 | $$PROJECT_NAME$$ 11 | $$PROJECT_NAME$$ 12 | enable 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ExportDawCubaseArticulation.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | using KeySwitchManager.Applications.Standalone.KeySwitches; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Commands 6 | { 7 | public class ExportDawCubaseArticulation : ExportDawArticulation 8 | { 9 | [Verb( "cubase", HelpText = "export to VST Expression map format")] 10 | public new class CommandOption : ExportDawArticulation.CommandOption 11 | {} 12 | 13 | protected override ExportFormat Format => ExportFormat.Cubase; 14 | } 15 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/AuthorCell.cs: -------------------------------------------------------------------------------- 1 | using RkHelper.Primitives; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 6 | { 7 | [ValueObject( typeof( string ) )] 8 | public partial class AuthorCell 9 | { 10 | public static readonly AuthorCell Empty = new ( string.Empty ); 11 | 12 | private static partial string Validate( string value ) 13 | => StringHelper.IsEmpty( value ) ? string.Empty : value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/FindOutputValue.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Domain.KeySwitches.Models; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Find 6 | { 7 | public sealed class FindOutputValue 8 | { 9 | public IReadOnlyCollection Result { get; } 10 | public int FoundCount { get; } 11 | 12 | public FindOutputValue( IReadOnlyCollection result ) 13 | { 14 | Result = result; 15 | FoundCount = Result.Count; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ExportDawCakewalkArticulation.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | using KeySwitchManager.Applications.Standalone.KeySwitches; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Commands 6 | { 7 | public class ExportDawCakewalkArticulation : ExportDawArticulation 8 | { 9 | [Verb( "cakewalk", HelpText = "export to Cakewalk Articulation format")] 10 | public new class CommandOption : ExportDawArticulation.CommandOption 11 | {} 12 | 13 | protected override ExportFormat Format => ExportFormat.Cakewalk; 14 | } 15 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/DescriptionCell.cs: -------------------------------------------------------------------------------- 1 | using RkHelper.Primitives; 2 | 3 | using ValueObjectGenerator; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 6 | { 7 | [ValueObject( typeof( string ) )] 8 | public partial class DescriptionCell 9 | { 10 | public static readonly DescriptionCell Empty = new(string.Empty); 11 | 12 | private static partial string Validate( string value ) 13 | => StringHelper.IsEmpty( value ) ? string.Empty : value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Export 6 | { 7 | public abstract class ExportContentWriter : IExportContentWriter 8 | { 9 | private Stream Stream { get; } 10 | 11 | protected ExportContentWriter( Stream stream ) 12 | { 13 | Stream = stream; 14 | } 15 | 16 | public abstract Task WriteAsync( IContent content, CancellationToken cancellationToken = default ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "date": "2018-05-06", 4 | "temperatureC": 1, 5 | "summary": "Freezing" 6 | }, 7 | { 8 | "date": "2018-05-07", 9 | "temperatureC": 14, 10 | "summary": "Bracing" 11 | }, 12 | { 13 | "date": "2018-05-08", 14 | "temperatureC": -13, 15 | "summary": "Freezing" 16 | }, 17 | { 18 | "date": "2018-05-09", 19 | "temperatureC": -16, 20 | "summary": "Balmy" 21 | }, 22 | { 23 | "date": "2018-05-10", 24 | "temperatureC": -2, 25 | "summary": "Chilly" 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Commands/ExportDawStudioOneArticulation.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | using KeySwitchManager.Applications.Standalone.KeySwitches; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Commands 6 | { 7 | public class ExportDawStudioOneArticulation : ExportDawArticulation 8 | { 9 | [Verb( "studio-one", HelpText = "export to Studio One 5 Sound Variations format")] 10 | public new class CommandOption : ExportDawArticulation.CommandOption 11 | {} 12 | 13 | protected override ExportFormat Format => ExportFormat.StudioOne; 14 | } 15 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/ExtraDataCell.cs: -------------------------------------------------------------------------------- 1 | using RkHelper.Primitives; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models 4 | { 5 | public class ExtraDataCell 6 | { 7 | public static readonly ExtraDataCell Empty 8 | = new ExtraDataCell( CellConstants.NotAvailableCellValue ); 9 | 10 | public string Value { get; } 11 | 12 | public ExtraDataCell( string name ) 13 | { 14 | Value = StringHelper.IsEmpty( name ) ? string.Empty : name; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Delete/DeleteInputValue.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.UseCase.KeySwitches.Delete 2 | { 3 | public class DeleteInputValue 4 | { 5 | public string DeveloperName { get; } 6 | public string ProductName { get; } 7 | public string InstrumentName { get; } 8 | 9 | public DeleteInputValue( string developerName, string productName, string instrumentName ) 10 | { 11 | DeveloperName = developerName; 12 | ProductName = productName; 13 | InstrumentName = instrumentName; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Yaml/KeySwitches/TestData/ImportTestData.yaml: -------------------------------------------------------------------------------- 1 | KeySwitches: 2 | - Id: ba6252a7-57b0-486f-87ad-cf1ed871b530 3 | Author: Author 4 | Description: Description 5 | Created: 2023-10-29T17:20:49.2450000 6 | LastUpdated: 2023-10-29T17:20:49.2450000 7 | DeveloperName: DeveloperName 8 | ProductName: Product 9 | InstrumentName: E.Guitar 10 | Articulations: 11 | - Name: Power Chord 12 | MidiMessage: 13 | NoteOn: [] 14 | ControlChange: [] 15 | ProgramChange: [] 16 | ExtraData: 17 | extKey: extValue 18 | ExtraData: 19 | extKey: extValue 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Delete/IDeletePresenter.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | using KeySwitchManager.UseCase.Commons; 5 | 6 | namespace KeySwitchManager.UseCase.KeySwitches.Delete 7 | { 8 | public interface IDeletePresenter : IOutputPort 9 | { 10 | public void HandleDeleteBegin( DeleteInputData inputData ) 11 | => HandleDeleteBeginAsync( inputData ).GetAwaiter().GetResult(); 12 | 13 | public Task HandleDeleteBeginAsync( DeleteInputData inputData, CancellationToken cancellationToken = default ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/StudioOne/Models/RootElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.StudioOne.Models 5 | { 6 | [XmlRoot( ElementName = "Music.KeySwitchList" )] 7 | public class RootElement 8 | { 9 | [XmlElement( ElementName = "Attributes" )] 10 | public List AttributeElements { get; set; } = new(); 11 | 12 | [XmlAttribute( AttributeName = "name" )] 13 | public string Name { get; set; } = string.Empty; 14 | } 15 | } -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/usecase/usecase.yaml: -------------------------------------------------------------------------------- 1 | templates: 2 | - name: usecase 3 | path: "usecase/usecase.cs" 4 | prefix: I 5 | suffix: UseCase 6 | 7 | - name: usecase.request 8 | path: "usecase/request.cs" 9 | prefix: "" 10 | suffix: Request 11 | 12 | - name: usecase.response 13 | path: "usecase/response.cs" 14 | prefix: "" 15 | suffix: Response 16 | 17 | - name: usecase.presenter 18 | path: "usecase/presenter.cs" 19 | prefix: "" 20 | suffix: Presenter 21 | 22 | - name: usecase.interactor 23 | path: "usecase/interactor.cs" 24 | prefix: "" 25 | suffix: Interactor 26 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/StudioOne/StudioOneGroupedExportPathBuilder.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | 4 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.StudioOne 5 | { 6 | public sealed class StudioOneGroupedExportPathBuilder : GroupedExportPathBuilder 7 | { 8 | public StudioOneGroupedExportPathBuilder() : this( DirectoryPath.Default ) {} 9 | 10 | public StudioOneGroupedExportPathBuilder( IDirectoryPath outputDirectory ) : base( ".keyswitch", outputDirectory ) {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportFilePresenter.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | using KeySwitchManager.UseCase.Commons; 6 | 7 | namespace KeySwitchManager.UseCase.KeySwitches.Export 8 | { 9 | public interface IExportPresenter : IOutputPort 10 | { 11 | void HandleExported( KeySwitch exported ) 12 | => HandleExportedAsync( exported ).GetAwaiter().GetResult(); 13 | 14 | Task HandleExportedAsync( KeySwitch exported, CancellationToken cancellationToken = default ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IExportContentFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Domain.KeySwitches.Models; 6 | 7 | namespace KeySwitchManager.UseCase.KeySwitches.Export 8 | { 9 | public interface IExportContentFactory 10 | { 11 | IContent Create( IReadOnlyCollection keySwitches ) 12 | => CreateAsync( keySwitches ).GetAwaiter().GetResult(); 13 | 14 | Task CreateAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Import/ImportFilePresenter.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | using KeySwitchManager.UseCase.Commons; 6 | 7 | namespace KeySwitchManager.UseCase.KeySwitches.Import 8 | { 9 | public interface IImportFilePresenter : IOutputPort 10 | { 11 | void HandleImported( KeySwitch keySwitch ) 12 | => HandleImportedAsync( keySwitch ).GetAwaiter().GetResult(); 13 | 14 | Task HandleImportedAsync( KeySwitch keySwitch, CancellationToken cancellationToken = default ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/ExportLeaveOpenedStreamContentWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 4 | { 5 | public sealed class ExportLeaveOpenedStreamContentWriterFactory : ExportStreamContentWriterFactory 6 | { 7 | public ExportLeaveOpenedStreamContentWriterFactory( Stream targetStream ) : base( targetStream ) {} 8 | 9 | protected override AbstractStreamExportContentWriter CreateStreamExportContentWriterImpl() 10 | { 11 | return new KeepOpenedStreamExportContentWriter( TargetStream ); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [日本語](README.ja.md) 2 | 3 | # KeySwitchManager 4 | 5 | KeySwitchManager is a tool that specializes in creating keyswitch definition files for multiple DAWs, allowing keyswitch information to be edited in text and spreadsheets, and managed in local database files. 6 | 7 | Usage and more information. 8 | 9 | - [Documentation](https://keyswitchmanager.readthedocs.io/) 10 | 11 | 12 | 13 | ## Japanese 14 | 15 | KeySwitchManager は複数のDAW用キースイッチ定義ファイル作成に特化した、キースイッチ情報をテキストやスプレッドシートで編集、ローカルデータベースファイルで管理可能なツール。 16 | 17 | 使い方など、詳しい情報はこちら 18 | 19 | - [ドキュメント](https://ja-keyswitchmanager.readthedocs.io/) 20 | 21 | 22 | 23 | ## License 24 | 25 | [MIT](LICENSE) 26 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Services/FileDownloadService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.JSInterop; 2 | 3 | namespace KeySwitchManager.Applications.Blazor.Services; 4 | 5 | public class FileDownloadService 6 | { 7 | private readonly IJSRuntime jsRuntime; 8 | 9 | public FileDownloadService( IJSRuntime jsRuntime ) 10 | { 11 | this.jsRuntime = jsRuntime; 12 | } 13 | 14 | public async Task TriggerDownloadAsync( byte[] byteArray, string fileName ) 15 | { 16 | var base64Data = Convert.ToBase64String( byteArray ); 17 | await jsRuntime.InvokeVoidAsync( "downloadFromByteArray", base64Data, fileName ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Plist/KeySwitches/Logic/Translators/LogicExportTranslator.cs: -------------------------------------------------------------------------------- 1 | using Claunia.PropertyList; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | using KeySwitchManager.Infrastructures.Storage.Plist.KeySwitches.Logic.Translators.Helpers; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.Plist.KeySwitches.Logic.Translators 8 | { 9 | public class LogicExportTranslator : IDataTranslator 10 | { 11 | public NSDictionary Translate( KeySwitch source ) 12 | => TranslateModelHelper.Translate( source ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Helpers/InvalidCellValueException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Helpers 4 | { 5 | public class InvalidCellValueException : Exception 6 | { 7 | public InvalidCellValueException() 8 | {} 9 | 10 | public InvalidCellValueException( int rowIndex, string columnLabel ) 11 | : base( $"Row:{rowIndex}, Column:{columnLabel} is invalid." ) 12 | { 13 | } 14 | 15 | public InvalidCellValueException( string message ) : base( message ) 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Delete/DeleteOutputData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.UseCase.Commons; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Delete 6 | { 7 | public sealed class DeleteOutputData : IOutputData 8 | { 9 | public bool Result { get; } 10 | public DeleteOutputValue Value { get; } 11 | public Exception? Error { get; } 12 | 13 | public DeleteOutputData( bool result, DeleteOutputValue value, Exception? error ) 14 | { 15 | Result = result; 16 | Value = value; 17 | Error = error; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CodeGenerators/ProjectTemplate/Template.module.Testing.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $$LANGVER$$ 5 | $$FRAMEWORK$$ 6 | $$PROJECT_NAME$$ 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportInputValue.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.UseCase.KeySwitches.Export 2 | { 3 | public sealed class ExportInputValue 4 | { 5 | public string DeveloperName { get; } 6 | public string ProductName { get; } 7 | public string InstrumentName { get; } 8 | 9 | public ExportInputValue( 10 | string developerName = "", 11 | string productName = "", 12 | string instrumentName = "" ) 13 | { 14 | DeveloperName = developerName; 15 | ProductName = productName; 16 | InstrumentName = instrumentName; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Helpers/MidiStatusHelper.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Domain.MidiMessages.Models.Helpers 2 | { 3 | public static class MidiStatusHelper 4 | { 5 | #region Presets 6 | public const int NoteOn = 0x90; 7 | public const int ControlChange = 0xB0; 8 | public const int ProgramChange = 0xC0; 9 | #endregion 10 | 11 | public static int MakeStatus( int status, int channel ) 12 | { 13 | return status | ( channel & 0x0F ); 14 | } 15 | 16 | public static int GetChannel( int status ) 17 | { 18 | return status & 0x0F; 19 | } 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/IPath.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Commons.Data 2 | { 3 | public interface IPath 4 | { 5 | public string Path { get; } 6 | public bool Exists { get; } 7 | public bool IsFile { get; } 8 | public bool IsDirectory { get; } 9 | public void CreateNew() {} 10 | 11 | public class Null : IPath 12 | { 13 | public string Path { get; } = string.Empty; 14 | public bool Exists { get; } = false; 15 | public bool IsFile { get; } = false; 16 | public bool IsDirectory { get; } = false; 17 | public void CreateNew() 18 | {} 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/ExtraDataKeys.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.KeySwitches.Models.Values; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models 4 | { 5 | public static class ExtraDataKeys 6 | { 7 | public static readonly ExtraDataKey SlotName = new ExtraDataKey( "Cubase.Slot" ); 8 | public static readonly ExtraDataKey ColorIndex = new ExtraDataKey( "Cubase.Color" ); 9 | public static readonly ExtraDataKey GroupIndex = new ExtraDataKey( "Cubase.Group" ); 10 | public static readonly ExtraDataKey ArticulationType = new ExtraDataKey( "Cubase.ArticulationType" ); 11 | } 12 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Views/Views.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Views 10 | KeySwitchManager.Views 11 | KeySwitchManager.Views 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Create/CreateOutputData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.KeySwitches.Models; 4 | using KeySwitchManager.UseCase.Commons; 5 | 6 | namespace KeySwitchManager.UseCase.KeySwitches.Create 7 | { 8 | public sealed class CreateOutputData : IOutputData 9 | { 10 | public bool Result { get; } 11 | public KeySwitch Value { get; } 12 | public Exception? Error { get; } 13 | 14 | public CreateOutputData( bool result, KeySwitch response, Exception? error ) 15 | { 16 | Result = result; 17 | Value = response; 18 | Error = error; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/KeepOpenedStreamExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 4 | { 5 | public class KeepOpenedStreamExportContentWriter : AbstractStreamExportContentWriter 6 | { 7 | private Stream TargetStream { get; } 8 | 9 | public KeepOpenedStreamExportContentWriter( Stream targetStream ) 10 | { 11 | TargetStream = targetStream; 12 | } 13 | 14 | protected override Stream OpenStream() 15 | { 16 | return TargetStream; 17 | } 18 | 19 | protected override void DisposeStream( Stream stream ) {} 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/UseCases.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.UseCase 10 | KeySwitchManager.UseCase 11 | KeySwitchManager.UseCase 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportOutputValue.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Domain.KeySwitches.Models; 4 | 5 | namespace KeySwitchManager.UseCase.KeySwitches.Export 6 | { 7 | public class ExportOutputValue 8 | { 9 | public ExportInputValue Input { get; } 10 | public IReadOnlyCollection Result { get; } 11 | public int WrittenCount { get; } 12 | 13 | public ExportOutputValue( ExportInputValue input, IReadOnlyCollection result ) 14 | { 15 | Input = input; 16 | Result = result; 17 | WrittenCount = result.Count; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/IExportContentWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Domain.KeySwitches.Models; 6 | 7 | namespace KeySwitchManager.UseCase.KeySwitches.Export 8 | { 9 | public interface IExportContentWriterFactory 10 | { 11 | IExportContentWriter Create( IReadOnlyCollection keySwitches, bool leaveOpenStream = false ) 12 | => CreateAsync( keySwitches ).GetAwaiter().GetResult(); 13 | 14 | Task CreateAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Domain.KeySwitches 10 | KeySwitchManager.Domain 11 | KeySwitchManager.Domain 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/MidiMessageModel.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 2 | { 3 | public class MidiMessageModel : IMidiMessageModel 4 | { 5 | public int Status { get; } 6 | 7 | public int Data1 { get; set; } 8 | 9 | public int Data2 { get; set; } 10 | 11 | public MidiMessageModel() 12 | {} 13 | 14 | public MidiMessageModel( 15 | int status, 16 | int data1, 17 | int data2 ) 18 | { 19 | Status = status; 20 | Data1 = data1; 21 | Data2 = data2; 22 | } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Program.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Applications.Blazor; 2 | using KeySwitchManager.Applications.Blazor.Services; 3 | 4 | using Microsoft.AspNetCore.Components.Web; 5 | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; 6 | 7 | using MudBlazor.Services; 8 | 9 | var builder = WebAssemblyHostBuilder.CreateDefault(args); 10 | builder.RootComponents.Add("#app"); 11 | builder.RootComponents.Add("head::after"); 12 | 13 | builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 14 | builder.Services.AddMudServices(); 15 | 16 | builder.Services.AddScoped(); 17 | 18 | await builder.Build().RunAsync(); 19 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/Extensions/UtcDateTimeExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeySwitchManager.Commons.Data.Extensions 4 | { 5 | public static class UtcDateTimeExtension 6 | { 7 | public static DateTime As( this UtcDateTime utcDateTime ) 8 | { 9 | return new DateTime( 10 | kind: DateTimeKind.Utc, 11 | year: utcDateTime.Year, 12 | month: utcDateTime.Month, 13 | day: utcDateTime.Day, 14 | hour: utcDateTime.Hour, 15 | minute: utcDateTime.Minute, 16 | second: utcDateTime.Second, 17 | millisecond: utcDateTime.MilliSecond 18 | ); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/ExtraData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using KeySwitchManager.Commons.Data; 6 | 7 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values 8 | { 9 | public class ExtraData : DataDictionary, IEquatable 10 | { 11 | public ExtraData() 12 | {} 13 | 14 | public ExtraData( IReadOnlyDictionary dictionary ) 15 | : base( dictionary ) 16 | {} 17 | 18 | public bool Equals( ExtraData? other ) 19 | { 20 | return other != null && other.Dictionary.SequenceEqual( Dictionary ); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/KeySwitches/Models/Values/MidiNoteNumberCell.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Helpers; 4 | 5 | using ValueObjectGenerator; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.KeySwitches.Models.Values 8 | { 9 | [ValueObject( typeof( string ) )] 10 | public partial class MidiNoteNumberCell 11 | { 12 | private static partial string Validate( string value ) 13 | { 14 | if( !MidiNoteNameHelper.Contains( value ) ) 15 | { 16 | throw new ArgumentException( nameof( value ) ); 17 | } 18 | 19 | return value; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/Commons/IInputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.Commons 4 | { 5 | public interface IInputData 6 | { 7 | TData Value { get; } 8 | } 9 | 10 | public abstract class InputData : IInputData 11 | { 12 | public virtual TData Value { get; } 13 | 14 | protected InputData( TData value ) 15 | { 16 | Value = value; 17 | } 18 | } 19 | 20 | public sealed class UnitInputData : IInputData 21 | { 22 | public static readonly UnitInputData Default = new(); 23 | 24 | public Unit Value => Unit.Default; 25 | 26 | private UnitInputData() {} 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/usecase/presenter.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace ${namespace} 4 | { 5 | public interface I${name}Presenter : IPresenter<${name}Response> 6 | { 7 | public class Null : I${name}Presenter 8 | { 9 | public void Complete( ${name}Response response ) 10 | {} 11 | } 12 | 13 | public class Console : I${name}Presenter 14 | { 15 | public void Present( T param ) 16 | { 17 | System.Console.WriteLine( param ); 18 | } 19 | 20 | public void Message( string message ) 21 | { 22 | System.Console.WriteLine( message ); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/DirectoryPath.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace KeySwitchManager.Commons.Data 4 | { 5 | public class DirectoryPath : IDirectoryPath 6 | { 7 | public static DirectoryPath Default { get; } = new DirectoryPath( "." ); 8 | 9 | public string Path { get; } 10 | public bool Exists => Directory.Exists( Path ); 11 | 12 | public DirectoryPath( string path ) 13 | { 14 | Path = path; 15 | } 16 | 17 | public void CreateNew() 18 | { 19 | if( !Exists ) 20 | { 21 | Directory.CreateDirectory( Path ); 22 | } 23 | } 24 | 25 | public override string ToString() => Path; 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/schema/template_info.yaml: -------------------------------------------------------------------------------- 1 | $schema: "http://json-schema.org/draft-07/schema#" 2 | $ref: "#/definitions/root" 3 | 4 | definitions: 5 | root: 6 | type: object 7 | properties: 8 | variables: 9 | type: array 10 | default: [] 11 | templates: 12 | type: array 13 | items: 14 | $ref: "#/definitions/TemplateInfo" 15 | required: 16 | - templates 17 | 18 | TemplateInfo: 19 | type: object 20 | properties: 21 | name: 22 | type: string 23 | path: 24 | type: string 25 | prefix: 26 | type: string 27 | default: "" 28 | suffix: 29 | type: string 30 | default: "" 31 | required: 32 | - name 33 | - path 34 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Translators/CubaseExportTranslator.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Domain.KeySwitches.Models; 3 | using KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Translators.Helpers; 4 | 5 | using RkHelper.Text.Xml; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Translators 8 | { 9 | public class CubaseExportTranslator : IDataTranslator 10 | { 11 | public IText Translate( KeySwitch source ) 12 | { 13 | var rootElement = TranslateModelHelper.TranslateRootElement( source ); 14 | return new PlainText( XmlHelper.ToXmlString( rootElement ) ); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/StreamExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | using RkHelper.System; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 6 | { 7 | public class StreamExportContentWriter : AbstractStreamExportContentWriter 8 | { 9 | private Stream TargetStream { get; } 10 | 11 | public StreamExportContentWriter( Stream targetStream ) 12 | { 13 | TargetStream = targetStream; 14 | } 15 | 16 | protected override Stream OpenStream() 17 | { 18 | return TargetStream; 19 | } 20 | 21 | protected override void DisposeStream( Stream stream ) 22 | { 23 | Disposer.Dispose( stream ); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Presenters/Presenters.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Presenters 10 | KeySwitchManager.Presenters 11 | KeySwitchManager.Presenters 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/Import/FileContent.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Commons.Data; 6 | using KeySwitchManager.UseCase.KeySwitches.Import; 7 | 8 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches.Import 9 | { 10 | public class FileContent : IContent 11 | { 12 | private IFilePath FilePath { get; } 13 | 14 | public FileContent( IFilePath filePath ) 15 | { 16 | FilePath = filePath; 17 | } 18 | 19 | public Task GetContentStreamAsync( CancellationToken cancellationToken = default ) 20 | { 21 | return Task.FromResult( FilePath.OpenReadStream() ); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Commons/Commons.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | net6.0 6 | KeySwitchManager.Testing.Commons 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Unit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeySwitchManager.Commons 4 | { 5 | [Serializable] 6 | public sealed class Unit : IEquatable 7 | { 8 | public static readonly Unit Default = new(); 9 | 10 | private Unit() {} 11 | 12 | public bool Equals( Unit _ ) 13 | => true; 14 | 15 | public override bool Equals( object? obj ) 16 | => ReferenceEquals( this, obj ) || obj is Unit other && Equals( other ); 17 | 18 | public override int GetHashCode() 19 | => 1; 20 | 21 | public static bool operator ==( Unit? left, Unit? right ) 22 | => true; 23 | 24 | public static bool operator !=( Unit? left, Unit? right ) 25 | => !( left == right ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Aggregations/GenericMidiMessage.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Aggregations 4 | { 5 | /// 6 | /// Generic MIDI Event. 7 | /// 8 | public class GenericMidiMessage : IMidiMessage 9 | { 10 | public IMidiMessageData Status { get; } 11 | public IMidiMessageData DataByte1 { get; } 12 | public IMidiMessageData DataByte2 { get; } 13 | 14 | public GenericMidiMessage( 15 | IMidiMessageData status, 16 | IMidiMessageData data1, 17 | IMidiMessageData data2 ) 18 | { 19 | Status = status; 20 | DataByte1 = data1; 21 | DataByte2 = data2; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Applications.Blazor.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | KeySwitchManager.Applications.Blazor 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/IntElement.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Xml.Serialization; 3 | 4 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models 5 | { 6 | [XmlRoot( ElementName = "int" )] 7 | public class IntElement 8 | { 9 | [XmlAttribute( AttributeName = "name" )] 10 | public string Name { get; set; } = string.Empty; 11 | 12 | [XmlAttribute( AttributeName = "value" )] 13 | public int Value { get; set; } 14 | 15 | [SuppressMessage( "ReSharper", "UnusedMember.Global" )] 16 | public IntElement() 17 | {} 18 | 19 | public IntElement( string name, int value ) 20 | { 21 | Name = name; 22 | Value = value; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/FileExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | 5 | using RkHelper.System; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 8 | { 9 | public class FileExportContentWriter : AbstractStreamExportContentWriter 10 | { 11 | private IFilePath OutputPath { get; } 12 | 13 | public FileExportContentWriter( IFilePath outputPath ) 14 | { 15 | OutputPath = outputPath; 16 | } 17 | 18 | protected override Stream OpenStream() 19 | { 20 | return OutputPath.OpenWriteStream(); 21 | } 22 | 23 | protected override void DisposeStream( Stream stream ) 24 | { 25 | Disposer.Dispose( stream ); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/Storage.Xml.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Storage.Xml 10 | KeySwitchManager.Infrastructures.Storage.Xml 11 | KeySwitchManager.Infrastructures.Storage.Xml 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/FloatElement.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Xml.Serialization; 3 | 4 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models 5 | { 6 | [XmlRoot( ElementName = "float" )] 7 | public class FloatElement 8 | { 9 | [XmlAttribute( AttributeName = "name" )] 10 | public string Name { get; set; } = string.Empty; 11 | 12 | [XmlAttribute( AttributeName = "value" )] 13 | public float Value { get; set; } 14 | 15 | [SuppressMessage( "ReSharper", "UnusedMember.Global" )] 16 | public FloatElement() 17 | {} 18 | 19 | public FloatElement( string name, float value ) 20 | { 21 | Name = name; 22 | Value = value; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Models/Values/Extensions/ExtraDataExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Models.Values.Extensions 4 | { 5 | public static class ExtraDataExtension 6 | { 7 | 8 | public static void KeyWithIndexCount( this ExtraData extraData, ExtraDataKey prefix, Action notify, int startIndex = 1, int endIndex = int.MaxValue ) 9 | { 10 | for( var i = startIndex; i < endIndex; i++ ) 11 | { 12 | var key = new ExtraDataKey( $"{prefix.Value}{i}" ); 13 | 14 | if( !extraData.ContainsKey( key ) ) 15 | { 16 | break; 17 | } 18 | 19 | notify.Invoke( key, extraData[ key ], i ); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Interactors/Interactors.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Interactor 10 | KeySwitchManager.Interactors 11 | KeySwitchManager.Interactors 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Export/YamlExportContentFileWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | using KeySwitchManager.UseCase.KeySwitches.Export; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Export 6 | { 7 | public sealed class YamlExportContentFileWriterFactory : KeySwitchExportContentFileWriterFactory 8 | { 9 | public YamlExportContentFileWriterFactory() : base( ".yaml" ) {} 10 | 11 | public YamlExportContentFileWriterFactory( IDirectoryPath outputDirectory ) 12 | : base( new DefaultExportPathBuilder( ".yaml", outputDirectory ) ) {} 13 | 14 | public YamlExportContentFileWriterFactory( IExportPathBuilder pathBuilder ) 15 | : base( pathBuilder ) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | net6.0 6 | KeySwitchManager.Testing.Domain 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Plist/KeySwitches/Logic/LogicExportContentFileWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | using KeySwitchManager.UseCase.KeySwitches.Export; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Plist.KeySwitches.Logic 6 | { 7 | public sealed class LogicExportContentFileWriterFactory : KeySwitchExportContentFileWriterFactory 8 | { 9 | public LogicExportContentFileWriterFactory() : base( ".plist" ) {} 10 | 11 | public LogicExportContentFileWriterFactory( IDirectoryPath outputDirectory ) 12 | : base( new DefaultExportPathBuilder( ".plist", outputDirectory ) ) {} 13 | 14 | public LogicExportContentFileWriterFactory( IExportPathBuilder pathBuilder ) 15 | : base( pathBuilder ) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/XmlClasses/PSlotThruTrigger.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models.XmlClasses 2 | { 3 | public static class PSlotThruTrigger 4 | { 5 | public static ObjectElement New() 6 | { 7 | #if false 8 | 9 | 10 | 11 | 12 | #endif 13 | var obj = new ObjectElement( "PSlotThruTrigger" ) 14 | { 15 | Name = "remote" 16 | }; 17 | 18 | obj.Int.Add( new IntElement( "status", 144 ) ); 19 | obj.Int.Add( new IntElement( "data1", -1 ) ); 20 | 21 | return obj; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/ExportPathBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | 6 | namespace KeySwitchManager.UseCase.KeySwitches.Export 7 | { 8 | public abstract class ExportPathBuilder : IExportPathBuilder 9 | { 10 | public string Suffix { get; } 11 | public IDirectoryPath OutputDirectory { get; } 12 | 13 | protected ExportPathBuilder( string suffix ) : this( suffix, DirectoryPath.Default ) {} 14 | protected ExportPathBuilder( string suffix, IDirectoryPath outputDirectory ) 15 | { 16 | Suffix = suffix; 17 | OutputDirectory = outputDirectory; 18 | } 19 | 20 | public abstract IFilePath Build( IReadOnlyCollection keySwitches ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Standalone/KeySwitches/Helpers/KeySwitchRepositoryFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | using KeySwitchManager.Domain.KeySwitches; 5 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches; 6 | 7 | namespace KeySwitchManager.Applications.Standalone.KeySwitches.Helpers 8 | { 9 | public static class KeySwitchRepositoryFactory 10 | { 11 | public static IKeySwitchRepository CreateFileRepository(string filePath) 12 | { 13 | var path = filePath.ToLower(); 14 | 15 | if( path.EndsWith( ".yaml" ) || path.EndsWith( ".yml" ) ) 16 | { 17 | return new YamlFileRepository( new FilePath( filePath ) ); 18 | } 19 | 20 | throw new ArgumentException( $"{filePath} is unknown file format" ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Controllers/Controllers.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Controllers 10 | KeySwitchManager.Controllers 11 | KeySwitchManager.Controllers 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet/Storage.Spreadsheet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Storage.Spreadsheet 10 | KeySwitchManager.Infrastructures.Storage.Spreadsheet 11 | KeySwitchManager.Infrastructures.Storage.Spreadsheet 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/CubaseExportContentFileWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | using KeySwitchManager.UseCase.KeySwitches.Export; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase 6 | { 7 | public sealed class CubaseExportContentFileWriterFactory : KeySwitchExportContentFileWriterFactory 8 | { 9 | public CubaseExportContentFileWriterFactory() : base( ".expressionmap" ) {} 10 | 11 | public CubaseExportContentFileWriterFactory( IDirectoryPath outputDirectory ) 12 | : base( new DefaultExportPathBuilder( ".expressionmap", outputDirectory ) ) {} 13 | 14 | public CubaseExportContentFileWriterFactory( IExportPathBuilder pathBuilder ) 15 | : base( pathBuilder ) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/KeySwitches/Cakewalk/CakewalkExportContentFileWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | using KeySwitchManager.UseCase.KeySwitches.Export; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk 6 | { 7 | public sealed class CakewalkExportContentFileWriterFactory : KeySwitchExportContentFileWriterFactory 8 | { 9 | public CakewalkExportContentFileWriterFactory() : base( ".artmap" ) {} 10 | 11 | public CakewalkExportContentFileWriterFactory( IDirectoryPath outputDirectory ) 12 | : base( new DefaultExportPathBuilder( ".artmap", outputDirectory ) ) {} 13 | 14 | public CakewalkExportContentFileWriterFactory( IExportPathBuilder pathBuilder ) 15 | : base( pathBuilder ) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/YamlFileRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | using KeySwitchManager.Commons.Data; 5 | 6 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches 7 | { 8 | public sealed class YamlFileRepository : YamlMemoryRepository 9 | { 10 | private FilePath YamlFilePath { get; } 11 | public YamlFileRepository( FilePath filePath ) : base( filePath.OpenReadStream() ) 12 | { 13 | YamlFilePath = filePath; 14 | } 15 | 16 | public override async Task FlushAsync( CancellationToken cancellationToken = default ) 17 | { 18 | await using var stream = YamlFilePath.OpenWriteStream(); 19 | await WriteBinaryToAsync( stream, cancellationToken ); 20 | return Count(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Plist/Storage.Plist.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Storage.Plist 10 | KeySwitchManager.Infrastructures.Storage.Plist 11 | KeySwitchManager.Infrastructures.Storage.Plist 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/Storage.Yaml.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Storage.Yaml 10 | KeySwitchManager.Infrastructures.Storage.Yaml 11 | KeySwitchManager.Infrastructures.Storage.Yaml 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/Storage.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Storage 10 | KeySwitchManager.Infrastructures.Storage 11 | KeySwitchManager.Infrastructures.Storage 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Find/FindInputData.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.UseCase.Commons; 2 | 3 | namespace KeySwitchManager.UseCase.KeySwitches.Find 4 | { 5 | public sealed class FindInputValue 6 | { 7 | public string DeveloperName { get; } 8 | public string ProductName { get; } 9 | public string InstrumentName { get; } 10 | 11 | public FindInputValue( 12 | string developerName = "", 13 | string productName = "", 14 | string instrumentName = "" ) 15 | { 16 | DeveloperName = developerName; 17 | ProductName = productName; 18 | InstrumentName = instrumentName; 19 | } 20 | } 21 | 22 | public sealed class FindInputData : InputData 23 | { 24 | public FindInputData( FindInputValue value ) : base( value ) {} 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Views/LogView/ILogTextView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace KeySwitchManager.Views.LogView 4 | { 5 | public interface ILogTextView 6 | { 7 | static readonly ILogTextView Null = new NullImpl(); 8 | 9 | bool AutoScroll { get; set; } 10 | 11 | void Append( string text ); 12 | void AppendError( string text ); 13 | void AppendError( Exception exception ); 14 | void Clear(); 15 | void ScrollToEnd(); 16 | 17 | private class NullImpl : ILogTextView 18 | { 19 | public bool AutoScroll { get; set; } 20 | 21 | public void Append( string text ) {} 22 | public void AppendError( string text ) {} 23 | public void AppendError( Exception exception ) {} 24 | public void Clear() {} 25 | public void ScrollToEnd() {} 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/GenerateLauncher.msbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #/bin/bash 6 | pushd `dirname $0` > /dev/null 7 | this_dir=`pwd` 8 | popd > /dev/null 9 | dotnet $this_dir/$(AssemblyName).dll "${@/#prefix:/}" 10 | 11 | 12 | 13 | @echo off 14 | dotnet %~dp0\$(AssemblyName).dll %* 15 | 16 | 17 | 18 | 22 | 23 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Commons.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | R-Koubou 7 | R-Koubou 8 | KeySwitchManager.Commons 9 | KeySwitchManager.Commons 10 | KeySwitchManager.Commons 11 | 0.0.1 12 | 9 13 | enable 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/StudioOne/StudioOneExportContentFileWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | using KeySwitchManager.UseCase.KeySwitches.Export; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.StudioOne 6 | { 7 | public sealed class StudioOneExportContentFileWriterFactory : KeySwitchExportContentFileWriterFactory 8 | { 9 | public StudioOneExportContentFileWriterFactory() : base( ".keyswitch" ) {} 10 | 11 | public StudioOneExportContentFileWriterFactory( IDirectoryPath outputDirectory ) 12 | : base( new DefaultExportPathBuilder( ".keyswitch", outputDirectory ) ) {} 13 | 14 | public StudioOneExportContentFileWriterFactory( IExportPathBuilder pathBuilder ) 15 | : base( pathBuilder ) {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Applications.Xamarin.Mac.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Applications.Xamarin.Mac", "Applications.Xamarin.Mac.csproj", "{6343EE02-E18E-4492-B3B3-B0544ACE01E5}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Any CPU = Debug|Any CPU 8 | Release|Any CPU = Release|Any CPU 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {6343EE02-E18E-4492-B3B3-B0544ACE01E5}.Debug|Any CPU.ActiveCfg = Debug|x86 12 | {6343EE02-E18E-4492-B3B3-B0544ACE01E5}.Debug|Any CPU.Build.0 = Debug|x86 13 | {6343EE02-E18E-4492-B3B3-B0544ACE01E5}.Release|Any CPU.ActiveCfg = Release|x86 14 | {6343EE02-E18E-4492-B3B3-B0544ACE01E5}.Release|Any CPU.Build.0 = Release|x86 15 | EndGlobalSection 16 | EndGlobal 17 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Export/YamlExportContentFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Domain.KeySwitches.Models; 6 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Translators; 7 | using KeySwitchManager.UseCase.KeySwitches.Export; 8 | 9 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Export 10 | { 11 | public class YamlExportContentFactory : IExportContentFactory 12 | { 13 | public Task CreateAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ) 14 | { 15 | var yamlText = new YamlKeySwitchExportTranslator().Translate( keySwitches ); 16 | return Task.FromResult( new StringContent( yamlText.Value ) ); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/templates/usecase/interactor.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.KeySwitches.Models; 2 | 3 | namespace ${namespace} 4 | { 5 | public class ${name}Interactor : I${name}UseCase 6 | { 7 | private IKeySwitchRepository Repository { get; } 8 | private I${name}Presenter Presenter { get; } 9 | 10 | public ${name}Interactor( 11 | IKeySwitchRepository repository ) : 12 | this( repository, new I${name}Presenter.Null() ) 13 | {} 14 | 15 | public ${name}Interactor( 16 | IKeySwitchRepository repository, 17 | I${name}Presenter presenter ) 18 | { 19 | Repository = repository; 20 | Presenter = presenter; 21 | } 22 | 23 | public ${name}Response Execute( ${name}Request request ) 24 | { 25 | throw new System.NotImplementedException(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Xml/Storage.Xml.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | net6.0 6 | KeySwitchManager.Testing.Storage.Xml 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Sources/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using AppKit; 2 | 3 | using Foundation; 4 | 5 | namespace KeySwitchManager.Xamarin.Mac 6 | { 7 | [Register( "AppDelegate" )] 8 | public class AppDelegate : NSApplicationDelegate 9 | { 10 | // ReSharper disable once EmptyConstructor 11 | public AppDelegate() 12 | { 13 | /*caret*/ 14 | } 15 | 16 | public override void DidFinishLaunching( NSNotification notification ) 17 | { 18 | // Insert code here to initialize your application 19 | } 20 | 21 | public override void WillTerminate( NSNotification notification ) 22 | { 23 | // Insert code here to tear down your application 24 | } 25 | 26 | public override bool ApplicationShouldTerminateAfterLastWindowClosed( NSApplication sender ) 27 | => true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/AbstractStreamExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.UseCase.KeySwitches.Export; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 8 | { 9 | public abstract class AbstractStreamExportContentWriter : IExportContentWriter 10 | { 11 | public async Task WriteAsync( IContent content, CancellationToken cancellationToken = default ) 12 | { 13 | var stream = OpenStream(); 14 | await using var contentStream = await content.GetContentStreamAsync(); 15 | await contentStream.CopyToAsync( stream, cancellationToken ); 16 | DisposeStream( stream ); 17 | } 18 | 19 | protected abstract Stream OpenStream(); 20 | protected abstract void DisposeStream( Stream stream ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Plist/Storage.Plist.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | net6.0 6 | KeySwitchManager.Testing.Storage.Plist 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/XmlClasses/POutputEvent.cs: -------------------------------------------------------------------------------- 1 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models.XmlClasses 2 | { 3 | public static class POutputEvent 4 | { 5 | public static ObjectElement New( int midiStatus, int data1, int data2 ) 6 | { 7 | #if false 8 | 9 | 10 | 11 | 12 | 13 | #endif 14 | var obj = new ObjectElement( "POutputEvent" ); 15 | 16 | obj.Int.Add( new IntElement( "status", midiStatus ) ); 17 | obj.Int.Add( new IntElement( "data1", data1 ) ); 18 | obj.Int.Add( new IntElement( "data2", data2 ) ); 19 | 20 | return obj; 21 | } 22 | 23 | } 24 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Aggregations/MidiNoteOn.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Aggregations 4 | { 5 | /// 6 | /// Representing a MIDI note on. 7 | /// 8 | public class MidiNoteOn : IMidiChannelVoiceMessage 9 | { 10 | public IMidiMessageData Status => new MidiStatus( 0x90 | Channel.Value ); 11 | public IMidiMessageData Channel { get; } 12 | public IMidiMessageData DataByte1 { get; } 13 | public IMidiMessageData DataByte2 { get; } 14 | 15 | public MidiNoteOn( 16 | MidiChannel channel, 17 | MidiNoteNumber midiNoteNumber, 18 | MidiVelocity midiVelocity ) 19 | { 20 | Channel = channel; 21 | DataByte1 = midiNoteNumber; 22 | DataByte2 = midiVelocity; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/Sources/Views/ConsoleLogView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Views.LogView; 4 | 5 | namespace KeySwitchManager.Applications.CLI.Views 6 | { 7 | public sealed class ConsoleLogView : ILogTextView 8 | { 9 | public bool AutoScroll { get; set; } // Ignore 10 | 11 | public void Append( string text ) 12 | { 13 | Console.Out.WriteLine( text ); 14 | } 15 | 16 | public void AppendError( string text ) 17 | { 18 | Console.Error.WriteLine( text ); 19 | } 20 | 21 | public void AppendError( Exception exception ) 22 | { 23 | Console.Error.WriteLine( exception.ToString() ); 24 | } 25 | 26 | public void Clear() 27 | { 28 | // None 29 | } 30 | 31 | public void ScrollToEnd() 32 | { 33 | // None 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/KeySwitches/Cakewalk/Models/ArticulationMap.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using Newtonsoft.Json; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk.Models 6 | { 7 | public class ArticulationMap 8 | { 9 | [JsonProperty( "name", Required = Required.Always )] 10 | public string Name { get; } 11 | 12 | [JsonProperty( "groups" )] 13 | public IList Groups { get; } 14 | 15 | [JsonProperty( "articulations" )] 16 | public IList Articulations { get; } 17 | 18 | public ArticulationMap( 19 | string name, 20 | IList groups, 21 | IList articulations ) 22 | { 23 | Name = name; 24 | Groups = groups; 25 | Articulations = articulations; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Aggregations/MidiProgramChange.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.KeySwitches.Models.Values; 2 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 3 | 4 | namespace KeySwitchManager.Domain.MidiMessages.Models.Aggregations 5 | { 6 | /// 7 | /// Represents a MIDI program change. 8 | /// 9 | public class MidiProgramChange : IMidiChannelVoiceMessage 10 | { 11 | public IMidiMessageData Status => new MidiStatus( 0xC0 | Channel.Value ); 12 | public IMidiMessageData Channel { get; } 13 | public IMidiMessageData DataByte1 { get; } 14 | public IMidiMessageData DataByte2 { get; } 15 | 16 | public MidiProgramChange( MidiChannel channel, MidiProgramChangeNumber number ) 17 | { 18 | Channel = channel; 19 | DataByte1 = number; 20 | DataByte2 = new GenericMidiData( 0 ); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/MidiProgramChangeModel.cs: -------------------------------------------------------------------------------- 1 | using YamlDotNet.Serialization; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 4 | { 5 | public class MidiProgramChangeModel : IMidiChannelVoiceMessageModel 6 | { 7 | [YamlIgnore] 8 | public int Status => 0xC0 | ( Channel & 0xF ); 9 | 10 | [YamlMember( Alias = "Channel" )] 11 | public int Channel { get; set; } 12 | 13 | [YamlMember( Alias = "ProgramNumber" )] 14 | public int Data1 { get; set; } 15 | 16 | [YamlIgnore] 17 | public int Data2 { get; set; } = 0x00; 18 | 19 | public MidiProgramChangeModel() {} 20 | 21 | public MidiProgramChangeModel( int channel, int data ) 22 | { 23 | Channel = channel; 24 | Data1 = data; 25 | Data2 = 0x00; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/ArticulationModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 4 | { 5 | public class ArticulationModel 6 | { 7 | public string Name { get; set; } = default!; 8 | 9 | public MidiModel MidiMessage { get; set; } = new MidiModel(); 10 | 11 | public IDictionary ExtraData { get; set; } = new Dictionary(); 12 | 13 | public ArticulationModel() 14 | {} 15 | 16 | public ArticulationModel( 17 | string name, 18 | MidiModel midiMessage, 19 | IReadOnlyDictionary extraData ) 20 | { 21 | Name = name; 22 | MidiMessage = midiMessage; 23 | ExtraData = new Dictionary( extraData ); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/SpecificExportPathBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | using KeySwitchManager.UseCase.KeySwitches.Export; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 8 | { 9 | public class SpecificExportPathBuilder : IExportPathBuilder 10 | { 11 | private IFilePath FilePath { get; } 12 | // no use 13 | public string Suffix => string.Empty; 14 | 15 | // no use 16 | public IDirectoryPath OutputDirectory { get; } = DirectoryPath.Default; 17 | 18 | public SpecificExportPathBuilder( IFilePath filePath ) 19 | { 20 | FilePath = filePath; 21 | } 22 | 23 | public IFilePath Build( IReadOnlyCollection keySwitches ) 24 | { 25 | return FilePath; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | KeySwitchManager 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
15 | 16 |
17 | An unhandled error has occurred. 18 | Reload 19 | 🗙 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet.ClosedXml/KeySwitches/Export/ClosedXmlExportContentFileWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Infrastructures.Storage.KeySwitches; 3 | using KeySwitchManager.UseCase.KeySwitches.Export; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.ClosedXml.KeySwitches.Export 6 | { 7 | public sealed class ClosedXmlExportContentFileWriterFactory : KeySwitchExportContentFileWriterFactory 8 | { 9 | public ClosedXmlExportContentFileWriterFactory() 10 | : this( new DefaultExportPathBuilder( ".xlsx" ) ) {} 11 | 12 | public ClosedXmlExportContentFileWriterFactory( IDirectoryPath outputDirectory ) 13 | : base( new DefaultExportPathBuilder( ".xlsx", outputDirectory ) ) {} 14 | 15 | public ClosedXmlExportContentFileWriterFactory( IExportPathBuilder pathBuilder ) 16 | : base( pathBuilder ) {} 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/StudioOne/Models/ExtraDataKeys.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.KeySwitches.Models.Values; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.StudioOne.Models 4 | { 5 | public static class ExtraDataKeys 6 | { 7 | public static readonly string ValueSeparator = ","; 8 | 9 | public static readonly ExtraDataKey Color = new ExtraDataKey( "StudioOne.Color" ); 10 | public static readonly ExtraDataKey Momentary = new ExtraDataKey( "StudioOne.Momentary" ); 11 | 12 | public static readonly ExtraDataKey NoteOnOff = new ExtraDataKey( "StudioOne.NoteOnOff" ); 13 | public static readonly ExtraDataKey NoteOn = new ExtraDataKey( "StudioOne.NoteOn" ); 14 | public static readonly ExtraDataKey NoteOff = new ExtraDataKey( "StudioOne.NoteOff" ); 15 | 16 | public static readonly ExtraDataKey Bank = new ExtraDataKey( "StudioOne.Bank" ); 17 | } 18 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Controllers/KeySwitches/CreateController.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | using KeySwitchManager.Interactors.KeySwitches; 5 | using KeySwitchManager.UseCase.KeySwitches.Create; 6 | using KeySwitchManager.UseCase.KeySwitches.Export; 7 | 8 | namespace KeySwitchManager.Controllers.KeySwitches 9 | { 10 | public sealed class CreateController 11 | { 12 | public void Create( IExportStrategy strategy, ICreatePresenter presenter ) 13 | => CreateAsync( strategy, presenter ).GetAwaiter().GetResult(); 14 | 15 | public async Task CreateAsync( IExportStrategy strategy, ICreatePresenter presenter, CancellationToken cancellationToken = default ) 16 | { 17 | var interactor = new CreateInteractor( presenter ); 18 | var inputData = new CreateInputData( strategy ); 19 | 20 | await interactor.HandleAsync( inputData, cancellationToken ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/MidiControlChangeModel.cs: -------------------------------------------------------------------------------- 1 | using YamlDotNet.Serialization; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 4 | { 5 | public class MidiControlChangeModel : IMidiChannelVoiceMessageModel 6 | { 7 | [YamlIgnore] 8 | public int Status => 0xB0 | ( Channel & 0xF ); 9 | 10 | [YamlMember( Alias = "Channel" )] 11 | public int Channel { get; set; } 12 | 13 | [YamlMember( Alias = "ControlNumber" )] 14 | public int Data1 { get; set; } 15 | 16 | [YamlMember( Alias = "Data" )] 17 | public int Data2 { get; set; } 18 | 19 | public MidiControlChangeModel() {} 20 | 21 | public MidiControlChangeModel( int channel, int data1, int data2 ) 22 | { 23 | Channel = channel; 24 | Data1 = data1; 25 | Data2 = data2; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/BinaryContent.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading.Tasks; 3 | 4 | using RkHelper.Primitives; 5 | 6 | namespace KeySwitchManager.UseCase.KeySwitches.Export 7 | { 8 | public class BinaryContent : IContent 9 | { 10 | private readonly byte[] data; 11 | private readonly int offset; 12 | private readonly int length; 13 | 14 | public BinaryContent( byte[] data ) 15 | : this( data, 0, data.Length ) {} 16 | 17 | public BinaryContent( byte[] data, int offset, int length ) 18 | { 19 | ArrayHelper.ValidateArrayRange( data, offset, length ); 20 | this.data = data; 21 | this.offset = offset; 22 | this.length = length; 23 | } 24 | 25 | public Task GetContentStreamAsync() 26 | { 27 | return Task.FromResult( new MemoryStream( data, offset, length ) ); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Json/Storage.Json.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | net6.0 6 | KeySwitchManager.Testing.Storage.Xml 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/GenerateVersion.msbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | $(Product) 10 | ============================== 11 | 12 | ## Assembly Version 13 | 14 | %(MyAssemblyIdentities.Version) 15 | 16 | ## Build On 17 | 18 | $([System.DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ss")) 19 | 20 | ## Build Configuration 21 | 22 | $(Configuration) 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/DefaultExportPathBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | using KeySwitchManager.Commons.Data; 5 | using KeySwitchManager.Domain.KeySwitches.Models; 6 | using KeySwitchManager.Infrastructures.Storage.KeySwitches.Helper; 7 | using KeySwitchManager.UseCase.KeySwitches.Export; 8 | 9 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 10 | { 11 | public sealed class DefaultExportPathBuilder : ExportPathBuilder 12 | { 13 | public DefaultExportPathBuilder( string suffix = "" ) : this( suffix, DirectoryPath.Default ) {} 14 | 15 | public DefaultExportPathBuilder( string suffix, IDirectoryPath outputDirectory ) : base( suffix, outputDirectory ) {} 16 | 17 | public override IFilePath Build( IReadOnlyCollection keySwitches ) 18 | { 19 | return CreatePathHelper.CreateFilePath( keySwitches.First(), Suffix, OutputDirectory ); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Aggregations/MidiControlChange.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 2 | 3 | namespace KeySwitchManager.Domain.MidiMessages.Models.Aggregations 4 | { 5 | /// 6 | /// Represents a MIDI control change. 7 | /// 8 | public class MidiControlChange : IMidiChannelVoiceMessage 9 | { 10 | public IMidiMessageData Status => new MidiStatus( 0xB0 | Channel.Value ); 11 | public IMidiMessageData Channel { get; } 12 | public IMidiMessageData DataByte1 { get; } 13 | public IMidiMessageData DataByte2 { get; } 14 | 15 | public MidiControlChange( 16 | MidiChannel channel, 17 | MidiControlChangeNumber midiControlChangeNumber, 18 | MidiControlChangeValue midiControlChangeValue ) 19 | { 20 | Channel = channel; 21 | DataByte1 = midiControlChangeNumber; 22 | DataByte2 = midiControlChangeValue; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/KeySwitches/Helpers/KeySwitchInfo.cs: -------------------------------------------------------------------------------- 1 | using RkHelper.Primitives; 2 | 3 | namespace KeySwitchManager.Domain.KeySwitches.Helpers 4 | { 5 | public class KeySwitchInfo 6 | { 7 | public string DeveloperName { get; } 8 | public string ProductName { get; } 9 | public string Author { get; } 10 | public string Description { get; } 11 | 12 | public KeySwitchInfo( 13 | string developerName, 14 | string productName, 15 | string author = "", 16 | string description = "" ) 17 | { 18 | StringHelper.ValidateEmpty( developerName ); 19 | StringHelper.ValidateNull( productName ); 20 | StringHelper.ValidateNull( author ); 21 | StringHelper.ValidateNull( description ); 22 | 23 | DeveloperName = developerName; 24 | ProductName = productName; 25 | Author = author; 26 | Description = description; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/StringElement.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Xml.Serialization; 3 | 4 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models 5 | { 6 | [XmlRoot( ElementName = "string" )] 7 | public class StringElement 8 | { 9 | [XmlAttribute( AttributeName = "name" )] 10 | public string Name { get; set; } = string.Empty; 11 | 12 | [XmlAttribute( AttributeName = "value" )] 13 | public string Value { get; set; } = string.Empty; 14 | 15 | [XmlAttribute( AttributeName = "wide" )] 16 | public bool Wide { get; set; } = true; 17 | 18 | [SuppressMessage( "ReSharper", "UnusedMember.Global" )] 19 | public StringElement() 20 | {} 21 | 22 | public StringElement( string name, string value, bool wide = true ) 23 | { 24 | Name = name; 25 | Value = value; 26 | Wide = wide; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/Storage.Json.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | netstandard2.1 6 | 7 | R-Koubou 8 | R-Koubou 9 | KeySwitchManager.Json.DotnetJson 10 | KeySwitchManager.Infrastructures.Storage.Json 11 | KeySwitchManager.Infrastructures.Storage.Json 12 | enable 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Spreadsheet.ClosedXml/KeySwitches/Translators/KeySwitchClosedXmlExportTranslator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using ClosedXML.Excel; 4 | 5 | using KeySwitchManager.Commons.Data; 6 | using KeySwitchManager.Domain.KeySwitches.Models; 7 | using KeySwitchManager.Infrastructures.Storage.Spreadsheet.ClosedXml.KeySwitches.Translators.Helpers; 8 | 9 | namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.ClosedXml.KeySwitches.Translators 10 | { 11 | public class KeySwitchClosedXmlExportTranslator : IDataTranslator, XLWorkbook> 12 | { 13 | private XLWorkbook Template { get; } 14 | 15 | public KeySwitchClosedXmlExportTranslator( XLWorkbook template ) 16 | { 17 | Template = template; 18 | } 19 | 20 | public XLWorkbook Translate( IReadOnlyCollection keySwitches ) 21 | { 22 | return KeySwitchToClosedXmlModelHelper.Translate( keySwitches, Template ); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/KeySwitches/Cakewalk/Translators/CakewalkExportTranslator.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Commons.Data; 2 | using KeySwitchManager.Domain.KeySwitches.Models; 3 | using KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk.Translators.Helpers; 4 | 5 | using Newtonsoft.Json; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk.Translators 8 | { 9 | public class CakewalkExportTranslator : IDataTranslator 10 | { 11 | public bool Formatted { get; } 12 | 13 | public CakewalkExportTranslator( bool formatted = false ) 14 | { 15 | Formatted = formatted; 16 | } 17 | 18 | public IText Translate( KeySwitch source ) 19 | { 20 | var jsonRoot = TranslateModelHelper.Translate( source ); 21 | var jsonText = JsonConvert.SerializeObject( jsonRoot, Formatted ? Formatting.Indented : Formatting.None ); 22 | 23 | return new PlainText( jsonText ); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/GenerateVersion.msbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | $(Product) 10 | ============================== 11 | 12 | ## Assembly Version 13 | 14 | %(MyAssemblyIdentities.Version) 15 | 16 | ## Build On 17 | 18 | $([System.DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ss")) 19 | 20 | ## Build Configuration 21 | 22 | $(Configuration) 23 | 24 | ## Git 25 | 26 | - Branch: $(GitBranch) 27 | - Hash: $(GitCommitHash) 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/GenerateVersion.msbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | $(Product) 10 | ============================== 11 | 12 | ## Assembly Version 13 | 14 | %(MyAssemblyIdentities.Version) 15 | 16 | ## Build On 17 | 18 | $([System.DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ss")) 19 | 20 | ## Build Configuration 21 | 22 | $(Configuration) 23 | 24 | ## Git 25 | 26 | - Branch: $(GitBranch) 27 | - Hash: $(GitCommitHash) 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/ListElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Xml.Serialization; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models 6 | { 7 | [XmlRoot( ElementName = "list" )] 8 | public class ListElement 9 | { 10 | [XmlElement( ElementName = "obj" )] 11 | public List Obj { get; set; } = new List(); 12 | 13 | [XmlAttribute( AttributeName = "name" )] 14 | public string Name { get; set; } = string.Empty; 15 | 16 | [XmlAttribute( AttributeName = "type" )] 17 | public string Type { get; set; } 18 | 19 | [SuppressMessage( "ReSharper", "UnusedMember.Global" )] 20 | public ListElement() 21 | { 22 | Name = "obj"; 23 | Type = "obj"; 24 | } 25 | 26 | public ListElement( string name, string type ) 27 | { 28 | Name = name; 29 | Type = type; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/IKeySwitchFileNameFormatter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | 6 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 7 | { 8 | public interface IKeySwitchFileNameFormatter 9 | { 10 | string Suffix { get; } 11 | string Format( KeySwitch keySwitch ); 12 | string Format( IReadOnlyCollection keySwitches ); 13 | 14 | public class Default : IKeySwitchFileNameFormatter 15 | { 16 | public string Suffix { get; } 17 | 18 | public Default( string suffix ) 19 | { 20 | Suffix = suffix; 21 | } 22 | 23 | public string Format( KeySwitch keySwitch ) 24 | => $"{keySwitch.ProductName} {keySwitch.InstrumentName}.{Suffix}"; 25 | 26 | public string Format( IReadOnlyCollection keySwitches ) 27 | => $"{keySwitches.First().ProductName}.{Suffix}"; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/KeySwitches/Export/StringContent.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Commons.Helpers; 6 | 7 | namespace KeySwitchManager.UseCase.KeySwitches.Export 8 | { 9 | public class StringContent : IContent 10 | { 11 | private readonly string data; 12 | private readonly Encoding encoding; 13 | 14 | public StringContent( string data ) : this( data, EncodingHelper.UTF8N ) {} 15 | 16 | public StringContent( string data, Encoding encoding ) 17 | { 18 | this.data = data; 19 | this.encoding = encoding; 20 | } 21 | 22 | public async Task GetContentStreamAsync() 23 | { 24 | var memoryStream = new MemoryStream(); 25 | var writer = new StreamWriter( memoryStream ); 26 | await writer.WriteAsync( data ); 27 | await writer.FlushAsync(); 28 | memoryStream.Seek( 0, SeekOrigin.Begin ); 29 | 30 | return memoryStream; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:65283", 7 | "sslPort": 44398 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "Mudblazor.Template": { 20 | "commandName": "Project", 21 | "dotnetRunMessages": "true", 22 | "launchBrowser": true, 23 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Blazor/wwwroot/download.js: -------------------------------------------------------------------------------- 1 | function downloadFromByteArray( base64Data, fileName ) 2 | { 3 | // Create binary data from Base64 strings 4 | const byteCharacters = atob( base64Data ); 5 | const byteNumbers = new Array( byteCharacters.length ); 6 | 7 | for( let i = 0; i < byteCharacters.length; i++ ) 8 | { 9 | byteNumbers[ i ] = byteCharacters.charCodeAt( i ); 10 | } 11 | 12 | const byteArray = new Uint8Array( byteNumbers ); 13 | 14 | // Create a Blob 15 | const blob = new Blob( [ byteArray ], { 16 | type: "application/octet-stream" 17 | }); 18 | 19 | // Creating URLs from Blobs 20 | const blobUrl = URL.createObjectURL( blob ); 21 | 22 | // Create a temporary a-element and download 23 | const link = document.createElement( 'a' ); 24 | document.body.appendChild( link ); // for Firefox 25 | link.href = blobUrl; 26 | link.download = fileName; 27 | link.click(); 28 | 29 | // Clean up URL 30 | URL.revokeObjectURL( blobUrl ); 31 | document.body.removeChild( link ); // for Firefox 32 | } 33 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/ExportStreamContentWriterFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | using KeySwitchManager.Domain.KeySwitches.Models; 7 | using KeySwitchManager.UseCase.KeySwitches.Export; 8 | 9 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 10 | { 11 | public abstract class ExportStreamContentWriterFactory : IExportContentWriterFactory 12 | { 13 | protected Stream TargetStream { get; } 14 | 15 | protected ExportStreamContentWriterFactory( Stream targetStream ) 16 | { 17 | TargetStream = targetStream; 18 | } 19 | 20 | public Task CreateAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ) 21 | { 22 | return Task.FromResult( CreateStreamExportContentWriterImpl() ); 23 | } 24 | 25 | protected abstract AbstractStreamExportContentWriter CreateStreamExportContentWriterImpl(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/CubaseExportContentFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | using KeySwitchManager.Domain.KeySwitches.Models; 7 | using KeySwitchManager.Infrastructures.Storage.KeySwitches.Helper; 8 | using KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Translators; 9 | using KeySwitchManager.UseCase.KeySwitches.Export; 10 | 11 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase 12 | { 13 | public class CubaseExportContentFactory : IExportContentFactory 14 | { 15 | public Task CreateAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ) 16 | { 17 | KeySwitchValidateHelper.ValidateOneElement( keySwitches ); 18 | 19 | var source = keySwitches.First(); 20 | var xmlText = new CubaseExportTranslator().Translate( source ); 21 | 22 | return Task.FromResult( new StringContent( xmlText.Value ) ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 R-Koubou 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 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Factory/IMidiNoteOnModelFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Factory 4 | { 5 | public interface IMidiNoteOnModelFactory : IMidiChannelVoiceMessageModelFactory 6 | { 7 | public MidiNoteOnModel Create( int noteNumber, int velocity ); 8 | 9 | public static IMidiNoteOnModelFactory Default => new DefaultModelFactory(); 10 | 11 | private class DefaultModelFactory : IMidiNoteOnModelFactory 12 | { 13 | public MidiNoteOnModel Create( int noteNumber, int velocity ) 14 | { 15 | return Create( 0x00, noteNumber, velocity ); 16 | } 17 | 18 | public MidiNoteOnModel Create( int channel, int data1, int data2 ) 19 | { 20 | return new MidiNoteOnModel( 21 | channel, 22 | data1, 23 | data2 24 | ); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Aggregations/MidiModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations 4 | { 5 | public class MidiModel 6 | { 7 | public IList NoteOn { get; set; } = new List(); 8 | public IList ControlChange { get; set; } = new List(); 9 | public IList ProgramChange { get; set; } = new List(); 10 | 11 | public MidiModel() 12 | {} 13 | 14 | public MidiModel( 15 | IReadOnlyCollection noteOn, 16 | IReadOnlyCollection controlChange, 17 | IReadOnlyCollection programChange ) 18 | { 19 | NoteOn = new List( noteOn ); 20 | ControlChange = new List( controlChange ); 21 | ProgramChange = new List( programChange ); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/Helper/KeySwitchValidateHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using KeySwitchManager.Domain.KeySwitches.Models; 6 | 7 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches.Helper 8 | { 9 | public static class KeySwitchValidateHelper 10 | { 11 | public static void ValidateOneElement( IReadOnlyCollection keySwitches ) 12 | { 13 | if( !keySwitches.Any() ) 14 | { 15 | throw new ArgumentException( $"{nameof( keySwitches )} is empty" ); 16 | } 17 | 18 | if( keySwitches.Count >= 2 ) 19 | { 20 | throw new ArgumentException( $"{nameof( keySwitches )} has 1 element only" ); 21 | } 22 | } 23 | 24 | public static void ValidateNotEmpty( IReadOnlyCollection keySwitches ) 25 | { 26 | if( !keySwitches.Any() ) 27 | { 28 | throw new ArgumentException( $"{nameof( keySwitches )} is empty" ); 29 | } 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/MidiMessages/Models/Values/VelocityTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace KeySwitchManager.Testing.Domain.MidiMessages.Models.Values 8 | { 9 | [TestFixture] 10 | public class VelocityTest 11 | { 12 | [TestCase( -1 )] 13 | [TestCase( 128 )] 14 | public void OutOfRangeTest( int velocity ) 15 | { 16 | Assert.Throws( () => _ = new MidiVelocity( velocity ) ); 17 | } 18 | 19 | [Test] 20 | public void EqualityTest() 21 | { 22 | var vel1 = new MidiVelocity( 10 ); 23 | var vel2 = new MidiVelocity( 20 ); 24 | Assert.IsTrue( vel1.Equals( new MidiVelocity( 10 ) ) ); 25 | Assert.IsFalse( vel1.Equals( vel2 ) ); 26 | } 27 | 28 | [Test] 29 | public void ToStringEqualityTest() 30 | { 31 | Assert.AreEqual( new MidiVelocity( 1 ).ToString(), "1" ); 32 | Assert.IsTrue( new MidiVelocity( 1 ).ToString() == "1" ); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /CodeGenerators/CodeTemplate/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 R-Koubou 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 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/UseCases/Commons/IOutputData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Commons; 4 | 5 | namespace KeySwitchManager.UseCase.Commons 6 | { 7 | public interface IOutputData 8 | { 9 | public bool Result { get; } 10 | public TData Value { get; } 11 | public Exception? Error { get; } 12 | } 13 | 14 | public abstract class OutputData : IOutputData 15 | { 16 | public virtual bool Result { get; } 17 | public virtual TData Value { get; } 18 | public virtual Exception? Error { get; } 19 | 20 | protected OutputData( bool result, TData value, Exception? error = null ) 21 | { 22 | Result = result; 23 | Value = value; 24 | Error = error; 25 | } 26 | } 27 | 28 | public sealed class UnitOutputData : IOutputData 29 | { 30 | public static readonly UnitOutputData Default = new(); 31 | 32 | public bool Result => true; 33 | public Unit Value => Unit.Default; 34 | public Exception? Error => null; 35 | 36 | private UnitOutputData() {} 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/MidiMessages/Models/Values/NoteNumberTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace KeySwitchManager.Testing.Domain.MidiMessages.Models.Values 8 | { 9 | [TestFixture] 10 | public class NoteNumberTest 11 | { 12 | [TestCase( -1 )] 13 | [TestCase( 128 )] 14 | public void OutOfRangeTest( int noteNumber ) 15 | { 16 | Assert.Throws( () => _ = new MidiNoteNumber( noteNumber ) ); 17 | } 18 | 19 | [Test] 20 | public void EqualityTest() 21 | { 22 | var note1 = new MidiNoteNumber( 1 ); 23 | var note2 = new MidiNoteNumber( 2 ); 24 | Assert.IsTrue( note1.Equals( new MidiNoteNumber( 1 ) ) ); 25 | Assert.IsFalse( note1.Equals( note2 ) ); 26 | } 27 | 28 | [Test] 29 | public void ToStringEqualityTest() 30 | { 31 | Assert.AreEqual( new MidiNoteNumber( 1 ).ToString(), "1" ); 32 | Assert.IsTrue( new MidiNoteNumber( 1 ).ToString() == "1" ); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/MidiMessages/Models/Values/StatusCodeTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace KeySwitchManager.Testing.Domain.MidiMessages.Models.Values 8 | { 9 | [TestFixture] 10 | public class StatusCodeTest 11 | { 12 | [Test] 13 | [TestCase( -1 )] 14 | [TestCase( 256 )] 15 | public void OutOfRangeTest( int ccNumber ) 16 | { 17 | Assert.Throws( () => _ = new MidiStatus( ccNumber ) ); 18 | } 19 | 20 | [Test] 21 | public void EqualityTest() 22 | { 23 | var code1 = new MidiStatus( 1 ); 24 | var code2 = new MidiStatus( 2 ); 25 | Assert.IsTrue( code1.Equals( new MidiStatus( 1 ) ) ); 26 | Assert.IsFalse( code1.Equals( code2 ) ); 27 | } 28 | 29 | [Test] 30 | public void ToStringEqualityTest() 31 | { 32 | Assert.AreEqual( new MidiStatus( 1 ).ToString(), "1" ); 33 | Assert.IsTrue( new MidiStatus( 1 ).ToString() == "1" ); 34 | 35 | } 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/CLI/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 R-Koubou 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 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 R-Koubou 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 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleName 5 | KeySwitchManager.Xamarin.Mac 6 | CFBundleIdentifier 7 | net.rkoubou.KeySwitchManager.Xamarin.Mac 8 | CFBundleShortVersionString 9 | 1.0 10 | CFBundleVersion 11 | 1 12 | LSMinimumSystemVersion 13 | 10.14 14 | CFBundleDevelopmentRegion 15 | en 16 | CFBundleInfoDictionaryVersion 17 | 6.0 18 | CFBundlePackageType 19 | APPL 20 | CFBundleSignature 21 | ???? 22 | NSHumanReadableCopyright 23 | ${AuthorCopyright:HtmlEncode} 24 | NSPrincipalClass 25 | NSApplication 26 | NSMainStoryboardFile 27 | Main 28 | XSAppIconAssets 29 | Assets.xcassets/AppIcon.appiconset 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Import/YamlImportContentReader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | using KeySwitchManager.Commons.Data; 7 | using KeySwitchManager.Commons.Helpers; 8 | using KeySwitchManager.Domain.KeySwitches.Models; 9 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Translators; 10 | using KeySwitchManager.UseCase.KeySwitches.Import; 11 | 12 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Import 13 | { 14 | public class YamlImportContentReader : IImportContentReader 15 | { 16 | public async Task> ReadAsync( IContent content, CancellationToken cancellationToken = default ) 17 | { 18 | await using var stream = await content.GetContentStreamAsync( cancellationToken ); 19 | using var reader = new StreamReader( stream, EncodingHelper.UTF8N ); 20 | 21 | var jsonText = await reader.ReadToEndAsync(); 22 | 23 | return new YamlKeySwitchImportTranslator().Translate( new PlainText( jsonText ) );; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/Xamarin.Mac/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 R-Koubou 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 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Models/Factory/IMidiControlChangeModelFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Aggregations; 2 | 3 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models.Factory 4 | { 5 | public interface IMidiControlChangeModelFactory : IMidiChannelVoiceMessageModelFactory 6 | { 7 | public MidiControlChangeModel Create( int ccNumber, int ccValue ); 8 | 9 | public static IMidiControlChangeModelFactory Default => new DefaultModelFactory(); 10 | 11 | private class DefaultModelFactory : IMidiControlChangeModelFactory 12 | { 13 | public MidiControlChangeModel Create( int ccNumber, int ccValue ) 14 | { 15 | return Create( 0x00, ccNumber, ccValue ); 16 | } 17 | 18 | public MidiControlChangeModel Create( int channel, int data1, int data2 ) 19 | { 20 | return new MidiControlChangeModel( 21 | channel, 22 | data1, 23 | data2 24 | ); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Yaml/KeySwitches/Translators/YamlKeySwitchImportTranslator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | using KeySwitchManager.Commons.Data; 4 | using KeySwitchManager.Domain.KeySwitches.Models; 5 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Models; 6 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Translators.Helpers; 7 | 8 | using YamlDotNet.Serialization; 9 | 10 | namespace KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Translators 11 | { 12 | public class YamlKeySwitchImportTranslator : IDataTranslator> 13 | { 14 | public IReadOnlyCollection Translate( IText source ) 15 | { 16 | var result = new List(); 17 | var deserializer = new DeserializerBuilder().Build(); 18 | var model = deserializer.Deserialize( source.Value ); 19 | 20 | foreach( var i in model.KeySwitches ) 21 | { 22 | var x = TranslateKeySwitchHelper.Translate( i ); 23 | result.Add( x ); 24 | } 25 | 26 | return result; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Commons/Data/FilePath.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace KeySwitchManager.Commons.Data 4 | { 5 | public class FilePath : IFilePath 6 | { 7 | public string Path { get; } 8 | public bool Exists => File.Exists( Path ); 9 | 10 | public FilePath( string path ) 11 | { 12 | Path = path; 13 | } 14 | 15 | public void CreateNew() 16 | { 17 | if( !Exists ) 18 | { 19 | using var _ = File.Create( this.Path ); 20 | } 21 | } 22 | 23 | public Stream OpenStream( FileMode mode, FileAccess access ) 24 | => File.Open( Path, mode, access ); 25 | 26 | public Stream OpenReadStream() 27 | => File.OpenRead( Path ); 28 | 29 | public Stream OpenWriteStream(bool overWrite = true) 30 | => File.Open( Path, overWrite ? FileMode.Create : FileMode.Append, FileAccess.Write ); 31 | 32 | public Stream OpenReadWriteStream(bool overWrite = true) 33 | => File.Open( Path, overWrite ? FileMode.Create : FileMode.Append, FileAccess.ReadWrite ); 34 | 35 | public override string ToString() => Path; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage/KeySwitches/ZipExportContentWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.IO.Compression; 3 | 4 | using KeySwitchManager.Commons.Data; 5 | 6 | using RkHelper.System; 7 | 8 | namespace KeySwitchManager.Infrastructures.Storage.KeySwitches 9 | { 10 | public class ZipExportContentWriter : AbstractStreamExportContentWriter 11 | { 12 | private ZipArchive ZipArchive { get; } 13 | private IFilePath ArchivePath { get; } 14 | private CompressionLevel CompressionLevel { get; } 15 | 16 | public ZipExportContentWriter( ZipArchive zipArchive, IFilePath archivePath, CompressionLevel compressionLevel = CompressionLevel.Optimal ) 17 | { 18 | ZipArchive = zipArchive; 19 | ArchivePath = archivePath; 20 | CompressionLevel = compressionLevel; 21 | } 22 | 23 | protected override Stream OpenStream() 24 | { 25 | return ZipArchive.CreateEntry( ArchivePath.Path, CompressionLevel ).Open(); 26 | } 27 | 28 | protected override void DisposeStream( Stream stream ) 29 | { 30 | Disposer.Dispose( stream ); 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Presenters/KeySwitches/DumpPresenter.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | using KeySwitchManager.UseCase.KeySwitches.Dump; 5 | using KeySwitchManager.Views.LogView; 6 | 7 | namespace KeySwitchManager.Presenters.KeySwitches 8 | { 9 | public sealed class DumpPresenter : IDumpPresenter 10 | { 11 | public static readonly IDumpPresenter Null = new NullImpl(); 12 | 13 | private ILogTextView TextView { get; } 14 | 15 | public DumpPresenter( ILogTextView textView ) 16 | { 17 | TextView = textView; 18 | } 19 | 20 | public async Task HandleAsync( DumpOutputData outputData, CancellationToken cancellationToken = default ) 21 | { 22 | TextView.Append( $"{outputData.Value.DumpDataCount} record(s) dumped" ); 23 | await Task.CompletedTask; 24 | } 25 | 26 | #region NullObject 27 | private class NullImpl : IDumpPresenter 28 | { 29 | public async Task HandleAsync( DumpOutputData outputData, CancellationToken cancellationToken = default ) 30 | => await Task.CompletedTask; 31 | } 32 | #endregion 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Yaml/Storage.Yaml.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 5 | net6.0 6 | KeySwitchManager.Testing.Storage.Yaml 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Always 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Json/KeySwitches/Cakewalk/CakewalkExportContentFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | using KeySwitchManager.Domain.KeySwitches.Models; 7 | using KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk.Translators; 8 | using KeySwitchManager.Infrastructures.Storage.KeySwitches.Helper; 9 | using KeySwitchManager.UseCase.KeySwitches.Export; 10 | 11 | namespace KeySwitchManager.Infrastructures.Storage.Json.KeySwitches.Cakewalk 12 | { 13 | public class CakewalkExportContentFactory : IExportContentFactory 14 | { 15 | public Task CreateAsync( IReadOnlyCollection keySwitches, CancellationToken cancellationToken = default ) 16 | { 17 | KeySwitchValidateHelper.ValidateOneElement( keySwitches ); 18 | 19 | var source = keySwitches.First(); 20 | 21 | // TODO すべての要素を束ねた 1 JSONファイルにしたい(Cakewalkは保持できる) 22 | var jsonText = new CakewalkExportTranslator( true ).Translate( source ); 23 | 24 | return Task.FromResult( new StringContent( jsonText.Value ) ); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Applications/WPF/WPF.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.002.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Applications.WPF", "Applications.WPF.csproj", "{3B23FC95-6BD9-4AD3-9A27-4D1983A44991}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {3B23FC95-6BD9-4AD3-9A27-4D1983A44991}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {3B23FC95-6BD9-4AD3-9A27-4D1983A44991}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {3B23FC95-6BD9-4AD3-9A27-4D1983A44991}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {3B23FC95-6BD9-4AD3-9A27-4D1983A44991}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {41BB74CF-649D-4CA8-B7EE-B59F5EA58A2B} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/MidiMessages/Models/Values/ControlNumberTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace KeySwitchManager.Testing.Domain.MidiMessages.Models.Values 8 | { 9 | [TestFixture] 10 | public class ControlNumberTest 11 | { 12 | [Test] 13 | [TestCase( -1 )] 14 | [TestCase( 128 )] 15 | public void OutOfRangeTest( int ccNumber ) 16 | { 17 | Assert.Throws( () => new MidiControlChangeNumber( ccNumber ) ); 18 | } 19 | 20 | [Test] 21 | public void EqualityTest() 22 | { 23 | var cc1 = new MidiControlChangeNumber( 1 ); 24 | var cc2 = new MidiControlChangeNumber( 2 ); 25 | Assert.IsTrue( cc1.Equals( new MidiControlChangeNumber( 1 ) ) ); 26 | Assert.IsFalse( cc1.Equals( cc2 ) ); 27 | } 28 | 29 | [Test] 30 | public void ToStringEqualityTest() 31 | { 32 | Assert.AreEqual( new MidiControlChangeNumber( 1 ).ToString(), "1" ); 33 | Assert.IsTrue( new MidiControlChangeNumber( 1 ).ToString() == "1" ); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Infrastructures/Storage.Xml/KeySwitches/Cubase/Models/RootElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Xml.Serialization; 4 | 5 | namespace KeySwitchManager.Infrastructures.Storage.Xml.KeySwitches.Cubase.Models 6 | { 7 | [XmlRoot( ElementName = "InstrumentMap" )] 8 | public class RootElement 9 | { 10 | 11 | [XmlElement( ElementName = "string" )] 12 | public StringElement StringElement { get; set; } 13 | 14 | [XmlElement( ElementName = "member" )] 15 | public List Member { get; set; } = new List(); 16 | 17 | [SuppressMessage( "ReSharper", "UnusedMember.Global" )] 18 | public RootElement() 19 | { 20 | StringElement = new StringElement( "name", string.Empty ); 21 | } 22 | 23 | public RootElement( string name ) 24 | { 25 | StringElement = new StringElement( "name", name ); 26 | } 27 | 28 | public RootElement( StringElement stringElement, IEnumerable members ) 29 | { 30 | StringElement = stringElement; 31 | Member.AddRange( members ); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/MidiMessages/Models/Values/MostSignificantByteTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace KeySwitchManager.Testing.Domain.MidiMessages.Models.Values 8 | { 9 | [TestFixture] 10 | public class MostSignificantByteTest 11 | { 12 | [TestCase( -1 )] 13 | [TestCase( 256 )] 14 | public void OutOfRangeTest( int noteNumber ) 15 | { 16 | Assert.Throws( () => _ = new MidiMostSignificantByte( noteNumber ) ); 17 | } 18 | 19 | [Test] 20 | public void EqualityTest() 21 | { 22 | var byte1 = new MidiMostSignificantByte( 1 ); 23 | var byte2 = new MidiMostSignificantByte( 2 ); 24 | Assert.IsTrue( byte1.Equals( new MidiMostSignificantByte( 1 ) ) ); 25 | Assert.IsFalse( byte1.Equals( byte2 ) ); 26 | } 27 | 28 | [Test] 29 | public void ToStringEqualityTest() 30 | { 31 | Assert.AreEqual( new MidiMostSignificantByte( 1 ).ToString(), "1" ); 32 | Assert.IsTrue( new MidiMostSignificantByte( 1 ).ToString() == "1" ); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Runtime/Domain/MidiMessages/Models/Factory/IGenericMidiMessageFactory.cs: -------------------------------------------------------------------------------- 1 | using KeySwitchManager.Domain.KeySwitches.Models.Values; 2 | using KeySwitchManager.Domain.MidiMessages.Models.Aggregations; 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | namespace KeySwitchManager.Domain.MidiMessages.Models.Factory 6 | { 7 | public interface IGenericMidiMessageFactory : IMidiMessageFactory 8 | { 9 | public static IGenericMidiMessageFactory Default => new DefaultFactory(); 10 | 11 | public static GenericMidiMessage Zero => 12 | new GenericMidiMessage( 13 | new MidiStatus( 0 ), 14 | new GenericMidiData( 0 ), 15 | new GenericMidiData( 0 ) 16 | ); 17 | 18 | private class DefaultFactory : IGenericMidiMessageFactory 19 | { 20 | public GenericMidiMessage Create( int status, int data1, int data2 ) 21 | { 22 | return new GenericMidiMessage( 23 | new MidiStatus( status ), 24 | new GenericMidiData( data1 ), 25 | new GenericMidiData( data2 ) 26 | ); 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Domain/MidiMessages/Models/Values/ControlValueTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using KeySwitchManager.Domain.MidiMessages.Models.Values; 4 | 5 | using NUnit.Framework; 6 | 7 | namespace KeySwitchManager.Testing.Domain.MidiMessages.Models.Values 8 | { 9 | [TestFixture] 10 | public class ControlValueTest 11 | { 12 | [Test] 13 | [TestCase( -1 )] 14 | [TestCase( 128 )] 15 | public void OutOfRangeTest( int ccNumber ) 16 | { 17 | Assert.Throws( () => _ = new MidiControlChangeValue( ccNumber ) ); 18 | } 19 | 20 | [Test] 21 | public void EqualityTest() 22 | { 23 | var cc1 = new MidiControlChangeNumber( 1 ); 24 | var cc2 = new MidiControlChangeNumber( 2 ); 25 | Assert.IsTrue( cc1.Equals( new MidiControlChangeNumber( 1 ) ) ); 26 | Assert.IsFalse( cc1.Equals( cc2 ) ); 27 | } 28 | 29 | [Test] 30 | public void ToStringEqualityTest() 31 | { 32 | Assert.AreEqual( new MidiControlChangeNumber( 1 ).ToString(), "1" ); 33 | Assert.IsTrue( new MidiControlChangeNumber( 1 ).ToString() == "1" ); 34 | 35 | } 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /KeySwitchManager/Sources/Tests/Infrastructures/Storage.Yaml/KeySwitches/YamlImportTest.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | 5 | using KeySwitchManager.Commons.Data; 6 | using KeySwitchManager.Infrastructures.Storage.KeySwitches.Import; 7 | using KeySwitchManager.Infrastructures.Storage.Yaml.KeySwitches.Import; 8 | 9 | using NUnit.Framework; 10 | 11 | namespace KeySwitchManager.Testing.Storage.Yaml.KeySwitches 12 | { 13 | [TestFixture] 14 | public class YamlImportTest 15 | { 16 | private static readonly string TestDirectory = TestContext.CurrentContext.TestDirectory; 17 | private static readonly string TestInputDirectory = Path.Combine( TestDirectory, "KeySwitches", "TestData" ); 18 | 19 | [Test] 20 | public async Task ImportTest() 21 | { 22 | var importPath = new FilePath( Path.Combine( TestInputDirectory, "ImportTestData.yaml" ) ); 23 | 24 | var content = new FileContent( importPath ); 25 | var reader = new YamlImportContentReader(); 26 | var keySwitches = await reader.ReadAsync( content ); 27 | 28 | var x = keySwitches.FirstOrDefault(); 29 | Assert.IsNotNull( x ); 30 | } 31 | } 32 | } 33 | --------------------------------------------------------------------------------