Skip to content

Commit d45789f

Browse files
committed
fix formatting, remove tabs
1 parent 0da587f commit d45789f

File tree

1 file changed

+81
-81
lines changed

1 file changed

+81
-81
lines changed

Assets/FbxExporters/Editor/FbxExporterRepairMissingScripts.cs

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -6,112 +6,112 @@
66

77
namespace FbxExporters.Editor
88
{
9-
public class RepairMissingScripts
10-
{
11-
private const string m_forumPackageGUID = "2d81c55c4d9d85146b1d2de96e084b63";
12-
private const string m_currentPackageGUID = "628ffbda3fdf4df4588770785d91a698";
9+
public class RepairMissingScripts
10+
{
11+
private const string m_forumPackageGUID = "2d81c55c4d9d85146b1d2de96e084b63";
12+
private const string m_currentPackageGUID = "628ffbda3fdf4df4588770785d91a698";
1313

14-
private const string m_fbxPrefabDLLFileId = "69888640";
14+
private const string m_fbxPrefabDLLFileId = "69888640";
1515

16-
private const string m_idFormat = "{{fileID: {0}, guid: {1}, type:";
16+
private const string m_idFormat = "{{fileID: {0}, guid: {1}, type:";
1717

1818

19-
private static string m_forumPackageSearchID;
19+
private static string m_forumPackageSearchID;
2020

21-
private static string ForumPackageSearchID {
22-
get {
23-
if (string.IsNullOrEmpty (m_forumPackageSearchID)) {
24-
m_forumPackageSearchID = string.Format (m_idFormat, m_fbxPrefabDLLFileId, m_forumPackageGUID);
25-
}
26-
return m_forumPackageSearchID;
27-
}
28-
}
21+
private static string ForumPackageSearchID {
22+
get {
23+
if (string.IsNullOrEmpty (m_forumPackageSearchID)) {
24+
m_forumPackageSearchID = string.Format (m_idFormat, m_fbxPrefabDLLFileId, m_forumPackageGUID);
25+
}
26+
return m_forumPackageSearchID;
27+
}
28+
}
2929

30-
private static string m_currentPackageSearchID;
30+
private static string m_currentPackageSearchID;
3131

32-
private static string CurrentPackageSearchID {
33-
get {
34-
if (string.IsNullOrEmpty (m_currentPackageSearchID)) {
35-
m_currentPackageSearchID = string.Format (m_idFormat, m_fbxPrefabDLLFileId, m_currentPackageGUID);
36-
}
37-
return m_currentPackageSearchID;
38-
}
39-
}
32+
private static string CurrentPackageSearchID {
33+
get {
34+
if (string.IsNullOrEmpty (m_currentPackageSearchID)) {
35+
m_currentPackageSearchID = string.Format (m_idFormat, m_fbxPrefabDLLFileId, m_currentPackageGUID);
36+
}
37+
return m_currentPackageSearchID;
38+
}
39+
}
4040

41-
public static bool ReplaceGUIDInTextAssets ()
42-
{
43-
// search project for assets containing old GUID
41+
public static bool ReplaceGUIDInTextAssets ()
42+
{
43+
// search project for assets containing old GUID
4444

4545
// ignore if forced binary
4646
if (UnityEditor.EditorSettings.serializationMode == SerializationMode.ForceBinary) {
4747
return false;
4848
}
4949

50-
// check all scenes and prefabs
51-
string[] searchFilePatterns = new string[]{ "*.prefab", "*.unity" };
52-
53-
bool replacedGUID = false;
54-
foreach (string searchPattern in searchFilePatterns) {
55-
foreach (string file in Directory.GetFiles(Application.dataPath, searchPattern, SearchOption.AllDirectories)) {
56-
replacedGUID |= ReplaceGUIDInFile (file);
57-
}
58-
}
59-
if (replacedGUID) {
60-
AssetDatabase.Refresh ();
61-
}
62-
return replacedGUID;
63-
}
64-
65-
private static bool ReplaceGUIDInFile (string path)
66-
{
67-
// try to read file, assume it's a text file for now
68-
bool modified = false;
69-
70-
try {
71-
var sr = new StreamReader (path);
50+
// check all scenes and prefabs
51+
string[] searchFilePatterns = new string[]{ "*.prefab", "*.unity" };
52+
53+
bool replacedGUID = false;
54+
foreach (string searchPattern in searchFilePatterns) {
55+
foreach (string file in Directory.GetFiles(Application.dataPath, searchPattern, SearchOption.AllDirectories)) {
56+
replacedGUID |= ReplaceGUIDInFile (file);
57+
}
58+
}
59+
if (replacedGUID) {
60+
AssetDatabase.Refresh ();
61+
}
62+
return replacedGUID;
63+
}
64+
65+
private static bool ReplaceGUIDInFile (string path)
66+
{
67+
// try to read file, assume it's a text file for now
68+
bool modified = false;
69+
70+
try {
71+
var sr = new StreamReader (path);
7272

7373
// verify that this is a text file
7474
var firstLine = "";
75-
if(sr.Peek() > -1){
76-
firstLine = sr.ReadLine();
77-
if(!firstLine.StartsWith("%YAML")){
75+
if (sr.Peek () > -1) {
76+
firstLine = sr.ReadLine ();
77+
if (!firstLine.StartsWith ("%YAML")) {
7878
sr.Close ();
7979
return false;
8080
}
8181
}
8282

83-
var sw = new StreamWriter (path + ".remap", false);
83+
var sw = new StreamWriter (path + ".remap", false);
8484

85-
if(!string.IsNullOrEmpty(firstLine)){
86-
sw.WriteLine(firstLine);
85+
if (!string.IsNullOrEmpty (firstLine)) {
86+
sw.WriteLine (firstLine);
8787
}
8888

89-
while (sr.Peek () > -1) {
90-
var line = sr.ReadLine ();
89+
while (sr.Peek () > -1) {
90+
var line = sr.ReadLine ();
9191

92-
if (line.Contains (ForumPackageSearchID)) {
93-
line = line.Replace (ForumPackageSearchID, CurrentPackageSearchID);
92+
if (line.Contains (ForumPackageSearchID)) {
93+
line = line.Replace (ForumPackageSearchID, CurrentPackageSearchID);
9494
modified |= true;
95-
}
96-
97-
sw.WriteLine (line);
98-
}
99-
100-
sr.Close ();
101-
sw.Close ();
102-
103-
if (modified) {
104-
File.Delete (path);
105-
File.Move (path + ".remap", path);
106-
return true;
107-
} else {
108-
File.Delete (path + ".remap");
109-
}
110-
} catch (IOException e) {
111-
Debug.LogError (string.Format ("Failed to replace GUID in file {0} (error={1})", path, e));
112-
}
113-
114-
return false;
115-
}
116-
}
95+
}
96+
97+
sw.WriteLine (line);
98+
}
99+
100+
sr.Close ();
101+
sw.Close ();
102+
103+
if (modified) {
104+
File.Delete (path);
105+
File.Move (path + ".remap", path);
106+
return true;
107+
} else {
108+
File.Delete (path + ".remap");
109+
}
110+
} catch (IOException e) {
111+
Debug.LogError (string.Format ("Failed to replace GUID in file {0} (error={1})", path, e));
112+
}
113+
114+
return false;
115+
}
116+
}
117117
}

0 commit comments

Comments
 (0)