示例#1
0
        public LocalPlaylists(IHelper aHelper, bool aAddOptionPage)
        {
            iLock = new object();

            iOptionSaveDirectory = new OptionFolderPath("playlistpath", "Local playlist path", "Path where local playlists are saved", Path.Combine(aHelper.DataPath.FullName, "Playlists"));

            if (aAddOptionPage)
            {
                // create the options page
                OptionPage optionPage = new OptionPage("Local Playlists");
                optionPage.Add(iOptionSaveDirectory);
                aHelper.AddOptionPage(optionPage);
            }
            else
            {
                aHelper.AddOption(iOptionSaveDirectory);
            }

            // listen for changes to the save directory option
            iOptionSaveDirectory.EventValueChanged += SaveDirectoryChanged;

            // initialise as being in its error state
            iPlaylists = null;
            iWrapped   = new LocalPlaylistsRootError(kRootId);
            iWrapped.EventContentUpdated += ContentUpdated;
            iWrapped.EventContentAdded   += ContentAdded;
            iWrapped.EventContentRemoved += ContentRemoved;

            Refresh();
        }
示例#2
0
        public HelperKinsky(string[] aArgs, IInvoker aInvoker)
            : base(aArgs)
        {
            iInvoker        = aInvoker;
            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();

            IModelFactory factory = new ModelFactory();

            iTopologyHouse = new Linn.Topology.House(iListenerNotify, iEventServer, factory);
            iSenders       = new ModelSenders(iListenerNotify, iEventServer);
            iHouse         = new House(iTopologyHouse, iInvoker, iSenders);

            OptionPage optionPage = new OptionPage("Startup Room");

            iOptionStartupRoom = new OptionStartupRoom(iHouse);
            optionPage.Add(iOptionStartupRoom);
            AddOptionPage(optionPage);

            //optionPage = new OptionPage("Cloud Servers");
            iOptionCloudServers = new OptionListUri("cloudservers", "Server locations", "List of locations for cloud media servers", new List <Uri>());
            //optionPage.Add(iOptionCloudServers);
            //AddOptionPage(optionPage);

            iOptionLastSelectedRoom = new OptionString("lastroom", "Last Selected Room", "The last room selected", string.Empty);
            AddOption(iOptionLastSelectedRoom);

            iOptionLastLocation = new OptionBreadcrumbTrail("lastlocation", "Last Location", "The last location visited by the browser", BreadcrumbTrail.Default);
            AddOption(iOptionLastLocation);

            iBookmarkManager = new BookmarkManager(Path.Combine(DataPath.FullName, "Bookmarks.xml"));

            Stack.SetStack(this);
        }
示例#3
0
        public LocalPlaylistSupport(HelperKinsky aHelper, LocalPlaylistFileNameGenerator aNameGenerator)
        {
            // create the options page
            OptionPage optionPage = new OptionPage("Local Playlists");

            iOptionSaveDirectory = new OptionFolderPath("playlistpath", "Local playlist path", "Path where local playlists are saved", Path.Combine(aHelper.DataPath.FullName, "Playlists"));
            optionPage.Add(iOptionSaveDirectory);
            aHelper.AddOptionPage(optionPage);

            // listen for changes to the save directory option
            iOptionSaveDirectory.EventValueChanged += SaveDirectoryChanged;

            iCreator       = new LocalPlaylistCreator(aNameGenerator);
            iRootContainer = new LocalPlaylistsRoot(iCreator, iOptionSaveDirectory);
        }
示例#4
0
        public static void Postfix(KeyboardJoystick __instance)
        {
            if (Input.GetKeyDown(KeyCode.Q))
            {
                IReadOnlyList <Ability> abilities = LocalPlayer.GetAbilities();
                if (abilities?.Count > 0)
                {
                    abilities[0]?.TryUse();
                }
            }

            if (Input.GetKeyDown(KeyCode.Tab) && LobbyBehaviour.Instance != null)
            {
                OptionPage.TurnPage();
            }
        }
