Beispiel #1
0
        /// <summary>
        /// Tries to parse a package reference in the format {guid:location}.
        /// </summary>
        /// <param name="packageReferenceAsText">The package reference as text.</param>
        /// <param name="packageReference">The package reference.</param>
        /// <returns><c>true</c> if the package reference is a valid reference, <c>false</c> otherwise.</returns>
        public static bool TryParse(string packageReferenceAsText, out PackageReference packageReference)
        {
            Guid  id;
            UFile location;

            packageReference = null;
            if (AssetReference.TryParse(packageReferenceAsText, out id, out location))
            {
                packageReference = new PackageReference(id, location);
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Tries to parse a package reference in the format {guid:location}.
        /// </summary>
        /// <param name="packageReferenceAsText">The package reference as text.</param>
        /// <param name="packageReference">The package reference.</param>
        /// <returns><c>true</c> if the package reference is a valid reference, <c>false</c> otherwise.</returns>
        public static bool TryParse(string packageReferenceAsText, out PackageReference packageReference)
        {
            Guid  id;
            UFile location;

            packageReference = null;
            Guid referenceId;

            if (AssetReference.TryParse(packageReferenceAsText, out referenceId, out id, out location))
            {
                packageReference = new PackageReference(id, location);
                if (referenceId != Guid.Empty)
                {
                    IdentifiableHelper.SetId(packageReference, referenceId);
                }
                return(true);
            }
            return(false);
        }