Example #1
0
 public static Headerv1 ParseHeaderv1(string filePath)
 {
     System.IO.FileStream fs = System.IO.File.OpenRead(filePath);
     byte[] data = new byte[fs.Length];
     fs.Read(data, 0, System.Convert.ToInt32(fs.Length));
     fs.Close();
     Headerv1 hdr = new Headerv1();
     hdr._data = data;
     Parser.ParseHeaderv1(ref hdr);
     return hdr;
 }
Example #2
0
		private static void ParseHeaderv1(ref Headerv1 header)
		{
			try
			{
				string hdr = System.Text.Encoding.ASCII.GetString(header._data);
				hdr = hdr.Replace("\n\n","\r\n\r\n");
				hdr = hdr.Replace("\r\r","\r\n\r\n");
				hdr = hdr.Replace("\r\n\t","²didju²");
				hdr = hdr.Replace("\n\t","\r\n\t");
				hdr = hdr.Replace("²didju²","\r\n\t");
				hdr = hdr.Replace("\r\n\t","²didju²");
				hdr = hdr.Replace("\r\t","\r\n\t");
				hdr = hdr.Replace("²didju²","\r\n\t");
				if(hdr.LastIndexOf("\r\n\r\n")!=-1) header.Lines = Codec.RFC2047Decode(hdr.Substring(0,hdr.IndexOf("\r\n\r\n")).Replace("\r\n\t"," ").Replace("\r\n "," "))+"\r\n";
				else header.Lines = Codec.RFC2047Decode(hdr.Replace("\r\n\t"," ").Replace("\r\n "," "));
			}
			catch(System.Exception) {  }
		}