lib/FileSystemImage.rb in ripxplore-0.8.0 vs lib/FileSystemImage.rb in ripxplore-0.11.0

- old
+ new

@@ -9,10 +9,12 @@ attr_accessor :volume_name def FileSystemImage.is_file_system_image_filename?(filename) extension=File.extname(File.basename(filename,".gz")).downcase + RipXploreLog.debug("checking if is file system image filename - #{filename} (extension #{extension})") + RipXploreLog.debug(ImageFormat.all_possible_extensions.join(";")) ImageFormat.all_possible_extensions.include?(extension) end #given a bytestream (and, optionally, filename the bytes are from), return the class that is the best match for this class def FileSystemImage.best_fit(file_bytes,filename=nil) @@ -143,10 +145,20 @@ s<<"%-32s %-16s $%04x $%04x\n" % [file.filename,file.type_description,file.contents.length,file.load_address] end s end - def save_as(filename) +#produce a detailed description of everything we know about this disk and the files on it +def to_info_dump + s="" + self.files.sort.each do |file| + s<<"--------------------------------------------\n#{file.filename} (#{file.class})\n" + s<<file.to_info_dump + end + s +end + +def save_as(filename) if !(filename=~/\.gz$/).nil? then require 'zlib' f=Zlib::GzipWriter.new(open(filename,"wb")) else f=open(filename,"wb")