Skip to content

Commit

Permalink
Upgrade to ,NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
aelij committed Nov 12, 2021
1 parent a0849f2 commit 4179a65
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 31 deletions.
12 changes: 7 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
</PropertyGroup>
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<DefaultTargetFramework>net5.0</DefaultTargetFramework>
<DefaultTargetFramework>net6.0</DefaultTargetFramework>
<TargetFrameworks Condition=" $(MSBuildProjectName.EndsWith('Windows')) ">$(DefaultTargetFramework)-windows;net48</TargetFrameworks>
<TargetFramework Condition=" '$(TargetFrameworks)' == '' and $(MSBuildProjectName.Contains('Windows')) ">$(DefaultTargetFramework)-windows</TargetFramework>
<TargetFramework Condition=" '$(TargetFramework)' == '' and '$(TargetFrameworks)' == '' ">$(DefaultTargetFramework)</TargetFramework>
<Features>strict</Features>
<Deterministic>True</Deterministic>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<EditorPackageVersion>1.3.0</EditorPackageVersion>
<RoslynPackageVersion>4.0.0-6.final</RoslynPackageVersion>
<RoslynAssemblyVersion>4.0.0.0</RoslynAssemblyVersion>
<AvaloniaVersion>0.10.7</AvaloniaVersion>
<DotNetVersion>[5.0.*,5.0.10]</DotNetVersion>
<RoslynPackageVersion>4.0.1</RoslynPackageVersion>
<RoslynAssemblyVersion>4.0.1.0</RoslynAssemblyVersion>
<AvaloniaVersion>0.10.10</AvaloniaVersion>
<AvaloniaEditVersion>0.10.9</AvaloniaEditVersion>
<DotNetVersion>[6.0.*,6.0.0]</DotNetVersion>
<RxVersion>5.0.0</RxVersion>
<LangVersion>9.0</LangVersion>
<Nullable>Enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Open `src\RoslynPad.sln` in Visual Studio 2019.

## Running the cross-platform .NET Core Avalonia version (on Mac or Linux)

* Install .NET Core SDK 5.0
* Install .NET Core SDK 6.0
* Download and unzip `RoslynPadNetCore.zip`.
* Run `dotnet RoslynPad.dll`

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "5.0.402"
"version": "6.0.100"
}
}
3 changes: 3 additions & 0 deletions src/RoslynPad.Avalonia/DocumentView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
IsEnabled="{Binding IsRunning}" />
<DropDown Items="{Binding AvailablePlatforms, Mode=OneTime}"
SelectedItem="{Binding Platform}" />
<Button Content="{DynamicResource SetPlatform}"
ToolTip.Tip="Set platform as default"
Command="{Binding SetDefaultPlatformCommand, Mode=OneTime}" />
<Separator />
<Button Command="{Binding SaveCommand, Mode=OneTime}"
ToolTip.Tip="Save (Ctrl+S)"
Expand Down
8 changes: 4 additions & 4 deletions src/RoslynPad.Avalonia/OpenFileDialogAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ public UI.FileDialogFilter Filter

public string InitialDirectory
{
get => _dialog.Directory;
get => _dialog.Directory ?? string.Empty;
set => _dialog.Directory = value;
}

public string FileName
{
get => _dialog.InitialFileName;
get => _dialog.InitialFileName ?? string.Empty;
set => _dialog.InitialFileName = value;
}

