Volume Control
Application-specific hotkeys for Windows
VolumeControl.Core.Config Class Reference

Contains the application configuration and logic to read from and write to JSON files. More...

Inheritance diagram for VolumeControl.Core.Config:
Collaboration diagram for VolumeControl.Core.Config:

Public Member Functions

 Config (string filePath)
 Creates a new Config instance. More...
 
void ResumeAutoSave ()
 Resumes automatic saving of the config to disk whenever a PropertyChanged event is triggered. More...
 
void PauseAutoSave ()
 Pauses automatic saving of the config to disk whenever a PropertyChanged event is triggered. More...
 
void AttachReflectivePropertyChangedHandlers ()
 Attaches autosave event handlers to properties that have notifications More...
 
void Save (Formatting formatting=Formatting.Indented, [CallerMemberName] string callerName="")
 
override bool Load ()
 

Static Public Attributes

static readonly JsonHotkey[] Hotkeys_Default
 Default hotkey configuration. More...
 
const string DefaultLogPath = "VolumeControl.log"
 The default log file path. More...
 

Properties

static Config Default [get]
 The default Config instance. More...
 
string LanguageName = "English (US/CA)" [get, set]
 Gets or sets the name of the current localization language. More...
 
bool LogMissingTranslations = true [get, set]
 Gets or sets whether missing translation keys cause a log message to be written. More...
 
ObservableImmutableList< string > LocalizationDirectories = new() [get, set]
 Gets or sets a list of directories to load localization packages from. More...
 
bool AllowMultipleDistinctInstances = false [get, set]
 Gets or sets whether multiple distinct instances of Volume Control are allowed to run concurrently.
In this case, distinct means that each instance is using a different config file.

This works by creating a MD5 hash of AppConfig.ConfigurationFile.Location, and appending it to the instance's mutex ID, seperated with a colon (:).
The initialization process of acquiring a mutex lock is still performed, which will always prevent Volume Control from running alongside other instances using the same config as itself, regardless of this setting. More...
 
bool RunAtStartup = false [get, set]
 Gets or sets whether the application should run when Windows starts.
Creates/deletes a registry value in HKEY_CURRENT_USER => SOFTWARE\Microsoft\Windows\CurrentVersion\Run More...
 
bool StartMinimized = false [get, set]
 Gets or sets whether the window should be minimized during startup.
The window can be shown again later using the tray icon. More...
 
bool ShowInTaskbar = true [get, set]
 Gets or sets whether the taskbar icon is visible when the window isn't minimized. More...
 
bool AlwaysOnTop = false [get, set]
 Gets or sets whether volume control should always appear on top of other windows when the window isn't minimized. More...
 
bool DeleteHotkeyConfirmation = true [get, set]
 Gets or sets whether confirmation is required to delete a hotkey. More...
 
bool ShowIcons = true [get, set]
 Gets or sets whether or not device/session icons are shown in the UI. More...
 
ObservableImmutableList< string > CustomAddonDirectories = new() [get, set]
 List of directories that should be checked for addons in addition to the default one. More...
 
bool AllowTransparency = true [get, set]
 Gets or sets whether the main window allows transparency effects.

  • When true, window background transparency is allowed.
  • When false, window background transparency isn't allowed;
    only controls within the window may use transparent background effects.
    (See System.Windows.Controls.Control.Background)
More...
 
bool KeepRelativePosition = false [get, set]
 Gets or sets whether the main window keeps its position relative to the nearest screen corner when its size changes. More...
 
bool RestoreMainWindowPosition = false [get, set]
 Gets or sets whether the main window should have its last known position restored when the application starts. More...
 
EScreenCorner MainWindowOriginCorner = EScreenCorner.TopLeft [get, set]
 Gets or sets the origin corner to use when restoring the main window's position. More...
 
Point? MainWindowPosition = null [get, set]
 Gets or sets the position to restore the main window to when the application starts. More...
 
NotificationConfigSection SessionListNotificationConfig = new() [get, set]
 Gets or sets the configuration for the SessionListNotification window. More...
 
NotificationConfigSection DeviceListNotificationConfig [get, set]
 Gets or sets the configuration for the DeviceListNotification window. More...
 
bool NotificationMoveRequiresAlt = false [get, set]
 Gets or sets whether the notification can be dragged without holding down the ALT key. More...
 
bool NotificationSavePos = true [get, set]
 Gets or sets whether the notification window position is restored when the program starts. More...
 
