Commit d0981ed8 authored by 神楽坂玲奈's avatar 神楽坂玲奈

Merge pull request #1 from IamIpanda/patch-1

Update Command.rb
parents 17293014 bdf82f74
...@@ -18,37 +18,38 @@ module Commands ...@@ -18,37 +18,38 @@ module Commands
def generate_all def generate_all
Log.logger.info "Generate all the card images with language #{Global.language}." Log.logger.info "Generate all the card images with language #{Global.language}."
self.clear_mse self.clear_mse
data = Sqlite.split Sqlite.load data = Sqlite.split Sqlite.load
MSETranslator.generate_mse_all(data) MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all MSETranslator.export_mse_all
end end
def generate_delta(languages = nil) def generate_delta(languages = nil)
Log.logger.info "Generate delta card image(s)" Log.logger.info "Generate delta card image(s) with parameter: #{languages.inspect}"
self.clear_mse
data = Sqlite.load
changes = HashJudger.compare data
generates = changes[0] + changes[2]
removes = changes[1]
data = Sqlite.split generates
if languages == nil if languages == nil
process(removes, data) process_generate_delta
else else
for language in languages for language in languages
Global.language = language Global.language = language
process(removes, data) process_generate_delta
end end
end end
end end
def process(removes, data) def process_generate_delta
Log.logger.info "Generate delta card image with language #{Global.language}"
self.clear_mse
data = Sqlite.load # Language effected here
changes = HashJudger.compare data
generates = changes[0] + changes[2]
removes = changes[1]
data = Sqlite.split generates
for card in removes for card in removes
id = YGOCoreJudgers.get_id card id = YGOCoreJudgers.get_id card
path = File.join Global.full_answer_path, id.to_s + Global.image_type path = File.join Global.full_answer_path, id.to_s + Global.image_type
File.delete path if File.exist? path File.delete path if File.exist? path
end end
MSETranslator.generate_mse_all(data) MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all MSETranslator.export_mse_all
end end
def generate_single(id) def generate_single(id)
...@@ -69,4 +70,4 @@ module Commands ...@@ -69,4 +70,4 @@ module Commands
languages languages
end end
end end
\ No newline at end of file
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