Skip to content

Commit 9073743

Browse files
committed
- bumps everything to net6 for supportability
Signed-off-by: Vincent Biret <[email protected]>
1 parent 336a7db commit 9073743

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

src/OoasGui/MainForm.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using Microsoft.OpenApi.Extensions;
1717
using Microsoft.OpenApi.Models;
1818
using Microsoft.OpenApi.OData;
19-
using System.Net;
2019
using System.Xml;
2120
using System.Threading.Tasks;
2221
using System.Net.Http;

src/OoasGui/OoasGui.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net5.0-windows</TargetFramework>
3+
<TargetFramework>net6.0-windows</TargetFramework>
44
<OutputType>WinExe</OutputType>
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
<UseWindowsForms>true</UseWindowsForms>

src/OoasUtil/OoasUtil.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

src/OoasUtil/UrlOpenApiGenerator.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
//---------------------------------------------------------------------
66

77
using System;
8-
using System.Net;
9-
using System.IO;
10-
using System.Text;
118
using System.Xml.Linq;
129
using Microsoft.OData.Edm;
1310
using Microsoft.OData.Edm.Csdl;
1411
using Microsoft.OpenApi;
1512
using Microsoft.OpenApi.OData;
13+
using System.Net.Http;
14+
using System.Threading.Tasks;
1615

1716
namespace OoasUtil
1817
{
@@ -44,20 +43,17 @@ public UrlOpenApiGenerator(Uri input, string output, OpenApiFormat format, OpenA
4443
/// </summary>
4544
protected override IEdmModel GetEdmModel()
4645
{
47-
Uri requestUri = new Uri(Input.OriginalString + "/$metadata");
46+
Uri requestUri = new (Input.OriginalString + "/$metadata");
4847

49-
WebRequest request = WebRequest.Create(requestUri);
50-
51-
WebResponse response = request.GetResponse();
52-
53-
Stream receivedStream = response.GetResponseStream();
54-
55-
StreamReader reader = new StreamReader(receivedStream, Encoding.UTF8);
56-
57-
string csdl = reader.ReadToEnd();
48+
string csdl = GetModelDocumentAsync(requestUri).GetAwaiter().GetResult();
5849

5950
return CsdlReader.Parse(XElement.Parse(csdl).CreateReader());
6051
}
52+
private async Task<string> GetModelDocumentAsync(Uri requestUri) {
53+
HttpResponseMessage response = await client.GetAsync(requestUri);
54+
return await response.Content.ReadAsStringAsync();
55+
}
56+
private static readonly HttpClient client = new ();
6157

6258
protected override void ModifySettings()
6359
{

tool/UpdateDocs/UpdateDocs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net5.0</TargetFramework>
3+
<TargetFramework>net6.0</TargetFramework>
44
<OutputType>Exe</OutputType>
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
</PropertyGroup>

0 commit comments

Comments
 (0)