private void GetHttpPayload(Frameunit frameunit)
        {
            string tcpSeqNum  = frameunit.fieldUnit.sourceAddr + "_" + frameunit.fieldUnit.destAddr + "_" + frameunit.propertyUnit.tcpSeqNumber;
            string nextSeqNum = frameunit.fieldUnit.sourceAddr + "_" + frameunit.fieldUnit.destAddr + "_" + (frameunit.propertyUnit.tcpSeqNumber + frameunit.propertyUnit.tcpPayloadLength);
            string uri        = frameunit.propertyUnit.httpserver + frameunit.propertyUnit.httpurilocation;
            int    frameNum   = frameunit.frameNum;

            if (URIResFragments.ContainsKey(uri) && pastFrameNum.Contains(tcpSeqNum) == false)
            {
                fragments frag = new fragments();
                frag.tcpSeqNum     = nextSeqNum;
                frag.fragmentsInfo = new List <string>();

                fragments target = URIResFragments[uri];
                if (target.tcpSeqNum == tcpSeqNum)
                {
                    target.fragmentsInfo.Add(frameNum + "_HTTP");
                    target.tcpSeqNum     = nextSeqNum;
                    URIResFragments[uri] = target;
                }
                else
                {
                    frag.fragmentsInfo.Add(frameNum + "_HTTP");
                    URIResFragments[uri] = frag;
                }

                pastFrameNum.Add(tcpSeqNum);
            }
        }
        private void GetTcpPayload()
        {
            List <int> tcpFrames       = new List <int>();
            bool       needAnotherLoop = true;
            List <int> needLoop        = _CommonNums;

            while (needAnotherLoop)
            {
                needAnotherLoop = false;
                tcpFrames       = needLoop;
                needLoop        = new List <int>();
                foreach (int tcpframe in tcpFrames)
                {
                    int       frameNum   = tcpframe;
                    Frameunit frameunit  = _frameNumberDict[frameNum];
                    string    tcpSeqNum  = frameunit.fieldUnit.sourceAddr + "_" + frameunit.fieldUnit.destAddr + "_" + frameunit.propertyUnit.tcpSeqNumber;
                    string    nextSeqNum = frameunit.fieldUnit.sourceAddr + "_" + frameunit.fieldUnit.destAddr + "_" + (frameunit.propertyUnit.tcpSeqNumber + frameunit.propertyUnit.tcpPayloadLength);
                    if (pastFrameNum.Contains(tcpSeqNum) == false)
                    {
                        if (FindSeqNumInDict(tcpSeqNum) == false)
                        {
                            needLoop.Add(frameNum);
                        }
                        else
                        {
                            fragments target = URIResFragments[_currentUri];
                            //change target.tcpSeqNum
                            target.tcpSeqNum = nextSeqNum;
                            target.fragmentsInfo.Add(frameNum + "_TCP");
                            pastFrameNum.Add(tcpSeqNum);
                            needAnotherLoop = true; // some tcp frame might arrive at a wrong order comparing to its seqnumber
                        }
                    }
                }
            }
        }
        private void CreateResource(string uri, fragments frag)
        {
            // Console.WriteLine("uri:"+uri);
            string    http_frame    = frag.fragmentsInfo[0];
            int       startframeNum = Int32.Parse(http_frame.Split('_')[0]);
            Frameunit frameunit     = _frameNumberDict[startframeNum];
            string    contentType   = frameunit.propertyUnit.httpcontentType;
            // Console.WriteLine(contentType);
            string urilocation = frameunit.propertyUnit.httpurilocation;
            string outputName  = _outputFolder + "\\" + startframeNum + "_" + urilocation.Split('/')[urilocation.Split('/').Length - 2] + "_" + urilocation.Split('/')[urilocation.Split('/').Length - 1];

            List <Byte> fragBytes = _payloadProcessing.ConstructFragments(frag.fragmentsInfo, frameunit.propertyUnit.httpcontentEncoding);

            Console.WriteLine(uri + ":" + frameunit.propertyUnit.httpcontentType + ": " + frameunit.propertyUnit.httpcontentEncoding);
            string writeline = uri + "," + contentType;

            // _csvWriter.AddLineToCsv(writeline);
            _csvAllLines.Add(writeline);
            Console.WriteLine("transfer type:" + frameunit.propertyUnit.httptransferType);
            if (fragBytes.Count > 0)
            {
                _fileConstructor = new FileConstructor(fragBytes, contentType, frameunit.propertyUnit.httpcontentEncoding, frameunit.propertyUnit.httptransferType, outputName, uri);
                Console.WriteLine(_fileConstructor.IsSuccessful);
                if (_fileConstructor.IsSuccessful == false)
                {
                    string retsr = "";
                    foreach (string item in frag.fragmentsInfo)
                    {
                        retsr += item + ", ";
                    }
                    Console.WriteLine("uri:" + uri);
                    Console.WriteLine(retsr);
                    Console.WriteLine("\n\n");
                }
            }
        }