Initial implementation of search, updated PacketHandler to behave more more like android app

This commit is contained in:
2021-01-30 21:27:16 -06:00
parent 8659bdfe4a
commit 4e9d3c0759
5 changed files with 366 additions and 37 deletions

View File

@@ -41,6 +41,30 @@ module TAC
@config_changed = false
end
def move_config(old_name, new_name)
if not File.exists?("#{TAC::CONFIGS_PATH}/#{old_name}.json") or
File.directory?("#{TAC::CONFIGS_PATH}/#{old_name}.json")
# move_config: Can not move config file "#{old_name}" does not exist!
return false
end
if File.exists?("#{TAC::CONFIGS_PATH}/#{new_name}.json") &&
!File.directory?("#{TAC::CONFIGS_PATH}/#{old_name}.json")
# move_config: Config file "#{new_name}" already exist!
return false
end
return FileUtils.mv(
"#{TAC::CONFIGS_PATH}/#{old_name}.json",
"#{TAC::CONFIGS_PATH}/#{new_name}.json"
)
end
def delete_config(config_name)
FileUtils.rm("#{TAC::CONFIGS_PATH}/#{config_name}.json") if File.exists?("#{TAC::CONFIGS_PATH}/#{config_name}.json")
end
def upload_config(config_name)
if @tacnet.connected?
json = Config.new(config_name).to_json