Ejemplo n.º 1
0
        private IEnumerable <string> ProcessMoveTasks()
        {
            foreach (Task task in tasks.Where(t => t.type == Task.Type.Move && t.status == Task.Status.Pending))
            {
                EditorUtils.EnsureFolderExists(EditorUtils.GetParentFolder(task.destination));

                currentTask = task.step;

                yield return(string.Format("Moving {0} to {1}", task.source, task.destination));

                string result = AssetDatabase.MoveAsset(task.source, task.destination);

                if (string.IsNullOrEmpty(result))
                {
                    task.SetSucceeded(string.Format("{0} was moved to\n{1}", task.source, task.destination));
                }
                else
                {
                    task.SetFailed(string.Format("{0} could not be moved to\n{1}: '{2}'",
                                                 task.source, task.destination, result));
                }

                yield return(task.statusText);
            }
        }