Updated editor to use project model

Updated editor to use project model

--- Test2d/Editor/Editor.cs
+++ Test2d/Editor/Editor.cs
@@ -12,7 +12,7 @@
 {
     public class Editor : ObservableObject
     {
-        private Container _container;
+        private Project _project;
         private IRenderer _renderer;
         private BaseShape _shape;
         private Tool _currentTool = Tool.Selection;
@@ -29,16 +29,21 @@
         private double _startY;
         private double _hitTreshold = 6.0;
         private bool _tryToConnect = true;
-
+
         public Container Container
         {
-            get { return _container; }
+            get { return Project.CurrentDocument.CurrentContainer; }
+        }
+
+        public Project Project
+        {
+            get { return _project; }
             set
             {
-                if (value != _container)
-                {
-                    _container = value;
-                    Notify("Container");
+                if (value != _project)
+                {
+                    _project = value;
+                    Notify("Project");
                 }
             }
         }
@@ -214,7 +219,7 @@

         public Func<string> GetImagePath { get; set; }

-        public static Editor Create(Container container, IRenderer renderer)
+        public static Editor Create(Project project, IRenderer renderer)
         {
             var editor = new Editor()
             {
@@ -238,8 +243,8 @@
                     LineStyle.Create(
                         ArrowStyle.Create(),
                         ArrowStyle.Create()));
-
-            editor.Container = container;
+
+            editor.Project = project;
             editor.Renderer = renderer;

             if (editor.EnableObserver)
@@ -491,21 +496,21 @@

         public void RemoveCurrentGroupLibrary()
         {
-            var gl = Container.CurrentGroupLibrary;
+            var gl = Project.CurrentGroupLibrary;
             if (gl != null)
             {
-                Container.GroupLibraries.Remove(gl);
-                Container.CurrentGroupLibrary = Container.GroupLibraries.FirstOrDefault();
+                Project.GroupLibraries.Remove(gl);
+                Project.CurrentGroupLibrary = Project.GroupLibraries.FirstOrDefault();
             }
         }

         public void RemoveCurrentGroup()
         {
-            var group = Container.CurrentGroupLibrary.CurrentGroup;
+            var group = Project.CurrentGroupLibrary.CurrentGroup;
             if (group != null)
             {
-                Container.CurrentGroupLibrary.Groups.Remove(group);
-                Container.CurrentGroupLibrary.CurrentGroup = Container.CurrentGroupLibrary.Groups.FirstOrDefault();
+                Project.CurrentGroupLibrary.Groups.Remove(group);
+                Project.CurrentGroupLibrary.CurrentGroup = Project.CurrentGroupLibrary.Groups.FirstOrDefault();
             }
         }

@@ -533,29 +538,29 @@

         public void RemoveCurrentStyleGroup()
         {
-            var sg = Container.CurrentStyleGroup;
+            var sg = Project.CurrentStyleGroup;
             if (sg != null)
             {
-                Container.StyleGroups.Remove(sg);
-                Container.CurrentStyleGroup = Container.StyleGroups.FirstOrDefault();
+                Project.StyleGroups.Remove(sg);
+                Project.CurrentStyleGroup = Project.StyleGroups.FirstOrDefault();
             }
         }

         public void RemoveCurrentStyle()
         {
-            var style = Container.CurrentStyleGroup.CurrentStyle;
+            var style = Project.CurrentStyleGroup.CurrentStyle;
             if (style != null)
             {
-                Container.CurrentStyleGroup.Styles.Remove(style);
-                Container.CurrentStyleGroup.CurrentStyle = Container.CurrentStyleGroup.Styles.FirstOrDefault();
-            }
-        }
-
-        public void Load(Container container)
+                Project.CurrentStyleGroup.Styles.Remove(style);
+                Project.CurrentStyleGroup.CurrentStyle = Project.CurrentStyleGroup.Styles.FirstOrDefault();
+            }
+        }
+
+        public void Load(Project project)
         {
             Renderer.ClearCache();

-            Container = container;
+            Project = project;
             Container.Invalidate();

             if (EnableObserver)
@@ -636,15 +641,15 @@
         {
             if (_renderer.SelectedShape != null)
             {
-                _container.CurrentLayer.Shapes.Remove(_renderer.SelectedShape);
-                _container.CurrentLayer.Invalidate();
+                Container.CurrentLayer.Shapes.Remove(_renderer.SelectedShape);
+                Container.CurrentLayer.Invalidate();

                 _renderer.SelectedShape = null;
             }

             if (_renderer.SelectedShapes != null)
             {
-                var layer = _container.CurrentLayer;
+                var layer = Container.CurrentLayer;

                 foreach (var shape in _renderer.SelectedShapes)
                 {
@@ -723,7 +728,7 @@

         public void TryToConnectStart(XLine line, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 line.Start = result as XPoint;
@@ -732,7 +737,7 @@

         public void TryToConnectEnd(XLine line, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 line.End = result as XPoint;
@@ -741,7 +746,7 @@

         public void TryToConnectTopLeft(XRectangle rectangle, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 rectangle.TopLeft = result as XPoint;
@@ -750,7 +755,7 @@

         public void TryToConnectBottomRight(XRectangle rectangle, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 rectangle.BottomRight = result as XPoint;
@@ -759,7 +764,7 @@

         public void TryToConnectTopLeft(XEllipse ellipse, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 ellipse.TopLeft = result as XPoint;
@@ -768,7 +773,7 @@

         public void TryToConnectBottomRight(XEllipse ellipse, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 ellipse.BottomRight = result as XPoint;
@@ -777,7 +782,7 @@

         public void TryToConnectPoint1(XArc arc, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 arc.Point1 = result as XPoint;
@@ -786,7 +791,7 @@

         public void TryToConnectPoint2(XArc arc, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 arc.Point2 = result as XPoint;
@@ -795,7 +800,7 @@

         public void TryToConnectPoint1(XBezier bezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 bezier.Point1 = result as XPoint;
@@ -804,7 +809,7 @@

         public void TryToConnectPoint2(XBezier bezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 bezier.Point2 = result as XPoint;
@@ -813,7 +818,7 @@

         public void TryToConnectPoint3(XBezier bezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 bezier.Point3 = result as XPoint;
@@ -822,7 +827,7 @@

         public void TryToConnectPoint4(XBezier bezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 bezier.Point4 = result as XPoint;
@@ -831,7 +836,7 @@

         public void TryToConnectPoint1(XQBezier qbezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 qbezier.Point1 = result as XPoint;
@@ -840,7 +845,7 @@

         public void TryToConnectPoint2(XQBezier qbezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 qbezier.Point2 = result as XPoint;
@@ -849,7 +854,7 @@

         public void TryToConnectPoint3(XQBezier qbezier, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 qbezier.Point3 = result as XPoint;
@@ -858,7 +863,7 @@

         public void TryToConnectTopLeft(XText text, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 text.TopLeft = result as XPoint;
@@ -867,7 +872,7 @@

         public void TryToConnectBottomRight(XText text, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 text.BottomRight = result as XPoint;
@@ -876,7 +881,7 @@

         public void TryToConnectTopLeft(XImage image, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 image.TopLeft = result as XPoint;
@@ -885,7 +890,7 @@

         public void TryToConnectBottomRight(XImage image, double x, double y)
         {
-            var result = ShapeBounds.HitTest(_container, new Vector2(x, y), _hitTreshold);
+            var result = ShapeBounds.HitTest(Container, new Vector2(x, y), _hitTreshold);
             if (result != null && result is XPoint)
             {
                 image.BottomRight = result as XPoint;
@@ -896,40 +901,40 @@
         {
             return Container.CurrentLayer != null
                 && Container.CurrentLayer.IsVisible
-                && Container.CurrentStyleGroup != null
-                && Container.CurrentStyleGroup.CurrentStyle != null;
+                && Project.CurrentStyleGroup != null
+                && Project.CurrentStyleGroup.CurrentStyle != null;
         }

         public bool IsLeftUpAvailable()
         {
             return Container.CurrentLayer != null
                 && Container.CurrentLayer.IsVisible
-                && Container.CurrentStyleGroup != null
-                && Container.CurrentStyleGroup.CurrentStyle != null;
+                && Project.CurrentStyleGroup != null
+                && Project.CurrentStyleGroup.CurrentStyle != null;
         }

         public bool IsRightDownAvailable()
         {
             return Container.CurrentLayer != null
                 && Container.CurrentLayer.IsVisible
-                && Container.CurrentStyleGroup != null
-                && Container.CurrentStyleGroup.CurrentStyle != null;
+                && Project.CurrentStyleGroup != null
+                && Project.CurrentStyleGroup.CurrentStyle != null;
         }

         public bool IsRightUpAvailable()
         {
             return Container.CurrentLayer != null
                 && Container.CurrentLayer.IsVisible
-                && Container.CurrentStyleGroup != null
-                && Container.CurrentStyleGroup.CurrentStyle != null;
+                && Project.CurrentStyleGroup != null
+                && Project.CurrentStyleGroup.CurrentStyle != null;
         }

         public bool IsMoveAvailable()
         {
             return Container.CurrentLayer != null
                 && Container.CurrentLayer.IsVisible
-                && Container.CurrentStyleGroup != null
-                && Container.CurrentStyleGroup.CurrentStyle != null;
+                && Project.CurrentStyleGroup != null
+                && Project.CurrentStyleGroup.CurrentStyle != null;
         }

         public bool IsSelectionAvailable()
@@ -947,7 +952,7 @@
                         if (_renderer.SelectedShape == null
                             && _renderer.SelectedShapes != null)
                         {
-                            var result = ShapeBounds.HitTest(_container, new Vector2(sx, sy), _hitTreshold);
+                            var result = ShapeBounds.HitTest(Container, new Vector2(sx, sy), _hitTreshold);
                             if (result != null)
                             {
                                 _startX = SnapToGrid ? Snap(sx, SnapX) : sx;
@@ -958,7 +963,7 @@
                             }
                         }

-                        if (TryToSelectShape(_container, sx, sy))
+                        if (TryToSelectShape(Container, sx, sy))
                         {
                             _startX = SnapToGrid ? Snap(sx, SnapX) : sx;
                             _startY = SnapToGrid ? Snap(sy, SnapY) : sy;
@@ -972,8 +977,8 @@
                             _selectionStyle,
                             null,
                             true);
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -984,8 +989,8 @@
                         {
                             rectangle.BottomRight.X = sx;
                             rectangle.BottomRight.Y = sy;
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.WorkingLayer.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1012,11 +1017,11 @@
                         {
                             rectangle.BottomRight.X = sx;
                             rectangle.BottomRight.Y = sy;
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.WorkingLayer.Invalidate();
                             CurrentState = State.None;

-                            TryToSelectShapes(_container, rectangle);
+                            TryToSelectShapes(Container, rectangle);
                         }
                     }
                     break;
@@ -1029,9 +1034,9 @@
             {
                 case State.None:
                     {
-                        _shape = XPoint.Create(sx, sy, _container.PointShape);
-                        _container.CurrentLayer.Shapes.Add(_shape);
-                        _container.Invalidate();
+                        _shape = XPoint.Create(sx, sy, Project.PointShape);
+                        Container.CurrentLayer.Shapes.Add(_shape);
+                        Container.Invalidate();
                     }
                     break;
             }
@@ -1045,14 +1050,14 @@
                     {
                         _shape = XLine.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape);
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape);
                         if (_tryToConnect)
                         {
                             TryToConnectStart(_shape as XLine, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1067,9 +1072,9 @@
                             {
                                 TryToConnectEnd(_shape as XLine, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1085,15 +1090,15 @@
                     {
                         _shape = XRectangle.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectTopLeft(_shape as XRectangle, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1108,9 +1113,9 @@
                             {
                                 TryToConnectBottomRight(_shape as XRectangle, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1126,15 +1131,15 @@
                     {
                         _shape = XEllipse.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectTopLeft(_shape as XEllipse, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1149,9 +1154,9 @@
                             {
                                 TryToConnectBottomRight(_shape as XEllipse, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1167,15 +1172,15 @@
                     {
                         _shape = XArc.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectPoint1(_shape as XArc, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1190,9 +1195,9 @@
                             {
                                 TryToConnectPoint2(_shape as XArc, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1208,15 +1213,15 @@
                     {
                         _shape = XBezier.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectPoint1(_shape as XBezier, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1235,7 +1240,7 @@
                             {
                                 TryToConnectPoint4(_shape as XBezier, sx, sy);
                             }
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                             CurrentState = State.Two;
                         }
                     }
@@ -1253,7 +1258,7 @@
                             {
                                 TryToConnectPoint3(_shape as XBezier, sx, sy);
                             }
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                             CurrentState = State.Three;
                         }
                     }
@@ -1269,9 +1274,9 @@
                             {
                                 TryToConnectPoint2(_shape as XBezier, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1287,15 +1292,15 @@
                     {
                         _shape = XQBezier.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectPoint1(_shape as XQBezier, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1312,7 +1317,7 @@
                             {
                                 TryToConnectPoint3(_shape as XQBezier, sx, sy);
                             }
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                             CurrentState = State.Two;
                         }
                     }
@@ -1328,9 +1333,9 @@
                             {
                                 TryToConnectPoint2(_shape as XQBezier, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1346,16 +1351,16 @@
                     {
                         _shape = XText.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             "Text",
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectTopLeft(_shape as XText, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1370,9 +1375,9 @@
                             {
                                 TryToConnectBottomRight(_shape as XText, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1394,16 +1399,16 @@

                         _shape = XImage.Create(
                             sx, sy,
-                            _container.CurrentStyleGroup.CurrentStyle,
-                            _container.PointShape,
+                            Project.CurrentStyleGroup.CurrentStyle,
+                            Project.PointShape,
                             uri,
                             DefaultIsFilled);
                         if (_tryToConnect)
                         {
                             TryToConnectTopLeft(_shape as XImage, sx, sy);
                         }
-                        _container.WorkingLayer.Shapes.Add(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Add(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.One;
                     }
                     break;
@@ -1418,9 +1423,9 @@
                             {
                                 TryToConnectBottomRight(_shape as XImage, sx, sy);
                             }
-                            _container.WorkingLayer.Shapes.Remove(_shape);
-                            _container.CurrentLayer.Shapes.Add(_shape);
-                            _container.Invalidate();
+                            Container.WorkingLayer.Shapes.Remove(_shape);
+                            Container.CurrentLayer.Shapes.Add(_shape);
+                            Container.Invalidate();
                             CurrentState = State.None;
                         }
                     }
@@ -1434,7 +1439,7 @@
             {
                 case State.None:
                     {
-                        IsContextMenu = TryToSelectShape(_container, sx, sy) ? true : false;
+                        IsContextMenu = TryToSelectShape(Container, sx, sy) ? true : false;
                     }
                     break;
             }
@@ -1457,8 +1462,8 @@
                     break;
                 case State.One:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1473,8 +1478,8 @@
                     break;
                 case State.One:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1489,8 +1494,8 @@
                     break;
                 case State.One:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1505,8 +1510,8 @@
                     break;
                 case State.One:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1523,8 +1528,8 @@
                 case State.Two:
                 case State.Three:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1540,8 +1545,8 @@
                 case State.One:
                 case State.Two:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1556,8 +1561,8 @@
                     break;
                 case State.One:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1572,8 +1577,8 @@
                     break;
                 case State.One:
                     {
-                        _container.WorkingLayer.Shapes.Remove(_shape);
-                        _container.WorkingLayer.Invalidate();
+                        Container.WorkingLayer.Shapes.Remove(_shape);
+                        Container.WorkingLayer.Invalidate();
                         CurrentState = State.None;
                     }
                     break;
@@ -1599,7 +1604,7 @@
                         {
                             rectangle.BottomRight.X = sx;
                             rectangle.BottomRight.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1628,7 +1633,7 @@
                         {
                             line.End.X = sx;
                             line.End.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1648,7 +1653,7 @@
                         {
                             rectangle.BottomRight.X = sx;
                             rectangle.BottomRight.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1668,7 +1673,7 @@
                         {
                             ellipse.BottomRight.X = sx;
                             ellipse.BottomRight.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1688,7 +1693,7 @@
                         {
                             arc.Point2.X = sx;
                             arc.Point2.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1712,7 +1717,7 @@
                             bezier.Point3.Y = sy;
                             bezier.Point4.X = sx;
                             bezier.Point4.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1725,7 +1730,7 @@
                             bezier.Point2.Y = sy;
                             bezier.Point3.X = sx;
                             bezier.Point3.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1736,7 +1741,7 @@
                         {
                             bezier.Point2.X = sx;
                             bezier.Point2.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1758,7 +1763,7 @@
                             qbezier.Point2.Y = sy;
                             qbezier.Point3.X = sx;
                             qbezier.Point3.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1769,7 +1774,7 @@
                         {
                             qbezier.Point2.X = sx;
                             qbezier.Point2.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1789,7 +1794,7 @@
                         {
                             text.BottomRight.X = sx;
                             text.BottomRight.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;
@@ -1809,7 +1814,7 @@
                         {
                             image.BottomRight.X = sx;
                             image.BottomRight.Y = sy;
-                            _container.WorkingLayer.Invalidate();
+                            Container.WorkingLayer.Invalidate();
                         }
                     }
                     break;


Always check for selected connectors

Always check for selected connectors

--- Test2d/Shapes/XGroup.cs
+++ Test2d/Shapes/XGroup.cs
@@ -97,36 +97,36 @@
                 {
                     shape.Draw(dc, renderer, dx, dy, db, record);
                 }
+            }

-                if (renderer.State.SelectedShape != null)
-                {
-                    if (this == renderer.State.SelectedShape)
-                    {
-                        foreach (var connector in Connectors)
+            if (renderer.State.SelectedShape != null)
+            {
+                if (this == renderer.State.SelectedShape)
+                {
+                    foreach (var connector in Connectors)
+                    {
+                        connector.Draw(dc, renderer, dx, dy, db, record);
+                    }
+                }
+                else
+                {
+                    foreach (var connector in Connectors)
+                    {
+                        if (connector == renderer.State.SelectedShape)
                         {
                             connector.Draw(dc, renderer, dx, dy, db, record);
                         }
                     }
-                    else
-                    {
-                        foreach (var connector in Connectors)
-                        {
-                            if (connector == renderer.State.SelectedShape)
-                            {
-                                connector.Draw(dc, renderer, dx, dy, db, record);
-                            }
-                        }
-                    }
-                }
-
-                if (renderer.State.SelectedShapes != null)
-                {
-                    if (renderer.State.SelectedShapes.Contains(this))
-                    {
-                        foreach (var connector in Connectors)
-                        {
-                            connector.Draw(dc, renderer, dx, dy, db, record);
-                        }
+                }
+            }
+
+            if (renderer.State.SelectedShapes != null)
+            {
+                if (renderer.State.SelectedShapes.Contains(this))
+                {
+                    foreach (var connector in Connectors)
+                    {
+                        connector.Draw(dc, renderer, dx, dy, db, record);
                     }
                 }
             }


Fixing bug in login process

Fixing bug in login process

--- src/BistroFiftyTwo.Server/Services/UserAccountService.cs
+++ src/BistroFiftyTwo.Server/Services/UserAccountService.cs
@@ -91,6 +91,8 @@
         {
             var userAccount = await Repository.GetByLoginAsync(login);

+            if (userAccount == null) return null;
+
             if (userAccount.PasswordFormat != (int) PasswordFormat.Hashed)
                 if (userAccount.AccountPassword.Equals(password))
                     return userAccount;


- flag fix

- flag fix

--- src/Implementation/FrannHammer.NetCore.WebApi/Startup.cs
+++ src/Implementation/FrannHammer.NetCore.WebApi/Startup.cs
@@ -146,7 +146,7 @@

         private void SeedData(ICharacterDataScraper characterDataScraper, DebugStorageLocationResolver fileLocationResolver)
         {
-#if DEBUG
+#if !DEBUG
             var charactersToSeed = Characters.All;
             foreach (var character in charactersToSeed)
             {
@@ -177,7 +177,7 @@
                 }
             }
 #endif
-#if !DEBUG
+#if DEBUG
             _characterData.AddRange(JsonConvert.DeserializeObject<List<Character>>(File.ReadAllText(fileLocationResolver.Character)));
             _moveData.AddRange(JsonConvert.DeserializeObject<List<Move>>(File.ReadAllText(fileLocationResolver.Move)));
             _movementData.AddRange(JsonConvert.DeserializeObject<List<Movement>>(File.ReadAllText(fileLocationResolver.Movement)));


Fixed falining tests after change on session state for finished envelopes

--- src/Lime.Protocol.UnitTests/Server/ServerChannelTests.cs
+++ src/Lime.Protocol.UnitTests/Server/ServerChannelTests.cs
@@ -536,11 +536,17 @@

         [TestMethod]
         [TestCategory("SendFinishedSessionAsync")]
-        [ExpectedException(typeof(InvalidOperationException))]
-        public async Task SendFinishedSessionAsync_NewState_ThrowsInvalidOperationException()
+        public async Task SendFinishedSessionAsync_NewState_ClosesTransport()
         {
             var target = GetTarget();
             await target.SendFinishedSessionAsync();
+
+            _transport.Verify(
+                t => t.CloseAsync(
+                    It.IsAny<CancellationToken>()));
+
+            Assert.AreEqual(target.State, SessionState.Finished);
+
         }

         #endregion


Fix inline CSS source map paths

Fix inline CSS source map paths

Fix incorrect relative paths to CSS source maps when CSS is inlined.

--- src/LondonTravel.Site/TagHelpers/InlineStyleTagHelper.cs
+++ src/LondonTravel.Site/TagHelpers/InlineStyleTagHelper.cs
@@ -112,6 +112,8 @@
                     css = MinifyCss(css);
                 }

+                css = FixSourceMapPath(css, filePath);
+
                 Cache.Set(cacheKey, css);
             }

@@ -167,5 +169,48 @@

             return builder.ToString();
         }
+
+        /// <summary>
+        /// Attempts to fix the source map path for the specified CSS.
+        /// </summary>
+        /// <param name="css">The CSS that may contain a source map path.</param>
+        /// <param name="filePath">The path of the file containing the CSS.</param>
+        /// <returns>
+        /// The CSS that may have had the source map path fixed.
+        /// </returns>
+        /// <remarks>
+        /// Rendering the CSS inline with an embedded source map path in a comment
+        /// may result in 404 errors from trying to fetch the map file with a relative
+        /// path to the document where the CSS is inlined, which is unlikely to match
+        /// the relative path from the original CSS file that the map file has.
+        /// </remarks>
+        private string FixSourceMapPath(string css, string filePath)
+        {
+            // Is there a map file?
+            string mapFilePath = $"{filePath}.map";
+            IFileInfo fileInfo = HostingEnvironment.WebRootFileProvider.GetFileInfo(mapFilePath);
+
+            if (fileInfo.Exists)
+            {
+                const string SourceMapPreamble = "sourceMappingURL=";
+
+                int startIndex = css.IndexOf(SourceMapPreamble);
+
+                if (startIndex > -1)
+                {
+                    startIndex += SourceMapPreamble.Length;
+
+                    int endIndex = css.IndexOf(" ", startIndex);
+
+                    if (endIndex > -1)
+                    {
+                        css = css.Remove(startIndex, endIndex - startIndex);
+                        css = css.Insert(startIndex, mapFilePath);
+                    }
+                }
+            }
+
+            return css;
+        }
     }
 }


Remove leftover unused stack variable

Remove leftover unused stack variable

--- src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs
+++ src/Nest/CommonAbstractions/Infer/Field/FieldResolver.cs
@@ -18,8 +18,6 @@

 		private readonly ConcurrentDictionary<Field, string> Fields = new ConcurrentDictionary<Field, string>();
 		private readonly ConcurrentDictionary<PropertyName, string> Properties = new ConcurrentDictionary<PropertyName, string>();
-
-		protected Stack<string> Stack { get; set;}

 		public FieldResolver(IConnectionSettingsValues settings)
 		{


Fixed a typo.

Fixed a typo.

--- src/Orchard.Web/Modules/Orchard.Email/Forms/EmailForm.cs
+++ src/Orchard.Web/Modules/Orchard.Email/Forms/EmailForm.cs
@@ -44,7 +44,7 @@

                     form._Type._Priority.Add(new SelectListItem { Value = "-50", Text = T("Low").Text });
                     form._Type._Priority.Add(new SelectListItem { Value = "0", Text = T("Normal").Text });
-                    form._Type._Priority.Add(new SelectListItem { Value = "50", Text = T("Hight").Text });
+                    form._Type._Priority.Add(new SelectListItem { Value = "50", Text = T("High").Text });

                     return form;
                 };


Check completion in strings after completion for folders

--- src/R/Editor/Impl/Completion/Engine/RCompletionEngine.cs
+++ src/R/Editor/Impl/Completion/Engine/RCompletionEngine.cs
@@ -34,17 +34,19 @@
                 return providers;
             }

-            var tokenNode = context.AstRoot.GetNodeOfTypeFromPosition<TokenNode>(context.Position);
-            if (tokenNode != null && tokenNode.Token.TokenType == RTokenType.String) {
-                // No completion in string
-                return providers;
-            }
-
+            // First check file completion - it happens inside strings
             string directory;
             if(CanShowFileCompletion(context.AstRoot, context.Position, out directory)) {
                 if (!string.IsNullOrEmpty(directory)) {
                     providers.Add(new FilesCompletionProvider(directory));
                 }
+                return providers;
+            }
+
+            // Now check if position is inside a string and if so, suppress completion list
+            var tokenNode = context.AstRoot.GetNodeOfTypeFromPosition<TokenNode>(context.Position);
+            if (tokenNode != null && tokenNode.Token.TokenType == RTokenType.String) {
+                // No completion in string
                 return providers;
             }


find method divided into 3 smaller methods to avoid too much complexity

--- src/Selenium.WebDriver.Extensions/WebDriverExtensions.cs
+++ src/Selenium.WebDriver.Extensions/WebDriverExtensions.cs
@@ -545,7 +545,7 @@
         /// <param name="wrapperFormat">
         /// The wrapper format string for the purpose of wrap the jQuery selection result.
         /// </param>
-        /// <returns>Result of invoking the script.</returns>
+        /// <returns>Parsed result of invoking the script.</returns>
         /// <remarks>
         /// Because of the limitations of the Selenium the only valid types are: <see cref="long"/>,
         /// <see cref="Nullable{Long}"/>, <see cref="bool"/>, <see cref="Nullable{Boolean}"/>, <see cref="string"/>,
@@ -566,7 +566,25 @@
             }

             driver.LoadJQuery();
-
+            return ParseResult<T>(driver.ExecuteScript(by, scriptFormat, wrapperFormat));
+        }
+
+        /// <summary>
+        /// Executes jQuery script.
+        /// </summary>
+        /// <param name="driver">The Selenium web driver.</param>
+        /// <param name="by">The Selenium jQuery selector.</param>
+        /// <param name="scriptFormat">The format string of the script to be invoked.</param>
+        /// <param name="wrapperFormat">
+        /// The wrapper format string for the purpose of wrap the jQuery selection result.
+        /// </param>
+        /// <returns>Result of invoking the script.</returns>
+        private static object ExecuteScript(
+            this IWebDriver driver,
+            JQuerySelector by,
+            string scriptFormat,
+            string wrapperFormat)
+        {
             var javaScriptDriver = (IJavaScriptExecutor)driver;
             var script = by + "." + scriptFormat;
             if (wrapperFormat != null)
@@ -576,13 +594,23 @@

             script = "return " + script + ";";

-            var result = javaScriptDriver.ExecuteScript(script);
+            return javaScriptDriver.ExecuteScript(script);
+        }
+
+        /// <summary>
+        /// Parses the result of executed jQuery script.
+        /// </summary>
+        /// <typeparam name="T">The type of the result to be returned.</typeparam>
+        /// <param name="result">The result of jQuery script.</param>
+        /// <returns>Parsed result of invoking the script.</returns>
+        private static T ParseResult<T>(object result)
+        {
             if (result == null)
             {
                 return default(T);
             }

-            if (typeof(T) == typeof(IEnumerable<IWebElement>)
+            if (typeof(T) == typeof(IEnumerable<IWebElement>)
                 && result.GetType() == typeof(ReadOnlyCollection<object>))
             {
                 result = ((ReadOnlyCollection<object>)result).Cast<IWebElement>();


Workaround potential compiler nullability bug

--- src/System.Memory/src/System/Buffers/ReadOnlySequence.cs
+++ src/System.Memory/src/System/Buffers/ReadOnlySequence.cs
@@ -146,7 +146,9 @@
         /// </summary>
         public ReadOnlySequence(ReadOnlyMemory<T> memory)
         {
+#pragma warning disable CS8631 // TODO-NULLABLE: Unexpected compiler error: https://github.com/dotnet/corefx/pull/38983#issuecomment-506757237
             if (MemoryMarshal.TryGetMemoryManager(memory, out MemoryManager<T>? manager, out int index, out int length))
+#pragma warning restore CS8631
             {
                 _startObject = manager;
                 _endObject = manager;


Fixed the page refresh after a user edits a collection.

--- Phocalstream_Web/Views/Account/EditUserCollection.cshtml
+++ Phocalstream_Web/Views/Account/EditUserCollection.cshtml
@@ -67,7 +67,10 @@
     function save() {
         $.ajax({
             url: '/api/usercollection/RemoveFromCollection?collectionId=' + @Model.ID.ToString() + '&photoIds=' + toRemove.join(','),
-            type: 'POST'
+            type: 'POST',
+            success: function (data) {
+                location.reload();
+            },
         });
     }


Added Time Logging for adb commands

Added Time Logging for adb commands

--- Devices/ADBRemoteControl.cs
+++ Devices/ADBRemoteControl.cs
@@ -294,6 +294,9 @@

         private async Task SendCommand(DeviceCommand command, CancellationToken token)
         {
+            Stopwatch stopWatch = new Stopwatch();
+            stopWatch.Start();
+
             string output;
             switch (command.Id)
             {
@@ -362,6 +365,8 @@
                     await SendCommandCore(command.Data, token).ConfigureAwait(false);
                     break;
             }
+
+            Trace.WriteLine(Invariant($"Executing {command.Id} took {stopWatch.Elapsed}"));
         }

         private async Task<string> SendCommandCore(string commandData, CancellationToken token)


(Needed) Read and Write Buffer Methods

(Needed) Read and Write Buffer Methods

--- source/Cosmos.Core/MemoryBlock.cs
+++ source/Cosmos.Core/MemoryBlock.cs
@@ -102,6 +102,44 @@
         {
             throw new Exception("TODO");
         }
+
+        #region ReadWrite
+        public unsafe void Read8(Byte[] aBuffer)
+        {
+            for (int i = 0; i < aBuffer.Length; i++)
+                aBuffer[i] = (*(Byte*)(Base + i));
+        }
+
+        public unsafe void Write8(Byte[] aBuffer)
+        {
+            for (int i = 0; i < aBuffer.Length; i++)
+                (*(Byte*)(Base + i)) = aBuffer[i];
+        }
+
+        public unsafe void Read16(UInt16[] aBuffer)
+        {
+            for (int i = 0; i < aBuffer.Length; i++)
+                aBuffer[i] = (*(UInt16*)(Base + i));
+        }
+
+        public unsafe void Write16(UInt16[] aBuffer)
+        {
+            for (int i = 0; i < aBuffer.Length; i++)
+                (*(UInt16*)(Base + i)) = aBuffer[i];
+        }
+
+        public unsafe void Read32(UInt32[] aBuffer)
+        {
+            for (int i = 0; i < aBuffer.Length; i++)
+                aBuffer[i] = (*(UInt32*)(Base + i));
+        }
+
+        public unsafe void Write32(UInt32[] aBuffer)
+        {
+            for (int i = 0; i < aBuffer.Length; i++)
+                (*(UInt32*)(Base + i)) = aBuffer[i];
+        }
+        #endregion ReadWrite
     }

     public class MemoryBlock08


Fix merge error.

Fix merge error.

--- source/MongoDB.GridFS/GridFile.cs
+++ source/MongoDB.GridFS/GridFile.cs
@@ -55,8 +55,8 @@
             this.db = db;
             this.files = db[bucket + ".files"];
             this.chunks = db[bucket + ".chunks"];
-            this.chunks.MetaData.CreateIndex(new Document().Add("files_id", 1).Add("n", 1), true);
-            this.files.MetaData.CreateIndex(new Document().Add("filename", 1).Add("n", 1), false);
+            this.chunks.Metadata.CreateIndex(new Document().Add("files_id", 1).Add("n", 1), true);
+            this.files.Metadata.CreateIndex(new Document().Add("filename", 1).Add("n", 1), false);
             this.name = bucket;
         }


Added launchEmail for Windows Phone and changed launchBrowser based on Volker's code

--- src/diddy/native/diddy.xna.cs
+++ src/diddy/native/diddy.xna.cs
@@ -64,22 +64,39 @@
 	public static void showKeyboard()
 	{
 	}
+
+	public static void launchMarket(String address, String windowName)
+	{
+		MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
+		marketplaceDetailTask.ContentIdentifier = address;
+		marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
+		marketplaceDetailTask.Show();
+	}
+
 	public static void launchBrowser(String address, String windowName)
 	{
 #if WINDOWS
 		System.Diagnostics.Process.Start(address);
 #elif WINDOWS_PHONE
-		MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
-		marketplaceDetailTask.ContentIdentifier = address;
-		marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
-		marketplaceDetailTask.Show();
+		WebBrowserTask webBrowserTask = new WebBrowserTask();
+		webBrowserTask.Uri = new Uri(address, UriKind.Absolute);
+		webBrowserTask.Show();
 #endif
 	}
+
 	public static void launchEmail(String email, String subject, String text)
 	{
 #if WINDOWS
 		string message = string.Format("mailto:{0}?subject={1}&body={2}",email, subject, text);
 		System.Diagnostics.Process.Start(message);
+#elif WINDOWS_PHONE
+		EmailComposeTask emailComposeTask = new EmailComposeTask();
+
+		emailComposeTask.Subject = subject;
+		emailComposeTask.Body = text;
+		emailComposeTask.To = email;
+
+		emailComposeTask.Show();
 #endif
 	}


web: Fix Cancel button URL in DeleteForward

--- SupportManager.Web/Areas/Teams/Home/DeleteForward.cshtml
+++ SupportManager.Web/Areas/Teams/Home/DeleteForward.cshtml
@@ -43,7 +43,7 @@
         <div class="col-md-12">
             <input type="submit" value="Delete" class="btn btn-danger" />

-            @Html.ActionLink("Cancel", "Details", null, null, new {@class = "btn btn-default"})
+            @Html.ActionLink("Cancel", "Home", null, null, new {@class = "btn btn-default"})
         </div>
     </div>
 }


d

d

Signed-off-by: Emmanuel Mathot <367ff60fe70ac02365998fe620af37ff67ae3274@gmail.com>

--- Terradue.Tep/Terradue/Tep/Controller/Data/DataPackage.cs
+++ Terradue.Tep/Terradue/Tep/Controller/Data/DataPackage.cs
@@ -28,7 +28,7 @@
 Each user of the platform may define a \ref DataPackage to save a set of dataset that he preselected.
 The 2 following state diagram shows the lifecycle of those data packages in creation and update.

-\startuml
+\startuml "Data package lifecycle #1 state diagram"

 User -> WebPortal: Select data
 WebPortal -> WebServer: Stores in a temporary data package
@@ -39,14 +39,9 @@
 WebServer -> WebPortal: Return new data package
 WebPortal -> User: Data package successfully created

-footer
-TEP Data Package creation state diagram
-(c) Terradue Srl
-endfooter
-
 \enduml

-\startuml
+\startuml "Data package lifecycle #2 state diagram"

 User -> WebPortal: Load existing data package
 WebPortal -> WebServer: Stores the data package in the temporary data package
@@ -62,9 +57,7 @@
 WebPortal -> User: Displays an error message to the user
 end

-footer
-TEP Data Package update state diagram
-(c) Terradue Srl
+
 endfooter

 \enduml


small and hidden bug there

small and hidden bug there

--- Assets/BitStrap/Plugins/Editor/BitPicker/FuzzyFinder.cs
+++ Assets/BitStrap/Plugins/Editor/BitPicker/FuzzyFinder.cs
@@ -15,6 +15,8 @@
 		{
 			if( tempMatches.array == null )
 				tempMatches = new Slice<int>( new int[config.recursionLimit * MeanMaxMatchesPerItem], 0 );
+
+			tempMatches.Count = 0;

 			var recursionCount = 0;
 			score = MatchRecursive( config, text, 0, pattern, 0, ref matches, 0, ref recursionCount );


tell resharper to ignore inconsistentNaming for OnGUI

--- Assets/Scripts/HarryPotterUnity/Utils/NetworkManager.cs
+++ Assets/Scripts/HarryPotterUnity/Utils/NetworkManager.cs
@@ -62,6 +62,7 @@
             //remove players?
         }

+        // ReSharper disable once InconsistentNaming
         public void OnGUI()
         {
             GUI.contentColor = Color.yellow;


MapItemComparer

MapItemComparer

Added a comparison method for MapItems to be able to create distinct
lists (remove duplicates)

--- EOLib/Map.cs
+++ EOLib/Map.cs
@@ -88,6 +88,18 @@
 		public int amount;
 	}

+	public class MapItemComparer : IEqualityComparer<MapItem>
+	{
+		public bool Equals(MapItem mi1, MapItem mi2)
+		{
+			return mi1.uid == mi2.uid;
+		}
+
+		public int GetHashCode(MapItem mi)
+		{
+			return mi.uid;
+		}
+	}
 	public struct MapItem
 	{
 		public short uid;


Change HttpClient to be a static instance

--- Tiver.Fowl.Drivers/Downloaders/ChromeDriverDownloader.cs
+++ Tiver.Fowl.Drivers/Downloaders/ChromeDriverDownloader.cs
@@ -15,6 +15,7 @@
     {
         public IDriverBinary Binary => new ChromeDriverBinary();
         public Uri LinkForDownloadsPage => new Uri("http://chromedriver.storage.googleapis.com/");
+        private static readonly HttpClient HttpClient = new HttpClient();

         public DownloadResult DownloadBinary(string versionNumber)
         {
@@ -64,8 +65,7 @@
         {
             var keys = new List<string>();

-            using (var client = new HttpClient())
-            using (var response = client.GetAsync(LinkForDownloadsPage).Result)
+            using (var response = HttpClient.GetAsync(LinkForDownloadsPage).Result)
             using (var content = response.Content)
             {
                 var result = content.ReadAsStringAsync().Result;
@@ -91,13 +91,9 @@
         {
             try
             {
-                string tempFile;
-                using (var client = new HttpClient())
-                {
-                    var bytes = client.GetByteArrayAsync(downloadLink).Result;
-                    tempFile = Path.GetTempFileName();
-                    File.WriteAllBytes(tempFile, bytes);
-                }
+                var bytes = HttpClient.GetByteArrayAsync(downloadLink).Result;
+                var tempFile = Path.GetTempFileName();
+                File.WriteAllBytes(tempFile, bytes);

                 ZipFile.ExtractToDirectory(tempFile, Config.DownloadLocation);
                 File.Delete(tempFile);
@@ -122,8 +118,7 @@
         {
             var linkForLatestReleaseFile = new Uri(LinkForDownloadsPage, "LATEST_RELEASE");

-            using (var client = new HttpClient())
-            using (var response = client.GetAsync(linkForLatestReleaseFile).Result)
+            using (var response = HttpClient.GetAsync(linkForLatestReleaseFile).Result)
             using (var content = response.Content)
             {
                 var rawResult = content.ReadAsStringAsync().Result;


Add some clarification.

Add some clarification.

--- Evaluator.cs
+++ Evaluator.cs
@@ -155,6 +155,9 @@
     bool isExpression = false;
     try {
       if(tmpCode.StartsWith("=")) {
+        // Special case handling of calculator mode.  The problem is that
+        // expressions involving multiplication are grammatically ambiguous
+        // without a var declaration or some other grammatical construct.
         tmpCode = "(" + tmpCode.Substring(1, tmpCode.Length-1) + ");";
         isExpression = true;
       }


Attempts to create arrays with element type "void" were not throwing the expected exception.
We need to check for attempts to create invalid array types upfront before calling into the ReflectionExecution/TypeLoader layer to create an array.

[tfs-changeset: 1565652]

--- src/System.Private.CoreLib/src/System/Array.cs
+++ src/System.Private.CoreLib/src/System/Array.cs
@@ -146,6 +146,9 @@
             RuntimeType runtimeElementType = elementType as RuntimeType;
             if (runtimeElementType == null)
                 throw new InvalidOperationException(SR.InvalidOperation_ArrayCreateInstance_NotARuntimeType);
+            if (runtimeElementType.Equals(typeof(void)))
+                throw new NotSupportedException(SR.NotSupported_VoidArray);
+
             try
             {
                 if (multiDim)
@@ -155,8 +158,6 @@
             }
             catch
             {
-                if (runtimeElementType.Equals(typeof(void)))
-                    throw new NotSupportedException(SR.NotSupported_VoidArray);
                 if (runtimeElementType.InternalIsOpen)
                     throw new NotSupportedException(SR.NotSupported_OpenType);
                 throw;


Add Wi-Fi button on AboutPage

Add Wi-Fi button on AboutPage

--- Project/uwpmm/uwpmm.WindowsPhone/Pages/AboutPage.xaml.cs
+++ Project/uwpmm/uwpmm.WindowsPhone/Pages/AboutPage.xaml.cs
@@ -26,6 +26,11 @@
             this.navigationHelper = new NavigationHelper(this);
             this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
             this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
+
+            CommandBarManager.SetEvent(AppBarItem.WifiSetting, async (s, args) =>
+            {
+                await Launcher.LaunchUriAsync(new Uri("ms-settings-wifi:"));
+            });
         }

         /// <summary>
@@ -103,6 +108,8 @@
                 Limited.Visibility = Visibility.Collapsed;
                 TrialButton.Visibility = Visibility.Collapsed;
             }
+
+            BottomAppBar = CommandBarManager.Clear().Icon(AppBarItem.WifiSetting).CreateNew(0.6);
         }

         protected override void OnNavigatedFrom(NavigationEventArgs e)
@@ -117,6 +124,8 @@
         private static string license = "";
         private static string copyright = "";
         private const string developer = "kazyx and naotaco (@naotaco_dev)";
+
+        CommandBarManager CommandBarManager = new CommandBarManager();

         private void Page_Loaded(object sender, RoutedEventArgs e)
         {


Better message

Better message

--- RDFSharp/Semantics/OWL/Validator/RDFOntologyValidator.cs
+++ RDFSharp/Semantics/OWL/Validator/RDFOntologyValidator.cs
@@ -147,7 +147,7 @@
             var report = new RDFOntologyValidatorReport();
             if (ontology != null)
             {
-                RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Validator is going to be applied on Ontology '{0}'...", ontology.Value));
+                RDFSemanticsEvents.RaiseSemanticsInfo(string.Format("Validator is going to be applied on Ontology '{0}': this may require intensive processing, depending on size and complexity of working T-BOX/A-BOX", ontology.Value));

                 //STEP 1: Expand ontology
                 RDFOntology expOntology = ontology.UnionWith(RDFBASEOntology.Instance);


Fix rendering of TextInput after programmatic focus (#554)

When programmatically giving a TextInput focus, it wasn't rendering
properly (e.g. the focus rect wasn't drawn, the cursor wasn't drawn or it
was drawn in the wrong spot, selected text wasn't highlighted).

It looks like ReactTextBox overrode OnGotFocus but forgot to give
TextBox's handler a chance to run.

--- ReactWindows/ReactNative/Views/TextInput/ReactTextBox.cs
+++ ReactWindows/ReactNative/Views/TextInput/ReactTextBox.cs
@@ -41,6 +41,7 @@

         protected override void OnGotFocus(RoutedEventArgs e)
         {
+            base.OnGotFocus(e);
             if (ClearTextOnFocus)
             {
                 Text = "";


Add a test for CreateProxyType.

Add a test for CreateProxyType.

--- RecycleBin.DynamicProxy.Tests/DynamicProxyBuilderTest.cs
+++ RecycleBin.DynamicProxy.Tests/DynamicProxyBuilderTest.cs
@@ -31,6 +31,14 @@
             {
             }
          }
+      }
+
+      [Test]
+      public void TestCreateType()
+      {
+         var builder = new DynamicProxyBuilder("RecycleBin.DynamicProxy.Proxy");
+         var proxyType = builder.CreateProxyType(typeof(IPerson), typeof(Person));
+         Assert.That(typeof(IPerson).IsAssignableFrom(proxyType), Is.True);
       }

       [Test]


更新资源打包工具

更新资源打包工具

资源文件夹下分场景文件夹，场景文件夹下包含场景文件和模块文件夹，模块文件夹下包含模块的资源。执行igeeknerd.com下的命令自动为资源文件夹下的所有资源ab更名

--- Editor/AssetsBundleTools.cs
+++ Editor/AssetsBundleTools.cs
@@ -15,7 +15,7 @@
 using UnityEditor;
 using System.IO;
 /// <summary>
-/// 资源打包工具
+/// AssetsBundle资源打包工具
 /// </summary>
 public class AssetsBundleTools {

@@ -33,7 +33,8 @@
         //删除资源库中没有使用的名字
         AssetDatabase.RemoveUnusedAssetBundleNames();
         //取得文件夹数据
-        string path = Application.dataPath + "Art/Scenes";
+        string path = Application.dataPath + "/Scenes";
+        //Debug.Log("文件夹为 " + path);
         DirectoryInfo dirinfo = new DirectoryInfo(path);
         //取得文件数据
         FileSystemInfo[] fsinfo = dirinfo.GetFileSystemInfos();
@@ -43,14 +44,134 @@
             FileSystemInfo tmpinfo = fsinfo[i];
             if (tmpinfo is DirectoryInfo)
             {
-                string tmppath = Path.Combine(path, tmpinfo.Name);
+                string tmppath = path + "/" + tmpinfo.Name;
+                //Debug.Log("path is " + path + " name is " + tmpinfo.Name);
+                SceneOverView(tmppath,tmpinfo.Name);
+            }
+            else//是一个场景文件
+            {
+
             }
         }
     }
+    /// <summary>
+    /// 便利一个场景的文件夹
+    /// </summary>
+    /// <param name="p_path">Art/Scenes下场景文件夹的位置</param>
+    public static void SceneOverView(string p_path,string p_scene_name)
+    {
+        //路径
+        string txtName = "Log.txt";
+        string tmppath = p_path +"/" +txtName;
+        //打开文件流
+        FileStream fs = new FileStream(tmppath, FileMode.OpenOrCreate);
+        StreamWriter sw = new StreamWriter(fs);
+        Dictionary<string, string> readDic = new Dictionary<string, string>();

-    public static void SceneOverView(string p_path)
+        ModuleOverView(p_path,p_scene_name);
+
+        //Debug.Log("当前的目录是 " + tmppath);
+        sw.Close();
+        fs.Close();
+
+    }
+    /// <summary>
+    /// 处理场景文件夹下的模块文件夹
+    /// </summary>
+    /// <param name="p_path"></param>
+    public static void ModuleOverView(string p_path, string p_scene_name)
     {
+        DirectoryInfo info = new DirectoryInfo(p_path);
+        FileSystemInfo[] fsinfo = info.GetFileSystemInfos();
+
+        for (int i= 0;i < fsinfo.Length;i++)
+        {
+
+            FileSystemInfo tmpfs = fsinfo[i];
+            //如果文件是模块的文件夹,处理模块文件夹中的文件
+            if (tmpfs is DirectoryInfo)
+            {
+                Debug.Log("模块文件夹的名字是 " + fsinfo[i].Name);
+                FileOverView(tmpfs.FullName,p_scene_name, fsinfo[i].Name);
+            }
+            else//是场景或者meta文件
+            {
+                if(fsinfo[i].Name.IndexOf(".meta") == -1)
+                {
+                    //排除。meta文件
+                    ChangeSCABName(tmpfs.FullName, p_scene_name, fsinfo[i].Name);
+                }
+
+            }
+        }
+    }
+    /// <summary>
+    /// 遍历模块中的除了.meta以外的所有文件
+    /// </summary>
+    /// <param name="p_path"></param>
+    public static void FileOverView(string p_path, string p_scene_name,string p_module_name)
+    {
+        DirectoryInfo info = new DirectoryInfo(p_path);
+        FileSystemInfo[] fsinfo = info.GetFileSystemInfos();

+        for (int i = 0; i < fsinfo.Length; i++)
+        {
+            //Debug.Log("文件的名字是 " + fsinfo[i].Name);
+            FileSystemInfo tmpfs = fsinfo[i];
+            //如果文件是模块的文件夹,处理模块文件夹中的文件
+            if (tmpfs.Name.IndexOf(".meta") == -1)
+            {
+                Debug.Log("文件的名字是 " + fsinfo[i].Name);
+                ChangeABName(fsinfo[i].FullName,p_scene_name,p_module_name);
+            }
+        }
+    }
+    /// <summary>
+    /// 改变文件的assetsbundle名字的后缀名字,注意命名中不要包含unity
+    /// </summary>
+    /// <param name="p_fullpath"></param>
+    /// <param name="p_scene_name"></param>
+    /// <param name="p_module_name"></param>
+    public static void ChangeABName(string p_fullpath,string p_scene_name,string p_module_name)
+    {
+        int tmpindex = p_fullpath.IndexOf("Assets");
+        string tmpstr = p_fullpath.Substring(tmpindex, p_fullpath.Length - tmpindex);
+        Debug.Log("截取的字符串为 " + tmpstr);
+        AssetImporter tmpimp = AssetImporter.GetAtPath(tmpstr);
+        tmpimp.assetBundleName = p_scene_name + "/" + p_module_name;
+
+        if(tmpstr.IndexOf(".unity") > 0){
+            tmpimp.assetBundleVariant = "u3dsc";
+        }
+        else
+        {
+            tmpimp.assetBundleVariant = "u3dres";
+        }
+
+    }
+    /// <summary>
+    /// 场景文件单独处理
+    /// </summary>
+    /// <param name="p_fullpath"></param>
+    /// <param name="p_scene_name"></param>
+    /// <param name="p_module_name"></param>
+    public static void ChangeSCABName(string p_fullpath, string p_scene_name, string p_module_name)
+    {
+        int tmpindex = p_fullpath.IndexOf("Assets");
+        string tmpstr = p_fullpath.Substring(tmpindex, p_fullpath.Length - tmpindex);
+        Debug.Log("截取的字符串为 " + tmpstr);
+        AssetImporter tmpimp = AssetImporter.GetAtPath(tmpstr);
+        //场景文件只用场景文件夹标记
+        tmpimp.assetBundleName = p_scene_name;
+
+        if (tmpstr.IndexOf(".unity") > 0)
+        {
+            tmpimp.assetBundleVariant = "u3dsc";
+        }
+        else
+        {
+            tmpimp.assetBundleVariant = "u3dres";
+        }
     }
 	// Use this for initialization
 	void Start () {


Cleaned up the nh conn mgr test.

Cleaned up the nh conn mgr test.

--- src/Tests/NHibernate/ConnectionManagerTests.cs
+++ src/Tests/NHibernate/ConnectionManagerTests.cs
@@ -6,6 +6,7 @@
 using Gribble;
 using Gribble.Mapping;
 using Gribble.Model;
+using NHibernate.Cfg;
 using NUnit.Framework;
 using ConnectionManager = Gribble.NHibernate.ConnectionManager;

@@ -14,7 +15,14 @@
     [TestFixture]
     public class ConnectionManagerTests
     {
-        public static string TableName = TestTable.GenerateName();
+        private readonly static string TableName = TestTable.GenerateName();
+        private TestDatabase _database;
+
+        private readonly static Func<TestDatabase, Configuration> CreateConfiguration = database => Fluently.Configure().
+                Sql2008Database(database.Connection.ConnectionString, IsolationLevel.ReadCommitted, true).
+                Mappings(map => map.FluentMappings.Add<EntityMap>().Conventions.Add(AutoImport.Never())).
+                ExposeConfiguration(config => config.AutoQuote()).
+                BuildConfiguration();

         public class Entity
         {
@@ -38,18 +46,20 @@
             }
         }

+        [TestFixtureSetUp]
+        public void Setup()
+        {
+            _database = new TestDatabase();
+            _database.SetUp();
+        }
+
+        [TestFixtureTearDown]
+        public void TearDown() { _database.TearDown(); }
+
         [Test]
         public void Gribble_Should_Share_Transaction_With_Nhibernate()
         {
-            var testDatabase = new TestDatabase();
-            testDatabase.SetUp();
-            var sessionFactory = Fluently.Configure().
-                    Sql2008Database(testDatabase.Connection.ConnectionString, IsolationLevel.ReadCommitted, true).
-                    Mappings(map => map.FluentMappings.Add<EntityMap>().Conventions.Add(AutoImport.Never())).
-                    ExposeConfiguration(config => config.AutoQuote()).
-                    BuildConfiguration();
-
-            using (var factory = sessionFactory.BuildSessionFactory())
+            using (var factory = CreateConfiguration(_database).BuildSessionFactory())
             using (var session = factory.OpenSession())
             using (var transaction = session.BeginTransaction())
             {


Fix watchdog not working in paths with spaces

--- src/Tgstation.Server.Host.Watchdog/Watchdog.cs
+++ src/Tgstation.Server.Host.Watchdog/Watchdog.cs
@@ -35,77 +35,77 @@
 		{
 			logger.LogInformation("Host watchdog starting...");

-			var enviromentPath = Environment.GetEnvironmentVariable("PATH");
-			var paths = enviromentPath.Split(';');
-			var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
-
-			var exeName = "dotnet";
-			IEnumerable<string> enumerator;
-			if (isWindows)
-			{
-				exeName += ".exe";
-				enumerator = paths;
-			}
-			else
-				enumerator = paths.Select(x => x.Split(':')).SelectMany(x => x);
-
-			enumerator = enumerator.Select(x => Path.Combine(x, exeName));
-
-			var dotnetPath = enumerator
-							   .Where(x =>
-							   {
-								   logger.LogTrace("Checking for dotnet at {0}", x);
-								   return File.Exists(x);
-							   })
-							   .FirstOrDefault();
-
-			if (dotnetPath == default)
-			{
-				logger.LogCritical("Unable to locate dotnet executable in PATH! Please ensure the .NET Core runtime is installed and is in your PATH!");
-				return;
-			}
-			logger.LogInformation("Detected dotnet executable at {0}", dotnetPath);
-
-			var rootLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
-
-			var assemblyStoragePath = Path.Combine(rootLocation, "lib");    //always always next to watchdog
-			var defaultAssemblyPath = Path.GetFullPath(Path.Combine(assemblyStoragePath, "Default"));
-#if DEBUG
-			//just copy the shit where it belongs
-			Directory.Delete(assemblyStoragePath, true);
-			Directory.CreateDirectory(defaultAssemblyPath);
-
-			var sourcePath = "../../../../Tgstation.Server.Host/bin/Debug/netcoreapp2.1";
-			foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
-				Directory.CreateDirectory(dirPath.Replace(sourcePath, defaultAssemblyPath));
-
-			foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
-				File.Copy(newPath, newPath.Replace(sourcePath, defaultAssemblyPath), true);
-
-			const string AppSettingsJson = "appsettings.json";
-			var rootJson = Path.Combine(rootLocation, AppSettingsJson);
-			File.Delete(rootJson);
-			File.Move(Path.Combine(defaultAssemblyPath, AppSettingsJson), rootJson);
-#endif
-
-			var assemblyName = String.Join(".", nameof(Tgstation), nameof(Server), nameof(Host), "dll");
-			var assemblyPath = Path.Combine(defaultAssemblyPath, assemblyName);
-
-			if (assemblyPath.Contains("\""))
-			{
-				logger.LogCritical("Running from paths with \"'s in the name is not supported!");
-				return;
-			}
-
-			if (!File.Exists(assemblyPath))
-			{
-				logger.LogCritical("Unable to locate host assembly!");
-				return;
-			}
-
 			string updateDirectory = null;
 			try
 			{
+				var enviromentPath = Environment.GetEnvironmentVariable("PATH");
+				var paths = enviromentPath.Split(';');
+				var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
+
+				var exeName = "dotnet";
+				IEnumerable<string> enumerator;
+				if (isWindows)
+				{
+					exeName += ".exe";
+					enumerator = paths;
+				}
+				else
+					enumerator = paths.Select(x => x.Split(':')).SelectMany(x => x);
+
+				enumerator = enumerator.Select(x => Path.Combine(x, exeName));
+
+				var dotnetPath = enumerator
+								   .Where(x =>
+								   {
+									   logger.LogTrace("Checking for dotnet at {0}", x);
+									   return File.Exists(x);
+								   })
+								   .FirstOrDefault();
+
+				if (dotnetPath == default)
+				{
+					logger.LogCritical("Unable to locate dotnet executable in PATH! Please ensure the .NET Core runtime is installed and is in your PATH!");
+					return;
+				}
+				logger.LogInformation("Detected dotnet executable at {0}", dotnetPath);
+
+				var rootLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+
+				var assemblyStoragePath = Path.Combine(rootLocation, "lib");    //always always next to watchdog
+				var defaultAssemblyPath = Path.GetFullPath(Path.Combine(assemblyStoragePath, "Default"));
+#if DEBUG
+				//just copy the shit where it belongs
+				Directory.Delete(assemblyStoragePath, true);
+				Directory.CreateDirectory(defaultAssemblyPath);
+
+				var sourcePath = "../../../../Tgstation.Server.Host/bin/Debug/netcoreapp2.1";
+				foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
+					Directory.CreateDirectory(dirPath.Replace(sourcePath, defaultAssemblyPath));
+
+				foreach (string newPath in Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories))
+					File.Copy(newPath, newPath.Replace(sourcePath, defaultAssemblyPath), true);
+
+				const string AppSettingsJson = "appsettings.json";
+				var rootJson = Path.Combine(rootLocation, AppSettingsJson);
+				File.Delete(rootJson);
+				File.Move(Path.Combine(defaultAssemblyPath, AppSettingsJson), rootJson);
+#endif
+
+				var assemblyName = String.Join(".", nameof(Tgstation), nameof(Server), nameof(Host), "dll");
+				var assemblyPath = Path.Combine(defaultAssemblyPath, assemblyName);
+
+				if (assemblyPath.Contains("\""))
+				{
+					logger.LogCritical("Running from paths with \"'s in the name is not supported!");
+					return;
+				}
+
+				if (!File.Exists(assemblyPath))
+				{
+					logger.LogCritical("Unable to locate host assembly!");
+					return;
+				}
+
 				while (!cancellationToken.IsCancellationRequested)
 					using (logger.BeginScope("Host invocation"))
 					{
@@ -119,7 +119,7 @@
 							var arguments = new List<string>
 							{
 								'"' + assemblyPath + '"',
-								updateDirectory
+								'"' + updateDirectory + '"'
 							};
 							if (Debugger.IsAttached)
 								arguments.Add("--attach-debugger");


fix the build

fix the build

--- build/build.cake
+++ build/build.cake
@@ -109,6 +109,23 @@
 // Version
 Action SetGitVersionData = () => {

+	if (BuildSystem.TeamCity.IsRunningOnTeamCity)
+	{
+		Information(
+			@"Environment:
+			PullRequest: {0}
+			Build Configuration Name: {1}
+			TeamCity Project Name: {2}",
+			BuildSystem.TeamCity.Environment.PullRequest.IsPullRequest,
+			BuildSystem.TeamCity.Environment.Build.BuildConfName,
+			BuildSystem.TeamCity.Environment.Project.Name
+			);
+	}
+	else
+	{
+		Information("Not running on TeamCity");
+	}
+
 	if(!isPullRequest) {
 		var gitVersion = GitVersion();
 		majorMinorPatch = gitVersion.MajorMinorPatch;


Coverage calculation step was fixed

Coverage calculation step was fixed

--- build/build.cake
+++ build/build.cake
@@ -160,11 +160,7 @@
             OpenCover(
                 x => x.DotNetCoreTest(
                      project.FullPath,
-                     new DotNetCoreTestSettings
-                     {
-                        Configuration = "Debug",
-                        ArgumentCustomization = args => args.Append("--configfile ./NuGet.config")
-                     }
+                     new DotNetCoreTestSettings { Configuration = "Debug" }
                 ),
                 resultsFile,
                 settings


Audio system.

Audio system.

--- Engine/Audio/AudioSystem.cs
+++ Engine/Audio/AudioSystem.cs
@@ -676,8 +676,6 @@

     public void StartGameLoop(int loop) {

-        // TODO fix this hack..,
-
         currentLoopIndex = loop - 1;

         float volumeLevel = (float)musicSoundVolume;


Re-make TestCaseMenuBar.

Re-make TestCaseMenuBar.

--- osu.Framework.Desktop.Tests/Visual/TestCaseMenuBar.cs
+++ osu.Framework.Desktop.Tests/Visual/TestCaseMenuBar.cs
@@ -1,51 +1,91 @@
 // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
 // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

+using System;
+using System.Collections.Generic;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.UserInterface;
 using osu.Framework.Testing;

 namespace osu.Framework.Desktop.Tests.Visual
 {
     internal class TestCaseMenuBar : TestCase
     {
+        private const int max_depth = 5;
+        private const int max_count = 5;
+
+        private readonly Random rng;
+
         public TestCaseMenuBar()
         {
-            //MenuItem second;
-            //Add(new MenuBar
-            //{
-            //    Anchor = Anchor.Centre,
-            //    Origin = Anchor.Centre,
-            //    Items = new[]
-            //    {
-            //        new MenuItem("First")
-            //        {
-            //            Items = new[]
-            //            {
-            //                new MenuItem("First #1"),
-            //                new MenuItem("First #2"),
-            //                new MenuItem("First #3"),
-            //                new MenuItem("First #4"),
-            //                new MenuItem("First #5"),
-            //            }
-            //        },
-            //        second = new MenuItem("Second")
-            //        {
-            //            Items = new[]
-            //            {
-            //                new MenuItem("Second #1"),
-            //                new MenuItem("Second #2"),
-            //                new MenuItem("Second #3"),
-            //                new MenuItem("Second #4"),
-            //                new MenuItem("Second #5"),
-            //            }
-            //        }
-            //    }
-            //});
+            rng = new Random(1337);

-            //AddStep("Change text", () =>
-            //{
-            //    second.Text.Value = "Third";
-            //    second.Items.ForEach(i => i.Text.Value = i.Text.Value.Replace("Second", "Third"));
-            //});
+            Add(new StyledMenuBar
+            {
+                Anchor = Anchor.Centre,
+                Origin = Anchor.Centre,
+                State = MenuState.Opened,
+                AlwaysOpen = true,
+                Items = new[]
+                {
+                    generateRandomMenu("First"),
+                    generateRandomMenu("Second"),
+                    generateRandomMenu("Third"),
+                }
+            });
+        }
+
+        private MenuItem generateRandomMenu(string name = "Menu Item", int currDepth = 1)
+        {
+            var item = new MenuItem(name);
+
+            if (currDepth == max_depth)
+                return item;
+
+            int subCount = rng.Next(0, max_count);
+            var subItems = new List<MenuItem>();
+            for (int i = 0; i < subCount; i++)
+                subItems.Add(generateRandomMenu(item.Text + $" #{i + 1}", currDepth + 1));
+
+            item.Items = subItems;
+            return item;
+        }
+
+        private class StyledMenuBar : Menu
+        {
+            public StyledMenuBar()
+                : base(Direction.Horizontal)
+            {
+            }
+
+            protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new StyledMenuBarItem(item);
+
+            private class StyledMenuBarItem : DrawableMenuItem
+            {
+                public StyledMenuBarItem(MenuItem item)
+                    : base(item)
+                {
+                }
+
+                private class StyledMenuBarItemMenu : Menu
+                {
+                    public StyledMenuBarItemMenu()
+                        : base(Direction.Vertical)
+                    {
+                        Anchor = Anchor.BottomLeft;
+                    }
+
+                    protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new StyledMenuItem(item);
+
+                    private class StyledMenuItem : DrawableMenuItem
+                    {
+                        public StyledMenuItem(MenuItem item)
+                            : base(item)
+                        {
+                        }
+                    }
+                }
+            }
         }
     }
 }


Remove redundant qualifiers

Remove redundant qualifiers

--- osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs
+++ osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs
@@ -357,13 +357,13 @@

         private class TestRuleset : Ruleset
         {
-            public override IEnumerable<Mod> GetModsFor(ModType type) => throw new System.NotImplementedException();
-
-            public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
-
-            public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException();
-
-            public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => throw new System.NotImplementedException();
+            public override IEnumerable<Mod> GetModsFor(ModType type) => throw new NotImplementedException();
+
+            public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new NotImplementedException();
+
+            public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException();
+
+            public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => throw new NotImplementedException();

             public override string Description => string.Empty;
             public override string ShortName => string.Empty;


Add missing licence header

Add missing licence header

--- osu.Game/Online/API/ModSettingsDictionaryFormatter.cs
+++ osu.Game/Online/API/ModSettingsDictionaryFormatter.cs
@@ -1,3 +1,6 @@
+// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
 using System;
 using System.Collections.Generic;
 using MessagePack;


Split out current/next frame conditionals for readability

--- osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs
+++ osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs
@@ -1,4 +1,4 @@
-// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
+// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

 using System;
@@ -21,8 +21,33 @@

         protected List<ReplayFrame> Frames => replay.Frames;

-        public TFrame CurrentFrame => !HasFrames || !currentFrameIndex.HasValue ? null : (TFrame)Frames[currentFrameIndex.Value];
-        public TFrame NextFrame => !HasFrames || ((currentDirection > 0 && currentFrameIndex == Frames.Count - 1) || (currentDirection < 0 && currentFrameIndex == 0)) ? null : (TFrame)Frames[nextFrameIndex];
+        public TFrame CurrentFrame
+        {
+            get
+            {
+                if (!HasFrames || !currentFrameIndex.HasValue)
+                    return null;
+
+                return (TFrame)Frames[currentFrameIndex.Value];
+            }
+        }
+
+        public TFrame NextFrame
+        {
+            get
+            {
+                if (!HasFrames)
+                    return null;
+
+                if (!currentFrameIndex.HasValue)
+                    return (TFrame)Frames[0];
+
+                if (currentDirection > 0)
+                    return currentFrameIndex == Frames.Count - 1 ? null : (TFrame)Frames[currentFrameIndex.Value + 1];
+                else
+                    return currentFrameIndex == 0 ? null : (TFrame)Frames[nextFrameIndex];
+            }
+        }

         private int? currentFrameIndex;


Make EditorTimingTimeline support beatmap changes

--- osu.Game/Tests/Visual/TestCaseEditorTimingTimeline.cs
+++ osu.Game/Tests/Visual/TestCaseEditorTimingTimeline.cs
@@ -1,6 +1,7 @@
 // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
 // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

+using System;
 using System.Collections.Generic;
 using System.Linq;
 using OpenTK;
@@ -13,6 +14,7 @@
 using osu.Framework.Graphics.Shapes;
 using osu.Framework.Input;
 using osu.Framework.Lists;
+using osu.Framework.MathUtils;
 using osu.Game.Beatmaps;
 using osu.Game.Beatmaps.ControlPoints;
 using osu.Game.Beatmaps.Timing;
@@ -158,7 +160,8 @@

                 beatmap.BindTo(osuGame.Beatmap);

-                markerContainer.RelativeChildSize = new Vector2((float)beatmap.Value.Track.Length, 1);
+                markerContainer.RelativeChildSize = new Vector2((float)Math.Max(1, beatmap.Value.Track.Length), 1);
+                beatmap.ValueChanged += b => markerContainer.RelativeChildSize = new Vector2((float)Math.Max(1, b.Track.Length), 1);
             }

             protected override bool OnDragStart(InputState state) => true;
@@ -194,13 +197,8 @@

             private class ControlPointTimeline : Timeline
             {
-                [BackgroundDependencyLoader]
-                private void load(OsuGameBase osuGame, OsuColour colours)
-                {
-                    var beatmap = osuGame.Beatmap.Value;
-                    if (beatmap == null)
-                        return;
-
+                protected override void LoadBeatmap(WorkingBeatmap beatmap)
+                {
                     ControlPointInfo cpi = beatmap.Beatmap.ControlPointInfo;

                     cpi.TimingPoints.ForEach(addTimingPoint);
@@ -254,76 +252,71 @@

             private class BookmarkTimeline : Timeline
             {
+                protected override void LoadBeatmap(WorkingBeatmap beatmap)
+                {
+                    foreach (int bookmark in beatmap.BeatmapInfo.Bookmarks)
+                        Add(new BookmarkVisualisation(bookmark));
+                }
+
+                private class BookmarkVisualisation : PointVisualisation
+                {
+                    public BookmarkVisualisation(double startTime)
+                        : base(startTime)
+                    {
+                    }
+
+                    [BackgroundDependencyLoader]
+                    private void load(OsuColour colours) => Colour = colours.Blue;
+                }
+            }
+
+            private class BreakTimeline : Timeline
+            {
+                protected override void LoadBeatmap(WorkingBeatmap beatmap)
+                {
+                    foreach (var breakPeriod in beatmap.Beatmap.Breaks)
+                        Add(new BreakVisualisation(breakPeriod));
+                }
+
+                private class BreakVisualisation : DurationVisualisation
+                {
+                    public BreakVisualisation(BreakPeriod breakPeriod)
+                        : base(breakPeriod.StartTime, breakPeriod.EndTime)
+                    {
+                    }
+
+                    [BackgroundDependencyLoader]
+                    private void load(OsuColour colours) => Colour = colours.Yellow;
+                }
+            }
+
+            private abstract class Timeline : CompositeDrawable
+            {
+                private readonly Container timeline;
+
+                public Timeline()
+                {
+                    AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });
+                }
+
                 [BackgroundDependencyLoader]
                 private void load(OsuGameBase osuGame)
                 {
-                    var beatmap = osuGame.Beatmap.Value;
-                    if (beatmap == null)
-                        return;
-
-                    foreach (int bookmark in beatmap.BeatmapInfo.Bookmarks)
-                        Add(new BookmarkVisualisation(bookmark));
-                }
-
-                private class BookmarkVisualisation : PointVisualisation
-                {
-                    public BookmarkVisualisation(double startTime)
-                        : base(startTime)
-                    {
-                    }
-
-                    [BackgroundDependencyLoader]
-                    private void load(OsuColour colours) => Colour = colours.Blue;
-                }
-            }
-
-            private class BreakTimeline : Timeline
-            {
-                [BackgroundDependencyLoader]
-                private void load(OsuGameBase osuGame)
-                {
-                    var beatmap = osuGame.Beatmap.Value;
-                    if (beatmap == null)
-                        return;
-
-                    foreach (var breakPeriod in beatmap.Beatmap.Breaks)
-                        Add(new BreakVisualisation(breakPeriod));
-                }
-
-                private class BreakVisualisation : DurationVisualisation
-                {
-                    public BreakVisualisation(BreakPeriod breakPeriod)
-                        : base(breakPeriod.StartTime, breakPeriod.EndTime)
-                    {
-                    }
-
-                    [BackgroundDependencyLoader]
-                    private void load(OsuColour colours) => Colour = colours.Yellow;
-                }
-            }
-
-            private abstract class Timeline : CompositeDrawable
-            {
-                private readonly Container timeline;
-
-                public Timeline()
-                {
-                    AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both });
-                }
-
-                [BackgroundDependencyLoader]
-                private void load(OsuGameBase osuGame)
-                {
-                    var beatmap = osuGame.Beatmap.Value;
-                    if (beatmap == null)
-                        return;
-
-                    timeline.RelativeChildSize = new Vector2((float)beatmap.Track.Length, 1);
+                    osuGame.Beatmap.ValueChanged += b =>
+                    {
+                        timeline.Clear();
+                        timeline.RelativeChildSize = new Vector2((float)Math.Max(1, b.Track.Length), 1);
+                        LoadBeatmap(b);
+                    };
+
+                    timeline.RelativeChildSize = new Vector2((float)Math.Max(1, osuGame.Beatmap.Value.Track.Length), 1);
+                    LoadBeatmap(osuGame.Beatmap);
                 }

                 protected void Add(PointVisualisation visualisation) => timeline.Add(visualisation);
-
                 protected void Add(DurationVisualisation visualisation) => timeline.Add(visualisation);
+
+                protected abstract void LoadBeatmap(WorkingBeatmap beatmap);
             }

             private class PointVisualisation : Box