1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-13 00:28:10 -05:00

Cleaned up some code and adhered closer to the Microsoft code standards.

This commit is contained in:
RaidMax
2017-06-12 13:50:00 -04:00
parent 7a81f6c2bd
commit 0ef306a60c
22 changed files with 507 additions and 573 deletions

View File

@ -7,11 +7,11 @@ namespace SharedLibrary
{
public class WebService
{
public static List<IPage> pageList { get; private set; }
public static List<IPage> PageList { get; private set; }
public static void Init()
{
pageList = new List<IPage>();
PageList = new List<IPage>();
}
}
@ -24,10 +24,10 @@ namespace SharedLibrary
public interface IPage
{
string getPath();
string getName();
HttpResponse getPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers);
bool isVisible();
string GetPath();
string GetName();
HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers);
bool Visible();
}
public abstract class HTMLPage : IPage
@ -44,57 +44,57 @@ namespace SharedLibrary
this.visible = visible;
}
protected string getContentType()
protected string GetContentType()
{
return "text/html";
}
protected string loadFile(string filename)
protected string LoadFile(string filename)
{
string s;
IFile HTML = new IFile(filename);
s = HTML.getLines();
s = HTML.GetText();
HTML.Close();
return s;
}
protected string loadHeader()
protected string LoadHeader()
{
return loadFile("webfront\\header.html");
return LoadFile("webfront\\header.html");
}
protected string loadFooter()
protected string LoadFooter()
{
return loadFile("webfront\\footer.html");
return LoadFile("webfront\\footer.html");
}
public bool isVisible()
public bool Visible()
{
return visible;
}
virtual public string getPath()
virtual public string GetPath()
{
return "";
}
abstract public string getName();
virtual public Dictionary<string, string> getHeaders(IDictionary<string, string> requestHeaders)
abstract public string GetName();
virtual public Dictionary<string, string> GetHeaders(IDictionary<string, string> requestHeaders)
{
return new Dictionary<string, string>();
}
abstract public string getContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers);
abstract public string GetContent(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers);
public HttpResponse getPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
{
HttpResponse resp = new HttpResponse()
{
content = getContent(querySet, headers),
contentType = getContentType(),
additionalHeaders = getHeaders(headers)
content = GetContent(querySet, headers),
contentType = GetContentType(),
additionalHeaders = GetHeaders(headers)
};
return resp;
}