Esempio n. 1
0
        private void TimerTickLookForGrimDawn(object sender, EventArgs e)
        {
            System.Windows.Forms.Timer timer = sender as System.Windows.Forms.Timer;
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "DetectGrimDawnTimer";
            }

            string gdPath = GrimDawnDetector.GetGrimLocation();

            if (!string.IsNullOrEmpty(gdPath) && Directory.Exists(gdPath))
            {
                timer?.Stop();

                // Attempt to force a database update
                foreach (Control c in modsPanel.Controls)
                {
                    ModsDatabaseConfig config = c as ModsDatabaseConfig;
                    if (config != null)
                    {
                        config.ForceDatabaseUpdate(gdPath, string.Empty);
                        break;
                    }
                }

                Logger.InfoFormat("Found Grim Dawn at {0}", gdPath);
            }
        }
Esempio n. 2
0
        private void buttonLanguageSelect_Click(object sender, EventArgs e)
        {
            new LanguagePackPicker(_itemTagDao, _playerItemDao, GrimDawnDetector.GetGrimLocations(), _parsingService)
            .ShowDialog();

            _itemViewUpdateTrigger?.Invoke();
        }
Esempio n. 3
0
        public SettingsWindow(
            CefBrowserHandler cefBrowserHandler,
            TooltipHelper tooltipHelper,
            Action itemViewUpdateTrigger,
            IPlayerItemDao playerItemDao,
            GDTransferFile[] modFilter,
            TransferStashService transferStashService,
            LanguagePackPicker languagePackPicker,
            SettingsService settings, GrimDawnDetector grimDawnDetector)
        {
            InitializeComponent();
            _controller                 = new SettingsController(settings);
            this._cefBrowserHandler     = cefBrowserHandler;
            this._tooltipHelper         = tooltipHelper;
            this._itemViewUpdateTrigger = itemViewUpdateTrigger;
            this._playerItemDao         = playerItemDao;
            this._modFilter             = modFilter;
            this._transferStashService  = transferStashService;
            _languagePackPicker         = languagePackPicker;
            _settings         = settings;
            _grimDawnDetector = grimDawnDetector;

            _controller.BindCheckbox(cbMinimizeToTray);

            _controller.BindCheckbox(cbMergeDuplicates);
            _controller.BindCheckbox(cbTransferAnyMod);
            _controller.BindCheckbox(cbSecureTransfers);
            _controller.BindCheckbox(cbShowRecipesAsItems);
            _controller.BindCheckbox(cbAutoUpdateModSettings);
            _controller.BindCheckbox(cbDisplaySkills);
            _controller.LoadDefaults();
        }
Esempio n. 4
0
 public ModsDatabaseConfig(
     Action itemViewUpdateTrigger,
     IPlayerItemDao playerItemDao,
     ParsingService parsingService,
     IDatabaseSettingDao databaseSettingRepo, GrimDawnDetector grimDawnDetector)
 {
     InitializeComponent();
     _itemViewUpdateTrigger       = itemViewUpdateTrigger;
     _playerItemDao               = playerItemDao;
     _parsingService              = parsingService;
     _databaseSettingRepo         = databaseSettingRepo;
     _grimDawnDetector            = grimDawnDetector;
     _databaseModSelectionService = new DatabaseModSelectionService();
 }
Esempio n. 5
0
        private void buttonSelect_Click(object sender, EventArgs e)
        {
            // find selected checkbox
            // if selected != Properties.Settings.Default.LocalizationFile
            var cb = Checkboxes.Where(m => m.Checked).FirstOrDefault();

            if (cb != null)
            {
                var package = cb.Tag.ToString();
                if (package != Properties.Settings.Default.LocalizationFile)
                {
                    Properties.Settings.Default.LocalizationFile = package;
                    Properties.Settings.Default.Save();

                    if (!string.IsNullOrEmpty(Properties.Settings.Default.LocalizationFile))
                    {
                        var loader = new LocalizationLoader();
                        GlobalSettings.Language = loader.LoadLanguage(package);

                        // TODO: Grab tags from loader and save to sql
                        databaseItemDao.Save(loader.GetItemTags());

                        UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(playerItemDao);
                        x.ShowDialog();
                    }
                    // Load the GD one
                    else
                    {
                        // Override timestamp to force an update
                        GlobalSettings.Language = new EnglishLanguage();

                        string location = GrimDawnDetector.GetGrimLocation();
                        if (!string.IsNullOrEmpty(location) && Directory.Exists(location))
                        {
                            ParsingDatabaseScreen parserUi = new ParsingDatabaseScreen(databaseSettingDao, this.parser, location, string.Empty, true, true);
                            parserUi.ShowDialog();
                        }
                        else
                        {
                            logger.Warn("Could not find the Grim Dawn install location");
                        }

                        // Update item stats as well
                        UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(playerItemDao);
                        x.ShowDialog();
                    }
                }
            }
            this.Close();
        }
