Peter Wilson 2015-11-18 14:11:21 -06:00
commit fa8e9aab6c
5 changed files with 69 additions and 77 deletions

View File

@ -28,8 +28,7 @@ namespace EduNetworkBuilder
OriginalItem = Original_Item;
ClonedItem = NetworkComponent.Clone(OriginalItem);
UpdateForm();
lblHelp.Text = "Select the network card or interface for that network card that you wish to edit. " +
"Then press the [edit] button to make changes to that. Press the [-] to remove it, and press [+] to add another.";
lblHelp.Text = "Select the network card or interface for that network card that you wish to edit. Then press the [edit] button to make changes to that. Press the [-] to remove it, and press [+] to add another.";
}
private void LoadFromOrig()
@ -103,7 +102,7 @@ namespace EduNetworkBuilder
}
btnGateway.Visible = true;
btnGateway.Text = "Gateway: " + ndCLonedItem.GetGateway().GetIP.ToIpString();
btnGateway.Text = string.Format("Gateway: {0}", ndCLonedItem.GetGateway().GetIP.ToIpString());
tbHostname.Text = ndCLonedItem.hostname;
//Network cards are changed with the [edit] button and do not need to be updated here
//IPAddresses are changed with the [edit] button and do not need to be updated here
@ -210,7 +209,7 @@ namespace EduNetworkBuilder
otext = tbHostname.Text;
tbHostname.Text = OriginalItem.hostname;
MessageBox.Show("The name '" + otext + "' is being used as part of this puzzle and this machine cannot be named that.");
MessageBox.Show(string.Format("The name '{0}' is being used as part of this puzzle and this machine cannot be named that.", otext));
}
}
}

View File

@ -223,9 +223,8 @@ namespace EduNetworkBuilder
}
public string IPFormat(string gw)
{
string tstring = "IP:" +PadIt(_ip.ToIpString())+
" Mask:" + PadIt(_mask.ToIpString())+
" GW:" + PadIt(gw);
string tstring = string.Format("IP:{0} Mask:{1} GW:{2}",
PadIt(_ip.ToIpString()), PadIt(_mask.ToIpString()), PadIt(gw));
return tstring;
}
}

View File

@ -704,7 +704,7 @@ namespace EduNetworkBuilder
}
else
{
MessageBox.Show("The network card," + NICs[index].NicName() + " is locked as part of the puzzle.", "Locked NIC");
MessageBox.Show(string.Format("The network card, {0} is locked as part of the puzzle.", NICs[index].NicName()), "Locked NIC");
}
}
public bool AutoJoinWireless()
@ -1297,8 +1297,9 @@ namespace EduNetworkBuilder
if(dest.GetIPString == NB.ZeroIPString && tPacket.destIP.GetIPString != NB.BroadcastIPString)
{
//No gateway set and no route...
tPacket.AddMessage(DebugLevel.info, hostname + " No route to host: " + tPacket.destIP.GetIPString);
tPacket.Tracking.Status = hostname + " No route to host: " + tPacket.destIP.GetIPString;
string errString = string.Format("{0} No route to host: {1}", hostname, tPacket.destIP.GetIPString);
tPacket.AddMessage(DebugLevel.info, errString);
tPacket.Tracking.Status = errString;
tPacket.MyStatus = PacketStatus.finished_failed;
return;
}
@ -1439,23 +1440,23 @@ namespace EduNetworkBuilder
if (tPacket.MyType == PacketType.arp_request)
{
//The packet was not successfully sent anywhere. DMac = "". This means no host with the specified IP
tPacket.AddMessage(DebugLevel.info, hostname + " Failed: No such IP on the local network - Arp only searches the local network.");
tPacket.Tracking.Status = hostname + " Failed: No such IP on the local network.";
tPacket.AddMessage(DebugLevel.info, string.Format("{0} Failed: No such IP on the local network - Arp only searches the local network.", hostname));
tPacket.Tracking.Status = string.Format("{0} Failed: No such IP on the local network.", hostname);
tPacket.MyStatus = PacketStatus.finished_failed;
}
else
{
//The packet was not successfully sent anywhere. DMac = "". This means no host with the specified IP
tPacket.AddMessage(DebugLevel.info, hostname + " Failed: No such IP.");
tPacket.Tracking.Status = hostname + " Failed: No such IP.";
tPacket.AddMessage(DebugLevel.info, string.Format("{0} Failed: No such IP.",hostname));
tPacket.Tracking.Status = string.Format("{0} Failed: No such IP.", hostname);
tPacket.MyStatus = PacketStatus.finished_failed;
}
}
else
{
//The packet was not successfully sent anywhere. No interface to send out the packet
tPacket.AddMessage(DebugLevel.info, hostname + " No local interface to send packet out.");
tPacket.Tracking.Status = hostname + " No local interface to send packet out";
tPacket.AddMessage(DebugLevel.info, string.Format("{0} No local interface to send packet out.", hostname));
tPacket.Tracking.Status = string.Format("{0} No local interface to send packet out", hostname);
tPacket.MyStatus = PacketStatus.finished_failed;
}
}
@ -1537,7 +1538,7 @@ namespace EduNetworkBuilder
nPacket.Tracking = new PacketMessage();
myNet.addPacket(nPacket);
tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReached1"));
tPacket.Tracking.Status = hostname + ":\tPing success: The ping reached the destination." + tPacket.sourceIP.GetIP.ToIpString() + " -> " + tPacket.destIP.GetIP.ToIpString();
tPacket.Tracking.Status = hostname + ":\tPing" + NB.Translate("ND_ProcessArrival_PingReached1") + tPacket.sourceIP.GetIP.ToIpString() + "-> " + tPacket.destIP.GetIP.ToIpString();
tPacket.MyStatus = PacketStatus.finished_ok;
IPAddress tip = nPacket.sourceIP;
if (!HasBroadcastAddress(tPacket.destIP))

