Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用web客户端登录表单?_C#_.net_Login_Webclient - Fatal编程技术网

C# 使用web客户端登录表单?

C# 使用web客户端登录表单?,c#,.net,login,webclient,C#,.net,Login,Webclient,大家好,我正在尝试使用c#.net为我的程序制作一个登录表单,并使用web客户端从网站上托管的.txt文件中查找和读取字符串。这是我目前掌握的代码。任何帮助或链接都会很有帮助,因为我不知道去哪里找 WebClient webClient = new WebClient(); String version = webClient.DownloadString("http://prostresser.xyz/psnservices/version.txt");

大家好,我正在尝试使用c#.net为我的程序制作一个登录表单,并使用web客户端从网站上托管的.txt文件中查找和读取字符串。这是我目前掌握的代码。任何帮助或链接都会很有帮助,因为我不知道去哪里找

        WebClient webClient = new WebClient();
        String version = webClient.DownloadString("http://prostresser.xyz/psnservices/version.txt");
        label2.Text = version;

        if (label1.Text == label2.Text)
        {

        }
        else
        {

            DialogResult result = MessageBox.Show("there is a new update for ProjectRTM" + Environment.NewLine + "would you like to update?",
   "update", MessageBoxButtons.YesNo,
       MessageBoxIcon.Information);
            if (result == DialogResult.Yes)
            {

                WebClient Client = new WebClient();
                Client.DownloadFileAsync(new Uri("http://prostresser.xyz/psnservices/update.rar"), Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "update.rar");


            }
            else if (result == DialogResult.No)
            {

            }
            else
            {

            } 

        }
        if (Directory.Exists(user) && Directory.Exists(pass))
        {
           metroTextBox1.Text = File.ReadAllText(user, Encoding.ASCII);
           metroTextBox2.Text = File.ReadAllText(pass, Encoding.ASCII);
        }
    }

下载RAR文件后,应将其解压缩。你可以用

Chilkat.Rar rar = new Chilkat.Rar();

//  Note: The Chilkat RAR functionality only provides the ability
//  to open, list, and "unrar" (i.e. extract) RAR archives.  It does
//  not provide the ability to create RAR archives.

//  Also, the Chilkat RAR functionality is free.  It does not
//  require a license to use indefinitely.

bool success;
string location = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "update.rar";
string unzipLocation = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/update/";
success = rar.Open(location);
if (success != true) {
    MessageBox.Show(rar.LastErrorText);
    return;
}

success = rar.Unrar(unzipLocation);
if (success != true) {
    MessageBox.Show(rar.LastErrorText);
}
else {
    MessageBox.Show("Success.");
    // Use file stream to load your text file. Find the matching username and password as needed. Figure that out since it varies depending on the format of the content of your text file.
    // Other processing
}