Exemple #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);
        }
Exemple #2
0
        public void RemoveMod(string mod)
        {
            string modPath = "";

            if (mod[0] == char.Parse("@"))
            {
                modPath = GetProcessDirectory() + mod;
                WriteToConsole("Deleting mod: " + modPath);
            }
            else
            {
                modPath = mod;
            }

            for (int i = 0; i < ConfigHolder.GetMods().Count; i++)
            {
                if (ConfigHolder.GetMods()[i].ToString() == modPath)
                {
                    ConfigHolder.GetMods().RemoveAt(i);
                }
            }

            ConfigIO.WriteMods(ConfigHolder.GetMods());
        }
Exemple #3
0
 public void RemoveAllMods()
 {
     ConfigHolder.SetMods(new System.Collections.ArrayList());
     ConfigIO.WriteMods(ConfigHolder.GetMods());
 }