예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentQueryHandler" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="repository">The repository.</param>
 /// <param name="storageManager">The storage manager.</param>
 /// <param name="archiveManager">The archive manager.</param>
 /// <exception cref="System.ArgumentNullException">
 /// logger or repository or storageManager or archiveManager
 /// </exception>
 public DocumentQueryHandler(ILogger <DocumentQueryHandler> logger, ICloudFileSystemRepository repository, IStorageManager storageManager, IArchiveManager archiveManager)
 {
     this._logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     this._repository     = repository ?? throw new ArgumentNullException(nameof(repository));
     this._storageManager = storageManager ?? throw new ArgumentNullException(nameof(storageManager));
     this._archiveManager = archiveManager ?? throw new ArgumentNullException(nameof(archiveManager));
 }
        // Constructors

        public AggregatedDeltaCreationStrategy(IDeltaCreator deltaCreator, IDeltaPatcher deltaPatcher, IArchiveManager archiveManager, ISignatureCreator signatureCreator)
        {
            _deltaCreator     = deltaCreator;
            _deltaPatcher     = deltaPatcher;
            _archiveManager   = archiveManager;
            _signatureCreator = signatureCreator;
        }
예제 #3
0
 public ArchiveController(IArchiveManager archiveManager, IHttpContextAccessor httpContextAccessor, IMapper mapper,
                          IDasBlogSettings settings) : base(settings)
 {
     this.archiveManager      = archiveManager;
     this.httpContextAccessor = httpContextAccessor;
     this.mapper = mapper;
 }
 public SimpleQueryable(IArchiveManager <T> archiveWrapper)
 {
     if (archiveWrapper == null)
     {
         throw new ArgumentNullException(nameof(archiveWrapper));
     }
     _archiveWrapper = archiveWrapper;
 }
예제 #5
0
 public FoldersController(IHostingEnvironment appEnv,
                          IArchiveManager archiveManager,
                          IFoldersService foldersService)
 {
     this.appEnv         = appEnv;
     this.archiveManager = archiveManager;
     this.foldersService = foldersService;
 }
예제 #6
0
 public QueryExecutor(IArchiveManager <T> archiveWrapper)
 {
     if (archiveWrapper == null)
     {
         throw new ArgumentNullException(nameof(archiveWrapper));
     }
     _archiveWrapper = archiveWrapper;
 }
예제 #7
0
        public RibbonViewModel(
            ISettingsManager settingsManager,
            IProgressService <double> progressService,
            IArchiveManager archiveManager,
            IProjectManager projectManager,
            ILoggerService loggerService,
            IModTools modTools,
            AppViewModel appViewModel
            )
        {
            _mainViewModel = appViewModel;

            _archiveManager  = archiveManager;
            _progressService = progressService;
            _projectManager  = projectManager;
            _modTools        = modTools;
            _loggerService   = loggerService;
            _settingsManager = settingsManager;

            //ViewSelectedCommand = new DelegateCommand<object>(ExecuteViewSelected, CanViewSelected);
            //AssetBrowserAddCommand = new RelayCommand(ExecuteAssetBrowserAdd, CanAssetBrowserAdd);
            //AssetBrowserOpenFileLocation = new RelayCommand(ExecuteAssetBrowserOpenFileLocation, CanAssetBrowserOpenFileLocation);

            OpenProjectCommand = ReactiveCommand.Create <string>(s => _mainViewModel.OpenProjectCommand.Execute(s).Subscribe());
            //NewProjectCommand = ReactiveCommand.Create(() => _mainViewModel.NewProjectCommand.Execute().Subscribe());
            PackProjectCommand        = ReactiveCommand.Create(() => _mainViewModel.PackModCommand.SafeExecute());
            PackInstallProjectCommand = ReactiveCommand.Create(() => _mainViewModel.PackInstallModCommand.SafeExecute());

            NewFileCommand  = ReactiveCommand.Create(() => _mainViewModel.NewFileCommand.SafeExecute(null));
            SaveFileCommand = ReactiveCommand.Create(() => _mainViewModel.SaveFileCommand.SafeExecute());
            SaveAsCommand   = ReactiveCommand.Create(() => _mainViewModel.SaveAsCommand.SafeExecute());
            SaveAllCommand  = ReactiveCommand.Create(() => _mainViewModel.SaveAllCommand.SafeExecute());

            ViewProjectExplorerCommand = ReactiveCommand.Create(() => _mainViewModel.ShowProjectExplorerCommand.SafeExecute());
            ViewAssetBrowserCommand    = ReactiveCommand.Create(() => _mainViewModel.ShowAssetsCommand.SafeExecute());
            ViewPropertiesCommand      = ReactiveCommand.Create(() => _mainViewModel.ShowPropertiesCommand.SafeExecute());
            ViewLogCommand             = ReactiveCommand.Create(() => _mainViewModel.ShowLogCommand.SafeExecute());
            //ViewCodeEditorCommand = ReactiveCommand.Create(() => _mainViewModel.ShowCodeEditorCommand.SafeExecute());
            ShowImportExportToolCommand = ReactiveCommand.Create(() => _mainViewModel.ShowImportExportToolCommand.SafeExecute());

            ShowPluginToolCommand = ReactiveCommand.Create(() => _mainViewModel.ShowPluginCommand.SafeExecute());

            ShowBugReportCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                var result = await Interactions.ShowBugReport.Handle(Unit.Default);
            });
            ShowFeedbackCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                var result = await Interactions.ShowFeedback.Handle(Unit.Default);
            });

            OpenMaterialRepositoryCommand = ReactiveCommand.Create(() =>
            {
                Commonfunctions.ShowFolderInExplorer(_settingsManager.MaterialRepositoryPath);
            });

            UnbundleGameCommand = ReactiveCommand.CreateFromTask(UnbundleGame);
        }
 public AdaptationResponseConsumer(IAdaptationResponseCollection collection, IArchiveManager archiveManager, IErrorReportGenerator errorReportGenerator, IFileManager fileManager, IArchiveProcessorConfig config, ILogger <AdaptationResponseConsumer> logger)
 {
     _collection           = collection ?? throw new ArgumentNullException(nameof(collection));
     _archiveManager       = archiveManager ?? throw new ArgumentNullException(nameof(archiveManager));
     _errorReportGenerator = errorReportGenerator ?? throw new ArgumentNullException(nameof(errorReportGenerator));
     _fileManager          = fileManager ?? throw new ArgumentNullException(nameof(fileManager));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #9
0
        private void OpenFile(string fileName = "")
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = Settings.Default.LastDirectory;

            // Supported Types
            ofd.Filter = Tools.LoadArchiveFilters(_archiveManagers);

            DialogResult dr = DialogResult.OK;

            if (fileName == string.Empty)
            {
                dr = ofd.ShowDialog();
            }

            if (dr != DialogResult.OK)
            {
                return;
            }

            if (fileName == string.Empty)
            {
                fileName = ofd.FileName;
            }

            IArchiveManager tempManager = SelectArchiveManager(fileName);

            try
            {
                if (tempManager?.Load(fileName) == LoadResult.Success)
                {
                    _archiveManager?.Unload();
                    _archiveManager = tempManager;
                    _fileOpen       = true;
                    _hasChanges     = false;

                    LoadDirectories();
                    UpdateForm();
                }

                Settings.Default.LastDirectory = new FileInfo(fileName).DirectoryName;
                Settings.Default.Save();
            }
            catch (Exception ex)
            {
                if (tempManager != null)
                {
                    MessageBox.Show(this, ex.ToString(), tempManager.Name + " - " + tempManager.Description + " Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show(this, ex.ToString(), "Supported Format Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #10
0
 public WorkerHostedService(
     ILogger <WorkerHostedService> logger,
     IHashService hashService,
     IArchiveManager archiveManager,
     IHostApplicationLifetime appLifetime)
 {
     _logger         = logger;
     _hashService    = hashService;
     _archiveManager = archiveManager;
 }
예제 #11
0
        // Constructors

        public FileRestore(IArchiveManager archiveManager,
                           IDeltaPatcher deltaPatcher,
                           ISignatureCreator signatureCreator,
                           IDeltaCreator deltaCreator,
                           IFileHandlingStrategySelector fileHandlingStrategySelectors)
        {
            _deltaCreator                 = deltaCreator;
            _signatureCreator             = signatureCreator;
            _fileHandlingStrategySelector = fileHandlingStrategySelectors;
            _archiveManager               = archiveManager;
            _deltaPatcher                 = deltaPatcher;
        }
예제 #12
0
파일: Manager.cs 프로젝트: benladen/Kuriimu
        private void OpenFile(string filename = "")
        {
            var ofd = new OpenFileDialog
            {
                InitialDirectory = Settings.Default.LastDirectory,
                Filter           = Tools.LoadFilters(_archiveManagers)
            };

            var dr = DialogResult.OK;

            if (filename == string.Empty)
            {
                dr = ofd.ShowDialog();
            }

            if (dr != DialogResult.OK)
            {
                return;
            }

            if (filename == string.Empty)
            {
                filename = ofd.FileName;
            }

            var tempManager = SelectArchiveManager(filename);

            try
            {
                if (tempManager != null)
                {
                    tempManager.Load(filename);

                    _archiveManager?.Unload();
                    _archiveManager = tempManager;
                    _fileOpen       = true;
                    _hasChanges     = false;

                    LoadDirectories();
                    UpdateForm();
                }

                Settings.Default.LastDirectory = new FileInfo(filename).DirectoryName;
                Settings.Default.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), tempManager != null ? $"{tempManager.Name} - {tempManager.Description} Manager" : "Supported Format Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #13
0
 public ModTools(
     ILoggerService loggerService,
     IProgressService <double> progressService,
     IHashService hashService,
     Red4ParserService wolvenkitFileService,
     MeshTools meshTools,
     IArchiveManager archiveManager
     )
 {
     _loggerService        = loggerService;
     _progressService      = progressService;
     _hashService          = hashService;
     _wolvenkitFileService = wolvenkitFileService;
     _meshTools            = meshTools;
     _archiveManager       = archiveManager;
 }
예제 #14
0
 public RED4Controller(
     ILoggerService loggerService,
     INotificationService notificationService,
     IProjectManager projectManager,
     ISettingsManager settingsManager,
     IHashService hashService,
     IModTools modTools,
     IArchiveManager gameArchiveManager
     )
 {
     _notificationService = notificationService;
     _loggerService       = loggerService;
     _projectManager      = projectManager;
     _settingsManager     = settingsManager;
     _hashService         = hashService;
     _modTools            = modTools;
     _archiveManager      = gameArchiveManager;
 }
예제 #15
0
        public ArchiveProcessor(
            IAdaptationOutcomeSender adaptationOutcomeSender,
            IFileManager fileManager,
            IArchiveManager archiveManager,
            IAdaptationResponseProducer responseProducer,
            IAdaptationResponseConsumer responseConsumer,
            IPasswordProtectedReportGenerator passwordProtectedReportGenerator,
            IArchiveProcessorConfig config,
            ILogger <ArchiveProcessor> logger)
        {
            _adaptationOutcomeSender          = adaptationOutcomeSender ?? throw new ArgumentNullException(nameof(adaptationOutcomeSender));
            _fileManager                      = fileManager ?? throw new ArgumentNullException(nameof(fileManager));
            _archiveManager                   = archiveManager ?? throw new ArgumentNullException(nameof(archiveManager));
            _responseProducer                 = responseProducer ?? throw new ArgumentNullException(nameof(responseProducer));
            _responseConsumer                 = responseConsumer ?? throw new ArgumentNullException(nameof(responseConsumer));
            _passwordProtectedReportGenerator = passwordProtectedReportGenerator ?? throw new ArgumentNullException(nameof(passwordProtectedReportGenerator));
            _config = config ?? throw new ArgumentNullException(nameof(config));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _processingTimeoutDuration = _config.ProcessingTimeoutDuration;
            _cancellationTokenSource   = new CancellationTokenSource();
        }
예제 #16
0
파일: Manager.cs 프로젝트: benladen/Kuriimu
        private IArchiveManager SelectArchiveManager(string filename, bool batchMode = false)
        {
            IArchiveManager result = null;

            // first look for managers whose extension matches that of our file name
            List <IArchiveManager> matchingManagers = _archiveManagers.Where(manager => manager.Extension.Split(';').Any(s => filename.ToLower().EndsWith(s))).ToList();

            result = matchingManagers.FirstOrDefault(manager => manager.Identify(filename));

            // if none of them match, then try all other managers
            if (result == null)
            {
                result = _archiveManagers.Except(matchingManagers).FirstOrDefault(manager => manager.Identify(filename));
            }

            if (result == null && !batchMode)
            {
                MessageBox.Show("None of the installed plugins are able to open the file.", "Unsupported Format", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(result == null ? null : (IArchiveManager)Activator.CreateInstance(result.GetType()));
        }
예제 #17
0
        public ConsoleFunctions(
            ILoggerService loggerService,
            IHashService hashService,
            IProgressService <double> progress,
            Red4ParserService wolvenkitFileService,
            IModTools modTools,
            IArchiveManager archiveManager,

            IOptions <CommonImportArgs> commonImportArgs,
            IOptions <XbmImportArgs> xbmImportArgs,
            IOptions <GltfImportArgs> gltfImportArgs,
            IOptions <XbmExportArgs> xbmExportArgs,
            IOptions <MeshExportArgs> meshExportArgs,
            IOptions <MorphTargetExportArgs> morphTargetExportArgs,
            IOptions <MlmaskExportArgs> mlmaskExportArgs,
            IOptions <WemExportArgs> wemExportArgs,
            IOptions <AnimationExportArgs> animationExportArgs
            )
        {
            _loggerService   = loggerService;
            _modTools        = modTools;
            _progressService = progress;
            _hashService     = hashService;
            _archiveManager  = archiveManager;

            _commonImportArgs      = commonImportArgs;
            _xbmImportArgs         = xbmImportArgs;
            _gltfImportArgs        = gltfImportArgs;
            _wolvenkitFileService  = wolvenkitFileService;
            _xbmExportArgs         = xbmExportArgs;
            _meshExportArgs        = meshExportArgs;
            _morphTargetExportArgs = morphTargetExportArgs;
            _mlmaskExportArgs      = mlmaskExportArgs;
            _wemExportArgs         = wemExportArgs;
            _animationExportArgs   = animationExportArgs;
        }
        // Constructors

        public EmptyLogFileHandlingStrategy(IArchiveManager archiveManager, ISignatureCreator signatureCreator)
        {
            _archiveManager   = archiveManager;
            _signatureCreator = signatureCreator;
        }
예제 #19
0
 public ArchiveController(IArchiveManager archiveManager, IHttpContextAccessor httpContextAccessor, IMapper mapper)
 {
     this.archiveManager      = archiveManager;
     this.httpContextAccessor = httpContextAccessor;
     this.mapper = mapper;
 }
예제 #20
0
        protected static void Setup(TestContext context)
        {
            #region cp77 game dir

            // Init
            Console.WriteLine("BaseTestClass.BaseTestInitialize()");
            s_config = new ConfigurationBuilder()
                       .AddJsonFile("appsettings.json")
                       .Build();
            s_writeToFile = bool.Parse(s_config.GetSection(s_writeToFileSetting).Value);

            // overrides hardcoded appsettings.json
            var cp77Dir = Environment.GetEnvironmentVariable("CP77_DIR", EnvironmentVariableTarget.User);
            if (!string.IsNullOrEmpty(cp77Dir) && new DirectoryInfo(cp77Dir).Exists)
            {
                s_gameDirectoryPath = cp77Dir;
            }
            else
            {
                s_gameDirectoryPath = s_config.GetSection(s_gameDirectorySetting).Value;
            }

            if (string.IsNullOrEmpty(s_gameDirectoryPath))
            {
                throw new ConfigurationErrorsException($"'{s_gameDirectorySetting}' is not configured");
            }

            var gameDirectory = new DirectoryInfo(s_gameDirectoryPath);
            if (!gameDirectory.Exists)
            {
                throw new ConfigurationErrorsException($"'{s_gameDirectorySetting}' is not a valid directory");
            }

            #endregion

            #region oodle

            var gameBinDir = new DirectoryInfo(Path.Combine(gameDirectory.FullName, "bin", "x64"));
            var oodleInfo  = new FileInfo(Path.Combine(gameBinDir.FullName, "oo2ext_7_win64.dll"));
            if (!oodleInfo.Exists)
            {
                Assert.Fail("Could not find oo2ext_7_win64.dll.");
            }
            var ass = AppDomain.CurrentDomain.BaseDirectory;
            var appOodleFileName = Path.Combine(ass, "oo2ext_7_win64.dll");
            if (!File.Exists(appOodleFileName))
            {
                oodleInfo.CopyTo(appOodleFileName);
            }
            if (!OodleLoadLib.Load(appOodleFileName))
            {
                Assert.Fail("Could not load oo2ext_7_win64.dll.");
            }

            #endregion

            //protobuf
            RuntimeTypeModel.Default[typeof(IGameArchive)].AddSubType(20, typeof(Archive));

            // IoC
            ServiceLocator.Default.RegisterInstance <ILoggerService>(new CatelLoggerService(false));
            ServiceLocator.Default.RegisterType <IHashService, HashService>();
            ServiceLocator.Default.RegisterType <IProgressService <double>, ProgressService <double> >();
            ServiceLocator.Default.RegisterType <Red4ParserService>();
            ServiceLocator.Default.RegisterType <MeshTools>();           //RIG, Cp77FileService
            ServiceLocator.Default.RegisterType <IArchiveManager, ArchiveManager>();
            ServiceLocator.Default.RegisterType <IModTools, ModTools>(); //Cp77FileService, ILoggerService, IProgress, IHashService, Mesh, Target



            var hashService = ServiceLocator.Default.ResolveType <IHashService>();
            s_bm = ServiceLocator.Default.ResolveType <IArchiveManager>();

            var archivedir = new DirectoryInfo(Path.Combine(gameDirectory.FullName, "archive", "pc", "content"));
            s_bm.LoadFromFolder(archivedir);
            s_groupedFiles = s_bm.GetGroupedFiles();

            var keyes     = s_groupedFiles.Keys.ToList();
            var keystring = string.Join(',', keyes);
            //Console.WriteLine(keystring);
        }
예제 #21
0
        // Constructors

        public TransactionWriter(IArchiveManager archiveManager)
        {
            _archiveManager = archiveManager;
        }
예제 #22
0
 public ArchiveController(IArchiveManager archiveRepository, IHttpContextAccessor httpContextAccessor)
 {
     _archiveRepository   = archiveRepository;
     _httpContextAccessor = httpContextAccessor;
 }
예제 #23
0
        // Constructors

        public FirstDeltaCreationStrategy(IDeltaCreator deltaCreator, IArchiveManager archiveManager, ISignatureCreator signatureCreator)
        {
            _deltaCreator     = deltaCreator;
            _archiveManager   = archiveManager;
            _signatureCreator = signatureCreator;
        }
예제 #24
0
 public ArchiveController(IArchiveManager archiveManager, IHttpContextAccessor httpContextAccessor)
 {
     _archiveManager      = archiveManager;
     _httpContextAccessor = httpContextAccessor;
 }
예제 #25
0
 public ArchiveController(IArchiveManager archiveManager)
 {
     _archiveManager = archiveManager;
 }
예제 #26
0
        // Constructors

        public AppendLogFileHandlingStrategy(IArchiveManager archiveManager, IEnumerable <IDeltaCreationStrategy> deltaCreationStrategies)
        {
            _archiveManager          = archiveManager;
            _deltaCreationStrategies = deltaCreationStrategies;
        }
예제 #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FareExportMonitor"/> class.
        /// </summary>
        /// <param name="archiveManager">
        /// The archive manager.
        /// </param>
        /// <param name="controlFactory">
        /// The control factory.
        /// </param>
        /// <param name="autoSync">
        /// The auto sync.
        /// </param>
        public FareExportMonitor(IArchiveManager archiveManager, IFareBrowserControlFactory controlFactory, Func<bool> autoSync)
            : base(controlFactory)
        {
            var env = AppContext.MonitorEnvironment;
            this._archiveManager = archiveManager;
            this._archiveManager.Initialize();
            this._fareDatabase = env.FareDatabase;
            this._autoSync = autoSync;
            this._logger = env.Logger;
            var guid = Guid.NewGuid().ToString();
            this._dataPath = AppUtil.GetLocalDataPath("Temp") + "\\" + guid + LOCK_EXT;
            Directory.CreateDirectory(this._dataPath);
            this._lockStream = File.Open(Path.Combine(this._dataPath, "_" + guid), FileMode.Create, FileAccess.ReadWrite, FileShare.None);

            this.RequestCompleted += this.FareExportMonitor_OnRequestCompleted;
        }
예제 #28
0
        public AssetBrowserViewModel(
            IProjectManager projectManager,
            INotificationService notificationService,
            IGameControllerFactory gameController,
            IArchiveManager archiveManager,
            ISettingsManager settings,
            IProgressService <double> progressService
            ) : base(ToolTitle)
        {
            _projectManager      = projectManager;
            _notificationService = notificationService;
            _gameController      = gameController;
            _archiveManager      = archiveManager;
            _settings            = settings;
            _progressService     = progressService;

            ContentId = ToolContentId;

            TogglePreviewCommand      = new RelayCommand(ExecuteTogglePreview, CanTogglePreview);
            OpenFileSystemItemCommand = new RelayCommand(ExecuteOpenFile, CanOpenFile);
            AddSelectedCommand        = new RelayCommand(ExecuteAddSelected, CanAddSelected);
            ToggleModBrowserCommand   = new RelayCommand(ExecuteToggleModBrowser, CanToggleModBrowser);
            OpenFileLocationCommand   = new RelayCommand(ExecuteOpenFileLocationCommand, CanOpenFileLocationCommand);

            ExpandAll   = ReactiveCommand.Create(() => { });
            CollapseAll = ReactiveCommand.Create(() => { });
            Collapse    = ReactiveCommand.Create(() => { });
            Expand      = ReactiveCommand.Create(() => { });

            AddSearchKeyCommand = ReactiveCommand.Create <string>(x => SearchBarText += $" {x}:");
            FindUsingCommand    = ReactiveCommand.CreateFromTask(FindUsing);

            archiveManager.ConnectGameRoot()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _boundRootNodes)
            .Subscribe(
                _ =>
            {
                // binds only the root node
                LeftItems = new ObservableCollection <RedFileSystemModel>(_boundRootNodes);
            });

            _archiveManager
            .WhenAnyValue(x => x.IsManagerLoaded)
            .Subscribe(loaded =>
            {
                LoadVisibility = loaded ? Visibility.Collapsed : Visibility.Visible;
                if (loaded)
                {
                    _notificationService.Success($"Asset Browser is initialized");
                    NoProjectBorderVisibility = Visibility.Collapsed;
                }
            });
            _projectManager
            .WhenAnyValue(_ => _.IsProjectLoaded)
            .Subscribe(loaded =>
            {
                NoProjectBorderVisibility = loaded ? Visibility.Collapsed : Visibility.Visible;
            });


            Classes = _gameController
                      .GetController()
                      .GetAvaliableClasses();
        }
예제 #29
0
        /// <summary>
        /// Import Export ViewModel Constructor
        /// </summary>
        /// <param name="projectManager"></param>
        /// <param name="loggerService"></param>
        /// <param name="messageService"></param>
        /// <param name="watcherService"></param>
        /// <param name="gameController"></param>
        /// <param name="modTools"></param>
        public ImportExportViewModel(
            IProjectManager projectManager,
            ILoggerService loggerService,
            IProgressService <double> progressService,
            IWatcherService watcherService,
            INotificationService notificationService,
            IGameControllerFactory gameController,
            ISettingsManager settingsManager,
            IModTools modTools,
            MeshTools meshTools,
            IArchiveManager archiveManager
            ) : base(ToolTitle)
        {
            _projectManager      = projectManager;
            _loggerService       = loggerService;
            _progressService     = progressService;
            _watcherService      = watcherService;
            _modTools            = modTools;
            _gameController      = gameController;
            _notificationService = notificationService;
            _settingsManager     = settingsManager;
            _meshTools           = meshTools;
            _archiveManager      = archiveManager;

            SetupToolDefaults();
            SideInDockedMode = DockSide.Tabbed;

            ProcessAllCommand              = ReactiveCommand.CreateFromTask(ExecuteProcessAll);
            ProcessSelectedCommand         = ReactiveCommand.CreateFromTask(ExecuteProcessSelected);
            CopyArgumentsTemplateToCommand = new DelegateCommand <string>(ExecuteCopyArgumentsTemplateTo, CanCopyArgumentsTemplateTo);
            SetCollectionCommand           = new DelegateCommand <string>(ExecuteSetCollection, CanSetCollection);
            ConfirmCollectionCommand       = new DelegateCommand <string>(ExecuteConfirmCollection, CanConfirmCollection);

            AddItemsCommand    = new DelegateCommand <ObservableCollection <object> >(ExecuteAddItems, CanAddItems);
            RemoveItemsCommand = new DelegateCommand <ObservableCollection <object> >(ExecuteRemoveItems, CanRemoveItems);

            _watcherService.Files
            .Connect()
            .Filter(_ => _.IsImportable)
            .Filter(_ => _.FullName.Contains(_projectManager.ActiveProject.RawDirectory))
            .Filter(x => CheckForMultiImport(x))
            .Transform(_ => new ImportableItemViewModel(_))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _importableItems)
            .Subscribe();

            _watcherService.Files
            .Connect()
            .Filter(_ => _.IsExportable)
            .Filter(_ => _.FullName.Contains(_projectManager.ActiveProject.ModDirectory))
            .Transform(_ => new ExportableItemViewModel(_))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _exportableItems)
            .Subscribe();

            _watcherService.Files
            .Connect()
            .Filter(_ => _.IsConvertable)
            .Filter(_ => _.FullName.Contains(_projectManager.ActiveProject.RawDirectory))
            .Transform(_ => new ConvertableItemViewModel(_))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Bind(out _convertableItems)
            .Subscribe();

            ////=> IsImportsSelected ? SelectedImport : IsExportsSelected ? SelectedExport : SelectedConvert;
            //this.WhenAnyValue(x => x.IsImportsSelected, y => y.IsExportsSelected, z => z.IsConvertsSelected)
            //    .Subscribe(b =>
            //{
            //    SelectedObject = IsImportsSelected ? SelectedImport : IsExportsSelected ? SelectedExport : SelectedConvert;
            //});


            this.WhenAnyValue(x => x.SelectedExport, y => y.SelectedImport, z => z.SelectedConvert)
            .Subscribe(b =>
            {
                var x = b.Item1;
                var y = b.Item2;
                var z = b.Item3;

                SelectedObject = IsImportsSelected ? SelectedImport : IsExportsSelected ? SelectedExport : SelectedConvert;
            });
        }
예제 #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FareExportMonitor"/> class.
 /// </summary>
 /// <param name="archiveManager">
 /// The archive manager.
 /// </param>
 /// <param name="controlFactory">
 /// The control factory.
 /// </param>
 /// <param name="autoSync">
 /// The auto sync.
 /// </param>
 public FareExportMonitor(IArchiveManager archiveManager, IFareBrowserControlFactory controlFactory, bool autoSync)
     : this(archiveManager, controlFactory, () => autoSync)
 {
 }