Beispiel #1
0
        public Project(TheGhostCore core)
        {
            _audioExport = null;
            _audioImport = null;
            _fileCopy = null;
            _audioImportInfo = null;
            _audioExportInfo = null;
            _fileCopyInfo = null;

            _songs = null;
            _tiers = null;

            _backgroundAudio = new List<ProjectBackgroundAudio>();

            _fileManager = null;
            _core = core;

            _theGhostInfo = null;

            _defaults = new ProjectDefaults();

            _storeProjectFiles = false;

            _projectSettings = new ProjectSettings(this);
            _projectSettingsGameMods = new ProjectSettingsGameMods(this);
        }
Beispiel #2
0
        /// <summary>
        /// Copy files to a project folder
        /// </summary>
        public void CopyFilesToProject(ProjectSettings settings, DirectoryInfo pDir)
        {
            if (!_project.StoreProjectFiles)
                return;

            DirectoryInfo sDir;

            List<FileInfo> allDsts = new List<FileInfo>();
            List<FileInfo> allSrcs = new List<FileInfo>();

            //copy background audio
            int bai = 1;
            foreach (ProjectBackgroundAudio ba in _project.BackgroundAudio)
            {
                try
                {
                    sDir = new DirectoryInfo(string.Format(@"{0}\(00 {1}) Background Music {2}", pDir.FullName, bai.ToString().PadLeft(3, '0'), bai.ToString()));

                    //gather all the song files and reassign the paths to the new location
                    foreach (AudioFile af in ba.AudioFiles)
                        af.UpdateName(addFile(new FileInfo(af.Name), sDir, allSrcs, allDsts).FullName);
                }
                catch
                {
                }
                bai++;
            }

            //copy songs
            foreach (ProjectTierSong pts in _project.Songs.Values)
            {
                try
                {
                    if (pts.Song != null)
                    {
                        ProjectSong ps = pts.Song;
                        sDir = ProjectSongSettingsFolder(pts, pDir);

                        //gather all the song files and reassign the paths to the new location
                        foreach (AudioFile af in ps.Audio.SongFiles)
                            af.UpdateName(addFile(new FileInfo(af.Name), sDir, allSrcs, allDsts).FullName);

                        if (ps.Audio.GuitarFile != null)
                            ps.Audio.GuitarFile.UpdateName(addFile(new FileInfo(ps.Audio.GuitarFile.Name), sDir, allSrcs, allDsts).FullName);

                        if (ps.Audio.RhythmFile != null)
                            ps.Audio.RhythmFile.UpdateName(addFile(new FileInfo(ps.Audio.RhythmFile.Name), sDir, allSrcs, allDsts).FullName);

                        foreach (NotesFile nf in ps.Notes.Files)
                            nf.Filename = addFile(new FileInfo(nf.Filename), sDir, allSrcs, allDsts).FullName;
                    }
                }
                catch
                {
                }
            }

            copyMoveProjectFiles(pDir, allSrcs, allDsts);

            //remove all files that aren't required
            if (pDir.Exists)
            {
                foreach (DirectoryInfo di in pDir.GetDirectories())
                {
                    foreach (FileInfo fi in di.GetFiles())
                    {
                        if (!allDsts.Exists(delegate(FileInfo fn)
                            {
                                return fn.FullName.ToLower() == fi.FullName.ToLower();
                            }))
                        {
                            FileHelper.Delete(fi.FullName);
                        }
                    }
                }

                //delete all the empty folders
                foreach (DirectoryInfo di in pDir.GetDirectories())
                {
                    if (di.GetFiles().Length == 0 || allDsts.Find(delegate(FileInfo fi)
                        {
                            return di.FullName.ToLower() == fi.DirectoryName.ToLower();
                        }) == null) //folder not in dest lists
                    {
                        try
                        {
                            di.Delete();
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public void LoadProject(string projectFile)
        {
            _projectSettings = new ProjectSettings(projectFile, this);
            PluginManager pm = _core.PluginManager;

            string aiName = pm.GetPluginNameFromTypeName(pm.AudioImportPlugins, _projectSettings.AudioImportPluginName);
            PluginInfo aiP = null;
            if (pm.AudioImportPlugins.ContainsKey(aiName))
                aiP = pm.AudioImportPlugins[aiName];

            string aoName = pm.GetPluginNameFromTypeName(pm.AudioExportPlugins, _projectSettings.AudioExportPluginName);
            PluginInfo aoP = null;
            if (pm.AudioExportPlugins.ContainsKey(aoName))
                aoP = pm.AudioExportPlugins[aoName];

            string exName = pm.GetPluginNameFromTypeName(pm.FileCopyPlugins, _projectSettings.FileCopyPluginName);
            PluginInfo exP = null;
            if (pm.FileCopyPlugins.ContainsKey(exName))
                exP = pm.FileCopyPlugins[exName];

            this.SetPlugins(aiP, aoP, exP);
        }