public void LogException(string type, string exceptionDescription, Exception exception, bool restartCore)
        {
            try
            {
                string fullExceptionDescription = t.PrintException(exceptionDescription, exception);
                if (fullExceptionDescription.Contains("Message    :Core is not running"))
                {
                    return;
                }

                LogLogic(new LogEntry(-1, type, fullExceptionDescription));
                LogVariable(type, nameof(restartCore), restartCore);

                ExceptionClass exCls = new ExceptionClass(fullExceptionDescription, DateTime.Now);
                exceptionLst.Add(exCls);

                int sameExceptionCount    = CheckExceptionLst(exCls);
                int sameExceptionCountMax = 0;

                foreach (var item in exceptionLst)
                {
                    if (sameExceptionCountMax < item.Occurrence)
                    {
                        sameExceptionCountMax = item.Occurrence;
                    }
                }

                if (restartCore)
                {
                    core.Restart(sameExceptionCount, sameExceptionCountMax, false);
                }
            }
            catch { }
        }
        private int CheckExceptionLst(ExceptionClass exceptionClass)
        {
            int count = 0;

            #region find count
            try
            {
                //remove Exceptions older than an hour
                for (int i = exceptionLst.Count; i < 0; i--)
                {
                    if (exceptionLst[i].Time < DateTime.Now.AddHours(-1))
                    {
                        exceptionLst.RemoveAt(i);
                    }
                }

                //keep only the last 12 Exceptions
                while (exceptionLst.Count > 12)
                {
                    exceptionLst.RemoveAt(0);
                }

                //find court of the same Exception
                if (exceptionLst.Count > 0)
                {
                    string thisOne = t.Locate(exceptionClass.Description, "######## EXCEPTION FOUND; BEGIN ########", "######## EXCEPTION FOUND; ENDED ########");

                    foreach (ExceptionClass exCls in exceptionLst)
                    {
                        string fromLst = t.Locate(exCls.Description, "######## EXCEPTION FOUND; BEGIN ########", "######## EXCEPTION FOUND; ENDED ########");

                        if (thisOne == fromLst)
                        {
                            count++;
                        }
                    }
                }
            }
            catch { }
            #endregion

            exceptionClass.Occurrence = count;
            LogStandard(t.GetMethodName("Log"), count + ". time the same Exception, within the last hour");
            return(count);
        }