下沙论坛

 找回密码
 注册论坛(EC通行证)

QQ登录

QQ登录

下沙大学生网QQ群8(千人群)
群号:6490324 ,验证:下沙大学生网。
用手机发布本地信息严禁群发,各种宣传贴请发表在下沙信息版块有问必答,欢迎提问 提升会员等级,助你宣传
新会员必读 大学生的论坛下沙新生必读下沙币获得方法及使用
查看: 3147|回复: 21
打印 上一主题 下一主题

轻松闲聊这 有懂.NET的高人不 呵呵 HELP

[复制链接]
头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    跳转到指定楼层
    1
    发表于 2006-6-11 10:36:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

    ~~

    门外汉求助

    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏 分享分享 顶 踩

    该用户从未签到

    2
    发表于 2006-6-11 10:36:00 | 只看该作者

    什么NET?

    ASP.NET?

    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2015-9-28 12:43
  • 签到天数: 2 天

    [LV.1]初来乍到

    3
    发表于 2006-6-11 10:37:00 | 只看该作者
    不懂?
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2014-11-6 17:27
  • 签到天数: 1 天

    [LV.1]初来乍到

    4
    发表于 2006-6-11 10:38:00 | 只看该作者
    同是门外汉
    回复 支持 反对

    使用道具 举报

    头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    5
     楼主| 发表于 2006-6-11 10:47:00 | 只看该作者

    源代码是CS结尾的  编译后成EXE的哦

    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6
    发表于 2006-6-11 10:49:00 | 只看该作者
    正忙着考这门课,复习中
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7
    发表于 2006-6-11 10:49:00 | 只看该作者
    哦,计算机操作系统的
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2014-11-6 17:27
  • 签到天数: 1 天

    [LV.1]初来乍到

    8
    发表于 2006-6-11 10:49:00 | 只看该作者
    CS是反恐么?
    回复 支持 反对

    使用道具 举报

    头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    9
     楼主| 发表于 2006-6-11 10:50:00 | 只看该作者
    QUOTE:
    以下是引用天颜儿在2006-6-11 10:49:00的发言:
    正忙着考这门课,复习中

    可以帮我看一段不到100行的源代码不

    以前同学帮我写了可以用的程序  现在用不了了  不知道哪里不能用诶

    回复 支持 反对

    使用道具 举报

    该用户从未签到

    10
    发表于 2006-6-11 10:50:00 | 只看该作者
    反恐精英,红色警戒
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    11
    发表于 2006-6-11 10:51:00 | 只看该作者
    QUOTE:
    以下是引用伤心酷龙在2006-6-11 10:50:00的发言:

    可以帮我看一段不到100行的源代码不

    以前同学帮我写了可以用的程序  现在用不了了  不知道哪里不能用诶

    恐怕能力不够
    回复 支持 反对

    使用道具 举报

    头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    12
     楼主| 发表于 2006-6-11 10:52:00 | 只看该作者

    有注释的

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.OleDb;
    using System.Net;
    using System.Diagnostics;

    namespace DownLoadSoftware
    {
     /// <summary>
     /// Form1 的摘要说明。
     /// </summary>
     public class MainForm : System.Windows.Forms.Form
     {
      private System.Windows.Forms.Panel panel1;
      private System.Windows.Forms.Label label3;
      private System.Windows.Forms.TextBox txtReferURL;
      private System.Windows.Forms.Label label4;
      private System.Windows.Forms.TextBox txtTureURL;
      private System.Windows.Forms.Label label1;
      private System.Windows.Forms.TextBox txtFlahGat;
      private System.Windows.Forms.TextBox txtAccessAdd;
      private System.Windows.Forms.Label label5;
      private System.Windows.Forms.Button btnAccessAdd;
      private System.Windows.Forms.Label label6;
      private System.Windows.Forms.TextBox txtFieldName;
      private System.Windows.Forms.Label label7;
      private System.Windows.Forms.TextBox txtTableName;
      private System.Windows.Forms.Button btnStart;
      private System.Windows.Forms.Button btnFlashGatAdd;
      private System.Windows.Forms.Label label2;
      private System.Windows.Forms.TextBox btnFormUrl;

      string accessAdd;
      string tableName;
      string fieldName;

      string formUrl;//
      string referUrl;
      string flashAdd;

      string realUrl;

      string selectSQL;
      string strConn;

      rocess flashGetP = new Process();

      /// <summary>
      /// 必需的设计器变量。
      /// </summary>
      private System.ComponentModel.Container components = null;

      public MainForm()
      {
       //
       // Windows 窗体设计器支持所必需的
       //
       InitializeComponent();

       //
       // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
       //
      }

      /// <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()
      {
       this.panel1 = new System.Windows.Forms.Panel();
       this.btnFormUrl = new System.Windows.Forms.TextBox();
       this.label2 = new System.Windows.Forms.Label();
       this.btnFlashGatAdd = new System.Windows.Forms.Button();
       this.txtTableName = new System.Windows.Forms.TextBox();
       this.label7 = new System.Windows.Forms.Label();
       this.txtFieldName = new System.Windows.Forms.TextBox();
       this.label6 = new System.Windows.Forms.Label();
       this.btnAccessAdd = new System.Windows.Forms.Button();
       this.btnStart = new System.Windows.Forms.Button();
       this.label5 = new System.Windows.Forms.Label();
       this.txtAccessAdd = new System.Windows.Forms.TextBox();
       this.txtFlahGat = new System.Windows.Forms.TextBox();
       this.label1 = new System.Windows.Forms.Label();
       this.txtTureURL = new System.Windows.Forms.TextBox();
       this.label4 = new System.Windows.Forms.Label();
       this.txtReferURL = new System.Windows.Forms.TextBox();
       this.label3 = new System.Windows.Forms.Label();
       this.panel1.SuspendLayout();
       this.SuspendLayout();
       //
       // panel1
       //
       this.panel1.BackColor = System.Drawing.Color.Gainsboro;
       this.panel1.Controls.Add(this.btnFormUrl);
       this.panel1.Controls.Add(this.label2);
       this.panel1.Controls.Add(this.btnFlashGatAdd);
       this.panel1.Controls.Add(this.txtTableName);
       this.panel1.Controls.Add(this.label7);
       this.panel1.Controls.Add(this.txtFieldName);
       this.panel1.Controls.Add(this.label6);
       this.panel1.Controls.Add(this.btnAccessAdd);
       this.panel1.Controls.Add(this.btnStart);
       this.panel1.Controls.Add(this.label5);
       this.panel1.Controls.Add(this.txtAccessAdd);
       this.panel1.Controls.Add(this.txtFlahGat);
       this.panel1.Controls.Add(this.label1);
       this.panel1.Controls.Add(this.txtTureURL);
       this.panel1.Controls.Add(this.label4);
       this.panel1.Controls.Add(this.txtReferURL);
       this.panel1.Controls.Add(this.label3);
       this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
       this.panel1.Location = new System.Drawing.Point(0, 0);
       this.panel1.Name = "panel1";
       this.panel1.Size = new System.Drawing.Size(352, 285);
       this.panel1.TabIndex = 2;
       this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
       //
       // btnFormUrl
       //
       this.btnFormUrl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.btnFormUrl.Location = new System.Drawing.Point(8, 112);
       this.btnFormUrl.Name = "btnFormUrl";
       this.btnFormUrl.Size = new System.Drawing.Size(280, 21);
       this.btnFormUrl.TabIndex = 24;
       this.btnFormUrl.Text = "";
       //
       // label2
       //
       this.label2.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label2.Location = new System.Drawing.Point(8, 96);
       this.label2.Name = "label2";
       this.label2.Size = new System.Drawing.Size(128, 17);
       this.label2.TabIndex = 23;
       this.label2.Text = "来源地址:";
       //
       // btnFlashGatAdd
       //
       this.btnFlashGatAdd.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.btnFlashGatAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
       this.btnFlashGatAdd.Location = new System.Drawing.Point(296, 248);
       this.btnFlashGatAdd.Name = "btnFlashGatAdd";
       this.btnFlashGatAdd.Size = new System.Drawing.Size(40, 23);
       this.btnFlashGatAdd.TabIndex = 22;
       this.btnFlashGatAdd.Text = "...";
       this.btnFlashGatAdd.Click += new System.EventHandler(this.btnFlashGatAdd_Click);
       //
       // txtTableName
       //
       this.txtTableName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.txtTableName.Location = new System.Drawing.Point(160, 64);
       this.txtTableName.Name = "txtTableName";
       this.txtTableName.Size = new System.Drawing.Size(128, 21);
       this.txtTableName.TabIndex = 21;
       this.txtTableName.Text = "";
       //
       // label7
       //
       this.label7.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label7.Location = new System.Drawing.Point(160, 48);
       this.label7.Name = "label7";
       this.label7.Size = new System.Drawing.Size(128, 17);
       this.label7.TabIndex = 20;
       this.label7.Text = "表明";
       //
       // txtFieldName
       //
       this.txtFieldName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.txtFieldName.Location = new System.Drawing.Point(8, 64);
       this.txtFieldName.Name = "txtFieldName";
       this.txtFieldName.Size = new System.Drawing.Size(128, 21);
       this.txtFieldName.TabIndex = 19;
       this.txtFieldName.Text = "";
       //
       // label6
       //
       this.label6.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label6.Location = new System.Drawing.Point(8, 48);
       this.label6.Name = "label6";
       this.label6.Size = new System.Drawing.Size(128, 17);
       this.label6.TabIndex = 18;
       this.label6.Text = "字段名字: ";
       //
       // btnAccessAdd
       //
       this.btnAccessAdd.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.btnAccessAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
       this.btnAccessAdd.Location = new System.Drawing.Point(296, 16);
       this.btnAccessAdd.Name = "btnAccessAdd";
       this.btnAccessAdd.Size = new System.Drawing.Size(40, 21);
       this.btnAccessAdd.TabIndex = 17;
       this.btnAccessAdd.Text = "...";
       this.btnAccessAdd.Click += new System.EventHandler(this.btnAccessAdd_Click);
       //
       // btnStart
       //
       this.btnStart.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
       this.btnStart.Location = new System.Drawing.Point(296, 48);
       this.btnStart.Name = "btnStart";
       this.btnStart.Size = new System.Drawing.Size(40, 184);
       this.btnStart.TabIndex = 16;
       this.btnStart.Text = "开始";
       this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
       //
       // label5
       //
       this.label5.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label5.Location = new System.Drawing.Point(8, 0);
       this.label5.Name = "label5";
       this.label5.Size = new System.Drawing.Size(128, 17);
       this.label5.TabIndex = 15;
       this.label5.Text = "Access数据库地址 :";
       //
       // txtAccessAdd
       //
       this.txtAccessAdd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.txtAccessAdd.Enabled = false;
       this.txtAccessAdd.Location = new System.Drawing.Point(8, 16);
       this.txtAccessAdd.Name = "txtAccessAdd";
       this.txtAccessAdd.Size = new System.Drawing.Size(280, 21);
       this.txtAccessAdd.TabIndex = 14;
       this.txtAccessAdd.Text = "";
       //
       // txtFlahGat
       //
       this.txtFlahGat.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.txtFlahGat.Enabled = false;
       this.txtFlahGat.Location = new System.Drawing.Point(8, 248);
       this.txtFlahGat.Name = "txtFlahGat";
       this.txtFlahGat.Size = new System.Drawing.Size(280, 21);
       this.txtFlahGat.TabIndex = 13;
       this.txtFlahGat.Text = "";
       //
       // label1
       //
       this.label1.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label1.Location = new System.Drawing.Point(8, 232);
       this.label1.Name = "label1";
       this.label1.Size = new System.Drawing.Size(128, 17);
       this.label1.TabIndex = 12;
       this.label1.Text = "FlahGat程序地址";
       //
       // txtTureURL
       //
       this.txtTureURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.txtTureURL.Location = new System.Drawing.Point(8, 200);
       this.txtTureURL.Name = "txtTureURL";
       this.txtTureURL.Size = new System.Drawing.Size(280, 21);
       this.txtTureURL.TabIndex = 11;
       this.txtTureURL.Text = "";
       //
       // label4
       //
       this.label4.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
       this.label4.Location = new System.Drawing.Point(8, 184);
       this.label4.Name = "label4";
       this.label4.Size = new System.Drawing.Size(128, 17);
       this.label4.TabIndex = 10;
       this.label4.Text = "真实的网址:";
       //
       // txtReferURL
       //
       this.txtReferURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.txtReferURL.Location = new System.Drawing.Point(8, 152);
       this.txtReferURL.Name = "txtReferURL";
       this.txtReferURL.Size = new System.Drawing.Size(280, 21);
       this.txtReferURL.TabIndex = 9;
       this.txtReferURL.Text = "";
       //
       // label3
       //
       this.label3.BackColor = System.Drawing.SystemColors.ActiveBorder;
       this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
       this.label3.Location = new System.Drawing.Point(8, 136);
       this.label3.Name = "label3";
       this.label3.Size = new System.Drawing.Size(128, 17);
       this.label3.TabIndex = 8;
       this.label3.Text = "伪装来源:";
       //
       // MainForm
       //
       this.AcceptButton = this.btnStart;
       this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
       this.ClientSize = new System.Drawing.Size(352, 285);
       this.Controls.Add(this.panel1);
       this.MaximizeBox = false;
       this.Name = "MainForm";
       this.Text = "获取软件真实地址";
       this.panel1.ResumeLayout(false);
       this.ResumeLayout(false);

      }
      #endregion

      /// <summary>
      /// 应用程序的主入口点。
      /// </summary>
      [STAThread]
      static void Main()
      {
       Application.Run(new MainForm());
      }

      private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
      {
      
      }

      private void btnStart_Click(object sender, System.EventArgs e)
      {
       flashGetP.StartInfo.FileName = "cmd.exe";
       //flashGetP.StartInfo.FileName= flashAdd +" "+realUrl;
       flashGetP.StartInfo.UseShellExecute = false;
       flashGetP.StartInfo.RedirectStandardInput = true;
       flashGetP.StartInfo.CreateNoWindow = true;
       flashGetP.Start();

       accessAdd = txtAccessAdd.Text;
       tableName = txtTableName.Text;
       fieldName=txtFieldName.Text;

       referUrl= txtReferURL.Text;
       flashAdd = txtFlahGat.Text;

       selectSQL= "Select * From "+ tableName ;
       strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + accessAdd;

       
       
       OleDbConnection oleConn = new OleDbConnection();
       oleConn.ConnectionString= strConn;

       OleDbDataAdapter OleDA = new OleDbDataAdapter();
       OleDA.SelectCommand = new OleDbCommand(selectSQL, oleConn);
       OleDbCommandBuilder oleCB = new OleDbCommandBuilder(OleDA);

       DataSet ds = new DataSet();


       try 
       {
        oleConn.Open();
        OleDA.Fill(ds, tableName);
       }
       catch
       {
        MessageBox.Show("数据源错误!!");
        oleConn.Close();
        return;
       }

       
       DataTable dt = ds.Tables[tableName];
       int rows = dt.Rows.Count;;

       for(int i= 0; i<rows; i++)
       {
        DataRow dr = dt.Rows;
        formUrl = (string) dr[fieldName];

        //btnFormUrl.Text= formUrl;

        realUrl = GetRealURL(referUrl,formUrl);
        if (realUrl !=null)
        {
         dr[fieldName]= realUrl;

         if(txtFlahGat.ToString() != "")
          flashGetP.StandardInput.WriteLine(flashAdd +" "+realUrl);
        }

        //txtTureURL.Text=realUrl;
       }

       OleDA.Update(ds, tableName);

       oleConn.Close();
       flashGetP.StandardInput.WriteLine("exit");
       btnStart.Text="处理完毕";
      }

      public string GetRealURL(string referURl,string formURL)
      {
       if (referURl.Length<10)
       {
        //MessageBox.Show("URL不正确吧","URL不正确");
        return null;
       }
       else
       {
        HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(formURL);
        myReq.Referer=referURl;

        try
        {
         HttpWebResponse myres=(HttpWebResponse)myReq.GetResponse();
        }
        catch
        {
         return null;
        }

        bool hasChanged = (myReq.RequestUri != myReq.Address);
        string geturl;
        if (hasChanged)
        {
         geturl=myReq.Address.ToString();
        }
        else
        {
         geturl=myReq.RequestUri.ToString();
        }
        return geturl ;
       }
      }
      private void btnAccessAdd_Click(object sender, System.EventArgs e)
      {
       OpenFileDialog ofd = new OpenFileDialog();
       ofd.Filter="Access数据库|*.mdb";
       if(ofd.ShowDialog() == DialogResult.OK)
        txtAccessAdd.Text=ofd.FileName.ToString();

       btnStart.Focus();
      }

      private void btnFlashGatAdd_Click(object sender, System.EventArgs e)
      {
       OpenFileDialog ofd = new OpenFileDialog();
       ofd.Filter="FlashGat|*.exe";
       if(ofd.ShowDialog() == DialogResult.OK)
        txtFlahGat.Text=ofd.FileName.ToString();
       btnStart.Focus();
      }
     }
    }

    回复 支持 反对

    使用道具 举报

    头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    13
     楼主| 发表于 2006-6-11 10:53:00 | 只看该作者
    呵呵&nbsp; 长了点&nbsp;&nbsp; 郁闷&nbsp;&nbsp; 吓倒MM了
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    14
    发表于 2006-6-11 10:57:00 | 只看该作者
    应该有人懂的,可能现在都不在吧,LZ 再等等吧
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    15
    发表于 2006-6-11 10:58:00 | 只看该作者
    发棵,这是才100行的么?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    16
    发表于 2006-6-11 11:00:00 | 只看该作者
    晕了
    回复 支持 反对

    使用道具 举报

    头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    17
     楼主| 发表于 2006-6-11 11:00:00 | 只看该作者

    刚刚放在FP里看了下  465行

    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2014-11-6 17:27
  • 签到天数: 1 天

    [LV.1]初来乍到

    18
    发表于 2006-6-11 11:02:00 | 只看该作者

    我帮不上

    我闪

    回复 支持 反对

    使用道具 举报

    该用户从未签到

    19
    发表于 2006-6-11 11:04:00 | 只看该作者

    我们所学重点在于数据库的连接。。。简单啊

    好多System.Windows.Forms。。。真陌生的代码

    回复 支持 反对

    使用道具 举报

    头像被屏蔽
  • TA的每日心情

    2018-4-30 14:01
  • 签到天数: 2 天

    [LV.1]初来乍到

    20
     楼主| 发表于 2006-6-11 11:08:00 | 只看该作者

    连接的是ACCESS数据库


    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    下沙大学生网推荐上一条 /1 下一条

    快速回复 返回顶部 返回列表