Revert "Make the migration tool better"

This reverts commit 45b661b66b.
This commit is contained in:
Alexander Meech 2017-11-06 01:20:22 -05:00
parent 435cc0a041
commit fcf86712f7
1 changed files with 16 additions and 32 deletions

View File

@ -25,19 +25,11 @@ public class Main
private File _info;
private boolean _complete = false;
private int _nextStart;
public Main()
{
int start = 0;
try
{
if (new File(new File(".").getCanonicalPath() + File.separator + "complete.dat").exists())
{
return;
}
_info = new File(new File(".").getCanonicalPath() + File.separator + "converterInfo.dat");
System.out.println(_info.getCanonicalPath());
if (_info.exists())
@ -54,12 +46,7 @@ public class Main
Files.write("0".getBytes(), _info);
}
_nextStart = start;
while (!_complete)
{
convertGroup(_nextStart);
}
convertGroup(start);
}
catch (IOException e)
{
@ -136,49 +123,46 @@ public class Main
s.execute("DELETE FROM accountStat WHERE accountId=" + accountId + ";");
}
}
completeGroup(start);
complete(start);
}
else
{
System.out.println("[INFO] Conversion complete");
try
while (true)
{
new File(new File(".").getCanonicalPath() + File.separator + "complete.dat").createNewFile();
try
{
Thread.sleep(3000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
catch (IOException e)
{
e.printStackTrace();
}
_complete = true;
}
}
catch (SQLException e)
{
e.printStackTrace();
_complete = true;
}
}
private void completeGroup(int start)
private void complete(int start)
{
_nextStart = start + 10000;
int nextStart = start + 10000;
if (_info.delete())
{
try
{
_info.createNewFile();
Files.write((_nextStart + "").getBytes(), _info);
System.out.println("[INFO] Completed " + start + " to " + (_nextStart - 1));
Files.write((nextStart + "").getBytes(), _info);
System.out.println("[INFO] Completed " + start + " to " + (nextStart - 1));
}
catch (IOException e)
{
e.printStackTrace();
_complete = true;
return;
}
}
else
{
_complete = true;
}
}
}