/// <summary> /// The entry point of the program, where the program control starts and ends. /// </summary> /// <param name='args'> /// The command-line arguments. /// </param> /// <returns> /// The exit code that is given to the operating system after the program ends. /// </returns> public static int Main(string[] args) { Catalog.Init("IdpGie", "./locale"); OutputDevice.AnalyzeAssembly(Assembly.GetExecutingAssembly()); WebShapeBase.AnalyzeAssembly(Assembly.GetExecutingAssembly()); ProgramManager manager = new ProgramManager(); try { manager.Run(args); } catch (Exception e) { Console.Error.Write("ERROR: "); Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); Console.Error.WriteLine("Try `idpgie --help' for more information."); return(0x01); } return(0x00); }
/// <summary> /// Translates the given node into a <see cref="IWebPagePiece"/>. /// </summary> /// <returns> /// An <see cref="IWebPagePiece"/> that corresponds to the given node. /// </returns> /// <param name='node'> /// The given <see cref="HtmlNode"/> to translate. /// </param> public static IWebPagePiece Translate(HtmlNode node) { switch (node.NodeType) { case HtmlNodeType.Element: if (WebShapeBase.ContainsTag(node.Name)) { return(WebShapeBase.DecodeWebShape(node).GetPagePiece()); } else { return(new HtmlElementPagePiece(node)); } case HtmlNodeType.Text: return(new HtmlTextWebPagePiece(node.InnerHtml)); default: return(DefaultWebPagePiece.SingleInstance); } }