示例#1
0
        void InitializeDataReader()
        {
            var memoryTableFactory = new GameMemoryTableFactory();

            dataReader = new D2DataReader(memoryTableFactory);
            dataReader.CharacterCreated += OnCharacterCreated;
            dataReader.DataRead         += OnDataRead;
        }
示例#2
0
        void InitializeDataReader()
        {
            var memoryTableFactory = new GameMemoryTableFactory();

            dataReader = new D2DataReader(memoryTableFactory, this.settingsService.CurrentSettings.ProcessDescriptions);
            dataReader.CharacterCreated += OnCharacterCreated;
            dataReader.DataRead         += OnDataRead;
        }
示例#3
0
 private void OnWindowDisposed(object sender, EventArgs e)
 {
     // Make sure the process handles close correctly.
     if (dataReader != null)
     {
         dataReader.Dispose();
         dataReader = null;
     }
 }
        public static List <ItemInfo> GetItemsByLocations(D2DataReader dataReader, List <BodyLocation> locations)
        {
            List <ItemInfo> Items = new List <ItemInfo>();

            dataReader.ItemSlotAction(locations, (itemReader, item) => {
                Items.Add(new ItemInfo(itemReader, item));
            });
            return(Items);
        }
示例#5
0
        public ItemServer(D2DataReader dataReader, string pipeName)
        {
            this.dataReader = dataReader;
            this.pipeName   = pipeName;

            listenThread = new Thread(new ThreadStart(ServerListen));
            listenThread.IsBackground = true;
            listenThread.Start();
        }
示例#6
0
        internal static List <ItemInfo> GetItemsByItems(D2DataReader dataReader, IEnumerable <Item> items)
        {
            List <ItemInfo> Items = new List <ItemInfo>();

            dataReader.ItemAction(items, (item, player, unitReader, stringReader, inventoryReader) => {
                Items.Add(new ItemInfo(item, player, unitReader, stringReader, inventoryReader));
            });
            return(Items);
        }
示例#7
0
        public static List <ItemInfo> GetItemsByLocations(D2DataReader dataReader, List <BodyLocation> locations)
        {
            List <ItemInfo> Items = new List <ItemInfo>();

            dataReader.ItemSlotAction(locations, (item, player, unitReader, stringReader, inventoryReader) => {
                Items.Add(new ItemInfo(item, player, unitReader, stringReader, inventoryReader));
            });
            return(Items);
        }
        public HttpClientService(GameService gameService, SettingsService settingsService)
        {
            this.gameService = gameService;
            dataReader       = gameService.DataReader;

            settingsService.SettingsChanged += (object sender, ApplicationSettingsEventArgs args) =>
            {
                Init(args.Settings);
            };

            Init(settingsService.CurrentSettings);
        }
示例#9
0
        public void Initialize()
        {
            Logger.Info("Initializing game service.");

            DataReader = new D2DataReader(
                new GameMemoryTableFactory(),
                di.configService.CurrentConfig.ProcessDescriptions
                );
            DataReader.DataRead += OnDataRead;

            Logger.Info("Initializing data reader thread.");
            new Thread(DataReader.RunReadOperation)
            {
                IsBackground = true
            }.Start();
        }
示例#10
0
        public GameService(ISettingsService settingsService)
        {
            Logger.Info("Initializing game service.");

            DataReader = new D2DataReader(
                new GameMemoryTableFactory(),
                settingsService.CurrentSettings.ProcessDescriptions
                );
            DataReader.CharacterCreated += OnCharacterCreated;
            DataReader.DataRead         += OnDataRead;

            Logger.Info("Initializing data reader thread.");
            new Thread(DataReader.RunReadOperation)
            {
                IsBackground = true
            }.Start();
        }
示例#11
0
        private void initialize()
        {
            try
            {
                Settings = LoadSettings();
            }
            catch (Exception e)
            {
                // Log error and show error message.
                Logger.Instance.WriteLine("Unhandled Settings Error:\n{0}", e.ToString());
                MessageBox.Show("An unhandled exception was caught trying to load the settings.\nPlease report the error and include the log found in the log folder.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                // Rethrow current exception.
                throw;
            }

            if (dataReader == null)
            {
                var memoryTable = GetVersionMemoryTable(Settings.D2Version);
                dataReader = new D2DataReader(this, memoryTable);
                itemServer = new ItemServer(dataReader, ItemServerPipeName);
            }

            if (dataReaderThread == null)
            {
                dataReaderThread = new Thread(dataReader.readDataThreadFunc);
                dataReaderThread.IsBackground = true;
                dataReaderThread.Start();
            }

            if (Settings.CheckUpdates)
            {
                VersionChecker.CheckForUpdate(false);
            }

            ApplySettings(Settings);
        }
示例#12
0
        protected virtual void Dispose(bool disposing)
        {
            if (isDisposed)
            {
                return;
            }

            Logger.Info("GameService disposed.");

            if (disposing)
            {
                if (dataReader != null)
                {
                    dataReader.DataRead         -= OnDataRead;
                    dataReader.CharacterCreated -= OnCharacterCreated;

                    dataReader.Dispose();
                    dataReader = null;
                }
            }

            isDisposed = true;
        }
 public CompletedQuestsRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader;
 }
示例#14
0
 public AllItemsRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader ?? throw new ArgumentNullException(nameof(dataReader));
 }
 public HirelingRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader;
 }
 public GameRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader;
 }
示例#17
0
 public ItemRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader;
 }
示例#18
0
 public CharacterRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader;
 }
示例#19
0
 public CompletedQuestsRequestHandler(D2DataReader dataReader)
 {
     this.dataReader = dataReader ?? throw new ArgumentNullException(nameof(dataReader));
 }