public override int GetHashCode() { int result = 1; result = (result * 397) ^ (Browser != null ? Browser.GetHashCode() : 0); result = (result * 397) ^ (BrowserVersion != null ? BrowserVersion.GetHashCode() : 0); result = (result * 397) ^ Id.GetHashCode(); result = (result * 397) ^ LoginDate.GetHashCode(); result = (result * 397) ^ (Username != null ? Username.GetHashCode() : 0); return(result); }
public override int GetHashCode() { int hash = 1; if (Raw.Length != 0) { hash ^= Raw.GetHashCode(); } if (Platform.Length != 0) { hash ^= Platform.GetHashCode(); } if (Os.Length != 0) { hash ^= Os.GetHashCode(); } if (OsVersion.Length != 0) { hash ^= OsVersion.GetHashCode(); } if (Engine.Length != 0) { hash ^= Engine.GetHashCode(); } if (EngineVersion.Length != 0) { hash ^= EngineVersion.GetHashCode(); } if (Browser.Length != 0) { hash ^= Browser.GetHashCode(); } if (BrowserVersion.Length != 0) { hash ^= BrowserVersion.GetHashCode(); } if (Localization.Length != 0) { hash ^= Localization.GetHashCode(); } if (Mobile != false) { hash ^= Mobile.GetHashCode(); } if (WalletCompatible != false) { hash ^= WalletCompatible.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int CompareTo(BrowserVersion other) { var strOther = other as SimpleStringVersion; if (strOther == null) { return(1); } return(StringComparer.InvariantCulture.Compare(version, strOther.version)); }
public override bool Equals(BrowserVersion other) { var strOther = other as SimpleStringVersion; if (strOther == null) { return(false); } return(version.Equals(strOther.version, StringComparison.InvariantCulture)); }
public async Task DownloadDriver() { var client = new GitHubClient(new ProductHeaderValue("Vulcan-Client")); var releases = await client.Repository.Release.GetAll("operasoftware", "operachromiumdriver"); string operaVersion = BrowserVersion.Split(".")[0]; foreach (var release in releases) { Match match = Regex.Match(release.Body, @"Opera Stable " + operaVersion); if (!match.Success) { return; } Console.WriteLine(release.Body); foreach (var asset in release.Assets) { if (asset.Name == "operadriver_win64.zip") { string downloadUrl = asset.BrowserDownloadUrl; using (HttpClient hClient = new HttpClient()) { using (HttpResponseMessage response = await hClient.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead)) using (Stream streamToReadFrom = await response.Content.ReadAsStreamAsync()) { string currentDirectory = Directory.GetCurrentDirectory(); string filePath = $"{currentDirectory}/{ZipFileName}"; using (Stream streamToWriteTo = File.Open(filePath, System.IO.FileMode.Create)) { await streamToReadFrom.CopyToAsync(streamToWriteTo); Console.WriteLine("Driver pobrany"); } Console.WriteLine("Rozpakowujemy drivera"); await Task.Run(() => { ZipFile.ExtractToDirectory(filePath, $"{currentDirectory}/drivers/"); Console.WriteLine("Driver rozpakowany"); }); Console.WriteLine("Usuwamy zipa"); await Task.Run(() => { File.Delete(filePath); Console.WriteLine("Zip usuniety"); }); } } } } } }
bool IsUsefulVersion(BrowserVersion version) { if (version is SemanticVersion) { return(true); } if (version is DottedNumericVersion) { return(true); } return(false); }
private void GetBrowserVersions(ActionExecutingContext filterContext) { HttpBrowserCapabilities hbc = HttpContext.Current.Request.Browser; string browserName = hbc.Browser.ToString().ToLower(); //获取浏览器类型 string browserVersion = hbc.Version.ToString(); //获取版本号 BrowserVersionType re = BrowserVersionType.Permit; if (!string.IsNullOrEmpty(ConfigurationHelper.GetAppSetting("DefaulBrowserIsAllow"))) { if (!Convert.ToBoolean(ConfigurationHelper.GetAppSetting("DefaulBrowserIsAllow"))) { re = BrowserVersionType.Forbid; } } object obj = ConfigurationManager.GetSection("BrowserVersionSection"); BrowserVersionSection mySection4 = (BrowserVersionSection)ConfigurationManager.GetSection("BrowserVersionSection"); List <MyKeyValueSetting> ml = new List <MyKeyValueSetting>(); List <BrowserVersion> blist = new List <BrowserVersion>(); if (mySection4 != null && mySection4.KeyValues.Count > 0) { ml = (from kv in mySection4.KeyValues.Cast <MyKeyValueSetting>() // let s = string.Format("{0}={1}", kv.Key, kv.Value) select kv).Where(c => c.BrowserName.ToLower() == browserName).ToList(); foreach (var item in ml) { BrowserVersion bv = new BrowserVersion(); bv.BrowserName = item.BrowserName; bv.Version = item.Version; bv.IsAllow = Convert.ToBoolean(item.IsAllow); bv.SpecifiedVersion = Convert.ToBoolean(item.specified); blist.Add(bv); } } BrowserVersionType type = BL.Permission.ComparativeVersion(browserVersion, re, blist); if (type == BrowserVersionType.Forbid) { filterContext.Result = new ContentResult { Content = MVC2015.Utility.Resource.ResourceHelper.GetValue("BrowserCanNotUse") }; } CommonHelper.SetCookie("BrowserVersionType", ((int)type).ToString(), null, false); }
public override async Task DownloadZip() { string edgeVersion = BrowserVersion.Split(".")[0]; Log.Debug("Sprawdzamy ostatnia wersje drivera do przegladrki"); using (HttpClient client = new HttpClient()) { Uri uri = new Uri($"https://msedgedriver.azureedge.net/LATEST_RELEASE_{edgeVersion}_WINDOWS"); using (HttpResponseMessage lastestVersionResponse = await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead)) { lastestVersionResponse.EnsureSuccessStatusCode(); using (Stream latestVersionStream = await lastestVersionResponse.Content.ReadAsStreamAsync()) { using (StreamReader sr = new StreamReader(latestVersionStream)) { string latestDriverVersion = sr.ReadToEnd(); latestDriverVersion = String.Concat(latestDriverVersion.Where(c => !Char.IsWhiteSpace(c))); Log.Debug($"Ostatnia wersja drivera {latestDriverVersion}"); Log.Debug("Pobieramy drivera"); Uri driverUri = new Uri($"https://msedgedriver.azureedge.net/{latestDriverVersion}/{ZipFileName}"); using (HttpResponseMessage response = await client.GetAsync(driverUri, HttpCompletionOption.ResponseHeadersRead)) { response.EnsureSuccessStatusCode(); using (Stream driverStream = await response.Content.ReadAsStreamAsync()) { using (Stream driverStreamWrite = File.Open(ZipPath, FileMode.Create)) { await driverStream.CopyToAsync(driverStreamWrite); } } } } } } } }
public override async Task DownloadZip() { string chromeVersion = BrowserVersion.Substring(0, 2); using (HttpClient client = new HttpClient()) { using (HttpResponseMessage lastestVersionResponse = await client.GetAsync($"http://chromedriver.storage.googleapis.com/LATEST_RELEASE_{chromeVersion}")) { lastestVersionResponse.EnsureSuccessStatusCode(); string latestVersionResponseBody = await lastestVersionResponse.Content.ReadAsStringAsync(); string url = $"http://chromedriver.storage.googleapis.com/{latestVersionResponseBody}/{ZipFileName}"; using (HttpResponseMessage response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead)) using (Stream streamToReadFrom = await response.Content.ReadAsStreamAsync()) { using (Stream streamToWriteTo = File.Open(ZipPath, FileMode.Create)) { await streamToReadFrom.CopyToAsync(streamToWriteTo); } } } } }
public bool IsSupported(BrowserVersion browser) { return true; }
public bool IsSupported(BrowserVersion browser) { return(true); }
public PortlessWebClient(WebHost host, BrowserVersion browserVersion) : base(browserVersion) { WebConnection = new PortlessWebConnection(host); }
public BrowserVersion Version(BrowserVersion src) { BrowserSettings.Version = src; return(BrowserSettings.Version); }