From 3f5100dcc0307e45bbe47c902c19deb1872f685d Mon Sep 17 00:00:00 2001 From: Tim Young Date: Sat, 21 Nov 2015 17:55:03 -0500 Subject: [PATCH] Changed layout of messages to make them consistent --- EduNetworkBuilder/NB.cs | 10 +++ EduNetworkBuilder/NetworkBuilder.Designer.cs | 76 ++++++++++--------- EduNetworkBuilder/NetworkCard.cs | 8 +- EduNetworkBuilder/NetworkDevice.cs | 60 +++++++-------- EduNetworkBuilder/NetworkLink.cs | 2 +- EduNetworkBuilder/Packet.cs | 2 +- EduNetworkBuilder/PacketMessage.cs | 4 +- EduNetworkBuilder/Resources/ReleaseNotes.rtf | 5 +- .../Resources/languages/edustrings.resx | 36 +++------ 9 files changed, 100 insertions(+), 103 deletions(-) diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index 4d8ea53..ad64041 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -354,6 +354,16 @@ namespace EduNetworkBuilder if (myWin == null) return null; return myWin.PuzzleInfoFromName(PuzzleName); } + + public static string LeftPad(string what, int amount=-1) + { + int UseAmount = 10; + if (amount != -1) UseAmount = amount; + string format = "{0," + (0 - UseAmount).ToString() + "}"; + string mystring = string.Format(format, what); + return mystring; + } + public static void ChangeLanguage() { //Find the window. If it exists, use /set the language setting there. If not, use / set the default. diff --git a/EduNetworkBuilder/NetworkBuilder.Designer.cs b/EduNetworkBuilder/NetworkBuilder.Designer.cs index 6ae960f..2b63825 100644 --- a/EduNetworkBuilder/NetworkBuilder.Designer.cs +++ b/EduNetworkBuilder/NetworkBuilder.Designer.cs @@ -113,35 +113,35 @@ // newToolStripMenuItem // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(125, 24); + this.newToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.newToolStripMenuItem.Text = "New"; this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); // // loadToolStripMenuItem // this.loadToolStripMenuItem.Name = "loadToolStripMenuItem"; - this.loadToolStripMenuItem.Size = new System.Drawing.Size(125, 24); + this.loadToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.loadToolStripMenuItem.Text = "Load"; this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click); // // reloadToolStripMenuItem // this.reloadToolStripMenuItem.Name = "reloadToolStripMenuItem"; - this.reloadToolStripMenuItem.Size = new System.Drawing.Size(125, 24); + this.reloadToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.reloadToolStripMenuItem.Text = "Reload"; this.reloadToolStripMenuItem.Click += new System.EventHandler(this.reloadToolStripMenuItem_Click); // // saveToolStripMenuItem // this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(125, 24); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(125, 24); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(131, 26); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -161,38 +161,38 @@ // cutToolStripMenuItem // this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; - this.cutToolStripMenuItem.Size = new System.Drawing.Size(197, 24); + this.cutToolStripMenuItem.Size = new System.Drawing.Size(203, 26); this.cutToolStripMenuItem.Text = "Cut"; // // copyToolStripMenuItem // this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; - this.copyToolStripMenuItem.Size = new System.Drawing.Size(197, 24); + this.copyToolStripMenuItem.Size = new System.Drawing.Size(203, 26); this.copyToolStripMenuItem.Text = "Copy"; // // pasteToolStripMenuItem // this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; - this.pasteToolStripMenuItem.Size = new System.Drawing.Size(197, 24); + this.pasteToolStripMenuItem.Size = new System.Drawing.Size(203, 26); this.pasteToolStripMenuItem.Text = "Paste"; // // undoToolStripMenuItem // this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; - this.undoToolStripMenuItem.Size = new System.Drawing.Size(197, 24); + this.undoToolStripMenuItem.Size = new System.Drawing.Size(203, 26); this.undoToolStripMenuItem.Text = "Undo"; // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(197, 24); + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(203, 26); this.optionsToolStripMenuItem.Text = "Options"; this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); // // changeLanguageToolStripMenuItem // this.changeLanguageToolStripMenuItem.Name = "changeLanguageToolStripMenuItem"; - this.changeLanguageToolStripMenuItem.Size = new System.Drawing.Size(197, 24); + this.changeLanguageToolStripMenuItem.Size = new System.Drawing.Size(203, 26); this.changeLanguageToolStripMenuItem.Text = "Change Language"; this.changeLanguageToolStripMenuItem.Click += new System.EventHandler(this.changeLanguageToolStripMenuItem_Click); // @@ -210,28 +210,28 @@ // dHCPRequestToolStripMenuItem // this.dHCPRequestToolStripMenuItem.Name = "dHCPRequestToolStripMenuItem"; - this.dHCPRequestToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.dHCPRequestToolStripMenuItem.Size = new System.Drawing.Size(185, 26); this.dHCPRequestToolStripMenuItem.Text = "DHCP Request"; this.dHCPRequestToolStripMenuItem.Click += new System.EventHandler(this.dHCPRequestToolStripMenuItem_Click); // // clearArpTableToolStripMenuItem // this.clearArpTableToolStripMenuItem.Name = "clearArpTableToolStripMenuItem"; - this.clearArpTableToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.clearArpTableToolStripMenuItem.Size = new System.Drawing.Size(185, 26); this.clearArpTableToolStripMenuItem.Text = "Clear Arp Table"; this.clearArpTableToolStripMenuItem.Click += new System.EventHandler(this.clearArpTableToolStripMenuItem_Click); // // clearIPsToolStripMenuItem // this.clearIPsToolStripMenuItem.Name = "clearIPsToolStripMenuItem"; - this.clearIPsToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.clearIPsToolStripMenuItem.Size = new System.Drawing.Size(185, 26); this.clearIPsToolStripMenuItem.Text = "Clear IPs"; this.clearIPsToolStripMenuItem.Click += new System.EventHandler(this.clearIPsToolStripMenuItem_Click); // // pingToolStripMenuItem // this.pingToolStripMenuItem.Name = "pingToolStripMenuItem"; - this.pingToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.pingToolStripMenuItem.Size = new System.Drawing.Size(185, 26); this.pingToolStripMenuItem.Text = "Ping"; this.pingToolStripMenuItem.Click += new System.EventHandler(this.pingToolStripMenuItem_Click); // @@ -249,28 +249,28 @@ // helpToolStripMenuItem1 // this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1"; - this.helpToolStripMenuItem1.Size = new System.Drawing.Size(201, 24); + this.helpToolStripMenuItem1.Size = new System.Drawing.Size(207, 26); this.helpToolStripMenuItem1.Text = "Help"; this.helpToolStripMenuItem1.Click += new System.EventHandler(this.helpToolStripMenuItem1_Click); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(201, 24); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(207, 26); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // // releaseNotesToolStripMenuItem // this.releaseNotesToolStripMenuItem.Name = "releaseNotesToolStripMenuItem"; - this.releaseNotesToolStripMenuItem.Size = new System.Drawing.Size(201, 24); + this.releaseNotesToolStripMenuItem.Size = new System.Drawing.Size(207, 26); this.releaseNotesToolStripMenuItem.Text = "Release Notes"; this.releaseNotesToolStripMenuItem.Click += new System.EventHandler(this.releaseNotesToolStripMenuItem_Click); // // checkForUpdatesToolStripMenuItem // this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem"; - this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(201, 24); + this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(207, 26); this.checkForUpdatesToolStripMenuItem.Text = "Check For Updates"; // // samplesToolStripMenuItem @@ -286,7 +286,7 @@ // puzzlesToolStripMenuItem // this.puzzlesToolStripMenuItem.Name = "puzzlesToolStripMenuItem"; - this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(135, 24); + this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.puzzlesToolStripMenuItem.Text = "Puzzles"; this.puzzlesToolStripMenuItem.Click += new System.EventHandler(this.puzzlesToolStripMenuItem_Click); // @@ -299,41 +299,41 @@ this.threeNetworksToolStripMenuItem, this.firewallsToolStripMenuItem}); this.solvedToolStripMenuItem.Name = "solvedToolStripMenuItem"; - this.solvedToolStripMenuItem.Size = new System.Drawing.Size(135, 24); + this.solvedToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.solvedToolStripMenuItem.Text = "Solved"; // // dHCPToolStripMenuItem // this.dHCPToolStripMenuItem.Name = "dHCPToolStripMenuItem"; - this.dHCPToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.dHCPToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.dHCPToolStripMenuItem.Text = "DHCP"; this.dHCPToolStripMenuItem.Click += new System.EventHandler(this.dHCPToolStripMenuItem_Click); // // oneNetworkToolStripMenuItem // this.oneNetworkToolStripMenuItem.Name = "oneNetworkToolStripMenuItem"; - this.oneNetworkToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.oneNetworkToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.oneNetworkToolStripMenuItem.Text = "One Network"; this.oneNetworkToolStripMenuItem.Click += new System.EventHandler(this.oneNetworkToolStripMenuItem_Click); // // twoNetworksToolStripMenuItem // this.twoNetworksToolStripMenuItem.Name = "twoNetworksToolStripMenuItem"; - this.twoNetworksToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.twoNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.twoNetworksToolStripMenuItem.Text = "Two Networks"; this.twoNetworksToolStripMenuItem.Click += new System.EventHandler(this.twoNetworksToolStripMenuItem_Click); // // threeNetworksToolStripMenuItem // this.threeNetworksToolStripMenuItem.Name = "threeNetworksToolStripMenuItem"; - this.threeNetworksToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.threeNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.threeNetworksToolStripMenuItem.Text = "Three Networks"; this.threeNetworksToolStripMenuItem.Click += new System.EventHandler(this.threeNetworksToolStripMenuItem_Click); // // firewallsToolStripMenuItem // this.firewallsToolStripMenuItem.Name = "firewallsToolStripMenuItem"; - this.firewallsToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.firewallsToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.firewallsToolStripMenuItem.Text = "Firewalls"; this.firewallsToolStripMenuItem.Click += new System.EventHandler(this.firewallsToolStripMenuItem_Click); // @@ -346,41 +346,41 @@ this.SolvedThreeNetworksToolStripMenuItem, this.firewallsToolStripMenuItem1}); this.toSolveToolStripMenuItem.Name = "toSolveToolStripMenuItem"; - this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(135, 24); + this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.toSolveToolStripMenuItem.Text = "To Solve"; // // solvedDHCPToolStripMenuItem // this.solvedDHCPToolStripMenuItem.Name = "solvedDHCPToolStripMenuItem"; - this.solvedDHCPToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.solvedDHCPToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.solvedDHCPToolStripMenuItem.Text = "DHCP"; this.solvedDHCPToolStripMenuItem.Click += new System.EventHandler(this.solvedDHCPToolStripMenuItem_Click); // // solvedOneNetworkToolStripMenuItem // this.solvedOneNetworkToolStripMenuItem.Name = "solvedOneNetworkToolStripMenuItem"; - this.solvedOneNetworkToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.solvedOneNetworkToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.solvedOneNetworkToolStripMenuItem.Text = "One Network"; this.solvedOneNetworkToolStripMenuItem.Click += new System.EventHandler(this.solvedOneNetworkToolStripMenuItem_Click); // // solvedTwoNetworksToolStripMenuItem // this.solvedTwoNetworksToolStripMenuItem.Name = "solvedTwoNetworksToolStripMenuItem"; - this.solvedTwoNetworksToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.solvedTwoNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.solvedTwoNetworksToolStripMenuItem.Text = "Two Networks"; this.solvedTwoNetworksToolStripMenuItem.Click += new System.EventHandler(this.solvedTwoNetworksToolStripMenuItem_Click); // // SolvedThreeNetworksToolStripMenuItem // this.SolvedThreeNetworksToolStripMenuItem.Name = "SolvedThreeNetworksToolStripMenuItem"; - this.SolvedThreeNetworksToolStripMenuItem.Size = new System.Drawing.Size(181, 24); + this.SolvedThreeNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26); this.SolvedThreeNetworksToolStripMenuItem.Text = "Three Networks"; this.SolvedThreeNetworksToolStripMenuItem.Click += new System.EventHandler(this.SolvedThreeNetworksToolStripMenuItem_Click); // // firewallsToolStripMenuItem1 // this.firewallsToolStripMenuItem1.Name = "firewallsToolStripMenuItem1"; - this.firewallsToolStripMenuItem1.Size = new System.Drawing.Size(181, 24); + this.firewallsToolStripMenuItem1.Size = new System.Drawing.Size(187, 26); this.firewallsToolStripMenuItem1.Text = "Firewalls"; this.firewallsToolStripMenuItem1.Click += new System.EventHandler(this.firewallsToolStripMenuItem1_Click); // @@ -398,11 +398,13 @@ // this.lbMessages.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.lbMessages.Font = new System.Drawing.Font("Courier New", 8F); this.lbMessages.FormattingEnabled = true; - this.lbMessages.Location = new System.Drawing.Point(74, 331); + this.lbMessages.ItemHeight = 16; + this.lbMessages.Location = new System.Drawing.Point(74, 329); this.lbMessages.Margin = new System.Windows.Forms.Padding(2); this.lbMessages.Name = "lbMessages"; - this.lbMessages.Size = new System.Drawing.Size(366, 43); + this.lbMessages.Size = new System.Drawing.Size(366, 52); this.lbMessages.TabIndex = 3; this.lbMessages.DoubleClick += new System.EventHandler(this.lbMessages_DoubleClick); // @@ -410,7 +412,7 @@ // this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.lblStatus.Location = new System.Drawing.Point(74, 374); + this.lblStatus.Location = new System.Drawing.Point(74, 400); this.lblStatus.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(365, 14); @@ -515,7 +517,7 @@ // myProgressBar // this.myProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.myProgressBar.Location = new System.Drawing.Point(10, 330); + this.myProgressBar.Location = new System.Drawing.Point(10, 329); this.myProgressBar.Margin = new System.Windows.Forms.Padding(2); this.myProgressBar.Name = "myProgressBar"; this.myProgressBar.Size = new System.Drawing.Size(59, 19); @@ -526,7 +528,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(463, 386); + this.ClientSize = new System.Drawing.Size(463, 412); this.Controls.Add(this.myProgressBar); this.Controls.Add(this.lblStatus); this.Controls.Add(this.lbMessages); diff --git a/EduNetworkBuilder/NetworkCard.cs b/EduNetworkBuilder/NetworkCard.cs index 90a24f0..8501a4b 100644 --- a/EduNetworkBuilder/NetworkCard.cs +++ b/EduNetworkBuilder/NetworkCard.cs @@ -436,7 +436,7 @@ namespace EduNetworkBuilder NetworkDevice nd = mynet.GetDeviceFromID(myID); string hostname = NB.Translate("NC_NoHost"); if (nd != null) hostname = nd.hostname; - nPacket.Tracking.Status = hostname + string.Format(NB.Translate("NC_NoIPOnSubStr"), hostname, nPacket.destIP.GetIPString); + nPacket.Tracking.Status = NB.LeftPad(hostname) + string.Format(NB.Translate("NC_NoIPOnSubStr"), hostname, nPacket.destIP.GetIPString); nPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -491,7 +491,7 @@ namespace EduNetworkBuilder NetworkDevice nd = mynet.GetDeviceFromID(myID); string hostname = NB.Translate("NC_NoHost"); if (nd != null) hostname = nd.hostname; - nPacket.Tracking.Status = hostname + string.Format(NB.Translate("NC_NoIPOnSubStr"), nPacket.destIP.GetIPString); + nPacket.Tracking.Status = NB.LeftPad(hostname) + string.Format(NB.Translate("NC_NoIPOnSubStr"), nPacket.destIP.GetIPString); nPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -557,7 +557,7 @@ namespace EduNetworkBuilder NetworkDevice nd = mynet.GetDeviceFromID(myID); string hostname = NB.Translate("NC_NoHost"); if (nd != null) hostname = nd.hostname; - nPacket.Tracking.Status = hostname + String.Format(NB.Translate("NC_NoIPOnSubStr"), nPacket.destIP.GetIPString); + nPacket.Tracking.Status = NB.LeftPad(hostname) + String.Format(NB.Translate("NC_NoIPOnSubStr"), nPacket.destIP.GetIPString); nPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -675,7 +675,7 @@ namespace EduNetworkBuilder nd = mynet.GetDeviceFromID(myID); string hostname = NB.Translate("NC_NoHost"); if (nd != null) hostname = nd.hostname; - tPacket.Tracking.Status = hostname + " " + NB.Translate("NC_ProcessInboundPacket_DifferentMachine3"); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + NB.Translate("NC_ProcessInboundPacket_DifferentMachine3"); tPacket.MyStatus = PacketStatus.finished_failed; } } diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index b1b043f..ba77e7c 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -1199,18 +1199,18 @@ namespace EduNetworkBuilder { if(ipc.What == PacketType.dhcp_request) { - //Console.WriteLine(hostname + ": packet=" + tPacket.MyType.ToString()); - //Console.WriteLine(" " + hostname + ": d:" + ipc.destIP.GetIPString + " s:" + tPacket.sourceIP.GetIPString); + //Console.WriteLine(NB.LeftPad(hostname) + ": packet=" + tPacket.MyType.ToString()); + //Console.WriteLine(" " + NB.LeftPad(hostname) + ": d:" + ipc.destIP.GetIPString + " s:" + tPacket.sourceIP.GetIPString); //if (HasBroadcastAddress(ipc.destIP)) // Console.WriteLine(" Broadcast"); } - if(ipc.destIP.GetIP == tPacket.sourceIP.GetIP || HasBroadcastAddress(ipc.destIP)) + if (ipc.destIP.GetIP == tPacket.sourceIP.GetIP || HasBroadcastAddress(ipc.destIP)) { if (ipc.What == PacketType.arp_request && tPacket.MyType == PacketType.arp_answer) typesMatch = true; if (ipc.What == PacketType.dhcp_request && tPacket.MyType == PacketType.dhcp_answer) { - //Console.WriteLine(" " + hostname + ": True"); + //Console.WriteLine(" " + NB.LeftPad(hostname) + ": True"); typesMatch = true; } if (ipc.What == PacketType.ping_request && tPacket.MyType == PacketType.ping_answer) @@ -1539,7 +1539,7 @@ namespace EduNetworkBuilder nPacket.Tracking = new PacketMessage(); myNet.addPacket(nPacket); tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReached1")); - tPacket.Tracking.Status = hostname + ":\tPing" + NB.Translate("ND_ProcessArrival_PingReached1") + tPacket.sourceIP.GetIP.ToIpString() + "-> " + tPacket.destIP.GetIP.ToIpString(); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " Ping " + 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)) @@ -1581,7 +1581,7 @@ namespace EduNetworkBuilder else { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProssArr_PingErr")); - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArr_PingErr")) + tPacket.sourceIP.GetIP.ToIpString() + " -> " + hostname; + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArr_PingErr")) + tPacket.sourceIP.GetIP.ToIpString() + " -> " + hostname; tPacket.MyStatus = PacketStatus.finished_ok; } return; @@ -1595,13 +1595,13 @@ namespace EduNetworkBuilder { tPacket.AddMessage(DebugLevel.info, string.Format(NB.Translate("ND_ProssArrSomeLostStr"), tPacket.health.ToString()) ); int left = 100 - tPacket.health; - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrPartialStr"), left , tPacket.sourceIP.GetIP.ToIpString(),tPacket.destIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrPartialStr"), left , tPacket.sourceIP.GetIP.ToIpString(),tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_ok; } else { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PingReturn1")); - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrSuccessStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrSuccessStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_ok; if (tPacket.sourceIP.GetIP != 0) { @@ -1616,7 +1616,7 @@ namespace EduNetworkBuilder else { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_PackReturnErr1")); - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrPngFailStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrPngFailStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_failed; } return; @@ -1668,7 +1668,7 @@ namespace EduNetworkBuilder nPacket.MyStatus = PacketStatus.processing; tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_ProcessArrival_ArpReached1")); - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrArp")) + "IP: " + tPacket.sourceIP.GetIPString + " MAC: "+ nPacket.sourceMAC; + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrArp")) + "IP: " + tPacket.sourceIP.GetIPString + " MAC: "+ nPacket.sourceMAC; tPacket.MyStatus = PacketStatus.finished_ok; } else @@ -1686,14 +1686,14 @@ namespace EduNetworkBuilder NetworkCard nic = LocalNic(tPacket.destIP); HostNicID myid = nic.myID; StoreArp(tPacket.sourceMAC, tPacket.TsourceIP.GetIP.ToIpString(), myid); - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrArpSuccessStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.sourceIP.GetIP.ToIpString(), tPacket.sourceMAC); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrArpSuccessStr"), 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 + ":\t" + string.Format(NB.Translate("ND_ProssArrArpFailStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrArpFailStr"), tPacket.sourceIP.GetIP.ToIpString(), tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_failed; } return; @@ -1742,7 +1742,7 @@ namespace EduNetworkBuilder IPAddress tIP = HubManagementIP(); if (tIP != null) IP = tIP.GetIPString; } - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrDHCPStr"), IP); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrDHCPStr"), IP); //If we are a wireless router, we need to keep passing the broadcast request on if(!DoesForwarding()) tPacket.MyStatus = PacketStatus.finished_ok; @@ -1762,7 +1762,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 + ":\t" + string.Format(NB.Translate("ND_ProssArrDHCPAnsStr"), tPacket.payloadIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrDHCPAnsStr"), tPacket.payloadIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_ok; //Yay! myNet.NotePacketArrived(tPacket.MyType, this, tPacket.payloadIP, tPacket.sourceIP); return; @@ -1774,7 +1774,7 @@ namespace EduNetworkBuilder string sIP = "?.?.?.?"; if (tPacket.sourceIP != null) sIP = tPacket.sourceIP.GetIP.ToIpString(); - tPacket.Tracking.Status = hostname + ":\t" + string.Format(NB.Translate("ND_ProssArrDHCPFailStr"), sIP, tPacket.destIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_ProssArrDHCPFailStr"), sIP, tPacket.destIP.GetIP.ToIpString()); tPacket.MyStatus = PacketStatus.finished_failed; } return; @@ -1983,15 +1983,15 @@ namespace EduNetworkBuilder { if (tPacket.MyType == PacketType.dhcp_answer) { - tPacket.AddMessage(DebugLevel.info, hostname + " " + string.Format(NB.Translate("ND_PrepPackGtewyErr")) + " " + tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " " + string.Format(NB.Translate("ND_PrepPackGtewyErr")); + tPacket.AddMessage(DebugLevel.info, NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_PrepPackGtewyErr")) + " " + tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_PrepPackGtewyErr")); tPacket.MyStatus = PacketStatus.finished_failed; return false; } else { - tPacket.AddMessage(DebugLevel.info, hostname + " " + string.Format(NB.Translate("ND_PrepPackRoutErr")) +" "+ tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " " + NB.Translate("ND_PrepPackRoutErr"); + tPacket.AddMessage(DebugLevel.info, NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_PrepPackRoutErr")) +" "+ tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + NB.Translate("ND_PrepPackRoutErr"); tPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -2004,8 +2004,8 @@ namespace EduNetworkBuilder tPacket.OutboundNic = LocalNic(tPacket.OutboundIP); if (tPacket.OutboundNic == null) { - tPacket.AddMessage(DebugLevel.info, hostname + " " + string.Format(NB.Translate("ND_PrepPackNICErr")) + " :"+ tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " " + NB.Translate("ND_PrepPackNICErr"); + tPacket.AddMessage(DebugLevel.info, NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_PrepPackNICErr")) + " :"+ tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + NB.Translate("ND_PrepPackNICErr"); tPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -2016,8 +2016,8 @@ namespace EduNetworkBuilder tPacket.OutboundIF = tPacket.OutboundNic.LocalInterface(tPacket.OutboundIP, tPacket.Tracking); if (tPacket.OutboundIF == null) { - tPacket.AddMessage(DebugLevel.info, hostname + " " + string.Format(NB.Translate("ND_PrepPackRoutErr")) + " :" + tPacket.OutboundIP.GetIP.ToIpString()); - tPacket.Tracking.Status = hostname + " " + NB.Translate("ND_PrepPackRoutErr"); + tPacket.AddMessage(DebugLevel.info, NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_PrepPackRoutErr")) + " :" + tPacket.OutboundIP.GetIP.ToIpString()); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + NB.Translate("ND_PrepPackRoutErr"); tPacket.MyStatus = PacketStatus.finished_failed; return false; } @@ -2194,7 +2194,7 @@ namespace EduNetworkBuilder if(nc == null) { tPacket.AddMessage(DebugLevel.info, NB.Translate("ND_DoInputFromLink_CardFail1")); - tPacket.Tracking.Status = hostname + " " + string.Format(NB.Translate("ND_DoInputFromLink_CardFail2")); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_DoInputFromLink_CardFail2")); tPacket.MyStatus = PacketStatus.finished_failed; return; } @@ -2233,16 +2233,16 @@ namespace EduNetworkBuilder { if (tPacket.MyType == PacketType.dhcp_request && !isDHCPServer) { - tPacket.AddMessage(DebugLevel.debug, hostname + " " +string.Format(NB.Translate("ND_DoInFromLnkDeaf"))); - tPacket.Tracking.Status = hostname +" " + string.Format(NB.Translate("ND_DoInFromLnkNoDHCP")); + tPacket.AddMessage(DebugLevel.debug, NB.LeftPad(hostname) + " " +string.Format(NB.Translate("ND_DoInFromLnkDeaf"))); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_DoInFromLnkNoDHCP")); 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 + " " +string.Format(NB.Translate("ND_NotRouter"))); - tPacket.Tracking.Status = hostname + " " + string.Format(NB.Translate("ND_NotRouter2")); + tPacket.AddMessage(DebugLevel.debug, NB.LeftPad(hostname) + " " +string.Format(NB.Translate("ND_NotRouter"))); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_NotRouter2")); tPacket.MyStatus = PacketStatus.finished_failed; return; } @@ -2251,8 +2251,8 @@ namespace EduNetworkBuilder myType != NetworkComponentType.wbridge && myType != NetworkComponentType.wrepeater && myType != NetworkComponentType.wrouter) { - tPacket.AddMessage(DebugLevel.debug, hostname + string.Format(NB.Translate("ND_NoLocIP"))); - tPacket.Tracking.Status = hostname + " " + string.Format(NB.Translate("ND_NoLocIP2")); + tPacket.AddMessage(DebugLevel.debug, NB.LeftPad(hostname) + string.Format(NB.Translate("ND_NoLocIP"))); + tPacket.Tracking.Status = NB.LeftPad(hostname) + " " + string.Format(NB.Translate("ND_NoLocIP2")); tPacket.MyStatus = PacketStatus.finished_failed; return; } diff --git a/EduNetworkBuilder/NetworkLink.cs b/EduNetworkBuilder/NetworkLink.cs index ecbfde9..797130e 100644 --- a/EduNetworkBuilder/NetworkLink.cs +++ b/EduNetworkBuilder/NetworkLink.cs @@ -331,7 +331,7 @@ namespace EduNetworkBuilder if(movingTo == null) { tPacket.AddMessage(DebugLevel.info, NB.Translate("NL_DoMoveNoEnd")); - tPacket.Tracking.Status = hostname + string.Format(NB.Translate("NL_DoMoveNoEnd2")); + tPacket.Tracking.Status = NB.LeftPad(hostname) + string.Format(NB.Translate("NL_DoMoveNoEnd2")); tPacket.MyStatus = PacketStatus.finished_failed; } else diff --git a/EduNetworkBuilder/Packet.cs b/EduNetworkBuilder/Packet.cs index 936e065..e523746 100644 --- a/EduNetworkBuilder/Packet.cs +++ b/EduNetworkBuilder/Packet.cs @@ -262,7 +262,7 @@ namespace EduNetworkBuilder { //No more arps going. We do not have an answer! Tracking.AddMessage(DebugLevel.info, WhereAmI, NB.Translate("P_ProcessTick") + ": "+ dest.GetIP.ToIpString()); - Tracking.Status = WhereAmI.hostname + NB.Translate("P_ProcessTick"); + Tracking.Status = NB.LeftPad(WhereAmI.hostname) + NB.Translate("P_ProcessTick"); MyStatus = PacketStatus.finished_failed; } return; diff --git a/EduNetworkBuilder/PacketMessage.cs b/EduNetworkBuilder/PacketMessage.cs index cf7ce3f..6cc3694 100644 --- a/EduNetworkBuilder/PacketMessage.cs +++ b/EduNetworkBuilder/PacketMessage.cs @@ -88,7 +88,7 @@ namespace EduNetworkBuilder { if((tmessage.WhatLevel | tLevel) == tLevel) { - tString = tmessage.HostName + " \t" + tmessage.WhatLevel.ToString() + "\t" + tmessage.Message; + tString = NB.LeftPad(tmessage.HostName) + " " + NB.LeftPad(tmessage.WhatLevel.ToString()) + " " + tmessage.Message; answer.Add(tString); } } @@ -100,7 +100,7 @@ namespace EduNetworkBuilder List answer = new List(); string tString; int time = duration.Seconds * 1000 + duration.Milliseconds; - tString = time.ToString() + " ms " + Status; + tString = NB.LeftPad(time.ToString() + "ms ", 10) + Status; answer.Add(tString); return answer; } diff --git a/EduNetworkBuilder/Resources/ReleaseNotes.rtf b/EduNetworkBuilder/Resources/ReleaseNotes.rtf index 04acf8e..fa747ab 100644 --- a/EduNetworkBuilder/Resources/ReleaseNotes.rtf +++ b/EduNetworkBuilder/Resources/ReleaseNotes.rtf @@ -1,10 +1,11 @@ {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}} -{\*\generator Riched20 10.0.10240}{\*\mmathPr\mnaryLim0\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 +{\*\generator Riched20 10.0.10240}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 \pard\nowidctlpar\sa200\sl276\slmult1\b\f0\fs22\lang9 Version 1.0.25\par \b0 * Minor changes to help file\par * Fixed size of labels on IP-Address editor box\par * Hide gateway label when we do not need it. (ip-address editor)\par -* rename "mixed network" puzzle to be "adding devices" (the puzzle was about adding devices)\b\par +* rename "mixed network" puzzle to be "adding devices" (the puzzle was about adding devices)\par +* Changed layout of many messages\b\par Version 1.0.24 \par \b0 * Add sound when ctrl-s is pressed so we know we saved.\par * Add sound fail when save is canceled (will use it later if ctrl-s fails)\par diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx index 8abcd7c..d262ba3 100644 --- a/EduNetworkBuilder/Resources/languages/edustrings.resx +++ b/EduNetworkBuilder/Resources/languages/edustrings.resx @@ -215,7 +215,7 @@ Solved - NetworkBuilder solvedToolStripMenuItem = Solved + _Solved = Solved DHCP @@ -227,11 +227,11 @@ Two Networks - NetworkBuilder twoNetworksToolStripMenuItem = Two Networks + NetworkBuilder solvedTwoNetworksToolStripMenuItem = Two Networks Three Networks - NetworkBuilder threeNetworksToolStripMenuItem = Three Networks + NetworkBuilder SolvedThreeNetworksToolStripMenuItem = Three Networks Firewalls @@ -241,14 +241,6 @@ To Solve NetworkBuilder toSolveToolStripMenuItem = To Solve - - Two Networks - NetworkBuilder solvedTwoNetworksToolStripMenuItem = Two Networks - - - Three Networks - NetworkBuilder SolvedThreeNetworksToolStripMenuItem = Three Networks - lblStatus NetworkBuilder lblStatus = lblStatus @@ -734,7 +726,7 @@ Network Device DoInputFromLink CardFail1 = The packet failed to hit a Card. We should not be here! - Success! The arp request reached the destination. + Success! The arp request reached the destination. Network Device ProcessArrival ArpReached1 = Success! The arp request reached the destination. @@ -746,7 +738,7 @@ Network Device ProcessArrival CommingOut = Packet coming out from tunnel. - Success! The DHCP request reached a DHCP Server. + Success! The DHCP request reached a DHCP Server. Network Device ProcessArrival DHCPReach1 = Success! The DHCP request reached a DHCP Server. @@ -771,14 +763,14 @@ The broadcast ping reached a destination that was not on the same network - Network Device ProcessArrival PingErr1 = The broadcast ping reached a destination that was not on the same network + ND_ProssArr_PingErr = The broadcast ping reached a destination that was not on the same network - Success! The ping reached the destination. + Success! The ping reached the destination. Network Device ProcessArrival Success1 = Success! The ping reached the destination. - Success! The ping returned from its destination. + Success! The ping returned from its destination. Network Device ProcessArrival PingReturn1 = Success! The ping returned from its destination. @@ -1150,13 +1142,9 @@ _Read = Read - Solved! Would you like to open the puzzle box to go to the next puzzle? 'No' will let you continue to play with this one. + Solved! Would you like to open the puzzle box to go to the next puzzle? 'No' will let you continue to play with this one. N_MarkAsSolvedDone = Solved! Would you like to open the puzzle box to go to the next puzzle? 'No' will let you continue to play with this one. - - Solved - _Solved = Solved - ----All Done---- N_ProssPackDone = ----All Done---- @@ -1381,10 +1369,6 @@ DHCP Request found Server: {0} ND_ProssArrDHCPStr = DHCP Request found Server: {0} - - The broadcast ping reached a destination that was not on the same network - ND_ProssArr_PingErr = The broadcast ping reached a destination that was not on the same network - Ping partial success: {0}% packet loss. {1} -> {2} ND_ProssArrPartialStr = Ping partial success: {0}% packet loss. {1} -> {2} @@ -1394,7 +1378,7 @@ ND_ProssArrPngFailStr = Ping failed: Arrived at a machine that was not expecting it and was rejected. {0} -> {1} - Success! The ping returned from its destination. But some was lost: health={0} + Success! The ping returned from its destination. But some was lost: health={0} ND_ProssArrSomeLostStr = Success! The ping returned from its destination. But some was lost: health={0}