Tidy: Sort/remove usings, simplify names
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Web
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Users;
|
||||
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Web
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Disco.Services.Web.Bundles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Services.Web.Bundles
|
||||
{
|
||||
@@ -14,8 +9,8 @@ namespace Disco.Services.Web.Bundles
|
||||
|
||||
public BundleHandler(IBundle requestBundle, string bundleVirtualPath)
|
||||
{
|
||||
this.RequestBundle = requestBundle;
|
||||
this.BundleVirtualPath = bundleVirtualPath;
|
||||
RequestBundle = requestBundle;
|
||||
BundleVirtualPath = bundleVirtualPath;
|
||||
}
|
||||
|
||||
public bool IsReusable
|
||||
@@ -30,7 +25,7 @@ namespace Disco.Services.Web.Bundles
|
||||
if (!string.IsNullOrEmpty(context.Request.Headers["If-Modified-Since"]))
|
||||
context.Response.StatusCode = 304;
|
||||
else
|
||||
this.RequestBundle.ProcessRequest(context);
|
||||
RequestBundle.ProcessRequest(context);
|
||||
}
|
||||
|
||||
internal static bool RemapHandlerForBundleRequests(HttpApplication app)
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(Disco.Services.Web.Bundles.BundleModule), "PreApplicationStart")]
|
||||
@@ -14,7 +10,7 @@ namespace Disco.Services.Web.Bundles
|
||||
{
|
||||
public void Init(HttpApplication context)
|
||||
{
|
||||
context.PostResolveRequestCache += new EventHandler(this.OnApplicationPostResolveRequestCache);
|
||||
context.PostResolveRequestCache += new EventHandler(OnApplicationPostResolveRequestCache);
|
||||
}
|
||||
|
||||
private void OnApplicationPostResolveRequestCache(object sender, EventArgs e)
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Services.Web.Bundles
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Services.Web.Bundles
|
||||
@@ -34,7 +30,7 @@ namespace Disco.Services.Web.Bundles
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return string.Format("{0}?v={1}", this.Url, this.FileHash);
|
||||
return string.Format("{0}?v={1}", Url, FileHash);
|
||||
#else
|
||||
return _VersionUrl;
|
||||
#endif
|
||||
@@ -65,10 +61,10 @@ namespace Disco.Services.Web.Bundles
|
||||
switch (fileInfo.Extension.ToLower())
|
||||
{
|
||||
case ".css":
|
||||
this.ContentType = "text/css";
|
||||
ContentType = "text/css";
|
||||
break;
|
||||
case ".js":
|
||||
this.ContentType = "text/javascript";
|
||||
ContentType = "text/javascript";
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unsupported Bundle File Extension");
|
||||
@@ -78,28 +74,28 @@ namespace Disco.Services.Web.Bundles
|
||||
if (fileInfo.Length > 0)
|
||||
UpdateFileHash();
|
||||
else
|
||||
this._FileHash = string.Empty;
|
||||
_FileHash = string.Empty;
|
||||
|
||||
//this.Version = fileInfo.LastWriteTimeUtc.Ticks;
|
||||
|
||||
this._VersionUrl = string.Format("{0}?v={1}", this.Url, this.FileHash);
|
||||
_VersionUrl = string.Format("{0}?v={1}", this.Url, FileHash);
|
||||
}
|
||||
|
||||
private void UpdateFileHash()
|
||||
{
|
||||
if (System.IO.File.Exists(this.File))
|
||||
if (System.IO.File.Exists(File))
|
||||
{
|
||||
var fileLastModified = System.IO.File.GetLastWriteTimeUtc(this.File);
|
||||
if (!this._FileLastModified.HasValue || this._FileLastModified.Value != fileLastModified)
|
||||
var fileLastModified = System.IO.File.GetLastWriteTimeUtc(File);
|
||||
if (!_FileLastModified.HasValue || _FileLastModified.Value != fileLastModified)
|
||||
{
|
||||
this._FileLastModified = fileLastModified;
|
||||
var fileBytes = System.IO.File.ReadAllBytes(this.File);
|
||||
_FileLastModified = fileLastModified;
|
||||
var fileBytes = System.IO.File.ReadAllBytes(File);
|
||||
if (fileBytes.Length > 0)
|
||||
{
|
||||
using (SHA256 sha = SHA256.Create())
|
||||
{
|
||||
byte[] hash = sha.ComputeHash(fileBytes);
|
||||
this._FileHash = HttpServerUtility.UrlTokenEncode(hash);
|
||||
_FileHash = HttpServerUtility.UrlTokenEncode(hash);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -111,13 +107,13 @@ namespace Disco.Services.Web.Bundles
|
||||
}
|
||||
}
|
||||
|
||||
this._FileHash = string.Empty;
|
||||
_FileHash = string.Empty;
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
// Write Content Type
|
||||
context.Response.ContentType = this.ContentType;
|
||||
context.Response.ContentType = ContentType;
|
||||
|
||||
// Write Headers
|
||||
var cache = context.Response.Cache;
|
||||
@@ -128,7 +124,7 @@ namespace Disco.Services.Web.Bundles
|
||||
cache.SetCacheability(HttpCacheability.Public);
|
||||
|
||||
// Write File
|
||||
context.Response.WriteFile(this.File);
|
||||
context.Response.WriteFile(File);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Services.Web.Bundles
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Web.Bundles
|
||||
{
|
||||
@@ -24,7 +20,7 @@ namespace Disco.Services.Web.Bundles
|
||||
public UrlBundle(string Url, string ContentType)
|
||||
{
|
||||
this.Url = Url;
|
||||
this.VersionUrl = Url;
|
||||
VersionUrl = Url;
|
||||
|
||||
this.ContentType = ContentType;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using Disco.Data.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Web
|
||||
@@ -15,18 +10,18 @@ namespace Disco.Services.Web
|
||||
|
||||
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
this.Database = new DiscoDataContext();
|
||||
this.Database.Configuration.LazyLoadingEnabled = false;
|
||||
Database = new DiscoDataContext();
|
||||
Database.Configuration.LazyLoadingEnabled = false;
|
||||
|
||||
base.OnActionExecuting(filterContext);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (this.Database != null)
|
||||
if (Database != null)
|
||||
{
|
||||
this.Database.Dispose();
|
||||
this.Database = null;
|
||||
Database.Dispose();
|
||||
Database = null;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
@@ -48,7 +41,7 @@ namespace Disco.Services.Web
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._typeId;
|
||||
return _typeId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Disco.Services.Web.Signalling
|
||||
if (AuthorisedClaims == null || AuthorisedClaims.Length == 0)
|
||||
throw new ArgumentNullException("AuthorisedClaims");
|
||||
|
||||
this.authorizedClaims = AuthorisedClaims;
|
||||
authorizedClaims = AuthorisedClaims;
|
||||
}
|
||||
|
||||
protected override bool UserAuthorized(IPrincipal user)
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Disco.Services.Web.Signalling
|
||||
if (AuthorisedClaims == null || AuthorisedClaims.Length == 0)
|
||||
throw new ArgumentNullException("AuthorisedClaims");
|
||||
|
||||
this.authorizedClaims = AuthorisedClaims;
|
||||
authorizedClaims = AuthorisedClaims;
|
||||
}
|
||||
|
||||
protected override bool UserAuthorized(IPrincipal user)
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Disco.Services.Web.Signalling
|
||||
|
||||
public DiscoHubAuthorizeAttribute(string AuthorisedClaim)
|
||||
{
|
||||
this.authorizedClaim = AuthorisedClaim;
|
||||
authorizedClaim = AuthorisedClaim;
|
||||
}
|
||||
|
||||
protected override bool UserAuthorized(IPrincipal user)
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Web
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user