示例#5
0
        public HelperKinsky(string[] aArgs, IInvoker aInvoker)
            : base(aArgs)
        {
            iInvoker        = aInvoker;
            iEventServer    = new EventServerUpnp();
            iListenerNotify = new SsdpListenerMulticast();

            IModelFactory factory = new ModelFactory();

            iTopologyHouse = new Linn.Topology.House(iListenerNotify, iEventServer, factory);
            iSenders       = new ModelSenders(iListenerNotify, iEventServer);
            iHouse         = new House(iTopologyHouse, iInvoker, iSenders);

            OptionPage optionPage = new OptionPage("Startup Room");

            iOptionStartupRoom = new OptionStartupRoom(iHouse);
            optionPage.Add(iOptionStartupRoom);
            AddOptionPage(optionPage);

            //optionPage = new OptionPage("Cloud Servers");
            iOptionCloudServers = new OptionListUri("cloudservers", "Server locations", "List of locations for cloud media servers", new List <Uri>());
            //optionPage.Add(iOptionCloudServers);
            //AddOptionPage(optionPage);

            iOptionInstallId = new OptionString("installid", "InstallId", "Unique installation identifer", Guid.NewGuid().ToString());
            AddOption(iOptionInstallId);

            iOptionLastNotificationVersion = new OptionUint("lastnotificationversion", "LastNotificationVersion", "last version of notification feed viewed", 0);
            AddOption(iOptionLastNotificationVersion);

            iOptionLastAcknowledgedNotificationVersion = new OptionUint("lastacknowledgednotificationversion", "LastAcknowledgedNotificationVersion", "last version of notification feed acknowledged", 0);
            AddOption(iOptionLastAcknowledgedNotificationVersion);

            iOptionLastNotificationDate = new OptionDateTime("lastnotificationdate", "LastNotificationDate", "last date notification feed viewed", DateTime.MinValue);
            AddOption(iOptionLastNotificationDate);

            iOptionLastSelectedRoom = new OptionString("lastroom", "Last Selected Room", "The last room selected", string.Empty);
            AddOption(iOptionLastSelectedRoom);

            iOptionLastLocation = new OptionBreadcrumbTrail("lastlocation", "Last Location", "The last location visited by the browser", BreadcrumbTrail.Default);
            AddOption(iOptionLastLocation);

            iBookmarkManager = new BookmarkManager(Path.Combine(DataPath.FullName, "Bookmarks.xml"));

            Stack.SetStack(this);
        }
示例#6
0
        private string GetString(OptionPage page, string fallback, string resourceId)
        {
            if (String.IsNullOrEmpty(resourceId))
            {
                return(fallback);
            }

            string result;

            ErrorUtil.ThrowOnFailure(page.Package.Package.GetStringResource(resourceId, out result));

            if (String.IsNullOrEmpty(result))
            {
                return(fallback);
            }

            return(result);
        }
示例#7
0
文件: Wfmu.cs 项目: daviddw/Kinsky
        public ContentDirectoryWfmu(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport    = aSupport;
            iOptionPage = new OptionPage("Wfmu");

            string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iWebFetcher = new WebFetcher(aDataPath);

            string wfmuLogo = aSupport.VirtualFileSystem.Uri(Path.Combine(installPath, "Wfmu.png"));

            iLive     = new Live(wfmuLogo);
            iPodcasts = new Podcasts(iWebFetcher, wfmuLogo);

            iMetadata       = new container();
            iMetadata.Id    = "wfmu";
            iMetadata.Title = "WFMU";
            iMetadata.AlbumArtUri.Add(wfmuLogo);
            iMetadata.ChildCount = 2;
        }
示例#8
0
        private void ToolsOptionsDialog_Load(object sender, EventArgs e)
        {
            _localRegistry = (NiLocalRegistry)GetService(typeof(INiLocalRegistry));

            var packageManager = (NiPackageManager)GetService(typeof(INiPackageManager));

            foreach (var registration in _localRegistry.Registrations.OfType <OptionPageRegistration>())
            {
                var optionPage = new OptionPage(registration, packageManager.Packages[registration.Package]);

                _pages.Add(optionPage);

                var categoryNode = GetCategoryNode(optionPage);

                var treeNode = new TreeNode
                {
                    Text = GetString(optionPage, registration.PageName, registration.PageNameResourceKey),
                    Tag  = optionPage
                };

                InsertPageSorted(categoryNode.Nodes, treeNode);

                if (
                    registration.CategoryName == _lastSelectedCategory &&
                    registration.PageName == _lastSelectedPage
                    )
                {
                    _treeView.SelectedNode = treeNode;
                }
            }

            if (_treeView.SelectedNode == null && _treeView.Nodes.Count > 0)
            {
                _treeView.SelectedNode = _treeView.Nodes[0].Nodes[0];
            }

            if (_treeView.SelectedNode != null)
            {
                _treeView.SelectedNode.EnsureVisible();
            }
        }
示例#9
0
        private TreeNode GetCategoryNode(OptionPage page)
        {
            TreeNode treeNode;

            if (_categoryNodes.TryGetValue(page.Registration.CategoryName, out treeNode))
            {
                return(treeNode);
            }

            treeNode = new TreeNode
            {
                Text = GetString(page, page.Registration.CategoryName, page.Registration.CategoryNameResourceKey),
                Tag  = new OptionCategory(page.Registration.CategoryName)
            };

            InsertCategorySorted(_treeView.Nodes, treeNode);

            _categoryNodes[page.Registration.CategoryName] = treeNode;

            return(treeNode);
        }
示例#10
0
        public ContentDirectoryShoutcast(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport    = aSupport;
            iOptionPage = new OptionPage("Shoutcast");

            string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iAlbumArtUri = aSupport.VirtualFileSystem.Uri(Path.Combine(installPath, "Shoutcast.png"));

            iStations = new List <LiveStation>();

            iMetadata       = new album();
            iMetadata.Id    = "shoutcast";
            iMetadata.Title = "Shoutcast";
            iMetadata.AlbumArtUri.Add(iAlbumArtUri);

            iWebFetcher = new WebFetcher(aDataPath);

            iWebFile = iWebFetcher.Create(new Uri("http://yp.shoutcast.com/sbin/newxml.phtml?search=radio&br=320&mt=audio/mpeg"), "stations.xml", 60);
            iWebFile.EventContentsChanged += WebFileContentsChanged;
            iWebFile.Open();
        }
示例#11
0
        public ContentDirectoryLocator(PluginManager aPluginManager, IAppRestartHandler aAppRestartHandler)
        {
            iOptionPage = new OptionPage("Plugins");

            iMutex = new Mutex(false);

            iMetadata            = new container();
            iMetadata.Id         = kId;
            iMetadata.Title      = kTitle;
            iMetadata.Restricted = false;
            iMetadata.Searchable = true;

            iEnabledContentDirectories  = new SortedList <Key, IContainer>();
            iDisabledContentDirectories = new SortedList <Key, IContainer>();

            iAppRestartHandler = aAppRestartHandler;

            iPluginManager = aPluginManager;
            iPluginManager.EventPluginInstalled   += PluginInstalled;
            iPluginManager.EventPluginUnInstalled += PluginUnInstalled;
            iPluginManager.EventRestartRequired   += RestartRequired;
        }
示例#12
0
        public MediaProviderFolder(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport = aSupport;

            iMutex   = new Mutex(false);
            iFolders = new List <string>();

            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iMetadata             = new container();
            iMetadata.Id          = kRootId;
            iMetadata.Title       = Name;
            iMetadata.WriteStatus = "PROTECTED";
            iMetadata.Restricted  = false;
            iMetadata.Searchable  = true;
            iMetadata.AlbumArtUri.Add(iSupport.VirtualFileSystem.Uri(Path.Combine(path, "Folder.png")));

            iPage   = new OptionPage("Folders");
            iOption = new OptionListFolderPath("folders", "Folders", "Folders to be included");
            iPage.Add(iOption);
            iOption.EventValueChanged += FoldersChanged;
        }
