コード例 #1
0
ファイル: SearchController.cs プロジェクト: marius00/iagd
        private bool ApplyItems(bool append)
        {
            var items = _itemPaginationService.Fetch();

            if (items.Count == 0)
            {
                Browser.AddItems(new List <List <JsonItem> >(0));
                return(false);
            }

            _itemStatService.ApplyStats(items);

            var convertedItems = ItemHtmlWriter.ToJsonSerializable(items);

            if (append)
            {
                Browser.AddItems(convertedItems);
            }
            else
            {
                Browser.SetItems(convertedItems, _itemPaginationService.NumItems);
            }

            // UpdateCollectionItems();
            return(true);
        }
コード例 #2
0
        bool Tick()
        {
            var items = _playerItemDao.ListWithMissingStatCache();

            if (items.Count <= 0)
            {
                return(true);
            }

            Logger.Debug($"Updated cache for {items.Count} items");
            _itemStatService.ApplyStats(items);

            foreach (var item in items)
            {
                var rendered = ItemHtmlWriter.GetJsonItem(item);

                List <string> searchableText = new List <string>();
                searchableText.AddRange(rendered.HeaderStats.Select(ToString));
                searchableText.AddRange(rendered.BodyStats.Select(ToString));
                searchableText.AddRange(rendered.PetStats.Select(ToString));
                if (rendered.Skill != null)
                {
                    searchableText.AddRange(rendered.Skill.HeaderStats.Select(ToString).ToList());
                    searchableText.AddRange(rendered.Skill.BodyStats.Select(ToString).ToList());
                    searchableText.AddRange(rendered.Skill.PetStats.Select(ToString).ToList());
                    searchableText.Add(rendered.Skill.Name);
                    searchableText.Add(rendered.Skill.Description);
                    searchableText.Add(rendered.Skill.Trigger);
                }

                searchableText.Add(rendered.Extras);
                item.SearchableText = string.Join("\n", searchableText);

                if (string.IsNullOrEmpty(item.SearchableText))
                {
                    if (string.IsNullOrEmpty(item.Name))
                    {
                        continue;
                    }
                    else
                    {
                        // Typically potions and writs, they wont have any stats listed, so set a dummy value to prevent an infinite loop here.
                        item.SearchableText = "-";
                    }
                }
            }

            _playerItemDao.UpdateCachedStats(items);
            return(true);
        }
コード例 #3
0
        public SearchController(
            IDatabaseItemDao databaseItemDao,
            IPlayerItemDao playerItemDao,
            IDatabaseItemStatDao databaseItemStatDao,
            IItemSkillDao itemSkillDao,
            IBuddyItemDao buddyItemDao
            //StashManager stashManager
            )
        {
            this._dbItemDao            = databaseItemDao;
            this._playerItemDao        = playerItemDao;
            this._itemStatService      = new ItemStatService(databaseItemStatDao, itemSkillDao);
            this._itemPaginatorService = new ItemPaginatorService(TakeSize);
            this._recipeService        = new RecipeService(databaseItemDao);
            //this._costCalculationService = new CostCalculationService(playerItemDao, stashManager);
            this._buddyItemDao = buddyItemDao
                                 //this._stashManager = stashManager
            ;


            // Just make sure it writes .css/.html files before displaying anything to the browser
            //
            ItemHtmlWriter.ToJsonSerializeable(new List <PlayerHeldItem>()); // TODO: is this not a NOOP?
            JsBind.OnRequestItems += JsBind_OnRequestItems;

            // Return the ingredients for a given recipe
            JsBind.OnRequestRecipeIngredients += (sender, args) => {
                var recipeArgument = args as RequestRecipeArgument;
                var ingredients    = _recipeService.GetRecipeIngredients(recipeArgument?.RecipeRecord);
                //_costCalculationService.Populate(ingredients);
                //_costCalculationService.SetMod(_previousMod);

                _previousCallback = recipeArgument?.Callback;
                _previousRecipe   = recipeArgument?.RecipeRecord;
                Browser.JsCallback(recipeArgument?.Callback, JsBind.Serialize(ingredients));
            };


            // Update the recipe when the stash has changed
            //stashManager.StashUpdated += StashManagerOnStashUpdated;


            // Return the list of recipes
            JsBind.OnRequestRecipeList += (sender, args) => {
                var recipeArgument = args as RequestRecipeArgument;
                var recipes        = _recipeService.GetRecipeList();
                Browser.JsCallback(recipeArgument?.Callback, JsBind.Serialize(recipes));
            };
        }
