void JsonWrite(Data.EventDataRow e) { if (streamWriter != null) { streamWriter.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(e.DataRow.GetDataDicForJson())); } }
void FileSave_Commited(object sender, Data.EventDataRow e) { if (count % 10000 == 0) { CheckFileSizeAndCreate(); } count++; if (SaveFileType == FileType.Tsv) { TsvWrite(e); } else { JsonWrite(e); } }
void TsvWrite(Data.EventDataRow e) { if (streamWriter != null) { foreach (var item2 in order) { if (e.DataRow.DataDic.ContainsKey(item2)) { var item = e.DataRow.DataDic[item2]; if (item.First() != null) { if (item.Count > 1) { item.ForEach(n => streamWriter.Write(n.ReadLines().Select(m => m.Replace("\t", " ").Trim()).JoinText(" ") + ",")); } else { streamWriter.Write(item.First().ReadLines().Select(m => m.Replace("\t", " ").Trim()).JoinText(" ")); } } } streamWriter.Write("\t"); } foreach (var item in e.DataRow.DataDic.OrderBy(n => n.Key).Where(n => order.Contains(n.Key) == false)) { if (item.Key.Length > 0) { streamWriter.Write(item.Key + ":"); } if (item.Value.Count > 1) { item.Value.ForEach(n => streamWriter.Write(n.ReadLines().Select(m => m.Replace("\t", " ").Trim()).JoinText(" ") + ",")); } else { streamWriter.Write(item.Value.First().ReadLines().Select(m => m.Replace("\t", " ").Trim()).JoinText(" ")); } streamWriter.Write("\t"); } streamWriter.WriteLine(); } }