1using System.Text.Json.Nodes;
13 public static string fName =
"ViewGameLogDialog";
34 m_listPanel.ItemClicked += delegate(
object item) {
44 if (button == MessageDialogButton.Button2) {
45 ClipboardManager.ClipboardString = item.ToString();
88 _ => { DialogsManager.HideAllDialogs(); }
96 JsonObject jsonObject =
new();
97 Dictionary<string, string> dictionary =
new();
98 jsonObject.Add(
"path", $
"/GameLog/{DateTime.Now.Ticks}.log");
99 dictionary.Add(
"Authorization", $
"Bearer {SettingsManager.ScpboxAccessToken}");
100 dictionary.Add(
"Content-Type",
"application/octet-stream");
101 dictionary.Add(
"Dropbox-API-Arg", jsonObject.ToJsonString());
102 MemoryStream memoryStream =
new();
105 memoryStream.Seek(0, SeekOrigin.Begin);
107 $
"{CommunityServerManager.CurrentChineseInfo.ApiUrl}/com/files/upload",
114 dialog.m_cancelButtonWidget.Text =
"OK";
119 delegate(Exception error) {
121 dialog.SmallMessage = error.Message;
129 m_listPanel.ItemWidgetFactory = delegate(
object item) {
130 string text = item !=
null ? item.ToString() :
string.Empty;
132 if (text.Contains(
"ERROR:")) {
135 else if (text.Contains(
"WARNING:")) {
138 else if (text.Contains(
"INFO:")) {
144 loader.ModifyLogColor(text, ref color);
160 if (recentLogLines.Count > 1000) {
161 recentLogLines.RemoveRange(0, recentLogLines.Count - 1000);
163 foreach (
string item
in recentLogLines) {
165 if (!item.Contains(
"WARNING:")
166 && !item.Contains(
"ERROR:")) {
171 && !item.Contains(
"ERROR:")) {
176 m_listPanel.ScrollPosition = m_listPanel.Items.Count *
m_listPanel.ItemSize;
static string ClipboardString
static object Get(Type type, string name)
static void HideDialog(Dialog dialog)
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
static List< string > GetRecentLogLines(int bytesCount)
static string GetRecentLog(int bytesCount)
static StreamWriter m_writer
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
static string ScpboxAccessToken
ButtonWidget m_copyButton
ButtonWidget m_uploadButton
ListPanelWidget m_listPanel
void SetErrorHead(int headLangIndex, int adviceLangIndex)
ButtonWidget m_closeButton
ButtonWidget m_filterButton
ButtonWidget m_clearButton
static void Post(string address, Dictionary< string, string > parameters, Dictionary< string, string > headers, Stream data, CancellableProgress progress, Action< byte[]> success, Action< Exception > failure)
static void HookAction(string HookName, Func< ModLoader, bool > action)
执行Hook