diff --git a/FanCtrl.csproj b/FanCtrl.csproj
index 550e391..4c86ecd 100644
--- a/FanCtrl.csproj
+++ b/FanCtrl.csproj
@@ -28,7 +28,7 @@
Lich
FanCtrl
0
- 1.1.6.0
+ 1.1.7.0
false
true
true
@@ -215,6 +215,7 @@
+
diff --git a/FanCtrl/Data/OSD/OSDGroup.cs b/FanCtrl/Data/OSD/OSDGroup.cs
index 998fb75..9e384fd 100644
--- a/FanCtrl/Data/OSD/OSDGroup.cs
+++ b/FanCtrl/Data/OSD/OSDGroup.cs
@@ -15,6 +15,8 @@ public class OSDGroup
public Color Color { get; set; } = Color.White;
+ public int Digit { get; set; } = 5;
+
private List mItemList = new List();
public List ItemList
{
@@ -63,7 +65,7 @@ public string getOSDString(int maxNameLength)
for (int i = 0; i < mItemList.Count; i++)
{
var item = mItemList[i];
- osdString.Append(item.getOSDString());
+ osdString.Append(item.getOSDString(Digit));
}
osdString.Append("\n");
@@ -76,6 +78,7 @@ public OSDGroup clone()
group.Name = this.Name;
group.IsColor = this.IsColor;
group.Color = Color.FromArgb(this.Color.R, this.Color.G, this.Color.B);
+ group.Digit = this.Digit;
for (int i = 0; i < mItemList.Count; i++)
group.ItemList.Add(mItemList[i].clone());
diff --git a/FanCtrl/Data/OSD/OSDItem.cs b/FanCtrl/Data/OSD/OSDItem.cs
index c3499ef..e50b0f9 100644
--- a/FanCtrl/Data/OSD/OSDItem.cs
+++ b/FanCtrl/Data/OSD/OSDItem.cs
@@ -10,19 +10,28 @@ namespace FanCtrl
public enum OSDItemType : int
{
Sensor = 0,
- Fan = 1,
- Control = 2,
- Predefined = 3,
+ Fan,
+ Control,
+ Predefined,
+ Unknown,
}
public enum OSDUnitType : int
{
Temperature = 0,
- RPM = 1,
- Percent = 2,
- //MHz = 3,
- //MB = 4,
- //FPS = 5,
+ RPM,
+ Percent,
+ MHz,
+ kHz,
+ KB,
+ MB,
+ GB,
+ MBPerSec,
+ Voltage,
+ Power,
+ FPS,
+ Blank,
+ Unknown,
}
public class OSDItem
@@ -37,7 +46,7 @@ public class OSDItem
public Color Color { get; set; } = Color.White;
- public string getOSDString()
+ public string getOSDString(int digit)
{
try
{
@@ -58,7 +67,7 @@ public string getOSDString()
}
// Value prefix
- osdString.Append("");
+ osdString.Append(string.Format("", digit));
// Value
var hardwareManager = HardwareManager.getInstance();
@@ -87,12 +96,24 @@ public string getOSDString()
int value = control.Value;
osdString.Append(value.ToString());
}
- /*
else if (ItemType == OSDItemType.Predefined)
{
-
+ if(UnitType == OSDUnitType.FPS)
+ {
+ osdString.Append("");
+ }
+ else if(UnitType == OSDUnitType.Blank)
+ {
+ osdString.Append(" ");
+ }
+ else
+ {
+ var sensor = hardwareManager.getOSDSensor(Index);
+ if (sensor == null)
+ return "";
+ osdString.Append(sensor.getString());
+ }
}
- */
else
{
return "";
@@ -146,16 +167,27 @@ public string getUnitString()
case OSDUnitType.Percent:
return " %";
- /*
case OSDUnitType.MHz:
+ case OSDUnitType.kHz:
return " MHz";
+ case OSDUnitType.KB:
+ case OSDUnitType.GB:
case OSDUnitType.MB:
return " MB";
+ case OSDUnitType.MBPerSec:
+ return " MB/s";
+
+ case OSDUnitType.Voltage:
+ return " V";
+
+ case OSDUnitType.Power:
+ return " W";
+
case OSDUnitType.FPS:
return " FPS";
- */
+
default:
return " ";
}
diff --git a/FanCtrl/Data/OSD/OSDManager.cs b/FanCtrl/Data/OSD/OSDManager.cs
index 0f05c2a..35e76aa 100644
--- a/FanCtrl/Data/OSD/OSDManager.cs
+++ b/FanCtrl/Data/OSD/OSDManager.cs
@@ -8,7 +8,7 @@
using System.Threading;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using System.Windows.Forms.DataVisualization.Charting;
+using System.Timers;
namespace FanCtrl
{
@@ -57,11 +57,29 @@ public bool IsEnable
}
}
+ private bool mIsTime = false;
+ public bool IsTime
+ {
+ get
+ {
+ Monitor.Enter(mLock);
+ bool isTime = mIsTime;
+ Monitor.Exit(mLock);
+ return isTime;
+ }
+ set
+ {
+ Monitor.Enter(mLock);
+ mIsTime = value;
+ Monitor.Exit(mLock);
+ }
+ }
+
private List mGroupList = new List();
private OSDManager()
{
-
+
}
private void clear()
@@ -98,6 +116,7 @@ public void read()
var rootObject = JObject.Parse(jsonString);
mIsEnable = (rootObject.ContainsKey("enable") == true) ? rootObject.Value("enable") : false;
+ mIsTime = (rootObject.ContainsKey("time") == true) ? rootObject.Value("time") : false;
if (rootObject.ContainsKey("group") == true)
{
@@ -106,16 +125,18 @@ public void read()
{
var groupObject = (JObject)groupList[i];
- string name = groupObject.Value("name");
- bool isColor = groupObject.Value("isColor");
- byte r = groupObject.Value("r");
- byte g = groupObject.Value("g");
- byte b = groupObject.Value("b");
+ string name = (groupObject.ContainsKey("name") == false) ? "" : groupObject.Value("name");
+ bool isColor = (groupObject.ContainsKey("isColor") == false) ? false : groupObject.Value("isColor");
+ byte r = (groupObject.ContainsKey("r") == false) ? (byte)0xFF : groupObject.Value("r");
+ byte g = (groupObject.ContainsKey("g") == false) ? (byte)0xFF : groupObject.Value("g");
+ byte b = (groupObject.ContainsKey("b") == false) ? (byte)0xFF : groupObject.Value("b");
+ int digit = (groupObject.ContainsKey("digit") == false) ? 5 : groupObject.Value("digit");
var group = new OSDGroup();
group.Name = name;
group.IsColor = isColor;
group.Color = Color.FromArgb(r, g, b);
+ group.Digit = digit;
if (groupObject.ContainsKey("item") == true)
{
@@ -124,13 +145,16 @@ public void read()
{
var itemObject = (JObject)itemList[j];
- var itemType = itemObject.Value("itemType");
- var unitType = itemObject.Value("unitType");
- int index = itemObject.Value("index");
- isColor = itemObject.Value("isColor");
- r = itemObject.Value("r");
- g = itemObject.Value("g");
- b = itemObject.Value("b");
+ var itemType = (itemObject.ContainsKey("itemType") == false) ? (int)OSDItemType.Unknown : itemObject.Value("itemType");
+ var unitType = (itemObject.ContainsKey("unitType") == false) ? (int)OSDUnitType.Unknown : itemObject.Value("unitType");
+ int index = (itemObject.ContainsKey("index") == false) ? 0 : itemObject.Value("index");
+ isColor = (itemObject.ContainsKey("isColor") == false) ? false : itemObject.Value("isColor");
+ r = (itemObject.ContainsKey("r") == false) ? (byte)0xFF : itemObject.Value("r");
+ g = (itemObject.ContainsKey("g") == false) ? (byte)0xFF : itemObject.Value("g");
+ b = (itemObject.ContainsKey("b") == false) ? (byte)0xFF : itemObject.Value("b");
+
+ if (itemType >= (int)OSDItemType.Unknown || unitType >= (int)OSDUnitType.Unknown)
+ continue;
var item = new OSDItem();
item.ItemType = (OSDItemType)itemType;
@@ -163,6 +187,7 @@ public void write()
{
var rootObject = new JObject();
rootObject["enable"] = mIsEnable;
+ rootObject["time"] = mIsTime;
var groupList = new JArray();
for(int i = 0; i < mGroupList.Count; i++)
@@ -175,6 +200,7 @@ public void write()
groupObject["r"] = group.Color.R;
groupObject["g"] = group.Color.G;
groupObject["b"] = group.Color.B;
+ groupObject["digit"] = group.Digit;
var itemList = new JArray();
for (int j = 0; j < group.ItemList.Count; j++)
diff --git a/FanCtrl/Hardware/HardwareManager.cs b/FanCtrl/Hardware/HardwareManager.cs
index faa3b70..3d7d88a 100644
--- a/FanCtrl/Hardware/HardwareManager.cs
+++ b/FanCtrl/Hardware/HardwareManager.cs
@@ -54,14 +54,15 @@ private HardwareManager(){}
// Control List
private List mControlList = new List();
+ // OSD sensor List
+ private List mOSDSensorList = new List();
+
// next tick change value
private List mChangeValueList = new List();
private List mChangeControlList = new List();
- // update thread
- private long mUpdateInterval = 1000;
- private bool mUpdateThreadState = false;
- private Thread mUpdateThread = null;
+ // update timer
+ private System.Timers.Timer mUpdateTimer = new System.Timers.Timer();
public event UpdateTimerEventHandler onUpdateCallback;
public delegate void UpdateTimerEventHandler();
@@ -258,6 +259,9 @@ public void start()
this.createGPUFan();
this.createGPUControl();
+ // osd sensor
+ this.createOSDSensor();
+
Monitor.Exit(mLock);
}
@@ -274,12 +278,7 @@ public void stop()
mChangeControlList.Clear();
mChangeValueList.Clear();
- mUpdateThreadState = false;
- if (mUpdateThread != null)
- {
- mUpdateThread.Join();
- mUpdateThread = null;
- }
+ mUpdateTimer.Stop();
if (mLHM != null)
{
@@ -358,10 +357,9 @@ public void startUpdate()
return;
}
- mUpdateInterval = OptionManager.getInstance().Interval;
- mUpdateThreadState = true;
- mUpdateThread = new Thread(onUpdateThread);
- mUpdateThread.Start();
+ mUpdateTimer.Interval = OptionManager.getInstance().Interval;
+ mUpdateTimer.Elapsed += onUpdateTimer;
+ mUpdateTimer.Start();
Monitor.Exit(mLock);
}
@@ -374,7 +372,7 @@ public void restartTimer(int interval)
Monitor.Exit(mLock);
return;
}
- mUpdateInterval = interval;
+ mUpdateTimer.Interval = interval;
Monitor.Exit(mLock);
}
@@ -665,6 +663,86 @@ private void createGPUControl()
}
}
+ private void createOSDSensor()
+ {
+ if (mIsGigabyte == true) {}
+
+ // LibreHardwareMonitor
+ else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
+ {
+ mLHM.createOSDSensor(ref mOSDSensorList);
+ }
+
+ // OpenHardwareMonitor
+ else if (OptionManager.getInstance().LibraryType == LibraryType.OpenHardwareMonitor)
+ {
+ mOHM.createOSDSensor(ref mOSDSensorList);
+ }
+
+ if (OptionManager.getInstance().IsNvAPIWrapper == true)
+ {
+ this.lockBus();
+ try
+ {
+ var gpuArray = PhysicalGPU.GetPhysicalGPUs();
+ for (int i = 0; i < gpuArray.Length; i++)
+ {
+ int subIndex = 0;
+
+ var osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Graphics", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Memory", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Processor", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Video Decoding", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Core", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Frame Buffer", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Video Engine", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Bus Interface", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Memory", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Free", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Used", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+
+ osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Total", i, subIndex++);
+ osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
+ mOSDSensorList.Add(osdSensor);
+ }
+ }
+ catch { }
+ this.unlockBus();
+ }
+ }
+
private bool isExistTemp(string name)
{
for (int i = 0; i < mSensorList.Count; i++)
@@ -804,171 +882,208 @@ private void onSetNvApiControl(int index, int coolerID, int value)
this.unlockBus();
}
- private byte mTest = 0x00;
-
- private void onUpdateThread()
+ private double onOSDSensorUpdate(OSDLibraryType libraryType, int index, int subIndex)
{
- long startTime = Util.getNowMS();
- while (mUpdateThreadState == true)
- {
- if (Monitor.TryEnter(mLock) == false)
+ double value = 0;
+ if (libraryType == OSDLibraryType.NvApiWrapper)
+ {
+ this.lockBus();
+ try
{
- Thread.Sleep(100);
- continue;
+ var gpuArray = PhysicalGPU.GetPhysicalGPUs();
+ var gpu = gpuArray[index];
+
+ switch (subIndex)
+ {
+ case 0:
+ value = (double)gpu.CurrentClockFrequencies.GraphicsClock.Frequency;
+ break;
+ case 1:
+ value = (double)gpu.CurrentClockFrequencies.MemoryClock.Frequency;
+ break;
+ case 2:
+ value = (double)gpu.CurrentClockFrequencies.ProcessorClock.Frequency;
+ break;
+ case 3:
+ value = (double)gpu.CurrentClockFrequencies.VideoDecodingClock.Frequency;
+ break;
+ case 4:
+ value = (double)gpu.UsageInformation.GPU.Percentage;
+ break;
+ case 5:
+ value = (double)gpu.UsageInformation.FrameBuffer.Percentage;
+ break;
+ case 6:
+ value = (double)gpu.UsageInformation.VideoEngine.Percentage;
+ break;
+ case 7:
+ value = (double)gpu.UsageInformation.BusInterface.Percentage;
+ break;
+ case 8:
+ value = (double)(((double)gpu.MemoryInformation.PhysicalFrameBufferSizeInkB - (double)gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB) / (double)gpu.MemoryInformation.PhysicalFrameBufferSizeInkB * 100.0);
+ break;
+ case 9:
+ value = (double)gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB;
+ break;
+ case 10:
+ value = (double)(gpu.MemoryInformation.PhysicalFrameBufferSizeInkB - gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB);
+ break;
+ case 11:
+ value = (double)gpu.MemoryInformation.PhysicalFrameBufferSizeInkB;
+ break;
+ default:
+ value = 0;
+ break;
+ }
}
+ catch { }
+ this.unlockBus();
+ }
+ return value;
+ }
- long nowTime = Util.getNowMS();
- if(nowTime - startTime < mUpdateInterval)
- {
- Monitor.Exit(mLock);
- Thread.Sleep(100);
- continue;
- }
- startTime = nowTime;
+ private void onUpdateTimer(object sender, EventArgs e)
+ {
+ if (Monitor.TryEnter(mLock) == false)
+ return;
- if (mIsGigabyte == true && mGigabyte != null)
- {
- mGigabyte.update();
- }
+ if (mIsGigabyte == true && mGigabyte != null)
+ {
+ mGigabyte.update();
+ }
- if (mLHM != null)
- {
- mLHM.update();
- }
+ if (mLHM != null)
+ {
+ mLHM.update();
+ }
- if (mOHM != null)
- {
- mOHM.update();
- }
+ if (mOHM != null)
+ {
+ mOHM.update();
+ }
- for (int i = 0; i < mSensorList.Count; i++)
- {
- mSensorList[i].update();
- }
+ for (int i = 0; i < mSensorList.Count; i++)
+ {
+ mSensorList[i].update();
+ }
- for (int i = 0; i < mFanList.Count; i++)
- {
- mFanList[i].update();
- }
+ for (int i = 0; i < mFanList.Count; i++)
+ {
+ mFanList[i].update();
+ }
- for (int i = 0; i < mControlList.Count; i++)
- {
- mControlList[i].update();
- }
+ for (int i = 0; i < mControlList.Count; i++)
+ {
+ mControlList[i].update();
+ }
- // change value
- bool isExistChange = false;
- if (mChangeValueList.Count > 0)
+ // change value
+ bool isExistChange = false;
+ if (mChangeValueList.Count > 0)
+ {
+ for (int i = 0; i < mChangeControlList.Count; i++)
{
- for (int i = 0; i < mChangeControlList.Count; i++)
- {
- isExistChange = true;
- mChangeControlList[i].setSpeed(mChangeValueList[i]);
- }
- mChangeControlList.Clear();
- mChangeValueList.Clear();
+ isExistChange = true;
+ mChangeControlList[i].setSpeed(mChangeValueList[i]);
}
+ mChangeControlList.Clear();
+ mChangeValueList.Clear();
+ }
+
+ // Control
+ var controlManager = ControlManager.getInstance();
+ if (controlManager.IsEnable == true && isExistChange == false)
+ {
+ var controlDictionary = new Dictionary();
+ int modeIndex = controlManager.ModeIndex;
- // Control
- var controlManager = ControlManager.getInstance();
- if (controlManager.IsEnable == true && isExistChange == false)
+ for (int i = 0; i < controlManager.getControlDataCount(modeIndex); i++)
{
- var controlDictionary = new Dictionary();
- int modeIndex = controlManager.ModeIndex;
+ var controlData = controlManager.getControlData(modeIndex, i);
+ if (controlData == null)
+ break;
+
+ int sensorIndex = controlData.Index;
+ int temperature = mSensorList[sensorIndex].Value;
- for (int i = 0; i < controlManager.getControlDataCount(modeIndex); i++)
+ for (int j = 0; j < controlData.FanDataList.Count; j++)
{
- var controlData = controlManager.getControlData(modeIndex, i);
- if (controlData == null)
- break;
+ var fanData = controlData.FanDataList[j];
+ int controlIndex = fanData.Index;
+ int percent = fanData.getValue(temperature);
- int sensorIndex = controlData.Index;
- int temperature = mSensorList[sensorIndex].Value;
+ var control = mControlList[controlIndex];
- for (int j = 0; j < controlData.FanDataList.Count; j++)
+ if (controlDictionary.ContainsKey(controlIndex) == false)
{
- var fanData = controlData.FanDataList[j];
- int controlIndex = fanData.Index;
- int percent = fanData.getValue(temperature);
-
- var control = mControlList[controlIndex];
-
- if (controlDictionary.ContainsKey(controlIndex) == false)
- {
- controlDictionary[controlIndex] = control;
- control.NextValue = percent;
- }
- else
- {
- control.NextValue = (control.NextValue >= percent) ? control.NextValue : percent;
- }
+ controlDictionary[controlIndex] = control;
+ control.NextValue = percent;
+ }
+ else
+ {
+ control.NextValue = (control.NextValue >= percent) ? control.NextValue : percent;
}
}
+ }
- foreach (var keyPair in controlDictionary)
- {
- var control = keyPair.Value;
- if (control.Value == control.NextValue)
- continue;
- control.setSpeed(control.NextValue);
- }
+ foreach (var keyPair in controlDictionary)
+ {
+ var control = keyPair.Value;
+ if (control.Value == control.NextValue)
+ continue;
+ control.setSpeed(control.NextValue);
}
+ }
- // onUpdateCallback
- onUpdateCallback();
+ // onUpdateCallback
+ onUpdateCallback();
- var osdManager = OSDManager.getInstance();
- if (osdManager.IsEnable == true)
+ var osdManager = OSDManager.getInstance();
+ if (osdManager.IsEnable == true)
+ {
+ var osdHeaderString = "\r";
+
+ var osdString = new StringBuilder();
+ if (osdManager.IsTime == true)
{
- var osdString = new StringBuilder();
- osdString.Append("");
- osdString.Append("");
- osdString.Append("");
- osdString.Append("\r");
-
- bool isOK = (osdManager.getGroupCount() > 0) ? true : false;
- int maxNameLength = 0;
- for (int i = 0; i < osdManager.getGroupCount(); i++)
- {
- var group = osdManager.getGroup(i);
- if (group == null)
- {
- isOK = false;
- break;
- }
+ osdString.Append(DateTime.Now.ToString("HH:mm:ss") + "\n");
+ }
- if (group.Name.Length > maxNameLength)
- maxNameLength = group.Name.Length;
- }
+ int maxNameLength = 0;
+ for (int i = 0; i < osdManager.getGroupCount(); i++)
+ {
+ var group = osdManager.getGroup(i);
+ if (group == null)
+ break;
+ if (group.Name.Length > maxNameLength)
+ maxNameLength = group.Name.Length;
+ }
- for (int i = 0; i < osdManager.getGroupCount(); i++)
- {
- var group = osdManager.getGroup(i);
- if (group == null)
- {
- isOK = false;
- break;
- }
- osdString.Append(group.getOSDString(maxNameLength));
- }
+ for (int i = 0; i < osdManager.getGroupCount(); i++)
+ {
+ var group = osdManager.getGroup(i);
+ if (group == null)
+ break;
+ osdString.Append(group.getOSDString(maxNameLength));
+ }
- if (isOK == true)
- {
- OSDController.updateOSD(osdString.ToString());
- osdManager.IsUpdate = true;
- }
+ if (osdString.ToString().Length > 0)
+ {
+ var sendString = osdHeaderString + osdString.ToString();
+ OSDController.updateOSD(sendString);
+ osdManager.IsUpdate = true;
}
- else
+ }
+ else
+ {
+ if (osdManager.IsUpdate == true)
{
- if (osdManager.IsUpdate == true)
- {
- OSDController.releaseOSD();
- osdManager.IsUpdate = false;
- }
+ OSDController.releaseOSD();
+ osdManager.IsUpdate = false;
}
-
- Monitor.Exit(mLock);
}
+
+ Monitor.Exit(mLock);
}
public int addChangeValue(int value, BaseControl control)
@@ -1050,5 +1165,26 @@ public BaseControl getControl(int index)
Monitor.Exit(mLock);
return control;
}
+
+ public int getOSDSensorCount()
+ {
+ Monitor.Enter(mLock);
+ int count = mOSDSensorList.Count;
+ Monitor.Exit(mLock);
+ return count;
+ }
+
+ public OSDSensor getOSDSensor(int index)
+ {
+ Monitor.Enter(mLock);
+ if (index >= mOSDSensorList.Count)
+ {
+ Monitor.Exit(mLock);
+ return null;
+ }
+ var other = mOSDSensorList[index];
+ Monitor.Exit(mLock);
+ return other;
+ }
}
}
diff --git a/FanCtrl/Hardware/LHM.cs b/FanCtrl/Hardware/LHM.cs
index bf91882..cb3c06e 100644
--- a/FanCtrl/Hardware/LHM.cs
+++ b/FanCtrl/Hardware/LHM.cs
@@ -9,7 +9,6 @@ public class LHM : IVisitor
{
private bool mIsStart = false;
- // LibreHardwareMonitorLib
private Computer mComputer = null;
public LHM() { }
@@ -22,6 +21,7 @@ public void start()
mComputer = new Computer();
mComputer.IsCpuEnabled = true;
+ mComputer.IsMemoryEnabled = true;
mComputer.IsMotherboardEnabled = true;
mComputer.IsControllerEnabled = true;
mComputer.IsGpuEnabled = true;
@@ -313,6 +313,112 @@ public void createGPUFanControl(ref List controlList)
}
}
+ public void createOSDSensor(ref List osdList)
+ {
+ try
+ {
+ bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;
+ var hardwareArray = mComputer.Hardware;
+ for (int i = 0; i < hardwareArray.Length; i++)
+ {
+ if (isNvAPIWrapper == true && hardwareArray[i].HardwareType == HardwareType.GpuNvidia)
+ continue;
+
+ var sensorArray = hardwareArray[i].Sensors;
+ this.setOSDSensor(sensorArray, SensorType.Load, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Clock, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Voltage, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Data, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.SmallData, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Power, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Throughput, ref osdList);
+
+ var subHardwareArray = hardwareArray[i].SubHardware;
+ for (int j = 0; j < subHardwareArray.Length; j++)
+ {
+ var subSensorArray = subHardwareArray[j].Sensors;
+ this.setOSDSensor(subSensorArray, SensorType.Load, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Clock, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Voltage, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Data, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.SmallData, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Power, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Throughput, ref osdList);
+ }
+ }
+ }
+ catch { }
+ }
+
+ private void setOSDSensor(ISensor[] sensorArray, SensorType sensorType, ref List osdList)
+ {
+ var sensorList = new List();
+ for (int i = 0; i < sensorArray.Length; i++)
+ {
+ if (sensorArray[i].SensorType != sensorType)
+ {
+ continue;
+ }
+ sensorList.Add(sensorArray[i]);
+ }
+
+ for (int i = 0; i < sensorList.Count; i++)
+ {
+ var sensor = sensorList[i];
+
+ int index = osdList.Count;
+ OSDUnitType unitType = OSDUnitType.Unknown;
+ string sensorName = "";
+ switch (sensorList[i].SensorType)
+ {
+ case SensorType.Voltage:
+ unitType = OSDUnitType.Voltage;
+ sensorName = "[Voltage] ";
+ break;
+
+ case SensorType.Power:
+ unitType = OSDUnitType.Power;
+ sensorName = "[Power] ";
+ break;
+
+ case SensorType.Load:
+ unitType = OSDUnitType.Percent;
+ sensorName = "[Load] ";
+ break;
+
+ case SensorType.Clock:
+ unitType = OSDUnitType.MHz;
+ sensorName = "[Clock] ";
+ break;
+
+ case SensorType.Data:
+ unitType = OSDUnitType.GB;
+ sensorName = "[Data] ";
+ break;
+
+ case SensorType.SmallData:
+ unitType = OSDUnitType.MB;
+ sensorName = "[Data] ";
+ break;
+
+ case SensorType.Throughput:
+ unitType = OSDUnitType.MBPerSec;
+ sensorName = "[Throughput] ";
+ break;
+
+ default:
+ unitType = OSDUnitType.Unknown;
+ break;
+ }
+
+ if (unitType == OSDUnitType.Unknown)
+ continue;
+
+ var osdSensor = new OSDSensor(sensorList[i], unitType, sensorName + sensorList[i].Name, index);
+ osdList.Add(osdSensor);
+ }
+ }
+
public void update()
{
mComputer.Accept(this);
diff --git a/FanCtrl/Hardware/OHM.cs b/FanCtrl/Hardware/OHM.cs
index 5893673..6016c02 100644
--- a/FanCtrl/Hardware/OHM.cs
+++ b/FanCtrl/Hardware/OHM.cs
@@ -9,7 +9,6 @@ public class OHM : IVisitor
{
private bool mIsStart = false;
- // OpenHardwareMonitorLib
private Computer mComputer = null;
public OHM() { }
@@ -22,6 +21,7 @@ public void start()
mComputer = new Computer();
mComputer.CPUEnabled = true;
+ mComputer.RAMEnabled = true;
mComputer.MainboardEnabled = true;
mComputer.FanControllerEnabled = true;
mComputer.GPUEnabled = true;
@@ -49,7 +49,7 @@ public void createTemp(ref List sensorList)
// CPU, GPU
int cpuNum = 2;
- int gpuAmdNum = 2;
+ int GpuAtiNum = 2;
int gpuNvidiaNum = 2;
var hardwareArray = mComputer.Hardware;
for (int i = 0; i < hardwareArray.Length; i++)
@@ -70,7 +70,7 @@ public void createTemp(ref List sensorList)
string name = hardwareArray[i].Name;
while (this.isExistTemp(ref sensorList, name) == true)
{
- name = hardwareArray[i].Name + " #" + gpuAmdNum++;
+ name = hardwareArray[i].Name + " #" + GpuAtiNum++;
}
var sensor = new HardwareTemp(hardwareArray[i], name);
sensorList.Add(sensor);
@@ -313,6 +313,112 @@ public void createGPUFanControl(ref List controlList)
}
}
+ public void createOSDSensor(ref List osdList)
+ {
+ try
+ {
+ bool isNvAPIWrapper = OptionManager.getInstance().IsNvAPIWrapper;
+ var hardwareArray = mComputer.Hardware;
+ for (int i = 0; i < hardwareArray.Length; i++)
+ {
+ if (isNvAPIWrapper == true && hardwareArray[i].HardwareType == HardwareType.GpuNvidia)
+ continue;
+
+ var sensorArray = hardwareArray[i].Sensors;
+ this.setOSDSensor(sensorArray, SensorType.Load, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Clock, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Voltage, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Data, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.SmallData, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Power, ref osdList);
+ this.setOSDSensor(sensorArray, SensorType.Throughput, ref osdList);
+
+ var subHardwareArray = hardwareArray[i].SubHardware;
+ for (int j = 0; j < subHardwareArray.Length; j++)
+ {
+ var subSensorArray = subHardwareArray[j].Sensors;
+ this.setOSDSensor(subSensorArray, SensorType.Load, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Clock, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Voltage, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Data, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.SmallData, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Power, ref osdList);
+ this.setOSDSensor(subSensorArray, SensorType.Throughput, ref osdList);
+ }
+ }
+ }
+ catch { }
+ }
+
+ private void setOSDSensor(ISensor[] sensorArray, SensorType sensorType, ref List osdList)
+ {
+ var sensorList = new List();
+ for (int i = 0; i < sensorArray.Length; i++)
+ {
+ if (sensorArray[i].SensorType != sensorType)
+ {
+ continue;
+ }
+ sensorList.Add(sensorArray[i]);
+ }
+
+ for (int i = 0; i < sensorList.Count; i++)
+ {
+ var sensor = sensorList[i];
+
+ int index = osdList.Count;
+ OSDUnitType unitType = OSDUnitType.Unknown;
+ string sensorName = "";
+ switch (sensorList[i].SensorType)
+ {
+ case SensorType.Voltage:
+ unitType = OSDUnitType.Voltage;
+ sensorName = "[Voltage] ";
+ break;
+
+ case SensorType.Power:
+ unitType = OSDUnitType.Power;
+ sensorName = "[Power] ";
+ break;
+
+ case SensorType.Load:
+ unitType = OSDUnitType.Percent;
+ sensorName = "[Load] ";
+ break;
+
+ case SensorType.Clock:
+ unitType = OSDUnitType.MHz;
+ sensorName = "[Clock] ";
+ break;
+
+ case SensorType.Data:
+ unitType = OSDUnitType.GB;
+ sensorName = "[Data] ";
+ break;
+
+ case SensorType.SmallData:
+ unitType = OSDUnitType.MB;
+ sensorName = "[Data] ";
+ break;
+
+ case SensorType.Throughput:
+ unitType = OSDUnitType.MBPerSec;
+ sensorName = "[Throughput] ";
+ break;
+
+ default:
+ unitType = OSDUnitType.Unknown;
+ break;
+ }
+
+ if (unitType == OSDUnitType.Unknown)
+ continue;
+
+ var osdSensor = new OSDSensor(sensorList[i], unitType, sensorName + sensorList[i].Name, index);
+ osdList.Add(osdSensor);
+ }
+ }
+
public void update()
{
mComputer.Accept(this);
diff --git a/FanCtrl/Hardware/Sensor/BaseSensor.cs b/FanCtrl/Hardware/Sensor/BaseSensor.cs
index 73b768a..a7038a9 100644
--- a/FanCtrl/Hardware/Sensor/BaseSensor.cs
+++ b/FanCtrl/Hardware/Sensor/BaseSensor.cs
@@ -14,6 +14,9 @@ public enum SENSOR_TYPE
// fan speed
FAN,
+ // OSD sensor
+ OSD,
+
UNKNOWN,
};
diff --git a/FanCtrl/Hardware/Sensor/OSDSensor.cs b/FanCtrl/Hardware/Sensor/OSDSensor.cs
new file mode 100644
index 0000000..55c6280
--- /dev/null
+++ b/FanCtrl/Hardware/Sensor/OSDSensor.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using LibreHardwareMonitor.Hardware;
+using OpenHardwareMonitor.Hardware;
+
+namespace FanCtrl
+{
+ public enum OSDLibraryType
+ {
+ LibreHardwareMonitor = 0,
+ OpenHardwareMonitor = 1,
+ NvApiWrapper = 2,
+ }
+
+ public class OSDSensor : BaseSensor
+ {
+ public delegate double OnOSDSensorUpdate(OSDLibraryType libraryType, int index, int subIndex);
+ public event OnOSDSensorUpdate onOSDSensorUpdate;
+
+ private LibreHardwareMonitor.Hardware.ISensor mLHMSensor = null;
+ private OpenHardwareMonitor.Hardware.ISensor mOHMSensor = null;
+
+ private int mIndex = 0;
+ private int mSubIndex = 0;
+
+ public OSDLibraryType LibraryType { get; set; }
+
+ public OSDUnitType UnitType { get; set; }
+
+ public double DoubleValue { get; set; }
+
+ public OSDSensor(LibreHardwareMonitor.Hardware.ISensor sensor, OSDUnitType unitType, string name, int index) : base(SENSOR_TYPE.OSD)
+ {
+ mLHMSensor = sensor;
+ LibraryType = OSDLibraryType.LibreHardwareMonitor;
+ UnitType = unitType;
+ Name = name;
+ mIndex = index;
+ }
+
+ public OSDSensor(OpenHardwareMonitor.Hardware.ISensor sensor, OSDUnitType unitType, string name, int index) : base(SENSOR_TYPE.OSD)
+ {
+ mOHMSensor = sensor;
+ LibraryType = OSDLibraryType.OpenHardwareMonitor;
+ UnitType = unitType;
+ Name = name;
+ mIndex = index;
+ }
+
+ public OSDSensor(OSDUnitType unitType, string name, int index, int subIndex) : base(SENSOR_TYPE.OSD)
+ {
+ LibraryType = OSDLibraryType.NvApiWrapper;
+ UnitType = unitType;
+ Name = name;
+ mIndex = index;
+ mSubIndex = subIndex;
+ }
+
+ public override string getString()
+ {
+ this.update();
+
+ if (UnitType == OSDUnitType.Voltage)
+ {
+ return string.Format("{0:0.00}", DoubleValue);
+ }
+ else if (UnitType == OSDUnitType.kHz)
+ {
+ Value = (int)Math.Round(DoubleValue / 1024);
+ return Value.ToString();
+ }
+ else if (UnitType == OSDUnitType.KB)
+ {
+ Value = (int)Math.Round(DoubleValue / 1024);
+ return Value.ToString();
+ }
+ else if (UnitType == OSDUnitType.GB)
+ {
+ Value = (int)Math.Round(DoubleValue * 1024);
+ return Value.ToString();
+ }
+ else if (UnitType == OSDUnitType.MBPerSec)
+ {
+ double value = Math.Round(DoubleValue / 1024 / 1024);
+ return string.Format("{0}", value);
+ }
+ else
+ {
+ Value = (int)Math.Round(DoubleValue);
+ return Value.ToString();
+ }
+ }
+ public override void update()
+ {
+ if (mLHMSensor != null)
+ {
+ DoubleValue = (mLHMSensor.Value.HasValue == true) ? (double)mLHMSensor.Value : (double)Value;
+ }
+
+ else if (mOHMSensor != null)
+ {
+ DoubleValue = (mOHMSensor.Value.HasValue == true) ? (double)mOHMSensor.Value : (double)Value;
+ }
+ else
+ {
+ DoubleValue = onOSDSensorUpdate(LibraryType, mIndex, mSubIndex);
+ }
+ }
+ }
+}
diff --git a/OSDForm.Designer.cs b/OSDForm.Designer.cs
index 73ed850..a46ba5d 100644
--- a/OSDForm.Designer.cs
+++ b/OSDForm.Designer.cs
@@ -31,6 +31,7 @@ private void InitializeComponent()
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OSDForm));
this.mEnableCheckBox = new System.Windows.Forms.CheckBox();
this.mGroupGroupBox = new System.Windows.Forms.GroupBox();
+ this.mGroupEditTextBox = new System.Windows.Forms.TextBox();
this.mGroupRemoveButton = new System.Windows.Forms.Button();
this.mGroupColorButton = new System.Windows.Forms.Button();
this.mGroupAddButton = new System.Windows.Forms.Button();
@@ -39,6 +40,7 @@ private void InitializeComponent()
this.mGroupListView = new System.Windows.Forms.ListView();
this.mGroupAddTextBox = new System.Windows.Forms.TextBox();
this.mItemGroupBox = new System.Windows.Forms.GroupBox();
+ this.mDigitLabel = new System.Windows.Forms.Label();
this.mItemComboBox = new System.Windows.Forms.ComboBox();
this.mItemRemoveButton = new System.Windows.Forms.Button();
this.mItemColorButton = new System.Windows.Forms.Button();
@@ -48,9 +50,11 @@ private void InitializeComponent()
this.mItemListView = new System.Windows.Forms.ListView();
this.mApplyButton = new System.Windows.Forms.Button();
this.mOKButton = new System.Windows.Forms.Button();
- this.mGroupEditTextBox = new System.Windows.Forms.TextBox();
+ this.mSystemTimeCheckBox = new System.Windows.Forms.CheckBox();
+ this.mDigitNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.mGroupGroupBox.SuspendLayout();
this.mItemGroupBox.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.mDigitNumericUpDown)).BeginInit();
this.SuspendLayout();
//
// mEnableCheckBox
@@ -73,16 +77,23 @@ private void InitializeComponent()
this.mGroupGroupBox.Controls.Add(this.mGroupUpButton);
this.mGroupGroupBox.Controls.Add(this.mGroupListView);
this.mGroupGroupBox.Controls.Add(this.mGroupAddTextBox);
- this.mGroupGroupBox.Location = new System.Drawing.Point(13, 45);
+ this.mGroupGroupBox.Location = new System.Drawing.Point(13, 49);
this.mGroupGroupBox.Name = "mGroupGroupBox";
- this.mGroupGroupBox.Size = new System.Drawing.Size(270, 195);
+ this.mGroupGroupBox.Size = new System.Drawing.Size(270, 279);
this.mGroupGroupBox.TabIndex = 1;
this.mGroupGroupBox.TabStop = false;
this.mGroupGroupBox.Text = "Groups";
//
+ // mGroupEditTextBox
+ //
+ this.mGroupEditTextBox.Location = new System.Drawing.Point(51, 168);
+ this.mGroupEditTextBox.Name = "mGroupEditTextBox";
+ this.mGroupEditTextBox.Size = new System.Drawing.Size(100, 21);
+ this.mGroupEditTextBox.TabIndex = 7;
+ //
// mGroupRemoveButton
//
- this.mGroupRemoveButton.Location = new System.Drawing.Point(203, 153);
+ this.mGroupRemoveButton.Location = new System.Drawing.Point(203, 156);
this.mGroupRemoveButton.Name = "mGroupRemoveButton";
this.mGroupRemoveButton.Size = new System.Drawing.Size(61, 29);
this.mGroupRemoveButton.TabIndex = 6;
@@ -92,7 +103,7 @@ private void InitializeComponent()
//
// mGroupColorButton
//
- this.mGroupColorButton.Location = new System.Drawing.Point(203, 118);
+ this.mGroupColorButton.Location = new System.Drawing.Point(203, 124);
this.mGroupColorButton.Name = "mGroupColorButton";
this.mGroupColorButton.Size = new System.Drawing.Size(61, 29);
this.mGroupColorButton.TabIndex = 5;
@@ -102,7 +113,7 @@ private void InitializeComponent()
//
// mGroupAddButton
//
- this.mGroupAddButton.Location = new System.Drawing.Point(203, 15);
+ this.mGroupAddButton.Location = new System.Drawing.Point(203, 23);
this.mGroupAddButton.Name = "mGroupAddButton";
this.mGroupAddButton.Size = new System.Drawing.Size(61, 29);
this.mGroupAddButton.TabIndex = 1;
@@ -112,7 +123,7 @@ private void InitializeComponent()
//
// mGroupDownButton
//
- this.mGroupDownButton.Location = new System.Drawing.Point(203, 83);
+ this.mGroupDownButton.Location = new System.Drawing.Point(203, 91);
this.mGroupDownButton.Name = "mGroupDownButton";
this.mGroupDownButton.Size = new System.Drawing.Size(61, 29);
this.mGroupDownButton.TabIndex = 4;
@@ -122,7 +133,7 @@ private void InitializeComponent()
//
// mGroupUpButton
//
- this.mGroupUpButton.Location = new System.Drawing.Point(203, 50);
+ this.mGroupUpButton.Location = new System.Drawing.Point(203, 58);
this.mGroupUpButton.Name = "mGroupUpButton";
this.mGroupUpButton.Size = new System.Drawing.Size(61, 29);
this.mGroupUpButton.TabIndex = 3;
@@ -134,23 +145,24 @@ private void InitializeComponent()
//
this.mGroupListView.FullRowSelect = true;
this.mGroupListView.HideSelection = false;
- this.mGroupListView.Location = new System.Drawing.Point(6, 47);
+ this.mGroupListView.Location = new System.Drawing.Point(6, 57);
this.mGroupListView.MultiSelect = false;
this.mGroupListView.Name = "mGroupListView";
- this.mGroupListView.Size = new System.Drawing.Size(191, 134);
+ this.mGroupListView.Size = new System.Drawing.Size(191, 213);
this.mGroupListView.TabIndex = 2;
this.mGroupListView.UseCompatibleStateImageBehavior = false;
this.mGroupListView.View = System.Windows.Forms.View.Details;
//
// mGroupAddTextBox
//
- this.mGroupAddTextBox.Location = new System.Drawing.Point(6, 19);
+ this.mGroupAddTextBox.Location = new System.Drawing.Point(6, 27);
this.mGroupAddTextBox.Name = "mGroupAddTextBox";
this.mGroupAddTextBox.Size = new System.Drawing.Size(191, 21);
this.mGroupAddTextBox.TabIndex = 0;
//
// mItemGroupBox
//
+ this.mItemGroupBox.Controls.Add(this.mDigitLabel);
this.mItemGroupBox.Controls.Add(this.mItemComboBox);
this.mItemGroupBox.Controls.Add(this.mItemRemoveButton);
this.mItemGroupBox.Controls.Add(this.mItemColorButton);
@@ -158,25 +170,35 @@ private void InitializeComponent()
this.mItemGroupBox.Controls.Add(this.mItemDownButton);
this.mItemGroupBox.Controls.Add(this.mItemUpButton);
this.mItemGroupBox.Controls.Add(this.mItemListView);
- this.mItemGroupBox.Location = new System.Drawing.Point(289, 45);
+ this.mItemGroupBox.Location = new System.Drawing.Point(289, 49);
this.mItemGroupBox.Name = "mItemGroupBox";
- this.mItemGroupBox.Size = new System.Drawing.Size(335, 195);
+ this.mItemGroupBox.Size = new System.Drawing.Size(418, 279);
this.mItemGroupBox.TabIndex = 7;
this.mItemGroupBox.TabStop = false;
this.mItemGroupBox.Text = "Items";
//
+ // mDigitLabel
+ //
+ this.mDigitLabel.AutoSize = true;
+ this.mDigitLabel.Location = new System.Drawing.Point(270, 1);
+ this.mDigitLabel.Name = "mDigitLabel";
+ this.mDigitLabel.Size = new System.Drawing.Size(75, 12);
+ this.mDigitLabel.TabIndex = 7;
+ this.mDigitLabel.Text = "Align digits :";
+ this.mDigitLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
+ //
// mItemComboBox
//
this.mItemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.mItemComboBox.FormattingEnabled = true;
- this.mItemComboBox.Location = new System.Drawing.Point(6, 19);
+ this.mItemComboBox.Location = new System.Drawing.Point(6, 28);
this.mItemComboBox.Name = "mItemComboBox";
- this.mItemComboBox.Size = new System.Drawing.Size(256, 20);
+ this.mItemComboBox.Size = new System.Drawing.Size(339, 20);
this.mItemComboBox.TabIndex = 1;
//
// mItemRemoveButton
//
- this.mItemRemoveButton.Location = new System.Drawing.Point(268, 153);
+ this.mItemRemoveButton.Location = new System.Drawing.Point(351, 157);
this.mItemRemoveButton.Name = "mItemRemoveButton";
this.mItemRemoveButton.Size = new System.Drawing.Size(61, 29);
this.mItemRemoveButton.TabIndex = 6;
@@ -186,7 +208,7 @@ private void InitializeComponent()
//
// mItemColorButton
//
- this.mItemColorButton.Location = new System.Drawing.Point(268, 118);
+ this.mItemColorButton.Location = new System.Drawing.Point(351, 124);
this.mItemColorButton.Name = "mItemColorButton";
this.mItemColorButton.Size = new System.Drawing.Size(61, 29);
this.mItemColorButton.TabIndex = 5;
@@ -196,7 +218,7 @@ private void InitializeComponent()
//
// mItemAddButton
//
- this.mItemAddButton.Location = new System.Drawing.Point(268, 15);
+ this.mItemAddButton.Location = new System.Drawing.Point(351, 23);
this.mItemAddButton.Name = "mItemAddButton";
this.mItemAddButton.Size = new System.Drawing.Size(61, 29);
this.mItemAddButton.TabIndex = 1;
@@ -206,7 +228,7 @@ private void InitializeComponent()
//
// mItemDownButton
//
- this.mItemDownButton.Location = new System.Drawing.Point(268, 83);
+ this.mItemDownButton.Location = new System.Drawing.Point(351, 91);
this.mItemDownButton.Name = "mItemDownButton";
this.mItemDownButton.Size = new System.Drawing.Size(61, 29);
this.mItemDownButton.TabIndex = 4;
@@ -216,7 +238,7 @@ private void InitializeComponent()
//
// mItemUpButton
//
- this.mItemUpButton.Location = new System.Drawing.Point(268, 50);
+ this.mItemUpButton.Location = new System.Drawing.Point(351, 57);
this.mItemUpButton.Name = "mItemUpButton";
this.mItemUpButton.Size = new System.Drawing.Size(61, 29);
this.mItemUpButton.TabIndex = 3;
@@ -228,17 +250,17 @@ private void InitializeComponent()
//
this.mItemListView.FullRowSelect = true;
this.mItemListView.HideSelection = false;
- this.mItemListView.Location = new System.Drawing.Point(6, 47);
+ this.mItemListView.Location = new System.Drawing.Point(6, 57);
this.mItemListView.MultiSelect = false;
this.mItemListView.Name = "mItemListView";
- this.mItemListView.Size = new System.Drawing.Size(256, 134);
+ this.mItemListView.Size = new System.Drawing.Size(339, 213);
this.mItemListView.TabIndex = 2;
this.mItemListView.UseCompatibleStateImageBehavior = false;
this.mItemListView.View = System.Windows.Forms.View.Details;
//
// mApplyButton
//
- this.mApplyButton.Location = new System.Drawing.Point(396, 246);
+ this.mApplyButton.Location = new System.Drawing.Point(479, 334);
this.mApplyButton.Name = "mApplyButton";
this.mApplyButton.Size = new System.Drawing.Size(111, 35);
this.mApplyButton.TabIndex = 8;
@@ -248,7 +270,7 @@ private void InitializeComponent()
//
// mOKButton
//
- this.mOKButton.Location = new System.Drawing.Point(513, 246);
+ this.mOKButton.Location = new System.Drawing.Point(596, 334);
this.mOKButton.Name = "mOKButton";
this.mOKButton.Size = new System.Drawing.Size(111, 35);
this.mOKButton.TabIndex = 9;
@@ -256,19 +278,32 @@ private void InitializeComponent()
this.mOKButton.UseVisualStyleBackColor = true;
this.mOKButton.Click += new System.EventHandler(this.onOKButtonClick);
//
- // mGroupEditTextBox
+ // mSystemTimeCheckBox
//
- this.mGroupEditTextBox.Location = new System.Drawing.Point(51, 168);
- this.mGroupEditTextBox.Name = "mGroupEditTextBox";
- this.mGroupEditTextBox.Size = new System.Drawing.Size(100, 21);
- this.mGroupEditTextBox.TabIndex = 7;
+ this.mSystemTimeCheckBox.AutoSize = true;
+ this.mSystemTimeCheckBox.Location = new System.Drawing.Point(295, 17);
+ this.mSystemTimeCheckBox.Name = "mSystemTimeCheckBox";
+ this.mSystemTimeCheckBox.Size = new System.Drawing.Size(130, 16);
+ this.mSystemTimeCheckBox.TabIndex = 0;
+ this.mSystemTimeCheckBox.Text = "Show system time";
+ this.mSystemTimeCheckBox.UseVisualStyleBackColor = true;
+ //
+ // mDigitNumericUpDown
+ //
+ this.mDigitNumericUpDown.Location = new System.Drawing.Point(640, 46);
+ this.mDigitNumericUpDown.Name = "mDigitNumericUpDown";
+ this.mDigitNumericUpDown.Size = new System.Drawing.Size(61, 21);
+ this.mDigitNumericUpDown.TabIndex = 7;
+ this.mDigitNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// OSDForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.ClientSize = new System.Drawing.Size(636, 289);
+ this.ClientSize = new System.Drawing.Size(719, 377);
+ this.Controls.Add(this.mDigitNumericUpDown);
+ this.Controls.Add(this.mSystemTimeCheckBox);
this.Controls.Add(this.mOKButton);
this.Controls.Add(this.mApplyButton);
this.Controls.Add(this.mItemGroupBox);
@@ -284,6 +319,8 @@ private void InitializeComponent()
this.mGroupGroupBox.ResumeLayout(false);
this.mGroupGroupBox.PerformLayout();
this.mItemGroupBox.ResumeLayout(false);
+ this.mItemGroupBox.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.mDigitNumericUpDown)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -311,5 +348,8 @@ private void InitializeComponent()
private System.Windows.Forms.Button mApplyButton;
private System.Windows.Forms.Button mOKButton;
private System.Windows.Forms.TextBox mGroupEditTextBox;
+ private System.Windows.Forms.CheckBox mSystemTimeCheckBox;
+ private System.Windows.Forms.NumericUpDown mDigitNumericUpDown;
+ private System.Windows.Forms.Label mDigitLabel;
}
}
\ No newline at end of file
diff --git a/OSDForm.cs b/OSDForm.cs
index 5678904..e15f5c6 100644
--- a/OSDForm.cs
+++ b/OSDForm.cs
@@ -35,13 +35,16 @@ public OSDForm()
mGroupEditTextBox.Hide();
mItemListView.Columns.Add("Color", 50);
- mItemListView.Columns.Add("Item", 200);
-
+ mItemListView.Columns.Add("Item", 280);
+
+ mDigitNumericUpDown.ValueChanged += onDigitNumericUpDownValueChanged;
+
this.enableItemConrol(false);
var hardwareManager = HardwareManager.getInstance();
var controlManager = ControlManager.getInstance();
+ // Sensor
for (int i = 0; i < hardwareManager.getSensorCount(); i++)
{
var sensor = hardwareManager.getSensor(i);
@@ -53,6 +56,7 @@ public OSDForm()
mItemComboBox.Items.Add("[" + StringLib.Temperature + "] " + controlManager.getName(0, i, false));
}
+ // Fan
for (int i = 0; i < hardwareManager.getFanCount(); i++)
{
var fan = hardwareManager.getFan(i);
@@ -64,6 +68,7 @@ public OSDForm()
mItemComboBox.Items.Add("[" + StringLib.Fan_speed + "] " + controlManager.getName(1, i, false));
}
+ // Control
for (int i = 0; i < hardwareManager.getControlCount(); i++)
{
var control = hardwareManager.getControl(i);
@@ -75,9 +80,38 @@ public OSDForm()
mItemComboBox.Items.Add("[" + StringLib.Fan_control + "] " + controlManager.getName(2, i, false));
}
+ // Predefined
+ // Framerate
+ var osdItem = new OSDItem();
+ osdItem.ItemType = OSDItemType.Predefined;
+ osdItem.UnitType = OSDUnitType.FPS;
+ mComboBoxItemList.Add(osdItem);
+ mItemComboBox.Items.Add("[" + StringLib.ETC + "] Framerate");
+
+ // Blank
+ osdItem = new OSDItem();
+ osdItem.ItemType = OSDItemType.Predefined;
+ osdItem.UnitType = OSDUnitType.Blank;
+ mComboBoxItemList.Add(osdItem);
+ mItemComboBox.Items.Add("[" + StringLib.ETC + "] Blank");
+
+ // osd sensor
+ for (int i = 0; i < hardwareManager.getOSDSensorCount(); i++)
+ {
+ var osdSensor = hardwareManager.getOSDSensor(i);
+ var item = new OSDItem();
+ item.ItemType = OSDItemType.Predefined;
+ item.UnitType = osdSensor.UnitType;
+ item.Index = i;
+ mComboBoxItemList.Add(item);
+ mItemComboBox.Items.Add(osdSensor.Name);
+ }
+
mItemComboBox.SelectedIndex = 0;
mEnableCheckBox.Checked = OSDManager.getInstance().IsEnable;
+ mSystemTimeCheckBox.Checked = OSDManager.getInstance().IsTime;
+
mGroupList = OSDManager.getInstance().getCloneGroupList();
for (int i = 0; i < mGroupList.Count; i++)
{
@@ -105,9 +139,11 @@ private void localizeComponent()
this.mEnableCheckBox.Text = StringLib.Enable_OSD;
mGroupGroupBox.Text = StringLib.Groups;
mItemGroupBox.Text = StringLib.Items;
+ mDigitLabel.Text = StringLib.Align_digits;
mGroupAddButton.Text = StringLib.Add;
mGroupColorButton.Text = StringLib.Color;
mGroupRemoveButton.Text = StringLib.Remove;
+ mSystemTimeCheckBox.Text = StringLib.Show_system_time;
mItemAddButton.Text = StringLib.Add;
mItemColorButton.Text = StringLib.Color;
mItemRemoveButton.Text = StringLib.Remove;
@@ -136,6 +172,7 @@ private void onGroupListViewIndexChanged(object sender, EventArgs e)
var controlManager = ControlManager.getInstance();
var group = mGroupList[index];
+ mDigitNumericUpDown.Value = group.Digit;
for (int i = 0; i < group.ItemList.Count; i++)
{
var item = group.ItemList[i];
@@ -163,6 +200,21 @@ private void onGroupListViewIndexChanged(object sender, EventArgs e)
{
listItem.SubItems.Add("[" + StringLib.Fan_control + "] " + controlManager.getName(2, item.Index, false));
}
+ else if (item.ItemType == OSDItemType.Predefined)
+ {
+ if(item.UnitType == OSDUnitType.FPS)
+ {
+ listItem.SubItems.Add("[" + StringLib.ETC + "] Framerate");
+ }
+ else if(item.UnitType == OSDUnitType.Blank)
+ {
+ listItem.SubItems.Add("[" + StringLib.ETC + "] Blank");
+ }
+ else
+ {
+ listItem.SubItems.Add(hardwareManager.getOSDSensor(item.Index).Name);
+ }
+ }
listItem.UseItemStyleForSubItems = false;
mItemListView.Items.Add(listItem);
@@ -213,6 +265,7 @@ private void onGroupEditTextBoxLeave(object sender, EventArgs e)
private void enableItemConrol(bool isEnable)
{
//mItemComboBox.Enabled = isEnable;
+ mDigitNumericUpDown.Enabled = isEnable;
mItemListView.Enabled = isEnable;
mItemAddButton.Enabled = isEnable;
mItemUpButton.Enabled = isEnable;
@@ -348,6 +401,19 @@ private void onGroupRemoveButtonClick(object sender, EventArgs e)
catch { }
}
+ private void onDigitNumericUpDownValueChanged(object sender, EventArgs e)
+ {
+ if (this.isSelectedGroupListView() == false)
+ return;
+
+ try
+ {
+ int index = mGroupListView.SelectedItems[0].Index;
+ mGroupList[index].Digit = Decimal.ToInt32(mDigitNumericUpDown.Value);
+ }
+ catch { }
+ }
+
private void onItemAddButtonClick(object sender, EventArgs e)
{
if (this.isSelectedGroupListView() == false)
@@ -488,6 +554,7 @@ private void onItemRemoveButtonClick(object sender, EventArgs e)
private void onApplyButtonClick(object sender, EventArgs e)
{
OSDManager.getInstance().IsEnable = mEnableCheckBox.Checked;
+ OSDManager.getInstance().IsTime = mSystemTimeCheckBox.Checked;
OSDManager.getInstance().setGroupList(mGroupList);
OSDManager.getInstance().write();
onApplyCallback(sender, e);
diff --git a/OptionForm.cs b/OptionForm.cs
index 784e68d..1df384f 100644
--- a/OptionForm.cs
+++ b/OptionForm.cs
@@ -124,6 +124,10 @@ private void onOKButtonClick(object sender, EventArgs e)
{
ControlManager.getInstance().reset();
ControlManager.getInstance().write();
+
+ OSDManager.getInstance().reset();
+ OSDManager.getInstance().write();
+
OnExitHandler(null, EventArgs.Empty);
return;
}
diff --git a/Portable/FanCtrl_v1.1.7.zip b/Portable/FanCtrl_v1.1.7.zip
new file mode 100644
index 0000000..5b44887
Binary files /dev/null and b/Portable/FanCtrl_v1.1.7.zip differ
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index b5de7e8..b151f43 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -31,8 +31,8 @@
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
-[assembly: AssemblyVersion("1.1.6")]
-[assembly: AssemblyFileVersion("1.1.6")]
-[assembly: AssemblyInformationalVersion("1.1.6")]
+[assembly: AssemblyVersion("1.1.7")]
+[assembly: AssemblyFileVersion("1.1.7")]
+[assembly: AssemblyInformationalVersion("1.1.7")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/README.md b/README.md
index e06c637..a33b1d5 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ Graph : [ZedGraph][8]
- Not all types of hardware are supported.
## Portable
-Download : [FanCtrl_v1.1.6.zip][10]
+Download : [FanCtrl_v1.1.7.zip][10]
## Donate
[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=AUCEJ8KGCNJTC¤cy_code=USD&source=url)
@@ -62,7 +62,7 @@ Download : [FanCtrl_v1.1.6.zip][10]
[7]: https://www.newtonsoft.com/json
[8]: http://zedgraph.sourceforge.net/samples.html
[9]: https://github.com/lich426/FanCtrl/blob/master/LICENSE
-[10]: https://github.com/lich426/FanCtrl/raw/master/Portable/FanCtrl_v1.1.6.zip
+[10]: https://github.com/lich426/FanCtrl/raw/master/Portable/FanCtrl_v1.1.7.zip
[11]: https://github.com/lich426/FanCtrl/blob/master/Packet/X2.txt
[12]: https://github.com/lich426/FanCtrl/blob/master/Packet/X3.txt
[13]: https://github.com/lich426/FanCtrl/blob/master/Packet/clc.txt
diff --git a/StringLib.Designer.cs b/StringLib.Designer.cs
index a16806e..c9b4319 100644
--- a/StringLib.Designer.cs
+++ b/StringLib.Designer.cs
@@ -69,6 +69,15 @@ internal static string Add {
}
}
+ ///
+ /// Align digits :과(와) 유사한 지역화된 문자열을 찾습니다.
+ ///
+ internal static string Align_digits {
+ get {
+ return ResourceManager.GetString("Align_digits", resourceCulture);
+ }
+ }
+
///
/// Apply과(와) 유사한 지역화된 문자열을 찾습니다.
///
@@ -159,6 +168,15 @@ internal static string Enable_OSD {
}
}
+ ///
+ /// ETC과(와) 유사한 지역화된 문자열을 찾습니다.
+ ///
+ internal static string ETC {
+ get {
+ return ResourceManager.GetString("ETC", resourceCulture);
+ }
+ }
+
///
/// Exit과(와) 유사한 지역화된 문자열을 찾습니다.
///
@@ -402,6 +420,15 @@ internal static string Show {
}
}
+ ///
+ /// Show system time과(와) 유사한 지역화된 문자열을 찾습니다.
+ ///
+ internal static string Show_system_time {
+ get {
+ return ResourceManager.GetString("Show_system_time", resourceCulture);
+ }
+ }
+
///
/// Silence과(와) 유사한 지역화된 문자열을 찾습니다.
///
diff --git a/StringLib.ko.resx b/StringLib.ko.resx
index e1569b7..4fa1648 100644
--- a/StringLib.ko.resx
+++ b/StringLib.ko.resx
@@ -120,6 +120,9 @@
추가
+
+ 자릿수 :
+
적용
@@ -150,6 +153,9 @@
OSD 활성화
+
+ 기타
+
종료
@@ -231,6 +237,9 @@
열기
+
+ 현재 시간 보기
+
사일런스
diff --git a/StringLib.resx b/StringLib.resx
index 12de65a..9a47795 100644
--- a/StringLib.resx
+++ b/StringLib.resx
@@ -120,6 +120,9 @@
Add
+
+ Align digits :
+
Apply
@@ -150,6 +153,9 @@
Enable OSD (RTSS)
+
+ ETC
+
Exit
@@ -231,6 +237,9 @@
Show
+
+ Show system time
+
Silence