// 19Apr2013-05:58UTC chinajade
        public static void DeprecationWarning_Behavior(CustomForcedBehavior cfb, string newBehaviorName, List <Tuple <string, string> > replacementAttributes)
        {
            if (QuestBehaviorCoreSettings.Instance.LogNotifyOn_OnDeprecatedBehaviorUse)
            {
                var oldLoggingContext = QBCLog.BehaviorLoggingContext;

                QBCLog.BehaviorLoggingContext = cfb;

                string attributes =
                    string.Join(" ", replacementAttributes.Select(t => string.Format("{0}=\"{1}\"", t.Item1, t.Item2)));

                QBCLog.Warning(QBCLog.BuildMessageWithContext(cfb.Element,
                                                              "{0}/********************{0}DEPRECATED BEHAVIOR ({1}){0}"
                                                              + "The {1} behavior has been deprecated, but will continue to function as originally designed."
                                                              + "  Please replace the use of the {1} behavior with the {2} behavior.{0}"
                                                              + "The replacement command to accomplish this task is:{0}    {3}",
                                                              Environment.NewLine,
                                                              cfb.GetType().Name,
                                                              newBehaviorName,
                                                              string.Format("<CustomBehavior File=\"{0}\" {1} />", newBehaviorName, attributes))
                               + Environment.NewLine
                               + "********************/"
                               + Environment.NewLine);

                AudibleNotifyOn(QuestBehaviorCoreSettings.Instance.AudibleNotify_OnDeprecatedBehaviorUse);
                QBCLog.BehaviorLoggingContext = oldLoggingContext;
            }
        }
        public override RunStatus Tick(object context)
        {
            try
            {
                return(base.Tick(context));
            }

            catch (Exception except)
            {
                if (except.GetType() != typeof(ThreadAbortException))
                {
                    var message = QBCLog.BuildMessageWithContext(_questBehaviorBase.Element,
                                                                 "{0} EXCEPTION CONTEXT ({1}):",
                                                                 QBCLog.VersionedBehaviorName,
                                                                 except.GetType().Name);

                    if (QuestBehaviorCoreSettings.Instance.LogProfileContextOnExceptions)
                    {
                        QBCLog.Error(message);
                        SystemSounds.Asterisk.Play();
                    }
                    else
                    {
                        QBCLog.DeveloperInfo(message);
                    }
                }

                throw;
            }
        }
        // 19Apr2013-05:58UTC chinajade
        public void UsageCheck_SemanticCoherency(XElement xElement, bool incoherencyPredicate, ProvideStringDelegate messageDelegate)
        {
            if (incoherencyPredicate)
            {
                QBCLog.Error(QBCLog.BuildMessageWithContext(xElement,
                                                            "PROFILE ERROR: {0}",
                                                            UtilFormatMessage(messageDelegate(null))));
                IsAttributeProblem = true;

                AudibleNotifyOn(QuestBehaviorCoreSettings.Instance.AudibleNotify_OnSemanticIncoherency);
            }
        }
        // 19Apr2013-05:58UTC chinajade
        public void UsageCheck_DeprecatedAttribute(XElement xElement, bool deprecatedAttributeEncounteredPredicate,
                                                   string attributeName, ProvideStringDelegate messageDelegate)
        {
            if (QuestBehaviorCoreSettings.Instance.LogNotifyOn_OnDeprecatedAttributeUse)
            {
                if (deprecatedAttributeEncounteredPredicate)
                {
                    QBCLog.Warning(QBCLog.BuildMessageWithContext(xElement,
                                                                  "DEPRECATED ATTRIBUTE ({1}):{0}{2}",
                                                                  Environment.NewLine,
                                                                  attributeName,
                                                                  UtilFormatMessage(messageDelegate(null))));

                    AudibleNotifyOn(QuestBehaviorCoreSettings.Instance.AudibleNotify_OnDeprecatedAttributeUse);
                }
            }
        }
        // 19Apr2013-05:58UTC chinajade
        public static void UsageCheck_ScheduledForDeprecation(CustomForcedBehavior cfb, string replacementBehaviorName)
        {
            if (QuestBehaviorCoreSettings.Instance.LogNotifyOn_OnScheduledForDeprecation)
            {
                var oldLoggingContext = QBCLog.BehaviorLoggingContext;

                QBCLog.BehaviorLoggingContext = cfb;
                QBCLog.Warning(QBCLog.BuildMessageWithContext(cfb.Element,
                                                              "SCHEDULED FOR DEPRECATION ({1}){0}"
                                                              + "Please replace the behavior with \"{2}\"",
                                                              Environment.NewLine,
                                                              cfb.GetType().Name,
                                                              replacementBehaviorName));

                AudibleNotifyOn(true);
                QBCLog.BehaviorLoggingContext = oldLoggingContext;
            }
        }