Esempio n. 1
0
 public GeneratorArguments(TConfig config, string atomsFolder, AtomDefaults defaults, ReadOnlyCollection <AtomModel> atoms)
     : this(
         config,
         atomsFolder,
         defaults,
         new Lazy <ReadOnlyCollection <AtomModel> >(() => atoms),
         Lazy(() => LoadProjections(atomsFolder)))
 {
 }
Esempio n. 2
0
 public GeneratorArguments(TConfig config, string atomsFolder, AtomDefaults defaults)
     : this(
         config,
         atomsFolder,
         defaults,
         Lazy(() => LoadAtoms(atomsFolder, defaults)),
         Lazy(() => LoadProjections(atomsFolder)))
 {
 }
Esempio n. 3
0
        private static ReadOnlyCollection <AtomModel> LoadAtoms(string atomsFolder, AtomDefaults defaults)
        {
            Log.Information("Loading atoms from {AtomFolder}", atomsFolder);

            var atoms = AtomCreator.FromFolder(atomsFolder, defaults).ToList();

            Log.Information("Loaded {LoadedAtomsCount} atoms", atoms.Count);

            return(atoms.AsReadOnly());
        }
Esempio n. 4
0
 private GeneratorArguments(
     TConfig config,
     string atomsFolder,
     AtomDefaults defaults,
     Lazy <ReadOnlyCollection <AtomModel> > atoms,
     Lazy <ReadOnlyCollection <ProjectionAtom> > projections)
 {
     Config      = config;
     AtomsFolder = atomsFolder;
     Defaults    = defaults;
     _atoms      = atoms;
 }
Esempio n. 5
0
        public static ReadOnlyCollection<AtomModel> FromFolder(string path, AtomDefaults defaults = null)
        {
            var allAtoms =
                Directory.EnumerateFiles(path, "*.atom")
                            .Where(i => !IsProjection(i) && !IsDefaultAtom(i))
                            .Select(
                                file =>
                                {
                                    var atom = FromString(File.ReadAllText(file), defaults);

                                    return atom;
                                });

            return AtomMemberBinder.BindReferences(allAtoms).ToList().AsReadOnly();
        }
Esempio n. 6
0
        public static ReadOnlyCollection <AtomModel> FromFolder(string path, AtomDefaults defaults = null)
        {
            var allAtoms =
                Directory.EnumerateFiles(path, "*.atom")
                .Where(i => !IsProjection(i) && !IsDefaultAtom(i))
                .Select(
                    file =>
            {
                var atom = FromString(File.ReadAllText(file), defaults);

                return(atom);
            });

            return(AtomMemberBinder.BindReferences(allAtoms).ToList().AsReadOnly());
        }
Esempio n. 7
0
 internal static AtomModel FromString(string atomString, AtomDefaults defaults = null)
 {
     return JsonConvert.DeserializeObject<AtomModel>(atomString, new AtomRootConverter(defaults?.AdditionalInfo ?? AtomAdditionalInfo.Default()));
 }
Esempio n. 8
0
 internal static AtomModel FromString(string atomString, AtomDefaults defaults = null)
 {
     return(JsonConvert.DeserializeObject <AtomModel>(atomString, new AtomRootConverter(defaults?.AdditionalInfo ?? AtomAdditionalInfo.Default())));
 }