SharedDrawingManager.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. using MuchInfo.Chart.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Runtime.CompilerServices;
  6. using System.Threading;
  7. namespace MuchInfo.Chart.WPF.Helpers
  8. {
  9. public class SharedDrawingManager
  10. {
  11. public delegate void DrawingsChangedForSymEventHandler(string symbol);
  12. public delegate void AnyDrawingChangedEventHandler();
  13. public delegate void DrawingChangedEventHandler(DrawingToolInfo info);
  14. public delegate void AllDrawingsChangedEventHandler();
  15. public delegate void SymbolsWithDrawingsChangedEventHandler();
  16. public class SharedDrawingManager_274
  17. {
  18. public enum SharedDrawingManager_274_276
  19. {
  20. SharedDrawingManager_274_276_1483,
  21. SharedDrawingManager_274_276_1484,
  22. SharedDrawingManager_274_276_1485
  23. }
  24. public SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276 SharedDrawingManager_274_1476;
  25. public DrawingToolInfo SharedDrawingManager_274_1477;
  26. public int SharedDrawingManager_274_1478;
  27. public DateTime SharedDrawingManager_274_1479;
  28. public SharedDrawingManager_274(SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276 aMode, DrawingToolInfo aItem)
  29. {
  30. this.SharedDrawingManager_274_1478 = 0;
  31. this.SharedDrawingManager_274_1479 = DateTime.Now;
  32. this.SharedDrawingManager_274_1476 = aMode;
  33. this.SharedDrawingManager_274_1477 = aItem;
  34. }
  35. }
  36. public class SharedDrawingManager_275
  37. {
  38. public bool SharedDrawingManager_275_1480;
  39. public bool SharedDrawingManager_275_1481;
  40. public SharedDrawingManager_275()
  41. {
  42. this.SharedDrawingManager_275_1480 = false;
  43. this.SharedDrawingManager_275_1481 = false;
  44. }
  45. public bool SharedDrawingManager_275_2921()
  46. {
  47. return this.SharedDrawingManager_275_1480 && this.SharedDrawingManager_275_1481;
  48. }
  49. }
  50. private static List<WeakReference> SharedDrawingManager_1455;
  51. private static Dictionary<string, List<DrawingToolInfo>> SharedDrawingManager_1456;
  52. private static List<DrawingToolInfo> SharedDrawingManager_1457;
  53. private static Dictionary<Guid, DrawingToolInfo> SharedDrawingManager_1458;
  54. private static Dictionary<string, string> SharedDrawingManager_1459;
  55. private static SharedDrawingManager.DrawingsChangedForSymEventHandler SharedDrawingManager_1460;
  56. private static SharedDrawingManager.AnyDrawingChangedEventHandler SharedDrawingManager_1461;
  57. private static SharedDrawingManager.DrawingChangedEventHandler SharedDrawingManager_1462;
  58. private static SharedDrawingManager.AllDrawingsChangedEventHandler SharedDrawingManager_1463;
  59. private static SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler SharedDrawingManager_1464;
  60. //private static ChartsWithDrawingWatchList SharedDrawingManager_1465;
  61. private static object SharedDrawingManager_1466;
  62. private static List<SharedDrawingManager.SharedDrawingManager_274> SharedDrawingManager_1467;
  63. //private static SharedDrawingDataRequest SharedDrawingManager_1468;
  64. private static object SharedDrawingManager_1470;
  65. public static event SharedDrawingManager.DrawingsChangedForSymEventHandler DrawingsChangedForSym
  66. {
  67. add
  68. {
  69. SharedDrawingManager.SharedDrawingManager_1460 = (SharedDrawingManager.DrawingsChangedForSymEventHandler)Delegate.Combine(SharedDrawingManager.SharedDrawingManager_1460, value);
  70. }
  71. remove
  72. {
  73. SharedDrawingManager.SharedDrawingManager_1460 = (SharedDrawingManager.DrawingsChangedForSymEventHandler)Delegate.Remove(SharedDrawingManager.SharedDrawingManager_1460, value);
  74. }
  75. }
  76. public static event SharedDrawingManager.AnyDrawingChangedEventHandler AnyDrawingChanged
  77. {
  78. [MethodImpl(32)]
  79. add
  80. {
  81. SharedDrawingManager.SharedDrawingManager_1461 = (SharedDrawingManager.AnyDrawingChangedEventHandler)Delegate.Combine(SharedDrawingManager.SharedDrawingManager_1461, value);
  82. }
  83. [MethodImpl(32)]
  84. remove
  85. {
  86. SharedDrawingManager.SharedDrawingManager_1461 = (SharedDrawingManager.AnyDrawingChangedEventHandler)Delegate.Remove(SharedDrawingManager.SharedDrawingManager_1461, value);
  87. }
  88. }
  89. public static event SharedDrawingManager.DrawingChangedEventHandler DrawingChanged
  90. {
  91. [MethodImpl(32)]
  92. add
  93. {
  94. SharedDrawingManager.SharedDrawingManager_1462 = (SharedDrawingManager.DrawingChangedEventHandler)Delegate.Combine(SharedDrawingManager.SharedDrawingManager_1462, value);
  95. }
  96. [MethodImpl(32)]
  97. remove
  98. {
  99. SharedDrawingManager.SharedDrawingManager_1462 = (SharedDrawingManager.DrawingChangedEventHandler)Delegate.Remove(SharedDrawingManager.SharedDrawingManager_1462, value);
  100. }
  101. }
  102. public static event SharedDrawingManager.AllDrawingsChangedEventHandler AllDrawingsChanged
  103. {
  104. [MethodImpl(32)]
  105. add
  106. {
  107. SharedDrawingManager.SharedDrawingManager_1463 = (SharedDrawingManager.AllDrawingsChangedEventHandler)Delegate.Combine(SharedDrawingManager.SharedDrawingManager_1463, value);
  108. }
  109. [MethodImpl(32)]
  110. remove
  111. {
  112. SharedDrawingManager.SharedDrawingManager_1463 = (SharedDrawingManager.AllDrawingsChangedEventHandler)Delegate.Remove(SharedDrawingManager.SharedDrawingManager_1463, value);
  113. }
  114. }
  115. public static event SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler SymbolsWithDrawingsChanged
  116. {
  117. [MethodImpl(32)]
  118. add
  119. {
  120. SharedDrawingManager.SharedDrawingManager_1464 = (SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler)Delegate.Combine(SharedDrawingManager.SharedDrawingManager_1464, value);
  121. }
  122. [MethodImpl(32)]
  123. remove
  124. {
  125. SharedDrawingManager.SharedDrawingManager_1464 = (SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler)Delegate.Remove(SharedDrawingManager.SharedDrawingManager_1464, value);
  126. }
  127. }
  128. public SharedDrawingManager()
  129. {
  130. SharedDrawingManager.SharedDrawingManager_2857(this);
  131. }
  132. private static void SharedDrawingManager_2857(object value)
  133. {
  134. List<WeakReference> sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1455;
  135. Monitor.Enter(sharedDrawingManager_);
  136. checked
  137. {
  138. try
  139. {
  140. bool flag = SharedDrawingManager.SharedDrawingManager_1455.Count == SharedDrawingManager.SharedDrawingManager_1455.Capacity;
  141. if (flag)
  142. {
  143. int num = 0;
  144. int arg_51_0 = 0;
  145. int num2 = SharedDrawingManager.SharedDrawingManager_1455.Count - 1;
  146. int num3 = arg_51_0;
  147. while (true)
  148. {
  149. int arg_A2_0 = num3;
  150. int num4 = num2;
  151. if (arg_A2_0 > num4)
  152. {
  153. break;
  154. }
  155. WeakReference weakReference = SharedDrawingManager.SharedDrawingManager_1455[num3];
  156. flag = weakReference.IsAlive;
  157. if (flag)
  158. {
  159. bool flag2 = num3 != num;
  160. if (flag2)
  161. {
  162. SharedDrawingManager.SharedDrawingManager_1455[num] = (SharedDrawingManager.SharedDrawingManager_1455[num3]);
  163. }
  164. num++;
  165. }
  166. num3++;
  167. }
  168. SharedDrawingManager.SharedDrawingManager_1455.RemoveRange(num, SharedDrawingManager.SharedDrawingManager_1455.Count - num);
  169. SharedDrawingManager.SharedDrawingManager_1455.Capacity = (SharedDrawingManager.SharedDrawingManager_1455.Count);
  170. }
  171. SharedDrawingManager.SharedDrawingManager_1455.Add(new WeakReference(RuntimeHelpers.GetObjectValue(value)));
  172. }
  173. finally
  174. {
  175. Monitor.Exit(sharedDrawingManager_);
  176. }
  177. }
  178. }
  179. static SharedDrawingManager()
  180. {
  181. SharedDrawingManager.SharedDrawingManager_1455 = new List<WeakReference>();
  182. SharedDrawingManager.SharedDrawingManager_1456 = new Dictionary<string, List<DrawingToolInfo>>();
  183. SharedDrawingManager.SharedDrawingManager_1457 = new List<DrawingToolInfo>();
  184. SharedDrawingManager.SharedDrawingManager_1458 = new Dictionary<Guid, DrawingToolInfo>();
  185. SharedDrawingManager.SharedDrawingManager_1459 = new Dictionary<string, string>();
  186. //SharedDrawingManager.SharedDrawingManager_1465 = new ChartsWithDrawingWatchList();
  187. SharedDrawingManager.SharedDrawingManager_1466 = RuntimeHelpers.GetObjectValue(new object());
  188. SharedDrawingManager.SharedDrawingManager_1467 = new List<SharedDrawingManager.SharedDrawingManager_274>();
  189. SharedDrawingManager.SharedDrawingManager_1470 = RuntimeHelpers.GetObjectValue(new object());
  190. // SharedDrawingManager.SharedDrawingManager_2892();
  191. //bool flag = true; UserDataManager.LoggedIn() && UserDataManager.KuberID.HasValue;
  192. //if (flag)
  193. //{
  194. // SharedDrawingManager.SharedDrawingManager_2881();
  195. // SharedDrawingManager.SharedDrawingManager_2883();
  196. //}
  197. //Thread thread = new Thread(new ThreadStart(SharedDrawingManager.SharedDrawingManager_2889));
  198. //thread.IsBackground = (true);
  199. //thread.Name = ("Shared Drawing Updater");
  200. //thread.Start();
  201. }
  202. private static void SharedDrawingManager_2871()
  203. {
  204. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1470;
  205. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  206. Monitor.Enter(sharedDrawingManager_);
  207. try
  208. {
  209. bool flag = true;// UserDataManager.LoggedIn() && UserDataManager.KuberID.HasValue;
  210. if (flag)
  211. {
  212. bool flag2 = SharedDrawingManager.SharedDrawingManager_1467.Count > 0;
  213. if (flag2)
  214. {
  215. //SharedDrawingManager.SharedDrawingManager_1472 = true;
  216. }
  217. }
  218. }
  219. finally
  220. {
  221. Monitor.Exit(sharedDrawingManager_);
  222. }
  223. SharedDrawingManager.SharedDrawingManager_2872();
  224. }
  225. private static void SharedDrawingManager_2872()
  226. {
  227. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1466;
  228. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  229. Monitor.Enter(sharedDrawingManager_);
  230. bool flag;
  231. try
  232. {
  233. SharedDrawingManager.SharedDrawingManager_1456.Clear();
  234. SharedDrawingManager.SharedDrawingManager_1457.Clear();
  235. SharedDrawingManager.SharedDrawingManager_1458.Clear();
  236. SharedDrawingManager.SharedDrawingManager_1459.Clear();
  237. SharedDrawingManager.AllDrawingsChangedEventHandler sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1463;
  238. flag = (sharedDrawingManager_2 != null);
  239. if (flag)
  240. {
  241. sharedDrawingManager_2();
  242. }
  243. SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler sharedDrawingManager_3 = SharedDrawingManager.SharedDrawingManager_1464;
  244. flag = (sharedDrawingManager_3 != null);
  245. if (flag)
  246. {
  247. sharedDrawingManager_3();
  248. }
  249. SharedDrawingManager.AnyDrawingChangedEventHandler sharedDrawingManager_4 = SharedDrawingManager.SharedDrawingManager_1461;
  250. flag = (sharedDrawingManager_4 != null);
  251. if (flag)
  252. {
  253. sharedDrawingManager_4();
  254. }
  255. }
  256. finally
  257. {
  258. Monitor.Exit(sharedDrawingManager_);
  259. }
  260. //flag = true;// (UserDataManager.LoggedIn() && UserDataManager.KuberID.HasValue);
  261. //if (flag)
  262. //{
  263. // SharedDrawingManager.SharedDrawingManager_2881();
  264. // SharedDrawingManager.SharedDrawingManager_2883();
  265. //}
  266. }
  267. public static List<DrawingToolInfo> GetDrawingsForSymbol(string symbolName)
  268. {
  269. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1466;
  270. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  271. Monitor.Enter(sharedDrawingManager_);
  272. List<DrawingToolInfo> result;
  273. try
  274. {
  275. bool flag = SharedDrawingManager.SharedDrawingManager_1456.ContainsKey(symbolName);
  276. if (flag)
  277. {
  278. result = SharedDrawingManager.SharedDrawingManager_1456[symbolName];
  279. }
  280. else
  281. {
  282. flag = SharedDrawingManager.SharedDrawingManager_1459.ContainsKey(symbolName);
  283. if (flag)
  284. {
  285. //bool flag2 = true; //UserDataManager.LoggedIn() && UserDataManager.KuberID.HasValue;
  286. //if (flag2)
  287. //{
  288. // SharedDrawingManager.SharedDrawingManager_273 sharedDrawingManager_2 = new SharedDrawingManager.SharedDrawingManager_273(aSymbolID);
  289. //}
  290. }
  291. result = new List<DrawingToolInfo>();
  292. }
  293. }
  294. finally
  295. {
  296. Monitor.Exit(sharedDrawingManager_);
  297. }
  298. return result;
  299. }
  300. public static List<DrawingToolInfo> GetDrawingsOnAllSymbols()
  301. {
  302. return SharedDrawingManager.SharedDrawingManager_1457;
  303. }
  304. public static void AddDrawing(DrawingToolInfo info)
  305. {
  306. SharedDrawingManager.SharedDrawingManager_2879(info, true);
  307. SharedDrawingManager.DrawingsChangedForSymEventHandler sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1460;
  308. bool flag = sharedDrawingManager_ != null;
  309. if (flag)
  310. {
  311. sharedDrawingManager_(info.Symbol);
  312. }
  313. SharedDrawingManager.AnyDrawingChangedEventHandler sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1461;
  314. flag = (sharedDrawingManager_2 != null);
  315. if (flag)
  316. {
  317. sharedDrawingManager_2();
  318. }
  319. sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1461;
  320. flag = (sharedDrawingManager_2 != null);
  321. if (flag)
  322. {
  323. sharedDrawingManager_2();
  324. }
  325. }
  326. public static void UpdateDrawing(DrawingToolInfo info)
  327. {
  328. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1466;
  329. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  330. Monitor.Enter(sharedDrawingManager_);
  331. try
  332. {
  333. SharedDrawingManager.SharedDrawingManager_2880(info);
  334. SharedDrawingManager.SharedDrawingManager_2879(info, false);
  335. SharedDrawingManager.SharedDrawingManager_274 aUpdate = new SharedDrawingManager.SharedDrawingManager_274(SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1484, info);
  336. SharedDrawingManager.SharedDrawingManager_2888(aUpdate);
  337. info.Updated = DateTime.Now;
  338. }
  339. finally
  340. {
  341. Monitor.Exit(sharedDrawingManager_);
  342. }
  343. SharedDrawingManager.DrawingChangedEventHandler sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1462;
  344. bool flag = sharedDrawingManager_2 != null;
  345. if (flag)
  346. {
  347. sharedDrawingManager_2(info);
  348. }
  349. SharedDrawingManager.AnyDrawingChangedEventHandler sharedDrawingManager_3 = SharedDrawingManager.SharedDrawingManager_1461;
  350. flag = (sharedDrawingManager_3 != null);
  351. if (flag)
  352. {
  353. sharedDrawingManager_3();
  354. }
  355. }
  356. public static void DeleteDrawing(DrawingToolInfo info)
  357. {
  358. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1466;
  359. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  360. Monitor.Enter(sharedDrawingManager_);
  361. try
  362. {
  363. SharedDrawingManager.SharedDrawingManager_2880(info);
  364. SharedDrawingManager.SharedDrawingManager_274 aUpdate = new SharedDrawingManager.SharedDrawingManager_274(SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1485, info);
  365. SharedDrawingManager.SharedDrawingManager_2888(aUpdate);
  366. }
  367. finally
  368. {
  369. Monitor.Exit(sharedDrawingManager_);
  370. }
  371. SharedDrawingManager.DrawingsChangedForSymEventHandler sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1460;
  372. bool flag = sharedDrawingManager_2 != null;
  373. if (flag)
  374. {
  375. sharedDrawingManager_2(info.Symbol);
  376. }
  377. flag = info.DrawOnAllSymbols;
  378. if (flag)
  379. {
  380. sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1460;
  381. flag = (sharedDrawingManager_2 != null);
  382. if (flag)
  383. {
  384. sharedDrawingManager_2(null);
  385. }
  386. }
  387. SharedDrawingManager.AnyDrawingChangedEventHandler sharedDrawingManager_3 = SharedDrawingManager.SharedDrawingManager_1461;
  388. flag = (sharedDrawingManager_3 != null);
  389. if (flag)
  390. {
  391. sharedDrawingManager_3();
  392. }
  393. }
  394. private static void SharedDrawingManager_2878(string symbol, List<DrawingToolInfo> drawings)
  395. {
  396. bool flag = SharedDrawingManager.SharedDrawingManager_1456.ContainsKey(symbol);
  397. if (flag)
  398. {
  399. List<DrawingToolInfo> list = new List<DrawingToolInfo>();
  400. list.AddRange(SharedDrawingManager.SharedDrawingManager_1456[symbol]);
  401. SharedDrawingManager.SharedDrawingManager_1456[symbol].Clear();
  402. try
  403. {
  404. List<DrawingToolInfo>.Enumerator enumerator = list.GetEnumerator();
  405. while (enumerator.MoveNext())
  406. {
  407. DrawingToolInfo current = enumerator.Current;
  408. SharedDrawingManager.SharedDrawingManager_1458.Remove(current.DrawingGUID);
  409. }
  410. }
  411. finally
  412. {
  413. //List<DrawingToolInfo>.Enumerator enumerator;
  414. //enumerator.Dispose();
  415. }
  416. }
  417. try
  418. {
  419. List<DrawingToolInfo>.Enumerator enumerator2 = drawings.GetEnumerator();
  420. while (enumerator2.MoveNext())
  421. {
  422. DrawingToolInfo current2 = enumerator2.Current;
  423. SharedDrawingManager.SharedDrawingManager_2879(current2, false);
  424. }
  425. }
  426. finally
  427. {
  428. //List<DrawingToolInfo>.Enumerator enumerator2;
  429. ////enumerator2.Dispose();
  430. }
  431. SharedDrawingManager.DrawingsChangedForSymEventHandler sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1460;
  432. flag = (sharedDrawingManager_ != null);
  433. if (flag)
  434. {
  435. sharedDrawingManager_(symbol);
  436. }
  437. SharedDrawingManager.AnyDrawingChangedEventHandler sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1461;
  438. flag = (sharedDrawingManager_2 != null);
  439. if (flag)
  440. {
  441. sharedDrawingManager_2();
  442. }
  443. }
  444. private static void SharedDrawingManager_2879(DrawingToolInfo info, bool AddToDB)
  445. {
  446. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1466;
  447. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  448. Monitor.Enter(sharedDrawingManager_);
  449. try
  450. {
  451. if (info == null || string.IsNullOrWhiteSpace(info.Symbol)) return;
  452. bool flag = !info.DrawOnAllSymbols;
  453. bool flag2;
  454. if (flag)
  455. {
  456. flag2 = !SharedDrawingManager.SharedDrawingManager_1459.ContainsKey(info.Symbol);
  457. if (flag2)
  458. {
  459. SharedDrawingManager.SharedDrawingManager_1459[info.Symbol] = info.Symbol;
  460. }
  461. flag2 = !SharedDrawingManager.SharedDrawingManager_1456.ContainsKey(info.Symbol);
  462. if (flag2)
  463. {
  464. SharedDrawingManager.SharedDrawingManager_1456.Add(info.Symbol, new List<DrawingToolInfo>());
  465. }
  466. SharedDrawingManager.SharedDrawingManager_1456[info.Symbol].Add(info);
  467. }
  468. else
  469. {
  470. SharedDrawingManager.SharedDrawingManager_1457.Add(info);
  471. }
  472. SharedDrawingManager.SharedDrawingManager_1458[info.DrawingGUID] = (info);
  473. if (AddToDB)
  474. {
  475. SharedDrawingManager.SharedDrawingManager_274 aUpdate = new SharedDrawingManager.SharedDrawingManager_274(SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1483, info);
  476. SharedDrawingManager.SharedDrawingManager_2888(aUpdate);
  477. }
  478. SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler sharedDrawingManager_2 = SharedDrawingManager.SharedDrawingManager_1464;
  479. flag2 = (sharedDrawingManager_2 != null);
  480. if (flag2)
  481. {
  482. sharedDrawingManager_2();
  483. }
  484. }
  485. finally
  486. {
  487. Monitor.Exit(sharedDrawingManager_);
  488. }
  489. }
  490. private static void SharedDrawingManager_2880(DrawingToolInfo Info)
  491. {
  492. bool flag = SharedDrawingManager.SharedDrawingManager_1458.ContainsKey(Info.DrawingGUID);
  493. if (flag)
  494. {
  495. try
  496. {
  497. SharedDrawingManager.SharedDrawingManager_1458.Remove(Info.DrawingGUID);
  498. }
  499. catch (Exception ex)
  500. {
  501. throw ex;
  502. }
  503. }
  504. flag = SharedDrawingManager.SharedDrawingManager_1456.ContainsKey(Info.Symbol);
  505. if (flag)
  506. {
  507. try
  508. {
  509. List<DrawingToolInfo> list = new List<DrawingToolInfo>();
  510. try
  511. {
  512. List<DrawingToolInfo>.Enumerator enumerator = SharedDrawingManager.SharedDrawingManager_1456[Info.Symbol].GetEnumerator();
  513. while (enumerator.MoveNext())
  514. {
  515. DrawingToolInfo current = enumerator.Current;
  516. flag = (current.DrawingGUID == Info.DrawingGUID);
  517. if (flag)
  518. {
  519. list.Add(current);
  520. }
  521. }
  522. }
  523. finally
  524. {
  525. //List<DrawingToolInfo>.Enumerator enumerator;
  526. //enumerator.Dispose();
  527. }
  528. try
  529. {
  530. List<DrawingToolInfo>.Enumerator enumerator2 = list.GetEnumerator();
  531. while (enumerator2.MoveNext())
  532. {
  533. DrawingToolInfo current2 = enumerator2.Current;
  534. SharedDrawingManager.SharedDrawingManager_1456[Info.Symbol].Remove(current2);
  535. }
  536. }
  537. finally
  538. {
  539. //List<DrawingToolInfo>.Enumerator enumerator2;
  540. ////enumerator2.Dispose();
  541. }
  542. flag = (SharedDrawingManager.SharedDrawingManager_1456[Info.Symbol].Count == 0);
  543. if (flag)
  544. {
  545. SharedDrawingManager.SharedDrawingManager_1459.Remove(Info.Symbol);
  546. try
  547. {
  548. SharedDrawingManager.SymbolsWithDrawingsChangedEventHandler sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1464;
  549. flag = (sharedDrawingManager_ != null);
  550. if (flag)
  551. {
  552. sharedDrawingManager_();
  553. }
  554. }
  555. catch (Exception ex)
  556. {
  557. throw ex;
  558. }
  559. }
  560. }
  561. catch (Exception ex)
  562. {
  563. throw ex;
  564. }
  565. }
  566. try
  567. {
  568. List<DrawingToolInfo> list2 = new List<DrawingToolInfo>();
  569. try
  570. {
  571. List<DrawingToolInfo>.Enumerator enumerator3 = SharedDrawingManager.SharedDrawingManager_1457.GetEnumerator();
  572. while (enumerator3.MoveNext())
  573. {
  574. DrawingToolInfo current3 = enumerator3.Current;
  575. flag = (current3.DrawingGUID == Info.DrawingGUID);
  576. if (flag)
  577. {
  578. list2.Add(current3);
  579. }
  580. }
  581. }
  582. finally
  583. {
  584. //List<DrawingToolInfo>.Enumerator enumerator3;
  585. //enumerator3.Dispose();
  586. }
  587. try
  588. {
  589. List<DrawingToolInfo>.Enumerator enumerator4 = list2.GetEnumerator();
  590. while (enumerator4.MoveNext())
  591. {
  592. DrawingToolInfo current4 = enumerator4.Current;
  593. SharedDrawingManager.SharedDrawingManager_1457.Remove(current4);
  594. }
  595. }
  596. finally
  597. {
  598. //List<DrawingToolInfo>.Enumerator enumerator4;
  599. //enumerator4.Dispose();
  600. }
  601. }
  602. catch (Exception ex)
  603. {
  604. throw ex;
  605. }
  606. }
  607. public static void ShutDown()
  608. {
  609. SharedDrawingManager.SharedDrawingManager_2891();
  610. }
  611. private static void SharedDrawingManager_2888(SharedDrawingManager.SharedDrawingManager_274 aUpdate)
  612. {
  613. object sharedDrawingManager_ = SharedDrawingManager.SharedDrawingManager_1470;
  614. //ObjectFlowControl.CheckForSyncLockOnValueType(sharedDrawingManager_);
  615. Monitor.Enter(sharedDrawingManager_);
  616. try
  617. {
  618. List<SharedDrawingManager.SharedDrawingManager_274> list = new List<SharedDrawingManager.SharedDrawingManager_274>();
  619. try
  620. {
  621. List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator = SharedDrawingManager.SharedDrawingManager_1467.GetEnumerator();
  622. while (enumerator.MoveNext())
  623. {
  624. SharedDrawingManager.SharedDrawingManager_274 current = enumerator.Current;
  625. bool flag = current.SharedDrawingManager_274_1476 == SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1484 && current.SharedDrawingManager_274_1477.DrawingGUID == aUpdate.SharedDrawingManager_274_1477.DrawingGUID;
  626. if (flag)
  627. {
  628. list.Add(current);
  629. }
  630. }
  631. }
  632. finally
  633. {
  634. //List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator;
  635. ////enumerator.Dispose();
  636. }
  637. try
  638. {
  639. List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator2 = list.GetEnumerator();
  640. while (enumerator2.MoveNext())
  641. {
  642. SharedDrawingManager.SharedDrawingManager_274 current2 = enumerator2.Current;
  643. SharedDrawingManager.SharedDrawingManager_1467.Remove(current2);
  644. }
  645. }
  646. finally
  647. {
  648. //List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator2;
  649. //////enumerator2.Dispose();
  650. }
  651. SharedDrawingManager.SharedDrawingManager_1467.Add(aUpdate);
  652. }
  653. finally
  654. {
  655. Monitor.Exit(sharedDrawingManager_);
  656. }
  657. }
  658. private static void SharedDrawingManager_2891()
  659. {
  660. List<SharedDrawingManager.SharedDrawingManager_274> list = new List<SharedDrawingManager.SharedDrawingManager_274>();
  661. list.AddRange(SharedDrawingManager.SharedDrawingManager_1467);
  662. bool flag;
  663. try
  664. {
  665. //flag = IsoStore.FileExists("PendingDrawz.dat");
  666. //if (flag)
  667. //{
  668. // IsoStore.DeleteFile("PendingDrawz.dat");
  669. //}
  670. }
  671. catch (Exception ex)
  672. {
  673. throw ex;
  674. }
  675. flag = (list.Count == 0);
  676. if (!flag)
  677. {
  678. try
  679. {
  680. Dictionary<Guid, SharedDrawingManager.SharedDrawingManager_275> dictionary = new Dictionary<Guid, SharedDrawingManager.SharedDrawingManager_275>();
  681. try
  682. {
  683. List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator = list.GetEnumerator();
  684. while (enumerator.MoveNext())
  685. {
  686. SharedDrawingManager.SharedDrawingManager_274 current = enumerator.Current;
  687. flag = (current.SharedDrawingManager_274_1476 == SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1483 || current.SharedDrawingManager_274_1476 == SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1485);
  688. if (flag)
  689. {
  690. bool flag2 = !dictionary.ContainsKey(current.SharedDrawingManager_274_1477.DrawingGUID);
  691. if (flag2)
  692. {
  693. dictionary.Add(current.SharedDrawingManager_274_1477.DrawingGUID, new SharedDrawingManager.SharedDrawingManager_275());
  694. }
  695. flag2 = (current.SharedDrawingManager_274_1476 == SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1483);
  696. if (flag2)
  697. {
  698. dictionary[current.SharedDrawingManager_274_1477.DrawingGUID].SharedDrawingManager_275_1480 = true;
  699. }
  700. flag2 = (current.SharedDrawingManager_274_1476 == SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1485);
  701. if (flag2)
  702. {
  703. dictionary[current.SharedDrawingManager_274_1477.DrawingGUID].SharedDrawingManager_275_1481 = true;
  704. }
  705. }
  706. }
  707. }
  708. finally
  709. {
  710. //List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator;
  711. //enumerator.Dispose();
  712. }
  713. MemoryStream memoryStream = new MemoryStream();
  714. try
  715. {
  716. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  717. try
  718. {
  719. bool flag2;
  720. try
  721. {
  722. List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator2 = list.GetEnumerator();
  723. while (enumerator2.MoveNext())
  724. {
  725. SharedDrawingManager.SharedDrawingManager_274 current2 = enumerator2.Current;
  726. flag2 = (dictionary.ContainsKey(current2.SharedDrawingManager_274_1477.DrawingGUID) && dictionary[current2.SharedDrawingManager_274_1477.DrawingGUID].SharedDrawingManager_275_2921());
  727. if (!flag2)
  728. {
  729. binaryWriter.Write((int)current2.SharedDrawingManager_274_1476);
  730. current2.SharedDrawingManager_274_1477.toBytes(binaryWriter);
  731. }
  732. }
  733. }
  734. finally
  735. {
  736. //List<SharedDrawingManager.SharedDrawingManager_274>.Enumerator enumerator2;
  737. ////enumerator2.Dispose();
  738. }
  739. flag2 = (memoryStream.Length > 0L);
  740. if (flag2)
  741. {
  742. //MemoryStream memoryStream2 = Zipper.ZipToMS(memoryStream.ToArray());
  743. //try
  744. //{
  745. // byte[] data = memoryStream2.ToArray();
  746. // IsoStore.SaveBinaryData(data, "PendingDrawz.dat");
  747. //}
  748. //finally
  749. //{
  750. // flag2 = (memoryStream2 != null);
  751. // if (flag2)
  752. // {
  753. // memoryStream2.Dispose();
  754. // }
  755. //}
  756. }
  757. }
  758. finally
  759. {
  760. bool flag2 = binaryWriter != null;
  761. if (flag2)
  762. {
  763. binaryWriter.Dispose();
  764. }
  765. }
  766. }
  767. finally
  768. {
  769. bool flag2 = memoryStream != null;
  770. if (flag2)
  771. {
  772. memoryStream.Dispose();
  773. }
  774. }
  775. }
  776. catch (Exception ex)
  777. {
  778. throw ex;
  779. }
  780. }
  781. }
  782. //private static void SharedDrawingManager_2892()
  783. //{
  784. // try
  785. // {
  786. // bool flag = IsoStore.FileExists("PendingDrawz.dat");
  787. // if (flag)
  788. // {
  789. // byte[] data = IsoStore.LoadBinaryData("PendingDrawz.dat");
  790. // MemoryStream memoryStream = Zipper.UnzipToMS(data);
  791. // try
  792. // {
  793. // BinaryReader binaryReader = new BinaryReader(memoryStream);
  794. // try
  795. // {
  796. // while (memoryStream.Position < memoryStream.Length)
  797. // {
  798. // SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276 sharedDrawingManager_274_ = (SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276)binaryReader.ReadInt32();
  799. // DrawingToolInfo info = DrawingToolInfo.fromBytes(binaryReader);
  800. // switch (sharedDrawingManager_274_)
  801. // {
  802. // case SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1483:
  803. // SharedDrawingManager.SharedDrawingManager_2879(info, true);
  804. // break;
  805. // case SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1484:
  806. // SharedDrawingManager.UpdateDrawing(info);
  807. // break;
  808. // case SharedDrawingManager.SharedDrawingManager_274.SharedDrawingManager_274_276.SharedDrawingManager_274_276_1485:
  809. // SharedDrawingManager.DeleteDrawing(info);
  810. // break;
  811. // }
  812. // }
  813. // }
  814. // finally
  815. // {
  816. // flag = (binaryReader != null);
  817. // if (flag)
  818. // {
  819. // binaryReader.Dispose();
  820. // }
  821. // }
  822. // }
  823. // finally
  824. // {
  825. // flag = (memoryStream != null);
  826. // if (flag)
  827. // {
  828. // memoryStream.Dispose();
  829. // }
  830. // }
  831. // SharedDrawingManager.SharedDrawingManager_1472 = true;
  832. // }
  833. // }
  834. // catch (Exception expr_12E)
  835. // {
  836. // ProjectData.SetProjectError(expr_12E);
  837. // ProjectData.ClearProjectError();
  838. // }
  839. //}
  840. }
  841. }