• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Util.VirtualDirectory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MediaPortal.Util.VirtualDirectory的典型用法代码示例。如果您正苦于以下问题:C# VirtualDirectory类的具体用法?C# VirtualDirectory怎么用?C# VirtualDirectory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VirtualDirectory类属于MediaPortal.Util命名空间,在下文中一共展示了VirtualDirectory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LoadSettings

    protected override void LoadSettings()
    {
      base.LoadSettings();
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        currentLayout = (Layout) xmlreader.GetValueAsInt(SerializeName, "layout", (int) Layout.List);
        m_bSortAscending = xmlreader.GetValueAsBool(SerializeName, "sortasc", true);
        VideoState.StartWindow = xmlreader.GetValueAsInt("movies", "startWindow", GetID);
        VideoState.View = xmlreader.GetValueAsString("movies", "startview", "369");

        // Prevent unaccesible My Videos from corrupted config
        if (!IsVideoWindow(VideoState.StartWindow))
        {
          VideoState.StartWindow = GetID;
          VideoState.View = "369";
        }

        _addVideoFilesToDb = xmlreader.GetValueAsBool("gui", "addVideoFilesToDb", false);
        _isFuzzyMatching = xmlreader.GetValueAsBool("movies", "fuzzyMatching", false);
        _scanSkipExisting = xmlreader.GetValueAsBool("moviedatabase", "scanskipexisting", false);
        _getActors = xmlreader.GetValueAsBool("moviedatabase", "getactors", true);
        _markWatchedFiles = xmlreader.GetValueAsBool("movies", "markwatched", true);
        //_eachFolderIsMovie = xmlreader.GetValueAsBool("movies", "eachFolderIsMovie", false);
        _fileMenuEnabled = xmlreader.GetValueAsBool("filemenu", "enabled", true);
        _fileMenuPinCode = Util.Utils.DecryptPassword(xmlreader.GetValueAsString("filemenu", "pincode", string.Empty));
        _howToPlayAll = xmlreader.GetValueAsInt("movies", "playallinfolder", 3);
        _watchedPercentage = xmlreader.GetValueAsInt("movies", "playedpercentagewatched", 95);
        _videoInfoInShare = xmlreader.GetValueAsBool("moviedatabase", "movieinfoshareview", false);
        _BDInternalMenu = xmlreader.GetValueAsBool("bdplayer", "useInternalBDPlayer", true);

        _virtualDirectory = VirtualDirectories.Instance.Movies;
		    // External player
        _useInternalVideoPlayer = xmlreader.GetValueAsBool("movieplayer", "internal", true);
        _useInternalDVDVideoPlayer = xmlreader.GetValueAsBool("dvdplayer", "internal", true);
        _externalPlayerExtensions = xmlreader.GetValueAsString("movieplayer", "extensions", "");

        _wolTimeout = xmlreader.GetValueAsInt("WOL", "WolTimeout", 10);
        _wolResendTime = xmlreader.GetValueAsInt("WOL", "WolResendTime", 1);

        if (_virtualStartDirectory == string.Empty)
        {
          if (_virtualDirectory.DefaultShare != null)
          {
            if (_virtualDirectory.DefaultShare.IsFtpShare)
            {
              //remote:hostname?port?login?password?folder
              _currentFolder = _virtualDirectory.GetShareRemoteURL(_virtualDirectory.DefaultShare);
              _virtualStartDirectory = _currentFolder;
            }
            else
            {
              _currentFolder = _virtualDirectory.DefaultShare.Path;
              _virtualStartDirectory = _virtualDirectory.DefaultShare.Path;
            }
          }
        }

        _askBeforePlayingDVDImage = xmlreader.GetValueAsBool("daemon", "askbeforeplaying", false);

        if (xmlreader.GetValueAsBool("movies", "rememberlastfolder", false))
        {
          string lastFolder = xmlreader.GetValueAsString("movies", "lastfolder", _currentFolder);
          if (VirtualDirectory.IsImageFile(Path.GetExtension(lastFolder)))
          {
            lastFolder = "root";
          }
          if (lastFolder != "root")
          {
            _currentFolder = lastFolder;
          }
        }

        _switchRemovableDrives = xmlreader.GetValueAsBool("movies", "SwitchRemovableDrives", true);
        _useOnlyNfoScraper = xmlreader.GetValueAsBool("moviedatabase", "useonlynfoscraper", false);
        _doNotUseDatabase = xmlreader.GetValueAsBool("moviedatabase", "donotusedatabase", false);

      }

      if (_currentFolder.Length > 0 && _currentFolder == _virtualStartDirectory)
      {
        VirtualDirectory vDir = new VirtualDirectory();
        vDir.LoadSettings("movies");
      }
    }
