/// <summary> /// Checks if the file name is a settings file. If so, the contained logfile name /// is returned. If not, the given file name is returned unchanged. /// </summary> /// <param name="fileName"></param> /// <returns></returns> private string FindFilenameForSettings(string fileName) { if (fileName.EndsWith(".lxp")) { PersistenceData persistenceData = Persister.LoadOptionsOnly(fileName); if (persistenceData == null) { return(fileName); } if (persistenceData.fileName != null && persistenceData.fileName.Length > 0) { IFileSystemPlugin fs = PluginRegistry.GetInstance().FindFileSystemForUri(persistenceData.fileName); if (fs != null && !fs.GetType().Equals(typeof(LocalFileSystem))) { return(persistenceData.fileName); } // On relative paths the URI check (and therefore the file system plugin check) will fail. // So fs == null and fs == LocalFileSystem are handled here like normal files. if (Path.IsPathRooted(persistenceData.fileName)) { return(persistenceData.fileName); } else { // handle relative paths in .lxp files string dir = Path.GetDirectoryName(fileName); return(Path.Combine(dir, persistenceData.fileName)); } } } return(fileName); }
private bool TryAsFileSystem(Type type) { // file system plugins can have optional constructor with IFileSystemCallback argument IFileSystemPlugin fs = TryInstantiate <IFileSystemPlugin>(type, this.fileSystemCallback); if (fs == null) { fs = TryInstantiate <IFileSystemPlugin>(type); } if (fs != null) { this.RegisteredFileSystemPlugins.Add(fs); if (fs is ILogExpertPluginConfigurator) { ((ILogExpertPluginConfigurator)fs).LoadConfig(ConfigManager.ConfigDir); } if (fs is ILogExpertPlugin) { this.pluginList.Add(fs as ILogExpertPlugin); (fs as ILogExpertPlugin).PluginLoaded(); } _logger.Info("Added file system plugin {0}", type); return(true); } return(false); }
private bool FileExists(string filePath) { IFileSystemPlugin fs = PluginRegistry.GetInstance().FindFileSystemForUri(filePath); ILogFileInfo info = fs.GetLogfileInfo(filePath); return(info.FileExists); }