Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (updateCheckMode == AUTO)
- {
- ByteArrayOutputStream patchOs = new ByteArrayOutputStream(756 * 1024);
- int patchCount = 0;
- for (Map.Entry<String, byte[]> file : zipFile.entrySet())
- {
- byte[] bytes;
- try (InputStream is = ClientLoader.class.getResourceAsStream("/patch/" + file.getKey() + ".bs"))
- {
- if (is == null)
- {
- continue;
- }
- bytes = ByteStreams.toByteArray(is);
- }
- patchOs.reset();
- Patch.patch(file.getValue(), bytes, patchOs);
- file.setValue(patchOs.toByteArray());
- final String OS = System.getProperty("os.name").toUpperCase();
- String dataFolder = "";
- if(OS.contains("WIN")){
- dataFolder = System.getenv("AppData");
- dataFolder += "\\SteroidClient\\patches";
- } else{
- dataFolder = System.getProperty("user.home");
- dataFolder += "/Library/Application Support/SteroidClient/patches";
- }
- File folder = new File(dataFolder);
- //File folder = new File("./patches/");
- File[] patches = folder.listFiles();
- if(patches != null) {
- for (File f : patches) {
- if (file.getKey().equals(f.getName())) {
- FileInputStream is = new FileInputStream(f);
- try {
- bytes = IOUtils.toByteArray(is);
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("BIG ERROR!");
- }
- log.info("Applied custom patch to: {}", file.getKey());
- file.setValue(bytes);
- is.close();
- }
- }
- }
- ++patchcount;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement