Esempio n. 1
0
 internal PictureOptions()
 {
     this.MaxSize       = int.MaxValue;
     this.MaxPictures   = int.MaxValue;
     this.MaxResolution = GlobalSettings.HDPhotoDefaultSupportedResolution;
     this.userPhotoSize = PictureOptions.GetUserPhotoSize(this.MaxResolution);
 }
Esempio n. 2
0
        internal static PictureOptions Parse(XmlNode pictureOptionsNode, StatusCode protocolError)
        {
            if (pictureOptionsNode == null)
            {
                return(null);
            }
            PictureOptions pictureOptions = new PictureOptions();

            foreach (object obj in pictureOptionsNode.ChildNodes)
            {
                XmlNode xmlNode = (XmlNode)obj;
                string  localName;
                if ((localName = xmlNode.LocalName) != null)
                {
                    if (!(localName == "MaxSize"))
                    {
                        if (!(localName == "MaxPictures"))
                        {
                            if (localName == "MaxResolution")
                            {
                                UserPhotoResolution userPhotoResolution;
                                if (!Enum.TryParse <UserPhotoResolution>(xmlNode.InnerText, out userPhotoResolution))
                                {
                                    throw new AirSyncPermanentException(protocolError, false)
                                          {
                                              ErrorStringForProtocolLogger = "InvalidMaxResolution"
                                          };
                                }
                                pictureOptions.MaxResolution = userPhotoResolution;
                                pictureOptions.userPhotoSize = PictureOptions.GetUserPhotoSize(userPhotoResolution);
                                continue;
                            }
                        }
                        else
                        {
                            int num;
                            if (!int.TryParse(xmlNode.InnerText, out num))
                            {
                                throw new AirSyncPermanentException(protocolError, false)
                                      {
                                          ErrorStringForProtocolLogger = "InvalidMaxPictures"
                                      };
                            }
                            pictureOptions.MaxPictures = num;
                            continue;
                        }
                    }
                    else
                    {
                        int num;
                        if (!int.TryParse(xmlNode.InnerText, out num))
                        {
                            throw new AirSyncPermanentException(protocolError, false)
                                  {
                                      ErrorStringForProtocolLogger = "InvalidMaxSize"
                                  };
                        }
                        pictureOptions.MaxSize = num;
                        continue;
                    }
                }
                throw new AirSyncPermanentException(protocolError, false)
                      {
                          ErrorStringForProtocolLogger = "UnexpectedPictureOption:" + xmlNode.Name
                      };
            }
            return(pictureOptions);
        }