// Path: src/main/java/net/technicpack/minecraftcore/mojang/version/ExtractRulesFileFilter.java
// public class ExtractRulesFileFilter implements IZipFileFilter {
//     private ExtractRules rules;
// 
//     public ExtractRulesFileFilter(ExtractRules rules) {
//         this.rules = rules;
//     }
// 
//     @Override
//     public boolean shouldExtract(String fileName) {
//         return this.rules.shouldExtract(fileName);
//     }
// }
// 
// Path: src/main/java/net/technicpack/minecraftcore/mojang/version/io/Library.java
// public class Library {
// 
//     private static final StringSubstitutor SUBSTITUTOR = new StringSubstitutor();
//     private static final String[] fallback = { "http://mirror.technicpack.net/Technic/lib/", "https://search.maven.org/remotecontent?filepath=" };
//     private String name;
//     private List<Rule> rules;
//     private Map<OperatingSystem, String> natives;
//     private ExtractRules extract;
//     private String url;
// 
//     public String getUrl() {
//         return url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public List<Rule> getRules() {
//         return rules;
//     }
// 
//     public Map<OperatingSystem, String> getNatives() {
//         return natives;
//     }
// 
//     public ExtractRules getExtract() {
//         return extract;
//     }
// 
//     public boolean isForCurrentOS() {
//         if (rules == null) {
//             return true;
//         }
//         return Rule.isAllowable(rules, null);
//     }
// 
//     public String getArtifactPath() {
//         return getArtifactPath(null);
//     }
// 
//     public String getArtifactPath(String classifier) {
//         if (this.name == null) {
//             throw new IllegalStateException("Cannot get artifact path of empty/blank artifact");
//         }
//         return String.format("%s/%s", getArtifactBaseDir(), getArtifactFilename(classifier));
//     }
// 
//     public String getArtifactBaseDir() {
//         if (this.name == null) {
//             throw new IllegalStateException("Cannot get artifact dir of empty/blank artifact");
//         }
//         String[] parts = this.name.split(":", 3);
//         return String.format("%s/%s/%s", parts[0].replaceAll("\\.", "/"), parts[1], parts[2]);
//     }
// 
//     public String getArtifactFilename(String classifier) {
//         if (this.name == null) {
//             throw new IllegalStateException("Cannot get artifact filename of empty/blank artifact");
//         }
// 
//         String[] parts = this.name.split(":", 3);
//         String result;
// 
//         if (classifier != null) {
//             result = String.format("%s-%s%s.jar", parts[1], parts[2], "-" + classifier);
//         } else {
//             result = String.format("%s-%s%s.jar", parts[1], parts[2], "");
//         }
// 
//         return SUBSTITUTOR.replace(result);
//     }
// 
//     public String getDownloadUrl(String path, MirrorStore mirrorStore) {
//         if (this.url != null) {
//             String checkUrl = url + path;
//             if (Utils.pingHttpURL(checkUrl, mirrorStore)) {
//                 return checkUrl;
//             }
//             for (String string : fallback) {
//                 checkUrl = string + path;
//                 if (Utils.pingHttpURL(checkUrl, mirrorStore)) {
//                     return checkUrl;
//                 }
//             }
//         }
//         return "https://libraries.minecraft.net/" + path;
//     }
// 
// }


import net.technicpack.launchercore.install.ITasksQueue;
import net.technicpack.launchercore.install.InstallTasksQueue;
import net.technicpack.launchercore.install.LauncherDirectories;
import net.technicpack.launchercore.install.tasks.EnsureFileTask;
import net.technicpack.launchercore.install.tasks.ListenerTask;
import net.technicpack.launchercore.install.verifiers.IFileVerifier;
import net.technicpack.launchercore.install.verifiers.MD5FileVerifier;
import net.technicpack.launchercore.install.verifiers.ValidZipFileVerifier;
import net.technicpack.launchercore.modpacks.ModpackModel;
import net.technicpack.minecraftcore.mojang.version.ExtractRulesFileFilter;
import net.technicpack.minecraftcore.mojang.version.io.Library;
import net.technicpack.utilslib.IZipFileFilter;
import net.technicpack.utilslib.maven.MavenConnector;
import net.technicpack.utilslib.OperatingSystem;
import java.io.File;
import java.io.IOException;
            }
        }

        String path = library.getArtifactPath(natives).replace("${arch}", System.getProperty("sun.arch.data.model"));

        File cache = new File(directories.getCacheDirectory(), path);
        if (cache.getParentFile() != null) {
            cache.getParentFile().mkdirs();
        }

        ValidZipFileVerifier zipVerifier = new ValidZipFileVerifier();
        if (cache.exists() && zipVerifier.isFileValid(cache) && extractDirectory == null)
            return;

        IFileVerifier verifier = null;
        String url = null;

        if (!cache.exists() || !zipVerifier.isFileValid(cache)) {
            url = library.getDownloadUrl(path, queue.getMirrorStore()).replace("${arch}", System.getProperty("sun.arch.data.model"));
            String md5 = queue.getMirrorStore().getETag(url);
            if (md5 != null && !md5.isEmpty()) {
                verifier = new MD5FileVerifier(md5);
            } else {
                verifier = zipVerifier;
            }
        }

        IZipFileFilter filter = null;

        if (library.getExtract() != null)
