@@ -15,23 +15,18 @@ public class RepairMissingScripts
15
15
16
16
private const string m_idFormat = "{{fileID: {0}, guid: {1}, type:" ;
17
17
18
- private static string m_forumPackageSearchID ;
19
- private static string ForumPackageSearchID {
20
- get {
21
- if ( string . IsNullOrEmpty ( m_forumPackageSearchID ) ) {
22
- m_forumPackageSearchID = string . Format ( m_idFormat , m_fbxPrefabDLLFileId , m_forumPackageGUID ) ;
23
- }
24
- return m_forumPackageSearchID ;
25
- }
26
- }
27
-
28
- private static string m_assetStorePackageSearchID ;
29
- private static string AssetStorePackageSearchID {
30
- get {
31
- if ( string . IsNullOrEmpty ( m_assetStorePackageSearchID ) ) {
32
- m_assetStorePackageSearchID = string . Format ( m_idFormat , m_fbxPrefabDLLFileId , m_assetStorePackageGUID ) ;
18
+ private static List < string > m_searchIDsToReplace ;
19
+ private static string [ ] SearchIDsToReplace
20
+ {
21
+ get
22
+ {
23
+ if ( m_searchIDsToReplace == null || m_searchIDsToReplace . Count <= 0 )
24
+ {
25
+ m_searchIDsToReplace = new List < string > ( ) ;
26
+ m_searchIDsToReplace . Add ( string . Format ( m_idFormat , m_fbxPrefabDLLFileId , m_forumPackageGUID ) ) ;
27
+ m_searchIDsToReplace . Add ( string . Format ( m_idFormat , m_fbxPrefabDLLFileId , m_assetStorePackageGUID ) ) ;
33
28
}
34
- return m_assetStorePackageSearchID ;
29
+ return m_searchIDsToReplace . ToArray ( ) ;
35
30
}
36
31
}
37
32
@@ -103,9 +98,13 @@ private static bool AssetNeedsRepair(string filePath)
103
98
}
104
99
105
100
var contents = sr . ReadToEnd ( ) ;
106
- if ( contents . Contains ( ForumPackageSearchID ) || contents . Contains ( AssetStorePackageSearchID ) ) {
107
- sr . Close ( ) ;
108
- return true ;
101
+ foreach ( var searchId in SearchIDsToReplace )
102
+ {
103
+ if ( contents . Contains ( searchId ) )
104
+ {
105
+ sr . Close ( ) ;
106
+ return true ;
107
+ }
109
108
}
110
109
}
111
110
}
@@ -162,15 +161,13 @@ private static bool ReplaceGUIDInFile (string path, string replacementSearchID)
162
161
while ( sr . Peek ( ) > - 1 ) {
163
162
var line = sr . ReadLine ( ) ;
164
163
165
- if ( line . Contains ( ForumPackageSearchID ) ) {
166
- line = line . Replace ( ForumPackageSearchID , replacementSearchID ) ;
167
- modified = true ;
168
- }
169
-
170
- if ( line . Contains ( AssetStorePackageSearchID ) )
164
+ foreach ( var searchId in SearchIDsToReplace )
171
165
{
172
- line = line . Replace ( AssetStorePackageSearchID , replacementSearchID ) ;
173
- modified = true ;
166
+ if ( line . Contains ( searchId ) )
167
+ {
168
+ line = line . Replace ( searchId , replacementSearchID ) ;
169
+ modified = true ;
170
+ }
174
171
}
175
172
176
173
sw . WriteLine ( line ) ;
0 commit comments