Skip to content

Commit ed7ab70

Browse files
Merge pull request #1 from lengkonglovelife/test
test
2 parents 097f32c + aedfa9a commit ed7ab70

34 files changed

+1380
-833
lines changed

CreamInstaller/Components/CustomForm.cs

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,37 @@ private void OnHelpButtonClicked(object sender, EventArgs args)
4949
const string acidicoala = "https://github.com/acidicoala";
5050
string repository = $"https://github.com/{Program.RepositoryOwner}/{Program.RepositoryName}";
5151
_ = helpDialog.Show(SystemIcons.Information,
52-
"自动遍历所有已安装的Steam、Epic和Ubisoft的游戏与游戏对应DLC,相关DLL位置,\n"
53-
+ "解析SteamCMD、Steam Store和Epic Games Store以获取选择的游戏的DLC,然后提供交互菜单\n"
54-
+ "为了维护CreamInstaller而有效使用解析信息\n\n"
55-
+ $"程序使用最新的[Koaloader]({acidicoala}/Koaloader)、[SmokeAPI]({acidicoala}/SmokeAPI)、[ScreamAPI]({acidicoala}/ScreamAPI)、[Uplay R1 Unlocker]({acidicoala}/ UplayR1Unlocker) 和 [Uplay R2 Unlocker]({acidicoala}/UplayR2Unlocker),全部由[acidicoala]({acidicoala})\n"
56-
+ $"全部嵌入到软件里;您无需下载已经调用的DLC解锁项目!\n\n"
57-
+ "如何使用:\n" + " 1. 用软件遍历电脑寻找可以解锁的游戏和DLC。\n"
58-
+ " 本软件自动从 Steam、Epic 和 Ubisoft 目录遍历所有已安装的游戏.\n"
59-
+ " 2. 等待自动下载安装SteamCMD(选择的是Steam游戏的时候).\n"
60-
+ " 3. 等待软件解析并缓存所选游戏的信息和 DLC。\n"
61-
+ " 第一次运行可能会加载一段时间,时间取决于选择的游戏DLC数量。\n"
62-
+ " 4. 选择要解锁的游戏的DLC。\n"
63-
+ " 软件没有对每款游戏进行测试,所以你要自行尝试。\n"
64-
+ " 5. 是否勾选Koaloader加载,这个取决于你,如果勾选了,还要选择DLL代理。\n"
65-
+ " 如果默认的“version.dll”不办事,请看这个帖子[此处](https://cs.rin.ru/forum/viewtopic.php?p=2552172#p2552172)找到一个可以用的。\n"
66-
+ " 6.点击“安装”。\n" +
67-
" 7. 点击“确定”关闭软件。\n"
68-
+ " 8. 如果CreamInstaller导致您安装的游戏出现问题,那就返回\n"
69-
+ " 转到第5步,选择需要恢复的游戏,然后单击“卸载”。\n\n"
70-
+ "注意:该软件不会自动下载或安装真实的DLC;正如软件标题所示,该项目\n"
71-
+ "只是个DLC Unlucker安装程序。如果您想要解锁 DLC 的游戏尚未安装 DLC,就像\n"
72-
+ "大多数游戏,您必须自己寻找、下载安装到游戏目录中。包括手动安装新的\n"
73-
+ "DLC 以及在游戏更新后自己手动更新之前安装的 DLC。\n\n"
74-
+ $"如果想获得可靠和快速的帮助,所有错误、崩溃和其他问题请看[GitHub Issues]({repository}/issues) 页面!\n\n"
75-
+ $"但是:请阅读与您的问题相对应的[FAQ entry]({repository}#faq--common-issues) 和/或[template issue]({repository}/issues/new/choose)(如果存在)!另请注意 [GitHub Issues]({repository}/issues)\n"
76-
+ "页面不是个人帮助热线,而是用于程序本身的错误/崩溃/问题等。如果您发布的问题是脑残问题你就可以死妈了\n"
77-
+ "已经在 FAQ 中进行了解释,我将关闭你的issue,你的问题我会忽略。\n\n"
78-
+ "SteamCMD 安装和 appinfo 缓存可以在 [C:\\ProgramData\\CreamInstaller]() 中找到。\n"
79-
+ $"启动时会自动检测更新,并会从 [GitHub]({repository})下载文件进行更新。\n"
80-
+ $"软件源码和其他调用可以在[GitHub]({repository})上找到。");
52+
"自动遍历Steam、Epic和Ubisoft的游戏DLC\n"
53+
+ "解析SteamCMD、Steam Store和Epic Games Store获取游戏DLC\n"
54+
+ "利用获取的信息解锁DLC\n\n"
55+
+ $"应用使用最新的[CreamAPI](https://cs.rin.ru/forum/viewtopic.php?f=29&t=70576) by [deadmau5](https://cs.rin.ru/forum/viewtopic.php?f=29&t=70576). 最新的 [Koaloader]({acidicoala}/Koaloader), [ScreamAPI]({acidicoala}/ScreamAPI), [Uplay R1\n"
56+
+ $"Unlocker]({acidicoala}/UplayR1Unlocker) 还有 [Uplay R2 Unlocker]({acidicoala}/UplayR2Unlocker), 全靠 [acidicoala]({acidicoala}). 上述工具已经全部集成到应用,无需额外下载\n"
57+
+ ""
58+
+ "如何使用:\n" + " 1. 选择游戏\n"
59+
+ " 应用会自动遍历.\n"
60+
+ " 2. 等待自动下载SteamWork (Steam游戏).\n"
61+
+ " 3. 等待应用找到DLC信息\n"
62+
+ " 第一次运行可能需要较久的时间\n"
63+
+ " 4. 选择你需要解锁的DLC\n"
64+
+ " 我们没有对全部游戏进行测试\n"
65+
+ " 5. 选择时候使用Koaloader,如果是就选择代理Dll\n"
66+
+ " 如果默认 \'version.dll\' 无法使用, 就打开[here](https://cs.rin.ru/forum/viewtopic.php?p=2552172#p2552172)寻找能用的\n"
67+
+ " 6. 点击 \"安装\" \n"
68+
+ " 7. 点击 \"OK\"关闭应用\n"
69+
+ " 8.如果解锁工具使游戏启动失败,就重新启动应用程序卸载解锁工具\n"
70+
+ " 转到第五步,选择需要恢复的游戏进行卸载\n\n"
71+
+ "注意: 程序不会帮你下载真实的DLC文件,比如(地平线5的车辆DLC包等)\n"
72+
+ "他只是个解锁工具,如果你想解锁游戏没安装的DLC 例如地平线5\n"
73+
+ "你需要自己去寻找DLC的资源包\n"
74+
+ "如果DLC更新你需要手动安装更新后的DLC\n\n"
75+
+ $"任何错误提交到GITHUB Issues 页面[GitHub Issues]({repository}/issues) \n\n"
76+
+ $"不过: 请阅读 [FAQ entry]({repository}#faq--common-issues) 还有 [template issue]({repository}/issues/new/choose) [GitHub\n"
77+
+ $"Issues]({repository}/issues) 页面不是你倒垃圾的页面,也不是你彰显你低智商的舞台,而是针对各类bug等问题的页面,你的任何傻逼死妈问题,请不要在此页面进行发布,否则你的亲妈会被大运撞死\n"
78+
+ "如果你的问题已经在FAQ Template issues 作了解答,亲自己杀掉亲妈且关闭问题线程 \n"
79+
+ "我不会解答此问题.\n\n"
80+
+ "SteamCMD 的缓存目录: [C:\\ProgramData\\CreamInstaller]().\n"
81+
+ $"程序会自动从项目检查更新 [GitHub]({repository}) \n"
82+
+ $"源代码可以在我的github找到[GitHub]({repository}).");
8183
}
8284

