Skip to content
Snippets Groups Projects
Commit 0a34e467 authored by deuce's avatar deuce
Browse files

Add new anonymous property. Fix extended description reading.

Add documentation comment at beginning of file.
parent 82dc5e95
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,28 @@
* in the specified directory.
*
* Similar to filedir.js.
*
* Each element in the array is an object with the following properties:
*
* base: Base filename.
* ext: Filename extension.
* datoffset: Offset in .dat file of file data.
* uldate: Date uploaded
* dldate: Date downloaded(?)
* credits: Number of credits(?)
* desc: Short description (58 chars max)
* uploader: Name of user that uploaded the file.
* downloaded: Number of times the file has been downloaded.
* opencount: I have no idea what this is.
* misc: Misc flags... see FM_* below.
* anonymous: Anonymous upload
* altpath: Index into the internal array of alt paths (not visible to JavaScript)
* extdesc: May be undefined... extended description.
*/
var FM_EXTDESC = 1;
var FM_ANON = (1<<1);
function FileBase(dir) {
var f = new File(format("%s%s.ixb", file_area.dir[dir].data_dir, dir));
var dat = new File(format("%s%s.dat", file_area.dir[dir].data_dir, dir));
......@@ -12,7 +32,7 @@ function FileBase(dir) {
var record = null;
var ret = [];
function FileEntry(idx) {
function FileEntry() {
var byte;
function getrec(file, len) {
......@@ -47,13 +67,17 @@ function FileBase(dir) {
this.misc = ascii(this.misc)-32;
else
this.misc = 0;
if (this.misc & FM_ANON)
this.anonymous = true;
else
this.anonymous = false;
this.altpath = parseInt(getrec(dat, 2), 16);
// Read from the EXB file
this.extdesc = '';
if (exb.is_open) {
if (exb.length > idx*512) {
exb.position = idx * 512;
var exbpos = (dat.position / 118) * 512;
if (exb.is_open && (this.misc & FM_EXTDESC)) {
if (exb.length > exbpos) {
exb.position = exbpos;
this.extdesc = exb.read(512).replace(/\x00.*$/, '');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment