Skip to content

Commit

Permalink
Merge pull request #3 from Stone-Red-Code/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Stone-Red-Code authored Feb 22, 2024
2 parents 536890a + 414f84a commit d4cd384
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 50 deletions.
Binary file modified installer/DesktopMagic-Installer.exe
Binary file not shown.
34 changes: 1 addition & 33 deletions src/DesktopMagic/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
global using Stone_Red_Utilities.Logging;

using AlwaysUpToDate;

using Stone_Red_C_Sharp_Utilities.Logging;

using System;
Expand All @@ -20,11 +18,7 @@ public partial class App : Application

public const string AppName = "Desktop Magic";
private readonly string logFilePath;
#if DEBUG
private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/develop/update/updateInfo.json");
#else
private readonly Updater updater = new Updater(TimeSpan.FromDays(1), "https://raw.githubusercontent.com/Stone-Red-Code/DesktopMagic/main/update/updateInfo.json");
#endif

private readonly Thread? eventThread;
private readonly EventWaitHandle eventWaitHandle;

Expand Down Expand Up @@ -64,12 +58,6 @@ public App()

Setup(true);
Exit += CloseHandler;

updater.ProgressChanged += Updater_ProgressChanged;
updater.OnException += Updater_OnException;
updater.NoUpdateAvailible += Updater_NoUpdateAvailible;
updater.UpdateAvailible += Updater_UpdateAvailible;
updater.Start();
}
}

Expand All @@ -79,26 +67,6 @@ protected void CloseHandler(object sender, EventArgs e)
eventThread?.Interrupt();
}

private void Updater_UpdateAvailible(string version, string additionalInformation)
{
updater.Update();
}

private void Updater_NoUpdateAvailible()
{
Logger.Log("No update available", "Updater");
}

private void Updater_OnException(Exception exception)
{
Logger.Log(exception.ToString(), "Updater");
}

private void Updater_ProgressChanged(long? totalFileSize, long totalBytesDownloaded, double? progressPercentage)
{
Logger.Log($"Downloading: {progressPercentage}% {totalBytesDownloaded}/{totalFileSize}", "Updater");
}

private void Setup(bool clearLogFile)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Expand Down
7 changes: 3 additions & 4 deletions src/DesktopMagic/DesktopMagic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<Authors>Stone_Red</Authors>
<Version>1.0.0.0</Version>
<Version>1.0.1.0</Version>
<PackageProjectUrl>https://github.com/Stone-Red-Code/DesktopMagic</PackageProjectUrl>
<RepositoryUrl>https://github.com/Stone-Red-Code/DesktopMagic</RepositoryUrl>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -35,7 +35,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AlwaysUpToDate" Version="1.0.0.4" />
<PackageReference Include="BusyIndicators" Version="2.1.2" />
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.1" />
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
Expand Down
3 changes: 2 additions & 1 deletion src/DesktopMagic/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

[assembly: SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "Windows only application")]
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "No need to")]
[assembly: SuppressMessage("Minor Code Smell", "S1075:URIs should not be hardcoded", Justification = "<Pending>")]
[assembly: SuppressMessage("Minor Code Smell", "S1075:URIs should not be hardcoded", Justification = "<Pending>")]
[assembly: SuppressMessage("Critical Code Smell", "S2696:Instance members should not write to \"static\" fields", Justification = "<Pending>", Scope = "member", Target = "~P:DesktopMagic.DataContexts.MainWindowDataContext.Settings")]
2 changes: 1 addition & 1 deletion src/DesktopMagic/Helpers/Win32Wrapper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Text;

#pragma warning disable
namespace DesktopMagic.Helpers;

internal class W32
Expand Down
2 changes: 1 addition & 1 deletion src/DesktopMagic/Helpers/WindowPos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Windows;
using System.Windows.Interop;
using System.Windows.Shapes;

#pragma warning disable
namespace DesktopMagic
{
using static NativeMethods;
Expand Down
2 changes: 1 addition & 1 deletion src/DesktopMagic/Plugins/PluginWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class PluginWindow : Window

public bool IsRunning { get; private set; } = true;
public PluginMetadata PluginMetadata { get; private set; }
public string? PluginFolderPath { get; private set; }
public string PluginFolderPath { get; private set; }

public PluginWindow(PluginMetadata pluginMetadata, PluginSettings settings, string pluginFolderPath)
{
Expand Down
7 changes: 6 additions & 1 deletion src/DesktopMagicPluginAPI/Drawing/FontComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ namespace DesktopMagic.Api.Drawing;

internal class FontComparer : IEqualityComparer<Font>
{
public bool Equals(Font font1, Font font2)
public bool Equals(Font? font1, Font? font2)
{
if (font1 is null || font2 is null)
{
return false;
}

if (font1.Name != font2.Name)
{
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/DesktopMagicPluginAPI/Settings/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class Button : Setting
/// <summary>
/// Occurs when the button gets clicked.
/// </summary>
public event Action OnClick;
public event Action? OnClick;

private string _value;
private string _value = string.Empty;

/// <summary>
/// Gets or sets the text caption displayed in the <see cref="Button"/> element.
Expand Down
2 changes: 1 addition & 1 deletion src/DesktopMagicPluginAPI/Settings/Label.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// </summary>
public class Label : Setting
{
private string _value;
private string _value = string.Empty;

/// <summary>
/// Gets or sets the text associated with this <see cref="Label"/>.
Expand Down
2 changes: 1 addition & 1 deletion src/DesktopMagicPluginAPI/Settings/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// </summary>
public class TextBox : Setting
{
private string _value;
private string _value = string.Empty;

/// <summary>
/// Gets or sets the text associated with this <see cref="TextBox"/>.
Expand Down
Binary file removed update/DesktopMagic.zip
Binary file not shown.
4 changes: 0 additions & 4 deletions update/updateInfo.json

This file was deleted.

0 comments on commit d4cd384

Please sign in to comment.