예제 #1
0
        private void SerializeBlockInfos(CDomContainer container)
        {
            CDomListSection blocksSection = container.CreateListSection(NODE_CIPSECTION);

            foreach (CBlockInPackageInfo info in BlocksInPackage)
            {
                CDomSection itemSection = blocksSection.CreateSection();

                itemSection.Set(NODE_LIST_NUMBER, info.Number);
                itemSection.Set(NODE_LIST_OFFSET, info.Offset);
                itemSection.Set(NODE_LIST_LENGTH, info.Length);
            }
        }
예제 #2
0
        public static void Serialize(TPersonForSerialization person, CDomContainer container)
        {
            container.Set("FirstName", person.FirstName);
            container.Set("LastName", person.LastName);
            container.Set("Age", person.Age);
            container.Set("Weight", person.Weight);
            container.Set("Height", person.Height);

            CDomSection section = container.CreateSection("Employee");
            section.Set("Company", person.EmployeeInfo.CompanyName);
            section.Set("EmployeeId", person.EmployeeInfo.EmployeeId);
            section.Set("Position", person.EmployeeInfo.Position);

            CDomListSection listSection = container.CreateListSection("children");

            foreach (TPersonChildren child in person.PersonChildrens)
            {
                CDomSection childSection = listSection.CreateSection();
                childSection.Set("Name", child.Name);
                childSection.Set("Age", child.Age);
                childSection.Set("Gender", (Int32)child.Gender);
            }
        }