protected void ParseZipFile(string folder, PluginDll dll, IList <PluginDll> expandingDlls, string path) { string zipFolder = GetPluginFolder(folder) + "_zip"; ZipHelper.UnpackFiles(path, zipFolder); foreach (string file in Directory.GetFiles(zipFolder)) { string newFile = Path.Combine(GetPluginFolder(folder), Path.GetFileName(file)); try { File.Copy(file, newFile, true); string fn = Path.GetFileNameWithoutExtension(newFile); PluginDll theDll = new PluginDll(); theDll.Name = fn; theDll.Version = dll.Version; if (!PluginLocatorBase.IsInPluginDlls(theDll, expandingDlls)) { expandingDlls.Add(theDll); } } catch { } } try { Directory.Delete(zipFolder, true); } catch { } }
private static XmlDocument GetPluginXmlDoc() { if (pluginXmlDoc.ChildNodes.Count == 0) { Stream pluginStream = (typeof(PluginConfig).Assembly).GetManifestResourceStream(pluginXmlFile); pluginXmlDoc.Load(pluginStream); CombineRemotePluginXmlDoc(pluginXmlDoc); PluginLocatorBase.CreateVersionRecord(pluginXmlDoc); } return(pluginXmlDoc); }
public virtual bool LoadPluginDlls() { string baseFolder = Path.Combine(PluginLocatorBase.GetBasePluginFolder(), ConfigItem.GetContainerName()); foreach (PluginDll dll in ConfigItem.PluginDlls) { if (dll.Name.ToLower().EndsWith(".zip")) { continue; } bool found = LoadPluginDll(dll.Name, baseFolder); if (!found) { return(false); } } return(true); }
private void LoadPluginDll(PluginConfigItem configItem) { IPluginLocator theLocator = PluginLocatorFactory.GetLocator(configItem.QualifiedName.LoadProtocol); IList <PluginDll> expandingDlls = new List <PluginDll>(); IList <PluginDll> _changedList = new List <PluginDll>(); for (int i = 0; i < configItem.PluginDlls.Count; i++) { PluginDll theDll = configItem.PluginDlls[i]; if (theDll.NewVersion) { bool loaded = theLocator.LoadDll(this._pluginContext.PluginContainer.Name, theDll, expandingDlls); if (!loaded) { configItem.Status = PluginConfigItemStatus.LoadPluginDllFailure; break; } else { theDll.NewVersion = false; _changedList.Add(theDll); } } } if (_changedList.Count > 0) { PluginLocatorBase.SavePluginDllVersion(_changedList); } foreach (PluginDll expandingDll in expandingDlls) { if (!PluginLocatorBase.IsInPluginDlls(expandingDll, configItem.PluginDlls)) { configItem.PluginDlls.Add(expandingDll); } } }