Fixed the attribute usage and renamed the EnumMgr methods - FromText and ToText.
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NSspi
|
namespace NSspi
|
||||||
{
|
{
|
||||||
[AttributeUsage( AttributeTargets.Enum )]
|
[AttributeUsage( AttributeTargets.Field )]
|
||||||
public class EnumStringAttribute : Attribute
|
public class EnumStringAttribute : Attribute
|
||||||
{
|
{
|
||||||
public EnumStringAttribute( string text )
|
public EnumStringAttribute( string text )
|
||||||
@@ -19,7 +19,7 @@ namespace NSspi
|
|||||||
|
|
||||||
public class EnumMgr
|
public class EnumMgr
|
||||||
{
|
{
|
||||||
public static string Text( Enum value )
|
public static string ToText( Enum value )
|
||||||
{
|
{
|
||||||
FieldInfo field = value.GetType().GetField( value.ToString() );
|
FieldInfo field = value.GetType().GetField( value.ToString() );
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ namespace NSspi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T Enum<T>( string text )
|
public static T FromText<T>( string text )
|
||||||
{
|
{
|
||||||
FieldInfo[] fields = typeof( T ).GetFields();
|
FieldInfo[] fields = typeof( T ).GetFields();
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace NSspi
|
|||||||
"{0}. Error Code = '{1:X}' - \"{2}\".",
|
"{0}. Error Code = '{1:X}' - \"{2}\".",
|
||||||
this.message,
|
this.message,
|
||||||
this.errorCode,
|
this.errorCode,
|
||||||
EnumMgr.Text(this.errorCode)
|
EnumMgr.ToText(this.errorCode)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user