Topic: Winbuilder11.xml, a Notepad++ syntax highligher of Winbuilder sourcecode  (Read 1899 times)

Tony4219

  • Chef
  • ***
  • Location: USA
  • Date Registered: Mar 2015
  • Posts: 158
Technically, it is called a user defined language (UDL) file.  To install properly, read THIS 
http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files#How_to_install_user_defined_language_files

Notepad++ lets you read a plain text file augmented by colors, depending on rules that you set up.

I had not found a way to get the SAME colorization for reading the plugin .script files for Winbuilder, but ran across ied206's PEBakery.xml Language file for Notepad++.  I had not used Notepad++ before. (Notepad2 has a bunch of built-in highlighters but no easy way to add more or modify existing ones, and of course there were none for Winbuilder).   ied206's original post and download is HERE http://theoven.org/index.php?topic=2294.0.

It had different colors but gave me an idea and an example base to build upon. THANKS IED206 !!

The colorization for PEBakery.xml is different to what Winbuilder uses for sourcecode, so I worked to get this closer
to the original. I kept ied206's easier-to-read yellow highlighted [Section] setting, functional hyperlinks, and blue keywords and general settings in [Main].   The History lines are treated like Comments, in that any keywords are NOT colorized in History.  Most text, Variables, quotations, and comments are like original.

[The hardest thing was the nesting of original green percent signs (%Variables%) within red double quotation marks, which is usually used in long Winbuilder paths containing Variables. For that, you have to learn to use the Styler. See Jon Evans at
http://www.thevalvepage.com/swmonkey/2015/08/19/notepad-user-defined-languages/    for an explanation on using the Styler.

And you have to learn Nesting of delimiters. See Claudia at https://notepad-plus-plus.org/community/topic/15267/colour-code-nested-brackets/4
            and        https://notepad-plus-plus.org/community/topic/15267/colour-code-nested-brackets/3

I leave this info as it took 2 days to find it ... ]

posted as a new thread as I only accidentally ran across the original.


Update:

If you downloaded Winbuilder11.xml UDL, then you may to replace it with Winbuilder12.xml.

Most simple plugins should not have had a problem, but I noticed sometimes there were inappropriate color changes at the wrong time.

What happened was Winbuilder11.xml looking at the 'normal' unmatched percent symbol as used in lines like this:
  ...  "#$q%PE_Programs%\%ProgramFolder%\Textmaker.exe#$q #$q%1#$q"
where there is only one (unmatched) percentage sign used in Windows Registry for a parameter, %1, surrounded in code by #$q on each side of it.   Winbuilder11.xml took this to be a Variable, and the green Variable color continued until it finally finds another percent sign many many characters away.
This should now be fixed.

Comments are (gray) and italic like Winbuilder style.

I added some codefolding only to the EncodedFile  section, usually near the end of plugins.
On NSUDO plugin, it collapses the 4 codefolded EncodedFiles GREAT. No probs with scrolling, although the largest was only about 148 lines. 
On SoftmakerOfcFree plugin, one zipped file is 8000+ lines long, which causes noticable hesitation when folding, and unfolding, even when scrolling. Your mileage may vary.
« Last Edit: April 18, 2018, 02:10:28 PM by Tony4219, Reason: improvements »

ied206

  • Chef
  • ***
  • Location: South Korea
  • Date Registered: Jan 2014
  • Posts: 257
Thanks for information.
FYI, I recently added ability to fold blocks (Begin ~ End, comments) to PEBakery Notepad++ UDL.


If you are interested in other editors, you can take a look of my Visual Studio Code Extension. Please note that you cannot exactly specify colorscheme in VSCode because it is defined in user's colorscheme. Instead it can support code snippet. I wrote code snippet of FileCopy as an example.
« Last Edit: April 12, 2018, 02:00:48 AM by ied206 »

Tony4219

  • Chef
  • ***
  • Location: USA
  • Date Registered: Mar 2015
  • Posts: 158
I had seen the CodeFolding feature and didn't consider it feasible as I always want to see all Comments.

BUT

since your reply my mind started wandering and, when I get some time,  I'm going to see if I can fold  code for " [EncodedFile-  "]  sections,  or "lines=0" sections.

Those don't have to be viewed very often; I think it is Base64 and basically unreadable anyway.

Tony4219

  • Chef
  • ***
  • Location: USA
  • Date Registered: Mar 2015
  • Posts: 158
Winbuilder12.xml has some codefolding for the EncodedFile section, in addition to some improvements.

I updated the original post. Thanks!

ied206

  • Chef
  • ***
  • Location: South Korea
  • Date Registered: Jan 2014
  • Posts: 257
I had updated by PEBakery/WinBuilder syntax highlighter to v1.1.
I applied your idea of using styler to support nesting, and attachment section folding.

Fun Fact: The reason why almost attachment sections have identical "AAAAAAAAAAAA" trailer is related with WinBuilder's attached file footer data structure.
WinBuilder stores original filename in the footer. However, the entry is always 550B long even though filename takes much less space (~50B).
EDIT: WinBuilder has two footers, and the last footer is quite static and uncompressed. It means the last 11B is always 0, leaving trails of As when encoded to base64.

Code: [Select]
// Taken from WinBuilder attach file format analysis for PEBakery development
[FinalFooter]
Not compressed, 36Byte (0x24)
0x00 - 0x04   : 4B  -> CRC32 of Zlib-Compressed File and Zlib-Compressed FirstFooter
0x04 - 0x08   : 4B  -> Unknown - Always 1
0x08 - 0x0B   : 4B  -> WB082 ZLBArchive Component version - Always 2
0x0C - 0x0F   : 4B  -> Zlib Compressed FirstFooter Length
0x10 - 0x17   : 8B  -> Zlib Compressed File Length
0x18 - 0x1B   : 4B  -> Unknown - Always 1
0x1C - 0x23   : 8B  -> Unknown - Always 0
« Last Edit: October 31, 2019, 09:58:05 PM by ied206 »

 

Powered by EzPortal