Exemple #1
0
 private ActionMapsCls(ActionMapsCls other)
 {
     this.version = other.version;
     this.m_js    = other.m_js;
     this.m_GUIDs = other.m_GUIDs;
     // other ref objects are not populated here
 }
        /// <summary>
        /// Copy return all ActionMaps while reassigning the JsN Tag
        /// </summary>
        /// <param name="newJsList">The JsN reassign list</param>
        /// <returns>The ActionMaps copy with reassigned input</returns>
        public ActionMapsCls ReassignJsN(JsReassingList newJsList)
        {
            ActionMapsCls newMaps = new ActionMapsCls(m_joystickList);

            // full copy from 'this'

            newMaps.m_uiCustHeader  = this.m_uiCustHeader;
            newMaps.m_deviceOptions = this.m_deviceOptions;
            newMaps.m_optionTree    = this.m_optionTree;
            newMaps.m_modifiers     = this.m_modifiers;

            for (int i = 0; i < JoystickCls.JSnum_MAX; i++)
            {
                newMaps.jsN[i] = this.jsN[i]; newMaps.jsNGUID[i] = this.jsNGUID[i];
            }

            foreach (ActionMapCls am in this)
            {
                newMaps.Add(am.ReassignJsN(newJsList));
            }

            //m_options.ReassignJsN( newJsList );

            return(newMaps);
        }
Exemple #3
0
        /// <summary>
        /// Read the xml part
        /// </summary>
        /// <param name="xr"></param>
        /// <returns></returns>
        private Boolean ReadXML(XmlReader xr)
        {
            log.Debug("ReadXML - Entry");

            Boolean retVal = true;

            if (ActionMapsCls.ActionMaps.Length == 0)
            {
                ActionMapsCls.LoadSupportedActionMaps( );                                   // make sure we have them loaded ( refactoring to get a singleton or so...)
            }
            try {
                do
                {
                    if (xr.IsStartElement( ))
                    {
                        m_nodeNameStack.Push(xr.Name);
                        if (xr.IsEmptyElement)
                        {
                            retVal = retVal && ReadEmptyElement(xr);
                            m_nodeNameStack.Pop( ); // empty ones end inline
                        }
                        else
                        {
                            retVal = retVal && ReadElement(xr);
                        }
                    }
                    else if (xr.NodeType == XmlNodeType.EndElement)
                    {
                        //Console.Write( "</{0}>\n", xr.Name );
                        String exitElement = m_nodeNameStack.Pop( );
                        if (m_state == EState.inActionMap)
                        {
                            if (exitElement.ToLower( ) == "actionmap")
                            {
                                m_state = EState.idle;                            // finished
                            }
                        }
                    }
                } while (xr.Read( ));

                if (m_nodeNameStack.Count == 0)
                {
                    return(retVal && true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex) {
                // get any exceptions from reading
                log.Error("ReadXML - unexpected", ex);
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// Copy return all ActionMaps while reassigning the JsN Tag
        /// </summary>
        /// <param name="newJsList">The JsN reassign list</param>
        /// <returns>The ActionMaps copy with reassigned input</returns>
        public ActionMapsCls ReassignJsN(JsReassingList newJsList)
        {
            var newMaps = new ActionMapsCls(this);

            newMaps.m_uiCustHeader  = ( UICustHeader )this.m_uiCustHeader.Clone( );
            newMaps.m_tuningOptions = ( Tuningoptions )this.m_tuningOptions.Clone( );
            newMaps.m_deviceOptions = ( Deviceoptions )this.m_deviceOptions.Clone( );

            foreach (ActionMapCls am in this)
            {
                newMaps.Add(am.ReassignJsN(newJsList)); // creates the deep copy of the tree
            }
            // remap the tuning options
            newMaps.m_tuningOptions.ReassignJsN(newJsList);

            return(newMaps);
        }