日期:2009-12-07  浏览次数:20369 次

 

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text;
using System.Xml;
using System.Security.Cryptography;

namespace writeconfig
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class frmMain : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Label labserver;
  private System.Windows.Forms.Label labdatabase;
  private System.Windows.Forms.Label labuser;
  private System.Windows.Forms.Label labpassword;
  private System.Windows.Forms.TextBox txtserver;
  private System.Windows.Forms.TextBox txtdatabase;
  private System.Windows.Forms.TextBox txtuser;
  private System.Windows.Forms.TextBox txtpassword;
  private System.Windows.Forms.Button btnRead;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.TextBox txtfile;
  private System.Windows.Forms.Button btnWrite;
  private System.Windows.Forms.Button btnLook;
  private System.Windows.Forms.OpenFileDialog ofd;
  private System.Windows.Forms.Label labkey;
  private System.Windows.Forms.TextBox txtkey;
  private FileInfo fi;
  private bool Find;
  private string password="";
  protected string keypassword="";
  private System.Windows.Forms.Button btnDeleteNode;
  
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;

  public frmMain()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();
   int[] tmp=new int[8]{23,234,195,165,201,240,143,198};
   foreach(int i in tmp)
   {
    keypassword+=((char)i).ToString();
   }
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
   this.labserver = new System.Windows.Forms.Label();
   this.labdatabase = new System.Windows.Forms.Label();
   this.labuser = new System.Windows.Forms.Label();
   this.labpassword = new System.Windows.Forms.Label();
   this.txtserver = new System.Windows.Forms.TextBox();
   this.txtdatabase = new System.Windows.Forms.TextBox();
   this.txtuser = new System.Windows.Forms.TextBox();
   this.txtpassword = new System.Windows.Forms.TextBox();
   this.btnRead = new System.Windows.Forms.Button();
   this.btnWrite = new System.Windows.Forms.Button();
   this.txtfile = new Sys