예제 #1
0
        public static bool setVariableValueFromOffset(Type dataType, IOffset offset, string destination, dynamic vaProxy)
        {
            object value = offset.GetValue(dataType);

            if (dataType == typeof(float) || dataType == typeof(double))
            {
                vaProxy.SetDecimal(destination, value);
            }
            else if (dataType == typeof(int) || dataType == typeof(uint) ||
                     dataType == typeof(short) || dataType == typeof(ushort) ||
                     dataType == typeof(char) || dataType == typeof(byte) ||
                     dataType == typeof(long) || dataType == typeof(ulong))
            {
                vaProxy.SetInt(destination, Convert.ToInt32(value));
            }
            else if (dataType == typeof(bool))
            {
                vaProxy.SetBoolean(destination, value);
            }
            else
            {
                return(false); // Unspported data type
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Reads an offset which contains a string and updates a Text destination variable
        /// </summary>
        /// <param name="offsetAddress">address of offset</param>
        /// <param name="length">length the length of the string data</param>
        /// <param name="destinationVariable">the Text variable destination in VoiceAttack</param>
        public void readStringOffset(int offsetAddress, int length, string destinationVariable)
        {
            lock (m_connectionLock)
            {
                if (!m_isConnected)
                {
                    writeErrorToLog("Not connected");
                    return;
                }
            }

            IOffset offset = m_offsetFactory.createOffset(offsetAddress, length);

            m_fsuipc.Process();

            m_vaProxy.SetText(destinationVariable, offset.GetValue(typeof(string)));
        }