コード例 #1
0
        public override void Initialize(XElement node, DirectoryInfo outputDir)
        {
            Addresses = new List <string>();
            Parts     = new List <MmsPart>();

            foreach (XAttribute tmpAttr in node.Attributes())
            {
                if (tmpAttr.Name == "date")
                {
                    MessageDate = GetDate(tmpAttr.Value);
                }

                if (tmpAttr.Name == "address")
                {
                    Address = GetAddress(tmpAttr.Value);
                }

                if (tmpAttr.Name == "contact_name")
                {
                    ContactName = tmpAttr.Value;
                }

                if (tmpAttr.Name == "name")
                {
                    Name = tmpAttr.Value;
                }
            }


            foreach (XElement tmpElement in node.Elements())
            {
                if (tmpElement.Name == "addrs")
                {
                    if (tmpElement != null)
                    {
                        foreach (XElement tmpAddress in tmpElement.Elements())
                        {
                            if (tmpAddress.Name == "addr")
                            {
                                foreach (XAttribute tmpAddrAttr in tmpAddress.Attributes())
                                {
                                    if (tmpAddrAttr.Name == "address")
                                    {
                                        Addresses.Add(GetAddress(tmpAddrAttr.Value));
                                    }
                                }
                            }
                        }
                    }
                }
                else if (tmpElement.Name == "parts")
                {
                    if (tmpElement != null)
                    {
                        int partIndex = 0;

                        foreach (XElement tmpPart in tmpElement.Elements())
                        {
                            if (tmpPart.Name == "part")
                            {
                                Parts.Add(MmsPart.Create(this, tmpPart, outputDir, partIndex));
                            }
                        }
                    }
                }
            }
        }