Exemplo n.º 1
0
 /// <summary>
 /// Loads the configuration with the shares
 /// </summary>
 public void LoadConfiguration()
 {
     try
       {
     XmlDocument doc = new XmlDocument();
     string path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml");
     doc.Load(path);
     if (doc.DocumentElement != null)
     {
       XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share");
       if (listShare != null)
     foreach (XmlNode nodeShare in listShare)
     {
       MPlayerShare share = new MPlayerShare
                               {
                                 Name = nodeShare.Attributes["name"].Value,
                                 Path = nodeShare.Attributes["path"].Value
                               };
       shareList.Items.Add(share);
     }
     }
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
     {
       pluginName.Text = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer GUI");
       myVideoShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true);
       myMusicShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true);
       playlistFolder.Checked = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false);
       dvdNavCheckbox.Checked = xmlreader.GetValueAsBool("mplayer", "useDVDNAV", false);
     }
       }
       catch (Exception e)
       {
     Log.Info("MPlayer GUI Error: Configuration could not be loaded: " + e.Message);
       }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Selected index change on the share list
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event Arguments</param>
        private void ShareListSelectedIndexChanged(object sender, EventArgs e)
        {
            if (_lastShare != null)
            {
                _lastShare.Path = shareLocation.Text;
            }

            if (shareList.SelectedIndex > -1)
            {
                _lastShare = shareList.SelectedItem as MPlayerShare;
                if (_lastShare != null)
                {
                    shareName.Text     = _lastShare.Name;
                    shareLocation.Text = _lastShare.Path;
                }
                shareName.Enabled     = true;
                shareLocation.Enabled = true;
            }
            else
            {
                shareName.Text        = String.Empty;
                shareLocation.Text    = String.Empty;
                shareName.Enabled     = false;
                shareLocation.Enabled = false;
                _lastShare            = null;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the Add-Button click event
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event Arguments</param>
        private void ShareAddClick(object sender, EventArgs e)
        {
            MPlayerShare temp = new MPlayerShare {
                Name = "NewLocation"
            };

            shareList.Items.Add(temp);
            shareList.SelectedItem = temp;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Loads the configuration with the shares
 /// </summary>
 public void LoadConfiguration()
 {
     try
     {
         XmlDocument doc  = new XmlDocument();
         string      path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml");
         doc.Load(path);
         if (doc.DocumentElement != null)
         {
             XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share");
             if (listShare != null)
             {
                 foreach (XmlNode nodeShare in listShare)
                 {
                     MPlayerShare share = new MPlayerShare
                     {
                         Name = nodeShare.Attributes["name"].Value,
                         Path = nodeShare.Attributes["path"].Value
                     };
                     shareList.Items.Add(share);
                 }
             }
         }
         using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
         {
             pluginName.Text        = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer GUI");
             myVideoShare.Checked   = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true);
             myMusicShare.Checked   = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true);
             playlistFolder.Checked = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false);
             dvdNavCheckbox.Checked = xmlreader.GetValueAsBool("mplayer", "useDVDNAV", false);
         }
     }
     catch (Exception e)
     {
         Log.Info("MPlayer GUI Error: Configuration could not be loaded: " + e.Message);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Stores the configuration with the shares
        /// </summary>
        public void SaveConfiguration()
        {
            shareList.SelectedIndex = -1;
            XmlTextWriter writer = new XmlTextWriter(Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml"),
                                                     System.Text.Encoding.UTF8)
            {
                Formatting = Formatting.Indented, Indentation = 1, IndentChar = (char)9
            };

            writer.WriteStartDocument(true);
            writer.WriteStartElement("mplayergui"); //<mplayer>
            writer.WriteAttributeString("version", "1");
            for (int i = 0; i < shareList.Items.Count; i++)
            {
                MPlayerShare temp = shareList.Items[i] as MPlayerShare;
                writer.WriteStartElement("Share"); //<Share>
                if (temp != null)
                {
                    writer.WriteAttributeString("name", temp.Name);
                    writer.WriteAttributeString("path", temp.Path);
                }
                writer.WriteEndElement(); //</Share>
            }
            writer.WriteEndElement();     //</mplayer>
            writer.WriteEndDocument();
            writer.Close();
            using (MediaPortal.Profile.Settings xmlWriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                xmlWriter.SetValue("mplayer", "displayNameOfGUI",
                                   String.IsNullOrEmpty(pluginName.Text) ? "My MPlayer" : pluginName.Text);
                xmlWriter.SetValueAsBool("mplayer", "useMyMusicShares", myMusicShare.Checked);
                xmlWriter.SetValueAsBool("mplayer", "useMyVideoShares", myVideoShare.Checked);
                xmlWriter.SetValueAsBool("mplayer", "treatPlaylistAsFolders", playlistFolder.Checked);
                xmlWriter.SetValueAsBool("mplayer", "useDVDNAV", dvdNavCheckbox.Checked);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handles the Selected index change on the share list
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event Arguments</param>
        private void ShareListSelectedIndexChanged(object sender, EventArgs e)
        {
            if (_lastShare != null)
              {
            _lastShare.Path = shareLocation.Text;
              }

              if (shareList.SelectedIndex > -1)
              {
            _lastShare = shareList.SelectedItem as MPlayerShare;
            if (_lastShare != null)
            {
              shareName.Text = _lastShare.Name;
              shareLocation.Text = _lastShare.Path;
            }
            shareName.Enabled = true;
            shareLocation.Enabled = true;
              }
              else
              {
            shareName.Text = String.Empty;
            shareLocation.Text = String.Empty;
            shareName.Enabled = false;
            shareLocation.Enabled = false;
            _lastShare = null;
              }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Handles the Add-Button click event
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event Arguments</param>
 private void ShareAddClick(object sender, EventArgs e)
 {
     MPlayerShare temp = new MPlayerShare {Name = "NewLocation"};
       shareList.Items.Add(temp);
       shareList.SelectedItem = temp;
 }