From 5c60523a4d06eed3c05923073a849b8931d49323 Mon Sep 17 00:00:00 2001 From: Andrei Ignat Date: Tue, 2 Sep 2025 20:57:20 +0300 Subject: [PATCH 1/3] added example --- README.md | 196 ++-- later.md | 182 +--- v2/Generator/DocusaurusExample.txt | 4 +- v2/Generator/all.csv | 1 + v2/RSCGExamplesData/GeneratorDataRec.json | 8 +- v2/RSCGExamplesData/NoExample.json | 5 - .../requiredenum/description.json | 22 + v2/rscg_examples/requiredenum/nuget.txt | 1 + v2/rscg_examples/requiredenum/readme.txt | 36 + .../requiredenum/src/.tours/requiredenum.tour | 30 + .../requiredenum/src/EnumDemo.sln | 25 + .../requiredenum/src/EnumDemo/EnumDemo.csproj | 23 + .../requiredenum/src/EnumDemo/Program.cs | 27 + .../src/EnumDemo/RequiredCarTypes.cs | 10 + v2/rscg_examples/requiredenum/video.json | 39 + v2/rscg_examples_site/docs/Categories/Enum.md | 4 +- .../docs/Categories/_PrimitiveEnum.mdx | 2 + v2/rscg_examples_site/docs/NoExamples.md | 276 +++-- .../FactoryGenerator.Abstractions.md | 53 - .../JinShil.MixinSourceGenerator.md | 61 -- .../docs/RSCG-Examples/Schema.md | 962 ------------------ .../docs/RSCG-Examples/index.md | 13 +- .../docs/RSCG-Examples/requiredenum.md | 220 ++++ v2/rscg_examples_site/docs/about.md | 2 +- v2/rscg_examples_site/docs/indexRSCG.md | 5 +- .../src/components/HomepageFeatures/index.js | 2 +- .../static/exports/RSCG.json | 8 + .../static/exports/RSCG.xlsx | Bin 12250 -> 12295 bytes 28 files changed, 723 insertions(+), 1494 deletions(-) create mode 100644 v2/rscg_examples/requiredenum/description.json create mode 100644 v2/rscg_examples/requiredenum/nuget.txt create mode 100644 v2/rscg_examples/requiredenum/readme.txt create mode 100644 v2/rscg_examples/requiredenum/src/.tours/requiredenum.tour create mode 100644 v2/rscg_examples/requiredenum/src/EnumDemo.sln create mode 100644 v2/rscg_examples/requiredenum/src/EnumDemo/EnumDemo.csproj create mode 100644 v2/rscg_examples/requiredenum/src/EnumDemo/Program.cs create mode 100644 v2/rscg_examples/requiredenum/src/EnumDemo/RequiredCarTypes.cs create mode 100644 v2/rscg_examples/requiredenum/video.json create mode 100644 v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md diff --git a/README.md b/README.md index 338760315..be579aa21 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# RSCG - 225 Examples of Roslyn Source Code Generators / 14 created by Microsoft / +# RSCG - 226 Examples of Roslyn Source Code Generators / 14 created by Microsoft / -## Latest Update : 2025-08-13 => 13 August 2025 +## Latest Update : 2025-08-14 => 14 August 2025 If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)*** @@ -20,8 +20,30 @@ If you want to be notified each time I add a new RSCG example , please click htt ## Content -Those are the 225 Roslyn Source Code Generators that I have tested you can see and download source code example. +Those are the 226 Roslyn Source Code Generators that I have tested you can see and download source code example. ( including 14 from Microsoft ) +### 226. [requiredenum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum) , in the [Enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) category + +Generated on : 2025-08-14 => 14 August 2025 + +
+ Expand + + + +Author: Yaroslav + +RequiredEnum is an open-source analyzer that helps handle all enum values for switch. + +Nuget: [https://www.nuget.org/packages/requiredenum/](https://www.nuget.org/packages/requiredenum/) + + +Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum) + +Source: [https://github.com/emptycoder/RequiredEnum](https://github.com/emptycoder/RequiredEnum) + +
+ ### 225. [Schema](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Schema) , in the [Serializer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#serializer) category Generated on : 2025-08-13 => 13 August 2025 @@ -5142,7 +5164,7 @@ Please help with those by providing a simple example : 1) [AdaskoTheBeAsT.Identity.Dapper]( https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper) , https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=AdaskoTheBeAsT.Identity.Dapper&body=https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper @@ -5156,7 +5178,7 @@ https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ApiClientGenerator 3) [AttributeFactoryGenerator]( https://github.com/PaulBraetz/AttributeFactoryGenerator) , https://github.com/PaulBraetz/AttributeFactoryGenerator -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=AttributeFactoryGenerator&body=https://github.com/PaulBraetz/AttributeFactoryGenerator @@ -5233,7 +5255,7 @@ https://github.com/ignatandrei/RSCG_Examples/issues/new?title=FastEndpoints&body 14) [FluentAssertions.Eventual]( https://github.com/mazharenko/FluentAssertions.Eventual) , https://github.com/mazharenko/FluentAssertions.Eventual -Why I have not tested : later +Why I have not tested : atchived https://github.com/ignatandrei/RSCG_Examples/issues/new?title=FluentAssertions.Eventual&body=https://github.com/mazharenko/FluentAssertions.Eventual @@ -5247,7 +5269,7 @@ https://github.com/ignatandrei/RSCG_Examples/issues/new?title=GRPC-Mock-Server&b 16) [H.NSwag.Generator]( https://github.com/HavenDV/H.NSwag.Generator) , https://github.com/HavenDV/H.NSwag.Generator -Why I have not tested : later +Why I have not tested : do not understand https://github.com/ignatandrei/RSCG_Examples/issues/new?title=H.NSwag.Generator&body=https://github.com/HavenDV/H.NSwag.Generator @@ -5259,357 +5281,329 @@ Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Hexa.Protobuf&body=https://github.com/HexaEngine/Hexa.Protobuf -18) [Hsu.Sg.Proxy]( https://github.com/hsu-net/source-generators/) , https://github.com/hsu-net/source-generators/ - -Why I have not tested : later - -https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Hsu.Sg.Proxy&body=https://github.com/hsu-net/source-generators/ - - -19) [https://github.com/Agentew04/CliToolkit]( https://github.com/Agentew04/CliToolkit) , https://github.com/Agentew04/CliToolkit +18) [https://github.com/Agentew04/CliToolkit]( https://github.com/Agentew04/CliToolkit) , https://github.com/Agentew04/CliToolkit Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/Agentew04/CliToolkit&body=https://github.com/Agentew04/CliToolkit -20) [https://github.com/AlexNav73/CoreCraft]( https://github.com/AlexNav73/CoreCraft) , https://github.com/AlexNav73/CoreCraft +19) [https://github.com/AlexNav73/CoreCraft]( https://github.com/AlexNav73/CoreCraft) , https://github.com/AlexNav73/CoreCraft -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/AlexNav73/CoreCraft&body=https://github.com/AlexNav73/CoreCraft -21) [https://github.com/Atoen/TextLocalizer]( https://github.com/Atoen/TextLocalizer) , https://github.com/Atoen/TextLocalizer +20) [https://github.com/Atoen/TextLocalizer]( https://github.com/Atoen/TextLocalizer) , https://github.com/Atoen/TextLocalizer -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/Atoen/TextLocalizer&body=https://github.com/Atoen/TextLocalizer -22) [https://github.com/bjornhellander/TestInheritanceGenerator]( https://github.com/bjornhellander/TestInheritanceGenerator) , https://github.com/bjornhellander/TestInheritanceGenerator +21) [https://github.com/bjornhellander/TestInheritanceGenerator]( https://github.com/bjornhellander/TestInheritanceGenerator) , https://github.com/bjornhellander/TestInheritanceGenerator -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/bjornhellander/TestInheritanceGenerator&body=https://github.com/bjornhellander/TestInheritanceGenerator -23) [https://github.com/borisdj/CsCodeGenerator]( https://github.com/borisdj/CsCodeGenerator) , https://github.com/borisdj/CsCodeGenerator +22) [https://github.com/borisdj/CsCodeGenerator]( https://github.com/borisdj/CsCodeGenerator) , https://github.com/borisdj/CsCodeGenerator Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/borisdj/CsCodeGenerator&body=https://github.com/borisdj/CsCodeGenerator -24) [https://github.com/buchmiet/FastFsm]( https://github.com/buchmiet/FastFsm) , https://github.com/buchmiet/FastFsm +23) [https://github.com/buchmiet/FastFsm]( https://github.com/buchmiet/FastFsm) , https://github.com/buchmiet/FastFsm Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/buchmiet/FastFsm&body=https://github.com/buchmiet/FastFsm -25) [https://github.com/chickensoft-games/LogicBlocks]( https://github.com/chickensoft-games/LogicBlocks) , https://github.com/chickensoft-games/LogicBlocks +24) [https://github.com/chickensoft-games/LogicBlocks]( https://github.com/chickensoft-games/LogicBlocks) , https://github.com/chickensoft-games/LogicBlocks Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/chickensoft-games/LogicBlocks&body=https://github.com/chickensoft-games/LogicBlocks -26) [https://github.com/dgmjr-io/InterfaceGenerator]( https://github.com/dgmjr-io/InterfaceGenerator) , https://github.com/dgmjr-io/InterfaceGenerator +25) [https://github.com/dgmjr-io/InterfaceGenerator]( https://github.com/dgmjr-io/InterfaceGenerator) , https://github.com/dgmjr-io/InterfaceGenerator Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/dgmjr-io/InterfaceGenerator&body=https://github.com/dgmjr-io/InterfaceGenerator -27) [https://github.com/eddievelasquez/IntercodeToolbox]( https://github.com/eddievelasquez/IntercodeToolbox) , https://github.com/eddievelasquez/IntercodeToolbox +26) [https://github.com/eddievelasquez/IntercodeToolbox]( https://github.com/eddievelasquez/IntercodeToolbox) , https://github.com/eddievelasquez/IntercodeToolbox -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/eddievelasquez/IntercodeToolbox&body=https://github.com/eddievelasquez/IntercodeToolbox -28) [https://github.com/GaoNian-NET/MapperToolkit]( https://github.com/GaoNian-NET/MapperToolkit) , https://github.com/GaoNian-NET/MapperToolkit +27) [https://github.com/GaoNian-NET/MapperToolkit]( https://github.com/GaoNian-NET/MapperToolkit) , https://github.com/GaoNian-NET/MapperToolkit Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/GaoNian-NET/MapperToolkit&body=https://github.com/GaoNian-NET/MapperToolkit -29) [https://github.com/inputfalken/Dynatello]( https://github.com/inputfalken/Dynatello) , https://github.com/inputfalken/Dynatello +28) [https://github.com/inputfalken/Dynatello]( https://github.com/inputfalken/Dynatello) , https://github.com/inputfalken/Dynatello -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/inputfalken/Dynatello&body=https://github.com/inputfalken/Dynatello -30) [https://github.com/ionite34/MinimalApiMapper]( https://github.com/ionite34/MinimalApiMapper) , https://github.com/ionite34/MinimalApiMapper +29) [https://github.com/ionite34/MinimalApiMapper]( https://github.com/ionite34/MinimalApiMapper) , https://github.com/ionite34/MinimalApiMapper Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/ionite34/MinimalApiMapper&body=https://github.com/ionite34/MinimalApiMapper -31) [https://github.com/JasonBock/CslaGeneratorSerialization]( https://github.com/JasonBock/CslaGeneratorSerialization) , https://github.com/JasonBock/CslaGeneratorSerialization +30) [https://github.com/JasonBock/CslaGeneratorSerialization]( https://github.com/JasonBock/CslaGeneratorSerialization) , https://github.com/JasonBock/CslaGeneratorSerialization -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/JasonBock/CslaGeneratorSerialization&body=https://github.com/JasonBock/CslaGeneratorSerialization -32) [https://github.com/MarkFl12/BlazorLinks]( https://github.com/MarkFl12/BlazorLinks) , https://github.com/MarkFl12/BlazorLinks - -Why I have not tested : later - -https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/MarkFl12/BlazorLinks&body=https://github.com/MarkFl12/BlazorLinks - - -33) [https://github.com/OrgEleCho/EleCho.Internationalization]( https://github.com/OrgEleCho/EleCho.Internationalization) , https://github.com/OrgEleCho/EleCho.Internationalization +31) [https://github.com/OrgEleCho/EleCho.Internationalization]( https://github.com/OrgEleCho/EleCho.Internationalization) , https://github.com/OrgEleCho/EleCho.Internationalization Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/OrgEleCho/EleCho.Internationalization&body=https://github.com/OrgEleCho/EleCho.Internationalization -34) [https://github.com/stbychkov/AutoLoggerMessage]( https://github.com/stbychkov/AutoLoggerMessage) , https://github.com/stbychkov/AutoLoggerMessage +32) [https://github.com/stbychkov/AutoLoggerMessage]( https://github.com/stbychkov/AutoLoggerMessage) , https://github.com/stbychkov/AutoLoggerMessage -Why I have not tested : later +Why I have not tested : Microsoft have done same feature https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/stbychkov/AutoLoggerMessage&body=https://github.com/stbychkov/AutoLoggerMessage -35) [https://github.com/Stepami/visitor-net]( https://github.com/Stepami/visitor-net) , https://github.com/Stepami/visitor-net +33) [https://github.com/Stepami/visitor-net]( https://github.com/Stepami/visitor-net) , https://github.com/Stepami/visitor-net Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/Stepami/visitor-net&body=https://github.com/Stepami/visitor-net -36) [https://github.com/svee4/RequiredStaticMembers]( https://github.com/svee4/RequiredStaticMembers) , https://github.com/svee4/RequiredStaticMembers +34) [https://github.com/svee4/RequiredStaticMembers]( https://github.com/svee4/RequiredStaticMembers) , https://github.com/svee4/RequiredStaticMembers Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/svee4/RequiredStaticMembers&body=https://github.com/svee4/RequiredStaticMembers -37) [https://github.com/SzymonHalucha/Minerals.AutoCommands]( https://github.com/SzymonHalucha/Minerals.AutoCommands) , https://github.com/SzymonHalucha/Minerals.AutoCommands +35) [https://github.com/SzymonHalucha/Minerals.AutoCommands]( https://github.com/SzymonHalucha/Minerals.AutoCommands) , https://github.com/SzymonHalucha/Minerals.AutoCommands Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/SzymonHalucha/Minerals.AutoCommands&body=https://github.com/SzymonHalucha/Minerals.AutoCommands -38) [https://github.com/Teleopti/Saspect]( https://github.com/Teleopti/Saspect) , https://github.com/Teleopti/Saspect +36) [https://github.com/Teleopti/Saspect]( https://github.com/Teleopti/Saspect) , https://github.com/Teleopti/Saspect Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/Teleopti/Saspect&body=https://github.com/Teleopti/Saspect -39) [https://github.com/TheFo2sh/AsyncFlow]( https://github.com/TheFo2sh/AsyncFlow) , https://github.com/TheFo2sh/AsyncFlow +37) [https://github.com/TheFo2sh/AsyncFlow]( https://github.com/TheFo2sh/AsyncFlow) , https://github.com/TheFo2sh/AsyncFlow -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/TheFo2sh/AsyncFlow&body=https://github.com/TheFo2sh/AsyncFlow -40) [https://github.com/wieslawsoltes/ReactiveGenerator]( https://github.com/wieslawsoltes/ReactiveGenerator) , https://github.com/wieslawsoltes/ReactiveGenerator +38) [https://github.com/wieslawsoltes/ReactiveGenerator]( https://github.com/wieslawsoltes/ReactiveGenerator) , https://github.com/wieslawsoltes/ReactiveGenerator -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=https://github.com/wieslawsoltes/ReactiveGenerator&body=https://github.com/wieslawsoltes/ReactiveGenerator -41) [Intellenum]( https://github.com/SteveDunn/Intellenum) , https://github.com/SteveDunn/Intellenum +39) [Intellenum]( https://github.com/SteveDunn/Intellenum) , https://github.com/SteveDunn/Intellenum Why I have not tested : not understand how to use https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Intellenum&body=https://github.com/SteveDunn/Intellenum -42) [laker]( https://github.com/Lakerfield/Lakerfield.Rpc) , https://github.com/Lakerfield/Lakerfield.Rpc +40) [laker]( https://github.com/Lakerfield/Lakerfield.Rpc) , https://github.com/Lakerfield/Lakerfield.Rpc -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=laker&body=https://github.com/Lakerfield/Lakerfield.Rpc -43) [LoggingDecoratorGenerator]( https://github.com/DavidFineboym/LoggingDecoratorGenerator) , https://github.com/DavidFineboym/LoggingDecoratorGenerator +41) [LoggingDecoratorGenerator]( https://github.com/DavidFineboym/LoggingDecoratorGenerator) , https://github.com/DavidFineboym/LoggingDecoratorGenerator Why I have not tested : Microsoft have done same feature https://github.com/ignatandrei/RSCG_Examples/issues/new?title=LoggingDecoratorGenerator&body=https://github.com/DavidFineboym/LoggingDecoratorGenerator -44) [lucide-blazor]( https://github.com/brecht-vde/lucide-blazor/) , https://github.com/brecht-vde/lucide-blazor/ +42) [lucide-blazor]( https://github.com/brecht-vde/lucide-blazor/) , https://github.com/brecht-vde/lucide-blazor/ Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=lucide-blazor&body=https://github.com/brecht-vde/lucide-blazor/ -45) [ManagedDotnetProfiler]( https://github.com/kevingosse/ManagedDotnetProfiler) , https://github.com/kevingosse/ManagedDotnetProfiler +43) [ManagedDotnetProfiler]( https://github.com/kevingosse/ManagedDotnetProfiler) , https://github.com/kevingosse/ManagedDotnetProfiler -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ManagedDotnetProfiler&body=https://github.com/kevingosse/ManagedDotnetProfiler -46) [Maui.BindableProperty.Generator]( https://github.com/rrmanzano/maui-bindableproperty-generator) , https://github.com/rrmanzano/maui-bindableproperty-generator +44) [Maui.BindableProperty.Generator]( https://github.com/rrmanzano/maui-bindableproperty-generator) , https://github.com/rrmanzano/maui-bindableproperty-generator Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Maui.BindableProperty.Generator&body=https://github.com/rrmanzano/maui-bindableproperty-generator -47) [Minerals.AutoCQRS]( https://github.com/SzymonHalucha/Minerals.AutoCQRS) , https://github.com/SzymonHalucha/Minerals.AutoCQRS +45) [Minerals.AutoCQRS]( https://github.com/SzymonHalucha/Minerals.AutoCQRS) , https://github.com/SzymonHalucha/Minerals.AutoCQRS Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Minerals.AutoCQRS&body=https://github.com/SzymonHalucha/Minerals.AutoCQRS -48) [Minerals.AutoDomain]( https://github.com/SzymonHalucha/Minerals.AutoDomain) , https://github.com/SzymonHalucha/Minerals.AutoDomain +46) [Minerals.AutoDomain]( https://github.com/SzymonHalucha/Minerals.AutoDomain) , https://github.com/SzymonHalucha/Minerals.AutoDomain Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Minerals.AutoDomain&body=https://github.com/SzymonHalucha/Minerals.AutoDomain -49) [MvvmGen]( https://github.com/thomasclaudiushuber/mvvmgen) , https://github.com/thomasclaudiushuber/mvvmgen +47) [MvvmGen]( https://github.com/thomasclaudiushuber/mvvmgen) , https://github.com/thomasclaudiushuber/mvvmgen Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=MvvmGen&body=https://github.com/thomasclaudiushuber/mvvmgen -50) [observable]( https://github.com/notanaverageman/Bindables) , https://github.com/notanaverageman/Bindables +48) [observable]( https://github.com/notanaverageman/Bindables) , https://github.com/notanaverageman/Bindables Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=observable&body=https://github.com/notanaverageman/Bindables -51) [Overloader]( https://github.com/emptycoder/Overloader) , https://github.com/emptycoder/Overloader - -Why I have not tested : later - -https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Overloader&body=https://github.com/emptycoder/Overloader - +49) [PolySharp]( https://github.com/Sergio0694/PolySharp) , https://github.com/Sergio0694/PolySharp -52) [PolySharp]( https://github.com/Sergio0694/PolySharp) , https://github.com/Sergio0694/PolySharp - -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=PolySharp&body=https://github.com/Sergio0694/PolySharp -53) [RazorGen]( https://github.com/dartk/RazorGen) , https://github.com/dartk/RazorGen +50) [RazorGen]( https://github.com/dartk/RazorGen) , https://github.com/dartk/RazorGen Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=RazorGen&body=https://github.com/dartk/RazorGen -54) [SerdeDn]( https://github.com/serdedotnet/serde) , https://github.com/serdedotnet/serde +51) [SerdeDn]( https://github.com/serdedotnet/serde) , https://github.com/serdedotnet/serde Why I have not tested : serializer. Done by MSFT with System.Text.Json https://github.com/ignatandrei/RSCG_Examples/issues/new?title=SerdeDn&body=https://github.com/serdedotnet/serde -55) [SogePoco]( https://github.com/d-p-y/SogePoco) , https://github.com/d-p-y/SogePoco +52) [SogePoco]( https://github.com/d-p-y/SogePoco) , https://github.com/d-p-y/SogePoco -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=SogePoco&body=https://github.com/d-p-y/SogePoco -56) [SourceCrafter.HttpServiceClientGenerator]( https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/) , https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ +53) [SourceCrafter.HttpServiceClientGenerator]( https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/) , https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=SourceCrafter.HttpServiceClientGenerator&body=https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ -57) [ST.NSwag.ServerSourceGenerator]( https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) , https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator +54) [ST.NSwag.ServerSourceGenerator]( https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) , https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ST.NSwag.ServerSourceGenerator&body=https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator -58) [StrongInject]( https://github.com/YairHalberstadt/stronginject/) , https://github.com/YairHalberstadt/stronginject/ +55) [StrongInject]( https://github.com/YairHalberstadt/stronginject/) , https://github.com/YairHalberstadt/stronginject/ Why I have not tested : later https://github.com/ignatandrei/RSCG_Examples/issues/new?title=StrongInject&body=https://github.com/YairHalberstadt/stronginject/ -59) [TeuJson]( https://github.com/Terria-K/TeuJson) , https://github.com/Terria-K/TeuJson +56) [TeuJson]( https://github.com/Terria-K/TeuJson) , https://github.com/Terria-K/TeuJson Why I have not tested : json a class, was done in System.Text.Json https://github.com/ignatandrei/RSCG_Examples/issues/new?title=TeuJson&body=https://github.com/Terria-K/TeuJson -60) [Tinyhand]( https://github.com/archi-Doc/Tinyhand) , https://github.com/archi-Doc/Tinyhand +57) [Tinyhand]( https://github.com/archi-Doc/Tinyhand) , https://github.com/archi-Doc/Tinyhand Why I have not tested : tried, need documentation https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Tinyhand&body=https://github.com/archi-Doc/Tinyhand -61) [TupleOverloadGenerator]( https://github.com/ProphetLamb/TupleOverloadGenerator) , https://github.com/ProphetLamb/TupleOverloadGenerator +58) [TupleOverloadGenerator]( https://github.com/ProphetLamb/TupleOverloadGenerator) , https://github.com/ProphetLamb/TupleOverloadGenerator -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=TupleOverloadGenerator&body=https://github.com/ProphetLamb/TupleOverloadGenerator -62) [TypealizR]( https://github.com/earloc/TypealizR) , https://github.com/earloc/TypealizR +59) [TypealizR]( https://github.com/earloc/TypealizR) , https://github.com/earloc/TypealizR Why I have not tested : depends on Microsoft.Extensions.Localization https://github.com/ignatandrei/RSCG_Examples/issues/new?title=TypealizR&body=https://github.com/earloc/TypealizR -63) [UnitTestBlazor]( https://github.com/bUnit-dev/bUnit) , https://github.com/bUnit-dev/bUnit +60) [UnitTestBlazor]( https://github.com/bUnit-dev/bUnit) , https://github.com/bUnit-dev/bUnit Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=UnitTestBlazor&body=https://github.com/bUnit-dev/bUnit -64) [ValueLink]( https://github.com/archi-Doc/ValueLink) , https://github.com/archi-Doc/ValueLink +61) [ValueLink]( https://github.com/archi-Doc/ValueLink) , https://github.com/archi-Doc/ValueLink -Why I have not tested : later +Why I have not tested : too complicated https://github.com/ignatandrei/RSCG_Examples/issues/new?title=ValueLink&body=https://github.com/archi-Doc/ValueLink -65) [VisitorPatternGenerator]( https://github.com/hikarin522/VisitorPatternGenerator/) , https://github.com/hikarin522/VisitorPatternGenerator/ +62) [VisitorPatternGenerator]( https://github.com/hikarin522/VisitorPatternGenerator/) , https://github.com/hikarin522/VisitorPatternGenerator/ Why I have not tested : issue opened https://github.com/ignatandrei/RSCG_Examples/issues/new?title=VisitorPatternGenerator&body=https://github.com/hikarin522/VisitorPatternGenerator/ -66) [Visor]( https://github.com/Tinkoff/Visor) , https://github.com/Tinkoff/Visor - -Why I have not tested : later - -https://github.com/ignatandrei/RSCG_Examples/issues/new?title=Visor&body=https://github.com/Tinkoff/Visor - - -67) [WrapperValueObject]( https://github.com/martinothamar/WrapperValueObject) , https://github.com/martinothamar/WrapperValueObject +63) [WrapperValueObject]( https://github.com/martinothamar/WrapperValueObject) , https://github.com/martinothamar/WrapperValueObject Why I have not tested : not maintained as in readme https://github.com/ignatandrei/RSCG_Examples/issues/new?title=WrapperValueObject&body=https://github.com/martinothamar/WrapperValueObject -## Do not want to test 110 ( old ISourceGenerator ) +## Do not want to test 111 ( old ISourceGenerator )
Expand @@ -6271,7 +6265,13 @@ Why I have not tested : old ISourceGenerator -110) [Xtz.StronglyTyped]( https://github.com/dev-experience/Xtz.StronglyTyped) , https://github.com/dev-experience/Xtz.StronglyTyped +110) [Visor]( https://github.com/Tinkoff/Visor) , https://github.com/Tinkoff/Visor + +Why I have not tested : archived + + + +111) [Xtz.StronglyTyped]( https://github.com/dev-experience/Xtz.StronglyTyped) , https://github.com/dev-experience/Xtz.StronglyTyped Why I have not tested : old ISourceGenerator diff --git a/later.md b/later.md index 35597556f..378a61266 100644 --- a/later.md +++ b/later.md @@ -1,6 +1,6 @@ # Just later -## Latest Update : 2025-08-13 => 13 August 2025 +## Latest Update : 2025-08-14 => 14 August 2025 @@ -8,265 +8,127 @@ -1) [AdaskoTheBeAsT.Identity.Dapper]( https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper) , https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper +1) [BigMachines]( https://github.com/archi-Doc/BigMachines) , https://github.com/archi-Doc/BigMachines Why I have not tested : later -2) [AttributeFactoryGenerator]( https://github.com/PaulBraetz/AttributeFactoryGenerator) , https://github.com/PaulBraetz/AttributeFactoryGenerator +2) [Dexie]( https://github.com/b-straub/DexieNET) , https://github.com/b-straub/DexieNET Why I have not tested : later -3) [BigMachines]( https://github.com/archi-Doc/BigMachines) , https://github.com/archi-Doc/BigMachines +3) [epj.RouteGenerator]( https://github.com/ewerspej/epj.RouteGenerator) , https://github.com/ewerspej/epj.RouteGenerator Why I have not tested : later -4) [Dexie]( https://github.com/b-straub/DexieNET) , https://github.com/b-straub/DexieNET +4) [FastEndpoints]( https://github.com/FastEndpoints/FastEndpoints) , https://github.com/FastEndpoints/FastEndpoints Why I have not tested : later -5) [epj.RouteGenerator]( https://github.com/ewerspej/epj.RouteGenerator) , https://github.com/ewerspej/epj.RouteGenerator +5) [GRPC-Mock-Server]( https://github.com/cezarypiatek/GRPC-Mock-Server) , https://github.com/cezarypiatek/GRPC-Mock-Server Why I have not tested : later -6) [FastEndpoints]( https://github.com/FastEndpoints/FastEndpoints) , https://github.com/FastEndpoints/FastEndpoints +6) [https://github.com/borisdj/CsCodeGenerator]( https://github.com/borisdj/CsCodeGenerator) , https://github.com/borisdj/CsCodeGenerator Why I have not tested : later -7) [FluentAssertions.Eventual]( https://github.com/mazharenko/FluentAssertions.Eventual) , https://github.com/mazharenko/FluentAssertions.Eventual +7) [https://github.com/buchmiet/FastFsm]( https://github.com/buchmiet/FastFsm) , https://github.com/buchmiet/FastFsm Why I have not tested : later -8) [GRPC-Mock-Server]( https://github.com/cezarypiatek/GRPC-Mock-Server) , https://github.com/cezarypiatek/GRPC-Mock-Server +8) [https://github.com/chickensoft-games/LogicBlocks]( https://github.com/chickensoft-games/LogicBlocks) , https://github.com/chickensoft-games/LogicBlocks Why I have not tested : later -9) [H.NSwag.Generator]( https://github.com/HavenDV/H.NSwag.Generator) , https://github.com/HavenDV/H.NSwag.Generator +9) [https://github.com/ionite34/MinimalApiMapper]( https://github.com/ionite34/MinimalApiMapper) , https://github.com/ionite34/MinimalApiMapper Why I have not tested : later -10) [Hsu.Sg.Proxy]( https://github.com/hsu-net/source-generators/) , https://github.com/hsu-net/source-generators/ +10) [https://github.com/Stepami/visitor-net]( https://github.com/Stepami/visitor-net) , https://github.com/Stepami/visitor-net Why I have not tested : later -11) [https://github.com/AlexNav73/CoreCraft]( https://github.com/AlexNav73/CoreCraft) , https://github.com/AlexNav73/CoreCraft +11) [https://github.com/SzymonHalucha/Minerals.AutoCommands]( https://github.com/SzymonHalucha/Minerals.AutoCommands) , https://github.com/SzymonHalucha/Minerals.AutoCommands Why I have not tested : later -12) [https://github.com/Atoen/TextLocalizer]( https://github.com/Atoen/TextLocalizer) , https://github.com/Atoen/TextLocalizer +12) [https://github.com/Teleopti/Saspect]( https://github.com/Teleopti/Saspect) , https://github.com/Teleopti/Saspect Why I have not tested : later -13) [https://github.com/bjornhellander/TestInheritanceGenerator]( https://github.com/bjornhellander/TestInheritanceGenerator) , https://github.com/bjornhellander/TestInheritanceGenerator +13) [Maui.BindableProperty.Generator]( https://github.com/rrmanzano/maui-bindableproperty-generator) , https://github.com/rrmanzano/maui-bindableproperty-generator Why I have not tested : later -14) [https://github.com/borisdj/CsCodeGenerator]( https://github.com/borisdj/CsCodeGenerator) , https://github.com/borisdj/CsCodeGenerator +14) [Minerals.AutoCQRS]( https://github.com/SzymonHalucha/Minerals.AutoCQRS) , https://github.com/SzymonHalucha/Minerals.AutoCQRS Why I have not tested : later -15) [https://github.com/buchmiet/FastFsm]( https://github.com/buchmiet/FastFsm) , https://github.com/buchmiet/FastFsm +15) [Minerals.AutoDomain]( https://github.com/SzymonHalucha/Minerals.AutoDomain) , https://github.com/SzymonHalucha/Minerals.AutoDomain Why I have not tested : later -16) [https://github.com/chickensoft-games/LogicBlocks]( https://github.com/chickensoft-games/LogicBlocks) , https://github.com/chickensoft-games/LogicBlocks +16) [MvvmGen]( https://github.com/thomasclaudiushuber/mvvmgen) , https://github.com/thomasclaudiushuber/mvvmgen Why I have not tested : later -17) [https://github.com/eddievelasquez/IntercodeToolbox]( https://github.com/eddievelasquez/IntercodeToolbox) , https://github.com/eddievelasquez/IntercodeToolbox +17) [observable]( https://github.com/notanaverageman/Bindables) , https://github.com/notanaverageman/Bindables Why I have not tested : later -18) [https://github.com/inputfalken/Dynatello]( https://github.com/inputfalken/Dynatello) , https://github.com/inputfalken/Dynatello +18) [RazorGen]( https://github.com/dartk/RazorGen) , https://github.com/dartk/RazorGen Why I have not tested : later -19) [https://github.com/ionite34/MinimalApiMapper]( https://github.com/ionite34/MinimalApiMapper) , https://github.com/ionite34/MinimalApiMapper +19) [SourceCrafter.HttpServiceClientGenerator]( https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/) , https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ Why I have not tested : later -20) [https://github.com/JasonBock/CslaGeneratorSerialization]( https://github.com/JasonBock/CslaGeneratorSerialization) , https://github.com/JasonBock/CslaGeneratorSerialization +20) [ST.NSwag.ServerSourceGenerator]( https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) , https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator Why I have not tested : later -21) [https://github.com/MarkFl12/BlazorLinks]( https://github.com/MarkFl12/BlazorLinks) , https://github.com/MarkFl12/BlazorLinks - -Why I have not tested : later - - - -22) [https://github.com/stbychkov/AutoLoggerMessage]( https://github.com/stbychkov/AutoLoggerMessage) , https://github.com/stbychkov/AutoLoggerMessage - -Why I have not tested : later - - - -23) [https://github.com/Stepami/visitor-net]( https://github.com/Stepami/visitor-net) , https://github.com/Stepami/visitor-net - -Why I have not tested : later - - - -24) [https://github.com/SzymonHalucha/Minerals.AutoCommands]( https://github.com/SzymonHalucha/Minerals.AutoCommands) , https://github.com/SzymonHalucha/Minerals.AutoCommands - -Why I have not tested : later - - - -25) [https://github.com/Teleopti/Saspect]( https://github.com/Teleopti/Saspect) , https://github.com/Teleopti/Saspect - -Why I have not tested : later - - - -26) [https://github.com/TheFo2sh/AsyncFlow]( https://github.com/TheFo2sh/AsyncFlow) , https://github.com/TheFo2sh/AsyncFlow - -Why I have not tested : later - - - -27) [https://github.com/wieslawsoltes/ReactiveGenerator]( https://github.com/wieslawsoltes/ReactiveGenerator) , https://github.com/wieslawsoltes/ReactiveGenerator - -Why I have not tested : later - - - -28) [laker]( https://github.com/Lakerfield/Lakerfield.Rpc) , https://github.com/Lakerfield/Lakerfield.Rpc - -Why I have not tested : later - - - -29) [ManagedDotnetProfiler]( https://github.com/kevingosse/ManagedDotnetProfiler) , https://github.com/kevingosse/ManagedDotnetProfiler - -Why I have not tested : later - - - -30) [Maui.BindableProperty.Generator]( https://github.com/rrmanzano/maui-bindableproperty-generator) , https://github.com/rrmanzano/maui-bindableproperty-generator - -Why I have not tested : later - - - -31) [Minerals.AutoCQRS]( https://github.com/SzymonHalucha/Minerals.AutoCQRS) , https://github.com/SzymonHalucha/Minerals.AutoCQRS - -Why I have not tested : later - - - -32) [Minerals.AutoDomain]( https://github.com/SzymonHalucha/Minerals.AutoDomain) , https://github.com/SzymonHalucha/Minerals.AutoDomain - -Why I have not tested : later - - - -33) [MvvmGen]( https://github.com/thomasclaudiushuber/mvvmgen) , https://github.com/thomasclaudiushuber/mvvmgen - -Why I have not tested : later - - - -34) [observable]( https://github.com/notanaverageman/Bindables) , https://github.com/notanaverageman/Bindables - -Why I have not tested : later - - - -35) [Overloader]( https://github.com/emptycoder/Overloader) , https://github.com/emptycoder/Overloader - -Why I have not tested : later - - - -36) [PolySharp]( https://github.com/Sergio0694/PolySharp) , https://github.com/Sergio0694/PolySharp - -Why I have not tested : later - - - -37) [RazorGen]( https://github.com/dartk/RazorGen) , https://github.com/dartk/RazorGen - -Why I have not tested : later - - - -38) [SogePoco]( https://github.com/d-p-y/SogePoco) , https://github.com/d-p-y/SogePoco - -Why I have not tested : later - - - -39) [SourceCrafter.HttpServiceClientGenerator]( https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/) , https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ - -Why I have not tested : later - - - -40) [ST.NSwag.ServerSourceGenerator]( https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) , https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator - -Why I have not tested : later - - - -41) [StrongInject]( https://github.com/YairHalberstadt/stronginject/) , https://github.com/YairHalberstadt/stronginject/ - -Why I have not tested : later - - - -42) [TupleOverloadGenerator]( https://github.com/ProphetLamb/TupleOverloadGenerator) , https://github.com/ProphetLamb/TupleOverloadGenerator - -Why I have not tested : later - - - -43) [ValueLink]( https://github.com/archi-Doc/ValueLink) , https://github.com/archi-Doc/ValueLink - -Why I have not tested : later - - - -44) [Visor]( https://github.com/Tinkoff/Visor) , https://github.com/Tinkoff/Visor +21) [StrongInject]( https://github.com/YairHalberstadt/stronginject/) , https://github.com/YairHalberstadt/stronginject/ Why I have not tested : later diff --git a/v2/Generator/DocusaurusExample.txt b/v2/Generator/DocusaurusExample.txt index d627cd14e..f7d8dfb7e 100644 --- a/v2/Generator/DocusaurusExample.txt +++ b/v2/Generator/DocusaurusExample.txt @@ -97,7 +97,7 @@ This is the CSharp Project that references **{{ Description.Generator.Name }}** ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX - +{{~ if Description.Data.outputFiles.HasFilesGenerated ~}} {{~ for fileContent in Description.Data.outputFiles.generatedFiles ~}} @@ -111,7 +111,7 @@ Those are taken from $(BaseIntermediateOutputPath)\GX {{~ end ~}} - +{{~ end ~}} ## Useful ### Download Example (.NET C#) diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv index bbe943819..0638e8e55 100644 --- a/v2/Generator/all.csv +++ b/v2/Generator/all.csv @@ -224,3 +224,4 @@ Nr,Key,Source,Category 223,JinShil.MixinSourceGenerator, https://github.com/JinShil/JinShil.MixinSourceGenerator,Mixin 224,FactoryGenerator.Abstractions, https://github.com/ivmazurenko/factory-generator,DependencyInjection 225,Schema, https://github.com/MeltyPlayer/Schema,Serializer +226,requiredenum, https://github.com/emptycoder/RequiredEnum,Enum diff --git a/v2/RSCGExamplesData/GeneratorDataRec.json b/v2/RSCGExamplesData/GeneratorDataRec.json index 10db53d43..3faa78c9b 100644 --- a/v2/RSCGExamplesData/GeneratorDataRec.json +++ b/v2/RSCGExamplesData/GeneratorDataRec.json @@ -1359,5 +1359,11 @@ "Category": 16, "dtStart": "2025-08-13T00:00:00", "show": true - } + }, +{ + "ID":"requiredenum", + "Category": 19, + "dtStart": "2025-08-14T00:00:00", + "show": true +} ] \ No newline at end of file diff --git a/v2/RSCGExamplesData/NoExample.json b/v2/RSCGExamplesData/NoExample.json index 529504a96..afbb10ea7 100644 --- a/v2/RSCGExamplesData/NoExample.json +++ b/v2/RSCGExamplesData/NoExample.json @@ -635,11 +635,6 @@ "name": "Dexie https://github.com/b-straub/DexieNET", "why": "later" }, - { - "ID": 134, - "name": "Overloader https://github.com/emptycoder/RequiredEnum", - "why": "later" - }, { "ID": 135, "name": "CsvMole https://github.com/pippinmole/CsvMole.NET", diff --git a/v2/rscg_examples/requiredenum/description.json b/v2/rscg_examples/requiredenum/description.json new file mode 100644 index 000000000..6097c60d8 --- /dev/null +++ b/v2/rscg_examples/requiredenum/description.json @@ -0,0 +1,22 @@ +{ + "generator":{ + "name":"requiredenum", + "nuget":[ + "https://www.nuget.org/packages/requiredenum/" + ], + "link":"https://github.com/emptycoder/RequiredEnum", + "author":"Yaroslav", + "source":"https://github.com/emptycoder/RequiredEnum" + }, + "data":{ + "goodFor":["Raise an error at compile time if not have switch handle case all enums values "], + "csprojDemo":"EnumDemo.csproj", + "csFiles":["Program.cs","RequiredCarTypes.cs"], + "excludeDirectoryGenerated":[""], + "includeAdditionalFiles":[""] + }, + "links":{ + "blog":"", + "video":"" + } +} \ No newline at end of file diff --git a/v2/rscg_examples/requiredenum/nuget.txt b/v2/rscg_examples/requiredenum/nuget.txt new file mode 100644 index 000000000..6054dec55 --- /dev/null +++ b/v2/rscg_examples/requiredenum/nuget.txt @@ -0,0 +1 @@ +RequiredEnum is an open-source analyzer that helps handle all enum values for switch. \ No newline at end of file diff --git a/v2/rscg_examples/requiredenum/readme.txt b/v2/rscg_examples/requiredenum/readme.txt new file mode 100644 index 000000000..b4dd6801a --- /dev/null +++ b/v2/rscg_examples/requiredenum/readme.txt @@ -0,0 +1,36 @@ +

RequiredEnum

+ +RequiredEnum is an open-source analyzer that helps handle all enum values for switch. + +# Installation + +[NuGet](https://www.nuget.org/packages/RequiredEnum/): `dotnet add package requiredenum` + +# Usage + +Just add 'Required' prefix for any name of enum in your project and you will get the error when one of cases weren't handle in a switch statement. + +```csharp +var test = (RequiredNumbers) Random.Shared.Next(0, Enum.GetNames(typeof(RequiredNumbers)).Length); +switch (test) +{ + case RequiredNumbers.Zero: + break; + case RequiredNumbers.One: + break; + default: + throw new ArgumentOutOfRangeException(); +} + +internal enum RequiredNumbers +{ + Zero, + One, + Two +} +``` +This code will throw the error ('Two' case wasn't handle) and it can't be compiled. + +# License + +RequiredEnum distributed under [MIT](./LICENSE) license. diff --git a/v2/rscg_examples/requiredenum/src/.tours/requiredenum.tour b/v2/rscg_examples/requiredenum/src/.tours/requiredenum.tour new file mode 100644 index 000000000..bed869314 --- /dev/null +++ b/v2/rscg_examples/requiredenum/src/.tours/requiredenum.tour @@ -0,0 +1,30 @@ + +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "requiredenum", + "steps": + [ + { + "file": "EnumDemo/EnumDemo.csproj", + "description": "First, we add Nuget [requiredenum](https://www.nuget.org/packages/requiredenum/) in csproj ", + "pattern": "requiredenum" + } + + ,{ + "file": "EnumDemo/RequiredCarTypes.cs", + "description": "File RequiredCarTypes.cs ", + "pattern": "this is the code" + } + + ,{ + "file": "EnumDemo/Program.cs", + "description": "File Program.cs \r\n>> dotnet run --project EnumDemo/EnumDemo.csproj ", + "pattern": "this is the code" + } + + + ], + + "ref": "main" + +} \ No newline at end of file diff --git a/v2/rscg_examples/requiredenum/src/EnumDemo.sln b/v2/rscg_examples/requiredenum/src/EnumDemo.sln new file mode 100644 index 000000000..ace1b5ec0 --- /dev/null +++ b/v2/rscg_examples/requiredenum/src/EnumDemo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36401.2 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnumDemo", "EnumDemo\EnumDemo.csproj", "{9D8848B1-F882-46F9-8036-C1C47BA503F0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9D8848B1-F882-46F9-8036-C1C47BA503F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D8848B1-F882-46F9-8036-C1C47BA503F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D8848B1-F882-46F9-8036-C1C47BA503F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D8848B1-F882-46F9-8036-C1C47BA503F0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {420BBB7E-4EC0-4A41-98F7-E573A6501983} + EndGlobalSection +EndGlobal diff --git a/v2/rscg_examples/requiredenum/src/EnumDemo/EnumDemo.csproj b/v2/rscg_examples/requiredenum/src/EnumDemo/EnumDemo.csproj new file mode 100644 index 000000000..219d0137c --- /dev/null +++ b/v2/rscg_examples/requiredenum/src/EnumDemo/EnumDemo.csproj @@ -0,0 +1,23 @@ + + + + Exe + net9.0 + enable + enable + + + + true + $(BaseIntermediateOutputPath)\GX + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/v2/rscg_examples/requiredenum/src/EnumDemo/Program.cs b/v2/rscg_examples/requiredenum/src/EnumDemo/Program.cs new file mode 100644 index 000000000..f9ae441ec --- /dev/null +++ b/v2/rscg_examples/requiredenum/src/EnumDemo/Program.cs @@ -0,0 +1,27 @@ +// See https://aka.ms/new-console-template for more information +using EnumDemo; + +Console.WriteLine("Hello, World!"); +RequiredCarTypes myCar = RequiredCarTypes.Tesla; +switch(myCar) +{ + //comment any case to see the error in action + case RequiredCarTypes.None: + Console.WriteLine("No car"); + break; + case RequiredCarTypes.Dacia: + Console.WriteLine("Dacia"); + break; + case RequiredCarTypes.Tesla: + Console.WriteLine("Tesla"); + break; + case RequiredCarTypes.BMW: + Console.WriteLine("BMW"); + break; + case RequiredCarTypes.Mercedes: + Console.WriteLine("Mercedes"); + break; + default: + Console.WriteLine("Unknown car"); + break; +} \ No newline at end of file diff --git a/v2/rscg_examples/requiredenum/src/EnumDemo/RequiredCarTypes.cs b/v2/rscg_examples/requiredenum/src/EnumDemo/RequiredCarTypes.cs new file mode 100644 index 000000000..26838eab1 --- /dev/null +++ b/v2/rscg_examples/requiredenum/src/EnumDemo/RequiredCarTypes.cs @@ -0,0 +1,10 @@ + +namespace EnumDemo; +public enum RequiredCarTypes +{ + None, + Dacia , + Tesla , + BMW , + Mercedes , +} diff --git a/v2/rscg_examples/requiredenum/video.json b/v2/rscg_examples/requiredenum/video.json new file mode 100644 index 000000000..96c6be744 --- /dev/null +++ b/v2/rscg_examples/requiredenum/video.json @@ -0,0 +1,39 @@ +{ + "scriptName": "requiredenum", + "steps": +[ + {"typeStep":"exec","arg":"clipchamp.exe launch"}, + {"typeStep":"text","arg": "Welcome to Roslyn Examples"}, + {"typeStep":"text","arg":"If you want to see more examples , see List Of RSCG"}, + {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG"}, + {"typeStep":"text","arg": "My name is Andrei Ignat and I am deeply fond of Roslyn Source Code Generator. "}, + +{"typeStep":"text","arg": "Today I will present requiredenum . Raise an error at compile time if not have switch handle case all enums values ."}, +{"typeStep":"browser","arg":"https://www.nuget.org/packages/requiredenum/"}, +{"typeStep":"text","arg": "The whole example is here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum"}, +{"typeStep":"text","arg": "You can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum#download-example-net--c-"}, +{"typeStep":"text","arg":"Here is the code downloaded "}, +{"typeStep":"exec","arg":"explorer.exe /select,D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\requiredenum\\src\\EnumDemo.sln"}, +{"typeStep":"text","arg": "So , let's start the project with Visual Studio Code "}, +{"typeStep":"stepvscode","arg": "-n D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\requiredenum\\src"}, + +{"typeStep":"text","arg": "To use it ,you will put the Nuget requiredenum into the csproj "}, + +{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\requiredenum\\src\\EnumDemo\\EnumDemo.csproj"}, + +{"typeStep":"text","arg": "And now I will show you an example of using requiredenum"}, + +{"typeStep":"hide","arg": "now execute the tour in VSCode"}, +{"typeStep":"tour", "arg": "src/.tours/"}, +{"typeStep":"text","arg":" And I will execute the project"}, +{"typeStep":"showproj", "arg":"EnumDemo.csproj"}, +{"typeStep":"text","arg":" This concludes the project"}, +{"typeStep":"waitseconds","arg":"30"}, +{"typeStep":"text","arg": "Remember, you can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum#download-example-net--c-", +SpeakTest=" "}, +{"typeStep":"waitseconds","arg":"30"}, +] +} diff --git a/v2/rscg_examples_site/docs/Categories/Enum.md b/v2/rscg_examples_site/docs/Categories/Enum.md index 8bcb8eb3a..fad19917b 100644 --- a/v2/rscg_examples_site/docs/Categories/Enum.md +++ b/v2/rscg_examples_site/docs/Categories/Enum.md @@ -1,6 +1,6 @@

Enum

-Number RSCG: 10 +Number RSCG: 11 1 [CredFetoEnum](/docs/CredFetoEnum) @@ -21,4 +21,6 @@ Number RSCG: 10 9 [NetEscapades.EnumGenerators](/docs/NetEscapades.EnumGenerators) 10 [PMart.Enumeration](/docs/PMart.Enumeration) + + 11 [requiredenum](/docs/requiredenum) \ No newline at end of file diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx index eb6a4604b..6229baad7 100644 --- a/v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx +++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveEnum.mdx @@ -20,6 +20,8 @@ 10 [PMart.Enumeration](/docs/PMart.Enumeration) + 11 [requiredenum](/docs/requiredenum) + ### See category [Enum](/docs/Categories/Enum) diff --git a/v2/rscg_examples_site/docs/NoExamples.md b/v2/rscg_examples_site/docs/NoExamples.md index 323ffa940..80de0a846 100644 --- a/v2/rscg_examples_site/docs/NoExamples.md +++ b/v2/rscg_examples_site/docs/NoExamples.md @@ -8,7 +8,7 @@ title: RSCG Without Examples 1)AdaskoTheBeAsT.Identity.Dapper https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper -Why I have not put example: later +Why I have not put example: too complicated 2)AjaxService.Gen https://github.com/MrAliSalehi/AjaxService @@ -28,7 +28,7 @@ Why I have not put example: old ISourceGenerator 6)AttributeFactoryGenerator https://github.com/PaulBraetz/AttributeFactoryGenerator -Why I have not put example: later +Why I have not put example: too complicated 7)AutoDeconstructable https://github.com/nemesissoft/Nemesis.TextParsers/tree/master/Nemesis.TextParsers.CodeGen/Deconstructable @@ -208,7 +208,7 @@ Why I have not put example: old ISourceGenerator 51)FluentAssertions.Eventual https://github.com/mazharenko/FluentAssertions.Eventual -Why I have not put example: later +Why I have not put example: atchived 52)FluentBuilder https://github.com/StefH/FluentBuilder @@ -248,469 +248,457 @@ Why I have not put example: old ISourceGenerator 61)H.NSwag.Generator https://github.com/HavenDV/H.NSwag.Generator -Why I have not put example: later +Why I have not put example: do not understand 62)Hexa.Protobuf https://github.com/HexaEngine/Hexa.Protobuf Why I have not put example: issue opened -63)Hsu.Sg.Proxy https://github.com/hsu-net/source-generators/ - -Why I have not put example: later - -64)HttpClientCodeGenerator https://github.com/Jalalx/HttpClientCodeGenerator +63)HttpClientCodeGenerator https://github.com/Jalalx/HttpClientCodeGenerator Why I have not put example: old ISourceGenerator -65)https://github.com/Agentew04/CliToolkit https://github.com/Agentew04/CliToolkit +64)https://github.com/Agentew04/CliToolkit https://github.com/Agentew04/CliToolkit Why I have not put example: issue opened -66)https://github.com/AlexNav73/CoreCraft https://github.com/AlexNav73/CoreCraft +65)https://github.com/AlexNav73/CoreCraft https://github.com/AlexNav73/CoreCraft -Why I have not put example: later +Why I have not put example: too complicated -67)https://github.com/Atoen/TextLocalizer https://github.com/Atoen/TextLocalizer +66)https://github.com/Atoen/TextLocalizer https://github.com/Atoen/TextLocalizer -Why I have not put example: later +Why I have not put example: too complicated -68)https://github.com/bjornhellander/TestInheritanceGenerator https://github.com/bjornhellander/TestInheritanceGenerator +67)https://github.com/bjornhellander/TestInheritanceGenerator https://github.com/bjornhellander/TestInheritanceGenerator -Why I have not put example: later +Why I have not put example: too complicated -69)https://github.com/borisdj/CsCodeGenerator https://github.com/borisdj/CsCodeGenerator +68)https://github.com/borisdj/CsCodeGenerator https://github.com/borisdj/CsCodeGenerator Why I have not put example: later -70)https://github.com/buchmiet/FastFsm https://github.com/buchmiet/FastFsm +69)https://github.com/buchmiet/FastFsm https://github.com/buchmiet/FastFsm Why I have not put example: later -71)https://github.com/chickensoft-games/LogicBlocks https://github.com/chickensoft-games/LogicBlocks +70)https://github.com/chickensoft-games/LogicBlocks https://github.com/chickensoft-games/LogicBlocks Why I have not put example: later -72)https://github.com/dgmjr-io/InterfaceGenerator https://github.com/dgmjr-io/InterfaceGenerator +71)https://github.com/dgmjr-io/InterfaceGenerator https://github.com/dgmjr-io/InterfaceGenerator Why I have not put example: issue opened -73)https://github.com/eddievelasquez/IntercodeToolbox https://github.com/eddievelasquez/IntercodeToolbox +72)https://github.com/eddievelasquez/IntercodeToolbox https://github.com/eddievelasquez/IntercodeToolbox -Why I have not put example: later +Why I have not put example: too complicated -74)https://github.com/GaoNian-NET/MapperToolkit https://github.com/GaoNian-NET/MapperToolkit +73)https://github.com/GaoNian-NET/MapperToolkit https://github.com/GaoNian-NET/MapperToolkit Why I have not put example: issue opened -75)https://github.com/inputfalken/Dynatello https://github.com/inputfalken/Dynatello - -Why I have not put example: later - -76)https://github.com/ionite34/MinimalApiMapper https://github.com/ionite34/MinimalApiMapper +74)https://github.com/inputfalken/Dynatello https://github.com/inputfalken/Dynatello -Why I have not put example: later +Why I have not put example: too complicated -77)https://github.com/JasonBock/CslaGeneratorSerialization https://github.com/JasonBock/CslaGeneratorSerialization +75)https://github.com/ionite34/MinimalApiMapper https://github.com/ionite34/MinimalApiMapper Why I have not put example: later -78)https://github.com/MarkFl12/BlazorLinks https://github.com/MarkFl12/BlazorLinks +76)https://github.com/JasonBock/CslaGeneratorSerialization https://github.com/JasonBock/CslaGeneratorSerialization -Why I have not put example: later +Why I have not put example: too complicated -79)https://github.com/nevsnirG/MinimalRichDomain https://github.com/nevsnirG/MinimalRichDomain +77)https://github.com/nevsnirG/MinimalRichDomain https://github.com/nevsnirG/MinimalRichDomain Why I have not put example: old ISourceGenerator -80)https://github.com/OrgEleCho/EleCho.Internationalization https://github.com/OrgEleCho/EleCho.Internationalization +78)https://github.com/OrgEleCho/EleCho.Internationalization https://github.com/OrgEleCho/EleCho.Internationalization Why I have not put example: issue opened -81)https://github.com/ramhari-dev/PropGenAoT https://github.com/ramhari-dev/PropGenAoT +79)https://github.com/ramhari-dev/PropGenAoT https://github.com/ramhari-dev/PropGenAoT Why I have not put example: no readme -82)https://github.com/stbychkov/AutoLoggerMessage https://github.com/stbychkov/AutoLoggerMessage +80)https://github.com/stbychkov/AutoLoggerMessage https://github.com/stbychkov/AutoLoggerMessage -Why I have not put example: later +Why I have not put example: Microsoft have done same feature -83)https://github.com/Stepami/visitor-net https://github.com/Stepami/visitor-net +81)https://github.com/Stepami/visitor-net https://github.com/Stepami/visitor-net Why I have not put example: later -84)https://github.com/svee4/RequiredStaticMembers https://github.com/svee4/RequiredStaticMembers +82)https://github.com/svee4/RequiredStaticMembers https://github.com/svee4/RequiredStaticMembers Why I have not put example: issue opened -85)https://github.com/SzymonHalucha/Minerals.AutoCommands https://github.com/SzymonHalucha/Minerals.AutoCommands +83)https://github.com/SzymonHalucha/Minerals.AutoCommands https://github.com/SzymonHalucha/Minerals.AutoCommands Why I have not put example: later -86)https://github.com/Teleopti/Saspect https://github.com/Teleopti/Saspect +84)https://github.com/Teleopti/Saspect https://github.com/Teleopti/Saspect Why I have not put example: later -87)https://github.com/TheFo2sh/AsyncFlow https://github.com/TheFo2sh/AsyncFlow +85)https://github.com/TheFo2sh/AsyncFlow https://github.com/TheFo2sh/AsyncFlow -Why I have not put example: later +Why I have not put example: too complicated -88)https://github.com/wieslawsoltes/ReactiveGenerator https://github.com/wieslawsoltes/ReactiveGenerator +86)https://github.com/wieslawsoltes/ReactiveGenerator https://github.com/wieslawsoltes/ReactiveGenerator -Why I have not put example: later +Why I have not put example: too complicated -89)HubClientProxyGenerator https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client.SourceGenerator +87)HubClientProxyGenerator https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR.Client.SourceGenerator Why I have not put example: not having nuget, but having IIncrementalGenerator -90)Imp.NET https://github.com/DouglasDwyer/Imp.NET +88)Imp.NET https://github.com/DouglasDwyer/Imp.NET Why I have not put example: old ISourceGenerator -91)Intellenum https://github.com/SteveDunn/Intellenum +89)Intellenum https://github.com/SteveDunn/Intellenum Why I have not put example: not understand how to use -92)InterfaceGenerator https://github.com/daver32/InterfaceGenerator +90)InterfaceGenerator https://github.com/daver32/InterfaceGenerator Why I have not put example: old ISourceGenerator -93)IoTHubClientGenerator https://github.com/alonf/IoTHubClientGenerator +91)IoTHubClientGenerator https://github.com/alonf/IoTHubClientGenerator Why I have not put example: old ISourceGenerator -94)JsonByExampleGenerator https://github.com/hermanussen/JsonByExampleGenerator +92)JsonByExampleGenerator https://github.com/hermanussen/JsonByExampleGenerator Why I have not put example: old ISourceGenerator -95)JsonDeserializeResourceSourceGenerator https://github.com/musictopia2/JsonDeserializeResourceSourceGenerator +93)JsonDeserializeResourceSourceGenerator https://github.com/musictopia2/JsonDeserializeResourceSourceGenerator Why I have not put example: no readme -96)JsonMergePatch https://github.com/ladeak/JsonMergePatch +94)JsonMergePatch https://github.com/ladeak/JsonMergePatch Why I have not put example: old ISourceGenerator -97)JsonSerializerContextGenerator https://github.com/musictopia2/JsonSerializerContextGenerator +95)JsonSerializerContextGenerator https://github.com/musictopia2/JsonSerializerContextGenerator Why I have not put example: no readme -98)JsonSourceGenerator https://github.com/Pilchie/JsonSourceGenerator +96)JsonSourceGenerator https://github.com/Pilchie/JsonSourceGenerator Why I have not put example: not having nuget, but having IIncrementalGenerator -99)JsonSrcGen https://github.com/trampster/JsonSrcGen +97)JsonSrcGen https://github.com/trampster/JsonSrcGen Why I have not put example: old ISourceGenerator -100)kli.Localize https://github.com/kl1mm/localize +98)kli.Localize https://github.com/kl1mm/localize Why I have not put example: old ISourceGenerator -101)laker https://github.com/Lakerfield/Lakerfield.Rpc +99)laker https://github.com/Lakerfield/Lakerfield.Rpc -Why I have not put example: later +Why I have not put example: too complicated -102)lambdajection https://github.com/cythral/lambdajection +100)lambdajection https://github.com/cythral/lambdajection Why I have not put example: old ISourceGenerator -103)Lazysh https://github.com/B1Z0N/LazyshGen +101)Lazysh https://github.com/B1Z0N/LazyshGen Why I have not put example: old ISourceGenerator -104)LoggingDecoratorGenerator https://github.com/DavidFineboym/LoggingDecoratorGenerator +102)LoggingDecoratorGenerator https://github.com/DavidFineboym/LoggingDecoratorGenerator Why I have not put example: Microsoft have done same feature -105)lucide-blazor https://github.com/brecht-vde/lucide-blazor/ +103)lucide-blazor https://github.com/brecht-vde/lucide-blazor/ Why I have not put example: issue opened -106)ManagedDotnetProfiler https://github.com/kevingosse/ManagedDotnetProfiler +104)ManagedDotnetProfiler https://github.com/kevingosse/ManagedDotnetProfiler -Why I have not put example: later +Why I have not put example: too complicated -107)MapDataReader https://github.com/jitbit/MapDataReader +105)MapDataReader https://github.com/jitbit/MapDataReader Why I have not put example: old ISourceGenerator -108)MappingCloningExtensions https://github.com/musictopia2/MappingCloningExtensions +106)MappingCloningExtensions https://github.com/musictopia2/MappingCloningExtensions Why I have not put example: no readme -109)Maui.BindableProperty.Generator https://github.com/rrmanzano/maui-bindableproperty-generator +107)Maui.BindableProperty.Generator https://github.com/rrmanzano/maui-bindableproperty-generator Why I have not put example: later -110)MediatR https://github.com/Burgyn/MMLib.MediatR.Generators +108)MediatR https://github.com/Burgyn/MMLib.MediatR.Generators Why I have not put example: old ISourceGenerator -111)MemberAccessGenerator https://github.com/ufcpp/MemberAccessGenerator +109)MemberAccessGenerator https://github.com/ufcpp/MemberAccessGenerator Why I have not put example: old ISourceGenerator -112)MemoizeSourceGenerator https://github.com/Zoxive/MemoizeSourceGenerator +110)MemoizeSourceGenerator https://github.com/Zoxive/MemoizeSourceGenerator Why I have not put example: old ISourceGenerator -113)Minerals.AutoCQRS https://github.com/SzymonHalucha/Minerals.AutoCQRS +111)Minerals.AutoCQRS https://github.com/SzymonHalucha/Minerals.AutoCQRS Why I have not put example: later -114)Minerals.AutoDomain https://github.com/SzymonHalucha/Minerals.AutoDomain +112)Minerals.AutoDomain https://github.com/SzymonHalucha/Minerals.AutoDomain Why I have not put example: later -115)MiniRazor https://github.com/Tyrrrz/MiniRazor/ +113)MiniRazor https://github.com/Tyrrrz/MiniRazor/ Why I have not put example: archived -116)MockableStaticGenerator https://github.com/HamedFathi/MockableStaticGenerator +114)MockableStaticGenerator https://github.com/HamedFathi/MockableStaticGenerator Why I have not put example: old ISourceGenerator -117)MockGen https://github.com/thomas-girotto/MockGen +115)MockGen https://github.com/thomas-girotto/MockGen Why I have not put example: old ISourceGenerator -118)MockSourceGenerator https://github.com/hermanussen/MockSourceGenerator +116)MockSourceGenerator https://github.com/hermanussen/MockSourceGenerator Why I have not put example: old ISourceGenerator -119)MrMeeseeks.DIE https://github.com/Yeah69/MrMeeseeks.DIE +117)MrMeeseeks.DIE https://github.com/Yeah69/MrMeeseeks.DIE Why I have not put example: old ISourceGenerator -120)MrMeeseeks.ResXToViewModelGenerator https://github.com/Yeah69/MrMeeseeks.ResXToViewModelGenerator +118)MrMeeseeks.ResXToViewModelGenerator https://github.com/Yeah69/MrMeeseeks.ResXToViewModelGenerator Why I have not put example: old ISourceGenerator -121)MrMeeseeks.StaticDelegateGenerator https://github.com/Yeah69/MrMeeseeks.StaticDelegateGenerator +119)MrMeeseeks.StaticDelegateGenerator https://github.com/Yeah69/MrMeeseeks.StaticDelegateGenerator Why I have not put example: old ISourceGenerator -122)MrMeeseeks.Visitor https://github.com/Yeah69/MrMeeseeks.Visitor +120)MrMeeseeks.Visitor https://github.com/Yeah69/MrMeeseeks.Visitor Why I have not put example: old ISourceGenerator -123)MvvmGen https://github.com/thomasclaudiushuber/mvvmgen +121)MvvmGen https://github.com/thomasclaudiushuber/mvvmgen Why I have not put example: later -124)Neon.Roslyn https://www.nuget.org/packages/Neon.Roslyn +122)Neon.Roslyn https://www.nuget.org/packages/Neon.Roslyn Why I have not put example: old ISourceGenerator -125)net_automatic_interface https://github.com/codecentric/net_automatic_interface +123)net_automatic_interface https://github.com/codecentric/net_automatic_interface Why I have not put example: old ISourceGenerator -126)NSourceGenerators https://github.com/NeVeSpl/NSourceGenerators/ +124)NSourceGenerators https://github.com/NeVeSpl/NSourceGenerators/ Why I have not put example: old ISourceGenerator -127)observable https://github.com/notanaverageman/Bindables +125)observable https://github.com/notanaverageman/Bindables Why I have not put example: later -128)Overloader https://github.com/emptycoder/Overloader - -Why I have not put example: later - -129)Pipelines https://github.com/DumplingsDevs/Pipelines/ +126)Pipelines https://github.com/DumplingsDevs/Pipelines/ Why I have not put example: old ISourceGenerator -130)Plastic https://github.com/sang-hyeon/Plastic +127)Plastic https://github.com/sang-hyeon/Plastic Why I have not put example: old ISourceGenerator -131)PolySharp https://github.com/Sergio0694/PolySharp +128)PolySharp https://github.com/Sergio0694/PolySharp -Why I have not put example: later +Why I have not put example: too complicated -132)PrimaryConstructor https://github.com/chaowlert/PrimaryConstructor +129)PrimaryConstructor https://github.com/chaowlert/PrimaryConstructor Why I have not put example: old ISourceGenerator -133)PrimitiveStaticDataGenerator https://github.com/iiweis/PrimitiveStaticDataGenerator +130)PrimitiveStaticDataGenerator https://github.com/iiweis/PrimitiveStaticDataGenerator Why I have not put example: old ISourceGenerator -134)PrintMembersGenerator https://github.com/Youssef1313/PrintMembersGenerator +131)PrintMembersGenerator https://github.com/Youssef1313/PrintMembersGenerator Why I have not put example: old ISourceGenerator -135)ProxyInterfaceGenerator https://github.com/StefH/ProxyInterfaceSourceGenerator +132)ProxyInterfaceGenerator https://github.com/StefH/ProxyInterfaceSourceGenerator Why I have not put example: old ISourceGenerator -136)PureHDF https://github.com/Apollo3zehn/PureHDF +133)PureHDF https://github.com/Apollo3zehn/PureHDF Why I have not put example: old ISourceGenerator -137)RazorGen https://github.com/dartk/RazorGen +134)RazorGen https://github.com/dartk/RazorGen Why I have not put example: later -138)RazorPageRouteGenerator https://github.com/surgicalcoder/RazorPageRouteGenerator +135)RazorPageRouteGenerator https://github.com/surgicalcoder/RazorPageRouteGenerator Why I have not put example: old ISourceGenerator -139)ReForge.Union https://github.com/nalcorso/ReForge.Union +136)ReForge.Union https://github.com/nalcorso/ReForge.Union Why I have not put example: not having nuget, but having IIncrementalGenerator -140)RoslynWeave https://github.com/Jishun/RoslynWeave +137)RoslynWeave https://github.com/Jishun/RoslynWeave Why I have not put example: old ISourceGenerator -141)ScenarioTests https://github.com/koenbeuk/ScenarioTests +138)ScenarioTests https://github.com/koenbeuk/ScenarioTests Why I have not put example: old ISourceGenerator -142)SerdeDn https://github.com/serdedotnet/serde +139)SerdeDn https://github.com/serdedotnet/serde Why I have not put example: serializer. Done by MSFT with System.Text.Json -143)SmallSharp https://github.com/devlooped/SmallSharp +140)SmallSharp https://github.com/devlooped/SmallSharp Why I have not put example: old ISourceGenerator -144)SmartAnnotations https://github.com/fiseni/SmartAnnotations +141)SmartAnnotations https://github.com/fiseni/SmartAnnotations Why I have not put example: old ISourceGenerator -145)SogePoco https://github.com/d-p-y/SogePoco +142)SogePoco https://github.com/d-p-y/SogePoco -Why I have not put example: later +Why I have not put example: too complicated -146)SourceApi https://github.com/alekshura/SourceApi +143)SourceApi https://github.com/alekshura/SourceApi Why I have not put example: old ISourceGenerator -147)SourceConfig https://github.com/alekshura/SourceConfig +144)SourceConfig https://github.com/alekshura/SourceConfig Why I have not put example: old ISourceGenerator -148)SourceCrafter.HttpServiceClientGenerator https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ +145)SourceCrafter.HttpServiceClientGenerator https://github.com/pedro-gilmora/SourceCrafter.HttpServiceClientGenerator/ Why I have not put example: later -149)SourceGeneratorQuery https://github.com/roeibajayo/SourceGeneratorQuery +146)SourceGeneratorQuery https://github.com/roeibajayo/SourceGeneratorQuery Why I have not put example: old ISourceGenerator -150)SourceInject https://github.com/giggio/sourceinject/ +147)SourceInject https://github.com/giggio/sourceinject/ Why I have not put example: old ISourceGenerator -151)SourceMapper https://github.com/alekshura/SourceMapper +148)SourceMapper https://github.com/alekshura/SourceMapper Why I have not put example: old ISourceGenerator -152)SourceMapper https://github.com/paiden/SourceMapper/ +149)SourceMapper https://github.com/paiden/SourceMapper/ Why I have not put example: old ISourceGenerator -153)SqlMarshal https://github.com/kant2002/SqlMarshal +150)SqlMarshal https://github.com/kant2002/SqlMarshal Why I have not put example: old ISourceGenerator -154)ST.NSwag.ServerSourceGenerator https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator +151)ST.NSwag.ServerSourceGenerator https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator Why I have not put example: later -155)StackXML https://github.com/ZingBallyhoo/StackXML +152)StackXML https://github.com/ZingBallyhoo/StackXML Why I have not put example: old ISourceGenerator -156)StaticProxyGenerator https://github.com/robertturner/StaticProxyGenerator +153)StaticProxyGenerator https://github.com/robertturner/StaticProxyGenerator Why I have not put example: old ISourceGenerator -157)StrongInject https://github.com/YairHalberstadt/stronginject/ +154)StrongInject https://github.com/YairHalberstadt/stronginject/ Why I have not put example: later -158)StronglyTypedEmbeddedResources https://github.com/surgicalcoder/StronglyTypedEmbeddedResources +155)StronglyTypedEmbeddedResources https://github.com/surgicalcoder/StronglyTypedEmbeddedResources Why I have not put example: old ISourceGenerator -159)StructPacker https://github.com/RudolfKurka/StructPacker +156)StructPacker https://github.com/RudolfKurka/StructPacker Why I have not put example: old ISourceGenerator -160)Svg https://github.com/wieslawsoltes/Svg.Skia +157)Svg https://github.com/wieslawsoltes/Svg.Skia Why I have not put example: old ISourceGenerator -161)tecli https://github.com/tyevco/TeCLI +158)tecli https://github.com/tyevco/TeCLI Why I have not put example: old ISourceGenerator -162)TeuJson https://github.com/Terria-K/TeuJson +159)TeuJson https://github.com/Terria-K/TeuJson Why I have not put example: json a class, was done in System.Text.Json -163)Thunderboltloc https://github.com/AlyElhaddad/ThunderboltIoc +160)Thunderboltloc https://github.com/AlyElhaddad/ThunderboltIoc Why I have not put example: old ISourceGenerator -164)Tinyhand https://github.com/archi-Doc/Tinyhand +161)Tinyhand https://github.com/archi-Doc/Tinyhand Why I have not put example: tried, need documentation -165)ToString https://github.com/Burgyn/MMLib.ToString +162)ToString https://github.com/Burgyn/MMLib.ToString Why I have not put example: old ISourceGenerator -166)Transplator https://github.com/atifaziz/Transplator +163)Transplator https://github.com/atifaziz/Transplator Why I have not put example: old ISourceGenerator -167)TupleOverloadGenerator https://github.com/ProphetLamb/TupleOverloadGenerator +164)TupleOverloadGenerator https://github.com/ProphetLamb/TupleOverloadGenerator -Why I have not put example: later +Why I have not put example: too complicated -168)TxtToListGenerator https://github.com/musictopia2/TxtToListGenerator +165)TxtToListGenerator https://github.com/musictopia2/TxtToListGenerator Why I have not put example: no readme -169)TypealizR https://github.com/earloc/TypealizR +166)TypealizR https://github.com/earloc/TypealizR Why I have not put example: depends on Microsoft.Extensions.Localization -170)UnitTestBlazor https://github.com/bUnit-dev/bUnit +167)UnitTestBlazor https://github.com/bUnit-dev/bUnit Why I have not put example: issue opened -171)ValueChangedGenerator https://github.com/ufcpp/ValueChangedGenerator +168)ValueChangedGenerator https://github.com/ufcpp/ValueChangedGenerator Why I have not put example: old ISourceGenerator -172)ValueLink https://github.com/archi-Doc/ValueLink +169)ValueLink https://github.com/archi-Doc/ValueLink -Why I have not put example: later +Why I have not put example: too complicated -173)ValueObjectGenerator https://github.com/RyotaMurohoshi/ValueObjectGenerator +170)ValueObjectGenerator https://github.com/RyotaMurohoshi/ValueObjectGenerator Why I have not put example: old ISourceGenerator -174)VisitorPatternGenerator https://github.com/hikarin522/VisitorPatternGenerator/ +171)VisitorPatternGenerator https://github.com/hikarin522/VisitorPatternGenerator/ Why I have not put example: issue opened -175)Visor https://github.com/Tinkoff/Visor +172)Visor https://github.com/Tinkoff/Visor -Why I have not put example: later +Why I have not put example: archived -176)WrapperValueObject https://github.com/martinothamar/WrapperValueObject +173)WrapperValueObject https://github.com/martinothamar/WrapperValueObject Why I have not put example: not maintained as in readme -177)Xtz.StronglyTyped https://github.com/dev-experience/Xtz.StronglyTyped +174)Xtz.StronglyTyped https://github.com/dev-experience/Xtz.StronglyTyped Why I have not put example: old ISourceGenerator diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md b/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md index bd7328732..bc8e9d02c 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md @@ -237,59 +237,6 @@ public class Customer : Person ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX - - - - - -```csharp showLineNumbers -// -using FactoryGenerator.Abstractions; -using Microsoft.Extensions.DependencyInjection; - -namespace AutoGeneratedNamespaceFromFactoryGenerator; - -public static class ServiceCollectionExtensions -{ - public static IServiceCollection RegisterGeneratedFactories(this IServiceCollection self) - { - self.AddTransient, InjectDemo.PersonTypePersonFactoryFactory>(); - - return self; - } -} -``` - - - - -```csharp showLineNumbers -// - -using FactoryGenerator.Abstractions; - -namespace InjectDemo; - -public sealed class PersonTypePersonFactoryFactory : FactoryGenerator.Abstractions.IFactory -{ - - - public PersonTypePersonFactoryFactory() - { - - } - - public InjectDemo.PersonFactory Create(global::InjectDemo.PersonType dependency0) - { - return new InjectDemo.PersonFactory(dependency0); - } -} -``` - - - - - ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md b/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md index 7c11c0ef9..29e75369e 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md @@ -319,67 +319,6 @@ internal class LogData ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX - - - - - -```csharp showLineNumbers - -namespace JinShil.MixinSourceGenerator -{ - /// - /// Specifies the type whose members are to be mixed in to a partial class or struct. - /// - [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple = true)] - public class MixinAttribute : System.Attribute - { - public System.Type Type \{ get; } - public MixinAttribute(System.Type type) - { - Type = type; - } - } -} -``` - - - - -```csharp showLineNumbers - -namespace JinShil.MixinSourceGenerator -{ - /// - /// Used to identify a member that should be ignored when mixing in members from other types. - /// - [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event, AllowMultiple = false)] - public class MixinIgnoreAttribute : System.Attribute - { - public MixinIgnoreAttribute() - \{ } - } -} -``` - - - - -```csharp showLineNumbers -#nullable enable -namespace DemoMixin -{ - partial class Person - { - public void Log(string data) => Console.WriteLine(data); - } -} -``` - - - - - ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md b/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md index dc9129d5c..0d8cd5b6a 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md @@ -419,968 +419,6 @@ public partial class Person : IBinaryConvertible ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX - - - - - -```csharp showLineNumbers -// -#pragma warning disable CS8669 - -using System; -using global::Nino.Core; -using System.Buffers; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static partial class Deserializer - { -#region System.Collections.Generic.IEnumerable> - Generated by transformer TrivialEnumerableUsingAdd - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(ReadOnlySpan data, out System.Collections.Generic.IEnumerable> value) - { - var reader = new Reader(data); - Deserialize(out value, ref reader); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(out System.Collections.Generic.IEnumerable> value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - - if (!reader.ReadCollectionHeader(out var length)) - { - value = default; - return; - } - - #if WEAK_VERSION_TOLERANCE - Reader eleReader; - #endif - - var lst = new System.Collections.Generic.List>(); - for (int i = 0; i < length; i++) - { - #if WEAK_VERSION_TOLERANCE - eleReader = reader.Slice(); - NinoDeserializer.Deserialize(out System.Collections.Generic.KeyValuePair item, ref eleReader); - #else - NinoDeserializer.Deserialize(out System.Collections.Generic.KeyValuePair item, ref reader); - #endif - lst.Add(item); - } - - value = lst; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeRef(ref System.Collections.Generic.IEnumerable> value, ref Reader reader) => Deserialize(out value, ref reader); - -#endregion - -#region System.Collections.Generic.KeyValuePair - Generated by transformer KeyValuePair - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(ReadOnlySpan data, out System.Collections.Generic.KeyValuePair value) - { - var reader = new Reader(data); - Deserialize(out value, ref reader); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(out System.Collections.Generic.KeyValuePair value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - NinoDeserializer.Deserialize(out string k, ref reader); - object v = NinoDeserializer.DeserializeBoxed(ref reader, null); - value = new System.Collections.Generic.KeyValuePair(k, v); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeRef(ref System.Collections.Generic.KeyValuePair value, ref Reader reader) - => Deserialize(out value, ref reader); - -#endregion - -#region byte[] - Generated by transformer Array - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(ReadOnlySpan data, out byte[] value) - { - var reader = new Reader(data); - Deserialize(out value, ref reader); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(out byte[] value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - reader.Read(out value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeRef(ref byte[] value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - reader.ReadRef(ref value); - } - -#endregion - -#region int[] - Generated by transformer Array - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(ReadOnlySpan data, out int[] value) - { - var reader = new Reader(data); - Deserialize(out value, ref reader); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(out int[] value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - reader.Read(out value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeRef(ref int[] value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - reader.ReadRef(ref value); - } - -#endregion - -#region long? - Generated by transformer Nullable - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(ReadOnlySpan data, out long? value) - { - var reader = new Reader(data); - Deserialize(out value, ref reader); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(out long? value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - reader.Read(out bool hasValue); - if (!hasValue) - { - value = default; - return; - } - - reader.UnsafeRead(out long ret); - value = ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeRef(ref long? value, ref Reader reader) => Deserialize(out value, ref reader); - -#endregion - - } -} -``` - - - - -```csharp showLineNumbers -// -using System; -using global::Nino.Core; -using System.Buffers; -using System.ComponentModel; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static partial class Deserializer - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(out string value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - - reader.Read(out value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeRef(ref string value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - - reader.Read(out value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Deserialize(ReadOnlySpan data, out string value) - { - var reader = new Reader(data); - Deserialize(out value, ref reader); - } - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeImpl(out SerializerDemo.Person value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - reader.Read(out int typeId); - if(typeId == TypeCollector.Null) - { - value = default; - return; - } - else if(typeId != NinoTypeConst.SerializerDemo_Person) - throw new InvalidOperationException("Invalid type id"); - - value = new SerializerDemo.Person(); -#if WEAK_VERSION_TOLERANCE - if (!reader.Eof) reader.UnsafeRead(out value.Age); -#else - reader.UnsafeRead(out value.Age); -#endif -#if WEAK_VERSION_TOLERANCE - if (!reader.Eof) reader.Read(out value.Name); -#else - reader.Read(out value.Name); -#endif - } - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void DeserializeImplRef(ref SerializerDemo.Person value, ref Reader reader) - { - #if WEAK_VERSION_TOLERANCE - if (reader.Eof) - { - value = default; - return; - } - #endif - if (Unsafe.IsNullRef(ref value)) - { - DeserializeImpl(out value, ref reader); - return; - } - - reader.Read(out int typeId); - if(typeId == TypeCollector.Null) - { - value = default; - return; - } - else if(typeId != NinoTypeConst.SerializerDemo_Person) - throw new InvalidOperationException("Invalid type id"); - -#if WEAK_VERSION_TOLERANCE - if (!reader.Eof) reader.UnsafeRead(out value.Age); -#else - reader.UnsafeRead(out value.Age); -#endif -#if WEAK_VERSION_TOLERANCE - if (!reader.Eof) reader.Read(out value.Name); -#else - reader.Read(out value.Name); -#endif - } - - - } -} -``` - - - - -```csharp showLineNumbers -// -#pragma warning disable CS8669 -using System; -using global::Nino.Core; -using System.Buffers; -using System.ComponentModel; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static partial class Deserializer - { - private static bool _initialized; - private static object _lock = new object(); - - static Deserializer() - { - Init(); - } - - #if NET5_0_OR_GREATER - [ModuleInitializer] - #endif - public static void Init() - { - lock (_lock) - { - if (_initialized) - return; - - RegisterTrivialDeserializers(); - RegisterCollectionDeserializers(); - _initialized = true; - } - } - - #if UNITY_2020_2_OR_NEWER - #if UNITY_EDITOR - [UnityEditor.InitializeOnLoadMethod] - private static void InitEditor() => Init(); - #endif - - [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void InitRuntime() => Init(); - #endif - - private static void RegisterCollectionDeserializers() - { - NinoTypeMetadata.RegisterDeserializer>>(Deserialize, DeserializeRef, false); - NinoTypeMetadata.RegisterDeserializer>(Deserialize, DeserializeRef, false); - NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); - NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); - NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); - } - private static void RegisterTrivialDeserializers() - { - NinoTypeMetadata.RegisterDeserializer(DeserializeImpl, DeserializeImplRef, false); - NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); - } - } -} -``` - - - - -```csharp showLineNumbers -/* -Base Types: - -Sub Types: - -Top Types: -SerializerDemo.Person - -Circular Types: - - -*/ -``` - - - - -```csharp showLineNumbers -// -#pragma warning disable CS0109, CS8669 -using System; -using System.Runtime.CompilerServices; - - -``` - - - - -```csharp showLineNumbers -// - -using System; -using System.Runtime.CompilerServices; - -#if NET8_0_OR_GREATER -namespace Serializer.NinoGen -{ - internal static partial class PrivateAccessor - { - } -} -#endif -``` - - - - -```csharp showLineNumbers -// -#pragma warning disable CS8669 - -using System; -using global::Nino.Core; -using System.Buffers; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static partial class Serializer - { -#region System.Collections.Generic.IEnumerable> - Generated by transformer TrivialEnumerable - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(this System.Collections.Generic.IEnumerable> value) - { - var bufferWriter = NinoSerializer.GetBufferWriter(); - Serialize(value, bufferWriter); - var ret = bufferWriter.WrittenSpan.ToArray(); - NinoSerializer.ReturnBufferWriter(bufferWriter); - return ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this System.Collections.Generic.IEnumerable> value, INinoBufferWriter bufferWriter) - { - Writer writer = new Writer(bufferWriter); - Serialize(value, ref writer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this System.Collections.Generic.IEnumerable> value, ref Writer writer) - { - if (value == null) - { - writer.Write(TypeCollector.NullCollection); - return; - } - - var serializer_1388A30A = CachedSerializer>.Instance; - - int cnt = 0; - int oldPos = writer.Advance(4); - - foreach (var item in value) - { - cnt++; - #if WEAK_VERSION_TOLERANCE - var pos = writer.Advance(4); - #endif - serializer_1388A30A.Serialize(item, ref writer); - #if WEAK_VERSION_TOLERANCE - writer.PutLength(pos); - #endif - } - - writer.PutBack(TypeCollector.GetCollectionHeader(cnt), oldPos); - } - -#endregion - -#region System.Collections.Generic.KeyValuePair - Generated by transformer KeyValuePair - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(this System.Collections.Generic.KeyValuePair value) - { - var bufferWriter = NinoSerializer.GetBufferWriter(); - Serialize(value, bufferWriter); - var ret = bufferWriter.WrittenSpan.ToArray(); - NinoSerializer.ReturnBufferWriter(bufferWriter); - return ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this System.Collections.Generic.KeyValuePair value, INinoBufferWriter bufferWriter) - { - Writer writer = new Writer(bufferWriter); - Serialize(value, ref writer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this System.Collections.Generic.KeyValuePair value, ref Writer writer) - { - var serializer_C55A10A5 = CachedSerializer.Instance; - var serializer_7A439E91 = CachedSerializer.Instance; - - serializer_C55A10A5.Serialize(value.Key, ref writer); - NinoSerializer.SerializeBoxed(value.Value, ref writer, value.Value?.GetType()); - } - -#endregion - -#region byte[] - Generated by transformer Array - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(this byte[] value) - { - var bufferWriter = NinoSerializer.GetBufferWriter(); - Serialize(value, bufferWriter); - var ret = bufferWriter.WrittenSpan.ToArray(); - NinoSerializer.ReturnBufferWriter(bufferWriter); - return ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this byte[] value, INinoBufferWriter bufferWriter) - { - Writer writer = new Writer(bufferWriter); - Serialize(value, ref writer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this byte[] value, ref Writer writer) - { - writer.Write(value); - } - -#endregion - -#region int[] - Generated by transformer Array - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(this int[] value) - { - var bufferWriter = NinoSerializer.GetBufferWriter(); - Serialize(value, bufferWriter); - var ret = bufferWriter.WrittenSpan.ToArray(); - NinoSerializer.ReturnBufferWriter(bufferWriter); - return ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this int[] value, INinoBufferWriter bufferWriter) - { - Writer writer = new Writer(bufferWriter); - Serialize(value, ref writer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this int[] value, ref Writer writer) - { - writer.Write(value); - } - -#endregion - -#region long? - Generated by transformer Nullable - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(this long? value) - { - var bufferWriter = NinoSerializer.GetBufferWriter(); - Serialize(value, bufferWriter); - var ret = bufferWriter.WrittenSpan.ToArray(); - NinoSerializer.ReturnBufferWriter(bufferWriter); - return ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this long? value, INinoBufferWriter bufferWriter) - { - Writer writer = new Writer(bufferWriter); - Serialize(value, ref writer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this long? value, ref Writer writer) - { - if (!value.HasValue) - { - writer.Write(false); - return; - } - - writer.Write(true); - writer.Write(value.Value); - } - -#endregion - - } -} -``` - - - - -```csharp showLineNumbers -// - -using System; -using System.Buffers; -using System.Threading; -using global::Nino.Core; -using System.ComponentModel; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static partial class Serializer - { - private static readonly ConcurrentQueue BufferWriters = new(); - private static readonly NinoArrayBufferWriter DefaultBufferWriter = new NinoArrayBufferWriter(1024); - private static int _defaultUsed; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static NinoArrayBufferWriter GetBufferWriter() - { - // Fast path - if (Interlocked.CompareExchange(ref _defaultUsed, 1, 0) == 0) - { - return DefaultBufferWriter; - } - - if (BufferWriters.Count == 0) - { - return new NinoArrayBufferWriter(1024); - } - - if (BufferWriters.TryDequeue(out var bufferWriter)) - { - return bufferWriter; - } - - return new NinoArrayBufferWriter(1024); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReturnBufferWriter(NinoArrayBufferWriter bufferWriter) - { -#if NET8_0_OR_GREATER - bufferWriter.ResetWrittenCount(); -#else - bufferWriter.Clear(); -#endif - // Check if the buffer writer is the default buffer writer - if (bufferWriter == DefaultBufferWriter) - { - // Ensure it is in use, otherwise throw an exception - if (Interlocked.CompareExchange(ref _defaultUsed, 0, 1) == 0) - { - throw new InvalidOperationException("The returned buffer writer is not in use."); - } - - return; - } - - BufferWriters.Enqueue(bufferWriter); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(bool value) - { - if (value) - return new byte[1] \{ 1 }; - - return new byte[1] \{ 0 }; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(byte value) - { - return new byte[1] \{ value }; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(string value, ref Writer writer) - { - writer.Write(value); - } - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte[] Serialize(this string value) - { - var bufferWriter = NinoSerializer.GetBufferWriter(); - Serialize(value, bufferWriter); - var ret = bufferWriter.WrittenSpan.ToArray(); - NinoSerializer.ReturnBufferWriter(bufferWriter); - return ret; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Serialize(this string value, INinoBufferWriter bufferWriter) - { - Writer writer = new Writer(bufferWriter); - Serialize(value, ref writer); - } - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void SerializeImpl(SerializerDemo.Person value, ref Writer writer) - { - if(value == null) - { - writer.Write(TypeCollector.Null); - return; - } - - writer.Write(NinoTypeConst.SerializerDemo_Person); - writer.Write(value.Age); - writer.Write(value.Name); - } - - } -} -``` - - - - -```csharp showLineNumbers -// -#pragma warning disable CS8669 -using System; -using global::Nino.Core; -using System.Buffers; -using System.ComponentModel; -using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static partial class Serializer - { - static Serializer() - { - Init(); - } - - private static bool _initialized; - private static object _lock = new object(); - - - #if NET5_0_OR_GREATER - [ModuleInitializer] - #endif - public static void Init() - { - lock (_lock) - { - if (_initialized) - return; - - RegisterTrivialSerializers(); - RegisterCollectionSerializers(); - _initialized = true; - } - } - - #if UNITY_2020_2_OR_NEWER - #if UNITY_EDITOR - [UnityEditor.InitializeOnLoadMethod] - private static void InitEditor() => Init(); - #endif - - [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void InitRuntime() => Init(); - #endif - - private static void RegisterCollectionSerializers() - { - NinoTypeMetadata.RegisterSerializer>>(Serialize, false); - NinoTypeMetadata.RegisterSerializer>(Serialize, false); - NinoTypeMetadata.RegisterSerializer(Serialize, false); - NinoTypeMetadata.RegisterSerializer(Serialize, false); - NinoTypeMetadata.RegisterSerializer(Serialize, false); - } - - private static void RegisterTrivialSerializers() - { - NinoTypeMetadata.RegisterSerializer(SerializeImpl, false); - NinoTypeMetadata.RegisterSerializer(Serialize, false); - } - - } -} -``` - - - - -```csharp showLineNumbers -// - -using System; -using Nino.Core; -using System.Runtime.CompilerServices; - -namespace Serializer.NinoGen -{ - public static class NinoTypeConst - { - private static bool _initialized; - private static object _lock = new object(); - - static NinoTypeConst() - { - Init(); - } - - #if UNITY_2020_2_OR_NEWER - #if UNITY_EDITOR - [UnityEditor.InitializeOnLoadMethod] - private static void InitEditor() => Init(); - #endif - - [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void InitRuntime() => Init(); - #endif - - #if NET5_0_OR_GREATER - [ModuleInitializer] - #endif - public static void Init() - { - lock (_lock) - { - if (_initialized) - return; - _initialized = true; - - NinoTypeMetadata.RegisterType(SerializerDemo_Person); - } - } - - // global::SerializerDemo.Person - public const int SerializerDemo_Person = 192498207; - - } -} -``` - - - - -```csharp showLineNumbers -/* -Type: SerializerDemo.Person -Parents: -Members: - int Age [Ctor: False, Private: False, Property: False, Utf8String: False] - string Name [Ctor: False, Private: False, Property: False, Utf8String: False] - -*/ -``` - - - - -```csharp showLineNumbers -using System; -using schema.binary; - -namespace SerializerDemo; - -public partial class Person { - public void Read(IBinaryReader br) { - br.PushContainerEndianness(Endianness.BigEndian); - this.Age = br.ReadInt32(); - this.Name = br.ReadStringNT(); - br.PopEndianness(); - } -} - -``` - - - - -```csharp showLineNumbers -using System; -using schema.binary; - -namespace SerializerDemo; - -public partial class Person { - public void Write(IBinaryWriter bw) { - bw.PushContainerEndianness(Endianness.BigEndian); - bw.WriteInt32(this.Age); - bw.WriteStringNT(this.Name); - bw.PopEndianness(); - } -} - -``` - - - - - ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md index 8eece553b..215d09adb 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/index.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/index.md @@ -1,7 +1,7 @@ --- sidebar_position: 30 -title: 225 RSCG list by category -description: 225 RSCG list by category +title: 226 RSCG list by category +description: 226 RSCG list by category slug: /rscg-examples --- @@ -689,7 +689,7 @@ import DocCardList from '@theme/DocCardList'; ## Enum
- Expand Enum =>examples:10 + Expand Enum =>examples:11 @@ -740,6 +740,11 @@ import DocCardList from '@theme/DocCardList'; [EnumsEnhanced](/docs/EnumsEnhanced) + + + +[requiredenum](/docs/requiredenum) +
@@ -1653,6 +1658,8 @@ flowchart LR; Enum--> EnumsEnhanced((EnumsEnhanced)) + Enum--> requiredenum((requiredenum)) + Equals--> GeneratorEquals((GeneratorEquals)) Equals--> Equatable.Generator((Equatable.Generator)) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md b/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md new file mode 100644 index 000000000..a76df9a36 --- /dev/null +++ b/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md @@ -0,0 +1,220 @@ +--- +sidebar_position: 2260 +title: 226 - requiredenum +description: Raise an error at compile time if not have switch handle case all enums values +slug: /requiredenum +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import TOCInline from '@theme/TOCInline'; +import SameCategory from '../Categories/_PrimitiveEnum.mdx'; + +# requiredenum by Yaroslav + + + + +## NuGet / site data +[![Nuget](https://img.shields.io/nuget/dt/requiredenum?label=requiredenum)](https://www.nuget.org/packages/requiredenum/) +[![GitHub last commit](https://img.shields.io/github/last-commit/emptycoder/RequiredEnum?label=updated)](https://github.com/emptycoder/RequiredEnum) +![GitHub Repo stars](https://img.shields.io/github/stars/emptycoder/RequiredEnum?style=social) + +## Details + +### Info +:::info + +Name: **requiredenum** + +RequiredEnum is an open-source analyzer that helps handle all enum values for switch. + +Author: Yaroslav + +NuGet: +*https://www.nuget.org/packages/requiredenum/* + + +You can find more details at https://github.com/emptycoder/RequiredEnum + +Source: https://github.com/emptycoder/RequiredEnum + +::: + +### Author +:::note +Yaroslav +![Alt text](https://github.com/emptycoder.png) +::: + +### Original Readme +:::note + +

RequiredEnum

+ +RequiredEnum is an open-source analyzer that helps handle all enum values for switch. + +# Installation + +[NuGet](https://www.nuget.org/packages/RequiredEnum/): `dotnet add package requiredenum` + +# Usage + +Just add 'Required' prefix for any name of enum in your project and you will get the error when one of cases weren't handle in a switch statement. + +```csharp +var test = (RequiredNumbers) Random.Shared.Next(0, Enum.GetNames(typeof(RequiredNumbers)).Length); +switch (test) +{ + case RequiredNumbers.Zero: + break; + case RequiredNumbers.One: + break; + default: + throw new ArgumentOutOfRangeException(); +} + +internal enum RequiredNumbers +{ + Zero, + One, + Two +} +``` +This code will throw the error ('Two' case wasn't handle) and it can't be compiled. + +# License + +RequiredEnum distributed under [MIT](https://github.com/emptycoder/RequiredEnum/LICENSE) license. + + +::: + +### About +:::note + +Raise an error at compile time if not have switch handle case all enums values + + +::: + +## How to use + +### Example (source csproj, source files) + + + + + +This is the CSharp Project that references **requiredenum** +```xml showLineNumbers {16} + + + + Exe + net9.0 + enable + enable + + + + true + $(BaseIntermediateOutputPath)\GX + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + +``` + + + + + + This is the use of **requiredenum** in *Program.cs* + +```csharp showLineNumbers +// See https://aka.ms/new-console-template for more information +using EnumDemo; + +Console.WriteLine("Hello, World!"); +RequiredCarTypes myCar = RequiredCarTypes.Tesla; +switch(myCar) +{ + //comment any case to see the error in action + case RequiredCarTypes.None: + Console.WriteLine("No car"); + break; + case RequiredCarTypes.Dacia: + Console.WriteLine("Dacia"); + break; + case RequiredCarTypes.Tesla: + Console.WriteLine("Tesla"); + break; + case RequiredCarTypes.BMW: + Console.WriteLine("BMW"); + break; + case RequiredCarTypes.Mercedes: + Console.WriteLine("Mercedes"); + break; + default: + Console.WriteLine("Unknown car"); + break; +} +``` + + + + + This is the use of **requiredenum** in *RequiredCarTypes.cs* + +```csharp showLineNumbers + +namespace EnumDemo; +public enum RequiredCarTypes +{ + None, + Dacia , + Tesla , + BMW , + Mercedes , +} + +``` + + + + +### Generated Files + +Those are taken from $(BaseIntermediateOutputPath)\GX +## Useful + +### Download Example (.NET C#) + +:::tip + +[Download Example project requiredenum ](/sources/requiredenum.zip) + +::: + + +### Share requiredenum + + + +https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum + + + diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md index 9e6b21a19..24f975d87 100644 --- a/v2/rscg_examples_site/docs/about.md +++ b/v2/rscg_examples_site/docs/about.md @@ -6,7 +6,7 @@ title: About ## Content You will find here code examples -of 225 Roslyn Source Code Generator (RSCG) +of 226 Roslyn Source Code Generator (RSCG) that can be useful for you. That means, you will write more elegant and concise code - even if the generators code is not always nice to look. ## Are those examples ready for production? diff --git a/v2/rscg_examples_site/docs/indexRSCG.md b/v2/rscg_examples_site/docs/indexRSCG.md index fe04e3000..0852a827e 100644 --- a/v2/rscg_examples_site/docs/indexRSCG.md +++ b/v2/rscg_examples_site/docs/indexRSCG.md @@ -7,9 +7,9 @@ slug: /List-of-RSCG import useBaseUrl from '@docusaurus/useBaseUrl'; -## 225 RSCG with examples in descending chronological order +## 226 RSCG with examples in descending chronological order -This is the list of 225 ( 14 from Microsoft) RSCG with examples +This is the list of 226 ( 14 from Microsoft) RSCG with examples [See by category](/docs/rscg-examples) [See as json](/exports/RSCG.json) [See as Excel](/exports/RSCG.xlsx) @@ -20,6 +20,7 @@ This is the list of 225 ( 14 from Microsoft) RSCG with examples | No | Name | Date | Category | | --------- | ----- | ---- | -------- | +|226| [requiredenum by Yaroslav ](/docs/requiredenum)|2025-08-14 => 14 August 2025 | [Enum](/docs/Categories/Enum) | |225| [Schema by Melty Player ](/docs/Schema)|2025-08-13 => 13 August 2025 | [Serializer](/docs/Categories/Serializer) | |224| [FactoryGenerator.Abstractions by Ivan Mazurenko ](/docs/FactoryGenerator.Abstractions)|2025-08-12 => 12 August 2025 | [DependencyInjection](/docs/Categories/DependencyInjection) | |223| [JinShil.MixinSourceGenerator by Jin Shil ](/docs/JinShil.MixinSourceGenerator)|2025-08-11 => 11 August 2025 | [Mixin](/docs/Categories/Mixin) | diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js index ef1831458..30c485b5f 100644 --- a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js +++ b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js @@ -4,7 +4,7 @@ import styles from './styles.module.css'; const FeatureList = [ { -title: '225 Examples (14 from MSFT)', +title: '226 Examples (14 from MSFT)', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> diff --git a/v2/rscg_examples_site/static/exports/RSCG.json b/v2/rscg_examples_site/static/exports/RSCG.json index f33fa0dfa..6a77683bb 100644 --- a/v2/rscg_examples_site/static/exports/RSCG.json +++ b/v2/rscg_examples_site/static/exports/RSCG.json @@ -1801,6 +1801,14 @@ "Source": "https://github.com/MeltyPlayer/Schema", "Category": "Serializer", "AddedOn": "2025-08-13T00:00:00" + }, + { + "Name": "requiredenum", + "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum", + "NuGet": "https://www.nuget.org/packages/requiredenum/", + "Source": "https://github.com/emptycoder/RequiredEnum", + "Category": "Enum", + "AddedOn": "2025-08-14T00:00:00" } ] } \ No newline at end of file diff --git a/v2/rscg_examples_site/static/exports/RSCG.xlsx b/v2/rscg_examples_site/static/exports/RSCG.xlsx index a7403a231d490576e10c3cb9fb15b795b623320f..de82badf9bef81ea935e8a79cb74fff4d4624832 100644 GIT binary patch delta 912 zcmcZ=-=0t(;LXe;!oa}6!63L?DY`sp)4qKS3=B$)3=I50x*|uvJijPADL+43uOc_6 zx8JevkO7bDdZ9}GOooF2TT>Z@lDO4REaB_Tc%;R5;jyrT!R?#2_0iXUUrqb6cSmB1 z`$9HTU55mNE4vETJ)HIC3A>rE>9q2$>G6xYPke7Yy|KPcZ|TA*lYHCbK2KresZ7_b zn)^xO{G|4dT~GN8f5x5bO48h0#yIbPoMycz%iE1@k280(fAr$Zy~Zf$J^f(^cgU$V z7uIoa4fve%^IOONj|$my56aG5eSE?_CBf>sMd|PE98gFJK54(QXa2sk%&2}n72oh_ z-p0QN82LaxXNvx+@k5<~LBDbHX{LSZ^&7h4ug87#{%POpVQJGFB4orPXep(&G35?_ zr6tRUXNoSGK|Acjj$JoYU7W1Oe(3$p8J}aS|Ne@V6lr%{!nVop{?Zx_op*oA7G?fj z7yIu`ub2AM^Z#G}XMnkZ0UX{d8w7ndfME^7+`#aTFG|fR*4Haa-F!!jjnORC*uu!z z$TTt4$Rf$a$S6fgLEp|sKPWXPu_QA;uQ(&Kpx6#(AS42#++Hl7ETN-OZ<}}6fX8jU zQo;JnNIxm|z)dMHrJgV~`P_8N@tiPa|K`#Y6RTQRIRqYYXxE#|QKup=ccB0K@wD>U zZesdYf^q5apSD@s_T^~^`G3;`Z?wE zksSsrr`*1OZk953H{`Ps$nFVnFZ@048=+(oUt zgg%(nrMspvR%ffq9NF}6(aM$;Vcok-WhDO1zHqfQ_)X`fJ1^DGor-U@e;MdI=XJP| z@5yYvPyUcnzz|bSBQ}lo}?#7>X|SD zd6OsTNi)8lyhcw(0X5Q@7$kt25nv0`p$*43Bd02vC7 g0)KrmM&rq8`kL|}A#_I~w7E@Qr?19Vs0R`O0IB#`j{pDw delta 814 zcmZoqxD{U?;LXe;!oa}6!Ek4#Vzl@1x3BgxFfb@FGBEH1>53fv^8BLgr2PDBy^7qN z-u}~kO$Gw4^-E{&72{c?*ud@E6aBY|soCTL-^-AvpVz)$yW6;2ZF2GFvngzauE%HP zFn+XQYTUNW?RGJv`2BO&HfVm<+&%HN_M*6!>eDwv9G=(zo#A=1wB7CF9Jeir*C!dD zYQH#FwVyBauywa{uRP)_X>zZfJO%xtsl?51;P^#)n3-4~24_oQtdD-VZ_iHyZN$+^;^z7d5Dg2FF z=HB-+>At`9^!&YnFPHrJS^rlaW-tRd3{`o5G;aQ)CCw;ckz`_FW@(aYV47-dVq$DC zSzbqu17sOrRoB+Zt~wg^2mKBk@U+FNeww>XR*^g7re4erzv@Pl(py=%LaK5(=Z`hI zKN98OSQz@~KcF>fd@a`wwPktdf$blHPUkyOiIPJdrosX50F; zopO^qHY3vVW8`565qXRAWe09P(Q^5c`p9V(?^Ls|Hd56lwx2>{z2~iy+)$sg>9Fdf z_>O}+FFs1%uw2siFVnM`dctW5?31fhc>mbcriUgnR=+ZN(;L0|TiD&?PtRY9d1;!fyfJraK>6GWNq?6f7x%wW#{dfxNV>YIH~--;V0wyR zVqg#k($UWOc_pcNo3nL=7&+kyZ*rTS2{Vv4d9R){ Date: Tue, 2 Sep 2025 20:58:43 +0300 Subject: [PATCH 2/3] zip file --- v2/book/examples/requiredenum.html | 54 ++++++++++++++++++ v2/book/list.html | 6 +- v2/book/pandocHTML.yaml | 1 + .../static/sources/requiredenum.zip | Bin 0 -> 1664 bytes 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 v2/book/examples/requiredenum.html create mode 100644 v2/rscg_examples_site/static/sources/requiredenum.zip diff --git a/v2/book/examples/requiredenum.html b/v2/book/examples/requiredenum.html new file mode 100644 index 000000000..4e17e7727 --- /dev/null +++ b/v2/book/examples/requiredenum.html @@ -0,0 +1,54 @@ + +

RSCG nr 226 : requiredenum

+ +

Info

+Nuget : https://www.nuget.org/packages/requiredenum/ + +

You can find more details at : https://github.com/emptycoder/RequiredEnum

+ +

Author :Yaroslav

+ +

Source: https://github.com/emptycoder/RequiredEnum

+ +

About

+ +Raise an error at compile time if not have switch handle case all enums values + +

+ How to use +

+

+ Add reference to the requiredenum in the csproj +

+ + +

This was for me the starting code

+ +
+ I have coded the file Program.cs +
+ +
+ +
+ I have coded the file RequiredCarTypes.cs +
+ +
+

And here are the generated files

+ +

+ You can download the code and this page as pdf from + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/requiredenum + +

+ + +

+ You can see the whole list at + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG + +

+ diff --git a/v2/book/list.html b/v2/book/list.html index 9286814a0..de4756f3f 100644 --- a/v2/book/list.html +++ b/v2/book/list.html @@ -17,7 +17,7 @@

-This is the list of 225 RSCG with examples => +This is the list of 226 RSCG with examples =>

@@ -926,6 +926,10 @@

+ + + +
225 Schema
226requiredenum
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml index faa90a4d7..b85ff81f3 100644 --- a/v2/book/pandocHTML.yaml +++ b/v2/book/pandocHTML.yaml @@ -239,6 +239,7 @@ input-files: - examples/JinShil.MixinSourceGenerator.html - examples/FactoryGenerator.Abstractions.html - examples/Schema.html +- examples/requiredenum.html # or you may use input-file: with a single value # defaults: diff --git a/v2/rscg_examples_site/static/sources/requiredenum.zip b/v2/rscg_examples_site/static/sources/requiredenum.zip new file mode 100644 index 0000000000000000000000000000000000000000..9c66c1ecb814129a7eaf3de6d6822025d5f144f8 GIT binary patch literal 1664 zcmWIWW@Zs#U|`^2m|G_oeV_Ay{7yy&h5{A_1|FcOYhG!tOKNVuUU5#|(#ae1ZW{=+ zJ?FS!&GBjylcJ;77FAwZmzh58%M7x%1dHEX#49!>!z1P5fv=NGUnoBn^*TCH*g8+Z z;`ZIY#~&a6zht+4eeHWUy{Nk{mvZhqd2X8449RFu*)v-A9RFy{}x@>DrAdr7YPv+hh0J8T58- zmA;idJ7>}|m8B9NOnMn4Kl3cnkZWcVS6TRzuX~;Mep)TQJKo2b~0pY+RHU>s@9Zhx2cu?N>X}O_SHH+uQ}=0)syU%_dmF51eQJW zJRNw{)N%uJPkIFZ4gG+Z=WLEv%~k)!w|8Q3~Q#VTa=*ss`7O(mCGd-5``oYis#@}Xf-_Tc{<#%rBq-SO7b7Ou9 z#79S3Ryr%WX!=U*`2Wzu&)`JRJO(qbM>RH17T%BFdN$M^{r-3u&kfK;09@ojm1x5K;t&`6C9dZyjc7DPKKHtZV`nqzwslukMUlfE~9v?h? ziEqcI`d9CCy4F8C=>AFc&RS`frm8#nb$`?L&8*v3pOUdPQb( zpq=j=k;#6$FZU_+UtLgWd*#%%Bi?>{wnaqGS(mNwQ#rz>-&^5pYQ=5}_tBw4<%x~Rc@T5KKFxaATQ%#L zBfn$QGLEYU_VPI9&V4WMkX*3i+uk0-qwYl|HIBR@LXO-kW;oY%sq-KHt@HQ#A=6)~ zfsG1f>x`B?ourq*RD40fyMrsTDB96}-hs`jQmbO31l`LQ@CI*^FQ1%OB-MU?w(Q2K zvmf4(aB$XmzVGw4EsD*>6Shu0!SZF%%+x)vTqh|-?@V7AQ`A{3zfwHV^XIR#U-@LR zw0J)+vHsE*e`4}GcCPPt`QAAyHUof%gvgf~l=gYr+e?C3vg9}S&PrE@l*LRCzM?=$KU6~`7OeR@J^srced~ifq z!f);2jF!)9_}bzh_GNEZQt!4oz4@u8rS_iAF9|b_Ew0`awr-(7{^`{hRTBHZgh~59 z75cl)Hh|&!GO@e|-w)<^A58LUIpz}EYn?YK{e30d$|;u~$rQ3Y5i?ZtY01xikpFVQ}VITV9Z3rjPLQd680i$W?3Qj3AXS-rp7UOzl8DKD$gF{x-(Q+8bDI`6E!eWv>1 zj+sGzX`7t10$da|wr()ltYLc8a-+tQO$u9QOkX`~x;G=opHH8IN)>#jA9-@dg;hgc zWvd1Ixx!Dp?S{3%-IIcYgSs96M8)Yb1b8zti7?kPOvumpF2H!B-RH46}O1Dzbt3gQ6( DQv#@i literal 0 HcmV?d00001 From fd6e1d38bd571cc0c8693ab80fcbf6f8698515f5 Mon Sep 17 00:00:00 2001 From: Andrei Ignat Date: Tue, 2 Sep 2025 21:20:59 +0300 Subject: [PATCH 3/3] repaired generated files --- v2/Generator/DocusaurusExample.txt | 2 +- v2/Generator/MultiGeneratorV2.cs | 4 +- v2/Generator/OutputFiles.cs | 2 + .../FactoryGenerator.Abstractions.md | 51 + .../JinShil.MixinSourceGenerator.md | 59 ++ .../docs/RSCG-Examples/Schema.md | 960 ++++++++++++++++++ .../docs/RSCG-Examples/requiredenum.md | 2 - .../static/exports/RSCG.xlsx | Bin 12295 -> 12295 bytes 8 files changed, 1075 insertions(+), 5 deletions(-) diff --git a/v2/Generator/DocusaurusExample.txt b/v2/Generator/DocusaurusExample.txt index f7d8dfb7e..60b9aff91 100644 --- a/v2/Generator/DocusaurusExample.txt +++ b/v2/Generator/DocusaurusExample.txt @@ -95,9 +95,9 @@ This is the CSharp Project that references **{{ Description.Generator.Name }}** ### Generated Files +{{~ if HasFilesGenerated ~}} Those are taken from $(BaseIntermediateOutputPath)\GX -{{~ if Description.Data.outputFiles.HasFilesGenerated ~}} {{~ for fileContent in Description.Data.outputFiles.generatedFiles ~}} diff --git a/v2/Generator/MultiGeneratorV2.cs b/v2/Generator/MultiGeneratorV2.cs index c34363a8f..148f3ead0 100644 --- a/v2/Generator/MultiGeneratorV2.cs +++ b/v2/Generator/MultiGeneratorV2.cs @@ -924,10 +924,10 @@ private async Task WroteDocusaurus(Description it, string pathDocusaurus) .Where(loop=>loop.Generator?.Name != it.Generator?.Name) .OrderBy(it=>it.Generator?.Name) .ToArray(); - + bool HasFilesGenerated = it?.Data?.outputFiles?.HasFilesGenerated() ?? false; var template = await File.ReadAllTextAsync("DocusaurusExample.txt"); var templateScriban = Scriban.Template.Parse(template); - var output = templateScriban.Render(new {Description=it, otherDesc, category}, member => member.Name); + var output = templateScriban.Render(new {Description=it,HasFilesGenerated, otherDesc, category}, member => member.Name); output = output .Replace(" { ", " \\{ ") .Replace(" } ", " \\} ") diff --git a/v2/Generator/OutputFiles.cs b/v2/Generator/OutputFiles.cs index 98265de4b..f0294133f 100644 --- a/v2/Generator/OutputFiles.cs +++ b/v2/Generator/OutputFiles.cs @@ -39,6 +39,8 @@ public string NameCsproj } public string[]? excludeDirectoryGenerated { get; internal set; } public string[]? includeAdditionalFiles { get; internal set; } + public bool HasFilesGenerated() => generatedFiles?.Length > 0; + public async Task GatherData(string nuget) { diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md b/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md index bc8e9d02c..e1de92444 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/FactoryGenerator.Abstractions.md @@ -237,6 +237,57 @@ public class Customer : Person ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers +// +using FactoryGenerator.Abstractions; +using Microsoft.Extensions.DependencyInjection; + +namespace AutoGeneratedNamespaceFromFactoryGenerator; + +public static class ServiceCollectionExtensions +{ + public static IServiceCollection RegisterGeneratedFactories(this IServiceCollection self) + { + self.AddTransient, InjectDemo.PersonTypePersonFactoryFactory>(); + + return self; + } +} +``` + + + + +```csharp showLineNumbers +// + +using FactoryGenerator.Abstractions; + +namespace InjectDemo; + +public sealed class PersonTypePersonFactoryFactory : FactoryGenerator.Abstractions.IFactory +{ + + + public PersonTypePersonFactoryFactory() + { + + } + + public InjectDemo.PersonFactory Create(global::InjectDemo.PersonType dependency0) + { + return new InjectDemo.PersonFactory(dependency0); + } +} +``` + + + + ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md b/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md index 29e75369e..5bee41d0b 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/JinShil.MixinSourceGenerator.md @@ -319,6 +319,65 @@ internal class LogData ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers + +namespace JinShil.MixinSourceGenerator +{ + /// + /// Specifies the type whose members are to be mixed in to a partial class or struct. + /// + [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple = true)] + public class MixinAttribute : System.Attribute + { + public System.Type Type \{ get; } + public MixinAttribute(System.Type type) + { + Type = type; + } + } +} +``` + + + + +```csharp showLineNumbers + +namespace JinShil.MixinSourceGenerator +{ + /// + /// Used to identify a member that should be ignored when mixing in members from other types. + /// + [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event, AllowMultiple = false)] + public class MixinIgnoreAttribute : System.Attribute + { + public MixinIgnoreAttribute() + \{ } + } +} +``` + + + + +```csharp showLineNumbers +#nullable enable +namespace DemoMixin +{ + partial class Person + { + public void Log(string data) => Console.WriteLine(data); + } +} +``` + + + + ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md b/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md index 0d8cd5b6a..3fded74e6 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/Schema.md @@ -419,6 +419,966 @@ public partial class Person : IBinaryConvertible ### Generated Files Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers +// +#pragma warning disable CS8669 + +using System; +using global::Nino.Core; +using System.Buffers; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static partial class Deserializer + { +#region System.Collections.Generic.IEnumerable> - Generated by transformer TrivialEnumerableUsingAdd + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(ReadOnlySpan data, out System.Collections.Generic.IEnumerable> value) + { + var reader = new Reader(data); + Deserialize(out value, ref reader); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(out System.Collections.Generic.IEnumerable> value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + + if (!reader.ReadCollectionHeader(out var length)) + { + value = default; + return; + } + + #if WEAK_VERSION_TOLERANCE + Reader eleReader; + #endif + + var lst = new System.Collections.Generic.List>(); + for (int i = 0; i < length; i++) + { + #if WEAK_VERSION_TOLERANCE + eleReader = reader.Slice(); + NinoDeserializer.Deserialize(out System.Collections.Generic.KeyValuePair item, ref eleReader); + #else + NinoDeserializer.Deserialize(out System.Collections.Generic.KeyValuePair item, ref reader); + #endif + lst.Add(item); + } + + value = lst; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeRef(ref System.Collections.Generic.IEnumerable> value, ref Reader reader) => Deserialize(out value, ref reader); + +#endregion + +#region System.Collections.Generic.KeyValuePair - Generated by transformer KeyValuePair + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(ReadOnlySpan data, out System.Collections.Generic.KeyValuePair value) + { + var reader = new Reader(data); + Deserialize(out value, ref reader); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(out System.Collections.Generic.KeyValuePair value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + NinoDeserializer.Deserialize(out string k, ref reader); + object v = NinoDeserializer.DeserializeBoxed(ref reader, null); + value = new System.Collections.Generic.KeyValuePair(k, v); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeRef(ref System.Collections.Generic.KeyValuePair value, ref Reader reader) + => Deserialize(out value, ref reader); + +#endregion + +#region byte[] - Generated by transformer Array + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(ReadOnlySpan data, out byte[] value) + { + var reader = new Reader(data); + Deserialize(out value, ref reader); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(out byte[] value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + reader.Read(out value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeRef(ref byte[] value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + reader.ReadRef(ref value); + } + +#endregion + +#region int[] - Generated by transformer Array + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(ReadOnlySpan data, out int[] value) + { + var reader = new Reader(data); + Deserialize(out value, ref reader); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(out int[] value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + reader.Read(out value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeRef(ref int[] value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + reader.ReadRef(ref value); + } + +#endregion + +#region long? - Generated by transformer Nullable + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(ReadOnlySpan data, out long? value) + { + var reader = new Reader(data); + Deserialize(out value, ref reader); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(out long? value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + reader.Read(out bool hasValue); + if (!hasValue) + { + value = default; + return; + } + + reader.UnsafeRead(out long ret); + value = ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeRef(ref long? value, ref Reader reader) => Deserialize(out value, ref reader); + +#endregion + + } +} +``` + + + + +```csharp showLineNumbers +// +using System; +using global::Nino.Core; +using System.Buffers; +using System.ComponentModel; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static partial class Deserializer + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(out string value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + + reader.Read(out value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeRef(ref string value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + + reader.Read(out value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Deserialize(ReadOnlySpan data, out string value) + { + var reader = new Reader(data); + Deserialize(out value, ref reader); + } + + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeImpl(out SerializerDemo.Person value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + reader.Read(out int typeId); + if(typeId == TypeCollector.Null) + { + value = default; + return; + } + else if(typeId != NinoTypeConst.SerializerDemo_Person) + throw new InvalidOperationException("Invalid type id"); + + value = new SerializerDemo.Person(); +#if WEAK_VERSION_TOLERANCE + if (!reader.Eof) reader.UnsafeRead(out value.Age); +#else + reader.UnsafeRead(out value.Age); +#endif +#if WEAK_VERSION_TOLERANCE + if (!reader.Eof) reader.Read(out value.Name); +#else + reader.Read(out value.Name); +#endif + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void DeserializeImplRef(ref SerializerDemo.Person value, ref Reader reader) + { + #if WEAK_VERSION_TOLERANCE + if (reader.Eof) + { + value = default; + return; + } + #endif + if (Unsafe.IsNullRef(ref value)) + { + DeserializeImpl(out value, ref reader); + return; + } + + reader.Read(out int typeId); + if(typeId == TypeCollector.Null) + { + value = default; + return; + } + else if(typeId != NinoTypeConst.SerializerDemo_Person) + throw new InvalidOperationException("Invalid type id"); + +#if WEAK_VERSION_TOLERANCE + if (!reader.Eof) reader.UnsafeRead(out value.Age); +#else + reader.UnsafeRead(out value.Age); +#endif +#if WEAK_VERSION_TOLERANCE + if (!reader.Eof) reader.Read(out value.Name); +#else + reader.Read(out value.Name); +#endif + } + + + } +} +``` + + + + +```csharp showLineNumbers +// +#pragma warning disable CS8669 +using System; +using global::Nino.Core; +using System.Buffers; +using System.ComponentModel; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static partial class Deserializer + { + private static bool _initialized; + private static object _lock = new object(); + + static Deserializer() + { + Init(); + } + + #if NET5_0_OR_GREATER + [ModuleInitializer] + #endif + public static void Init() + { + lock (_lock) + { + if (_initialized) + return; + + RegisterTrivialDeserializers(); + RegisterCollectionDeserializers(); + _initialized = true; + } + } + + #if UNITY_2020_2_OR_NEWER + #if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] + private static void InitEditor() => Init(); + #endif + + [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void InitRuntime() => Init(); + #endif + + private static void RegisterCollectionDeserializers() + { + NinoTypeMetadata.RegisterDeserializer>>(Deserialize, DeserializeRef, false); + NinoTypeMetadata.RegisterDeserializer>(Deserialize, DeserializeRef, false); + NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); + NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); + NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); + } + private static void RegisterTrivialDeserializers() + { + NinoTypeMetadata.RegisterDeserializer(DeserializeImpl, DeserializeImplRef, false); + NinoTypeMetadata.RegisterDeserializer(Deserialize, DeserializeRef, false); + } + } +} +``` + + + + +```csharp showLineNumbers +/* +Base Types: + +Sub Types: + +Top Types: +SerializerDemo.Person + +Circular Types: + + +*/ +``` + + + + +```csharp showLineNumbers +// +#pragma warning disable CS0109, CS8669 +using System; +using System.Runtime.CompilerServices; + + +``` + + + + +```csharp showLineNumbers +// + +using System; +using System.Runtime.CompilerServices; + +#if NET8_0_OR_GREATER +namespace Serializer.NinoGen +{ + internal static partial class PrivateAccessor + { + } +} +#endif +``` + + + + +```csharp showLineNumbers +// +#pragma warning disable CS8669 + +using System; +using global::Nino.Core; +using System.Buffers; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static partial class Serializer + { +#region System.Collections.Generic.IEnumerable> - Generated by transformer TrivialEnumerable + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(this System.Collections.Generic.IEnumerable> value) + { + var bufferWriter = NinoSerializer.GetBufferWriter(); + Serialize(value, bufferWriter); + var ret = bufferWriter.WrittenSpan.ToArray(); + NinoSerializer.ReturnBufferWriter(bufferWriter); + return ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this System.Collections.Generic.IEnumerable> value, INinoBufferWriter bufferWriter) + { + Writer writer = new Writer(bufferWriter); + Serialize(value, ref writer); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this System.Collections.Generic.IEnumerable> value, ref Writer writer) + { + if (value == null) + { + writer.Write(TypeCollector.NullCollection); + return; + } + + var serializer_1388A30A = CachedSerializer>.Instance; + + int cnt = 0; + int oldPos = writer.Advance(4); + + foreach (var item in value) + { + cnt++; + #if WEAK_VERSION_TOLERANCE + var pos = writer.Advance(4); + #endif + serializer_1388A30A.Serialize(item, ref writer); + #if WEAK_VERSION_TOLERANCE + writer.PutLength(pos); + #endif + } + + writer.PutBack(TypeCollector.GetCollectionHeader(cnt), oldPos); + } + +#endregion + +#region System.Collections.Generic.KeyValuePair - Generated by transformer KeyValuePair + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(this System.Collections.Generic.KeyValuePair value) + { + var bufferWriter = NinoSerializer.GetBufferWriter(); + Serialize(value, bufferWriter); + var ret = bufferWriter.WrittenSpan.ToArray(); + NinoSerializer.ReturnBufferWriter(bufferWriter); + return ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this System.Collections.Generic.KeyValuePair value, INinoBufferWriter bufferWriter) + { + Writer writer = new Writer(bufferWriter); + Serialize(value, ref writer); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this System.Collections.Generic.KeyValuePair value, ref Writer writer) + { + var serializer_C55A10A5 = CachedSerializer.Instance; + var serializer_7A439E91 = CachedSerializer.Instance; + + serializer_C55A10A5.Serialize(value.Key, ref writer); + NinoSerializer.SerializeBoxed(value.Value, ref writer, value.Value?.GetType()); + } + +#endregion + +#region byte[] - Generated by transformer Array + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(this byte[] value) + { + var bufferWriter = NinoSerializer.GetBufferWriter(); + Serialize(value, bufferWriter); + var ret = bufferWriter.WrittenSpan.ToArray(); + NinoSerializer.ReturnBufferWriter(bufferWriter); + return ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this byte[] value, INinoBufferWriter bufferWriter) + { + Writer writer = new Writer(bufferWriter); + Serialize(value, ref writer); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this byte[] value, ref Writer writer) + { + writer.Write(value); + } + +#endregion + +#region int[] - Generated by transformer Array + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(this int[] value) + { + var bufferWriter = NinoSerializer.GetBufferWriter(); + Serialize(value, bufferWriter); + var ret = bufferWriter.WrittenSpan.ToArray(); + NinoSerializer.ReturnBufferWriter(bufferWriter); + return ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this int[] value, INinoBufferWriter bufferWriter) + { + Writer writer = new Writer(bufferWriter); + Serialize(value, ref writer); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this int[] value, ref Writer writer) + { + writer.Write(value); + } + +#endregion + +#region long? - Generated by transformer Nullable + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(this long? value) + { + var bufferWriter = NinoSerializer.GetBufferWriter(); + Serialize(value, bufferWriter); + var ret = bufferWriter.WrittenSpan.ToArray(); + NinoSerializer.ReturnBufferWriter(bufferWriter); + return ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this long? value, INinoBufferWriter bufferWriter) + { + Writer writer = new Writer(bufferWriter); + Serialize(value, ref writer); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this long? value, ref Writer writer) + { + if (!value.HasValue) + { + writer.Write(false); + return; + } + + writer.Write(true); + writer.Write(value.Value); + } + +#endregion + + } +} +``` + + + + +```csharp showLineNumbers +// + +using System; +using System.Buffers; +using System.Threading; +using global::Nino.Core; +using System.ComponentModel; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static partial class Serializer + { + private static readonly ConcurrentQueue BufferWriters = new(); + private static readonly NinoArrayBufferWriter DefaultBufferWriter = new NinoArrayBufferWriter(1024); + private static int _defaultUsed; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static NinoArrayBufferWriter GetBufferWriter() + { + // Fast path + if (Interlocked.CompareExchange(ref _defaultUsed, 1, 0) == 0) + { + return DefaultBufferWriter; + } + + if (BufferWriters.Count == 0) + { + return new NinoArrayBufferWriter(1024); + } + + if (BufferWriters.TryDequeue(out var bufferWriter)) + { + return bufferWriter; + } + + return new NinoArrayBufferWriter(1024); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ReturnBufferWriter(NinoArrayBufferWriter bufferWriter) + { +#if NET8_0_OR_GREATER + bufferWriter.ResetWrittenCount(); +#else + bufferWriter.Clear(); +#endif + // Check if the buffer writer is the default buffer writer + if (bufferWriter == DefaultBufferWriter) + { + // Ensure it is in use, otherwise throw an exception + if (Interlocked.CompareExchange(ref _defaultUsed, 0, 1) == 0) + { + throw new InvalidOperationException("The returned buffer writer is not in use."); + } + + return; + } + + BufferWriters.Enqueue(bufferWriter); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(bool value) + { + if (value) + return new byte[1] \{ 1 }; + + return new byte[1] \{ 0 }; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(byte value) + { + return new byte[1] \{ value }; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(string value, ref Writer writer) + { + writer.Write(value); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte[] Serialize(this string value) + { + var bufferWriter = NinoSerializer.GetBufferWriter(); + Serialize(value, bufferWriter); + var ret = bufferWriter.WrittenSpan.ToArray(); + NinoSerializer.ReturnBufferWriter(bufferWriter); + return ret; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Serialize(this string value, INinoBufferWriter bufferWriter) + { + Writer writer = new Writer(bufferWriter); + Serialize(value, ref writer); + } + + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void SerializeImpl(SerializerDemo.Person value, ref Writer writer) + { + if(value == null) + { + writer.Write(TypeCollector.Null); + return; + } + + writer.Write(NinoTypeConst.SerializerDemo_Person); + writer.Write(value.Age); + writer.Write(value.Name); + } + + } +} +``` + + + + +```csharp showLineNumbers +// +#pragma warning disable CS8669 +using System; +using global::Nino.Core; +using System.Buffers; +using System.ComponentModel; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static partial class Serializer + { + static Serializer() + { + Init(); + } + + private static bool _initialized; + private static object _lock = new object(); + + + #if NET5_0_OR_GREATER + [ModuleInitializer] + #endif + public static void Init() + { + lock (_lock) + { + if (_initialized) + return; + + RegisterTrivialSerializers(); + RegisterCollectionSerializers(); + _initialized = true; + } + } + + #if UNITY_2020_2_OR_NEWER + #if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] + private static void InitEditor() => Init(); + #endif + + [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void InitRuntime() => Init(); + #endif + + private static void RegisterCollectionSerializers() + { + NinoTypeMetadata.RegisterSerializer>>(Serialize, false); + NinoTypeMetadata.RegisterSerializer>(Serialize, false); + NinoTypeMetadata.RegisterSerializer(Serialize, false); + NinoTypeMetadata.RegisterSerializer(Serialize, false); + NinoTypeMetadata.RegisterSerializer(Serialize, false); + } + + private static void RegisterTrivialSerializers() + { + NinoTypeMetadata.RegisterSerializer(SerializeImpl, false); + NinoTypeMetadata.RegisterSerializer(Serialize, false); + } + + } +} +``` + + + + +```csharp showLineNumbers +// + +using System; +using Nino.Core; +using System.Runtime.CompilerServices; + +namespace Serializer.NinoGen +{ + public static class NinoTypeConst + { + private static bool _initialized; + private static object _lock = new object(); + + static NinoTypeConst() + { + Init(); + } + + #if UNITY_2020_2_OR_NEWER + #if UNITY_EDITOR + [UnityEditor.InitializeOnLoadMethod] + private static void InitEditor() => Init(); + #endif + + [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void InitRuntime() => Init(); + #endif + + #if NET5_0_OR_GREATER + [ModuleInitializer] + #endif + public static void Init() + { + lock (_lock) + { + if (_initialized) + return; + _initialized = true; + + NinoTypeMetadata.RegisterType(SerializerDemo_Person); + } + } + + // global::SerializerDemo.Person + public const int SerializerDemo_Person = 192498207; + + } +} +``` + + + + +```csharp showLineNumbers +/* +Type: SerializerDemo.Person +Parents: +Members: + int Age [Ctor: False, Private: False, Property: False, Utf8String: False] + string Name [Ctor: False, Private: False, Property: False, Utf8String: False] + +*/ +``` + + + + +```csharp showLineNumbers +using System; +using schema.binary; + +namespace SerializerDemo; + +public partial class Person { + public void Read(IBinaryReader br) { + br.PushContainerEndianness(Endianness.BigEndian); + this.Age = br.ReadInt32(); + this.Name = br.ReadStringNT(); + br.PopEndianness(); + } +} + +``` + + + + +```csharp showLineNumbers +using System; +using schema.binary; + +namespace SerializerDemo; + +public partial class Person { + public void Write(IBinaryWriter bw) { + bw.PushContainerEndianness(Endianness.BigEndian); + bw.WriteInt32(this.Age); + bw.WriteStringNT(this.Name); + bw.PopEndianness(); + } +} + +``` + + + + ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md b/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md index a76df9a36..691a34622 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/requiredenum.md @@ -192,8 +192,6 @@ public enum RequiredCarTypes ### Generated Files - -Those are taken from $(BaseIntermediateOutputPath)\GX ## Useful ### Download Example (.NET C#) diff --git a/v2/rscg_examples_site/static/exports/RSCG.xlsx b/v2/rscg_examples_site/static/exports/RSCG.xlsx index de82badf9bef81ea935e8a79cb74fff4d4624832..0746547d4a7a25bee6ddba2c839a5326330ff87e 100644 GIT binary patch delta 641 zcmZoqXiumQ@MdNaVPN3kU}#>Y6s`09-=2L83=B$)3=I50x*|uvJijPADL+43uOc_6 zxBo0(lYu}>{L-7d#r{lZkTWri`^uRWxnN?M=XS0B{HrU%^EVq$K5PCnZNuCh3)7v~ zHI&S0a9F<5Xr1N*saF@d%u?-A%0EpvzUX>n-{TyO1-$hO&o4>2yC~FVnOy9dtWROB z6~Eky-Uo)>QDVD&(sPo|lF(xZKi@z7biI&Yq|SqiTkjnA%yAYibog<`rO;>j>f%j4 z(_cn~Z+>aRme2Q}pZ)6Ai#wESx4t+eeI$9g)15PGUrM&<6#s1Q`m}j_4FjrQPsKNU znz!-a0Y;|gRhthm>1c3(Lcrqu2cgYhw4@mY5)CYq%*+f;O$^gaOe~BnCd=!{ft5_z z(4{@uRY#-#eBL1gp7wavPqn4NTvIv^q)v|&)E5Z)-k&j9gHPJ#HedCUy-bY0!c)s` zq^h5`zdhgXWW4A&xbyRFLQE`_hY z2&+Ghp2%NS6ejy=Y0RmqD^K5yx%ai;Q_ERV)R4NVH~--;U}}h9Vqg#k($UWOc_pcN vo3nL=7{MU|N;Z>Q^-O^wIeCwsC5Za2=K>GU$)w%cK|8ar|$^>u)`MJ delta 641 zcmZoqXiumQ@MdNaVPN3kU=Uoc6kQ&)Y2Q8u1_mWY1_pj0U6G?-o?n!ml%JoiSCO03 z+wa(S$biRny-+28Cd0vit*MMcN!;oumhkmvJksL3@L1Tv;Py@1`si!Fucm$3yCX5h zeIc8vu0w*sm0bnv9?p96gx$>7bXs}W^!P>HC%!kH-dNwJw{+o@NxtoIpQo_#RHkcI z&HW^Ceo}kKuBUv4KjY4IC28(0W1ROtPP5*V`K{ysM}_RU2W4ljK0e`|l3?}RqV#un4k)AqpR`}uGk@P%W>mkPif{Nd zZ{xoMj7);dHy>cq(cl1uz{&6YU;Vaoo^r6(p8|EWW4Ei1yhcbUpa{F{B@YHRSD&P#V* zs-HU*-)jFd(09)3a3kN7*?OP+H_4rwx8W}fYDnGGoB!|^Ff~LlF)#=N>1gNtypq(s v&Dpv_jNlLfC7a2udZxgToV-WR5=4F1bAgBFWM_RtM99_XJAf4I)As}b`JE0U