Exemplo n.º 1
0
        /// <summary>
        /// Resolves a JSON Resource's *original* token.
        /// </summary>
        /// <param name="token"></param>
        public static JToken ResolveJson(JsonResource resource)
        {
            JToken root = resource.OriginalToken.DeepClone();
            var walker = new Providers.JsonWalker(root);
            List<JToken> keyTokens = new List<JToken>();

            walker.OnToken += t => translate(resource, t);
            //walker.OnKey += t => { var r = resolve(resource, t.Name, false); };
            walker.Work();

            return root;
        }
Exemplo n.º 2
0
        /// <summary>
        /// After all manifests have been loaded, we *might* want to deal with each of those files. Maybe.
        /// </summary>
        public static void ProccessQueue()
        {
            while (Queue.Count > 0)
            {
                Resource resource = Queue.Dequeue();

                // Try to load it.
                Pather pather = new Pather(resource.Location);
                JToken token = LoadJson(resource);

                // If the json failed
                if (token == null)
                    continue;

                var walker = new Providers.JsonWalker(token);

                walker.OnToken += t => addToContext(resource, t);
                walker.Work();
            }
        }