Ejemplo n.º 1
0
        public Byte Axis(Ds3Axis Offset)
        {
            if (m_Detail.Model != DsModel.DS3)
            {
                throw new InvalidEnumArgumentException();
            }

            return(Native[(Int32)Offset]);
        }
Ejemplo n.º 2
0
 public Ds3AxisMap(Ds3Axis Name, Ds3Axis Value)
 {
     m_Name  = Name;
     m_Value = Value;
 }
Ejemplo n.º 3
0
        public virtual Boolean Construct(ref XmlDocument Map)
        {
            Boolean Constructed = true;

            try
            {
                XmlNode     Node;
                XmlDocument Doc = new XmlDocument();

                Node = Doc.CreateXmlDeclaration("1.0", "utf-8", String.Empty);
                Doc.AppendChild(Node);

                Node = Doc.CreateComment(String.Format(" ScpMapper Configuration Data. {0} ", DateTime.Now));
                Doc.AppendChild(Node);

                Node = Doc.CreateNode(XmlNodeType.Element, "ScpMapper", null);
                {
                    CreateTextNode(Doc, Node, "Description", "SCP Mapping File");
                    CreateTextNode(Doc, Node, "Version", Assembly.GetExecutingAssembly().GetName().Version.ToString());

                    XmlNode Mapping = Doc.CreateNode(XmlNodeType.Element, "Mapping", null);
                    {
                        foreach (Profile Item in m_Mapper.Values)
                        {
                            if (Item.Default)
                            {
                                CreateTextNode(Doc, Node, "Active", Item.Name);
                            }

                            XmlNode Profile = Doc.CreateNode(XmlNodeType.Element, "Profile", null);
                            {
                                CreateTextNode(Doc, Profile, "Name", Item.Name);
                                CreateTextNode(Doc, Profile, "Type", Item.Type);
                                CreateTextNode(Doc, Profile, "Value", Item.Qualifier);

                                XmlNode Ds3 = Doc.CreateNode(XmlNodeType.Element, DsModel.DS3.ToString(), null);
                                {
                                    XmlNode Button = Doc.CreateNode(XmlNodeType.Element, "Button", null);
                                    {
                                        foreach (Ds3Button Ds3Button in Item.Ds3Button.Keys)
                                        {
                                            CreateTextNode(Doc, Button, Ds3Button.ToString(), Item.Ds3Button[Ds3Button].ToString());
                                        }
                                    }
                                    Ds3.AppendChild(Button);

                                    XmlNode Axis = Doc.CreateNode(XmlNodeType.Element, "Axis", null);
                                    {
                                        foreach (Ds3Axis Ds3Axis in Item.Ds3Axis.Keys)
                                        {
                                            CreateTextNode(Doc, Axis, Ds3Axis.ToString(), Item.Ds3Axis[Ds3Axis].ToString());
                                        }
                                    }
                                    Ds3.AppendChild(Axis);
                                }
                                Profile.AppendChild(Ds3);

                                XmlNode Ds4 = Doc.CreateNode(XmlNodeType.Element, DsModel.DS4.ToString(), null);
                                {
                                    XmlNode Button = Doc.CreateNode(XmlNodeType.Element, "Button", null);
                                    {
                                        foreach (Ds4Button Ds4Button in Item.Ds4Button.Keys)
                                        {
                                            CreateTextNode(Doc, Button, Ds4Button.ToString(), Item.Ds4Button[Ds4Button].ToString());
                                        }
                                    }
                                    Ds4.AppendChild(Button);

                                    XmlNode Axis = Doc.CreateNode(XmlNodeType.Element, "Axis", null);
                                    {
                                        foreach (Ds4Axis Ds4Axis in Item.Ds4Axis.Keys)
                                        {
                                            CreateTextNode(Doc, Axis, Ds4Axis.ToString(), Item.Ds4Axis[Ds4Axis].ToString());
                                        }
                                    }
                                    Ds4.AppendChild(Axis);
                                }
                                Profile.AppendChild(Ds4);
                            }
                            Mapping.AppendChild(Profile);
                        }
                    }
                    Node.AppendChild(Mapping);
                }
                Doc.AppendChild(Node);

                Map = Doc;
            }
            catch { Constructed = false; }

            return(Constructed);
        }
