TODO: find good libary for UPNP

This commit is contained in:
Bitl 2017-09-02 13:27:02 -07:00
parent c0425f358a
commit 108737794b
2 changed files with 5 additions and 31 deletions

View File

@ -110,10 +110,7 @@ namespace RBXLegacyLauncher
{
if (GlobalVars.upnp == true)
{
NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Add(GlobalVars.ServerPort, "TCP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port TCP");
mappings.Add(GlobalVars.ServerPort, "UDP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port UDP");
//TODO: find good libary for UPNP
}
WriteConfigValues();
StartServer();
@ -822,11 +819,7 @@ namespace RBXLegacyLauncher
void ServerExited(object sender, EventArgs e)
{
NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Remove(GlobalVars.ServerPort, "TCP");
mappings.Remove(GlobalVars.ServerPort, "UDP");
//TODO: find good libary for UPNP
}
void StartStudio()
@ -871,10 +864,7 @@ namespace RBXLegacyLauncher
{
if (GlobalVars.upnp == true)
{
NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Add(GlobalVars.ServerPort, "TCP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port TCP");
mappings.Add(GlobalVars.ServerPort, "UDP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port UDP");
//TODO: find good libary for UPNP
}
StartServer();
}
@ -882,10 +872,7 @@ namespace RBXLegacyLauncher
{
if (GlobalVars.upnp == true)
{
NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Add(GlobalVars.ServerPort, "TCP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port TCP");
mappings.Add(GlobalVars.ServerPort, "UDP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port UDP");
//TODO: find good libary for UPNP
}
StartServerNo3D();
}
@ -893,10 +880,7 @@ namespace RBXLegacyLauncher
{
if (GlobalVars.upnp == true)
{
NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Add(GlobalVars.ServerPort, "TCP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port TCP");
mappings.Add(GlobalVars.ServerPort, "UDP", GlobalVars.ServerPort, SecurityFuncs.GetLocalIPAddress(), true, "RBXLegacy Server Port UDP");
//TODO: find good libary for UPNP
}
StartServerNo3D();
}

View File

@ -119,15 +119,5 @@
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<COMReference Include="NATUPNPLib">
<Guid>{1C565858-F302-471E-B409-F180AA4ABEC6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>