Example #1
0
        public Tag(byte[] image, int offset)
        {
            this.header = new TagHeader(image, offset);
            BinarySubstr data = this.header.content;

#if DEBUG
            __dll__.log.Lock();
            __dll__.log.WriteLine("[ID3v2.3.0 Tag]");
            __dll__.log.AddIndent();
            __dll__.log.WriteVar("IsExperimentalTag", this.header.experimental.ToString());
            __dll__.log.WriteVar("Unsynchronization", this.header.unsynchronization.ToString());
            __dll__.log.WriteVar("HasExtendedHeader", this.header.hasExtHeader.ToString());
#endif
            if (this.header.hasExtHeader)
            {
                this.extheader = new ExtendedHeader(data);
#if DEBUG
                __dll__.log.WriteVar("PaddingSize", this.extheader.paddingSize.ToString());
                __dll__.log.WriteVar("HasCRC32", this.extheader.hasCrc32.ToString());
#endif
                if (this.extheader.hasCrc32)
                {
                    uint crc32 = data.CalculateCRC32();
                    __dll__.log.WriteLine("    CRC32 Check: 実 {0:X8} --><-- {1:X8} 理", crc32, this.extheader.crc32);
                    if (crc32 != this.extheader.crc32)
                    {
                        throw new System.ApplicationException("Crc 値が一致しません。");
                    }
                }
            }
            afh.Collections.DictionaryP <string, FrameHeader> headers = FrameHeader.GetFrameHeaders(data);
            this.frames = headers.Map <Frame>(Frame.CreateFrame);
#if DEBUG
            __dll__.log.RemoveIndent();
            foreach (Gen::KeyValuePair <string, Frame> pair in this.frames)
            {
                __dll__.log.WriteLine("Frame---");
                __dll__.log.AddIndent();
                __dll__.log.WriteVar("FrameID", pair.Key);
                __dll__.log.WriteVar("FrameType", pair.Value.GetType().FullName);
                //__dll__.log.WriteVar("Discards on TagChange",pair.Value.discardOnAlteringTag.ToString());
                //__dll__.log.WriteVar("Discards on FileChange",pair.Value.discardOnAlteringFile.ToString());
                //__dll__.log.WriteVar("ReadOnly",pair.Value.readOnly.ToString());
                //__dll__.log.WriteVar("Compressed",pair.Value.compression.ToString());
                //__dll__.log.WriteVar("Encrypted",pair.Value.encryption.ToString());
                //__dll__.log.WriteVar("Grouping",pair.Value.grouping.ToString());
                if (pair.Value is ID3v2_3_.TextInformationFrame)
                {
                    __dll__.log.WriteVar("TextContent", ((ID3v2_3_.TextInformationFrame)pair.Value).Text);
                }
                __dll__.log.RemoveIndent();
            }
            __dll__.log.Unlock();
#endif
        }
Example #2
0
 //=================================================
 //		Constructor
 //=================================================
 /// <summary>
 /// 新しい Tag を生成します。
 /// </summary>
 public Tag()
 {
     this.header = new TagHeader();
 }