floppydisc
Sorceror
ClientVersion fix
As of the new UO client update, the version string now contains more than just one digit as revision. This means, that the current ClientVersion constructor parses the version string (4.0.10) and just reads this as "4.0.1".
I wrote a fix for this. This is the new constructor for the ClientVersion object (found in ClientVersion.cs)
As of the new UO client update, the version string now contains more than just one digit as revision. This means, that the current ClientVersion constructor parses the version string (4.0.10) and just reads this as "4.0.1".
I wrote a fix for this. This is the new constructor for the ClientVersion object (found in ClientVersion.cs)
Code:
public ClientVersion( string fmt )
{
m_SourceString = fmt;
try
{
fmt = fmt.ToLower();
string[] version = fmt.Split( new char[] {'.'}, 3 );
m_Patch = 0;
for ( int i = 0; i < version[2].Length; i++ )
{
if ( Char.IsLetter( version[2][i] ) )
{
m_Patch = ( version[2][i] - 'a' ) + 1;
version[2] = version[2].Remove( i, version[2].Length - i );
break;
}
}
m_Major = int.Parse( version[0] );
m_Minor = int.Parse( version[1] );
m_Revision = int.Parse( version[2] );
if ( fmt.IndexOf( "god" ) >= 0 || fmt.IndexOf( "gq" ) >= 0 )
m_Type = ClientType.God;
else if ( fmt.IndexOf( "third dawn" ) >= 0 || fmt.IndexOf( "uo:td" ) >= 0 || fmt.IndexOf( "uotd" ) >= 0 || fmt.IndexOf( "uo3d" ) >= 0 || fmt.IndexOf( "uo:3d" ) >= 0 )
m_Type = ClientType.UOTD;
else
m_Type = ClientType.Regular;
}
catch
{
m_Major = 0;
m_Minor = 0;
m_Revision = 0;
m_Patch = 0;
m_Type = ClientType.Regular;
}
}