Пример #1
0
        public void Remove(PackageReference pkg)
        {
            if (pkg is null)
            {
                throw new ArgumentNullException(nameof(pkg));
            }

            if (dependencies.ContainsKey(pkg.PackageID))
            {
                dependencies.Remove(pkg.PackageID);
            }

            Save();
        }
Пример #2
0
        public static bool IsInstalled(PackageReference pkg)
        {
            if (pkg is null)
            {
                throw new ArgumentNullException(nameof(pkg));
            }

            if (pkg is AbstractPackage p)
            {
                return(p.IsInstalled);
            }
            else
            {
                return(PackageDatabase.ContainsKey(pkg.PackageID) &&
                       PackageDatabase[pkg.PackageID].Any(p => p.IsInstalled));
            }
        }
Пример #3
0
        public static bool IsAvailable(PackageReference pkg)
        {
            if (pkg is null)
            {
                throw new ArgumentNullException(nameof(pkg));
            }

            if (pkg is AbstractPackage p)
            {
                return(p.Available);
            }
            else
            {
                return(PackageDatabase.ContainsKey(pkg.PackageID) &&
                       PackageDatabase[pkg.PackageID].Any(pkg.Equals));
            }
        }
Пример #4
0
        public void Add(PackageReference pkg)
        {
            if (pkg is null)
            {
                throw new ArgumentNullException(nameof(pkg));
            }

            if (pkg.ForRemoval)
            {
                Remove(pkg);
            }
            else
            {
                dependencies[pkg.PackageID] = pkg;
                Save();
            }
        }
Пример #5
0
 public bool TryGetValue(string key, out PackageReference value)
 {
     return(dependencies.TryGetValue(key, out value));
 }
Пример #6
0
        private UnityPackageManifest(SerializationInfo info, StreamingContext context)
        {
            var dict = info.GetValue <Dictionary <string, string> >(nameof(dependencies));

            dependencies = dict.ToDictionary(kv => kv.Key, kv => new PackageReference(PackageReference.FormatUnityPackageManagerSpec(kv.Key, kv.Value)));
        }