Page 1 of 1

[Modules] Memory File System (all OS / DPI)

Posted: Thu Jun 23, 2022 6:43 pm
by Thorsten1867
MemoryFile - Module (all OS / 64Bit)

Based on an idea by srod & Kingwolf71, but their solution was far too complicated for me ;-)

Code: Select all

  ; MemFile::Create()   - comparable with CreateFile()
  ; MemFile::Open()     - comparable with OpenFile()
  ; MemFile::Close()    - reallocate memory with the actual size
  ; MemFile::Delete()   - comparable with DeleteFile()  
  ; MemFile::Free()     - removes the file and frees the memory 
  
  ; MemFile::Load()     - adds a file from HDD
  ; MemFile::Save()     - saves the file to HDD
  ; MemFile::Memory()   - adds a file from memory
  
  ; MemFile::Is()        - comparable with IsFile()
  ; MemFile::Size()      - comparable with FileSize()
  ; MemFile::Examine()   - comparable with ExamineDirectory()
  ; MemFile::NextEntry() - comparable with NextDirectoryEntry()
  ; MemFile::EntryID()   - returns the FileID => MemFile::Open()
  ; MemFile::EntryName() - comparable with DirectoryEntryName()
  ; MemFile::EntrySize() - comparable with DirectoryEntrySize()
  ; MemFile::Finish()    - comparable with FinishDirectory()
  
  ; MemFile::Loc()
  ; MemFile::FileSeek()
  ; MemFile::Lof()
  ; MemFile::Eof()
  
  ; MemFile::ReadStringFormat()
  ; MemFile::WriteStringFormat()
  
  ; MemFile::WriteAsciiCharacter()  
  ; MemFile::WriteByte()
  ; MemFile::WriteWord()
  ; MemFile::WriteUnicodeCharacter()
  ; MemFile::WriteLong()
  ; MemFile::WriteInteger()
  ; MemFile::WriteFloat()
  ; MemFile::WriteDouble()
  ; MemFile::WriteCharacter()
  ; MemFile::WriteString()
  ; MemFile::WriteStringN()
  
  ; MemFile::ReadAsciiCharacter()
  ; MemFile::ReadByte()
  ; MemFile::ReadUnicodeCharacter()
  ; MemFile::ReadWord()
  ; MemFile::ReadLong()
  ; MemFile::ReadInteger()
  ; MemFile::ReadFloat()
  ; MemFile::ReadDouble()
  ; MemFile::ReadCharacter()
  ; MemFile::ReadString()
    
  ; MemFile::Error()    - returns the last error

Download: MemoryFileModule.pbi

Re: [Modules] Memory File System (all OS / DPI)

Posted: Fri Jun 24, 2022 12:57 am
by BarryG
For "creating" files in memory, before writing them to disk? Also, the link doesn't open for me... Firefox and Edge both keep timing out when trying.

Re: [Modules] Memory File System (all OS / DPI)

Posted: Fri Jun 24, 2022 7:48 am
by Lord
Hi!

Both examples are missing the structure entry \EOF.
After adding this to MemFile_Structure both examples are complaining
that Entry() is not a Function, Array, Macro or LinkedList.

I stopped here.

Re: [Modules] Memory File System (all OS / DPI)

Posted: Fri Jun 24, 2022 10:49 am
by Thorsten1867
Lord wrote: Fri Jun 24, 2022 7:48 am Hi!

Both examples are missing the structure entry \EOF.
After adding this to MemFile_Structure both examples are complaining
that Entry() is not a Function, Array, Macro or LinkedList.

I stopped here.
Fixed