Ejemplo n.º 1
0
        public static int GetTotalTestCase(this SpojClient spojClient, string spojProblemCode)
        {
            var text    = spojClient.GetText(string.Format(SpojProblemInfoUrl, spojProblemCode));
            var matches = Regex.Matches(text.Trim(), "<option value=\"(\\d+)\">Modify testcase #\\d+</option>");

            var listNumber = new List <int>();

            foreach (Match match in matches)
            {
                try
                {
                    var value = int.Parse(match.Groups[1].Value);
                    listNumber.Add(value);
                }
                catch (Exception e)
                {
                    LogHepler.WriteCustomErrorLog(e, "Logger/SpojClient");
                }
            }

            return(listNumber.Max());
        }