-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackageList.aspx.cs
122 lines (98 loc) · 6.25 KB
/
PackageList.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
public partial class PackageInfo : System.Web.UI.Page
{
string sdkRoot = "C:\\Inetpub\\wwwroot\\sdk\\";
private string GetHtml(string file)
{
if (File.Exists(file))
{
StringBuilder retval = new StringBuilder();
using (System.IO.FileStream s = System.IO.File.OpenRead(file))
{
using (System.IO.StreamReader reader = new System.IO.StreamReader(s))
{
string line;
while ((line = reader.ReadLine()) != null)
{
if (retval.Length > 0)
retval.Append("<br/>");
retval.Append(line);
}
return retval.ToString();
}
}
}
return "No information available";
}
private string GetDescription(FileInfo file)
{
if (Regex.Match(file.Name, @"gdal-.*-core\.msi", RegexOptions.IgnoreCase).Success)
return "Generic installer for the GDAL core components";
if (Regex.Match(file.Name, @"MapManager.*\.msi", RegexOptions.IgnoreCase).Success)
return "Installer for the <a href=\"http://www.gisinternals.com/MapManager\">MapServer MapManager</a> application. The installer doesn't contain the ECW, Oracle, MrSID and FileGDB plugins, which should be installed by using the GDAL plugin msi installers.";
if (Regex.Match(file.Name, @"gdal-.*-ecw\.msi", RegexOptions.IgnoreCase).Success)
return "Installer for the GDAL ECW plugin (must be installed to the same directory as the GDAL core)";
if (Regex.Match(file.Name, @"gdal-.*-oracle\.msi", RegexOptions.IgnoreCase).Success)
return "Installer for the GDAL Oracle plugin (must be installed to the same directory as the GDAL core, make sure the proper version of oci.dll is available on your system)";
if (Regex.Match(file.Name, @"gdal-.*-mrsid\.msi", RegexOptions.IgnoreCase).Success)
return "Installer for the GDAL MrSID plugin (must be installed to the same directory as the GDAL core)";
if (Regex.Match(file.Name, @"gdal-.*-filegdb\.msi", RegexOptions.IgnoreCase).Success)
return "Installer for the OGR FileGDB plugin (must be installed to the same directory as the GDAL core)";
if (Regex.Match(file.Name, @"GDAL-.*py.*\.(exe|msi)", RegexOptions.IgnoreCase).Success)
return "Installer for the GDAL python bindings (requires to install the GDAL core)";
if (Regex.Match(file.Name, @"MapScript-.*py.*\.(exe|msi)", RegexOptions.IgnoreCase).Success)
return "Installer for the MapScript python bindings (Not yet working)";
if (Regex.Match(file.Name, @"mapserver.*\.msi", RegexOptions.IgnoreCase).Success)
return "MapServer installer with IIS registration support, including GDAL. The plugin installers can be used to install further drivers. When registering with IIS, the IIS6 management compatibility option should be installed in the IIS7+ web servers.";
return "";
}
protected void Page_Load(object sender, EventArgs e)
{
string fileIn = this.Request.QueryString["file"];
if (fileIn == null)
return;
StringBuilder contents = new StringBuilder();
string dirName = Path.GetFileNameWithoutExtension(fileIn);
contents.AppendLine("<p>Available downloads (<b>" + dirName + "</b>):</p>");
contents.AppendLine("<table>");
contents.AppendLine("<tr><th>File name</th><th>Date of compilation</th><th>Size</th><th>Description</th>");
if (File.Exists(sdkRoot + "downloads\\" + fileIn))
{
FileInfo file = new FileInfo(sdkRoot + "downloads\\" + fileIn);
contents.AppendLine("<tr><td><a href=\"Download.aspx?file=" + file.Name + "\">" + file.Name + "</a></td><td>" + file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString() + "</td><td>" + Math.Round((double)file.Length / 1024).ToString() + " kB</td><td>Compiled binaries in a single .zip package</td></tr>");
}
if (File.Exists(sdkRoot + "downloads\\" + dirName + "-src.zip"))
{
FileInfo file = new FileInfo(sdkRoot + "downloads\\" + dirName + "-src.zip");
contents.AppendLine("<tr><td><a href=\"Download.aspx?file=" + file.Name + "\">" + file.Name + "</a></td><td>" + file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString() + "</td><td>" + Math.Round((double)file.Length / 1024).ToString() + " kB</td><td>GDAL and MapServer sources</td></tr>");
}
if (File.Exists(sdkRoot + "downloads\\" + dirName + "-libs.zip"))
{
FileInfo file = new FileInfo(sdkRoot + "downloads\\" + dirName + "-libs.zip");
contents.AppendLine("<tr><td><a href=\"Download.aspx?file=" + file.Name + "\">" + file.Name + "</a></td><td>" + file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString() + "</td><td>" + Math.Round((double)file.Length / 1024).ToString() + " kB</td><td>Compiled libraries and headers</td></tr>");
}
DirectoryInfo di = new DirectoryInfo(sdkRoot + "downloads\\" + dirName);
if (di.Exists)
{
FileInfo[] files = di.GetFiles();
foreach (FileInfo file in files)
{
contents.AppendLine("<tr><td><a href=\"Download.aspx?file=" + dirName + "\\" + file.Name + "\">" + file.Name + "</a></td><td>" + file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString() + "</td><td>" + Math.Round((double)file.Length / 1024).ToString() + " kB</td><td>" + GetDescription(file) + "</td></tr>");
}
}
contents.AppendLine("</table>");
if (di.Exists)
{
contents.AppendLine("<p><span class=\"note\">Note:</span> In order to have the bindings work the location of the core components must be included manually in the PATH environment variable.</p>");
}
filelistDiv.InnerHtml = contents.ToString();
}
}