Skip to content

Commit

Permalink
1.9.2
Browse files Browse the repository at this point in the history
[Bug fixes]
- Display selection gets overriden in  display action settings ( Profile's setting not being saved #86)
  • Loading branch information
Codectory committed Jan 5, 2022
1 parent 6cd748d commit 47f7ac9
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 39 deletions.
6 changes: 6 additions & 0 deletions Source/AutoHDR.Updater/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
53 changes: 53 additions & 0 deletions Source/AutoHDR.Updater/AutoHDR.Updater.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>AutoHDR.Updater</RootNamespace>
<AssemblyName>AutoHDR.Updater</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
17 changes: 17 additions & 0 deletions Source/AutoHDR.Updater/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoHDR.Updater
{
class Program
{
static void Main(string[] args)
{
string zip = args[0];
string targetFolder = args[0];
}
}
}
36 changes: 36 additions & 0 deletions Source/AutoHDR.Updater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("AutoHDR.Updater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoHDR.Updater")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]

// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("5df058e2-c5ab-42de-8eed-d22ff39960ad")]

// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
14 changes: 14 additions & 0 deletions Source/AutoHDR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoHDR.Threading", "AutoHD
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoHDR.Audio", "AutoHDR.Audio\AutoHDR.Audio.csproj", "{FC3B898C-2F23-43BE-A924-8A74D800E942}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoHDR.Updater", "AutoHDR.Updater\AutoHDR.Updater.csproj", "{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -97,6 +99,18 @@ Global
{FC3B898C-2F23-43BE-A924-8A74D800E942}.Release|x64.Build.0 = Release|Any CPU
{FC3B898C-2F23-43BE-A924-8A74D800E942}.Release|x86.ActiveCfg = Release|Any CPU
{FC3B898C-2F23-43BE-A924-8A74D800E942}.Release|x86.Build.0 = Release|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Debug|x64.ActiveCfg = Debug|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Debug|x64.Build.0 = Debug|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Debug|x86.ActiveCfg = Debug|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Debug|x86.Build.0 = Debug|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Release|Any CPU.Build.0 = Release|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Release|x64.ActiveCfg = Release|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Release|x64.Build.0 = Release|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Release|x86.ActiveCfg = Release|Any CPU
{5DF058E2-C5AB-42DE-8EED-D22FF39960AD}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
29 changes: 29 additions & 0 deletions Source/AutoHDR/AutoHDRDaemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,19 +325,24 @@ private void LoadSettings()
Globals.Instance.LoadSettings();
FixAssignments();
Globals.Instance.SaveSettings();

Settings.ApplicationProfileAssignments.Sort(a => a.Position, ListSortDirection.Ascending);
Settings.ApplicationProfileAssignments.CollectionChanged += ApplicationProfileAssigments_CollectionChanged;
Settings.ApplicationProfiles.CollectionChanged += ApplicationProfiles_CollectionChanged;
Settings.ActionShortcuts.CollectionChanged += ActionShortcuts_CollectionChanged;
Settings.Displays.CollectionChanged += Monitors_CollectionChanged;



Settings.PropertyChanged += Settings_PropertyChanged;

ApplicationProfileAssigments_CollectionChanged(
Settings.ApplicationProfileAssignments, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfileAssignments.ToList()));

ApplicationProfiles_CollectionChanged(Settings.ApplicationProfiles, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfiles.ToList()));



Monitors_CollectionChanged(Settings.Displays, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.Displays.ToList()));


Expand Down Expand Up @@ -616,6 +621,10 @@ private void ApplicationProfiles_CollectionChanged(object sender, NotifyCollecti
profile.ApplicationStarted.CollectionChanged += ProfileActions_CollectionChanged;
profile.ApplicationLostFocus.CollectionChanged += ProfileActions_CollectionChanged;
profile.ApplicationGotFocus.CollectionChanged += ProfileActions_CollectionChanged;
ProfileActions_CollectionChanged(profile.ApplicationClosed, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, profile.ApplicationClosed.ToList()));
ProfileActions_CollectionChanged(profile.ApplicationStarted, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, profile.ApplicationStarted.ToList()));
ProfileActions_CollectionChanged(profile.ApplicationLostFocus, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, profile.ApplicationLostFocus.ToList()));
ProfileActions_CollectionChanged(profile.ApplicationGotFocus, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, profile.ApplicationGotFocus.ToList()));
profile.PropertyChanged += SaveSettingsOnPropertyChanged;
}
break;
Expand All @@ -631,6 +640,8 @@ private void ApplicationProfiles_CollectionChanged(object sender, NotifyCollecti
}
break;
}


Globals.Instance.SaveSettings();

}
Expand Down Expand Up @@ -663,6 +674,24 @@ private void ActionShortcuts_CollectionChanged(object sender, NotifyCollectionCh

private void ProfileActions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
{

case NotifyCollectionChangedAction.Add:
foreach (IProfileAction action in e.NewItems)
{
Globals.Logs.Add($"Action added: {action.ActionDescription}", false);
((BaseViewModel)action).PropertyChanged += SaveSettingsOnPropertyChanged;
}
break;
case NotifyCollectionChangedAction.Remove:
foreach (IProfileAction action in e.OldItems)
{
Globals.Logs.Add($"Action removed: {action.ActionDescription}", false);
((BaseViewModel)action).PropertyChanged -= SaveSettingsOnPropertyChanged;
}
break;
}
Globals.Instance.SaveSettings();
}

