diff --git a/program/Logger.cs b/program/Logger.cs
new file mode 100644
index 0000000..85b0efe
--- /dev/null
+++ b/program/Logger.cs
@@ -0,0 +1,69 @@
+using System;
+using System.IO;
+using System.Text;
+
+/// Append-only text log next to the .exe: logs/ears-YYYYMMDD.log
+public static class Logger
+{
+ private static readonly object _gate = new object();
+ private static string _path;
+ private static bool _failed;
+
+ public static void Write(string message)
+ {
+ Write(null, message);
+ }
+
+ public static void Write(string tag, string message)
+ {
+ if (_failed) return;
+
+ string line = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") +
+ (string.IsNullOrEmpty(tag) ? " " : " [" + tag + "] ") +
+ message;
+
+ lock (_gate)
+ {
+ try
+ {
+ if (_path == null) _path = Init();
+ File.AppendAllText(_path, line + Environment.NewLine, Encoding.UTF8);
+ }
+ catch (Exception ex)
+ {
+ _failed = true; // never let logging crash the app
+ Console.WriteLine("[Logger] disabled: " + ex.Message);
+ }
+ }
+ }
+
+ public static void Write(string tag, string format, params object[] args)
+ {
+ Write(tag, string.Format(format, args));
+ }
+
+ public static void Exception(string tag, Exception ex)
+ {
+ Write(tag, ex.GetType().Name + ": " + ex.Message);
+ Write(tag, ex.StackTrace ?? "(no stack)");
+ }
+
+ private static string Init()
+ {
+ string dir = Path.Combine(
+ Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
+ "logs");
+
+ Directory.CreateDirectory(dir);
+
+ string path = Path.Combine(dir, "ears-" + DateTime.Now.ToString("yyyyMMdd") + ".log");
+
+ File.AppendAllText(path,
+ Environment.NewLine +
+ "=== session start " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") +
+ " (" + Environment.OSVersion.Platform + ") ===" + Environment.NewLine,
+ Encoding.UTF8);
+
+ return path;
+ }
+}
\ No newline at end of file
diff --git a/program/MainWindow.cs b/program/MainWindow.cs
index 083aa67..2455c89 100644
--- a/program/MainWindow.cs
+++ b/program/MainWindow.cs
@@ -55,7 +55,7 @@
private static Builder CreateBuilder()
{
var builder = new Builder();
- builder.AddFromFile("homepageallv5.glade");
+ builder.AddFromFile("homepageallv6.glade");
return builder;
}
diff --git a/program/MapWindow.cs b/program/MapWindow.cs
index 5c74aa9..e18eb72 100644
--- a/program/MapWindow.cs
+++ b/program/MapWindow.cs
@@ -9,6 +9,20 @@
[UI] private Label MapTitleLabel = null;
[UI] private Button MapBackButton = null;
+ [UI] private Label MapCaseLabel = null;
+ [UI] private RadioButton BodySkeletonRadio = null;
+ [UI] private RadioButton BodyJacketRadio = null;
+ [UI] private ComboBoxText JacketSizeCombo = null;
+ [UI] private RadioButton ViewFrontRadio = null;
+ [UI] private RadioButton ViewBackRadio = null;
+ [UI] private RadioButton ViewRightRadio = null;
+ [UI] private RadioButton ViewLeftRadio = null;
+ [UI] private CheckButton HideCircleCheck = null;
+ [UI] private CheckButton BlackAudioCheck = null;
+ [UI] private Button SoundTestButton = null;
+ [UI] private TextView MapLogView = null;
+ [UI] private Box MapControlSlots = null;
+
private readonly Language _lang;
private readonly SoundLooper _sound = new SoundLooper();
@@ -29,6 +43,7 @@
_lang.Register("MapBackButton", MapBackButton);
_lang.RegisterDynamic("MapTitleLabel", MapTitleLabel);
+ _sound.Log += msg => Logger.Write("sound", msg);
}
/// Called when a disease is picked. Loads images, starts the loop.
@@ -40,6 +55,8 @@
_body = LoadPixbuf(bodyPath, false);
_map = LoadPixbuf(mapPath, true); // true = key out black
+ Logger.Write("case", "open: " + title + " | map=" + mapPath + " | sound=" + soundPath);
+
MapArea.QueueDraw();
_sound.Start(soundPath);
}
@@ -48,6 +65,7 @@
public void StopSession()
{
_sound.Stop();
+ Logger.Write("case", "closed");
}
private void OnBackClicked(object sender, EventArgs e)
@@ -86,7 +104,9 @@
{
if (string.IsNullOrEmpty(path) || !File.Exists(path))
{
- Console.WriteLine("[MapWindow] image not found: " + path);
+ // Console.WriteLine("[MapWindow] image not found: " + path);
+ Logger.Write("map", "image not found: " + path);
+
return null;
}
@@ -101,7 +121,9 @@
}
catch (Exception ex)
{
- Console.WriteLine("[MapWindow] load failed " + path + ": " + ex.Message);
+ // Console.WriteLine("[MapWindow] load failed " + path + ": " + ex.Message);
+ Logger.Write("map", "image not found: " + path);
+
return null;
}
}
diff --git a/program/homepageallv6.glade b/program/homepageallv6.glade
new file mode 100644
index 0000000..4630bf4
--- /dev/null
+++ b/program/homepageallv6.glade
@@ -0,0 +1,828 @@
+
+
+
+
+
+