PageDownloadClient.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. using System;
  2. using System.CodeDom.Compiler;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Runtime.CompilerServices;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Markup;
  10. using System.Windows.Media;
  11. using Microsoft.VisualBasic.CompilerServices;
  12. using Newtonsoft.Json.Linq;
  13. namespace PCL
  14. {
  15. // Token: 0x020001A7 RID: 423
  16. [DesignerGenerated]
  17. public class PageDownloadClient : MyPageRight, IComponentConnector
  18. {
  19. // Token: 0x0600116B RID: 4459 RVA: 0x0000A8B5 File Offset: 0x00008AB5
  20. public PageDownloadClient()
  21. {
  22. base.Initialized += delegate(object sender, EventArgs e)
  23. {
  24. this.LoaderInit();
  25. };
  26. base.Loaded += delegate(object sender, RoutedEventArgs e)
  27. {
  28. this.Init();
  29. };
  30. this.InitializeComponent();
  31. }
  32. // Token: 0x0600116C RID: 4460 RVA: 0x0007CCB8 File Offset: 0x0007AEB8
  33. private void LoaderInit()
  34. {
  35. base.PageLoaderInit(this.Load, this.PanLoad, this.PanBack, null, ModDownload.accountTests, delegate(ModLoader.LoaderBase a0)
  36. {
  37. this.Load_OnFinish();
  38. }, null, true);
  39. }
  40. // Token: 0x0600116D RID: 4461 RVA: 0x0000A8E8 File Offset: 0x00008AE8
  41. private void Init()
  42. {
  43. this.PanBack.ScrollToHome();
  44. }
  45. // Token: 0x0600116E RID: 4462 RVA: 0x0007CCF4 File Offset: 0x0007AEF4
  46. private void Load_OnFinish()
  47. {
  48. checked
  49. {
  50. try
  51. {
  52. Dictionary<string, List<JObject>> dictionary = new Dictionary<string, List<JObject>>
  53. {
  54. {
  55. "正式版",
  56. new List<JObject>()
  57. },
  58. {
  59. "预览版",
  60. new List<JObject>()
  61. },
  62. {
  63. "远古版",
  64. new List<JObject>()
  65. },
  66. {
  67. "愚人节版",
  68. new List<JObject>()
  69. }
  70. };
  71. JArray jarray = (JArray)ModDownload.accountTests.Output.Value["versions"];
  72. try
  73. {
  74. foreach (JToken jtoken in jarray)
  75. {
  76. JObject jobject = (JObject)jtoken;
  77. string text = (string)jobject["type"];
  78. if (Operators.CompareString(text, "release", false) != 0)
  79. {
  80. if (Operators.CompareString(text, "snapshot", false) != 0)
  81. {
  82. if (Operators.CompareString(text, "special", false) != 0)
  83. {
  84. text = "远古版";
  85. }
  86. else
  87. {
  88. text = "愚人节版";
  89. }
  90. }
  91. else
  92. {
  93. text = "预览版";
  94. if (jobject["id"].ToString().StartsWith("1.") && !jobject["id"].ToString().ToLower().Contains("combat") && !jobject["id"].ToString().ToLower().Contains("rc") && !jobject["id"].ToString().ToLower().Contains("experimental") && !jobject["id"].ToString().ToLower().Contains("pre"))
  95. {
  96. text = "正式版";
  97. jobject["type"] = "release";
  98. }
  99. string text2 = jobject["id"].ToString().ToLower();
  100. uint num = <PrivateImplementationDetails>.ComputeStringHash(text2);
  101. if (num <= 2819146544U)
  102. {
  103. if (num <= 2783260049U)
  104. {
  105. if (num != 673058499U)
  106. {
  107. if (num == 2783260049U)
  108. {
  109. if (Operators.CompareString(text2, "1.rv-pre1", false) == 0)
  110. {
  111. goto IL_3CF;
  112. }
  113. }
  114. }
  115. else if (Operators.CompareString(text2, "2.0", false) == 0)
  116. {
  117. goto IL_3CF;
  118. }
  119. }
  120. else if (num != 2812350463U)
  121. {
  122. if (num == 2819146544U)
  123. {
  124. if (Operators.CompareString(text2, "15w14a", false) == 0)
  125. {
  126. goto IL_3CF;
  127. }
  128. }
  129. }
  130. else if (Operators.CompareString(text2, "23w13a_or_b", false) == 0)
  131. {
  132. goto IL_3CF;
  133. }
  134. }
  135. else
  136. {
  137. if (num <= 3741345573U)
  138. {
  139. if (num != 3653809737U)
  140. {
  141. if (num != 3741345573U)
  142. {
  143. goto IL_36E;
  144. }
  145. if (Operators.CompareString(text2, "20w14infinite", false) != 0)
  146. {
  147. goto IL_36E;
  148. }
  149. }
  150. else if (Operators.CompareString(text2, "20w14∞", false) != 0)
  151. {
  152. goto IL_36E;
  153. }
  154. text = "愚人节版";
  155. jobject["id"] = "20w14∞";
  156. jobject["type"] = "special";
  157. jobject.Add("lore", ModMinecraft.GetMcFoolName((string)jobject["id"]));
  158. goto IL_41C;
  159. }
  160. if (num != 3766348906U)
  161. {
  162. if (num != 3830073160U)
  163. {
  164. if (num == 4285466550U)
  165. {
  166. if (Operators.CompareString(text2, "24w14potato", false) == 0)
  167. {
  168. goto IL_3CF;
  169. }
  170. }
  171. }
  172. else if (Operators.CompareString(text2, "22w13oneblockatatime", false) == 0)
  173. {
  174. goto IL_3CF;
  175. }
  176. }
  177. else if (Operators.CompareString(text2, "3d shareware v1.34", false) == 0)
  178. {
  179. goto IL_3CF;
  180. }
  181. }
  182. IL_36E:
  183. DateTime dateTime = Extensions.Value<DateTime>(jobject["releaseTime"]).ToUniversalTime().AddHours(2.0);
  184. if (dateTime.Month == 4 && dateTime.Day == 1)
  185. {
  186. text = "愚人节版";
  187. jobject["type"] = "special";
  188. goto IL_41C;
  189. }
  190. goto IL_41C;
  191. IL_3CF:
  192. text = "愚人节版";
  193. jobject["type"] = "special";
  194. jobject.Add("lore", ModMinecraft.GetMcFoolName((string)jobject["id"]));
  195. }
  196. }
  197. else
  198. {
  199. text = "正式版";
  200. }
  201. IL_41C:
  202. dictionary[text].Add(jobject);
  203. }
  204. }
  205. finally
  206. {
  207. IEnumerator<JToken> enumerator;
  208. if (enumerator != null)
  209. {
  210. enumerator.Dispose();
  211. }
  212. }
  213. int num2 = dictionary.Keys.Count - 1;
  214. for (int i = 0; i <= num2; i++)
  215. {
  216. dictionary[Enumerable.ElementAtOrDefault<string>(dictionary.Keys, i)] = Enumerable.ElementAtOrDefault<List<JObject>>(dictionary.Values, i).Sort((PageDownloadClient._Closure$__.$I3-0 == null) ? (PageDownloadClient._Closure$__.$I3-0 = ((JObject a, JObject b) => DateTime.Compare(Extensions.Value<DateTime>(a["releaseTime"]), Extensions.Value<DateTime>(b["releaseTime"])) > 0)) : PageDownloadClient._Closure$__.$I3-0);
  217. }
  218. this.PanMain.Children.Clear();
  219. MyCard myCard = new MyCard();
  220. myCard.Title = "最新版本";
  221. myCard.Margin = new Thickness(0.0, 0.0, 0.0, 15.0);
  222. myCard.CreateParser(2);
  223. MyCard myCard2 = myCard;
  224. List<JObject> list = new List<JObject>();
  225. JObject jobject2 = (JObject)dictionary["正式版"][0].DeepClone();
  226. jobject2["lore"] = "最新正式版,发布于 " + Extensions.Value<DateTime>(jobject2["releaseTime"]).ToString("yyyy'/'MM'/'dd HH':'mm");
  227. list.Add(jobject2);
  228. if (DateTime.Compare(Extensions.Value<DateTime>(dictionary["正式版"][0]["releaseTime"]), Extensions.Value<DateTime>(dictionary["预览版"][0]["releaseTime"])) < 0)
  229. {
  230. JObject jobject3 = (JObject)dictionary["预览版"][0].DeepClone();
  231. jobject3["lore"] = "最新预览版,发布于 " + Extensions.Value<DateTime>(jobject3["releaseTime"]).ToString("yyyy'/'MM'/'dd HH':'mm");
  232. list.Add(jobject3);
  233. }
  234. StackPanel element = new StackPanel
  235. {
  236. Margin = new Thickness(20.0, 40.0, 18.0, 0.0),
  237. VerticalAlignment = VerticalAlignment.Top,
  238. RenderTransform = new TranslateTransform(0.0, 0.0),
  239. Tag = list
  240. };
  241. MyCard.StackInstall(ref element, 2, "");
  242. myCard2.Children.Add(element);
  243. this.PanMain.Children.Add(myCard2);
  244. try
  245. {
  246. foreach (KeyValuePair<string, List<JObject>> keyValuePair in dictionary)
  247. {
  248. if (Enumerable.Any<JObject>(keyValuePair.Value))
  249. {
  250. MyCard myCard3 = new MyCard();
  251. myCard3.Title = keyValuePair.Key + " (" + Conversions.ToString(keyValuePair.Value.Count) + ")";
  252. myCard3.Margin = new Thickness(0.0, 0.0, 0.0, 15.0);
  253. myCard3.CreateParser(2);
  254. MyCard myCard4 = myCard3;
  255. StackPanel stackPanel = new StackPanel
  256. {
  257. Margin = new Thickness(20.0, 40.0, 18.0, 0.0),
  258. VerticalAlignment = VerticalAlignment.Top,
  259. RenderTransform = new TranslateTransform(0.0, 0.0),
  260. Tag = keyValuePair.Value
  261. };
  262. myCard4.Children.Add(stackPanel);
  263. myCard4._Stub = stackPanel;
  264. myCard4.IsSwaped = true;
  265. this.PanMain.Children.Add(myCard4);
  266. }
  267. }
  268. }
  269. finally
  270. {
  271. Dictionary<string, List<JObject>>.Enumerator enumerator2;
  272. ((IDisposable)enumerator2).Dispose();
  273. }
  274. }
  275. catch (Exception ex)
  276. {
  277. ModBase.Log(ex, "可视化 MC 版本列表出错", ModBase.LogLevel.Feedback, "出现错误");
  278. }
  279. }
  280. }
  281. // Token: 0x0600116F RID: 4463 RVA: 0x0000A8F5 File Offset: 0x00008AF5
  282. public void DownloadStart(MyListItem sender, object e)
  283. {
  284. ModDownloadLib.McDownloadClient(ModNet.NetPreDownloadBehaviour.HintWhileExists, sender.Title, NewLateBinding.LateIndexGet(sender.Tag, new object[]
  285. {
  286. "url"
  287. }, null).ToString());
  288. }
  289. // Token: 0x170002B1 RID: 689
  290. // (get) Token: 0x06001170 RID: 4464 RVA: 0x0000A923 File Offset: 0x00008B23
  291. // (set) Token: 0x06001171 RID: 4465 RVA: 0x0000A92B File Offset: 0x00008B2B
  292. internal virtual MyScrollViewer PanBack { get; set; }
  293. // Token: 0x170002B2 RID: 690
  294. // (get) Token: 0x06001172 RID: 4466 RVA: 0x0000A934 File Offset: 0x00008B34
  295. // (set) Token: 0x06001173 RID: 4467 RVA: 0x0000A93C File Offset: 0x00008B3C
  296. internal virtual StackPanel PanMain { get; set; }
  297. // Token: 0x170002B3 RID: 691
  298. // (get) Token: 0x06001174 RID: 4468 RVA: 0x0000A945 File Offset: 0x00008B45
  299. // (set) Token: 0x06001175 RID: 4469 RVA: 0x0000A94D File Offset: 0x00008B4D
  300. internal virtual MyCard PanLoad { get; set; }
  301. // Token: 0x170002B4 RID: 692
  302. // (get) Token: 0x06001176 RID: 4470 RVA: 0x0000A956 File Offset: 0x00008B56
  303. // (set) Token: 0x06001177 RID: 4471 RVA: 0x0000A95E File Offset: 0x00008B5E
  304. internal virtual MyLoading Load { get; set; }
  305. // Token: 0x06001178 RID: 4472 RVA: 0x0007D558 File Offset: 0x0007B758
  306. [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  307. public void InitializeComponent()
  308. {
  309. if (!this._ConfigurationThread)
  310. {
  311. this._ConfigurationThread = true;
  312. Uri resourceLocator = new Uri("/Plain Craft Launcher 2;component/pages/pagedownload/pagedownloadclient.xaml", UriKind.Relative);
  313. Application.LoadComponent(this, resourceLocator);
  314. }
  315. }
  316. // Token: 0x06001179 RID: 4473 RVA: 0x0000414E File Offset: 0x0000234E
  317. [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  318. internal Delegate _CreateDelegate(Type delegateType, string handler)
  319. {
  320. return Delegate.CreateDelegate(delegateType, this, handler);
  321. }
  322. // Token: 0x0600117A RID: 4474 RVA: 0x0007D588 File Offset: 0x0007B788
  323. [EditorBrowsable(EditorBrowsableState.Never)]
  324. [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  325. public void System_Windows_Markup_IComponentConnector_Connect(int connectionId, object target)
  326. {
  327. if (connectionId == 1)
  328. {
  329. this.PanBack = (MyScrollViewer)target;
  330. return;
  331. }
  332. if (connectionId == 2)
  333. {
  334. this.PanMain = (StackPanel)target;
  335. return;
  336. }
  337. if (connectionId == 3)
  338. {
  339. this.PanLoad = (MyCard)target;
  340. return;
  341. }
  342. if (connectionId == 4)
  343. {
  344. this.Load = (MyLoading)target;
  345. return;
  346. }
  347. this._ConfigurationThread = true;
  348. }
  349. // Token: 0x04000917 RID: 2327
  350. [AccessedThroughProperty("PanBack")]
  351. [CompilerGenerated]
  352. private MyScrollViewer templateThread;
  353. // Token: 0x04000918 RID: 2328
  354. [AccessedThroughProperty("PanMain")]
  355. [CompilerGenerated]
  356. private StackPanel methodThread;
  357. // Token: 0x04000919 RID: 2329
  358. [AccessedThroughProperty("PanLoad")]
  359. [CompilerGenerated]
  360. private MyCard _TaskThread;
  361. // Token: 0x0400091A RID: 2330
  362. [AccessedThroughProperty("Load")]
  363. [CompilerGenerated]
  364. private MyLoading m_ConsumerThread;
  365. // Token: 0x0400091B RID: 2331
  366. private bool _ConfigurationThread;
  367. }
  368. }