示例#13
0
        private void _treeView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            var newPage = (OptionPage)(e.Node.Nodes.Count > 0 ? e.Node.Nodes[0] : e.Node).Tag;

            if (_currentPage == newPage)
            {
                return;
            }

            if (!CanDeactivate())
            {
                e.Cancel = true;
                return;
            }

            _currentPage = newPage;

            if (_currentPage.Page == null)
            {
                object instance;
                ErrorUtil.ThrowOnFailure(_localRegistry.CreateInstance(
                                             _currentPage.Registration.Id,
                                             _currentPage.Package.Package,
                                             out instance
                                             ));

                _currentPage.Page = (INiOptionPage)instance;

                ErrorUtil.ThrowOnFailure(_currentPage.Page.Initialize());
            }

            _pageHost.Page = _currentPage.Page;

            ErrorUtil.ThrowOnFailure(_currentPage.Page.Activate());

            _lastSelectedCategory = _currentPage.Registration.CategoryName;
            _lastSelectedPage     = _currentPage.Registration.PageName;
        }
示例#14
0
 public void AddOptionsPage(OptionPage optionpage)
 {
     optionspage.Add(optionpage);
     OptionTabPages.TabPages.Add(optionpage);
 }
示例#15
0
        internal void InitialiseStack()
        {
            OptionPage generalOptionsPage = new OptionPage("General");

            iHideCursorOption = new OptionBool("hidecursor", "Hide Cursor", "Hide Cursor", false);
            generalOptionsPage.Add(iHideCursorOption);
            iRotaryControlsOption = new OptionBool("rotarycontrol", "Use rotary controls", "Use rotary controls", true);
            generalOptionsPage.Add(iRotaryControlsOption);
            iShowToolTipsOption = new OptionBool("tooltips", "Show tooltips", "Show tooltips", true);
            generalOptionsPage.Add(iShowToolTipsOption);
            iShowExtendedTrackInfoOption = new OptionBool("trackinfo", "Extended track info", "Show extended track information", true);
            generalOptionsPage.Add(iShowExtendedTrackInfoOption);
            iGroupPlaylistOption = new OptionBool("groupplaylist", "Group playlist items by album", "Allows grouping of items within the playlist window", false);
            generalOptionsPage.Add(iGroupPlaylistOption);
            iTransparentOption = new OptionBool("customwindow", "Transparent window (requires restart)", "Toggles custom window", true);
            generalOptionsPage.Add(iTransparentOption);
            iSoftwareRenderingOption = new OptionBool("softwarerendering", "Force software rendering (requires restart)", "Disables hardware rendering for troublesome display cards", false);
            generalOptionsPage.Add(iSoftwareRenderingOption);
            iHelper.AddOptionPage(generalOptionsPage);

            iOptionPageUpdates = new OptionPageUpdates(iHelper);
            iHelper.AddOptionPage(iOptionPageUpdates);



            OptionPage fontsOptionPage = new OptionPage("Fonts");

            iFontsOption = new OptionEnum("fontsize", "Font size", "Font size");
            iFontsOption.AddDefault(kFontOptionNormal);
            iFontsOption.Add(kFontOptionLarge);
            fontsOptionPage.Add(iFontsOption);

            iHideCursorOption.EventValueChanged            += OnOptionChanged;
            iRotaryControlsOption.EventValueChanged        += OnOptionChanged;
            iShowToolTipsOption.EventValueChanged          += OnOptionChanged;
            iShowExtendedTrackInfoOption.EventValueChanged += OnOptionChanged;
            iFontsOption.EventValueChanged              += OnOptionChanged;
            iTransparentOption.EventValueChanged        += OnOptionChanged;
            iOptionPageUpdates.EventBetaVersionsChanged += OnUpdatesChanged;
            iOptionPageUpdates.EventAutoUpdateChanged   += OnUpdatesChanged;

            iHelper.AddOptionPage(fontsOptionPage);

            iViewMaster = new ViewMaster();
            iHttpServer = new HttpServer(HttpServer.kPortKinskyDesktop);
            iHttpClient = new HttpClient();

            iLibrary         = new MediaProviderLibrary(iHelper);
            iSharedPlaylists = new SharedPlaylists(iHelper);
            iLocalPlaylists  = new LocalPlaylists(iHelper, true);

            iSupport = new MediaProviderSupport(iHttpServer);

            PluginManager pluginManager = new PluginManager(iHelper, iHttpClient, iSupport);

            iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler());
            OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists);
            OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);

            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
            iHelper.AddOptionPage(iLocator.OptionPage);

            iSaveSupport     = new SaveSupport(iHelper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
            iViewSaveSupport = new ViewSaveSupport(RequestLocalPlaylistFilename, iSaveSupport);
            iPlaySupport     = new PlaySupport();

            iHelper.ProcessOptionsFileAndCommandLine();
            SetUpdateTypes();
        }