bool NotificationExtraMouseControlsEnabled = true [get, set]
 Gets or sets whether extra mouse controls are enabled in the notification window.
Extra mouse controls include Right-Click to deselect & Middle-Click to toggle selection lock. More...
 
bool CheckForUpdates = true [get, set]
 Gets or sets whether the program should check for updates on startup. More...
 
bool ShowUpdatePrompt = true [get, set]
 Gets or sets whether a message box prompt is shown informing the user of an available update. More...
 
JsonHotkey[] Hotkeys = null! [get, set]
 The current hotkey configuration, or null if the default configuration should be used instead. More...
 
TargetInfo TargetSession = TargetInfo.Empty [get, set]
 Gets or sets the last target session. More...
 
ObservableImmutableList< TargetInfoSelectedSessions = new() [get, set]
 Gets or sets the list of selected sessions. More...
 
bool LockTargetSession = false [get, set]
 Gets or sets whether the target session is locked. More...
 
bool HideInactiveSessions = true [get, set]
 Hide inactive sessions from notification and hotkey navigation. More...
 
string TargetDeviceID = string.Empty [get, set]
 Gets or sets the target device ID. More...
 
bool LockTargetDevice = false [get, set]
 Gets or sets whether the target device is locked. More...
 
int VolumeStepSize = 2 [get, set]
 Gets or sets the amount of volume added or subtracted from the current volume level when volume change hotkeys are pressed. More...
 
int PeakMeterUpdateIntervalMs = 100 [get, set]
 Gets or sets the interval (in milliseconds) between updating the audio peak meters. More...
 
bool ShowPeakMeters = true [get, set]
 Gets or sets whether or not peak meters are shown in the mixer. More...
 
bool EnableDeviceControl = false [get, set]
 Gets or sets whether volume & mute controls are visible in the Audio Devices list. More...
 
ObservableImmutableList< string > HiddenSessionProcessNames = new() [get, set]
 Gets or sets the list of (process names of) hidden audio sessions. More...
 
bool EnableInputDevices = false [get, set]
 Gets or sets a value that indicates whether input devices are loaded by the AudioDeviceManager. More...
 
bool EnableLogging = true [get, set]
 Gets or sets whether the log is enabled or not. More...
 
string LogPath = DefaultLogPath [get, set]
 Gets or sets the location of the log file. More...
 
EventType LogFilter = EventType.INFO | EventType.WARN | EventType.ERROR | EventType.FATAL | EventType.CRITICAL [get, set]
 Gets or sets the Log.EventType filter used for messages. More...
 
bool LogClearOnInitialize = true [get, set]
 Gets or sets whether the log is cleared when the program starts. More...
 
SemVersion __VERSION__ = new(0) [get, set]
 Gets or sets the version number identifier of the last Volume Control instance to access this config file. More...
 

Detailed Description

Contains the application configuration and logic to read from and write to JSON files.

Constructor & Destructor Documentation

◆ Config()

VolumeControl.Core.Config.Config ( string  filePath)

Creates a new Config instance.

The first time this is called, the AppConfig.Configuration.DefaultInstance property is set to that instance; all subsequent calls do not update this property.

Member Function Documentation

◆ AttachReflectivePropertyChangedHandlers()

void VolumeControl.Core.Config.AttachReflectivePropertyChangedHandlers ( )

Attaches autosave event handlers to properties that have notifications

◆ PauseAutoSave()

void VolumeControl.Core.Config.PauseAutoSave ( )

Pauses automatic saving of the config to disk whenever a PropertyChanged event is triggered.

References VolumeControl.Log.FLog.FilterEventType(), and VolumeControl.Log.FLog.Trace().

Here is the call graph for this function:

◆ ResumeAutoSave()

void VolumeControl.Core.Config.ResumeAutoSave ( )

Resumes automatic saving of the config to disk whenever a PropertyChanged event is triggered.

References VolumeControl.Log.FLog.FilterEventType(), and VolumeControl.Log.FLog.Trace().

Here is the call graph for this function:

Member Data Documentation

◆ DefaultLogPath

const string VolumeControl.Core.Config.DefaultLogPath = "VolumeControl.log"
static

The default log file path.

◆ Hotkeys_Default

readonly JsonHotkey [] VolumeControl.Core.Config.Hotkeys_Default
static

Default hotkey configuration.

