コード例 #1
0
        /// <summary>
        ///    Renders the current instance to a <see cref="ByteVector"/>
        /// </summary>
        /// <param name="is_bigendian">
        ///    A <see cref="System.Boolean"/> indicating the endianess for rendering.
        /// </param>
        /// <param name="offset">
        ///    A <see cref="System.UInt32"/> with the offset, the data is stored.
        /// </param>
        /// <param name="type">
        ///    A <see cref="System.UInt16"/> the ID of the type, which is rendered
        /// </param>
        /// <param name="count">
        ///    A <see cref="System.UInt32"/> with the count of the values which are
        ///    rendered.
        /// </param>
        /// <returns>
        ///    A <see cref="ByteVector"/> with the rendered data.
        /// </returns>
        public ByteVector Render(bool is_bigendian, uint offset, out ushort type, out uint count)
        {
            type  = (ushort)IFDEntryType.SLong;
            count = 1;

            return(ByteVector.FromInt(Value, is_bigendian));
        }
コード例 #2
0
ファイル: ByteVectorTest.cs プロジェクト: rygos/iTagger
 public void Int()
 {
     Assert.AreEqual(Int32.MaxValue, ByteVector.FromInt(Int32.MaxValue).ToInt());
     Assert.AreEqual(Int32.MinValue, ByteVector.FromInt(Int32.MinValue).ToInt());
     Assert.AreEqual(0, ByteVector.FromInt(0).ToInt());
     Assert.AreEqual(30292, ByteVector.FromInt(30292).ToInt());
     Assert.AreEqual(-30292, ByteVector.FromInt(-30292).ToInt());
     Assert.AreEqual(-1, ByteVector.FromInt(-1).ToInt());
 }
コード例 #3
0
        public ByteVector Render(bool is_bigendian, uint offset, out ushort type, out uint count)
        {
            type  = (ushort)IFDEntryType.SRational;
            count = 1;
            ByteVector data = new ByteVector();

            data.Add(ByteVector.FromInt(Value.Numerator, is_bigendian));
            data.Add(ByteVector.FromInt(Value.Denominator, is_bigendian));
            return(data);
        }
コード例 #4
0
        public override ByteVector Render(bool is_bigendian, uint offset, out ushort type, out uint count)
        {
            type  = (ushort)IFDEntryType.Long;
            count = (uint)Values.Length;
            ByteVector data = new ByteVector();

            foreach (int value in Values)
            {
                data.Add(ByteVector.FromInt(value, is_bigendian));
            }
            return(data);
        }
コード例 #5
0
        public override ByteVector Render(bool is_bigendian, uint offset, out ushort type, out uint count)
        {
            type  = (ushort)IFDEntryType.SRational;
            count = (uint)Values.Length;
            ByteVector data = new ByteVector();

            foreach (SRational rational in Values)
            {
                data.Add(ByteVector.FromInt(rational.Numerator, is_bigendian));
                data.Add(ByteVector.FromInt(rational.Denominator, is_bigendian));
            }
            return(data);
        }
コード例 #6
0
        /// <summary>
        ///    Renders the values in the current instance into field
        ///    data for a specified version.
        /// </summary>
        /// <param name="version">
        ///    A <see cref="byte" /> indicating the ID3v2 version the
        ///    field data is to be encoded in.
        /// </param>
        /// <returns>
        ///    A <see cref="ByteVector" /> object containing the
        ///    rendered field data.
        /// </returns>
        protected override ByteVector RenderFields(byte version)
        {
            var data = new List <byte> {
                (byte)TimestampFormat
            };

            foreach (var @event in Events)
            {
                data.Add((byte)@event.TypeOfEvent);

                var timeData = ByteVector.FromInt(@event.Time);
                data.AddRange(timeData.Data);
            }

            return(new ByteVector(data.ToArray()));
        }
コード例 #7
0
ファイル: Tagger.cs プロジェクト: Aftnet/NetMediaInfoLib
        private bool TagMp4TVEpisode(ITVEpisode payload, IFileAbstraction target)
        {
            using (var file = Create(target))
            {
                file.RemoveTags(TagTypes.AllTags);
                var tag = (AppleTag)file.GetTag(TagTypes.Apple, true);
                GetTVEpisodeData(payload, out var title, out var genres, out var description, out var image);
                SetBasicProperties(tag, title, genres, description, image);

                SetPropertyIfValid(tag, $"https://www.themoviedb.org/tv/{payload.Parent.Parent.ID}", AppleDefaultBoxes.Url);
                tag.SetData(AppleDefaultBoxes.TvSeasonNumber, ByteVector.FromInt(payload.Parent.Number), 0);
                tag.SetData(AppleDefaultBoxes.TvEpisodeNumber, ByteVector.FromInt(payload.Number), 0);
                SetPropertyIfValid(tag, payload.Parent.Parent.Title, AppleDefaultBoxes.TvShowName);
                SetItunesMediaProperties(tag, file.Properties, AppleDefaultBoxes.ITunesMediaTypes.TVShow);
                file.Save();
            }

            return(true);
        }