Exemplo n.º 1
0
        public static void SaveFromPluginFile(string strPluginFileElement, Character character, SINner mySINnerLoading = null)
        {
            if (character == null)
            {
                throw new ArgumentNullException(nameof(character));
            }
            if (string.IsNullOrEmpty(strPluginFileElement))
            {
                return;
            }
            CharacterExtended objReturn = new CharacterExtended(character, mySINnerLoading, new CharacterCache(), false);

            objReturn.MyCharacterCache.LoadFromFile(character.FileName);
            try
            {
                if (!s_dicCachedPluginFileSINners.TryGetValue(strPluginFileElement, out SINner objSiNner))
                {
                    objSiNner = JsonConvert.DeserializeObject <SINner>(strPluginFileElement);
                    s_dicCachedPluginFileSINners.AddOrUpdate(strPluginFileElement, objSiNner, (x, y) => objSiNner);
                }

                objReturn.MySINnerFile = objSiNner;
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            SaveSINnerIds();
        }
Exemplo n.º 2
0
        public void OnException(object sender, FirstChanceExceptionEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            //Notes down the line number of every first chance exception.
            //Then counts the occurrences. Should make it easier to find what throws the most exceptions
            StackTrace trace = new StackTrace(e.Exception, true);

            StackFrame frame = trace.GetFrame(0);

            // This kind of resolves a crash due to other applications querying Chummer's frames.
            // Specifically, the NVDA screen reader. See https://github.com/chummer5a/chummer5a/issues/1888
            // In theory shouldn't mask any existing issues?
            if (frame == null)
            {
                return;
            }
            string heat = string.Format(GlobalSettings.InvariantCultureInfo, "{0}:{1}", frame.GetFileName(), frame.GetFileLineNumber());

            _map.AddOrUpdate(heat, 1, (a, b) => b + 1);
        }