throw out throw

throw out throw

--- WalletWasabi.Gui/Program.cs
+++ WalletWasabi.Gui/Program.cs
@@ -30,9 +30,11 @@

 		/// Warning! In Avalonia applications Main must not be async. Otherwise application may not run on OSX.
 		/// see https://github.com/AvaloniaUI/Avalonia/wiki/Unresolved-platform-support-issues
-		private static void Main(string[] args)
+		private static int Main(string[] args)
 		{
 			bool runGui = false;
+			Exception? appException = null;
+
 			try
 			{
 				Global = CreateGlobal();
@@ -48,26 +50,23 @@
 				if (Global.CrashReporter.IsReport)
 				{
 					StartCrashReporter(args);
-					return;
-				}
-
-				if (runGui)
+				}
+				else if (runGui)
 				{
 					Logger.LogSoftwareStarted("Wasabi GUI");
-
 					BuildAvaloniaApp().StartShellApp("Wasabi Wallet", AppMainAsync, args);
 				}
 			}
 			catch (Exception ex)
 			{
+				appException = ex;
 				Logger.LogCritical(ex);
-				Global.CrashReporter.SetException(ex);
-				throw;
-			}
-			finally
-			{
-				DisposeAsync().GetAwaiter().GetResult();
-			}
+				Global?.CrashReporter?.SetException(ex);
+			}
+
+			DisposeAsync().GetAwaiter().GetResult();
+
+			return appException is { } ? 1 : 0;
 		}

 		private static Global CreateGlobal()
@@ -131,10 +130,10 @@

 		private static async Task DisposeAsync()
 		{
-			var disposeGui = MainWindowViewModel.Instance is { };
-			if (disposeGui)
-			{
-				MainWindowViewModel.Instance.Dispose();
+			var mainViewModel = MainWindowViewModel.Instance;
+			if (mainViewModel is { })
+			{
+				mainViewModel.Dispose();
 			}

 			if (Global?.CrashReporter?.IsInvokeRequired is true)
@@ -151,7 +150,7 @@
 			AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
 			TaskScheduler.UnobservedTaskException -= TaskScheduler_UnobservedTaskException;

-			if (disposeGui)
+			if (mainViewModel is { })
 			{
 				Logger.LogSoftwareStopped("Wasabi GUI");
 			}


Frontpage fixes

Frontpage fixes

--- Geekhub/Views/Meetings/MeetingsForFrontpage.cshtml
+++ Geekhub/Views/Meetings/MeetingsForFrontpage.cshtml
@@ -1,5 +1,6 @@
 @model IEnumerable<Geekhub.App.Modules.Meetings.Models.Meeting>

+
De tre næste events

     @Html.Partial("_Meetings")


Reduce the amount of logging in unit tests.

Heavy logging makes the tests I/O bound and causes other, more relevant test files to be evicted.

--- Duplicati/UnitTest/BasicSetupHelper.cs
+++ Duplicati/UnitTest/BasicSetupHelper.cs
@@ -107,7 +107,7 @@

                 opts["passphrase"] = "123456";
                 opts["debug-output"] = "";
-                opts["log-level"] = "profiling";
+                opts["log-level"] = "error";
                 opts["log-file"] = LOGFILE;
                 opts["dblock-size"] = "10mb";
                 opts["dbpath"] = DBFILE;


Remove base test folder instead of individual members.

--- Duplicati/UnitTest/BasicSetupHelper.cs
+++ Duplicati/UnitTest/BasicSetupHelper.cs
@@ -87,14 +87,8 @@
         [OneTimeTearDown]
         public void RemoveSourceData()
         {
-            if (Directory.Exists(DATAFOLDER))
-                Directory.Delete(DATAFOLDER, true);
-            if (Directory.Exists(TARGETFOLDER))
-                Directory.Delete(TARGETFOLDER, true);
-            if (File.Exists(LOGFILE))
-                File.Delete(LOGFILE);
-            if (File.Exists(DBFILE))
-                File.Delete(DBFILE);
+            if (Directory.Exists(BASEFOLDER))
+                Directory.Delete(BASEFOLDER, true);
         }

         protected virtual Dictionary<string, string> TestOptions


8.2.1

--- EDDiscovery/Properties/AssemblyInfo.cs
+++ EDDiscovery/Properties/AssemblyInfo.cs
@@ -47,5 +47,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("8.2.0.0")]
-[assembly: AssemblyFileVersion("8.2.0.0")]
+[assembly: AssemblyVersion("8.2.1.0")]
+[assembly: AssemblyFileVersion("8.2.1.0")]


8.0.2

--- EDDiscovery/Properties/AssemblyInfo.cs
+++ EDDiscovery/Properties/AssemblyInfo.cs
@@ -47,5 +47,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("8.0.1.0")]
-[assembly: AssemblyFileVersion("8.0.1.0")]
+[assembly: AssemblyVersion("8.0.2.0")]
+[assembly: AssemblyFileVersion("8.0.2.0")]


11.10.0.2

--- EDDiscovery/Properties/AssemblyInfo.cs
+++ EDDiscovery/Properties/AssemblyInfo.cs
@@ -47,6 +47,6 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("11.10.0.1")]
+[assembly: AssemblyVersion("11.10.0.2")]


icon change & minor

icon change & minor

--- EdiTree/Components/SubTreeComponent.cs
+++ EdiTree/Components/SubTreeComponent.cs
@@ -114,9 +114,7 @@
             };
         }

-        bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index) {
-            return true;
-        }
+        bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index) => true;

         public void VariableParameterMaintenance() {
             for (var i = 1; i < Params.Input.Count; i++) {


Fixes bug in logs showing data feed ends at DateTime.MaxValue

--- Engine/DataFeeds/FileSystemDataFeed.cs
+++ Engine/DataFeeds/FileSystemDataFeed.cs
@@ -423,10 +423,14 @@
                 }

                 // syncer returns MaxValue on failure/end of data
-                if (_frontierUtc != DateTime.MaxValue)
+                if (timeSlice.Time != DateTime.MaxValue)
                 {
                     yield return timeSlice;
-                    _frontierUtc = nextFrontier;
+
+                    // end of data signal
+                    if (nextFrontier == DateTime.MaxValue) break;
+
+                    _frontierUtc = nextFrontier;
                 }
                 else if (timeSlice.SecurityChanges == SecurityChanges.None)
                 {


Cleanup previous fix

Cleanup previous fix

--- Languages/IronPython/IronPython/Modules/Builtin.cs
+++ Languages/IronPython/IronPython/Modules/Builtin.cs
@@ -190,29 +190,17 @@
                 return DynamicHelpers.GetPythonTypeFromType(typeof(_basestring));
             }
         }
