private void Publish(IAdvController controller, Login login) { try { if (!controller.DoLogin(login)) { return; } } catch (Exception ex) { _logWriter.LogAction("Ошибка входа на сайт " + Environment.NewLine + ex); return; } foreach (var adv in _items) { try { controller.Post(adv); } catch (Exception ex) { _logWriter.LogAction("Ошибка публикации " + Environment.NewLine + ex); } } _logWriter.LogAction(string.Format("Публикация на {0} закончена.", controller.MainUrl)); SystemSounds.Asterisk.Play(); }
/// <summary> /// Dumps the element ids. /// </summary> /// <param name="document">The document.</param> /// <param name="logWriter">The log writer.</param> public static void DumpElements(Document document, ILogWriter logWriter) { logWriter.LogAction("Dump:"); IHTMLElementCollection elements = elementCollection(document); foreach (IHTMLElement e in elements) { logWriter.LogAction("id = " + e.id); } }
/// <summary> /// Dumps the elements with HTML source. /// </summary> /// <param name="document">The document.</param> /// <param name="logWriter">The log writer.</param> public static void DumpElementsWithHtmlSource(Document document, ILogWriter logWriter) { logWriter.LogAction("Dump:=================================================="); IHTMLElementCollection elements = elementCollection(document); foreach (IHTMLElement e in elements) { logWriter.LogAction("------------------------- " + e.id); logWriter.LogAction(e.outerHTML); } }
/// <summary> /// Dumps frame info. /// </summary> /// <param name="document">The document.</param> /// <param name="logWriter">The log writer.</param> public static void DumpFrames(Document document, ILogWriter logWriter) { FrameCollection frames = document.Frames; logWriter.LogAction("There are " + frames.Length.ToString() + " Frames"); int index = 0; foreach (Frame frame in frames) { logWriter.LogAction("Frame index: " + index.ToString()); logWriter.LogAction(" name: " + frame.Name); logWriter.LogAction(" scr: " + frame.Url); index++; } }