public void InstalledPackage(CanonicalName canonicalName) { _packages.Value.Add(Package.GetPackage(canonicalName)); Package.GetPackage(canonicalName).IsInstalled = true; Task.Factory.StartNew(() => { if (PackageManager.Instance.Telemetry) { // ping the coapp server to tell it that a package installed try { Logger.Message("Pinging `http://coapp.org/telemetry/?anonid={0}&pkg={1}` ".format(PackageManager.Instance.AnonymousId, canonicalName)); var req = HttpWebRequest.Create("http://coapp.org/telemetry/?anonid={0}&pkg={1}".format(PackageManager.Instance.AnonymousId, canonicalName)); req.BetterGetResponse().Close(); } catch { // who cares... } } }, TaskCreationOptions.AttachedToParent); try { Event <PackageInstalled> .Raise(canonicalName); } catch (Exception e) { Logger.Error("CRITICAL: PackageInstalled event delegate thru an exception of type '{0}' -- {1}".format(e.GetType(), e.StackTrace)); } }
public void PackageSatisfiedBy(string requestedCanonicalName, string satisfiedByCanonicalName) { var pkg = Package.GetPackage(requestedCanonicalName); // pkg.SatisfiedBy = Package.GetPackage(satisfiedByCanonicalName); _packages.Value.Add(pkg); }
public void RemovedPackage(CanonicalName canonicalName) { _packages.Value.Add(Package.GetPackage(canonicalName)); Package.GetPackage(canonicalName).IsInstalled = false; try { Event <PackageRemoved> .Raise(canonicalName); } catch (Exception e) { Logger.Error("CRITICAL: PackageRemoved event delegate thru an exception of type '{0}' -- {1}".format(e.GetType(), e.StackTrace)); } }
public Task <Package> GetPackageDetails(CanonicalName canonicalName, bool forceRefresh = false) { return(Package.GetPackage(canonicalName).AsResultTask()); /* * if (!canonicalName.IsCanonical) { * return InvalidCanonicalNameResult<Package>(canonicalName); * } * * return GetPackage(canonicalName, forceRefresh).Continue(pkg => { * if (forceRefresh || pkg.IsPackageDetailsStale) { * Remote.GetPackageDetails(canonicalName).Wait(); * } * return pkg; * }); * */ }
public Task <Package> GetPackage(CanonicalName canonicalName, bool forceRefresh = false) { if (null == canonicalName) { return(CoTask.AsResultTask <Package>(null)); } if (!canonicalName.IsCanonical) { return(InvalidCanonicalNameResult <Package>(canonicalName)); } var pkg = Package.GetPackage(canonicalName); if (forceRefresh || pkg.IsPackageInfoStale) { return((Remote.FindPackages(canonicalName, null, null, null) as Task <PackageManagerResponseImpl>).Continue(response => pkg)); } return(pkg.AsResultTask()); }
public void UnableToInstallPackage(CanonicalName packageCanonicalName) { throw new PackageInstallFailedException(Package.GetPackage(packageCanonicalName)); }
public void PackageHasPotentialUpgrades(CanonicalName packageCanonicalName, IEnumerable <CanonicalName> supercedents) { UpgradablePackage = Package.GetPackage(packageCanonicalName); PotentialUpgrades = supercedents.Select(Package.GetPackage); throw new PackageHasPotentialUpgradesException(Package.GetPackage(packageCanonicalName), PotentialUpgrades); }
public void PackageDetails(CanonicalName canonicalName, PackageDetails details) { var result = Package.GetPackage(canonicalName); result.PackageDetails = details; }
static Session() { UrlEncodedMessage.AddTypeSubstitution <IPackage>((message, objectName, expectedType) => Package.GetPackage(message[objectName + ".CanonicalName"])); }