$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) $:.unshift(File.dirname(__FILE__+"\\..")) unless $:.include?(File.dirname(__FILE__+"\\..")) || $:.include?(File.expand_path(File.dirname(__FILE__+"\\.."))) require 'FileSystem' class AppleCPM0x0F && sector[byte_number]!=0xe5 && sector[byte_number]!=0x1F) then is_valid=false break end if (sector[byte_number]==0xe5) then found_0xE5_byte=true end end end is_valid && found_0xE5_byte } #CPM DIR looks like this: #$00 User number, or E5h if it's a free entry #$01..0B Filename + extension: 8+3 characters #$0C..0D Extent number of this entry #$0E ??? #$0F Number of 128-byte records allocated in this extant #$10..1F Allocation map for this directory entry def self.files(file_system_image) files=FileContainer.new catalog=get_block(file_system_image,0)+get_block(file_system_image,1) 0.upto(63) do |dir_entry_no| dir_entry_start=dir_entry_no*0x20 dir_entry=catalog[dir_entry_start..dir_entry_start+0x1F] if (dir_entry[0]<0x10) then file_name=dir_entry[0x01..0x08].gsub(' ','') file_ext=dir_entry[0x09..0x0B].gsub(' ','') full_filename="#{file_name}.#{file_ext}" files<