public void TestInvalidByteLoad() { var secret = new MemorySecret(); Assert.Throws <ArgumentNullException>(() => secret.Load((byte[])null, GameRegion.US)); Assert.Throws <SecretException>(() => secret.Load(new byte[] { 0 }, GameRegion.US)); Assert.Throws <InvalidChecksumException>(() => secret.Load("6●sWh", GameRegion.US)); Assert.Throws <ArgumentException>(() => { secret.Load("H~2:♥", GameRegion.US); }); }
public void LoadSecretFromString() { var secret = new MemorySecret(); secret.Load(desiredSecretString, GameRegion.US); Assert.AreEqual(desiredSecret, secret); }
public void LoadSecretFromBytes_JP() { var secret = new MemorySecret(); secret.Load(desiredSecretBytes_JP, GameRegion.JP); Assert.AreEqual(desiredSecret_JP, secret); }
public void LoadSecretFromString_JP() { var secret = new MemorySecret(); secret.Load(desiredSecretString_JP, GameRegion.JP); Assert.That(desiredSecret_JP, Is.EqualTo(secret)); }
public void TestWeirdBytes() { var secret = new MemorySecret(); Assert.Throws <UnknownMemoryException>(() => { secret.Load(desiredSecretBytes_JP_Weird, GameRegion.JP); }); }
public void LoadSecretFromString() { MemorySecret secret = new MemorySecret(); secret.Load(DesiredSecretString); Assert.AreEqual(Game.Ages, secret.TargetGame); Assert.AreEqual(14129, secret.GameID); Assert.AreEqual(Memory.ClockShopKingZora, secret.Memory); Assert.AreEqual(true, secret.IsReturnSecret); }
public void LoadFromGameInfo() { MemorySecret secret = new MemorySecret() { Memory = Memory.ClockShopKingZora, IsReturnSecret = true }; secret.Load(GameInfoTest.DesiredInfo); Assert.AreEqual(DesiredSecret, secret); }
private void btnDone_Click(object sender, RoutedEventArgs e) { try { if (GameInfo == null) { GameInfo = new GameInfo() { Region = _region } } ; var trimmedData = data.Take(currentPic.Clamp(0, _secretLength)).ToArray(); switch (Mode) { case SecretType.Game: GameSecret gs = new GameSecret(); gs.Load(trimmedData, _region); gs.UpdateGameInfo(GameInfo); break; case SecretType.Ring: RingSecret rs = new RingSecret(); rs.Load(trimmedData, _region); rs.UpdateGameInfo(GameInfo, chkAppendRings.IsChecked == true); break; case SecretType.Memory: MemorySecret ms = new MemorySecret(); ms.Load(trimmedData, _region); // Now what? break; } this.Close(); } catch (SecretException ex) { MessageBox.Show(ex.Message, "Invalid Secret", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
protected void OnButtonOkPressed(object sender, EventArgs e) { try { if (GameInfo == null) { GameInfo = new GameInfo(); } var trimmedData = data.Take(currentPic.Clamp(0, _secretLength)).ToArray(); switch (Mode) { case SecretType.Game: GameSecret gs = new GameSecret(_region); gs.Load(trimmedData); gs.UpdateGameInfo(GameInfo); break; case SecretType.Ring: RingSecret rs = new RingSecret(_region); rs.Load(trimmedData); rs.UpdateGameInfo(GameInfo, chkAppendRings.Active); break; case SecretType.Memory: MemorySecret ms = new MemorySecret(_region); ms.Load(trimmedData); // Now what? break; } this.Respond(ResponseType.Ok); } catch (InvalidSecretException ex) { MessageBox.Show(ex.Message, "Invalid Secret", ButtonsType.Ok, MessageType.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", ButtonsType.Ok, MessageType.Error); } }
public void LoadSecretFromString() { MemorySecret secret = new MemorySecret(); secret.Load(DesiredSecretString); Assert.AreEqual(DesiredSecret, secret); }
public void LoadSecretFromBytes() { MemorySecret secret = new MemorySecret(); secret.Load(DesiredSecretBytes); Assert.AreEqual(DesiredSecret, secret); }