Пример #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;
            }
        }