Beispiel #1
0
        public static List <IOutputDependency> LoadDependencies(IOutputExecutor executor)
        {
            var result = new List <IOutputDependency>();

            var fileName = executor.GetType().Name + GenesisDefaults.DependenciesExtension;

            string t = string.Empty;

            if (File.Exists(fileName))
            {
                t = File.ReadAllText(fileName);
            }

            var tmp    = new string[] { Tokens.TemplateSeperator };
            var chunks = t.Split(tmp, StringSplitOptions.RemoveEmptyEntries);

            foreach (var i in chunks)
            {
                using (var rdr = new StringReader(i))
                {
                    var pathFragment = rdr.ReadLine();
                    var content      = rdr.ReadToEnd();

                    result.Add(new GenesisDependency(pathFragment, content));

                    rdr.Dispose();
                }
            }

            return(result);
        }
Beispiel #2
0
        public static IGeneratorTemplate LoadTemplateFor(IOutputExecutor generator)
        {
            var templateFilePath = Path.Combine(Environment.CurrentDirectory, generator.GetType().Name + ".gen"); //TODO: hard coded path

            if (!File.Exists(templateFilePath))
            {
                throw new FileNotFoundException(templateFilePath);
            }

            var contents = File.ReadAllText(templateFilePath);

            return(new StringTemplate(contents));
        }