From 5dd3bf8e81218cc6e54076e3199fedfa2cacd2f1 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 19 Nov 2015 14:14:50 -0500 Subject: [PATCH] My changes --- EduNetworkBuilder/Packet.cs | 32 +++++++++---------- .../Resources/languages/edustrings.resx | 24 ++++++++++++++ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/EduNetworkBuilder/Packet.cs b/EduNetworkBuilder/Packet.cs index ebc66b4..6b491ae 100644 --- a/EduNetworkBuilder/Packet.cs +++ b/EduNetworkBuilder/Packet.cs @@ -106,7 +106,7 @@ namespace EduNetworkBuilder health = copyfrom.health; StartTime = copyfrom.StartTime; OriginalDestIP = copyfrom.OriginalDestIP; - Tracking.AddMessage(DebugLevel.debug, WhereAmI, "Packet duplicated"); + Tracking.AddMessage(DebugLevel.debug, WhereAmI, NB.Translate("P_PacketDuplicated")); } //Generate a packet with the given payload. @@ -121,7 +121,7 @@ namespace EduNetworkBuilder sourceMAC = source; destMAC = dest; OutboundDestMAC = dest; - Tracking.AddMessage(DebugLevel.info, start, theType.ToString() + string.Format("Packet Created")); + Tracking.AddMessage(DebugLevel.info, start, theType.ToString() + string.Format(NB.Translate("Packet Created"))); Tracking.AddMessage(DebugLevel.routing, start, string.Format(" MAC: {0} -> {1}", source, dest)); } else @@ -134,9 +134,9 @@ namespace EduNetworkBuilder destMAC = NB.BroadcastMACString; OutboundDestMAC = destMAC; } - Tracking.AddMessage(DebugLevel.info, start, "Packet Created"); + Tracking.AddMessage(DebugLevel.info, start, NB.Translate("Packet Created")); Tracking.AddMessage(DebugLevel.routing, start, string.Format(" IP: {0} -> {1}", source, dest)); - Tracking.AddMessage(DebugLevel.debug, start, string.Format(" IPs Translated {0} -> {1}",sourceIP.GetIP.ToIpString(), destIP.GetIP.ToIpString())); + Tracking.AddMessage(DebugLevel.debug, start, string.Format(NB.Translate(" IPs Translated {0} -> {1}"),sourceIP.GetIP.ToIpString(), destIP.GetIP.ToIpString())); } isFresh = true; } @@ -153,7 +153,7 @@ namespace EduNetworkBuilder destIP = dest; if (destIP != null && destIP.BroadcastAddress == destIP.GetIP) destMAC = NB.BroadcastMACString; - Tracking.AddMessage(DebugLevel.info, start, "Packet Created"); + Tracking.AddMessage(DebugLevel.info, start, NB.Translate("Packet Created")); Tracking.AddMessage(DebugLevel.routing, start, string.Format(" IP:{0} -> {1}", sourceIP.GetIP.ToIpString(), dest.GetIP.ToIpString())); } else @@ -161,7 +161,7 @@ namespace EduNetworkBuilder sourceIP = new IPAddress(NB.ZeroIPString); destMAC = NB.BroadcastMACString; destIP = dest; - Tracking.AddMessage(DebugLevel.info, start, "Packet Created"); + Tracking.AddMessage(DebugLevel.info, start, NB.Translate("Packet Created")); //Tracking.AddMessage(DebugLevel.routing, start, " IP:" + sourceIP.GetIP.ToIpString() + " -> " + dest.GetIP.ToIpString()); } isFresh = true; @@ -261,8 +261,8 @@ namespace EduNetworkBuilder if(MyNet.CountPackets(PacketType.arp_answer) + MyNet.CountPackets(PacketType.arp_request) == 0) { //No more arps going. We do not have an answer! - Tracking.AddMessage(DebugLevel.info, WhereAmI, string.Format("Unable to find a mac address for the IP address: {0}", dest.GetIP.ToIpString())); - Tracking.Status = string.Format("{0} Failed: Unable to find a MAC address for the specified IP.", WhereAmI.hostname ); + Tracking.AddMessage(DebugLevel.info, WhereAmI, NB.Translate("P_ProcessTick") + ": "+ dest.GetIP.ToIpString()); + Tracking.Status = WhereAmI.hostname + NB.Translate("P_ProcessTick"); MyStatus = PacketStatus.finished_failed; } return; @@ -277,8 +277,8 @@ namespace EduNetworkBuilder //We pass it to the device if (WhereAmI == null) { - AddMessage(DebugLevel.debug, "The packet was dropped because we lost where it was. WhereAmI == null!"); - Tracking.Status = "NO_Host Lost location of packet.."; + AddMessage(DebugLevel.debug, NB.Translate("P_PacketLostLong")); + Tracking.Status = NB.Translate("P_PacketLostShort"); MyStatus = PacketStatus.finished_failed; return; //We cannot process the packet } @@ -297,8 +297,8 @@ namespace EduNetworkBuilder //So, we pass the packet to the device to process if (WhereAmI == null) { - AddMessage(DebugLevel.debug, "The packet was dropped because we lost where it was. WhereAmI == null!"); - Tracking.Status = "NO_Host Lost location of packet.."; + AddMessage(DebugLevel.debug, NB.Translate("P_PacketLostLong")); + Tracking.Status = NB.Translate("P_PacketLostShort"); MyStatus = PacketStatus.finished_failed; return; //We cannot process the packet } @@ -309,8 +309,8 @@ namespace EduNetworkBuilder { if (WhereAmI == null) { - AddMessage(DebugLevel.debug, "The packet was dropped because we lost where it was. WhereAmI == null!"); - Tracking.Status = "NO_Host Lost location of packet.."; + AddMessage(DebugLevel.debug, NB.Translate("P_PacketLostLong")); + Tracking.Status = NB.Translate("P_PacketLostShort"); MyStatus = PacketStatus.finished_failed; return; //We cannot process the packet } @@ -340,8 +340,8 @@ namespace EduNetworkBuilder myDirection = nb_direction.to_dst; else myDirection = nb_direction.to_src; - Console.WriteLine(string.Format("Starting on link. SMAC: {0} DMAC: {1}",sourceMAC,destMAC)); - AddMessage(DebugLevel.debug, " Starting on link"); + Console.WriteLine(NB.Translate("Starting on link.") + string.Format(" SMAC: {0} DMAC: {1}",sourceMAC,destMAC)); + AddMessage(DebugLevel.debug, " " + "Starting on link"); } public void StartOnDevice(NetworkDevice theDevice) diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx index 11c90e1..b6b1ef0 100644 --- a/EduNetworkBuilder/Resources/languages/edustrings.resx +++ b/EduNetworkBuilder/Resources/languages/edustrings.resx @@ -1525,6 +1525,30 @@ unknown PacketMessage PM_UnknownHost = unknown + + IPs Translated {0} -> {1} + Packet IPsTranslated = IPs Translated {0} -> {1} + + + Packet Created + Packet P_PacketCreated = Packet Created + + + Packet duplicated + Packet P_PacketDuplicated = Packet duplicated + + + The packet was dropped because we lost where it was. WhereAmI == null! + P_PacketLostLong = The packet was dropped because we lost where it was. WhereAmI == null! + + + NO_Host Lost location of packet.. + P_PacketLostShort = NO_Host Lost location of packet.. + + + Unable to find a MAC address for the IP address + P_ProcessTick = Unable to find a MAC address for the IP address + Not found. RTFW_NotFound = Not found.