This commit is contained in:
Szymon Porwolik
2019-02-23 21:45:12 +01:00
parent cc30d305d5
commit 3d8b07361e
5 changed files with 152 additions and 22 deletions

View File

@@ -10,14 +10,13 @@
Perun.Refresh = 15 -- base refresh rate in secounds (values lower than 60 may affect performance!) Perun.Refresh = 15 -- base refresh rate in secounds (values lower than 60 may affect performance!)
Perun.JsonLocation = "Scripts\\Json\\perun_export.json" -- relatve do user's SaveGames DCS folder Perun.JsonLocation = "Scripts\\Json\\perun_export.json" -- relatve do user's SaveGames DCS folder
Perun.UDPTargetPort = 48620 -- UDP port to send data to Perun.UDPTargetPort = 48620 -- UDP port to send data to
Perun.MOTD_L1 = "Witamy na serwerze Gildia.org" -- Message send to players connecting the server - Line 1 Perun.MOTD_L1 = "Witamy na serwerze Gildia.org !" -- Message send to players connecting the server - Line 1
Perun.MOTD_L2 = "Wymagamy obecno<EFBFBD>ci na 255Mhz (DCS SRS)" -- Message send to players connecting the server - Line 2 Perun.MOTD_L2 = "Wymagamy obecnosci na 255Mhz (DCS SRS)" -- Message send to players connecting the server - Line 2
Perun.MOTD_L3 = "Udanej zabawy" -- Message send to players connecting the server - Line 3
-- ########### END OF SETTINGS ########### -- ########### END OF SETTINGS ###########
-- Variable init -- Variable init
Perun.Version = "v0.2.1" Perun.Version = "v0.3.0"
Perun.StatusData = {} Perun.StatusData = {}
Perun.SlotsData = {} Perun.SlotsData = {}
Perun.VersionData = {} Perun.VersionData = {}
@@ -156,7 +155,6 @@
Perun.onPlayerStart = function (id) Perun.onPlayerStart = function (id)
net.send_chat(Perun.MOTD_L1, id); net.send_chat(Perun.MOTD_L1, id);
net.send_chat(Perun.MOTD_L2, id); net.send_chat(Perun.MOTD_L2, id);
net.send_chat(Perun.MOTD_L3, id);
end end
Perun.onPlayerTrySendChat = function (playerID, msg, all) Perun.onPlayerTrySendChat = function (playerID, msg, all)
@@ -193,7 +191,7 @@
elseif eventName == "disconnect" then elseif eventName == "disconnect" then
--"disconnect", playerID, name, playerSide, reason_code --"disconnect", playerID, name, playerSide, reason_code
Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " disconnected; reason: " .. arg4); Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " disconnected");
elseif eventName == "crash" then elseif eventName == "crash" then
--"crash", playerID, unit_missionID --"crash", playerID, unit_missionID
@@ -213,7 +211,7 @@
elseif eventName == "pilot_death" then elseif eventName == "pilot_death" then
--"pilot_death", playerID, unit_missionID --"pilot_death", playerID, unit_missionID
Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. "died"); Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " died");
else else
Perun.LogEvent(eventName,"Unknown event type"); Perun.LogEvent(eventName,"Unknown event type");

View File

