/// <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); }
/// <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 var headerPos = w.BaseStream.Position; // wLength w.Write(_header.wLength); // wValueLength w.Write(_header.wValueLength); // wType w.Write(_header.wType); // szKey w.Write(Encoding.Unicode.GetBytes(_key)); // null terminator w.Write((UInt16)0); // pad fixed info ResourceUtil.PadToDWORD(w); var 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); }
internal void WriteControls(BinaryWriter w) { foreach (var control in Controls) { ResourceUtil.PadToDWORD(w); control.Write(w); } }
/// <summary> /// Write the menu collection to a binary stream. /// </summary> /// <param name="w">Binary stream.</param> internal void Write(BinaryWriter w) { foreach (var menuItem in this) { ResourceUtil.PadToDWORD(w); menuItem.Write(w); } }
/// <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(_header.wLength); // wValueLength w.Write(_header.wValueLength); // wType w.Write(_header.wType); // write key w.Write(Encoding.Unicode.GetBytes(_key)); // null-terminator w.Write((UInt16)0); // pad fixed info ResourceUtil.PadToDWORD(w); }
/// <summary> /// Write the string file-version resource to a binary stream. /// </summary> /// <param name="w">Binary stream.</param> internal override void Write(BinaryWriter w) { var headerPos = w.BaseStream.Position; base.Write(w); var stringsEnum = _strings.GetEnumerator(); while (stringsEnum.MoveNext()) { stringsEnum.Current.Value.Write(w); } ResourceUtil.WriteAt(w, w.BaseStream.Position - headerPos, headerPos); ResourceUtil.PadToDWORD(w); }
/// <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) { var headerPos = w.BaseStream.Position; base.Write(w); var total = _strings.Count; var 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); } } }
/// <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) { var headerPos = w.BaseStream.Position; base.Write(w); var languagesEnum = _languages.GetEnumerator(); var valuePos = w.BaseStream.Position; while (languagesEnum.MoveNext()) { // id w.Write(languagesEnum.Current.Key); // code page w.Write(languagesEnum.Current.Value); } ResourceUtil.WriteAt(w, w.BaseStream.Position - valuePos, headerPos + 2); ResourceUtil.PadToDWORD(w); ResourceUtil.WriteAt(w, w.BaseStream.Position - headerPos, headerPos); }
/// <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(_fixedfileinfo)); ResourceUtil.PadToDWORD(w); }