-
Notifications
You must be signed in to change notification settings - Fork 5
/
Program.cs
76 lines (66 loc) · 1.75 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using Microsoft.Win32;
namespace CameraPrefsApp
{
class Program
{
private static Configuration config;
static void Main(string[] args)
{
Console.WriteLine("\nReading CameraPrefs.xml...");
String configPath = "CameraPrefs.xml";
if (args.Length >= 1)
configPath = args[0];
config = loadAndParseConfig(configPath);
applyCameraSettings(config.Cameras);
applyTrueColorSetting(config.TrueColorEnabled);
}
private static Configuration loadAndParseConfig(String pPath)
{
try
{
return Configuration.Deserialize(pPath);
}
catch (IOException pException)
{
TextWriter errorWriter = Console.Error;
errorWriter.WriteLine("\n ERROR: Config not found at \"" + pPath + "\"");
return null;
}
}
private static void applyTrueColorSetting(Boolean pValue)
{
Console.WriteLine("\nApplying TrueColor setting to registry...");
RegistryKey hkcu = Registry.CurrentUser;
hkcu = hkcu.OpenSubKey("Software\\Microsoft\\LifeCam", true);
try
{
hkcu.SetValue("TrueColorOff", pValue ? 0 : 1);
}
catch (Exception pException)
{
Console.WriteLine("\n ERROR: LifeCam entry not found. Is the LifeCam software installed?");
}
}
private static void applyCameraSettings(CameraPrefs[] pCameraPrefsList)
{
foreach (CameraPrefs cameraPrefs in pCameraPrefsList)
{
try
{
LifeCamCamera camera = LifeCamCamera.CreateFromPrefs(cameraPrefs);
}
catch (Exception pException)
{
Console.WriteLine("\n ERROR: " + pException.Message);
continue;
}
}
}
}
}