Skip to content

Commit 9274a09

Browse files
committed
2 parents cf6ece3 + c40247b commit 9274a09

File tree

5 files changed

+19
-29
lines changed

5 files changed

+19
-29
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,7 @@ jobs:
4848
run: dotnet test
4949
working-directory: Source/${{ env.SOLUTION_DIR }}
5050

51-
- name: Publish (Linux)
52-
if: runner.os == 'Linux'
53-
run: dotnet publish ${{ env.PROJECT }} -c Release -o ${{matrix.OUTPUTDIR}} -r ${{matrix.RUNTIMEID}}
54-
working-directory: Source/${{ env.SOLUTION_DIR }}
55-
56-
- name: Publish (Windows)
57-
if: runner.os == 'Windows'
51+
- name: Publish
5852
run: dotnet publish ${{ env.PROJECT }} -c Release -o ${{matrix.OUTPUTDIR}} -p:PublishReadyToRun=true --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:UseAppHost=true -r ${{matrix.RUNTIMEID}}
5953
working-directory: Source/${{ env.SOLUTION_DIR }}
6054

Source/VisualPairCoding/VisualPairCoding.AvaloniaUI/EnterNamesWindow.axaml.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private void OnActivated(object? sender, EventArgs e)
3232
if (_autostart)
3333
{
3434
RoutedEventArgs? args = e as RoutedEventArgs;
35-
this.StartForm(sender, args);
35+
this.StartForm(sender, args!);
3636
}
3737
}
3838

@@ -68,7 +68,7 @@ public async void StartForm(object? sender, RoutedEventArgs args)
6868
sessionForm.Hide();
6969

7070
var tcs = new TaskCompletionSource<object>();
71-
sessionForm.Closed += (s, e) => tcs.SetResult(null);
71+
sessionForm.Closed += (s, e) => tcs.SetResult(null!);
7272
sessionForm.Show();
7373
await tcs.Task;
7474
}
@@ -154,7 +154,7 @@ private void RandomizeParticipants(object? sender, RoutedEventArgs args)
154154
}
155155

156156

157-
private static Random random = new();
157+
private static readonly Random random = new();
158158

159159
public static void Shuffle<T>(IList<T> list)
160160
{
@@ -163,9 +163,7 @@ public static void Shuffle<T>(IList<T> list)
163163
{
164164
n--;
165165
int k = random.Next(n + 1);
166-
T value = list[k];
167-
list[k] = list[n];
168-
list[n] = value;
166+
(list[n], list[k]) = (list[k], list[n]);
169167
}
170168
}
171169

@@ -194,7 +192,7 @@ private List<string> GetParticipants()
194192

195193
public async void LoadSessionConfiguration(object? sender, RoutedEventArgs args)
196194
{
197-
OpenFileDialog openFileDialog = new OpenFileDialog
195+
OpenFileDialog openFileDialog = new()
198196
{
199197
Title = "Open VPC Session",
200198
Filters = new List<FileDialogFilter>
@@ -226,7 +224,7 @@ public async void SaveSessionConfiguration(object? sender, RoutedEventArgs args)
226224
var participants = GetParticipants();
227225

228226

229-
SaveFileDialog saveFileDialog = new SaveFileDialog();
227+
SaveFileDialog saveFileDialog = new();
230228
saveFileDialog.Filters?.Add(new FileDialogFilter { Name = "VPC Session", Extensions = { "vpcsession" } });
231229
saveFileDialog.InitialFileName = string.Join("_", participants);
232230

Source/VisualPairCoding/VisualPairCoding.AvaloniaUI/RunSessionForm.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private async void ChooseAnotherPairAndStartNewTurn()
133133
);
134134

135135
var tcs = new TaskCompletionSource<object>();
136-
form.Closed += (s, e) => tcs.SetResult(null);
136+
form.Closed += (s, e) => tcs.SetResult(null!);
137137

138138
form.Show();
139139
form.Topmost = true;

Source/VisualPairCoding/VisualPairCoding.AvaloniaUI/VisualPairCoding.AvaloniaUI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<OutputType>Exe</OutputType>
3+
<OutputType>WinExe</OutputType>
44
<TargetFramework>net7.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<!--Avalonia doesen't support TrimMode=link currently,but we are working on that https://github.com/AvaloniaUI/Avalonia/issues/6892 -->
77
<TrimMode>copyused</TrimMode>
8-
<BuiltInComInteropSupport>false</BuiltInComInteropSupport>
8+
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
99
<SelfContained>true</SelfContained>
1010
<PublishSingleFile>true</PublishSingleFile>
1111
</PropertyGroup>
@@ -29,7 +29,7 @@
2929
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
3030
</ItemGroup>
3131
<ItemGroup>
32-
<ProjectReference Include="..\VisualPairCoding.BL.Tests\VisualPairCoding.BL.Tests.csproj" />
32+
<!--<ProjectReference Include="..\VisualPairCoding.BL.Tests\VisualPairCoding.BL.Tests.csproj" />-->
3333
<ProjectReference Include="..\VisualPairCoding.BL\VisualPairCoding.BL.csproj" />
3434
<ProjectReference Include="..\VisualPairCoding.Infrastructure\VisualPairCoding.Infrastructure.csproj" />
3535
<ProjectReference Include="..\VisualPairCoding.Interfaces\VisualPairCoding.Interfaces.csproj" />

Source/VisualPairCoding/VisualPairCoding.Infrastructure/AutoUpdater.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,25 @@ public AutoUpdater(
2323

2424
public GithubAPIResponse[] GetReleaseList()
2525
{
26-
using (var client = new HttpClient())
27-
{
28-
var webRequest = new HttpRequestMessage(HttpMethod.Get, _githubUrl);
29-
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");
26+
using var client = new HttpClient();
27+
var webRequest = new HttpRequestMessage(HttpMethod.Get, _githubUrl);
28+
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0");
3029

31-
var response = client.Send(webRequest);
30+
var response = client.Send(webRequest);
3231

33-
string result = response.Content.ReadAsStringAsync().Result.Trim();
32+
string result = response.Content.ReadAsStringAsync().Result.Trim();
3433

35-
GithubAPIResponse[] releases = JsonConvert.DeserializeObject<GithubAPIResponse[]>(result);
34+
GithubAPIResponse[] releases = JsonConvert.DeserializeObject<GithubAPIResponse[]>(result)!;
3635

37-
return releases;
38-
}
36+
return releases!;
3937
}
4038

4139

4240
public void Update()
4341
{
4442
GithubAPIResponse[] releases = GetReleaseList();
4543

46-
using (WebClient downloadClient = new WebClient())
44+
using (WebClient downloadClient = new())
4745
{
4846
downloadClient.DownloadFile(releases[0].Assets[0].Browser_download_url, releases[0].Assets[0].Name);
4947
}

0 commit comments

Comments
 (0)