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 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); } } }