示例#16
0
        private string GetString(OptionPage page, string fallback, string resourceId)
        {
            if (String.IsNullOrEmpty(resourceId))
                return fallback;

            string result;
            ErrorUtil.ThrowOnFailure(page.Package.Package.GetStringResource(resourceId, out result));

            if (String.IsNullOrEmpty(result))
                return fallback;

            return result;
        }
示例#17
0
        private TreeNode GetCategoryNode(OptionPage page)
        {
            TreeNode treeNode;

            if (_categoryNodes.TryGetValue(page.Registration.CategoryName, out treeNode))
                return treeNode;

            treeNode = new TreeNode
            {
                Text = GetString(page, page.Registration.CategoryName, page.Registration.CategoryNameResourceKey),
                Tag = new OptionCategory(page.Registration.CategoryName)
            };

            InsertCategorySorted(_treeView.Nodes, treeNode);

            _categoryNodes[page.Registration.CategoryName] = treeNode;

            return treeNode;
        }
示例#18
0
        private void _treeView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            var newPage = (OptionPage)(e.Node.Nodes.Count > 0 ? e.Node.Nodes[0] : e.Node).Tag;

            if (_currentPage == newPage)
                return;

            if (!CanDeactivate())
            {
                e.Cancel = true;
                return;
            }

            _currentPage = newPage;

            if (_currentPage.Page == null)
            {
                object instance;
                ErrorUtil.ThrowOnFailure(_localRegistry.CreateInstance(
                    _currentPage.Registration.Id,
                    _currentPage.Package.Package,
                    out instance
                ));

                _currentPage.Page = (INiOptionPage)instance;

                ErrorUtil.ThrowOnFailure(_currentPage.Page.Initialize());
            }

            _pageHost.Page = _currentPage.Page;

            ErrorUtil.ThrowOnFailure(_currentPage.Page.Activate());

            _lastSelectedCategory = _currentPage.Registration.CategoryName;
            _lastSelectedPage = _currentPage.Registration.PageName;
        }
示例#19
0
        private void ToolsOptionsDialog_Load(object sender, EventArgs e)
        {
            _localRegistry = (NiLocalRegistry)GetService(typeof(INiLocalRegistry));

            var packageManager = (NiPackageManager)GetService(typeof(INiPackageManager));

            foreach (var registration in _localRegistry.Registrations.OfType<OptionPageRegistration>())
            {
                var optionPage = new OptionPage(registration, packageManager.Packages[registration.Package]);

                _pages.Add(optionPage);

                var categoryNode = GetCategoryNode(optionPage);

                var treeNode = new TreeNode
                {
                    Text = GetString(optionPage, registration.PageName, registration.PageNameResourceKey),
                    Tag = optionPage
                };

                InsertPageSorted(categoryNode.Nodes, treeNode);

                if (
                    registration.CategoryName == _lastSelectedCategory &&
                    registration.PageName == _lastSelectedPage
                )
                    _treeView.SelectedNode = treeNode;
            }

            if (_treeView.SelectedNode == null && _treeView.Nodes.Count > 0)
                _treeView.SelectedNode = _treeView.Nodes[0].Nodes[0];

            if (_treeView.SelectedNode != null)
                _treeView.SelectedNode.EnsureVisible();
        }