Esempio n. 1
0
 private static void _ParseDateContains(string src, char contains, ref int[] dt)
 {
     string[] digits = src.Split(contains);
     if (digits.Length > 0)
     {
         for (int i = 0; i < digits.Length; i++)
         {
             if (digits[i].All(char.IsDigit))
             {
                 dt = CoCSeason._ParseDateDefault(digits[i], dt);
             }
         }
     }
 }
Esempio n. 2
0
            private static int[] _GetDate(int idx, string[] cmd)
            {
                int[] dt = { 0, 0 };

                if ((cmd.Length - 1) > idx)
                {
                    int max = ((cmd.Length > (idx + 2)) ? (idx + 2) : (idx + 1));
                    for (int i = max; i > idx; i--)
                    {
                        if (string.IsNullOrWhiteSpace(cmd[i]))
                        {
                            continue;
                        }
                        if (cmd[i].All(char.IsDigit))
                        {
                            dt = CoCSeason._ParseDateDefault(cmd[i], dt);
                        }
                        else if (cmd[i].Contains("-"))
                        {
                            CoCSeason._ParseDateContains(cmd[i], '-', ref dt);
                        }
                        else if (cmd[i].Contains("."))
                        {
                            CoCSeason._ParseDateContains(cmd[i], '.', ref dt);
                        }
                        if ((dt[0] > 0) && (dt[1] > 0))
                        {
                            break;
                        }
                    }
                }
                if ((dt[0] == 0) || (dt[1] == 0))
                {
                    int[] dtc = CoCSeason._GetSeasonDate();
                    dt[0] = ((dt[0] > 0) ? dt[0] : dtc[0]);
                    dt[1] = ((dt[1] > 0) ? dt[1] : dtc[1]);
                }
                return(dt);
            }