make the initial traversial class

This commit is contained in:
Tim Young 2017-08-25 10:13:05 -05:00
parent 7d14ca89bb
commit f4cade1652
2 changed files with 60 additions and 0 deletions

View File

@ -177,6 +177,7 @@
<DependentUpon>RTFWindow.cs</DependentUpon> <DependentUpon>RTFWindow.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="SchoolworkClass.cs" /> <Compile Include="SchoolworkClass.cs" />
<Compile Include="TraversalClass.cs" />
<Compile Include="TrippleDESDocumentEncryption.cs" /> <Compile Include="TrippleDESDocumentEncryption.cs" />
<Compile Include="VLANConfig.cs"> <Compile Include="VLANConfig.cs">
<SubType>Form</SubType> <SubType>Form</SubType>

View File

@ -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<TraversalRecord> PathTaken = new List<TraversalRecord>();
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));
}
/// <summary>
/// This is just a debug function to print off the whole path as we find it.
/// </summary>
public void DumpPath()
{
foreach(TraversalRecord one in PathTaken)
{
Console.WriteLine(string.Format("{0:12} : {1:-12}",one.host, one.WhatUsed.ToString()));
}
}
}
}