csharp/C1rdec/Poe-Lurker/src/Lurker/Helpers/TradeEventHelper.cs

TradeEventHelper.cs
//-----------------------------------------------------------------------
// 
//     Copyright © Wohs Inc.
// 
//-----------------------------------------------------------------------

namespace Lurker.Helpers
{
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.RegularExpressions;

    /// 
    /// Represents the trade event helper.
    /// 
    public static clast TradeEventHelper
    {
        #region Fields

        private static List _regexes = new List
        {
            "@.+Hi, I would like to buy.+", // english
            "@.+안녕하세요,.+구매하고 싶습니다", // korean
            "@.+Здравствуйте, хочу купить у вас.+", // russian
            "@.+สวัสดี, เราต้องการจะชื้อของคุณ.+", // thai
            "@.+Bonjour, je souhaiterais t'acheter.+", // french
            "@.+Hi, ich möchte.+kaufen.+", // german
            "@.+Olá, eu gostaria de comprar o seu item.+", // portuguese
            "@.+Hola, quisiera comprar tu.+", // spanish
        };

        #endregion

        #region Properties

        /// 
        /// Determines whether [is trade message] [the specified message].
        /// 
        /// The message.
        /// 
        ///   true if [is trade message] [the specified message]; otherwise, false.
        /// 
        public static bool IsTradeMessage(string message)
        {
            if (string.IsNullOrEmpty(message))
            {
                return false;
            }

            return _regexes.Any(pattern => Regex.Match(message, pattern).Success);
        }

        #endregion
    }
}