Ejemplo n.º 4
0
        public virtual Boolean Initialize(XmlDocument Map)
        {
            try
            {
                m_Remapping = false; m_Mapper.Clear();

                XmlNode Node = Map.SelectSingleNode("/ScpMapper");

                m_Description = Node.SelectSingleNode("Description").FirstChild.Value;
                m_Version     = Node.SelectSingleNode("Version").FirstChild.Value;
                m_Active      = Node.SelectSingleNode("Active").FirstChild.Value;

                foreach (XmlNode ProfileNode in Node.SelectNodes("Mapping/Profile"))
                {
                    String Name = ProfileNode.SelectSingleNode("Name").FirstChild.Value;
                    String Type = ProfileNode.SelectSingleNode("Type").FirstChild.Value;

                    String Qualifier = String.Empty;

                    try
                    {
                        XmlNode QualifierNode = ProfileNode.SelectSingleNode("Value");

                        if (QualifierNode.HasChildNodes)
                        {
                            Qualifier = QualifierNode.FirstChild.Value;
                        }
                    }
                    catch { }

                    Profile Profile = new Profile(Name == m_Active, Name, Type, Qualifier);

                    try
                    {
                        foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Button"))
                        {
                            foreach (XmlNode Item in Mapping.ChildNodes)
                            {
                                Ds3Button Target = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.ParentNode.Name);
                                Ds3Button Mapped = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.Value);

                                Profile.Ds3Button[Target] = Mapped;
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Axis"))
                        {
                            foreach (XmlNode Item in Mapping.ChildNodes)
                            {
                                Ds3Axis Target = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.ParentNode.Name);
                                Ds3Axis Mapped = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.Value);

                                Profile.Ds3Axis[Target] = Mapped;
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Button"))
                        {
                            foreach (XmlNode Item in Mapping.ChildNodes)
                            {
                                Ds4Button Target = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.ParentNode.Name);
                                Ds4Button Mapped = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.Value);

                                Profile.Ds4Button[Target] = Mapped;
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Axis"))
                        {
                            foreach (XmlNode Item in Mapping.ChildNodes)
                            {
                                Ds4Axis Target = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.ParentNode.Name);
                                Ds4Axis Mapped = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.Value);

                                Profile.Ds4Axis[Target] = Mapped;
                            }
                        }
                    }
                    catch { }

                    m_Mapper[Profile.Name] = Profile;
                }

                Int32 Mappings = m_Mapper[m_Active].Ds3Button.Count + m_Mapper[m_Active].Ds3Axis.Count + m_Mapper[m_Active].Ds4Button.Count + m_Mapper[m_Active].Ds4Axis.Count;
                LogDebug(String.Format("## Mapper.Initialize() - Profiles [{0}] Active [{1}] Mappings [{2}]", m_Mapper.Count, m_Active, Mappings));

                m_Remapping = true;
            }
            catch { }

            return(m_Remapping);
        }
Ejemplo n.º 5
0
 public DSAxis(Ds3Axis parDs3Axis, Ds4Axis parDs4Axis, bool parTriggerHigh)
 {
     m_DS3 = parDs3Axis;
     m_DS4 = parDs4Axis;
     m_TriggerHigh = parTriggerHigh;
 }
Ejemplo n.º 6
0
        public byte Axis(Ds3Axis Offset)
        {
            if (m_Detail.Model != DsModel.DS3) throw new InvalidEnumArgumentException();

            return Native[(int)Offset];
        }
Ejemplo n.º 7
0
 public Ds3AxisMap(Ds3Axis Name, Ds3Axis Value)
 {
     m_Name = Name;
     m_Value = Value;
 }