Example #1
0
        /// <summary>
        /// Checks for equality of the given object with the current one
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>True if both objects are equal and false otherwise</returns>
        public override bool Equals(object obj)
        {
            // If the object is the exact this object
            if (obj == this)
            {
                return(true);
            }

            // If the given object is null then it can't be equal too
            if (obj == null)
            {
                return(false);
            }

            try
            {
                // Try to cast the object
                IonContent content = (IonContent)obj;

                // Check all elements for equality
                return(variation.Equals(content.variation) &&
                       outlet.Equals(content.outlet) &&
                       isSearchable.Equals(content.isSearchable) &&
                       position == content.position &&
                       type.Equals(content.type) &&
                       isAvailable == content.isAvailable);
            }

            catch
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// Searches the page for a text content with the given name and returns its text or an empty string, if the outlet wasn't found
        /// </summary>
        /// <param name="outlet"></param>
        /// <returns>String or emptyString</returns>
        public string getTextOrEmpty(string outlet)
        {
            IonContent content = getContent(outlet);

            if (content != null && content.GetType() == typeof(IonTextContent))
            {
                return(((IonTextContent)content).text);
            }

            return("");
        }