Пример #1
0
        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);
            }
        }
Пример #2
0
        public bool InstallBundles()
        {
            if (File.Exists(GlobalPersistentFile))
            {
                Persistenter.Load(GlobalPersistentFile);
            }
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            List <string> pluginDirectoryList = new List <string>();
            string        path = string.Empty;

            foreach (string str in PluginsDirectoryList)
            {
                path = str;
                if (!Directory.Exists(path))
                {
                    path = PathUtility.GetFullPath(path);
                }
                if (Directory.Exists(path))
                {
                    foreach (string str3 in Directory.GetFiles(path, "Manifest.xml", SearchOption.AllDirectories))
                    {
                        pluginDirectoryList.Add(Directory.GetParent(Path.GetFullPath(str3)).FullName);
                    }
                }
                else
                {
                    FileLogUtility.Warn(string.Format(Messages.PluginsDirectoryNotExist, path, str));
                }
            }
            stopwatch.Stop();
            FileLogUtility.Verbose(string.Format(Messages.TimeSpentForBundlesFound, stopwatch.ElapsedMilliseconds, pluginDirectoryList.Count));
            stopwatch.Start();
            InstallBundles(pluginDirectoryList);
            stopwatch.Stop();
            FileLogUtility.Verbose(string.Format(Messages.TimeSpentForBundleManifestParsed, stopwatch.ElapsedMilliseconds, pluginDirectoryList.Count));
            return(true);
        }