NativeApp.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using MediaBrowser.Server.Mono;
  2. using System;
  3. using System.Runtime.InteropServices;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. using MediaBrowser.Common.Updates;
  7. using MediaBrowser.Model.Logging;
  8. using MediaBrowser.Model.Updates;
  9. namespace MediaBrowser.ServerApplication.Native
  10. {
  11. /// <summary>
  12. /// Class NativeApp
  13. /// </summary>
  14. public static class NativeApp
  15. {
  16. /// <summary>
  17. /// Shutdowns this instance.
  18. /// </summary>
  19. public static void Shutdown()
  20. {
  21. MainClass.Shutdown ();
  22. }
  23. /// <summary>
  24. /// Restarts this instance.
  25. /// </summary>
  26. public static void Restart()
  27. {
  28. MainClass.Restart ();
  29. }
  30. /// <summary>
  31. /// Determines whether this instance [can self restart].
  32. /// </summary>
  33. /// <returns><c>true</c> if this instance [can self restart]; otherwise, <c>false</c>.</returns>
  34. public static bool CanSelfRestart
  35. {
  36. get
  37. {
  38. return MainClass.CanSelfRestart;
  39. }
  40. }
  41. /// <summary>
  42. /// Gets a value indicating whether this instance can self update.
  43. /// </summary>
  44. /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
  45. public static bool CanSelfUpdate
  46. {
  47. get
  48. {
  49. return MainClass.CanSelfUpdate;
  50. }
  51. }
  52. public static bool SupportsAutoRunAtStartup
  53. {
  54. get { return false; }
  55. }
  56. public static void PreventSystemStandby()
  57. {
  58. }
  59. public static Task<CheckForUpdateResult> CheckForApplicationUpdate(Version currentVersion,
  60. PackageVersionClass updateLevel,
  61. IInstallationManager installationManager,
  62. CancellationToken cancellationToken,
  63. IProgress<double> progress)
  64. {
  65. var result = new CheckForUpdateResult { AvailableVersion = currentVersion.ToString(), IsUpdateAvailable = false };
  66. return Task.FromResult(result);
  67. }
  68. }
  69. }