Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FancyErrorPrinter.cs
Go to the documentation of this file.
1using System;
3using System.IO;
4using System.Text;
5using System.Windows.Forms;
7using ReLogic.OS;
8
9namespace Terraria.UI;
10
12{
14 {
15 bool flag = false;
17 {
18 flag = true;
19 }
21 {
22 flag = true;
23 }
25 {
26 flag = true;
27 }
29 {
30 flag = true;
31 }
32 if (flag)
33 {
35 stringBuilder.AppendLine("Failed to load asset: \"" + filePath.Replace("/", "\\") + "\"!");
36 List<string> suggestions = new List<string> { "Try to verify/repair the game installation, the asset may be missing.", "If you are using an Anti-virus, please make sure it does not block Terraria in any way." };
37 stringBuilder.AppendLine();
38 stringBuilder.AppendLine("Suggestions:");
40 stringBuilder.AppendLine();
42 ShowTheBox(stringBuilder.ToString());
44 }
45 }
46
48 {
49 bool flag = false;
51 {
52 flag = true;
53 }
55 {
56 flag = true;
57 }
59 {
60 flag = true;
61 }
62 if (flag)
63 {
65 stringBuilder.AppendLine("Failed to create the file: \"" + filePath.Replace("/", "\\") + "\"!");
66 List<string> list = new List<string> { "If you are using an Anti-virus, please make sure it does not block Terraria in any way.", "Try making sure your `Documents/My Games/Terraria` folder is not set to 'read-only'.", "Try to verify/repair the game installation." };
67 if (filePath.ToLower().Contains("onedrive"))
68 {
69 list.Add("Try updating OneDrive.");
70 }
71 stringBuilder.AppendLine();
72 stringBuilder.AppendLine("Suggestions:");
74 stringBuilder.AppendLine();
76 ShowTheBox(stringBuilder.ToString());
78 }
79 }
80
82 {
83 bool flag = false;
85 {
86 flag = true;
87 }
89 {
90 flag = true;
91 }
93 {
94 flag = true;
95 }
96 if (flag)
97 {
99 stringBuilder.AppendLine("Failed to create the folder: \"" + folderPath.Replace("/", "\\") + "\"!");
100 List<string> list = new List<string> { "If you are using an Anti-virus, please make sure it does not block Terraria in any way.", "Try making sure your `Documents/My Games/Terraria` folder is not set to 'read-only'.", "Try to verify/repair the game installation." };
101 if (folderPath.ToLower().Contains("onedrive"))
102 {
103 list.Add("Try updating OneDrive.");
104 }
105 stringBuilder.AppendLine();
106 stringBuilder.AppendLine("Suggestions:");
108 stringBuilder.AppendLine();
110 ShowTheBox(stringBuilder.ToString());
112 }
113 }
114
116 {
117 text.AppendLine("The original Error below");
118 text.Append(exception);
119 }
120
122 {
123 for (int i = 0; i < suggestions.Count; i++)
124 {
125 string text2 = suggestions[i];
126 text.AppendLine(i + 1 + ". " + text2);
127 }
128 }
129
130 private static void ShowTheBox(string preparedMessage)
131 {
133 {
135 }
136 }
137}
static bool IsWindows
Definition Platform.cs:19
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static void WriteLine()
Definition Console.cs:733
static bool dedServ
Definition Main.cs:1226
static void AppendSuggestions(StringBuilder text, List< string > suggestions)
static void IncludeOriginalMessage(StringBuilder text, Exception exception)
static void ShowTheBox(string preparedMessage)
static void ShowFileSavingFailError(Exception exception, string filePath)
static void ShowDirectoryCreationFailError(Exception exception, string folderPath)
static void ShowFailedToLoadAssetError(Exception exception, string filePath)