-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx.cs
87 lines (72 loc) · 3.77 KB
/
Default.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
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page {
protected String gstrPath;
protected String gstrFullPath;
protected Ly.IO.JsonFile gJson;
protected string gstrApps = "";
protected string gszCookieName = "";
protected Ly.Web.HttpUserAgent gUserAgent;
protected void Page_Load(object sender, EventArgs e) {
gstrPath = "";
if (Request.Cookies["UserName"] != null) {
gszCookieName = Request.Cookies["UserName"].Value;
}
gUserAgent = new Ly.Web.HttpUserAgent(HttpContext.Current.Request.UserAgent);
//Session["Manager"] = "Admin";
string szKey = "";
if (Request["key"] != null) szKey = Request["key"].ToString();
Random rnd = new Random();
if (szKey != "") {
Response.Redirect("/ui_window/Default.aspx?key=" + szKey + "&rnd=" + rnd.NextDouble());
} else {
Response.Redirect("/ui_window/Default.aspx?rnd=" + rnd.NextDouble());
}
if (Request["Path"] != null) gstrPath = Request["Path"].ToString().Trim().Replace("\\", "/");
if (gstrPath.StartsWith("/") || gstrPath.IndexOf("..") >= 0) gstrPath = "";
if (gstrPath != "" && !gstrPath.EndsWith("/")) gstrPath += "/";
gstrFullPath = "/" + gstrPath;
gJson = new Ly.IO.JsonFile(Server.MapPath("/Files/System/Apps.txt"), System.Text.Encoding.UTF8);
//String Connstr = Pub.IO.ReadAllText(Server.MapPath("/Files/System/Conn.txt"));
//检测是否安装了数据
string szConnectString = Pub.IO.ReadAllText(base.Server.MapPath(WebConfig.SZ_PATH_CONNECTSTRING));
if (!Pub.CheckInstall(szConnectString)) Response.Redirect("/Files/App/Install/Install.aspx");
//gstrApps = "{Array:[";
for (int i = 0; i < gJson.Objects.Count; i++) {
if (gJson.Objects[i].Name == "App") {
if (gJson.Objects[i].Items["Name"].Value == "#(TableList)") {
using (Ly.DB.Dream.Tables gTab = new Ly.DB.Dream.Tables(szConnectString)) {
gTab.SystemTables.GetDatasOrderByIndex();
for (int j = 0; j < gTab.SystemTables.StructureCollection.Count; j++) {
if (gstrApps != "") {
gstrApps += ",";
}
using (Ly.IO.Json js = new Ly.IO.Json()) {
js.Items["text"].Value = gTab.SystemTables.StructureCollection[j].Text;
js.Items["name"].Value = "System/Table";
js.Items["logo"].Value = "/Files/App/System/Manager/Logo.png";
js.Items["url"].Value = "/Files/App/System/Table/Default.aspx?Table=" + gTab.SystemTables.StructureCollection[j].ID;
gstrApps += js.Object.ToString().Replace("\"", "\\\"");
}
}
}
} else {
if (gstrApps != "") {
gstrApps += ",";
}
using (Ly.IO.Json js = new Ly.IO.Json()) {
js.Items["text"].Value = gJson.Objects[i].Items["Name"].Value;
js.Items["name"].Value = gJson.Objects[i].Items["Dir"].Value;
js.Items["logo"].Value = gJson.Objects[i].Items["Icon"].Value;
js.Items["url"].Value = gJson.Objects[i].Items["App"].Value;
gstrApps += js.Object.ToString().Replace("\"", "\\\"");
}
}
}
}
gstrApps = "{Array:[" + gstrApps + "]}";
}
}