public void SaveUnInstallLocation(string path, bool needRemove) { if (!UnInstalledBundleLocation.Exists(item => item.Location == path)) { var option = new UnInstallBundleOption { Location = path, NeedRemove = needRemove }; UnInstalledBundleLocation.Add(option); } InstalledBundleLocation.Remove(path); }
private void RemoveBundlesToBeDeleted(List <string> pluginDirectoryList) { Predicate <string> match = null; if (Persistenter != null) { if (match == null) { match = delegate(string pluginDirectory) { UnInstallBundleOption item = Persistenter.UnInstalledBundleLocation.Find(a => IsSamePath(a.Location, pluginDirectory)); if (item == null) { return(false); } if (item.NeedRemove) { try { Directory.Delete(item.Location, true); } catch (Exception exception) { FileLogUtility.Error(string.Format(Messages.DeleteDirectoryFailed, item.Location, exception.Message)); } try { Persistenter.UnInstalledBundleLocation.Remove(item); Persistenter.Save(GlobalPersistentFile); } catch (Exception exception2) { FileLogUtility.Error(string.Format(Messages.DeleteDirectoryFailed, item.Location, exception2.Message)); } } return(true); }; } pluginDirectoryList.RemoveAll(match); } }