// Path: src/main/java/net/technicpack/minecraftcore/mojang/version/ExtractRulesFileFilter.java
// public class ExtractRulesFileFilter implements IZipFileFilter {
//     private ExtractRules rules;
// 
//     public ExtractRulesFileFilter(ExtractRules rules) {
//         this.rules = rules;
//     }
// 
//     @Override
//     public boolean shouldExtract(String fileName) {
//         return this.rules.shouldExtract(fileName);
//     }
// }
// 
// Path: src/main/java/net/technicpack/minecraftcore/mojang/version/io/Library.java
// public class Library {
// 
//     private static final StringSubstitutor SUBSTITUTOR = new StringSubstitutor();
//     private static final String[] fallback = { "http://mirror.technicpack.net/Technic/lib/", "https://search.maven.org/remotecontent?filepath=" };
//     private String name;
//     private List<Rule> rules;
//     private Map<OperatingSystem, String> natives;
//     private ExtractRules extract;
//     private String url;
// 
//     public String getUrl() {
//         return url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public List<Rule> getRules() {
//         return rules;
//     }
// 
//     public Map<OperatingSystem, String> getNatives() {
//         return natives;
//     }
// 
//     public ExtractRules getExtract() {
//         return extract;
//     }
// 
//     public boolean isForCurrentOS() {
//         if (rules == null) {
//             return true;
//         }
//         return Rule.isAllowable(rules, null);
//     }
// 
//     public String getArtifactPath() {
//         return getArtifactPath(null);
//     }
// 
//     public String getArtifactPath(String classifier) {
//         if (this.name == null) {
//             throw new IllegalStateException("Cannot get artifact path of empty/blank artifact");
//         }
//         return String.format("%s/%s", getArtifactBaseDir(), getArtifactFilename(classifier));
//     }
// 
//     public String getArtifactBaseDir() {
//         if (this.name == null) {
//             throw new IllegalStateException("Cannot get artifact dir of empty/blank artifact");
//         }
//         String[] parts = this.name.split(":", 3);
//         return String.format("%s/%s/%s", parts[0].replaceAll("\\.", "/"), parts[1], parts[2]);
//     }
// 
//     public String getArtifactFilename(String classifier) {
//         if (this.name == null) {
//             throw new IllegalStateException("Cannot get artifact filename of empty/blank artifact");
//         }
// 
//         String[] parts = this.name.split(":", 3);
//         String result;
// 
//         if (classifier != null) {
//             result = String.format("%s-%s%s.jar", parts[1], parts[2], "-" + classifier);
//         } else {
//             result = String.format("%s-%s%s.jar", parts[1], parts[2], "");
//         }
// 
//         return SUBSTITUTOR.replace(result);
//     }
// 
//     public String getDownloadUrl(String path, MirrorStore mirrorStore) {
//         if (this.url != null) {
//             String checkUrl = url + path;
//             if (Utils.pingHttpURL(checkUrl, mirrorStore)) {
//                 return checkUrl;
//             }
//             for (String string : fallback) {
//                 checkUrl = string + path;
//                 if (Utils.pingHttpURL(checkUrl, mirrorStore)) {
//                     return checkUrl;
//                 }
//             }
//         }
//         return "https://libraries.minecraft.net/" + path;
//     }
// 
// }


// Path: src/main/java/net/technicpack/minecraftcore/install/tasks/InstallVersionLibTask.java
import net.technicpack.launchercore.install.ITasksQueue;
import net.technicpack.launchercore.install.InstallTasksQueue;
import net.technicpack.launchercore.install.LauncherDirectories;
import net.technicpack.launchercore.install.tasks.EnsureFileTask;
import net.technicpack.launchercore.install.tasks.ListenerTask;
import net.technicpack.launchercore.install.verifiers.IFileVerifier;
import net.technicpack.launchercore.install.verifiers.MD5FileVerifier;
import net.technicpack.launchercore.install.verifiers.ValidZipFileVerifier;
import net.technicpack.launchercore.modpacks.ModpackModel;
import net.technicpack.minecraftcore.mojang.version.ExtractRulesFileFilter;
import net.technicpack.minecraftcore.mojang.version.io.Library;
import net.technicpack.utilslib.IZipFileFilter;
import net.technicpack.utilslib.maven.MavenConnector;
import net.technicpack.utilslib.OperatingSystem;
import java.io.File;
import java.io.IOException;

            }
        }

        String path = library.getArtifactPath(natives).replace("${arch}", System.getProperty("sun.arch.data.model"));

        File cache = new File(directories.getCacheDirectory(), path);
        if (cache.getParentFile() != null) {
            cache.getParentFile().mkdirs();
        }

        ValidZipFileVerifier zipVerifier = new ValidZipFileVerifier();
        if (cache.exists() && zipVerifier.isFileValid(cache) && extractDirectory == null)
            return;

        IFileVerifier verifier = null;
        String url = null;

        if (!cache.exists() || !zipVerifier.isFileValid(cache)) {
            url = library.getDownloadUrl(path, queue.getMirrorStore()).replace("${arch}", System.getProperty("sun.arch.data.model"));
            String md5 = queue.getMirrorStore().getETag(url);
            if (md5 != null && !md5.isEmpty()) {
                verifier = new MD5FileVerifier(md5);
            } else {
                verifier = zipVerifier;
            }
        }

        IZipFileFilter filter = null;

        if (library.getExtract() != null)
            filter = new ExtractRulesFileFilter(library.getExtract());