示例#1
0
 public SongHashData AddSongToHash(string songDirectory, bool hashImmediately = true)
 {
     if (Directory.Exists(songDirectory))
     {
         var newSongHashData = new SongHashData()
         {
             Directory = songDirectory
         };
         if (hashImmediately)
         {
             newSongHashData.GenerateHash();
         }
         this.Data.Add(songDirectory, newSongHashData);
         return(newSongHashData);
     }
     return(null);
 }
        public void GenerateDirectoryHash_Test()
        {
            string testDir  = @"I:\Steam\SteamApps\common\Beat Saber\Beat Saber_Data\CustomLevels\1001-675 Party Rock Anthem";
            var    testSong = new SongHashData()
            {
                Directory = testDir
            };

            testSong.GenerateDirectoryHash();
            testSong.GenerateHash();
            Console.WriteLine($"testSong hash: {testSong.DirectoryHash}");
            var testSong2 = new SongHashData()
            {
                Directory = testDir
            };

            testSong2.GenerateDirectoryHash();
            testSong2.GenerateHash();
            Console.WriteLine($"testSong2 hash: {testSong2.DirectoryHash}");
            Assert.AreEqual(testSong.DirectoryHash, testSong2.DirectoryHash);
        }