コード例 #1
0
        private void WriteSuffixDiin(Stream outStream)
        {
            var diinSource = GetChunkById(DsdChunk.IdType.DIIN);

            if (diinSource != null)
            {
                // Write DIIN
                var diinChunk = new DsdChunksContainer(DsdChunk.IdType.DIIN);

                // > MARK property
                // Ignore at this moment

                // > DIAR property
                if (!string.IsNullOrEmpty(diinSource.ArtistText))
                {
                    if ((diinSource.ArtistText.Length % 2) != 0)
                    {
                        diinSource.ArtistText += " ";
                    }

                    var diarChunk = new DsdChunksContainer(DsdChunk.DiinChunk.DIAR);
                    diarChunk.WriteInt32(diinSource.ArtistText.TrimEnd().Length);
                    diarChunk.WriteIdString(diinSource.ArtistText, diinSource.ArtistText.Length);
                    diinChunk.WriteChunk(diarChunk);
                }

                // > DITI property
                if (!string.IsNullOrEmpty(diinSource.TitleText))
                {
                    if ((diinSource.TitleText.Length % 2) != 0)
                    {
                        diinSource.TitleText += " ";
                    }

                    var ditiChunk = new DsdChunksContainer(DsdChunk.DiinChunk.DITI);
                    ditiChunk.WriteInt32(diinSource.TitleText.TrimEnd().Length);
                    ditiChunk.WriteIdString(diinSource.TitleText, diinSource.TitleText.Length);
                    diinChunk.WriteChunk(ditiChunk);
                }

                // > EMID property
                if (!string.IsNullOrEmpty(diinSource.EMId))
                {
                    Console.WriteLine("EMID: " + diinSource.EMId + ", length: " + diinSource.EMId.Length);
                    Console.WriteLine("\n\n");
                    var emidChunk = new DsdChunksContainer(DsdChunk.DiinChunk.EMID);
                    emidChunk.WriteIdString(diinSource.EMId, diinSource.EMId.Length);
                    diinChunk.WriteChunk(emidChunk);
                }

                diinChunk.FlushToStream(outStream);
            }
        }
コード例 #2
0
        private void PutCommentIntoChunk(DsdChunksContainer comtChunk, DsdChunk.DsdComment comment)
        {
            DsdChunksContainer.WriteUInt16(comtChunk.GetStream(), (ushort)comment.TimeStamp.Year);
            DsdChunksContainer.WriteUInt8(comtChunk.GetStream(), (byte)comment.TimeStamp.Month);
            DsdChunksContainer.WriteUInt8(comtChunk.GetStream(), (byte)comment.TimeStamp.Day);
            DsdChunksContainer.WriteUInt8(comtChunk.GetStream(), (byte)comment.TimeStamp.Hour);
            DsdChunksContainer.WriteUInt8(comtChunk.GetStream(), (byte)comment.TimeStamp.Minute);

            DsdChunksContainer.WriteUInt16(comtChunk.GetStream(), comment.Type);
            DsdChunksContainer.WriteUInt16(comtChunk.GetStream(), comment.Ref);

            if ((comment.Text.Length % 2) != 0)
            {
                comment.Text += " ";
            }
            DsdChunksContainer.WriteInt32(comtChunk.GetStream(), comment.Text.Length);
            DsdChunksContainer.WriteIdString(comtChunk.GetStream(), comment.Text);
        }