Expand Down
14 changes: 8 additions & 6 deletions Source/AutoHDR/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ public class Globals : BaseViewModel

private UserAppSettings _settings;
public UserAppSettings Settings { get => _settings; set { _settings = value; OnPropertyChanged(); } }
private bool _settingsLoadedOnce = false;
public bool SettingsLoadedOnce { get; private set; } = false;

public event EventHandler SettingsLoaded;

public void SaveSettings(bool force = false)
{
if (!force && !_settingsLoadedOnce)
if (!force && !SettingsLoadedOnce)
return;
Globals.Logs.Add("Saving settings..", false);
try
Expand All @@ -53,22 +55,22 @@ public void LoadSettings()
if (File.Exists(SettingsPath))
{
Settings = UserAppSettings.ReadSettings(SettingsPath);
_settingsLoadedOnce = true;
SettingsLoadedOnce = true;
}
else if (File.Exists(SettingsPathCompatible))
{
Settings = UserAppSettings.ReadSettings(SettingsPathCompatible);
_settingsLoadedOnce = true;
SettingsLoadedOnce = true;
}
else
{
Globals.Logs.Add("No settings found. Creating settings file...", false);
Settings = new UserAppSettings();
Settings.ApplicationProfiles.Add(Profile.DefaultProfile());
_settingsLoadedOnce = true;
SettingsLoadedOnce = true;
}
SaveSettings();

SettingsLoaded?.Invoke(this, EventArgs.Empty);
}
catch (Exception ex)
{
Expand Down
68 changes: 49 additions & 19 deletions Source/AutoHDR/Profiles/Actions/DisplayAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,15 @@ public List<Display> AllDisplays
[JsonProperty]
public Display Display
{
get => _display;
set
{
_display = value;
get => _display;
set
{
_display = value;
OnPropertyChanged();
if (value.IsAllDisplay())
{
Resolution = AllDisplays[1].Resolution;
RefreshRate = AllDisplays[1].RefreshRate;
}
else
{
Resolution = value.Resolution;
RefreshRate = value.RefreshRate;
}
}

Resolution = value.Resolution;
RefreshRate = value.RefreshRate;
}
}
public override string ActionTypeName => ProjectResources.ProjectLocales.DisplayAction;

Expand Down Expand Up @@ -82,17 +75,54 @@ public Display Display
private Size _resolution;

[JsonProperty]
public Size Resolution { get => _resolution; set { _resolution = value; OnPropertyChanged(); } }
public Size Resolution
{
get
{
try
{
if (Display.IsAllDisplay())
return AllDisplays[1].Resolution;
}
catch { }
return _resolution;
}
set { _resolution = value; OnPropertyChanged(); }
}

private int _refreshRate;

[JsonProperty]
public int RefreshRate { get => _refreshRate; set { _refreshRate = value; OnPropertyChanged(); } }
public int RefreshRate
{
get
{
try
{
if (Display.IsAllDisplay())
return AllDisplays[1].RefreshRate;
}
catch { }
return _refreshRate;
}
set { _refreshRate = value; OnPropertyChanged(); } }

ColorDepth _colorDepth;

[JsonProperty]
public ColorDepth ColorDepth { get => _colorDepth; set { _colorDepth = value; OnPropertyChanged(); } }
public ColorDepth ColorDepth
{
get
{
try
{
if (Display.IsAllDisplay())
return AllDisplays[1].ColorDepth;
}
catch { }
return _colorDepth;
}
set { _colorDepth = value; OnPropertyChanged(); } }

public IEnumerable<ColorDepth> ColorDepthValues { get => Enum.GetValues(typeof(ColorDepth)).Cast<ColorDepth>(); }

Expand All @@ -118,7 +148,7 @@ public override string ActionDescription

public DisplayAction() : base()
{
Display = Display.AllDisplays;
_display = Display.AllDisplays;
}

public override ActionEndResult RunAction(ApplicationChangedType applicationChangedType)
Expand Down
4 changes: 2 additions & 2 deletions Source/AutoHDR/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.9.1.0")]
[assembly: AssemblyFileVersion("1.9.1.0")]
[assembly: AssemblyVersion("1.9.2.0")]
[assembly: AssemblyFileVersion("1.9.2.0")]
7 changes: 7 additions & 0 deletions Source/AutoHDR/UserAppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Xml.Serialization;

namespace AutoHDR
Expand All @@ -26,6 +27,8 @@ public class UserAppSettings : BaseViewModel
private bool _checkForNewVersion = true;
readonly object _audioDevicesLock = new object();
private Guid _defaultProfileGuid = Guid.Empty;
private Size _windowSize = new Size(1280, 800);


private SortableObservableCollection<ApplicationProfileAssignment> _applicationProfileAssignments;
private DispatchingObservableCollection<Profile> _applicationProfiles;
Expand Down Expand Up @@ -71,6 +74,10 @@ public class UserAppSettings : BaseViewModel
[JsonProperty]
public DispatchingObservableCollection<ProfileActionShortcut> ActionShortcuts { get => _actionShortcuts; set { _actionShortcuts = value; OnPropertyChanged(); } }

[JsonProperty]
public Size WindowSize { get => _windowSize; set { _windowSize = value; OnPropertyChanged(); } }


public UserAppSettings()
{
ApplicationProfileAssignments = new SortableObservableCollection<ApplicationProfileAssignment>(new ObservableCollection<ApplicationProfileAssignment>());
Expand Down
Loading

0 comments on commit 47f7ac9

Please sign in to comment.