Property Documentation

◆ __VERSION__

SemVersion VolumeControl.Core.Config.__VERSION__ = new(0)
getset

Gets or sets the version number identifier of the last Volume Control instance to access this config file.

Default: 0.0.0

◆ AllowMultipleDistinctInstances

bool VolumeControl.Core.Config.AllowMultipleDistinctInstances = false
getset

Gets or sets whether multiple distinct instances of Volume Control are allowed to run concurrently.
In this case, distinct means that each instance is using a different config file.

This works by creating a MD5 hash of AppConfig.ConfigurationFile.Location, and appending it to the instance's mutex ID, seperated with a colon (:).
The initialization process of acquiring a mutex lock is still performed, which will always prevent Volume Control from running alongside other instances using the same config as itself, regardless of this setting.

Default: false

◆ AllowTransparency

bool VolumeControl.Core.Config.AllowTransparency = true
getset

Gets or sets whether the main window allows transparency effects.

  • When true, window background transparency is allowed.
  • When false, window background transparency isn't allowed;
    only controls within the window may use transparent background effects.
    (See System.Windows.Controls.Control.Background)

Default: true

◆ AlwaysOnTop

bool VolumeControl.Core.Config.AlwaysOnTop = false
getset

Gets or sets whether volume control should always appear on top of other windows when the window isn't minimized.

Default: false

◆ CheckForUpdates

bool VolumeControl.Core.Config.CheckForUpdates = true
getset

Gets or sets whether the program should check for updates on startup.

◆ CustomAddonDirectories

ObservableImmutableList<string> VolumeControl.Core.Config.CustomAddonDirectories = new()
getset

List of directories that should be checked for addons in addition to the default one.

Default: {}

◆ Default

Config VolumeControl.Core.Config.Default
staticget

The default Config instance.

◆ DeleteHotkeyConfirmation

bool VolumeControl.Core.Config.DeleteHotkeyConfirmation = true
getset

Gets or sets whether confirmation is required to delete a hotkey.

◆ DeviceListNotificationConfig

NotificationConfigSection VolumeControl.Core.Config.DeviceListNotificationConfig
getset
Initial value:
= new()
{
LockedColor = Color.FromRgb(0xA7, 0x33, 0x74),
UnlockedColor = Color.FromRgb(0x49, 0x80, 0x49),
}

Gets or sets the configuration for the DeviceListNotification window.

Referenced by VolumeControl.SDK.VCAPI.ShowDeviceListNotification().

◆ EnableDeviceControl

bool VolumeControl.Core.Config.EnableDeviceControl = false
getset

Gets or sets whether volume & mute controls are visible in the Audio Devices list.

◆ EnableInputDevices

bool VolumeControl.Core.Config.EnableInputDevices = false
getset

Gets or sets a value that indicates whether input devices are loaded by the AudioDeviceManager.

◆ EnableLogging

bool VolumeControl.Core.Config.EnableLogging = true
getset

Gets or sets whether the log is enabled or not.

Default: true

◆ HiddenSessionProcessNames

ObservableImmutableList<string> VolumeControl.Core.Config.HiddenSessionProcessNames = new()
getset

Gets or sets the list of (process names of) hidden audio sessions.

◆ HideInactiveSessions

bool VolumeControl.Core.Config.HideInactiveSessions = true
getset

◆ Hotkeys

JsonHotkey [] VolumeControl.Core.Config.Hotkeys = null!
getset

The current hotkey configuration, or null if the default configuration should be used instead.

◆ KeepRelativePosition

bool VolumeControl.Core.Config.KeepRelativePosition = false
getset

Gets or sets whether the main window keeps its position relative to the nearest screen corner when its size changes.

Returns
true when the main window

◆ LanguageName

string VolumeControl.Core.Config.LanguageName = "English (US/CA)"
getset

Gets or sets the name of the current localization language.

Default: "English (US/CA)"

◆ LocalizationDirectories

ObservableImmutableList<string> VolumeControl.Core.Config.LocalizationDirectories = new()
getset

Gets or sets a list of directories to load localization packages from.

Default: {}

◆ LockTargetDevice

bool VolumeControl.Core.Config.LockTargetDevice = false
getset

Gets or sets whether the target device is locked.

◆ LockTargetSession

bool VolumeControl.Core.Config.LockTargetSession = false
getset

Gets or sets whether the target session is locked.

◆ LogClearOnInitialize

