Exemplo n.º 1
0
        /// <summary>
        /// Adds a section of MP shares
        /// </summary>
        /// <param name="section">Name of the section</param>
        private void AddSection(String section)
        {
            Share defaultshare = null;

            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                string strDefault = xmlreader.GetValueAsString(section, "default", String.Empty);
                for (int i = 0; i < 20; i++)
                {
                    string strShareName = String.Format("sharename{0}", i);
                    string strSharePath = String.Format("sharepath{0}", i);
                    string strPincode   = String.Format("pincode{0}", i);

                    string shareType     = String.Format("sharetype{0}", i);
                    string shareServer   = String.Format("shareserver{0}", i);
                    string shareLogin    = String.Format("sharelogin{0}", i);
                    string sharePwd      = String.Format("sharepassword{0}", i);
                    string sharePort     = String.Format("shareport{0}", i);
                    string remoteFolder  = String.Format("shareremotepath{0}", i);
                    string shareViewPath = String.Format("shareview{0}", i);

                    Share share = new Share
                    {
                        Name = xmlreader.GetValueAsString(section, strShareName, String.Empty),
                        Path = xmlreader.GetValueAsString(section, strSharePath, String.Empty)
                    };

                    share.Pincode       = Utils.DecryptPin(xmlreader.GetValueAsString(section, strPincode, string.Empty));
                    share.IsFtpShare    = xmlreader.GetValueAsBool(section, shareType, false);
                    share.FtpServer     = xmlreader.GetValueAsString(section, shareServer, String.Empty);
                    share.FtpLoginName  = xmlreader.GetValueAsString(section, shareLogin, String.Empty);
                    share.FtpPassword   = xmlreader.GetValueAsString(section, sharePwd, String.Empty);
                    share.FtpPort       = xmlreader.GetValueAsInt(section, sharePort, 21);
                    share.FtpFolder     = xmlreader.GetValueAsString(section, remoteFolder, "/");
                    share.DefaultLayout = (GUIFacadeControl.Layout)xmlreader.GetValueAsInt(section, shareViewPath, (int)GUIFacadeControl.Layout.List);

                    if (share.Name.Length > 0)
                    {
                        if (strDefault == share.Name)
                        {
                            share.Default = true;
                            if (defaultshare == null)
                            {
                                defaultshare = share;
                            }
                        }

                        if (!_sharePaths.Contains(share.Path.ToLower()))
                        {
                            _sharePaths.Add(share.Path.ToLower());
                            _mDirectory.Add(share);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Loads the configuration of this section
 /// </summary>
 public void LoadConfiguration()
 {
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
       {
     soundOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound);
     soundOutputDevice.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0);
     audioChannels.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default);
     audioDelayStep.Value = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100);
     passthroughAC3_DTS.Checked = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false);
     audioNormalize.Checked = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false);
       }
 }
Exemplo n.º 4
0
 /// <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);
     }
 }
Exemplo n.º 5
0
 /// <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);
       }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Loads the configuration of this section
 /// </summary>
 public void LoadConfiguration()
 {
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
     {
         soundOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound);
         soundOutputDevice.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0);
         audioChannels.SelectedIndex     = xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default);
         audioDelayStep.Value            = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100);
         passthroughAC3_DTS.Checked      = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false);
         audioNormalize.Checked          = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false);
     }
 }
Exemplo n.º 7
0
 /// <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);
       }
 }
Exemplo n.º 8
0
 /// <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);
     }
 }
Exemplo n.º 9
0
        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 static void LoadSettings()
        {
            AutoSearch        = true;
            ApproveIfOne      = false;
            ApproveForNearest = false;
            NearestFactor     = 20;

            try
            {
                logger.Debug("Load settings from: " + ConfigFilename);
                #region Load settings
                using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, ConfigFilename)))
                {
                    AutoSearch        = xmlreader.GetValueAsBool("Fetcher", "AutoSearch", AutoSearch);
                    ApproveIfOne      = xmlreader.GetValueAsBool("Fetcher", "ApproveIfOne", ApproveIfOne);
                    ApproveForNearest = xmlreader.GetValueAsBool("Fetcher", "ApproveForNearest", ApproveForNearest);
                    NearestFactor     = xmlreader.GetValueAsInt("Fetcher", "NearestFactor", NearestFactor);
                }
                #endregion
                logger.Debug("Load settings from: " + ConfigFilename + " complete.");
            }
            catch (Exception ex)
            {
                logger.Error("LoadSettings: " + ex);
            }

            #region Report Settings
            logger.Debug("Importer: " + Check(ApproveIfOne) + " If one, " + Check(ApproveForNearest) + " Nearest <= " + NearestFactor);
            #endregion
        }
Exemplo n.º 11
0
    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();
      }

    }
Exemplo n.º 12
0
        /// <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();
        }
