From e0df170a198f6b875fbbe37a7fa8a3c5fdf3aa5c Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 29 Apr 2012 23:05:51 +0000 Subject: Adding driver and test project. --- Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo | Bin 50176 -> 50176 bytes Native/EmuKeyboardDesigner/MainForm.cs | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'Native') diff --git a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo index aa47a7d..db01de5 100644 Binary files a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo and b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo differ 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) { -- cgit v1.2.3