v0.3 UI is ready

This commit is contained in:
Dmitry Isaenko 2019-03-19 03:10:00 +03:00
parent 9bf4a76076
commit 31045683e4
12 changed files with 206 additions and 60 deletions

View file

@ -25,12 +25,40 @@ public class NETPacket {
"Content-Range: bytes %d-%d/%d\r\n"+
"Content-Length: %d\r\n"+
"Last-Modified: Mon, 18 Mar 2019 12:57:33 GMT\r\n\r\n";
private static final String CODE_400 =
"HTTP/1.0 400 invalid range\r\n"+
"Server: NS-USBloader-"+NSLMain.appVersion+"\r\n" +
"Date: %s\r\n" +
"Connection: close\r\n"+
"Content-Type: text/html;charset=utf-8\r\n"+
"Content-Length: 0\r\b\r\n";
private static final String CODE_404 =
"HTTP/1.0 404 Not Found\r\n"+
"Server: NS-USBloader-"+NSLMain.appVersion+"\r\n" +
"Date: %s\r\n" +
"Connection: close\r\n"+
"Content-Type: text/html;charset=utf-8\r\n"+
"Content-Length: 0\r\b\r\n";
private static final String CODE_416 =
"HTTP/1.0 416 Requested Range Not Satisfiable\r\n"+
"Server: NS-USBloader-"+NSLMain.appVersion+"\r\n" +
"Date: %s\r\n" +
"Connection: close\r\n"+
"Content-Type: text/html;charset=utf-8\r\n"+
"Content-Length: 0\r\b\r\n";
public static String getCode200(long nspFileSize){
return String.format(CODE_200, ZonedDateTime.now(ZoneId.of("GMT")).format(DateTimeFormatter.RFC_1123_DATE_TIME), nspFileSize-1, nspFileSize, nspFileSize);
}
public static String getCode206(long nspFileSize, long startPos, long endPos){
return String.format(CODE_206, ZonedDateTime.now(ZoneId.of("GMT")).format(DateTimeFormatter.RFC_1123_DATE_TIME), startPos, endPos, nspFileSize, endPos-startPos+1);
}
public static String getCode404(){
return String.format(CODE_404, ZonedDateTime.now(ZoneId.of("GMT")).format(DateTimeFormatter.RFC_1123_DATE_TIME));
}
public static String getCode416(){
return String.format(CODE_416, ZonedDateTime.now(ZoneId.of("GMT")).format(DateTimeFormatter.RFC_1123_DATE_TIME));
}
public static String getCode400(){
return String.format(CODE_400, ZonedDateTime.now(ZoneId.of("GMT")).format(DateTimeFormatter.RFC_1123_DATE_TIME));
}
}