From b2662c6abaa24ca9fad2050526eefdca780efd6f Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 19 Nov 2015 12:00:34 -0500 Subject: [PATCH] Clean up strings for translation --- EduNetworkBuilder/NetworkDevice.cs | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 1cd1f34..7e01437 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -1580,7 +1580,7 @@ namespace EduNetworkBuilder else { tPacket.AddMessage(DebugLevel.info, "The broadcast ping reached a destination that was not on the same network"); - tPacket.Tracking.Status = hostname + ":\t" + "The broadcast ping reached a destination that was not on the same network" + tPacket.sourceIP.GetIP.ToIpString() + " -> " + hostname; + tPacket.Tracking.Status = hostname + ":\t" + string.Format("The broadcast ping reached a destination that was not on the same network") + tPacket.sourceIP.GetIP.ToIpString() + " -> " + hostname; tPacket.MyStatus = PacketStatus.finished_ok; } return; @@ -1592,7 +1592,7 @@ namespace EduNetworkBuilder { if (tPacket.health < 100) { - tPacket.AddMessage(DebugLevel.info, "Success! The ping returned from its destination." + " But some was lost: health=" + tPacket.health.ToString() ); + tPacket.AddMessage(DebugLevel.info, string.Format("Success! The ping returned from its destination. But some was lost: health={0}", tPacket.health.ToString()) ); int left = 100 - tPacket.health; tPacket.Tracking.Status = hostname + string.Format(":\tPing partial success: {0}% packet loss. {1} -> {2}", left , tPacket.sourceIP.GetIP.ToIpString(),tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_ok; @@ -1600,7 +1600,7 @@ namespace EduNetworkBuilder else { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReturn1")); - tPacket.Tracking.Status = hostname + ":\tPing success: The ping returned from its destination" + tPacket.sourceIP.GetIP.ToIpString() + " -> " + tPacket.destIP.GetIP.ToIpString(); + tPacket.Tracking.Status = hostname + string.Format(":\tPing success: The ping returned from its destination {0} -> {1}", tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_ok; if (tPacket.sourceIP.GetIP != 0) { @@ -1615,7 +1615,7 @@ namespace EduNetworkBuilder else { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PackReturnErr1")); - tPacket.Tracking.Status = hostname + ":\tPing failed: Arrived at a machine that was not expecting it and was rejected." + tPacket.sourceIP.GetIP.ToIpString() + " -> " + tPacket.destIP.GetIP.ToIpString(); + tPacket.Tracking.Status = hostname + string.Format(":\tPing failed: Arrived at a machine that was not expecting it and was rejected. {0} -> {1}", tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_failed; } return; @@ -1667,7 +1667,7 @@ namespace EduNetworkBuilder nPacket.MyStatus = PacketStatus.processing; tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_ArpReached1")); - tPacket.Tracking.Status = hostname + ":\tArp Request found IP: " + tPacket.sourceIP.GetIPString + " on MAC: "+ nPacket.sourceMAC; + tPacket.Tracking.Status = hostname + ":\t" + string.Format("Arp Request found") + "IP: " + tPacket.sourceIP.GetIPString + " MAC: "+ nPacket.sourceMAC; tPacket.MyStatus = PacketStatus.finished_ok; } else @@ -1685,14 +1685,14 @@ namespace EduNetworkBuilder NetworkCard nic = LocalNic(tPacket.destIP); HostNicID myid = nic.myID; StoreArp(tPacket.sourceMAC, tPacket.TsourceIP.GetIP.ToIpString(), myid); - tPacket.Tracking.Status = hostname + ":\tArp request success: Who Has " + tPacket.sourceIP.GetIP.ToIpString() + " tell " + tPacket.sourceIP.GetIP.ToIpString() + " = " + tPacket.sourceMAC; + tPacket.Tracking.Status = hostname + ":\t" + string.Format("Arp request success: Who Has {0} tell {1} = {2}", tPacket.sourceIP.GetIP.ToIpString(), tPacket.sourceIP.GetIP.ToIpString(), tPacket.sourceMAC); tPacket.MyStatus = PacketStatus.finished_ok; //Yay! myNet.NotePacketArrived(tPacket.MyType, this, tPacket.destIP, tPacket.sourceIP); } else { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PackReturnErr1")); - tPacket.Tracking.Status = hostname + ":\tARP failed: Arrived at a machine that was not expecting it and was rejected." + tPacket.sourceIP.GetIP.ToIpString() + " -> " + tPacket.destIP.GetIP.ToIpString(); + tPacket.Tracking.Status = hostname + ":\t" + string.Format("ARP failed: Arrived at a machine that was not expecting it and was rejected. {0} -> {1}", tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_failed; } return; @@ -1741,7 +1741,7 @@ namespace EduNetworkBuilder IPAddress tIP = HubManagementIP(); if (tIP != null) IP = tIP.GetIPString; } - tPacket.Tracking.Status = hostname + ":\tDHCP Request found Server: " + IP; + tPacket.Tracking.Status = hostname + ":\t" + string.Format("DHCP Request found Server: {0}", IP); //If we are a wireless router, we need to keep passing the broadcast request on if(!DoesForwarding()) tPacket.MyStatus = PacketStatus.finished_ok; @@ -1761,7 +1761,7 @@ namespace EduNetworkBuilder tPacket.payloadIP = new IPAddress(NB.ZeroIPString); tnic.SetIPForDHCP(tPacket.payloadIP); IsDirty = true; //If we need to redraw the device IP - tPacket.Tracking.Status = hostname + ":\tDHCP request/answer. " + tPacket.payloadIP.GetIP.ToIpString(); + tPacket.Tracking.Status = hostname + ":\t" + string.Format("DHCP request/answer. {0}", tPacket.payloadIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_ok; //Yay! myNet.NotePacketArrived(tPacket.MyType, this, tPacket.payloadIP, tPacket.sourceIP); return; @@ -1773,7 +1773,7 @@ namespace EduNetworkBuilder string sIP = "?.?.?.?"; if (tPacket.sourceIP != null) sIP = tPacket.sourceIP.GetIP.ToIpString(); - tPacket.Tracking.Status = hostname + ":\tDHCP Request failed: Arrived at a machine that was not expecting it and was rejected." + sIP + " -> " + tPacket.destIP.GetIP.ToIpString(); + tPacket.Tracking.Status = hostname + ":\t" + string.Format("DHCP Request failed: Arrived at a machine that was not expecting it and was rejected. {0} -> {1}", sIP, tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_failed; } return; @@ -1982,15 +1982,15 @@ namespace EduNetworkBuilder { if (tPacket.MyType == PacketType.dhcp_answer) { - tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: DHCP Server does not have gateway set. DHCP server failing" + tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " ERROR: DHCP Server does not have gateway set. DHCP server failing"; + tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: DHCP Server does not have gateway set. DHCP server failing") + " " + tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = hostname + string.Format(" ERROR: DHCP Server does not have gateway set. DHCP server failing"); tPacket.MyStatus = PacketStatus.finished_failed; return false; } else { - tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: No route or local interface for packet. " + tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " No route or local interface for packet."; + tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: No route or local interface for packet.") +" "+ tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = hostname + "ERROR: No route or local interface for packet."; tPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -2003,8 +2003,8 @@ namespace EduNetworkBuilder tPacket.OutboundNic = LocalNic(tPacket.OutboundIP); if (tPacket.OutboundNic == null) { - tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: No local Network Card for packet. :" + tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " No route or local network card for packet."; + tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: No local Network Card for packet.") + " :"+ tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = hostname + " ERROR: No local Network Card for packet."; tPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -2015,8 +2015,8 @@ namespace EduNetworkBuilder tPacket.OutboundIF = tPacket.OutboundNic.LocalInterface(tPacket.OutboundIP, tPacket.Tracking); if (tPacket.OutboundIF == null) { - tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: No local interface for packet. :" + tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " No route or local interface for packet."; + tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: No route or local interface for packet.") + " :" + tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = hostname + " ERROR: No route or local interface for packet."; tPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -2193,7 +2193,7 @@ namespace EduNetworkBuilder if(nc == null) { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_DoInputFromLink_CardFail1")); - tPacket.Tracking.Status = hostname + " Failed: no card available to use."; + tPacket.Tracking.Status = hostname + string.Format(" Failed: no card available to use."); tPacket.MyStatus = PacketStatus.finished_failed; return; } @@ -2232,16 +2232,16 @@ namespace EduNetworkBuilder { if (tPacket.MyType == PacketType.dhcp_request && !isDHCPServer) { - tPacket.AddMessage(DebugLevel.debug, hostname + " Packet request fell on deaf ears. This is not a DHCP server."); - tPacket.Tracking.Status = hostname + " Failed: Not a DHCP Server. Packet Dropped."; + tPacket.AddMessage(DebugLevel.debug, hostname + string.Format(" Packet request fell on deaf ears. This is not a DHCP server.")); + tPacket.Tracking.Status = hostname + string.Format(" Failed: Not a DHCP Server. Packet Dropped."); tPacket.MyStatus = PacketStatus.finished_failed; return; } if ((tPacket.MyType == PacketType.ping_answer || tPacket.MyType== PacketType.ping_request) && !RoutesPackets() && (!HasIPAddress(tPacket.destIP) && !HasBroadcastAddress(tPacket.destIP))) { - tPacket.AddMessage(DebugLevel.debug, hostname + " Not a router"); - tPacket.Tracking.Status = hostname + " This device is not a router. Packet dropped."; + tPacket.AddMessage(DebugLevel.debug, hostname + string.Format(" Not a router")); + tPacket.Tracking.Status = hostname + string.Format(" This device is not a router. Packet dropped."); tPacket.MyStatus = PacketStatus.finished_failed; return; } @@ -2250,8 +2250,8 @@ namespace EduNetworkBuilder myType != NetworkComponentType.wbridge && myType != NetworkComponentType.wrepeater && myType != NetworkComponentType.wrouter) { - tPacket.AddMessage(DebugLevel.debug, hostname + " The device had no local IPs. Quietly dropped."); - tPacket.Tracking.Status = hostname + " Failed: no IPs local to the packet."; + tPacket.AddMessage(DebugLevel.debug, hostname + string.Format(" The device had no local IPs. Quietly dropped.")); + tPacket.Tracking.Status = hostname + string.Format(" Failed: no IPs local to the packet."); tPacket.MyStatus = PacketStatus.finished_failed; return; } @@ -2462,8 +2462,8 @@ namespace EduNetworkBuilder { if (WithAdditionalInfo) { - theStrings.Add("IF:" + ip.GetIP.ToIpString().PadLeft(15) + " Range: " + - ip.GetMask.ToIpString() + " - " + ip.GetGateway.ToIpString()); + theStrings.Add(string.Format("IF: {0} Range: {1} - {2}", ip.GetIP.ToIpString().PadLeft(15), + ip.GetMask.ToIpString(),ip.GetGateway.ToIpString())); } else {