コード例 #1
0
ファイル: HttpxChunks.cs プロジェクト: orf53975/IoTGateway
        internal static void ChunkReceived(object Sender, MessageEventArgs e)
        {
            string StreamId = XML.Attribute(e.Content, "streamId");
            string Key      = e.From + " " + StreamId;

            if (!chunkedStreams.TryGetValue(Key, out ChunkRecord Rec))
            {
                return;
            }

            int Nr = XML.Attribute(e.Content, "nr", 0);

            if (Nr < 0)
            {
                return;
            }

            bool Last = XML.Attribute(e.Content, "last", false);

            byte[] Data = Convert.FromBase64String(e.Content.InnerText);

            if (!Rec.ChunkReceived(Nr, Last, Data))
            {
                Rec.Dispose();
                chunkedStreams.Remove(Key);
            }
        }