public static int Export( List<string> args )
        {
            if ( args.Count < 2 ) {
                Console.WriteLine( "Usage: db src" );
                return -1;
            }

            string InDatabase = args[0];
            string OutFile = args[1];

            scr s = new scr();
            List<GraceNoteDatabaseEntry> Entries = ReadDatabase( "Data Source=" + InDatabase );

            // init loop stuff
            s.Sections = new List<scrSection>();
            scrSection sec = new scrSection();
            sec.Elements = new List<scrElement>();
            sec.Location = (uint)Entries[0].PointerRef;
            sec.PointerIndex = Entries[0].IdentifyPointerRef;
            int SectionPointerIndex = sec.PointerIndex;

            for ( int i = 0; i < Entries.Count; ++i ) {
                GraceNoteDatabaseEntry e = Entries[i];

                if ( e.IdentifyPointerRef != SectionPointerIndex ) {
                    // reached new section, write old to scr
                    s.Sections.Add( sec );
                    sec = new scrSection();
                    sec.Elements = new List<scrElement>();
                    sec.Location = (uint)e.PointerRef;
                    sec.PointerIndex = e.IdentifyPointerRef;
                    SectionPointerIndex = sec.PointerIndex;
                }

                scrElement screlem = new scrElement();

                switch ( e.IdentifyString ) {
                    case "Code":
                        screlem.Type = scrElement.scrElementType.Code;
                        screlem.Code = CodeStringToArray( e.TextEN );
                        break;
                    case "Text":
                        screlem.Type = scrElement.scrElementType.Text;
                        screlem.Text = e.TextEN;
                        break;
                    default: throw new Exception( "scrExport: Unknown IdentifyString type!" );
                }

                sec.Elements.Add( screlem );
            }
            s.Sections.Add( sec );

            s.CreateFile( OutFile );

            return 0;
        }
        public static int Export(List <string> args)
        {
            if (args.Count < 2)
            {
                Console.WriteLine("Usage: db src");
                return(-1);
            }

            string InDatabase = args[0];
            string OutFile    = args[1];

            scr s = new scr();
            List <GraceNoteDatabaseEntry> Entries = ReadDatabase("Data Source=" + InDatabase);

            // init loop stuff
            s.Sections = new List <scrSection>();
            scrSection sec = new scrSection();

            sec.Elements     = new List <scrElement>();
            sec.Location     = (uint)Entries[0].PointerRef;
            sec.PointerIndex = Entries[0].IdentifyPointerRef;
            int SectionPointerIndex = sec.PointerIndex;

            for (int i = 0; i < Entries.Count; ++i)
            {
                GraceNoteDatabaseEntry e = Entries[i];

                if (e.IdentifyPointerRef != SectionPointerIndex)
                {
                    // reached new section, write old to scr
                    s.Sections.Add(sec);
                    sec                 = new scrSection();
                    sec.Elements        = new List <scrElement>();
                    sec.Location        = (uint)e.PointerRef;
                    sec.PointerIndex    = e.IdentifyPointerRef;
                    SectionPointerIndex = sec.PointerIndex;
                }

                scrElement screlem = new scrElement();

                switch (e.IdentifyString)
                {
                case "Code":
                    screlem.Type = scrElement.scrElementType.Code;
                    screlem.Code = CodeStringToArray(e.TextEN);
                    break;

                case "Text":
                    screlem.Type = scrElement.scrElementType.Text;
                    screlem.Text = e.TextEN;
                    break;

                default: throw new Exception("scrExport: Unknown IdentifyString type!");
                }

                sec.Elements.Add(screlem);
            }
            s.Sections.Add(sec);

            s.CreateFile(OutFile);

            return(0);
        }