Skip to content

Commit 5cb3030

Browse files
committed
Merge pull request #1441 from kellyelton/master
Squeltch some errors
2 parents bcab340 + 453a100 commit 5cb3030

File tree

3 files changed

+47
-23
lines changed

3 files changed

+47
-23
lines changed

octgnFX/Octgn/App.xaml.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
using Octgn.Library.Exceptions;
1818

1919
using log4net;
20-
20+
using Octgn.Core.Plugin;
21+
using Octgn.Library.Plugin;
2122
using Octgn.Play;
2223
using Octgn.Utils;
2324
using Octgn.Windows;
@@ -70,6 +71,24 @@ protected override void OnStartup(StartupEventArgs e)
7071
args.Cancel = gotit;
7172
return;
7273
}
74+
var src = args.Exception.Source;
75+
try
76+
{
77+
foreach (var plug in PluginManager.GetPlugins<IDeckBuilderPlugin>())
78+
{
79+
var pt = plug.GetType();
80+
var pn = pt.Assembly.GetName();
81+
if (src == pn.Name)
82+
{
83+
args.Cancel = true;
84+
return;
85+
}
86+
}
87+
}
88+
catch(Exception ex)
89+
{
90+
Log.Error("Check against plugins error", ex);
91+
}
7392
if (X.Instance.Debug)
7493
{
7594
args.Cancel = true;

octgnFX/Octgn/Play/Gui/CardControl.xaml.cs

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public partial class CardControl : INotifyPropertyChanged
6868
FrameworkPropertyMetadataOptions.Inherits));
6969

7070
public static readonly DependencyProperty IsAnchoredProperty = DependencyProperty.Register(
71-
"IsAnchored", typeof (bool), typeof (CardControl), new PropertyMetadata(default(bool)));
71+
"IsAnchored", typeof(bool), typeof(CardControl), new PropertyMetadata(default(bool)));
7272

7373
public bool IsAnchored
7474
{
75-
get { return (bool) GetValue(IsAnchoredProperty); }
75+
get { return (bool)GetValue(IsAnchoredProperty); }
7676
set { SetValue(IsAnchoredProperty, value); }
7777
}
7878

@@ -87,11 +87,11 @@ public static void SetAnimateLoad(DependencyObject obj, bool value)
8787
}
8888

8989
public static readonly DependencyProperty CardImageStretchProperty = DependencyProperty.Register(
90-
"CardImageStretch", typeof (Stretch), typeof (CardControl), new PropertyMetadata(Stretch.Fill));
90+
"CardImageStretch", typeof(Stretch), typeof(CardControl), new PropertyMetadata(Stretch.Fill));
9191

9292
public Stretch CardImageStretch
9393
{
94-
get { return (Stretch) GetValue(CardImageStretchProperty); }
94+
get { return (Stretch)GetValue(CardImageStretchProperty); }
9595
set { SetValue(CardImageStretchProperty, value); }
9696
}
9797

