Skip to content

Commit 4d984e2

Browse files
committed
v3.6.3.8
1 parent 8a2cf2c commit 4d984e2

File tree

3 files changed

+314
-432
lines changed

3 files changed

+314
-432
lines changed

MSL/controls/dialogs/InstallForgeDialog.xaml.cs

Lines changed: 13 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ private async void UserControl_Loaded(object sender, RoutedEventArgs e)
5151
File.Create(InstallPath + "/msl-installForge.log").Close();
5252
logWriter = File.AppendText(InstallPath + "/msl-installForge.log");
5353
Log_in("准备安装Forge···");
54-
Log_in("3秒后开始安装···");
55-
await Task.Delay(3000);
54+
Log_in("5秒后开始安装···");
55+
await Task.Delay(5000);
5656
Mirror.IsEnabled = false;
5757
MultiThreadCount.IsEnabled = false;
5858
await Task.Run(Install);
@@ -285,23 +285,10 @@ await Dispatcher.Invoke(async () => //下载
285285
});
286286

287287
}
288-
else {
289-
downloadTasks.Add(DownloadFile(_dlurl, _savepath, _sha1));
290-
}
291-
292-
//bool dlStatus = await DownloadFile(_dlurl, _savepath, _sha1);
293-
//Status_change("正在下载Forge运行Lib···(" + libCount + "/" + libALLCount + ")");
294-
/*
295-
}
296-
else
297-
{
298-
await Dispatcher.Invoke(async () =>
288+
else
299289
{
300-
//Status_change("正在下载Forge运行Lib···(" + libCount + "/" + libALLCount + ")");
301-
await MagicShow.ShowDownloader(Window.GetWindow(this), _dlurl, Path.GetDirectoryName(_savepath), Path.GetFileName(_savepath), "下载LIB···");
302-
});
303-
}
304-
*/
290+
downloadTasks.Add(DownloadFile(_dlurl, _savepath, _sha1));
291+
}
305292
}
306293
}
307294
else
@@ -325,8 +312,6 @@ await Dispatcher.Invoke(async () =>
325312

326313
string _savepath = LibPath + "/" + NameToPath(SafeGetValue(lib, "name"));
327314
Log_in("[LIB]下载:" + NameToPath(SafeGetValue(lib, "name")));
328-
//if (!_dlurl.Contains("mcp")) //mcp那个zip会用js redirect,所以只能用downloader,真神奇!
329-
//{
330315
if (_dlurl.Contains("mcp_config")) //mcp那个zip会用js redirect,所以只能用downloader,真神奇!
331316
{
332317
await Dispatcher.Invoke(async () => //下载
@@ -345,20 +330,6 @@ await Dispatcher.Invoke(async () => //下载
345330
{
346331
downloadTasks.Add(DownloadFile(_dlurl, _savepath));
347332
}
348-
//downloadTasks.Add(DownloadFile(_dlurl, _savepath));
349-
//bool dlStatus = await DownloadFile(_dlurl, _savepath);
350-
//Status_change("正在下载Forge运行Lib···(" + libCount + "/" + libALLCount + ")");
351-
/*
352-
}
353-
else
354-
{
355-
await Dispatcher.Invoke(async () =>
356-
{
357-
//Status_change("正在下载Forge运行Lib···(" + libCount + "/" + libALLCount + ")");
358-
await MagicShow.ShowDownloader(Window.GetWindow(this), _dlurl, Path.GetDirectoryName(_savepath), Path.GetFileName(_savepath), "下载LIB(" + libCount + "/" + libALLCount + ")中···");
359-
});
360-
}
361-
*/
362333
}
363334
}
364335
await Task.WhenAll(downloadTasks);
@@ -483,21 +454,12 @@ await Dispatcher.Invoke(async () =>
483454
Log_in("启动参数:" + buildarg);
484455
}
485456
}
486-
/*
487-
using (StreamWriter sw = new StreamWriter(InstallPath + "/install.bat", false, Encoding.UTF8))
488-
{
489-
sw.WriteLine("@echo off");
490-
sw.WriteLine("chcp 65001");
491-
sw.WriteLine(batData);
492-
}
493-
*/
494457
Status_change("正在编译Forge,请耐心等待……");
495458
Dispatcher.Invoke(() =>
496459
{
497460
CancelButton.IsEnabled = false;
498461
});
499462
Log_in("正在编译Forge……\n");
500-
StartLogging(); // 启动编译缓慢日志
501463
foreach (string cmdLine in cmdLines)
502464
{
503465
Process process = new Process();
@@ -535,7 +497,6 @@ await Dispatcher.Invoke(async () =>
535497

536498
Log_in("安装结束!");
537499
Status_change("结束!本对话框将自动关闭!");
538-
timer.Enabled = false; // 关闭日志计时器
539500
try
540501
{
541502
//File.Delete(InstallPath + "/install.bat");
@@ -559,33 +520,20 @@ await Dispatcher.Invoke(async () =>
559520
catch (OperationCanceledException) { return; }
560521
}
561522

562-
// forge编译缓慢日志输出
563523
private string logTemp = "";
564-
private System.Timers.Timer timer;
565-
566-
public void StartLogging()
567-
{
568-
timer = new System.Timers.Timer(1000);
569-
timer.Elapsed += OnTimedEvent;
570-
timer.AutoReset = true;
571-
timer.Enabled = true;
572-
}
573-
574-
private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
575-
{
576-
if (logTemp != "")
577-
{
578-
Log_in(logTemp);
579-
logTemp = "";
580-
}
581-
582-
}
583-
524+
private int counter = 100;
584525
private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
585526
{
586527
if (e.Data != null)
587528
{
529+
if (counter == 100)
530+
{
531+
counter = 0;
532+
Log_in(logTemp);
533+
logTemp = "";
534+
}
588535
logTemp += e.Data + "\n";
536+
counter++;
589537
}
590538
}
591539

0 commit comments

Comments
 (0)