Esempio n. 1
0
        private int ValidateSize(XDRPCArgumentInfo lpvBufArg, string msgType)
        {
            int requiredBufferSize = lpvBufArg.GetRequiredBufferSize();

            if (requiredBufferSize > this.BufferSize)
            {
                throw new XDRPCInvalidOperationException(string.Format("Invalid {0} operation: Allocated buffer's size ({1}) is smaller than object's size ({2}).", (object)msgType, (object)this.BufferSize, (object)requiredBufferSize));
            }
            if (lpvBufArg.GetRequiredReferenceSize() > 0)
            {
                throw new XDRPCInvalidOperationException(string.Format("Invalid {0} operation: {1}", (object)msgType, (object)"Struct type containing references is not supported by the XDRPC allocation system. You will need to use the XDRPC allocation system to create the data for the references on the Xbox and change the struct to have uints filled with the XDRPCReference.Pointer values for that data instead of the references. See the How to Use XDRPC documentation for more info."));
            }
            return(requiredBufferSize);
        }
Esempio n. 2
0
 public static XDRPCReference AllocateRPC(
     this IXboxConsole console,
     XDRPCArgumentInfo lpvBufArg,
     XDRPCMode mode)
 {
     if (lpvBufArg.PassBy == ArgumentType.ByValue)
     {
         throw new XDRPCInvalidOperationException("Allocating XDRPCArgumentInfo with ByValue argument type is not allowed.");
     }
     if (lpvBufArg.GetRequiredReferenceSize() > 0)
     {
         throw new XDRPCInvalidOperationException("Struct type containing references is not supported by the XDRPC allocation system. You will need to use the XDRPC allocation system to create the data for the references on the Xbox and change the struct to have uints filled with the XDRPCReference.Pointer values for that data instead of the references. See the How to Use XDRPC documentation for more info.");
     }
     return(console.AllocateRPC(lpvBufArg.GetRequiredBufferSize(), mode));
 }