/// <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); } }
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"); }
public void ReadConfig() { try { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { Action = reader.GetValueAsInt("MarantzControl", "Action", 0); Address = reader.GetValueAsString("MarantzControl", "Address", "0.0.0.0"); Port = reader.GetValueAsString("MarantzControl", "Port", "23"); TelnetCommand = reader.GetValueAsString("MarantzControl", "TelnetCommand", ""); } } catch (Exception ex) { Log.Error("MarantzControl: Configuration read failed, using defaults! {0}", ex.ToString()); SetDefault(); } }
/// <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> /// 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); } }
/// <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); } }
private void frmHeadWebLoadSettings(object sender, EventArgs e) { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "HeadWeb.xml"))) { inputUsername.Text = xmlreader.GetValueAsString("Settings", "Username", ""); inputPassword.Text = xmlreader.GetValueAsString("Settings", "Password", ""); inputPincode.Text = xmlreader.GetValueAsString("Settings", "PINCode", ""); if (xmlreader.GetValueAsString("Settings", "VideoQuality", "").Length <= 0) { videoQuality.SelectedIndex = 0; } else { videoQuality.SelectedIndex = videoQuality.Items.IndexOf(xmlreader.GetValueAsString("Settings", "VideoQuality", "")); } if (xmlreader.GetValueAsInt("Settings", "AutoLogin", 0) != 0) checkboxLogin.Checked = true; if (xmlreader.GetValueAsInt("Settings", "PinApprovePurchase", 0) != 0) checkboxPin.Checked = true; if (xmlreader.GetValueAsInt("Settings", "DisableAdultMovies", 0) != 0) checkboxAdult.Checked = true; if (xmlreader.GetValueAsInt("Settings", "UseOrginalName", 0) != 0) checkboxOrginalName.Checked = 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"))) { 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); } }
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(); } }
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(); }
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(); } }
/// <summary> /// Load a playlist from disc. /// </summary> /// <param name="type">Type of the playlist</param> /// <param name="name">Name of the playlist (file)</param> /// <param name="shuffle"><code>true</code> to shuffle the playlist</param> public static void LoadPlaylist(string type, string name, bool shuffle) { // Only working for music atm PlayListType plType = GetTypeFromString(type); if (plType == PlayListType.PLAYLIST_MUSIC) { string playlistPath = String.Empty; // Playlist path supplied if (name.EndsWith(".m3u")) { playlistPath = name; } // Playlist name supplied else { // Get playlist folder from mp config using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string playlistFolder = reader.GetValueAsString("music", "playlists", ""); if (!Path.IsPathRooted(playlistFolder)) { playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder); } playlistPath = Path.Combine(playlistFolder, name + ".m3u"); } } if (File.Exists(playlistPath)) { // Load playlist from file PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer; PlayList playList = playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC); PlayListM3uIO m3uPlayList = new PlayListM3uIO(); m3uPlayList.Load(playList, playlistPath); // Shuffle playlist if (shuffle) { Shuffle(type); } } } }
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> /// Get all available playlists (playlists in the mp playlist folder) /// </summary> /// <returns>List of playlist names</returns> public static List <String> GetPlaylists() { List <String> playlists = new List <String>(); // Get playlist folder from mp config using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string playlistFolder = reader.GetValueAsString("music", "playlists", ""); if (!Path.IsPathRooted(playlistFolder)) { playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder); } foreach (String f in Directory.GetFiles(playlistFolder)) { playlists.Add(new FileInfo(f).Name); } } return(playlists); }
/// <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 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(); } }
/// <summary> /// Get all active window plugins and the corresponding window IDs. /// This can be used in the client to jump to a specific plugin. /// /// We are also sending the plugin icon as byte array if it exists. /// </summary> internal static ArrayList GetActiveWindowPluginsAndIDs(bool sendIcons) { // Return cached data if (WifiRemote.savedAndSortedPlugins != null) { return(WifiRemote.savedAndSortedPlugins); } // Init cache savedAndSortedPlugins = new ArrayList(); // No cache yet, build plugin list ArrayList plugins = new ArrayList(); ArrayList sortedPlugins = new ArrayList(); Dictionary <int, String> savedPlugins; List <int> ignoredPluginsList; using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { // Read plugin ids and convert them to int String[] savedPluginStrings = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "savedPlugins", "").Split('|'); savedPlugins = new Dictionary <int, string>(); for (int j = 0; j + 1 < savedPluginStrings.Length; j = j + 2) { // Add plugin id and name int i; if (int.TryParse(savedPluginStrings[j], out i)) { savedPlugins.Add(i, savedPluginStrings[j + 1]); } } // Read ignored plugins // Ignored by default: // -1: // 0: home // 3005: GUITopbar // 730716: fanart handler String[] ignoredPluginsString = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "ignoredPlugins", "-1|0|3005|730716").Split('|'); ignoredPluginsList = new List <int>(); foreach (String pluginId in ignoredPluginsString) { int i; if (int.TryParse(pluginId, out i)) { ignoredPluginsList.Add(i); } } } // Fetch all active plugins foreach (ISetupForm plugin in PluginManager.SetupForms) { // Plugin not hidden if (!ignoredPluginsList.Contains(plugin.GetWindowId())) { if (sendIcons) { byte[] iconBytes = new byte[0]; // Load plugin icon Type pluginType = plugin.GetType(); PluginIconsAttribute[] icons = (PluginIconsAttribute[])pluginType.GetCustomAttributes(typeof(PluginIconsAttribute), false); if (icons.Length > 0) { string resourceName = icons[0].ActivatedResourceName; if (!string.IsNullOrEmpty(resourceName)) { System.Drawing.Image icon = null; try { icon = System.Drawing.Image.FromStream(pluginType.Assembly.GetManifestResourceStream(resourceName)); } catch (Exception e) { WifiRemote.LogMessage("Could not load plugin icon: " + e.Message, WifiRemote.LogType.Error); } if (icon != null) { iconBytes = ImageHelper.imageToByteArray(icon, System.Drawing.Imaging.ImageFormat.Png); } } } plugins.Add(new WindowPlugin(plugin.PluginName(), plugin.GetWindowId(), iconBytes)); } else { plugins.Add(new WindowPlugin(plugin.PluginName(), plugin.GetWindowId(), null)); } } } // Add sorted plugins foreach (var aSavedPlugin in savedPlugins) { // Find saved plugin with this window id var query = from WindowPlugin p in plugins where p.WindowId == aSavedPlugin.Key select p; // Add the first found plugin to the list foreach (WindowPlugin plugin in query) { WifiRemote.savedAndSortedPlugins.Add(new WindowPlugin(aSavedPlugin.Value, aSavedPlugin.Key, plugin.Icon)); break; } } // Add rest of plugins foreach (WindowPlugin plugin in plugins) { if (!savedPlugins.ContainsKey(plugin.WindowId)) { WifiRemote.savedAndSortedPlugins.Add(plugin); } } return(WifiRemote.savedAndSortedPlugins); }
/// <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(); }
static MyFilmsSettings() { UserAgent = null; MPVersion = null; Version = null; EntryAssembly = null; try { apppath = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); EntryAssembly = Assembly.GetEntryAssembly(); isConfig = !System.IO.Path.GetFileNameWithoutExtension(EntryAssembly.Location).Equals("mediaportal", StringComparison.InvariantCultureIgnoreCase); Version = Assembly.GetCallingAssembly().GetName().Version; MPVersion = Assembly.GetEntryAssembly().GetName().Version; MPSkinVersion = MediaPortal.Common.Utils.CompatibilityManager.SkinVersion; BuildDate = GetLinkerTimeStamp(Assembly.GetAssembly(typeof(MyFilmsSettings)).Location); MPBuildDate = GetLinkerTimeStamp(System.IO.Path.Combine(GetPath(Path.App), "MediaPortal.exe")); UserAgent = string.Format("MyFilms{0}/{1}", isConfig ? "Config" : string.Empty, Version); } catch (Exception) { } logPath = Config.GetFile(Config.Dir.Log, "MyFilms.log"); backupLogPath = Config.GetFile(Config.Dir.Log, "MyFilms.bak"); langPath = Config.GetSubFolder(Config.Dir.Language, "MyFilms"); MyFilmsPath = Config.GetFolder(Config.Dir.Config) + @"\MyFilms"; MyFilmsThumbsPath = Config.GetFolder(Config.Dir.Thumbs) + @"\MyFilms"; DefaultImages = Config.GetFolder(Config.Dir.Thumbs) + @"\MyFilms\DefaultImages"; ViewImages = Config.GetFolder(Config.Dir.Thumbs) + @"\MyFilms\ViewImages"; ThumbsCachePath = Config.GetFolder(Config.Dir.Thumbs) + @"\MyFilms\ThumbsCache"; GrabberScripts = Config.GetFolder(Config.Dir.Config) + @"\scripts\MyFilms"; skinPath = Config.GetFolder(Config.Dir.Skin); InitFolders(); try { using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string language = reader.GetValueAsString("gui", "language", null); string cultureName = language != null ? GUILocalizeStrings.GetCultureName(language) : null; if (cultureName != null && cultureName.Length > 1) { MPLanguage = cultureName.Substring(cultureName.Length - 2).ToLower(); // e.g. with "en-UK" use "uk" } else { MPLanguage = "en"; } LogMyFilms.Debug("MyFilmsSettings: language name = '" + (language ?? "<null>") + "', culture name = '" + (cultureName ?? "<null>") + "', selected (sub) culture = '" + MPLanguage + "'"); } } catch (Exception ex) { LogMyFilms.Debug("MyFilmsSettings: language exception: " + ex.Message); MPLanguage = "ex"; } }
public static void Load(string section) { Log.Info(string.Format("AvalonConfig: Settings.Load({0})", section)); using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "Avalon.xml"))) { switch (section) { #region MovingPictures case settings.cXMLSectionMovingPictures: MovingPicturesConfig.IsDefaultStyle = xmlreader.GetValueAsInt(section, settings.cXMLSettingMovingPicturesView, 1) == 1; MovingPicturesConfig.ThumbViewMod = (MovingPicturesConfig.Views)xmlreader.GetValueAsInt(section, settings.cXMLSettingMovingPicturesThumbMod, 0); break; #endregion #region TV case settings.cXMLSectionTV: TVConfig.TVMiniGuideRowSize = (TVConfig.TVMiniGuideRows)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVMiniGuideSize, 3); TVConfig.TVGuideRowSize = (TVConfig.TVGuideRows)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVGuideSize, 8); TVConfig.TVHomeLayoutType = (TVConfig.TVHomeLayout)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVHomeLayout, 0); break; #endregion #region TVSeries case settings.cXMLSectionTVSeries: TVSeriesConfig.IsDefaultStyle = xmlreader.GetValueAsInt(section, "TVSeriesInfo", 1) == 1; TVSeriesConfig.widebannerMod = (TVSeriesConfig.Views)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVSeriesWidebannerMod, 0); break; #endregion #region Update case settings.cXMLSectionUpdate: if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateCheckOnStart, 1) != 0) AvalonGUIConfig.checkOnStart = true; if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateCheckForUpdateAt, 1) != 0) AvalonGUIConfig.checkForUpdateAt = true; if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateRunPatchUtilityUnattended, 1) != 0) AvalonGUIConfig.patchUtilityRunUnattended = true; if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdatePatchUtilityRestartMP, 1) != 0) AvalonGUIConfig.patchUtilityRestartMP = true; if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdatePatchAppliedLastRun, 0) != 0) AvalonGUIConfig.patchAppliedLastRun = true; if (AvalonGUIConfig.checkForUpdateAt) { string checkTime = xmlreader.GetValueAsString(section, settings.cXMLSettingUpdateCheckTime, ""); if (string.IsNullOrEmpty(checkTime)) { AvalonGUIConfig.checkTime = DateTime.Parse("03:00"); AvalonGUIConfig.checkInterval = 1; } else { DateTime dtCheckTime = new DateTime(); if (!DateTime.TryParse(checkTime, CultureInfo.CurrentCulture, DateTimeStyles.None, out dtCheckTime)) dtCheckTime = DateTime.Now; AvalonGUIConfig.checkTime = dtCheckTime; AvalonGUIConfig.nextUpdateCheck = xmlreader.GetValueAsString(section, settings.cXMLSettingUpdateNextUpdateCheck, ""); AvalonGUIConfig.checkInterval = xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateCheckInterval, 1); } } break; #endregion #region MyFilms case settings.cXMLSectionMyFilms: MyFilmsConfig.IsDefaultStyle = xmlreader.GetValueAsInt(section, settings.cXMLSettingMyFilmsView, 1) == 1; MyFilmsConfig.ThumbViewMod = (MyFilmsConfig.Views)xmlreader.GetValueAsInt(section, settings.cXMLSettingMyFilmsThumbMod, 0); break; #endregion #region Misc case settings.cXMLSectionMisc: MiscConfigGUI.HidePoster = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscHidePoster, 0) == 1; MiscConfigGUI.showRSS = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowRSS, 1) == 1; MiscConfigGUI.showHiddenMenu = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowHiddenMenu, 1) == 1; MiscConfigGUI.UnfocusedAlphaListItems = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUnfocusedAlphaListItems, 150); MiscConfigGUI.UnfocusedAlphaThumbs = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUnfocusedAlphaThumbs, 150); MiscConfigGUI.UseLargeFonts = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUseLargeFonts, 0) == 1; MiscConfigGUI.showFiveDayWeather = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShow5DayWeather, 1) == 1; MiscConfigGUI.siteUtil = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscTrailerSite, 0); MiscConfigGUI.TextColor = xmlreader.GetValueAsString(section, settings.cXMLSettingMiscTextColor, "FFFFFF"); MiscConfigGUI.TextColor2 = xmlreader.GetValueAsString(section, settings.cXMLSettingMiscTextColor2, "FFFFFF"); MiscConfigGUI.TextColor3 = xmlreader.GetValueAsString(section, settings.cXMLSettingMiscTextColor3, "FFFFFF"); MiscConfigGUI.WatchedColor = xmlreader.GetValueAsString(section, settings.cXMLSettingMiscWatchedColor, "85CFFF"); MiscConfigGUI.RemoteColor = xmlreader.GetValueAsString(section, settings.cXMLSettingMiscRemoteColor, "FC7B19"); MiscConfigGUI.UseWeatherInfoservice = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUseWeatherInfoservice, 0) == 1; break; #endregion #region Video case settings.cXMLSectionVideo: VideoConfig.IsDefaultStyle = xmlreader.GetValueAsInt(section, settings.cXMLSettingVideoView, 1) == 1; VideoConfig.ThumbViewMod = (VideoConfig.Views)xmlreader.GetValueAsInt(section, settings.cXMLSettingVideoThumbMod, 0); break; #endregion } } }
/// <summary> /// Get all active window plugins and the corresponding window IDs. /// This can be used in the client to jump to a specific plugin. /// /// We are also sending the plugin icon as byte array if it exists. /// </summary> internal static ArrayList GetActiveWindowPluginsAndIDs(bool sendIcons) { // Return cached data if (WifiRemote.savedAndSortedPlugins != null) { return WifiRemote.savedAndSortedPlugins; } // Init cache savedAndSortedPlugins = new ArrayList(); // No cache yet, build plugin list ArrayList plugins = new ArrayList(); ArrayList sortedPlugins = new ArrayList(); Dictionary<int, String> savedPlugins; List<int> ignoredPluginsList; using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { // Read plugin ids and convert them to int String[] savedPluginStrings = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "savedPlugins", "").Split('|'); savedPlugins = new Dictionary<int, string>(); for (int j = 0; j + 1 < savedPluginStrings.Length; j = j + 2) { // Add plugin id and name int i; if (int.TryParse(savedPluginStrings[j], out i)) { savedPlugins.Add(i, savedPluginStrings[j + 1]); } } // Read ignored plugins // Ignored by default: // -1: // 0: home // 3005: GUITopbar // 730716: fanart handler String[] ignoredPluginsString = reader.GetValueAsString(WifiRemote.PLUGIN_NAME, "ignoredPlugins", "-1|0|3005|730716").Split('|'); ignoredPluginsList = new List<int>(); foreach (String pluginId in ignoredPluginsString) { int i; if (int.TryParse(pluginId, out i)) { ignoredPluginsList.Add(i); } } } // Fetch all active plugins foreach (ISetupForm plugin in PluginManager.SetupForms) { // Plugin not hidden if (!ignoredPluginsList.Contains(plugin.GetWindowId())) { if (sendIcons) { byte[] iconBytes = new byte[0]; // Load plugin icon Type pluginType = plugin.GetType(); PluginIconsAttribute[] icons = (PluginIconsAttribute[])pluginType.GetCustomAttributes(typeof(PluginIconsAttribute), false); if (icons.Length > 0) { string resourceName = icons[0].ActivatedResourceName; if (!string.IsNullOrEmpty(resourceName)) { System.Drawing.Image icon = null; try { icon = System.Drawing.Image.FromStream(pluginType.Assembly.GetManifestResourceStream(resourceName)); } catch (Exception e) { WifiRemote.LogMessage("Could not load plugin icon: " + e.Message, WifiRemote.LogType.Error); } if (icon != null) { iconBytes = ImageHelper.imageToByteArray(icon, System.Drawing.Imaging.ImageFormat.Png); } } } plugins.Add(new WindowPlugin(plugin.PluginName(), plugin.GetWindowId(), iconBytes)); } else { plugins.Add(new WindowPlugin(plugin.PluginName(), plugin.GetWindowId(), null)); } } } // Add sorted plugins foreach (var aSavedPlugin in savedPlugins) { // Find saved plugin with this window id var query = from WindowPlugin p in plugins where p.WindowId == aSavedPlugin.Key select p; // Add the first found plugin to the list foreach (WindowPlugin plugin in query) { WifiRemote.savedAndSortedPlugins.Add(new WindowPlugin(aSavedPlugin.Value, aSavedPlugin.Key, plugin.Icon)); break; } } // Add rest of plugins foreach (WindowPlugin plugin in plugins) { if (!savedPlugins.ContainsKey(plugin.WindowId)) { WifiRemote.savedAndSortedPlugins.Add(plugin); } } return WifiRemote.savedAndSortedPlugins; }
/// <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); } }
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 void LoadSettings() { Log.Debug("[TVWishListMP]:Loadsettings"); try { using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "TvWishListMP.xml"))) { //set log verbosity Log.DebugValue = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxDebug", "false")); _UserListItemFormat = reader.GetValueAsString(SectionName, "MainItemFormat", ""); _UserListItemFormat = _UserListItemFormat.Replace("<br>", "\n"); _UserListItemFormat = _UserListItemFormat.Replace("<BR>", "\n"); _UserEmailFormat_Org = reader.GetValueAsString(SectionName, "EmailMainFormat", ""); _UserEmailFormat_Org = _UserEmailFormat_Org.Replace("<br>", "\n"); _UserEmailFormat_Org = _UserEmailFormat_Org.Replace("<BR>", "\n"); _UserViewOnlyFormat_Org = reader.GetValueAsString(SectionName, "ViewMainFormat", ""); _UserViewOnlyFormat_Org = _UserViewOnlyFormat_Org.Replace("<br>", "\n"); _UserViewOnlyFormat_Org = _UserViewOnlyFormat_Org.Replace("<BR>", "\n"); TvWishItemSeparator = Convert.ToChar(reader.GetValueAsString(SectionName, "TvWishItemSeparator", ";")); //TIMEOUT = Convert.ToInt32(reader.GetValueAsString(SectionName, "TimeOut", "60")); TimeOutValueString = reader.GetValueAsString(SectionName, "TimeOut", "60"); //data for GUI_Edit_window myTvWishes._boolTranslator[(int)TvWishEntries.action] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxAction", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.active] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxActive", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.afterdays] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxAfterDays", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.aftertime] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxAfterTime", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.beforedays] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxBeforeDay", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.beforetime] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxBeforeTime", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.channel] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxChannel", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.episodename] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeName", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.episodenumber] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeNumber", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.episodepart] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodePart", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.exclude] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxExclude", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.group] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxGroup", "true")); //myTvWishes._boolTranslator[(int)TvWishEntries.hits] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxHits", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.keepepisodes] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxKeepEpisodes", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.keepuntil] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxKeepUntil", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.matchtype] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxMatchType", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.name] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeName", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.postrecord] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPostrecord", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.prerecord] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPrerecord", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.priority] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPriority", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.recommendedcard] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxRecommendedCard", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.recordtype] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxRecordtype", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.searchfor] = true; myTvWishes._boolTranslator[(int)TvWishEntries.seriesnumber] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxSeriesNumber", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.skip] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxSkip", "true")); myTvWishes._boolTranslator[(int)TvWishEntries.useFolderName] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxUseFolderNames", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.withinNextHours] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxRecordtype", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.episodecriteria] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeCriteria", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.preferredgroup] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPreferredGroup", "false")); myTvWishes._boolTranslator[(int)TvWishEntries.includerecordings] = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxIncludeRecordings", "false")); //modify for listview table changes myTvWishes.DisableInfoWindow = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxDisableInfoWindow", "false")); TvWishListQuickMenu = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxDisableQuickMenu", "false")); //create backup vector for usage after view only mode for (int i = 0; i < myTvWishes._boolTranslator.Length; i++) { myTvWishes._boolTranslatorbackup[i] = myTvWishes._boolTranslator[i]; } //load user defined default formats string userDefaultFormatsString = reader.GetValueAsString(SectionName, "DefaultFormats", myTvWishes.DefaultFormatString); if (userDefaultFormatsString == string.Empty) userDefaultFormatsString = "True";//all other defaults will be set from checking below Log.Debug("DefaultFormatsString=" + userDefaultFormatsString); string[] userDefaultFormats = myTvWishes.CheckColumnsEntries(userDefaultFormatsString.Split(TvWishItemSeparator), TvWishItemSeparator,true); for (int i = 0; i < userDefaultFormats.Length; i++) { //overwrite myTvWishes.DefaultValues with user defined default values myTvWishes.DefaultValues[i] = userDefaultFormats[i]; } //id default must be -1 myTvWishes.DefaultValues[(int)TvWishEntries.tvwishid] = "-1"; //counter defaults must be 0 myTvWishes.DefaultValues[(int)TvWishEntries.viewed] = "0"; myTvWishes.DefaultValues[(int)TvWishEntries.emailed] = "0"; myTvWishes.DefaultValues[(int)TvWishEntries.conflicts] = "0"; myTvWishes.DefaultValues[(int)TvWishEntries.deleted] = "0"; myTvWishes.DefaultValues[(int)TvWishEntries.recorded] = "0"; myTvWishes.DefaultValues[(int)TvWishEntries.scheduled] = "0"; //data for GUI_List_window GUI_List_window._sort = Convert.ToInt32(reader.GetValueAsString(SectionName, "Sort", "1")); GUI_List_window._sortreverse = Convert.ToBoolean(reader.GetValueAsString(SectionName, "SortReverse", "false")); GUI_List_window._Email = Convert.ToBoolean(reader.GetValueAsString(SectionName, "FilterEmailed", "true")); GUI_List_window._Deleted = Convert.ToBoolean(reader.GetValueAsString(SectionName, "FilterDeleted", "false")); GUI_List_window._Conflicts = Convert.ToBoolean(reader.GetValueAsString(SectionName, "FilterConflicts", "false")); GUI_List_window._Scheduled = Convert.ToBoolean(reader.GetValueAsString(SectionName, "FilterScheduled", "true")); GUI_List_window._Recorded = Convert.ToBoolean(reader.GetValueAsString(SectionName, "FilterRecorded", "false")); GUI_List_window._View = Convert.ToBoolean(reader.GetValueAsString(SectionName, "FilterViewed", "true")); GUI_List_window._UserListItemFormat = reader.GetValueAsString(SectionName, "ResultsItemFormat", ""); GUI_List_window._UserListItemFormat = GUI_List_window._UserListItemFormat.Replace("<br>", "\n"); GUI_List_window._UserListItemFormat = GUI_List_window._UserListItemFormat.Replace("<BR>", "\n"); GUI_List_window._UserEmailFormat = reader.GetValueAsString(SectionName, "EmailResultsFormat", ""); GUI_List_window._UserEmailFormat = GUI_List_window._UserEmailFormat.Replace("<br>", "\n"); GUI_List_window._UserEmailFormat = GUI_List_window._UserEmailFormat.Replace("<BR>", "\n"); GUI_List_window._UserViewOnlyFormat = reader.GetValueAsString(SectionName, "ViewResultsFormat", ""); GUI_List_window._UserViewOnlyFormat = GUI_List_window._UserViewOnlyFormat.Replace("<br>", "\n"); GUI_List_window._UserViewOnlyFormat = GUI_List_window._UserViewOnlyFormat.Replace("<BR>", "\n"); string _userDateTimeFormat = reader.GetValueAsString(SectionName, "DateTimeFormat", ""); if (_userDateTimeFormat != "") { mymessages.date_time_format = _userDateTimeFormat; Log.Debug("GUI_List_window.mymessages.date_time_format changed to "+mymessages.date_time_format); } } } catch (Exception exc) { Log.Error("Error LoadSettings: Exception " + exc.Message); } }
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); } }
/// <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); }
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(); } }
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); } }
private string PluginNameSetup() { if (strPluginName == null) { string wPluginName; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MyFilms.xml"))) { wPluginName = xmlreader.GetValueAsString("MyFilms", "PluginName", "MyFilms"); } strPluginName = wPluginName; } return strPluginName; }
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() { 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.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"); }
public string readMPConfiguration(string sectionName, string entryName) { try { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { return xmlreader.GetValueAsString(sectionName, entryName, ""); } } catch (Exception e) { //showError("Error reading MediaPortal.xml : " + e.Message, formStreamedMpEditor.errorCode.readError); return string.Empty; } }
/// <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); }
public void Load() { StringDictionary settings = new StringDictionary(); MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); //MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"); JMMServer_Address = xmlreader.GetValueAsString("Anime3", "JMMServer_Address", "127.0.0.1"); JMMServer_Port = xmlreader.GetValueAsString("Anime3", "JMMServer_Port", "8111"); ImportFolderMappingsList = xmlreader.GetValueAsString("Anime3", "ImportFolderMappingsList", ""); CurrentJMMUserID = xmlreader.GetValueAsString("Anime3", "CurrentJMMUserID", ""); thumbsFolder = xmlreader.GetValueAsString("Anime3", "ThumbsFolder", ""); PluginName = xmlreader.GetValueAsString("Anime3", "PluginName", "My Anime 3"); //XMLWebServiceIP = xmlreader.GetValueAsString("Anime2", "XMLWebServiceIP", "anime.hobbydb.net"); LastGroupList = xmlreader.GetValueAsString("Anime2", "LastGroupList", ""); BakaBTUsername = xmlreader.GetValueAsString("Anime3", "BakaBTUsername", ""); BakaBTPassword = xmlreader.GetValueAsString("Anime3", "BakaBTPassword", ""); AnimeBytesUsername = xmlreader.GetValueAsString("Anime3", "AnimeBytesUsername", ""); AnimeBytesPassword = xmlreader.GetValueAsString("Anime3", "AnimeBytesPassword", ""); UTorrentAddress = xmlreader.GetValueAsString("Anime3", "UTorrentAddress", ""); UTorrentPassword = xmlreader.GetValueAsString("Anime3", "UTorrentPassword", ""); UTorrentPort = xmlreader.GetValueAsString("Anime3", "UTorrentPort", ""); UTorrentUsername = xmlreader.GetValueAsString("Anime3", "UTorrentUsername", ""); TorrentSourcesRaw = xmlreader.GetValueAsString("Anime3", "TorrentSources", AnimePluginSettings.TorrentSourcesAll); TorrentPreferOwnGroups = GetBooleanSetting(ref xmlreader, "TorrentPreferOwnGroups", true); WatchedPercentage = int.Parse(xmlreader.GetValueAsString("Anime3", "WatchedPercentage", "90")); EpisodeDisplayFormat = xmlreader.GetValueAsString("Anime3", "EpisodeDisplayFormat", @"<EpNo>: <EpName>"); fileSelectionDisplayFormat = xmlreader.GetValueAsString("Anime3", "FileSelectionDisplayFormat", @"<AnGroupShort> - <FileRes> / <FileSource> / <VideoBitDepth>bit"); ShowMissing = GetBooleanSetting(ref xmlreader, "ShowMissing", true); ShowMissingMyGroupsOnly = GetBooleanSetting(ref xmlreader, "ShowMissingMyGroupsOnly", false); DisplayRatingDialogOnCompletion = GetBooleanSetting(ref xmlreader, "DisplayRatingDialogOnCompletion", true); SingleSeriesGroups = GetBooleanSetting(ref xmlreader, "SingleSeriesGroups", false); string viewMode = ""; viewMode = xmlreader.GetValueAsString("Anime3", "LastGroupViewMode", "0"); LastGroupViewMode = (GUIFacadeControl.Layout)int.Parse(viewMode); string viewModeFan = ""; viewModeFan = xmlreader.GetValueAsString("Anime3", "LastFanartViewMode", "1"); LastFanartViewMode = (GUIFacadeControl.Layout)int.Parse(viewModeFan); string viewModePoster = ""; viewModePoster = xmlreader.GetValueAsString("Anime3", "LastPosterViewMode", "2"); LastPosterViewMode = (GUIFacadeControl.Layout)int.Parse(viewModePoster); HideWatchedFiles = GetBooleanSetting(ref xmlreader, "HideWatchedFiles", false); DefaultAudioLanguage = xmlreader.GetValueAsString("Anime3", "DefaultAudioLanguage", @"<file>"); DefaultSubtitleLanguage = xmlreader.GetValueAsString("Anime3", "DefaultSubtitleLanguage", @"<file>"); string findtimeout = ""; findtimeout = xmlreader.GetValueAsString("Anime3", "FindTimeout", "3"); FindTimeout_s = int.Parse(findtimeout); string findmode = ""; findmode = xmlreader.GetValueAsString("Anime3", "FindMode", "0"); FindMode = (SearchMode)int.Parse(findmode); FindStartWord = GetBooleanSetting(ref xmlreader, "FindStartWord", true); FindFilter = GetBooleanSetting(ref xmlreader, "FindFilter", true); AniDBAutoEpisodesSubbed = GetBooleanSetting(ref xmlreader, "AniDBAutoEpisodesSubbed", true); ShowOnlyAvailableEpisodes = GetBooleanSetting(ref xmlreader, "ShowOnlyAvailableEpisodes", true); HidePlot = GetBooleanSetting(ref xmlreader, "HidePlot", true); MenuDeleteFiles = GetBooleanSetting(ref xmlreader, "MenuDeleteFiles", false); string infodel = ""; infodel = xmlreader.GetValueAsString("Anime3", "InfoDelay", "150"); InfoDelay = int.Parse(infodel); string postpct = ""; postpct = xmlreader.GetValueAsString("Anime3", "PosterSizePct", "50"); int tmpPost = 0; int.TryParse(postpct, out tmpPost); if (tmpPost > 0 && tmpPost <= 100) PosterSizePct = tmpPost; else PosterSizePct = 50; string banpct = ""; banpct = xmlreader.GetValueAsString("Anime3", "BannerSizePct", "50"); int tmpBanner = 0; int.TryParse(banpct, out tmpBanner); if (tmpBanner > 0 && tmpBanner <= 100) BannerSizePct = tmpBanner; else BannerSizePct = 50; string ffdshowNotificationsShow = ""; ffdshowNotificationsShow = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsShow", "1"); FfdshowNotificationsShow = ffdshowNotificationsShow == "0" ? false : true; string ffdshowNotificationsAutoClose = ""; ffdshowNotificationsAutoClose = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoClose", "1"); FfdshowNotificationsAutoClose = ffdshowNotificationsAutoClose == "0" ? false : true; string ffdshowNotificationsLock = ""; ffdshowNotificationsLock = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLock", "1"); FfdshowNotificationsLock = ffdshowNotificationsLock == "0" ? false : true; FfdshowNotificationsAutoCloseTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoCloseTime", "3000")); FfdshowNotificationsLockTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLockTime", "5000")); xmlreader.Dispose(); // parse the list of torrent sources if (TorrentSourcesRaw.Length > 0) { string[] fitems = TorrentSourcesRaw.Split(';'); foreach (string s in fitems) { TorrentSources.Add(s); } } }
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(); }
public SubtitleSelector(ISubtitleStream dvbStreams, SubtitleRenderer subRender, TeletextSubtitleDecoder subDecoder) { Log.Debug("SubtitleSelector ctor"); if (subRender == null) { throw new Exception("Nullpointer input not allowed ( SubtitleRenderer)"); } else { this.dvbStreams = dvbStreams; this.subRender = subRender; } // load preferences using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { preferedLanguages = new List<string>(); string languages = reader.GetValueAsString("tvservice", "preferredsublanguages", ""); Log.Debug("SubtitleSelector: sublangs entry content: " + languages); StringTokenizer st = new StringTokenizer(languages, ";"); while (st.HasMore) { string lang = st.NextToken(); if (lang.Length != 3) { Log.Warn("Language {0} is not in the correct format!", lang); } else { preferedLanguages.Add(lang); Log.Info("Prefered language {0} is {1}", preferedLanguages.Count, lang); } } } pageEntries = new Dictionary<int, TeletextPageEntry>(); bitmapSubtitleCache = new List<SubtitleOption>(); lock (syncLock) { if (subDecoder != null) { subDecoder.SetPageInfoCallback(new MediaPortal.Player.Subtitles.TeletextSubtitleDecoder.PageInfoCallback(OnPageInfo)); } if (dvbStreams != null) { RetrieveBitmapSubtitles(); subStreamCallback = new SubtitleStreamEventCallback(OnSubtitleReset); IntPtr pSubStreamCallback = Marshal.GetFunctionPointerForDelegate(subStreamCallback); Log.Debug("Calling SetSubtitleStreamEventCallback"); dvbStreams.SetSubtitleResetCallback(pSubStreamCallback); } if (preferedLanguages.Count > 0) { autoSelectOption = new SubtitleOption(); autoSelectOption.language = "None"; autoSelectOption.isAuto = true; autoSelectOption.type = SubtitleType.None; SetOption(0); // the autoselect mode will have index 0 (ugly) } } Log.Debug("End SubtitleSelector ctor"); }
public void LoadSettings() { try { using (var reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "TvWishListMP.xml"))) { //DEBUG first checkBoxDebug.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxDebug", "false")); myTvWishes.Debug = checkBoxDebug.Checked; Log.DebugValue = checkBoxDebug.Checked; checkBoxAction.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxAction", "true")); checkBoxActive.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxActive", "false")); checkBoxAfterDays.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxAfterDays", "false")); checkBoxAfterTime.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxAfterTime", "false")); checkBoxBeforeDay.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxBeforeDay", "false")); checkBoxBeforeTime.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxBeforeTime", "false")); checkBoxChannel.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxChannel", "true")); checkBoxEpisodeName.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeName", "false")); checkBoxEpisodeNumber.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeNumber", "false")); checkBoxEpisodePart.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodePart", "false")); checkBoxExclude.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxExclude", "true")); checkBoxGroup.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxGroup", "true")); //checkBoxHits.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxHits", "true")); checkBoxKeepEpisodes.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxKeepEpisodes", "false")); checkBoxKeepUntil.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxKeepUntil", "false")); checkBoxMatchType.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxMatchType", "true")); checkBoxName.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxName", "true")); checkBoxPostrecord.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPostrecord", "false")); checkBoxPrerecord.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPrerecord", "false")); checkBoxPriority.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPriority", "false")); checkBoxRecommendedCard.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxRecommendedCard", "false")); checkBoxRecordtype.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxRecordtype", "true")); // SearchFor is always true; checkBoxSeriesNumber.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxSeriesNumber", "false")); checkBoxSkip.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxSkip", "true")); checkBoxUseFolderNames.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxUseFolderNames", "false")); checkBoxWithinNextHours.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxRecordtype", "false")); checkBoxEpisodeCriteria.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxEpisodeCriteria", "false")); checkBoxPreferredGroup.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxPreferredGroup", "false")); checkBoxIncludeRecordings.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxIncludeRecordings", "false")); //modify for listview table changes checkBoxDisableInfoWindow.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxDisableInfoWindow", "false")); checkBoxDisableQuickMenu.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "checkBoxDisableQuickMenu", "false")); radioButtonEasy.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "radioButtonEasy", "true")); radioButtonExpert.Checked = Convert.ToBoolean(reader.GetValueAsString(SectionName, "radioButtonExpert", "false")); //filenametextBox.Text=reader.GetValueAsString(SectionName, "TvwishlistFolder", ""); //Log.Debug("[TVWishListMP] TvWishListSetup: loadsettings: " + filenametextBox.Text); textBoxDateTimeFormat.Text = reader.GetValueAsString(SectionName, "DateTimeFormat", ""); textBoxMainItemFormat.Text = reader.GetValueAsString(SectionName, "MainItemFormat", ""); textBoxEmailMainFormat.Text = reader.GetValueAsString(SectionName, "EmailMainFormat", ""); textBoxEmailResultsFormat.Text = reader.GetValueAsString(SectionName, "EmailResultsFormat", ""); textBoxResultsItemFormat.Text = reader.GetValueAsString(SectionName, "ResultsItemFormat", ""); textBoxViewMainFormat.Text = reader.GetValueAsString(SectionName, "ViewMainFormat", ""); textBoxViewResultsFormat.Text = reader.GetValueAsString(SectionName, "ViewResultsFormat", ""); textBoxTimeOut.Text = reader.GetValueAsString(SectionName, "TimeOut", "60"); //load defaultformats string defaultformatstring = reader.GetValueAsString(SectionName, "DefaultFormats", ""); //Complete User default string in English LoadDefaultFormatsFromString(defaultformatstring); } } catch (Exception exc) { Log.Debug("[TVWishListMP] TvWishListSetup: Error LoadSettings: Exception " + exc.Message); } }
/// <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"))) { dvdArguments.Text = xmlreader.GetValueAsString("mplayer", "dvdArguments", String.Empty); vcdArguments.Text = xmlreader.GetValueAsString("mplayer", "vcdArguments", String.Empty); svcdArguments.Text = xmlreader.GetValueAsString("mplayer", "svcdArguments", String.Empty); cueArguments.Text = xmlreader.GetValueAsString("mplayer", "cueArguments", String.Empty); ftpArguments.Text = xmlreader.GetValueAsString("mplayer", "ftpArguments", String.Empty); httpArguments.Text = xmlreader.GetValueAsString("mplayer", "httpArguments", String.Empty); mmsArguments.Text = xmlreader.GetValueAsString("mplayer", "mmsArguments", String.Empty); mpstArguments.Text = xmlreader.GetValueAsString("mplayer", "mpstArguments", String.Empty); rtspArguments.Text = xmlreader.GetValueAsString("mplayer", "rtspArguments", String.Empty); sdpArguments.Text = xmlreader.GetValueAsString("mplayer", "sdpArguments", String.Empty); udpArguments.Text = xmlreader.GetValueAsString("mplayer", "udpArguments", String.Empty); unsvArguments.Text = xmlreader.GetValueAsString("mplayer", "unsvArguments", String.Empty); } }
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> /// Get all available playlists (playlists in the mp playlist folder) /// </summary> /// <returns>List of playlist names</returns> public static List<String> GetPlaylists() { List<String> playlists = new List<String>(); // Get playlist folder from mp config using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string playlistFolder = reader.GetValueAsString("music", "playlists", ""); if (!Path.IsPathRooted(playlistFolder)) { playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder); } foreach (String f in Directory.GetFiles(playlistFolder)) { playlists.Add(new FileInfo(f).Name); } } return playlists; }
private bool Load() { MediaPortal.Profile.Settings xml = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); _settings.Add("uTorrent.Server.IP", xml.GetValueAsString("MyTorrents", "uTorrent.Server.IP", "127.0.0.1")); _settings.Add("uTorrent.Server.Port", xml.GetValueAsString("MyTorrents", "uTorrent.Server.Port", "8080")); _settings.Add("uTorrent.Username", xml.GetValueAsString("MyTorrents", "uTorrent.User", "Admin")); _settings.Add("uTorrent.Password", xml.GetValueAsString("MyTorrents", "uTorrent.Password", "salainen")); _settings.Add("Torrent.Notifications", xml.GetValueAsString("MyTorrents", "Torrent.Notifications", "False")); _settings.Add("Torrent.PluginName", xml.GetValueAsString("MyTorrents", "Torrent.PluginName", "MyTorrents")); _settings.Add("uTorrent.Backend", xml.GetValueAsString("MyTorrents", "uTorrent.Backend", "utorrent")); _settings.Add("Torrent.Timer.Inside", xml.GetValueAsString("MyTorrents", "Torrent.Timer.Inside", "5")); _settings.Add("Torrent.Timer.Outside", xml.GetValueAsString("MyTorrents", "Torrent.Timer.Outside", "240")); _settings.Add("TorrentView", xml.GetValueAsString("MyTorrents", "TorrentView", "Active")); _settings.Add("SortOrder", xml.GetValueAsString("MyTorrents", "SortOrder", "Default")); return(true); }
private static List<SettingsFolder> getAllFolders() { List<SettingsFolder> result = new List<SettingsFolder>(); List<SettingsFolder> toRemove = new List<SettingsFolder>(); List<string> subtitlesPathsMP = new List<string>(); int index; MediaPortal.Profile.Settings mpSettings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); string subtitlesPathsSetting = mpSettings.GetValueAsString("subtitles", "paths", @".\"); foreach (string subtitlesPath in subtitlesPathsSetting.Split(new string[] { "," }, StringSplitOptions.None)) { string subtitlesPathToAdd = subtitlesPath.Trim(); if (FileUtils.pathNameIsValid(subtitlesPathToAdd)) subtitlesPathsMP.Add(FileUtils.ensureBackSlash(subtitlesPathToAdd)); } foreach (string subtitlesPath in subtitlesPathsMP) { if (containsPath(Settings.SettingsManager.Properties.FolderSettings.Folders, subtitlesPath, out index)) { SettingsFolder settingsFolder = Settings.SettingsManager.Properties.FolderSettings.Folders[index]; SettingsFolder newSettingsFolder = new SettingsFolder() { Folder = settingsFolder.Folder, Enabled = settingsFolder.Enabled, //Existing = pathExists(settingsFolder.Folder), //Writable = pathIsWritable(settingsFolder.Folder), DefaultForMovies = settingsFolder.DefaultForMovies, DefaultForTVShows = settingsFolder.DefaultForTVShows }; result.Add(newSettingsFolder); } else { SettingsFolder newSettingsFolder = new SettingsFolder() { Folder = subtitlesPath, Enabled = true, //Existing = pathExists(subtitlesPath), //Writable = pathIsWritable(subtitlesPath), DefaultForMovies = false, DefaultForTVShows = false }; result.Add(newSettingsFolder); } } // ensure path .\ if empty - default if (result.Count == 0) { SettingsFolder newSettingsFolder = new SettingsFolder() { Folder = @".\", Enabled = true, DefaultForMovies = true, DefaultForTVShows = true }; result.Insert(0, newSettingsFolder); } Settings.SettingsManager.Properties.FolderSettings.Folders.Clear(); Settings.SettingsManager.Properties.FolderSettings.Folders.AddRange(result); return result; }
/// <summary> /// Load a playlist from disc. /// </summary> /// <param name="type">Type of the playlist</param> /// <param name="name">Name of the playlist (file)</param> /// <param name="shuffle"><code>true</code> to shuffle the playlist</param> public static void LoadPlaylist(string type, string name, bool shuffle) { // Only working for music atm PlayListType plType = GetTypeFromString(type); if (plType == PlayListType.PLAYLIST_MUSIC) { string playlistPath = String.Empty; // Playlist path supplied if (name.EndsWith(".m3u")) { playlistPath = name; } // Playlist name supplied else { // Get playlist folder from mp config using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string playlistFolder = reader.GetValueAsString("music", "playlists", ""); if (!Path.IsPathRooted(playlistFolder)) { playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder); } playlistPath = Path.Combine(playlistFolder, name + ".m3u"); } } if (File.Exists(playlistPath)) { // Load playlist from file PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer; PlayList playList = playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC); PlayListM3uIO m3uPlayList = new PlayListM3uIO(); m3uPlayList.Load(playList, playlistPath); // Shuffle playlist if (shuffle) { Shuffle(type); } } } }
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> /// Save the current playlist to file /// </summary> /// <param name="name">Name of new playlist</param> internal static void SaveCurrentPlaylist(string name) { try { using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { string playlistFolder = reader.GetValueAsString("music", "playlists", ""); if (!Path.IsPathRooted(playlistFolder)) { playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder); } PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer; PlayList playList = playListPlayer.GetPlaylist(playListPlayer.CurrentPlaylistType); String fileName = Path.Combine(playlistFolder, name + ".m3u"); PlayListM3uIO m3uPlayList = new PlayListM3uIO(); m3uPlayList.Save(playList, fileName); } } catch (Exception ex) { WifiRemote.LogMessage("Error saving playlist: " + ex.ToString(), WifiRemote.LogType.Warn); } }
public SubtitleSelector(ISubtitleStream dvbStreams, SubtitleRenderer subRender, TeletextSubtitleDecoder subDecoder) { Log.Debug("SubtitleSelector ctor"); if (subRender == null) { throw new Exception("Nullpointer input not allowed ( SubtitleRenderer)"); } else { this.dvbStreams = dvbStreams; this.subRender = subRender; } // load preferences using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) { preferedLanguages = new List <string>(); string languages = reader.GetValueAsString("tvservice", "preferredsublanguages", ""); Log.Debug("SubtitleSelector: sublangs entry content: " + languages); StringTokenizer st = new StringTokenizer(languages, ";"); while (st.HasMore) { string lang = st.NextToken(); if (lang.Length != 3) { Log.Warn("Language {0} is not in the correct format!", lang); } else { preferedLanguages.Add(lang); Log.Info("Prefered language {0} is {1}", preferedLanguages.Count, lang); } } } pageEntries = new Dictionary <int, TeletextPageEntry>(); bitmapSubtitleCache = new List <SubtitleOption>(); lock (syncLock) { if (subDecoder != null) { subDecoder.SetPageInfoCallback(new MediaPortal.Player.Subtitles.TeletextSubtitleDecoder.PageInfoCallback(OnPageInfo)); } if (dvbStreams != null) { RetrieveBitmapSubtitles(); subStreamCallback = new SubtitleStreamEventCallback(OnSubtitleReset); IntPtr pSubStreamCallback = Marshal.GetFunctionPointerForDelegate(subStreamCallback); Log.Debug("Calling SetSubtitleStreamEventCallback"); dvbStreams.SetSubtitleResetCallback(pSubStreamCallback); } if (preferedLanguages.Count > 0) { autoSelectOption = new SubtitleOption(); autoSelectOption.language = "None"; autoSelectOption.isAuto = true; autoSelectOption.type = SubtitleType.None; SetOption(0); // the autoselect mode will have index 0 (ugly) } } Log.Debug("End SubtitleSelector ctor"); }
public void Load() { StringDictionary settings = new StringDictionary(); MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")); //MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml"); JMMServer_Address = xmlreader.GetValueAsString("Anime3", "JMMServer_Address", "127.0.0.1"); JMMServer_Port = xmlreader.GetValueAsString("Anime3", "JMMServer_Port", "8111"); ImportFolderMappingsList = xmlreader.GetValueAsString("Anime3", "ImportFolderMappingsList", ""); CurrentJMMUserID = xmlreader.GetValueAsString("Anime3", "CurrentJMMUserID", ""); thumbsFolder = xmlreader.GetValueAsString("Anime3", "ThumbsFolder", ""); PluginName = xmlreader.GetValueAsString("Anime3", "PluginName", "My Anime 3"); //XMLWebServiceIP = xmlreader.GetValueAsString("Anime2", "XMLWebServiceIP", "anime.hobbydb.net"); LastGroupList = xmlreader.GetValueAsString("Anime2", "LastGroupList", ""); BakaBTUsername = xmlreader.GetValueAsString("Anime3", "BakaBTUsername", ""); BakaBTPassword = xmlreader.GetValueAsString("Anime3", "BakaBTPassword", ""); AnimeBytesUsername = xmlreader.GetValueAsString("Anime3", "AnimeBytesUsername", ""); AnimeBytesPassword = xmlreader.GetValueAsString("Anime3", "AnimeBytesPassword", ""); UTorrentAddress = xmlreader.GetValueAsString("Anime3", "UTorrentAddress", ""); UTorrentPassword = xmlreader.GetValueAsString("Anime3", "UTorrentPassword", ""); UTorrentPort = xmlreader.GetValueAsString("Anime3", "UTorrentPort", ""); UTorrentUsername = xmlreader.GetValueAsString("Anime3", "UTorrentUsername", ""); TorrentSourcesRaw = xmlreader.GetValueAsString("Anime3", "TorrentSources", AnimePluginSettings.TorrentSourcesAll); TorrentPreferOwnGroups = GetBooleanSetting(ref xmlreader, "TorrentPreferOwnGroups", true); WatchedPercentage = int.Parse(xmlreader.GetValueAsString("Anime3", "WatchedPercentage", "90")); EpisodeDisplayFormat = xmlreader.GetValueAsString("Anime3", "EpisodeDisplayFormat", @"<EpNo>: <EpName>"); fileSelectionDisplayFormat = xmlreader.GetValueAsString("Anime3", "FileSelectionDisplayFormat", @"<AnGroupShort> - <FileRes> / <FileSource> / <VideoBitDepth>bit"); ShowMissing = GetBooleanSetting(ref xmlreader, "ShowMissing", true); ShowMissingMyGroupsOnly = GetBooleanSetting(ref xmlreader, "ShowMissingMyGroupsOnly", false); DisplayRatingDialogOnCompletion = GetBooleanSetting(ref xmlreader, "DisplayRatingDialogOnCompletion", true); SingleSeriesGroups = GetBooleanSetting(ref xmlreader, "SingleSeriesGroups", false); string viewMode = ""; viewMode = xmlreader.GetValueAsString("Anime3", "LastGroupViewMode", "0"); LastGroupViewMode = (GUIFacadeControl.Layout) int.Parse(viewMode); string viewModeFan = ""; viewModeFan = xmlreader.GetValueAsString("Anime3", "LastFanartViewMode", "1"); LastFanartViewMode = (GUIFacadeControl.Layout) int.Parse(viewModeFan); string viewModePoster = ""; viewModePoster = xmlreader.GetValueAsString("Anime3", "LastPosterViewMode", "2"); LastPosterViewMode = (GUIFacadeControl.Layout) int.Parse(viewModePoster); HideWatchedFiles = GetBooleanSetting(ref xmlreader, "HideWatchedFiles", false); DefaultAudioLanguage = xmlreader.GetValueAsString("Anime3", "DefaultAudioLanguage", @"<file>"); DefaultSubtitleLanguage = xmlreader.GetValueAsString("Anime3", "DefaultSubtitleLanguage", @"<file>"); string findtimeout = ""; findtimeout = xmlreader.GetValueAsString("Anime3", "FindTimeout", "3"); FindTimeout_s = int.Parse(findtimeout); string findmode = ""; findmode = xmlreader.GetValueAsString("Anime3", "FindMode", "0"); FindMode = (SearchMode)int.Parse(findmode); FindStartWord = GetBooleanSetting(ref xmlreader, "FindStartWord", true); FindFilter = GetBooleanSetting(ref xmlreader, "FindFilter", true); AniDBAutoEpisodesSubbed = GetBooleanSetting(ref xmlreader, "AniDBAutoEpisodesSubbed", true); ShowOnlyAvailableEpisodes = GetBooleanSetting(ref xmlreader, "ShowOnlyAvailableEpisodes", true); HidePlot = GetBooleanSetting(ref xmlreader, "HidePlot", true); MenuDeleteFiles = GetBooleanSetting(ref xmlreader, "MenuDeleteFiles", false); string infodel = ""; infodel = xmlreader.GetValueAsString("Anime3", "InfoDelay", "150"); InfoDelay = int.Parse(infodel); string postpct = ""; postpct = xmlreader.GetValueAsString("Anime3", "PosterSizePct", "50"); int tmpPost = 0; int.TryParse(postpct, out tmpPost); if (tmpPost > 0 && tmpPost <= 100) { PosterSizePct = tmpPost; } else { PosterSizePct = 50; } string banpct = ""; banpct = xmlreader.GetValueAsString("Anime3", "BannerSizePct", "50"); int tmpBanner = 0; int.TryParse(banpct, out tmpBanner); if (tmpBanner > 0 && tmpBanner <= 100) { BannerSizePct = tmpBanner; } else { BannerSizePct = 50; } string ffdshowNotificationsShow = ""; ffdshowNotificationsShow = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsShow", "1"); FfdshowNotificationsShow = ffdshowNotificationsShow == "0" ? false : true; string ffdshowNotificationsAutoClose = ""; ffdshowNotificationsAutoClose = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoClose", "1"); FfdshowNotificationsAutoClose = ffdshowNotificationsAutoClose == "0" ? false : true; string ffdshowNotificationsLock = ""; ffdshowNotificationsLock = xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLock", "1"); FfdshowNotificationsLock = ffdshowNotificationsLock == "0" ? false : true; FfdshowNotificationsAutoCloseTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsAutoCloseTime", "3000")); FfdshowNotificationsLockTime = int.Parse(xmlreader.GetValueAsString("Anime3", "FfdshowNotificationsLockTime", "5000")); xmlreader.Dispose(); // parse the list of torrent sources if (TorrentSourcesRaw.Length > 0) { string[] fitems = TorrentSourcesRaw.Split(';'); foreach (string s in fitems) { TorrentSources.Add(s); } } }