Revert unrar5 experiment
This commit is contained in:
parent
e269bab186
commit
682c3b834f
|
@ -411,19 +411,6 @@ bitjs.archive = bitjs.archive || {};
|
||||||
return "unrar.js";
|
return "unrar.js";
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Unrarrer5
|
|
||||||
* @extends {bitjs.archive.Unarchiver}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
bitjs.archive.Unrarrer5 = function(arrayBuffer, optPathToBitJS) {
|
|
||||||
bitjs.base(this, arrayBuffer, optPathToBitJS);
|
|
||||||
};
|
|
||||||
bitjs.inherits(bitjs.archive.Unrarrer5, bitjs.archive.Unarchiver);
|
|
||||||
bitjs.archive.Unrarrer5.prototype.getScriptFileName = function() {
|
|
||||||
return "unrar5.js";
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Untarrer
|
* Untarrer
|
||||||
* @extends {bitjs.archive.Unarchiver}
|
* @extends {bitjs.archive.Unarchiver}
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
/* global VM_FIXEDGLOBALSIZE, VM_GLOBALMEMSIZE, MAXWINMASK, VM_GLOBALMEMADDR, MAXWINSIZE */
|
/* global VM_FIXEDGLOBALSIZE, VM_GLOBALMEMSIZE, MAXWINMASK, VM_GLOBALMEMADDR, MAXWINSIZE */
|
||||||
|
|
||||||
// This file expects to be invoked as a Worker (see onmessage below).
|
// This file expects to be invoked as a Worker (see onmessage below).
|
||||||
/*importScripts("../io/bitstream.js");
|
importScripts("../io/bitstream.js");
|
||||||
importScripts("../io/bytebuffer.js");
|
importScripts("../io/bytebuffer.js");
|
||||||
importScripts("archive.js");
|
importScripts("archive.js");
|
||||||
importScripts("rarvm.js");*/
|
importScripts("rarvm.js");
|
||||||
|
|
||||||
// Progress variables.
|
// Progress variables.
|
||||||
var currentFilename = "";
|
var currentFilename = "";
|
||||||
|
@ -29,21 +29,19 @@ var totalFilesInArchive = 0;
|
||||||
|
|
||||||
// Helper functions.
|
// Helper functions.
|
||||||
var info = function(str) {
|
var info = function(str) {
|
||||||
console.log(str);
|
postMessage(new bitjs.archive.UnarchiveInfoEvent(str));
|
||||||
// postMessage(new bitjs.archive.UnarchiveInfoEvent(str));
|
|
||||||
};
|
};
|
||||||
var err = function(str) {
|
var err = function(str) {
|
||||||
console.log(str);
|
postMessage(new bitjs.archive.UnarchiveErrorEvent(str));
|
||||||
// postMessage(new bitjs.archive.UnarchiveErrorEvent(str));
|
|
||||||
};
|
};
|
||||||
var postProgress = function() {
|
var postProgress = function() {
|
||||||
/*postMessage(new bitjs.archive.UnarchiveProgressEvent(
|
postMessage(new bitjs.archive.UnarchiveProgressEvent(
|
||||||
currentFilename,
|
currentFilename,
|
||||||
currentFileNumber,
|
currentFileNumber,
|
||||||
currentBytesUnarchivedInFile,
|
currentBytesUnarchivedInFile,
|
||||||
currentBytesUnarchived,
|
currentBytesUnarchived,
|
||||||
totalUncompressedBytesInArchive,
|
totalUncompressedBytesInArchive,
|
||||||
totalFilesInArchive));*/
|
totalFilesInArchive));
|
||||||
};
|
};
|
||||||
|
|
||||||
// shows a byte value as its hex representation
|
// shows a byte value as its hex representation
|
||||||
|
@ -1300,7 +1298,7 @@ var unrar = function(arrayBuffer) {
|
||||||
totalUncompressedBytesInArchive = 0;
|
totalUncompressedBytesInArchive = 0;
|
||||||
totalFilesInArchive = 0;
|
totalFilesInArchive = 0;
|
||||||
|
|
||||||
//postMessage(new bitjs.archive.UnarchiveStartEvent());
|
postMessage(new bitjs.archive.UnarchiveStartEvent());
|
||||||
var bstream = new bitjs.io.BitStream(arrayBuffer, false /* rtl */);
|
var bstream = new bitjs.io.BitStream(arrayBuffer, false /* rtl */);
|
||||||
|
|
||||||
var header = new RarVolumeHeader(bstream);
|
var header = new RarVolumeHeader(bstream);
|
||||||
|
@ -1350,7 +1348,7 @@ var unrar = function(arrayBuffer) {
|
||||||
localfile.unrar();
|
localfile.unrar();
|
||||||
|
|
||||||
if (localfile.isValid) {
|
if (localfile.isValid) {
|
||||||
// postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile));
|
postMessage(new bitjs.archive.UnarchiveExtractEvent(localfile));
|
||||||
postProgress();
|
postProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1360,7 +1358,7 @@ var unrar = function(arrayBuffer) {
|
||||||
} else {
|
} else {
|
||||||
err("Invalid RAR file");
|
err("Invalid RAR file");
|
||||||
}
|
}
|
||||||
// postMessage(new bitjs.archive.UnarchiveFinishEvent());
|
postMessage(new bitjs.archive.UnarchiveFinishEvent());
|
||||||
};
|
};
|
||||||
|
|
||||||
// event.data.file has the ArrayBuffer.
|
// event.data.file has the ArrayBuffer.
|
||||||
|
|
|
@ -162,15 +162,10 @@ function initProgressClick() {
|
||||||
function loadFromArrayBuffer(ab) {
|
function loadFromArrayBuffer(ab) {
|
||||||
var start = (new Date).getTime();
|
var start = (new Date).getTime();
|
||||||
var h = new Uint8Array(ab, 0, 10);
|
var h = new Uint8Array(ab, 0, 10);
|
||||||
unrar5(ab);
|
|
||||||
var pathToBitJS = "../../static/js/archive/";
|
var pathToBitJS = "../../static/js/archive/";
|
||||||
var lastCompletion = 0;
|
var lastCompletion = 0;
|
||||||
/*if (h[0] === 0x52 && h[1] === 0x61 && h[2] === 0x72 && h[3] === 0x21) { //Rar!
|
if (h[0] === 0x52 && h[1] === 0x61 && h[2] === 0x72 && h[3] === 0x21) { //Rar!
|
||||||
if (h[7] === 0x01) {
|
unarchiver = new bitjs.archive.Unrarrer(ab, pathToBitJS);
|
||||||
unarchiver = new bitjs.archive.Unrarrer(ab, pathToBitJS);
|
|
||||||
} else {
|
|
||||||
unarchiver = new bitjs.archive.Unrarrer5(ab, pathToBitJS);
|
|
||||||
}
|
|
||||||
} else if (h[0] === 80 && h[1] === 75) { //PK (Zip)
|
} else if (h[0] === 80 && h[1] === 75) { //PK (Zip)
|
||||||
unarchiver = new bitjs.archive.Unzipper(ab, pathToBitJS);
|
unarchiver = new bitjs.archive.Unzipper(ab, pathToBitJS);
|
||||||
} else if (h[0] === 255 && h[1] === 216) { // JPEG
|
} else if (h[0] === 255 && h[1] === 216) { // JPEG
|
||||||
|
@ -234,7 +229,7 @@ function loadFromArrayBuffer(ab) {
|
||||||
unarchiver.start();
|
unarchiver.start();
|
||||||
} else {
|
} else {
|
||||||
alert("Some error");
|
alert("Some error");
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollTocToActive() {
|
function scrollTocToActive() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user