public void LoadDefault() { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(KeyMaps)); StringReader sr = new StringReader(Properties.Resources._default); KeyMaps maps = (KeyMaps)serializer.Deserialize(sr); sr.Close(); keylist = new List <KeyMap>(maps.KeyMap); keylist[0].InUse = true; }
public void SaveMapList() { KeyMaps maps = new KeyMaps(); maps.KeyMap = keylist.ToArray(); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(KeyMaps)); System.IO.StreamWriter sw = new System.IO.StreamWriter( GetSettingFilePath(), false, new System.Text.UTF8Encoding(false)); serializer.Serialize(sw, maps); sw.Close(); }
private void LoadMapList() { string path = GetSettingFilePath(); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(KeyMaps)); KeyMaps maps = null; if (File.Exists(path)) { FileStream fs = new FileStream(path, FileMode.Open); maps = (KeyMaps)serializer.Deserialize(fs); fs.Close(); } else { StringReader sr = new StringReader(Properties.Resources._default); maps = (KeyMaps)serializer.Deserialize(sr); sr.Close(); } keylist = new List <KeyMap>(maps.KeyMap); keylist[0].InUse = true; }