StorytellerDocGen.Commands.CommandUsageCache.CommandUsageCache C# (CSharp) Method

CommandUsageCache() public method

public CommandUsageCache ( DocSettings settings ) : System.IO
settings DocSettings
return System.IO
        public CommandUsageCache(DocSettings settings)
        {
            _settings = settings;

            _reports = new LightweightCache<string, CommandLineApplicationReport>(app =>
            {
                var file = _settings.Root.AppendPath("content", app + ".usage.xml");
                if (!File.Exists(file))
                    throw new FileNotFoundException("Cannot find a command usage file for {0} at {1}".ToFormat(app, file));

                var serializer = new XmlSerializer(typeof(CommandLineApplicationReport));

                using (var stream = new FileStream(file, FileMode.Open))
                {
                    using (var reader = new StreamReader(stream))
                    {
                        return serializer.Deserialize(reader).As<CommandLineApplicationReport>();
                    }
                }
            });
        }