bool VolumeControl.Core.Config.LogClearOnInitialize = true
getset

Gets or sets whether the log is cleared when the program starts.

Default: true

◆ LogFilter

EventType VolumeControl.Core.Config.LogFilter = EventType.INFO | EventType.WARN | EventType.ERROR | EventType.FATAL | EventType.CRITICAL
getset

Gets or sets the Log.EventType filter used for messages.

◆ LogMissingTranslations

bool VolumeControl.Core.Config.LogMissingTranslations = true
getset

Gets or sets whether missing translation keys cause a log message to be written.

◆ LogPath

string VolumeControl.Core.Config.LogPath = DefaultLogPath
getset

Gets or sets the location of the log file.

Default: "VolumeControl.log"

◆ MainWindowOriginCorner

EScreenCorner VolumeControl.Core.Config.MainWindowOriginCorner = EScreenCorner.TopLeft
getset

Gets or sets the origin corner to use when restoring the main window's position.

◆ MainWindowPosition

Point? VolumeControl.Core.Config.MainWindowPosition = null
getset

Gets or sets the position to restore the main window to when the application starts.

◆ NotificationExtraMouseControlsEnabled

bool VolumeControl.Core.Config.NotificationExtraMouseControlsEnabled = true
getset

Gets or sets whether extra mouse controls are enabled in the notification window.
Extra mouse controls include Right-Click to deselect & Middle-Click to toggle selection lock.

◆ NotificationMoveRequiresAlt

bool VolumeControl.Core.Config.NotificationMoveRequiresAlt = false
getset

Gets or sets whether the notification can be dragged without holding down the ALT key.

◆ NotificationSavePos

bool VolumeControl.Core.Config.NotificationSavePos = true
getset

Gets or sets whether the notification window position is restored when the program starts.

◆ PeakMeterUpdateIntervalMs

int VolumeControl.Core.Config.PeakMeterUpdateIntervalMs = 100
getset

Gets or sets the interval (in milliseconds) between updating the audio peak meters.

◆ RestoreMainWindowPosition

bool VolumeControl.Core.Config.RestoreMainWindowPosition = false
getset

Gets or sets whether the main window should have its last known position restored when the application starts.

◆ RunAtStartup

bool VolumeControl.Core.Config.RunAtStartup = false
getset

Gets or sets whether the application should run when Windows starts.
Creates/deletes a registry value in HKEY_CURRENT_USER => SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Default: false

◆ SelectedSessions

ObservableImmutableList<TargetInfo> VolumeControl.Core.Config.SelectedSessions = new()
getset

Gets or sets the list of selected sessions.

◆ SessionListNotificationConfig

NotificationConfigSection VolumeControl.Core.Config.SessionListNotificationConfig = new()
getset

Gets or sets the configuration for the SessionListNotification window.

Referenced by VolumeControl.SDK.VCAPI.ShowSessionListNotification().

◆ ShowIcons

bool VolumeControl.Core.Config.ShowIcons = true
getset

Gets or sets whether or not device/session icons are shown in the UI.

Default: true

◆ ShowInTaskbar

bool VolumeControl.Core.Config.ShowInTaskbar = true
getset

Gets or sets whether the taskbar icon is visible when the window isn't minimized.

Default: true

◆ ShowPeakMeters

bool VolumeControl.Core.Config.ShowPeakMeters = true
getset

Gets or sets whether or not peak meters are shown in the mixer.

◆ ShowUpdatePrompt

bool VolumeControl.Core.Config.ShowUpdatePrompt = true
getset

Gets or sets whether a message box prompt is shown informing the user of an available update.

When this is disabled, updates are notified through the caption bar.

◆ StartMinimized

bool VolumeControl.Core.Config.StartMinimized = false
getset

Gets or sets whether the window should be minimized during startup.
The window can be shown again later using the tray icon.

Default: false

◆ TargetDeviceID

string VolumeControl.Core.Config.TargetDeviceID = string.Empty
getset

Gets or sets the target device ID.

◆ TargetSession

TargetInfo VolumeControl.Core.Config.TargetSession = TargetInfo.Empty
getset

Gets or sets the last target session.

◆ VolumeStepSize

int VolumeControl.Core.Config.VolumeStepSize = 2
getset

Gets or sets the amount of volume added or subtracted from the current volume level when volume change hotkeys are pressed.


The documentation for this class was generated from the following file: