Class: Yuki::VD

Inherits:
Object show all
Defined in:
docs/00000_Dependencies.rb

Overview

Class that helps to read Virtual Directories

In reading mode, the Virtual Directories can be loaded to RAM if MAX_SIZE >= VD.size

All the filenames inside the Yuki::VD has to be downcased filename in utf-8

Note : Encryption is up to the developper and no longer supported on the basic script

Constant Summary collapse

DEBUG_ON =

Is the debug info on ?

ARGV.include?('debug-yuki-vd')
MAX_SIZE =

The max size of the file that can be loaded in memory

10 * 1024 * 1024
ALLOWED_MODES =

10Mo List of allowed modes

%i[read write update]
POINTER_SIZE =

Size of the pointer at the begin of the file

4
UNPACK_METHOD =

Unpack method of the pointer at the begin of the file

'L'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, mode) ⇒ VD

Create a new Yuki::VD file or load it

Parameters:

  • filename (String)

    name of the Yuki::VD file

  • mode (:read, :write, :update)

    if we read or write the virtual directory



2624
2625
# File 'docs/00000_Dependencies.rb', line 2624

def initialize(filename, mode)
end

Instance Attribute Details

#filenameString (readonly)

Returns the filename of the current Yuki::VD.

Returns:

  • (String)

    the filename of the current Yuki::VD



2609
2610
2611
# File 'docs/00000_Dependencies.rb', line 2609

def filename
  @filename
end

Instance Method Details

#add_file(filename, ext_name = nil)

Add a file to the Yuki::VD

Parameters:

  • filename (String)

    the file name

  • ext_name (String, nil) (defaults to: nil)

    the file extension



2644
2645
# File 'docs/00000_Dependencies.rb', line 2644

def add_file(filename, ext_name = nil)
end

#close

Close the VD



2651
2652
# File 'docs/00000_Dependencies.rb', line 2651

def close
end

#exists?(filename) ⇒ Boolean

Test if a file exists in the VD

Parameters:

Returns:

  • (Boolean)


2634
2635
# File 'docs/00000_Dependencies.rb', line 2634

def exists?(filename)
end

#get_filenamesArray<String>

Get all the filename

Returns:



2648
2649
# File 'docs/00000_Dependencies.rb', line 2648

def get_filenames
end

#read_data(filename) ⇒ String?

Read a file data from the VD

Parameters:

  • filename (String)

    the file we want to read its data

Returns:

  • (String, nil)

    the data of the file



2629
2630
# File 'docs/00000_Dependencies.rb', line 2629

def read_data(filename)
end

#write_data(filename, data)

Write a file with its data in the VD

Parameters:

  • filename (String)

    the file name

  • data (String)

    the data of the file



2639
2640
# File 'docs/00000_Dependencies.rb', line 2639

def write_data(filename, data)
end