Removed unnecessary tools.
This commit is contained in:
parent
f6ae3344f5
commit
b1ccdf2ca8
@ -94,31 +94,6 @@
|
||||
<attribute name="Main-Class" value="com.l2jserver.loginserver.L2LoginServer" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar destfile="${build.dist.login}/L2J_Configurator.jar" level="9">
|
||||
<fileset dir="${build.bin}">
|
||||
<include name="**/configurator/**" />
|
||||
<include name="**/i18n/**" />
|
||||
<include name="**/images/**" />
|
||||
<exclude name="**/accountmanager/**" />
|
||||
<exclude name="**/dbinstaller/**" />
|
||||
<exclude name="**/gameserver/**" />
|
||||
<exclude name="**/gsregistering/**" />
|
||||
<exclude name="**/log/**" />
|
||||
<exclude name="**/loginserver/**" />
|
||||
<exclude name="**/status/**" />
|
||||
<exclude name="**/util/**" />
|
||||
<exclude name="**/Config/**" />
|
||||
<exclude name="**/L2DatabaseFactory/**" />
|
||||
<exclude name="**/Server/**" />
|
||||
</fileset>
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}" />
|
||||
<attribute name="Built-Date" value="${time.stamp}" />
|
||||
<attribute name="Class-Path" value="${manifest.libs}" />
|
||||
<attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
|
||||
<attribute name="Main-Class" value="com.l2jserver.tools.configurator.ConfigUserInterface" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar destfile="${build.dist.game}/l2jserver.jar" level="9">
|
||||
<fileset dir="${build.bin}">
|
||||
<exclude name="**/dbinstaller/**" />
|
||||
@ -134,65 +109,6 @@
|
||||
<attribute name="Main-Class" value="com.l2jserver.gameserver.GameServer" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar destfile="${build.dist.game}/L2J_Configurator.jar" level="9">
|
||||
<fileset dir="${build.bin}">
|
||||
<include name="**/configurator/**" />
|
||||
<include name="**/i18n/**" />
|
||||
<include name="**/images/**" />
|
||||
<exclude name="**/accountmanager/**" />
|
||||
<exclude name="**/dbinstaller/**" />
|
||||
<exclude name="**/gameserver/**" />
|
||||
<exclude name="**/gsregistering/**" />
|
||||
<exclude name="**/log/**" />
|
||||
<exclude name="**/loginserver/**" />
|
||||
<exclude name="**/status/**" />
|
||||
<exclude name="**/util/**" />
|
||||
<exclude name="**/Config/**" />
|
||||
<exclude name="**/L2DatabaseFactory/**" />
|
||||
<exclude name="**/Server/**" />
|
||||
</fileset>
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}" />
|
||||
<attribute name="Built-Date" value="${time.stamp}" />
|
||||
<attribute name="Class-Path" value="${manifest.libs}" />
|
||||
<attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
|
||||
<attribute name="Main-Class" value="com.l2jserver.tools.configurator.ConfigUserInterface" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<!--
|
||||
<jar destfile="${build.dist.tools}/Database_Installer_GS.jar" level="9">
|
||||
<fileset dir="${build.bin}">
|
||||
<include name="**/dbinstaller/**" />
|
||||
<include name="**/images/**" />
|
||||
<include name="**/util/**" />
|
||||
<include name="**/SQLFilter**" />
|
||||
<exclude name="**/LauncherLS*" />
|
||||
</fileset>
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}" />
|
||||
<attribute name="Built-Date" value="${time.stamp}" />
|
||||
<attribute name="Class-Path" value="${manifest.libs}" />
|
||||
<attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
|
||||
<attribute name="Main-Class" value="com.l2jserver.tools.dbinstaller.LauncherGS" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar destfile="${build.dist.tools}/Database_Installer_LS.jar" level="9">
|
||||
<fileset dir="${build.bin}">
|
||||
<include name="**/dbinstaller/**" />
|
||||
<include name="**/images/**" />
|
||||
<include name="**/util/**" />
|
||||
<include name="**/SQLFilter**" />
|
||||
<exclude name="**/LauncherGS*" />
|
||||
</fileset>
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}" />
|
||||
<attribute name="Built-Date" value="${time.stamp}" />
|
||||
<attribute name="Class-Path" value="${manifest.libs}" />
|
||||
<attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
|
||||
<attribute name="Main-Class" value="com.l2jserver.tools.dbinstaller.LauncherLS" />
|
||||
</manifest>
|
||||
</jar>
|
||||
-->
|
||||
</target>
|
||||
|
||||
<target name="build" depends="jar" description="Create the Zip file.">
|
||||
|
BIN
trunk/dist/images/add.png
vendored
BIN
trunk/dist/images/add.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 733 B |
BIN
trunk/dist/images/cross.png
vendored
BIN
trunk/dist/images/cross.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 655 B |
BIN
trunk/dist/images/disk.png
vendored
BIN
trunk/dist/images/disk.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 620 B |
BIN
trunk/dist/images/help.png
vendored
BIN
trunk/dist/images/help.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 786 B |
BIN
trunk/dist/images/l2j.png
vendored
BIN
trunk/dist/images/l2j.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 446 B |
BIN
trunk/dist/images/l2jserverlogo.png
vendored
BIN
trunk/dist/images/l2jserverlogo.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 8.7 KiB |
@ -1,23 +0,0 @@
|
||||
language = English
|
||||
toolName = Server Configuration Tool
|
||||
|
||||
success = Configuration saved successfully
|
||||
error = Error
|
||||
errorReading = Error reading
|
||||
errorSaving = Error saving
|
||||
reason = Reason:
|
||||
yes = Yes
|
||||
no = No
|
||||
|
||||
fileMenu = File
|
||||
exitItem = Exit
|
||||
helpMenu = Help
|
||||
aboutItem = About
|
||||
|
||||
save = Save
|
||||
cancel = Cancel
|
||||
|
||||
credits = © 2008-2009 L2J Team. All rights reserved.
|
||||
langText = Language: English
|
||||
icons = Icons by http://www.famfamfam.com
|
||||
translation = Translation: L2J Team
|
@ -1,23 +0,0 @@
|
||||
language = Deutsch
|
||||
toolName = Server Konfigurations Tool
|
||||
|
||||
success = Konfiguration erfolgreich gespeichert
|
||||
error = Fehler
|
||||
errorReading = Fehler beim Lesen
|
||||
errorSaving = Fehler beim Schreiben
|
||||
reason = Grund:
|
||||
yes = Ja
|
||||
no = Nein
|
||||
|
||||
fileMenu = Datei
|
||||
exitItem = Beenden
|
||||
helpMenu = Hilfe
|
||||
aboutItem = Über
|
||||
|
||||
save = Speichern
|
||||
cancel = Abbrechen
|
||||
|
||||
credits = © 2008-2010 L2J Team. Alle Rechte vorbehalten.
|
||||
language = Sprache: Deutsch
|
||||
icons = Icons von http://www.famfamfam.com
|
||||
translation = Übersetzung: benurb
|
@ -1,23 +0,0 @@
|
||||
language = Español
|
||||
toolName = Herramienta de Configuración de Servidores L2J
|
||||
|
||||
success = Configuración grabada correctamente
|
||||
error = Error
|
||||
errorReading = Error al leer el archivo
|
||||
errorSaving = Error al grabar el archivo
|
||||
reason = Motivo:
|
||||
yes = Si
|
||||
no = No
|
||||
|
||||
fileMenu = Archivo
|
||||
exitItem = Salir
|
||||
helpMenu = Ayuda
|
||||
aboutItem = Acerca de...
|
||||
|
||||
save = Grabar
|
||||
cancel = Cancelar
|
||||
|
||||
credits = © 2008-2010 el equipo L2J. Todos los derechos reservados.
|
||||
language = Idioma: Español
|
||||
icons = Iconos de http://www.famfamfam.com
|
||||
translation = Traducción: DrLecter
|
@ -1,23 +0,0 @@
|
||||
language = Italiano
|
||||
toolName = Strumento di configurazione del server L2J
|
||||
|
||||
success = Configurazione salvata con successo
|
||||
error = Errore
|
||||
errorReading = Errore durante la lettura del file
|
||||
errorSaving = Impossibile salvare il file
|
||||
reason = Motivo:
|
||||
yes = Si
|
||||
no = No
|
||||
|
||||
fileMenu = File
|
||||
exitItem = Esci
|
||||
helpMenu = Aiuto
|
||||
aboutItem = Informazioni su...
|
||||
|
||||
save = Salva
|
||||
cancel = Annulla
|
||||
|
||||
credits = © 2008-2010 L2J Team. Tutti i diritti riservati.
|
||||
language = Lingua: Italiano
|
||||
icons = Icone di http://www.famfamfam.com
|
||||
translation = Traduzione: Scafu
|
@ -1,23 +0,0 @@
|
||||
language = Nederlands
|
||||
toolName = Server Configuratie Tool
|
||||
|
||||
success = Configuratie succesvol opgeslagen
|
||||
error = Fout
|
||||
errorReading = Fout bij het lezen
|
||||
errorSaving = Fout bij het opslaan
|
||||
reason = Reden:
|
||||
yes = Ja
|
||||
no = Nee
|
||||
|
||||
fileMenu = Bestand
|
||||
exitItem = Afsluiten
|
||||
helpMenu = Help
|
||||
aboutItem = Over
|
||||
|
||||
save = Opslaan
|
||||
cancel = Annuleren
|
||||
|
||||
credits = © 2008-2010 L2J Team. Alle rechten voorbehouden.
|
||||
language = Taal: Nederlands
|
||||
icons = Iconen door http://www.famfamfam.com
|
||||
translation = Vertaling: Bloodshed
|
@ -1,23 +0,0 @@
|
||||
language = Slovencina
|
||||
toolName = Nastroj pre konfigurovanie servera
|
||||
|
||||
success = Konfiguracia uspesne ulozena
|
||||
error = Chyba
|
||||
errorReading = Chyba pri citani
|
||||
errorSaving = Chyba pri zapise
|
||||
reason = Dovod:
|
||||
yes = Ano
|
||||
no = Nie
|
||||
|
||||
fileMenu = Subor
|
||||
exitItem = Ukoncit
|
||||
helpMenu = Pomoc
|
||||
aboutItem = O aplikacii
|
||||
|
||||
save = Ulozit
|
||||
cancel = Zrusit
|
||||
|
||||
credits = © 2008-2010 L2J Team. Vsetky prava vyhradene.
|
||||
language = Jazyk: Slovencina
|
||||
icons = Ikony z http://www.famfamfam.com
|
||||
translation = Preklad: Aikimaniac
|
@ -1,80 +0,0 @@
|
||||
language = English
|
||||
toolName = GS Registering Tool
|
||||
|
||||
error = Error
|
||||
reason = Reason:
|
||||
yes = Yes
|
||||
no = No
|
||||
|
||||
fileMenu = File
|
||||
exitItem = Exit
|
||||
helpMenu = Help
|
||||
aboutItem = About
|
||||
|
||||
btnRemove = Remove
|
||||
btnRemoveAll = Remove All
|
||||
btnRegister = Register GameServer
|
||||
confirmRemoveTitle = Confirm Removal
|
||||
confirmRemoveText = Are you sure you want to remove GameServer %d - %s?
|
||||
confirmRemoveAllText = Are you sure you want to remove ALL GameServers?
|
||||
gsListRetrieveError = There was an error while attempting to retrieve the list of currently registered GameServers.
|
||||
|
||||
gsName = GameServer Name
|
||||
gsAction = Action
|
||||
|
||||
registerGS = Register GameServer
|
||||
serverName = Server name:
|
||||
save = Save
|
||||
cancel = Cancel
|
||||
saveHexId = The hexid.txt file should be saved on GameServer's 'configs' folder to properly complete this process.
|
||||
hexidDest = Choose hexid file destination folder...
|
||||
|
||||
purpose = Allows to register/remove GameServers from LoginServer.
|
||||
options = Options:
|
||||
fallbackOpt = If during the register operation the specified GameServer ID is in use, an attempt with the first available ID will be made.
|
||||
forceOpt = Forces GameServer register operation to overwrite a previous registration on the specified ID, if necessary.
|
||||
cmdOpt = Forces this application to run in console mode, even if GUI is supported.
|
||||
helpOpt = Shows this help message and exits.
|
||||
languageOpt = Attempts to use the language for the specified locale, on failure reverts to auto-detection.
|
||||
registerOpt1 = Registers a GameServer on ID <id> and saves the hexid.txt file on <hexid_dest_dir>.
|
||||
registerOpt2 = You can provide a negative value for <id> to register under the first available ID.
|
||||
registerOpt3 = Nothing is done if <id> is already in use, unless --force or --fallback is used.
|
||||
unregisterOpt = Removes the GameServer specified by <id>, use "all" to remove all currently registered GameServers.
|
||||
wrongUnregisterArg = wrong argument for GameServer removal, specify a numeric ID or "all" without quotes to remove all.
|
||||
noAction = No action to be taken.
|
||||
checkingIdInUse = Checking if GameServer ID %d is in use...
|
||||
removingGsId = Removing GameServer ID: %d
|
||||
forcingRegistration = Forcing registration on ID %d, an existing registration on this ID is being overwritten.
|
||||
fallingBack = Trying to register on the first available ID.
|
||||
registrationOk = GameServer successfully registered on LoginServer with ID %d.
|
||||
unregisterOk = GameServer ID: %d was successfully removed from LoginServer.
|
||||
unregisterAllOk = All GameServers were successfully removed.
|
||||
noFreeId = There was no free ID available to register.
|
||||
sqlErrorRegister = An SQL error occurred while trying to register the GameServer.
|
||||
ioErrorRegister = An error saving the hexid file occurred while trying to register the GameServer.
|
||||
errorRegister = An error occurred while trying to register the GameServer.
|
||||
errorUnregister = An error occurred while trying to remove the GameServer.
|
||||
sqlErrorUnregister = An SQL error occurred while trying to remove the GameServer.
|
||||
sqlErrorUnregisterAll = An SQL error occurred while trying to remove ALL GameServers.
|
||||
noServerNames = No available names for GameServer, verify servername.xml file exists in the LoginServer folder.
|
||||
noNameForId = No name for ID: %d
|
||||
idIsNotFree = This ID is not available.
|
||||
noServerForId = No GameServer is registered on ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = Register GameServer
|
||||
cmdMenuListNames = List GameServers Names and IDs
|
||||
cmdMenuRemoveGS = Remove GameServer
|
||||
cmdMenuRemoveAll = Remove ALL GameServers
|
||||
cmdMenuExit = Exit
|
||||
yourChoice = Choice:
|
||||
invalidChoice = Invalid Choice: %s
|
||||
gsInUse = In Use
|
||||
gsFree = Free
|
||||
enterDesiredId = Enter desired ID:
|
||||
|
||||
credits = © 2008-2009 L2J Team. All rights reserved.
|
||||
langText = Language: English
|
||||
icons = Icons by http://www.famfamfam.com
|
||||
translation = Translation: L2J Team
|
||||
bugReports = Bug Reports:
|
@ -1,80 +0,0 @@
|
||||
language = Ceština
|
||||
toolName = GS Registering Tool
|
||||
|
||||
error = Chyba
|
||||
reason = Duvod:
|
||||
yes = Ano
|
||||
no = Ne
|
||||
|
||||
fileMenu = Soubor
|
||||
exitItem = Konec
|
||||
helpMenu = Nápoveda
|
||||
aboutItem = O aplikaci
|
||||
|
||||
btnRemove = Odebrat
|
||||
btnRemoveAll = Odebrat vše
|
||||
btnRegister = Registrace Herního Serveru
|
||||
confirmRemoveTitle = Potvrdit odstranení
|
||||
confirmRemoveText = Jste si jist, že chcete odstranit Herní Server %d - %s?
|
||||
confirmRemoveAllText = Jste si jist, že chcete odstranit všechny Herní Servery?
|
||||
gsListRetrieveError = Došlo k chybe pri pokusu o získání seznamu aktuálne registrovaných Herních Serveru.
|
||||
|
||||
gsName = Jméno Herního Serveru
|
||||
gsAction = Akce
|
||||
|
||||
registerGS = Registrace Herního Serveru
|
||||
serverName = Jméno Serveru:
|
||||
save = Uložit
|
||||
cancel = Zruš
|
||||
saveHexId = Soubor hexid.txt by mel být uložen do GameServeru v 'configs' složce pro rádné dokoncení tohoto procesu.
|
||||
hexidDest = zvolte pro hexid cílovou složku...
|
||||
|
||||
purpose = Umožnuje zaregistrovat / odebrat Herní Server z Prihlašovacího Serveru.
|
||||
options = Možnosti:
|
||||
fallbackOpt = Pokud v prubehu registrování Vámi zadaným Herním Serverem císlo je používané, pokus s prvním volným císlem bude provedeno.
|
||||
forceOpt = Registrace Herního Serveru prepíše predchozí registraci na uvedené císlo, je-li to nezbytné.
|
||||
cmdOpt = Aplikace bude spuštena v režimu konzole, i když je podporován grafický režim.
|
||||
helpOpt = Zobrazuje tuto nápovedu zprávy a ukoncení.
|
||||
languageOpt = Pokusy o použití jazyka pro konkrétní lokalizace, pri neúspechu se vrací zpet k auto-detekci.
|
||||
registerOpt1 = Zaregistrovat Herní Server na císlu <ID> a uloží hexid.txt soubor do <hexid_dest_dir>.
|
||||
registerOpt2 = Mužete poskytnout záporné hodnoty pro <ID> do rejstríku podle prvních dostupných císel.
|
||||
registerOpt3 = Nic se nestane pokud <id> je již použité, v prípade že --force nebo --fallback je použité.
|
||||
unregisterOpt = Odstraní Herní Server podle stanoveného <ID>, použijte "vše" pro odebrání všech soucasných registrovaných Herních Serveru.
|
||||
wrongUnregisterArg = Špatný argument pro odstranení Herního Serveru, zadejte císelné ID nebo "all" bez uvozovek, aby se odstranily všechny.
|
||||
noAction = Žádné akce, která mají být prijata.
|
||||
checkingIdInUse = Kontroluji jestli císlo Herního Serveru %d je již použité...
|
||||
removingGsId = Odebírám císlo Herního Serveru: %d.
|
||||
forcingRegistration = Nutím registraci na císle %d, stávající registrace na tomto císle bude prepsaná.
|
||||
fallingBack = Pokouším se registrovat na prvním volným císle.
|
||||
registrationOk = Herní Server byl úspešne zaregistrován v Príhlašovacím Serveru pod císlem %d.
|
||||
unregisterOk = Herní Server císlo: %d byl úspešne odebrán z Prihlašovacího Serveru.
|
||||
unregisterAllOk = Všechny Herní Servery byly úspešne odebrány.
|
||||
noFreeId = Nebylo nalezeno žádné volné císlo pro registraci.
|
||||
sqlErrorRegister = Nastala SQL chyba pri pokusu o registraci Herního Serveru.
|
||||
ioErrorRegister = Nastala chyba pri vytvárení souboru hexid.txt.
|
||||
errorRegister = Nastala chyba pri pokuso o zaregistrování Herního Serveru.
|
||||
errorUnregister = Nastala chyba pri pokusu o odebrání Herního Serveru.
|
||||
sqlErrorUnregister = Nastala SQL chyba pri pokusu o odebrání Herního Serveru.
|
||||
sqlErrorUnregisterAll = Nastala SQL chyba pri pokusu o odebrání všech Herních Serveru.
|
||||
noServerNames = Nebylo nalezeno žádné volné jméno pro Herní Server, prosím zkontrolujte ve složce LoginServer soubor servername.xml.
|
||||
noNameForId = Žádné jméno pro císlo: %d.
|
||||
idIsNotFree = Toto císlo je již používané.
|
||||
noServerForId = Nebyl nalezen žádny server pod císlem: %d.
|
||||
|
||||
|
||||
cmdMenuRegister = Registrace Herního Serveru
|
||||
cmdMenuListNames = Seznam Jmen a císel Herních Serveru
|
||||
cmdMenuRemoveGS = Odebrat Herní Server
|
||||
cmdMenuRemoveAll = Odebrat Všechny Herní Servery
|
||||
cmdMenuExit = Konec
|
||||
yourChoice = Volba:
|
||||
invalidChoice = Neplatná volba: %s
|
||||
gsInUse = Již použité
|
||||
gsFree = Volné
|
||||
enterDesiredId = Zadejte požadované císlo:
|
||||
|
||||
credits = © 2008-2010 L2J Tým. Všechna práva vyhrazena.
|
||||
language = Jazyk: Ceština
|
||||
icons = Ikony od http://www.famfamfam.com
|
||||
translation = Preklad: L2J Tým
|
||||
bugReports = Nahlášení chyb:
|
@ -1,80 +0,0 @@
|
||||
language = Deutsch
|
||||
toolName = GS Registrierungs Tool
|
||||
|
||||
error = Fehler
|
||||
reason = Grund:
|
||||
yes = Ja
|
||||
no = Nein
|
||||
|
||||
fileMenu = Datei
|
||||
exitItem = Beenden
|
||||
helpMenu = Hilfe
|
||||
aboutItem = Über
|
||||
|
||||
btnRemove = Entfernen
|
||||
btnRemoveAll = Alle entfernen
|
||||
btnRegister = GameServer registrieren
|
||||
confirmRemoveTitle = Löschung bestätigen
|
||||
confirmRemoveText = Sind sie sicher, dass GameServer %d - %s gelöscht werden soll?
|
||||
confirmRemoveAllText = Sind sie sicher, dass alle GameServer gelöscht werden sollen?
|
||||
gsListRetrieveError = Beim Empfangen der Liste mit aktuell registrierten GameServern ist ein Fehler aufgetreten.
|
||||
|
||||
gsName = GameServer Name
|
||||
gsAction = Aktion
|
||||
|
||||
registerGS = GameServer registrieren
|
||||
serverName = Server Name:
|
||||
save = Speichern
|
||||
cancel = Abbrechen
|
||||
saveHexId = Die hexid.txt Datei muss im 'config' Unterordner des GameServers gespeichert werden um den Vorgang ordnungsgemäß abzuschließen.
|
||||
hexidDest = Zielverzeichnis für hexid Datei wählen...
|
||||
|
||||
purpose = Erlaubt GameServer am LoginServer zu registrieren/vom LoginServer zu entfernen.
|
||||
options = Optionen:
|
||||
fallbackOpt = Wenn währrend des Registrierungsvorgangs die angegebene GameServer ID in Benutzung ist wird die nächste, freie ID verwendet.
|
||||
forceOpt = Erzwingt das Überschreiben einer gespeicherten Registrierung mit der angegebenen ID, falls das nötig sein sollte.
|
||||
cmdOpt = Erzwingt den Konsolenmodus der Anwendung auch wenn der grafische Modus unterstützt wird.
|
||||
helpOpt = Zeigt diese Hilfemeldung an und schließt das Fenster.
|
||||
languageOpt = Versucht die Sprache für die angegebene locale zu benutzen und stellt sich bei einem Fehler wieder auf automatische Erkennung zurück.
|
||||
registerOpt1 = Registriert einen GameServer für ID <id> und speichert die hexid.txt Datei unter <hexid_dest_dir>.
|
||||
registerOpt2 = Sie können einen negativen Wert für <id> benutzen um den GameServer unter der ersten verfügbaren ID zu registrieren.
|
||||
registerOpt3 = Es passiert nichts wenn <id> bereits benutzt wird, außer --force oder --fallback ist gesetzt.
|
||||
unregisterOpt = Entfernt den GameServer mit der <id>. Benutzen sie "all" um alle momentan registrieren GameServer zu entfernen.
|
||||
wrongUnregisterArg = Falscher Parameter für die Löschung des GameServers. Geben sie eine numerische ID um einen GameServer zu entfernen oder "all" (ohne Anführungszeichen) um alle momentan registrieren GameServer zu entfernen.
|
||||
noAction = Keine Aktion wird ausgeführt.
|
||||
checkingIdInUse = Überprüfe ob die GameServer ID %d bereits in Benutzung ist...
|
||||
removingGsId = Entferne GameServer ID: %d
|
||||
forcingRegistration = Erzwingt die Registrierung auf ID %d. Eine bereits existierende Registrierung auf dieser ID wird überschrieben.
|
||||
fallingBack = Versuche auf der ersten, freien ID zu registrieren.
|
||||
registrationOk = GameServer wurd erfolgreich mit der ID %d auf dem LoginServer registriert.
|
||||
unregisterOk = GameServer ID: %d wurde erfolgreich vom LoginServer entfernt.
|
||||
unregisterAllOk = Alle GameServer wurden erfolgreich entfernt.
|
||||
noFreeId = Es ist keine freie ID zum Registrieren vorhanden.
|
||||
sqlErrorRegister = Beim Versuch den GameServer zu registrieren ist ein SQL Fehler aufgetreten.
|
||||
ioErrorRegister = Beim Versuch den GameServer zu registrieren ist ein Fehler beim Speichern der hexid Datei aufgetreten.
|
||||
errorRegister = Beim Versuch den GameServer zu registrieren ist ein Fehler aufgetreten.
|
||||
errorUnregister = Beim Versuch den GameServer zu entfernen ist ein Fehler aufgetreten.
|
||||
sqlErrorUnregister = Beim Versuch den GameServer zu entfernen ist ein SQL Fehler aufgetreten.
|
||||
sqlErrorUnregisterAll = Beim Versuch alle GameServer zu entfernen ist ein SQL Fehler aufgetreten.
|
||||
noServerNames = Keine verfügbaren Namen für den GameServer gefunden. Stellen sie sicher, dass die servername.xml Date im LoginServer Verzeichnis vorhanden ist.
|
||||
noNameForId = Kein Name für ID: %d
|
||||
idIsNotFree = Diese ID ist nicht verfügbar.
|
||||
noServerForId = Kein registrierter GameServer für ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = GameServer registrieren
|
||||
cmdMenuListNames = GameServers Namen und IDs auflisten
|
||||
cmdMenuRemoveGS = GameServer enternen
|
||||
cmdMenuRemoveAll = Alle GameServer entfernen
|
||||
cmdMenuExit = Schließen
|
||||
yourChoice = Bitte wählen:
|
||||
invalidChoice = Ungültige Auswahl: %s
|
||||
gsInUse = In Benutzung
|
||||
gsFree = Frei
|
||||
enterDesiredId = Gewünsche ID eingeben:
|
||||
|
||||
credits = © 2008-2010 L2J Team. Alle Rechte vorbehalten.
|
||||
language = Sprache: Deutsch
|
||||
icons = Icons von http://www.famfamfam.com
|
||||
translation = Übersetzung: benurb
|
||||
bugReports = Fehlerberichte:
|
@ -1,80 +0,0 @@
|
||||
language = Español
|
||||
toolName = Herramienta para registrar gameservers L2J
|
||||
|
||||
error = Error
|
||||
reason = Motivo:
|
||||
yes = Si
|
||||
no = No
|
||||
|
||||
fileMenu = Archivo
|
||||
exitItem = Salir
|
||||
helpMenu = Ayuda
|
||||
aboutItem = Acerca de...
|
||||
|
||||
btnRemove = Quitar
|
||||
btnRemoveAll = Quitar todo
|
||||
btnRegister = Registrar GameServer
|
||||
confirmRemoveTitle = Confirmar Eliminación
|
||||
confirmRemoveText = Seguro que deseas eliminar el GameServer %d - %s?
|
||||
confirmRemoveAllText = Seguro que deseas quitar todos los GameServers de la lista?
|
||||
gsListRetrieveError = Ha ocurrido un error mientras se intentaba obtener una lista de servidores registrados.
|
||||
|
||||
gsName = Nombre de GameServer
|
||||
gsAction = Acción
|
||||
|
||||
registerGS = Registrar GameServer
|
||||
serverName = Nombre de servidor:
|
||||
save = Grabar
|
||||
cancel = Cancelar
|
||||
saveHexId = Para completar este proceso, es preciso guardar el archivo hexid.txt en la carpeta 'configs' del GameServer.
|
||||
hexidDest = Elige la carpeta de destino para el archivo hexid...
|
||||
|
||||
purpose = Permite agregar o quitar GameServers de un LoginServer.
|
||||
options = Opciones:
|
||||
fallbackOpt = Si se determina durante el registro que el ID solicitado está en uso, se intentará con el siguiente ID disponible.
|
||||
forceOpt = Fuerza la sobreescritura de un ID registrado anteriormente, si es necesario.
|
||||
cmdOpt = Fuerza el funcionamiento en modo consola, aún cuando la interfaz gráfica esté soportada.
|
||||
helpOpt = Muestra este mensaje de ayuda y finaliza.
|
||||
languageOpt = Intenta usar el soporte lingüístico indicado, volviendo a la detección automática si falla.
|
||||
registerOpt1 = Registra un GameServer con el ID <id> y guarda el archivo hexid.txt en la carpeta <hexid_dest_dir> que se indique.
|
||||
registerOpt2 = Se puede usar un valor de <id> negativo para que se ocupe el primer ID disponible.
|
||||
registerOpt3 = No hace nada si <id> ya está siendo usado, a menos que se indique algo distinto con --force ó --fallback.
|
||||
unregisterOpt = Elimina el GameServer especificado en <id>, o todos los gameservers registrados si en vez de un ID se indica "all".
|
||||
wrongUnregisterArg = argumento incorrecto para la eliminación de un GameServer, indica el número de ID ó bien "all" sin las comillas para quitar todos.
|
||||
noAction = No se hace nada.
|
||||
checkingIdInUse = Comprobando si el ID para GameServer %d está en uso...
|
||||
removingGsId = Liberando ID de GameServer: %d
|
||||
forcingRegistration = Forzando registro con el ID %d, una registración anterior está siendo sobreescrita.
|
||||
fallingBack = Intentando obtener un registro con el primer ID que esté disponible
|
||||
registrationOk = Se ha registrado un GameServer exitósamente en este LoginServer usando el ID %d.
|
||||
unregisterOk = El ID de GameServer %d ha sido liberado para su uso en este LoginServer.
|
||||
unregisterAllOk = Se han liberado todos los ID de GameServer.
|
||||
noFreeId = No hay un ID de GameServer disponible.
|
||||
sqlErrorRegister = Ha ocurrido un error SQL mientras se intentaba registrar un GameServer.
|
||||
ioErrorRegister = Ha ocurrido un error de archivo mientras se intentaba guardar el archivo hexid resultante de registrar un GameServer.
|
||||
errorRegister = Ha ocurrido un error mientras se intentaba registrar un GameServer.
|
||||
errorUnregister = Ha ocurrido un error mientras se intentaba liberar un ID de GameServer.
|
||||
sqlErrorUnregister = Ha ocurrido un error SQL mientras se intentaba liberar un ID de GameServer.
|
||||
sqlErrorUnregisterAll = Ha ocurrido un error SQL mientras se intentaba liberar todos los ID de GameServer.
|
||||
noServerNames = No hay nombres disponibles para el GameServer, verifica que el archivo servername.xml está presente en la carpeta del LoginServer.
|
||||
noNameForId = No hay un nombre para el ID: %d
|
||||
idIsNotFree = Este ID no está libre.
|
||||
noServerForId = No hay un GameServer registrado bajo el ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = Registrar GameServer
|
||||
cmdMenuListNames = Listar nombres e IDs
|
||||
cmdMenuRemoveGS = Liberar GameServer
|
||||
cmdMenuRemoveAll = Liberar todos los GameServers
|
||||
cmdMenuExit = Salir
|
||||
yourChoice = Elige:
|
||||
invalidChoice = Opción incorrecta: %s
|
||||
gsInUse = En uso
|
||||
gsFree = Libre
|
||||
enterDesiredId = Ingresa el ID que deseas:
|
||||
|
||||
credits = © 2008-2010 el equipo L2J. Todos los derechos reservados.
|
||||
language = Lenguaje: Español
|
||||
icons = Iconos de http://www.famfamfam.com
|
||||
translation = Traducción: DrLecter
|
||||
bugReports = Reporte de bugs:
|
@ -1,80 +0,0 @@
|
||||
language = Magyar
|
||||
toolName = GS Registering Tool
|
||||
|
||||
error = Hiba
|
||||
reason = Ok:
|
||||
yes = Igen
|
||||
no = Nem
|
||||
|
||||
fileMenu = Fájl
|
||||
exitItem = Kilépés
|
||||
helpMenu = Sugó
|
||||
aboutItem = Névjegy
|
||||
|
||||
btnRemove = Eltávolítás
|
||||
btnRemoveAll = Összes eltávolítása
|
||||
btnRegister = GameServer regisztrálása
|
||||
confirmRemoveTitle = Eltávolítás megerosítése
|
||||
confirmRemoveText = Biztos vagy benne, hogy eltávolítod a GameServer %d - %s?
|
||||
confirmRemoveAllText = Biztos vagy benne, hogy az összes GameServert eltávolítod?
|
||||
gsListRetrieveError = Hiba történt a regisztrált GameServer-ek listájának lekérésekor.
|
||||
|
||||
gsName = GameServer Neve
|
||||
gsAction = Akció
|
||||
|
||||
registerGS = GameServer regisztrálása
|
||||
serverName = Server neve:
|
||||
save = Mentés
|
||||
cancel = Mégse
|
||||
saveHexId = A hexid.txt fájlt a GameServer 'configs' mappájába kell menteni, hogy a GameServer megfeleloen muködjön.
|
||||
hexidDest = Válaszd ki a hexid fájl cél mappáját...
|
||||
|
||||
purpose = Megengedi a GameServerek regisztrációját/eltávolítását a LoginServerbol.
|
||||
options = Beállítások:
|
||||
fallbackOpt = Amenyiben a regisztrálási eljárás közben a kiválasztott GameServer ID már használatban van, akkor a következo nem használt ID-t használja a regisztrációhoz.
|
||||
forceOpt = A GameServer regisztrációjánál felül fogja írni a megadott ID-n korábban regisztráltat, ha szükséges.
|
||||
cmdOpt = Console mód használata akkor is, ha a GUI elérheto.
|
||||
helpOpt = Megmutatja ezt a Sugót.
|
||||
languageOpt = Megpróbálja a lokálisan beállított nyelvet használni, ha nem sikerül, akkor visszavált automatikus felismerésre.
|
||||
registerOpt1 = GameServer regisztrálása a(z) <id> ID-n és a hexid.txt mentése a <hexid_dest_dir> helyre.
|
||||
registerOpt2 = Használhatsz negatív értéket a(z) <id>-hez a regisztráció során az elso szabad ID használatához.
|
||||
registerOpt3 = Semmi se történik ha a(z) <id> használatban van és a --force vagy --fallback kapcsolókat nem használod.
|
||||
unregisterOpt = Eltávolítja a <id>-u GameServer-t, használd az "all" kapcsolót az összes regisztrált GameServer eltávolításához.
|
||||
wrongUnregisterArg = Hibás kapcsoló a GameServer eltávolításához, adjon meg egy szám ID-t vagy "all" parancsot a macskakörmök nélkül az összes eltávolításához.
|
||||
noAction = No action to be taken.
|
||||
checkingIdInUse = Ellenörzi, hogy a GameServer ID %d használatban van e...
|
||||
removingGsId = GameServer ID: %d eltávolítása
|
||||
forcingRegistration = Kényszerített regisztráció az ID %d, a korábbi regisztráció felülírásra kerül.
|
||||
fallingBack = Megpróbálja az elso szabad ID-t használni.
|
||||
registrationOk = GameServer sikeresen regisztrálva a LoginServer-ben a következo ID-vel: %d.
|
||||
unregisterOk = GameServer ID: %d sikeresen eltávolítva a LoginServer-bol.
|
||||
unregisterAllOk = A GameServerek eltávolítása sikeres.
|
||||
noFreeId = Nincs szabad ID a regisztrációhoz.
|
||||
sqlErrorRegister = SQL hiba történt a GameServer regisztrációja közben.
|
||||
ioErrorRegister = Hiba történt a hexid fájl mentése közben.
|
||||
errorRegister = Hiba történt a GameServer regisztrációja közben.
|
||||
errorUnregister = Hiba történt a GameServer eltávolítása közben.
|
||||
sqlErrorUnregister = SQL hiba történt a GameServer eltávolítása közben.
|
||||
sqlErrorUnregisterAll = SQL hiba történt a GameServerek eltávolítása közben.
|
||||
noServerNames = Nincs szabad név a GameServer-hez, ellenorizze a servername.xml elérheto e a LoginServer mappában.
|
||||
noNameForId = Nincs név ehhez az ID-hez: %d
|
||||
idIsNotFree = Nem szabad ID.
|
||||
noServerForId = Nincs regisztrált GameServer ezen az ID-n: %d
|
||||
|
||||
|
||||
cmdMenuRegister = GameServer regisztrálása
|
||||
cmdMenuListNames = GameServer Nevek és ID-k Listája
|
||||
cmdMenuRemoveGS = GameServer eltávolítása
|
||||
cmdMenuRemoveAll = Az összes GameServer eltávolítása
|
||||
cmdMenuExit = Kilépés
|
||||
yourChoice = Választás:
|
||||
invalidChoice = Rossz választás: %s
|
||||
gsInUse = Használatban
|
||||
gsFree = Szabad
|
||||
enterDesiredId = Üsse be a kívánt ID-t:
|
||||
|
||||
credits = Š 2008-2010 L2J Team. Minden jog fenttartva.
|
||||
language = Nyelv: Magyar
|
||||
icons = Icons by http://www.famfamfam.com
|
||||
translation = Fordítás: L2J Team
|
||||
bugReports = Hiba bejelentés:
|
@ -1,80 +0,0 @@
|
||||
language = Italiano
|
||||
toolName = Strumento di registrazione del gameserver L2J
|
||||
|
||||
error = Errore
|
||||
reason = Motivo:
|
||||
yes = Si
|
||||
no = No
|
||||
|
||||
fileMenu = File
|
||||
exitItem = Esci
|
||||
helpMenu = Aiuto
|
||||
aboutItem = Informazioni
|
||||
|
||||
btnRemove = Rimuovi
|
||||
btnRemoveAll = Rimuovi tutto
|
||||
btnRegister = GameServer registrati
|
||||
confirmRemoveTitle = Confermare la cancellazione
|
||||
confirmRemoveText = Sei sicuro di voler eliminare il Gameserver %d - %s ?
|
||||
confirmRemoveAllText = Sei sicuro di voler eliminare tutti i Gameserver dalla lista?
|
||||
gsListRetrieveError = Si è verificato un errore durante il tentativo di ottenere la lista dei Gameserver registrati.
|
||||
|
||||
gsName = Nome GameServer
|
||||
gsAction = Azione
|
||||
|
||||
registerGS = Registra GameServer
|
||||
serverName = Nome Server:
|
||||
save = Salva
|
||||
cancel = Annulla
|
||||
saveHexId = Per completare questo processo, è necessario salvare il file hexid.txt nella cartella 'config' del Gameserver.
|
||||
hexidDest = Scegli la cartella di destinazione per il file hexid...
|
||||
|
||||
purpose = Gameserver consente la registrazione/rimozione dal LoginServer.
|
||||
options = Opzioni:
|
||||
fallbackOpt = Se è accertato che la richiesta di registrazione per l'ID è in uso, si provi con il prossimo ID disponibile.
|
||||
forceOpt = Forza la sovrascrittura di un ID già registrato, se necessario.
|
||||
cmdOpt = Forza il funzionamento in modalità console, anche quando l'interfaccia grafica è supportata.
|
||||
helpOpt = Visualizza questo messaggio di aiuto e di uscita.
|
||||
languageOpt = Prova ad usare la lingua specificata, ritorna al rilevamento automatico in caso di errore.
|
||||
registerOpt1 = Registra un GameServer con ID <id> e salva il file hexid.txt nella cartella <hexid_dest_dir> indicata.
|
||||
registerOpt2 = Usa un valore <id> negativo per occupare il primo ID disponibile.
|
||||
registerOpt3 = Non fare niente se <id> è già in uso, a meno che siano utilizzati i comandi --force o --fallback.
|
||||
unregisterOpt = Rimuovi il Gameserver <id>. Usa "all" per rimuovere tutti i GameServer attualmente registrati.
|
||||
wrongUnregisterArg = Argomento sbagliato per l'eliminazione di un GameServer, indica il numero ID o "tutti" (senza virgolette) per rimuoverli tutti.
|
||||
noAction = Nessuna azione verrà eseguita.
|
||||
checkingIdInUse = Verificare se l'ID %d del GameServer è già in uso...
|
||||
removingGsId = Rimuovere GameServer ID: %d
|
||||
forcingRegistration = Forzare la registrazione con ID %d. Una registrazione precedente verrà sovrascritta.
|
||||
fallingBack = Ottieni la registrazione con il primo ID disponibile.
|
||||
registrationOk = GameServer ID: %d registrato con successo al LoginServer.
|
||||
unregisterOk = GameServer ID: %d rimosso dal LoginServer.
|
||||
unregisterAllOk = Tutti i GameServer sono stati rimossi con successo.
|
||||
noFreeId = Nessun ID libero disponibile per la registrazione.
|
||||
sqlErrorRegister = Si è verificato un errore SQL durante la registrazione del GameServer.
|
||||
ioErrorRegister = Si è verificato un errore nel salvataggio del file hexid durante l'operazione di registrazione del GameServer.
|
||||
errorRegister = Si è verificato un errore durante il tentativo di registrare un GameServer.
|
||||
errorUnregister = Si è verificato un errore durante il tentativo di rimuovere un GameServer.
|
||||
sqlErrorUnregister = Si è verificato un errore SQL durante il tentativo di rimuovere un GameServer.
|
||||
sqlErrorUnregisterAll = Si è verificato un errore SQL durante il tentativo di rimuovere tutti i GameServer.
|
||||
noServerNames = Nessun nome disponibile per il GameServer, verificare che il file servername.xml sia presente nella cartella del LoginServer.
|
||||
noNameForId = Nessun nome associato all'ID: %d
|
||||
idIsNotFree = Questo ID non è disponibile.
|
||||
noServerForId = Nessun GameServer registrato con ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = Registra GameServer
|
||||
cmdMenuListNames = Visualizza Nomi e ID dei GameServers
|
||||
cmdMenuRemoveGS = Elimina GameServer
|
||||
cmdMenuRemoveAll = Elimina TUTTI i GameServer
|
||||
cmdMenuExit = Esci
|
||||
yourChoice = Scegliere:
|
||||
invalidChoice = Scelta non valida: %s
|
||||
gsInUse = In Uso
|
||||
gsFree = Disponibile
|
||||
enterDesiredId = Inserire l'ID desiderato:
|
||||
|
||||
credits = © 2008-2010 L2J Team. Tutti i diritti riservati.
|
||||
language = Lingua: Italiano
|
||||
icons = Icone di http://www.famfamfam.com
|
||||
translation = Traduzione: Scafu
|
||||
bugReports = Segnalazione bug:
|
@ -1,80 +0,0 @@
|
||||
language = Nederlands
|
||||
toolName = GS Registratie Tool
|
||||
|
||||
error = Fout
|
||||
reason = Reden:
|
||||
yes = Ja
|
||||
no = Nee
|
||||
|
||||
fileMenu = Bestand
|
||||
exitItem = Afsluiten
|
||||
helpMenu = Help
|
||||
aboutItem = Over
|
||||
|
||||
btnRemove = Verwijderen
|
||||
btnRemoveAll = Alles Verwijderen
|
||||
btnRegister = Registreer GameServer
|
||||
confirmRemoveTitle = Bevestig Verwijderen
|
||||
confirmRemoveText = Weet u zeker dat u GameServer %d - %s wilt verwijderen?
|
||||
confirmRemoveAllText = Weet u zeker dat u alle GameServers wilt verwijderen?
|
||||
gsListRetrieveError = Er is een fout opgetreden tijdens het ophalen van de lijst van de geregistreerde Gameservers.
|
||||
|
||||
gsName = GameServer Naam
|
||||
gsAction = Handeling
|
||||
|
||||
registerGS = Registreer GameServer
|
||||
serverName = Server naam:
|
||||
save = Opslaan
|
||||
cancel = Annuleren
|
||||
saveHexId = Het hexid.txt bestand moet in de GameServer's 'configs' map worden opgeslagen om dit process te voltooien.
|
||||
hexidDest = Kies de bestemmingsmap voor het hexid bestand...
|
||||
|
||||
purpose = Staat het registreren/verwijderen van GameServers op de LoginServer toe.
|
||||
options = Opties:
|
||||
fallbackOpt = Als tijdens het registreen process het opgegeven GameServer ID in gebruik is, zal er een poging gedaan worden met het eerst beschikbare ID.
|
||||
forceOpt = Forceert het GameServer registratie process de vorige registratie te overschrijven, indien nodig op het specifieke ID.
|
||||
cmdOpt = Forceert de applicatie in console modus uit te voeren, zelfs wanneer de GUI wordt ondersteund.
|
||||
helpOpt = Toont dit help bericht en sluit dan af.
|
||||
languageOpt = Probeert de taal te gebruiken voor de opgegeven locatie, indien er een fout ontstaat wordt de auto-detectie weer ingeschakelt.
|
||||
registerOpt1 = Registreert een GameServer op ID <id> en slaat het hexid.txt bestand op in <hexid_dest_dir>.
|
||||
registerOpt2 = U kunt een negatieve waarde voor <id> opgeven om te registreren op het eerste beschikbare ID.
|
||||
registerOpt3 = Er wordt niets gedaan als <id> al in gebruik is, tenzij --force of --fallback wordt gebruikt.
|
||||
unregisterOpt = Verwijderd de GameServer met het gespecificeerde <id>, gebruik "alle" om alle op did moment geregistreerde GameServers te verwijderen.
|
||||
wrongUnregisterArg = verkeerd argument voor het verwijderenen van de GameServer, specificeer een numeriek ID of "alle" zonder aanhalingstekens om ze allemaal te verwijderen.
|
||||
noAction = Er word geen handeling ondernomen.
|
||||
checkingIdInUse = Controleren of GameServer ID %d in gebruik is...
|
||||
removingGsId = Bezig met het verwijderen van GameServer ID: %d
|
||||
forcingRegistration = Geforceerde registratie op ID %d, bestaande registratie op dit ID word overschreven.
|
||||
fallingBack = Proberen te registreren op het eerst beschikbare ID.
|
||||
registrationOk = GameServer successvol geregistreerd op de LoginServer met ID %d.
|
||||
unregisterOk = GameServer ID: %d is succesvol verwijderd van de LoginServer.
|
||||
unregisterAllOk = Alle GameServers zijn succesvol verwijderd.
|
||||
noFreeId = Er was geen vrij ID beschikbaar om te registreren.
|
||||
sqlErrorRegister = Er is een SQL fout opgetreden tijdens het registreren van de gameserver.
|
||||
ioErrorRegister = Er is een fout opgetreden bij het registreren van de GameServer tijdens het opslaan van het hexid bestand.
|
||||
errorRegister = Er is een fout opgetreden tijdens het registreren van de gameserver.
|
||||
errorUnregister = Er is een fout opgetreden tijdens het verwijderen van de gameserver.
|
||||
sqlErrorUnregister = Er is een SQL fout opgetreden tijdens het verwijderen van de gameserver.
|
||||
sqlErrorUnregisterAll = Er is een SQL fout opgetreden tijdens het verwijderen van alle gameservers.
|
||||
noServerNames = Er zijn geen beschikbare namen voor GameServer, controleer of het servername.xml bestand aanwezig is in de LoginServer map.
|
||||
noNameForId = Er is geen naam voor ID: %d
|
||||
idIsNotFree = Dit ID is niet beschikbaar.
|
||||
noServerForId = Er is geen GameServer is geregistreerd met ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = Registreer GameServer
|
||||
cmdMenuListNames = List GameServers Names and IDs
|
||||
cmdMenuRemoveGS = Verwijder GameServer
|
||||
cmdMenuRemoveAll = Verwijder alle GameServers
|
||||
cmdMenuExit = Afsluiten
|
||||
yourChoice = Keuze:
|
||||
invalidChoice = Ongeldige keuze: %s
|
||||
gsInUse = In Gebruik
|
||||
gsFree = Vrij
|
||||
enterDesiredId = Voer het gewenste ID in:
|
||||
|
||||
credits = © 2008-2010 L2J Team. Alle rechten voorbehouden.
|
||||
language = Language: Nederlands
|
||||
icons = Iconen door http://www.famfamfam.com
|
||||
translation = Translation: Bloodshed
|
||||
bugReports = Bug Reports:
|
@ -1,80 +0,0 @@
|
||||
language = Português (Brasil)
|
||||
toolName = GS Registering Tool
|
||||
|
||||
error = Erro
|
||||
reason = Motivo:
|
||||
yes = Sim
|
||||
no = Não
|
||||
|
||||
fileMenu = Arquivo
|
||||
exitItem = Sair
|
||||
helpMenu = Ajuda
|
||||
aboutItem = Sobre
|
||||
|
||||
btnRemove = Remover
|
||||
btnRemoveAll = Remover Todos
|
||||
btnRegister = Registrar GameServer
|
||||
confirmRemoveTitle = Confirma Remoção
|
||||
confirmRemoveText = Tem certeza que deseja remover este GameServer %d - %s?
|
||||
confirmRemoveAllText = Tem certeza que deseja remover TODOS GameServers?
|
||||
gsListRetrieveError = Ocorreu um erro tentando obter a lista de GameServers registrados neste LoginServer.
|
||||
|
||||
gsName = Nome do GameServer
|
||||
gsAction = Ação
|
||||
|
||||
registerGS = Registrar GameServer
|
||||
serverName = Nome do Servidor:
|
||||
save = Salvar
|
||||
cancel = Cancelar
|
||||
saveHexId = O arquivo hexid.txt deverá ser salvo na pasta configs do GameServer para completar o processo.
|
||||
hexidDest = Escolha onde salvar o arquivo de hexid...
|
||||
|
||||
purpose = Permite que GameServers sejam registrados e removidos do LoginServer.
|
||||
options = Opções:
|
||||
fallbackOpt = Se ao tentar registrar o GameServer o ID especificado estiver em uso, o primeiro ID disponível será usado.
|
||||
forceOpt = Força operações de registro de GameServer a sobrescreverem um registro anterior quando necessário.
|
||||
cmdOpt = Obriga este programa a rodar em modo console mesmo se o modo GUI for suportado.
|
||||
helpOpt = Exibe esta mensagem de ajuda.
|
||||
languageOpt = Faz com que a aplicação tente usar o idioma especificado, ignorando a auto-detecção.
|
||||
registerOpt1 = Registra um GameServer no ID <id> e salva o arquivo hexid.txt em <hexid_dest_dir>.
|
||||
registerOpt2 = Use um valor negativo em <id> para registrar o primeiro ID disponível.
|
||||
registerOpt3 = Não tem efeito se <id> já estiver em uso, exceto se --force for usado em conjunto (sobrescreve).
|
||||
unregisterOpt = Remove o GameServer especificado por <id>, use "all" para remover todos GameServers atualmente registrados.
|
||||
wrongUnregisterArg = Argumento incorreto para remoção de GameServer, informe o ID numérico ou "all" sem aspas para remover todos.
|
||||
noAction = Nenhuma ação a ser tomada.
|
||||
checkingIdInUse = Verificando se GameServer ID %d está em uso...
|
||||
removingGsId = Removendo GameServer ID: %d
|
||||
forcingRegistration = Forçando registro no ID %d, sobrescrevendo o registro anterior existente neste ID.
|
||||
fallingBack = Tentado registrar o primeiro ID livre.
|
||||
registrationOk = GameServer registrado no LoginServer com sucesso no ID %d.
|
||||
unregisterOk = GameServer ID: %d foi removido do LoginServer com sucesso.
|
||||
unregisterAllOk = Todos GameServers foram removidos do LoginServer com sucesso.
|
||||
noFreeId = Não foi possível encontrar um ID livre para registrar o GameServer.
|
||||
sqlErrorRegister = Ocorreu um erro na operação SQL enquanto tentando registrar o GameServer.
|
||||
ioErrorRegister = Ocorreu um erro salvando o arquivo de hexid enquanto tentando registrar o GameServer.
|
||||
errorRegister = Ocorreu um erro enquanto tentando registrar o GameServer.
|
||||
errorUnregister = Ocorreu um erro enquanto tentando desregistrar o GameServer.
|
||||
sqlErrorUnregister = Ocorreu um erro na operação SQL enquanto tentando desregistrar o GameServer.
|
||||
sqlErrorUnregisterAll = Ocorreu um erro na operação SQL enquanto tentando desregistrar todos GameServers.
|
||||
noServerNames = Não há nomes disponíveis para GameServers, verifique se o arquivo servername.xml está na pasta do LoginServer.
|
||||
noNameForId = Nenhum nome está associado ao ID: %d
|
||||
idIsNotFree = Este ID não está disponível
|
||||
noServerForId = Nenhum server está registrado no ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = Registrar GameServer
|
||||
cmdMenuListNames = Listar Nome e IDs de GameServers
|
||||
cmdMenuRemoveGS = Remover um GameServer
|
||||
cmdMenuRemoveAll = Remover TODOS GameServers
|
||||
cmdMenuExit = Sair
|
||||
yourChoice = Escolha:
|
||||
invalidChoice = Escolha Inválida: %s
|
||||
gsInUse = Em Uso
|
||||
gsFree = Disponível
|
||||
enterDesiredId = Digite o ID desejado:
|
||||
|
||||
credits = © 2008-2010 Equipe L2J. Todos os direitos reservados.
|
||||
language = Idioma: Português (Brasil)
|
||||
icons = Ícones por http://www.famfamfam.com
|
||||
translation = Tradução: Equipe L2J
|
||||
bugReports = Reporte Bugs:
|
@ -1,80 +0,0 @@
|
||||
language = 中文 (简体)
|
||||
toolName = GS Registering Tool
|
||||
|
||||
error = 错误
|
||||
reason = 原因:
|
||||
yes = 是
|
||||
no = 否
|
||||
|
||||
fileMenu = 档案
|
||||
exitItem = 离开
|
||||
helpMenu = 帮助
|
||||
aboutItem = 关于
|
||||
|
||||
btnRemove = 移除
|
||||
btnRemoveAll = 移除全部
|
||||
btnRegister = 注册游戏服务器
|
||||
confirmRemoveTitle = 确认移除
|
||||
confirmRemoveText = 确定要移除游戏服务器 %d - %s?
|
||||
confirmRemoveAllText = 确定要移除全部游戏服务器s?
|
||||
gsListRetrieveError = 无法正常取得所注册过的游戏服务器列表.
|
||||
|
||||
gsName = 游戏服务器名称
|
||||
gsAction = 动作
|
||||
|
||||
registerGS = 注册游戏服务器
|
||||
serverName = 服务器名称:
|
||||
save = 存取
|
||||
cancel = 取消
|
||||
saveHexId = hexid.txt 档案必须存取在游戏服务器的 'configs' 文件夹才能正常执行.
|
||||
hexidDest = 请选择hexid档案的位置...
|
||||
|
||||
purpose = 允许从登入服务器 注册/移除 游戏服务器.
|
||||
options = 选项:
|
||||
fallbackOpt = 若在注册游戏服务器的程序发现该游戏服务器ID已经注册过,将会自动注册为下一个可使用的ID.
|
||||
forceOpt = 若在注册游戏服务器的程序发现该游戏服务器ID已经注册过,将会强制取代此游戏服务器ID位置.
|
||||
cmdOpt = 强制让此程序启动在指令窗口模式.
|
||||
helpOpt = 显示此帮助讯息与离开.
|
||||
languageOpt = 尝试让系统自动侦测该平台的语言, 错误时会自动复原.
|
||||
registerOpt1 = 注册游戏服务器的ID为 <id> 并存取hexid.txt档案至 <hexid_dest_dir>.
|
||||
registerOpt2 = 您可以在 <id> 使用负的数值, 让系统自动注册第一个可以使用的ID.
|
||||
registerOpt3 = 若 <id> 已经被使用了, 系统将不会做出任何动作, 除非有使用到 --force 或者 --fallback .
|
||||
unregisterOpt = 利用指定的 <id> 来移除游戏服务器, 用 "all" 来移除目前已注册的游戏服务器.
|
||||
wrongUnregisterArg = 移除游戏服务器指令错误, 请指定游戏服务器编号或者用 all 来移除全部.
|
||||
noAction = 无任何动作.
|
||||
checkingIdInUse = 检查是否游戏服务器 ID %d 已被使用...
|
||||
removingGsId = 正在移除游戏服务器 ID: %d
|
||||
forcingRegistration = 强制注册游戏服务器 ID %d, 上一个以注册的游戏服务器将会被复写.
|
||||
fallingBack = 尝试注册第一个可使用的ID.
|
||||
registrationOk = 游戏服务器成功注册上登入服务器并使用 ID %d.
|
||||
unregisterOk = 游戏服务器 ID: %d 成功从登入服务器移除.
|
||||
unregisterAllOk = 所有游戏服务器成功移除.
|
||||
noFreeId = 已经没有多余可使用的ID.
|
||||
sqlErrorRegister = 游戏服务器注册时发生SQL错误.
|
||||
ioErrorRegister = 游戏服务器注册时发生无法正常存取hexid档案.
|
||||
errorRegister = 游戏服务器注册时发生错误.
|
||||
errorUnregister = 游戏服务器移除时发生错误.
|
||||
sqlErrorUnregister = 游戏服务器移除时发生SQL错误.
|
||||
sqlErrorUnregisterAll = 游戏服务器全部移除时发生SQL错误.
|
||||
noServerNames = 没有可以使用的名称给游戏服务器, 检察是否 servername.xml 此档案再登入服务器文件夹里面.
|
||||
noNameForId = ID: %d 没有任何名称.
|
||||
idIsNotFree = 此 ID 无法使用.
|
||||
noServerForId = 无任何游戏服务器使用 ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = 注册游戏服务器
|
||||
cmdMenuListNames = 列出游戏服务器名称以及ID
|
||||
cmdMenuRemoveGS = 移除游戏服务器
|
||||
cmdMenuRemoveAll = 移除全部游戏服务器
|
||||
cmdMenuExit = 离开
|
||||
yourChoice = 选择:
|
||||
invalidChoice = 错误选择: %s
|
||||
gsInUse = 以使用
|
||||
gsFree = 可使用
|
||||
enterDesiredId = 请输入想使用的ID:
|
||||
|
||||
credits = © 2008-2010 L2J 团队版权所有.
|
||||
language = 语言: 中文 (简体)
|
||||
icons = 图片提供 http://www.famfamfam.com
|
||||
translation = 翻译: L2J 团队 ShanSoft
|
||||
bugReports = 错误回报:
|
@ -1,80 +0,0 @@
|
||||
language = Slovencina
|
||||
toolName = Nastroj pre registrovanie herneho servera
|
||||
|
||||
error = Chyba
|
||||
reason = Dovod:
|
||||
yes = Ano
|
||||
no = Ne
|
||||
|
||||
fileMenu = Subor
|
||||
exitItem = Koniec
|
||||
helpMenu = Napoveda
|
||||
aboutItem = O aplikacii
|
||||
|
||||
btnRemove = Odobrat
|
||||
btnRemoveAll = Odobrat vsetky
|
||||
btnRegister = Registracia Herneho Servera
|
||||
confirmRemoveTitle = Potvrdit odstranenie
|
||||
confirmRemoveText = Si si isty, ze chces odstranit herny server %d - %s?
|
||||
confirmRemoveAllText = Si si isty, ze chces odstranit vsetky herne servre?
|
||||
gsListRetrieveError = Vznikla chyba pri pokuse o ziskanie zoznamu aktualne registrovanych hernych serverov.
|
||||
|
||||
gsName = Meno herneho serveru
|
||||
gsAction = Uloha
|
||||
|
||||
registerGS = Registracia herneho servera
|
||||
serverName = Meno servera:
|
||||
save = Uložzit
|
||||
cancel = Zrusitš
|
||||
saveHexId = Pre uspesne ukoncenie procesu by subor hexid.txt mal byt uložzeny v adresari "config" herneho servera.
|
||||
hexidDest = Zvol si cielovy adresar pre subor hexid.txt.
|
||||
|
||||
purpose = Umožznuje zaregistrovat / odobrat herny server z prihlasovacieho servera.
|
||||
options = Možznosti:
|
||||
fallbackOpt = Ak je v registracii zadane uz pouzite cislo, bude pouzite nasledujuce prve volne.
|
||||
forceOpt = Ak je to nevyhnutne, registracia herneho servera prepise cislo predoslej registracie na uvedene cislo.
|
||||
cmdOpt = Aplikacia bude spusštena v konzolovom rezime konzole aj napriek podpore grafickeho rezimu.
|
||||
helpOpt = Zobrazuje tuto napovedu a zatvori okno.
|
||||
languageOpt = Pokusi sa o pouzitie zvolenej lokalizacie, pri neuspechu sa prepne na automaticku detekciu.
|
||||
registerOpt1 = Zaregistrovat herny server s cislom <ID> a ulozit hexid.txt subor do <hexid_dest_dir>.
|
||||
registerOpt2 = Mozete zvolit zapornu hodnotu pre <ID> na zaregistrovanie pred prve volne cislo.
|
||||
registerOpt3 = Nic se nedeje ak je uz <id> použité, v pripade zže je pouzite --force alebo --fallback.
|
||||
unregisterOpt = Odstraní Herní Server podle stanoveného <ID>, použijte "vše" pro odebrání všech soucasných registrovaných Herních Serveru.
|
||||
wrongUnregisterArg = Zadana nespravna hodnota pri odoberani herneho servera, zadajte cislo ID alebo "all" bez uvodoviek, aby sa odobrali vsetky.
|
||||
noAction = ŽZiadne ulohy, ktore by by mali byt vykonane.
|
||||
checkingIdInUse = Kontrolujem ci uz cislo herneho servera %d nie je pouzite...
|
||||
removingGsId = Odoberam cislo herneho servera: %d.
|
||||
forcingRegistration = Vynucujem si registraciu pod cislom %d, aktualna registracia na tomto cisle bude prepisana.
|
||||
fallingBack = Pokusam sa zaregistrovat na prvom volnom cisle.
|
||||
registrationOk = Herny server bol uspesne zaregistrovany v prihlasovacom servri pod cislom %d.
|
||||
unregisterOk = Herny server cislo: %d bol uspesne odobraty z prihlasovacieho servera.
|
||||
unregisterAllOk = Vsšetky herne servre boli uspesne odobrate.
|
||||
noFreeId = Nebolo najdene ziadne volne cislo pre registraciu.
|
||||
sqlErrorRegister = Vznikla chyba s SQL pri pokuse o registraciu herneho servera.
|
||||
ioErrorRegister = Vznikla chyba pri vytvarani suboru hexid.txt.
|
||||
errorRegister = Vznikla chyba pri pokuse o zaregistrovanie herneho servera.
|
||||
errorUnregister = Vznikla chyba pri pokuse o odobratie herneho servera.
|
||||
sqlErrorUnregister = Vznikla chyba s SQL pri pokuse o odobratie herneho servera.
|
||||
sqlErrorUnregisterAll = Vznikla chyba s SQL pri pokuse o odobratie vsetkych hernych serverov.
|
||||
noServerNames = Nebolo najdene ziadne volne meno pre herny server, prosim skontrolujte v adresari LoginServer subor servername.xml.
|
||||
noNameForId = ŽZiadne meno pre cislo: %d.
|
||||
idIsNotFree = Toto cislo je uz pouzivane.
|
||||
noServerForId = Nebol najdeny ziadny server s cislom: %d.
|
||||
|
||||
|
||||
cmdMenuRegister = Registracia herneho servera
|
||||
cmdMenuListNames = Zoznam mien a cisel hernych serverov
|
||||
cmdMenuRemoveGS = Odobrat herny server
|
||||
cmdMenuRemoveAll = Odobrat vsetky herne servre
|
||||
cmdMenuExit = Koniec
|
||||
yourChoice = Volba:
|
||||
invalidChoice = Neplatna volba: %s
|
||||
gsInUse = Uz pouzite
|
||||
gsFree = Volne
|
||||
enterDesiredId = Zadajte pozžadovane cislo:
|
||||
|
||||
credits = © 2008-2010 L2J Team. Vsšetky prava vyhradene.
|
||||
language = Jazyk: Slovencina
|
||||
icons = Ikony z http://www.famfamfam.com
|
||||
translation = Preklad: L2J Team - Aikimaniac
|
||||
bugReports = Nahlasovanie chyb:
|
@ -1,80 +0,0 @@
|
||||
language = 中文
|
||||
toolName = GS Registering Tool
|
||||
|
||||
error = 錯誤
|
||||
reason = 原因:
|
||||
yes = 是
|
||||
no = 否
|
||||
|
||||
fileMenu = 檔案
|
||||
exitItem = 離開
|
||||
helpMenu = 幫助
|
||||
aboutItem = 關於
|
||||
|
||||
btnRemove = 移除
|
||||
btnRemoveAll = 移除全部
|
||||
btnRegister = 註冊遊戲伺服器
|
||||
confirmRemoveTitle = 確定移除
|
||||
confirmRemoveText = 確定要移除遊戲伺服器 %d - %s?
|
||||
confirmRemoveAllText = 確定要移除全部遊戲伺服器?
|
||||
gsListRetrieveError = 無法取得註冊過的遊戲伺服器列表。
|
||||
|
||||
gsName = 遊戲伺服器名稱
|
||||
gsAction = 動作
|
||||
|
||||
registerGS = 註冊遊戲伺服器
|
||||
serverName = 伺服器名稱:
|
||||
save = 儲存
|
||||
cancel = 取消
|
||||
saveHexId = hexid.txt 檔案必須儲存在遊戲伺服器的「configs」資料夾才能正常執行。
|
||||
hexidDest = 請選擇 hexid 檔案的位置...
|
||||
|
||||
purpose = 允許從登入伺服器「註冊/移除」遊戲伺服器。
|
||||
options = 選項:
|
||||
fallbackOpt = 若在註冊遊戲伺服器時,發現該ID已經註冊過,將會自動註冊為下一個可使用的ID。
|
||||
forceOpt = 若在註冊遊戲伺服器時,發現該ID已經註冊過,將會強制取代此遊戲伺服器的ID位置。
|
||||
cmdOpt = 強制讓此程式啟動在命令模式。
|
||||
helpOpt = 顯示此説明訊息與離開。
|
||||
languageOpt = 嘗試讓系統自動偵測該平臺的語言,發生錯誤時將會自動復原。
|
||||
registerOpt1 = 註冊遊戲伺服器的ID為 <id>,並儲存 hexid.txt 檔案至 <hexid_dest_dir>。
|
||||
registerOpt2 = 您可以在 <id> 使用負的數值,讓系統自動註冊第一個可以使用的ID。
|
||||
registerOpt3 = 若 <id> 已經被使用了,系統將不會做出任何動作,除非有加入 --force 或者 --fallback 的參數。
|
||||
unregisterOpt = 利用指定的 <id> 來移除遊戲伺服器,用「all」來移除目前已註冊的遊戲伺服器。
|
||||
wrongUnregisterArg = 移除遊戲伺服器的指令錯誤,請指定遊戲伺服器ID,或者用「all」來移除全部。
|
||||
noAction = 無任何動作。
|
||||
checkingIdInUse = 檢查是否遊戲伺服器 ID: %d 已被使用...
|
||||
removingGsId = 正在移除遊戲伺服器 ID: %d
|
||||
forcingRegistration = 強制註冊遊戲伺服器 ID: %d,之前註冊的遊戲伺服器將會被複蓋。
|
||||
fallingBack = 嘗試註冊第一個可使用的ID。
|
||||
registrationOk = 遊戲伺服器成功註冊於登入伺服器,並使用 ID: %d
|
||||
unregisterOk = 遊戲伺服器 ID: %d 成功從登入伺服器移除。
|
||||
unregisterAllOk = 所有遊戲伺服器成功移除。
|
||||
noFreeId = 已經沒有多餘可使用的ID。
|
||||
sqlErrorRegister = 遊戲伺服器註冊時,發生 SQL 錯誤。
|
||||
ioErrorRegister = 遊戲伺服器註冊時,發生無法存取 hexid 檔案的錯誤。
|
||||
errorRegister = 遊戲伺服器註冊時,發生錯誤。
|
||||
errorUnregister = 遊戲伺服器移除時,發生錯誤。
|
||||
sqlErrorUnregister = 遊戲伺服器移除時,發生 SQL 錯誤。
|
||||
sqlErrorUnregisterAll = 遊戲伺服器全部移除時,發生 SQL 錯誤。
|
||||
noServerNames = 沒有可以使用的名稱給遊戲伺服器,請檢查 servername.xml 此檔案,是否放在登入伺服器資料夾裡面。
|
||||
noNameForId = ID: %d 沒有任何名稱。
|
||||
idIsNotFree = 此 ID 無法使用。
|
||||
noServerForId = 無任何遊戲伺服器使用 ID: %d
|
||||
|
||||
|
||||
cmdMenuRegister = 註冊遊戲伺服器
|
||||
cmdMenuListNames = 列出遊戲伺服器名稱以及ID
|
||||
cmdMenuRemoveGS = 移除遊戲伺服器
|
||||
cmdMenuRemoveAll = 移除全部遊戲伺服器
|
||||
cmdMenuExit = 離開
|
||||
yourChoice = 選擇:
|
||||
invalidChoice = 錯誤選擇: %s
|
||||
gsInUse = 使用中
|
||||
gsFree = 可以正常使用
|
||||
enterDesiredId = 請輸入想使用的ID:
|
||||
|
||||
credits = © 2008-2010 L2J 團隊版權所有
|
||||
language = 語言:中文
|
||||
icons = 圖片提供 http://www.famfamfam.com
|
||||
translation = 翻譯: L2J 團隊 ShanSoft
|
||||
bugReports = 錯誤回報:
|
BIN
trunk/dist/login/RegisterGameServer.exe
vendored
BIN
trunk/dist/login/RegisterGameServer.exe
vendored
Binary file not shown.
@ -1,757 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.configurator;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.tools.configurator.ConfigUserInterface.ConfigFile.ConfigComment;
|
||||
import com.l2jserver.tools.configurator.ConfigUserInterface.ConfigFile.ConfigProperty;
|
||||
import com.l2jserver.tools.i18n.LanguageControl;
|
||||
import com.l2jserver.tools.images.ImagesTable;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class ConfigUserInterface extends JFrame implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 2609592249095305857L;
|
||||
|
||||
public static final String EOL = System.getProperty("line.separator");
|
||||
|
||||
private final JTabbedPane _tabPane = new JTabbedPane();
|
||||
|
||||
private List<ConfigFile> _configs = new FastList<>();
|
||||
|
||||
private ResourceBundle _bundle;
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// couldn't care less
|
||||
}
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle("configurator.Configurator", Locale.getDefault(), LanguageControl.INSTANCE);
|
||||
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
ConfigUserInterface cui = new ConfigUserInterface(bundle);
|
||||
cui.setVisible(true);
|
||||
});
|
||||
}
|
||||
|
||||
public ConfigUserInterface(ResourceBundle bundle)
|
||||
{
|
||||
setBundle(bundle);
|
||||
setTitle(bundle.getString("toolName"));
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setSize(750, 500);
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
setDefaultLookAndFeelDecorated(true);
|
||||
setIconImage(ImagesTable.getImage("l2j.png").getImage());
|
||||
|
||||
GridBagConstraints cons = new GridBagConstraints();
|
||||
cons.fill = GridBagConstraints.HORIZONTAL;
|
||||
cons.gridx = 0;
|
||||
cons.gridy = 0;
|
||||
cons.weighty = 0;
|
||||
cons.weightx = 1;
|
||||
|
||||
JMenuBar menubar = new JMenuBar();
|
||||
|
||||
JMenu fileMenu = new JMenu(bundle.getString("fileMenu"));
|
||||
JMenu helpMenu = new JMenu(bundle.getString("helpMenu"));
|
||||
|
||||
JMenuItem exitItem = new JMenuItem(bundle.getString("exitItem"));
|
||||
exitItem.setActionCommand("exit");
|
||||
exitItem.addActionListener(this);
|
||||
fileMenu.add(exitItem);
|
||||
|
||||
JMenuItem aboutItem = new JMenuItem(bundle.getString("aboutItem"));
|
||||
aboutItem.setActionCommand("about");
|
||||
aboutItem.addActionListener(this);
|
||||
helpMenu.add(aboutItem);
|
||||
|
||||
menubar.add(fileMenu);
|
||||
menubar.add(helpMenu);
|
||||
|
||||
setJMenuBar(menubar);
|
||||
|
||||
JToolBar toolBar = new JToolBar();
|
||||
toolBar.setFloatable(false);
|
||||
toolBar.setRollover(true);
|
||||
toolBar.add(createToolButton("disk.png", bundle.getString("save"), "save"));
|
||||
this.add(toolBar, cons);
|
||||
|
||||
cons.gridy++;
|
||||
cons.fill = GridBagConstraints.BOTH;
|
||||
cons.weighty = 1;
|
||||
loadConfigs();
|
||||
buildInterface();
|
||||
this.add(_tabPane, cons);
|
||||
}
|
||||
|
||||
private JButton createToolButton(String image, String text, String action)
|
||||
{
|
||||
JButton button = new JButton(text, ImagesTable.getImage(image));
|
||||
button.setActionCommand(action);
|
||||
button.addActionListener(this);
|
||||
return button;
|
||||
}
|
||||
|
||||
private void buildInterface()
|
||||
{
|
||||
ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
|
||||
ToolTipManager.sharedInstance().setInitialDelay(0);
|
||||
ToolTipManager.sharedInstance().setReshowDelay(0);
|
||||
|
||||
GridBagConstraints cons = new GridBagConstraints();
|
||||
cons.fill = GridBagConstraints.NONE;
|
||||
cons.anchor = GridBagConstraints.FIRST_LINE_START;
|
||||
cons.insets = new Insets(2, 2, 2, 2);
|
||||
for (ConfigFile cf : getConfigs())
|
||||
{
|
||||
JPanel panel = new JPanel()
|
||||
{
|
||||
private static final long serialVersionUID = -323928678804839054L;
|
||||
|
||||
@Override
|
||||
public void scrollRectToVisible(Rectangle r)
|
||||
{
|
||||
}
|
||||
};
|
||||
panel.setLayout(new GridBagLayout());
|
||||
|
||||
cons.gridy = 0;
|
||||
cons.weighty = 0;
|
||||
for (ConfigComment cc : cf.getConfigProperties())
|
||||
{
|
||||
if (!(cc instanceof ConfigProperty))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ConfigProperty cp = (ConfigProperty) cc;
|
||||
cons.gridx = 0;
|
||||
|
||||
JLabel keyLabel = new JLabel(cp.getDisplayName() + ':', ImagesTable.getImage("help.png"), SwingConstants.LEFT);
|
||||
String comments = "<b>" + cp.getName() + ":</b><br>" + cp.getComments();
|
||||
comments = comments.replace(EOL, "<br>");
|
||||
comments = "<html>" + comments + "</html>";
|
||||
keyLabel.setToolTipText(comments);
|
||||
cons.weightx = 0;
|
||||
panel.add(keyLabel, cons);
|
||||
cons.gridx++;
|
||||
|
||||
JComponent valueComponent = cp.getValueComponent();
|
||||
valueComponent.setToolTipText(comments);
|
||||
cons.weightx = 1;
|
||||
panel.add(valueComponent, cons);
|
||||
cons.gridx++;
|
||||
cons.gridy++;
|
||||
}
|
||||
cons.gridy++;
|
||||
cons.weighty = 1;
|
||||
panel.add(new JLabel(), cons); // filler
|
||||
_tabPane.addTab(cf.getName(), new JScrollPane(panel));
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfigs()
|
||||
{
|
||||
File configsDir = new File("config");
|
||||
for (File file : configsDir.listFiles())
|
||||
{
|
||||
if (file.getName().endsWith(".properties") && file.isFile() && file.canWrite())
|
||||
{
|
||||
try
|
||||
{
|
||||
parsePropertiesFile(file);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("errorReading") + file.getName(), getBundle().getString("error"), JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param file
|
||||
* @throws IOException
|
||||
*/
|
||||
private void parsePropertiesFile(File file) throws IOException
|
||||
{
|
||||
try (FileInputStream fis = new FileInputStream(file);
|
||||
InputStreamReader isr = new InputStreamReader(fis);
|
||||
LineNumberReader lnr = new LineNumberReader(isr))
|
||||
{
|
||||
String line;
|
||||
StringBuilder commentBuffer = new StringBuilder();
|
||||
ConfigFile cf = new ConfigFile(file);
|
||||
while ((line = lnr.readLine()) != null)
|
||||
{
|
||||
line = line.trim();
|
||||
if (line.isEmpty())
|
||||
{
|
||||
// blank line, reset comments
|
||||
if (commentBuffer.length() > 0)
|
||||
{
|
||||
cf.addConfigComment(commentBuffer.toString());
|
||||
}
|
||||
commentBuffer.setLength(0);
|
||||
}
|
||||
else if (line.charAt(0) == '#')
|
||||
{
|
||||
if (commentBuffer.length() > 0)
|
||||
{
|
||||
commentBuffer.append(EOL);
|
||||
}
|
||||
commentBuffer.append(line.substring(1));
|
||||
}
|
||||
else if (line.indexOf('=') >= 0)
|
||||
{
|
||||
String[] kv = line.split("=");
|
||||
String key = kv[0].trim();
|
||||
StringBuilder value = new StringBuilder();
|
||||
if (kv.length > 1)
|
||||
{
|
||||
value.append(kv[1].trim());
|
||||
}
|
||||
|
||||
if (line.indexOf('\\') >= 0)
|
||||
{
|
||||
while (((line = lnr.readLine()) != null) && (line.indexOf('\\') >= 0))
|
||||
{
|
||||
value.append(EOL + line);
|
||||
}
|
||||
value.append(EOL + line);
|
||||
}
|
||||
|
||||
String comments = commentBuffer.toString();
|
||||
commentBuffer.setLength(0); // reset
|
||||
|
||||
cf.addConfigProperty(key, parseValue(value.toString()), comments);
|
||||
}
|
||||
}
|
||||
getConfigs().add(cf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private Object parseValue(String value)
|
||||
{
|
||||
if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("true"))
|
||||
{
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* try { double parseDouble = Double.parseDouble(value); return parseDouble; } catch (NumberFormatException e) { // not a double, ignore }
|
||||
*/
|
||||
|
||||
// localhost -> 127.0.0.1
|
||||
if (value.equals("localhost"))
|
||||
{
|
||||
value = "127.0.0.1";
|
||||
}
|
||||
|
||||
String[] parts = value.split("\\.");
|
||||
if (parts.length == 4)
|
||||
{
|
||||
boolean ok = true;
|
||||
for (int i = 0; (i < 4) && ok; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
int parseInt = Integer.parseInt(parts[i]);
|
||||
if ((parseInt < 0) || (parseInt > 255))
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
try
|
||||
{
|
||||
InetAddress address = InetAddress.getByName(value);
|
||||
return address;
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static class ConfigFile
|
||||
{
|
||||
private final File _file;
|
||||
private String _name;
|
||||
private final List<ConfigComment> _configs = new FastList<>();
|
||||
|
||||
public ConfigFile(File file)
|
||||
{
|
||||
_file = file;
|
||||
int lastIndex = file.getName().lastIndexOf('.');
|
||||
setName(file.getName().substring(0, lastIndex));
|
||||
}
|
||||
|
||||
public void addConfigProperty(String name, Object value, ValueType type, String comments)
|
||||
{
|
||||
_configs.add(new ConfigProperty(name, value, type, comments));
|
||||
}
|
||||
|
||||
public void addConfigComment(String comment)
|
||||
{
|
||||
_configs.add(new ConfigComment(comment));
|
||||
}
|
||||
|
||||
public void addConfigProperty(String name, Object value, String comments)
|
||||
{
|
||||
this.addConfigProperty(name, value, ValueType.firstTypeMatch(value), comments);
|
||||
}
|
||||
|
||||
public List<ConfigComment> getConfigProperties()
|
||||
{
|
||||
return _configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void save() throws IOException
|
||||
{
|
||||
try (FileOutputStream fos = new FileOutputStream(_file);
|
||||
OutputStreamWriter osw = new OutputStreamWriter(fos);
|
||||
BufferedWriter bufWriter = new BufferedWriter(osw))
|
||||
{
|
||||
for (ConfigComment cc : _configs)
|
||||
{
|
||||
cc.save(bufWriter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigComment
|
||||
{
|
||||
|
||||
private String _comments;
|
||||
|
||||
/**
|
||||
* @param comments
|
||||
*/
|
||||
public ConfigComment(String comments)
|
||||
{
|
||||
_comments = comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the comments.
|
||||
*/
|
||||
public String getComments()
|
||||
{
|
||||
return _comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param comments The comments to set.
|
||||
*/
|
||||
public void setComments(String comments)
|
||||
{
|
||||
_comments = comments;
|
||||
}
|
||||
|
||||
public void save(Writer writer) throws IOException
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('#');
|
||||
sb.append(getComments().replace(EOL, EOL + "#"));
|
||||
sb.append(EOL + EOL);
|
||||
writer.write(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigProperty extends ConfigComment
|
||||
{
|
||||
private String _propname;
|
||||
private Object _value;
|
||||
private ValueType _type;
|
||||
private JComponent _component;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param value
|
||||
* @param type
|
||||
* @param comments
|
||||
*/
|
||||
public ConfigProperty(String name, Object value, ValueType type, String comments)
|
||||
{
|
||||
super(comments);
|
||||
if (!type.getType().isAssignableFrom(value.getClass()))
|
||||
{
|
||||
throw new IllegalArgumentException("Value Instance Type doesn't match the type argument.");
|
||||
}
|
||||
_propname = name;
|
||||
_type = type;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _propname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getDisplayName()
|
||||
{
|
||||
return unCamelize(_propname);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
_propname = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the value.
|
||||
*/
|
||||
public Object getValue()
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The value to set.
|
||||
*/
|
||||
public void setValue(String value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the type.
|
||||
*/
|
||||
public ValueType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type The type to set.
|
||||
*/
|
||||
public void setType(ValueType type)
|
||||
{
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public JComponent getValueComponent()
|
||||
{
|
||||
if (_component == null)
|
||||
{
|
||||
_component = createValueComponent();
|
||||
}
|
||||
return _component;
|
||||
}
|
||||
|
||||
public JComponent createValueComponent()
|
||||
{
|
||||
switch (getType())
|
||||
{
|
||||
case BOOLEAN:
|
||||
boolean bool = (Boolean) getValue();
|
||||
JCheckBox checkBox = new JCheckBox();
|
||||
checkBox.setSelected(bool);
|
||||
return checkBox;
|
||||
case IPv4:
|
||||
return new JIPTextField((Inet4Address) getValue());
|
||||
case DOUBLE:
|
||||
case INTEGER:
|
||||
case STRING:
|
||||
default:
|
||||
String val = getValue().toString();
|
||||
JTextArea textArea = new JTextArea(val);
|
||||
textArea.setFont(UIManager.getFont("TextField.font"));
|
||||
int rows = 1;
|
||||
for (int i = 0; i < val.length(); i++)
|
||||
{
|
||||
if (val.charAt(i) == '\\')
|
||||
{
|
||||
rows++;
|
||||
}
|
||||
}
|
||||
textArea.setRows(rows);
|
||||
textArea.setColumns(Math.max(val.length() / rows, 20));
|
||||
return textArea;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Writer writer) throws IOException
|
||||
{
|
||||
String value;
|
||||
if (getValueComponent() instanceof JCheckBox)
|
||||
{
|
||||
value = Boolean.toString(((JCheckBox) getValueComponent()).isSelected());
|
||||
value = value.substring(0, 1).toUpperCase() + value.substring(1);
|
||||
}
|
||||
else if (getValueComponent() instanceof JIPTextField)
|
||||
{
|
||||
value = ((JIPTextField) getValueComponent()).getText();
|
||||
}
|
||||
else if (getValueComponent() instanceof JTextArea)
|
||||
{
|
||||
value = ((JTextArea) getValueComponent()).getText();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Unhandled component value");
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('#');
|
||||
sb.append(getComments().replace(EOL, EOL + "#"));
|
||||
sb.append(EOL);
|
||||
sb.append(getName());
|
||||
sb.append(" = ");
|
||||
sb.append(value);
|
||||
sb.append(EOL);
|
||||
sb.append(EOL);
|
||||
writer.write(sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ValueType
|
||||
{
|
||||
BOOLEAN(Boolean.class),
|
||||
DOUBLE(Double.class),
|
||||
INTEGER(Integer.class),
|
||||
IPv4(Inet4Address.class),
|
||||
STRING(String.class);
|
||||
|
||||
private final Class<?> _type;
|
||||
|
||||
private ValueType(Class<?> type)
|
||||
{
|
||||
_type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the type.
|
||||
*/
|
||||
public Class<?> getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public static ValueType firstTypeMatch(Object value)
|
||||
{
|
||||
for (ValueType vt : ValueType.values())
|
||||
{
|
||||
if (vt.getType() == value.getClass())
|
||||
{
|
||||
return vt;
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException("No match for: " + value.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
StringBuilder errors = new StringBuilder();
|
||||
|
||||
if (cmd.equals("save"))
|
||||
{
|
||||
for (ConfigFile cf : ConfigUserInterface.this.getConfigs())
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.save();
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
errors.append(getBundle().getString("errorSaving") + cf.getName() + ".properties. " + getBundle().getString("reason") + e1.getLocalizedMessage() + EOL);
|
||||
}
|
||||
}
|
||||
if (errors.length() == 0)
|
||||
{
|
||||
JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("success"), "OK", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog(ConfigUserInterface.this, errors, getBundle().getString("error"), JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(2);
|
||||
}
|
||||
}
|
||||
else if (cmd.equals("exit"))
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
else if (cmd.equals("about"))
|
||||
{
|
||||
JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("credits") + EOL + "http://www.l2jserver.com" + EOL + EOL + getBundle().getString("icons") + EOL + EOL + getBundle().getString("langText") + EOL + getBundle().getString("translation"), getBundle().getString("aboutItem"), JOptionPane.INFORMATION_MESSAGE, ImagesTable.getImage("l2jserverlogo.png"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configs The configuration to set.
|
||||
*/
|
||||
public void setConfigs(List<ConfigFile> configs)
|
||||
{
|
||||
_configs = configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the configuration.
|
||||
*/
|
||||
public List<ConfigFile> getConfigs()
|
||||
{
|
||||
return _configs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keyName
|
||||
* @return Returns the configuration setting name in a human readable form.
|
||||
*/
|
||||
public static String unCamelize(final String keyName)
|
||||
{
|
||||
Pattern p = Pattern.compile("\\p{Lu}");
|
||||
Matcher m = p.matcher(keyName);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
int last = 0;
|
||||
while (m.find())
|
||||
{
|
||||
if (m.start() != (last + 1))
|
||||
{
|
||||
m.appendReplacement(sb, " " + m.group());
|
||||
}
|
||||
last = m.start();
|
||||
}
|
||||
m.appendTail(sb);
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bundle The bundle to set.
|
||||
*/
|
||||
public void setBundle(ResourceBundle bundle)
|
||||
{
|
||||
_bundle = bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the bundle.
|
||||
*/
|
||||
public ResourceBundle getBundle()
|
||||
{
|
||||
return _bundle;
|
||||
}
|
||||
}
|
@ -1,328 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.configurator;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.PlainDocument;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class JIPTextField extends JPanel implements FocusListener
|
||||
{
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JTextField[] _textFields;
|
||||
private List<FocusListener> _focusListeners;
|
||||
|
||||
public JIPTextField(String textIp)
|
||||
{
|
||||
super.addFocusListener(this);
|
||||
|
||||
initIPTextField(textIp);
|
||||
|
||||
for (JTextField _textField : _textFields)
|
||||
{
|
||||
_textField.addFocusListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public JIPTextField()
|
||||
{
|
||||
this("...");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value
|
||||
*/
|
||||
public JIPTextField(Inet4Address value)
|
||||
{
|
||||
this(value.getHostAddress());
|
||||
}
|
||||
|
||||
private void initIPTextField(String textIp)
|
||||
{
|
||||
final ActionListener nextfocusaction = evt -> ((Component) evt.getSource()).transferFocus();
|
||||
|
||||
setLayout(new GridBagLayout());
|
||||
_textFields = new JTextField[4];
|
||||
|
||||
GridBagConstraints cons = new GridBagConstraints();
|
||||
cons.anchor = GridBagConstraints.PAGE_START;
|
||||
cons.fill = GridBagConstraints.HORIZONTAL;
|
||||
cons.insets = new Insets(1, 1, 1, 1);
|
||||
cons.gridx = 0;
|
||||
cons.gridy = 0;
|
||||
|
||||
MaxLengthDocument previous = null;
|
||||
String[] parts = textIp.split("\\.");
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
String str = parts[i];
|
||||
if (i > 0)
|
||||
{
|
||||
JLabel dot = new JLabel(".");
|
||||
cons.weightx = 0;
|
||||
add(dot, cons);
|
||||
cons.gridx++;
|
||||
}
|
||||
MaxLengthDocument maxDoc = new MaxLengthDocument(3);
|
||||
_textFields[i] = new JTextField(maxDoc, str, 3);
|
||||
if (previous != null)
|
||||
{
|
||||
previous.setNext(_textFields[i]);
|
||||
}
|
||||
previous = maxDoc;
|
||||
// ic.weightx = 1;
|
||||
add(_textFields[i], cons);
|
||||
_textFields[i].addActionListener(nextfocusaction);
|
||||
cons.gridx++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFocusListener(FocusListener fl)
|
||||
{
|
||||
if (_focusListeners == null)
|
||||
{
|
||||
_focusListeners = new LinkedList<>();
|
||||
}
|
||||
|
||||
if ((fl != null) && !_focusListeners.contains(fl))
|
||||
{
|
||||
_focusListeners.add(fl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFocusListener(FocusListener fl)
|
||||
{
|
||||
if (_focusListeners != null)
|
||||
{
|
||||
_focusListeners.remove(fl);
|
||||
}
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (_textFields[i].getText().length() == 0)
|
||||
{
|
||||
str.append('0');
|
||||
}
|
||||
else
|
||||
{
|
||||
str.append(_textFields[i].getText());
|
||||
}
|
||||
|
||||
if (i < 3)
|
||||
{
|
||||
str.append('.');
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
public void setText(String str)
|
||||
{
|
||||
try
|
||||
{
|
||||
// make sure string is not null; throw a NullPointerException otherwise
|
||||
str.length();
|
||||
|
||||
InetAddress ip = InetAddress.getByName(str);
|
||||
byte b[] = ip.getAddress();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// byte always have a sign in Java, IP addresses aren't
|
||||
if (b[i] >= 0)
|
||||
{
|
||||
_textFields[i].setText(Byte.toString(b[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
_textFields[i].setText(Integer.toString(b[i] + 256));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (UnknownHostException ex)
|
||||
{
|
||||
}
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
_textFields[i].setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
for (JTextField _textField : _textFields)
|
||||
{
|
||||
if (_textField != null)
|
||||
{
|
||||
_textField.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (!_textFields[i].getText().isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCorrect()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (_textFields[i].getText().length() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent event)
|
||||
{
|
||||
if (_focusListeners != null)
|
||||
{
|
||||
for (FocusListener fl : _focusListeners)
|
||||
{
|
||||
fl.focusGained(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent event)
|
||||
{
|
||||
if (isCorrect() || isEmpty())
|
||||
{
|
||||
if (_focusListeners != null)
|
||||
{
|
||||
for (FocusListener fl : _focusListeners)
|
||||
{
|
||||
fl.focusLost(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MaxLengthDocument extends PlainDocument
|
||||
{
|
||||
|
||||
/**
|
||||
* Comment for <code>serialVersionUID</code>
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final int _max;
|
||||
private JTextField _next;
|
||||
|
||||
public MaxLengthDocument(int maxLength)
|
||||
{
|
||||
this(maxLength, null);
|
||||
}
|
||||
|
||||
public MaxLengthDocument(int maxLength, JTextField next)
|
||||
{
|
||||
_max = maxLength;
|
||||
setNext(next);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
|
||||
{
|
||||
if ((getLength() + str.length()) > _max)
|
||||
{
|
||||
if (getNext() != null)
|
||||
{
|
||||
if (getNext().getText().length() > 0)
|
||||
{
|
||||
getNext().select(0, getNext().getText().length());
|
||||
}
|
||||
else
|
||||
{
|
||||
getNext().getDocument().insertString(0, str, a);
|
||||
}
|
||||
getNext().requestFocusInWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.insertString(offset, str, a);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param next The next to set.
|
||||
*/
|
||||
public void setNext(JTextField next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the next.
|
||||
*/
|
||||
public JTextField getNext()
|
||||
{
|
||||
return _next;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public interface DBOutputInterface
|
||||
{
|
||||
public void setProgressIndeterminate(boolean value);
|
||||
|
||||
public void setProgressMaximum(int maxValue);
|
||||
|
||||
public void setProgressValue(int value);
|
||||
|
||||
public void setFrameVisible(boolean value);
|
||||
|
||||
public void appendToProgressArea(String text);
|
||||
|
||||
public Connection getConnection();
|
||||
|
||||
public int requestConfirm(String title, String message, int type);
|
||||
|
||||
public void showMessage(String title, String message, int type);
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller;
|
||||
|
||||
import java.awt.HeadlessException;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.console.DBInstallerConsole;
|
||||
import com.l2jserver.tools.dbinstaller.gui.DBConfigGUI;
|
||||
|
||||
/**
|
||||
* Contains main class for Database Installer If system doesn't support the graphical UI, start the installer in console mode.
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class LauncherGS
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String mode = "l2jgs";
|
||||
String dir = "../sql/game/";
|
||||
String cleanUp = "gs_cleanup.sql";
|
||||
|
||||
try
|
||||
{
|
||||
// Set OS Look And Feel
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
new DBConfigGUI(mode, dir, cleanUp);
|
||||
}
|
||||
catch (HeadlessException e)
|
||||
{
|
||||
new DBInstallerConsole(mode, dir, cleanUp);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller;
|
||||
|
||||
import java.awt.HeadlessException;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.console.DBInstallerConsole;
|
||||
import com.l2jserver.tools.dbinstaller.gui.DBConfigGUI;
|
||||
|
||||
/**
|
||||
* Contains main class for Database Installer If system doesn't support the graphical UI, start the installer in console mode.
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class LauncherLS
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String mode = "l2jls";
|
||||
String dir = "../sql/login/";
|
||||
String cleanUp = "ls_cleanup.sql";
|
||||
|
||||
try
|
||||
{
|
||||
// Set OS Look And Feel
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
new DBConfigGUI(mode, dir, cleanUp);
|
||||
}
|
||||
catch (HeadlessException e)
|
||||
{
|
||||
new DBInstallerConsole(mode, dir, cleanUp);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.SQLException;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.util.mysql.DBDumper;
|
||||
import com.l2jserver.tools.dbinstaller.util.mysql.ScriptExecutor;
|
||||
import com.l2jserver.util.file.filter.SQLFilter;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class RunTasks extends Thread
|
||||
{
|
||||
DBOutputInterface _frame;
|
||||
boolean _cleanInstall;
|
||||
String _db;
|
||||
String _sqlDir;
|
||||
String _cleanUpFile;
|
||||
|
||||
public RunTasks(DBOutputInterface frame, String db, String sqlDir, String cleanUpFile, boolean cleanInstall)
|
||||
{
|
||||
_frame = frame;
|
||||
_db = db;
|
||||
_cleanInstall = cleanInstall;
|
||||
_sqlDir = sqlDir;
|
||||
_cleanUpFile = cleanUpFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
new DBDumper(_frame, _db);
|
||||
ScriptExecutor exec = new ScriptExecutor(_frame);
|
||||
|
||||
File clnFile = new File(_cleanUpFile);
|
||||
File updDir = new File(_sqlDir, "updates");
|
||||
File[] files = updDir.listFiles(new SQLFilter());
|
||||
|
||||
Preferences prefs = Preferences.userRoot();
|
||||
|
||||
if (_cleanInstall)
|
||||
{
|
||||
if (clnFile.exists())
|
||||
{
|
||||
_frame.appendToProgressArea("Cleaning Database...");
|
||||
exec.execSqlFile(clnFile);
|
||||
_frame.appendToProgressArea("Database Cleaned!");
|
||||
}
|
||||
else
|
||||
{
|
||||
_frame.appendToProgressArea("Database Cleaning Script Not Found!");
|
||||
}
|
||||
|
||||
if (updDir.exists())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (File cf : files)
|
||||
{
|
||||
sb.append(cf.getName() + ';');
|
||||
}
|
||||
prefs.put(_db + "_upd", sb.toString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_cleanInstall && updDir.exists())
|
||||
{
|
||||
_frame.appendToProgressArea("Installing Updates...");
|
||||
|
||||
for (File cf : files)
|
||||
{
|
||||
if (!prefs.get(_db + "_upd", "").contains(cf.getName()))
|
||||
{
|
||||
exec.execSqlFile(cf, true);
|
||||
prefs.put(_db + "_upd", prefs.get(_db + "_upd", "") + cf.getName() + ";");
|
||||
}
|
||||
}
|
||||
_frame.appendToProgressArea("Database Updates Installed!");
|
||||
}
|
||||
}
|
||||
|
||||
_frame.appendToProgressArea("Installing Database Content...");
|
||||
exec.execSqlBatch(new File(_sqlDir));
|
||||
_frame.appendToProgressArea("Database Installation Complete!");
|
||||
|
||||
File cusDir = new File(_sqlDir, "custom");
|
||||
if (cusDir.exists())
|
||||
{
|
||||
int ch = _frame.requestConfirm("Install Custom", "Do you want to install custom tables?", JOptionPane.YES_NO_OPTION);
|
||||
if (ch == 0)
|
||||
{
|
||||
_frame.appendToProgressArea("Installing Custom Tables...");
|
||||
exec.execSqlBatch(cusDir);
|
||||
_frame.appendToProgressArea("Custom Tables Installed!");
|
||||
}
|
||||
}
|
||||
|
||||
File modDir = new File(_sqlDir, "mods");
|
||||
if (modDir.exists())
|
||||
{
|
||||
int ch = _frame.requestConfirm("Install Mods", "Do you want to install mod tables?", JOptionPane.YES_NO_OPTION);
|
||||
if (ch == 0)
|
||||
{
|
||||
_frame.appendToProgressArea("Installing Mods Tables...");
|
||||
exec.execSqlBatch(modDir);
|
||||
_frame.appendToProgressArea("Mods Tables Installed!");
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_frame.getConnection().close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "Cannot close MySQL Connection: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
_frame.setFrameVisible(false);
|
||||
_frame.showMessage("Done!", "Database Installation Complete!", JOptionPane.INFORMATION_MESSAGE);
|
||||
System.exit(0);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.console;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Scanner;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.DBOutputInterface;
|
||||
import com.l2jserver.tools.dbinstaller.RunTasks;
|
||||
import com.l2jserver.tools.dbinstaller.util.CloseShieldedInputStream;
|
||||
import com.l2jserver.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class DBInstallerConsole implements DBOutputInterface
|
||||
{
|
||||
Connection _con;
|
||||
|
||||
public DBInstallerConsole(String db, String dir, String cleanUp)
|
||||
{
|
||||
System.out.println("Welcome to L2J DataBase installer");
|
||||
Preferences prop = Preferences.userRoot();
|
||||
RunTasks rt = null;
|
||||
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
|
||||
{
|
||||
while (_con == null)
|
||||
{
|
||||
System.out.printf("%s (%s): ", "Host", prop.get("dbHost_" + db, "localhost"));
|
||||
String dbHost = scn.nextLine();
|
||||
System.out.printf("%s (%s): ", "Port", prop.get("dbPort_" + db, "3306"));
|
||||
String dbPort = scn.nextLine();
|
||||
System.out.printf("%s (%s): ", "Username", prop.get("dbUser_" + db, "root"));
|
||||
String dbUser = scn.nextLine();
|
||||
System.out.printf("%s (%s): ", "Password", "");
|
||||
String dbPass = scn.nextLine();
|
||||
System.out.printf("%s (%s): ", "Database", prop.get("dbDbse_" + db, db));
|
||||
String dbDbse = scn.nextLine();
|
||||
|
||||
dbHost = dbHost.isEmpty() ? prop.get("dbHost_" + db, "localhost") : dbHost;
|
||||
dbPort = dbPort.isEmpty() ? prop.get("dbPort_" + db, "3306") : dbPort;
|
||||
dbUser = dbUser.isEmpty() ? prop.get("dbUser_" + db, "root") : dbUser;
|
||||
dbDbse = dbDbse.isEmpty() ? prop.get("dbDbse_" + db, db) : dbDbse;
|
||||
|
||||
MySqlConnect connector = new MySqlConnect(dbHost, dbPort, dbUser, dbPass, dbDbse, true);
|
||||
|
||||
_con = connector.getConnection();
|
||||
}
|
||||
|
||||
System.out.print("(C)lean install, (U)pdate or (E)xit? ");
|
||||
String resp = scn.next();
|
||||
if (resp.equalsIgnoreCase("c"))
|
||||
{
|
||||
System.out.print("Do you really want to destroy your db (Y/N)?");
|
||||
if (scn.next().equalsIgnoreCase("y"))
|
||||
{
|
||||
rt = new RunTasks(this, db, dir, cleanUp, true);
|
||||
}
|
||||
}
|
||||
else if (resp.equalsIgnoreCase("u"))
|
||||
{
|
||||
rt = new RunTasks(this, db, dir, cleanUp, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (rt != null)
|
||||
{
|
||||
rt.run();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendToProgressArea(String text)
|
||||
{
|
||||
System.out.println(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection()
|
||||
{
|
||||
return _con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressIndeterminate(boolean value)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressMaximum(int maxValue)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressValue(int value)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFrameVisible(boolean value)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int requestConfirm(String title, String message, int type)
|
||||
{
|
||||
System.out.print(message);
|
||||
String res = "";
|
||||
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
|
||||
{
|
||||
res = scn.next();
|
||||
}
|
||||
return res.equalsIgnoreCase("y") ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(String title, String message, int type)
|
||||
{
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
@ -1,184 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.RunTasks;
|
||||
import com.l2jserver.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import com.l2jserver.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
import com.l2jserver.tools.images.ImagesTable;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class DBConfigGUI extends JFrame
|
||||
{
|
||||
private static final long serialVersionUID = -8391792251140797076L;
|
||||
|
||||
JTextField _dbHost;
|
||||
JTextField _dbPort;
|
||||
JTextField _dbUser;
|
||||
JPasswordField _dbPass;
|
||||
JTextField _dbDbse;
|
||||
|
||||
String _db;
|
||||
String _dir;
|
||||
String _cleanUp;
|
||||
|
||||
Preferences _prop;
|
||||
|
||||
public DBConfigGUI(String db, String dir, String cleanUp)
|
||||
{
|
||||
super("L2J Database Installer");
|
||||
setLayout(new SpringLayout());
|
||||
setDefaultLookAndFeelDecorated(true);
|
||||
setIconImage(ImagesTable.getImage("l2j.png").getImage());
|
||||
|
||||
_db = db;
|
||||
_dir = dir;
|
||||
_cleanUp = cleanUp;
|
||||
|
||||
int width = 260;
|
||||
int height = 220;
|
||||
Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
_prop = Preferences.userRoot();
|
||||
|
||||
// Host
|
||||
JLabel labelDbHost = new JLabel("Host: ", SwingConstants.LEFT);
|
||||
add(labelDbHost);
|
||||
_dbHost = new JTextField(15);
|
||||
_dbHost.setText(_prop.get("dbHost_" + db, "localhost"));
|
||||
labelDbHost.setLabelFor(_dbHost);
|
||||
add(_dbHost);
|
||||
|
||||
// Port
|
||||
JLabel labelDbPort = new JLabel("Port: ", SwingConstants.LEFT);
|
||||
add(labelDbPort);
|
||||
_dbPort = new JTextField(15);
|
||||
_dbPort.setText(_prop.get("dbPort_" + db, "3306"));
|
||||
labelDbPort.setLabelFor(_dbPort);
|
||||
add(_dbPort);
|
||||
|
||||
// Username
|
||||
JLabel labelDbUser = new JLabel("Username: ", SwingConstants.LEFT);
|
||||
add(labelDbUser);
|
||||
_dbUser = new JTextField(15);
|
||||
_dbUser.setText(_prop.get("dbUser_" + db, "root"));
|
||||
labelDbUser.setLabelFor(_dbUser);
|
||||
add(_dbUser);
|
||||
|
||||
// Password
|
||||
JLabel labelDbPass = new JLabel("Password: ", SwingConstants.LEFT);
|
||||
add(labelDbPass);
|
||||
_dbPass = new JPasswordField(15);
|
||||
_dbPass.setText(_prop.get("dbPass_" + db, ""));
|
||||
labelDbPass.setLabelFor(_dbPass);
|
||||
add(_dbPass);
|
||||
|
||||
// Database
|
||||
JLabel labelDbDbse = new JLabel("Database: ", SwingConstants.LEFT);
|
||||
add(labelDbDbse);
|
||||
_dbDbse = new JTextField(15);
|
||||
_dbDbse.setText(_prop.get("dbDbse_" + db, db));
|
||||
labelDbDbse.setLabelFor(_dbDbse);
|
||||
add(_dbDbse);
|
||||
|
||||
ActionListener cancelListener = e -> System.exit(0);
|
||||
|
||||
// Cancel
|
||||
JButton btnCancel = new JButton("Cancel");
|
||||
btnCancel.addActionListener(cancelListener);
|
||||
add(btnCancel);
|
||||
|
||||
ActionListener connectListener = e ->
|
||||
{
|
||||
MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
|
||||
|
||||
if (connector.getConnection() != null)
|
||||
{
|
||||
_prop.put("dbHost_" + _db, _dbHost.getText());
|
||||
_prop.put("dbPort_" + _db, _dbPort.getText());
|
||||
_prop.put("dbUser_" + _db, _dbUser.getText());
|
||||
_prop.put("dbDbse_" + _db, _dbDbse.getText());
|
||||
|
||||
boolean cleanInstall = false;
|
||||
DBInstallerGUI dbi = new DBInstallerGUI(connector.getConnection());
|
||||
setVisible(false);
|
||||
|
||||
Object[] options =
|
||||
{
|
||||
"Full Install",
|
||||
"Upgrade",
|
||||
"Exit"
|
||||
};
|
||||
int n = JOptionPane.showOptionDialog(null, "Select Installation Type", "Installation Type", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
|
||||
|
||||
if ((n == 2) || (n == -1))
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
int conf = JOptionPane.showConfirmDialog(null, "Do you really want to destroy your db?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
if (conf == 1)
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
cleanInstall = true;
|
||||
}
|
||||
|
||||
dbi.setVisible(true);
|
||||
|
||||
RunTasks task = new RunTasks(dbi, _db, _dir, _cleanUp, cleanInstall);
|
||||
task.setPriority(Thread.MAX_PRIORITY);
|
||||
task.start();
|
||||
}
|
||||
};
|
||||
|
||||
// Connect
|
||||
JButton btnConnect = new JButton("Connect");
|
||||
btnConnect.addActionListener(connectListener);
|
||||
add(btnConnect);
|
||||
|
||||
SpringUtilities.makeCompactGrid(getContentPane(), 6, 2, 5, 5, 5, 5);
|
||||
|
||||
setVisible(true);
|
||||
}
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.gui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.sql.Connection;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.DBOutputInterface;
|
||||
import com.l2jserver.tools.images.ImagesTable;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
{
|
||||
private static final long serialVersionUID = -1005504757826370170L;
|
||||
|
||||
private final JProgressBar _progBar;
|
||||
private final JTextArea _progArea;
|
||||
private final Connection _con;
|
||||
|
||||
public DBInstallerGUI(Connection con)
|
||||
{
|
||||
super("L2J Database Installer");
|
||||
setLayout(new BorderLayout());
|
||||
setDefaultLookAndFeelDecorated(true);
|
||||
setIconImage(ImagesTable.getImage("l2j.png").getImage());
|
||||
|
||||
_con = con;
|
||||
|
||||
int width = 480;
|
||||
int height = 360;
|
||||
Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
|
||||
setResizable(false);
|
||||
|
||||
_progBar = new JProgressBar();
|
||||
_progBar.setIndeterminate(true);
|
||||
add(_progBar, BorderLayout.PAGE_START);
|
||||
|
||||
_progArea = new JTextArea();
|
||||
JScrollPane scrollPane = new JScrollPane(_progArea);
|
||||
|
||||
_progArea.setEditable(false);
|
||||
appendToProgressArea("Connected");
|
||||
|
||||
add(scrollPane, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressIndeterminate(boolean value)
|
||||
{
|
||||
_progBar.setIndeterminate(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressMaximum(int maxValue)
|
||||
{
|
||||
_progBar.setMaximum(maxValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressValue(int value)
|
||||
{
|
||||
_progBar.setValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendToProgressArea(String text)
|
||||
{
|
||||
_progArea.append(text + System.getProperty("line.separator"));
|
||||
_progArea.setCaretPosition(_progArea.getDocument().getLength());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection()
|
||||
{
|
||||
return _con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFrameVisible(boolean value)
|
||||
{
|
||||
setVisible(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int requestConfirm(String title, String message, int type)
|
||||
{
|
||||
return JOptionPane.showConfirmDialog(null, message, title, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(String title, String message, int type)
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, message, title, type);
|
||||
}
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Prevent the underlying input stream to close.
|
||||
* @author Joe Cheng, Zoey76
|
||||
*/
|
||||
public class CloseShieldedInputStream extends InputStream
|
||||
{
|
||||
private InputStream _in = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new close shielded input stream.
|
||||
* @param in the in
|
||||
*/
|
||||
public CloseShieldedInputStream(InputStream in)
|
||||
{
|
||||
_in = in;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
_in = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int read() throws IOException
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
throw new IOException("Stream is null!");
|
||||
}
|
||||
return _in.read();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int read(byte b[]) throws IOException
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
throw new IOException("Stream is null!");
|
||||
}
|
||||
return _in.read(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int read(byte b[], int off, int len) throws IOException
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
throw new IOException("Stream is null!");
|
||||
}
|
||||
return _in.read(b, off, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long skip(long n) throws IOException
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
throw new IOException("Stream is null!");
|
||||
}
|
||||
return _in.skip(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public synchronized void mark(int readlimit)
|
||||
{
|
||||
if (_in != null)
|
||||
{
|
||||
_in.mark(readlimit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean markSupported()
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _in.markSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public synchronized void reset() throws IOException
|
||||
{
|
||||
if (_in == null)
|
||||
{
|
||||
throw new IOException("Stream is null!");
|
||||
}
|
||||
_in.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the underlying stream.
|
||||
* @return the underlying stream
|
||||
*/
|
||||
public InputStream getUnderlyingStream()
|
||||
{
|
||||
return _in;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.util;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class FileWriterStdout extends BufferedWriter
|
||||
{
|
||||
public FileWriterStdout(FileWriter fileWriter)
|
||||
{
|
||||
super(fileWriter);
|
||||
}
|
||||
|
||||
public void println() throws IOException
|
||||
{
|
||||
append(System.getProperty("line.separator"));
|
||||
}
|
||||
|
||||
public void println(String line) throws IOException
|
||||
{
|
||||
append(line + System.getProperty("line.separator"));
|
||||
}
|
||||
|
||||
public void print(String text) throws IOException
|
||||
{
|
||||
append(text);
|
||||
}
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.util.mysql;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Formatter;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.DBOutputInterface;
|
||||
import com.l2jserver.tools.dbinstaller.util.FileWriterStdout;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class DBDumper
|
||||
{
|
||||
DBOutputInterface _frame;
|
||||
String _db;
|
||||
|
||||
public DBDumper(DBOutputInterface frame, String db)
|
||||
{
|
||||
_frame = frame;
|
||||
_db = db;
|
||||
createDump();
|
||||
}
|
||||
|
||||
public void createDump()
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Connection con = _frame.getConnection();
|
||||
try (Statement s = con.createStatement();
|
||||
ResultSet rset = s.executeQuery("SHOW TABLES"))
|
||||
{
|
||||
File dump = new File("dumps", form.format("%1$s_dump_%2$tY%2$tm%2$td-%2$tH%2$tM%2$tS.sql", _db, new GregorianCalendar().getTime()).toString());
|
||||
new File("dumps").mkdir();
|
||||
dump.createNewFile();
|
||||
|
||||
_frame.appendToProgressArea("Writing dump " + dump.getName());
|
||||
if (rset.last())
|
||||
{
|
||||
int rows = rset.getRow();
|
||||
rset.beforeFirst();
|
||||
if (rows > 0)
|
||||
{
|
||||
_frame.setProgressIndeterminate(false);
|
||||
_frame.setProgressMaximum(rows);
|
||||
}
|
||||
}
|
||||
|
||||
try (FileWriter fileWriter = new FileWriter(dump);
|
||||
FileWriterStdout fws = new FileWriterStdout(fileWriter))
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
_frame.setProgressValue(rset.getRow());
|
||||
_frame.appendToProgressArea("Dumping Table " + rset.getString(1));
|
||||
fws.println("CREATE TABLE `" + rset.getString(1) + "`");
|
||||
fws.println("(");
|
||||
try (Statement desc = con.createStatement();
|
||||
ResultSet dset = desc.executeQuery("DESC " + rset.getString(1)))
|
||||
{
|
||||
Map<String, List<String>> keys = new HashMap<>();
|
||||
boolean isFirst = true;
|
||||
while (dset.next())
|
||||
{
|
||||
if (!isFirst)
|
||||
{
|
||||
fws.println(",");
|
||||
}
|
||||
fws.print("\t`" + dset.getString(1) + "`");
|
||||
fws.print(" " + dset.getString(2));
|
||||
if (dset.getString(3).equals("NO"))
|
||||
{
|
||||
fws.print(" NOT NULL");
|
||||
}
|
||||
if (!dset.getString(4).isEmpty())
|
||||
{
|
||||
if (!keys.containsKey(dset.getString(4)))
|
||||
{
|
||||
keys.put(dset.getString(4), new ArrayList<String>());
|
||||
}
|
||||
keys.get(dset.getString(4)).add(dset.getString(1));
|
||||
}
|
||||
if (dset.getString(5) != null)
|
||||
{
|
||||
fws.print(" DEFAULT '" + dset.getString(5) + "'");
|
||||
}
|
||||
if (!dset.getString(6).isEmpty())
|
||||
{
|
||||
fws.print(" " + dset.getString(6));
|
||||
}
|
||||
isFirst = false;
|
||||
}
|
||||
if (keys.containsKey("PRI"))
|
||||
{
|
||||
fws.println(",");
|
||||
fws.print("\tPRIMARY KEY (");
|
||||
isFirst = true;
|
||||
for (String key : keys.get("PRI"))
|
||||
{
|
||||
if (!isFirst)
|
||||
{
|
||||
fws.print(", ");
|
||||
}
|
||||
fws.print("`" + key + "`");
|
||||
isFirst = false;
|
||||
}
|
||||
fws.print(")");
|
||||
}
|
||||
if (keys.containsKey("MUL"))
|
||||
{
|
||||
fws.println(",");
|
||||
isFirst = true;
|
||||
for (String key : keys.get("MUL"))
|
||||
{
|
||||
if (!isFirst)
|
||||
{
|
||||
fws.println(", ");
|
||||
}
|
||||
fws.print("\tKEY `key_" + key + "` (`" + key + "`)");
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
fws.println();
|
||||
fws.println(");");
|
||||
fws.flush();
|
||||
}
|
||||
|
||||
try (Statement desc = con.createStatement();
|
||||
ResultSet dset = desc.executeQuery("SELECT * FROM " + rset.getString(1)))
|
||||
{
|
||||
boolean isFirst = true;
|
||||
int cnt = 0;
|
||||
while (dset.next())
|
||||
{
|
||||
if ((cnt % 100) == 0)
|
||||
{
|
||||
fws.println("INSERT INTO `" + rset.getString(1) + "` VALUES ");
|
||||
}
|
||||
else
|
||||
{
|
||||
fws.println(",");
|
||||
}
|
||||
|
||||
fws.print("\t(");
|
||||
boolean isInFirst = true;
|
||||
for (int i = 1; i <= dset.getMetaData().getColumnCount(); i++)
|
||||
{
|
||||
if (!isInFirst)
|
||||
{
|
||||
fws.print(", ");
|
||||
}
|
||||
|
||||
if (dset.getString(i) == null)
|
||||
{
|
||||
fws.print("NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
fws.print("'" + dset.getString(i).replace("\'", "\\\'") + "'");
|
||||
}
|
||||
isInFirst = false;
|
||||
}
|
||||
fws.print(")");
|
||||
isFirst = false;
|
||||
|
||||
if ((cnt % 100) == 99)
|
||||
{
|
||||
fws.println(";");
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
if (!isFirst && ((cnt % 100) != 0))
|
||||
{
|
||||
fws.println(";");
|
||||
}
|
||||
fws.println();
|
||||
fws.flush();
|
||||
}
|
||||
}
|
||||
fws.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
_frame.appendToProgressArea("Dump Complete!");
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.util.mysql;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Formatter;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class MySqlConnect
|
||||
{
|
||||
Connection con = null;
|
||||
|
||||
public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
|
||||
{
|
||||
try (Formatter form = new Formatter())
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
|
||||
con = DriverManager.getConnection(formattedText, user, password);
|
||||
|
||||
try (Statement s = con.createStatement())
|
||||
{
|
||||
s.execute("CREATE DATABASE IF NOT EXISTS `" + db + "`");
|
||||
s.execute("USE `" + db + "`");
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
if (console)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "MySQL Error: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
catch (InstantiationException e)
|
||||
{
|
||||
if (console)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "Instantiation Exception: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
if (console)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "Illegal Access: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
if (console)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "Cannot find MySQL Connector: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection()
|
||||
{
|
||||
return con;
|
||||
}
|
||||
|
||||
public Statement getStatement()
|
||||
{
|
||||
try
|
||||
{
|
||||
return con.createStatement();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.println("Statement Null");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.util.mysql;
|
||||
|
||||
import java.awt.HeadlessException;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.l2jserver.tools.dbinstaller.DBOutputInterface;
|
||||
import com.l2jserver.util.file.filter.SQLFilter;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class ScriptExecutor
|
||||
{
|
||||
DBOutputInterface _frame;
|
||||
|
||||
public ScriptExecutor(DBOutputInterface frame)
|
||||
{
|
||||
_frame = frame;
|
||||
}
|
||||
|
||||
public void execSqlBatch(File dir)
|
||||
{
|
||||
execSqlBatch(dir, false);
|
||||
}
|
||||
|
||||
public void execSqlBatch(File dir, boolean skipErrors)
|
||||
{
|
||||
File[] file = dir.listFiles(new SQLFilter());
|
||||
Arrays.sort(file);
|
||||
_frame.setProgressIndeterminate(false);
|
||||
_frame.setProgressMaximum(file.length - 1);
|
||||
for (int i = 0; i < file.length; i++)
|
||||
{
|
||||
_frame.setProgressValue(i);
|
||||
execSqlFile(file[i], skipErrors);
|
||||
}
|
||||
}
|
||||
|
||||
public void execSqlFile(File file)
|
||||
{
|
||||
execSqlFile(file, false);
|
||||
}
|
||||
|
||||
public void execSqlFile(File file, boolean skipErrors)
|
||||
{
|
||||
_frame.appendToProgressArea("Installing " + file.getName());
|
||||
String line = "";
|
||||
Connection con = _frame.getConnection();
|
||||
try (Statement stmt = con.createStatement();
|
||||
Scanner scn = new Scanner(file))
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (scn.hasNextLine())
|
||||
{
|
||||
line = scn.nextLine();
|
||||
if (line.startsWith("--"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (line.contains("--"))
|
||||
{
|
||||
line = line.split("--")[0];
|
||||
}
|
||||
|
||||
line = line.trim();
|
||||
if (!line.isEmpty())
|
||||
{
|
||||
sb.append(line + System.getProperty("line.separator"));
|
||||
}
|
||||
|
||||
if (line.endsWith(";"))
|
||||
{
|
||||
stmt.execute(sb.toString());
|
||||
sb = new StringBuilder();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "File Not Found!: " + e.getMessage(), "Installer Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
if (!skipErrors)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object[] options =
|
||||
{
|
||||
"Continue",
|
||||
"Abort"
|
||||
};
|
||||
|
||||
int n = JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
if (n == 1)
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
catch (HeadlessException h)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,226 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Oracle or the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.l2jserver.tools.dbinstaller.util.swing;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
|
||||
import javax.swing.Spring;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
/**
|
||||
* A 1.4 file that provides utility methods for creating form- or grid-style layouts with SpringLayout.<br>
|
||||
* These utilities are used by several programs, such as SpringBox and SpringCompactGrid.
|
||||
*/
|
||||
public class SpringUtilities
|
||||
{
|
||||
/**
|
||||
* A debugging utility that prints to stdout the component's minimum, preferred, and maximum sizes.
|
||||
* @param c
|
||||
*/
|
||||
public static void printSizes(Component c)
|
||||
{
|
||||
System.out.println("minimumSize = " + c.getMinimumSize());
|
||||
System.out.println("preferredSize = " + c.getPreferredSize());
|
||||
System.out.println("maximumSize = " + c.getMaximumSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code> in a grid. Each component is as big as the maximum preferred width and height of the components. The parent is made just big enough to fit them all.
|
||||
* @param parent
|
||||
* @param rows number of rows
|
||||
* @param cols number of columns
|
||||
* @param initialX x location to start the grid at
|
||||
* @param initialY y location to start the grid at
|
||||
* @param xPad x padding between cells
|
||||
* @param yPad y padding between cells
|
||||
*/
|
||||
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad)
|
||||
{
|
||||
SpringLayout layout;
|
||||
try
|
||||
{
|
||||
layout = (SpringLayout) parent.getLayout();
|
||||
}
|
||||
catch (ClassCastException exc)
|
||||
{
|
||||
System.err.println("The first argument to makeGrid must use SpringLayout.");
|
||||
return;
|
||||
}
|
||||
|
||||
Spring xPadSpring = Spring.constant(xPad);
|
||||
Spring yPadSpring = Spring.constant(yPad);
|
||||
Spring initialXSpring = Spring.constant(initialX);
|
||||
Spring initialYSpring = Spring.constant(initialY);
|
||||
int max = rows * cols;
|
||||
|
||||
// Calculate Springs that are the max of the width/height so that all
|
||||
// cells have the same size.
|
||||
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).getWidth();
|
||||
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).getWidth();
|
||||
for (int i = 1; i < max; i++)
|
||||
{
|
||||
SpringLayout.Constraints cons = layout.getConstraints(parent.getComponent(i));
|
||||
|
||||
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
|
||||
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
|
||||
}
|
||||
|
||||
// Apply the new width/height Spring. This forces all the
|
||||
// components to have the same size.
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
SpringLayout.Constraints cons = layout.getConstraints(parent.getComponent(i));
|
||||
|
||||
cons.setWidth(maxWidthSpring);
|
||||
cons.setHeight(maxHeightSpring);
|
||||
}
|
||||
|
||||
// Then adjust the x/y constraints of all the cells so that they
|
||||
// are aligned in a grid.
|
||||
SpringLayout.Constraints lastCons = null;
|
||||
SpringLayout.Constraints lastRowCons = null;
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
SpringLayout.Constraints cons = layout.getConstraints(parent.getComponent(i));
|
||||
if ((i % cols) == 0)
|
||||
{ // start of new row
|
||||
lastRowCons = lastCons;
|
||||
cons.setX(initialXSpring);
|
||||
}
|
||||
else
|
||||
{
|
||||
// x position depends on previous component
|
||||
if (lastCons != null)
|
||||
{
|
||||
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST), xPadSpring));
|
||||
}
|
||||
}
|
||||
|
||||
if ((i / cols) == 0)
|
||||
{
|
||||
// first row
|
||||
cons.setY(initialYSpring);
|
||||
}
|
||||
else
|
||||
{
|
||||
// y position depends on previous row
|
||||
if (lastRowCons != null)
|
||||
{
|
||||
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH), yPadSpring));
|
||||
}
|
||||
}
|
||||
lastCons = cons;
|
||||
}
|
||||
|
||||
// Set the parent's size.
|
||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
||||
if (lastCons != null)
|
||||
{
|
||||
pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH)));
|
||||
pCons.setConstraint(SpringLayout.EAST, Spring.sum(Spring.constant(xPad), lastCons.getConstraint(SpringLayout.EAST)));
|
||||
}
|
||||
}
|
||||
|
||||
/* Used by makeCompactGrid. */
|
||||
private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols)
|
||||
{
|
||||
SpringLayout layout = (SpringLayout) parent.getLayout();
|
||||
Component c = parent.getComponent((row * cols) + col);
|
||||
return layout.getConstraints(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code> * <code>cols</code> components of <code>parent</code> in a grid. Each component in a column is as wide as the maximum preferred width of the components in that column; height is similarly determined for each row. The parent is made just big enough to fit
|
||||
* them all.
|
||||
* @param parent
|
||||
* @param rows number of rows
|
||||
* @param cols number of columns
|
||||
* @param initialX x location to start the grid at
|
||||
* @param initialY y location to start the grid at
|
||||
* @param xPad x padding between cells
|
||||
* @param yPad y padding between cells
|
||||
*/
|
||||
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad)
|
||||
{
|
||||
SpringLayout layout;
|
||||
try
|
||||
{
|
||||
layout = (SpringLayout) parent.getLayout();
|
||||
}
|
||||
catch (ClassCastException exc)
|
||||
{
|
||||
System.err.println("The first argument to makeCompactGrid must use SpringLayout.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Align all cells in each column and make them the same width.
|
||||
Spring x = Spring.constant(initialX);
|
||||
for (int c = 0; c < cols; c++)
|
||||
{
|
||||
Spring width = Spring.constant(0);
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
width = Spring.max(width, getConstraintsForCell(r, c, parent, cols).getWidth());
|
||||
}
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols);
|
||||
constraints.setX(x);
|
||||
constraints.setWidth(width);
|
||||
}
|
||||
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
|
||||
}
|
||||
|
||||
// Align all cells in each row and make them the same height.
|
||||
Spring y = Spring.constant(initialY);
|
||||
for (int r = 0; r < rows; r++)
|
||||
{
|
||||
Spring height = Spring.constant(0);
|
||||
for (int c = 0; c < cols; c++)
|
||||
{
|
||||
height = Spring.max(height, getConstraintsForCell(r, c, parent, cols).getHeight());
|
||||
}
|
||||
for (int c = 0; c < cols; c++)
|
||||
{
|
||||
SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols);
|
||||
constraints.setY(y);
|
||||
constraints.setHeight(height);
|
||||
}
|
||||
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
|
||||
}
|
||||
|
||||
// Set the parent's size.
|
||||
SpringLayout.Constraints pCons = layout.getConstraints(parent);
|
||||
pCons.setConstraint(SpringLayout.SOUTH, y);
|
||||
pCons.setConstraint(SpringLayout.EAST, x);
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package com.l2jserver.tools.gsregistering;
|
||||
|
||||
import java.awt.HeadlessException;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -28,19 +27,14 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.Server;
|
||||
import com.l2jserver.loginserver.GameServerTable;
|
||||
import com.l2jserver.tools.i18n.LanguageControl;
|
||||
import com.l2jserver.util.Util;
|
||||
|
||||
/**
|
||||
@ -50,7 +44,6 @@ import com.l2jserver.util.Util;
|
||||
public abstract class BaseGameServerRegister
|
||||
{
|
||||
private boolean _loaded = false;
|
||||
private ResourceBundle _bundle;
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
@ -58,221 +51,7 @@ public abstract class BaseGameServerRegister
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Locale locale = null;
|
||||
boolean gui = true;
|
||||
boolean interactive = true;
|
||||
boolean force = false;
|
||||
boolean fallback = false;
|
||||
BaseTask task = null;
|
||||
|
||||
ResourceBundle bundle = null;
|
||||
try
|
||||
{
|
||||
locale = Locale.getDefault();
|
||||
bundle = ResourceBundle.getBundle("gsregister.GSRegister", locale, LanguageControl.INSTANCE);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
System.out.println("FATAL: Failed to load default translation.");
|
||||
System.exit(666);
|
||||
}
|
||||
|
||||
String arg;
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
arg = args[i];
|
||||
|
||||
// --cmd : no gui
|
||||
if (arg.equals("-c") || arg.equals("--cmd"))
|
||||
{
|
||||
gui = false;
|
||||
}
|
||||
// --force : Forces GameServer register operations to overwrite a server if necessary
|
||||
else if (arg.equals("-f") || arg.equals("--force"))
|
||||
{
|
||||
force = true;
|
||||
}
|
||||
// --fallback : If an register operation fails due to ID already being in use it will then try to register first available ID
|
||||
else if (arg.equals("-b") || arg.equals("--fallback"))
|
||||
{
|
||||
fallback = true;
|
||||
}
|
||||
// --register <id> <hexid_dest_dir> : Register GameServer with ID <id> and output hexid on <hexid_dest_dir>
|
||||
// Fails if <id> already in use, unless -force is used (overwrites)
|
||||
else if (arg.equals("-r") || arg.equals("--register"))
|
||||
{
|
||||
gui = false;
|
||||
interactive = false;
|
||||
int id = Integer.parseInt(args[++i]);
|
||||
String dir = args[++i];
|
||||
|
||||
task = new RegisterTask(id, dir, force, fallback);
|
||||
}
|
||||
// --unregister <id> : Removes GameServer denoted by <id>
|
||||
else if (arg.equals("-u") || arg.equals("--unregister"))
|
||||
{
|
||||
gui = false;
|
||||
interactive = false;
|
||||
String gsId = args[++i];
|
||||
if (gsId.equalsIgnoreCase("all"))
|
||||
{
|
||||
task = new UnregisterAllTask();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int id = Integer.parseInt(gsId);
|
||||
task = new UnregisterTask(id);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
if (bundle != null)
|
||||
{
|
||||
System.out.printf(bundle.getString("wrongUnregisterArg") + Config.EOL, gsId);
|
||||
}
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// --language <locale> : Sets the app to use the specified locale, overriding auto-detection
|
||||
else if (arg.equals("-l") || arg.equals("--language"))
|
||||
{
|
||||
String loc = args[++i];
|
||||
Locale[] availableLocales = Locale.getAvailableLocales();
|
||||
Locale l;
|
||||
for (int j = 0; (j < availableLocales.length) && (locale == null); j++)
|
||||
{
|
||||
l = availableLocales[j];
|
||||
if (l.toString().equals(loc))
|
||||
{
|
||||
locale = l;
|
||||
}
|
||||
}
|
||||
if (locale == null)
|
||||
{
|
||||
System.out.println("Specified locale '" + loc + "' was not found, using default behaviour.");
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
bundle = ResourceBundle.getBundle("gsregister.GSRegister", locale, LanguageControl.INSTANCE);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
System.out.println("Failed to load translation ''");
|
||||
}
|
||||
}
|
||||
}
|
||||
// --help : Prints usage/arguments/credits
|
||||
else if (arg.equals("-h") || arg.equals("--help"))
|
||||
{
|
||||
gui = false;
|
||||
interactive = false;
|
||||
|
||||
BaseGameServerRegister.printHelp(bundle);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (gui)
|
||||
{
|
||||
BaseGameServerRegister.startGUI(bundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (interactive)
|
||||
{
|
||||
BaseGameServerRegister.startCMD(bundle);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there is a task, do it, else the app has already finished
|
||||
if (task != null)
|
||||
{
|
||||
task.setBundle(bundle);
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (HeadlessException e)
|
||||
{
|
||||
BaseGameServerRegister.startCMD(bundle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the help.
|
||||
* @param bundle the bundle
|
||||
*/
|
||||
private static void printHelp(ResourceBundle bundle)
|
||||
{
|
||||
String[] help =
|
||||
{
|
||||
bundle.getString("purpose"),
|
||||
"",
|
||||
bundle.getString("options"),
|
||||
"-b, --fallback\t\t\t\t" + bundle.getString("fallbackOpt"),
|
||||
"-c, --cmd\t\t\t\t" + bundle.getString("cmdOpt"),
|
||||
"-f, --force\t\t\t\t" + bundle.getString("forceOpt"),
|
||||
"-h, --help\t\t\t\t" + bundle.getString("helpOpt"),
|
||||
"-l, --language\t\t\t\t" + bundle.getString("languageOpt"),
|
||||
"-r, --register <id> <hexid_dest_dir>\t" + bundle.getString("registerOpt1"),
|
||||
"\t\t\t\t\t" + bundle.getString("registerOpt2"),
|
||||
"\t\t\t\t\t" + bundle.getString("registerOpt3"),
|
||||
"",
|
||||
"-u, --unregister <id>|all\t\t" + bundle.getString("unregisterOpt"),
|
||||
"",
|
||||
bundle.getString("credits"),
|
||||
bundle.getString("bugReports") + " http://www.l2jserver.com"
|
||||
|
||||
/*
|
||||
* "-b, --fallback\t\t\t\tIf an register operation fails due to ID already being in use it will then try to register first available ID", "-c, --cmd\t\t\t\tForces application to run in command-line mode even if the GUI is supported.",
|
||||
* "-f, --force\t\t\t\tForces GameServer register operations to overwrite a server if necessary", "-h, --help\t\t\t\tPrints this help message", "-l, --language <locale>\t\t\t\tAsks the application to use the specified locale, overriding auto-detection",
|
||||
* "-r, --register <id> <hexid_dest_dir>\tRegister GameServer with ID <id> and output hexid on <hexid_dest_dir>", "\t\t\t\t\tUse a negative value on <id> to register the first available ID", "\t\t\t\t\tFails if <id> already in use, unless --force is used (overwrites)", "",
|
||||
* "-u, --unregister <id>|all\t\tRemoves GameServer denoted by <id>, use \"all\" for removing all registered GameServers", "", "Copyright (C) L2J Team 2008-2012.", "Report bugs: http://www.l2jserver.com"
|
||||
*/
|
||||
};
|
||||
|
||||
for (String str : help)
|
||||
{
|
||||
System.out.println(str);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the GUI.
|
||||
* @param bundle the bundle.
|
||||
*/
|
||||
private static void startGUI(final ResourceBundle bundle)
|
||||
{
|
||||
try
|
||||
{
|
||||
// avoid that ugly Metal LaF
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// couldn't care less
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
GUserInterface gui = new GUserInterface(bundle);
|
||||
gui.getFrame().setVisible(true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the CMD.
|
||||
* @param bundle the bundle.
|
||||
*/
|
||||
private static void startCMD(final ResourceBundle bundle)
|
||||
{
|
||||
GameServerRegister cmdUi = new GameServerRegister(bundle);
|
||||
GameServerRegister cmdUi = new GameServerRegister();
|
||||
try
|
||||
{
|
||||
cmdUi.consoleUI();
|
||||
@ -283,15 +62,6 @@ public abstract class BaseGameServerRegister
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new base game server register.
|
||||
* @param bundle the bundle.
|
||||
*/
|
||||
public BaseGameServerRegister(ResourceBundle bundle)
|
||||
{
|
||||
setBundle(bundle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*/
|
||||
@ -314,24 +84,6 @@ public abstract class BaseGameServerRegister
|
||||
return _loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bundle.
|
||||
* @param bundle the bundle to set.
|
||||
*/
|
||||
public void setBundle(ResourceBundle bundle)
|
||||
{
|
||||
_bundle = bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bundle.
|
||||
* @return the bundle.
|
||||
*/
|
||||
public ResourceBundle getBundle()
|
||||
{
|
||||
return _bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the error.
|
||||
* @param msg the msg.
|
||||
@ -459,143 +211,6 @@ public abstract class BaseGameServerRegister
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class RegisterTask.
|
||||
*/
|
||||
private static class RegisterTask extends BaseTask
|
||||
{
|
||||
private final int _id;
|
||||
private final String _outDir;
|
||||
private boolean _force;
|
||||
private boolean _fallback;
|
||||
|
||||
/**
|
||||
* Instantiates a new register task.
|
||||
* @param id the id.
|
||||
* @param outDir the out dir.
|
||||
* @param force the force.
|
||||
* @param fallback the fallback.
|
||||
*/
|
||||
public RegisterTask(int id, String outDir, boolean force, boolean fallback)
|
||||
{
|
||||
_id = id;
|
||||
_outDir = outDir;
|
||||
_force = force;
|
||||
_fallback = fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the actions.
|
||||
* @param force the force.
|
||||
* @param fallback the fallback.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setActions(boolean force, boolean fallback)
|
||||
{
|
||||
_force = force;
|
||||
_fallback = fallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_id < 0)
|
||||
{
|
||||
int registeredId = BaseGameServerRegister.registerFirstAvailable(_outDir);
|
||||
|
||||
if (registeredId < 0)
|
||||
{
|
||||
System.out.println(getBundle().getString("noFreeId"));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.printf(getBundle().getString("registrationOk") + Config.EOL, registeredId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.printf(getBundle().getString("checkingIdInUse") + Config.EOL, _id);
|
||||
if (GameServerTable.getInstance().hasRegisteredGameServerOnId(_id))
|
||||
{
|
||||
System.out.println(getBundle().getString("yes"));
|
||||
if (_force)
|
||||
{
|
||||
System.out.printf(getBundle().getString("forcingRegistration") + Config.EOL, _id);
|
||||
BaseGameServerRegister.unregisterGameServer(_id);
|
||||
BaseGameServerRegister.registerGameServer(_id, _outDir);
|
||||
System.out.printf(getBundle().getString("registrationOk") + Config.EOL, _id);
|
||||
}
|
||||
else if (_fallback)
|
||||
{
|
||||
System.out.println(getBundle().getString("fallingBack"));
|
||||
int registeredId = BaseGameServerRegister.registerFirstAvailable(_outDir);
|
||||
|
||||
if (registeredId < 0)
|
||||
{
|
||||
System.out.println(getBundle().getString("noFreeId"));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.printf(getBundle().getString("registrationOk") + Config.EOL, registeredId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(getBundle().getString("noAction"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(getBundle().getString("no"));
|
||||
BaseGameServerRegister.registerGameServer(_id, _outDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
showError(getBundle().getString("sqlErrorRegister"), e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
showError(getBundle().getString("ioErrorRegister"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class UnregisterTask.
|
||||
*/
|
||||
private static class UnregisterTask extends BaseTask
|
||||
{
|
||||
private final int _id;
|
||||
|
||||
/**
|
||||
* Instantiates a new unregister task.
|
||||
* @param id the task id.
|
||||
*/
|
||||
public UnregisterTask(int id)
|
||||
{
|
||||
_id = id;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
System.out.printf(getBundle().getString("removingGsId") + Config.EOL, _id);
|
||||
try
|
||||
{
|
||||
BaseGameServerRegister.unregisterGameServer(_id);
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
showError(getBundle().getString("sqlErrorRegister"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class UnregisterAllTask.
|
||||
*/
|
||||
|
@ -1,387 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.gsregistering;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.loginserver.GameServerTable;
|
||||
import com.l2jserver.tools.images.ImagesTable;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class GUserInterface extends BaseGameServerRegister implements ActionListener
|
||||
{
|
||||
private final JFrame _frame;
|
||||
private final JTableModel _dtm;
|
||||
protected final JProgressBar _progressBar;
|
||||
|
||||
public JTable _gsTable;
|
||||
|
||||
public GUserInterface(ResourceBundle bundle)
|
||||
{
|
||||
super(bundle);
|
||||
|
||||
_frame = new JFrame();
|
||||
getFrame().setTitle(getBundle().getString("toolName"));
|
||||
getFrame().setSize(600, 400);
|
||||
getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
getFrame().setLayout(new GridBagLayout());
|
||||
GridBagConstraints cons = new GridBagConstraints();
|
||||
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
getFrame().setIconImage(ImagesTable.getImage("l2j.png").getImage());
|
||||
|
||||
JMenuBar menubar = new JMenuBar();
|
||||
getFrame().setJMenuBar(menubar);
|
||||
|
||||
JMenu fileMenu = new JMenu(getBundle().getString("fileMenu"));
|
||||
|
||||
JMenuItem exitItem = new JMenuItem(getBundle().getString("exitItem"));
|
||||
exitItem.addActionListener(this);
|
||||
exitItem.setActionCommand("exit");
|
||||
|
||||
fileMenu.add(exitItem);
|
||||
|
||||
JMenu helpMenu = new JMenu(getBundle().getString("helpMenu"));
|
||||
|
||||
JMenuItem aboutItem = new JMenuItem(getBundle().getString("aboutItem"));
|
||||
aboutItem.addActionListener(this);
|
||||
aboutItem.setActionCommand("about");
|
||||
|
||||
helpMenu.add(aboutItem);
|
||||
|
||||
menubar.add(fileMenu);
|
||||
menubar.add(helpMenu);
|
||||
|
||||
JButton btnRegister = new JButton(getBundle().getString("btnRegister"), ImagesTable.getImage("add.png"));
|
||||
btnRegister.addActionListener(this);
|
||||
btnRegister.setActionCommand("register");
|
||||
getFrame().add(btnRegister, cons);
|
||||
|
||||
cons.gridx = 1;
|
||||
cons.anchor = GridBagConstraints.LINE_END;
|
||||
JButton btnRemoveAll = new JButton(getBundle().getString("btnRemoveAll"), ImagesTable.getImage("cross.png"));
|
||||
btnRemoveAll.addActionListener(this);
|
||||
btnRemoveAll.setActionCommand("removeAll");
|
||||
getFrame().add(btnRemoveAll, cons);
|
||||
|
||||
String name = getBundle().getString("gsName");
|
||||
String action = getBundle().getString("gsAction");
|
||||
|
||||
_dtm = new JTableModel(new Object[]
|
||||
{
|
||||
"ID",
|
||||
name,
|
||||
action
|
||||
});
|
||||
_gsTable = new JTable(_dtm);
|
||||
_gsTable.addMouseListener(new JTableButtonMouseListener(_gsTable));
|
||||
|
||||
_gsTable.getColumnModel().getColumn(0).setMaxWidth(30);
|
||||
|
||||
TableColumn actionCollumn = _gsTable.getColumnModel().getColumn(2);
|
||||
actionCollumn.setCellRenderer(new ButtonCellRenderer());
|
||||
|
||||
cons.fill = GridBagConstraints.BOTH;
|
||||
cons.gridx = 0;
|
||||
cons.gridy = 1;
|
||||
cons.weighty = 1.0;
|
||||
cons.weightx = 1.0;
|
||||
cons.gridwidth = 2;
|
||||
JLayeredPane layer = new JLayeredPane();
|
||||
layer.setLayout(new BoxLayout(layer, BoxLayout.PAGE_AXIS));
|
||||
layer.add(new JScrollPane(_gsTable), 0);
|
||||
_progressBar = new JProgressBar();
|
||||
_progressBar.setIndeterminate(true);
|
||||
_progressBar.setVisible(false);
|
||||
layer.add(_progressBar, BorderLayout.CENTER, 1);
|
||||
// layer.setV
|
||||
getFrame().add(layer, cons);
|
||||
|
||||
refreshAsync();
|
||||
}
|
||||
|
||||
public void refreshAsync()
|
||||
{
|
||||
Thread t = new Thread(() -> GUserInterface.this.refreshServers(), "LoaderThread");
|
||||
t.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> _progressBar.setVisible(true));
|
||||
|
||||
super.load();
|
||||
|
||||
SwingUtilities.invokeLater(() -> _progressBar.setVisible(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(String msg, Throwable t)
|
||||
{
|
||||
String title;
|
||||
if (getBundle() != null)
|
||||
{
|
||||
title = getBundle().getString("error");
|
||||
msg += Config.EOL + getBundle().getString("reason") + ' ' + t.getLocalizedMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "Error";
|
||||
msg += Config.EOL + "Cause: " + t.getLocalizedMessage();
|
||||
}
|
||||
JOptionPane.showMessageDialog(getFrame(), msg, title, JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
protected void refreshServers()
|
||||
{
|
||||
if (!isLoaded())
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
// load succeeded?
|
||||
if (isLoaded())
|
||||
{
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
int size = GameServerTable.getInstance().getServerNames().size();
|
||||
if (size == 0)
|
||||
{
|
||||
String title = getBundle().getString("error");
|
||||
String msg = getBundle().getString("noServerNames");
|
||||
JOptionPane.showMessageDialog(getFrame(), msg, title, JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
// reset
|
||||
_dtm.setRowCount(0);
|
||||
|
||||
for (final int id : GameServerTable.getInstance().getRegisteredGameServers().keySet())
|
||||
{
|
||||
String name = GameServerTable.getInstance().getServerNameById(id);
|
||||
JButton button = new JButton(getBundle().getString("btnRemove"), ImagesTable.getImage("cross.png"));
|
||||
button.addActionListener(e ->
|
||||
{
|
||||
String sid = String.valueOf(id);
|
||||
String sname = GameServerTable.getInstance().getServerNameById(id);
|
||||
|
||||
int choice = JOptionPane.showConfirmDialog(getFrame(), getBundle().getString("confirmRemoveText").replace("%d", sid).replace("%s", sname), getBundle().getString("confirmRemoveTitle"), JOptionPane.YES_NO_OPTION);
|
||||
if (choice == JOptionPane.YES_OPTION)
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseGameServerRegister.unregisterGameServer(id);
|
||||
GUserInterface.this.refreshAsync();
|
||||
}
|
||||
catch (SQLException e1)
|
||||
{
|
||||
GUserInterface.this.showError(getBundle().getString("errorUnregister"), e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
_dtm.addRow(new Object[]
|
||||
{
|
||||
id,
|
||||
name,
|
||||
button
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
if (cmd.equals("register"))
|
||||
{
|
||||
RegisterDialog rd = new RegisterDialog(this);
|
||||
rd.setVisible(true);
|
||||
}
|
||||
else if (cmd.equals("exit"))
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
else if (cmd.equals("about"))
|
||||
{
|
||||
JOptionPane.showMessageDialog(getFrame(), getBundle().getString("credits") + Config.EOL + "http://www.l2jserver.com" + Config.EOL + Config.EOL + getBundle().getString("icons") + Config.EOL + Config.EOL + getBundle().getString("langText") + Config.EOL + getBundle().getString("translation"), getBundle().getString("aboutItem"), JOptionPane.INFORMATION_MESSAGE, ImagesTable.getImage("l2jserverlogo.png"));
|
||||
}
|
||||
else if (cmd.equals("removeAll"))
|
||||
{
|
||||
int choice = JOptionPane.showConfirmDialog(getFrame(), getBundle().getString("confirmRemoveAllText"), getBundle().getString("confirmRemoveTitle"), JOptionPane.YES_NO_OPTION);
|
||||
if (choice == JOptionPane.YES_OPTION)
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseGameServerRegister.unregisterAllGameServers();
|
||||
refreshAsync();
|
||||
}
|
||||
catch (SQLException e1)
|
||||
{
|
||||
GUserInterface.this.showError(getBundle().getString("errorUnregister"), e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the frame.
|
||||
*/
|
||||
public JFrame getFrame()
|
||||
{
|
||||
return _frame;
|
||||
}
|
||||
|
||||
protected class ButtonCellRenderer implements TableCellRenderer
|
||||
{
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
|
||||
{
|
||||
return (Component) value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward mouse-events from table to buttons inside.<br>
|
||||
* Buttons animate properly.
|
||||
* @author KenM
|
||||
*/
|
||||
private class JTableButtonMouseListener implements MouseListener
|
||||
{
|
||||
private final JTable _table;
|
||||
|
||||
public JTableButtonMouseListener(JTable table)
|
||||
{
|
||||
_table = table;
|
||||
}
|
||||
|
||||
private void forwardEvent(MouseEvent e)
|
||||
{
|
||||
TableColumnModel columnModel = _table.getColumnModel();
|
||||
int column = columnModel.getColumnIndexAtX(e.getX());
|
||||
int row = e.getY() / _table.getRowHeight();
|
||||
Object value;
|
||||
|
||||
if ((row >= _table.getRowCount()) || (row < 0) || (column >= _table.getColumnCount()) || (column < 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
value = _table.getValueAt(row, column);
|
||||
|
||||
if (value instanceof JButton)
|
||||
{
|
||||
final JButton b = (JButton) value;
|
||||
if (e.getID() == MouseEvent.MOUSE_PRESSED)
|
||||
{
|
||||
b.getModel().setPressed(true);
|
||||
b.getModel().setArmed(true);
|
||||
_table.repaint();
|
||||
}
|
||||
else if (e.getID() == MouseEvent.MOUSE_RELEASED)
|
||||
{
|
||||
b.doClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e)
|
||||
{
|
||||
forwardEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e)
|
||||
{
|
||||
forwardEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
forwardEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
forwardEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
forwardEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
private class JTableModel extends DefaultTableModel
|
||||
{
|
||||
private static final long serialVersionUID = -5907903982876753479L;
|
||||
|
||||
public JTableModel(Object[] columnNames)
|
||||
{
|
||||
super(columnNames, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int column)
|
||||
{
|
||||
return getValueAt(0, column).getClass();
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ import java.io.InputStreamReader;
|
||||
import java.io.LineNumberReader;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.loginserver.GameServerTable;
|
||||
@ -38,18 +37,15 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
BaseGameServerRegister.main(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bundle
|
||||
*/
|
||||
public GameServerRegister(ResourceBundle bundle)
|
||||
public GameServerRegister()
|
||||
{
|
||||
super(bundle);
|
||||
super();
|
||||
load();
|
||||
|
||||
int size = GameServerTable.getInstance().getServerNames().size();
|
||||
if (size == 0)
|
||||
{
|
||||
System.out.println(getBundle().getString("noServerNames"));
|
||||
System.out.println("No available names for GameServer, verify servername.xml file exists in the LoginServer folder.");
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
@ -65,15 +61,15 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
hr();
|
||||
System.out.println("GSRegister");
|
||||
System.out.println(Config.EOL);
|
||||
System.out.println("1 - " + getBundle().getString("cmdMenuRegister"));
|
||||
System.out.println("2 - " + getBundle().getString("cmdMenuListNames"));
|
||||
System.out.println("3 - " + getBundle().getString("cmdMenuRemoveGS"));
|
||||
System.out.println("4 - " + getBundle().getString("cmdMenuRemoveAll"));
|
||||
System.out.println("5 - " + getBundle().getString("cmdMenuExit"));
|
||||
System.out.println("1 - Register GameServer");
|
||||
System.out.println("2 - List GameServers Names and IDs");
|
||||
System.out.println("3 - Remove GameServer");
|
||||
System.out.println("4 - Remove ALL GameServers");
|
||||
System.out.println("5 - Exit");
|
||||
|
||||
do
|
||||
{
|
||||
System.out.print(getBundle().getString("yourChoice") + ' ');
|
||||
System.out.print("Choice: ");
|
||||
choice = _in.readLine();
|
||||
try
|
||||
{
|
||||
@ -98,14 +94,14 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
System.exit(0);
|
||||
break;
|
||||
default:
|
||||
System.out.printf(getBundle().getString("invalidChoice") + Config.EOL, choice);
|
||||
System.out.printf("Invalid Choice: %s" + Config.EOL, choice);
|
||||
choiceOk = false;
|
||||
}
|
||||
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
System.out.printf(getBundle().getString("invalidChoice") + Config.EOL, choice);
|
||||
System.out.printf("Invalid Choice: %s" + Config.EOL, choice);
|
||||
}
|
||||
}
|
||||
while (!choiceOk);
|
||||
@ -143,8 +139,8 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
|
||||
String id;
|
||||
boolean inUse;
|
||||
String gsInUse = getBundle().getString("gsInUse");
|
||||
String gsFree = getBundle().getString("gsFree");
|
||||
String gsInUse = "In Use";
|
||||
String gsFree = "Free";
|
||||
int gsStatusMaxLen = Math.max(gsInUse.length(), gsFree.length()) + 2;
|
||||
for (Entry<Integer, String> e : GameServerTable.getInstance().getServerNames().entrySet())
|
||||
{
|
||||
@ -182,16 +178,16 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
*/
|
||||
private void unregisterAllGS() throws IOException
|
||||
{
|
||||
if (yesNoQuestion(getBundle().getString("confirmRemoveAllText")))
|
||||
if (yesNoQuestion("Are you sure you want to remove ALL GameServers?"))
|
||||
{
|
||||
try
|
||||
{
|
||||
BaseGameServerRegister.unregisterAllGameServers();
|
||||
System.out.println(getBundle().getString("unregisterAllOk"));
|
||||
System.out.println("All GameServers were successfully removed.");
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
showError(getBundle().getString("sqlErrorUnregisterAll"), e);
|
||||
showError("An SQL error occurred while trying to remove ALL GameServers.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -203,9 +199,9 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
{
|
||||
hr();
|
||||
System.out.println(question);
|
||||
System.out.println("1 - " + getBundle().getString("yes"));
|
||||
System.out.println("2 - " + getBundle().getString("no"));
|
||||
System.out.print(getBundle().getString("yourChoice") + ' ');
|
||||
System.out.println("1 - Yes");
|
||||
System.out.println("2 - No");
|
||||
System.out.print("Choice: ");
|
||||
String choice;
|
||||
choice = _in.readLine();
|
||||
if (choice != null)
|
||||
@ -220,7 +216,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.printf(getBundle().getString("invalidChoice") + Config.EOL, choice);
|
||||
System.out.printf("Invalid Choice: %s" + Config.EOL, choice);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,7 +233,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
|
||||
do
|
||||
{
|
||||
System.out.print(getBundle().getString("enterDesiredId") + ' ');
|
||||
System.out.print("Enter desired ID: ");
|
||||
line = _in.readLine();
|
||||
try
|
||||
{
|
||||
@ -245,7 +241,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
System.out.printf(getBundle().getString("invalidChoice") + Config.EOL, line);
|
||||
System.out.printf("Invalid Choice: %s" + Config.EOL, line);
|
||||
}
|
||||
}
|
||||
while (id == Integer.MIN_VALUE);
|
||||
@ -253,27 +249,27 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
String name = GameServerTable.getInstance().getServerNameById(id);
|
||||
if (name == null)
|
||||
{
|
||||
System.out.printf(getBundle().getString("noNameForId") + Config.EOL, id);
|
||||
System.out.printf("No name for ID: %d" + Config.EOL, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameServerTable.getInstance().hasRegisteredGameServerOnId(id))
|
||||
{
|
||||
System.out.printf(getBundle().getString("confirmRemoveText") + Config.EOL, id, name);
|
||||
System.out.printf("Are you sure you want to remove GameServer %d - %s?" + Config.EOL, id, name);
|
||||
try
|
||||
{
|
||||
BaseGameServerRegister.unregisterGameServer(id);
|
||||
System.out.printf(getBundle().getString("unregisterOk") + Config.EOL, id);
|
||||
System.out.printf("GameServer ID: %d was successfully removed from LoginServer." + Config.EOL, id);
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
showError(getBundle().getString("sqlErrorUnregister"), e);
|
||||
showError("An SQL error occurred while trying to remove the GameServer.", e);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.printf(getBundle().getString("noServerForId") + Config.EOL, id);
|
||||
System.out.printf("No GameServer is registered on ID: %d" + Config.EOL, id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +282,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
|
||||
do
|
||||
{
|
||||
System.out.println(getBundle().getString("enterDesiredId"));
|
||||
System.out.println("Enter desired ID:");
|
||||
line = _in.readLine();
|
||||
try
|
||||
{
|
||||
@ -294,7 +290,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
System.out.printf(getBundle().getString("invalidChoice") + Config.EOL, line);
|
||||
System.out.printf("Invalid Choice: %s" + Config.EOL, line);
|
||||
}
|
||||
}
|
||||
while (id == Integer.MIN_VALUE);
|
||||
@ -302,13 +298,13 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
String name = GameServerTable.getInstance().getServerNameById(id);
|
||||
if (name == null)
|
||||
{
|
||||
System.out.printf(getBundle().getString("noNameForId") + Config.EOL, id);
|
||||
System.out.printf("No name for ID: %d" + Config.EOL, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameServerTable.getInstance().hasRegisteredGameServerOnId(id))
|
||||
{
|
||||
System.out.println(getBundle().getString("idIsNotFree"));
|
||||
System.out.println("This ID is not available.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -318,7 +314,7 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
showError(getBundle().getString("ioErrorRegister"), e);
|
||||
showError("An error saving the hexid file occurred while trying to register the GameServer.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -328,16 +324,8 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
public void showError(String msg, Throwable t)
|
||||
{
|
||||
String title;
|
||||
if (getBundle() != null)
|
||||
{
|
||||
title = getBundle().getString("error");
|
||||
msg += Config.EOL + getBundle().getString("reason") + ' ' + t.getLocalizedMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "Error";
|
||||
msg += Config.EOL + "Cause: " + t.getLocalizedMessage();
|
||||
}
|
||||
title = "Error";
|
||||
msg += Config.EOL + "Reason: " + t.getLocalizedMessage();
|
||||
System.out.println(title + ": " + msg);
|
||||
}
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.gsregistering;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import com.l2jserver.loginserver.GameServerTable;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class RegisterDialog extends JDialog implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final ResourceBundle _bundle;
|
||||
private final JComboBox<ComboServer> _combo;
|
||||
private final GUserInterface _owner;
|
||||
|
||||
public RegisterDialog(final GUserInterface owner)
|
||||
{
|
||||
super(owner.getFrame(), true);
|
||||
_owner = owner;
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
_bundle = owner.getBundle();
|
||||
setTitle(_bundle.getString("registerGS"));
|
||||
setResizable(false);
|
||||
setLayout(new GridBagLayout());
|
||||
GridBagConstraints cons = new GridBagConstraints();
|
||||
cons.weightx = 0.5;
|
||||
cons.weighty = 0.5;
|
||||
cons.gridx = 0;
|
||||
cons.gridy = 0;
|
||||
cons.fill = GridBagConstraints.BOTH;
|
||||
|
||||
final JLabel label = new JLabel(_bundle.getString("serverName"));
|
||||
this.add(label, cons);
|
||||
|
||||
_combo = new JComboBox<>();
|
||||
_combo.setEditable(false);
|
||||
for (Map.Entry<Integer, String> entry : GameServerTable.getInstance().getServerNames().entrySet())
|
||||
{
|
||||
if (!GameServerTable.getInstance().hasRegisteredGameServerOnId(entry.getKey()))
|
||||
{
|
||||
_combo.addItem(new ComboServer(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
cons.gridx = 1;
|
||||
cons.gridy = 0;
|
||||
this.add(_combo, cons);
|
||||
|
||||
cons.gridx = 0;
|
||||
cons.gridy = 1;
|
||||
cons.gridwidth = 2;
|
||||
JTextPane textPane = new JTextPane();
|
||||
textPane.setText(_bundle.getString("saveHexId"));
|
||||
textPane.setEditable(false);
|
||||
textPane.setBackground(label.getBackground());
|
||||
this.add(textPane, cons);
|
||||
cons.gridwidth = 1;
|
||||
|
||||
JButton btnSave = new JButton(_bundle.getString("save"));
|
||||
btnSave.setActionCommand("save");
|
||||
btnSave.addActionListener(this);
|
||||
cons.gridx = 0;
|
||||
cons.gridy = 2;
|
||||
this.add(btnSave, cons);
|
||||
|
||||
JButton btnCancel = new JButton(_bundle.getString("cancel"));
|
||||
btnCancel.setActionCommand("cancel");
|
||||
btnCancel.addActionListener(this);
|
||||
cons.gridx = 1;
|
||||
cons.gridy = 2;
|
||||
this.add(btnCancel, cons);
|
||||
|
||||
final double leftSize = Math.max(label.getPreferredSize().getWidth(), btnSave.getPreferredSize().getWidth());
|
||||
final double rightSize = Math.max(_combo.getPreferredSize().getWidth(), btnCancel.getPreferredSize().getWidth());
|
||||
|
||||
final double height = _combo.getPreferredSize().getHeight() + (4 * textPane.getPreferredSize().getHeight()) + btnSave.getPreferredSize().getHeight();
|
||||
this.setSize((int) (leftSize + rightSize + 30), (int) (height + 20));
|
||||
|
||||
setLocationRelativeTo(owner.getFrame());
|
||||
}
|
||||
|
||||
class ComboServer
|
||||
{
|
||||
private final int _id;
|
||||
private final String _name;
|
||||
|
||||
public ComboServer(int id, String name)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the id.
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
String cmd = e.getActionCommand();
|
||||
|
||||
if (cmd.equals("save"))
|
||||
{
|
||||
ComboServer server = (ComboServer) _combo.getSelectedItem();
|
||||
int gsId = server.getId();
|
||||
|
||||
JFileChooser fc = new JFileChooser();
|
||||
// fc.setS
|
||||
fc.setDialogTitle(_bundle.getString("hexidDest"));
|
||||
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
fc.setFileFilter(new FileFilter()
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean accept(File f)
|
||||
{
|
||||
return f.isDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
fc.showOpenDialog(this);
|
||||
|
||||
try
|
||||
{
|
||||
BaseGameServerRegister.registerGameServer(gsId, fc.getSelectedFile().getAbsolutePath());
|
||||
_owner.refreshAsync();
|
||||
setVisible(false);
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
_owner.showError(_bundle.getString("ioErrorRegister"), e1);
|
||||
}
|
||||
}
|
||||
else if (cmd.equals("cancel"))
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.i18n;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.ResourceBundle.Control;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public class LanguageControl extends Control
|
||||
{
|
||||
public static final String LANGUAGES_DIRECTORY = "../languages/";
|
||||
|
||||
public static final LanguageControl INSTANCE = new LanguageControl();
|
||||
|
||||
/**
|
||||
* prevent instancing, allows sub-classing
|
||||
*/
|
||||
protected LanguageControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IOException
|
||||
{
|
||||
if ((baseName == null) || (locale == null) || (format == null) || (loader == null))
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ResourceBundle bundle = null;
|
||||
if (format.equals("java.properties"))
|
||||
{
|
||||
format = "properties";
|
||||
String bundleName = toBundleName(baseName, locale);
|
||||
String resourceName = LANGUAGES_DIRECTORY + toResourceName(bundleName, format);
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(resourceName);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis))
|
||||
{
|
||||
bundle = new PropertyResourceBundle(bis);
|
||||
}
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.tools.images;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import javolution.util.FastMap;
|
||||
|
||||
/**
|
||||
* Usage of this class causes images to be loaded and kept in memory, and therefore should only be used by helper applications.<br>
|
||||
* Some icons from famfamfam (http://www.famfamfam.com/) credit *MUST* be given.
|
||||
* @author KenM
|
||||
*/
|
||||
public class ImagesTable
|
||||
{
|
||||
private static final Map<String, ImageIcon> IMAGES = new FastMap<>();
|
||||
|
||||
public static final String IMAGES_DIRECTORY = "../images/";
|
||||
|
||||
public static ImageIcon getImage(String name)
|
||||
{
|
||||
if (!IMAGES.containsKey(name))
|
||||
{
|
||||
IMAGES.put(name, new ImageIcon(IMAGES_DIRECTORY + name));
|
||||
}
|
||||
return IMAGES.get(name);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user