Stubbed preset manager state, added confirm and variable dialogs, variables can now be created, everything is now mutatable

This commit is contained in:
2020-06-08 08:58:47 -05:00
parent 151df4ca57
commit f7a3e282f1
9 changed files with 393 additions and 58 deletions

View File

@@ -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,