изменение названия атрибута

This commit is contained in:
2025-02-04 20:57:04 +03:00
parent d732510a9f
commit f0f8460632
11 changed files with 15 additions and 13 deletions
@@ -102,23 +102,25 @@ namespace {Namespace}
.OfType<IMethodSymbol>();
Console.WriteLine(methodBody.Select(i => i.ToDisplayString()));
var originalName = className;
// Build up the source code
className = className.TrimStart('I') + "RemoteEndpoint";
var code = $@"// <auto-generated/>
using System;
using mROA.Implementation;
using System.Collections.Generic;
namespace {namespaceName};
partial class {className} (int id, ISerialisationModule.IFrontendSerialisationModule serialisationModule) : ITestParameter, IRemoteObject
partial class {className} (int id, ISerialisationModule.IFrontendSerialisationModule serialisationModule) : {originalName}, IRemoteObject
{{
public int Id => id;
}}
";
// Add the source code to the compilation.
context.AddSource($"{className}.g.cs", SourceText.From(code, Encoding.UTF8));
// context.AddSource($"{className}.g.cs", SourceText.From(code, Encoding.UTF8));
}
}
}
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1888db3522e2880c8ef7146ee78cc413905212c4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d732510a9fde122ff874ca08ed8c0f85b5fe6c02")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
+1 -1
View File
@@ -2,7 +2,7 @@
namespace mROA.Example;
[SharedObjectInterafce]
[SharedObjectInterface]
public interface ITestController
{
void A();
+1 -1
View File
@@ -2,7 +2,7 @@ using mROA.Implementation;
namespace mROA.Example;
[SharedObjectInterafce]
[SharedObjectInterface]
public interface ITestParameter
{
public int Test();
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Example")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1888db3522e2880c8ef7146ee78cc413905212c4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d732510a9fde122ff874ca08ed8c0f85b5fe6c02")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Example")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Example")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1888db3522e2880c8ef7146ee78cc413905212c4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d732510a9fde122ff874ca08ed8c0f85b5fe6c02")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1,3 +0,0 @@
namespace mROA.Implementation;
public class SharedObjectInterafceAttribute : Attribute;
@@ -0,0 +1,3 @@
namespace mROA.Implementation;
public class SharedObjectInterfaceAttribute : Attribute;
+1 -1
View File
@@ -27,7 +27,7 @@ public class ContextRepository : IContextRepository
_singletons =
types.ToFrozenDictionary(
t => t.GetInterfaces().FirstOrDefault(i =>
i.GetCustomAttributes(typeof(SharedObjectInterafceAttribute), true).Length > 0)!.GetHashCode(),
i.GetCustomAttributes(typeof(SharedObjectInterfaceAttribute), true).Length > 0)!.GetHashCode(),
Activator.CreateInstance);
}
+1 -1
View File
@@ -27,7 +27,7 @@ public class MethodRepository : IMethodRepository
public void CollectForAssembly(Assembly assembly)
{
var types = assembly.GetTypes().Where(i => i.IsInterface && i.GetCustomAttributes(typeof(SharedObjectInterafceAttribute), true).Length > 0);
var types = assembly.GetTypes().Where(i => i.IsInterface && i.GetCustomAttributes(typeof(SharedObjectInterfaceAttribute), true).Length > 0);
foreach (var type in types)
{
foreach (var method in type.GetMethods())
+1 -1
View File
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1888db3522e2880c8ef7146ee78cc413905212c4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d732510a9fde122ff874ca08ed8c0f85b5fe6c02")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]