Skip to content

Commit

Permalink
[Windows] Upgrade to .NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark committed Sep 2, 2023
1 parent c1ba533 commit eb4d9b0
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 208 deletions.
8 changes: 4 additions & 4 deletions windows/QMK Toolbox.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QMK Toolbox", "QMK Toolbox\QMK Toolbox.csproj", "{1F8BE719-CB0D-4A67-8422-B0C3A1B823F7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QMK Toolbox", "QMK Toolbox\QMK Toolbox.csproj", "{1F8BE719-CB0D-4A67-8422-B0C3A1B823F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion windows/QMK Toolbox/AboutBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public string AssemblyTitle
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
return System.IO.Path.GetFileNameWithoutExtension(path: Assembly.GetExecutingAssembly().Location);
}
}

Expand Down
3 changes: 0 additions & 3 deletions windows/QMK Toolbox/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
</configuration>
30 changes: 30 additions & 0 deletions windows/QMK Toolbox/FodyWeavers.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
Expand All @@ -43,6 +53,16 @@
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
Expand Down Expand Up @@ -73,6 +93,16 @@
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
Expand Down
2 changes: 1 addition & 1 deletion windows/QMK Toolbox/KeyTester/KeyTesterWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected override bool ProcessKeyMessage(ref Message m)
if (m.Msg == WM_KEYDOWN || m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYDOWN || m.Msg == WM_SYSKEYUP)
{
int vKey = m.WParam.ToInt32();
int scanCode = (m.LParam.ToInt32() >> 16) & 0x1FF;
int scanCode = (int)((m.LParam.ToInt64() >> 16) & 0x1FF);
KeyControl pressedKeyControl = GetKeyControlForKey(vKey, scanCode);

if (pressedKeyControl != null)
Expand Down
17 changes: 11 additions & 6 deletions windows/QMK Toolbox/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Permissions;
using System.Windows.Forms;

Expand Down Expand Up @@ -128,7 +130,6 @@ private void MainWindow_DragDrop(object sender, DragEventArgs e)
SetFilePath(((string[])e.Data.GetData(DataFormats.FileDrop, false)).First());
}

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override void WndProc(ref Message m)
{
if (m.Msg == NativeMethods.WmShowme)
Expand Down Expand Up @@ -432,19 +433,23 @@ private void LoadLocalFile(string path)
filepathBox.SelectedItem = path;
}

private void DownloadFile(string url)
private async void DownloadFile(string url)
{
logTextBox.LogInfo($"Downloading the file: {url}");

try
{
string destFile = Path.Combine(KnownFolders.Downloads.Path, url.Substring(url.LastIndexOf("/") + 1));
using (var wb = new WebClient())

var client = new HttpClient();
client.DefaultRequestHeaders.UserAgent.ParseAdd("QMK Toolbox");

var response = await client.GetAsync(url);
using (var fs = new FileStream(destFile, FileMode.CreateNew))
{
wb.Headers.Add("User-Agent", "QMK Toolbox");
wb.DownloadFile(url, destFile);
await response.Content.CopyToAsync(fs);
logTextBox.LogInfo($"File saved to: {destFile}");
}
logTextBox.LogInfo($"File saved to: {destFile}");

LoadLocalFile(destFile);
}
Expand Down
35 changes: 0 additions & 35 deletions windows/QMK Toolbox/Properties/AssemblyInfo.cs

This file was deleted.

4 changes: 2 additions & 2 deletions windows/QMK Toolbox/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eb4d9b0

Please sign in to comment.