Exemplo n.º 1
0
        /// <summary>
        ///    Gets a specified volume adjustment frame from the
        ///    specified tag, optionally creating it if it does not
        ///    exist.
        /// </summary>
        /// <param name="tag">
        ///    A <see cref="Tag" /> object to search in.
        /// </param>
        /// <param name="identification">
        ///    A <see cref="string" /> specifying the identification to
        ///    match.
        /// </param>
        /// <param name="create">
        ///    A <see cref="bool" /> specifying whether or not to create
        ///    and add a new frame to the tag if a match is not found.
        /// </param>
        /// <returns>
        ///    A <see cref="RelativeVolumeFrame" /> object containing
        ///    the matching frame, or <see langword="null" /> if a match
        ///    wasn't found and <paramref name="create" /> is <see
        ///    langword="false" />.
        /// </returns>
        public static RelativeVolumeFrame Get(Tag tag,
                                              string identification,
                                              bool create)
        {
            RelativeVolumeFrame rva2;

            foreach (Frame frame in tag.GetFrames(FrameType.RVA2))
            {
                rva2 = frame as RelativeVolumeFrame;

                if (rva2 == null)
                {
                    continue;
                }

                if (rva2.Identification != identification)
                {
                    continue;
                }

                return(rva2);
            }

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

            rva2 = new RelativeVolumeFrame(identification);
            tag.AddFrame(rva2);
            return(rva2);
        }
Exemplo n.º 2
0
        /// <summary>
        ///    Creates a deep copy of the current instance.
        /// </summary>
        /// <returns>
        ///    A new <see cref="Frame" /> object identical to the
        ///    current instance.
        /// </returns>
        public override Frame Clone()
        {
            RelativeVolumeFrame frame =
                new RelativeVolumeFrame(identification);

            for (int i = 0; i < 9; i++)
            {
                frame.channels [i] = channels [i];
            }
            return(frame);
        }