4 using System.Collections;
5 using System.Collections.Generic;
6 using System.Diagnostics;
8 using SiliconStudio.Core;
9 using SiliconStudio.Core.Diagnostics;
10 using SiliconStudio.Core.IO;
12 namespace SiliconStudio.Assets
17 [DataContract(
"AssetFolderCollection")]
19 [DebuggerDisplay(
"Count = {Count}")]
22 private readonly List<AssetFolder> folders;
29 folders =
new List<AssetFolder>();
35 if (item == null)
throw new ArgumentNullException(
"item");
36 if (item.
Path == null)
38 throw new ArgumentOutOfRangeException(
"item",
"SourceFolder.Folder cannot be null");
42 var existingFolder = Find(item.
Path);
43 if (existingFolder != null)
45 existingFolder.RawImports.AddRange(item.RawImports);
55 return folders.FirstOrDefault(sourceFolder => sourceFolder.Path == folder);
67 if (item == null)
throw new ArgumentNullException(
"item");
68 return folders.Contains(item);
74 folders.CopyTo(array, arrayIndex);
84 if (foldersTo == null)
throw new ArgumentNullException(
"folders");
85 foreach (var sourceFolder
in this)
87 foldersTo.Add(sourceFolder.Clone());
94 if (item == null)
throw new ArgumentNullException(
"item");
95 return folders.Remove(item);
103 return folders.Count;
119 return folders.GetEnumerator();
123 IEnumerator IEnumerable.GetEnumerator()
AssetFolder Find(UDirectory folder)
A location relative to a package from where assets will be loaded
AssetFolderCollection()
Initializes a new instance of the AssetFolderCollection class.
Defines a normalized directory path. See UPath for details. This class cannot be inherited.
void Add(AssetFolder item)
void CopyTo(AssetFolder[] array, int arrayIndex)
bool Remove(AssetFolder item)
void CloneTo(AssetFolderCollection foldersTo)
Clones this instance to the specified instance.
UDirectory Path
Gets or sets the folder.
Use this class to provide a debug output in Visual Studio debugger.
A collection of AssetFolder
IEnumerator< AssetFolder > GetEnumerator()
bool Contains(AssetFolder item)