コード例 #1
0
ファイル: MusicPlaylist.cs プロジェクト: seyed1411/ief
        internal void SaveMusicFilesInfos(string _path, string _fileName)
        {
            Dictionary <string, List <MusicFile> > toJsonItem = new Dictionary <string, List <MusicFile> >();

            toJsonItem.Add("tracks", tracks);
            DiskIO.SaveAsJSONFile(toJsonItem, _path, _fileName);
        }
コード例 #2
0
ファイル: SurveysFolder.cs プロジェクト: seyed1411/ief
        internal void ExportFilesTo(string contentLoc)
        {
            string newWorkArea = contentLoc + "\\" + title;

            DiskIO.CreateDirectory(newWorkArea);
            DiskIO.SaveAsJSONFile(this, newWorkArea, "index.en.json");
        }
コード例 #3
0
        internal FileCopier[] ExportFilesTo(string contentLoc, string[] _languages)
        {
            string            newWorkArea    = contentLoc + "\\" + title;
            List <FileCopier> allFilesToCopy = new List <FileCopier>();

            // create root folder
            DiskIO.CreateDirectory(newWorkArea);
            DiskIO.DeleteAllFiles(newWorkArea);
            foreach (MovieFile p in this.library)
            {
                // create each movie folder
                string movieNewLocation = newWorkArea + "\\" + p.id;
                DiskIO.CreateDirectory(movieNewLocation);
                // add video files to copy
                allFilesToCopy.Add(new FileCopier(p.video.path, movieNewLocation + "\\" + DiskIO.GetFileName(p.video.path)));
                // change the file path to the new path for further library json saving
                p.video.path = DiskIO.GetFileName(p.video.path);
                // add trailer if exist
                if (!string.IsNullOrEmpty(p.trailer.path))
                {
                    allFilesToCopy.Add(new FileCopier(p.trailer.path, movieNewLocation + "\\" + DiskIO.GetFileName(p.trailer.path)));
                    p.trailer.path = DiskIO.GetFileName(p.trailer.path);
                }
                if (!string.IsNullOrEmpty(p.cover))
                {
                    // add video cover to copy
                    allFilesToCopy.Add(new FileCopier(p.cover, movieNewLocation + "\\cover.jpg"));
                    // change the cover path to the new path for further library json saving
                    p.cover = "\\cover.jpg";
                }
            }
            // save changed paths and music files into exported location
            this.SaveMovieLibraryAtLocation(newWorkArea, "index.en.json");

            // copy all requested non-English langs
            foreach (string lang in _languages)
            {
                string abbriv = "index." + lang.Substring(0, 2).ToLower() + ".json";
                if (DiskIO.IsFileExist(ContentLocation, abbriv))
                {
                    VideoFolder temp = DiskIO.DeserializeVideoFolderFromFile(ContentLocation, abbriv);
                    foreach (MovieFile p in temp.library)
                    {
                        p.video.path = "\\" + DiskIO.GetFileName(p.video.path);
                        if (!string.IsNullOrEmpty(p.trailer.path))
                        {
                            p.trailer.path = "\\" + DiskIO.GetFileName(p.trailer.path);
                        }
                        if (!string.IsNullOrEmpty(p.cover))
                        {
                            p.cover = "\\cover.jpg";
                        }
                    }
                    DiskIO.SaveAsJSONFile(temp, newWorkArea, abbriv);
                }
            }
            return(allFilesToCopy.ToArray());
        }
コード例 #4
0
ファイル: AudioFolder.cs プロジェクト: seyed1411/ief
 private void SavePlaylistLibraryAtLocation(string _fullPath, string _fileName)
 {
     // save all playlists json file
     DiskIO.SaveAsJSONFile(this, _fullPath, _fileName);
     // create folder for each playlist and save their music tracks
     foreach (MusicPlaylist pls in this.library)
     {
         string playlistFolder = _fullPath + "\\" + pls.id;
         //DiskIO.CreateDirectory(playlistFolder);
         pls.SaveMusicFilesInfos(playlistFolder, "index.Json");
     }
 }
コード例 #5
0
ファイル: AudioFolder.cs プロジェクト: seyed1411/ief
 internal void SavePlaylistLibrary()
 {
     // save all playlists json file
     DiskIO.SaveAsJSONFile(this, this.ContentLocation, "index.en.json");
     // create folder for each playlist and save their music tracks
     foreach (MusicPlaylist pls in this.library)
     {
         string playlistFolder = this.ContentLocation + "\\" + pls.id;
         DiskIO.CreateDirectory(playlistFolder);
         pls.SaveMusicFilesInfos(playlistFolder, "index.Json");
     }
 }
