Fixed the attribute usage and renamed the EnumMgr methods - FromText and ToText.

This commit is contained in:
antiduh
2014-07-11 21:32:06 +00:00
parent 3a134be9df
commit 8c19366314
2 changed files with 4 additions and 4 deletions

View File

@@ -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();

View File

@@ -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)
); );
} }
} }