public object Clone() { BooruTagList cList = new BooruTagList(); this.ForEach(x => cList.Add(x.Clone() as BooruTag)); return(cList); }
private static void TagDelta(ref BooruTagList Tags, string deltaString) { var removeTags = new List <string>(); var addTags = new List <string>(); string[] deltaParts = deltaString.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (string part in deltaParts) { if (part.StartsWith("_") && part.Length > 1) { removeTags.Add(part.Substring(1).ToLower()); } else { addTags.Add(part.ToLower()); } } for (int i = Tags.Count - 1; !(i < 0); i--) { if (removeTags.Contains(Tags[i].Tag)) { Tags.RemoveAt(i); } } foreach (string addTag in addTags) { Tags.Add(new BooruTag(addTag)); } }
public static BooruTagList FromTable(DataTable Table) { BooruTagList bTagList = new BooruTagList(); foreach (DataRow row in Table.Rows) { bTagList.Add(BooruTag.FromRow(row)); } return(bTagList); }
public static BooruTagList FromReader(ReaderWriter Reader) { uint count = Reader.ReadUInt(); BooruTagList bTagList = new BooruTagList(); for (uint i = 0; i < count; i++) { bTagList.Add(BooruTag.FromReader(Reader)); } return(bTagList); }
public static BooruTagList FromString(string Tags) { BooruTagList bTagList = new BooruTagList(); if (!string.IsNullOrWhiteSpace(Tags)) { string[] parts = Tags.Split(new char[4] { ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries); foreach (string part in parts) { bTagList.Add(new BooruTag(part.ToLower())); } } return(bTagList); }