示例#1
0
        /// <summary>
        ///   Read a string table.
        /// </summary>
        /// <param name = "lpRes">Pointer to the beginning of the string table.</param>
        /// <returns>Pointer to the end of the string table.</returns>
        internal override IntPtr Read(IntPtr lpRes)
        {
            _strings.Clear();
            var pChild = base.Read(lpRes);

            while (pChild.ToInt32() < (lpRes.ToInt32() + _header.wLength)) {
                var res = new StringTableEntry(pChild);
                _strings.Add(res.Key, res);
                pChild = ResourceUtil.Align(pChild.ToInt32() + res.Header.wLength);
            }

            return new IntPtr(lpRes.ToInt32() + _header.wLength);
        }
示例#2
0
        /// <summary>
        ///   Returns an entry within the string table.
        /// </summary>
        /// <param name = "key">Key.</param>
        /// <returns>An entry within the string table.</returns>
        public string this[string key]
        {
            get {
                var v = _strings[key];
                return v == null ? null : _strings[key].Value;
            }
            set {
                StringTableEntry sr = null;
                if (!_strings.TryGetValue(key, out sr)) {
                    sr = new StringTableEntry(key);
                    _strings.Add(key, sr);
                }

                sr.Value = value;
            }
        }