Beispiel #1
0
        public static void LoadProject(string file)
        {
            ProjectFormats format  = DetectProjectFormat(file);
            UProject       project = null;

            if (format == ProjectFormats.Ustx)
            {
                project = USTx.Load(file);
            }
            else if (format == ProjectFormats.Vsq3 || format == ProjectFormats.Vsq4)
            {
                project = VSQx.Load(file);
            }
            else if (format == ProjectFormats.Ust)
            {
                project = Ust.Load(file);
            }
            else
            {
                System.Windows.MessageBox.Show("Unknown file format");
            }
            if (project != null)
            {
                DocManager.Inst.ExecuteCmd(new LoadProjectNotification(project));
            }
        }
Beispiel #2
0
        public static void LoadProject(string[] files)
        {
            if (files.Length < 1)
            {
                return;
            }
            ProjectFormats format = DetectProjectFormat(files[0]);
            UProject       project;

            switch (format)
            {
            case ProjectFormats.Ustx:
                project = Ustx.Load(files[0]);
                break;

            case ProjectFormats.Vsq3:
            case ProjectFormats.Vsq4:
                project = VSQx.Load(files[0]);
                break;

            case ProjectFormats.Ust:
                project = Ust.Load(files);
                break;

            default:
                throw new FileFormatException("Unknown file format");
            }
            if (project != null)
            {
                DocManager.Inst.ExecuteCmd(new LoadProjectNotification(project));
            }
        }
Beispiel #3
0
        public static void ImportTracks(UProject project, string[] files)
        {
            if (files.Length < 1)
            {
                return;
            }
            foreach (string file in files)
            {
                ProjectFormats format = DetectProjectFormat(file);
                UProject       loaded;
                switch (format)
                {
                case ProjectFormats.Ustx:
                    loaded = Ustx.Load(file);
                    break;

                case ProjectFormats.Vsq3:
                case ProjectFormats.Vsq4:
                    loaded = VSQx.Load(file);
                    break;

                case ProjectFormats.Ust:
                    loaded = Ust.Load(new[] { file });
                    break;

                default:
                    throw new FileFormatException("Unknown file format");
                }
                int trackCount = project.tracks.Count;
                foreach (var(abbr, descriptor) in loaded.expressions)
                {
                    if (!project.expressions.ContainsKey(abbr))
                    {
                        project.expressions.Add(abbr, descriptor);
                    }
                }
                foreach (var track in loaded.tracks)
                {
                    track.TrackNo = project.tracks.Count;
                    project.tracks.Add(track);
                }
                foreach (var part in loaded.parts)
                {
                    project.parts.Add(part);
                    part.trackNo += trackCount;
                }
                project.beatPerBar = loaded.beatPerBar;
                project.beatUnit   = loaded.beatUnit;
                project.bpm        = loaded.bpm;
            }
            project.AfterLoad();
            project.Validate();
            DocManager.Inst.ExecuteCmd(new LoadProjectNotification(project));
        }