|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Text; |
4 | | - |
5 | | -namespace ProgrammerAl.SourceGenerators.PublicInterfaceGenerator.Attributes; |
6 | | - |
7 | | -[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] |
8 | | -public class GenerateInterfaceAttribute : Attribute |
9 | | -{ |
10 | | - /// <summary> |
11 | | - /// Set this to override the default interface name. Or leave it null to use the class name with an 'I' prepended to it. |
12 | | - /// </summary> |
13 | | - public string? InterfaceName { get; set; } |
14 | | - |
15 | | - /// <summary> |
16 | | - /// Set this to override the namespace to generate the interface in. By default, it will be the same as the class. |
17 | | - /// </summary> |
18 | | - public string? Namespace { get; set; } |
19 | | - |
20 | | - /// <summary> |
21 | | - /// Set this to specify the interfaces the generated interface will inherit from. For example, IDisposable. |
22 | | - /// This should be a syntax-valid list as you would type it out normally because it will be concatenated directly into the interface definition. |
23 | | - /// For example: ""MyNamespace.MyInterface1, MyNamespace.MyInterface2"" |
24 | | - /// </summary> |
25 | | - public string? Interfaces { get; set; } |
26 | | - |
27 | | - /// <summary> |
28 | | - /// Set this to specify the generated interface inherits from System.IDisposable. |
29 | | - /// This will be appended to the list of interfaces the generated interface inherits from. |
30 | | - /// This is in addition to the <see cref="Interfaces"/> property. |
31 | | - /// If you are also specifying interfaces with the <see cref="Interfaces"/> property, |
32 | | - /// either set this to false and include "System.IDisposable" in the <see cref="Interfaces"/> property string, |
33 | | - /// or set this to true and don't include "System.IDisposable" in the <see cref="Interfaces"/> string. |
34 | | - /// Failure to do this will result in System.IDisposable being appended to the generated interface twice. |
35 | | - /// </summary> |
36 | | - public bool IsIDisposable { get; set; } |
37 | | - |
38 | | - /// <summary> |
39 | | - /// Set this to specify the generated interface inherits from <see cref="System.IAsyncDisposable"/>. |
40 | | - /// This is in addition to the <see cref="Interfaces"/> property. |
41 | | - /// If you are also specifying interfaces with the <see cref="Interfaces"/> property, |
42 | | - /// either set this to false and include "System.IAsyncDisposable" in the <see cref="Interfaces"/> property string, |
43 | | - /// or set this to true and don't include "System.IAsyncDisposable" in the <see cref="Interfaces"/> string. |
44 | | - /// Failure to do this will result in System.IAsyncDisposable being appended to the generated interface twice. |
45 | | - /// </summary> |
46 | | - public bool IsIAsyncDisposable { get; set; } |
47 | | - |
48 | | - public static class Constants |
49 | | - { |
50 | | - public const string GenerateInterfaceAttributeName = nameof(GenerateInterfaceAttribute); |
51 | | - public static string GenerateInterfaceAttributeNameSpace = typeof(GenerateInterfaceAttribute).Namespace; |
52 | | - public static string GenerateInterfaceAttributeFullName = typeof(GenerateInterfaceAttribute).FullName; |
53 | | - |
54 | | - public const string ExcludeFromGeneratedInterfaceAttributeName = "ExcludeFromGeneratedInterfaceAttribute"; |
55 | | - |
56 | | - public const string AttributeProperty_InterfaceName = nameof(InterfaceName); |
57 | | - public const string AttributeProperty_NamespaceName = nameof(Namespace); |
58 | | - public const string AttributeProperty_Interfaces = nameof(Interfaces); |
59 | | - public const string AttributeProperty_IsIDisposable = nameof(IsIDisposable); |
60 | | - public const string AttributeProperty_IsIAsyncDisposable = nameof(IsIAsyncDisposable); |
61 | | - } |
62 | | -} |
| 1 | +//using System; |
| 2 | +//using System.Collections.Generic; |
| 3 | +//using System.Text; |
| 4 | + |
| 5 | +//namespace ProgrammerAl.SourceGenerators.PublicInterfaceGenerator.Attributes; |
| 6 | + |
| 7 | +//[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] |
| 8 | +//public class GenerateInterfaceAttribute : Attribute |
| 9 | +//{ |
| 10 | +// /// <summary> |
| 11 | +// /// Set this to override the default interface name. Or leave it null to use the class name with an 'I' prepended to it. |
| 12 | +// /// </summary> |
| 13 | +// public string? InterfaceName { get; set; } |
| 14 | + |
| 15 | +// /// <summary> |
| 16 | +// /// Set this to override the namespace to generate the interface in. By default, it will be the same as the class. |
| 17 | +// /// </summary> |
| 18 | +// public string? Namespace { get; set; } |
| 19 | + |
| 20 | +// /// <summary> |
| 21 | +// /// Set this to specify the interfaces the generated interface will inherit from. For example, IDisposable. |
| 22 | +// /// This should be a syntax-valid list as you would type it out normally because it will be concatenated directly into the interface definition. |
| 23 | +// /// For example: ""MyNamespace.MyInterface1, MyNamespace.MyInterface2"" |
| 24 | +// /// </summary> |
| 25 | +// public string? Interfaces { get; set; } |
| 26 | + |
| 27 | +// /// <summary> |
| 28 | +// /// Set this to specify the generated interface inherits from System.IDisposable. |
| 29 | +// /// This will be appended to the list of interfaces the generated interface inherits from. |
| 30 | +// /// This is in addition to the <see cref="Interfaces"/> property. |
| 31 | +// /// If you are also specifying interfaces with the <see cref="Interfaces"/> property, |
| 32 | +// /// either set this to false and include "System.IDisposable" in the <see cref="Interfaces"/> property string, |
| 33 | +// /// or set this to true and don't include "System.IDisposable" in the <see cref="Interfaces"/> string. |
| 34 | +// /// Failure to do this will result in System.IDisposable being appended to the generated interface twice. |
| 35 | +// /// </summary> |
| 36 | +// public bool IsIDisposable { get; set; } |
| 37 | + |
| 38 | +// /// <summary> |
| 39 | +// /// Set this to specify the generated interface inherits from <see cref="System.IAsyncDisposable"/>. |
| 40 | +// /// This is in addition to the <see cref="Interfaces"/> property. |
| 41 | +// /// If you are also specifying interfaces with the <see cref="Interfaces"/> property, |
| 42 | +// /// either set this to false and include "System.IAsyncDisposable" in the <see cref="Interfaces"/> property string, |
| 43 | +// /// or set this to true and don't include "System.IAsyncDisposable" in the <see cref="Interfaces"/> string. |
| 44 | +// /// Failure to do this will result in System.IAsyncDisposable being appended to the generated interface twice. |
| 45 | +// /// </summary> |
| 46 | +// public bool IsIAsyncDisposable { get; set; } |
| 47 | +//} |
| 48 | + |
| 49 | +//public static class Constants |
| 50 | +//{ |
| 51 | +// public const string GenerateInterfaceAttributeName = nameof(GenerateInterfaceAttribute); |
| 52 | +// public static string GenerateInterfaceAttributeNameSpace = typeof(GenerateInterfaceAttribute).Namespace; |
| 53 | +// public static string GenerateInterfaceAttributeFullName = typeof(GenerateInterfaceAttribute).FullName; |
| 54 | + |
| 55 | +// public const string ExcludeFromGeneratedInterfaceAttributeName = "ExcludeFromGeneratedInterfaceAttribute"; |
| 56 | + |
| 57 | +// public const string AttributeProperty_InterfaceName = nameof(InterfaceName); |
| 58 | +// public const string AttributeProperty_NamespaceName = nameof(Namespace); |
| 59 | +// public const string AttributeProperty_Interfaces = nameof(Interfaces); |
| 60 | +// public const string AttributeProperty_IsIDisposable = nameof(IsIDisposable); |
| 61 | +// public const string AttributeProperty_IsIAsyncDisposable = nameof(IsIAsyncDisposable); |
| 62 | +//} |
0 commit comments