def initialize(txt_file, identifier)
@txt_file = String.new
@identifier = identifier
set_file(txt_file)
if Debug != 0 then
puts "File: " + @txt_file + "|"
puts "Identifier: " + @identifier
end
foo = false
@hash = Hash.new
@array = Array.new
array_counter = 0
begin
file = File.new(@txt_file, "r")
rescue
raise if !$!.to_s.include? File.expand_path(@txt_file)
file = @txt_file[@txt_file.length-@txt_file.reverse.index("/")..@txt_file.length]
response = Net::HTTP.get URI.parse(Rddc_url + file)
begin
Dir.mkdir(File.expand_path("~/.rddc"))
rescue
end
file = File.new(@txt_file, "w")
file.puts response
file.close
file = File.new(@txt_file, "r")
end
@part_found = false
file.each do |line|
if line[1] != nil then
foo = true if line.include? "<" + identifier + ">"
foo = false if line.include? "</" + identifier + ">"
@part_found = true if foo == true
if Debug != 0 then
puts line
puts "Part found!" if foo == true
end
if line[0..0] != "#" and line[0..0] != "<" and foo == true
if line.index("=") != nil then
key = line[0..line.index("=")-1]
value = line[line.index("=")+1..line.length-2]
else
key = line[0..line.length-2]
value = nil
end
@hash[key]=value
bar = Array.new(2)
bar[0]=key
bar[1]=value
@array[array_counter] = bar
array_counter += 1
if Debug == 2 then
puts "[" + key + "] [" + value + "]" if key != nil and value != nil
end
end
end
end
end