private static void Move_Memory(bool rightwards) { Config.Stream.Suspend(); int multiplicity = KeyboardUtilities.GetCurrentlyInputtedNumber() ?? 1; List <List <uint> > processGroups = GetProcessGroups(); Dictionary <uint, ObjectSnapshot> objectSnapshots = new Dictionary <uint, ObjectSnapshot>(); List <uint> selectedAddresses = Config.ObjectSlotsManager.SelectedObjects.ConvertAll(obj => obj.Address); for (int i = 0; i < multiplicity; i++) { List <uint> newSelectedAddresses = new List <uint>(); selectedAddresses.Sort((uint objAddress1, uint objAddress2) => { int multiplier = rightwards ? -1 : +1; int diff = objAddress1.CompareTo(objAddress2); return(multiplier * diff); }); foreach (uint address in selectedAddresses) { Move_Memory(address, rightwards, processGroups, objectSnapshots, newSelectedAddresses); } selectedAddresses.Clear(); selectedAddresses.AddRange(newSelectedAddresses); } ApplyProcessGroups(processGroups); foreach (uint address in objectSnapshots.Keys) { ObjectSnapshot objectSnapshot = objectSnapshots[address]; objectSnapshot.Apply(address, false); } Config.ObjectSlotsManager.SelectAddresses(selectedAddresses); Config.Stream.Resume(); }
private static void SwapObjects(uint objAddress1, uint objAddress2, Dictionary <uint, ObjectSnapshot> objectSnapshots) { ObjectSnapshot obj1 = objectSnapshots.ContainsKey(objAddress1) ? objectSnapshots[objAddress1] : new ObjectSnapshot(objAddress1); ObjectSnapshot obj2 = objectSnapshots.ContainsKey(objAddress2) ? objectSnapshots[objAddress2] : new ObjectSnapshot(objAddress2); objectSnapshots[objAddress1] = obj2; objectSnapshots[objAddress2] = obj1; }