private IEnumerator TransitionToCombatCoroutine(Breach breach = null) { if (!isLoadingSomething) { var ongoingOperation = SceneManager.LoadSceneAsync(sceneToLoadCombat, LoadSceneMode.Additive); TransitionScreen.SetActive(true); Time.timeScale = 0; while (!ongoingOperation.isDone) { isLoadingSomething = true; yield return(new WaitForEndOfFrame()); } if (breach) { breach.BreachDefeated = true; } SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(sceneToLoadCombat)); Time.timeScale = 1; MapHolderGameObject.SetActive(false); TransitionScreen.SetActive(false); isLoadingSomething = false; sceneToLoadCombat = 3; // Load Combat Scene 3? } }
//---------------------------------------------------------------------------------------------------------------- public static Breach CheckIfBreachExistsInDatabase(string Title) { //Check database to see if Title passed in exists in the Breach table Breach breach = db.FirstOrDefault <Breach>("SELECT * FROM Breach WHERE Title= @0 ", Title); return(breach); }
//---------------------------------------------------------------------------------------------------------------- public static Breached_Emails FromBreach(Breach obj, string email) { Breached_Emails result = new Breached_Emails(); result.ID = obj.ID; result.Email = email; return(result); }
public override void Init(object initData) { base.Init(initData); if (initData != null) { Breach = (Breach)initData; } }
public BreachCache(Breach breach) { Id = breach.Id; Position = breach.Position; WalkablePosition = ExilePather.FastWalkablePositionFor(breach); IsValid = true; Log.InfoFormat("[BreachCache] {0} {1}", Id, WalkablePosition); }
public void ToString_ReturnsValueOfNameProperty() { const string name = "BREACH_NAME"; var b = new Breach() { Name = name, }; Assert.Equal(name, b.Name); }
public async Task GetBreach_WhenCalledWithUnknownSite_ReturnsNull() { // Arrange IHaveIBeenPwnedClient client = new HaveIBeenPwnedClient(); // Act Breach breach = await client.GetBreach("DOES NOT EXIST"); // Assert Assert.IsNull(breach); }
public async Task GetBreach_WhenCalledWithBreachedSite_ReturnsBreachDetails() { // Arrange IHaveIBeenPwnedClient client = new HaveIBeenPwnedClient(); // Act Breach breach = await client.GetBreach("Adobe"); // Assert Assert.AreEqual("Adobe", breach.Name); Assert.AreEqual("In October 2013, 153 million Adobe accounts were breached with each containing an internal ID, username, email, <em>encrypted</em> password and a password hint in plain text. The password cryptography was poorly done and <a href=\"http://stricture-group.com/files/adobe-top100.txt\" target=\"_blank\" rel=\"noopener\">many were quickly resolved back to plain text</a>. The unencrypted hints also <a href=\"http://www.troyhunt.com/2013/11/adobe-credentials-and-serious.html\" target=\"_blank\" rel=\"noopener\">disclosed much about the passwords</a> adding further to the risk that hundreds of millions of Adobe customers already faced.", breach.Description); }
//---------------------------------------------------------------------------------------------------------------- public static Breach FromPwned(Pwned obj) { Breach result = new Breach(); result.Domain = obj.Domain; result.AddedDate = obj.AddedDate; result.BreachDate = obj.BreachDate; result.LogoPath = obj.LogoPath; result.Title = obj.Title; result.IsVerified = obj.IsVerified; return(result); }
///<inheritdoc/> public override int GetHashCode() { int hash = 17; // Overflow is fine, just wrap unchecked { hash = (hash * 29) + Breach.GetHashCode(); hash = (hash * 29) + MineCount.GetHashCode(); } return(hash); }
public void GetHashCode_ReturnsDifferentHashCodesForDifferentValues() { var p = new Breach() { Name = "FIRST", }; var other = new Breach() { Name = "SECOND", }; Assert.NotEqual(p.GetHashCode(), other.GetHashCode()); }
public void GetHashCode_ReturnsSameHashCodesForSameValues() { var p = new Breach() { Name = "VALUE", }; var other = new Breach() { Name = "VALUE", }; Assert.Equal(p.GetHashCode(), other.GetHashCode()); }
public void Equals_WithSameTypeButDifferentValues_ReturnsFalse() { var p = new Breach() { Name = "FIRST", }; var other = new Breach() { Name = "SECOND", }; Assert.False(p.Equals(other)); }
public void Equals_WithSameTypeAndSameValues_ReturnsTrue() { var p = new Breach() { Name = "VALUE", }; var other = new Breach() { Name = "VALUE", }; Assert.True(p.Equals(other)); }
public void TransitionToCombat(Breach breach = null) { // TODO: Set it up to save the map data //StaticVariables.persistanceManager.SaveMapData(); if (!isLoadingSomething && StaticVariables.petData.stats.health > 0) { StartCoroutine(TransitionToCombatCoroutine(breach)); } else if (StaticVariables.petData.stats.health == 0 && !showingAlert) { StartCoroutine(ShowAlertText(5f)); } }
public void ParseDateIsCorrect() { //Arrange Breach breach = new Breach { AddedDate = "2016-10-08T07:46:05Z", BreachDate = "2015-03-01" }; // Act string FormattedAddedDate = breach.GetFormattedAddedDate(); string FormattedBreachDate = breach.GetFormattedBreachDate(); // Assert Assert.Equal("08.10.2016", FormattedAddedDate); Assert.Equal("01.03.2015", FormattedBreachDate); }
public async Task <Breach> GetBreach(string site) { string api = "breach"; var response = await GETRequestAsync($"{api}/{site}"); Breach breach = new Breach(); if (response.StatusCode == "OK") { string body = response.Body; breach = JsonConvert.DeserializeObject <Breach>(body); return(breach); } else { return(null); } }
public IActionResult AdminEdit(int?id) { Breach = new Breach(); if (id == null) { return(View(Breach)); } Breach = _db.Breaches.FirstOrDefault(x => x.Id == id); if (id == null) { Breach = new Breach(); return(View(Breach)); } return(View(Breach)); }
internal void AttemptBreach(Hackable toHack) { if (!hasUsedAction && GetBreach() > 0 && !toHack.IsHacked()) { int breachRange = 1; if (GetKeywords().Contains("Remote")) { breachRange = GetRange(); } List <DungeonTile> tempPath = DungeonManager.instance.grid.FindPath(myTile, toHack.myTile, breachRange, true); if (tempPath[tempPath.Count - 1] == toHack.myTile) { Breach newBreach = Instantiate(myBreach, gameObject.transform.position, Quaternion.identity).GetComponent <Breach>(); newBreach.breach = GetBreach(); newBreach.SetCourse(tempPath, toHack); Program.isTargetingBreach = false; movesLeft = 0; hasUsedAction = true; } } }
void Start() { exitBreachComp = exitBreach.GetComponent <Breach>(); }
public void Update(Breach breach) { // Nothing to do here }
/// <summary> /// Parse the given HTML code coming from Mozilla's FireFox monitor website /// and return only the breach that haven't been announced to the user yet. /// </summary> private async Task <IReadOnlyList <Breach> > ParseBreachesAsync( SecureString emailAddress, string html, HashSet <string> treatedBreaches, IReadOnlyDictionary <string, string> pwnedBrownBagData, CancellationToken cancellationToken) { var breachesSummary = new List <Breach>(); int locationStart = -1; int locationEnd; do { locationStart = html.IndexOf(BreachInfoWrapperIdentifier, locationStart + 1, StringComparison.OrdinalIgnoreCase); if (locationStart > -1) { locationEnd = html.IndexOf(BreachInfoWrapperEndIdentifier, locationStart, StringComparison.OrdinalIgnoreCase); if (locationEnd > locationStart && html.IndexOf(BreachPasswordIdentifier, locationStart, StringComparison.OrdinalIgnoreCase) > -1) { // Breach title int breachTitleStart = html.IndexOf(BreachTitleIdentifier, locationStart, StringComparison.OrdinalIgnoreCase) + BreachTitleIdentifier.Length; int breachTitleEnd = html.IndexOf(BreachInfoEndIdentifier, breachTitleStart, StringComparison.OrdinalIgnoreCase); string breachTitle = html.Substring(breachTitleStart, breachTitleEnd - breachTitleStart); // Breach date int breachDateStart = html.IndexOf(BreachDateIdentifier, breachTitleEnd, StringComparison.OrdinalIgnoreCase) + BreachDateIdentifier.Length; int breachDateEnd = html.IndexOf(BreachInfoEndIdentifier, breachDateStart, StringComparison.OrdinalIgnoreCase); string breachDateStr = html.Substring(breachDateStart, breachDateEnd - breachDateStart); var brownBagItemKey = $"{BrownBagPwnedPrefix}{breachTitle}_{_serializationProvider.GetSha1Hash(emailAddress.ToUnsecureString())}"; var breachDate = DateTime.Parse(breachDateStr, new CultureInfo("en")); treatedBreaches.Add(brownBagItemKey); // If this breach has never been recorded in the user data bundle, // or that the detected breach is more recent that the one we had in record, // then we return a result, so the user will be notified. if ((!pwnedBrownBagData.TryGetValue(brownBagItemKey, out string brownBagValue) || DateTime.Parse(brownBagValue, CultureInfo.InvariantCulture) < breachDate) && !string.IsNullOrWhiteSpace(breachTitle)) { var breachSummary = new Breach { Title = breachTitle, EmailAddress = emailAddress.Copy(), BrownBagItemKey = brownBagItemKey, BreachDate = breachDate }; breachesSummary.Add(breachSummary); await _dataManager.SetBrownBagDataAsync( breachSummary.BrownBagItemKey, breachSummary.BreachDate.ToString(CultureInfo.InvariantCulture), cancellationToken) .ConfigureAwait(false); } } } } while (locationStart > -1); return(breachesSummary); }
public void Equals_WithWrongTypeObject_ReturnsFalse() { var p = new Breach(); Assert.False(p.Equals(string.Empty)); }
public void Equals_WithNullObject_ReturnsFalse() { var p = new Breach(); Assert.False(p.Equals((object)null)); }
public void AddBreach(Breach breach) { breaches.Add(breach); }