15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

480 ❘ ChaPTer 19 instrumentAtiOn<br />

Message resource fi les are native resource fi les that have nothing in common with .<strong>NET</strong><br />

resource fi les. .<strong>NET</strong> resource fi les are covered in Chapter 22, “Localization.”<br />

A message fi le is a text fi le with the mc fi le extension. The syntax that this fi le uses to<br />

defi ne messages is very strict. The sample fi le EventLogMessages.mc contains four<br />

categories followed by event messages. Every message has an ID that can be used by<br />

the application writing event entries. Parameters that can be passed from the application<br />

are defi ned with % syntax in the message text.<br />

For the exact syntax of message fi les, check the MSDN documentation for Message<br />

Text Files.<br />

; // EventLogDemoMessages.mc<br />

; // ********************************************************<br />

; // — Event categories -<br />

; // Categories must be numbered consecutively starting at 1.<br />

; // ********************************************************<br />

MessageId=0x1<br />

Severity=Success<br />

SymbolicName=INSTALL_CATEGORY<br />

Language=English<br />

Installation<br />

.<br />

MessageId=0x2<br />

Severity=Success<br />

SymbolicName=DATA_CATEGORY<br />

Language=English<br />

Database Query<br />

.<br />

MessageId=0x3<br />

Severity=Success<br />

SymbolicName=UPDATE_CATEGORY<br />

Language=English<br />

Data Update<br />

.<br />

MessageId=0x4<br />

Severity=Success<br />

SymbolicName=<strong>NET</strong>WORK_CATEGORY<br />

Language=English<br />

Network Communication<br />

.<br />

; // — Event messages -<br />

; // *********************************<br />

MessageId = 1000<br />

Severity = Success<br />

Facility = Application<br />

SymbolicName = MSG_CONNECT_1000<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!