Exemplo n.º 1
0
        private async Task <string> GenerateDefaultConfigFileAsync(string configFileInUserSettings)
        {
            using (var fileStream = fileAccessor.CreateText(configFileInUserSettings))
            {
                var assembly     = Assembly.GetExecutingAssembly();
                var resourceName = assembly.GetManifestResourceNames().Single(str => str.EndsWith("defaultConfigFile.json"));

                using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        var defaultConfigFileContent = await reader.ReadToEndAsync();

                        await fileStream.WriteAsync(defaultConfigFileContent);

                        return(JObject.Parse(defaultConfigFileContent).SelectToken("types").ToString());
                    }
            }
        }