Filled in version.json, added utility function.

This commit is contained in:
Daniel Scalzi 2017-05-18 13:03:25 -04:00
parent a3c9130d7a
commit bd503f71c8
3 changed files with 150 additions and 100 deletions

View File

@ -158,6 +158,27 @@ const instance = new AssetGuard()
// Utility Functions // Utility Functions
/**
* Resolve an artifact id into a path. For example, on windows
* net.minecraftforge:forge:1.11.2-13.20.0.2282
* becomes
* net\minecraftforge\forge\1.11.2-13.20.0.2282\forge-1.11.2-13.20.0.2282.jar
*
* @param {String} artifact - the artifact id string.
* @param {String} extension - the extension of the file at the resolved path.
* @returns {String} - the resolved relative path from the artifact id.
*/
function _resolvePath(artifact, extension){
let ps = artifact.split(':')
let cs = ps[0].split('.')
cs.push(ps[1])
cs.push(ps[2])
cs.push(ps[1].concat('-').concat(ps[2]).concat(extension))
return path.join.apply(path, cs)
}
/** /**
* Calculates the hash for a file using the specified algorithm. * Calculates the hash for a file using the specified algorithm.
* *
@ -271,6 +292,7 @@ function _validateForgeJar(buf, checksums){
} }
function _extractPackXZ(filePath){ function _extractPackXZ(filePath){
return new Promise(function(fulfill, reject){
const libPath = path.join(__dirname, '..', 'libraries', 'java', 'PackXZExtract.jar') const libPath = path.join(__dirname, '..', 'libraries', 'java', 'PackXZExtract.jar')
console.log(libPath) console.log(libPath)
const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', ['-jar', libPath, '-packxz', filePath]) const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', ['-jar', libPath, '-packxz', filePath])
@ -282,6 +304,8 @@ function _extractPackXZ(filePath){
}) })
child.on('close', (code, signal) => { child.on('close', (code, signal) => {
console.log('exited with code', code) console.log('exited with code', code)
fulfill()
})
}) })
} }
@ -610,6 +634,5 @@ module.exports = {
processDlQueues, processDlQueues,
instance, instance,
Asset, Asset,
Library, Library
_extractPackXZ
} }

View File

@ -39,7 +39,6 @@ $(document).on('ready', function(){
/* Open web links in the user's default browser. */ /* Open web links in the user's default browser. */
$(document).on('click', 'a[href^="http"]', function(event) { $(document).on('click', 'a[href^="http"]', function(event) {
event.preventDefault(); event.preventDefault();
//ag._extractPackXZ(path.join(__dirname, '..', 'mcfiles', 'scala-continuations-library_2.11-1.0.2.jar.pack.xz'))
//testdownloads() //testdownloads()
shell.openExternal(this.href) shell.openExternal(this.href)
}); });

View File

