Skip to content

Commit

Permalink
up 常规问题修复
Browse files Browse the repository at this point in the history
遗漏UA
  • Loading branch information
Coloryr committed Feb 20, 2024
1 parent f6760d6 commit 6e6b281
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/ColorMC.Core/CoreMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ColorMC.Core;
public static class ColorMCCore
{
public const string TopVersion = "A24";
public const string DateVersion = "20240219";
public const string DateVersion = "20240220";

public const string Version = $"{TopVersion}.{DateVersion}";

Expand Down
11 changes: 10 additions & 1 deletion src/ColorMC.Core/Net/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ColorMC.Core.Objs;
using ColorMC.Core.Utils;
using System.Net;
using System.Net.Http.Headers;

namespace ColorMC.Core.Net;

Expand Down Expand Up @@ -47,14 +48,18 @@ public static void Init()
{
DownloadClient = new(new HttpClientHandler()
{
Proxy = new WebProxy(ConfigUtils.Config.Http.ProxyIP, ConfigUtils.Config.Http.ProxyPort)
Proxy = new WebProxy(ConfigUtils.Config.Http.ProxyIP, ConfigUtils.Config.Http.ProxyPort),
});
}
else
{
DownloadClient = new();
}

DownloadClient.DefaultRequestHeaders.UserAgent.Clear();
DownloadClient.DefaultRequestHeaders.UserAgent
.Add(new ProductInfoHeaderValue("ColorMC", ColorMCCore.Version));

if (ConfigUtils.Config.Http.LoginProxy
&& !string.IsNullOrWhiteSpace(ConfigUtils.Config.Http.ProxyIP))
{
Expand All @@ -68,6 +73,10 @@ public static void Init()
LoginClient = new();
}

LoginClient.DefaultRequestHeaders.UserAgent.Clear();
LoginClient.DefaultRequestHeaders.UserAgent
.Add(new ProductInfoHeaderValue("ColorMC", ColorMCCore.Version));

LoginClient.Timeout = TimeSpan.FromSeconds(10);
DownloadClient.Timeout = TimeSpan.FromSeconds(10);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ColorMC.Gui/Resource/Language/gui_zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
"ServerPackWindow.Tabs.Text4": "配置文件选择",
"ServerPackWindow.Tab1.Text1": "服务器包会复制游戏实例的所有设置,包括JVM参数,运行前启动等数据",
"ServerPackWindow.Tab1.Text6": "更新说明",
"ServerPackWindow.Tab1.Text10": "生成服务器实例",
"ServerPackWindow.Tab1.Text10": "开始生成",
"ServerPackWindow.Tab1.Text11": "转到下一个设置",
"ServerPackWindow.Tab1.Error3": "生成失败,请查看日志获取详细信息",
"ServerPackWindow.Tab1.Info1": "正在生成服务器实例",
Expand Down
2 changes: 1 addition & 1 deletion src/ColorMC.Gui/UI/Controls/Main/MainEmptyControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
d:DesignWidth="800"
x:DataType="model:MainEmptyModel"
mc:Ignorable="d">
<Panel>
<Panel Background="Transparent">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Top"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected override Control ViewChange(bool iswhell, int old, int index)
{
case 1:
case 2:
case 4:
model.RemoveChoise();
break;
}
Expand All @@ -105,6 +106,7 @@ protected override Control ViewChange(bool iswhell, int old, int index)
return _tab3 ??= new();
case 3:
model.LoadFile();
model.SetTab4Click();
return _tab4 ??= new();
default:
throw new InvalidEnumArgumentException();
Expand Down
11 changes: 1 addition & 10 deletions src/ColorMC.Gui/UI/Controls/ServerPack/Tab1Control.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,12 @@
<Button
Width="160"
Height="30"
Margin="-2,-2,3,-2"
Margin="-2"
Classes="top"
Command="{Binding GoToNext}"
Content="{setting:Localize ServerPackWindow.Tab1.Text11}"
ToolTip.Tip="{setting:Localize ToolTip.Text47}"
ToolTip.VerticalOffset="-30" />
<Button
Width="160"
Height="30"
Margin="-2,-2,0,-2"
Classes="top"
Command="{Binding Gen}"
Content="{setting:Localize ServerPackWindow.Tab1.Text10}"
ToolTip.Tip="{setting:Localize ToolTip.Text47}"
ToolTip.VerticalOffset="-30" />
</StackPanel>
<TextBlock
Margin="0,0,0,5"
Expand Down
3 changes: 1 addition & 2 deletions src/ColorMC.Gui/UI/Model/ServerPack/ServerPackModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public ServerPackModel(BaseModel model, ServerPackObj obj) : base(model)
Obj = obj;
}

[RelayCommand]
public async Task Gen()
public async void Gen()
{
var local = await PathBinding.SelectPath(FileType.ServerPack);
if (local == null)
Expand Down
2 changes: 2 additions & 0 deletions src/ColorMC.Gui/UI/Model/ServerPack/ServerPackTab1Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public void GoToNext()
NowView++;
}



public void LoadConfig()
{
_loadConfig = true;
Expand Down
6 changes: 6 additions & 0 deletions src/ColorMC.Gui/UI/Model/ServerPack/ServerPackTab4Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public void AddFile()
LoadFile();
}

public void SetTab4Click()
{
Model.SetChoiseCall(_name, Gen);
Model.SetChoiseContent(_name, App.Lang("ServerPackWindow.Tab1.Text10"));
}

public void LoadFile()
{
FileList.Clear();
Expand Down
4 changes: 4 additions & 0 deletions src/ColorMC.Gui/UIBinding/BaseBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ await Launch(obj, (a) =>

list.Add(temp);
}
if (list.Count == 0)
{
return;
}

Thread.Sleep(1000);

Expand Down

0 comments on commit 6e6b281

Please sign in to comment.