Commit bdf82f74 authored by IamIpanda's avatar IamIpanda

Update Command.rb

[fix] generate_delta doesn't work correctly when different changes happen on multi-language.
[warn] That code hasn't been verified.
parent 17293014
......@@ -18,37 +18,38 @@ module Commands
def generate_all
Log.logger.info "Generate all the card images with language #{Global.language}."
self.clear_mse
data = Sqlite.split Sqlite.load
MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all
data = Sqlite.split Sqlite.load
MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all
end
def generate_delta(languages = nil)
Log.logger.info "Generate delta card image(s)"
self.clear_mse
data = Sqlite.load
changes = HashJudger.compare data
generates = changes[0] + changes[2]
removes = changes[1]
data = Sqlite.split generates
Log.logger.info "Generate delta card image(s) with parameter: #{languages.inspect}"
if languages == nil
process(removes, data)
process_generate_delta
else
for language in languages
Global.language = language
process(removes, data)
process_generate_delta
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
id = YGOCoreJudgers.get_id card
path = File.join Global.full_answer_path, id.to_s + Global.image_type
File.delete path if File.exist? path
end
MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all
MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all
end
def generate_single(id)
......@@ -69,4 +70,4 @@ module Commands
languages
end
end
\ No newline at end of file
end
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