Sha256: 4a03eaed906a9b95aa90168086aaae1857831a49e278ca0d7b9dbe806f5bd3e3

Contents?: true

Size: 773 Bytes

Versions: 71

Compression:

Stored size: 773 Bytes

Contents

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;

namespace Generators.Input
{
    public static class ConfigFile
    {
        private const string ConfigFilePath = "../config.json";

        public static IEnumerable<string> GetExerciseNames()
        {
            var jsonContents = File.ReadAllText(ConfigFilePath);
            var config = JsonConvert.DeserializeObject<Config>(jsonContents);
            return config.Exercises.Select(exercise => exercise.Slug).OrderBy(x => x).ToArray();
        }

        private class Config
        {
            public ConfigExercise[] Exercises { get; set; }
        }

        private class ConfigExercise
        {
            public string Slug { get; set; }
        }
    }
}

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
trackler-2.2.1.136 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.135 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.134 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.133 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.132 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.131 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.130 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.129 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.128 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.127 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.126 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.125 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.124 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.123 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.122 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.121 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.120 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.119 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.118 tracks/csharp/generators/Input/ConfigFile.cs
trackler-2.2.1.117 tracks/csharp/generators/Input/ConfigFile.cs