コード例 #1
0
ファイル: AuntSue.cs プロジェクト: FUNCTOR99/AOC
        private void ParseInput(String input)
        {
            input = input.Trim() + ",";

            AuntSueNumber = Convert.ToInt32(StringOps.ParameterAfter(input, "Sue", ":").Trim());

            if (input.Contains("children"))
            {
                Children = Convert.ToInt32(StringOps.ParameterAfter(input, "children:", ",").Trim());
            }
            else
            {
                Children = -1;
            }

            if (input.Contains("cats"))
            {
                Cats = Convert.ToInt32(StringOps.ParameterAfter(input, "cats:", ",").Trim());
            }
            else
            {
                Cats = -1;
            }

            if (input.Contains("samoyeds"))
            {
                Samoyeds = Convert.ToInt32(StringOps.ParameterAfter(input, "samoyeds:", ",").Trim());
            }
            else
            {
                Samoyeds = -1;
            }

            if (input.Contains("pomeranians"))
            {
                Pomeranians = Convert.ToInt32(StringOps.ParameterAfter(input, "pomeranians:", ",").Trim());
            }
            else
            {
                Pomeranians = -1;
            }

            if (input.Contains("akitas"))
            {
                Akitas = Convert.ToInt32(StringOps.ParameterAfter(input, "akitas:", ",").Trim());
            }
            else
            {
                Akitas = -1;
            }

            if (input.Contains("vizslas"))
            {
                Vizslas = Convert.ToInt32(StringOps.ParameterAfter(input, "vizslas:", ",").Trim());
            }
            else
            {
                Vizslas = -1;
            }

            if (input.Contains("goldfish"))
            {
                Goldfish = Convert.ToInt32(StringOps.ParameterAfter(input, "goldfish:", ",").Trim());
            }
            else
            {
                Goldfish = -1;
            }

            if (input.Contains("trees"))
            {
                Trees = Convert.ToInt32(StringOps.ParameterAfter(input, "trees:", ",").Trim());
            }
            else
            {
                Trees = -1;
            }

            if (input.Contains("cars"))
            {
                Cars = Convert.ToInt32(StringOps.ParameterAfter(input, "cars:", ",").Trim());
            }
            else
            {
                Cars = -1;
            }

            if (input.Contains("perfumes"))
            {
                Perfumes = Convert.ToInt32(StringOps.ParameterAfter(input, "perfumes:", ",").Trim());
            }
            else
            {
                Perfumes = -1;
            }
        }