Esempio n. 1
0
        public bool AddMod(string mod)
        {
            foreach (string m in ConfigHolder.GetMods())
            {
                if (m.Equals(mod))
                {
                    WriteToConsole("The mod " + mod + " is already loaded!");
                    return(false);
                }
            }

            string keysPath = "";

            if (Directory.Exists(mod + @"\keys") || Directory.Exists(mod + @"\key"))
            {
                if (Directory.Exists(mod + @"\keys"))
                {
                    keysPath = mod + @"\keys";
                }
                else if (Directory.Exists(mod + @"\key"))
                {
                    keysPath = mod + @"\key";
                }
                if (Directory.Exists(keysPath))
                {
                    foreach (string s in Directory.GetFiles(keysPath))
                    {
                        if (s.EndsWith(".bikey"))
                        {
                            if (!File.Exists(GetProcessDirectory() + @"\keys\" + Path.GetFileName(s)))
                            {
                                File.Copy(s, GetProcessDirectory() + @"\keys\" + Path.GetFileName(s));
                            }
                        }
                    }
                }
            }

            ConfigHolder.AddMod(mod);
            ConfigIO.WriteMods(ConfigHolder.GetMods());
            return(true);
        }