mirror of
https://github.com/ksherlock/profuse.git
synced 2024-12-25 08:29:22 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@136 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
982b754713
commit
99321a3f93
@ -142,7 +142,7 @@ FileEntry *VolumeEntry::fileAtIndex(unsigned i) const
|
||||
return i < _files.size() ? _files[i] : NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark FileEntry
|
||||
@ -150,10 +150,49 @@ FileEntry *VolumeEntry::fileAtIndex(unsigned i) const
|
||||
FileEntry::FileEntry(void *vp) :
|
||||
Entry(vp)
|
||||
{
|
||||
|
||||
|
||||
_status = Read8(vp, 0x05) & 0x01;
|
||||
_fileNameLength = Read8(vp, 0x06);
|
||||
std::memset(_fileName, 0, 16);
|
||||
std::memcpy(_fileName, 0x07 + (uint8_t *)vp, _fileNameLength);
|
||||
_lastByte = Read16(vp, 0x16);
|
||||
_modification = DateRec(Read16(vp, 0x18));
|
||||
}
|
||||
|
||||
FileEntry::~FileEntry()
|
||||
{
|
||||
delete _pageLength;
|
||||
}
|
||||
|
||||
|
||||
unsigned FileEntry::fileSize()
|
||||
{
|
||||
switch(fileKind())
|
||||
{
|
||||
case kTextFile:
|
||||
return textFileSize();
|
||||
break;
|
||||
default:
|
||||
return dataFileSize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FileEntry::read(uint8_t *buffer, unsigned size, unsigned offset)
|
||||
{
|
||||
switch(fileKind())
|
||||
{
|
||||
case kTextFile:
|
||||
return textRead(buffer, size, offset);
|
||||
break;
|
||||
default:
|
||||
return dataRead(buffer, size, offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
unsigned File::fileSize() {
|
||||
return (_lastBlock - _firstBlock - 1) * 512 + _lastByte;
|
||||
}
|
||||
|
@ -11,6 +11,19 @@ namespace ProFUSE {
|
||||
|
||||
namespace Pascal {
|
||||
|
||||
|
||||
enum {
|
||||
kUntypedFile,
|
||||
kBadBlockFile,
|
||||
kCodeFile,
|
||||
kTextFile,
|
||||
kInfoFile,
|
||||
kDataFile,
|
||||
kGrafFile,
|
||||
kFotoFile,
|
||||
kSecureDir
|
||||
};
|
||||
|
||||
class FileEntry;
|
||||
|
||||
class Entry {
|
||||
@ -97,13 +110,19 @@ class FileEntry : public Entry {
|
||||
unsigned _lastByte;
|
||||
DateRec _modification;
|
||||
|
||||
// non-text files
|
||||
unsigned dataFileSize();
|
||||
int dataRead(uint8_t *buffer, unsigned size, unsigned offset);
|
||||
|
||||
// for text files.
|
||||
unsigned textFileSize();
|
||||
int textRead(uint8_t *buffer, unsigned size, unsigned offset);
|
||||
|
||||
unsigned readTextPage(unsigned block, uint8_t *in);
|
||||
unsigned decodeTextPage(unsigned block, uint8_t *out);
|
||||
unsigned textReadPage(unsigned block, uint8_t *in);
|
||||
unsigned textDecodePage(unsigned block, uint8_t *out);
|
||||
|
||||
|
||||
std::vector<unsigned> *_pageLengths;
|
||||
std::vector<unsigned> *_pageLength;
|
||||
unsigned _fileSize;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user