Re-added Admin menu and display of build number

This commit is contained in:
Rick Falkvinge
2014-09-27 14:03:25 +02:00
parent ef160918ca
commit 120522d817
5 changed files with 52 additions and 27 deletions
+27
View File
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using Swarmops.Logic.Cache;
using Swarmops.Logic.Swarm;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
@@ -37,4 +39,29 @@ public class ControlV5Base : System.Web.UI.UserControl
base.OnLoad(e);
}
protected string GetBuildIdentity()
{
// Read build number if not loaded, or set to "Private" if none
string buildIdentity = (string) GuidCache.Get("_buildIdentity");
if (buildIdentity == null)
{
try
{
using (StreamReader reader = File.OpenText(HttpContext.Current.Request.MapPath("~/BuildIdentity.txt")))
{
buildIdentity = "Build " + reader.ReadLine();
}
}
catch (Exception)
{
buildIdentity = "Private Build";
}
GuidCache.Set("_buildIdentity", buildIdentity);
}
return buildIdentity;
}
}