protected override void OnPageLoad() { //MainWindow.setGUIProperty("FanArt.SelectedPreview", ""); BaseConfig.MyAnimeLog.Write("OnPageLoad seriesid : {0}", MainWindow.GlobalSeriesID.ToString()); if (m_Facade != null) { m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; currentView = GUIFacadeControl.Layout.Filmstrip; } base.OnPageLoad(); // update skin controls UpdateLayoutButton(); if (labelWideBannerSource != null) { labelWideBannerSource.Label = Translation.Source + ": "; } if (labelDefault != null) { labelDefault.Label = Translation.Default + ": "; } if (labelDisabled != null) { labelDisabled.Label = Translation.Disabled; } ClearProperties(); ShowWideBanners(); }
protected override void OnPageLoad() { //MainWindow.setGUIProperty("FanArt.SelectedPreview", ""); CurrentView = BaseConfig.Settings.LastPosterViewMode; BaseConfig.MyAnimeLog.Write("OnPageLoad seriesid : {0}", MainWindow.GlobalSeriesID.ToString()); if (m_Facade != null) { m_Facade.CurrentLayout = CurrentView; } base.OnPageLoad(); // update skin controls UpdateLayoutButton(); if (labelPosterSource != null) { labelPosterSource.Label = "Source:"; } if (labelDefault != null) { labelDefault.Label = "Default: "; } if (labelDisabled != null) { labelDisabled.Label = "Disabled"; } ClearProperties(); ShowPosters(); }
protected override void OnPageLoad() { viewIsFullscreen = false; //MainWindow.setGUIProperty("FanArt.SelectedPreview", ""); CurrentView = BaseConfig.Settings.LastFanartViewMode; BaseConfig.MyAnimeLog.Write("OnPageLoad:FanartWindow seriesid : {0} - CurrentView: {1}", MainWindow.GlobalSeriesID.ToString(), CurrentView); if (m_Facade != null) { m_Facade.CurrentLayout = CurrentView; } base.OnPageLoad(); // update skin controls UpdateLayoutButton(); ClearProperties(); BaseConfig.MyAnimeLog.Write("Fanart Chooser Window initializing"); ShowFanart(); }
private void UpdateLayoutButton() { string strLine = string.Empty; GUIFacadeControl.Layout view = CurrentView; switch (view) { case GUIFacadeControl.Layout.List: strLine = GUILocalizeStrings.Get(101); break; case GUIFacadeControl.Layout.SmallIcons: strLine = GUILocalizeStrings.Get(100); break; case GUIFacadeControl.Layout.LargeIcons: strLine = GUILocalizeStrings.Get(417); break; case GUIFacadeControl.Layout.Filmstrip: strLine = GUILocalizeStrings.Get(733); break; case GUIFacadeControl.Layout.Playlist: strLine = GUILocalizeStrings.Get(101); break; } }
/// <summary> /// Set facade Layout /// </summary> /// <param name="layout">Layout string name</param> internal void SetFacadeLayout(string layout) { if (string.IsNullOrEmpty(layout)) { return; } GUIFacadeControl.Layout _l; if (Enum.TryParse(layout, out _l)) { Layout = _l; } }
/// <summary> /// Initializes a new instance of the FanartImage class. /// </summary> internal LatestsFacade() { ControlID = 0; FocusedID = -1; SelectedItem = -1; SelectedImage = -1; LeftToRight = true; UnWatched = true; AddProperties = false; HasNew = false; Update = 0; Type = LatestsFacadeType.Latests; SubType = LatestsFacadeSubType.None; ThumbType = LatestsFacadeThumbType.None; Layout = GUIFacadeControl.Layout.Filmstrip; }
public static int ProperDefaultFromLayout(GUIFacadeControl.Layout layout) { switch (layout) { case GUIFacadeControl.Layout.SmallIcons: return(1); case GUIFacadeControl.Layout.LargeIcons: return(2); case GUIFacadeControl.Layout.AlbumView: return(3); case GUIFacadeControl.Layout.Filmstrip: return(4); case GUIFacadeControl.Layout.CoverFlow: return(5); default: return(0); } }
protected bool AllowView(GUIFacadeControl.Layout view) { if (view == GUIFacadeControl.Layout.List) { return(false); } if (view == GUIFacadeControl.Layout.AlbumView) { return(false); } if (view == GUIFacadeControl.Layout.Playlist) { return(false); } return(true); }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == btnWideBanners) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); } if (control == btnFanart) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.FANART, false); } if (control == buttonLayouts) { switch (CurrentView) { case GUIFacadeControl.Layout.LargeIcons: m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; CurrentView = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); break; case GUIFacadeControl.Layout.Filmstrip: m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; CurrentView = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); break; } UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); } if (MA3WindowManager.HandleWindowChangeButton(control)) { return; } }
public static String GetAnimeImageAsFileName(AniDB_AnimeVM anime, GUIFacadeControl.Layout viewMode) { string imgFileName = ""; switch (viewMode) { case GUIFacadeControl.Layout.LargeIcons: imgFileName = GetWideBannerAsFileName(anime); break; case GUIFacadeControl.Layout.List: case GUIFacadeControl.Layout.AlbumView: case GUIFacadeControl.Layout.Filmstrip: case GUIFacadeControl.Layout.CoverFlow: imgFileName = GetPosterAsFileName(anime); break; } //BaseConfig.MyAnimeLog.Write("GetSeriesBannerAsFileName::viewMode: {0} : {1} : {2}", viewMode, imgFileName, ser); return(imgFileName); }
public static String GetSeriesImage(AnimeSeriesVM ser, GUIFacadeControl.Layout viewMode) { string imgFileName = ""; Size sz = PosterSize; switch (viewMode) { case GUIFacadeControl.Layout.LargeIcons: imgFileName = GetWideBannerAsFileName(ser.AniDB_Anime); sz = BannerSize; break; case GUIFacadeControl.Layout.List: case GUIFacadeControl.Layout.AlbumView: case GUIFacadeControl.Layout.Filmstrip: case GUIFacadeControl.Layout.CoverFlow: imgFileName = GetPosterAsFileName(ser.AniDB_Anime); sz = PosterSize; break; } //BaseConfig.MyAnimeLog.Write("GetSeriesBannerAsFileName::viewMode: {0} : {1} : {2}", viewMode, imgFileName, ser); if (imgFileName.Length == 0) { string ident = "series_" + ser.SeriesName; string sTextureName = buildMemoryImage(drawSimpleBanner(sz, ser.SeriesName), ident, sz, true); if (sTextureName.Length > 0 && !s_SeriesImageList.Contains(sTextureName)) { s_SeriesImageList.Add(sTextureName); } return(sTextureName); } else { string sTextureName = ""; if (imgFileName.Length > 0 && System.IO.File.Exists(imgFileName)) { sTextureName = buildMemoryImageFromFile(imgFileName, sz); } return(sTextureName); } }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { MainMenu menu = new MainMenu(); menu.Add(btnWideBanners, () => { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); }); menu.Add(btnFanart, () => { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.FANART, false); }); menu.Add(buttonLayouts, () => { switch (CurrentView) { case GUIFacadeControl.Layout.LargeIcons: m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; CurrentView = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); break; case GUIFacadeControl.Layout.Filmstrip: m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; CurrentView = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); break; } UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); }); menu.Check(control); }
protected virtual void InitLayoutSelections() { btnLayouts.ClearMenu(); // Add the allowed layouts to choose from to the menu. int totalLayouts = Enum.GetValues(typeof(GUIFacadeControl.Layout)).Length; for (int i = 0; i < totalLayouts; i++) { string layoutName = Enum.GetName(typeof(GUIFacadeControl.Layout), i); GUIFacadeControl.Layout layout = GetLayoutNumber(layoutName); if (AllowLayout(layout)) { if (!facadeLayout.IsNullLayout(layout)) { btnLayouts.AddItem(GUIFacadeControl.GetLayoutLocalizedName(layout), (int)layout); } } } // Have the menu select the currently selected layout. btnLayouts.SetSelectedItemByValue((int)CurrentLayout); }
private void UpdateLayoutButton() { string strLine = string.Empty; GUIFacadeControl.Layout view = CurrentView; switch (view) { case GUIFacadeControl.Layout.List: strLine = GUILocalizeStrings.Get(101); break; case GUIFacadeControl.Layout.SmallIcons: strLine = GUILocalizeStrings.Get(100); break; case GUIFacadeControl.Layout.LargeIcons: strLine = GUILocalizeStrings.Get(417); break; case GUIFacadeControl.Layout.Filmstrip: strLine = GUILocalizeStrings.Get(733); break; case GUIFacadeControl.Layout.CoverFlow: strLine = GUILocalizeStrings.Get(791); break; case GUIFacadeControl.Layout.Playlist: strLine = GUILocalizeStrings.Get(101); break; } if (buttonLayouts != null) { GUIControl.SetControlLabel(GetID, buttonLayouts.GetID, strLine); } }
public static String GetGroupImageAsFileName(AnimeGroupVM grp, GUIFacadeControl.Layout viewMode) { string imgFileName = ""; DateTime start = DateTime.Now; switch (viewMode) { case GUIFacadeControl.Layout.LargeIcons: imgFileName = GetWideBannerAsFileName(grp); break; case GUIFacadeControl.Layout.List: case GUIFacadeControl.Layout.AlbumView: case GUIFacadeControl.Layout.Filmstrip: case GUIFacadeControl.Layout.CoverFlow: imgFileName = GetPosterAsFileName(grp); break; } TimeSpan ts = DateTime.Now - start; BaseConfig.MyAnimeLog.Write("GetGroupImageAsFileName::: {0} in {1}ms", grp.GroupName, ts.TotalMilliseconds); return(imgFileName); }
protected virtual void SwitchToNextAllowedLayout(GUIFacadeControl.Layout selectedLayout) { int iSelectedLayout = (int)selectedLayout; int totalLayouts = Enum.GetValues(typeof(GUIFacadeControl.Layout)).Length - 1; if (iSelectedLayout > totalLayouts) { iSelectedLayout = 0; } bool shouldContinue = true; do { if (!AllowLayout(selectedLayout) || facadeLayout.IsNullLayout(selectedLayout)) { iSelectedLayout++; if (iSelectedLayout > totalLayouts) { iSelectedLayout = 0; } } else { shouldContinue = false; } } while (shouldContinue); CurrentLayout = (GUIFacadeControl.Layout)iSelectedLayout; SwitchLayout(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LAYOUT_CHANGED, 0, 0, 0, 0, 0, 0); GUIWindowManager.SendMessage(msg); }
protected override void OnPageLoad() { BaseConfig.MyAnimeLog.Write("Starting page load..."); SubClass(); hook = new KeyboardHook(); hook.KeyDown += new KeyEventHandlerEx(hook_KeyDown); hook.KeyUp += new KeyEventHandlerEx(hook_KeyUp); hook.IsEnabled = true; if (!isFirstInitDone) OnFirstStart(); currentViewClassification = settings.LastViewClassification; currentStaticViewID = settings.LastStaticViewID; currentView = settings.LastView; groupViewMode = settings.LastGroupViewMode; m_Facade.CurrentLayout = groupViewMode; //backdrop.LoadingImage = loadingImage; Console.Write(JMMServerVM.Instance.ServerOnline.ToString()); LoadFacade(); m_Facade.Focus = true; SkinSettings.Load(); //MainWindow.anidbProcessor.UpdateVotesHTTP(MainWindow.settings.Username, MainWindow.settings.Password); autoUpdateTimer.Start(); BaseConfig.MyAnimeLog.Write("Thumbs Setting Folder: {0}", settings.ThumbsFolder); //searching setGUIProperty(guiProperty.FindInput, " "); setGUIProperty(guiProperty.FindText, " "); setGUIProperty(guiProperty.FindMatch, " "); search = new SearchCollection(); search.List = m_Facade; search.ListItemSearchProperty = "DVDLabel"; search.Mode = settings.FindMode; search.StartWord = settings.FindStartWord; UpdateSearchPanel(false); DownloadAllImages(); }
protected override void OnPageLoad() { //MainWindow.setGUIProperty("FanArt.SelectedPreview", ""); BaseConfig.MyAnimeLog.Write("OnPageLoad seriesid : {0}", MainWindow.GlobalSeriesID.ToString()); if (m_Facade != null) { m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; currentView = GUIFacadeControl.Layout.Filmstrip; } base.OnPageLoad(); // update skin controls UpdateLayoutButton(); if (labelWideBannerSource != null) labelWideBannerSource.Label = "Source:"; if (labelDefault != null) labelDefault.Label = "Default: "; if (labelDisabled != null) labelDisabled.Label = "Disabled"; ClearProperties(); ShowWideBanners(); }
private ContextMenuAction ShowLayoutMenu(string previousMenu) { ContextMenu cmenu = new ContextMenu(Translation.ChangeLayout, previousMenu); cmenu.AddAction(Translation.ListPosters, () => groupViewMode = GUIFacadeControl.Layout.List); cmenu.AddAction(Translation.WideBanners, () => groupViewMode = GUIFacadeControl.Layout.LargeIcons); cmenu.AddAction(Translation.Filmstrip, () => groupViewMode = GUIFacadeControl.Layout.Filmstrip); if (!m_Facade.IsNullLayout(GUIFacadeControl.Layout.CoverFlow)) cmenu.AddAction(Translation.Coverflow, () => groupViewMode = GUIFacadeControl.Layout.CoverFlow); ContextMenuAction context = cmenu.Show(); if (context == ContextMenuAction.Exit) { History level = GetCurrent(); if (level.Listing is GroupFilterVM && ((GroupFilterVM)level.Listing).Childs.Count == 0) { settings.LastGroupViewMode = groupViewMode; settings.Save(); } LoadFacade(); } return context; }
private void ToggleFacadeViewMode() { switch (currentView) { case GUIFacadeControl.Layout.List: currentView = GUIFacadeControl.Layout.SmallIcons; break; case GUIFacadeControl.Layout.SmallIcons: currentView = GUIFacadeControl.Layout.LargeIcons; break; case GUIFacadeControl.Layout.LargeIcons: currentView = GUIFacadeControl.Layout.List; break; } switch (CurrentState) { case State.groups: PluginConfiguration.Instance.currentGroupView = currentView; break; case State.sites: PluginConfiguration.Instance.currentSiteView = currentView; break; case State.categories: PluginConfiguration.Instance.currentCategoryView = currentView; break; case State.videos: PluginConfiguration.Instance.currentVideoView = currentView; break; } if (CurrentState != State.details) SetFacadeViewMode(); }
public void Load() { Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); //MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"); JMMServer_Address = xmlreader.GetValueAsString("Anime3", "JMMServer_Address", "127.0.0.1"); JMMServer_Port = xmlreader.GetValueAsString("Anime3", "JMMServer_Port", "8111"); ImportFolderMappingsList = xmlreader.GetValueAsString("Anime3", "ImportFolderMappingsList", ""); CurrentJMMUserID = xmlreader.GetValueAsString("Anime3", "CurrentJMMUserID", ""); thumbsFolder = xmlreader.GetValueAsString("Anime3", "ThumbsFolder", ""); PluginName = xmlreader.GetValueAsString("Anime3", "PluginName", "My Anime 3"); //XMLWebServiceIP = xmlreader.GetValueAsString("Anime2", "XMLWebServiceIP", "anime.hobbydb.net"); LastGroupList = xmlreader.GetValueAsString("Anime3", "LastGroupList", ""); WatchedPercentage = int.Parse(xmlreader.GetValueAsString("Anime3", "WatchedPercentage", "90")); EpisodeDisplayFormat = xmlreader.GetValueAsString("Anime3", "EpisodeDisplayFormat", @"<EpNo>: <EpName>"); fileSelectionDisplayFormat = xmlreader.GetValueAsString("Anime3", "FileSelectionDisplayFormat", @"<AnGroupShort> - <FileRes> / <FileSource> / <VideoBitDepth>bit"); ShowMissing = GetBooleanSetting(ref xmlreader, "ShowMissing", true); ShowMissingMyGroupsOnly = GetBooleanSetting(ref xmlreader, "ShowMissingMyGroupsOnly", false); DisplayRatingDialogOnCompletion = GetBooleanSetting(ref xmlreader, "DisplayRatingDialogOnCompletion", true); string viewMode = xmlreader.GetValueAsString("Anime3", "LastGroupViewMode", "0"); LastGroupViewMode = (GUIFacadeControl.Layout) int.Parse(viewMode); string viewModeFan = xmlreader.GetValueAsString("Anime3", "LastFanartViewMode", "1"); LastFanartViewMode = (GUIFacadeControl.Layout) int.Parse(viewModeFan); string viewModePoster = xmlreader.GetValueAsString("Anime3", "LastPosterViewMode", "2"); LastPosterViewMode = (GUIFacadeControl.Layout) int.Parse(viewModePoster); HideWatchedFiles = GetBooleanSetting(ref xmlreader, "HideWatchedFiles", false); DefaultAudioLanguage = xmlreader.GetValueAsString("Anime3", "DefaultAudioLanguage", @"<file>"); DefaultSubtitleLanguage = xmlreader.GetValueAsString("Anime3", "DefaultSubtitleLanguage", @"<file>"); string findtimeout = xmlreader.GetValueAsString("Anime3", "FindTimeout", "3"); FindTimeout_s = int.Parse(findtimeout); string findmode = xmlreader.GetValueAsString("Anime3", "FindMode", "0"); FindMode = (SearchMode)int.Parse(findmode); FindStartWord = GetBooleanSetting(ref xmlreader, "FindStartWord", true); FindFilter = GetBooleanSetting(ref xmlreader, "FindFilter", true); AniDBAutoEpisodesSubbed = GetBooleanSetting(ref xmlreader, "AniDBAutoEpisodesSubbed", true); ShowOnlyAvailableEpisodes = GetBooleanSetting(ref xmlreader, "ShowOnlyAvailableEpisodes", true); HidePlot = GetBooleanSetting(ref xmlreader, "HidePlot", true); MenuDeleteFiles = GetBooleanSetting(ref xmlreader, "MenuDeleteFiles", false); string infodel = xmlreader.GetValueAsString("Anime3", "InfoDelay", "150"); InfoDelay = int.Parse(infodel); string postpct = xmlreader.GetValueAsString("Anime3", "PosterSizePct", "50"); int tmpPost; int.TryParse(postpct, out tmpPost); if (tmpPost > 0 && tmpPost <= 100) { PosterSizePct = tmpPost; } else { PosterSizePct = 50; } LoadLocalThumbnails = GetBooleanSetting(ref xmlreader, "LoadLocalThumbnails", true); string banpct = xmlreader.GetValueAsString("Anime3", "BannerSizePct", "50"); int tmpBanner; int.TryParse(banpct, out tmpBanner); if (tmpBanner > 0 && tmpBanner <= 100) { BannerSizePct = tmpBanner; } else { BannerSizePct = 50; } string ffdshowNotificationsShow = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsShow", "1"); FfdshowNotificationsShow = ffdshowNotificationsShow != "0"; string ffdshowNotificationsAutoClose = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoClose", "1"); FfdshowNotificationsAutoClose = ffdshowNotificationsAutoClose != "0"; string ffdshowNotificationsLock = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLock", "1"); FfdshowNotificationsLock = ffdshowNotificationsLock != "0"; FfdshowNotificationsAutoCloseTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoCloseTime", "3000")); FfdshowNotificationsLockTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLockTime", "5000")); ModeToggleKey = xmlreader.GetValueAsString("Anime3", "ModeToggleKey", "]"); StartTextToggleKey = xmlreader.GetValueAsString("Anime3", "StartTextToggleKey", "["); AskBeforeStartStreamingPlayback = GetBooleanSetting(ref xmlreader, "AskBeforeStartStreamingPlayback", true); HomeButtonNavigation = GetBooleanSetting(ref xmlreader, "HomeButtonNavigation", true); BasicHome = xmlreader.GetValueAsBool("gui", "startbasichome", false); _subPaths = xmlreader.GetValueAsString("subtitles", "paths", @".\"); xmlreader.Dispose(); }
public void Load() { StringDictionary settings = new StringDictionary(); MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); //MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"); JMMServer_Address = xmlreader.GetValueAsString("Anime3", "JMMServer_Address", "127.0.0.1"); JMMServer_Port = xmlreader.GetValueAsString("Anime3", "JMMServer_Port", "8111"); ImportFolderMappingsList = xmlreader.GetValueAsString("Anime3", "ImportFolderMappingsList", ""); CurrentJMMUserID = xmlreader.GetValueAsString("Anime3", "CurrentJMMUserID", ""); thumbsFolder = xmlreader.GetValueAsString("Anime3", "ThumbsFolder", ""); PluginName = xmlreader.GetValueAsString("Anime3", "PluginName", "My Anime 3"); //XMLWebServiceIP = xmlreader.GetValueAsString("Anime2", "XMLWebServiceIP", "anime.hobbydb.net"); LastGroupList = xmlreader.GetValueAsString("Anime2", "LastGroupList", ""); BakaBTUsername = xmlreader.GetValueAsString("Anime3", "BakaBTUsername", ""); BakaBTPassword = xmlreader.GetValueAsString("Anime3", "BakaBTPassword", ""); AnimeBytesUsername = xmlreader.GetValueAsString("Anime3", "AnimeBytesUsername", ""); AnimeBytesPassword = xmlreader.GetValueAsString("Anime3", "AnimeBytesPassword", ""); UTorrentAddress = xmlreader.GetValueAsString("Anime3", "UTorrentAddress", ""); UTorrentPassword = xmlreader.GetValueAsString("Anime3", "UTorrentPassword", ""); UTorrentPort = xmlreader.GetValueAsString("Anime3", "UTorrentPort", ""); UTorrentUsername = xmlreader.GetValueAsString("Anime3", "UTorrentUsername", ""); TorrentSourcesRaw = xmlreader.GetValueAsString("Anime3", "TorrentSources", AnimePluginSettings.TorrentSourcesAll); TorrentPreferOwnGroups = GetBooleanSetting(ref xmlreader, "TorrentPreferOwnGroups", true); WatchedPercentage = int.Parse(xmlreader.GetValueAsString("Anime3", "WatchedPercentage", "90")); EpisodeDisplayFormat = xmlreader.GetValueAsString("Anime3", "EpisodeDisplayFormat", @"<EpNo>: <EpName>"); fileSelectionDisplayFormat = xmlreader.GetValueAsString("Anime3", "FileSelectionDisplayFormat", @"<AnGroupShort> - <FileRes> / <FileSource> / <VideoBitDepth>bit"); ShowMissing = GetBooleanSetting(ref xmlreader, "ShowMissing", true); ShowMissingMyGroupsOnly = GetBooleanSetting(ref xmlreader, "ShowMissingMyGroupsOnly", false); DisplayRatingDialogOnCompletion = GetBooleanSetting(ref xmlreader, "DisplayRatingDialogOnCompletion", true); SingleSeriesGroups = GetBooleanSetting(ref xmlreader, "SingleSeriesGroups", false); string viewMode = ""; viewMode = xmlreader.GetValueAsString("Anime3", "LastGroupViewMode", "0"); LastGroupViewMode = (GUIFacadeControl.Layout) int.Parse(viewMode); string viewModeFan = ""; viewModeFan = xmlreader.GetValueAsString("Anime3", "LastFanartViewMode", "1"); LastFanartViewMode = (GUIFacadeControl.Layout) int.Parse(viewModeFan); string viewModePoster = ""; viewModePoster = xmlreader.GetValueAsString("Anime3", "LastPosterViewMode", "2"); LastPosterViewMode = (GUIFacadeControl.Layout) int.Parse(viewModePoster); HideWatchedFiles = GetBooleanSetting(ref xmlreader, "HideWatchedFiles", false); DefaultAudioLanguage = xmlreader.GetValueAsString("Anime3", "DefaultAudioLanguage", @"<file>"); DefaultSubtitleLanguage = xmlreader.GetValueAsString("Anime3", "DefaultSubtitleLanguage", @"<file>"); string findtimeout = ""; findtimeout = xmlreader.GetValueAsString("Anime3", "FindTimeout", "3"); FindTimeout_s = int.Parse(findtimeout); string findmode = ""; findmode = xmlreader.GetValueAsString("Anime3", "FindMode", "0"); FindMode = (SearchMode)int.Parse(findmode); FindStartWord = GetBooleanSetting(ref xmlreader, "FindStartWord", true); FindFilter = GetBooleanSetting(ref xmlreader, "FindFilter", true); AniDBAutoEpisodesSubbed = GetBooleanSetting(ref xmlreader, "AniDBAutoEpisodesSubbed", true); ShowOnlyAvailableEpisodes = GetBooleanSetting(ref xmlreader, "ShowOnlyAvailableEpisodes", true); HidePlot = GetBooleanSetting(ref xmlreader, "HidePlot", true); MenuDeleteFiles = GetBooleanSetting(ref xmlreader, "MenuDeleteFiles", false); string infodel = ""; infodel = xmlreader.GetValueAsString("Anime3", "InfoDelay", "150"); InfoDelay = int.Parse(infodel); string postpct = ""; postpct = xmlreader.GetValueAsString("Anime3", "PosterSizePct", "50"); int tmpPost = 0; int.TryParse(postpct, out tmpPost); if (tmpPost > 0 && tmpPost <= 100) { PosterSizePct = tmpPost; } else { PosterSizePct = 50; } string banpct = ""; banpct = xmlreader.GetValueAsString("Anime3", "BannerSizePct", "50"); int tmpBanner = 0; int.TryParse(banpct, out tmpBanner); if (tmpBanner > 0 && tmpBanner <= 100) { BannerSizePct = tmpBanner; } else { BannerSizePct = 50; } string ffdshowNotificationsShow = ""; ffdshowNotificationsShow = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsShow", "1"); FfdshowNotificationsShow = ffdshowNotificationsShow == "0" ? false : true; string ffdshowNotificationsAutoClose = ""; ffdshowNotificationsAutoClose = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoClose", "1"); FfdshowNotificationsAutoClose = ffdshowNotificationsAutoClose == "0" ? false : true; string ffdshowNotificationsLock = ""; ffdshowNotificationsLock = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLock", "1"); FfdshowNotificationsLock = ffdshowNotificationsLock == "0" ? false : true; FfdshowNotificationsAutoCloseTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoCloseTime", "3000")); FfdshowNotificationsLockTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLockTime", "5000")); xmlreader.Dispose(); // parse the list of torrent sources if (TorrentSourcesRaw.Length > 0) { string[] fitems = TorrentSourcesRaw.Split(';'); foreach (string s in fitems) { TorrentSources.Add(s); } } }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { MainMenu menu = new MainMenu(); menu.Add(btnWideBanners, () => { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); }); menu.Add(btnPosters, () => { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.POSTERS, false); }); menu.Add(buttonLayouts, () => { bool shouldContinue; do { shouldContinue = false; switch (CurrentView) { case GUIFacadeControl.Layout.List: CurrentView = GUIFacadeControl.Layout.Playlist; if (!AllowView(CurrentView) || m_Facade.PlayListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Playlist: CurrentView = GUIFacadeControl.Layout.SmallIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.SmallIcons: CurrentView = GUIFacadeControl.Layout.LargeIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.LargeIcons: CurrentView = GUIFacadeControl.Layout.Filmstrip; if (!AllowView(CurrentView) || m_Facade.FilmstripLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Filmstrip: CurrentView = GUIFacadeControl.Layout.List; if (!AllowView(CurrentView) || m_Facade.ListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.List; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.List; BaseConfig.Settings.Save(); } break; } } while (shouldContinue); UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); }); if (menu.Check(control)) return; base.OnClicked(controlId, control, actionType); }
protected override void OnPageLoad() { BaseConfig.MyAnimeLog.Write("Starting page load..."); pluginsIsShown = true; Utils.GetLatestVersionAsync(); //Removed will generate problems with MediaPortal //SubClass(); if (!isFirstInitDone) { OnFirstStart(); } currentViewClassification = settings.LastViewClassification; currentStaticViewID = settings.LastStaticViewID; currentView = settings.LastView; groupViewMode = settings.LastGroupViewMode; m_Facade.CurrentLayout = groupViewMode; //backdrop.LoadingImage = loadingImage; Console.Write(JMMServerVM.Instance.ServerOnline.ToString()); LoadFacade(); m_Facade.Focus = true; SkinSettings.Load(); //MainWindow.anidbProcessor.UpdateVotesHTTP(MainWindow.settings.Username, MainWindow.settings.Password); autoUpdateTimer.Start(); BaseConfig.MyAnimeLog.Write("Thumbs Setting Folder: {0}", settings.ThumbsFolder); //searching ClearGUIProperty(GuiProperty.FindInput); ClearGUIProperty(GuiProperty.FindText); ClearGUIProperty(GuiProperty.FindMatch); search = new SearchCollection(); search.List = m_Facade; search.ListItemSearchProperty = "DVDLabel"; search.Mode = settings.FindMode; search.StartWord = settings.FindStartWord; UpdateSearchPanel(false); DownloadAllImages(); }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { MainMenu menu = new MainMenu(); menu.Add(btnWideBanners, () => { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); }); menu.Add(btnPosters, () => { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.POSTERS, false); }); menu.Add(buttonLayouts, () => { bool shouldContinue; do { shouldContinue = false; switch (CurrentView) { case GUIFacadeControl.Layout.List: CurrentView = GUIFacadeControl.Layout.Playlist; if (!AllowView(CurrentView) || m_Facade.PlayListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Playlist: CurrentView = GUIFacadeControl.Layout.SmallIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.SmallIcons: CurrentView = GUIFacadeControl.Layout.LargeIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.LargeIcons: CurrentView = GUIFacadeControl.Layout.Filmstrip; if (!AllowView(CurrentView) || m_Facade.FilmstripLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Filmstrip: CurrentView = GUIFacadeControl.Layout.List; if (!AllowView(CurrentView) || m_Facade.ListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.List; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.List; BaseConfig.Settings.Save(); } break; } } while (shouldContinue); UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); }); if (menu.Check(control)) { return; } base.OnClicked(controlId, control, actionType); }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == btnWideBanners) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); } if (control == btnFanart) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.FANART, false); } if (control == buttonLayouts) { switch (CurrentView) { case GUIFacadeControl.Layout.LargeIcons: m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; CurrentView = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); break; case GUIFacadeControl.Layout.Filmstrip: m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; CurrentView = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastPosterViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); break; } UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); } if (MA3WindowManager.HandleWindowChangeButton(control)) return; }
private void UpdateViewState() { switch (CurrentState) { case State.groups: GUIPropertyManager.SetProperty("#OnlineVideos.HeaderLabel", PluginConfiguration.Instance.BasicHomeScreenName); GUIPropertyManager.SetProperty("#OnlineVideos.HeaderImage", SiteImageExistenceCache.GetImageForSite("OnlineVideos")); ShowAndEnable(GUI_facadeView.GetID); HideFilterButtons(); HideSearchButtons(); if (OnlineVideoSettings.Instance.UseAgeConfirmation && !OnlineVideoSettings.Instance.AgeConfirmed) ShowAndEnable(GUI_btnEnterPin.GetID); else HideAndDisable(GUI_btnEnterPin.GetID); currentView = PluginConfiguration.Instance.currentGroupView; SetFacadeViewMode(); GUIPropertyManager.SetProperty("#itemtype", Translation.Instance.Groups); break; case State.sites: GUIPropertyManager.SetProperty("#OnlineVideos.HeaderLabel", PluginConfiguration.Instance.BasicHomeScreenName + (selectedSitesGroup != null ? ": " + selectedSitesGroup.Label : "")); GUIPropertyManager.SetProperty("#OnlineVideos.HeaderImage", SiteImageExistenceCache.GetImageForSite("OnlineVideos")); ShowAndEnable(GUI_facadeView.GetID); HideFilterButtons(); ShowOrderButtons(); HideSearchButtons(); if (OnlineVideoSettings.Instance.UseAgeConfirmation && !OnlineVideoSettings.Instance.AgeConfirmed) ShowAndEnable(GUI_btnEnterPin.GetID); else HideAndDisable(GUI_btnEnterPin.GetID); currentView = PluginConfiguration.Instance.currentSiteView; SetFacadeViewMode(); GUIPropertyManager.SetProperty("#itemtype", Translation.Instance.Sites); break; case State.categories: string cat_headerlabel = selectedCategory != null ? selectedCategory.RecursiveName() : SelectedSite.Settings.Name; GUIPropertyManager.SetProperty("#OnlineVideos.HeaderLabel", cat_headerlabel); GUIPropertyManager.SetProperty("#OnlineVideos.HeaderImage", SiteImageExistenceCache.GetImageForSite(SelectedSite.Settings.Name, SelectedSite.Settings.UtilName)); ShowAndEnable(GUI_facadeView.GetID); HideFilterButtons(); if (SelectedSite.CanSearch) ShowSearchButtons(); else HideSearchButtons(); HideAndDisable(GUI_btnEnterPin.GetID); currentView = suggestedView != null ? suggestedView.Value : PluginConfiguration.Instance.currentCategoryView; SetFacadeViewMode(); GUIPropertyManager.SetProperty("#itemtype", Translation.Instance.Categories); break; case State.videos: switch (currentVideosDisplayMode) { case VideosMode.Search: GUIPropertyManager.SetProperty("#OnlineVideos.HeaderLabel", Translation.Instance.SearchResults + " [" + lastSearchQuery + "]"); break; default: { string proposedLabel = SelectedSite.GetCurrentVideosTitle(); GUIPropertyManager.SetProperty("#OnlineVideos.HeaderLabel", proposedLabel != null ? proposedLabel : selectedCategory != null ? selectedCategory.RecursiveName() : ""); break; } } GUIPropertyManager.SetProperty("#OnlineVideos.HeaderImage", SiteImageExistenceCache.GetImageForSite(SelectedSite.Settings.Name, SelectedSite.Settings.UtilName)); ShowAndEnable(GUI_facadeView.GetID); if (SelectedSite is IFilter) ShowFilterButtons(); else HideFilterButtons(); if (SelectedSite.CanSearch) ShowSearchButtons(); else HideSearchButtons(); if (SelectedSite.HasFilterCategories) ShowCategoryButton(); HideAndDisable(GUI_btnEnterPin.GetID); currentView = suggestedView != null ? suggestedView.Value : PluginConfiguration.Instance.currentVideoView; SetFacadeViewMode(); GUIPropertyManager.SetProperty("#itemtype", Translation.Instance.Videos); break; case State.details: GUIPropertyManager.SetProperty("#OnlineVideos.HeaderLabel", selectedVideo.Title); GUIPropertyManager.SetProperty("#OnlineVideos.HeaderImagee", SiteImageExistenceCache.GetImageForSite(SelectedSite.Settings.Name, SelectedSite.Settings.UtilName)); HideAndDisable(GUI_facadeView.GetID); HideFilterButtons(); HideSearchButtons(); HideAndDisable(GUI_btnEnterPin.GetID); GUIPropertyManager.SetProperty("#itemcount", (GUI_infoList.Count - 1).ToString()); break; } GUIWindowManager.Process(); // required for the next statement to work correctly, so the skinengine has correct state for visibility and focus if (CurrentState == State.details) GUIControl.FocusControl(GetID, GUI_infoList.GetID); else GUIControl.FocusControl(GetID, GUI_facadeView.GetID); }
private bool ShowLayoutMenu(string previousMenu) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) return true; //keep showing the dialog until the user closes it int selectedLabel = 0; string currentMenu = "Change Layout"; while (true) { dlg.Reset(); dlg.SetHeading(currentMenu); if (previousMenu != string.Empty) dlg.Add("<<< " + previousMenu); dlg.Add("List Posters"); dlg.Add("Wide Banners"); dlg.Add("Filmstrip"); if (!m_Facade.IsNullLayout(GUIFacadeControl.Layout.CoverFlow)) dlg.Add("Coverflow"); dlg.SelectedLabel = selectedLabel; dlg.DoModal(GUIWindowManager.ActiveWindow); selectedLabel = dlg.SelectedLabel; int selection = selectedLabel + ((previousMenu == string.Empty) ? 1 : 0); switch (selection) { case 0: //show previous return true; case 1: groupViewMode = GUIFacadeControl.Layout.List; break; case 2: groupViewMode = GUIFacadeControl.Layout.LargeIcons; break; case 3: groupViewMode = GUIFacadeControl.Layout.Filmstrip; break; case 4: // Disabled for now due to a bug - enable to see the issue groupViewMode = GUIFacadeControl.Layout.CoverFlow; break; //Utils.DialogMsg("Disabled", "This Layout is temporarily disabled"); //return false; default: //close menu return false; } break; } if (listLevel == Listlevel.Group) { settings.LastGroupViewMode = groupViewMode; settings.Save(); } LoadFacade(); return false; }
protected virtual bool AllowLayout(GUIFacadeControl.Layout layout) { return(true); }
void Load() { OnlineVideos.OnlineVideoSettings ovsconf = OnlineVideos.OnlineVideoSettings.Instance; ovsconf.UserStore = new UserStore(); ovsconf.FavDB = FavoritesDatabase.Instance; ovsconf.Logger = Log.Instance; ovsconf.ThumbsDir = Config.GetFolder(Config.Dir.Thumbs) + @"\OnlineVideos\"; ovsconf.ConfigDir = Config.GetFolder(Config.Dir.Config); ovsconf.DllsDir = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "OnlineVideos\\"); // When run from MPEI we get an invalid plugin directory, we'll try to rectify that here try { var hasFiles = true; if (Directory.Exists(ovsconf.DllsDir)) { var files = Directory.GetFiles(ovsconf.DllsDir, "OnlineVideos.Sites.*.dll"); if (files == null || files.Count() == 0) hasFiles = false; } else hasFiles = false; if (!hasFiles) ovsconf.DllsDir = Path.Combine(MediaPortal.Configuration.Config.GetDirectoryInfo(MediaPortal.Configuration.Config.Dir.Plugins).FullName, "Windows\\OnlineVideos"); } catch (Exception ex) { Log.Instance.Error(ex); } ovsconf.ThumbsResizeOptions = new OnlineVideos.Downloading.ImageDownloader.ResizeOptions() { MaxSize = (int)Thumbs.ThumbLargeResolution, Compositing = Thumbs.Compositing, Interpolation = Thumbs.Interpolation, Smoothing = Thumbs.Smoothing }; try { ovsconf.Locale = CultureInfo.CreateSpecificCulture(GUILocalizeStrings.GetCultureName(GUILocalizeStrings.CurrentLanguage())); } catch (Exception ex) { Log.Instance.Error(ex); } try { using (Settings settings = new MPSettings()) { BasicHomeScreenName = settings.GetValueAsString(CFG_SECTION, CFG_BASICHOMESCREEN_NAME, BasicHomeScreenName); siteOrder = (SiteOrder)settings.GetValueAsInt(CFG_SECTION, CFG_SITEVIEW_ORDER, (int)SiteOrder.AsInFile); currentGroupView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_GROUPVIEW_MODE, (int)GUIFacadeControl.Layout.List); currentSiteView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_SITEVIEW_MODE, (int)GUIFacadeControl.Layout.List); currentCategoryView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_CATEGORYVIEW_MODE, (int)GUIFacadeControl.Layout.List); currentVideoView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_VIDEOVIEW_MODE, (int)GUIFacadeControl.Layout.SmallIcons); ovsconf.ThumbsDir = settings.GetValueAsString(CFG_SECTION, CFG_THUMBNAIL_DIR, ovsconf.ThumbsDir).Replace("/", @"\"); if (!ovsconf.ThumbsDir.EndsWith(@"\")) ovsconf.ThumbsDir = ovsconf.ThumbsDir + @"\"; // fix thumbnail dir to include the trailing slash try { if (!string.IsNullOrEmpty(ovsconf.ThumbsDir) && !Directory.Exists(ovsconf.ThumbsDir)) Directory.CreateDirectory(ovsconf.ThumbsDir); } catch (Exception e) { Log.Instance.Error("Failed to create thumb dir: {0}", e.ToString()); } ThumbsAge = settings.GetValueAsInt(CFG_SECTION, CFG_THUMBNAIL_AGE, ThumbsAge); Log.Instance.Info("Thumbnails will be stored in {0} with a maximum age of {1} days.", ovsconf.ThumbsDir, ThumbsAge); ovsconf.DownloadDir = settings.GetValueAsString(CFG_SECTION, CFG_DOWNLOAD_DIR, ""); try { if (!string.IsNullOrEmpty(ovsconf.DownloadDir) && !Directory.Exists(ovsconf.DownloadDir)) Directory.CreateDirectory(ovsconf.DownloadDir); } catch (Exception e) { Log.Instance.Error("Failed to create download dir: {0}", e.ToString()); } ovsconf.CacheTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_CACHE_TIMEOUT, ovsconf.CacheTimeout); ovsconf.UseAgeConfirmation = settings.GetValueAsBool(CFG_SECTION, CFG_USE_AGECONFIRMATION, ovsconf.UseAgeConfirmation); ovsconf.UtilTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_UTIL_TIMEOUT, ovsconf.UtilTimeout); ovsconf.DynamicCategoryTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_CATEGORYDISCOVERED_TIMEOUT, ovsconf.DynamicCategoryTimeout); // set an almost random string by default -> user must enter pin in Configuration before beeing able to watch adult sites pinAgeConfirmation = settings.GetValueAsString(CFG_SECTION, CFG_PIN_AGECONFIRMATION, DateTime.Now.Millisecond.ToString()); useQuickSelect = settings.GetValueAsBool(CFG_SECTION, CFG_USE_QUICKSELECT, useQuickSelect); wmpbuffer = settings.GetValueAsInt(CFG_SECTION, CFG_WMP_BUFFER, wmpbuffer); playbuffer = settings.GetValueAsInt(CFG_SECTION, CFG_PLAY_BUFFER, playbuffer); email = settings.GetValueAsString(CFG_SECTION, CFG_EMAIL, ""); password = settings.GetValueAsString(CFG_SECTION, CFG_PASSWORD, ""); string lsFilter = settings.GetValueAsString(CFG_SECTION, CFG_FILTER, "").Trim(); FilterArray = lsFilter != "" ? lsFilter.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) : null; searchHistoryNum = settings.GetValueAsInt(CFG_SECTION, CFG_SEARCHHISTORY_NUM, searchHistoryNum); searchHistoryType = (SearchHistoryType)settings.GetValueAsInt(CFG_SECTION, CFG_SEARCHHISTORYTYPE, (int)searchHistoryType); string searchHistoryXML = settings.GetValueAsString(CFG_SECTION, CFG_SEARCHHISTORY, "").Trim(); if ("" != searchHistoryXML) { try { byte[] searchHistoryBytes = System.Text.Encoding.UTF8.GetBytes(searchHistoryXML); MemoryStream xmlMem = new MemoryStream(searchHistoryBytes); xmlMem.Position = 0; System.Runtime.Serialization.DataContractSerializer dcs = new System.Runtime.Serialization.DataContractSerializer(typeof(Dictionary<string, List<string>>)); searchHistory = (Dictionary<string, List<string>>)dcs.ReadObject(xmlMem); } catch (Exception e) { Log.Instance.Warn("Error reading search history from configuration: {0}:{1}! Clearing...", e.GetType(), e.Message); searchHistory = null; } } if (null == searchHistory) searchHistory = new Dictionary<string, List<string>>(); // set updateOnStart only when defined, so we have 3 modes: undefined = ask, true = don't ask and update, false = don't ask and don't update string doUpdateString = settings.GetValue(CFG_SECTION, CFG_UPDATEONSTART); if (!string.IsNullOrEmpty(doUpdateString)) updateOnStart = settings.GetValueAsBool(CFG_SECTION, CFG_UPDATEONSTART, true); // last point in time the plugin was run in mediaportal string tempDate = settings.GetValueAsString(CFG_SECTION, CFG_LAST_FIRSTRUN, string.Empty); if (!string.IsNullOrEmpty(tempDate)) DateTime.TryParse(tempDate, out lastFirstRun); updatePeriod = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_UPDATEPERIOD, (int)updatePeriod); // read the video extensions configured in MediaPortal string[] mediaportal_user_configured_video_extensions; string strTmp = settings.GetValueAsString("movies", "extensions", ".avi,.mpg,.ogm,.mpeg,.mkv,.wmv,.ifo,.qt,.rm,.mov,.sbe,.dvr-ms,.ts"); mediaportal_user_configured_video_extensions = strTmp.Split(','); var listOfExtensions = mediaportal_user_configured_video_extensions.ToList(); listOfExtensions.AddRange(new string[] { ".asf", ".asx", ".flv", ".m4v", ".mov", ".mp4", ".wmv" }); listOfExtensions = listOfExtensions.Distinct().ToList(); listOfExtensions.Sort(); ovsconf.AddSupportedVideoExtensions(listOfExtensions); autoGroupByLang = settings.GetValueAsBool(CFG_SECTION, CFG_AUTO_LANG_GROUPS, autoGroupByLang); ovsconf.FavoritesFirst = settings.GetValueAsBool(CFG_SECTION, CFG_FAVORITES_FIRST, ovsconf.FavoritesFirst); LatestVideosRandomize = settings.GetValueAsBool(CFG_SECTION, CFG_LATESTVIDEOS_RANDOMIZE, LatestVideosRandomize); LatestVideosMaxItems = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_LATESTVIDEOS_MAXITEMS, (int)LatestVideosMaxItems); LatestVideosOnlineDataRefresh = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_LATESTVIDEOS_ONLINEDATA_REFRESH, (int)LatestVideosOnlineDataRefresh); LatestVideosGuiDataRefresh = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_LATESTVIDEOS_GUIDATA_REFRESH, (int)LatestVideosGuiDataRefresh); AllowRefreshRateChange = settings.GetValueAsBool(CFG_SECTION, CFG_ALLOW_REFRESHRATE_CHANGE, AllowRefreshRateChange); StoreLayoutPerCategory = settings.GetValueAsBool(CFG_SECTION, CFG_STORE_LAYOUT_PER_CATEGORY, StoreLayoutPerCategory); ovsconf.HttpPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.HttpOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_OPEN_CONNECTION_TIMEOUT, ovsconf.HttpOpenConnectionTimeout); ovsconf.HttpOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.HttpOpenConnectionSleepTime); ovsconf.HttpTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.HttpTotalReopenConnectionTimeout); ovsconf.HttpServerAuthenticate = settings.GetValueAsBool(CFG_SECTION, CFG_FILTER_V2_HTTP_SERVER_AUTHENTICATE, ovsconf.HttpServerAuthenticate); ovsconf.HttpServerUserName = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_SERVER_USER_NAME, ovsconf.HttpServerUserName); ovsconf.HttpServerPassword = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_SERVER_PASSWORD, ovsconf.HttpServerPassword); ovsconf.HttpProxyServerAuthenticate = settings.GetValueAsBool(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_AUTHENTICATE, ovsconf.HttpProxyServerAuthenticate); ovsconf.HttpProxyServer = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER, ovsconf.HttpProxyServer); ovsconf.HttpProxyServerPort = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_PORT, ovsconf.HttpProxyServerPort); ovsconf.HttpProxyServerUserName = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_USER_NAME, ovsconf.HttpProxyServerUserName); ovsconf.HttpProxyServerPassword = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_PASSWORD, ovsconf.HttpProxyServerPassword); ovsconf.HttpProxyServerType = (OnlineVideos.MPUrlSourceFilter.ProxyServerType)settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_PROXY_SERVER_TYPE, (int)ovsconf.HttpProxyServerType); ovsconf.RtmpPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_RTMP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.RtmpOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTMP_OPEN_CONNECTION_TIMEOUT, ovsconf.RtmpOpenConnectionTimeout); ovsconf.RtmpOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTMP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.RtmpOpenConnectionSleepTime); ovsconf.RtmpTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTMP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.RtmpTotalReopenConnectionTimeout); ovsconf.RtspPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_RTSP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.RtspOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_OPEN_CONNECTION_TIMEOUT, ovsconf.RtspOpenConnectionTimeout); ovsconf.RtspOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.RtspOpenConnectionSleepTime); ovsconf.RtspTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.RtspTotalReopenConnectionTimeout); ovsconf.RtspClientPortMin = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_CLIENT_PORT_MIN, ovsconf.RtspClientPortMin); ovsconf.RtspClientPortMax = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_CLIENT_PORT_MAX, ovsconf.RtspClientPortMax); ovsconf.UdpRtpPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_UDPRTP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.UdpRtpOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_OPEN_CONNECTION_TIMEOUT, ovsconf.UdpRtpOpenConnectionTimeout); ovsconf.UdpRtpOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.UdpRtpOpenConnectionSleepTime); ovsconf.UdpRtpTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.UdpRtpTotalReopenConnectionTimeout); ovsconf.UdpRtpReceiveDataCheckInterval = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_RECEIVE_DATA_CHECK_INTERVAL, ovsconf.UdpRtpReceiveDataCheckInterval); } LoadSitesGroups(); ovsconf.LoadSites(); } catch (Exception e) { Log.Instance.Error(e); } }
protected virtual void SetLayout(GUIFacadeControl.Layout layout) { // Set the selected layout. SwitchToNextAllowedLayout(layout); }
void Load() { OnlineVideos.OnlineVideoSettings ovsconf = OnlineVideos.OnlineVideoSettings.Instance; ovsconf.UserStore = new UserStore(); ovsconf.FavDB = FavoritesDatabase.Instance; ovsconf.Logger = Log.Instance; ovsconf.ThumbsDir = Config.GetFolder(Config.Dir.Thumbs) + @"\OnlineVideos\"; ovsconf.ConfigDir = Config.GetFolder(Config.Dir.Config); ovsconf.DllsDir = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "OnlineVideos\\"); // When run from MPEI we get an invalid plugin directory, we'll try to rectify that here try { var hasFiles = true; if (Directory.Exists(ovsconf.DllsDir)) { var files = Directory.GetFiles(ovsconf.DllsDir, "OnlineVideos.Sites.*.dll"); if (files == null || files.Count() == 0) { hasFiles = false; } } else { hasFiles = false; } if (!hasFiles) { ovsconf.DllsDir = Path.Combine(MediaPortal.Configuration.Config.GetDirectoryInfo(MediaPortal.Configuration.Config.Dir.Plugins).FullName, "Windows\\OnlineVideos"); } } catch (Exception ex) { Log.Instance.Error(ex); } ovsconf.ThumbsResizeOptions = new OnlineVideos.Downloading.ImageDownloader.ResizeOptions() { MaxSize = (int)Thumbs.ThumbLargeResolution, Compositing = Thumbs.Compositing, Interpolation = Thumbs.Interpolation, Smoothing = Thumbs.Smoothing }; try { ovsconf.Locale = CultureInfo.CreateSpecificCulture(GUILocalizeStrings.GetCultureName(GUILocalizeStrings.CurrentLanguage())); } catch (Exception ex) { Log.Instance.Error(ex); } try { using (Settings settings = new MPSettings()) { BasicHomeScreenName = settings.GetValueAsString(CFG_SECTION, CFG_BASICHOMESCREEN_NAME, BasicHomeScreenName); siteOrder = (SiteOrder)settings.GetValueAsInt(CFG_SECTION, CFG_SITEVIEW_ORDER, (int)SiteOrder.AsInFile); currentGroupView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_GROUPVIEW_MODE, (int)GUIFacadeControl.Layout.List); currentSiteView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_SITEVIEW_MODE, (int)GUIFacadeControl.Layout.List); currentCategoryView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_CATEGORYVIEW_MODE, (int)GUIFacadeControl.Layout.List); currentVideoView = (GUIFacadeControl.Layout)settings.GetValueAsInt(CFG_SECTION, CFG_VIDEOVIEW_MODE, (int)GUIFacadeControl.Layout.SmallIcons); ovsconf.ThumbsDir = settings.GetValueAsString(CFG_SECTION, CFG_THUMBNAIL_DIR, ovsconf.ThumbsDir).Replace("/", @"\"); if (!ovsconf.ThumbsDir.EndsWith(@"\")) { ovsconf.ThumbsDir = ovsconf.ThumbsDir + @"\"; // fix thumbnail dir to include the trailing slash } try { if (!string.IsNullOrEmpty(ovsconf.ThumbsDir) && !Directory.Exists(ovsconf.ThumbsDir)) { Directory.CreateDirectory(ovsconf.ThumbsDir); } } catch (Exception e) { Log.Instance.Error("Failed to create thumb dir: {0}", e.ToString()); } ThumbsAge = settings.GetValueAsInt(CFG_SECTION, CFG_THUMBNAIL_AGE, ThumbsAge); Log.Instance.Info("Thumbnails will be stored in {0} with a maximum age of {1} days.", ovsconf.ThumbsDir, ThumbsAge); ovsconf.DownloadDir = settings.GetValueAsString(CFG_SECTION, CFG_DOWNLOAD_DIR, ""); try { if (!string.IsNullOrEmpty(ovsconf.DownloadDir) && !Directory.Exists(ovsconf.DownloadDir)) { Directory.CreateDirectory(ovsconf.DownloadDir); } } catch (Exception e) { Log.Instance.Error("Failed to create download dir: {0}", e.ToString()); } ovsconf.CacheTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_CACHE_TIMEOUT, ovsconf.CacheTimeout); ovsconf.UseAgeConfirmation = settings.GetValueAsBool(CFG_SECTION, CFG_USE_AGECONFIRMATION, ovsconf.UseAgeConfirmation); ovsconf.UtilTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_UTIL_TIMEOUT, ovsconf.UtilTimeout); ovsconf.DynamicCategoryTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_CATEGORYDISCOVERED_TIMEOUT, ovsconf.DynamicCategoryTimeout); // set an almost random string by default -> user must enter pin in Configuration before beeing able to watch adult sites pinAgeConfirmation = settings.GetValueAsString(CFG_SECTION, CFG_PIN_AGECONFIRMATION, DateTime.Now.Millisecond.ToString()); useQuickSelect = settings.GetValueAsBool(CFG_SECTION, CFG_USE_QUICKSELECT, useQuickSelect); wmpbuffer = settings.GetValueAsInt(CFG_SECTION, CFG_WMP_BUFFER, wmpbuffer); playbuffer = settings.GetValueAsInt(CFG_SECTION, CFG_PLAY_BUFFER, playbuffer); email = settings.GetValueAsString(CFG_SECTION, CFG_EMAIL, ""); password = settings.GetValueAsString(CFG_SECTION, CFG_PASSWORD, ""); string lsFilter = settings.GetValueAsString(CFG_SECTION, CFG_FILTER, "").Trim(); FilterArray = lsFilter != "" ? lsFilter.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) : null; searchHistoryNum = settings.GetValueAsInt(CFG_SECTION, CFG_SEARCHHISTORY_NUM, searchHistoryNum); searchHistoryType = (SearchHistoryType)settings.GetValueAsInt(CFG_SECTION, CFG_SEARCHHISTORYTYPE, (int)searchHistoryType); string searchHistoryXML = settings.GetValueAsString(CFG_SECTION, CFG_SEARCHHISTORY, "").Trim(); if ("" != searchHistoryXML) { try { byte[] searchHistoryBytes = System.Text.Encoding.UTF8.GetBytes(searchHistoryXML); MemoryStream xmlMem = new MemoryStream(searchHistoryBytes); xmlMem.Position = 0; System.Runtime.Serialization.DataContractSerializer dcs = new System.Runtime.Serialization.DataContractSerializer(typeof(Dictionary <string, List <string> >)); searchHistory = (Dictionary <string, List <string> >)dcs.ReadObject(xmlMem); } catch (Exception e) { Log.Instance.Warn("Error reading search history from configuration: {0}:{1}! Clearing...", e.GetType(), e.Message); searchHistory = null; } } if (null == searchHistory) { searchHistory = new Dictionary <string, List <string> >(); } // set updateOnStart only when defined, so we have 3 modes: undefined = ask, true = don't ask and update, false = don't ask and don't update string doUpdateString = settings.GetValue(CFG_SECTION, CFG_UPDATEONSTART); if (!string.IsNullOrEmpty(doUpdateString)) { updateOnStart = settings.GetValueAsBool(CFG_SECTION, CFG_UPDATEONSTART, true); } // last point in time the plugin was run in mediaportal string tempDate = settings.GetValueAsString(CFG_SECTION, CFG_LAST_FIRSTRUN, string.Empty); if (!string.IsNullOrEmpty(tempDate)) { DateTime.TryParse(tempDate, out lastFirstRun); } updatePeriod = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_UPDATEPERIOD, (int)updatePeriod); // read the video extensions configured in MediaPortal string[] mediaportal_user_configured_video_extensions; string strTmp = settings.GetValueAsString("movies", "extensions", ".avi,.mpg,.ogm,.mpeg,.mkv,.wmv,.ifo,.qt,.rm,.mov,.sbe,.dvr-ms,.ts"); mediaportal_user_configured_video_extensions = strTmp.Split(','); var listOfExtensions = mediaportal_user_configured_video_extensions.ToList(); listOfExtensions.AddRange(new string[] { ".asf", ".asx", ".flv", ".m4v", ".mov", ".mp4", ".wmv" }); listOfExtensions = listOfExtensions.Distinct().ToList(); listOfExtensions.Sort(); ovsconf.AddSupportedVideoExtensions(listOfExtensions); autoGroupByLang = settings.GetValueAsBool(CFG_SECTION, CFG_AUTO_LANG_GROUPS, autoGroupByLang); ovsconf.FavoritesFirst = settings.GetValueAsBool(CFG_SECTION, CFG_FAVORITES_FIRST, ovsconf.FavoritesFirst); LatestVideosRandomize = settings.GetValueAsBool(CFG_SECTION, CFG_LATESTVIDEOS_RANDOMIZE, LatestVideosRandomize); LatestVideosMaxItems = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_LATESTVIDEOS_MAXITEMS, (int)LatestVideosMaxItems); LatestVideosOnlineDataRefresh = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_LATESTVIDEOS_ONLINEDATA_REFRESH, (int)LatestVideosOnlineDataRefresh); LatestVideosGuiDataRefresh = (uint)settings.GetValueAsInt(CFG_SECTION, CFG_LATESTVIDEOS_GUIDATA_REFRESH, (int)LatestVideosGuiDataRefresh); AllowRefreshRateChange = settings.GetValueAsBool(CFG_SECTION, CFG_ALLOW_REFRESHRATE_CHANGE, AllowRefreshRateChange); StoreLayoutPerCategory = settings.GetValueAsBool(CFG_SECTION, CFG_STORE_LAYOUT_PER_CATEGORY, StoreLayoutPerCategory); ovsconf.HttpPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_HTTP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.HttpOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_OPEN_CONNECTION_TIMEOUT, ovsconf.HttpOpenConnectionTimeout); ovsconf.HttpOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.HttpOpenConnectionSleepTime); ovsconf.HttpTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_HTTP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.HttpTotalReopenConnectionTimeout); ovsconf.RtmpPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_RTMP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.RtmpOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTMP_OPEN_CONNECTION_TIMEOUT, ovsconf.RtmpOpenConnectionTimeout); ovsconf.RtmpOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTMP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.RtmpOpenConnectionSleepTime); ovsconf.RtmpTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTMP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.RtmpTotalReopenConnectionTimeout); ovsconf.RtspPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_RTSP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.RtspOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_OPEN_CONNECTION_TIMEOUT, ovsconf.RtspOpenConnectionTimeout); ovsconf.RtspOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.RtspOpenConnectionSleepTime); ovsconf.RtspTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.RtspTotalReopenConnectionTimeout); ovsconf.RtspClientPortMin = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_CLIENT_PORT_MIN, ovsconf.RtspClientPortMin); ovsconf.RtspClientPortMax = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_RTSP_CLIENT_PORT_MAX, ovsconf.RtspClientPortMax); ovsconf.UdpRtpPreferredNetworkInterface = settings.GetValueAsString(CFG_SECTION, CFG_FILTER_V2_UDPRTP_PREFERRED_NETWORK_INTERFACE, OnlineVideoSettings.NetworkInterfaceSystemDefault); ovsconf.UdpRtpOpenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_OPEN_CONNECTION_TIMEOUT, ovsconf.UdpRtpOpenConnectionTimeout); ovsconf.UdpRtpOpenConnectionSleepTime = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_OPEN_CONNECTION_SLEEP_TIME, ovsconf.UdpRtpOpenConnectionSleepTime); ovsconf.UdpRtpTotalReopenConnectionTimeout = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_TOTAL_REOPEN_CONNECTION_TIMEOUT, ovsconf.UdpRtpTotalReopenConnectionTimeout); ovsconf.UdpRtpReceiveDataCheckInterval = settings.GetValueAsInt(CFG_SECTION, CFG_FILTER_V2_UDPRTP_RECEIVE_DATA_CHECK_INTERVAL, ovsconf.UdpRtpReceiveDataCheckInterval); } LoadSitesGroups(); ovsconf.LoadSites(); } catch (Exception e) { Log.Instance.Error(e); } }
protected override void OnPageLoad() { //MainWindow.setGUIProperty("FanArt.SelectedPreview", ""); CurrentView = BaseConfig.Settings.LastPosterViewMode; BaseConfig.MyAnimeLog.Write("OnPageLoad seriesid : {0}", MainWindow.GlobalSeriesID.ToString()); if (m_Facade != null) { m_Facade.CurrentLayout = CurrentView; } base.OnPageLoad(); // update skin controls UpdateLayoutButton(); if (labelPosterSource != null) labelPosterSource.Label = "Source:"; if (labelDefault != null) labelDefault.Label = "Default: "; if (labelDisabled != null) labelDisabled.Label = "Disabled"; ClearProperties(); ShowPosters(); }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == btnWideBanners) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); } if (control == btnPosters) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.POSTERS, false); } if (control == buttonLayouts) { bool shouldContinue = false; do { shouldContinue = false; switch (CurrentView) { case GUIFacadeControl.Layout.List: CurrentView = GUIFacadeControl.Layout.Playlist; if (!AllowView(CurrentView) || m_Facade.PlayListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Playlist: CurrentView = GUIFacadeControl.Layout.SmallIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.SmallIcons: CurrentView = GUIFacadeControl.Layout.LargeIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.LargeIcons: CurrentView = GUIFacadeControl.Layout.Filmstrip; if (!AllowView(CurrentView) || m_Facade.FilmstripLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Filmstrip: CurrentView = GUIFacadeControl.Layout.List; if (!AllowView(CurrentView) || m_Facade.ListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.List; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.List; BaseConfig.Settings.Save(); } break; } } while (shouldContinue); UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); } if (MA3WindowManager.HandleWindowChangeButton(control)) return; if (actionType != MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) return; // some other events raised onClicked too for some reason? }
public void Load() { StringDictionary settings = new StringDictionary(); MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); //MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"); JMMServer_Address = xmlreader.GetValueAsString("Anime3", "JMMServer_Address", "127.0.0.1"); JMMServer_Port = xmlreader.GetValueAsString("Anime3", "JMMServer_Port", "8111"); ImportFolderMappingsList = xmlreader.GetValueAsString("Anime3", "ImportFolderMappingsList", ""); CurrentJMMUserID = xmlreader.GetValueAsString("Anime3", "CurrentJMMUserID", ""); thumbsFolder = xmlreader.GetValueAsString("Anime3", "ThumbsFolder", ""); PluginName = xmlreader.GetValueAsString("Anime3", "PluginName", "My Anime 3"); //XMLWebServiceIP = xmlreader.GetValueAsString("Anime2", "XMLWebServiceIP", "anime.hobbydb.net"); LastGroupList = xmlreader.GetValueAsString("Anime2", "LastGroupList", ""); BakaBTUsername = xmlreader.GetValueAsString("Anime3", "BakaBTUsername", ""); BakaBTPassword = xmlreader.GetValueAsString("Anime3", "BakaBTPassword", ""); AnimeBytesUsername = xmlreader.GetValueAsString("Anime3", "AnimeBytesUsername", ""); AnimeBytesPassword = xmlreader.GetValueAsString("Anime3", "AnimeBytesPassword", ""); UTorrentAddress = xmlreader.GetValueAsString("Anime3", "UTorrentAddress", ""); UTorrentPassword = xmlreader.GetValueAsString("Anime3", "UTorrentPassword", ""); UTorrentPort = xmlreader.GetValueAsString("Anime3", "UTorrentPort", ""); UTorrentUsername = xmlreader.GetValueAsString("Anime3", "UTorrentUsername", ""); TorrentSourcesRaw = xmlreader.GetValueAsString("Anime3", "TorrentSources", AnimePluginSettings.TorrentSourcesAll); TorrentPreferOwnGroups = GetBooleanSetting(ref xmlreader, "TorrentPreferOwnGroups", true); WatchedPercentage = int.Parse(xmlreader.GetValueAsString("Anime3", "WatchedPercentage", "90")); EpisodeDisplayFormat = xmlreader.GetValueAsString("Anime3", "EpisodeDisplayFormat", @"<EpNo>: <EpName>"); fileSelectionDisplayFormat = xmlreader.GetValueAsString("Anime3", "FileSelectionDisplayFormat", @"<AnGroupShort> - <FileRes> / <FileSource> / <VideoBitDepth>bit"); ShowMissing = GetBooleanSetting(ref xmlreader, "ShowMissing", true); ShowMissingMyGroupsOnly = GetBooleanSetting(ref xmlreader, "ShowMissingMyGroupsOnly", false); DisplayRatingDialogOnCompletion = GetBooleanSetting(ref xmlreader, "DisplayRatingDialogOnCompletion", true); SingleSeriesGroups = GetBooleanSetting(ref xmlreader, "SingleSeriesGroups", false); string viewMode = ""; viewMode = xmlreader.GetValueAsString("Anime3", "LastGroupViewMode", "0"); LastGroupViewMode = (GUIFacadeControl.Layout)int.Parse(viewMode); string viewModeFan = ""; viewModeFan = xmlreader.GetValueAsString("Anime3", "LastFanartViewMode", "1"); LastFanartViewMode = (GUIFacadeControl.Layout)int.Parse(viewModeFan); string viewModePoster = ""; viewModePoster = xmlreader.GetValueAsString("Anime3", "LastPosterViewMode", "2"); LastPosterViewMode = (GUIFacadeControl.Layout)int.Parse(viewModePoster); HideWatchedFiles = GetBooleanSetting(ref xmlreader, "HideWatchedFiles", false); DefaultAudioLanguage = xmlreader.GetValueAsString("Anime3", "DefaultAudioLanguage", @"<file>"); DefaultSubtitleLanguage = xmlreader.GetValueAsString("Anime3", "DefaultSubtitleLanguage", @"<file>"); string findtimeout = ""; findtimeout = xmlreader.GetValueAsString("Anime3", "FindTimeout", "3"); FindTimeout_s = int.Parse(findtimeout); string findmode = ""; findmode = xmlreader.GetValueAsString("Anime3", "FindMode", "0"); FindMode = (SearchMode)int.Parse(findmode); FindStartWord = GetBooleanSetting(ref xmlreader, "FindStartWord", true); FindFilter = GetBooleanSetting(ref xmlreader, "FindFilter", true); AniDBAutoEpisodesSubbed = GetBooleanSetting(ref xmlreader, "AniDBAutoEpisodesSubbed", true); ShowOnlyAvailableEpisodes = GetBooleanSetting(ref xmlreader, "ShowOnlyAvailableEpisodes", true); HidePlot = GetBooleanSetting(ref xmlreader, "HidePlot", true); MenuDeleteFiles = GetBooleanSetting(ref xmlreader, "MenuDeleteFiles", false); string infodel = ""; infodel = xmlreader.GetValueAsString("Anime3", "InfoDelay", "150"); InfoDelay = int.Parse(infodel); string postpct = ""; postpct = xmlreader.GetValueAsString("Anime3", "PosterSizePct", "50"); int tmpPost = 0; int.TryParse(postpct, out tmpPost); if (tmpPost > 0 && tmpPost <= 100) PosterSizePct = tmpPost; else PosterSizePct = 50; string banpct = ""; banpct = xmlreader.GetValueAsString("Anime3", "BannerSizePct", "50"); int tmpBanner = 0; int.TryParse(banpct, out tmpBanner); if (tmpBanner > 0 && tmpBanner <= 100) BannerSizePct = tmpBanner; else BannerSizePct = 50; string ffdshowNotificationsShow = ""; ffdshowNotificationsShow = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsShow", "1"); FfdshowNotificationsShow = ffdshowNotificationsShow == "0" ? false : true; string ffdshowNotificationsAutoClose = ""; ffdshowNotificationsAutoClose = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoClose", "1"); FfdshowNotificationsAutoClose = ffdshowNotificationsAutoClose == "0" ? false : true; string ffdshowNotificationsLock = ""; ffdshowNotificationsLock = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLock", "1"); FfdshowNotificationsLock = ffdshowNotificationsLock == "0" ? false : true; FfdshowNotificationsAutoCloseTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoCloseTime", "3000")); FfdshowNotificationsLockTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLockTime", "5000")); xmlreader.Dispose(); // parse the list of torrent sources if (TorrentSourcesRaw.Length > 0) { string[] fitems = TorrentSourcesRaw.Split(';'); foreach (string s in fitems) { TorrentSources.Add(s); } } }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == btnWideBanners) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.WIDEBANNERS, false); } if (control == btnPosters) { GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.POSTERS, false); } if (control == buttonLayouts) { bool shouldContinue = false; do { shouldContinue = false; switch (CurrentView) { case GUIFacadeControl.Layout.List: CurrentView = GUIFacadeControl.Layout.Playlist; if (!AllowView(CurrentView) || m_Facade.PlayListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Playlist; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Playlist: CurrentView = GUIFacadeControl.Layout.SmallIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.SmallIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.SmallIcons: CurrentView = GUIFacadeControl.Layout.LargeIcons; if (!AllowView(CurrentView) || m_Facade.ThumbnailLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.LargeIcons; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.LargeIcons: CurrentView = GUIFacadeControl.Layout.Filmstrip; if (!AllowView(CurrentView) || m_Facade.FilmstripLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.Filmstrip; BaseConfig.Settings.Save(); } break; case GUIFacadeControl.Layout.Filmstrip: CurrentView = GUIFacadeControl.Layout.List; if (!AllowView(CurrentView) || m_Facade.ListLayout == null) { shouldContinue = true; } else { m_Facade.CurrentLayout = GUIFacadeControl.Layout.List; BaseConfig.Settings.LastFanartViewMode = GUIFacadeControl.Layout.List; BaseConfig.Settings.Save(); } break; } } while (shouldContinue); UpdateLayoutButton(); GUIControl.FocusControl(GetID, controlId); } if (MA3WindowManager.HandleWindowChangeButton(control)) { return; } if (actionType != MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) { return; // some other events raised onClicked too for some reason? } }