Commit 5a87a77c authored by zh99998's avatar zh99998

0.6.6 URL protocol

parent 709a9dbb
/nbproject/ /nbproject/
/.idea/
/ruby/ /ruby/
/pkg/ /pkg/
/config.yml /config.yml
......
...@@ -7,10 +7,6 @@ require 'rdoc/task' ...@@ -7,10 +7,6 @@ require 'rdoc/task'
#require 'rake/testtask' #require 'rake/testtask'
Windows = RUBY_PLATFORM["mingw"] || RUBY_PLATFORM["mswin"] Windows = RUBY_PLATFORM["mingw"] || RUBY_PLATFORM["mswin"]
if Windows
STDOUT.set_encoding "GBK", "UTF-8"
STDERR.set_encoding "GBK", "UTF-8"
end
#在windows上UTF-8脚本编码环境中 Dir.glob无法列出中文目录下的文件 所以自己写个递归 #在windows上UTF-8脚本编码环境中 Dir.glob无法列出中文目录下的文件 所以自己写个递归
def list(path) def list(path)
result = [] result = []
...@@ -24,7 +20,7 @@ end ...@@ -24,7 +20,7 @@ end
spec = Gem::Specification.new do |s| spec = Gem::Specification.new do |s|
s.name = 'mycard' s.name = 'mycard'
s.version = '0.6.4' s.version = '0.6.6'
s.extra_rdoc_files = ['README.txt', 'LICENSE.txt'] s.extra_rdoc_files = ['README.txt', 'LICENSE.txt']
s.summary = 'a card game' s.summary = 'a card game'
s.description = s.summary s.description = s.summary
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
p ARGV
STDIN.gets
begin begin
#定义全局方法 #定义全局方法
def load_config(file="config.yml") def load_config(file="config.yml")
...@@ -19,8 +17,10 @@ begin ...@@ -19,8 +17,10 @@ begin
if RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"] if RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"]
require 'win32/registry' require 'win32/registry'
pwd = Dir.pwd.gsub('/', '\\') pwd = Dir.pwd.gsub('/', '\\')
path = '"' + pwd + '\ruby\bin\ruby.exe" -C"' + pwd + '" -KU lib/main.rb' path = '"' + pwd + '\ruby\bin\rubyw.exe" -C"' + pwd + '" -KU lib/main.rb'
command = path + ' "%1"' command = path + ' "%1"'
path.replace path.ljust path.bytesize
command.replace command.ljust command.bytesize
Win32::Registry::HKEY_CLASSES_ROOT.create('mycard'){|reg|reg['URL Protocol'] = path unless (reg['URL Protocol'] == path rescue false)} Win32::Registry::HKEY_CLASSES_ROOT.create('mycard'){|reg|reg['URL Protocol'] = path unless (reg['URL Protocol'] == path rescue false)}
Win32::Registry::HKEY_CLASSES_ROOT.create('mycard\shell\open\command'){|reg|reg[nil] = command unless (reg[nil] == command rescue false)} Win32::Registry::HKEY_CLASSES_ROOT.create('mycard\shell\open\command'){|reg|reg[nil] = command unless (reg[nil] == command rescue false)}
end end
...@@ -36,8 +36,6 @@ begin ...@@ -36,8 +36,6 @@ begin
log_level = "INFO" log_level = "INFO"
profile = nil profile = nil
ARGV.each do |arg| ARGV.each do |arg|
p arg
STDIN.gets
case arg.dup.force_encoding("UTF-8") case arg.dup.force_encoding("UTF-8")
when /--log=(.*)/ when /--log=(.*)/
log.replace $1 log.replace $1
...@@ -74,7 +72,6 @@ begin ...@@ -74,7 +72,6 @@ begin
require 'logger' require 'logger'
if log == "STDOUT" #调试用 if log == "STDOUT" #调试用
log = STDOUT log = STDOUT
STDOUT.set_encoding "GBK", "UTF-8", :invalid => :replace, :undef => :replace if RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"]
end end
$log = Logger.new(log) $log = Logger.new(log)
$log.level = Logger.const_get log_level $log.level = Logger.const_get log_level
......
...@@ -4,11 +4,7 @@ require_relative 'room' ...@@ -4,11 +4,7 @@ require_relative 'room'
require_relative 'ygocore/game' require_relative 'ygocore/game'
$game = Ygocore.new $game = Ygocore.new
p 1
STDIN.gets
uri = URI.unescape URI.unescape ARGV.first[9, ARGV.first.size-9] uri = URI.unescape URI.unescape ARGV.first[9, ARGV.first.size-9]
p uri
STDIN.gets
case uri case uri
when /^(.*\.yrp)$/ when /^(.*\.yrp)$/
require 'open-uri' require 'open-uri'
...@@ -29,8 +25,6 @@ when /^(.*\.ydk)$/ ...@@ -29,8 +25,6 @@ when /^(.*\.ydk)$/
} }
Ygocore.run_ygocore(File.basename($1, '.ydk'), true) Ygocore.run_ygocore(File.basename($1, '.ydk'), true)
when /^(?:(.*)\:(.*)\@)?(.*)\:(\d+)\/(.*)$/ when /^(?:(.*)\:(.*)\@)?(.*)\:(\d+)\/(.*)$/
p $1
STDIN.gets
require 'uri' require 'uri'
$game.user = User.new($1.to_sym, $1) if $1 $game.user = User.new($1.to_sym, $1) if $1
$game.password = $2 if $2 $game.password = $2 if $2
......
...@@ -2,7 +2,7 @@ require 'open-uri' ...@@ -2,7 +2,7 @@ require 'open-uri'
require "fileutils" require "fileutils"
require_relative 'card' require_relative 'card'
module Update module Update
Version = '0.6.4' Version = '0.6.6'
URL = "http://card.touhou.cc/mycard/update.json?version=#{Version}" URL = "http://card.touhou.cc/mycard/update.json?version=#{Version}"
class <<self class <<self
attr_reader :thumbnails, :images, :status attr_reader :thumbnails, :images, :status
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment