/// <summary>
 /// Initializes a new instance of the <see cref="ModHolderControlViewModel" /> class.
 /// </summary>
 /// <param name="promptNotificationsService">The prompt notifications service.</param>
 /// <param name="modListInstallRefreshRequestHandler">The mod list install refresh request handler.</param>
 /// <param name="modDefinitionInvalidReplaceHandler">The mod definition invalid replace handler.</param>
 /// <param name="idGenerator">The identifier generator.</param>
 /// <param name="shutDownState">State of the shut down.</param>
 /// <param name="modService">The mod service.</param>
 /// <param name="modPatchCollectionService">The mod patch collection service.</param>
 /// <param name="gameService">The game service.</param>
 /// <param name="notificationAction">The notification action.</param>
 /// <param name="appAction">The application action.</param>
 /// <param name="localizationManager">The localization manager.</param>
 /// <param name="installedModsControlViewModel">The installed mods control view model.</param>
 /// <param name="collectionModsControlViewModel">The collection mods control view model.</param>
 /// <param name="modDefinitionAnalyzeHandler">The mod definition analyze handler.</param>
 /// <param name="modDefinitionLoadHandler">The mod definition load handler.</param>
 /// <param name="modDefinitionPatchLoadHandler">The mod definition patch load handler.</param>
 /// <param name="gameDirectoryChangedHandler">The game directory changed handler.</param>
 /// <param name="logger">The logger.</param>
 public ModHolderControlViewModel(IPromptNotificationsService promptNotificationsService, ModListInstallRefreshRequestHandler modListInstallRefreshRequestHandler, ModDefinitionInvalidReplaceHandler modDefinitionInvalidReplaceHandler,
                                  IIDGenerator idGenerator, IShutDownState shutDownState, IModService modService, IModPatchCollectionService modPatchCollectionService, IGameService gameService,
                                  INotificationAction notificationAction, IAppAction appAction, ILocalizationManager localizationManager,
                                  InstalledModsControlViewModel installedModsControlViewModel, CollectionModsControlViewModel collectionModsControlViewModel,
                                  ModDefinitionAnalyzeHandler modDefinitionAnalyzeHandler, ModDefinitionLoadHandler modDefinitionLoadHandler, ModDefinitionPatchLoadHandler modDefinitionPatchLoadHandler,
                                  GameUserDirectoryChangedHandler gameDirectoryChangedHandler, ILogger logger)
 {
     // It was supposed to be a small project and I ended up with this mess I seriously need to introduce facades sometime
     this.promptNotificationsService         = promptNotificationsService;
     this.modDefinitionInvalidReplaceHandler = modDefinitionInvalidReplaceHandler;
     this.idGenerator               = idGenerator;
     this.shutDownState             = shutDownState;
     this.modService                = modService;
     this.modPatchCollectionService = modPatchCollectionService;
     this.notificationAction        = notificationAction;
     this.localizationManager       = localizationManager;
     this.gameService               = gameService;
     this.logger    = logger;
     this.appAction = appAction;
     this.modDefinitionLoadHandler            = modDefinitionLoadHandler;
     this.modDefinitionPatchLoadHandler       = modDefinitionPatchLoadHandler;
     this.modDefinitionAnalyzeHandler         = modDefinitionAnalyzeHandler;
     this.gameDirectoryChangedHandler         = gameDirectoryChangedHandler;
     this.modListInstallRefreshRequestHandler = modListInstallRefreshRequestHandler;
     InstalledMods  = installedModsControlViewModel;
     CollectionMods = collectionModsControlViewModel;
     if (StaticResources.CommandLineOptions != null && StaticResources.CommandLineOptions.EnableResumeGameButton)
     {
         forceEnableResumeButton = true;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IronySparkleUpdater" /> class.
 /// </summary>
 /// <param name="isInstallerVersion">if set to <c>true</c> [is installer version].</param>
 /// <param name="updaterService">The updater service.</param>
 /// <param name="appAction">The application action.</param>
 public IronySparkleUpdater(bool isInstallerVersion, IUpdaterService updaterService, IAppAction appAction) :
     base(Constants.AppCastAddress, new Ed25519Checker(NetSparkleUpdater.Enums.SecurityMode.OnlyVerifySoftwareDownloads, Constants.PublicUpdateKey))
 {
     IsInstallerVersion  = isInstallerVersion;
     this.updaterService = updaterService;
     this.appAction      = appAction;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModCompareSelectorControlViewModel" /> class.
 /// </summary>
 /// <param name="hotkeyPressedHandler">The hotkey pressed handler.</param>
 /// <param name="appAction">The application action.</param>
 /// <param name="modPatchCollectionService">The mod patch collection service.</param>
 public ModCompareSelectorControlViewModel(ConflictSolverViewHotkeyPressedHandler hotkeyPressedHandler,
                                           IAppAction appAction, IModPatchCollectionService modPatchCollectionService)
 {
     this.modPatchCollectionService = modPatchCollectionService;
     this.appAction            = appAction;
     this.hotkeyPressedHandler = hotkeyPressedHandler;
 }
Esempio n. 4
0
 /// <summary>
 /// Copies the text asynchronous.
 /// </summary>
 /// <param name="text">The text.</param>
 /// <returns>Task.</returns>
 protected virtual Task CopyTextAsync(string text)
 {
     if (appAction == null)
     {
         appAction = DIResolver.Get <IAppAction>();
     }
     return(appAction.CopyAsync(text));
 }
Esempio n. 5
0
 public static IAppAction GetAppMenuItem(ToolStripMenuItem menu, AppAction action)
 {
     foreach (ToolStripMenuItem item in menu.DropDownItems)
     {
         IAppAction appItem = item as IAppAction;
         if (appItem != null && appItem.Action == action)
         {
             return(appItem);
         }
     }
     return(null);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InstalledModsControlViewModel" /> class.
 /// </summary>
 /// <param name="gameService">The game service.</param>
 /// <param name="localizationManager">The localization manager.</param>
 /// <param name="modService">The mod service.</param>
 /// <param name="appStateService">The application state service.</param>
 /// <param name="modSelectedSortOrder">The mod selected sort order.</param>
 /// <param name="modNameSortOrder">The mod name sort order.</param>
 /// <param name="modVersionSortOrder">The mod version sort order.</param>
 /// <param name="filterMods">The filter mods.</param>
 /// <param name="appAction">The application action.</param>
 /// <param name="notificationAction">The notification action.</param>
 public InstalledModsControlViewModel(IGameService gameService, ILocalizationManager localizationManager,
                                      IModService modService, IAppStateService appStateService, SortOrderControlViewModel modSelectedSortOrder,
                                      SortOrderControlViewModel modNameSortOrder, SortOrderControlViewModel modVersionSortOrder,
                                      SearchModsControlViewModel filterMods, IAppAction appAction, INotificationAction notificationAction)
 {
     this.modService          = modService;
     this.gameService         = gameService;
     this.appStateService     = appStateService;
     this.appAction           = appAction;
     this.notificationAction  = notificationAction;
     this.localizationManager = localizationManager;
     ModNameSortOrder         = modNameSortOrder;
     ModVersionSortOrder      = modVersionSortOrder;
     ModSelectedSortOrder     = modSelectedSortOrder;
     FilterMods = filterMods;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModHolderControlViewModel" /> class.
 /// </summary>
 /// <param name="shutDownState">State of the shut down.</param>
 /// <param name="modService">The mod service.</param>
 /// <param name="modPatchCollectionService">The mod patch collection service.</param>
 /// <param name="gameService">The game service.</param>
 /// <param name="notificationAction">The notification action.</param>
 /// <param name="appAction">The application action.</param>
 /// <param name="localizationManager">The localization manager.</param>
 /// <param name="installedModsControlViewModel">The installed mods control view model.</param>
 /// <param name="collectionModsControlViewModel">The collection mods control view model.</param>
 /// <param name="modDefinitionAnalyzeHandler">The mod definition analyze handler.</param>
 /// <param name="modDefinitionLoadHandler">The mod definition load handler.</param>
 /// <param name="modDefinitionPatchLoadHandler">The mod definition patch load handler.</param>
 /// <param name="gameDirectoryChangedHandler">The game directory changed handler.</param>
 /// <param name="logger">The logger.</param>
 public ModHolderControlViewModel(IShutDownState shutDownState, IModService modService, IModPatchCollectionService modPatchCollectionService, IGameService gameService,
                                  INotificationAction notificationAction, IAppAction appAction, ILocalizationManager localizationManager,
                                  InstalledModsControlViewModel installedModsControlViewModel, CollectionModsControlViewModel collectionModsControlViewModel,
                                  ModDefinitionAnalyzeHandler modDefinitionAnalyzeHandler, ModDefinitionLoadHandler modDefinitionLoadHandler, ModDefinitionPatchLoadHandler modDefinitionPatchLoadHandler,
                                  GameUserDirectoryChangedHandler gameDirectoryChangedHandler, ILogger logger)
 {
     this.shutDownState             = shutDownState;
     this.modService                = modService;
     this.modPatchCollectionService = modPatchCollectionService;
     this.notificationAction        = notificationAction;
     this.localizationManager       = localizationManager;
     this.gameService               = gameService;
     this.logger    = logger;
     this.appAction = appAction;
     this.modDefinitionLoadHandler      = modDefinitionLoadHandler;
     this.modDefinitionPatchLoadHandler = modDefinitionPatchLoadHandler;
     this.modDefinitionAnalyzeHandler   = modDefinitionAnalyzeHandler;
     this.gameDirectoryChangedHandler   = gameDirectoryChangedHandler;
     InstalledMods  = installedModsControlViewModel;
     CollectionMods = collectionModsControlViewModel;
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainConflictSolverControlViewModel" /> class.
 /// </summary>
 /// <param name="modPatchCollectionService">The mod patch collection service.</param>
 /// <param name="localizationManager">The localization manager.</param>
 /// <param name="mergeViewer">The merge viewer.</param>
 /// <param name="binaryMergeViewer">The binary merge viewer.</param>
 /// <param name="modCompareSelector">The mod compare selector.</param>
 /// <param name="ignoreConflictsRules">The ignore conflicts rules.</param>
 /// <param name="modFilter">The mod filter.</param>
 /// <param name="resetConflicts">The reset conflicts.</param>
 /// <param name="dbSearch">The database search.</param>
 /// <param name="customConflicts">The custom conflicts.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="notificationAction">The notification action.</param>
 /// <param name="appAction">The application action.</param>
 public MainConflictSolverControlViewModel(IModPatchCollectionService modPatchCollectionService, ILocalizationManager localizationManager,
                                           MergeViewerControlViewModel mergeViewer, MergeViewerBinaryControlViewModel binaryMergeViewer,
                                           ModCompareSelectorControlViewModel modCompareSelector, ModConflictIgnoreControlViewModel ignoreConflictsRules,
                                           ConflictSolverModFilterControlViewModel modFilter, ConflictSolverResetConflictsControlViewModel resetConflicts,
                                           ConflictSolverDBSearchControlViewModel dbSearch, ConflictSolverCustomConflictsControlViewModel customConflicts,
                                           ILogger logger, INotificationAction notificationAction, IAppAction appAction)
 {
     this.modPatchCollectionService = modPatchCollectionService;
     this.localizationManager       = localizationManager;
     this.logger             = logger;
     this.notificationAction = notificationAction;
     this.appAction          = appAction;
     MergeViewer             = mergeViewer;
     ModCompareSelector      = modCompareSelector;
     BinaryMergeViewer       = binaryMergeViewer;
     IgnoreConflictsRules    = ignoreConflictsRules;
     ModFilter       = modFilter;
     ResetConflicts  = resetConflicts;
     DatabaseSearch  = dbSearch;
     CustomConflicts = customConflicts;
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HashReportControlViewModel" /> class.
 /// </summary>
 /// <param name="appAction">The application action.</param>
 public HashReportControlViewModel(IAppAction appAction)
 {
     this.appAction = appAction;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShortcutsControlViewModel" /> class.
 /// </summary>
 /// <param name="appAction">The application action.</param>
 /// <param name="gameService">The game service.</param>
 public ShortcutsControlViewModel(IAppAction appAction, IGameService gameService)
 {
     this.appAction   = appAction;
     this.gameService = gameService;
 }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModCompareSelectorControlViewModel" /> class.
 /// </summary>
 /// <param name="appAction">The application action.</param>
 /// <param name="modPatchCollectionService">The mod patch collection service.</param>
 public ModCompareSelectorControlViewModel(IAppAction appAction, IModPatchCollectionService modPatchCollectionService)
 {
     this.modPatchCollectionService = modPatchCollectionService;
     this.appAction = appAction;
 }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Updater" /> class.
 /// </summary>
 /// <param name="updateProgressHandler">The update progress handler.</param>
 /// <param name="updaterService">The updater service.</param>
 /// <param name="appAction">The application action.</param>
 /// <param name="shutDownState">State of the shut down.</param>
 public Updater(UpdateUnpackProgressHandler updateProgressHandler, IUpdaterService updaterService, IAppAction appAction, IShutDownState shutDownState)
 {
     this.shutDownState  = shutDownState;
     isInstallerVersion  = IsInstallerVersion();
     this.updaterService = updaterService;
     progress            = new Subject <int>();
     error   = new Subject <Exception>();
     updater = new IronySparkleUpdater(isInstallerVersion, updaterService, appAction)
     {
         SecurityProtocolType = System.Net.SecurityProtocolType.Tls12,
         AppCastHandler       = new IronyAppCast(isInstallerVersion, updaterService),
         Configuration        = new UpdaterConfiguration(new EntryAssemblyAccessor()),
         TmpDownloadFilePath  = StaticResources.GetUpdaterPath().FirstOrDefault()
     };
     updater.DownloadStarted += (sender, path) =>
     {
         progress.OnNext(0);
     };
     updater.DownloadHadError += (sender, path, exception) =>
     {
         if (exception.Message != lastException?.Message)
         {
             error.OnNext(exception);
             lastException = exception;
         }
     };
     updater.DownloadMadeProgress += (sender, item, progress) =>
     {
         this.progress.OnNext(progress.ProgressPercentage);
     };
     updater.DownloadFinished += (sender, path) =>
     {
         updatePath = path;
         progress.OnNext(100);
     };
     updateProgressHandler.Subscribe(s =>
     {
         progress.OnNext(s.Progress);
     });
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MergeViewerControlViewModel" /> class.
 /// </summary>
 /// <param name="appAction">The application action.</param>
 public MergeViewerControlViewModel(IAppAction appAction)
 {
     this.appAction = appAction;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShortcutsControlViewModel" /> class.
 /// </summary>
 /// <param name="dlcManager">The DLC manager.</param>
 /// <param name="appAction">The application action.</param>
 /// <param name="gameService">The game service.</param>
 public ActionsControlViewModel(DLCManagerControlViewModel dlcManager, IAppAction appAction, IGameService gameService)
 {
     this.appAction   = appAction;
     this.gameService = gameService;
     DLCManager       = dlcManager;
 }