static void AddCodex(FileInfo file)
        {
            // Read file
            string content = File.ReadAllText(file.FullName);

            // Parse file
            JObject item = null;

            try
            {
                item = JObject.Parse(content);
            }
            catch
            {
                Console.WriteLine("Skipped '" + file.FullName + "', as it could not be parsed as a valid JSON file.");
                return;
            }

            JObject newItem = new JObject();

            newItem["path"]     = AssetPath(file.FullName, basePath);
            newItem["fileName"] = file.Name;

            // Set item name
            string name = ItemReader.GetCodexName(item);

            newItem["name"] = name;

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            // Set item description. Use item name if no description is set.
            string shortDescription = ItemReader.GetCodexTitle(item);

            if (string.IsNullOrEmpty(shortDescription))
            {
                shortDescription = name;
            }
            newItem["shortdescription"] = shortDescription;

            // Set category
            newItem["category"] = "codex";

            // Set icon
            newItem["icon"] = ItemReader.GetIcon(item, true);

            // Set rarity.
            string rarity = ItemReader.GetCodexRarity(item);

            if (rarity != null)
            {
                newItem["rarity"] = rarity;
            }

            // Set race
            string race = ItemReader.GetSpecies(item);

            if (race != null)
            {
                newItem["race"] = race;
            }

            // Add the item.
            switch (resultType)
            {
            case ResultType.Patch:
                JObject patch = JObject.Parse("{'op':'add','path':'/-','value':{}}");
                patch["value"] = newItem;
                result.Add(patch);
                break;

            case ResultType.Normal:
                result.Add(newItem);
                break;
            }
        }
        /// <summary>
        /// Callback that scans the item file and adds the information needed for the Wardrobe mod to <see cref="result"/>.
        /// </summary>
        /// <param name="file">File to scan. Expected to be a JSON formatted item file.</param>
        static void AddItem(FileInfo file)
        {
            if (file.Extension == ".codex")
            {
                AddCodex(file);
                return;
            }

            // Read file
            string content = File.ReadAllText(file.FullName);

            // Parse file
            JObject item = null;

            try
            {
                item = JObject.Parse(content);
            }
            catch
            {
                Console.WriteLine("Skipped '" + file.FullName + "', as it could not be parsed as a valid JSON file.");
                return;
            }

            JObject newItem = new JObject();

            newItem["path"]     = AssetPath(file.FullName, basePath);
            newItem["fileName"] = file.Name;

            // Set item name
            string name = ItemReader.GetItemName(item);

            newItem["name"] = name;

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            // Skip objects with no item variant.
            if (item.Value <bool?>("hasObjectItem") == false)
            {
                return;
            }

            // Set item description. Use item name if no description is set.
            string shortDescription = ItemReader.GetShortDescription(item);

            if (string.IsNullOrEmpty(shortDescription))
            {
                shortDescription = name;
            }
            newItem["shortdescription"] = shortDescription;

            // Set category
            string category = ItemReader.GetCategory(file.Extension, item);

            newItem["category"] = category;

            // Set icon
            newItem["icon"] = ItemReader.GetIcon(item, true);

            // Set rarity.
            string rarity = ItemReader.GetRarity(item);

            if (rarity != null)
            {
                newItem["rarity"] = rarity;
            }

            // Set race
            string race = ItemReader.GetRace(item);

            if (race != null)
            {
                newItem["race"] = race;
            }

            string directives = ItemReader.GetDirectives(item);

            if (!string.IsNullOrEmpty(directives))
            {
                newItem["directives"] = directives;
            }


            // Add the item.
            switch (resultType)
            {
            case ResultType.Patch:
                JObject patch = JObject.Parse("{'op':'add','path':'/-','value':{}}");
                patch["value"] = newItem;
                result.Add(patch);
                break;

            case ResultType.Normal:
                result.Add(newItem);
                break;
            }
        }