Beispiel #1
0
        public SessionDataMessage(ulong sessionId, bool isCompleted, System.Buffers.IMemoryOwner <byte> data)
        {
            if (data is null)
            {
                throw new System.ArgumentNullException("data");
            }
            if (data.Memory.Length > 262144)
            {
                throw new System.ArgumentOutOfRangeException("data");
            }

            this.SessionId   = sessionId;
            this.IsCompleted = isCompleted;
            _data            = data;

            {
                var __h = new System.HashCode();
                if (this.SessionId != default)
                {
                    __h.Add(this.SessionId.GetHashCode());
                }
                if (this.IsCompleted != default)
                {
                    __h.Add(this.IsCompleted.GetHashCode());
                }
                if (!this.Data.IsEmpty)
                {
                    __h.Add(Omnix.Base.Helpers.ObjectHelper.GetHashCode(this.Data.Span));
                }
                __hashCode = __h.ToHashCode();
            }
        }
Beispiel #2
0
 private static void OnRawAsyncData(string ip, int port, long time, System.Buffers.IMemoryOwner <byte> data, string ID, uint ipuint)
 {
     using (data)
     {
         Console.WriteLine($"Data Received ASYNC: {data.Memory}");
     }
 }
Beispiel #3
0
            public Thumbnail Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                System.Buffers.IMemoryOwner <byte> p_value = Omnix.Base.SimpleMemoryOwner <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Value
                    {
                        p_value = r.GetRecyclableMemory(33554432);
                        break;
                    }
                    }
                }

                return(new Thumbnail(p_value));
            }
Beispiel #4
0
            public SessionDataMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                ulong p_sessionId   = 0;
                bool  p_isCompleted = false;

                System.Buffers.IMemoryOwner <byte> p_data = Omnix.Base.SimpleMemoryOwner <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // SessionId
                    {
                        p_sessionId = r.GetUInt64();
                        break;
                    }

                    case 1:     // IsCompleted
                    {
                        p_isCompleted = r.GetBoolean();
                        break;
                    }

                    case 2:     // Data
                    {
                        p_data = r.GetRecyclableMemory(262144);
                        break;
                    }
                    }
                }

                return(new SessionDataMessage(p_sessionId, p_isCompleted, p_data));
            }
Beispiel #5
0
        public Thumbnail(System.Buffers.IMemoryOwner <byte> value)
        {
            if (value is null)
            {
                throw new System.ArgumentNullException("value");
            }
            if (value.Memory.Length > 33554432)
            {
                throw new System.ArgumentOutOfRangeException("value");
            }

            _value = value;

            {
                var __h = new System.HashCode();
                if (!this.Value.IsEmpty)
                {
                    __h.Add(Omnix.Base.Helpers.ObjectHelper.GetHashCode(this.Value.Span));
                }
                __hashCode = __h.ToHashCode();
            }
        }
Beispiel #6
0
        /// <inheritdoc/>
        protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span <byte> buffer)
        {
            int height = stripHeight;

            using System.Buffers.IMemoryOwner <byte> scanLineBuffer = this.Allocator.Allocate <byte>(this.width * 2);
            Span <byte> scanLine = scanLineBuffer.GetSpan().Slice(0, this.width);
            Span <byte> referenceScanLineSpan = scanLineBuffer.GetSpan().Slice(this.width, this.width);

            using var bitReader = new T6BitReader(stream, this.FillOrder, byteCount, this.Allocator);

            var  referenceScanLine = new CcittReferenceScanline(this.isWhiteZero, this.width);
            uint bitsWritten       = 0;

            for (int y = 0; y < height; y++)
            {
                scanLine.Fill(0);
                Decode2DScanline(bitReader, this.isWhiteZero, referenceScanLine, scanLine);

                bitsWritten = this.WriteScanLine(buffer, scanLine, bitsWritten);

                scanLine.CopyTo(referenceScanLineSpan);
                referenceScanLine = new CcittReferenceScanline(this.isWhiteZero, referenceScanLineSpan);
            }
        }
 internal DiagnosticPoolBlock(System.Buffers.DiagnosticMemoryPool pool, System.Buffers.IMemoryOwner <byte> memoryOwner)
 {
 }