-
-        public static string bin(int number) {
-            return Int32Ops.ToBinary(number);
-        }
-
-        public static string bin(Index number) {
-            return Int32Ops.ToBinary(Converter.ConvertToIndex(number));
-        }
-
-        public static string bin(BigInteger number) {
-            return BigIntegerOps.ToBinary(number);
-        }
-
-        public static string bin(double number) {
-            throw PythonOps.TypeError("'float' object cannot be interpreted as an index");
-        }
-
-        public static string bin(CodeContext context, object obj) {
+
+        public static string bin(object obj) {
+            if (obj is int) return Int32Ops.ToBinary((int)obj);
+            if (obj is Index) return Int32Ops.ToBinary(Converter.ConvertToIndex((Index)obj));
+            if (obj is BigInteger) return BigIntegerOps.ToBinary((BigInteger)obj);
+
             object res = PythonOps.Index(obj);
             if (res is int) {
-                return bin((int)res);
-            } else if (res is double) {
-                return bin((double)res);
+                return Int32Ops.ToBinary((int)res);
+            } else if (res is BigInteger) {
+                return BigIntegerOps.ToBinary((BigInteger)res);
             }

             throw PythonOps.TypeError("__index__ returned non-(int, long) (type {0})", PythonOps.GetPythonTypeName(res));


cross diffing on structs

cross diffing on structs

--- ODiff.Tests/Diff_structs.cs
+++ ODiff.Tests/Diff_structs.cs
@@ -11,25 +11,31 @@
             [Test]
             public void It_will_detect_diff_on_public_properties()
             {
-                var left = new Employee { Name = "Steve" };
-                var right = new Employee();
+                var employeeA = new Employee { Name = "Steve" };
+                var employeeB = new Employee();

-                var diff = Diff.ObjectValues(left, right);
-
-                Assert.AreEqual(1, diff.Table.Rows.Count());
-                Assert.AreEqual("Name", diff.Table[0].MemberPath);
+                Cross.diff(employeeA, employeeB, (left, right) =>
+                {
+                    var diff = Diff.ObjectValues(left, right);
+
+                    Assert.AreEqual(1, diff.Table.Rows.Count());
+                    Assert.AreEqual("Name", diff.Table[0].MemberPath);
+                });
             }

             [Test]
             public void It_will_detect_diff_on_public_fields()
             {
-                var left = new Employee { Number = 1 };
-                var right = new Employee { Number = 2 };
+                var employeeA = new Employee { Number = 1 };
+                var employeeB = new Employee { Number = 2 };

-                var diff = Diff.ObjectValues(left, right);
-
-                Assert.AreEqual(1, diff.Table.Rows.Count());
-                Assert.AreEqual("Number", diff.Table[0].MemberPath);
+                Cross.diff(employeeA, employeeB, (left, right) =>
+                {
+                    var diff = Diff.ObjectValues(left, right);
+
+                    Assert.AreEqual(1, diff.Table.Rows.Count());
+                    Assert.AreEqual("Number", diff.Table[0].MemberPath);
+                });
             }

             struct Employee


Added method stubs

Added method stubs

--- Test2d.Editor/Editor/Helpers/PathHelper.cs
+++ Test2d.Editor/Editor/Helpers/PathHelper.cs
@@ -115,7 +115,7 @@
         /// </summary>
         /// <param name="x"></param>
         /// <param name="y"></param>
-        private void LeftDownLine(double x, double y)
+        private void LineLeftDown(double x, double y)
         {
             double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
             double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
@@ -177,7 +177,7 @@
         /// </summary>
         /// <param name="x"></param>
         /// <param name="y"></param>
-        private void RightDownLine(double x, double y)
+        private void LineRightDown(double x, double y)
         {
             double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
             double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
@@ -206,7 +206,7 @@
         /// </summary>
         /// <param name="x"></param>
         /// <param name="y"></param>
-        private void MoveLine(double x, double y)
+        private void LineMove(double x, double y)
         {
             double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
             double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
@@ -254,28 +254,118 @@
         /// </summary>
         /// <param name="x"></param>
         /// <param name="y"></param>
+        private void ArcLeftDown(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void ArcRightDown(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void ArcMove(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void BezierLeftDown(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void BezierRightDown(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void BezierMove(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void QBezierLeftDown(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void QBezierRightDown(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        private void QBezierMove(double x, double y)
+        {
+            // TODO:
+        }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
         public override void LeftDown(double x, double y)
         {
             switch(_editor.CurrentPathTool)
             {
                 case PathTool.Line:
                     {
-                        LeftDownLine(x, y);
+                        LineLeftDown(x, y);
                     }
                     break;
                 case PathTool.Arc:
                     {
-                        // TODO:
+                        ArcLeftDown(x, y);
                     }
                     break;
                 case PathTool.Bezier:
                     {
-                        // TODO:
+                        BezierLeftDown(x, y);
                     }
                     break;
                 case PathTool.QBezier:
                     {
-                        // TODO:
+                        QBezierLeftDown(x, y);
                     }
                     break;
             }
@@ -301,22 +391,22 @@
             {
                 case PathTool.Line:
                     {
-                        RightDownLine(x, y);
+                        LineRightDown(x, y);
                     }
                     break;
                 case PathTool.Arc:
                     {
-                        // TODO:
+                        ArcRightDown(x, y);
                     }
                     break;
                 case PathTool.Bezier:
                     {
-                        // TODO:
+                        BezierRightDown(x, y);
                     }
                     break;
                 case PathTool.QBezier:
                     {
-                        // TODO:
+                        QBezierRightDown(x, y);
                     }
                     break;
             }
@@ -342,22 +432,22 @@
             {
                 case PathTool.Line:
                     {
-                        MoveLine(x, y);
+                        LineMove(x, y);
                     }
                     break;
                 case PathTool.Arc:
                     {
-                        // TODO:
+                        ArcMove(x, y);
                     }
                     break;
                 case PathTool.Bezier:
                     {
-                        // TODO:
+                        BezierMove(x, y);
                     }
                     break;
                 case PathTool.QBezier:
                     {
-                        // TODO:
+                        QBezierMove(x, y);
                     }
                     break;
             }


Added IMovable methods and properties

Added IMovable methods and properties

--- Game/GameWindows/Game/Base/IMovable.cs
+++ Game/GameWindows/Game/Base/IMovable.cs
@@ -1,7 +1,52 @@
-namespace GameWindows.Game.Base
+using Microsoft.Xna.Framework;
+
+namespace GameWindows.Game.Base
 {
 	internal interface IMovable : IObject
 	{
-
+		/// <summary>
+		/// Gets or sets the speed.
+		/// </summary>
+		/// <value>
+		/// The speed.
+		/// </value>
+		float Speed { get; set; }
+
+		/// <summary>
+		/// Gets or sets the inertia.
+		/// </summary>
+		/// <value>
+		/// The inertia.
+		/// </value>
+		float Inertia { get; set; }
+
+		/// <summary>
+		/// Gets or sets the velocity.
+		/// </summary>
+		/// <value>
+		/// The velocity.
+		/// </value>
+		Vector2 Velocity { get; set; }
+
+		/// <summary>
+		/// Move by specified delta.
+		/// </summary>
+		/// <param name="xDelta">The x delta.</param>
+		/// <param name="yDelta">The y delta.</param>
+		void Move(float xDelta, float yDelta);
+
+		/// <summary>
+		/// Moves to given position. This will move object to destination over time, not in one frame.
+		/// </summary>
+		/// <param name="x">The x.</param>
+		/// <param name="y">The y.</param>
+		void MoveTo(float x, float y);
+
+		/// <summary>
+		/// Sets the position.
+		/// </summary>
+		/// <param name="x">The x.</param>
+		/// <param name="y">The y.</param>
+		void SetPosition(float x, float y);
 	}
 }


small rename

small rename

--- Ghpr.Core/Factories/ReporterFactory.cs
+++ Ghpr.Core/Factories/ReporterFactory.cs
@@ -32,9 +32,9 @@
         private static T CreateInstanceFromFile<T>(string fileName) where T : class
         {
             var uri = new Uri(typeof(ReporterFactory).Assembly.CodeBase);
-            var dataServiceAssemblyFullPath = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? "", fileName);
-            var dataServiceAssembly = Assembly.LoadFrom(dataServiceAssemblyFullPath);
-            var implementationType = dataServiceAssembly.GetTypes()
+            var instanceAssemblyFullPath = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? "", fileName);
+            var instanceAssembly = Assembly.LoadFrom(instanceAssemblyFullPath);
+            var implementationType = instanceAssembly.GetTypes()
                 .FirstOrDefault(t => typeof(T).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract);
             if (implementationType == null)
             {


improve performance by not setting Mouse.OverrideCursor

--- GongSolutions.Wpf.DragDrop/DragDrop.cs
+++ GongSolutions.Wpf.DragDrop/DragDrop.cs
@@ -415,7 +415,7 @@
           uiElement.PreviewGiveFeedback -= DropTarget_GiveFeedback;
         }

-        Mouse.OverrideCursor = null;
+//        Mouse.OverrideCursor = null;
       }
     }

@@ -824,7 +824,7 @@
     {
       DropTarget_PreviewDragOver(sender, e);

-      Mouse.OverrideCursor = Cursors.Arrow;
+//      Mouse.OverrideCursor = Cursors.Arrow;
     }

     private static void DropTarget_PreviewDragLeave(object sender, DragEventArgs e)
@@ -833,7 +833,7 @@
       EffectAdorner = null;
       DropTargetAdorner = null;

-      Mouse.OverrideCursor = null;
+//      Mouse.OverrideCursor = null;
     }

     private static void DropTarget_PreviewDragOver(object sender, DragEventArgs e)
@@ -949,7 +949,7 @@
       dropHandler.Drop(dropInfo);
       dragHandler.Dropped(dropInfo);

-      Mouse.OverrideCursor = null;
+//      Mouse.OverrideCursor = null;
       e.Handled = !dropInfo.NotHandled;
     }


DateTimePicker corrections

DateTimePicker corrections

--- GranitXMLEditor/GranitXMLEditorForm.cs
+++ GranitXMLEditor/GranitXMLEditorForm.cs
@@ -289,29 +289,39 @@
         Resources.StatusSumAllText + XmlToObjectBinder.SumAmount + " Ft");
     }

-    private DateTimePicker _dateTimePicker;
-    private DataGridViewCell _clickedDateCell;
+    private DateTimePicker _dateTimePicker = null;

     private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
     {
       var dlg = MainForm.CreateFindDialog(DataGrid);
       dlg.IsFirstInitNecessary = true;

-      if (e.ColumnIndex >= 0 &&
-        dataGridView1.Columns[e.ColumnIndex].HeaderText == Resources.RequestedExecutionDateHeaderText)
-      {
-        _dateTimePicker = new DateTimePicker();
+      ShowDateTimePickerIfNeeded(e);
+
+    }
+
+    private void ShowDateTimePickerIfNeeded(DataGridViewCellEventArgs e)
+    {
+      if (e.ColumnIndex >= 0 && dataGridView1.Columns[e.ColumnIndex].HeaderText == Resources.RequestedExecutionDateHeaderText)
+      {
+        if (_dateTimePicker != null)
+          _dateTimePicker.Visible = false;
+        else
+          _dateTimePicker = new DateTimePicker();
+
         dataGridView1.Controls.Add(_dateTimePicker);
         _dateTimePicker.Format = DateTimePickerFormat.Short;
         Rectangle Rectangle = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
         _dateTimePicker.Size = new Size(Rectangle.Width, Rectangle.Height);
         _dateTimePicker.Location = new Point(Rectangle.X, Rectangle.Y);
-
         _dateTimePicker.CloseUp += new EventHandler(dtp_CloseUp);
         _dateTimePicker.TextChanged += new EventHandler(dtp_OnTextChange);
+        _dateTimePicker.Value = (DateTime)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;

         _dateTimePicker.Visible = true;
       }
+      else if (_dateTimePicker.Visible)
+        _dateTimePicker.Visible = false;
     }

     private void dtp_OnTextChange(object sender, EventArgs e)


formatting

formatting

--- Infrastructure.OpenXML/ExcelHandler.cs
+++ Infrastructure.OpenXML/ExcelHandler.cs
@@ -1,13 +1,10 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.IO;
 using System.Linq;
-using System.Linq.Expressions;
 using System.Text.RegularExpressions;
 using Core.ApplicationServices;
-using DocumentFormat.OpenXml;
 using DocumentFormat.OpenXml.Spreadsheet;
 using DocumentFormat.OpenXml.Packaging;
 using DataTable = System.Data.DataTable;
@@ -19,29 +16,24 @@
         public DataSet Import(Stream stream)
         {
             var dataSet = new DataSet();
-
-            //Open document
+
+            // Open document
             var spreadsheetDocument = SpreadsheetDocument.Open(stream, true);

-            //Open WorkbookPart
+            // Open WorkbookPart
             var workbookPart = spreadsheetDocument.WorkbookPart;
-
-            //Open Sheets
+
+            // Open Sheets
             var sheets = workbookPart.Workbook.GetFirstChild<Sheets>().Elements<Sheet>();

             foreach (var sheet in sheets)
             {
-
-                var dataTable = new DataTable() { TableName = sheet.Name };
-
+                var dataTable = new DataTable { TableName = sheet.Name };
                 var relationshipId = sheet.Id.Value;
-
-                var worksheetPart = (WorksheetPart) workbookPart.GetPartById(relationshipId);
+                var worksheetPart = (WorksheetPart)workbookPart.GetPartById(relationshipId);
                 var workSheet = worksheetPart.Worksheet;
                 var sheetData = workSheet.GetFirstChild<SheetData>();
-
                 var rows = sheetData.Descendants<Row>().ToList();
-
                 var numColumns = rows.Max(x => x.Descendants<Cell>().Count());

                 for (var i = 0; i < numColumns; i++)
@@ -52,21 +44,21 @@
                 foreach (var row in rows)
                 {
                     //skip header row
-                    if(row.RowIndex < 2)
+                    if (row.RowIndex < 2)
                         continue;
-
+
                     var dataRow = dataTable.NewRow();

                     var cells = GetCells(row, numColumns);

                     var i = 0;
-                    bool rowHasValue = false;
+                    var rowHasValue = false;

                     foreach (var cell in cells)
                     {
                         var cellValue = GetCellValue(spreadsheetDocument, cell);
                         dataRow[i] = cellValue;
-
+
                         if (!string.IsNullOrWhiteSpace(cellValue))
                         {
                             rowHasValue = true;
@@ -79,50 +71,54 @@
                     {
                         dataTable.Rows.Add(dataRow);
                     }
-
-                }
-
+
+                }
                 dataSet.Tables.Add(dataTable);
-
-            }
-
+            }
             return dataSet;
         }

-        //returns a list of cells of length @numColumns.
-        //if there's a blank cell between two non blank cell, this list will properly reflect that
-        //by inserting empty cells the right places.
-        //likewise, if the row doesn't have @numColumns cells, empty cells will be appended.
-        private IEnumerable<Cell> GetCells(Row row, int numColumns)
+        /// <summary>
+        /// Gets a list of cells with the specified length.
+        /// </summary>
+        /// <param name="row">The row.</param>
+        /// <param name="numColumns">The number of columns.</param>
+        /// <returns>returns a list of cells of length <see cref="numColumns"/>.</returns>
+        /// <remarks>
+        /// if there's a blank cell between two non blank cell, this list will properly reflect that
+        /// by inserting empty cells the right places.
+        /// likewise, if the row doesn't have @numColumns cells, empty cells will be appended.
+        /// </remarks>
+        private static IEnumerable<Cell> GetCells(Row row, int numColumns)
         {
             var result = new List<Cell>();

             var i = 0;
             foreach (var cell in row.Descendants<Cell>())
             {
-                string columnName = GetColumnName(cell.CellReference);
-                //column index is the real index of the cell
-                int columnIndex = ConvertColumnNameToNumber(columnName);
-
-                //for every missing cell between the previous and the current index, add a new cell
+                var columnName = GetColumnName(cell.CellReference);
+                // column index is the real index of the cell
+                var columnIndex = ConvertColumnNameToNumber(columnName);
+
+                // for every missing cell between the previous and the current index, add a new cell
                 for (; i < columnIndex; i++)
                 {
                     result.Add(new Cell());
                 }

-                //then add the current cell
+                // then add the current cell
                 result.Add(cell);
                 i++;
             }

-            //add all remaining cells until we reach last column
+            // add all remaining cells until we reach last column
             for (; i < numColumns; i++)
             {
                 result.Add(new Cell());
             }

             return result;
-        }
+        }

         /// <summary>
         /// Given a cell name, parses the specified cell to get the column name.
@@ -133,8 +129,8 @@
         private static string GetColumnName(string cellReference)
         {
             // Match the column name portion of the cell name.
-            Regex regex = new Regex("[A-Za-z]+");
-            Match match = regex.Match(cellReference);
+            var regex = new Regex("[A-Za-z]+");
+            var match = regex.Match(cellReference);

             return match.Value;
         }
@@ -150,17 +146,17 @@
         /// contains characters other than uppercase letters</exception>
         private static int ConvertColumnNameToNumber(string columnName)
         {
-            Regex alpha = new Regex("^[A-Z]+$");
+            var alpha = new Regex("^[A-Z]+$");
             if (!alpha.IsMatch(columnName)) throw new ArgumentException();

-            char[] colLetters = columnName.ToCharArray();
+            var colLetters = columnName.ToCharArray();
             Array.Reverse(colLetters);

-            int convertedValue = 0;
-            for (int i = 0; i < colLetters.Length; i++)
-            {
-                char letter = colLetters[i];
-                int current = i == 0 ? letter - 65 : letter - 64; // ASCII 'A' = 65
+            var convertedValue = 0;
+            for (var i = 0; i < colLetters.Length; i++)
+            {
+                var letter = colLetters[i];
+                var current = i == 0 ? letter - 65 : letter - 64; // ASCII 'A' = 65
                 convertedValue += current * (int)Math.Pow(26, i);
             }

@@ -172,38 +168,34 @@
             if (cell == null) return "";

             var stringTablePart = document.WorkbookPart.SharedStringTablePart;
-
             var value = "";

-            if(cell.CellValue != null)
+            if (cell.CellValue != null)
                 value = cell.CellValue.InnerXml;

             if (cell.DataType != null && cell.DataType.Value == CellValues.SharedString)
             {
                 return stringTablePart.SharedStringTable.ChildElements[Int32.Parse(value)].InnerText;
             }
-            else
-            {
-                return value;
-            }
+            return value;
         }

         public Stream Export(DataSet data, Stream stream)
         {
-            //Open document
+            // Open document
             var spreadsheetDocument = SpreadsheetDocument.Open(stream, true);

-            //Open a WorkbookPart
+            // Open a WorkbookPart
             var workbookPart = spreadsheetDocument.WorkbookPart;

-            //Loop through data
+            // Loop through data
             foreach (DataTable table in data.Tables)
             {
                 var id = workbookPart.Workbook.Descendants<Sheet>().First(x => x.Name == table.TableName).Id;
                 var workSheetPart = (WorksheetPart)workbookPart.GetPartById(id);
                 var sheetData = workSheetPart.Worksheet.GetFirstChild<SheetData>();

-                /*
+                /* disabled until more information on the subject is found... see last comment section
                  //cell format is a kind of style that can be applied to cells
                 var unlockedCellFormat = new CellFormat()
                 {
@@ -230,34 +222,31 @@
                 var lockedStyleIndex = UInt32Value.FromUInt32((uint)workbookStylesPart.Stylesheet.CellFormats.Count());
                  */

-                //Delete all rows except for the header row
+                // Delete all rows except for the header row
                 var headerRow = sheetData.Elements<Row>().FirstOrDefault();
                 sheetData.RemoveAllChildren();
                 sheetData.AppendChild(headerRow);

                 foreach (DataRow row in table.Rows)
                 {
-                    var newRow = new Row();// { RowIndex = rowIndex };
+                    var newRow = new Row();

                     foreach (DataColumn column in table.Columns)
                     {
-
-                        var newCell = new Cell()
+                        var newCell = new Cell
                         {
                             CellValue = new CellValue(row[column].ToString()),
                             DataType = CellValues.String,
                             //StyleIndex = lockedStyleIndex //locked style
                         };
-
+
                         //TODO: Altid int?
                         int t;
                         newCell.DataType = int.TryParse(row[column].ToString(), out t) ? CellValues.Number : CellValues.String;
-
                         newRow.AppendChild(newCell);
                     }
                     sheetData.AppendChild(newRow);
                 }
-

                 /* disabled until more information on the subject is found - or at least until i can test it properly
                 //this is also necessary to enable protection of cells.
@@ -275,10 +264,9 @@
                 workSheetPart.Worksheet.Save();
                  */
             }
-

             workbookPart.Workbook.Save(); //TODO: Test if nessesary?
-            spreadsheetDocument.Close(); //TODO: Make sure this dosn't clear stream
+            spreadsheetDocument.Close();

             return stream;
         }


Fixed visual inspector bug

Fixed visual inspector bug

Inspector for the CaveGenerator would show the "Is Constant" toggle
twice if the corresponding heightmap foldout was expanded.

--- Internal/Editor/CaveGeneratorEditor.cs
+++ Internal/Editor/CaveGeneratorEditor.cs
@@ -2,10 +2,7 @@
 using UnityEngine.Assertions;
 using UnityEditor;
 using CaveGeneration;
-using CaveGeneration.MeshGeneration;
 using System.Collections.Generic;
-using System.Linq;
-using System.Collections;

 [CustomEditor(typeof(CaveGenerator))]
 public class CaveGeneratorEditor : Editor
@@ -56,7 +53,6 @@

     public override void OnInspectorGUI()
     {
-        serializedObject.Update();
         DrawProperties();
         serializedObject.ApplyModifiedProperties();

@@ -119,18 +115,13 @@
                 SerializedProperty height = property.FindPropertyRelative(HEIGHT_MAP_HEIGHT);
                 EditorGUI.indentLevel++;
                 EditorGUILayout.PropertyField(height, new GUIContent(CONSTANT_HEIGHT_LABEL));
+                DrawProperty(isConstant);
                 EditorGUI.indentLevel--;
             }
         }
         else
         {
             DrawProperty(property);
-        }
-        if (property.isExpanded)
-        {
-            EditorGUI.indentLevel++;
-            DrawProperty(isConstant);
-            EditorGUI.indentLevel--;
         }
     }


Added PrivateKeyType enum

Added PrivateKeyType enum

--- PInvoke/Crypt32/Wincrypt.cs
+++ PInvoke/Crypt32/Wincrypt.cs
@@ -8,6 +8,16 @@
 	/// Methods and data types found in Crypt32.dll.
 	public static partial class Crypt32
 	{
+		/// Private key pair type.
+		[PInvokeData("wincrypt.h")]
+		public enum PrivateKeyType
+		{
+			/// Key exchange
+			AT_KEYEXCHANGE = 1,
+			/// Digital signature
+			AT_SIGNATURE = 2
+		}
+
 		///
 		/// The CERT_CONTEXT structure contains both the encoded and decoded representations of a certificate. A certificate context returned
 		/// by one of the functions defined in Wincrypt.h must be freed by calling the CertFreeCertificateContext function. The


Tiny typo in TaskCompletionSource xml comment (#12066)

--- src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs
+++ src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs
@@ -45,7 +45,7 @@
     /// and may be used from multiple threads concurrently.
     /// </para>
     /// </remarks>
-    /// <typeparam name="TResult">The type of the result value assocatied with this <see
+    /// <typeparam name="TResult">The type of the result value associated with this <see
     /// cref="TaskCompletionSource{TResult}"/>.</typeparam>
     public class TaskCompletionSource<TResult>
     {


Search for package cache hash file in right directory

--- PackageCacheResolverTest.cs
+++ PackageCacheResolverTest.cs
@@ -58,7 +58,7 @@
             var packagePath = Path.Combine(CachePath, F.DefaultPackageName, F.DefaultVersion);
             var fileSystem = FileSystemMockBuilder.Create()
                 .AddFile(
-                    Path.Combine(CachePath, $"{F.DefaultPackageName}.{F.DefaultVersion}.nupkg.{F.DefaultHashAlgoritm}"),
+                    Path.Combine(packagePath, $"{F.DefaultPackageName}.{F.DefaultVersion}.nupkg.{F.DefaultHashAlgoritm}"),
                     "WRONGHASH"
                 )
                 .AddFiles(packagePath, F.DefaultAssemblies)
@@ -77,7 +77,7 @@
             var packagePath = Path.Combine(CachePath, F.DefaultPackageName, F.DefaultVersion);
             var fileSystem = FileSystemMockBuilder.Create()
                 .AddFile(
-                    Path.Combine(CachePath, $"{F.DefaultPackageName}.{F.DefaultVersion}.nupkg.{F.DefaultHashAlgoritm}"),
+                    Path.Combine(packagePath, $"{F.DefaultPackageName}.{F.DefaultVersion}.nupkg.{F.DefaultHashAlgoritm}"),
                     F.DefaultHashValue
                 )
                 .AddFiles(packagePath, F.TwoAssemblies)
@@ -101,7 +101,7 @@
             var packagePath = Path.Combine(CachePath, F.DefaultPackageName, F.DefaultVersion);
             var fileSystem = FileSystemMockBuilder.Create()
                 .AddFile(
-                    Path.Combine(CachePath, $"{F.DefaultPackageName}.{F.DefaultVersion}.nupkg.{F.DefaultHashAlgoritm}"),
+                    Path.Combine(packagePath, $"{F.DefaultPackageName}.{F.DefaultVersion}.nupkg.{F.DefaultHashAlgoritm}"),
                     F.DefaultHashValue
                 )
                 .AddFiles(packagePath, F.DefaultAssemblyPath)


reinitialize credential service after new credentials are added (#389)

because the CredentialService is caching the responses to detect retries

--- PackageExplorer/App.xaml.cs
+++ PackageExplorer/App.xaml.cs
@@ -39,12 +39,12 @@

         private async void Application_Startup(object sender, StartupEventArgs e)
         {
-            HttpHandlerResourceV3.CredentialService = new CredentialService(new ICredentialProvider[] {
-                Container.GetExportedValue<CredentialManagerProvider>(),
-                Container.GetExportedValue<CredentialPublishProvider>(),
-                Container.GetExportedValue<CredentialDialogProvider>(),
-            }, false);
-            HttpHandlerResourceV3.CredentialsSuccessfullyUsed = (uri, credentials) => Container.GetExportedValue<ICredentialManager>().Add(credentials, uri);
+            InitCredentialService();
+            HttpHandlerResourceV3.CredentialsSuccessfullyUsed = (uri, credentials) =>
+            {
+                Container.GetExportedValue<ICredentialManager>().Add(credentials, uri);
+                InitCredentialService();
+            };

             MigrateSettings();

@@ -60,6 +60,15 @@
                     return;
                 }
             }
+        }
+
+        private void InitCredentialService()
+        {
+            HttpHandlerResourceV3.CredentialService = new CredentialService(new ICredentialProvider[] {
+                Container.GetExportedValue<CredentialManagerProvider>(),
+                Container.GetExportedValue<CredentialPublishProvider>(),
+                Container.GetExportedValue<CredentialDialogProvider>(),
+            }, nonInteractive: false);
         }

         private static void MigrateSettings()


Removed unused method.

Removed unused method.

--- Piranha/Models/PageModel.cs
+++ Piranha/Models/PageModel.cs
@@ -161,36 +161,6 @@

 			if (Cache.Current.Contains(cachename))
 				Cache.Current.Remove(cachename) ;
-		}
-
-		/// <summary>
-		/// Gets the page model for the current route. This method is only for MVC use.
-		/// </summary>
-		/// <typeparam name="T">The page model type</typeparam>
-		/// <param name="route">Optional route. Overrides RouteData if provided</param>
-		/// <returns>The model</returns>
-		public static T GetByRoute<T>(string route = "") where T : PageModel {
-			RouteData rd = RouteTable.Routes.GetRouteData(new HttpContextWrapper(HttpContext.Current)) ;
-
-			string controller = (string)rd.Values["controller"] ;
-			string action     = (string)rd.Values["action"] ;
-
-			if (route == "")
-				route = controller + (action.ToLower() != "index" ? "/" + action : "") ;
-
-			if (controller.ToLower() != "home") {
-				T m = Activator.CreateInstance<T>() ;
-				m.Page = Models.Page.GetSingle("page_controller = @0 OR (page_controller is NULL AND pagetemplate_controller = @0)", route) ;
-
-				if (m.Page.GroupId != Guid.Empty) {
-					if (!HttpContext.Current.User.Identity.IsAuthenticated || !HttpContext.Current.User.IsMember(m.Page.GroupId))
-						throw new UnauthorizedAccessException("The current user doesn't have access to the requested page.") ;
-				}
-
-				m.Init() ;
-				return m ;
-			}
-			throw new InvalidOperationException("GetByRoute() is only applicable for custom controllers.") ;
 		}
 		#endregion


Handle empty properties on fallback

Handle empty properties on fallback

When a property exists but value is null or empty, the next value is
evaluated.

--- Meridium.EPiServer.Migration/Support/SourcePage.cs
+++ Meridium.EPiServer.Migration/Support/SourcePage.cs
@@ -12,8 +12,18 @@
         }

         public TValue GetValueWithFallback<TValue>(params string[] properties) where TValue : class {
-            var property = properties.SkipWhile(p => null == Properties.Get(p)).FirstOrDefault();
+            var property = properties.SkipWhile(p => !Properties.HasValue(p)).FirstOrDefault();
             return (property != null) ? GetValue<TValue>(property) : null;
         }
     }
+
+    internal static class PropertyDataExtensions {
+        public static bool HasValue(this PropertyDataCollection self, string key) {
+            var property = self.Get(key);
+
+            if (property == null) return false;
+
+            return !(property.IsNull || string.IsNullOrWhiteSpace(property.ToString()));
+        }
+    }
 }


Corregir error

Corregir error

Corrigiendo el error de TheLocura "Errores Locos" TL

--- UTAUdotNET/Window1.xaml.cs
+++ UTAUdotNET/Window1.xaml.cs
@@ -24,33 +24,10 @@
             InitializeComponent();
         }

-        private void Button_Click(object sender, RoutedEventArgs e)
-        {
-            Archivos.Content = "TL";
-        }
-
-        private void Button_Click(object sender, RoutedEventArgs e)
-        {
-            Editar.Content = "TL"
-        }
-
-        private void Button_Click(object sender, RoutedEventArgs e)
-        {
-            Ver.Content = "TL"
-        }
-
-        private void Button_Click(object sender, RoutedEventArgs e)
-        {
-            Herramientas.Content = "TL"
-        }
-
-        private void Archivos_Click(object sender, RoutedEventArgs e)
-        {
-            Opciones.Content = "TL"
-        }

         private void Button_Click(object sender, RoutedEventArgs e)
         {
-            Plugins.Content = "TL"
+            Plugins.Content = "TL";
         }
 }
+}


Implemented tests for DirectoryHelper.Copy method.

--- MissingFeatures.Tests/DirectoryHelper/CopyTests.cs
+++ MissingFeatures.Tests/DirectoryHelper/CopyTests.cs
@@ -1,51 +1,238 @@
 namespace MissingFeatures.Tests.DirectoryHelper
 {
-    using System.Collections.Generic;
+    using System;
+    using System.IO;
     using System.IO.Abstractions.TestingHelpers;
     using System.IO.Fakes;
+    using System.Linq;
+    using System.Text;

     using Microsoft.QualityTools.Testing.Fakes;
     using Microsoft.VisualStudio.TestTools.UnitTesting;

-    using MissingFeatures.Tests.DirectoryHelper.ShimBehaviors;
-
-    /* Test cases:
-        - src doesn't exits
-        - destination doesn't exits
-        - src without subdirectories
-        - src with subdirectories
-        - src with files
-        - src with files in subdirectories
-        - recursive = false
-        - src == destination
-        - exact same src dirs like existing destination directory hierarchy
-    */
+    using MissingFeatures;

     [TestClass]
     public class CopyTests
     {
-        [TestMethod]
-        public void Test()
-        {
-
-            var fileSystemData = new Dictionary<string, MockFileData>
-            {
-                [@"c:\a\b\test.txt"] = new MockFileData("Text file content"),
-                [@"..\test"] = new MockDirectoryData(),
-                [@"..\binary.bin"] = new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2, 0xff, 0x00, }),
-                [@"c:\existing"] = new MockDirectoryData(),
-                [@".\test"] = new MockDirectoryData(),
-                [@"d:\data"] = new MockDirectoryData()
+        private MockFileSystem fileSystem;
+
+        [TestInitialize]
+        public void InitializeFileSystemData()
+        {
+            this.fileSystem = new MockFileSystem();
+            this.fileSystem.AddDirectory(@"c:\test");
+            this.fileSystem.AddFile(@"c:\test\test.txt", new MockFileData("Test text file content"));
+            this.fileSystem.AddDirectory(@"c:\test\nested-test");
+            this.fileSystem.AddFile(@"c:\test\nested-test\text-file.txt", new MockFileData("Some text with ASCII encoding", Encoding.ASCII));
+            this.fileSystem.AddFile(@"c:\test\binary.bin", new MockFileData(new byte[] { 0x12, 0x34, 0x56, 0xd2, 0xff, 0x00, }));
+            this.fileSystem.AddDirectory(@"c:\empty-dir");
+            this.fileSystem.AddDirectory(@"d:\non-empty-dir\test\nested-test\nested-nested-test");
+            this.fileSystem.AddFile(@"d:\non-empty-dir\test\nested-test\test-file.bin", new MockFileData(new byte[] { 0x11, 0x22, 0x33, 0x44, 0xff, 0xbb, 0x00, }));
+            this.fileSystem.AddFile(@"c:\a\b\c\test.txt", new MockFileData("Text file content"));
+        }
+
+        [TestMethod]
+        [ExpectedException(typeof(ArgumentException))]
+        public void TestNonExistingSource_ShouldThrowException()
+        {
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\test-non-existing\", @"c:\data\");
+            }
+        }
+
+        [TestMethod]
+        public void TestEmptySourceAndNonExistingDestination_ShouldCreateDestination()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\empty-dir", @"c:\data\");
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy + 1, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+        }
+
+        [TestMethod]
+        public void TestEmptySourceAndExistingDestination_ShouldDoNothing()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\empty-dir", @"c:\a");
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        [TestMethod]
+        public void TestEqualSourceAndDestination_ShouldDoNothing()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\test", @"c:\test");
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        [TestMethod]
+        public void TestNonEmptySourceAndNonExistingDestination_ShouldHaveCorrectDirectoriesCountAndFilesCount()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\a", @"c:\empty-dir2");
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy + 3, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy + 1, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        [TestMethod]
+        public void TestNonEmptySourceAndExistingDestination_ShouldHaveCorrectDirectoriesCountAndFilesCount()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\a", @"c:\empty-dir");
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy + 2, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy + 1, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        [TestMethod]
+        public void TestNonEmptySourceWithoutFilesAndExistingDestinationNonRecursive_ShouldHaveCorrectDirectoriesCountAndFilesCount()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\a", @"c:\empty-dir", false, false);
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy + 1, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        [TestMethod]
+        public void TestNonEmptySourceWithFilesAndExistingDestinationNonRecursive_ShouldHaveCorrectDirectoriesCountAndFilesCount()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\test", @"c:\empty-dir", false, false);
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy + 1, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy + 2, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        [TestMethod]
+        public void TestNonEmptySourceAndDestinationWithoutFileOverwrite_ShouldHaveCorrectFileContent()
+        {
+            const string DestinationTestFilePath = @"c:\a\b\c\test.txt";
+
+            var destinationTestFileContentBeforeCopy = fileSystem.GetFile(DestinationTestFilePath).TextContents;
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\test", @"c:\a\b\c\");
+            }
+
+            var destinationTestFileContentAfterCopy = fileSystem.GetFile(DestinationTestFilePath).TextContents;
+            Assert.AreEqual(destinationTestFileContentBeforeCopy, destinationTestFileContentAfterCopy, "Invalid file content.");
+        }
+
+        [TestMethod]
+        public void TestNonEmptySourceAndDestinationWithFileOverwrite_ShouldHaveCorrectFileContent()
+        {
+            const string SourceTestFilePath = @"c:\test\test.txt";
+            const string DestinationTestFilePath = @"c:\a\b\c\test.txt";
+
+            var sourceTestFileContentBeforeCopy = fileSystem.GetFile(SourceTestFilePath).TextContents;
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\test", @"c:\a\b\c\", true);
+            }
+
+            var destinationTestFileContentAfterCopy = fileSystem.GetFile(DestinationTestFilePath).TextContents;
+            Assert.AreEqual(sourceTestFileContentBeforeCopy, destinationTestFileContentAfterCopy, "Invalid file content.");
+        }
+
+        [TestMethod]
+        public void TestSimilarSourceAndDestinationDirectoryHierarchies_ShouldHaveCorrectDirectoriesCountAndFilesCount()
+        {
+            var directoriesBeforeCopy = fileSystem.AllDirectories.Count();
+            var filesBeforeCopy = fileSystem.AllFiles.Count();
+
+            using (ShimsContext.Create())
+            {
+                this.PrepareFileSystemShims();
+
+                DirectoryHelper.Copy(@"c:\", @"d:\non-empty-dir\");
+            }
+
+            Assert.AreEqual(directoriesBeforeCopy + 4, fileSystem.AllDirectories.Count(), "Incorrect directories count.");
+            Assert.AreEqual(filesBeforeCopy + 4, fileSystem.AllFiles.Count(), "Incorrect files count.");
+        }
+
+        private void PrepareFileSystemShims()
+        {
+            ShimDirectory.ExistsString = dirPath => this.fileSystem.Directory.Exists(dirPath);
+            ShimDirectory.CreateDirectoryString = dirPath =>
+            {
+                this.fileSystem.AddDirectory(dirPath);
+                return new DirectoryInfo(dirPath);
             };

-            var fileSystem = new MockFileSystem(fileSystemData, @"c:\data");
-
-            using (ShimsContext.Create())
-            {
-                ShimFile.Behavior = new MockFileShimBehavior(fileSystem);
-                // TODO: Add shim bahaviors for: Directory, FileInfo, DirectoryInfo classes
-                // TODO: Extract shim behaviors registrations to a common method
-            }
+            ShimFile.ExistsString = filePath => this.fileSystem.File.Exists(filePath);
+            ShimFile.CopyStringStringBoolean =
+                (sourceFilePath, destinationFilePath, overwrite) => this.fileSystem.File.Copy(sourceFilePath, destinationFilePath, overwrite);
+
+            ShimDirectoryInfo.AllInstances.ExistsGet = dir => this.fileSystem.DirectoryInfo.FromDirectoryName(dir.FullName).Exists;
+            ShimDirectoryInfo.AllInstances.GetFiles =
+                dir => this.fileSystem.Directory.GetFiles(dir.FullName).Select(filePath => new FileInfo(filePath)).ToArray();
+            ShimDirectoryInfo.AllInstances.GetDirectories =
+                dir => this.fileSystem.Directory.GetDirectories(dir.FullName).Select(dirPath => new DirectoryInfo(dirPath)).ToArray();
         }
     }
 }


