예제 #1
0
 private void LoadTxtFiles(List <string> txtFiles)
 {
     txtFiles.ForEach(delegate(string path)
     {
         try
         {
             SongMeta newSongMeta = SongMetaBuilder.ParseFile(path);
             if (CheckSupportedMediaFormats(newSongMeta))
             {
                 Add(newSongMeta);
                 SongsSuccess++;
             }
             else
             {
                 SongsFailed++;
             }
         }
         catch (SongMetaBuilderException e)
         {
             Debug.LogWarning(path + "\n" + e.Message);
             SongsFailed++;
         }
         catch (Exception ex)
         {
             Debug.LogException(ex);
             Debug.LogError(path);
             SongsFailed++;
         }
     });
 }
예제 #2
0
    private void TestFile(string fileName)
    {
        string   filePath = folderPath + fileName;
        SongMeta songMeta = SongMetaBuilder.ParseFile(filePath);

        Assert.AreEqual(testSongTitle, songMeta.Title);
    }
예제 #3
0
 private static void ScanFilesAsThread()
 {
     lock (s_scanLock)
     {
         s_songsFound = 0;
         s_songsSuccess = 0;
         s_songsFailed = 0;
         FolderScanner scannerTxt = new FolderScanner("*.txt");
         List<string> txtFiles = scannerTxt.GetFiles((string)SettingsManager.GetSetting(ESetting.SongDir));
         s_songsFound = txtFiles.Count;
         txtFiles.ForEach(delegate (string path)
         {
             try
             {
                 Add(SongMetaBuilder.ParseFile(path));
                 Interlocked.Increment(ref s_songsSuccess);
             }
             catch (SongMetaBuilderException e)
             {
                 Debug.Log("nope::"+path+"\n"+e.Message);
                 Interlocked.Increment(ref s_songsFailed);
             }
             catch (Exception ex)
             {
                 Debug.LogException(ex);
                 Debug.Log("nope::" + path);
                 Interlocked.Increment(ref s_songsFailed);
             }
         });
     }
 }
예제 #4
0
파일: SongMeta.cs 프로젝트: xxxDSSxxx/Play
    public void Reload()
    {
        SongMeta other = SongMetaBuilder.ParseFile(SongMetaUtils.GetAbsoluteSongMetaPath(this));

        // Copy values
        Encoding = other.Encoding;
        SongHash = other.SongHash;

        voiceNames = other.voiceNames;
        voices     = new List <Voice>();

        Artist = other.Artist;
        Title  = other.Title;
        Bpm    = other.Bpm;
        Mp3    = other.Mp3;

        Background   = other.Background;
        Cover        = other.Cover;
        Edition      = other.Edition;
        End          = other.End;
        Gap          = other.Gap;
        Genre        = other.Genre;
        Language     = other.Language;
        Relative     = other.Relative;
        Start        = other.Start;
        PreviewStart = other.PreviewStart;
        PreviewEnd   = other.PreviewEnd;
        Video        = other.Video;
        VideoGap     = other.VideoGap;
        Year         = other.Year;
    }
예제 #5
0
    private void ScanFilesSynchronously()
    {
        lock (scanLock)
        {
            SongsFound   = 0;
            SongsSuccess = 0;
            SongsFailed  = 0;
            FolderScanner scannerTxt = new FolderScanner("*.txt");

            // Find all txt files in the song directories
            List <string> txtFiles = new List <string>();
            List <string> songDirs = SettingsManager.Instance.Settings.GameSettings.songDirs;
            foreach (string songDir in songDirs)
            {
                List <string> txtFilesInSongDir = scannerTxt.GetFiles(songDir);
                txtFiles.AddRange(txtFilesInSongDir);
            }
            SongsFound = txtFiles.Count;
            Debug.Log($"Found {SongsFound} songs in {songDirs.Count} configured song directories");

            txtFiles.ForEach(delegate(string path)
            {
                try
                {
                    Add(SongMetaBuilder.ParseFile(path));
                    SongsSuccess++;
                }
                catch (SongMetaBuilderException e)
                {
                    Debug.LogWarning(path + "\n" + e.Message);
                    SongsFailed++;
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    Debug.LogError(path);
                    SongsFailed++;
                }
            });
        }
    }
예제 #6
0
 private void LoadTxtFiles(List <string> txtFiles)
 {
     txtFiles.ForEach(delegate(string path)
     {
         try
         {
             Add(SongMetaBuilder.ParseFile(path));
             SongsSuccess++;
         }
         catch (SongMetaBuilderException e)
         {
             Debug.LogWarning(path + "\n" + e.Message);
             SongsFailed++;
         }
         catch (Exception ex)
         {
             Debug.LogException(ex);
             Debug.LogError(path);
             SongsFailed++;
         }
     });
 }