开发者ID:gayancc,项目名称:MediaPortal-1,代码行数:84,代码来源:GUIVideoFiles.cs


示例2: LoadDirectory

    protected override void LoadDirectory(string strNewDirectory)
    {
      GUIWaitCursor.Show();
      currentFolder = strNewDirectory;
      GUIControl.ClearControl(GetID, facadeLayout.GetID);
      ArrayList itemlist = new ArrayList();
      ArrayList movies = new ArrayList();

      if (_searchMovie)
      {
        string sql = "SELECT DISTINCT " +
                     "movieinfo.idMovie," +
                     "movieinfo.idDirector," +
                     "movieinfo.strDirector," +
                     "movieinfo.strPlotOutline," +
                     "movieinfo.strPlot," +
                     "movieinfo.strTagLine," +
                     "movieinfo.strVotes," +
                     "movieinfo.fRating," +
                     "movieinfo.strCast," +
                     "movieinfo.strCredits," +
                     "movieinfo.iYear," +
                     "movieinfo.strGenre," +
                     "movieinfo.strPictureURL," +
                     "movieinfo.strTitle," +
                     "movieinfo.IMDBID," +
                     "movieinfo.mpaa," +
                     "movieinfo.runtime," +
                     "movieinfo.iswatched," +
                     "movieinfo.strUserReview," +
                     "movieinfo.strFanartURL," +
                     "movieinfo.dateAdded," +
                     "movieinfo.dateWatched," +
                     "movieinfo.studios," +
                     "movieinfo.country," +
                     "movieinfo.language," +
                     "movieinfo.lastupdate, " +
			               "movieinfo.strSortTitle " +
                     "FROM movieinfo " +
                     "INNER JOIN actorlinkmovie ON actorlinkmovie.idMovie = movieinfo.idMovie " +
                     "INNER JOIN actors ON actors.idActor = actorlinkmovie.idActor " +
                     "WHERE "+ _searchMovieDbField + " LIKE '%" + _searchMovieString + "%' " +
                     "ORDER BY movieinfo.strTitle ASC";

        VideoDatabase.GetMoviesByFilter(sql, out movies, false, true, false, false);
      }
      else if (_searchActor && handler.CurrentLevelWhere != "title")
      {
        string sql = string.Empty;
        
        if (handler.CurrentLevelWhere == "director")
        {
          sql = "SELECT idActor, strActor, imdbActorId FROM actors INNER JOIN movieinfo ON movieinfo.idDirector = actors.idActor WHERE strActor LIKE '%" 
                + _searchActorString + 
                "%' ORDER BY strActor ASC";
        }
        else
        {
          sql = "SELECT * FROM actors WHERE strActor LIKE '%" + _searchActorString + "%' ORDER BY strActor ASC";
        }
        
        VideoDatabase.GetMoviesByFilter(sql, out movies, true, false, false, false);
      }
      else
      {
        movies = ((VideoViewHandler)handler).Execute();
      }

      GUIControl.ClearControl(GetID, facadeLayout.GetID);
      SwitchLayout();

      if (handler.CurrentLevel > 0)
      {
        GUIListItem listItem = new GUIListItem("..");
        listItem.Path = string.Empty;
        listItem.IsFolder = true;
        Util.Utils.SetDefaultIcons(listItem);
        listItem.OnItemSelected += OnItemSelected;
        itemlist.Add(listItem);
        SetLabel(listItem);
        ((VideoViewHandler)handler).SetLabel(listItem.AlbumInfoTag as IMDBMovie, ref listItem);
        facadeLayout.Add(listItem);
      }

      VirtualDirectory vDir = new VirtualDirectory();
      // Get protected share paths for videos
      vDir.LoadSettings("movies");

      foreach (IMDBMovie movie in movies)
      {
        GUIListItem item = new GUIListItem();
        item.Label = movie.Title;

        if (handler.CurrentLevelWhere != "user groups")
        {
          if (handler.CurrentLevel + 1 < handler.MaxLevels)
          {
            item.IsFolder = true;
          }
          else
//.........这里部分代码省略.........
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoTitle.cs


示例3: OnShowSavedPlaylists

    protected void OnShowSavedPlaylists(string _directory)
    {
      VirtualDirectory _virtualDirectory = new VirtualDirectory();
      _virtualDirectory.AddExtension(".m3u");
      _virtualDirectory.AddExtension(".pls");
      _virtualDirectory.AddExtension(".b4s");
      _virtualDirectory.AddExtension(".wpl");

      List<GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);
      if (_directory == m_strPlayListPath)
      {
        itemlist.RemoveAt(0);
      }

      GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      if (dlg == null)
      {
        return;
      }
      dlg.Reset();
      dlg.SetHeading(983); // Saved Playlists

      foreach (GUIListItem item in itemlist)
      {
        Util.Utils.SetDefaultIcons(item);
        dlg.Add(item);
      }

      dlg.DoModal(GetID);

      if (dlg.SelectedLabel == -1)
      {
        return;
      }

      GUIListItem selectItem = itemlist[dlg.SelectedLabel];
      if (selectItem.IsFolder)
      {
        OnShowSavedPlaylists(selectItem.Path);
        return;
      }

      GUIWaitCursor.Show();
      LoadPlayList(selectItem.Path);
      GUIWaitCursor.Hide();
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:46,代码来源:GUIVideoBaseWindow.cs


示例4: IsItemPinProtected

    // Check if item is pin protected and if it exists within unlocked shares
    // Returns true if item is valid or if item is not within protected shares
    private bool IsItemPinProtected(GUIListItem item, VirtualDirectory vDir)
    {
      string directory = Path.GetDirectoryName(item.Path); // item path

      if (directory != null)
      {
        //VirtualDirectory vDir = new VirtualDirectory();
        //// Get protected share paths for videos
        //vDir.LoadSettings("movies");

        // Check if item belongs to protected shares
        int pincode = 0;
        bool folderPinProtected = vDir.IsProtectedShare(directory, out pincode);

        bool success = false;

        // User unlocked share/shares with PIN and item is within protected shares
        if (folderPinProtected && _ageConfirmed)
        {
          // Iterate unlocked shares against current item path
          foreach (string share in _currentProtectedShare)
          {
          if (!directory.ToUpperInvariant().Contains(share.ToUpperInvariant()))
            {
              continue;
            }
            success = true;
            break;
          }

          // current item is not within unlocked shares, 
          // don't show item and go to the next item
          if (!success)
          {
            return false;
          }
          return true;
        }

        // Nothing unlocked and item belongs to protected shares,
        // don't show item and go to the next item
        if (folderPinProtected && !_ageConfirmed)
        {
          return false;
        }
      }

      // Item is not inside protected shares, show it
      return true;
    }
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:52,代码来源:GUIVideoTitle.cs


示例5: GetRandomMovie

    private IMDBMovie GetRandomMovie(ArrayList mList)
    {
      try
      {
        ArrayList movies = new ArrayList(mList);
        ArrayList pShares = new ArrayList();

        foreach (string p in _protectedShares)
        {
          char[] splitter = { '|' };
          string[] pin = p.Split(splitter);
          // Only add shares which are unlocked
          if (Convert.ToInt32(pin[0]) == _currentPin)
          {
            pShares.Add(pin[1]);
          }
        }

        // Do not show fanart for unlocked protected movies
        foreach (IMDBMovie m in movies)
        {
          ArrayList files = new ArrayList();
          VideoDatabase.GetFilesForMovie(m.ID, ref files);

          if (string.IsNullOrEmpty(files[0].ToString()))
          {
            continue;
          }

          string directory = Path.GetDirectoryName(files[0].ToString());

          if (string.IsNullOrEmpty(directory))
            continue;

          VirtualDirectory vDir = new VirtualDirectory();
          vDir.LoadSettings("movies");
          int pincode = 0;
          bool folderPinProtected = vDir.IsProtectedShare(directory, out pincode);

          // No PIN entered, remove all protected conetnt
          if (folderPinProtected && !_ageConfirmed)
          {
            mList.Remove(m);
            continue;
          }

          // PIN entered, check for corresponding shares
          if (folderPinProtected && _ageConfirmed)
          {
            bool found = false;

            foreach (string share in pShares)
            {
              if (directory.ToLowerInvariant().Contains(share.ToLowerInvariant()))
              {
                // Movie belongs to unlocked share
                found = true;
                break;
              }
            }
            // If movie is not from unlocked shares, don't show fanart
            if (!found)
            {
              mList.Remove(m);
            }
          }
        }

        if (mList.Count > 0)
        {
          Random rnd = new Random();
          int r = rnd.Next(mList.Count);
          IMDBMovie movieDetails = (IMDBMovie)mList[r];
          return movieDetails;
        }
        else
        {
          return null;
        }
      }
      catch (Exception)
      {
        return null;
      }
    }
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:85,代码来源:GUIVideoTitle.cs


示例6: GetVideoFiles

    public void GetVideoFiles(string path, ref ArrayList availableFiles)
    {
      //
      // Count the files in the current directory
      //
      try
      {
        VirtualDirectory dir = new VirtualDirectory();
        dir.SetExtensions(Util.Utils.VideoExtensions);
        ArrayList imagePath = new ArrayList();
        
        // Thumbs creation spam no1 causing this call
        //
        // Temporary disable thumbcreation
        //
        using (Settings xmlReaderWriter = new MPSettings())
        {
          _currentCreateVideoThumbs = xmlReaderWriter.GetValueAsBool("thumbnails", "tvrecordedondemand", true);
          xmlReaderWriter.SetValueAsBool("thumbnails", "tvrecordedondemand", false);
        }

        List<GUIListItem> items = dir.GetDirectoryUnProtectedExt(path, true);
        
        foreach (GUIListItem item in items)
        {
          if (item.IsFolder)
          {
            if (item.Label != "..")
            {
              if (item.Path.ToUpperInvariant().IndexOf(@"\VIDEO_TS") >= 0)
              {
                string strFile = String.Format(@"{0}\VIDEO_TS.IFO", item.Path);
                availableFiles.Add(strFile);
              }
              else if (item.Path.ToUpperInvariant().IndexOf(@"\BDMV") >= 0)
              {
                string strFile = String.Format(@"{0}\index.bdmv", item.Path);
                availableFiles.Add(strFile);
              }
              else
              {
                GetVideoFiles(item.Path, ref availableFiles);
              }
            }
          }
          else
          {
            bool skipDuplicate = false;

            if (VirtualDirectory.IsImageFile(Path.GetExtension(item.Path)))
            {
              string filePath = Path.GetDirectoryName(item.Path) + @"\" + Path.GetFileNameWithoutExtension(item.Path);

              if (!imagePath.Contains(filePath))
              {
                imagePath.Add(filePath);
              }
              else
              {
                skipDuplicate = true;
              }
            }
            if (!skipDuplicate)
            {
              string extension = Path.GetExtension(item.Path);

              if (extension != null && extension.ToUpperInvariant() != @".IFO" && extension.ToUpperInvariant() != ".BDMV")
              {
                availableFiles.Add(item.Path);
              }
            }
          }
        }
      }
      catch (Exception e)
      {
        Log.Info("VideoDatabase: Exception counting video files:{0}", e);
      }
      finally
      {
        // Restore thumbcreation setting
        using (Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValueAsBool("thumbnails", "tvrecordedondemand", _currentCreateVideoThumbs);
        }
      }
    }
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:87,代码来源:VideoDatabaseSqlLite.cs


示例7: CheckItem

    // Check if item is pin protected and if it exists within unlocked shares
    // Returns true if item is valid or if item is not within protected shares
    private bool CheckItem(GUIListItem item)
    {
      string directory = Path.GetDirectoryName(item.Path); // item path
      VirtualDirectory vDir = new VirtualDirectory();
      // Get protected share paths for videos
      vDir.LoadSettings("movies"); 

      // Check if item belongs to protected shares
      int pincode = 0;
      bool folderPinProtected = vDir.IsProtectedShare(directory, out pincode);
      
      bool success = false;

      // User unlocked share/shares with PIN and item is within protected shares
      if (folderPinProtected && ageConfirmed) 
      {
        // Iterate unlocked shares against current item path
        foreach (string share in currentProtectedShare)
        {
          if (!directory.ToLower().Contains(share.ToLower()))
          {
            continue;
          }
          else // item belongs to unlocked shares and will be displayed
          {
            success = true;
            break;
          }
        }
        // current item is not within unlocked shares, 
        // don't show item and go to the next item
        if (!success)
        {
          return false;
        }
        else // current item is within unlocked shares, show it
        {
          return true;
        }
      }
      // Nothing unlocked and item belongs to protected shares,
      // don't show item and go to the next item
      else if (folderPinProtected && !ageConfirmed)
      {
        return false;
      }
      // Item is not inside protected shares, show it
      return true;
    }
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:51,代码来源:GUIVideoTitle.cs


示例8: SetMovieData

    /// <summary>
    /// Use only in share view
    /// </summary>
    /// <param name="item"></param>
    public static void SetMovieData(GUIListItem item)
    {
      IMDBMovie info = new IMDBMovie();

      if (item == null)
      {
        return;
      }
      
      try
      {
        string path = string.Empty;
        string fileName = string.Empty;

        if (Util.Utils.IsVideo(item.Path))
        {
          Util.Utils.Split(item.Path, out path, out fileName);
        }
        else
        {
          path = item.Path;
        }

        if (item.Path != ".." && System.IO.File.Exists(item.Path + @"\VIDEO_TS\VIDEO_TS.IFO"))
        {
          fileName = item.Path + @"\VIDEO_TS\VIDEO_TS.IFO";
        }
        else if (item.Path != ".." && System.IO.File.Exists(item.Path + @"\BDMV\index.bdmv"))
        {
          fileName = item.Path + @"\BDMV\index.bdmv";
        }
        else
        {
          fileName = item.Path;
        }

        // Set
        VideoFilesMediaInfo mInfo = new VideoFilesMediaInfo();

        if (path == ".." || string.IsNullOrEmpty(path) || (!Directory.Exists(path) && !Util.Utils.IsVideo(fileName)))
        {
          info.MediaInfo = mInfo;
          item.AlbumInfoTag = info;
          return;
        }

        if (Directory.Exists(path) && !Util.Utils.IsVideo(fileName))
        {
          int rndMovieId = -1;

          VirtualDirectory vDir = new VirtualDirectory();
          string pin = string.Empty;
          vDir.LoadSettings("movies");

          if (!vDir.IsProtectedShare(path, out pin))
          {
            ArrayList mList = new ArrayList();
            VideoDatabase.GetRandomMoviesByPath(path, ref mList, 1);

            if (mList.Count > 0)
            {
              IMDBMovie movieDetails = (IMDBMovie)mList[0];
              mList.Clear();
              rndMovieId = movieDetails.ID;
              if (Util.Utils.IsFolderDedicatedMovieFolder(path))
              {
                VideoDatabase.GetMovieInfoById(rndMovieId,ref info);
                int percent = 0;
                int watchedCount = 0;
                VideoDatabase.GetmovieWatchedStatus(rndMovieId, out percent, out watchedCount);
                info.WatchedPercent = percent;
                info.WatchedCount = watchedCount;
                ArrayList fList = new ArrayList();
                VideoDatabase.GetFilesForMovie(rndMovieId,ref fList);
                if (fList.Count > 0)
                {
                  VideoDatabase.GetVideoFilesMediaInfo((string)fList[0], ref mInfo, false);
                  info.VideoFileName = (string)fList[0];
                }
              }
            }
            else
            {
              // User fanart (only for videos which do not have movie info in db -> not scanned)
              try
              {
                GetUserFanart(item, ref info);
              }
              catch (Exception ex)
              {
                Log.Error("IMDBMovie Set user fanart file property error: {0}", ex.Message);
              }
            }
          }

          info.ID = rndMovieId;
//.........这里部分代码省略.........
开发者ID:hkjensen,项目名称:MediaPortal-1,代码行数:101,代码来源:IMDBMovie.cs


示例9: CountFiles

 private static void CountFiles(string path, ref ArrayList availableFiles)
 {
   //
   // Count the files in the current directory
   //
   try
   {
     VirtualDirectory dir = new VirtualDirectory();
     dir.SetExtensions(Util.Utils.PictureExtensions);
     List<GUIListItem> items = dir.GetDirectoryUnProtectedExt(path, true);
     foreach (GUIListItem item in items)
     {
       if (item.IsFolder)
       {
         if (item.Label != "..")
         {
           CountFiles(item.Path, ref availableFiles);
           CreateThumbsAndAddPictureToDBFolderThread ManualThumbBuilderFolder =
             new CreateThumbsAndAddPictureToDBFolderThread(item.Path);
         }
       }
       else
       {
         availableFiles.Add(item.Path);
       }
     }
   }
   catch (Exception e)
   {
     Log.Info("Exception counting files:{0}", e);
     // Ignore
   }
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:33,代码来源:GUISettingsPictures_Database.cs


示例10: CountFiles

    /// <summary>
    /// 
    /// </summary>
    /// <param name="path"></param>
    /// <param name="availableFiles"></param>
    private static void CountFiles(string path, ref ArrayList availableFiles)
    {
      //
      // Count the files in the current directory
      //
      try
      {
        VirtualDirectory dir = new VirtualDirectory();
        dir.SetExtensions(Util.Utils.VideoExtensions);
        // Thumbs creation spam no1 causing this call
        //
        // Temporary disable thumbcreation
        //
        using (Settings xmlreader = new MPSettings())
        {
          _currentCreateVideoThumbs = xmlreader.GetValueAsBool("thumbnails", "tvrecordedondemand", true);
        }
        using (Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValueAsBool("thumbnails", "tvrecordedondemand", false);
        }

        List<GUIListItem> items = dir.GetDirectoryUnProtectedExt(path, true);
        foreach (GUIListItem item in items)
        {
          if (item.IsFolder)
          {
            if (item.Label != "..")
            {
              if (item.Path.ToLower().IndexOf("video_ts") >= 0)
              {
                string strFile = String.Format(@"{0}\VIDEO_TS.IFO", item.Path);
                availableFiles.Add(strFile);
              }
              else
              {
                CountFiles(item.Path, ref availableFiles);
              }
            }
          }
          else
          {
            availableFiles.Add(item.Path);
          }
        }
      }
      catch (Exception e)
      {
        Log.Info("Exception counting files:{0}", e);
        // Ignore
      }
      finally
      {
        // Restore thumbcreation setting
        using (Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValueAsBool("thumbnails", "tvrecordedondemand", _currentCreateVideoThumbs);
        }
      }
    }
开发者ID:ncoH,项目名称:MediaPortal-1,代码行数:65,代码来源:IMDBFetcher.cs


示例11: OnShowSavedPlaylists

        protected void OnShowSavedPlaylists(string _directory)
        {
            // Set TVSeries Playlist Extension
            VirtualDirectory _virtualDirectory = new VirtualDirectory();
            _virtualDirectory.AddExtension(".tvsplaylist");

            // Get All Playlists found in Directory
            List<GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);
            if (_directory == DBOption.GetOptions(DBOption.cPlaylistPath))
                itemlist.RemoveAt(0);

            // If no playlists found, show a Message to user and then exit
            if (itemlist.Count == 0)
            {
                GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                dlgOK.SetHeading(983);
                dlgOK.SetLine(1, Translation.NoPlaylistsFound);
                dlgOK.SetLine(2, _directory);
                dlgOK.DoModal(GUIWindowManager.ActiveWindow);
                return;
            }

            // Create Playist Menu Dialog
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            if (dlg == null)
                return;
            dlg.Reset();
            dlg.SetHeading(983); // Saved Playlists

            // Add all playlists found to Menu for selection
            foreach (GUIListItem item in itemlist)
            {
                MediaPortal.Util.Utils.SetDefaultIcons(item);
                dlg.Add(item);
            }

            // Show Plaulist Menu Dialog
            dlg.DoModal(GetID);

            // Nothing was selected e.g. BACK
            if (dlg.SelectedLabel == -1)
                return;

            GUIListItem selectItem = itemlist[dlg.SelectedLabel];

            // If Item selected was a Folder, re-curse to show contents
            if (selectItem.IsFolder)
            {
                OnShowSavedPlaylists(selectItem.Path);
                return;
            }

            // Load the Selected Playlist
            GUIWaitCursor.Show();
            LoadPlayList(selectItem.Path);
            GUIWaitCursor.Hide();
        }
开发者ID:MichelZ,项目名称:MP-TVSeries,代码行数:57,代码来源:TVSeriesPlugin.cs


示例12: SetDirectoryStructure

 public void SetDirectoryStructure(VirtualDirectory value)
 {
   m_directory = value;
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:4,代码来源:GUIDialogFile.cs


示例13: DoModal

    public void DoModal(int dwParentId)
    {
      m_bOverlay = GUIGraphicsContext.Overlay;
      m_dwParentWindowID = dwParentId;
      m_pParentWindow = GUIWindowManager.GetWindow(m_dwParentWindowID);
      if (null == m_pParentWindow)
      {
        m_dwParentWindowID = 0;
        return;
      }

      if (m_directory == null)
      {
        m_directory = new VirtualDirectory();
      }

      // show menu
      ShowFileMenu(m_itemSourceItem);
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:19,代码来源:GUIDialogFile.cs


示例14: OnShowSavedPlaylists

        /// <summary>
        /// Show saved playlists
        /// </summary>
        /// <param name="_directory"></param>
        protected void OnShowSavedPlaylists(string _directory)
        {
            VirtualDirectory _virtualDirectory = new VirtualDirectory();
              _virtualDirectory.AddExtension(".mvplaylist");

              List<GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);
              string playListPath = string.Empty;

              if (!string.IsNullOrEmpty(mvCentralCore.Settings.PlayListFolder.Trim()))
            playListPath = mvCentralCore.Settings.PlayListFolder;
              else
              {
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
            {
              playListPath = xmlreader.GetValueAsString("movies", "playlists", string.Empty);
              playListPath = MediaPortal.Util.Utils.RemoveTrailingSlash(playListPath);
            }
              }

              if (_directory == playListPath)
            itemlist.RemoveAt(0);

              // If no playlists found, show a Message to user and then exit
              if (itemlist.Count == 0)
              {
            GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            dlgOK.SetHeading(983);
            dlgOK.SetLine(1, Localization.NoPlaylistsFound);
            dlgOK.SetLine(2, _directory);
            dlgOK.DoModal(GUIWindowManager.ActiveWindow);
            return;
              }

              GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
              if (dlg == null)
            return;
              dlg.Reset();
              dlg.SetHeading(983); // Saved Playlists

              foreach (GUIListItem item in itemlist)
              {
            MediaPortal.Util.Utils.SetDefaultIcons(item);
            dlg.Add(item);
              }

              dlg.DoModal(GetID);

              if (dlg.SelectedLabel == -1)
            return;

              GUIListItem selectItem = itemlist[dlg.SelectedLabel];
              if (selectItem.IsFolder)
              {
            OnShowSavedPlaylists(selectItem.Path);
            return;
              }

              GUIWaitCursor.Show();
              LoadPlayList(selectItem.Path);
              GUIWaitCursor.Hide();
        }
开发者ID:andrewjswan,项目名称:mvcentral,代码行数:65,代码来源:GUImvPlaylist.cs


示例15: ListFilesForUpdateMediaInfo

 private void ListFilesForUpdateMediaInfo(GUIListItem item, ref List<GUIListItem> itemlist)
 {
   if (item != null)
   {
     // Process the list of files found in the directory.
     VirtualDirectory virtualDirectory = new VirtualDirectory();
     virtualDirectory.SetExtensions(Util.Utils.VideoExtensions);
     List<GUIListItem> inertItemlist = virtualDirectory.GetDirectoryUnProtectedExt(item.Path, true);
     foreach (GUIListItem subItem in inertItemlist)
     {
       if (!subItem.IsFolder)
       {
         itemlist.Add(subItem);
       }
       else
       {
         if (subItem.Label != "..")
         {
           ListFilesForUpdateMediaInfo(subItem, ref itemlist);
         }
       }
     }
   }
 }
开发者ID:gayancc,项目名称:MediaPortal-1,代码行数:24,代码来源:GUIVideoFiles.cs


示例16: GetInfoFromIMDB

    public static bool GetInfoFromIMDB(IMDB.IProgress progress, ref IMDBMovie movieDetails, bool isFuzzyMatching,
                                       bool getActors)
    {
      string file;
      string path = movieDetails.Path;
      string filename = movieDetails.File;
      if (path != string.Empty)
      {
        if (path.EndsWith(@"\"))
        {
          path = path.Substring(0, path.Length - 1);
          movieDetails.Path = path;
        }
        if (filename.StartsWith(@"\"))
        {
          filename = filename.Substring(1);
          movieDetails.File = filename;
        }
        file = path + Path.DirectorySeparatorChar + filename;
      }
      else
      {
        file = filename;
      }

      bool addToDB = true;
      int id = movieDetails.ID;
      if (id < 0)
      {
        if (File.Exists(file))
        {
          id = VideoDatabase.AddMovieFile(file);

          VirtualDirectory dir = new VirtualDirectory();
          dir.SetExtensions(Util.Utils.VideoExtensions);
          // Thumb creation spam no2 causing this call
          //
          // Temporary disable thumbcreation
          //
          using (Settings xmlreader = new MPSettings())
          {
            _currentCreateVideoThumbs = xmlreader.GetValueAsBool("thumbnails", "tvrecordedondemand", true);
          }
          using (Settings xmlwriter = new MPSettings())
          {
            xmlwriter.SetValueAsBool("thumbnails", "tvrecordedondemand", false);
          }
          List<GUIListItem> items = dir.GetDirectoryUnProtectedExt(path, true);
          
          foreach (GUIListItem item in items)
          {
            if (item.IsFolder)
            {
              continue;
            }
            if (Util.Utils.ShouldStack(item.Path, file) && item.Path != file)
            {
              string strPath, strFileName;

              DatabaseUtility.Split(item.Path, out strPath, out strFileName);
              DatabaseUtility.RemoveInvalidChars(ref strPath);
              DatabaseUtility.RemoveInvalidChars(ref strFileName);
              int pathId = VideoDatabase.AddPath(strPath);
              VideoDatabase.AddFile(id, pathId, strFileName);
            }
          }
          // Restore thumbcreation setting
          using (Settings xmlwriter = new MPSettings())
          {
            xmlwriter.SetValueAsBool("thumbnails", "tvrecordedondemand", _currentCreateVideoThumbs);
          }

          movieDetails.ID = id;
        }
        else
        {
          Log.Info("File doesn't exists. So no info is stored in db.");
          getActors = false;
          addToDB = false;
        }
      }
      if (RefreshIMDB(progress, ref movieDetails, isFuzzyMatching, getActors, addToDB))
      {
        if (movieDetails != null)
        {
          return true;
        }
      }
      return false;
    }
开发者ID:elliottmc,项目名称:MediaPortal-1,代码行数:90,代码来源:IMDBFetcher.cs


示例17: AddVideoFiles

    private static void AddVideoFiles(string path, ref ArrayList availableFiles)
    {
      //
      // Count the files in the current directory
      //
      bool currentCreateVideoThumbs = false;

      try
      {
        VirtualDirectory dir = new VirtualDirectory();
        dir.SetExtensions(Util.Utils.VideoExtensions);
        // Temporary disable thumbcreation
        using (Profile.Settings xmlreader = new MPSettings())
        {
          currentCreateVideoThumbs = xmlreader.GetValueAsBool("thumbnails", "videoondemand", true);
        }
        using (Profile.Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValueAsBool("thumbnails", "videoondemand", false);
        }

        List<GUIListItem> items = dir.GetDirectoryUnProtectedExt(path, true);

        foreach (GUIListItem item in items)
        {
          if (item.IsFolder)
          {
            if (item.Label != "..")
            {
              if (item.Path.ToUpperInvariant().IndexOf("VIDEO_TS") >= 0)
              {
                string strFile = String.Format(@"{0}\VIDEO_TS.IFO", item.Path);
                availableFiles.Add(strFile);
              }
              if (item.Path.ToUpperInvariant().IndexOf("BDMV") >= 0)
              {
                string strFile = String.Format(@"{0}\index.bdmv", item.Path);
                availableFiles.Add(strFile);
              }
              else
              {
                AddVideoFiles(item.Path, ref availableFiles);
              }
            }
          }
          else
          {
            availableFiles.Add(item.Path);
          }
        }
      }
      catch (Exception e)
      {
        Log.Info("Exception counting files:{0}", e);
        // Ignore
      }
      finally
      {
        // Restore thumbcreation setting
        using (Profile.Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValueAsBool("thumbnails", "videoondemand", currentCreateVideoThumbs);
        }
      }
    }
开发者ID:gayancc,项目名称:MediaPortal-1,代码行数:65,代码来源:GUIVideoFiles.cs


示例18: LoadSettings

    protected override void LoadSettings()
    {
      base.LoadSettings();
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        currentLayout = (Layout)xmlreader.GetValueAsInt(SerializeName, "layout", (int)Layout.List);
        m_bSortAscending = xmlreader.GetValueAsBool(SerializeName, "sortasc", true);
        VideoState.StartWindow = xmlreader.GetValueAsInt("movies", "startWindow", GetID);
        VideoState.View = xmlreader.GetValueAsString("movies", "startview", "369");

        // Prevent unaccesible My Videos from corrupted config
        if (!IsVideoWindow(VideoState.StartWindow))
        {
          VideoState.StartWindow = GetID;
          VideoState.View = "369";
        }

        _isFuzzyMatching = xmlreader.GetValueAsBool("movies", "fuzzyMatching", false);
        _scanSkipExisting = xmlreader.GetValueAsBool("moviedatabase", "scanskipexisting", false);
        _getActors = xmlreader.GetValueAsBool("moviedatabase", "getactors", true);
        _markWatchedFiles = xmlreader.GetValueAsBool("movies", "markwatched", true);
        _eachFolderIsMovie = xmlreader.GetValueAsBool("movies", "eachFolderIsMovie", false);
        _fileMenuEnabled = xmlreader.GetValueAsBool("filemenu", "enabled", true);
        _fileMenuPinCode = Util.Utils.DecryptPin(xmlreader.GetValueAsString("filemenu", "pincode", string.Empty));
        _howToPlayAll = xmlreader.GetValueAsInt("movies", "playallinfolder", 3);

        _virtualDirectory = VirtualDirectories.Instance.Movies;

        if (_virtualStartDirectory == string.Empty)
        {
          if (_virtualDirectory.DefaultShare != null)
          {
            if (_virtualDirectory.DefaultShare.IsFtpShare)
            {
              //remote:hostname?port?login?password?folder
              _currentFolder = _virtualDirectory.GetShareRemoteURL(_virtualDirectory.DefaultShare);
              _virtualStartDirectory = _currentFolder;
            }
            else
            {
              _currentFolder = _virtualDirectory.DefaultShare.Path;
              _virtualStartDirectory = _virtualDirectory.DefaultShare.Path;
            }
          }
        }

        _askBeforePlayingDVDImage = xmlreader.GetValueAsBool("daemon", "askbeforeplaying", false);

        if (xmlreader.GetValueAsBool("movies", "rememberlastfolder", false))
        {
          string lastFolder = xmlreader.GetValueAsString("movies", "lastfolder", _currentFolder);
          if (VirtualDirectory.IsImageFile(Path.GetExtension(lastFolder)))
          {
            lastFolder = "root";
          }
          if (lastFolder != "root")
          {
            _currentFolder = lastFolder;
          }
        }
        _switchRemovableDrives = xmlreader.GetValueAsBool(& 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Database.IMDBActor类代码示例发布时间:2022-05-26
下一篇:
C# Controls.MPLabel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap