public static string GetString(this MatchMethod matchMethod)
		{
			switch (matchMethod)
			{
				case MatchMethod.Full:
					return "full";
				case MatchMethod.Contains:
					return "contains";
				case MatchMethod.Starts:
					return "starts";
				case MatchMethod.Ends:
					return "ends";
				default:
					throw new ArgumentOutOfRangeException(nameof(matchMethod), matchMethod, null);
			}
		}
Beispiel #2
0
        static FunctionMethodCreator()
        {
            methodList = new Dictionary<string, FunctionMethod>();
            //キャラクタデータ系
            methodList["GETCHARA"] = new GetcharaMethod();
            methodList["GETSPCHARA"] = new GetspcharaMethod();
            methodList["CSVNAME"] = new CsvStrDataMethod(CharacterStrData.NAME);
            methodList["CSVCALLNAME"] = new CsvStrDataMethod(CharacterStrData.CALLNAME);
            methodList["CSVNICKNAME"] = new CsvStrDataMethod(CharacterStrData.NICKNAME);
            methodList["CSVMASTERNAME"] = new CsvStrDataMethod(CharacterStrData.MASTERNAME);
            methodList["CSVCSTR"] = new CsvcstrMethod();
            methodList["CSVBASE"] = new CsvDataMethod(CharacterIntData.BASE);
            methodList["CSVABL"] = new CsvDataMethod(CharacterIntData.ABL);
            methodList["CSVMARK"] = new CsvDataMethod(CharacterIntData.MARK);
            methodList["CSVEXP"] = new CsvDataMethod(CharacterIntData.EXP);
            methodList["CSVRELATION"] = new CsvDataMethod(CharacterIntData.RELATION);
            methodList["CSVTALENT"] = new CsvDataMethod(CharacterIntData.TALENT);
            methodList["CSVCFLAG"] = new CsvDataMethod(CharacterIntData.CFLAG);
            methodList["CSVEQUIP"] = new CsvDataMethod(CharacterIntData.EQUIP);
            methodList["CSVJUEL"] = new CsvDataMethod(CharacterIntData.JUEL);
            methodList["FINDCHARA"] = new FindcharaMethod(false);
            methodList["FINDLASTCHARA"] = new FindcharaMethod(true);
            methodList["EXISTCSV"] = new ExistCsvMethod();

            //汎用処理系
            methodList["VARSIZE"] = new VarsizeMethod();
            methodList["CHKFONT"] = new CheckfontMethod();
            methodList["CHKDATA"] = new CheckdataMethod("CHKDATA", EraSaveFileType.Normal);
            methodList["ISSKIP"] = new IsSkipMethod();
            methodList["MOUSESKIP"] = new MouseSkipMethod();
            methodList["GETCOLOR"] = new GetColorMethod(false);
            methodList["GETDEFCOLOR"] = new GetColorMethod(true);
            methodList["GETFOCUSCOLOR"] = new GetFocusColorMethod();
            methodList["GETBGCOLOR"] = new GetBGColorMethod(false);
            methodList["GETDEFBGCOLOR"] = new GetBGColorMethod(true);
            methodList["GETSTYLE"] = new GetStyleMethod();
            methodList["GETFONT"] = new GetFontMethod();
            methodList["BARSTR"] = new BarStringMethod();
            methodList["CURRENTALIGN"] = new CurrentAlignMethod();
            methodList["CURRENTREDRAW"] = new CurrentRedrawMethod();

            methodList["CHKVARDATA"] = new CheckdataMethod("CHKVARDATA", EraSaveFileType.Var);
            methodList["CHKCHARADATA"] = new CheckdataMethod("CHKCHARADATA", EraSaveFileType.CharVar);
            //methodList["CHKGLOBALDATA"] = new CheckdataMethod("CHKGLOBALDATA", EraSaveFileType.Global);

            //定数取得
            methodList["MONEYSTR"] = new MoneyStrMethod();
            methodList["PRINTCPERLINE"] = new GetPrintCPerLineMethod();
            methodList["SAVENOS"] = new GetSaveNosMethod();
            methodList["GETTIME"] = new GettimeMethod();
            methodList["GETTIMES"] = new GettimesMethod();
            methodList["GETMILLISECOND"] = new GetmsMethod();
            methodList["GETSECOND"] = new GetSecondMethod();

            //数学関数
            methodList["RAND"] = new RandMethod();
            methodList["MIN"] = new MaxMethod(false);
            methodList["MAX"] = new MaxMethod(true);
            methodList["ABS"] = new AbsMethod();
            methodList["POWER"] = new PowerMethod();
            methodList["SQRT"] = new SqrtMethod();
            methodList["CBRT"] = new CbrtMethod();
            methodList["LOG"] = new LogMethod();
            methodList["LOG10"] = new LogMethod(10.0d);
            methodList["EXPONENT"] = new ExpMethod();
            methodList["SIGN"] = new SignMethod();
            methodList["LIMIT"] = new GetLimitMethod();

            //変数操作系
            methodList["SUMARRAY"] = new SumArrayMethod();
            methodList["SUMCARRAY"] = new SumArrayMethod(true);
            methodList["MATCH"] = new MatchMethod();
            methodList["CMATCH"] = new MatchMethod(true);
            methodList["GROUPMATCH"] = new GroupMatchMethod();
            methodList["NOSAMES"] = new NosamesMethod();
            methodList["ALLSAMES"] = new AllsamesMethod();
            methodList["MAXARRAY"] = new MaxArrayMethod();
            methodList["MAXCARRAY"] = new MaxArrayMethod(true);
            methodList["MINARRAY"] = new MaxArrayMethod(false, false);
            methodList["MINCARRAY"] = new MaxArrayMethod(true, false);
            methodList["GETBIT"] = new GetbitMethod();
            methodList["GETNUM"] = new GetnumMethod();
            methodList["GETPALAMLV"] = new GetPalamLVMethod();
            methodList["GETEXPLV"] = new GetExpLVMethod();
            methodList["FINDELEMENT"] = new FindElementMethod(false);
            methodList["FINDLASTELEMENT"] = new FindElementMethod(true);
            methodList["INRANGE"] = new InRangeMethod();
            methodList["INRANGEARRAY"] = new InRangeArrayMethod();
            methodList["INRANGECARRAY"] = new InRangeArrayMethod(true);

            //文字列操作系
            methodList["STRLENS"] = new StrlenMethod();
            methodList["STRLENSU"] = new StrlenuMethod();
            methodList["SUBSTRING"] = new SubstringMethod();
            methodList["SUBSTRINGU"] = new SubstringuMethod();
            methodList["STRFIND"] = new StrfindMethod(false);
            methodList["STRFINDU"] = new StrfindMethod(true);
            methodList["STRCOUNT"] = new StrCountMethod();
            methodList["TOSTR"] = new ToStrMethod();
            methodList["TOINT"] = new ToIntMethod();
            methodList["TOUPPER"] = new StrChangeStyleMethod(StrFormType.Upper);
            methodList["TOLOWER"] = new StrChangeStyleMethod(StrFormType.Lower);
            methodList["TOHALF"] = new StrChangeStyleMethod(StrFormType.Half);
            methodList["TOFULL"] = new StrChangeStyleMethod(StrFormType.Full);
            methodList["LINEISEMPTY"] = new LineIsEmptyMethod();
            methodList["REPLACE"] = new ReplaceMethod();
            methodList["UNICODE"] = new UnicodeMethod();
            methodList["UNICODEBYTE"] = new UnicodeByteMethod();
            methodList["CONVERT"] = new ConvertIntMethod();
            methodList["ISNUMERIC"] = new IsNumericMethod();
            methodList["ESCAPE"] = new EscapeMethod();
            methodList["ENCODETOUNI"] = new EncodeToUniMethod();
            methodList["CHARATU"] = new CharAtMethod();
            methodList["GETLINESTR"] = new GetLineStrMethod();
        }