Esempio n. 6
0
        private void ModsDatabaseConfig_Load(object sender, EventArgs e)
        {
            Dock = DockStyle.Fill;

            var paths = GrimDawnDetector.GetGrimLocations();

            if (paths.Count == 0)
            {
                listViewInstalls.Enabled  = false;
                buttonForceUpdate.Enabled = false;
            }
            else
            {
                UpdateListView(paths);
            }

            buttonForceUpdate.Enabled = listViewInstalls.SelectedItems.Count > 0;
        }
Esempio n. 7
0
 public MainWindow(
     CefBrowserHandler browser,
     IDatabaseItemDao databaseItemDao,
     IDatabaseItemStatDao databaseItemStatDao,
     IPlayerItemDao playerItemDao,
     IAzurePartitionDao azurePartitionDao,
     IDatabaseSettingDao databaseSettingDao,
     IBuddyItemDao buddyItemDao,
     IBuddySubscriptionDao buddySubscriptionDao,
     IRecipeItemDao recipeItemDao,
     IItemSkillDao itemSkillDao,
     IItemTagDao itemTagDao,
     ParsingService parsingService,
     AugmentationItemRepo augmentationItemRepo,
     SettingsService settingsService,
     GrimDawnDetector grimDawnDetector,
     IItemCollectionDao itemCollectionRepo
     )
 {
     _cefBrowserHandler = browser;
     InitializeComponent();
     FormClosing            += MainWindow_FormClosing;
     _automaticUpdateChecker = new AutomaticUpdateChecker(settingsService);
     _settingsController     = new SettingsController(settingsService);
     _dynamicPacker          = new DynamicPacker(databaseItemStatDao);
     _databaseItemDao        = databaseItemDao;
     _databaseItemStatDao    = databaseItemStatDao;
     _playerItemDao          = playerItemDao;
     _azurePartitionDao      = azurePartitionDao;
     _databaseSettingDao     = databaseSettingDao;
     _buddyItemDao           = buddyItemDao;
     _buddySubscriptionDao   = buddySubscriptionDao;
     _recipeParser           = new RecipeParser(recipeItemDao);
     _itemSkillDao           = itemSkillDao;
     _itemTagDao             = itemTagDao;
     _parsingService         = parsingService;
     _augmentationItemRepo   = augmentationItemRepo;
     _userFeedbackService    = new UserFeedbackService(_cefBrowserHandler);
     _settingsService        = settingsService;
     _grimDawnDetector       = grimDawnDetector;
     _itemCollectionRepo     = itemCollectionRepo;
 }
Esempio n. 8
0
        public SettingsWindow(
            CefBrowserHandler cefBrowserHandler,
            TooltipHelper tooltipHelper,
            Action itemViewUpdateTrigger,
            IPlayerItemDao playerItemDao,
            GDTransferFile[] modFilter,
            TransferStashService transferStashService,
            TransferStashService2 transferStashService2,
            LanguagePackPicker languagePackPicker,
            SettingsService settings, GrimDawnDetector grimDawnDetector, DarkMode darkModeToggler, AutomaticUpdateChecker automaticUpdateChecker)
        {
            InitializeComponent();
            _controller                 = new SettingsController(settings);
            this._cefBrowserHandler     = cefBrowserHandler;
            this._tooltipHelper         = tooltipHelper;
            this._itemViewUpdateTrigger = itemViewUpdateTrigger;
            this._playerItemDao         = playerItemDao;
            this._modFilter             = modFilter;
            this._transferStashService  = transferStashService;
            this._transferStashService2 = transferStashService2;
            _languagePackPicker         = languagePackPicker;
            _settings               = settings;
            _grimDawnDetector       = grimDawnDetector;
            _darkModeToggler        = darkModeToggler;
            _automaticUpdateChecker = automaticUpdateChecker;

            _controller.BindCheckbox(cbMinimizeToTray);

            _controller.BindCheckbox(cbTransferAnyMod);
            _controller.BindCheckbox(cbSecureTransfers);
            _controller.BindCheckbox(cbShowRecipesAsItems);
            _controller.BindCheckbox(cbHideSkills);
            _controller.LoadDefaults();

            // TODO: Write out the settingscontroller and add logic for updating showskills config

            linkCheckForUpdates.Visible = Environment.Is64BitOperatingSystem;
            pbAutomaticUpdates.Visible  = Environment.Is64BitOperatingSystem;
        }
