Class: DOSFile

Inherits:
DSKFile show all
Defined in:
lib/DOSFile.rb

Overview

Apple DOS 3.3 file

Constant Summary

Constants inherited from DSKFile

DSKFile::APPLESOFT_TOKENS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DSKFile

#==, #buffer_as_applesoft_file, #can_be_picture?, #file_extension, #hex_dump, #length_in_sectors, #to_ascii, #to_s

Constructor Details

#initialize(filename, contents, locked = false, file_type_byte = nil) ⇒ DOSFile

Returns a new instance of DOSFile.



12
13
14
15
16
17
18
# File 'lib/DOSFile.rb', line 12

def initialize(filename,contents,locked=false,file_type_byte=nil)
@filename=filename
@locked=locked
@contents=contents
  @file_type_byte=file_type_byte
  @file_type=sprintf("$%02X",file_type_byte)
end

Instance Attribute Details

#contentsObject

Returns the value of attribute contents.



11
12
13
# File 'lib/DOSFile.rb', line 11

def contents
  @contents
end

#file_type_byteObject

Returns the value of attribute file_type_byte.



11
12
13
# File 'lib/DOSFile.rb', line 11

def file_type_byte
  @file_type_byte
end

#filenameObject

Returns the value of attribute filename.



11
12
13
# File 'lib/DOSFile.rb', line 11

def filename
  @filename
end

#lockedObject

Returns the value of attribute locked.



11
12
13
# File 'lib/DOSFile.rb', line 11

def locked
  @locked
end

Class Method Details

.catalog_filename(filename) ⇒ Object

render a filename in form suitable for inclusion in a DOS catalog



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/DOSFile.rb', line 30

def  DOSFile.catalog_filename(filename)
  s=""
  for i in 0..29
    c=(filename[i])
    if c.nil? then
      c=0xA0        
      else 
      c=(c|0x80)
    end
    s+=c.chr
  end
  s
end

Instance Method Details

#catalog_filenameObject



44
45
46
# File 'lib/DOSFile.rb', line 44

def catalog_filename
  DOSFile.catalog_filename(filename)
end

#file_typeObject

File type as displayed in Apple DOS 3.3 Catalog



22
23
24
# File 'lib/DOSFile.rb', line 22

def file_type
	@file_type
end