protected virtual IReadOnlyCollection <TPI> GetPlayerInfoQueryResult(string ip, ushort port) { if (port == 0) { throw new InvalidPortException(); } IQueryExecutor <TSI, TPI> queryExecutor = Activator.CreateInstance(typeof(TQE), ip, port) as IQueryExecutor <TSI, TPI>; if (queryExecutor != null) { try { return(queryExecutor.GetPlayerInfo()); } catch (FormatException) { throw new InvalidIpAddressException(); } } throw new QueryExecutorInitializationException(); }