/// <summary> /// 增加流表项 /// </summary> /// <param name="fItem"></param> public void AddItem(FlowTableItem fItem) { try { SortedItemList.Add(fItem.strDesIP, fItem); } //已经存在键值相同的Item catch (System.ArgumentException) { } }
/// <summary> /// 处理控制器下发的Pakcet_Out消息,监听子线程调用 /// </summary> /// <param name="packetInfo"></param> public static void DealPacketOut(PacketInfo packetInfo) { Console.WriteLine("packet_out"); byte[] buffer = packetInfo.GetPacketByte(); PacketEntity packet = (PacketEntity)Util.BytesToObject(buffer); byte[] FlowBuffer = packet.GetByteContent(); Dictionary <string, int> dictionary = (Dictionary <string, int>)Util.BytesToObject(FlowBuffer); for (int i = 0; i < dictionary.Count; i++) { //Console.WriteLine(dictionary.ElementAt(i).Key + " " + dictionary.ElementAt(i).Value); FlowTableItem fItem = new FlowTableItem(dictionary.ElementAt(i).Key, dictionary.ElementAt(i).Value); FlowTable.GetInstance().AddItem(fItem); } FlowTable.PrintItems(); }