Beispiel #1
0
 protected override void AfterLoad()
 {
     Configuration.Servers.Clear();
     foreach (var server in servers)
     {
         var newServer = new Configuration.Server();
         server.AfterLoad(newServer);
         Configuration.Servers.Add(newServer);
     }
     Configuration.MainWindowVisible     = mainWindowVisible;
     Configuration.MainWindowPosition    = mainWindowPosition.AsRect().ToTuple();
     Configuration.InfoWindowVisible     = infoWindowVisible;
     Configuration.InfoWindowPosition    = infoWindowPosition.AsRect().ToTuple();
     Configuration.AutoStartServers      = autoStartServers;
     Configuration.AutoAcceptConnections = autoAcceptConnections;
     Configuration.ConfirmRemoveClient   = confirmRemoveClient;
     Configuration.PauseServerWithGame   = pauseServerWithGame;
     try {
         Logger.Level = (Logger.Severity)Enum.Parse(typeof(Logger.Severity), logLevel);
     } catch (ArgumentException) {
         Console.WriteLine(
             "[kRPC] Error parsing log level from configuration file. Got '" + logLevel + "'. " +
             "Defaulting to " + Logger.Severity.Info);
         Logger.Level = Logger.Severity.Info;
     }
     Configuration.VerboseErrors       = verboseErrors;
     ServicesChecker.CheckDocumented   = checkDocumented;
     Configuration.OneRPCPerUpdate     = oneRPCPerUpdate;
     Configuration.MaxTimePerUpdate    = maxTimePerUpdate;
     Configuration.AdaptiveRateControl = adaptiveRateControl;
     Configuration.BlockingRecv        = blockingRecv;
     Configuration.RecvTimeout         = recvTimeout;
     Logger.WriteLine("Loaded configuration", Logger.Severity.Debug);
 }
Beispiel #2
0
 protected override void BeforeSave()
 {
     Logger.WriteLine("Saving configuration", Logger.Severity.Debug);
     servers.Clear();
     foreach (var server in Configuration.Servers)
     {
         var newServer = new Server();
         newServer.BeforeSave(server);
         servers.Add(newServer);
     }
     mainWindowVisible     = Configuration.MainWindowVisible;
     mainWindowPosition    = RectStorage.FromRect(Configuration.MainWindowPosition.ToRect());
     infoWindowVisible     = Configuration.InfoWindowVisible;
     infoWindowPosition    = RectStorage.FromRect(Configuration.InfoWindowPosition.ToRect());
     autoStartServers      = Configuration.AutoStartServers;
     autoAcceptConnections = Configuration.AutoAcceptConnections;
     confirmRemoveClient   = Configuration.ConfirmRemoveClient;
     pauseServerWithGame   = Configuration.PauseServerWithGame;
     logLevel            = Logger.Level.ToString();
     verboseErrors       = Configuration.VerboseErrors;
     checkDocumented     = ServicesChecker.CheckDocumented;
     oneRPCPerUpdate     = Configuration.OneRPCPerUpdate;
     maxTimePerUpdate    = Configuration.MaxTimePerUpdate;
     adaptiveRateControl = Configuration.AdaptiveRateControl;
     blockingRecv        = Configuration.BlockingRecv;
     recvTimeout         = Configuration.RecvTimeout;
 }