chore : replaced var with explicit types
This commit is contained in:
parent
b344b6a03f
commit
64841332e0
4 changed files with 34 additions and 33 deletions
|
|
@ -16,14 +16,14 @@ public static class CoordinateParser
|
|||
throw new ArgumentException("canvas_rect cannot be null or empty.");
|
||||
}
|
||||
|
||||
var parts = rect.Split(':');
|
||||
string[] parts = rect.Split(':');
|
||||
if (parts.Length != 2)
|
||||
{
|
||||
throw new ArgumentException("Invalid canvas_rect format.");
|
||||
}
|
||||
|
||||
var (row1, col1) = ParseSingleCoordinate(parts[0]);
|
||||
var (row2, col2) = ParseSingleCoordinate(parts[1]);
|
||||
(int row1, int col1) = ParseSingleCoordinate(parts[0]);
|
||||
(int row2, int col2) = ParseSingleCoordinate(parts[1]);
|
||||
|
||||
return (
|
||||
Math.Min(row1, row2),
|
||||
|
|
@ -35,14 +35,14 @@ public static class CoordinateParser
|
|||
|
||||
private static (int Row, int Col) ParseSingleCoordinate(string coord)
|
||||
{
|
||||
var match = CoordRegex.Match(coord);
|
||||
Match match = CoordRegex.Match(coord);
|
||||
if (!match.Success)
|
||||
{
|
||||
throw new ArgumentException($"Invalid coordinate format: {coord}");
|
||||
}
|
||||
|
||||
var rowStr = match.Groups[1].Value.ToUpper();
|
||||
var colStr = match.Groups[2].Value;
|
||||
string rowStr = match.Groups[1].Value.ToUpper();
|
||||
string colStr = match.Groups[2].Value;
|
||||
|
||||
int row = rowStr.Length == 1 ? rowStr[0] - 'A' : 26 + (rowStr[1] - 'A');
|
||||
int col = int.Parse(colStr) - 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue