示例#1
0
        /// <summary>Writes the compiled story to a Fountain file.</summary>
        /// <param name="story">The story.</param>
        /// <param name="options">The options.</param>
        public void WriteStoryToFountainFile(Parsed.Fiction parsedFiction, CommandLineToolOptions options)
        {
            string fountainContent = FountainExponentialAdapter.ConvertToFountainExponential(parsedFiction, options.InputFileName);

            try
            {
                FileSystemInteractor.WriteAllTextToFile(options.RootedOutputFountainFilePath, fountainContent, System.Text.Encoding.UTF8);

                OutputManager.ShowExportComplete(options);
            }
            catch
            {
                ConsoleInteractor.WriteErrorMessage("Could not write to output file '{0}'", options.RootedOutputFilePath);
                ConsoleInteractor.EnvironmentExitWithCodeError1();
            }
        }
示例#2
0
        /// <summary>Writes the compiled story to a JSON file.</summary>
        /// <param name="story">The story.</param>
        /// <param name="options">The options.</param>
        public void WriteStoryToJsonFile(Runtime.IStory story, CommandLineToolOptions options)
        {
            // Compile mode
            var jsonStr = story.ToJson();

            try
            {
                FileSystemInteractor.WriteAllTextToFile(options.RootedOutputFilePath, jsonStr, System.Text.Encoding.UTF8);

                OutputManager.ShowExportComplete(options);
            }
            catch
            {
                ConsoleInteractor.WriteErrorMessage("Could not write to output file '{0}'", options.RootedOutputFilePath);
                ConsoleInteractor.EnvironmentExitWithCodeError1();
            }
        }