Esempio n. 1
0
        public static void WriteToFile(Specification spec, string file)
        {
            var stream = new MemoryStream();

            try
            {
                var writer = new StreamWriter(stream);

                var mdWriter = new MarkdownWriter(writer);
                mdWriter.Write(spec);

                writer.Flush();

                stream.Position = 0;

                if (stream.Length > 0)
                {
                    using (var fileStream = new FileStream(file, FileMode.Create))
                    {
                        stream.CopyTo(fileStream);
                    }
                }
            }
            catch (Exception e)
            {
                ConsoleWriter.Write($"There was some kind of problem persisting {file}");
                ConsoleWriter.Write(ConsoleColor.Yellow, e.ToString());
            }
        }
Esempio n. 2
0
        public static string WriteToText(Specification specification)
        {
            var text   = new StringWriter();
            var writer = new MarkdownWriter(text);

            writer.Write(specification);

            return(text.ToString());
        }
Esempio n. 3
0
        public static string WriteToText(Specification specification)
        {
            var text = new StringWriter();
            var writer = new MarkdownWriter(text);

            writer.Write(specification);

            return text.ToString();
        }
Esempio n. 4
0
        public static void WriteToFile(Specification spec, string file)
        {
            using (var stream = new FileStream(file, FileMode.Create))
            {
                var writer = new StreamWriter(stream);

                var mdWriter = new MarkdownWriter(writer);
                mdWriter.Write(spec);

                writer.Flush();
            }
        }
Esempio n. 5
0
        public static void WriteToFile(Specification spec, string file)
        {
            using (var stream = new FileStream(file, FileMode.Create))
            {
                var writer = new StreamWriter(stream);

                var mdWriter = new MarkdownWriter(writer);
                mdWriter.Write(spec);

                writer.Flush();
            }
        }