Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mastersign committed Aug 16, 2016
2 parents e6796ef + 7a4d36d commit 577b1b7
Show file tree
Hide file tree
Showing 168 changed files with 5,116 additions and 2,686 deletions.
5 changes: 5 additions & 0 deletions BenchManager/.nuget/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EWSoftware.SHFB" version="2016.5.28.0" targetFramework="net20" />
<package id="EWSoftware.SHFB.NETFramework" version="4.6.1" targetFramework="net20" />
</packages>
1 change: 1 addition & 0 deletions BenchManager/BenchDashboard/AppInfoDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private void LoadProperties(BenchConfiguration config, AppFacade app)
AddRow(gridResolved, PropertyKeys.AppWebsite, app.Website);
AddRow(gridResolved, PropertyKeys.AppDocs, app.Docs);
AddRow(gridResolved, PropertyKeys.AppVersion, app.Version);
AddRow(gridResolved, "Installed Version", app.InstalledVersion);
AddRow(gridResolved, PropertyKeys.AppDependencies, app.Dependencies);
AddRow(gridResolved, PropertyKeys.AppForce, app.Force);
AddRow(gridResolved, PropertyKeys.AppSetupTestFile, app.SetupTestFile);
Expand Down
12 changes: 11 additions & 1 deletion BenchManager/BenchDashboard/AppWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ public AppWrapper(AppFacade app, int no)

public string Label { get { return app.Label; } }

public string Version { get { return app.Version; } }
public string Version
{
get
{
return app.IsInstalled && !app.IsVersionUpToDate
? app.InstalledVersion + " \u2192 " + app.Version
: app.Version;
}
}

public string Launcher { get { return app.Launcher; } }