Fix similar "can see but can't path" crash on sprinters.

--- Trunk/GameEngine/Actors/SprinterMonster.cs
+++ Trunk/GameEngine/Actors/SprinterMonster.cs
@@ -13,11 +13,15 @@

         public override void Action(CoreGameEngine engine)
         {
-            if (IsPlayerVisible(engine) && GetPathToPlayer(engine).Count == 2)
+            if (IsPlayerVisible(engine))
             {
                 UpdateKnownPlayerLocation(engine);
-                if (engine.UseSkill(this, SkillType.Rush, engine.Player.Position))
-                    return;
+                List<Point> pathToPlayer = GetPathToPlayer(engine);
+                if (pathToPlayer != null && pathToPlayer.Count == 2)
+                {
+                    if (engine.UseSkill(this, SkillType.Rush, engine.Player.Position))
+                        return;
+                }
             }

             DefaultAction(engine);


acm as well

acm as well

--- NadekoBot/Modules/Permissions/PermissionsModule.cs
+++ NadekoBot/Modules/Permissions/PermissionsModule.cs
@@ -559,7 +559,8 @@
                         try
                         {
                             var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
-                            var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
+                            var chArg = e.GetArg("channel");
+                            var channel = string.IsNullOrWhiteSpace(chArg) ? e.Channel :PermissionHelper.ValidateChannel(e.Server, chArg);
                             foreach (var module in NadekoBot.Client.GetService<ModuleService>().Modules)
                             {
                                 PermissionsHandler.SetChannelModulePermission(channel, module.Name, state);


W07E03 - Full solution (refactored)

W07E03 - Full solution (refactored)

--- W07E03-Addition/W07E03-Addition/Program.cs
+++ W07E03-Addition/W07E03-Addition/Program.cs
@@ -14,43 +14,18 @@
             Console.SetOut(sw);

             string[] stdin = File.ReadAllLines("input.txt");
-            long N = long.Parse(stdin[0]);
-            AvlTree<long>[] nodes = new AvlTree<long>[N];
-
-            //Parsing
-            for (int i = 1; i <= N; i++)
-            {
-                long[] args = stdin[i].Split(' ').Select(x => long.Parse(x)).ToArray();
-
-                if (nodes[i - 1] == null)
-                    nodes[i - 1] = new AvlTree<long>();
-                nodes[i - 1].Key = args[0];
-                //Left child
-                if (args[1] != 0)
-                {
-                    if (nodes[args[1] - 1] == null)
-                        nodes[args[1] - 1] = new AvlTree<long>() { Parent = nodes[i - 1] };
-                    nodes[i - 1].Left = nodes[args[1] - 1];
-                }
-                //Right child
-                if (args[2] != 0)
-                {
-                    if (args[2] != 0 && nodes[args[2] - 1] == null)
-                        nodes[args[2] - 1] = new AvlTree<long>() { Parent = nodes[i - 1] };
-                    nodes[i - 1].Right = nodes[args[2] - 1];
-                }
-            }
-
-            AvlTree<long> root=null;
-            if (nodes.Length != 0)
-            {
-                root = nodes[0];
-                while (root.Parent != null)
-                    root = root.Parent;
-            }
-
-            for (long i = N + 1; i < stdin.Length; i++)
-                root = AvlTree<long>.Insert(root, new AvlTree<long> { Key = long.Parse(stdin[i]) });
+
+            AvlTree<long> root = null;
+            for (int i = 1; i <= long.Parse(stdin[0]); i++)
+                root = AvlTree<long>.Insert(root, new AvlTree<long> { Key = long.Parse(stdin[i].Split(' ')[0]) });
+
+            for (int i = int.Parse(stdin[0]) + 1; i < stdin.Length; i++)
+            {
+                AvlTree<long> node = new AvlTree<long> { Key = long.Parse(stdin[i].Split(' ')[0]) };
+                root = AvlTree<long>.Insert(root, node);
+                root = AvlTree<long>.Balance(node);
+            }
+

             Console.WriteLine(stdin.Length - 1);
             AvlTree<long>.PrintTree(root);
@@ -66,7 +41,100 @@
         public AvlTree<T> Left { get; set; }
         public AvlTree<T> Right { get; set; }

-        private long Depth { get; set; }
+        private long height = 0;
+        public long Height { get { return height; } set { height = value; } }
+
+        public static AvlTree<T> Next(AvlTree<T> node)
+        {
+            if (node.Right == null)
+                return node;
+            return Minimum(node.Right);
+        }
+
+        public static AvlTree<T> Previous(AvlTree<T> node)
+        {
+            if (node.Left == null)
+                return node;
+            return Maximum(node.Left);
+        }
+
+        public static AvlTree<T> Maximum(AvlTree<T> node)
+        {
+            while (node.Right != null)
+                node = node.Right;
+            return node;
+        }
+
+        public static AvlTree<T> Minimum(AvlTree<T> node)
+        {
+            while (node.Left != null)
+                node = node.Left;
+            return node;
+        }
+
+        /// <returns>Root of tree after remove</returns>
+        public static AvlTree<T> Remove(AvlTree<T> item)
+        {
+            AvlTree<T> parent = item.Parent;
+
+            //Leaf
+            if (item.Left == null && item.Right == null)
+            {
+                if (parent == null)
+                    return null;
+                if (parent.Left == item)
+                    parent.Left = null;
+                else
+                    parent.Right = null;
+
+                UpdateHeight(parent);
+                return Balance(parent);
+            }
+
+            //One child
+            if ((item.Left == null) ^ (item.Right == null))
+                if (item.Left != null)
+                {
+                    if (parent != null)
+                    {
+                        if (parent.Left == item)
+                            parent.Left = item.Left;
+                        else
+                            parent.Right = item.Left;
+
+                        UpdateHeight(parent);
+                    }
+
+                    item.Left.Parent = parent;
+                    return Balance(item.Left);
+                }
+                else
+                {
+                    if (parent != null)
+                    {
+                        if (parent.Left == item)
+                            parent.Left = item.Right;
+                        else
+                            parent.Right = item.Right;
+
+                        UpdateHeight(parent);
+                    }
+
+                    item.Right.Parent = parent;
+                    return Balance(item.Right);
+                }
+
+
+            //Two child
+            if ((item.Left != null) && (item.Right != null))
+            {
+                AvlTree<T> prev = Previous(item);
+                Remove(prev);
+                item.Key = prev.Key;
+            }
+
+            return Balance(item);
+        }

         /// <returns>Root of tree after insert</returns>
         public static AvlTree<T> Insert(AvlTree<T> root, AvlTree<T> node)
@@ -86,7 +154,9 @@
                     {
                         current.Right = node;
                         node.Parent = current;
-                        return Balance(node);
+                        UpdateHeight(node);
+                        return root;
+                        //return Balance(node);
                     }
                 }
                 else
@@ -97,13 +167,42 @@
                     {
                         current.Left = node;
                         node.Parent = current;
-                        return Balance(node);
+                        UpdateHeight(node);
+                        return root;
+                        //return Balance(node);
                     }
                 }
             }
         }

