This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82d89df
commit a02e671
Showing
44 changed files
with
122 additions
and
770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,79 @@ | ||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32; | ||
|
||
namespace Dionysus.App.Helpers; | ||
|
||
public class AppHelper | ||
{ | ||
|
||
[DllImport("user32.dll")] | ||
public static extern int SetWindowLong(IntPtr window, int index, int value); | ||
public const int GWL_EXSTYLE = -20; | ||
public const int WS_EX_TOOLWINDOW = 0x00000080; | ||
[DllImport("user32.dll")] | ||
public static extern int GetWindowLong(IntPtr window, int index); | ||
|
||
public static void HideFromAltTab(IntPtr windowHandle) | ||
{ | ||
SetWindowLong(windowHandle, GWL_EXSTYLE, | ||
GetWindowLong(windowHandle, GWL_EXSTYLE) | | ||
WS_EX_TOOLWINDOW); | ||
} | ||
|
||
public static void Logic(bool value) | ||
{ | ||
if (value) AddToStartup(); | ||
else RemoveFromStartup(); | ||
} | ||
|
||
static void AddToStartup() | ||
{ | ||
string appPath = Application.ExecutablePath; | ||
|
||
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey( | ||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); | ||
registryKey.SetValue("Dionysus", $"\"{appPath}\""); | ||
registryKey.Close(); | ||
} | ||
|
||
static void RemoveFromStartup() | ||
{ | ||
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey( | ||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); | ||
if (registryKey != null) | ||
{ | ||
registryKey.DeleteValue("Dionysus", false); | ||
registryKey.Close(); | ||
} | ||
} | ||
|
||
public static bool AddedToStartup() | ||
{ | ||
return (Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", | ||
true).GetValueNames().Contains("Dionysus")); | ||
} | ||
using System.Runtime.InteropServices; | ||
using Microsoft.Win32; | ||
|
||
namespace Dionysus.App.Helpers; | ||
|
||
public class AppHelper | ||
{ | ||
|
||
[DllImport("user32.dll")] | ||
public static extern int SetWindowLong(IntPtr window, int index, int value); | ||
public const int GWL_EXSTYLE = -20; | ||
public const int WS_EX_TOOLWINDOW = 0x00000080; | ||
[DllImport("user32.dll")] | ||
public static extern int GetWindowLong(IntPtr window, int index); | ||
|
||
public static void HideFromAltTab(IntPtr windowHandle) | ||
{ | ||
SetWindowLong(windowHandle, GWL_EXSTYLE, | ||
GetWindowLong(windowHandle, GWL_EXSTYLE) | | ||
WS_EX_TOOLWINDOW); | ||
} | ||
|
||
public static void Logic(bool value) | ||
{ | ||
if (value) AddToStartup(); | ||
else RemoveFromStartup(); | ||
} | ||
|
||
static void AddToStartup() | ||
{ | ||
string appPath = Application.ExecutablePath; | ||
|
||
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey( | ||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); | ||
registryKey.SetValue("Dionysus", $"\"{appPath}\""); | ||
registryKey.Close(); | ||
} | ||
|
||
static void RemoveFromStartup() | ||
{ | ||
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey( | ||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); | ||
if (registryKey != null) | ||
{ | ||
registryKey.DeleteValue("Dionysus", false); | ||
registryKey.Close(); | ||
} | ||
} | ||
|
||
public static bool AddedToStartup() | ||
{ | ||
return (Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", | ||
true).GetValueNames().Contains("Dionysus")); | ||
} | ||
|
||
public static async Task<(bool updNeed, string url)> NeedUpdate(string currentVersion) | ||
{ | ||
using var _httpClient = new HttpClient(); | ||
var _html = await _httpClient.GetStringAsync("https://github.com/blazor911/Dionysus/tags"); | ||
var _htmlDocument = new HtmlAgilityPack.HtmlDocument(); | ||
_htmlDocument.LoadHtml(_html); | ||
|
||
var versionNode = _htmlDocument.DocumentNode.SelectSingleNode("//h2/a[@href and contains(text(),'v')]"); | ||
|
||
if (versionNode != null) | ||
{ | ||
var latestVersion = versionNode.InnerText.Trim().Replace("v", ""); | ||
var latestVersionUrl = "https://github.com" + versionNode.Attributes["href"].Value; | ||
|
||
if (Version.TryParse(latestVersion, out var parsedLatestVersion) && | ||
Version.TryParse(currentVersion, out var parsedCurrentVersion)) | ||
{ | ||
bool needsUpdate = parsedLatestVersion > parsedCurrentVersion; | ||
return (needsUpdate, needsUpdate ? latestVersionUrl : string.Empty); | ||
} | ||
} | ||
return (false, string.Empty); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,7 +116,7 @@ a, .btn-link { | |
top: 7px; | ||
right: 7px; | ||
display: none; | ||
gap: 0.2rem; | ||
gap: 0.3rem; | ||
z-index: 2; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.App.AssemblyInfoInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
382009481810ed02f68b093cde34fd7b1b0327badd77e1148ca2e7cfaca9ec92 | ||
51d36010ba54091312e638ee54fb870e3ffc4fac525ef55a098d5350e9ea56d3 |
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.App.csproj.GenerateResource.cache
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.App.sourcelink.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"documents":{"D:\\C# projects\\Dionysus\\*":"https://raw.githubusercontent.com/blazor911/Dionysus/59a2b71f7e74d4f90b7e35e60f3a685574363650/*"}} | ||
{"documents":{"D:\\C# projects\\Dionysus\\*":"https://raw.githubusercontent.com/blazor911/Dionysus/82d89df58f2acfa0fc092c5fe16ad73145f6fd14/*"}} |
Binary file modified
BIN
+81 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.Localization.strings.de.resources
Binary file not shown.
Binary file modified
BIN
+75 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.Localization.strings.fr.resources
Binary file not shown.
Binary file modified
BIN
+76 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.Localization.strings.resources
Binary file not shown.
Binary file modified
BIN
+84 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/Dionysus.Localization.strings.uk.resources
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+512 Bytes
(110%)
src/Dionysus.App/obj/Debug/net8.0-windows/de/Dionysus.resources.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/fr/Dionysus.resources.dll
Binary file not shown.
Binary file modified
BIN
+512 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/ref/Dionysus.dll
Binary file not shown.
Binary file modified
BIN
+512 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/refint/Dionysus.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Debug/net8.0-windows/uk/Dionysus.resources.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/Dionysus.App.AssemblyInfoInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bfb108870cf0f229f3863e3c50c35875ae1b691f86a9a34fc7caaea986ab7586 | ||
547e0a8c358e495a6b24158170e109832d544c3ac7df2aee215d0073d532a99b |
2 changes: 1 addition & 1 deletion
2
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/Dionysus.App.sourcelink.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"documents":{"D:\\C# projects\\Dionysus\\*":"https://raw.githubusercontent.com/blazor911/Dionysus/59a2b71f7e74d4f90b7e35e60f3a685574363650/*"}} | ||
{"documents":{"D:\\C# projects\\Dionysus\\*":"https://raw.githubusercontent.com/blazor911/Dionysus/82d89df58f2acfa0fc092c5fe16ad73145f6fd14/*"}} |
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/Dionysus.dll
Binary file not shown.
Binary file modified
BIN
+44 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/Dionysus.pdb
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/apphost.exe
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/de/Dionysus.resources.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/fr/Dionysus.resources.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/ref/Dionysus.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/refint/Dionysus.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
src/Dionysus.App/obj/Release/net8.0-windows/win-x64/uk/Dionysus.resources.dll
Binary file not shown.
Oops, something went wrong.