瀏覽代碼

Fixed encoding in game list.

pull/21/head
veronie 4 年之前
父節點
當前提交
1718e1e05c
共有 3 個文件被更改,包括 9 次插入5 次删除
  1. +2
    -2
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/result/BggApi.java
  2. +7
    -2
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/handlers/ImportResultTxtHandler.java
  3. +0
    -1
      xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/parts/BatMain.java

+ 2
- 2
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/result/BggApi.java 查看文件

@@ -160,8 +160,8 @@ public class BggApi {
} else {
// HTTP_OK, go on...
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
new InputStreamReader(con.getInputStream(), "UTF-8"));
String inputLine = new String();
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);


+ 7
- 2
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/handlers/ImportResultTxtHandler.java 查看文件

@@ -58,6 +58,7 @@ public class ImportResultTxtHandler {
int lineNo = 0; // count overall lines
int errNo = 0; // count unparsable lines
int dupNo = 0; // count duplicates
boolean header = false;
try {
input = new FileReader(resultPath);
@@ -69,7 +70,10 @@ public class ImportResultTxtHandler {
lineNo++;
String[] tokens = myLine.split(",");
if(tokens.length > 0) {
if(tokens[0].equals("id")) continue; // header line
if(tokens[0].equals("id")) {
header = true;
continue; // header line
}
try {
boolean exists = !ids.add(Integer.parseInt(tokens[0]));
if(exists) {
@@ -90,7 +94,8 @@ public class ImportResultTxtHandler {
if(ids != null) {
MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
StringBuilder msg = new StringBuilder();
int thingsNo = lineNo - errNo - dupNo - 1;
int thingsNo = lineNo - errNo - dupNo;
if(header) thingsNo -= 1;
msg.append("Parsing successful. Found ").append(Integer.toString(thingsNo)).append(" things.");
if(errNo > 0) {
msg.append("\n\rSkipped ").append(Integer.toString(errNo)).append(" line(s).");


+ 0
- 1
xyz.veronie.bgg.ui/src/xyz/veronie/bgg/ui/parts/BatMain.java 查看文件

@@ -30,7 +30,6 @@ import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;


Loading…
取消
儲存