Added comments.

This commit is contained in:
Holger Börchers 2018-03-22 08:16:17 +01:00
parent 9dd3943448
commit 715e93985d

View File

@ -10,6 +10,9 @@ using System.Threading.Tasks;
namespace Katteker namespace Katteker
{ {
/// <summary>
/// Update manager, which handles the updates.
/// </summary>
public class UpdateManager public class UpdateManager
{ {
private static readonly string _baseDir = AppDomain.CurrentDomain.BaseDirectory; private static readonly string _baseDir = AppDomain.CurrentDomain.BaseDirectory;
@ -40,6 +43,13 @@ namespace Katteker
/// </summary> /// </summary>
public string UrlOrPath => _urlOrPath; public string UrlOrPath => _urlOrPath;
/// <summary>
/// Create the update manager.
/// </summary>
/// <param name="urlOrPath">path to the publishing directory</param>
/// <param name="applicationName">name of the application to update.</param>
/// <param name="rootDirectory">root directory.</param>
/// <returns>the update manager.</returns>
public static UpdateManager Create(string urlOrPath = null, string applicationName = null, string rootDirectory = null) public static UpdateManager Create(string urlOrPath = null, string applicationName = null, string rootDirectory = null)
{ {
_config = ReadConfigFile(); _config = ReadConfigFile();
@ -49,6 +59,14 @@ namespace Katteker
return new UpdateManager(urlOrPath, appName, rootAppDirectory); return new UpdateManager(urlOrPath, appName, rootAppDirectory);
} }
/// <summary>
/// Try to create the update manager.
/// </summary>
/// <param name="manager">update manager</param>
/// <param name="urlOrPath">path to the publishing directory</param>
/// <param name="applicationName">name of the application to update.</param>
/// <param name="rootDirectory">root directory.</param>
/// <returns>true if the creation success, false otherwise.</returns>
public static bool TryCreate(out UpdateManager manager, string urlOrPath = null, string applicationName = null, string rootDirectory = null) public static bool TryCreate(out UpdateManager manager, string urlOrPath = null, string applicationName = null, string rootDirectory = null)
{ {
try try
@ -69,6 +87,11 @@ namespace Katteker
return updateInfo.ReleasesToApply; return updateInfo.ReleasesToApply;
} }
/// <summary>
/// Restart the application.
/// </summary>
/// <param name="exeToStart"></param>
/// <param name="arguments"></param>
public void RestartApp(string exeToStart = null, string arguments = null) public void RestartApp(string exeToStart = null, string arguments = null)
{ {
exeToStart = exeToStart ?? Path.GetFileName(Assembly.GetEntryAssembly().Location); exeToStart = exeToStart ?? Path.GetFileName(Assembly.GetEntryAssembly().Location);
@ -81,6 +104,11 @@ namespace Katteker
} }
} }
/// <summary>
/// Update application.
/// </summary>
/// <param name="progress">The updating process.</param>
/// <returns></returns>
public async Task<bool> UpdateAppAsync(IProgress<int> progress = null) public async Task<bool> UpdateAppAsync(IProgress<int> progress = null)
{ {
progress?.Report(0); progress?.Report(0);