View File

@ -122,7 +122,7 @@ namespace EduNetworkBuilder
destMAC = dest;
OutboundDestMAC = dest;
Tracking.AddMessage(DebugLevel.info, start, theType.ToString() + "Packet Created");
Tracking.AddMessage(DebugLevel.routing, start, " MAC:" + source + " -> " + dest);
Tracking.AddMessage(DebugLevel.routing, start, string.Format(" MAC: {0} -> {1}", source, dest));
}
else
{
@ -135,8 +135,8 @@ namespace EduNetworkBuilder
OutboundDestMAC = destMAC;
}
Tracking.AddMessage(DebugLevel.info, start, "Packet Created");
Tracking.AddMessage(DebugLevel.routing, start, " IP:" + source + " -> " + dest);
Tracking.AddMessage(DebugLevel.debug, start, " IPs Translated to" + sourceIP.GetIP.ToIpString() + " -> " + destIP.GetIP.ToIpString());
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()));
}
isFresh = true;
}
@ -154,7 +154,7 @@ namespace EduNetworkBuilder
if (destIP != null && destIP.BroadcastAddress == destIP.GetIP)
destMAC = NB.BroadcastMACString;
Tracking.AddMessage(DebugLevel.info, start, "Packet Created");
Tracking.AddMessage(DebugLevel.routing, start, " IP:" + sourceIP.GetIP.ToIpString() + " -> " + dest.GetIP.ToIpString());
Tracking.AddMessage(DebugLevel.routing, start, string.Format(" IP:{0} -> {1}", sourceIP.GetIP.ToIpString(), dest.GetIP.ToIpString()));
}
else
{
@ -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, "Unable to find a mac address for the IP address: " + dest.GetIP.ToIpString());
Tracking.Status = WhereAmI.hostname + " Failed: Unable to find a MAC address for the specified IP.";
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 );
MyStatus = PacketStatus.finished_failed;
}
return;
@ -278,7 +278,7 @@ 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..";
Tracking.Status = "NO_Host Lost location of packet..";
MyStatus = PacketStatus.finished_failed;
return; //We cannot process the packet
}
@ -298,7 +298,7 @@ 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..";
Tracking.Status = "NO_Host Lost location of packet..";
MyStatus = PacketStatus.finished_failed;
return; //We cannot process the packet
}
@ -310,7 +310,7 @@ 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..";
Tracking.Status = "NO_Host Lost location of packet..";
MyStatus = PacketStatus.finished_failed;
return; //We cannot process the packet
}
@ -340,7 +340,7 @@ namespace EduNetworkBuilder
myDirection = nb_direction.to_dst;
else
myDirection = nb_direction.to_src;
Console.WriteLine("Starting on link. SMAC: " + sourceMAC + " DMAC: " + destMAC);
Console.WriteLine(string.Format("Starting on link. SMAC: {0} DMAC: {1}",sourceMAC,destMAC));
AddMessage(DebugLevel.debug, " Starting on link");
}
@ -366,8 +366,9 @@ namespace EduNetworkBuilder
}
if(MyType == PacketType.arp_request && MyStatus == PacketStatus.finished_failed)
{
Tracking.AddMessage(DebugLevel.info, "Packet", "Packet failed to reach any IP. No such IP on network: " + destIP.GetIPString);
Tracking.Status = "Packet failed to reach IP: " + destIP.GetIPString;
Tracking.AddMessage(DebugLevel.info, "Packet",
string.Format("Packet failed to reach any IP. No such IP on network: {0}", destIP.GetIPString));
Tracking.Status = string.Format("Packet failed to reach IP: {0}",destIP.GetIPString);
MyStatus = PacketStatus.finished_failed;
}
if (MyStatus != PacketStatus.finished)
@ -435,15 +436,12 @@ namespace EduNetworkBuilder
}
if ((WhatIsSet & DebugPausePoint.dump) == DebugPausePoint.dump)
{
Console.WriteLine(hostname + ": " + MyType.ToString());
Console.Write(hostname + ": " + position + " PACKET: dstIP:" + dIP);
Console.WriteLine(" dstMAC:" + destMAC);
Console.Write(hostname + ": " + position + " PACKET: srcIP:" + sIP);
Console.WriteLine(" srcMAC:" + sourceMAC);
Console.WriteLine(string.Format("{0}: {1} PACKET: dstIP: {2} destMAC: {3}", hostname, position, dIP, destMAC));
Console.WriteLine(string.Format("{0}: {1} PACKET: srcIP: {2} srcMAC: {3}", hostname, position, sIP, sourceMAC));
Console.WriteLine("---");
}
AddMessage(DebugLevel.packet, hostname + ": " + position + " PACKET: dstIP:" + dIP + " dstMAC:" + destMAC);
AddMessage(DebugLevel.packet, hostname + ": " + position + " PACKET: srcIP:" + sIP + " srcMAC:" + sourceMAC);
AddMessage(DebugLevel.packet, string.Format("{0}: {1} PACKET: dstIP: {2} destMAC: {3}", hostname, position, dIP, destMAC));
AddMessage(DebugLevel.packet, string.Format("{0}: {1} PACKET: srcIP: {2} srcMAC: {3}", hostname,position,sIP,sourceMAC));
}
public static T Clone<T>(T source)