Exemplo n.º 13
0
 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();
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Loads the configuration of this section
 /// </summary>
 public void LoadConfiguration()
 {
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
       {
     VideoOutputDriver videoOutputDriverStandardValue = VideoOutputDriver.DirectX;
     if (OSInfo.OSInfo.OSList.WindowsVista == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows2008 == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows7 == OSInfo.OSInfo.GetOSName())
     {
       videoOutputDriverStandardValue = VideoOutputDriver.Direct3D;
     }
     videoOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)videoOutputDriverStandardValue);
     postProcessing.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum);
     aspectRatio.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic);
     deinterlace.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive);
     noiseDenoise.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing);
     framedrop.Checked = xmlreader.GetValueAsBool("mplayer", "framedrop", false);
     directRendering.Checked = xmlreader.GetValueAsBool("mplayer", "directRendering", true);
     doubleBuffering.Checked = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true);
       }
 }
Exemplo n.º 15
0
        /// <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);
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Loads the configuration of this section
 /// </summary>
 public void LoadConfiguration()
 {
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
     {
         VideoOutputDriver videoOutputDriverStandardValue = VideoOutputDriver.DirectX;
         if (OSInfo.OSInfo.OSList.WindowsVista == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows2008 == OSInfo.OSInfo.GetOSName() || OSInfo.OSInfo.OSList.Windows7 == OSInfo.OSInfo.GetOSName())
         {
             videoOutputDriverStandardValue = VideoOutputDriver.Direct3D;
         }
         videoOutputDriver.SelectedIndex = xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)videoOutputDriverStandardValue);
         postProcessing.SelectedIndex    = xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum);
         aspectRatio.SelectedIndex       = xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic);
         deinterlace.SelectedIndex       = xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive);
         noiseDenoise.SelectedIndex      = xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing);
         framedrop.Checked       = xmlreader.GetValueAsBool("mplayer", "framedrop", false);
         directRendering.Checked = xmlreader.GetValueAsBool("mplayer", "directRendering", true);
         doubleBuffering.Checked = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true);
     }
 }
Exemplo n.º 17
0
 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;
       }
 }
Exemplo n.º 18
0
        private void displayDeviceSettings()
        {
            using (var xmlReader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MQTTPlugin.xml")))
            {
                WindowChange_checkBox.Checked = xmlReader.GetValueAsBool(MQTTPlugin.PLUGIN_NAME, "WindowChange", true);
                mediaDuration_textBox.Text    = (xmlReader.GetValueAsInt(MQTTPlugin.PLUGIN_NAME, "SetLevelForMediaDuration", 10)).ToString();

                host_textBox.Text     = xmlReader.GetValueAsString(MQTTPlugin.BROKER, "Host", string.Empty);
                port_textBox.Text     = xmlReader.GetValueAsString(MQTTPlugin.BROKER, "Port", "1883");
                user_textBox.Text     = xmlReader.GetValueAsString(MQTTPlugin.BROKER, "User", string.Empty);
                password_textBox.Text = DPAPI.DecryptString(xmlReader.GetValueAsString(MQTTPlugin.BROKER, "Password", string.Empty));

                debug_checkBox.Checked = xmlReader.GetValueAsBool(MQTTPlugin.PLUGIN_NAME, "DebugMode", false);
            }
        }
 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();
     }
 }
        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 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");
        }
