-
-
Notifications
You must be signed in to change notification settings - Fork 321
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (49 loc) · 1.54 KB
/
Program.cs
File metadata and controls
56 lines (49 loc) · 1.54 KB
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
using System;
using System.IO;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace StardewModdingAPI.Web;
/// <summary>The main app entry point.</summary>
public class Program
{
/*********
** Fields
*********/
/// <summary>The backing field for <see cref="CacheBustValue"/>.</summary>
private static string? CacheBustValueImpl;
/*********
** Accessors
*********/
/// <summary>A value which can be appended to URLs to force browsers to fetch new data when the server is redeployed.</summary>
public static string CacheBustValue
{
get
{
if (Program.CacheBustValueImpl is null)
{
Assembly assembly = Assembly.GetExecutingAssembly();
FileInfo fileInfo = new(assembly.Location);
Program.CacheBustValueImpl = new DateTimeOffset(fileInfo.LastWriteTime).ToUnixTimeSeconds().ToString();
}
return Program.CacheBustValueImpl;
}
}
/*********
** Public methods
*********/
/// <summary>The main app entry point.</summary>
/// <param name="args">The command-line arguments.</param>
public static void Main(string[] args)
{
Host
.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(builder => builder
.CaptureStartupErrors(true)
.UseSetting("detailedErrors", "true")
.UseStartup<Startup>()
)
.Build()
.Run();
}
}