Пример #1
0
        public object Cook(CookingContext parent, string recipePath)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (string.IsNullOrEmpty(recipePath))
            {
                throw new ArgumentNullException("recipePath");
            }

            GameAssetRecipe recipe = BeginCook(parent.BaseDirectory, recipePath);

            if (recipe != null)
            {
                CookingContext context = new CookingContext(parent, recipePath, recipe);
                context.AddDependency(Path.Combine(parent.BaseDirectory, recipePath));
                object asset = recipe.Cook.CookObject(context);
                parent.Reference(context);
                return(asset);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public CookingReport Cook(string baseDirectory, string recipePath)
        {
            if (string.IsNullOrEmpty(baseDirectory))
            {
                throw new ArgumentNullException("baseDirectory");
            }
            if (string.IsNullOrEmpty(recipePath))
            {
                throw new ArgumentNullException("recipePath");
            }

            GameAssetRecipe recipe = BeginCook(baseDirectory, recipePath);

            if (recipe != null)
            {
                CookingContext context = new CookingContext(this, baseDirectory, recipePath, recipe);
                context.AddDependency(Path.Combine(baseDirectory, recipePath));
                context.SetVariable("AssetName", Path.GetFileNameWithoutExtension(recipePath));
                return(new CookingReport(recipe.Cook.CookObject(context), context));
            }
            else
            {
                return(null);
            }
        }