Browse Source

排除用不到的程序集信息文件

v1.4
大石头 9 years ago
parent
commit
4dd0b01532
  1. 5
      GitCandy.Web/Controllers/CandyControllerBase.cs
  2. 68
      GitCandy.Web/Git/Cache/GitCacheAccessor.cs
  3. 3
      GitCandy.Web/GitCandy.Web.csproj
  4. 14
      GitCandy.Web/Views/Home/About.cshtml
  5. 56
      GitCandy.Web/Views/Home/About.generated.cs

5
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);
}

68
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();
}
}
}
}

3
GitCandy.Web/GitCandy.Web.csproj

@ -426,7 +426,6 @@
<Compile Include="Models\TreeModel.cs" />
<Compile Include="Models\UserListModel.cs" />
<Compile Include="Models\UserModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Views\Account\Change.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@ -679,8 +678,6 @@
<LastGenOutput>SR.zh-Hans.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Information" />
<EmbeddedResource Include="Properties\CacheVersion" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />

14
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)
</div>
<!--
@AppInfomation.BuildingInformation
Version: @AppInfomation.Version
Tracing: @AppInfomation.DateTimeOffsetFormatedNow
Starting: @AppInfomation.StartingTime
-->
</div>

56
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</div>\r\n<!--\r\n");
#line 23 "..\..\Views\Home\About.cshtml"
Write(AppInfomation.BuildingInformation);
#line default
#line hidden
WriteLiteral("\r\n\r\nVersion: ");
#line 25 "..\..\Views\Home\About.cshtml"
Write(AppInfomation.Version);
#line default
#line hidden
WriteLiteral("\r\n\r\nTracing: ");
#line 27 "..\..\Views\Home\About.cshtml"
Write(AppInfomation.DateTimeOffsetFormatedNow);
#line default
#line hidden
WriteLiteral("\r\n\r\nStarting: ");
#line 29 "..\..\Views\Home\About.cshtml"
Write(AppInfomation.StartingTime);
#line default
#line hidden
WriteLiteral("\r\n-->");
"ING.txt)\r\n</div>");
}
}

Loading…
Cancel
Save