Expand All @@ -49,6 +57,8 @@ public string Typ
return "Python 2";
case AppTyps.Python3Package:
return "Python 3";
case AppTyps.NuGetPackage:
return "NuGet";
default:
return app.Typ;
}
Expand Down
71 changes: 39 additions & 32 deletions BenchManager/BenchDashboard/BenchDashboard.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Net.Compilers.1.3.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.3.0\build\Microsoft.Net.Compilers.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -204,63 +204,70 @@
</ItemGroup>
<ItemGroup>
<None Include="Resources\properties_16.png" />
<Content Include="Resources\website_16.png" />
<None Include="Resources\about.ico" />
<None Include="Resources\bash.ico" />
<None Include="Resources\library_16.png" />
<None Include="Resources\Markdown.ico" />
<None Include="Resources\markdown_16.png" />
<None Include="Resources\refresh_16.png" />
<None Include="Resources\userconfig_16.png" />
<None Include="Resources\userlibrary_16.png" />
<None Include="Resources\website_16.png" />
<None Include="acknowledgements.txt" />
<None Include="licenses.txt" />
<Content Include="Resources\cached_16.png" />
<None Include="Resources\cached_16.png" />
<None Include="Resources\cancelled_48.png" />
<Content Include="Resources\cleanup_16.png" />
<Content Include="Resources\clear_16.png" />
<None Include="Resources\cleanup_16.png" />
<None Include="Resources\clear_16.png" />
<None Include="Resources\warning_36_animation.gif" />
<None Include="Resources\warning_48.png" />
<EmbeddedResource Include="Resources\ConEmu.xml" />
<Content Include="Resources\deletedownload_16.png" />
<Content Include="Resources\downloadall_16.png" />
<Content Include="Resources\download_16.png" />
<Content Include="Resources\do_16.png" />
<Content Include="Resources\do_32.png" />
<None Include="Resources\deletedownload_16.png" />
<None Include="Resources\downloadall_16.png" />
<None Include="Resources\download_16.png" />
<None Include="Resources\do_16.png" />
<None Include="Resources\do_32.png" />
<None Include="Resources\error_48.png" />
<Content Include="Resources\install_16.png" />
<Content Include="Resources\logo_64.png" />
<None Include="Resources\install_16.png" />
<None Include="Resources\logo_64.png" />
<Content Include="Resources\MarkdownViewerTemplate.html" />
<Content Include="Resources\doc_16.png" />
<Content Include="Resources\docs_16.png" />
<Content Include="Resources\none_16.png" />
<None Include="Resources\doc_16.png" />
<None Include="Resources\docs_16.png" />
<None Include="Resources\none_16.png" />
<None Include="Resources\ok_48.png" />
<None Include="Resources\progress_36_animation.gif" />
<Content Include="Resources\purge_16.png" />
<Content Include="Resources\reinstall_16.png" />
<None Include="Resources\purge_16.png" />
<None Include="Resources\reinstall_16.png" />
<None Include="Resources\stop_32.png" />
<None Include="Resources\stop_16.png" />
<None Include="Resources\stop_36_animation.gif" />
<Content Include="Resources\MarkdownViewerStyle.css" />
<Content Include="Resources\task_16.png" />
<Content Include="Resources\tolerated_16.png" />
<Content Include="Resources\uninstall_16.png" />
<Content Include="Resources\updateenv_16.png" />
<Content Include="Resources\upgrade_16.png" />
<Content Include="Resources\warning_16.png" />
<None Include="Resources\task_16.png" />
<None Include="Resources\tolerated_16.png" />
<None Include="Resources\uninstall_16.png" />
<None Include="Resources\updateenv_16.png" />
<None Include="Resources\upgrade_16.png" />
<None Include="Resources\warning_16.png" />
<None Include="Resources\apps.png" />
<Content Include="Resources\bench.ico" />
<None Include="Resources\bench.ico" />
<None Include="Resources\missing_app_16.png" />
<None Include="Resources\config.png" />
<None Include="Resources\exclude.png" />
<None Include="Resources\include.png" />
<Content Include="Resources\blocked_16.png" />
<Content Include="Resources\info_16.png" />
<Content Include="Resources\ok_16.png" />
<Content Include="Resources\setup.ico" />
<None Include="Resources\blocked_16.png" />
<None Include="Resources\info_16.png" />
<None Include="Resources\ok_16.png" />
<None Include="Resources\setup.ico" />
<None Include="Resources\setup_16.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.3.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.3.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\ConEmu.Core.16.6.19.0\build\ConEmu.Core.Targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ConEmu.Core.16.6.19.0\build\ConEmu.Core.Targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\ConEmu.Core.16.7.24.0\build\ConEmu.Core.Targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ConEmu.Core.16.7.24.0\build\ConEmu.Core.Targets'))" />
</Target>
<Import Project="..\packages\ConEmu.Core.16.6.19.0\build\ConEmu.Core.Targets" Condition="Exists('..\packages\ConEmu.Core.16.6.19.0\build\ConEmu.Core.Targets')" />
<Import Project="..\packages\ConEmu.Core.16.7.24.0\build\ConEmu.Core.Targets" Condition="Exists('..\packages\ConEmu.Core.16.7.24.0\build\ConEmu.Core.Targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
81 changes: 69 additions & 12 deletions BenchManager/BenchDashboard/Core.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -27,6 +28,12 @@ public class Core : IDisposable, IBenchManager

private bool busy;

private bool configReloadNecessary;

private readonly object configReloadLockHandle = new object();

private FileSystemWatcher[] fsWatchers;

private ActionState actionState;

private Cancelation cancelation;
Expand Down Expand Up @@ -62,6 +69,7 @@ public Core(string benchRoot)
Env = new BenchEnvironment(Config);
Downloader = BenchTasks.InitializeDownloader(Config);
ProcessExecutionHost = new DefaultExecutionHost();
SetupFileWatchers();
}

public void SyncWithGui(ThreadStart task)
Expand All @@ -84,6 +92,10 @@ public bool Busy
if (value == busy) return;
busy = value;
OnBusyChanged();
if (!busy && configReloadNecessary)
{
Reload();
}
}
}