8385
private void OnActivation(object sender, EventArgs args) => Activate();

CreamInstaller/Components/CustomTreeView.cs

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace CreamInstaller.Components;
1313

1414
internal sealed class CustomTreeView : TreeView
1515
{
16-
private const string KoaloaderToggleString = "Koaloader";
16+
private const string ProxyToggleString = "代理";
1717

1818
private static readonly Color C1 = ColorTranslator.FromHtml("#FFFF99");
1919
private static readonly Color C2 = ColorTranslator.FromHtml("#696900");
@@ -24,10 +24,10 @@ internal sealed class CustomTreeView : TreeView
2424
private static readonly Color C7 = ColorTranslator.FromHtml("#006900");
2525
private static readonly Color C8 = ColorTranslator.FromHtml("#69AA69");
2626

27-
private readonly Dictionary<Selection, Rectangle> checkBoxBounds = new();
28-
private readonly Dictionary<Selection, Rectangle> comboBoxBounds = new();
27+
private readonly Dictionary<Selection, Rectangle> checkBoxBounds = [];
28+
private readonly Dictionary<Selection, Rectangle> comboBoxBounds = [];
2929

30-
private readonly Dictionary<TreeNode, Rectangle> selectionBounds = new();
30+
private readonly Dictionary<TreeNode, Rectangle> selectionBounds = [];
3131
private SolidBrush backBrush;
3232
private ToolStripDropDown comboBoxDropDown;
3333
private Font comboBoxFont;
@@ -36,6 +36,7 @@ internal sealed class CustomTreeView : TreeView
3636
internal CustomTreeView()
3737
{
3838
DrawMode = TreeViewDrawMode.OwnerDrawAll;
39+
Invalidated += OnInvalidated;
3940
DrawNode += DrawTreeNode;
4041
Disposed += OnDisposed;
4142
}
@@ -59,27 +60,38 @@ private void OnDisposed(object sender, EventArgs e)
5960
comboBoxDropDown = null;
6061
}
6162