Beispiel #3
0
 public void EndsWith(string arg, bool cc)
 {
     Method = MatchMethod.EndsWith;
     SetArg(arg, cc);
 }
Beispiel #4
0
 public void StartsWith(string arg, bool cc)
 {
     Method = MatchMethod.StartsWith;
     SetArg(arg, cc);
 }
Beispiel #5
0
 public void Equals(string arg, bool cc)
 {
     Method = MatchMethod.Equals;
     SetArg(arg, cc);
 }
Beispiel #6
0
 public void Regex(string arg, bool cc)
 {
     Method = MatchMethod.Regex;
     SetArg(arg, cc);
 }
Beispiel #7
0
 public void Contains(string arg, bool cc)
 {
     Method = MatchMethod.Contains;
     SetArg(arg, cc);
 }
 /// <summary>
 /// Add an attribute name/value pair with a specific match method to use when searching
 /// </summary>
 public void Add(string name, string value, MatchMethod valueMatchMethod)
 {
     this.Add(new HtmlAttributeFindParams(name, value, valueMatchMethod));
 }
Beispiel #9
0
 /// <summary>
 /// Returns whether an element whose id or name matches the given string exists within this collection (recursive)
 /// </summary>
 /// <param name="id">The string to use when matching the element's id or name to find (case insensitive).</param>
 /// <param name="idMatchMethod">How to treat the string when matching it with the HtmlElement's id or name</param>
 /// <returns>True if an element is found, otherwise false</returns>
 public bool Exists(string id, MatchMethod idMatchMethod)
 {
     return(Exists(new HtmlElementFindParams(id, idMatchMethod)));
 }
