Fix parse 3

This commit is contained in:
plant_1312 2020-01-29 17:23:01 +00:00
parent b5a8590e99
commit fa61015e18

View File

@ -53,15 +53,21 @@ namespace Yggtk {
save_config_button.clicked.connect (() => {
if (peer_ip_entry.text != yggconfout) {
Parser.to_json (peer_ip_entry);
if (yggconfout == "") {
string yggconf;
Process.spawn_command_line_sync ("yggdrasil -genconf -json", out yggconf);
Parser.to_json (peer_ip_entry, yggconf);
} else {
FileUtils.get_contents ("/etc/yggdrasil.conf", out yggconfout);
Parser.to_json (peer_ip_entry, yggconfout);
}
}
});
}
public class Parser : Object {
public void to_json (Entry ip) {
string yggconf;
Process.spawn_command_line_sync ("yggdrasil -genconf -json", out yggconf);
public void to_json (Entry ip, string yggconf) {
var node = Json.from_string (yggconf);
var obj = node.get_object ();
obj.set_string_member ("Peers", ip.text);