public override void OnEnteredState() { this.zipTempName = Path.GetTempFileName() + ".zip"; try { bool flag; if (OS.VerifyFrameworkVersion(this.downloadMe.NetFxMajorVersion, this.downloadMe.NetFxMinorVersion, this.downloadMe.NetFxServicePack, true)) { flag = false; } else { flag = true; } base.OnProgress(0.0); FileStream underlyingStream = new FileStream(this.zipTempName, FileMode.Create, FileAccess.Write, FileShare.Read); try { SiphonStream output = new SiphonStream(underlyingStream); this.abortMeStream = output; ProgressEventHandler progressCallback = (sender, e) => base.OnProgress(e.Percent); WebHelpers.DownloadFile(new Uri(this.downloadMe.ChooseDownloadUrl(flag)), output, progressCallback); output.Flush(); this.abortMeStream = null; output = null; } finally { if (underlyingStream != null) { underlyingStream.Close(); underlyingStream = null; } } base.StateMachine.QueueInput(PrivateInput.GoToExtracting); } catch (Exception exception) { this.exception = exception; if (base.AbortRequested) { base.StateMachine.QueueInput(PrivateInput.GoToAborted); } else { this.exception = exception; base.StateMachine.QueueInput(PrivateInput.GoToError); } } }