Exemple #1
0
        internal static RawEntry ParseRawEntry(IDictionary <string, object> rawEntry)
        {
            RawEntry entry = new RawEntry();

            Get(rawEntry, "time", out entry.Time);
            Get(rawEntry, "sequence", out entry.Sequence);
            Get(rawEntry, "area", out entry.AreaGenerator);
            Get(rawEntry, "params", out entry.AreaGeneratorArgs);
            return(entry);
        }
Exemple #2
0
        internal static PatternEntry ParseEntry(IDictionary <string, object> rawData)
        {
            if (rawData == null)
            {
                throw new ParsingError("Malformed json");
            }


            RawEntry rawEntry = ParseRawEntry(rawData);

            try
            {
                var generator = MakeGenerator(rawEntry.AreaGenerator, rawEntry.AreaGeneratorArgs);
                return(new PatternEntry(rawEntry, generator));
            }
            catch (ArgumentException error)
            {
                throw new ParsingError(string.Format("While constructing generator: {0}", error.Message), error);
            }
        }
Exemple #3
0
 public PatternEntry(RawEntry raw, IGenerator gen)
 {
     Time      = raw.Time;
     Sequence  = raw.Sequence;
     Generator = gen;
 }