示例#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);
 }
示例#2
0
 public void BeforeSave(Configuration.Server server)
 {
     id       = server.Id.ToString();
     name     = server.Name;
     protocol = server.Protocol.ToString();
     settings = server.Settings.Select(x => new KeyValuePair {
         key = x.Key, value = x.Value
     }).ToList();
 }
示例#3
0
 public void AfterLoad(Configuration.Server server)
 {
     server.Id   = new Guid(id);
     server.Name = name;
     try {
         server.Protocol = (Protocol)Enum.Parse(typeof(Protocol), protocol);
     } catch (ArgumentException) {
         Console.WriteLine(
             "[kRPC] Error parsing server protocol from configuration file. Got '" + protocol + "'. " +
             "Defaulting to " + Protocol.ProtocolBuffersOverTCP);
         server.Protocol = Protocol.ProtocolBuffersOverTCP;
         protocol        = server.Protocol.ToString();
     }
     server.Settings = settings.ToDictionary(x => x.key, x => x.value);
 }