コード例 #4
0
ファイル: SearchController.cs プロジェクト: haapanen/iagd
        private bool ApplyItems()
        {
            var items = _itemPaginatorService.Fetch();

            if (items.Count == 0)
            {
                JsBind.ItemSourceExhausted = true;
                return(false);
            }

            _itemStatService.ApplyStats(items);

            var convertedItems = ItemHtmlWriter.ToJsonSerializeable(items);

            JsBind.UpdateItems(convertedItems);
            return(true);
        }
コード例 #5
0
        public SearchController(
            IDatabaseItemDao databaseItemDao,
            IPlayerItemDao playerItemDao,
            IDatabaseItemStatDao databaseItemStatDao,
            IItemSkillDao itemSkillDao,
            IBuddyItemDao buddyItemDao,
            AugmentationItemRepo augmentationItemRepo, SettingsService settings)
        {
            _dbItemDao            = databaseItemDao;
            _playerItemDao        = playerItemDao;
            _itemStatService      = new ItemStatService(databaseItemStatDao, itemSkillDao, settings);
            _itemPaginatorService = new ItemPaginatorService(TakeSize);
            _buddyItemDao         = buddyItemDao;
            _augmentationItemRepo = augmentationItemRepo;
            _settings             = settings;

            // Just make sure it writes .css/.html files before displaying anything to the browser
            //
            ItemHtmlWriter.ToJsonSerializeable(new List <PlayerHeldItem>()); // TODO: is this not a NOOP?
            JsBind.OnRequestItems += JsBind_OnRequestItems;
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: MartinRohrbach/iagd
        private static void Main(string[] args)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "Main";
            }

            Logger.Info("Starting IA:GD..");
            ExceptionReporter.UrlCrashreport = "http://ribbs.dreamcrash.org/iagd/crashreport.php";
            ExceptionReporter.UrlStats       = "http://ribbs.dreamcrash.org/iagd/stats.php";
#if !DEBUG
            ExceptionReporter.LogExceptions = true;
#endif

            Logger.Info("Starting exception monitor for bug reports.."); // Phrased this way since people took it as a 'bad' thing.
            Logger.Debug("Crash reports can be seen at http://ribbs.dreamcrash.org/iagd/logs.html");
            ExceptionReporter.EnableLogUnhandledOnThread();

#if DEBUG
            AzureUris.Initialize(AzureUris.EnvAzure);
            //AzureUris.Initialize(AzureUris.EnvDev);
#else
            AzureUris.Initialize(AzureUris.EnvAzure);
#endif

            StartupService.Init();

#if DEBUG
            Test();
#endif

            // Prevent running in RELEASE mode by accident
            // And thus risking the live database
#if !DEBUG
            if (Debugger.IsAttached)
            {
                Logger.Fatal("Debugger attached, please run in DEBUG mode");
                return;
            }
#endif
            //ParsingUIBackgroundWorker tmp = new ParsingUIBackgroundWorker();

            ItemHtmlWriter.CopyMissingFiles();

            Guid guid = new Guid("{F3693953-C090-4F93-86A2-B98AB96A9368}");
            using (SingleInstance singleInstance = new SingleInstance(guid))
            {
                if (singleInstance.IsFirstInstance)
                {
                    Logger.Info("Calling run..");
                    singleInstance.ArgumentsReceived += singleInstance_ArgumentsReceived;
                    singleInstance.ListenForArgumentsFromSuccessiveInstances();
                    using (ThreadExecuter threadExecuter = new ThreadExecuter())
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Logger.Info("Visual styles enabled..");
                        Run(args, threadExecuter);
                    }
                }
                else
                {
                    if (args != null && args.Length > 0)
                    {
                        singleInstance.PassArgumentsToFirstInstance(args);
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(new string[] { "--ignore" });
                    }
                }
            }

            Logger.Info("IA Exited");
            LogManager.Shutdown();
        }
コード例 #7
0
        private static void Main(string[] args)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "Main";
            }

            Logger.Info("Starting IA:GD..");
            ExceptionReporter.UrlCrashreport = "http://ribbs.dreamcrash.org/iagd/crashreport.php";
            ExceptionReporter.UrlStats       = "http://ribbs.dreamcrash.org/iagd/stats.php";
#if !DEBUG
            ExceptionReporter.LogExceptions = true;
#endif

            Logger.Info("Starting exception monitor for bug reports.."); // Phrased this way since people took it as a 'bad' thing.
            Logger.Debug("Crash reports can be seen at http://ribbs.dreamcrash.org/iagd/logs.html");
            ExceptionReporter.EnableLogUnhandledOnThread();

