using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace ControlTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class FormDecompileWizard : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControlDecompilerWizard;
private System.Windows.Forms.TabPage tabPageSolution;
private System.Windows.Forms.Label labelSolutionName;
private System.Windows.Forms.Label labelLocation;
private System.Windows.Forms.TextBox textBoxSolutionName;
private System.Windows.Forms.TextBox textBoxLocation;
private System.Windows.Forms.Button buttonBrowse;
private System.Windows.Forms.CheckedListBox checkedListBoxProjects;
private System.Windows.Forms.Button buttonRemove;
private System.Windows.Forms.GroupBox groupBoxProjects;
private System.Windows.Forms.TabPage tabPageScrambling;
private System.Windows.Forms.Button buttonLoad;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null; public FormDecompileWizard()
{
//
// Required for Windows Form Designer support
//
InitializeComponent(); //
// TODO: Add any constructor code after InitializeComponent call
//
} /// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (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.tabControlDecompilerWizard = new System.Windows.Forms.TabControl();
this.tabPageSolution = new System.Windows.Forms.TabPage();
this.checkedListBoxProjects = new System.Windows.Forms.CheckedListBox();
this.buttonBrowse = new System.Windows.Forms.Button();
this.textBoxLocation = new System.Windows.Forms.TextBox();
this.textBoxSolutionName = new System.Windows.Forms.TextBox();
this.labelLocation = new System.Windows.Forms.Label();
this.labelSolutionName = new System.Windows.Forms.Label();
this.buttonLoad = new System.Windows.Forms.Button();
this.buttonRemove = new System.Windows.Forms.Button();
this.groupBoxProjects = new System.Windows.Forms.GroupBox();
this.tabPageScrambling = new System.Windows.Forms.TabPage();
this.tabControlDecompilerWizard.SuspendLayout();
this.tabPageSolution.SuspendLayout();
this.SuspendLayout();
// 
// tabControlDecompilerWizard
// 
this.tabControlDecompilerWizard.Controls.AddRange(new System.Windows.Forms.Control[] {
 this.tabPageSolution,
 this.tabPageScrambling});