Exemplo n.º 22
0
        public static void Load(string section)
        {
            smcLog.WriteLog(string.Format("StreamedMPConfig: Settings.Load({0})", section), LogLevel.Info);
              using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "StreamedMPConfig.xml")))
              {
            // Read user settings from configuration file
            switch (section)
            {
              #region Update
              case settings.cXMLSectionUpdate:
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateCheckOnStart, 1) != 0)
              StreamedMPConfig.checkOnStart = true;
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateCheckForUpdateAt, 1) != 0)
              StreamedMPConfig.checkForUpdateAt = true;
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateRunPatchUtilityUnattended, 1) != 0)
              StreamedMPConfig.patchUtilityRunUnattended = true;
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdatePatchUtilityRestartMP, 1) != 0)
              StreamedMPConfig.patchUtilityRestartMP = true;
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdatePatchAppliedLastRun, 0) != 0)
              StreamedMPConfig.patchAppliedLastRun = true;

            if (StreamedMPConfig.checkForUpdateAt)
            {
              string checkTime = xmlreader.GetValueAsString(section, settings.cXMLSettingUpdateCheckTime, "");

              if (string.IsNullOrEmpty(checkTime))
              {
                StreamedMPConfig.checkTime = DateTime.Parse("03:00");
                StreamedMPConfig.checkInterval = 1;
              }
              else
              {
                DateTime dtCheckTime = new DateTime();
                if (!DateTime.TryParse(checkTime, CultureInfo.CurrentCulture, DateTimeStyles.None, out dtCheckTime))
                  dtCheckTime = DateTime.Now;
                StreamedMPConfig.checkTime = dtCheckTime;

                StreamedMPConfig.nextUpdateCheck = xmlreader.GetValueAsString(section, settings.cXMLSettingUpdateNextUpdateCheck, "");
                StreamedMPConfig.checkInterval = xmlreader.GetValueAsInt(section, settings.cXMLSettingUpdateCheckInterval, 1);
              }
            }
            break;
              #endregion

              #region Music
              case settings.cXMLSectionMusic:
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingMusicCdCoverOnly, 1) != 0)
              MusicOptionsGUI.cdCoverOnly = true;
            if (xmlreader.GetValueAsInt(section, settings.cXMLSettingMusicShowEqGraphic, 1) != 0)
              MusicOptionsGUI.showEqGraphic = true;
            MusicOptionsGUI.nowPlayingStyle = (MusicOptionsGUI.NowPlayingStyles)xmlreader.GetValueAsInt(section, settings.cXMLSettingNowPlayingStyle, 0);
            break;
              #endregion

              #region TVSeries
              case settings.cXMLSectionTVSeries:
            TVSeriesConfig.IsDefaultStyle = xmlreader.GetValueAsInt(section, settings.cXMLSettingTVSeriesDefaultStyle, 1) == 1;
            TVSeriesConfig.WideBannerMod = (TVSeriesConfig.WideBanners)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVSeriesWideBannerMod, 0);
            break;
              #endregion

              #region MovingPictures
              case settings.cXMLSectionMovingPictures:
            MovingPicturesConfig.IsDefaultStyle = xmlreader.GetValueAsInt(section, settings.cXMLSettingMovingPicturesDefaultStyle, 1) == 1;
            MovingPicturesConfig.ThumbnailMod = (MovingPicturesConfig.Thumbnails)xmlreader.GetValueAsInt(section, settings.cXMLSettingMovingPicturesThumbMod, 0);
            MovingPicturesConfig.ShowMovPicsTaglineInDetails = xmlreader.GetValueAsInt(section, settings.cXMLSettingMovingPicturesTagline, 1) == 1;
            break;
              #endregion

              #region TV
              case settings.cXMLSectionTV:
            TVConfig.TVGuideRowSize = (TVConfig.TVGuideRows)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVGuideSize, 10);
            TVConfig.TVMiniGuideRowSize = (TVConfig.TVMiniGuideRows)xmlreader.GetValueAsInt(section, settings.cXMLSettingTVMiniGuideSize, 7);
            TVConfig.EnableRandomTVSeriesFanart = xmlreader.GetValueAsInt(section, settings.cXMLSettingTVEnableRandomTVSeriesFanart, 0) == 1;
            break;
              #endregion

              #region Video
              case settings.cXMLSectionVideo:
            VideoOptionsGUI.FullVideoOSD = xmlreader.GetValueAsInt(section, settings.cXMLSettingVideoFullVideoOSD, 1) == 1;
            break;
              #endregion

              #region Misc
              case settings.cXMLSectionMisc:
            MiscConfigGUI.ShowHiddenMenuImage = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowHiddenMenuImage, 1) == 1;
            MiscConfigGUI.ShowRoundedImages = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowRoundedCovers, 0) == 1;
            MiscConfigGUI.ShowIconsInArtwork = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowIconsInArtwork, 1) == 1;
            MiscConfigGUI.ShowTraktStyleIconsInArtwork = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowTraktStyleIconsInArtwork, 1) == 1;
            MiscConfigGUI.EnablePlayMostRecents = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscEnablePlayMostRecents, 1) == 1;
            MiscConfigGUI.FilterWatchedInRecentlyAdded = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscFilterWatchedInRecentlyAdded, 0) == 1;
            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, "808080");
            MiscConfigGUI.RemoteColor = xmlreader.GetValueAsString(section, settings.cXMLSettingMiscRemoteColor, "FFA075");
            MiscConfigGUI.UnfocusedAlphaListItems = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUnfocusedAlphaListItems, 100);
            MiscConfigGUI.UnfocusedAlphaThumbs = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUnfocusedAlphaThumbs, 100);
            MiscConfigGUI.MostRecentFanartTimerInt = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscMostRecentFanartTimerInt, 7);
            MiscConfigGUI.UseLargeFonts = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscUseLargeFonts, 0) == 1;
            MiscConfigGUI.ShowListScrollingPopup = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscShowListScrollingPopup, 1) == 1;
            MiscConfigGUI.TextualLogos = xmlreader.GetValueAsInt(section, settings.cXMLSettingMiscTextualLogos, 1) == 1;
            MiscConfigGUI.MyVideoWatchedProgress = xmlreader.GetValueAsInt(section, settings.cXMLSettingMyVideoWatchedProgress, 0) == 1;
            break;
              #endregion

            }
              }
        }
Exemplo n.º 23
0
        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);
            }
        }
Exemplo n.º 24
0
        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
                }
            }
        }
Exemplo n.º 25
0
        /// <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();
        }
