bench consolidation
This commit is contained in:
parent
ca7698ad1f
commit
fa88b665b6
2 changed files with 21 additions and 8 deletions
|
|
@ -460,7 +460,7 @@ const HK_STATISTICS = {
|
||||||
function HKCheckCompletion(jsonObject) {
|
function HKCheckCompletion(jsonObject) {
|
||||||
|
|
||||||
// start benchmark
|
// start benchmark
|
||||||
let countBegin = new Date();
|
bench.begin.HKCC = new Date();
|
||||||
|
|
||||||
let HKPlayerData;
|
let HKPlayerData;
|
||||||
let HKWorldItems;
|
let HKWorldItems;
|
||||||
|
|
@ -650,8 +650,8 @@ function HKCheckCompletion(jsonObject) {
|
||||||
CompletionHTML(DIV_ID);
|
CompletionHTML(DIV_ID);
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
let countEnd = new Date();
|
bench.end.HKCC = new Date();
|
||||||
console.info("HKCheckCompletion() time (ms) =", countEnd - countBegin);
|
console.info("HKCheckCompletion() time (ms) =", bench.end.HKCC - bench.begin.HKCC);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,23 @@ const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a ne
|
||||||
|
|
||||||
// ---------------- Variables ----------------- //
|
// ---------------- Variables ----------------- //
|
||||||
|
|
||||||
let bench = { begin: 0, end: 0 };
|
let bench = {
|
||||||
|
begin: {
|
||||||
|
LSF: 0,
|
||||||
|
HKCC: 0,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
LSF: 0,
|
||||||
|
HKCC: 0,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------- Functions ----------------- //
|
// ---------------- Functions ----------------- //
|
||||||
|
|
||||||
// main input tag file function
|
// main input tag file function
|
||||||
function LoadSaveFile(input) {
|
function LoadSaveFile(input) {
|
||||||
// start benchmark
|
// start benchmark
|
||||||
bench.begin = new Date();
|
bench.begin.LSF = new Date();
|
||||||
|
|
||||||
// Prepares a File object from the first file of the input files for reading as an Array Buffer
|
// Prepares a File object from the first file of the input files for reading as an Array Buffer
|
||||||
let inputFileObject = input.files[0];
|
let inputFileObject = input.files[0];
|
||||||
|
|
@ -67,14 +76,14 @@ function ProcessFileObject() {
|
||||||
// Convert ArrayBuffer to string/text TextDecoder().decode(ArrayBuffer)
|
// Convert ArrayBuffer to string/text TextDecoder().decode(ArrayBuffer)
|
||||||
decodedString = new TextDecoder().decode(inputArrayBuffer);
|
decodedString = new TextDecoder().decode(inputArrayBuffer);
|
||||||
|
|
||||||
// 4. Paste decoded string file to text area
|
// 4. Paste decoded string file to text area
|
||||||
|
|
||||||
document.getElementById("save-area").value = "";
|
document.getElementById("save-area").value = "";
|
||||||
document.getElementById("save-area").value = decodedString;
|
document.getElementById("save-area").value = decodedString;
|
||||||
|
|
||||||
// finish and show benchmark
|
// finish and show benchmark
|
||||||
bench.end = new Date();
|
bench.end.LSF = new Date();
|
||||||
console.info("LoadSaveFile() time (ms) =", bench.end - bench.begin);
|
console.info("LoadSaveFile() time (ms) =", bench.end.LSF - bench.begin.LSF);
|
||||||
|
|
||||||
// after pasting the decoded string, launch the main analyzing function immediately
|
// after pasting the decoded string, launch the main analyzing function immediately
|
||||||
HKReadTextArea();
|
HKReadTextArea();
|
||||||
|
|
@ -83,6 +92,7 @@ function ProcessFileObject() {
|
||||||
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
// alert(`Array Buffer: ${inputArrayBuffer}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(`The file cannot be decoded. Error: ${error}`);
|
alert(`The file cannot be decoded. Error: ${error}`);
|
||||||
|
console.info(`The file cannot be decoded. Error: ${error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,8 +121,10 @@ function Base64Decode(buffer) {
|
||||||
let p = buffer.indexOf(64);
|
let p = buffer.indexOf(64);
|
||||||
buffer = buffer.subarray(0, p != -1 ? p : buffer.length);
|
buffer = buffer.subarray(0, p != -1 ? p : buffer.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = new Uint8Array(3 * buffer.length / 4);
|
let output = new Uint8Array(3 * buffer.length / 4);
|
||||||
let continuous = Math.floor(buffer.length / 4) * 4;
|
let continuous = Math.floor(buffer.length / 4) * 4;
|
||||||
|
|
||||||
for (let i = 0; i < continuous; i += 4) {
|
for (let i = 0; i < continuous; i += 4) {
|
||||||
let k = 3 * i / 4;
|
let k = 3 * i / 4;
|
||||||
output[k] = buffer[i] << 2 | buffer[i + 1] >> 4;
|
output[k] = buffer[i] << 2 | buffer[i + 1] >> 4;
|
||||||
|
|
@ -126,6 +138,7 @@ function Base64Decode(buffer) {
|
||||||
output[k + 1] = (buffer[continuous + 1] & 0x0F) << 4 | buffer[continuous + 2] >> 2;
|
output[k + 1] = (buffer[continuous + 1] & 0x0F) << 4 | buffer[continuous + 2] >> 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue