给你们个我刚写的配套使用代码【本人的水平拙劣,代码风格奇特,恐不符大众口味,还望见谅。
class Http Win32API.new("shell32","ShellExecute","lppppl","l").call(0,0,"RMHttpDelegate.exe","#{$$}",0,0) REQUEST = "RM_HTTP_REQUEST_#{$$}" RESULT = "RM_HTTP_RESULT_#{$$}" CONTENT = "RM_HTTP_CONTENT_#{$$}" PATH = ENV['temp'] def self.option(*strs) File.open("#{PATH}/#{REQUEST}", "w") {|f| f.write(strs.join("\n")) } end def self.check if File.exist?("#{PATH}/#{RESULT}") if File.read("#{PATH}/#{RESULT}") == "Success" return File.read("#{PATH}/#{CONTENT}") end end return nil end def self.dispose File.delete("#{PATH}/#{REQUEST}") if File.exist?("#{PATH}/#{REQUEST}") File.delete("#{PATH}/#{RESULT}") if File.exist?("#{PATH}/#{RESULT}") File.delete("#{PATH}/#{CONTENT}") if File.exist?("#{PATH}/#{CONTENT}") end end END { Http.dispose }
class Http
Win32API.new("shell32","ShellExecute","lppppl","l").call(0,0,"RMHttpDelegate.exe","#{$$}",0,0)
REQUEST = "RM_HTTP_REQUEST_#{$$}"
RESULT = "RM_HTTP_RESULT_#{$$}"
CONTENT = "RM_HTTP_CONTENT_#{$$}"
PATH = ENV['temp']
def self.option(*strs)
File.open("#{PATH}/#{REQUEST}", "w") {|f| f.write(strs.join("\n")) }
end
def self.check
if File.exist?("#{PATH}/#{RESULT}")
if File.read("#{PATH}/#{RESULT}") == "Success"
return File.read("#{PATH}/#{CONTENT}")
end
end
return nil
end
def self.dispose
File.delete("#{PATH}/#{REQUEST}") if File.exist?("#{PATH}/#{REQUEST}")
File.delete("#{PATH}/#{RESULT}") if File.exist?("#{PATH}/#{RESULT}")
File.delete("#{PATH}/#{CONTENT}") if File.exist?("#{PATH}/#{CONTENT}")
end
end
END { Http.dispose }
食用姿势:
第一步 把主L的exe文件下载下来重命名为RMHttpDelegate.exe放到游戏根目录
第二步 仅供参考- Http.option("www.baidu.com", "s?wd=Hello,World", "GET")
- switch = false
- loop do
- Graphics.update
- Input.update
- if switch && Http.check
- p Http.check
- switch = false
- end
- end
复制代码 |