-        /// <returns>Root of tree after balanc</returns>
+        private static void UpdateHeight(AvlTree<T> node)
+        {
+            while (node != null)
+            {
+                long rH = node.Right != null ? node.Right.Height : -1;
+                long lH = node.Left != null ? node.Left.Height : -1;
+
+                if (rH > lH)
+                    node.Height = rH + 1;
+                else
+                    node.Height = lH + 1;
+
+                node = node.Parent;
+            }
+        }
+
+        public static AvlTree<T> Search(AvlTree<T> root, T key)
+        {
+            while (root != null && root.Key.CompareTo(key) != 0)
+                if (root.Key.CompareTo(key) > 0)
+                    root = root.Left;
+                else
+                    root = root.Right;
+
+            return root;
+        }
+
+        /// <returns>Root of tree after balance</returns>
         public static AvlTree<T> Balance(AvlTree<T> leaf)
         {
             AvlTree<T> current = leaf;
@@ -130,29 +229,6 @@
                     current = current.Parent;
             }
             return current;
-        }
-
-        public static long Height(AvlTree<T> root)
-        {
-            if (root == null)
-                return -1;
-            Queue<AvlTree<T>> bfsQueue = new Queue<AvlTree<T>>();
-            long height = 0;
-            root.Depth = 0;
-            bfsQueue.Enqueue(root);
-            while (bfsQueue.Count != 0)
-            {
-                AvlTree<T> current = bfsQueue.Dequeue();
-                if (current != root)
-                    current.Depth = current.Parent.Depth + 1;
-                if (current.Depth > height)
-                    height = current.Depth;
-                if (current.Right != null)
-                    bfsQueue.Enqueue(current.Right);
-                if (current.Left != null)
-                    bfsQueue.Enqueue(current.Left);
-            }
-            return height;
         }

         public static void PrintTree(AvlTree<T> root)
