Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaoye
mycard
Commits
db69541c
Commit
db69541c
authored
May 27, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URL protocol加强
parent
5f588e30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
lib/quickstart.rb
lib/quickstart.rb
+27
-9
lib/ygocore/game.rb
lib/ygocore/game.rb
+19
-2
No files found.
lib/quickstart.rb
View file @
db69541c
require
'json'
require_relative
'game'
require_relative
'user'
require_relative
'room'
require_relative
'ygocore/game'
$game
=
Ygocore
.
new
args
=
JSON
.
parse
ARGV
.
first
[
7
,
ARGV
.
first
.
size
-
7
].
unpack
(
'm'
).
first
$game
.
user
=
User
.
new
(
args
[
"username"
].
to_sym
,
args
[
"username"
])
$game
.
password
=
args
[
"password"
]
$game
.
server
=
args
[
'server_ip'
]
$game
.
port
=
args
[
'server_port'
]
Ygocore
.
run_ygocore
Room
.
new
(
0
,
args
[
'room_name'
]),
true
\ No newline at end of file
uri
=
ARGV
.
first
[
9
,
ARGV
.
first
.
size
-
9
]
case
uri
when
/^(.*)\:(.*)\@(.*)\:(\d+)\/(.*)$/
$game
.
user
=
User
.
new
(
$1
.
to_sym
,
$1
)
$game
.
password
=
$2
$game
.
server
=
$3
$game
.
port
=
$4
.
to_i
Ygocore
.
run_ygocore
Room
.
new
(
0
,
$5
),
true
when
/^(.*\.yrp)$/
require
'open-uri'
open
(
"http://"
+
$1
,
'rb'
)
{
|
src
|
Dir
.
mkdir
(
"replay"
)
unless
File
.
directory?
(
"replay"
)
open
(
'replay/'
+
File
.
basename
(
$1
),
'wb'
){
|
dest
|
dest
.
write
src
.
read
}
}
Ygocore
.
replay
(
'replay/'
+
File
.
basename
(
$1
),
true
)
when
/^(.*\.ydk)$/
require
'open-uri'
open
(
"http://"
+
$1
,
'rb'
)
{
|
src
|
Dir
.
mkdir
(
'ygocore/deck'
)
unless
File
.
directory?
(
"ygocore/deck"
)
open
(
'ygocore/deck/'
+
File
.
basename
(
$1
),
'wb'
){
|
dest
|
dest
.
write
src
.
read
}
}
Ygocore
.
run_ygocore
(
File
.
basename
(
$1
,
'.ydk'
),
true
)
end
\ No newline at end of file
lib/ygocore/game.rb
View file @
db69541c
...
...
@@ -139,6 +139,23 @@ class Ygocore < Game
args
=
'-r'
when
:deck
args
=
'-d'
when
String
system_conf
=
{}
begin
IO
.
readlines
(
'system.conf'
).
each
do
|
line
|
line
.
force_encoding
"UTF-8"
next
if
line
[
0
,
1
]
==
'#'
field
,
contents
=
line
.
chomp
.
split
(
' = '
,
2
)
system_conf
[
field
]
=
contents
end
rescue
system_conf
[
'antialias'
]
=
2
system_conf
[
'textfont'
]
=
'c:/windows/fonts/simsun.ttc 14'
system_conf
[
'numfont'
]
=
'c:/windows/fonts/arialbd.ttf'
end
system_conf
[
'lastdeck'
]
=
option
open
(
'system.conf'
,
'w'
)
{
|
file
|
file
.
write
system_conf
.
collect
{
|
key
,
value
|
"
#{
key
}
=
#{
value
}
"
}.
join
(
"
\n
"
)}
args
=
'-d'
end
IO
.
popen
(
"ygopro_vs.exe
#{
args
}
"
)
WM
.
iconify
rescue
nil
...
...
@@ -164,11 +181,11 @@ class Ygocore < Game
end
end
end
def
self
.
replay
(
file
)
def
self
.
replay
(
file
,
skip_image_downloading
=
false
)
require
'fileutils'
FileUtils
.
mv
Dir
.
glob
(
'ygocore/replay/*.yrp'
),
'replay/'
FileUtils
.
copy_file
(
file
,
"ygocore/replay/
#{
File
.
basename
(
file
)
}
"
)
run_ygocore
(
:replay
)
run_ygocore
(
:replay
,
skip_image_downloading
)
end
private
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment