示例#1
0
		/// <summary>
		/// Creates the correct type of FileNode based on the file name.
		/// </summary>
		public static FileNode Create(string filePath, Project project)
		{
            if (project != null) 
            {
                if (project.IsOutput(filePath))
                    return new ProjectOutputNode(filePath);
                if (project.IsInput(filePath))
                    return new InputSwfNode(filePath);
            }

            string ext = Path.GetExtension(filePath).ToLower();

            if (FileInspector.IsSwf(filePath, ext) || FileInspector.IsSwc(filePath, ext))
                return new SwfFileNode(filePath);
            else if (FileAssociations.ContainsKey(ext)) // custom nodes building
                return FileAssociations[ext](filePath);
            else
                return new FileNode(filePath);
		}