Exemple #1
0
        /// <summary>
        /// Reads the paths from the config files and sets them.
        /// </summary>
        private static void SetupGamePaths(IGamePathService gamePathResolver)
        {
            if (Config.Settings.Default.AutoDetectGamePath)
            {
                gamePathResolver.TQPath             = gamePathResolver.ResolveGamePath();
                gamePathResolver.ImmortalThronePath = gamePathResolver.ResolveGamePath();
            }
            else
            {
                gamePathResolver.TQPath             = Config.Settings.Default.TQPath;
                gamePathResolver.ImmortalThronePath = Config.Settings.Default.TQITPath;
            }

            // Show a message that the default path is going to be used.
            if (string.IsNullOrEmpty(Config.Settings.Default.VaultPath))
            {
                string folderPath = Path.Combine(gamePathResolver.TQSaveFolder, "TQVaultData");

                // Check to see if we are still using a shortcut to specify the vault path and display a message
                // to use the configuration UI if we are.
                if (!Directory.Exists(folderPath) && File.Exists(Path.ChangeExtension(folderPath, ".lnk")))
                {
                    MessageBox.Show(Resources.DataLinkMsg, Resources.DataLink, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, VaultForm.RightToLeftOptions);
                }
                else
                {
                    MessageBox.Show(Resources.DataDefaultPathMsg, Resources.DataDefaultPath, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, VaultForm.RightToLeftOptions);
                }
            }

            gamePathResolver.TQVaultSaveFolder = Config.Settings.Default.VaultPath;
        }
Exemple #2
0
 public VaultService(ILogger <StashService> log, SessionContext userContext, IPlayerCollectionProvider playerCollectionProvider, IGamePathService gamePathResolver)
 {
     this.Log                      = log;
     this.userContext              = userContext;
     this.GamePathResolver         = gamePathResolver;
     this.PlayerCollectionProvider = playerCollectionProvider;
 }
Exemple #3
0
 public StashService(ILogger <StashService> log, SessionContext userContext, IStashProvider stashProvider, IGamePathService gamePathResolver)
 {
     this.Log              = log.Logger;
     this.userContext      = userContext;
     this.StashProvider    = stashProvider;
     this.GamePathResolver = gamePathResolver;
 }
Exemple #4
0
 public StashProvider(ILogger <StashProvider> log, IItemProvider itemProvider, ISackCollectionProvider sackCollectionProvider, IGamePathService gamePathResolver, ITQDataService tQData)
 {
     this.Log                    = log;
     this.ItemProvider           = itemProvider;
     this.SackCollectionProvider = sackCollectionProvider;
     this.GamePathResolver       = gamePathResolver;
     this.TQData                 = tQData;
 }
Exemple #5
0
        /// <summary>
        /// Sets the name of the game map if a custom map is set in the config file.
        /// Defaults to Main otherwise.
        /// </summary>
        private static void SetupMapName(IGamePathService gamePathResolver)
        {
            // Set the map name.  Command line argument can override this setting in LoadResources().
            string mapName = "main";

            if (Config.Settings.Default.ModEnabled)
            {
                mapName = Config.Settings.Default.CustomMap;
            }

            gamePathResolver.MapName = mapName;
        }
Exemple #6
0
 public PlayerService(
     ILogger <PlayerService> log
     , SessionContext userContext
     , IPlayerCollectionProvider playerCollectionProvider
     , IStashProvider stashProvider
     , IGamePathService gamePathResolver
     , ITranslationService translationService
     )
 {
     this.Log         = log;
     this.userContext = userContext;
     this.PlayerCollectionProvider = playerCollectionProvider;
     this.GamePathResolver         = gamePathResolver;
     this.TranslationService       = translationService;
 }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the VaultForm class.
        /// </summary>
        public VaultForm(IServiceProvider serviceProvider)
        {
            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                this.ServiceProvider          = serviceProvider;
                this.FontService              = this.ServiceProvider.GetService <IFontService>();
                this.UIService                = this.ServiceProvider.GetService <IUIService>();
                this.Database                 = this.ServiceProvider.GetService <IDatabase>();
                this.ItemProvider             = this.ServiceProvider.GetService <IItemProvider>();
                this.PlayerCollectionProvider = this.ServiceProvider.GetService <IPlayerCollectionProvider>();
                this.GamePathResolver         = this.ServiceProvider.GetService <IGamePathService>();

                this.titleFont = FontService.GetFontAlbertusMTLight(9.5F);
                InitForm();
            }
        }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the Database class.
 /// </summary>
 public Database(
     ILogger <Database> log
     , IArcFileProvider arcFileProvider
     , IArzFileProvider arzFileProvider
     , IItemAttributeProvider itemAttributeProvider
     , IGamePathService gamePathResolver
     , ITQDataService tQData
     )
 {
     this.Log = log;
     this.AutoDetectLanguage    = Config.Settings.Default.AutoDetectLanguage;
     this.TQLanguage            = Config.Settings.Default.TQLanguage;
     this.arcProv               = arcFileProvider;
     this.arzProv               = arzFileProvider;
     this.ItemAttributeProvider = itemAttributeProvider;
     this.GamePathResolver      = gamePathResolver;
     this.TQData = tQData;
     this.LoadDBFile();
 }
Exemple #9
0
        /// <summary>
        /// Initializes a new instance of the Form1 class.
        /// </summary>
        public MainForm(ILogger <MainForm> log
                        , IArcFileProvider arcFileProvider
                        , IArzFileProvider arzFileProvider
                        , IDBRecordCollectionProvider dBRecordCollectionProvider
                        , IBitmapService bitmapService
                        , IGamePathService gamePathService)
        {
            this.InitializeComponent();

            Assembly     a     = Assembly.GetExecutingAssembly();
            AssemblyName aname = a.GetName();

            this.Log     = log;
            this.arcProv = arcFileProvider;
            this.arzProv = arzFileProvider;
            this.DBRecordCollectionProvider = dBRecordCollectionProvider;
            this.BitmapService   = bitmapService;
            this.GamePathService = gamePathService;
            this.titleText       = aname.Name;
            this.selectedFileToolStripMenuItem.Enabled = false;
            this.allFilesToolStripMenuItem.Enabled     = false;
            fileType         = CompressedFileType.Unknown;
            this.initialSize = this.Size;
        }