#if DEBUG
            AzureUris.Initialize(AzureUris.EnvAzure);
            //AzureUris.Initialize(AzureUris.EnvDev);
#else
            AzureUris.Initialize(AzureUris.EnvAzure);
#endif

            var      version   = Assembly.GetExecutingAssembly().GetName().Version;
            DateTime buildDate = new DateTime(2000, 1, 1)
                                 .AddDays(version.Build)
                                 .AddSeconds(version.Revision * 2);

            Logger.InfoFormat("Running version {0}.{1}.{2}.{3} from {4}", version.Major, version.Minor, version.Build, version.Revision, buildDate.ToString("dd/MM/yyyy"));

            if (!DependencyChecker.CheckNet452Installed())
            {
                MessageBox.Show("It appears .Net Framework 4.5.2 is not installed.\nIA May not function correctly", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (!DependencyChecker.CheckVs2013Installed())
            {
                MessageBox.Show("It appears VS 2013 (x86) redistributable is not installed.\nPlease install it to continue using IA", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            if (!DependencyChecker.CheckVs2010Installed())
            {
                MessageBox.Show("It appears VS 2010 (x86) redistributable is not installed.\nPlease install it to continue using IA", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

#if DEBUG
            Test();
#endif

            // Prevent running in RELEASE mode by accident
            // And thus risking the live database
#if !DEBUG
            if (Debugger.IsAttached)
            {
                Logger.Fatal("Debugger attached, please run in DEBUG mode");
                return;
            }
#endif
            //ParsingUIBackgroundWorker tmp = new ParsingUIBackgroundWorker();

            ItemHtmlWriter.CopyMissingFiles();

            Guid guid = new Guid("{F3693953-C090-4F93-86A2-B98AB96A9368}");
            using (SingleInstance singleInstance = new SingleInstance(guid))
            {
                if (singleInstance.IsFirstInstance)
                {
                    Logger.Info("Calling run..");
                    singleInstance.ArgumentsReceived += singleInstance_ArgumentsReceived;
                    singleInstance.ListenForArgumentsFromSuccessiveInstances();
                    using (ThreadExecuter threadExecuter = new ThreadExecuter())
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Logger.Info("Visual styles enabled..");
                        Run(args, threadExecuter);
                    }
                }
                else
                {
                    if (args != null && args.Length > 0)
                    {
                        singleInstance.PassArgumentsToFirstInstance(args);
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(new string[] { "--ignore" });
                    }
                }
            }

            Logger.Info("IA Exited");
        }
コード例 #8
0
        private static void Main(string[] args)
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name             = "Main";
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
            }


            Logger.Info("Starting IA:GD..");
            ExceptionReporter.UrlStats = "https://webstats.evilsoft.net/report/iagd";


            Logger.Info("Starting exception monitor for bug reports..");
            Logger.Debug("Anonymous usage statistics can be seen at https://webstats.evilsoft.net/iagd");
            ExceptionReporter.EnableLogUnhandledOnThread();

            Uris.Initialize(Uris.EnvCloud);
            StartupService.Init();

#if DEBUG
            Test();
            Uris.Initialize(Uris.EnvLocalDev);
#endif

            // Prevent running in RELEASE mode by accident
            // And thus risking the live database
#if !DEBUG
            if (Debugger.IsAttached)
            {
                Logger.Fatal("Debugger attached, please run in DEBUG mode");
                return;
            }
#endif
            //ParsingUIBackgroundWorker tmp = new ParsingUIBackgroundWorker();

            ItemHtmlWriter.CopyMissingFiles();

            Guid guid = new Guid("{F3693953-C090-4F93-86A2-B98AB96A9368}");
            using (SingleInstance singleInstance = new SingleInstance(guid)) {
                if (singleInstance.IsFirstInstance)
                {
                    Logger.Info("Calling run..");
                    singleInstance.ArgumentsReceived += singleInstance_ArgumentsReceived;
                    singleInstance.ListenForArgumentsFromSuccessiveInstances();
                    using (ThreadExecuter threadExecuter = new ThreadExecuter()) {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Logger.Info("Visual styles enabled..");
                        Run(args, threadExecuter);
                    }
                }
                else
                {
                    if (args != null && args.Length > 0)
                    {
                        singleInstance.PassArgumentsToFirstInstance(args);
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(new string[] { "--ignore" });
                    }

                    Logger.Info("Already has an instance of IA Running, exiting..");
                }
            }

            Logger.Info("IA Exited");
            LogManager.Shutdown();
        }