private static void GetRefreshRateConfiguration()
    {
      if (_refreshRateSettings == null)
      {
        _refreshRateSettings = new List<RefreshRateSetting>();

        NumberFormatInfo provider = new NumberFormatInfo();
        provider.NumberDecimalSeparator = ".";

        Settings xmlreader = new MPSettings();

        for (int i = 1; i < 100; i++)
        {
          string extCmd = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_ext", "");
          string name = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_name", "");

          if (string.IsNullOrEmpty(name))
          {
            continue;
          }

          string fps = xmlreader.GetValueAsString("general", name + "_fps", "");
          string hz = xmlreader.GetValueAsString("general", name + "_hz", "");

          RefreshRateSetting setting = new RefreshRateSetting();

          setting.Name = name;

          char[] splitter = {';'};
          string[] fpsArray = fps.Split(splitter);

          List<double> fpsList = new List<double>();
          foreach (string fpsItem in fpsArray)
          {
            double fpsAsDouble = -1;
            double.TryParse(fpsItem, NumberStyles.AllowDecimalPoint, provider, out fpsAsDouble);

            if (fpsAsDouble > -1)
            {
              fpsList.Add(fpsAsDouble);
            }
          }

          setting.Fps = fpsList;

          double hzAsDouble = -1;
          double.TryParse(hz, NumberStyles.AllowDecimalPoint, provider, out hzAsDouble);

          setting.Hz = hzAsDouble;
          setting.ExtCmd = extCmd;

          _refreshRateSettings.Add(setting);
        }
      }
    }
    private static void GetRefreshRateConfiguration()
    {
      if (_refreshRateSettings == null)
      {
        _refreshRateSettings = new List<RefreshRateSetting>();

        NumberFormatInfo provider = new NumberFormatInfo();
        provider.NumberDecimalSeparator = ".";

        Settings xmlreader = new MPSettings();

        for (int i = 1; i < 100; i++)
        {
          string extCmd = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_ext", "");
          string name = xmlreader.GetValueAsString("general", "refreshrate0" + Convert.ToString(i) + "_name", "");

          if (string.IsNullOrEmpty(name))
          {
            continue;
          }

          string fps = xmlreader.GetValueAsString("general", name + "_fps", "");
          string hz = xmlreader.GetValueAsString("general", name + "_hz", "");

          RefreshRateSetting setting = new RefreshRateSetting();

          setting.Name = name;

          char[] splitter = {';'};
          string[] fpsArray = fps.Split(splitter);

          List<double> fpsList = new List<double>();
          foreach (string fpsItem in fpsArray)
          {
            double fpsAsDouble = -1;
            double.TryParse(fpsItem, NumberStyles.AllowDecimalPoint, provider, out fpsAsDouble);

            if (fpsAsDouble > -1)
            {
              fpsList.Add(fpsAsDouble);
            }
          }

          setting.Fps = fpsList;

          double hzAsDouble = -1;
          double.TryParse(hz, NumberStyles.AllowDecimalPoint, provider, out hzAsDouble);

          setting.Hz = hzAsDouble;
          setting.ExtCmd = extCmd;

          _refreshRateSettings.Add(setting);
        }
      }
    }
    // change screen refresh rate based on media framerate
    public static void AdaptRefreshRate(string strFile, MediaType type)
    {
      if (_refreshrateChangePending)
      {
        return;
      }

      bool isTV = Util.Utils.IsLiveTv(strFile);
      bool isDVD = Util.Utils.IsDVD(strFile);
      bool isVideo = Util.Utils.IsVideo(strFile);
      bool isRTSP = Util.Utils.IsRTSP(strFile); //rtsp users for live TV and recordings.

      if (!isTV && !isDVD && !isVideo && !isRTSP)
      {
        return;
      }

      bool enabled = false;
      NumberFormatInfo provider = new NumberFormatInfo();
      provider.NumberDecimalSeparator = ".";
      bool deviceReset = false;
      bool force_refresh_rate = false;
      using (Settings xmlreader = new MPSettings())
      {
        enabled = xmlreader.GetValueAsBool("general", "autochangerefreshrate", false);

        if (!enabled)
        {
          Log.Info("RefreshRateChanger.AdaptRefreshRate: 'auto refreshrate changer' disabled");
          return;
        }

        deviceReset = xmlreader.GetValueAsBool("general", "devicereset", false);
        force_refresh_rate = xmlreader.GetValueAsBool("general", "force_refresh_rate", false);
      }

      RefreshRateSetting setting = RetrieveRefreshRateChangerSetting("TV");

      if (setting == null)
      {
        Log.Error(
          "RefreshRateChanger.AdaptRefreshRate: TV section not found in mediaportal.xml, please delete file and reconfigure.");
        return;
      }

      List<double> tvFPS = setting.Fps;
      double fps = -1;

      if ((isVideo || isDVD) && (!isRTSP && !isTV))
      {
        if (g_Player.MediaInfo != null)
        {
          fps = g_Player.MediaInfo.Framerate;
        }
        else
        {
          StackTrace st = new StackTrace(true);
          StackFrame sf = st.GetFrame(0);

          Log.Error("RefreshRateChanger.AdaptRefreshRate: g_Player.MediaInfo was null. file: {0} st: {1}", strFile,
                    sf.GetMethod().Name);
          return;
        }
      }
      else if (isTV || isRTSP)
      {
        if (tvFPS.Count > 0)
        {
          fps = tvFPS[0];
        }
      }

      if (fps < 1)
      {
        Log.Info("RefreshRateChanger.AdaptRefreshRate: unable to guess framerate on file {0}", strFile);
      }
      else
      {
        Log.Info("RefreshRateChanger.AdaptRefreshRate: framerate on file {0} is {1}", strFile, fps);
      }

      SetRefreshRateBasedOnFPS(fps, strFile, type);
    }