public static async Task <List <KworkRecord> > Parse(ChromiumWebBrowser wv) { var res = new List <KworkRecord>(); var strList = (await GetFromPage(wv)).Split(new string[] { "^^^" }, StringSplitOptions.None); for (int i = 0; i < strList.Length - 1; i++) { try { var recordArr = strList[i].Split(new string[] { "###" }, StringSplitOptions.None); var newRecord = new KworkRecord() { Title = recordArr[0], Text = recordArr[1], Info = recordArr[2], ParseDate = DateTime.Now }; if (newRecord.Text.EndsWith("Скрыть")) { newRecord.Text = newRecord.Text.Remove(newRecord.Text.Length - 6); } newRecord.Text = newRecord.Text.Trim(); res.Add(newRecord); WindowLogger.Log($"Parsed record *{newRecord.Title}*."); } catch (Exception ex) { WindowLogger.Log("Error while parsing record."); WindowLogger.Log(ex.ToString()); } } return(res); }
public static async Task Send(KworkRecord rec) { string text = rec.Title + "\n\n" + rec.Text + "\n\n" + rec.Info; await Send(text); }