diff --git a/Logic/Support/Formatting.cs b/Logic/Support/Formatting.cs
index c41c7fbc..a419a9d6 100644
--- a/Logic/Support/Formatting.cs
+++ b/Logic/Support/Formatting.cs
@@ -14,6 +14,7 @@ namespace Swarmops.Logic.Support
public static class Formatting
{
private static string _swarmopsVersion;
+ private static DateTime? _swarmopsBuildDateTime = null;
public static string SwarmopsVersion
{
@@ -73,6 +74,62 @@ namespace Swarmops.Logic.Support
}
}
+ public static DateTime SwarmopsBuildTime
+ {
+ get
+ {
+ if (_swarmopsBuildDateTime != null)
+ {
+ return (DateTime) _swarmopsBuildDateTime;
+ }
+
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ _swarmopsBuildDateTime = DateTime.Now;
+ GuidCache.Set("_swarmopsBuildDateTime", _swarmopsBuildDateTime);
+ return (DateTime) _swarmopsBuildDateTime;
+ }
+
+ // if we still don't have it, check the cache and possibly return
+
+ _swarmopsBuildDateTime = (DateTime?) GuidCache.Get("_swarmopsBuildDateTime");
+
+ if (_swarmopsBuildDateTime != null)
+ {
+ return (DateTime) _swarmopsBuildDateTime;
+ }
+
+ try
+ {
+ if (HttpContext.Current != null) // frontend: use friendly format
+ {
+ using (
+ StreamReader reader =
+ File.OpenText(HttpContext.Current.Request.MapPath("~/BuildDateTime.txt")))
+ {
+ _swarmopsBuildDateTime = DateTime.Parse(reader.ReadLine());
+ }
+ }
+ else // backend: use build ID only
+ {
+ using (
+ StreamReader reader =
+ File.OpenText("/usr/share/swarmops/backend/BuildDateTime.txt"))
+ {
+ _swarmopsBuildDateTime = DateTime.Parse(reader.ReadLine());
+ }
+ }
+ }
+ catch (Exception)
+ {
+ _swarmopsBuildDateTime = DateTime.Now;
+ }
+
+ GuidCache.Set("_swarmopsBuildDateTime", _swarmopsBuildDateTime);
+ return (DateTime) _swarmopsBuildDateTime;
+ }
+ }
+
public static string CleanNumber (string input)
{
return LogicServices.CleanNumber (input);
diff --git a/Site/App_GlobalResources/Menu5.designer.cs b/Site/App_GlobalResources/Menu5.designer.cs
index 50639333..fb7cbc8b 100644
--- a/Site/App_GlobalResources/Menu5.designer.cs
+++ b/Site/App_GlobalResources/Menu5.designer.cs
@@ -19,7 +19,7 @@ namespace Resources {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option or rebuild the Visual Studio project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "11.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "14.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Menu5 {
@@ -132,6 +132,33 @@ namespace Resources {
}
}
+ ///