diff options
author | Ian C <ianc@noddybox.co.uk> | 2012-04-29 23:05:51 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2012-04-29 23:05:51 +0000 |
commit | e0df170a198f6b875fbbe37a7fa8a3c5fdf3aa5c (patch) | |
tree | 19a50de8b19a311b61111ef5d608b2d519f4e753 /Native/EmuKeyboardDesigner | |
parent | 0232442759a7bc0254e1bc2afa852df448f09cb8 (diff) |
Adding driver and test project.
Diffstat (limited to 'Native/EmuKeyboardDesigner')
-rw-r--r-- | Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo | bin | 50176 -> 50176 bytes | |||
-rw-r--r-- | Native/EmuKeyboardDesigner/MainForm.cs | 21 |
2 files changed, 13 insertions, 8 deletions
diff --git a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo Binary files differindex aa47a7d..db01de5 100644 --- a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo +++ b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo diff --git a/Native/EmuKeyboardDesigner/MainForm.cs b/Native/EmuKeyboardDesigner/MainForm.cs index 36144b9..33ebd22 100644 --- a/Native/EmuKeyboardDesigner/MainForm.cs +++ b/Native/EmuKeyboardDesigner/MainForm.cs @@ -86,17 +86,15 @@ namespace EmuKeyboardDesigner {
OpenFileDialog fsel = new OpenFileDialog();
- fsel.Filter = "XML Files(*.XML)|*.XML";
+ fsel.Filter = "Keyboard Files (*.keyboard)|*.keyboard";
if (fsel.ShowDialog() == DialogResult.OK)
{
try
{
- XmlDocument xml = new XmlDocument();
+ BinaryReader stream = new BinaryReader(File.OpenRead(fsel.FileName), Encoding.UTF8);
- xml.Load(fsel.FileName);
-
- KeyboardDefinition def = KeyboardDefinition.CreateFromXML(xml);
+ KeyboardDefinition def = KeyboardDefinition.Load(stream);
keyList.Items.Clear();
@@ -109,6 +107,9 @@ namespace EmuKeyboardDesigner {
keyList.SelectedIndex = 0;
}
+
+ stream.Close();
+ stream.Dispose();
}
catch (Exception ex)
{
@@ -121,7 +122,8 @@ namespace EmuKeyboardDesigner {
SaveFileDialog fsel = new SaveFileDialog();
- fsel.Filter = "XML Files(*.XML)|*.XML";
+ fsel.Filter = "Keyboard Files (*.keyboard)|*.keyboard";
+ fsel.AddExtension = true;
if (fsel.ShowDialog() == DialogResult.OK)
{
@@ -134,9 +136,12 @@ namespace EmuKeyboardDesigner def.Definitions.Add(k);
}
- XmlDocument doc = def.CreateXML();
+ BinaryWriter stream = new BinaryWriter(File.Create(fsel.FileName), Encoding.UTF8);
+
+ def.Save(stream);
- doc.Save(fsel.FileName);
+ stream.Close();
+ stream.Dispose();
}
catch (Exception ex)
{
|