@@ -188,9 +264,16 @@
         public static long GetBalance(AvlTree<T> tree)
         {
             if (tree == null)
-                throw new ArgumentNullException("tree");
-
-            return Height(tree.Right) - Height(tree.Left);
+                return 0;
+
+            if (tree.Left != null && tree.Right != null)
+                return tree.Right.Height - tree.Left.Height;
+            if (tree.Left == null && tree.Right != null)
+                return tree.Right.Height + 1;
+            if (tree.Left != null && tree.Right == null)
+                return -1 - tree.Left.Height;
+            else
+                return 0;
         }

         /// <returns>Root of tree after turn</returns>
@@ -223,6 +306,21 @@
                 else
                     parent.Left = child;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+
+            if (xH > yH)
+                root.Height = xH + 1;
+            else
+                root.Height = yH + 1;
+            if (root.Height > zH)
+                child.Height = root.Height + 1;
+            else
+                child.Height = zH + 1;
+
+            UpdateHeight(child);
             return child;
         }

@@ -256,6 +354,22 @@
                 else
                     parent.Left = child;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+
+            if (zH > xH)
+                root.Height = zH + 1;
+            else
+                root.Height = xH + 1;
+
+            if (y.Height > root.Height)
+                child.Height = yH + 1;
+            else
+                child.Height = root.Height + 1;
+
+            UpdateHeight(child);
             return child;
         }