63+
private void OnInvalidated(object sender, EventArgs e)
64+
{
65+
checkBoxBounds.Clear();
66+
comboBoxBounds.Clear();
67+
selectionBounds.Clear();
68+
}
69+
6270
private void DrawTreeNode(object sender, DrawTreeNodeEventArgs e)
6371
{
6472
e.DrawDefault = true;
6573
TreeNode node = e.Node;
6674
if (node is not { IsVisible: true })
6775
return;
76+
6877
bool highlighted = (e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected && Focused;
6978
Graphics graphics = e.Graphics;
7079
backBrush ??= new(BackColor);
7180
Font font = node.NodeFont ?? Font;
7281
Brush brush = highlighted ? SystemBrushes.Highlight : backBrush;
7382
Rectangle bounds = node.Bounds;
7483
Rectangle selectionBounds = bounds;
84+
7585
Form form = FindForm();
7686
if (form is not SelectForm and not SelectDialogForm)
7787
return;
88+
7889
string id = node.Name;
7990
Platform platform = (node.Tag as Platform?).GetValueOrDefault(Platform.None);
8091
DLCType dlcType = (node.Tag as DLCType?).GetValueOrDefault(DLCType.None);
8192
if (string.IsNullOrWhiteSpace(id) || platform is Platform.None && dlcType is DLCType.None)
8293
return;
94+
8395
Color color = highlighted
8496
? C1
8597
: Enabled
@@ -91,15 +103,15 @@ private void DrawTreeNode(object sender, DrawTreeNodeEventArgs e)
91103
SelectionDLC dlc = SelectionDLC.FromId(dlcType, node.Parent?.Name, id);
92104
text = dlc?.Selection != null ? dlc.Selection.Platform.ToString() : dlcType.ToString();
93105
}
94-
else
95-
text = platform.ToString();
106+
else text = platform.ToString();
96107

97108
Size size = TextRenderer.MeasureText(graphics, text, font);
98109
bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width };
99110
selectionBounds = new(selectionBounds.Location, selectionBounds.Size + bounds.Size with { Height = 0 });
100111
graphics.FillRectangle(brush, bounds);
101112
Point point = new(bounds.Location.X - 1, bounds.Location.Y + 1);
102113
TextRenderer.DrawText(graphics, text, font, point, color, TextFormatFlags.Default);
114+
103115
if (platform is not Platform.Paradox)
104116
{
105117
color = highlighted
@@ -130,7 +142,7 @@ private void DrawTreeNode(object sender, DrawTreeNodeEventArgs e)
130142
graphics.FillRectangle(brush, bounds);
131143
}
132144

