예제 #1
0
        public override bool Equals(object obj)
        {
            var je = obj as JournalEntry;

            if (je == null)
            {
                return(false);
            }

            bool ret =
                SourcePageType.Equals(je.SourcePageType) &&
                ((Parameter == null && je.Parameter == null) ||
                 (Parameter.Equals(je.Parameter)));

            return(ret);
        }
예제 #2
0
        public override int GetHashCode()
        {
            int hash = 17;

            if (Parameter != null)
            {
                hash = hash * 23 + Parameter.GetHashCode();
            }
            else
            {
                hash = hash * 23;
            }

            hash = hash * 23 + SourcePageType.GetHashCode();

            return(hash);
        }
예제 #3
0
        /// <summary>
        /// Formats a string that has the format ThisIsAClassName and formats in a friendly way
        /// </summary>
        /// <param name="value">string value</param>
        /// <returns>Friendly string value</returns>
        internal static string FormatAsFriendlyTitle(this SourcePageType value)
        {
            var charArr = value.ToString().ToCharArray();
            var result  = new StringBuilder();

            for (var i = 0; i < charArr.Length; i++)
            {
                if (char.IsUpper(charArr[i]))
                {
                    result.Append($" {charArr[i]}");
                }
                else
                {
                    result.Append(charArr[i]);
                }
            }

            // Convert to string and remove space at start
            return(result.ToString().TrimStart(' '));
        }