class CFPropertyList::List

def load(file=nil,format=nil)

format = nil:: The format of the plist file. Auto-detect if nil
file = nil:: The filename of the file to read. If nil, use +filename+ instance variable
Read a plist file
def load(file=nil,format=nil)
  file = @filename if file.nil?
  format = @format if format.nil?
  @value = {}
  raise IOError.new("File #{file} not readable!") unless File.readable? file
  case format
  when List::FORMAT_BINARY, List::FORMAT_XML then
    prsr = @@parsers[format-1].new
    @value = prsr.load({:file => file})
  when List::FORMAT_AUTO then # what we now do is ugly, but neccessary to recognize the file format
    magic_number = IO.read(file,8)
    filetype = magic_number[0..5]
    version = magic_number[6..7]
    prsr = nil
    if filetype == "bplist" then
      raise CFFormatError.new("Wong file version #{version}") unless version == "00"
      prsr = Binary.new
    else
      prsr = XML.new
    end
    @value = prsr.load({:file => file})
  end
end