/// <summary> /// Constructor. /// </summary> public QueryEntry(ISoftware sw, DetectedSoftware _detected, bool _needsUpdate, ApplicationType _type) { software = sw; detected = _detected; needsUpdate = _needsUpdate; type = _type; }
public void AddSoftware(string data, ISoftware software) { if (this.MaxCapacity >= software.ConsumCapacity + this.AllSoftwares.Sum(c => c.ConsumCapacity)) { this.allSoftwares.Add(software); } }
protected void _searchForNewer(ISoftware sw) { Assert.IsNotNull(sw); if (!sw.implementsSearchForNewer()) { Assert.Inconclusive("The result of searchForNewer() was not tested, " + "because this class indicates that it does not implement that method."); } var newerInfo = sw.searchForNewer(); Assert.IsNotNull(newerInfo); }
void AvailableApplicationsFilter(object sender, FilterEventArgs e) { if (string.IsNullOrEmpty(SASearcher)) { e.Accepted = true; return; } ISoftware s = e.Item as ISoftware; e.Accepted = (s.Name.ToUpper().Contains(SASearcher.ToUpper())) ? true : false; }
public void RegisterLightSoftware(IList <string> data) { IHardware hardware = this.hardwares.FirstOrDefault(h => h.Name == data[0]); if (hardware == null) { } var isValid = ValidateSoftware(data); if (isValid) { ISoftware software = softwareFactory.CreateSoftware(data.Skip(1).ToList(), "Light"); hardware.AddSoftware(data[0], software); } }
public async Task Invoke(HttpContext context, IRequest request, ISoftware software) { try { var now = DateTime.Now; var requestModel = new Model.Entity.ClientApi.Request() { UserAgent = context.Request.Headers["User-Agent"].ToString(), Ip = context.Connection.RemoteIpAddress.ToString(), RequestPath = context.Request.Path }; if (string.IsNullOrWhiteSpace(context.Request.Headers["ApiKey"].ToString())) { context.Response.StatusCode = 401; await context.Response.WriteAsync("درخواست ارسال شده، بدون مجوز است."); } requestModel.ApiKey = context.Request.Headers["ApiKey"].ToString(); if (string.IsNullOrWhiteSpace(context.Request.Headers["SoftwareId"].ToString())) { context.Response.StatusCode = 404; await context.Response.WriteAsync("سیستم شناسه ی شما را دریافت نکرد."); } requestModel.SoftwareId = context.Request.Headers["SoftwareId"].ToGuid(); if (software.IsValidApiKey(context.Request.Headers["ApiKey"], context.Request.Headers["SoftwareId"].ToGuid())) { await _next.Invoke(context); } else { context.Response.StatusCode = 403; await context.Response.WriteAsync("درخواست ارسال شده، نا معتبر است."); } requestModel.RespondTime = (float)DateTime.Now.Subtract(now).TotalSeconds; requestModel.StatusCode = context.Response.StatusCode.ToString(); request.Insert(requestModel); request.Save(); } catch (Exception) { await _next.Invoke(context); } }
public SoftwareDto(ISoftware item, bool deep = false) { if (item == null) { return; } this.ProductId = item.ProductId; this.LicenseCode = item.LicenseCode; if (deep) { if (item.Product != null) { this.Product = new ProductDto(item.Product, deep); } } }
public void _upToDate_info(ISoftware sw) { Assert.IsNotNull(sw); if (!sw.implementsSearchForNewer()) { Assert.Inconclusive("The check for up to date information was not performed, " + "because this class indicates that it does not implement the searchForNewer() method."); } var info = sw.info(); var newerInfo = sw.searchForNewer(); Assert.IsNotNull(newerInfo, "searchForNewer() returned null!"); int comp = string.Compare(info.newestVersion, newerInfo.newestVersion); var older = new Quartet(info.newestVersion); var newer = new Quartet(newerInfo.newestVersion); if (comp < 0 || older < newer) { Assert.Inconclusive( "Known newest version of " + info.Name + " is " + info.newestVersion + ", but the current newest version is " + newerInfo.newestVersion + "!"); } }
protected void _info(ISoftware sw) { Assert.IsNotNull(sw); var info = sw.info(); Assert.IsNotNull(info); // name must be set Assert.IsFalse(string.IsNullOrWhiteSpace(info.Name)); // at least one installation information instance should be present Assert.IsTrue((info.install32Bit != null) || (info.install64Bit != null)); // at least one regex should be present Assert.IsTrue(!string.IsNullOrWhiteSpace(info.match32Bit) || !string.IsNullOrWhiteSpace(info.match64Bit)); // 32 bit information should match Assert.AreEqual <bool>(info.install32Bit != null, !string.IsNullOrWhiteSpace(info.match32Bit)); // 64 bit information should match Assert.AreEqual <bool>(info.install64Bit != null, !string.IsNullOrWhiteSpace(info.match64Bit)); // checksums should always be present if (null != info.install32Bit) { Assert.IsTrue(info.install32Bit.hasChecksum()); } if (null != info.install64Bit) { Assert.IsTrue(info.install64Bit.hasChecksum()); } // check whether signature data has expired // Expiration is not an error though, because some people publish signed binaries that expire the day after the release. if (null != info.install32Bit && info.install32Bit.signature.containsData() && info.install32Bit.signature.hasExpired()) { Assert.Inconclusive("Signature data of 32 bit installer is past its expiration date!"); } if (null != info.install64Bit && info.install64Bit.signature.containsData() && info.install64Bit.signature.hasExpired()) { Assert.Inconclusive("Signature data of 64 bit installer is past its expiration date!"); } }
public void RemoveSoftwere(ISoftware softwre) { if (this.softwares.FirstOrDefault(s => s.Name == softwre.Name) != null) { this.softwares.Remove(softwre); this.UsedMemory -= softwre.MemoryConsumption; this.UsedCapacity -= softwre.CapacityConsumption; } }
public void AddSoftwere(ISoftware softwere) { if (this.UsedCapacity +softwere.CapacityConsumption <= this.MaximumCapacity && this.UsedMemory +softwere.MemoryConsumption <= this.MaximumMemory) { this.softwares.Add(softwere); this.UsedMemory += softwere.MemoryConsumption; this.UsedCapacity += softwere.CapacityConsumption; } }
public void RemoveSoftware(string hard, string soft) { ISoftware software = this.allSoftwares.First(c => c.Name == soft); this.AllSoftwares.Remove(software); }