Clock fix

This commit is contained in:
seerge
2023-03-31 11:45:46 +02:00
parent ee84ba6304
commit dfbfd16d23
3 changed files with 15 additions and 24 deletions

View File

@@ -190,7 +190,9 @@ public class ASUSWmi
byte[] args = new byte[8];
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
byte[] status = CallMethod(DSTS, args);
return BitConverter.ToInt32(status, 0) - 65536;
}
public byte[] DeviceGetBuffer(uint DeviceID, uint Status = 0)
@@ -198,6 +200,7 @@ public class ASUSWmi
byte[] args = new byte[8];
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
BitConverter.GetBytes((uint)Status).CopyTo(args, 4);
return CallMethod(DSTS, args);
}

View File

@@ -4,6 +4,8 @@ using Starlight.Communication;
using System.Management;
using System.Drawing.Drawing2D;
using System.Text;
using System.Globalization;
using System;
namespace Starlight.AnimeMatrix
{
@@ -359,6 +361,15 @@ namespace Starlight.AnimeMatrix
}
public void PresentClock()
{
int second = DateTime.Now.Second;
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
PresentText(DateTime.Now.ToString("H" + ((second % 2 == 0)?":":" ") + "mm"));
else
PresentText(DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mm"), DateTime.Now.ToString("tt"));
}
public void PresentText(string text1, string text2 = "")
{

View File

@@ -354,29 +354,7 @@ namespace GHelper
mat.PresentNextFrame();
break;
case 3:
string format1, format2;
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
{
format1 = "H:mm";
format2 = "";
}
else
{
format1 = "h:mm";
format2 = "tt";
}
if (matrixTick > 0)
{
format1 = format1.Replace(":", " ");
matrixTick = 0;
}
else
{
matrixTick++;
}
mat.PresentText(DateTime.Now.ToString(format1), DateTime.Now.ToString(format2));
mat.PresentClock();
break;
}
@@ -745,7 +723,6 @@ namespace GHelper
bool overdriveSetting = (Program.config.getConfig("no_overdrive") != 1);
int overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
int miniled = Program.wmi.DeviceGet(ASUSWmi.ScreenMiniled);
bool screenEnabled = (frequency >= 0);