Example #1
0
 public void LoadFeatures(string path, GadgetFeatureRegistry registry)
 {
     // read features.txt
     List<string> resources = new List<string>();
     List<ParsedFeature> features = new List<ParsedFeature>();
     string[] lines = File.ReadAllLines(path);
     foreach (var entry in lines)
     {
         string line = entry.Trim();
         if (!line.StartsWith("#") && line.Length > 0)
         {
             resources.Add(line);
         }
     }
     
     foreach (string item in resources)
     {
         string content = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/Content/" + item);
         string loc = item.Substring(0, item.LastIndexOf('/') + 1);
         ParsedFeature feature = Parse(content, loc, true);
         if (feature != null)
         {
             features.Add(feature);
         }
         
     }
     foreach (ParsedFeature item in features)
     {
         GadgetFeature gadgetFeature = new GadgetFeature(item.Name, item.libraries, item.deps);
         registry.Register(gadgetFeature);
     }
 }
Example #2
0
 private static bool IsCore(GadgetFeature feature)
 {
     return feature.getName().StartsWith("core");
 }
Example #3
0
 public void Register(GadgetFeature feature)
 {
     if (graphComplete)
     {
         throw new Exception("register should never be " +
                             "invoked after calling getLibraries");
     }
     if (IsCore(feature))
     {
         core[feature.getName()] = feature;
         foreach (var feat in features.Values)
         {
             feat.addDependency(feature.getName());
         }
     }
     else
     {
         feature.addDependencies(core.Keys);
     }
     features[feature.getName()] = feature;
 }