Пример #1
0
 private static XDRPCArgumentInfo[] GenerateArgumentInfoArray(
     params object[] args)
 {
     XDRPCArgumentInfo[] xdrpcArgumentInfoArray = new XDRPCArgumentInfo[args.Length];
     for (int idx = 0; idx < args.Length; ++idx)
     {
         object o = args[idx];
         if (o == null)
         {
             xdrpcArgumentInfoArray[idx] = (XDRPCArgumentInfo) new XDRPCNullArgumentInfo();
         }
         else
         {
             Type type = o.GetType();
             if (typeof(XDRPCArgumentInfo).IsAssignableFrom(type))
             {
                 xdrpcArgumentInfoArray[idx] = (XDRPCArgumentInfo)o;
             }
             else
             {
                 if (!XDRPCMarshaler.IsValidArgumentType(type))
                 {
                     throw new XDRPCInvalidArgumentTypeException(type, idx);
                 }
                 xdrpcArgumentInfoArray[idx] = XDRPCMarshaler.GenerateArgumentInfo(type, o);
             }
         }
     }
     return(xdrpcArgumentInfoArray);
 }
Пример #2
0
 private void ValidateType(Type t, string msg)
 {
     if (!XDRPCMarshaler.IsValidArgumentType(t))
     {
         throw new XDRPCInvalidTypeException(t, string.Format("Invalid {0} operation: Type {1} is not supported by XDRPC.", (object)msg, (object)t.Name));
     }
 }
Пример #3
0
        public static XDRPCReference AllocateRPC <T>(
            this IXboxConsole console,
            XDRPCMode mode)
            where T : struct
        {
            Type t = typeof(T);

            if (!XDRPCMarshaler.IsValidArgumentType(t))
            {
                throw new XDRPCInvalidTypeException(t, string.Format("Invalid type {0}: Cannot allocate type not supported by XDRPC.", (object)t.Name));
            }
            XDRPCArgumentInfo argumentInfo = XDRPCMarshaler.GenerateArgumentInfo(t, (object)default(T), ArgumentType.ByRef);

            return(console.AllocateRPC(argumentInfo, mode));
        }