IApplicationHost.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using MediaBrowser.Model.Updates;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Common.Kernel
  7. {
  8. /// <summary>
  9. /// An interface to be implemented by the applications hosting a kernel
  10. /// </summary>
  11. public interface IApplicationHost
  12. {
  13. /// <summary>
  14. /// Restarts this instance.
  15. /// </summary>
  16. void Restart();
  17. /// <summary>
  18. /// Reloads the logger.
  19. /// </summary>
  20. void ReloadLogger();
  21. /// <summary>
  22. /// Gets the application version.
  23. /// </summary>
  24. /// <value>The application version.</value>
  25. Version ApplicationVersion { get; }
  26. /// <summary>
  27. /// Gets the log file path.
  28. /// </summary>
  29. /// <value>The log file path.</value>
  30. string LogFilePath { get; }
  31. /// <summary>
  32. /// Gets or sets a value indicating whether this instance can self update.
  33. /// </summary>
  34. /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
  35. bool CanSelfUpdate { get; }
  36. /// <summary>
  37. /// Gets a value indicating whether this instance is first run.
  38. /// </summary>
  39. /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
  40. bool IsFirstRun { get; }
  41. /// <summary>
  42. /// Gets the failed assemblies.
  43. /// </summary>
  44. /// <value>The failed assemblies.</value>
  45. List<string> FailedAssemblies { get; }
  46. /// <summary>
  47. /// Gets all concrete types.
  48. /// </summary>
  49. /// <value>All concrete types.</value>
  50. Type[] AllConcreteTypes { get; }
  51. /// <summary>
  52. /// Gets the exports.
  53. /// </summary>
  54. /// <typeparam name="T"></typeparam>
  55. /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
  56. /// <returns>IEnumerable{``0}.</returns>
  57. IEnumerable<T> GetExports<T>(bool manageLiftime = true);
  58. /// <summary>
  59. /// Checks for update.
  60. /// </summary>
  61. /// <returns>Task{CheckForUpdateResult}.</returns>
  62. Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress);
  63. /// <summary>
  64. /// Updates the application.
  65. /// </summary>
  66. /// <returns>Task.</returns>
  67. Task UpdateApplication(CancellationToken cancellationToken, IProgress<double> progress);
  68. /// <summary>
  69. /// Creates an instance of type and resolves all constructor dependancies
  70. /// </summary>
  71. /// <param name="type">The type.</param>
  72. /// <returns>System.Object.</returns>
  73. object CreateInstance(Type type);
  74. /// <summary>
  75. /// Resolves this instance.
  76. /// </summary>
  77. /// <typeparam name="T"></typeparam>
  78. /// <returns>``0.</returns>
  79. T Resolve<T>();
  80. /// <summary>
  81. /// Resolves this instance.
  82. /// </summary>
  83. /// <typeparam name="T"></typeparam>
  84. /// <returns>``0.</returns>
  85. T TryResolve<T>();
  86. }
  87. }