this.tabControlDecompilerWizard.Location = new System.Drawing.Point(24, 24);
this.tabControlDecompilerWizard.Name = "tabControlDecompilerWizard";
this.tabControlDecompilerWizard.SelectedIndex = 0;
this.tabControlDecompilerWizard.Size = new System.Drawing.Size(592, 344);
this.tabControlDecompilerWizard.TabIndex = 0;
this.tabControlDecompilerWizard.SelectedIndexChanged += new System.EventHandler(this.tabControlDecompilerWizard_SelectedIndexChanged);
// 
// tabPageSolution
// 
this.tabPageSolution.Controls.AddRange(new System.Windows.Forms.Control[] {
  this.buttonRemove,
  this.buttonLoad,
  this.checkedListBoxProjects,

}

解决方案 »

  1.   

      this.buttonBrowse,
      this.textBoxLocation,
      this.textBoxSolutionName,
      this.labelLocation,
      this.labelSolutionName,
      this.groupBoxProjects});
    this.tabPageSolution.Location = new System.Drawing.Point(4, 21);
    this.tabPageSolution.Name = "tabPageSolution";
    this.tabPageSolution.Size = new System.Drawing.Size(584, 319);
    this.tabPageSolution.TabIndex = 0;
    this.tabPageSolution.Text = "Solution";
    this.tabPageSolution.Click += new System.EventHandler(this.tabPageSolution_Click);
    // 
    // checkedListBoxProjects
    // 
    this.checkedListBoxProjects.Location = new System.Drawing.Point(152, 128);
    this.checkedListBoxProjects.Name = "checkedListBoxProjects";
    this.checkedListBoxProjects.Size = new System.Drawing.Size(376, 164);
    this.checkedListBoxProjects.TabIndex = 6;
    // 
    // buttonBrowse
    // 
    this.buttonBrowse.Location = new System.Drawing.Point(432, 48);
    this.buttonBrowse.Name = "buttonBrowse";
    this.buttonBrowse.Size = new System.Drawing.Size(96, 24);
    this.buttonBrowse.TabIndex = 4;
    this.buttonBrowse.Text = "Browse";
    // 
    // textBoxLocation
    // 
    this.textBoxLocation.Location = new System.Drawing.Point(152, 48);
    this.textBoxLocation.Name = "textBoxLocation";
    this.textBoxLocation.Size = new System.Drawing.Size(256, 21);
    this.textBoxLocation.TabIndex = 3;
    this.textBoxLocation.Text = "C:\\Decompiled";
    // 
    // textBoxSolutionName
    // 
    this.textBoxSolutionName.Location = new System.Drawing.Point(152, 16);
    this.textBoxSolutionName.Name = "textBoxSolutionName";
    this.textBoxSolutionName.Size = new System.Drawing.Size(376, 21);
    this.textBoxSolutionName.TabIndex = 2;
    this.textBoxSolutionName.Text = "Solution1";
    // 
    // labelLocation
    // 
    this.labelLocation.Location = new System.Drawing.Point(32, 56);
    this.labelLocation.Name = "labelLocation";
    this.labelLocation.Size = new System.Drawing.Size(104, 16);
    this.labelLocation.TabIndex = 1;
    this.labelLocation.Text = "Location";
    // 
    // labelSolutionName
    // 
    this.labelSolutionName.Location = new System.Drawing.Point(32, 24);
    this.labelSolutionName.Name = "labelSolutionName";
    this.labelSolutionName.Size = new System.Drawing.Size(100, 16);
    this.labelSolutionName.TabIndex = 0;
    this.labelSolutionName.Text = "Solution Name";
    // 
    // buttonLoad
    // 
    this.buttonLoad.Location = new System.Drawing.Point(40, 160);
    this.buttonLoad.Name = "buttonLoad";
    this.buttonLoad.Size = new System.Drawing.Size(96, 24);
    this.buttonLoad.TabIndex = 8;
    this.buttonLoad.Text = "Load";
    // 
    // buttonRemove
    // 
    this.buttonRemove.Location = new System.Drawing.Point(40, 232);
    this.buttonRemove.Name = "buttonRemove";
    this.buttonRemove.Size = new System.Drawing.Size(96, 24);
    this.buttonRemove.TabIndex = 9;
    this.buttonRemove.Text = "Remove";
    // 
    // groupBoxProjects
    // 
    this.groupBoxProjects.Location = new System.Drawing.Point(24, 96);
    this.groupBoxProjects.Name = "groupBoxProjects";
    this.groupBoxProjects.Size = new System.Drawing.Size(520, 208);
    this.groupBoxProjects.TabIndex = 10;
    this.groupBoxProjects.TabStop = false;
    this.groupBoxProjects.Text = "Projects";
    // 
    // tabPageScrambling
    // 
    this.tabPageScrambling.Location = new System.Drawing.Point(4, 21);
    this.tabPageScrambling.Name = "tabPageScrambling";
    this.tabPageScrambling.Size = new System.Drawing.Size(584, 319);
    this.tabPageScrambling.TabIndex = 1;
    this.tabPageScrambling.Text = "Scrambling";
    // 
    // FormDecompileWizard
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(672, 389);
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
      this.tabControlDecompilerWizard});
    this.Name = "FormDecompileWizard";
    this.Text = "Decompile Wizard";
    this.tabControlDecompilerWizard.ResumeLayout(false);
    this.tabPageSolution.ResumeLayout(false);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new FormDecompileWizard());
    } private void tabPageSolution_Click(object sender, System.EventArgs e)
    {

    } private void tabControlDecompilerWizard_SelectedIndexChanged(object sender, System.EventArgs e)
    {

    }
    }
      

  2.   

    public virtual object GetInitValue()
    {
    object oRetVal = null;
    if ( /*this.ExtendedProperties.Contains("DefaultValue")*/ this.DefaultValue != System.DBNull.Value )
    {
    //oRetVal = this.ExtendedProperties["DefaultValue"];
    oRetVal = this.DefaultValue;
    }
    else if ( !this.AllowDBNull )
    {
    switch( this.DataType.ToString() )
    {
    case "System.Guid" :
    oRetVal = Guid.NewGuid();
    break;
    case "System.Boolean" :
    oRetVal = false;
    break;
    case "System.Byte" :
    oRetVal = 0;
    break;
    case "System.Char" :
    oRetVal = "";
    break;
    case "System.DateTime" :
    oRetVal = DateTime.Today;
    break;
    case "System.Decimal" :
    oRetVal = 0;
    break; 
    case "System.Double" :
    oRetVal = 0;
    break;
    case "System.Int16" :
    case "System.Int32" :
    case "System.Int64" :
    oRetVal = 0;
    break;
    case "System.SByte" :
    break;
    case "System.Single" :
    break;
    case "System.String" :
    oRetVal = "";
    break;
    case "System.TimeSpan" :
    oRetVal = DateTime.Today;
    break;
    case "System.UInt16" :
    case "System.UInt32" :
    case "System.UInt64" :
    oRetVal = 0;
    break;
    default:
    break;
    }
    }
    if ( oRetVal == null )
    {
    oRetVal = System.DBNull.Value;
    }
    return oRetVal;
    } public virtual System.Data.SqlClient.SqlParameter GetCommandParameter()
    {
    System.Data.SqlClient.SqlParameter parameter;
    /*
    if ( this.DataBaseType == System.Data.SqlDbType.VarChar )
    {
    parameter = new System.Data.SqlClient.SqlParameter( "@" + this.ColumnName, this.DataBaseType, this.MaxLength );
    }
    else
    {
    parameter = new System.Data.SqlClient.SqlParameter( "@" + this.ColumnName, this.DataBaseType );
    }
    */
    parameter = new System.Data.SqlClient.SqlParameter( "@" + this.ColumnName, this.DataBaseType, this.ColumnSize );
    parameter.SourceColumn = this.ColumnName;
    return parameter;
    }
    public object TransFormValue( string stringValue )
    {
    object objValue = null;
    try
    {
    switch( this.DataType.ToString() )
    {
    case "System.Guid" :
    if ( stringValue == "" )
    {
    objValue = DBNull.Value;
    }
    else
    {
    objValue = new System.Guid( stringValue );
    }
    break;
    case "System.DateTime" :
    if ( stringValue == "" )
    {
    objValue = System.DBNull.Value;
    }
    else
    {
    objValue = System.Convert.ToDateTime( stringValue );
    }
    break;
    case "System.Boolean" :
    stringValue = stringValue.ToLower();
    if ( stringValue == "true" || stringValue == "-1" )
    {
    objValue = true;
    }
    else
    {
    objValue = false;
    }
    break;
    case "System.Double" :
    objValue = System.Convert.ToDecimal( stringValue );
    break;
    default :
    objValue = stringValue;
    break;
    }
    }
    catch( Exception e )
    {
    string errorMessage = e.Message;
    }
    return objValue;
    }