public MyLyricsSetup_SearchTitleDialog(MyLyricsSetup_LyricsLibrary form, string artist, string title, bool markedDatabase) { InitializeComponent(); this.parent = form; this.markedDatabase = markedDatabase; // initialize delegates m_DelegateStringUpdate = new DelegateStringUpdate(this.updateStringMethod); m_DelegateStatusUpdate = new DelegateStatusUpdate(this.updateStatusMethod); m_DelegateLyricFound = new DelegateLyricFound(this.lyricFoundMethod); m_DelegateLyricNotFound = new DelegateLyricNotFound(this.lyricNotFoundMethod); m_DelegateThreadFinished = new DelegateThreadFinished(this.ThreadFinishedMethod); m_DelegateThreadException = new DelegateThreadException(this.ThreadExceptionMethod); // initialize events m_EventStopThread = new ManualResetEvent(false); tbArtist.Text = artist; tbTitle.Text = title; originalArtist = artist; originalTitle = title; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { cbLyricWiki.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricWiki", "True")).ToString().Equals("True") ? true : false; cbEvilLabs.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useEvilLabs", "True")).ToString().Equals("True") ? true : false; cbLyrics007.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyrics007", "True")).ToString().Equals("True") ? true : false; cbLyricsOnDemand.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useLyricsOnDemand", "True")).ToString().Equals("True") ? true : false; cbSeekLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useSeekLyrics", "True")).ToString().Equals("True") ? true : false; cbHotLyrics.Checked = ((string)xmlreader.GetValueAsString("myLyrics", "useHotLyrics", "True")).ToString().Equals("True") ? true : false; automaticFetch = xmlreader.GetValueAsBool("myLyrics", "automaticFetch", true); automaticUpdate = xmlreader.GetValueAsBool("myLyrics", "automaticUpdateWhenFirstFound", false); moveLyricFromMarkedDatabase = xmlreader.GetValueAsBool("myLyrics", "moveLyricFromMarkedDatabase", true); } this.Show(); if (artist.Length != 0 && title.Length != 0) { if (automaticFetch) { fetchLyric(originalArtist, originalTitle); lvSearchResults.Focus(); } else { btFind.Focus(); } } else if (artist.Length != 0) { tbTitle.Focus(); } else { tbArtist.Focus(); } }
public static void LoadSettings() { AutoSearch = true; ApproveIfOne = false; ApproveForNearest = false; NearestFactor = 20; try { logger.Debug("Load settings from: " + ConfigFilename); #region Load settings using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, ConfigFilename))) { AutoSearch = xmlreader.GetValueAsBool("Fetcher", "AutoSearch", AutoSearch); ApproveIfOne = xmlreader.GetValueAsBool("Fetcher", "ApproveIfOne", ApproveIfOne); ApproveForNearest = xmlreader.GetValueAsBool("Fetcher", "ApproveForNearest", ApproveForNearest); NearestFactor = xmlreader.GetValueAsInt("Fetcher", "NearestFactor", NearestFactor); } #endregion logger.Debug("Load settings from: " + ConfigFilename + " complete."); } catch (Exception ex) { logger.Error("LoadSettings: " + ex); } #region Report Settings logger.Debug("Importer: " + Check(ApproveIfOne) + " If one, " + Check(ApproveForNearest) + " Nearest <= " + NearestFactor); #endregion }
private void displayDeviceSettings() { using (var xmlReader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { egPath_textBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "egPath", ""); egPart2_comboBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "egPart2", "Type"); egPart3_comboBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "egPart3", "Status"); egPayload_checkBox.Checked = xmlReader.GetValueAsBool(EventGhostPlus.PLUGIN_NAME, "egPayload", false); WindowChange_checkBox.Checked = xmlReader.GetValueAsBool(EventGhostPlus.PLUGIN_NAME, "WindowChange", true); mediaDuration_textBox.Text = (xmlReader.GetValueAsInt(EventGhostPlus.PLUGIN_NAME, "setLevelForMediaDuration", 10)).ToString(); tcpip_radioButton.Checked = xmlReader.GetValueAsBool(EventGhostPlus.PLUGIN_NAME, "tcpipIsEnabled", false); host_textBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "tcpipHost", ""); port_textBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "tcpipPort", "1024"); PWDEncrypted = xmlReader.GetValueAsBool(EventGhostPlus.PLUGIN_NAME, "PWDEncrypted", false); if (PWDEncrypted) password_textBox.Text = DPAPI.DecryptString(xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "tcpipPassword", "")); else password_textBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "tcpipPassword", ""); rcvport_textBox.Text = xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "ReceivePort", "1023"); rcvpassword_textBox.Text = DPAPI.DecryptString(xmlReader.GetValueAsString(EventGhostPlus.PLUGIN_NAME, "ReceivePassword", "")); debug_checkBox.Checked = xmlReader.GetValueAsBool(EventGhostPlus.PLUGIN_NAME, "DebugMode", false); } tcpipStatusEnabler(); }
/// <summary> /// Loads the configuration of this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { soundOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound); soundOutputDevice.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0); audioChannels.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default); audioDelayStep.Value = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100); passthroughAC3_DTS.Checked = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false); audioNormalize.Checked = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false); } }
/// <summary> /// Loads the configuration of this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { soundOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound); soundOutputDevice.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0); audioChannels.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default); audioDelayStep.Value = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100); passthroughAC3_DTS.Checked = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false); audioNormalize.Checked = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false); } }
/// <summary> /// Loads the configuration for this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { osdSelect.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "osd", (int)OSDMode.ExternalOSDLibrary); optionalArguments.Text = xmlreader.GetValueAsString("mplayer", "generalArguments", String.Empty); rebuildIndex.Checked = xmlreader.GetValueAsBool("mplayer", "rebuildIndex", false); priorityBoost.Checked = xmlreader.GetValueAsBool("mplayer", "priorityBoost", true); int tempCacheSize = xmlreader.GetValueAsInt("mplayer", "cacheSize", 4096); cacheSize.Text = tempCacheSize > 0 ? tempCacheSize.ToString() : String.Empty; mplayerPath.Text = xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\MPlayer.exe"); bool blankScreenStandardValue = !OSInfo.OSInfo.VistaOrLater(); externalOSDLibraryBlank.Checked = xmlreader.GetValueAsBool("externalOSDLibrary", "blankScreen", blankScreenStandardValue); } }
private void displayDeviceSettings() { using (var xmlReader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MQTTPlugin.xml"))) { WindowChange_checkBox.Checked = xmlReader.GetValueAsBool(MQTTPlugin.PLUGIN_NAME, "WindowChange", true); mediaDuration_textBox.Text = (xmlReader.GetValueAsInt(MQTTPlugin.PLUGIN_NAME, "SetLevelForMediaDuration", 10)).ToString(); host_textBox.Text = xmlReader.GetValueAsString(MQTTPlugin.BROKER, "Host", string.Empty); port_textBox.Text = xmlReader.GetValueAsString(MQTTPlugin.BROKER, "Port", "1883"); user_textBox.Text = xmlReader.GetValueAsString(MQTTPlugin.BROKER, "User", string.Empty); password_textBox.Text = DPAPI.DecryptString(xmlReader.GetValueAsString(MQTTPlugin.BROKER, "Password", string.Empty)); debug_checkBox.Checked = xmlReader.GetValueAsBool(MQTTPlugin.PLUGIN_NAME, "DebugMode", false); } }
/// <summary> /// Loads the configuration for this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { osdSelect.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "osd", (int) OSDMode.ExternalOSDLibrary); optionalArguments.Text = xmlreader.GetValueAsString("mplayer", "generalArguments", String.Empty); rebuildIndex.Checked = xmlreader.GetValueAsBool("mplayer", "rebuildIndex", false); priorityBoost.Checked = xmlreader.GetValueAsBool("mplayer", "priorityBoost", true); int tempCacheSize = xmlreader.GetValueAsInt("mplayer", "cacheSize", 4096); cacheSize.Text = tempCacheSize > 0 ? tempCacheSize.ToString() : String.Empty; mplayerPath.Text = xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\MPlayer.exe"); bool blankScreenStandardValue = !OSInfo.OSInfo.VistaOrLater(); externalOSDLibraryBlank.Checked = xmlreader.GetValueAsBool("externalOSDLibrary", "blankScreen", blankScreenStandardValue); } }
/// <summary> /// Adds a section of MP shares /// </summary> /// <param name="section">Name of the section</param> private void AddSection(String section) { Share defaultshare = null; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string strDefault = xmlreader.GetValueAsString(section, "default", String.Empty); for (int i = 0; i < 20; i++) { string strShareName = String.Format("sharename{0}", i); string strSharePath = String.Format("sharepath{0}", i); string strPincode = String.Format("pincode{0}", i); string shareType = String.Format("sharetype{0}", i); string shareServer = String.Format("shareserver{0}", i); string shareLogin = String.Format("sharelogin{0}", i); string sharePwd = String.Format("sharepassword{0}", i); string sharePort = String.Format("shareport{0}", i); string remoteFolder = String.Format("shareremotepath{0}", i); string shareViewPath = String.Format("shareview{0}", i); Share share = new Share { Name = xmlreader.GetValueAsString(section, strShareName, String.Empty), Path = xmlreader.GetValueAsString(section, strSharePath, String.Empty) }; share.Pincode = Utils.DecryptPin(xmlreader.GetValueAsString(section, strPincode, string.Empty)); share.IsFtpShare = xmlreader.GetValueAsBool(section, shareType, false); share.FtpServer = xmlreader.GetValueAsString(section, shareServer, String.Empty); share.FtpLoginName = xmlreader.GetValueAsString(section, shareLogin, String.Empty); share.FtpPassword = xmlreader.GetValueAsString(section, sharePwd, String.Empty); share.FtpPort = xmlreader.GetValueAsInt(section, sharePort, 21); share.FtpFolder = xmlreader.GetValueAsString(section, remoteFolder, "/"); share.DefaultLayout = (GUIFacadeControl.Layout)xmlreader.GetValueAsInt(section, shareViewPath, (int)GUIFacadeControl.Layout.List); if (share.Name.Length > 0) { if (strDefault == share.Name) { share.Default = true; if (defaultshare == null) { defaultshare = share; } } if (!_sharePaths.Contains(share.Path.ToLower())) { _sharePaths.Add(share.Path.ToLower()); _mDirectory.Add(share); } } else { break; } } } }
public void Load() { using (var xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { this.PluginName = xmlreader.GetValueAsString("youtubevideos", "PluginName", "YouTube.fm"); this.Region = xmlreader.GetValueAsString("youtubevideos", "Region", "Ask"); this.InitialDisplay = xmlreader.GetValueAsInt("youtubevideos", "InitialDisplay", 3); this.User = xmlreader.GetValueAsString("youtubevideos", "user", string.Empty); this.Password = xmlreader.GetValueAsString("youtubevideos", "password", string.Empty); this.InitialCat = xmlreader.GetValueAsInt("youtubevideos", "InitialCat", 1); this.VideoQuality = xmlreader.GetValueAsInt("youtubevideos", "VideoQuality", 0); this.InstantAction = (Action.ActionType)xmlreader.GetValueAsInt("youtubevideos", "InstantAction", (int)(Action.ActionType.REMOTE_1)); this.InitialSearch = xmlreader.GetValueAsString("youtubevideos", "InitialSearch", string.Empty); this.InstantChar = xmlreader.GetValueAsInt("youtubevideos", "InstantCharInt", 01); this.MusicFilter = xmlreader.GetValueAsBool("youtubevideos", "MusicFilter", true); this.UseSMSStyleKeyBoard = xmlreader.GetValueAsBool("youtubevideos", "UseSMSStyleKeyBoard", true); string his = xmlreader.GetValueAsString("youtubevideos", "searchhistory", string.Empty); this.Time = xmlreader.GetValueAsBool("youtubevideos", "time", false); this.ShowNowPlaying = xmlreader.GetValueAsBool("youtubevideos", "ShowNowPlaying", true); this.UseYouTubePlayer = xmlreader.GetValueAsBool("youtubevideos", "UseYouTubePlayer", false); this.UseExtremFilter = xmlreader.GetValueAsBool("youtubevideos", "UseExtremFilter", false); this.LoadOnlineFanart = xmlreader.GetValueAsBool("youtubevideos", "LoadOnlineFanart", true); this.FanartDir = xmlreader.GetValueAsString("youtubevideos", "FanartFolder", string.Empty); this.DownloadFolder = xmlreader.GetValueAsString("youtubevideos", "DownloadFolder", Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\\My Videos"); foreach (string s in his.Split('|')) { if (!string.IsNullOrEmpty(s.Trim())) { SearchHistory.Add(s); } } } this.LocalFile.Load(); }
/// <summary> /// Initialise the socket server if necessary /// </summary> internal void InitAndStartSocket() { if (socketServer == null) { WifiRemote.LogMessage("Setting up socket server", LogType.Debug); String userName = null; String password = null; String passcode = null; AuthMethod auth = AuthMethod.None; int autologinTimeout = 0; bool showNotification = false; // Load port from config using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { port = (UInt16)reader.GetValueAsInt(PLUGIN_NAME, "port", DEFAULT_PORT); disableBonjour = reader.GetValueAsBool(PLUGIN_NAME, "disableBonjour", false); serviceName = reader.GetValueAsString(PLUGIN_NAME, "serviceName", ""); userName = reader.GetValueAsString(PLUGIN_NAME, "username", ""); userName = WifiRemote.DecryptString(userName); password = reader.GetValueAsString(PLUGIN_NAME, "password", ""); password = WifiRemote.DecryptString(password); passcode = reader.GetValueAsString(PLUGIN_NAME, "passcode", ""); passcode = WifiRemote.DecryptString(passcode); auth = (AuthMethod)reader.GetValueAsInt(PLUGIN_NAME, "auth", 0); autologinTimeout = reader.GetValueAsInt(PLUGIN_NAME, "autologinTimeout", 0); showNotification = reader.GetValueAsBool(PLUGIN_NAME, "showNotifications", false); } // Start listening for client connections socketServer = new SocketServer(port); socketServer.UserName = userName; socketServer.Password = password; socketServer.PassCode = passcode; socketServer.AllowedAuth = auth; socketServer.AutologinTimeout = autologinTimeout; socketServer.ShowNotifications = showNotification; } socketServer.Start(); }
/// <summary> /// Loads the configuration of this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { VideoOutputDriver videoOutputDriverStandardValue = VideoOutputDriver.DirectX; if (OSInfo.OSInfo.OSList.WindowsVista == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows2008 == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows7 == OSInfo.OSInfo.GetOSName()) { videoOutputDriverStandardValue = VideoOutputDriver.Direct3D; } videoOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)videoOutputDriverStandardValue); postProcessing.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum); aspectRatio.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic); deinterlace.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive); noiseDenoise.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing); framedrop.Checked = xmlreader.GetValueAsBool("mplayer", "framedrop", false); directRendering.Checked = xmlreader.GetValueAsBool("mplayer", "directRendering", true); doubleBuffering.Checked = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true); } }
/// <summary> /// Loads the configuration of this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { VideoOutputDriver videoOutputDriverStandardValue = VideoOutputDriver.DirectX; if (OSInfo.OSInfo.OSList.WindowsVista == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows2008 == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows7 == OSInfo.OSInfo.GetOSName()) { videoOutputDriverStandardValue = VideoOutputDriver.Direct3D; } videoOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)videoOutputDriverStandardValue); postProcessing.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum); aspectRatio.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic); deinterlace.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive); noiseDenoise.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing); framedrop.Checked = xmlreader.GetValueAsBool("mplayer", "framedrop", false); directRendering.Checked = xmlreader.GetValueAsBool("mplayer", "directRendering", true); doubleBuffering.Checked = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true); } }
/// <summary> /// Standard constructor which set the WindowID /// </summary> public MPlayerGUIPlugin() { GetID = 9533; _virtualPath = String.Empty; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { CurrentView = (View)xmlreader.GetValueAsInt(string.Empty, "view", (int)View.List); CurrentSortMethod = (VideoSort.SortMethod)xmlreader.GetValueAsInt(string.Empty, "sortmethod", (int)VideoSort.SortMethod.Name); _displayName = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer"); _useMyVideoShares = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); _useMyMusicShares = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); _treatPlaylistsAsFolders = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false); _useDvdnav = xmlreader.GetValueAsBool("mplayer", "useDVDNAV", false); String mStrLanguage = xmlreader.GetValueAsString("skin", "language", "English"); LocalizeStrings.Load(mStrLanguage); } }
public VideoHandler() { playlistPlayer = MediaPortal.Playlists.PlayListPlayer.SingletonPlayer; // Check if External Player is being used MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); m_bIsExternalPlayer = !xmlreader.GetValueAsBool("movieplayer", "internal", true); m_bIsExternalDVDPlayer = !xmlreader.GetValueAsBool("dvdplayer", "internal", true); // external player handlers Utils.OnStartExternal += new Utils.UtilEventHandler(onStartExternal); Utils.OnStopExternal += new Utils.UtilEventHandler(onStopExternal); g_Player.PlayBackStopped += new MediaPortal.Player.g_Player.StoppedHandler(OnPlayBackStopped); g_Player.PlayBackEnded += new MediaPortal.Player.g_Player.EndedHandler(OnPlayBackEnded); g_Player.PlayBackStarted += new MediaPortal.Player.g_Player.StartedHandler(OnPlayBackStarted); g_Player.PlayBackChanged += new g_Player.ChangedHandler(OnPlaybackChanged); PlayPropertyUpdater.WorkerSupportsCancellation = true; PlayPropertyUpdater.DoWork += new DoWorkEventHandler(SetPlayProperties_DoWork); }
public void Load() { using (var xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { this.PluginName = xmlreader.GetValueAsString("youtubevideos", "PluginName", "YouTube.fm"); this.User = xmlreader.GetValueAsString("youtubevideos", "user", string.Empty); this.Password = xmlreader.GetValueAsString("youtubevideos", "password", string.Empty); this.StartUpOpt = xmlreader.GetValueAsInt("youtubevideos", "StartUpOpt", 0); this.VideoQuality = xmlreader.GetValueAsInt("youtubevideos", "VideoQuality", 0); this.LayoutItem = xmlreader.GetValueAsInt("youtubevideos", "LayoutItem", 0); this.LayoutArtist = xmlreader.GetValueAsInt("youtubevideos", "LayoutArtist", 2); this.LayoutVideo = xmlreader.GetValueAsInt("youtubevideos", "LayoutVideo", 5); this.MusicFilter = xmlreader.GetValueAsBool("youtubevideos", "MusicFilter", true); string his = xmlreader.GetValueAsString("youtubevideos", "searchhistory", string.Empty); this.ShowNowPlaying = xmlreader.GetValueAsBool("youtubevideos", "ShowNowPlaying", true); this.UseExtremFilter = xmlreader.GetValueAsBool("youtubevideos", "UseExtremFilter", false); this.LoadOnlineFanart = xmlreader.GetValueAsBool("youtubevideos", "LoadOnlineFanart", true); this.CacheDir = xmlreader.GetValueAsString("youtubevideos", "CacheDir", string.Empty); this.FanartDir = xmlreader.GetValueAsString("youtubevideos", "FanartFolder", string.Empty); this.DownloadFolder = xmlreader.GetValueAsString("youtubevideos", "DownloadFolder", Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Videos"); this.LastFmUser = xmlreader.GetValueAsString("youtubevideos", "LastFmUser", string.Empty); this.LastFmPass = xmlreader.GetValueAsString("youtubevideos", "LastFmPass", string.Empty); this.LastFmNowPlay = xmlreader.GetValueAsBool("youtubevideos", "LastFmNowPlay", false); this.LastFmSubmit = xmlreader.GetValueAsBool("youtubevideos", "LastFmSubmit", false); this.UseAsServer = xmlreader.GetValueAsBool("youtubevideos", "UseAsServer", false); this.PortNumber = xmlreader.GetValueAsInt("youtubevideos", "PortNumber", 18944); this.UseDefaultOSD = xmlreader.GetValueAsBool("youtubevideos", "UseDefaultOSD", false); foreach (string s in his.Split('|')) { if (!string.IsNullOrEmpty(s.Trim())) { SearchHistory.Add(s); } } } if (string.IsNullOrEmpty(CacheDir)) { CacheDir = Config.GetFile(Config.Dir.Thumbs, @"Youtube.Fm\Cache"); } if (string.IsNullOrEmpty(FanartDir)) { FanartDir = Config.GetFile(Config.Dir.Thumbs, @"Youtube.Fm\Fanart\", "%artist%.png"); } this.LocalFile.Load(); MainMenu.Load("youtubefmMenu.xml"); }
/// <summary> /// Loads the configuration of this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string subtitleFontName = xmlreader.GetValueAsString("mplayer", "subtitleFontName", "Arial"); subtitleFont.SelectedItem = subtitleFontName; subtitles.Checked = xmlreader.GetValueAsBool("mplayer", "enableSubtitles", false); subtitleDelayStep.Value = xmlreader.GetValueAsInt("mplayer", "subtitleDelayStep", 100); subtitlePosition.Value = xmlreader.GetValueAsInt("mplayer", "subtitlePosition", 100); subtitleSize.Value = xmlreader.GetValueAsInt("mplayer", "subtitleSize", 5); } }
/// <summary> /// Loads the configuration of this section /// </summary> public void LoadConfiguration() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string subtitleFontName = xmlreader.GetValueAsString("mplayer", "subtitleFontName", "Arial"); subtitleFont.SelectedItem = subtitleFontName; subtitles.Checked = xmlreader.GetValueAsBool("mplayer", "enableSubtitles", false); subtitleDelayStep.Value = xmlreader.GetValueAsInt("mplayer", "subtitleDelayStep", 100); subtitlePosition.Value = xmlreader.GetValueAsInt("mplayer", "subtitlePosition", 100); subtitleSize.Value = xmlreader.GetValueAsInt("mplayer", "subtitleSize", 5); } }
/// <summary> /// Loads the configuration with the shares /// </summary> public void LoadConfiguration() { try { XmlDocument doc = new XmlDocument(); string path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml"); doc.Load(path); if (doc.DocumentElement != null) { XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share"); if (listShare != null) { foreach (XmlNode nodeShare in listShare) { MPlayerShare share = new MPlayerShare { Name = nodeShare.Attributes["name"].Value, Path = nodeShare.Attributes["path"].Value }; shareList.Items.Add(share); } } } using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { pluginName.Text = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer GUI"); myVideoShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); myMusicShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); playlistFolder.Checked = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false); dvdNavCheckbox.Checked = xmlreader.GetValueAsBool("mplayer", "useDVDNAV", false); } } catch (Exception e) { Log.Info("MPlayer GUI Error: Configuration could not be loaded: " + e.Message); } }
public void Load() { using ( MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { Mp3 = xmlreader.GetValueAsBool("radiotime", "mp3", true); Wma = xmlreader.GetValueAsBool("radiotime", "wma", true); Real = xmlreader.GetValueAsBool("radiotime", "real", false); ShowPresets = xmlreader.GetValueAsBool("radiotime", "showpresets", false); UseVideo = xmlreader.GetValueAsBool("radiotime", "UseVideo", false); JumpNowPlaying = xmlreader.GetValueAsBool("radiotime", "JumpNowPlaying", false); User = xmlreader.GetValueAsString("radiotime", "user", string.Empty); Password = xmlreader.GetValueAsString("radiotime", "password", string.Empty); FolderId = xmlreader.GetValueAsString("radiotime", "FolderId", string.Empty); PluginName = xmlreader.GetValueAsString("radiotime", "pluginname", "RadioTime"); StartWithFastPreset = xmlreader.GetValueAsBool("radiotime", "StartWithFastPreset", false); SearchHistory.Clear(); ArtistSearchHistory.Clear(); string searchs = xmlreader.GetValueAsString("radiotime", "searchHistory", ""); if (!string.IsNullOrEmpty(searchs)) { string[] array = searchs.Split('|'); for (int i = 0; i < array.Length && i < 25; i++) { if (!string.IsNullOrEmpty(array[i])) { SearchHistory.Add(array[i]); } } } searchs = xmlreader.GetValueAsString("radiotime", "artistSearchHistory", ""); if (!string.IsNullOrEmpty(searchs)) { string[] array = searchs.Split('|'); for (int i = 0; i < array.Length && i < 25; i++) { if (!string.IsNullOrEmpty(array[i])) { ArtistSearchHistory.Add(array[i]); } } } PartnerId = "41"; } }
/// <summary> /// Public method to load the text from a strings/xml file into memory /// </summary> /// <param name="language">Language</param> /// <returns> /// true when text is loaded /// false when it was unable to load the text /// </returns> //[Obsolete("This method has changed", true)] static public bool Load(string language) { bool isPrefixEnabled; using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); string directory = Config.GetSubFolder(Config.Dir.Language, "MPlayer"); string cultureName = null; if (language != null) { cultureName = GetCultureName(language); } Log.Info("MPlayer: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); return(true); }
/// <summary> /// Handler for the GUIMessage of the MP System /// </summary> /// <param name="message">Message of MP</param> /// <returns>Result</returns> public override bool OnMessage(GUIMessage message) { if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_INIT) { bool mplayerPlayerAvailable; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { mplayerPlayerAvailable = xmlreader.GetValueAsBool("plugins", "MPlayer", false); } mplayerPlayerAvailable = (mplayerPlayerAvailable & File.Exists(Config.GetFile(Config.Dir.Plugins, "ExternalPlayers", "MPlayer_ExtPlayer.dll"))); if (!mplayerPlayerAvailable) { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading("My MPlayer GUI"); dlgOk.SetLine(1, "MPlayer External Player not available!"); dlgOk.SetLine(2, "Please activate it in the Setup"); dlgOk.DoModal(GetID); GUIWindowManager.ShowPreviousWindow(); } } return(base.OnMessage(message)); }
private void Configuration_Load(object sender, EventArgs e) { toolTip1.SetToolTip(txtDBInstance, "Specifiy the database instance used"); toolTip1.SetToolTip(txtServerName, "Machine name or IP address where the My Movies database resides"); toolTip1.SetToolTip(txtUserName, "Leave blank to use trusted connection"); toolTip1.SetToolTip(txtPassword, "Leave blank to use trusted connection"); try { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { DriveReplacements pathReplacements; txtProgramDataPath.Text = xmlreader.GetValueAsString("MyMovies", "txtProgramDataPath", @"C:\ProgramData\My Movies"); txtServerName.Text = xmlreader.GetValueAsString("MyMovies", "txtServerName", "localhost"); txtDBInstance.Text = xmlreader.GetValueAsString("MyMovies", "txtDBInstance", "MYMOVIES"); txtUserName.Text = xmlreader.GetValueAsString("MyMovies", "txtUserName", string.Empty); txtPassword.Text = xmlreader.GetValueAsString("MyMovies", "txtPassword", string.Empty); txtPINCode.Text = xmlreader.GetValueAsString("MyMovies", "txtPINCode", "4321"); chkEnableRemoteWakeup.Checked = xmlreader.GetValueAsBool("MyMovies", "chkRemoteWakeup", false); string xml = xmlreader.GetValueAsString("MyMovies", "xmlPathReplacement", string.Empty); pathReplacements = new DriveReplacements(xml); LoadGrid(pathReplacements); Users users = new Users(xmlreader.GetValueAsString("MyMovies", "xmlUsers", string.Empty)); foreach (string user in users.Collection) { gridUsers.Rows.Add(new string[] { user }); } MacAddress macAddress = MacAddress.Parse(xmlreader.GetValueAsString("MyMovies", "MACAddress", "00-00-00-00-00-00")); numUDMac1.Value = macAddress[0]; numUDMac2.Value = macAddress[1]; numUDMac3.Value = macAddress[2]; numUDMac4.Value = macAddress[3]; numUDMac5.Value = macAddress[4]; numUDMac6.Value = macAddress[5]; IPAddress ipAddress = IPAddress.Parse(xmlreader.GetValueAsString("MyMovies", "IPAddress", "0.0.0.0")); numUDIP1.Value = ipAddress.GetAddressBytes()[0]; numUDIP2.Value = ipAddress.GetAddressBytes()[1]; numUDIP3.Value = ipAddress.GetAddressBytes()[2]; numUDIP4.Value = ipAddress.GetAddressBytes()[3]; numRetries.Value = xmlreader.GetValueAsInt("MyMovies", "wakeupRetries", 3); numRetryTimeout.Value = xmlreader.GetValueAsInt("MyMovies", "wakeupRetryTimeout", 3000); numMaxRating.Value = xmlreader.GetValueAsInt("MyMovies", "maximumViewableRating", 4); } } catch (Exception ex) { Log.Error("MyMovies::Init - Cannot load settings"); Log.Error(ex); } }
public void Load() { var passwordNeedsUpdate = false; using (var xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { Mp3 = xmlreader.GetValueAsBool("radiotime", "mp3", true); Wma = xmlreader.GetValueAsBool("radiotime", "wma", true); Real = xmlreader.GetValueAsBool("radiotime", "real", false); ShowPresets = xmlreader.GetValueAsBool("radiotime", "showpresets", false); UseVideo = xmlreader.GetValueAsBool("radiotime", "UseVideo", false); JumpNowPlaying = xmlreader.GetValueAsBool("radiotime", "JumpNowPlaying", false); User = xmlreader.GetValueAsString("radiotime", "user", string.Empty); var encryptedPassword = xmlreader.GetValueAsString("radiotime", "encryptedPassword", string.Empty); if (!string.IsNullOrEmpty(encryptedPassword)) { { Password = PasswordUtility.DecryptData(encryptedPassword, DataProtectionScope.LocalMachine); if (string.IsNullOrEmpty(Password)) { Password = string.Empty; } } } else { Password = xmlreader.GetValueAsString("radiotime", "password", string.Empty); passwordNeedsUpdate = true; } FolderId = xmlreader.GetValueAsString("radiotime", "FolderId", string.Empty); PluginName = xmlreader.GetValueAsString("radiotime", "pluginname", "RadioTime"); StartWithFastPreset = xmlreader.GetValueAsBool("radiotime", "StartWithFastPreset", false); SearchHistory.Clear(); ArtistSearchHistory.Clear(); var searchs = xmlreader.GetValueAsString("radiotime", "searchHistory", ""); if (!string.IsNullOrEmpty(searchs)) { var array = searchs.Split('|'); for (var i = 0; i < array.Length && i < 25; i++) { if (!string.IsNullOrEmpty(array[i])) { SearchHistory.Add(array[i]); } } } searchs = xmlreader.GetValueAsString("radiotime", "artistSearchHistory", ""); if (!string.IsNullOrEmpty(searchs)) { var array = searchs.Split('|'); for (var i = 0; i < array.Length && i < 25; i++) { if (!string.IsNullOrEmpty(array[i])) { ArtistSearchHistory.Add(array[i]); } } } PartnerId = "41"; } if (passwordNeedsUpdate) { SaveEncryptedPassword(); } }
public void Load() { using (var xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { this.PluginName = xmlreader.GetValueAsString("youtubevideos", "PluginName", "YouTube.fm"); this.Region = xmlreader.GetValueAsString("youtubevideos", "Region", "Ask"); this.InitialDisplay = xmlreader.GetValueAsInt("youtubevideos", "InitialDisplay", 3); this.User = xmlreader.GetValueAsString("youtubevideos", "user", string.Empty); this.Password = xmlreader.GetValueAsString("youtubevideos", "password", string.Empty); this.InitialCat = xmlreader.GetValueAsInt("youtubevideos", "InitialCat", 1); this.VideoQuality = xmlreader.GetValueAsInt("youtubevideos", "VideoQuality", 0); this.InstantAction = (Action.ActionType)xmlreader.GetValueAsInt("youtubevideos", "InstantAction", (int)(Action.ActionType.REMOTE_1)); this.InitialSearch = xmlreader.GetValueAsString("youtubevideos", "InitialSearch", string.Empty); this.InstantChar = xmlreader.GetValueAsInt("youtubevideos", "InstantCharInt", 01); this.MusicFilter = xmlreader.GetValueAsBool("youtubevideos", "MusicFilter", true); this.UseSMSStyleKeyBoard = xmlreader.GetValueAsBool("youtubevideos", "UseSMSStyleKeyBoard", true); string his = xmlreader.GetValueAsString("youtubevideos", "searchhistory", string.Empty); this.Time = xmlreader.GetValueAsBool("youtubevideos", "time", false); this.ShowNowPlaying = xmlreader.GetValueAsBool("youtubevideos", "ShowNowPlaying", true); this.UseYouTubePlayer = xmlreader.GetValueAsBool("youtubevideos", "UseYouTubePlayer", false); this.UseExtremFilter = xmlreader.GetValueAsBool("youtubevideos", "UseExtremFilter", false); this.LoadOnlineFanart = xmlreader.GetValueAsBool("youtubevideos", "LoadOnlineFanart", true); this.FanartDir = xmlreader.GetValueAsString("youtubevideos", "FanartFolder", string.Empty); this.DownloadFolder = xmlreader.GetValueAsString("youtubevideos", "DownloadFolder", Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\\My Videos"); foreach (string s in his.Split('|')) { if (!string.IsNullOrEmpty(s.Trim())) SearchHistory.Add(s); } } this.LocalFile.Load(); }
/// <summary> /// Load the settings from the mediaportal config /// </summary> public static void Load() { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { username = reader.GetValue(Helper.PLUGIN_NAME, "username"); server = reader.GetValue(Helper.PLUGIN_NAME, "server"); string tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "resource"); if (!String.IsNullOrEmpty(tmpSettingsString)) { resource = tmpSettingsString; } string encryptedPassword = reader.GetValue(Helper.PLUGIN_NAME, "password"); password = decryptString(encryptedPassword); autoConnectStartup = reader.GetValueAsBool(Helper.PLUGIN_NAME, "autoConnectStartup", autoConnectStartup); notifyOnMessagePlugin = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMessagePlugin", notifyOnMessagePlugin); notifyOnMessageGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMessageGlobally", notifyOnMessageGlobally); notifyOnStatusPlugin = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnStatusPlugin", notifyOnStatusPlugin); notifyOnStatusGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnStatusGlobally", notifyOnStatusGlobally); notifyOnMoodPlugin = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMoodPlugin", notifyOnMoodPlugin); notifyOnMoodGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMoodGlobally", notifyOnMoodGlobally); notifyOnActivityPlugin = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnActivityPlugin", notifyOnActivityPlugin); notifyOnActivityGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnActivityGlobally", notifyOnActivityGlobally); notifyOnTunePlugin = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnTunePlugin", notifyOnTunePlugin); notifyOnTuneGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnTuneGlobally", notifyOnTuneGlobally); notifyOnErrorPlugin = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnErrorPlugin", notifyOnErrorPlugin); notifyOnErrorGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnErrorGlobally", notifyOnErrorGlobally); selectStatusOnStartup = reader.GetValueAsBool(Helper.PLUGIN_NAME, "selectStatusOnStartup", selectStatusOnStartup); notifyTimeOut = reader.GetValueAsInt(Helper.PLUGIN_NAME, "notifyTimeOut", notifyTimeOut); autoIdleTimeOut = reader.GetValueAsInt(Helper.PLUGIN_NAME, "autoIdleTimeOut", autoIdleTimeOut); autoIdleStatusType = (Enums.StatusType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "autoIdleStatusType", (int)autoIdleStatusType); tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "autoIdleStatusMessage"); if (!String.IsNullOrEmpty(tmpSettingsString)) { autoIdleStatusMessage = tmpSettingsString; } defaultStatusType = (Enums.StatusType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultStatusType", (int)defaultStatusType); tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "defaultStatusMessage"); if (!String.IsNullOrEmpty(tmpSettingsString)) { defaultStatusMessage = tmpSettingsString; } defaultMoodType = (Enums.MoodType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultMoodType", (int)defaultMoodType); tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "defaultMoodMessage"); if (!String.IsNullOrEmpty(tmpSettingsString)) { defaultMoodMessage = tmpSettingsString; } defaultActivityType = (Enums.ActivityType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultActivityType", (int)defaultActivityType); tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "defaultActivityMessage"); if (!String.IsNullOrEmpty(tmpSettingsString)) { defaultActivityMessage = tmpSettingsString; } notifyWindowType = (Helper.PLUGIN_NOTIFY_WINDOWS)reader.GetValueAsInt(Helper.PLUGIN_NAME, "notifyWindowType", (int)notifyWindowType); defaultKeyboardType = (Dialog.KeyBoardTypes)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultKeyboardType", (int)Dialog.KeyBoardTypes.Default); publishTuneInfo = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishTuneInfo", publishTuneInfo); publishActivityMusic = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityMusic", publishActivityMusic); publishActivityRadio = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityRadio", publishActivityRadio); publishActivityMovie = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityMovie", publishActivityMovie); publishActivityTV = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityTV", publishActivityTV); publishActivityRecording = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityRecording", publishActivityRecording); } }
public void LoadSettings() { try { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(ConfigFileName())) { // Global parameters this.SampleInterval.Value = reader.GetValueAsInt(settingsSectionName, this.SampleInterval.Name, 15); this.FolderRecursionDepth.Value = reader.GetValueAsInt(settingsSectionName, this.FolderRecursionDepth.Name, 2); this.MaxNumFailures.Value = reader.GetValueAsInt(settingsSectionName, this.MaxNumFailures.Name, 2); this.IgnoreHiddenFiles.Checked = reader.GetValueAsBool(settingsSectionName, this.IgnoreHiddenFiles.Name, true); this.IgnoreSystemFiles.Checked = reader.GetValueAsBool(settingsSectionName, this.IgnoreSystemFiles.Name, true); this.SharesToIgnore.Lines = reader.GetValueAsString(settingsSectionName, this.SharesToIgnore.Name, "").Split('|'); // Video parameters this.VideoMinFileSizeMB.Value = reader.GetValueAsInt(settingsSectionName, this.VideoMinFileSizeMB.Name, 0); this.VideoMaxFileSizeMB.Value = reader.GetValueAsInt(settingsSectionName, this.VideoMaxFileSizeMB.Name, 0); // Picture parameters this.PictureMinFileSizeKB.Value = reader.GetValueAsInt(settingsSectionName, this.PictureMinFileSizeKB.Name, 0); this.PictureMaxFileSizeKB.Value = reader.GetValueAsInt(settingsSectionName, this.PictureMaxFileSizeKB.Name, 0); // Music parameters this.AudioMinFileSizeMB.Value = reader.GetValueAsInt(settingsSectionName, this.AudioMinFileSizeMB.Name, 0); this.AudioMaxFileSizeMB.Value = reader.GetValueAsInt(settingsSectionName, this.AudioMaxFileSizeMB.Name, 0); } } catch (Exception e) { Log.Debug(e.Message); } }
public override void ReadConfig() { try { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { HdmiPort = reader.GetValueAsInt("CecRemote", "HDMIPort", base.HdmiPort); DeviceType = (CecSharp.CecDeviceType)Enum.Parse(typeof(CecSharp.CecDeviceType), (reader.GetValueAsString("CecRemote", "Type", base.DeviceType.ToString())), true); OsdName = reader.GetValueAsString("CecRemote", "OsdName", base.OsdName); FastScrolling = reader.GetValueAsBool("CecRemote", "FastScrolling", base.FastScrolling); FastScrollingRepeatDelay = (ushort)reader.GetValueAsInt("CecRemote", "FastScrollingRepeatDelay", base.FastScrollingRepeatDelay); FastScrollingRepeatRate = (ushort)reader.GetValueAsInt("CecRemote", "FastScrollingRepeatRate", base.FastScrollingRepeatRate); RequireDelayBetweenKeys = reader.GetValueAsBool("CecRemote", "RequireDelayBetweenKeys", base.RequireDelayBetweenKeys); DelayBetweenKeys = (ushort)reader.GetValueAsInt("CecRemote", "DelayBetweenKeys", base.DelayBetweenKeys); DisableScreensaver = reader.GetValueAsBool("CecRemote", "DisableScreensaver", base.DisableScreensaver); ExtensiveLogging = reader.GetValueAsBool("CecRemote", "ExtensiveLogging", base.ExtensiveLogging); WakeDevicesOnStart = reader.GetValueAsBool("CecRemote", "WakeDevicesOnStart", base.WakeDevicesOnStart); ActivateSourceOnStart = reader.GetValueAsBool("CecRemote", "ActivateSourceOnStart", base.ActivateSourceOnStart); OnStartWakeDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnStartWakeDevices", base.OnStartWakeDevices.Primary.ToString())); StandbyDevicesOnExit = reader.GetValueAsBool("CecRemote", "StandbyDevicesOnExit", base.StandbyDevicesOnExit); InactivateSourceOnExit = reader.GetValueAsBool("CecRemote", "InactivateSourceOnExit", base.InactivateSourceOnExit); OnExitStandbyDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnExitStandbyDevices", base.OnExitStandbyDevices.Primary.ToString())); WakeDevicesOnResume = reader.GetValueAsBool("CecRemote", "WakeDevicesOnResume", base.WakeDevicesOnResume); ActivateSourceOnResume = reader.GetValueAsBool("CecRemote", "ActivateSourceOnResume", base.ActivateSourceOnResume); RequireUserInputOnResume = reader.GetValueAsBool("CecRemote", "RequireUserInputOnResume", base.RequireUserInputOnResume); OnResumeWakeDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnResumeWakeDevices", base.OnResumeWakeDevices.Primary.ToString())); StandbyDevicesOnSleep = reader.GetValueAsBool("CecRemote", "StandbyDevicesOnSleep", base.StandbyDevicesOnSleep); InactivateSourceOnSleep = reader.GetValueAsBool("CecRemote", "InactivateSourceOnSleep", base.InactivateSourceOnSleep); OnSleepStandbyDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnSleepStandbyDevices", base.OnSleepStandbyDevices.Primary.ToString())); ConnectedTo = (CecSharp.CecLogicalAddress)Enum.Parse(typeof(CecSharp.CecLogicalAddress), (reader.GetValueAsString("CecRemote", "ConnectedTo", base.ConnectedTo.ToString())), true); SendTvPowerOff = reader.GetValueAsBool("CecRemote", "SendTvPowerOff", base.SendTvPowerOff); SendTvPowerOffOnlyIfActiveSource = reader.GetValueAsBool("CecRemote", "SendTvPowerOffOnlyIfActiveSource", base.SendTvPowerOffOnlyIfActiveSource); RequireActiveSourceWhenSleep = reader.GetValueAsBool("CecRemote", "RequireActiveSourceWhenSleep", base.RequireActiveSourceWhenSleep); ControlVolume = reader.GetValueAsBool("CecRemote", "ControlVolume", base.ControlVolume); ForcePhysicalAddress = reader.GetValueAsBool("CecRemote", "ForcePhysicalAddress", base.ForcePhysicalAddress); PhysicalAddress = reader.GetValueAsString("CecRemote", "PhysicalAddress", base.PhysicalAddress); } } catch (Exception ex) { Log.Error("CecRemote: Configuration read failed, using defaults! {0}", ex.ToString()); base.SetDefaults(); } }
public void Load() { var passwordNeedsUpdate = false; using (var xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { Mp3 = xmlreader.GetValueAsBool("radiotime", "mp3", true); Wma = xmlreader.GetValueAsBool("radiotime", "wma", true); Real = xmlreader.GetValueAsBool("radiotime", "real", false); ShowPresets = xmlreader.GetValueAsBool("radiotime", "showpresets", false); UseVideo = xmlreader.GetValueAsBool("radiotime", "UseVideo", false); JumpNowPlaying = xmlreader.GetValueAsBool("radiotime", "JumpNowPlaying", false); User = xmlreader.GetValueAsString("radiotime", "user", string.Empty); var encryptedPassword = xmlreader.GetValueAsString("radiotime", "encryptedPassword", string.Empty); if (!string.IsNullOrEmpty(encryptedPassword)) { { Password = PasswordUtility.DecryptData(encryptedPassword, DataProtectionScope.LocalMachine); if (string.IsNullOrEmpty(Password)) { Password = string.Empty; } } } else { Password = xmlreader.GetValueAsString("radiotime", "password", string.Empty); passwordNeedsUpdate = true; } FolderId = xmlreader.GetValueAsString("radiotime", "FolderId", string.Empty); PluginName = xmlreader.GetValueAsString("radiotime", "pluginname", "RadioTime"); StartWithFastPreset = xmlreader.GetValueAsBool("radiotime", "StartWithFastPreset", false); SearchHistory.Clear(); ArtistSearchHistory.Clear(); var searchs = xmlreader.GetValueAsString("radiotime", "searchHistory", ""); if (!string.IsNullOrEmpty(searchs)) { var array = searchs.Split('|'); for (var i = 0; i < array.Length && i < 25; i++) { if (!string.IsNullOrEmpty(array[i])) SearchHistory.Add(array[i]); } } searchs = xmlreader.GetValueAsString("radiotime", "artistSearchHistory", ""); if (!string.IsNullOrEmpty(searchs)) { var array = searchs.Split('|'); for (var i = 0; i < array.Length && i < 25; i++) { if (!string.IsNullOrEmpty(array[i])) ArtistSearchHistory.Add(array[i]); } } PartnerId = "41"; } if (passwordNeedsUpdate) { SaveEncryptedPassword(); } }
/// <summary> /// Adds a section of MP shares /// </summary> /// <param name="section">Name of the section</param> private void AddSection(String section) { Share defaultshare = null; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string strDefault = xmlreader.GetValueAsString(section, "default", String.Empty); for (int i = 0; i < 20; i++) { string strShareName = String.Format("sharename{0}", i); string strSharePath = String.Format("sharepath{0}", i); string strPincode = String.Format("pincode{0}", i); string shareType = String.Format("sharetype{0}", i); string shareServer = String.Format("shareserver{0}", i); string shareLogin = String.Format("sharelogin{0}", i); string sharePwd = String.Format("sharepassword{0}", i); string sharePort = String.Format("shareport{0}", i); string remoteFolder = String.Format("shareremotepath{0}", i); string shareViewPath = String.Format("shareview{0}", i); Share share = new Share { Name = xmlreader.GetValueAsString(section, strShareName, String.Empty), Path = xmlreader.GetValueAsString(section, strSharePath, String.Empty) }; share.Pincode = Utils.DecryptPin(xmlreader.GetValueAsString(section, strPincode, string.Empty)); share.IsFtpShare = xmlreader.GetValueAsBool(section, shareType, false); share.FtpServer = xmlreader.GetValueAsString(section, shareServer, String.Empty); share.FtpLoginName = xmlreader.GetValueAsString(section, shareLogin, String.Empty); share.FtpPassword = xmlreader.GetValueAsString(section, sharePwd, String.Empty); share.FtpPort = xmlreader.GetValueAsInt(section, sharePort, 21); share.FtpFolder = xmlreader.GetValueAsString(section, remoteFolder, "/"); share.DefaultLayout = (GUIFacadeControl.Layout)xmlreader.GetValueAsInt(section, shareViewPath, (int)GUIFacadeControl.Layout.List); if (share.Name.Length > 0) { if (strDefault == share.Name) { share.Default = true; if (defaultshare == null) { defaultshare = share; } } if (!_sharePaths.Contains(share.Path.ToLower())) { _sharePaths.Add(share.Path.ToLower()); _mDirectory.Add(share); } } else break; } } }
private void LoadSettings() { if (!_SettingsLoaded) { string section = ConfigProfile.ConfigSection; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, ConfigProfile.ConfigFile))) { string ext = xmlreader.GetValueAsString(section, ConfigProfile.PropNames.Extensions, ConfigProfile.Defaults.Extensions); _SupportedExtensions = ext.Split(new string[] { "," }, StringSplitOptions.None); _UseForCDDA = xmlreader.GetValueAsBool(section, ConfigProfile.PropNames.UseForCDDA, ConfigProfile.Defaults.UseForCDDA); _UseForWebStream = xmlreader.GetValueAsBool(section, ConfigProfile.PropNames.UseForWebStream, ConfigProfile.Defaults.UseForWebStream); _UseForLastFMWebStream = xmlreader.GetValueAsBool(section, ConfigProfile.PropNames.UseForLastFMWebStream, ConfigProfile.Defaults.UseForLastFMWebStream); } using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { Level logLevel = (Level)Enum.Parse(typeof(Level), xmlreader.GetValueAsString("general", "loglevel", "3")); _DebugMode = logLevel == Level.Debug; } _SettingsLoaded = true; } }
/// <summary> /// Loads the configuration with the shares /// </summary> public void LoadConfiguration() { try { XmlDocument doc = new XmlDocument(); string path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml"); doc.Load(path); if (doc.DocumentElement != null) { XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share"); if (listShare != null) foreach (XmlNode nodeShare in listShare) { MPlayerShare share = new MPlayerShare { Name = nodeShare.Attributes["name"].Value, Path = nodeShare.Attributes["path"].Value }; shareList.Items.Add(share); } } using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { pluginName.Text = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer GUI"); myVideoShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); myMusicShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); playlistFolder.Checked = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false); dvdNavCheckbox.Checked = xmlreader.GetValueAsBool("mplayer", "useDVDNAV", false); } } catch (Exception e) { Log.Info("MPlayer GUI Error: Configuration could not be loaded: " + e.Message); } }
/// <summary> /// Constructor /// </summary> public BluRayPlayerLauncherPlugin() { Log.Info("Blu-Ray Player Launcher: construct"); GetID = PluginWindowId; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _player = (Players)xmlreader.GetValueAsInt("BluRayPlayerLauncher", "player", (int)Players.Arcsoft); _playerExecutable = xmlreader.GetValueAsString("BluRayPlayerLauncher", "executable", null); _minimizeDuringPlay = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "minimizeDuringPlay", true); _suspendRenderingDuringPlay = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "suspendRenderingDuringPlay", true); _restorePowerState = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "restorePowerState", false); _showInMenu = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "showInMenu", true); _KeyboardTranslation = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "KeyboardTranslation", true); _pluginNameInMenu = xmlreader.GetValueAsString("BluRayPlayerLauncher", "pluginNameInMenu", "Blu-Ray Player Launcher"); _autoplayHDDVD = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "autoplayHDDVD", true); _autoplayBluray = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "autoplayBluray", true); _autoplayASK = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "autoplayASK", true); _changeRefreshRate = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "changeRefreshRate", true); _24hzRefreshRate = xmlreader.GetValueAsBool("BluRayPlayerLauncher", "24hzRefreshRate", false); _startWithBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false); Log.Info("Blu-Ray Player Launcher: executable: {0}", _playerExecutable); Log.Info("Blu-Ray Player Launcher: minimizeDuringPlay: {0}", _minimizeDuringPlay); Log.Info("Blu-Ray Player Launcher: suspendRenderingDuringPlay: {0}", _suspendRenderingDuringPlay); } }
protected override void OnPageLoad() { base.OnPageLoad(); if (string.IsNullOrEmpty(playlistname)) { GUIPropertyManager.SetProperty("#currentmodule", "Playlist"); } else { GUIPropertyManager.SetProperty("#currentmodule", "Playlist/" + playlistname); } _playlistType = PlayListType.PLAYLIST_MUSIC_VIDEO; currentView = View.PlayList; facadeView.CurrentLayout = GUIFacadeControl.Layout.Playlist; LoadDirectory(string.Empty); if (m_iItemSelected >= 0) { GUIControl.SelectItemControl(GetID, facadeView.GetID, m_iItemSelected); } if ((m_iLastControl == facadeView.GetID) && facadeView.Count <= 0) { m_iLastControl = btnNowPlaying.GetID; GUIControl.FocusControl(GetID, m_iLastControl); } if (facadeView.Count <= 0) { GUIControl.FocusControl(GetID, btnViewAs.GetID); } using (MediaPortal.Profile.Settings settings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("youtubeplaylist", "repeat", true); ScrobblerOn = settings.GetValueAsBool("youtubeplaylist", "ScrobblerOn", true); currentScrobbleMode =(ScrobbleMode) settings.GetValueAsInt("youtubeplaylist", "ScrobblerMode", 0); } if (btnRepeatPlaylist != null) { btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist; } if (ScrobblerOn) btnScrobble.Selected = true; SetScrobbleButonLabel(); SelectCurrentPlayingSong(); }
public static bool Load(string language) { bool isPrefixEnabled; using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); if (language == null) language = reader.GetValueAsString("skin", "language", "English"); } string directory = Config.GetSubFolder(Config.Dir.Language, "TVWishListMP"); string cultureName = null; if (language != null) cultureName = GetCultureName(language); Log.Info("[TVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); //GUIGraphicsContext.CharsInCharacterSet = _stringProvider.Characters; return true; }
/// <summary> /// Reads the whole configuration /// </summary> private void ReadConfig() { try { ExtensionSettings mplayerSetting = new ExtensionSettings(".mplayer", PlayMode.Unrecognized, "", true); _extensionSettings = new Dictionary<string, ExtensionSettings>(); _extensionSettings.Add(mplayerSetting.Name, mplayerSetting); _extensionSettingsExtPlayer = new Dictionary<string, ExtensionSettings>(); _extensionSettingsExtPlayer.Add(mplayerSetting.Name, mplayerSetting); ExtensionSettings settings; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _osdMode = (OSDMode)xmlreader.GetValueAsInt("mplayer", "osd", (int)OSDMode.InternalMPlayer); _rebuildIndex = xmlreader.GetValueAsBool("mplayer", "rebuildIndex", false); _priorityBoost = xmlreader.GetValueAsBool("mplayer", "priorityBoost", true); _framedrop = xmlreader.GetValueAsBool("mplayer", "framedrop", false); _doubleBuffering = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true); _directRendering = xmlreader.GetValueAsBool("mplayer", "directRendering", true); _audioNormalize = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false); _passthroughAC3_DTS = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false); _soundOutputDriver = (SoundOutputDriver)xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound); _soundOutputDevice = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0); _deinterlace = (Deinterlace)xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive); _aspectRatio = (AspectRatio)xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic); _postProcessing = (PostProcessing)xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum); _audioChannels = (AudioChannels)xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default); _noiseDenoise = (NoiseDenoise)xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing); _cacheSize = xmlreader.GetValueAsInt("mplayer", "cacheSize", 0); _audioDelayStep = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100); _subtitleDelayStep = xmlreader.GetValueAsInt("mplayer", "subtitleDelayStep", 100); _subtitlePosition = xmlreader.GetValueAsInt("mplayer", "subtitlePosition", 100); _subtitleSize = xmlreader.GetValueAsInt("mplayer", "subtitleSize", 5); string subtitleFontName = xmlreader.GetValueAsString("mplayer", "subtitleFontName", "Arial"); _subtitleFontSet = CheckSubtitleFont(subtitleFontName, out _subtitleFontFileName); _mplayerPath = xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\"); xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\Mplayer.exe"); string arguments = xmlreader.GetValueAsString("mplayer", "generalArguments", ""); settings = new ExtensionSettings("general", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "dvdArguments", String.Empty); settings = new ExtensionSettings("dvd://", PlayMode.Video, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "vcdArguments", String.Empty); settings = new ExtensionSettings("vcd://", PlayMode.Video, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "svcdArguments", String.Empty); settings = new ExtensionSettings("svcd://", PlayMode.Video, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "cueArguments", String.Empty); settings = new ExtensionSettings("cue://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "ftpArguments", String.Empty); settings = new ExtensionSettings("ftp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "httpArguments", String.Empty); settings = new ExtensionSettings("http://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); settings = new ExtensionSettings("http_proxy://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "mmsArguments", String.Empty); settings = new ExtensionSettings("mms://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); settings = new ExtensionSettings("mmst://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "mpstArguments", String.Empty); settings = new ExtensionSettings("mpst://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "rtspArguments", String.Empty); settings = new ExtensionSettings("rtsp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); settings = new ExtensionSettings("rtp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "sdpArguments", String.Empty); settings = new ExtensionSettings("sdp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "udpArguments", String.Empty); settings = new ExtensionSettings("udp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "unsvArguments", String.Empty); settings = new ExtensionSettings("unsv://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); _enableSubtitles = xmlreader.GetValueAsBool("mplayer", "enableSubtitles", false); _videoOutputDriver = (VideoOutputDriver)xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)VideoOutputDriver.DirectX); string timeout = (xmlreader.GetValueAsString("movieplayer", "skipsteptimeout", "1500")); if (timeout == string.Empty) _seekStepTimeout = 1500; else _seekStepTimeout = Convert.ToInt16(timeout); String m_strLanguage = xmlreader.GetValueAsString("skin", "language", "English"); LocalizeStrings.Load(m_strLanguage); } LoadXMLData(); } catch (Exception e) { Log.Error(e); } _supportedExtensions = new String[_extensionSettingsExtPlayer.Count]; _extensionSettingsExtPlayer.Keys.CopyTo(_supportedExtensions, 0); }
/// <summary> /// Handler for the GUIMessage of the MP System /// </summary> /// <param name="message">Message of MP</param> /// <returns>Result</returns> public override bool OnMessage(GUIMessage message) { if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_INIT) { bool mplayerPlayerAvailable; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { mplayerPlayerAvailable = xmlreader.GetValueAsBool("plugins", "MPlayer", false); } mplayerPlayerAvailable = (mplayerPlayerAvailable & File.Exists(Config.GetFile(Config.Dir.Plugins, "ExternalPlayers", "MPlayer_ExtPlayer.dll"))); if (!mplayerPlayerAvailable) { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading("My MPlayer GUI"); dlgOk.SetLine(1, "MPlayer External Player not available!"); dlgOk.SetLine(2, "Please activate it in the Setup"); dlgOk.DoModal(GetID); GUIWindowManager.ShowPreviousWindow(); } } return base.OnMessage(message); }
public PlayListPlayer() { Init(); // Check if External Player is being used MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml")); m_bIsExternalPlayer = !xmlreader.GetValueAsBool("movieplayer", "internal", true); m_bIsExternalDVDPlayer = !xmlreader.GetValueAsBool("dvdplayer", "internal", true); if (!LastFMProfile.IsLoged) LastFMProfile.Login(mvCentralCore.Settings.LastFMUsername, mvCentralCore.Settings.LastFMPassword); }
public override bool Init() { bool result = Load(GUIGraphicsContext.Skin + @"\MyMovies.xml"); try { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _currentLayout = (LayoutOptions)xmlreader.GetValueAsInt("MyMovies", "layout", (int)LayoutOptions.List); _currentView = (Views)xmlreader.GetValueAsInt("MyMovies", "view", (int)_currentView); _currentSorting = (Sorting.Options)xmlreader.GetValueAsInt("MyMovies", "sorting", (int)_currentSorting); CurrentUser = xmlreader.GetValueAsInt("MyMovies", "currentUser", CurrentUser); _sortAscending = xmlreader.GetValueAsBool("MyMovies", "sortDirection", _sortAscending); _programDataPath = xmlreader.GetValueAsString("MyMovies", "txtProgramDataPath", @"C:\ProgramData\My Movies\FileStorage"); _serverName = xmlreader.GetValueAsString("MyMovies", "txtServerName", "localhost"); _dbInstance = xmlreader.GetValueAsString("MyMovies", "txtDBInstance", "MYMOVIES"); _userName = xmlreader.GetValueAsString("MyMovies", "txtUserName", string.Empty); _password = xmlreader.GetValueAsString("MyMovies", "txtPassword", string.Empty); _storedPIN = xmlreader.GetValueAsString("MyMovies", "txtPINCode", "4321"); _chkRemoteWakeup = xmlreader.GetValueAsBool("MyMovies", "chkRemoteWakeup", false); _macAddress = MacAddress.Parse(xmlreader.GetValueAsString("MyMovies", "MACAddress", "00-00-00-00-00-00")); _ipAddress = IPAddress.Parse(xmlreader.GetValueAsString("MyMovies", "IPAddress", "0.0.0.0")); _wakeupRetries = xmlreader.GetValueAsInt("MyMovies", "wakeupRetries", 3); _wakeupRetryTimeout = xmlreader.GetValueAsInt("MyMovies", "wakeupRetryTimeout", 3000); _maxConfiguredRating= xmlreader.GetValueAsInt("MyMovies", "maximumViewableRating", 4); string xml = xmlreader.GetValueAsString("MyMovies", "xmlPathReplacement", string.Empty); _driveReplacements = new DriveReplacements(xml); string xmlUsers = xmlreader.GetValueAsString("MyMovies", "xmlUsers", string.Empty); _availableUsers = new Users(xmlUsers); } Log.Info(string.Format("MyMovies::Init - RemoteWakeup {0}, MAC {1}, IP {2}", _chkRemoteWakeup, _macAddress, _ipAddress)); } catch (Exception ex) { Log.Error("MyMovies::Init - Cannot load settings"); Log.Error(ex); } // Determine the maximum assigned rating within the DB. _maxRating = GetMaximumRating(); g_Player.PlayBackStopped += new g_Player.StoppedHandler(OnPlayBackStopped); g_Player.PlayBackChanged += new g_Player.ChangedHandler(OnPlayBackChanged); g_Player.PlayBackEnded += new g_Player.EndedHandler(OnPlayBackEnded); return result; }
/// <summary> /// Standard constructor which set the WindowID /// </summary> public MPlayerGUIPlugin() { GetID = 9533; _virtualPath = String.Empty; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { CurrentView = (View)xmlreader.GetValueAsInt(string.Empty, "view", (int)View.List); CurrentSortMethod = (VideoSort.SortMethod)xmlreader.GetValueAsInt(string.Empty, "sortmethod", (int)VideoSort.SortMethod.Name); _displayName = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer"); _useMyVideoShares = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); _useMyMusicShares = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); _treatPlaylistsAsFolders = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false); _useDvdnav = xmlreader.GetValueAsBool("mplayer", "useDVDNAV", false); String mStrLanguage = xmlreader.GetValueAsString("skin", "language", "English"); LocalizeStrings.Load(mStrLanguage); } }
public override bool Init() { mdb = MusicDatabase.Instance; m_strDirectory = System.IO.Directory.GetCurrentDirectory(); using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _enableScrobbling = xmlreader.GetValueAsBool("plugins", "Audioscrobbler", false); _currentScrobbleUser = xmlreader.GetValueAsString("audioscrobbler", "user", "Username"); _useSimilarRandom = xmlreader.GetValueAsBool("audioscrobbler", "usesimilarrandom", true); _announceNowPlaying = xmlreader.GetValueAsBool("audioscrobbler", "EnableNowPlaying", true); } _scrobbleUsers = mdb.GetAllScrobbleUsers(); // no users in database if (_scrobbleUsers.Count > 0 && _enableScrobbling) LoadScrobbleUserSettings(); ascrobbler = AudioscrobblerUtils.Instance; // ScrobbleLock = new object(); //added by Sam GUIWindowManager.Receivers += new SendMessageHandler(this.OnThreadMessage); GUIWindowManager.OnNewAction += new OnActionHandler(this.OnNewAction); g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped); Youtube2MP.player.PlayBegin += new YoutubePlaylistPlayer.EventHandler(player_PlayBegin); return Load(GUIGraphicsContext.Skin + @"\youtubeplaylist.xml"); }
public VideoHandler() { playlistPlayer = MediaPortal.Playlists.PlayListPlayer.SingletonPlayer; // Check if External Player is being used MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); m_bIsExternalPlayer = !xmlreader.GetValueAsBool("movieplayer", "internal", true); m_bIsExternalDVDPlayer = !xmlreader.GetValueAsBool("dvdplayer", "internal", true); // external player handlers Utils.OnStartExternal += new Utils.UtilEventHandler(onStartExternal); Utils.OnStopExternal += new Utils.UtilEventHandler(onStopExternal); g_Player.PlayBackStopped += new MediaPortal.Player.g_Player.StoppedHandler(OnPlayBackStopped); g_Player.PlayBackEnded += new MediaPortal.Player.g_Player.EndedHandler(OnPlayBackEnded); g_Player.PlayBackStarted += new MediaPortal.Player.g_Player.StartedHandler(OnPlayBackStarted); g_Player.PlayBackChanged += new g_Player.ChangedHandler(OnPlaybackChanged); PlayPropertyUpdater.WorkerSupportsCancellation = true; PlayPropertyUpdater.DoWork += new DoWorkEventHandler(SetPlayProperties_DoWork); }
protected override void OnPageLoad() { base.OnPageLoad(); if (Youtube2MP._settings.UseYouTubePlayer) { _playlistType = PlayListType.PLAYLIST_VIDEO_TEMP; } else { _playlistType = PlayListType.PLAYLIST_MUSIC_VIDEO; } currentView = View.PlayList; facadeView.View = GUIFacadeControl.ViewMode.Playlist; if (ScrobblerOn) btnScrobble.Selected = true; if (_scrobbleUsers.Count < 2) btnScrobbleUser.Visible = false; btnScrobbleUser.Label = GUILocalizeStrings.Get(33005) + _currentScrobbleUser; LoadDirectory(string.Empty); if (m_iItemSelected >= 0) { GUIControl.SelectItemControl(GetID, facadeView.GetID, m_iItemSelected); } if ((m_iLastControl == facadeView.GetID) && facadeView.Count <= 0) { m_iLastControl = btnNowPlaying.GetID; GUIControl.FocusControl(GetID, m_iLastControl); } if (facadeView.Count <= 0) { GUIControl.FocusControl(GetID, btnViewAs.GetID); } using (MediaPortal.Profile.Settings settings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("musicfiles", "repeat", true); } if (btnRepeatPlaylist != null) { btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist; } SelectCurrentPlayingSong(); }
/// <summary> /// Reads the whole configuration /// </summary> private void ReadConfig() { try { ExtensionSettings mplayerSetting = new ExtensionSettings(".mplayer", PlayMode.Unrecognized, "", true); _extensionSettings = new Dictionary <string, ExtensionSettings>(); _extensionSettings.Add(mplayerSetting.Name, mplayerSetting); _extensionSettingsExtPlayer = new Dictionary <string, ExtensionSettings>(); _extensionSettingsExtPlayer.Add(mplayerSetting.Name, mplayerSetting); ExtensionSettings settings; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { _osdMode = (OSDMode)xmlreader.GetValueAsInt("mplayer", "osd", (int)OSDMode.InternalMPlayer); _rebuildIndex = xmlreader.GetValueAsBool("mplayer", "rebuildIndex", false); _priorityBoost = xmlreader.GetValueAsBool("mplayer", "priorityBoost", true); _framedrop = xmlreader.GetValueAsBool("mplayer", "framedrop", false); _doubleBuffering = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true); _directRendering = xmlreader.GetValueAsBool("mplayer", "directRendering", true); _audioNormalize = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false); _passthroughAC3_DTS = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false); _soundOutputDriver = (SoundOutputDriver)xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound); _soundOutputDevice = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0); _deinterlace = (Deinterlace)xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive); _aspectRatio = (AspectRatio)xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic); _postProcessing = (PostProcessing)xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum); _audioChannels = (AudioChannels)xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default); _noiseDenoise = (NoiseDenoise)xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing); _cacheSize = xmlreader.GetValueAsInt("mplayer", "cacheSize", 0); _audioDelayStep = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100); _subtitleDelayStep = xmlreader.GetValueAsInt("mplayer", "subtitleDelayStep", 100); _subtitlePosition = xmlreader.GetValueAsInt("mplayer", "subtitlePosition", 100); _subtitleSize = xmlreader.GetValueAsInt("mplayer", "subtitleSize", 5); string subtitleFontName = xmlreader.GetValueAsString("mplayer", "subtitleFontName", "Arial"); _subtitleFontSet = CheckSubtitleFont(subtitleFontName, out _subtitleFontFileName); _mplayerPath = xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\"); xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\Mplayer.exe"); string arguments = xmlreader.GetValueAsString("mplayer", "generalArguments", ""); settings = new ExtensionSettings("general", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "dvdArguments", String.Empty); settings = new ExtensionSettings("dvd://", PlayMode.Video, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "vcdArguments", String.Empty); settings = new ExtensionSettings("vcd://", PlayMode.Video, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "svcdArguments", String.Empty); settings = new ExtensionSettings("svcd://", PlayMode.Video, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "cueArguments", String.Empty); settings = new ExtensionSettings("cue://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "ftpArguments", String.Empty); settings = new ExtensionSettings("ftp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "httpArguments", String.Empty); settings = new ExtensionSettings("http://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); settings = new ExtensionSettings("http_proxy://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "mmsArguments", String.Empty); settings = new ExtensionSettings("mms://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); settings = new ExtensionSettings("mmst://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "mpstArguments", String.Empty); settings = new ExtensionSettings("mpst://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "rtspArguments", String.Empty); settings = new ExtensionSettings("rtsp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); settings = new ExtensionSettings("rtp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "sdpArguments", String.Empty); settings = new ExtensionSettings("sdp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "udpArguments", String.Empty); settings = new ExtensionSettings("udp://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); arguments = xmlreader.GetValueAsString("mplayer", "unsvArguments", String.Empty); settings = new ExtensionSettings("unsv://", PlayMode.Unrecognized, arguments, false); _extensionSettings.Add(settings.Name, settings); _enableSubtitles = xmlreader.GetValueAsBool("mplayer", "enableSubtitles", false); _videoOutputDriver = (VideoOutputDriver)xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)VideoOutputDriver.DirectX); string timeout = (xmlreader.GetValueAsString("movieplayer", "skipsteptimeout", "1500")); if (timeout == string.Empty) { _seekStepTimeout = 1500; } else { _seekStepTimeout = Convert.ToInt16(timeout); } String m_strLanguage = xmlreader.GetValueAsString("skin", "language", "English"); LocalizeStrings.Load(m_strLanguage); } LoadXMLData(); } catch (Exception e) { Log.Error(e); } _supportedExtensions = new String[_extensionSettingsExtPlayer.Count]; _extensionSettingsExtPlayer.Keys.CopyTo(_supportedExtensions, 0); }
bool _mpSetAsFullScreen() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { return xmlreader.GetValueAsBool("general", "startfullscreen", false); } }
/// <summary> /// Initialise the socket server if necessary /// </summary> internal void InitAndStartSocket() { if (socketServer == null) { WifiRemote.LogMessage("Setting up socket server", LogType.Debug); String userName = null; String password = null; String passcode = null; AuthMethod auth = AuthMethod.None; int autologinTimeout = 0; bool showNotification = false; // Load port from config using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { port = (UInt16)reader.GetValueAsInt(PLUGIN_NAME, "port", DEFAULT_PORT); disableBonjour = reader.GetValueAsBool(PLUGIN_NAME, "disableBonjour", false); serviceName = reader.GetValueAsString(PLUGIN_NAME, "serviceName", ""); userName = reader.GetValueAsString(PLUGIN_NAME, "username", ""); userName = WifiRemote.DecryptString(userName); password = reader.GetValueAsString(PLUGIN_NAME, "password", ""); password = WifiRemote.DecryptString(password); passcode = reader.GetValueAsString(PLUGIN_NAME, "passcode", ""); passcode = WifiRemote.DecryptString(passcode); auth = (AuthMethod)reader.GetValueAsInt(PLUGIN_NAME, "auth", 0); autologinTimeout = reader.GetValueAsInt(PLUGIN_NAME, "autologinTimeout", 0); showNotification = reader.GetValueAsBool(PLUGIN_NAME, "showNotifications", false); } // Start listening for client connections socketServer = new SocketServer(port); socketServer.UserName = userName; socketServer.Password = password; socketServer.PassCode = passcode; socketServer.AllowedAuth = auth; socketServer.AutologinTimeout = autologinTimeout; socketServer.ShowNotifications = showNotification; } socketServer.Start(); }
public override void ReadConfig() { try { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { HdmiPort = reader.GetValueAsInt("CecRemote", "HDMIPort", base.HdmiPort); DeviceType = (CecSharp.CecDeviceType)Enum.Parse(typeof(CecSharp.CecDeviceType), (reader.GetValueAsString("CecRemote", "Type", base.DeviceType.ToString())), true); OsdName = reader.GetValueAsString("CecRemote", "OsdName", base.OsdName); FastScrolling = reader.GetValueAsBool("CecRemote", "FastScrolling", base.FastScrolling); FastScrollingRepeatDelay = (ushort)reader.GetValueAsInt("CecRemote", "FastScrollingRepeatDelay", base.FastScrollingRepeatDelay); FastScrollingRepeatRate = (ushort)reader.GetValueAsInt("CecRemote", "FastScrollingRepeatRate", base.FastScrollingRepeatRate); RequireDelayBetweenKeys = reader.GetValueAsBool("CecRemote", "RequireDelayBetweenKeys", base.RequireDelayBetweenKeys); DelayBetweenKeys = (ushort)reader.GetValueAsInt("CecRemote", "DelayBetweenKeys", base.DelayBetweenKeys); DisableScreensaver = reader.GetValueAsBool("CecRemote", "DisableScreensaver", base.DisableScreensaver); ExtensiveLogging = reader.GetValueAsBool("CecRemote", "ExtensiveLogging", base.ExtensiveLogging); WakeDevicesOnStart = reader.GetValueAsBool("CecRemote", "WakeDevicesOnStart", base.WakeDevicesOnStart); ActivateSourceOnStart = reader.GetValueAsBool("CecRemote", "ActivateSourceOnStart", base.ActivateSourceOnStart); OnStartWakeDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnStartWakeDevices", base.OnStartWakeDevices.Primary.ToString())); StandbyDevicesOnExit = reader.GetValueAsBool("CecRemote", "StandbyDevicesOnExit", base.StandbyDevicesOnExit); InactivateSourceOnExit = reader.GetValueAsBool("CecRemote", "InactivateSourceOnExit", base.InactivateSourceOnExit); OnExitStandbyDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnExitStandbyDevices", base.OnExitStandbyDevices.Primary.ToString())); WakeDevicesOnResume = reader.GetValueAsBool("CecRemote", "WakeDevicesOnResume", base.WakeDevicesOnResume); ActivateSourceOnResume = reader.GetValueAsBool("CecRemote", "ActivateSourceOnResume", base.ActivateSourceOnResume); RequireUserInputOnResume = reader.GetValueAsBool("CecRemote", "RequireUserInputOnResume", base.RequireUserInputOnResume); OnResumeWakeDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnResumeWakeDevices", base.OnResumeWakeDevices.Primary.ToString())); StandbyDevicesOnSleep = reader.GetValueAsBool("CecRemote", "StandbyDevicesOnSleep", base.StandbyDevicesOnSleep); InactivateSourceOnSleep = reader.GetValueAsBool("CecRemote", "InactivateSourceOnSleep", base.InactivateSourceOnSleep); OnSleepStandbyDevices = ParseDevices(reader.GetValueAsString("CecRemote", "OnSleepStandbyDevices", base.OnSleepStandbyDevices.Primary.ToString())); ConnectedTo = (CecSharp.CecLogicalAddress)Enum.Parse(typeof(CecSharp.CecLogicalAddress), (reader.GetValueAsString("CecRemote", "ConnectedTo", base.ConnectedTo.ToString())), true); SendTvPowerOff = reader.GetValueAsBool("CecRemote", "SendTvPowerOff", base.SendTvPowerOff); SendTvPowerOffOnlyIfActiveSource = reader.GetValueAsBool("CecRemote", "SendTvPowerOffOnlyIfActiveSource", base.SendTvPowerOffOnlyIfActiveSource); RequireActiveSourceWhenSleep = reader.GetValueAsBool("CecRemote", "RequireActiveSourceWhenSleep", base.RequireActiveSourceWhenSleep); ControlVolume = reader.GetValueAsBool("CecRemote", "ControlVolume", base.ControlVolume); ForcePhysicalAddress = reader.GetValueAsBool("CecRemote", "ForcePhysicalAddress", base.ForcePhysicalAddress); PhysicalAddress = reader.GetValueAsString("CecRemote", "PhysicalAddress", base.PhysicalAddress); } } catch (Exception ex) { Log.Error("CecRemote: Configuration read failed, using defaults! {0}", ex.ToString()); base.SetDefaults(); } }
public static bool Load(string language) { bool isPrefixEnabled; using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); if (language == null) language = reader.GetValueAsString("skin", "language", "English"); } string directory = Config.GetSubFolder(Config.Dir.Language, "TVWishListMP"); string cultureName = null; if (language != null) cultureName = GetCultureName(language); Log.Info("[aTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); CultureInfo MPculture = CultureInfo.CreateSpecificCulture(cultureName); Log.Debug("MPculture.EnglishName=" + MPculture.EnglishName); Log.Debug("MPculture.Parent.EnglishName=" + MPculture.Parent.EnglishName); CultureInfo[] availableCultures = _stringProvider.AvailableLanguages(); foreach (CultureInfo myculture in availableCultures) { if (myculture.EnglishName == language) { Log.Info("[bTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); return true; } } foreach (CultureInfo myculture in availableCultures) { if (myculture.EnglishName == MPculture.Parent.EnglishName) { Log.Info("[cTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, MPculture.Parent.TwoLetterISOLanguageName, MPculture.Parent.EnglishName, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, MPculture.Parent.TwoLetterISOLanguageName, isPrefixEnabled); return true; } } CultureInfo bestculture = _stringProvider.GetBestLanguage(); Log.Info("[dTVWishListMP Localice Strings]: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, bestculture.TwoLetterISOLanguageName, bestculture.EnglishName, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, bestculture.TwoLetterISOLanguageName, isPrefixEnabled); return true; }
public void Load() { using (var xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { this.PluginName = xmlreader.GetValueAsString("youtubevideos", "PluginName", "YouTube.fm"); this.User = xmlreader.GetValueAsString("youtubevideos", "user", string.Empty); this.Password = xmlreader.GetValueAsString("youtubevideos", "password", string.Empty); this.StartUpOpt = xmlreader.GetValueAsInt("youtubevideos", "StartUpOpt", 0); this.VideoQuality = xmlreader.GetValueAsInt("youtubevideos", "VideoQuality", 0); this.LayoutItem = xmlreader.GetValueAsInt("youtubevideos", "LayoutItem", 0); this.LayoutArtist = xmlreader.GetValueAsInt("youtubevideos", "LayoutArtist", 2); this.LayoutVideo = xmlreader.GetValueAsInt("youtubevideos", "LayoutVideo", 5); this.MusicFilter = xmlreader.GetValueAsBool("youtubevideos", "MusicFilter", true); string his = xmlreader.GetValueAsString("youtubevideos", "searchhistory", string.Empty); this.ShowNowPlaying = xmlreader.GetValueAsBool("youtubevideos", "ShowNowPlaying", true); this.UseExtremFilter = xmlreader.GetValueAsBool("youtubevideos", "UseExtremFilter", false); this.LoadOnlineFanart = xmlreader.GetValueAsBool("youtubevideos", "LoadOnlineFanart", true); this.CacheDir = xmlreader.GetValueAsString("youtubevideos", "CacheDir", string.Empty); this.FanartDir = xmlreader.GetValueAsString("youtubevideos", "FanartFolder", string.Empty); this.DownloadFolder = xmlreader.GetValueAsString("youtubevideos", "DownloadFolder", Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\Videos"); this.LastFmUser = xmlreader.GetValueAsString("youtubevideos", "LastFmUser", string.Empty); this.LastFmPass = xmlreader.GetValueAsString("youtubevideos", "LastFmPass", string.Empty); this.LastFmNowPlay = xmlreader.GetValueAsBool("youtubevideos", "LastFmNowPlay", false); this.LastFmSubmit = xmlreader.GetValueAsBool("youtubevideos", "LastFmSubmit", false); this.UseAsServer = xmlreader.GetValueAsBool("youtubevideos", "UseAsServer", false); this.PortNumber = xmlreader.GetValueAsInt("youtubevideos", "PortNumber", 18944); this.UseDefaultOSD = xmlreader.GetValueAsBool("youtubevideos", "UseDefaultOSD", false); foreach (string s in his.Split('|')) { if (!string.IsNullOrEmpty(s.Trim())) SearchHistory.Add(s); } } if (string.IsNullOrEmpty(CacheDir)) { CacheDir = Config.GetFile(Config.Dir.Thumbs, @"Youtube.Fm\Cache"); } if (string.IsNullOrEmpty(FanartDir)) { FanartDir = Config.GetFile(Config.Dir.Thumbs, @"Youtube.Fm\Fanart\", "%artist%.png"); } this.LocalFile.Load(); MainMenu.Load("youtubefmMenu.xml"); }
/// <summary> /// Public method to load the text from a strings/xml file into memory /// </summary> /// <param name="language">Language</param> /// <returns> /// true when text is loaded /// false when it was unable to load the text /// </returns> //[Obsolete("This method has changed", true)] public static bool Load(string language) { bool isPrefixEnabled; using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true); string directory = Config.GetSubFolder(Config.Dir.Language, "MPlayer"); string cultureName = null; if (language != null) cultureName = GetCultureName(language); Log.Info("MPlayer: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled); _stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled); return true; }
public override bool Init() { m_localControlForInvoke = new Control(); m_localControlForInvoke.CreateControl(); MPTVSeriesLog.Write("**** Plugin started in MediaPortal ****"); DBOption.LogOptions(); #region Translations Translation.Init(); // Push Translated Strings to skin MPTVSeriesLog.Write("Setting translated strings: ", MPTVSeriesLog.LogLevel.Debug); string propertyName = string.Empty; string propertyValue = string.Empty; foreach (string name in Translation.Strings.Keys) { propertyName = "#TVSeries.Translation." + name + ".Label"; propertyValue = Translation.Strings[name]; MPTVSeriesLog.Write(propertyName + " = " + propertyValue, MPTVSeriesLog.LogLevel.Debug); GUIPropertyManager.SetProperty(propertyName, propertyValue); } #endregion #region Misc m_VideoHandler = new VideoHandler(); m_VideoHandler.RateRequestOccured += new VideoHandler.rateRequest(m_VideoHandler_RateRequestOccured); // Setup Random Fanart Timer m_FanartTimer = new System.Threading.Timer(new TimerCallback(FanartTimerEvent), null, Timeout.Infinite, Timeout.Infinite); m_bFanartTimerDisabled = true; // Lock for Parental Control logicalView.IsLocked = true; // Timer to reset Locked Status if (!string.IsNullOrEmpty(DBOption.GetOptions(DBOption.cParentalControlPinCode))) { long interval = DBOption.GetOptions(DBOption.cParentalControlResetInterval) * 60 * 1000; m_ParentalControlTimer = new System.Threading.Timer(new TimerCallback(ParentalControlTimerEvent), null, 0, interval); } // Check if MediaPortal will Show TVSeries Plugin when restarting // We need to do this because we may need to show a modal dialog e.g. PinCode and we can't do this if MediaPortal window is not yet ready using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { m_bShowLastActiveModule = xmlreader.GetValueAsBool("general", "showlastactivemodule", false); m_iLastActiveModule = xmlreader.GetValueAsInt("general", "lastactivemodule", -1); } #endregion #region Initialize Importer m_parserUpdater = new OnlineParsing(this); OnlineParsing.OnlineParsingProgress += new OnlineParsing.OnlineParsingProgressHandler(parserUpdater_OnlineParsingProgress); OnlineParsing.OnlineParsingCompleted += new OnlineParsing.OnlineParsingCompletedHandler(parserUpdater_OnlineParsingCompleted); System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged; Microsoft.Win32.SystemEvents.PowerModeChanged += new Microsoft.Win32.PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); // Setup Importer InitImporter(); #endregion #region Skin Settings / Load SkinSettings.Init(); // listen to this event to detect skin/language changes in GUI GUIWindowManager.OnDeActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnDeActivateWindow); GUIWindowManager.OnActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnActivateWindow); String xmlSkin = GUIGraphicsContext.Skin + @"\TVSeries.xml"; MPTVSeriesLog.Write("Loading main skin window: " + xmlSkin); return Load(xmlSkin); #endregion }