예제 #1
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var repo = KSoft.Debug.TypeCheck.CastReference <EngineBuildRepository>(s.UserData);

            if (s.IsReading)
            {
                Repository = repo;
            }
            else
            {
                Contract.Assert(repo == Repository);
            }

            using (s.EnterUserDataBookmark(this))
            {
                s.StreamAttribute("name", this, obj => obj.Name);
                s.StreamAttribute("project", this, obj => obj.ProjectName);

                EngineTargetPlatform.SerializeBitSet(s, ref mValidTargetPlatforms, "ValidTargetPlatforms");

                using (var bm = s.EnterCursorBookmarkOpt("Revisions", Revisions, Predicates.HasItems)) if (bm.IsNotNull)
                    {
                        s.StreamableElements("Rev", Revisions);
                    }
            }

            if (s.IsReading)
            {
                KSoft.Debug.ValueCheck.IsLessThanEqualTo("Too many registered branch revisions in " + Name,
                                                         EngineBuildRevision.kMaxCount, Revisions.Count);

                Revisions.TrimExcess();
            }
        }