1- // Copyright(c) 2019-2022 pypy, Natsumi and individual contributors.
1+ // Copyright(c) 2019-2025 pypy, Natsumi and individual contributors.
22// All rights reserved.
33//
44// This work is licensed under the terms of the MIT license.
@@ -28,7 +28,7 @@ static AssetBundleManager()
2828
2929 public string GetAssetId ( string id , string variant = "" )
3030 {
31- using ( var sha256 = SHA256 . Create ( ) )
31+ using ( var sha256 = SHA256 . Create ( ) )
3232 {
3333 byte [ ] hash = sha256 . ComputeHash ( Encoding . UTF8 . GetBytes ( id + variant ) ) ;
3434 StringBuilder idHex = new StringBuilder ( hash . Length * 2 ) ;
@@ -53,16 +53,17 @@ public string GetAssetVersion(int version, int variantVersion = 0)
5353 {
5454 versionHex += b . ToString ( "X2" ) ;
5555 }
56-
56+
5757 return versionHex . PadLeft ( 32 , '0' ) ;
5858 }
59-
59+
6060 public ( int , int ) ReverseHexToDecimal ( string hexString )
6161 {
6262 if ( hexString . Length != 32 )
6363 return ( 0 , 0 ) ; // it's cooked
64-
65- try {
64+
65+ try
66+ {
6667 var variantVersionHexString = hexString . Substring ( 0 , 8 ) ; // 0..8
6768 var versionHexString = hexString . Substring ( 24 , 8 ) ; // 24..32
6869 var versionBytes = new byte [ 4 ] ;
@@ -110,7 +111,7 @@ public string GetVRChatCacheFullLocation(string id, int version, string variant
110111 var dirs = Directory . GetDirectories ( topDir , versionSearchPattern ) ;
111112 if ( dirs . Length > 0 )
112113 return dirs . OrderByDescending ( dir => ReverseHexToDecimal ( Path . GetFileName ( dir ) ) . Item2 ) . First ( ) ;
113-
114+
114115 return Path . Join ( topDir , versionLocation ) ;
115116 }
116117
@@ -129,7 +130,7 @@ public Tuple<long, bool, string> CheckVRChatCache(string id, int version, string
129130 var fullLocation = GetVRChatCacheFullLocation ( id , version ) ;
130131 if ( ! Directory . Exists ( fullLocation ) )
131132 fullLocation = GetVRChatCacheFullLocation ( id , version , variant , variantVersion ) ;
132-
133+
133134 var fileLocation = Path . Join ( fullLocation , "__data" ) ;
134135 var cachePath = string . Empty ;
135136 if ( File . Exists ( fileLocation ) )
@@ -157,7 +158,7 @@ public void DeleteCache(string id, int version, string variant, int variantVersi
157158 var path = GetVRChatCacheFullLocation ( id , version ) ;
158159 if ( Directory . Exists ( path ) )
159160 Directory . Delete ( path , true ) ;
160-
161+
161162 path = GetVRChatCacheFullLocation ( id , version , variant , variantVersion ) ;
162163 if ( Directory . Exists ( path ) )
163164 Directory . Delete ( path , true ) ;
@@ -206,7 +207,7 @@ public List<string> SweepCache()
206207
207208 if ( File . Exists ( Path . Join ( versionDirectory . FullName , "__lock" ) ) )
208209 continue ; // skip locked version
209-
210+
210211 versionDirectory . Delete ( true ) ;
211212 output . Add ( $ "{ cacheDirectory . Name } \\ { versionDirectory . Name } ") ;
212213 }
0 commit comments