Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public MemoryPatchVariableEditor(IVariable variable)
 {
     _editableVariable = variable as MemoryPatchVariable;
     Initialize();
     GetDataFromVariable();
 }