133-
CheckBoxState checkBoxState = selection.Koaloader
145+
CheckBoxState checkBoxState = selection.UseProxy
134146
? Enabled ? CheckBoxState.CheckedPressed : CheckBoxState.CheckedDisabled
135147
: Enabled
136148
? CheckBoxState.UncheckedPressed
@@ -142,7 +154,8 @@ private void DrawTreeNode(object sender, DrawTreeNodeEventArgs e)
142154
graphics.FillRectangle(backBrush, bounds);
143155
point = new(bounds.Left, bounds.Top + bounds.Height / 2 - size.Height / 2 - 1);
144156
CheckBoxRenderer.DrawCheckBox(graphics, point, checkBoxState);
145-
text = KoaloaderToggleString;
157+
158+
text = ProxyToggleString;
146159
size = TextRenderer.MeasureText(graphics, text, font);
147160
int left = 1;
148161
bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width + left };
@@ -151,29 +164,48 @@ private void DrawTreeNode(object sender, DrawTreeNodeEventArgs e)
151164
graphics.FillRectangle(backBrush, bounds);
152165
point = new(bounds.Location.X - 1 + left, bounds.Location.Y + 1);
153166
TextRenderer.DrawText(graphics, text, font, point, Enabled ? C7 : C8, TextFormatFlags.Default);
167+
154168
this.checkBoxBounds[selection] = RectangleToClient(checkBoxBounds);
155-
if (selection.Koaloader)
169+
170+
if (selection.UseProxy)
156171
{
157172
comboBoxFont ??= new(font.FontFamily, 6, font.Style, font.Unit, font.GdiCharSet,
158173
font.GdiVerticalFont);
159174
ComboBoxState comboBoxState = Enabled ? ComboBoxState.Normal : ComboBoxState.Disabled;
160-
text = (selection.KoaloaderProxy ?? Selection.DefaultKoaloaderProxy) + ".dll";
175+
ButtonState buttonState = Enabled ? ButtonState.Normal : ButtonState.Inactive;
176+
177+
text = (selection.Proxy ?? Selection.DefaultProxy) + ".dll";
161178
size = TextRenderer.MeasureText(graphics, text, comboBoxFont) + new Size(6, 0);
162179
const int padding = 2;
163180
bounds = new(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds.Height - padding);
164181
selectionBounds = new(selectionBounds.Location,
165182
selectionBounds.Size + bounds.Size with { Height = 0 });
166183
Rectangle comboBoxBounds = bounds;
167184
graphics.FillRectangle(backBrush, bounds);
168-
ComboBoxRenderer.DrawTextBox(graphics, bounds, text, comboBoxFont, comboBoxState);
185+
if (ComboBoxRenderer.IsSupported)
186+
ComboBoxRenderer.DrawTextBox(graphics, bounds, text, comboBoxFont, comboBoxState);
187+
else
188+
{
189+
graphics.FillRectangle(SystemBrushes.ControlText, bounds);
190+
ControlPaint.DrawButton(graphics, bounds, buttonState);
191+
point = new(bounds.Location.X + 3 + bounds.Width / 2 - size.Width / 2,
192+
bounds.Location.Y + bounds.Height / 2 - size.Height / 2);
193+
TextRenderer.DrawText(graphics, text, comboBoxFont, point,
194+
Enabled ? SystemColors.ControlText : SystemColors.GrayText, TextFormatFlags.Default);
195+
}
196+
169197
size = new(14, 0);
170198
left = -1;
171199
bounds = bounds with { X = bounds.X + bounds.Width + left, Width = size.Width };
172200
selectionBounds = new(selectionBounds.Location,
173201
selectionBounds.Size + new Size(bounds.Size.Width + left, 0));
174202
comboBoxBounds = new(comboBoxBounds.Location,
175203
comboBoxBounds.Size + new Size(bounds.Size.Width + left, 0));
176-
ComboBoxRenderer.DrawDropDownButton(graphics, bounds, comboBoxState);
204+
if (ComboBoxRenderer.IsSupported)
205+
ComboBoxRenderer.DrawDropDownButton(graphics, bounds, comboBoxState);
206+
else
207+
ControlPaint.DrawComboButton(graphics, bounds, buttonState);
208+
177209
this.comboBoxBounds[selection] = RectangleToClient(comboBoxBounds);
178210
}
179211
else
@@ -201,20 +233,16 @@ protected override void OnMouseDown(MouseEventArgs e)
201233
break;
202234
}
203235

