2
0

Clean up and polish release

- Nice popup UI with proper positioning
- Professional README with badges
- Remove debug logging
- Add .claude/ to .gitignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-03 22:30:42 -05:00
parent 0352c6b755
commit f23f26d809
7 changed files with 145 additions and 128 deletions

View File

@@ -220,9 +220,6 @@ public static class CMMCommand
}
}
private static readonly string DebugLog = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "MonitorParse.log");
/// <summary>
/// 取得螢幕清單
/// </summary>
@@ -232,27 +229,19 @@ public static class CMMCommand
if (!File.Exists(CMMsMonitors)) return monitors;
// Try reading raw bytes to understand encoding
// Read with UTF-16 LE encoding (ControlMyMonitor outputs UTF-16)
var rawBytes = await File.ReadAllBytesAsync(CMMsMonitors);
File.WriteAllText(DebugLog, $"File size: {rawBytes.Length} bytes\nFirst 20 bytes: {BitConverter.ToString(rawBytes.Take(20).ToArray())}\n\n");
// Try UTF-16 LE (common Windows Unicode)
var content = System.Text.Encoding.Unicode.GetString(rawBytes);
File.AppendAllText(DebugLog, $"Content preview:\n{content.Substring(0, Math.Min(500, content.Length))}\n\n");
XMonitor? mon = null;
foreach (var line in content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
{
File.AppendAllText(DebugLog, $"LINE: [{line}]\n");
var colonIdx = line.IndexOf(':');
if (colonIdx < 0) continue;
var key = line.Substring(0, colonIdx).Trim();
var val = line.Substring(colonIdx + 1).Trim().Trim('"');
File.AppendAllText(DebugLog, $" KEY=[{key}] VAL=[{val}]\n");
if (key.Contains("Monitor Device Name"))
{
mon = new XMonitor { MonitorDeviceName = val };
@@ -272,14 +261,12 @@ public static class CMMCommand
else if (mon != null && key.Contains("Monitor ID"))
{
mon.MonitorID = val;
File.AppendAllText(DebugLog, $" -> Adding monitor: Name=[{mon.MonitorName}] SN=[{mon.SerialNumber}]\n");
if (!string.IsNullOrEmpty(mon.SerialNumber))
monitors.Add(mon);
mon = null;
}
}
File.AppendAllText(DebugLog, $"\nTotal monitors with serial: {monitors.Count}\n");
return monitors;
}