[WIP] saving a copy for later

This commit is contained in:
Terry MacDonald
2021-06-22 19:44:50 +12:00
parent d654b80377
commit 3ec33def99
6 changed files with 59 additions and 24 deletions

View File

@ -8,10 +8,11 @@ using ATI.ADL;
using Microsoft.Win32.SafeHandles;
using DisplayMagicianShared;
using System.Threading;
using static DisplayMagicianShared.AMD.AMDProfileData;
namespace DisplayMagicianShared.AMD
{
public class AMDLibrary : IDisposable
internal class AMDLibrary : IDisposable
{
// Static members are 'eagerly initialized', that is,
// immediately when class is loaded for the first time.
@ -25,27 +26,7 @@ namespace DisplayMagicianShared.AMD
// Instantiate a SafeHandle instance.
private SafeHandle _safeHandle = new SafeFileHandle(IntPtr.Zero, true);
private IntPtr _adlContextHandle = IntPtr.Zero;
// Struct to be used as the AMD Profile
internal struct AMDProfile
{
internal List<AMDAdapter> Adapters;
}
// Struct to store the Display
internal struct AMDAdapter
{
internal ADLAdapterInfoX2 AdapterInfoX2;
internal List<AMDDisplay> Displays;
}
// Struct to store the Display
internal struct AMDDisplay
{
internal List<ADLMode> DisplayModes;
}
private IntPtr _adlContextHandle = IntPtr.Zero;
static AMDLibrary() { }
public AMDLibrary()

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ATI.ADL;
namespace DisplayMagicianShared.AMD
{
internal class AMDProfileData : VideoLibraryProfileData
{
// Struct to be used as the AMD Profile
internal struct AMDProfile
{
public List<AMDAdapter> Adapters;
}
// Struct to store the Display
internal struct AMDAdapter
{
internal ADLAdapterInfoX2 AdapterInfoX2;
internal List<AMDDisplay> Displays;
}
// Struct to store the Display
internal struct AMDDisplay
{
internal List<ADLMode> DisplayModes;
}
internal AMDProfile ProfileData {get; set;}
}
}

View File

@ -53,6 +53,7 @@
<ItemGroup>
<Compile Include="AMD\ADL.cs" />
<Compile Include="AMD\AMDLibrary.cs" />
<Compile Include="AMD\AMDProfileData.cs" />
<Compile Include="SharedLogger.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
@ -87,6 +88,7 @@
<Compile Include="UserControls\DisplayView.Designer.cs">
<DependentUpon>DisplayView.cs</DependentUpon>
</Compile>
<Compile Include="VideoLibraryProfileData.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">

View File

@ -155,6 +155,8 @@ namespace DisplayMagicianShared
public string Name { get; set; }
public Topology.Path[] Paths { get; set; } = new Topology.Path[0];
internal VideoLibraryProfileData ProfileData { get; set; }
[JsonIgnore]
public ProfileIcon ProfileIcon

View File

@ -14,6 +14,7 @@ using System.Text.RegularExpressions;
using NvAPIWrapper.Native.GPU;
using DisplayMagicianShared.AMD;
using System.Windows.Forms;
using static DisplayMagicianShared.AMD.AMDProfileData;
namespace DisplayMagicianShared
{
@ -563,12 +564,12 @@ namespace DisplayMagicianShared
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
if (amdLibrary.IsInstalled)
{
AMDLibrary.AMDProfile thisOne = amdLibrary.GetActiveProfile();
AMDProfile thisOne = amdLibrary.GetActiveProfile();
activeProfile = new ProfileItem
{
Name = "Current Display Profile",
//Driver = "AMD",
//ProfileData = amdLibrary.GetActiveProfile()
ProfileData = amdLibrary.GetActiveProfile()
//ProfileDisplayIdentifiers = ProfileRepository.GenerateProfileDisplayIdentifiers()
};
activeProfile.ProfileIcon = new ProfileIcon(activeProfile);

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DisplayMagicianShared
{
class VideoLibraryProfileData
{
// Empty Class
}
}