/// <summary> /// Adds the plugin xml config to the plugin class and sets status flags /// </summary> public void AddPluginFile(Plugin plugin, IPlugin pluginFile, string filePath) { //get the path info string pluginPath = Path.GetDirectoryName(filePath); string filename = Path.GetFileName(filePath); //sort out backslashes as MakeRelativePath is fussy about these if (!PluginsPath.Trim().EndsWith(@"\")) { PluginsPath += @"\"; } if (pluginPath.Trim().EndsWith(@"\")) { pluginPath.Remove(pluginPath.Length - 1, 1); } string relativePath = FileUtils.MakeRelativePath(PluginsPath, pluginPath); plugin.AddPluginFile(pluginFile, filename, pluginPath, relativePath); if (plugin.HasPluginFile) { //synch the name plugin.Name = plugin.PluginFile.Name; //remove any dot prefixes on the file extensions for consistency //with how file extensions are held for (int i = 0; i < plugin.PluginFile.FileExtensions.Length; i++) { plugin.PluginFile.FileExtensions[i] = plugin.PluginFile.FileExtensions[i].TrimStart(new[] { '.' }); } } else { if (String.IsNullOrEmpty(plugin.Name)) { plugin.Name = "Unknown"; } } //set the status flags SetPluginStatus(plugin); }