ModLaunch.cs 134 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Globalization;
  5. using System.IO;
  6. using System.IO.Compression;
  7. using System.Linq;
  8. using System.Net;
  9. using System.Runtime.CompilerServices;
  10. using System.Text;
  11. using System.Threading;
  12. using System.Windows;
  13. using System.Windows.Controls;
  14. using Microsoft.VisualBasic;
  15. using Microsoft.VisualBasic.CompilerServices;
  16. using Newtonsoft.Json;
  17. using Newtonsoft.Json.Linq;
  18. namespace PCL
  19. {
  20. // Token: 0x02000160 RID: 352
  21. [StandardModule]
  22. public sealed class ModLaunch
  23. {
  24. // Token: 0x06000DFE RID: 3582 RVA: 0x0005FE8C File Offset: 0x0005E08C
  25. public static bool McLaunchStart(ModLaunch.McLaunchOptions Options = null)
  26. {
  27. ModLaunch.filterTests = (Options ?? new ModLaunch.McLaunchOptions());
  28. if (!ModBase.RunInUi())
  29. {
  30. throw new Exception("McLaunchStart 必须在 UI 线程调用!");
  31. }
  32. bool result;
  33. if (ModLaunch.databaseTests.State == ModBase.LoadState.Loading)
  34. {
  35. ModMain.Hint("已有游戏正在启动中!", ModMain.HintType.Critical, true);
  36. result = false;
  37. }
  38. else
  39. {
  40. if (ModLaunch.filterTests._DicMap != null && ModMinecraft.AddClient() != ModLaunch.filterTests._DicMap)
  41. {
  42. ModLaunch.McLaunchLog("在启动前切换到版本 " + ModLaunch.filterTests._DicMap.Name);
  43. ModLaunch.filterTests._DicMap.Load();
  44. if (ModLaunch.filterTests._DicMap._ConfigurationMap == ModMinecraft.McVersionState.Error)
  45. {
  46. ModMain.Hint("无法启动 Minecraft:" + ModLaunch.filterTests._DicMap._ConsumerMap, ModMain.HintType.Critical, true);
  47. return false;
  48. }
  49. ModMinecraft.InstantiateClient(ModLaunch.filterTests._DicMap);
  50. ModBase.m_IdentifierRepository.Set("LaunchVersionSelect", ModMinecraft.AddClient().Name, false, null);
  51. ModMain.recordIterator.RefreshButtonsUI();
  52. ModMain.recordIterator.RefreshPage(false, false);
  53. }
  54. ModMain._ProcessIterator.AprilGiveup();
  55. ModMain._ProcessIterator._ConsumerIterator = Enumerable.ToList<FormMain.PageStackData>(Enumerable.Where<FormMain.PageStackData>(ModMain._ProcessIterator._ConsumerIterator, (ModLaunch._Closure$__.$I3-0 == null) ? (ModLaunch._Closure$__.$I3-0 = ((FormMain.PageStackData p) => p.initializerMap != FormMain.PageType.VersionSelect)) : ModLaunch._Closure$__.$I3-0));
  56. ModLaunch.databaseTests.Start(Options, true);
  57. result = true;
  58. }
  59. return result;
  60. }
  61. // Token: 0x06000DFF RID: 3583 RVA: 0x00060004 File Offset: 0x0005E204
  62. public static void McLaunchLog(string Text)
  63. {
  64. Text = ModSecret.SecretFilter(Text, '*');
  65. ModBase.RunInUi(delegate()
  66. {
  67. TextBlock labLog;
  68. (labLog = ModMain.m_ServiceIterator.LabLog).Text = string.Concat(new string[]
  69. {
  70. labLog.Text,
  71. "\r\n[",
  72. ModBase.GetTimeNow(),
  73. "] ",
  74. Text
  75. });
  76. }, false);
  77. ModBase.Log("[Launch] " + Text, ModBase.LogLevel.Normal, "出现错误");
  78. }
  79. // Token: 0x06000E00 RID: 3584 RVA: 0x00060060 File Offset: 0x0005E260
  80. private static void McLaunchState(ModLoader.LoaderTask<ModLaunch.McLaunchOptions, object> Loader)
  81. {
  82. switch (ModLaunch.databaseTests.State)
  83. {
  84. case ModBase.LoadState.Waiting:
  85. case ModBase.LoadState.Finished:
  86. case ModBase.LoadState.Failed:
  87. case ModBase.LoadState.Aborted:
  88. ModMain.recordIterator.PageChangeToLogin();
  89. return;
  90. case ModBase.LoadState.Loading:
  91. ModMain.m_ServiceIterator.LabLog.Text = "";
  92. return;
  93. default:
  94. return;
  95. }
  96. }
  97. // Token: 0x06000E01 RID: 3585 RVA: 0x000600B4 File Offset: 0x0005E2B4
  98. private static void McLaunchStart(ModLoader.LoaderTask<ModLaunch.McLaunchOptions, object> Loader)
  99. {
  100. ModBase.RunInUiWait(new Action(ModMain.recordIterator.PageChangeToLaunching));
  101. try
  102. {
  103. ModLaunch.McLaunchPrecheck();
  104. ModLaunch.McLaunchLog("预检测已通过");
  105. }
  106. catch (Exception ex)
  107. {
  108. if (!ex.Message.StartsWithF("$$", false))
  109. {
  110. ModMain.Hint(ex.Message, ModMain.HintType.Critical, true);
  111. }
  112. throw;
  113. }
  114. try
  115. {
  116. List<ModLoader.LoaderBase> list = new List<ModLoader.LoaderBase>
  117. {
  118. new ModLoader.LoaderTask<int, int>("获取 Java", new Action<ModLoader.LoaderTask<int, int>>(ModLaunch.McLaunchJava), null, ThreadPriority.Normal)
  119. {
  120. ProgressWeight = 4.0,
  121. Block = false
  122. },
  123. ModLaunch.interceptorTests,
  124. new ModLoader.LoaderCombo<string>("补全文件", ModDownload.DlClientFix(ModMinecraft.AddClient(), false, ModDownload.AssetsIndexExistsBehaviour.DownloadInBackground))
  125. {
  126. ProgressWeight = 15.0,
  127. Show = false
  128. },
  129. new ModLoader.LoaderTask<string, List<ModMinecraft.McLibToken>>("获取启动参数", new Action<ModLoader.LoaderTask<string, List<ModMinecraft.McLibToken>>>(ModLaunch.McLaunchArgumentMain), null, ThreadPriority.Normal)
  130. {
  131. ProgressWeight = 2.0
  132. },
  133. new ModLoader.LoaderTask<List<ModMinecraft.McLibToken>, int>("解压文件", new Action<ModLoader.LoaderTask<List<ModMinecraft.McLibToken>, int>>(ModLaunch.McLaunchNatives), null, ThreadPriority.Normal)
  134. {
  135. ProgressWeight = 2.0
  136. },
  137. new ModLoader.LoaderTask<int, int>("预启动处理", (ModLaunch._Closure$__.$IR11-2 == null) ? (ModLaunch._Closure$__.$IR11-2 = delegate(ModLoader.LoaderTask<int, int> a0)
  138. {
  139. ModLaunch.McLaunchPrerun();
  140. }) : ModLaunch._Closure$__.$IR11-2, null, ThreadPriority.Normal)
  141. {
  142. ProgressWeight = 1.0
  143. },
  144. new ModLoader.LoaderTask<int, int>("执行自定义命令", new Action<ModLoader.LoaderTask<int, int>>(ModLaunch.McLaunchCustom), null, ThreadPriority.Normal)
  145. {
  146. ProgressWeight = 1.0
  147. },
  148. new ModLoader.LoaderTask<int, Process>("启动进程", new Action<ModLoader.LoaderTask<int, Process>>(ModLaunch.McLaunchRun), null, ThreadPriority.Normal)
  149. {
  150. ProgressWeight = 2.0
  151. },
  152. new ModLoader.LoaderTask<Process, int>("等待游戏窗口出现", new Action<ModLoader.LoaderTask<Process, int>>(ModLaunch.McLaunchWait), null, ThreadPriority.Normal)
  153. {
  154. ProgressWeight = 1.0
  155. },
  156. new ModLoader.LoaderTask<int, int>("结束处理", (ModLaunch._Closure$__.$IR11-3 == null) ? (ModLaunch._Closure$__.$IR11-3 = delegate(ModLoader.LoaderTask<int, int> a0)
  157. {
  158. ModLaunch.McLaunchEnd();
  159. }) : ModLaunch._Closure$__.$IR11-3, null, ThreadPriority.Normal)
  160. {
  161. ProgressWeight = 1.0
  162. }
  163. };
  164. object left = ModBase.m_IdentifierRepository.Get("VersionRamOptimize", ModMinecraft.AddClient());
  165. if (Operators.ConditionalCompareObjectEqual(left, 0, false))
  166. {
  167. if (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("LaunchArgumentRam", null)))
  168. {
  169. ((ModLoader.LoaderCombo<string>)list[2]).Block = false;
  170. list.Insert(3, new ModLoader.LoaderTask<int, int>("内存优化", new Action<ModLoader.LoaderTask<int, int>>(ModLaunch.McLaunchMemoryOptimize), null, ThreadPriority.Normal)
  171. {
  172. ProgressWeight = 30.0
  173. });
  174. }
  175. }
  176. else if (Operators.ConditionalCompareObjectEqual(left, 1, false))
  177. {
  178. ((ModLoader.LoaderCombo<string>)list[2]).Block = false;
  179. list.Insert(3, new ModLoader.LoaderTask<int, int>("内存优化", new Action<ModLoader.LoaderTask<int, int>>(ModLaunch.McLaunchMemoryOptimize), null, ThreadPriority.Normal)
  180. {
  181. ProgressWeight = 30.0
  182. });
  183. }
  184. else
  185. {
  186. Operators.ConditionalCompareObjectEqual(left, 2, false);
  187. }
  188. ModLoader.LoaderCombo<object> loaderCombo = new ModLoader.LoaderCombo<object>("Minecraft 启动", list)
  189. {
  190. Show = false
  191. };
  192. if (ModLaunch.interceptorTests.State == ModBase.LoadState.Finished)
  193. {
  194. ModLaunch.interceptorTests.State = ModBase.LoadState.Waiting;
  195. }
  196. ModLaunch.m_PredicateTests = loaderCombo;
  197. ModLaunch._PageTests = null;
  198. loaderCombo.Start(null, false);
  199. ModLoader.LoaderTaskbarAdd<object>(loaderCombo);
  200. while (loaderCombo.State == ModBase.LoadState.Loading)
  201. {
  202. ModMain.recordIterator.Dispatcher.Invoke(new Action(ModMain.recordIterator.LaunchingRefresh));
  203. Thread.Sleep(200);
  204. }
  205. ModMain.recordIterator.Dispatcher.Invoke(new Action(ModMain.recordIterator.LaunchingRefresh));
  206. switch (loaderCombo.State)
  207. {
  208. case ModBase.LoadState.Finished:
  209. ModMain.Hint(ModMinecraft.AddClient().Name + " 启动成功!", ModMain.HintType.Finish, true);
  210. break;
  211. case ModBase.LoadState.Failed:
  212. throw loaderCombo.Error;
  213. case ModBase.LoadState.Aborted:
  214. if (ModLaunch._PageTests == null)
  215. {
  216. ModLaunch.McLaunchOptions mcLaunchOptions = ModLaunch.filterTests;
  217. ModMain.Hint((((mcLaunchOptions != null) ? mcLaunchOptions.requestMap : null) == null) ? "已取消启动!" : "已取消导出启动脚本!", ModMain.HintType.Info, true);
  218. }
  219. else
  220. {
  221. ModMain.Hint(ModLaunch._PageTests, ModMain.HintType.Finish, true);
  222. }
  223. break;
  224. default:
  225. throw new Exception("错误的状态改变:" + ModBase.GetStringFromEnum(loaderCombo.State));
  226. }
  227. }
  228. catch (Exception ex2)
  229. {
  230. Exception ex3 = ex2;
  231. while (!ex3.Message.StartsWithF("$", false))
  232. {
  233. if (ex3.InnerException == null)
  234. {
  235. ModLaunch.McLaunchLog("错误:" + ModBase.GetExceptionDetail(ex2, false));
  236. Exception ex4 = ex2;
  237. ModLaunch.McLaunchOptions mcLaunchOptions2 = ModLaunch.filterTests;
  238. string desc = (((mcLaunchOptions2 != null) ? mcLaunchOptions2.requestMap : null) == null) ? "Minecraft 启动失败" : "导出启动脚本失败";
  239. ModBase.LogLevel level = ModBase.LogLevel.Msgbox;
  240. ModLaunch.McLaunchOptions mcLaunchOptions3 = ModLaunch.filterTests;
  241. ModBase.Log(ex4, desc, level, (((mcLaunchOptions3 != null) ? mcLaunchOptions3.requestMap : null) == null) ? "启动失败" : "导出启动脚本失败");
  242. throw;
  243. }
  244. ex3 = ex3.InnerException;
  245. }
  246. if (Operators.CompareString(ex3.Message, "$$", false) != 0)
  247. {
  248. string caption = ex3.Message.TrimStart(new char[]
  249. {
  250. '$'
  251. });
  252. ModLaunch.McLaunchOptions mcLaunchOptions4 = ModLaunch.filterTests;
  253. ModMain.MyMsgBox(caption, (((mcLaunchOptions4 != null) ? mcLaunchOptions4.requestMap : null) == null) ? "启动失败" : "导出启动脚本失败", "确定", "", "", false, true, false, null, null, null);
  254. }
  255. throw;
  256. }
  257. }
  258. // Token: 0x06000E02 RID: 3586 RVA: 0x0006063C File Offset: 0x0005E83C
  259. private static void McLaunchMemoryOptimize(ModLoader.LoaderTask<int, int> Loader)
  260. {
  261. ModLaunch._Closure$__12-0 CS$<>8__locals1 = new ModLaunch._Closure$__12-0(CS$<>8__locals1);
  262. ModLaunch.McLaunchLog("内存优化开始");
  263. CS$<>8__locals1.$VB$Local_Finished = false;
  264. ModBase.RunInNewThread(delegate
  265. {
  266. PageOtherTest.MemoryOptimize(false);
  267. CS$<>8__locals1.$VB$Local_Finished = true;
  268. }, "Launch Memory Optimize", ThreadPriority.Normal);
  269. while (!CS$<>8__locals1.$VB$Local_Finished && !Loader.IsAborted)
  270. {
  271. if (Loader.Progress < 0.7)
  272. {
  273. Loader.Progress += 0.007;
  274. }
  275. else
  276. {
  277. Loader.Progress += (0.95 - Loader.Progress) * 0.02;
  278. }
  279. Thread.Sleep(100);
  280. }
  281. }
  282. // Token: 0x06000E03 RID: 3587 RVA: 0x000606E8 File Offset: 0x0005E8E8
  283. private static void McLaunchPrecheck()
  284. {
  285. if (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("SystemDebugDelay", null)))
  286. {
  287. Thread.Sleep(ModBase.RandomInteger(100, 2000));
  288. }
  289. if (ModMinecraft.AddClient().ChangeMapper().Contains("!") || ModMinecraft.AddClient().ChangeMapper().Contains(";"))
  290. {
  291. throw new Exception("游戏路径中不可包含 ! 或 ;(" + ModMinecraft.AddClient().ChangeMapper() + ")");
  292. }
  293. if (ModMinecraft.AddClient().Path.Contains("!") || ModMinecraft.AddClient().Path.Contains(";"))
  294. {
  295. throw new Exception("游戏路径中不可包含 ! 或 ;(" + ModMinecraft.AddClient().Path + ")");
  296. }
  297. if (ModMinecraft.AddClient() == null)
  298. {
  299. throw new Exception("未选择 Minecraft 版本!");
  300. }
  301. ModMinecraft.AddClient().Load();
  302. if (ModMinecraft.AddClient()._ConfigurationMap == ModMinecraft.McVersionState.Error)
  303. {
  304. throw new Exception("Minecraft 存在问题:" + ModMinecraft.AddClient()._ConsumerMap);
  305. }
  306. string CheckResult = "";
  307. ModBase.RunInUiWait(delegate()
  308. {
  309. CheckResult = ModLaunch.McLoginAble(ModLaunch.McLoginInput());
  310. });
  311. if (Operators.CompareString(CheckResult, "", false) != 0)
  312. {
  313. throw new ArgumentException(CheckResult);
  314. }
  315. ModBase.RunInNewThread((ModLaunch._Closure$__.$I13-1 == null) ? (ModLaunch._Closure$__.$I13-1 = delegate()
  316. {
  317. object left2 = ModBase.m_IdentifierRepository.Get("SystemLaunchCount", null);
  318. if (Conversions.ToBoolean(Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 10, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 20, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 40, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 60, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 80, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 100, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 120, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 150, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 200, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 250, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 300, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 350, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 400, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 500, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 600, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 700, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 800, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 900, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 1000, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 1200, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 1400, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 1600, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 1800, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left2, 2000, false))) && ModMain.MyMsgBox(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("PCL 已经为你启动了 ", ModBase.m_IdentifierRepository.Get("SystemLaunchCount", null)), " 次游戏啦!"), "\r\n"), "如果 PCL 还算好用的话,能不能考虑赞助一下 PCL……"), "\r\n"), "如果没有大家的支持,PCL 很难在免费、无任何广告的情况下维持数年的更新(磕头)……!")), Conversions.ToString(Operators.ConcatenateObject(ModBase.m_IdentifierRepository.Get("SystemLaunchCount", null), " 次启动!")), "支持 PCL!", "但是我拒绝", "", false, true, false, null, null, null) == 1)
  319. {
  320. ModBase.OpenWebsite("https://afdian.com/a/LTCat");
  321. }
  322. }) : ModLaunch._Closure$__.$I13-1, "Donate", ThreadPriority.Normal);
  323. if (Conversions.ToBoolean(Conversions.ToBoolean(Operators.NotObject(ModBase.m_IdentifierRepository.Get("HintBuy", null))) && Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("LoginType", null), ModLaunch.McLoginType.Ms, false)))
  324. {
  325. if (ModBase.IsSystemLanguageChinese())
  326. {
  327. object left = ModBase.m_IdentifierRepository.Get("SystemLaunchCount", null);
  328. if (Conversions.ToBoolean(Conversions.ToBoolean(Operators.CompareObjectEqual(left, 3, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 8, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 15, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 30, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 50, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 70, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 90, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 110, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 130, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 180, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 220, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 280, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 330, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 380, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 450, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 550, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 660, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 750, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 880, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 950, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 1100, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 1300, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 1500, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 1700, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 1900, false))) && ModMain.MyMsgBox(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("你已经启动了 ", ModBase.m_IdentifierRepository.Get("SystemLaunchCount", null)), " 次 Minecraft 啦!"), "\r\n"), "如果觉得 Minecraft 还不错,可以购买正版支持一下,毕竟开发游戏也真的很不容易……不要一直白嫖啦。"), "\r\n"), "\r\n"), "在登录一次正版账号后,就不会再出现这个提示了!")), "考虑一下正版?", "支持正版游戏!", "下次一定", "", false, true, false, null, null, null) == 1)
  329. {
  330. ModBase.OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj");
  331. return;
  332. }
  333. }
  334. else if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("LoginType", null), ModLaunch.McLoginType.Legacy, false))
  335. {
  336. int num = ModMain.MyMsgBox("你必须先登录正版账号,才能进行离线登录!", "正版验证", "购买正版", "试玩", "返回", false, true, false, (ModLaunch._Closure$__.$I13-2 == null) ? (ModLaunch._Closure$__.$I13-2 = delegate()
  337. {
  338. ModBase.OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj");
  339. }) : ModLaunch._Closure$__.$I13-2, null, null);
  340. if (num == 2)
  341. {
  342. ModMain.Hint("游戏将以试玩模式启动!", ModMain.HintType.Critical, true);
  343. ModLaunch.filterTests._HelperMap.Add("--demo");
  344. return;
  345. }
  346. if (num != 3)
  347. {
  348. return;
  349. }
  350. throw new Exception("$$");
  351. }
  352. }
  353. }
  354. // Token: 0x06000E04 RID: 3588 RVA: 0x00060C88 File Offset: 0x0005EE88
  355. public static string McLoginName()
  356. {
  357. object left = ModBase.m_IdentifierRepository.Get("LoginType", null);
  358. if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Ms, false))
  359. {
  360. if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("CacheMsV2Name", null), "", false))
  361. {
  362. return Conversions.ToString(ModBase.m_IdentifierRepository.Get("CacheMsV2Name", null));
  363. }
  364. }
  365. else if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Legacy, false))
  366. {
  367. if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("LoginLegacyName", null), "", false))
  368. {
  369. return ModBase.m_IdentifierRepository.Get("LoginLegacyName", null).ToString().BeforeFirst("¨", false);
  370. }
  371. }
  372. else if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Nide, false))
  373. {
  374. if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("CacheNideName", null), "", false))
  375. {
  376. return Conversions.ToString(ModBase.m_IdentifierRepository.Get("CacheNideName", null));
  377. }
  378. }
  379. else if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Auth, false) && Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("CacheAuthName", null), "", false))
  380. {
  381. return Conversions.ToString(ModBase.m_IdentifierRepository.Get("CacheAuthName", null));
  382. }
  383. string result;
  384. if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("CacheMsV2Name", null), "", false))
  385. {
  386. result = Conversions.ToString(ModBase.m_IdentifierRepository.Get("CacheMsV2Name", null));
  387. }
  388. else if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("CacheNideName", null), "", false))
  389. {
  390. result = Conversions.ToString(ModBase.m_IdentifierRepository.Get("CacheNideName", null));
  391. }
  392. else if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("CacheAuthName", null), "", false))
  393. {
  394. result = Conversions.ToString(ModBase.m_IdentifierRepository.Get("CacheAuthName", null));
  395. }
  396. else if (Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("LoginLegacyName", null), "", false))
  397. {
  398. result = ModBase.m_IdentifierRepository.Get("LoginLegacyName", null).ToString().BeforeFirst("¨", false);
  399. }
  400. else
  401. {
  402. result = null;
  403. }
  404. return result;
  405. }
  406. // Token: 0x06000E05 RID: 3589 RVA: 0x00060EB8 File Offset: 0x0005F0B8
  407. public static string McLoginAble()
  408. {
  409. object left = ModBase.m_IdentifierRepository.Get("LoginType", null);
  410. string result;
  411. if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Ms, false))
  412. {
  413. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("CacheMsV2OAuthRefresh", null), "", false))
  414. {
  415. result = ModMain.m_ClientRepository.IsVaild();
  416. }
  417. else
  418. {
  419. result = "";
  420. }
  421. }
  422. else if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Legacy, false))
  423. {
  424. result = ModMain.m_ProcIterator.IsVaild();
  425. }
  426. else if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Nide, false))
  427. {
  428. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("CacheNideAccess", null), "", false))
  429. {
  430. result = ModMain.parserRepository.IsVaild();
  431. }
  432. else
  433. {
  434. result = "";
  435. }
  436. }
  437. else if (Operators.ConditionalCompareObjectEqual(left, ModLaunch.McLoginType.Auth, false))
  438. {
  439. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("CacheAuthAccess", null), "", false))
  440. {
  441. result = ModMain.fieldRepository.IsVaild();
  442. }
  443. else
  444. {
  445. result = "";
  446. }
  447. }
  448. else
  449. {
  450. result = "未知的登录方式";
  451. }
  452. return result;
  453. }
  454. // Token: 0x06000E06 RID: 3590 RVA: 0x00060FC8 File Offset: 0x0005F1C8
  455. public static string McLoginAble(ModLaunch.McLoginData LoginData)
  456. {
  457. switch (LoginData.Type)
  458. {
  459. case ModLaunch.McLoginType.Legacy:
  460. return PageLoginLegacy.IsVaild((ModLaunch.McLoginLegacy)LoginData);
  461. case ModLaunch.McLoginType.Nide:
  462. return PageLoginNide.IsVaild((ModLaunch.McLoginServer)LoginData);
  463. case ModLaunch.McLoginType.Auth:
  464. return PageLoginAuth.IsVaild((ModLaunch.McLoginServer)LoginData);
  465. case ModLaunch.McLoginType.Ms:
  466. return PageLoginMs.IsVaild((ModLaunch.McLoginMs)LoginData);
  467. }
  468. return "未知的登录方式";
  469. }
  470. // Token: 0x06000E07 RID: 3591 RVA: 0x0006103C File Offset: 0x0005F23C
  471. public static ModLaunch.McLoginData McLoginInput()
  472. {
  473. ModLaunch.McLoginData result = null;
  474. ModLaunch.McLoginType mcLoginType = (ModLaunch.McLoginType)Conversions.ToInteger(ModBase.m_IdentifierRepository.Get("LoginType", null));
  475. try
  476. {
  477. switch (mcLoginType)
  478. {
  479. case ModLaunch.McLoginType.Legacy:
  480. result = PageLoginLegacy.GetLoginData();
  481. break;
  482. case ModLaunch.McLoginType.Nide:
  483. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("CacheNideAccess", null), "", false))
  484. {
  485. result = PageLoginNide.GetLoginData();
  486. }
  487. else
  488. {
  489. result = PageLoginNideSkin.GetLoginData();
  490. }
  491. break;
  492. case ModLaunch.McLoginType.Auth:
  493. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("CacheAuthAccess", null), "", false))
  494. {
  495. result = PageLoginAuth.GetLoginData();
  496. }
  497. else
  498. {
  499. result = PageLoginAuthSkin.GetLoginData();
  500. }
  501. break;
  502. case ModLaunch.McLoginType.Ms:
  503. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("CacheMsV2OAuthRefresh", null), "", false))
  504. {
  505. result = PageLoginMs.GetLoginData();
  506. }
  507. else
  508. {
  509. result = PageLoginMsSkin.GetLoginData();
  510. }
  511. break;
  512. }
  513. }
  514. catch (Exception ex)
  515. {
  516. ModBase.Log(ex, "获取登录输入信息失败(" + ModBase.GetStringFromEnum(mcLoginType) + ")", ModBase.LogLevel.Feedback, "出现错误");
  517. }
  518. return result;
  519. }
  520. // Token: 0x06000E08 RID: 3592 RVA: 0x0006115C File Offset: 0x0005F35C
  521. private static void McLoginStart(ModLoader.LoaderTask<ModLaunch.McLoginData, ModLaunch.McLoginResult> Data)
  522. {
  523. ModLaunch.McLaunchLog("登录加载已开始");
  524. string text = ModLaunch.McLoginAble(Data.Input);
  525. if (Operators.CompareString(text, "", false) != 0)
  526. {
  527. throw new ArgumentException(text);
  528. }
  529. ModLoader.LoaderBase loaderBase = null;
  530. switch (Data.Input.Type)
  531. {
  532. case ModLaunch.McLoginType.Legacy:
  533. loaderBase = ModLaunch._ParamsTests;
  534. break;
  535. case ModLaunch.McLoginType.Nide:
  536. loaderBase = ModLaunch.dispatcherTests;
  537. break;
  538. case ModLaunch.McLoginType.Auth:
  539. loaderBase = ModLaunch._ProcessTests;
  540. break;
  541. case ModLaunch.McLoginType.Ms:
  542. loaderBase = ModLaunch.m_ContainerTests;
  543. break;
  544. }
  545. loaderBase.WaitForExit(Data.Input, ModLaunch.interceptorTests, Data.IsForceRestarting);
  546. object obj = NewLateBinding.LateGet(loaderBase, null, "Output", new object[0], null, null, null);
  547. Data.Output = ((obj != null) ? ((ModLaunch.McLoginResult)obj) : default(ModLaunch.McLoginResult));
  548. ModBase.RunInUi((ModLaunch._Closure$__.$I25-0 == null) ? (ModLaunch._Closure$__.$I25-0 = delegate()
  549. {
  550. ModMain.recordIterator.RefreshPage(true, false);
  551. }) : ModLaunch._Closure$__.$I25-0, false);
  552. ModLaunch.McLaunchLog("登录加载已结束");
  553. }
  554. // Token: 0x06000E09 RID: 3593 RVA: 0x0006125C File Offset: 0x0005F45C
  555. private static void McLoginMsStart(ModLoader.LoaderTask<ModLaunch.McLoginMs, ModLaunch.McLoginResult> Data)
  556. {
  557. ModLaunch.McLoginMs input = Data.Input;
  558. string observerMap = input.observerMap;
  559. ModLaunch.McLaunchLog("登录方式:正版(" + ((Operators.CompareString(observerMap, "", false) == 0) ? "尚未登录" : observerMap) + ")");
  560. Data.Progress = 0.05;
  561. if (!Data.IsForceRestarting && Operators.CompareString(input.paramMap, "", false) != 0 && ModLaunch.m_ParameterTests > 0L && checked(ModBase.GetTimeTick() - ModLaunch.m_ParameterTests) < 600000L)
  562. {
  563. Data.Output = new ModLaunch.McLoginResult
  564. {
  565. _StateMap = input.paramMap,
  566. Name = input.observerMap,
  567. m_InstanceMap = input._TagMap,
  568. Type = "Microsoft",
  569. _CallbackMap = input._TagMap,
  570. _TemplateMap = input.stubMap
  571. };
  572. }
  573. else
  574. {
  575. string[] array;
  576. if (Operators.CompareString(input.m_SystemMap, "", false) != 0)
  577. {
  578. array = ModLaunch.smethod_0(input.m_SystemMap);
  579. if (Operators.CompareString(array[0], "Relogin", false) != 0)
  580. {
  581. goto IL_126;
  582. }
  583. }
  584. array = ModLaunch.MsLoginStep1New(Data);
  585. IL_126:
  586. if (Data.IsAborted)
  587. {
  588. throw new ThreadInterruptedException();
  589. }
  590. Data.Progress = 0.25;
  591. if (Data.IsAborted)
  592. {
  593. throw new ThreadInterruptedException();
  594. }
  595. string accessToken = array[0];
  596. string text = array[1];
  597. string xbltoken = ModLaunch.MsLoginStep2(accessToken);
  598. Data.Progress = 0.4;
  599. if (Data.IsAborted)
  600. {
  601. throw new ThreadInterruptedException();
  602. }
  603. string[] tokens = ModLaunch.MsLoginStep3(xbltoken);
  604. Data.Progress = 0.55;
  605. if (Data.IsAborted)
  606. {
  607. throw new ThreadInterruptedException();
  608. }
  609. string text2 = ModLaunch.MsLoginStep4(tokens);
  610. Data.Progress = 0.7;
  611. if (Data.IsAborted)
  612. {
  613. throw new ThreadInterruptedException();
  614. }
  615. ModLaunch.MsLoginStep5(text2);
  616. Data.Progress = 0.85;
  617. if (Data.IsAborted)
  618. {
  619. throw new ThreadInterruptedException();
  620. }
  621. string[] array2 = ModLaunch.MsLoginStep6(text2);
  622. Data.Progress = 0.98;
  623. ModBase.m_IdentifierRepository.Set("CacheMsV2OAuthRefresh", text, false, null);
  624. ModBase.m_IdentifierRepository.Set("CacheMsV2Access", text2, false, null);
  625. ModBase.m_IdentifierRepository.Set("CacheMsV2Uuid", array2[0], false, null);
  626. ModBase.m_IdentifierRepository.Set("CacheMsV2Name", array2[1], false, null);
  627. ModBase.m_IdentifierRepository.Set("CacheMsV2ProfileJson", array2[2], false, null);
  628. JObject jobject = (JObject)ModBase.GetJson(Conversions.ToString(ModBase.m_IdentifierRepository.Get("LoginMsJson", null)));
  629. jobject.Remove(input.observerMap);
  630. jobject[array2[1]] = text;
  631. ModBase.m_IdentifierRepository.Set("LoginMsJson", jobject.ToString(0, new JsonConverter[0]), false, null);
  632. Data.Output = new ModLaunch.McLoginResult
  633. {
  634. _StateMap = text2,
  635. Name = array2[1],
  636. m_InstanceMap = array2[0],
  637. Type = "Microsoft",
  638. _CallbackMap = array2[0],
  639. _TemplateMap = array2[2]
  640. };
  641. ModLaunch.m_ParameterTests = ModBase.GetTimeTick();
  642. ModLaunch.McLaunchLog("微软登录完成");
  643. }
  644. ModBase.m_IdentifierRepository.Set("HintBuy", true, false, null);
  645. if (ModSecret.ThemeUnlock(10, false, null))
  646. {
  647. ModMain.MyMsgBox("感谢你对正版游戏的支持!\r\n隐藏主题 跳票红 已解锁!", "提示", "确定", "", "", false, true, false, null, null, null);
  648. }
  649. }
  650. // Token: 0x06000E0A RID: 3594 RVA: 0x000615D4 File Offset: 0x0005F7D4
  651. private static void McLoginServerStart(ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult> Data)
  652. {
  653. ModLaunch.McLoginServer input = Data.Input;
  654. bool flag = false;
  655. string text = input.m_IssuerMap;
  656. if (Conversions.ToBoolean(text.Contains("@") && Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("UiLauncherEmail", null))))
  657. {
  658. text = ModMinecraft.AccountFilter(text);
  659. }
  660. ModLaunch.McLaunchLog(string.Concat(new string[]
  661. {
  662. "登录方式:",
  663. input.m_WatcherMap,
  664. "(",
  665. text,
  666. ")"
  667. }));
  668. Data.Progress = 0.05;
  669. if (Data.Input._IdentifierMap || !Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("Cache" + input.m_SerializerMap + "Username", null), Data.Input.m_IssuerMap, false) || !Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("Cache" + input.m_SerializerMap + "Pass", null), Data.Input._IndexerMap, false) || !Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("Cache" + input.m_SerializerMap + "Access", null), "", false) || !Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("Cache" + input.m_SerializerMap + "Client", null), "", false) || !Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("Cache" + input.m_SerializerMap + "Uuid", null), "", false) || !Operators.ConditionalCompareObjectNotEqual(ModBase.m_IdentifierRepository.Get("Cache" + input.m_SerializerMap + "Name", null), "", false))
  670. {
  671. goto IL_300;
  672. }
  673. try
  674. {
  675. if (Data.IsAborted)
  676. {
  677. throw new ThreadInterruptedException();
  678. }
  679. ModLaunch.McLoginRequestValidate(ref Data);
  680. goto IL_306;
  681. }
  682. catch (Exception ex)
  683. {
  684. string exceptionSummary = ModBase.GetExceptionSummary(ex);
  685. ModLaunch.McLaunchLog("验证登录失败:" + exceptionSummary);
  686. if ((exceptionSummary.Contains("超时") || exceptionSummary.Contains("imeout")) && !exceptionSummary.Contains("403"))
  687. {
  688. ModLaunch.McLaunchLog("已触发超时登录失败");
  689. throw new Exception("$登录失败:连接登录服务器超时。\r\n请检查你的网络状况是否良好,或尝试使用 VPN!");
  690. }
  691. }
  692. Data.Progress = 0.25;
  693. IL_2A5:
  694. try
  695. {
  696. if (Data.IsAborted)
  697. {
  698. throw new ThreadInterruptedException();
  699. }
  700. ModLaunch.McLoginRequestRefresh(ref Data, flag);
  701. goto IL_306;
  702. }
  703. catch (Exception ex2)
  704. {
  705. ModLaunch.McLaunchLog("刷新登录失败:" + ModBase.GetExceptionSummary(ex2));
  706. }
  707. Data.Progress = (flag ? 0.85 : 0.45);
  708. IL_300:
  709. try
  710. {
  711. if (Data.IsAborted)
  712. {
  713. throw new ThreadInterruptedException();
  714. }
  715. flag = ModLaunch.McLoginRequestLogin(ref Data);
  716. }
  717. catch (Exception ex3)
  718. {
  719. ModLaunch.McLaunchLog("登录失败:" + ModBase.GetExceptionSummary(ex3));
  720. throw;
  721. }
  722. if (flag)
  723. {
  724. Data.Progress = 0.65;
  725. goto IL_2A5;
  726. }
  727. IL_306:
  728. Data.Progress = 0.95;
  729. Dictionary<string, string> dictionary = new Dictionary<string, string>();
  730. List<string> list = new List<string>();
  731. List<string> list2 = new List<string>();
  732. checked
  733. {
  734. try
  735. {
  736. if (Conversions.ToBoolean(Operators.NotObject(Operators.CompareObjectEqual(ModBase.m_IdentifierRepository.Get("Login" + input.m_SerializerMap + "Email", null), "", false))))
  737. {
  738. list.AddRange(ModBase.m_IdentifierRepository.Get("Login" + input.m_SerializerMap + "Email", null).ToString().Split("¨"));
  739. }
  740. if (Conversions.ToBoolean(Operators.NotObject(Operators.CompareObjectEqual(ModBase.m_IdentifierRepository.Get("Login" + input.m_SerializerMap + "Pass", null), "", false))))
  741. {
  742. list2.AddRange(ModBase.m_IdentifierRepository.Get("Login" + input.m_SerializerMap + "Pass", null).ToString().Split("¨"));
  743. }
  744. int num = list.Count - 1;
  745. for (int i = 0; i <= num; i++)
  746. {
  747. dictionary.Add(list[i], list2[i]);
  748. }
  749. dictionary.Remove(input.m_IssuerMap);
  750. list = new List<string>(dictionary.Keys);
  751. list.Insert(0, input.m_IssuerMap);
  752. list2 = new List<string>(dictionary.Values);
  753. list2.Insert(0, input._IndexerMap);
  754. ModBase.m_IdentifierRepository.Set("Login" + input.m_SerializerMap + "Email", list.Join("¨"), false, null);
  755. ModBase.m_IdentifierRepository.Set("Login" + input.m_SerializerMap + "Pass", list2.Join("¨"), false, null);
  756. }
  757. catch (Exception ex4)
  758. {
  759. ModBase.Log(ex4, "保存启动记录失败", ModBase.LogLevel.Hint, "出现错误");
  760. ModBase.m_IdentifierRepository.Set("Login" + input.m_SerializerMap + "Email", "", false, null);
  761. ModBase.m_IdentifierRepository.Set("Login" + input.m_SerializerMap + "Pass", "", false, null);
  762. }
  763. }
  764. }
  765. // Token: 0x06000E0B RID: 3595 RVA: 0x00061B88 File Offset: 0x0005FD88
  766. private static void McLoginLegacyStart(ModLoader.LoaderTask<ModLaunch.McLoginLegacy, ModLaunch.McLoginResult> Data)
  767. {
  768. ModLaunch.McLoginLegacy input = Data.Input;
  769. ModLaunch.McLaunchLog("登录方式:离线(" + input.m_RulesMap + ")");
  770. Data.Progress = 0.1;
  771. Data.Output.Name = input.m_RulesMap;
  772. Data.Output.m_InstanceMap = ModLaunch.McLoginLegacyUuidWithCustomSkin(input.m_RulesMap, input.m_RefMap, input._DecoratorMap);
  773. Data.Output.Type = "Legacy";
  774. Data.Output._StateMap = Data.Output.m_InstanceMap;
  775. Data.Output._CallbackMap = Data.Output.m_InstanceMap;
  776. List<string> list = new List<string>();
  777. if (Conversions.ToBoolean(Operators.NotObject(Operators.CompareObjectEqual(ModBase.m_IdentifierRepository.Get("LoginLegacyName", null), "", false))))
  778. {
  779. list.AddRange(ModBase.m_IdentifierRepository.Get("LoginLegacyName", null).ToString().Split("¨"));
  780. }
  781. list.Remove(input.m_RulesMap);
  782. list.Insert(0, input.m_RulesMap);
  783. ModBase.m_IdentifierRepository.Set("LoginLegacyName", list.ToArray().Join("¨"), false, null);
  784. }
  785. // Token: 0x06000E0C RID: 3596 RVA: 0x00061CB8 File Offset: 0x0005FEB8
  786. private static void McLoginRequestValidate(ref ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult> Data)
  787. {
  788. ModLaunch.McLaunchLog("验证登录开始(Validate, " + Data.Input.m_SerializerMap + ")");
  789. string text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Access", null));
  790. string text2 = Conversions.ToString(ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Client", null));
  791. string instanceMap = Conversions.ToString(ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Uuid", null));
  792. string name = Conversions.ToString(ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Name", null));
  793. JObject jobject = new JObject(new object[]
  794. {
  795. new JProperty("accessToken", text),
  796. new JProperty("clientToken", text2),
  797. new JProperty("requestUser", true)
  798. });
  799. ModNet.NetRequestRetry(Data.Input.interpreterMap + "/validate", "POST", jobject.ToString(0, new JsonConverter[0]), "application/json; charset=utf-8", true, new Dictionary<string, string>
  800. {
  801. {
  802. "Accept-Language",
  803. "zh_CN"
  804. }
  805. });
  806. Data.Output._StateMap = text;
  807. Data.Output._CallbackMap = text2;
  808. Data.Output.m_InstanceMap = instanceMap;
  809. Data.Output.Name = name;
  810. Data.Output.Type = Data.Input.m_SerializerMap;
  811. ModLaunch.McLaunchLog("验证登录成功(Validate, " + Data.Input.m_SerializerMap + ")");
  812. }
  813. // Token: 0x06000E0D RID: 3597 RVA: 0x00061E88 File Offset: 0x00060088
  814. private static void McLoginRequestRefresh(ref ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult> Data, bool RequestUser)
  815. {
  816. ModLaunch.McLaunchLog("刷新登录开始(Refresh, " + Data.Input.m_SerializerMap + ")");
  817. JObject jobject = (JObject)ModBase.GetJson(ModNet.NetRequestRetry(Data.Input.interpreterMap + "/refresh", "POST", Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("{", RequestUser ? Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("\r\n \"requestUser\": true,\r\n \"selectedProfile\": {\r\n \"id\":\"", ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Uuid", null)), "\",\r\n \"name\":\""), ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Name", null)), "\"},") : ""), "\r\n \"accessToken\":\""), ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Access", null)), "\",\r\n \"clientToken\":\""), ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Client", null)), "\"}"), "application/json; charset=utf-8", true, new Dictionary<string, string>
  818. {
  819. {
  820. "Accept-Language",
  821. "zh_CN"
  822. }
  823. }));
  824. if (jobject["selectedProfile"] == null)
  825. {
  826. throw new Exception(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("选择的角色 ", ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Name", null)), " 无效!")));
  827. }
  828. Data.Output._StateMap = jobject["accessToken"].ToString();
  829. Data.Output._CallbackMap = jobject["clientToken"].ToString();
  830. Data.Output.m_InstanceMap = jobject["selectedProfile"]["id"].ToString();
  831. Data.Output.Name = jobject["selectedProfile"]["name"].ToString();
  832. Data.Output.Type = Data.Input.m_SerializerMap;
  833. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Access", Data.Output._StateMap, false, null);
  834. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Client", Data.Output._CallbackMap, false, null);
  835. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Uuid", Data.Output.m_InstanceMap, false, null);
  836. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Name", Data.Output.Name, false, null);
  837. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Username", Data.Input.m_IssuerMap, false, null);
  838. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Pass", Data.Input._IndexerMap, false, null);
  839. ModLaunch.McLaunchLog("刷新登录成功(Refresh, " + Data.Input.m_SerializerMap + ")");
  840. }
  841. // Token: 0x06000E0E RID: 3598 RVA: 0x00062234 File Offset: 0x00060434
  842. private static bool McLoginRequestLogin(ref ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult> Data)
  843. {
  844. bool result;
  845. try
  846. {
  847. ModLaunch._Closure$__36-0 CS$<>8__locals1 = new ModLaunch._Closure$__36-0(CS$<>8__locals1);
  848. bool flag = false;
  849. ModLaunch.McLaunchLog("登录开始(Login, " + Data.Input.m_SerializerMap + ")");
  850. JObject jobject = new JObject(new object[]
  851. {
  852. new JProperty("agent", new JObject(new object[]
  853. {
  854. new JProperty("name", "Minecraft"),
  855. new JProperty("version", 1)
  856. })),
  857. new JProperty("username", Data.Input.m_IssuerMap),
  858. new JProperty("password", Data.Input._IndexerMap),
  859. new JProperty("requestUser", true)
  860. });
  861. CS$<>8__locals1.$VB$Local_LoginJson = (JObject)ModBase.GetJson(ModNet.NetRequestRetry(Data.Input.interpreterMap + "/authenticate", "POST", jobject.ToString(0, new JsonConverter[0]), "application/json; charset=utf-8", true, new Dictionary<string, string>
  862. {
  863. {
  864. "Accept-Language",
  865. "zh_CN"
  866. }
  867. }));
  868. if (Enumerable.Count<JToken>(CS$<>8__locals1.$VB$Local_LoginJson["availableProfiles"]) == 0)
  869. {
  870. if (Data.Input._IdentifierMap)
  871. {
  872. ModMain.Hint("你还没有创建角色,无法更换!", ModMain.HintType.Critical, true);
  873. }
  874. throw new Exception("$你还没有创建角色,请在创建角色后再试!");
  875. }
  876. if (Data.Input._IdentifierMap && Enumerable.Count<JToken>(CS$<>8__locals1.$VB$Local_LoginJson["availableProfiles"]) == 1)
  877. {
  878. ModMain.Hint("你的账户中只有一个角色,无法更换!", ModMain.HintType.Critical, true);
  879. }
  880. CS$<>8__locals1.$VB$Local_SelectedName = null;
  881. CS$<>8__locals1.$VB$Local_SelectedId = null;
  882. if ((CS$<>8__locals1.$VB$Local_LoginJson["selectedProfile"] == null || Data.Input._IdentifierMap) && Enumerable.Count<JToken>(CS$<>8__locals1.$VB$Local_LoginJson["availableProfiles"]) > 1)
  883. {
  884. flag = true;
  885. string right = Conversions.ToString(ModBase.m_IdentifierRepository.Get("Cache" + Data.Input.m_SerializerMap + "Uuid", null));
  886. try
  887. {
  888. foreach (JToken jtoken in CS$<>8__locals1.$VB$Local_LoginJson["availableProfiles"])
  889. {
  890. if (Operators.CompareString(jtoken["id"].ToString(), right, false) == 0)
  891. {
  892. CS$<>8__locals1.$VB$Local_SelectedName = jtoken["name"].ToString();
  893. CS$<>8__locals1.$VB$Local_SelectedId = jtoken["id"].ToString();
  894. ModLaunch.McLaunchLog("根据缓存选择的角色:" + CS$<>8__locals1.$VB$Local_SelectedName);
  895. }
  896. }
  897. }
  898. finally
  899. {
  900. IEnumerator<JToken> enumerator;
  901. if (enumerator != null)
  902. {
  903. enumerator.Dispose();
  904. }
  905. }
  906. if (CS$<>8__locals1.$VB$Local_SelectedName == null)
  907. {
  908. ModLaunch.McLaunchLog("要求玩家选择角色");
  909. ModBase.RunInUiWait(delegate()
  910. {
  911. List<IMyRadio> list = new List<IMyRadio>();
  912. List<JToken> list2 = new List<JToken>();
  913. try
  914. {
  915. foreach (JToken jtoken2 in CS$<>8__locals1.$VB$Local_LoginJson["availableProfiles"])
  916. {
  917. list.Add(new MyRadioBox
  918. {
  919. Text = jtoken2["name"].ToString()
  920. });
  921. list2.Add(jtoken2);
  922. }
  923. }
  924. finally
  925. {
  926. IEnumerator<JToken> enumerator2;
  927. if (enumerator2 != null)
  928. {
  929. enumerator2.Dispose();
  930. }
  931. }
  932. int value = ModMain.MyMsgBoxSelect(list, "选择使用的角色", "确定", "", false).Value;
  933. CS$<>8__locals1.$VB$Local_SelectedName = list2[value]["name"].ToString();
  934. CS$<>8__locals1.$VB$Local_SelectedId = list2[value]["id"].ToString();
  935. });
  936. ModLaunch.McLaunchLog("玩家选择的角色:" + CS$<>8__locals1.$VB$Local_SelectedName);
  937. }
  938. }
  939. else
  940. {
  941. CS$<>8__locals1.$VB$Local_SelectedName = CS$<>8__locals1.$VB$Local_LoginJson["selectedProfile"]["name"].ToString();
  942. CS$<>8__locals1.$VB$Local_SelectedId = CS$<>8__locals1.$VB$Local_LoginJson["selectedProfile"]["id"].ToString();
  943. }
  944. Data.Output._StateMap = CS$<>8__locals1.$VB$Local_LoginJson["accessToken"].ToString();
  945. Data.Output._CallbackMap = CS$<>8__locals1.$VB$Local_LoginJson["clientToken"].ToString();
  946. Data.Output.Name = CS$<>8__locals1.$VB$Local_SelectedName;
  947. Data.Output.m_InstanceMap = CS$<>8__locals1.$VB$Local_SelectedId;
  948. Data.Output.Type = Data.Input.m_SerializerMap;
  949. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Access", Data.Output._StateMap, false, null);
  950. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Client", Data.Output._CallbackMap, false, null);
  951. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Uuid", Data.Output.m_InstanceMap, false, null);
  952. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Name", Data.Output.Name, false, null);
  953. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Username", Data.Input.m_IssuerMap, false, null);
  954. ModBase.m_IdentifierRepository.Set("Cache" + Data.Input.m_SerializerMap + "Pass", Data.Input._IndexerMap, false, null);
  955. ModLaunch.McLaunchLog("登录成功(Login, " + Data.Input.m_SerializerMap + ")");
  956. result = flag;
  957. }
  958. catch (Exception ex)
  959. {
  960. string exceptionSummary = ModBase.GetExceptionSummary(ex);
  961. ModBase.Log(ex, "登录失败原始错误信息", ModBase.LogLevel.Normal, "出现错误");
  962. if (ex is ModNet.ResponsedWebException)
  963. {
  964. string text = null;
  965. try
  966. {
  967. text = Conversions.ToString(NewLateBinding.LateIndexGet(ModBase.GetJson(((ModNet.ResponsedWebException)ex).GetMapper()), new object[]
  968. {
  969. "errorMessage"
  970. }, null));
  971. }
  972. catch (Exception ex2)
  973. {
  974. }
  975. if (!string.IsNullOrWhiteSpace(text))
  976. {
  977. if (text.Contains("密码错误") || text.ContainsF("Incorrect username or password", true))
  978. {
  979. ModLaunch.McLaunchLog("密码错误,退出登录");
  980. ModLaunch.McLoginType type = Data.Input.Type;
  981. if (type != ModLaunch.McLoginType.Nide)
  982. {
  983. if (type == ModLaunch.McLoginType.Auth)
  984. {
  985. ModBase.RunInUi(new Action(PageLoginAuthSkin.ExitLogin), false);
  986. }
  987. }
  988. else
  989. {
  990. ModBase.RunInUi(new Action(PageLoginNideSkin.ExitLogin), false);
  991. }
  992. }
  993. throw new Exception("$登录失败:" + text);
  994. }
  995. }
  996. if (exceptionSummary.Contains("403"))
  997. {
  998. ModLaunch.McLoginType type2 = Data.Input.Type;
  999. if (type2 == ModLaunch.McLoginType.Nide)
  1000. {
  1001. throw new Exception("$登录失败,以下为可能的原因:\r\n - 输入的账号或密码错误。\r\n - 密码错误次数过多,导致被暂时屏蔽。请不要操作,等待 10 分钟后再试。\r\n" + (Data.Input.m_IssuerMap.Contains("@") ? "" : " - 登录账号应为邮箱或统一通行证账号,而非游戏角色 ID。\r\n") + " - 只注册了账号,但没有加入对应服务器。");
  1002. }
  1003. if (type2 == ModLaunch.McLoginType.Auth)
  1004. {
  1005. throw new Exception("$登录失败,以下为可能的原因:\r\n - 输入的账号或密码错误。\r\n - 登录尝试过于频繁,导致被暂时屏蔽。请不要操作,等待 10 分钟后再试。\r\n - 只注册了账号,但没有在皮肤站新建角色。");
  1006. }
  1007. result = false;
  1008. }
  1009. else
  1010. {
  1011. if (exceptionSummary.Contains("超时") || exceptionSummary.Contains("imeout") || exceptionSummary.Contains("网络请求失败"))
  1012. {
  1013. throw new Exception("$登录失败:连接登录服务器超时。\r\n请检查你的网络状况是否良好,或尝试使用 VPN!");
  1014. }
  1015. if (ex.Message.StartsWithF("$", false))
  1016. {
  1017. throw;
  1018. }
  1019. throw new Exception("登录失败:" + ex.Message, ex);
  1020. }
  1021. }
  1022. return result;
  1023. }
  1024. // Token: 0x06000E0F RID: 3599 RVA: 0x00062940 File Offset: 0x00060B40
  1025. private static string[] MsLoginStep1New(ModLoader.LoaderTask<ModLaunch.McLoginMs, ModLaunch.McLoginResult> Data)
  1026. {
  1027. ModMain.MyMsgBoxConverter myMsgBoxConverter;
  1028. do
  1029. {
  1030. ModLaunch.McLaunchLog("开始微软登录步骤 1/6(原始登录)");
  1031. JObject jobject = (JObject)ModBase.GetJson(ModNet.NetRequestRetry("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST", string.Format("client_id={0}&tenant=/consumers&scope=XboxLive.signin%20offline_access", "fe72edc2-3a6f-4280-90e8-e2beb64ce7e1"), "application/x-www-form-urlencoded", true, null));
  1032. ModLaunch.McLaunchLog("网页登录地址:" + jobject["verification_uri"].ToString());
  1033. myMsgBoxConverter = new ModMain.MyMsgBoxConverter
  1034. {
  1035. m_CollectionMap = jobject,
  1036. m_PolicyMap = true,
  1037. Type = ModMain.MyMsgBoxType.Login
  1038. };
  1039. ModMain.m_DispatcherIterator.Add(myMsgBoxConverter);
  1040. while (myMsgBoxConverter.schemaMap == null)
  1041. {
  1042. Thread.Sleep(100);
  1043. }
  1044. if (!(myMsgBoxConverter.schemaMap is ModBase.RestartException))
  1045. {
  1046. goto IL_159;
  1047. }
  1048. }
  1049. while (ModMain.MyMsgBox(string.Format("请在登录时选择 {0}其他登录方法{1},然后选择 {2}使用我的密码{3}。{4}如果没有该选项,请选择 {5}设置密码{6},设置完毕后再登录。", new object[]
  1050. {
  1051. ModBase.callbackRepository,
  1052. ModBase.m_TemplateRepository,
  1053. ModBase.callbackRepository,
  1054. ModBase.m_TemplateRepository,
  1055. "\r\n",
  1056. ModBase.callbackRepository,
  1057. ModBase.m_TemplateRepository
  1058. }), "需要使用密码登录", "重新登录", "设置密码", "取消", false, true, false, null, (ModLaunch._Closure$__.$I37-0 == null) ? (ModLaunch._Closure$__.$I37-0 = delegate()
  1059. {
  1060. ModBase.OpenWebsite("https://account.live.com/password/Change");
  1061. }) : ModLaunch._Closure$__.$I37-0, null) == 1);
  1062. throw new Exception("$$");
  1063. IL_159:
  1064. if (myMsgBoxConverter.schemaMap is Exception)
  1065. {
  1066. throw (Exception)myMsgBoxConverter.schemaMap;
  1067. }
  1068. return (string[])myMsgBoxConverter.schemaMap;
  1069. }
  1070. // Token: 0x06000E10 RID: 3600 RVA: 0x00062ACC File Offset: 0x00060CCC
  1071. private static string[] smethod_0(string Code)
  1072. {
  1073. ModLaunch.McLaunchLog("开始微软登录步骤 1/6(刷新登录)");
  1074. string data;
  1075. try
  1076. {
  1077. data = Conversions.ToString(ModNet.NetRequestMultiple("https://login.live.com/oauth20_token.srf", "POST", string.Format("client_id={0}&refresh_token={1}&grant_type=refresh_token&scope=XboxLive.signin%20offline_access", "fe72edc2-3a6f-4280-90e8-e2beb64ce7e1", Uri.EscapeDataString(Code)), "application/x-www-form-urlencoded", 2, null, true));
  1078. }
  1079. catch (Exception ex)
  1080. {
  1081. if (!ex.Message.Contains("must sign in again") && (!ex.Message.Contains("refresh_token") || !ex.Message.Contains("is not valid")))
  1082. {
  1083. throw;
  1084. }
  1085. return new string[]
  1086. {
  1087. "Relogin",
  1088. ""
  1089. };
  1090. }
  1091. JObject jobject = (JObject)ModBase.GetJson(data);
  1092. string text = jobject["access_token"].ToString();
  1093. string text2 = jobject["refresh_token"].ToString();
  1094. return new string[]
  1095. {
  1096. text,
  1097. text2
  1098. };
  1099. }
  1100. // Token: 0x06000E11 RID: 3601 RVA: 0x00062BC4 File Offset: 0x00060DC4
  1101. private static string MsLoginStep2(string AccessToken)
  1102. {
  1103. ModLaunch.McLaunchLog("开始微软登录步骤 2/6");
  1104. string data = "{\r\n \"Properties\": {\r\n \"AuthMethod\": \"RPS\",\r\n \"SiteName\": \"user.auth.xboxlive.com\",\r\n \"RpsTicket\": \"" + (AccessToken.StartsWithF("d=", false) ? "" : "d=") + AccessToken + "\"\r\n },\r\n \"RelyingParty\": \"http://auth.xboxlive.com\",\r\n \"TokenType\": \"JWT\"\r\n }";
  1105. return ((JObject)ModBase.GetJson(Conversions.ToString(ModNet.NetRequestMultiple("https://user.auth.xboxlive.com/user/authenticate", "POST", data, "application/json", 3, null, true))))["Token"].ToString();
  1106. }
  1107. // Token: 0x06000E12 RID: 3602 RVA: 0x00062C3C File Offset: 0x00060E3C
  1108. private static string[] MsLoginStep3(string XBLToken)
  1109. {
  1110. ModLaunch.McLaunchLog("开始微软登录步骤 3/6");
  1111. string data = "{\r\n \"Properties\": {\r\n \"SandboxId\": \"RETAIL\",\r\n \"UserTokens\": [\r\n \"" + XBLToken + "\"\r\n ]\r\n },\r\n \"RelyingParty\": \"rp://api.minecraftservices.com/\",\r\n \"TokenType\": \"JWT\"\r\n }";
  1112. string data2;
  1113. try
  1114. {
  1115. data2 = Conversions.ToString(ModNet.NetRequestMultiple("https://xsts.auth.xboxlive.com/xsts/authorize", "POST", data, "application/json", 3, null, true));
  1116. }
  1117. catch (WebException ex)
  1118. {
  1119. if (ex.Message.Contains("2148916227"))
  1120. {
  1121. ModMain.MyMsgBox("该账号似乎已被微软封禁,无法登录。", "登录失败", "我知道了", "", "", true, true, false, null, null, null);
  1122. throw new Exception("$$");
  1123. }
  1124. if (ex.Message.Contains("2148916233"))
  1125. {
  1126. if (ModMain.MyMsgBox("你尚未注册 Xbox 账户,请在注册后再登录。", "登录提示", "注册", "取消", "", false, true, false, null, null, null) == 1)
  1127. {
  1128. ModBase.OpenWebsite("https://signup.live.com/signup");
  1129. }
  1130. throw new Exception("$$");
  1131. }
  1132. if (ex.Message.Contains("2148916235"))
  1133. {
  1134. ModMain.MyMsgBox(string.Format("你的网络所在的国家或地区无法登录微软账号。{0}请尝试使用加速器或 VPN。", "\r\n"), "登录失败", "我知道了", "", "", false, true, false, null, null, null);
  1135. throw new Exception("$$");
  1136. }
  1137. if (ex.Message.Contains("2148916238"))
  1138. {
  1139. if (ModMain.MyMsgBox("该账号年龄不足,你需要先修改出生日期,然后才能登录。\r\n该账号目前填写的年龄是否在 13 岁以上?", "登录提示", "13 岁以上", "12 岁以下", "我不知道", false, true, false, null, null, null) == 1)
  1140. {
  1141. ModBase.OpenWebsite("https://account.live.com/editprof.aspx");
  1142. ModMain.MyMsgBox("请在打开的网页中修改账号的出生日期(至少改为 18 岁以上)。\r\n在修改成功后等待一分钟,然后再回到 PCL,就可以正常登录了!", "登录提示", "确定", "", "", false, true, false, null, null, null);
  1143. }
  1144. else
  1145. {
  1146. ModBase.OpenWebsite("https://support.microsoft.com/zh-cn/account-billing/如何更改-microsoft-帐户上的出生日期-837badbc-999e-54d2-2617-d19206b9540a");
  1147. ModMain.MyMsgBox("请根据打开的网页的说明,修改账号的出生日期(至少改为 18 岁以上)。\r\n在修改成功后等待一分钟,然后再回到 PCL,就可以正常登录了!", "登录提示", "确定", "", "", false, true, false, null, null, null);
  1148. }
  1149. throw new Exception("$$");
  1150. }
  1151. throw;
  1152. }
  1153. JObject jobject = (JObject)ModBase.GetJson(data2);
  1154. string text = jobject["Token"].ToString();
  1155. string text2 = jobject["DisplayClaims"]["xui"][0]["uhs"].ToString();
  1156. return new string[]
  1157. {
  1158. text,
  1159. text2
  1160. };
  1161. }
  1162. // Token: 0x06000E13 RID: 3603 RVA: 0x00062E90 File Offset: 0x00061090
  1163. private static string MsLoginStep4(string[] Tokens)
  1164. {
  1165. ModLaunch.McLaunchLog("开始微软登录步骤 4/6");
  1166. string data = new JObject(new JProperty("identityToken", string.Format("XBL3.0 x={0};{1}", Tokens[1], Tokens[0]))).ToString(0, new JsonConverter[0]);
  1167. string data2;
  1168. try
  1169. {
  1170. data2 = ModNet.NetRequestRetry("https://api.minecraftservices.com/authentication/login_with_xbox", "POST", data, "application/json", true, null);
  1171. }
  1172. catch (WebException ex)
  1173. {
  1174. string exceptionSummary = ModBase.GetExceptionSummary(ex);
  1175. if (exceptionSummary.Contains("(429)"))
  1176. {
  1177. ModBase.Log(ex, "微软登录第 5 步汇报 429", ModBase.LogLevel.Debug, "出现错误");
  1178. throw new Exception("$登录尝试太过频繁,请等待几分钟后再试!");
  1179. }
  1180. if (exceptionSummary.Contains("(403)"))
  1181. {
  1182. ModBase.Log(ex, "微软登录第 5 步汇报 403", ModBase.LogLevel.Debug, "出现错误");
  1183. throw new Exception("$当前 IP 的登录尝试异常。\r\n如果你使用了 VPN 或加速器,请把它们关掉或更换节点后再试!");
  1184. }
  1185. throw;
  1186. }
  1187. return ((JObject)ModBase.GetJson(data2))["access_token"].ToString();
  1188. }
  1189. // Token: 0x06000E14 RID: 3604 RVA: 0x00062F7C File Offset: 0x0006117C
  1190. private static void MsLoginStep5(string AccessToken)
  1191. {
  1192. ModLaunch.McLaunchLog("开始微软登录步骤 5/6");
  1193. string text = Conversions.ToString(ModNet.NetRequestMultiple("https://api.minecraftservices.com/entitlements/mcstore", "GET", "", "application/json", 2, new Dictionary<string, string>
  1194. {
  1195. {
  1196. "Authorization",
  1197. "Bearer " + AccessToken
  1198. }
  1199. }, true));
  1200. try
  1201. {
  1202. JObject jobject = (JObject)ModBase.GetJson(text);
  1203. if (!jobject.ContainsKey("items") || !Enumerable.Any<JToken>(jobject["items"]))
  1204. {
  1205. int num = ModMain.MyMsgBox("你尚未购买正版 Minecraft,或者 Xbox Game Pass 已到期。", "登录失败", "购买 Minecraft", "取消", "", false, true, false, null, null, null);
  1206. if (num == 1)
  1207. {
  1208. ModBase.OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj");
  1209. }
  1210. throw new Exception("$$");
  1211. }
  1212. }
  1213. catch (Exception ex)
  1214. {
  1215. ModBase.Log(ex, "微软登录第 6 步异常:" + text, ModBase.LogLevel.Debug, "出现错误");
  1216. throw;
  1217. }
  1218. }
  1219. // Token: 0x06000E15 RID: 3605 RVA: 0x0006306C File Offset: 0x0006126C
  1220. private static string[] MsLoginStep6(string AccessToken)
  1221. {
  1222. ModLaunch.McLaunchLog("开始微软登录步骤 6/6");
  1223. string text;
  1224. try
  1225. {
  1226. text = Conversions.ToString(ModNet.NetRequestMultiple("https://api.minecraftservices.com/minecraft/profile", "GET", "", "application/json", 2, new Dictionary<string, string>
  1227. {
  1228. {
  1229. "Authorization",
  1230. "Bearer " + AccessToken
  1231. }
  1232. }, true));
  1233. }
  1234. catch (WebException ex)
  1235. {
  1236. string exceptionSummary = ModBase.GetExceptionSummary(ex);
  1237. if (exceptionSummary.Contains("(429)"))
  1238. {
  1239. ModBase.Log(ex, "微软登录第 7 步汇报 429", ModBase.LogLevel.Debug, "出现错误");
  1240. throw new Exception("$登录尝试太过频繁,请等待几分钟后再试!");
  1241. }
  1242. if (exceptionSummary.Contains("(404)"))
  1243. {
  1244. ModBase.Log(ex, "微软登录第 7 步汇报 404", ModBase.LogLevel.Debug, "出现错误");
  1245. ModBase.RunInNewThread((ModLaunch._Closure$__.$I43-0 == null) ? (ModLaunch._Closure$__.$I43-0 = delegate()
  1246. {
  1247. int num = ModMain.MyMsgBox("请先创建 Minecraft 玩家档案,然后再重新登录。", "登录失败", "创建档案", "取消", "", false, true, false, null, null, null);
  1248. if (num == 1)
  1249. {
  1250. ModBase.OpenWebsite("https://www.minecraft.net/zh-hans/msaprofile/mygames/editprofile");
  1251. }
  1252. }) : ModLaunch._Closure$__.$I43-0, "Login Failed: Create Profile", ThreadPriority.Normal);
  1253. throw new Exception("$$");
  1254. }
  1255. throw;
  1256. }
  1257. JObject jobject = (JObject)ModBase.GetJson(text);
  1258. string text2 = jobject["id"].ToString();
  1259. string text3 = jobject["name"].ToString();
  1260. return new string[]
  1261. {
  1262. text2,
  1263. text3,
  1264. text
  1265. };
  1266. }
  1267. // Token: 0x06000E16 RID: 3606 RVA: 0x000631A8 File Offset: 0x000613A8
  1268. private static string McLoginLegacyUuidWithCustomSkin(string UserName, int SkinType, string SkinName)
  1269. {
  1270. string text = Conversions.ToString(ModLaunch.McLoginLegacyUuid(UserName));
  1271. checked
  1272. {
  1273. switch (SkinType)
  1274. {
  1275. case 0:
  1276. return text;
  1277. case 1:
  1278. while (Operators.CompareString(ModMinecraft.McSkinSex(text), "Steve", false) != 0)
  1279. {
  1280. if (text.EndsWithF("FFFFF", false))
  1281. {
  1282. text = text.Substring(0, 27) + "00000";
  1283. }
  1284. text = text.Substring(0, 27) + (long.Parse(text.Substring(27), NumberStyles.AllowHexSpecifier) + 1L).ToString("X").PadLeft(5, '0');
  1285. }
  1286. return text;
  1287. case 2:
  1288. while (Operators.CompareString(ModMinecraft.McSkinSex(text), "Alex", false) != 0)
  1289. {
  1290. if (text.EndsWithF("FFFFF", false))
  1291. {
  1292. text = text.Substring(0, 27) + "00000";
  1293. }
  1294. text = text.Substring(0, 27) + (long.Parse(text.Substring(27), NumberStyles.AllowHexSpecifier) + 1L).ToString("X").PadLeft(5, '0');
  1295. }
  1296. return text;
  1297. case 3:
  1298. try
  1299. {
  1300. if (Operators.CompareString(SkinName, "", false) != 0 && ModMinecraft.AddClient().Version._ServerMap < 20)
  1301. {
  1302. ModBase.Log("[Skin] 由于离线皮肤设置,使用正版 UUID:" + SkinName, ModBase.LogLevel.Normal, "出现错误");
  1303. text = Conversions.ToString(ModLaunch.McLoginMojangUuid(SkinName, false));
  1304. }
  1305. return text;
  1306. }
  1307. catch (Exception ex)
  1308. {
  1309. ModBase.Log(ex, "离线启动时使用的正版皮肤获取失败", ModBase.LogLevel.Debug, "出现错误");
  1310. ModMain.MyMsgBox("由于设置的离线启动时使用的正版皮肤获取失败,游戏将以无皮肤的方式启动。\r\n请检查你的网络是否通畅,或尝试使用 VPN!\r\n\r\n详细的错误信息:" + ex.Message, "皮肤获取失败", "确定", "", "", false, true, false, null, null, null);
  1311. return text;
  1312. }
  1313. break;
  1314. case 4:
  1315. break;
  1316. default:
  1317. return text;
  1318. }
  1319. while (Operators.CompareString(ModMinecraft.McSkinSex(text), (!Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("LaunchSkinSlim", null))) ? "Steve" : "Alex", false) != 0)
  1320. {
  1321. if (text.EndsWithF("FFFFF", false))
  1322. {
  1323. text = text.Substring(0, 27) + "00000";
  1324. }
  1325. text = text.Substring(0, 27) + (long.Parse(text.Substring(27), NumberStyles.AllowHexSpecifier) + 1L).ToString("X").PadLeft(5, '0');
  1326. }
  1327. return text;
  1328. }
  1329. }
  1330. // Token: 0x06000E17 RID: 3607 RVA: 0x00063420 File Offset: 0x00061620
  1331. public static object McLoginMojangUuid(string Name, bool ThrowOnNotFound)
  1332. {
  1333. object result;
  1334. if (Name.Trim().Length == 0)
  1335. {
  1336. result = ModBase.StrFill("", "0", 32);
  1337. }
  1338. else
  1339. {
  1340. string text = ModBase.ReadIni(ModBase.m_DecoratorRepository + "Cache\\Uuid\\Mojang.ini", Name, "");
  1341. if (Strings.Len(text) == 32)
  1342. {
  1343. result = text;
  1344. }
  1345. else
  1346. {
  1347. try
  1348. {
  1349. JObject jobject = (JObject)ModNet.NetGetCodeByRequestRetry("https://api.mojang.com/users/profiles/minecraft/" + Name, null, "", true, null, false);
  1350. if (jobject == null)
  1351. {
  1352. throw new FileNotFoundException("正版玩家档案不存在(" + Name + ")");
  1353. }
  1354. text = (string)(jobject["id"] ?? "");
  1355. }
  1356. catch (Exception ex)
  1357. {
  1358. ModBase.Log(ex, "从官网获取正版 Uuid 失败(" + Name + ")", ModBase.LogLevel.Debug, "出现错误");
  1359. if (ThrowOnNotFound || Operators.CompareString(ex.GetType().Name, "FileNotFoundException", false) != 0)
  1360. {
  1361. throw new Exception("从官网获取正版 Uuid 失败", ex);
  1362. }
  1363. text = Conversions.ToString(ModLaunch.McLoginLegacyUuid(Name));
  1364. }
  1365. if (Strings.Len(text) != 32)
  1366. {
  1367. throw new Exception("获取的正版 Uuid 长度不足(" + text + ")");
  1368. }
  1369. ModBase.WriteIni(ModBase.m_DecoratorRepository + "Cache\\Uuid\\Mojang.ini", Name, text);
  1370. result = text;
  1371. }
  1372. }
  1373. return result;
  1374. }
  1375. // Token: 0x06000E18 RID: 3608 RVA: 0x0006357C File Offset: 0x0006177C
  1376. public static object McLoginLegacyUuid(string Name)
  1377. {
  1378. string text = ModBase.StrFill(Name.Length.ToString("X"), "0", 16) + ModBase.StrFill(ModBase.GetHash(Name).ToString("X"), "0", 16);
  1379. return string.Concat(new string[]
  1380. {
  1381. text.Substring(0, 12),
  1382. "3",
  1383. text.Substring(13, 3),
  1384. "9",
  1385. text.Substring(17, 15)
  1386. });
  1387. }
  1388. // Token: 0x06000E19 RID: 3609 RVA: 0x00063610 File Offset: 0x00061810
  1389. private static void McLaunchJava(ModLoader.LoaderTask<int, int> Task)
  1390. {
  1391. Version version = new Version(0, 0, 0, 0);
  1392. Version version2 = new Version(999, 999, 999, 999);
  1393. if ((DateTime.Compare(ModMinecraft.AddClient()._RegistryMap, new DateTime(2024, 4, 2)) >= 0 && ModMinecraft.AddClient().Version._ServerMap == 99) || (ModMinecraft.AddClient().Version._ServerMap > 20 && ModMinecraft.AddClient().Version._ServerMap != 99) || (ModMinecraft.AddClient().Version._ServerMap == 20 && ModMinecraft.AddClient().Version.m_ResolverMap >= 5))
  1394. {
  1395. version = new Version(1, 21, 0, 0);
  1396. }
  1397. else if ((DateTime.Compare(ModMinecraft.AddClient()._RegistryMap, new DateTime(2021, 11, 16)) >= 0 && ModMinecraft.AddClient().Version._ServerMap == 99) || (ModMinecraft.AddClient().Version._ServerMap >= 18 && ModMinecraft.AddClient().Version._ServerMap != 99))
  1398. {
  1399. version = new Version(1, 17, 0, 0);
  1400. }
  1401. else if ((DateTime.Compare(ModMinecraft.AddClient()._RegistryMap, new DateTime(2021, 5, 11)) >= 0 && ModMinecraft.AddClient().Version._ServerMap == 99) || (ModMinecraft.AddClient().Version._ServerMap >= 17 && ModMinecraft.AddClient().Version._ServerMap != 99))
  1402. {
  1403. version = new Version(1, 16, 0, 0);
  1404. }
  1405. else if (ModMinecraft.AddClient()._RegistryMap.Year >= 2017)
  1406. {
  1407. version = new Version(1, 8, 0, 0);
  1408. }
  1409. else if (DateTime.Compare(ModMinecraft.AddClient()._RegistryMap, new DateTime(2013, 5, 1)) <= 0 && ModMinecraft.AddClient()._RegistryMap.Year >= 2001)
  1410. {
  1411. version2 = new Version(1, 12, 999, 999);
  1412. }
  1413. if (ModMinecraft.AddClient().Version._StatusMap)
  1414. {
  1415. if (ModMinecraft.AddClient().Version._ServerMap <= 7 && ModMinecraft.AddClient().Version._ServerMap > 0)
  1416. {
  1417. version2 = new Version(1, 8, 999, 999);
  1418. }
  1419. else if (ModMinecraft.AddClient().Version._ServerMap >= 8 && ModMinecraft.AddClient().Version._ServerMap <= 11)
  1420. {
  1421. version = new Version(1, 8, 0, 0);
  1422. version2 = new Version(1, 8, 999, 999);
  1423. }
  1424. else if (ModMinecraft.AddClient().Version._ServerMap == 12)
  1425. {
  1426. version2 = new Version(1, 8, 999, 999);
  1427. }
  1428. }
  1429. if (ModMinecraft.AddClient().Version.m_StructMap)
  1430. {
  1431. if (Operators.CompareString(ModMinecraft.AddClient().Version._ConnectionMap, "1.7.2", false) == 0)
  1432. {
  1433. version = ((new Version(1, 7, 0, 0) > version) ? new Version(1, 7, 0, 0) : version);
  1434. version2 = ((new Version(1, 7, 999, 999) < version2) ? new Version(1, 7, 999, 999) : version2);
  1435. }
  1436. else if (ModMinecraft.AddClient().Version._ServerMap <= 12 && ModMinecraft.AddClient().Version._ServerMap > 0)
  1437. {
  1438. version2 = new Version(1, 8, 999, 999);
  1439. }
  1440. else if (ModMinecraft.AddClient().Version._ServerMap <= 14 && ModMinecraft.AddClient().Version._ServerMap >= 13)
  1441. {
  1442. version = ((new Version(1, 8, 0, 0) > version) ? new Version(1, 8, 0, 0) : version);
  1443. version2 = ((new Version(1, 10, 999, 999) < version2) ? new Version(1, 10, 999, 999) : version2);
  1444. }
  1445. else if (ModMinecraft.AddClient().Version._ServerMap == 15)
  1446. {
  1447. version = ((new Version(1, 8, 0, 0) > version) ? new Version(1, 8, 0, 0) : version);
  1448. version2 = ((new Version(1, 15, 999, 999) < version2) ? new Version(1, 15, 999, 999) : version2);
  1449. }
  1450. else if (ModMinecraft.VersionSortBoolean(ModMinecraft.AddClient().Version.printerMap, "34.0.0") && ModMinecraft.VersionSortBoolean("36.2.25", ModMinecraft.AddClient().Version.printerMap))
  1451. {
  1452. version2 = ((new Version(1, 8, 0, 320) < version2) ? new Version(1, 8, 0, 320) : version2);
  1453. }
  1454. else if (ModMinecraft.AddClient().Version._ServerMap >= 18 && ModMinecraft.AddClient().Version._ServerMap < 19 && ModMinecraft.AddClient().Version._StatusMap)
  1455. {
  1456. version2 = ((new Version(1, 18, 999, 999) < version2) ? new Version(1, 18, 999, 999) : version2);
  1457. }
  1458. }
  1459. if (ModMinecraft.AddClient().Version._CandidateMap)
  1460. {
  1461. if (ModMinecraft.AddClient().Version._ServerMap >= 15 && ModMinecraft.AddClient().Version._ServerMap <= 16 && ModMinecraft.AddClient().Version._ServerMap != -1)
  1462. {
  1463. version = ((new Version(1, 8, 0, 0) > version) ? new Version(1, 8, 0, 0) : version);
  1464. }
  1465. else if (ModMinecraft.AddClient().Version._ServerMap >= 18 && ModMinecraft.AddClient().Version._ServerMap < 99)
  1466. {
  1467. version = ((new Version(1, 17, 0, 0) > version) ? new Version(1, 17, 0, 0) : version);
  1468. }
  1469. }
  1470. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("LoginType", null), ModLaunch.McLoginType.Nide, false))
  1471. {
  1472. version = ((new Version(1, 8, 0, 141) > version) ? new Version(1, 8, 0, 141) : version);
  1473. }
  1474. object dispatcher = ModJava.m_Dispatcher;
  1475. ObjectFlowControl.CheckForSyncLockOnValueType(dispatcher);
  1476. lock (dispatcher)
  1477. {
  1478. ModLaunch.McLaunchLog("Java 版本需求:最低 " + version.ToString() + ",最高 " + version2.ToString());
  1479. ModLaunch.m_RecordTests = ModJava.JavaSelect("$$", version, version2, ModMinecraft.AddClient());
  1480. if (!Task.IsAborted)
  1481. {
  1482. if (ModLaunch.m_RecordTests != null)
  1483. {
  1484. ModLaunch.McLaunchLog("选择的 Java:" + ModLaunch.m_RecordTests.ToString());
  1485. }
  1486. else if (!Task.IsAborted)
  1487. {
  1488. ModLaunch.McLaunchLog("无合适的 Java,需要确认是否自动下载");
  1489. string text;
  1490. if (version >= new Version(1, 21, 0, 0))
  1491. {
  1492. text = Conversions.ToString(21);
  1493. if (!ModJava.JavaDownloadConfirm("Java 21", false))
  1494. {
  1495. throw new Exception("$$");
  1496. }
  1497. }
  1498. else if (version >= new Version(1, 9, 0, 0))
  1499. {
  1500. text = Conversions.ToString(17);
  1501. if (!ModJava.JavaDownloadConfirm("Java 17", false))
  1502. {
  1503. throw new Exception("$$");
  1504. }
  1505. }
  1506. else if (version2 < new Version(1, 8, 0, 0))
  1507. {
  1508. text = Conversions.ToString(7);
  1509. if (!ModJava.JavaDownloadConfirm("Java 7", true))
  1510. {
  1511. throw new Exception("$$");
  1512. }
  1513. }
  1514. else if (version > new Version(1, 8, 0, 140) && version2 < new Version(1, 8, 0, 321))
  1515. {
  1516. text = "8u141";
  1517. if (!ModJava.JavaDownloadConfirm("Java 8.0.141 ~ 8.0.320", true))
  1518. {
  1519. throw new Exception("$$");
  1520. }
  1521. }
  1522. else if (version > new Version(1, 8, 0, 140))
  1523. {
  1524. text = "8u141";
  1525. if (!ModJava.JavaDownloadConfirm("Java 8.0.141 或更高版本的 Java 8", true))
  1526. {
  1527. throw new Exception("$$");
  1528. }
  1529. }
  1530. else if (version2 < new Version(1, 8, 0, 321))
  1531. {
  1532. text = Conversions.ToString(8);
  1533. if (!ModJava.JavaDownloadConfirm("Java 8.0.320 或更低版本的 Java 8", false))
  1534. {
  1535. throw new Exception("$$");
  1536. }
  1537. }
  1538. else
  1539. {
  1540. text = Conversions.ToString(8);
  1541. if (!ModJava.JavaDownloadConfirm("Java 8", false))
  1542. {
  1543. throw new Exception("$$");
  1544. }
  1545. }
  1546. ModLoader.LoaderCombo<int> loaderCombo = ModJava.JavaFixLoaders(Conversions.ToInteger(text));
  1547. try
  1548. {
  1549. loaderCombo.Start(text, true);
  1550. while (loaderCombo.State == ModBase.LoadState.Loading && !Task.IsAborted)
  1551. {
  1552. Task.Progress = loaderCombo.Progress;
  1553. Thread.Sleep(10);
  1554. }
  1555. }
  1556. finally
  1557. {
  1558. loaderCombo.Abort();
  1559. }
  1560. if (ModJava._Process.State != ModBase.LoadState.Loading)
  1561. {
  1562. ModJava._Process.State = ModBase.LoadState.Waiting;
  1563. }
  1564. ModLaunch.m_RecordTests = ModJava.JavaSelect("$$", version, version2, ModMinecraft.AddClient());
  1565. if (!Task.IsAborted)
  1566. {
  1567. if (ModLaunch.m_RecordTests == null)
  1568. {
  1569. ModMain.Hint("没有可用的 Java,已取消启动!", ModMain.HintType.Critical, true);
  1570. throw new Exception("$$");
  1571. }
  1572. ModLaunch.McLaunchLog("选择的 Java:" + ModLaunch.m_RecordTests.ToString());
  1573. }
  1574. }
  1575. }
  1576. }
  1577. }
  1578. // Token: 0x06000E1A RID: 3610 RVA: 0x00063F18 File Offset: 0x00062118
  1579. public static string ExtractJavaWrapper()
  1580. {
  1581. string text = ModBase._MethodRepository + "JavaWrapper.jar";
  1582. ModBase.Log("[Java] 选定的 Java Wrapper 路径:" + text, ModBase.LogLevel.Normal, "出现错误");
  1583. object obj = ModLaunch.invocationTests;
  1584. ObjectFlowControl.CheckForSyncLockOnValueType(obj);
  1585. lock (obj)
  1586. {
  1587. try
  1588. {
  1589. ModBase.WriteFile(text, ModBase.GetResources("JavaWrapper"), false);
  1590. }
  1591. catch (Exception ex)
  1592. {
  1593. if (File.Exists(text))
  1594. {
  1595. ModBase.Log(ex, "Java Wrapper 文件释放失败,但文件已存在,将在删除后尝试重新生成", ModBase.LogLevel.Developer, "出现错误");
  1596. try
  1597. {
  1598. File.Delete(text);
  1599. ModBase.WriteFile(text, ModBase.GetResources("JavaWrapper"), false);
  1600. goto IL_F3;
  1601. }
  1602. catch (Exception ex2)
  1603. {
  1604. ModBase.Log(ex2, "Java Wrapper 文件重新释放失败,将尝试更换文件名重新生成", ModBase.LogLevel.Developer, "出现错误");
  1605. text = ModBase._MethodRepository + "JavaWrapper2.jar";
  1606. try
  1607. {
  1608. ModBase.WriteFile(text, ModBase.GetResources("JavaWrapper"), false);
  1609. }
  1610. catch (Exception innerException)
  1611. {
  1612. throw new FileNotFoundException("释放 Java Wrapper 最终尝试失败", innerException);
  1613. }
  1614. goto IL_F3;
  1615. }
  1616. goto IL_E7;
  1617. IL_F3:
  1618. return text;
  1619. }
  1620. IL_E7:
  1621. throw new FileNotFoundException("释放 Java Wrapper 失败", ex);
  1622. }
  1623. }
  1624. return text;
  1625. }
  1626. // Token: 0x06000E1B RID: 3611 RVA: 0x00064060 File Offset: 0x00062260
  1627. private static void McLaunchArgumentMain(ModLoader.LoaderTask<string, List<ModMinecraft.McLibToken>> Loader)
  1628. {
  1629. ModLaunch.McLaunchLog("开始获取 Minecraft 启动参数");
  1630. string text;
  1631. if (ModMinecraft.AddClient().NewThread()["arguments"] != null && ModMinecraft.AddClient().NewThread()["arguments"]["jvm"] != null)
  1632. {
  1633. ModLaunch.McLaunchLog("获取新版 JVM 参数");
  1634. text = ModLaunch.McLaunchArgumentsJvmNew(ModMinecraft.AddClient());
  1635. ModLaunch.McLaunchLog("新版 JVM 参数获取成功:");
  1636. ModLaunch.McLaunchLog(text);
  1637. }
  1638. else
  1639. {
  1640. ModLaunch.McLaunchLog("获取旧版 JVM 参数");
  1641. text = ModLaunch.McLaunchArgumentsJvmOld(ModMinecraft.AddClient());
  1642. ModLaunch.McLaunchLog("旧版 JVM 参数获取成功:");
  1643. ModLaunch.McLaunchLog(text);
  1644. }
  1645. if (!string.IsNullOrEmpty((string)ModMinecraft.AddClient().NewThread()["minecraftArguments"]))
  1646. {
  1647. ModLaunch.McLaunchLog("获取旧版 Game 参数");
  1648. text = text + " " + ModLaunch.McLaunchArgumentsGameOld(ModMinecraft.AddClient());
  1649. ModLaunch.McLaunchLog("旧版 Game 参数获取成功");
  1650. }
  1651. if (ModMinecraft.AddClient().NewThread()["arguments"] != null && ModMinecraft.AddClient().NewThread()["arguments"]["game"] != null)
  1652. {
  1653. ModLaunch.McLaunchLog("获取新版 Game 参数");
  1654. text = text + " " + ModLaunch.McLaunchArgumentsGameNew(ModMinecraft.AddClient());
  1655. ModLaunch.McLaunchLog("新版 Game 参数获取成功");
  1656. }
  1657. Dictionary<string, string> dictionary = ModLaunch.McLaunchArgumentsReplace(ModMinecraft.AddClient(), ref Loader);
  1658. if (string.IsNullOrWhiteSpace(dictionary["${version_type}"]))
  1659. {
  1660. text = text.Replace(" --versionType ${version_type}", "");
  1661. dictionary["${version_type}"] = "\"\"";
  1662. }
  1663. try
  1664. {
  1665. foreach (KeyValuePair<string, string> keyValuePair in dictionary)
  1666. {
  1667. text = text.Replace(keyValuePair.Key, (keyValuePair.Value.Contains(" ") || keyValuePair.Value.Contains(":\\")) ? ("\"" + keyValuePair.Value + "\"") : keyValuePair.Value);
  1668. }
  1669. }
  1670. finally
  1671. {
  1672. Dictionary<string, string>.Enumerator enumerator;
  1673. ((IDisposable)enumerator).Dispose();
  1674. }
  1675. text = text.Replace(" -Dos.name=Windows 10", " -Dos.name=\"Windows 10\"");
  1676. if (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("LaunchArgumentWindowType", null), 0, false))
  1677. {
  1678. text += " --fullscreen";
  1679. }
  1680. try
  1681. {
  1682. foreach (string text2 in ModLaunch.filterTests._HelperMap)
  1683. {
  1684. text = text + " " + text2.Trim();
  1685. }
  1686. }
  1687. finally
  1688. {
  1689. List<string>.Enumerator enumerator2;
  1690. ((IDisposable)enumerator2).Dispose();
  1691. }
  1692. string text3 = Conversions.ToString(string.IsNullOrEmpty(ModLaunch.filterTests.m_MockMap) ? ModBase.m_IdentifierRepository.Get("VersionServerEnter", ModMinecraft.AddClient()) : ModLaunch.filterTests.m_MockMap);
  1693. if (text3.Length > 0)
  1694. {
  1695. if (DateTime.Compare(ModMinecraft.AddClient()._RegistryMap, new DateTime(2023, 4, 4)) > 0)
  1696. {
  1697. text += string.Format(" --quickPlayMultiplayer \"{0}\"", text3);
  1698. }
  1699. else
  1700. {
  1701. if (text3.Contains(":"))
  1702. {
  1703. text = string.Concat(new string[]
  1704. {
  1705. text,
  1706. " --server ",
  1707. text3.Split(":")[0],
  1708. " --port ",
  1709. text3.Split(":")[1]
  1710. });
  1711. }
  1712. else
  1713. {
  1714. text = text + " --server " + text3 + " --port 25565";
  1715. }
  1716. if (ModMinecraft.AddClient().Version._StatusMap)
  1717. {
  1718. ModMain.Hint("OptiFine 与自动进入服务器可能不兼容,有概率导致材质丢失甚至游戏崩溃!", ModMain.HintType.Critical, true);
  1719. }
  1720. }
  1721. }
  1722. string text4 = Conversions.ToString(ModBase.m_IdentifierRepository.Get("VersionAdvanceGame", ModMinecraft.AddClient()));
  1723. text = Conversions.ToString(Operators.AddObject(text, Operators.ConcatenateObject(" ", (Operators.CompareString(text4, "", false) == 0) ? ModBase.m_IdentifierRepository.Get("LaunchAdvanceGame", null) : text4)));
  1724. ModLaunch.McLaunchLog("Minecraft 启动参数:");
  1725. ModLaunch.McLaunchLog(text);
  1726. ModLaunch._ServiceTests = text;
  1727. }
  1728. // Token: 0x06000E1C RID: 3612 RVA: 0x00064460 File Offset: 0x00062660
  1729. private static string McLaunchArgumentsJvmOld(ModMinecraft.McVersion Version)
  1730. {
  1731. List<string> list = new List<string>();
  1732. list.Add("-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump");
  1733. string text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("VersionAdvanceJvm", ModMinecraft.AddClient()));
  1734. if (Operators.CompareString(text, "", false) == 0)
  1735. {
  1736. text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("LaunchAdvanceJvm", null));
  1737. }
  1738. if (!text.Contains("-Dlog4j2.formatMsgNoLookups=true"))
  1739. {
  1740. text += " -Dlog4j2.formatMsgNoLookups=true";
  1741. }
  1742. text = text.Replace(" -XX:MaxDirectMemorySize=256M", "");
  1743. list.Insert(0, text);
  1744. list.Add("-Xmn" + Conversions.ToString(Math.Floor(PageVersionSetup.GetRam(ModMinecraft.AddClient(), new bool?(!ModLaunch.m_RecordTests.producerRepository)) * 1024.0 * 0.15)) + "m");
  1745. list.Add("-Xmx" + Conversions.ToString(Math.Floor(PageVersionSetup.GetRam(ModMinecraft.AddClient(), new bool?(!ModLaunch.m_RecordTests.producerRepository)) * 1024.0)) + "m");
  1746. list.Add("\"-Djava.library.path=" + ModLaunch.GetNativesFolder() + "\"");
  1747. list.Add("-cp ${classpath}");
  1748. if (Operators.CompareString(ModLaunch.interceptorTests.Output.Type, "Nide", false) == 0)
  1749. {
  1750. list.Insert(0, Conversions.ToString(Operators.ConcatenateObject("-Dnide8auth.client=true -javaagent:\"" + ModBase.m_InstanceRepository + "nide8auth.jar\"=", ModBase.m_IdentifierRepository.Get("VersionServerNide", ModMinecraft.AddClient()))));
  1751. }
  1752. if (Operators.CompareString(ModLaunch.interceptorTests.Output.Type, "Auth", false) == 0)
  1753. {
  1754. string text2 = Conversions.ToString((ModLaunch.interceptorTests.Input.Type == ModLaunch.McLoginType.Legacy) ? "http://hiperauth.tech/api/yggdrasil-hiper/" : ModBase.m_IdentifierRepository.Get("VersionServerAuthServer", ModMinecraft.AddClient()));
  1755. try
  1756. {
  1757. string s = Conversions.ToString(ModNet.NetGetCodeByRequestRetry(text2, Encoding.UTF8, "", false, null, false));
  1758. list.Insert(0, string.Concat(new string[]
  1759. {
  1760. "-javaagent:\"",
  1761. ModBase._MethodRepository,
  1762. "authlib-injector.jar\"=",
  1763. text2,
  1764. " -Dauthlibinjector.side=client -Dauthlibinjector.yggdrasil.prefetched=",
  1765. Convert.ToBase64String(Encoding.UTF8.GetBytes(s))
  1766. }));
  1767. }
  1768. catch (Exception innerException)
  1769. {
  1770. throw new Exception("无法连接到第三方登录服务器(" + text2 + ")", innerException);
  1771. }
  1772. }
  1773. if (ModLaunch.m_RecordTests.PostTests() >= 9)
  1774. {
  1775. list.Add("--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED");
  1776. }
  1777. list.Add("-Doolloo.jlw.tmpdir=\"" + ModBase._MethodRepository.TrimEnd(new char[]
  1778. {
  1779. '\\'
  1780. }) + "\"");
  1781. list.Add("-jar \"" + ModLaunch.ExtractJavaWrapper() + "\"");
  1782. if (Version.NewThread()["mainClass"] == null)
  1783. {
  1784. throw new Exception("版本 json 中没有 mainClass 项!");
  1785. }
  1786. list.Add((string)Version.NewThread()["mainClass"]);
  1787. return list.Join(" ");
  1788. }
  1789. // Token: 0x06000E1D RID: 3613 RVA: 0x00064784 File Offset: 0x00062984
  1790. private static string McLaunchArgumentsJvmNew(ModMinecraft.McVersion Version)
  1791. {
  1792. List<string> list = new List<string>();
  1793. ModMinecraft.McVersion mcVersion = Version;
  1794. for (;;)
  1795. {
  1796. if (mcVersion.NewThread()["arguments"] != null && mcVersion.NewThread()["arguments"]["jvm"] != null)
  1797. {
  1798. try
  1799. {
  1800. foreach (JToken jtoken in mcVersion.NewThread()["arguments"]["jvm"])
  1801. {
  1802. if (jtoken.Type == 8)
  1803. {
  1804. list.Add(jtoken.ToString());
  1805. }
  1806. else if (ModMinecraft.McJsonRuleCheck(jtoken["rules"]))
  1807. {
  1808. if (jtoken["value"].Type == 8)
  1809. {
  1810. list.Add(jtoken["value"].ToString());
  1811. }
  1812. else
  1813. {
  1814. try
  1815. {
  1816. foreach (JToken jtoken2 in jtoken["value"])
  1817. {
  1818. list.Add(jtoken2.ToString());
  1819. }
  1820. }
  1821. finally
  1822. {
  1823. IEnumerator<JToken> enumerator2;
  1824. if (enumerator2 != null)
  1825. {
  1826. enumerator2.Dispose();
  1827. }
  1828. }
  1829. }
  1830. }
  1831. }
  1832. goto IL_0D;
  1833. }
  1834. finally
  1835. {
  1836. IEnumerator<JToken> enumerator;
  1837. if (enumerator != null)
  1838. {
  1839. enumerator.Dispose();
  1840. }
  1841. }
  1842. continue;
  1843. }
  1844. IL_0D:
  1845. if (Operators.CompareString(mcVersion.CallThread(), "", false) == 0)
  1846. {
  1847. break;
  1848. }
  1849. mcVersion = new ModMinecraft.McVersion(mcVersion.CallThread());
  1850. }
  1851. ModSecret.SecretLaunchJvmArgs(ref list);
  1852. if (Operators.CompareString(ModLaunch.interceptorTests.Output.Type, "Nide", false) == 0)
  1853. {
  1854. list.Insert(0, Conversions.ToString(Operators.ConcatenateObject("-javaagent:\"" + ModBase.m_InstanceRepository + "nide8auth.jar\"=", ModBase.m_IdentifierRepository.Get("VersionServerNide", ModMinecraft.AddClient()))));
  1855. }
  1856. if (Operators.CompareString(ModLaunch.interceptorTests.Output.Type, "Auth", false) == 0)
  1857. {
  1858. string text = Conversions.ToString((ModLaunch.interceptorTests.Input.Type == ModLaunch.McLoginType.Legacy) ? "http://hiperauth.tech/api/yggdrasil-hiper/" : ModBase.m_IdentifierRepository.Get("VersionServerAuthServer", ModMinecraft.AddClient()));
  1859. try
  1860. {
  1861. string s = Conversions.ToString(ModNet.NetGetCodeByRequestRetry(text, Encoding.UTF8, "", false, null, false));
  1862. list.Insert(0, string.Concat(new string[]
  1863. {
  1864. "-javaagent:\"",
  1865. ModBase._MethodRepository,
  1866. "authlib-injector.jar\"=",
  1867. text,
  1868. " -Dauthlibinjector.side=client -Dauthlibinjector.yggdrasil.prefetched=",
  1869. Convert.ToBase64String(Encoding.UTF8.GetBytes(s))
  1870. }));
  1871. }
  1872. catch (Exception innerException)
  1873. {
  1874. throw new Exception("无法连接到第三方登录服务器(" + text + ")", innerException);
  1875. }
  1876. }
  1877. if (ModLaunch.m_RecordTests.PostTests() >= 9)
  1878. {
  1879. list.Add("--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED");
  1880. }
  1881. list.Add("-Doolloo.jlw.tmpdir=\"" + ModBase._MethodRepository.TrimEnd(new char[]
  1882. {
  1883. '\\'
  1884. }) + "\"");
  1885. list.Add("-jar \"" + ModLaunch.ExtractJavaWrapper() + "\"");
  1886. List<string> list2 = new List<string>();
  1887. checked
  1888. {
  1889. int num = list.Count - 1;
  1890. for (int i = 0; i <= num; i++)
  1891. {
  1892. string text2 = list[i];
  1893. if (list[i].StartsWithF("-", false))
  1894. {
  1895. while (i < list.Count - 1 && !list[i + 1].StartsWithF("-", false))
  1896. {
  1897. i++;
  1898. text2 = text2 + " " + list[i];
  1899. }
  1900. }
  1901. list2.Add(text2.Trim().Replace("McEmu= ", "McEmu="));
  1902. }
  1903. list2.Remove("-XX:MaxDirectMemorySize=256M");
  1904. string str = Enumerable.ToList<string>(Enumerable.Distinct<string>(list2)).Join(" ");
  1905. if (Version.NewThread()["mainClass"] == null)
  1906. {
  1907. throw new Exception("版本 json 中没有 mainClass 项!");
  1908. }
  1909. return str + " " + Version.NewThread()["mainClass"].ToString();
  1910. }
  1911. }
  1912. // Token: 0x06000E1E RID: 3614 RVA: 0x00064BA8 File Offset: 0x00062DA8
  1913. private static string McLaunchArgumentsGameOld(ModMinecraft.McVersion Version)
  1914. {
  1915. List<string> list = new List<string>();
  1916. string text = Version.NewThread()["minecraftArguments"].ToString();
  1917. if (!text.Contains("--height"))
  1918. {
  1919. text += " --height ${resolution_height} --width ${resolution_width}";
  1920. }
  1921. list.Add(text);
  1922. string text2 = list.Join(" ");
  1923. if ((Version.Version.m_StructMap || Version.Version._AccountMap) && Version.Version._StatusMap)
  1924. {
  1925. if (text2.Contains("--tweakClass optifine.OptiFineForgeTweaker"))
  1926. {
  1927. ModBase.Log("[Launch] 发现正确的 OptiFineForge TweakClass,目前参数:" + text2, ModBase.LogLevel.Normal, "出现错误");
  1928. text2 = text2.Replace(" --tweakClass optifine.OptiFineForgeTweaker", "").Replace("--tweakClass optifine.OptiFineForgeTweaker ", "") + " --tweakClass optifine.OptiFineForgeTweaker";
  1929. }
  1930. if (text2.Contains("--tweakClass optifine.OptiFineTweaker"))
  1931. {
  1932. ModBase.Log("[Launch] 发现错误的 OptiFineForge TweakClass,目前参数:" + text2, ModBase.LogLevel.Normal, "出现错误");
  1933. text2 = text2.Replace(" --tweakClass optifine.OptiFineTweaker", "").Replace("--tweakClass optifine.OptiFineTweaker ", "") + " --tweakClass optifine.OptiFineForgeTweaker";
  1934. try
  1935. {
  1936. ModBase.WriteFile(Version.Path + Version.Name + ".json", ModBase.ReadFile(Version.Path + Version.Name + ".json", null).Replace("optifine.OptiFineTweaker", "optifine.OptiFineForgeTweaker"), false, null);
  1937. }
  1938. catch (Exception ex)
  1939. {
  1940. ModBase.Log(ex, "替换 OptiFineForge TweakClass 失败", ModBase.LogLevel.Debug, "出现错误");
  1941. }
  1942. }
  1943. }
  1944. return text2;
  1945. }
  1946. // Token: 0x06000E1F RID: 3615 RVA: 0x00064D40 File Offset: 0x00062F40
  1947. private static string McLaunchArgumentsGameNew(ModMinecraft.McVersion Version)
  1948. {
  1949. List<string> list = new List<string>();
  1950. ModMinecraft.McVersion mcVersion = Version;
  1951. for (;;)
  1952. {
  1953. if (mcVersion.NewThread()["arguments"] != null && mcVersion.NewThread()["arguments"]["game"] != null)
  1954. {
  1955. try
  1956. {
  1957. foreach (JToken jtoken in mcVersion.NewThread()["arguments"]["game"])
  1958. {
  1959. if (jtoken.Type == 8)
  1960. {
  1961. list.Add(jtoken.ToString());
  1962. }
  1963. else if (ModMinecraft.McJsonRuleCheck(jtoken["rules"]))
  1964. {
  1965. if (jtoken["value"].Type == 8)
  1966. {
  1967. list.Add(jtoken["value"].ToString());
  1968. }
  1969. else
  1970. {
  1971. try
  1972. {
  1973. foreach (JToken jtoken2 in jtoken["value"])
  1974. {
  1975. list.Add(jtoken2.ToString());
  1976. }
  1977. }
  1978. finally
  1979. {
  1980. IEnumerator<JToken> enumerator2;
  1981. if (enumerator2 != null)
  1982. {
  1983. enumerator2.Dispose();
  1984. }
  1985. }
  1986. }
  1987. }
  1988. }
  1989. goto IL_0D;
  1990. }
  1991. finally
  1992. {
  1993. IEnumerator<JToken> enumerator;
  1994. if (enumerator != null)
  1995. {
  1996. enumerator.Dispose();
  1997. }
  1998. }
  1999. continue;
  2000. }
  2001. IL_0D:
  2002. if (Operators.CompareString(mcVersion.CallThread(), "", false) == 0)
  2003. {
  2004. break;
  2005. }
  2006. mcVersion = new ModMinecraft.McVersion(mcVersion.CallThread());
  2007. }
  2008. List<string> list2 = new List<string>();
  2009. checked
  2010. {
  2011. int num = list.Count - 1;
  2012. for (int i = 0; i <= num; i++)
  2013. {
  2014. string text = list[i];
  2015. if (list[i].StartsWithF("-", false))
  2016. {
  2017. while (i < list.Count - 1 && !list[i + 1].StartsWithF("-", false))
  2018. {
  2019. i++;
  2020. text = text + " " + list[i];
  2021. }
  2022. }
  2023. list2.Add(text);
  2024. }
  2025. string text2 = Enumerable.ToList<string>(Enumerable.Distinct<string>(list2)).Join(" ");
  2026. if ((Version.Version.m_StructMap || Version.Version._AccountMap) && Version.Version._StatusMap)
  2027. {
  2028. if (text2.Contains("--tweakClass optifine.OptiFineForgeTweaker"))
  2029. {
  2030. ModBase.Log("[Launch] 发现正确的 OptiFineForge TweakClass,目前参数:" + text2, ModBase.LogLevel.Normal, "出现错误");
  2031. text2 = text2.Replace(" --tweakClass optifine.OptiFineForgeTweaker", "").Replace("--tweakClass optifine.OptiFineForgeTweaker ", "") + " --tweakClass optifine.OptiFineForgeTweaker";
  2032. }
  2033. if (text2.Contains("--tweakClass optifine.OptiFineTweaker"))
  2034. {
  2035. ModBase.Log("[Launch] 发现错误的 OptiFineForge TweakClass,目前参数:" + text2, ModBase.LogLevel.Normal, "出现错误");
  2036. text2 = text2.Replace(" --tweakClass optifine.OptiFineTweaker", "").Replace("--tweakClass optifine.OptiFineTweaker ", "") + " --tweakClass optifine.OptiFineForgeTweaker";
  2037. try
  2038. {
  2039. ModBase.WriteFile(Version.Path + Version.Name + ".json", ModBase.ReadFile(Version.Path + Version.Name + ".json", null).Replace("optifine.OptiFineTweaker", "optifine.OptiFineForgeTweaker"), false, null);
  2040. }
  2041. catch (Exception ex)
  2042. {
  2043. ModBase.Log(ex, "替换 OptiFineForge TweakClass 失败", ModBase.LogLevel.Debug, "出现错误");
  2044. }
  2045. }
  2046. }
  2047. return text2;
  2048. }
  2049. }
  2050. // Token: 0x06000E20 RID: 3616 RVA: 0x000650A4 File Offset: 0x000632A4
  2051. private static Dictionary<string, string> McLaunchArgumentsReplace(ModMinecraft.McVersion Version, ref ModLoader.LoaderTask<string, List<ModMinecraft.McLibToken>> Loader)
  2052. {
  2053. Dictionary<string, string> dictionary = new Dictionary<string, string>();
  2054. dictionary.Add("${classpath_separator}", ";");
  2055. dictionary.Add("${natives_directory}", ModLaunch.GetNativesFolder());
  2056. dictionary.Add("${library_directory}", ModMinecraft.m_ProxyTests + "libraries");
  2057. dictionary.Add("${libraries_directory}", ModMinecraft.m_ProxyTests + "libraries");
  2058. dictionary.Add("${launcher_name}", "PCL");
  2059. dictionary.Add("${launcher_version}", Conversions.ToString(347));
  2060. dictionary.Add("${version_name}", Version.Name);
  2061. string text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("VersionArgumentInfo", ModMinecraft.AddClient()));
  2062. dictionary.Add("${version_type}", Conversions.ToString((Operators.CompareString(text, "", false) == 0) ? ModBase.m_IdentifierRepository.Get("LaunchArgumentInfo", null) : text));
  2063. dictionary.Add("${game_directory}", Strings.Left(ModMinecraft.AddClient().ChangeMapper(), checked(Enumerable.Count<char>(ModMinecraft.AddClient().ChangeMapper()) - 1)));
  2064. dictionary.Add("${assets_root}", ModMinecraft.m_ProxyTests + "assets");
  2065. dictionary.Add("${user_properties}", "{}");
  2066. dictionary.Add("${auth_player_name}", ModLaunch.interceptorTests.Output.Name);
  2067. dictionary.Add("${auth_uuid}", ModLaunch.interceptorTests.Output.m_InstanceMap);
  2068. dictionary.Add("${auth_access_token}", ModLaunch.interceptorTests.Output._StateMap);
  2069. dictionary.Add("${access_token}", ModLaunch.interceptorTests.Output._StateMap);
  2070. dictionary.Add("${auth_session}", ModLaunch.interceptorTests.Output._StateMap);
  2071. dictionary.Add("${user_type}", "msa");
  2072. object left = ModBase.m_IdentifierRepository.Get("LaunchArgumentWindowType", null);
  2073. Size $VB$Local_Result;
  2074. if (Operators.ConditionalCompareObjectEqual(left, 2, false))
  2075. {
  2076. ModLaunch._Closure$__57-0 CS$<>8__locals1 = new ModLaunch._Closure$__57-0(CS$<>8__locals1);
  2077. ModBase.RunInUiWait(delegate()
  2078. {
  2079. CS$<>8__locals1.$VB$Local_Result = new Size(ModBase.GetPixelSize(ModMain._ProcessIterator.PanForm.ActualWidth), ModBase.GetPixelSize(ModMain._ProcessIterator.PanForm.ActualHeight));
  2080. });
  2081. $VB$Local_Result = CS$<>8__locals1.$VB$Local_Result;
  2082. }
  2083. else if (Operators.ConditionalCompareObjectEqual(left, 3, false))
  2084. {
  2085. $VB$Local_Result = new Size(Conversions.ToDouble(NewLateBinding.LateGet(null, typeof(Math), "Max", new object[]
  2086. {
  2087. 100,
  2088. Operators.SubtractObject(ModBase.m_IdentifierRepository.Get("LaunchArgumentWindowWidth", null), 2)
  2089. }, null, null, null)), Conversions.ToDouble(NewLateBinding.LateGet(null, typeof(Math), "Max", new object[]
  2090. {
  2091. 100,
  2092. Operators.SubtractObject(ModBase.m_IdentifierRepository.Get("LaunchArgumentWindowHeight", null), 2)
  2093. }, null, null, null)));
  2094. }
  2095. else
  2096. {
  2097. $VB$Local_Result = new Size(873.0, 538.0);
  2098. }
  2099. $VB$Local_Result.Height -= 29.5 * (double)ModBase._ConfigurationRepository / 96.0;
  2100. if (ModMinecraft.AddClient().Version._ServerMap <= 12 && ModLaunch.m_RecordTests.PostTests() <= 8 && ModLaunch.m_RecordTests.policyRepository.Revision >= 200 && ModLaunch.m_RecordTests.policyRepository.Revision <= 321 && !ModMinecraft.AddClient().Version._StatusMap && !ModMinecraft.AddClient().Version.m_StructMap)
  2101. {
  2102. ModLaunch.McLaunchLog(string.Format("已应用窗口大小过大修复({0})", ModLaunch.m_RecordTests.policyRepository.Revision));
  2103. $VB$Local_Result.Width /= (double)ModBase._ConfigurationRepository / 96.0;
  2104. $VB$Local_Result.Height /= (double)ModBase._ConfigurationRepository / 96.0;
  2105. }
  2106. dictionary.Add("${resolution_width}", Conversions.ToString(Math.Round($VB$Local_Result.Width)));
  2107. dictionary.Add("${resolution_height}", Conversions.ToString(Math.Round($VB$Local_Result.Height)));
  2108. dictionary.Add("${game_assets}", ModMinecraft.m_ProxyTests + "assets\\virtual\\legacy");
  2109. dictionary.Add("${assets_index_name}", ModMinecraft.McAssetsGetIndexName(Version));
  2110. List<ModMinecraft.McLibToken> list = ModMinecraft.McLibListGet(Version, true);
  2111. Loader.Output = list;
  2112. List<string> list2 = new List<string>();
  2113. string text2 = null;
  2114. try
  2115. {
  2116. foreach (ModMinecraft.McLibToken mcLibToken in list)
  2117. {
  2118. if (!mcLibToken.attributeMap)
  2119. {
  2120. if (mcLibToken.Name != null && Operators.CompareString(mcLibToken.Name, "optifine:OptiFine", false) == 0)
  2121. {
  2122. text2 = mcLibToken._WrapperMap;
  2123. }
  2124. else
  2125. {
  2126. list2.Add(mcLibToken._WrapperMap);
  2127. }
  2128. }
  2129. }
  2130. }
  2131. finally
  2132. {
  2133. List<ModMinecraft.McLibToken>.Enumerator enumerator;
  2134. ((IDisposable)enumerator).Dispose();
  2135. }
  2136. if (text2 != null)
  2137. {
  2138. list2.Insert(checked(list2.Count - 2), text2);
  2139. }
  2140. dictionary.Add("${classpath}", list2.Join(";"));
  2141. return dictionary;
  2142. }
  2143. // Token: 0x06000E21 RID: 3617 RVA: 0x000655B4 File Offset: 0x000637B4
  2144. private static void McLaunchNatives(ModLoader.LoaderTask<List<ModMinecraft.McLibToken>, int> Loader)
  2145. {
  2146. string text = ModLaunch.GetNativesFolder() + "\\";
  2147. Directory.CreateDirectory(text);
  2148. ModLaunch.McLaunchLog("正在解压 Natives 文件");
  2149. List<string> list = new List<string>();
  2150. try
  2151. {
  2152. foreach (ModMinecraft.McLibToken mcLibToken in Loader.Input)
  2153. {
  2154. if (mcLibToken.attributeMap)
  2155. {
  2156. ZipArchive zipArchive;
  2157. try
  2158. {
  2159. zipArchive = new ZipArchive(new FileStream(mcLibToken._WrapperMap, FileMode.Open));
  2160. }
  2161. catch (InvalidDataException ex)
  2162. {
  2163. ModBase.Log(ex, "打开 Natives 文件失败(" + mcLibToken._WrapperMap + ")", ModBase.LogLevel.Debug, "出现错误");
  2164. File.Delete(mcLibToken._WrapperMap);
  2165. throw new Exception("无法打开 Natives 文件(" + mcLibToken._WrapperMap + "),该文件可能已损坏,请重新尝试启动游戏");
  2166. }
  2167. try
  2168. {
  2169. foreach (ZipArchiveEntry zipArchiveEntry in zipArchive.Entries)
  2170. {
  2171. string fullName = zipArchiveEntry.FullName;
  2172. if (fullName.EndsWithF(".dll", true))
  2173. {
  2174. string text2 = text + fullName;
  2175. list.Add(text2);
  2176. FileInfo fileInfo = new FileInfo(text2);
  2177. if (fileInfo.Exists)
  2178. {
  2179. if (fileInfo.Length == zipArchiveEntry.Length)
  2180. {
  2181. if (ModBase._TokenRepository)
  2182. {
  2183. ModLaunch.McLaunchLog("无需解压:" + text2);
  2184. continue;
  2185. }
  2186. continue;
  2187. }
  2188. else
  2189. {
  2190. try
  2191. {
  2192. File.Delete(text2);
  2193. }
  2194. catch (UnauthorizedAccessException ex2)
  2195. {
  2196. ModLaunch.McLaunchLog("删除原 dll 访问被拒绝,这通常代表有一个 MC 正在运行,跳过解压:" + text2);
  2197. ModLaunch.McLaunchLog("实际的错误信息:" + ModBase.GetExceptionSummary(ex2));
  2198. break;
  2199. }
  2200. }
  2201. }
  2202. ModBase.WriteFile(text2, zipArchiveEntry.Open());
  2203. ModLaunch.McLaunchLog("已解压:" + text2);
  2204. }
  2205. }
  2206. goto IL_1C1;
  2207. }
  2208. finally
  2209. {
  2210. IEnumerator<ZipArchiveEntry> enumerator2;
  2211. if (enumerator2 != null)
  2212. {
  2213. enumerator2.Dispose();
  2214. }
  2215. }
  2216. IL_1B5:
  2217. zipArchive.Dispose();
  2218. continue;
  2219. IL_1C1:
  2220. if (zipArchive != null)
  2221. {
  2222. goto IL_1B5;
  2223. }
  2224. }
  2225. }
  2226. }
  2227. finally
  2228. {
  2229. List<ModMinecraft.McLibToken>.Enumerator enumerator;
  2230. ((IDisposable)enumerator).Dispose();
  2231. }
  2232. foreach (string text3 in Directory.GetFiles(text))
  2233. {
  2234. if (!list.Contains(text3))
  2235. {
  2236. try
  2237. {
  2238. ModLaunch.McLaunchLog("删除:" + text3);
  2239. File.Delete(text3);
  2240. }
  2241. catch (UnauthorizedAccessException ex3)
  2242. {
  2243. ModLaunch.McLaunchLog("删除多余文件访问被拒绝,跳过删除步骤");
  2244. ModLaunch.McLaunchLog("实际的错误信息:" + ModBase.GetExceptionSummary(ex3));
  2245. break;
  2246. }
  2247. }
  2248. }
  2249. }
  2250. // Token: 0x06000E22 RID: 3618 RVA: 0x00065890 File Offset: 0x00063A90
  2251. private static string GetNativesFolder()
  2252. {
  2253. string text = ModMinecraft.AddClient().Path + ModMinecraft.AddClient().Name + "-natives";
  2254. string result;
  2255. if (!ModBase.rulesRepository && !text.IsASCII())
  2256. {
  2257. text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\.minecraft\\bin\\natives";
  2258. if (text.IsASCII())
  2259. {
  2260. result = text;
  2261. }
  2262. else
  2263. {
  2264. result = ModBase._RefRepository + "ProgramData\\PCL\\natives";
  2265. }
  2266. }
  2267. else
  2268. {
  2269. result = text;
  2270. }
  2271. return result;
  2272. }
  2273. // Token: 0x06000E23 RID: 3619 RVA: 0x00065900 File Offset: 0x00063B00
  2274. private static void McLaunchPrerun()
  2275. {
  2276. try
  2277. {
  2278. if (Operators.CompareString(ModLaunch.interceptorTests.Output.Type, "Microsoft", false) == 0)
  2279. {
  2280. ModMinecraft.McFolderLauncherProfilesJsonCreate(ModMinecraft.m_ProxyTests);
  2281. JObject jobject = (JObject)ModBase.GetJson(string.Concat(new string[]
  2282. {
  2283. "\r\n {\r\n \"authenticationDatabase\": {\r\n \"00000111112222233333444445555566\": {\r\n \"username\": \"",
  2284. ModLaunch.interceptorTests.Output.Name.Replace("\"", "-"),
  2285. "\",\r\n \"profiles\": {\r\n \"66666555554444433333222221111100\": {\r\n \"displayName\": \"",
  2286. ModLaunch.interceptorTests.Output.Name,
  2287. "\"\r\n }\r\n }\r\n }\r\n },\r\n \"clientToken\": \"",
  2288. ModLaunch.interceptorTests.Output._CallbackMap,
  2289. "\",\r\n \"selectedUser\": {\r\n \"account\": \"00000111112222233333444445555566\", \r\n \"profile\": \"66666555554444433333222221111100\"\r\n }\r\n }"
  2290. }));
  2291. JObject jobject2 = (JObject)ModBase.GetJson(ModBase.ReadFile(ModMinecraft.m_ProxyTests + "launcher_profiles.json", null));
  2292. jobject2.Merge(jobject);
  2293. ModBase.WriteFile(ModMinecraft.m_ProxyTests + "launcher_profiles.json", jobject2.ToString(), false, Encoding.GetEncoding("GB18030"));
  2294. ModLaunch.McLaunchLog("已更新 launcher_profiles.json");
  2295. }
  2296. }
  2297. catch (Exception ex)
  2298. {
  2299. ModBase.Log(ex, "更新 launcher_profiles.json 失败,将在删除文件后重试", ModBase.LogLevel.Debug, "出现错误");
  2300. try
  2301. {
  2302. File.Delete(ModMinecraft.m_ProxyTests + "launcher_profiles.json");
  2303. ModMinecraft.McFolderLauncherProfilesJsonCreate(ModMinecraft.m_ProxyTests);
  2304. JObject jobject3 = (JObject)ModBase.GetJson(string.Concat(new string[]
  2305. {
  2306. "\r\n {\r\n \"authenticationDatabase\": {\r\n \"00000111112222233333444445555566\": {\r\n \"username\": \"",
  2307. ModLaunch.interceptorTests.Output.Name.Replace("\"", "-"),
  2308. "\",\r\n \"profiles\": {\r\n \"66666555554444433333222221111100\": {\r\n \"displayName\": \"",
  2309. ModLaunch.interceptorTests.Output.Name,
  2310. "\"\r\n }\r\n }\r\n }\r\n },\r\n \"clientToken\": \"",
  2311. ModLaunch.interceptorTests.Output._CallbackMap,
  2312. "\",\r\n \"selectedUser\": {\r\n \"account\": \"00000111112222233333444445555566\", \r\n \"profile\": \"66666555554444433333222221111100\"\r\n }\r\n }"
  2313. }));
  2314. JObject jobject4 = (JObject)ModBase.GetJson(ModBase.ReadFile(ModMinecraft.m_ProxyTests + "launcher_profiles.json", null));
  2315. jobject4.Merge(jobject3);
  2316. ModBase.WriteFile(ModMinecraft.m_ProxyTests + "launcher_profiles.json", jobject4.ToString(), false, Encoding.GetEncoding("GB18030"));
  2317. ModLaunch.McLaunchLog("已在删除后更新 launcher_profiles.json");
  2318. }
  2319. catch (Exception ex2)
  2320. {
  2321. ModBase.Log(ex2, "更新 launcher_profiles.json 失败", ModBase.LogLevel.Feedback, "出现错误");
  2322. }
  2323. }
  2324. string text = ModMinecraft.AddClient().ChangeMapper() + "options.txt";
  2325. if (!File.Exists(text))
  2326. {
  2327. string text2 = ModMinecraft.AddClient().ChangeMapper() + "config\\yosbr\\options.txt";
  2328. if (File.Exists(text2))
  2329. {
  2330. ModLaunch.McLaunchLog("将修改 Yosbr Mod 中的 options.txt");
  2331. text = text2;
  2332. ModBase.WriteIni(text, "lang", "none");
  2333. }
  2334. }
  2335. try
  2336. {
  2337. string text3 = ModBase.ReadIni(text, "lang", "none");
  2338. string text4 = (Operators.CompareString(text3, "none", false) == 0 || !Directory.Exists(ModMinecraft.AddClient().ChangeMapper() + "saves")) ? (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("ToolHelpChinese", null)) ? "zh_cn" : "en_us") : text3.ToLower();
  2339. if (ModMinecraft.AddClient().Version._ServerMap < 12)
  2340. {
  2341. text4 = checked(text4.Substring(0, text4.Length - 2) + text4.Substring(text4.Length - 2).ToUpper());
  2342. }
  2343. if (Operators.CompareString(text3, text4, false) == 0)
  2344. {
  2345. ModLaunch.McLaunchLog(string.Format("需要的语言为 {0},当前语言为 {1},无需修改", text4, text3));
  2346. }
  2347. else
  2348. {
  2349. ModBase.WriteIni(text, "lang", "-");
  2350. ModBase.WriteIni(text, "lang", text4);
  2351. ModLaunch.McLaunchLog(string.Format("已将语言从 {0} 修改为 {1}", text3, text4));
  2352. }
  2353. object left = ModBase.m_IdentifierRepository.Get("LaunchArgumentWindowType", null);
  2354. if (Operators.ConditionalCompareObjectEqual(left, 0, false))
  2355. {
  2356. ModBase.WriteIni(text, "fullscreen", "true");
  2357. }
  2358. else if (!Operators.ConditionalCompareObjectEqual(left, 1, false))
  2359. {
  2360. ModBase.WriteIni(text, "fullscreen", "false");
  2361. }
  2362. }
  2363. catch (Exception ex3)
  2364. {
  2365. ModBase.Log(ex3, "更新 options.txt 失败", ModBase.LogLevel.Hint, "出现错误");
  2366. }
  2367. if (Conversions.ToBoolean(ModMinecraft.AddClient().Version._ServerMap <= 7 && ModMinecraft.AddClient().Version._ServerMap >= 2 && ModLaunch.interceptorTests.Input.Type == ModLaunch.McLoginType.Legacy && (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("LaunchSkinType", null), 2, false) || (Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("LaunchSkinType", null), 4, false) && Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("LaunchSkinSlim", null))))))
  2368. {
  2369. ModMain.Hint("此 Minecraft 版本尚不支持 Alex 皮肤,你的皮肤可能会显示为 Steve!", ModMain.HintType.Critical, true);
  2370. }
  2371. try
  2372. {
  2373. Directory.CreateDirectory(ModMinecraft.AddClient().ChangeMapper() + "resourcepacks\\");
  2374. string path = ModMinecraft.AddClient().ChangeMapper() + "resourcepacks\\PCL2 Skin.zip";
  2375. bool flag = ModMinecraft.AddClient().Version._ServerMap >= 13 || ModMinecraft.AddClient().Version._ServerMap < 6;
  2376. if (ModLaunch.interceptorTests.Input.Type == ModLaunch.McLoginType.Legacy && Operators.ConditionalCompareObjectEqual(ModBase.m_IdentifierRepository.Get("LaunchSkinType", null), 4, false) && File.Exists(ModBase.m_InstanceRepository + "CustomSkin.png"))
  2377. {
  2378. Directory.CreateDirectory(ModBase.m_DecoratorRepository);
  2379. string text5 = ModBase.m_DecoratorRepository + "pack.mcmeta";
  2380. string text6 = ModBase.m_DecoratorRepository + "pack.png";
  2381. int value;
  2382. switch (ModMinecraft.AddClient().Version._ServerMap)
  2383. {
  2384. case 0:
  2385. case 1:
  2386. case 2:
  2387. case 3:
  2388. case 4:
  2389. case 5:
  2390. ModLaunch.McLaunchLog("Minecraft 版本过老,尚不支持自定义离线皮肤");
  2391. goto IL_B91;
  2392. case 6:
  2393. case 7:
  2394. case 8:
  2395. value = 1;
  2396. break;
  2397. case 9:
  2398. case 10:
  2399. value = 2;
  2400. break;
  2401. case 11:
  2402. case 12:
  2403. value = 3;
  2404. break;
  2405. case 13:
  2406. case 14:
  2407. value = 4;
  2408. break;
  2409. case 15:
  2410. value = 5;
  2411. break;
  2412. case 16:
  2413. value = 6;
  2414. break;
  2415. case 17:
  2416. value = 7;
  2417. break;
  2418. case 18:
  2419. if (ModMinecraft.AddClient().Version.m_ResolverMap <= 2)
  2420. {
  2421. value = 8;
  2422. }
  2423. else
  2424. {
  2425. value = 9;
  2426. }
  2427. break;
  2428. case 19:
  2429. if (ModMinecraft.AddClient().Version.m_ResolverMap <= 3)
  2430. {
  2431. value = 9;
  2432. }
  2433. else
  2434. {
  2435. value = 12;
  2436. }
  2437. break;
  2438. case 20:
  2439. if (ModMinecraft.AddClient().Version.m_ResolverMap <= 1)
  2440. {
  2441. value = 15;
  2442. }
  2443. else
  2444. {
  2445. value = 17;
  2446. }
  2447. break;
  2448. default:
  2449. value = 17;
  2450. break;
  2451. }
  2452. ModLaunch.McLaunchLog("正在构建自定义皮肤资源包,格式为:" + Conversions.ToString(value));
  2453. new MyBitmap(ModBase.m_SerializerRepository + "Heads/Logo.png").Save(text6);
  2454. ModBase.WriteFile(text5, "{\"pack\":{\"pack_format\":" + Conversions.ToString(value) + ",\"description\":\"PCL 自定义离线皮肤资源包\"}}", false, null);
  2455. MyBitmap myBitmap = new MyBitmap(ModBase.m_InstanceRepository + "CustomSkin.png");
  2456. if ((ModMinecraft.AddClient().Version._ServerMap == 6 || ModMinecraft.AddClient().Version._ServerMap == 7) && myBitmap._ContainerIterator.Height == 64)
  2457. {
  2458. ModLaunch.McLaunchLog("该 Minecraft 版本不支持双层皮肤,已进行裁剪");
  2459. myBitmap = myBitmap.Clip(0, 0, 64, 32);
  2460. }
  2461. myBitmap.Save(ModBase.Path + "PCL\\CustomSkin_Cliped.png");
  2462. using (FileStream fileStream = new FileStream(path, FileMode.Create))
  2463. {
  2464. using (ZipArchive zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Create))
  2465. {
  2466. zipArchive.CreateEntryFromFile(text5, "pack.mcmeta");
  2467. zipArchive.CreateEntryFromFile(text6, "pack.png");
  2468. int serverMap = ModMinecraft.AddClient().Version._ServerMap;
  2469. bool flag2 = serverMap < 19 || (serverMap == 19 && ModMinecraft.AddClient().Version.m_ResolverMap <= 2);
  2470. if (flag2)
  2471. {
  2472. zipArchive.CreateEntryFromFile(ModBase.Path + "PCL\\CustomSkin_Cliped.png", "assets/minecraft/textures/entity/" + (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("LaunchSkinSlim", null)) ? "alex.png" : "steve.png"));
  2473. }
  2474. else
  2475. {
  2476. foreach (string arg in new string[]
  2477. {
  2478. "alex",
  2479. "ari",
  2480. "efe",
  2481. "kai",
  2482. "makena",
  2483. "noor",
  2484. "steve",
  2485. "sunny",
  2486. "zuri"
  2487. })
  2488. {
  2489. zipArchive.CreateEntryFromFile(ModBase.Path + "PCL\\CustomSkin_Cliped.png", string.Format("assets/minecraft/textures/entity/player/{0}/{1}.png", Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("LaunchSkinSlim", null)) ? "slim" : "wide", arg));
  2490. }
  2491. }
  2492. }
  2493. }
  2494. File.Delete(ModBase.Path + "PCL\\CustomSkin_Cliped.png");
  2495. ModBase.IniClearCache(text);
  2496. string text7 = ModBase.ReadIni(text, "resourcePacks", "[]").TrimStart(new char[]
  2497. {
  2498. '['
  2499. }).TrimEnd(new char[]
  2500. {
  2501. ']'
  2502. });
  2503. if (flag)
  2504. {
  2505. if (Operators.CompareString(text7, "", false) == 0)
  2506. {
  2507. text7 = "\"vanilla\"";
  2508. }
  2509. List<string> list = new List<string>(text7.Split(","));
  2510. List<string> list2 = new List<string>();
  2511. try
  2512. {
  2513. foreach (string text8 in list)
  2514. {
  2515. if (Operators.CompareString(text8, "\"file/PCL2 Skin.zip\"", false) != 0 && Operators.CompareString(text8, "", false) != 0)
  2516. {
  2517. list2.Add(text8);
  2518. }
  2519. }
  2520. }
  2521. finally
  2522. {
  2523. List<string>.Enumerator enumerator;
  2524. ((IDisposable)enumerator).Dispose();
  2525. }
  2526. list2.Add("\"file/PCL2 Skin.zip\"");
  2527. string value2 = "[" + list2.Join(",") + "]";
  2528. ModBase.WriteIni(text, "resourcePacks", value2);
  2529. }
  2530. else
  2531. {
  2532. List<string> list3 = new List<string>(text7.Split(","));
  2533. List<string> list4 = new List<string>();
  2534. try
  2535. {
  2536. foreach (string text9 in list3)
  2537. {
  2538. if (Operators.CompareString(text9, "\"PCL2 Skin.zip\"", false) != 0 && Operators.CompareString(text9, "", false) != 0)
  2539. {
  2540. list4.Add(text9);
  2541. }
  2542. }
  2543. }
  2544. finally
  2545. {
  2546. List<string>.Enumerator enumerator2;
  2547. ((IDisposable)enumerator2).Dispose();
  2548. }
  2549. list4.Add("\"PCL2 Skin.zip\"");
  2550. string value3 = "[" + list4.Join(",") + "]";
  2551. ModBase.WriteIni(text, "resourcePacks", value3);
  2552. }
  2553. }
  2554. else if (File.Exists(path))
  2555. {
  2556. ModLaunch.McLaunchLog("正在清空自定义皮肤资源包");
  2557. File.Delete(path);
  2558. ModBase.IniClearCache(text);
  2559. string text10 = ModBase.ReadIni(text, "resourcePacks", "[]").TrimStart(new char[]
  2560. {
  2561. '['
  2562. }).TrimEnd(new char[]
  2563. {
  2564. ']'
  2565. });
  2566. if (flag)
  2567. {
  2568. if (Operators.CompareString(text10, "", false) == 0)
  2569. {
  2570. text10 = "\"vanilla\"";
  2571. }
  2572. List<string> list5 = new List<string>(text10.Split(","));
  2573. list5.Remove("\"file/PCL2 Skin.zip\"");
  2574. string value4 = "[" + list5.Join(",") + "]";
  2575. ModBase.WriteIni(text, "resourcePacks", value4);
  2576. }
  2577. else
  2578. {
  2579. List<string> list6 = new List<string>(text10.Split(","));
  2580. list6.Remove("\"PCL2 Skin.zip\"");
  2581. string value5 = "[" + list6.Join(",") + "]";
  2582. ModBase.WriteIni(text, "resourcePacks", value5);
  2583. }
  2584. }
  2585. IL_B91:;
  2586. }
  2587. catch (Exception ex4)
  2588. {
  2589. ModBase.Log(ex4, "离线皮肤资源包设置失败", ModBase.LogLevel.Hint, "出现错误");
  2590. }
  2591. }
  2592. // Token: 0x06000E24 RID: 3620 RVA: 0x00066588 File Offset: 0x00064788
  2593. private static void McLaunchCustom(ModLoader.LoaderTask<int, int> Loader)
  2594. {
  2595. string text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("LaunchAdvanceRun", null));
  2596. if (Operators.CompareString(text, "", false) != 0)
  2597. {
  2598. text = ModLaunch.ArgumentReplace(text, true);
  2599. }
  2600. string text2 = Conversions.ToString(ModBase.m_IdentifierRepository.Get("VersionAdvanceRun", ModMinecraft.AddClient()));
  2601. if (Operators.CompareString(text2, "", false) != 0)
  2602. {
  2603. text2 = ModLaunch.ArgumentReplace(text2, true);
  2604. }
  2605. try
  2606. {
  2607. string raw = string.Concat(new string[]
  2608. {
  2609. "@echo off\r\ntitle 启动 - ",
  2610. ModMinecraft.AddClient().Name,
  2611. "\r\necho 游戏正在启动,请稍候。\r\nset APPDATA=\"",
  2612. ModMinecraft.m_ProxyTests,
  2613. "\"\r\ncd /D \"",
  2614. ModMinecraft.m_ProxyTests,
  2615. "\"\r\n",
  2616. text,
  2617. "\r\n",
  2618. text2,
  2619. "\r\n\"",
  2620. ModLaunch.m_RecordTests.StartTests(),
  2621. "\" ",
  2622. ModLaunch._ServiceTests,
  2623. "\r\necho 游戏已退出。\r\npause"
  2624. });
  2625. ModBase.WriteFile(ModLaunch.filterTests.requestMap ?? (ModBase.Path + "PCL\\LatestLaunch.bat"), ModSecret.SecretFilter(raw, 'F'), false, Encoding.Default.Equals(Encoding.UTF8) ? Encoding.UTF8 : Encoding.GetEncoding("GB18030"));
  2626. if (ModLaunch.filterTests.requestMap != null)
  2627. {
  2628. ModLaunch.McLaunchLog("导出启动脚本完成,强制结束启动过程");
  2629. ModLaunch._PageTests = "导出启动脚本成功!";
  2630. ModBase.OpenExplorer("/select,\"" + ModLaunch.filterTests.requestMap + "\"");
  2631. Loader.Parent.Abort();
  2632. return;
  2633. }
  2634. }
  2635. catch (Exception ex)
  2636. {
  2637. ModBase.Log(ex, "输出启动脚本失败", ModBase.LogLevel.Debug, "出现错误");
  2638. if (ModLaunch.filterTests.requestMap != null)
  2639. {
  2640. throw ex;
  2641. }
  2642. }
  2643. if (Operators.CompareString(text, "", false) != 0)
  2644. {
  2645. ModLaunch.McLaunchLog("正在执行全局自定义命令:" + text);
  2646. Process process = new Process();
  2647. try
  2648. {
  2649. process.StartInfo.FileName = "cmd.exe";
  2650. process.StartInfo.Arguments = "/c \"" + text + "\"";
  2651. process.StartInfo.WorkingDirectory = ModMinecraft.m_ProxyTests;
  2652. process.StartInfo.UseShellExecute = false;
  2653. process.StartInfo.CreateNoWindow = true;
  2654. process.Start();
  2655. if (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("LaunchAdvanceRunWait", null)))
  2656. {
  2657. while (!process.HasExited && !Loader.IsAborted)
  2658. {
  2659. Thread.Sleep(10);
  2660. }
  2661. }
  2662. }
  2663. catch (Exception ex2)
  2664. {
  2665. ModBase.Log(ex2, "执行全局自定义命令失败", ModBase.LogLevel.Hint, "出现错误");
  2666. }
  2667. finally
  2668. {
  2669. if (!process.HasExited && Loader.IsAborted)
  2670. {
  2671. ModLaunch.McLaunchLog("由于取消启动,已强制结束自定义命令 CMD 进程");
  2672. process.Kill();
  2673. }
  2674. }
  2675. }
  2676. if (Operators.CompareString(text2, "", false) != 0)
  2677. {
  2678. ModLaunch.McLaunchLog("正在执行版本自定义命令:" + text2);
  2679. Process process2 = new Process();
  2680. try
  2681. {
  2682. process2.StartInfo.FileName = "cmd.exe";
  2683. process2.StartInfo.Arguments = "/c \"" + text2 + "\"";
  2684. process2.StartInfo.WorkingDirectory = ModMinecraft.m_ProxyTests;
  2685. process2.StartInfo.UseShellExecute = false;
  2686. process2.StartInfo.CreateNoWindow = true;
  2687. process2.Start();
  2688. if (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("VersionAdvanceRunWait", ModMinecraft.AddClient())))
  2689. {
  2690. while (!process2.HasExited && !Loader.IsAborted)
  2691. {
  2692. Thread.Sleep(10);
  2693. }
  2694. }
  2695. }
  2696. catch (Exception ex3)
  2697. {
  2698. ModBase.Log(ex3, "执行版本自定义命令失败", ModBase.LogLevel.Hint, "出现错误");
  2699. }
  2700. finally
  2701. {
  2702. if (!process2.HasExited && Loader.IsAborted)
  2703. {
  2704. ModLaunch.McLaunchLog("由于取消启动,已强制结束自定义命令 CMD 进程");
  2705. process2.Kill();
  2706. }
  2707. }
  2708. }
  2709. }
  2710. // Token: 0x06000E25 RID: 3621 RVA: 0x000669CC File Offset: 0x00064BCC
  2711. private static void McLaunchRun(ModLoader.LoaderTask<int, Process> Loader)
  2712. {
  2713. Process process = new Process();
  2714. ProcessStartInfo processStartInfo = new ProcessStartInfo(ModLaunch.m_RecordTests.PrintTests());
  2715. if (processStartInfo.EnvironmentVariables.ContainsKey("appdata"))
  2716. {
  2717. processStartInfo.EnvironmentVariables["appdata"] = ModMinecraft.m_ProxyTests;
  2718. }
  2719. else
  2720. {
  2721. processStartInfo.EnvironmentVariables.Add("appdata", ModMinecraft.m_ProxyTests);
  2722. }
  2723. List<string> list = new List<string>(processStartInfo.EnvironmentVariables["Path"].Split(";"));
  2724. list.Add(ModLaunch.m_RecordTests._UtilsRepository);
  2725. processStartInfo.EnvironmentVariables["Path"] = Enumerable.ToList<string>(Enumerable.Distinct<string>(list)).Join(";");
  2726. processStartInfo.StandardErrorEncoding = Encoding.UTF8;
  2727. processStartInfo.StandardOutputEncoding = Encoding.UTF8;
  2728. processStartInfo.WorkingDirectory = ModMinecraft.AddClient().ChangeMapper();
  2729. processStartInfo.UseShellExecute = false;
  2730. processStartInfo.RedirectStandardOutput = true;
  2731. processStartInfo.RedirectStandardError = true;
  2732. processStartInfo.CreateNoWindow = false;
  2733. processStartInfo.Arguments = ModLaunch._ServiceTests;
  2734. process.StartInfo = processStartInfo;
  2735. process.Start();
  2736. ModLaunch.McLaunchLog("已启动游戏进程:" + ModLaunch.m_RecordTests.PrintTests());
  2737. if (Loader.IsAborted)
  2738. {
  2739. ModLaunch.McLaunchLog("由于取消启动,已强制结束游戏进程");
  2740. process.Kill();
  2741. return;
  2742. }
  2743. Loader.Output = process;
  2744. ModLaunch._PoolTests = process;
  2745. try
  2746. {
  2747. process.PriorityBoostEnabled = true;
  2748. object left = ModBase.m_IdentifierRepository.Get("LaunchArgumentPriority", null);
  2749. if (Operators.ConditionalCompareObjectEqual(left, 0, false))
  2750. {
  2751. process.PriorityClass = ProcessPriorityClass.AboveNormal;
  2752. }
  2753. else if (Operators.ConditionalCompareObjectEqual(left, 2, false))
  2754. {
  2755. process.PriorityClass = ProcessPriorityClass.BelowNormal;
  2756. }
  2757. }
  2758. catch (Exception ex)
  2759. {
  2760. ModBase.Log(ex, "设置进程优先级失败", ModBase.LogLevel.Feedback, "出现错误");
  2761. }
  2762. }
  2763. // Token: 0x06000E26 RID: 3622 RVA: 0x00066BA0 File Offset: 0x00064DA0
  2764. private static void McLaunchWait(ModLoader.LoaderTask<Process, int> Loader)
  2765. {
  2766. ModLaunch.McLaunchLog("");
  2767. ModLaunch.McLaunchLog("~ 基础参数 ~");
  2768. ModLaunch.McLaunchLog("PCL 版本:Release 2.8.12 (" + Conversions.ToString(347) + ")");
  2769. ModLaunch.McLaunchLog(string.Concat(new string[]
  2770. {
  2771. "游戏版本:",
  2772. ModMinecraft.AddClient().Version.ToString(),
  2773. "(识别为 1.",
  2774. Conversions.ToString(ModMinecraft.AddClient().Version._ServerMap),
  2775. ".",
  2776. Conversions.ToString(ModMinecraft.AddClient().Version.m_ResolverMap),
  2777. ")"
  2778. }));
  2779. ModLaunch.McLaunchLog("资源版本:" + ModMinecraft.McAssetsGetIndexName(ModMinecraft.AddClient()));
  2780. ModLaunch.McLaunchLog("版本继承:" + ((Operators.CompareString(ModMinecraft.AddClient().CallThread(), "", false) == 0) ? "无" : ModMinecraft.AddClient().CallThread()));
  2781. ModLaunch.McLaunchLog(string.Concat(new string[]
  2782. {
  2783. "分配的内存:",
  2784. Conversions.ToString(PageVersionSetup.GetRam(ModMinecraft.AddClient(), new bool?(!ModLaunch.m_RecordTests.producerRepository))),
  2785. " GB(",
  2786. Conversions.ToString(Math.Round(PageVersionSetup.GetRam(ModMinecraft.AddClient(), new bool?(!ModLaunch.m_RecordTests.producerRepository)) * 1024.0)),
  2787. " MB)"
  2788. }));
  2789. ModLaunch.McLaunchLog("MC 文件夹:" + ModMinecraft.m_ProxyTests);
  2790. ModLaunch.McLaunchLog("版本文件夹:" + ModMinecraft.AddClient().Path);
  2791. ModLaunch.McLaunchLog("版本隔离:" + Conversions.ToString(Operators.CompareString(ModMinecraft.AddClient().ChangeMapper(), ModMinecraft.AddClient().Path, false) == 0));
  2792. ModLaunch.McLaunchLog("HMCL 格式:" + Conversions.ToString(ModMinecraft.AddClient().InvokeThread()));
  2793. ModLaunch.McLaunchLog("Java 信息:" + ((ModLaunch.m_RecordTests != null) ? ModLaunch.m_RecordTests.ToString() : "无可用 Java"));
  2794. ModLaunch.McLaunchLog("环境变量:" + ((ModLaunch.m_RecordTests != null) ? (ModLaunch.m_RecordTests.CompareTests() ? "已设置" : "未设置") : "未设置"));
  2795. ModLaunch.McLaunchLog("Natives 文件夹:" + ModLaunch.GetNativesFolder());
  2796. ModLaunch.McLaunchLog("");
  2797. ModLaunch.McLaunchLog("~ 登录参数 ~");
  2798. ModLaunch.McLaunchLog("玩家用户名:" + ModLaunch.interceptorTests.Output.Name);
  2799. ModLaunch.McLaunchLog("AccessToken:" + ModLaunch.interceptorTests.Output._StateMap);
  2800. ModLaunch.McLaunchLog("ClientToken:" + ModLaunch.interceptorTests.Output._CallbackMap);
  2801. ModLaunch.McLaunchLog("UUID:" + ModLaunch.interceptorTests.Output.m_InstanceMap);
  2802. ModLaunch.McLaunchLog("登录方式:" + ModLaunch.interceptorTests.Output.Type);
  2803. ModLaunch.McLaunchLog("");
  2804. string text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("VersionArgumentTitle", ModMinecraft.AddClient()));
  2805. if (Operators.CompareString(text, "", false) == 0)
  2806. {
  2807. text = Conversions.ToString(ModBase.m_IdentifierRepository.Get("LaunchArgumentTitle", null));
  2808. }
  2809. text = ModLaunch.ArgumentReplace(text, false);
  2810. ModWatcher.Watcher watcher = new ModWatcher.Watcher(Loader, ModMinecraft.AddClient(), text);
  2811. ModLaunch.customerTests = watcher;
  2812. while (watcher.State == ModWatcher.Watcher.MinecraftState.Loading)
  2813. {
  2814. Thread.Sleep(100);
  2815. }
  2816. if (watcher.State == ModWatcher.Watcher.MinecraftState.Crashed)
  2817. {
  2818. throw new Exception("$$");
  2819. }
  2820. }
  2821. // Token: 0x06000E27 RID: 3623 RVA: 0x00066F3C File Offset: 0x0006513C
  2822. private static void McLaunchEnd()
  2823. {
  2824. ModLaunch.McLaunchLog("开始启动结束处理");
  2825. if (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("UiMusicStop", null)))
  2826. {
  2827. ModBase.RunInUi((ModLaunch._Closure$__.$I64-0 == null) ? (ModLaunch._Closure$__.$I64-0 = delegate()
  2828. {
  2829. if (ModMusic.MusicPause())
  2830. {
  2831. ModBase.Log("[Music] 已根据设置,在启动后暂停音乐播放", ModBase.LogLevel.Normal, "出现错误");
  2832. }
  2833. }) : ModLaunch._Closure$__.$I64-0, false);
  2834. }
  2835. else if (Conversions.ToBoolean(ModBase.m_IdentifierRepository.Get("UiMusicStart", null)))
  2836. {
  2837. ModBase.RunInUi((ModLaunch._Closure$__.$I64-1 == null) ? (ModLaunch._Closure$__.$I64-1 = delegate()
  2838. {
  2839. if (ModMusic.MusicResume())
  2840. {
  2841. ModBase.Log("[Music] 已根据设置,在启动后开始音乐播放", ModBase.LogLevel.Normal, "出现错误");
  2842. }
  2843. }) : ModLaunch._Closure$__.$I64-1, false);
  2844. }
  2845. ModLaunch.McLaunchLog(Conversions.ToString(Operators.ConcatenateObject("启动器可见性:", ModBase.m_IdentifierRepository.Get("LaunchArgumentVisible", null))));
  2846. object left = ModBase.m_IdentifierRepository.Get("LaunchArgumentVisible", null);
  2847. if (Operators.ConditionalCompareObjectEqual(left, 0, false))
  2848. {
  2849. ModLaunch.McLaunchLog("已根据设置,在启动后关闭启动器");
  2850. ModBase.RunInUi((ModLaunch._Closure$__.$I64-2 == null) ? (ModLaunch._Closure$__.$I64-2 = delegate()
  2851. {
  2852. ModMain._ProcessIterator.EndProgram(false);
  2853. }) : ModLaunch._Closure$__.$I64-2, false);
  2854. }
  2855. else if (Conversions.ToBoolean(Conversions.ToBoolean(Operators.CompareObjectEqual(left, 2, false)) || Conversions.ToBoolean(Operators.CompareObjectEqual(left, 3, false))))
  2856. {
  2857. ModLaunch.McLaunchLog("已根据设置,在启动后隐藏启动器");
  2858. ModBase.RunInUi((ModLaunch._Closure$__.$I64-3 == null) ? (ModLaunch._Closure$__.$I64-3 = delegate()
  2859. {
  2860. ModMain._ProcessIterator.Hidden = true;
  2861. }) : ModLaunch._Closure$__.$I64-3, false);
  2862. }
  2863. else if (Operators.ConditionalCompareObjectEqual(left, 4, false))
  2864. {
  2865. ModLaunch.McLaunchLog("已根据设置,在启动后最小化启动器");
  2866. ModBase.RunInUi((ModLaunch._Closure$__.$I64-4 == null) ? (ModLaunch._Closure$__.$I64-4 = delegate()
  2867. {
  2868. ModMain._ProcessIterator.WindowState = WindowState.Minimized;
  2869. }) : ModLaunch._Closure$__.$I64-4, false);
  2870. }
  2871. else
  2872. {
  2873. Operators.ConditionalCompareObjectEqual(left, 5, false);
  2874. }
  2875. ModBase.m_IdentifierRepository.Set("SystemLaunchCount", Operators.AddObject(ModBase.m_IdentifierRepository.Get("SystemLaunchCount", null), 1), false, null);
  2876. }
  2877. // Token: 0x06000E28 RID: 3624 RVA: 0x00067140 File Offset: 0x00065340
  2878. private static string ArgumentReplace(string Raw, bool ReplaceTimeAndDate)
  2879. {
  2880. string result;
  2881. if (Raw == null)
  2882. {
  2883. result = null;
  2884. }
  2885. else
  2886. {
  2887. Raw = Raw.Replace("{minecraft}", ModMinecraft.m_ProxyTests);
  2888. Raw = Raw.Replace("{verpath}", ModMinecraft.AddClient().Path);
  2889. Raw = Raw.Replace("{verindie}", ModMinecraft.AddClient().ChangeMapper());
  2890. Raw = Raw.Replace("{java}", ModLaunch.m_RecordTests._UtilsRepository);
  2891. Raw = Raw.Replace("{user}", ModLaunch.interceptorTests.Output.Name);
  2892. Raw = Raw.Replace("{uuid}", ModLaunch.interceptorTests.Output.m_InstanceMap);
  2893. if (ReplaceTimeAndDate)
  2894. {
  2895. Raw = Raw.Replace("{date}", DateTime.Now.ToString("yyyy/M/d"));
  2896. Raw = Raw.Replace("{time}", DateTime.Now.ToString("HH:mm:ss"));
  2897. }
  2898. switch (ModLaunch.interceptorTests.Input.Type)
  2899. {
  2900. case ModLaunch.McLoginType.Legacy:
  2901. if (PageLinkHiper.EnableReader() == ModBase.LoadState.Finished)
  2902. {
  2903. Raw = Raw.Replace("{login}", "联机离线");
  2904. }
  2905. else
  2906. {
  2907. Raw = Raw.Replace("{login}", "离线");
  2908. }
  2909. break;
  2910. case ModLaunch.McLoginType.Nide:
  2911. Raw = Raw.Replace("{login}", "统一通行证");
  2912. break;
  2913. case ModLaunch.McLoginType.Auth:
  2914. Raw = Raw.Replace("{login}", "Authlib-Injector");
  2915. break;
  2916. case ModLaunch.McLoginType.Ms:
  2917. Raw = Raw.Replace("{login}", "正版");
  2918. break;
  2919. }
  2920. Raw = Raw.Replace("{name}", ModMinecraft.AddClient().Name);
  2921. if (Enumerable.Contains<string>(new string[]
  2922. {
  2923. "unknown",
  2924. "old",
  2925. "pending"
  2926. }, ModMinecraft.AddClient().Version._ConnectionMap.ToLower()))
  2927. {
  2928. Raw = Raw.Replace("{version}", ModMinecraft.AddClient().Name);
  2929. }
  2930. else
  2931. {
  2932. Raw = Raw.Replace("{version}", ModMinecraft.AddClient().Version._ConnectionMap);
  2933. }
  2934. Raw = Raw.Replace("{path}", ModBase.Path);
  2935. result = Raw;
  2936. }
  2937. return result;
  2938. }
  2939. // Token: 0x0400076E RID: 1902
  2940. public static ModLaunch.McLaunchOptions filterTests = null;
  2941. // Token: 0x0400076F RID: 1903
  2942. public static ModLoader.LoaderTask<ModLaunch.McLaunchOptions, object> databaseTests = new ModLoader.LoaderTask<ModLaunch.McLaunchOptions, object>("Loader Launch", new Action<ModLoader.LoaderTask<ModLaunch.McLaunchOptions, object>>(ModLaunch.McLaunchStart), null, ThreadPriority.Normal)
  2943. {
  2944. OnStateChanged = delegate(ModLoader.LoaderBase a0)
  2945. {
  2946. ModLaunch.McLaunchState((ModLoader.LoaderTask<ModLaunch.McLaunchOptions, object>)a0);
  2947. }
  2948. };
  2949. // Token: 0x04000770 RID: 1904
  2950. public static ModLoader.LoaderCombo<object> m_PredicateTests;
  2951. // Token: 0x04000771 RID: 1905
  2952. public static Process _PoolTests;
  2953. // Token: 0x04000772 RID: 1906
  2954. public static ModWatcher.Watcher customerTests;
  2955. // Token: 0x04000773 RID: 1907
  2956. private static string _PageTests = null;
  2957. // Token: 0x04000774 RID: 1908
  2958. public static ModLoader.LoaderTask<ModLaunch.McLoginData, ModLaunch.McLoginResult> interceptorTests = new ModLoader.LoaderTask<ModLaunch.McLoginData, ModLaunch.McLoginResult>("登录", new Action<ModLoader.LoaderTask<ModLaunch.McLoginData, ModLaunch.McLoginResult>>(ModLaunch.McLoginStart), new Func<ModLaunch.McLoginData>(ModLaunch.McLoginInput), ThreadPriority.BelowNormal)
  2959. {
  2960. ReloadTimeout = 1,
  2961. ProgressWeight = 15.0,
  2962. Block = false
  2963. };
  2964. // Token: 0x04000775 RID: 1909
  2965. public static ModLoader.LoaderTask<ModLaunch.McLoginMs, ModLaunch.McLoginResult> m_ContainerTests = new ModLoader.LoaderTask<ModLaunch.McLoginMs, ModLaunch.McLoginResult>("Loader Login Ms", new Action<ModLoader.LoaderTask<ModLaunch.McLoginMs, ModLaunch.McLoginResult>>(ModLaunch.McLoginMsStart), null, ThreadPriority.Normal)
  2966. {
  2967. ReloadTimeout = 1
  2968. };
  2969. // Token: 0x04000776 RID: 1910
  2970. public static ModLoader.LoaderTask<ModLaunch.McLoginLegacy, ModLaunch.McLoginResult> _ParamsTests = new ModLoader.LoaderTask<ModLaunch.McLoginLegacy, ModLaunch.McLoginResult>("Loader Login Legacy", new Action<ModLoader.LoaderTask<ModLaunch.McLoginLegacy, ModLaunch.McLoginResult>>(ModLaunch.McLoginLegacyStart), null, ThreadPriority.Normal);
  2971. // Token: 0x04000777 RID: 1911
  2972. public static ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult> dispatcherTests = new ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult>("Loader Login Nide", new Action<ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult>>(ModLaunch.McLoginServerStart), null, ThreadPriority.Normal)
  2973. {
  2974. ReloadTimeout = 600000
  2975. };
  2976. // Token: 0x04000778 RID: 1912
  2977. public static ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult> _ProcessTests = new ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult>("Loader Login Auth", new Action<ModLoader.LoaderTask<ModLaunch.McLoginServer, ModLaunch.McLoginResult>>(ModLaunch.McLoginServerStart), null, ThreadPriority.Normal)
  2978. {
  2979. ReloadTimeout = 600000
  2980. };
  2981. // Token: 0x04000779 RID: 1913
  2982. private static long m_ParameterTests = 0L;
  2983. // Token: 0x0400077A RID: 1914
  2984. public static ModJava.JavaEntry m_RecordTests = null;
  2985. // Token: 0x0400077B RID: 1915
  2986. private static string _ServiceTests;
  2987. // Token: 0x0400077C RID: 1916
  2988. private static object invocationTests = RuntimeHelpers.GetObjectValue(new object());
  2989. // Token: 0x02000161 RID: 353
  2990. public class McLaunchOptions
  2991. {
  2992. // Token: 0x06000E29 RID: 3625 RVA: 0x00008D9F File Offset: 0x00006F9F
  2993. public McLaunchOptions()
  2994. {
  2995. this.m_MockMap = null;
  2996. this.requestMap = null;
  2997. this._DicMap = null;
  2998. this._HelperMap = new List<string>();
  2999. }
  3000. // Token: 0x0400077D RID: 1917
  3001. public string m_MockMap;
  3002. // Token: 0x0400077E RID: 1918
  3003. public string requestMap;
  3004. // Token: 0x0400077F RID: 1919
  3005. public ModMinecraft.McVersion _DicMap;
  3006. // Token: 0x04000780 RID: 1920
  3007. public List<string> _HelperMap;
  3008. }
  3009. // Token: 0x02000162 RID: 354
  3010. public enum McLoginType
  3011. {
  3012. // Token: 0x04000782 RID: 1922
  3013. Legacy,
  3014. // Token: 0x04000783 RID: 1923
  3015. Nide = 2,
  3016. // Token: 0x04000784 RID: 1924
  3017. Auth,
  3018. // Token: 0x04000785 RID: 1925
  3019. Ms = 5
  3020. }
  3021. // Token: 0x02000163 RID: 355
  3022. public abstract class McLoginData
  3023. {
  3024. // Token: 0x06000E2C RID: 3628 RVA: 0x00008DC8 File Offset: 0x00006FC8
  3025. public override bool Equals(object obj)
  3026. {
  3027. return obj != null && obj.GetHashCode() == this.GetHashCode();
  3028. }
  3029. // Token: 0x04000786 RID: 1926
  3030. public ModLaunch.McLoginType Type;
  3031. }
  3032. // Token: 0x02000164 RID: 356
  3033. public class McLoginServer : ModLaunch.McLoginData
  3034. {
  3035. // Token: 0x06000E2E RID: 3630 RVA: 0x00008DDD File Offset: 0x00006FDD
  3036. public McLoginServer(ModLaunch.McLoginType Type)
  3037. {
  3038. this._IdentifierMap = false;
  3039. this.Type = Type;
  3040. }
  3041. // Token: 0x06000E2F RID: 3631 RVA: 0x0006735C File Offset: 0x0006555C
  3042. public override int GetHashCode()
  3043. {
  3044. return Convert.ToInt32(decimal.Remainder(new decimal(ModBase.GetHash(string.Concat(new string[]
  3045. {
  3046. this.m_IssuerMap,
  3047. this._IndexerMap,
  3048. this.interpreterMap,
  3049. this.m_SerializerMap,
  3050. Conversions.ToString((int)this.Type)
  3051. }))), 2147483647m));
  3052. }
  3053. // Token: 0x04000787 RID: 1927
  3054. public string m_IssuerMap;
  3055. // Token: 0x04000788 RID: 1928
  3056. public string _IndexerMap;
  3057. // Token: 0x04000789 RID: 1929
  3058. public string interpreterMap;
  3059. // Token: 0x0400078A RID: 1930
  3060. public string m_SerializerMap;
  3061. // Token: 0x0400078B RID: 1931
  3062. public string m_WatcherMap;
  3063. // Token: 0x0400078C RID: 1932
  3064. public bool _IdentifierMap;
  3065. }
  3066. // Token: 0x02000165 RID: 357
  3067. public class McLoginMs : ModLaunch.McLoginData
  3068. {
  3069. // Token: 0x06000E31 RID: 3633 RVA: 0x000673C8 File Offset: 0x000655C8
  3070. public McLoginMs()
  3071. {
  3072. this.m_SystemMap = "";
  3073. this.paramMap = "";
  3074. this._TagMap = "";
  3075. this.observerMap = "";
  3076. this.stubMap = "";
  3077. this.Type = ModLaunch.McLoginType.Ms;
  3078. }
  3079. // Token: 0x06000E32 RID: 3634 RVA: 0x0006741C File Offset: 0x0006561C
  3080. public override int GetHashCode()
  3081. {
  3082. return Convert.ToInt32(decimal.Remainder(new decimal(ModBase.GetHash(string.Concat(new string[]
  3083. {
  3084. this.m_SystemMap,
  3085. this.paramMap,
  3086. this._TagMap,
  3087. this.observerMap,
  3088. this.stubMap
  3089. }))), 2147483647m));
  3090. }
  3091. // Token: 0x0400078D RID: 1933
  3092. public string m_SystemMap;
  3093. // Token: 0x0400078E RID: 1934
  3094. public string paramMap;
  3095. // Token: 0x0400078F RID: 1935
  3096. public string _TagMap;
  3097. // Token: 0x04000790 RID: 1936
  3098. public string observerMap;
  3099. // Token: 0x04000791 RID: 1937
  3100. public string stubMap;
  3101. }
  3102. // Token: 0x02000166 RID: 358
  3103. public class McLoginLegacy : ModLaunch.McLoginData
  3104. {
  3105. // Token: 0x06000E34 RID: 3636 RVA: 0x00008DF4 File Offset: 0x00006FF4
  3106. public McLoginLegacy()
  3107. {
  3108. this.Type = ModLaunch.McLoginType.Legacy;
  3109. }
  3110. // Token: 0x06000E35 RID: 3637 RVA: 0x00067484 File Offset: 0x00065684
  3111. public override int GetHashCode()
  3112. {
  3113. return Convert.ToInt32(decimal.Remainder(new decimal(ModBase.GetHash(this.m_RulesMap + Conversions.ToString(this.m_RefMap) + this._DecoratorMap + Conversions.ToString((int)this.Type))), 2147483647m));
  3114. }
  3115. // Token: 0x04000792 RID: 1938
  3116. public string m_RulesMap;
  3117. // Token: 0x04000793 RID: 1939
  3118. public int m_RefMap;
  3119. // Token: 0x04000794 RID: 1940
  3120. public string _DecoratorMap;
  3121. }
  3122. // Token: 0x02000167 RID: 359
  3123. public struct McLoginResult
  3124. {
  3125. // Token: 0x04000795 RID: 1941
  3126. public string Name;
  3127. // Token: 0x04000796 RID: 1942
  3128. public string m_InstanceMap;
  3129. // Token: 0x04000797 RID: 1943
  3130. public string _StateMap;
  3131. // Token: 0x04000798 RID: 1944
  3132. public string Type;
  3133. // Token: 0x04000799 RID: 1945
  3134. public string _CallbackMap;
  3135. // Token: 0x0400079A RID: 1946
  3136. public string _TemplateMap;
  3137. }
  3138. }
  3139. }