@@ -296,6 +410,28 @@
             root.Left = y;
             root.Right = w;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+            long wH = w != null ? w.Height : -1;
+
+            if (zH > xH)
+                b.Height = zH + 1;
+            else
+                b.Height = xH + 1;
+
+            if (yH > wH)
+                root.Height = yH + 1;
+            else
+                root.Height = wH + 1;
+
+            if (b.Height > root.Height)
+                c.Height = b.Height + 1;
+            else
+                c.Height = root.Height + 1;
+
+            UpdateHeight(c);
             return c;
         }

@@ -336,6 +472,28 @@
             root.Left = w;
             root.Right = x;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+            long wH = w != null ? w.Height : -1;
+
+            if (wH > yH)
+                root.Height = wH + 1;
+            else
+                root.Height = xH + 1;
+
+            if (yH > zH)
+                b.Height = yH + 1;
+            else
+                b.Height = zH + 1;
+
+            if (b.Height > root.Height)
+                c.Height = b.Height + 1;
+            else
+                c.Height = root.Height + 1;
+
+            UpdateHeight(c);
             return c;
         }
     }


fix bug

fix bug

--- Utils/Client/HttpClient.cs
+++ Utils/Client/HttpClient.cs
@@ -135,7 +135,7 @@
             // 在DEBUG模式下且AccessToken有效时记录接口调用日志
             LogAsync(method.ToString(), url, Message);
 #endif
-            return true;
+            return _Result.successful;
         }

         /// <summary>


I'm taking the SafeObservable from Metro branch

--- Ocell.Common/Library/Collections/SafeObservable.cs
+++ Ocell.Common/Library/Collections/SafeObservable.cs
@@ -1,18 +1,15 @@
 using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
 using System.Collections.Generic;
 using System.Collections.Specialized;
 using System.Threading;
+using System.Linq;
+
+#if WINDOWS_PHONE
 using System.Windows.Threading;
