Solve some issues with multiple saved wireless links. They ended up connecting to the wrong devices and making a mess. So, we will start by auto-generating all wireless links.

This commit is contained in:
Tim Young 2018-04-09 18:24:12 +03:00
parent 3bea76f528
commit 11eec48969
3 changed files with 12 additions and 274 deletions

View File

@ -326,7 +326,8 @@ namespace EduNetworkBuilder
break;
case "link":
newNL = new NetworkLink(Individual);
NetComponents.Add(newNL);
if(newNL.theLinkType != LinkType.wireless)
NetComponents.Add(newNL); //do no load wireless links. Rebuild them
break;
case "device":
newND = new NetworkDevice(Individual);
@ -411,6 +412,13 @@ namespace EduNetworkBuilder
if (newUnique != -1)
UniqueIdentifier = newUnique;
int maxUI = 0;
foreach(NetworkComponent nc in NetComponents)
{
if (maxUI < nc.GetUniqueIdentifier)
maxUI = nc.GetUniqueIdentifier;
}
if (maxUI <= UniqueIdentifier) UniqueIdentifier = maxUI + 1;
}
public void OpenHelpIfNeeded(bool skipOpeningWindows)
@ -498,7 +506,8 @@ namespace EduNetworkBuilder
for (int loop = 0; loop < NetComponents.Count; loop++)
{
if (NB.GetComponentType(NetComponents[loop]) == GeneralComponentType.link)
NetComponents[loop].Save(writer);
if(((NetworkLink)NetComponents[loop]).theLinkType != LinkType.wireless )
NetComponents[loop].Save(writer); //Wireless links are rebuilt automatically
}
foreach(NetTest nt in NetTests)
{

View File

@ -1081,6 +1081,7 @@ namespace EduNetworkBuilder
nic.ConnectedLink = newLink.GetUniqueIdentifier;
Closest.ConnectedLink = newLink.GetUniqueIdentifier;
myNet.AddItem(newLink);
Console.WriteLine(hostname + " Connecting to :" + Closest.myID.HostName);
didsomething = true;
}
}

View File

@ -1368,159 +1368,6 @@
</interface>
</nic>
</device>
<link>
<SrcNic>
<hostid>154</hostid>
<nicid>157</nicid>
<hostname>laptop3</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>140</nicid>
<hostname>wrouter0</hostname>
<nicname>wport7</nicname>
</DstNic>
<hostname>laptop3_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>319</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>229</hostid>
<nicid>233</nicid>
<hostname>wrepeater0</hostname>
<nicname>wlan1</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>142</nicid>
<hostname>wrouter0</hostname>
<nicname>wport9</nicname>
</DstNic>
<hostname>wrepeater0_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>326</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>154</hostid>
<nicid>157</nicid>
<hostname>laptop3</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>140</nicid>
<hostname>wrouter0</hostname>
<nicname>wport7</nicname>
</DstNic>
<hostname>laptop3_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>317</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>229</hostid>
<nicid>233</nicid>
<hostname>wrepeater0</hostname>
<nicname>wlan1</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>142</nicid>
<hostname>wrouter0</hostname>
<nicname>wport9</nicname>
</DstNic>
<hostname>wrepeater0_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>324</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>154</hostid>
<nicid>157</nicid>
<hostname>laptop3</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>140</nicid>
<hostname>wrouter0</hostname>
<nicname>wport7</nicname>
</DstNic>
<hostname>laptop3_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>307</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>229</hostid>
<nicid>233</nicid>
<hostname>wrepeater0</hostname>
<nicname>wlan1</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>142</nicid>
<hostname>wrouter0</hostname>
<nicname>wport9</nicname>
</DstNic>
<hostname>wrepeater0_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>314</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>154</hostid>
<nicid>157</nicid>
<hostname>laptop3</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>140</nicid>
<hostname>wrouter0</hostname>
<nicname>wport7</nicname>
</DstNic>
<hostname>laptop3_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>301</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>229</hostid>
<nicid>233</nicid>
<hostname>wrepeater0</hostname>
<nicname>wlan1</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>142</nicid>
<hostname>wrouter0</hostname>
<nicname>wport9</nicname>
</DstNic>
<hostname>wrepeater0_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>308</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>154</hostid>
<nicid>157</nicid>
<hostname>laptop3</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>140</nicid>
<hostname>wrouter0</hostname>
<nicname>wport7</nicname>
</DstNic>
<hostname>laptop3_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>286</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>103</hostid>
@ -1623,125 +1470,6 @@
<linktype>normal</linktype>
<uniqueidentifier>128</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>229</hostid>
<nicid>233</nicid>
<hostname>wrepeater0</hostname>
<nicname>wlan1</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>142</nicid>
<hostname>wrouter0</hostname>
<nicname>wport9</nicname>
</DstNic>
<hostname>wrepeater0_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>238</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>149</hostid>
<nicid>152</nicid>
<hostname>laptop2</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>139</nicid>
<hostname>wrouter0</hostname>
<nicname>wport6</nicname>
</DstNic>
<hostname>laptop2_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>356</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>149</hostid>
<nicid>152</nicid>
<hostname>laptop2</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>139</nicid>
<hostname>wrouter0</hostname>
<nicname>wport6</nicname>
</DstNic>
<hostname>laptop2_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>358</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>149</hostid>
<nicid>152</nicid>
<hostname>laptop2</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>139</nicid>
<hostname>wrouter0</hostname>
<nicname>wport6</nicname>
</DstNic>
<hostname>laptop2_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>354</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>207</hostid>
<nicid>210</nicid>
<hostname>laptop4</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>229</hostid>
<nicid>234</nicid>
<hostname>wrepeater0</hostname>
<nicname>wport2</nicname>
</DstNic>
<hostname>laptop4_link_wrepeater0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>269</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>149</hostid>
<nicid>152</nicid>
<hostname>laptop2</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>139</nicid>
<hostname>wrouter0</hostname>
<nicname>wport6</nicname>
</DstNic>
<hostname>laptop2_link_wrouter0</hostname>
<linktype>wireless</linktype>
<uniqueidentifier>360</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>149</hostid>
<nicid>152</nicid>
<hostname>laptop2</hostname>
<nicname>wlan2</nicname>
</SrcNic>
<DstNic>
<hostid>130</hostid>
<nicid>139</nicid>
<hostname>wrouter0</hostname>
<nicname>wport6</nicname>
</DstNic>
<hostname />
<linktype>wireless</linktype>
<uniqueidentifier>283</uniqueidentifier>
</link>
<nettest>
<shost>wrouter0</shost>
<dhost>False</dhost>