2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-04-29 06:48:41 +00:00
This commit is contained in:
2026-04-05 12:35:27 +03:00
parent 44983d7784
commit c7d095ea96
17 changed files with 546 additions and 732 deletions
+8 -27
View File
@@ -117,30 +117,6 @@ namespace Esiur.Proxy
}
}
// var code = @$"using Esiur.Resource;
//using Esiur.Core;
//#nullable enable
//namespace {ci.ClassSymbol.ContainingNamespace.ToDisplayString()} {{
//";
// if (IsInterfaceImplemented(ci, classes))
// code += $"public partial class {ci.Name} {{\r\n";
// else
// {
// code +=
//$@" public partial class {ci.Name} : IResource {{
// public virtual Instance? Instance {{ get; set; }}
// public virtual event DestroyedEvent? OnDestroy;
// public virtual void Destroy() {{ OnDestroy?.Invoke(this); }}
//";
// if (!ci.HasTrigger)
// code += "\tpublic virtual AsyncReply<bool> Trigger(ResourceTrigger trigger) => new AsyncReply<bool>(true);\r\n\r\n";
// }
foreach (var f in ci.Fields)
{
var givenName = f.GetAttributes().FirstOrDefault(x => x.AttributeClass?.Name == "ExportAttribute")?.ConstructorArguments.FirstOrDefault().Value as string;
@@ -156,12 +132,17 @@ namespace Esiur.Proxy
if (f.Type.Name.StartsWith("ResourceEventHandler") || f.Type.Name.StartsWith("CustomResourceEventHandler"))
{
code.AppendLine($"public event {f.Type} {pn};");
code.AppendLine($"\tpublic event {f.Type} {pn};");
}
else
{
code.AppendLine($"\t{attrs}\r\n\t public {f.Type} {pn} {{ \r\n\t\t get => {fn}; \r\n\t\t set {{ \r\n\t\t this.{fn} = value; \r\n\t\t Instance?.Modified(); \r\n\t\t}}\r\n\t}}\r\n");
code.AppendLine($"\tpublic {f.Type} {pn} {{");
code.AppendLine($"\t\t get => {fn};");
code.AppendLine($"\t\t set {{");
code.AppendLine($"\t\t this.{fn} = value;");
code.AppendLine($"\t\t Instance?.Modified();");
code.AppendLine($"\t\t}}");
code.AppendLine($"\t}}");
}
}