Esempio n. 9
0
        /// <summary>
        /// Sets the "last database update" timestamp to 0 to force an update
        /// Queues a database update, followed by an item stat update.
        /// </summary>
        public void ForceDatabaseUpdate(string location, bool isVanilla)
        {
            // Override timestamp to force an update
            _databaseSettingDao.UpdateDatabaseTimestamp(0);

            var paths = GrimDawnDetector.GetGrimLocations();

            if (!string.IsNullOrEmpty(location) && Directory.Exists(location) && _arzParser.NeedUpdate(location))
            {
                ParsingDatabaseScreen parser = new ParsingDatabaseScreen(
                    _databaseSettingDao,
                    _arzParser,
                    location,
                    Properties.Settings.Default.LocalizationFile,
                    false,
                    !isVanilla);
                parser.ShowDialog();

                //databaseSettingDao.UpdateCurrentDatabase(location);
                UpdateListview(paths);
            }
            else
            {
                Logger.Warn("Could not find the Grim Dawn install location");
            }

            // Update item stats as well
            UpdatingPlayerItemsScreen x = new UpdatingPlayerItemsScreen(_playerItemDao);

            x.ShowDialog();


            if (_itemViewUpdateTrigger != null)
            {
                _itemViewUpdateTrigger();
            }
        }
Esempio n. 10
0
        private void SettingsWindow_Load(object sender, EventArgs e)
        {
            this.Dock = DockStyle.Fill;



            this.labelNumItems.Text = string.Format("Number of items parsed from Grim Dawn database: {0}", _itemDao.GetRowCount());

            // TODO:
            string   filename     = GrimDawnDetector.GetGrimLocation();
            string   databaseFile = Path.Combine(filename, "database", "database.arz");
            DateTime lastPatch    = default(DateTime);

            if (File.Exists(databaseFile))
            {
                lastPatch = System.IO.File.GetLastWriteTime(databaseFile);
                this.labelLastPatch.Text = string.Format("Last Grim Dawn patch: {0}", lastPatch.ToString("dd/MM/yyyy"));
            }
            else
            {
                this.labelLastPatch.Text = "Could not find Grim Dawn install folder";
            }

            DateTime lastUpdate = new DateTime(_settingsDao.GetLastDatabaseUpdate());

            this.labelLastUpdated.Text = string.Format("Grim Dawn database last updated: {0}", lastUpdate.ToString("dd/MM/yyyy"));
            if (lastUpdate < lastPatch)
            {
                this.labelLastUpdated.ForeColor = Color.Red;
            }


            radioBeta.Checked        = (bool)Properties.Settings.Default.SubscribeExperimentalUpdates;
            radioRelease.Checked     = !(bool)Properties.Settings.Default.SubscribeExperimentalUpdates;
            firefoxCheckBox1.Checked = Properties.Settings.Default.Hotfix1_0_4_0_active;
            //controller.LoadDefaults();
        }