public Task<string[]?> ShowAsync()
{
var active = (Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.Windows.First(w => w.IsActive);
return _dialog.ShowAsync(active);
return _dialog.ShowAsync(active!);
}
}
}
}
24 changes: 24 additions & 0 deletions src/RoslynPad.Avalonia/Resources/Icons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,28 @@
Geometry="F1M7,14L5,14 5,10 7,10z M5.525,8.521C5.775,8.021 5.915,8.043 6.033,8.065 6.254,8.102 6.403,8.312 6.366,8.533 6.359,8.574 6.338,8.696 6.116,8.847 6.054,8.89 5.958,8.944 5.854,9L5.307,9C5.405,8.78,5.491,8.589,5.525,8.521 M4,14L2,14 2,10 4,10z M2.967,8.065C3.086,8.043 3.225,8.021 3.476,8.522 3.51,8.589 3.595,8.78 3.694,9L3.146,9C3.043,8.944 2.947,8.89 2.885,8.848 2.662,8.696 2.641,8.574 2.634,8.532 2.597,8.312 2.746,8.102 2.967,8.065 M7.232,8.68C7.35,7.982 6.878,7.317 6.181,7.199 5.272,7.052 4.889,7.832 4.741,8.126 4.704,8.2 4.609,8.41 4.5,8.653 4.391,8.41 4.296,8.2 4.26,8.128 4.112,7.832 3.73,7.051 2.819,7.199 2.122,7.317 1.65,7.982 1.768,8.679 1.788,8.792 1.831,8.897 1.881,9L1,9 1,15 8,15 8,9 7.119,9C7.17,8.898,7.212,8.793,7.232,8.68" />
</DrawingGroup.Children>
</DrawingGroup>
<DrawingGroup x:Key="SetPlatform">
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF"
Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6"
Geometry="F1M0.5859,-0.000199999999999534L2.5859,1.9998 -9.9999999999989E-05,1.9998 -9.9999999999989E-05,5.9998 1.0249,5.9998 1.0249,7.5608 0.5859,7.9998 1.0249,7.9998 1.0249,11.4898 8.1819,15.9998 8.6689,15.9998 14.8809,11.4448 14.8809,3.4588 8.5979,0.1438 7.5559,0.1438 6.2289,0.8148 5.4139,-0.000199999999999534z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M13,10.5088L8.973,13.4098 8.973,7.9998 13,5.3648z M8.078,0.9998L6.973,1.5588 7.65,2.2368 8.006,2.0558 12.805,4.4198 8.329,7.1068 7.042,6.3728 6.365,7.0498 8.006,7.9658 8.006,13.5498 7.966,13.5758 7.966,13.5998 7.953,13.5878 7.939,13.5998 7.939,13.5758 2.992,10.3508 2.992,7.9998 2.025,7.9998 2.025,10.9388 8.401,14.9558 13.881,10.9388 13.881,4.0618z" />
<GeometryDrawing Brush="#FF00529C"
Geometry="F1M5,5L1,5 1,3 5,3 3,1 5,1 8,4 5,7 3,7z" />
<GeometryDrawing Brush="#FFF0EFF1"
Geometry="F1M13,10.5088L8.973,13.4098 8.973,7.9998 13,5.3648z" />
<GeometryDrawing Brush="#FFF0EFF1"
Geometry="F1M8.0063,2.0557L7.6503,2.2367 9.4143,3.9997 7.0413,6.3727 8.3283,7.1067 12.8043,4.4197z" />
<GeometryDrawing Brush="#FFF0EFF1"
Geometry="F1M5.4141,8L2.9921,8 2.9921,10.351 7.9391,13.576 7.9391,13.6 7.9531,13.588 7.9661,13.6 7.9661,13.576 8.0061,13.55 8.0061,7.966 6.3651,7.049z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M9.0479,8.0405L9.0479,13.2635 12.9249,10.4705 12.9249,5.5035z M8.8979,13.5565L8.8979,7.9595 8.9319,7.9365 13.0749,5.2265 13.0749,10.5465z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M8.0059,1.9717L7.5949,2.1807 7.7069,2.2927 8.0069,2.1397 12.6489,4.4267 8.3279,7.0197 7.0969,6.3177 6.9869,6.4277 8.2919,7.1717 8.3299,7.1937 12.8439,4.4847 12.9609,4.4137z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M6.3096,7.1045L7.9316,8.0095 7.9316,13.4815 3.0666,10.3095 3.0666,8.0005 2.9166,8.0005 2.9166,10.3915 7.8656,13.6185 7.8776,13.7505 7.9526,13.6865 8.0416,13.7625 8.0416,13.6165 8.0816,13.5895 8.0816,7.9215 6.4196,6.9945z" />
</DrawingGroup.Children>
</DrawingGroup>
</ResourceDictionary>
6 changes: 3 additions & 3 deletions src/RoslynPad.Avalonia/SaveFileDialogAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ public UI.FileDialogFilter Filter

public string DefaultExt
{
get => _dialog.DefaultExtension;
get => _dialog.DefaultExtension ?? string.Empty;
set => _dialog.DefaultExtension = value;
}

public string FileName
{
get => _dialog.InitialFileName;
get => _dialog.InitialFileName ?? string.Empty;
set => _dialog.InitialFileName = value;
}

public Task<string?> ShowAsync()
{
var active = (Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.Windows.First(w => w.IsActive);
return _dialog.ShowAsync(active);
return _dialog.ShowAsync(active!);
}
}
}
3 changes: 1 addition & 2 deletions src/RoslynPad.Common.UI/RoslynPad.Common.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem.Watcher" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="System.Reactive.Core" Version="$(DotnetVersion)" />
<PackageReference Include="Microsoft.Win32.Registry" Version="$(DotnetVersion)" />
<PackageReference Include="System.Reactive.Core" Version="$(RxVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(DotnetVersion)" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions src/RoslynPad.Common.UI/Services/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ internal class ApplicationSettings : IApplicationSettings
WriteIndented = true,
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};

private readonly ITelemetryProvider? _telemetryProvider;
Expand Down Expand Up @@ -85,7 +86,7 @@ private void LoadSettings(string path)
try
{
var json = File.ReadAllText(path);
_values = JsonSerializer.Deserialize<SerializableValues>(json) ?? new SerializableValues();
_values = JsonSerializer.Deserialize<SerializableValues>(json, s_serializerOptions) ?? new SerializableValues();
InitializeValues();
}
catch (Exception e)
Expand All @@ -101,9 +102,8 @@ private void SaveSettings()

try
{
using var writer = File.Create(_path);
using var jsonWriter = new Utf8JsonWriter(writer);
JsonSerializer.Serialize(jsonWriter, _values, s_serializerOptions);
using var stream = File.Create(_path);
JsonSerializer.Serialize(stream, _values, s_serializerOptions);
}
catch (Exception e)
{
Expand Down
11 changes: 10 additions & 1 deletion src/RoslynPad.Common.UI/ViewModels/OpenDocumentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class OpenDocumentViewModel : NotificationObject
public IEnumerable<IResultObject> Results => _results;

public IDelegateCommand ToggleLiveModeCommand { get; }
public IDelegateCommand SetDefaultPlatformCommand { get; }

public bool IsLiveMode
{
Expand Down Expand Up @@ -156,6 +157,7 @@ public OpenDocumentViewModel(IServiceProvider serviceProvider, MainViewModelBase
UncommentSelectionCommand = commands.CreateAsync(() => CommentUncommentSelectionAsync(CommentAction.Uncomment));
RenameSymbolCommand = commands.CreateAsync(RenameSymbolAsync);
ToggleLiveModeCommand = commands.Create(() => IsLiveMode = !IsLiveMode);
SetDefaultPlatformCommand = commands.Create(SetDefaultPlatform);

ILText = DefaultILText;

Expand Down Expand Up @@ -183,6 +185,13 @@ public OpenDocumentViewModel(IServiceProvider serviceProvider, MainViewModelBase
InitializePlatforms();
}

private void SetDefaultPlatform()
{
if (Platform != null)
{
MainViewModel.Settings.DefaultPlatformName = Platform.ToString();
}
}
private void InitializePlatforms()
{
AvailablePlatforms = _platformsFactory.GetExecutionPlatforms().ToImmutableArray();
Expand Down Expand Up @@ -578,7 +587,7 @@ internal void Initialize(DocumentId documentId,
DocumentId = documentId;
_isInitialized = true;

Platform = AvailablePlatforms.FirstOrDefault(p => p.Name == MainViewModel.Settings.DefaultPlatformName) ??
Platform = AvailablePlatforms.FirstOrDefault(p => p.ToString() == MainViewModel.Settings.DefaultPlatformName) ??
AvailablePlatforms.FirstOrDefault();

UpdatePackages();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="0.10.4" />
<PackageReference Include="System.Reactive.Linq" Version="$(DotnetVersion)" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="$(AvaloniaEditVersion)" />
<PackageReference Include="System.Reactive.Linq" Version="$(RxVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RoslynPad.Roslyn.Avalonia\RoslynPad.Roslyn.Avalonia.csproj" />
Expand All @@ -26,4 +26,4 @@
<Link>Shared\%(RecursivePath)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AvalonEdit" Version="6.1.2.30" />
<PackageReference Include="System.Reactive.Linq" Version="$(DotnetVersion)" />
<PackageReference Include="System.Reactive.Linq" Version="$(RxVersion)" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\RoslynPad.Editor.Shared\**\*.cs">
Expand Down
17 changes: 12 additions & 5 deletions src/RoslynPad/DocumentView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</Menu>
<Grid Visibility="{Binding HasReportedProgress, Converter={StaticResource BooleanToVisibilityConverter}}"
Width="60"
Margin="5, 0" >
Margin="5, 0">
<ProgressBar Value="{Binding ReportedProgress, Mode=OneWay}"
Minimum="0.0"
Maximum="1.0" />
Expand All @@ -112,7 +112,11 @@
Content="{StaticResource Stop}"
IsEnabled="{Binding IsRunning}" />
<ComboBox ItemsSource="{Binding AvailablePlatforms, Mode=OneTime}"
SelectedItem="{Binding Platform}" />
SelectedItem="{Binding Platform}"
HorizontalContentAlignment="Stretch" />
<Button Content="{StaticResource SetPlatform}"
ToolTip="Set platform as default"
Command="{Binding SetDefaultPlatformCommand, Mode=OneTime}" />
<Separator />
<Button Command="{Binding SaveCommand, Mode=OneTime}"
ToolTip="Save (Ctrl+S)"
Expand Down Expand Up @@ -329,10 +333,13 @@
ContextMenuOpening="ResultTree_OnContextMenuOpening">
<FrameworkElement.Style>
<Style TargetType="controls:TreeListView">
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
Value="Hidden" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
Value="Auto" />
</Trigger>
</Style.Triggers>
</Style>
Expand Down
44 changes: 44 additions & 0 deletions src/RoslynPad/Resources/Icons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,48 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="Favorite">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF"
Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6"
Geometry="F1M7.2729,-0.000199999999999534L5.6649,4.9998 -9.99999999997669E-05,4.9998 -9.99999999997669E-05,6.5148 4.2109,9.5218 2.1279,15.9998 3.8809,15.9998 7.9999,12.3378 12.1199,15.9998 13.8719,15.9998 11.7899,9.5218 15.9999,6.5148 15.9999,4.9998 10.3369,4.9998 8.7289,-0.000199999999999534z" />
<GeometryDrawing Brush="Gold"
Geometry="F1M10.6143,9.1328L12.5003,14.9998 8.0003,10.9998 3.5003,14.9998 5.3863,9.1328 1.0003,5.9998 6.3933,5.9998 8.0013,0.9998 9.6073,5.9998 15.0003,5.9998z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="SetPlatform">
<DrawingImage.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF"
Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6"
Geometry="F1M0.5859,-0.000199999999999534L2.5859,1.9998 -9.9999999999989E-05,1.9998 -9.9999999999989E-05,5.9998 1.0249,5.9998 1.0249,7.5608 0.5859,7.9998 1.0249,7.9998 1.0249,11.4898 8.1819,15.9998 8.6689,15.9998 14.8809,11.4448 14.8809,3.4588 8.5979,0.1438 7.5559,0.1438 6.2289,0.8148 5.4139,-0.000199999999999534z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M13,10.5088L8.973,13.4098 8.973,7.9998 13,5.3648z M8.078,0.9998L6.973,1.5588 7.65,2.2368 8.006,2.0558 12.805,4.4198 8.329,7.1068 7.042,6.3728 6.365,7.0498 8.006,7.9658 8.006,13.5498 7.966,13.5758 7.966,13.5998 7.953,13.5878 7.939,13.5998 7.939,13.5758 2.992,10.3508 2.992,7.9998 2.025,7.9998 2.025,10.9388 8.401,14.9558 13.881,10.9388 13.881,4.0618z" />
<GeometryDrawing Brush="#FF00529C"
Geometry="F1M5,5L1,5 1,3 5,3 3,1 5,1 8,4 5,7 3,7z" />
<GeometryDrawing Brush="#FFF0EFF1"
Geometry="F1M13,10.5088L8.973,13.4098 8.973,7.9998 13,5.3648z" />
<GeometryDrawing Brush="#FFF0EFF1"
Geometry="F1M8.0063,2.0557L7.6503,2.2367 9.4143,3.9997 7.0413,6.3727 8.3283,7.1067 12.8043,4.4197z" />
<GeometryDrawing Brush="#FFF0EFF1"
Geometry="F1M5.4141,8L2.9921,8 2.9921,10.351 7.9391,13.576 7.9391,13.6 7.9531,13.588 7.9661,13.6 7.9661,13.576 8.0061,13.55 8.0061,7.966 6.3651,7.049z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M9.0479,8.0405L9.0479,13.2635 12.9249,10.4705 12.9249,5.5035z M8.8979,13.5565L8.8979,7.9595 8.9319,7.9365 13.0749,5.2265 13.0749,10.5465z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M8.0059,1.9717L7.5949,2.1807 7.7069,2.2927 8.0069,2.1397 12.6489,4.4267 8.3279,7.0197 7.0969,6.3177 6.9869,6.4277 8.2919,7.1717 8.3299,7.1937 12.8439,4.4847 12.9609,4.4137z" />
<GeometryDrawing Brush="#FF414141"
Geometry="F1M6.3096,7.1045L7.9316,8.0095 7.9316,13.4815 3.0666,10.3095 3.0666,8.0005 2.9166,8.0005 2.9166,10.3915 7.8656,13.6185 7.8776,13.7505 7.9526,13.6865 8.0416,13.7625 8.0416,13.6165 8.0816,13.5895 8.0816,7.9215 6.4196,6.9945z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>

</ResourceDictionary>

0 comments on commit 4179a65

Please sign in to comment.