-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.xaml.cs
54 lines (49 loc) · 1.86 KB
/
App.xaml.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
using System.Windows;
using System.IO;
using Control = System.Windows.Forms.Control;
using System;
namespace SimpRef
{
public partial class App : Application
{
App()
{
//get dpi ratio to adjust mouse position
GloVar.DpiRatio = 96.0 / new Control().CreateGraphics().DpiX;
GloVar.AutoHiding = true;
if (File.Exists("setting.ini"))
{
StreamReader sr = new StreamReader("setting.ini");
try
{
while (sr.Peek() > -1)
{
String[] datas = sr.ReadLine().ToLower().Split('=');
if (datas.Length >= 2)
if (datas[0].Contains("autofocus"))
{
if (datas[1].Contains("false")) GloVar.AutoFocus = false;
else if (datas[1].Contains("true")) GloVar.AutoFocus = true;
}
else if (datas[0].Contains("opacity"))
{
GloVar.Opacity_norm = Convert.ToDouble(datas[1]) / 100.0;
}
else if (datas[0].Contains("barheight"))
{
GloVar.BarHeight = Convert.ToDouble(datas[1]);
}
}
}
catch { new Msgbox("Setting Error!"); }
}
else
{
StreamWriter sw = new StreamWriter("setting.ini",false);
sw.Write("AutoFocus = true\r\nOpacity = 100.0\r\nBarHeight=25.0");
sw.Close();
sw.Dispose();
}
}
}
}