Beispiel #1
0
        public static void Load()
        {
            try
            {
                if (File.Exists(ExceptionDetectorUpdated.SettingsFile))
                {
                    var node = ConfigNode.Load(ExceptionDetectorUpdated.SettingsFile);
                    if (node == null)
                    {
                        return;
                    }

                    var root = node.GetNode("ExceptionDetectorUpdated");
                    if (root == null)
                    {
                        return;
                    }

                    var settings = root.GetNode("Config");
                    if (settings == null)
                    {
                        return;
                    }

                    var singleNode = settings.GetNode(_singlePass);
                    if (singleNode != null)
                    {
                        ConvertToDictionary(singleNode, ExceptionDetectorUpdated.SinglePassValues);
                    }
                    var doubleNode = settings.GetNode(_doublePass);
                    if (doubleNode != null)
                    {
                        ConvertToDictionary(doubleNode, ExceptionDetectorUpdated.DoublePassValues);
                    }

                    var set = settings.GetValue(_showFullLog);
                    if (bool.TryParse(set, out var settf))
                    {
                        ExceptionDetectorUpdated.FullLog = settf;
                    }

                    var knowns = settings.GetValue(_hideKnowns);
                    if (bool.TryParse(knowns, out var knowntf))
                    {
                        ExceptionDetectorUpdated.HideKnowns = knowntf;
                    }

                    var shInfo = settings.GetValue(_showInfoMessage);
                    if (bool.TryParse(shInfo, out var llmtf))
                    {
                        ExceptionDetectorUpdated.ShowInfoMessage = llmtf;
                    }
                }
                Save();
            }
            catch (Exception ex)
            {
                ExceptionDetectorUpdated.WriteLog(ex.ToString());
            }
        }
Beispiel #2
0
 public static void Save()
 {
     try
     {
         var node     = new ConfigNode();
         var root     = node.AddNode("ExceptionDetectorUpdated");
         var settings = root.AddNode("Config");
         settings.AddValue(_showFullLog, ExceptionDetectorUpdated.FullLog);
         settings.AddValue(_hideKnowns, ExceptionDetectorUpdated.HideKnowns);
         settings.AddValue(_showInfoMessage, ExceptionDetectorUpdated.ShowInfoMessage);
         var sNode = settings.AddNode(ConvertFromDictionary(_singlePass, ExceptionDetectorUpdated.SinglePassValues));
         var dNode = settings.AddNode(ConvertFromDictionary(_doublePass, ExceptionDetectorUpdated.DoublePassValues));
         node.Save(ExceptionDetectorUpdated.SettingsFile);
     }
     catch (Exception ex)
     {
         ExceptionDetectorUpdated.WriteLog(ex.ToString());
     }
 }