-using System.Linq;
+using System.Windows;
+#elif METRO
+using System.Threading.Tasks;
+#endif

 namespace Ocell.Library
 {
@@ -21,7 +18,9 @@
     public class SafeObservable<T> : IList<T>, INotifyCollectionChanged
     {
         private IList<T> collection = new List<T>();
+#if WINDOWS_PHONE
         private Dispatcher dispatcher;
+#endif
         public event NotifyCollectionChangedEventHandler CollectionChanged;
         private object sync = new object();

@@ -33,69 +32,108 @@

         public SafeObservable()
         {
+#if WINDOWS_PHONE
             dispatcher = Deployment.Current.Dispatcher;
-        }
+#endif
+        }
+
+        #region Event raisers.
+        void RaiseCollectionReset()
+        {
+            var copy = CollectionChanged;
+            if (copy != null)
+            {
+#if WINDOWS_PHONE
+                if (!dispatcher.CheckAccess())
+                    dispatcher.BeginInvoke(RaiseCollectionReset);
+                else
+#endif
+                    copy(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+            }
+        }
+
+        void RaiseCollectionAdd(T item, int index)
+        {
+            var copy = CollectionChanged;
+            if (copy != null)
+            {
+#if WINDOWS_PHONE
+                if (!dispatcher.CheckAccess())
+                    dispatcher.BeginInvoke(() => RaiseCollectionAdd(item, index));
+                else
+#endif
+                    copy(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
+            }
+        }
+
+        void RaiseCollectionRemove(T item, int index)
+        {
+            var copy = CollectionChanged;
+            if (copy != null)
+            {
+#if WINDOWS_PHONE
+                if (!dispatcher.CheckAccess())
+                    dispatcher.BeginInvoke(() => RaiseCollectionRemove(item, index));
+                else
+#endif
+                    copy(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
+            }
+        }
+
+        void RaiseCollectionReplace(T value, T old, int index)
+        {
+            var copy = CollectionChanged;
+            if (copy != null)
+            {
+#if WINDOWS_PHONE
+                if (!dispatcher.CheckAccess())
+                    dispatcher.BeginInvoke(() => RaiseCollectionReplace(value, old, index));
+                else
+#endif
+                    copy(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, value, old, index));
+            }
+        }
+        #endregion

         public void Add(T item)
         {
-            if (dispatcher.CheckAccess())
-                DoAdd(item);
-            else
-                dispatcher.BeginInvoke((Action)(() => { DoAdd(item); }));
+            int index;
+
+            lock (sync)
+            {
+                collection.Add(item);
+                index = collection.Count;
+            }
+
+            RaiseCollectionAdd(item, index);
         }

         public void BulkAdd(IEnumerable<T> items)
-        {
-            if (dispatcher.CheckAccess())
-                DoBulkAdd(items);
-            else
-                dispatcher.BeginInvoke(() => DoBulkAdd(items));
-        }
-
-        private void DoBulkAdd(IEnumerable<T> items)
         {
             int added = 0;
             foreach (var item in items)
             {
-                DoAdd(item);
+                Add(item);
                 added++;
                 if (added >= 5)
                 {
+#if METRO
+                    Task.Delay(10).RunSynchronously();
+#else
                     Thread.Sleep(10);
+#endif
                     added = 0;
                 }
             }
         }

-        private void DoAdd(T item)
-        {
-            lock (sync)
-            {
-                collection.Add(item);
-                int index = collection.Count;
-                if (CollectionChanged != null)
-                    CollectionChanged(this,
-                       new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
-            }
-        }

         public void Clear()
         {
-            if (dispatcher.CheckAccess())
-                DoClear();
-            else
-                dispatcher.BeginInvoke((Action)(() => { DoClear(); }));
-        }
-
-        private void DoClear()
-        {
-            lock (sync)
-            {
+            lock (sync)
                 collection.Clear();
-                if (CollectionChanged != null)
-                    CollectionChanged(this,
-                        new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
-            }
+
+            RaiseCollectionReset();
         }

         public bool Contains(T item)
@@ -131,30 +169,20 @@

         public bool Remove(T item)
         {
-            if (dispatcher.CheckAccess())
-                return DoRemove(item);
-            else
-            {
-                dispatcher.BeginInvoke(() => DoRemove(item));
-                return true; // I KNOW.
-            }
-        }
-
-        private bool DoRemove(T item)
-        {
             bool result;
-            lock (sync)
-            {
-                var index = collection.IndexOf(item);
+            int index;
+            lock (sync)
+            {
+                index = collection.IndexOf(item);
                 if (index == -1)
-                {
                     return false;
-                }
+
                 result = collection.Remove(item);
-                if (result && CollectionChanged != null)
-                    CollectionChanged(this, new
-                        NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
-            }
+            }
+
+            if (result)
+                RaiseCollectionRemove(item, index);
+
             return result;
         }

@@ -182,44 +210,26 @@

         public void Insert(int index, T item)
         {
-            if (dispatcher.CheckAccess())
-                DoInsert(index, item);
-            else
-                dispatcher.BeginInvoke((Action)(() => { DoInsert(index, item); }));
-        }
-
-        private void DoInsert(int index, T item)
-        {
-            lock (sync)
-            {
+            lock (sync)
                 collection.Insert(index, item);
-                if (CollectionChanged != null)
-                    CollectionChanged(this,
-                        new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
-            }
+
+            RaiseCollectionAdd(item, index);
         }

         public void RemoveAt(int index)
         {
-            if (dispatcher.CheckAccess())
-                DoRemoveAt(index);
-            else
-                dispatcher.BeginInvoke((Action)(() => { DoRemoveAt(index); }));
-        }
-
-        private void DoRemoveAt(int index)
-        {
+            T item;
             lock (sync)
             {
                 if (collection.Count == 0 || collection.Count <= index)
                 {
                     return;
                 }
+                item = collection[index];
                 collection.RemoveAt(index);
-                if (CollectionChanged != null)
-                    CollectionChanged(this,
-                        new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
-            }
+            }
+
+            RaiseCollectionRemove(item, index);
         }

         public T this[int index]
@@ -233,17 +243,18 @@
             }
             set
             {
+                T old;
                 lock (sync)
                 {
                     if (collection.Count == 0 || collection.Count <= index || collection[index].Equals(value))
                         return;
-                    var old = collection[index];
+                    old = collection[index];
                     collection[index] = value;
-                    if (CollectionChanged != null)
-                        CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, value, old, index));
                 }
+
+                RaiseCollectionReplace(value, old, index);
             }

         }
     }
-}
+}


remove unedited partial

remove unedited partial

--- nuget/content/Views/Shared/_Notifications.cshtml
+++ nuget/content/Views/Shared/_Notifications.cshtml
@@ -1,92 +0,0 @@
-@using BootstrapNotifications.Extensions
-
-@{
-    var errorList = Html.GetNotifications(NotificationType.ERROR);
-    var warningList = Html.GetNotifications(NotificationType.WARNING);
-    var successList = Html.GetNotifications(NotificationType.SUCCESS);
-    var infoList = Html.GetNotifications(NotificationType.INFO);
-}
-
-@if (errorList != null)
-{
-

-        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
-        @if(errorList.Count() > 1){
-             There are @errorList.Count() errors:
-

-                @foreach (String message in errorList)
-                {
-
@Html.Raw(message)

-                }
-

-        }
-        else{
-             Error:
-            @Html.Raw(errorList.First())
-        }
-

-}
-
-
-@if (warningList != null)
-{
-

-        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
-        @if(warningList.Count() > 1){
-             There are @warningList.Count() warnings:
-

-                @foreach (String message in warningList)
-                {
-
@Html.Raw(message)

-                }
-

-        }
-        else{
-             Warning:
-            @Html.Raw(warningList.First())
-        }
-

-}
-
-
-@if (successList != null)
-{
-

-        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
-        @if(successList.Count() > 1){
-             There are @successList.Count() successful notifications:
-

-                @foreach (String message in successList)
-                {
-
@Html.Raw(message)

-                }
-

-        }
-        else{
-             Success!
-            @Html.Raw(successList.First())
-        }
-

-}
-
-
-@if (infoList != null)
-{
-

-        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
-        @if(infoList.Count() > 1){
-             There are @infoList.Count() notifications:
-

-                @foreach (String message in infoList)
-                {
-
@Html.Raw(message)

-                }
-

-        }
-        else{
-
-            @Html.Raw(infoList.First())
-        }
-

-}
-


W07E04 - Full solution (refactored)

W07E04 - Full solution (refactored)

--- W07E04-Deletion/W07E04-Deletion/Program.cs
+++ W07E04-Deletion/W07E04-Deletion/Program.cs
@@ -14,47 +14,19 @@
             Console.SetOut(sw);

             string[] stdin = File.ReadAllLines("input.txt");
-            long N = long.Parse(stdin[0]);
-            AvlTree<long>[] nodes = new AvlTree<long>[N];
-
-            //Parsing
-            for (int i = 1; i <= N; i++)
-            {
-                long[] args = stdin[i].Split(' ').Select(x => long.Parse(x)).ToArray();
-
-                if (nodes[i - 1] == null)
-                    nodes[i - 1] = new AvlTree<long>();
-                nodes[i - 1].Key = args[0];
-                //Left child
-                if (args[1] != 0)
-                {
-                    if (nodes[args[1] - 1] == null)
-                        nodes[args[1] - 1] = new AvlTree<long>() { Parent = nodes[i - 1] };
-                    nodes[i - 1].Left = nodes[args[1] - 1];
-                }
-                //Right child
-                if (args[2] != 0)
-                {
-                    if (args[2] != 0 && nodes[args[2] - 1] == null)
-                        nodes[args[2] - 1] = new AvlTree<long>() { Parent = nodes[i - 1] };
-                    nodes[i - 1].Right = nodes[args[2] - 1];
-                }
-            }
+            int N = int.Parse(stdin[0]);

             AvlTree<long> root = null;
-            if (nodes.Length != 0)
-            {
-                root = nodes[0];
-                while (root.Parent != null)
-                    root = root.Parent;
-            }
-
-            for (long i = N + 1; i < stdin.Length; i++)
-            {
-                AvlTree<long> item = AvlTree<long>.Search(root, long.Parse(stdin[i]));
-                if (item != null)
-                    root = AvlTree<long>.Remove(item);
-            }
+            for (int i = 1; i <=N; i++)
+                root = AvlTree<long>.Insert(root, new AvlTree<long> { Key = long.Parse(stdin[i].Split(' ')[0]) });
+
+            for(int i = N+1;i<stdin.Length;i++)
+            {
+                AvlTree<long> node = AvlTree<long>.Search(root, long.Parse(stdin[i]));
+                if (node != null)
+                    root = AvlTree<long>.Remove(node);
+            }
+
             Console.WriteLine(N - (stdin.Length - 1 - N));
             AvlTree<long>.PrintTree(root);

@@ -70,6 +42,8 @@
         public AvlTree<T> Right { get; set; }

         private long Depth { get; set; }
+        private long height = 0;
+        public long Height { get { return height; } set { height = value; } }

         public static AvlTree<T> Next(AvlTree<T> node)
         {
@@ -113,6 +87,8 @@
                     parent.Left = null;
                 else
                     parent.Right = null;
+
+                UpdateHeight(parent);
                 return Balance(parent);
             }

@@ -121,21 +97,30 @@
                 if (item.Left != null)
                 {
                     if (parent != null)
+                    {
                         if (parent.Left == item)
                             parent.Left = item.Left;
                         else
                             parent.Right = item.Left;

+                        UpdateHeight(parent);
+                    }
+
                     item.Left.Parent = parent;
                     return Balance(item.Left);
                 }
                 else
                 {
                     if (parent != null)
+                    {
                         if (parent.Left == item)
                             parent.Left = item.Right;
                         else
                             parent.Right = item.Right;
+
+                        UpdateHeight(parent);
+                    }
+
                     item.Right.Parent = parent;
                     return Balance(item.Right);
                 }
@@ -170,7 +155,9 @@
                     {
                         current.Right = node;
                         node.Parent = current;
-                        return Balance(node);
+                        UpdateHeight(node);
+                        return root;
+                        //return Balance(node);
                     }
                 }
                 else
@@ -181,9 +168,27 @@
                     {
                         current.Left = node;
                         node.Parent = current;
-                        return Balance(node);
+                        UpdateHeight(node);
+                        return root;
+                        //return Balance(node);
                     }
                 }
+            }
+        }
+
+        private static void UpdateHeight(AvlTree<T> node)
+        {
+            while (node != null)
+            {
+                long rH = node.Right != null ? node.Right.Height : -1;
+                long lH = node.Left != null ? node.Left.Height : -1;
+
+                if (rH > lH)
+                    node.Height = rH + 1;
+                else
+                    node.Height = lH + 1;
+
+                node = node.Parent;
             }
         }

@@ -225,29 +230,6 @@
                     current = current.Parent;
             }
             return current;
