Ejemplo n.º 1
0
		public void LoadFromWordLines(String[] InputLines)
			{
			AlpenVereinPlainTextDataEntries = new DataCollection<AlpenVereinPlainTextDataEntry>();
			int LineIndex = -1;
			int EntryStartingLineNumber = -1;
			AlpenVereinPlainTextDataEntry ActuallEntry = null;
			foreach (String Line in InputLines)
				{
				LineIndex++;
				String LineReminder = String.Empty;
				DateTime? StartDate = null;
				DateTime? EndDate = null;
				if (StartOfEvent (Line, ref StartDate, ref EndDate, ref LineReminder))
					{
					if (ActuallEntry != null)
						{
						int MoveIndex = EntryStartingLineNumber + 1;
						while (MoveIndex < LineIndex)
							{
							if (!String.IsNullOrEmpty(InputLines[MoveIndex].Trim( )))
								ActuallEntry.EntryContent.Add (InputLines [MoveIndex]);
							MoveIndex++;
							}
						}
					ActuallEntry = new AlpenVereinPlainTextDataEntry();
					ActuallEntry.EntryHeadLine.Add (Line);
					EntryStartingLineNumber = LineIndex;
					AlpenVereinPlainTextDataEntries.Add(ActuallEntry);
					}
				}
			if (ActuallEntry != null)
				{
				int MoveIndex = EntryStartingLineNumber + 1;
				while (MoveIndex < LineIndex)
					{
					if (!String.IsNullOrEmpty(InputLines[MoveIndex].Trim()))
						ActuallEntry.EntryContent.Add(InputLines[MoveIndex]);
					MoveIndex++;
					}
				}

			}
Ejemplo n.º 2
0
		private void ParseSubHTMLDoc(String SubLinkAdress)
			{
			System.Net.WebClient WClient = new System.Net.WebClient();
			Byte[] Raw = WClient.DownloadData(String.Format(EntryWebAddressTemplate, SubLinkAdress));
			String WebContent = System.Text.Encoding.UTF8.GetString(Raw);
			HtmlDocument HtmlDoc = new HtmlDocument();
			TextReader Reader = new StringReader(SkipKnownProblemStrings(WebContent));
			HtmlDoc.Load(Reader);
			HtmlDoc.OptionAddDebuggingAttributes = true;
			XPathNavigator Nav = HtmlDoc.CreateNavigator();
			XPathNodeIterator contentHeadPaneOpen = Nav.Select("//div[@class=\'page-header\']/h2[@itemprop=\'name\']");
			contentHeadPaneOpen.MoveNext();
			String HeadLine = contentHeadPaneOpen.Current.Value.Trim();
			if (String.IsNullOrEmpty(HeadLine))
				return;
			AlpenVereinPlainTextDataEntry ActuallEntry = new AlpenVereinPlainTextDataEntry() { Parent = this };
			AlpenVereinPlainTextDataEntries.Add(ActuallEntry);
			ActuallEntry.EntryHeadLine.Add(HeadLine);
			XPathNodeIterator ContentContentPaneOpen = Nav.Select("//div[@itemprop=\'articleBody\']");
			ContentContentPaneOpen.MoveNext();
			String Value = Basics.ConvertEscapedHTMLToString(ContentContentPaneOpen
				.Current.Value.Replace("____NewLine____", "^")).Trim();
			List<String> LinesToAdd = new List<string>();
			foreach (String Line in Value.Split('^'))
				if ((!String.IsNullOrEmpty(Line))
					&& (Line.Trim() != ""))
					LinesToAdd.Add(Line);
			ActuallEntry.EntryContent.AddRange(LinesToAdd);

			}