Esempio n. 11
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "UI";
            }

            ExceptionReporter.EnableLogUnhandledOnThread();
            SizeChanged += OnMinimizeWindow;

            _stashManager = new StashManager(_playerItemDao, _databaseItemStatDao, SetFeedback, ListviewUpdateTrigger);
            _stashFileMonitor.OnStashModified += (_, __) => {
                StashEventArg args = __ as StashEventArg;
                if (_stashManager != null && _stashManager.TryLootStashFile(args?.Filename))
                {
                    // STOP TIMER
                    _stashFileMonitor.CancelQueuedNotify();
                } // TODO: This logic should be changed to 're queue' but only trigger once, if its slow it triggers multiple times.
            };

            if (!_stashFileMonitor.StartMonitorStashfile(GlobalPaths.SavePath))
            {
                MessageBox.Show("Ooops!\nIt seems you are synchronizing your saves to steam cloud..\nThis tool is unfortunately not compatible.\n");
                Process.Start("http://www.grimdawn.com/forums/showthread.php?t=20752");

                if (!Debugger.IsAttached)
                {
                    Close();
                }
            }

            // Chicken and the egg..
            SearchController searchController = new SearchController(
                _databaseItemDao,
                _playerItemDao,
                _databaseItemStatDao,
                _itemSkillDao,
                _buddyItemDao,
                _stashManager,
                _augmentationItemRepo
                );

            _cefBrowserHandler.InitializeChromium(searchController.JsBind, Browser_IsBrowserInitializedChanged);
            searchController.Browser             = _cefBrowserHandler;
            searchController.JsBind.OnClipboard += SetItemsClipboard;

            // Load the grim database
            string gdPath = GrimDawnDetector.GetGrimLocation();

            if (!string.IsNullOrEmpty(gdPath))
            {
            }
            else
            {
                Logger.Warn("Could not find the Grim Dawn install location");
                statusLabel.Text = "Could not find the Grim Dawn install location";

                var timer = new System.Windows.Forms.Timer();
                timer.Tick    += TimerTickLookForGrimDawn;
                timer.Interval = 10000;
                timer.Start();
            }

            // Load recipes
            foreach (string file in GlobalPaths.FormulasFiles)
            {
                if (!string.IsNullOrEmpty(file))
                {
                    bool isHardcore = file.EndsWith("gsh");
                    Logger.InfoFormat("Reading recipes at \"{0}\", IsHardcore={1}", file, isHardcore);
                    _recipeParser.UpdateFormulas(file, isHardcore);
                }
            }

            var addAndShow = UIHelper.AddAndShow;

            // Create the tab contents
            _buddySettingsWindow = new BuddySettings(delegate(bool b) { BuddySyncEnabled = b; },
                                                     _buddyItemDao,
                                                     _buddySubscriptionDao
                                                     );

            addAndShow(_buddySettingsWindow, buddyPanel);

            _authAuthService = new AzureAuthService(_cefBrowserHandler, new AuthenticationProvider());
            var backupSettings = new BackupSettings(_playerItemDao, _authAuthService);

            addAndShow(backupSettings, backupPanel);
            addAndShow(new ModsDatabaseConfig(DatabaseLoadedTrigger, _playerItemDao, _parsingService), modsPanel);
            addAndShow(new HelpTab(), panelHelp);
            addAndShow(new LoggingWindow(), panelLogging);
            var backupService = new BackupService(_authAuthService, _playerItemDao, _azurePartitionDao, () => Settings.Default.UsingDualComputer);

            _backupServiceWorker            = new BackupServiceWorker(backupService);
            backupService.OnUploadComplete += (o, args) => _searchWindow.UpdateListView();
            searchController.OnSearch      += (o, args) => backupService.OnSearch();

            _searchWindow = new SplitSearchWindow(_cefBrowserHandler.BrowserControl, SetFeedback, _playerItemDao, searchController, _itemTagDao);
            addAndShow(_searchWindow, searchPanel);
            _stashManager.StashUpdated += (_, __) => {
                _searchWindow.UpdateListView();
            };

            addAndShow(
                new SettingsWindow(
                    _cefBrowserHandler,
                    _itemTagDao,
                    _tooltipHelper,
                    ListviewUpdateTrigger,
                    _databaseSettingDao,
                    _playerItemDao,
                    _arzParser,
                    _searchWindow.ModSelectionHandler.GetAvailableModSelection(),
                    _stashManager,
                    _parsingService
                    ),
                settingsPanel);

            new StashTabPicker(_stashManager.NumStashTabs).SaveStashSettingsToRegistry();

#if !DEBUG
            ThreadPool.QueueUserWorkItem(m => ExceptionReporter.ReportUsage());
            CheckForUpdates();
