Skip to content

Commit

Permalink
Remove redundant qualifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
Saibamen committed Nov 9, 2024
1 parent 2ff302f commit 6deb76a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
5 changes: 3 additions & 2 deletions zal_program/Zal/Functions/MajorFunctions/LocalSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private async Task setupSocketio()
pcName = "Default Computer";
}
}

pcName = string.Concat(pcName.Where(char.IsLetterOrDigit));
var filePath = GlobalClass.Instance.getFilepathFromResources("server.exe");
var startInfo = new ProcessStartInfo
Expand All @@ -71,7 +72,7 @@ private async Task setupSocketio()
};
serverProcess.Exited += (sender, args) =>
{
System.Diagnostics.Debug.WriteLine(args);
Debug.WriteLine(args);
};
try
{
Expand All @@ -83,7 +84,7 @@ private async Task setupSocketio()
Logger.LogError("error running server process", ex);
}

var ip = Zal.Backend.HelperFunctions.SpecificFunctions.IpGetter.getIp();
var ip = Backend.HelperFunctions.SpecificFunctions.IpGetter.getIp();
socketio = new SocketIOClient.SocketIO($"http://{ip}:{port}",
new SocketIOOptions
{
Expand Down
28 changes: 14 additions & 14 deletions zal_program/Zal/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ private Task StartPipeServer()
{
Invoke(new Action(() =>
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
Show();
WindowState = FormWindowState.Normal;
Activate();
}));
}
}
Expand All @@ -71,7 +71,7 @@ private void setupTrayMenu()
{
ni = new NotifyIcon
{
Icon = System.Drawing.Icon.ExtractAssociatedIcon(Process.GetCurrentProcess().MainModule.FileName),
Icon = Icon.ExtractAssociatedIcon(Process.GetCurrentProcess().MainModule.FileName),
Visible = true
};
var trayMenu = new ContextMenuStrip();
Expand All @@ -83,7 +83,7 @@ private void setupTrayMenu()
};
// Add items to the context menu
trayMenu.Items.Add("Open", null, (sender, e) => Show());
trayMenu.Items.Add("Exit", null, (sender, e) => System.Windows.Forms.Application.Exit());
trayMenu.Items.Add("Exit", null, (sender, e) => Application.Exit());
ni.ContextMenuStrip = trayMenu;
ni.DoubleClick +=
delegate (object sender, EventArgs args)
Expand All @@ -95,7 +95,7 @@ private void setupTrayMenu()
if ((string?)LocalDatabase.Instance.readKey("startMinimized") == "1")
{
if (launchedByStartup)
{ this.Hide(); }
{ Hide(); }
}
}
private async void MainForm_Load(object sender, EventArgs e)
Expand All @@ -104,14 +104,14 @@ private async void MainForm_Load(object sender, EventArgs e)

await FrontendGlobalClass.Initialize(socketConnectionStateChanged: (sender, state) =>
{
this.Invoke(new Action(() =>
Invoke(new Action(() =>
{
mobileConnectionText.Text = state == Functions.Models.SocketConnectionState.Connected ? "Mobile connected" : "Mobile not connected";
mobileConnectionText.ForeColor = !(state == Functions.Models.SocketConnectionState.Connected) ? Color.FromKnownColor(KnownColor.IndianRed) : Color.FromKnownColor(KnownColor.ForestGreen);
}));
}, computerDataReceived: (sender, data) =>
{
this.Invoke(new Action(() =>
Invoke(new Action(() =>
{
gpuDatas = data.gpuData;

Expand All @@ -136,10 +136,10 @@ private void configurationsToolStripMenuItem_Click(object sender, EventArgs e)
private async Task checkForUpdates()
{
var latestVersion = new WebClient().DownloadString("https://zalapp.com/program-version");
var currentVersion = System.Windows.Forms.Application.ProductVersion;
var currentVersion = Application.ProductVersion;
if (latestVersion != currentVersion)
{
var dialog = System.Windows.Forms.MessageBox.Show($"New update is available! do you want to update?\ncurrent version: {currentVersion}\nlatest version:{latestVersion}", "Zal", MessageBoxButtons.YesNo);
var dialog = MessageBox.Show($"New update is available! do you want to update?\ncurrent version: {currentVersion}\nlatest version:{latestVersion}", "Zal", MessageBoxButtons.YesNo);
if (dialog == DialogResult.Yes)
{
using (var webClient = new WebClient())
Expand All @@ -160,7 +160,7 @@ private async Task checkForUpdates()
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("An error occurred updating Zal: " + ex.Message);
MessageBox.Show("An error occurred updating Zal: " + ex.Message);
}
}
}
Expand Down Expand Up @@ -188,13 +188,13 @@ private void viewLogToolStripMenuItem_Click(object sender, EventArgs e)
private async void copyProcessedBackendDataToolStripMenuItem_ClickAsync(object sender, EventArgs e)
{
var data = await FrontendGlobalClass.Instance.dataManager.getBackendData();
System.Windows.Forms.Clipboard.SetText(Newtonsoft.Json.JsonConvert.SerializeObject(data));
Clipboard.SetText(Newtonsoft.Json.JsonConvert.SerializeObject(data));
}

private void copyRawBackendDataToolStripMenuItem_Click(object sender, EventArgs e)
{
var data = FrontendGlobalClass.Instance.backend.getEntireComputerData();
System.Windows.Forms.Clipboard.SetText(Newtonsoft.Json.JsonConvert.SerializeObject(data));
Clipboard.SetText(Newtonsoft.Json.JsonConvert.SerializeObject(data));

}

Expand Down Expand Up @@ -230,7 +230,7 @@ protected override void WndProc(ref Message m)

if (m.WParam.ToInt32() == SC_MINIMIZE)
{
this.Hide();
Hide();
m.Result = IntPtr.Zero;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion zal_program/Zal/Pages/ConfigurationsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private async void button1_Click(object sender, EventArgs e)
await LocalDatabase.Instance.writeKey("runOnStartup", runOnStartupCheckbox.Checked ? "1" : "0");
await LocalDatabase.Instance.writeKey("startMinimized", startMinimizedCheckbox.Checked ? "1" : "0");
FrontendGlobalClass.Instance.localSocket.restartSocketio();
this.Hide();
Hide();
}

private async void gpusList_SelectedIndexChanged(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion zal_program/Zal/Pages/ConnectionSettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void button1_Click(object sender, EventArgs e)
LocalDatabase.Instance.writeKey("port", portTextBox.Text.Length == 0 ? null : portTextBox.Text);
LocalDatabase.Instance.writeKey("pcName", pcNameTextBox.Text.Length == 0 ? null : pcNameTextBox.Text);
FrontendGlobalClass.Instance.localSocket.restartSocketio();
this.Hide();
Hide();
}

private void pcNameTextBox_KeyPress(object sender, KeyPressEventArgs e)
Expand Down

0 comments on commit 6deb76a

Please sign in to comment.