Expand Down Expand Up @@ -118,6 +130,50 @@ private void OnActionStateChanged()

public Cancelation Cancelation { get { return cancelation; } }

private void SetupFileWatchers()
{
DisposeFileWatchers();
var paths = Config.Sources;
fsWatchers = paths
.Select(p => new FileSystemWatcher(Path.GetDirectoryName(p))
{
Filter = Path.GetFileName(p),
//NotifyFilter = NotifyFilters.LastWrite,
IncludeSubdirectories = false,
EnableRaisingEvents = true,
})
.ToArray();
foreach (var w in fsWatchers)
{
w.Changed += SourceFileChangedHandler;
}
}

private void DisposeFileWatchers()
{
if (fsWatchers != null)
{
foreach (var w in fsWatchers)
{
w.Changed -= SourceFileChangedHandler;
w.Dispose();
}
fsWatchers = null;
}
}

private void SourceFileChangedHandler(object sender, FileSystemEventArgs e)
{
if (busy)
{
configReloadNecessary = true;
}
else
{
Task.Run(() => Reload(true));
}
}

private void OnConfigReloaded()
{
SyncWithGui(() =>
Expand Down Expand Up @@ -156,12 +212,16 @@ private void OnAppStateChanged(string appId)

public void Reload(bool configChanged = false)
{
Config = Config.Reload();
Env = new BenchEnvironment(Config);
if (configChanged)
configReloadNecessary = false;
lock (configReloadLockHandle)
{
Downloader.Dispose();
Downloader = BenchTasks.InitializeDownloader(Config);
Config = Config.Reload();
Env = new BenchEnvironment(Config);
if (configChanged)
{
Downloader.Dispose();
Downloader = BenchTasks.InitializeDownloader(Config);
}
}
OnConfigReloaded();
}
Expand All @@ -177,7 +237,6 @@ public void SetAppActivated(string appId, bool value)
{
activationFile.SignOut(appId);
}
Reload();
}

public void SetAppDeactivated(string appId, bool value)
Expand All @@ -191,7 +250,6 @@ public void SetAppDeactivated(string appId, bool value)
{
deactivationFile.SignOut(appId);
}
Reload();
}

public Task<ActionResult> RunTaskAsync(BenchTaskForAll action,
Expand Down Expand Up @@ -411,7 +469,7 @@ public async Task<ActionResult> InstallAppsAsync(Action<TaskInfo> notify, string
"Installing the app " + appId + " failed.",
result.Errors, 10));
}
OnAppStateChanged(appId);
OnAllAppStateChanged();
return result;
}

Expand Down Expand Up @@ -449,7 +507,7 @@ public async Task<ActionResult> UninstallAppsAsync(Action<TaskInfo> notify, stri
"Uninstalling the app " + appId + " failed.",
result.Errors, 10));
}
OnAppStateChanged(appId);
OnAllAppStateChanged();
return result;
}

Expand Down Expand Up @@ -487,7 +545,7 @@ public async Task<ActionResult> ReinstallAppsAsync(Action<TaskInfo> notify, stri
"Reinstalling the app " + appId + " failed.",
result.Errors, 10));
}
OnAppStateChanged(appId);
OnAllAppStateChanged();
return result;
}

Expand Down Expand Up @@ -525,7 +583,7 @@ public async Task<ActionResult> UpgradeAppsAsync(Action<TaskInfo> notify, string
"Upgrading the app " + appId + " failed.",
result.Errors, 10));
}
OnAppStateChanged(appId);
OnAllAppStateChanged();
return result;
}

Expand All @@ -546,7 +604,6 @@ public async Task<ActionResult> UpdateEnvironmentAsync(Action<TaskInfo> notify)
"Updating the bench environment failed.",
result.Errors, 10));
}
OnAllAppStateChanged();
return result;
}

Expand Down
Loading

0 comments on commit 577b1b7

Please sign in to comment.