Comments
1 comment
-
What parthpatel asks for seems quite difficult, but there may be something else that can be achieved and would help in recompiling windows forms code.
Would it be possible to have an option allowing reflector to generate fully qualified names?
For instance this code (removed the partial stuff):public class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { } /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(12, 12); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 264); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); } #endregion private System.Windows.Forms.Button button1; }
gets reflectored like this:public class Form1 : Form { // Fields private Button button1; private IContainer components = null; // Methods public Form1() { this.InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Hello .NET 3.5"); } protected override void Dispose(bool disposing) { if (disposing && (this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.button1 = new Button(); base.SuspendLayout(); this.button1.Location = new Point(12, 12); this.button1.Name = "button1"; this.button1.Size = new Size(0x4b, 0x17); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new EventHandler(this.button1_Click); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x11c, 0x108); base.Controls.Add(this.button1); base.Name = "Form1"; this.Text = "Form1"; base.ResumeLayout(false); } }
This is perfectly correct from the compiler point of view, but it can't be deserialized by the Windows Forms designer. Because the designer doesn't parse the using statements, it can't instantiate non fully qualified objects. And this is true for the objects declaraions, but also for the various objects on the right sides of the affectations: Size, Point, AutoScaleMode, and so on...[/code]
Add comment
Please sign in to leave a comment.
Last time i used .NET Reflector when i urgently needed to decompile my project. I have exported the C# project. But it didn't made designer file. I know as the compiler convert and merge one simple solid class for All partial Class and all other extra stuff. I still would like to have this feature.
I am sure that redgate developer are genious and consider this request. I am expecting this because i know the reputation and progress of REDGATE since the beta version of SQL Prompt.
Thanks