public static void debug(string message, DBMErrorLevel level = DBMErrorLevel.EncounterErrors, Exception ex = null)
 {
     EncounterController.debug(message, level, ex);
 }
        static void trySetup()
        {
            if (Constants.GameLanguage == null || CurrentUser == null || _targetEntity == null || CurrentUser.HPMax == 0 || zone.Index == 0)
            {
                return;
            }

            try
            {

                if (youGainDict.ContainsKey(Constants.GameLanguage))
                {
                    youGain = youGainDict[Constants.GameLanguage];
                }
                if (youLoseDict.ContainsKey(Constants.GameLanguage))
                {
                    youLose = youLoseDict[Constants.GameLanguage];
                }
                if (youSufferDict.ContainsKey(Constants.GameLanguage))
                {
                    youSuffer = youSufferDict[Constants.GameLanguage];
                }
                if (youRecoverDict.ContainsKey(Constants.GameLanguage))
                {
                    youRecover = youRecoverDict[Constants.GameLanguage];
                }
                if (sealedOffDict.ContainsKey(Constants.GameLanguage))
                {
                    sealedOff = sealedOffDict[Constants.GameLanguage];
                }

                if (youGain == null)
                {
                    youGain = new Replacements(null, "");
                }
                if (youLose == null)
                {
                    youLose = new Replacements(null, "");
                }
                if (youSuffer == null)
                {
                    youSuffer = new Replacements(null, "");
                }
                if (youRecover == null)
                {
                    youRecover = new Replacements(null, "");
                }

                testString = new Regex(@"\!testing");
                repeatString = new Regex(@"\@(.*)");
                endString = new Regex(@"\!end");

                try
                {
                    EncounterController.speechVolume = int.Parse(Settings.Default.VoiceVolume);
                }
                catch
                {
                    EncounterController.speechVolume = 100;
                }
                try
                {
                    EncounterController.errorLevel = (DBMErrorLevel)Enum.Parse(typeof(DBMErrorLevel), Settings.Default.DebugLogLevel);
                }
                catch
                {
                    EncounterController.errorLevel = DBMErrorLevel.EncounterInfo;
                }

                compileScripts();

                debug("DBM Ready, speech volume: " + speechVolume);

            }
            catch (Exception e2)
            {
                debug("trySetup", DBMErrorLevel.EngineErrors, e2);
            }
            setupDone = true;
        }
 public static void debug(string message, DBMErrorLevel level = DBMErrorLevel.EncounterErrors, Exception ex = null)
 {
     EncounterController.debug(message, level, ex);
 }
        public static void debug(string message, DBMErrorLevel level = DBMErrorLevel.EncounterErrors, Exception ex = null)
        {
            try
            {
                if (level >= errorLevel)
                {
                    var timeStampColor = Settings.Default.TimeStampColor.ToString();
                    DateTime now = DateTime.Now.ToUniversalTime();
                    string debugInfo = "): ";
                    string timeStamp = "[" + now.ToShortDateString() + " " + now.Hour + ":" + now.Minute.ToString("D2") + ":" + now.Second.ToString("D2") + ":" + now.Millisecond.ToString("D3") + "] ";
                    string line = "";

                    if (ex != null)
                    {
                        StackTrace st = new StackTrace(ex, true);
                        // Get the top stack frame
                        StackFrame frame = st.GetFrame(0);

                        debugInfo = ":" + frame.GetFileName() + ":" + frame.GetMethod() + ":" + frame.GetFileLineNumber() + ":" + frame.GetFileColumnNumber() + ": " + ex.Message + "): ";
                    }


                    line = timeStamp + "(" + Enum.GetName(typeof(DBMErrorLevel),level) + debugInfo + message;

                    File.AppendAllText(debugLogPath, line + Environment.NewLine);

                    FFXIVAPP.Common.Constants.FD.AppendFlow(timeStamp, "", line, new[]
                    {
                        timeStampColor, "#FFFFFF"
                    }, MainView.View.ChatLogFD._FDR);
                }
            }
            catch (Exception ex2)
            {
                debug("Debug Error", DBMErrorLevel.EngineErrors, ex2);
            }
        }