public void MoveWorks() { var scrambler = new Scrambler(); Assert.Equal("bdeac", scrambler.Scramble("bcdea", new[] { SampleOps.Move1To4 })); Assert.Equal("abdec", scrambler.Scramble("bdeac", new[] { SampleOps.Move3To0 })); }
public void RotateWorks() { var scrambler = new Scrambler(); Assert.Equal("bcdea", scrambler.Scramble("abcde", new[] { SampleOps.Rotate1Left })); Assert.Equal("cdeab", scrambler.Scramble("abcde", new[] { SampleOps.Rotate8Right })); }
public string Solve(string[] input) { var parser = new OperationParser(); var steps = input.Select(line => parser.Parse(line)); var scrambler = new Scrambler(); return(scrambler.Scramble(Password, steps)); }
public void Scramble_ReturnsCorrectString_BasedOnContainedRules() { var input = "abcde"; var expected = "decab"; var sut = new Scrambler(); var actual = sut.Scramble(input, instructions); Assert.Equal(expected, actual); }
public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, exceptionArgs) => { var errorText = "Program exited with message:\n " + exceptionArgs.ExceptionObject; File.AppendAllText("Error.log", $"{DateTime.Now.ToString("g")} {errorText}\r\n{new string('-', 30)}\r\n"); MessageBox.Show(errorText); Environment.Exit(1); }; #if !DEBUG MemoryControl.Start(); if (Scrambler.Scramble(args.Length > 0 ? args[0] : null)) { return; } #endif Offsets offs; int pid = FindPoeProcess(out offs); if (pid == 0) { MessageBox.Show("Path of Exile is not running!"); return; } Sounds.LoadSounds(); using (var memory = new Memory(offs, pid)) { offs.DoPatternScans(memory); var gameController = new GameController(memory); gameController.RefreshState(); var overlay = new ExternalOverlay(gameController, memory.IsInvalid); Application.Run(overlay); } }
/// <summary> /// Saves all items in the StageProject to their respective parts /// </summary> public void SaveAll(bool imagesScrambled = true) { //These have all been checked Map?.Save(MapPath !); if (Entity != null) { PXEVE.Write(Entity, EntityPath !); } if (Tileset != null) { if (imagesScrambled) { using (Bitmap b = Scrambler.Scramble(Tileset)) b.Save(TilesetPath); } else { Tileset.Save(TilesetPath); } } TilesetProperties?.Save(TilesetPropertiesPath !); if (Spritesheet != null) { if (imagesScrambled) { using (Bitmap b = Scrambler.Scramble(Spritesheet)) b.Save(SpritesheetPath); } else { Spritesheet.Save(SpritesheetPath); } } }
public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, exceptionArgs) => { var errorText = "Program exited with message:\n " + exceptionArgs.ExceptionObject; File.AppendAllText("Error.log", $"{DateTime.Now.ToString("g")} {errorText}\r\n{new string('-', 30)}\r\n"); MessageBox.Show(errorText); Environment.Exit(1); }; #region DEBUG #if !DEBUG MemoryControl.Start(); if (Scrambler.Scramble(args.Length > 0 ? args[0] : null)) { return; } #endif #endregion Offsets offs; int pid = FindPoeProcess(out offs); if (pid == 0) { MessageBox.Show("Path of Exile is not running or you started x32 POE (DirectX9) with x64 PoeHUD or vice verse."); return; } Sounds.LoadSounds(); using (var memory = new Memory(offs, pid)) { offs.DoPatternScans(memory); var gameController = new GameController(memory); #region DEBUG #if DEBUG StringBuilder sb = new StringBuilder(); sb.Append("AddressOfProcess: " + memory.AddressOfProcess.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("GameController: " + (offs.Base + memory.AddressOfProcess).ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("GameState: " + (offs.GameStateOffset + memory.AddressOfProcess).ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("TheGame: " + gameController.Game.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("IngameState: " + gameController.Game.IngameState.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("IngameData: " + gameController.Game.IngameState.Data.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("IngameUi: " + gameController.Game.IngameState.IngameUi.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("InventoryPanel: " + gameController.Game.IngameState.IngameUi.InventoryPanel.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("UIRoot: " + gameController.Game.IngameState.UIRoot.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append("ServerData: " + gameController.Game.IngameState.ServerData.Address.ToString("X")); sb.Append(System.Environment.NewLine); sb.Append(System.Environment.NewLine); sb.Append(memory.DebugStr); File.WriteAllText("__BaseOffsets.txt", sb.ToString()); #endif #endregion var overlay = new ExternalOverlay(gameController, memory.IsInvalid); Application.Run(overlay); } Process.GetCurrentProcess().Kill(); }
public string GetAnswerA(bool animate = false) { var scrambler = new Scrambler(); return(scrambler.Scramble("abcdefgh", File.ReadAllLines("Day21_input.txt"))); }
public void SwapPositionWorks() { var scrambler = new Scrambler(); Assert.Equal("ebcda", scrambler.Scramble("abcde", new[] { SampleOps.Swap4With0 })); }
public void ScramblingWithSequenceWorks() { var scrambler = new Scrambler(); Assert.Equal("decab", scrambler.Scramble("abcde", SampleOps.Sequence)); }
public void ReverseWorks() { var scrambler = new Scrambler(); Assert.Equal("abcde", scrambler.Scramble("edcba", new[] { SampleOps.Reverse0Through4 })); }
public void SwapLetterWorks() { var scrambler = new Scrambler(); Assert.Equal("edcba", scrambler.Scramble("ebcda", new[] { SampleOps.SwapDWithB })); }