furnace-swf 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/furnace-swf
CHANGED
@@ -79,33 +79,43 @@ File.open(opts[:input]) do |file|
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
def find_tag(swf, name)
|
83
|
+
abc_tags = swf.stream.tags(SWF::DoABCTag, SWF::DoABC2Tag)
|
84
|
+
|
85
|
+
if name =~ /\d+/
|
86
|
+
abc_tags[name.to_i]
|
87
|
+
else
|
88
|
+
abc_tags.find { |tag| tag.name == name }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
82
92
|
case subcommand
|
83
93
|
when 'abclist'
|
84
94
|
puts "ABC tags:"
|
85
95
|
|
86
|
-
swf.stream.tags(SWF::DoABCTag).
|
87
|
-
puts "
|
96
|
+
swf.stream.tags(SWF::DoABCTag, SWF::DoABC2Tag).each_with_index do |tag, index|
|
97
|
+
puts " #{index}) #{tag.name.inspect}: #{tag.bytecode.length} byte(s)"
|
88
98
|
end
|
89
99
|
|
90
100
|
when 'abcextract'
|
91
|
-
if tag = swf
|
101
|
+
if tag = find_tag(swf, subopts[:name])
|
92
102
|
File.open(subopts[:output], 'w') do |f|
|
93
103
|
f.write tag.bytecode
|
94
104
|
end
|
95
105
|
else
|
96
|
-
$stderr.puts "Tag
|
106
|
+
$stderr.puts "Tag `#{subopts[:name]}' was not found"
|
97
107
|
exit -1
|
98
108
|
end
|
99
109
|
|
100
110
|
when 'abcreplace'
|
101
|
-
if tag = swf
|
111
|
+
if tag = find_tag(swf, subopts[:name])
|
102
112
|
tag.bytecode = subopts[:input].read
|
103
113
|
|
104
114
|
File.open(subopts[:output], 'w') do |f|
|
105
115
|
swf.write f
|
106
116
|
end
|
107
117
|
else
|
108
|
-
$stderr.puts "Tag
|
118
|
+
$stderr.puts "Tag `#{subopts[:name]}' was not found"
|
109
119
|
exit -1
|
110
120
|
end
|
111
121
|
end
|
data/furnace-swf.gemspec
CHANGED
@@ -13,11 +13,13 @@ Gem::Specification.new do |s|
|
|
13
13
|
%q{Flash SWF files. It can be used with furnace-avm2 in } <<
|
14
14
|
%q{order to achieve impressive results.}
|
15
15
|
|
16
|
-
s.files = `git ls-files`.split(
|
17
|
-
s.
|
18
|
-
s.
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
+
s.required_ruby_version = '>= 1.9.1'
|
22
|
+
|
21
23
|
s.add_runtime_dependency "bindata"
|
22
24
|
s.add_runtime_dependency "trollop"
|
23
25
|
end
|
@@ -14,8 +14,8 @@ module Furnace::SWF
|
|
14
14
|
BigDecimal.new(frame_rate_lo) / 100
|
15
15
|
end
|
16
16
|
|
17
|
-
def tags(
|
18
|
-
|
17
|
+
def tags(*types)
|
18
|
+
tag_wrappers.select { |tw| types.any? { |type| tw.content.is_a? type } }.map(&:content)
|
19
19
|
end
|
20
20
|
|
21
21
|
def real_num_bytes
|
@@ -1,9 +1,15 @@
|
|
1
1
|
module Furnace::SWF
|
2
2
|
class DoABCTag < Tag
|
3
|
-
type
|
3
|
+
type 72
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
string :bytecode, :read_length => lambda { parent.real_length }
|
6
|
+
|
7
|
+
def name
|
8
|
+
"<DoABCTag>"
|
9
|
+
end
|
10
|
+
|
11
|
+
def flags
|
12
|
+
0
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
data/lib/furnace-swf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: furnace-swf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bindata
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/furnace-swf/swf/tag.rb
|
71
71
|
- lib/furnace-swf/swf/tag_wrapper.rb
|
72
72
|
- lib/furnace-swf/swf/tags/define_binary_data_tag.rb
|
73
|
+
- lib/furnace-swf/swf/tags/do_abc2_tag.rb
|
73
74
|
- lib/furnace-swf/swf/tags/do_abc_tag.rb
|
74
75
|
- lib/furnace-swf/swf/tags/symbol_class_tag.rb
|
75
76
|
- lib/furnace-swf/swf/ubit.rb
|
@@ -85,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
86
|
requirements:
|
86
87
|
- - ! '>='
|
87
88
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
+
version: 1.9.1
|
89
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
91
|
none: false
|
91
92
|
requirements:
|
@@ -94,8 +95,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
95
|
version: '0'
|
95
96
|
requirements: []
|
96
97
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.8.
|
98
|
+
rubygems_version: 1.8.23
|
98
99
|
signing_key:
|
99
100
|
specification_version: 3
|
100
101
|
summary: Flash SWF file reader and writer
|
101
102
|
test_files: []
|
103
|
+
has_rdoc:
|