Пример #1
0
        internal ContentManifestAsset(ContentManifestGroup group, ContentManifestAssetDescription desc)
        {
            Contract.Require(group, nameof(group));
            Contract.Require(desc, nameof(desc));

            if (String.IsNullOrEmpty(desc.Name))
                throw new InvalidDataException(UltravioletStrings.InvalidContentManifestAssetName);

            if (String.IsNullOrEmpty(desc.Path))
                throw new InvalidDataException(UltravioletStrings.InvalidContentManifestAssetPath.Format(desc.Name));

            this.ManifestGroup = group;
            this.Name = desc.Name;
            this.RelativePath = desc.Path;
            this.AbsolutePath = Path.Combine(group.Directory, desc.Path);
            this.Type = group.Type;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentManifestAsset"/> class.
        /// </summary>
        /// <param name="group">The <see cref="ContentManifestGroup"/> that owns the asset.</param>
        /// <param name="desc">The manifest asset description.</param>
        internal ContentManifestAsset(ContentManifestGroup group, ContentManifestAssetDescription desc)
        {
            Contract.Require(group, nameof(group));
            Contract.Require(desc, nameof(desc));

            if (String.IsNullOrEmpty(desc.Name))
            {
                throw new InvalidDataException(UltravioletStrings.InvalidContentManifestAssetName);
            }

            if (String.IsNullOrEmpty(desc.Path))
            {
                throw new InvalidDataException(UltravioletStrings.InvalidContentManifestAssetPath.Format(desc.Name));
            }

            this.ManifestGroup = group;
            this.Name          = desc.Name;
            this.RelativePath  = desc.Path;
            this.AbsolutePath  = Path.Combine(group.Directory, desc.Path);
            this.Type          = group.Type;
        }