/// <summary>
 /// Write the menu item to a binary stream.
 /// </summary>
 /// <param name="w">Binary stream.</param>
 internal override void Write(BinaryWriter w)
 {
     base.Write(w);
     ResourceUtil.PadToDWORD(w);
     w.Write(_dwHelpId);
     _subMenuItems.Write(w);
 }
Example #2
0
        /// <summary>
        /// Write a string resource to a binary stream.
        /// </summary>
        /// <param name="w">Binary stream.</param>
        internal void Write(BinaryWriter w)
        {
            // write the block info
            long headerPos = w.BaseStream.Position;

            // wLength
            w.Write((UInt16)_header.wLength);
            // wValueLength
            w.Write((UInt16)_header.wValueLength);
            // wType
            w.Write((UInt16)_header.wType);
            // szKey
            w.Write(Encoding.Unicode.GetBytes(_key));
            // null terminator
            w.Write((UInt16)0);
            // pad fixed info
            ResourceUtil.PadToDWORD(w);
            long valuePos = w.BaseStream.Position;

            if (_value != null)
            {
                // value (always double-null-terminated)
                w.Write(Encoding.Unicode.GetBytes(_value));
            }
            // wValueLength
            ResourceUtil.WriteAt(w, (w.BaseStream.Position - valuePos) / Marshal.SystemDefaultCharSize, headerPos + 2);
            // wLength
            ResourceUtil.WriteAt(w, w.BaseStream.Position - headerPos, headerPos);
        }
 /// <summary>
 /// Write the menu collection to a binary stream.
 /// </summary>
 /// <param name="w">Binary stream.</param>
 internal void Write(BinaryWriter w)
 {
     foreach (MenuExTemplateItem menuItem in this)
     {
         ResourceUtil.PadToDWORD(w);
         menuItem.Write(w);
     }
 }
Example #4
0
 internal void WriteControls(BinaryWriter w)
 {
     foreach (DialogTemplateControlBase control in Controls)
     {
         ResourceUtil.PadToDWORD(w);
         control.Write(w);
     }
 }
Example #5
0
 /// <summary>
 /// Write the menu item to a binary stream.
 /// </summary>
 /// <param name="w">Binary stream.</param>
 internal virtual void Write(BinaryWriter w)
 {
     // header
     w.Write(_header.dwType);
     w.Write(_header.dwState);
     w.Write(_header.dwMenuId);
     w.Write(_header.bResInfo);
     // menu string
     if (_menuString != null)
     {
         w.Write(Encoding.Unicode.GetBytes(_menuString));
         w.Write((UInt16)0);
         ResourceUtil.PadToDWORD(w);
     }
 }
 /// <summary>
 /// Write the resource table.
 /// </summary>
 /// <param name="w">Binary stream.</param>
 internal virtual void Write(BinaryWriter w)
 {
     // wLength
     w.Write((UInt16)_header.wLength);
     // wValueLength
     w.Write((UInt16)_header.wValueLength);
     // wType
     w.Write((UInt16)_header.wType);
     // write key
     w.Write(Encoding.Unicode.GetBytes(_key));
     // null-terminator
     w.Write((UInt16)0);
     // pad fixed info
     ResourceUtil.PadToDWORD(w);
 }
Example #7
0
        /// <summary>
        /// Write the string file-version resource to a binary stream.
        /// </summary>
        /// <param name="w">Binary stream.</param>
        internal override void Write(BinaryWriter w)
        {
            long headerPos = w.BaseStream.Position;

            base.Write(w);

            Dictionary <string, StringTable> .Enumerator stringsEnum = _strings.GetEnumerator();
            while (stringsEnum.MoveNext())
            {
                stringsEnum.Current.Value.Write(w);
            }

            ResourceUtil.WriteAt(w, w.BaseStream.Position - headerPos, headerPos);
            ResourceUtil.PadToDWORD(w);
        }
Example #8
0
        /// <summary>
        /// Write the string table to a binary stream.
        /// </summary>
        /// <param name="w">Binary stream.</param>
        /// <returns>Last unpadded position.</returns>
        internal override void Write(BinaryWriter w)
        {
            long headerPos = w.BaseStream.Position;

            base.Write(w);

            int total = _strings.Count;

            Dictionary <string, StringTableEntry> .Enumerator stringsEnum = _strings.GetEnumerator();
            while (stringsEnum.MoveNext())
            {
                stringsEnum.Current.Value.Write(w);
                ResourceUtil.WriteAt(w, w.BaseStream.Position - headerPos, headerPos);
                // total parent structure size must not include padding
                if (--total != 0)
                {
                    ResourceUtil.PadToDWORD(w);
                }
            }
        }
Example #9
0
        /// <summary>
        /// Write the table of language and code page identifier pairs to a binary stream.
        /// </summary>
        /// <param name="w">Binary stream.</param>
        /// <returns>Last unpadded position.</returns>
        internal override void Write(BinaryWriter w)
        {
            long headerPos = w.BaseStream.Position;

            base.Write(w);

            Dictionary <UInt16, UInt16> .Enumerator languagesEnum = _languages.GetEnumerator();
            long valuePos = w.BaseStream.Position;

            while (languagesEnum.MoveNext())
            {
                // id
                w.Write((UInt16)languagesEnum.Current.Key);
                // code page
                w.Write((UInt16)languagesEnum.Current.Value);
            }

            ResourceUtil.WriteAt(w, w.BaseStream.Position - valuePos, headerPos + 2);
            ResourceUtil.PadToDWORD(w);
            ResourceUtil.WriteAt(w, w.BaseStream.Position - headerPos, headerPos);
        }
Example #10
0
 /// <summary>
 /// Write fixed file information to a binary stream.
 /// </summary>
 /// <param name="w">Binary stream.</param>
 public void Write(BinaryWriter w)
 {
     w.Write(ResourceUtil.GetBytes <Kernel32.VS_FIXEDFILEINFO>(_fixedfileinfo));
     ResourceUtil.PadToDWORD(w);
 }