ArtemisComm.ShipAction2Packet.GetSubPacket C# (CSharp) Method

GetSubPacket() private method

private GetSubPacket ( Stream stream ) : IPackage
stream Stream
return IPackage
        IPackage GetSubPacket(Stream stream)
        {
            IPackage retVal = null;
            object[] parms = { stream, 0 };
            Type[] constructorSignature = { typeof(Stream), typeof(int) };

            Type t = Type.GetType(typeof(ShipAction2SubPacketType).Namespace + "." + this.SubPacketType.ToString());


            if (t != null)
            {
                ConstructorInfo constructor = t.GetConstructor(constructorSignature);
                object obj = constructor.Invoke(parms);
                retVal = obj as IPackage;
            }

            return retVal;
        }