-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConnectionInfo.cs
More file actions
639 lines (580 loc) · 14.1 KB
/
ConnectionInfo.cs
File metadata and controls
639 lines (580 loc) · 14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using _003CPrivateImplementationDetails_003E_007B32439FAB_002DE055_002D4B6F_002D932A_002DAD6005671EA2_007D;
using TradingPlatform.BusinessLayer.Integration;
using TradingPlatform.BusinessLayer.Utils.Extensions;
namespace TradingPlatform.BusinessLayer;
/// <summary>
/// Represents all needed parameters for the connection constructing process.
/// </summary>
[Published]
public sealed class ConnectionInfo : ICustomizable, IRenamable, IComparable, IComparable<ConnectionInfo>
{
[Serializable]
[CompilerGenerated]
private sealed class 녴
{
public static readonly 녴 놓녟 = new 녴();
public static Func<SettingItem, SettingItem> 놓놱;
internal SettingItem 녴(SettingItem P_0)
{
return P_0.GetCopy();
}
}
internal const string 녪녭 = "ConnectionId";
private const string 녪녱 = "Name";
internal const string 녪놲 = "Group";
private const string 녪높 = "VendorName";
private const string 녪놶 = "IsFavourite";
private const string 녪뇏 = "ConnectionState";
private const string 녪녻 = "CreationType";
[CompilerGenerated]
private string 녪녙;
[CompilerGenerated]
private string 녪놢;
[CompilerGenerated]
private string 녪녧;
[CompilerGenerated]
private string 녪녤;
[CompilerGenerated]
private bool 녪놆;
[CompilerGenerated]
private ConnectionState 녪뇎;
[CompilerGenerated]
private IList<SettingItem> 녪놷;
[CompilerGenerated]
private IList<SettingItem> 녪녗;
[CompilerGenerated]
private ConnectionCreationType 녪놜;
[CompilerGenerated]
private string 녪놨;
[CompilerGenerated]
private bool 녪녢;
[CompilerGenerated]
private List<ConnectionInfoLink> 녪놞;
[CompilerGenerated]
private string 녪놳;
private VendorInfo 녪놺;
[CompilerGenerated]
private bool 녪놅;
/// <summary>
/// Gets a user friendly name of the connection
/// </summary>
public string Name
{
[CompilerGenerated]
get
{
return 녪녙;
}
[CompilerGenerated]
internal set
{
녪녙 = value;
}
}
/// <summary>
/// Gets connection group
/// </summary>
public string Group
{
[CompilerGenerated]
get
{
return 녪놢;
}
[CompilerGenerated]
private set
{
녪놢 = value;
}
}
/// <summary>
/// Gets vendor's name
/// </summary>
public string VendorName
{
[CompilerGenerated]
get
{
return 녪녧;
}
[CompilerGenerated]
private set
{
녪녧 = value;
}
}
/// <summary>
/// Gets connection Id
/// </summary>
public string ConnectionId
{
[CompilerGenerated]
get
{
return 녪녤;
}
[CompilerGenerated]
internal set
{
녪녤 = value;
}
}
/// <summary>
/// Favorites one will be displayed in Control center toolbar
/// </summary>
public bool IsFavourite
{
[CompilerGenerated]
get
{
return 녪놆;
}
[CompilerGenerated]
set
{
녪놆 = value;
}
}
/// <summary>
/// Gets ConnectionState
/// </summary>
public ConnectionState ConnectionState
{
[CompilerGenerated]
get
{
return 녪뇎;
}
[CompilerGenerated]
internal set
{
녪뇎 = value;
}
}
/// <summary>
/// Gets vendor's settings
/// </summary>
public IList<SettingItem> VendorSettings
{
[CompilerGenerated]
get
{
return 녪놷;
}
[CompilerGenerated]
private set
{
녪놷 = value;
}
}
internal IList<SettingItem> ConnectionSettings
{
[CompilerGenerated]
get
{
return 녪녗;
}
[CompilerGenerated]
set
{
녪녗 = value;
}
}
/// <summary>
/// Specifies how connection was created: by default or by user
/// </summary>
public ConnectionCreationType CreationType
{
[CompilerGenerated]
get
{
return 녪놜;
}
[CompilerGenerated]
private set
{
녪놜 = value;
}
}
public string ConnectionLogoPath
{
[CompilerGenerated]
get
{
return 녪놨;
}
[CompilerGenerated]
internal set
{
녪놨 = value;
}
}
public bool AllowCreateCustomConnections
{
[CompilerGenerated]
get
{
return 녪녢;
}
[CompilerGenerated]
internal set
{
녪녢 = value;
}
}
public List<ConnectionInfoLink> Links
{
[CompilerGenerated]
get
{
return 녪놞;
}
[CompilerGenerated]
internal set
{
녪놞 = value;
}
}
public string Copyrights
{
[CompilerGenerated]
get
{
return 녪놳;
}
[CompilerGenerated]
internal set
{
녪놳 = value;
}
}
public VendorInfo VendorInfo
{
get
{
return 녪놺;
}
internal set
{
if (value == null)
{
return;
}
녪놺 = value;
List<SettingItem> list = new List<SettingItem>(녪놺.ConnectionParameters);
if (ConnectionSettings != null)
{
list.MergeWith(ConnectionSettings.Select((SettingItem P_0) => P_0.GetCopy()).ToList());
}
VendorSettings = list;
}
}
/// <summary>
/// <see cref="T:TradingPlatform.BusinessLayer.ICustomizable" /> realization
/// </summary>
public IList<SettingItem> Settings
{
get
{
int value = (int)((ConnectionState != ConnectionState.Connecting) ? ((ConnectionState == ConnectionState.Disconnecting) ? ConnectionState.Disconnected : ConnectionState) : ConnectionState.Connected);
List<SettingItem> list = new List<SettingItem>
{
new SettingItemString(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎뇉(), ConnectionId)
{
VisibilityMode = VisibilityMode.Hidden
},
new SettingItemString(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놂놵(), Name)
{
Text = _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵놯()
},
new SettingItemString(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎뇍(), Group)
{
VisibilityMode = VisibilityMode.Hidden
},
new SettingItemString(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녾(), VendorName)
{
VisibilityMode = VisibilityMode.Hidden
},
new SettingItemBoolean(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녬(), IsFavourite)
{
VisibilityMode = VisibilityMode.Hidden
},
new SettingItemInteger(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녹(), value)
{
VisibilityMode = VisibilityMode.Hidden
},
new SettingItemInteger(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녔(), (int)CreationType)
{
VisibilityMode = VisibilityMode.Hidden
}
};
if (VendorSettings != null)
{
for (int i = 0; i < VendorSettings.Count; i++)
{
list.Add(VendorSettings[i].GetCopy());
}
}
return list;
}
set
{
if (value == null)
{
throw new ArgumentNullException(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놂뇄());
}
foreach (SettingItem item in value)
{
try
{
string name = item.Name;
if (name != null)
{
switch (name.Length)
{
case 12:
switch (name[1])
{
case 'o':
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎뇉()))
{
break;
}
ConnectionId = item.Value as string;
goto end_IL_0021;
case 'r':
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녔()))
{
break;
}
CreationType = (ConnectionCreationType)(int)item.Value;
goto end_IL_0021;
}
break;
case 4:
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놂놵()))
{
break;
}
Name = item.Value as string;
goto end_IL_0021;
case 10:
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녾()))
{
break;
}
VendorName = item.Value as string;
놂();
goto end_IL_0021;
case 5:
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎뇍()))
{
break;
}
Group = item.Value as string;
goto end_IL_0021;
case 11:
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녬()))
{
break;
}
IsFavourite = (bool)item.Value;
goto end_IL_0021;
case 15:
{
if (!(name == _26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녹()))
{
break;
}
ConnectionState connectionState = (ConnectionState)(int)item.Value;
if (connectionState == ConnectionState.Disconnecting)
{
connectionState = ConnectionState.Disconnected;
}
ConnectionState = connectionState;
goto end_IL_0021;
}
}
}
VendorSettings?.UpdateItemValue(item.Name, item.Value);
end_IL_0021:;
}
catch (Exception ex)
{
Core.Instance.Loggers.Log(ex);
}
}
if (string.IsNullOrEmpty(ConnectionLogoPath) && CreationType == ConnectionCreationType.Custom)
{
놴();
}
}
}
public bool SyncMsgProcessing
{
[CompilerGenerated]
get
{
return 녪놅;
}
[CompilerGenerated]
set
{
녪놅 = value;
}
}
string IRenamable.Name
{
get
{
return Name;
}
set
{
Core.Instance.Connections.RenameConnectionInfo(this, value);
}
}
/// <summary>
/// Creates connection info instance
/// </summary>
/// <param name="name"></param>
internal ConnectionInfo(string P_0)
{
Name = P_0;
ConnectionState = ConnectionState.Disconnected;
ConnectionId = string.Empty;
}
internal ConnectionInfo(string P_0, string P_1)
: this(P_0, P_1, P_1, ConnectionCreationType.Custom)
{
}
/// <summary>
/// Creates connection info instance.
/// </summary>
/// <param name="name"></param>
/// <param name="group"></param>
/// <param name="vendorName"></param>
/// <param name="creationType"></param>
internal ConnectionInfo(string P_0, string P_1, string P_2, ConnectionCreationType P_3 = ConnectionCreationType.Default)
: this(P_0)
{
Group = P_1 ?? P_2;
VendorName = P_2;
CreationType = P_3;
ConnectionId = 녴();
if (CreationType == ConnectionCreationType.Custom)
{
놴();
놂();
}
else if (CreationType == ConnectionCreationType.Technical)
{
놂();
}
}
private string 녴()
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(3, 4);
defaultInterpolatedStringHandler.AppendFormatted(VendorName);
defaultInterpolatedStringHandler.AppendLiteral(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎놙());
defaultInterpolatedStringHandler.AppendFormatted(Group);
defaultInterpolatedStringHandler.AppendLiteral(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎놙());
defaultInterpolatedStringHandler.AppendFormatted(CreationType);
defaultInterpolatedStringHandler.AppendLiteral(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.놎놙());
defaultInterpolatedStringHandler.AppendFormatted((CreationType == ConnectionCreationType.Default) ? Name : Guid.NewGuid().ToShortString());
return defaultInterpolatedStringHandler.ToStringAndClear();
}
private void 놴()
{
ConnectionInfo connectionInfo = Core.Instance.Connections.ConnectionsInfo.FirstOrDefault((ConnectionInfo P_0) => P_0.CreationType == ConnectionCreationType.Default && P_0.Group == Group);
if (connectionInfo != null)
{
ConnectionLogoPath = connectionInfo.ConnectionLogoPath;
}
}
private void 놂()
{
if (VendorInfo == null)
{
VendorInfo vendorInfo = Core.Instance.Vendors.Vendors.FirstOrDefault((VendorInfo P_0) => P_0.MetaData.VendorName == VendorName);
ConnectionInfo connectionInfo = vendorInfo?.DefaultConnections.FirstOrDefault((ConnectionInfo P_0) => P_0.Group == Group);
if (connectionInfo != null)
{
ConnectionSettings = connectionInfo.ConnectionSettings;
}
VendorInfo = vendorInfo;
}
}
[NotPublished]
public override string ToString()
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(26, 3);
defaultInterpolatedStringHandler.AppendLiteral(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵녠());
defaultInterpolatedStringHandler.AppendFormatted(Name);
defaultInterpolatedStringHandler.AppendLiteral(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵놠());
defaultInterpolatedStringHandler.AppendFormatted(VendorName);
defaultInterpolatedStringHandler.AppendLiteral(_26195AC7_002DD65B_002D4910_002DB963_002D637D18805E71.녵놟());
defaultInterpolatedStringHandler.AppendFormatted(IsFavourite);
return defaultInterpolatedStringHandler.ToStringAndClear();
}
public override bool Equals(object obj)
{
if (obj is ConnectionInfo connectionInfo)
{
return ConnectionId == connectionInfo.ConnectionId;
}
return false;
}
public override int GetHashCode()
{
return -463474436 + EqualityComparer<string>.Default.GetHashCode(ConnectionId);
}
private bool 녴(string P_0, ref string P_1)
{
return true;
}
bool IRenamable.IsNameAllowed(string P_0, ref string P_1)
{
//ILSpy generated this explicit interface implementation from .override directive in 녴
return this.녴(P_0, ref P_1);
}
public int CompareTo(object obj)
{
return CompareTo(obj as ConnectionInfo);
}
public int CompareTo(ConnectionInfo other)
{
if (this == other)
{
return 0;
}
if (other == null)
{
return 1;
}
return string.Compare(ConnectionId, other.ConnectionId, StringComparison.Ordinal);
}
[CompilerGenerated]
private bool 녴(ConnectionInfo P_0)
{
if (P_0.CreationType == ConnectionCreationType.Default)
{
return P_0.Group == Group;
}
return false;
}
[CompilerGenerated]
private bool 녴(VendorInfo P_0)
{
return P_0.MetaData.VendorName == VendorName;
}
[CompilerGenerated]
private bool 놴(ConnectionInfo P_0)
{
return P_0.Group == Group;
}
}