require 'mscorlib'
require 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

module Zlib

class GZipFile
	
	def close
	end

end

class GZipReader < GZipFile
	
	def initialize io
		@io = io
		carray = @io.read.to_clr_string.ToCharArray
		barray = []
		carray.each do |c| 
			b = System::BitConverter.GetBytes c
			barray << b[0]
		end
	ms = System::IO::MemoryStream.new
	barray.each { |b| ms.WriteByte b }
	ms.Position = 0
	@gzipstream = System::IO::Compression::GZipStream.new ms, System::IO::Compression::CompressionMode.Decompress
	end
	
	def read
		byte = 0
		sb = System::Text::StringBuilder.new
		while true
			byte = @gzipstream.ReadByte
		break if byte == -1
			sb.Append System::Convert.ToChar byte
		end 
	
	sb.ToString
	
	end
	
	def close
		@io.close
	end
end

class ZStream

	def finish
	end

end

class Inflate < ZStream

	def initialize window_bits
	end
	
	def inflate
			
	end

end
end