Exemplo n.º 26
0
 int _logLevel()
 {
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
       {
     return xmlreader.GetValueAsInt("general", "loglevel", 0);
       }
 }
Exemplo n.º 27
0
        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;
        }
Exemplo n.º 28
0
        private void InitLogger()
        {
            if (loggerInitialized)
            {
                return;
            }
            loggerInitialized = true;

            string logFileName    = "pandoramusicbox.log";
            string oldLogFileName = "pandoramusicBox.old.log";

            // backup the current log file and clear for the new one
            try {
                FileInfo logFile = new FileInfo(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logFileName));
                if (logFile.Exists)
                {
                    if (File.Exists(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, oldLogFileName)))
                    {
                        File.Delete(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, oldLogFileName));
                    }

                    logFile.CopyTo(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, oldLogFileName));
                    logFile.Delete();
                }
            }
            catch (Exception) { }

            // if no configuration exists go ahead and create one
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            // build the logging target for pandora music box logging
            FileTarget musicBoxLogTarget = new FileTarget();

            musicBoxLogTarget.Name     = "pandora-musicbox";
            musicBoxLogTarget.FileName = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logFileName);
            musicBoxLogTarget.Layout   = "${date:format=dd-MMM-yyyy HH\\:mm\\:ss} " +
                                         "${level:fixedLength=true:padding=5} " +
                                         "[${logger:fixedLength=true:padding=20:shortName=true}]: ${message} " +
                                         "${exception:format=tostring}";
            LogManager.Configuration.AddTarget("pandora-musicbox", musicBoxLogTarget);

            // Get current Log Level from MediaPortal
            LogLevel logLevel;

            MediaPortal.Profile.Settings xmlreader = MediaPortalSettings;
            switch ((Level)xmlreader.GetValueAsInt("general", "loglevel", 0))
            {
            case Level.Error:
                logLevel = LogLevel.Error;
                break;

            case Level.Warning:
                logLevel = LogLevel.Warn;
                break;

            case Level.Information:
                logLevel = LogLevel.Info;
                break;

            case Level.Debug:
            default:
                logLevel = LogLevel.Debug;
                break;
            }

            // always log in debug mode if the plugin was compiled in debug mode
            #if DEBUG
            logLevel = LogLevel.Debug;
            #endif

            // set the logging rules for pandora musicbox logging
            LoggingRule musicboxRule = new LoggingRule("PandoraMusicBox.*", logLevel, musicBoxLogTarget);
            LogManager.Configuration.LoggingRules.Add(musicboxRule);

            // force NLog to reload the configuration data
            LogManager.Configuration = LogManager.Configuration;
        }
Exemplo n.º 29
0
        // Initializes the logging system.
        private static void InitLogger(RichTextBox rtb)
        {
            // backup the current log file and clear for the new one
            try
            {
                FileInfo logFile = new FileInfo(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logFileName));
                if (logFile.Exists)
                {
                    if (File.Exists(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, oldLogFileName)))
                    {
                        File.Delete(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, oldLogFileName));
                    }

                    logFile.CopyTo(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, oldLogFileName));
                    logFile.Delete();
                }
            }
            catch (Exception) { }

            // if no configuration exists go ahead and create one
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            // build the logging target for music videos logging
            FileTarget mvLogTarget = new FileTarget();

            mvLogTarget.Name     = "mvCentral";
            mvLogTarget.FileName = MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Log, logFileName);
            mvLogTarget.Layout   = "${date:format=dd-MMM-yyyy HH\\:mm\\:ss} " +
                                   "${level:fixedLength=true:padding=5} " +
                                   "[${logger:fixedLength=true:padding=20:shortName=true}]: ${message} " +
                                   "${exception:format=tostring}";

            LogManager.Configuration.AddTarget("mvCentral", mvLogTarget);

            // Get current Log Level from MediaPortal
            LogLevel logLevel;

            MediaPortal.Profile.Settings xmlreader = MediaPortalSettings;
            switch ((Level)xmlreader.GetValueAsInt("general", "loglevel", 0))
            {
            case Level.Error:
                logLevel = LogLevel.Error;
                break;

            case Level.Warning:
                logLevel = LogLevel.Warn;
                break;

            case Level.Information:
                logLevel = LogLevel.Info;
                break;

            case Level.Debug:
            default:
                logLevel = LogLevel.Debug;
                break;
            }

#if DEBUG
            logLevel = LogLevel.Debug;
#endif



            // set the logging rules for Music Videos logging
            LoggingRule mvRule          = new LoggingRule("mvCentral.*", logLevel, mvLogTarget);
            LoggingRule CornerstoneRule = new LoggingRule("Cornerstone.*", logLevel, mvLogTarget);

            LogManager.Configuration.LoggingRules.Add(mvRule);
            LogManager.Configuration.LoggingRules.Add(CornerstoneRule);

            // force NLog to reload the configuration data
            LogManager.Configuration = LogManager.Configuration;
        }
