diff --git a/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj b/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj index 6361ed2..88eea93 100644 --- a/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj +++ b/ICSharpCode.AvalonEdit.Sample/ICSharpCode.AvalonEdit.Sample.csproj @@ -4,7 +4,7 @@ netcoreapp3.0;net40;net45 true true - TRACE;DOTNET4 + TRACE true ..\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.snk AvalonEdit.Sample @@ -14,13 +14,13 @@ false - TRACE;DOTNET4 + TRACE - TRACE;DOTNET4 + TRACE - TRACE;DOTNET4 + TRACE diff --git a/ICSharpCode.AvalonEdit.Sample/Window1.xaml.cs b/ICSharpCode.AvalonEdit.Sample/Window1.xaml.cs index 9440b08..0fba481 100644 --- a/ICSharpCode.AvalonEdit.Sample/Window1.xaml.cs +++ b/ICSharpCode.AvalonEdit.Sample/Window1.xaml.cs @@ -56,9 +56,9 @@ namespace ICSharpCode.AvalonEdit.Sample InitializeComponent(); - #if DOTNET4 + this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display); - #endif + propertyGridComboBox.SelectedIndex = 2; //textEditor.TextArea.SelectionBorder = null; diff --git a/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj b/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj index ef223e9..ef35611 100644 --- a/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj +++ b/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj @@ -4,7 +4,7 @@ net40;net45 true true - TRACE;DOTNET4 + TRACE true ..\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.snk ic#code @@ -13,13 +13,13 @@ false - TRACE;DOTNET4 + TRACE - TRACE;DOTNET4 + TRACE - TRACE;DOTNET4 + TRACE diff --git a/ICSharpCode.AvalonEdit/Editing/TextArea.cs b/ICSharpCode.AvalonEdit/Editing/TextArea.cs index c7a1b6a..ebe5dcc 100644 --- a/ICSharpCode.AvalonEdit/Editing/TextArea.cs +++ b/ICSharpCode.AvalonEdit/Editing/TextArea.cs @@ -1045,11 +1045,9 @@ namespace ICSharpCode.AvalonEdit.Editing this.MouseEnter += delegate { ShowMouseCursor(); }; this.MouseLeave += delegate { ShowMouseCursor(); }; this.PreviewMouseMove += delegate { ShowMouseCursor(); }; - #if DOTNET4 this.TouchEnter += delegate { ShowMouseCursor(); }; this.TouchLeave += delegate { ShowMouseCursor(); }; this.PreviewTouchMove += delegate { ShowMouseCursor(); }; - #endif } void ShowMouseCursor() diff --git a/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs b/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs index 6dfb652..e019db9 100644 --- a/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs +++ b/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs @@ -155,11 +155,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting /// /// Serializes this HighlightingColor instance. /// - #if DOTNET4 [System.Security.SecurityCritical] - #else - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] - #endif public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs b/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs index 13c76c2..c3458a7 100644 --- a/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs +++ b/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs @@ -18,11 +18,7 @@ using System; using System.IO; -#if DOTNET4 using System.Net; -#else -using System.Web; -#endif namespace ICSharpCode.AvalonEdit.Highlighting { @@ -64,11 +60,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting if (color == null) throw new ArgumentNullException("color"); writer.Write(" style=\""); - #if DOTNET4 WebUtility.HtmlEncode(color.ToCss(), writer); - #else - HttpUtility.HtmlEncode(color.ToCss(), writer); - #endif writer.Write('"'); } diff --git a/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs b/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs index b29d452..25e1d9b 100644 --- a/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs +++ b/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs @@ -19,11 +19,7 @@ using System; using System.Collections.Generic; using System.IO; -#if DOTNET4 using System.Net; -#else -using System.Web; -#endif using System.Text; using System.Windows; using System.Windows.Media; @@ -136,11 +132,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting needIndentation = true; break; default: - #if DOTNET4 WebUtility.HtmlEncode(c.ToString(), htmlWriter); - #else - HttpUtility.HtmlEncode(c.ToString(), htmlWriter); - #endif break; } // If we just handled a space by setting hasSpace = true, @@ -181,11 +173,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting if (value.Length == 0) return; WriteIndentationAndSpace(); - #if DOTNET4 WebUtility.HtmlEncode(value, htmlWriter); - #else - HttpUtility.HtmlEncode(value, htmlWriter); - #endif } /// @@ -256,11 +244,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting public override void BeginHyperlinkSpan(Uri uri) { WriteIndentationAndSpace(); - #if DOTNET4 string link = WebUtility.HtmlEncode(uri.ToString()); - #else - string link = HttpUtility.HtmlEncode(uri.ToString()); - #endif htmlWriter.Write(""); endTagStack.Push(""); } diff --git a/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs b/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs index a696850..dbb1af5 100644 --- a/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs +++ b/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdColor.cs @@ -93,11 +93,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting.Xshd /// /// Serializes this XshdColor instance. /// - #if DOTNET4 [System.Security.SecurityCritical] - #else - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] - #endif public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) diff --git a/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index cb38966..2e9f89d 100644 --- a/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -4,7 +4,7 @@ netcoreapp3.0;net40;net45 true true - TRACE;DOTNET4 + TRACE true ICSharpCode.AvalonEdit.snk ICSharpCode.AvalonEdit.xml @@ -30,13 +30,13 @@ - TRACE;DOTNET4 + TRACE - TRACE;DOTNET4 + TRACE - TRACE;DOTNET4 + TRACE diff --git a/ICSharpCode.AvalonEdit/TextEditor.cs b/ICSharpCode.AvalonEdit/TextEditor.cs index 35fa951..3ef5e1d 100644 --- a/ICSharpCode.AvalonEdit/TextEditor.cs +++ b/ICSharpCode.AvalonEdit/TextEditor.cs @@ -77,12 +77,6 @@ namespace ICSharpCode.AvalonEdit SetCurrentValue(DocumentProperty, new TextDocument()); } - #if !DOTNET4 - void SetCurrentValue(DependencyProperty property, object value) - { - SetValue(property, value); - } - #endif #endregion /// diff --git a/ICSharpCode.AvalonEdit/Utils/TextFormatterFactory.cs b/ICSharpCode.AvalonEdit/Utils/TextFormatterFactory.cs index 96a662a..f92ad15 100644 --- a/ICSharpCode.AvalonEdit/Utils/TextFormatterFactory.cs +++ b/ICSharpCode.AvalonEdit/Utils/TextFormatterFactory.cs @@ -31,19 +31,6 @@ namespace ICSharpCode.AvalonEdit.Utils /// static class TextFormatterFactory { - #if !DOTNET4 - readonly static DependencyProperty TextFormattingModeProperty; - - static TextFormatterFactory() - { - Assembly presentationFramework = typeof(FrameworkElement).Assembly; - Type textOptionsType = presentationFramework.GetType("System.Windows.Media.TextOptions", false); - if (textOptionsType != null) { - TextFormattingModeProperty = textOptionsType.GetField("TextFormattingModeProperty").GetValue(null) as DependencyProperty; - } - } - #endif - /// /// Creates a using the formatting mode used by the specified owner object. /// @@ -51,21 +38,7 @@ namespace ICSharpCode.AvalonEdit.Utils { if (owner == null) throw new ArgumentNullException("owner"); - #if DOTNET4 return TextFormatter.Create(TextOptions.GetTextFormattingMode(owner)); - #else - if (TextFormattingModeProperty != null) { - object formattingMode = owner.GetValue(TextFormattingModeProperty); - return (TextFormatter)typeof(TextFormatter).InvokeMember( - "Create", - BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, - null, null, - new object[] { formattingMode }, - CultureInfo.InvariantCulture); - } else { - return TextFormatter.Create(); - } - #endif } /// @@ -74,11 +47,7 @@ namespace ICSharpCode.AvalonEdit.Utils /// public static bool PropertyChangeAffectsTextFormatter(DependencyProperty dp) { - #if DOTNET4 return dp == TextOptions.TextFormattingModeProperty; - #else - return dp == TextFormattingModeProperty && TextFormattingModeProperty != null; - #endif } /// @@ -102,7 +71,6 @@ namespace ICSharpCode.AvalonEdit.Utils emSize = TextBlock.GetFontSize(element); if (foreground == null) foreground = TextBlock.GetForeground(element); - #if DOTNET4 return new FormattedText( text, CultureInfo.CurrentCulture, @@ -113,31 +81,6 @@ namespace ICSharpCode.AvalonEdit.Utils null, TextOptions.GetTextFormattingMode(element) ); - #else - if (TextFormattingModeProperty != null) { - object formattingMode = element.GetValue(TextFormattingModeProperty); - return (FormattedText)Activator.CreateInstance( - typeof(FormattedText), - text, - CultureInfo.CurrentCulture, - FlowDirection.LeftToRight, - typeface, - emSize, - foreground, - null, - formattingMode - ); - } else { - return new FormattedText( - text, - CultureInfo.CurrentCulture, - FlowDirection.LeftToRight, - typeface, - emSize.Value, - foreground - ); - } - #endif } } }