mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 21:32:35 +00:00
Stubbed preset manager state, added confirm and variable dialogs, variables can now be created, everything is now mutatable
This commit is contained in:
@@ -4,6 +4,17 @@ module TAC
|
||||
def initialize
|
||||
@config = load_config
|
||||
@tacnet = TACNET.new
|
||||
|
||||
@config_changed = false
|
||||
end
|
||||
|
||||
def config_changed!
|
||||
@config[:config][:updated_at] = Time.now
|
||||
@config_changed = true
|
||||
end
|
||||
|
||||
def config_changed?
|
||||
@config_changed
|
||||
end
|
||||
|
||||
def load_config
|
||||
@@ -25,16 +36,27 @@ module TAC
|
||||
|
||||
File.open(TAC::CONFIG_PATH, "w") { |f| f.write json }
|
||||
|
||||
@config_changed = false
|
||||
end
|
||||
|
||||
def upload_config
|
||||
if @tacnet.connected?
|
||||
@tacnet.puts(TAC::TACNET::PacketHandler.packet_dump_config(json))
|
||||
end
|
||||
end
|
||||
|
||||
def download_config
|
||||
if @tacnet.connected?
|
||||
end
|
||||
end
|
||||
|
||||
def write_default_config
|
||||
File.open(TAC::CONFIG_PATH, "w") do |f|
|
||||
f.write JSON.dump(
|
||||
{
|
||||
config: {
|
||||
created_at: Time.now,
|
||||
updated_at: Time.now,
|
||||
spec_version: TAC::CONFIG_SPEC_VERSION,
|
||||
hostname: TACNET::DEFAULT_HOSTNAME,
|
||||
port: TACNET::DEFAULT_PORT,
|
||||
|
||||
Reference in New Issue
Block a user