BlogEngine.Core.Packaging.FileSystem.Load C# (CSharp) Method

Load() public static method

public static Load ( List packages ) : void
packages List
return void
        public static void Load(List<JsonPackage> packages)
        {
            try
            {
                var themes = GetThemes();
                var widgets = GetWidgets();

                if(themes != null && themes.Count > 0)
                {
                    foreach (var theme in from theme in themes
                        let found = packages.Any(pkg => theme.Id.ToLower() == pkg.Id.ToLower())
                        where !found select theme)
                    {
                        packages.Add(theme);
                    }
                }

                if (widgets != null && widgets.Count > 0)
                {
                    foreach (var wdg in from wdg in widgets
                        let found = packages.Any(pkg => wdg.Id.ToLower() == pkg.Id.ToLower())
                        where !found select wdg)
                    {
                        packages.Add(wdg);
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.Log(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
            }
        }

Usage Example

Example #1
0
        static List <JsonPackage> LoadPackages()
        {
            var packages = new List <JsonPackage>();

            Gallery.Load(packages);
            //Trace("01: ", packages);
            FileSystem.Load(packages);
            //Trace("02: ", packages);
            Installer.MarkAsInstalled(packages);
            //Trace("03: ", packages);

            return(packages);
        }