View File

@ -1,18 +1,17 @@
DeviceConfig.cs:31: lblHelp.Text = "Select the network card or interface for that network card that you wish to edit. " +
DeviceConfig.cs:32: "Then press the [edit] button to make changes to that. Press the [-] to remove it, and press [+] to add another.";
DeviceConfig.cs:75: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:106: btnGateway.Text = "Gateway: " + ndCLonedItem.GetGateway().GetIP.ToIpString();
DeviceConfig.cs:144: lbArpTable.Items.Add("Arp Table MAC\tIPAddress");
DeviceConfig.cs:147: lbArpTable.Items.Add(ae.MACAddress + "\t" + ae.IPAddr);
DeviceConfig.cs:152: string selectedNicName = "";
DeviceConfig.cs:154: selectedNicName = Regex.Replace(selectedNicName, " .*", "");
DeviceConfig.cs:155: selectedNicName = Regex.Replace(selectedNicName, "\\*", "");
DeviceConfig.cs:213: MessageBox.Show("The name '" + otext + "' is being used as part of this puzzle and this machine cannot be named that.");
DeviceConfig.cs:222: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:294: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:347: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:353: selectedNIC = Regex.Replace(selectedNIC, " .*", "");
DeviceConfig.cs:354: selectedNIC = Regex.Replace(selectedNIC, "\\*", "");
DeviceConfig.cs:31: lblHelp.Text = "Select the network card or interface for that network card that you wish to edit. Then press the [edit] button to make changes to that. Press the [-] to remove it, and press [+] to add another.";
DeviceConfig.cs:74: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:105: btnGateway.Text = string.Format("Gateway: {0}", ndCLonedItem.GetGateway().GetIP.ToIpString());
DeviceConfig.cs:143: lbArpTable.Items.Add("Arp Table MAC\tIPAddress");
DeviceConfig.cs:146: lbArpTable.Items.Add(ae.MACAddress + "\t" + ae.IPAddr);
DeviceConfig.cs:151: string selectedNicName = "";
DeviceConfig.cs:153: selectedNicName = Regex.Replace(selectedNicName, " .*", "");
DeviceConfig.cs:154: selectedNicName = Regex.Replace(selectedNicName, "\\*", "");
DeviceConfig.cs:212: MessageBox.Show(string.Format("The name '{0}' is being used as part of this puzzle and this machine cannot be named that.", otext));
DeviceConfig.cs:221: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:293: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:346: if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
DeviceConfig.cs:352: selectedNIC = Regex.Replace(selectedNIC, " .*", "");
DeviceConfig.cs:353: selectedNIC = Regex.Replace(selectedNIC, "\\*", "");
IPAddress.cs:99: public bool Edit(NetworkDevice FromWhat, string message="")
IPAddress.cs:102: if (message != "")
IPAddress.cs:122: _mask = "255.255.255.0".ParseIp();
@ -22,10 +21,8 @@ IPAddress.cs:131: if (mySplitVal[0] == "172")
IPAddress.cs:133: _mask = "255.255.0.0".ParseIp();
IPAddress.cs:135: if (mySplitVal[0] == "192")
IPAddress.cs:137: _mask = "255.255.255.0".ParseIp();
IPAddress.cs:226: string tstring = "IP:" +PadIt(_ip.ToIpString())+
IPAddress.cs:227: " Mask:" + PadIt(_mask.ToIpString())+
IPAddress.cs:228: " GW:" + PadIt(gw);
IPAddress.cs:245: return String.Join(".", parts);
IPAddress.cs:226: string tstring = string.Format("IP:{0} Mask:{1} GW:{2}",
IPAddress.cs:244: return String.Join(".", parts);
IPAddressEntry.cs:32: string hostname = "";
IPAddressEntry.cs:48: if (!lNM.Contains("255"))
IPAddressEntry.cs:49: lNM = "255.255.255.0";
@ -377,42 +374,40 @@ Packet.cs:62: public string OutboundMAC = "";
Packet.cs:63: public string OutboundDestMAC = "";
Packet.cs:109: Tracking.AddMessage(DebugLevel.debug, WhereAmI, "Packet duplicated");
Packet.cs:124: Tracking.AddMessage(DebugLevel.info, start, theType.ToString() + "Packet Created");
Packet.cs:125: Tracking.AddMessage(DebugLevel.routing, start, " MAC:" + source + " -> " + dest);
Packet.cs:125: Tracking.AddMessage(DebugLevel.routing, start, string.Format(" MAC: {0} -> {1}", source, dest));
Packet.cs:137: Tracking.AddMessage(DebugLevel.info, start, "Packet Created");
Packet.cs:138: Tracking.AddMessage(DebugLevel.routing, start, " IP:" + source + " -> " + dest);
Packet.cs:138: Tracking.AddMessage(DebugLevel.routing, start, string.Format(" IP: {0} -> {1}", source, dest));
Packet.cs:156: Tracking.AddMessage(DebugLevel.info, start, "Packet Created");
Packet.cs:157: Tracking.AddMessage(DebugLevel.routing, start, " IP:" + sourceIP.GetIP.ToIpString() + " -> " + dest.GetIP.ToIpString());
Packet.cs:157: Tracking.AddMessage(DebugLevel.routing, start, string.Format(" IP:{0} -> {1}", sourceIP.GetIP.ToIpString(), dest.GetIP.ToIpString()));
Packet.cs:164: Tracking.AddMessage(DebugLevel.info, start, "Packet Created");
Packet.cs:165: //Tracking.AddMessage(DebugLevel.routing, start, " IP:" + sourceIP.GetIP.ToIpString() + " -> " + dest.GetIP.ToIpString());
Packet.cs:226: //The packet is "inside" the device.
Packet.cs:229: // Here the packet is just about to exit. Maybe we need to set the "source IP"
Packet.cs:254: if (dMAC != "" || destMAC == NB.BroadcastMACString)
Packet.cs:264: Tracking.AddMessage(DebugLevel.info, WhereAmI, "Unable to find a mac address for the IP address: " + dest.GetIP.ToIpString());
Packet.cs:265: Tracking.Status = WhereAmI.hostname + " Failed: Unable to find a MAC address for the specified IP.";
Packet.cs:264: Tracking.AddMessage(DebugLevel.info, WhereAmI, string.Format("Unable to find a mac address for the IP address: {0}", dest.GetIP.ToIpString()));
Packet.cs:265: Tracking.Status = string.Format("{0} Failed: Unable to find a MAC address for the specified IP.", WhereAmI.hostname );
Packet.cs:280: AddMessage(DebugLevel.debug, "The packet was dropped because we lost where it was. WhereAmI == null!");
Packet.cs:281: Tracking.Status = "NO_Host" + " Lost location of packet..";
Packet.cs:281: Tracking.Status = "NO_Host Lost location of packet..";
Packet.cs:290: //The packet is "inside" the device.
Packet.cs:293: // Here the packet is just about to exit. Maybe we need to set the "source IP"
Packet.cs:300: AddMessage(DebugLevel.debug, "The packet was dropped because we lost where it was. WhereAmI == null!");
Packet.cs:301: Tracking.Status = "NO_Host" + " Lost location of packet..";
Packet.cs:301: Tracking.Status = "NO_Host Lost location of packet..";
Packet.cs:312: AddMessage(DebugLevel.debug, "The packet was dropped because we lost where it was. WhereAmI == null!");
Packet.cs:313: Tracking.Status = "NO_Host" + " Lost location of packet..";
Packet.cs:313: Tracking.Status = "NO_Host Lost location of packet..";
Packet.cs:337: OutboundMAC = "";
Packet.cs:343: Console.WriteLine("Starting on link. SMAC: " + sourceMAC + " DMAC: " + destMAC);
Packet.cs:343: Console.WriteLine(string.Format("Starting on link. SMAC: {0} DMAC: {1}",sourceMAC,destMAC));
Packet.cs:344: AddMessage(DebugLevel.debug, " Starting on link");
Packet.cs:369: Tracking.AddMessage(DebugLevel.info, "Packet", "Packet failed to reach any IP. No such IP on network: " + destIP.GetIPString);
Packet.cs:370: Tracking.Status = "Packet failed to reach IP: " + destIP.GetIPString;
Packet.cs:429: position = Regex.Replace(position, "packet_", "");
Packet.cs:434: Console.WriteLine("Pausing");
Packet.cs:438: Console.WriteLine(hostname + ": " + MyType.ToString());
Packet.cs:439: Console.Write(hostname + ": " + position + " PACKET: dstIP:" + dIP);
Packet.cs:440: Console.WriteLine(" dstMAC:" + destMAC);
Packet.cs:441: Console.Write(hostname + ": " + position + " PACKET: srcIP:" + sIP);
Packet.cs:442: Console.WriteLine(" srcMAC:" + sourceMAC);
Packet.cs:443: Console.WriteLine("---");
Packet.cs:445: AddMessage(DebugLevel.packet, hostname + ": " + position + " PACKET: dstIP:" + dIP + " dstMAC:" + destMAC);
Packet.cs:446: AddMessage(DebugLevel.packet, hostname + ": " + position + " PACKET: srcIP:" + sIP + " srcMAC:" + sourceMAC);
Packet.cs:453: throw new ArgumentException("The type must be serializable.", "source");
Packet.cs:369: Tracking.AddMessage(DebugLevel.info, "Packet",
Packet.cs:370: string.Format("Packet failed to reach any IP. No such IP on network: {0}", destIP.GetIPString));
Packet.cs:371: Tracking.Status = string.Format("Packet failed to reach IP: {0}",destIP.GetIPString);
Packet.cs:430: position = Regex.Replace(position, "packet_", "");
Packet.cs:435: Console.WriteLine("Pausing");
Packet.cs:439: Console.WriteLine(string.Format("{0}: {1} PACKET: dstIP: {2} destMAC: {3}", hostname, position, dIP, destMAC));
Packet.cs:440: Console.WriteLine(string.Format("{0}: {1} PACKET: srcIP: {2} srcMAC: {3}", hostname, position, sIP, sourceMAC));
Packet.cs:441: Console.WriteLine("---");
Packet.cs:443: AddMessage(DebugLevel.packet, string.Format("{0}: {1} PACKET: dstIP: {2} destMAC: {3}", hostname, position, dIP, destMAC));
Packet.cs:444: AddMessage(DebugLevel.packet, string.Format("{0}: {1} PACKET: srcIP: {2} srcMAC: {3}", hostname,position,sIP,sourceMAC));
Packet.cs:451: throw new ArgumentException("The type must be serializable.", "source");
PacketMessage.cs:34: public string _Status = ""; //Usually "success" or "failed"
PacketMessage.cs:47: throw new ArgumentException("The type must be serializable.", "source");
PacketMessage.cs:76: string host = "unknown";