Пример #1
0
        internal static WindowsPhoneStoreServiceAppCapabilitiesNode ParseXml(XmlReader reader)
        {
            var node = new WindowsPhoneStoreServiceAppCapabilitiesNode();

            var capabilities         = new List <WindowsPhoneStoreServiceAppCapabilityNode>();
            var hardwareCapabilities = new List <WindowsPhoneStoreServiceAppHwCapabilityNode>();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    switch (reader.Name)
                    {
                    case "capability":
                        capabilities.Add(WindowsPhoneStoreServiceAppCapabilityNode.ParseXml(reader));
                        break;

                    case "hwCapability":
                        hardwareCapabilities.Add(WindowsPhoneStoreServiceAppHwCapabilityNode.ParseXml(reader));
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
            }

            node.Capabilities         = capabilities.ToArray();
            node.HardwareCapabilities = hardwareCapabilities.ToArray();

            return(node);
        }
        internal static WindowsPhoneStoreServiceAppCapabilitiesNode ParseXml(XmlReader reader)
        {
            var node = new WindowsPhoneStoreServiceAppCapabilitiesNode();

            var capabilities = new List<WindowsPhoneStoreServiceAppCapabilityNode>();
            var hardwareCapabilities = new List<WindowsPhoneStoreServiceAppHwCapabilityNode>();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    switch (reader.Name)
                    {
                        case "capability":
                            capabilities.Add(WindowsPhoneStoreServiceAppCapabilityNode.ParseXml(reader));
                            break;

                        case "hwCapability":
                            hardwareCapabilities.Add(WindowsPhoneStoreServiceAppHwCapabilityNode.ParseXml(reader));
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
            }

            node.Capabilities = capabilities.ToArray();
            node.HardwareCapabilities = hardwareCapabilities.ToArray();

            return node;
        }
Пример #3
0
        internal static WindowsPhoneStoreServiceAppEntryNode ParseXml(XmlReader reader)
        {
            var node = new WindowsPhoneStoreServiceAppEntryNode();

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                case "a:updated":
                    node.Updated = reader.ReadElementContentAsNullable <DateTime>();
                    break;

                case "a:title":
                    node.Title = WindowsPhoneStoreServiceAppContentNode.ParseXml(reader);
                    break;

                case "a:id":
                    node.Id = reader.ReadElementContentAsUrn();
                    break;

                case "version":
                    node.Version = reader.ReadElementContentAsString();
                    break;

                case "payloadId":
                    node.PayloadId = reader.ReadElementContentAsUrn();
                    break;

                case "skuId":
                    node.SkuId = reader.ReadElementContentAsUrn();
                    break;

                case "skuLastUpdated":
                    node.SkuLastUpdated = reader.ReadElementContentAsNullable <DateTime>();
                    break;

                case "isAvailableInCountry":
                    node.IsAvailableInCountry = reader.ReadElementContentAsBoolean();
                    break;

                case "isAvailableInStore":
                    node.IsAvailableInStore = reader.ReadElementContentAsBoolean();
                    break;

                case "isClientTypeCompatible":
                    node.IsClientTypeCompatible = reader.ReadElementContentAsBoolean();
                    break;

                case "isHardwareCompatible":
                    node.IsHardwareCompatible = reader.ReadElementContentAsBoolean();
                    break;

                case "isBlacklisted":
                    node.IsBlacklisted = reader.ReadElementContentAsBoolean();
                    break;

                case "url":
                    node.Url = reader.ReadElementContentAsString();
                    break;

                case "packageSize":
                    node.PackageSize = reader.ReadElementContentAsInt();
                    break;

                case "installSize":
                    node.InstallSize = reader.ReadElementContentAsInt();
                    break;

                case "clientTypes":
                    node.ClientTypes = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                    break;

                case "supportedLanguages":
                    node.SupportedLanguages = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
                    break;

                case "deviceCapabilities":
                    var deviceCapabilitiesString = reader.ReadElementContentAsString();

                    if (!string.IsNullOrEmpty(deviceCapabilitiesString))
                    {
                        deviceCapabilitiesString = string.Format("<root>{0}</root>", deviceCapabilitiesString);

                        using (var stringReader = new StringReader(deviceCapabilitiesString))
                        {
                            using (var reader2 = XmlReader.Create(stringReader))
                            {
                                reader2.ReadStartElement();

                                node.DeviceCapabilities = WindowsPhoneStoreServiceAppCapabilitiesNode.ParseXml(reader2);

                                reader2.ReadEndElement();
                            }
                        }
                    }
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }

            reader.ReadEndElement();

            return(node);
        }