IW4M-Admin/Admin/Connection.cs

56 lines
1.2 KiB
C#
Raw Normal View History

2015-03-08 17:20:10 -04:00
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
namespace IW4MAdmin
{
class Connection
{
public Connection(String Loc)
{
Location = Loc;
ConnectionHandle = WebRequest.Create(Location);
ConnectionHandle.Proxy = null;
}
public String Read()
{
try
{
WebResponse Resp = ConnectionHandle.GetResponse();
StreamReader data_in = new StreamReader(Resp.GetResponseStream());
String result = data_in.ReadToEnd();
2015-03-08 17:20:10 -04:00
data_in.Close();
Resp.Close();
2015-03-08 17:20:10 -04:00
return result;
}
catch (System.Net.WebException)
{
return null;
}
2015-03-08 17:20:10 -04:00
}
public void Request(String data)
{
try
{
WebResponse Resp = WebRequest.Create(data).GetResponse();
Resp.Close();
}
catch (System.Net.WebException)
{
return;
}
}
2015-03-08 17:20:10 -04:00
private String Location;
private WebRequest ConnectionHandle;
}
}