Beispiel #10
0
 /// <summary>
 /// Recursively finds all the elements whose id or name matches the given string.
 /// </summary>
 /// <param name="id">The string to use when matching the element's id or name to find (case insensitive).</param>
 /// <param name="idMatchMethod">How to treat the string when matching it with the HtmlElement's id or name</param>
 /// <returns>A collection of  HtmlElements whose ids or names match the given string</returns>
 public ReadOnlyCollection <HtmlElement> FindAll(string id, MatchMethod idMatchMethod)
 {
     return(this.FindAll(new HtmlElementFindParams(id, idMatchMethod)));
 }
Beispiel #11
0
 /// <summary>
 /// Recursively finds the first element whose id or name matches the given string.
 /// </summary>
 /// <param name="id">The string to use when matching the element's id or name to find (case insensitive).</param>
 /// <param name="idMatchMethod">How to treat the string when matching it with the HtmlElement's id or name</param>
 /// <returns>The first HtmlElement whose id or name matches the given string</returns>
 /// <exception cref="ElementNotFoundException">Thrown if element not found</exception>
 public HtmlElement Find(string id, MatchMethod idMatchMethod)
 {
     return(this.Find(new HtmlElementFindParams(id, idMatchMethod)));
 }
Beispiel #12
0
        /// <summary>
        /// Determines if a given element matches a specific attribute
        /// </summary>
        private bool MatchSingleAttribute(HtmlElement element, string attributeName, string attributeValue, MatchMethod matchMethod)
        {
            bool isAttributeMatched = false;

            if (element.CachedAttributes.Dictionary.ContainsKey(attributeName))
            {
                string realAttributeValue = element.CachedAttributes.Dictionary[attributeName];

                switch (matchMethod)
                {
                case MatchMethod.Literal:
                    isAttributeMatched = String.Equals(realAttributeValue, attributeValue, StringComparison.OrdinalIgnoreCase);
                    break;

                case MatchMethod.EndsWith:
                    isAttributeMatched = realAttributeValue.EndsWith(attributeValue, StringComparison.OrdinalIgnoreCase);
                    break;

                case MatchMethod.Contains:
                    isAttributeMatched = realAttributeValue.Contains(attributeValue);
                    break;

                case MatchMethod.Regex:
                    isAttributeMatched = Regex.IsMatch(realAttributeValue, attributeValue, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.CultureInvariant);
                    break;
                }
            }

            return(isAttributeMatched);
        }
Beispiel #13
0
 /// <summary>
 /// Constructor to find an HtmlElement by its id or name (case insensitive)
 /// </summary>
 /// <param name="id">The id of the element to find</param>
 /// <param name="idMatchMethod">How to treat the string when matching it with the HtmlElement's id or name.</param>
 public HtmlElementFindParams(string id, MatchMethod idMatchMethod)
     : this()
 {
     _idAttributeFindParams.Value            = id;
     _idAttributeFindParams.ValueMatchMethod = idMatchMethod;
 }