예제 #1
0
        public StashManager(
            IPlayerItemDao playerItemDao,
            IDatabaseItemStatDao dbItemStatDao,
            Action <string, string> setFeedback,
            Action performedLootCallback
            )
        {
            _playerItemDao         = playerItemDao;
            _itemSizeService       = new ItemSizeService(dbItemStatDao);
            _setFeedback           = setFeedback;
            _performedLootCallback = performedLootCallback;

            var path = GlobalPaths.SavePath;

            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                UpdateUnlooted(path);

                var pCrypto = new GDCryptoDataBuffer(DataBuffer.ReadBytesFromDisk(path));
                var stash   = new Stash();

                if (stash.Read(pCrypto))
                {
                    NumStashTabs = stash.Tabs.Count;
                }
            }
        }
예제 #2
0
        public TransferStashService(
            IPlayerItemDao playerItemDao,
            IDatabaseItemStatDao dbItemStatDao,
            Action <string, string, string> setFeedback,
            Action performedLootCallback
            )
        {
            _playerItemDao         = playerItemDao;
            _itemSizeService       = new ItemSizeService(dbItemStatDao);
            _setFeedback           = setFeedback;
            _performedLootCallback = performedLootCallback;

            // TODO: Should also check for transfer.gsh and pick whichever is newest / has the highest number
            var path = Path.Combine(GlobalPaths.SavePath, "transfer.gst");

            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                UpdateUnlooted(path);

                var pCrypto = new GDCryptoDataBuffer(DataBuffer.ReadBytesFromDisk(path));
                var stash   = new Stash();

                if (stash.Read(pCrypto))
                {
                    NumStashTabs = stash.Tabs.Count;
                }
            }
        }
예제 #3
0
        public TransferStashService(IDatabaseItemStatDao dbItemStatDao, SettingsService settings, SafeTransferStashWriter stashWriter)
        {
            _settings        = settings;
            _stashWriter     = stashWriter;
            _itemSizeService = new ItemSizeService(dbItemStatDao);

            // This is used to limit settings, just pick whichever is highest.
            NumStashTabs = Math.Max(
                GetNumTabsInStash(Path.Combine(GlobalPaths.SavePath, "transfer.gst")),
                GetNumTabsInStash(Path.Combine(GlobalPaths.SavePath, "transfer.gsh"))
                );
        }
예제 #4
0
        /// <summary>
        /// Load the item sizes for the given records
        /// </summary>
        /// <param name="baseRecords"></param>
        private void LoadItemSizes(IEnumerable <string> baseRecords)
        {
            var relevant = baseRecords.Where(m => !_itemShapeCache.Keys.Contains(m));
            var tmp      = _itemStatDao.MapItemBitmaps(relevant.ToList());

            foreach (var key in tmp.Keys)
            {
                var bitmap = $"{Path.GetFileName(tmp[key].Replace(".dbr", ".tex"))}.png";
                int h, w;
                ItemSizeService.MapItemSize(bitmap, out h, out w);

                _itemShapeCache[key] = new Shape {
                    Width  = w,
                    Height = h
                };
            }
        }
예제 #5
0
        public StashManager(IPlayerItemDao playerItemDao, IDatabaseItemStatDao dbItemStatDao)
        {
            _playerItemDao   = playerItemDao;
            _itemSizeService = new ItemSizeService(dbItemStatDao);
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "My Games",
                                       "Grim Dawn", "Save", "transfer.gst");

            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                UpdateUnlooted(path);

                GDCryptoDataBuffer pCrypto = new GDCryptoDataBuffer(DataBuffer.ReadBytesFromDisk(path));
                Stash stash = new Stash();
                if (stash.Read(pCrypto))
                {
                    NumStashTabs = stash.Tabs.Count;
                }
            }
        }
예제 #6
0
        public TransferStashService(IDatabaseItemStatDao dbItemStatDao, SettingsService settings, SafeTransferStashWriter stashWriter)
        {
            _settings        = settings;
            _stashWriter     = stashWriter;
            _itemSizeService = new ItemSizeService(dbItemStatDao);

            // TODO: Should also check for transfer.gsh and pick whichever is newest / has the highest number
            var path = Path.Combine(GlobalPaths.SavePath, "transfer.gst");

            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                var pCrypto = new GDCryptoDataBuffer(DataBuffer.ReadBytesFromDisk(path));
                var stash   = new Stash();

                if (stash.Read(pCrypto))
                {
                    NumStashTabs = stash.Tabs.Count;
                }
            }
        }
예제 #7
0
 public ItemSizeController(ItemSizeService _resturantItemSizeService)
 {
     resturantItemSizeService = _resturantItemSizeService;
 }