コード例 #1
0
        private bool UpdateMemoryMap()
        {
            try
            {
                WebRequest request = HttpWebRequest.Create("https://raw.githubusercontent.com/monster1991/FFXIV-Zodiac-Glass/gh-pages/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, "BaseAddress[0] : " + this.currentMemoryMap.ItemSetPointer.BaseAddressOffset[0].ToString());
                            this.log.Write(LogLevel.Info, "BaseAddress[1] : " + this.currentMemoryMap.ItemSetPointer.BaseAddressOffset[1].ToString());
                            this.log.Write(LogLevel.Info, "Offsets[0] : " + this.currentMemoryMap.ItemSetPointer.Offsets[0].ToString());
                            this.log.Write(LogLevel.Info, "Offsets[1] : " + this.currentMemoryMap.ItemSetPointer.Offsets[1].ToString());
                            this.log.Write(LogLevel.Info, "Offsets[2] : " + this.currentMemoryMap.ItemSetPointer.Offsets[2].ToString());
                            this.log.Write(LogLevel.Info, "Offsets[3] : " + this.currentMemoryMap.ItemSetPointer.Offsets[3].ToString());
                            this.log.Write(LogLevel.Info, "MemoryMap updated.");
                        }
                        catch (Exception ex)
                        {
                            this.log.WriteException("Saving new MemoryMap failed.", ex);
                        }
                    }
                }
                return(true);
            }
            catch (WebException ex)
            {
                this.log.WriteException("Updating MemoryMap failed.", ex);
                throw;
            }
            catch (Exception ex)
            {
                this.log.WriteException("Updating MemoryMap failed.", ex);
                return(false);
            }
        }
コード例 #2
0
        private bool UpdateMemoryMap()
        {
            try
            {
                WebRequest request = HttpWebRequest.Create("https://raw.githubusercontent.com/MartinKuschnik/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);
            }
        }