Skip to content

Commit

Permalink
Merge pull request #35 from harliq/PositionsFix
Browse files Browse the repository at this point in the history
Was using int32 for cellid, and cell ids can be higher.
  • Loading branch information
harliq authored Feb 14, 2021
2 parents 05ab1a8 + 99cab92 commit 7736f30
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion WeenieFab/WeenieFab/DataTables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void CreateDataTable()
DataColumn positionDescription = new DataColumn("Description");

positionType.DataType = Type.GetType("System.Int32");
cellID.DataType = Type.GetType("System.Int32");
cellID.DataType = Type.GetType("System.Int64");

xOrigin.DataType = Type.GetType("System.Single");
yOrigin.DataType = Type.GetType("System.Single");
Expand Down
2 changes: 1 addition & 1 deletion WeenieFab/WeenieFab/Decode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public static DataTable DecodePositions(string blob, string pattern)
DataRow dr = tempDataTable.NewRow();

dr[0] = MainWindow.ConvertToInteger(match.Groups[2].ToString());
dr[1] = MainWindow.ConvertToInteger(match.Groups[3].ToString());
dr[1] = MainWindow.ConvertToLong(match.Groups[3].ToString());

dr[2] = MainWindow.ConvertToFloat(match.Groups[4].ToString());
dr[3] = MainWindow.ConvertToFloat(match.Groups[5].ToString());
Expand Down
9 changes: 6 additions & 3 deletions WeenieFab/WeenieFab/EventsButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ private void btnAddPosition_Click(object sender, RoutedEventArgs e)

dr[0] = ConvertToInteger(cbPosition.SelectedIndex.ToString());

dr[1] = ConvertToInteger(tbCellID.Text);
dr[1] = ConvertToLong(tbCellID.Text);

dr[2] = ConvertToFloat(tbOriginX.Text);
dr[3] = ConvertToFloat(tbOriginY.Text);
Expand All @@ -1223,7 +1223,7 @@ private void btnUpdatePosition_Click(object sender, RoutedEventArgs e)

dr[0] = ConvertToInteger(cbPosition.SelectedIndex.ToString());

dr[1] = ConvertToInteger(tbCellID.Text);
dr[1] = ConvertToLong(tbCellID.Text);

dr[2] = ConvertToFloat(tbOriginX.Text);
dr[3] = ConvertToFloat(tbOriginY.Text);
Expand Down Expand Up @@ -1262,7 +1262,10 @@ private void btnUseLoc_Click(object sender, RoutedEventArgs e)
var match = Regex.Match(tbPositionLoc.Text, rgxPattern);
string tloc = match.Groups[1].ToString().Replace("0x", "");

int loc = int.Parse(tloc, System.Globalization.NumberStyles.HexNumber);
// long loc = int64.Parse(tloc, System.Globalization.NumberStyles.HexNumber);

long loc = Convert.ToInt64(tloc, 16);


tbCellID.Text = loc.ToString();
tbOriginX.Text = match.Groups[2].ToString();
Expand Down
2 changes: 1 addition & 1 deletion WeenieFab/WeenieFab/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@
</Grid>
</TabItem>

<TabItem Header="Positions">
<TabItem Header="Positions" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Grid Background="#FFE1E8F5">
<Label Content="Position Type" HorizontalAlignment="Left" Margin="92,25,0,0" VerticalAlignment="Top"/>
<Label Content="Cell ID" HorizontalAlignment="Left" Margin="290,25,0,0" VerticalAlignment="Top"/>
Expand Down
9 changes: 9 additions & 0 deletions WeenieFab/WeenieFab/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ public static int ConvertToInteger(string text)
Int32.TryParse(text, out i);
return i;
}

public static long ConvertToLong(string text)
{
long i = 0;
Int64.TryParse(text, out i);
return i;
}


public static uint ConvertToUInteger(string text)
{
uint i = 0;
Expand Down
2 changes: 1 addition & 1 deletion WeenieFab/WeenieFab/TableToSql.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public static string ConvertPositionTable(DataTable dt, string wcid, string head
foreach (DataRow row in dt.Rows)
{

int loc = MainWindow.ConvertToInteger(row[1].ToString());
long loc = MainWindow.ConvertToLong(row[1].ToString());
string locHex = loc.ToString("X");

// string toriginX = string.Format("F6", row[2].ToString());
Expand Down
2 changes: 1 addition & 1 deletion WeenieFab/WeenieFab/WeenieFab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<Version>0.9.9.4</Version>
<Version>0.9.9.5</Version>
<ApplicationIcon>WeenieFabAppIcon.ico</ApplicationIcon>
</PropertyGroup>

Expand Down

0 comments on commit 7736f30

Please sign in to comment.