Skip to content

Commit

Permalink
Replace PropertyChanged.Fody with source generator
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Dec 30, 2024
1 parent 7a43035 commit 579328f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 35 deletions.
1 change: 1 addition & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ guidelines = 80
[*.cs]
file_header_template = This Source Code Form is subject to the terms of the Mozilla Public\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.
guidelines = 80, 120
propertychanged.first_letter_capitalization = lower_case

# Xml files
[*.xml]
Expand Down
63 changes: 29 additions & 34 deletions src/JsonConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,52 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

using Newtonsoft.Json;
using PropertyChanged;
using PropertyChanged.SourceGenerator;
using System;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;

namespace WinDynamicDesktop
{
[AddINotifyPropertyChangedInterface]
public class AppConfig : INotifyPropertyChanged
public partial class AppConfig : INotifyPropertyChanged
{
#pragma warning disable 67
public event PropertyChangedEventHandler PropertyChanged;
#pragma warning restore 67

// Schedule settings
public int locationMode { get; set; }
public string location { get; set; }
public double? latitude { get; set; }
public double? longitude { get; set; }
public string sunriseTime { get; set; }
public string sunsetTime { get; set; }
public int sunriseSunsetDuration { get; set; }
[Notify] private int _locationMode { get; set; }
[Notify] private string _location { get; set; }
[Notify] private double? _latitude { get; set; }
[Notify] private double? _longitude { get; set; }
[Notify] private string _sunriseTime { get; set; }
[Notify] private string _sunsetTime { get; set; }
[Notify] private int _sunriseSunsetDuration { get; set; }

// Theme settings
public string[] activeThemes { get; set; }
[Obsolete("Will be removed in v6")]
[Notify] private string[] _activeThemes { get; set; }
[Obsolete("Deprecated")]
public bool darkMode { get; set; }
public int appearanceMode { get; set; }
[Obsolete("Will be removed in v6")]
[Notify] private int _appearanceMode { get; set; }
[Obsolete("Deprecated")]
public bool changeLockScreen { get; set; }
public int lockScreenDisplayIndex { get; set; } = -1;
public string lockScreenTheme { get; set; }
[Obsolete("Will be removed in v6")]
[Notify] private int _lockScreenDisplayIndex { get; set; } = -1;
[Notify] private string _lockScreenTheme { get; set; }
[Obsolete("Deprecated")]
public bool enableShuffle { get; set; }
public int themeShuffleMode { get; set; } = (int)ShufflePeriod.EveryDay;
[Obsolete("Will be removed in v6")]
[Notify] private int _themeShuffleMode { get; set; } = (int)ShufflePeriod.EveryDay;
[Obsolete("Deprecated")]
public string lastShuffleDate { get; set; }
public string lastShuffleTime { get; set; }
public string[] shuffleHistory { get; set; }
public string[] favoriteThemes { get; set; }
public bool showInstalledOnly { get; set; }
[Notify] private string _lastShuffleTime { get; set; }
[Notify] private string[] _shuffleHistory { get; set; }
[Notify] private string[] _favoriteThemes { get; set; }
[Notify] private bool _showInstalledOnly { get; set; }

// General settings
public string language { get; set; }
public bool autoUpdateCheck { get; set; } = true;
public string lastUpdateCheckTime { get; set; }
public bool hideTrayIcon { get; set; }
public bool fullScreenPause { get; set; }
public bool enableScripts { get; set; }
public bool debugLogging { get; set; }
[Notify] private string _language { get; set; }
[Notify] private bool _autoUpdateCheck { get; set; } = true;
[Notify] private string _lastUpdateCheckTime { get; set; }
[Notify] private bool _hideTrayIcon { get; set; }
[Notify] private bool _fullScreenPause { get; set; }
[Notify] private bool _enableScripts { get; set; }
[Notify] private bool _debugLogging { get; set; }
}

class JsonConfig
Expand Down
5 changes: 4 additions & 1 deletion src/WinDynamicDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
<PackageReference Include="GeoTimeZone" Version="5.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NGettext" Version="0.6.7" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="All" />
<PackageReference Include="PropertyChanged.SourceGenerator" Version="1.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="SunCalcNet" Version="1.2.2" />
<PackageReference Include="TimeZoneConverter" Version="6.1.0" />
Expand Down

0 comments on commit 579328f

Please sign in to comment.