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

View File

@ -119,15 +119,5 @@
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>