OSDN Git Service

終了時に直近の提督経験値を記録する
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / Config.cs
index cd14ecd..bb215e8 100644 (file)
@@ -24,8 +24,6 @@ namespace KancolleSniffer
     public class ProxyConfig\r
     {\r
         public const int DefaultListenPort = 8080;\r
-        public const string AutoConfigUrl = "https://kancollesniffer.osdn.jp/proxy.pac";\r
-        public const string AutoConfigUrlWithPort = "https://kancollesniffer.osdn.jp/proxy.php?port=";\r
         public bool Auto { get; set; }\r
         public int Listen { get; set; }\r
         public bool UseUpstream { get; set; }\r
@@ -45,6 +43,7 @@ namespace KancolleSniffer
         public Point Location { get; set; }\r
         public Size Size { get; set; }\r
         public bool ShipType { get; set; }\r
+        public ListForm.SortOrder SortOrder { get; set; } = ListForm.SortOrder.ExpToNext;\r
         public List<List<int>> ShipGroup { get; set; }\r
 \r
         public ShipListConfig()\r
@@ -59,16 +58,12 @@ namespace KancolleSniffer
         public bool On { get; set; }\r
         public string OutputDir { get; set; }\r
         public int MaterialLogInterval { get; set; }\r
-        public bool ServerOn { get; set; }\r
-        public int Listen { get; set; }\r
 \r
         public LogConfig()\r
         {\r
             On = true;\r
             OutputDir = "";\r
             MaterialLogInterval = 10;\r
-            ServerOn = true;\r
-            Listen = 8008;\r
         }\r
     }\r
 \r
@@ -95,25 +90,31 @@ namespace KancolleSniffer
             "hirou.mp3"\r
         };\r
 \r
-        public readonly string[] SoundNames =\r
+        public string this[string name]\r
         {\r
-            "遠征終了", "入渠終了", "建造完了", "艦娘数超過", "装備数超過",\r
-            "大破警告", "泊地修理20分経過", "泊地修理進行", "泊地修理完了", "疲労回復"\r
-        };\r
+            get { return Files[Config.NotificationIndex[name]]; }\r
+            set { Files[Config.NotificationIndex[name]] = value; }\r
+        }\r
+    }\r
 \r
-        private readonly Dictionary<string, int> _names = new Dictionary<string, int>();\r
+    [Flags]\r
+    public enum NotificationType\r
+    {\r
+        FlashWindow = 1,\r
+        ShowBaloonTip = 1 << 1,\r
+        PlaySound = 1 << 2,\r
+        All = (1 << 3) - 1\r
+    }\r
 \r
-        public SoundConfig()\r
-        {\r
-            var idx = 0;\r
-            foreach (var name in SoundNames)\r
-                _names[name] = idx++;\r
-        }\r
+    public class NotificationConfig\r
+    {\r
+        public NotificationType[] Settings =\r
+            Config.NotificationNames.Select(x => NotificationType.All).ToArray();\r
 \r
-        public string this[string name]\r
+        public NotificationType this[string name]\r
         {\r
-            get { return Files[_names[name]]; }\r
-            set { Files[_names[name]] = value; }\r
+            get { return Settings[Config.NotificationIndex[name]]; }\r
+            set { Settings[Config.NotificationIndex[name]] = value; }\r
         }\r
     }\r
 \r
@@ -125,9 +126,11 @@ namespace KancolleSniffer
         public Point Location { get; set; } = new Point(int.MinValue, int.MinValue);\r
         public bool TopMost { get; set; }\r
         public bool HideOnMinimized { get; set; }\r
+        public int Zoom { get; set; } = 100;\r
         public bool FlashWindow { get; set; } = true;\r
         public bool ShowBaloonTip { get; set; }\r
         public bool PlaySound { get; set; } = true;\r
+        public NotificationConfig Notifications { get; set; } = new NotificationConfig();\r
         public int MarginShips { get; set; } = 4;\r
         public int MarginEquips { get; set; } = 10;\r
         public List<int> NotifyConditions { get; set; }\r
@@ -142,6 +145,15 @@ namespace KancolleSniffer
         public LogConfig Log { get; set; } = new LogConfig();\r
         public KancolleDbConfig KancolleDb { get; set; } = new KancolleDbConfig();\r
 \r
+        public static readonly string[] NotificationNames =\r
+        {\r
+            "遠征終了", "入渠終了", "建造完了", "艦娘数超過", "装備数超過",\r
+            "大破警告", "泊地修理20分経過", "泊地修理進行", "泊地修理完了", "疲労回復"\r
+        };\r
+\r
+        public static readonly Dictionary<string, int> NotificationIndex =\r
+            NotificationNames.Select((name, i) => new {name, i}).ToDictionary(entry => entry.name, entry => entry.i);\r
+\r
         public Config()\r
         {\r
             _configFileName = Path.Combine(_baseDir, "config.xml");\r
@@ -151,7 +163,7 @@ namespace KancolleSniffer
         public void InitializeValues()\r
         {\r
             NotifyConditions = new List<int>(new[] {40, 49});\r
-            ResetHours = new List<int>(new int[] {2});\r
+            ResetHours = new List<int>(new[] {2});\r
         }\r
 \r
         public void Load()\r
@@ -252,8 +264,6 @@ namespace KancolleSniffer
             Log.On = json.Log.On;\r
             Log.OutputDir = json.Log.OutputDir;\r
             Log.MaterialLogInterval = (int)json.Log.MaterialLogInterval;\r
-            Log.ServerOn = json.Log.ServerOn;\r
-            Log.Listen = (int)json.Log.Listen;\r
         }\r
     }\r
 }
\ No newline at end of file