Go to: decompile the Silverlight Project

Source: Internet
Author: User
Tags reflector

From: http://www.cnblogs.com/jv9/archive/2009/12/15/1622853.html

On the Internet, many Silverlight projects are released every day, some of which are open source and some are just for demonstration.

In the early stages of Silverlight learning, most of them require imitation learning. Therefore, when a Silverlight project is found, you can viewSource codeYes.

However, Silverlight only releases the resource package xap, and all resources are in this xap file. How to view the resources andCodeWhat about it?

Next I will demonstrate the decompilation method. In the demo, I will use Silverlight. Net homepage Silverlight as an example.

1. First open Silverlight. Net, which contains a Silverlight navigation animation;

 

 

2. In the browser, right-click to view the page source code;

 

 

3. Search for "xap" in the HTML source code to quickly locate the xap location.

 

 

 

We can see that<ParamName="Source"Value="Clientbin/showcasenav. xap"/>

The value is the location of the xap on the server.

 

4. We use the same domain name to obtain the current xap file. Open a new browser and enter: http://www.silverlight.net/clientBin/showcasenav/ShowcaseNav.xap in the address bar

The browser will prompt you to download the xap file.

 

 

5. rename the downloaded file showcasenav. xap, Which is showcasenav.zip. decompress the package to the same directory. the Assembly file, class library, and configuration file used by Silverlight are displayed in the directory.

 

 

6. You can use the decompilation software that everyone is familiar with. reflector to view the resources and code files in the DLL. Download reflector: http://www.red-gate.com/products/reflector/

 

 

 

7. Double-click"Mscommunities. Silverlight. showcasenav", Expand the file to see the DLL and resources. Resources contains all the XAML files and image files. The dll contains the class library background code.

 

 

 

8. Click to enter the reources directory and double-click"Mscommunities. Silverlight. showcasenav. G. Resources",

On the right side of reflector, you can view the resource list. Select any file you want to view the code, right-click "Save as", and save it to your local computer. You can use vs2008 or the text editing software to view the code content.

 

 

 

9. corresponding to each resource file, there will be class library code, double-click"Mscommunities. Silverlight. showcasenav. dll", Then double-click"Mscommunities. Silverlight. showcasenavYou can view the various class library files. Here, we select "itemadvancecontrol" and you can see the decompilation code on the Right of reflector.

 

 

 

So far, we have already talked about how to decompile the Silverlight project and view its source code. Next I want to introduce a foreign shared software, which can achieve the same effect as above-Silverlight spy,

: Http://silverlightspy.com/silverlightspy/download-silverlight-spy/

Silverlight spy is a shared software that automatically retrieves xap files to help you Parse Files in xap. The software works with reflector to view the source code of the Silverlight project.

At the same time, you can break down the style and UI in the project, and display isolated storege to developers.

Enter the Silverlight. net address in the address bar. Double-click any resource and view it in the View window.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.