CardSourceGenerator 1.3.5

dotnet add package CardSourceGenerator --version 1.3.5
                    
NuGet\Install-Package CardSourceGenerator -Version 1.3.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CardSourceGenerator" Version="1.3.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CardSourceGenerator" Version="1.3.5" />
                    
Directory.Packages.props
<PackageReference Include="CardSourceGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CardSourceGenerator --version 1.3.5
                    
#r "nuget: CardSourceGenerator, 1.3.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CardSourceGenerator@1.3.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CardSourceGenerator&version=1.3.5
                    
Install as a Cake Addin
#tool nuget:?package=CardSourceGenerator&version=1.3.5
                    
Install as a Cake Tool

CardSourceGenerator

This is an analyzer for generating types based on Yu-Gi-Oh card names. This allows card name errors (e.g., typos) to be detected by the compiler (i.e., using the wrong card name throws a compilation error). You can access these card names via YGOCards.CardNameMap or by going YGOCards.[YourCardName].

  1. CardSourceGenerator
  2. YGOHandAnalysisFramework
  3. AdvancedDeckBuilder

How To Install

This repository is available as a NuGet package.

  1. Add the analyzer to your project. It can be a project reference or a package (as a package is much easier).
  2. Then, you need to provide the card data. Currently, the only supported format is the JSON data provided by YGOProDeck.com (no affiliation), available via their API endpoint.
  3. Add the JSON data to your project by downloading the JSON file from YGOProDeck, then adding it to your project (I usually add a folder called CardData and put it in there).
  4. Next, you must tell the analyzer where the card data is. This can be done by editing the .csproj file with this property:
<ItemGroup>
	<AdditionalFiles Include="CardData\*.json" />
</ItemGroup>
  1. I also include the JSON files in the .gitignore by including:
/{Project Folder}/CardData/*.json
  1. If you want to include the data with your output so you can use it at runtime (e.g., loading attributes, types, attack points, etc.), you can also add this to the .csproj:
<ItemGroup>
  <AdditionalFiles Update="CardData\*.json">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </AdditionalFiles>
</ItemGroup>

How To Use

Building your project will run the analyzer. If you're using Visual Studio, you can view these files by going Solution Explorer → Your Project Here → DependenciesAnalyzersCardSourceGeneratorCardSourceGenerator.SourceGenerator. You will have access to the YGOCards static class and the following types:

  1. YGOCards.StartingDeckLocation
  2. YGOCards.IYGOCard
  3. YGOCards.YGOCardName

You will also have access to properties whose names are based on every Yu-Gi-Oh! card provided in all of the JSON card data files. You can view these in YGOCards.Names.{FileNameHere}.g.cs. These can be accessed by going YGOCards.{CardNameHere}.

Only the names are provided by the source generator, but you can also load more data (e.g., attack points, attributes, etc.) via helpers methods in the YGOCards static class. An example method is YGOCards.LoadCardDataFromYgoPro(string path) located in YGOCards.CardData.g.cs. Where these files are located depends on how you go about it, but I copy the JSON files with my build output (see step 6 in "How To Install") and I use this helper method:

public static class CardDataLoader
{
    public static IEnumerable<YGOCards.IYGOCard> LoadCardData()
    {
        var path = Path.Combine(Environment.CurrentDirectory, "CardData");
        var files = Directory.GetFiles(path, "*.json");
        return YGOCards
            .LoadAllCardDataFromYgoPro(files)
            .Values;
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.5 258 10/16/2025
1.3.4 232 8/30/2025
1.3.3 208 8/30/2025
1.3.3-alpha4 179 8/19/2025
1.3.3-alpha3 160 8/19/2025
1.3.3-alpha2 163 8/19/2025
1.3.2 370 4/14/2025
1.3.1 312 3/23/2025
1.2.7 306 3/23/2025