Skip to content

Commit

Permalink
Fix removing plugin, remove firewall exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenvh1 committed Jan 20, 2024
1 parent c010c90 commit 3fbaaa3
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 44 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified server/.vs/ETS2 Local Radio desktop/v17/.suo
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f256e2e163fe1f8fc1aa6e661c76ede2cec59c7c
684de7e598f230a82171dfe49df1dc9d3470ece14b02d43507c028ae1b7d89a7
Binary file modified server/Capture/obj/Release/Capture.dll
Binary file not shown.
Binary file modified server/Capture/obj/Release/Capture.pdb
Binary file not shown.
10 changes: 8 additions & 2 deletions server/ETS2 Local Radio desktop/ETS2 Local Radio desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExCSS, Version=4.2.3.0, Culture=neutral, PublicKeyToken=bdbe16be9b936b9a, processorArchitecture=MSIL">
<HintPath>..\packages\ExCSS.4.2.3\lib\net48\ExCSS.dll</HintPath>
<Reference Include="ExCSS, Version=4.2.4.0, Culture=neutral, PublicKeyToken=bdbe16be9b936b9a, processorArchitecture=MSIL">
<HintPath>..\packages\ExCSS.4.2.4\lib\net48\ExCSS.dll</HintPath>
</Reference>
<Reference Include="Gma.System.MouseKeyHook, Version=5.7.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MouseKeyHook.5.7.1\lib\net48\Gma.System.MouseKeyHook.dll</HintPath>
Expand All @@ -83,6 +83,9 @@
<Reference Include="Svg, Version=3.4.0.0, Culture=neutral, PublicKeyToken=12a0bac221edeae2, processorArchitecture=MSIL">
<HintPath>..\packages\Svg.3.4.6\lib\net462\Svg.dll</HintPath>
</Reference>
<Reference Include="Swan.Lite, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Unosquare.Swan.Lite.3.1.0\lib\net461\Swan.Lite.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
Expand All @@ -100,6 +103,9 @@
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
68 changes: 28 additions & 40 deletions server/ETS2 Local Radio desktop/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void Main_Load(object sender, EventArgs e)
Subscribe();

//Add Firewall exception
AddException();
//AddException();

//Load languages to combobox:
LoadLanguages();
Expand Down Expand Up @@ -308,6 +308,7 @@ private void LoadAddresses()
comboIP.Items.Add("http://" + ip.ToString() + ":" + Settings.Port);
}
}
comboIP.Items.Add("http://localhost:" + Settings.Port);
comboIP.SelectedIndex = 0;
}

Expand Down Expand Up @@ -374,28 +375,28 @@ private void Telemetry_Data(SCSTelemetry data, bool updated)
}
}

private static void DeleteException()
{
Process netsh = new Process();
string arguments = "advfirewall firewall delete rule name=\"ETS2 Local Radio\" dir=in protocol=TCP localport=" + Settings.Port;
netsh.StartInfo.FileName = "netsh";
netsh.StartInfo.Arguments = arguments;
netsh.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
netsh.Start();
}

private static void AddException()
{
DeleteException();
// to prevent duplicates

Process netsh = new Process();
string arguments = "advfirewall firewall add rule name=\"ETS2 Local Radio\" dir=in action=allow protocol=TCP localport=" + Settings.Port;
netsh.StartInfo.FileName = "netsh";
netsh.StartInfo.Arguments = arguments;
netsh.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
netsh.Start();
}
//private static void DeleteException()
//{
// Process netsh = new Process();
// string arguments = "advfirewall firewall delete rule name=\"ETS2 Local Radio\" dir=in protocol=TCP localport=" + Settings.Port;
// netsh.StartInfo.FileName = "netsh";
// netsh.StartInfo.Arguments = arguments;
// netsh.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// netsh.Start();
//}

//private static void AddException()
//{
// DeleteException();
// // to prevent duplicates

// Process netsh = new Process();
// string arguments = "advfirewall firewall add rule name=\"ETS2 Local Radio\" dir=in action=allow protocol=TCP localport=" + Settings.Port;
// netsh.StartInfo.FileName = "netsh";
// netsh.StartInfo.Arguments = arguments;
// netsh.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// netsh.Start();
//}

private void Main_FormClosing(object sender, EventArgs e)
{
Expand All @@ -406,7 +407,7 @@ private void Main_FormClosing(object sender, EventArgs e)
Unsubscribe();
myServer.Stop();
writeFile("none", "0", "0");
DeleteException();
//DeleteException();
joystickTimer.Stop();
joystick.Release();
}
Expand Down Expand Up @@ -838,24 +839,11 @@ private void removePluginButton_LinkClicked(object sender, LinkLabelLinkClickedE
{
try
{
DialogResult result = DialogResult.No;
//MessageBox.Show(removeOverlay, "ETS2 Local Radio server",
//MessageBoxButtons.YesNoCancel,
//MessageBoxIcon.Question);
if (result != DialogResult.Cancel)
if (folderDialog.ShowDialog() == DialogResult.OK)
{
if (folderDialog.ShowDialog() == DialogResult.OK)
{
var folder = folderDialog.SelectedPath;
File.Delete(folder + @"\bin\win_x86\plugins\ets2-telemetry.dll");
File.Delete(folder + @"\bin\win_x64\plugins\ets2-telemetry.dll");
var folder = folderDialog.SelectedPath;
File.Delete(folder + @"\bin\win_x64\plugins\local-radio.dll");

if (result == DialogResult.Yes)
{
File.Delete(folder + @"\bin\win_x86\d3d9.dll");
File.Delete(folder + @"\bin\win_x64\d3d9.dll");
}
}
}
CheckPlugins();
}
Expand Down
4 changes: 4 additions & 0 deletions server/ETS2 Local Radio desktop/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<assemblyIdentity name="SharpDX.D3DCompiler" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ExCSS" publicKeyToken="bdbe16be9b936b9a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 3 additions & 1 deletion server/ETS2 Local Radio desktop/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ExCSS" version="4.2.3" targetFramework="net48" />
<package id="ExCSS" version="4.2.4" targetFramework="net48" />
<package id="MouseKeyHook" version="5.7.1" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="SlimDX" version="4.0.13.44" targetFramework="net45" />
Expand All @@ -9,4 +9,6 @@
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
<package id="Unosquare.Swan.Lite" version="3.1.0" targetFramework="net48" />
</packages>
Binary file modified server/bin/Capture.dll
Binary file not shown.
Binary file modified server/bin/Capture.pdb
Binary file not shown.

0 comments on commit 3fbaaa3

Please sign in to comment.