예제 #1
0
 public byte[] PackBufferData()
 {
     byte[] buffer = (byte[])null;
     if (this.MaxArrayLength > 0)
     {
         int offset = 0;
         buffer = new byte[this._elementSize * this.MaxArrayLength];
         for (int index = 0; index < this.MaxArrayLength; ++index)
         {
             MarshalingUtils.PushBufferData(this._arrayElementData[index].Info.PackBufferData(), buffer, ref offset);
         }
     }
     return(buffer);
 }
예제 #2
0
 public byte[] PackReferenceData()
 {
     byte[] buffer = (byte[])null;
     if (this._referenceSize > 0)
     {
         buffer = new byte[this._referenceSize];
         for (int index = 0; index < this.MaxArrayLength; ++index)
         {
             byte[] numArray = this._arrayElementData[index].Info.PackReferenceData();
             if (numArray != null)
             {
                 int referenceOffset = this._arrayElementData[index].ReferenceOffset;
                 MarshalingUtils.PushBufferData(numArray, buffer, ref referenceOffset);
             }
         }
     }
     return(buffer);
 }
예제 #3
0
        private void CreateArgumentBufferData()
        {
            int offset = 0;
            int num    = 2;

            this.callData = new byte[this.totalBufferSize];
            MarshalingUtils.PushCallData(0UL, this.callData, ref offset);
            MarshalingUtils.PushCallData(0UL, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.Options.PostMethodCall, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.callFlags, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.totalArgumentCount, this.callData, ref offset);
            MarshalingUtils.PushCallData((ulong)this.FloatingPointArguments.Length, this.callData, ref offset);
            for (int index1 = 0; index1 < this.IntegerArguments.Length + num; ++index1)
            {
                ulong bufferAddress1 = (ulong)this.bufferBaseAddress + (ulong)this.bufferData[index1].BufferOffset;
                if (index1 < num)
                {
                    MarshalingUtils.PushCallData(this.Options.GetArgumentValue(index1, bufferAddress1), this.callData, ref offset);
                }
                else
                {
                    int   index2         = index1 - num;
                    ulong bufferAddress2 = (ulong)this.bufferBaseAddress + (ulong)this.referenceData[index2].BufferOffset;
                    this.IntegerArguments[index2].SetReferenceAddress(bufferAddress2);
                    if (this.IntegerArguments[index2].GetArgumentCount() == 1)
                    {
                        MarshalingUtils.PushCallData(this.IntegerArguments[index2].GetArgumentValue(bufferAddress1), this.callData, ref offset);
                    }
                    else
                    {
                        foreach (ulong argumentValue in this.IntegerArguments[index2].GetArgumentValues(bufferAddress1))
                        {
                            MarshalingUtils.PushCallData(argumentValue, this.callData, ref offset);
                        }
                    }
                }
            }
            for (int index = 0; index < this.FloatingPointArguments.Length; ++index)
            {
                ulong bufferAddress = (ulong)this.bufferBaseAddress + (ulong)this.bufferData[index].BufferOffset;
                MarshalingUtils.PushCallData(this.FloatingPointArguments[index].GetArgumentValue(bufferAddress), this.callData, ref offset);
            }
            for (int index = 0; index < this.IntegerArguments.Length + num; ++index)
            {
                if (this.bufferData[index].BufferSize > 0)
                {
                    byte[] numArray = index >= num ? this.IntegerArguments[index - num].PackBufferData() : this.Options.PackBufferData(index);
                    if (numArray != null)
                    {
                        offset = this.bufferData[index].BufferOffset;
                        MarshalingUtils.PushBufferData(numArray, this.callData, ref offset);
                    }
                }
            }
            for (int index = 0; index < this.IntegerArguments.Length; ++index)
            {
                if (this.referenceData[index].BufferSize > 0)
                {
                    byte[] numArray = this.IntegerArguments[index].PackReferenceData();
                    if (numArray != null)
                    {
                        offset = this.referenceData[index].BufferOffset;
                        MarshalingUtils.PushBufferData(numArray, this.callData, ref offset);
                    }
                }
            }
        }