예제 #1
0
 public UserManager(IUnitOfWork unitOfWork,
                    IUserRepository repository,
                    IMachineRepository machineRepository,
                    IItemRepository itemRepository,
                    IUserFileRepository userFileRepository,
                    IConfigurationRepository configRepository,
                    IInitRepository initRepository,
                    ICNCLibUserContext userContext,
                    ICurrentDateTime currentDate,
                    IMapper mapper,
                    IOneWayPasswordProvider passwordProvider,
                    CallStatisticCache callStatisticCache) : base(unitOfWork, repository, mapper)
 {
     _unitOfWork         = unitOfWork;
     _repository         = repository;
     _machineRepository  = machineRepository;
     _itemRepository     = itemRepository;
     _configRepository   = configRepository;
     _userFileRepository = userFileRepository;
     _initRepository     = initRepository;
     _userContext        = userContext;
     _currentDate        = currentDate;
     _mapper             = mapper;
     _passwordProvider   = passwordProvider;
     _callStatisticCache = callStatisticCache;
 }
예제 #2
0
 public BackupSettings(
     IFileSystem fileSystem,
     IInitRepository initRepository,
     IProvideRepositoryCheckouts repositoryCheckouts,
     IGuiSettingsPath guiPaths,
     IPipelineSettingsPath paths)
 {
     _fileSystem          = fileSystem;
     _initRepository      = initRepository;
     _repositoryCheckouts = repositoryCheckouts;
     _guiPaths            = guiPaths;
     _paths = paths;
 }
예제 #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              UserManager <ApplicationUser> userManager,
                              RoleManager <IdentityRole> roleManager,
                              IGenreRepository genrerepo,
                              IPostRepository postrepo,
                              IMovieRepository movierepo,
                              IRatingRepository ratingrepo,
                              IInitRepository initrepo,
                              IMovieGenreRepository moviegenrerepo)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();
            app.UseResponseCaching();

            app.UseAuthentication();
            app.UseAuthorization();

            SeedData.Seed(userManager, roleManager, genrerepo, movierepo, postrepo, ratingrepo, initrepo, moviegenrerepo);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");

                /*
                 * endpoints.MapControllerRoute(
                 *  name: "genres",
                 *  pattern: "Movies/Index/{genre}/{id}");
                 * endpoints.MapControllerRoute(
                 *  name: "orderBy",
                 *  pattern: "Movies/Index/{mode}");*/

                endpoints.MapRazorPages();
            });
        }
예제 #4
0
        public static void Seed(UserManager <ApplicationUser> userManager,
                                RoleManager <IdentityRole> roleManager,
                                IGenreRepository genrerepo,
                                IMovieRepository movierepo,
                                IPostRepository postrepo,
                                IRatingRepository ratingrepo,
                                IInitRepository initrepo,
                                IMovieGenreRepository moviegenrerepo)
        {
            var alreadyInit = SeedInit(initrepo);

            if (alreadyInit)
            {
                return;
            }
            SeedRoles(roleManager);
            SeedUsers(userManager);
            SeedGenres(genrerepo);
            SeedMovies(movierepo, moviegenrerepo);
            SeedPosts(postrepo, movierepo);
            SeedRatings(ratingrepo);
        }
