public void Save(string FileName) { DateTime start = DateTime.Now; FileStream file = File.OpenRead(this.strFileName); FileStream nFS = File.Create("TEST OUTPUT.mp3"); file.Position = firstFrame.Position; int b; long lastPos = lastFrame.Position + lastFrame.FrameSize; long curPos = file.Position; /*while ((b = file.ReadByte()) > -1) * { * curPos++; * nFS.WriteByte((byte)b); * if (curPos >= lastPos) * { * break; * } * } * nFS.Flush();*/ /*byte[] testread = new byte[(lastFrame.Position + lastFrame.FrameSize) - firstFrame.Position]; * file.Read(testread, 0, testread.Length); * nFS.Write(testread, 0, testread.Length); * nFS.Flush();*/ /** * If filesize > MAX_ALLOWED_LENGTH then * Copy byte by byte * else * Copy entire MP3 into memory and write out **/ if (id3v1.Exists) { nFS.Write(id3v1.ToByte(), 0, id3v1.ToByte().Length); } nFS.Flush(); Console.WriteLine("[BEGIN WRITE]"); Console.WriteLine("Writing ID3v2 Tag (if enabled)."); Console.WriteLine("Writing MPEG Audio"); Console.WriteLine("Writing APE Tag (if enabled)."); Console.WriteLine("Writing Lyrics3 Tag (if enbaled & ID3v1 enabled)."); Console.WriteLine("Writing ID3v1 Tag (if enabled)."); Console.WriteLine("[END WRITE]"); nFS.Close(); TimeSpan tTime = DateTime.Now - start; Console.WriteLine("SAVING TOOK: " + tTime.TotalMilliseconds); }