This commit is contained in:
asayre 2010-10-18 07:06:50 +00:00
parent a90eb17e96
commit 83662f2215
6 changed files with 33 additions and 29 deletions

View file

@ -35,6 +35,7 @@ namespace Server
SA
}
[Flags]
public enum ClientFlags
{
None = 0x00000000,
@ -49,6 +50,7 @@ namespace Server
UOTD = 0x00000100
}
[Flags]
public enum FeatureFlags
{
None = 0x00000000,
@ -82,6 +84,7 @@ namespace Server
ExpansionSA = ExpansionML | SA
}
[Flags]
public enum CharacterListFlags
{
None = 0x00000000,

View file

@ -23,7 +23,7 @@ using System.Collections;
namespace Server
{
public class Insensitive
public static class Insensitive
{
private static IComparer m_Comparer = CaseInsensitiveComparer.Default;

View file

@ -992,11 +992,11 @@ namespace Server
}
object oMusic = this.DefaultMusic;
MusicName music = this.DefaultMusic;
ReadEnum( xml["music"], "name", typeof( MusicName ), ref oMusic, false );
ReadEnum( xml["music"], "name", ref music, false );
m_Music = (MusicName) oMusic;
m_Music = music;
}
protected static string GetAttribute( XmlElement xml, string attribute, bool mandatory )
@ -1137,12 +1137,12 @@ namespace Server
return true;
}
public static bool ReadEnum( XmlElement xml, string attribute, Type type, ref object value )
public static bool ReadEnum<T>( XmlElement xml, string attribute, ref T value )
{
return ReadEnum( xml, attribute, type, ref value, true );
return ReadEnum( xml, attribute, ref value, true );
}
public static bool ReadEnum( XmlElement xml, string attribute, Type type, ref object value, bool mandatory )
public static bool ReadEnum<T>( XmlElement xml, string attribute, ref T value, bool mandatory )
{
string s = GetAttribute( xml, attribute, mandatory );
@ -1151,7 +1151,8 @@ namespace Server
try
{
value = Enum.Parse( type, s, true );
value = (T)Enum.Parse( typeof( T ), s, true );
//TODO: On .NET 4.0, use Enum.TryParse
}
catch
{