예제 #5
0
        public PatcherUserSettingsVm(
            ILogger logger,
            IProfileLoadOrder loadOrder,
            IProfileSimpleLinkCacheVm linkCacheVm,
            IObservable <Inputs> source,
            bool needBuild,
            IInitRepository initRepository,
            IProvideAutogeneratedSettings autoGenSettingsProvider,
            IProvideRepositoryCheckouts repoCheckouts,
            IGetSettingsStyle getSettingsStyle,
            IExecuteOpenForSettings executeOpenForSettings,
            IOpenSettingsHost openSettingsHost)
        {
            _logger                = logger;
            _initRepository        = initRepository;
            _repoCheckouts         = repoCheckouts;
            _settingsConfiguration = source
                                     .Select(i =>
            {
                return(Observable.Create <SettingsConfiguration>(async(observer, cancel) =>
                {
                    observer.OnNext(new SettingsConfiguration(SettingsStyle.None, Array.Empty <ReflectionSettingsConfig
                                                                                               >()));
                    if (i.ProjPath.Failed)
                    {
                        return;
                    }

                    try
                    {
                        var result = await getSettingsStyle.Get(
                            i.ProjPath.Value,
                            directExe: false,
                            cancel: cancel,
                            buildMetaPath: i.MetaPath,
                            build: needBuild).ConfigureAwait(false);
                        logger.Information($"Settings type: {result}");
                        observer.OnNext(result);
                    }
                    catch (Exception ex)
                    {
                        logger.Error($"Error checking if patcher can open settings: {ex}");
                    }
                    observer.OnCompleted();
                }));
            })
                                     .Switch()
                                     .ToGuiProperty(this, nameof(SettingsConfiguration), new SettingsConfiguration(SettingsStyle.None, Array.Empty <ReflectionSettingsConfig>()), deferSubscription: true);

            OpenSettingsCommand = NoggogCommand.CreateFromObject(
                objectSource: Observable.CombineLatest(
                    source.Select(x => x.ProjPath),
                    this.WhenAnyValue(x => x.SettingsConfiguration),
                    (Proj, Conf) => (Proj, Conf)),
                canExecute: x => x.Proj.Succeeded &&
                (x.Conf.Style == SettingsStyle.Open || x.Conf.Style == SettingsStyle.Host),
                execute: async(o) =>
            {
                if (o.Conf.Style == SettingsStyle.Open)
                {
                    await executeOpenForSettings.Open(
                        o.Proj.Value,
                        directExe: false,
                        cancel: CancellationToken.None,
                        loadOrder: loadOrder.LoadOrder.Items.Select <ReadOnlyModListingVM, IModListingGetter>(lvm => lvm)).ConfigureAwait(false);
                }
                else
                {
                    await openSettingsHost.Open(
                        path: o.Proj.Value,
                        cancel: CancellationToken.None,
                        loadOrder: loadOrder.LoadOrder.Items.Select <ReadOnlyModListingVM, IModListingGetter>(lvm => lvm)).ConfigureAwait(false);
                }
            },
                disposable: this);

            _settingsOpen = OpenSettingsCommand.IsExecuting
                            .ToGuiProperty(this, nameof(SettingsOpen), deferSubscription: true);

            _reflectionSettings = Observable.CombineLatest(
                this.WhenAnyValue(x => x.SettingsConfiguration),
                source.Select(x => x.ProjPath),
                (SettingsConfig, ProjPath) => (SettingsConfig, ProjPath))
                                  .Select(x =>
            {
                if (x.ProjPath.Failed ||
                    x.SettingsConfig.Style != SettingsStyle.SpecifiedClass ||
                    x.SettingsConfig.Targets.Length == 0)
                {
                    return(default(AutogeneratedSettingsVm?));
                }
                return(autoGenSettingsProvider.Get(x.SettingsConfig,
                                                   projPath: x.ProjPath.Value,
                                                   loadOrder: loadOrder.LoadOrder.Connect().Transform <ReadOnlyModListingVM, IModListingGetter>(x => x),
                                                   linkCache: linkCacheVm.WhenAnyValue(x => x.SimpleLinkCache)));
            })
                                  .ToGuiProperty <AutogeneratedSettingsVm?>(this, nameof(ReflectionSettings), initialValue: null, deferSubscription: true);
        }
예제 #6
0
 private static bool SeedInit(IInitRepository initRepository)
 {
     return(initRepository.IsInit());
 }
예제 #7
0
 public InitService(IInitRepository repository) : base(repository)
 {
     _repository = repository;
 }