/// <summary> /// Given an array of strings as sources and a language, turn them into a project and return the documents and spans of it. /// </summary> /// <param name="sources">Classes in the form of strings</param> /// <returns>A Tuple containing the Documents produced from the sources and their TextSpans if relevant</returns> private static Document[] GetDocuments(string[] sources) { var project = ProjectFactory.CreateProject(sources); var documents = project.Documents.ToArray(); if (sources.Length != documents.Length) { throw new SystemException("Amount of sources did not match amount of Documents created"); } return(documents); }
/// <summary> /// Create a Document from a string through creating a project that contains it. /// </summary> /// <param name="source">Classes in the form of a string</param> /// <returns>A Document created from the source string</returns> public static Document CreateDocument(string source) { return(ProjectFactory.CreateProject(new[] { source }).Documents.First()); }