Пример #1
0
        /// <summary>
        /// 別の集団を選択する
        /// <paramref name="aggregationName"/>集団が存在しない場合は新しく生成する
        /// </summary>
        /// <param name="aggregationName">集団名</param>
        public static void ChangeAggregation(string aggregationName)
        {
            if (HasAggregation(aggregationName) == false)
            {
                Aggregations.Add(aggregationName, new Aggregation(null, aggregationName));
            }

            CurrentAggregationName = aggregationName;
        }
Пример #2
0
        private Ingestion DeserializeAggregations(XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    string     name    = reader.LocalName;
                    CFXmlModel model   = null;
                    string     strGuid = reader.GetAttribute("guid");
                    switch (name)
                    {
                    case "collection":
                        model = new CFCollection();
                        break;

                    case "item":
                        model = new CFItem();
                        break;

                    case "form":
                        model = new Form();
                        break;

                    case "file":
                        model = new CFDataFile();
                        break;

                    default:
                        throw new FormatException("Invalid XML element: " + reader.Name);
                    }

                    if (model != null)
                    {
                        model.Guid       = strGuid;
                        model.MappedGuid = strGuid;
                        model.Content    = reader.ReadOuterXml();
                        Aggregations.Add(model);
                    }
                }

                if (reader.NodeType == System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.Name == "aggregations")
                    {
                        return(this);
                    }
                }
            }

            return(this);
        }
Пример #3
0
        private Ingestion DeserializeAggregations(XElement element)
        {
            foreach (XElement child in element.Elements())
            {
                string     name    = child.Name.LocalName;
                CFXmlModel model   = null;
                string     strGuid = child.Attribute("guid").Value;
                switch (name)
                {
                case "collection":
                    model = new CFCollection();
                    break;

                case "item":
                    model = new CFItem();
                    break;

                case "form":
                    model = new Form();
                    break;

                case "file":
                    model = new CFDataFile();
                    break;
                }

                if (model != null)
                {
                    model.Guid       = strGuid;
                    model.MappedGuid = strGuid;
                    model.Content    = child.ToString();
                    Aggregations.Add(model);
                }
            }
            return(this);
        }