public bool TryParse(string x, string y, FileRange xRange, FileRange yRange, out XmlComponentPoint componentPoint)
        {
            if (!TryParseComponentPosition(x, xRange, out var relativeToX, out var remainingX))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseOffsets(remainingX, OffsetAxis.X, xRange, out var xOffsets))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseComponentPosition(y, yRange, out var relativeToY, out var remainingY))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseOffsets(remainingY, OffsetAxis.Y, yRange, out var yOffsets))
            {
                componentPoint = null;
                return(false);
            }

            var offsets = xOffsets.Concat(yOffsets).ToList();

            componentPoint = new XmlComponentPoint(relativeToX, relativeToY, offsets);
            return(true);
        }
Exemple #2
0
 public XmlConnectionDescription(
     ConnectionName name,
     XmlComponentPoint start,
     XmlComponentPoint end,
     ConditionalCollection <ConnectionEdge> edge)
 {
     Name  = name;
     Start = start;
     End   = end;
     Edge  = edge;
 }
        public bool TryParse(string point, FileRange range, out XmlComponentPoint componentPoint)
        {
            if (!TryParseComponentPosition(point, range, out var relativeTo, out var remaining))
            {
                componentPoint = null;
                return(false);
            }

            if (!TryParseOffsets(remaining, null, range, out var offsets))
            {
                componentPoint = null;
                return(false);
            }

            componentPoint = new XmlComponentPoint(relativeTo, relativeTo, offsets);
            return(true);
        }
 public static bool TryParse(this IComponentPointParser parser, XAttribute location, out XmlComponentPoint componentPoint)
 {
     return(parser.TryParse(location.Value, location.GetFileRange(), out componentPoint));
 }
 public static bool TryParse(this IComponentPointParser parser, XAttribute x, XAttribute y, out XmlComponentPoint componentPoint)
 {
     return(parser.TryParse(x.Value, y.Value, x.GetFileRange(), y.GetFileRange(), out componentPoint));
 }