diff --git a/EduNetworkBuilder/EduNetworkBuilder.csproj b/EduNetworkBuilder/EduNetworkBuilder.csproj
index 858ac88..5864e97 100644
--- a/EduNetworkBuilder/EduNetworkBuilder.csproj
+++ b/EduNetworkBuilder/EduNetworkBuilder.csproj
@@ -383,6 +383,12 @@
+
+ False
+ EduNetworkBuilder user file
+ EdunNetworkBuilder
+ Resources\NBIco.ico
+
False
EduNetworkBuilder network file
diff --git a/EduNetworkBuilder/LanguageString.cs b/EduNetworkBuilder/LanguageString.cs
index 9e3ad7f..0f3e7fa 100644
--- a/EduNetworkBuilder/LanguageString.cs
+++ b/EduNetworkBuilder/LanguageString.cs
@@ -14,6 +14,7 @@ namespace EduNetworkBuilder
public string text="";
public string language="en";
public string tag_type;
+ private LanguageString() { }
public LanguageString(string lang, string msg, string tag)
{
@@ -21,6 +22,14 @@ namespace EduNetworkBuilder
language = lang;
tag_type = tag;
}
+ public LanguageString Clone()
+ {
+ LanguageString newitem = new LanguageString();
+ newitem.text = text;
+ newitem.language = language;
+ newitem.tag_type = tag_type;
+ return newitem;
+ }
public LanguageString(XmlNode theNode, string tag)
{
@@ -62,6 +71,27 @@ namespace EduNetworkBuilder
{
tag = type;
}
+ private LanguageStrings() { }
+ public LanguageStrings(LanguageStrings ToCopy)
+ {
+ LanguageStrings.Clone(ToCopy, this);
+ }
+
+ public static void Clone(LanguageStrings source, LanguageStrings dest)
+ {
+ dest.tag = source.tag;
+ dest.TheStrings.Clear();
+ foreach(LanguageString ls in source.TheStrings)
+ {
+ dest.TheStrings.Add(ls.Clone());
+ }
+ }
+ public LanguageStrings Clone()
+ {
+ LanguageStrings newitem = new LanguageStrings();
+ LanguageStrings.Clone(this, newitem);
+ return newitem;
+ }
public void Add(XmlNode theNode)
{
diff --git a/EduNetworkBuilder/NetTest.cs b/EduNetworkBuilder/NetTest.cs
index e9df04f..35dd0c3 100644
--- a/EduNetworkBuilder/NetTest.cs
+++ b/EduNetworkBuilder/NetTest.cs
@@ -7,9 +7,13 @@ using System.Drawing;
using System.Xml;
using System.Windows.Forms;
using System.Text.RegularExpressions;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Runtime.Serialization;
+using System.IO;
namespace EduNetworkBuilder
{
+ [Serializable]
public class NetTest
{
public string sHost = "";
@@ -547,5 +551,29 @@ namespace EduNetworkBuilder
}
return false;
}
+
+
+ public static T Clone(T source)
+ {
+ if (!typeof(T).IsSerializable)
+ {
+ throw new ArgumentException(NB.Translate("NC_CloneSerialzable"), NB.Translate("_source"));
+ }
+
+ // Don't serialize a null object, simply return the default for that object
+ if (Object.ReferenceEquals(source, null))
+ {
+ return default(T);
+ }
+
+ IFormatter formatter = new BinaryFormatter();
+ Stream stream = new MemoryStream();
+ using (stream)
+ {
+ formatter.Serialize(stream, source);
+ stream.Seek(0, SeekOrigin.Begin);
+ return (T)formatter.Deserialize(stream);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs
index a67dc55..76aedbd 100644
--- a/EduNetworkBuilder/Network.cs
+++ b/EduNetworkBuilder/Network.cs
@@ -19,7 +19,7 @@ namespace EduNetworkBuilder
///
public class Network
{
- public string PuzzleName="";
+ public string PuzzleName = "";
public int myHeight = 1024;
public int myWidth = 1024;
public int Level = 0;
@@ -38,9 +38,9 @@ namespace EduNetworkBuilder
List NetComponents = new List();
//should have background image
Image TheNetImage = new Bitmap(1024, 1024);
- Image TheNetImageBackground = new Bitmap(1024,1024);
+ Image TheNetImageBackground = new Bitmap(1024, 1024);
public int itemsize = 100; //The size of network components
- PictureBox myPBox=null;
+ PictureBox myPBox = null;
private int UniqueIdentifier = 100; //This gets used for all sorts of things. is auto-incremented every time someone asks for one
private List myPackets = new List();
private List myMessages = new List();
@@ -58,8 +58,8 @@ namespace EduNetworkBuilder
private int DefaultTimeout = 10;
private int NumberOfSecondsForTimeout = 10;
private List PacketRectangles = new List();
- public BindingList VlanNames = new BindingList() { new VLANName(1,"Default") };
-
+ public BindingList VlanNames = new BindingList() { new VLANName(1, "Default") };
+
private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch
private List PacketColors = new List();
@@ -74,7 +74,10 @@ namespace EduNetworkBuilder
NetTitle = new LanguageStrings("title"); //Do not translate this string "title". It is an important word
}
- public Network() { } //simple constructor
+ public Network() {
+ NetMessage = new LanguageStrings("message");
+ NetTitle = new LanguageStrings("title"); //Do not translate this string "title". It is an important word
+ } //simple constructor
private bool isDirty()
{
@@ -86,6 +89,38 @@ namespace EduNetworkBuilder
return false;
}
+ public static void Clone(Network source, Network dest)
+ {
+ dest.DefaultTimeout = source.DefaultTimeout;
+ dest.HintsToDisplay = source.HintsToDisplay;
+ dest.itemsize = source.itemsize;
+ dest.Level = source.Level;
+ dest.myHeight = source.myHeight;
+ dest.myWidth = source.myWidth;
+ //dest.NetComponents
+ foreach(NetworkComponent NC in source.NetComponents)
+ {
+ dest.NetComponents.Add(NetworkComponent.Clone(NC));
+ }
+ //dest.NetTests
+ foreach(NetTest NT in source.NetTests)
+ {
+ dest.NetTests.Add(NetTest.Clone(NT));
+ }
+ dest.NetTitle = source.NetTitle;
+ dest.NetworkFilename = source.NetworkFilename;
+ dest.OptionShowLabels = source.OptionShowLabels;
+ dest.PacketColors = source.PacketColors;
+ dest.PuzzleName = source.PuzzleName;
+ dest.NetMessage = new LanguageStrings(source.NetMessage);
+ }
+
+ public Network Clone()
+ {
+ Network newitem = new Network();
+ Network.Clone(this, newitem);
+ return newitem;
+ }
public void ClearComponents()
{
@@ -289,8 +324,10 @@ namespace EduNetworkBuilder
//save the number of items
//Save all the items
writer.WriteStartElement("Network");
- NetMessage.Save(writer);
- NetTitle.Save(writer);
+ if(NetMessage != null)
+ NetMessage.Save(writer);
+ if(NetTitle != null)
+ NetTitle.Save(writer);
writer.WriteElementString("height", myHeight.ToString());
writer.WriteElementString("width", myWidth.ToString());
writer.WriteElementString("itemsize", itemsize.ToString());
diff --git a/EduNetworkBuilder/NetworkBuilder.Designer.cs b/EduNetworkBuilder/NetworkBuilder.Designer.cs
index ffd7c13..80045ca 100644
--- a/EduNetworkBuilder/NetworkBuilder.Designer.cs
+++ b/EduNetworkBuilder/NetworkBuilder.Designer.cs
@@ -43,6 +43,7 @@
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.changeLanguageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.classSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.profileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dHCPRequestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clearArpTableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -81,7 +82,7 @@
this.HelpPanel = new System.Windows.Forms.Panel();
this.cbViewTitles = new System.Windows.Forms.CheckBox();
this.myProgressBar = new System.Windows.Forms.ProgressBar();
- this.profileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.addToClassworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.msMainMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit();
this.HelpPanel.SuspendLayout();
@@ -160,7 +161,8 @@
this.optionsToolStripMenuItem,
this.changeLanguageToolStripMenuItem,
this.classSetupToolStripMenuItem,
- this.profileToolStripMenuItem});
+ this.profileToolStripMenuItem,
+ this.addToClassworkToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(47, 24);
this.editToolStripMenuItem.Text = "Edit";
@@ -210,6 +212,13 @@
this.classSetupToolStripMenuItem.Text = "Class Setup";
this.classSetupToolStripMenuItem.Click += new System.EventHandler(this.classSetupToolStripMenuItem_Click);
//
+ // profileToolStripMenuItem
+ //
+ this.profileToolStripMenuItem.Name = "profileToolStripMenuItem";
+ this.profileToolStripMenuItem.Size = new System.Drawing.Size(203, 26);
+ this.profileToolStripMenuItem.Text = "Profile";
+ this.profileToolStripMenuItem.Click += new System.EventHandler(this.profileToolStripMenuItem_Click);
+ //
// allToolStripMenuItem
//
this.allToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -564,12 +573,12 @@
this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.myProgressBar.TabIndex = 11;
//
- // profileToolStripMenuItem
+ // addToClassworkToolStripMenuItem
//
- this.profileToolStripMenuItem.Name = "profileToolStripMenuItem";
- this.profileToolStripMenuItem.Size = new System.Drawing.Size(203, 26);
- this.profileToolStripMenuItem.Text = "Profile";
- this.profileToolStripMenuItem.Click += new System.EventHandler(this.profileToolStripMenuItem_Click);
+ this.addToClassworkToolStripMenuItem.Name = "addToClassworkToolStripMenuItem";
+ this.addToClassworkToolStripMenuItem.Size = new System.Drawing.Size(203, 26);
+ this.addToClassworkToolStripMenuItem.Text = "Add To Classwork";
+ this.addToClassworkToolStripMenuItem.Click += new System.EventHandler(this.addToClassworkToolStripMenuItem_Click);
//
// BuilderWindow
//
@@ -660,6 +669,7 @@
private System.Windows.Forms.ToolStripMenuItem SolvedVLANToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem classSetupToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem profileToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem addToClassworkToolStripMenuItem;
}
}
diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs
index 1923ed5..c0ba0d6 100644
--- a/EduNetworkBuilder/NetworkBuilder.cs
+++ b/EduNetworkBuilder/NetworkBuilder.cs
@@ -1866,5 +1866,16 @@ namespace EduNetworkBuilder
CurrentUser = PPF.Edit();
UpdateMenu();
}
+
+ private void addToClassworkToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (CurrentUser == null) return;
+ if (!CurrentUser.isAdmin) return;
+
+ PersonProfileForm PPF = new PersonProfileForm(CurrentUser);
+ CurrentUser = PPF.AddSchoolwork(myNetwork);
+ UpdateMenu();
+
+ }
}
}
\ No newline at end of file
diff --git a/EduNetworkBuilder/PersonClass.cs b/EduNetworkBuilder/PersonClass.cs
index 468637b..fe6a16d 100644
--- a/EduNetworkBuilder/PersonClass.cs
+++ b/EduNetworkBuilder/PersonClass.cs
@@ -41,7 +41,7 @@ namespace EduNetworkBuilder
///
List EverCompletedPuzzles = new List();
- List Projects = new List();
+ public List Projects = new List();
private PersonClass()
{ }
@@ -122,6 +122,9 @@ namespace EduNetworkBuilder
Passwords.Add(Individual.InnerText);
break;
case "project":
+ case "schoolwork":
+ SchoolworkClass SWC = new SchoolworkClass(Individual);
+ Projects.Add(SWC);
break;
}
}
diff --git a/EduNetworkBuilder/PersonProfileForm.cs b/EduNetworkBuilder/PersonProfileForm.cs
index 531b416..a93c841 100644
--- a/EduNetworkBuilder/PersonProfileForm.cs
+++ b/EduNetworkBuilder/PersonProfileForm.cs
@@ -59,7 +59,8 @@ namespace EduNetworkBuilder
{
//Prompt for a username
String Dest = NB.TextPromptBox(NB.Translate("PPF_EnterUserName"));
- if (Dest == "") Close();//No name given or canceled.
+ if (Dest == "") { Close(); return; }//No name given or canceled.
+ if (Dest == null) { Close(); return; }
if (Dest[0] != '_') Dest = "_Teacher_" + Dest; //Make sure it begins with _
//Find a directory for it.
CurrentUser = new PersonClass(Dest, true); //Make an admin person class
@@ -100,7 +101,25 @@ namespace EduNetworkBuilder
BW.Show();
}
return CurrentUser;
- }
+ }
+
+ public PersonClass AddSchoolwork(Network ToAdd)
+ {
+ if (CurrentUser == null) return CurrentUser;
+ BuilderWindow BW = NB.GetBuilderWin();
+ SchoolworkClass NewWork = new SchoolworkClass(ToAdd);
+ CurrentUser.Projects.Add(NewWork);
+ UpdateFormFromUser(); //make sure we list the right homeworks.
+
+ if (BW != null)
+ {
+ BW.Hide();
+ this.tcTabControl.SelectedIndex = 1; //Jump to the items tab
+ this.ShowDialog();
+ BW.Show();
+ }
+ return CurrentUser;
+ }
private void UpdateFormFromUser()
{
@@ -110,6 +129,24 @@ namespace EduNetworkBuilder
tbUsername.Text = CurrentUser.UserName;
if (CurrentUser.isAdmin) this.Text = "Admin: " + CurrentUser.UserName;
else this.Text = "Student: " + CurrentUser.UserName;
+
+ tvClasswork.Nodes.Clear();
+ TreeNode Node;
+ if (CurrentUser.isAdmin)
+ {
+ //We have a class tree
+ Node = new TreeNode("Class");
+ TreeNode Top = Node;
+ tvClasswork.Nodes.Add(Node);
+ foreach(SchoolworkClass SWC in CurrentUser.Projects)
+ {
+ Node = new TreeNode(SWC.Name);
+ Top.Nodes.Add(Node);
+ }
+ //we have a students tree
+ Node = new TreeNode("Students");
+ tvClasswork.Nodes.Add(Node);
+ }
}
private void SaveUserInfoFromForm()
diff --git a/EduNetworkBuilder/SchoolworkClass.cs b/EduNetworkBuilder/SchoolworkClass.cs
index 95520a6..d751b0d 100644
--- a/EduNetworkBuilder/SchoolworkClass.cs
+++ b/EduNetworkBuilder/SchoolworkClass.cs
@@ -17,7 +17,7 @@ namespace EduNetworkBuilder
///
/// The name of the project. Homework3, Quiz 4, etc.
///
- string Name = "";
+ public string Name = "";
///
/// The short description of the project.
///
@@ -42,6 +42,15 @@ namespace EduNetworkBuilder
Load(TheNode);
}
+ public SchoolworkClass(Network ToAdd)
+ {
+ theProject = ToAdd.Clone();
+ Name = theProject.PuzzleName;
+ Description = theProject.PuzzleName;
+ isMaster = true;
+ }
+
+
#region Load and Save
//Load and save functions
public void Load(string filename)
diff --git a/EduNetworkBuilderSetup/Product.wxs b/EduNetworkBuilderSetup/Product.wxs
index 6f97050..f2b0d78 100644
--- a/EduNetworkBuilderSetup/Product.wxs
+++ b/EduNetworkBuilderSetup/Product.wxs
@@ -10,45 +10,45 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+