public override void Parse() { var lines = ContentRaw.Split(END_OF_LINE, StringSplitOptions.None); var attributeLines = lines .Select(x => x.Trim()) .TakeWhile(x => !SEPARATOR.Equals(x)) .Where(x => !string.IsNullOrEmpty(x)); foreach (var attributeLine in attributeLines) { ParseAttributeLine(attributeLine); } var contentLines = lines.SkipWhile(x => !SEPARATOR.Equals(x)).Skip(1); ParseContent(contentLines); }
// Load the data public void Load(string record) { // Clear the content ContentDictionary.Clear(); ContentRaw = string.Empty; Labels.Clear(); // Loop through the content of the record to generate the content that will be sent to Loki string[] recordFragments = record.Split('\t'); for (int i = 0; i < recordFragments.Length; i++) { // We only add the fields that we do not want to drop if (!_fieldsToDrop.Contains(_fieldsReceived[i])) { ContentDictionary.Add(_fieldsReceived[i], recordFragments[i]); ContentRaw += recordFragments[i] + "\t"; } } ContentRaw = ContentRaw.TrimEnd('\t'); // Trim last tab // Generates the labels GenerateLabels(); }