Skip to content

Commit

Permalink
Merge pull request #11 from Foglio1024/master
Browse files Browse the repository at this point in the history
Small UX changes
  • Loading branch information
GoneUp authored Sep 24, 2020
2 parents 1e01cf2 + 7bf05a2 commit 13ca17c
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions GPK_RePack/Forms/GUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ private void btnExport_Click(object sender, EventArgs e)
return;
}

var path = MiscFuncs.GenerateSaveDialog(selectedExport.ObjectName, ".raw");
var path = MiscFuncs.GenerateSaveDialog(selectedExport.ObjectName, "");
if (path == "") return;
DataTools.WriteExportDataFile(path, selectedExport);
}
Expand All @@ -761,7 +761,7 @@ private void btnExport_Click(object sender, EventArgs e)
{
if (exp.Data != null)
{
DataTools.WriteExportDataFile(String.Format("{0}\\{1}.raw", dialog.SelectedPath, exp.ObjectName), exp);
DataTools.WriteExportDataFile(String.Format("{0}\\{1}", dialog.SelectedPath, exp.ObjectName), exp);
logger.Trace("save for " + exp.UID);
}
}
Expand All @@ -781,7 +781,7 @@ private void btnExport_Click(object sender, EventArgs e)
{
if (exp.Data != null)
{
DataTools.WriteExportDataFile(String.Format("{0}\\{1}\\{2}.raw", dialog.SelectedPath, exp.ClassName, exp.ObjectName), exp);
DataTools.WriteExportDataFile(String.Format("{0}\\{1}\\{2}", dialog.SelectedPath, exp.ClassName, exp.ObjectName), exp);
logger.Trace("save for " + exp.UID);
}
}
Expand Down Expand Up @@ -1748,6 +1748,20 @@ private void DrawGrid(GpkPackage package, GpkExport export)
{
GpkArrayProperty tmpArray = (GpkArrayProperty)prop;
valueCell.Value = tmpArray.GetValueHex();
row.ContextMenuStrip = new ContextMenuStrip();
row.ContextMenuStrip.Items.Add(
new ToolStripButton("Export", null,
(sender, args) =>
{
BigBytePropExport(tmpArray);
}));
row.ContextMenuStrip.Items.Add(
new ToolStripButton("Import", null,
(sender, args) =>
{
BigBytePropImport(tmpArray);
})
);
}
else if (prop is GpkStructProperty)
{
Expand Down Expand Up @@ -2010,11 +2024,15 @@ private IProperty readProperty(DataGridViewRow row)
private void BigBytePropExport_Click(object sender, EventArgs e)
{
var arrayProp = checkArrayRow();
BigBytePropExport(arrayProp);
}
private void BigBytePropExport(GpkArrayProperty arrayProp)
{
if (arrayProp == null || arrayProp.value == null) return;
byte[] data = new byte[arrayProp.value.Length - 4];
Array.Copy(arrayProp.value, 4, data, 0, arrayProp.value.Length - 4); //remove count bytes

String path = MiscFuncs.GenerateSaveDialog(arrayProp.name, ".raw");
String path = MiscFuncs.GenerateSaveDialog(arrayProp.name, "");
if (path == "") return;

DataTools.WriteExportDataFile(path, data);
Expand All @@ -2023,6 +2041,10 @@ private void BigBytePropExport_Click(object sender, EventArgs e)
private void BigBytePropImport_Click(object sender, EventArgs e)
{
var arrayProp = checkArrayRow();
BigBytePropImport(arrayProp);
}
private void BigBytePropImport(GpkArrayProperty arrayProp)
{
if (arrayProp == null) return;

String[] files = MiscFuncs.GenerateOpenDialog(false, this);
Expand Down Expand Up @@ -2227,7 +2249,7 @@ private void saveSingleGpkPackage()

#endregion


}
}

Expand Down

0 comments on commit 13ca17c

Please sign in to comment.