Beispiel #1
0
        public static ErgonProject FromString(string content, string filePath = null)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var ergonProject = new ErgonProject(filePath);

            ergonProject.Load(content, filePath);
            return(ergonProject);
        }
Beispiel #2
0
        public static ErgonProject FromFile(string filePath)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }
            var fullFilePath = Path.Combine(Environment.CurrentDirectory, filePath);
            var ergonProject = new ErgonProject(fullFilePath);

            if (!File.Exists(fullFilePath))
            {
                ergonProject.Diagnostics.Error(new SourceSpan(filePath, new TextPosition(), new TextPosition()), $"Unable to find {DefaultFileName} file `{fullFilePath}");
                return(ergonProject);
            }

            var content = File.ReadAllText(fullFilePath, Encoding.UTF8);

            ergonProject.Load(content, filePath);
            return(ergonProject);
        }
Beispiel #3
0
 public void Add(ErgonProject project)
 {
     Projects.Add(project);
 }