forked from smartstore/SmartStoreNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmartStoreVersion.cs
More file actions
84 lines (77 loc) · 2.54 KB
/
Copy pathSmartStoreVersion.cs
File metadata and controls
84 lines (77 loc) · 2.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
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
using System;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using SmartStore;
namespace SmartStore.Core
{
public static class SmartStoreVersion
{
private static readonly Version s_infoVersion = new Version("1.0.0.0");
private static readonly Version s_version = Assembly.GetExecutingAssembly().GetName().Version;
private static readonly List<Version> s_breakingChangesHistory = new List<Version>
{
// IMPORTANT: Add app versions from low to high
// NOTE: do not specify build & revision unless you have good reasons for it.
// A release with breaking changes should definitely have at least
// a greater minor version.
new Version("1.2"),
new Version("1.2.1"), // MC: had to be :-(
new Version("2.0"),
new Version("2.1"),
new Version("2.2")
};
static SmartStoreVersion()
{
s_breakingChangesHistory.Reverse();
// get informational version
var infoVersionAttr = Assembly.GetExecutingAssembly().GetAttribute<AssemblyInformationalVersionAttribute>(false);
if (infoVersionAttr != null)
{
s_infoVersion = new Version(infoVersionAttr.InformationalVersion);
}
}
/// <summary>
/// Gets the app version
/// </summary>
public static string CurrentVersion
{
get
{
return "{0}.{1}".FormatInvariant(s_infoVersion.Major, s_infoVersion.Minor);
}
}
/// <summary>
/// Gets the app full version
/// </summary>
public static string CurrentFullVersion
{
get
{
return s_infoVersion.ToString();
}
}
public static Version Version
{
get
{
return s_infoVersion;
}
}
/// <summary>
/// Gets a list of SmartStore.NET versions in which breaking changes occured,
/// which could lead to plugins malfunctioning.
/// </summary>
/// <remarks>
/// A plugin's <c>MinAppVersion</c> is checked against this list to assume
/// it's compatibility with the current app version.
/// </remarks>
internal static IEnumerable<Version> BreakingChangesHistory
{
get
{
return s_breakingChangesHistory.AsEnumerable();
}
}
}
}