@@ -259,9 +259,16 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
259
259
260
260
await using var registeredEvent = token . Register ( ( ) =>
261
261
{
262
- if ( ! process . HasExited )
263
- process . Kill ( ) ;
264
- sourceBuffer . Dispose ( ) ;
262
+ try
263
+ {
264
+ if ( ! process . HasExited )
265
+ process . Kill ( ) ;
266
+ sourceBuffer . Dispose ( ) ;
267
+ }
268
+ catch ( Exception e )
269
+ {
270
+ Log . Exception ( "|JsonRPCPlugin.ExecuteAsync|Exception when kill process" , e ) ;
271
+ }
265
272
} ) ;
266
273
267
274
try
@@ -288,7 +295,7 @@ protected async Task<Stream> ExecuteAsync(ProcessStartInfo startInfo, Cancellati
288
295
}
289
296
290
297
sourceBuffer . Seek ( 0 , SeekOrigin . Begin ) ;
291
-
298
+
292
299
return sourceBuffer ;
293
300
}
294
301
@@ -376,7 +383,8 @@ public Control CreateSettingPanel()
376
383
sep . SetResourceReference ( Separator . BackgroundProperty , "Color03B" ) ; /* for theme change */
377
384
var panel = new StackPanel
378
385
{
379
- Orientation = Orientation . Vertical , VerticalAlignment = VerticalAlignment . Center ,
386
+ Orientation = Orientation . Vertical ,
387
+ VerticalAlignment = VerticalAlignment . Center ,
380
388
Margin = settingLabelPanelMargin
381
389
} ;
382
390
RowDefinition gridRow = new RowDefinition ( ) ;
@@ -390,8 +398,10 @@ public Control CreateSettingPanel()
390
398
} ;
391
399
var desc = new TextBlock ( )
392
400
{
393
- Text = attribute . Description , FontSize = 12 ,
394
- VerticalAlignment = VerticalAlignment . Center , Margin = settingDescMargin ,
401
+ Text = attribute . Description ,
402
+ FontSize = 12 ,
403
+ VerticalAlignment = VerticalAlignment . Center ,
404
+ Margin = settingDescMargin ,
395
405
TextWrapping = TextWrapping . WrapWithOverflow
396
406
} ;
397
407
desc . SetResourceReference ( TextBlock . ForegroundProperty , "Color04B" ) ;
@@ -405,7 +415,7 @@ public Control CreateSettingPanel()
405
415
panel . Children . Add ( name ) ;
406
416
panel . Children . Add ( desc ) ;
407
417
}
408
-
418
+
409
419
410
420
Grid . SetColumn ( panel , 0 ) ;
411
421
Grid . SetRow ( panel , rowCount ) ;
@@ -420,20 +430,20 @@ public Control CreateSettingPanel()
420
430
{
421
431
Text = attribute . Description . Replace ( "\\ r\\ n" , "\r \n " ) ,
422
432
Margin = settingTextBlockMargin ,
423
- Padding = new Thickness ( 0 , 0 , 0 , 0 ) ,
433
+ Padding = new Thickness ( 0 , 0 , 0 , 0 ) ,
424
434
HorizontalAlignment = System . Windows . HorizontalAlignment . Left ,
425
435
TextAlignment = TextAlignment . Left ,
426
436
TextWrapping = TextWrapping . Wrap
427
437
} ;
428
- Grid . SetColumn ( contentControl , 0 ) ;
429
- Grid . SetColumnSpan ( contentControl , 2 ) ;
430
- Grid . SetRow ( contentControl , rowCount ) ;
431
- if ( rowCount != 0 )
432
- mainPanel . Children . Add ( sep ) ;
433
- Grid . SetRow ( sep , rowCount ) ;
434
- Grid . SetColumn ( sep , 0 ) ;
435
- Grid . SetColumnSpan ( sep , 2 ) ;
436
- break ;
438
+ Grid . SetColumn ( contentControl , 0 ) ;
439
+ Grid . SetColumnSpan ( contentControl , 2 ) ;
440
+ Grid . SetRow ( contentControl , rowCount ) ;
441
+ if ( rowCount != 0 )
442
+ mainPanel . Children . Add ( sep ) ;
443
+ Grid . SetRow ( sep , rowCount ) ;
444
+ Grid . SetColumn ( sep , 0 ) ;
445
+ Grid . SetColumnSpan ( sep , 2 ) ;
446
+ break ;
437
447
}
438
448
case "input" :
439
449
{
@@ -449,50 +459,49 @@ public Control CreateSettingPanel()
449
459
Settings [ attribute . Name ] = textBox . Text ;
450
460
} ;
451
461
contentControl = textBox ;
452
- Grid . SetColumn ( contentControl , 1 ) ;
453
- Grid . SetRow ( contentControl , rowCount ) ;
454
- if ( rowCount != 0 )
455
- mainPanel . Children . Add ( sep ) ;
456
- Grid . SetRow ( sep , rowCount ) ;
457
- Grid . SetColumn ( sep , 0 ) ;
458
- Grid . SetColumnSpan ( sep , 2 ) ;
459
- break ;
462
+ Grid . SetColumn ( contentControl , 1 ) ;
463
+ Grid . SetRow ( contentControl , rowCount ) ;
464
+ if ( rowCount != 0 )
465
+ mainPanel . Children . Add ( sep ) ;
466
+ Grid . SetRow ( sep , rowCount ) ;
467
+ Grid . SetColumn ( sep , 0 ) ;
468
+ Grid . SetColumnSpan ( sep , 2 ) ;
469
+ break ;
460
470
}
461
471
case "inputWithFileBtn" :
472
+ {
473
+ var textBox = new TextBox ( )
462
474
{
463
- var textBox = new TextBox ( )
464
- {
465
- Margin = new Thickness ( 10 , 0 , 0 , 0 ) ,
466
- Text = Settings [ attribute . Name ] as string ?? string . Empty ,
467
- HorizontalAlignment = System . Windows . HorizontalAlignment . Stretch ,
468
- ToolTip = attribute . Description
469
- } ;
470
- textBox . TextChanged += ( _ , _ ) =>
471
- {
472
- Settings [ attribute . Name ] = textBox . Text ;
473
- } ;
474
- var Btn = new System . Windows . Controls . Button ( )
475
- {
476
- Margin = new Thickness ( 10 , 0 , 0 , 0 ) ,
477
- Content = "Browse"
478
- } ;
479
- var dockPanel = new DockPanel ( )
480
- {
481
- Margin = settingControlMargin
482
- } ;
483
- DockPanel . SetDock ( Btn , Dock . Right ) ;
484
- dockPanel . Children . Add ( Btn ) ;
485
- dockPanel . Children . Add ( textBox ) ;
486
- contentControl = dockPanel ;
487
- Grid . SetColumn ( contentControl , 1 ) ;
488
- Grid . SetRow ( contentControl , rowCount ) ;
489
- if ( rowCount != 0 )
490
- mainPanel . Children . Add ( sep ) ;
491
- Grid . SetRow ( sep , rowCount ) ;
492
- Grid . SetColumn ( sep , 0 ) ;
493
- Grid . SetColumnSpan ( sep , 2 ) ;
494
- break ;
495
- }
475
+ Margin = new Thickness ( 10 , 0 , 0 , 0 ) ,
476
+ Text = Settings [ attribute . Name ] as string ?? string . Empty ,
477
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Stretch ,
478
+ ToolTip = attribute . Description
479
+ } ;
480
+ textBox . TextChanged += ( _ , _ ) =>
481
+ {
482
+ Settings [ attribute . Name ] = textBox . Text ;
483
+ } ;
484
+ var Btn = new System . Windows . Controls . Button ( )
485
+ {
486
+ Margin = new Thickness ( 10 , 0 , 0 , 0 ) , Content = "Browse"
487
+ } ;
488
+ var dockPanel = new DockPanel ( )
489
+ {
490
+ Margin = settingControlMargin
491
+ } ;
492
+ DockPanel . SetDock ( Btn , Dock . Right ) ;
493
+ dockPanel . Children . Add ( Btn ) ;
494
+ dockPanel . Children . Add ( textBox ) ;
495
+ contentControl = dockPanel ;
496
+ Grid . SetColumn ( contentControl , 1 ) ;
497
+ Grid . SetRow ( contentControl , rowCount ) ;
498
+ if ( rowCount != 0 )
499
+ mainPanel . Children . Add ( sep ) ;
500
+ Grid . SetRow ( sep , rowCount ) ;
501
+ Grid . SetColumn ( sep , 0 ) ;
502
+ Grid . SetColumnSpan ( sep , 2 ) ;
503
+ break ;
504
+ }
496
505
case "textarea" :
497
506
{
498
507
var textBox = new TextBox ( )
@@ -511,14 +520,14 @@ public Control CreateSettingPanel()
511
520
Settings [ attribute . Name ] = ( ( TextBox ) sender ) . Text ;
512
521
} ;
513
522
contentControl = textBox ;
514
- Grid . SetColumn ( contentControl , 1 ) ;
515
- Grid . SetRow ( contentControl , rowCount ) ;
516
- if ( rowCount != 0 )
517
- mainPanel . Children . Add ( sep ) ;
518
- Grid . SetRow ( sep , rowCount ) ;
519
- Grid . SetColumn ( sep , 0 ) ;
520
- Grid . SetColumnSpan ( sep , 2 ) ;
521
- break ;
523
+ Grid . SetColumn ( contentControl , 1 ) ;
524
+ Grid . SetRow ( contentControl , rowCount ) ;
525
+ if ( rowCount != 0 )
526
+ mainPanel . Children . Add ( sep ) ;
527
+ Grid . SetRow ( sep , rowCount ) ;
528
+ Grid . SetColumn ( sep , 0 ) ;
529
+ Grid . SetColumnSpan ( sep , 2 ) ;
530
+ break ;
522
531
}
523
532
case "passwordBox" :
524
533
{
@@ -535,14 +544,14 @@ public Control CreateSettingPanel()
535
544
Settings [ attribute . Name ] = ( ( PasswordBox ) sender ) . Password ;
536
545
} ;
537
546
contentControl = passwordBox ;
538
- Grid . SetColumn ( contentControl , 1 ) ;
539
- Grid . SetRow ( contentControl , rowCount ) ;
540
- if ( rowCount != 0 )
541
- mainPanel . Children . Add ( sep ) ;
542
- Grid . SetRow ( sep , rowCount ) ;
543
- Grid . SetColumn ( sep , 0 ) ;
544
- Grid . SetColumnSpan ( sep , 2 ) ;
545
- break ;
547
+ Grid . SetColumn ( contentControl , 1 ) ;
548
+ Grid . SetRow ( contentControl , rowCount ) ;
549
+ if ( rowCount != 0 )
550
+ mainPanel . Children . Add ( sep ) ;
551
+ Grid . SetRow ( sep , rowCount ) ;
552
+ Grid . SetColumn ( sep , 0 ) ;
553
+ Grid . SetColumnSpan ( sep , 2 ) ;
554
+ break ;
546
555
}
547
556
case "dropdown" :
548
557
{
@@ -559,14 +568,14 @@ public Control CreateSettingPanel()
559
568
Settings [ attribute . Name ] = ( string ) ( ( System . Windows . Controls . ComboBox ) sender ) . SelectedItem ;
560
569
} ;
561
570
contentControl = comboBox ;
562
- Grid . SetColumn ( contentControl , 1 ) ;
563
- Grid . SetRow ( contentControl , rowCount ) ;
564
- if ( rowCount != 0 )
565
- mainPanel . Children . Add ( sep ) ;
566
- Grid . SetRow ( sep , rowCount ) ;
567
- Grid . SetColumn ( sep , 0 ) ;
568
- Grid . SetColumnSpan ( sep , 2 ) ;
569
- break ;
571
+ Grid . SetColumn ( contentControl , 1 ) ;
572
+ Grid . SetRow ( contentControl , rowCount ) ;
573
+ if ( rowCount != 0 )
574
+ mainPanel . Children . Add ( sep ) ;
575
+ Grid . SetRow ( sep , rowCount ) ;
576
+ Grid . SetColumn ( sep , 0 ) ;
577
+ Grid . SetColumnSpan ( sep , 2 ) ;
578
+ break ;
570
579
}
571
580
case "checkbox" :
572
581
var checkBox = new CheckBox
@@ -592,13 +601,11 @@ public Control CreateSettingPanel()
592
601
case "hyperlink" :
593
602
var hyperlink = new Hyperlink
594
603
{
595
- ToolTip = attribute . Description ,
596
- NavigateUri = attribute . url
604
+ ToolTip = attribute . Description , NavigateUri = attribute . url
597
605
} ;
598
606
var linkbtn = new System . Windows . Controls . Button
599
607
{
600
- HorizontalAlignment = System . Windows . HorizontalAlignment . Right ,
601
- Margin = settingControlMargin
608
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Right , Margin = settingControlMargin
602
609
} ;
603
610
linkbtn . Content = attribute . urlLabel ;
604
611
@@ -619,7 +626,7 @@ public Control CreateSettingPanel()
619
626
mainPanel . Children . Add ( panel ) ;
620
627
mainPanel . Children . Add ( contentControl ) ;
621
628
rowCount ++ ;
622
-
629
+
623
630
}
624
631
return settingWindow ;
625
632
}
0 commit comments