コード例 #1
0
        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;
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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;
        }