make dashboard project portable

pull/702/head
Luke Pulverenti 8 years ago
parent ef6b90b8e6
commit 23d7afdf68

@ -11,10 +11,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Services; using MediaBrowser.Model.Services;
@ -243,9 +240,7 @@ namespace MediaBrowser.WebDashboard.Api
cacheDuration = TimeSpan.FromDays(365); cacheDuration = TimeSpan.FromDays(365);
} }
var assembly = GetType().Assembly.GetName(); var cacheKey = (_appHost.ApplicationVersion.ToString() + (localizationCulture ?? string.Empty) + path).GetMD5();
var cacheKey = (assembly.Version + (localizationCulture ?? string.Empty) + path).GetMD5();
return await ResultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(path, localizationCulture)).ConfigureAwait(false); return await ResultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(path, localizationCulture)).ConfigureAwait(false);
} }
@ -442,9 +437,9 @@ namespace MediaBrowser.WebDashboard.Api
private async Task DumpHtml(string source, string destination, string mode, string culture, string appVersion) private async Task DumpHtml(string source, string destination, string mode, string culture, string appVersion)
{ {
foreach (var file in Directory.GetFiles(source, "*", SearchOption.TopDirectoryOnly)) foreach (var file in _fileSystem.GetFiles(source))
{ {
var filename = Path.GetFileName(file); var filename = file.Name;
await DumpFile(filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false); await DumpFile(filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false);
} }
@ -466,14 +461,12 @@ namespace MediaBrowser.WebDashboard.Api
_fileSystem.CreateDirectory(destination); _fileSystem.CreateDirectory(destination);
//Now Create all of the directories //Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(source, "*", foreach (var dirPath in _fileSystem.GetDirectories(source, true))
SearchOption.AllDirectories)) _fileSystem.CreateDirectory(dirPath.FullName.Replace(source, destination));
_fileSystem.CreateDirectory(dirPath.Replace(source, destination));
//Copy all the files & Replaces any files with the same name //Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(source, "*.*", foreach (var newPath in _fileSystem.GetFiles(source, true))
SearchOption.AllDirectories)) _fileSystem.CopyFile(newPath.FullName, newPath.FullName.Replace(source, destination), true);
_fileSystem.CopyFile(newPath, newPath.Replace(source, destination), true);
} }
} }

@ -7,8 +7,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
@ -228,7 +226,7 @@ namespace MediaBrowser.WebDashboard.Api
html = html.Substring(0, index+7); html = html.Substring(0, index+7);
} }
} }
var mainFile = File.ReadAllText(GetDashboardResourcePath("index.html")); var mainFile = _fileSystem.ReadAllText(GetDashboardResourcePath("index.html"));
html = ReplaceFirst(mainFile, "<div class=\"mainAnimatedPages skinBody\"></div>", "<div class=\"mainAnimatedPages skinBody hide\">" + html + "</div>"); html = ReplaceFirst(mainFile, "<div class=\"mainAnimatedPages skinBody\"></div>", "<div class=\"mainAnimatedPages skinBody hide\">" + html + "</div>");
} }

@ -13,8 +13,10 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<ProductVersion>10.0.0</ProductVersion> <ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile /> <TargetFrameworkProfile>
</TargetFrameworkProfile>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -48,12 +50,6 @@
<Reference Include="Patterns.Logging"> <Reference Include="Patterns.Logging">
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath> <HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\SharedVersion.cs"> <Compile Include="..\SharedVersion.cs">
@ -1562,7 +1558,7 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent> <PostBuildEvent>
</PostBuildEvent> </PostBuildEvent>

@ -0,0 +1,16 @@
{
"supports": {
"net46.app": {},
"uwp.10.0.app": {},
"dnxcore50.app": {}
},
"dependencies": {
"Microsoft.NETCore": "5.0.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.0"
},
"frameworks": {
"dotnet": {
"imports": "portable-net452+win81"
}
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save