コード例 #1
0
ファイル: PackageReference.cs プロジェクト: Tembocs/Soup
        /// <summary>
        /// Try parse a package reference from the provided string
        /// </summary>
        public static bool TryParse(string value, out PackageReference result)
        {
            try
            {
                result = Parse(value);
                return(true);
            }
            catch (ArgumentException)
            {
            }

            result = null;
            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Read json
        /// </summary>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType != JsonToken.String)
            {
                return(null);
            }

            var result = existingValue as PackageReference ?? new PackageReference();
            var value  = reader.Value as string;

            if (PackageReference.TryParse(value, out PackageReference newValue))
            {
                result = newValue;
            }

            return(result);
        }
コード例 #3
0
 /// <summary>
 /// Build the kitchen include path
 /// </summary>
 public static string BuildKitchenIncludePath(LocalUserConfig config, PackageReference reference)
 {
     return(BuildKitchenIncludePath(config, reference.Name, reference.Version));
 }