public void SaveConfig() { Trace.TraceInformation("Getaway saving config"); var serviceState = new softGetawayServiceState(); serviceState.active = shouldStart_; var connGuid = GetSharedConnection(); if (connGuid != null) { serviceState.publicConnectionGuid = connGuid; } var connSettings = GetPrivateConnectionSettings(); serviceState.wifiSSID = connSettings.SSID; serviceState.limitClientsCount = connSettings.MaxPeerCount; serviceState.wifiPassword = connSettings.Password; serviceState.privateIP = GetIP(); objectToFile(strStateFileName + "config", serviceState); var peersState = new softGetawayPeersStorage(); foreach (var peerService in GetPeers()) { NetworkPeerStorage storage = (NetworkPeerStorage)peerService.storage.Clone(); if (!peerService.isSetHostName) { storage.HostName = null; } if (!peerService.isSetIP) { storage.IPAddress = null; } peersState.peers.Add(storage); } objectToFile(strStateFileName + "peers", peersState); Trace.TraceInformation("Getaway config saved"); }
public void SaveConfig() { Trace.TraceInformation("Getaway saving config"); var serviceState = new softGetawayServiceState(); serviceState.active = shouldStart_; var connGuid = GetSharedConnection(); if (connGuid != null) { serviceState.publicConnectionGuid = connGuid; } var connSettings = GetPrivateConnectionSettings(); serviceState.wifiSSID = connSettings.SSID; serviceState.limitClientsCount = connSettings.MaxPeerCount; serviceState.wifiPassword = connSettings.Password; serviceState.privateIP = GetIP(); objectToFile(strStateFileName + "config", serviceState); var peersState = new softGetawayPeersStorage(); foreach (var peerService in GetPeers()) { NetworkPeerStorage storage = (NetworkPeerStorage)peerService.storage.Clone(); if (!peerService.isSetHostName) storage.HostName = null; if (!peerService.isSetIP) storage.IPAddress = null; peersState.peers.Add(storage); } objectToFile(strStateFileName + "peers", peersState); Trace.TraceInformation("Getaway config saved"); }