Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.17 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: #2b.#rd
  3. // Assembly: osu!, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
  4. // MVID: 10148CFD-FC95-4E89-8CEB-E7D9576A739C
  5. // Assembly location: C:\Program Files (x86)\osu\osu!.exe
  6.  
  7. using \u00232b;
  8. using \u0023c;
  9. using \u0023lb;
  10. using \u0023T;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.IO;
  14. using System.Runtime.CompilerServices;
  15. using System.Runtime.InteropServices;
  16. using System.Security.Cryptography;
  17. using System.Text;
  18. using System.Threading;
  19.  
  20. namespace \u00232b
  21. {
  22. internal sealed class \u0023rd : IDisposable
  23. {
  24. private bool \u0023b = true;
  25. private object \u0023a = new object();
  26. private static readonly MD5CryptoServiceProvider \u0023a = new MD5CryptoServiceProvider();
  27. private static byte[] \u0023a = new byte[32]
  28. {
  29. (byte) 216,
  30. (byte) 98,
  31. (byte) 163,
  32. (byte) 48,
  33. (byte) 2,
  34. (byte) 109,
  35. (byte) 118,
  36. (byte) 89,
  37. (byte) 244,
  38. (byte) 247,
  39. (byte) 37,
  40. (byte) 194,
  41. (byte) 235,
  42. (byte) 70,
  43. (byte) 174,
  44. (byte) 52,
  45. (byte) 13,
  46. (byte) 106,
  47. (byte) 97,
  48. (byte) 84,
  49. (byte) 242,
  50. (byte) 62,
  51. (byte) 186,
  52. (byte) 48,
  53. (byte) 25,
  54. (byte) 66,
  55. (byte) 72,
  56. (byte) 85,
  57. (byte) 242,
  58. (byte) 22,
  59. (byte) 15,
  60. (byte) 92
  61. };
  62. private static readonly byte[] \u0023c = new byte[64];
  63. private byte[] \u0023b;
  64. private string \u0023a;
  65. private Dictionary<string, \u00231b> \u0023a;
  66. private Dictionary<string, byte[]> \u0023a;
  67. private long \u0023a;
  68. private byte[] \u0023d;
  69. private SortedDictionary<string, int> \u0023a;
  70. private Dictionary<string, DateTime> \u0023a;
  71. private Dictionary<string, DateTime> \u0023b;
  72. private Dictionary<string, bool> \u0023a;
  73. private List<\u0023td> \u0023a;
  74. private Dictionary<\u00233b, string> \u0023a;
  75. private Stream \u0023a;
  76. internal bool \u0023a;
  77. private bool \u0023c;
  78. private bool \u0023d;
  79. private bool \u0023e;
  80. private int \u0023a;
  81. private int \u0023b;
  82. private long \u0023b;
  83.  
  84. static \u0023rd()
  85. {
  86. new \u00232(1990).\u0023Cr(\u0023rd.\u0023c);
  87. }
  88.  
  89. public \u0023rd([In] string obj0)
  90. : this(obj0, (byte[]) null, false, false)
  91. {
  92. }
  93.  
  94. public \u0023rd([In] Stream obj0, [In] bool obj1)
  95. {
  96. this.\u0023a = obj0;
  97. try
  98. {
  99. this.\u0023js(obj1);
  100. }
  101. catch (Exception ex)
  102. {
  103. this.Close();
  104. throw;
  105. }
  106. }
  107.  
  108. public \u0023rd([In] string obj0, [In] byte[] obj1, [In] bool obj2, [In] bool obj3)
  109. {
  110. this.\u0023e = !File.Exists(obj0);
  111. if (this.\u0023e && !obj2)
  112. throw new IOException(\u0023b.Get(40631) + obj0 + \u0023b.Get(40660));
  113. if (obj1 != null)
  114. this.\u0023b = obj1;
  115. try
  116. {
  117. this.\u0023a = obj0;
  118. if (!this.\u0023e)
  119. this.\u0023a = (Stream) File.Open(obj0, FileMode.Open, FileAccess.Read, FileShare.Read);
  120. this.\u0023js(false);
  121. }
  122. catch (Exception ex)
  123. {
  124. this.Close();
  125. throw;
  126. }
  127. }
  128.  
  129. ~\u0023rd()
  130. {
  131. this.Dispose(false);
  132. }
  133.  
  134. [SpecialName]
  135. public int \u0023qC()
  136. {
  137. return this.\u0023a;
  138. }
  139.  
  140. private void \u0023js([In] bool obj0)
  141. {
  142. this.\u0023a = new Dictionary<\u00233b, string>();
  143. this.\u0023a = new Dictionary<string, \u00231b>((IEqualityComparer<string>) StringComparer.CurrentCultureIgnoreCase);
  144. this.\u0023a = new SortedDictionary<string, int>();
  145. this.\u0023a = new Dictionary<string, DateTime>();
  146. this.\u0023b = new Dictionary<string, DateTime>();
  147. this.\u0023a = new Dictionary<string, bool>();
  148. this.\u0023a = new List<\u0023td>();
  149. this.\u0023a = new Dictionary<string, byte[]>((IEqualityComparer<string>) StringComparer.CurrentCultureIgnoreCase);
  150. this.\u0023d = false;
  151. this.\u0023c = false;
  152. this.\u0023a = false;
  153. if (this.\u0023e)
  154. {
  155. this.\u0023a = 0;
  156. this.\u0023b = 0;
  157. using (\u0023kb kb = (\u0023kb) new \u0023mb())
  158. {
  159. kb.GenerateIV();
  160. this.\u0023d = new byte[kb.IV.Length];
  161. Array.Copy((Array) kb.IV, (Array) this.\u0023d, this.\u0023d.Length);
  162. kb.Clear();
  163. }
  164. }
  165. else
  166. {
  167. BinaryReader binaryReader = new BinaryReader(this.\u0023a);
  168. byte[] numArray = binaryReader.ReadBytes(3);
  169. if (numArray.Length < 3 || (int) numArray[0] != 236 || ((int) numArray[1] != 72 || (int) numArray[2] != 79))
  170. throw new IOException(\u0023b.Get(40665));
  171. int num1 = (int) binaryReader.ReadByte();
  172. this.\u0023d = binaryReader.ReadBytes(16);
  173. // ISSUE: reference to a compiler-generated method
  174. this.\u0023lC(binaryReader.ReadBytes(16));
  175. // ISSUE: reference to a compiler-generated method
  176. this.\u0023nC(binaryReader.ReadBytes(16));
  177. // ISSUE: reference to a compiler-generated method
  178. this.\u0023pC(binaryReader.ReadBytes(16));
  179. using (MemoryStream memoryStream = new MemoryStream())
  180. {
  181. using (BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream))
  182. {
  183. int num2 = binaryReader.ReadInt32();
  184. binaryWriter.Write(num2);
  185. for (int index = 0; index < num2; ++index)
  186. {
  187. short num3 = binaryReader.ReadInt16();
  188. string str = binaryReader.ReadString();
  189. if (Enum.IsDefined(typeof (\u00233b), (object) (int) num3))
  190. this.\u0023a.Add((\u00233b) num3, str);
  191. binaryWriter.Write(num3);
  192. binaryWriter.Write(str);
  193. }
  194. binaryWriter.Flush();
  195. // ISSUE: reference to a compiler-generated method
  196. if (!\u00237.\u0023cs(\u0023rd.\u0023yC(memoryStream.ToArray(), num2 * 3, (byte) 167), this.\u0023kC()))
  197. throw new IOException(\u0023b.Get(40686));
  198. binaryWriter.Close();
  199. }
  200. }
  201. int num4 = binaryReader.ReadInt32();
  202. for (int index = 0; index < num4; ++index)
  203. this.\u0023a.Add(binaryReader.ReadString(), binaryReader.ReadInt32());
  204. if (this.\u0023b == null)
  205. this.\u0023b = \u0023rd.\u0023AC(Encoding.ASCII.GetBytes(this.\u0023a[\u00233b.\u0023c] + \u0023b.Get(40727) + this.\u0023a[\u00233b.\u0023j]));
  206. if (obj0)
  207. this.\u0023b = binaryReader.BaseStream.Position;
  208. else
  209. this.\u0023tC(binaryReader);
  210. }
  211. }
  212.  
  213. private void \u0023tC([In] BinaryReader obj0)
  214. {
  215. // ISSUE: reference to a compiler-generated method
  216. this.\u0023GC(true);
  217. using (\u00231 obj = new \u00231(obj0.BaseStream, \u0023Z.\u0023a, this.\u0023b))
  218. {
  219. byte[] buffer = new byte[64];
  220. obj.Read(buffer, 0, 64);
  221. if (!\u00237.\u0023cs(buffer, \u0023rd.\u0023c))
  222. throw new Exception(\u0023b.Get(40740));
  223. }
  224. this.\u0023b = (int) obj0.BaseStream.Position;
  225. int count = obj0.ReadInt32();
  226. int index1 = 0;
  227. while (index1 < 16)
  228. {
  229. // ISSUE: reference to a compiler-generated method
  230. // ISSUE: reference to a compiler-generated method
  231. count -= (int) this.\u0023mC()[index1] | (int) this.\u0023mC()[index1 + 1] << 17;
  232. index1 += 2;
  233. }
  234. byte[] buffer1 = obj0.ReadBytes(count);
  235. this.\u0023a = (int) obj0.BaseStream.Position;
  236. for (int index2 = 0; index2 < this.\u0023d.Length; ++index2)
  237. {
  238. // ISSUE: reference to a compiler-generated method
  239. this.\u0023d[index2] ^= this.\u0023oC()[index2 % 16];
  240. }
  241. using (\u0023kb kb = (\u0023kb) new \u0023mb())
  242. {
  243. kb.IV = this.\u0023d;
  244. kb.Key = this.\u0023b;
  245. using (MemoryStream memoryStream = new MemoryStream(buffer1))
  246. {
  247. using (Stream input = (Stream) new \u00231((Stream) memoryStream, \u0023Z.\u0023b, this.\u0023b))
  248. {
  249. using (BinaryReader binaryReader = new BinaryReader(input))
  250. {
  251. int num1 = binaryReader.ReadInt32();
  252. // ISSUE: reference to a compiler-generated method
  253. if (!\u00237.\u0023cs(\u0023rd.\u0023yC(buffer1, num1 * 4, (byte) 209), this.\u0023mC()))
  254. throw new IOException(\u0023b.Get(40686));
  255. int num2 = binaryReader.ReadInt32();
  256. for (int index2 = 0; index2 < num1; ++index2)
  257. {
  258. string key = binaryReader.ReadString();
  259. byte[] numArray = binaryReader.ReadBytes(16);
  260. DateTime dateTime1 = DateTime.FromBinary(binaryReader.ReadInt64());
  261. DateTime dateTime2 = DateTime.FromBinary(binaryReader.ReadInt64());
  262. int num3 = index2 + 1 >= num1 ? (int) obj0.BaseStream.Length - this.\u0023a : binaryReader.ReadInt32();
  263. int num4 = num3 - num2;
  264. if (\u0023rd.\u0023EC(key))
  265. {
  266. long position = obj0.BaseStream.Position;
  267. bool flag;
  268. if ((long) (this.\u0023a + num2 + num4 / 2 - 512 + 4) >= obj0.BaseStream.Length || num4 < 1024)
  269. {
  270. flag = true;
  271. }
  272. else
  273. {
  274. byte[] buffer2 = new byte[1024];
  275. using (\u0023td td = new \u0023td(this.\u0023hw(), this.\u0023a + num2, num4 - 4, this.\u0023d, this.\u0023b))
  276. {
  277. int num5 = (num4 - 4) / 2;
  278. td.Seek((long) (num5 - num5 % 16 - 512 + 16), SeekOrigin.Begin);
  279. td.Read(buffer2, 0, 1024);
  280. obj0.BaseStream.Position = position;
  281. }
  282. flag = !BitConverter.ToString(\u0023rd.\u0023a.ComputeHash(buffer2)).Replace(\u0023b.Get(6336), \u0023b.Get(32761)).Equals(this.\u0023a[\u00233b.\u0023i]);
  283. }
  284. if (flag)
  285. {
  286. this.\u0023b = false;
  287. // ISSUE: reference to a compiler-generated method
  288. this.\u0023sC(true);
  289. num2 = num3;
  290. continue;
  291. }
  292. }
  293. this.\u0023a.Add(key, new \u00231b(key, num2, num4, numArray, dateTime1, dateTime2));
  294. num2 = num3;
  295. }
  296. binaryReader.Close();
  297. }
  298. }
  299. }
  300. kb.Clear();
  301. }
  302. this.\u0023a.Seek(0L, SeekOrigin.Begin);
  303. }
  304.  
  305. private void \u0023uC([In] Dictionary<string, byte[]> obj0, [In] ICryptoTransform obj1)
  306. {
  307. string[] array = new string[obj0.Keys.Count];
  308. obj0.Keys.CopyTo(array, 0);
  309. foreach (string index in array)
  310. {
  311. using (MemoryStream memoryStream = new MemoryStream())
  312. {
  313. using (Stream output = (Stream) new \u00231((Stream) memoryStream, \u0023Z.\u0023b, this.\u0023b))
  314. {
  315. using (BinaryWriter binaryWriter = new BinaryWriter(output))
  316. {
  317. binaryWriter.Write(obj0[index].Length);
  318. if (!this.\u0023a[index])
  319. binaryWriter.Write(obj0[index]);
  320. else
  321. memoryStream.Write(obj0[index], 0, obj0[index].Length);
  322. output.Flush();
  323. obj0[index] = memoryStream.ToArray();
  324. binaryWriter.Close();
  325. }
  326. }
  327. }
  328. }
  329. }
  330.  
  331. private static byte[] \u0023vC([In] SortedDictionary<string, byte[]> obj0)
  332. {
  333. using (MemoryStream memoryStream = new MemoryStream())
  334. {
  335. using (BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream))
  336. {
  337. foreach (byte[] buffer in obj0.Values)
  338. binaryWriter.Write(buffer);
  339. binaryWriter.Flush();
  340. byte[] numArray = memoryStream.ToArray();
  341. binaryWriter.Close();
  342. return numArray;
  343. }
  344. }
  345. }
  346.  
  347. private byte[] \u0023wC([In] SortedDictionary<string, byte[]> obj0, [In] Dictionary<string, byte[]> obj1, [In] Dictionary<string, DateTime> obj2, [In] Dictionary<string, DateTime> obj3, [In] ICryptoTransform obj4)
  348. {
  349. using (MemoryStream memoryStream = new MemoryStream())
  350. {
  351. using (\u00231 obj5 = new \u00231((Stream) memoryStream, \u0023Z.\u0023b, this.\u0023b))
  352. {
  353. using (BinaryWriter binaryWriter = new BinaryWriter((Stream) obj5))
  354. {
  355. binaryWriter.Write(obj0.Count);
  356. int num = 0;
  357. foreach (KeyValuePair<string, byte[]> keyValuePair in obj0)
  358. {
  359. binaryWriter.Write(num);
  360. binaryWriter.Write(keyValuePair.Key);
  361. using (\u00231 obj6 = new \u00231((Stream) new MemoryStream(keyValuePair.Value, false), \u0023Z.\u0023b, this.\u0023b))
  362. {
  363. byte[] buffer = new byte[keyValuePair.Value.Length];
  364. obj6.Read(buffer, 0, keyValuePair.Value.Length);
  365. byte[] hash = \u0023rd.\u0023a.ComputeHash(buffer, 4, keyValuePair.Value.Length - 4);
  366. binaryWriter.Write(hash);
  367. binaryWriter.Write(obj2[keyValuePair.Key].ToBinary());
  368. binaryWriter.Write(obj3[keyValuePair.Key].ToBinary());
  369. obj1[keyValuePair.Key] = hash;
  370. }
  371. num += keyValuePair.Value.Length;
  372. }
  373. obj5.Flush();
  374. binaryWriter.Flush();
  375. byte[] numArray = memoryStream.ToArray();
  376. obj5.Close();
  377. binaryWriter.Close();
  378. return numArray;
  379. }
  380. }
  381. }
  382. }
  383.  
  384. private static byte[] \u0023xC([In] Dictionary<\u00233b, string> obj0)
  385. {
  386. using (MemoryStream memoryStream = new MemoryStream())
  387. {
  388. using (BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream))
  389. {
  390. binaryWriter.Write(obj0.Count);
  391. foreach (KeyValuePair<\u00233b, string> keyValuePair in obj0)
  392. {
  393. binaryWriter.Write((ushort) keyValuePair.Key);
  394. binaryWriter.Write(keyValuePair.Value ?? string.Empty);
  395. }
  396. binaryWriter.Close();
  397. return memoryStream.ToArray();
  398. }
  399. }
  400. }
  401.  
  402. private static byte[] \u0023yC([In] byte[] obj0, [In] int obj1, [In] byte obj2)
  403. {
  404. try
  405. {
  406. obj0[obj1] ^= obj2;
  407. byte[] hash = \u0023rd.\u0023a.ComputeHash(obj0);
  408. obj0[obj1] ^= obj2;
  409. for (int index = 0; index < 8; ++index)
  410. {
  411. byte num = hash[index];
  412. hash[index] = hash[index + 8];
  413. hash[index + 8] = num;
  414. }
  415. hash[5] ^= (byte) 45;
  416. return hash;
  417. }
  418. catch (Exception ex)
  419. {
  420. throw new IOException(\u0023b.Get(40686));
  421. }
  422. }
  423.  
  424. private byte[] \u0023zC([In] Stream obj0, [In] int obj1, [In] byte obj2)
  425. {
  426. long position = obj0.Position;
  427. long length = obj0.Length - position;
  428. string str = this.\u0023LC(\u00233b.\u0023g);
  429. byte[] buffer;
  430. if (!string.IsNullOrEmpty(str))
  431. {
  432. long num1 = Convert.ToInt64(str);
  433. long num2 = Convert.ToInt64(this.\u0023LC(\u00233b.\u0023h));
  434. buffer = new byte[length - num2];
  435. obj0.Read(buffer, 0, (int) num1);
  436. long num3 = obj0.Position + num2;
  437. if (num3 >= obj0.Length)
  438. {
  439. obj0.Position = num3;
  440. obj0.Read(buffer, (int) (obj0.Position - position - num2), (int) (obj0.Length - obj0.Position));
  441. }
  442. obj1 %= (int) (length - num2);
  443. }
  444. else
  445. {
  446. buffer = new byte[length];
  447. obj0.Read(buffer, 0, buffer.Length);
  448. }
  449. return \u0023rd.\u0023yC(buffer, obj1, obj2);
  450. }
  451.  
  452. public static byte[] \u0023AC([In] byte[] obj0)
  453. {
  454. return \u0023rd.\u0023a.ComputeHash(obj0);
  455. }
  456.  
  457. public static bool \u0023BC([In] string obj0)
  458. {
  459. string str = Path.GetExtension(obj0).ToLower();
  460. if (!(str == \u0023b.Get(40757)))
  461. return str == \u0023b.Get(40766);
  462. return true;
  463. }
  464.  
  465. public static bool \u0023CC([In] string obj0)
  466. {
  467. string str = Path.GetExtension(obj0).ToLower();
  468. if (!(str == \u0023b.Get(40775)))
  469. return str == \u0023b.Get(40784);
  470. return true;
  471. }
  472.  
  473. public static bool \u0023DC([In] string obj0)
  474. {
  475. if (!(Path.GetExtension(obj0).ToLower() == \u0023b.Get(40793)))
  476. return Path.GetExtension(obj0).ToLower() == \u0023b.Get(40802);
  477. return true;
  478. }
  479.  
  480. public static bool \u0023EC([In] string obj0)
  481. {
  482. string str = Path.GetExtension(obj0).ToLower();
  483. if (!(str == \u0023b.Get(40807)) && !(str == \u0023b.Get(40816)))
  484. return str == \u0023b.Get(40825);
  485. return true;
  486. }
  487.  
  488. [SpecialName]
  489. public string \u0023hw()
  490. {
  491. return this.\u0023a;
  492. }
  493.  
  494. [SpecialName]
  495. public string[] \u0023HC()
  496. {
  497. this.\u0023XC();
  498. string[] array = new string[this.\u0023a.Count];
  499. this.\u0023a.Keys.CopyTo(array, 0);
  500. return array;
  501. }
  502.  
  503. public int \u0023IC([In] string obj0)
  504. {
  505. if (!this.\u0023a.ContainsKey(obj0))
  506. return -2;
  507. return this.\u0023a[obj0];
  508. }
  509.  
  510. public void \u0023JC([In] string obj0, [In] int obj1)
  511. {
  512. if (!this.\u0023a.ContainsKey(obj0))
  513. throw new Exception(\u0023b.Get(40834));
  514. if (this.\u0023a.ContainsValue(obj1) && obj1 != -1 && this.\u0023IC(obj0) != obj1)
  515. throw new Exception(\u0023b.Get(40887));
  516. this.\u0023a[obj0] = obj1;
  517. }
  518.  
  519. public bool \u0023KC([In] string obj0)
  520. {
  521. if (!this.\u0023a.ContainsKey(obj0))
  522. return this.\u0023a.ContainsKey(obj0);
  523. return true;
  524. }
  525.  
  526. public string \u0023LC([In] \u00233b obj0)
  527. {
  528. this.\u0023XC();
  529. string str;
  530. this.\u0023a.TryGetValue(obj0, out str);
  531. return str;
  532. }
  533.  
  534. public Stream \u0023MC([In] string obj0)
  535. {
  536. return this.\u0023MC(obj0, false);
  537. }
  538.  
  539. public Stream \u0023MC([In] string obj0, [In] bool obj1)
  540. {
  541. this.\u0023XC();
  542. Stream stream = (Stream) null;
  543. if (this.\u0023a.ContainsKey(obj0))
  544. {
  545. if (!obj1)
  546. {
  547. // ISSUE: reference to a compiler-generated method
  548. // ISSUE: reference to a compiler-generated method
  549. \u0023td td = new \u0023td(this.\u0023a, this.\u0023a + this.\u0023a[obj0].\u0023kw(), this.\u0023a[obj0].get_Length(), this.\u0023d, this.\u0023b);
  550. this.\u0023a.Add(td);
  551. td.\u00232C(new \u0023td.\u0023ud(this.\u0023NC));
  552. stream = (Stream) td;
  553. }
  554. else
  555. {
  556. // ISSUE: reference to a compiler-generated method
  557. byte[] buffer = new byte[this.\u0023a[obj0].get_Length() - 4];
  558. FileStream fileStream = File.Open(this.\u0023a, FileMode.Open, FileAccess.Read, FileShare.Read);
  559. // ISSUE: reference to a compiler-generated method
  560. fileStream.Seek((long) (this.\u0023a + this.\u0023a[obj0].\u0023kw() + 4), SeekOrigin.Begin);
  561. fileStream.Read(buffer, 0, buffer.Length);
  562. stream = (Stream) new MemoryStream(buffer, false);
  563. }
  564. }
  565. else if (this.\u0023a.ContainsKey(obj0))
  566. stream = (Stream) new MemoryStream(this.\u0023a[obj0], false);
  567. return stream;
  568. }
  569.  
  570. private void \u0023NC([In] \u0023td obj0)
  571. {
  572. if (this.\u0023a || !this.\u0023a.Contains(obj0))
  573. return;
  574. this.\u0023a.Remove(obj0);
  575. }
  576.  
  577. public void \u0023OC([In] \u00233b obj0, [In] string obj1)
  578. {
  579. this.\u0023XC();
  580. this.\u0023a[obj0] = obj1;
  581. this.\u0023d = true;
  582. switch (obj0)
  583. {
  584. case \u00233b.\u0023c:
  585. case \u00233b.\u0023j:
  586. string str1;
  587. this.\u0023a.TryGetValue(\u00233b.\u0023c, out str1);
  588. string str2;
  589. this.\u0023a.TryGetValue(\u00233b.\u0023j, out str2);
  590. if (str1 == null || str2 == null || this.\u0023b != null && this.\u0023b != \u0023rd.\u0023a)
  591. break;
  592. this.\u0023b = \u0023rd.\u0023AC(Encoding.ASCII.GetBytes(str1 + \u0023b.Get(40727) + str2));
  593. break;
  594. }
  595. }
  596.  
  597. public void \u0023PC([In] string obj0, [In] bool obj1)
  598. {
  599. this.\u0023XC();
  600. obj0 = \u00237.\u0023pac(obj0);
  601. string[] strArray;
  602. if (!obj1)
  603. {
  604. strArray = Directory.GetFiles(obj0);
  605. }
  606. else
  607. {
  608. List<string> list = new List<string>();
  609. Stack<string> stack = new Stack<string>();
  610. stack.Push(obj0);
  611. while (stack.Count > 0)
  612. {
  613. string path = stack.Pop();
  614. foreach (string str in Directory.GetFiles(path))
  615. list.Add(str);
  616. foreach (string str in Directory.GetDirectories(path))
  617. stack.Push(str);
  618. }
  619. strArray = list.ToArray();
  620. }
  621. foreach (string path in strArray)
  622. {
  623. if (!\u0023rd.\u0023DC(path))
  624. this.\u0023QC(\u00237.\u0023Wdc(path, obj0), path, File.GetCreationTimeUtc(path), File.GetLastWriteTimeUtc(path));
  625. }
  626. this.\u0023c = true;
  627. }
  628.  
  629. public void \u0023QC([In] string obj0, [In] string obj1, [In] DateTime obj2, [In] DateTime obj3)
  630. {
  631. this.\u0023XC();
  632. if (\u0023rd.\u0023DC(obj0))
  633. throw new IOException(\u0023b.Get(40936));
  634. byte[] buffer;
  635. using (FileStream fileStream = File.OpenRead(obj1))
  636. {
  637. buffer = new byte[fileStream.Length];
  638. fileStream.Read(buffer, 0, (int) fileStream.Length);
  639. fileStream.Close();
  640. }
  641. this.\u0023QC(obj0, buffer, obj2, obj3);
  642. this.\u0023c = true;
  643. }
  644.  
  645. public void \u0023QC([In] string obj0, [In] byte[] obj1, [In] DateTime obj2, [In] DateTime obj3)
  646. {
  647. this.\u0023QC(obj0, obj1, obj2, obj3, false);
  648. }
  649.  
  650. public void \u0023QC([In] string obj0, [In] byte[] obj1, [In] DateTime obj2, [In] DateTime obj3, [In] bool obj4)
  651. {
  652. this.\u0023XC();
  653. if (\u0023rd.\u0023DC(obj0))
  654. throw new IOException(\u0023b.Get(40936));
  655. if (\u0023rd.\u0023BC(obj0) && !this.\u0023a.ContainsKey(obj0))
  656. this.\u0023a.Add(obj0, -1);
  657. if (\u0023rd.\u0023EC(obj0))
  658. {
  659. if (obj1.Length < 1024)
  660. throw new IOException(\u0023b.Get(41001));
  661. long num = this.\u0023a;
  662. foreach (KeyValuePair<string, \u00231b> keyValuePair in this.\u0023a)
  663. {
  664. // ISSUE: reference to a compiler-generated method
  665. num += (long) keyValuePair.Value.get_Length();
  666. }
  667. byte[] buffer = new byte[1024];
  668. Array.Copy((Array) obj1, obj1.LongLength / 2L - obj1.LongLength / 2L % 16L - 512L + 16L, (Array) buffer, 0L, 1024L);
  669. byte[] hash = \u0023rd.\u0023a.ComputeHash(buffer);
  670. this.\u0023OC(\u00233b.\u0023g, Convert.ToString(num));
  671. this.\u0023OC(\u00233b.\u0023h, Convert.ToString(obj1.Length));
  672. this.\u0023OC(\u00233b.\u0023i, BitConverter.ToString(hash).Replace(\u0023b.Get(6336), \u0023b.Get(32761)));
  673. this.\u0023d = true;
  674. }
  675. this.\u0023a[obj0] = obj1;
  676. this.\u0023a[obj0] = obj2;
  677. this.\u0023b[obj0] = obj3;
  678. this.\u0023a[obj0] = obj4;
  679. this.\u0023a += obj1.LongLength;
  680. if (this.\u0023a.ContainsKey(obj0))
  681. this.\u0023a.Remove(obj0);
  682. this.\u0023c = true;
  683. }
  684.  
  685. public void \u0023RC([In] string obj0)
  686. {
  687. this.\u0023XC();
  688. bool flag = false;
  689. if (this.\u0023a.ContainsKey(obj0))
  690. {
  691. this.\u0023a.Remove(obj0);
  692. flag = true;
  693. }
  694. if (this.\u0023a.ContainsKey(obj0))
  695. {
  696. this.\u0023a.Remove(obj0);
  697. this.\u0023a.Remove(obj0);
  698. this.\u0023b.Remove(obj0);
  699. this.\u0023a.Remove(obj0);
  700. flag = true;
  701. }
  702. if (!flag)
  703. return;
  704. this.\u0023c = true;
  705. if (!this.\u0023a.ContainsKey(obj0))
  706. return;
  707. this.\u0023a.Remove(obj0);
  708. }
  709.  
  710. public static void \u0023SC([In] string obj0, [In] List<\u00231b> obj1, [In] int obj2, [In] long obj3)
  711. {
  712. // ISSUE: reference to a compiler-generated method
  713. // ISSUE: reference to a compiler-generated method
  714. obj1_1.Sort((Comparison<\u00231b>) ((obj0_2, obj1_2) => obj0_2.\u0023kw() - obj1_2.\u0023kw()));
  715. using (BinaryWriter binaryWriter = new BinaryWriter((Stream) new MemoryStream()))
  716. {
  717. binaryWriter.Write(new byte[obj2]);
  718. using (\u0023rd rd = new \u0023rd(obj0_1))
  719. {
  720. using (FileStream fileStream = File.OpenRead(obj0_1))
  721. {
  722. int num = rd.\u0023qC();
  723. foreach (\u00231b obj1 in obj1_1)
  724. {
  725. // ISSUE: reference to a compiler-generated method
  726. if (rd.\u0023a.ContainsKey(obj1.\u0023hw()))
  727. {
  728. // ISSUE: reference to a compiler-generated method
  729. \u00231b obj4 = rd.\u0023a[obj1.\u0023hw()];
  730. // ISSUE: reference to a compiler-generated method
  731. long length = (long) obj1.\u0023kw() - binaryWriter.BaseStream.Position;
  732. if (length > 0L)
  733. binaryWriter.Write(new byte[length]);
  734. // ISSUE: reference to a compiler-generated method
  735. byte[] buffer = new byte[obj1.get_Length()];
  736. // ISSUE: reference to a compiler-generated method
  737. binaryWriter.Seek(obj1.\u0023kw() + obj2, SeekOrigin.Begin);
  738. // ISSUE: reference to a compiler-generated method
  739. fileStream.Seek((long) (obj4.\u0023kw() + num), SeekOrigin.Begin);
  740. fileStream.Read(buffer, 0, buffer.Length);
  741. binaryWriter.Write(buffer);
  742. }
  743. }
  744. }
  745. }
  746. binaryWriter.Seek(0, SeekOrigin.Begin);
  747. using (FileStream fileStream = File.Open(obj0_1, FileMode.Create))
  748. {
  749. byte[] buffer = new byte[524288];
  750. Stream baseStream = binaryWriter.BaseStream;
  751. int count;
  752. while ((count = baseStream.Read(buffer, 0, 524288)) > 0)
  753. fileStream.Write(buffer, 0, count);
  754. long position = fileStream.Position;
  755. }
  756. }
  757. }
  758.  
  759. public List<\u00231b> \u0023TC()
  760. {
  761. List<\u00231b> list = new List<\u00231b>();
  762. foreach (\u00231b obj in this.\u0023a.Values)
  763. list.Add(obj);
  764. return list;
  765. }
  766.  
  767. public bool \u0023UC()
  768. {
  769. return this.\u0023UC(false);
  770. }
  771.  
  772. public bool \u0023UC([In] bool obj0)
  773. {
  774. this.\u0023XC();
  775. if (!this.\u0023b && !obj0)
  776. throw new Exception(\u0023b.Get(41058));
  777. if (!this.\u0023c && !this.\u0023d)
  778. return false;
  779. if (this.\u0023a.Count != 0)
  780. throw new IOException(\u0023b.Get(41179));
  781. if (this.\u0023a.Count + this.\u0023a.Count == 0)
  782. throw new IOException(\u0023b.Get(41228));
  783. if (this.\u0023a != null)
  784. this.\u0023a.Close();
  785. byte[] numArray1 = (byte[]) null;
  786. if (this.\u0023e)
  787. {
  788. this.\u0023c = true;
  789. this.\u0023d = true;
  790. }
  791. else
  792. numArray1 = File.ReadAllBytes(this.\u0023a);
  793. using (\u0023kb kb = (\u0023kb) new \u0023mb())
  794. {
  795. using (BinaryWriter binaryWriter = new BinaryWriter((Stream) new MemoryStream()))
  796. {
  797. kb.IV = this.\u0023d;
  798. kb.Key = this.\u0023b;
  799. binaryWriter.Write(new byte[3]
  800. {
  801. (byte) 236,
  802. (byte) 72,
  803. (byte) 79
  804. });
  805. binaryWriter.Write((byte) 0);
  806. SortedDictionary<string, byte[]> sortedDictionary = new SortedDictionary<string, byte[]>((IComparer<string>) new \u0023rd.\u0023sd());
  807. Dictionary<string, byte[]> dictionary1 = new Dictionary<string, byte[]>();
  808. Dictionary<string, DateTime> dictionary2 = new Dictionary<string, DateTime>();
  809. Dictionary<string, DateTime> dictionary3 = new Dictionary<string, DateTime>();
  810. byte[] buffer1;
  811. if (this.\u0023c)
  812. {
  813. foreach (KeyValuePair<string, \u00231b> keyValuePair in this.\u0023a)
  814. {
  815. // ISSUE: reference to a compiler-generated method
  816. byte[] numArray2 = new byte[keyValuePair.Value.get_Length()];
  817. // ISSUE: reference to a compiler-generated method
  818. Array.Copy((Array) numArray1, this.\u0023a + keyValuePair.Value.\u0023kw(), (Array) numArray2, 0, numArray2.Length);
  819. sortedDictionary.Add(keyValuePair.Key, numArray2);
  820. // ISSUE: reference to a compiler-generated method
  821. dictionary2[keyValuePair.Key] = keyValuePair.Value.\u0023ow();
  822. // ISSUE: reference to a compiler-generated method
  823. dictionary3[keyValuePair.Key] = keyValuePair.Value.\u0023qw();
  824. }
  825. this.\u0023uC(this.\u0023a, kb.CreateEncryptor());
  826. foreach (KeyValuePair<string, byte[]> keyValuePair in this.\u0023a)
  827. {
  828. sortedDictionary.Add(keyValuePair.Key, keyValuePair.Value);
  829. dictionary2[keyValuePair.Key] = this.\u0023a[keyValuePair.Key];
  830. dictionary3[keyValuePair.Key] = this.\u0023b[keyValuePair.Key];
  831. }
  832. buffer1 = \u0023rd.\u0023vC(sortedDictionary);
  833. }
  834. else
  835. {
  836. buffer1 = new byte[numArray1.Length - this.\u0023a];
  837. Array.Copy((Array) numArray1, this.\u0023a, (Array) buffer1, 0, buffer1.Length);
  838. }
  839. byte[] buffer2 = new byte[this.\u0023d.Length];
  840. for (int index = 0; index < buffer2.Length; ++index)
  841. buffer2[index] = (byte) ((uint) this.\u0023d[index] ^ (uint) buffer1[index]);
  842. binaryWriter.Write(buffer2);
  843. byte[] buffer3;
  844. if (this.\u0023d || this.\u0023c)
  845. {
  846. buffer3 = \u0023rd.\u0023xC(this.\u0023a);
  847. binaryWriter.Write(buffer3);
  848. binaryWriter.Write(this.\u0023a.Count);
  849. foreach (KeyValuePair<string, int> keyValuePair in this.\u0023a)
  850. {
  851. binaryWriter.Write(keyValuePair.Key);
  852. binaryWriter.Write(keyValuePair.Value);
  853. }
  854. using (\u00231 obj = new \u00231(binaryWriter.BaseStream, \u0023Z.\u0023a, this.\u0023b))
  855. obj.Write(\u0023rd.\u0023c, 0, 64);
  856. }
  857. else
  858. {
  859. buffer3 = new byte[this.\u0023b - 68];
  860. Array.Copy((Array) numArray1, 68, (Array) buffer3, 0, buffer3.Length);
  861. binaryWriter.Write(buffer3);
  862. }
  863. int num1 = (int) binaryWriter.BaseStream.Position;
  864. if (this.\u0023c)
  865. {
  866. byte[] buffer4 = this.\u0023wC(sortedDictionary, dictionary1, dictionary2, dictionary3, kb.CreateEncryptor());
  867. // ISSUE: reference to a compiler-generated method
  868. this.\u0023nC(\u0023rd.\u0023yC(buffer4, sortedDictionary.Count * 4, (byte) 209));
  869. int length = buffer4.Length;
  870. int index = 0;
  871. while (index < 16)
  872. {
  873. // ISSUE: reference to a compiler-generated method
  874. // ISSUE: reference to a compiler-generated method
  875. length += (int) this.\u0023mC()[index] | (int) this.\u0023mC()[index + 1] << 17;
  876. index += 2;
  877. }
  878. binaryWriter.Write(length);
  879. binaryWriter.Write(buffer4);
  880. }
  881. else
  882. {
  883. byte[] buffer4 = new byte[this.\u0023a - this.\u0023b];
  884. Array.Copy((Array) numArray1, this.\u0023b, (Array) buffer4, 0, buffer4.Length);
  885. binaryWriter.Write(buffer4);
  886. }
  887. int num2 = (int) binaryWriter.BaseStream.Position;
  888. binaryWriter.Write(buffer1);
  889. if (!obj0)
  890. {
  891. // ISSUE: reference to a compiler-generated method
  892. this.\u0023lC(\u0023rd.\u0023yC(buffer3, this.\u0023a.Count * 3, (byte) 167));
  893. // ISSUE: reference to a compiler-generated method
  894. this.\u0023pC(this.\u0023zC((Stream) new MemoryStream(buffer1, false), buffer1.Length / 2, (byte) 159));
  895. }
  896. using (FileStream fileStream = File.Open(this.\u0023a, FileMode.Create, FileAccess.Write, FileShare.None))
  897. {
  898. byte[] buffer4 = new byte[524288];
  899. binaryWriter.Seek(0, SeekOrigin.Begin);
  900. Stream baseStream = binaryWriter.BaseStream;
  901. baseStream.Read(buffer4, 0, 20);
  902. fileStream.Write(buffer4, 0, 20);
  903. // ISSUE: reference to a compiler-generated method
  904. fileStream.Write(this.\u0023kC(), 0, 16);
  905. // ISSUE: reference to a compiler-generated method
  906. fileStream.Write(this.\u0023mC(), 0, 16);
  907. // ISSUE: reference to a compiler-generated method
  908. fileStream.Write(this.\u0023oC(), 0, 16);
  909. int count;
  910. while ((count = baseStream.Read(buffer4, 0, 524288)) > 0)
  911. fileStream.Write(buffer4, 0, count);
  912. }
  913. binaryWriter.Close();
  914. kb.Clear();
  915. if (this.\u0023c)
  916. {
  917. this.\u0023a.Clear();
  918. int num3 = 0;
  919. foreach (KeyValuePair<string, byte[]> keyValuePair in sortedDictionary)
  920. {
  921. this.\u0023a.Add(keyValuePair.Key, new \u00231b(keyValuePair.Key, num3, keyValuePair.Value.Length, dictionary1[keyValuePair.Key], dictionary2[keyValuePair.Key], dictionary3[keyValuePair.Key]));
  922. num3 += keyValuePair.Value.Length;
  923. }
  924. }
  925. this.\u0023b = num1;
  926. this.\u0023a = num2;
  927. this.\u0023e = false;
  928. this.\u0023d = false;
  929. this.\u0023c = false;
  930. this.\u0023a.Clear();
  931. this.\u0023b.Clear();
  932. this.\u0023a.Clear();
  933. }
  934. }
  935. this.\u0023a = (Stream) File.Open(this.\u0023a, FileMode.Open, FileAccess.Read, FileShare.Read);
  936. return true;
  937. }
  938.  
  939. public void Close()
  940. {
  941. if (this.\u0023a)
  942. return;
  943. if (this.\u0023a != null)
  944. this.\u0023a.ForEach((Action<\u0023td>) (obj0 => obj0.Close()));
  945. if (this.\u0023d != null)
  946. Array.Clear((Array) this.\u0023d, 0, this.\u0023d.Length);
  947. if (this.\u0023a != null)
  948. this.\u0023a.Clear();
  949. if (this.\u0023a != null)
  950. this.\u0023a.Clear();
  951. if (this.\u0023a != null)
  952. this.\u0023a.Clear();
  953. if (this.\u0023b != null)
  954. this.\u0023b.Clear();
  955. if (this.\u0023a != null)
  956. this.\u0023a.Clear();
  957. if (this.\u0023a != null)
  958. this.\u0023a.Clear();
  959. if (this.\u0023a != null)
  960. {
  961. this.\u0023a.Close();
  962. this.\u0023a.Dispose();
  963. }
  964. this.\u0023a = true;
  965. }
  966.  
  967. public bool \u0023VC([In] int obj0, [In] bool obj1)
  968. {
  969. try
  970. {
  971. lock (this.\u0023a)
  972. {
  973. if (!Monitor.TryEnter(this.\u0023a, obj0))
  974. return false;
  975. }
  976. }
  977. catch
  978. {
  979. return false;
  980. }
  981. if (obj1 && this.\u0023a != null)
  982. {
  983. this.\u0023a.Close();
  984. this.\u0023a = (Stream) null;
  985. }
  986. return true;
  987. }
  988.  
  989. public void \u0023WC()
  990. {
  991. if (this.\u0023a == null)
  992. this.\u0023a = (Stream) File.Open(this.\u0023a, FileMode.Open, FileAccess.Read, FileShare.Read);
  993. lock (this.\u0023a)
  994. Monitor.Exit(this.\u0023a);
  995. }
  996.  
  997. public void Dispose()
  998. {
  999. this.Dispose(true);
  1000. GC.SuppressFinalize((object) this);
  1001. }
  1002.  
  1003. private void Dispose([In] bool obj0)
  1004. {
  1005. this.Close();
  1006. }
  1007.  
  1008. private void \u0023XC()
  1009. {
  1010. if (this.\u0023a)
  1011. throw new Exception(\u0023b.Get(41269));
  1012. }
  1013.  
  1014. internal sealed class \u0023sd : IComparer<string>
  1015. {
  1016. public int Compare([In] string obj0, [In] string obj1)
  1017. {
  1018. if (object.ReferenceEquals((object) obj0, (object) obj1))
  1019. return 0;
  1020. if (\u0023rd.\u0023EC(obj0))
  1021. return 1;
  1022. if (\u0023rd.\u0023EC(obj1))
  1023. return -1;
  1024. return obj0.CompareTo(obj1);
  1025. }
  1026. }
  1027. }
  1028. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement