str+=((char)cnt).ToString();
cnt=random.Next(0,128);
m=random.Next(5,50);
}
textBox1.Text=str;
}
privatevoidbutton4_Click(objectsender,EventArgse)
{
stringstrLine;
try
{
FileStreamaFile=newFileStream("Original.txt",FileMode.Open);
StreamReadersr=newStreamReader(aFile);
strLine=sr.ReadLine();
while(strLine!
=null)
{
textBox1.Text+=strLine;
strLine=sr.ReadLine();
}
sr.Close();
}
catch(IOExceptionex)
{
MessageBox.Show("找不到名为‘Original.txt’的文件!
");
}
}
}
}
/**************************简易行程编码软件.Designer.cs****************************/
namespace行程编码
{
partialclass简易行程编码软件
{
///
///Requireddesignervariable.
///
privateSystem.ComponentModel.IContainercomponents=null;
///
///Cleanupanyresourcesbeingused.
///
///trueifmanagedresourcesshouldbedisposed;otherwise,false.
protectedoverridevoidDispose(booldisposing)
{
if(disposing&&(components!
=null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#regionWindowsFormDesignergeneratedcode
///
///RequiredmethodforDesignersupport-donotmodify
///thecontentsofthismethodwiththecodeeditor.
///
privatevoidInitializeComponent()
{
System.ComponentModel.ComponentResourceManagerresources=newSystem.ComponentModel.ComponentResourceManager(typeof(简易行程编码软件));
this.label1=newSystem.Windows.Forms.Label();
this.button4=newSystem.Windows.Forms.Button();
this.label5=newSystem.Windows.Forms.Label();
this.label4=newSystem.Windows.Forms.Label();
this.label3=newSystem.Windows.Forms.Label();
this.button3=newSystem.Windows.Forms.Button();
this.button2=newSystem.Windows.Forms.Button();
this.textBox2=newSystem.Windows.Forms.TextBox();
this.textBox1=newSystem.Windows.Forms.TextBox();
this.label2=newSystem.Windows.Forms.Label();
this.button1=newSystem.Windows.Forms.Button();
this.SuspendLayout();
//
//label1
//
this.label1.AutoSize=true;
this.label1.Location=newSystem.Drawing.Point(73,28);
this.label1.Margin=newSystem.Windows.Forms.Padding(4,0,4,0);
this.label1.Name="label1";
this.label1.Size=newSystem.Drawing.Size(56,16);
this.label1.TabIndex=1;
this.label1.Text="原文:
";
//
//button4
//
this.button4.Location=newSystem.Drawing.Point(232,321);
this.button4.Margin=newSystem.Windows.Forms.Padding(4,4,4,4);
this.button4.Name="button4";
this.button4.Size=newSystem.Drawing.Size(127,31);
this.button4.TabIndex=20;
this.button4.Text="读入原码文件";
this.button4.UseVisualStyleBackColor=true;
this.button4.Click+=newSystem.EventHandler(this.button4_Click);
//
//label5
//
this.label5.AutoSize=true;
this.label5.ForeColor=System.Drawing.Color.FromArgb(((int)(((byte)(0)))),((int)(((byte)(192)))),((int)(((byte)(0)))));
this.label5.Location=newSystem.Drawing.Point(39,101);
this.label5.Margin=newSystem.Windows.Forms.Padding(4,0,4,0);
this.label5.Name="label5";
this.label5.Size=newSystem.Drawing.Size(104,16);
this.label5.TabIndex=19;
this.label5.Text="产生随机字串";
this.label5.TextAlign=System.Drawing.ContentAlignment.MiddleCenter;
this.label5.Click+=newSystem.EventHandler(this.label5_Click);
//
//label4
//
this.label4.ForeColor=System.Drawing.Color.Red;
this.label4.Location=newSystem.Drawing.Point(13,336);
this.label4.Margin=newSystem.Windows.Forms.Padding(4,0,4,0);
this.label4.Name="label4";
this.label4.RightToLeft=System.Windows.Forms.RightToLeft.No;
this.label4.Size=newSystem.Drawing.Size(107,16);
this.label4.TabIndex=18;
this.label4.Text="100%";
this.label4.TextAlign=System.Drawing.ContentAlignment.MiddleRight;
//
//label3
//
this.label3.AutoSize=true;
this.label3.ForeColor=System.Drawing.SystemColors.ControlText;
this.label3.Location=newSystem.Drawing.Point(39,300);
this.label3.Margin=newSystem.Windows.Forms.Padding(4,0,4,0);
this.label3.Name="label3";
this.label3.Size=newSystem.Drawing.Size(88,16);
this.label3.TabIndex=17;
this.label3.Text="压缩比为:
";
//
//button3
//
this.button3.Location=newSystem.Drawing.Point(232,360);
this.button3.Margin=newSystem.Windows.Forms.Padding(4,4,4,4);
this.button3.Name="button3";
this.button3.Size=newSystem.Drawing.Size(127,31);
this.button3.TabIndex=16;
this.button3.Text="写入压缩文件";
this.button3.UseVisualStyleBackColor=true;
this.button3.Click+=newSystem.EventHandler(this.button3_Click);
//
//button2
//
this.button2.Location=newSystem.Drawing.Point(151,360);
this.button2.Margin=newSystem.Windows.Forms.Padding(4,4,4,4);
this.button2.Name="button2";
this.button2.Size=newSystem.Drawing.Size(73,31);
this.button2.TabIndex=15;
this.button2.Text="还原";
this.button2.UseVisualStyleBackColor=true;
this.button2.Click+=newSystem.EventHandler(this.button2_Click);
//
//textBox2
//
this.textBox2.Location=newSystem.Drawing.Point(149,160);
this.te