mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-09-19 14:53:49 +00:00
Package selection and downloading functional
This commit is contained in:
@@ -15,7 +15,7 @@ module W3DHubLauncher
|
||||
@name = hash["name"]
|
||||
@error = hash["error"]
|
||||
@file_size = Integer(hash["size"] || 0)
|
||||
@checksum_chunk_size = Integer(hash["checksum-size"] || 0)
|
||||
@checksum_chunk_size = Integer(hash["checksum-chunk-size"] || 0)
|
||||
@sha256_checksum = hash["checksum"]
|
||||
@checksum_chunks = hash["checksum-chunks"]
|
||||
@download_url = hash["download_url"]
|
||||
@@ -25,6 +25,10 @@ module W3DHubLauncher
|
||||
@error
|
||||
end
|
||||
|
||||
def version?
|
||||
@version != Gem::Version.new("0.0.0.0")
|
||||
end
|
||||
|
||||
# checksum whole file and file chunks until a mismatch occurs or the whole file is verified.
|
||||
def verify_file(filename)
|
||||
file_size = File.size(filename)
|
||||
|
||||
@@ -76,15 +76,16 @@ module W3DHubLauncher
|
||||
attr_reader :id, :channel
|
||||
attr_accessor :version, :installation_path, :wine_prefix_path, :launch_command
|
||||
|
||||
def self.create(id:, channel:, version:, installation_path:, wine_prefix_path:, launch_command:)
|
||||
def self.create(id:, channel:, version:, installation_path:, wine_prefix_path:, launch_command:, timestamp:)
|
||||
hash = {
|
||||
"schema" => SCHEMA,
|
||||
"id" => id,
|
||||
"channel" => channel,
|
||||
"version" => Gem::Version.new(version),
|
||||
"version" => version,
|
||||
"installation_path" => installation_path,
|
||||
"wine_prefix_path" => wine_prefix_path,
|
||||
"launch_command" => launch_command,
|
||||
"timestamp" => timestamp
|
||||
}
|
||||
|
||||
self.new(hash)
|
||||
@@ -99,6 +100,7 @@ module W3DHubLauncher
|
||||
@installation_path = data["installation_path"]
|
||||
@wine_prefix_path = data["wine_prefix_path"]
|
||||
@launch_command = data["launch_command"]
|
||||
@timestamp = Time.at(data["timestamp"])
|
||||
end
|
||||
|
||||
def to_json(options = {})
|
||||
@@ -109,7 +111,8 @@ module W3DHubLauncher
|
||||
version: @version.to_s,
|
||||
installation_path: @installation_path,
|
||||
wine_prefix_path: @wine_prefix_path,
|
||||
launch_command: @launch_command
|
||||
launch_command: @launch_command,
|
||||
timestamp: @timestamp.to_i
|
||||
}.to_json(options)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user