Example #1
0
        public void readRest(BinaryReader b)
        {

           
/*
            if (msgPointer != 0)
            {

                mainVein = new MessageNode(true);

                Int64 oldPos = b.BaseStream.Position;

                b.BaseStream.Seek(msgPointer, SeekOrigin.Begin);

                mainVein.readIn(this, b);

                b.BaseStream.Seek(oldPos, SeekOrigin.Begin);
            }
 */
            mainVein = new MessageNode(true);

            mainVein.runningText = MessageNode.blazeTrail(msgPointer, b);

            Program.mWriteCount++;


            string illegal = "(" + dateToGoodDTS(dtf) + "," + Program.mWriteCount + ") " + subjectLine;
            string regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
            Regex r = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch)));
            illegal = r.Replace(illegal, "");
           File.WriteAllText("mail/" + illegal + ".eml", mainVein.runningText);
           File.SetCreationTime("mail/" + illegal + ".eml", dtf);
           File.SetLastWriteTime("mail/" + illegal + ".eml", dtf);

        }
Example #2
0
        public void readIn(MessageInfo parent, BinaryReader b)
        {
            parentMessage = parent;

            // if (iAmLegend)
            //    Console.WriteLine(parentMessage.subjectLine);

            if (parentMessage == null)
            {
                Console.WriteLine("orphan");
                return;
            }

            depth++;

            objectMarker = b.ReadInt32();
            bodyLength   = b.ReadInt32();
            textLength   = b.ReadInt32();
            nextNode     = b.ReadInt32();

            //Console.WriteLine();
            // Console.WriteLine("Depth: " + depth);
            //  Console.WriteLine("OBJMARC: " + objectMarker);
            //  Console.WriteLine("BODLEN: " + bodyLength);
            //  Console.WriteLine("TEXTLEN: " + textLength);
            //  Console.WriteLine("NEXTNODE: " + nextNode);

            if (textLength < 1)
            {
                return;
            }

            /*if (depth > 999)
             * {
             *  Program.badMessages.Add(parent);
             *  Console.WriteLine("BADDIE " + parentMessage.subjectLine);
             *  return;
             * }*/

            List <Byte> charList = new List <Byte>();

            for (int i = 0; i < textLength; i++)
            {
                Byte c = b.ReadByte();
                charList.Add(c);
            }

            text = Encoding.ASCII.GetString(charList.ToArray());

            runningText   = text;
            runningLength = textLength;

            if (nextNode == 0)
            {
                return;
            }

            if (nextNode != 0)
            {
                Int64 oldPos = b.BaseStream.Position;
                b.BaseStream.Seek(nextNode, SeekOrigin.Begin);
                MessageNode nextNodeStruct = new MessageNode(false);

                nextNodeStruct.legendObject  = legendObject;
                nextNodeStruct.depth         = depth;
                nextNodeStruct.parentMessage = parentMessage;
                nextNodeStruct.readIn(parentMessage, b);

                runningText   += nextNodeStruct.runningText;
                runningLength += nextNodeStruct.runningLength;
                b.BaseStream.Seek(oldPos, SeekOrigin.Begin);

                // if (iAmLegend)
                //     Console.WriteLine(runningText);
            }



            //  Console.WriteLine(objectMarker + " : " + runningLength);
        }