@ -12,28 +12,13 @@
"autoconnect": true, "autoconnect": true,
"modules": [ "modules": [
{ {
"id": "MODNAME", "id": "net.minecraftforge:forge:1.11.2-13.20.0.2282",
"name": "Mod Name version 1.11.2",
"type": "forgemod",
"required": {
"value": false,
"def": false
},
"artifact": {
"size": 1234,
"MD5": "e71e88c744588fdad48d3b3beb4935fc",
"path": "forgemod path is appended to {basepath}/mods",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/somemod.jar"
}
},
{
"id": "net.minecraftforge.forge.forge-universal:1.11.2-13.20.0.2282",
"name": "Minecraft Forge 1.11.2-13.20.0.2282", "name": "Minecraft Forge 1.11.2-13.20.0.2282",
"type": "forge-hosted", "type": "forge-hosted",
"artifact": { "artifact": {
"size": 4123353, "size": 4123353,
"MD5": "1d0f1b383ec122a993e374771c954be2", "MD5": "1d0f1b383ec122a993e374771c954be2",
"path": "net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282-universal.jar", "extension": ".jar",
"url": "http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282-universal.jar" "url": "http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282-universal.jar"
}, },
"sub-modules": [ "sub-modules": [
@ -44,7 +29,7 @@
"artifact": { "artifact": {
"size": 32999, "size": 32999,
"MD5": "934b2d91c7c5be4a49577c9e6b40e8da", "MD5": "934b2d91c7c5be4a49577c9e6b40e8da",
"path": "net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/launchwrapper-1.12.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/launchwrapper-1.12.jar"
} }
}, },
@ -55,7 +40,7 @@
"artifact": { "artifact": {
"size": 241639, "size": 241639,
"MD5": "c5cc4613bbdfba3ccf5f0ab85390d0b8", "MD5": "c5cc4613bbdfba3ccf5f0ab85390d0b8",
"path": "org/ow2/asm/asm-all/5.0.3/asm-all-5.0.3.jar", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/asm-all-5.0.3.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/asm-all-5.0.3.jar"
} }
}, },
@ -64,190 +49,233 @@
"name": "Minecraft Forge (scala-library)", "name": "Minecraft Forge (scala-library)",
"type": "library", "type": "library",
"artifact": { "artifact": {
"size": 5612286, "size": 1474672,
"MD5": "f2d0c1ce6ab76531bbd48acbcd3d4ff1", "MD5": "f2d0c1ce6ab76531bbd48acbcd3d4ff1",
"path": "org/scala-lang/scala-library/2.11.1/scala-library-2.11.1.jar", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-library-2.11.1.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-library-2.11.1.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang:scala-compiler:2.11.1",
"name": "Minecraft Forge (scala-compiler)", "name": "Minecraft Forge (scala-compiler)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 3076920,
"MD5": "9c88616e35796955e0ff1235b11f1475", "MD5": "9c88616e35796955e0ff1235b11f1475",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-compiler-2.11.1.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-compiler-2.11.1.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang:scala-actors-migration_2.11:1.1.0",
"name": "Minecraft Forge (scala-actors-migration)", "name": "Minecraft Forge (scala-actors-migration)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 21324,
"MD5": "55e0dc48a2a122353628a463b9499cf0", "MD5": "55e0dc48a2a122353628a463b9499cf0",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-actors-migration_2.11-1.1.0.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-actors-migration_2.11-1.1.0.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2",
"name": "Minecraft Forge (scala-continuations-library)", "name": "Minecraft Forge (scala-continuations-library)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 7956,
"MD5": "820008ee6df308dafa0a6c478270aa19", "MD5": "820008ee6df308dafa0a6c478270aa19",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-continuations-library_2.11-1.0.2.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-continuations-library_2.11-1.0.2.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2",
"name": "Minecraft Forge (scala-continuations-plugin)", "name": "Minecraft Forge (scala-continuations-plugin)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 46140,
"MD5": "657a7ad23928bf4bee68202c7d7e1d56", "MD5": "657a7ad23928bf4bee68202c7d7e1d56",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-continuations-plugin_2.11.1-1.0.2.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-continuations-plugin_2.11.1-1.0.2.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang:scala-parser-combinators_2.11:1.0.1",
"name": "Minecraft Forge (scala-parser-combinators)", "name": "Minecraft Forge (scala-parser-combinators)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 85568,
"MD5": "de496467c91610e55e6e711b6bdbf10c", "MD5": "de496467c91610e55e6e711b6bdbf10c",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-parser-combinators_2.11-1.0.1.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-parser-combinators_2.11-1.0.1.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang:scala-reflect:2.11.1",
"name": "Minecraft Forge (scala-reflect)", "name": "Minecraft Forge (scala-reflect)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 1070312,
"MD5": "abbdaf710e856f6e65376706c9505952", "MD5": "abbdaf710e856f6e65376706c9505952",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-reflect-2.11.1.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-reflect-2.11.1.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "org.scala-lang:scala-swing_2.11:1.0.1",
"name": "Minecraft Forge (scala-swing)", "name": "Minecraft Forge (scala-swing)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 736795,
"MD5": "1d360289e697022a3f57abaad344b28f", "MD5": "1d360289e697022a3f57abaad344b28f",
"path": "", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-swing_2.11-1.0.1.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-swing_2.11-1.0.1.jar"
} }
}, },
{ {
"id": "", "id": "org.scala-lang:scala-xml_2.11:1.0.2",
"name": "Minecraft Forge (scala-xml)", "name": "Minecraft Forge (scala-xml)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 217812,
"MD5": "1c5a20efca1474626e0e0123f9cdd8ce", "MD5": "1c5a20efca1474626e0e0123f9cdd8ce",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-xml_2.11-1.0.2.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/scala-xml_2.11-1.0.2.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "com.typesafe.akka:akka-actor_2.11:2.3.3",
"name": "Minecraft Forge (akka-actor)", "name": "Minecraft Forge (akka-actor)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 746612,
"MD5": "469367f3308e571b1bdf2192d7779807", "MD5": "469367f3308e571b1bdf2192d7779807",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/akka-actor_2.11-2.3.3.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/akka-actor_2.11-2.3.3.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "com.typesafe:config:1.2.1",
"name": "Minecraft Forge (typesafe-config)", "name": "Minecraft Forge (typesafe-config)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 56636,
"MD5": "f24b281c40daef1280d5ef26b11caa63", "MD5": "f24b281c40daef1280d5ef26b11caa63",
"path": "", "extension": ".jar.pack.xz",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/config-1.2.1.jar.pack.xz" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/config-1.2.1.jar.pack.xz"
} }
}, },
{ {
"id": "", "id": "lzma:lzma:0.0.1",
"name": "Mojang (LZMA)", "name": "Mojang (LZMA)",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 5762,
"MD5": "a3e3c3186e41c4a1a3027ba2bb23cdc6", "MD5": "a3e3c3186e41c4a1a3027ba2bb23cdc6",
"path": "", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/lzma-0.0.1.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/lzma-0.0.1.jar"
} }
}, },
{ {
"id": "", "id": "net.sf.trove4j:trove4j:3.0.3",
"name": "Trove4J 3.0.3", "name": "Trove4J 3.0.3",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 2523218,
"MD5": "8fc4d4e0129244f9fd39650c5f30feb2", "MD5": "8fc4d4e0129244f9fd39650c5f30feb2",
"path": "", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/trove4j-3.0.3.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/trove4j-3.0.3.jar"
} }
}, },
{ {
"id": "", "id": "java3d:vecmath:1.5.2",
"name": "Vecmath 1.5.2", "name": "Vecmath 1.5.2",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 318956,
"MD5": "e5d2b7f46c4800a32f62ce75676a5710", "MD5": "e5d2b7f46c4800a32f62ce75676a5710",
"path": "", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/vecmath-1.5.2.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/vecmath-1.5.2.jar"
} }
}, },
{ {
"id": "", "id": "net.sf.jopt-simple:jopt-simple:4.6",
"name": "Jopt-simple 4.6", "name": "Jopt-simple 4.6",
"type": "", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 62477,
"MD5": "13560a58a79b46b82057686543e8d727", "MD5": "13560a58a79b46b82057686543e8d727",
"path": "", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/jopt-simple-4.6.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/jopt-simple-4.6.jar"
} }
}, },
{ {
"id": "", "id": "net.minecraftforge.MercuriusUpdater:1.11.2",
"name": "MercuriusUpdater 1.11.2", "name": "MercuriusUpdater 1.11.2",
"type": "library", "type": "library",
"artifact": { "artifact": {
"size": 0, "size": 15146,
"MD5": "13560a58a79b46b82057686543e8d727", "MD5": "13560a58a79b46b82057686543e8d727",
"path": "", "extension": ".jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/MercuriusUpdater-1.11.2.jar" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/MercuriusUpdater-1.11.2.jar"
} }
} }
] ]
}, },
{ {
"id": "net.optifine.optifine:1.11.2_HD_U_B8", "id": "net.optifine:optifine:1.11.2_HD_U_B8",
"name": "Optifine 1.11.2 HD U B8", "name": "Optifine (1.11.2_HD_U_B8)",
"type": "library", "type": "forgemod",
"artifact": { "artifact": {
"size": 2050307, "size": 2050307,
"MD5": "c18c80f8bfa2a440cc5af4ab8816bc4b", "MD5": "c18c80f8bfa2a440cc5af4ab8816bc4b",
"path": "optifine/OptiFine/1.11.2_HD_U_B8/OptiFine-1.11.2_HD_U_B8.jar", "path": "OptiFine-1.11.2_HD_U_B8.jar",
"url": "http://optifine.net/download.php?f=OptiFine_1.11.2_HD_U_B8.jar" "url": "http://optifine.net/download.php?f=OptiFine_1.11.2_HD_U_B8.jar"
} }
}, },
{
"id": "com.westeroscraft:westerosblocks:3.0.0-beta-1",
"name": "WesterosBlocks (3.0.0-beta-1)",
"type": "forgemod",
"artifact": {
"size": 16222133,
"MD5": "2a71c13afd289d15c9f95a23712b095d",
"path": "WesterosBlocks.jar",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/mods/WesterosBlocks.jar"
}
},
{
"id": "com.westeroscraft:westeroscraftrp:2017-03-21",
"name": "WesterosCraft Resource Pack (2017-03-21)",
"type": "file",
"artifact": {
"size": 58816622,
"MD5": "1b5dd219a21bda8cd0fb8f7ee986515a",
"path": "resourcepacks/WesterosCraft.zip",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/resourcepacks/WesterosCraft.zip"
}
},
{
"id": "options.txt",
"name": "Default Client Options",
"type": "file",
"artifact": {
"size": 1973,
"path": "options.txt",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/options-1.11.2.txt"
}
},
{
"id": "servers.dat",
"name": "Saved Client Servers",
"type": "file",
"artifact": {
"size": 87,
"MD5": "594de6063df993b5fde31c7290226ee4",
"path": "servers.dat",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/servers.dat"
}
},
{ {
"id": "chatbubbles", "id": "chatbubbles",
"name": "Chat Bubbles 1.11.2", "name": "Chat Bubbles 1.11.2",
@ -258,7 +286,7 @@
"artifact": { "artifact": {
"size": 37838, "size": 37838,
"MD5": "0497a93e5429b43082282e9d9119fcba", "MD5": "0497a93e5429b43082282e9d9119fcba",
"path": "litemod path is appended to {basepath}/mods/{mc-version}", "path": "mod_chatBubbles-1.0.1_for_1.11.2.litemod",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/mod_chatBubbles-1.0.1_for_1.11.2.litemod" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/mod_chatBubbles-1.0.1_for_1.11.2.litemod"
}, },
"sub-modules": [ "sub-modules": [
@ -269,7 +297,7 @@
"artifact": { "artifact": {
"size": 331, "size": 331,
"MD5": "f21b4b325f09238a3d6b2103d54351ef", "MD5": "f21b4b325f09238a3d6b2103d54351ef",
"path": "file path is appended to {basepath}", "path": "mods/chatbubbles/customRegexes.txt",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/customRegexes.txt" "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.11.2/customRegexes.txt"
} }
} }