Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 06:19

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# WebClient TextDatei Download

Discussion on C# WebClient TextDatei Download within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1




 
bloodx's Avatar
 
elite*gold: 55
Join Date: Mar 2006
Posts: 4,582
Received Thanks: 1,539
C# WebClient TextDatei Download

Hallo, ich möchte eine .txt Datei als ne art Notice in ne TextBox laden, aber WebClient DownloadFile / DownloadString lädt die .txt als 1 Line gibt es da eine Lösung dass das nicht gemacht wird ?

Sonst müsste ich ja per substr etwas hinzufügen und mir den gesamten Inhalt selber zusammen basteln, finde ich nicht so super eig.



Vielen Dank.
bloodx is offline  
Old 02/23/2015, 17:12   #2


 
Requi's Avatar
 
elite*gold: 3570
The Black Market: 244/0/0
Join Date: Dec 2012
Posts: 13,044
Received Thanks: 8,252
Code:
var wc = new WebClient();
var source = wc.DownloadString("http://www.url.com");
So mache ich es und bekomme alle Zeilen.
Requi is offline  
Thanks
1 User
Old 02/23/2015, 17:18   #3




 
bloodx's Avatar
 
elite*gold: 55
Join Date: Mar 2006
Posts: 4,582
Received Thanks: 1,539
danke, aber klappt leider nicht

hatte es auch bereits so probiert :
PHP Code:
WebClient c = new WebClient();
string test =  c.DownloadString("bla.de/notice.txt"); 
aber inder TextBox wird alles in einer Zeile ausgegeben ( Ja ich habe Multi Line an )

So sieht die Text halt aus z.b
Code:
Update xxxx
Halloo
Test
Wie gehts ?
bloodx is offline  
Old 02/23/2015, 18:54   #4
 
elite*gold: 0
Join Date: Nov 2010
Posts: 700
Received Thanks: 507
Damit gibst du nur die 1. Zeile aus. Das geht ganz einfach mit "Split" und das wird dann einfach bei jeder neuen Zeile gemacht

PHP Code:
WebClient c = new WebClient();
string test =  c.DownloadString("bla.de/notice.txt").Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0]; 
Es ist zwar aber komisch das es alles in einer Zeile ausgegeben wird. Probier mal das hier:

PHP Code:
WebClient c = new WebClient();
string[] test =  c.DownloadString("bla.de/notice.txt").Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
foreach (
string i1 in testtextBox1.Text += i1 Environment.NewLine
Edit: Achso ich habe die Frage ein bisschen falsch verstanden, ich änder das nochmal ab
supercracker13 is offline  
Thanks
1 User
Old 02/23/2015, 19:05   #5




 
bloodx's Avatar
 
elite*gold: 55
Join Date: Mar 2006
Posts: 4,582
Received Thanks: 1,539
Danke :-) also ich habe jetzt ne richTextBox erstellt und da klappt es Wunderbar - bei der normalen ging es leider nicht.
bloodx is offline  
Old 02/27/2015, 07:54   #6


 
elite*gold: 1091
Join Date: Jun 2007
Posts: 19,836
Received Thanks: 7,180
Welches OS läuft auf deinem Server? Vielleicht liegt's ja an unterschiedlicher Kodierung bzw. Verwendung von einer anderen LF/CR (line feed/carriage return) Konvention. Linux handhabt das zum Beispiel anders wie Windows.
Mostey is offline  
Reply


Similar Threads Similar Threads
Problem mit Webclient
08/27/2013 - .NET Languages - 7 Replies
Ich downloade den String von einer Website dort stehen in einer Textdatei Codes. Beispiel: 1234-abcd-4567-efgh 5844-abcd-wrge-efgh 1234-abcd-4567-efgh 1234-sgwe-4567-efgh Jeder Code ist anders. Jetzt will ich den String auslesen.
Conquer Online Webclient?
12/22/2012 - CO2 Private Server - 2 Replies
As you know Java is cross-platform, so it is possible to put specific games made with Java on webclients, but for what games is that possible? I know that Runescape for example is a very famous webclient/client game, but I was wondering if Conquer Online would also be able to be put in a webclient, if you would convert the C# into Java.
[C#] Webclient / HttpWebRequest Refresh
12/06/2012 - .NET Languages - 8 Replies
Guten Tag zusammen, ich habe ein 'kleines Problem mit meinem neuen C# Projekt. Ich muss, soweit dies möglich ist, eine Seite (via Webclient oder HttpWebRequest) alle paar Minuten Neu laden (Refresh / F5), ohne diese komplett neu aufzurufen / zu "deklarieren". -> Ich habe zZ noch nichts hilfreiches darüber gefunden.
Runescape Webclient?
02/26/2012 - Runescape Private Server - 0 Replies
Hallo liebe Community, könnte mir jemand sagen, wie man einen Webclient erstellt? Ich möchte einen Runescape Server aufmachen der auf einem Webclienten läuft. Hoffe jemand hat eine Antwort. MFG Bomba :confused:
(Question)Webclient
04/16/2010 - Runescape - 5 Replies
well i want to know if there is a list with webclient and non web client like Webclient Server name: Non Web Client



All times are GMT +1. The time now is 06:21.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.