本文介绍了C#中的downloadstring问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我不明白为什么这会告诉我有更新可用。
DownloadString函数是否会永久保存结果,这样如果再次执行programm,结果仍然是相同的即使答案已经改变了?如果是,只需回复是。
如果没有,请帮助我!
var Webpagestring01 = string.Empty ;
using(var web = new System.Net.WebClient())
Webpagestring01 = web.DownloadString(https://www.dropbox.com/s/yqig5di1smlkjkl/update.txt?dl=0 );
if(Webpagestring01.Contains(2.0.0))
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(Update Found!);
Console.WriteLine();
Console.ResetColor();
Console.WriteLine(----------------------------------------- -------------------------------------------------- -----------------------------);
Console.WriteLine(如果要继续使用菜单,请按1安装更新或按2);
Console.WriteLine();
Console.WriteLine(----------------------------------------- -------------------------------------------------- -----------------------------);
int answer06 = Convert.ToInt32(Console.ReadLine());
if(answer06 == 1)
{
Process.Start(https://www.dropbox.com/sh/6gx6zf2lpy1u4xj/AAAEF7wgUrxYGX9v8PKvEmXna?dl=1);
}
否则if(answer06 == 2)
{
for(int i = 1; i< = 35; i ++)
{
Console.WriteLine();
}
转到菜单;
}
}
我的尝试:
我试图通过将Webpagestring的名称更改为Webpagestring01来解决问题
解决方案
So I dont quite get why this shows me that there is an update availible.
Does the DownloadString function save the result permanentely so that if you execute the programm again the result will still be the same even if the answer has changed? If yes just reply with a yes.
If no please help me!
var Webpagestring01 = string.Empty; using (var web = new System.Net.WebClient()) Webpagestring01 = web.DownloadString("https://www.dropbox.com/s/yqig5di1smlkjkl/update.txt?dl=0"); if (Webpagestring01.Contains("2.0.0")) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(" Update Found!"); Console.WriteLine(); Console.ResetColor(); Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); Console.WriteLine("Press 1 to install the update or press 2 if you want to continue to the Menu"); Console.WriteLine(); Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); int answer06 = Convert.ToInt32(Console.ReadLine()); if (answer06 == 1) { Process.Start("https://www.dropbox.com/sh/6gx6zf2lpy1u4xj/AAAEF7wgUrxYGX9v8PKvEmXna?dl=1"); } else if (answer06 == 2) { for (int i = 1; i <= 35; i++) { Console.WriteLine(); } goto Menu; } }
What I have tried:
I tried to fix the problem by changing the names of the Webpagestring to Webpagestring01
解决方案
这篇关于C#中的downloadstring问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!