public static async Task CreateCatalogAsync(string root, string feedRoot, string nupkgFolder, Uri baseUri, ILogger log) { using (var cache = new LocalCache()) { var sleetConfig = CreateSleetConfig(root, feedRoot, baseUri); var settings = LocalSettings.Load(sleetConfig); var fileSystem = FileSystemFactory.CreateFileSystem(settings, cache, "feed"); var success = await InitCommand.RunAsync(settings, fileSystem, enableCatalog : true, enableSymbols : false, log : log, token : CancellationToken.None); if (success != true) { throw new InvalidOperationException("Catalog init failed"); } if (Directory.GetFiles(nupkgFolder).Any()) { success = await PushCommand.PushPackages(settings, fileSystem, new List <string>() { nupkgFolder }, false, false, log, CancellationToken.None); if (success != true) { throw new InvalidOperationException("Push failed"); } } } }
public static async Task CreateCatalogAsync(string root, string feedRoot, string nupkgFolder, Uri baseUri, int catalogPageSize, ILogger log) { using (var cache = new LocalCache()) { var sleetConfig = CreateSleetConfig(root, feedRoot, baseUri); var settings = LocalSettings.Load(sleetConfig); var fileSystem = FileSystemFactory.CreateFileSystem(settings, cache, "feed"); var feedSettings = await FeedSettingsUtility.GetSettingsOrDefault(fileSystem, log, CancellationToken.None); feedSettings.CatalogEnabled = true; feedSettings.SymbolsEnabled = false; feedSettings.CatalogPageSize = catalogPageSize; var success = await InitCommand.InitAsync(settings, fileSystem, feedSettings, log, CancellationToken.None); if (success != true) { throw new InvalidOperationException("Catalog init failed"); } if (Directory.GetFiles(nupkgFolder).Any()) { success = await PushCommand.PushPackages(settings, fileSystem, new List <string>() { nupkgFolder }, false, false, log, CancellationToken.None); if (success != true) { throw new InvalidOperationException("Push failed"); } } } }
/// <inheritdoc /> public async Task <LoadResult> LoadFile(IStateInfo stateInfo, ArchiveFileInfo afi, Guid pluginId, LoadFileContext loadFileContext) { // If stateInfo is no archive state if (!(stateInfo.PluginState is IArchiveState archiveState)) { throw new InvalidOperationException("The state represents no archive."); } // If file is already loaded var absoluteFilePath = UPath.Combine(stateInfo.AbsoluteDirectory, stateInfo.FilePath.ToRelative(), afi.FilePath.ToRelative()); if (IsLoaded(absoluteFilePath)) { return(new LoadResult(GetLoadedFile(absoluteFilePath))); } // 1. Create file system action var fileSystemAction = new Func <IStreamManager, IFileSystem>(streamManager => FileSystemFactory.CreateAfiFileSystem(stateInfo, UPath.Root, streamManager)); // 2. Load file // ArchiveFileInfos have stateInfo as their parent, if loaded like this var loadResult = await LoadFile(fileSystemAction, afi.FilePath, stateInfo, pluginId, loadFileContext); if (!loadResult.IsSuccessful) { return(loadResult); } // 3. Add archive child to parent // ArchiveChildren are only added, if a file is loaded like this stateInfo.ArchiveChildren.Add(loadResult.LoadedState); return(loadResult); }
private static void FillSources(IList <IFileSystemInfo> sources, IList <string> scripts) { foreach (var script in scripts) { sources.Add(FileSystemFactory.FileSystemInfoFromPath(script)); } }
public override void Connect(IReadOnlyCollection <Component> instanceComponents) { Logger.Instance.Log(LogLevel.Info, "\nConfiguring components ({0}, {1}, {2}, {3}) to work with component({4}):\n", ESAgentComponentId, ESIndexComponentId, ESZookeeperComponentId, ESFileProcessorComponentId, DatabaseComponentId); ESAgentComponent esAgent = instanceComponents.Single(c => c.Id == ESAgentComponentId) as ESAgentComponent; ESIndexComponent esIndex = instanceComponents.Single(c => c.Id == ESIndexComponentId) as ESIndexComponent; ESZooKeeperComponent esZooKeeper = instanceComponents.Single(c => c.Id == ESZookeeperComponentId) as ESZooKeeperComponent; ESFileProcessorComponent esFileProcessor = instanceComponents.Single(c => c.Id == ESFileProcessorComponentId) as ESFileProcessorComponent; DatabaseComponent databaseComponent = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent; DropSolrIndex(esIndex); string serviceNameXPath = "/configuration/ServiceName"; esFileProcessor.ServiceName = FileSystemFactory.GetFileSystem(esFileProcessor.ServerName).XmlHelper.XmlPeek(esFileProcessor.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esFileProcessor.ServerName, esFileProcessor.ServiceName); esAgent.ServiceName = FileSystemFactory.GetFileSystem(esAgent.ServerName).XmlHelper.XmlPeek(esAgent.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esAgent.ServerName, esAgent.ServiceName); esIndex.ServiceName = FileSystemFactory.GetFileSystem(esIndex.ServerName).XmlHelper.XmlPeek(esIndex.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esIndex.ServerName, esIndex.ServiceName); esZooKeeper.ServiceName = FileSystemFactory.GetFileSystem(esZooKeeper.ServerName).XmlHelper.XmlPeek(esZooKeeper.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esZooKeeper.ServerName, esZooKeeper.ServiceName); //Wait Until services are stopped for 30 seconds Thread.Sleep(30000); HttpServerConnection connection = IomFactory.CreateHttpServerConnection(databaseComponent.InnovatorUrl, databaseComponent.DatabaseName, databaseComponent.LoginOfRootInnovatorUser, databaseComponent.PasswordOfRootInnovatorUser.Value); try { connection.Login(); Innovator innovator = new Innovator(connection); EditVariable(innovator, "ES_SolrUrl", esIndex.ESAIClusterUrl); EditVariable(innovator, "ES_AIClusterUrl", esIndex.ESAIClusterUrl); EditCryptoPwd(innovator, esAgent); } finally { connection.Logout(); } UpdateESZooKeeperServiceConfig(esZooKeeper, databaseComponent); WindowsServiceHelper.StartService(esZooKeeper.ServerName, esZooKeeper.ServiceName); UpdateESIndexServiceConfig(esIndex, databaseComponent); WindowsServiceHelper.StartService(esIndex.ServerName, esIndex.ServiceName); UpdateESAgentServiceConfig(esAgent, databaseComponent); WindowsServiceHelper.StartService(esAgent.ServerName, esAgent.ServiceName); UpdateESFileProcessorServiceConfig(esFileProcessor, databaseComponent); WindowsServiceHelper.StartService(esFileProcessor.ServerName, esFileProcessor.ServiceName); ReloadSolrCollection(esIndex); }
private async Task Execute() { txtLog.Clear(); Logger.StartLogging(); ToggleUi(false); if (!VerifyInput()) { Logger.StopLogging(); ToggleUi(true); return; } var selectedPlugin = (PluginElement)cmbPlugins.SelectedItem; _batchProcessor.PluginId = selectedPlugin.IsEmpty ? Guid.Empty : selectedPlugin.Plugin.PluginId; _batchProcessor.ScanSubDirectories = chkSubDirectories.Checked; var sourceFileSystem = FileSystemFactory.CreatePhysicalFileSystem(txtSourcePath.Text, new StreamManager()); var destinationFileSystem = FileSystemFactory.CreatePhysicalFileSystem(txtDestinationPath.Text, new StreamManager()); await _batchProcessor.Process(sourceFileSystem, destinationFileSystem); ToggleUi(true); }
public async Task LocalFeed_RelativePath_DefaultSleetJson() { var originalWorkingDir = Directory.GetCurrentDirectory(); using (var target = new TestFolder()) using (var cache = new LocalCache()) { var baseUri = UriUtility.CreateUri("https://localhost:8080/testFeed/"); var log = new TestLogger(); var sleetConfig = TestUtility.CreateConfigWithLocal("local", "output", baseUri.AbsoluteUri); var sleetConfigPath = Path.Combine(target.Root, "sleet.json"); await JsonUtility.SaveJsonAsync(new FileInfo(sleetConfigPath), sleetConfig); try { Directory.SetCurrentDirectory(target.Root); //Load sleet.json file from working directory var settings = LocalSettings.Load(path: null); var fileSystem = await FileSystemFactory.CreateFileSystemAsync(settings, cache, "local") as PhysicalFileSystem; fileSystem.Should().NotBeNull(); fileSystem.LocalRoot.Should().Be(Path.Combine(target.Root, "output") + Path.DirectorySeparatorChar); } finally { Directory.SetCurrentDirectory(originalWorkingDir); } } }
public void Detect_Invalid_ReturnsEmpty() { var factory = new FileSystemFactory(); Assert.Empty(factory.Detect(null, null)); Assert.Empty(factory.Detect(Stream.Null, null)); }
static Core() { KernelName = "KernelOne"; FileSystemFactory fileSystemFactory = new FileSystemFactory(); //fileSystemFactory.Create(new Cosmos.HAL.BlockDevice.Partition()); }
public void Configuration(IAppBuilder app) { // Setup logger for CKFinder LoggerManager.LoggerAdapterFactory = new NLogLoggerAdapterFactory(); // TODO: Needs to be more secure? See: http://benfoster.io/blog/aspnet-webapi-cors // TODO: Editing images doesn't werk yet: 'Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.' // TODO: Do we want to use OWIN Cors for the complete API or do we want to use Web API Cors for the rest of the api // and only use OWIN for the CKFinder Mapping? We need to move it into the setup conenctor if we do. app.UseCors(CorsOptions.AllowAll); /* * Register the "local" type backend file system. */ FileSystemFactory.RegisterFileSystem <LocalStorage>(); /* * Map the CKFinder connector service under a given path. By default the CKFinder JavaScript * client expect the ASP.NET connector to be accessible under the "/ckfinder/connector" route. */ app.Map("/ckfinder/connector", SetupConnector); // Setup WebApi HttpConfiguration httpConfiguration = new HttpConfiguration(); WebApiConfig.Register(httpConfiguration); app.UseWebApi(httpConfiguration); }
public IList <JobFileContent> DownloadPartsOfJobFilesFromCluster(long submittedJobInfoId, TaskFileOffset[] taskFileOffsets, AdaptorUser loggedUser) { log.Info("Getting part of job files from cluster for submitted job info ID " + submittedJobInfoId + " with user " + loggedUser.GetLogIdentification()); SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); IRexFileSystemManager fileManager = FileSystemFactory.GetInstance(jobInfo.Specification.FileTransferMethod.Protocol).CreateFileSystemManager(jobInfo.Specification.FileTransferMethod); IList <JobFileContent> result = new List <JobFileContent>(); foreach (SubmittedTaskInfo taskInfo in jobInfo.Tasks) { IList <TaskFileOffset> currentTaskFileOffsets = (from taskFileOffset in taskFileOffsets where taskFileOffset.SubmittedTaskInfoId == taskInfo.Id select taskFileOffset).ToList(); foreach (TaskFileOffset currentOffset in currentTaskFileOffsets) { ICollection <JobFileContent> contents = fileManager.DownloadPartOfJobFileFromCluster(taskInfo, currentOffset.FileType, currentOffset.Offset); if (contents != null) { foreach (JobFileContent content in contents) { result.Add(content); } } } } return(result); }
private static void RegisterFileSystems() { FileSystemFactory.RegisterFileSystem <LocalStorage>(); FileSystemFactory.RegisterFileSystem <DropboxStorage>(); FileSystemFactory.RegisterFileSystem <AmazonStorage>(); FileSystemFactory.RegisterFileSystem <AzureStorage>(); }
public void TestInitialize() { //FileSystem = FileSystemFactory.CreateInMemory().Value; FileSystem = FileSystemFactory.MockSAFENetwork() .GetAwaiter() .GetResult() .Value; }
public RoleplayingDatabaseContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <RoleplayingDatabaseContext>(); new SchemaAwareDbContextService(new ContentService(FileSystemFactory.CreateContentFileSystem())) .ConfigureSchemaAwareContext <RoleplayingDatabaseContext>(optionsBuilder); return(new RoleplayingDatabaseContext(optionsBuilder.Options)); }
/// <inheritdoc /> public CharactersDatabaseContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <CharactersDatabaseContext>(); new ContextConfigurationService(new ContentService(FileSystemFactory.CreateContentFileSystem())) .ConfigureSchemaAwareContext <CharactersDatabaseContext>(optionsBuilder); return(new CharactersDatabaseContext(optionsBuilder.Options)); }
private void ExtractWith(IFileSystem sourceFileSystem, UPath filePath, Guid pluginId) { // Load file LoadResult loadResult; try { loadResult = pluginId == Guid.Empty ? _pluginManager.LoadFile(sourceFileSystem, filePath).Result : _pluginManager.LoadFile(sourceFileSystem, filePath, pluginId).Result; } catch (Exception e) { Console.WriteLine($"Batch Error: {filePath}: {e.Message}"); return; } if (!loadResult.IsSuccessful) { Console.WriteLine($"Batch Error: {filePath}: {loadResult.Message}"); return; } var absolutePath = (UPath)sourceFileSystem.ConvertPathToInternal(filePath); var destinationDirectory = absolutePath.GetDirectory() / absolutePath.GetName().Replace('.', '_'); var destinationFileSystem = FileSystemFactory.CreatePhysicalFileSystem(destinationDirectory, new StreamManager()); switch (loadResult.LoadedState.PluginState) { case IArchiveState archiveState: foreach (var afi in archiveState.Files) { var newFileStream = destinationFileSystem.OpenFile(afi.FilePath, FileMode.Create, FileAccess.Write); afi.GetFileData().Result.CopyTo(newFileStream); newFileStream.Close(); } break; case IImageState imageState: var index = 0; foreach (var img in imageState.Images) { var kanvasImage = new KanvasImage(imageState, img); kanvasImage.GetImage().Save(destinationDirectory + "/" + (img.Name ?? $"{index:00}") + ".png"); index++; } break; default: Console.WriteLine($"Batch Error: {filePath}: '{loadResult.LoadedState.PluginState.GetType().Name}' is not supported."); break; } _pluginManager.Close(loadResult.LoadedState); }
public void Configuration(IAppBuilder app) { FileSystemFactory.RegisterFileSystem <LocalStorage>(); /* * Map the CKFinder connector service under a given path. By default the CKFinder JavaScript * client expects the ASP.NET connector to be accessible under the "/ckfinder/connector" route. */ app.Map("/ckfinder/connector", SetupConnector); }
private static void UpdateESAgentServiceConfig(ESAgentComponent esAgent, DatabaseComponent databaseComponent) { string innovatorUrlXPath = "/configuration/Aras_Innovator_URL"; string innovatorDBPath = "/configuration/Aras_Innovator_DB"; IFileSystem targetFileSystem = FileSystemFactory.GetFileSystem(esAgent.ServerName); targetFileSystem.XmlHelper.XmlPoke(esAgent.PathToConfig, innovatorUrlXPath, databaseComponent.InnovatorUrl); targetFileSystem.XmlHelper.XmlPoke(esAgent.PathToConfig, innovatorDBPath, databaseComponent.DatabaseName); }
private static void UpdateESFileProcessorServiceConfig(ESFileProcessorComponent esFileProcessor, DatabaseComponent databaseComponent) { string innovatorUrlXPath = "/configuration/FileProcessor/ArasInnovatorURL"; string innovatorDBPath = "/configuration/FileProcessor/ArasInnovatorDB"; IFileSystem targetFileSystem = FileSystemFactory.GetFileSystem(esFileProcessor.ServerName); targetFileSystem.XmlHelper.XmlPoke(esFileProcessor.PathToConfig, innovatorUrlXPath, databaseComponent.InnovatorUrl); targetFileSystem.XmlHelper.XmlPoke(esFileProcessor.PathToConfig, innovatorDBPath, databaseComponent.DatabaseName); }
public ArchiveContext(ContextNode contextNode, IContext parentContext, IInternalPluginManager pluginManager) : base(pluginManager, contextNode) { ContractAssertions.IsNotNull(contextNode, nameof(contextNode)); ContractAssertions.IsNotNull(parentContext, nameof(parentContext)); _stateInfo = contextNode.StateInfo; _archiveState = _stateInfo.PluginState as IArchiveState; _archiveFileSystem = FileSystemFactory.CreateAfiFileSystem(_stateInfo); _parentContext = parentContext; }
/// <inheritdoc /> protected override void RegisterServices(IServiceCollection serviceCollection) { serviceCollection .AddDbContext <CoreDatabaseContext>(ConfigureOptions <CoreDatabaseContext>) .AddSingleton(FileSystemFactory.CreateContentFileSystem()) .AddSingleton <DelayedActionService>() .AddScoped <ContentService>() .AddScoped <UserFeedbackService>() .AddScoped <PrivacyService>(); }
public async Task <IList <AnmcNamedImageRessource> > Load(string file) { if (_archiveStateInfo != null) { Close(); } // Load archive _archiveStateInfo = await LoadArchive(file); // Load images var archiveFileSystem = FileSystemFactory.CreateAfiFileSystem(ArchiveState, UPath.Root, _archiveStateInfo.StreamManager); _imageStateInfos = await LoadImages(archiveFileSystem); // Load point mappings var mappings = await LoadPvb(archiveFileSystem); _pointMappings = await LoadPbis(archiveFileSystem, mappings); // Load RES.bin var nameIndices = await LoadResBin(archiveFileSystem); // Create image providers var imageStates = _imageStateInfos.Select(x => x.State as IImageState).ToArray(); var imageProviders = new ImageProvider[_imageStateInfos.Count]; for (var i = 0; i < imageProviders.Length; i++) { imageProviders[i] = new ImageProvider(new KanvasImage(imageStates[i], imageStates[i].Images[0])); } // Create final image ressources var result = new List <AnmcNamedImageRessource>(); for (var i = 0; i < Math.Min(_pointMappings.Count, nameIndices.Count); i++) { var nameIndex = nameIndices.First(x => x.Value.pbiIndex == i); var imageProvider = imageProviders[nameIndex.Value.imageIndex]; var partIndex = 0; var imageRessources = new List <AnmcImageRessource>(); for (var mappingIndex = 0; mappingIndex < _pointMappings[i].Count; mappingIndex += 6) { var points = _pointMappings[i].Skip(mappingIndex).Take(6).ToArray(); var imageRessource = new AnmcImageRessource(imageProvider, points, $"{nameIndex.Key} Part {partIndex++}"); imageRessources.Add(imageRessource); } result.Add(new AnmcNamedImageRessource(nameIndex.Key, imageRessources)); } return(result); }
public async Task NuGetReader_DownloadPackageAsync() { // Arrange using (var packagesFolder = new TestFolder()) using (var globalFolder = new TestFolder()) using (var target = new TestFolder()) using (var cache = new LocalCache()) { var outputRoot = Path.Combine(target.Root, "output"); var baseUri = UriUtility.CreateUri("https://localhost:8080/testFeed/"); var log = new TestLogger(); var testPackage = new TestNupkg("packageA", "1.0.0"); var sleetConfig = TestUtility.CreateConfigWithLocal("local", outputRoot, baseUri.AbsoluteUri); var sleetConfigPath = Path.Combine(target.Root, "sleet.config"); await JsonUtility.SaveJsonAsync(new FileInfo(sleetConfigPath), sleetConfig); var zipFile = testPackage.Save(packagesFolder.Root); var settings = LocalSettings.Load(sleetConfigPath); var fileSystem = await FileSystemFactory.CreateFileSystemAsync(settings, cache, "local"); var success = await InitCommand.RunAsync(settings, fileSystem, log); // Act // Run sleet success &= await PushCommand.RunAsync(settings, fileSystem, new List <string>() { packagesFolder.Root }, false, false, log); // Create a repository abstraction for nuget var nugetFileSystem = new PhysicalFileSystem(cache, UriUtility.CreateUri(outputRoot), baseUri); var localSource = GetSource(outputRoot, baseUri, nugetFileSystem); var resource = await localSource.GetResourceAsync <DownloadResource>(); var cacheContext = new SourceCacheContext() { NoCache = true }; var downloadContext = new PackageDownloadContext(cacheContext, globalFolder, directDownload: false); var result = await resource.GetDownloadResourceResultAsync(new PackageIdentity("packageA", NuGetVersion.Parse("1.0.0")), downloadContext, globalFolder, log, CancellationToken.None); // Assert Assert.True(success, log.ToString()); Assert.Equal(DownloadResourceResultStatus.Available, result.Status); Assert.True(result.PackageStream.Length > 0); Assert.Equal(new PackageIdentity("packageA", NuGetVersion.Parse("1.0.0")), result.PackageReader.GetIdentity()); } }
public void LoadFrom(string configurationFile) { try { var info = string.IsNullOrEmpty(configurationFile) ? null : FileSystemFactory.FileSystemInfoFromPath(configurationFile); LoadFrom(info); } catch (Exception ex) when((ex as IOException) == null) { throw new ConfigurationErrorsException("Fail to load configuration from [{0}].".FormatWith(configurationFile), ex); } }
public void CreateLogger_GivenFileSystem_ShouldCreateFileLogger() { // Arrange. ILoggerFactory factory = new FileSystemFactory(); // Act. ILogger logger = factory.CreateLogger(); // Assert. Assert.IsInstanceOf <FileLogger>(logger); Assert.IsNotInstanceOf <ConsoleLogger>(logger); }
private ISleetFileSystem GetAzureFileSystem(LocalCache fileCache) { try { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(source.ConnectionString); return(new AzureFileSystem(fileCache, new Uri(source.Path), new Uri(source.Path), storageAccount, source.Name, source.FeedSubPath)); } catch { return(FileSystemFactory.CreateFileSystem(GetSettings(), fileCache, source.Name)); } }
public ArchiveForm(IStateInfo stateInfo, IArchiveFormCommunicator communicator, PluginManager pluginManager, IProgressContext progress) { InitializeComponent(); _stateInfo = stateInfo; _communicator = communicator; _pluginManager = pluginManager; _progress = progress; _archiveFileSystem = FileSystemFactory.CreateAfiFileSystem(stateInfo); _openingFiles = new List <IArchiveFileInfo>(); _changedDirectories = new HashSet <UPath>(); _selectedPath = UPath.Root; _searchTerm = new SearchTerm(searchTextBox); _searchTerm.TextChanged += searchTerm_TextChanged; _asyncOperation = new AsyncOperation(); _asyncOperation.Started += asyncOperation_Started; _asyncOperation.Finished += asyncOperation_Finished; folderView.Expanded += folderView_Expanded; folderView.Collapsed += folderView_Collapsed; folderView.CellFormatting += folderView_CellFormatting; folderView.SelectedItemChanged += folderView_SelectedItemChanged; fileView.SelectedItemsChanged += fileView_SelectedItemsChanged; fileView.CellDoubleClick += fileView_CellDoubleClick; fileView.CellFormatting += fileView_CellFormatting; searchClearCommand.Executed += searchClearCommand_Executed; cancelCommand.Executed += cancelCommand_Executed; saveCommand.Executed += SaveCommand_Executed; saveAsCommand.Executed += SaveAsCommand_Executed; openCommand.Executed += openCommand_Executed; extractFileCommand.Executed += extractFileCommand_Executed; replaceFileCommand.Executed += replaceFileCommand_Executed; renameFileCommand.Executed += RenameFileCommand_Executed; deleteFileCommand.Executed += DeleteFileCommand_Executed; extractDirectoryCommand.Executed += extractDirectoryCommand_Executed; replaceDirectoryCommand.Executed += replaceDirectoryCommand_Executed; renameDirectoryCommand.Executed += renameDirectoryCommand_Executed; addDirectoryCommand.Executed += addDirectoryCommand_Executed; deleteDirectoryCommand.Executed += deleteDirectoryCommand_Executed; UpdateProperties(); LoadDirectories(); UpdateFiles(_selectedPath); }
/// <inheritdoc /> public Task <LoadResult> LoadFile(Stream stream, UPath streamName, Guid pluginId, LoadFileContext loadFileContext) { // We don't check for an already loaded file here, since that should never happen // 1. Create file system action var fileSystemAction = new Func <IStreamManager, IFileSystem>(streamManager => FileSystemFactory.CreateMemoryFileSystem(stream, streamName, streamManager)); // 2. Load file // A stream has no parent, since it should never occur to be loaded from somewhere deeper in the system return(LoadFile(fileSystemAction, streamName, null, pluginId, loadFileContext)); }
/// <inheritdoc /> protected override void RegisterServices(IServiceCollection serviceCollection) { serviceCollection.AddDbContext <CoreDatabaseContext>(ConfigureOptions <CoreDatabaseContext>); serviceCollection .AddSingleton(FileSystemFactory.CreateContentFileSystem()) .AddSingleton <DelayedActionService>() .AddScoped <ContentService>() .AddScoped <UserFeedbackService>() .AddScoped <PrivacyService>() .AddLogging(c => c.AddProvider(NullLoggerProvider.Instance)); }
public ICollection <FileInformation> ListChangedFilesForJob(long submittedJobInfoId, AdaptorUser loggedUser) { SubmittedJobInfo jobInfo = LogicFactory.GetLogicFactory().CreateJobManagementLogic(unitOfWork).GetSubmittedJobInfoById(submittedJobInfoId, loggedUser); if (jobInfo.State < JobState.Submitted || jobInfo.State == JobState.WaitingForServiceAccount) { return(null); } IRexFileSystemManager fileManager = FileSystemFactory.GetInstance(jobInfo.Specification.FileTransferMethod.Protocol).CreateFileSystemManager(jobInfo.Specification.FileTransferMethod); return(fileManager.ListChangedFilesForJob(jobInfo, jobInfo.SubmitTime.Value)); }
public FileSystemSync(FileSystemFactory fileSystemFactory) { _fileSystemFactory = fileSystemFactory; }