コード例 #1
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();
        }
コード例 #2
0
ファイル: Properties.cs プロジェクト: Peteys93/MCGalaxy
        public static void Load(string givenPath, bool skipsalt = false)
        {
            RandomNumberGenerator prng = RandomNumberGenerator.Create();
            StringBuilder         sb   = new StringBuilder();

            byte[] oneChar = new byte[1];
            while (sb.Length < 16)
            {
                prng.GetBytes(oneChar);
                if (Char.IsLetterOrDigit((char)oneChar[0]))
                {
                    sb.Append((char)oneChar[0]);
                }
            }
            Server.salt = sb.ToString();

            if (PropertiesFile.Read(givenPath, LineProcessor))
            {
                Server.s.SettingsUpdate();
            }

            if (!Directory.Exists(Server.backupLocation))
            {
                Server.backupLocation = Application.StartupPath + "/levels/backups";
            }
            Server.updateTimer.Interval = Server.PositionInterval;
            Save(givenPath);
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: Alias.cs プロジェクト: Peteys93/MCGalaxy
 public static void Load()
 {
     aliases = new List <Alias>();
     if (!File.Exists(file))
     {
         Save(); return;
     }
     PropertiesFile.Read(file, LineProcessor, ':');
 }
コード例 #5
0
ファイル: GroupProperties.cs プロジェクト: ProtheanGod/KingMC
        public static void InitAll()
        {
            Group temp = null;

            PropertiesFile.Read(Paths.RankPropsFile, ref temp, ParseProperty, '=', false);
            if (temp != null)
            {
                AddGroup(ref temp);
            }
        }
コード例 #6
0
        public static void InitAll()
        {
            List <string> lines = CP437Reader.ReadAllLines(filename);
            Group         grp   = null;

            PropertiesFile.Read(filename, ref grp, ParseProperty, '=', false);
            if (grp != null)
            {
                AddGroup(ref grp);
            }
        }
コード例 #7
0
        public static void Load()
        {
            aliases.Clear();
            coreAliases.Clear();

            if (!File.Exists(file))
            {
                Save(); return;
            }
            PropertiesFile.Read(file, LineProcessor, ':');
        }
コード例 #8
0
 void LoadAutoloadCommands()
 {
     if (File.Exists("text/autoload.txt"))
     {
         PropertiesFile.Read("text/autoload.txt", AutoLoadLineProcessor);
         GC.Collect();
         GC.WaitForPendingFinalizers();
     }
     else
     {
         Log("autoload.txt does not exist");
     }
 }
コード例 #9
0
            public void LoadConfig()
            {
                if (cfg == null)
                {
                    cfg = ConfigElement.GetAll(typeof(DiscordConfig));
                }
                PropertiesFile.Read(ConfigFile, LineProcessor);
                SaveConfig();

                if (config.DiscordPrefix != "")
                {
                    config.DiscordPrefix += " ";                                             // add space after prefix, trim removes it
                }
            }
コード例 #10
0
        public static void InitAll()
        {
            Group temp = null;

            if (cfg == null)
            {
                cfg = ConfigElement.GetAll(typeof(Group));
            }

            PropertiesFile.Read(Paths.RankPropsFile, ref temp, ParseProperty, '=', false);
            if (temp != null)
            {
                AddGroup(ref temp);
            }
        }
コード例 #11
0
        public static void LoadList()
        {
            if (!File.Exists("plugins/Parties/parties.txt"))
            {
                return;
            }
            Team tmp = new Team();

            lock (ioLock) {
                Teams.Clear();
                PropertiesFile.Read("plugins/Parties/parties.txt", ref tmp, LineProcessor, '=');
                if (tmp.Name != null)
                {
                    Add(tmp);
                }
            }
        }
コード例 #12
0
ファイル: Awards.cs プロジェクト: Benedani/MCGalaxy
        public static void Load()
        {
            if (!File.Exists("text/awardsList.txt"))
            {
                using (CP437Writer w = new CP437Writer("text/awardsList.txt")) {
                    w.WriteLine("#This is a full list of awards. The server will load these and they can be awarded as you please");
                    w.WriteLine("#Format is:");
                    w.WriteLine("# AwardName : Description of award goes after the colon");
                    w.WriteLine();
                    w.WriteLine("Gotta start somewhere : Built your first house");
                    w.WriteLine("Climbing the ladder : Earned a rank advancement");
                    w.WriteLine("Do you live here? : Joined the server a huge bunch of times");
                }
            }

            AwardsList = new List <Award>();
            PropertiesFile.Read("text/awardsList.txt", AwardsListLineProcessor, ':');
            PlayerAwards = new List <PlayerAward>();
            PropertiesFile.Read("text/playerAwards.txt", PlayerAwardsLineProcessor, ':');
        }
コード例 #13
0
        public static void LoadDisabledList()
        {
            supportedCount = 0;

            foreach (CpeExtension e in All)
            {
                e.Enabled = true;
            }
            PropertiesFile.Read(Paths.CPEDisabledFile, ParseLine, '=');

            // file is out of sync with actual list
            if (supportedCount == All.Length)
            {
                return;
            }
            try {
                SaveDisabledList();
            } catch (Exception ex) {
                Logger.LogError("Error saving CPE disabled list", ex);
            }
        }
コード例 #14
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);
        }
コード例 #15
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);
        }
コード例 #16
0
 /// <summary> Loads updater properties from given file  </summary>
 /// <param name="givenPath">File path relative to server to load properties from</param>
 public static void Load(string givenPath)
 {
     PropertiesFile.Read(givenPath, LineProcessor);
 }
コード例 #17
0
ファイル: ConfigElement.cs プロジェクト: TheDireMaster/McDire
 public static bool ParseFile(ConfigElement[] elements, string path, object instance)
 {
     return(PropertiesFile.Read(path, (k, v) => Parse(elements, instance, k, v)));
 }
コード例 #18
0
 public static bool Load(string path, LevelConfig config)
 {
     return(PropertiesFile.Read(path, ref config, LineProcessor));
 }