Пример #1
0
        public void LoadConfig()
        {
            softGetawayServiceState serviceState = (softGetawayServiceState)objectFromFile(strStateFileName + "config", typeof(softGetawayServiceState));

            if (serviceState != null)
            {
                // Set SSID and Password
                SetPrivateConnectionSettings(new ConnectionSettings()
                {
                    SSID         = serviceState.wifiSSID,
                    MaxPeerCount = serviceState.limitClientsCount,
                    Password     = serviceState.wifiPassword
                });
                SetIP(serviceState.privateIP);
                softGetawayPeersStorage peersState;
                peersState = (softGetawayPeersStorage)objectFromFile(strStateFileName + "peers", typeof(softGetawayPeersStorage));
                if ((peersState != null) && (peersState.peers != null))
                {
                    foreach (var p in peersState.peers)
                    {
                        privateManager.AddPeerFromStorage(p);
                    }
                }
                this.currentSharedConnectionGuid = serviceState.publicConnectionGuid;
                shouldStart_ = serviceState.active;
            }
        }
Пример #2
0
        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");
        }
Пример #3
0
        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");
        }