예제 #1
0
        public OggTag Read(Stream oggStream)
        {
            OggTag tag = new OggTag();

            byte[] b = new byte[4];
            oggStream.Read(b, 0, b.Length);
            int vendorstringLength = Utils.GetNumber(b, 0, 3);

            b = new byte[vendorstringLength];
            oggStream.Read(b, 0, b.Length);
            tag.Add("vendor", new string(Encoding.UTF8.GetChars(b)));

            b = new byte[4];
            oggStream.Read(b, 0, b.Length);
            int userComments = Utils.GetNumber(b, 0, 3);

            for (int i = 0; i < userComments; i++)
            {
                b = new byte[4];
                oggStream.Read(b, 0, b.Length);
                int commentLength = Utils.GetNumber(b, 0, 3);

                b = new byte[commentLength];
                oggStream.Read(b, 0, b.Length);
                tag.AddOggField(b);
            }

            return(tag);
        }
예제 #2
0
		public OggTag Read( Stream oggStream )
		{
			OggTag tag = new OggTag();
			
			byte[] b = new byte[4];
			oggStream.Read( b , 0,  b .Length);
			int vendorstringLength = Utils.GetNumber( b, 0, 3);
			b = new byte[vendorstringLength];
			oggStream.Read( b , 0,  b .Length);
			tag.Add("vendor", new string(Encoding.UTF8.GetChars(b)));
			
			b = new byte[4];
			oggStream.Read( b , 0,  b .Length);
			int userComments = Utils.GetNumber( b, 0, 3);

			for ( int i = 0; i < userComments; i++ ) {
				b = new byte[4];
				oggStream.Read( b , 0,  b .Length);
				int commentLength = Utils.GetNumber( b, 0, 3);

				b = new byte[commentLength];
				oggStream.Read( b , 0,  b .Length);
				tag.AddOggField(b);
			}
			
			return tag;
		}
예제 #3
0
        public void Delete(Stream raf, Stream tempRaf)
        {
            OggTag tag = null;

            try {
                tag = reader.Read(raf);
            } catch (CannotReadException e) {
                Write(new OggTag(), raf, tempRaf);
                return;
            }

            OggTag emptyTag = new OggTag();

            if (tag.HasField("vendor"))
            {
                emptyTag.Add("vendor", tag.Get("vendor")[0] as string);
            }

            raf.Seek(0, SeekOrigin.Begin);
            tempRaf.Seek(0, SeekOrigin.Begin);

            Write(emptyTag, raf, tempRaf);
        }