/// <summary> /// Initializes a new instance of the <see cref="Package"/> class. /// </summary> public Package() { localDependencies = new List <PackageReference>(); temporaryAssets = new AssetItemCollection(); assets = new PackageAssetCollection(this); explicitFolders = new List <UDirectory>(); Bundles = new BundleCollection(this); Meta = new PackageMeta(); TemplateFolders = new List <TemplateFolder>(); Templates = new List <TemplateDescription>(); Profiles = new PackageProfileCollection(); IsDirty = true; }
/// <summary> /// Initializes a new instance of the <see cref="Package"/> class. /// </summary> public Package() { localDependencies = new List <PackageReference>(); temporaryAssets = new AssetItemCollection(); assets = new PackageAssetCollection(this); explicitFolders = new List <UDirectory>(); loadedAssemblies = new List <PackageLoadedAssembly>(); Bundles = new BundleCollection(this); Meta = new PackageMeta(); TemplateFolders = new List <TemplateFolder>(); Templates = new List <TemplateDescription>(); Profiles = new PackageProfileCollection(); IsDirty = true; settings = new Lazy <PackageUserSettings>(() => new PackageUserSettings(this)); SerializedVersion = PackageFileVersion; }
public void ValidateAssets(bool alwaysGenerateNewAssetId = false) { if (TemporaryAssets.Count == 0) { return; } try { // Make sure we are suspending notifications before updating all assets Assets.SuspendCollectionChanged(); Assets.Clear(); // Get generated output items var outputItems = new AssetItemCollection(); // Create a resolver from the package var resolver = AssetResolver.FromPackage(this); resolver.AlwaysCreateNewId = alwaysGenerateNewAssetId; // Clean assets AssetCollision.Clean(TemporaryAssets, outputItems, resolver, false); // Add them back to the package foreach (var item in outputItems) { Assets.Add(item); } TemporaryAssets.Clear(); } finally { // Restore notification on assets Assets.ResumeCollectionChanged(); } }