public TextGenerator( ITemplateLoader templateLoader, IVirtualFileProvider virtualFileProvider) { _templateLoader = templateLoader; _virtualFileProvider = virtualFileProvider; }
public EffectCompiler(IVirtualFileProvider fileProvider) { FileProvider = fileProvider; NativeLibrary.PreloadLibrary("d3dcompiler_47.dll"); SourceDirectories = new List <string>(); UrlToFilePath = new Dictionary <string, string>(); }
public AbpComponentDemoSectionTagHelper( IVirtualFileProvider virtualFileProvider, IGuidGenerator guidGenerator) { _virtualFileProvider = virtualFileProvider; _guidGenerator = guidGenerator; }
public FileOdbBackend(string vfsRootUrl, string indexName, bool isReadOnly) { var resolveProviderResult = VirtualFileSystem.ResolveProvider(vfsRootUrl, true); virtualFileProvider = resolveProviderResult.Provider; this.vfsRootUrl = resolveProviderResult.Path; vfsTempUrl = this.vfsRootUrl + TempDirectory; // Ensure directories exists if (!virtualFileProvider.DirectoryExists(this.vfsRootUrl)) { virtualFileProvider.CreateDirectory(this.vfsRootUrl); } IsReadOnly = isReadOnly; contentIndexMap = !string.IsNullOrEmpty(indexName) ? Serialization.Contents.ContentIndexMap.Load(vfsRootUrl + VirtualFileSystem.DirectorySeparatorChar + indexName, isReadOnly) : Serialization.Contents.ContentIndexMap.CreateInMemory(); if (!isReadOnly && !virtualFileProvider.DirectoryExists(vfsTempUrl)) { try { virtualFileProvider.CreateDirectory(vfsTempUrl); } catch (Exception) { IsReadOnly = true; } } }
public FileOdbBackend(string vfsRootUrl, bool isReadOnly, string indexName = "index") { var resolveProviderResult = VirtualFileSystem.ResolveProvider(vfsRootUrl, true); virtualFileProvider = resolveProviderResult.Provider; this.vfsRootUrl = resolveProviderResult.Path; vfsTempUrl = this.vfsRootUrl + "/tmp/"; // Ensure directories exists if (!virtualFileProvider.DirectoryExists(this.vfsRootUrl)) { virtualFileProvider.CreateDirectory(this.vfsRootUrl); } this.isReadOnly = isReadOnly; assetIndexMap = Serialization.Assets.AssetIndexMap.Load(vfsRootUrl + VirtualFileSystem.DirectorySeparatorChar + indexName, isReadOnly); if (!isReadOnly && !virtualFileProvider.DirectoryExists(vfsTempUrl)) { try { virtualFileProvider.CreateDirectory(vfsTempUrl); } catch (Exception) { this.isReadOnly = true; } } }
/// <inheritdoc/> public override void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl) { if (destinationProvider is FileSystemProvider filesystemProvider) { filesystemProvider.CreateDirectory(destinationUrl.Substring(0, destinationUrl.LastIndexOf(VirtualFileSystem.DirectorySeparatorChar))); var sourcePath = ConvertUrlToFullPath(sourceUrl); var destPath = filesystemProvider.ConvertUrlToFullPath(destinationUrl); File.Move(sourcePath, destPath); } else { bool copySuccesful = false; using (Stream sourceStream = OpenStream(sourceUrl, VirtualFileMode.Open, VirtualFileAccess.Read)) using (Stream destinationStream = destinationProvider.OpenStream(destinationUrl, VirtualFileMode.CreateNew, VirtualFileAccess.Write)) { sourceStream.CopyTo(destinationStream); copySuccesful = true; } if (copySuccesful) { FileDelete(sourceUrl); } } }
public HybridWebRootFileProvider(IVirtualFileProvider virtualFileProvider, IHostingEnvironment hostingEnvironment) { _virtualFileProvider = virtualFileProvider; _hostingEnvironment = hostingEnvironment; _fileProvider = CreateHybridProvider(); }
public FileOdbBackend(string vfsRootUrl, string indexName, bool isReadOnly) { var resolveProviderResult = VirtualFileSystem.ResolveProvider(vfsRootUrl, true); virtualFileProvider = resolveProviderResult.Provider; this.vfsRootUrl = resolveProviderResult.Path; vfsTempUrl = this.vfsRootUrl + TempDirectory; // Ensure directories exists if (!virtualFileProvider.DirectoryExists(this.vfsRootUrl)) virtualFileProvider.CreateDirectory(this.vfsRootUrl); IsReadOnly = isReadOnly; contentIndexMap = !string.IsNullOrEmpty(indexName) ? Serialization.Contents.ContentIndexMap.Load(vfsRootUrl + VirtualFileSystem.DirectorySeparatorChar + indexName, isReadOnly) : Serialization.Contents.ContentIndexMap.CreateInMemory(); if (!isReadOnly && !virtualFileProvider.DirectoryExists(vfsTempUrl)) { try { virtualFileProvider.CreateDirectory(vfsTempUrl); } catch (Exception) { IsReadOnly = true; } } }
public FileOdbBackend(string vfsRootUrl, bool isReadOnly, string indexName = "index") { var resolveProviderResult = VirtualFileSystem.ResolveProvider(vfsRootUrl, true); virtualFileProvider = resolveProviderResult.Provider; this.vfsRootUrl = resolveProviderResult.Path; vfsTempUrl = this.vfsRootUrl + "/tmp/"; // Ensure directories exists if (!virtualFileProvider.DirectoryExists(this.vfsRootUrl)) virtualFileProvider.CreateDirectory(this.vfsRootUrl); this.isReadOnly = isReadOnly; assetIndexMap = Serialization.Assets.AssetIndexMap.Load(vfsRootUrl + VirtualFileSystem.DirectorySeparatorChar + indexName, isReadOnly); if (!isReadOnly && !virtualFileProvider.DirectoryExists(vfsTempUrl)) { try { virtualFileProvider.CreateDirectory(vfsTempUrl); } catch (Exception) { this.isReadOnly = true; } } }
/// <summary> /// Add a new file provider /// </summary> /// <param name="fileProvider"> </param> public void Add(IVirtualFileProvider fileProvider) { if (fileProvider == null) { throw new ArgumentNullException("fileProvider"); } _fileProviders.Add(fileProvider); }
public SettingUiAppService(IStringLocalizer <SettingUiResource> localizer, IVirtualFileProvider fileProvider, IJsonSerializer jsonSerializer, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager) { _localizer = localizer; _fileProvider = fileProvider; _jsonSerializer = jsonSerializer; _settingDefinitionManager = settingDefinitionManager; _settingManager = settingManager; }
public TemplatContentsModel(ITemplateDefinitionAppService templateDefinitionAppService, IVirtualFileProvider virtualFileProvider , TemplateDefinitionManager templateDefinitionManager) { _templateDefinitionAppService = templateDefinitionAppService; VirtualFileProvider = virtualFileProvider; _templateDefinitionManager = templateDefinitionManager; }
public static IEffectCompiler CreateEffectCompiler( IVirtualFileProvider fileProvider, EffectSystem effectSystem = null, string packageName = null, EffectCompilationMode effectCompilationMode = EffectCompilationMode.Local, bool recordEffectRequested = false, TaskSchedulerSelector taskSchedulerSelector = null, DatabaseFileProvider database = null) { EffectCompilerBase compiler = null; if ((effectCompilationMode & EffectCompilationMode.Local) != 0) { // Local allowed and available, let's use that compiler = new EffectCompiler(fileProvider) { SourceDirectories = { EffectCompilerBase.DefaultSourceShaderFolder }, }; } // Select database - needed for caching var selectedDatabase = database ?? fileProvider as DatabaseFileProvider; // Nothing to do remotely bool needRemoteCompiler = (compiler == null && (effectCompilationMode & EffectCompilationMode.Remote) != 0); if (needRemoteCompiler || recordEffectRequested) { // Create the object that handles the connection var shaderCompilerTarget = new RemoteEffectCompilerClient(packageName); if (recordEffectRequested) { // Let's notify effect compiler server for each new effect requested effectSystem.EffectUsed += shaderCompilerTarget.NotifyEffectUsed; } // Use remote only if nothing else was found before (i.e. a local compiler) if (needRemoteCompiler) { // Create a remote compiler compiler = new RemoteEffectCompiler(fileProvider, selectedDatabase, shaderCompilerTarget); } else { // Otherwise, EffectSystem takes ownership of shaderCompilerTarget shaderCompilerTarget.DisposeBy(effectSystem); } } // Local not possible or allowed, and remote not allowed either => switch back to null compiler if (compiler == null) { compiler = new NullEffectCompiler(fileProvider, selectedDatabase); } return(new EffectCompilerCache(compiler, selectedDatabase, taskSchedulerSelector)); }
public Index(IOptions <AbpLocalizationOptions> abpLocalizationOptions, ResourceManagerStringLocalizerFactory innerFactory, ILanguageProvider languageProvider, IVirtualFileProvider virtualFileProvider) : this() { this.abpLocalizationOptions = abpLocalizationOptions; InnerFactory = innerFactory; LanguageProvider = languageProvider; VirtualFileProvider = virtualFileProvider; }
public MappingsLoader( IVirtualFileProvider virtualFileProvider, IJsonSerializer jsonSerializer) { _virtualFileProvider = virtualFileProvider; _jsonSerializer = jsonSerializer; _mappings = new ConcurrentDictionary <DbProviderType, DbTypeMap>(); Initial(); }
/// <summary> /// Unregisters the specified virtual file provider. /// </summary> /// <param name="provider">The provider.</param> /// <param name="dispose">Indicate that the provider should be disposed, if it inherits from IDisposable interface.</param> public static void UnregisterProvider(IVirtualFileProvider provider, bool dispose = true) { var mountPoints = providers.Where(x => x.Value == provider).ToArray(); foreach (var mountPoint in mountPoints) { providers.Remove(mountPoint.Key); } }
/// <summary> /// Initializes a new instance of the <see cref="ShaderMixinParser"/> class. /// </summary> public ShaderMixinParser(IVirtualFileProvider fileProvider) { SourceManager = new ShaderSourceManager(fileProvider); var shaderLoader = new ShaderLoader(SourceManager); if (shaderLibrary == null) { shaderLibrary = new StrideShaderLibrary(shaderLoader); } }
public ClientProxyApiDescriptionFinder( IVirtualFileProvider virtualFileProvider, IJsonSerializer jsonSerializer) { VirtualFileProvider = virtualFileProvider; JsonSerializer = jsonSerializer; ActionApiDescriptionModels = new Dictionary <string, ActionApiDescriptionModel>(); Initialize(); }
public WebContentFileProvider( IVirtualFileProvider virtualFileProvider, IWebHostEnvironment hostingEnvironment, IOptions <RocketAspNetCoreContentOptions> options) { _virtualFileProvider = virtualFileProvider; _hostingEnvironment = hostingEnvironment; Options = options.Value; _fileProvider = CreateFileProvider(); }
public EffectCompiler(IVirtualFileProvider fileProvider) { FileProvider = fileProvider; if (Platform.IsWindowsDesktop && !d3dCompilerLoaded) { NativeLibraryHelper.PreloadLibrary("d3dcompiler_47", typeof(EffectCompiler)); d3dCompilerLoaded = true; } SourceDirectories = new List <string>(); UrlToFilePath = new Dictionary <string, string>(); }
/// <summary> /// Registers the specified virtual file provider at the specified mount location. /// </summary> /// <param name="provider">The provider.</param> public static void RegisterProvider(IVirtualFileProvider provider) { if (provider.RootPath != null) { if (providers.ContainsKey(provider.RootPath)) { throw new InvalidOperationException(string.Format("A Virtual File Provider with the root path \"{0}\" already exists.", provider.RootPath)); } providers.Add(provider.RootPath, provider); } }
/// <summary> /// Registers a virtual file provider at the specified mount location. /// </summary> /// <param name="provider">The provider to register.</param> public static void RegisterProvider(IVirtualFileProvider provider) { if (provider.RootPath != null) { if (providers.ContainsKey(provider.RootPath)) { throw new InvalidOperationException($@"A Virtual File Provider with the root path ""{provider.RootPath}"" already exists."); } providers.Add(provider.RootPath, provider); } }
/// <summary> /// Initializes a new instance of the <see cref="ShaderMixinParser"/> class. /// </summary> public ShaderMixinParser(IVirtualFileProvider fileProvider) { SourceManager = new ShaderSourceManager(fileProvider); var shaderLoader = new ShaderLoader(SourceManager); if (shaderLibrary == null) { shaderLibrary = new XenkoShaderLibrary(shaderLoader); } // Create the clone context with the instances of Hlsl classes HlslSemanticAnalysis.FillCloneContext(hlslCloneContext); }
/// <summary> /// Initializes a new instance of the <see cref="ShaderMixinParser"/> class. /// </summary> public ShaderMixinParser(IVirtualFileProvider fileProvider) { SourceManager = new ShaderSourceManager(fileProvider); var shaderLoader = new ShaderLoader(SourceManager); if (shaderLibrary == null) { shaderLibrary = new ParadoxShaderLibrary(shaderLoader); } // Create the clone context with the instances of Hlsl classes HlslSemanticAnalysis.FillCloneContext(hlslCloneContext); }
/// <summary> /// Initializes static members of the <see cref="VirtualFileSystem"/> class. /// </summary> static VirtualFileSystem() { PlatformFolders.IsVirtualFileSystemInitialized = true; // TODO: Find a better solution to customize the ApplicationDataDirectory, now we're very limited due to the initialization from a static constructor ApplicationData = new FileSystemProvider("/data", Path.Combine(PlatformFolders.ApplicationDataDirectory, PlatformFolders.ApplicationDataSubDirectory)); ApplicationCache = new FileSystemProvider("/cache", PlatformFolders.ApplicationCacheDirectory); ApplicationRoaming = new FileSystemProvider("/roaming", PlatformFolders.ApplicationRoamingDirectory); ApplicationLocal = new FileSystemProvider("/local", PlatformFolders.ApplicationLocalDirectory); ApplicationTemporary = new FileSystemProvider("/tmp", PlatformFolders.ApplicationTemporaryDirectory); ApplicationBinary = new FileSystemProvider("/binary", PlatformFolders.ApplicationBinaryDirectory); Drive = new DriveFileProvider(DriveFileProvider.DefaultRootPath); }
//========================================================================================== /// <summary> /// This type of DynamicSoundSource is streamed from Disk and reads compressed Celt encoded data, used internally. /// </summary> /// <param name="instance">The associated SoundInstance</param> /// <param name="fileProvider">The file provider to read the stream from</param> /// <param name="soundStreamUrl">The compressed stream internal URL</param> /// <param name="numberOfPackets"></param> /// <param name="sampleRate">The sample rate of the compressed data</param> /// <param name="channels">The number of channels of the compressed data</param> /// <param name="maxCompressedSize">The maximum size of a compressed packet</param> public CompressedSoundSource(SoundInstance instance, IVirtualFileProvider fileProvider, string soundStreamUrl, int numberOfPackets, int sampleRate, int channels, int maxCompressedSize) : base(instance, NumberOfBuffers, SamplesPerBuffer * MaxChannels * sizeof(short)) { looped = instance.IsLooping; this.channels = channels; this.maxCompressedSize = maxCompressedSize; this.fileProvider = fileProvider; this.soundStreamUrl = soundStreamUrl; this.sampleRate = sampleRate; this.numberOfPackets = numberOfPackets; playRange = new PlayRange(TimeSpan.Zero, TimeSpan.Zero); NewSources.Add(this); }
public SettingUiAppService(IStringLocalizer <SettingUiResource> localizer, IStringLocalizerFactory factory, IVirtualFileProvider fileProvider, IJsonSerializer jsonSerializer, ISettingDefinitionManager settingDefinitionManager, ISettingManager settingManager, IPermissionDefinitionManager permissionDefinitionManager) { _localizer = localizer; _factory = factory; _fileProvider = fileProvider; _jsonSerializer = jsonSerializer; _settingDefinitionManager = settingDefinitionManager; _settingManager = settingManager; _permissionDefinitionManager = permissionDefinitionManager; }
/// <summary> /// Unregisters the specified virtual file provider. /// </summary> /// <param name="provider">The provider.</param> /// <param name="dispose">Indicate that the provider should be disposed, if it inherits from IDisposable interface.</param> public static void UnregisterProvider(IVirtualFileProvider provider, bool dispose = true) { var mountPoints = providers.Where(x => x.Value == provider).ToArray(); foreach (var mountPoint in mountPoints) { providers.Remove(mountPoint.Key); } if (dispose) { var disposable = provider as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
/// <inheritdoc/> public override void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl) { var fsProvider = destinationProvider as FileSystemProvider; if (fsProvider != null) { destinationProvider.CreateDirectory(destinationUrl.Substring(0, destinationUrl.LastIndexOf(VirtualFileSystem.DirectorySeparatorChar))); File.Move(ConvertUrlToFullPath(sourceUrl), fsProvider.ConvertUrlToFullPath(destinationUrl)); } else { using (Stream sourceStream = OpenStream(sourceUrl, VirtualFileMode.Open, VirtualFileAccess.Read), destinationStream = destinationProvider.OpenStream(destinationUrl, VirtualFileMode.CreateNew, VirtualFileAccess.Write)) { sourceStream.CopyTo(destinationStream); } FileDelete(sourceUrl); } }
//get shader source from data base, is there a more direct way? public static string GetShaderSourceCode(string effectName, IVirtualFileProvider fileProvider, ShaderSourceManager shaderSourceManager) { var path = GetPathOfSdslShader(effectName, fileProvider); if (!string.IsNullOrWhiteSpace(path)) { try { return(File.ReadAllText(path)); } catch (Exception) { //fall through } } return(shaderSourceManager?.LoadShaderSource(effectName).Source); }
public RedisRequiresLimitFeatureChecker( ICurrentTenant currentTenant, IVirtualFileProvider virtualFileProvider, IOptions <AbpRedisRequiresLimitFeatureOptions> optionsAccessor) { if (optionsAccessor == null) { throw new ArgumentNullException(nameof(optionsAccessor)); } _options = optionsAccessor.Value; _currentTenant = currentTenant; _virtualFileProvider = virtualFileProvider; _instance = _options.InstanceName ?? string.Empty; Logger = NullLogger <RedisRequiresLimitFeatureChecker> .Instance; }
/// <inheritdoc/> public override void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl) { var fsProvider = destinationProvider as FileSystemProvider; if (fsProvider != null) { destinationProvider.CreateDirectory(destinationUrl.Substring(0, destinationUrl.LastIndexOf(VirtualFileSystem.DirectorySeparatorChar))); NativeFile.FileMove(ConvertUrlToFullPath(sourceUrl), fsProvider.ConvertUrlToFullPath(destinationUrl)); } else { using (Stream sourceStream = OpenStream(sourceUrl, VirtualFileMode.Open, VirtualFileAccess.Read), destinationStream = destinationProvider.OpenStream(destinationUrl, VirtualFileMode.CreateNew, VirtualFileAccess.Write)) { sourceStream.CopyTo(destinationStream); } NativeFile.FileDelete(sourceUrl); } }
public GitHubSourceCodeStore( IOptions <AbpCliOptions> options, IJsonSerializer jsonSerializer, ICancellationTokenProvider cancellationTokenProvider, IVirtualFileProvider virtualFileProvider, IOptions <OctokitOptions> octokitOptions, IGitHubClient gitHubClient ) { JsonSerializer = jsonSerializer; CancellationTokenProvider = cancellationTokenProvider; Options = options.Value; VirtualFileProvider = virtualFileProvider; Logger = NullLogger <GitHubSourceCodeStore> .Instance; OctokitOptions = octokitOptions.Value; GitHubClient = gitHubClient; }
/// <summary> /// Initializes a new instance of the <see cref="VirtualFileSystem" /> class. /// </summary> static VirtualFileSystem() { PlatformFolders.IsVirtualFileSystemInitialized = true; // TODO: find a better solution to customize the ApplicationDataDirectory, now we're very limited due to the initialization from a static constructor #if SILICONSTUDIO_PLATFORM_ANDROID ApplicationData = new ZipFileSystemProvider("/data", PlatformAndroid.Context.ApplicationInfo.SourceDir); #else ApplicationData = new FileSystemProvider("/data", Path.Combine(PlatformFolders.ApplicationDataDirectory, PlatformFolders.ApplicationDataSubDirectory)); #endif ApplicationCache = new FileSystemProvider("/cache", PlatformFolders.ApplicationCacheDirectory); #if SILICONSTUDIO_PLATFORM_IOS // On iOS, we don't want cache folder to be cleared by the OS. ((FileSystemProvider)ApplicationCache).AutoSetSkipBackupAttribute = true; #endif ApplicationRoaming = new FileSystemProvider("/roaming", PlatformFolders.ApplicationRoamingDirectory); ApplicationLocal = new FileSystemProvider("/local", PlatformFolders.ApplicationLocalDirectory); ApplicationTemporary = new FileSystemProvider("/tmp", PlatformFolders.ApplicationTemporaryDirectory); ApplicationBinary = new FileSystemProvider("/binary", PlatformFolders.ApplicationBinaryDirectory); Drive = new DriveFileProvider(DriveFileProvider.DefaultRootPath); }
/// <summary> /// Add a new file provider /// </summary> /// <param name="fileProvider"> </param> public void Add(IVirtualFileProvider fileProvider) { if (fileProvider == null) throw new ArgumentNullException("fileProvider"); _fileProviders.Add(fileProvider); }
/// <summary> /// Registers the specified virtual file provider at the specified mount location. /// </summary> /// <param name="provider">The provider.</param> public static void RegisterProvider(IVirtualFileProvider provider) { if (provider.RootPath != null) { if (providers.ContainsKey(provider.RootPath)) throw new InvalidOperationException(string.Format("A Virtual File Provider with the root path \"{0}\" already exists.", provider.RootPath)); providers.Add(provider.RootPath, provider); } }
/// <inheritdoc/> public virtual void FileMove(string sourceUrl, IVirtualFileProvider destinationProvider, string destinationUrl) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="ShaderSourceManager" /> class. /// </summary> /// <param name="fileProvider">The file provider to use for loading shader sources.</param> public ShaderSourceManager(IVirtualFileProvider fileProvider) { this.fileProvider = fileProvider; LookupDirectoryList = new List<string>(); UrlToFilePath = new Dictionary<string, string>(); }
/// <summary> /// Unregisters the specified virtual file provider. /// </summary> /// <param name="provider">The provider.</param> /// <param name="dispose">Indicate that the provider should be disposed, if it inherits from IDisposable interface.</param> public static void UnregisterProvider(IVirtualFileProvider provider, bool dispose = true) { var mountPoints = providers.Where(x => x.Value == provider).ToArray(); foreach (var mountPoint in mountPoints) providers.Remove(mountPoint.Key); }
/// <summary> /// Opens the stream from a given path. /// </summary> /// <param name="path">The path.</param> /// <param name="mode">The stream opening mode (append, open, create, etc...).</param> /// <param name="access">The stream access.</param> /// <param name="share">The stream share mode.</param> /// <param name="provider">The provider used to load the stream.</param> /// <returns>The stream.</returns> public static Stream OpenStream(string path, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share, out IVirtualFileProvider provider) { var resolveProviderResult = ResolveProvider(path, false); provider = resolveProviderResult.Provider; return provider.OpenStream(resolveProviderResult.Path, mode, access, share); }