コード例 #6
0
ファイル: AudioFolder.cs プロジェクト: seyed1411/ief
        internal FileCopier[] ExportFilesTo(string _contentLoc, string[] _languages)
        {
            string            newWorkArea    = _contentLoc + "\\" + title;
            List <FileCopier> allFilesToCopy = new List <FileCopier>();

            // create root folder
            DiskIO.CreateDirectory(newWorkArea);
            DiskIO.DeleteAllFiles(newWorkArea);
            // create each playlist folder
            foreach (MusicPlaylist p in this.library)
            {
                string playlistNewLocation = newWorkArea + "\\" + p.id;
                DiskIO.CreateDirectory(playlistNewLocation);
                // determine music files to copy
                foreach (MusicFile file in p.GetMusicFilesInfo())
                {
                    // add music file
                    allFilesToCopy.Add(new FileCopier(file.file, playlistNewLocation + "\\" + DiskIO.GetFileName(file.file)));
                    // change the file path to the new path for further library json saving
                    file.file = DiskIO.GetFileName(file.file);
                }
                // add playlist cover to copy
                if (p.cover != "")
                {
                    allFilesToCopy.Add(new FileCopier(p.cover, playlistNewLocation + "\\cover.jpg"));
                    // change the cover path to the new path for further library json saving
                    p.cover = "\\cover.jpg";
                }
                p.playlist = "\\index.m3u";
            }
            // save changed paths and music files into exported location
            this.SavePlaylistLibraryAtLocation(newWorkArea, "index.en.json");

            // copy all requested non-English langs
            foreach (string lang in _languages)
            {
                string abbriv = "index." + lang.Substring(0, 2).ToLower() + ".json";
                if (DiskIO.IsFileExist(ContentLocation, abbriv))
                {
                    AudioFolder temp = DiskIO.DeserializeAudioFolderFromFile(ContentLocation, abbriv);
                    foreach (MusicPlaylist x in temp.library)
                    {
                        x.playlist = "\\index.m3u";
                        if (x.cover != "")
                        {
                            x.cover = "\\cover.jpg";
                        }
                    }
                    DiskIO.SaveAsJSONFile(temp, newWorkArea, abbriv);
                }
            }
            return(allFilesToCopy.ToArray());
        }
コード例 #7
0
ファイル: ProjectFolder.cs プロジェクト: seyed1411/ief
        private void CreateNewProjetFiles()
        {
            // create index.json file
            string           path   = location + @"\" + title;
            ProjectMethadata toFile = new ProjectMethadata(this.ContentLocation);

            DiskIO.SaveAsJSONFile(toFile, path, "index.json");
            string mcmFileContent = string.Join(";", new string[2] {
                title, location
            });

            DiskIO.SaveAsTextFile(mcmFileContent, path, title + ".mcm");
        }
コード例 #8
0
        internal void RemoveMovieNonEnglishData(int _id)
        {
            VideoFolder temp = new VideoFolder(this.location, this.title);

            foreach (var item in Enum.GetValues(typeof(Languages)))
            {
                string header   = item.ToString().Substring(0, 2);
                string fileName = "index." + header + ".json";
                if (DiskIO.IsFileExist(ContentLocation, fileName))
                {
                    temp = DiskIO.DeserializeVideoFolderFromFile(ContentLocation, fileName);
                    temp.SetLocationTitle(this.location, this.title);
                    if (temp.HasMovieWithID(_id))
                    {
                        temp.RemoveMovieWithID(_id);
                    }
                    DiskIO.SaveAsJSONFile(temp, this.ContentLocation, fileName);
                }
            }
        }
コード例 #9
0
ファイル: SurveysFolder.cs プロジェクト: seyed1411/ief
 internal void SaveSurveysLibrary()
 {
     DiskIO.SaveAsJSONFile(this, this.ContentLocation, "index.en.json");
 }
コード例 #10
0
 private void SaveMovieLibraryAtLocation(string _fullPath, string _fileName)
 {
     DiskIO.SaveAsJSONFile(this, _fullPath, _fileName);
 }
コード例 #11
0
 internal void SaveMoviesLibrary(string _fileName)
 {
     DiskIO.SaveAsJSONFile(this, this.ContentLocation, _fileName);
 }