Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove net462 TargetFramework as net462 is supported by netstandard2.0 #1118

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Source/DataTypes/SvgAspectRatioConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, System.Global
if (sParts.Length < 2)
throw new ArgumentOutOfRangeException("value is not a member of SvgPreserveAspectRatio");
}

#if Net4
if (!Enum.TryParse<SvgPreserveAspectRatio>(sParts[nAlignIndex], out eAlign))
throw new ArgumentOutOfRangeException("value is not a member of SvgPreserveAspectRatio");
#else
eAlign = (SvgPreserveAspectRatio)Enum.Parse(typeof(SvgPreserveAspectRatio), sParts[nAlignIndex]);
#endif

nAlignIndex++;

Expand Down
4 changes: 0 additions & 4 deletions Source/DataTypes/SvgUnitCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ public override string ToString()
// (e.g., 'M 100 100 L 200 200' contains unnecessary spaces and could be expressed more compactly as 'M100 100L200 200')."
// http://www.w3.org/TR/SVGTiny12/paths.html#PathDataGeneralInformation
// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Notes
#if Net4
return string.Join(" ", this.Select(u => u.ToString()));
#else
return string.Join(" ", this.Select(u => u.ToString()).ToArray());
#endif
}

public static bool IsNullOrEmpty(SvgUnitCollection collection)
Expand Down
19 changes: 2 additions & 17 deletions Source/Svg.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.1;netstandard2.0</TargetFrameworks>
<PackageLicenseExpression>MS-PL</PackageLicenseExpression>
<RootNamespace>Svg</RootNamespace>
<AssemblyName>Svg</AssemblyName>
Expand Down Expand Up @@ -49,21 +49,6 @@
<None Include="svg-logo-v.png" Pack="true" PackagePath="" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
<Title>Svg for .Net Framework 4.6.2</Title>
<DefineConstants>$(DefineConstants);NETFULL;Net4</DefineConstants>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
Expand All @@ -72,7 +57,7 @@
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net462'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>

Expand Down
74 changes: 0 additions & 74 deletions Source/SvgElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,8 @@ private Dictionary<string, string> WritePropertyAttributes(XmlWriter writer)
opacityValues.Add(property.AttributeName + "-opacity", opacity);
}
}

#if NETFULL
var value = (string)property.Converter.ConvertTo(propertyValue, typeof(string));
#else
// dotnetcore throws exception if input is null
var value = propertyValue == null ? null : (string)property.Converter.ConvertTo(propertyValue, typeof(string));
#endif

if (propertyValue != null)
{
Expand Down Expand Up @@ -912,50 +907,6 @@ protected void OnContentChanged(ContentEventArgs args)
onmouseout = "<anything>"
*/

#if Net4
/// <summary>
/// Use this method to provide your implementation ISvgEventCaller which can register Actions
/// and call them if one of the events occurs. Make sure, that your SvgElement has a unique ID.
/// The SvgTextElement overwrites this and regsiters the Change event tor its text content.
/// </summary>
/// <param name="caller"></param>
public virtual void RegisterEvents(ISvgEventCaller caller)
{
if (caller != null && !string.IsNullOrEmpty(this.ID))
{
var rpcID = this.ID + "/";

caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onclick", CreateMouseEventAction(RaiseMouseClick));
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmousedown", CreateMouseEventAction(RaiseMouseDown));
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseup", CreateMouseEventAction(RaiseMouseUp));
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmousemove", CreateMouseEventAction(RaiseMouseMove));
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseover", CreateMouseEventAction(RaiseMouseOver));
caller.RegisterAction<float, float, int, int, bool, bool, bool, string>(rpcID + "onmouseout", CreateMouseEventAction(RaiseMouseOut));
caller.RegisterAction<int, bool, bool, bool, string>(rpcID + "onmousescroll", OnMouseScroll);
}
}

/// <summary>
/// Use this method to provide your implementation ISvgEventCaller to unregister Actions
/// </summary>
/// <param name="caller"></param>
public virtual void UnregisterEvents(ISvgEventCaller caller)
{
if (caller != null && !string.IsNullOrEmpty(this.ID))
{
var rpcID = this.ID + "/";

caller.UnregisterAction(rpcID + "onclick");
caller.UnregisterAction(rpcID + "onmousedown");
caller.UnregisterAction(rpcID + "onmouseup");
caller.UnregisterAction(rpcID + "onmousemove");
caller.UnregisterAction(rpcID + "onmousescroll");
caller.UnregisterAction(rpcID + "onmouseover");
caller.UnregisterAction(rpcID + "onmouseout");
}
}
#endif

[SvgAttribute("onclick")]
public event EventHandler<MouseArg> Click;

Expand All @@ -977,14 +928,6 @@ public virtual void UnregisterEvents(ISvgEventCaller caller)
[SvgAttribute("onmouseout")]
public event EventHandler<MouseArg> MouseOut;

#if Net4
protected Action<float, float, int, int, bool, bool, bool, string> CreateMouseEventAction(Action<object, MouseArg> eventRaiser)
{
return (x, y, button, clickCount, altKey, shiftKey, ctrlKey, sessionID) =>
eventRaiser(this, new MouseArg { x = x, y = y, Button = button, ClickCount = clickCount, AltKey = altKey, ShiftKey = shiftKey, CtrlKey = ctrlKey, SessionID = sessionID });
}
#endif

//click
protected void RaiseMouseClick(object sender, MouseArg e)
{
Expand Down Expand Up @@ -1093,23 +1036,6 @@ public class ChildAddedEventArgs : SVGArg
public SvgElement BeforeSibling;
}

#if Net4
//deriving class registers event actions and calls the actions if the event occurs
public interface ISvgEventCaller
{
void RegisterAction(string rpcID, Action action);
void RegisterAction<T1>(string rpcID, Action<T1> action);
void RegisterAction<T1, T2>(string rpcID, Action<T1, T2> action);
void RegisterAction<T1, T2, T3>(string rpcID, Action<T1, T2, T3> action);
void RegisterAction<T1, T2, T3, T4>(string rpcID, Action<T1, T2, T3, T4> action);
void RegisterAction<T1, T2, T3, T4, T5>(string rpcID, Action<T1, T2, T3, T4, T5> action);
void RegisterAction<T1, T2, T3, T4, T5, T6>(string rpcID, Action<T1, T2, T3, T4, T5, T6> action);
void RegisterAction<T1, T2, T3, T4, T5, T6, T7>(string rpcID, Action<T1, T2, T3, T4, T5, T6, T7> action);
void RegisterAction<T1, T2, T3, T4, T5, T6, T7, T8>(string rpcID, Action<T1, T2, T3, T4, T5, T6, T7, T8> action);
void UnregisterAction(string rpcID);
}
#endif

/// <summary>
/// Represents the state of the mouse at the moment the event occured.
/// </summary>
Expand Down
20 changes: 0 additions & 20 deletions Source/Text/SvgTextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,26 +287,6 @@ protected void RaiseChange(object sender, StringArg s)
}
}

#if Net4
public override void RegisterEvents(ISvgEventCaller caller)
{
//register basic events
base.RegisterEvents(caller);

//add change event for text
caller.RegisterAction<string, string>(this.ID + "/onchange", OnChange);
}

public override void UnregisterEvents(ISvgEventCaller caller)
{
//unregister base events
base.UnregisterEvents(caller);

//unregister change event
caller.UnregisterAction(this.ID + "/onchange");
}
#endif

public override SvgElement DeepCopy<T>()
{
var newObj = base.DeepCopy<T>() as SvgTextBase;
Expand Down
Loading
Loading