#endif

            int min  = 1000 * 60;
            int hour = 60 * min;
            _timerReportUsage = new Timer();
            _timerReportUsage.Start();
            _timerReportUsage.Elapsed += (a1, a2) => {
                if (Thread.CurrentThread.Name == null)
                {
                    Thread.CurrentThread.Name = "ReportUsageThread";
                }
                ReportUsage();
            };
            _timerReportUsage.Interval  = 12 * hour;
            _timerReportUsage.AutoReset = true;
            _timerReportUsage.Start();

            Shown += (_, __) => { StartInjector(); };

            //settingsController.Data.budd
            BuddySyncEnabled = (bool)Settings.Default.BuddySyncEnabled;

            // Start the backup task
            _backupBackgroundTask = new BackgroundTask(new FileBackup(_playerItemDao));

            LocalizationLoader.ApplyLanguage(Controls, GlobalSettings.Language);
            EasterEgg.Activate(this);

            // Initialize the "stash packer" used to find item positions for transferring items ingame while the stash is open
            {
                _dynamicPacker.Initialize(8, 16);

                var transferFiles = GlobalPaths.TransferFiles;
                if (transferFiles.Count > 0)
                {
                    var file  = transferFiles.MaxBy(m => m.LastAccess);
                    var stash = StashManager.GetStash(file.Filename);
                    if (stash != null)
                    {
                        _dynamicPacker.Initialize(stash.Width, stash.Height);
                        if (stash.Tabs.Count >= 3)
                        {
                            foreach (var item in stash.Tabs[2].Items)
                            {
                                byte[] bx = BitConverter.GetBytes(item.XOffset);
                                uint   x  = (uint)BitConverter.ToSingle(bx, 0);

                                byte[] by = BitConverter.GetBytes(item.YOffset);
                                uint   y  = (uint)BitConverter.ToSingle(by, 0);

                                _dynamicPacker.Insert(item.BaseRecord, item.Seed, x, y);
                            }
                        }
                    }
                }
            }

            _messageProcessors.Add(new ItemPositionFinder(_dynamicPacker));
            _messageProcessors.Add(new PlayerPositionTracker());
            _messageProcessors.Add(new StashStatusHandler());
            _messageProcessors.Add(new ItemReceivedProcessor(_searchWindow, _stashFileMonitor, _playerItemDao));
            _messageProcessors.Add(new ItemInjectCallbackProcessor(_searchWindow.UpdateListViewDelayed, _playerItemDao));
            _messageProcessors.Add(new ItemSpawnedProcessor());
            _messageProcessors.Add(new CloudDetectorProcessor(SetFeedback));
            _messageProcessors.Add(new GenericErrorHandler());
            //messageProcessors.Add(new LogMessageProcessor());
#if DEBUG
            //messageProcessors.Add(new DebugMessageProcessor());
#endif

            GlobalSettings.StashStatusChanged += GlobalSettings_StashStatusChanged;

            _transferController = new ItemTransferController(
                _cefBrowserHandler,
                SetFeedback,
                SetTooltipAtmouse,
                _settingsController,
                _searchWindow,
                _dynamicPacker,
                _playerItemDao,
                _stashManager,
                new ItemStatService(_databaseItemStatDao, _itemSkillDao)
                );
            Application.AddMessageFilter(new MousewheelMessageFilter());


            var titleTag = GlobalSettings.Language.GetTag("iatag_ui_itemassistant");
            if (!string.IsNullOrEmpty(titleTag))
            {
                this.Text += $" - {titleTag}";
            }


            // Popup login diag
            if (_authAuthService.CheckAuthentication() == AzureAuthService.AccessStatus.Unauthorized)
            {
                var t = new System.Windows.Forms.Timer {
                    Interval = 100
                };
                t.Tick += (o, args) => {
                    if (_cefBrowserHandler.BrowserControl.IsBrowserInitialized)
                    {
                        _authAuthService.Authenticate();
                        t.Stop();
                    }
                };
                t.Start();
            }


            _cefBrowserHandler.TransferSingleRequested += TransferSingleItem;
            _cefBrowserHandler.TransferAllRequested    += TransferAllItems;
            new WindowSizeManager(this);
        }
