-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPluginCore.cs
657 lines (611 loc) · 25.4 KB
/
PluginCore.cs
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
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
using System;
using System.Collections;
using Decal.Adapter;
using Decal.Adapter.Wrappers;
using VirindiViewService.Controls;
using System.Collections.Generic;
/*
* Template created by Mag-nus. 8/19/2011, VVS added by Virindi-Inquisitor.
* Plugin created by mudzereli 2012/12
*/
namespace mudsort {
[WireUpBaseEvents]
[FriendlyName("mudsort")]
public class PluginCore : PluginBase
{
const int ICON_ADD = 0x060011F9; // GREEN CIRCLE
const int ICON_MOVE_DOWN = 0x60028FD; // RED DOWN ARROW
const int ICON_MOVE_UP = 0x60028FC; // GREEN UP ARROW
const int ICON_REMOVE = 0x60011F8; //RED CIRCLE SLASH
private static PluginCore instance;
public int containerDest = 0;
public int containerDestSlot = 0;
public int containerSource = 0;
public string ocfilter = "";
private State CURRENT_STATE = State.IDLE;
private ArrayList sortFlags = new ArrayList();
private ArrayList sortList = new ArrayList();
private Queue sortQueue = new Queue();
public static PluginCore getInstance()
{
return instance;
}
/// Initializes the sorting process by filtering items and registering an event handler.
public void activate()
{
try
{
// Set the current state to initiated
CURRENT_STATE = State.INITIATED;
// Clear existing sort queues and lists
sortQueue.Clear();
sortList.Clear();
// Iterate through items in the specified container
foreach (WorldObject worldObject in Core.WorldFilter.GetByContainer(containerSource))
{
// Check if the item is not equipped, has a valid slot, is not a Foci object,
// and matches the selected object class filter (if applicable)
if (worldObject.Values(LongValueKey.EquippedSlots, 0) == 0
&& Core.WorldFilter[worldObject.Id].Values(LongValueKey.Slot) != -1
&& !worldObject.ObjectClass.Equals(ObjectClass.Foci)
&& (MainView.cmbObjClassFilters.Current == 0
|| (MainView.cmbObjClassFilters.Current != 0 && worldObject.ObjectClass.ToString().ToLower().StartsWith(ocfilter.ToLower()))))
{
// Add the world object to the sort list
addWorldObject(sortList, worldObject, false);
}
}
// Log the number of items added to the sort list
Util.WriteToChat(sortList.Count + " items added to sort list...");
// Register the render frame event handler for sorting
CoreManager.Current.RenderFrame += new EventHandler<EventArgs>(Current_RenderFrame_Sort);
}
catch (Exception e)
{
// Log any errors encountered during execution
Util.LogError(e);
}
}
public void addWorldObject(System.Collections.IList toList, WorldObject worldObject, bool recursive)
{
if (!worldObject.HasIdData)
{
Core.IDQueue.AddToQueue(worldObject.Id);
}
if (worldObject.ObjectClass.Equals(ObjectClass.Container))
{
if (recursive)
{
foreach (WorldObject obj in Core.WorldFilter.GetByContainer(worldObject.Id))
{
addWorldObject(toList, obj, recursive);
}
}
}
else
{
toList.Add(worldObject);
}
}
public void cancel()
{
try
{
sortQueue.Clear();
CURRENT_STATE = State.IDLE;
CoreManager.Current.RenderFrame -= new EventHandler<EventArgs>(Current_RenderFrame_Sort);
MainView.prgProgressBar.Position = 0;
MainView.prgProgressBar.PreText = "";
}
catch (Exception ex) { Util.LogError(ex); }
}
[BaseEvent("LoginComplete", "CharacterFilter")]
private void CharacterFilter_LoginComplete(object sender, EventArgs e)
{
try
{
Util.WriteToChat("Plugin online.");
cancel();
createSortFlagListFromString(MainView.edtSortString.Text);
rebuildLstSortSettings();
if (Properties.Settings.Default.IdentifyOnLogin)
{
foreach (WorldObject obj in Core.WorldFilter.GetByContainer(Core.CharacterFilter.Id))
{
if (obj.ObjectClass.Equals(ObjectClass.Container))
{
foreach (WorldObject o in Core.WorldFilter.GetByContainer(obj.Id))
{
Core.IDQueue.AddToQueue(obj.Id);
}
}
Core.IDQueue.AddToQueue(obj.Id);
}
}
MainView.edtSourceContainer.Text = Core.CharacterFilter.Id.ToString();
containerSource = Core.CharacterFilter.Id;
MainView.edtDestContainer.Text = Core.CharacterFilter.Id.ToString();
containerDest = Core.CharacterFilter.Id;
}
catch (Exception ex) { Util.LogError(ex); }
}
[BaseEvent("Logoff", "CharacterFilter")]
private void CharacterFilter_Logoff(object sender, EventArgs e)
{
try
{
cancel();
Util.WriteToChat("Plugin offline.");
}
catch (Exception ex) { Util.LogError(ex); }
}
public void createSortFlagListFromString(String str)
{
sortFlags.Clear();
foreach (SortFlag sf in SortFlag.sortedFlagList.Values)
{
sf.descending = false;
}
String[] sortKeys = str.Split(',');
//Util.WriteToChat("creating list from " + sortKeys.Length + " keys");
for (int i = 0; i < sortKeys.Length; i++)
{
try
{
SortFlag sf = SortFlag.decode(sortKeys[i]);
sf.descending = sortKeys[i].Length == 3 && sortKeys[i].Substring(2, 1).Equals("-");
sortFlags.Add(sf);
}
catch (Exception e) { Util.LogError(e); }
}
//Util.WriteToChat("SortFlags Contains " + sortFlags.Count + " flags");
}
private void Current_RenderFrame_Sort(object sender, EventArgs e)
{
try
{
if (CURRENT_STATE == State.IDLE)
{
CoreManager.Current.RenderFrame -= new EventHandler<EventArgs>(Current_RenderFrame_Sort);
}
else if (CURRENT_STATE == State.INITIATED)
{
bool identifying = false;
MainView.prgProgressBar.Max = sortList.Count;
MainView.prgProgressBar.PreText = "identifying...";
foreach (WorldObject obj in sortList)
{
if (!obj.HasIdData)
{
identifying = true;
MainView.prgProgressBar.Position = sortList.IndexOf(obj) + 1;
break;
}
}
if (!identifying)
{
CURRENT_STATE = State.BUILDING_LIST;
MainView.prgProgressBar.Position = MainView.prgProgressBar.Max;
}
}
else if (CURRENT_STATE == State.BUILDING_LIST)
{
MainView.prgProgressBar.PreText = "building list...";
System.Collections.ArrayList sortValueList = new System.Collections.ArrayList();
//Util.DebugWrite("# of sortflags = " + sortFlags.Count);
for (int i = sortFlags.Count - 1; i >= 0; i--)
{
SortFlag sf = (SortFlag)sortFlags[i];
foreach (WorldObject worldObject in sortList)
{
String sortMetric = sf.valueOf(worldObject);
//Util.DebugWrite("adding WorldObject = "+worldObject.Name+" / sortMetric = "+ sortMetric);
if (!sortValueList.Contains(sortMetric))
{
sortValueList.Add(sortMetric);
}
}
//Util.DebugWrite("Sorting List...");
sortValueList.Sort(new AlphanumComparator());
//Util.DebugWrite("List Sorted.");
System.Collections.ArrayList newSortList = new System.Collections.ArrayList();
if (sf.descending)
{
sortValueList.Reverse();
}
//Util.DebugWrite("Starting to Iterate through sorted sortValueList");
foreach (Object sortValue in sortValueList)
{
foreach (WorldObject worldObject in sortList)
{
String sortMetric = sf.valueOf(worldObject);
if (sortMetric.Equals(sortValue))
{
newSortList.Add(worldObject);
}
}
}
sortList = newSortList;
if (i == 0)
{
if (Properties.Settings.Default.ReverseSortList)
{
sortList.Reverse();
}
foreach (WorldObject worldObject in sortList)
{
sortQueue.Enqueue(worldObject);
}
}
}
Util.WriteToChat(sortQueue.Count + " items in queue...");
CURRENT_STATE = State.MOVING_ITEMS;
MainView.prgProgressBar.PreText = "working...";
MainView.prgProgressBar.Max = sortQueue.Count;
}
else if (CURRENT_STATE == State.MOVING_ITEMS)
{
if (sortQueue.Count > 0)
{
if (Core.Actions.BusyState == 0)
{
MainView.prgProgressBar.Position = MainView.prgProgressBar.Max - sortQueue.Count;
WorldObject obj = (WorldObject)sortQueue.Dequeue();
if (containerDest != Core.CharacterFilter.Id && Core.WorldFilter[containerDest].ObjectClass.Equals(ObjectClass.Player))
{
Globals.Host.Actions.GiveItem(obj.Id, containerDest);
}
else
{
Globals.Host.Actions.MoveItem(obj.Id, containerDest, containerDestSlot, true);
}
}
}
else
{
CURRENT_STATE = State.IDLE;
MainView.prgProgressBar.PreText = "done!";
MainView.prgProgressBar.Position = MainView.prgProgressBar.Max;
MainView.btnActivate.Text = "Activate";
if(Properties.Settings.Default.ThinkWhenDone)
{
Globals.Host.Actions.InvokeChatParser("/tell "+Core.CharacterFilter.Name+", done sorting!");
}
Util.WriteToChat("done sorting items!");
}
}
}
catch (Exception ex) { Util.LogError(ex); }
}
public void lstSortSettings_Selected(object sender, int row, int col)
{
try
{
HudList.HudListRowAccessor acc = MainView.lstSortSettings[row];
String code = ((HudStaticText) acc[0]).Text.ToString();
SortFlag flag = SortFlag.decode(code);
bool changed = false;
if (col < 2) // DUMP PROPERTIES
{
flag.propertyDumpSelection();
} else if (col == 2) // MOVE UP
{
if (sortFlags.Contains(flag))
{
int index = sortFlags.IndexOf(flag);
if (index > 0)
{
SortFlag f = (SortFlag)sortFlags[index - 1];
sortFlags[index - 1] = sortFlags[index];
sortFlags[index] = f;
changed = true;
}
}
} else if (col == 3) // MOVE DOWN
{
if (sortFlags.Contains(flag))
{
int index = sortFlags.IndexOf(flag);
if (index < sortFlags.Count - 1)
{
SortFlag f = (SortFlag)sortFlags[index + 1];
sortFlags[index + 1] = sortFlags[index];
sortFlags[index] = f;
changed = true;
}
}
}
else if (col == 4) // REMOVE
{
if (sortFlags.Contains(flag))
{
sortFlags.Remove(flag);
flag.descending = false;
}
else
{
sortFlags.Add(flag);
}
changed = true;
}
else if (col == 5)
{
if (sortFlags.Contains(flag))
{
flag.descending = !flag.descending;
changed = true;
}
}
if (changed)
{
MainView.edtSortString.Text = sortFlagListToString();
rebuildLstSortSettings();
}
}
catch (Exception ex) { Util.LogError(ex); }
}
public void rebuildLstSortSettings()
{
MainView.lstSortSettings.ClearRows();
foreach (SortFlag iFlag in sortFlags)
{
HudList.HudListRowAccessor row = MainView.lstSortSettings.AddRow();
((HudStaticText)row[0]).Text = iFlag.code;
((HudStaticText)row[1]).Text = iFlag.name;
((HudPictureBox)row[2]).Image = ICON_MOVE_UP;
((HudPictureBox)row[3]).Image = ICON_MOVE_DOWN;
((HudPictureBox)row[4]).Image = ICON_REMOVE;
((HudPictureBox)row[5]).Image = iFlag.descending ? ICON_MOVE_DOWN : ICON_MOVE_UP;
((HudPictureBox)row[6]).Image = iFlag.keyIcon;
VirindiViewService.TooltipSystem.AssociateTooltip((HudStaticText)row[0], "Click To Dump Selected Item's " + iFlag.key.ToString() + " To Chat");
VirindiViewService.TooltipSystem.AssociateTooltip((HudStaticText)row[1], "Click To Dump Selected Item's " + iFlag.key.ToString() + " To Chat");
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[2], "Click To Increase Sort Priority Of " + iFlag.key.ToString());
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[3], "Click To Decrease Sort Priority Of " + iFlag.key.ToString());
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[4], "Click To Remove Sorting By " + iFlag.key.ToString());
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[5], "Click To Reverse Sort Order Of " + iFlag.key.ToString());
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[6], iFlag.key.GetType() == typeof(string) ? "Custom" : iFlag.key.GetType().Name);
}
foreach (SortFlag iFlag in SortFlag.sortedFlagList.Values)
{
int id = 6;
if (iFlag.key is MSStringValueKey) {
id = 2;
} else if (iFlag.key is MSLongValueKey) {
id = 3;
} else if (iFlag.key is MSDoubleValueKey) {
id = 4;
} else if (iFlag.key is MSBoolValueKey) {
id = 5;
}
bool common = false;
if (SortFlag.CommonFlags.Contains(iFlag.name))
{
common = true;
}
if (!sortFlags.Contains(iFlag) && ((MainView.cmbSortListFilters.Current == 0 && common) || MainView.cmbSortListFilters.Current == 1 || MainView.cmbSortListFilters.Current == id))
{
HudList.HudListRowAccessor row = MainView.lstSortSettings.AddRow();
((HudStaticText)row[0]).Text = iFlag.code;
((HudStaticText)row[1]).Text = iFlag.name;
((HudPictureBox)row[2]).Image = null;
((HudPictureBox)row[3]).Image = null;
((HudPictureBox)row[4]).Image = ICON_ADD;
((HudPictureBox)row[5]).Image = null;
((HudPictureBox)row[6]).Image = iFlag.keyIcon;
VirindiViewService.TooltipSystem.AssociateTooltip((HudStaticText)row[0], "Click To Dump Selected Item's " + iFlag.key.ToString() + " To Chat");
VirindiViewService.TooltipSystem.AssociateTooltip((HudStaticText)row[1], "Click To Dump Selected Item's " + iFlag.key.ToString() + " To Chat");
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[4], "Click To Sort By " + iFlag.key.ToString());
VirindiViewService.TooltipSystem.AssociateTooltip((HudPictureBox)row[6], iFlag.key.GetType().Name);
}
}
//MainView.edtSortString.Text = sortFlagListToString();
}
public void setDestContainer()
{
setDestContainer(Core.Actions.CurrentSelection);
}
public void setDestContainer(int containerID)
{
try
{
if (containerID != 0 && Core.WorldFilter[containerID].Values(LongValueKey.ItemSlots) > 0)
{
containerDest = containerID;
}
else
{
containerDest = 0;
}
MainView.edtDestContainer.Text = containerDest != 0 ? containerDest.ToString() : "invalid!";
}
catch (Exception ex) { Util.LogError(ex); }
}
public void setSourceContainer()
{
setSourceContainer(Core.Actions.CurrentSelection);
}
public void setSourceContainer(int containerID)
{
try
{
if (containerID != 0 && Core.WorldFilter[containerID].Values(LongValueKey.ItemSlots) > 0)
{
containerSource = containerID;
}
else
{
containerSource = 0;
}
MainView.edtSourceContainer.Text = containerSource != 0 ? containerSource.ToString() : "invalid!";
}
catch (Exception ex) { Util.LogError(ex); }
}
private String sortFlagListToString()
{
String s = "";
foreach (SortFlag iFlag in sortFlags)
{
s = s + iFlag.code + (iFlag.descending ? "-" : "") + (sortFlags.IndexOf(iFlag) != sortFlags.Count - 1 ? "," : "");
}
return s;
}
void Current_CommandLineText(object sender, ChatParserInterceptEventArgs e)
{
try
{
if (e.Text == null)
return;
if (ProcessMSCommand(e.Text))
e.Eat = true;
}
catch (Exception ex) { Util.LogError(ex); }
}
public bool ProcessMSCommand(string msCommand)
{
msCommand = msCommand.ToLower().Trim();
if (msCommand.StartsWith("/ms help") || msCommand.Equals("/ms"))
{
Util.WriteToChat("listing help / commands...");
Util.WriteToChat("/ms start - start sorting");
Util.WriteToChat("/ms stop - cancel sorting");
Util.WriteToChat("/ms set source (pack <1-8>|player|<containerID>) - set source container to: pack 1-8, player, given containerID, or selection (no argument)");
Util.WriteToChat("/ms set dest (pack <1-8>|player|<containerID>) - set destination to: pack 1-8, player, given containerID, or selection (no argument)");
Util.WriteToChat("/ms set flags (sort flag string) - sets the sort string to the given argument");
Util.WriteToChat("/ms set ocfilter (object class string) - sets the object class filter to the given argument");
Util.WriteToChat("/ms clear ocfilter - clears the object class filter");
return true;
}
if (msCommand.Equals("/ms set ocfilter")|| msCommand.Equals("/ms clear ocfilter"))
{
msCommand = msCommand.Substring("/ms set ocfilter ".Length);
Util.WriteToChat("Clearing ObjectClass Filter.");
ocfilter = "";
MainView.cmbObjClassFilters.Current = 0;
return true;
}
if (msCommand.StartsWith("/ms set ocfilter "))
{
msCommand = msCommand.Substring("/ms set ocfilter ".Length);
Util.WriteToChat("Setting ObjectClass Filter: " + msCommand);
ocfilter = msCommand;
MainView.cmbObjClassFilters.Current = MainView.cmbObjClassFilters.Count-1;
return true;
}
if (msCommand.Equals("/ms set source"))
{
Util.WriteToChat("Setting Source Container to Selection...");
setSourceContainer();
return true;
}
if (msCommand.Equals("/ms set dest"))
{
Util.WriteToChat("Setting Destination Container to Selection...");
setDestContainer();
return true;
}
if (msCommand.StartsWith("/ms set source "))
{
msCommand = msCommand.Substring("/ms set source ".Length).ToLower();
if (msCommand.StartsWith("player"))
{
Util.WriteToChat("Setting Source Container to Player ID: " + Core.CharacterFilter.Id);
setSourceContainer(Core.CharacterFilter.Id);
return true;
}
if (msCommand.StartsWith("pack"))
{
msCommand = msCommand.Substring("pack".Length);
foreach (WorldObject worldObject in Core.WorldFilter.GetByContainer(Core.CharacterFilter.Id))
{
if (worldObject.Values(LongValueKey.EquippedSlots, 0) == 0
&& worldObject.ObjectClass == ObjectClass.Container
&& worldObject.Values(LongValueKey.Slot) + 1 == Int32.Parse(msCommand)
&& !worldObject.ObjectClass.Equals(ObjectClass.Foci))
{
Util.WriteToChat("Setting Source Container to: " + worldObject.Id + "...");
setSourceContainer(worldObject.Id);
return true;
}
}
}
else
{
Util.WriteToChat("Setting Source Container to: " + msCommand + "...");
setSourceContainer(Int32.Parse(msCommand));
return true;
}
return true;
}
if (msCommand.StartsWith("/ms set dest "))
{
msCommand = msCommand.Substring("/ms set dest ".Length).ToLower();
if (msCommand.StartsWith("player"))
{
Util.WriteToChat("Setting Destination Container to Player ID: " + Core.CharacterFilter.Id);
setDestContainer(Core.CharacterFilter.Id);
return true;
}
if (msCommand.StartsWith("pack"))
{
msCommand = msCommand.Substring("pack".Length);
foreach (WorldObject worldObject in Core.WorldFilter.GetByContainer(Core.CharacterFilter.Id))
{
if (worldObject.Values(LongValueKey.EquippedSlots, 0) == 0
&& worldObject.ObjectClass == ObjectClass.Container
&& worldObject.Values(LongValueKey.Slot) + 1 == Int32.Parse(msCommand)
&& !worldObject.ObjectClass.Equals(ObjectClass.Foci))
{
Util.WriteToChat("Setting Destination Container to: " + worldObject.Id + "...");
setDestContainer(worldObject.Id);
return true;
}
}
} else
{
Util.WriteToChat("Setting Destination Container to: " + msCommand + "...");
setDestContainer(Int32.Parse(msCommand));
return true;
}
return true;
}
if (msCommand.StartsWith("/ms set flags "))
{
msCommand = msCommand.Substring("/ms set flags ".Length).ToUpper();
Util.WriteToChat("Updated Sort Flags: "+msCommand);
getInstance().createSortFlagListFromString(msCommand);
getInstance().rebuildLstSortSettings();
return true;
}
if (msCommand.StartsWith("/ms start"))
{
Util.WriteToChat("Starting Sort...");
getInstance().activate();
return true;
}
if (msCommand.StartsWith("/ms stop"))
{
Util.WriteToChat("Stopping Sort...");
getInstance().cancel();
return true;
}
return false;
}
protected override void Startup()
{
try
{
instance = this;
Globals.Init("mudsort", Host, Core);
MainView.ViewInit();
CoreManager.Current.CommandLineText += new EventHandler<ChatParserInterceptEventArgs>(Current_CommandLineText);
} catch (Exception ex) { Util.LogError(ex); }
}
protected override void Shutdown()
{
try
{
CoreManager.Current.CommandLineText -= new EventHandler<ChatParserInterceptEventArgs>(Current_CommandLineText);
}
catch (Exception ex) { Util.LogError(ex); }
}
}}