Sha256: cf6942cdebc4c666cc5dd798b85becfa4f26f76d9352a7cee60d3ca11013e1ba

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

module RMXPExtractor
  require "rmxp_extractor/data_export"
  require "rmxp_extractor/data_import"
  require "rmxp_extractor/script_handler"
  require "rmxp_extractor/version"

  FORMATS = ["json", "yaml", "rb", "ron"]

  def self.usage
    STDERR.puts "usage: rmxp_extractor < -v/--version > import/export <type = json> | scripts"
    exit 1
  end

  def self.process(type)
    RMXPExtractor.usage if type.length < 1

    case type[0]
    when "-v", "--version"
      puts VERSION
    when "import"
      check_format(type[1])
      import(type[1])
    when "export"
      check_format(type[1])
      export(type[1])
    when "scripts"
      if type.length < 4 || type.length > 5
        STDERR.puts "usage: rmxp_extractor scripts game_dir scripts_dir scripts_name  [x]"
        exit 1
      else
        puts type.to_s
        RMXPExtractor.rpgscript(type[1], type[2], type[3], type[4] == "x")
      end
    else
      RMXPExtractor.usage
    end
  end

  def self.check_format(format)
    format = "json" if format.nil?
    unless FORMATS.include?(format)
      warn "Allowed formats: #{FORMATS.to_s}"
      exit 1
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rmxp_extractor-2.0.0 lib/rmxp_extractor.rb
rmxp_extractor-1.9 lib/rmxp_extractor.rb
rmxp_extractor-1.7 lib/rmxp_extractor.rb