Example #1
0
        static void Main(string[] args)
        {
            string baseDir = @"D:\Test\Bilder\{0}.mp3";
            string baseDir2 = @"D:\Test\{0}.mp3";
            string Target = @"D:\Test\Target\{0}.mp3";

            string filePath = String.Format(baseDir2, "2");

            FileInfo info = new FileInfo(filePath);
            if(!info.Exists)
                throw new FileNotFoundException();

            ContainerFactory fac = new ContainerFactory();
            var cont = fac.Create(info.OpenRead());
            cont.ReadFrameCollection();

            foreach (var item in cont.Frames)
            {
                System.Console.WriteLine(item.FrameID + " => " + item.FrameData);
            }

            string targetDir = String.Format(Target, 3);
            cont.CopyTo(targetDir);

            FileInfo info2 = new FileInfo(targetDir);
            var cont2 = fac.Create(info2.OpenRead());

            cont2.ReadFrameCollection();

            foreach (var item in cont2.Frames)
            {
                System.Console.WriteLine(item.FrameID + " => " + item.FrameData);
            }
            System.Console.ReadKey();
        }
Example #2
0
        private TagData getID3Tags(FileInfo fi)
        {
            ContainerFactory fac = new ContainerFactory();
            var stream = fi.OpenRead();
            MP3Data data;
            try
            {
                data = fac.Create(stream);
                if (data == null) return null;
                var outStream = new MemoryStream();
                var writer = new ID3V23TagWriter(outStream);
                writer.WriteFrame(data.Frames);

                TagData tags = new TagData();
                tags.ContentLength = stream.Length - 128 - outStream.Length;
                outStream.Seek(0, SeekOrigin.Begin);
                tags.Begin = outStream.ToArray();

                return tags;
            }
            catch (Exception e)
            {
                return null;
            }
        }
Example #3
0
        private static void blub()
        {
            var source = createTestObject("SingleDataDummy");
            //var item = source.Groups[0].Items[0];

            ContainerFactory fac = new ContainerFactory();
            //var data = fac.Create(item.Open(), true);
        }
Example #4
0
        private static void createFakeStream(string fileName)
        {
            var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            ContainerFactory fac = new ContainerFactory();
            var data = fac.Create(fs);

            MemoryStream s = new MemoryStream();

            ID3V23TagWriter writer = new ID3V23TagWriter(s);

            writer.WriteFrame(data.Frames);

            s.Seek(0, SeekOrigin.Begin);

            data = fac.Create(s);
            var l = data;
        }
Example #5
0
        static void Main(string[] args)
        {
            string Path = @"F:\FluxWorkBenchFiles\ComponentTests\4.mp3";

            FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read);

            ContainerFactory fac = new ContainerFactory();

            var container = fac.Create(fs);

            container.ReadFrameCollection();

            foreach (var item in container.Frames)
            {
                System.Console.WriteLine("{0} => {1}", item.FrameID, item.FrameData);
            }

            System.Console.WriteLine("fertig ... warte");
            System.Console.ReadKey();
        }