+\r
+ private void ReadOldConfig()\r
+ {\r
+ var old = Path.Combine(_baseDir, "config.json");\r
+ var json = (dynamic)JsonParser.Parse(File.ReadAllText(old));\r
+ Location = new Point((int)json.Location.X, (int)json.Location.Y);\r
+ foreach (var property in (from prop in GetType().GetProperties()\r
+ let type = prop.PropertyType\r
+ where type == typeof(bool) || type == typeof(int) || type == typeof(string)\r
+ select prop))\r
+ {\r
+ if (!json.IsDefined(property.Name))\r
+ continue;\r
+ var v = json[property.Name];\r
+ property.SetValue(this, property.PropertyType == typeof(int) ? (int)v : v);\r
+ }\r
+ NotifyConditions = new List<int>((int[])json.NotifyConditions);\r
+ ResetHours = new List<int>((int[])json.ResetHours);\r
+ Sounds.Volume = (int)json.SoundVolume;\r
+ var idx = 0;\r
+ foreach (var name in new[]\r
+ {\r
+ "Mission", "NDock", "KDock", "MaxShips", "MaxEquips",\r
+ "DamagedShip", "Akashi20Min", "AkashiProgress", "AkashiComplete", "Condition"\r
+ })\r
+ {\r
+ if (json.IsDefined(name + "SoundFile"))\r
+ Sounds.Files[idx] = json[name + "SoundFile"];\r
+ idx++;\r
+ }\r
+ Proxy.Auto = json.Proxy.Auto;\r
+ Proxy.Listen = (int)json.Proxy.Listen;\r
+ Proxy.UseUpstream = json.Proxy.UseUpstream;\r
+ Proxy.UpstreamPort = (int)json.Proxy.UpstreamPort;\r
+ var sl = json.ShipList;\r
+ ShipList.Location = new Point((int)sl.Location.X, (int)sl.Location.Y);\r
+ ShipList.Size = new Size((int)sl.Size.Width, (int)sl.Size.Height);\r
+ ShipList.ShipType = sl.ShipType;\r
+ var sg = (int[][])sl.ShipGroup;\r
+ ShipList.ShipGroup = new List<List<int>>();\r
+ foreach (var g in sg)\r
+ ShipList.ShipGroup.Add(new List<int>(g));\r
+ 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