From 547f9b55654b3faf4395268d4c1dc1ace2958c78 Mon Sep 17 00:00:00 2001 From: roozbehghazavi Date: Sat, 27 Jun 2026 16:44:24 +0200 Subject: [PATCH] Update framework to 4.8, fix DedicatedServerSettings.ini append bug, and make the password field optional --- CoJ/CoJ.vbproj | 8 +++- CoJ/My Project/Application.Designer.vb | 22 ++++++---- CoJ/My Project/Resources.Designer.vb | 26 ++++++------ CoJ/My Project/Settings.Designer.vb | 58 +++++++++++++------------- CoJ/app.config | 10 ++--- CoJ/frmConsola.vb | 4 +- CoJ/frmServerConfig.vb | 10 ++--- 7 files changed, 72 insertions(+), 66 deletions(-) diff --git a/CoJ/CoJ.vbproj b/CoJ/CoJ.vbproj index 0a68fa5..1eb8632 100644 --- a/CoJ/CoJ.vbproj +++ b/CoJ/CoJ.vbproj @@ -1,5 +1,5 @@  - + Debug @@ -11,7 +11,7 @@ CoJ2Controller 512 WindowsForms - v4.0 + v4.8 false publicar\ true @@ -27,6 +27,7 @@ 1.0.0.%2a false true + x86 @@ -37,6 +38,7 @@ bin\Debug\ CoJ2Controller.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + false AnyCPU @@ -47,6 +49,7 @@ bin\Release\ CoJ2Controller.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + false On @@ -171,6 +174,7 @@ True Application.myapp + True True diff --git a/CoJ/My Project/Application.Designer.vb b/CoJ/My Project/Application.Designer.vb index 264323e..eee3693 100644 --- a/CoJ/My Project/Application.Designer.vb +++ b/CoJ/My Project/Application.Designer.vb @@ -1,10 +1,10 @@ '------------------------------------------------------------------------------ ' -' Este código fue generado por una herramienta. -' Versión de runtime:4.0.30319.18033 +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 ' -' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -' se vuelve a generar el código. +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. ' '------------------------------------------------------------------------------ @@ -14,10 +14,10 @@ Option Explicit On Namespace My - 'NOTA: este archivo se genera de forma automática; no lo modifique directamente. Para realizar cambios, - ' o si detecta errores de compilación en este archivo, vaya al Diseñador de proyectos - ' (vaya a Propiedades del proyecto o haga doble clic en el nodo My Project en el - ' Explorador de soluciones) y realice cambios en la pestaña Aplicación. + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. ' Partial Friend Class MyApplication @@ -34,5 +34,11 @@ Namespace My Protected Overrides Sub OnCreateMainForm() Me.MainForm = Global.CoJ2Controller.FrmMain End Sub + + _ + Protected Overrides Function OnInitialize(ByVal commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean + Me.MinimumSplashScreenDisplayTime = 0 + Return MyBase.OnInitialize(commandLineArgs) + End Function End Class End Namespace diff --git a/CoJ/My Project/Resources.Designer.vb b/CoJ/My Project/Resources.Designer.vb index 374a6f9..bdbb4fd 100644 --- a/CoJ/My Project/Resources.Designer.vb +++ b/CoJ/My Project/Resources.Designer.vb @@ -1,10 +1,10 @@ '------------------------------------------------------------------------------ ' -' Este código fue generado por una herramienta. -' Versión de runtime:4.0.30319.18033 +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 ' -' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -' se vuelve a generar el código. +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. ' '------------------------------------------------------------------------------ @@ -15,14 +15,14 @@ Imports System Namespace My.Resources - 'StronglyTypedResourceBuilder generó automáticamente esta clase - 'a través de una herramienta como ResGen o Visual Studio. - 'Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen - 'con la opción /str o recompile su proyecto de VS. + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. ''' - ''' Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc. + ''' A strongly-typed resource class, for looking up localized strings, etc. ''' - _ @@ -33,7 +33,7 @@ Namespace My.Resources Private resourceCulture As Global.System.Globalization.CultureInfo ''' - ''' Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. + ''' Returns the cached ResourceManager instance used by this class. ''' _ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager @@ -47,8 +47,8 @@ Namespace My.Resources End Property ''' - ''' Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las - ''' búsquedas de recursos mediante esta clase de recurso fuertemente tipado. + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. ''' _ Friend Property Culture() As Global.System.Globalization.CultureInfo diff --git a/CoJ/My Project/Settings.Designer.vb b/CoJ/My Project/Settings.Designer.vb index 8a3ae6b..197f6f4 100644 --- a/CoJ/My Project/Settings.Designer.vb +++ b/CoJ/My Project/Settings.Designer.vb @@ -1,10 +1,10 @@ '------------------------------------------------------------------------------ ' -' Este código fue generado por una herramienta. -' Versión de runtime:4.0.30319.18033 +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 ' -' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -' se vuelve a generar el código. +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. ' '------------------------------------------------------------------------------ @@ -13,35 +13,35 @@ Option Explicit On Namespace My - - _ + + _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()), MySettings) - -#Region "Funcionalidad para autoguardar de My.Settings" + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" #If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean + Private Shared addedHandler As Boolean - Private Shared addedHandlerLockObject As New Object + Private Shared addedHandlerLockObject As New Object - _ - Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub #End If #End Region - + Public Shared ReadOnly Property [Default]() As MySettings Get - + #If _MyType = "WindowsForms" Then - If Not addedHandler Then + If Not addedHandler Then SyncLock addedHandlerLockObject If Not addedHandler Then AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings @@ -57,13 +57,13 @@ Namespace My End Namespace Namespace My - - _ + + _ Friend Module MySettingsProperty - - _ + + _ Friend ReadOnly Property Settings() As Global.CoJ2Controller.My.MySettings Get Return Global.CoJ2Controller.My.MySettings.Default diff --git a/CoJ/app.config b/CoJ/app.config index a44bc37..162b652 100644 --- a/CoJ/app.config +++ b/CoJ/app.config @@ -1,4 +1,4 @@ - + @@ -12,14 +12,12 @@ - + - + - + diff --git a/CoJ/frmConsola.vb b/CoJ/frmConsola.vb index 6e0bd0d..b73d4ac 100644 --- a/CoJ/frmConsola.vb +++ b/CoJ/frmConsola.vb @@ -2167,9 +2167,7 @@ Public Class frmConsola readerConfig.Close() '**************Volvemos a escribir DedicatedServerSetting con otro orden de mapas*************** - My.Computer.FileSystem.DeleteFile(ruta & "\CoJ2\DedicatedServerSettings.ini") - - writer = File.AppendText(ruta & "\CoJ2\DedicatedServerSettings.ini") + writer = File.CreateText(ruta & "\CoJ2\DedicatedServerSettings.ini") For i = 0 To NumLineas writer.WriteLine(arrLineaLeida(i)) diff --git a/CoJ/frmServerConfig.vb b/CoJ/frmServerConfig.vb index d825291..3750161 100644 --- a/CoJ/frmServerConfig.vb +++ b/CoJ/frmServerConfig.vb @@ -466,14 +466,14 @@ Public Class frmServerConfig End If For i = 0 To dgAdmins.Rows.Count - 2 - If dgAdmins.Rows(i).Cells(0).Value IsNot Nothing And dgAdmins.Rows(i).Cells(1).Value IsNot Nothing And dgAdmins.Rows(i).Cells(2).Value IsNot Nothing Then + If dgAdmins.Rows(i).Cells(0).Value IsNot Nothing And dgAdmins.Rows(i).Cells(2).Value IsNot Nothing Then adminsUserConfig = adminsUserConfig & dgAdmins.Rows(i).Cells(0).Value.ToString.Trim & ";;" - adminPassConfig = adminPassConfig & dgAdmins.Rows(i).Cells(1).Value.ToString.Trim & ";;" + adminPassConfig = adminPassConfig & If(dgAdmins.Rows(i).Cells(1).Value IsNot Nothing, dgAdmins.Rows(i).Cells(1).Value.ToString.Trim, "") & ";;" adminLevelConfig = adminLevelConfig & dgAdmins.Rows(i).Cells(2).Value.ToString.Trim & ";;" End If Next - writer = File.AppendText(rutaAppData & "\Config\ServerAdmins.ini") + writer = File.CreateText(rutaAppData & "\Config\ServerAdmins.ini") writer.WriteLine("//Next line was created by Mods CoJ. Do not modify!") writer.WriteLine("//" & adminsUserConfig & "##" & adminPassConfig & "##" & adminLevelConfig & "##") @@ -490,9 +490,9 @@ Public Class frmServerConfig writer.WriteLine("") For i = 0 To dgAdmins.Rows.Count - 2 - If dgAdmins.Rows(i).Cells(0).Value IsNot Nothing And dgAdmins.Rows(i).Cells(1).Value IsNot Nothing And dgAdmins.Rows(i).Cells(2).Value IsNot Nothing Then + If dgAdmins.Rows(i).Cells(0).Value IsNot Nothing And dgAdmins.Rows(i).Cells(2).Value IsNot Nothing Then adminsUserConfig = dgAdmins.Rows(i).Cells(0).Value.ToString.Trim - adminPassConfig = dgAdmins.Rows(i).Cells(1).Value.ToString.Trim + adminPassConfig = If(dgAdmins.Rows(i).Cells(1).Value IsNot Nothing, dgAdmins.Rows(i).Cells(1).Value.ToString.Trim, "") adminLevelConfig = dgAdmins.Rows(i).Cells(2).Value.ToString.Trim If adminLevelConfig = "Standard" Then