/// <summary> /// 获取所有生命在index索引时的数据 /// </summary> /// <param name="lifeList"></param> /// <param name="index"></param> /// <returns></returns> static public string GetAllLifeDataAtIndex(List <SnapshotNodeDataLife> lifeList, SnapshotInfo info) { StringBuilder result = new StringBuilder(); result.AppendLine($"===========【{info}】 ==========="); int count = lifeList.Count; for (int i = 0; i < count; i++) { result.AppendLine(string.Format("===========监控类型:{0}===========", lifeList[i].SnapshotType)); result.Append($"{GetNodeData(lifeList[i].GetSnapshotData(info.index))}"); result.AppendLine(string.Format("==================================")); result.AppendLine(""); } return(result.ToString()); }
/// <summary> /// 获取所有生命线在oldIndex到newIndex的差异 /// </summary> /// <param name="lifeList">生命线列表</param> /// <param name="oldInfo">旧索引</param> /// <param name="newInfo">新索引</param> /// <param name="isOnlyIncrease">是否只打印增量</param> /// <param name="isColorful">是否要打印带色彩</param> /// <returns></returns> static public string GetAllLifeDataDifferent(List <SnapshotNodeDataLife> lifeList, SnapshotInfo oldInfo, SnapshotInfo newInfo, bool isOnlyIncrease) { StringBuilder result = new StringBuilder(); bool bInit = false; int count = lifeList.Count; for (int i = 0; i < count; i++) { var nodeData = lifeList[i].GetDifferent(oldInfo.index, newInfo.index, isOnlyIncrease); if (nodeData.Count == 0) { continue; } if (!bInit) { result.AppendLine(string.Format("=======【{0}】和【{1}】 的对比结果=======", oldInfo, newInfo)); bInit = true; } result.AppendLine(string.Format("===========监控类型:{0}===========", lifeList[i].SnapshotType)); result.Append($"{GetNodeData(nodeData)}"); result.AppendLine(string.Format("==================================")); result.AppendLine(""); } if (bInit) { return(result.ToString()); } return(null); }