From f0409c794d14add12adf9a956e143cc135fe05f6 Mon Sep 17 00:00:00 2001
From: Thomas Hounsell
Date: Thu, 23 Feb 2017 20:53:49 +0000
Subject: [PATCH] Code style consistency and enforcement
---
BuildFeed.Local/InvariantTerms.cs | 12 +-
BuildFeed.Local/Properties/AssemblyInfo.cs | 7 +-
BuildFeed.Model/Api/NewBuild.cs | 30 +-
BuildFeed.Model/Api/SearchResult.cs | 14 +-
BuildFeed.Model/Build.cs | 336 +++++------
BuildFeed.Model/BuildGroup.cs | 20 +-
BuildFeed.Model/BuildRepository-Group.cs | 168 +++---
BuildFeed.Model/BuildRepository-Lab.cs | 102 ++--
BuildFeed.Model/BuildRepository-Source.cs | 30 +-
BuildFeed.Model/BuildRepository-Version.cs | 114 ++--
BuildFeed.Model/BuildRepository-Year.cs | 82 +--
BuildFeed.Model/BuildVersion.cs | 22 +-
BuildFeed.Model/MetaItem.cs | 244 ++++----
BuildFeed.Model/MongoConfig.cs | 62 +-
BuildFeed.Model/ProjectFamily.cs | 60 +-
BuildFeed.Model/Properties/AssemblyInfo.cs | 7 +-
BuildFeed.Model/TypeOfSource.cs | 42 +-
BuildFeed.Model/View/ChangePassword.cs | 32 +-
BuildFeed.Model/View/FrontBuildGroup.cs | 12 +-
BuildFeed.Model/View/LoginUser.cs | 22 +-
BuildFeed.Model/View/RegistrationUser.cs | 38 +-
BuildFeed.Model/View/SitemapData.cs | 48 +-
BuildFeed.Model/app.config | 17 +-
BuildFeed.Model/packages.config | 19 +-
BuildFeed/App_Code/PaginationHelpers.cshtml | 80 ++-
BuildFeed/App_Start/RouteConfig.cs | 34 +-
.../Areas/admin/Controllers/baseController.cs | 54 +-
.../Areas/admin/Controllers/metaController.cs | 170 +++---
.../admin/Controllers/usersController.cs | 112 ++--
.../admin/Models/ViewModel/MetaListing.cs | 10 +-
.../Areas/admin/adminAreaRegistration.cs | 44 +-
BuildFeed/Code/CustomContentTypeAttribute.cs | 18 +-
BuildFeed/Code/DateTimeModelBinder.cs | 32 +-
BuildFeed/Code/DisplayHelpers.cs | 106 ++--
BuildFeed/Code/MvcIntrinsics.cs | 12 +-
BuildFeed/Code/Options/Locale.cs | 138 ++---
BuildFeed/Code/Options/Theme.cs | 62 +-
BuildFeed/Code/OutputCachePushAttribute.cs | 30 +-
BuildFeed/Controllers/BaseController.cs | 22 +-
BuildFeed/Controllers/apiController.cs | 5 +-
BuildFeed/Controllers/frontController.cs | 2 -
BuildFeed/Controllers/rssController.cs | 294 +++++-----
BuildFeed/Controllers/supportController.cs | 534 +++++++++---------
BuildFeed/Global.asax | 2 +-
BuildFeed/Global.asax.cs | 76 +--
BuildFeed/OneSignalSDKUpdaterWorker.js | 2 +-
BuildFeed/OneSignalSDKWorker.js | 2 +-
BuildFeed/Properties/AssemblyInfo.cs | 7 +-
BuildFeed/Views/_ViewStart.cshtml | 2 +-
BuildFeed/Views/front/AddBulk.cshtml | 78 +--
BuildFeed/Views/front/Pages.cshtml | 6 +-
BuildFeed/Views/front/editBuild.cshtml | 294 +++++-----
BuildFeed/Views/front/index.cshtml | 120 ++--
BuildFeed/Views/front/viewBuild.cshtml | 306 +++++-----
BuildFeed/Views/front/viewGroup.cshtml | 134 ++---
BuildFeed/Views/front/viewLab.cshtml | 172 +++---
BuildFeed/Views/front/viewSource.cshtml | 166 +++---
BuildFeed/Views/front/viewVersion.cshtml | 166 +++---
BuildFeed/Views/front/viewYear.cshtml | 184 +++---
BuildFeed/Views/shared/_default.cshtml | 2 +-
BuildFeed/Views/shared/error.cshtml | 2 +-
BuildFeed/Views/support/password.cshtml | 30 +-
BuildFeed/Views/support/register.cshtml | 40 +-
BuildFeed/Views/support/sitemap.cshtml | 2 +-
.../Views/support/thanks_register.cshtml | 7 +-
BuildFeed/content/Web.config | 3 +-
BuildFeed/manifest.json | 28 +-
BuildFeed/packages.config | 159 +++---
BuildFeed/res/Web.config | 3 +-
BuildFeed/res/css/dark.css.map | 2 +-
BuildFeed/res/css/default.css.map | 2 +-
BuildFeed/res/css/light.css.map | 2 +-
BuildFeed/yandex_702baad42b020be7.html | 6 +-
73 files changed, 2696 insertions(+), 2608 deletions(-)
diff --git a/BuildFeed.Local/InvariantTerms.cs b/BuildFeed.Local/InvariantTerms.cs
index ecac936..bbc34e8 100644
--- a/BuildFeed.Local/InvariantTerms.cs
+++ b/BuildFeed.Local/InvariantTerms.cs
@@ -2,10 +2,10 @@
namespace BuildFeed.Local
{
- public class InvariantTerms
- {
- public const string DeveloperName = "Thomas Hounsell";
- public const string ProductName = "Windows NT";
- public const string SiteName = "BuildFeed";
- }
+ public class InvariantTerms
+ {
+ public const string DeveloperName = "Thomas Hounsell";
+ public const string ProductName = "Windows NT";
+ public const string SiteName = "BuildFeed";
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Local/Properties/AssemblyInfo.cs b/BuildFeed.Local/Properties/AssemblyInfo.cs
index 4633fdb..5b63323 100644
--- a/BuildFeed.Local/Properties/AssemblyInfo.cs
+++ b/BuildFeed.Local/Properties/AssemblyInfo.cs
@@ -1,10 +1,10 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
+
[assembly: AssemblyTitle("BuildFeed.Local")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
+
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
+
[assembly: Guid("3485b33a-6c3a-4535-9d85-4696914ad504")]
// Version information for an assembly consists of the following four values:
@@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
+
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/BuildFeed.Model/Api/NewBuild.cs b/BuildFeed.Model/Api/NewBuild.cs
index 1eded84..9733e3f 100644
--- a/BuildFeed.Model/Api/NewBuild.cs
+++ b/BuildFeed.Model/Api/NewBuild.cs
@@ -2,20 +2,20 @@
namespace BuildFeed.Model.Api
{
- public class NewBuildPost
- {
- public NewBuild[] NewBuilds { get; set; }
- public string Password { get; set; }
- public string Username { get; set; }
- }
+ public class NewBuildPost
+ {
+ public NewBuild[] NewBuilds { get; set; }
+ public string Password { get; set; }
+ public string Username { get; set; }
+ }
- public class NewBuild
- {
- public DateTime? BuildTime { get; set; }
- public string Lab { get; set; }
- public uint MajorVersion { get; set; }
- public uint MinorVersion { get; set; }
- public uint Number { get; set; }
- public uint? Revision { get; set; }
- }
+ public class NewBuild
+ {
+ public DateTime? BuildTime { get; set; }
+ public string Lab { get; set; }
+ public uint MajorVersion { get; set; }
+ public uint MinorVersion { get; set; }
+ public uint Number { get; set; }
+ public uint? Revision { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/Api/SearchResult.cs b/BuildFeed.Model/Api/SearchResult.cs
index 299c2a1..878b3ae 100644
--- a/BuildFeed.Model/Api/SearchResult.cs
+++ b/BuildFeed.Model/Api/SearchResult.cs
@@ -1,10 +1,10 @@
namespace BuildFeed.Model.Api
{
- public class SearchResult
- {
- public string Group { get; set; }
- public string Label { get; set; }
- public string Title { get; set; }
- public string Url { get; set; }
- }
+ public class SearchResult
+ {
+ public string Group { get; set; }
+ public string Label { get; set; }
+ public string Title { get; set; }
+ public string Url { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/Build.cs b/BuildFeed.Model/Build.cs
index de2e580..0f9aeba 100644
--- a/BuildFeed.Model/Build.cs
+++ b/BuildFeed.Model/Build.cs
@@ -11,205 +11,205 @@ using Required = System.ComponentModel.DataAnnotations.RequiredAttribute;
namespace BuildFeed.Model
{
- [DataObject]
- [BsonIgnoreExtraElements]
- public class Build
- {
- [Key]
- [BsonId]
- public Guid Id { get; set; }
+ [DataObject]
+ [BsonIgnoreExtraElements]
+ public class Build
+ {
+ [Key]
+ [BsonId]
+ public Guid Id { get; set; }
- public long? LegacyId { get; set; }
+ public long? LegacyId { get; set; }
- [@Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_MajorVersion))]
- public uint MajorVersion { get; set; }
+ [@Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_MajorVersion))]
+ public uint MajorVersion { get; set; }
- [@Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_MinorVersion))]
- public uint MinorVersion { get; set; }
+ [@Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_MinorVersion))]
+ public uint MinorVersion { get; set; }
- [@Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_BuildNumber))]
- public uint Number { get; set; }
+ [@Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_BuildNumber))]
+ public uint Number { get; set; }
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Revision))]
- [DisplayFormat(ConvertEmptyStringToNull = true)]
- public uint? Revision { get; set; }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Revision))]
+ [DisplayFormat(ConvertEmptyStringToNull = true)]
+ public uint? Revision { get; set; }
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_LabString))]
- public string Lab { get; set; }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_LabString))]
+ public string Lab { get; set; }
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_BuildTime))]
- [DisplayFormat(ConvertEmptyStringToNull = true, ApplyFormatInEditMode = true, DataFormatString = "{0:yyMMdd-HHmm}")]
- public DateTime? BuildTime { get; set; }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_BuildTime))]
+ [DisplayFormat(ConvertEmptyStringToNull = true, ApplyFormatInEditMode = true, DataFormatString = "{0:yyMMdd-HHmm}")]
+ public DateTime? BuildTime { get; set; }
- [@Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Added))]
- public DateTime Added { get; set; }
+ [@Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Added))]
+ public DateTime Added { get; set; }
- [@Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Modified))]
- public DateTime Modified { get; set; }
+ [@Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Modified))]
+ public DateTime Modified { get; set; }
- [@Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_SourceType))]
- [EnumDataType(typeof(TypeOfSource))]
- public TypeOfSource SourceType { get; set; }
+ [@Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_SourceType))]
+ [EnumDataType(typeof(TypeOfSource))]
+ public TypeOfSource SourceType { get; set; }
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_SourceDetails))]
- [AllowHtml]
- public string SourceDetails { get; set; }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_SourceDetails))]
+ [AllowHtml]
+ public string SourceDetails { get; set; }
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_LeakDate))]
- [DisplayFormat(ConvertEmptyStringToNull = true, ApplyFormatInEditMode = true)]
- public DateTime? LeakDate { get; set; }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_LeakDate))]
+ [DisplayFormat(ConvertEmptyStringToNull = true, ApplyFormatInEditMode = true)]
+ public DateTime? LeakDate { get; set; }
- public string LabUrl { get; set; }
+ public string LabUrl { get; set; }
- public bool IsLeaked => SourceType == TypeOfSource.PublicRelease || SourceType == TypeOfSource.InternalLeak || SourceType == TypeOfSource.UpdateGDR || SourceType == TypeOfSource.UpdateLDR;
+ public bool IsLeaked => SourceType == TypeOfSource.PublicRelease || SourceType == TypeOfSource.InternalLeak || SourceType == TypeOfSource.UpdateGDR || SourceType == TypeOfSource.UpdateLDR;
- public string FullBuildString { get; set; }
+ public string FullBuildString { get; set; }
- public string AlternateBuildString { get; set; }
+ public string AlternateBuildString { get; set; }
- public ProjectFamily Family
- {
- get
- {
- if (Number >= 14800)
+ public ProjectFamily Family
+ {
+ get
{
- return ProjectFamily.Redstone2;
+ if (Number >= 14800)
+ {
+ return ProjectFamily.Redstone2;
+ }
+ if (Number >= 11000)
+ {
+ return ProjectFamily.Redstone;
+ }
+ if (Number >= 10500)
+ {
+ return ProjectFamily.Threshold2;
+ }
+ if (Number >= 9700)
+ {
+ return ProjectFamily.Threshold;
+ }
+ if (Number >= 9250)
+ {
+ return ProjectFamily.Windows81;
+ }
+ if (Number >= 7650)
+ {
+ return ProjectFamily.Windows8;
+ }
+ if (Number >= 6020)
+ {
+ return ProjectFamily.Windows7;
+ }
+ if (MajorVersion == 6
+ && Number >= 5000)
+ {
+ return ProjectFamily.WindowsVista;
+ }
+ if (MajorVersion == 6)
+ {
+ return ProjectFamily.Longhorn;
+ }
+ if (MajorVersion == 5
+ && Number >= 3000)
+ {
+ return ProjectFamily.Server2003;
+ }
+ if (MajorVersion == 5
+ && Number >= 2205)
+ {
+ return ProjectFamily.WindowsXP;
+ }
+ if (MajorVersion == 5
+ && MinorVersion == 50)
+ {
+ return ProjectFamily.Neptune;
+ }
+ if (MajorVersion == 5)
+ {
+ return ProjectFamily.Windows2000;
+ }
+ return ProjectFamily.None;
}
- if (Number >= 11000)
- {
- return ProjectFamily.Redstone;
- }
- if (Number >= 10500)
- {
- return ProjectFamily.Threshold2;
- }
- if (Number >= 9700)
- {
- return ProjectFamily.Threshold;
- }
- if (Number >= 9250)
- {
- return ProjectFamily.Windows81;
- }
- if (Number >= 7650)
- {
- return ProjectFamily.Windows8;
- }
- if (Number >= 6020)
- {
- return ProjectFamily.Windows7;
- }
- if (MajorVersion == 6
- && Number >= 5000)
- {
- return ProjectFamily.WindowsVista;
- }
- if (MajorVersion == 6)
- {
- return ProjectFamily.Longhorn;
- }
- if (MajorVersion == 5
- && Number >= 3000)
- {
- return ProjectFamily.Server2003;
- }
- if (MajorVersion == 5
- && Number >= 2205)
- {
- return ProjectFamily.WindowsXP;
- }
- if (MajorVersion == 5
- && MinorVersion == 50)
- {
- return ProjectFamily.Neptune;
- }
- if (MajorVersion == 5)
- {
- return ProjectFamily.Windows2000;
- }
- return ProjectFamily.None;
- }
- }
+ }
- public string SourceDetailsFiltered
- {
- get
- {
- HtmlDocument hDoc = new HtmlDocument();
- hDoc.LoadHtml($"{SourceDetails}
");
-
- if (string.IsNullOrWhiteSpace(hDoc.DocumentNode.InnerText))
+ public string SourceDetailsFiltered
+ {
+ get
{
- return "";
+ HtmlDocument hDoc = new HtmlDocument();
+ hDoc.LoadHtml($"{SourceDetails}
");
+
+ if (string.IsNullOrWhiteSpace(hDoc.DocumentNode.InnerText))
+ {
+ return "";
+ }
+
+ if (Uri.IsWellFormedUriString(hDoc.DocumentNode.InnerText, UriKind.Absolute))
+ {
+ Uri uri = new Uri(hDoc.DocumentNode.InnerText, UriKind.Absolute);
+ return $"{VariantTerms.Model_ExternalLink} ";
+ }
+
+ return SourceDetails;
+ }
+ }
+
+ public string GenerateFullBuildString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append($"{MajorVersion}.{MinorVersion}.{Number}");
+
+ if (Revision.HasValue)
+ {
+ sb.Append($".{Revision}");
}
- if (Uri.IsWellFormedUriString(hDoc.DocumentNode.InnerText, UriKind.Absolute))
+ if (!string.IsNullOrWhiteSpace(Lab))
{
- Uri uri = new Uri(hDoc.DocumentNode.InnerText, UriKind.Absolute);
- return $"{VariantTerms.Model_ExternalLink} ";
+ sb.Append($".{Lab}");
}
- return SourceDetails;
- }
- }
-
- public string GenerateFullBuildString()
- {
- StringBuilder sb = new StringBuilder();
- sb.Append($"{MajorVersion}.{MinorVersion}.{Number}");
-
- if (Revision.HasValue)
- {
- sb.Append($".{Revision}");
- }
-
- if (!string.IsNullOrWhiteSpace(Lab))
- {
- sb.Append($".{Lab}");
- }
-
- if (BuildTime.HasValue)
- {
- sb.Append($".{BuildTime.Value.ToString("yyMMdd-HHmm", CultureInfo.InvariantCulture.DateTimeFormat)}");
- }
-
- return sb.ToString();
- }
-
- public string GenerateAlternateBuildString()
- {
- StringBuilder sb = new StringBuilder();
- sb.Append($"{MajorVersion}.{MinorVersion}.{Number}");
-
- if (Revision.HasValue)
- {
- sb.Append($".{Revision}");
- }
-
- if (!string.IsNullOrWhiteSpace(Lab))
- {
- sb.Append($" ({Lab}");
-
if (BuildTime.HasValue)
{
- sb.Append($".{BuildTime.Value.ToString("yyMMdd-HHmm", CultureInfo.InvariantCulture.DateTimeFormat)}");
+ sb.Append($".{BuildTime.Value.ToString("yyMMdd-HHmm", CultureInfo.InvariantCulture.DateTimeFormat)}");
}
- sb.Append(")");
- }
+ return sb.ToString();
+ }
- return sb.ToString();
- }
+ public string GenerateAlternateBuildString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append($"{MajorVersion}.{MinorVersion}.{Number}");
- public string GenerateLabUrl() => !string.IsNullOrEmpty(Lab)
- ? Lab.Replace('/', '-').ToLower()
- : "";
- }
+ if (Revision.HasValue)
+ {
+ sb.Append($".{Revision}");
+ }
+
+ if (!string.IsNullOrWhiteSpace(Lab))
+ {
+ sb.Append($" ({Lab}");
+
+ if (BuildTime.HasValue)
+ {
+ sb.Append($".{BuildTime.Value.ToString("yyMMdd-HHmm", CultureInfo.InvariantCulture.DateTimeFormat)}");
+ }
+
+ sb.Append(")");
+ }
+
+ return sb.ToString();
+ }
+
+ public string GenerateLabUrl() => !string.IsNullOrEmpty(Lab)
+ ? Lab.Replace('/', '-').ToLower()
+ : "";
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildGroup.cs b/BuildFeed.Model/BuildGroup.cs
index a90496d..d212c51 100644
--- a/BuildFeed.Model/BuildGroup.cs
+++ b/BuildFeed.Model/BuildGroup.cs
@@ -1,14 +1,14 @@
namespace BuildFeed.Model
{
- public struct BuildGroup
- {
- public uint Major { get; set; }
- public uint Minor { get; set; }
- public uint Build { get; set; }
- public uint? Revision { get; set; }
+ public struct BuildGroup
+ {
+ public uint Major { get; set; }
+ public uint Minor { get; set; }
+ public uint Build { get; set; }
+ public uint? Revision { get; set; }
- public override string ToString() => Revision.HasValue
- ? $"{Major}.{Minor}.{Build}.{Revision.Value}"
- : $"{Major}.{Minor}.{Build}";
- }
+ public override string ToString() => Revision.HasValue
+ ? $"{Major}.{Minor}.{Build}.{Revision.Value}"
+ : $"{Major}.{Minor}.{Build}";
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildRepository-Group.cs b/BuildFeed.Model/BuildRepository-Group.cs
index cbbacb7..670ac05 100644
--- a/BuildFeed.Model/BuildRepository-Group.cs
+++ b/BuildFeed.Model/BuildRepository-Group.cs
@@ -7,95 +7,95 @@ using MongoDB.Driver;
namespace BuildFeed.Model
{
- public partial class BuildRepository
- {
- public async Task SelectAllGroups(int limit = -1, int skip = 0)
- {
- IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument
- {
- new BsonElement("_id",
- new BsonDocument
- {
- new BsonElement(nameof(BuildGroup.Major), $"${nameof(Build.MajorVersion)}"),
- new BsonElement(nameof(BuildGroup.Minor), $"${nameof(Build.MinorVersion)}"),
- new BsonElement(nameof(BuildGroup.Build), $"${nameof(Build.Number)}"),
- new BsonElement(nameof(BuildGroup.Revision), $"${nameof(Build.Revision)}")
- }),
- new BsonElement("date", new BsonDocument("$max", $"${nameof(Build.BuildTime)}")),
- new BsonElement("count", new BsonDocument("$sum", 1))
- }).Sort(new BsonDocument
- {
- new BsonElement($"_id.{nameof(BuildGroup.Major)}", -1),
- new BsonElement($"_id.{nameof(BuildGroup.Minor)}", -1),
- new BsonElement($"_id.{nameof(BuildGroup.Build)}", -1),
- new BsonElement($"_id.{nameof(BuildGroup.Revision)}", -1)
- }).Skip(skip);
-
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
-
- List grouping = await query.ToListAsync();
-
- return (from g in grouping
- select new FrontBuildGroup
- {
- Key = new BuildGroup
+ public partial class BuildRepository
+ {
+ public async Task SelectAllGroups(int limit = -1, int skip = 0)
+ {
+ IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument
+ {
+ new BsonElement("_id",
+ new BsonDocument
{
- Major = (uint)g["_id"].AsBsonDocument[nameof(BuildGroup.Major)].AsInt32,
- Minor = (uint)g["_id"].AsBsonDocument[nameof(BuildGroup.Minor)].AsInt32,
- Build = (uint)g["_id"].AsBsonDocument[nameof(BuildGroup.Build)].AsInt32,
- Revision = (uint?)g["_id"].AsBsonDocument[nameof(BuildGroup.Revision)].AsNullableInt32
- },
- LastBuild = g["date"].ToNullableUniversalTime(),
- BuildCount = g["count"].AsInt32
- }).ToArray();
- }
+ new BsonElement(nameof(BuildGroup.Major), $"${nameof(Build.MajorVersion)}"),
+ new BsonElement(nameof(BuildGroup.Minor), $"${nameof(Build.MinorVersion)}"),
+ new BsonElement(nameof(BuildGroup.Build), $"${nameof(Build.Number)}"),
+ new BsonElement(nameof(BuildGroup.Revision), $"${nameof(Build.Revision)}")
+ }),
+ new BsonElement("date", new BsonDocument("$max", $"${nameof(Build.BuildTime)}")),
+ new BsonElement("count", new BsonDocument("$sum", 1))
+ }).Sort(new BsonDocument
+ {
+ new BsonElement($"_id.{nameof(BuildGroup.Major)}", -1),
+ new BsonElement($"_id.{nameof(BuildGroup.Minor)}", -1),
+ new BsonElement($"_id.{nameof(BuildGroup.Build)}", -1),
+ new BsonElement($"_id.{nameof(BuildGroup.Revision)}", -1)
+ }).Skip(skip);
- public async Task SelectAllGroupsCount()
- {
- List grouping = await _buildCollection.Aggregate().Group(new BsonDocument
- {
- new BsonElement("_id",
- new BsonDocument
- {
- new BsonElement(nameof(BuildGroup.Major), $"${nameof(Build.MajorVersion)}"),
- new BsonElement(nameof(BuildGroup.Minor), $"${nameof(Build.MinorVersion)}"),
- new BsonElement(nameof(BuildGroup.Build), $"${nameof(Build.Number)}"),
- new BsonElement(nameof(BuildGroup.Revision), $"${nameof(Build.Revision)}")
- })
- }).ToListAsync();
- return grouping.Count;
- }
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
- public async Task> SelectGroup(BuildGroup group, int limit = -1, int skip = 0)
- {
- IFindFluent query = _buildCollection.Find(new BsonDocument
- {
+ List grouping = await query.ToListAsync();
+
+ return (from g in grouping
+ select new FrontBuildGroup
+ {
+ Key = new BuildGroup
+ {
+ Major = (uint)g["_id"].AsBsonDocument[nameof(BuildGroup.Major)].AsInt32,
+ Minor = (uint)g["_id"].AsBsonDocument[nameof(BuildGroup.Minor)].AsInt32,
+ Build = (uint)g["_id"].AsBsonDocument[nameof(BuildGroup.Build)].AsInt32,
+ Revision = (uint?)g["_id"].AsBsonDocument[nameof(BuildGroup.Revision)].AsNullableInt32
+ },
+ LastBuild = g["date"].ToNullableUniversalTime(),
+ BuildCount = g["count"].AsInt32
+ }).ToArray();
+ }
+
+ public async Task SelectAllGroupsCount()
+ {
+ List grouping = await _buildCollection.Aggregate().Group(new BsonDocument
+ {
+ new BsonElement("_id",
+ new BsonDocument
+ {
+ new BsonElement(nameof(BuildGroup.Major), $"${nameof(Build.MajorVersion)}"),
+ new BsonElement(nameof(BuildGroup.Minor), $"${nameof(Build.MinorVersion)}"),
+ new BsonElement(nameof(BuildGroup.Build), $"${nameof(Build.Number)}"),
+ new BsonElement(nameof(BuildGroup.Revision), $"${nameof(Build.Revision)}")
+ })
+ }).ToListAsync();
+ return grouping.Count;
+ }
+
+ public async Task> SelectGroup(BuildGroup group, int limit = -1, int skip = 0)
+ {
+ IFindFluent query = _buildCollection.Find(new BsonDocument
+ {
+ new BsonElement(nameof(Build.MajorVersion), group.Major),
+ new BsonElement(nameof(Build.MinorVersion), group.Minor),
+ new BsonElement(nameof(Build.Number), group.Build),
+ new BsonElement(nameof(Build.Revision), group.Revision)
+ }).Sort(new BsonDocument
+ {
+ new BsonElement(nameof(Build.BuildTime), 1)
+ }).Skip(skip);
+
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
+
+ return await query.ToListAsync();
+ }
+
+ public async Task SelectGroupCount(BuildGroup group) => await _buildCollection.CountAsync(new BsonDocument
+ {
new BsonElement(nameof(Build.MajorVersion), group.Major),
new BsonElement(nameof(Build.MinorVersion), group.Minor),
new BsonElement(nameof(Build.Number), group.Build),
new BsonElement(nameof(Build.Revision), group.Revision)
- }).Sort(new BsonDocument
- {
- new BsonElement(nameof(Build.BuildTime), 1)
- }).Skip(skip);
-
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
-
- return await query.ToListAsync();
- }
-
- public async Task SelectGroupCount(BuildGroup group) => await _buildCollection.CountAsync(new BsonDocument
- {
- new BsonElement(nameof(Build.MajorVersion), @group.Major),
- new BsonElement(nameof(Build.MinorVersion), @group.Minor),
- new BsonElement(nameof(Build.Number), @group.Build),
- new BsonElement(nameof(Build.Revision), @group.Revision)
- });
- }
+ });
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildRepository-Lab.cs b/BuildFeed.Model/BuildRepository-Lab.cs
index b1399d0..4125cd8 100644
--- a/BuildFeed.Model/BuildRepository-Lab.cs
+++ b/BuildFeed.Model/BuildRepository-Lab.cs
@@ -7,70 +7,70 @@ using MongoDB.Driver;
namespace BuildFeed.Model
{
- public partial class BuildRepository
- {
- public async Task SelectAllLabs(int limit = -1, int skip = 0)
- {
- IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument("_id", $"${nameof(Build.Lab)}")).Sort(new BsonDocument("_id", 1)).Skip(skip);
+ public partial class BuildRepository
+ {
+ public async Task SelectAllLabs(int limit = -1, int skip = 0)
+ {
+ IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument("_id", $"${nameof(Build.Lab)}")).Sort(new BsonDocument("_id", 1)).Skip(skip);
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
- List grouping = await query.ToListAsync();
+ List grouping = await query.ToListAsync();
- return (from g in grouping
- where !g["_id"].IsBsonNull
- select g["_id"].AsString).ToArray();
- }
+ return (from g in grouping
+ where !g["_id"].IsBsonNull
+ select g["_id"].AsString).ToArray();
+ }
- public async Task SelectLabsForVersion(int major, int minor)
- {
- IAggregateFluent query = _buildCollection.Aggregate().Match(new BsonDocument
- {
- new BsonElement(nameof(Build.MajorVersion), major),
- new BsonElement(nameof(Build.MinorVersion), minor)
- }).Group(new BsonDocument("_id", $"${nameof(Build.Lab)}")).Sort(new BsonDocument("_id", 1));
+ public async Task SelectLabsForVersion(int major, int minor)
+ {
+ IAggregateFluent query = _buildCollection.Aggregate().Match(new BsonDocument
+ {
+ new BsonElement(nameof(Build.MajorVersion), major),
+ new BsonElement(nameof(Build.MinorVersion), minor)
+ }).Group(new BsonDocument("_id", $"${nameof(Build.Lab)}")).Sort(new BsonDocument("_id", 1));
- List grouping = await query.ToListAsync();
+ List grouping = await query.ToListAsync();
- return (from g in grouping
- where !g["_id"].IsBsonNull
- select g["_id"].AsString).ToArray();
- }
+ return (from g in grouping
+ where !g["_id"].IsBsonNull
+ select g["_id"].AsString).ToArray();
+ }
- public async Task> SearchLabs(string search)
- {
- List> result = await _buildCollection.Aggregate().Match(b => b.Lab != null).Match(b => b.Lab != "").Match(b => b.Lab.ToLower().Contains(search.ToLower())).Group(b => b.Lab.ToLower(),
- // incoming bullshit hack
- bg => new Tuple(bg.Key)).ToListAsync();
+ public async Task> SearchLabs(string search)
+ {
+ List> result = await _buildCollection.Aggregate().Match(b => b.Lab != null).Match(b => b.Lab != "").Match(b => b.Lab.ToLower().Contains(search.ToLower())).Group(b => b.Lab.ToLower(),
+ // incoming bullshit hack
+ bg => new Tuple(bg.Key)).ToListAsync();
- // work ourselves out of aforementioned bullshit hack
- return result.Select(b => b.Item1).ToList();
- }
+ // work ourselves out of aforementioned bullshit hack
+ return result.Select(b => b.Item1).ToList();
+ }
- public async Task SelectAllLabsCount()
- {
- IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument("_id", new BsonDocument(nameof(Build.Lab), $"${nameof(Build.Lab)}"))).Sort(new BsonDocument("_id", 1));
+ public async Task SelectAllLabsCount()
+ {
+ IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument("_id", new BsonDocument(nameof(Build.Lab), $"${nameof(Build.Lab)}"))).Sort(new BsonDocument("_id", 1));
- List grouping = await query.ToListAsync();
+ List grouping = await query.ToListAsync();
- return grouping.Count;
- }
+ return grouping.Count;
+ }
- public async Task> SelectLab(string lab, int limit = -1, int skip = 0)
- {
- IFindFluent query = _buildCollection.Find(new BsonDocument(nameof(Build.LabUrl), lab)).Sort(sortByCompileDate).Skip(skip);
+ public async Task> SelectLab(string lab, int limit = -1, int skip = 0)
+ {
+ IFindFluent query = _buildCollection.Find(new BsonDocument(nameof(Build.LabUrl), lab)).Sort(sortByCompileDate).Skip(skip);
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
- return await query.ToListAsync();
- }
+ return await query.ToListAsync();
+ }
- public async Task SelectLabCount(string lab) => await _buildCollection.CountAsync(new BsonDocument(nameof(Build.LabUrl), lab));
- }
+ public async Task SelectLabCount(string lab) => await _buildCollection.CountAsync(new BsonDocument(nameof(Build.LabUrl), lab));
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildRepository-Source.cs b/BuildFeed.Model/BuildRepository-Source.cs
index 5ab73fe..fc75081 100644
--- a/BuildFeed.Model/BuildRepository-Source.cs
+++ b/BuildFeed.Model/BuildRepository-Source.cs
@@ -6,24 +6,24 @@ using MongoDB.Driver;
namespace BuildFeed.Model
{
- public partial class BuildRepository
- {
- public Task SelectAllSources(int limit = -1, int skip = 0) => Task.Run(() => Enum.GetValues(typeof(TypeOfSource)) as TypeOfSource[]);
+ public partial class BuildRepository
+ {
+ public Task SelectAllSources(int limit = -1, int skip = 0) => Task.Run(() => Enum.GetValues(typeof(TypeOfSource)) as TypeOfSource[]);
- public Task SelectAllSourcesCount() => Task.Run(() => Enum.GetValues(typeof(TypeOfSource)).LongLength);
+ public Task SelectAllSourcesCount() => Task.Run(() => Enum.GetValues(typeof(TypeOfSource)).LongLength);
- public async Task> SelectSource(TypeOfSource source, int limit = -1, int skip = 0)
- {
- IFindFluent query = _buildCollection.Find(new BsonDocument(nameof(Build.SourceType), source)).Sort(sortByOrder).Skip(skip);
+ public async Task> SelectSource(TypeOfSource source, int limit = -1, int skip = 0)
+ {
+ IFindFluent query = _buildCollection.Find(new BsonDocument(nameof(Build.SourceType), source)).Sort(sortByOrder).Skip(skip);
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
- return await query.ToListAsync();
- }
+ return await query.ToListAsync();
+ }
- public async Task SelectSourceCount(TypeOfSource source) => await _buildCollection.CountAsync(new BsonDocument(nameof(Build.SourceType), source));
- }
+ public async Task SelectSourceCount(TypeOfSource source) => await _buildCollection.CountAsync(new BsonDocument(nameof(Build.SourceType), source));
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildRepository-Version.cs b/BuildFeed.Model/BuildRepository-Version.cs
index 71474c7..353e844 100644
--- a/BuildFeed.Model/BuildRepository-Version.cs
+++ b/BuildFeed.Model/BuildRepository-Version.cs
@@ -6,67 +6,67 @@ using MongoDB.Driver;
namespace BuildFeed.Model
{
- public partial class BuildRepository
- {
- public async Task SelectAllVersions(int limit = -1, int skip = 0)
- {
- IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument("_id",
- new BsonDocument
+ public partial class BuildRepository
+ {
+ public async Task SelectAllVersions(int limit = -1, int skip = 0)
+ {
+ IAggregateFluent query = _buildCollection.Aggregate().Group(new BsonDocument("_id",
+ new BsonDocument
+ {
+ new BsonElement(nameof(BuildVersion.Major), $"${nameof(Build.MajorVersion)}"),
+ new BsonElement(nameof(BuildVersion.Minor), $"${nameof(Build.MinorVersion)}")
+ })).Sort(new BsonDocument
{
- new BsonElement(nameof(BuildVersion.Major), $"${nameof(Build.MajorVersion)}"),
- new BsonElement(nameof(BuildVersion.Minor), $"${nameof(Build.MinorVersion)}")
- })).Sort(new BsonDocument
- {
- new BsonElement($"_id.{nameof(BuildVersion.Major)}", -1),
- new BsonElement($"_id.{nameof(BuildVersion.Minor)}", -1)
- }).Skip(skip);
+ new BsonElement($"_id.{nameof(BuildVersion.Major)}", -1),
+ new BsonElement($"_id.{nameof(BuildVersion.Minor)}", -1)
+ }).Skip(skip);
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
-
- List grouping = await query.ToListAsync();
-
- return (from g in grouping
- select new BuildVersion
- {
- Major = (uint)g["_id"].AsBsonDocument[nameof(BuildVersion.Major)].AsInt32,
- Minor = (uint)g["_id"].AsBsonDocument[nameof(BuildVersion.Minor)].AsInt32
- }).ToArray();
- }
-
- public async Task SelectAllVersionsCount()
- {
- List query = await _buildCollection.Aggregate().Group(new BsonDocument("_id",
- new BsonDocument
+ if (limit > 0)
{
- new BsonElement(nameof(BuildVersion.Major), $"${nameof(Build.MajorVersion)}"),
- new BsonElement(nameof(BuildVersion.Minor), $"${nameof(Build.MinorVersion)}")
- })).ToListAsync();
- return query.Count;
- }
+ query = query.Limit(limit);
+ }
- public async Task> SelectVersion(uint major, uint minor, int limit = -1, int skip = 0)
- {
- IFindFluent query = _buildCollection.Find(new BsonDocument
- {
+ List grouping = await query.ToListAsync();
+
+ return (from g in grouping
+ select new BuildVersion
+ {
+ Major = (uint)g["_id"].AsBsonDocument[nameof(BuildVersion.Major)].AsInt32,
+ Minor = (uint)g["_id"].AsBsonDocument[nameof(BuildVersion.Minor)].AsInt32
+ }).ToArray();
+ }
+
+ public async Task SelectAllVersionsCount()
+ {
+ List query = await _buildCollection.Aggregate().Group(new BsonDocument("_id",
+ new BsonDocument
+ {
+ new BsonElement(nameof(BuildVersion.Major), $"${nameof(Build.MajorVersion)}"),
+ new BsonElement(nameof(BuildVersion.Minor), $"${nameof(Build.MinorVersion)}")
+ })).ToListAsync();
+ return query.Count;
+ }
+
+ public async Task> SelectVersion(uint major, uint minor, int limit = -1, int skip = 0)
+ {
+ IFindFluent query = _buildCollection.Find(new BsonDocument
+ {
+ new BsonElement(nameof(Build.MajorVersion), major),
+ new BsonElement(nameof(Build.MinorVersion), minor)
+ }).Sort(sortByOrder).Skip(skip);
+
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
+
+ return await query.ToListAsync();
+ }
+
+ public async Task SelectVersionCount(uint major, uint minor) => await _buildCollection.CountAsync(new BsonDocument
+ {
new BsonElement(nameof(Build.MajorVersion), major),
new BsonElement(nameof(Build.MinorVersion), minor)
- }).Sort(sortByOrder).Skip(skip);
-
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
-
- return await query.ToListAsync();
- }
-
- public async Task SelectVersionCount(uint major, uint minor) => await _buildCollection.CountAsync(new BsonDocument
- {
- new BsonElement(nameof(Build.MajorVersion), major),
- new BsonElement(nameof(Build.MinorVersion), minor)
- });
- }
+ });
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildRepository-Year.cs b/BuildFeed.Model/BuildRepository-Year.cs
index 0ebd77d..4ade8e0 100644
--- a/BuildFeed.Model/BuildRepository-Year.cs
+++ b/BuildFeed.Model/BuildRepository-Year.cs
@@ -7,54 +7,54 @@ using MongoDB.Driver;
namespace BuildFeed.Model
{
- public partial class BuildRepository
- {
- public async Task SelectAllYears(int limit = -1, int skip = 0)
- {
- IAggregateFluent query =
- _buildCollection.Aggregate()
- .Match(Builders.Filter.Ne(b => b.BuildTime, null))
- .Group(new BsonDocument("_id", new BsonDocument("$year", $"${nameof(Build.BuildTime)}")))
- .Sort(new BsonDocument("_id", -1))
- .Skip(skip);
+ public partial class BuildRepository
+ {
+ public async Task SelectAllYears(int limit = -1, int skip = 0)
+ {
+ IAggregateFluent query =
+ _buildCollection.Aggregate()
+ .Match(Builders.Filter.Ne(b => b.BuildTime, null))
+ .Group(new BsonDocument("_id", new BsonDocument("$year", $"${nameof(Build.BuildTime)}")))
+ .Sort(new BsonDocument("_id", -1))
+ .Skip(skip);
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
- List grouping = await query.ToListAsync();
+ List grouping = await query.ToListAsync();
- return (from g in grouping
- where !g["_id"].IsBsonNull
- select g["_id"].AsInt32).ToArray();
- }
+ return (from g in grouping
+ where !g["_id"].IsBsonNull
+ select g["_id"].AsInt32).ToArray();
+ }
- public async Task SelectAllYearsCount()
- {
- List query = await _buildCollection.Aggregate().Match(Builders.Filter.Ne(b => b.BuildTime, null)).Group(new BsonDocument("_id", new BsonDocument("$year", $"${nameof(Build.BuildTime)}"))).ToListAsync();
+ public async Task SelectAllYearsCount()
+ {
+ List query = await _buildCollection.Aggregate().Match(Builders.Filter.Ne(b => b.BuildTime, null)).Group(new BsonDocument("_id", new BsonDocument("$year", $"${nameof(Build.BuildTime)}"))).ToListAsync();
- return query.Count;
- }
+ return query.Count;
+ }
- public async Task> SelectYear(int year, int limit = -1, int skip = 0)
- {
- IFindFluent query =
- _buildCollection.Find(Builders.Filter.And(Builders.Filter.Gte(b => b.BuildTime, new DateTime(year, 1, 1, 0, 0, 0, DateTimeKind.Utc)),
- Builders.Filter.Lte(b => b.BuildTime, new DateTime(year, 12, 31, 23, 59, 59, DateTimeKind.Utc)))).Sort(sortByCompileDate).Skip(skip);
+ public async Task> SelectYear(int year, int limit = -1, int skip = 0)
+ {
+ IFindFluent query =
+ _buildCollection.Find(Builders.Filter.And(Builders.Filter.Gte(b => b.BuildTime, new DateTime(year, 1, 1, 0, 0, 0, DateTimeKind.Utc)),
+ Builders.Filter.Lte(b => b.BuildTime, new DateTime(year, 12, 31, 23, 59, 59, DateTimeKind.Utc)))).Sort(sortByCompileDate).Skip(skip);
- if (limit > 0)
- {
- query = query.Limit(limit);
- }
+ if (limit > 0)
+ {
+ query = query.Limit(limit);
+ }
- return await query.ToListAsync();
- }
+ return await query.ToListAsync();
+ }
- public async Task SelectYearCount(int year)
- =>
- await
- _buildCollection.CountAsync(Builders.Filter.And(Builders.Filter.Gte(b => b.BuildTime, new DateTime(year, 1, 1, 0, 0, 0, DateTimeKind.Utc)),
- Builders.Filter.Lte(b => b.BuildTime, new DateTime(year, 12, 31, 23, 59, 59, DateTimeKind.Utc))));
- }
+ public async Task SelectYearCount(int year)
+ =>
+ await
+ _buildCollection.CountAsync(Builders.Filter.And(Builders.Filter.Gte(b => b.BuildTime, new DateTime(year, 1, 1, 0, 0, 0, DateTimeKind.Utc)),
+ Builders.Filter.Lte(b => b.BuildTime, new DateTime(year, 12, 31, 23, 59, 59, DateTimeKind.Utc))));
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/BuildVersion.cs b/BuildFeed.Model/BuildVersion.cs
index cfda2d9..c381b65 100644
--- a/BuildFeed.Model/BuildVersion.cs
+++ b/BuildFeed.Model/BuildVersion.cs
@@ -1,16 +1,16 @@
namespace BuildFeed.Model
{
- public struct BuildVersion
- {
- public uint Major { get; set; }
- public uint Minor { get; set; }
+ public struct BuildVersion
+ {
+ public uint Major { get; set; }
+ public uint Minor { get; set; }
- public BuildVersion(uint major, uint minor)
- {
- Major = major;
- Minor = minor;
- }
+ public BuildVersion(uint major, uint minor)
+ {
+ Major = major;
+ Minor = minor;
+ }
- public override string ToString() => $"{Major}.{Minor}";
- }
+ public override string ToString() => $"{Major}.{Minor}";
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/MetaItem.cs b/BuildFeed.Model/MetaItem.cs
index faac284..db94127 100644
--- a/BuildFeed.Model/MetaItem.cs
+++ b/BuildFeed.Model/MetaItem.cs
@@ -12,156 +12,156 @@ using Required = System.ComponentModel.DataAnnotations.RequiredAttribute;
namespace BuildFeed.Model
{
- [DataObject]
- public class MetaItemModel
- {
- [Key]
- [BsonId]
- [@Required]
- public MetaItemKey Id { get; set; }
+ [DataObject]
+ public class MetaItemModel
+ {
+ [Key]
+ [BsonId]
+ [@Required]
+ public MetaItemKey Id { get; set; }
- [DisplayName("Meta Description")]
- public string MetaDescription { get; set; }
+ [DisplayName("Meta Description")]
+ public string MetaDescription { get; set; }
- [DisplayName("Page Content")]
- [AllowHtml]
- public string PageContent { get; set; }
- }
+ [DisplayName("Page Content")]
+ [AllowHtml]
+ public string PageContent { get; set; }
+ }
- public class MetaItem
- {
- private const string META_COLLECTION_NAME = "metaitem";
- private readonly BuildRepository _bModel;
+ public class MetaItem
+ {
+ private const string META_COLLECTION_NAME = "metaitem";
+ private readonly BuildRepository _bModel;
- private readonly IMongoCollection _metaCollection;
+ private readonly IMongoCollection _metaCollection;
- public MetaItem()
- {
- MongoClientSettings settings = new MongoClientSettings
- {
- Server = new MongoServerAddress(MongoConfig.Host, MongoConfig.Port)
- };
-
- if (!string.IsNullOrEmpty(MongoConfig.Username) && !string.IsNullOrEmpty(MongoConfig.Password))
- {
- settings.Credentials = new List
+ public MetaItem()
+ {
+ MongoClientSettings settings = new MongoClientSettings
{
- MongoCredential.CreateCredential(MongoConfig.Database, MongoConfig.Username, MongoConfig.Password)
+ Server = new MongoServerAddress(MongoConfig.Host, MongoConfig.Port)
};
- }
- MongoClient dbClient = new MongoClient(settings);
+ if (!string.IsNullOrEmpty(MongoConfig.Username) && !string.IsNullOrEmpty(MongoConfig.Password))
+ {
+ settings.Credentials = new List
+ {
+ MongoCredential.CreateCredential(MongoConfig.Database, MongoConfig.Username, MongoConfig.Password)
+ };
+ }
- _metaCollection = dbClient.GetDatabase(MongoConfig.Database).GetCollection(META_COLLECTION_NAME);
- _bModel = new BuildRepository();
- }
+ MongoClient dbClient = new MongoClient(settings);
- [DataObjectMethod(DataObjectMethodType.Select, false)]
- public async Task> Select()
- {
- return await _metaCollection.Find(new BsonDocument()).ToListAsync();
- }
+ _metaCollection = dbClient.GetDatabase(MongoConfig.Database).GetCollection(META_COLLECTION_NAME);
+ _bModel = new BuildRepository();
+ }
- [DataObjectMethod(DataObjectMethodType.Select, true)]
- public async Task> SelectByType(MetaType type)
- {
- return await _metaCollection.Find(f => f.Id.Type == type).ToListAsync();
- }
+ [DataObjectMethod(DataObjectMethodType.Select, false)]
+ public async Task> Select()
+ {
+ return await _metaCollection.Find(new BsonDocument()).ToListAsync();
+ }
- [DataObjectMethod(DataObjectMethodType.Select, false)]
- public async Task SelectById(MetaItemKey id)
- {
- return await _metaCollection.Find(f => (f.Id.Type == id.Type) && (f.Id.Value == id.Value)).SingleOrDefaultAsync();
- }
+ [DataObjectMethod(DataObjectMethodType.Select, true)]
+ public async Task> SelectByType(MetaType type)
+ {
+ return await _metaCollection.Find(f => f.Id.Type == type).ToListAsync();
+ }
- [DataObjectMethod(DataObjectMethodType.Select, false)]
- public async Task> SelectUnusedLabs()
- {
- string[] labs = await _bModel.SelectAllLabs();
+ [DataObjectMethod(DataObjectMethodType.Select, false)]
+ public async Task SelectById(MetaItemKey id)
+ {
+ return await _metaCollection.Find(f => f.Id.Type == id.Type && f.Id.Value == id.Value).SingleOrDefaultAsync();
+ }
- List usedLabs = await _metaCollection.Find(f => f.Id.Type == MetaType.Lab).ToListAsync();
+ [DataObjectMethod(DataObjectMethodType.Select, false)]
+ public async Task> SelectUnusedLabs()
+ {
+ string[] labs = await _bModel.SelectAllLabs();
- return from l in labs
- where usedLabs.All(ul => ul.Id.Value != l)
- select l;
- }
+ List usedLabs = await _metaCollection.Find(f => f.Id.Type == MetaType.Lab).ToListAsync();
- [DataObjectMethod(DataObjectMethodType.Select, false)]
- public async Task> SelectUnusedVersions()
- {
- BuildVersion[] versions = await _bModel.SelectAllVersions();
+ return from l in labs
+ where usedLabs.All(ul => ul.Id.Value != l)
+ select l;
+ }
- List usedVersions = await _metaCollection.Find(f => f.Id.Type == MetaType.Version).ToListAsync();
+ [DataObjectMethod(DataObjectMethodType.Select, false)]
+ public async Task> SelectUnusedVersions()
+ {
+ BuildVersion[] versions = await _bModel.SelectAllVersions();
- return from v in versions
- where usedVersions.All(ul => ul.Id.Value != v.ToString())
- select v.ToString();
- }
+ List usedVersions = await _metaCollection.Find(f => f.Id.Type == MetaType.Version).ToListAsync();
- [DataObjectMethod(DataObjectMethodType.Select, false)]
- public async Task> SelectUnusedYears()
- {
- int[] years = await _bModel.SelectAllYears();
+ return from v in versions
+ where usedVersions.All(ul => ul.Id.Value != v.ToString())
+ select v.ToString();
+ }
- List usedYears = await _metaCollection.Find(f => f.Id.Type == MetaType.Year).ToListAsync();
+ [DataObjectMethod(DataObjectMethodType.Select, false)]
+ public async Task> SelectUnusedYears()
+ {
+ int[] years = await _bModel.SelectAllYears();
- return from y in years
- where usedYears.All(ul => ul.Id.Value != y.ToString())
- select y.ToString();
- }
+ List usedYears = await _metaCollection.Find(f => f.Id.Type == MetaType.Year).ToListAsync();
- [DataObjectMethod(DataObjectMethodType.Insert, true)]
- public async Task Insert(MetaItemModel item)
- {
- await _metaCollection.InsertOneAsync(item);
- }
+ return from y in years
+ where usedYears.All(ul => ul.Id.Value != y.ToString())
+ select y.ToString();
+ }
- [DataObjectMethod(DataObjectMethodType.Update, true)]
- public async Task Update(MetaItemModel item)
- {
- await _metaCollection.ReplaceOneAsync(f => (f.Id.Type == item.Id.Type) && (f.Id.Value == item.Id.Value), item);
- }
+ [DataObjectMethod(DataObjectMethodType.Insert, true)]
+ public async Task Insert(MetaItemModel item)
+ {
+ await _metaCollection.InsertOneAsync(item);
+ }
- [DataObjectMethod(DataObjectMethodType.Insert, false)]
- public async Task InsertAll(IEnumerable items)
- {
- await _metaCollection.InsertManyAsync(items);
- }
+ [DataObjectMethod(DataObjectMethodType.Update, true)]
+ public async Task Update(MetaItemModel item)
+ {
+ await _metaCollection.ReplaceOneAsync(f => f.Id.Type == item.Id.Type && f.Id.Value == item.Id.Value, item);
+ }
- [DataObjectMethod(DataObjectMethodType.Delete, true)]
- public async Task DeleteById(MetaItemKey id)
- {
- await _metaCollection.DeleteOneAsync(f => (f.Id.Type == id.Type) && (f.Id.Value == id.Value));
- }
- }
+ [DataObjectMethod(DataObjectMethodType.Insert, false)]
+ public async Task InsertAll(IEnumerable items)
+ {
+ await _metaCollection.InsertManyAsync(items);
+ }
- public class MetaItemKey
- {
- public MetaType Type { get; set; }
- public string Value { get; set; }
+ [DataObjectMethod(DataObjectMethodType.Delete, true)]
+ public async Task DeleteById(MetaItemKey id)
+ {
+ await _metaCollection.DeleteOneAsync(f => f.Id.Type == id.Type && f.Id.Value == id.Value);
+ }
+ }
- public MetaItemKey()
- {
- }
+ public class MetaItemKey
+ {
+ public MetaType Type { get; set; }
+ public string Value { get; set; }
- public MetaItemKey(string id)
- {
- string[] items = id.Split(':');
- Type = (MetaType)Enum.Parse(typeof(MetaType), items[0]);
- Value = items[1];
- }
+ public MetaItemKey()
+ {
+ }
- public override string ToString()
- {
- return $"{Type}:{Value}";
- }
- }
+ public MetaItemKey(string id)
+ {
+ string[] items = id.Split(':');
+ Type = (MetaType)Enum.Parse(typeof(MetaType), items[0]);
+ Value = items[1];
+ }
- public enum MetaType
- {
- Lab,
- Version,
- Source,
- Year
- }
+ public override string ToString()
+ {
+ return $"{Type}:{Value}";
+ }
+ }
+
+ public enum MetaType
+ {
+ Lab,
+ Version,
+ Source,
+ Year
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/MongoConfig.cs b/BuildFeed.Model/MongoConfig.cs
index 4d2657d..56e0d07 100644
--- a/BuildFeed.Model/MongoConfig.cs
+++ b/BuildFeed.Model/MongoConfig.cs
@@ -2,40 +2,40 @@
namespace BuildFeed.Model
{
- public static class MongoConfig
- {
- public static string Host { get; }
- public static int Port { get; }
- public static string Database { get; }
- public static string Username { get; }
- public static string Password { get; }
+ public static class MongoConfig
+ {
+ public static string Host { get; }
+ public static int Port { get; }
+ public static string Database { get; }
+ public static string Username { get; }
+ public static string Password { get; }
- static MongoConfig()
- {
- Host = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["data:MongoHost"])
- ? ConfigurationManager.AppSettings["data:MongoHost"]
- : "localhost";
+ static MongoConfig()
+ {
+ Host = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["data:MongoHost"])
+ ? ConfigurationManager.AppSettings["data:MongoHost"]
+ : "localhost";
- int _port;
- bool success = int.TryParse(ConfigurationManager.AppSettings["data:MongoPort"], out _port);
- if (!success)
- {
- _port = 27017; // mongo default port
- }
- Port = _port;
+ int _port;
+ bool success = int.TryParse(ConfigurationManager.AppSettings["data:MongoPort"], out _port);
+ if (!success)
+ {
+ _port = 27017; // mongo default port
+ }
+ Port = _port;
- Database = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["data:MongoDB"])
- ? ConfigurationManager.AppSettings["data:MongoDB"]
- : "MongoAuth";
+ Database = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["data:MongoDB"])
+ ? ConfigurationManager.AppSettings["data:MongoDB"]
+ : "MongoAuth";
- Username = ConfigurationManager.AppSettings["data:MongoUser"] ?? "";
- Password = ConfigurationManager.AppSettings["data:MongoPass"] ?? "";
- }
+ Username = ConfigurationManager.AppSettings["data:MongoUser"] ?? "";
+ Password = ConfigurationManager.AppSettings["data:MongoPass"] ?? "";
+ }
- public static void SetupIndexes()
- {
- BuildRepository b = new BuildRepository();
- b.SetupIndexes();
- }
- }
+ public static void SetupIndexes()
+ {
+ BuildRepository b = new BuildRepository();
+ b.SetupIndexes();
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/ProjectFamily.cs b/BuildFeed.Model/ProjectFamily.cs
index 1f42e21..b52e3b7 100644
--- a/BuildFeed.Model/ProjectFamily.cs
+++ b/BuildFeed.Model/ProjectFamily.cs
@@ -2,47 +2,47 @@
namespace BuildFeed.Model
{
- public enum ProjectFamily
- {
- None,
+ public enum ProjectFamily
+ {
+ None,
- [Display(Name = "Windows 2000")]
- Windows2000,
+ [Display(Name = "Windows 2000")]
+ Windows2000,
- [Display(Name = "Neptune")]
- Neptune,
+ [Display(Name = "Neptune")]
+ Neptune,
- [Display(Name = "Windows XP")]
- WindowsXP,
+ [Display(Name = "Windows XP")]
+ WindowsXP,
- [Display(Name = "Server 2003")]
- Server2003,
+ [Display(Name = "Server 2003")]
+ Server2003,
- [Display(Name = "Longhorn")]
- Longhorn,
+ [Display(Name = "Longhorn")]
+ Longhorn,
- [Display(Name = "Vista")]
- WindowsVista,
+ [Display(Name = "Vista")]
+ WindowsVista,
- [Display(Name = "Windows 7")]
- Windows7,
+ [Display(Name = "Windows 7")]
+ Windows7,
- [Display(Name = "Windows 8")]
- Windows8,
+ [Display(Name = "Windows 8")]
+ Windows8,
- [Display(Name = "Windows 8.1")]
- Windows81,
+ [Display(Name = "Windows 8.1")]
+ Windows81,
- [Display(Name = "Threshold")]
- Threshold,
+ [Display(Name = "Threshold")]
+ Threshold,
- [Display(Name = "Threshold 2")]
- Threshold2,
+ [Display(Name = "Threshold 2")]
+ Threshold2,
- [Display(Name = "Redstone")]
- Redstone,
+ [Display(Name = "Redstone")]
+ Redstone,
- [Display(Name = "Redstone 2")]
- Redstone2
- }
+ [Display(Name = "Redstone 2")]
+ Redstone2
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/Properties/AssemblyInfo.cs b/BuildFeed.Model/Properties/AssemblyInfo.cs
index 9b23247..084fe90 100644
--- a/BuildFeed.Model/Properties/AssemblyInfo.cs
+++ b/BuildFeed.Model/Properties/AssemblyInfo.cs
@@ -1,10 +1,10 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
+
[assembly: AssemblyTitle("BuildFeed.Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
+
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
+
[assembly: Guid("7e2b4f61-1c11-4471-af80-5480e94c0664")]
// Version information for an assembly consists of the following four values:
@@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
+
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/BuildFeed.Model/TypeOfSource.cs b/BuildFeed.Model/TypeOfSource.cs
index 64760e7..5a9761b 100644
--- a/BuildFeed.Model/TypeOfSource.cs
+++ b/BuildFeed.Model/TypeOfSource.cs
@@ -3,33 +3,33 @@ using BuildFeed.Local;
namespace BuildFeed.Model
{
- public enum TypeOfSource
- {
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_PublicRelease))]
- PublicRelease = 0,
+ public enum TypeOfSource
+ {
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_PublicRelease))]
+ PublicRelease = 0,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_InternalLeak))]
- InternalLeak = 1,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_InternalLeak))]
+ InternalLeak = 1,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_UpdateGDR))]
- UpdateGDR = 2,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_UpdateGDR))]
+ UpdateGDR = 2,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_UpdateLDR))]
- UpdateLDR = 3,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_UpdateLDR))]
+ UpdateLDR = 3,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_AppPackage))]
- AppPackage = 4,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_AppPackage))]
+ AppPackage = 4,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_BuildTools))]
- BuildTools = 5,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_BuildTools))]
+ BuildTools = 5,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_Documentation))]
- Documentation = 6,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_Documentation))]
+ Documentation = 6,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_Logging))]
- Logging = 7,
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_Logging))]
+ Logging = 7,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_PrivateLeak))]
- PrivateLeak = 8
- }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_Source_PrivateLeak))]
+ PrivateLeak = 8
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/View/ChangePassword.cs b/BuildFeed.Model/View/ChangePassword.cs
index ce29151..1b6b077 100644
--- a/BuildFeed.Model/View/ChangePassword.cs
+++ b/BuildFeed.Model/View/ChangePassword.cs
@@ -3,22 +3,22 @@ using BuildFeed.Local;
namespace BuildFeed.Model.View
{
- public class ChangePassword
- {
- [Required]
- [MinLength(8)]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_ConfirmNewPassword))]
- [Compare("NewPassword")]
- public string ConfirmNewPassword { get; set; }
+ public class ChangePassword
+ {
+ [Required]
+ [MinLength(8)]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_ConfirmNewPassword))]
+ [Compare("NewPassword")]
+ public string ConfirmNewPassword { get; set; }
- [Required]
- [MinLength(8)]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EnterNewPassword))]
- public string NewPassword { get; set; }
+ [Required]
+ [MinLength(8)]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EnterNewPassword))]
+ public string NewPassword { get; set; }
- [Required]
- [MinLength(8)]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EnterCurrentPassword))]
- public string OldPassword { get; set; }
- }
+ [Required]
+ [MinLength(8)]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EnterCurrentPassword))]
+ public string OldPassword { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/View/FrontBuildGroup.cs b/BuildFeed.Model/View/FrontBuildGroup.cs
index cc32ddb..ab0e9b0 100644
--- a/BuildFeed.Model/View/FrontBuildGroup.cs
+++ b/BuildFeed.Model/View/FrontBuildGroup.cs
@@ -2,10 +2,10 @@
namespace BuildFeed.Model.View
{
- public class FrontBuildGroup
- {
- public int BuildCount { get; set; }
- public BuildGroup Key { get; set; }
- public DateTime? LastBuild { get; set; }
- }
+ public class FrontBuildGroup
+ {
+ public int BuildCount { get; set; }
+ public BuildGroup Key { get; set; }
+ public DateTime? LastBuild { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/View/LoginUser.cs b/BuildFeed.Model/View/LoginUser.cs
index 313e47a..5019ba5 100644
--- a/BuildFeed.Model/View/LoginUser.cs
+++ b/BuildFeed.Model/View/LoginUser.cs
@@ -3,17 +3,17 @@ using BuildFeed.Local;
namespace BuildFeed.Model.View
{
- public class LoginUser
- {
- [Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_UserName))]
- public string UserName { get; set; }
+ public class LoginUser
+ {
+ [Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_UserName))]
+ public string UserName { get; set; }
- [Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_Password))]
- public string Password { get; set; }
+ [Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_Password))]
+ public string Password { get; set; }
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_RememberMe))]
- public bool RememberMe { get; set; }
- }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_RememberMe))]
+ public bool RememberMe { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/View/RegistrationUser.cs b/BuildFeed.Model/View/RegistrationUser.cs
index db7ffb3..2b86c59 100644
--- a/BuildFeed.Model/View/RegistrationUser.cs
+++ b/BuildFeed.Model/View/RegistrationUser.cs
@@ -3,26 +3,26 @@ using BuildFeed.Local;
namespace BuildFeed.Model.View
{
- public class RegistrationUser
- {
- [Required]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_UserName))]
- public string UserName { get; set; }
+ public class RegistrationUser
+ {
+ [Required]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_UserName))]
+ public string UserName { get; set; }
- [Required]
- [EmailAddress]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EmailAddress))]
- public string EmailAddress { get; set; }
+ [Required]
+ [EmailAddress]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EmailAddress))]
+ public string EmailAddress { get; set; }
- [Required]
- [MinLength(8)]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EnterPassword))]
- public string Password { get; set; }
+ [Required]
+ [MinLength(8)]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_EnterPassword))]
+ public string Password { get; set; }
- [Required]
- [MinLength(8)]
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_ConfirmPassword))]
- [Compare(nameof(Password))]
- public string ConfirmPassword { get; set; }
- }
+ [Required]
+ [MinLength(8)]
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Support_ConfirmPassword))]
+ [Compare(nameof(Password))]
+ public string ConfirmPassword { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/View/SitemapData.cs b/BuildFeed.Model/View/SitemapData.cs
index 7f8fe59..e610007 100644
--- a/BuildFeed.Model/View/SitemapData.cs
+++ b/BuildFeed.Model/View/SitemapData.cs
@@ -4,35 +4,35 @@ using System.Web.Routing;
namespace BuildFeed.Model.View
{
- public class SitemapData
- {
- public Dictionary Actions { get; set; }
- public SitemapDataBuildGroup[] Builds { get; set; }
+ public class SitemapData
+ {
+ public Dictionary Actions { get; set; }
+ public SitemapDataBuildGroup[] Builds { get; set; }
- public string[] Labs { get; set; }
- }
+ public string[] Labs { get; set; }
+ }
- public class SitemapDataBuildGroup
- {
- public SitemapDataBuild[] Builds { get; set; }
- public BuildGroup Id { get; set; }
- }
+ public class SitemapDataBuildGroup
+ {
+ public SitemapDataBuild[] Builds { get; set; }
+ public BuildGroup Id { get; set; }
+ }
- public class SitemapDataBuild
- {
- public Guid Id { get; set; }
- public string Name { get; set; }
- }
+ public class SitemapDataBuild
+ {
+ public Guid Id { get; set; }
+ public string Name { get; set; }
+ }
- public class SitemapPagedAction
- {
- public string Action => UrlParams["action"].ToString();
+ public class SitemapPagedAction
+ {
+ public string Action => UrlParams["action"].ToString();
- public string Name { get; set; }
- public int Pages { get; set; }
+ public string Name { get; set; }
+ public int Pages { get; set; }
- public string UniqueId => UrlParams.GetHashCode().ToString("X8").ToLower();
+ public string UniqueId => UrlParams.GetHashCode().ToString("X8").ToLower();
- public RouteValueDictionary UrlParams { get; set; }
- }
+ public RouteValueDictionary UrlParams { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed.Model/app.config b/BuildFeed.Model/app.config
index 2ae86f9..addb1ae 100644
--- a/BuildFeed.Model/app.config
+++ b/BuildFeed.Model/app.config
@@ -1,11 +1,12 @@
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildFeed.Model/packages.config b/BuildFeed.Model/packages.config
index 63c432c..bd71db5 100644
--- a/BuildFeed.Model/packages.config
+++ b/BuildFeed.Model/packages.config
@@ -1,12 +1,13 @@
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildFeed/App_Code/PaginationHelpers.cshtml b/BuildFeed/App_Code/PaginationHelpers.cshtml
index 256c9ba..3d66701 100644
--- a/BuildFeed/App_Code/PaginationHelpers.cshtml
+++ b/BuildFeed/App_Code/PaginationHelpers.cshtml
@@ -12,28 +12,48 @@
{
RouteValueDictionary rvd = new RouteValueDictionary(rd);
rvd.Remove("page");
-
-
+
+
+
+
+
+
+
+
+
+
}
else if (currentPage > 2)
{
- RouteValueDictionary firstRvd = new RouteValueDictionary(rd);
- firstRvd.Remove("page");
-
+ RouteValueDictionary firstRvd = new RouteValueDictionary(rd);
+ firstRvd.Remove("page");
+
+
+
+
+
- RouteValueDictionary rvd = new RouteValueDictionary(rd)
- {
- ["page"] = currentPage - 1
- };
-
+ RouteValueDictionary rvd = new RouteValueDictionary(rd)
+ {
+ ["page"] = currentPage - 1
+ };
+
+
+
+
+
}
else
{
-
+
+
+
-
+
+
+
}
@@ -77,26 +97,38 @@
@if (currentPage < totalPages)
{
- RouteValueDictionary rvd = new RouteValueDictionary(rd)
- {
- ["page"] = currentPage + 1
- };
+ RouteValueDictionary rvd = new RouteValueDictionary(rd)
+ {
+ ["page"] = currentPage + 1
+ };
-
+
+
+
+
+
- RouteValueDictionary lastRvd = new RouteValueDictionary(rd)
- {
- ["page"] = totalPages
- };
-
+ RouteValueDictionary lastRvd = new RouteValueDictionary(rd)
+ {
+ ["page"] = totalPages
+ };
+
+
+
+
+
}
else
{
-
+
+
+
-
+
+
+
}
diff --git a/BuildFeed/App_Start/RouteConfig.cs b/BuildFeed/App_Start/RouteConfig.cs
index 9325e88..b15a05c 100644
--- a/BuildFeed/App_Start/RouteConfig.cs
+++ b/BuildFeed/App_Start/RouteConfig.cs
@@ -4,22 +4,22 @@ using System.Web.Routing;
namespace BuildFeed
{
- public class RouteConfig
- {
- public static void RegisterRoutes(RouteCollection routes)
- {
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+ public class RouteConfig
+ {
+ public static void RegisterRoutes(RouteCollection routes)
+ {
+ routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- routes.AppendTrailingSlash = true;
- routes.MapHttpRoute("API",
- "api/{action}/{id}",
- new
- {
- controller = "api",
- action = "GetBuilds",
- id = UrlParameter.Optional
- });
- routes.MapMvcAttributeRoutes();
- }
- }
+ routes.AppendTrailingSlash = true;
+ routes.MapHttpRoute("API",
+ "api/{action}/{id}",
+ new
+ {
+ controller = "api",
+ action = "GetBuilds",
+ id = UrlParameter.Optional
+ });
+ routes.MapMvcAttributeRoutes();
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Areas/admin/Controllers/baseController.cs b/BuildFeed/Areas/admin/Controllers/baseController.cs
index 5f732a7..751b542 100644
--- a/BuildFeed/Areas/admin/Controllers/baseController.cs
+++ b/BuildFeed/Areas/admin/Controllers/baseController.cs
@@ -5,34 +5,34 @@ using BuildFeed.Controllers;
namespace BuildFeed.Areas.admin.Controllers
{
- public class baseController : BaseController
- {
- [Authorize(Roles = "Administrators")]
- // GET: admin/base
- public ActionResult index()
- {
- return View();
- }
+ public class baseController : BaseController
+ {
+ [Authorize(Roles = "Administrators")]
+ // GET: admin/base
+ public ActionResult index()
+ {
+ return View();
+ }
- [Authorize(Users = "hounsell")]
- public ActionResult setup()
- {
- if (!Roles.RoleExists("Administrators"))
- {
- Roles.CreateRole("Administrators");
- }
- if (!Roles.IsUserInRole("hounsell", "Administrators"))
- {
- Roles.AddUserToRole("hounsell", "Administrators");
- }
+ [Authorize(Users = "hounsell")]
+ public ActionResult setup()
+ {
+ if (!Roles.RoleExists("Administrators"))
+ {
+ Roles.CreateRole("Administrators");
+ }
+ if (!Roles.IsUserInRole("hounsell", "Administrators"))
+ {
+ Roles.AddUserToRole("hounsell", "Administrators");
+ }
- return RedirectToAction("index");
- }
+ return RedirectToAction("index");
+ }
- [Authorize(Users = "hounsell")]
- public ActionResult exception()
- {
- throw new Exception("This is a test exception");
- }
- }
+ [Authorize(Users = "hounsell")]
+ public ActionResult exception()
+ {
+ throw new Exception("This is a test exception");
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Areas/admin/Controllers/metaController.cs b/BuildFeed/Areas/admin/Controllers/metaController.cs
index ad73c23..91763ff 100644
--- a/BuildFeed/Areas/admin/Controllers/metaController.cs
+++ b/BuildFeed/Areas/admin/Controllers/metaController.cs
@@ -7,102 +7,102 @@ using BuildFeed.Model;
namespace BuildFeed.Areas.admin.Controllers
{
- [Authorize(Roles = "Administrators")]
- public class metaController : BaseController
- {
- private readonly MetaItem _mModel;
+ [Authorize(Roles = "Administrators")]
+ public class metaController : BaseController
+ {
+ private readonly MetaItem _mModel;
- public metaController()
- {
- _mModel = new MetaItem();
- }
+ public metaController()
+ {
+ _mModel = new MetaItem();
+ }
- // GET: admin/meta
- public async Task index()
- {
- return View(new MetaListing
- {
- CurrentItems = from i in await _mModel.Select()
+ // GET: admin/meta
+ public async Task index()
+ {
+ return View(new MetaListing
+ {
+ CurrentItems = from i in await _mModel.Select()
+ group i by i.Id.Type
+ into b
+ orderby b.Key.ToString()
+ select b,
+ NewItems = from i in (from l in await _mModel.SelectUnusedLabs()
+ select new MetaItemModel
+ {
+ Id = new MetaItemKey
+ {
+ Type = MetaType.Lab,
+ Value = l
+ }
+ }).Concat(from v in await _mModel.SelectUnusedVersions()
+ select new MetaItemModel
+ {
+ Id = new MetaItemKey
+ {
+ Type = MetaType.Version,
+ Value = v
+ }
+ }).Concat(from y in await _mModel.SelectUnusedYears()
+ select new MetaItemModel
+ {
+ Id = new MetaItemKey
+ {
+ Type = MetaType.Year,
+ Value = y
+ }
+ })
group i by i.Id.Type
into b
orderby b.Key.ToString()
- select b,
- NewItems = from i in (from l in await _mModel.SelectUnusedLabs()
- select new MetaItemModel
- {
- Id = new MetaItemKey
- {
- Type = MetaType.Lab,
- Value = l
- }
- }).Concat(from v in await _mModel.SelectUnusedVersions()
- select new MetaItemModel
- {
- Id = new MetaItemKey
- {
- Type = MetaType.Version,
- Value = v
- }
- }).Concat(from y in await _mModel.SelectUnusedYears()
- select new MetaItemModel
- {
- Id = new MetaItemKey
- {
- Type = MetaType.Year,
- Value = y
- }
- })
- group i by i.Id.Type
- into b
- orderby b.Key.ToString()
- select b
- });
- }
+ select b
+ });
+ }
- public ActionResult create(MetaType type, string value)
- {
- return View(new MetaItemModel
- {
- Id = new MetaItemKey
+ public ActionResult create(MetaType type, string value)
+ {
+ return View(new MetaItemModel
{
- Type = type,
- Value = value
+ Id = new MetaItemKey
+ {
+ Type = type,
+ Value = value
+ }
+ });
+ }
+
+ [HttpPost]
+ public async Task create(MetaItemModel meta)
+ {
+ if (ModelState.IsValid)
+ {
+ await _mModel.Insert(meta);
+ return RedirectToAction("index");
}
- });
- }
- [HttpPost]
- public async Task create(MetaItemModel meta)
- {
- if (ModelState.IsValid)
- {
- await _mModel.Insert(meta);
- return RedirectToAction("index");
- }
+ return View(meta);
+ }
- return View(meta);
- }
+ public async Task edit(MetaType type, string value)
+ {
+ return View("create",
+ await _mModel.SelectById(new MetaItemKey
+ {
+ Type = type,
+ Value = value
+ }));
+ }
- public async Task edit(MetaType type, string value)
- {
- return View("create",
- await _mModel.SelectById(new MetaItemKey
+ [HttpPost]
+ public async Task edit(MetaItemModel meta)
+ {
+ if (ModelState.IsValid)
{
- Type = type,
- Value = value
- }));
- }
+ await _mModel.Update(meta);
+ return RedirectToAction("index");
+ }
- [HttpPost]
- public async Task edit(MetaItemModel meta)
- {
- if (ModelState.IsValid)
- {
- await _mModel.Update(meta);
- return RedirectToAction("index");
- }
-
- return View("create", meta);
- }
- }
+ return View("create", meta);
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Areas/admin/Controllers/usersController.cs b/BuildFeed/Areas/admin/Controllers/usersController.cs
index 2a5ef2d..fd7237b 100644
--- a/BuildFeed/Areas/admin/Controllers/usersController.cs
+++ b/BuildFeed/Areas/admin/Controllers/usersController.cs
@@ -8,73 +8,73 @@ using MongoAuth;
namespace BuildFeed.Areas.admin.Controllers
{
- [Authorize(Roles = "Administrators")]
- public class usersController : BaseController
- {
- // GET: admin/users
- public ActionResult index() => View(Membership.GetAllUsers().Cast().OrderByDescending(m => m.IsApproved).ThenBy(m => m.UserName));
+ [Authorize(Roles = "Administrators")]
+ public class usersController : BaseController
+ {
+ // GET: admin/users
+ public ActionResult index() => View(Membership.GetAllUsers().Cast().OrderByDescending(m => m.IsApproved).ThenBy(m => m.UserName));
- public ActionResult admins()
- {
- List admins = Roles.GetUsersInRole("Administrators").Select(Membership.GetUser).ToList();
+ public ActionResult admins()
+ {
+ List admins = Roles.GetUsersInRole("Administrators").Select(Membership.GetUser).ToList();
- return View(admins.OrderByDescending(m => m.UserName));
- }
+ return View(admins.OrderByDescending(m => m.UserName));
+ }
- public ActionResult promote(string id)
- {
- Roles.AddUserToRole(id, "Administrators");
- return RedirectToAction("Index");
- }
+ public ActionResult promote(string id)
+ {
+ Roles.AddUserToRole(id, "Administrators");
+ return RedirectToAction("Index");
+ }
- public ActionResult demote(string id)
- {
- Roles.RemoveUserFromRole(id, "Administrators");
- return RedirectToAction("Index");
- }
+ public ActionResult demote(string id)
+ {
+ Roles.RemoveUserFromRole(id, "Administrators");
+ return RedirectToAction("Index");
+ }
- public ActionResult approve(Guid id)
- {
- MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
- provider?.ChangeApproval(id, true);
- return RedirectToAction("Index");
- }
+ public ActionResult approve(Guid id)
+ {
+ MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
+ provider?.ChangeApproval(id, true);
+ return RedirectToAction("Index");
+ }
- public ActionResult unapprove(Guid id)
- {
- MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
- provider?.ChangeApproval(id, false);
- return RedirectToAction("Index");
- }
+ public ActionResult unapprove(Guid id)
+ {
+ MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
+ provider?.ChangeApproval(id, false);
+ return RedirectToAction("Index");
+ }
- public ActionResult @lock(Guid id)
- {
- MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
- provider?.ChangeLockStatus(id, true);
- return RedirectToAction("Index");
- }
+ public ActionResult @lock(Guid id)
+ {
+ MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
+ provider?.ChangeLockStatus(id, true);
+ return RedirectToAction("Index");
+ }
- public ActionResult unlock(Guid id)
- {
- MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
- provider?.ChangeLockStatus(id, false);
- return RedirectToAction("Index");
- }
+ public ActionResult unlock(Guid id)
+ {
+ MongoMembershipProvider provider = Membership.Provider as MongoMembershipProvider;
+ provider?.ChangeLockStatus(id, false);
+ return RedirectToAction("Index");
+ }
- public ActionResult cleanup()
- {
- MembershipUserCollection users = Membership.GetAllUsers();
+ public ActionResult cleanup()
+ {
+ MembershipUserCollection users = Membership.GetAllUsers();
- foreach (MembershipUser user in users)
- {
- if (!user.IsApproved
- && (user.CreationDate.AddDays(30) < DateTime.Now))
+ foreach (MembershipUser user in users)
{
- Membership.DeleteUser(user.UserName);
+ if (!user.IsApproved
+ && user.CreationDate.AddDays(30) < DateTime.Now)
+ {
+ Membership.DeleteUser(user.UserName);
+ }
}
- }
- return RedirectToAction("index");
- }
- }
+ return RedirectToAction("index");
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Areas/admin/Models/ViewModel/MetaListing.cs b/BuildFeed/Areas/admin/Models/ViewModel/MetaListing.cs
index ba39f54..eda3aab 100644
--- a/BuildFeed/Areas/admin/Models/ViewModel/MetaListing.cs
+++ b/BuildFeed/Areas/admin/Models/ViewModel/MetaListing.cs
@@ -4,9 +4,9 @@ using BuildFeed.Model;
namespace BuildFeed.Areas.admin.Models.ViewModel
{
- public class MetaListing
- {
- public IEnumerable> CurrentItems { get; set; }
- public IEnumerable> NewItems { get; set; }
- }
+ public class MetaListing
+ {
+ public IEnumerable> CurrentItems { get; set; }
+ public IEnumerable> NewItems { get; set; }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Areas/admin/adminAreaRegistration.cs b/BuildFeed/Areas/admin/adminAreaRegistration.cs
index f32ea48..1ce7941 100644
--- a/BuildFeed/Areas/admin/adminAreaRegistration.cs
+++ b/BuildFeed/Areas/admin/adminAreaRegistration.cs
@@ -2,28 +2,28 @@
namespace BuildFeed.Areas.admin
{
- public class AdminAreaRegistration : AreaRegistration
- {
- public override string AreaName => "admin";
+ public class AdminAreaRegistration : AreaRegistration
+ {
+ public override string AreaName => "admin";
- public override void RegisterArea(AreaRegistrationContext context)
- {
- context.MapRoute("Meta",
- "admin/{controller}/{action}/{type}/{value}",
- new
- {
- action = "index",
- controller = "meta"
- });
+ public override void RegisterArea(AreaRegistrationContext context)
+ {
+ context.MapRoute("Meta",
+ "admin/{controller}/{action}/{type}/{value}",
+ new
+ {
+ action = "index",
+ controller = "meta"
+ });
- context.MapRoute("Admin (Default)",
- "admin/{controller}/{action}/{id}",
- new
- {
- action = "index",
- controller = "base",
- id = UrlParameter.Optional
- });
- }
- }
+ context.MapRoute("Admin (Default)",
+ "admin/{controller}/{action}/{id}",
+ new
+ {
+ action = "index",
+ controller = "base",
+ id = UrlParameter.Optional
+ });
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/CustomContentTypeAttribute.cs b/BuildFeed/Code/CustomContentTypeAttribute.cs
index 12c8660..628db91 100644
--- a/BuildFeed/Code/CustomContentTypeAttribute.cs
+++ b/BuildFeed/Code/CustomContentTypeAttribute.cs
@@ -2,14 +2,14 @@
namespace BuildFeed.Code
{
- // this class is a hacky workaround because Microsoft just don't feel like caching the correct content type
- public class CustomContentTypeAttribute : ActionFilterAttribute
- {
- public string ContentType { get; set; }
+ // this class is a hacky workaround because Microsoft just don't feel like caching the correct content type
+ public class CustomContentTypeAttribute : ActionFilterAttribute
+ {
+ public string ContentType { get; set; }
- public override void OnResultExecuted(ResultExecutedContext filterContext)
- {
- filterContext.HttpContext.Response.ContentType = ContentType;
- }
- }
+ public override void OnResultExecuted(ResultExecutedContext filterContext)
+ {
+ filterContext.HttpContext.Response.ContentType = ContentType;
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/DateTimeModelBinder.cs b/BuildFeed/Code/DateTimeModelBinder.cs
index 4182379..6340364 100644
--- a/BuildFeed/Code/DateTimeModelBinder.cs
+++ b/BuildFeed/Code/DateTimeModelBinder.cs
@@ -4,23 +4,23 @@ using System.Web.Mvc;
namespace BuildFeed.Code
{
- public class DateTimeModelBinder : DefaultModelBinder
- {
- public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
- {
- ValueProviderResult value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
+ public class DateTimeModelBinder : DefaultModelBinder
+ {
+ public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
+ {
+ ValueProviderResult value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
- DateTime retValue;
- bool success = DateTime.TryParse(value.AttemptedValue, CultureInfo.CurrentUICulture.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces, out retValue);
+ DateTime retValue;
+ bool success = DateTime.TryParse(value.AttemptedValue, CultureInfo.CurrentUICulture.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces, out retValue);
- if (!success)
- {
- success = DateTime.TryParseExact(value.AttemptedValue, "yyMMdd-HHmm", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out retValue);
- }
+ if (!success)
+ {
+ success = DateTime.TryParseExact(value.AttemptedValue, "yyMMdd-HHmm", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out retValue);
+ }
- return success
- ? retValue as DateTime?
- : null;
- }
- }
+ return success
+ ? retValue as DateTime?
+ : null;
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/DisplayHelpers.cs b/BuildFeed/Code/DisplayHelpers.cs
index 403647e..49161d4 100644
--- a/BuildFeed/Code/DisplayHelpers.cs
+++ b/BuildFeed/Code/DisplayHelpers.cs
@@ -8,68 +8,68 @@ using System.Web.Mvc;
namespace BuildFeed.Code
{
- public static class MvcExtensions
- {
- public static IHtmlString CheckboxListForEnum(this HtmlHelper html, string id, T currentItem) where T : struct
- {
- StringBuilder sb = new StringBuilder();
+ public static class MvcExtensions
+ {
+ public static IHtmlString CheckboxListForEnum(this HtmlHelper html, string id, T currentItem) where T : struct
+ {
+ StringBuilder sb = new StringBuilder();
- foreach (T enumItem in Enum.GetValues(typeof(T)).Cast())
- {
- long enumValue = Convert.ToInt64(enumItem);
- long currentValue = Convert.ToInt64(currentItem);
-
- if (enumValue == 0)
+ foreach (T enumItem in Enum.GetValues(typeof(T)).Cast())
{
- // skip 0-valued bitflags, they're for display only.
- continue;
+ long enumValue = Convert.ToInt64(enumItem);
+ long currentValue = Convert.ToInt64(currentItem);
+
+ if (enumValue == 0)
+ {
+ // skip 0-valued bitflags, they're for display only.
+ continue;
+ }
+
+ TagBuilder wrapper = new TagBuilder("div");
+ wrapper.Attributes.Add("class", "checkbox");
+
+ TagBuilder label = new TagBuilder("label");
+
+ TagBuilder input = new TagBuilder("input");
+ if ((enumValue & currentValue) != 0)
+ {
+ input.MergeAttribute("checked", "checked");
+ }
+ input.MergeAttribute("type", "checkbox");
+ input.MergeAttribute("value", enumValue.ToString());
+ input.MergeAttribute("name", id);
+
+ label.InnerHtml = input.ToString(TagRenderMode.SelfClosing);
+ label.InnerHtml += GetDisplayTextForEnum(enumItem);
+
+ wrapper.InnerHtml = label.ToString(TagRenderMode.Normal);
+
+ sb.Append(wrapper.ToString(TagRenderMode.Normal));
}
- TagBuilder wrapper = new TagBuilder("div");
- wrapper.Attributes.Add("class", "checkbox");
+ return new HtmlString(sb.ToString());
+ }
- TagBuilder label = new TagBuilder("label");
+ public static string GetDisplayTextForEnum(object o)
+ {
+ string result = null;
+ DisplayAttribute display = o.GetType().GetMember(o.ToString()).First().GetCustomAttributes(false).OfType().LastOrDefault();
- TagBuilder input = new TagBuilder("input");
- if ((enumValue & currentValue) != 0)
+ if (display != null)
{
- input.MergeAttribute("checked", "checked");
+ result = display.GetName();
}
- input.MergeAttribute("type", "checkbox");
- input.MergeAttribute("value", enumValue.ToString());
- input.MergeAttribute("name", id);
- label.InnerHtml = input.ToString(TagRenderMode.SelfClosing);
- label.InnerHtml += GetDisplayTextForEnum(enumItem);
+ return result ?? o.ToString();
+ }
- wrapper.InnerHtml = label.ToString(TagRenderMode.Normal);
+ public static string ToLongDateWithoutDay(this DateTime dt)
+ {
+ string s = CultureInfo.CurrentUICulture.DateTimeFormat.LongDatePattern;
+ s = s.Replace("dddd", "").Replace("ddd", "");
+ s = s.Trim(' ', ',');
- sb.Append(wrapper.ToString(TagRenderMode.Normal));
- }
-
- return new HtmlString(sb.ToString());
- }
-
- public static string GetDisplayTextForEnum(object o)
- {
- string result = null;
- DisplayAttribute display = o.GetType().GetMember(o.ToString()).First().GetCustomAttributes(false).OfType().LastOrDefault();
-
- if (display != null)
- {
- result = display.GetName();
- }
-
- return result ?? o.ToString();
- }
-
- public static string ToLongDateWithoutDay(this DateTime dt)
- {
- string s = CultureInfo.CurrentUICulture.DateTimeFormat.LongDatePattern;
- s = s.Replace("dddd", "").Replace("ddd", "");
- s = s.Trim(' ', ',');
-
- return dt.ToString(s);
- }
- }
+ return dt.ToString(s);
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/MvcIntrinsics.cs b/BuildFeed/Code/MvcIntrinsics.cs
index 4c650c0..65770b5 100644
--- a/BuildFeed/Code/MvcIntrinsics.cs
+++ b/BuildFeed/Code/MvcIntrinsics.cs
@@ -3,10 +3,10 @@ using System.Web.WebPages;
namespace BuildFeed.Code
{
- public static class MvcIntrinsics
- {
- public static AjaxHelper Ajax => ((WebViewPage)WebPageContext.Current.Page).Ajax;
- public static HtmlHelper Html => ((WebViewPage)WebPageContext.Current.Page).Html;
- public static UrlHelper Url => ((WebViewPage)WebPageContext.Current.Page).Url;
- }
+ public static class MvcIntrinsics
+ {
+ public static AjaxHelper Ajax => ((WebViewPage)WebPageContext.Current.Page).Ajax;
+ public static HtmlHelper Html => ((WebViewPage)WebPageContext.Current.Page).Html;
+ public static UrlHelper Url => ((WebViewPage)WebPageContext.Current.Page).Url;
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/Options/Locale.cs b/BuildFeed/Code/Options/Locale.cs
index ee07723..9a2e373 100644
--- a/BuildFeed/Code/Options/Locale.cs
+++ b/BuildFeed/Code/Options/Locale.cs
@@ -4,84 +4,84 @@ using System.Web;
namespace BuildFeed.Code.Options
{
- public class Locale
- {
- private const string LANG_COOKIE_NAME = "bf_lang";
+ public class Locale
+ {
+ private const string LANG_COOKIE_NAME = "bf_lang";
- public static readonly Locale[] AvailableLocales =
- {
- new Locale("ar"),
- //new Locale("bn"),
- new Locale("cs"),
- new Locale("de"),
- new Locale("el"),
- new Locale("en"),
- new Locale("es"),
- new Locale("fa"),
- new Locale("fi"),
- new Locale("fr"),
- new Locale("he"),
- new Locale("hr"),
- new Locale("hu"),
- new Locale("id"),
- new Locale("it"),
- new Locale("ja"),
- new Locale("ko"),
- new Locale("lt"),
- new Locale("nl"),
- new Locale("pl"),
- new Locale("pt"),
- new Locale("pt-br"),
- //new Locale("qps-ploc"),
- new Locale("ro"),
- new Locale("ru"),
- new Locale("sk"),
- new Locale("sl"),
- new Locale("sv"),
- new Locale("tr"),
- new Locale("uk"),
- new Locale("vi"),
- new Locale("zh-hans"),
- new Locale("zh-hant")
- };
+ public static readonly Locale[] AvailableLocales =
+ {
+ new Locale("ar"),
+ //new Locale("bn"),
+ new Locale("cs"),
+ new Locale("de"),
+ new Locale("el"),
+ new Locale("en"),
+ new Locale("es"),
+ new Locale("fa"),
+ new Locale("fi"),
+ new Locale("fr"),
+ new Locale("he"),
+ new Locale("hr"),
+ new Locale("hu"),
+ new Locale("id"),
+ new Locale("it"),
+ new Locale("ja"),
+ new Locale("ko"),
+ new Locale("lt"),
+ new Locale("nl"),
+ new Locale("pl"),
+ new Locale("pt"),
+ new Locale("pt-br"),
+ //new Locale("qps-ploc"),
+ new Locale("ro"),
+ new Locale("ru"),
+ new Locale("sk"),
+ new Locale("sl"),
+ new Locale("sv"),
+ new Locale("tr"),
+ new Locale("uk"),
+ new Locale("vi"),
+ new Locale("zh-hans"),
+ new Locale("zh-hant")
+ };
- public string DisplayName => Info.NativeName;
+ public string DisplayName => Info.NativeName;
- public CultureInfo Info { get; set; }
- public string LocaleId { get; set; }
+ public CultureInfo Info { get; set; }
+ public string LocaleId { get; set; }
- public Locale(string localeId)
- {
- LocaleId = localeId;
- Info = CultureInfo.GetCultureInfo(localeId);
- }
+ public Locale(string localeId)
+ {
+ LocaleId = localeId;
+ Info = CultureInfo.GetCultureInfo(localeId);
+ }
- public static CultureInfo DetectCulture(HttpContextBase context)
- {
- string langCookie = context.Request.Cookies[LANG_COOKIE_NAME]?.Value;
+ public static CultureInfo DetectCulture(HttpContextBase context)
+ {
+ string langCookie = context.Request.Cookies[LANG_COOKIE_NAME]?.Value;
- if (!string.IsNullOrEmpty(langCookie))
- {
- try
+ if (!string.IsNullOrEmpty(langCookie))
{
- CultureInfo ci = (CultureInfo)CultureInfo.GetCultureInfo(langCookie).Clone();
+ try
+ {
+ CultureInfo ci = (CultureInfo)CultureInfo.GetCultureInfo(langCookie).Clone();
- // Get Gregorian Calendar in locale if available
- Calendar gc = ci.OptionalCalendars.FirstOrDefault(c => c is GregorianCalendar && (((GregorianCalendar)c).CalendarType == GregorianCalendarTypes.Localized));
- if (gc != null)
- {
- ci.DateTimeFormat.Calendar = gc;
- }
+ // Get Gregorian Calendar in locale if available
+ Calendar gc = ci.OptionalCalendars.FirstOrDefault(c => c is GregorianCalendar && ((GregorianCalendar)c).CalendarType == GregorianCalendarTypes.Localized);
+ if (gc != null)
+ {
+ ci.DateTimeFormat.Calendar = gc;
+ }
- return ci;
+ return ci;
+ }
+
+ catch (CultureNotFoundException)
+ {
+ }
}
- catch (CultureNotFoundException)
- {
- }
- }
-
- return CultureInfo.CurrentCulture;
- }
- }
+ return CultureInfo.CurrentCulture;
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/Options/Theme.cs b/BuildFeed/Code/Options/Theme.cs
index e2b1261..937e96d 100644
--- a/BuildFeed/Code/Options/Theme.cs
+++ b/BuildFeed/Code/Options/Theme.cs
@@ -6,43 +6,43 @@ using BuildFeed.Local;
namespace BuildFeed.Code.Options
{
- public class Theme
- {
- private const string THEME_COOKIE_NAME = "bf_theme";
+ public class Theme
+ {
+ private const string THEME_COOKIE_NAME = "bf_theme";
- public static Theme[] AvailableThemes = (from st in Enum.GetValues(typeof(SiteTheme)).Cast()
- select new Theme(st)).ToArray();
+ public static Theme[] AvailableThemes = (from st in Enum.GetValues(typeof(SiteTheme)).Cast()
+ select new Theme(st)).ToArray();
- private readonly SiteTheme _siteTheme;
+ private readonly SiteTheme _siteTheme;
- public string CookieValue => _siteTheme.ToString();
- public string CssPath => $"~/res/css/{_siteTheme.ToString().ToLower()}.css";
- public string DisplayName => MvcExtensions.GetDisplayTextForEnum(_siteTheme);
+ public string CookieValue => _siteTheme.ToString();
+ public string CssPath => $"~/res/css/{_siteTheme.ToString().ToLower()}.css";
+ public string DisplayName => MvcExtensions.GetDisplayTextForEnum(_siteTheme);
- public Theme(SiteTheme st)
- {
- _siteTheme = st;
- }
+ public Theme(SiteTheme st)
+ {
+ _siteTheme = st;
+ }
- public static SiteTheme DetectTheme(HttpContextBase context)
- {
- string themeCookie = context.Request.Cookies[THEME_COOKIE_NAME]?.Value;
- SiteTheme theme = SiteTheme.Dark;
- if (!string.IsNullOrEmpty(themeCookie))
- {
- Enum.TryParse(themeCookie, out theme);
- }
+ public static SiteTheme DetectTheme(HttpContextBase context)
+ {
+ string themeCookie = context.Request.Cookies[THEME_COOKIE_NAME]?.Value;
+ SiteTheme theme = SiteTheme.Dark;
+ if (!string.IsNullOrEmpty(themeCookie))
+ {
+ Enum.TryParse(themeCookie, out theme);
+ }
- return theme;
- }
- }
+ return theme;
+ }
+ }
- public enum SiteTheme
- {
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Common_ThemeDark))]
- Dark = 0,
+ public enum SiteTheme
+ {
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Common_ThemeDark))]
+ Dark = 0,
- [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Common_ThemeLight))]
- Light
- }
+ [Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Common_ThemeLight))]
+ Light
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Code/OutputCachePushAttribute.cs b/BuildFeed/Code/OutputCachePushAttribute.cs
index 915921e..8c0b488 100644
--- a/BuildFeed/Code/OutputCachePushAttribute.cs
+++ b/BuildFeed/Code/OutputCachePushAttribute.cs
@@ -5,20 +5,20 @@ using BuildFeed.Code.Options;
namespace BuildFeed.Code
{
- public class OutputCachePushAttribute : ActionFilterAttribute
- {
- public override void OnResultExecuted(ResultExecutedContext filterContext)
- {
- bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
- Theme theme = new Theme(Theme.DetectTheme(filterContext.HttpContext));
+ public class OutputCachePushAttribute : ActionFilterAttribute
+ {
+ public override void OnResultExecuted(ResultExecutedContext filterContext)
+ {
+ bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
+ Theme theme = new Theme(Theme.DetectTheme(filterContext.HttpContext));
- filterContext.HttpContext.Response.PushPromise("/res/css/default.css");
- filterContext.HttpContext.Response.PushPromise(VirtualPathUtility.ToAbsolute(theme.CssPath));
- if (isRtl)
- {
- filterContext.HttpContext.Response.PushPromise("/res/css/rtl.css");
- }
- filterContext.HttpContext.Response.PushPromise("/res/ts/bfs.js");
- }
- }
+ filterContext.HttpContext.Response.PushPromise("/res/css/default.css");
+ filterContext.HttpContext.Response.PushPromise(VirtualPathUtility.ToAbsolute(theme.CssPath));
+ if (isRtl)
+ {
+ filterContext.HttpContext.Response.PushPromise("/res/css/rtl.css");
+ }
+ filterContext.HttpContext.Response.PushPromise("/res/ts/bfs.js");
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Controllers/BaseController.cs b/BuildFeed/Controllers/BaseController.cs
index 1107352..930b796 100644
--- a/BuildFeed/Controllers/BaseController.cs
+++ b/BuildFeed/Controllers/BaseController.cs
@@ -5,17 +5,17 @@ using BuildFeed.Code.Options;
namespace BuildFeed.Controllers
{
- public class BaseController : Controller
- {
- protected override void Initialize(RequestContext requestContext)
- {
- CultureInfo ci = Locale.DetectCulture(requestContext.HttpContext);
- CultureInfo.CurrentCulture = ci;
- CultureInfo.CurrentUICulture = ci;
+ public class BaseController : Controller
+ {
+ protected override void Initialize(RequestContext requestContext)
+ {
+ CultureInfo ci = Locale.DetectCulture(requestContext.HttpContext);
+ CultureInfo.CurrentCulture = ci;
+ CultureInfo.CurrentUICulture = ci;
- ViewBag.Theme = new Theme(Theme.DetectTheme(requestContext.HttpContext));
+ ViewBag.Theme = new Theme(Theme.DetectTheme(requestContext.HttpContext));
- base.Initialize(requestContext);
- }
- }
+ base.Initialize(requestContext);
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Controllers/apiController.cs b/BuildFeed/Controllers/apiController.cs
index a2bc121..1f69b9c 100644
--- a/BuildFeed/Controllers/apiController.cs
+++ b/BuildFeed/Controllers/apiController.cs
@@ -11,8 +11,6 @@ using BuildFeed.Model;
using BuildFeed.Model.Api;
using BuildFeed.Model.View;
using OneSignal.CSharp.SDK;
-using OneSignal.CSharp.SDK.Resources;
-using OneSignal.CSharp.SDK.Resources.Notifications;
namespace BuildFeed.Controllers
{
@@ -94,7 +92,8 @@ namespace BuildFeed.Controllers
await _bModel.Insert(build);
OneSignalClient osc = new OneSignalClient(ConfigurationManager.AppSettings["push:OneSignalApiKey"]);
- osc.PushNewBuild(build, $"https://buildfeed.net{Url.Route("Build", new { controller = "Front", action = nameof(FrontController.ViewBuild), id = build.Id, area = "", httproute = "" })}?utm_source=notification&utm_campaign=new_build");
+ osc.PushNewBuild(build,
+ $"https://buildfeed.net{Url.Route("Build", new { controller = "Front", action = nameof(FrontController.ViewBuild), id = build.Id, area = "", httproute = "" })}?utm_source=notification&utm_campaign=new_build");
}
return true;
}
diff --git a/BuildFeed/Controllers/frontController.cs b/BuildFeed/Controllers/frontController.cs
index 5751521..9d46b1e 100644
--- a/BuildFeed/Controllers/frontController.cs
+++ b/BuildFeed/Controllers/frontController.cs
@@ -15,8 +15,6 @@ using BuildFeed.Code;
using BuildFeed.Model;
using BuildFeed.Model.View;
using OneSignal.CSharp.SDK;
-using OneSignal.CSharp.SDK.Resources;
-using OneSignal.CSharp.SDK.Resources.Notifications;
namespace BuildFeed.Controllers
{
diff --git a/BuildFeed/Controllers/rssController.cs b/BuildFeed/Controllers/rssController.cs
index 775952a..f0403be 100644
--- a/BuildFeed/Controllers/rssController.cs
+++ b/BuildFeed/Controllers/rssController.cs
@@ -9,167 +9,167 @@ using WilderMinds.RssSyndication;
namespace BuildFeed.Controllers
{
- public class RssController : BaseController
- {
- private const int RSS_SIZE = 25;
- private readonly BuildRepository _bModel;
+ public class RssController : BaseController
+ {
+ private const int RSS_SIZE = 25;
+ private readonly BuildRepository _bModel;
- public RssController()
- {
- _bModel = new BuildRepository();
- }
+ public RssController()
+ {
+ _bModel = new BuildRepository();
+ }
- [Route("rss/compiled")]
- public async Task Index()
- {
- List builds = await _bModel.SelectBuildsByCompileDate(RSS_SIZE);
+ [Route("rss/compiled")]
+ public async Task Index()
+ {
+ List builds = await _bModel.SelectBuildsByCompileDate(RSS_SIZE);
- Feed feed = new Feed
- {
- Title = "BuildFeed RSS - Recently Compiled",
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
- Items = (from build in builds
- select new Item
- {
- Title = build.AlternateBuildString,
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
- Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
- Categories =
- {
- build.Family.ToString()
- },
- PublishDate = DateTime.SpecifyKind(build.BuildTime.GetValueOrDefault(), DateTimeKind.Utc)
- }).ToList()
- };
+ Feed feed = new Feed
+ {
+ Title = "BuildFeed RSS - Recently Compiled",
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
+ Items = (from build in builds
+ select new Item
+ {
+ Title = build.AlternateBuildString,
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
+ Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
+ Categories =
+ {
+ build.Family.ToString()
+ },
+ PublishDate = DateTime.SpecifyKind(build.BuildTime.GetValueOrDefault(), DateTimeKind.Utc)
+ }).ToList()
+ };
- return new ContentResult
- {
- Content = feed.Serialize(),
- ContentType = "application/rss+xml",
- ContentEncoding = Encoding.UTF8
- };
- }
+ return new ContentResult
+ {
+ Content = feed.Serialize(),
+ ContentType = "application/rss+xml",
+ ContentEncoding = Encoding.UTF8
+ };
+ }
- [Route("rss/added")]
- public async Task Added()
- {
- List builds = await _bModel.SelectBuildsByAddedDate(RSS_SIZE);
+ [Route("rss/added")]
+ public async Task Added()
+ {
+ List builds = await _bModel.SelectBuildsByAddedDate(RSS_SIZE);
- Feed feed = new Feed
- {
- Title = "BuildFeed RSS - Recently Added",
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
- Items = (from build in builds
- select new Item
- {
- Title = build.AlternateBuildString,
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
- Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
- Categories =
- {
- build.Family.ToString()
- },
- PublishDate = DateTime.SpecifyKind(build.Added, DateTimeKind.Utc)
- }).ToList()
- };
+ Feed feed = new Feed
+ {
+ Title = "BuildFeed RSS - Recently Added",
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
+ Items = (from build in builds
+ select new Item
+ {
+ Title = build.AlternateBuildString,
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
+ Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
+ Categories =
+ {
+ build.Family.ToString()
+ },
+ PublishDate = DateTime.SpecifyKind(build.Added, DateTimeKind.Utc)
+ }).ToList()
+ };
- return new ContentResult
- {
- Content = feed.Serialize(),
- ContentType = "application/rss+xml",
- ContentEncoding = Encoding.UTF8
- };
- }
+ return new ContentResult
+ {
+ Content = feed.Serialize(),
+ ContentType = "application/rss+xml",
+ ContentEncoding = Encoding.UTF8
+ };
+ }
- [Route("rss/leaked")]
- public async Task Leaked()
- {
- List builds = await _bModel.SelectBuildsByLeakedDate(RSS_SIZE);
+ [Route("rss/leaked")]
+ public async Task Leaked()
+ {
+ List builds = await _bModel.SelectBuildsByLeakedDate(RSS_SIZE);
- Feed feed = new Feed
- {
- Title = "BuildFeed RSS - Recently Leaked",
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
- Items = (from build in builds
- select new Item
- {
- Title = build.AlternateBuildString,
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
- Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
- Categories =
- {
- build.Family.ToString()
- },
- PublishDate = DateTime.SpecifyKind(build.LeakDate.GetValueOrDefault(), DateTimeKind.Utc)
- }).ToList()
- };
+ Feed feed = new Feed
+ {
+ Title = "BuildFeed RSS - Recently Leaked",
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
+ Items = (from build in builds
+ select new Item
+ {
+ Title = build.AlternateBuildString,
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
+ Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
+ Categories =
+ {
+ build.Family.ToString()
+ },
+ PublishDate = DateTime.SpecifyKind(build.LeakDate.GetValueOrDefault(), DateTimeKind.Utc)
+ }).ToList()
+ };
- return new ContentResult
- {
- Content = feed.Serialize(),
- ContentType = "application/rss+xml",
- ContentEncoding = Encoding.UTF8
- };
- }
+ return new ContentResult
+ {
+ Content = feed.Serialize(),
+ ContentType = "application/rss+xml",
+ ContentEncoding = Encoding.UTF8
+ };
+ }
- [Route("rss/version")]
- public async Task Version()
- {
- List builds = await _bModel.SelectBuildsByOrder(RSS_SIZE);
+ [Route("rss/version")]
+ public async Task Version()
+ {
+ List builds = await _bModel.SelectBuildsByOrder(RSS_SIZE);
- Feed feed = new Feed
- {
- Title = "BuildFeed RSS - Highest Version",
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
- Items = (from build in builds
- select new Item
- {
- Title = build.AlternateBuildString,
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
- Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
- Categories =
- {
- build.Family.ToString()
- }
- }).ToList()
- };
+ Feed feed = new Feed
+ {
+ Title = "BuildFeed RSS - Highest Version",
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
+ Items = (from build in builds
+ select new Item
+ {
+ Title = build.AlternateBuildString,
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
+ Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
+ Categories =
+ {
+ build.Family.ToString()
+ }
+ }).ToList()
+ };
- return new ContentResult
- {
- Content = feed.Serialize(),
- ContentType = "application/rss+xml",
- ContentEncoding = Encoding.UTF8
- };
- }
+ return new ContentResult
+ {
+ Content = feed.Serialize(),
+ ContentType = "application/rss+xml",
+ ContentEncoding = Encoding.UTF8
+ };
+ }
- [Route("rss/lab/{lab}")]
- public async Task Lab(string lab)
- {
- List builds = await _bModel.SelectLab(lab, RSS_SIZE);
+ [Route("rss/lab/{lab}")]
+ public async Task Lab(string lab)
+ {
+ List builds = await _bModel.SelectLab(lab, RSS_SIZE);
- Feed feed = new Feed
- {
- Title = $"BuildFeed RSS - {lab} Lab",
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
- Items = (from build in builds
- select new Item
- {
- Title = build.AlternateBuildString,
- Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
- Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
- Categories =
- {
- build.Family.ToString()
- }
- }).ToList()
- };
+ Feed feed = new Feed
+ {
+ Title = $"BuildFeed RSS - {lab} Lab",
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}"),
+ Items = (from build in builds
+ select new Item
+ {
+ Title = build.AlternateBuildString,
+ Link = new Uri($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}"),
+ Permalink = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}",
+ Categories =
+ {
+ build.Family.ToString()
+ }
+ }).ToList()
+ };
- return new ContentResult
- {
- Content = feed.Serialize(),
- ContentType = "application/rss+xml",
- ContentEncoding = Encoding.UTF8
- };
- }
- }
+ return new ContentResult
+ {
+ Content = feed.Serialize(),
+ ContentType = "application/rss+xml",
+ ContentEncoding = Encoding.UTF8
+ };
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Controllers/supportController.cs b/BuildFeed/Controllers/supportController.cs
index 0f3ef41..ee40042 100644
--- a/BuildFeed/Controllers/supportController.cs
+++ b/BuildFeed/Controllers/supportController.cs
@@ -14,320 +14,320 @@ using BuildFeed.Model.View;
namespace BuildFeed.Controllers
{
- public class SupportController : BaseController
- {
- private readonly BuildRepository _bModel;
+ public class SupportController : BaseController
+ {
+ private readonly BuildRepository _bModel;
- public SupportController()
- {
- _bModel = new BuildRepository();
- }
+ public SupportController()
+ {
+ _bModel = new BuildRepository();
+ }
- [Route("login/")]
- public ActionResult Login() => View();
+ [Route("login/")]
+ public ActionResult Login() => View();
- [HttpPost]
- [Route("login/")]
- public ActionResult Login(LoginUser ru)
- {
- if (ModelState.IsValid)
- {
- bool isAuthenticated = Membership.ValidateUser(ru.UserName, ru.Password);
-
- if (isAuthenticated)
+ [HttpPost]
+ [Route("login/")]
+ public ActionResult Login(LoginUser ru)
+ {
+ if (ModelState.IsValid)
{
- int expiryLength = ru.RememberMe
- ? 129600
- : 60;
+ bool isAuthenticated = Membership.ValidateUser(ru.UserName, ru.Password);
- FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(ru.UserName, true, expiryLength);
- string encryptedTicket = FormsAuthentication.Encrypt(ticket);
- HttpCookie cookieTicket = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
- {
- Expires = DateTime.Now.AddMinutes(expiryLength),
- Path = FormsAuthentication.FormsCookiePath
- };
- Response.Cookies.Add(cookieTicket);
+ if (isAuthenticated)
+ {
+ int expiryLength = ru.RememberMe
+ ? 129600
+ : 60;
- string returnUrl = string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])
- ? "/"
- : Request.QueryString["ReturnUrl"];
+ FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(ru.UserName, true, expiryLength);
+ string encryptedTicket = FormsAuthentication.Encrypt(ticket);
+ HttpCookie cookieTicket = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
+ {
+ Expires = DateTime.Now.AddMinutes(expiryLength),
+ Path = FormsAuthentication.FormsCookiePath
+ };
+ Response.Cookies.Add(cookieTicket);
- return Redirect(returnUrl);
+ string returnUrl = string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])
+ ? "/"
+ : Request.QueryString["ReturnUrl"];
+
+ return Redirect(returnUrl);
+ }
}
- }
- ViewData["ErrorMessage"] = "The username and password are not valid.";
- return View(ru);
- }
+ ViewData["ErrorMessage"] = "The username and password are not valid.";
+ return View(ru);
+ }
- [Authorize]
- [Route("password/")]
- public ActionResult Password() => View();
+ [Authorize]
+ [Route("password/")]
+ public ActionResult Password() => View();
- [HttpPost]
- [Authorize]
- [Route("password/")]
- public ActionResult Password(ChangePassword cp)
- {
- if (ModelState.IsValid)
- {
- MembershipUser user = Membership.GetUser();
-
- if (user != null)
+ [HttpPost]
+ [Authorize]
+ [Route("password/")]
+ public ActionResult Password(ChangePassword cp)
+ {
+ if (ModelState.IsValid)
{
- bool success = user.ChangePassword(cp.OldPassword, cp.NewPassword);
+ MembershipUser user = Membership.GetUser();
- if (success)
- {
- return Redirect("/");
- }
+ if (user != null)
+ {
+ bool success = user.ChangePassword(cp.OldPassword, cp.NewPassword);
+
+ if (success)
+ {
+ return Redirect("/");
+ }
+ }
}
- }
- ViewData["ErrorMessage"] = "There was an error changing your password.";
- return View(cp);
- }
+ ViewData["ErrorMessage"] = "There was an error changing your password.";
+ return View(cp);
+ }
- [Route("logout/")]
- public ActionResult Logout()
- {
- FormsAuthentication.SignOut();
- return Redirect("/");
- }
+ [Route("logout/")]
+ public ActionResult Logout()
+ {
+ FormsAuthentication.SignOut();
+ return Redirect("/");
+ }
- [Route("register/")]
- public ActionResult Register() => View();
+ [Route("register/")]
+ public ActionResult Register() => View();
- [HttpPost]
- [Route("register/")]
- public ActionResult Register(RegistrationUser ru)
- {
- if (ModelState.IsValid)
- {
- MembershipCreateStatus status;
- Membership.CreateUser(ru.UserName, ru.Password, ru.EmailAddress, "THIS WILL BE IGNORED", "I WILL BE IGNORED", false, out status);
-
- switch (status)
+ [HttpPost]
+ [Route("register/")]
+ public ActionResult Register(RegistrationUser ru)
+ {
+ if (ModelState.IsValid)
{
- case MembershipCreateStatus.Success:
- return RedirectToAction("thanks_register");
- case MembershipCreateStatus.InvalidPassword:
- ViewData["ErrorMessage"] = "The password is invalid.";
- break;
- case MembershipCreateStatus.DuplicateEmail:
- ViewData["ErrorMessage"] = "A user account with this email address already exists.";
- break;
- case MembershipCreateStatus.DuplicateUserName:
- ViewData["ErrorMessage"] = "A user account with this user name already exists.";
- break;
- default:
- ViewData["ErrorMessage"] = "Unspecified error.";
- break;
+ MembershipCreateStatus status;
+ Membership.CreateUser(ru.UserName, ru.Password, ru.EmailAddress, "THIS WILL BE IGNORED", "I WILL BE IGNORED", false, out status);
+
+ switch (status)
+ {
+ case MembershipCreateStatus.Success:
+ return RedirectToAction("thanks_register");
+ case MembershipCreateStatus.InvalidPassword:
+ ViewData["ErrorMessage"] = "The password is invalid.";
+ break;
+ case MembershipCreateStatus.DuplicateEmail:
+ ViewData["ErrorMessage"] = "A user account with this email address already exists.";
+ break;
+ case MembershipCreateStatus.DuplicateUserName:
+ ViewData["ErrorMessage"] = "A user account with this user name already exists.";
+ break;
+ default:
+ ViewData["ErrorMessage"] = "Unspecified error.";
+ break;
+ }
}
- }
- return View(ru);
- }
+ return View(ru);
+ }
- [Route("register/thanks/")]
- public ActionResult thanks_register() => View();
+ [Route("register/thanks/")]
+ public ActionResult thanks_register() => View();
- [Route("rss")]
- public async Task Rss()
- {
- ViewBag.Labs = await _bModel.SelectAllLabs();
- return View();
- }
+ [Route("rss")]
+ public async Task Rss()
+ {
+ ViewBag.Labs = await _bModel.SelectAllLabs();
+ return View();
+ }
- [Route("sitemap/")]
+ [Route("sitemap/")]
#if !DEBUG
[OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName;lang;theme")]
#endif
- public async Task Sitemap()
- {
- List builds = await _bModel.SelectBuildsByOrder();
- var actions = new Dictionary
- {
+ public async Task Sitemap()
+ {
+ List builds = await _bModel.SelectBuildsByOrder();
+ var actions = new Dictionary
{
- "Pages", new[]
- {
- new SitemapPagedAction
- {
- UrlParams = new RouteValueDictionary(new
- {
- controller = "Front",
- action = "Index",
- page = 1
- }),
- Pages = (builds.Count + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
- }
- }
- },
- {
- "Versions", (from b in builds
- group b by new BuildVersion
- {
- Major = b.MajorVersion,
- Minor = b.MinorVersion
- }
- into bv
- orderby bv.Key.Major descending, bv.Key.Minor descending
- select new SitemapPagedAction
- {
- Name = $"{InvariantTerms.ProductName} {bv.Key.Major}.{bv.Key.Minor}",
- UrlParams = new RouteValueDictionary(new
- {
- controller = "Front",
- action = "ViewVersion",
- major = bv.Key.Major,
- minor = bv.Key.Minor,
- page = 1
- }),
- Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
- }).ToArray()
- },
- {
- "Labs", (from b in builds
- where !string.IsNullOrEmpty(b.Lab)
- group b by b.Lab
- into bv
- orderby bv.Key
- select new SitemapPagedAction
+ {
+ "Pages", new[]
+ {
+ new SitemapPagedAction
{
- Name = bv.Key,
- UrlParams = new RouteValueDictionary(new
- {
- controller = "Front",
- action = "ViewLab",
- lab = bv.Key,
- page = 1
- }),
- Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
- }).ToArray()
- },
- {
- "Years", (from b in builds
- where b.BuildTime.HasValue
- group b by b.BuildTime.Value.Year
- into bv
- orderby bv.Key descending
- select new SitemapPagedAction
- {
- Name = bv.Key.ToString(),
UrlParams = new RouteValueDictionary(new
{
- controller = "Front",
- action = "ViewYear",
- year = bv.Key,
- page = 1
+ controller = "Front",
+ action = "Index",
+ page = 1
}),
- Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
- }).ToArray()
- },
- {
- "Sources", (from b in builds
- group b by b.SourceType
- into bv
- orderby bv.Key
- select new SitemapPagedAction
- {
- Name = MvcExtensions.GetDisplayTextForEnum(bv.Key),
- UrlParams = new RouteValueDictionary(new
+ Pages = (builds.Count + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
+ }
+ }
+ },
+ {
+ "Versions", (from b in builds
+ group b by new BuildVersion
+ {
+ Major = b.MajorVersion,
+ Minor = b.MinorVersion
+ }
+ into bv
+ orderby bv.Key.Major descending, bv.Key.Minor descending
+ select new SitemapPagedAction
+ {
+ Name = $"{InvariantTerms.ProductName} {bv.Key.Major}.{bv.Key.Minor}",
+ UrlParams = new RouteValueDictionary(new
+ {
+ controller = "Front",
+ action = "ViewVersion",
+ major = bv.Key.Major,
+ minor = bv.Key.Minor,
+ page = 1
+ }),
+ Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
+ }).ToArray()
+ },
+ {
+ "Labs", (from b in builds
+ where !string.IsNullOrEmpty(b.Lab)
+ group b by b.Lab
+ into bv
+ orderby bv.Key
+ select new SitemapPagedAction
+ {
+ Name = bv.Key,
+ UrlParams = new RouteValueDictionary(new
+ {
+ controller = "Front",
+ action = "ViewLab",
+ lab = bv.Key,
+ page = 1
+ }),
+ Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
+ }).ToArray()
+ },
+ {
+ "Years", (from b in builds
+ where b.BuildTime.HasValue
+ group b by b.BuildTime.Value.Year
+ into bv
+ orderby bv.Key descending
+ select new SitemapPagedAction
{
- controller = "Front",
- action = "ViewSource",
- source = bv.Key,
- page = 1
- }),
- Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
- }).ToArray()
- }
- };
+ Name = bv.Key.ToString(),
+ UrlParams = new RouteValueDictionary(new
+ {
+ controller = "Front",
+ action = "ViewYear",
+ year = bv.Key,
+ page = 1
+ }),
+ Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
+ }).ToArray()
+ },
+ {
+ "Sources", (from b in builds
+ group b by b.SourceType
+ into bv
+ orderby bv.Key
+ select new SitemapPagedAction
+ {
+ Name = MvcExtensions.GetDisplayTextForEnum(bv.Key),
+ UrlParams = new RouteValueDictionary(new
+ {
+ controller = "Front",
+ action = "ViewSource",
+ source = bv.Key,
+ page = 1
+ }),
+ Pages = (bv.Count() + (FrontController.PAGE_SIZE - 1)) / FrontController.PAGE_SIZE
+ }).ToArray()
+ }
+ };
- SitemapData model = new SitemapData
- {
- Builds = (from b in builds
- group b by new
- {
- Major = b.MajorVersion,
- Minor = b.MinorVersion,
- Build = b.Number,
- b.Revision
- }
- into bg
- orderby bg.Key.Major descending, bg.Key.Minor descending, bg.Key.Build descending, bg.Key.Revision descending
- select new SitemapDataBuildGroup
- {
- Id = new BuildGroup
- {
- Major = bg.Key.Major,
- Minor = bg.Key.Minor,
- Build = bg.Key.Build,
- Revision = bg.Key.Revision
- },
- Builds = (from bgb in bg
- select new SitemapDataBuild
- {
- Id = bgb.Id,
- Name = bgb.FullBuildString
- }).ToArray()
- }).ToArray(),
- Actions = actions,
- Labs = (from b in builds
- group b by b.Lab
- into lab
- select lab.Key).ToArray()
- };
+ SitemapData model = new SitemapData
+ {
+ Builds = (from b in builds
+ group b by new
+ {
+ Major = b.MajorVersion,
+ Minor = b.MinorVersion,
+ Build = b.Number,
+ b.Revision
+ }
+ into bg
+ orderby bg.Key.Major descending, bg.Key.Minor descending, bg.Key.Build descending, bg.Key.Revision descending
+ select new SitemapDataBuildGroup
+ {
+ Id = new BuildGroup
+ {
+ Major = bg.Key.Major,
+ Minor = bg.Key.Minor,
+ Build = bg.Key.Build,
+ Revision = bg.Key.Revision
+ },
+ Builds = (from bgb in bg
+ select new SitemapDataBuild
+ {
+ Id = bgb.Id,
+ Name = bgb.FullBuildString
+ }).ToArray()
+ }).ToArray(),
+ Actions = actions,
+ Labs = (from b in builds
+ group b by b.Lab
+ into lab
+ select lab.Key).ToArray()
+ };
- return View(model);
- }
+ return View(model);
+ }
- [Route("xml-sitemap/")]
+ [Route("xml-sitemap/")]
#if !DEBUG
[OutputCache(Duration = 3600, VaryByParam = "none", VaryByCustom = "userName;lang;theme")]
#endif
- public async Task XmlSitemap()
- {
- XNamespace xn = XNamespace.Get("http://www.sitemaps.org/schemas/sitemap/0.9");
- var xlist = new List();
+ public async Task XmlSitemap()
+ {
+ XNamespace xn = XNamespace.Get("http://www.sitemaps.org/schemas/sitemap/0.9");
+ var xlist = new List();
- // home page
- XElement home = new XElement(xn + "url");
- home.Add(new XElement(xn + "loc", Request.Url?.GetLeftPart(UriPartial.Authority) + "/"));
- home.Add(new XElement(xn + "changefreq", "daily"));
- xlist.Add(home);
+ // home page
+ XElement home = new XElement(xn + "url");
+ home.Add(new XElement(xn + "loc", Request.Url?.GetLeftPart(UriPartial.Authority) + "/"));
+ home.Add(new XElement(xn + "changefreq", "daily"));
+ xlist.Add(home);
- foreach (Build b in await _bModel.Select())
- {
- XElement url = new XElement(xn + "url");
- url.Add(new XElement(xn + "loc",
- Request.Url?.GetLeftPart(UriPartial.Authority) + Url.Action("ViewBuild",
- "Front",
- new
- {
- id = b.Id
- })));
- if (b.Modified != DateTime.MinValue)
+ foreach (Build b in await _bModel.Select())
{
- url.Add(new XElement(xn + "lastmod", b.Modified.ToString("yyyy-MM-dd")));
+ XElement url = new XElement(xn + "url");
+ url.Add(new XElement(xn + "loc",
+ Request.Url?.GetLeftPart(UriPartial.Authority) + Url.Action("ViewBuild",
+ "Front",
+ new
+ {
+ id = b.Id
+ })));
+ if (b.Modified != DateTime.MinValue)
+ {
+ url.Add(new XElement(xn + "lastmod", b.Modified.ToString("yyyy-MM-dd")));
+ }
+ xlist.Add(url);
}
- xlist.Add(url);
- }
- XDeclaration decl = new XDeclaration("1.0", "utf-8", "");
- XElement root = new XElement(xn + "urlset", xlist);
+ XDeclaration decl = new XDeclaration("1.0", "utf-8", "");
+ XElement root = new XElement(xn + "urlset", xlist);
- XDocument xdoc = new XDocument(decl, root);
+ XDocument xdoc = new XDocument(decl, root);
- Response.ContentType = "application/xml";
- xdoc.Save(Response.OutputStream);
+ Response.ContentType = "application/xml";
+ xdoc.Save(Response.OutputStream);
- return new EmptyResult();
- }
+ return new EmptyResult();
+ }
- [Route("credits/")]
- public ActionResult Credits() => View();
- }
+ [Route("credits/")]
+ public ActionResult Credits() => View();
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/Global.asax b/BuildFeed/Global.asax
index 59cbfaa..9d17b82 100644
--- a/BuildFeed/Global.asax
+++ b/BuildFeed/Global.asax
@@ -1 +1 @@
-<%@ Application Codebehind="Global.asax.cs" Inherits="BuildFeed.MvcApplication" Language="C#" %>
+<%@ Application Codebehind="Global.asax.cs" Inherits="BuildFeed.MvcApplication" Language="C#" %>
\ No newline at end of file
diff --git a/BuildFeed/Global.asax.cs b/BuildFeed/Global.asax.cs
index fd55a2e..ff8ad5b 100644
--- a/BuildFeed/Global.asax.cs
+++ b/BuildFeed/Global.asax.cs
@@ -10,52 +10,52 @@ using BuildFeed.Model;
namespace BuildFeed
{
- public class MvcApplication : HttpApplication
- {
- protected void Application_Start()
- {
- // Disable ASP.NET MVC version header
- MvcHandler.DisableMvcResponseHeader = true;
+ public class MvcApplication : HttpApplication
+ {
+ protected void Application_Start()
+ {
+ // Disable ASP.NET MVC version header
+ MvcHandler.DisableMvcResponseHeader = true;
- // Don't bother looking for the legacy aspx view engine.
- ViewEngines.Engines.Clear();
- ViewEngines.Engines.Add(new RazorViewEngine());
+ // Don't bother looking for the legacy aspx view engine.
+ ViewEngines.Engines.Clear();
+ ViewEngines.Engines.Add(new RazorViewEngine());
- AreaRegistration.RegisterAllAreas();
- FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
- RouteConfig.RegisterRoutes(RouteTable.Routes);
+ AreaRegistration.RegisterAllAreas();
+ FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
+ RouteConfig.RegisterRoutes(RouteTable.Routes);
- DateTimeModelBinder db = new DateTimeModelBinder();
+ DateTimeModelBinder db = new DateTimeModelBinder();
- ModelBinders.Binders.Add(typeof(DateTime), db);
- ModelBinders.Binders.Add(typeof(DateTime?), db);
+ ModelBinders.Binders.Add(typeof(DateTime), db);
+ ModelBinders.Binders.Add(typeof(DateTime?), db);
- MongoConfig.SetupIndexes();
- }
+ MongoConfig.SetupIndexes();
+ }
- public override string GetVaryByCustomString(HttpContext context, string custom)
- {
- string[] parts = custom.Split(';');
- List varyParts = new List();
- HttpContextWrapper contextWrapper = new HttpContextWrapper(context);
+ public override string GetVaryByCustomString(HttpContext context, string custom)
+ {
+ string[] parts = custom.Split(';');
+ var varyParts = new List();
+ HttpContextWrapper contextWrapper = new HttpContextWrapper(context);
- foreach (string part in parts)
- {
- switch (part)
+ foreach (string part in parts)
{
- case "userName":
- varyParts.Add($"user:{context.User.Identity.Name}");
- break;
- case "lang":
- varyParts.Add($"lang:{Locale.DetectCulture(contextWrapper).LCID}");
- break;
- case "theme":
- varyParts.Add($"theme:{Theme.DetectTheme(contextWrapper)}");
- break;
+ switch (part)
+ {
+ case "userName":
+ varyParts.Add($"user:{context.User.Identity.Name}");
+ break;
+ case "lang":
+ varyParts.Add($"lang:{Locale.DetectCulture(contextWrapper).LCID}");
+ break;
+ case "theme":
+ varyParts.Add($"theme:{Theme.DetectTheme(contextWrapper)}");
+ break;
+ }
}
- }
- return string.Join(";", varyParts.OrderBy(s => s));
- }
- }
+ return string.Join(";", varyParts.OrderBy(s => s));
+ }
+ }
}
\ No newline at end of file
diff --git a/BuildFeed/OneSignalSDKUpdaterWorker.js b/BuildFeed/OneSignalSDKUpdaterWorker.js
index 8657823..982c3fc 100644
--- a/BuildFeed/OneSignalSDKUpdaterWorker.js
+++ b/BuildFeed/OneSignalSDKUpdaterWorker.js
@@ -1 +1 @@
-importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');
+importScripts("https://cdn.onesignal.com/sdks/OneSignalSDK.js");
\ No newline at end of file
diff --git a/BuildFeed/OneSignalSDKWorker.js b/BuildFeed/OneSignalSDKWorker.js
index 8657823..982c3fc 100644
--- a/BuildFeed/OneSignalSDKWorker.js
+++ b/BuildFeed/OneSignalSDKWorker.js
@@ -1 +1 @@
-importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');
+importScripts("https://cdn.onesignal.com/sdks/OneSignalSDK.js");
\ No newline at end of file
diff --git a/BuildFeed/Properties/AssemblyInfo.cs b/BuildFeed/Properties/AssemblyInfo.cs
index 014e263..16dd922 100644
--- a/BuildFeed/Properties/AssemblyInfo.cs
+++ b/BuildFeed/Properties/AssemblyInfo.cs
@@ -1,10 +1,10 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
+
[assembly: AssemblyTitle("BuildFeed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
+
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
+
[assembly: Guid("6c5846cb-43ac-4818-a9b5-a6cd1d6983a3")]
// Version information for an assembly consists of the following four values:
@@ -31,5 +33,6 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
+
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/BuildFeed/Views/_ViewStart.cshtml b/BuildFeed/Views/_ViewStart.cshtml
index d599c2d..b43c42a 100644
--- a/BuildFeed/Views/_ViewStart.cshtml
+++ b/BuildFeed/Views/_ViewStart.cshtml
@@ -1,3 +1,3 @@
@{
- Layout = "~/Views/shared/_default.cshtml";
+ Layout = "~/Views/shared/_default.cshtml";
}
\ No newline at end of file
diff --git a/BuildFeed/Views/front/AddBulk.cshtml b/BuildFeed/Views/front/AddBulk.cshtml
index 4d9c18c..9c6aef0 100644
--- a/BuildFeed/Views/front/AddBulk.cshtml
+++ b/BuildFeed/Views/front/AddBulk.cshtml
@@ -3,58 +3,58 @@
@model BuildFeed.Model.View.BulkAddition
@{
- ViewBag.Title = $"{VariantTerms.Common_AddBulk} | {InvariantTerms.SiteName}";
+ ViewBag.Title = $"{VariantTerms.Common_AddBulk} | {InvariantTerms.SiteName}";
}
@VariantTerms.Common_AddBulk
@if (ViewBag.Results != null)
{
- @VariantTerms.Bulk_Success
-
+ @VariantTerms.Bulk_Success
+
}
@VariantTerms.Bulk_Instructions
@using (Html.BeginForm())
{
- @Html.AntiForgeryToken()
+ @Html.AntiForgeryToken()
-
+
-
+
-
+
}
\ No newline at end of file
diff --git a/BuildFeed/Views/front/Pages.cshtml b/BuildFeed/Views/front/Pages.cshtml
index 3c92730..4116fda 100644
--- a/BuildFeed/Views/front/Pages.cshtml
+++ b/BuildFeed/Views/front/Pages.cshtml
@@ -35,11 +35,13 @@
DateTime maxDate = group.LastBuild.Value;
if (maxDate.AddDays(28) > DateTime.Now)
{
- @maxDate.Humanize()
+
+ @maxDate.Humanize()
}
else
{
- @maxDate.ToLongDateWithoutDay()
+
+ @maxDate.ToLongDateWithoutDay()
}
}
diff --git a/BuildFeed/Views/front/editBuild.cshtml b/BuildFeed/Views/front/editBuild.cshtml
index 8be44d3..6b424c6 100644
--- a/BuildFeed/Views/front/editBuild.cshtml
+++ b/BuildFeed/Views/front/editBuild.cshtml
@@ -2,187 +2,187 @@
@using BuildFeed.Model
@model BuildFeed.Model.Build
@{
- ViewBag.Title = (string)ViewContext.RouteData.Values["action"] == nameof(FrontController.AddBuild)
- ? $"{VariantTerms.Common_AddBuild} | {InvariantTerms.SiteName}"
- : $"{VariantTerms.Front_EditBuild} {Model.FullBuildString} | {InvariantTerms.SiteName}";
- Html.EnableClientValidation();
- Html.EnableUnobtrusiveJavaScript();
+ ViewBag.Title = (string)ViewContext.RouteData.Values["action"] == nameof(FrontController.AddBuild)
+ ? $"{VariantTerms.Common_AddBuild} | {InvariantTerms.SiteName}"
+ : $"{VariantTerms.Front_EditBuild} {Model.FullBuildString} | {InvariantTerms.SiteName}";
+ Html.EnableClientValidation();
+ Html.EnableUnobtrusiveJavaScript();
}
@if ((string)ViewContext.RouteData.Values["action"] == nameof(FrontController.AddBuild))
{
- @VariantTerms.Common_AddBuild
+ @VariantTerms.Common_AddBuild
}
else
{
- @VariantTerms.Front_EditBuild @Model.AlternateBuildString
+ @VariantTerms.Front_EditBuild @Model.AlternateBuildString
}
@using (Html.BeginForm())
{
- @Html.AntiForgeryToken()
+ @Html.AntiForgeryToken()
- @Html.ValidationSummary(true)
+ @Html.ValidationSummary(true)
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
}
@section Scripts
{
-
-
-
+
+
+
-
-
+
+
-
+ $("#MajorVersion").val(result[2]);
+ $("#MinorVersion").val(result[3]);
+ $("#Number").val(result[4]);
+ $("#Revision").val(result[6]);
+ $("#Lab").val(result[8]);
+ $("#BuildTime").val(result[9]);
+ });
+ });
+
}
\ No newline at end of file
diff --git a/BuildFeed/Views/front/index.cshtml b/BuildFeed/Views/front/index.cshtml
index 0f2166a..34aab11 100644
--- a/BuildFeed/Views/front/index.cshtml
+++ b/BuildFeed/Views/front/index.cshtml
@@ -1,78 +1,78 @@
@model BuildFeed.Model.View.FrontPage
@{
- ViewBag.Title = $"{InvariantTerms.SiteName} | Windows 10 Build Tracker";
+ ViewBag.Title = $"{InvariantTerms.SiteName} | Windows 10 Build Tracker";
}
@section Head
{
-
+
}
@string.Format(VariantTerms.Front_HomeH1, InvariantTerms.SiteName)
@VariantTerms.Front_LatestBuilds
- @VariantTerms.Front_FullBuildListing
+ @VariantTerms.Front_FullBuildListing
@VariantTerms.Front_Share
diff --git a/BuildFeed/Views/front/viewBuild.cshtml b/BuildFeed/Views/front/viewBuild.cshtml
index 11b5e0f..0f87ab8 100644
--- a/BuildFeed/Views/front/viewBuild.cshtml
+++ b/BuildFeed/Views/front/viewBuild.cshtml
@@ -4,132 +4,132 @@
@model BuildFeed.Model.Build
@{
- ViewBag.Title = $"{Model.FullBuildString} | {InvariantTerms.SiteName}";
+ ViewBag.Title = $"{Model.FullBuildString} | {InvariantTerms.SiteName}";
}
@section head
{
-
-
+
+
-
-
-
- @{
- string metaDesc = Model.BuildTime.HasValue
- ? string.Format(VariantTerms.Meta_BuildDate, Model.Number, Model.Lab, Model.BuildTime.Value.ToLongDateWithoutDay())
- : string.Format(VariantTerms.Meta_BuildNoDate, Model.Number, Model.Lab);
- }
-
-
-
+
+
+
+ @{
+ string metaDesc = Model.BuildTime.HasValue
+ ? string.Format(VariantTerms.Meta_BuildDate, Model.Number, Model.Lab, Model.BuildTime.Value.ToLongDateWithoutDay())
+ : string.Format(VariantTerms.Meta_BuildNoDate, Model.Number, Model.Lab);
+ }
+
+
+
}
@Model.AlternateBuildString
@VariantTerms.Front_Details
-
- @Html.LabelFor(model => model.MajorVersion)
-
@Html.DisplayFor(model => model.MajorVersion)
-
-
- @Html.LabelFor(model => model.MinorVersion)
-
@Html.DisplayFor(model => model.MinorVersion)
-
-
- @Html.LabelFor(model => model.Number)
-
@Html.DisplayFor(model => model.Number)
-
-
- @Html.LabelFor(model => model.Revision)
-
- @if (Model.Revision.HasValue)
- {
- @Html.DisplayFor(model => model.Revision)
- }
- else
- {
- @("-")
- }
-
-
+
+ @Html.LabelFor(model => model.MajorVersion)
+
@Html.DisplayFor(model => model.MajorVersion)
+
+
+ @Html.LabelFor(model => model.MinorVersion)
+
@Html.DisplayFor(model => model.MinorVersion)
+
+
+ @Html.LabelFor(model => model.Number)
+
@Html.DisplayFor(model => model.Number)
+
+
+ @Html.LabelFor(model => model.Revision)
+
+ @if (Model.Revision.HasValue)
+ {
+ @Html.DisplayFor(model => model.Revision)
+ }
+ else
+ {
+ @("-")
+ }
+
+
-
-
-
- @if (Model.LeakDate.HasValue)
- {
- @Html.LabelFor(model => model.LeakDate)
-
-
-
- }
-
+ }
+
+
+
+
+
+
+ @Html.LabelFor(model => model.SourceType)
+
+
+
+ @if (Model.LeakDate.HasValue)
+ {
+ @Html.LabelFor(model => model.LeakDate)
+
+
+
+ }
+
@if (!string.IsNullOrWhiteSpace(Model.SourceDetailsFiltered))
{
- @Html.DisplayNameFor(model => model.SourceDetails)
- @Html.Raw(Model.SourceDetailsFiltered)
-
+ @Html.DisplayNameFor(model => model.SourceDetails)
+ @Html.Raw(Model.SourceDetailsFiltered)
+
}
@VariantTerms.Front_Share
@@ -137,57 +137,57 @@
@if (User.Identity.IsAuthenticated)
{
- @VariantTerms.Front_EditorActions
-
- @Html.ActionLink(VariantTerms.Front_Edit, nameof(FrontController.EditBuild), new
- {
- id = Model.Id
- }, new
- {
- @class = "button edit-button"
- })
+
@VariantTerms.Front_EditorActions
+
+ @Html.ActionLink(VariantTerms.Front_Edit, nameof(FrontController.EditBuild), new
+ {
+ id = Model.Id
+ }, new
+ {
+ @class = "button edit-button"
+ })
- @if (Roles.IsUserInRole("Administrators"))
- {
- @Html.ActionLink(VariantTerms.Front_Delete, nameof(FrontController.DeleteBuild), new
- {
- id = Model.Id
- }, new
- {
- @class = "button delete-button"
- })
- }
-
+ @if (Roles.IsUserInRole("Administrators"))
+ {
+ @Html.ActionLink(VariantTerms.Front_Delete, nameof(FrontController.DeleteBuild), new
+ {
+ id = Model.Id
+ }, new
+ {
+ @class = "button delete-button"
+ })
+ }
+
}
-
- @VariantTerms.Front_ReturnToOverview
-
-
- @VariantTerms.Front_ReturnToListing
+
+ @VariantTerms.Front_ReturnToOverview
+
+
+ @VariantTerms.Front_ReturnToListing
\ No newline at end of file
diff --git a/BuildFeed/Views/front/viewGroup.cshtml b/BuildFeed/Views/front/viewGroup.cshtml
index b18e78b..b9fad53 100644
--- a/BuildFeed/Views/front/viewGroup.cshtml
+++ b/BuildFeed/Views/front/viewGroup.cshtml
@@ -4,77 +4,77 @@
@using Humanizer
@model Tuple>
@{
- ViewBag.Title = $"{Model.Item1} | {InvariantTerms.SiteName}";
+ ViewBag.Title = $"{Model.Item1} | {InvariantTerms.SiteName}";
}
@Model.Item1.ToString()
@VariantTerms.Front_Listing
- @foreach (Build build in Model.Item2)
- {
-
-
- @if (build.BuildTime.HasValue)
- {
-
-
- @build.BuildTime.Value.ToLongDateWithoutDay()
-
-
-
- @build.BuildTime.Value.ToShortTimeString()
-
- }
- @if (build.IsLeaked)
- {
-
-
- @VariantTerms.Front_Public
-
- }
- else
- {
-
-
- @VariantTerms.Front_Private
-
- }
- @if (User.Identity.IsAuthenticated)
- {
-
-
- @VariantTerms.Front_Edit
-
-
- @if (Roles.IsUserInRole("Administrators"))
- {
-
- @VariantTerms.Front_Delete
-
- }
-
- }
-
- }
-
-
-
-
-
+ @foreach (Build build in Model.Item2)
+ {
+
+
+ @if (build.BuildTime.HasValue)
+ {
+
+
+ @build.BuildTime.Value.ToLongDateWithoutDay()
+
+
+
+ @build.BuildTime.Value.ToShortTimeString()
+
+ }
+ @if (build.IsLeaked)
+ {
+
+
+ @VariantTerms.Front_Public
+
+ }
+ else
+ {
+
+
+ @VariantTerms.Front_Private
+
+ }
+ @if (User.Identity.IsAuthenticated)
+ {
+
+
+ @VariantTerms.Front_Edit
+
+
+ @if (Roles.IsUserInRole("Administrators"))
+ {
+
+ @VariantTerms.Front_Delete
+
+ }
+
+ }
+
+ }
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildFeed/Views/front/viewLab.cshtml b/BuildFeed/Views/front/viewLab.cshtml
index 92d14ab..e743af5 100644
--- a/BuildFeed/Views/front/viewLab.cshtml
+++ b/BuildFeed/Views/front/viewLab.cshtml
@@ -4,107 +4,107 @@
@using Humanizer
@model IEnumerable
@{
- ViewBag.Title = string.Format("{0}{1} | {2}", string.Format(VariantTerms.Front_BuildsFrom, ViewBag.ItemId), ViewBag.PageNumber == 1
- ? ""
- : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber), InvariantTerms.SiteName);
+ ViewBag.Title = string.Format("{0}{1} | {2}", string.Format(VariantTerms.Front_BuildsFrom, ViewBag.ItemId), ViewBag.PageNumber == 1
+ ? ""
+ : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber), InvariantTerms.SiteName);
}
@section head
{
- @if (ViewBag.MetaItem != null)
- {
-
-
- }
- else
- {
- string metaDesc = string.Format(VariantTerms.Meta_LabGeneric, ViewBag.ItemId);
-
-
- }
+ @if (ViewBag.MetaItem != null)
+ {
+
+
+ }
+ else
+ {
+ string metaDesc = string.Format(VariantTerms.Meta_LabGeneric, ViewBag.ItemId);
+
+
+ }
- @if (ViewBag.PageNumber != 1)
- {
-
- }
+ @if (ViewBag.PageNumber != 1)
+ {
+
+ }
}
@string.Format(VariantTerms.Front_BuildsFrom, ViewBag.ItemId)
@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
- @VariantTerms.Front_About
- @Html.Raw(ViewBag.MetaItem.PageContent)
+ @VariantTerms.Front_About
+ @Html.Raw(ViewBag.MetaItem.PageContent)
}
@VariantTerms.Front_Share
@VariantTerms.Front_Listing
- @foreach (Build build in Model)
- {
-
-
- @if (build.BuildTime.HasValue)
- {
-
-
- @build.BuildTime.Value.ToLongDateWithoutDay()
-
-
-
-
- @build.BuildTime.Value.ToShortTimeString()
-
-
- }
- @if (build.IsLeaked)
- {
-
-
- @VariantTerms.Front_Public
-
- }
- else
- {
-
-
- @VariantTerms.Front_Private
-
- }
- @if (User.Identity.IsAuthenticated)
- {
-
-
- @VariantTerms.Front_Edit
-
-
- @if (Roles.IsUserInRole("Administrators"))
- {
-
- @VariantTerms.Front_Delete
-
- }
-
- }
-
- }
-
-
-
-
-
+ @foreach (Build build in Model)
+ {
+
+
+ @if (build.BuildTime.HasValue)
+ {
+
+
+ @build.BuildTime.Value.ToLongDateWithoutDay()
+
+
+
+
+ @build.BuildTime.Value.ToShortTimeString()
+
+
+ }
+ @if (build.IsLeaked)
+ {
+
+
+ @VariantTerms.Front_Public
+
+ }
+ else
+ {
+
+
+ @VariantTerms.Front_Private
+
+ }
+ @if (User.Identity.IsAuthenticated)
+ {
+
+
+ @VariantTerms.Front_Edit
+
+
+ @if (Roles.IsUserInRole("Administrators"))
+ {
+
+ @VariantTerms.Front_Delete
+
+ }
+
+ }
+
+ }
+
+
+
+
+
@PaginationHelpers.PaginationBlock((int)ViewBag.PageNumber, (int)ViewBag.PageCount, "viewLab", ViewContext.RouteData.Values)
\ No newline at end of file
diff --git a/BuildFeed/Views/front/viewSource.cshtml b/BuildFeed/Views/front/viewSource.cshtml
index 8697bf8..b89f4ea 100644
--- a/BuildFeed/Views/front/viewSource.cshtml
+++ b/BuildFeed/Views/front/viewSource.cshtml
@@ -4,104 +4,104 @@
@using Humanizer
@model IEnumerable
@{
- ViewBag.Title = string.Format("{0}{1} | {2}", ViewBag.ItemId, ViewBag.PageNumber == 1
- ? ""
- : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber), InvariantTerms.SiteName);
+ ViewBag.Title = string.Format("{0}{1} | {2}", ViewBag.ItemId, ViewBag.PageNumber == 1
+ ? ""
+ : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber), InvariantTerms.SiteName);
}
@section head
{
- @if (ViewBag.MetaItem != null)
- {
-
-
- }
+ @if (ViewBag.MetaItem != null)
+ {
+
+
+ }
- @if (ViewBag.PageNumber != 1)
- {
-
- }
+ @if (ViewBag.PageNumber != 1)
+ {
+
+ }
}
@ViewBag.ItemId
@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
- @VariantTerms.Front_About
- @Html.Raw(ViewBag.MetaItem.PageContent)
+ @VariantTerms.Front_About
+ @Html.Raw(ViewBag.MetaItem.PageContent)
}
@VariantTerms.Front_Share
@VariantTerms.Front_Listing
- @foreach (Build build in Model)
- {
-
-
- @if (!string.IsNullOrEmpty(build.Lab))
- {
-
- @build.Lab
- }
- @if (build.BuildTime.HasValue)
- {
-
-
- @build.BuildTime.Value.ToLongDateWithoutDay()
-
-
-
- @build.BuildTime.Value.ToShortTimeString()
-
- }
- @if (build.IsLeaked)
- {
-
-
- @VariantTerms.Front_Public
-
- }
- else
- {
-
-
- @VariantTerms.Front_Private
-
- }
- @if (User.Identity.IsAuthenticated)
- {
-
-
- @VariantTerms.Front_Edit
-
-
- @if (Roles.IsUserInRole("Administrators"))
- {
-
- @VariantTerms.Front_Delete
-
- }
-
- }
-
- }
-
-
-
-
-
+ @foreach (Build build in Model)
+ {
+
+
+ @if (!string.IsNullOrEmpty(build.Lab))
+ {
+
+ @build.Lab
+ }
+ @if (build.BuildTime.HasValue)
+ {
+
+
+ @build.BuildTime.Value.ToLongDateWithoutDay()
+
+
+
+ @build.BuildTime.Value.ToShortTimeString()
+
+ }
+ @if (build.IsLeaked)
+ {
+
+
+ @VariantTerms.Front_Public
+
+ }
+ else
+ {
+
+
+ @VariantTerms.Front_Private
+
+ }
+ @if (User.Identity.IsAuthenticated)
+ {
+
+
+ @VariantTerms.Front_Edit
+
+
+ @if (Roles.IsUserInRole("Administrators"))
+ {
+
+ @VariantTerms.Front_Delete
+
+ }
+
+ }
+
+ }
+
+
+
+
+
@PaginationHelpers.PaginationBlock((int)ViewBag.PageNumber, (int)ViewBag.PageCount, "viewSource", ViewContext.RouteData.Values)
\ No newline at end of file
diff --git a/BuildFeed/Views/front/viewVersion.cshtml b/BuildFeed/Views/front/viewVersion.cshtml
index 2f094b2..8007290 100644
--- a/BuildFeed/Views/front/viewVersion.cshtml
+++ b/BuildFeed/Views/front/viewVersion.cshtml
@@ -4,103 +4,103 @@
@using Humanizer
@model IEnumerable
@{
- ViewBag.Title = $"{InvariantTerms.ProductName} {ViewBag.ItemId} {(ViewBag.PageNumber == 1 ? "" : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber))} | {InvariantTerms.SiteName}";
+ ViewBag.Title = $"{InvariantTerms.ProductName} {ViewBag.ItemId} {(ViewBag.PageNumber == 1 ? "" : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber))} | {InvariantTerms.SiteName}";
}
@section head
{
- @if (ViewBag.MetaItem != null)
- {
-
-
- }
+ @if (ViewBag.MetaItem != null)
+ {
+
+
+ }
- @if (ViewBag.PageNumber != 1)
- {
-
- }
+ @if (ViewBag.PageNumber != 1)
+ {
+
+ }
}
@string.Format("{0} {1}", InvariantTerms.ProductName, ViewBag.ItemId)
@if (ViewBag.MetaItem != null
- && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
+ && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
- @VariantTerms.Front_About
- @Html.Raw(ViewBag.MetaItem.PageContent)
+ @VariantTerms.Front_About
+ @Html.Raw(ViewBag.MetaItem.PageContent)
}
@VariantTerms.Front_Share
@VariantTerms.Front_Listing
- @foreach (Build build in Model)
- {
-
-
- @if (!string.IsNullOrEmpty(build.Lab))
- {
-
- @build.Lab
-
- }
- @if (build.BuildTime.HasValue)
- {
-
-
- @build.BuildTime.Value.ToLongDateWithoutDay()
-
-
-
- @build.BuildTime.Value.ToShortTimeString()
-
- }
- @if (build.IsLeaked)
- {
-
-
- @VariantTerms.Front_Public
-
- }
- else
- {
-
-
- @VariantTerms.Front_Private
-
- }
- @if (User.Identity.IsAuthenticated)
- {
-
-
- @VariantTerms.Front_Edit
-
-
- @if (Roles.IsUserInRole("Administrators"))
- {
-
- @VariantTerms.Front_Delete
-
- }
-
- }
-
- }
-
-
-
-
-
+ @foreach (Build build in Model)
+ {
+
+
+ @if (!string.IsNullOrEmpty(build.Lab))
+ {
+
+ @build.Lab
+
+ }
+ @if (build.BuildTime.HasValue)
+ {
+
+
+ @build.BuildTime.Value.ToLongDateWithoutDay()
+
+
+
+ @build.BuildTime.Value.ToShortTimeString()
+
+ }
+ @if (build.IsLeaked)
+ {
+
+
+ @VariantTerms.Front_Public
+
+ }
+ else
+ {
+
+
+ @VariantTerms.Front_Private
+
+ }
+ @if (User.Identity.IsAuthenticated)
+ {
+
+
+ @VariantTerms.Front_Edit
+
+
+ @if (Roles.IsUserInRole("Administrators"))
+ {
+
+ @VariantTerms.Front_Delete
+
+ }
+
+ }
+
+ }
+
+
+
+
+
@PaginationHelpers.PaginationBlock((int)ViewBag.PageNumber, (int)ViewBag.PageCount, "viewVersion", ViewContext.RouteData.Values)
\ No newline at end of file
diff --git a/BuildFeed/Views/front/viewYear.cshtml b/BuildFeed/Views/front/viewYear.cshtml
index 2e9e904..a50eaf2 100644
--- a/BuildFeed/Views/front/viewYear.cshtml
+++ b/BuildFeed/Views/front/viewYear.cshtml
@@ -4,113 +4,113 @@
@using Humanizer
@model IEnumerable
@{
- ViewBag.Title = string.Format("{0}{1} | {2}", string.Format(VariantTerms.Front_BuildsFrom, ViewBag.ItemId), ViewBag.PageNumber == 1
- ? ""
- : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber), InvariantTerms.SiteName);
+ ViewBag.Title = string.Format("{0}{1} | {2}", string.Format(VariantTerms.Front_BuildsFrom, ViewBag.ItemId), ViewBag.PageNumber == 1
+ ? ""
+ : string.Format(VariantTerms.Common_TitlePage, ViewBag.PageNumber), InvariantTerms.SiteName);
}
@section head
{
- @if (ViewBag.MetaItem != null)
- {
-
-
- }
- else
- {
- string metaDesc = string.Format(VariantTerms.Meta_YearGeneric, ViewBag.ItemId);
-
-
- }
+ @if (ViewBag.MetaItem != null)
+ {
+
+
+ }
+ else
+ {
+ string metaDesc = string.Format(VariantTerms.Meta_YearGeneric, ViewBag.ItemId);
+
+
+ }
- @if (ViewBag.PageNumber != 1)
- {
-
- }
+ @if (ViewBag.PageNumber != 1)
+ {
+
+ }
}
@string.Format(VariantTerms.Front_BuildsFrom, ViewBag.ItemId)
@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
- @VariantTerms.Front_About
- @Html.Raw(ViewBag.MetaItem.PageContent)
+ @VariantTerms.Front_About
+ @Html.Raw(ViewBag.MetaItem.PageContent)
}
@VariantTerms.Front_Share
@VariantTerms.Front_Listing
- @foreach (Build build in Model)
- {
-
-
- @if (!string.IsNullOrEmpty(build.Lab))
- {
-
- @build.Lab
-
- }
- @if (build.BuildTime.HasValue)
- {
-
-
- @build.BuildTime.Value.ToLongDateWithoutDay()
-
-
-
-
- @build.BuildTime.Value.ToShortTimeString()
-
-
- }
- @if (build.IsLeaked)
- {
-
-
- @VariantTerms.Front_Public
-
- }
- else
- {
-
-
- @VariantTerms.Front_Private
-
- }
- @if (User.Identity.IsAuthenticated)
- {
-
-
- @VariantTerms.Front_Edit
-
-
- @if (Roles.IsUserInRole("Administrators"))
- {
-
- @VariantTerms.Front_Delete
-
- }
-
- }
-
- }
-
-
-
-
-
+ @foreach (Build build in Model)
+ {
+
+
+ @if (!string.IsNullOrEmpty(build.Lab))
+ {
+
+ @build.Lab
+
+ }
+ @if (build.BuildTime.HasValue)
+ {
+
+
+ @build.BuildTime.Value.ToLongDateWithoutDay()
+
+
+
+
+ @build.BuildTime.Value.ToShortTimeString()
+
+
+ }
+ @if (build.IsLeaked)
+ {
+
+
+ @VariantTerms.Front_Public
+
+ }
+ else
+ {
+
+
+ @VariantTerms.Front_Private
+
+ }
+ @if (User.Identity.IsAuthenticated)
+ {
+
+
+ @VariantTerms.Front_Edit
+
+
+ @if (Roles.IsUserInRole("Administrators"))
+ {
+
+ @VariantTerms.Front_Delete
+
+ }
+
+ }
+
+ }
+
+
+
+
+
@PaginationHelpers.PaginationBlock((int)ViewBag.PageNumber, (int)ViewBag.PageCount, "viewYear", ViewContext.RouteData.Values)
\ No newline at end of file
diff --git a/BuildFeed/Views/shared/_default.cshtml b/BuildFeed/Views/shared/_default.cshtml
index 3b8b9fb..a10a69e 100644
--- a/BuildFeed/Views/shared/_default.cshtml
+++ b/BuildFeed/Views/shared/_default.cshtml
@@ -272,7 +272,7 @@
-
+
@RenderSection("scripts", false)
+
@RenderSection("scripts", false)
@VariantTerms.Front_Comments
- - - + (function() + { + var dsq = document.createElement('script'); + dsq.type = 'text/javascript'; + dsq.async = true; + dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]) + .appendChild(dsq); + })(); + +