Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a807834d2 | ||
|
|
e1cfdba2cc | ||
|
|
9770c26b93 | ||
|
|
a0c9a249f6 | ||
|
|
53aade262e | ||
|
|
a78ad87312 | ||
|
|
ab86b3bcec | ||
|
|
b8087f6333 | ||
|
|
83ce2bd490 | ||
|
|
1f110321b4 | ||
|
|
efc215f58a | ||
|
|
4e1456e432 | ||
|
|
5908f8f332 | ||
|
|
5889bc6ddf | ||
|
|
2084d88117 | ||
|
|
49495ba9c4 | ||
|
|
1a73404c4c | ||
|
|
c66daec294 | ||
|
|
38853937be | ||
|
|
488d4dfcac | ||
|
|
fb96745ede | ||
|
|
9d06065d70 | ||
|
|
464261f09f | ||
|
|
9123619ad1 | ||
|
|
cabd8d28bb | ||
|
|
67eda5d79b |
@@ -20,7 +20,7 @@ Perun.MOTD_L2 = "Wymagamy obecnosci DCS SRS oraz TeamSpeak - szczegoly na forum"
|
|||||||
|
|
||||||
|
|
||||||
-- Variable init
|
-- Variable init
|
||||||
Perun.Version = "v0.8.2"
|
Perun.Version = "v0.8.3"
|
||||||
Perun.StatusData = {}
|
Perun.StatusData = {}
|
||||||
Perun.SlotsData = {}
|
Perun.SlotsData = {}
|
||||||
Perun.MissionData = {}
|
Perun.MissionData = {}
|
||||||
@@ -189,10 +189,10 @@ Perun.ConnectToPerun = function ()
|
|||||||
|
|
||||||
_, err = Perun.TCP:connect(Perun.TCPPerunHost, Perun.TCPTargetPort)
|
_, err = Perun.TCP:connect(Perun.TCPPerunHost, Perun.TCPTargetPort)
|
||||||
if err then
|
if err then
|
||||||
Perun.AddLog("TCP connection error : " .. err)
|
Perun.AddLog("ERROR - TCP connection error : " .. err)
|
||||||
else
|
else
|
||||||
Perun.AddLog("Connected to TCP server")
|
Perun.AddLog("Sucess - connected to TCP server")
|
||||||
Perun.TCP:setoption("keepalive")
|
-- Perun.TCP:setoption("keepalive")
|
||||||
Perun.lastReconnect = _now
|
Perun.lastReconnect = _now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -207,10 +207,9 @@ Perun.SendToPerun = function(data_id, data_package)
|
|||||||
TempData["instance"]=Perun.Instance
|
TempData["instance"]=Perun.Instance
|
||||||
|
|
||||||
temp=net.lua2json(TempData)
|
temp=net.lua2json(TempData)
|
||||||
temp=stripChars(temp)
|
temp="<SOT>" .. stripChars(temp) .. "<EOT>"
|
||||||
|
|
||||||
-- TCP Part - sending
|
-- TCP Part - sending
|
||||||
Perun.AddLog("Sending packet: " .. data_id)
|
|
||||||
intStatus = nil
|
intStatus = nil
|
||||||
intTries =0
|
intTries =0
|
||||||
err=nil
|
err=nil
|
||||||
@@ -226,7 +225,7 @@ Perun.SendToPerun = function(data_id, data_package)
|
|||||||
err = nil
|
err = nil
|
||||||
end
|
end
|
||||||
if err then
|
if err then
|
||||||
Perun.AddLog("Packed dropped : " .. data_id)
|
Perun.AddLog("ERROR - packed dropped : " .. data_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -314,7 +313,7 @@ Perun.LogChat = function(playerID,msg,all)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent = function(log_type,log_content,log_arg_1,log_arg_2)
|
Perun.LogEvent = function(log_type,log_content,log_arg_1,log_arg_2)
|
||||||
-- Logs chat messages
|
-- Logs events messages
|
||||||
|
|
||||||
data={}
|
data={}
|
||||||
data['log_type']= log_type
|
data['log_type']= log_type
|
||||||
@@ -465,6 +464,7 @@ Perun.LogStats = function(playerID)
|
|||||||
data['stat_data_perun']=_temp
|
data['stat_data_perun']=_temp
|
||||||
data['stat_data_type']=_temp['ps_type'];
|
data['stat_data_type']=_temp['ps_type'];
|
||||||
data['stat_ucid']=net.get_player_info(playerID, 'ucid')
|
data['stat_ucid']=net.get_player_info(playerID, 'ucid')
|
||||||
|
data['stat_name']=net.get_player_info(playerID, 'name')
|
||||||
data['stat_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
data['stat_datetime']=os.date('%Y-%m-%d %H:%M:%S')
|
||||||
data['stat_missionhash']=Perun.MissionHash
|
data['stat_missionhash']=Perun.MissionHash
|
||||||
|
|
||||||
@@ -483,6 +483,47 @@ Perun.LogLogin = function(playerID)
|
|||||||
Perun.SendToPerun(53,data)
|
Perun.SendToPerun(53,data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Perun.CheckMulticrew = function (owner_playerID,owner_unittype)
|
||||||
|
-- Check multicrew and return list of co-player
|
||||||
|
|
||||||
|
_coplayers = {}
|
||||||
|
table.insert(_coplayers, owner_playerID)
|
||||||
|
if owner_unittype == "F-14B" or owner_unittype == "Yak-52" or owner_unittype == "L-39C" or owner_unittype == "SA342M" or owner_unittype =="SA342Minigun" or owner_unittype == "SA342Mistral" or owner_unittype == "SA342L" then -- TBD add additional multicrew model types
|
||||||
|
|
||||||
|
_owner_slot=net.get_player_info(owner_playerID, 'slot')
|
||||||
|
_owner_side=net.get_player_info(owner_playerID, 'side')
|
||||||
|
|
||||||
|
-- Check if we are co-player
|
||||||
|
_t_start, _t_end = string.find(_owner_slot, '_%d+')
|
||||||
|
_sub_slot = nil
|
||||||
|
if _t_start then
|
||||||
|
-- This is co-player
|
||||||
|
_master_slot = string.sub(_owner_slot, 0 , _t_start -1 )
|
||||||
|
_sub_slot = string.sub(_owner_slot, _t_start + 1, _t_end )
|
||||||
|
else
|
||||||
|
_master_slot = _owner_slot
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if _master_slot ~= "" then
|
||||||
|
-- Search for all players to account for event
|
||||||
|
_all_players = net.get_player_list()
|
||||||
|
for PlayerIDIndex, playerID in ipairs(_all_players) do
|
||||||
|
local _playerDetails = net.get_player_info( playerID )
|
||||||
|
|
||||||
|
if _playerDetails.side == _owner_side and (_playerDetails.slot == _master_slot or _playerDetails.slot == _master_slot .. "_1" or _playerDetails.slot == _master_slot .. "_2") and playerID ~= owner_playerID then
|
||||||
|
-- Let's build coplayers list
|
||||||
|
table.insert(_coplayers, playerID)
|
||||||
|
else
|
||||||
|
-- No coplayers
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return _coplayers
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- ########### Event callbacks ###########
|
--- ########### Event callbacks ###########
|
||||||
|
|
||||||
Perun.onSimulationStart = function()
|
Perun.onSimulationStart = function()
|
||||||
@@ -527,7 +568,7 @@ Perun.onSimulationFrame = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Send keepalive
|
-- Send keepalive
|
||||||
if _now > Perun.lastSentKeepAlive + 5 then
|
if _now > Perun.lastSentKeepAlive + 3 then
|
||||||
Perun.lastSentKeepAlive = _now
|
Perun.lastSentKeepAlive = _now
|
||||||
Perun.SendToPerun(0,nil)
|
Perun.SendToPerun(0,nil)
|
||||||
end
|
end
|
||||||
@@ -554,10 +595,6 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name").." killed friendy " .. net.get_player_info(arg3, "name") .. " using " .. arg2,nil,nil);
|
Perun.LogEvent(eventName,Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name").." killed friendy " .. net.get_player_info(arg3, "name") .. " using " .. arg2,nil,nil);
|
||||||
|
|
||||||
if arg1 ~= arg3 then
|
|
||||||
-- Perun.LogStatsCount(arg1,"friendly_fire",DCS.getUnitType(net.get_player_info(arg1 , 'slot')))
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif eventName == "mission_end" then
|
elseif eventName == "mission_end" then
|
||||||
--"mission_end", winner, msg
|
--"mission_end", winner, msg
|
||||||
@@ -576,31 +613,41 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
|
|
||||||
if net.get_player_info(arg1, "name") ~= nil then
|
if net.get_player_info(arg1, "name") ~= nil then
|
||||||
_temp2 = " player ".. net.get_player_info(arg1, "name") .." ";
|
_temp2 = " player ".. net.get_player_info(arg1, "name") .." ";
|
||||||
if Perun.GetCategory(arg5) == "Planes" then
|
|
||||||
Perun.LogStatsCount(arg1,"kill_Planes",arg2)
|
_temp_event_type=""
|
||||||
elseif Perun.GetCategory(arg5) == "Helicopters" then
|
if arg3 ~= arg6 then
|
||||||
Perun.LogStatsCount(arg1,"kill_Helicopters",arg2)
|
if Perun.GetCategory(arg5) == "Planes" then
|
||||||
elseif Perun.GetCategory(arg5) == "Ships" then
|
_temp_event_type="kill_Planes"
|
||||||
Perun.LogStatsCount(arg1,"kill_Ships",arg2)
|
elseif Perun.GetCategory(arg5) == "Helicopters" then
|
||||||
elseif Perun.GetCategory(arg5) == "Air Defence" then
|
_temp_event_type="kill_Helicopters"
|
||||||
Perun.LogStatsCount(arg1,"kill_Air_Defence",arg2)
|
elseif Perun.GetCategory(arg5) == "Ships" then
|
||||||
elseif Perun.GetCategory(arg5) == "Unarmed" then
|
_temp_event_type="kill_Ships"
|
||||||
Perun.LogStatsCount(arg1,"kill_Unarmed",arg2)
|
elseif Perun.GetCategory(arg5) == "Air Defence" then
|
||||||
elseif Perun.GetCategory(arg5) == "Armor" then
|
_temp_event_type="kill_Air_Defence"
|
||||||
Perun.LogStatsCount(arg1,"kill_Armor",arg2)
|
elseif Perun.GetCategory(arg5) == "Unarmed" then
|
||||||
elseif Perun.GetCategory(arg5) == "Infantry" then
|
_temp_event_type="kill_Unarmed"
|
||||||
Perun.LogStatsCount(arg1,"kill_Infantry",arg2)
|
elseif Perun.GetCategory(arg5) == "Armor" then
|
||||||
elseif Perun.GetCategory(arg5) == "Fortification" then
|
_temp_event_type="kill_Armor"
|
||||||
Perun.LogStatsCount(arg1,"kill_Fortification",arg2)
|
elseif Perun.GetCategory(arg5) == "Infantry" then
|
||||||
else
|
_temp_event_type="kill_Infantry"
|
||||||
Perun.LogStatsCount(arg1,"kill_Other",arg2)
|
elseif Perun.GetCategory(arg5) == "Fortification" then
|
||||||
end
|
_temp_event_type="kill_Fortification"
|
||||||
if net.get_player_info(arg4, "name") ~= nil and arg3 ~= arg6 then
|
else
|
||||||
Perun.LogStatsCount(arg1,"kill_PvP",arg2)
|
_temp_event_type="kill_Other"
|
||||||
|
end
|
||||||
|
if net.get_player_info(arg4, "name") ~= nil and arg3 ~= arg6 then
|
||||||
|
pilots_accounted = Perun.CheckMulticrew(arg1,arg2)
|
||||||
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,"kill_PvP",DCS.getUnitType(arg2));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_temp_event_type="friendly_fire"
|
||||||
end
|
end
|
||||||
|
|
||||||
if arg3 == arg6 then
|
pilots_accounted = Perun.CheckMulticrew(arg1,arg2)
|
||||||
Perun.LogStatsCount(arg1,"friendly_fire",arg2)
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,_temp_event_type,DCS.getUnitType(arg2));
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -642,12 +689,20 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
elseif eventName == "crash" then
|
elseif eventName == "crash" then
|
||||||
--"crash", playerID, unit_missionID
|
--"crash", playerID, unit_missionID
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " crashed in " .. DCS.getUnitType(arg2),nil,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " crashed in " .. DCS.getUnitType(arg2),nil,nil);
|
||||||
Perun.LogStatsCount(arg1,"crash",DCS.getUnitType(arg2))
|
|
||||||
|
pilots_accounted = Perun.CheckMulticrew(arg1,DCS.getUnitType(arg2))
|
||||||
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,"crash",DCS.getUnitType(arg2));
|
||||||
|
end
|
||||||
elseif eventName == "eject" then
|
elseif eventName == "eject" then
|
||||||
--"eject", playerID, unit_missionID
|
--"eject", playerID, unit_missionID
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " ejected " .. DCS.getUnitType(arg2),nil,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " ejected " .. DCS.getUnitType(arg2),nil,nil);
|
||||||
Perun.LogStatsCount(arg1,"eject",DCS.getUnitType(arg2));
|
|
||||||
|
pilots_accounted = Perun.CheckMulticrew(arg1,DCS.getUnitType(arg2))
|
||||||
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,"eject",DCS.getUnitType(arg2));
|
||||||
|
end
|
||||||
|
|
||||||
elseif eventName == "takeoff" then
|
elseif eventName == "takeoff" then
|
||||||
--"takeoff", playerID, unit_missionID, airdromeName
|
--"takeoff", playerID, unit_missionID, airdromeName
|
||||||
if arg3 ~= "" then
|
if arg3 ~= "" then
|
||||||
@@ -658,14 +713,20 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
|
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " took off in ".. DCS.getUnitType(arg2) .. _temp,arg3,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " took off in ".. DCS.getUnitType(arg2) .. _temp,arg3,nil);
|
||||||
|
|
||||||
|
_type = ""
|
||||||
if string.find(arg3, "FARP",1,true) then
|
if string.find(arg3, "FARP",1,true) then
|
||||||
Perun.LogStatsCount(arg1,"tookoff_FARP",DCS.getUnitType(arg2))
|
_type="tookoff_FARP"
|
||||||
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) then
|
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) then
|
||||||
Perun.LogStatsCount(arg1,"tookoff_SHIP",DCS.getUnitType(arg2))
|
_type="tookoff_SHIP"
|
||||||
elseif arg3 ~= "" then
|
elseif arg3 ~= "" then
|
||||||
Perun.LogStatsCount(arg1,"tookoff_AIRFIELD",DCS.getUnitType(arg2))
|
_type="tookoff_AIRFIELD"
|
||||||
else
|
else
|
||||||
Perun.LogStatsCount(arg1,"tookoff_OTHER",DCS.getUnitType(arg2))
|
_type="tookoff_OTHER"
|
||||||
|
end
|
||||||
|
|
||||||
|
pilots_accounted = Perun.CheckMulticrew(arg1,DCS.getUnitType(arg2))
|
||||||
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,_type,DCS.getUnitType(arg2))
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif eventName == "landing" then
|
elseif eventName == "landing" then
|
||||||
@@ -678,20 +739,31 @@ Perun.onGameEvent = function (eventName,arg1,arg2,arg3,arg4,arg5,arg6,arg7)
|
|||||||
|
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " landed in " .. DCS.getUnitType(arg2).. _temp,arg3,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " landed in " .. DCS.getUnitType(arg2).. _temp,arg3,nil);
|
||||||
|
|
||||||
|
_type = ""
|
||||||
if string.find(arg3, "FARP",1,true) then
|
if string.find(arg3, "FARP",1,true) then
|
||||||
Perun.LogStatsCount(arg1,"landing_FARP",DCS.getUnitType(arg2))
|
_type = "landing_FARP"
|
||||||
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) then
|
elseif string.find(arg3, "CVN-74 John C. Stennis",1,true) or string.find(arg3, "LHA-1 Tarawa",1,true) then
|
||||||
Perun.LogStatsCount(arg1,"landing_SHIP",DCS.getUnitType(arg2))
|
_type = "landing_SHIP"
|
||||||
elseif arg3 ~= "" then
|
elseif arg3 ~= "" then
|
||||||
Perun.LogStatsCount(arg1,"landing_AIRFIELD",DCS.getUnitType(arg2))
|
_type = "landing_AIRFIELD"
|
||||||
else
|
else
|
||||||
Perun.LogStatsCount(arg1,"landing_OTHER",DCS.getUnitType(arg2))
|
_type = "landing_OTHER"
|
||||||
|
end
|
||||||
|
|
||||||
|
pilots_accounted = Perun.CheckMulticrew(arg1,DCS.getUnitType(arg2))
|
||||||
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,_type,DCS.getUnitType(arg2))
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif eventName == "pilot_death" then
|
elseif eventName == "pilot_death" then
|
||||||
--"pilot_death", playerID, unit_missionID
|
--"pilot_death", playerID, unit_missionID
|
||||||
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " in " .. DCS.getUnitType(arg2) .. " died",nil,nil);
|
Perun.LogEvent(eventName, Perun.SideID2Name( net.get_player_info(arg1, "side")) .. " player " .. net.get_player_info(arg1, "name") .. " in " .. DCS.getUnitType(arg2) .. " died",nil,nil);
|
||||||
Perun.LogStatsCount(arg1,"pilot_death",DCS.getUnitType(arg2))
|
|
||||||
|
pilots_accounted = Perun.CheckMulticrew(arg1,DCS.getUnitType(arg2))
|
||||||
|
for _, pilotID in ipairs(pilots_accounted) do
|
||||||
|
Perun.LogStatsCount(pilotID,"pilot_death",DCS.getUnitType(arg2))
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
Perun.LogEvent(eventName,"Unknown event type",nil,nil);
|
Perun.LogEvent(eventName,"Unknown event type",nil,nil);
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,141 +5,205 @@ using System;
|
|||||||
|
|
||||||
public class DatabaseController
|
public class DatabaseController
|
||||||
{
|
{
|
||||||
public string strMySQLConnectionString; // MySQL connection string
|
public string DatabaseConnectionString; // MySQL connection string
|
||||||
public MySqlConnection connMySQL;
|
public MySqlConnection DatabaseConnection;
|
||||||
public bool bStatus;
|
public bool DatabaseStatus;
|
||||||
|
|
||||||
public void SendToMySql(string strRawUDPFrame)
|
public int SendToMySql(string RawTCPFrame, bool CheckConnection = false)
|
||||||
{
|
{
|
||||||
// Main function to send data to mysql
|
// Main function to send data to mysql
|
||||||
dynamic strUDPFrame = JsonConvert.DeserializeObject(strRawUDPFrame); // Deserialize raw data
|
if (CheckConnection)
|
||||||
string strUDPFrameType = strUDPFrame.type;
|
{
|
||||||
string strUDPFrameTimestamp = strUDPFrame.timestamp;
|
RawTCPFrame = "{\"type\": \"-1\"}";
|
||||||
string strUDPFrameInstance = strUDPFrame.instance;
|
}
|
||||||
string strUDPFramePayload;
|
dynamic TCPFrame = JsonConvert.DeserializeObject(RawTCPFrame); // Deserialize raw data
|
||||||
string strUDPFramePayload_Perun;
|
string TCPFrameType = TCPFrame.type;
|
||||||
string strSQLQueryTxt;
|
string TCPFrameTimestamp = TCPFrame.timestamp;
|
||||||
|
string TCPFrameInstance = TCPFrame.instance;
|
||||||
|
string TCPFramePayload;
|
||||||
|
string TCPFramePayload_Perun;
|
||||||
|
string SQLQueryTxt;
|
||||||
|
int ReturnValue = 1;
|
||||||
|
|
||||||
// Some frames may come without timestamp, use database currrent timestampe then
|
// Some frames may come without timestamp, use database currrent timestampe then
|
||||||
if (strUDPFrameTimestamp != null)
|
if (TCPFrameTimestamp != null)
|
||||||
{
|
{
|
||||||
strUDPFrameTimestamp = "'" + strUDPFrameTimestamp + "'";
|
TCPFrameTimestamp = "'" + TCPFrameTimestamp + "'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strUDPFrameTimestamp = "CURRENT_TIMESTAMP()";
|
TCPFrameTimestamp = "CURRENT_TIMESTAMP()";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify specific types
|
// Modify specific types
|
||||||
if (strUDPFrameType == "1")
|
if (TCPFrameType == "1")
|
||||||
{
|
{
|
||||||
strUDPFrame.payload["v_win"] = "v" + Globals.strPerunVersion; // Inject app version information
|
TCPFrame.payload["v_win"] = "v" + Globals.VersionPerun; // Inject app version information
|
||||||
|
|
||||||
|
// Pull DCS hook version
|
||||||
|
Globals.VersionDCSHook = TCPFrame.payload.v_dcs_hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specific SQL per each frame type
|
// Specific SQL per each frame type
|
||||||
if (strUDPFrameType == "50")
|
if (TCPFrameType == "50")
|
||||||
{
|
{
|
||||||
// Add entry to chat log
|
// Add entry to chat log
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + strUDPFrame.payload.ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.ucid + "' );";
|
SQLQueryTxt = "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + TCPFrame.payload.ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + TCPFrame.payload.ucid + "' );";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated` = " + strUDPFrameTimestamp + ",`pe_DataPlayers_lastname`='" + strUDPFrame.payload.player + "' WHERE `pe_DataPlayers_ucid`='" + strUDPFrame.payload.ucid + "' ;";
|
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated` = " + TCPFrameTimestamp + ",`pe_DataPlayers_lastname`='" + TCPFrame.payload.player + "' WHERE `pe_DataPlayers_ucid`='" + TCPFrame.payload.ucid + "' ;";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` ='" + strUDPFrame.payload.missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
SQLQueryTxt += "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` ='" + TCPFrame.payload.missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + " ;";
|
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + " ;";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_LogChat` (`pe_LogChat_id`,`pe_LogChat_datetime`, `pe_LogChat_playerid`, `pe_LogChat_msg`, `pe_LogChat_all`,`pe_LogChat_missionhash_id`) VALUES (NULL,'" + strUDPFrame.payload.datetime + "', (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.ucid + "'), '" + strUDPFrame.payload.msg + "', '" + strUDPFrame.payload.all + "',(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.missionhash + "'));";
|
SQLQueryTxt += "INSERT INTO `pe_LogChat` (`pe_LogChat_id`,`pe_LogChat_datetime`, `pe_LogChat_playerid`, `pe_LogChat_msg`, `pe_LogChat_all`,`pe_LogChat_missionhash_id`) VALUES (NULL,'" + TCPFrame.payload.datetime + "', (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.ucid + "'), '" + TCPFrame.payload.msg + "', '" + TCPFrame.payload.all + "',(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.missionhash + "'));";
|
||||||
}
|
}
|
||||||
else if (strUDPFrameType == "51")
|
else if (TCPFrameType == "51")
|
||||||
{
|
{
|
||||||
// Add entry to event log
|
// Add entry to event log
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.log_missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
SQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.log_missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ";";
|
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ";";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_LogEvent` (`pe_LogEvent_arg1`,`pe_LogEvent_arg2`,`pe_LogEvent_id`, `pe_LogEvent_datetime`, `pe_LogEvent_type`, `pe_LogEvent_content`,`pe_LogEvent_missionhash_id`) VALUES ('" + strUDPFrame.payload.log_arg_1 + "','" + strUDPFrame.payload.log_arg_2 + "', NULL, '" + strUDPFrame.payload.log_datetime + "', '" + strUDPFrame.payload.log_type + "', '" + strUDPFrame.payload.log_content + "', (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.log_missionhash + "'));";
|
SQLQueryTxt += "INSERT INTO `pe_LogEvent` (`pe_LogEvent_arg1`,`pe_LogEvent_arg2`,`pe_LogEvent_id`, `pe_LogEvent_datetime`, `pe_LogEvent_type`, `pe_LogEvent_content`,`pe_LogEvent_missionhash_id`) VALUES ('" + TCPFrame.payload.log_arg_1 + "','" + TCPFrame.payload.log_arg_2 + "', NULL, '" + TCPFrame.payload.log_datetime + "', '" + TCPFrame.payload.log_type + "', '" + TCPFrame.payload.log_content + "', (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.log_missionhash + "'));";
|
||||||
}
|
}
|
||||||
else if (strUDPFrameType == "52")
|
else if (TCPFrameType == "52")
|
||||||
{
|
{
|
||||||
// Update user stats
|
// Update user stats
|
||||||
strUDPFramePayload = JsonConvert.SerializeObject(strUDPFrame.payload.stat_data_dcs); // Deserialize payload
|
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload.stat_data_dcs); // Deserialize payload
|
||||||
strUDPFramePayload_Perun = JsonConvert.SerializeObject(strUDPFrame.payload.stat_data_perun); // Deserialize payload
|
TCPFramePayload_Perun = JsonConvert.SerializeObject(TCPFrame.payload.stat_data_perun); // Deserialize payload
|
||||||
|
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + strUDPFrame.payload.stat_missionhash + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + ");";
|
SQLQueryTxt = "INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT '" + TCPFrame.payload.stat_missionhash + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + ");";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + strUDPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + strUDPFrameInstance + " ;";
|
SQLQueryTxt += "UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = " + TCPFrameTimestamp + " WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "' AND `pe_DataMissionHashes_instance`=" + TCPFrameInstance + " ;";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + strUDPFrame.payload.stat_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "');";
|
SQLQueryTxt += "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + TCPFrame.payload.stat_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "');";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated`=" + strUDPFrameTimestamp + " WHERE `pe_DataPlayers_ucid`='" + strUDPFrame.payload.stat_ucid + "';";
|
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET `pe_DataPlayers_updated`=" + TCPFrameTimestamp + " WHERE `pe_DataPlayers_ucid`='" + TCPFrame.payload.stat_ucid + "';";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_DataTypes` (`pe_DataTypes_name`) SELECT '" + strUDPFrame.payload.stat_data_type + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "');";
|
SQLQueryTxt += "INSERT INTO `pe_DataTypes` (`pe_DataTypes_name`) SELECT '" + TCPFrame.payload.stat_data_type + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "');";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_LogStats` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`,`pe_LogStats_typeid`) SELECT (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "'), (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "'), (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "') FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_LogStats` WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`= (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "'));";
|
SQLQueryTxt += "INSERT INTO `pe_LogStats` (`pe_LogStats_playerid`,`pe_LogStats_missionhash_id`,`pe_LogStats_typeid`) SELECT (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "'), (SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "'), (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "') FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_LogStats` WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`= (SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "'));";
|
||||||
strSQLQueryTxt += "UPDATE `pe_LogStats` SET `ps_kills_fortification`=" + strUDPFrame.payload.stat_data_perun.ps_kills_fortification + ",`ps_other_landings`=" + strUDPFrame.payload.stat_data_perun.ps_other_landings + ",`ps_other_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_other_takeoffs + ",`ps_pvp`=" + strUDPFrame.payload.stat_data_perun.ps_pvp + ",`ps_deaths`=" + strUDPFrame.payload.stat_data_perun.ps_deaths + ",`ps_ejections`=" + strUDPFrame.payload.stat_data_perun.ps_ejections + ",`ps_crashes`=" + strUDPFrame.payload.stat_data_perun.ps_crashes + ",`ps_teamkills`=" + strUDPFrame.payload.stat_data_perun.ps_teamkills + ",`ps_kills_planes`=" + strUDPFrame.payload.stat_data_perun.ps_kills_planes + ",`ps_kills_helicopters`=" + strUDPFrame.payload.stat_data_perun.ps_kills_helicopters + ",`ps_kills_air_defense`=" + strUDPFrame.payload.stat_data_perun.ps_kills_air_defense + ",`ps_kills_armor`=" + strUDPFrame.payload.stat_data_perun.ps_kills_armor + ",`ps_kills_unarmed`=" + strUDPFrame.payload.stat_data_perun.ps_kills_unarmed + ",`ps_kills_infantry`=" + strUDPFrame.payload.stat_data_perun.ps_kills_infantry + ",`ps_kills_ships`=" + strUDPFrame.payload.stat_data_perun.ps_kills_ships + ",`ps_kills_other`=" + strUDPFrame.payload.stat_data_perun.ps_kills_other + ",`ps_airfield_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_airfield_takeoffs + ",`ps_airfield_landings`=" + strUDPFrame.payload.stat_data_perun.ps_airfield_landings + ",`ps_ship_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_ship_takeoffs + ",`ps_ship_landings`=" + strUDPFrame.payload.stat_data_perun.ps_ship_landings + ",`ps_farp_takeoffs`=" + strUDPFrame.payload.stat_data_perun.ps_farp_takeoffs + ",`ps_farp_landings`=" + strUDPFrame.payload.stat_data_perun.ps_farp_landings + ", `pe_LogStats_datetime`='" + strUDPFrame.payload.stat_datetime + "',`pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "'),`pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + strUDPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + strUDPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`=(SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + strUDPFrame.payload.stat_data_type + "');";
|
SQLQueryTxt += "UPDATE `pe_LogStats` SET `ps_kills_fortification`=" + TCPFrame.payload.stat_data_perun.ps_kills_fortification + ",`ps_other_landings`=" + TCPFrame.payload.stat_data_perun.ps_other_landings + ",`ps_other_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_other_takeoffs + ",`ps_pvp`=" + TCPFrame.payload.stat_data_perun.ps_pvp + ",`ps_deaths`=" + TCPFrame.payload.stat_data_perun.ps_deaths + ",`ps_ejections`=" + TCPFrame.payload.stat_data_perun.ps_ejections + ",`ps_crashes`=" + TCPFrame.payload.stat_data_perun.ps_crashes + ",`ps_teamkills`=" + TCPFrame.payload.stat_data_perun.ps_teamkills + ",`ps_kills_planes`=" + TCPFrame.payload.stat_data_perun.ps_kills_planes + ",`ps_kills_helicopters`=" + TCPFrame.payload.stat_data_perun.ps_kills_helicopters + ",`ps_kills_air_defense`=" + TCPFrame.payload.stat_data_perun.ps_kills_air_defense + ",`ps_kills_armor`=" + TCPFrame.payload.stat_data_perun.ps_kills_armor + ",`ps_kills_unarmed`=" + TCPFrame.payload.stat_data_perun.ps_kills_unarmed + ",`ps_kills_infantry`=" + TCPFrame.payload.stat_data_perun.ps_kills_infantry + ",`ps_kills_ships`=" + TCPFrame.payload.stat_data_perun.ps_kills_ships + ",`ps_kills_other`=" + TCPFrame.payload.stat_data_perun.ps_kills_other + ",`ps_airfield_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_airfield_takeoffs + ",`ps_airfield_landings`=" + TCPFrame.payload.stat_data_perun.ps_airfield_landings + ",`ps_ship_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_ship_takeoffs + ",`ps_ship_landings`=" + TCPFrame.payload.stat_data_perun.ps_ship_landings + ",`ps_farp_takeoffs`=" + TCPFrame.payload.stat_data_perun.ps_farp_takeoffs + ",`ps_farp_landings`=" + TCPFrame.payload.stat_data_perun.ps_farp_landings + ", `pe_LogStats_datetime`='" + TCPFrame.payload.stat_datetime + "',`pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "'),`pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') WHERE `pe_LogStats_missionhash_id`=(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = '" + TCPFrame.payload.stat_missionhash + "') AND `pe_LogStats_playerid` = (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = '" + TCPFrame.payload.stat_ucid + "') AND `pe_LogStats_typeid`=(SELECT pe_DataTypes_id FROM `pe_DataTypes` where `pe_DataTypes_name` = '" + TCPFrame.payload.stat_data_type + "');";
|
||||||
}
|
}
|
||||||
else if (strUDPFrameType == "53")
|
else if (TCPFrameType == "53")
|
||||||
{
|
{
|
||||||
// User logged in to DCS server
|
// User logged in to DCS server
|
||||||
|
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + strUDPFrame.payload.login_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where pe_DataPlayers_ucid='" + strUDPFrame.payload.login_ucid + "');";
|
SQLQueryTxt = "INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT '" + TCPFrame.payload.login_ucid + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where pe_DataPlayers_ucid='" + TCPFrame.payload.login_ucid + "');";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataPlayers` SET pe_DataPlayers_lastip='" + strUDPFrame.payload.login_ipaddr + "', pe_DataPlayers_lastname='" + strUDPFrame.payload.login_name + "',pe_DataPlayers_updated='" + strUDPFrame.payload.login_datetime + "' WHERE `pe_DataPlayers_ucid`= '" + strUDPFrame.payload.login_ucid + "';";
|
SQLQueryTxt += "UPDATE `pe_DataPlayers` SET pe_DataPlayers_lastip='" + TCPFrame.payload.login_ipaddr + "', pe_DataPlayers_lastname='" + TCPFrame.payload.login_name + "',pe_DataPlayers_updated='" + TCPFrame.payload.login_datetime + "' WHERE `pe_DataPlayers_ucid`= '" + TCPFrame.payload.login_ucid + "';";
|
||||||
strSQLQueryTxt += "INSERT INTO `pe_LogLogins` (`pe_LogLogins_datetime`, `pe_LogLogins_playerid`, `pe_LogLogins_name`, `pe_LogLogins_ip`,`pe_LogLogins_instance`) VALUES ('" + strUDPFrame.payload.login_datetime + "', (SELECT pe_DataPlayers_id from pe_DataPlayers WHERE pe_DataPlayers_ucid = '" + strUDPFrame.payload.login_ucid + "'), '" + strUDPFrame.payload.login_name + "', '" + strUDPFrame.payload.login_ipaddr + "','" + strUDPFrameInstance + "');";
|
SQLQueryTxt += "INSERT INTO `pe_LogLogins` (`pe_LogLogins_datetime`, `pe_LogLogins_playerid`, `pe_LogLogins_name`, `pe_LogLogins_ip`,`pe_LogLogins_instance`) VALUES ('" + TCPFrame.payload.login_datetime + "', (SELECT pe_DataPlayers_id from pe_DataPlayers WHERE pe_DataPlayers_ucid = '" + TCPFrame.payload.login_ucid + "'), '" + TCPFrame.payload.login_name + "', '" + TCPFrame.payload.login_ipaddr + "','" + TCPFrameInstance + "');";
|
||||||
|
}
|
||||||
|
else if (TCPFrameType == "-1")
|
||||||
|
{
|
||||||
|
// Keep alive message
|
||||||
|
SQLQueryTxt = "SELECT `pe_Config_payload` FROM `pe_Config` WHERE `pe_Config_id` = 1;";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// General definition used for 1-10 type packets
|
// General definition used for 1-10 type packets
|
||||||
strUDPFramePayload = JsonConvert.SerializeObject(strUDPFrame.payload); // Deserialize payload
|
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
|
||||||
|
|
||||||
strSQLQueryTxt = "INSERT INTO `pe_DataRaw` (`pe_dataraw_type`,`pe_dataraw_instance`) SELECT '" + strUDPFrameType + "','" + strUDPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataRaw` WHERE `pe_dataraw_type` = '" + strUDPFrameType + "' AND `pe_dataraw_instance` = " + strUDPFrameInstance + ");";
|
SQLQueryTxt = "INSERT INTO `pe_DataRaw` (`pe_dataraw_type`,`pe_dataraw_instance`) SELECT '" + TCPFrameType + "','" + TCPFrameInstance + "' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataRaw` WHERE `pe_dataraw_type` = '" + TCPFrameType + "' AND `pe_dataraw_instance` = " + TCPFrameInstance + ");";
|
||||||
strSQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = JSON_QUOTE('" + strUDPFramePayload + "'), `pe_dataraw_updated`=" + strUDPFrameTimestamp + " WHERE `pe_dataraw_type`=" + strUDPFrameType + " AND `pe_dataraw_instance` = " + strUDPFrameInstance + ";";
|
SQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = JSON_QUOTE('" + TCPFramePayload + "'), `pe_dataraw_updated`=" + TCPFrameTimestamp + " WHERE `pe_dataraw_type`=" + TCPFrameType + " AND `pe_dataraw_instance` = " + TCPFrameInstance + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to mysql and execute sql
|
// Connect to mysql and execute sql
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connMySQL = new MySqlConnection(strMySQLConnectionString);
|
DatabaseConnection = new MySqlConnection(DatabaseConnectionString);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("Sending data to MySQL - Begin");
|
Console.WriteLine("Sending data to MySQL - Begin");
|
||||||
connMySQL.Open();
|
DatabaseConnection.Open();
|
||||||
bStatus = true;
|
DatabaseStatus = true;
|
||||||
MySqlCommand cmdMySQL = new MySqlCommand(strSQLQueryTxt, connMySQL);
|
MySqlCommand DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
|
||||||
MySqlDataReader rdrMySQL = cmdMySQL.ExecuteReader();
|
MySqlDataReader DatabaseReader = DatabaseCommand.ExecuteReader();
|
||||||
|
|
||||||
while (rdrMySQL.Read())
|
if (DatabaseReader.HasRows)
|
||||||
{
|
{
|
||||||
Console.WriteLine(rdrMySQL[0] + " -- " + rdrMySQL[1]);
|
while (DatabaseReader.Read())
|
||||||
|
{
|
||||||
|
if (TCPFrameType == "-1")
|
||||||
|
{
|
||||||
|
Globals.VersionDatabase= DatabaseReader.GetString(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rdrMySQL.Close();
|
else
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > MySQL updated, package type: " + strUDPFrameType);
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
DatabaseReader.Close();
|
||||||
|
|
||||||
|
switch (Int32.Parse(TCPFrameType))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Connected players: " + TCPFrame.payload["c_players"], 1,0,"1");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Mission: \"" + TCPFrame.payload["mission"]["name"]+"\""+ ", time:" + TCPFrame.payload["mission"]["modeltime"], 1, 0, "2");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Slots data updated", 1, 0, "3");
|
||||||
|
break;
|
||||||
|
case 50:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Player's \""+ TCPFrame.payload.player + "\" chat message saved", 1, 0, "50");
|
||||||
|
break;
|
||||||
|
case 51:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Game event: \""+ TCPFrame.payload.log_content +"\"", 1, 0, "51");
|
||||||
|
break;
|
||||||
|
case 52:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Player's \""+ TCPFrame.payload.stat_name + "\" stats saved", 1, 0, "52");
|
||||||
|
break;
|
||||||
|
case 53:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Player \""+ TCPFrame.payload.login_name + "\" logged in", 1, 0, "53");
|
||||||
|
break;
|
||||||
|
case 100:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data send", 1,0,"100");
|
||||||
|
break;
|
||||||
|
case 101:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "LotATC data send", 1,0,"101");
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Data send", 1,0, TCPFrameType);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (ArgumentException a_ex)
|
catch (ArgumentException a_ex)
|
||||||
{
|
{
|
||||||
// General exception found
|
// General exception found
|
||||||
Console.WriteLine(a_ex.ToString());
|
Console.WriteLine(a_ex.ToString());
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL - package type: " + strUDPFrameType);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - error: " + a_ex.Message,1,1, TCPFrameType);
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL >" + a_ex.Message);
|
Globals.ErrorsGame++;
|
||||||
bStatus = false;
|
DatabaseStatus = false;
|
||||||
|
ReturnValue = 0;
|
||||||
}
|
}
|
||||||
catch (MySqlException m_ex)
|
catch (MySqlException m_ex)
|
||||||
{
|
{
|
||||||
// MySQL exception found
|
// MySQL exception found
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL - package type: " + strUDPFrameType);
|
|
||||||
switch (m_ex.Number)
|
switch (m_ex.Number)
|
||||||
{
|
{
|
||||||
case 1042: // Unable to connect to any of the specified MySQL hosts (Check Server,Port)
|
case 1042: // Unable to connect to any of the specified MySQL hosts (Check Server,Port)
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL - unable to connect >" + m_ex.Message);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - unable to connect, error: " + m_ex.Message,1,1, TCPFrameType);
|
||||||
break;
|
break;
|
||||||
case 0: // Access denied (Check DB name,username,password)
|
case 0: // Access denied (Check DB name,username,password)
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL - access denied > " + m_ex.Message);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - access denied, error: " + m_ex.Message,1,1, TCPFrameType);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL > " + m_ex.Number);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - error id: " + m_ex.Number,1,1, TCPFrameType);
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL > " + m_ex.Message);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - query: " + SQLQueryTxt, 1, 1, TCPFrameType);
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - error: " + m_ex.Message,1,1, TCPFrameType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bStatus = false;
|
Globals.ErrorsGame++;
|
||||||
|
DatabaseStatus = false;
|
||||||
|
ReturnValue = 0;
|
||||||
}
|
}
|
||||||
connMySQL.Close();
|
DatabaseConnection.Close();
|
||||||
Console.WriteLine("Sending data to MySQL - Done");
|
Console.WriteLine("Sending data to MySQL - Done");
|
||||||
}
|
}
|
||||||
catch (ArgumentException x_ex)
|
catch (ArgumentException x_ex)
|
||||||
{
|
{
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + strUDPFrameInstance + " > ERROR MySQL - unable to connect > " + x_ex.Message);
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR MySQL - unable to connect, error: " + x_ex.Message,1,1, TCPFrameType);
|
||||||
|
ReturnValue = 0;
|
||||||
|
Globals.ErrorsGame++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,25 @@
|
|||||||
|
|
||||||
internal class Globals
|
internal class Globals
|
||||||
{
|
{
|
||||||
public static string strPerunVersion = "DEBUG"; // Helper for pulling version definition
|
public static string[] AppLogHistory = new string[10]; // Log history for GUI
|
||||||
public static string[] arrGUILogHistory = new string[10]; // Log history for GUI
|
public static bool AppUpdateGUI = true; // Flag if log control requires update
|
||||||
public static bool bGUILogHistoryUpdate = true; // Flag if log control requires update
|
public static string AppTitle = ""; // Helper to update title
|
||||||
public static string strPerunTitleText = ""; // Helper to update title
|
public static int AppInstanceID = 0; // Kepp the instance ID
|
||||||
public static int intInstanceId = 0; // Kepp the instance ID
|
public static bool AppForceIconReload = true; // Force main window icons reload
|
||||||
public static bool bStatusIconsForce = true; // Force main window icons reload
|
|
||||||
public static bool bdcConnection = false; // Historic db connection status
|
public static bool StatusDatabase = false; // Historic db connection status
|
||||||
public static bool bTCPServer = false; // Historic tcp connection status
|
public static bool StatusSRS = false; // Historic srs connection status
|
||||||
public static bool bSRSStatus = false; // Historic srs connection status
|
public static bool StatusLotATC = false; // Historic lotatc connection status
|
||||||
public static bool bLotATCStatus = false; // Historic lotatc connection status
|
public static bool StatusHistoryConnection = false; // Historic tcp connection status
|
||||||
public static bool bClientConnected = false; // Flag if is TCP connectionstill alive
|
public static bool StatusConnection = false; // Flag if is TCP connectionstill alive
|
||||||
public static int intMysqlErros = 0; // MySQL - Error counter
|
public static int ErrorsDatabase = 0; // MySQL - Error counter
|
||||||
public static int intGameErros = 0; // TCP connection - Error counter
|
public static int ErrorsGame = 0; // TCP connection - Error counter
|
||||||
public static int intGameErrosHistory = 0; // TCP connection - historic value of Error counter
|
public static int ErrorsHistoryGame = 0; // TCP connection - historic value of Error counter
|
||||||
public static int intSRSErros = 0; // DCS SRS - error counter
|
public static int ErrorsSRS = 0; // DCS SRS - error counter
|
||||||
public static int intLotATCErros = 0; // LotATC - error counter
|
public static int ErrorsLotATC = 0; // LotATC - error counter
|
||||||
|
|
||||||
|
public static string VersionDCSHook = ""; // Version - DCS hook
|
||||||
|
public static string VersionDatabase = ""; // Version - Database
|
||||||
|
public static string VersionPerun = "DEBUG"; // Version - Perun
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,36 +6,36 @@ class LogController
|
|||||||
// TBD - done via https://stackoverflow.com/questions/20185015/how-to-write-log-file-in-c
|
// TBD - done via https://stackoverflow.com/questions/20185015/how-to-write-log-file-in-c
|
||||||
public static void WriteLog(string strLog)
|
public static void WriteLog(string strLog)
|
||||||
{
|
{
|
||||||
StreamWriter log;
|
StreamWriter LogStreamWriter;
|
||||||
FileStream fileStream = null;
|
FileStream LogFileStream = null;
|
||||||
DirectoryInfo logDirInfo = null;
|
DirectoryInfo LogDirectoryInfo = null;
|
||||||
FileInfo logFileInfo;
|
FileInfo LogFileInfo;
|
||||||
|
|
||||||
string logFilePath = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), "Documents") + "\\Perun\\";
|
string LogFilePath = Path.Combine(Environment.ExpandEnvironmentVariables("%userprofile%"), "Documents") + "\\Perun\\";
|
||||||
logFilePath = logFilePath + "Perun_Log_" + System.DateTime.Today.ToString("yyyyddMM") + "." + "txt";
|
LogFilePath = LogFilePath + "Perun_Log_" + System.DateTime.Today.ToString("yyyyddMM") + "." + "txt";
|
||||||
logFileInfo = new FileInfo(logFilePath);
|
LogFileInfo = new FileInfo(LogFilePath);
|
||||||
logDirInfo = new DirectoryInfo(logFileInfo.DirectoryName);
|
LogDirectoryInfo = new DirectoryInfo(LogFileInfo.DirectoryName);
|
||||||
if (!logDirInfo.Exists) logDirInfo.Create();
|
if (!LogDirectoryInfo.Exists) LogDirectoryInfo.Create();
|
||||||
if (!logFileInfo.Exists)
|
if (!LogFileInfo.Exists)
|
||||||
{
|
{
|
||||||
fileStream = logFileInfo.Create();
|
LogFileStream = LogFileInfo.Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fileStream = new FileStream(logFilePath, FileMode.Append);
|
LogFileStream = new FileStream(LogFilePath, FileMode.Append);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
log = new StreamWriter(fileStream);
|
LogStreamWriter = new StreamWriter(LogFileStream);
|
||||||
log.WriteLine(strLog);
|
LogStreamWriter.WriteLine(strLog);
|
||||||
log.Close();
|
LogStreamWriter.Close();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,40 +1,94 @@
|
|||||||
// This class gathers all helper functions
|
// This class gathers all helper functions
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
internal class PerunHelper
|
internal class PerunHelper
|
||||||
{
|
{
|
||||||
public static void GUILogHistoryAdd(ref string[] arrLogHistory, string strEntryToAdd)
|
public static void AddLog(ref string[] arrLogHistory, string strEntryToAdd, int intDirection = 0, int intMarker = 0, string strType = " ", bool bSkipGui = false)
|
||||||
{
|
{
|
||||||
// Rotate log history
|
// Declare values
|
||||||
for (int i = 0; i < arrLogHistory.Length - 1; i++)
|
string LogDirection;
|
||||||
|
string LogMarker;
|
||||||
|
// Set direction marker
|
||||||
|
switch (intDirection)
|
||||||
{
|
{
|
||||||
arrLogHistory[i] = arrLogHistory[i + 1]; // Shift one down
|
case 1:
|
||||||
|
LogDirection = ">";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
LogDirection = "<";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
LogDirection = "^";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LogDirection = " ";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new entry
|
// Set marker for user flags (markers)
|
||||||
arrLogHistory[arrLogHistory.Length - 1] = DateTime.Now.ToString("yyyy-dd-MM HH:mm:ss") + " > " + strEntryToAdd; // Add entry at the last position
|
LogMarker = (intMarker>0) ? "X" : " ";
|
||||||
|
|
||||||
|
// Set frame type
|
||||||
|
strType=strType.PadLeft(3, ' ');
|
||||||
|
|
||||||
|
if (!bSkipGui)
|
||||||
|
{
|
||||||
|
// Rotate log history
|
||||||
|
for (int i = 0; i < arrLogHistory.Length - 1; i++)
|
||||||
|
{
|
||||||
|
arrLogHistory[i] = arrLogHistory[i + 1]; // Shift one down
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new entry
|
||||||
|
arrLogHistory[arrLogHistory.Length - 1] = DateTime.Now.ToString("HH:mm:ss") + " " + LogDirection + " " + strEntryToAdd; // Add entry at the last position
|
||||||
|
|
||||||
|
// Update control at my window
|
||||||
|
Globals.AppUpdateGUI = true;
|
||||||
|
}
|
||||||
// Add the entry to log file
|
// Add the entry to log file
|
||||||
LogController.WriteLog(arrLogHistory[arrLogHistory.Length - 1]);
|
LogController.WriteLog(DateTime.Now.ToString("yyyy-dd-MM ") + " " + DateTime.Now.ToString("HH:mm:ss") + " | Instance: "+ Globals.AppInstanceID + " | " + LogMarker + " | "+ LogDirection + " | "+ strType + " | " + strEntryToAdd);
|
||||||
|
|
||||||
// Update control at my window
|
|
||||||
Globals.bGUILogHistoryUpdate = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetAppVersion(string strBeginning)
|
public static string GetAppVersion(string strBeginning)
|
||||||
{
|
{
|
||||||
// Gets build version
|
// Gets build version
|
||||||
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
|
Globals.VersionPerun = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
|
return strBeginning + "v" + Globals.VersionPerun;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int CheckVersions()
|
||||||
|
{
|
||||||
|
// Checks the versions of APP, DCS Hook and MySQL database
|
||||||
|
Match match = Regex.Match(Globals.VersionPerun, @"^\d+.\d+.\d+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
string VersionApp = "v" + match.Groups[0].Value;
|
||||||
|
|
||||||
|
int ReturnValue = 1;
|
||||||
|
if (!String.IsNullOrEmpty(Globals.VersionDatabase))
|
||||||
{
|
{
|
||||||
// For network deployed
|
// Check database
|
||||||
System.Deployment.Application.ApplicationDeployment cd = System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
|
if(VersionApp != Globals.VersionDatabase)
|
||||||
Globals.strPerunVersion = cd.CurrentVersion.ToString();
|
{
|
||||||
|
// Incorrect database version
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR Incorrect database revision : "+ Globals.VersionDatabase, 1, 1, "?");
|
||||||
|
Globals.ErrorsDatabase++;
|
||||||
|
ReturnValue = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!String.IsNullOrEmpty(Globals.VersionDCSHook))
|
||||||
{
|
{
|
||||||
// For other cases
|
// Check database
|
||||||
Globals.strPerunVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
if (VersionApp != Globals.VersionDCSHook)
|
||||||
|
{
|
||||||
|
// Incorrect dcs script version
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "ERROR Incorrect DCS hook revision : " + Globals.VersionDCSHook, 2, 1, "?");
|
||||||
|
Globals.ErrorsGame++;
|
||||||
|
ReturnValue = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return strBeginning + "v" + Globals.strPerunVersion;
|
|
||||||
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using System;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
public class TCPController
|
public class TCPController
|
||||||
@@ -42,6 +43,7 @@ public class TCPController
|
|||||||
NetworkStream nsReadStream = null;
|
NetworkStream nsReadStream = null;
|
||||||
TcpClient tcpClient = null;
|
TcpClient tcpClient = null;
|
||||||
bool bTCPConnectionOnline = false;
|
bool bTCPConnectionOnline = false;
|
||||||
|
string strReceiveBuffer;
|
||||||
|
|
||||||
// Main loop - do until diconnect button is clicked
|
// Main loop - do until diconnect button is clicked
|
||||||
while (!bCloseConnection)
|
while (!bCloseConnection)
|
||||||
@@ -62,7 +64,7 @@ public class TCPController
|
|||||||
{
|
{
|
||||||
// Start listening
|
// Start listening
|
||||||
Console.WriteLine("TCP: Waiting for connection");
|
Console.WriteLine("TCP: Waiting for connection");
|
||||||
Globals.bClientConnected = false;
|
Globals.StatusConnection = false;
|
||||||
|
|
||||||
// Wait for pending connection
|
// Wait for pending connection
|
||||||
if (tcpServer.Pending())
|
if (tcpServer.Pending())
|
||||||
@@ -71,14 +73,14 @@ public class TCPController
|
|||||||
bTCPConnectionOnline = true;
|
bTCPConnectionOnline = true;
|
||||||
tcpClient = tcpServer.AcceptTcpClient(); //if a connection exists, the server will accept it
|
tcpClient = tcpServer.AcceptTcpClient(); //if a connection exists, the server will accept it
|
||||||
nsReadStream = tcpClient.GetStream(); //networkstream is used to send/receive messages
|
nsReadStream = tcpClient.GetStream(); //networkstream is used to send/receive messages
|
||||||
nsReadStream.ReadTimeout = 6000;
|
nsReadStream.ReadTimeout = 10000;
|
||||||
tcpClient.ReceiveTimeout = 6000;
|
tcpClient.ReceiveTimeout = 10000;
|
||||||
|
|
||||||
|
|
||||||
while (tcpClient.Connected && !bCloseConnection && bTCPConnectionOnline) //while the client is connected, we look for incoming messages
|
while (tcpClient.Connected && !bCloseConnection && bTCPConnectionOnline) //while the client is connected, we look for incoming messages
|
||||||
{
|
{
|
||||||
StringBuilder CompleteMessage = new StringBuilder();
|
StringBuilder CompleteMessage = new StringBuilder();
|
||||||
Globals.bClientConnected = true;
|
Globals.StatusConnection = true;
|
||||||
|
|
||||||
if (nsReadStream.CanRead)
|
if (nsReadStream.CanRead)
|
||||||
{
|
{
|
||||||
@@ -103,39 +105,72 @@ public class TCPController
|
|||||||
strReceivedData = CompleteMessage.ToString();
|
strReceivedData = CompleteMessage.ToString();
|
||||||
Console.WriteLine("Sender: {0} Payload: {1}", null, strReceivedData);
|
Console.WriteLine("Sender: {0} Payload: {1}", null, strReceivedData);
|
||||||
|
|
||||||
try
|
string pattern = @"(\<SOT\>)+?.*?(\<EOT\>)+?";
|
||||||
|
|
||||||
|
foreach (Match match in Regex.Matches(strReceivedData, pattern))
|
||||||
{
|
{
|
||||||
if (strReceivedData != "")
|
strReceiveBuffer = match.Value;
|
||||||
|
|
||||||
|
Console.WriteLine("Found '{0}' at position {1} end {2}",match.Value, match.Index,match.Length);
|
||||||
|
Console.WriteLine("Prepared {0}", strReceiveBuffer.Substring(5, match.Length-10));
|
||||||
|
|
||||||
|
strReceivedData = strReceiveBuffer.Substring(5, match.Length - 10);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
dynamic dynamicRawTCPFrame = JsonConvert.DeserializeObject(strReceivedData); // Deserialize received frame
|
if (strReceivedData != "")
|
||||||
string strRawTCPFrameType = dynamicRawTCPFrame.type;
|
|
||||||
|
|
||||||
PerunHelper.GUILogHistoryAdd(ref arrGUILogHistory, "#" + Globals.intInstanceId + "> TCP packet received, type: " + strRawTCPFrameType);
|
|
||||||
|
|
||||||
// Add to mySQL send buffer (find first empty slot)
|
|
||||||
if (Int32.Parse(strRawTCPFrameType) != 0)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < arrMySQLSendBuffer.Length - 1; i++)
|
dynamic dynamicRawTCPFrame = JsonConvert.DeserializeObject(strReceivedData); // Deserialize received frame
|
||||||
|
string strRawTCPFrameType = dynamicRawTCPFrame.type;
|
||||||
|
|
||||||
|
// Check if this is NOT keep alive
|
||||||
|
if (Int32.Parse(strRawTCPFrameType) != 0)
|
||||||
{
|
{
|
||||||
if (arrMySQLSendBuffer[i] == null)
|
// Add to mySQL send buffer (find first empty slot)
|
||||||
|
PerunHelper.AddLog(ref arrGUILogHistory, "Packet received" , 2,0, strRawTCPFrameType,true);
|
||||||
|
bool AddedDataToBuffer = false;
|
||||||
|
for (int i = 0; i < arrMySQLSendBuffer.Length - 1; i++)
|
||||||
{
|
{
|
||||||
arrMySQLSendBuffer[i] = strReceivedData;
|
if (arrMySQLSendBuffer[i] == null)
|
||||||
break;
|
{
|
||||||
|
arrMySQLSendBuffer[i] = strReceivedData;
|
||||||
|
AddedDataToBuffer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!AddedDataToBuffer)
|
||||||
|
{
|
||||||
|
PerunHelper.AddLog(ref arrGUILogHistory, "ERROR package was dropped", 1, 1, strRawTCPFrameType);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// Keep alive
|
||||||
|
PerunHelper.AddLog(ref arrGUILogHistory, "Keep-alive received", 2,0,"0",true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bTCPConnectionOnline = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Globals.ErrorsGame++;
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
PerunHelper.AddLog(ref arrGUILogHistory, "ERROR while message parsing , error: " + e.Message,2,1,"?");
|
||||||
bTCPConnectionOnline = false;
|
bTCPConnectionOnline = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
// Send empty byte to check if connection is still alive
|
||||||
{
|
try
|
||||||
Globals.intGameErros++;
|
{
|
||||||
Console.WriteLine(e.ToString());
|
tcpClient.Client.Send(new byte[] { 0 }, 1, 0);
|
||||||
PerunHelper.GUILogHistoryAdd(ref arrGUILogHistory, "#" + Globals.intInstanceId + " > TCP ERROR incorrect JSON > " + e.Message);
|
}
|
||||||
bTCPConnectionOnline = false;
|
catch (SocketException e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
PerunHelper.AddLog(ref arrGUILogHistory, "TCP ERROR cannot check connection, error: " + e.Message,2,1,"?");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,9 +180,9 @@ public class TCPController
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Globals.intGameErros++;
|
Globals.ErrorsGame++;
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
PerunHelper.GUILogHistoryAdd(ref arrGUILogHistory, "#" + Globals.intInstanceId + " > TCP error - connection closed or port in use > " + e.Message);
|
PerunHelper.AddLog(ref arrGUILogHistory, "TCP error - connection closed or port in use, error: " + e.Message,1,1,"?");
|
||||||
bTCPConnectionOnline = false;
|
bTCPConnectionOnline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
119
02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs
generated
@@ -68,14 +68,20 @@
|
|||||||
this.label10 = new System.Windows.Forms.Label();
|
this.label10 = new System.Windows.Forms.Label();
|
||||||
this.label11 = new System.Windows.Forms.Label();
|
this.label11 = new System.Windows.Forms.Label();
|
||||||
this.label12 = new System.Windows.Forms.Label();
|
this.label12 = new System.Windows.Forms.Label();
|
||||||
|
this.con_Button_Reset_Flags = new System.Windows.Forms.Button();
|
||||||
|
this.label13 = new System.Windows.Forms.Label();
|
||||||
|
this.label14 = new System.Windows.Forms.Label();
|
||||||
|
this.con_img_logo = new System.Windows.Forms.PictureBox();
|
||||||
this.con_img_lotATC = new System.Windows.Forms.PictureBox();
|
this.con_img_lotATC = new System.Windows.Forms.PictureBox();
|
||||||
this.con_img_srs = new System.Windows.Forms.PictureBox();
|
this.con_img_srs = new System.Windows.Forms.PictureBox();
|
||||||
this.con_img_dcs = new System.Windows.Forms.PictureBox();
|
this.con_img_dcs = new System.Windows.Forms.PictureBox();
|
||||||
this.con_img_db = new System.Windows.Forms.PictureBox();
|
this.con_img_db = new System.Windows.Forms.PictureBox();
|
||||||
|
this.con_Button_Add_Marker = new System.Windows.Forms.Button();
|
||||||
this.con_GroupBox_1.SuspendLayout();
|
this.con_GroupBox_1.SuspendLayout();
|
||||||
this.con_GroupBox_2.SuspendLayout();
|
this.con_GroupBox_2.SuspendLayout();
|
||||||
this.con_GroupBox_3.SuspendLayout();
|
this.con_GroupBox_3.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.con_img_logo)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.con_img_lotATC)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.con_img_lotATC)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.con_img_srs)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.con_img_srs)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.con_img_dcs)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.con_img_dcs)).BeginInit();
|
||||||
@@ -92,11 +98,10 @@
|
|||||||
this.con_List_Received.Name = "con_List_Received";
|
this.con_List_Received.Name = "con_List_Received";
|
||||||
this.con_List_Received.Size = new System.Drawing.Size(307, 134);
|
this.con_List_Received.Size = new System.Drawing.Size(307, 134);
|
||||||
this.con_List_Received.TabIndex = 0;
|
this.con_List_Received.TabIndex = 0;
|
||||||
this.con_List_Received.SelectedIndexChanged += new System.EventHandler(this.con_List_Received_SelectedIndexChanged);
|
|
||||||
//
|
//
|
||||||
// con_Button_Listen_ON
|
// con_Button_Listen_ON
|
||||||
//
|
//
|
||||||
this.con_Button_Listen_ON.Location = new System.Drawing.Point(12, 553);
|
this.con_Button_Listen_ON.Location = new System.Drawing.Point(12, 602);
|
||||||
this.con_Button_Listen_ON.Name = "con_Button_Listen_ON";
|
this.con_Button_Listen_ON.Name = "con_Button_Listen_ON";
|
||||||
this.con_Button_Listen_ON.Size = new System.Drawing.Size(86, 39);
|
this.con_Button_Listen_ON.Size = new System.Drawing.Size(86, 39);
|
||||||
this.con_Button_Listen_ON.TabIndex = 2;
|
this.con_Button_Listen_ON.TabIndex = 2;
|
||||||
@@ -107,7 +112,7 @@
|
|||||||
// con_Button_Listen_OFF
|
// con_Button_Listen_OFF
|
||||||
//
|
//
|
||||||
this.con_Button_Listen_OFF.Enabled = false;
|
this.con_Button_Listen_OFF.Enabled = false;
|
||||||
this.con_Button_Listen_OFF.Location = new System.Drawing.Point(104, 553);
|
this.con_Button_Listen_OFF.Location = new System.Drawing.Point(104, 602);
|
||||||
this.con_Button_Listen_OFF.Name = "con_Button_Listen_OFF";
|
this.con_Button_Listen_OFF.Name = "con_Button_Listen_OFF";
|
||||||
this.con_Button_Listen_OFF.Size = new System.Drawing.Size(86, 39);
|
this.con_Button_Listen_OFF.Size = new System.Drawing.Size(86, 39);
|
||||||
this.con_Button_Listen_OFF.TabIndex = 3;
|
this.con_Button_Listen_OFF.TabIndex = 3;
|
||||||
@@ -118,7 +123,7 @@
|
|||||||
// con_GroupBox_1
|
// con_GroupBox_1
|
||||||
//
|
//
|
||||||
this.con_GroupBox_1.Controls.Add(this.con_List_Received);
|
this.con_GroupBox_1.Controls.Add(this.con_List_Received);
|
||||||
this.con_GroupBox_1.Location = new System.Drawing.Point(12, 385);
|
this.con_GroupBox_1.Location = new System.Drawing.Point(12, 434);
|
||||||
this.con_GroupBox_1.Name = "con_GroupBox_1";
|
this.con_GroupBox_1.Name = "con_GroupBox_1";
|
||||||
this.con_GroupBox_1.Size = new System.Drawing.Size(324, 162);
|
this.con_GroupBox_1.Size = new System.Drawing.Size(324, 162);
|
||||||
this.con_GroupBox_1.TabIndex = 4;
|
this.con_GroupBox_1.TabIndex = 4;
|
||||||
@@ -142,7 +147,7 @@
|
|||||||
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_database);
|
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_database);
|
||||||
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_server);
|
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_server);
|
||||||
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_password);
|
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_password);
|
||||||
this.con_GroupBox_2.Location = new System.Drawing.Point(12, 27);
|
this.con_GroupBox_2.Location = new System.Drawing.Point(14, 54);
|
||||||
this.con_GroupBox_2.Name = "con_GroupBox_2";
|
this.con_GroupBox_2.Name = "con_GroupBox_2";
|
||||||
this.con_GroupBox_2.Size = new System.Drawing.Size(324, 154);
|
this.con_GroupBox_2.Size = new System.Drawing.Size(324, 154);
|
||||||
this.con_GroupBox_2.TabIndex = 5;
|
this.con_GroupBox_2.TabIndex = 5;
|
||||||
@@ -236,7 +241,7 @@
|
|||||||
this.con_GroupBox_3.Controls.Add(this.con_txt_3rd_srs);
|
this.con_GroupBox_3.Controls.Add(this.con_txt_3rd_srs);
|
||||||
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_lotatc);
|
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_lotatc);
|
||||||
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_srs);
|
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_srs);
|
||||||
this.con_GroupBox_3.Location = new System.Drawing.Point(12, 261);
|
this.con_GroupBox_3.Location = new System.Drawing.Point(14, 288);
|
||||||
this.con_GroupBox_3.Name = "con_GroupBox_3";
|
this.con_GroupBox_3.Name = "con_GroupBox_3";
|
||||||
this.con_GroupBox_3.Size = new System.Drawing.Size(324, 68);
|
this.con_GroupBox_3.Size = new System.Drawing.Size(324, 68);
|
||||||
this.con_GroupBox_3.TabIndex = 6;
|
this.con_GroupBox_3.TabIndex = 6;
|
||||||
@@ -281,7 +286,7 @@
|
|||||||
//
|
//
|
||||||
// con_Button_Quit
|
// con_Button_Quit
|
||||||
//
|
//
|
||||||
this.con_Button_Quit.Location = new System.Drawing.Point(251, 553);
|
this.con_Button_Quit.Location = new System.Drawing.Point(251, 602);
|
||||||
this.con_Button_Quit.Name = "con_Button_Quit";
|
this.con_Button_Quit.Name = "con_Button_Quit";
|
||||||
this.con_Button_Quit.Size = new System.Drawing.Size(86, 39);
|
this.con_Button_Quit.Size = new System.Drawing.Size(86, 39);
|
||||||
this.con_Button_Quit.TabIndex = 7;
|
this.con_Button_Quit.TabIndex = 7;
|
||||||
@@ -292,9 +297,10 @@
|
|||||||
// con_lab_github
|
// con_lab_github
|
||||||
//
|
//
|
||||||
this.con_lab_github.AutoSize = true;
|
this.con_lab_github.AutoSize = true;
|
||||||
this.con_lab_github.Location = new System.Drawing.Point(141, 9);
|
this.con_lab_github.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.con_lab_github.Location = new System.Drawing.Point(183, 39);
|
||||||
this.con_lab_github.Name = "con_lab_github";
|
this.con_lab_github.Name = "con_lab_github";
|
||||||
this.con_lab_github.Size = new System.Drawing.Size(181, 13);
|
this.con_lab_github.Size = new System.Drawing.Size(155, 12);
|
||||||
this.con_lab_github.TabIndex = 8;
|
this.con_lab_github.TabIndex = 8;
|
||||||
this.con_lab_github.TabStop = true;
|
this.con_lab_github.TabStop = true;
|
||||||
this.con_lab_github.Text = "https://github.com/szporwolik/perun";
|
this.con_lab_github.Text = "https://github.com/szporwolik/perun";
|
||||||
@@ -303,9 +309,10 @@
|
|||||||
// label5
|
// label5
|
||||||
//
|
//
|
||||||
this.label5.AutoSize = true;
|
this.label5.AutoSize = true;
|
||||||
this.label5.Location = new System.Drawing.Point(15, 9);
|
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.label5.Location = new System.Drawing.Point(183, 27);
|
||||||
this.label5.Name = "label5";
|
this.label5.Name = "label5";
|
||||||
this.label5.Size = new System.Drawing.Size(120, 13);
|
this.label5.Size = new System.Drawing.Size(102, 12);
|
||||||
this.label5.TabIndex = 9;
|
this.label5.TabIndex = 9;
|
||||||
this.label5.Text = "Manual and bugtracker:";
|
this.label5.Text = "Manual and bugtracker:";
|
||||||
//
|
//
|
||||||
@@ -342,7 +349,7 @@
|
|||||||
this.groupBox1.Controls.Add(this.con_txt_dcs_instance);
|
this.groupBox1.Controls.Add(this.con_txt_dcs_instance);
|
||||||
this.groupBox1.Controls.Add(this.label7);
|
this.groupBox1.Controls.Add(this.label7);
|
||||||
this.groupBox1.Controls.Add(this.con_txt_dcs_server_port);
|
this.groupBox1.Controls.Add(this.con_txt_dcs_server_port);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(12, 187);
|
this.groupBox1.Location = new System.Drawing.Point(14, 214);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(324, 68);
|
this.groupBox1.Size = new System.Drawing.Size(324, 68);
|
||||||
this.groupBox1.TabIndex = 7;
|
this.groupBox1.TabIndex = 7;
|
||||||
@@ -386,7 +393,7 @@
|
|||||||
this.label9.AutoSize = true;
|
this.label9.AutoSize = true;
|
||||||
this.label9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.label9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label9.Location = new System.Drawing.Point(21, 369);
|
this.label9.Location = new System.Drawing.Point(21, 396);
|
||||||
this.label9.Name = "label9";
|
this.label9.Name = "label9";
|
||||||
this.label9.Size = new System.Drawing.Size(61, 13);
|
this.label9.Size = new System.Drawing.Size(61, 13);
|
||||||
this.label9.TabIndex = 1;
|
this.label9.TabIndex = 1;
|
||||||
@@ -397,7 +404,7 @@
|
|||||||
this.label10.AutoSize = true;
|
this.label10.AutoSize = true;
|
||||||
this.label10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.label10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label10.Location = new System.Drawing.Point(117, 369);
|
this.label10.Location = new System.Drawing.Point(117, 396);
|
||||||
this.label10.Name = "label10";
|
this.label10.Name = "label10";
|
||||||
this.label10.Size = new System.Drawing.Size(39, 13);
|
this.label10.Size = new System.Drawing.Size(39, 13);
|
||||||
this.label10.TabIndex = 14;
|
this.label10.TabIndex = 14;
|
||||||
@@ -408,7 +415,7 @@
|
|||||||
this.label11.AutoSize = true;
|
this.label11.AutoSize = true;
|
||||||
this.label11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.label11.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label11.Location = new System.Drawing.Point(205, 369);
|
this.label11.Location = new System.Drawing.Point(205, 396);
|
||||||
this.label11.Name = "label11";
|
this.label11.Name = "label11";
|
||||||
this.label11.Size = new System.Drawing.Size(32, 13);
|
this.label11.Size = new System.Drawing.Size(32, 13);
|
||||||
this.label11.TabIndex = 15;
|
this.label11.TabIndex = 15;
|
||||||
@@ -419,16 +426,58 @@
|
|||||||
this.label12.AutoSize = true;
|
this.label12.AutoSize = true;
|
||||||
this.label12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.label12.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.label12.Location = new System.Drawing.Point(282, 369);
|
this.label12.Location = new System.Drawing.Point(282, 396);
|
||||||
this.label12.Name = "label12";
|
this.label12.Name = "label12";
|
||||||
this.label12.Size = new System.Drawing.Size(49, 13);
|
this.label12.Size = new System.Drawing.Size(49, 13);
|
||||||
this.label12.TabIndex = 16;
|
this.label12.TabIndex = 16;
|
||||||
this.label12.Text = "LotATC";
|
this.label12.Text = "LotATC";
|
||||||
//
|
//
|
||||||
|
// con_Button_Reset_Flags
|
||||||
|
//
|
||||||
|
this.con_Button_Reset_Flags.Enabled = false;
|
||||||
|
this.con_Button_Reset_Flags.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.con_Button_Reset_Flags.Location = new System.Drawing.Point(224, 414);
|
||||||
|
this.con_Button_Reset_Flags.Name = "con_Button_Reset_Flags";
|
||||||
|
this.con_Button_Reset_Flags.Size = new System.Drawing.Size(114, 20);
|
||||||
|
this.con_Button_Reset_Flags.TabIndex = 17;
|
||||||
|
this.con_Button_Reset_Flags.Text = "Reset error flags";
|
||||||
|
this.con_Button_Reset_Flags.UseVisualStyleBackColor = true;
|
||||||
|
this.con_Button_Reset_Flags.Click += new System.EventHandler(this.con_Button_Reset_Flags_Click);
|
||||||
|
//
|
||||||
|
// label13
|
||||||
|
//
|
||||||
|
this.label13.AutoSize = true;
|
||||||
|
this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.label13.Location = new System.Drawing.Point(63, 7);
|
||||||
|
this.label13.Name = "label13";
|
||||||
|
this.label13.Size = new System.Drawing.Size(74, 25);
|
||||||
|
this.label13.TabIndex = 19;
|
||||||
|
this.label13.Text = "Perun";
|
||||||
|
//
|
||||||
|
// label14
|
||||||
|
//
|
||||||
|
this.label14.AutoSize = true;
|
||||||
|
this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.label14.Location = new System.Drawing.Point(65, 32);
|
||||||
|
this.label14.Name = "label14";
|
||||||
|
this.label14.Size = new System.Drawing.Size(88, 13);
|
||||||
|
this.label14.TabIndex = 20;
|
||||||
|
this.label14.Text = "for DCS World";
|
||||||
|
//
|
||||||
|
// con_img_logo
|
||||||
|
//
|
||||||
|
this.con_img_logo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||||
|
this.con_img_logo.Image = global::Perun_v1.Properties.Resources.perun_logo;
|
||||||
|
this.con_img_logo.Location = new System.Drawing.Point(12, 7);
|
||||||
|
this.con_img_logo.Name = "con_img_logo";
|
||||||
|
this.con_img_logo.Size = new System.Drawing.Size(45, 41);
|
||||||
|
this.con_img_logo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
|
this.con_img_logo.TabIndex = 18;
|
||||||
|
this.con_img_logo.TabStop = false;
|
||||||
|
//
|
||||||
// con_img_lotATC
|
// con_img_lotATC
|
||||||
//
|
//
|
||||||
this.con_img_lotATC.Image = global::Perun_v1.Properties.Resources.status_disconnected;
|
this.con_img_lotATC.Location = new System.Drawing.Point(292, 362);
|
||||||
this.con_img_lotATC.Location = new System.Drawing.Point(292, 335);
|
|
||||||
this.con_img_lotATC.Name = "con_img_lotATC";
|
this.con_img_lotATC.Name = "con_img_lotATC";
|
||||||
this.con_img_lotATC.Size = new System.Drawing.Size(29, 28);
|
this.con_img_lotATC.Size = new System.Drawing.Size(29, 28);
|
||||||
this.con_img_lotATC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.con_img_lotATC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
@@ -437,8 +486,7 @@
|
|||||||
//
|
//
|
||||||
// con_img_srs
|
// con_img_srs
|
||||||
//
|
//
|
||||||
this.con_img_srs.Image = global::Perun_v1.Properties.Resources.status_disconnected;
|
this.con_img_srs.Location = new System.Drawing.Point(207, 362);
|
||||||
this.con_img_srs.Location = new System.Drawing.Point(207, 335);
|
|
||||||
this.con_img_srs.Name = "con_img_srs";
|
this.con_img_srs.Name = "con_img_srs";
|
||||||
this.con_img_srs.Size = new System.Drawing.Size(29, 28);
|
this.con_img_srs.Size = new System.Drawing.Size(29, 28);
|
||||||
this.con_img_srs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.con_img_srs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
@@ -447,8 +495,7 @@
|
|||||||
//
|
//
|
||||||
// con_img_dcs
|
// con_img_dcs
|
||||||
//
|
//
|
||||||
this.con_img_dcs.Image = global::Perun_v1.Properties.Resources.status_disconnected;
|
this.con_img_dcs.Location = new System.Drawing.Point(122, 362);
|
||||||
this.con_img_dcs.Location = new System.Drawing.Point(122, 335);
|
|
||||||
this.con_img_dcs.Name = "con_img_dcs";
|
this.con_img_dcs.Name = "con_img_dcs";
|
||||||
this.con_img_dcs.Size = new System.Drawing.Size(29, 28);
|
this.con_img_dcs.Size = new System.Drawing.Size(29, 28);
|
||||||
this.con_img_dcs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.con_img_dcs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
@@ -458,19 +505,35 @@
|
|||||||
// con_img_db
|
// con_img_db
|
||||||
//
|
//
|
||||||
this.con_img_db.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
this.con_img_db.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||||
this.con_img_db.Image = global::Perun_v1.Properties.Resources.status_disconnected;
|
this.con_img_db.Location = new System.Drawing.Point(37, 362);
|
||||||
this.con_img_db.Location = new System.Drawing.Point(37, 335);
|
|
||||||
this.con_img_db.Name = "con_img_db";
|
this.con_img_db.Name = "con_img_db";
|
||||||
this.con_img_db.Size = new System.Drawing.Size(29, 28);
|
this.con_img_db.Size = new System.Drawing.Size(29, 28);
|
||||||
this.con_img_db.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
this.con_img_db.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||||
this.con_img_db.TabIndex = 10;
|
this.con_img_db.TabIndex = 10;
|
||||||
this.con_img_db.TabStop = false;
|
this.con_img_db.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// con_Button_Add_Marker
|
||||||
|
//
|
||||||
|
this.con_Button_Add_Marker.Enabled = false;
|
||||||
|
this.con_Button_Add_Marker.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.con_Button_Add_Marker.Location = new System.Drawing.Point(12, 414);
|
||||||
|
this.con_Button_Add_Marker.Name = "con_Button_Add_Marker";
|
||||||
|
this.con_Button_Add_Marker.Size = new System.Drawing.Size(114, 20);
|
||||||
|
this.con_Button_Add_Marker.TabIndex = 21;
|
||||||
|
this.con_Button_Add_Marker.Text = "Add log marker";
|
||||||
|
this.con_Button_Add_Marker.UseVisualStyleBackColor = true;
|
||||||
|
this.con_Button_Add_Marker.Click += new System.EventHandler(this.con_Button_Add_Marker_Click);
|
||||||
|
//
|
||||||
// form_Main
|
// form_Main
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(349, 604);
|
this.ClientSize = new System.Drawing.Size(349, 653);
|
||||||
|
this.Controls.Add(this.con_Button_Add_Marker);
|
||||||
|
this.Controls.Add(this.label14);
|
||||||
|
this.Controls.Add(this.label13);
|
||||||
|
this.Controls.Add(this.con_img_logo);
|
||||||
|
this.Controls.Add(this.con_Button_Reset_Flags);
|
||||||
this.Controls.Add(this.label12);
|
this.Controls.Add(this.label12);
|
||||||
this.Controls.Add(this.label11);
|
this.Controls.Add(this.label11);
|
||||||
this.Controls.Add(this.label10);
|
this.Controls.Add(this.label10);
|
||||||
@@ -503,6 +566,7 @@
|
|||||||
this.con_GroupBox_3.PerformLayout();
|
this.con_GroupBox_3.PerformLayout();
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox1.PerformLayout();
|
this.groupBox1.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.con_img_logo)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.con_img_lotATC)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.con_img_lotATC)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.con_img_srs)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.con_img_srs)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.con_img_dcs)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.con_img_dcs)).EndInit();
|
||||||
@@ -556,6 +620,11 @@
|
|||||||
private System.Windows.Forms.Label label10;
|
private System.Windows.Forms.Label label10;
|
||||||
private System.Windows.Forms.Label label11;
|
private System.Windows.Forms.Label label11;
|
||||||
private System.Windows.Forms.Label label12;
|
private System.Windows.Forms.Label label12;
|
||||||
|
private System.Windows.Forms.Button con_Button_Reset_Flags;
|
||||||
|
private System.Windows.Forms.PictureBox con_img_logo;
|
||||||
|
private System.Windows.Forms.Label label13;
|
||||||
|
private System.Windows.Forms.Label label14;
|
||||||
|
private System.Windows.Forms.Button con_Button_Add_Marker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,27 +10,25 @@ namespace Perun_v1
|
|||||||
public partial class form_Main : Form
|
public partial class form_Main : Form
|
||||||
{
|
{
|
||||||
// Variable definitions
|
// Variable definitions
|
||||||
public string[] arrMySQLSendBuffer = new string[65534]; // MySQL send buffer
|
public string[] DatabaseSendBuffer = new string[50]; // MySQL send buffer
|
||||||
public bool bAllowAppClosure = false; // Helper to handle system tray
|
public bool AppCanClose = false; // Helper to handle system tray - true needed to quit the app
|
||||||
|
|
||||||
public DatabaseController dcConnection = new DatabaseController(); // MySQL controller
|
public DatabaseController DatabaseConnection = new DatabaseController(); // Main MySQL controller
|
||||||
public TCPController tcpServer = new TCPController(); // TCP controller
|
public TCPController TCPServer = new TCPController(); // Main TCP controller
|
||||||
|
|
||||||
public bool bSRSStatus; // Use empty/default SRS status
|
public bool ExtSRSStatus; // True if to use empty/default SRS status
|
||||||
public bool bLotATCStatus; // Use empty/default LotATC status
|
public bool ExtLotATCStatus; // True if to use empty/default LotATC status
|
||||||
|
|
||||||
// ################################ Main ################################
|
// ################################ Main ################################
|
||||||
private void form_Main_Load(object sender, EventArgs e)
|
private void form_Main_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Form loaded - fill controls with default values
|
// Form loaded
|
||||||
Globals.arrGUILogHistory[0] = DateTime.Now.ToString("HH:mm:ss") + " > " + "Perun started";
|
Globals.AppLogHistory[0] = DateTime.Now.ToString("HH:mm:ss") + " > " + "Perun started"; // Add information to the log control
|
||||||
|
form_Main_LoadSettings(); // Load settings from registry
|
||||||
|
|
||||||
// Display build version in title bar
|
// Display build version in title bar
|
||||||
Globals.strPerunTitleText = PerunHelper.GetAppVersion(this.Text + " - ");
|
Globals.AppTitle = PerunHelper.GetAppVersion(this.Text + " - ");
|
||||||
this.Text = Globals.strPerunTitleText;
|
this.Text = Globals.AppTitle;
|
||||||
|
|
||||||
// Load settings from registry
|
|
||||||
form_Main_LoadSettings();
|
|
||||||
|
|
||||||
// Use command line parameters
|
// Use command line parameters
|
||||||
string[] args = Environment.GetCommandLineArgs();
|
string[] args = Environment.GetCommandLineArgs();
|
||||||
@@ -68,6 +66,12 @@ namespace Perun_v1
|
|||||||
con_check_3rd_lotatc.Checked = true;
|
con_check_3rd_lotatc.Checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize controls
|
||||||
|
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
|
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
|
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
|
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
public form_Main()
|
public form_Main()
|
||||||
@@ -113,12 +117,14 @@ namespace Perun_v1
|
|||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void form_Main_DisableControls()
|
private void form_Main_SetControlsToConnected()
|
||||||
{
|
{
|
||||||
// Disables controls
|
// Disables controls
|
||||||
con_Button_Listen_ON.Enabled = false;
|
con_Button_Add_Marker.Enabled = true;
|
||||||
con_Button_Listen_OFF.Enabled = true;
|
con_Button_Listen_OFF.Enabled = true;
|
||||||
|
con_Button_Listen_ON.Enabled = false;
|
||||||
con_Button_Quit.Enabled = false;
|
con_Button_Quit.Enabled = false;
|
||||||
|
con_Button_Reset_Flags.Enabled = true;
|
||||||
con_txt_mysql_database.Enabled = false;
|
con_txt_mysql_database.Enabled = false;
|
||||||
con_txt_mysql_username.Enabled = false;
|
con_txt_mysql_username.Enabled = false;
|
||||||
con_txt_mysql_password.Enabled = false;
|
con_txt_mysql_password.Enabled = false;
|
||||||
@@ -132,12 +138,14 @@ namespace Perun_v1
|
|||||||
con_txt_dcs_instance.Enabled = false;
|
con_txt_dcs_instance.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void form_Main_EnableControls()
|
private void form_Main_SetControlsToDisconnected()
|
||||||
{
|
{
|
||||||
// Enables controls
|
// Enables controls
|
||||||
con_Button_Listen_ON.Enabled = true;
|
con_Button_Reset_Flags.Enabled = false;
|
||||||
con_Button_Listen_OFF.Enabled = false;
|
con_Button_Listen_OFF.Enabled = false;
|
||||||
|
con_Button_Listen_ON.Enabled = true;
|
||||||
con_Button_Quit.Enabled = true;
|
con_Button_Quit.Enabled = true;
|
||||||
|
con_Button_Add_Marker.Enabled = false;
|
||||||
con_txt_mysql_database.Enabled = true;
|
con_txt_mysql_database.Enabled = true;
|
||||||
con_txt_mysql_username.Enabled = true;
|
con_txt_mysql_username.Enabled = true;
|
||||||
con_txt_mysql_password.Enabled = true;
|
con_txt_mysql_password.Enabled = true;
|
||||||
@@ -149,6 +157,7 @@ namespace Perun_v1
|
|||||||
con_check_3rd_srs.Enabled = true;
|
con_check_3rd_srs.Enabled = true;
|
||||||
con_txt_dcs_server_port.Enabled = true;
|
con_txt_dcs_server_port.Enabled = true;
|
||||||
con_txt_dcs_instance.Enabled = true;
|
con_txt_dcs_instance.Enabled = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ################################ User input ################################
|
// ################################ User input ################################
|
||||||
@@ -156,31 +165,29 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
// Start listening
|
// Start listening
|
||||||
// Set globals
|
// Set globals
|
||||||
Globals.intInstanceId = Int32.Parse(con_txt_dcs_instance.Text);
|
Globals.AppInstanceID = Int32.Parse(con_txt_dcs_instance.Text);
|
||||||
Globals.bStatusIconsForce = true;
|
Globals.AppForceIconReload = true;
|
||||||
|
Globals.ErrorsDatabase = 0; // Reset error counter
|
||||||
Globals.intMysqlErros = 0; // Reset error counter
|
Globals.ErrorsGame = 0; // Reset error counter
|
||||||
Globals.intGameErros = 0; // Reset error counter
|
Globals.ErrorsSRS = 0; // Reset error counter
|
||||||
Globals.intSRSErros = 0; // Reset error counter
|
Globals.ErrorsLotATC = 0; // Reset error counter
|
||||||
Globals.intLotATCErros = 0; // Reset error counter
|
Globals.StatusConnection = false; // Reset connection status
|
||||||
|
|
||||||
Globals.bClientConnected = false; // Reset connection status
|
|
||||||
|
|
||||||
// Prepare GUI
|
// Prepare GUI
|
||||||
form_Main_DisableControls();
|
form_Main_SetControlsToConnected();
|
||||||
form_Main_SaveSettings();
|
form_Main_SaveSettings();
|
||||||
this.Text = "[#" + con_txt_dcs_instance.Text + "] " + Globals.strPerunTitleText; // Set title bar
|
this.Text = "[#" + con_txt_dcs_instance.Text + "] " + Globals.AppTitle; // Set title bar
|
||||||
trayIconMain.Text = this.Text; // Set notification icon text
|
trayIconMain.Text = this.Text; // Set notification icon text
|
||||||
|
|
||||||
// Prepare MySQL connection string
|
// Prepare MySQL connection string
|
||||||
dcConnection.strMySQLConnectionString = "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;
|
DatabaseConnection.DatabaseConnectionString = "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;
|
||||||
|
|
||||||
// Start listening
|
// Start listening
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Globals.intInstanceId + " > " + "Opening connections");
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Opening connections",0,1);
|
||||||
tcpServer.Create(Int32.Parse(con_txt_dcs_server_port.Text), ref Globals.arrGUILogHistory, ref arrMySQLSendBuffer);
|
TCPServer.Create(Int32.Parse(con_txt_dcs_server_port.Text), ref Globals.AppLogHistory, ref DatabaseSendBuffer);
|
||||||
tcpServer.thrTCPListener = new Thread(tcpServer.StartListen);
|
TCPServer.thrTCPListener = new Thread(TCPServer.StartListen);
|
||||||
tcpServer.thrTCPListener.Start();
|
TCPServer.thrTCPListener.Start();
|
||||||
tcpServer.thrTCPListener.Name = "TCPThread";
|
TCPServer.thrTCPListener.Name = "TCPThread";
|
||||||
|
|
||||||
// Start timmers
|
// Start timmers
|
||||||
tim_MySQL.Enabled = true;
|
tim_MySQL.Enabled = true;
|
||||||
@@ -196,7 +203,7 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
// Stop listening
|
// Stop listening
|
||||||
// Prepare GUI
|
// Prepare GUI
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Globals.intInstanceId + " > " + "Closing connections");
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Closing connections",0,1);
|
||||||
con_Button_Listen_OFF.Enabled = false;
|
con_Button_Listen_OFF.Enabled = false;
|
||||||
Tim_GUI_Tick(null, null);
|
Tim_GUI_Tick(null, null);
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
@@ -207,45 +214,46 @@ namespace Perun_v1
|
|||||||
tim_3rdparties.Enabled = false;
|
tim_3rdparties.Enabled = false;
|
||||||
tim_MySQL.Enabled = false;
|
tim_MySQL.Enabled = false;
|
||||||
|
|
||||||
// Wait untill TCP server closed connection
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tcpServer.StopListen();
|
// Stop the server
|
||||||
|
TCPServer.StopListen();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "TCP ERROR, error: " + ex.Message, 2, 1, "?");
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (tcpServer.thrTCPListener.IsAlive)
|
while (TCPServer.thrTCPListener.IsAlive)
|
||||||
{
|
{
|
||||||
Thread.Sleep(100); //ms
|
// Wait untill TCP server closed connection
|
||||||
|
Thread.Sleep(200); //ms
|
||||||
}
|
}
|
||||||
form_Main_EnableControls(); // Enable controls
|
form_Main_SetControlsToDisconnected(); // Enable controls
|
||||||
|
|
||||||
|
// Load status images
|
||||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected");
|
||||||
|
|
||||||
// Display information about closed connections
|
// Display information about closed connections
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Globals.intInstanceId + " > " + "Connections closed");
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Connections closed",0,1);
|
||||||
Tim_GUI_Tick(null, null);
|
Tim_GUI_Tick(null, null);
|
||||||
|
|
||||||
// Set title bar
|
// Set title bar
|
||||||
this.Text = Globals.strPerunTitleText;
|
this.Text = Globals.AppTitle;
|
||||||
trayIconMain.Text = this.Text;
|
trayIconMain.Text = this.Text;
|
||||||
|
|
||||||
// Set globals
|
// Set globals
|
||||||
Globals.intInstanceId = 0;
|
Globals.AppInstanceID = 0;
|
||||||
|
Globals.AppUpdateGUI = false;
|
||||||
// Set helpers for updates
|
Globals.StatusDatabase = false;
|
||||||
Globals.bGUILogHistoryUpdate = false;
|
Globals.StatusHistoryConnection = false;
|
||||||
Globals.bdcConnection = false;
|
Globals.StatusSRS = false;
|
||||||
Globals.bTCPServer = false;
|
Globals.StatusLotATC = false;
|
||||||
Globals.bSRSStatus = false;
|
Globals.StatusConnection = false;
|
||||||
Globals.bLotATCStatus = false;
|
|
||||||
Globals.bClientConnected = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void con_lab_github_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
private void con_lab_github_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
@@ -288,13 +296,13 @@ namespace Perun_v1
|
|||||||
// ################################ Form state ################################
|
// ################################ Form state ################################
|
||||||
private void con_Button_Quit_Click(object sender, EventArgs e)
|
private void con_Button_Quit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Close app
|
// Try to close app
|
||||||
DialogResult dialogResult = MessageBox.Show("Are you sure to exit Perun?", "Question", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
|
DialogResult dialogResult = MessageBox.Show("Are you sure to exit Perun?", "Question", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
form_Main_SaveSettings();
|
form_Main_SaveSettings();
|
||||||
|
|
||||||
bAllowAppClosure = true; // Save settings on exit
|
AppCanClose = true; // Save settings on exit
|
||||||
this.Close(); // Allow to exit application
|
this.Close(); // Allow to exit application
|
||||||
}
|
}
|
||||||
else if (dialogResult == DialogResult.No)
|
else if (dialogResult == DialogResult.No)
|
||||||
@@ -330,11 +338,10 @@ namespace Perun_v1
|
|||||||
TopMost = top;
|
TopMost = top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void form_Main_FormClosing(object sender, FormClosingEventArgs e)
|
private void form_Main_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
// Minimize to try on clicking "X"
|
// Minimize to try on clicking "X"
|
||||||
if (e.CloseReason == CloseReason.UserClosing && !bAllowAppClosure)
|
if (e.CloseReason == CloseReason.UserClosing && !AppCanClose)
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
form_Main_SendToTray(); // Send app to system tray
|
form_Main_SendToTray(); // Send app to system tray
|
||||||
@@ -353,29 +360,29 @@ namespace Perun_v1
|
|||||||
// Main timer to sync GUI with background tasks and flush buffers
|
// Main timer to sync GUI with background tasks and flush buffers
|
||||||
|
|
||||||
// Refresh Log Window
|
// Refresh Log Window
|
||||||
if (Globals.bGUILogHistoryUpdate)
|
if (Globals.AppUpdateGUI)
|
||||||
{
|
{
|
||||||
con_List_Received.Items.Clear();
|
con_List_Received.Items.Clear();
|
||||||
foreach (string i in Globals.arrGUILogHistory)
|
foreach (string i in Globals.AppLogHistory)
|
||||||
{
|
{
|
||||||
if (i != null)
|
if (i != null)
|
||||||
{
|
{
|
||||||
con_List_Received.Items.Add(i);
|
con_List_Received.Items.Add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Globals.bGUILogHistoryUpdate = false;
|
Globals.AppUpdateGUI = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Do nothing , control does not require update
|
// Do nothing , control does not require update
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update status icons at main form
|
// Update status icons at main form - MySQL
|
||||||
if ((dcConnection.bStatus != Globals.bdcConnection) || Globals.bStatusIconsForce)
|
if ((DatabaseConnection.DatabaseStatus != Globals.StatusDatabase) || Globals.AppForceIconReload)
|
||||||
{
|
{
|
||||||
if (dcConnection.bStatus)
|
if (DatabaseConnection.DatabaseStatus)
|
||||||
{
|
{
|
||||||
if (Globals.intMysqlErros == 0)
|
if (Globals.ErrorsDatabase == 0)
|
||||||
{
|
{
|
||||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
||||||
}
|
}
|
||||||
@@ -388,14 +395,14 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
||||||
}
|
}
|
||||||
Globals.bdcConnection = dcConnection.bStatus;
|
Globals.StatusDatabase = DatabaseConnection.DatabaseStatus;
|
||||||
}
|
}
|
||||||
|
// Update status icons at main form - DCS
|
||||||
if ((Globals.bClientConnected != Globals.bTCPServer) || Globals.bStatusIconsForce || Globals.intGameErros != Globals.intGameErrosHistory)
|
if ((Globals.StatusConnection != Globals.StatusHistoryConnection) || Globals.AppForceIconReload || Globals.ErrorsGame != Globals.ErrorsHistoryGame)
|
||||||
{
|
{
|
||||||
if (Globals.bClientConnected)
|
if (Globals.StatusConnection)
|
||||||
{
|
{
|
||||||
if (Globals.intGameErros == 0)
|
if (Globals.ErrorsGame == 0)
|
||||||
{
|
{
|
||||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
||||||
}
|
}
|
||||||
@@ -408,14 +415,15 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
||||||
}
|
}
|
||||||
Globals.bTCPServer = Globals.bClientConnected;
|
Globals.StatusHistoryConnection = Globals.StatusConnection;
|
||||||
Globals.intGameErrosHistory = Globals.intGameErros;
|
Globals.ErrorsHistoryGame = Globals.ErrorsGame;
|
||||||
}
|
}
|
||||||
if ((bSRSStatus != Globals.bSRSStatus) || Globals.bStatusIconsForce)
|
// Update status icons at main form - SRS
|
||||||
|
if ((ExtSRSStatus != Globals.StatusSRS) || Globals.AppForceIconReload)
|
||||||
{
|
{
|
||||||
if (bSRSStatus && con_check_3rd_srs.Checked)
|
if (ExtSRSStatus && con_check_3rd_srs.Checked)
|
||||||
{
|
{
|
||||||
if (Globals.intSRSErros == 0)
|
if (Globals.ErrorsSRS == 0)
|
||||||
{
|
{
|
||||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
||||||
}
|
}
|
||||||
@@ -428,13 +436,14 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
||||||
}
|
}
|
||||||
Globals.bSRSStatus = bSRSStatus;
|
Globals.StatusSRS = ExtSRSStatus;
|
||||||
}
|
}
|
||||||
if ((bLotATCStatus != Globals.bLotATCStatus) || Globals.bStatusIconsForce)
|
// Update status icons at main form - LotATC
|
||||||
|
if ((ExtLotATCStatus != Globals.StatusLotATC) || Globals.AppForceIconReload)
|
||||||
{
|
{
|
||||||
if (bLotATCStatus && con_check_3rd_lotatc.Checked)
|
if (ExtLotATCStatus && con_check_3rd_lotatc.Checked)
|
||||||
{
|
{
|
||||||
if (Globals.intLotATCErros == 0)
|
if (Globals.ErrorsLotATC == 0)
|
||||||
{
|
{
|
||||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_connected");
|
||||||
}
|
}
|
||||||
@@ -447,140 +456,185 @@ namespace Perun_v1
|
|||||||
{
|
{
|
||||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("status_disconnected_error");
|
||||||
}
|
}
|
||||||
Globals.bLotATCStatus = bLotATCStatus;
|
Globals.StatusLotATC = ExtLotATCStatus;
|
||||||
}
|
}
|
||||||
Globals.bStatusIconsForce = false;
|
Globals.AppForceIconReload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Tim_MySQL_Tick(object sender, EventArgs e)
|
private void Tim_MySQL_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Send buffer to MySQL
|
// Send buffer to MySQL
|
||||||
for (int i = 0; i < arrMySQLSendBuffer.Length - 1; i++)
|
for (int i = 0; i < DatabaseSendBuffer.Length - 1; i++)
|
||||||
{
|
{
|
||||||
if (arrMySQLSendBuffer[i] != null)
|
if (DatabaseSendBuffer[i] != null)
|
||||||
{
|
{
|
||||||
dcConnection.SendToMySql(arrMySQLSendBuffer[i]);
|
if (DatabaseConnection.SendToMySql(DatabaseSendBuffer[i]) > 0)
|
||||||
arrMySQLSendBuffer[i] = null;
|
{
|
||||||
|
DatabaseSendBuffer[i] = null; // If packet was send then delete it from send buffer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tim_3rdparties_Tick(object sender, EventArgs e)
|
private void tim_3rdparties_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Main timer to send JSON files to MySQL
|
// Main timer to check MySQL connection and send JSON files to MySQL
|
||||||
string strSRSJson = "";
|
|
||||||
string strLotATCJson = "";
|
|
||||||
|
|
||||||
bool boolSRSdefault = true;
|
// Send ping to check for possible connection issues
|
||||||
bool boolLotATCdefault = true;
|
DatabaseConnection.SendToMySql("", true);
|
||||||
|
|
||||||
|
if (PerunHelper.CheckVersions()==0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Version mismatch detected - please check log files and update.\n\nPerun will now terminate.", "Perun ERROR!",MessageBoxButtons.OK,MessageBoxIcon.Error);
|
||||||
|
con_Button_Listen_OFF_Click(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take care of 3rd party stuff
|
||||||
|
string ExtSRSJson = "";
|
||||||
|
string ExtLotATCJson = "";
|
||||||
|
|
||||||
|
bool ExtSRSUseDefault = true;
|
||||||
|
bool ExtLotATCUseDefault = true;
|
||||||
|
|
||||||
// Handle SRS
|
// Handle SRS
|
||||||
if (con_check_3rd_srs.Checked)
|
if (Globals.StatusConnection)
|
||||||
{
|
{
|
||||||
try
|
if (con_check_3rd_srs.Checked)
|
||||||
{
|
{
|
||||||
strSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
try
|
||||||
dynamic raw_lotatc = JsonConvert.DeserializeObject(strSRSJson);
|
|
||||||
|
|
||||||
for (int i = 0; i < raw_lotatc.Count; i++)
|
|
||||||
{
|
{
|
||||||
|
ExtSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
||||||
|
dynamic raw_lotatc = JsonConvert.DeserializeObject(ExtSRSJson);
|
||||||
|
|
||||||
if (raw_lotatc[i].RadioInfo != null)
|
for (int i = 0; i < raw_lotatc.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
int temp = raw_lotatc[i].RadioInfo.radios.Count - 1;
|
if (raw_lotatc[i].RadioInfo != null)
|
||||||
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")
|
int temp = raw_lotatc[i].RadioInfo.radios.Count - 1;
|
||||||
|
for (int j = temp; j >= 0; j--)
|
||||||
{
|
{
|
||||||
raw_lotatc[i].RadioInfo.radios[j].Remove();
|
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();
|
||||||
}
|
}
|
||||||
raw_lotatc[i].ClientChannelId.Parent.Remove();
|
|
||||||
raw_lotatc[i].RadioInfo.simultaneousTransmission.Parent.Remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (raw_lotatc.Count > 0)
|
||||||
|
{
|
||||||
|
ExtSRSJson = JsonConvert.SerializeObject(raw_lotatc);
|
||||||
|
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + ExtSRSJson + "'}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'false'}}"; // No SRS clients connected
|
||||||
|
}
|
||||||
|
ExtSRSUseDefault = false;
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data loaded", 3, 0, "100", true);
|
||||||
|
ExtSRSStatus = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc_srs)
|
||||||
|
{
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data ERROR , error: " + exc_srs.Message, 3, 1, "100");
|
||||||
|
ExtSRSStatus = false;
|
||||||
|
Globals.ErrorsSRS++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raw_lotatc.Count > 0)
|
|
||||||
{
|
|
||||||
strSRSJson = JsonConvert.SerializeObject(raw_lotatc);
|
|
||||||
strSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + strSRSJson + "'}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'false'}}"; // No SRS clients connected
|
|
||||||
}
|
|
||||||
boolSRSdefault = false;
|
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Int32.Parse(con_txt_dcs_instance.Text) + " > SRS data loaded");
|
|
||||||
bSRSStatus = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception exc_srs)
|
if (ExtSRSUseDefault)
|
||||||
{
|
{
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Int32.Parse(con_txt_dcs_instance.Text) + " > SRS data ERROR > " + exc_srs.Message);
|
ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}";
|
||||||
bSRSStatus = false;
|
|
||||||
Globals.intSRSErros++;
|
|
||||||
}
|
}
|
||||||
|
DatabaseConnection.SendToMySql(ExtSRSJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (boolSRSdefault)
|
|
||||||
{
|
|
||||||
strSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}";
|
|
||||||
}
|
|
||||||
dcConnection.SendToMySql(strSRSJson);
|
|
||||||
|
|
||||||
// Handle LotATC
|
// Handle LotATC
|
||||||
if (con_check_3rd_lotatc.Checked)
|
if (Globals.StatusConnection)
|
||||||
{
|
{
|
||||||
try
|
if (con_check_3rd_lotatc.Checked)
|
||||||
{
|
{
|
||||||
strLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text);
|
try
|
||||||
dynamic raw_srs = JsonConvert.DeserializeObject(strLotATCJson);
|
{
|
||||||
|
ExtLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text);
|
||||||
|
dynamic raw_srs = JsonConvert.DeserializeObject(ExtLotATCJson);
|
||||||
|
|
||||||
|
ExtLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + ExtLotATCJson + "'}";
|
||||||
|
ExtLotATCUseDefault = false;
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "LotATC data loaded", 3, 0, "101", true);
|
||||||
|
ExtLotATCStatus = true;
|
||||||
|
}
|
||||||
|
catch (Exception exc_lotatc)
|
||||||
|
{
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "LotATC data ERROR, error: " + exc_lotatc.Message, 3, 1, "101");
|
||||||
|
ExtLotATCStatus = false;
|
||||||
|
Globals.ErrorsLotATC++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
strLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + strLotATCJson + "'}";
|
|
||||||
boolLotATCdefault = false;
|
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Int32.Parse(con_txt_dcs_instance.Text) + " > LotATC data loaded");
|
|
||||||
bLotATCStatus = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception exc_lotatc)
|
if (ExtLotATCUseDefault)
|
||||||
{
|
{
|
||||||
PerunHelper.GUILogHistoryAdd(ref Globals.arrGUILogHistory, "#" + Int32.Parse(con_txt_dcs_instance.Text) + " > LotATC data ERROR > " + exc_lotatc.Message);
|
ExtLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}"; // No LotATC controller connected
|
||||||
bLotATCStatus = false;
|
|
||||||
Globals.intLotATCErros++;
|
|
||||||
}
|
}
|
||||||
|
DatabaseConnection.SendToMySql(ExtLotATCJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (boolLotATCdefault)
|
|
||||||
{
|
|
||||||
strLotATCJson = "{'type':'101','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'true'}}"; // No LotATC controller connected
|
|
||||||
}
|
|
||||||
dcConnection.SendToMySql(strLotATCJson);
|
|
||||||
|
|
||||||
// Let's do not risk int overload
|
// Let's do not risk int overload
|
||||||
Globals.intMysqlErros = (Globals.intMysqlErros > 999) ? 999 : Globals.intMysqlErros;
|
Globals.ErrorsDatabase = (Globals.ErrorsDatabase > 999) ? 999 : Globals.ErrorsDatabase;
|
||||||
Globals.intGameErros = (Globals.intGameErros > 999) ? 999 : Globals.intGameErros;
|
Globals.ErrorsGame = (Globals.ErrorsGame > 999) ? 999 : Globals.ErrorsGame;
|
||||||
Globals.intSRSErros = (Globals.intSRSErros > 999) ? 999 : Globals.intSRSErros;
|
Globals.ErrorsSRS = (Globals.ErrorsSRS > 999) ? 999 : Globals.ErrorsSRS;
|
||||||
Globals.intLotATCErros = (Globals.intLotATCErros > 999) ? 999 : Globals.intLotATCErros;
|
Globals.ErrorsLotATC = (Globals.ErrorsLotATC > 999) ? 999 : Globals.ErrorsLotATC;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void con_Button_Reset_Flags_Click(object sender, EventArgs e)
|
||||||
private void con_List_Received_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
|
// Reset error flags
|
||||||
|
DialogResult dialogResult = MessageBox.Show("Are you sure to reset error flags?", "Question", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
|
||||||
|
if (dialogResult == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
// Reset errors counter
|
||||||
|
Globals.ErrorsDatabase = 0; // MySQL - Error counter
|
||||||
|
Globals.ErrorsGame = 0; // TCP connection - Error counter
|
||||||
|
Globals.ErrorsHistoryGame = 0; // TCP connection - historic value of Error counter
|
||||||
|
Globals.ErrorsSRS = 0; // DCS SRS - error counter
|
||||||
|
Globals.ErrorsLotATC = 0; // LotATC - error counter
|
||||||
|
|
||||||
|
// Force icons reload
|
||||||
|
Globals.AppForceIconReload = true;
|
||||||
|
|
||||||
|
// Add information
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "Resetted error counter",0,1);
|
||||||
|
}
|
||||||
|
else if (dialogResult == DialogResult.No)
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void con_Button_Add_Marker_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Added user marker
|
||||||
|
PerunHelper.AddLog(ref Globals.AppLogHistory, "User Marker",0,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,6 +419,9 @@
|
|||||||
<metadata name="tim_MySQL.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="tim_MySQL.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>687, 19</value>
|
<value>687, 19</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>26</value>
|
||||||
|
</metadata>
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
AAABAAEAQD8AAAEAIAAgQQAAFgAAACgAAABAAAAAfgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
AAABAAEAQD8AAAEAIAAgQQAAFgAAACgAAABAAAAAfgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||||
|
|||||||
BIN
02_Windows_App/Perun_v1/03_Resources/perun_logo.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 909 B After Width: | Height: | Size: 909 B |
@@ -34,7 +34,7 @@
|
|||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>Perun.htm</WebPage>
|
<WebPage>Perun.htm</WebPage>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>0.8.2.%2a</ApplicationVersion>
|
<ApplicationVersion>0.8.3.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@@ -131,25 +131,23 @@
|
|||||||
<Compile Include="01_Classes\PerunHelper.cs" />
|
<Compile Include="01_Classes\PerunHelper.cs" />
|
||||||
<Compile Include="02_Forms\form_Main.cs">
|
<Compile Include="02_Forms\form_Main.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="02_Forms\form_Main.Designer.cs">
|
<Compile Include="02_Forms\form_Main.Designer.cs">
|
||||||
<DependentUpon>form_Main.cs</DependentUpon>
|
<DependentUpon>form_Main.cs</DependentUpon>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="01_Classes\Program.cs" />
|
<Compile Include="01_Classes\Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="02_Forms\form_Main.resx">
|
<EmbeddedResource Include="02_Forms\form_Main.resx">
|
||||||
<DependentUpon>form_Main.cs</DependentUpon>
|
<DependentUpon>form_Main.cs</DependentUpon>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
</Compile>
|
|
||||||
<None Include="00_Config\packages.config" />
|
<None Include="00_Config\packages.config" />
|
||||||
<None Include="00_Config\Perun_v1_TemporaryKey.pfx" />
|
<None Include="00_Config\Perun_v1_TemporaryKey.pfx" />
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
@@ -159,6 +157,11 @@
|
|||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
@@ -182,17 +185,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="03_Resources\perun_logo.ico" />
|
<Content Include="03_Resources\perun_logo.ico" />
|
||||||
<None Include="Resources\status-connectedx.png" />
|
<None Include="03_Resources\perun_logo.png" />
|
||||||
<None Include="Resources\status-disconnected-game.png" />
|
<None Include="Resources\perun_logo.png" />
|
||||||
|
<None Include="Resources\status-connected-error.png" />
|
||||||
<None Include="Resources\status-disconnected-error.png" />
|
<None Include="Resources\status-disconnected-error.png" />
|
||||||
<None Include="Resources\status-disconnected.png" />
|
<None Include="Resources\status-disconnected.png" />
|
||||||
<None Include="Resources\status-connected.png" />
|
<None Include="Resources\status-connected.png" />
|
||||||
<None Include="Resources\ico_error.png" />
|
|
||||||
<None Include="Resources\ico_srs.png" />
|
|
||||||
<None Include="Resources\ico_lotatc.png" />
|
|
||||||
<None Include="Resources\ico_game.png" />
|
|
||||||
<None Include="Resources\ico_db.png" />
|
|
||||||
<None Include="Resources\img_db.png" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -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.8.2.0")]
|
[assembly: AssemblyVersion("0.8.3.0")]
|
||||||
[assembly: AssemblyFileVersion("0.8.2.0")]
|
[assembly: AssemblyFileVersion("0.8.3.0")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ namespace Perun_v1.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap perun_logo {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("perun_logo", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -118,16 +118,19 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="perun_logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\03_Resources\perun_logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="status_connected" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="status_connected" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\status-connected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\03_Resources\status-connected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="status_connected_error" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="status_connected_error" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\status-connectedx.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\03_Resources\status-connected-error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="status_disconnected" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="status_disconnected" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\status-disconnected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\03_Resources\status-disconnected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="status_disconnected_error" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="status_disconnected_error" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\status-disconnected-error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\03_Resources\status-disconnected-error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -8,6 +8,45 @@ SET time_zone = "+00:00";
|
|||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
/*!40101 SET NAMES utf8mb4 */;
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS `m1081_perun` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||||
|
USE `m1081_perun`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
DROP PROCEDURE IF EXISTS `sp_CleanDatabase`$$
|
||||||
|
CREATE DEFINER=`m1081`@`%.devil` PROCEDURE `sp_CleanDatabase` () MODIFIES SQL DATA
|
||||||
|
BEGIN
|
||||||
|
DELETE FROM pe_DataMissionHashes;
|
||||||
|
DELETE FROM pe_DataPlayers;
|
||||||
|
DELETE FROM pe_DataRaw;
|
||||||
|
DELETE FROM pe_LogChat;
|
||||||
|
DELETE FROM pe_LogEvent;
|
||||||
|
DELETE FROM pe_LogLogins;
|
||||||
|
DELETE FROM pe_LogStats;
|
||||||
|
|
||||||
|
ALTER TABLE pe_DataMissionHashes AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE pe_DataPlayers AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE pe_DataRaw AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE pe_LogChat AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE pe_LogEvent AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE pe_LogLogins AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE pe_LogStats AUTO_INCREMENT = 1;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DROP PROCEDURE IF EXISTS `sp_SyncForumGame`$$
|
||||||
|
$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `pe_Config`;
|
||||||
|
CREATE TABLE IF NOT EXISTS `pe_Config` (
|
||||||
|
`pe_Config_id` int(11) NOT NULL,
|
||||||
|
`pe_Config_payload` varchar(255) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`pe_Config_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
INSERT INTO `pe_Config` (`pe_Config_id`, `pe_Config_payload`) VALUES
|
||||||
|
(1, 'v0.8.3');
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_DataMissionHashes`;
|
DROP TABLE IF EXISTS `pe_DataMissionHashes`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
||||||
@@ -18,7 +57,7 @@ CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
|
|||||||
PRIMARY KEY (`pe_DataMissionHashes_id`),
|
PRIMARY KEY (`pe_DataMissionHashes_id`),
|
||||||
UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
|
UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
|
||||||
KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
|
KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=818 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_DataPlayers`;
|
DROP TABLE IF EXISTS `pe_DataPlayers`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_DataPlayers` (
|
CREATE TABLE IF NOT EXISTS `pe_DataPlayers` (
|
||||||
@@ -29,7 +68,7 @@ CREATE TABLE IF NOT EXISTS `pe_DataPlayers` (
|
|||||||
`pe_DataPlayers_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`pe_DataPlayers_updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`pe_DataPlayers_id`),
|
PRIMARY KEY (`pe_DataPlayers_id`),
|
||||||
UNIQUE KEY `UNIQUE_UCID` (`pe_DataPlayers_ucid`)
|
UNIQUE KEY `UNIQUE_UCID` (`pe_DataPlayers_ucid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=219 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_DataRaw`;
|
DROP TABLE IF EXISTS `pe_DataRaw`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_DataRaw` (
|
CREATE TABLE IF NOT EXISTS `pe_DataRaw` (
|
||||||
@@ -47,7 +86,7 @@ CREATE TABLE IF NOT EXISTS `pe_DataTypes` (
|
|||||||
`pe_DataTypes_update` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`pe_DataTypes_update` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`pe_DataTypes_id`),
|
PRIMARY KEY (`pe_DataTypes_id`),
|
||||||
UNIQUE KEY `UNIQUE_TYPE_NAME` (`pe_DataTypes_name`)
|
UNIQUE KEY `UNIQUE_TYPE_NAME` (`pe_DataTypes_name`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogChat`;
|
DROP TABLE IF EXISTS `pe_LogChat`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
||||||
@@ -61,7 +100,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogChat` (
|
|||||||
KEY `pe_LogChat_missionhash_id` (`pe_LogChat_missionhash_id`),
|
KEY `pe_LogChat_missionhash_id` (`pe_LogChat_missionhash_id`),
|
||||||
KEY `pe_LogChat_playerid` (`pe_LogChat_playerid`),
|
KEY `pe_LogChat_playerid` (`pe_LogChat_playerid`),
|
||||||
KEY `pe_LogChat_datetime` (`pe_LogChat_datetime`)
|
KEY `pe_LogChat_datetime` (`pe_LogChat_datetime`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=19739 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogEvent`;
|
DROP TABLE IF EXISTS `pe_LogEvent`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
||||||
@@ -75,7 +114,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogEvent` (
|
|||||||
PRIMARY KEY (`pe_LogEvent_id`),
|
PRIMARY KEY (`pe_LogEvent_id`),
|
||||||
KEY `pe_LogEvent_missionhash_id` (`pe_LogEvent_missionhash_id`),
|
KEY `pe_LogEvent_missionhash_id` (`pe_LogEvent_missionhash_id`),
|
||||||
KEY `pe_LogEvent_datetime` (`pe_LogEvent_datetime`)
|
KEY `pe_LogEvent_datetime` (`pe_LogEvent_datetime`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=93657 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogLogins`;
|
DROP TABLE IF EXISTS `pe_LogLogins`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
||||||
@@ -88,7 +127,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogLogins` (
|
|||||||
PRIMARY KEY (`pe_LogLogins_id`),
|
PRIMARY KEY (`pe_LogLogins_id`),
|
||||||
KEY `pe_LogLogins_playerid` (`pe_LogLogins_playerid`),
|
KEY `pe_LogLogins_playerid` (`pe_LogLogins_playerid`),
|
||||||
KEY `pe_LogLogins_datetime` (`pe_LogLogins_datetime`)
|
KEY `pe_LogLogins_datetime` (`pe_LogLogins_datetime`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=10742 DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `pe_LogStats`;
|
DROP TABLE IF EXISTS `pe_LogStats`;
|
||||||
CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
||||||
@@ -132,7 +171,7 @@ CREATE TABLE IF NOT EXISTS `pe_LogStats` (
|
|||||||
KEY `pe_LogStats_missionhash_id` (`pe_LogStats_missionhash_id`),
|
KEY `pe_LogStats_missionhash_id` (`pe_LogStats_missionhash_id`),
|
||||||
KEY `pe_LogStats_playerid` (`pe_LogStats_playerid`),
|
KEY `pe_LogStats_playerid` (`pe_LogStats_playerid`),
|
||||||
KEY `pe_LogStats_typeid` (`pe_LogStats_typeid`)
|
KEY `pe_LogStats_typeid` (`pe_LogStats_typeid`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=9595 DEFAULT CHARSET=utf8;
|
||||||
DROP TRIGGER IF EXISTS `pe_LogStats_UPDATE`;
|
DROP TRIGGER IF EXISTS `pe_LogStats_UPDATE`;
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE TRIGGER `pe_LogStats_UPDATE` BEFORE UPDATE ON `pe_LogStats` FOR EACH ROW BEGIN
|
CREATE TRIGGER `pe_LogStats_UPDATE` BEFORE UPDATE ON `pe_LogStats` FOR EACH ROW BEGIN
|
||||||
|
|||||||
27
README.md
@@ -2,20 +2,19 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
# Perun for DCS World
|
# Perun for DCS World
|
||||||
|
|
||||||
Included lua script extracts data from DCS World multiplayer server and sends information to TCP port and JSON file for further processing.
|
Included lua script extracts data from DCS World multiplayer server and sends information to TCP port and JSON file for further processing.
|
||||||
|
|
||||||
Provided windows app puts received TCP packets to MySQL database; additionaly Perun windows application can be used to merge LotATC and DCS SRS data in one database making Perun for DCS World wannabe ultimate integration tool for the server admins.
|
Provided windows app puts received TCP packets to MySQL database; additionaly Perun windows application can be used to merge LotATC and DCS SRS data in one database making Perun for DCS World wannabe ultimate integration tool for the server admins.
|
||||||
|
|
||||||
However, this software is intended to be used by experienced users - the output is MySQL data and/or JSON file; you will need to process/display it yourself.
|
However, this software is intended to be used by experienced users - the output is MySQL data and/or JSON file; you will need to process/display it yourself.
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
Core:
|
Core:
|
||||||
* For JSON Export:
|
* For JSON Export:
|
||||||
* DCS World stable or DCS World beta
|
* DCS World stable or DCS World beta
|
||||||
@@ -28,7 +27,6 @@ Core:
|
|||||||
* for [LotATC](https://www.lotatc.com/) you will need location of stats.json file and proper LotATC configuration with JSON data export enabled - see [LotATC documentation](https://www.lotatc.com/documentation/server_configuration.html)
|
* for [LotATC](https://www.lotatc.com/) you will need location of stats.json file and proper LotATC configuration with JSON data export enabled - see [LotATC documentation](https://www.lotatc.com/documentation/server_configuration.html)
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
* Download latest [release](https://github.com/szporwolik/perun/releases)
|
* Download latest [release](https://github.com/szporwolik/perun/releases)
|
||||||
* Copy contents of [01_DCS](https://github.com/szporwolik/perun/tree/master/01_DCS) to your \Scripts folder (located inside DCS folder in your Saved Games)
|
* Copy contents of [01_DCS](https://github.com/szporwolik/perun/tree/master/01_DCS) to your \Scripts folder (located inside DCS folder in your Saved Games)
|
||||||
* **optionaly** create MySQL database using SQL script located in [03_MySQL](https://github.com/szporwolik/perun/tree/master/03_MySQL); note that you need just a one database per DCS server machine - multiple instances pushing data to the one database are supported
|
* **optionaly** create MySQL database using SQL script located in [03_MySQL](https://github.com/szporwolik/perun/tree/master/03_MySQL); note that you need just a one database per DCS server machine - multiple instances pushing data to the one database are supported
|
||||||
@@ -57,6 +55,15 @@ Example for windows shortcut:
|
|||||||
```
|
```
|
||||||
C:\Perun_v1\Perun.exe 48621 1 "G:\DCS SRS\clients-list.json" "C:\Users\DCS\Saved Games\DCS\Mods\tech\LotAtc\stats.json"
|
C:\Perun_v1\Perun.exe 48621 1 "G:\DCS SRS\clients-list.json" "C:\Users\DCS\Saved Games\DCS\Mods\tech\LotAtc\stats.json"
|
||||||
```
|
```
|
||||||
|
## Troubleshooting - FAQ
|
||||||
|
- [I keep getting 1305 MySQL error](#i-keep-getting-1305-mysql-error)
|
||||||
|
- [Carrier landing are not tracked correctly](#carrier-landing-are-not-tracked-correctly)
|
||||||
|
|
||||||
|
### I keep getting 1305 MySQL error
|
||||||
|
That probably means that your database does not support JSON functions, you shall upgrade your MySQL server to at lease 5.7 version.
|
||||||
|
|
||||||
|
### Carrier landing are not tracked correctly
|
||||||
|
DCS API does not track carrier landing natively, so there is a trick to achive that. You shall set your carrier to a propoer group name to have landings tracked.
|
||||||
|
|
||||||
# API documentation (for expert users)
|
# API documentation (for expert users)
|
||||||
## MySQL database structure
|
## MySQL database structure
|
||||||
@@ -95,32 +102,24 @@ C:\Perun_v1\Perun.exe 48621 1 "G:\DCS SRS\clients-list.json" "C:\Users\DCS\Saved
|
|||||||
|
|
||||||
# Project information
|
# Project information
|
||||||
## Built With
|
## Built With
|
||||||
|
|
||||||
* [VisualStudio 2017 Community](https://visualstudio.microsoft.com/vs/community/)
|
* [VisualStudio 2017 Community](https://visualstudio.microsoft.com/vs/community/)
|
||||||
* [Notepad++](https://notepad-plus-plus.org/)
|
* [Notepad++](https://notepad-plus-plus.org/)
|
||||||
|
|
||||||
## used 3rd party resources
|
|
||||||
|
|
||||||
* [Tango Icon Library](http://tango.freedesktop.org/Tango_Icon_Library)
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Please contact me if you'd like to contribute.
|
Please contact me if you'd like to contribute.
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/szporwolik/perun/tags).
|
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/szporwolik/perun/tags).
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
* **Szymon Porwolik** - *Initial work* - [szporwolik](https://github.com/szporwolik)
|
* **Szymon Porwolik** - *Initial work* - [szporwolik](https://github.com/szporwolik)
|
||||||
|
|
||||||
See also the list of [contributors](https://github.com/szporwolik/perun/contributors) who participated in this project.
|
See also the list of [contributors](https://github.com/szporwolik/perun/contributors) who participated in this project.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||||
|
|
||||||
## Acknowledgments
|
## Acknowledgments
|
||||||
|

|
||||||
|
|
||||||
* Thanks to [Gildia DCS](https://forum.gildia.org) Polish community of DCS World pilots.
|
Thanks to [Gildia DCS](https://forum.gildia.org) Polish community of DCS World pilots.
|
||||||
|
|||||||