Exemplo n.º 30
0
        public override bool Init()
        {
            m_localControlForInvoke = new Control();
            m_localControlForInvoke.CreateControl();

            MPTVSeriesLog.Write("**** Plugin started in MediaPortal ****");
            DBOption.LogOptions();

            #region Translations
            Translation.Init();

            // Push Translated Strings to skin
            MPTVSeriesLog.Write("Setting translated strings: ", MPTVSeriesLog.LogLevel.Debug);
            string propertyName = string.Empty;
            string propertyValue = string.Empty;
            foreach (string name in Translation.Strings.Keys)
            {
                propertyName = "#TVSeries.Translation." + name + ".Label";
                propertyValue = Translation.Strings[name];
                MPTVSeriesLog.Write(propertyName + " = " + propertyValue, MPTVSeriesLog.LogLevel.Debug);
                GUIPropertyManager.SetProperty(propertyName, propertyValue);
            }
            #endregion

            #region Misc
            m_VideoHandler = new VideoHandler();
            m_VideoHandler.RateRequestOccured += new VideoHandler.rateRequest(m_VideoHandler_RateRequestOccured);

            // Setup Random Fanart Timer
            m_FanartTimer = new System.Threading.Timer(new TimerCallback(FanartTimerEvent), null, Timeout.Infinite, Timeout.Infinite);
            m_bFanartTimerDisabled = true;

            // Lock for Parental Control
            logicalView.IsLocked = true;
            // Timer to reset Locked Status
            if (!string.IsNullOrEmpty(DBOption.GetOptions(DBOption.cParentalControlPinCode)))
            {
                long interval = DBOption.GetOptions(DBOption.cParentalControlResetInterval) * 60 * 1000;
                m_ParentalControlTimer = new System.Threading.Timer(new TimerCallback(ParentalControlTimerEvent), null, 0, interval);
            }

            // Check if MediaPortal will Show TVSeries Plugin when restarting
            // We need to do this because we may need to show a modal dialog e.g. PinCode and we can't do this if MediaPortal window is not yet ready
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                m_bShowLastActiveModule = xmlreader.GetValueAsBool("general", "showlastactivemodule", false);
                m_iLastActiveModule = xmlreader.GetValueAsInt("general", "lastactivemodule", -1);
            }

            #endregion

            #region Initialize Importer
            m_parserUpdater = new OnlineParsing(this);
            OnlineParsing.OnlineParsingProgress += new OnlineParsing.OnlineParsingProgressHandler(parserUpdater_OnlineParsingProgress);
            OnlineParsing.OnlineParsingCompleted += new OnlineParsing.OnlineParsingCompletedHandler(parserUpdater_OnlineParsingCompleted);

            System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged;
            Microsoft.Win32.SystemEvents.PowerModeChanged += new Microsoft.Win32.PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);

            // Setup Importer
            InitImporter();
            #endregion

            #region Skin Settings / Load
            SkinSettings.Init();

            // listen to this event to detect skin/language changes in GUI
            GUIWindowManager.OnDeActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnDeActivateWindow);

            GUIWindowManager.OnActivateWindow += new GUIWindowManager.WindowActivationHandler(GUIWindowManager_OnActivateWindow);

            String xmlSkin = GUIGraphicsContext.Skin + @"\TVSeries.xml";
            MPTVSeriesLog.Write("Loading main skin window: " + xmlSkin);
            return Load(xmlSkin);
            #endregion
        }
Exemplo n.º 31
0
        /// <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);
              }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Adds a section of MP shares
        /// </summary>
        /// <param name="section">Name of the section</param>
        private void AddSection(String section)
        {
            Share defaultshare = null;
              using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
              {
            string strDefault = xmlreader.GetValueAsString(section, "default", String.Empty);
            for (int i = 0; i < 20; i++)
            {
              string strShareName = String.Format("sharename{0}", i);
              string strSharePath = String.Format("sharepath{0}", i);
              string strPincode = String.Format("pincode{0}", i);

              string shareType = String.Format("sharetype{0}", i);
              string shareServer = String.Format("shareserver{0}", i);
              string shareLogin = String.Format("sharelogin{0}", i);
              string sharePwd = String.Format("sharepassword{0}", i);
              string sharePort = String.Format("shareport{0}", i);
              string remoteFolder = String.Format("shareremotepath{0}", i);
              string shareViewPath = String.Format("shareview{0}", i);

              Share share = new Share
                          {
                            Name = xmlreader.GetValueAsString(section, strShareName, String.Empty),
                            Path = xmlreader.GetValueAsString(section, strSharePath, String.Empty)
                          };

              share.Pincode = Utils.DecryptPin(xmlreader.GetValueAsString(section, strPincode, string.Empty));
              share.IsFtpShare = xmlreader.GetValueAsBool(section, shareType, false);
              share.FtpServer = xmlreader.GetValueAsString(section, shareServer, String.Empty);
              share.FtpLoginName = xmlreader.GetValueAsString(section, shareLogin, String.Empty);
              share.FtpPassword = xmlreader.GetValueAsString(section, sharePwd, String.Empty);
              share.FtpPort = xmlreader.GetValueAsInt(section, sharePort, 21);
              share.FtpFolder = xmlreader.GetValueAsString(section, remoteFolder, "/");
              share.DefaultLayout = (GUIFacadeControl.Layout)xmlreader.GetValueAsInt(section, shareViewPath, (int)GUIFacadeControl.Layout.List);

              if (share.Name.Length > 0)
              {

            if (strDefault == share.Name)
            {
              share.Default = true;
              if (defaultshare == null)
              {
                defaultshare = share;
              }
            }

            if (!_sharePaths.Contains(share.Path.ToLower()))
            {
              _sharePaths.Add(share.Path.ToLower());
              _mDirectory.Add(share);
            }
              }
              else
            break;
            }
              }
        }
