Exemplo n.º 1
0
        private UntypedProjectConfig VerifyProjectConfigFile(string path)
        {
            UntypedProjectConfig project = ParsingUtils.ReadYamlFile <UntypedProjectConfig>(path);

            // Ensure that the ApiVersion property is present and
            // valid.
            if (!(project.ContainsKey("apiVersion") &&
                  project["apiVersion"] is string apiVersion &&
                  SupportedApiVersions.Contains(apiVersion)))
            {
                Log.LogCritical($"The project configuration at \"{path}\" does not use a supported schema.");
                Log.LogCritical("The following are the supported versions:");
                foreach (string version in SupportedApiVersions)
                {
                    Log.LogCritical($"- {version}\n");
                }

                Environment.Exit(1);
            }

            return(project);
        }
Exemplo n.º 2
0
        protected T ReadYamlFile <T>(string filePath, string field)
        {
            string fullPath = Path.Join(GetDataDirectoryPath(), filePath) + ".yaml";

            return(ParsingUtils.ReadYamlFile <T>(fullPath, field));
        }