Пример #1
0
 public DerpTag(DerpTag org)
 {
     NameEn        = org.NameEn;
     NameKr        = org.NameKr;
     DescriptionEn = org.DescriptionEn;
     DescriptionKr = org.DescriptionKr;
     Synonym       = org.Synonym;
     Index         = org.Index;
     Category      = org.Category;
 }
Пример #2
0
        public DerpTag Clone()
        {
            DerpTag model = new DerpTag();

            model.Id            = this.Id;
            model.Index         = this.Index;
            model.Category      = this.Category;
            model.NameEn        = this.NameEn;
            model.NameKr        = this.NameKr;
            model.DescriptionEn = this.DescriptionEn;
            model.DescriptionKr = this.DescriptionKr;
            model.Synonym       = this.Synonym;
            model.IsFavorite    = this.IsFavorite;
            return(model);
        }
Пример #3
0
 public bool Equals(DerpTag other)
 {
     return(Id.Equals(other.Id));
 }
Пример #4
0
        public void GetContents()
        {
            var            tagstr  = Tags.Replace(", ", ",").Split(',');
            List <DerpTag> tags    = new List <DerpTag>();
            List <string>  tagstr2 = new List <string>();

            _artists = _characters = _anothers = _contents = string.Empty;
            try
            {
                for (int i = 0; i < tagstr.Length; i++)
                {
                    DerpTag tag = ContentTags.Find(item => item.NameEn == tagstr[i]);
                    string  name;
                    if (tag != null)
                    {
                        name = tag.Name;
                    }
                    else
                    {
                        name = tagstr[i];
                    }
                    if (tag != null && tag.Category == DerpTagCategory.RATING)
                    {
                        if (_anothers.Length == 0)
                        {
                            _anothers = name;
                        }
                        else
                        {
                            _anothers += ", " + name;
                        }
                    }
                    else if (tagstr[i] == "artist needed" || tagstr[i].StartsWith("artist:") || tagstr[i].StartsWith("editor:") || tagstr[i].StartsWith("commissioner:"))
                    {
                        if (_artists.Length == 0)
                        {
                            _artists = name;
                        }
                        else
                        {
                            _artists += ", " + name;
                        }
                    }
                    else if (tagstr[i].StartsWith("spoiler:") || tagstr[i].StartsWith("comic:") || tagstr[i].StartsWith("fanfic:") || tagstr[i].StartsWith("game:") || tagstr[i].StartsWith("art pack:") || tagstr[i].StartsWith("series:"))
                    {
                        if (_contents.Length == 0)
                        {
                            _contents = name;
                        }
                        else
                        {
                            _contents += ", " + name;
                        }
                    }
                    else if (tagstr[i] == "oc" || tagstr[i] == "oc only")
                    {
                        if (_characters.Length == 0)
                        {
                            _characters = name;
                        }
                        else
                        {
                            _characters += ", " + name;
                        }
                    }
                    else if (tag != null &&
                             (tag.Category == DerpTagCategory.ARTCATEGORY ||
                              tag.Category == DerpTagCategory.CHARACTERFEATURE ||
                              tag.Category == DerpTagCategory.RACE ||
                              tag.Category == DerpTagCategory.POSE ||
                              tag.Category == DerpTagCategory.BODYPART ||
                              tag.Category == DerpTagCategory.BEHAVIOR))
                    {
                        tags.Add(tag);
                    }
                    else
                    {
                        tagstr2.Add(tagstr[i]);
                    }
                }

                foreach (var tag in tags.OrderBy(i => i.Category))
                {
                    if (_anothers.Length == 0)
                    {
                        _anothers = tag.Name;
                    }
                    else
                    {
                        _anothers += ", " + tag.Name;
                    }
                }

                for (int i = 0; i < tagstr2.Count; i++)
                {
                    DerpTag tag = ContentTags.Find(item => item.NameEn == tagstr2[i]);
                    string  name;
                    if (tag != null)
                    {
                        name = tag.Name;
                    }
                    else
                    {
                        name = tagstr2[i];
                    }

                    if (tag != null && tag.Category == DerpTagCategory.ORIGIN)
                    {
                        if (_artists.Length == 0)
                        {
                            _artists = tag.Name;
                        }
                        else
                        {
                            _artists += ", " + tag.Name;
                        }
                    }
                    else if (tag != null && (tag.Category == DerpTagCategory.CONTENTOFFICIAL || tag.Category == DerpTagCategory.CONTENTFANMADE))
                    {
                        if (_contents.Length == 0)
                        {
                            _contents = tag.Name;
                        }
                        else
                        {
                            _contents += ", " + tag.Name;
                        }
                    }
                    else if (tagstr2[i].StartsWith("oc:"))
                    {
                        if (_characters.Length == 0)
                        {
                            _characters = tagstr2[i];
                        }
                        else
                        {
                            _characters += ", " + tagstr2[i];
                        }
                    }
                    else if (tag != null && (tag.Category == DerpTagCategory.OC || tag.Category == DerpTagCategory.CHARACTER))
                    {
                        if (_characters.Length == 0)
                        {
                            _characters = tag.Name;
                        }
                        else
                        {
                            _characters += ", " + tag.Name;
                        }
                    }
                    else if (tag != null)
                    {
                        if (_anothers.Length == 0)
                        {
                            _anothers = tag.Name;
                        }
                        else
                        {
                            _anothers += ", " + tag.Name;
                        }
                    }
                    else
                    {
                        string org = tagstr2[i];
                        int    acc = 0;
                        string temp2;

                        if (DerpTag.Korean)
                        {
                            while (true)
                            {
                                int space = org.IndexOf(' ', acc);
                                if (space > 0 && space < org.Length - 1)
                                {
                                    string word1 = org.Substring(0, space);
                                    string word2 = org.Substring(space + 1);

                                    var tag1 = ContentTags.Find(item => item.NameEn == word1);
                                    var tag2 = ContentTags.Find(item => item.NameEn == word2);

                                    if (tag1 != null && tag2 != null)
                                    {
                                        temp2 = tag1.Name + ' ' + tag2.Name;
                                        break;
                                    }
                                    else
                                    {
                                        acc = word1.Length + 1;
                                    }
                                }
                                else
                                {
                                    temp2 = tagstr2[i];
                                    break;
                                }
                            }
                        }
                        else
                        {
                            temp2 = tagstr2[i];
                        }


                        if (_anothers.Length == 0)
                        {
                            _anothers = temp2;
                        }
                        else
                        {
                            _anothers += ", " + temp2;
                        }
                    }
                }
            }
            catch
            { }
            _artists    = _artists.Length == 0 ? "unknown artist" : _artists;
            _contents   = _contents.Length == 0 ? "no content" : _contents;
            _characters = _characters.Length == 0 ? "no character" : _characters;
            _anothers   = _anothers.Length == 0 ? "no tag" : _anothers;
        }
Пример #5
0
 public DerpSuggestionItem(string key, DerpTag obj)
 {
     Key = key;
     Tag = obj;
 }