Exemplo n.º 33
0
        /// <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);
        }
Exemplo n.º 34
0
        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>
        /// Setup logger. This funtion made by the team behind Moving Pictures
        /// (http://code.google.com/p/moving-pictures/)
        /// </summary>
        private void InitLogger()
        {
            //LoggingConfiguration config = new LoggingConfiguration();
            LoggingConfiguration config = LogManager.Configuration ?? new LoggingConfiguration();

            try
            {
                FileInfo logFile = new FileInfo(Config.GetFile(Config.Dir.Log, LogFileName));
                if (logFile.Exists)
                {
                    if (File.Exists(Config.GetFile(Config.Dir.Log, OldLogFileName)))
                    {
                        File.Delete(Config.GetFile(Config.Dir.Log, OldLogFileName));
                    }

                    logFile.CopyTo(Config.GetFile(Config.Dir.Log, OldLogFileName));
                    logFile.Delete();
                }
            }
            catch (Exception)
            {
            }

            FileTarget fileTarget = new FileTarget();

            fileTarget.FileName = Config.GetFile(Config.Dir.Log, LogFileName);
            fileTarget.Encoding = "utf-8";
            fileTarget.Layout   = "${date:format=dd-MMM-yyyy HH\\:mm\\:ss} " +
                                  "${level:fixedLength=true:padding=5} " +
                                  "[${logger:fixedLength=true:padding=20:shortName=true}]: ${message} " +
                                  "${exception:format=tostring}";

            config.AddTarget("latestmedia-handler", fileTarget);

            // Get current Log Level from MediaPortal
            LogLevel logLevel;

            MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));

            switch ((Level)xmlreader.GetValueAsInt("general", "loglevel", 0))
            {
            case Level.Error:
                logLevel = LogLevel.Error;
                break;

            case Level.Warning:
                logLevel = LogLevel.Warn;
                break;

            case Level.Information:
                logLevel = LogLevel.Info;
                break;

            case Level.Debug:
            default:
                logLevel = LogLevel.Debug;
                break;
            }

#if DEBUG
            logLevel = LogLevel.Debug;
#endif

            LoggingRule rule = new LoggingRule("*", logLevel, fileTarget);
            config.LoggingRules.Add(rule);

            LogManager.Configuration = config;
        }
        public void LoadSettings()
        {
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                string section = ConfigSection;

                Extensions =
                    xmlreader.GetValueAsString(section, PropNames.Extensions, Defaults.Extensions);

                SeekIncrement =
                    xmlreader.GetValueAsInt(section, PropNames.SeekIncrement, Defaults.SeekIncrement);

                UseForCDDA =
                    xmlreader.GetValueAsBool(section, PropNames.UseForCDDA, Defaults.UseForCDDA);

                UseForWebStream =
                    xmlreader.GetValueAsBool(section, PropNames.UseForWebStream, Defaults.UseForWebStream);
            }
        }
Exemplo n.º 37
0
        /// <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);
              }
        }