Esempio n. 12
0
        private void MainWindow_Load(object sender, EventArgs e) {
            if (Thread.CurrentThread.Name == null)
                Thread.CurrentThread.Name = "UI";


            ExceptionReporter.EnableLogUnhandledOnThread();
            SizeChanged += OnMinimizeWindow;

            buttonDevTools.Visible = Debugger.IsAttached;


            _stashManager = new StashManager(_playerItemDao, _databaseItemStatDao);
            if (!_stashManager.StartMonitorStashfile(SetFeedback, ListviewUpdateTrigger)) {
                MessageBox.Show("Ooops!\nIt seems you are synchronizing your saves to steam cloud..\nThis tool is unfortunately not compatible.\n");
                Process.Start("http://www.grimdawn.com/forums/showthread.php?t=20752");

                if (!Debugger.IsAttached)
                    Close();

            }

            //ItemHtmlWriter.Write(new List<PlayerHeldItem>());

            // Chicken and the egg..
            SearchController searchController = new SearchController(
                _databaseItemDao,
                _playerItemDao, 
                _databaseItemStatDao, 
                _itemSkillDao, 
                _buddyItemDao,
                _stashManager
                );
            _cefBrowserHandler.InitializeChromium(searchController.JsBind, Browser_IsBrowserInitializedChanged);
            searchController.Browser = _cefBrowserHandler;
            searchController.JsBind.OnTransfer += TransferItem;
            searchController.JsBind.OnClipboard += SetItemsClipboard;

            // Load the grim database
            string gdPath = GrimDawnDetector.GetGrimLocation();
            if (!string.IsNullOrEmpty(gdPath)) {
            } else {
                Logger.Warn("Could not find the Grim Dawn install location");
                statusLabel.Text = "Could not find the Grim Dawn install location";

                var timer = new System.Windows.Forms.Timer();
                timer.Tick += TimerTickLookForGrimDawn;
                timer.Interval = 10000;
                timer.Start();
            }

    

            var addAndShow = UIHelper.AddAndShow;


            // Create the tab contents
            _buddySettingsWindow = new BuddySettings(delegate (bool b) { BuddySyncEnabled = b; }, 
                _buddyItemDao, 
                _buddySubscriptionDao
                );

            addAndShow(_buddySettingsWindow, buddyPanel);

            var backupSettings = new BackupSettings(EnableOnlineBackups, _playerItemDao);
            tabControl1.Selected += ((s, ev) => {
                if (ev.TabPage == tabPageBackups)
                    backupSettings?.BackupSettings_GotFocus();
            });
            addAndShow(backupSettings, backupPanel);
            addAndShow(new ModsDatabaseConfig(DatabaseLoadedTrigger, _databaseSettingDao, _arzParser, _playerItemDao), modsPanel);
            addAndShow(new HelpTab(), panelHelp);            
            addAndShow(new LoggingWindow(), panelLogging);


            _searchWindow = new SearchWindow(_cefBrowserHandler.BrowserControl, SetFeedback, _playerItemDao, searchController, _databaseItemDao);
            addAndShow(_searchWindow, searchPanel);


            addAndShow(
                new SettingsWindow(_tooltipHelper,
                    ListviewUpdateTrigger,
                    _databaseSettingDao,
                    _databaseItemDao,
                    _playerItemDao,
                    _arzParser,
                    _searchWindow.ModSelectionHandler.GetAvailableModSelection(),
                    _stashManager
                ),
                settingsPanel);


            new StashTabPicker(_stashManager.NumStashTabs).SaveStashSettingsToRegistry();

#if !DEBUG
            ThreadPool.QueueUserWorkItem(m => ExceptionReporter.ReportUsage());
            CheckForUpdates();
#endif

            int min = 1000 * 60;
            int hour = 60 * min;
            _timerReportUsage = new Timer();
            _timerReportUsage.Start();
            _timerReportUsage.Elapsed += (a1, a2) => {
                if (Thread.CurrentThread.Name == null)
                    Thread.CurrentThread.Name = "ReportUsageThread";
                ReportUsage();
            };
            _timerReportUsage.Interval = 12 * hour;
            _timerReportUsage.AutoReset = true;
            _timerReportUsage.Start();


            Shown += (_, __) => { StartInjector(); };

            //settingsController.Data.budd
            BuddySyncEnabled = (bool)Settings.Default.BuddySyncEnabled;

            // Start the backup task
            _backupBackgroundTask = new BackgroundTask(new CloudBackup(_playerItemDao));



            LocalizationLoader.ApplyLanguage(Controls, GlobalSettings.Language);
            EasterEgg.Activate(this);
Esempio n. 13
0
        public static ServiceProvider Initialize(ThreadExecuter threadExecuter, SqlDialect dialect)
        {
            Logger.Debug("Creating services");
            var factory = new SessionFactory(dialect);

            // Settings should be upgraded early, it contains the language pack etc and some services depends on settings.
            var settingsService  = StartupService.LoadSettingsService();
            var grimDawnDetector = new GrimDawnDetector(settingsService);

            IPlayerItemDao        playerItemDao;
            IDatabaseItemDao      databaseItemDao;
            IDatabaseSettingDao   databaseSettingDao;
            IDatabaseItemStatDao  databaseItemStatDao;
            IItemTagDao           itemTagDao;
            IBuddyItemDao         buddyItemDao;
            IBuddySubscriptionDao buddySubscriptionDao;
            IRecipeItemDao        recipeItemDao;
            IItemSkillDao         itemSkillDao;
            IAugmentationItemDao  augmentationItemRepo;
            IItemCollectionDao    itemCollectionRepo;

            if (dialect == SqlDialect.Sqlite)
            {
                playerItemDao        = new PlayerItemRepo(threadExecuter, factory, dialect);
                databaseItemDao      = new DatabaseItemRepo(threadExecuter, factory, dialect);
                databaseSettingDao   = new DatabaseSettingRepo(threadExecuter, factory, dialect);
                databaseItemStatDao  = new DatabaseItemStatRepo(threadExecuter, factory, dialect);
                itemTagDao           = new ItemTagRepo(threadExecuter, factory, dialect);
                buddyItemDao         = new BuddyItemRepo(threadExecuter, factory, dialect);
                buddySubscriptionDao = new BuddySubscriptionRepo(threadExecuter, factory, dialect);
                recipeItemDao        = new RecipeItemRepo(threadExecuter, factory, dialect);
                itemSkillDao         = new ItemSkillRepo(threadExecuter, factory);
                augmentationItemRepo = new AugmentationItemRepo(threadExecuter, factory, new DatabaseItemStatDaoImpl(factory, dialect), dialect);
                itemCollectionRepo   = new ItemCollectionRepo(threadExecuter, factory, dialect);
            }
            else
            {
                databaseItemStatDao  = new DatabaseItemStatDaoImpl(factory, dialect);
                playerItemDao        = new PlayerItemDaoImpl(factory, databaseItemStatDao, dialect);
                databaseItemDao      = new DatabaseItemDaoImpl(factory, dialect);
                databaseSettingDao   = new DatabaseSettingDaoImpl(factory, dialect);
                itemTagDao           = new ItemTagDaoImpl(factory, dialect);
                buddyItemDao         = new BuddyItemDaoImpl(factory, databaseItemStatDao, dialect);
                buddySubscriptionDao = new BuddySubscriptionDaoImpl(factory, dialect);
                recipeItemDao        = new RecipeItemDaoImpl(factory, dialect);
                itemSkillDao         = new ItemSkillDaoImpl(factory);
                augmentationItemRepo = new AugmentationItemDaoImpl(factory, databaseItemStatDao, dialect);
                itemCollectionRepo   = new ItemCollectionDaoImpl(factory, dialect);
            }

            // Chicken and the egg..
            var itemStatService = new ItemStatService(databaseItemStatDao, itemSkillDao, settingsService);
            SearchController searchController = new SearchController(
                databaseItemDao,
                playerItemDao,
                itemStatService,
                buddyItemDao,
                augmentationItemRepo,
                settingsService,
                itemCollectionRepo
                );

            List <object> services = new List <object>();

            services.Add(itemTagDao);
            services.Add(databaseItemDao);
            services.Add(databaseItemStatDao);
            services.Add(playerItemDao);
            services.Add(databaseSettingDao);
            services.Add(buddyItemDao);
            services.Add(buddySubscriptionDao);
            services.Add(itemSkillDao);
            services.Add(augmentationItemRepo);
            //services.Add(userFeedbackService);
            services.Add(settingsService);
            services.Add(grimDawnDetector);
            services.Add(recipeItemDao);
            services.Add(itemCollectionRepo);
            services.Add(searchController);

            services.Add(itemStatService);

            var cacher = new TransferStashServiceCache(databaseItemDao);

            services.Add(cacher);


            Logger.Debug("All services created");
            return(new ServiceProvider(services));
        }
Esempio n. 14
0
 private void buttonLanguageSelect_Click(object sender, EventArgs e)
 {
     _languagePackPicker.Show(GrimDawnDetector.GetGrimLocations());
     _itemViewUpdateTrigger?.Invoke();
 }