public ISet <IMethodReference> GetEntryPoints(WholeProgram wholeProgram) { ISet <string> entryPointAttributeIDs = new HashSet <string>(System.IO.File.ReadAllLines(pathToFile)); ISet <IMethodReference> foundEntryPoints = new HashSet <IMethodReference>(); ISet <string> foundEntryPointIDs = new HashSet <string>(); foreach (IMethodDefinition methodDefinition in wholeProgram.AllDefinedMethods()) { foreach (ICustomAttribute attribute in methodDefinition.Attributes) { string attributeDefinitionID = GarbageCollectHelper.GetIDStringForReference(attribute.Type); if (entryPointAttributeIDs.Contains(attributeDefinitionID)) { foundEntryPoints.Add(methodDefinition); foundEntryPointIDs.Add(attributeDefinitionID); } } } // A poor attempt at slightly more humane error-reporting foreach (string desiredEntryPointID in entryPointAttributeIDs) { if (!foundEntryPointIDs.Contains(desiredEntryPointID)) { Console.WriteLine("Couldn't find any entry points with attribute {0}", desiredEntryPointID); Environment.Exit(-1); } } return(foundEntryPoints); }
public ISet <IMethodReference> GetEntryPoints(WholeProgram wholeProgram) { // Read entry points from provided file string entrypointsFileContents = System.IO.File.ReadAllText(pathToFile); // Creating the map is expensive; perhaps should cache in wholeProgram? DocumentationCommentDefinitionIdStringMap idMap = new DocumentationCommentDefinitionIdStringMap(wholeProgram.AllAssemblies()); return(new HashSet <IMethodReference>(idMap.CreateEntryPointListFromString(entrypointsFileContents))); }
public ISet <IMethodReference> GetEntryPoints(WholeProgram wholeProgram) { // The set of entry points is the designated entry points // for each of the root assemblies. ISet <IMethodReference> rootsEntryPoints = new HashSet <IMethodReference>(); foreach (IAssembly rootAssembly in wholeProgram.RootAssemblies()) { IMethodReference assemblyEntryPoint = rootAssembly.EntryPoint; if (!(assemblyEntryPoint is Dummy)) { rootsEntryPoints.Add(assemblyEntryPoint); } } return(rootsEntryPoints); }