コード例 #1
0
        private void RefreshEntryPoints(bool RefreshPlugins)
        {
            Async.Queue("Configurator ep refresh", () =>
            {
                using (new MediaBrowser.Util.Profiler("Entry Point Refresh"))
                {
                    EntryPointManager epm = null;

                    try
                    {
                        epm = new EntryPointManager();
                    }
                    catch (Exception ex)
                    {
                        //Write to error log, don't prompt user.
                        Logger.ReportError("Error starting Entry Point Manager in RefreshEntryPoints(). " + ex.Message);
                        return;
                    }

                    try
                    {
                        List<EntryPointItem> entryPoints = new List<EntryPointItem>();

                        try
                        {
                            Logger.ReportInfo("Reloading Virtual children");
                            if (RefreshPlugins)
                            {
                                //Kernel.Init(KernelLoadDirective.ShadowPlugins);
                                Kernel.Instance.ReLoadRoot();
                            }

                            Kernel.Instance.RootFolder.ValidateChildren();
                        }
                        catch (Exception ex)
                        {
                            Logger.ReportError("Error validating children. " + ex.Message, ex);
                            throw new Exception("Error validating children. " + ex.Message);
                        }

                        foreach (var folder in Kernel.Instance.RootFolder.Children)
                        {
                            String displayName = folder.Name;
                            if (displayName == null || displayName.Length <= 0)
                                continue;

                            String path = string.Empty;

                            if (folder.GetType() == typeof(Folder) && folder.Path != null && folder.Path.Length > 1)
                            {
                                path = folder.Path;
                            }
                            else
                            {
                                path = folder.Id.ToString();
                            }

                            EntryPointItem ep = new EntryPointItem(displayName, path);
                            entryPoints.Add(ep);
                        }

                        epm.ValidateEntryPoints(entryPoints);
                    }
                    catch (Exception ex)
                    {
                        String msg = "Error Refreshing Entry Points. " + ex.Message;
                        Logger.ReportError(msg, ex);
                        //MessageBox.Show(msg);
                    }
                }
            });
        }
コード例 #2
0
        private void RenameVirtualFolderEntryPoint(String OldName, String NewName, String OldContext, String NewContext)
        {
            EntryPointManager epm = null;

            try
            {
                epm = new EntryPointManager();
            }
            catch (Exception ex)
            {
                //Write to error log, don't prompt user.
                Logger.ReportError("Error starting Entry Point Manager in RenameVirtualFolderEntryPoint(). " + ex.Message);
                return;
            }

            try
            {
                epm.RenameEntryPointTitle(OldName, NewName, OldContext, NewContext);
            }
            catch (Exception ex)
            {
                String msg = "Error renaming Entry Points. " + ex.Message;
                Logger.ReportError(msg);
                MessageBox.Show(msg);
            }
        }