private void btnLoadFlatBuffer_Click(object sender, RoutedEventArgs e) { Uri appUri = new Uri((@"ms-appx:///data/imoveis.fb")); StorageFile fbFile = StorageFile.GetFileFromApplicationUriAsync(appUri).AsTask().ConfigureAwait(false).GetAwaiter().GetResult(); IBuffer buffer = FileIO.ReadBufferAsync(fbFile).AsTask().ConfigureAwait(false).GetAwaiter().GetResult(); byte[] content = new byte[buffer.Length]; using (DataReader reader = DataReader.FromBuffer(buffer)) { reader.ReadBytes(content); } ByteBuffer bb = new ByteBuffer(content); long start = System.DateTime.Now.Ticks; Imoveis imoveis = Imoveis.GetRootAsImoveis(bb); long end = System.DateTime.Now.Ticks; lblFlatBufferLoadingTime.Text = "Tempo de carregamento: " + ((end - start) / 10000) + " milissegundos"; Debug.WriteLine("Apartamentos carregados: " + imoveis.AptosLength + ". Casas carregadas: " + imoveis.CasasLength); }
public SignAndDatePDF(ByteBuffer myFilledPDF) { pdfreader = new PdfReader(myFilledPDF.Buffer); myPDF = new ByteBuffer(); pdfStamper = new PdfStamper(pdfreader, myPDF); pdfFormFields = pdfStamper.AcroFields; }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.Error = AmqpCodec.DecodeKnownType<Error>(buffer); } }
/* internal ExtNegotiation(BinaryReader din, int len) { int uidLen = din.ReadUInt16(); this.asuid = AAssociateRQAC.ReadASCII(din, uidLen); this.m_info = new byte[len - uidLen - 2]; din.BaseStream.Read( m_info, 0, m_info.Length); } */ internal ExtNegotiation(ByteBuffer bb, int len) { int uidLen = bb.ReadInt16(); this.asuid = bb.ReadString(uidLen); this.m_info = new byte[len - uidLen - 2]; bb.Read( m_info, 0, m_info.Length ); }
/// <summary> /// Constructor /// </summary> /// <param name="packetType">SFTP packet type.</param> public SFTPPacket(SFTPPacketType packetType) { _payload = _payloadBuffer.Value; _payload.Clear(); _payload.WriteUInt32(0); // SFTP message length _payload.WriteByte((byte)packetType); }
public Object deserialize(RbSerializerN serializer, ByteBuffer buffer) { String key = serializer.deserializeString(buffer); String value = serializer.deserializeString(buffer); return new DebugProperty(key, value); }
public int Read (ByteBuffer buffer) { int offset = buffer.Position () + buffer.ArrayOffset (); int num2 = s.Read (buffer.Array (), offset, (buffer.Limit () + buffer.ArrayOffset ()) - offset); buffer.Position (buffer.Position () + num2); return num2; }
public static IList Decode(ByteBuffer buffer, FormatCode formatCode) { if (formatCode == 0 && (formatCode = AmqpEncoding.ReadFormatCode(buffer)) == FormatCode.Null) { return null; } IList list = new List<object>(); if (formatCode == FormatCode.List0) { return list; } int size; int count; AmqpEncoding.ReadSizeAndCount(buffer, formatCode, FormatCode.List8, FormatCode.List32, out size, out count); for (; count > 0; --count) { object item = AmqpEncoding.DecodeObject(buffer); list.Add(item); } return list; }
public void serialize(RbSerializerN serializer, ByteBuffer buffer, Object obje) { var obj = (DebugProperty) obje; serializer.serialize(buffer, obj.key); serializer.serialize(buffer, obj.value); }
public static void createImagePatternBCH(int i, ByteBuffer bb) { JNI.Frame frame = (JNI.Frame) null; if (ARToolKitPlus.__\u003Cjniptr\u003EcreateImagePatternBCH\u0028ILjava\u002Fnio\u002FByteBuffer\u003B\u0029V == IntPtr.Zero) ARToolKitPlus.__\u003Cjniptr\u003EcreateImagePatternBCH\u0028ILjava\u002Fnio\u002FByteBuffer\u003B\u0029V = JNI.Frame.GetFuncPtr(ARToolKitPlus.__\u003CGetCallerID\u003E(), "com/googlecode/javacv/cpp/ARToolKitPlus", "createImagePatternBCH", "(ILjava/nio/ByteBuffer;)V"); // ISSUE: explicit reference operation IntPtr num1 = ((JNI.Frame) @frame).Enter(ARToolKitPlus.__\u003CGetCallerID\u003E()); try { IntPtr num2 = num1; // ISSUE: explicit reference operation IntPtr num3 = ((JNI.Frame) @frame).MakeLocalRef((object) ClassLiteral<ARToolKitPlus>.Value); int num4 = i; // ISSUE: explicit reference operation IntPtr num5 = ((JNI.Frame) @frame).MakeLocalRef((object) bb); // ISSUE: cast to a function pointer type // ISSUE: function pointer call __calli((__FnPtr<void (IntPtr, IntPtr, int, IntPtr)>) ARToolKitPlus.__\u003Cjniptr\u003EcreateImagePatternBCH\u0028ILjava\u002Fnio\u002FByteBuffer\u003B\u0029V)(num2, (int) num3, (IntPtr) num4, num5); } catch (object ex) { Console.WriteLine((object) "*** exception in native code ***"); Console.WriteLine(ex); throw; } finally { // ISSUE: explicit reference operation ((JNI.Frame) @frame).Leave(); } }
public static async Task<WebSocketMessage> ReadMessageAsync(WebSocket webSocket, byte[] buffer, int maxMessageSize) { ArraySegment<byte> arraySegment = new ArraySegment<byte>(buffer); WebSocketReceiveResult receiveResult = await webSocket.ReceiveAsync(arraySegment, CancellationToken.None).ConfigureAwait(continueOnCapturedContext: false); // special-case close messages since they might not have the EOF flag set if (receiveResult.MessageType == WebSocketMessageType.Close) { return new WebSocketMessage(null, WebSocketMessageType.Close); } if (receiveResult.EndOfMessage) { // we anticipate that single-fragment messages will be common, so we optimize for them switch (receiveResult.MessageType) { case WebSocketMessageType.Binary: return new WebSocketMessage(BufferSliceToByteArray(buffer, receiveResult.Count), WebSocketMessageType.Binary); case WebSocketMessageType.Text: return new WebSocketMessage(BufferSliceToString(buffer, receiveResult.Count), WebSocketMessageType.Text); default: throw new Exception("This code path should never be hit."); } } else { // for multi-fragment messages, we need to coalesce ByteBuffer bytebuffer = new ByteBuffer(maxMessageSize); bytebuffer.Append(BufferSliceToByteArray(buffer, receiveResult.Count)); WebSocketMessageType originalMessageType = receiveResult.MessageType; while (true) { // loop until an error occurs or we see EOF receiveResult = await webSocket.ReceiveAsync(arraySegment, CancellationToken.None).ConfigureAwait(continueOnCapturedContext: false); if (receiveResult.MessageType != originalMessageType) { throw new InvalidOperationException("Incorrect message type"); } bytebuffer.Append(BufferSliceToByteArray(buffer, receiveResult.Count)); if (receiveResult.EndOfMessage) { switch (receiveResult.MessageType) { case WebSocketMessageType.Binary: return new WebSocketMessage(bytebuffer.GetByteArray(), WebSocketMessageType.Binary); case WebSocketMessageType.Text: return new WebSocketMessage(bytebuffer.GetString(), WebSocketMessageType.Text); default: throw new Exception("This code path should never be hit."); } } } } }
internal static Broker ReadFrom(ByteBuffer buffer) { var id = buffer.GetInt(); var host = ApiUtils.ReadShortString(buffer); var port = buffer.GetInt(); return new Broker(id, host, port); }
internal DicomAttributeMultiValueText(DicomTag tag, ByteBuffer item) : base(tag) { string valueArray; valueArray = item.GetString(); // store the length before removing pad chars StreamLength = (uint) valueArray.Length; // Saw some Osirix images that had padding on SH attributes with a null character, just // pull them out here. // Leading and trailing space characters are non-significant in all multi-valued VRs, // so pull them out here as well since some devices seem to pad UI attributes with spaces too. valueArray = valueArray.Trim(new [] {tag.VR.PadChar, '\0', ' '}); if (valueArray.Length == 0) { _values = new string[0]; Count = 1; StreamLength = 0; } else { _values = valueArray.Split(new char[] {'\\'}); Count = (long) _values.Length; StreamLength = (uint) valueArray.Length; } }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.Role = AmqpCodec.DecodeBoolean(buffer); } if (count-- > 0) { this.First = AmqpCodec.DecodeUInt(buffer); } if (count-- > 0) { this.Last = AmqpCodec.DecodeUInt(buffer); } if (count-- > 0) { this.Settled = AmqpCodec.DecodeBoolean(buffer); } if (count-- > 0) { this.State = (DeliveryState)AmqpCodec.DecodeAmqpDescribed(buffer); } if (count-- > 0) { this.Batchable = AmqpCodec.DecodeBoolean(buffer); } }
public static byte[] GetBytesFromCString(string cStr, DataCoding dataCoding) { if (cStr == null) { throw new ArgumentNullException("cStr"); } if (cStr.Length == 0) { return new byte[] { 0x00 }; } byte[] bytes = null; switch (dataCoding) { case DataCoding.ASCII: bytes = System.Text.Encoding.ASCII.GetBytes(cStr); break; case DataCoding.Latin1: bytes = Latin1Encoding.GetBytes(cStr); break; case DataCoding.UCS2: bytes = System.Text.Encoding.Unicode.GetBytes(cStr); break; case DataCoding.SMSCDefault: bytes = SMSCDefaultEncoding.GetBytes(cStr); break; default: throw new SmppException(SmppErrorCode.ESME_RUNKNOWNERR, "Unsupported encoding"); } ByteBuffer buffer = new ByteBuffer(bytes, bytes.Length + 1); buffer.Append(new byte[] { 0x00 }); //Append a null charactor a the end return buffer.ToBytes(); }
public GraphicsProxy() { calls = ByteBuffer.allocate(INITIAL_BUFFER_SIZE); calls.order(ByteOrder.LITTLE_ENDIAN); calls.put(calls.order() == ByteOrder.BIG_ENDIAN ? (byte) 1 : (byte) 0); isDebugging = java.lang.System.getProperty("debug", "false") == "true"; }
int Find(byte[] prefix, ByteBuffer key) { var left = 0; var right = _keys.Length; while (left < right) { var middle = (left + right) / 2; var currentKey = _keys[middle]; var result = BitArrayManipulation.CompareByteArray(prefix, prefix.Length, currentKey, Math.Min(currentKey.Length, prefix.Length)); if (result == 0) { result = BitArrayManipulation.CompareByteArray(key.Buffer, key.Offset, key.Length, currentKey, prefix.Length, currentKey.Length - prefix.Length); } if (result < 0) { right = middle; } else { left = middle + 1; } } return left; }
public string Decode(ByteBuffer b) { string res = enc.Decode (b); if (res.IndexOf ('\uFFFD') != -1 && decoder.Fallback == DecoderFallback.ExceptionFallback) throw new CharacterCodingException (); return res; }
protected override byte[] GetBodyData() { ByteBuffer buffer = new ByteBuffer(vSystemID.Length + vPassword.Length + 2); buffer.Append(EncodeCString(vSystemID)); buffer.Equals(EncodeCString(vPassword)); return buffer.ToBytes(); }
static int _CreateByteBuffer(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { ByteBuffer obj = new ByteBuffer(); ToLua.PushObject(L, obj); return 1; } else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(byte[]))) { byte[] arg0 = ToLua.CheckByteBuffer(L, 1); ByteBuffer obj = new ByteBuffer(arg0); ToLua.PushObject(L, obj); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ByteBuffer.New"); } } catch(Exception e) { return LuaDLL.toluaL_exception(L, e); } }
public CompletedResponse(Stream stream, ByteBuffer buffer) { int bRead; buffer.Reset(); for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte()) buffer.Add((byte)bRead); if (bRead == ' ' && buffer.GetPosition() == INSERT.Length && buffer.AreSame(INSERT)) { long lioid = 0; for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte()) lioid = (lioid << 3) + (lioid << 1) + bRead - 48; if (bRead == ' ') LastInsertedOID = lioid; } while (bRead > 0) { buffer.Reset(); for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte()) buffer.Add((byte)bRead); } if (bRead == -1) { throw new IOException(); } RowsAffected = buffer.TryGetInt(); }
public override void NESSoftReset() { lock_regs = false; cur_reg = 0; regs = new ByteBuffer(4); base.NESSoftReset(); }
private void WriteIteratorScopes(Function function) { if (function.IteratorScopes.Count == 0) return; var buffer = new ByteBuffer(); buffer.WriteByte(4); buffer.WriteByte(1); buffer.Align(4); buffer.WriteByte(4); buffer.WriteByte(3); buffer.Align(4); var scopes = function.IteratorScopes; buffer.WriteInt32(scopes.Count * 8 + 12); buffer.WriteInt32(scopes.Count); foreach (var scope in scopes) { buffer.WriteInt32(scope.Offset); buffer.WriteInt32(scope.Offset + scope.Length); } pdb.SetSymAttribute(function.Token, "MD2", buffer.length, buffer.buffer); }
override public void serialize(ByteBuffer bu) { base.serialize(bu) bu.writeUnsignedInt8(byCmd); bu.writeUnsignedInt8(byParam); bu.writeUnsignedInt32(dwTimestamp); }
override public void derialize(ByteBuffer bu) { base.derialize(bu) bu.readUnsignedInt8(ref byCmd); bu.readUnsignedInt8(ref byParam); bu.readUnsignedInt32(ref dwTimestamp); }
int Find(byte[] prefix, ByteBuffer key) { var left = 0; var right = _keyvalues.Length; var keyBytes = _keyBytes; while (left < right) { var middle = (left + right) / 2; int currentKeyOfs = _keyvalues[middle].KeyOffset; int currentKeyLen = _keyvalues[middle].KeyLength; var result = BitArrayManipulation.CompareByteArray(prefix, 0, prefix.Length, keyBytes, currentKeyOfs, Math.Min(currentKeyLen, prefix.Length)); if (result == 0) { result = BitArrayManipulation.CompareByteArray(key.Buffer, key.Offset, key.Length, keyBytes, currentKeyOfs + prefix.Length, currentKeyLen - prefix.Length); if (result == 0) { return middle * 2 + 1; } } if (result < 0) { right = middle; } else { left = middle + 1; } } return left * 2; }
protected override void OnDecode(ByteBuffer buffer, int count) { if (count-- > 0) { this.Durable = AmqpCodec.DecodeBoolean(buffer); } if (count-- > 0) { this.Priority = AmqpCodec.DecodeUByte(buffer); } if (count-- > 0) { this.Ttl = AmqpCodec.DecodeUInt(buffer); } if (count-- > 0) { this.FirstAcquirer = AmqpCodec.DecodeBoolean(buffer); } if (count-- > 0) { this.DeliveryCount = AmqpCodec.DecodeUInt(buffer); } }
/// <summary> /// Allocates a new byte buffer. /// The new buffer's position will be zero, its limit will be its capacity, /// and its mark will be undefined. /// It will have a backing array, and its array offset will be zero. /// </summary> /// <param name="capacity"></param> /// <returns></returns> public static ByteBuffer Allocate(int capacity) { MemoryStream ms = new MemoryStream(capacity); ByteBuffer buffer = new ByteBuffer(ms); buffer.Limit = capacity; return buffer; }
public static ByteBuffer allocate(int capacity) { ByteBuffer b = new ByteBuffer(); b.buffer = new byte[capacity]; b.limit = 0; return b; }
public ImageDebugDirectory GetDebugHeader(out byte [] header) { var section = GetSectionAtVirtualAddress (Debug.VirtualAddress); var buffer = new ByteBuffer (section.Data); buffer.position = (int) (Debug.VirtualAddress - section.VirtualAddress); var directory = new ImageDebugDirectory { Characteristics = buffer.ReadInt32 (), TimeDateStamp = buffer.ReadInt32 (), MajorVersion = buffer.ReadInt16 (), MinorVersion = buffer.ReadInt16 (), Type = buffer.ReadInt32 (), SizeOfData = buffer.ReadInt32 (), AddressOfRawData = buffer.ReadInt32 (), PointerToRawData = buffer.ReadInt32 (), }; if (directory.SizeOfData == 0 || directory.PointerToRawData == 0) { header = Empty<byte>.Array; return directory; } buffer.position = (int) (directory.PointerToRawData - section.PointerToRawData); header = new byte [directory.SizeOfData]; Buffer.BlockCopy (buffer.buffer, buffer.position, header, 0, header.Length); return directory; }
public static TopKV2Options GetRootAsTopKV2Options(ByteBuffer _bb, TopKV2Options obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static Buffer GetRootAsBuffer(ByteBuffer _bb, Buffer obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static Buffer GetRootAsBuffer(ByteBuffer _bb) { return GetRootAsBuffer(_bb, new Buffer()); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { ConsumerTag = EncodingUtils.ReadShortString(buffer); }
protected override void WriteMethodPayload(ByteBuffer buffer) { EncodingUtils.WriteShortStringBytes(buffer, ConsumerTag); }
public TopKV2Options __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return(this); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
public void build(byte[] data) { ByteBuffer buf = ByteBuffer.wrap(data); for (int i = 0; i < this.__flag.Length; i++) { this.__flag[i] = buf.get(); } if (this.hasPos()) { this.pos = buf.getInt(); } if (this.hasPlayerId()) { this.playerId = buf.getInt(); } if (this.hasGold()) { this.gold = buf.getInt(); } if (this.hasPour()) { this.pour = buf.getInt(); } if (this.hasIsBanker()) { if (buf.get() == 1) { this.isBanker = true; } else { this.isBanker = false; } } if (this.hasIsDismiss()) { if (buf.get() == 1) { this.isDismiss = true; } else { this.isDismiss = false; } } if (this.hasPokerList()) { int size = buf.getShort(); for (int i = 0; i < size; i++) { byte[] bytes = new byte[buf.getInt()]; buf.get(ref bytes, 0, bytes.Length); this.pokerList.Add(JY_POKER.decode(bytes)); } } if (this.hasStatus()) { this.status = (SEAT_STATUS)buf.get(); } if (this.hasNickname()) { byte[] bytes = new byte[buf.getShort()]; buf.get(ref bytes, 0, bytes.Length); this.nickname = System.Text.Encoding.UTF8.GetString(bytes); } if (this.hasAvatar()) { byte[] bytes = new byte[buf.getShort()]; buf.get(ref bytes, 0, bytes.Length); this.avatar = System.Text.Encoding.UTF8.GetString(bytes); } if (this.hasGender()) { this.gender = buf.get(); } if (this.hasEarnings()) { this.earnings = buf.getInt(); } if (this.hasHistoryPokerList()) { int size = buf.getShort(); for (int i = 0; i < size; i++) { byte[] bytes = new byte[buf.getInt()]; buf.get(ref bytes, 0, bytes.Length); this.historyPokerList.Add(JY_POKER.decode(bytes)); } } if (this.hasIsReady()) { if (buf.get() == 1) { this.isReady = true; } else { this.isReady = false; } } if (this.hasIsJoinGame()) { if (buf.get() == 1) { this.isJoinGame = true; } else { this.isJoinGame = false; } } if (this.hasLoopEarnings()) { this.loopEarnings = buf.getInt(); } if (this.hasIsOnLine()) { if (buf.get() == 1) { this.isOnLine = true; } else { this.isOnLine = false; } } }
public static BossData GetRootAsBossData(ByteBuffer _bb) { return(GetRootAsBossData(_bb, new BossData())); }
public static TopKV2Options GetRootAsTopKV2Options(ByteBuffer _bb) { return(GetRootAsTopKV2Options(_bb, new TopKV2Options())); }
public static BossData GetRootAsBossData(ByteBuffer _bb, BossData obj) { return(obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public byte[] encode() { ByteBuffer[] bytes = new ByteBuffer[17]; int total = 0; if (this.hasPos()) { bytes[0] = ByteBuffer.allocate(4); bytes[0].putInt(this.pos); total += bytes[0].limit(); } if (this.hasPlayerId()) { bytes[1] = ByteBuffer.allocate(4); bytes[1].putInt(this.playerId); total += bytes[1].limit(); } if (this.hasGold()) { bytes[2] = ByteBuffer.allocate(4); bytes[2].putInt(this.gold); total += bytes[2].limit(); } if (this.hasPour()) { bytes[3] = ByteBuffer.allocate(4); bytes[3].putInt(this.pour); total += bytes[3].limit(); } if (this.hasIsBanker()) { bytes[4] = ByteBuffer.allocate(1); if (this.isBanker) { bytes[4].put((byte)1); } else { bytes[4].put((byte)0); } total += bytes[4].limit(); } if (this.hasIsDismiss()) { bytes[5] = ByteBuffer.allocate(1); if (this.isDismiss) { bytes[5].put((byte)1); } else { bytes[5].put((byte)0); } total += bytes[5].limit(); } if (this.hasPokerList()) { int length = 0; for (int i = 0, len = this.pokerList.Count; i < len; i++) { length += this.pokerList[i].encode().Length; } bytes[6] = ByteBuffer.allocate(this.pokerList.Count * 4 + length + 2); bytes[6].putShort((short)this.pokerList.Count); for (int i = 0, len = this.pokerList.Count; i < len; i++) { byte[] _byte = this.pokerList[i].encode(); bytes[6].putInt(_byte.Length); bytes[6].put(_byte); } total += bytes[6].limit(); } if (this.hasStatus()) { bytes[7] = ByteBuffer.allocate(1); bytes[7].put((byte)this.status); total += bytes[7].limit(); } if (this.hasNickname()) { byte[] _byte = System.Text.Encoding.UTF8.GetBytes(this.nickname); short len = (short)_byte.Length; bytes[8] = ByteBuffer.allocate(2 + len); bytes[8].putShort(len); bytes[8].put(_byte); total += bytes[8].limit(); } if (this.hasAvatar()) { byte[] _byte = System.Text.Encoding.UTF8.GetBytes(this.avatar); short len = (short)_byte.Length; bytes[9] = ByteBuffer.allocate(2 + len); bytes[9].putShort(len); bytes[9].put(_byte); total += bytes[9].limit(); } if (this.hasGender()) { bytes[10] = ByteBuffer.allocate(1); bytes[10].put(this.gender); total += bytes[10].limit(); } if (this.hasEarnings()) { bytes[11] = ByteBuffer.allocate(4); bytes[11].putInt(this.earnings); total += bytes[11].limit(); } if (this.hasHistoryPokerList()) { int length = 0; for (int i = 0, len = this.historyPokerList.Count; i < len; i++) { length += this.historyPokerList[i].encode().Length; } bytes[12] = ByteBuffer.allocate(this.historyPokerList.Count * 4 + length + 2); bytes[12].putShort((short)this.historyPokerList.Count); for (int i = 0, len = this.historyPokerList.Count; i < len; i++) { byte[] _byte = this.historyPokerList[i].encode(); bytes[12].putInt(_byte.Length); bytes[12].put(_byte); } total += bytes[12].limit(); } if (this.hasIsReady()) { bytes[13] = ByteBuffer.allocate(1); if (this.isReady) { bytes[13].put((byte)1); } else { bytes[13].put((byte)0); } total += bytes[13].limit(); } if (this.hasIsJoinGame()) { bytes[14] = ByteBuffer.allocate(1); if (this.isJoinGame) { bytes[14].put((byte)1); } else { bytes[14].put((byte)0); } total += bytes[14].limit(); } if (this.hasLoopEarnings()) { bytes[15] = ByteBuffer.allocate(4); bytes[15].putInt(this.loopEarnings); total += bytes[15].limit(); } if (this.hasIsOnLine()) { bytes[16] = ByteBuffer.allocate(1); if (this.isOnLine) { bytes[16].put((byte)1); } else { bytes[16].put((byte)0); } total += bytes[16].limit(); } ByteBuffer buf = ByteBuffer.allocate(3 + total); buf.put(this.__flag); for (int i = 0; i < bytes.Length; i++) { if (bytes[i] != null) { buf.put(bytes[i].array()); } } return(buf.array()); }
public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public BossData __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return(this); }
public static MutatorSettings GetRootAsMutatorSettings(ByteBuffer _bb) { return(GetRootAsMutatorSettings(_bb, new MutatorSettings())); }
public MutatorSettings __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return(this); }
public static TransformT GetRootAsTransformT(ByteBuffer _bb, TransformT obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static MutatorSettings GetRootAsMutatorSettings(ByteBuffer _bb, MutatorSettings obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
protected override void OnEncode(ByteBuffer buffer) { AmqpCodec.EncodeString(this.SqlExpression, buffer); AmqpCodec.EncodeInt(this.CompatibilityLevel, buffer); }
public TransformT __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return(this); }
public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static TransformT GetRootAsTransformT(ByteBuffer _bb) { return(GetRootAsTransformT(_bb, new TransformT())); }
public async Task OpenAsync(TimeSpan timeout, bool useWebSocket, X509Certificate2 clientCert, RemoteCertificateValidationCallback certificateValidationCallback, IWebProxy proxy) { if (Logging.IsEnabled) { Logging.Enter(this, $"{nameof(AmqpClientConnection)}.{nameof(OpenAsync)}"); } var hostName = _uri.Host; var tcpSettings = new TcpTransportSettings { Host = hostName, Port = _uri.Port != -1 ? _uri.Port : AmqpConstants.DefaultSecurePort }; TransportSettings = new TlsTransportSettings(tcpSettings) { TargetHost = hostName, Certificate = clientCert, CertificateValidationCallback = certificateValidationCallback }; TransportBase transport; if (useWebSocket) { transport = await CreateClientWebSocketTransportAsync(timeout, proxy).ConfigureAwait(false); SaslTransportProvider provider = _amqpSettings.GetTransportProvider <SaslTransportProvider>(); if (provider != null) { if (Logging.IsEnabled) { Logging.Info(this, $"{nameof(AmqpClientConnection)}.{nameof(OpenAsync)}: Using SaslTransport"); } _sentHeader = new ProtocolHeader(provider.ProtocolId, provider.DefaultVersion); ByteBuffer buffer = new ByteBuffer(new byte[AmqpConstants.ProtocolHeaderSize]); _sentHeader.Encode(buffer); _tcs = new TaskCompletionSource <TransportBase>(); var args = new TransportAsyncCallbackArgs(); args.SetBuffer(buffer.Buffer, buffer.Offset, buffer.Length); args.CompletedCallback = OnWriteHeaderComplete; args.Transport = transport; bool operationPending = transport.WriteAsync(args); if (Logging.IsEnabled) { Logging.Info(this, $"{nameof(AmqpClientConnection)}.{nameof(OpenAsync)}: Sent Protocol Header: {_sentHeader.ToString()} operationPending: {operationPending} completedSynchronously: {args.CompletedSynchronously}"); } if (!operationPending) { args.CompletedCallback(args); } transport = await _tcs.Task.ConfigureAwait(false); await transport.OpenAsync(timeout).ConfigureAwait(false); } } else { var tcpInitiator = new AmqpTransportInitiator(_amqpSettings, TransportSettings); transport = await tcpInitiator.ConnectTaskAsync(timeout).ConfigureAwait(false); } AmqpConnection = new AmqpConnection(transport, _amqpSettings, AmqpConnectionSettings); AmqpConnection.Closed += OnConnectionClosed; await AmqpConnection.OpenAsync(timeout).ConfigureAwait(false); _isConnectionClosed = false; }
public TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return(this); }
public static Hash GetRootAsHash(ByteBuffer _bb, Hash obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return(GetRootAsTableInC(_bb, new TableInC())); }
public static Thread GetRootAsThread(ByteBuffer _bb) { return(GetRootAsThread(_bb, new Thread())); }
public Hash __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return(this); }
public Thread __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return(this); }
public static Hash GetRootAsHash(ByteBuffer _bb) { return(GetRootAsHash(_bb, new Hash())); }