@@ -120,7 +120,7 @@ public CardControl()
120120
anchoredIcon.Width = markerSize;
121121
peekers.SetValue(TextBlock.FontSizeProperty, markerSize * 0.8);
122122
//if (Program.GameEngine.Definition.CardCornerRadius > 0)
123-
img.Clip = new RectangleGeometry();
123+
img.Clip = new RectangleGeometry();
124124
AddHandler(MarkerControl.MarkerDroppedEvent, new EventHandler<MarkerEventArgs>(MarkerDropped));
125125
AddHandler(TableControl.TableKeyEvent, new EventHandler<TableKeyEventArgs>(TableKeyDown));
126126
DataContextChanged += CardChangedHandler;
@@ -265,7 +265,7 @@ private static void IsAlwaysUpChanged(DependencyObject sender, DependencyPropert
265265
protected override Size MeasureOverride(Size constraint)
266266
{
267267
//Program.GameMess.GameDebug("MeasureOverride " + constraint);
268-
if (img == null)
268+
if (img == null)
269269
return constraint;
270270
img.Measure(constraint);
271271
if (img.Clip != null)
@@ -276,11 +276,11 @@ protected override Size MeasureOverride(Size constraint)
276276
//clipRect.RadiusX = clipRect.RadiusY = Program.GameEngine.Definition.CardCornerRadius * clipRect.Rect.Height / cs.Height;
277277
if (IsUp)
278278
{
279-
clipRect.RadiusX = clipRect.RadiusY = cs.CornerRadius*clipRect.Rect.Height/cs.Height;
279+
clipRect.RadiusX = clipRect.RadiusY = cs.CornerRadius * clipRect.Rect.Height / cs.Height;
280280
}
281281
else
282282
{
283-
clipRect.RadiusX = clipRect.RadiusY = cs.BackCornerRadius*clipRect.Rect.Height/cs.BackHeight;
283+
clipRect.RadiusX = clipRect.RadiusY = cs.BackCornerRadius * clipRect.Rect.Height / cs.BackHeight;
284284
}
285285
}
286286
return img.DesiredSize;
@@ -303,13 +303,13 @@ private void CardChangedHandler(object sender, DependencyPropertyChangedEventArg
303303
// If IsUp changes, it automatically updates the picture.
304304
// Otherwise do it explicitely
305305
if (oldIsUp == IsUp)
306-
SetDisplayedPicture(Card.GetBitmapImage(IsUp));
307-
//SetDisplayedPicture(Card.GetPicture(IsUp));
306+
SetDisplayedPicture(Card.GetBitmapImage(IsUp));
307+
//SetDisplayedPicture(Card.GetPicture(IsUp));
308308
IsAnchored = Card.Anchored;
309309
UpdateInvertedTransform();
310310
Card.PropertyChanged += PropertyChangeHandler;
311311
//InvalidateMeasure();
312-
InvalidateVisual();
312+
InvalidateVisual();
313313
OnPropertyChanged("ActualWidth");
314314
OnPropertyChanged("ActualHeight");
315315
AnimateOrientation(Card.Orientation);
@@ -494,7 +494,7 @@ protected void LeftButtonDownOverImage(object sender, MouseEventArgs e)
494494
if (window != null)
495495
_mouseWindowPt = TranslatePoint(_mousePt, (UIElement)window.Content);
496496
_dragSource = Keyboard.Modifiers == ModifierKeys.Shift ? DragSource.Target : DragSource.Card;
497-
if(Card.Anchored && _dragSource == DragSource.Card)
497+
if (Card.Anchored && _dragSource == DragSource.Card)
498498
_dragSource = DragSource.None;
499499
CaptureMouse();
500500
}
@@ -728,11 +728,11 @@ protected void DragCardStarted()
728728
var cs = Card == null ? Program.GameEngine.Definition.CardSize : Card.Size;
729729
if (IsUp)
730730
{
731-
_mouseOffset = new Vector(_mousePt.X*cs.Width/ActualWidth, _mousePt.Y*cs.Height/ActualHeight);
731+
_mouseOffset = new Vector(_mousePt.X * cs.Width / ActualWidth, _mousePt.Y * cs.Height / ActualHeight);
732732
}
733733
else
734734
{
735-
_mouseOffset = new Vector(_mousePt.X*cs.BackWidth/ActualWidth, _mousePt.Y*cs.BackHeight/ActualHeight);
735+
_mouseOffset = new Vector(_mousePt.X * cs.BackWidth / ActualWidth, _mousePt.Y * cs.BackHeight / ActualHeight);
736736
}
737737

738738
// Create adorners
@@ -799,7 +799,7 @@ protected void DragCardCompleted()
799799
// Release the card and its group
800800
foreach (Card c in DraggedCards)
801801
{
802-
if(c != null)
802+
if (c != null)
803803
c.ReleaseControl();
804804
}
805805
Card.Group.ReleaseControl();
@@ -872,12 +872,17 @@ protected void DragMouseDelta(double dx, double dy)
872872
if (!overArgs.FaceUp.HasValue)
873873
overArgs.FaceUp = (Keyboard.Modifiers & ModifierKeys.Shift) == 0;
874874

875-
var i = 0;
876-
foreach (CardDragAdorner overlay in OverlayElements)
875+
try
877876
{
878-
var crd = overArgs.Cards.IndexOf(overArgs.Cards.FirstOrDefault(x => x.Id == overlay.SourceCard.Card.Id));
879-
overlay.SetState(dx, dy, true, overArgs.CardSizes[crd], overArgs.FaceUp.Value, overlay.OnHoverRequestInverted);
880-
i++;
877+
foreach (CardDragAdorner overlay in OverlayElements)
878+
{
879+
var crd = overArgs.Cards.IndexOf(overArgs.Cards.FirstOrDefault(x => x.Id == overlay.SourceCard.Card.Id));
880+
overlay.SetState(dx, dy, true, overArgs.CardSizes[crd], overArgs.FaceUp.Value, overlay.OnHoverRequestInverted);
881+
}
882+
}
883+
catch (Exception e)
884+
{
885+
Log.Info("DragMouseDelta", e);
881886
}
882887

883888
return;
@@ -1105,7 +1110,7 @@ private void TableKeyDown(object source, TableKeyEventArgs te)
11051110
}
11061111
catch (Exception e)
11071112
{
1108-
Log.Warn("TableKeyDown Error",e);
1113+
Log.Warn("TableKeyDown Error", e);
11091114
}
11101115
}
11111116

recentchanges.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Can now click through transparent areas of Cards - Kelly
1+
Fixed a few spam errors - Kelly

0 commit comments

Comments
 (0)