コード例 #1
0
        private static void Main()
        {
            ColorWarsSettings settings;

            try
            {
                settings = Newtonsoft.Json.JsonConvert.DeserializeObject <ColorWarsSettings>(File.ReadAllText("settings.json"));
            }
            catch (FileNotFoundException)
            {
                settings = new ColorWarsSettings();

                string json = Newtonsoft.Json.JsonConvert.SerializeObject(settings, Newtonsoft.Json.Formatting.Indented);
                File.WriteAllText("settings.json", json);
            }

            using (var game = new ColorWarsGame(settings))
                game.Run();
        }
コード例 #2
0
 static void Main()
 {
     using (var game = new ColorWarsGame())
         game.Run();
 }