RedHerring.Clues 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RedHerring.Clues --version 1.1.0                
NuGet\Install-Package RedHerring.Clues -Version 1.1.0                
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="RedHerring.Clues" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RedHerring.Clues --version 1.1.0                
#r "nuget: RedHerring.Clues, 1.1.0"                
#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.
// Install RedHerring.Clues as a Cake Addin
#addin nuget:?package=RedHerring.Clues&version=1.1.0

// Install RedHerring.Clues as a Cake Tool
#tool nuget:?package=RedHerring.Clues&version=1.1.0                

Red Herring Clues

Nuget

Simple definition system for your data-driven project.

Accessing Definition

Use Definitions or IDefinitions, depending on how much access you need.

IEnumerable<T> GetAll<T>() where T : ADefinition;

Returns all definitions of the given type.

T Get<T>(CompositeId id) where T : ADefinition;

Returns the definition of the given type, with the specified id.

bool TryGet<T>(CompositeId id, out T definition) where T : ADefinition;

Returns true if the definition of the given type, with the specified id, exists.

bool Contains<T>(CompositeId id) where T : ADefinition;

Returns true if the definition of the given type, with the specified id, exists.

T Default<T>() where T : ADefinition;

Returns the default definition of the given type. If no definition is marked as default, it will return null.

Loading Definitions

To use Clues in your project, all you need to do is create an instance of Definitions. Loading and creation of definitions is up to you (you may want to deserialize from XML, JSON, etc.). Once they are deserialized, you just need to feed them into the Definitions instance to

var indexer = new DefinitionIndexer();
var loader = new DefinitionLoader(indexer);

// add one or more assemblies to indexer and let it process them
var assembly = AssemblyWithYourDefinitions;
indexer.AddAssembly(assembly);
indexer.Index();

// process definitions
var definitions = new Definitions();
definitions.Load(loader);

CompositeId

Id that consists of 2 parts, Primary and Secondary, both of which are a uint internally. It is up to you, how you use this, even using all 8 bytes as a single Id is fine.. It comes with a property drawer, for easier editing. Both parts of the id are visually represented by 4 characters, with values between 0-255.

A Definition

Basic definition type from which all of the other definitions need to inherit if ADefinition. It contains some basic properties:

  • IsDefault - It this the default definition for the type?
  • Id - The CompositeId used to identify this definition.

You will need to override the Init method to create a game-ready definition from raw deserialized data. Feel free to raise an exception during Init, ideally one that derives from FailedToInitializeDefinitionException.

Definition Type Attribute

Attribute to use on your custom definition type, in order to have it registered as another definition type, in addition to its own. The current types need to derived from the specified type.

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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.

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
2.0.0 116 9/16/2023
1.1.0 108 9/16/2023
1.0.0 121 9/16/2023