public FFXIVMemoryReader(Process process, FFXIVMemoryMap memMep) { if (process == null) { throw new ArgumentNullException(MethodBase.GetCurrentMethod().GetParameters()[0].Name); } if (memMep == null) { throw new ArgumentNullException(MethodBase.GetCurrentMethod().GetParameters()[1].Name); } this.process = process; this.memMep = memMep; if (!this.process.HasExited) { this.processHandel = NativeMethods.OpenProcess(ProcessAccessFlags.VirtualMemoryRead | ProcessAccessFlags.QueryInformation, false, this.process.Id); } }
private bool UpdateMemoryMap() { try { WebRequest request = HttpWebRequest.Create("https://raw.githubusercontent.com/InvisibleShield/FFXIV-Zodiac-Glass/master/MEMMAP"); using (Stream responseStream = request.GetResponse().GetResponseStream()) { XmlSerializer seri = new XmlSerializer(typeof(FFXIVMemoryMap)); FFXIVMemoryMap newMemMap = seri.Deserialize(responseStream) as FFXIVMemoryMap; if (newMemMap != null && !newMemMap.Equals(this.currentMemoryMap)) { this.currentMemoryMap = newMemMap; try { Settings.Default.MemoryMap = newMemMap; Settings.Default.Save(); this.log.Write(LogLevel.Info, "MemoryMap updated."); } catch (Exception ex) { this.log.WriteException("Saving new MemoryMap failed.", ex); } return true; } return false; } } catch (WebException ex) { this.log.WriteException("Updating MemoryMap failed.", ex); throw; } catch (Exception ex) { this.log.WriteException("Updating MemoryMap failed.", ex); return false; } }
private void LoadMemoryMap() { try { #if DEBUG this.currentMemoryMap = FFXIVMemoryMap.Default; #else this.currentMemoryMap = Settings.Default.MemoryMap ?? FFXIVMemoryMap.Default; #endif } catch (Exception ex) { this.log.WriteException("Reading MemoryMap failed.", ex); this.currentMemoryMap = FFXIVMemoryMap.Default; } }
public override bool Equals(object obj) { FFXIVMemoryMap other = obj as FFXIVMemoryMap; return(other != null && this.ItemSetPointer.Equals(other.ItemSetPointer)); }