Esempio n. 1
0
        static void Main(string[] args)
        {
            var tiles      = Tiles.Get();
            var units      = Units.Get();
            var structures = Structures.Get();
            var features   = Features.Get();
            var abilities  = Abilities.Get();
            var effects    = Effects.Get();
            var behaviours = Behaviours.Get();

            var outputObject = new OutputObject
            {
                Entities = new OutputEntities
                {
                    Tiles      = tiles,
                    Units      = units,
                    Structures = structures,
                    Features   = features
                },
                Abilities  = abilities,
                Effects    = effects,
                Behaviours = behaviours
            };

            var jsonSettings = new JsonSerializerSettings
            {
                ContractResolver = new DefaultContractResolver
                {
                    NamingStrategy = new CamelCaseNamingStrategy()
                                     //NamingStrategy = new SnakeCaseNamingStrategy()
                },
                Formatting = Formatting.Indented,
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
            };

            jsonSettings.Converters.Add(new StringEnumConverter());
            var outputJson = JsonConvert.SerializeObject(outputObject, jsonSettings);

            var path = Path.Combine(
                Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory
                                    ?? Directory.GetCurrentDirectory())
                .Parent.Parent.Parent.FullName,
                FileName);

            File.WriteAllText(path, outputJson);
        }