From f4cade16521ff84d6d4728332e6dccb979d3342a Mon Sep 17 00:00:00 2001 From: Tim Young Date: Fri, 25 Aug 2017 10:13:05 -0500 Subject: [PATCH] make the initial traversial class --- EduNetworkBuilder/EduNetworkBuilder.csproj | 1 + EduNetworkBuilder/TraversalClass.cs | 59 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 EduNetworkBuilder/TraversalClass.cs diff --git a/EduNetworkBuilder/EduNetworkBuilder.csproj b/EduNetworkBuilder/EduNetworkBuilder.csproj index ca3708b..9c57274 100644 --- a/EduNetworkBuilder/EduNetworkBuilder.csproj +++ b/EduNetworkBuilder/EduNetworkBuilder.csproj @@ -177,6 +177,7 @@ RTFWindow.cs + Form diff --git a/EduNetworkBuilder/TraversalClass.cs b/EduNetworkBuilder/TraversalClass.cs new file mode 100644 index 0000000..9a3afc8 --- /dev/null +++ b/EduNetworkBuilder/TraversalClass.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EduNetworkBuilder +{ + public class TraversalClass + { + protected struct TraversalRecord + { + public string host; + public TraversalTechnology WhatUsed; + + public TraversalRecord(string Host, TraversalTechnology what) + { + host = Host; + WhatUsed = what; + } + } + + List PathTaken = new List(); + + public TraversalClass(){ } + + public TraversalClass(TraversalClass CloneFrom) + { + Clone(CloneFrom, this); + } + + public TraversalClass Clone() + { + TraversalClass newClass = new TraversalClass(this); + return newClass; + } + + public static void Clone(TraversalClass source, TraversalClass dest) + { + dest.PathTaken.AddRange(source.PathTaken); + } + + public void AddPath(string Host, TraversalTechnology WithWhat) + { + PathTaken.Add(new TraversalRecord(Host, WithWhat)); + } + + /// + /// This is just a debug function to print off the whole path as we find it. + /// + public void DumpPath() + { + foreach(TraversalRecord one in PathTaken) + { + Console.WriteLine(string.Format("{0:12} : {1:-12}",one.host, one.WhatUsed.ToString())); + } + } + } +}