diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 84792f2..3919afc 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -109,6 +109,27 @@ class Library extends Asset{ } } +class DistroModule extends Asset { + + /** + * Create a DistroModule. This is for processing, + * not equivalent to the module objects in the + * distro index. + * + * @param {any} id - id of the asset. + * @param {String} hash - hash value of the asset. + * @param {Number} size - size in bytes of the asset. + * @param {String} from - url where the asset can be found. + * @param {String} to - absolute local file path of the asset. + * @param {String} type - the module type. + */ + constructor(id, hash, size, from, to, type){ + super(id, hash, size, from, to) + this.type = type + } + +} + /** * Class representing a download tracker. This is used to store meta data * about a download queue, including the queue itself. @@ -320,6 +341,31 @@ function _extractPackXZ(filePaths){ }) } +function _finalizeForgeAsset(asset, basePath){ + return new Promise(function(fulfill, reject){ + fs.readFile(asset.to, (err, data) => { + const zip = new AdmZip(data) + const zipEntries = zip.getEntries() + + for(let i=0; i { + _chainValidateDistributionIndex(basePath).then((value) => { let servers = value.servers let serv = null for(let i=0; i { - console.log('minecraft:', data.toString('utf8')) + console.log('Minecraft:', data.toString('utf8')) }) child.stderr.on('data', (data) => { - console.log('minecraft:', data.toString('utf8')) + console.log('Minecraft:', data.toString('utf8')) }) child.on('close', (code, signal) => { - console.log('exited with code', code) + console.log('Exited with code', code) }) }) } -finalizeArguments = function(versionData, authData, basePath){ - const mcArgs = versionData['minecraftArguments'] +function finalizeArgumentsForge(versionData, forgeData, authData, basePath){ + const mcArgs = forgeData['minecraftArguments'] const gameProfile = authData['selectedProfile'] const regex = new RegExp('\\${*(.*)}') const argArr = mcArgs.split(' ') - argArr.unshift('net.minecraft.client.main.Main') - argArr.unshift(classpathArg(versionData, basePath)) - argArr.unshift('-cp') - argArr.unshift('-Djava.library.path=' + path.join(basePath, 'natives')) - argArr.unshift('-Xmn128M') - argArr.unshift('-XX:-UseAdaptiveSizePolicy') - argArr.unshift('-XX:+CMSIncrementalMode') - argArr.unshift('-XX:+UseConcMarkSweepGC') - argArr.unshift('-Xmx1G') + const staticArgs = ['-Xmx4G', + '-XX:+UseConcMarkSweepGC', + '-XX:+CMSIncrementalMode', + '-XX:-UseAdaptiveSizePolicy', + '-Xmn128M', + '-Djava.library.path=' + path.join(basePath, 'natives'), + '-cp', + classpathArg(versionData, basePath).concat(forgeClasspathArg(forgeData, basePath)).join(';'), + forgeData.mainClass] for(let i=0; i