コード例 #1
0
        public static Tag Create(Tag_Id Id,
                                 Languages Language,
                                 String Text)

        => new Tag(Id,
                   I18NString.Create(Language,
                                     Text));
コード例 #2
0
            public static Builder Create(Tag_Id Id,
                                         Languages Language,
                                         String Text)

            => new Builder(Id,
                           I18NString.Create(Language,
                                             Text));
コード例 #3
0
 /// <summary>
 /// Create a new tag.
 /// </summary>
 /// <param name="Id">The unique identification of the user tag.</param>
 /// <param name="Description">An optional (multi-language) description of the user tag.</param>
 public Tag(Tag_Id Id,
            I18NString Description = null)
 {
     this.Id          = Id;
     this.Description = Description ?? new I18NString();
     this.Tags        = new Tags.Builder();
 }
コード例 #4
0
ファイル: Tags.cs プロジェクト: Vanaheimr/UsersAPI
        /// <summary>
        /// Try to parse the given tag JSON.
        /// </summary>
        /// <param name="JSONArray">A JSON array.</param>
        /// <param name="Tags">The parsed tags.</param>
        /// <param name="ErrorResponse">An error message.</param>
        public static Boolean TryParseJSON(JArray JSONArray,
                                           out Tags Tags,
                                           out String ErrorResponse)
        {
            try
            {
                ErrorResponse = null;

                if (JSONArray == null)
                {
                    ErrorResponse = "The given JSON object must not be null!";
                    Tags          = null;
                    return(false);
                }

                if (JSONArray.HasValues)
                {
                    var _tags = new Dictionary <Tag, TagEdge>();

                    foreach (var item in JSONArray)
                    {
                        try
                        {
                            if (item is JArray array && array.Children().Count() == 2)
                            {
                                var TagId     = item[0].Value <String>();
                                var TagObject = item[0] as JObject;

                                if (TagObject != null && Tag.TryParseJSON(item[0] as JObject,
                                                                          out Tag Tag2,
                                                                          out ErrorResponse))
                                {
                                    _tags.Add(Tag2,
                                              new TagEdge(TagEdgeLabel.IsSameAs, item[1].Value <Single>()));
                                }

                                else
                                {
                                    _tags.Add(new Tag(Tag_Id.Parse(TagId)),
                                              new TagEdge(TagEdgeLabel.IsSameAs, item[1].Value <Single>()));
                                }
                            }
                        }
コード例 #5
0
 /// <summary>
 /// Create a new tag builder.
 /// </summary>
 /// <param name="Id">The unique identification of the user tag.</param>
 /// <param name="Description">An optional (multi-language) description of the user tag.</param>
 public Builder(Tag_Id Id,
                I18NString Description = null)
 {
     this.Id          = Id;
     this.Description = Description ?? new I18NString();
 }