Exemplo n.º 1
0
        public static void Load()
        {
            old = new OldPerms();
            if (PropertiesFile.Read(Paths.ServerPropsFile, ref old, LineProcessor))
            {
                Server.SettingsUpdate();
            }

            CountdownGame.Config.Load();
            ZSGame.Config.Load();
            LSGame.Config.Load();
            CTFGame.Config.Load();
            TWGame.Config.Load();

            Database.Backend = Server.Config.UseMySQL ? MySQLBackend.Instance : SQLiteBackend.Instance;
            #pragma warning disable 0618
            Server.DefaultColor = Server.Config.DefaultColor;
            Server.moneys       = Server.Config.Currency;
            #pragma warning restore 0618

            if (!Directory.Exists(Server.Config.BackupDirectory))
            {
                Server.Config.BackupDirectory = "levels/backups";
            }

            Save();
            Server.SetMainLevel(Server.Config.MainLevel);
        }
Exemplo n.º 2
0
        public static void Load()
        {
            old = new OldPerms();
            if (PropertiesFile.Read(Paths.ServerPropsFile, ref old, LineProcessor))
            {
                Server.SettingsUpdate();
            }
            if (old.saveZS)
            {
                ZSConfig.SaveSettings();
            }
            ZSConfig.LoadSettings();

            Database.Backend = ServerConfig.UseMySQL ? MySQLBackend.Instance : SQLiteBackend.Instance;
            #pragma warning disable 0618
            Server.DefaultColor = ServerConfig.DefaultColor;
            Server.moneys       = ServerConfig.Currency;
            #pragma warning restore 0618

            if (!Directory.Exists(ServerConfig.BackupDirectory))
            {
                ServerConfig.BackupDirectory = Path.Combine(Utils.FolderPath, "levels/backups");
            }
            Save();
        }
Exemplo n.º 3
0
        static void LineProcessor(string key, string value, ref OldPerms perms)
        {
            switch (key.ToLower())
            {
            // Backwards compatibility with old config, where review permissions where global
            case "review-enter-perm":
            case "review-leave-perm":
                break;

            case "review-view-perm":
                perms.viewPerm = int.Parse(value); break;

            case "review-next-perm":
                perms.nextPerm = int.Parse(value); break;

            case "review-clear-perm":
                perms.clearPerm = int.Parse(value); break;

            case "opchat-perm":
                perms.opchatPerm = int.Parse(value); break;

            case "adminchat-perm":
                perms.adminchatPerm = int.Parse(value); break;

            default:
                if (!ConfigElement.Parse(Server.serverConfig, key, value, null))
                {
                    Server.s.Log("\"" + key + "\" was not a recognised level property key.");
                }
                break;
            }
        }
Exemplo n.º 4
0
        static void LineProcessor(string key, string value, ref OldPerms perms)
        {
            switch (key.ToLower())
            {
            // Backwards compatibility: some command extra permissions used to be part of server.properties
            case "review-enter-perm":
            case "review-leave-perm":
                return;

            case "review-view-perm":
                perms.viewPerm = int.Parse(value); return;

            case "review-next-perm":
                perms.nextPerm = int.Parse(value); return;

            case "review-clear-perm":
                perms.clearPerm = int.Parse(value); return;

            case "opchat-perm":
                perms.opchatPerm = int.Parse(value); return;

            case "adminchat-perm":
                perms.adminchatPerm = int.Parse(value); return;

            // Backwards compatibility: map generation volume used to be part of server.properties
            case "map-gen-limit-admin":
                perms.mapGenLimitAdmin = int.Parse(value); return;

            case "map-gen-limit":
                perms.mapGenLimit = int.Parse(value); return;

            case "afk-kick":
                perms.afkKickMins = int.Parse(value); return;

            case "afk-kick-perm":
                perms.afkKickMax = Group.ParsePermOrName(value, LevelPermission.AdvBuilder); return;
            }

            if (!ConfigElement.Parse(Server.serverConfig, key, value, null))
            {
                // Backwards compatibility: ZS used to be part of server.properties
                if (ConfigElement.Parse(Server.zombieConfig, key, value, null))
                {
                    perms.saveZS = true;
                }
                else
                {
                    Logger.Log(LogType.Warning, "\"{0}\" was not a recognised server property key.", key);
                }
            }
        }
Exemplo n.º 5
0
 static void LineProcessor(string key, string value, ref OldPerms perms)
 {
     // Backwards compatibility: some command extra permissions used to be part of server.properties
     // Backwards compatibility: map generation volume used to be part of server.properties
     if (key.CaselessEq("review-view-perm"))
     {
         perms.viewPerm = int.Parse(value);
     }
     else if (key.CaselessEq("review-next-perm"))
     {
         perms.nextPerm = int.Parse(value);
     }
     else if (key.CaselessEq("review-clear-perm"))
     {
         perms.clearPerm = int.Parse(value);
     }
     else if (key.CaselessEq("opchat-perm"))
     {
         perms.opchatPerm = int.Parse(value);
     }
     else if (key.CaselessEq("adminchat-perm"))
     {
         perms.adminchatPerm = int.Parse(value);
     }
     else if (key.CaselessEq("map-gen-limit-admin"))
     {
         perms.mapGenLimitAdmin = int.Parse(value);
     }
     else if (key.CaselessEq("map-gen-limit"))
     {
         perms.mapGenLimit = int.Parse(value);
     }
     else if (key.CaselessEq("afk-kick"))
     {
         perms.afkKickMins = int.Parse(value);
     }
     else if (key.CaselessEq("afk-kick-perm"))
     {
         perms.afkKickMax = Group.ParsePermOrName(value, LevelPermission.AdvBuilder);
     }
     else
     {
         ConfigElement.Parse(Server.serverConfig, Server.Config, key, value);
     }
 }
Exemplo n.º 6
0
        public static void Load(string givenPath, bool skipSalt = false)
        {
            if (!skipSalt)
            {
                GenerateSalt();
            }
            oldPerms = new OldPerms();
            if (PropertiesFile.Read(givenPath, ref oldPerms, LineProcessor))
            {
                Server.s.SettingsUpdate();
            }

            Database.Backend = Server.useMySQL ?
                               MySQLBackend.Instance : SQLiteBackend.Instance;

            if (!Directory.Exists(Server.backupLocation))
            {
                Server.backupLocation = Application.StartupPath + "/levels/backups";
            }
            Server.updateTimer.Interval = Server.PositionInterval;
            Save(givenPath);
        }
Exemplo n.º 7
0
        public static void Load()
        {
            old = new OldPerms();
            if (PropertiesFile.Read(Paths.ServerPropsFile, ref old, LineProcessor))
            {
                Server.SettingsUpdate();
            }

            CountdownGame.Config.Load();
            ZSGame.Config.Load();
            LSGame.Config.Load();
            CTFGame.Config.Load();
            TWGame.Config.Load();

            Database.Backend = Server.Config.UseMySQL ? MySQLBackend.Instance : SQLiteBackend.Instance;

            if (!Directory.Exists(Server.Config.BackupDirectory))
            {
                Server.Config.BackupDirectory = "levels/backups";
            }

            Save();
            Server.SetMainLevel(Server.Config.MainLevel);
        }