Exemple #1
0
        public static UserTextInformationFrame Get(Tag tag,
                                                   string description,
                                                   StringType type,
                                                   bool create)
        {
            if (tag == null)
            {
                throw new ArgumentNullException("tag");
            }

            if (description == null)
            {
                throw new ArgumentNullException("description");
            }

            if (description.Length == 0)
            {
                throw new ArgumentException(
                          "Description must not be empty.",
                          "description");
            }

            foreach (UserTextInformationFrame frame in
                     tag.GetFrames <UserTextInformationFrame> (
                         FrameType.TXXX))
            {
                if (description.Equals(frame.Description))
                {
                    return(frame);
                }
            }

            if (!create)
            {
                return(null);
            }

            UserTextInformationFrame new_frame =
                new UserTextInformationFrame(description,
                                             type);

            tag.AddFrame(new_frame);
            return(new_frame);
        }
		public static UserTextInformationFrame Get (Tag tag,
		                                            string description,
		                                            StringType type,
		                                            bool create)
		{
			if (tag == null)
				throw new ArgumentNullException ("tag");
			
			if (description == null)
				throw new ArgumentNullException ("description");
			
			if (description.Length == 0)
				throw new ArgumentException (
					"Description must not be empty.",
					"description");
			
			foreach (UserTextInformationFrame frame in
				tag.GetFrames<UserTextInformationFrame> (
					FrameType.TXXX))
				if (description.Equals (frame.Description))
					return frame;
			
			if (!create)
				return null;
			
			UserTextInformationFrame new_frame =
				new UserTextInformationFrame (description,
					type);
			tag.AddFrame (new_frame);
			return new_frame;
		}