轻松闲聊这 有懂.NET的高人不 呵呵 HELP
<p>~~</p><p>门外汉求助</p> <p>什么NET?</p><p>ASP.NET?</p> 不懂? 同是门外汉 <p>源代码是CS结尾的 编译后成EXE的哦</p><p></p><p></p> 正忙着考这门课,复习中 哦,计算机操作系统的 CS是反恐么? <div class="msgheader">QUOTE:</div><div class="msgborder"><b>以下是引用<i>天颜儿</i>在2006-6-11 10:49:00的发言:</b><br/>正忙着考这门课,复习中</div><p>可以帮我看一段不到100行的源代码不</p><p>以前同学帮我写了可以用的程序 现在用不了了 不知道哪里不能用诶</p> 反恐精英,红色警戒 <div class="msgheader">QUOTE:</div><div class="msgborder"><b>以下是引用<i>伤心酷龙</i>在2006-6-11 10:50:00的发言:</b><br/><p>可以帮我看一段不到100行的源代码不</p><p>以前同学帮我写了可以用的程序 现在用不了了 不知道哪里不能用诶</p></div><p></p>恐怕能力不够 <p>有注释的</p><p>using System;<br/>using System.Drawing;<br/>using System.Collections;<br/>using System.ComponentModel;<br/>using System.Windows.Forms;<br/>using System.Data;<br/>using System.Data.OleDb;<br/>using System.Net;<br/>using System.Diagnostics;</p><p>namespace DownLoadSoftware<br/>{<br/> /// <summary><br/> /// Form1 的摘要说明。<br/> /// </summary><br/> public class MainForm : System.Windows.Forms.Form<br/> {<br/> private System.Windows.Forms.Panel panel1;<br/> private System.Windows.Forms.Label label3;<br/> private System.Windows.Forms.TextBox txtReferURL;<br/> private System.Windows.Forms.Label label4;<br/> private System.Windows.Forms.TextBox txtTureURL;<br/> private System.Windows.Forms.Label label1;<br/> private System.Windows.Forms.TextBox txtFlahGat;<br/> private System.Windows.Forms.TextBox txtAccessAdd;<br/> private System.Windows.Forms.Label label5;<br/> private System.Windows.Forms.Button btnAccessAdd;<br/> private System.Windows.Forms.Label label6;<br/> private System.Windows.Forms.TextBox txtFieldName;<br/> private System.Windows.Forms.Label label7;<br/> private System.Windows.Forms.TextBox txtTableName;<br/> private System.Windows.Forms.Button btnStart;<br/> private System.Windows.Forms.Button btnFlashGatAdd;<br/> private System.Windows.Forms.Label label2;<br/> private System.Windows.Forms.TextBox btnFormUrl;</p><p> string accessAdd;<br/> string tableName;<br/> string fieldName;</p><p> string formUrl;//<br/> string referUrl;<br/> string flashAdd;</p><p> string realUrl;</p><p> string selectSQL;<br/> string strConn;</p><p> Process flashGetP = new Process();</p><p> /// <summary><br/> /// 必需的设计器变量。<br/> /// </summary><br/> private System.ComponentModel.Container components = null;</p><p> public MainForm()<br/> {<br/> //<br/> // Windows 窗体设计器支持所必需的<br/> //<br/> InitializeComponent();</p><p> //<br/> // TODO: 在 InitializeComponent 调用后添加任何构造函数代码<br/> //<br/> }</p><p> /// <summary><br/> /// 清理所有正在使用的资源。<br/> /// </summary><br/> protected override void Dispose( bool disposing )<br/> {<br/> if( disposing )<br/> {<br/> if (components != null) <br/> {<br/> components.Dispose();<br/> }<br/> }<br/> base.Dispose( disposing );<br/> }</p><p> #region Windows 窗体设计器生成的代码<br/> /// <summary><br/> /// 设计器支持所需的方法 - 不要使用代码编辑器修改<br/> /// 此方法的内容。<br/> /// </summary><br/> private void InitializeComponent()<br/> {<br/> this.panel1 = new System.Windows.Forms.Panel();<br/> this.btnFormUrl = new System.Windows.Forms.TextBox();<br/> this.label2 = new System.Windows.Forms.Label();<br/> this.btnFlashGatAdd = new System.Windows.Forms.Button();<br/> this.txtTableName = new System.Windows.Forms.TextBox();<br/> this.label7 = new System.Windows.Forms.Label();<br/> this.txtFieldName = new System.Windows.Forms.TextBox();<br/> this.label6 = new System.Windows.Forms.Label();<br/> this.btnAccessAdd = new System.Windows.Forms.Button();<br/> this.btnStart = new System.Windows.Forms.Button();<br/> this.label5 = new System.Windows.Forms.Label();<br/> this.txtAccessAdd = new System.Windows.Forms.TextBox();<br/> this.txtFlahGat = new System.Windows.Forms.TextBox();<br/> this.label1 = new System.Windows.Forms.Label();<br/> this.txtTureURL = new System.Windows.Forms.TextBox();<br/> this.label4 = new System.Windows.Forms.Label();<br/> this.txtReferURL = new System.Windows.Forms.TextBox();<br/> this.label3 = new System.Windows.Forms.Label();<br/> this.panel1.SuspendLayout();<br/> this.SuspendLayout();<br/> // <br/> // panel1<br/> // <br/> this.panel1.BackColor = System.Drawing.Color.Gainsboro;<br/> this.panel1.Controls.Add(this.btnFormUrl);<br/> this.panel1.Controls.Add(this.label2);<br/> this.panel1.Controls.Add(this.btnFlashGatAdd);<br/> this.panel1.Controls.Add(this.txtTableName);<br/> this.panel1.Controls.Add(this.label7);<br/> this.panel1.Controls.Add(this.txtFieldName);<br/> this.panel1.Controls.Add(this.label6);<br/> this.panel1.Controls.Add(this.btnAccessAdd);<br/> this.panel1.Controls.Add(this.btnStart);<br/> this.panel1.Controls.Add(this.label5);<br/> this.panel1.Controls.Add(this.txtAccessAdd);<br/> this.panel1.Controls.Add(this.txtFlahGat);<br/> this.panel1.Controls.Add(this.label1);<br/> this.panel1.Controls.Add(this.txtTureURL);<br/> this.panel1.Controls.Add(this.label4);<br/> this.panel1.Controls.Add(this.txtReferURL);<br/> this.panel1.Controls.Add(this.label3);<br/> this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;<br/> this.panel1.Location = new System.Drawing.Point(0, 0);<br/> this.panel1.Name = "panel1";<br/> this.panel1.Size = new System.Drawing.Size(352, 285);<br/> this.panel1.TabIndex = 2;<br/> this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);<br/> // <br/> // btnFormUrl<br/> // <br/> this.btnFormUrl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.btnFormUrl.Location = new System.Drawing.Point(8, 112);<br/> this.btnFormUrl.Name = "btnFormUrl";<br/> this.btnFormUrl.Size = new System.Drawing.Size(280, 21);<br/> this.btnFormUrl.TabIndex = 24;<br/> this.btnFormUrl.Text = "";<br/> // <br/> // label2<br/> // <br/> this.label2.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label2.Location = new System.Drawing.Point(8, 96);<br/> this.label2.Name = "label2";<br/> this.label2.Size = new System.Drawing.Size(128, 17);<br/> this.label2.TabIndex = 23;<br/> this.label2.Text = "来源地址:";<br/> // <br/> // btnFlashGatAdd<br/> // <br/> this.btnFlashGatAdd.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.btnFlashGatAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;<br/> this.btnFlashGatAdd.Location = new System.Drawing.Point(296, 248);<br/> this.btnFlashGatAdd.Name = "btnFlashGatAdd";<br/> this.btnFlashGatAdd.Size = new System.Drawing.Size(40, 23);<br/> this.btnFlashGatAdd.TabIndex = 22;<br/> this.btnFlashGatAdd.Text = "...";<br/> this.btnFlashGatAdd.Click += new System.EventHandler(this.btnFlashGatAdd_Click);<br/> // <br/> // txtTableName<br/> // <br/> this.txtTableName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.txtTableName.Location = new System.Drawing.Point(160, 64);<br/> this.txtTableName.Name = "txtTableName";<br/> this.txtTableName.Size = new System.Drawing.Size(128, 21);<br/> this.txtTableName.TabIndex = 21;<br/> this.txtTableName.Text = "";<br/> // <br/> // label7<br/> // <br/> this.label7.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label7.Location = new System.Drawing.Point(160, 48);<br/> this.label7.Name = "label7";<br/> this.label7.Size = new System.Drawing.Size(128, 17);<br/> this.label7.TabIndex = 20;<br/> this.label7.Text = "表明";<br/> // <br/> // txtFieldName<br/> // <br/> this.txtFieldName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.txtFieldName.Location = new System.Drawing.Point(8, 64);<br/> this.txtFieldName.Name = "txtFieldName";<br/> this.txtFieldName.Size = new System.Drawing.Size(128, 21);<br/> this.txtFieldName.TabIndex = 19;<br/> this.txtFieldName.Text = "";<br/> // <br/> // label6<br/> // <br/> this.label6.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label6.Location = new System.Drawing.Point(8, 48);<br/> this.label6.Name = "label6";<br/> this.label6.Size = new System.Drawing.Size(128, 17);<br/> this.label6.TabIndex = 18;<br/> this.label6.Text = "字段名字: ";<br/> // <br/> // btnAccessAdd<br/> // <br/> this.btnAccessAdd.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.btnAccessAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;<br/> this.btnAccessAdd.Location = new System.Drawing.Point(296, 16);<br/> this.btnAccessAdd.Name = "btnAccessAdd";<br/> this.btnAccessAdd.Size = new System.Drawing.Size(40, 21);<br/> this.btnAccessAdd.TabIndex = 17;<br/> this.btnAccessAdd.Text = "...";<br/> this.btnAccessAdd.Click += new System.EventHandler(this.btnAccessAdd_Click);<br/> // <br/> // btnStart<br/> // <br/> this.btnStart.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat;<br/> this.btnStart.Location = new System.Drawing.Point(296, 48);<br/> this.btnStart.Name = "btnStart";<br/> this.btnStart.Size = new System.Drawing.Size(40, 184);<br/> this.btnStart.TabIndex = 16;<br/> this.btnStart.Text = "开始";<br/> this.btnStart.Click += new System.EventHandler(this.btnStart_Click);<br/> // <br/> // label5<br/> // <br/> this.label5.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label5.Location = new System.Drawing.Point(8, 0);<br/> this.label5.Name = "label5";<br/> this.label5.Size = new System.Drawing.Size(128, 17);<br/> this.label5.TabIndex = 15;<br/> this.label5.Text = "Access数据库地址 :";<br/> // <br/> // txtAccessAdd<br/> // <br/> this.txtAccessAdd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.txtAccessAdd.Enabled = false;<br/> this.txtAccessAdd.Location = new System.Drawing.Point(8, 16);<br/> this.txtAccessAdd.Name = "txtAccessAdd";<br/> this.txtAccessAdd.Size = new System.Drawing.Size(280, 21);<br/> this.txtAccessAdd.TabIndex = 14;<br/> this.txtAccessAdd.Text = "";<br/> // <br/> // txtFlahGat<br/> // <br/> this.txtFlahGat.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.txtFlahGat.Enabled = false;<br/> this.txtFlahGat.Location = new System.Drawing.Point(8, 248);<br/> this.txtFlahGat.Name = "txtFlahGat";<br/> this.txtFlahGat.Size = new System.Drawing.Size(280, 21);<br/> this.txtFlahGat.TabIndex = 13;<br/> this.txtFlahGat.Text = "";<br/> // <br/> // label1<br/> // <br/> this.label1.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label1.Location = new System.Drawing.Point(8, 232);<br/> this.label1.Name = "label1";<br/> this.label1.Size = new System.Drawing.Size(128, 17);<br/> this.label1.TabIndex = 12;<br/> this.label1.Text = "FlahGat程序地址";<br/> // <br/> // txtTureURL<br/> // <br/> this.txtTureURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.txtTureURL.Location = new System.Drawing.Point(8, 200);<br/> this.txtTureURL.Name = "txtTureURL";<br/> this.txtTureURL.Size = new System.Drawing.Size(280, 21);<br/> this.txtTureURL.TabIndex = 11;<br/> this.txtTureURL.Text = "";<br/> // <br/> // label4<br/> // <br/> this.label4.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));<br/> this.label4.Location = new System.Drawing.Point(8, 184);<br/> this.label4.Name = "label4";<br/> this.label4.Size = new System.Drawing.Size(128, 17);<br/> this.label4.TabIndex = 10;<br/> this.label4.Text = "真实的网址:";<br/> // <br/> // txtReferURL<br/> // <br/> this.txtReferURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.txtReferURL.Location = new System.Drawing.Point(8, 152);<br/> this.txtReferURL.Name = "txtReferURL";<br/> this.txtReferURL.Size = new System.Drawing.Size(280, 21);<br/> this.txtReferURL.TabIndex = 9;<br/> this.txtReferURL.Text = "";<br/> // <br/> // label3<br/> // <br/> this.label3.BackColor = System.Drawing.SystemColors.ActiveBorder;<br/> this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br/> this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));<br/> this.label3.Location = new System.Drawing.Point(8, 136);<br/> this.label3.Name = "label3";<br/> this.label3.Size = new System.Drawing.Size(128, 17);<br/> this.label3.TabIndex = 8;<br/> this.label3.Text = "伪装来源:";<br/> // <br/> // MainForm<br/> // <br/> this.AcceptButton = this.btnStart;<br/> this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);<br/> this.ClientSize = new System.Drawing.Size(352, 285);<br/> this.Controls.Add(this.panel1);<br/> this.MaximizeBox = false;<br/> this.Name = "MainForm";<br/> this.Text = "获取软件真实地址";<br/> this.panel1.ResumeLayout(false);<br/> this.ResumeLayout(false);</p><p> }<br/> #endregion</p><p> /// <summary><br/> /// 应用程序的主入口点。<br/> /// </summary><br/> <br/> static void Main() <br/> {<br/> Application.Run(new MainForm());<br/> }</p><p> private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br/> {<br/> <br/> }</p><p> private void btnStart_Click(object sender, System.EventArgs e)<br/> {<br/> flashGetP.StartInfo.FileName = "cmd.exe";<br/> //flashGetP.StartInfo.FileName= flashAdd +" "+realUrl;<br/> flashGetP.StartInfo.UseShellExecute = false;<br/> flashGetP.StartInfo.RedirectStandardInput = true;<br/> flashGetP.StartInfo.CreateNoWindow = true;<br/> flashGetP.Start();</p><p> accessAdd = txtAccessAdd.Text;<br/> tableName = txtTableName.Text;<br/> fieldName=txtFieldName.Text;</p><p> referUrl= txtReferURL.Text;<br/> flashAdd = txtFlahGat.Text;</p><p> selectSQL= "Select * From "+ tableName ;<br/> strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + accessAdd;</p><p> <br/> <br/> OleDbConnection oleConn = new OleDbConnection();<br/> oleConn.ConnectionString= strConn;</p><p> OleDbDataAdapter OleDA = new OleDbDataAdapter();<br/> OleDA.SelectCommand = new OleDbCommand(selectSQL, oleConn);<br/> OleDbCommandBuilder oleCB = new OleDbCommandBuilder(OleDA);</p><p> DataSet ds = new DataSet();</p><p><br/> try <br/> {<br/> oleConn.Open();<br/> OleDA.Fill(ds, tableName);<br/> }<br/> catch<br/> {<br/> MessageBox.Show("数据源错误!!");<br/> oleConn.Close();<br/> return;<br/> }</p><p> <br/> DataTable dt = ds.Tables;<br/> int rows = dt.Rows.Count;;</p><p> for(int i= 0; i<rows; i++)<br/> {<br/> DataRow dr = dt.Rows;<br/> formUrl = (string) dr;</p><p> //btnFormUrl.Text= formUrl;</p><p> realUrl = GetRealURL(referUrl,formUrl);<br/> if (realUrl !=null)<br/> {<br/> dr= realUrl;</p><p> if(txtFlahGat.ToString() != "")<br/> flashGetP.StandardInput.WriteLine(flashAdd +" "+realUrl);<br/> }</p><p> //txtTureURL.Text=realUrl;<br/> }</p><p> OleDA.Update(ds, tableName);</p><p> oleConn.Close();<br/> flashGetP.StandardInput.WriteLine("exit");<br/> btnStart.Text="处理完毕";<br/> }</p><p> public string GetRealURL(string referURl,string formURL)<br/> {<br/> if (referURl.Length<10)<br/> {<br/> //MessageBox.Show("URL不正确吧","URL不正确");<br/> return null;<br/> }<br/> else<br/> {<br/> HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(formURL);<br/> myReq.Referer=referURl;</p><p> try<br/> {<br/> HttpWebResponse myres=(HttpWebResponse)myReq.GetResponse();<br/> }<br/> catch<br/> {<br/> return null;<br/> }</p><p> bool hasChanged = (myReq.RequestUri != myReq.Address);<br/> string geturl;<br/> if (hasChanged)<br/> {<br/> geturl=myReq.Address.ToString();<br/> }<br/> else<br/> {<br/> geturl=myReq.RequestUri.ToString();<br/> }<br/> return geturl ;<br/> }<br/> }<br/> private void btnAccessAdd_Click(object sender, System.EventArgs e)<br/> {<br/> OpenFileDialog ofd = new OpenFileDialog();<br/> ofd.Filter="Access数据库|*.mdb";<br/> if(ofd.ShowDialog() == DialogResult.OK)<br/> txtAccessAdd.Text=ofd.FileName.ToString();</p><p> btnStart.Focus();<br/> }</p><p> private void btnFlashGatAdd_Click(object sender, System.EventArgs e)<br/> {<br/> OpenFileDialog ofd = new OpenFileDialog();<br/> ofd.Filter="FlashGat|*.exe";<br/> if(ofd.ShowDialog() == DialogResult.OK)<br/> txtFlahGat.Text=ofd.FileName.ToString();<br/> btnStart.Focus();<br/> }<br/> }<br/>}<br/></p> 呵呵 长了点 郁闷 吓倒MM了 应该有人懂的,可能现在都不在吧,LZ 再等等吧 发棵,这是才100行的么? 晕了 <p></p><p>刚刚放在FP里看了下 465行</p> <p>我帮不上</p><p>我闪</p> <p>我们所学重点在于数据库的连接。。。简单啊</p><p>好多System.Windows.Forms。。。真陌生的代码</p> <p>连接的是ACCESS数据库</p><p></p><p><br/></p>
页:
[1]
2