Beispiel #1
0
        public static ModDatabaseItem Get(string name, int major)
        {
            ModDatabaseItem result = null;

            foreach (var mod in AllModsList)
            {
                if (mod.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) && mod.Major == major)
                {
                    //We try to find the newest version under a specified major version
                    if (result == null)
                    {
                        result = mod;
                        continue;
                    }
                    else if (mod.Minor > result.Minor)
                    {
                        result = mod;
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
 public static void Add(string name, int major, int minor, string tag, string file, bool hasWhitelist)
 {
     if (Contains(name, major))
     {
         Get(name, major).File          = file;
         Get(name, major).Major         = major;
         Get(name, major).Minor         = minor;
         Get(name, major).Tag           = tag;
         Get(name, major).UsesWhitelist = hasWhitelist;
     }
     else
     {
         var itm = new ModDatabaseItem();
         itm.Name          = name;
         itm.Major         = major;
         itm.Minor         = minor;
         itm.Tag           = tag;
         itm.File          = file;
         itm.UsesWhitelist = hasWhitelist;
         _items.Add(itm);
     }
     Save();
 }