Esempio n. 1
0
        public static KeyStoreInfoCollection ReadStore(XmlElement xmlElement)
        {
            KeyStoreInfoCollection storeCollection = new KeyStoreInfoCollection();

            foreach (XmlElement childElement in xmlElement.ChildNodes.OfType <XmlElement>())
            {
                if (childElement.Name == KEY_STORE_INFO)
                {
                    try
                    {
                        KeyStoreInfo keyStore = new KeyStoreInfo();
                        switch ((KEY_TYPE)int.Parse(childElement.GetAttribute(KEY_STORE_TYPE)))
                        {
                        case KEY_TYPE.KEYBOARD:
                            keyStore.SetStoreValue((Keys)int.Parse(childElement.GetAttribute(KEY_STORE_VALUE)));
                            break;

                        case KEY_TYPE.JOYSTICK:
                            keyStore.SetStoreValue((JoystickButtons)int.Parse(childElement.GetAttribute(KEY_STORE_VALUE)));
                            break;
                        }
                        storeCollection.Add(keyStore);
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            return(storeCollection);
        }