public ExportedLibraryDto(string name, string uniqueId, string coverFileId, List <ExportedVideoSimpleDto> videos, List <ExportedCharacterSimpleDto> characters, List <ExportedCharacterSimpleDto> creators, List <ExportedSeriesSimpleDto> series, List <ExportedPublisherSimpleDto> publishers, List <ExportedLocationSimpleDto> locations, List <Calendar> calendars, List <ExportedPlaylistSimpleDto> playlists, List <Tag> characterTags, List <Tag> videoTags, List <MediaFile> files, List <ExportedSeriesSequenceSimpleDto> seriesSequences, List <SeriesTagExportDto> tagsOnSeries, List <VideoTagExportDto> tagsOnVideos, List <FileTagExportDto> tagsOnFiles, List <CharacterTagExportDto> tagsOnCharacters, List <VideoMediaFilesExportDto> filesOnVideos, List <FileLocationExportDto> filesOnLocations, List <CharacterMediaFilesExportDto> filesOnCharacters, List <VideosInSequencesExportDto> videosInSeriesSequences, List <VideosInSequencesExportDto> videosInPlaylists, List <VideoLocationExportDto> videosOnLocations, List <VideoCharacterActorExportDto> charactersInVideos, List <VideoCreatorExportDto> videoCreators, LibrarySettings settings) { Name = name; UniqueId = uniqueId; CoverFileId = coverFileId; Videos = videos; Characters = characters; Creators = creators; Series = series; Publishers = publishers; Locations = locations; Calendars = calendars; Playlists = playlists; CharacterTags = characterTags; VideoTags = videoTags; Files = files; SeriesSequences = seriesSequences; TagsOnSeries = tagsOnSeries; TagsOnVideos = tagsOnVideos; TagsOnFiles = tagsOnFiles; TagsOnCharacters = tagsOnCharacters; FilesOnVideos = filesOnVideos; FilesOnLocations = filesOnLocations; FilesOnCharacters = filesOnCharacters; VideosInSeriesSequences = videosInSeriesSequences; VideosInPlaylists = videosInPlaylists; VideosOnLocations = videosOnLocations; CharactersInVideos = charactersInVideos; VideoCreators = videoCreators; Settings = settings; }
public LibraryCategoryService( LibrarySettings librarySettings, CommonSettings commonSettings, IAclService aclService, ICacheManager cacheManager, IDataProvider dataProvider, IDbContext dbContext, IEventPublisher eventPublisher, ILocalizationService localizationService, IRepository <AclRecord> aclRepository, IRepository <LibraryCategory> categoryRepository, IRepository <StoreMapping> storeMappingRepository, IStaticCacheManager staticCacheManager, IStoreContext storeContext, IStoreMappingService storeMappingService, IWorkContext workContext) { _librarySettings = librarySettings; _commonSettings = commonSettings; _aclService = aclService; _cacheManager = cacheManager; _dataProvider = dataProvider; _dbContext = dbContext; _eventPublisher = eventPublisher; _localizationService = localizationService; _aclRepository = aclRepository; _categoryRepository = categoryRepository; _storeMappingRepository = storeMappingRepository; _staticCacheManager = staticCacheManager; _storeContext = storeContext; _storeMappingService = storeMappingService; _workContext = workContext; }
static void Main(string[] args) { var utilsManager = new Manager() .UploadCombo("combo.txt") .UploadProxies("proxies.txt"); var settings = new LibrarySettings(TitlePreffix: "Test Checker") { proxyType = ProxyType.HTTP, Threads = 500, Timeout = 8000, MethodCheck = testMethod, UtilsManager = utilsManager, ListeningKeys = new ListeningKeys(Enable: true) { GetCheckedLines = ConsoleKey.C, // uncheckedlines.txt GetUncheckedLines = ConsoleKey.S // checkedlines.txt } }; new ByteLibrary(settings) .Start(); Console.ReadLine(); }
/***************************************************/ /**** Public Constructors ****/ /***************************************************/ public static LibrarySettings LibrarySettings(SectionLibrary sectionLibrary = SectionLibrary.UK_Sections) { LibrarySettings librarySettings = new LibrarySettings(); librarySettings.SectionDatabase = sectionLibrary; return(librarySettings); }
public void UpdateLibrarySettings(long libraryId, LibrarySettings settings) { using (var db = DataAccessUtil.CreateSqlConnection()) { db.Open(); using (var txn = db.BeginTransaction()) { var command = new SqliteCommand($"UPDATE library_setting SET value = @Value WHERE library_id = {libraryId} AND name = @Key", db, txn); command.Parameters.AddWithValue("@Key", nameof(settings.PublisherLabel)); command.Parameters.AddWithValue("@Value", settings.PublisherLabel); command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.SeriesLabel); command.Parameters["@Value"].Value = settings.SeriesLabel; command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.CharacterLabel); command.Parameters["@Value"].Value = settings.CharacterLabel; command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.VideoLabel); command.Parameters["@Value"].Value = settings.VideoLabel; command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.VideoPreviewDateFormat); command.Parameters["@Value"].Value = settings.VideoPreviewDateFormat; command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.ShowCharacters); command.Parameters["@Value"].Value = settings.ShowCharacters.ToString(); command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.ShowCreators); command.Parameters["@Value"].Value = settings.ShowCreators.ToString(); command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.ShowLocations); command.Parameters["@Value"].Value = settings.ShowLocations.ToString(); command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.ShowPublishers); command.Parameters["@Value"].Value = settings.ShowPublishers.ToString(); command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.ShowSeries); command.Parameters["@Value"].Value = settings.ShowSeries.ToString(); command.ExecuteNonQuery(); command.Parameters["@Key"].Value = nameof(settings.ShowVideos); command.Parameters["@Value"].Value = settings.ShowVideos.ToString(); command.ExecuteNonQuery(); txn.Commit(); } } }
/***************************************************/ /**** Public Constructors ****/ /***************************************************/ public static LusasConfig LusasConfig(LibrarySettings librarySettings = null) { LusasConfig lusasConfig = new LusasConfig(); if (librarySettings != null) { lusasConfig.LibrarySettings = librarySettings; } return(lusasConfig); }
private List <T> ReadXmlFile <T>() where T : class { List <T> elements; var settings = new LibrarySettings(); var stream = new FileStream(PathStrings.FileToRead, FileMode.Open); using (stream) { elements = new LibraryReader <IElement>(stream, settings).Where(_ => _ is T).Cast <T>().ToList(); } return(elements); }
static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", false, true); var configuration = builder.Build(); var settings = new LibrarySettings(); configuration.GetSection("LibrarySettings").Bind(settings); var x = settings.SettingA; }
public void CanToWriteRealCollectioToRealFileTest() { List <IElement> library; var settings = new LibrarySettings(); var outSettings = new OutputSettings(); var stream = new FileStream(PathStrings.FileToRead, FileMode.Open); using (stream) { library = new LibraryReader <IElement>(stream, settings).ToList(); } stream = new FileStream(PathStrings.FileToWrite, FileMode.Create); using (stream) { var writer = new LibraryWriter <IElement>(library, settings); writer.WriteXElements(stream, outSettings); } }
public long UpsertLibrary(CreateLibraryDto dto, string uniqueId, LibrarySettings settings) { var libraryId = GetLibraryIdFromGUID(uniqueId); if (libraryId == DatabaseConstants.DEFAULT_ID) { libraryId = CreateLibrary(dto, uniqueId); } else { var library = new Library(libraryId, dto.Name, dto.BackgroundImageId, false, uniqueId); UpdateLibrary(library); } if (settings != null) { UpdateLibrarySettings(libraryId, settings); } return(libraryId); }
private List <T> ReadXmlString <T>(string xmlString, bool withFailSettings = false) where T : class { var settings = new LibrarySettings(); if (withFailSettings) { settings.MainElementName = null; } List <T> elements; var stream = new MemoryStream(); using (stream) { var writer = new StreamWriter(stream); writer.Write(xmlString); writer.Flush(); stream.Position = 0; elements = new LibraryReader <T>(stream, settings).ToList(); } return(elements); }
public LibraryCategoryModelFactory(LibrarySettings catalogSettings, IAclSupportedModelFactory aclSupportedModelFactory, IBaseAdminModelFactory baseAdminModelFactory, ILibraryCategoryService categoryService, IDiscountService discountService, IDiscountSupportedModelFactory discountSupportedModelFactory, ILocalizationService localizationService, ILocalizedModelFactory localizedModelFactory, IStoreMappingSupportedModelFactory storeMappingSupportedModelFactory, IUrlRecordService urlRecordService) { _catalogSettings = catalogSettings; _aclSupportedModelFactory = aclSupportedModelFactory; _baseAdminModelFactory = baseAdminModelFactory; _categoryService = categoryService; _discountService = discountService; _discountSupportedModelFactory = discountSupportedModelFactory; _localizationService = localizationService; _localizedModelFactory = localizedModelFactory; _storeMappingSupportedModelFactory = storeMappingSupportedModelFactory; _urlRecordService = urlRecordService; }
private string WriteXmlString <T>(List <T> collecton, bool withFailSettings = false) where T : class { var outSettings = new OutputSettings(); var settings = new LibrarySettings(); if (withFailSettings) { settings.MainElementName = null; } var stream = new MemoryStream(); string result; using (stream) { var writer = new LibraryWriter <T>(collecton, settings); writer.WriteXElements(stream, outSettings); stream.Position = 0; result = new StreamReader(stream).ReadToEnd(); } return(result); }
public void ConvertLibrarySettings(LibrarySettings target) { target.SearchSettings.Clear(); this.oldSettings.librarySettings.SearchSettings .ForEach(x => target.SearchSettings.Add(this.ConvertSearch(x))); target.FavoriteSearch.Clear(); this.oldSettings.librarySettings.FavoriteSearch .Reverse <SparkImageViewer.FileSearch.SearchInformation>() .ForEach(x => target.FavoriteSearch.Add(this.ConvertSearch(x))); target.DefaultSort.Clear(); this.oldSettings.librarySettings.DefaultSort .ForEach(x => target.DefaultSort.Add(this.ConvertSort(x))); target.DefaultGroupSort.Clear(); this.oldSettings.librarySettings.DefaultGroupSort .ForEach(x => target.DefaultGroupSort.Add(this.ConvertSort(x))); target.IsGroupingEnabled = this.oldSettings.IsGroupingEnabled; target.RefreshLibraryCompletely = this.oldSettings.RefreshLibraryCompletely; }
public async Task Start2(LibrarySettings libSettings, Library library, TypedTable <Record, string> records, Action <int> OnLoaded, Action <int> OnAdding) { this.ConvertLibrarySettings(libSettings); library.InitializeLibrarySettings(libSettings); this.ConvertLibraryData(library); var ignored = new HashSet <TagInformation>(); var tagMax = this.Tags.Max(x => x.Key); for (int i = 1; i <= tagMax; i++) { TagInformation tag; if (!this.Tags.TryGetValue(i, out tag)) { tag = new TagInformation() { IsIgnored = false, Name = i.ToString(), }; ignored.Add(tag); } var newKey = library.Tags.SetTag(tag); } //this.Tags.OrderBy(x=>x.Key).ForEach(x => library.Tags.SetTag(x.Value)); ignored.ForEach(x => x.IsIgnored = true); await Task.Delay(1000); await this.ConvertFileDatabase(library, records, OnLoaded, OnAdding); }
public BusinessLogic(IOptionsSnapshot <LibrarySettings> settings) { _settings = settings.Value; }
private async Task <Library> CreateLibraryAsync() { LibraryOwner.Reset(); //this.settings?.Folders?.Clear(); this.FileEnumerator?.Clear(); var path = System.IO.Directory.GetCurrentDirectory(); var config = new LibraryConfigurationDummy(path); this.FileEnumerator = new Dictionary <string, FolderContainerDummy>();// = new FolderAccesserDummy(); //config.FolderAccesser = this.FileEnumerator; config.GetChildFoldersFunction = s => { var key = s.TrimEnd(System.IO.Path.DirectorySeparatorChar); if (!this.FileEnumerator.ContainsKey(key)) { Debug.WriteLine(key); this.FileEnumerator.ForEach(x => Debug.WriteLine(x.Key + "," + x.Value.Path)); return(null); } return(this.FileEnumerator[key] .Folders?.Select(x => x.Value.Path) ?? new string[0]); }; config.GetFolderFunction = s => { var key = s.TrimEnd(System.IO.Path.DirectorySeparatorChar); FolderContainerDummy f; this.FileEnumerator.TryGetValue(key, out f); return(f); }; this.config = config; LibraryOwner.SetConfig(config); //config.Folders.Add(folder); //config.FileExistingChecker = _ => false; var library = LibraryOwner.GetCurrent(); this.settings = new LibrarySettings() { Version = 10, }; library.InitializeLibrarySettings(settings); await library.LoadAsync(); await library.ClearAsync(); data.ForEach((x, c) => { var f = LoadTestData(x); this.AddFolder(f); library.Folders.Add(new FolderInformation(f.Path)); }); await library.RefreshLibraryAsync(true); var search = new SearchInformation(new ComplexSearch(false)); library.Searcher.AddSearchToDictionary(search); return(library); }