/// <summary> /// /// </summary> /// <param name="strPrefix"></param> /// <param name="bIgnoreCase"></param> /// <returns></returns> public GameCommandPrefix Register( string strPrefix, bool bIgnoreCase ) { if ( strPrefix == null || strPrefix == string.Empty ) throw new Exception( "GameCommandManager.Register(...) - strPrefix == null || strPrefix == string.Empty error!" ); GameCommandPrefix gameCommandPrefix = null; if ( bIgnoreCase == true ) { string strIgnoreCase = strPrefix.ToLower(); gameCommandPrefix = m_GameCommandPrefixsIgnoreCase.GetValue( strIgnoreCase ); if ( gameCommandPrefix == null ) { gameCommandPrefix = new GameCommandPrefix(); gameCommandPrefix.Prefix = strPrefix; gameCommandPrefix.IgnoreCase = bIgnoreCase; m_GameCommandPrefixsIgnoreCase.Add( strIgnoreCase, gameCommandPrefix ); } } else { gameCommandPrefix = m_GameCommandPrefixsInvariant.GetValue( strPrefix ); if ( gameCommandPrefix == null ) { gameCommandPrefix = new GameCommandPrefix(); gameCommandPrefix.Prefix = strPrefix; gameCommandPrefix.IgnoreCase = bIgnoreCase; m_GameCommandPrefixsInvariant.Add( gameCommandPrefix.Prefix, gameCommandPrefix ); } } return gameCommandPrefix; }
/// <summary> /// /// </summary> /// <param name="strGameCommand"></param> /// <returns></returns> public bool CallGameCommand(NetState netState, string strGameCommandLine, bool bIgnoreCasePrefix, bool bIgnoreCaseGameCommand) { GameCommandPrefix gameCommandPrefix = this.GetGameCommandPrefix(strGameCommandLine, bIgnoreCasePrefix); if (gameCommandPrefix == null) { return(false); } return(gameCommandPrefix.CallGameCommand(netState, strGameCommandLine, bIgnoreCaseGameCommand)); }
/// <summary> /// /// </summary> /// <param name="strGameCommand"></param> /// <param name="iAccessLevel"></param> /// <param name="eventGameCommand"></param> public void Register(GameCommandPrefix gameCommandPrefix) { if (gameCommandPrefix.IgnoreCase == true) { m_GameCommandPrefixsIgnoreCase.Add(gameCommandPrefix.Prefix.ToLower(), gameCommandPrefix); } else { m_GameCommandPrefixsInvariant.Add(gameCommandPrefix.Prefix, gameCommandPrefix); } }
/// <summary> /// /// </summary> /// <param name="strGameCommand"></param> /// <returns></returns> public GameCommandPrefix GetGameCommandPrefix(string strGameCommandLine, bool bIgnoreCase) { if (strGameCommandLine == null || strGameCommandLine == string.Empty) { return(null); } if (bIgnoreCase == true) { GameCommandPrefix[] gameCommandPrefixArray = m_GameCommandPrefixsIgnoreCase.ToArrayValues(); for (int iIndex = 0; iIndex < gameCommandPrefixArray.Length; iIndex++) { GameCommandPrefix gameCommandPrefix = gameCommandPrefixArray[iIndex]; if (Insensitive.StartsWith(strGameCommandLine, gameCommandPrefix.Prefix) == false) { continue; } return(gameCommandPrefix); } } else { GameCommandPrefix[] gameCommandPrefixArray = m_GameCommandPrefixsInvariant.ToArrayValues(); for (int iIndex = 0; iIndex < gameCommandPrefixArray.Length; iIndex++) { GameCommandPrefix gameCommandPrefix = gameCommandPrefixArray[iIndex]; if (strGameCommandLine.StartsWith(gameCommandPrefix.Prefix) == false) { continue; } return(gameCommandPrefix); } } return(null); }
/// <summary> /// /// </summary> /// <param name="strPrefix"></param> /// <param name="bIgnoreCase"></param> /// <returns></returns> public GameCommandPrefix Register(string strPrefix, bool bIgnoreCase) { if (strPrefix == null || strPrefix == string.Empty) { throw new Exception("GameCommandManager.Register(...) - strPrefix == null || strPrefix == string.Empty error!"); } GameCommandPrefix gameCommandPrefix = null; if (bIgnoreCase == true) { string strIgnoreCase = strPrefix.ToLower(); gameCommandPrefix = m_GameCommandPrefixsIgnoreCase.GetValue(strIgnoreCase); if (gameCommandPrefix == null) { gameCommandPrefix = new GameCommandPrefix(); gameCommandPrefix.Prefix = strPrefix; gameCommandPrefix.IgnoreCase = bIgnoreCase; m_GameCommandPrefixsIgnoreCase.Add(strIgnoreCase, gameCommandPrefix); } } else { gameCommandPrefix = m_GameCommandPrefixsInvariant.GetValue(strPrefix); if (gameCommandPrefix == null) { gameCommandPrefix = new GameCommandPrefix(); gameCommandPrefix.Prefix = strPrefix; gameCommandPrefix.IgnoreCase = bIgnoreCase; m_GameCommandPrefixsInvariant.Add(gameCommandPrefix.Prefix, gameCommandPrefix); } } return(gameCommandPrefix); }
/// <summary> /// /// </summary> /// <param name="strGameCommand"></param> /// <param name="iAccessLevel"></param> /// <param name="eventGameCommand"></param> public void Register( GameCommandPrefix gameCommandPrefix ) { if ( gameCommandPrefix.IgnoreCase == true ) m_GameCommandPrefixsIgnoreCase.Add( gameCommandPrefix.Prefix.ToLower(), gameCommandPrefix ); else m_GameCommandPrefixsInvariant.Add( gameCommandPrefix.Prefix, gameCommandPrefix ); }