public void Load(XPathNavigator nav, string profileMainNodeName, ProfileItemPrivacyType profileItemPrivacyType) { var navPointer = nav.Select("/" + profileMainNodeName + "/Variables/Variable"); while (navPointer.MoveNext()) { var type = navPointer.Current.GetAttribute("Type", navPointer.Current.NamespaceURI); IVariable variable = null; if (type == "FsuipcVariable") { variable = new FsuipcVariable(); } if (type == "MemoryPatchVariable") { variable = new MemoryPatchVariable(); } if (type == "FakeVariable") { variable = new FakeVariable(); } if (variable != null) { variable.Load(navPointer.Current); (variable as VariableBase).SetPrivacyType(profileItemPrivacyType); StoreVariable(variable); } } }
private void SynchronizeMemoryPatchVariable(MemoryPatchVariable mpv) { var valueToSet = mpv.GetValueToSet(); if (valueToSet != null && valueToSet != mpv.GetValueInMemory()) { var writeVarResult = _memoryPatchMethodInstance.SetVariableValue(mpv.ModuleName, mpv.Offset, mpv.GetVariableSize(), (double)valueToSet); if (writeVarResult.Code == MemoryPatchVariableErrorCode.ModuleNotFound) { if (!_notFoundModules.Contains(mpv.ModuleName)) { _notFoundModules.Add(mpv.ModuleName); } Initialize(); return; } } var readVarResult = _memoryPatchMethodInstance.GetVariableValue(mpv.ModuleName, mpv.Offset, mpv.GetVariableSize()); if (readVarResult.Code == MemoryPatchVariableErrorCode.ModuleNotFound) { if (!_notFoundModules.Contains(mpv.ModuleName)) { _notFoundModules.Add(mpv.ModuleName); } Initialize(); } else { mpv.SetValueInMemory(readVarResult.Value); mpv.SetValueToSet(readVarResult.Value); } }
public MemoryPatchVariableEditor(IVariable variable) { _editableVariable = variable as MemoryPatchVariable; Initialize(); GetDataFromVariable(); }