Fixed: raw data to db

This commit is contained in:
VladMordock
2021-02-18 01:29:01 +01:00
parent bfc846c35c
commit 50e41c394d
6 changed files with 140 additions and 52 deletions

View File

@@ -44,7 +44,17 @@ public class DatabaseController
int LogDirection = 1; int LogDirection = 1;
MySqlCommand DatabaseCommand = null; MySqlCommand DatabaseCommand = null;
// Add parameters - prevent SQL injection // For frames 1 to 10 we will put those into data raw tables
if (Int32.Parse(TCPFrameType) >= 1 && Int32.Parse(TCPFrameType) <= 10)
{
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 + ");";
SQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = @PAR_TCPFramePayload, `pe_dataraw_updated`=" + TCPFrameTimestamp + " WHERE `pe_dataraw_type`=" + TCPFrameType + " AND `pe_dataraw_instance` = " + TCPFrameInstance + ";";
}
else
{
SQLQueryTxt = "";
}
switch (Int32.Parse(TCPFrameType)) switch (Int32.Parse(TCPFrameType))
{ {
case -1: case -1:
@@ -58,7 +68,7 @@ public class DatabaseController
break; break;
case 1: case 1:
// General status information // General status information (diagnostic information)
LogInfo = $"Players data received"; LogInfo = $"Players data received";
TCPFrame.payload["v_win"] = "v" + Globals.VersionPerun; // Inject app version information (for database) TCPFrame.payload["v_win"] = "v" + Globals.VersionPerun; // Inject app version information (for database)
@@ -68,11 +78,13 @@ public class DatabaseController
SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_perunversion_winapp` = '" + TCPFrame.payload.v_win + "', `pe_OnlineStatus_perunversion_dcshook` ='" + TCPFrame.payload.v_dcs_hook + "' WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "' ;"; SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_perunversion_winapp` = '" + TCPFrame.payload.v_win + "', `pe_OnlineStatus_perunversion_dcshook` ='" + TCPFrame.payload.v_dcs_hook + "' WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "' ;";
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection); DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload);
break; break;
case 2: case 2:
// Mission Data // Status Data (basic mission etc)
LogInfo = $"Mission data received"; LogInfo = $"Mission data received";
SQLQueryTxt += "DELETE FROM pe_OnlinePlayers WHERE pe_OnlinePlayers_instance = " + Int32.Parse(TCPFrameInstance) + ";"; SQLQueryTxt += "DELETE FROM pe_OnlinePlayers WHERE pe_OnlinePlayers_instance = " + Int32.Parse(TCPFrameInstance) + ";";
@@ -90,6 +102,8 @@ public class DatabaseController
SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_theatre` = '" + TCPFrame.payload.mission.theatre + "', `pe_OnlineStatus_name` = '" + TCPFrame.payload.mission.name + "' , `pe_OnlineStatus_pause` = '" + TCPFrame.payload.mission.pause + "', `pe_OnlineStatus_multiplayer` = '" + TCPFrame.payload.mission.multiplayer + "', `pe_OnlineStatus_realtime` = '" + TCPFrame.payload.mission.realtime + "', `pe_OnlineStatus_modeltime` = '" + TCPFrame.payload.mission.modeltime + "', `pe_OnlineStatus_players` = " + player_count + " WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "';"; SQLQueryTxt += "UPDATE `pe_OnlineStatus` SET `pe_OnlineStatus_theatre` = '" + TCPFrame.payload.mission.theatre + "', `pe_OnlineStatus_name` = '" + TCPFrame.payload.mission.name + "' , `pe_OnlineStatus_pause` = '" + TCPFrame.payload.mission.pause + "', `pe_OnlineStatus_multiplayer` = '" + TCPFrame.payload.mission.multiplayer + "', `pe_OnlineStatus_realtime` = '" + TCPFrame.payload.mission.realtime + "', `pe_OnlineStatus_modeltime` = '" + TCPFrame.payload.mission.modeltime + "', `pe_OnlineStatus_players` = " + player_count + " WHERE `pe_OnlineStatus_instance` = '" + Int32.Parse(TCPFrameInstance) + "';";
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection); DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload);
// Save for GUI // Save for GUI
Globals.CurrentMission.Theatre = TCPFrame.payload.mission.theatre; // Mission theatre Globals.CurrentMission.Theatre = TCPFrame.payload.mission.theatre; // Mission theatre
@@ -99,7 +113,15 @@ public class DatabaseController
Globals.CurrentMission.ModelTime = TCPFrame.payload.mission.modeltime; // Mission time Globals.CurrentMission.ModelTime = TCPFrame.payload.mission.modeltime; // Mission time
Globals.CurrentMission.RealTime = TCPFrame.payload.mission.realtime; // Since start of server Globals.CurrentMission.RealTime = TCPFrame.payload.mission.realtime; // Since start of server
break; break;
case 3:
// Slots Data (basic mission etc)
LogInfo = $"Slots data received";
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload);
break;
case 50: case 50:
// Chat entry // Chat entry
LogInfo = $"Player \"{TCPFrame.payload.player}\" -> chat message saved"; LogInfo = $"Player \"{TCPFrame.payload.player}\" -> chat message saved";
@@ -167,9 +189,6 @@ public class DatabaseController
// Switch to insert correct log information // Switch to insert correct log information
switch (Int32.Parse(TCPFrameType)) switch (Int32.Parse(TCPFrameType))
{ {
case 3:
LogInfo = "Slots data received";
break;
case 100: case 100:
LogInfo = "DCS SRS data send"; LogInfo = "DCS SRS data send";
break; break;
@@ -184,10 +203,9 @@ public class DatabaseController
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 + ");"; 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 + ");";
SQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = @PAR_TCPFramePayload, `pe_dataraw_updated`=" + TCPFrameTimestamp + " WHERE `pe_dataraw_type`=" + TCPFrameType + " AND `pe_dataraw_instance` = " + TCPFrameInstance + ";"; SQLQueryTxt += "UPDATE `pe_DataRaw` SET `pe_dataraw_payload` = @PAR_TCPFramePayload, `pe_dataraw_updated`=" + TCPFrameTimestamp + " WHERE `pe_dataraw_type`=" + TCPFrameType + " AND `pe_dataraw_instance` = " + TCPFrameInstance + ";";
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection); DatabaseCommand = new MySqlCommand(SQLQueryTxt, DatabaseConnection);
TCPFramePayload = JsonConvert.SerializeObject(TCPFrame.payload); // Deserialize payload
DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload); DatabaseCommand.Parameters.AddWithValue("@PAR_TCPFramePayload", TCPFramePayload);
break; break;

View File

@@ -81,6 +81,12 @@ internal class Globals
public static string LastLogLocation = ""; // Last used log location public static string LastLogLocation = ""; // Last used log location
public static bool RotateLogs = false; // Rotate logs true/false public static bool RotateLogs = false; // Rotate logs true/false
public static float LastFrameTime = 0f; // Last recorded frame time
public static float LastFrameDelay = 0f; // Last recorded frame time
public static string[] arrGUILogHistory; // Log history for GUI
public static string[] arrMySQLSendBuffer; // MySQL send buffer
public static CurrentMissionClass CurrentMission = new CurrentMissionClass(); // Actual mission information single ton public static CurrentMissionClass CurrentMission = new CurrentMissionClass(); // Actual mission information single ton
public static HardwareMonitorClass HardwareMonitor = new HardwareMonitorClass(); // Hardware monitor singleton public static HardwareMonitorClass HardwareMonitor = new HardwareMonitorClass(); // Hardware monitor singleton

View File

@@ -5,6 +5,12 @@ using System.Text.RegularExpressions;
internal class PerunHelper internal class PerunHelper
{ {
public static void SetFrameRates(float frame_rate, float last_delay)
{
Globals.LastFrameTime = frame_rate;
Globals.LastFrameDelay = last_delay;
}
// Add error infomation // Add error infomation
public static void LogError(ref string[] arrLogHistory, string strEntryToAdd, int intDirection = 0, int intMarker = 0, string strType = " ", bool bSkipGui = false) public static void LogError(ref string[] arrLogHistory, string strEntryToAdd, int intDirection = 0, int intMarker = 0, string strType = " ", bool bSkipGui = false)
{ {
@@ -92,7 +98,7 @@ internal class PerunHelper
Globals.AppUpdateGUI = true; Globals.AppUpdateGUI = true;
} }
// Add the entry to log file // Add the entry to log file
LogController.instance.WriteLog(logLevel, $"{DateTime.Now.ToString("yyyy-MM-dd ")} {DateTime.Now.ToString("HH:mm:ss.fff")} | {Globals.HardwareMonitor.LastCurrentCpuUsage} | {Globals.HardwareMonitor.LastCurrentRamUsage} | {Globals.AppInstanceID} | {LogMarker} | {LogDirection} | {strType} | {strEntryToAdd}"); LogController.instance.WriteLog(logLevel, $"{DateTime.Now.ToString("yyyy-MM-dd ")} {DateTime.Now.ToString("HH:mm:ss.fff")} | {Globals.HardwareMonitor.LastCurrentCpuUsage} | {Globals.HardwareMonitor.LastCurrentRamUsage} | {Globals.LastFrameTime.ToString("0.00")} | {Globals.LastFrameDelay.ToString("0.00")} | {Globals.AppInstanceID} | {LogMarker} | {LogDirection} | {strType} | {strEntryToAdd}");
} }
// Gets build version // Gets build version

View File

@@ -12,16 +12,15 @@ public class TCPController
// Main class for TCP listener // Main class for TCP listener
public int intListenPort; // Port to connect to public int intListenPort; // Port to connect to
public bool bCloseConnection; // Helper to exit main loop without killing thread public bool bCloseConnection; // Helper to exit main loop without killing thread
public string[] arrGUILogHistory; // Log history for GUI
public string[] arrMySQLSendBuffer; // MySQL send buffer
public Thread thrTCPListener; // Seperate thread for TCP public Thread thrTCPListener; // Seperate thread for TCP
public void Create(int par_intListenPort, ref string[] par_arrLogHistory, ref string[] par_arrSendBuffer) public void Create(int par_intListenPort, ref string[] par_arrLogHistory, ref string[] par_arrSendBuffer)
{ {
// Create class and map creation arguments to class // Create class and map creation arguments to class
intListenPort = par_intListenPort; intListenPort = par_intListenPort;
arrGUILogHistory = par_arrLogHistory; Globals.arrGUILogHistory = par_arrLogHistory;
arrMySQLSendBuffer = par_arrSendBuffer; Globals.arrMySQLSendBuffer = par_arrSendBuffer;
bCloseConnection = false; bCloseConnection = false;
} }
@@ -31,9 +30,9 @@ public class TCPController
bCloseConnection = true; bCloseConnection = true;
// Clear send buffer // Clear send buffer
for (int i = 0; i < arrMySQLSendBuffer.Length - 1; i++) for (int i = 0; i < Globals.arrMySQLSendBuffer.Length - 1; i++)
{ {
arrMySQLSendBuffer[i] = null; // Empty send buffer Globals.arrMySQLSendBuffer[i] = null; // Empty send buffer
} }
} }
@@ -126,25 +125,30 @@ public class TCPController
if (Int32.Parse(strRawTCPFrameType) != 0) if (Int32.Parse(strRawTCPFrameType) != 0)
{ {
// Add to mySQL send buffer (find first empty slot) // Add to mySQL send buffer (find first empty slot)
PerunHelper.LogDebug(ref arrGUILogHistory, "Packet received" , 2,0, strRawTCPFrameType); PerunHelper.LogDebug(ref Globals.arrGUILogHistory, "Packet received" , 2,0, strRawTCPFrameType);
bool AddedDataToBuffer = false; bool AddedDataToBuffer = false;
for (int i = 0; i < arrMySQLSendBuffer.Length - 1; i++) for (int i = 0; i < Globals.arrMySQLSendBuffer.Length - 1; i++)
{ {
if (arrMySQLSendBuffer[i] == null) if (Globals.arrMySQLSendBuffer[i] == null)
{ {
arrMySQLSendBuffer[i] = strReceivedData; Globals.arrMySQLSendBuffer[i] = strReceivedData;
AddedDataToBuffer = true; AddedDataToBuffer = true;
break; break;
} }
} }
if (!AddedDataToBuffer) if (!AddedDataToBuffer)
{ {
PerunHelper.LogError(ref arrGUILogHistory, "ERROR TCP package was dropped", 1, 1, strRawTCPFrameType); PerunHelper.LogError(ref Globals.arrGUILogHistory, "ERROR TCP package was dropped", 1, 1, strRawTCPFrameType);
} }
} else } else
{ {
// Keep alive // Keep alive
PerunHelper.LogDebug(ref arrGUILogHistory, "Keep-alive received", 2,0,"0"); PerunHelper.LogDebug(ref Globals.arrGUILogHistory, "Keep-alive received", 2,0,"0");
}
if (dynamicRawTCPFrame.dcs_frame_time != null && dynamicRawTCPFrame.dcs_current_frame_delay != null)
{
PerunHelper.SetFrameRates((float)dynamicRawTCPFrame.dcs_frame_time, (float)dynamicRawTCPFrame.dcs_current_frame_delay);
} }
} }
else else
@@ -156,7 +160,7 @@ public class TCPController
{ {
Globals.ErrorsGame++; Globals.ErrorsGame++;
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
PerunHelper.LogError(ref arrGUILogHistory, $"ERROR TCP while message parsing , error: {e.Message}",2,1,"?"); PerunHelper.LogError(ref Globals.arrGUILogHistory, $"ERROR TCP while message parsing , error: {e.Message}",2,1,"?");
bTCPConnectionOnline = false; bTCPConnectionOnline = false;
} }
@@ -168,7 +172,7 @@ public class TCPController
catch (SocketException e) catch (SocketException e)
{ {
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
PerunHelper.LogError(ref arrGUILogHistory, $"ERROR TCP cannot check connection, error: {e.Message}",2,1,"?"); PerunHelper.LogError(ref Globals.arrGUILogHistory, $"ERROR TCP cannot check connection, error: {e.Message}",2,1,"?");
} }
} }
@@ -182,7 +186,7 @@ public class TCPController
{ {
Globals.ErrorsGame++; Globals.ErrorsGame++;
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
PerunHelper.LogError(ref arrGUILogHistory, $"ERROR TCP - connection closed or port in use, error: {e.Message}",1,1,"?"); PerunHelper.LogError(ref Globals.arrGUILogHistory, $"ERROR TCP - connection closed or port in use, error: {e.Message}",1,1,"?");
bTCPConnectionOnline = false; bTCPConnectionOnline = false;
} }

View File

@@ -34,6 +34,7 @@
this.con_Button_Listen_ON = new System.Windows.Forms.Button(); this.con_Button_Listen_ON = new System.Windows.Forms.Button();
this.con_Button_Listen_OFF = new System.Windows.Forms.Button(); this.con_Button_Listen_OFF = new System.Windows.Forms.Button();
this.con_GroupBox_1 = new System.Windows.Forms.GroupBox(); this.con_GroupBox_1 = new System.Windows.Forms.GroupBox();
this.con_Button_See_log = new System.Windows.Forms.Button();
this.label15 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label();
this.con_com_loglevel = new System.Windows.Forms.ComboBox(); this.con_com_loglevel = new System.Windows.Forms.ComboBox();
this.con_Button_Add_Marker = new System.Windows.Forms.Button(); this.con_Button_Add_Marker = new System.Windows.Forms.Button();
@@ -83,6 +84,7 @@
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_GroupBox_5 = new System.Windows.Forms.GroupBox(); this.con_GroupBox_5 = new System.Windows.Forms.GroupBox();
this.con_check_delete_logs = new System.Windows.Forms.CheckBox();
this.con_GroupBox_6 = new System.Windows.Forms.GroupBox(); this.con_GroupBox_6 = new System.Windows.Forms.GroupBox();
this.label26 = new System.Windows.Forms.Label(); this.label26 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label(); this.label25 = new System.Windows.Forms.Label();
@@ -100,8 +102,10 @@
this.label27 = new System.Windows.Forms.Label(); this.label27 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label();
this.tim_HW_status = new System.Windows.Forms.Timer(this.components); this.tim_HW_status = new System.Windows.Forms.Timer(this.components);
this.con_Button_See_log = new System.Windows.Forms.Button(); this.label30 = new System.Windows.Forms.Label();
this.con_check_delete_logs = new System.Windows.Forms.CheckBox(); this.label31 = new System.Windows.Forms.Label();
this.label32 = new System.Windows.Forms.Label();
this.label33 = new System.Windows.Forms.Label();
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();
@@ -163,6 +167,18 @@
this.con_GroupBox_1.TabStop = false; this.con_GroupBox_1.TabStop = false;
this.con_GroupBox_1.Text = "Data log"; this.con_GroupBox_1.Text = "Data log";
// //
// con_Button_See_log
//
this.con_Button_See_log.Enabled = false;
this.con_Button_See_log.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.con_Button_See_log.Location = new System.Drawing.Point(170, 12);
this.con_Button_See_log.Name = "con_Button_See_log";
this.con_Button_See_log.Size = new System.Drawing.Size(56, 20);
this.con_Button_See_log.TabIndex = 24;
this.con_Button_See_log.Text = "See log";
this.con_Button_See_log.UseVisualStyleBackColor = true;
this.con_Button_See_log.Click += new System.EventHandler(this.con_Button_See_log_Click);
//
// label15 // label15
// //
this.label15.AutoSize = true; this.label15.AutoSize = true;
@@ -631,6 +647,20 @@
this.con_GroupBox_5.TabStop = false; this.con_GroupBox_5.TabStop = false;
this.con_GroupBox_5.Text = "Other settings"; this.con_GroupBox_5.Text = "Other settings";
// //
// con_check_delete_logs
//
this.con_check_delete_logs.AutoSize = true;
this.con_check_delete_logs.Checked = true;
this.con_check_delete_logs.CheckState = System.Windows.Forms.CheckState.Checked;
this.con_check_delete_logs.Location = new System.Drawing.Point(105, 19);
this.con_check_delete_logs.Name = "con_check_delete_logs";
this.con_check_delete_logs.Size = new System.Drawing.Size(138, 17);
this.con_check_delete_logs.TabIndex = 25;
this.con_check_delete_logs.Text = "Rotate logs after 7 days";
this.con_check_delete_logs.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this.con_check_delete_logs.UseVisualStyleBackColor = true;
this.con_check_delete_logs.Validated += new System.EventHandler(this.con_check_delete_logs_Validated);
//
// con_GroupBox_6 // con_GroupBox_6
// //
this.con_GroupBox_6.Controls.Add(this.label26); this.con_GroupBox_6.Controls.Add(this.label26);
@@ -751,6 +781,10 @@
// //
// con_GroupBox_7 // con_GroupBox_7
// //
this.con_GroupBox_7.Controls.Add(this.label33);
this.con_GroupBox_7.Controls.Add(this.label32);
this.con_GroupBox_7.Controls.Add(this.label31);
this.con_GroupBox_7.Controls.Add(this.label30);
this.con_GroupBox_7.Controls.Add(this.label29); this.con_GroupBox_7.Controls.Add(this.label29);
this.con_GroupBox_7.Controls.Add(this.label28); this.con_GroupBox_7.Controls.Add(this.label28);
this.con_GroupBox_7.Controls.Add(this.label27); this.con_GroupBox_7.Controls.Add(this.label27);
@@ -765,7 +799,7 @@
// label29 // label29
// //
this.label29.AutoSize = true; this.label29.AutoSize = true;
this.label29.Location = new System.Drawing.Point(82, 30); this.label29.Location = new System.Drawing.Point(40, 34);
this.label29.Name = "label29"; this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(37, 13); this.label29.Size = new System.Drawing.Size(37, 13);
this.label29.TabIndex = 34; this.label29.TabIndex = 34;
@@ -774,7 +808,7 @@
// label28 // label28
// //
this.label28.AutoSize = true; this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(82, 16); this.label28.Location = new System.Drawing.Point(40, 16);
this.label28.Name = "label28"; this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(35, 13); this.label28.Size = new System.Drawing.Size(35, 13);
this.label28.TabIndex = 34; this.label28.TabIndex = 34;
@@ -783,7 +817,7 @@
// label27 // label27
// //
this.label27.AutoSize = true; this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(51, 30); this.label27.Location = new System.Drawing.Point(10, 34);
this.label27.Name = "label27"; this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(34, 13); this.label27.Size = new System.Drawing.Size(34, 13);
this.label27.TabIndex = 34; this.label27.TabIndex = 34;
@@ -793,7 +827,7 @@
// label20 // label20
// //
this.label20.AutoSize = true; this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(53, 16); this.label20.Location = new System.Drawing.Point(10, 16);
this.label20.Name = "label20"; this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(32, 13); this.label20.Size = new System.Drawing.Size(32, 13);
this.label20.TabIndex = 34; this.label20.TabIndex = 34;
@@ -806,31 +840,43 @@
this.tim_HW_status.Interval = 1000; this.tim_HW_status.Interval = 1000;
this.tim_HW_status.Tick += new System.EventHandler(this.tim_HW_status_Tick); this.tim_HW_status.Tick += new System.EventHandler(this.tim_HW_status_Tick);
// //
// con_Button_See_log // label30
// //
this.con_Button_See_log.Enabled = false; this.label30.AutoSize = true;
this.con_Button_See_log.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label30.Location = new System.Drawing.Point(92, 16);
this.con_Button_See_log.Location = new System.Drawing.Point(170, 12); this.label30.Name = "label30";
this.con_Button_See_log.Name = "con_Button_See_log"; this.label30.Size = new System.Drawing.Size(81, 13);
this.con_Button_See_log.Size = new System.Drawing.Size(56, 20); this.label30.TabIndex = 34;
this.con_Button_See_log.TabIndex = 24; this.label30.Text = "Last frame time:";
this.con_Button_See_log.Text = "See log"; this.label30.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.con_Button_See_log.UseVisualStyleBackColor = true;
this.con_Button_See_log.Click += new System.EventHandler(this.con_Button_See_log_Click);
// //
// con_check_delete_logs // label31
// //
this.con_check_delete_logs.AutoSize = true; this.label31.AutoSize = true;
this.con_check_delete_logs.Checked = true; this.label31.Location = new System.Drawing.Point(174, 16);
this.con_check_delete_logs.CheckState = System.Windows.Forms.CheckState.Checked; this.label31.Name = "label31";
this.con_check_delete_logs.Location = new System.Drawing.Point(105, 19); this.label31.Size = new System.Drawing.Size(61, 13);
this.con_check_delete_logs.Name = "con_check_delete_logs"; this.label31.TabIndex = 34;
this.con_check_delete_logs.Size = new System.Drawing.Size(138, 17); this.label31.Text = "[frame time]";
this.con_check_delete_logs.TabIndex = 25; //
this.con_check_delete_logs.Text = "Rotate logs after 7 days"; // label32
this.con_check_delete_logs.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; //
this.con_check_delete_logs.UseVisualStyleBackColor = true; this.label32.AutoSize = true;
this.con_check_delete_logs.Validated += new System.EventHandler(this.con_check_delete_logs_Validated); this.label32.Location = new System.Drawing.Point(86, 34);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(87, 13);
this.label32.TabIndex = 35;
this.label32.Text = "Last frame delay:";
this.label32.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(174, 34);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(67, 13);
this.label33.TabIndex = 36;
this.label33.Text = "[frame delay]";
// //
// form_Main // form_Main
// //
@@ -962,6 +1008,10 @@
private System.Windows.Forms.Timer tim_HW_status; private System.Windows.Forms.Timer tim_HW_status;
private System.Windows.Forms.Button con_Button_See_log; private System.Windows.Forms.Button con_Button_See_log;
private System.Windows.Forms.CheckBox con_check_delete_logs; private System.Windows.Forms.CheckBox con_check_delete_logs;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Label label32;
} }
} }

View File

@@ -581,6 +581,10 @@ namespace Perun_v1
Globals.ErrorsHistoryGame = Globals.ErrorsGame; Globals.ErrorsHistoryGame = Globals.ErrorsGame;
} }
// Frame times
label31.Text = $"{Globals.LastFrameTime.ToString("0.00")}µs";
label33.Text = $"{Globals.LastFrameDelay.ToString("0.00")}µs";
// Check if we shall rate logs // Check if we shall rate logs
Globals.RotateLogs = con_check_minimize_to_tray.Checked; Globals.RotateLogs = con_check_minimize_to_tray.Checked;