allow import / export data from RIFF Chunk Properties dialog
This commit is contained in:
parent
7f5b45ee3c
commit
08f6182fcf
@ -2,6 +2,26 @@
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="margin_right">8</property>
|
||||
<property name="margin_top">8</property>
|
||||
<property name="margin_bottom">8</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="margin_right">8</property>
|
||||
<property name="margin_top">8</property>
|
||||
<property name="margin_bottom">8</property>
|
||||
<property name="stock">gtk-save</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="tmChunkType">
|
||||
<columns>
|
||||
<!-- column-name colChunkTypeName -->
|
||||
@ -185,7 +205,10 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image1</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -194,12 +217,15 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="cmdImportData1">
|
||||
<object class="GtkButton" id="cmdExportData">
|
||||
<property name="label" translatable="yes">Export...</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image2</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="always_show_image">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
@ -24,6 +24,7 @@ using System;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
using MBS.Framework.UserInterface.Controls.HexEditor;
|
||||
using MBS.Framework.UserInterface.Dialogs;
|
||||
using UniversalEditor.ObjectModels.Chunked;
|
||||
|
||||
namespace UniversalEditor.Editors.RIFF.Dialogs
|
||||
@ -45,8 +46,6 @@ namespace UniversalEditor.Editors.RIFF.Dialogs
|
||||
{
|
||||
base.OnCreated(e);
|
||||
|
||||
cboChunkType.Changed += cboChunkType_Changed;
|
||||
|
||||
Buttons[0].ResponseValue = (int)DialogResult.None;
|
||||
Buttons[0].Click += cmdOK_Click;
|
||||
DefaultButton = Buttons[0];
|
||||
@ -88,7 +87,8 @@ namespace UniversalEditor.Editors.RIFF.Dialogs
|
||||
this.Close();
|
||||
}
|
||||
|
||||
void cboChunkType_Changed(object sender, EventArgs e)
|
||||
[EventHandler("cboChunkType", "Changed")]
|
||||
private void cboChunkType_Changed(object sender, EventArgs e)
|
||||
{
|
||||
if (cboChunkType.SelectedItem == (cboChunkType.Model as DefaultTreeModel).Rows[0])
|
||||
{
|
||||
@ -106,5 +106,28 @@ namespace UniversalEditor.Editors.RIFF.Dialogs
|
||||
}
|
||||
}
|
||||
|
||||
[EventHandler("cmdImportData", "Click")]
|
||||
private void cmdImportData_Click(object sender, EventArgs e)
|
||||
{
|
||||
FileDialog dlg = new FileDialog();
|
||||
dlg.Mode = FileDialogMode.Open;
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
hexData.Data = System.IO.File.ReadAllBytes(dlg.SelectedFileName);
|
||||
}
|
||||
}
|
||||
|
||||
[EventHandler("cmdExportData", "Click")]
|
||||
private void cmdExportData_Click(object sender, EventArgs e)
|
||||
{
|
||||
FileDialog dlg = new FileDialog();
|
||||
dlg.Mode = FileDialogMode.Save;
|
||||
dlg.SelectedFileName = txtChunkID.Text;
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(dlg.SelectedFileName, hexData.Data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user