diff --git a/Application/OasisBot/Program.cs b/Application/OasisBot/Program.cs index eca3e0cb..9a707b57 100644 --- a/Application/OasisBot/Program.cs +++ b/Application/OasisBot/Program.cs @@ -19,13 +19,8 @@ namespace RSBot; internal static class Program { [DllImport("kernel32.dll")] - static extern IntPtr GetConsoleWindow(); + private static extern bool FreeConsole(); - [DllImport("user32.dll")] - static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); - - private const int SW_HIDE = 0; - private const int SW_SHOW = 5; public static string AssemblyTitle = Assembly .GetExecutingAssembly() .GetCustomAttribute() @@ -105,15 +100,14 @@ private static void Main(string[] args) } else { - var handle = GetConsoleWindow(); - ShowWindow(handle, SW_HIDE); + FreeConsole(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); Main mainForm = new Main(); - SplashScreen splashScreen = new SplashScreen(mainForm); + SplashScreen splashScreen = new SplashScreen(mainForm); splashScreen.ShowDialog(); Application.Run(mainForm); diff --git a/Application/OasisBot/Resources/tray.ico b/Application/OasisBot/Resources/tray.ico index 4a6e7a21..c036e91d 100644 Binary files a/Application/OasisBot/Resources/tray.ico and b/Application/OasisBot/Resources/tray.ico differ diff --git a/Application/OasisBot/Resources/tray.png b/Application/OasisBot/Resources/tray.png index 0fcbe812..27a44a16 100644 Binary files a/Application/OasisBot/Resources/tray.png and b/Application/OasisBot/Resources/tray.png differ diff --git a/Application/OasisBot/Views/SplashScreen.Designer.cs b/Application/OasisBot/Views/SplashScreen.Designer.cs index 079ca795..56be6507 100644 --- a/Application/OasisBot/Views/SplashScreen.Designer.cs +++ b/Application/OasisBot/Views/SplashScreen.Designer.cs @@ -48,7 +48,7 @@ private void InitializeComponent() pictureBox.Location = new System.Drawing.Point(0, 0); pictureBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); pictureBox.Name = "pictureBox"; - pictureBox.Size = new System.Drawing.Size(533, 91); + pictureBox.Size = new System.Drawing.Size(640, 91); pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; pictureBox.TabIndex = 0; pictureBox.TabStop = false; @@ -74,7 +74,7 @@ private void InitializeComponent() logoLabel.GradientAnimation = true; logoLabel.Location = new System.Drawing.Point(0, 91); logoLabel.Name = "logoLabel"; - logoLabel.Size = new System.Drawing.Size(533, 100); + logoLabel.Size = new System.Drawing.Size(640, 100); logoLabel.TabIndex = 3; logoLabel.Text = "RSBOT"; logoLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -94,7 +94,7 @@ private void InitializeComponent() System.Drawing.Color.FromArgb(182, 159, 119) }; labelVersion.GradientAnimation = false; - labelVersion.Location = new System.Drawing.Point(443, 129); + labelVersion.Location = new System.Drawing.Point(550, 129); labelVersion.Name = "labelVersion"; labelVersion.Size = new System.Drawing.Size(63, 28); labelVersion.TabIndex = 4; @@ -117,7 +117,7 @@ private void InitializeComponent() label2.GradientAnimation = false; label2.Location = new System.Drawing.Point(0, 232); label2.Name = "label2"; - label2.Size = new System.Drawing.Size(533, 32); + label2.Size = new System.Drawing.Size(640, 32); label2.TabIndex = 5; label2.Text = "Free powerful bot for Silkroad Online servers"; label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -138,7 +138,7 @@ private void InitializeComponent() label3.GradientAnimation = false; label3.Location = new System.Drawing.Point(0, 264); label3.Name = "label3"; - label3.Size = new System.Drawing.Size(533, 26); + label3.Size = new System.Drawing.Size(640, 26); label3.TabIndex = 5; label3.Text = "Created with contributions from the community"; label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -158,7 +158,7 @@ private void InitializeComponent() lblLoading.GradientAnimation = false; lblLoading.Location = new System.Drawing.Point(0, 191); lblLoading.Name = "lblLoading"; - lblLoading.Size = new System.Drawing.Size(533, 21); + lblLoading.Size = new System.Drawing.Size(640, 21); lblLoading.TabIndex = 6; lblLoading.Text = "Loading"; lblLoading.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -182,7 +182,7 @@ private void InitializeComponent() progressLoading.Radius = 4; progressLoading.ShowAsPercent = true; progressLoading.ShowValue = true; - progressLoading.Size = new System.Drawing.Size(533, 290); + progressLoading.Size = new System.Drawing.Size(640, 290); progressLoading.TabIndex = 7; progressLoading.Text = "0,0%"; progressLoading.Value = 0L; @@ -194,7 +194,7 @@ private void InitializeComponent() BackColor = System.Drawing.SystemColors.Control; BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; BorderColor = System.Drawing.Color.Empty; - ClientSize = new System.Drawing.Size(533, 290); + ClientSize = new System.Drawing.Size(640, 290); ControlBox = false; Controls.Add(labelVersion); Controls.Add(label2); diff --git a/Application/OasisBot/tray.ico b/Application/OasisBot/tray.ico index 4a6e7a21..c036e91d 100644 Binary files a/Application/OasisBot/tray.ico and b/Application/OasisBot/tray.ico differ diff --git a/Dependencies/Languages/RSBot/ar_AR.rsl b/Dependencies/Languages/OasisBot/ar_AR.rsl similarity index 100% rename from Dependencies/Languages/RSBot/ar_AR.rsl rename to Dependencies/Languages/OasisBot/ar_AR.rsl diff --git a/Dependencies/Languages/RSBot/de_DE.rsl b/Dependencies/Languages/OasisBot/de_DE.rsl similarity index 100% rename from Dependencies/Languages/RSBot/de_DE.rsl rename to Dependencies/Languages/OasisBot/de_DE.rsl diff --git a/Dependencies/Languages/RSBot/en_US.rsl b/Dependencies/Languages/OasisBot/en_US.rsl similarity index 100% rename from Dependencies/Languages/RSBot/en_US.rsl rename to Dependencies/Languages/OasisBot/en_US.rsl diff --git a/Dependencies/Languages/RSBot/es_ES.rsl b/Dependencies/Languages/OasisBot/es_ES.rsl similarity index 97% rename from Dependencies/Languages/RSBot/es_ES.rsl rename to Dependencies/Languages/OasisBot/es_ES.rsl index 8b902373..baa4652b 100644 --- a/Dependencies/Languages/RSBot/es_ES.rsl +++ b/Dependencies/Languages/OasisBot/es_ES.rsl @@ -1,53 +1,53 @@ -RSBot.Main.Character.label3="Oro:" -RSBot.Main.Character.label2="Nivel:" -RSBot.Main.Panel.btnSave="Guardar" -RSBot.Main.fileToolStripMenuItem="Menu" -RSBot.Main.menuItemExit="Salir" -RSBot.Main.viewToolStripMenuItem="Ver" -RSBot.Main.menuSidebar="Barra Lateral" -RSBot.Main.toolsToolStripMenuItem="Bucle" -RSBot.Main.menuScriptRecorder="Grabar Script" -RSBot.Main.menuPlugins="Plugins" -RSBot.Main.languageToolStripMenuItem="Idioma" -RSBot.Main.themeToolStripMenuItem="Tema" -RSBot.Main.darkToolStripMenuItem="Negro" -RSBot.Main.lightToolStripMenuItem="Blanco" -RSBot.Main.coloredToolStripMenuItem="Elegir Color" -RSBot.Main.aboutToolStripMenuItem="Acerca" -RSBot.Main.thisToolStripMenuItem="OasisBot" -RSBot.ScriptRecorder.Panel.labelStatus="" -RSBot.ScriptRecorder.Panel.btnRunNow="Correr" -RSBot.ScriptRecorder.Panel.btnSave="Guardar" -RSBot.ScriptRecorder.Panel.btnClear="Limpiar" -RSBot.ScriptRecorder.Panel.btnStart="Grabar" -RSBot.ExitDialog.Panel.btnNo="No" -RSBot.ExitDialog.Panel.btnYes="Si" -RSBot.ExitDialog.Panel.checkDontAskAgain="No Preguntar de nuevo" -RSBot.ExitDialog.labelInfo="Está seguro de que desea salir de OasisBot? -Esto lo desconectará del Servidor Silkroad!" -LabelPlayerName="Desconectado" -LabelEntityName="No se ha seleccionado ninguna entidad." -LabelPetName="< Sin nombre >" -NotifyPleaseSelectProperBotBase="Seleccione una base de bots adecuada e inténtelo de nuevo." -NotifyPlayerWasNull="Tu personaje tiene que estar en el juego para iniciar el bot." -Running="Corriendo" -Ready="Listo" -Start="Grabar" -Stop="Detener" -Idle="Inactivo" -Recording="Grabando..." -StopingBot="Deteniendo el bot [{0}]" -StartBot="Iniciar BOT" -StopBot="Detener BOT" -NoBotbaseDetected="¡No se ha detectado ninguna base de bots!" -NoBotbaseDetectedDesc="The bot can not be run without any botbase!\n Please install a proper botbase and try again.\n You can find help at https://silkroad-developer-community.github.io/OasisBot" -SaveRecordedScript="Guardar Script." -RunNow="Correr" -StopRunning="Detener" -OpenFileDialogTitle="Seleccione su archivo ejecutable de Silkroad para continuar..." -ClientTypeInputDialogTitle="¡Selecciona tu tipo de cliente!" -ClientTypeInputDialogContent="¡Seleccione el tipo de juego para que OasisBot funcione correctamente!" -SelectSroDirWarn="¡Seleccione un directorio de Silkroad adecuado!" -ClientTypeNotSelected="Está configurado en 'Vietnam' por ahora porque no ha seleccionado ningún tipo de juego." -ConfigureTrainingAreaBeforeStartBot="Please configure the training area before start the bot!" -PleaseEnterGame="¡Por favor ingrese al juego!" +RSBot.Main.Character.label3="Oro:" +RSBot.Main.Character.label2="Nivel:" +RSBot.Main.Panel.btnSave="Guardar" +RSBot.Main.fileToolStripMenuItem="Menu" +RSBot.Main.menuItemExit="Salir" +RSBot.Main.viewToolStripMenuItem="Ver" +RSBot.Main.menuSidebar="Barra Lateral" +RSBot.Main.toolsToolStripMenuItem="Bucle" +RSBot.Main.menuScriptRecorder="Grabar Script" +RSBot.Main.menuPlugins="Plugins" +RSBot.Main.languageToolStripMenuItem="Idioma" +RSBot.Main.themeToolStripMenuItem="Tema" +RSBot.Main.darkToolStripMenuItem="Negro" +RSBot.Main.lightToolStripMenuItem="Blanco" +RSBot.Main.coloredToolStripMenuItem="Elegir Color" +RSBot.Main.aboutToolStripMenuItem="Acerca" +RSBot.Main.thisToolStripMenuItem="OasisBot" +RSBot.ScriptRecorder.Panel.labelStatus="" +RSBot.ScriptRecorder.Panel.btnRunNow="Correr" +RSBot.ScriptRecorder.Panel.btnSave="Guardar" +RSBot.ScriptRecorder.Panel.btnClear="Limpiar" +RSBot.ScriptRecorder.Panel.btnStart="Grabar" +RSBot.ExitDialog.Panel.btnNo="No" +RSBot.ExitDialog.Panel.btnYes="Si" +RSBot.ExitDialog.Panel.checkDontAskAgain="No Preguntar de nuevo" +RSBot.ExitDialog.labelInfo="Está seguro de que desea salir de OasisBot? +Esto lo desconectará del Servidor Silkroad!" +LabelPlayerName="Desconectado" +LabelEntityName="No se ha seleccionado ninguna entidad." +LabelPetName="< Sin nombre >" +NotifyPleaseSelectProperBotBase="Seleccione una base de bots adecuada e inténtelo de nuevo." +NotifyPlayerWasNull="Tu personaje tiene que estar en el juego para iniciar el bot." +Running="Corriendo" +Ready="Listo" +Start="Grabar" +Stop="Detener" +Idle="Inactivo" +Recording="Grabando..." +StopingBot="Deteniendo el bot [{0}]" +StartBot="Iniciar BOT" +StopBot="Detener BOT" +NoBotbaseDetected="¡No se ha detectado ninguna base de bots!" +NoBotbaseDetectedDesc="The bot can not be run without any botbase!\n Please install a proper botbase and try again.\n You can find help at https://silkroad-developer-community.github.io/OasisBot" +SaveRecordedScript="Guardar Script." +RunNow="Correr" +StopRunning="Detener" +OpenFileDialogTitle="Seleccione su archivo ejecutable de Silkroad para continuar..." +ClientTypeInputDialogTitle="¡Selecciona tu tipo de cliente!" +ClientTypeInputDialogContent="¡Seleccione el tipo de juego para que OasisBot funcione correctamente!" +SelectSroDirWarn="¡Seleccione un directorio de Silkroad adecuado!" +ClientTypeNotSelected="Está configurado en 'Vietnam' por ahora porque no ha seleccionado ningún tipo de juego." +ConfigureTrainingAreaBeforeStartBot="Please configure the training area before start the bot!" +PleaseEnterGame="¡Por favor ingrese al juego!" diff --git a/Dependencies/Languages/RSBot/ru_RU.rsl b/Dependencies/Languages/OasisBot/ru_RU.rsl similarity index 100% rename from Dependencies/Languages/RSBot/ru_RU.rsl rename to Dependencies/Languages/OasisBot/ru_RU.rsl diff --git a/Dependencies/Languages/RSBot/tr_TR.rsl b/Dependencies/Languages/OasisBot/tr_TR.rsl similarity index 100% rename from Dependencies/Languages/RSBot/tr_TR.rsl rename to Dependencies/Languages/OasisBot/tr_TR.rsl diff --git a/Dependencies/Languages/RSBot/vn_VN.rsl b/Dependencies/Languages/OasisBot/vn_VN.rsl similarity index 100% rename from Dependencies/Languages/RSBot/vn_VN.rsl rename to Dependencies/Languages/OasisBot/vn_VN.rsl diff --git a/Plugins/RSBot.General/GeneralCLICommands.cs b/Plugins/RSBot.General/GeneralCLICommands.cs index bc3688f5..bf6f9531 100644 --- a/Plugins/RSBot.General/GeneralCLICommands.cs +++ b/Plugins/RSBot.General/GeneralCLICommands.cs @@ -2,6 +2,7 @@ using RSBot.Core.Components; using RSBot.Core.Components.Command; using System; +using System.Threading.Tasks; namespace RSBot.General; @@ -12,12 +13,17 @@ public class StartClientCommand : ICLICommand public void Execute(string[] args) { - GeneralPlugin.Instance.Manager.StartClientAsync().ContinueWith(task => + _ = Task.Run(async () => { - if (task.IsFaulted) - Log.Error($"Failed to start client: {task.Exception?.InnerException?.Message ?? task.Exception?.Message}"); - else + try + { + await GeneralPlugin.Instance.Manager.StartClientAsync().ConfigureAwait(false); Log.Notify("Client started"); + } + catch (Exception ex) + { + Log.Error($"Failed to start client: {ex.Message}"); + } }); } }