Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Dropped support for .NET 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyVignelles committed Oct 18, 2019
1 parent 0acc0fd commit 45a353a
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@ namespace Vlc.DotNet.Core.Interops
{
public static class VlcMediaInstanceExtensions
{
#if NET20
public static VlcMediaInstance AddOptionToMedia(VlcMediaInstance mediaInstance, VlcManager manager, string option)
#else
public static VlcMediaInstance AddOptionToMedia(this VlcMediaInstance mediaInstance, VlcManager manager, string option)
#endif
{
manager.AddOptionToMedia(mediaInstance, option);
return mediaInstance;
}

#if NET20
public static VlcMediaInstance AddOptionToMedia(VlcMediaInstance mediaInstance, VlcManager manager, string[] option)
#else
public static VlcMediaInstance AddOptionToMedia(this VlcMediaInstance mediaInstance, VlcManager manager, string[] option)
#endif
{
manager.AddOptionToMedia(mediaInstance, option);
return mediaInstance;
Expand Down
6 changes: 3 additions & 3 deletions src/Vlc.DotNet.Core.Interops/MarshalHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class MarshalHelper
/// <returns>The converted structure</returns>
public static T PtrToStructure<T>(IntPtr ptr) where T: struct
{
#if NET20 || NET35 || NET40 || NET45
#if NET35 || NET40 || NET45
return (T)Marshal.PtrToStructure(ptr, typeof(T));
#else
return Marshal.PtrToStructure<T>(ptr);
Expand All @@ -31,7 +31,7 @@ public static T PtrToStructure<T>(IntPtr ptr) where T: struct
/// <returns>The number of bytes in the structure</returns>
public static int SizeOf<T>()
{
#if NET20 || NET35 || NET40 || NET45
#if NET35 || NET40 || NET45
return Marshal.SizeOf(typeof(T));
#else
return Marshal.SizeOf<T>();
Expand All @@ -46,7 +46,7 @@ public static int SizeOf<T>()
/// <returns>The delegate</returns>
public static T GetDelegateForFunctionPointer<T>(IntPtr ptr)
{
#if NET20 || NET35 || NET40 || NET45
#if NET35 || NET40 || NET45
return (T)(object)Marshal.GetDelegateForFunctionPointer(ptr, typeof(T));
#else
// The GetDelegateForFunctionPointer with two parameters is now deprecated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
#if !(NET20 || NET35)
#if !NET35
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
Expand All @@ -16,7 +16,7 @@ public sealed partial class VlcManager
private static readonly CallbackSeekMediaDelegate CallbackSeekMediaDelegate = CallbackSeekMedia;
private static readonly CallbackCloseMediaDelegate CallbackCloseMediaDelegate = CallbackCloseMedia;

#if NET20 || NET35
#if NET35
private static readonly Dictionary<IntPtr, StreamData> DicStreams = new Dictionary<IntPtr, StreamData>();
#else
private static readonly ConcurrentDictionary<IntPtr, StreamData> DicStreams = new ConcurrentDictionary<IntPtr, StreamData>();
Expand Down Expand Up @@ -159,7 +159,7 @@ private static IntPtr AddStream(Stream stream)

private static StreamData GetStream(IntPtr handle)
{
#if NET20 || NET35
#if NET35
lock (DicStreams)
{
if (!DicStreams.ContainsKey(handle))
Expand All @@ -183,7 +183,7 @@ private static StreamData GetStream(IntPtr handle)

private static void RemoveStream(IntPtr handle)
{
#if NET20 || NET35
#if NET35
lock (DicStreams)
{
if (DicStreams.ContainsKey(handle))
Expand Down
13 changes: 0 additions & 13 deletions src/Vlc.DotNet.Core/AudioOutputsManagement.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
#if !NET20
using System.Linq;
#endif
using Vlc.DotNet.Core.Interops;

namespace Vlc.DotNet.Core
Expand All @@ -22,18 +20,7 @@ public IEnumerable<AudioOutputDescription> All
{
get
{
#if NET20
var results = myManager.GetAudioOutputsDescriptions();
var resultsList = new List<AudioOutputDescription>(results.Count);
foreach(var x in results)
{
resultsList.Add(new AudioOutputDescription(x.Name, x.Description, this.myManager));
}

return resultsList;
#else
return myManager.GetAudioOutputsDescriptions().Select(x => new AudioOutputDescription(x.Name, x.Description, this.myManager));
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Vlc.DotNet.Core/DialogsManagement.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET20 && !NET35 && !NET40
#if !NET35 && !NET40
namespace Vlc.DotNet.Core
{
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/Vlc.DotNet.Core/IDialogsManagement.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET20 && !NET35 && !NET40
#if !NET35 && !NET40
namespace Vlc.DotNet.Core
{
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/Vlc.DotNet.Core/IVlcDialogManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET20 && !NET35 && !NET40
#if !NET35 && !NET40

namespace Vlc.DotNet.Core
{
Expand Down
2 changes: 1 addition & 1 deletion src/Vlc.DotNet.Core/Vlc.DotNet.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<Title>Vlc.DotNet.Core</Title>
<TargetFrameworks>net20;net35;net40;net45;netstandard2.0;netstandard1.3</TargetFrameworks>
<TargetFrameworks>net35;net40;net45;netstandard2.0;netstandard1.3</TargetFrameworks>
<Description>.Net API to use the audio/video capabilities of the VLC libraries.</Description>
<PackageTags>vlc media api</PackageTags>
</PropertyGroup>
Expand Down
16 changes: 0 additions & 16 deletions src/Vlc.DotNet.Core/VlcMedia/VlcMedia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,22 @@ public sealed partial class VlcMedia : IDisposable
private readonly VlcMediaPlayer myVlcMediaPlayer;

internal VlcMedia(VlcMediaPlayer player, FileInfo file, params string[] options)
#if NET20
: this(player, VlcMediaInstanceExtensions.AddOptionToMedia(player.Manager.CreateNewMediaFromPath(file.FullName), player.Manager, options))
#else
: this(player, player.Manager.CreateNewMediaFromPath(file.FullName).AddOptionToMedia(player.Manager, options))
#endif
{
}

internal VlcMedia(VlcMediaPlayer player, Uri uri, params string[] options)
#if NET20
: this(player, VlcMediaInstanceExtensions.AddOptionToMedia(player.Manager.CreateNewMediaFromLocation(uri.AbsoluteUri), player.Manager, options))
#else
: this(player, player.Manager.CreateNewMediaFromLocation(uri.AbsoluteUri).AddOptionToMedia(player.Manager, options))
#endif
{
}

internal VlcMedia(VlcMediaPlayer player, string mrl, params string[] options)
#if NET20
: this(player, VlcMediaInstanceExtensions.AddOptionToMedia(player.Manager.CreateNewMediaFromLocation(mrl), player.Manager, options))
#else
: this(player, player.Manager.CreateNewMediaFromLocation(mrl).AddOptionToMedia(player.Manager, options))
#endif
{
}

internal VlcMedia(VlcMediaPlayer player, Stream stream, params string[] options)
#if NET20
: this(player, VlcMediaInstanceExtensions.AddOptionToMedia(player.Manager.CreateNewMediaFromStream(stream), player.Manager, options))
#else
: this(player, player.Manager.CreateNewMediaFromStream(stream).AddOptionToMedia(player.Manager, options))
#endif
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Vlc.DotNet.Core/VlcMediaPlayer/VlcMediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public VlcMediaPlayer(VlcManager manager)
SubTitles = new SubTitlesManagement(manager, myMediaPlayerInstance);
Video = new VideoManagement(manager, myMediaPlayerInstance);
Audio = new AudioManagement(manager, myMediaPlayerInstance);
#if !NET20 && !NET35 && !NET40
#if !NET35 && !NET40
Dialogs = new DialogsManagement(manager, myMediaPlayerInstance);
#endif
}
Expand Down Expand Up @@ -315,7 +315,7 @@ public void Navigate(NavigateModes navigateMode)

public IAudioManagement Audio { get; }

#if !NET20 && !NET35 && !NET40
#if !NET35 && !NET40
public IDialogsManagement Dialogs { get; }
#endif

Expand Down

0 comments on commit 45a353a

Please sign in to comment.