private static void TestPsnCustomConfigsStorage(string filename) { var sf = new StreamedFile(filename); var psnStorage = new PsnDataCustomConfigurationsStorageRelayMemoryCache(new PsnDataCustomConfigurationsStorageXDocument(sf, sf)); psnStorage.Add(new IdentifierStringToLowerBased("Hello"), new IdentifierStringToLowerBased("World"), "VeryInfromativePsnLog #1"); }
/// <summary> /// Получает ссылку на репозиторий в локальной директории /// </summary> /// <param name="directoryPath">Путь к директории</param> /// <returns>Ссылка на репозиторий</returns> public IRepository GetLocalDirectoryRepository(string directoryPath) { var streamableFileForPsnDataInfoStorage = new StreamedFile(Path.Combine(directoryPath, "PsnDataInformationStorage.xml")); var streamableFileForDeviceInformationStorage = new StreamedFile(Path.Combine(directoryPath, "DeviceInformationStorage.xml")); var streamableFileForPsnDataCustomConfigStorage = new StreamedFile(Path.Combine(directoryPath, "PsnDataCustomConfigrationStorage.xml")); var bw = new BackgroundQueueWorker <Action>(a => a()); return(new RelayRepository(_psnInternalConfigurations.Value, () => { try { return new ReposetoryOpenedResultSimple( new StreamedDataStorageRelayMemoryCache(new StreamReadableDataStorageLocalDir(directoryPath)), new PsnDataInformationStorageRelayMemoryCache(new PsnDataInformationStorageXDocument(streamableFileForPsnDataInfoStorage, streamableFileForPsnDataInfoStorage)), new DeviceInformationStorageRelayMemoryCache(new DeviceInformationStorageXDocument(streamableFileForDeviceInformationStorage, streamableFileForDeviceInformationStorage)), new PsnDataCustomConfigurationsStorageRelayMemoryCache(new PsnDataCustomConfigurationsStorageXDocument(streamableFileForPsnDataCustomConfigStorage, streamableFileForPsnDataCustomConfigStorage)), new PsnInternalConfigurationsStorageRelay(_psnInternalConfigurations.Value)); } catch (Exception ex) { throw new Exception("Не удалось открыть репозиторий по указанному пути: " + directoryPath, ex); } } , new KeyValueStorageHolderXml() , bw , bw , "DIR@" + directoryPath)); }