CodeWriter and pain

This commit is contained in:
ThomasCharester committed 2026-01-20 20:38:20 +03:00
1 parent a409054750
commit 85ac63425c
89 files changed
+1439 -1461

No files matched your search

@@ -1,26 +1,26 @@
using System.Collections.Generic;
using Entities;
namespace InfraGens.Sample;
public class Examples
{
// Create generated entities, based on DDD.UbiquitousLanguageRegistry.txt
public object[] CreateEntities()
{
return new object[]
{
new Customer(),
new Employee(),
new Product(),
new Shop(),
new Stock()
};
}
// Execute generated method Report
public IEnumerable<string> CreateEntityReport(SampleEntity entity)
{
return entity.Report();
}
}
// using System.Collections.Generic;
// using Entities;
//
// namespace InfraGens.Sample;
//
// public class Examples
// {
// // Create generated entities, based on DDD.UbiquitousLanguageRegistry.txt
// public object[] CreateEntities()
// {
// return new object[]
// {
// new Customer(),
// new Employee(),
// new Product(),
// new Shop(),
// new Stock()
// };
// }
//
// // Execute generated method Report
// public IEnumerable<string> CreateEntityReport(SampleEntity entity)
// {
// return entity.Report();
// }
// }
@@ -1,12 +1,56 @@
using Generators;
using System;
namespace InfraGens.Sample;
[Config("Configs/Camera/CameraConfig")]
public class GameCamera
{
[ToConfig] public int Camera;
}
public class StateMachine : Attribute
{
public Type StateMachineContextType;
public Type StateMachineEnumType;
// This code will not compile until you build the project with the Source Generators
public StateMachine(Type stateMachineContextType, Type stateMachineEnumType)
{
StateMachineContextType = stateMachineContextType;
StateMachineEnumType = stateMachineEnumType;
}
}
[Report]
public partial class SampleEntity
public class State : Attribute
{
public Type StateEnum;
public Type StateMachineContext;
public bool SilentBitch; // Поэтому нейминг переменных очень важен
public State(Type stateEnum, Type stateMachineContext, bool silentBitch = false)
{
StateEnum = stateEnum;
StateMachineContext = stateMachineContext;
SilentBitch = silentBitch;
}
}
public class StateRaisingEvent : Attribute
{
}
public class Config : Attribute
{
public bool Multiple;
public string MenuName;
public Config(string menuName, bool multiple = false)
{
Multiple = multiple;
MenuName = menuName;
}
}
public class ToConfig : Attribute
{
}
public class SceneIdEnum : Attribute
{
public int Id { get; } = 42;
public string? Name { get; } = "Sample";
}
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("InfraGens.Sample")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a3cd3e86a161e3ee450256b1b37c6a4583c70840")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a4090547509ba65f8ba7b22442c10d06c15217e0")]
[assembly: System.Reflection.AssemblyProductAttribute("InfraGens.Sample")]
[assembly: System.Reflection.AssemblyTitleAttribute("InfraGens.Sample")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
ff49a1d065da3858c1224dae22c001fae5c9d17e1737f7b26cef44c567a20d60
ef1fde298251b87291e3f53f6d50441cec1268cfc54dba8a1b093bc8be99164e
@@ -9,3 +9,14 @@ A:\Projects\Infra\Assets\SourceGeneration\InfraGens\InfraGens\InfraGens.Sample\o
A:\Projects\Infra\Assets\SourceGeneration\InfraGens\InfraGens\InfraGens.Sample\obj\Debug\net8.0\refint\InfraGens.Sample.dll
A:\Projects\Infra\Assets\SourceGeneration\InfraGens\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.pdb
A:\Projects\Infra\Assets\SourceGeneration\InfraGens\InfraGens\InfraGens.Sample\obj\Debug\net8.0\ref\InfraGens.Sample.dll
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.GeneratedMSBuildEditorConfig.editorconfig
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.AssemblyInfoInputs.cache
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.AssemblyInfo.cs
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.csproj.CoreCompileInputs.cache
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.dll
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\refint\InfraGens.Sample.dll
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\InfraGens.Sample.pdb
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\bin\Debug\net8.0\InfraGens.Sample.deps.json
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\bin\Debug\net8.0\InfraGens.Sample.dll
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\bin\Debug\net8.0\InfraGens.Sample.pdb
A:\Projects\Infra\Assets\SourceGeneration\InfraGens~\InfraGens\InfraGens.Sample\obj\Debug\net8.0\ref\InfraGens.Sample.dll