Exemplo n.º 38
0
        public void Start()
        {
            //InitMostRecents();

            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                myskin = xmlreader.GetValueAsString("skin", "name", "");
                //mousecontrol = xmlreader.GetValueAsString("general", "mousesupport", "");
            }

            // Check to see if Avalon is the selected skin (halt plugin if not)
            if (myskin.IndexOf("Avalon") != -1)
            {
                Log.Info("Avalon BasicHome plugin: Skin found");
                //Skin is Avalon, continue

                // Load settings and set the default item
                if (!File.Exists(Config.GetFile(Config.Dir.Config, "Avalon.xml")))
                {
                    Log.Info("Avalon BasicHome plugin: Config-file Avalon.xml not found.");
                    Stop();
                }
                else
                {

                    using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "Avalon.xml")))
                    {
                        string mytest = xmlreader.GetValueAsString("AvalonBasicHome", "menuItemName0", "");
                        if (mytest.Length > 0)
                        {

                            int a = 0;
                            var submenus = new Object[250, 3];
                            do
                            {

                                mytest = xmlreader.GetValueAsString("AvalonBasicHome", "menuItemName" + a, "");
                                if (mytest != "")
                                {
                                    ms_headings.Add(xmlreader.GetValueAsString("AvalonBasicHome", "menuItemName" + a, ""));
                                    ms_windowids.Add(xmlreader.GetValueAsInt("AvalonBasicHome", "menuItemHyperlink" + a, 0));

                                    if (xmlreader.GetValueAsString("AvalonBasicHome", "menuItemBgImage" + a, "").Contains("jpg") || xmlreader.GetValueAsString("AvalonBasicHome", "menuItemBgImage" + a, "").Contains("png"))
                                    {
                                        ms_bgimages.Add("BasicHomeBG/" + xmlreader.GetValueAsString("AvalonBasicHome", "menuItemBgImage" + a, ""));
                                    }
                                    else
                                    {
                                        ms_bgimages.Add(xmlreader.GetValueAsString("AvalonBasicHome", "menuItemBgImage" + a, ""));
                                    }

                                    ms_window_params.Add(xmlreader.GetValueAsString("AvalonBasicHome", "menuItemParameter" + a, ""));
                                    ms_recentMedia.Add(xmlreader.GetValueAsString("AvalonBasicHome", "menuItemRecentMedia" + a, ""));

                                    int b = 0;
                                    do
                                    {
                                        //Read submenu
                                        if (xmlreader.GetValueAsString("AvalonBasicHomeSubmenu" + a, "submenuItemName" + b, "") != "")
                                        {
                                            //Log.Info("found some submenus, :" + a + ", " + b + "navn: " + xmlreader.GetValueAsString("AvalonBasicHomeSubmenu" + a, "submenuItemName" + b, ""));
                                            Children.Add(new Child(a, b, xmlreader.GetValueAsString("AvalonBasicHomeSubmenu" + a, "submenuItemName" + b, ""), xmlreader.GetValueAsInt("AvalonBasicHomeSubmenu" + a, "submenuItemHyperlink" + b, 0), xmlreader.GetValueAsString("AvalonBasicHomeSubmenu" + a, "submenuItemParameter" + b, "")));
                                        }
                                        b++;
                                    } while (b < 250);

                                }
                                a++;
                            } while (a < 25);

                            SetNeighbours(0, ms_headings.Count - 1);
                            SetSubmenu(0);
                            if (ms_headings.Count > 0)
                            {
                                SetProperty("#bgimage1", ms_bgimages[0]);
                                SetProperty("#bgimage2", ms_bgimages[0]);
                                GUIControl.SetControlLabel(35, 801, ms_headings[0]);
                                GUIControl.SetControlLabel(35, 802, ms_headings[0]);
                                GUIControl.SetControlLabel(35, 901, ms_headings[0]);
                                GUIControl.SetControlLabel(35, 902, ms_headings[0]);
                                SetProperty("#homeitem", ms_headings[0]);
                                SetProperty("#recentMedia", ms_recentMedia[0]);
                            }

                        }
                        else
                        {
                            Log.Info("Avalon plugin: No menuitems configured");
                            Stop();
                        }
                        GUIGraphicsContext.OnNewAction += new OnActionHandler(AvalonAction);
                        GUIPropertyManager.OnPropertyChanged += new GUIPropertyManager.OnPropertyChangedHandler(GUIPropertyManager_OnPropertyChanged);

                    }
                }
            }
        }
