Beispiel #1
0
        public ClassMap(Type sourceType, Type targetType)
        {
            SourceType         = sourceType;
            TargetType         = targetType;
            SourceTypeName     = sourceType.Name;
            TargetTypeName     = targetType.Name;
            SourceTypeFullName = sourceType.FullName.Replace("+", ".");
            TargetTypeFullName = targetType.FullName.Replace("+", ".");
            SourceVariable     = Char.ToLower(SourceTypeName[0]) + SourceTypeName.Substring(1);
            TargetVariable     = Char.ToLower(TargetTypeName[0]) + TargetTypeName.Substring(1);

            var sourceProperties = SourceType.GetProperties().Select(x => new Prop(x));
            var targetProperties = TargetType.GetProperties().Select(x => new Prop(x));

            PropMaps = sourceProperties
                       .Join(targetProperties, s => s.Name, t => t.Name, (s, t) => new PropMap(s, t))
                       .Select(x => x)
                       .ToList();
        }
        /*public int CompareTo(object obj)
         * {
         *  if (this == obj)
         *      return 0;
         *
         *  PdfTagPattern input = (obj as PdfTagPattern);
         *
         *  if (input == null)
         *      throw new ArgumentException("Parámetro de tipo incorrecto.");
         *
         *  if (MatchesCount > input.MatchesCount)
         *      return -1;
         *  else
         *      return 1;
         *
         * }*/

        /// <summary>
        /// Determina si el objeto especificado es igual al objeto actual.
        /// </summary>
        /// <param name="obj">Objeto que se va a comparar con el objeto actual.</param>
        /// <returns>Es true si el objeto especificado es igual al objeto actual;
        /// en caso contrario, es false.</returns>
        public override bool Equals(object obj)
        {
            PdfTagPattern input = (obj as PdfTagPattern);

            if (input == null)
            {
                throw new ArgumentException("Parámetro de tipo incorrecto.");
            }

            bool equalsRectangle = false;

            if (SourceTypeName.Equals("ColorFontWordGroupsInfos"))
            {
                if (CFType == input.CFType)
                {
                    if (CFType == "X")
                    {
                        if (PdfRectangle.Llx == input.PdfRectangle.Llx || PdfRectangle.Urx == input.PdfRectangle.Urx)
                        {
                            equalsRectangle = true;
                        }
                    }
                    else if (CFType == "Y")
                    {
                        if (PdfRectangle.Lly == input.PdfRectangle.Lly || PdfRectangle.Ury == input.PdfRectangle.Ury)
                        {
                            equalsRectangle = true;
                        }
                    }
                    else
                    {
                        equalsRectangle = true;
                    }
                }
            }
            else if (PdfRectangle == null)
            {
                if (input.PdfRectangle == null)
                {
                    equalsRectangle = true;
                }
            }
            else
            {
                equalsRectangle = PdfRectangle.Equals(input.PdfRectangle);
            }

            if (SourceTypeName.Equals("ColorFontWordGroupsInfos")) // Comprobamos que las propiedades del ColorFontWordGroups sean las mismas.
            {
                return(MetadataItemName == input.MetadataItemName &&
                       PdfPageN == input.PdfPageN &&
                       IsLastPage == input.IsLastPage &&
                       equalsRectangle &&
                       RegexPattern == input.RegexPattern &&
                       Position == input.Position &&
                       SourceTypeName == input.SourceTypeName &&
                       FillColor == input.FillColor &&
                       StrokeColor == input.StrokeColor &&
                       FontName == input.FontName &&
                       FontSize == input.FontSize &&
                       CFType == input.CFType);
            }
            else
            {
                return(MetadataItemName == input.MetadataItemName &&
                       PdfPageN == input.PdfPageN &&
                       IsLastPage == input.IsLastPage &&
                       equalsRectangle &&
                       RegexPattern == input.RegexPattern &&
                       Position == input.Position &&
                       SourceTypeName == input.SourceTypeName);
            }
        }
Beispiel #3
0
 SendEventOut(SourceTypeName, EventType, EventName, StateInfo);