public DtoApiBoolResponse DownloadKernel(DtoOnlineKernel onlineKernel) { return(new DtoApiBoolResponse() { Value = new DownloadKernel().Download(onlineKernel) }); }
protected void btnDownload_OnClick(object sender, EventArgs e) { var control = sender as Control; if (control != null) { var onlineKernel = new DtoOnlineKernel(); var gvRow = (GridViewRow)control.Parent.Parent; onlineKernel.BaseVersion = gvRow.Cells[2].Text; onlineKernel.FileName = gvRow.Cells[0].Text; if (onlineKernel.BaseVersion != null) { var result = Call.OnlineKernelApi.DownloadKernel(onlineKernel); EndUserMessage = result ? "Successfully Downloaded Kernel" : "Could Not Download Kernel"; } } PopulateKernels(); }
public bool RunAllServers(DtoOnlineKernel onlineKernel) { var uow = new UnitOfWork(); var comServers = uow.ClientComServerRepository.Get(x => x.IsTftpServer); var intercomKey = ServiceSetting.GetSettingValue(SettingStrings.IntercomKeyEncrypted); var decryptedKey = new EncryptionServices().DecryptText(intercomKey); var NoErrors = true; foreach (var com in comServers) { if (!new APICall().ClientComServerApi.DownloadKernel(com.Url, "", decryptedKey, onlineKernel)) { NoErrors = false; } } return(NoErrors); }
public bool Download(DtoOnlineKernel onlineKernel) { var guid = ConfigurationManager.AppSettings["ComServerUniqueId"]; _thisComServer = new ServiceClientComServer().GetServerByGuid(guid); if (_thisComServer == null) { log.Error($"Com Server With Guid {guid} Not Found"); return(false); } if (string.IsNullOrEmpty(_thisComServer.TftpPath)) { log.Error($"Com Server With Guid {guid} Does Not Have A Valid Tftp Path"); return(false); } var baseUrl = "http://files.theopenem.com/kernels/"; using (var wc = new WebClient()) { try { wc.DownloadFile(new Uri(baseUrl + onlineKernel.BaseVersion + "/" + onlineKernel.FileName), _thisComServer.TftpPath + "kernels" + Path.DirectorySeparatorChar + onlineKernel.FileName); return(true); } catch (Exception ex) { log.Error("Could Not Download Kernel On Com Server: " + _thisComServer.DisplayName); log.Error(ex.Message); return(false); } } }
public bool DownloadKernel(string url, string serverName, string interComKey, DtoOnlineKernel onlineKernel) { Request.Method = Method.POST; Request.Resource = "Imaging/DownloadKernel"; Request.AddJsonBody(onlineKernel); var responseData = new ApiRequest(new Uri(url)).ExecuteHMACInterCom <DtoApiBoolResponse>(Request, serverName, interComKey); return(responseData != null && responseData.Value); }