-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to see active audio profile
Added registry checks to see which audio profile is currently active. Reflect the active profile within the UI
- Loading branch information
1 parent
86d53f4
commit c6346cf
Showing
10 changed files
with
194 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<Application x:Class="MiToolz.App" | ||
<Application | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="MiToolz.App" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
<System:String x:Key="VersionNo" xml:space="preserve"> MiToolz v2.7.0 </System:String> | ||
<System:String x:Key="VersionDate" xml:space="preserve"> Build Date : 07-05-2020 </System:String> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using Microsoft.Win32; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Xml.Linq; | ||
|
||
namespace MiToolz | ||
{ | ||
class ConfigManager | ||
{ | ||
readonly string Path; | ||
readonly string EXE = Assembly.GetExecutingAssembly().GetName().Name; | ||
|
||
[DllImport("kernel32", CharSet = CharSet.Unicode)] | ||
static extern long WritePrivateProfileString(string Section, string Key, string Value, string FilePath); | ||
|
||
[DllImport("kernel32", CharSet = CharSet.Unicode)] | ||
static extern int GetPrivateProfileString(string Section, string Key, string Default, StringBuilder RetVal, int Size, string FilePath); | ||
|
||
//ini file management > | ||
public ConfigManager(string IniPath = null) | ||
{ | ||
Path = new FileInfo(IniPath ?? EXE + ".ini").FullName; | ||
} | ||
|
||
public string IniRead(string Key, string Section = null) | ||
{ | ||
var RetVal = new StringBuilder(255); | ||
GetPrivateProfileString(Section ?? EXE, Key, "", RetVal, 255, Path); | ||
return RetVal.ToString(); | ||
} | ||
|
||
public void IniWrite(string Key, string Value, string Section = null) | ||
{ | ||
WritePrivateProfileString(Section ?? EXE, Key, Value, Path); | ||
} | ||
|
||
public void IniDeleteKey(string Key, string Section = null) | ||
{ | ||
IniWrite(Key, null, Section ?? EXE); | ||
} | ||
|
||
public void IniDeleteSection(string Section = null) | ||
{ | ||
IniWrite(null, null, Section ?? EXE); | ||
} | ||
|
||
public bool IniKeyExists(string Key, string Section = null) | ||
{ | ||
return IniRead(Key, Section).Length > 0; | ||
} | ||
|
||
//registry key management > | ||
public string RegReadKeyValue(string subKey, string key) | ||
|
||
{ | ||
string str = string.Empty; | ||
|
||
using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(subKey)) | ||
|
||
{ | ||
if (registryKey != null) | ||
{ | ||
str = registryKey.GetValue(key).ToString(); | ||
registryKey.Close(); | ||
} | ||
} | ||
return str; | ||
} | ||
|
||
//xml file management > | ||
public string XmlRead(string FullXmlFilePath) | ||
{ | ||
string str = string.Empty; | ||
|
||
//read xml entry for 'profile_name' in xml located in 'FullXmlFilePath' return profile name value | ||
|
||
XDocument doc = XDocument.Load(FullXmlFilePath); | ||
var selectors = from elements in doc.Elements("profile").Elements("info") | ||
select elements; | ||
|
||
foreach (var element in selectors) | ||
{ | ||
str = element.Element("profile_name").Value; | ||
//MessageBox.Show(element.Element("profile_name").Value); | ||
} | ||
|
||
return str; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.