public void DownloadAndInstallPackage( ReportInstallProgress reportProgress, DownloadComplete downloadComplete, DownloadError downloadError, VerificationError verificationError, IsCancelled isCancelled ) { string downloadPath = PrepareDownloadFilePath (FileUtil.GetUniqueTempPathInProject (), config.Filename); new Detail.AsyncTaskRunnerBuilder<byte[]> ().Do ((object[] args) => { return Net.Validator.MakeRequest (() => { return API.V1.DownloadFile (config.PackageUrl, (progress) => reportProgress(progress), () => { return isCancelled (); }); }); }).OnError ((System.Exception e) => { downloadError(e); return Detail.AsyncTaskRunner<byte[]>.ErrorRecovery.Nothing; }).OnCompletion ((byte[] downloadedBytes) => { if (downloadedBytes.Length == 0) { return; } try { System.IO.File.WriteAllBytes (downloadPath, downloadedBytes); string signatureUrl = SignatureUrlFromPackageUrl (config.PackageUrl); VerifySignature (signatureUrl, downloadedBytes, verificationError, downloadError, isCancelled, () => { downloadComplete (downloadPath); InstallPackage (downloadPath); }); } catch (IOException e) { downloadError (e as Exception); } }).Run (); }
public void DownloadAndInstallPackage( ReportInstallProgress reportProgress, DownloadComplete downloadComplete, DownloadError downloadError, VerificationError verificationError, IsCancelled isCancelled ) { string downloadPath = PrepareDownloadFilePath(FileUtil.GetUniqueTempPathInProject(), config.Filename); new Detail.AsyncTaskRunnerBuilder <byte[]> ().Do((object[] args) => { return(Net.Validator.MakeRequest(() => { return API.V1.DownloadFile(config.PackageUrl, (progress) => reportProgress(progress), () => { return isCancelled(); }); })); }).OnError((System.Exception e) => { downloadError(e); return(Detail.AsyncTaskRunner <byte[]> .ErrorRecovery.Nothing); }).OnCompletion((byte[] downloadedBytes) => { if (downloadedBytes.Length == 0) { return; } try { System.IO.File.WriteAllBytes(downloadPath, downloadedBytes); string signatureUrl = SignatureUrlFromPackageUrl(config.PackageUrl); VerifySignature(signatureUrl, downloadedBytes, verificationError, downloadError, isCancelled, () => { downloadComplete(downloadPath); InstallPackage(downloadPath); }); } catch (IOException e) { downloadError(e as Exception); } }).Run(); }
private static void VerifySignature( string signatureUrl, byte[] fileToVerify, VerificationError verificationError, DownloadError downloadError, IsCancelled isCancelled, Action onSuccess ) { new Detail.AsyncTaskRunnerBuilder <byte[]> ().Do((object[] args) => { return(Net.Validator.MakeRequest(() => { return API.V1.DownloadFile(signatureUrl, (progress) => {}, () => { return isCancelled(); }); })); }).OnError((System.Exception e) => { downloadError(e); return(Detail.AsyncTaskRunner <byte[]> .ErrorRecovery.Nothing); }).OnCompletion((byte[] signature) => { if (SignatureMatches(signature, fileToVerify) == VerificationStatus.Success) { onSuccess(); return; } verificationError(); }).Run(); }
public override int GetHashCode() { int hash = 1; if (RaidSeed != 0L) { hash ^= RaidSeed.GetHashCode(); } if (FortId.Length != 0) { hash ^= FortId.GetHashCode(); } if (StartTimeMs != 0L) { hash ^= StartTimeMs.GetHashCode(); } if (EndTimeMs != 0L) { hash ^= EndTimeMs.GetHashCode(); } if (ImageUrl.Length != 0) { hash ^= ImageUrl.GetHashCode(); } if (Latitude != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Latitude); } if (Longitude != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Longitude); } if (GymName.Length != 0) { hash ^= GymName.GetHashCode(); } if (SpawnTimeMs != 0L) { hash ^= SpawnTimeMs.GetHashCode(); } if (IsCancelled != false) { hash ^= IsCancelled.GetHashCode(); } if (raidPokemon_ != null) { hash ^= RaidPokemon.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (RaidSeed != 0L) { hash ^= RaidSeed.GetHashCode(); } if (FortId.Length != 0) { hash ^= FortId.GetHashCode(); } if (StartTimeMs != 0L) { hash ^= StartTimeMs.GetHashCode(); } if (EndTimeMs != 0L) { hash ^= EndTimeMs.GetHashCode(); } if (ImageUrl.Length != 0) { hash ^= ImageUrl.GetHashCode(); } if (Latitude != 0D) { hash ^= Latitude.GetHashCode(); } if (Longitude != 0D) { hash ^= Longitude.GetHashCode(); } if (GymName.Length != 0) { hash ^= GymName.GetHashCode(); } if (SpawnTimeMs != 0L) { hash ^= SpawnTimeMs.GetHashCode(); } if (IsCancelled != false) { hash ^= IsCancelled.GetHashCode(); } if (raidPokemon_ != null) { hash ^= RaidPokemon.GetHashCode(); } return(hash); }
public void Dispose() { // Clearing all of these ensures that the transient APIs // can't be called outside of the appropriate scope. #region dispose-dispatcher service-apis _GetNuGetExePath = null; _GetNuGetDllPath = null; _DownloadFile = null; _AddPinnedItemToTaskbar = null; _RemovePinnedItemFromTaskbar = null; _CreateShortcutLink = null; _UnzipFileIncremental = null; _UnzipFile = null; _AddFileAssociation = null; _RemoveFileAssociation = null; _AddExplorerMenuItem = null; _RemoveExplorerMenuItem = null; _SetEnvironmentVariable = null; _RemoveEnvironmentVariable = null; _AddFolderToPath = null; _RemoveFolderFromPath = null; _InstallMSI = null; _RemoveMSI = null; _StartProcess = null; _InstallVSIX = null; _UninstallVSIX = null; _InstallPowershellScript = null; _UninstallPowershellScript = null; _SearchForExecutable = null; _GetUserBinFolder = null; _GetSystemBinFolder = null; _CopyFile = null; _CopyFolder = null; _Delete = null; _DeleteFolder = null; _CreateFolder = null; _DeleteFile = null; _BeginTransaction = null; _AbortTransaction = null; _EndTransaction = null; _GenerateUninstallScript = null; _GetKnownFolder = null; _IsElevated = null; #endregion #region dispose-dispatcher core-apis _Warning = null; _Message = null; _Error = null; _Debug = null; _Verbose = null; _ExceptionThrown = null; _Progress = null; _ProgressComplete = null; _GetHostDelegate = null; _IsCancelled = null; #endregion #region dispose-dispatcher request-apis _OkToContinue = null; _YieldPackage = null; _YieldPackageDetails = null; _YieldPackageSwidtag = null; _YieldSource = null; _YieldMetadataDefinition = null; _YieldInstallationOptionsDefinition = null; #endregion #region dispose-dispatcher host-apis _GetMetadataKeys = null; _GetMetadataValues = null; _GetInstallationOptionKeys = null; _GetInstallationOptionValues = null; _PackageSources = null; _GetConfiguration = null; _ShouldContinueWithUntrustedPackageSource = null; _ShouldProcessPackageInstall = null; _ShouldProcessPackageUninstall = null; _ShouldContinueAfterPackageInstallFailure = null; _ShouldContinueAfterPackageUninstallFailure = null; _ShouldContinueRunningInstallScript = null; _ShouldContinueRunningUninstallScript = null; _AskPermission = null; _WhatIf = null; #endregion #region dispose-dispatcher protocol-apis _ProtocolGetNames = null; _ProtocolIsValidSource = null; _ProtocolGetItemMetadata = null; _ProtocolDownloadItem = null; _ProtocolUnpackItem = null; _InstallItem = null; #endregion _callback = null; }
public bool IsCancelled( ) { CheckDisposed(); return((_IsCancelled ?? (_IsCancelled = (_callback.Resolve <IsCancelled>() ?? (() => default(bool)))))()); }
internal Response(Object requestImpl, PackageProvider provider) { _provider = provider; _context = requestImpl; _isCancelled = _context.As <IsCancelled>(); }
private static void VerifySignature( string signatureUrl, byte[] fileToVerify, VerificationError verificationError, DownloadError downloadError, IsCancelled isCancelled, Action onSuccess ) { new Detail.AsyncTaskRunnerBuilder<byte[]> ().Do ((object[] args) => { return Net.Validator.MakeRequest (() => { return API.V1.DownloadFile (signatureUrl, (progress) => {}, () => { return isCancelled (); }); }); }).OnError ((System.Exception e) => { downloadError (e); return Detail.AsyncTaskRunner<byte[]>.ErrorRecovery.Nothing; }).OnCompletion ((byte[] signature) => { if (SignatureMatches (signature, fileToVerify) == VerificationStatus.Success) { onSuccess (); return; } verificationError (); }).Run (); }