From 4dd0b01532662871695c6efc80a0cb63867331a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Thu, 24 Nov 2016 14:02:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E9=99=A4=E7=94=A8=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E7=A8=8B=E5=BA=8F=E9=9B=86=E4=BF=A1=E6=81=AF=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/CandyControllerBase.cs | 5 +- GitCandy.Web/Git/Cache/GitCacheAccessor.cs | 68 +++++++++---------- GitCandy.Web/GitCandy.Web.csproj | 3 - GitCandy.Web/Views/Home/About.cshtml | 14 +--- GitCandy.Web/Views/Home/About.generated.cs | 56 ++------------- 5 files changed, 45 insertions(+), 101 deletions(-) diff --git a/GitCandy.Web/Controllers/CandyControllerBase.cs b/GitCandy.Web/Controllers/CandyControllerBase.cs index ddc5f78..7310068 100644 --- a/GitCandy.Web/Controllers/CandyControllerBase.cs +++ b/GitCandy.Web/Controllers/CandyControllerBase.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using System.Threading; using System.Web; using System.Web.Caching; @@ -7,6 +8,7 @@ using GitCandy.Configuration; using GitCandy.Data; using GitCandy.Security; using NewLife.Log; +using NewLife.Reflection; namespace GitCandy.Controllers { @@ -102,6 +104,7 @@ namespace GitCandy.Controllers base.OnAuthorization(filterContext); } + static AssemblyX asm = AssemblyX.Create(Assembly.GetExecutingAssembly()); protected override void OnActionExecuting(ActionExecutingContext filterContext) { if (UserConfiguration.Current.ForceSsl && !Request.IsSecureConnection) @@ -121,7 +124,7 @@ namespace GitCandy.Controllers ViewBag.Lang = culture.Name; ViewBag.Identity = 0; - Response.AddHeader("X-GitCandy-Version", AppInfomation.Version.ToString()); + Response.AddHeader("X-GitCandy-Version", asm.Version); base.OnActionExecuting(filterContext); } diff --git a/GitCandy.Web/Git/Cache/GitCacheAccessor.cs b/GitCandy.Web/Git/Cache/GitCacheAccessor.cs index 70630fb..ccd27ea 100644 --- a/GitCandy.Web/Git/Cache/GitCacheAccessor.cs +++ b/GitCandy.Web/Git/Cache/GitCacheAccessor.cs @@ -66,29 +66,29 @@ namespace GitCandy.Git.Cache cachePath.EnsureDirectory(false); - var expectation = GetExpectation(); - var reality = new String[accessors.Length]; - var filename = Path.Combine(cachePath, "version"); - if (File.Exists(filename)) - { - var lines = File.ReadAllLines(filename); - Array.Copy(lines, reality, Math.Min(lines.Length, reality.Length)); - } - - for (int i = 0; i < reality.Length && i < expectation.Length; i++) - { - if (reality[i] != expectation[i]) - { - var path = Path.Combine(cachePath, (i + 1).ToString()); - if (Directory.Exists(path)) - { - var tmpPath = path + "." + DateTime.Now.Ticks + ".del"; - Directory.Move(path, tmpPath); - } - } - } - - File.WriteAllLines(filename, expectation); + //var expectation = GetExpectation(); + //var reality = new String[accessors.Length]; + //var filename = Path.Combine(cachePath, "version"); + //if (File.Exists(filename)) + //{ + // var lines = File.ReadAllLines(filename); + // Array.Copy(lines, reality, Math.Min(lines.Length, reality.Length)); + //} + + //for (int i = 0; i < reality.Length && i < expectation.Length; i++) + //{ + // if (reality[i] != expectation[i]) + // { + // var path = Path.Combine(cachePath, (i + 1).ToString()); + // if (Directory.Exists(path)) + // { + // var tmpPath = path + "." + DateTime.Now.Ticks + ".del"; + // Directory.Move(path, tmpPath); + // } + // } + //} + + //File.WriteAllLines(filename, expectation); new TimerX(s => { @@ -103,16 +103,16 @@ namespace GitCandy.Git.Cache enabled = true; } - private static String[] GetExpectation() - { - var assembly = typeof(AppInfomation).Assembly; - var name = assembly.GetManifestResourceNames().Single(s => s.EndsWith(".CacheVersion")); - using (var stream = assembly.GetManifestResourceStream(name)) - using (var reader = new StreamReader(stream)) - { - return reader.ReadToEnd().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - } - } + //private static String[] GetExpectation() + //{ + // var assembly = typeof(AppInfomation).Assembly; + // var name = assembly.GetManifestResourceNames().Single(s => s.EndsWith(".CacheVersion")); + // using (var stream = assembly.GetManifestResourceStream(name)) + // using (var reader = new StreamReader(stream)) + // { + // return reader.ReadToEnd().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + // } + //} public static void Delete(String project) { @@ -329,4 +329,4 @@ namespace GitCandy.Git.Cache return typeof(TAccessor).GetHashCode() ^ GetCacheKey().GetHashCode(); } } -} +} \ No newline at end of file diff --git a/GitCandy.Web/GitCandy.Web.csproj b/GitCandy.Web/GitCandy.Web.csproj index a5f327b..08fa362 100644 --- a/GitCandy.Web/GitCandy.Web.csproj +++ b/GitCandy.Web/GitCandy.Web.csproj @@ -426,7 +426,6 @@ - True True @@ -679,8 +678,6 @@ SR.zh-Hans.Designer.cs Designer - - diff --git a/GitCandy.Web/Views/Home/About.cshtml b/GitCandy.Web/Views/Home/About.cshtml index ebef863..728679a 100644 --- a/GitCandy.Web/Views/Home/About.cshtml +++ b/GitCandy.Web/Views/Home/About.cshtml @@ -9,22 +9,10 @@ * [ASP.NET MVC](http://aspnetwebstack.codeplex.com/) @@ [Apache License 2.0](http://aspnetwebstack.codeplex.com/license) * [Bootstrap](http://github.com/twbs/bootstrap) @@ [MIT License](http://github.com/twbs/bootstrap/blob/master/LICENSE) * [Bootstrap-switch](http://github.com/nostalgiaz/bootstrap-switch) @@ [Apache License 2.0](http://github.com/nostalgiaz/bootstrap-switch/blob/master/LICENSE) -* [EntityFramework](http://entityframework.codeplex.com/) @@ [Apache License 2.0](http://entityframework.codeplex.com/license) * [FxSsh](http://github.com/Aimeast/FxSsh) @@ [MIT license](http://github.com/Aimeast/FxSsh/blob/master/LICENSE.md) * [Highlight.js](http://github.com/isagalaev/highlight.js) @@ [New BSD License](http://github.com/isagalaev/highlight.js/blob/master/LICENSE) * [jQuery](http://github.com/jquery/jquery) @@ [MIT License](http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) * [LibGit2Sharp](http://github.com/libgit2/libgit2sharp) @@ [MIT License](http://github.com/libgit2/libgit2sharp/blob/master/LICENSE.md) * [marked](http://github.com/chjj/marked) @@ [MIT License](http://github.com/chjj/marked/blob/master/LICENSE) -* [Microsoft.Composition (MEF2)](http://mef.codeplex.com/) @@ [Microsoft Public License](http://mef.codeplex.com/license) -* [Newtonsoft.Json](http://json.codeplex.com/) @@ [MIT License](http://json.codeplex.com/license) * [SharpZipLib](http://github.com/icsharpcode/SharpZipLib) @@ [GPL License v2](http://github.com/icsharpcode/SharpZipLib/blob/master/doc/COPYING.txt) - - \ No newline at end of file + \ No newline at end of file diff --git a/GitCandy.Web/Views/Home/About.generated.cs b/GitCandy.Web/Views/Home/About.generated.cs index e6e6dbf..786829b 100644 --- a/GitCandy.Web/Views/Home/About.generated.cs +++ b/GitCandy.Web/Views/Home/About.generated.cs @@ -27,11 +27,12 @@ namespace ASP using System.Web.UI; using System.Web.WebPages; using GitCandy; - using GitCandy.Web.App_GlobalResources; using GitCandy.Base; using GitCandy.Configuration; using GitCandy.Extensions; using GitCandy.Models; + using GitCandy.Web; + using GitCandy.Web.App_GlobalResources; using NewLife; using NewLife.Cube; using NewLife.Reflection; @@ -88,10 +89,7 @@ WriteLiteral("@ [MIT License](http://github.com/twbs/bootstrap/blob/master/LICEN "ap-switch](http://github.com/nostalgiaz/bootstrap-switch) "); WriteLiteral("@ [Apache License 2.0](http://github.com/nostalgiaz/bootstrap-switch/blob/master/" + -"LICENSE)\r\n* [EntityFramework](http://entityframework.codeplex.com/) "); - -WriteLiteral("@ [Apache License 2.0](http://entityframework.codeplex.com/license)\r\n* [FxSsh](ht" + -"tp://github.com/Aimeast/FxSsh) "); +"LICENSE)\r\n* [FxSsh](http://github.com/Aimeast/FxSsh) "); WriteLiteral("@ [MIT license](http://github.com/Aimeast/FxSsh/blob/master/LICENSE.md)\r\n* [Highl" + "ight.js](http://github.com/isagalaev/highlight.js) "); @@ -105,53 +103,11 @@ WriteLiteral("@ [MIT License](http://github.com/jquery/jquery/blob/master/MIT-LI WriteLiteral("@ [MIT License](http://github.com/libgit2/libgit2sharp/blob/master/LICENSE.md)\r\n*" + " [marked](http://github.com/chjj/marked) "); -WriteLiteral("@ [MIT License](http://github.com/chjj/marked/blob/master/LICENSE)\r\n* [Microsoft." + -"Composition (MEF2)](http://mef.codeplex.com/) "); - -WriteLiteral("@ [Microsoft Public License](http://mef.codeplex.com/license)\r\n* [Newtonsoft.Json" + -"](http://json.codeplex.com/) "); - -WriteLiteral("@ [MIT License](http://json.codeplex.com/license)\r\n* [SharpZipLib](http://github." + -"com/icsharpcode/SharpZipLib) "); +WriteLiteral("@ [MIT License](http://github.com/chjj/marked/blob/master/LICENSE)\r\n* [SharpZipLi" + +"b](http://github.com/icsharpcode/SharpZipLib) "); WriteLiteral("@ [GPL License v2](http://github.com/icsharpcode/SharpZipLib/blob/master/doc/COPY" + -"ING.txt)\r\n\r\n"); +"ING.txt)\r\n"); } }