Compare commits

..

No commits in common. "4cb3cbb491ec5c1e119efd3847929bd41adbcd84" and "f7b8e4d2652a9d54c9d76da564bd023694e49827" have entirely different histories.

6 changed files with 39 additions and 65 deletions

View file

@ -61,7 +61,7 @@ public class AppPreferences {
public void setNsIp(String ip){preferences.put("NSIP", ip);}
public String getNsIp(){return preferences.get("NSIP", "192.168.1.42");}
public String getRecent(){ return FilesHelper.getRealFolder(preferences.get("RECENT", System.getProperty("user.home"))); }
public String getRecent(){ return preferences.get("RECENT", System.getProperty("user.home")); }
public void setRecent(String path){ preferences.put("RECENT", path); }
//------------ SETTINGS ------------------//
@ -124,12 +124,12 @@ public class AppPreferences {
public int getSplitMergeType(){ return preferences.getInt("SM_TYPE", 0); }
public void setSplitMergeType(int value){ preferences.putInt("SM_TYPE", value); }
public String getSplitMergeRecent(){ return FilesHelper.getRealFolder(preferences.get("SM_RECENT", System.getProperty("user.home"))); }
public String getSplitMergeRecent(){ return preferences.get("SM_RECENT", System.getProperty("user.home")); }
public void setSplitMergeRecent(String value){ preferences.put("SM_RECENT", value); }
// RCM //
public String getRecentRcm(int num){ return preferences.get(String.format("RCM_%02d", num), ""); }
public void setRecentRcm(int num, String value){ preferences.put(String.format("RCM_%02d", num), value); }
// NXDT //
public String getNXDTSaveToLocation(){ return FilesHelper.getRealFolder(preferences.get("nxdt_saveto", System.getProperty("user.home"))); }
public String getNXDTSaveToLocation(){ return preferences.get("nxdt_saveto", System.getProperty("user.home")); }
public void setNXDTSaveToLocation(String value){ preferences.put("nxdt_saveto", value); }
}

View file

@ -32,7 +32,6 @@ import javafx.stage.FileChooser;
import nsusbloader.AppPreferences;
import nsusbloader.COM.NET.NETCommunications;
import nsusbloader.COM.USB.UsbCommunications;
import nsusbloader.FilesHelper;
import nsusbloader.MediatorControl;
import nsusbloader.ModelControllers.CancellableRunnable;
import nsusbloader.NSLDataTypes.EModule;
@ -194,7 +193,11 @@ public class FrontController implements Initializable {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(resourceBundle.getString("btn_OpenFile"));
fileChooser.setInitialDirectory(new File(FilesHelper.getRealFolder(previouslyOpenedPath)));
File validator = new File(previouslyOpenedPath);
if (validator.exists() && validator.isDirectory())
fileChooser.setInitialDirectory(validator);
else
fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));
if (getSelectedProtocol().equals("TinFoil") && MediatorControl.getInstance().getContoller().getSettingsCtrlr().getTinfoilSettings().isXciNszXczSupport())
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NSP/XCI/NSZ/XCZ", "*.nsp", "*.xci", "*.nsz", "*.xcz"));
@ -220,8 +223,11 @@ public class FrontController implements Initializable {
DirectoryChooser dirChooser = new DirectoryChooser();
dirChooser.setTitle(resourceBundle.getString("btn_OpenFile"));
String saveToLocation = FilesHelper.getRealFolder(previouslyOpenedPath);
dirChooser.setInitialDirectory(new File(saveToLocation));
File validator = new File(previouslyOpenedPath);
if (validator.exists() && validator.isDirectory())
dirChooser.setInitialDirectory(validator);
else
dirChooser.setInitialDirectory(new File(System.getProperty("user.home")));
splitFile = dirChooser.showDialog(usbNetPane.getScene().getWindow());

View file

@ -25,7 +25,6 @@ import javafx.scene.control.Label;
import javafx.scene.layout.Region;
import javafx.stage.DirectoryChooser;
import nsusbloader.AppPreferences;
import nsusbloader.FilesHelper;
import nsusbloader.MediatorControl;
import nsusbloader.ModelControllers.CancellableRunnable;
import nsusbloader.NSLDataTypes.EModule;
@ -53,8 +52,11 @@ public class NxdtController implements Initializable {
public void initialize(URL url, ResourceBundle resourceBundle) {
this.rb = resourceBundle;
String saveToLocation = AppPreferences.getInstance().getNXDTSaveToLocation();
saveToLocationLbl.setText(saveToLocation);
File saveToValidator = new File(AppPreferences.getInstance().getNXDTSaveToLocation());
if (saveToValidator.exists())
saveToLocationLbl.setText(saveToValidator.getAbsolutePath());
else
saveToLocationLbl.setText(System.getProperty("user.home"));
btnDumpStopImage = new Region();
btnDumpStopImage.getStyleClass().add("regionDump");

View file

@ -20,6 +20,7 @@ package nsusbloader.Controllers;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.input.DragEvent;
import javafx.scene.input.TransferMode;
@ -28,7 +29,6 @@ import javafx.scene.layout.VBox;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import nsusbloader.AppPreferences;
import nsusbloader.FilesHelper;
import nsusbloader.MediatorControl;
import nsusbloader.ModelControllers.CancellableRunnable;
import nsusbloader.NSLDataTypes.EModule;
@ -97,13 +97,10 @@ public class SplitMergeController implements Initializable {
saveToPathLbl.setText(AppPreferences.getInstance().getSplitMergeRecent());
changeSaveToBtn.setOnAction((actionEvent -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(resourceBundle.getString("tabSplMrg_Btn_SelectFolder"));
String saveToLocation = FilesHelper.getRealFolder(saveToPathLbl.getText());
directoryChooser.setInitialDirectory(new File(saveToLocation));
File saveToDir = directoryChooser.showDialog(changeSaveToBtn.getScene().getWindow());
DirectoryChooser dc = new DirectoryChooser();
dc.setTitle(resourceBundle.getString("tabSplMrg_Btn_SelectFolder"));
dc.setInitialDirectory(new File(saveToPathLbl.getText()));
File saveToDir = dc.showDialog(changeSaveToBtn.getScene().getWindow());
if (saveToDir != null)
saveToPathLbl.setText(saveToDir.getAbsolutePath());
}));
@ -230,6 +227,7 @@ public class SplitMergeController implements Initializable {
* */
@FXML
private void handleDrop(DragEvent event) {
Node sourceNode = (Node) event.getSource();
File fileDrpd = event.getDragboard().getFiles().get(0);
if (fileDrpd.isDirectory())

View file

@ -1,32 +0,0 @@
/*
Copyright 2019-2020 Dmitry Isaenko
This file is part of NS-USBloader.
NS-USBloader 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.
NS-USBloader 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 NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
*/
package nsusbloader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class FilesHelper {
public static String getRealFolder(String path){
Path splitMergePath = Paths.get(path);
if (Files.notExists(splitMergePath) || Files.isRegularFile(splitMergePath))
return System.getProperty("user.home");
return path;
}
}

View file

@ -1,29 +1,29 @@
katebtn_OpenFile=Selecionar Arquivos
btn_Upload=Carregar Arquivos
katebtn_OpenFile=Selecionar arquivos
btn_Upload=Upar para o switch
tab3_Txt_EnteredAsMsg1=Voc\u00EA logou como:
tab3_Txt_EnteredAsMsg2=Voc\u00EA precisa de permiss\u00F5es root ou ter configurado as regras 'udev' deste usu\u00E1rio para evitar poss\u00EDveis problemas.
tab3_Txt_FilesToUploadTitle=Arquivos Para Carregar:
tab3_Txt_FilesToUploadTitle=Arquivos para upar:
tab3_Txt_GreetingsMessage=Bem vindo ao NS-USBloader
tab3_Txt_NoFolderOrFileSelected=Nenhum arquivo selecionado. Nada para Carregar.
tab3_Txt_NoFolderOrFileSelected=Nenhum arquivo selecionado. Nada para upar.
windowBodyConfirmExit=Transfer\u00EAncia de dados em progresso: Fechar ir\u00E1 interromper.\nN\u00E3o \u00E9 aconselh\u00E1vel.\nInterromper processo e sair?
windowTitleConfirmExit=N\u00E3o, n\u00E3o fa\u00E7a isso!
btn_Stop=Interromper!
btn_Stop=Imterromper!
tab3_Txt_GreetingsMessage2=--\n\
Fonte: https://github.com/developersu/ns-usbloader/\n\
Source: https://github.com/developersu/ns-usbloader/\n\
Site: https://developersu.blogspot.com/search/label/NS-USBloader\n\
Dmitry Isaenko [developer.su]
tab1_table_Lbl_Status=Status
tab1_table_Lbl_FileName=Nome do Arquivo
tab1_table_Lbl_FileName=Nome do arquivo
tab1_table_Lbl_Size=Tamanho
tab1_table_Lbl_Upload=Carregar
tab1_table_Lbl_Upload=Upar
tab1_table_contextMenu_Btn_BtnDelete=Remover
tab1_table_contextMenu_Btn_DeleteAll=Remover Todos
tab1_table_contextMenu_Btn_DeleteAll=Remover todos
tab2_Lbl_HostIP=Host IP
tab1_Lbl_NSIP=NS IP:
tab2_Cb_ValidateNSHostName=Sempre validar o IP do switch.
windowBodyBadIp=Tem certeza que preencheu o endere\u00E7o IP corretamente?
windowTitleBadIp=Endere\u00E7o IP do switch provavelmente incorreto.
tab2_Cb_ExpertMode=Modo Avançado (Configura\u00E7\u00E3o NET)
tab2_Cb_ExpertMode=Modo Expert (Configura\u00E7\u00E3o NET)
tab2_Lbl_HostPort=porta
tab2_Cb_AutoDetectIp=Auto-detectar IP
tab2_Cb_RandSelectPort=Usar porta aleat\u00F3ria
@ -44,12 +44,12 @@ tab2_Lbl_Language=Idioma
windowBodyRestartToApplyLang=Por favor, reinicie para aplicar as modifica\u00E7\u00F5es.
btn_OpenSplitFile=Select split NSP
tab2_Lbl_ApplicationSettings=Configura\u00E7\u00F5es principais
tabSplMrg_Lbl_SplitNMergeTitle=Ferramenta de Fragmentar (Dividir) & Mesclar (Juntar) arquivos
tabSplMrg_RadioBtn_Split=Fragmentar (Dividir)
tabSplMrg_RadioBtn_Merge=Mesclar (Juntar)
tabSplMrg_Lbl_SplitNMergeTitle=Ferramenta de Fragmentar(Split) & mesclar (merge) arquivos
tabSplMrg_RadioBtn_Split=Fragmentar (Split)
tabSplMrg_RadioBtn_Merge=Mesclar (Merge)
tabSplMrg_Txt_File=Arquivo:
tabSplMrg_Txt_Folder=Fragmentar arquivo (pasta):
tabSplMrg_Btn_SelectFile=Selecionar Arquivo
tabSplMrg_Btn_SelectFile=Selecionar arquivo
tabSplMrg_Btn_SelectFolder=Selecionar Pasta
tabSplMrg_Lbl_SaveToLocation=Salvar em:
tabSplMrg_Btn_ChangeSaveToLocation=Trocar