Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AssetFolder.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 using System.Diagnostics;
6 using SiliconStudio.Core;
7 using SiliconStudio.Core.IO;
8 
9 namespace SiliconStudio.Assets
10 {
11  /// <summary>
12  /// A location relative to a package from where assets will be loaded
13  /// </summary>
14  [DataContract("AssetFolder")]
15  [DebuggerDisplay("{Path} RawImports [{RawImports.Count}]")]
16  public sealed class AssetFolder
17  {
18  private UDirectory path;
19  private readonly List<RawImport> rawImports;
20 
21  /// <summary>
22  /// Initializes a new instance of the <see cref="AssetFolder"/> class.
23  /// </summary>
24  public AssetFolder()
25  {
26  rawImports = new List<RawImport>();
27  }
28 
29  /// <summary>
30  /// Initializes a new instance of the <see cref="AssetFolder"/> class.
31  /// </summary>
32  /// <param name="path">The folder.</param>
33  public AssetFolder(UDirectory path) : this()
34  {
35  if (path == null) throw new ArgumentNullException("path");
36  this.path = path;
37  }
38 
39  /// <summary>
40  /// Gets or sets the folder.
41  /// </summary>
42  /// <value>The folder.</value>
43  public UDirectory Path
44  {
45  get
46  {
47  return path;
48  }
49  set
50  {
51  if (value == null) throw new ArgumentNullException();
52  path = value;
53  }
54  }
55 
56  /// <summary>
57  /// Gets the raw imports (a collection of files, or wildcard)
58  /// </summary>
59  /// <value>The raw imports.</value>
60  public List<RawImport> RawImports
61  {
62  get
63  {
64  return rawImports;
65  }
66  }
67 
68  public AssetFolder Clone()
69  {
70  var sourceFolder = new AssetFolder();
71  if (Path != null)
72  {
73  sourceFolder.Path = path;
74  }
75  sourceFolder.RawImports.AddRange(RawImports);
76  return sourceFolder;
77  }
78  }
79 }
A location relative to a package from where assets will be loaded
Definition: AssetFolder.cs:16
Defines a normalized directory path. See UPath for details. This class cannot be inherited.
Definition: UDirectory.cs:13
AssetFolder(UDirectory path)
Initializes a new instance of the AssetFolder class.
Definition: AssetFolder.cs:33
AssetFolder()
Initializes a new instance of the AssetFolder class.
Definition: AssetFolder.cs:24