Skip to content

Commit 98822de

Browse files
committed
Fix POM, update package name a bit, update NXDT-related part
1 parent 8771d55 commit 98822de

30 files changed

+298
-107
lines changed

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@
172172
</dependencies>
173173
<build>
174174
<plugins>
175+
<!-- Junit5 -->
176+
<plugin>
177+
<groupId>org.apache.maven.plugins</groupId>
178+
<artifactId>maven-surefire-plugin</artifactId>
179+
<version>2.22.2</version>
180+
</plugin>
181+
<plugin>
182+
<groupId>org.apache.maven.plugins</groupId>
183+
<artifactId>maven-failsafe-plugin</artifactId>
184+
<version>2.22.2</version>
185+
</plugin>
175186
<plugin>
176187
<groupId>org.apache.maven.plugins</groupId>
177188
<artifactId>maven-compiler-plugin</artifactId>

src/main/java/nsusbloader/Controllers/FrontController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import javafx.stage.DirectoryChooser;
3131
import javafx.stage.FileChooser;
3232
import nsusbloader.AppPreferences;
33-
import nsusbloader.COM.NET.NETCommunications;
34-
import nsusbloader.COM.USB.UsbCommunications;
33+
import nsusbloader.com.net.NETCommunications;
34+
import nsusbloader.com.usb.UsbCommunications;
3535
import nsusbloader.FilesHelper;
3636
import nsusbloader.MediatorControl;
3737
import nsusbloader.ModelControllers.CancellableRunnable;

src/main/java/nsusbloader/Utilities/Rcm.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
*/
2525
package nsusbloader.Utilities;
2626

27-
import nsusbloader.COM.USB.UsbConnect;
28-
import nsusbloader.COM.USB.UsbErrorCodes;
27+
import nsusbloader.com.usb.UsbConnect;
28+
import nsusbloader.com.usb.UsbErrorCodes;
2929
import nsusbloader.ModelControllers.ILogPrinter;
3030
import nsusbloader.ModelControllers.Log;
3131
import nsusbloader.NSLDataTypes.EModule;
@@ -39,14 +39,12 @@
3939

4040
public class Rcm implements Runnable{
4141

42-
private boolean status = false;
43-
4442
private enum ECurrentOS {
4543
win, lin, mac, unsupported
4644
}
4745

48-
private ILogPrinter logPrinter;
49-
private String filePath;
46+
private final ILogPrinter logPrinter;
47+
private final String filePath;
5048

5149
private DeviceHandle handler;
5250

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Copyright 2019-2020 Dmitry Isaenko, DarkMatterCore
3+
4+
This file is part of NS-USBloader.
5+
6+
NS-USBloader is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
NS-USBloader is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
package nsusbloader.Utilities.nxdumptool;
20+
21+
import java.io.File;
22+
import java.io.IOException;
23+
import java.io.RandomAccessFile;
24+
25+
public class NxdtNspFile {
26+
private final String name;
27+
private final int headerSize;
28+
private final long fullSize;
29+
private long nspRemainingSize;
30+
private final File file;
31+
32+
NxdtNspFile(String name, int headerSize, long fullSize, File file) throws Exception{
33+
this.name = name;
34+
this.headerSize = headerSize;
35+
this.fullSize = fullSize;
36+
this.file = file;
37+
this.nspRemainingSize = fullSize - headerSize;
38+
39+
removeIfExists();
40+
createHeaderFiller();
41+
}
42+
private void removeIfExists() throws Exception{
43+
if (! file.exists())
44+
return;
45+
46+
if (file.delete())
47+
return;
48+
49+
throw new Exception("Unable to delete leftovers of the NSP file: "+name);
50+
}
51+
private void createHeaderFiller() throws Exception {
52+
try (RandomAccessFile raf = new RandomAccessFile(file, "rw")){
53+
raf.setLength(headerSize);
54+
}
55+
catch (IOException e){
56+
throw new Exception("Unable to reserve space for NSP file's header: "+e.getMessage());
57+
}
58+
}
59+
60+
public String getName() { return name; }
61+
public int getHeaderSize() { return headerSize; }
62+
public long getFullSize() { return fullSize; }
63+
public File getFile() { return file; }
64+
public long getNspRemainingSize() { return nspRemainingSize; }
65+
66+
public void setNspRemainingSize(long nspRemainingSize) { this.nspRemainingSize = nspRemainingSize; }
67+
}

src/main/java/nsusbloader/Utilities/nxdumptool/NxdtTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package nsusbloader.Utilities.nxdumptool;
2020

21-
import nsusbloader.COM.USB.UsbConnect;
21+
import nsusbloader.com.usb.UsbConnect;
2222
import nsusbloader.ModelControllers.CancellableRunnable;
2323
import nsusbloader.ModelControllers.ILogPrinter;
2424
import nsusbloader.ModelControllers.Log;

0 commit comments

Comments
 (0)