Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

Refactor project settings for optimization and update Avalonia package versions; enhance drag-and-drop functionality in ProxyRulesWindow.

AnoF-Cyberf30591448dfe
diff --git a/Windows/gui/ProxyBridge.GUI.csproj b/Windows/gui/ProxyBridge.GUI.csproj
index ec23792..1e6c4fe 100644
--- a/Windows/gui/ProxyBridge.GUI.csproj
+++ b/Windows/gui/ProxyBridge.GUI.csproj
@@ -17,15 +17,19 @@
<Description>Universal proxy client for Windows applications</Description>
<NeutralLanguage>en-US</NeutralLanguage>
<PublishAot>true</PublishAot>
- <InvariantGlobalization>false</InvariantGlobalization>
- <PublishAot>true</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>
- <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
- <IlcGenerateDgmlFile>false</IlcGenerateDgmlFile>
+
+ <IlcOptimizationPreference>Size</IlcOptimizationPreference>
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
+ <IlcGenerateDgmlFile>false</IlcGenerateDgmlFile>
+ <StripSymbols>true</StripSymbols>
<EventSourceSupport>false</EventSourceSupport>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
+ <DebuggerSupport>false</DebuggerSupport>
+ <MetadataUpdaterSupport>false</MetadataUpdaterSupport>
+ <HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
+ <InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
@@ -51,10 +55,10 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Avalonia" Version="11.3.11" />
- <PackageReference Include="Avalonia.Desktop" Version="11.3.11" />
- <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.11" />
- <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.11" />
- <PackageReference Include="Avalonia.Diagnostics" Version="11.3.11" Condition="'$(Configuration)' == 'Debug'" />
+ <PackageReference Include="Avalonia" Version="12.0.5" />
+ <PackageReference Include="Avalonia.Desktop" Version="12.0.5" />
+ <PackageReference Include="Avalonia.Themes.Fluent" Version="12.0.5" />
+ <PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.5" />
+ <PackageReference Include="Avalonia.Diagnostics" Version="12.0.5" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
</Project>
diff --git a/Windows/gui/ViewModels/ViewModelBase.cs b/Windows/gui/ViewModels/ViewModelBase.cs
index 1bf657a..8e55ad6 100644
--- a/Windows/gui/ViewModels/ViewModelBase.cs
+++ b/Windows/gui/ViewModels/ViewModelBase.cs
@@ -1,4 +1,4 @@
-using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
@@ -15,7 +15,9 @@ public class ViewModelBase : INotifyPropertyChanged
protected bool SetProperty<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
- if (Equals(field, value)) return false;
+ // EqualityComparer<T>.Default avoids the boxing that object.Equals(field, value)
+ // incurs for value-typed properties (bool/int/enum) — this runs on every setter.
+ if (EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
OnPropertyChanged(propertyName);
return true;
diff --git a/Windows/gui/Views/MainWindow.axaml b/Windows/gui/Views/MainWindow.axaml
index e722661..ed5e5de 100644
--- a/Windows/gui/Views/MainWindow.axaml
+++ b/Windows/gui/Views/MainWindow.axaml
@@ -325,16 +325,28 @@
</Grid>
</Border>
- <!-- Connections Log -->
+ <!-- Connections Log (read-only display: SelectableTextBlock is far
+ lighter than an editable TextBox — no undo buffer/caret/input
+ machinery — while still allowing text selection + copy) -->
<ScrollViewer>
- <TextBox Text="{Binding FilteredConnectionsLog, Mode=OneWay}"
- IsReadOnly="True"
- AcceptsReturn="True"
- TextWrapping="Wrap"
- Background="Transparent"
- BorderThickness="0"
- Watermark="No active connections..."
- MinHeight="500"/>
+ <Panel MinHeight="500">
+ <SelectableTextBlock Text="{Binding FilteredConnectionsLog, Mode=OneWay}"
+ FontFamily="Consolas,Courier New"
+ FontSize="13"
+ Foreground="#FFD4D4D4"
+ SelectionBrush="#FF264F78"
+ TextWrapping="Wrap"
+ Padding="8"
+ VerticalAlignment="Top"/>
+ <TextBlock Text="No active connections..."
+ Foreground="#FF6A6A6A"
+ FontFamily="Consolas,Courier New"
+ FontSize="13"
+ Padding="8"
+ VerticalAlignment="Top"
+ IsHitTestVisible="False"
+ IsVisible="{Binding FilteredConnectionsLog, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
+ </Panel>
</ScrollViewer>
</DockPanel>
</Border>
@@ -361,15 +373,26 @@
</Grid>
</Border>
- <!-- Activity Log -->
+ <!-- Activity Log (read-only: SelectableTextBlock, see connections log) -->
<ScrollViewer>
- <TextBox Text="{Binding FilteredActivityLog, Mode=OneWay}"
- IsReadOnly="True"
- AcceptsReturn="True"
- TextWrapping="Wrap"
- Background="Transparent"
- BorderThickness="0"
- MinHeight="500"/>
+ <Panel MinHeight="500">
+ <SelectableTextBlock Text="{Binding FilteredActivityLog, Mode=OneWay}"
+ FontFamily="Consolas,Courier New"
+ FontSize="13"
+ Foreground="#FFD4D4D4"
+ SelectionBrush="#FF264F78"
+ TextWrapping="Wrap"
+ Padding="8"
+ VerticalAlignment="Top"/>
+ <TextBlock Text="No activity yet..."
+ Foreground="#FF6A6A6A"
+ FontFamily="Consolas,Courier New"
+ FontSize="13"
+ Padding="8"
+ VerticalAlignment="Top"
+ IsHitTestVisible="False"
+ IsVisible="{Binding FilteredActivityLog, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
+ </Panel>
</ScrollViewer>
</DockPanel>
</Border>
diff --git a/Windows/gui/Views/ProxyRulesWindow.axaml.cs b/Windows/gui/Views/ProxyRulesWindow.axaml.cs
index efae3c6..41211f7 100644
--- a/Windows/gui/Views/ProxyRulesWindow.axaml.cs
+++ b/Windows/gui/Views/ProxyRulesWindow.axaml.cs
@@ -123,29 +123,44 @@ public partial class ProxyRulesWindow : Window
}
}
+ // Holds the rule being dragged. This is an in-process, single-window reorder, so we
+ // keep the object in a field rather than serializing it into the drag payload —
+ // Avalonia 12's DataTransfer/DataFormat model is format-oriented (text/bytes/files)
+ // and doesn't carry arbitrary .NET objects. The DataTransfer below just initiates the
+ // drag; the actual payload is _draggedRule.
+ private ProxyRule? _draggedRule;
+
private async void Rule_PointerPressed(object? sender, PointerPressedEventArgs e)
{
if (sender is not Border border || border.DataContext is not ProxyRule rule)
return;
- var dragData = new DataObject();
- dragData.Set("DraggedRule", rule);
+ _draggedRule = rule;
+ try
+ {
+ var dragData = new DataTransfer();
+ dragData.Add(DataTransferItem.Create(DataFormat.Text, "rule"));
- var result = await DragDrop.DoDragDrop(e, dragData, DragDropEffects.Move);
+ var result = await DragDrop.DoDragDropAsync(e, dragData, DragDropEffects.Move);
- if (result == DragDropEffects.Move && DataContext is ProxyRulesViewModel vm)
- {
- // refsh indices after drag completes
- for (int i = 0; i < vm.ProxyRules.Count; i++)
+ if (result == DragDropEffects.Move && DataContext is ProxyRulesViewModel vm)
{
- vm.ProxyRules[i].Index = i + 1;
+ // refsh indices after drag completes
+ for (int i = 0; i < vm.ProxyRules.Count; i++)
+ {
+ vm.ProxyRules[i].Index = i + 1;
+ }
}
}
+ finally
+ {
+ _draggedRule = null;
+ }
}
private void Rules_DragOver(object? sender, DragEventArgs e)
{
- e.DragEffects = DragDropEffects.Move;
+ e.DragEffects = _draggedRule != null ? DragDropEffects.Move : DragDropEffects.None;
}
private void Rules_Drop(object? sender, DragEventArgs e)
@@ -153,7 +168,7 @@ public partial class ProxyRulesWindow : Window
if (DataContext is not ProxyRulesViewModel vm)
return;
- if (e.Data.Get("DraggedRule") is not ProxyRule draggedRule)
+ if (_draggedRule is not ProxyRule draggedRule)
return;
if (e.Source is Control control)