private void ParseInputFile(string inputFileName) { using (StreamReader fsource = new StreamReader(inputFileName)) { TracingLog CurrentNode = new TracingLog(); string line = fsource.ReadLine(); while (line != null) { line = line.Trim(); int Index = line.IndexOf("\": \""); if (Index > 0) { string[] lineArr = new string[2]; lineArr[0] = line.Substring(1, Index - 1); int Length = line.Length; int tailLength = 1; if (line[Length - 1] == ',') { tailLength = 2; } lineArr[1] = line.Substring(Index + 4, Length - (Index + 4) - tailLength); CurrentNode.SetFieldByStringArr(lineArr); } else if (line == "{") { CurrentNode = new TracingLog(); } else if (line[0] == '}') { TracingLogDict.AddToDict(CurrentNode); } line = fsource.ReadLine(); } return; } }
public void AddToDict(TracingLog Item) { TracingLogLinkNode LinkedNode = new TracingLogLinkNode(Item); if (LogDict.ContainsKey(Item.trace_id)) { TracingLogLinkNode DictNode = LogDict[Item.trace_id]; if (Item.DateTime < DictNode.TracingLog.DateTime) { LinkedNode.Next = DictNode; LogDict[Item.trace_id] = LinkedNode; } else { DictNode.AddNode(LinkedNode); } } else { LogDict[Item.trace_id] = LinkedNode; } }
public TracingLogLinkNode(TracingLog Item) { TracingLog = Item; }