diff --git a/ConsoleManager.cs b/ConsoleManager.cs index c48dc4f..993e085 100644 --- a/ConsoleManager.cs +++ b/ConsoleManager.cs @@ -6,7 +6,10 @@ public static void CheckInstall() { if (!File.Exists(Application.StartupPath+ @"\PteroConsole.exe")) { - MessageBox.Show("Sorry but it looks like the app is missing"); + + } else + { + } } } diff --git a/Form1.Designer.cs b/Form1.Designer.cs deleted file mode 100644 index 04bd876..0000000 --- a/Form1.Designer.cs +++ /dev/null @@ -1,57 +0,0 @@ -namespace PteroController -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - panel1 = new Panel(); - SuspendLayout(); - // - // panel1 - // - panel1.Location = new Point(83, 83); - panel1.Name = "panel1"; - panel1.Size = new Size(591, 260); - panel1.TabIndex = 0; - // - // Form1 - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(panel1); - Name = "Form1"; - Text = "Form1"; - Load += Form1_Load; - ResumeLayout(false); - } - - #endregion - - private Panel panel1; - } -} \ No newline at end of file diff --git a/Form1.cs b/Form1.cs deleted file mode 100644 index 299afbc..0000000 --- a/Form1.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace PteroController -{ - public partial class Form1 : Form - { - [DllImport("kernel32.dll")] - public static extern bool AllocConsole(); - - [DllImport("kernel32.dll")] - public static extern bool FreeConsole(); - private Process externalProcess; - - public Form1() - { - InitializeComponent(); - } - private void EmbedExternalApplication() - { - string externalAppPath = "C:\\Users\\NaysKutzu\\Documents\\GitHub\\PteroController\\Controller\\bin\\Debug\\net6.0-windows\\PteroConsole.exe"; - externalProcess = new Process(); - externalProcess.StartInfo.FileName = externalAppPath; - externalProcess.StartInfo.UseShellExecute = false; - externalProcess.StartInfo.CreateNoWindow = true; - - // Redirect standard input, output, and error streams - externalProcess.StartInfo.RedirectStandardInput = true; - externalProcess.StartInfo.RedirectStandardOutput = true; - externalProcess.StartInfo.RedirectStandardError = true; - - externalProcess.OutputDataReceived += (sender, e) => - { - if (!string.IsNullOrEmpty(e.Data)) - { - // Write the console output to the console window - Console.WriteLine(e.Data); - } - }; - - externalProcess.ErrorDataReceived += (sender, e) => - { - if (!string.IsNullOrEmpty(e.Data)) - { - // Write the console error output to the console window - Console.Error.WriteLine(e.Data); - } - }; - - externalProcess.Start(); - - // Attach the console window to the form - AllocConsole(); - - // Start reading the standard output and error streams - externalProcess.BeginOutputReadLine(); - externalProcess.BeginErrorReadLine(); - } - - protected override void OnClosed(EventArgs e) - { - base.OnClosed(e); - - // Close the external console application and free the console when the form is closed - if (externalProcess != null && !externalProcess.HasExited) - { - externalProcess.CloseMainWindow(); - externalProcess.WaitForExit(); - FreeConsole(); - } - } - - private void Form1_Load(object sender, EventArgs e) - { - EmbedExternalApplication(); - } - } -} diff --git a/Form1.resx b/Form1.resx deleted file mode 100644 index a395bff..0000000 --- a/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/FrmLogin.cs b/FrmLogin.cs index 0d7a120..bda6261 100644 --- a/FrmLogin.cs +++ b/FrmLogin.cs @@ -66,17 +66,27 @@ private void CheckSession() try { var account = new ConfigParser(Program.AppAccountInfo); - string panelUrl = Decrypt(account.GetValue("LOGIN", "panel_url")); - string panelAPI = Decrypt(account.GetValue("LOGIN", "api_key")); - string panelPass = Decrypt(account.GetValue("LOGIN", "panel_pwd")); - txtpanelurl.Text = panelUrl; - txtpanelapikey.Text = panelAPI; - txtpanelpwd.Text = panelPass; - btnlogin.PerformClick(); + var EpanelUrl = account.GetValue("LOGIN", "panel_url"); + var EpanelApi = account.GetValue("LOGIN", "api_key"); + var EpanelPass = account.GetValue("LOGIN", "panel_pwd"); + if (EpanelApi == null || EpanelPass == null || EpanelApi == null) + { + + } + else + { + string panelUrl = Decrypt(EpanelUrl); + string panelAPI = Decrypt(EpanelApi); + string panelPass = Decrypt(EpanelPass); + txtpanelurl.Text = panelUrl; + txtpanelapikey.Text = panelAPI; + txtpanelpwd.Text = panelPass; + btnlogin.PerformClick(); + } } catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Show("Failed to check for sessions: \n'" + ex.Message+"'"); } } @@ -118,6 +128,10 @@ private async void btnlogin_Click(object sender, EventArgs e) { string apiKey = txtpanelapikey.Text; string panelUrl = txtpanelurl.Text; + if (txtpanelpwd.Text == "") + { + MessageBox.Show("You did not provide any password for the connection! The SFTP module will be disabled"); + } #pragma warning disable if (!Uri.TryCreate(panelUrl, UriKind.Absolute, out Uri panelUri)) { @@ -143,7 +157,7 @@ private async void btnlogin_Click(object sender, EventArgs e) } else { - MessageBox.Show("Faild to get your data please check the panel url"); + MessageBox.Show("Failed to get your data please check the panel url"); } } #pragma warning restore diff --git a/FrmServerSelector.cs b/FrmServerSelector.cs index ce992d9..4d389ea 100644 --- a/FrmServerSelector.cs +++ b/FrmServerSelector.cs @@ -85,7 +85,7 @@ private void serverListBox_SelectedIndexChanged(object sender, EventArgs e) } catch (Exception ex) { - MessageBox.Show("We are sorry but we can't load the servers"); + MessageBox.Show("We are sorry but we can't load the servers:\n"+ex.Message); } } } diff --git a/PteroController.csproj.user b/PteroController.csproj.user index e8546ef..685525b 100644 --- a/PteroController.csproj.user +++ b/PteroController.csproj.user @@ -1,9 +1,6 @@  - - Form - Form