示例#1
0
 /// <summary>
 /// Saves the entire <see cref="Photocopier"/> to a XElement.
 /// </summary>
 /// <param name="elementName"> The element name. </param>
 /// <param name="photocopier"> The destination <see cref="Photocopier"/>. </param>
 public static XElement SavePhotocopier(string elementName, Photocopier photocopier)
 {
     return(new XElement
            (
                elementName,
                new XElement("Name", photocopier.Name),
                new XElement("FileType", photocopier.FileType),
                new XElement("FolderRelativeId", photocopier.FolderRelativeId)
            ));
 }
示例#2
0
        /// <summary>
        ///Returns a boolean indicating whether the given <see cref="Photocopier"/> is equal to this <see cref="Photo"/> instance.
        /// </summary>
        /// <param name="other"> The <see cref="Photocopier"/> to compare this instance to. </param>
        /// <returns> True if the other <see cref="Photocopier"/> is equal to this instance; False otherwise. </returns>
        public bool Equals(Photocopier other)
        {
            if (this.Name != other.Name)
            {
                return(false);
            }
            if (this.FileType != other.FileType)
            {
                return(false);
            }
            if (this.FolderRelativeId != other.FolderRelativeId)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        /// <summary>
        ///  Loads a <see cref="Photocopier"/> from an XElement.
        /// </summary>
        /// <param name="element"> The source XElement. </param>
        /// <returns> The loaded <see cref="Photocopier"/>. </returns>
        public static Photocopier LoadPhotocopier(XElement element)
        {
            Photocopier photocopier = new Photocopier();

            if (element.Element("Name") is XElement name)
            {
                photocopier.Name = name.Value;
            }
            if (element.Element("FileType") is XElement fileType)
            {
                photocopier.FileType = fileType.Value;
            }
            if (element.Element("FolderRelativeId") is XElement folderRelativeId)
            {
                photocopier.FolderRelativeId = folderRelativeId.Value;
            }

            return(photocopier);
        }
示例#4
0
        /// <summary>
        /// Find the first <see cref="Photo"/> by <see cref="Photocopier"/>.
        /// </summary>
        /// <param name="photocopier"> The source photocopier</param>
        /// <returns> The product photo. </returns>
        public static Photo FindFirstPhoto(Photocopier photocopier)
        {
            string id = photocopier.FolderRelativeId;

            return(Photo.Instances[id]);
        }