Clean up strings for translation

This commit is contained in:
Tim Young 2015-11-19 12:00:34 -05:00
parent 1a7258a84e
commit b2662c6aba

View File

@ -1580,7 +1580,7 @@ namespace EduNetworkBuilder
else else
{ {
tPacket.AddMessage(DebugLevel.info, "The broadcast ping reached a destination that was not on the same network"); 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; tPacket.MyStatus = PacketStatus.finished_ok;
} }
return; return;
@ -1592,7 +1592,7 @@ namespace EduNetworkBuilder
{ {
if (tPacket.health < 100) 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; 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.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; tPacket.MyStatus = PacketStatus.finished_ok;
@ -1600,7 +1600,7 @@ namespace EduNetworkBuilder
else else
{ {
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReturn1")); 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; tPacket.MyStatus = PacketStatus.finished_ok;
if (tPacket.sourceIP.GetIP != 0) if (tPacket.sourceIP.GetIP != 0)
{ {
@ -1615,7 +1615,7 @@ namespace EduNetworkBuilder
else else
{ {
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PackReturnErr1")); 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; tPacket.MyStatus = PacketStatus.finished_failed;
} }
return; return;
@ -1667,7 +1667,7 @@ namespace EduNetworkBuilder
nPacket.MyStatus = PacketStatus.processing; nPacket.MyStatus = PacketStatus.processing;
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_ArpReached1")); 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; tPacket.MyStatus = PacketStatus.finished_ok;
} }
else else
@ -1685,14 +1685,14 @@ namespace EduNetworkBuilder
NetworkCard nic = LocalNic(tPacket.destIP); NetworkCard nic = LocalNic(tPacket.destIP);
HostNicID myid = nic.myID; HostNicID myid = nic.myID;
StoreArp(tPacket.sourceMAC, tPacket.TsourceIP.GetIP.ToIpString(), 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! tPacket.MyStatus = PacketStatus.finished_ok; //Yay!
myNet.NotePacketArrived(tPacket.MyType, this, tPacket.destIP, tPacket.sourceIP); myNet.NotePacketArrived(tPacket.MyType, this, tPacket.destIP, tPacket.sourceIP);
} }
else else
{ {
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PackReturnErr1")); 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; tPacket.MyStatus = PacketStatus.finished_failed;
} }
return; return;
@ -1741,7 +1741,7 @@ namespace EduNetworkBuilder
IPAddress tIP = HubManagementIP(); IPAddress tIP = HubManagementIP();
if (tIP != null) IP = tIP.GetIPString; 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 we are a wireless router, we need to keep passing the broadcast request on
if(!DoesForwarding()) if(!DoesForwarding())
tPacket.MyStatus = PacketStatus.finished_ok; tPacket.MyStatus = PacketStatus.finished_ok;
@ -1761,7 +1761,7 @@ namespace EduNetworkBuilder
tPacket.payloadIP = new IPAddress(NB.ZeroIPString); tPacket.payloadIP = new IPAddress(NB.ZeroIPString);
tnic.SetIPForDHCP(tPacket.payloadIP); tnic.SetIPForDHCP(tPacket.payloadIP);
IsDirty = true; //If we need to redraw the device IP 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! tPacket.MyStatus = PacketStatus.finished_ok; //Yay!
myNet.NotePacketArrived(tPacket.MyType, this, tPacket.payloadIP, tPacket.sourceIP); myNet.NotePacketArrived(tPacket.MyType, this, tPacket.payloadIP, tPacket.sourceIP);
return; return;
@ -1773,7 +1773,7 @@ namespace EduNetworkBuilder
string sIP = "?.?.?.?"; string sIP = "?.?.?.?";
if (tPacket.sourceIP != null) if (tPacket.sourceIP != null)
sIP = tPacket.sourceIP.GetIP.ToIpString(); 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; tPacket.MyStatus = PacketStatus.finished_failed;
} }
return; return;
@ -1982,15 +1982,15 @@ namespace EduNetworkBuilder
{ {
if (tPacket.MyType == PacketType.dhcp_answer) 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.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 + " ERROR: DHCP Server does not have gateway set. DHCP server failing"; tPacket.Tracking.Status = hostname + string.Format(" ERROR: DHCP Server does not have gateway set. DHCP server failing");
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return false; return false;
} }
else else
{ {
tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: No route or local interface for packet. " + tPacket.OutboundIP.GetIP.ToIpString()); tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: No route or local interface for packet.") +" "+ tPacket.OutboundIP.GetIP.ToIpString());
tPacket.Tracking.Status = hostname + " No route or local interface for packet."; tPacket.Tracking.Status = hostname + "ERROR: No route or local interface for packet.";
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return false; return false;
} }
@ -2003,8 +2003,8 @@ namespace EduNetworkBuilder
tPacket.OutboundNic = LocalNic(tPacket.OutboundIP); tPacket.OutboundNic = LocalNic(tPacket.OutboundIP);
if (tPacket.OutboundNic == null) if (tPacket.OutboundNic == null)
{ {
tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: No local Network Card for packet. :" + tPacket.OutboundIP.GetIP.ToIpString()); tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: No local Network Card for packet.") + " :"+ tPacket.OutboundIP.GetIP.ToIpString());
tPacket.Tracking.Status = hostname + " No route or local network card for packet."; tPacket.Tracking.Status = hostname + " ERROR: No local Network Card for packet.";
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return false; return false;
} }
@ -2015,8 +2015,8 @@ namespace EduNetworkBuilder
tPacket.OutboundIF = tPacket.OutboundNic.LocalInterface(tPacket.OutboundIP, tPacket.Tracking); tPacket.OutboundIF = tPacket.OutboundNic.LocalInterface(tPacket.OutboundIP, tPacket.Tracking);
if (tPacket.OutboundIF == null) if (tPacket.OutboundIF == null)
{ {
tPacket.AddMessage(DebugLevel.info, hostname + " ERROR: No local interface for packet. :" + tPacket.OutboundIP.GetIP.ToIpString()); tPacket.AddMessage(DebugLevel.info, hostname + string.Format(" ERROR: No route or local interface for packet.") + " :" + tPacket.OutboundIP.GetIP.ToIpString());
tPacket.Tracking.Status = hostname + " No route or local interface for packet."; tPacket.Tracking.Status = hostname + " ERROR: No route or local interface for packet.";
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return false; return false;
} }
@ -2193,7 +2193,7 @@ namespace EduNetworkBuilder
if(nc == null) if(nc == null)
{ {
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_DoInputFromLink_CardFail1")); 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; tPacket.MyStatus = PacketStatus.finished_failed;
return; return;
} }
@ -2232,16 +2232,16 @@ namespace EduNetworkBuilder
{ {
if (tPacket.MyType == PacketType.dhcp_request && !isDHCPServer) 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.AddMessage(DebugLevel.debug, hostname + string.Format(" Packet request fell on deaf ears. This is not a DHCP server."));
tPacket.Tracking.Status = hostname + " Failed: Not a DHCP Server. Packet Dropped."; tPacket.Tracking.Status = hostname + string.Format(" Failed: Not a DHCP Server. Packet Dropped.");
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return; return;
} }
if ((tPacket.MyType == PacketType.ping_answer || tPacket.MyType== PacketType.ping_request) && if ((tPacket.MyType == PacketType.ping_answer || tPacket.MyType== PacketType.ping_request) &&
!RoutesPackets() && (!HasIPAddress(tPacket.destIP) && !HasBroadcastAddress(tPacket.destIP))) !RoutesPackets() && (!HasIPAddress(tPacket.destIP) && !HasBroadcastAddress(tPacket.destIP)))
{ {
tPacket.AddMessage(DebugLevel.debug, hostname + " Not a router"); tPacket.AddMessage(DebugLevel.debug, hostname + string.Format(" Not a router"));
tPacket.Tracking.Status = hostname + " This device is not a router. Packet dropped."; tPacket.Tracking.Status = hostname + string.Format(" This device is not a router. Packet dropped.");
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return; return;
} }
@ -2250,8 +2250,8 @@ namespace EduNetworkBuilder
myType != NetworkComponentType.wbridge && myType != NetworkComponentType.wrepeater && myType != NetworkComponentType.wbridge && myType != NetworkComponentType.wrepeater &&
myType != NetworkComponentType.wrouter) myType != NetworkComponentType.wrouter)
{ {
tPacket.AddMessage(DebugLevel.debug, hostname + " The device had no local IPs. Quietly dropped."); tPacket.AddMessage(DebugLevel.debug, hostname + string.Format(" The device had no local IPs. Quietly dropped."));
tPacket.Tracking.Status = hostname + " Failed: no IPs local to the packet."; tPacket.Tracking.Status = hostname + string.Format(" Failed: no IPs local to the packet.");
tPacket.MyStatus = PacketStatus.finished_failed; tPacket.MyStatus = PacketStatus.finished_failed;
return; return;
} }
@ -2462,8 +2462,8 @@ namespace EduNetworkBuilder
{ {
if (WithAdditionalInfo) if (WithAdditionalInfo)
{ {
theStrings.Add("IF:" + ip.GetIP.ToIpString().PadLeft(15) + " Range: " + theStrings.Add(string.Format("IF: {0} Range: {1} - {2}", ip.GetIP.ToIpString().PadLeft(15),
ip.GetMask.ToIpString() + " - " + ip.GetGateway.ToIpString()); ip.GetMask.ToIpString(),ip.GetGateway.ToIpString()));
} }
else else
{ {