public unsafe int imethod_43() { int int32; fixed(byte *pointer = this.byte_5) { this.method_1(pointer); int32 = LittleEndianBitConverter.ToInt32(this.byte_5); } return(int32); }
/// <summary> /// Read data from stream /// </summary> /// <param name="s">stream</param> /// <returns>data of specified type</returns> public static byte[] ToData(Stream s) { byte[] lenBuf = new byte[sizeof(int)]; s.Read(lenBuf, 0, lenBuf.Length); int len = LittleEndianBitConverter.ToInt32(lenBuf, 0); if (len == 0) { return(null); } else { byte[] buf = new byte[len]; s.Read(buf, 0, len); return(buf); } }
/// <summary> /// Read data from stream /// </summary> /// <param name="s">stream</param> /// <returns>data of specified type</returns> public static string ToString(Stream s) { byte[] lenBuf = new byte[sizeof(int)]; s.Read(lenBuf, 0, lenBuf.Length); int len = LittleEndianBitConverter.ToInt32(lenBuf, 0); if (len == 0) { return(null); } else { byte[] buf = new byte[len]; s.Read(buf, 0, len); return(Encoding.UTF8.GetString(buf, 0, buf.Length)); } }
private static int smethod_1(Stream stream, byte[] buffer) { stream.Read(buffer, 0, 4); return(LittleEndianBitConverter.ToInt32(buffer)); }
public static int smethod_7(Stream stream) { byte[] numArray = new byte[4]; stream.Read(numArray, 0, 4); return(LittleEndianBitConverter.ToInt32(numArray, 0)); }
public void ToXXX_ThrowsOnNull() { var sut = new LittleEndianBitConverter(); Check.ThatCode(() => sut.ToInt32(null, 0)).Throws <ArgumentNullException>(); }
private void InnerConnect(int millisecondsTimeout) { if (Closing) { throw new NTcpException("Can't operate SingleConnectionCable when it is closing.", ErrorCode.Closing); } if (TryToConnect) { throw new NTcpException("Try to connect by other tread now.", ErrorCode.TryToConenct); } try { try { if (!_SyncConnection.Connected) { TryToConnect = true; CableId = 0; _SyncConnection.Connect(millisecondsTimeout, true); ulong processAffinity = (ulong)System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity; byte[] ret = _SyncConnection.SyncSend(MessageFlag.Inner, (uint)InnerEvent.GetProcessorId, LittleEndianBitConverter.GetBytes(processAffinity)); int processorId = LittleEndianBitConverter.ToInt32(ret, 0); CableId = LittleEndianBitConverter.ToUInt16(ret, sizeof(int)); _SyncConnection.SetProcessorId(processorId); OnConnectedEvent(); } } catch (Exception e) { OnErrorEvent("InnerConnect", e); return; } if (Capacity == 1) { return; } while (true) { SingleConnection pendingConn; lock (_LockObj) { if (_PendingAsyncConnections.Count <= 0) { return; } pendingConn = _PendingAsyncConnections.Dequeue(); } try { TryToConnect = true; pendingConn.Connect(millisecondsTimeout); lock (_LockObj) { _WorkingAsyncConnections.AddLast(pendingConn); } } catch (Exception e) { _PendingAsyncConnections.Enqueue(pendingConn); OnErrorEvent("InnerConnect", e); return; } } } finally { TryToConnect = false; } }
public virtual int vmethod_8() { byte[] numArray = new byte[4]; this.stream_0.Read(numArray, 0, 4); return(LittleEndianBitConverter.ToInt32(numArray)); }