Пример #1
0
        /// <summary>
        /// get cardinal index from offset string name (ie: 12 from "Buttons55")
        /// </summary>
        /// <param name="offsetName"></param>
        /// <returns></returns>
        public static int GetIndex(string offsetName)
        {
            if (!IndexLookup.ContainsKey(offsetName))
            {
                throw new ArgumentOutOfRangeException($"JoystickOffset does not contain the name: {offsetName}.");
            }

            IndexLookup.TryGetValue(offsetName, out var o);
            return(o);
        }
Пример #2
0
        public Boolean TryGetValue(
            String key,
            out PipelineContextData value)
        {
            if (m_list?.Count > 0 &&
                IndexLookup.TryGetValue(key, out var index))
            {
                value = m_list[index].Value;
                return(true);
            }

            value = null;
            return(false);
        }
Пример #3
0
        public PipelineContextData this[String key]
        {
            get
            {
                var index = IndexLookup[key];
                return(m_list[index].Value);
            }

            set
            {
                // Existing
                if (IndexLookup.TryGetValue(key, out var index))
                {
                    key           = m_list[index].Key; // preserve casing
                    m_list[index] = new DictionaryContextDataPair(key, value);
                }
                // New
                else
                {
                    Add(key, value);
                }
            }
        }