protected override void LoadSettings()
 {
     base.LoadSettings();
     using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
     {
         currentLayout     = (Layout)xmlreader.GetValueAsInt(SerializeName, "layout", (int)Layout.List);
         m_bSortAscending  = xmlreader.GetValueAsBool(SerializeName, "sortasc", true);
         currentSortMethod = (MusicSort.SortMethod)xmlreader.GetValueAsInt(SerializeName, "sortmethod", (int)MusicSort.SortMethod.Name);
     }
 }
        static DaemonTools()
        {
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
            {
                _Enabled   = xmlreader.GetValueAsBool("daemon", "enabled", false);
                _Path      = xmlreader.GetValueAsString("daemon", "path", "");
                _Drive     = xmlreader.GetValueAsString("daemon", "drive", "E:");
                _DriveNo   = xmlreader.GetValueAsInt("daemon", "driveNo", 0);
                _DriveType = xmlreader.GetValueAsString("daemon", "driveType", "");

                /*
                 * DAEMON Tools supports the following image files:
                 * cue/bin
                 * iso
                 * ccd (CloneCD)
                 * bwt (Blindwrite)
                 * mds (Media Descriptor File)
                 * cdi (Discjuggler)
                 * nrg (Nero)
                 * pdi (Instant CD/DVD)
                 * b5t (BlindWrite 5)
                 */
                string[] extensions =
                    xmlreader.GetValueAsString("daemon", "extensions", Utils.ImageExtensionsDefault).Split(',');
                _supportedExtensions = new HashSet <string>();
                // Can't use an AddRange, as we need to trim the blanks
                foreach (string ext in extensions)
                {
                    _supportedExtensions.Add(ext.Trim());
                }
            }
        }
Exemple #3
0
 static DaemonTools()
 {
   using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
   {
     _Enabled = xmlreader.GetValueAsBool("daemon", "enabled", false);
     _Path = xmlreader.GetValueAsString("daemon", "path", "");
     _Drive = xmlreader.GetValueAsString("daemon", "drive", "E:");
     _DriveNo = xmlreader.GetValueAsInt("daemon", "driveNo", 0);
     _DriveType = xmlreader.GetValueAsString("daemon", "driveType", "");
     /*
      * DAEMON Tools supports the following image files:
      * cue/bin
      * iso
      * ccd (CloneCD)
      * bwt (Blindwrite)
      * mds (Media Descriptor File)
      * cdi (Discjuggler)
      * nrg (Nero)
      * pdi (Instant CD/DVD)
      * b5t (BlindWrite 5)
      */
     string[] extensions =
       xmlreader.GetValueAsString("daemon", "extensions", Utils.ImageExtensionsDefault).Split(',');
     _supportedExtensions = new HashSet<string>();
     // Can't use an AddRange, as we need to trim the blanks  
     foreach (string ext in extensions)
       _supportedExtensions.Add(ext.Trim());
   }
 }
Exemple #4
0
 public static void InitLogLevel()
 {
     using (var xmlreader = new MediaPortal.Profile.MPSettings())
     {
         int logLevel = xmlreader.GetValueAsInt("general", "loglevel", 2);
         if (DBOption.GetOptions(DBOption.cSQLLoggingEnabled))
         {
             selectedLogLevel = MPTVSeriesLog.LogLevel.DebugSQL;
         }
         else if (logLevel == 3)
         {
             selectedLogLevel = MPTVSeriesLog.LogLevel.Debug;
         }
         else
         {
             selectedLogLevel = MPTVSeriesLog.LogLevel.Normal;
         }
     }
 }
        public MyVideos(int priority)
        {
            // check that we are running MediaPortal 1.3 or greater
            string libFilename = Path.Combine(Config.GetSubFolder(Config.Dir.Plugins, "Windows"), "WindowPlugins.dll");

            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(libFilename);
            string version = fvi.ProductVersion;
            if (new Version(version) < new Version(1, 3, 0, 0))
            {
                throw new FileLoadException("MediaPortal does not meet minimum requirements!");
            }

            // get video watched percentage to count as scrobble
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
            {
                WatchedPercent = xmlreader.GetValueAsInt("movies", "playedpercentagewatched", 95);
            }

            Priority = priority;
        }
