├── .github ├── FUNDING.yml └── workflows │ └── codeql.yml ├── .gitignore ├── Common ├── AsusSensorInfo.cs ├── AsusWMI.cs ├── BiosACPIFunction.cs ├── BiosMemController.cs ├── CpuSingleton.cs ├── MemoryConfig.cs ├── MemoryModule.cs ├── Screenshot.cs ├── UpdaterArgs.cs ├── UpdaterPersistenceProvider.cs ├── ZenStates-Core-README.md └── ZenStates-Core.dll ├── LICENSE ├── OHWMPlugin ├── OHWMPlugin.cs ├── OHWMPlugin.csproj └── Properties │ └── AssemblyInfo.cs ├── README.md ├── WPF-no-themes ├── App.xaml ├── App.xaml.cs ├── AppSettings.cs ├── Common │ ├── ISensor.cs │ └── Sensor.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Plugin │ ├── IPlugin.cs │ ├── OHWMPlugin.cs │ └── SVI2Plugin.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── BuildNumberTemplate.cs │ ├── BuildNumberTemplate.tt │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ ├── 64.png │ ├── ZenTimings.ico │ ├── ZenTimings2022.ico │ ├── camera-dark.png │ ├── camera-light.png │ └── splash.png ├── Themes │ ├── Base.xaml │ └── Light.xaml ├── Updater.cs ├── Windows │ ├── AboutDialog.xaml │ ├── AboutDialog.xaml.cs │ ├── DebugDialog.xaml │ ├── DebugDialog.xaml.cs │ ├── OptionsDialog.xaml │ ├── OptionsDialog.xaml.cs │ ├── SaveWindow.xaml │ ├── SaveWindow.xaml.cs │ ├── SplashWindow.xaml │ └── SplashWindow.xaml.cs ├── ZenTimings-legacy.csproj ├── ZenTimings-legacy.sln ├── app.config ├── app.manifest └── packages.config ├── WPF ├── App.xaml ├── App.xaml.cs ├── AppSettings.cs ├── Common │ ├── ISensor.cs │ └── Sensor.cs ├── Config.cs ├── Converters │ ├── DDR4ToVisConverter.cs │ ├── DDR5ToVisConverter.cs │ ├── FloatToBoolConverter.cs │ ├── FloatToNAConverter.cs │ ├── FloatToVoltageConverter.cs │ └── PhoenixToVisConverter.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Plugin │ ├── IPlugin.cs │ ├── OHWMPlugin.cs │ └── SVI2Plugin.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── BuildNumberTemplate.cs │ ├── BuildNumberTemplate.tt │ ├── Resources.Designer.cs │ └── Resources.resx ├── Resources │ ├── ROG │ │ ├── ROG-logo-burnt-40.svg │ │ ├── ROG-logo-burnt-40.xaml │ │ ├── ROG-logo-dracula-40.svg │ │ ├── ROG-logo-dracula-40.xaml │ │ ├── ROG-logo-mint-40.svg │ │ ├── ROG-logo-mint-40.xaml │ │ ├── ROG-logo-red-40.svg │ │ ├── ROG-logo-red-40.xaml │ │ ├── ROG-logo-retro-40.svg │ │ ├── ROG-logo-retro-40.xaml │ │ ├── ROG-logo-white-40.svg │ │ ├── ROG-logo-white-40.xaml │ │ └── ROG-logo.svg │ ├── ZenTimings2022.ico │ ├── ZenTimings2022_flipped.ico │ ├── camera-dark.svg │ ├── camera-dark.xaml │ ├── camera-light.svg │ ├── camera-light.xaml │ ├── camera.svg │ ├── camera2.svg │ ├── new-icon │ │ ├── 128.png │ │ ├── 16.png │ │ ├── 24.png │ │ ├── 256.png │ │ ├── 32.png │ │ ├── 48.png │ │ ├── 512.png │ │ ├── 512_flipped.png │ │ ├── 64.png │ │ ├── 96.png │ │ └── drawing.svg │ ├── new-logo.psd │ ├── splash.png │ ├── splash.psd │ └── warning-icon.png ├── Themes │ ├── Base.xaml │ ├── BurntOrange.xaml │ ├── Dark.xaml │ ├── DarkMint.xaml │ ├── DarkMintGradient.xaml │ ├── DarkRed.xaml │ ├── Dracula.xaml │ ├── Light.xaml │ └── RetroWave.xaml ├── Updater.cs ├── Windows │ ├── AboutDialog.xaml │ ├── AboutDialog.xaml.cs │ ├── Changelog.xaml │ ├── Changelog.xaml.cs │ ├── DebugDialog.xaml │ ├── DebugDialog.xaml.cs │ ├── OptionsDialog.xaml │ ├── OptionsDialog.xaml.cs │ ├── SaveScreenshotWindow.xaml │ ├── SaveScreenshotWindow.xaml.cs │ ├── SplashWindow.xaml │ ├── SplashWindow.xaml.cs │ ├── SystemInfoWindow.xaml │ └── SystemInfoWindow.xaml.cs ├── ZenTimings.csproj ├── ZenTimings.sln ├── app.config ├── app.manifest └── packages.config └── screenshot.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: ['https://www.paypal.com/donate/?hosted_button_id=NLSRLE9MVDPCW', 'https://revolut.me/ivanrusanov'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "master" ] 17 | pull_request: 18 | branches: [ "master" ] 19 | schedule: 20 | - cron: '33 12 * * 5' 21 | 22 | jobs: 23 | analyze: 24 | name: Analyze (${{ matrix.language }}) 25 | # Runner size impacts CodeQL analysis time. To learn more, please see: 26 | # - https://gh.io/recommended-hardware-resources-for-running-codeql 27 | # - https://gh.io/supported-runners-and-hardware-resources 28 | # - https://gh.io/using-larger-runners (GitHub.com only) 29 | # Consider using larger runners or machines with greater resources for possible analysis time improvements. 30 | runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} 31 | timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} 32 | permissions: 33 | # required for all workflows 34 | security-events: write 35 | 36 | # required to fetch internal or private CodeQL packs 37 | packages: read 38 | 39 | # only required for workflows in private repositories 40 | actions: read 41 | contents: read 42 | 43 | strategy: 44 | fail-fast: false 45 | matrix: 46 | include: 47 | - language: csharp 48 | build-mode: none 49 | # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' 50 | # Use `c-cpp` to analyze code written in C, C++ or both 51 | # Use 'java-kotlin' to analyze code written in Java, Kotlin or both 52 | # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both 53 | # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, 54 | # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. 55 | # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how 56 | # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages 57 | steps: 58 | - name: Checkout repository 59 | uses: actions/checkout@v4 60 | 61 | # Initializes the CodeQL tools for scanning. 62 | - name: Initialize CodeQL 63 | uses: github/codeql-action/init@v3 64 | with: 65 | languages: ${{ matrix.language }} 66 | build-mode: ${{ matrix.build-mode }} 67 | # If you wish to specify custom queries, you can do so here or in a config file. 68 | # By default, queries listed here will override any specified in a config file. 69 | # Prefix the list here with "+" to use these queries and those in the config file. 70 | 71 | # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 72 | # queries: security-extended,security-and-quality 73 | 74 | # If the analyze step fails for one of the languages you are analyzing with 75 | # "We were unable to automatically build your code", modify the matrix above 76 | # to set the build mode to "manual" for that language. Then modify this step 77 | # to build your code. 78 | # ℹ️ Command-line programs to run using the OS shell. 79 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 80 | - if: matrix.build-mode == 'manual' 81 | shell: bash 82 | run: | 83 | echo 'If you are using a "manual" build mode for one or more of the' \ 84 | 'languages you are analyzing, replace this with the commands to build' \ 85 | 'your code, for example:' 86 | echo ' make bootstrap' 87 | echo ' make release' 88 | exit 1 89 | 90 | - name: Perform CodeQL Analysis 91 | uses: github/codeql-action/analyze@v3 92 | with: 93 | category: "/language:${{matrix.language}}" 94 | -------------------------------------------------------------------------------- /Common/AsusSensorInfo.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using static ZenTimings.AsusWMI; 3 | 4 | namespace ZenTimings 5 | { 6 | /* 7 | * Sample data for core voltage from Crosshair VI Hero 8 | * 9 | * Data_Type: 3 10 | * Location: 0 11 | * Name: CPU Core Voltage 12 | * Source: 1 13 | * Type: 0 14 | */ 15 | public class AsusSensorInfo : INotifyPropertyChanged 16 | { 17 | public event PropertyChangedEventHandler PropertyChanged; 18 | 19 | protected void OnPropertyChanged(PropertyChangedEventArgs eventArgs) 20 | { 21 | PropertyChanged?.Invoke(this, eventArgs); 22 | } 23 | 24 | protected bool SetProperty(ref T storage, T value, PropertyChangedEventArgs args) 25 | { 26 | if (Equals(storage, value)) return false; 27 | storage = value; 28 | OnPropertyChanged(args); 29 | return true; 30 | } 31 | 32 | private byte index; 33 | 34 | public byte Index 35 | { 36 | get => index; 37 | set => SetProperty(ref index, value, InternalEventArgsCache.Index); 38 | } 39 | 40 | private AsusSensorDataType dataType; 41 | 42 | public AsusSensorDataType DataType 43 | { 44 | get => dataType; 45 | set => SetProperty(ref dataType, value, InternalEventArgsCache.DataType); 46 | } 47 | 48 | 49 | private AsusSensorLocation location; 50 | 51 | public AsusSensorLocation Location 52 | { 53 | get => location; 54 | set => SetProperty(ref location, value, InternalEventArgsCache.Location); 55 | } 56 | 57 | private string name; 58 | 59 | public string Name 60 | { 61 | get => name; 62 | set => SetProperty(ref name, value, InternalEventArgsCache.Name); 63 | } 64 | 65 | private AsusSensorSource source; 66 | 67 | public AsusSensorSource Source 68 | { 69 | get => source; 70 | set => SetProperty(ref source, value, InternalEventArgsCache.Source); 71 | } 72 | 73 | private AsusSensorType type; 74 | 75 | public AsusSensorType Type 76 | { 77 | get => type; 78 | set => SetProperty(ref type, value, InternalEventArgsCache.Type); 79 | } 80 | 81 | private string val; 82 | 83 | public string Value 84 | { 85 | get => val; 86 | set => SetProperty(ref val, value, InternalEventArgsCache.Value); 87 | } 88 | 89 | internal static class InternalEventArgsCache 90 | { 91 | internal static PropertyChangedEventArgs Index = new PropertyChangedEventArgs("Index"); 92 | internal static PropertyChangedEventArgs DataType = new PropertyChangedEventArgs("DataType"); 93 | internal static PropertyChangedEventArgs Location = new PropertyChangedEventArgs("Location"); 94 | internal static PropertyChangedEventArgs Name = new PropertyChangedEventArgs("Name"); 95 | internal static PropertyChangedEventArgs Source = new PropertyChangedEventArgs("Source"); 96 | internal static PropertyChangedEventArgs Type = new PropertyChangedEventArgs("Type"); 97 | internal static PropertyChangedEventArgs Value = new PropertyChangedEventArgs("Value"); 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /Common/BiosACPIFunction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace ZenTimings 4 | { 5 | public class BiosACPIFunction : IEnumerable 6 | { 7 | public string IDString; 8 | public uint ID; 9 | 10 | public BiosACPIFunction(string idString, uint id) 11 | { 12 | IDString = idString; 13 | ID = id; 14 | } 15 | 16 | public IEnumerator GetEnumerator() 17 | { 18 | return ((IEnumerable)IDString).GetEnumerator(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Common/BiosMemController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace ZenTimings 6 | { 7 | public class BiosMemController : IDisposable 8 | { 9 | private static readonly Dictionary ProcOdtDict = new Dictionary 10 | { 11 | {1, "480.0 Ω"}, 12 | {2, "240.0 Ω"}, 13 | {3, "160.0 Ω"}, 14 | {8, "120.0 Ω"}, 15 | {9, "96.0 Ω"}, 16 | {10, "80.0 Ω"}, 17 | {11, "68.6 Ω"}, 18 | {24, "60.0 Ω"}, 19 | {25, "53.3 Ω"}, 20 | {26, "48.0 Ω"}, 21 | {27, "43.6 Ω"}, 22 | {56, "40.0 Ω"}, 23 | {57, "36.9 Ω"}, 24 | {58, "34.3 Ω"}, 25 | {59, "32.0 Ω"}, 26 | {62, "30.0 Ω"}, 27 | {63, "28.2 Ω"} 28 | }; 29 | 30 | private static readonly Dictionary DriveStrengthDict = new Dictionary 31 | { 32 | {0, "120.0 Ω"}, 33 | {1, "60.0 Ω"}, 34 | {3, "40.0 Ω"}, 35 | {7, "30.0 Ω"}, 36 | {15, "24.0 Ω"}, 37 | {31, "20.0 Ω"} 38 | }; 39 | 40 | private static readonly Dictionary RttDict = new Dictionary 41 | { 42 | {0, "Disabled"}, 43 | {1, "RZQ/4"}, 44 | {2, "RZQ/2"}, 45 | {3, "RZQ/6"}, 46 | {4, "RZQ/1"}, 47 | {5, "RZQ/5"}, 48 | {6, "RZQ/3"}, 49 | {7, "RZQ/7"} 50 | }; 51 | 52 | private static readonly Dictionary RttWrDict = new Dictionary 53 | { 54 | {0, "Off"}, 55 | {1, "RZQ/2"}, 56 | {2, "RZQ/1"}, 57 | {3, "Hi-Z"}, 58 | {4, "RZQ/3"} 59 | }; 60 | 61 | private bool disposedValue; 62 | 63 | private byte[] table; 64 | 65 | public BiosMemController() 66 | { 67 | } 68 | 69 | public BiosMemController(byte[] table) 70 | { 71 | ParseTable(table); 72 | } 73 | 74 | public byte[] Table 75 | { 76 | get => table; 77 | set 78 | { 79 | if (value != null) 80 | { 81 | table = value; 82 | ParseTable(value); 83 | } 84 | } 85 | } 86 | 87 | public Resistances Config { get; set; } 88 | 89 | public void Dispose() 90 | { 91 | // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method 92 | Dispose(true); 93 | GC.SuppressFinalize(this); 94 | } 95 | 96 | private void ParseTable(byte[] biosTable) 97 | { 98 | GCHandle handle = GCHandle.Alloc(biosTable, GCHandleType.Pinned); 99 | try 100 | { 101 | Config = (Resistances)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), 102 | typeof(Resistances)); 103 | } 104 | finally 105 | { 106 | handle.Free(); 107 | } 108 | } 109 | 110 | private static string GetByKey(Dictionary dict, int key) 111 | { 112 | return dict.TryGetValue(key, out string output) ? output : "N/A"; 113 | } 114 | 115 | public string GetProcODTString(int key) => GetByKey(ProcOdtDict, key); 116 | public string GetDrvStrenString(int key) => GetByKey(DriveStrengthDict, key); 117 | public string GetRttString(int key) => GetByKey(RttDict, key); 118 | public string GetRttWrString(int key) => GetByKey(RttWrDict, key); 119 | public string GetSetupString(byte value) => $"{value / 32}/{value % 32}"; 120 | 121 | protected virtual void Dispose(bool disposing) 122 | { 123 | if (!disposedValue) 124 | { 125 | Table = null; 126 | disposedValue = true; 127 | } 128 | } 129 | 130 | [Serializable] 131 | [StructLayout(LayoutKind.Explicit)] 132 | public struct Resistances 133 | { 134 | [FieldOffset(27)] public ushort MemVddio; 135 | [FieldOffset(29)] public ushort MemVtt; 136 | [FieldOffset(31)] public ushort MemVpp; 137 | [FieldOffset(33)] public byte ProcODT; 138 | [FieldOffset(65)] public byte RttNom; 139 | [FieldOffset(66)] public byte RttWr; 140 | [FieldOffset(67)] public byte RttPark; 141 | [FieldOffset(86)] public byte AddrCmdSetup; 142 | [FieldOffset(87)] public byte CsOdtSetup; 143 | [FieldOffset(88)] public byte CkeSetup; 144 | [FieldOffset(89)] public byte ClkDrvStren; 145 | [FieldOffset(90)] public byte AddrCmdDrvStren; 146 | [FieldOffset(91)] public byte CsOdtCmdDrvStren; 147 | [FieldOffset(92)] public byte CkeDrvStren; 148 | }; 149 | } 150 | } -------------------------------------------------------------------------------- /Common/CpuSingleton.cs: -------------------------------------------------------------------------------- 1 | using ZenStates.Core; 2 | 3 | namespace ZenTimings 4 | { 5 | internal sealed class CpuSingleton 6 | { 7 | private static Cpu instance = null; 8 | private CpuSingleton() { } 9 | 10 | public static Cpu Instance 11 | { 12 | get 13 | { 14 | if (instance == null) 15 | instance = new Cpu(); 16 | 17 | return instance; 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Common/MemoryModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace ZenTimings 4 | { 5 | public enum MemRank 6 | { 7 | SR = 0, 8 | DR = 1, 9 | QR = 2, 10 | } 11 | 12 | public class MemoryModule : IEnumerable 13 | { 14 | public string BankLabel { get; set; } 15 | public string PartNumber { get; set; } 16 | public string Manufacturer { get; set; } 17 | public string DeviceLocator { get; set; } 18 | public ulong Capacity { get; set; } 19 | public uint ClockSpeed { get; set; } 20 | public MemRank Rank { get; set; } 21 | public string Slot { get; set; } = ""; 22 | public uint DctOffset { get; set; } = 0; 23 | 24 | public MemoryModule(string partNumber, string bankLabel, string manufacturer, 25 | string deviceLocator, ulong capacity, uint clockSpeed) 26 | { 27 | PartNumber = partNumber; 28 | Capacity = capacity; 29 | ClockSpeed = clockSpeed; 30 | BankLabel = bankLabel; 31 | Manufacturer = manufacturer; 32 | DeviceLocator = deviceLocator; 33 | } 34 | 35 | public IEnumerator GetEnumerator() 36 | { 37 | return ((IEnumerable)PartNumber).GetEnumerator(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Common/Screenshot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Drawing; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace ZenTimings 7 | { 8 | public class Screenshot : IDisposable 9 | { 10 | // GDI stuff for window screenshot without shadows 11 | [DllImport("gdi32.dll")] 12 | private static extern bool BitBlt(IntPtr hdcDest, int nxDest, int nyDest, int nWidth, int nHeight, 13 | IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop); 14 | 15 | [DllImport("gdi32.dll")] 16 | private static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int width, int nHeight); 17 | 18 | [DllImport("gdi32.dll")] 19 | private static extern IntPtr CreateCompatibleDC(IntPtr hdc); 20 | 21 | [DllImport("gdi32.dll")] 22 | private static extern IntPtr DeleteDC(IntPtr hdc); 23 | 24 | [DllImport("gdi32.dll")] 25 | private static extern IntPtr DeleteObject(IntPtr hObject); 26 | 27 | [DllImport("user32.dll")] 28 | private static extern IntPtr GetDesktopWindow(); 29 | 30 | [DllImport("user32.dll")] 31 | private static extern IntPtr GetWindowDC(IntPtr hWnd); 32 | 33 | [DllImport("user32.dll")] 34 | private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc); 35 | 36 | [DllImport("gdi32.dll")] 37 | private static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject); 38 | 39 | [DllImport("user32.dll", SetLastError = true)] 40 | private static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect); 41 | 42 | [DllImport("dwmapi.dll")] 43 | private static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out RECT pvAttribute, 44 | int cbAttribute); 45 | 46 | [DllImport("user32.dll")] 47 | private static extern IntPtr GetForegroundWindow(); 48 | 49 | [StructLayout(LayoutKind.Sequential)] 50 | private readonly struct RECT 51 | { 52 | public readonly int left; 53 | public readonly int top; 54 | public readonly int right; 55 | public readonly int bottom; 56 | } 57 | 58 | private const int DWMWA_EXTENDED_FRAME_BOUNDS = 9; 59 | private const int SRCCOPY = 0x00CC0020; 60 | private const int CAPTUREBLT = 0x40000000; 61 | private bool disposedValue; 62 | 63 | private Bitmap CaptureRegion(Rectangle region) 64 | { 65 | Bitmap result; 66 | 67 | IntPtr desktophWnd = GetDesktopWindow(); 68 | IntPtr desktopDc = GetWindowDC(desktophWnd); 69 | IntPtr memoryDc = CreateCompatibleDC(desktopDc); 70 | IntPtr bitmap = CreateCompatibleBitmap(desktopDc, region.Width, region.Height); 71 | IntPtr oldBitmap = SelectObject(memoryDc, bitmap); 72 | 73 | var success = BitBlt(memoryDc, 0, 0, region.Width, region.Height, desktopDc, region.Left, region.Top, 74 | SRCCOPY | CAPTUREBLT); 75 | 76 | try 77 | { 78 | if (!success) throw new Win32Exception(); 79 | 80 | result = Image.FromHbitmap(bitmap); 81 | } 82 | finally 83 | { 84 | SelectObject(memoryDc, oldBitmap); 85 | DeleteObject(bitmap); 86 | DeleteDC(memoryDc); 87 | ReleaseDC(desktophWnd, desktopDc); 88 | } 89 | 90 | return result; 91 | } 92 | 93 | private Bitmap CaptureWindow(IntPtr hWnd) 94 | { 95 | RECT region; 96 | 97 | if (Environment.OSVersion.Version.Major < 6) 98 | { 99 | GetWindowRect(hWnd, out region); 100 | } 101 | else 102 | { 103 | if (DwmGetWindowAttribute(hWnd, DWMWA_EXTENDED_FRAME_BOUNDS, out region, 104 | Marshal.SizeOf(typeof(RECT))) != 0) GetWindowRect(hWnd, out region); 105 | } 106 | 107 | return CaptureRegion(Rectangle.FromLTRB(region.left, region.top, region.right, region.bottom)); 108 | } 109 | 110 | public Bitmap CaptureActiveWindow() 111 | { 112 | return CaptureWindow(GetForegroundWindow()); 113 | } 114 | 115 | public Bitmap CaptureDekstop() 116 | { 117 | return CaptureWindow(GetDesktopWindow()); 118 | } 119 | 120 | protected virtual void Dispose(bool disposing) 121 | { 122 | if (!disposedValue) 123 | { 124 | if (disposing) 125 | { 126 | // TODO: dispose managed state (managed objects) 127 | } 128 | 129 | // TODO: free unmanaged resources (unmanaged objects) and override finalizer 130 | // TODO: set large fields to null 131 | disposedValue = true; 132 | } 133 | } 134 | 135 | // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources 136 | // ~Screenshot() 137 | // { 138 | // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method 139 | // Dispose(disposing: false); 140 | // } 141 | 142 | public void Dispose() 143 | { 144 | // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method 145 | Dispose(true); 146 | GC.SuppressFinalize(this); 147 | } 148 | } 149 | } -------------------------------------------------------------------------------- /Common/UpdaterArgs.cs: -------------------------------------------------------------------------------- 1 | namespace ZenTimings 2 | { 3 | [System.Serializable()] 4 | [System.ComponentModel.DesignerCategory("code")] 5 | [System.Xml.Serialization.XmlType(AnonymousType = true)] 6 | [System.Xml.Serialization.XmlRoot(Namespace = "", IsNullable = false)] 7 | public class UpdaterArgs 8 | { 9 | public string Version { get; set; } 10 | 11 | public string Url { get; set; } 12 | 13 | public string Changelog { get; set; } 14 | 15 | public bool Mandatory { get; set; } 16 | 17 | public UpdaterArgsChecksum Checksum { get; set; } 18 | 19 | [System.Xml.Serialization.XmlArrayItem("Change", IsNullable = false)] 20 | public string[] Changes { get; set; } 21 | } 22 | 23 | [System.Serializable()] 24 | [System.ComponentModel.DesignerCategory("code")] 25 | [System.Xml.Serialization.XmlType(AnonymousType = true)] 26 | public class UpdaterArgsChecksum 27 | { 28 | [System.Xml.Serialization.XmlAttribute()] 29 | public string algorithm { get; set; } 30 | 31 | [System.Xml.Serialization.XmlText()] 32 | public string Value { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /Common/UpdaterPersistenceProvider.cs: -------------------------------------------------------------------------------- 1 | using AutoUpdaterDotNET; 2 | using System; 3 | using System.Windows; 4 | 5 | namespace ZenTimings 6 | { 7 | public sealed class UpdaterPersistenceProvider : IPersistenceProvider 8 | { 9 | internal readonly AppSettings appSettings = AppSettings.Instance; 10 | public UpdaterPersistenceProvider() { } 11 | 12 | /// 13 | /// Reads the flag indicating whether a specific version should be skipped or not. 14 | /// 15 | /// Returns a version to skip. If skip value is false or not present then it will return null. 16 | public Version GetSkippedVersion() 17 | { 18 | // return Assembly.GetExecutingAssembly().GetName().Version; 19 | if (appSettings != null && appSettings.UpdaterSkippedVersion != null && appSettings.UpdaterSkippedVersion != "") 20 | { 21 | return new Version(appSettings.UpdaterSkippedVersion); 22 | } 23 | 24 | return new Version(0, 0, 0); 25 | } 26 | 27 | /// 28 | /// Reads the value containing the date and time at which the user must be given again the possibility to upgrade the application. 29 | /// 30 | /// Returns a DateTime value at which the user must be given again the possibility to upgrade the application. If remind later value is not present then it will return null. 31 | public DateTime? GetRemindLater() 32 | { 33 | if (appSettings?.UpdaterRemindLaterAt != null) 34 | { 35 | DateTime.TryParse(appSettings?.UpdaterRemindLaterAt, out DateTime result); 36 | return result; 37 | } 38 | 39 | return null; 40 | } 41 | 42 | /// 43 | /// Sets the values indicating the specific version that must be ignored by AutoUpdater. 44 | /// 45 | /// Version code for the specific version that must be ignored. Set it to null if you don't want to skip any version. 46 | public void SetSkippedVersion(Version version) 47 | { 48 | if (appSettings != null && version != null) 49 | { 50 | appSettings.UpdaterSkippedVersion = version.ToString(); 51 | appSettings.Save(); 52 | } 53 | } 54 | 55 | /// 56 | /// Sets the date and time at which the user must be given again the possibility to upgrade the application. 57 | /// 58 | /// Date and time at which the user must be given again the possibility to upgrade the application. 59 | public void SetRemindLater(DateTime? remindLaterAt) 60 | { 61 | if (appSettings != null && remindLaterAt != null) 62 | { 63 | appSettings.UpdaterRemindLaterAt = remindLaterAt.ToString(); 64 | appSettings.Save(); 65 | } 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /Common/ZenStates-Core-README.md: -------------------------------------------------------------------------------- 1 | # ZenStates-Core 2 | This project aims to provide a common functions for full SMU control on AMD Zen platform. 3 | The library is used in ZenTimings and ZenStates projects. 4 | 5 | ## CPU Support 6 | The following AMD Zen-based codenames are supported 7 | * SummitRidge 8 | * Whitehaven 9 | * Naples 10 | * RavenRidge 11 | * PinnacleRidge 12 | * Colfax 13 | * Picasso 14 | * FireFlight 15 | * Matisse 16 | * CastlePeak 17 | * Rome 18 | * Dali 19 | * Renoir 20 | * VanGogh 21 | * Vermeer 22 | * Chagall 23 | * Milan 24 | * Cezanne 25 | * Rembrandt 26 | * Lucienne 27 | 28 | ## How To 29 | First, reference the DLL in your .NET project and import it. 30 | ```c# 31 | using ZenStates.Core; 32 | ``` 33 | Then initialize it. Cpu is the main module. 34 | ```c# 35 | private readonly Cpu cpu = new Cpu(); 36 | ``` 37 | 38 | ## Modules 39 | ### `Cpu.info` 40 | 41 | | field | type | 42 | |----------------|-------------| 43 | | cpuid | uint | 44 | | family | Family | 45 | | codeName | CodeName | 46 | | cpuName | string | 47 | | packageType | PackageType | 48 | | baseModel | uint | 49 | | extModel | uint | 50 | | model | uint | 51 | | ccds | uint | 52 | | ccxs | uint | 53 | | coresPerCcx | uint | 54 | | cores | uint | 55 | | logicalCores | uint | 56 | | physicalCores | uint | 57 | | threadsPerCore | uint | 58 | | patchLevel | uint | 59 | | coreDisableMap | uint | 60 | | svi2 | SVI2 | 61 | 62 | 63 | where svi2 exposes the following fields corresponding to the SVI2 power planes 64 | 65 | | field | type | 66 | |----------------|-------------| 67 | | coreAddress | uint | 68 | | socAddress | uint | 69 | 70 | ### `Cpu.systemInfo` 71 | 72 | The module combines `Cpu.info` with additional information about the motherboard 73 | 74 | ## Projects used 75 | [ryzen_smu (gitlab)](https://gitlab.com/leogx9r/ryzen_smu/) 76 | [ryzen_nb_smu (github)](https://github.com/flygoat/ryzen_nb_smu) 77 | [zenpower (github)](https://github.com/ocerman/zenpower) 78 | [Linux kernel (github)](https://github.com/torvalds/linux) 79 | [AMD's public documentation](https://www.amd.com/en/support/tech-docs) 80 | [Open Hardware Monitor](https://github.com/openhardwaremonitor/openhardwaremonitor) 81 | 82 | with the help of patrickschur, leogx9r, PJVol, FlyGoat, sbski, 1usmus 83 | -------------------------------------------------------------------------------- /Common/ZenStates-Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/Common/ZenStates-Core.dll -------------------------------------------------------------------------------- /OHWMPlugin/OHWMPlugin.cs: -------------------------------------------------------------------------------- 1 | using OpenHardwareMonitor.Hardware; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using ZenTimings.Common; 10 | using ZenTimings.Plugin; 11 | 12 | namespace OHWMPlugin 13 | { 14 | public class OHWMPlugin : IPlugin 15 | { 16 | internal Computer computer; 17 | 18 | public string Name => "OpenHardwareMonitor Plugin"; 19 | 20 | public string Description => "A wrapper around OpenHardwareMonitor's DLL"; 21 | 22 | public string Author => "Ivan Rusanov"; 23 | 24 | public string Version => "1.0"; 25 | 26 | public List Sensors { get; internal set; } 27 | 28 | public OHWMPlugin() 29 | { 30 | Assembly assembly = Assembly.LoadFrom("OpenHardwareMonitorLib.dll"); 31 | if (assembly == null) 32 | { 33 | throw new Exception("OpenHardwareMonitorLib.dll not found"); 34 | } 35 | } 36 | 37 | public void Close() 38 | { 39 | throw new NotImplementedException(); 40 | } 41 | 42 | public void Open() 43 | { 44 | computer = new Computer() 45 | { 46 | //CPUEnabled = true, 47 | //RAMEnabled = true, 48 | MainboardEnabled = true, 49 | //FanControllerEnabled = true, 50 | }; 51 | 52 | computer.Open(); 53 | int index = 0; 54 | 55 | foreach (var hardware in computer.Hardware) 56 | { 57 | if (hardware.HardwareType == HardwareType.Mainboard) 58 | { 59 | foreach (var subHardware in hardware.SubHardware) 60 | { 61 | foreach (var subsensor in subHardware.Sensors) 62 | { 63 | //if (subsensor.SensorType == SensorType.Voltage) 64 | Console.WriteLine($"----{subsensor.SensorType}, Name: {subsensor.Name}, Value: {subsensor.Value}"); 65 | Sensors.Add(new Sensor(subsensor.Name, index)); 66 | index++; 67 | } 68 | } 69 | } 70 | } 71 | } 72 | 73 | public bool Update() 74 | { 75 | int index = 0; 76 | 77 | foreach (var hardware in computer.Hardware) 78 | { 79 | if (hardware.HardwareType == HardwareType.Mainboard) 80 | { 81 | foreach (var subHardware in hardware.SubHardware) 82 | { 83 | subHardware.Update(); 84 | 85 | foreach (var subsensor in subHardware.Sensors) 86 | { 87 | Sensors[index].Value = subsensor.Value; 88 | } 89 | } 90 | } 91 | } 92 | 93 | return true; 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /OHWMPlugin/OHWMPlugin.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {29941469-27AD-4C9B-8DE2-7E971105A99C} 8 | Library 9 | Properties 10 | ZenTimings.Plugin 11 | OHWMPlugin 12 | v4.5 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\Common\OpenHardwareMonitorLib.dll 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | ISensor.cs 49 | 50 | 51 | Sensor.cs 52 | 53 | 54 | IPlugin.cs 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /OHWMPlugin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OHWMPlugin")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OHWMPlugin")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("29941469-27ad-4c9b-8de2-7e971105a99c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZenTimings 2 | 3 | ![ZenTimings](screenshot.png "ZenTimings") 4 | 5 | ### Projects used 6 | [Adonis UI (github)](https://benruehl.github.io/adonis-ui/) 7 | [RTCSharp (github)](https://github.com/tomrus88/RTCSharp) 8 | [ryzen_smu (gitlab)](https://gitlab.com/leogx9r/ryzen_smu/) 9 | [ryzen_nb_smu (github)](https://github.com/flygoat/ryzen_nb_smu) 10 | [zenpower (github)](https://github.com/ocerman/zenpower) 11 | [Linux kernel (github)](https://github.com/torvalds/linux) 12 | [AMD's public documentation](https://www.amd.com/en/support/tech-docs) 13 | [Open Hardware Monitor](https://github.com/openhardwaremonitor/openhardwaremonitor) 14 | -------------------------------------------------------------------------------- /WPF-no-themes/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /WPF-no-themes/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Threading; 4 | using System.Windows; 5 | using System.Windows.Markup; 6 | using ZenStates.Core; 7 | using ZenTimings.Windows; 8 | 9 | namespace ZenTimings 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App 15 | { 16 | internal const string mutexName = "Local\\ZenTimings"; 17 | internal static Mutex instanceMutex; 18 | internal bool createdNew; 19 | public Updater updater; 20 | 21 | protected override void OnStartup(StartupEventArgs e) 22 | { 23 | instanceMutex = new Mutex(true, mutexName, out createdNew); 24 | 25 | if (!createdNew) 26 | { 27 | // App is already running! Exit the application and show the other window. 28 | InteropMethods.PostMessage((IntPtr)InteropMethods.HWND_BROADCAST, InteropMethods.WM_SHOWME, 29 | IntPtr.Zero, IntPtr.Zero); 30 | Current.Shutdown(); 31 | Environment.Exit(0); 32 | } 33 | 34 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 35 | Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); 36 | FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata( 37 | XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); 38 | 39 | updater = new Updater(); 40 | 41 | GC.KeepAlive(instanceMutex); 42 | SplashWindow.Start(); 43 | base.OnStartup(e); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /WPF-no-themes/AppSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Windows; 4 | using System.Xml.Serialization; 5 | 6 | namespace ZenTimings 7 | { 8 | [Serializable] 9 | public sealed class AppSettings 10 | { 11 | public const int VersionMajor = 1; 12 | public const int VersionMinor = 4; 13 | 14 | private static readonly string Filename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.xml"); 15 | 16 | private static AppSettings _instance = null; 17 | 18 | private AppSettings() { } 19 | 20 | public static AppSettings Instance 21 | { 22 | get 23 | { 24 | if (_instance == null) 25 | { 26 | _instance = new AppSettings().Load(); 27 | } 28 | 29 | return _instance; 30 | } 31 | } 32 | 33 | public enum Theme : int 34 | { 35 | Light, 36 | Dark, 37 | DarkMint, 38 | DarkMintGradient, 39 | DarkRed, 40 | Dracula, 41 | RetroWave, 42 | BurntOrange, 43 | } 44 | 45 | public enum ScreenshotType : int 46 | { 47 | Window, 48 | Desktop, 49 | } 50 | 51 | public AppSettings Create(bool save = true) 52 | { 53 | if (save) Save(); 54 | 55 | return this; 56 | } 57 | 58 | public AppSettings Reset() => Create(); 59 | 60 | public AppSettings Load() 61 | { 62 | try 63 | { 64 | if (File.Exists(Filename)) 65 | { 66 | using (StreamReader sr = new StreamReader(Filename)) 67 | { 68 | XmlSerializer xmls = new XmlSerializer(typeof(AppSettings)); 69 | return xmls.Deserialize(sr) as AppSettings; 70 | } 71 | } 72 | } 73 | catch (Exception ex) 74 | { 75 | Console.WriteLine(ex.Message); 76 | MessageBox.Show( 77 | "Invalid or outdated settings file!\nSettings will be reset to defaults.", 78 | "Error", 79 | MessageBoxButton.OK, 80 | MessageBoxImage.Error); 81 | } 82 | 83 | return Create(); 84 | } 85 | 86 | public void Save() 87 | { 88 | try 89 | { 90 | Version = $"{VersionMajor}.{VersionMinor}"; 91 | using (StreamWriter sw = new StreamWriter(Filename)) 92 | { 93 | XmlSerializer xmls = new XmlSerializer(typeof(AppSettings)); 94 | xmls.Serialize(sw, this); 95 | } 96 | } 97 | catch (Exception ex) 98 | { 99 | Console.WriteLine(ex.Message); 100 | MessageBox.Show( 101 | "Could not save settings to file!", 102 | "Error", 103 | MessageBoxButton.OK, 104 | MessageBoxImage.Error); 105 | } 106 | } 107 | 108 | public string Version { get; set; } = $"{VersionMajor}.{VersionMinor}"; 109 | public bool AutoRefresh { get; set; } = true; 110 | public int AutoRefreshInterval { get; set; } = 2000; 111 | public bool AdvancedMode { get; set; } = true; 112 | public Theme AppTheme { get; set; } = Theme.DarkMintGradient; 113 | public ScreenshotType ScreenshotMode { get; set; } = ScreenshotType.Window; 114 | public bool CheckForUpdates { get; set; } = true; 115 | public string UpdaterSkippedVersion { get; set; } = ""; 116 | public string UpdaterRemindLaterAt { get; set; } = ""; 117 | public bool MinimizeToTray { get; set; } 118 | public bool SaveWindowPosition { get; set; } 119 | public bool AutoUninstallDriver { get; set; } = true; 120 | public double WindowLeft { get; set; } 121 | public double WindowTop { get; set; } 122 | public double SysInfoWindowLeft { get; set; } 123 | public double SysInfoWindowTop { get; set; } 124 | public double SysInfoWindowWidth { get; set; } 125 | public double SysInfoWindowHeight { get; set; } 126 | public string NotifiedChangelog { get; set; } = ""; 127 | public string NotifiedRembrandt { get; set; } = ""; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /WPF-no-themes/Common/ISensor.cs: -------------------------------------------------------------------------------- 1 | namespace ZenTimings.Common 2 | { 3 | public interface ISensor 4 | { 5 | int Index { get; } 6 | string Name { get; } 7 | float? Value { get; } 8 | float? Min { get; } 9 | float? Max { get; } 10 | void ResetMin(); 11 | void ResetMax(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /WPF-no-themes/Common/Sensor.cs: -------------------------------------------------------------------------------- 1 | namespace ZenTimings.Common 2 | { 3 | public class Sensor : ISensor 4 | { 5 | private float? currentValue; 6 | 7 | public int Index { get; } 8 | public string Name { get; } 9 | public float? Value 10 | { 11 | get => currentValue; 12 | set 13 | { 14 | if (value != null && value != currentValue) 15 | { 16 | currentValue = value; 17 | 18 | if (Max == null || currentValue > Max) 19 | Max = currentValue; 20 | else if (Min == null || currentValue < Min) 21 | Min = currentValue; 22 | } 23 | } 24 | } 25 | public float? Min { get; private set; } 26 | public float? Max { get; private set; } 27 | 28 | public Sensor(string name, int index) 29 | { 30 | Name = name ?? ""; 31 | Index = index; 32 | } 33 | 34 | public void ResetMin() => Min = null; 35 | public void ResetMax() => Max = null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /WPF-no-themes/Plugin/IPlugin.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using ZenTimings.Common; 3 | 4 | namespace ZenTimings.Plugin 5 | { 6 | public interface IPlugin 7 | { 8 | string Name { get; } 9 | string Description { get; } 10 | string Author { get; } 11 | string Version { get; } 12 | List Sensors { get; } 13 | void Open(); 14 | void Close(); 15 | bool Update(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /WPF-no-themes/Plugin/OHWMPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using ZenTimings.Common; 5 | 6 | namespace ZenTimings.Plugin 7 | { 8 | public class OHWMPlugin : IPlugin 9 | { 10 | internal dynamic computer; 11 | internal Assembly assembly; 12 | internal Type Mainboard; 13 | public string Name => "OpenHardwareMonitor Plugin"; 14 | 15 | public string Description => "A wrapper around OpenHardwareMonitor's DLL"; 16 | 17 | public string Author => "Ivan Rusanov"; 18 | 19 | public string Version => "1.0"; 20 | 21 | public List Sensors { get; internal set; } 22 | 23 | public OHWMPlugin() 24 | { 25 | try 26 | { 27 | assembly = Assembly.LoadFrom("OpenHardwareMonitorLib.dll"); 28 | Type type = assembly.GetType("OpenHardwareMonitor.Hardware.Computer"); 29 | computer = Activator.CreateInstance(type); 30 | Mainboard = assembly.GetType("OpenHardwareMonitor.Hardware.Mainboard.Mainboard"); 31 | } 32 | catch (Exception ex) 33 | { 34 | Close(); 35 | } 36 | } 37 | 38 | public void Close() 39 | { 40 | computer?.Close(); 41 | assembly = null; 42 | } 43 | 44 | public void Open() 45 | { 46 | Sensors = new List(); 47 | computer.MainboardEnabled = true; 48 | computer.Open(); 49 | 50 | foreach (var hardware in computer.Hardware) 51 | { 52 | if (GetPropValue(hardware, "HardwareType").ToString() == "Mainboard") 53 | { 54 | foreach (var subHardware in GetPropValue(hardware, "SubHardware")) 55 | { 56 | Type type = subHardware.GetType(); 57 | // subHardware.Update(); 58 | 59 | type.InvokeMember("Update", 60 | BindingFlags.Default | BindingFlags.InvokeMethod, 61 | null, 62 | subHardware, 63 | null); 64 | 65 | foreach (var subsensor in GetPropValue(subHardware, "Sensors")) 66 | { 67 | if (GetPropValue(subsensor, "SensorType").ToString() == "Voltage") 68 | { 69 | // Console.WriteLine($"----Index: {GetPropValue(subsensor, "Index")}, {GetPropValue(subsensor, "SensorType")}, Name: {GetPropValue(subsensor, "Name")}, Value: {GetPropValue(subsensor, "Value")}"); 70 | try 71 | { 72 | Sensors.Add( 73 | new Sensor((string)GetPropValue(subsensor, "Name"), (int)GetPropValue(subsensor, "Index")) 74 | { 75 | Value = GetPropValue(subsensor, "Value") ?? 0, 76 | } 77 | ); 78 | } 79 | catch { } 80 | } 81 | } 82 | } 83 | } 84 | } 85 | } 86 | 87 | public bool Update() 88 | { 89 | foreach (var hardware in computer.Hardware) 90 | { 91 | if (GetPropValue(hardware, "HardwareType").ToString() == "Mainboard") 92 | { 93 | foreach (var subHardware in GetPropValue(hardware, "SubHardware")) 94 | { 95 | Type type = subHardware.GetType(); 96 | // subHardware.Update(); 97 | 98 | type.InvokeMember("Update", 99 | BindingFlags.Default | BindingFlags.InvokeMethod, 100 | null, 101 | subHardware, 102 | null); 103 | 104 | foreach (var subsensor in GetPropValue(subHardware, "Sensors")) 105 | { 106 | if (GetPropValue(subsensor, "SensorType").ToString() == "Voltage") 107 | { 108 | Sensors[(int)GetPropValue(subsensor, "Index")].Value = GetPropValue(subsensor, "Value") ?? 0; 109 | } 110 | } 111 | } 112 | } 113 | } 114 | 115 | return true; 116 | } 117 | 118 | private static object GetPropValue(object src, string propName) 119 | { 120 | return src.GetType().GetProperty(propName)?.GetValue(src, null); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /WPF-no-themes/Plugin/SVI2Plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ZenStates.Core; 4 | using ZenTimings.Common; 5 | 6 | namespace ZenTimings.Plugin 7 | { 8 | public class SVI2Plugin : IPlugin 9 | { 10 | internal Cpu _cpu; 11 | internal int timeout = 20; 12 | internal const string VERSION = "1.1"; 13 | 14 | public string Name => "SVI2 Sensors"; 15 | 16 | public string Description => ""; 17 | 18 | public string Author => ""; 19 | 20 | public string Version => VERSION; 21 | 22 | public List Sensors { get; private set; } 23 | 24 | public SVI2Plugin(Cpu cpu) 25 | { 26 | if (cpu != null && cpu.Status == IOModule.LibStatus.OK) 27 | { 28 | _cpu = cpu; 29 | Sensors = new List 30 | { 31 | new Sensor("VSOC", 0), 32 | new Sensor("VCORE", 1), 33 | }; 34 | } 35 | } 36 | 37 | public bool Update() 38 | { 39 | if (Sensors?.Count > 0) 40 | { 41 | uint soc_plane_value; 42 | uint vcore_plane_value; 43 | do 44 | { 45 | soc_plane_value = _cpu.ReadDword(_cpu.info.svi2.socAddress); 46 | vcore_plane_value = _cpu.ReadDword(_cpu.info.svi2.coreAddress); 47 | } while ((soc_plane_value & 0xFF00) != 0 && (vcore_plane_value & 0xFF00) != 0 && --timeout > 0); 48 | 49 | if (timeout > 0) 50 | { 51 | uint socVid = (soc_plane_value >> 16) & 0xFF; 52 | Sensors[0].Value = Convert.ToSingle(Utils.VidToVoltage(socVid)); 53 | 54 | Console.WriteLine("Vsoc: " + Sensors[0].Min + " " + Sensors[0].Max); 55 | 56 | uint coreVid = (vcore_plane_value >> 16) & 0xFF; 57 | Sensors[1].Value = Convert.ToSingle(Utils.VidToVoltage(coreVid)); 58 | 59 | Console.WriteLine("Vcore: " + Sensors[1].Min + " " + Sensors[1].Max); 60 | return true; 61 | } 62 | } 63 | 64 | return false; 65 | } 66 | 67 | public void Open() 68 | { 69 | throw new NotImplementedException(); 70 | } 71 | 72 | public void Close() 73 | { 74 | _cpu = null; 75 | Sensors = null; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /WPF-no-themes/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.InteropServices; 4 | using System.Windows; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ZenTimings")] 10 | [assembly: AssemblyDescription("Author: Ivan Rusanov")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("ZenTimings")] 13 | [assembly: AssemblyProduct("ZenTimings")] 14 | [assembly: AssemblyCopyright("Copyright © 2019-2025")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | //In order to begin building localizable applications, set 24 | //CultureYouAreCodingWith in your .csproj file 25 | //inside a . For example, if you are using US english 26 | //in your source files, set the to en-US. Then uncomment 27 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 28 | //the line below to match the UICulture setting in the project file. 29 | 30 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 31 | 32 | 33 | [assembly: ThemeInfo( 34 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 35 | //(used if a resource is not found in the page, 36 | // or application resource dictionaries) 37 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 38 | //(used if a resource is not found in the page, 39 | // app, or any theme specific resource dictionaries) 40 | )] 41 | 42 | 43 | // Version information for an assembly consists of the following four values: 44 | // 45 | // Major Version 46 | // Minor Version 47 | // Build Number 48 | // Revision 49 | // 50 | // You can specify all the values or you can default the Build and Revision Numbers 51 | // by using the '*' as shown below: 52 | // [assembly: AssemblyVersion("1.0.*")] 53 | // [assembly: AssemblyVersion("1.2.1.0")] 54 | // [assembly: AssemblyFileVersion("1.2.1.0")] 55 | [assembly: NeutralResourcesLanguage("en")] 56 | -------------------------------------------------------------------------------- /WPF-no-themes/Properties/BuildNumberTemplate.cs: -------------------------------------------------------------------------------- 1 | // 2 | // This code was generated by a tool. Any changes made manually will be lost 3 | // the next time this code is regenerated. 4 | // 5 | 6 | using System.Reflection; 7 | 8 | [assembly: AssemblyVersion("1.33.1599")] 9 | [assembly: AssemblyFileVersion("1.33.1599")] 10 | -------------------------------------------------------------------------------- /WPF-no-themes/Properties/BuildNumberTemplate.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#" #> 2 | // 3 | // This code was generated by a tool. Any changes made manually will be lost 4 | // the next time this code is regenerated. 5 | // 6 | 7 | using System.Reflection; 8 | 9 | [assembly: AssemblyVersion("1.33.<#= this.RevisionNumber #>")] 10 | [assembly: AssemblyFileVersion("1.33.<#= this.RevisionNumber #>")] 11 | <#+ 12 | int RevisionNumber = (int)(DateTime.UtcNow - new DateTime(2020,9,1)).TotalDays; 13 | #> -------------------------------------------------------------------------------- /WPF-no-themes/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ZenTimings.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZenTimings.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap _16 { 67 | get { 68 | object obj = ResourceManager.GetObject("_16", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap _64 { 77 | get { 78 | object obj = ResourceManager.GetObject("_64", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 85 | /// 86 | internal static System.Drawing.Icon ZenTimings2022 { 87 | get { 88 | object obj = ResourceManager.GetObject("ZenTimings2022", resourceCulture); 89 | return ((System.Drawing.Icon)(obj)); 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /WPF-no-themes/Resources/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/WPF-no-themes/Resources/64.png -------------------------------------------------------------------------------- /WPF-no-themes/Resources/ZenTimings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/WPF-no-themes/Resources/ZenTimings.ico -------------------------------------------------------------------------------- /WPF-no-themes/Resources/ZenTimings2022.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/WPF-no-themes/Resources/ZenTimings2022.ico -------------------------------------------------------------------------------- /WPF-no-themes/Resources/camera-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/WPF-no-themes/Resources/camera-dark.png -------------------------------------------------------------------------------- /WPF-no-themes/Resources/camera-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/WPF-no-themes/Resources/camera-light.png -------------------------------------------------------------------------------- /WPF-no-themes/Resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/irusanov/ZenTimings/fc34983637aa17bde1331ca78332c812a1a026c1/WPF-no-themes/Resources/splash.png -------------------------------------------------------------------------------- /WPF-no-themes/Themes/Base.xaml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 14 | 15 | 18 | 19 | 22 | 23 | 27 | 28 | 31 | 32 | 35 | 36 | 39 | 40 | 43 | 44 | 55 | 56 | 57 | 58 | 68 | 69 | 76 | 77 | 81 | 82 | 94 | -------------------------------------------------------------------------------- /WPF-no-themes/Themes/Light.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | #f3f3f3 24 | 25 | #f3f3f3 26 | 27 | #212529 28 | -------------------------------------------------------------------------------- /WPF-no-themes/Windows/AboutDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Reflection; 5 | using System.Windows; 6 | using System.Windows.Threading; 7 | 8 | namespace ZenTimings.Windows 9 | { 10 | /// 11 | /// Interaction logic for AboutDialog.xaml 12 | /// 13 | public partial class AboutDialog 14 | { 15 | private static readonly Updater updater = (Application.Current as App)?.updater; 16 | private DispatcherTimer notificationTimer; 17 | 18 | public AboutDialog() 19 | { 20 | var AssemblyTitle = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute( 21 | Assembly.GetExecutingAssembly(), 22 | typeof(AssemblyTitleAttribute), false)).Title; 23 | 24 | var AssemblyProduct = ((AssemblyProductAttribute)Attribute.GetCustomAttribute( 25 | Assembly.GetExecutingAssembly(), 26 | typeof(AssemblyProductAttribute), false)).Product; 27 | 28 | var AssemblyVersion = ((AssemblyFileVersionAttribute)Attribute.GetCustomAttribute( 29 | Assembly.GetExecutingAssembly(), 30 | typeof(AssemblyFileVersionAttribute), false)).Version; 31 | 32 | var AssemblyDescription = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute( 33 | Assembly.GetExecutingAssembly(), 34 | typeof(AssemblyDescriptionAttribute), false)).Description; 35 | 36 | var AssemblyCopyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute( 37 | Assembly.GetExecutingAssembly(), 38 | typeof(AssemblyCopyrightAttribute), false)).Copyright; 39 | 40 | 41 | InitializeComponent(); 42 | 43 | //this.Title = string.Format("About {0}", AssemblyTitle); 44 | this.labelProductName.Content = AssemblyProduct; 45 | this.labelVersion.Text = $"Version {AssemblyVersion}"; 46 | this.labelCopyright.Text = AssemblyCopyright; 47 | this.labelCompanyName.Text = AssemblyDescription; 48 | 49 | // List of all modules, there might be more DLL files in the directory 50 | string[] files = 51 | { 52 | //"AdonisUI.ClassicTheme.dll", 53 | //"AdonisUI.dll", 54 | "AutoUpdater.NET.dll", 55 | "inpoutx64.dll", 56 | "WinIo32.dll", 57 | "ZenStates-Core.dll", 58 | }; 59 | var appModules = new List>(); 60 | 61 | foreach (var file in files) 62 | { 63 | var version = "missing"; 64 | 65 | try 66 | { 67 | FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(file); 68 | version = fileVersionInfo.FileVersion.Replace(", ", "."); 69 | } 70 | catch (Exception) 71 | { 72 | // Do Nothing 73 | } 74 | 75 | appModules.Add(new KeyValuePair(file.Replace(".dll", ""), version)); 76 | } 77 | 78 | Modules.ItemsSource = appModules; 79 | updater.UpdateCheckCompleteEvent += Updater_UpdateCheckCompleteEvent; 80 | } 81 | 82 | private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) 83 | { 84 | Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); 85 | e.Handled = true; 86 | } 87 | 88 | private void CheckUpdateBtn_Click(object sender, RoutedEventArgs e) 89 | { 90 | updater.CheckForUpdate(true); 91 | } 92 | 93 | private void Updater_UpdateCheckCompleteEvent(object sender, EventArgs e) 94 | { 95 | if (notificationTimer != null) 96 | { 97 | if (notificationTimer.IsEnabled) notificationTimer.Stop(); 98 | } 99 | 100 | notificationTimer = new DispatcherTimer 101 | { 102 | Interval = TimeSpan.FromMilliseconds(6000) 103 | }; 104 | 105 | notificationTimer.Tick += new EventHandler((s, x) => 106 | { 107 | notificationTimer.Stop(); 108 | aboutWindowPopup.IsOpen = false; 109 | }); 110 | 111 | notificationTimer.Start(); 112 | 113 | aboutWindowPopup.Width = AboutWindowContent.ActualWidth; 114 | aboutWindowPopup.IsOpen = true; 115 | } 116 | 117 | private void AboutWindowPopup_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) 118 | { 119 | aboutWindowPopup.IsOpen = false; 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /WPF-no-themes/Windows/DebugDialog.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 32 | Click on Debug button to generate a report. 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |