aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common')
-rw-r--r--MediaBrowser.Common/Extensions/HexHelper.cs22
-rw-r--r--MediaBrowser.Common/IApplicationHost.cs8
-rw-r--r--MediaBrowser.Common/MediaBrowser.Common.csproj6
-rw-r--r--MediaBrowser.Common/Net/HttpRequestOptions.cs12
-rw-r--r--MediaBrowser.Common/Net/IHttpClient.cs16
-rw-r--r--MediaBrowser.Common/Updates/IInstallationManager.cs21
6 files changed, 42 insertions, 43 deletions
diff --git a/MediaBrowser.Common/Extensions/HexHelper.cs b/MediaBrowser.Common/Extensions/HexHelper.cs
new file mode 100644
index 000000000..3d80d94ac
--- /dev/null
+++ b/MediaBrowser.Common/Extensions/HexHelper.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Globalization;
+
+namespace MediaBrowser.Common.Extensions
+{
+ public static class HexHelper
+ {
+ public static byte[] FromHexString(string str)
+ {
+ byte[] bytes = new byte[str.Length / 2];
+ for (int i = 0; i < str.Length; i += 2)
+ {
+ bytes[i / 2] = byte.Parse(str.Substring(i, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
+ }
+
+ return bytes;
+ }
+
+ public static string ToHexString(byte[] bytes)
+ => BitConverter.ToString(bytes).Replace("-", "");
+ }
+}
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index cb7343440..2248e9c85 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -75,10 +75,10 @@ namespace MediaBrowser.Common
/// <summary>
/// Gets the exports.
/// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="manageLiftime">if set to <c>true</c> [manage liftime].</param>
- /// <returns>IEnumerable{``0}.</returns>
- IEnumerable<T> GetExports<T>(bool manageLifetime = true);
+ /// <typeparam name="T">The type.</typeparam>
+ /// <param name="manageLifetime">If set to <c>true</c> [manage lifetime].</param>
+ /// <returns><see cref="IReadOnlyCollection{T}" />.</returns>
+ IReadOnlyCollection<T> GetExports<T>(bool manageLifetime = true);
/// <summary>
/// Resolves this instance.
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index 05b48a2a1..91ab066f9 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -23,6 +23,12 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <!-- We need at least C# 7.1 for the "default literal" feature-->
+ <LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>
diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs
index 76bd35e57..94b972a02 100644
--- a/MediaBrowser.Common/Net/HttpRequestOptions.cs
+++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs
@@ -64,12 +64,6 @@ namespace MediaBrowser.Common.Net
set => RequestHeaders[HeaderNames.Host] = value;
}
- /// <summary>
- /// Gets or sets the progress.
- /// </summary>
- /// <value>The progress.</value>
- public IProgress<double> Progress { get; set; }
-
public Dictionary<string, string> RequestHeaders { get; private set; }
public string RequestContentType { get; set; }
@@ -79,10 +73,6 @@ namespace MediaBrowser.Common.Net
public bool BufferContent { get; set; }
- public bool LogRequest { get; set; }
- public bool LogRequestAsDebug { get; set; }
- public bool LogErrors { get; set; }
-
public bool LogErrorResponseBody { get; set; }
public bool EnableKeepAlive { get; set; }
@@ -105,8 +95,6 @@ namespace MediaBrowser.Common.Net
{
RequestHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- LogRequest = true;
- LogErrors = true;
CacheMode = CacheMode.None;
DecompressionMethod = CompressionMethod.Deflate;
}
diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs
index db69c6f2c..d84a4d664 100644
--- a/MediaBrowser.Common/Net/IHttpClient.cs
+++ b/MediaBrowser.Common/Net/IHttpClient.cs
@@ -47,21 +47,5 @@ namespace MediaBrowser.Common.Net
/// <param name="options">The options.</param>
/// <returns>Task{HttpResponseInfo}.</returns>
Task<HttpResponseInfo> Post(HttpRequestOptions options);
-
- /// <summary>
- /// Downloads the contents of a given url into a temporary location
- /// </summary>
- /// <param name="options">The options.</param>
- /// <returns>Task{System.String}.</returns>
- /// <exception cref="System.ArgumentNullException">progress</exception>
- /// <exception cref="Model.Net.HttpException"></exception>
- Task<string> GetTempFile(HttpRequestOptions options);
-
- /// <summary>
- /// Gets the temporary file response.
- /// </summary>
- /// <param name="options">The options.</param>
- /// <returns>Task{HttpResponseInfo}.</returns>
- Task<HttpResponseInfo> GetTempFileResponse(HttpRequestOptions options);
}
}
diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs
index a263be35f..88ac7e473 100644
--- a/MediaBrowser.Common/Updates/IInstallationManager.cs
+++ b/MediaBrowser.Common/Updates/IInstallationManager.cs
@@ -16,11 +16,6 @@ namespace MediaBrowser.Common.Updates
event EventHandler<InstallationEventArgs> PackageInstallationCancelled;
/// <summary>
- /// The current installations
- /// </summary>
- List<Tuple<InstallationInfo, CancellationTokenSource>> CurrentInstallations { get; set; }
-
- /// <summary>
/// The completed installations
/// </summary>
IEnumerable<InstallationInfo> CompletedInstallations { get; }
@@ -33,7 +28,7 @@ namespace MediaBrowser.Common.Updates
/// <summary>
/// Occurs when [plugin updated].
/// </summary>
- event EventHandler<GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>>> PluginUpdated;
+ event EventHandler<GenericEventArgs<(IPlugin, PackageVersionInfo)>> PluginUpdated;
/// <summary>
/// Occurs when [plugin updated].
@@ -102,12 +97,9 @@ namespace MediaBrowser.Common.Updates
/// Installs the package.
/// </summary>
/// <param name="package">The package.</param>
- /// <param name="isPlugin">if set to <c>true</c> [is plugin].</param>
- /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- /// <exception cref="ArgumentNullException">package</exception>
- Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken);
+ /// <returns><see cref="Task" />.</returns>
+ Task InstallPackage(PackageVersionInfo package, CancellationToken cancellationToken = default);
/// <summary>
/// Uninstalls a plugin
@@ -115,5 +107,12 @@ namespace MediaBrowser.Common.Updates
/// <param name="plugin">The plugin.</param>
/// <exception cref="ArgumentException"></exception>
void UninstallPlugin(IPlugin plugin);
+
+ /// <summary>
+ /// Cancels the installation
+ /// </summary>
+ /// <param name="id">The id of the package that is being installed</param>
+ /// <returns>Returns true if the install was cancelled</returns>
+ bool CancelInstallation(Guid id);
}
}