Exemple #6
0
        public MyVideos(int priority)
        {
            // check that we are running MediaPortal 1.7 Pre-Release or greater
            string libFilename = Path.Combine(Config.GetSubFolder(Config.Dir.Plugins, "Windows"), "GUIVideos.dll");

            FileVersionInfo fvi     = FileVersionInfo.GetVersionInfo(libFilename);
            string          version = fvi.ProductVersion;

            if (new Version(version) < new Version(1, 6, 100, 0))
            {
                throw new FileLoadException("MediaPortal does not meet minimum requirements!");
            }

            // get video watched percentage to count as scrobble
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
            {
                WatchedPercent = xmlreader.GetValueAsInt("movies", "playedpercentagewatched", 95);
            }

            Priority = priority;
        }
 protected override void LoadSettings()
 {
   base.LoadSettings();
   using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
   {
     currentLayout = (Layout)xmlreader.GetValueAsInt(SerializeName, "layout", (int)Layout.List);
     m_bSortAscending = xmlreader.GetValueAsBool(SerializeName, "sortasc", true);
     currentSortMethod = (MusicSort.SortMethod)xmlreader.GetValueAsInt(SerializeName, "sortmethod", (int)MusicSort.SortMethod.Name);
   }
 }
    public override bool Init()
    {
      bool bResult = Load(GUIGraphicsContext.GetThemedSkinFile(@"\videoFullScreen.xml"));
      GetID = (int)Window.WINDOW_FULLSCREEN_VIDEO;
      using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
      {
        _immediateSeekIsRelative = xmlreader.GetValueAsBool("movieplayer", "immediateskipstepsisrelative", true);
        _immediateSeekValue = xmlreader.GetValueAsInt("movieplayer", "immediateskipstepsize", 10);
      }

      SettingsLoaded = false;

      g_Player.PlayBackEnded += new g_Player.EndedHandler(g_Player_PlayBackEnded);
      g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped);
      g_Player.PlayBackChanged += new g_Player.ChangedHandler(g_Player_PlayBackChanged);

      return bResult;
    }
Exemple #9
0
 public static void InitLogLevel()
 {
     using (var xmlreader = new MediaPortal.Profile.MPSettings())
     {
         int logLevel = xmlreader.GetValueAsInt("general", "loglevel", 2);
         if (DBOption.GetOptions(DBOption.cSQLLoggingEnabled))
             selectedLogLevel = MPTVSeriesLog.LogLevel.DebugSQL;
         else if (logLevel == 3)
             selectedLogLevel = MPTVSeriesLog.LogLevel.Debug;
         else
             selectedLogLevel = MPTVSeriesLog.LogLevel.Normal;
     }
 }
        public static void InitLogger()
        {
            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("myvideo-importer", fileTarget);

            // Get current Log Level from MediaPortal
            LogLevel logLevel       = LogLevel.Debug;
            string   threadPriority = "Normal";
            int      intLogLevel    = 3;

            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
            {
                threadPriority = xmlreader.GetValueAsString("general", "ThreadPriority", threadPriority);
                intLogLevel    = xmlreader.GetValueAsInt("general", "loglevel", intLogLevel);
            }

            switch (intLogLevel)
            {
            case 0:
                logLevel = LogLevel.Error;
                break;

            case 1:
                logLevel = LogLevel.Warn;
                break;

            case 2:
                logLevel = LogLevel.Info;
                break;

            default:
                logLevel = LogLevel.Debug;
                break;
            }
      #if DEBUG
            logLevel = LogLevel.Debug;
      #endif

            Priority = string.IsNullOrEmpty(threadPriority) || !threadPriority.Equals("Normal", StringComparison.CurrentCulture) ?
                       (string.IsNullOrEmpty(threadPriority) || !threadPriority.Equals("BelowNormal", StringComparison.CurrentCulture) ?
                        ePriority.BelowNormal :
                        ePriority.Lowest) :
                       ePriority.Lowest;

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

            LogManager.Configuration = config;
        }
    private void Initialize()
    {
      using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
      {
        ReceiveEnabled = xmlreader.GetValueAsBool("USBUIRT", "internal", false);
        TransmitEnabled = xmlreader.GetValueAsBool("USBUIRT", "external", false);
        Is3Digit = xmlreader.GetValueAsBool("USBUIRT", "is3digit", false);
        tunerNeedsEnter = xmlreader.GetValueAsBool("USBUIRT", "needsenter", false);

        CommandRepeatCount = xmlreader.GetValueAsInt("USBUIRT", "repeatcount", 2);
        InterCommandDelay = xmlreader.GetValueAsInt("USBUIRT", "commanddelay", 100);
      }

      if (!LoadValues())
      {
        Log.Info("USBUIRT:unable to load values from:{0}", remotefile);
      }

      if (!LoadTunerValues())
      {
        Log.Info("USBUIRT:unable to load tunervalues from:{0}", tunerfile);
      }
    }