204-
if (e.Button is not MouseButtons.Left)
236+
if (e.Button is not MouseButtons.Left || !ComboBoxRenderer.IsSupported)
205237
return;
238+
206239
if (comboBoxBounds.Count > 0 && selectForm is not null)
207240
foreach (KeyValuePair<Selection, Rectangle> pair in comboBoxBounds)
208241
if (!Selection.All.ContainsKey(pair.Key))
209242
_ = comboBoxBounds.Remove(pair.Key);
210243
else if (pair.Value.Contains(clickPoint))
211244
{
212-
HashSet<string> proxies = EmbeddedResources
213-
.Where(r => r.StartsWith("Koaloader", StringComparison.Ordinal)).Select(p =>
214-
{
215-
p.GetProxyInfoFromIdentifier(out string proxyName, out _);
216-
return proxyName;
217-
}).ToHashSet();
245+
IEnumerable<string> proxies = pair.Key.GetAvailableProxies();
218246
comboBoxDropDown ??= new();
219247
comboBoxDropDown.ShowItemToolTips = false;
220248
comboBoxDropDown.Items.Clear();
@@ -224,7 +252,9 @@ protected override void OnMouseDown(MouseEventArgs e)
224252
foreach ((string directory, BinaryType _) in pair.Key.ExecutableDirectories)
225253
{
226254
string path = directory + @"\" + proxy + ".dll";
227-
if (!path.FileExists() || path.IsResourceFile(ResourceIdentifier.Koaloader))
255+
if (!path.FileExists() || path.IsResourceFile(ResourceIdentifier.Koaloader) ||
256+
path.IsResourceFile(ResourceIdentifier.Steamworks32) ||
257+
path.IsResourceFile(ResourceIdentifier.Steamworks64))
228258
continue;
229259
canUse = false;
230260
break;
@@ -233,8 +263,8 @@ protected override void OnMouseDown(MouseEventArgs e)
233263
if (canUse)
234264
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (_, _) =>
235265
{
236-
pair.Key.KoaloaderProxy = proxy == Selection.DefaultKoaloaderProxy ? null : proxy;
237-
selectForm.OnKoaloaderChanged();
266+
pair.Key.Proxy = proxy == Selection.DefaultProxy ? null : proxy;
267+
selectForm.OnProxyChanged();
238268
}) { Font = comboBoxFont });
239269
}
240270

@@ -247,8 +277,8 @@ protected override void OnMouseDown(MouseEventArgs e)
247277
_ = checkBoxBounds.Remove(pair.Key);
248278
else if (pair.Value.Contains(clickPoint))
249279
{
250-
pair.Key.Koaloader = !pair.Key.Koaloader;
251-
selectForm?.OnKoaloaderChanged();
280+
pair.Key.UseProxy = !pair.Key.UseProxy;
281+
selectForm?.OnProxyChanged();
252282
break;
253283
}
254284
}

CreamInstaller/Components/PlatformIdComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal sealed class StringComparer : IComparer<string>
2222
{
2323
public int Compare(string a, string b)
2424
=> !int.TryParse(a, out _) && !int.TryParse(b, out _)
25-
? string.Compare(a, b, StringComparison.Ordinal)
25+
? string.Compare(a, b, StringComparison.CurrentCulture)
2626
: !int.TryParse(a, out int A)
2727
? 1
2828
: !int.TryParse(b, out int B)

0 commit comments

Comments
 (0)