public static void Parse(System.IO.FileInfo file) { HTMLParser parser = new HTMLParser(file); System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle())); System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary())); System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding); for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine()) System.Console.Out.WriteLine(l); }
public static void Parse(System.IO.FileInfo file) { System.IO.FileStream fis = null; try { fis = new System.IO.FileStream(file.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read); HTMLParser parser = new HTMLParser(fis); System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle())); System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary())); System.Console.Out.WriteLine("Content:"); System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding); for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine()) System.Console.Out.WriteLine(l); } finally { if (fis != null) fis.Close(); } }
public static void Parse(System.IO.FileInfo file) { HTMLParser parser = new HTMLParser(file); System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle())); System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary())); System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding); for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine()) { System.Console.Out.WriteLine(l); } }
public static void Parse(System.IO.FileInfo file) { System.IO.FileStream fis = null; try { fis = new System.IO.FileStream(file.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read); HTMLParser parser = new HTMLParser(fis); System.Console.Out.WriteLine("Title: " + Entities.Encode(parser.GetTitle())); System.Console.Out.WriteLine("Summary: " + Entities.Encode(parser.GetSummary())); System.Console.Out.WriteLine("Content:"); System.IO.StreamReader reader = new System.IO.StreamReader(parser.GetReader().BaseStream, parser.GetReader().CurrentEncoding); for (System.String l = reader.ReadLine(); l != null; l = reader.ReadLine()) { System.Console.Out.WriteLine(l); } } finally { if (fis != null) { fis.Close(); } } }