internal void AddTag(ImageTag tag) { if ((tag.TagTypes & AllowedTypes) != tag.TagTypes) { throw new Exception(String.Format("Attempted to add {0} to an image, but the only allowed types are {1}", tag.TagTypes, AllowedTypes)); } if (tag is IFDTag) { Exif = tag as IFDTag; } else if (tag is XmpTag) { // we treat a IPTC-IIM tag as a XMP tag. However, we prefer the real XMP tag. // See comments in Jpeg/File.cs for what we should do to deal with this properly. if (Xmp != null && (tag is IIM.IIMTag || Xmp is IIM.IIMTag)) { var iimTag = tag as IIM.IIMTag; if (iimTag == null) { iimTag = Xmp as IIM.IIMTag; Xmp = tag as XmpTag; } if (string.IsNullOrEmpty(Xmp.Title)) { Xmp.Title = iimTag.Title; } if (string.IsNullOrEmpty(Xmp.Creator)) { Xmp.Creator = iimTag.Creator; } if (string.IsNullOrEmpty(Xmp.Copyright)) { Xmp.Copyright = iimTag.Copyright; } if (string.IsNullOrEmpty(Xmp.Comment)) { Xmp.Comment = iimTag.Comment; } if (Xmp.Keywords == null) { Xmp.Keywords = iimTag.Keywords; } } else { Xmp = tag as XmpTag; } } else { OtherTags.Add(tag); } all_tags = null; }
private string CompileTagString() { string tags = string.Empty; Characters.ForEach(x => tags += tags_base + x); Fandoms.ForEach(x => tags += tags_base + x); // all three take each item and add it to the tags string with tags_base before it OtherTags.ForEach(x => tags += tags_base + x); tags.Trim(); return(tags); }
internal void AddTag(ImageTag tag) { if ((tag.TagTypes & AllowedTypes) != tag.TagTypes) { throw new Exception(String.Format("Attempted to add {0} to an image, but the only allowed types are {1}", tag.TagTypes, AllowedTypes)); } if (tag is IFDTag) { Exif = tag as IFDTag; } else if (tag is XmpTag) { if (Xmp != null && (tag is IIM.IIMTag || Xmp is IIM.IIMTag)) { var iimTag = tag as IIM.IIMTag; if (iimTag == null) { iimTag = Xmp as IIM.IIMTag; Xmp = tag as XmpTag; } if (string.IsNullOrEmpty(Xmp.Title)) { Xmp.Title = iimTag.Title; } if (string.IsNullOrEmpty(Xmp.Creator)) { Xmp.Creator = iimTag.Creator; } if (string.IsNullOrEmpty(Xmp.Copyright)) { Xmp.Copyright = iimTag.Copyright; } if (string.IsNullOrEmpty(Xmp.Comment)) { Xmp.Comment = iimTag.Comment; } if (Xmp.Keywords == null) { Xmp.Keywords = iimTag.Keywords; } } else { Xmp = tag as XmpTag; } } else { OtherTags.Add(tag); } all_tags = null; }
internal void RemoveTag(ImageTag tag) { if (tag is IFDTag) { Exif = null; } else if (tag is XmpTag) { Xmp = null; } else { OtherTags.Remove(tag); } all_tags = null; }
internal void AddTag(ImageTag tag) { if ((tag.TagTypes & AllowedTypes) != tag.TagTypes) { throw new Exception(String.Format("Attempted to add {0} to an image, but the only allowed types are {1}", tag.TagTypes, AllowedTypes)); } if (tag is IFDTag) { Exif = tag as IFDTag; } else if (tag is XmpTag) { Xmp = tag as XmpTag; } else { OtherTags.Add(tag); } all_tags = null; }
private void LoadV2Tag(TagLib.Id3v2.Tag id3Tag) { Album = id3Tag.Album; Artist = id3Tag.JoinedPerformers; AlbumArtist = id3Tag.JoinedAlbumArtists; DiscNumber = id3Tag.Disc != 0 ? id3Tag.Disc.ToString() : ""; DiscCount = id3Tag.DiscCount != 0 ? id3Tag.DiscCount.ToString() : ""; DiscNumberAndCount = id3Tag.Frames.Any(f => f.FrameId.ToString() == "TPOS") ? id3Tag.Frames.First(f => f.FrameId.ToString() == "TPOS").ToString() : ""; TrackNumber = id3Tag.Track.ToString(); Year = id3Tag.Year == 0 ? "0000" : id3Tag.Year.ToString(); Genre = id3Tag.JoinedGenres; Title = id3Tag.Title; ContainsOtherTags = id3Tag.Frames.Any(f => !ValidFrameNames.Contains(f.FrameId.ToString())); if (ContainsOtherTags) { List <string> invalidTagsDescriptions = new List <string>(); var invalidTagsFrameIDs = id3Tag.Frames.Where(f => !ValidFrameNames.Contains(f.FrameId.ToString())).ToList(); foreach (var frame in invalidTagsFrameIDs) { try { //The frame can be of multiple types, so let's try and get the description var frameProperties = frame.GetType().GetProperties(); var frameDescription = frameProperties.FirstOrDefault(p => p.Name == "Description"); var descriptionValue = (string)frameDescription.GetValue(frame, null); if (string.IsNullOrWhiteSpace(descriptionValue)) { if (Data.ID3V2Definitions.FrameDefintions.ContainsKey(frame.FrameId.ToString())) { descriptionValue = Data.ID3V2Definitions.FrameDefintions[frame.FrameId.ToString()]; } else { descriptionValue = frame.FrameId.ToString(); } } invalidTagsDescriptions.Add(descriptionValue); frameDescription = null; frameProperties = null; } catch { if (Data.ID3V2Definitions.FrameDefintions.ContainsKey(frame.FrameId.ToString())) { invalidTagsDescriptions.Add(Data.ID3V2Definitions.FrameDefintions[frame.FrameId.ToString()]); } else { invalidTagsDescriptions.Add(frame.FrameId.ToString()); } } } OtherTags = string.Join(",", invalidTagsDescriptions); if ((OtherTags.ToLower() == "totaldiscs,totaltracks" || OtherTags.ToLower() == "totaltracks,totaldiscs" || OtherTags.ToLower() == "totaldiscs" || OtherTags.ToLower() == "totaltracks") && IgnoreITunesTotalTags) { ContainsOtherTags = false; OtherTags = ""; } } else { OtherTags = ""; } }
public bool[] BuildUsedRequestArray() { // Set anything false that is not used. This will be used when guilding the query string. bool[] used = new bool[18] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true }; if (Basic is null || Basic.Equals("")) { used[0] = false; } if (Title is null || Title.Equals("")) { used[1] = false; } if (Authors is null || Authors.Equals("")) { used[2] = false; } if (Characters is null || Characters.Equals("")) { used[3] = false; } if (Relationships is null || Relationships.Equals("")) { used[4] = false; } if (Fandoms is null || Fandoms.Equals("")) { used[5] = false; } if (OtherTags is null || OtherTags.Equals("")) { used[6] = false; } if (Likes.Item1 == 0 && Likes.Item2 == 0) { used[7] = false; } if (Views.Item1 == 0 && Views.Item2 == 0) { used[8] = false; } if (Comments.Item1 == 0 && Comments.Item2 == 0) { used[9] = false; } if (WordCount.Item1 == 0 && WordCount.Item2 == 0) { used[10] = false; } if (UpdateBefore.Item1 == default || UpdateBefore.Item2 == default) { used[11] = false; } if (PublishBefore.Item1 == default || PublishBefore.Item2 == default) { used[12] = false; } if (Direction == 0) { used[13] = false; } if (SearchFicsBy == 0) { used[14] = false; } if (FicRaiting == 0) { used[15] = false; } if (Status == 0) { used[16] = false; } if (Crossover == 0) { used[17] = false; } return(used); }