public void Shutdown() { Log?.LogMessage("Shutting down server."); // Restart the update agent if we shut it down. UpdateAgent.Start(); }
public NetSdkMsiInstallerClient(InstallElevationContextBase elevationContext, ISetupLogger logger, IWorkloadResolver workloadResolver, SdkFeatureBand sdkFeatureBand, INuGetPackageDownloader nugetPackageDownloader = null, VerbosityOptions verbosity = VerbosityOptions.normal, PackageSourceLocation packageSourceLocation = null, IReporter reporter = null) : base(elevationContext, logger, reporter) { _packageSourceLocation = packageSourceLocation; _nugetPackageDownloader = nugetPackageDownloader; _sdkFeatureBand = sdkFeatureBand; _workloadResolver = workloadResolver; _dependent = $"{DependentPrefix},{sdkFeatureBand},{HostArchitecture}"; Log?.LogMessage($"Executing: {CurrentProcess.GetCommandLine()}, PID: {CurrentProcess.Id}, PPID: {ParentProcess.Id}"); Log?.LogMessage($"{nameof(IsElevated)}: {IsElevated}"); Log?.LogMessage($"{nameof(Is64BitProcess)}: {Is64BitProcess}"); Log?.LogMessage($"{nameof(RebootPending)}: {RebootPending}"); Log?.LogMessage($"{nameof(ProcessorArchitecture)}: {ProcessorArchitecture}"); Log?.LogMessage($"{nameof(HostArchitecture)}: {HostArchitecture}"); Log?.LogMessage($"{nameof(SdkDirectory)}: {SdkDirectory}"); Log?.LogMessage($"SDK feature band: {_sdkFeatureBand}"); if (IsElevated) { // Turn off automatic updates. We don't want MU to potentially patch the SDK // and it also reduces the risk of hitting ERROR_INSTALL_ALREADY_RUNNING. UpdateAgent.Stop(); } }
private void updateWorker_DoWork(object sender, DoWorkEventArgs e) { this._latestReleaseMajorMinor = UpdateAgent.GetLatestVersion(false, null); if (this._latestReleaseMajorMinor.HasValue) { this._latestBeta = UpdateAgent.GetLatestBetaVersion(); } }
public void UnzipPackageTest() { //arrange var unzip = new UpdateAgent(); //act unzip.UnzipPackage(@"C:\Users\Pavilion\Documents\test\test.zip", @"C:\Users\Pavilion\Documents\unzip"); //assert Assert.IsNotNull(true); }
public void CheckupZipCreatedDateTimeTest() { //arrange var updater = new UpdateAgent(); //act var datetime = updater.CheckupZipCreatedDateTime(@"C:\Users\Pavilion\Documents\test\test1.1.01.zip"); //assert Assert.IsNotNull(datetime); }
public void Shutdown() { // Restart the update agent if we shut it down. UpdateAgent.Start(); Log?.LogMessage("Shutting down server."); if (_shutdownRequested) { Dispatcher.Reply(new InstallResponseMessage()); } }
public bool AgentUpdate(AgentUpdateArgs arg) { UpdateAgent handlerAgentUpdate = OnAgentUpdate; if (handlerAgentUpdate != null) { OnAgentUpdate(this, arg); handlerAgentUpdate = null; return(true); } handlerAgentUpdate = null; return(false); }
public void RunScriptTest() { //arrange var updater = new UpdateAgent(); //act string[] arguments = new string[] { @"C:\NAP", @"C:\MarketName_Patches\PatchTester\Patches" }; var runner = updater.RunScript(@"C:\MarketName_Patches\PatchTester\testshell.ps1", arguments); Assert.Fail(); }
public void UpdateAgent(UpdateAgent data) { using (SqlConnection conn = new SqlConnection(_connectionStringAdmin)) { conn.Open(); SqlCommand cmd = new SqlCommand("dbo.UpdateAgent", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", data.Id); cmd.Parameters.AddWithValue("@check", data.Check); cmd.Parameters.AddWithValue("@isActive", data.IsActive); cmd.ExecuteNonQuery(); } }
public void Shutdown() { Log?.LogMessage("Shutting down"); if (IsElevated) { UpdateAgent.Start(); } else if (IsClient && Dispatcher != null && Dispatcher.IsConnected) { InstallResponseMessage response = Dispatcher.SendShutdownRequest(); } Log?.LogMessage("Shutdown completed."); Log?.LogMessage($"Restart required: {Restart}"); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button> (Resource.Id.myButton); button.Click += delegate { var updater = UpdateAgent.GetInstance(this); updater.DownloadMode = DownloadMode.Overwrite; updater.Start("http://filelx.liqucn.com/upload/2015/shipin/360Video_ys4873.apk", "ys4873.apk"); }; }
/// <summary> /// Starts the execution loop of the server. /// </summary> public void Run() { // Turn off automatic updates to reduce the risk of running into ERROR_INSTALL_ALREADY_RUNNING. We // also don't want MU to potentially patch the SDK while performing workload installations. UpdateAgent.Stop(); while (!_done) { if (!Dispatcher.IsConnected || !IsParentProcessRunning) { _done = true; break; } InstallRequestMessage request = Dispatcher.ReceiveRequest(); try { switch (request.RequestType) { case InstallRequestType.Shutdown: Dispatcher.Reply(new InstallResponseMessage()); _done = true; break; case InstallRequestType.CachePayload: Cache.CachePayload(request.PackageId, request.PackageVersion, request.ManifestPath); Dispatcher.ReplySuccess($"Package Cached"); break; case InstallRequestType.WriteWorkloadInstallationRecord: RecordRepository.WriteWorkloadInstallationRecord(new WorkloadId(request.WorkloadId), new SdkFeatureBand(request.SdkFeatureBand)); Dispatcher.ReplySuccess($"Workload record created."); break; case InstallRequestType.DeleteWorkloadInstallationRecord: RecordRepository.DeleteWorkloadInstallationRecord(new WorkloadId(request.WorkloadId), new SdkFeatureBand(request.SdkFeatureBand)); Dispatcher.ReplySuccess($"Workload record deleted."); break; case InstallRequestType.InstallMsi: Dispatcher.Reply(InstallMsi(request.PackagePath, request.LogFile)); break; case InstallRequestType.UninstallMsi: Dispatcher.Reply(UninstallMsi(request.ProductCode, request.LogFile)); break; case InstallRequestType.RepairMsi: Dispatcher.Reply(RepairMsi(request.ProductCode, request.LogFile)); break; case InstallRequestType.AddDependent: case InstallRequestType.RemoveDependent: UpdateDependent(request.RequestType, request.ProviderKeyName, request.Dependent); Dispatcher.ReplySuccess($"Updated dependent '{request.Dependent}' for provider key '{request.ProviderKeyName}'"); break; default: throw new InvalidOperationException($"Unknown message request: {(int)request.RequestType}"); } } catch (Exception e) { LogException(e); Dispatcher.Reply(e); } } }
private async void MainForm_Load(object sender, EventArgs e) { if (!(await UpdateAgent.IsLatest())) { DialogResult result = MessageBox.Show("New version found. Do you want to update?", "Found Update", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (!(await UpdateAgent.Execute())) { MessageBox.Show("Update failed. Try again later."); } } } Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; TitleLabel.Text += $" [Version - {version}]"; #region Load saved settings try { GlobalSettings.proxyList = JsonConvert.DeserializeObject <List <Proxy> >(Properties.Settings.Default.ProxyList) == null ? new List <Proxy>() : JsonConvert.DeserializeObject <List <Proxy> >(Properties.Settings.Default.ProxyList); } catch { MessageBox.Show("ProxyList load failed."); GlobalSettings.proxyList = new List <Proxy>(); } try { GlobalSettings.creatorSettings = JsonConvert.DeserializeObject <CreatorSettings>(Properties.Settings.Default.CreatorSettings) == null ? new CreatorSettings() : JsonConvert.DeserializeObject <CreatorSettings>(Properties.Settings.Default.CreatorSettings); } catch { MessageBox.Show("Creator settings load failed."); GlobalSettings.creatorSettings = new CreatorSettings(); } try { GlobalSettings.webProxy = JsonConvert.DeserializeObject <List <WebProxyItem> >(Properties.Settings.Default.WebProxyList) == null ? new List <WebProxyItem>() : JsonConvert.DeserializeObject <List <WebProxyItem> >(Properties.Settings.Default.WebProxyList); } catch { MessageBox.Show("WebProxyList load failed."); GlobalSettings.webProxy = new List <WebProxyItem>(); } try { GlobalSettings.captchaSettings = JsonConvert.DeserializeObject <List <CaptchaAPI> >(Properties.Settings.Default.CaptchaSettings) == null ? new List <CaptchaAPI>() : JsonConvert.DeserializeObject <List <CaptchaAPI> >(Properties.Settings.Default.CaptchaSettings); } catch { MessageBox.Show("Captcha settings load failed."); GlobalSettings.captchaSettings = new List <CaptchaAPI>(); } if (GlobalSettings.captchaSettings.Count == 0) { int index = 1; foreach (CaptchaProvider _ in Enum.GetValues(typeof(CaptchaProvider))) { GlobalSettings.captchaSettings.Add(new CaptchaAPI(_, "", index)); index++; } } else if (GlobalSettings.captchaSettings.Count < Enum.GetValues(typeof(CaptchaProvider)).Length) { int index = GlobalSettings.captchaSettings.Count + 1; foreach (CaptchaProvider _ in Enum.GetValues(typeof(CaptchaProvider))) { if (GlobalSettings.captchaSettings.FirstOrDefault(__ => __.provider == _) == null) { GlobalSettings.captchaSettings.Add(new CaptchaAPI(_, "", index)); index++; } } } #endregion GlobalSettings.webProxyForm.TopLevel = GlobalSettings.createForm.TopLevel = GlobalSettings.captchaFrom.TopLevel = GlobalSettings.proxyForm.TopLevel = false; GlobalSettings.webProxyForm.AutoScroll = GlobalSettings.createForm.AutoScroll = GlobalSettings.captchaFrom.AutoScroll = GlobalSettings.proxyForm.AutoScroll = true; GlobalSettings.webProxyForm.Dock = GlobalSettings.createForm.Dock = GlobalSettings.captchaFrom.Dock = GlobalSettings.proxyForm.Dock = DockStyle.Fill; this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; ContentPanel.Controls.Clear(); ContentPanel.Controls.Add(GlobalSettings.createForm); GlobalSettings.createForm.Show(); }