Map AttachedProperties

23 Juni 2008

Currently I’m trying to implement a reusable control for reflection in WPF. I come to the conclusion that XAML is a very easy way to achieve such an effect but it is not the ‘modern abstract’ way. So after a while I found a very nice example which operates with AttachedProperties to display a reflection (see Reflecting on Reflections).

But the author missed to copy all AttachedProperties for a Panel from the element that has reflection  to the new Panel (which is responsible for the reflection at last).

Here you can find a first and rapid implementation to gain all necessary AttachedProperties for Panels: Den Rest des Beitrags lesen »


Deobfuscate fonts in an XPS document

10 Juni 2007

XPS is the new portable format from Microsoft. The file structure consists of several parts, which includes the text (the so called „fixed documents“) and, of course, all resources. Images and fonts are embedded in a specific folder but as a general rule fonts are obfuscated to „protect“ the copyrights of the author.

To extract the text (which is by the way a subset of XAML) all resources have to be extracted, too. But obfuscated fonts cannot be read, therefore a decryption is required.
The encryption is rather simple: The first 32 bytes are XOR with the GUID of the file (it is also documented in the MSDN). To reverse all font files repeat the exclusive disjunction with the GUID (the file name implies the GUID, thank you) and you will receive the original source (for a better understanding see: http://en.wikipedia.org/wiki/XOR).

I attached a little example. Pass the obfuscated font path and streamOut will return the deobfuscated stream. To save the stream to disc, call streamOut.Position = 0 first.

Edit 2008-10-26:
Here you can find my solution:
http://www.bremora.com/index.php/xps-font-deobfuscator


Expression Blend Release Candidate 1

24 April 2007

Der erste RC des WPF-Designers Expression Blend ist nun auf den Seiten von Microsoft verfügbar.

Der Download und der Key für eine 180-Tage-Testversion befinden sich hier.

EDIT:  Expression Blend ist zur Zeit nicht mehr als RC verfügbar. Stattdessen kann nun die Releaseversion 60 Tage lang getestet werden.


.NET 3.0 Klassenhierarchie mit VS 2005 erstellen

24 April 2007

Eine von Microsoft dokumentiertes „Klassendiagramm“ wie für das gute alte MFC, sucht man für das .NET 3.0 Framework leider vergebens. Zwar gibt es eine struktierte Klassenbibliothek, jedoch zeigt dies noch lange nicht alle Abhängigkeiten auf.

Eine einfache Lösung zur Veranschaulichung aller Typen bietet der Klassendesigner (beliebiges Projekt öffnen -> rechte Maustaste auf eine *.cs-Datei -> Klassendiagramm anzeigen -> bestehende Klassen löschen) und der Objektbrowser (Ansicht->Objektbrowser) von Visual Studio 2005.

Anschließend die gewünschten Namespaces in der Klassendesigner ziehen. Zur Darstellung weitere Abhängigkeiten kann man mit dem Kontextmenü „Basisklasse anzeigen“ und „Abgeleitete Klassen anzeigen“ alle Verbindungen aufzeigen.

Schließlich kann das Diagramm noch als Bild gespeichert werden (Kontextmenü->Diagramm als Bild exportieren). Allerdings bleibt die Auflösung bei sehr großen Entwürfen nicht konstant, sodass das Diagramm im Bild kaum noch zu lesen ist.


WPF Designer deaktivieren

19 April 2007

Das der WPF-Designer zur Visualisierung von XAML-Dokumenten in Visual Studio 2005 sich wohl noch in einer frühen Betaphase befindet (ständige Abstürze, schlechte Performance), sollte bereits bekannt sein.

Die Frage, die sich nun aufstellt lautet: Wie kann ich diesen deaktivieren und standardmäßig lediglich den Editor laden?

Antwort:

  • Auf ein XAML-Dokument in dem Projekt klicken
  • Rechte Maustaste -> „Open with…“
  • „XML Editor“ als default auswählen