internal static byte[] GetBigEndianBytes(ulong v) { byte[] bytes = BitConverter.GetBytes(v); if (BitConverter.IsLittleEndian) { MarshalingUtils.ReverseBytes(bytes); } return(bytes); }
public void UnpackBufferData(byte[] data) { if (this.PassBy != ArgumentType.ByRef && this.PassBy != ArgumentType.Out) { return; } if (BitConverter.IsLittleEndian && this.Encoding == Encoding.Unicode) { MarshalingUtils.ReverseBytes(data, 2); } this.Value = this.Encoding.GetString(data, 0, this.GetReturnedStringLength(data)); }
public void UnpackBufferData(byte[] data) { if (this.PassBy != ArgumentType.ByRef && this.PassBy != ArgumentType.Out) { return; } if (BitConverter.IsLittleEndian) { MarshalingUtils.ReverseBytes(data); } this.Value = (T)(XDRPCArgumentInfo <T> .GetValue(data) ?? (object)default(T)); }
public byte[] PackBufferData() { if (this.PassBy != ArgumentType.ByRef && this.PassBy != ArgumentType.Out) { return((byte[])null); } byte[] bytes = XDRPCArgumentInfo <T> .GetBytes((object)this.Value); if (BitConverter.IsLittleEndian) { MarshalingUtils.ReverseBytes(bytes); } return(bytes); }
internal static ulong GetUInt64FromBigEndianBytes(byte[] buffer, int start) { int length = MarshalingUtils.SizeOf(typeof(ulong)); if (start + length > buffer.Length) { throw new XDRPCException("Error de-serializing UInt64 from buffer"); } byte[] buffer1 = new byte[length]; Array.Copy((Array)buffer, start, (Array)buffer1, 0, length); if (BitConverter.IsLittleEndian) { MarshalingUtils.ReverseBytes(buffer1); } return(BitConverter.ToUInt64(buffer1, 0)); }
public byte[] PackBufferData() { byte[] buffer = (byte[])null; if (this._maxBufferSize > 0) { if (this.Value != null) { buffer = this.Encoding.GetBytes(this.Value); if (BitConverter.IsLittleEndian && this.Encoding == Encoding.Unicode) { MarshalingUtils.ReverseBytes(buffer, 2); } } else { buffer = new byte[this._maxBufferSize]; } } return(buffer); }