Exemplo n.º 39
0
        /// <summary>
        /// Load the settings from the mediaportal config
        /// </summary>
        public static void Load()
        {
            using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml"))) {
                username = reader.GetValue(Helper.PLUGIN_NAME, "username");
                server   = reader.GetValue(Helper.PLUGIN_NAME, "server");
                string tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "resource");
                if (!String.IsNullOrEmpty(tmpSettingsString))
                {
                    resource = tmpSettingsString;
                }
                string encryptedPassword = reader.GetValue(Helper.PLUGIN_NAME, "password");
                password                 = decryptString(encryptedPassword);
                autoConnectStartup       = reader.GetValueAsBool(Helper.PLUGIN_NAME, "autoConnectStartup", autoConnectStartup);
                notifyOnMessagePlugin    = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMessagePlugin", notifyOnMessagePlugin);
                notifyOnMessageGlobally  = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMessageGlobally", notifyOnMessageGlobally);
                notifyOnStatusPlugin     = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnStatusPlugin", notifyOnStatusPlugin);
                notifyOnStatusGlobally   = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnStatusGlobally", notifyOnStatusGlobally);
                notifyOnMoodPlugin       = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMoodPlugin", notifyOnMoodPlugin);
                notifyOnMoodGlobally     = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnMoodGlobally", notifyOnMoodGlobally);
                notifyOnActivityPlugin   = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnActivityPlugin", notifyOnActivityPlugin);
                notifyOnActivityGlobally = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnActivityGlobally", notifyOnActivityGlobally);
                notifyOnTunePlugin       = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnTunePlugin", notifyOnTunePlugin);
                notifyOnTuneGlobally     = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnTuneGlobally", notifyOnTuneGlobally);
                notifyOnErrorPlugin      = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnErrorPlugin", notifyOnErrorPlugin);
                notifyOnErrorGlobally    = reader.GetValueAsBool(Helper.PLUGIN_NAME, "notifyOnErrorGlobally", notifyOnErrorGlobally);
                selectStatusOnStartup    = reader.GetValueAsBool(Helper.PLUGIN_NAME, "selectStatusOnStartup", selectStatusOnStartup);
                notifyTimeOut            = reader.GetValueAsInt(Helper.PLUGIN_NAME, "notifyTimeOut", notifyTimeOut);
                autoIdleTimeOut          = reader.GetValueAsInt(Helper.PLUGIN_NAME, "autoIdleTimeOut", autoIdleTimeOut);
                autoIdleStatusType       = (Enums.StatusType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "autoIdleStatusType", (int)autoIdleStatusType);
                tmpSettingsString        = reader.GetValue(Helper.PLUGIN_NAME, "autoIdleStatusMessage");
                if (!String.IsNullOrEmpty(tmpSettingsString))
                {
                    autoIdleStatusMessage = tmpSettingsString;
                }
                defaultStatusType = (Enums.StatusType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultStatusType", (int)defaultStatusType);
                tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "defaultStatusMessage");
                if (!String.IsNullOrEmpty(tmpSettingsString))
                {
                    defaultStatusMessage = tmpSettingsString;
                }
                defaultMoodType   = (Enums.MoodType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultMoodType", (int)defaultMoodType);
                tmpSettingsString = reader.GetValue(Helper.PLUGIN_NAME, "defaultMoodMessage");
                if (!String.IsNullOrEmpty(tmpSettingsString))
                {
                    defaultMoodMessage = tmpSettingsString;
                }
                defaultActivityType = (Enums.ActivityType)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultActivityType", (int)defaultActivityType);
                tmpSettingsString   = reader.GetValue(Helper.PLUGIN_NAME, "defaultActivityMessage");
                if (!String.IsNullOrEmpty(tmpSettingsString))
                {
                    defaultActivityMessage = tmpSettingsString;
                }
                notifyWindowType    = (Helper.PLUGIN_NOTIFY_WINDOWS)reader.GetValueAsInt(Helper.PLUGIN_NAME, "notifyWindowType", (int)notifyWindowType);
                defaultKeyboardType = (Dialog.KeyBoardTypes)reader.GetValueAsInt(Helper.PLUGIN_NAME, "defaultKeyboardType", (int)Dialog.KeyBoardTypes.Default);

                publishTuneInfo          = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishTuneInfo", publishTuneInfo);
                publishActivityMusic     = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityMusic", publishActivityMusic);
                publishActivityRadio     = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityRadio", publishActivityRadio);
                publishActivityMovie     = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityMovie", publishActivityMovie);
                publishActivityTV        = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityTV", publishActivityTV);
                publishActivityRecording = reader.GetValueAsBool(Helper.PLUGIN_NAME, "publishActivityRecording", publishActivityRecording);
            }
        }
        protected override void OnPageLoad()
        {
            base.OnPageLoad();
              if (string.IsNullOrEmpty(playlistname))
              {
            GUIPropertyManager.SetProperty("#currentmodule", "Playlist");
              }
              else
              {
            GUIPropertyManager.SetProperty("#currentmodule", "Playlist/" + playlistname);
              }
              _playlistType = PlayListType.PLAYLIST_MUSIC_VIDEO;

              currentView = View.PlayList;
              facadeView.CurrentLayout = GUIFacadeControl.Layout.Playlist;

              LoadDirectory(string.Empty);
              if (m_iItemSelected >= 0)
              {
            GUIControl.SelectItemControl(GetID, facadeView.GetID, m_iItemSelected);
              }
              if ((m_iLastControl == facadeView.GetID) && facadeView.Count <= 0)
              {
            m_iLastControl = btnNowPlaying.GetID;
            GUIControl.FocusControl(GetID, m_iLastControl);
              }
              if (facadeView.Count <= 0)
              {
            GUIControl.FocusControl(GetID, btnViewAs.GetID);
              }

              using (MediaPortal.Profile.Settings settings = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
              {
            playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("youtubeplaylist", "repeat", true);
            ScrobblerOn = settings.GetValueAsBool("youtubeplaylist", "ScrobblerOn", true);
            currentScrobbleMode =(ScrobbleMode) settings.GetValueAsInt("youtubeplaylist", "ScrobblerMode", 0);
              }

              if (btnRepeatPlaylist != null)
              {
            btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist;
              }
              if (ScrobblerOn)
            btnScrobble.Selected = true;

              SetScrobbleButonLabel();
              SelectCurrentPlayingSong();
        }
 public 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();
 }
Exemplo n.º 42
0
        /// <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);
        }