Example #1
0
 private object ValidateArgInfoNullValue(Type fieldType, XDRPCArgumentInfo argInfo)
 {
     if (argInfo.GetType().IsGenericType)
     {
         Type genericArgument = argInfo.GetType().GetGenericArguments()[0];
         if (!genericArgument.Equals(fieldType) && genericArgument.Equals(typeof(uint)) && ((XDRPCArgumentInfo <uint>)argInfo).Value == 0U)
         {
             return((object)null);
         }
     }
     return(XDRPCMarshaler.GetArgumentInfoValue(fieldType, argInfo));
 }
Example #2
0
        public T Get <T>()
        {
            this.ValidatePointer(nameof(Get));
            Type type = typeof(T);

            this.ValidateType(type, nameof(Get));
            int arrayElementCount          = this.GetArrayElementCount(type);
            XDRPCArgumentInfo argumentInfo = XDRPCMarshaler.GenerateArgumentInfo(type, (object)default(T), ArgumentType.Out, arrayElementCount);

            this.Get(argumentInfo);
            return((T)XDRPCMarshaler.GetArgumentInfoValue(type, argumentInfo));
        }
        private void UpdateArrayValue()
        {
            if (this.MaxArrayLength <= 0)
            {
                return;
            }
            Type  elementType = typeof(T).GetElementType();
            Array instance    = Array.CreateInstance(elementType, this.MaxArrayLength);

            for (int index = 0; index < this.MaxArrayLength; ++index)
            {
                instance.SetValue(XDRPCMarshaler.GetArgumentInfoValue(elementType, this._arrayElementData[index].Info), index);
            }
            this.Value        = instance as T;
            this._arrayLength = instance.Length;
        }