Skip to content

Commit b08bed0

Browse files
authored
Port to .NET Framework (#80)
* Port to .NET 4.8 * Stat Injection
1 parent 25d3cd7 commit b08bed0

47 files changed

Lines changed: 2231 additions & 255 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DebugFiles/SWBF2Admin.sqlite

3 KB
Binary file not shown.

DebugFiles/web/frame.htm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
2929
<a href="/live/dashboard" class="active"><i id="status" class="material-icons">dns</i>Dashboard</a>
3030
<a href="/live/players" class="runtime"><i class="material-icons">face</i>Players</a>
3131
<a href="/live/chat" class="runtime"><i class="material-icons">chat</i>Chat</a>
32+
<a href="/live/gameedit" class="runtime"><i class="material-icons">edit</i>Game Edit</a>
3233

3334
<span>Server Settings</span>
3435
<a href="/settings/general"><i class="material-icons">dns</i>General</a>
3536
<a href="/settings/game"><i class="material-icons">videogame_asset</i>Game</a>
3637
<a href="/settings/maps"><i class="material-icons">map</i>Map Rotation</a>
37-
38+
3839
<span>Database</span>
3940
<a href="/db/statistics" class="runtime"><i class="material-icons">timeline</i>Statistics</a>
4041
<a href="/db/bans" class="runtime"><i class="material-icons">gavel</i>Bans</a>

DebugFiles/web/gameedit.htm

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<div class="default">
2+
<h2>Game Edit</h2>
3+
<div class="autoscale">
4+
5+
<div class="item">
6+
<span>Mission Timer</span>
7+
<div class="text">
8+
<div class="text">
9+
<div>
10+
<a href="#" id="gameedit_btn_add_time_15" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
11+
<span>+ 15</span>
12+
</a>
13+
<a href="#" id="gameedit_btn_add_time_30" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
14+
<span>+ 30</span>
15+
</a>
16+
<a href="#" id="gameedit_btn_add_time_45" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
17+
<span>+ 45</span>
18+
</a>
19+
<a href="#" id="gameedit_btn_add_time_60" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
20+
<span>+ 60</span>
21+
</a>
22+
</div>
23+
<br>
24+
<div>
25+
<a href="#" id="gameedit_btn_del_time_15" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
26+
<span>- 15</span>
27+
</a>
28+
<a href="#" id="gameedit_btn_del_time_30" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
29+
<span>- 30</span>
30+
</a>
31+
<a href="#" id="gameedit_btn_del_time_45" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
32+
<span>- 45</span>
33+
</a>
34+
<a href="#" id="gameedit_btn_del_time_60" class="button" style="display: inline-block; width: 60px; height: 40px; text-align: center; line-height: 40px;">
35+
<span>- 60</span>
36+
</a>
37+
</div>
38+
</div>
39+
</div>
40+
41+
42+
<span id="team1_name" class="team1_name_display">Team 1</span>
43+
<div class="text" value="Score">
44+
<span id="team1_score" class="score-display">Score: 0</span>
45+
<a href="#" id="gameedit_btn_add_flag_1" class="button">
46+
<span>+ 1</span>
47+
</a>
48+
<a href="#" id="gameedit_btn_sub_flag_1" class="button">
49+
<span>- 1</span>
50+
</a>
51+
</div>
52+
53+
<span id="team2_name" class="team2_name_display">Team 2</span>
54+
<div class="text">
55+
<span id="team2_score" class="score-display">Score: 0</span>
56+
<a href="#" id="gameedit_btn_add_flag_2" class="button">
57+
<span>+ 1</span>
58+
</a>
59+
<a href="#" id="gameedit_btn_sub_flag_2" class="button">
60+
<span>- 1</span>
61+
</a>
62+
</div>
63+
</div>
64+
65+
</div>
66+
</div>
67+
68+
<script type="text/javascript" src="/res/gameedit.js"></script>

DebugFiles/web/players.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h2>Players</h2>
3434
<li><a href="#" id="players_a_swap"><i class="material-icons">swap_horiz</i>Swap player</a></li>
3535
<li><a href="#" id="players_a_kick"><i class="material-icons">remove_circle</i>Kick player</a></li>
3636
<li><a href="#" id="players_a_ban"><i class="material-icons">gavel</i>Ban player</a></li>
37+
<li><a href="#" id="players_a_points"><i class="material-icons">star</i>Give 12 points</a></li>
3738
</ul>
3839

3940
<div id="players_div_ban" class="settings">

DebugFiles/web/res/gameedit.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
var GameEditUrl = "/live/gameedit";
2+
var GameEditUpdateInterval = 3000;
3+
4+
function GameEdit() {
5+
var base = this;
6+
this.timer = null;
7+
8+
this.onInit = function() {
9+
base.timer = setInterval(base.updateStatus, GameEditUpdateInterval);
10+
this.updateStatus();
11+
12+
// Array of buttons and their corresponding time values
13+
const timeButtons = [
14+
{ id: "#gameedit_btn_add_time_15", time: 15 },
15+
{ id: "#gameedit_btn_add_time_30", time: 30 },
16+
{ id: "#gameedit_btn_add_time_45", time: 45 },
17+
{ id: "#gameedit_btn_add_time_60", time: 60 },
18+
{ id: "#gameedit_btn_del_time_15", time: -15 },
19+
{ id: "#gameedit_btn_del_time_30", time: -30 },
20+
{ id: "#gameedit_btn_del_time_45", time: -45 },
21+
{ id: "#gameedit_btn_del_time_60", time: -60 }
22+
];
23+
24+
timeButtons.forEach(button => {
25+
$(button.id).click(function(e) {
26+
e.preventDefault();
27+
base.addTime(button.time);
28+
});
29+
});
30+
31+
// Array of flags and their corresponding values
32+
const flagButtons = [
33+
{ id: "#gameedit_btn_add_flag_1", team: 1 , score: 1},
34+
{ id: "#gameedit_btn_add_flag_2", team: 2 , score: 1},
35+
{ id: "#gameedit_btn_sub_flag_1", team: 1 , score: -1},
36+
{ id: "#gameedit_btn_sub_flag_2", team: 2 , score: -1}
37+
];
38+
39+
flagButtons.forEach(button => {
40+
$(button.id).click(function(e) {
41+
e.preventDefault();
42+
base.addFlag(button.team, button.score);
43+
});
44+
});
45+
};
46+
47+
this.onDeinit = function() {
48+
if(base.timer != null) clearInterval(base.timer);
49+
};
50+
51+
this.updateStatus = function(s) {
52+
$.post({
53+
url: DashboardUrl,
54+
data: '{"action":"status_get"}',
55+
contentType: "application/json",
56+
dataType:"json",
57+
}).done(function(res) {
58+
$("#team1_score").text(`Score: ${res.Team1Score}`);
59+
$("#team2_score").text(`Score: ${res.Team2Score}`);
60+
});
61+
};
62+
63+
this.addTime = function(time) {
64+
$.post({
65+
url: GameEditUrl,
66+
data: JSON.stringify({ action: "add_time", TimeToAdd: time}),
67+
})
68+
.done(function(res) {
69+
base.updateStatus();
70+
})
71+
.fail(function() {
72+
alert("Failed to add time!");
73+
});
74+
};
75+
76+
this.addFlag = function(team, score) {
77+
$.post({
78+
url: GameEditUrl,
79+
data: JSON.stringify({action: "add_flag", team: team, score: score}),
80+
})
81+
.done(function(res){
82+
base.updateStatus();
83+
})
84+
.fail(function() {
85+
alert("Failed to add flag!");
86+
})
87+
};
88+
89+
this.addPlayerPoints = function(slot, score){
90+
$.post({
91+
url: GameEditUrl,
92+
data: JSON.stringify({action:"add_player_points", slot: slot, score: score}),
93+
})
94+
.done(function(res){
95+
})
96+
.fail(function() {
97+
alert("Failed to add flag!");
98+
})
99+
};
100+
}
101+
102+
// Register the GameEdit page
103+
mainFrame.setActivePage(new GameEdit());

DebugFiles/web/res/players.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ function Players() {
1414
$(window).blur(base.hideQuickAdmin);
1515
$(document).click(base.hideQuickAdmin);
1616

17+
18+
1719
$("#players_a_swap").click(function (e) {
1820
e.preventDefault();
1921
base.quickAdmin({ Action: "players_swap" });
@@ -29,6 +31,11 @@ function Players() {
2931
base.dialog.show(base.player);
3032
});
3133

34+
$("#players_a_points").click(function (e) {
35+
e.preventDefault();
36+
base.quickAdmin({Action: "players_points", Points: 12});
37+
});
38+
3239
$("#players_num_ban_duration").on('input propertychange paste', function (evt) {
3340
$("#players_ban_permanent").prop("checked", false);
3441
});

DllLoader/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
5+
</startup>
6+
</configuration>

DllLoader/DllLoader.csproj

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,54 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
24
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{E6F07CF4-2B80-4134-8D0D-52562FA16B8F}</ProjectGuid>
48
<OutputType>Exe</OutputType>
5-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6-
<AssemblyTitle>DllLoader</AssemblyTitle>
7-
<Product>DllLoader</Product>
8-
<Copyright>Copyright © 2018</Copyright>
9-
<AssemblyVersion>1.3.0.0</AssemblyVersion>
10-
<FileVersion>1.0.0.0</FileVersion>
9+
<RootNamespace>DllLoader</RootNamespace>
10+
<AssemblyName>DllLoader</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<TargetFrameworkProfile />
1115
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>x64</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Data.DataSetExtensions" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Net.Http" />
43+
<Reference Include="System.Xml" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="DllInjector.cs" />
47+
<Compile Include="Program.cs" />
48+
<Compile Include="Properties\AssemblyInfo.cs" />
49+
</ItemGroup>
1250
<ItemGroup>
13-
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
14-
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
51+
<None Include="App.config" />
1552
</ItemGroup>
53+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
1654
</Project>

DllLoader/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ static void Main(string[] args)
5151
Console.WriteLine("ERROR");
5252
Console.WriteLine(e.ToString());
5353
}
54+
55+
#if DEBUG
56+
Console.WriteLine("Press [return] to exit.");
57+
Console.ReadLine();
58+
#endif
5459
}
5560
}
5661
}

DllLoader/Properties/AssemblyInfo.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
using System.Reflection;
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("DllLoader")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("DllLoader")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
414
[assembly: AssemblyTrademark("")]
515
[assembly: AssemblyCulture("")]
616

@@ -11,3 +21,16 @@
1121

1222
// The following GUID is for the ID of the typelib if this project is exposed to COM
1323
[assembly: Guid("e6f07cf4-2b80-4134-8d0d-52562fa16b8f")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.3.0.0")]
36+
[assembly: AssemblyFileVersion("1.3.0.0")]

0 commit comments

Comments
 (0)