Beispiel #1
0
 ///<summary>True if the computer name of this session is included in the HasVerboseLogging PrefValue.</summary>
 public static bool IsVerboseLoggingSession()
 {
     try {
         if (Prefs.DictIsNull())                  //Do not allow PrefC.GetString below if we haven't loaded the Pref cache yet. This would cause a recursive loop and stack overflow.
         {
             throw new Exception("Prefs cache is null");
         }
         if (_isVerboseLoggingSession == YN.Unknown)
         {
             if (PrefC.GetString(PrefName.HasVerboseLogging).ToLower().Split(',').ToList().Exists(x => x == Environment.MachineName.ToLower()))
             {
                 _isVerboseLoggingSession = YN.Yes;
                 //Switch logger to a directory that won't have permissions issues.
                 Logger.UseMyDocsDirectory();
             }
             else
             {
                 _isVerboseLoggingSession = YN.No;
             }
         }
         return(_isVerboseLoggingSession == YN.Yes);
     }
     catch (Exception e) {
         e.DoNothing();
         return(false);
     }
 }
Beispiel #2
0
        ///<summary>Gets a pref of type string.  Will not throw an exception if null or not found.</summary>
        public static string GetStringSilent(PrefName prefName)
        {
            if (Prefs.DictIsNull())
            {
                return("");
            }
            Pref pref = null;

            ODException.SwallowAnyException(() => {
                pref = Prefs.GetOne(prefName);
            });
            return(pref == null ? "" : pref.ValueString);
        }
Beispiel #3
0
        ///<Summary>Gets a pref of type bool, but will not throw an exception if null or not found.  Indicate whether the silent default is true or false.</Summary>
        public static bool GetBoolSilent(PrefName prefName, bool silentDefault)
        {
            if (Prefs.DictIsNull())
            {
                return(silentDefault);
            }
            Pref pref = null;

            ODException.SwallowAnyException(() => {
                pref = Prefs.GetOne(prefName);
            });
            return(pref == null ? silentDefault : PIn.Bool(pref.ValueString));
        }
Beispiel #4
0
 ///<summary>Used by an outside developer.</summary>
 public static bool HListIsNull()
 {
     return(Prefs.DictIsNull());
 }