@@ -24,8 +24,8 @@
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<AutorunEnabled>true</AutorunEnabled> <AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>2</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>0.2.1.%2a</ApplicationVersion> <ApplicationVersion>0.3.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
@@ -48,6 +48,8 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>perun_logo.ico</ApplicationIcon> <ApplicationIcon>perun_logo.ico</ApplicationIcon>
@@ -65,6 +67,15 @@
<PropertyGroup> <PropertyGroup>
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Google.Protobuf, Version=3.5.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <Reference Include="Google.Protobuf, Version=3.5.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.5.1\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.5.1\lib\net45\Google.Protobuf.dll</HintPath>
@@ -118,6 +129,7 @@
</Compile> </Compile>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Perun_v1_TemporaryKey.pfx" /> <None Include="Perun_v1_TemporaryKey.pfx" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
// przy użyciu symbolu „*”, tak jak pokazano poniżej: // przy użyciu symbolu „*”, tak jak pokazano poniżej:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")] [assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: NeutralResourcesLanguage("en")] [assembly: NeutralResourcesLanguage("en")]

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- Opcje manifestu Kontroli konta użytkownika
Jeśli chcesz zmienić poziom Kontroli konta użytkownika systemu Windows, zastąp
węzeł requestedExecutionLevel jednym z następujących.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Określenie elementu requestedExecutionLevel spowoduje wyłączenie wirtualizacji plików i rejestru.
Usuń ten element, jeśli aplikacja wymaga wirtualizacji w celu zachowania
zgodności z poprzednimi wersjami.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Lista wersji systemu Windows, na których ta aplikacja została przetestowana
i dla których została zaprojektowana. Odkomentuj odpowiednie elementy, a system Windows
automatycznie wybierze najbardziej zgodne środowisko. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Wskazuje, że aplikacja rozpoznaje wartości DPI i nie będzie automatycznie skalowana przez system Windows przy dużych
wartościach DPI. Aplikacje korzystające z technologii Windows Presentation Foundation (WPF) automatycznie rozpoznają wartości DPI i nie potrzebują
tej opcji. Aplikacje korzystające z technologii Windows Forms przeznaczone dla platformy .NET Framework 4.6, które korzystają z tej opcji, powinny
ustawić także wartość „true” dla parametru „EnableWindowsFormsHighDpiAutoResizing” w pliku app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Włącz motywy dla typowych formantów systemu Windows i okien dialogowych (system Windows XP i nowsze) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@@ -9,6 +9,7 @@ using System.Windows.Forms;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Perun_v1 namespace Perun_v1
{ {
@@ -204,6 +205,20 @@ namespace Perun_v1
con_txt_3rd_srs.Enabled = false; con_txt_3rd_srs.Enabled = false;
con_check_3rd_lotatc.Enabled = false; con_check_3rd_lotatc.Enabled = false;
con_check_3rd_srs.Enabled = false; con_check_3rd_srs.Enabled = false;
// Save settings
Properties.Settings.Default.MYSQL_Server = con_txt_mysql_database.Text;
Properties.Settings.Default.MYSQL_DB = con_txt_mysql_database.Text;
Properties.Settings.Default.MYSQL_User = con_txt_mysql_username.Text;
Properties.Settings.Default.MYSQL_Password = con_txt_mysql_password.Text;
Properties.Settings.Default.MYSQL_Port = con_txt_mysql_port.Text;
Properties.Settings.Default.MYSQL_Server = con_txt_mysql_server.Text;
Properties.Settings.Default.MYSQL_Port = con_txt_mysql_port.Text;
Properties.Settings.Default.OTHER_LOTATC_FILE = con_txt_3rd_lotatc.Text;
Properties.Settings.Default.OTHER_SRS_FILE = con_txt_3rd_srs.Text;
Properties.Settings.Default.OTHER_LOTATC_USE = con_check_3rd_lotatc.Checked;
Properties.Settings.Default.OTHER_SRS_USE = con_check_3rd_srs.Checked;
// Prepare connection string // Prepare connection string
MySql_connStr = "server="+con_txt_mysql_server.Text+";user="+con_txt_mysql_username.Text+";database="+con_txt_mysql_database.Text+";port="+ con_txt_mysql_port.Text + ";password="+con_txt_mysql_password.Text; MySql_connStr = "server="+con_txt_mysql_server.Text+";user="+con_txt_mysql_username.Text+";database="+con_txt_mysql_database.Text+";port="+ con_txt_mysql_port.Text + ";password="+con_txt_mysql_password.Text;
@@ -360,22 +375,53 @@ namespace Perun_v1
bool SRSdefault = true; bool SRSdefault = true;
bool LotATCdefault = true; bool LotATCdefault = true;
// Handle SRS
if (con_check_3rd_srs.Checked) if (con_check_3rd_srs.Checked)
{ {
try try
{ {
strSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text); strSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
JsonConvert.DeserializeObject(strSRSJson); dynamic raw_lotatc = JsonConvert.DeserializeObject(strSRSJson);
LogHistoryAdd(ref LogHistory, "SRS data loaded"); for (int i = 0; i < raw_lotatc.Count; i++)
{
int temp = raw_lotatc[i].RadioInfo.radios.Count - 1;
for (int j = temp; j >= 0; j--)
{
raw_lotatc[i].RadioInfo.radios[j].enc.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].encKey.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].encMode.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].freqMax.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].freqMin.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].modulation.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].freqMode.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].volMode.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].expansion.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].channel.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].simul.Parent.Remove();
if (raw_lotatc[i].RadioInfo.radios[j].name == "No Radio")
{
raw_lotatc[i].RadioInfo.radios[j].Remove();
}
}
raw_lotatc[i].ClientChannelId.Parent.Remove();
raw_lotatc[i].RadioInfo.simultaneousTransmission.Parent.Remove();
}
strSRSJson = JsonConvert.SerializeObject(raw_lotatc);
strSRSJson = "{'type':'100','payload':'" + strSRSJson + "'}"; strSRSJson = "{'type':'100','payload':'" + strSRSJson + "'}";
SRSdefault = false; SRSdefault = false;
LogHistoryAdd(ref LogHistory, "SRS data loaded");
} }
catch catch
{ {
LogHistoryAdd(ref LogHistory, "SRS data ERROR");
} }
} }
if(SRSdefault) if(SRSdefault)
{ {
@@ -383,20 +429,24 @@ namespace Perun_v1
} }
SendToMySql(strSRSJson); SendToMySql(strSRSJson);
// Handle LotATC
if (con_check_3rd_lotatc.Checked) if (con_check_3rd_lotatc.Checked)
{ {
try try
{ {
strLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text); strLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text);
JsonConvert.DeserializeObject(strLotATCJson); dynamic raw_srs = JsonConvert.DeserializeObject(strLotATCJson);
LogHistoryAdd(ref LogHistory, "LotATC data loaded");
strLotATCJson = "{'type':'101','payload':'" + strLotATCJson + "'}"; strLotATCJson = "{'type':'101','payload':'" + strLotATCJson + "'}";
LotATCdefault = false;
LogHistoryAdd(ref LogHistory, "LotATC data loaded");
} }
catch catch
{ {
LogHistoryAdd(ref LogHistory, "LotATC data ERROR");
} }
} }
if (LotATCdefault) if (LotATCdefault)