-        }
-
-        public static long Height(AvlTree<T> root)
-        {
-            if (root == null)
-                return -1;
-            Queue<AvlTree<T>> bfsQueue = new Queue<AvlTree<T>>();
-            long height = 0;
-            root.Depth = 0;
-            bfsQueue.Enqueue(root);
-            while (bfsQueue.Count != 0)
-            {
-                AvlTree<T> current = bfsQueue.Dequeue();
-                if (current != root)
-                    current.Depth = current.Parent.Depth + 1;
-                if (current.Depth > height)
-                    height = current.Depth;
-                if (current.Right != null)
-                    bfsQueue.Enqueue(current.Right);
-                if (current.Left != null)
-                    bfsQueue.Enqueue(current.Left);
-            }
-            return height;
         }

         public static void PrintTree(AvlTree<T> root)
@@ -283,9 +265,16 @@
         public static long GetBalance(AvlTree<T> tree)
         {
             if (tree == null)
-                throw new ArgumentNullException("tree");
-
-            return Height(tree.Right) - Height(tree.Left);
+                return 0;
+
+            if (tree.Left != null && tree.Right != null)
+                return tree.Right.Height - tree.Left.Height;
+            if (tree.Left == null && tree.Right != null)
+                return tree.Right.Height + 1;
+            if (tree.Left != null && tree.Right == null)
+                return -1 - tree.Left.Height;
+            else
+                return 0;
         }

         /// <returns>Root of tree after turn</returns>
@@ -318,6 +307,21 @@
                 else
                     parent.Left = child;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+
+            if (xH > yH)
+                root.Height = xH + 1;
+            else
+                root.Height = yH + 1;
+            if (root.Height > zH)
+                child.Height = root.Height + 1;
+            else
+                child.Height = zH + 1;
+
+            UpdateHeight(child);
             return child;
         }

@@ -351,6 +355,22 @@
                 else
                     parent.Left = child;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+
+            if (zH > xH)
+                root.Height = zH + 1;
+            else
+                root.Height = xH + 1;
+
+            if (y.Height > root.Height)
+                child.Height = yH + 1;
+            else
+                child.Height = root.Height + 1;
+
+            UpdateHeight(child);
             return child;
         }

@@ -391,6 +411,28 @@
             root.Left = y;
             root.Right = w;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+            long wH = w != null ? w.Height : -1;
+
+            if (zH > xH)
+                b.Height = zH + 1;
+            else
+                b.Height = xH + 1;
+
+            if (yH > wH)
+                root.Height = yH + 1;
+            else
+                root.Height = wH + 1;
+
+            if (b.Height > root.Height)
+                c.Height = b.Height + 1;
+            else
+                c.Height = root.Height + 1;
+
+            UpdateHeight(c);
             return c;
         }

@@ -431,6 +473,28 @@
             root.Left = w;
             root.Right = x;

+            //Heights
+            long xH = x != null ? x.Height : -1;
+            long yH = y != null ? y.Height : -1;
+            long zH = z != null ? z.Height : -1;
+            long wH = w != null ? w.Height : -1;
+
+            if (wH > yH)
+                root.Height = wH + 1;
+            else
+                root.Height = xH + 1;
+
+            if (yH > zH)
+                b.Height = yH + 1;
+            else
+                b.Height = zH + 1;
+
+            if (b.Height > root.Height)
+                c.Height = b.Height + 1;
+            else
+                c.Height = root.Height + 1;
+
+            UpdateHeight(c);
             return c;
         }
     }


default schema to lndm

default schema to lndm

--- Landmine.Domain/LandmineDataContext.cs
+++ Landmine.Domain/LandmineDataContext.cs
@@ -11,8 +11,13 @@
         public LandmineDataContext()
            : base("DefaultConnection")
         {
+        }

+        public DbSet<Score> Scores { get; set; }
+
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            modelBuilder.HasDefaultSchema("lndm");
         }
-        public DbSet<Score> Scores { get; set; }
     }
 }


Put links from youtube into Videos category

--- WLW/LinkBlogPlugin/Helpers/LookupHelper.cs
+++ WLW/LinkBlogPlugin/Helpers/LookupHelper.cs
@@ -104,6 +104,11 @@
         /// <returns>An author result for the lookup.</returns>
         public AuthorResult GetAuthorInfoByUrl(string authorName, string url)
         {
+            if (url.Contains("youtube.com"))
+            {
+                return new AuthorResult(authorName, new Category(CategoryType.Videos));
+            }
+
             var result = _urlContainsLookupDictionary.Keys.FirstOrDefault(url.Contains);

             return !string.IsNullOrWhiteSpace(result)


Small chaneg to adapt to trunk

Small chaneg to adapt to trunk

--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3421,9 +3421,10 @@
                         RotationOffset,
                         UsePhysics);

-                    if (PhysActor != null)
+                    PhysicsActor pa = PhysActor;
+                    if (pa != null)
                     {
-                        PhysActor.LocalID = LocalId;
+                        pa.LocalID = LocalId;
                         DoPhysicsPropertyUpdate(UsePhysics, true);
                         if (m_parentGroup != null)
                         {


Formatting

Formatting

--- PART/Source/CprBroker/Web/Pages/LogEntries.aspx.cs
+++ PART/Source/CprBroker/Web/Pages/LogEntries.aspx.cs
@@ -71,7 +71,7 @@
                 Page = page;
             }

-
+

             public TraceEventType? CurrentType
             {
@@ -104,8 +104,8 @@
         protected void Page_Load(object sender, EventArgs e)
         {
             if (!IsPostBack)
-            {
-                lvType.DataBind();
+            {
+                lvType.DataBind();
             }
         }


Revert to If

Revert to If

--- WebApp-B2C-DotNet/Views/Home/Claims.cshtml
+++ WebApp-B2C-DotNet/Views/Home/Claims.cshtml
@@ -13,15 +13,18 @@

     @foreach (Claim claim in ClaimsPrincipal.Current.Claims)
-
     {
-        string myClaimType = @claim.GetType().ToString();

-
-             @myClaimType
+            @claim.Type
+            if (@claim.Type = "emails")
+            {
+            @claim.Value + " Found it!"
+            }
+            else
+            {
             @claim.Value
-
-
+            }
+


More guards

More guards

--- WalletWasabi/Crypto/Mac.cs
+++ WalletWasabi/Crypto/Mac.cs
@@ -39,6 +39,7 @@
 		public static MAC ComputeMAC(CoordinatorSecretKey sk, GroupElement Ma, Scalar t)
 		{
 			Guard.NotNull(nameof(sk), sk);
+			CryptoGuard.NotZero(nameof(t), t);
 			CryptoGuard.NotNullOrInfinity(nameof(Ma), Ma);

 			return ComputeAlgebraicMAC((sk.X0, sk.X1), (sk.W * Generators.Gw) + (sk.Ya * Ma), t);


add comment

add comment

--- Line.Messaging/ILineMessagingClient.cs
+++ Line.Messaging/ILineMessagingClient.cs
@@ -6,6 +6,9 @@

 namespace Line.Messaging
 {
+    /// <summary>
+    /// LINE Messaging API client, which handles request/response to LINE server.
+    /// </summary>
     public interface ILineMessagingClient
     {
         #region Message


Replace  AppendFormat with Append (ToQueryString extension)

--- src/redmine-net-api/Extensions/NameValueCollectionExtensions.cs
+++ src/redmine-net-api/Extensions/NameValueCollectionExtensions.cs
@@ -15,6 +15,7 @@
 */

 using System.Collections.Specialized;
+using System.Globalization;
 using System.Text;

 namespace Redmine.Net.Api.Extensions
@@ -76,16 +77,23 @@

             for (var index = 0; index < requestParameters.Count; ++index)
             {
-                stringBuilder.AppendFormat("{0}={1}&",requestParameters.AllKeys[index],requestParameters[index]);
-
+                stringBuilder
+                    .Append(requestParameters.AllKeys[index].ToString(CultureInfo.InvariantCulture))
+                    .Append("=")
+                    .Append(requestParameters[index].ToString(CultureInfo.InvariantCulture))
+                    .Append("&");
             }

             stringBuilder.Length -= 1;

-            stringBuilder.Insert(0, "?");
+            var queryString = stringBuilder.ToString();

-            return stringBuilder.ToString();
-
+            #if !(NET20)
+            stringBuilder.Clear();
+            #endif
+            stringBuilder = null;
+
+            return queryString;
         }

     }


Update WindowFrameRemover.cs

Update WindowFrameRemover.cs


Fix already taken -a option

Fix already taken -a option

now -av

--- XmlSchemaClassGenerator.Console/Program.cs
+++ XmlSchemaClassGenerator.Console/Program.cs
@@ -76,7 +76,7 @@
                 { "f|ef", "generate Entity Framework Code First compatible classes", v => entityFramework = v != null },
                 { "t|interface", "generate interfaces for groups and attribute groups (default is enabled)", v => interfaces = v != null },
                 { "a|pascal", "use Pascal case for class and property names (default is enabled)", v => pascal = v != null },
-                { "a|assemblyVisible", "use the internal visibility modifier (default is false)", v => assembly = v != null },
+                { "av|assemblyVisible", "use the internal visibility modifier (default is false)", v => assembly = v != null },
                 { "u|enableUpaCheck", "should XmlSchemaSet check for Unique Particle Attribution (UPA) (default is enabled)", v => enableUpaCheck = v != null },
                 { "ct|collectionType=", "collection type to use (default is " + typeof(Collection<>).FullName + ")", v => collectionType = v == null ? typeof(Collection<>) : Type.GetType(v, true) },
                 { "cit|collectionImplementationType=", "the default collection type implementation to use (default is null)", v => collectionImplementationType = v == null ? null : Type.GetType(v, true) },


catch exceptions when loading images from zip

--- PackageExplorer/Converters/PackageIconConverter.cs
+++ PackageExplorer/Converters/PackageIconConverter.cs
@@ -28,12 +28,18 @@
                     {
                         if (string.Equals(file.Path, iconPath, StringComparison.OrdinalIgnoreCase))
                         {
-                            var image = new BitmapImage();
-                            image.BeginInit();
-                            image.CacheOption = BitmapCacheOption.OnLoad;
-                            image.StreamSource = file.GetStream();
-                            image.EndInit();
-                            return image;
+                            // catch potential exceptions during image loading from zip file
+                            // see 1097
+                            try
+                            {
+                                var image = new BitmapImage();
+                                image.BeginInit();
+                                image.CacheOption = BitmapCacheOption.OnLoad;
+                                image.StreamSource = file.GetStream();
+                                image.EndInit();
+                                return image;
+                            }
+                            catch { }
                         }
                     }