private unsafe void Encode() { if (this.changed) { this.data = new tagID3v1_1(); fixed(tagID3v1_1 *pTag = &this.data) { pTag->pstrId[0] = 0x54; pTag->pstrId[1] = 0x41; pTag->pstrId[2] = 0x47; fixed(char *pwstr = this.song) this.enc.GetBytes(pwstr, this.song.Length, pTag->pstrSong, tagID3v1_1.SONG_SIZE); fixed(char *pwstr = this.artist) this.enc.GetBytes(pwstr, this.artist.Length, pTag->pstrArtist, tagID3v1_1.ARTIST_SIZE); fixed(char *pwstr = this.album) this.enc.GetBytes(pwstr, this.album.Length, pTag->pstrAlbum, tagID3v1_1.ALBUM_SIZE); fixed(char *pwstr = this.year) this.enc.GetBytes(pwstr, this.year.Length, pTag->pstrYear, tagID3v1_1.YEAR_SIZE); fixed(char *pwstr = this.comment) this.enc.GetBytes(pwstr, this.comment.Length, pTag->pstrComment, tagID3v1_1.COMMENT_SIZE); } this.data.nSongNumber = this.songNum; this.data.nGenre = this.genre; } }
public Tag(System.Text.Encoding enc) { this.changed = false; this.changed = true; this.data = new tagID3v1_1(); this.enc = enc; this.song = "<無題>"; this.artist = ""; this.album = ""; this.year = "2000"; this.comment = ""; this.songNum = 0; this.genre = 0xff; }
internal unsafe Tag(StreamAccessor accessor, System.Text.Encoding enc) { this.changed = false; byte[] buffer = new byte[tagID3v1_1.SIZE]; if (tagID3v1_1.SIZE != accessor.Stream.Read(buffer, 0, tagID3v1_1.SIZE)) { throw new FileFormatException("Stream の長さが ID3v1 のタグを格納できる大きさになっていません。"); } fixed(byte *pData = buffer) { this.data = *(tagID3v1_1 *)pData; } this.Decode(enc); }