コード例 #1
0
        public Format.Schema.CheckV1 Serialize()
        {
            Format.Schema.CheckV1 check = new Format.Schema.CheckV1();

            var querySerialized = this.Queries.Select(q => q.Serialize());

            check.Queries.AddRange(querySerialized);

            return(check);
        }
コード例 #2
0
        static public Either <Errors.FormatError, Check> DeserializeV1(Format.Schema.CheckV1 check)
        {
            IList <Rule> queries = new List <Rule>();

            foreach (Format.Schema.RuleV1 query in check.Queries)
            {
                Either <Errors.FormatError, Rule> res = Rule.DeserializeV1(query);
                if (res.IsLeft)
                {
                    return(res.Left);
                }
                else
                {
                    queries.Add(res.Right);
                }
            }

            return(new Check(queries));
        }