-
Notifications
You must be signed in to change notification settings - Fork 0
/
UploadChars.aspx.cs
executable file
·90 lines (82 loc) · 2.88 KB
/
UploadChars.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
using ParseCharacters;
using WoWDetails;
public partial class UploadChars : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies.Get("SAMembers");
string username;
if (cookie == null)
{
//Response.Redirect("~/NotLoggedIn.aspx");
}
else
{
username = CheckLoggedIn.Check(cookie.Value);
}
if (IsPostBack)
{
if (CharUpload.HasFile)
{
String InputFileName = CharUpload.FileName;
if (InputFileName != "CharacterProfiler.lua")
{
LabelStatus.Text = "Sorry, you need to upload the CharacterProfiler.lua file";
}
else
{
HttpPostedFile InputFile = CharUpload.PostedFile;
Stream theStream = InputFile.InputStream;
// Call the CharacterParser class to read and parse out the Proudmoore
// chars in the file. Once done, save the object to the Cache.
CharacterParser myChars = new CharacterParser();
List<WoWCharacter> proudmooreChars = new List<WoWCharacter>();
proudmooreChars = myChars.DoParse(theStream);
Cache.Insert("uploadedChars", proudmooreChars);
// Count how many characters are in the file - reject if there arent any
int CharCount = 0;
foreach (WoWCharacter TempChar in proudmooreChars)
{
CharCount++;
}
if (CharCount > 0)
{
Response.Redirect("SelectChars.aspx");
}
else
{
LabelStatus.Text = "Sorry - that file doesn't have any characters from Proudmoore in it";
}
}
}
else
{
LabelStatus.Text = "Sorry - you need to select a file to upload";
}
}
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("Roster.aspx");
}
protected void btnViewChars_Click(object sender, EventArgs e)
{
Response.Redirect("Roster.aspx");
}
protected void btnSelectChars_Click(object sender, EventArgs e)
{
}
}