private void ParseAddress() { Match m = _addressPattern.Value.Match(_address); if (!m.Success) { Logger.Fatal("ParseAddress: Invalid address \"{0}\"", _address); throw new InvalidOperationException("Invalid address"); } Top = new RowHelper(m.Groups["top"].Value); Left = new ColumnHelper(m.Groups["left"].Value); if (_address.Contains(":")) { Bottom = new RowHelper(m.Groups["bottom"].Value); Right = new ColumnHelper(m.Groups["right"].Value); } }
/// <summary> /// Normalizes the address by putting the top left cell first, /// the bottom right cell last. /// </summary> private void NormalizeAddress() { if (IsRectangle) { if (Top > Bottom) { RowHelper r = Top; Top = Bottom; Bottom = r; } if (Left > Right) { ColumnHelper c = Left; Left = Right; Right = c; } } }