Add boolean return value

Add boolean return value

--- osu.Game/Database/ArchiveModelManager.cs
+++ osu.Game/Database/ArchiveModelManager.cs
@@ -281,7 +281,8 @@
         /// Is a no-op for already deleted items.
         /// </summary>
         /// <param name="item">The item to delete.</param>
-        public void Delete(TModel item)
+        /// <returns>false if no operation was performed</returns>
+        public bool Delete(TModel item)
         {
             using (ContextFactory.GetForWrite())
             {
@@ -289,10 +290,11 @@
                 var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);

                 // Test for null since FirstOrDefault will return null if nothing is found
-                if (foundModel == null || foundModel.DeletePending) return;
+                if (foundModel == null || foundModel.DeletePending) return false;

                 if (ModelStore.Delete(foundModel))
                     Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());
+                return true;
             }
         }


Use `ThreadLocal` to avoid potential threading issues

--- osu.Game/Database/RealmContextFactory.cs
+++ osu.Game/Database/RealmContextFactory.cs
@@ -52,7 +52,7 @@
         /// </summary>
         private readonly SemaphoreSlim contextCreationLock = new SemaphoreSlim(1);

-        private bool canCreateContexts;
+        private ThreadLocal<bool> currentThreadCanCreateContexts = new ThreadLocal<bool>();

         private static readonly GlobalStatistic<int> refreshes = GlobalStatistics.Get<int>(@"Realm", @"Dirty Refreshes");
         private static readonly GlobalStatistic<int> contexts_created = GlobalStatistics.Get<int>(@"Realm", @"Contexts (Created)");
@@ -155,13 +155,13 @@

             try
             {
-                if (!canCreateContexts)
+                if (!currentThreadCanCreateContexts.Value)
                     contextCreationLock.Wait();

                 // the semaphore is used to stop all context creation.
                 // once the semaphore has been taken by this code section, it is safe to create further contexts.
                 // this can happen if a realm subscription is active and triggers a callback which has user code that calls `CreateContext`.
-                canCreateContexts = true;
+                currentThreadCanCreateContexts.Value = true;

                 contexts_created.Value++;

@@ -170,7 +170,7 @@
             finally
             {
                 contextCreationLock.Release();
-                canCreateContexts = false;
+                currentThreadCanCreateContexts.Value = false;
             }
         }


범위의 최소값과 최대값이 모두 음수인 그래프의 X좌표를 입력받아 눈금의 숫자를 출력하는 알고리즘 구현

--- Transformation/LogTransformation.cs
+++ Transformation/LogTransformation.cs
@@ -362,7 +362,14 @@
                 {
                     Value = 0;

-                    MaxLogValue = Math.Ceiling(Math.Log(Max, LogBase));
+                    if (Min > 0)
+                    {
+                        MaxLogValue = Math.Ceiling(Math.Log(Max, LogBase)) - Math.Floor(Math.Log(Min, LogBase));
+                    }
+                    else
+                    {
+                        MaxLogValue = Math.Ceiling(Math.Log(Max, LogBase));
+                    }

                     RulerCount = MaxLogValue + 1;

@@ -392,6 +399,47 @@
                         }
                     }
                 }
+
+                else if (Min < 0 && Max < 0)
+                {
+
+                    if (Min < 0)
+                    {
+                        MaxLogValue = Math.Ceiling(Math.Log(Math.Abs(Min), LogBase))
+                            - Math.Floor(Math.Log(Math.Abs(Max), LogBase));
+                    }
+                    else
+                    {
+                        MaxLogValue = Math.Ceiling(Math.Log(Min, LogBase));
+                    }
+
+                    Value = Math.Pow(LogBase, MaxLogValue) * (-1);
+
+                    RulerCount = MaxLogValue + 1;
+
+                    CurrentPoint = 80 + GraphWidth / RulerCount; // x축에 있는 눈금 1의 좌표
+
+                    if (PointValue != GraphZeroPoint.X)
+                    {
+                        while (CurrentPoint < PointValue)
+                        {
+                            Gap = Math.Pow(LogBase, MaxLogValue - i) - Math.Pow(LogBase, MaxLogValue - (i + 1));
+
+                            j = 0;
+
+                            while (j < Gap)
+                            {
+                                CurrentPoint += (GraphWidth / RulerCount) / Gap;
+
+                                Value += 1;
+
+                                j++;
+                            }
+
+                            i++;
+                        }
+                    }
+                }
             }
             else
             {
@@ -399,7 +447,14 @@
                 {
                     Value = 0;

-                    MaxLogValue = Math.Ceiling(Math.Log(Max, LogBase));
+                    if(Min > 0)
+                    {
+                        MaxLogValue = Math.Ceiling(Math.Log(Max, LogBase)) - Math.Floor(Math.Log(Min,LogBase));
+                    }
+                    else
+                    {
+                        MaxLogValue = Math.Ceiling(Math.Log(Max, LogBase));
+                    }

                     RulerCount = MaxLogValue + 1;


Unit tests now dump JSON for debugging

Unit tests now dump JSON for debugging

--- UnitTests/TestInternals/TestBase.cs
+++ UnitTests/TestInternals/TestBase.cs
@@ -28,6 +28,8 @@
             settings.Error = Error;

             VirusTotal = new VirusTotal("YOUR API KEY HERE", settings);
+            VirusTotal.DumpRawJSON = true;
+            VirusTotal.DumpFolder = @"%TEMP%\UnitTests\";
         }

         protected VirusTotal VirusTotal { get; }


clean up existing editor

clean up existing editor

--- VSIXProject2019/GitChangesWindow.cs
+++ VSIXProject2019/GitChangesWindow.cs
@@ -45,6 +45,8 @@
         private IServiceProvider OleServiceProvider;
         private IVsInvisibleEditorManager InvisibleEditorManager;
         private IVsEditorAdaptersFactoryService EditorAdapter;
+        private IVsInvisibleEditor invisibleEditor;
+        private IVsCodeWindow codeWindow;
         private IVsTextView textView;

         public const string WindowGuidString = "e0487501-8bf2-4e94-8b35-ceb6f0010c44"; // Replace with new GUID in your own code
@@ -96,11 +98,25 @@
             }
         }

+        /// <summary>
+        /// Cleans up an existing editor if we are about to put a new one in place, used to close down the old editor bits as well as
+        /// nulling out any cached objects that we have that came from the now dead editor.
         /// </summary>
         internal void ClearEditor()
         {
             filePath = "";
-            DiffEditor.Content = null;
+            if (this.codeWindow != null)
+            {
+                this.codeWindow.Close();
+                this.codeWindow = null;
+            }
+
+            if (this.textView != null)
+            {
+                this.textView.CloseView();
+                this.textView = null;
+            }
+            this.invisibleEditor = null;
         }
         #endregion

@@ -110,14 +126,12 @@
             //IVsInvisibleEditors are in-memory represenations of typical Visual Studio editors.
             //Language services, highlighting and error squiggles are hooked up to these editors
             //for us once we convert them to WpfTextViews.
-            IVsInvisibleEditor invisibleEditor;
             ErrorHandler.ThrowOnFailure(this.InvisibleEditorManager.RegisterInvisibleEditor(
                 filePath
                 , pProject: null
                 , dwFlags: (uint)_EDITORREGFLAGS.RIEF_ENABLECACHING
                 , pFactory: null
                 , ppEditor: out invisibleEditor));
-            //RegisterDocument(filePath);

             var docDataPointer = IntPtr.Zero;
             Guid guidIVsTextLines = typeof(IVsTextLines).GUID;
@@ -129,7 +143,6 @@

             IVsTextLines docData = (IVsTextLines)Marshal.GetObjectForIUnknown(docDataPointer);

-            IVsCodeWindow codeWindow;
             //Create a code window adapter
             codeWindow = EditorAdapter.CreateVsCodeWindowAdapter(OleServiceProvider);

@@ -146,14 +159,10 @@
             ErrorHandler.ThrowOnFailure(codeWindow.GetPrimaryView(out textView));

             var textViewHost = EditorAdapter.GetWpfTextViewHost(textView);
-            //textViewHost.TextView.Options.SetOptionValue(GitTextViewOptions.DiffMarginId, false);
             textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.ChangeTrackingId, false);
             textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
             textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
             textViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
-            textViewHost.TextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
-
-            //DiffEditor.Content = "";
             DiffEditor.Content = textViewHost.HostControl;

             return textView;


whitespace

whitespace

--- WalletWasabi.Gui/MainWindow.xaml.cs
+++ WalletWasabi.Gui/MainWindow.xaml.cs
@@ -47,7 +47,6 @@

 		private void InitializeComponent()
 		{
-
 			AvaloniaXamlLoader.Load(this);
 		}


cleanup

cleanup

--- WorkingTimeTracker/Configuration.cs
+++ WorkingTimeTracker/Configuration.cs
@@ -10,6 +10,22 @@
 {
     public class Configuration
     {
+        /*Variables*/
+        public string configFileName = "config.xml";
+        Values values = new Values();
+
+
+        /*--------------------------------------------------------------------------------------------------------------*/
+        /*Value container class*/
+        public class Values
+        {
+            public string SafetyCopyPath = "null";
+            public double standartWorkingTime = 8;
+        }
+
+
+
+        /*--------------------------------------------------------------------------------------------------------------*/
         /*Singleton stuff*/
         private static readonly Configuration instance = new Configuration();

@@ -23,9 +39,11 @@

         private Configuration()
         {
+            /*Load values from file*/
             this.load();
         }

+        /*Singleton instance*/
         public static Configuration Instance
         {
             get
@@ -34,27 +52,8 @@
             }

         }
-
-        public class Values
-        {
-            public string SafetyCopyPath = "null";
-            public double standartWorkingTime = 8;
-        }
-
-        Values values = new Values();
-
-
-        public string configFileName = "config.xml";
-
-        public void load()
-        {
-            if (File.Exists(configFileName))
-            {
-                values = Serialization.ReadFromXmlFile<Values>(configFileName);
-            }
-        }
-
-
+        /*--------------------------------------------------------------------------------------------------------------*/
+        /*getters and setters*/
         public void setSafetyCopyPath(string path)
         {
             values.SafetyCopyPath = path;
@@ -67,20 +66,34 @@
             safe();
         }

+        public string getSafetyCopyPath()
+        {
+            return values.SafetyCopyPath;
+        }
+
+        public double getStandartWorkingTime()
+        {
+            return values.standartWorkingTime;
+        }
+
+        /*--------------------------------------------------------------------------------------------------------------*/
+        /*File operations*/
+
+        /*Save values to File*/
         private void safe()
         {
             Serialization.WriteToXmlFile<Values>(this.configFileName,values);
         }

-        internal string getSafetyCopyPath()
+        /*Load values from file if it exists*/
+        public void load()
         {
-            return values.SafetyCopyPath;
+            if (File.Exists(configFileName))
+            {
+                values = Serialization.ReadFromXmlFile<Values>(configFileName);
+            }
         }

-        internal double getStandartWorkingTime()
-        {
-            return values.standartWorkingTime;
-        }
     }


Throw an exception if attempting to ask an async question when we're awaiting the response from a previous question.

--- WorldModel/WorldModel/WorldModel.cs
+++ WorldModel/WorldModel/WorldModel.cs
@@ -1360,6 +1360,10 @@

         internal void ShowQuestionAsync(string caption, IScript callback, Context c)
         {
+            if (m_questionCallback != null)
+            {
+                throw new Exception("Only one question can be asked at a time.");
+            }
             m_questionCallback = callback;
             m_questionCallbackContext = c;
             m_playerUI.ShowQuestion(caption);


[CA-121427] MetricUpdater threading/locking model is broken (making plan in CP-6997) -- Optimization

Signed-off-by: Gabor Apati-Nagy <fea1aad7ceb67d3aeb88acb6b51e51467c21418e@citrix.com>

--- XenModel/XenSearch/MetricUpdater.cs
+++ XenModel/XenSearch/MetricUpdater.cs
@@ -41,6 +41,7 @@

 using XenAdmin.Core;
 using System.Threading.Tasks;
+using System.Linq;

 namespace XenAdmin.XenSearch
 {
@@ -120,12 +121,9 @@
                     hosts = _hosts;
                 }

-                Parallel.ForEach(hosts.Keys,
+                Parallel.ForEach(hosts.Keys.Where(h => h.Connection.IsConnected),
                     host =>
                     {
-                        if (!host.Connection.IsConnected)
-                            return;
-
                         HostMetric hm;
                         //Intentionally using TryGetValue (instead of indexer's getter), because there is a slight chance 'host' is not in 'hosts.Keys' anymore.
                         //This means that metrics of such 'host' can be ignored safely (no else implemented below).


fixed minimal settings bug

fixed minimal settings bug

--- YuGiOhBot/Services/GuildServices.cs
+++ YuGiOhBot/Services/GuildServices.cs
@@ -53,13 +53,13 @@
                 using (SqliteCommand getMinimal = database.CreateCommand())
                 {

-                    getMinimal.CommandText = $"select * from {PrefixTable}";
+                    getMinimal.CommandText = $"select * from {MinimalTable}";

                     using (SqliteDataReader dataReader = await getMinimal.ExecuteReaderAsync())
                     {

                         int idOrd = dataReader.GetOrdinal("id");
-                        int settingOrd = dataReader.GetOrdinal("prefix");
+                        int settingOrd = dataReader.GetOrdinal("setting");

                         while (await dataReader.ReadAsync())
                         {


remove unsed stubs.

remove unsed stubs.

2005-11-18  Larry Ewing  <lewing@novell.com>

	* src/Exif.cs: remove unsed stubs.

--- src/Exif.cs
+++ src/Exif.cs
@@ -566,15 +566,6 @@
 			this.SetData (FSpot.BitConverter.GetBytes (s, this.ByteOrder == ByteOrder.Intel));
 		}

-		public void SetData (ushort [] data)
-		{
-		}
-
-		public void SetData (short [] data)
-		{
-
-		}
-
 		public void SetData (string value)
 		{
 			int len = System.Text.Encoding.UTF8.GetByteCount (value);


skip not valid sheet names ( if given valid list )

--- src/Xlsx.cs
+++ src/Xlsx.cs
@@ -45,7 +45,8 @@
             string _sheetName = null,
             bool sheetNameIgnoreCase = true,
             HashSet<string> columnNames = null,
-            bool columnNamesIgnoreCase = true)
+            bool columnNamesIgnoreCase = true,
+            string[] valid_sheetnames = null)
         {
             var wb = new XLWorkbook(xlsxPathfilename);
             string sheetName = _sheetName;
@@ -56,6 +57,8 @@
             {
                 foreach (var _ws in wb.Worksheets)
                 {
+                    if (valid_sheetnames != null && !valid_sheetnames.Any(r => r.ToLower() == _ws.Name.ToLower())) continue;
+
                     yield return new ImportXlsxDataSheet(_ws.Name, _ws.ParseXlsxData(columnNames, columnNamesIgnoreCase));
                 }
             }


fixifixi

fixifixi

--- Checker.cs
+++ Checker.cs
@@ -6,7 +6,5 @@
         {
             return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z");
         }
-
-        public static void
     }
 }


New overload for parameter reward/penalty update method; limit to specific parameter type

--- contractContainer.cs
+++ contractContainer.cs
@@ -152,6 +152,18 @@
 			}
 		}

+		internal void updateParemeterInfo(Type t)
+		{
+			foreach (parameterContainer pC in allParamList)
+			{
+				if (pC.CParam.GetType() == t)
+				{
+					pC.paramRewards(pC.CParam);
+					pC.paramPenalties(pC.CParam);
+				}
+			}
+		}
+
 		internal void addToParamList(parameterContainer pC)
 		{
 			allParamList.Add(pC);


Do not expose non-public Apple selectors.

This will be provided for in an alternate manner.

--- src/foundation.cs
+++ src/foundation.cs
@@ -3911,12 +3911,6 @@
 		[Static]
 		[Export ("inputStreamWithURL:")]
 		NSInputStream FromUrl (NSUrl url);
-
-		[Export ("_scheduleInCFRunLoop:forMode:")]
-		void ScheduleInCFRunLoop (CFRunLoop runloop, NSString mode);
-
-		[Export ("_unscheduleFromCFRunLoop:forMode:")]
-		void UnscheduleInCFRunLoop (CFRunLoop runloop, NSString mode);
 	}

 	//


NSThread's initWithTarget:selector:object: can take null for the object

--- src/foundation.cs
+++ src/foundation.cs
@@ -5221,7 +5221,7 @@
 		NSThread MainThread { get; }

 		[Export ("initWithTarget:selector:object:")]
-		IntPtr Constructor (NSObject target, Selector selector, NSObject argument);
+		IntPtr Constructor (NSObject target, Selector selector, [NullAllowed] NSObject argument);

 		[Export ("isExecuting")]
 		bool IsExecuting { get; }


Log GIO critical warnings.

Log GIO critical warnings.

--- src/main.cs
+++ src/main.cs
@@ -153,6 +153,8 @@
 					//Debug GLib-GObject critical warnings
 					GLib.Log.SetLogHandler ("GLib-GObject", GLib.LogLevelFlags.Critical, logFunc);

+					GLib.Log.SetLogHandler ("GLib-GIO", GLib.LogLevelFlags.Critical, logFunc);
+
 					break;
 				case "--uninstalled": case "--gdb": case "--valgrind": case "--sync":
 					break;


Lock before rendering progress

Lock before rendering progress

--- src/AppHarbor/ConsoleProgressBar.cs
+++ src/AppHarbor/ConsoleProgressBar.cs
@@ -13,6 +13,7 @@
 		private readonly IList<double> _perSecondAverages;
 		private readonly string _displayUnit;
 		private Func<long, double> _displayUnitConversion;
+		private readonly object _lock = new Object();

 		public ConsoleProgressBar(string displayUnit, Func<long, double> displayUnitConversion)
 		{
@@ -48,8 +49,12 @@
 				.GetHumanized());

 			var percentDone = (processedItems * 100) / totalItems;
-			ConsoleProgressBar.Render(percentDone, string.Format("{0} ({1}% of {2:0.0} {3}). {4}",
-				message, percentDone, _displayUnitConversion(totalItems), _displayUnit, timeEstimate));
+
+			lock (_lock)
+			{
+				ConsoleProgressBar.Render(percentDone, string.Format("{0} ({1}% of {2:0.0} {3}). {4}",
+					message, percentDone, _displayUnitConversion(totalItems), _displayUnit, timeEstimate));
+			}
 		}

 		private static void Render(double percentage, string message)


Update IInputElement.cs

Update IInputElement.cs

--- src/Avalonia.Input/IInputElement.cs
+++ src/Avalonia.Input/IInputElement.cs
@@ -63,7 +63,7 @@
         event EventHandler<PointerReleasedEventArgs> PointerReleased;

         /// <summary>
-        /// Occurs when the mouse wheen is scrolled over the control.
+        /// Occurs when the mouse wheel is scrolled over the control.
         /// </summary>
         event EventHandler<PointerWheelEventArgs> PointerWheelChanged;


#98 Always bind before setting content

#98 Always bind before setting content

--- src/Caliburn.Micro.Platform/View.cs
+++ src/Caliburn.Micro.Platform/View.cs
@@ -303,10 +303,7 @@
                 var context = GetContext(targetLocation);

                 var view = ViewLocator.LocateForModel(args.NewValue, targetLocation, context);
-                // Trialing binding before setting content in Xamarin Forms
-#if XFORMS
                 ViewModelBinder.Bind(args.NewValue, view, context);
-#endif
                 if (!SetContentProperty(targetLocation, view)) {

                     Log.Warn("SetContentProperty failed for ViewLocator.LocateForModel, falling back to LocateForModelType");
@@ -315,9 +312,6 @@

                     SetContentProperty(targetLocation, view);
                 }
-#if !XFORMS
-                ViewModelBinder.Bind(args.NewValue, view, context);
-#endif
             }
             else {
                 SetContentProperty(targetLocation, args.NewValue);


Add missing time types

Add missing time types

--- src/ConnectSdk/Querying/TimeType.cs
+++ src/ConnectSdk/Querying/TimeType.cs
@@ -6,6 +6,8 @@
         Hours,
         Days,
         Weeks,
+        Months,
+        Quarters,
         Years,
     }
 }


chore(ver): bump Core to v1.3.1 for release

--- src/Core/Properties/AssemblyInfo.cs
+++ src/Core/Properties/AssemblyInfo.cs
@@ -32,4 +32,4 @@
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.3.0.0")]
-[assembly: AssemblyFileVersion("1.3.0.0")]
+[assembly: AssemblyFileVersion("1.3.1.0")]


Make the Column Storage handling more robust

If no separate Storage is specified, directly set the Column
member, even if it is a writable property instead of a field.

git-svn-id: 1800f71f313d917366f95485fa960eed04b40598@1223 33146b6e-df29-0410-a1ca-39be37fb9416

--- src/DbLinq/Data/Linq/DataContext.cs
+++ src/DbLinq/Data/Linq/DataContext.cs
@@ -704,14 +704,27 @@
 					//it would be interesting surround the above query with a .Take(1) expression for performance.
 				}

-
-				FieldInfo entityRefField = (FieldInfo)memberData.StorageMember;
+				// If no separate Storage is specified, use the member directly
+				MemberInfo storage = memberData.StorageMember;
+				if (storage == null)
+					storage = memberData.Member;
+
+				 // Check that the storage is a field or a writable property
+				if (!(storage is FieldInfo) && !(storage is PropertyInfo && ((PropertyInfo)storage).CanWrite)) {
+					throw new InvalidOperationException(String.Format(
+						"Member {0}.{1} is not a field nor a writable property",
+						storage.DeclaringType, storage.Name));
+				}
+
+				Type storageType = storage.GetMemberType();
+
 				object entityRefValue = null;
 				if (query != null)
-					entityRefValue = Activator.CreateInstance(entityRefField.FieldType, query);
+					entityRefValue = Activator.CreateInstance(storageType, query);
 				else
-					entityRefValue = Activator.CreateInstance(entityRefField.FieldType);
-				entityRefField.SetValue(entity, entityRefValue);
+					entityRefValue = Activator.CreateInstance(storageType);
+
+				storage.SetMemberValue(entity, entityRefValue);
 			}
 		}


Fix demo by uncommenting line accidentally left commented

--- src/Demo/DemoDistributor/Program.cs
+++ src/Demo/DemoDistributor/Program.cs
@@ -11,7 +11,7 @@
         {
             //Configure the distributor
             var distributor = new Distributor<File, Vendor>();
-            //distributor.RegisterEndpointRepository(new FileSystemEndpointRepository());
+            distributor.RegisterEndpointRepository(new FileSystemEndpointRepository());
             distributor.RegisterEndpointRepository(new SharepointEndpointRepository());
             distributor.RegisterEndpointDeliveryService(new FileSystemDeliveryService());
             distributor.RegisterEndpointDeliveryService(new SharepointDeliveryService());


Update ViewModels.cs

Update ViewModels.cs

--- src/Draw2D/ViewModels/ViewModels.cs
+++ src/Draw2D/ViewModels/ViewModels.cs
@@ -3766,7 +3766,7 @@
             };
         }

-        public void DrawLine(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
+        internal void DrawLine(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
         {
             _line.Style = _strokeStyle;
             _line.StartPoint.X = a.X;
@@ -3776,7 +3776,17 @@
             _line.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void FillEllipse(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
+        internal void DrawLine(object dc, IShapeRenderer renderer, double ax, double ay, double bx, double by, double dx, double dy, DrawMode mode)
+        {
+            _line.Style = _strokeStyle;
+            _line.StartPoint.X = ax;
+            _line.StartPoint.Y = ay;
+            _line.Point.X = bx;
+            _line.Point.Y = by;
+            _line.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void FillEllipse(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
         {
             _ellipse.Style = _fillStyle;
             _ellipse.TopLeft.X = s.X - radius;
@@ -3786,7 +3796,17 @@
             _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void DrawEllipse(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
+        internal void FillEllipse(object dc, IShapeRenderer renderer, double sx, double sy, double radius, double dx, double dy, DrawMode mode)
+        {
+            _ellipse.Style = _fillStyle;
+            _ellipse.TopLeft.X = sx - radius;
+            _ellipse.TopLeft.Y = sy - radius;
+            _ellipse.BottomRight.X = sx + radius;
+            _ellipse.BottomRight.Y = sy + radius;
+            _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void DrawEllipse(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
         {
             _ellipse.Style = _strokeStyle;
             _ellipse.TopLeft.X = s.X - radius;
@@ -3796,7 +3816,17 @@
             _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void FillEllipse(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
+        internal void DrawEllipse(object dc, IShapeRenderer renderer, double sx, double sy, double radius, double dx, double dy, DrawMode mode)
+        {
+            _ellipse.Style = _strokeStyle;
+            _ellipse.TopLeft.X = sx - radius;
+            _ellipse.TopLeft.Y = sy - radius;
+            _ellipse.BottomRight.X = sx+ radius;
+            _ellipse.BottomRight.Y = sy + radius;
+            _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void FillEllipse(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
         {
             _ellipse.Style = _fillStyle;
             _ellipse.TopLeft.X = a.X;
@@ -3806,7 +3836,17 @@
             _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void DrawEllipse(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
+        internal void FillEllipse(object dc, IShapeRenderer renderer, double ax, double ay, double bx, double by, double dx, double dy, DrawMode mode)
+        {
+            _ellipse.Style = _fillStyle;
+            _ellipse.TopLeft.X = ax;
+            _ellipse.TopLeft.Y = ay;
+            _ellipse.BottomRight.X = bx;
+            _ellipse.BottomRight.Y = by;
+            _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void DrawEllipse(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
         {
             _ellipse.Style = _strokeStyle;
             _ellipse.TopLeft.X = a.X;
@@ -3816,7 +3856,17 @@
             _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void FillRectangle(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
+        internal void DrawEllipse(object dc, IShapeRenderer renderer, double ax, double ay, double bx, double by, double dx, double dy, DrawMode mode)
+        {
+            _ellipse.Style = _strokeStyle;
+            _ellipse.TopLeft.X = ax;
+            _ellipse.TopLeft.Y = ay;
+            _ellipse.BottomRight.X = bx;
+            _ellipse.BottomRight.Y = by;
+            _ellipse.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void FillRectangle(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
         {
             _rectangle.Style = _fillStyle;
             _rectangle.TopLeft.X = s.X - radius;
@@ -3826,7 +3876,17 @@
             _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void DrawRectangle(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
+        internal void FillRectangle(object dc, IShapeRenderer renderer, double sx, double sy, double radius, double dx, double dy, DrawMode mode)
+        {
+            _rectangle.Style = _fillStyle;
+            _rectangle.TopLeft.X = sx - radius;
+            _rectangle.TopLeft.Y = sy - radius;
+            _rectangle.BottomRight.X = sx + radius;
+            _rectangle.BottomRight.Y = sy + radius;
+            _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void DrawRectangle(object dc, IShapeRenderer renderer, PointShape s, double radius, double dx, double dy, DrawMode mode)
         {
             _rectangle.Style = _strokeStyle;
             _rectangle.TopLeft.X = s.X - radius;
@@ -3836,7 +3896,17 @@
             _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void FillRectangle(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
+        internal void DrawRectangle(object dc, IShapeRenderer renderer, double sx, double sy, double radius, double dx, double dy, DrawMode mode)
+        {
+            _rectangle.Style = _strokeStyle;
+            _rectangle.TopLeft.X = sx - radius;
+            _rectangle.TopLeft.Y = sy - radius;
+            _rectangle.BottomRight.X = sx + radius;
+            _rectangle.BottomRight.Y = sy + radius;
+            _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void FillRectangle(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
         {
             _rectangle.Style = _fillStyle;
             _rectangle.TopLeft.X = a.X;
@@ -3846,7 +3916,17 @@
             _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void DrawRectangle(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
+        internal void FillRectangle(object dc, IShapeRenderer renderer, double ax, double ay, double bx, double by, double dx, double dy, DrawMode mode)
+        {
+            _rectangle.Style = _fillStyle;
+            _rectangle.TopLeft.X = ax;
+            _rectangle.TopLeft.Y = ay;
+            _rectangle.BottomRight.X = bx;
+            _rectangle.BottomRight.Y = by;
+            _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void DrawRectangle(object dc, IShapeRenderer renderer, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
         {
             _rectangle.Style = _strokeStyle;
             _rectangle.TopLeft.X = a.X;
@@ -3856,7 +3936,17 @@
             _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
         }

-        public void DrawText(object dc, IShapeRenderer renderer, string text, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
+        internal void DrawRectangle(object dc, IShapeRenderer renderer, double ax, double ay, double bx, double by, double dx, double dy, DrawMode mode)
+        {
+            _rectangle.Style = _strokeStyle;
+            _rectangle.TopLeft.X = ax;
+            _rectangle.TopLeft.Y = ay;
+            _rectangle.BottomRight.X = bx;
+            _rectangle.BottomRight.Y = by;
+            _rectangle.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void DrawText(object dc, IShapeRenderer renderer, string text, PointShape a, PointShape b, double dx, double dy, DrawMode mode)
         {
             _text.Style = _strokeStyle;
             _text.TopLeft.X = a.X;
@@ -3866,6 +3956,44 @@
             _text.Draw(dc, renderer, dx, dy, mode, null, null);
         }

+        internal void DrawText(object dc, IShapeRenderer renderer, string text, double ax, double ay, double bx, double by, double dx, double dy, DrawMode mode)
+        {
+            _text.Style = _strokeStyle;
+            _text.TopLeft.X = ax;
+            _text.TopLeft.Y = ay;
+            _text.BottomRight.X = bx;
+            _text.BottomRight.Y = by;
+            _text.Draw(dc, renderer, dx, dy, mode, null, null);
+        }
+
+        internal void GetBoxFromPoints(List<PointShape> points, out double ax, out double ay, out double bx, out double by)
+        {
+            ax = double.MaxValue;
+            ay = double.MaxValue;
+            bx = double.MinValue;
+            by = double.MinValue;
+
+            foreach (var point in points)
+            {
+                ax = Math.Min(ax, point.X);
+                ay = Math.Min(ay, point.Y);
+                bx = Math.Max(bx, point.X);
+                by = Math.Max(by, point.Y);
+            }
+        }
+
+        internal void DrawBoxFromPoints(object dc, IShapeRenderer renderer, BaseShape shape, double dx, double dy, DrawMode mode)
+        {
+            var points = new List<PointShape>();
+            shape.GetPoints(points);
+
+            if (points.Count >= 2)
+            {
+                GetBoxFromPoints(points, out double ax, out double ay, out double bx, out double by);
+                DrawRectangle(dc, renderer, ax, ay, bx, by, dx, dy, mode);
+            }
+        }
+
         public abstract void Draw(object dc, BaseShape shape, IShapeRenderer renderer, ISelectionState selectionState, double dx, double dy, DrawMode mode);
     }

@@ -3925,16 +4053,19 @@
     [DataContract(IsReference = true)]
     public class GroupDecorator : CommonDecorator
     {
-        public void Draw(object dc, IShapeRenderer renderer, GroupShape group, double dx, double dy, DrawMode mode)
-        {
-            // TODO: Draw group shape decorator.
+        public void Draw(object dc, IShapeRenderer renderer, GroupShape group, ISelectionState selectionState, double dx, double dy, DrawMode mode)
+        {
+            if (selectionState.IsSelected(group))
+            {
+                DrawBoxFromPoints(dc, renderer, group, dx, dy, mode);
+            }
         }

         public override void Draw(object dc, BaseShape shape, IShapeRenderer renderer, ISelectionState selectionState, double dx, double dy, DrawMode mode)
         {
             if (shape is GroupShape group)
             {
-                Draw(dc, renderer, group, dx, dy, mode);
+                Draw(dc, renderer, group, selectionState, dx, dy, mode);
             }
         }
     }
@@ -3989,6 +4120,11 @@

         public void DrawFigure(object dc, IShapeRenderer renderer, FigureShape figure, ISelectionState selectionState, double dx, double dy, DrawMode mode)
         {
+            if (selectionState.IsSelected(figure))
+            {
+                DrawBoxFromPoints(dc, renderer, figure, dx, dy, mode);
+            }
+
             foreach (var shape in figure.Shapes)
             {
                 DrawShape(dc, renderer, shape, selectionState, dx, dy, mode);
@@ -4016,6 +4152,11 @@

         public void Draw(object dc, IShapeRenderer renderer, PathShape path, ISelectionState selectionState, double dx, double dy, DrawMode mode)
         {
+            if (selectionState.IsSelected(path))
+            {
+                DrawBoxFromPoints(dc, renderer, path, dx, dy, mode);
+            }
+
             foreach (var figure in path.Figures)
             {
                 _figureDecorator.Draw(dc, figure, renderer, selectionState, dx, dy, mode);


Conventional field name

Conventional field name

--- src/Elmah/ConnectionStringHelper.cs
+++ src/Elmah/ConnectionStringHelper.cs
@@ -174,7 +174,7 @@
             return ResolveDataSourceFilePath(dataSource);
         }

-        static readonly char[] _dirSeparators = { Path.DirectorySeparatorChar };
+        static readonly char[] DirSeparators = { Path.DirectorySeparatorChar };

         static string ResolveDataSourceFilePath(string path)
         {
@@ -215,9 +215,9 @@
             // trailing backslashes into account to avoid duplication.
             //

-            return baseDirectory.TrimEnd(_dirSeparators)
+            return baseDirectory.TrimEnd(DirSeparators)
                  + Path.DirectorySeparatorChar
-                 + path.Substring(dataDirectoryMacroString.Length).TrimStart(_dirSeparators);
+                 + path.Substring(dataDirectoryMacroString.Length).TrimStart(DirSeparators);
         }
     }
 }


Fix regression when reading output in non-ascii locales

--- src/GitHub.Api/Tasks/ProcessTask.cs
+++ src/GitHub.Api/Tasks/ProcessTask.cs
@@ -106,7 +106,7 @@
                     gotOutput.Set();
                     if (e.Data != null)
                     {
-                        var line = Encoding.UTF8.GetString(Encoding.Default.GetBytes(e.Data));
+                        var line = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(e.Data));
                         errors.Add(line.TrimEnd('\r', '\n'));
                         Logger.Trace(line);
                     }
@@ -121,7 +121,7 @@
                     gotOutput.Set();
                     if (e.Data != null)
                     {
-                        var line = Encoding.UTF8.GetString(Encoding.Default.GetBytes(e.Data));
+                        var line = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(e.Data));
                         outputProcessor.LineReceived(line.TrimEnd('\r','\n'));
                     }
                     else


Exception in callback assigns error to response result.

--- src/GriklyApi.Portable/GriklyApi.cs
+++ src/GriklyApi.Portable/GriklyApi.cs
@@ -190,14 +190,29 @@
             Execute(request, path, result =>
                                        {
                                            IHttpResponse<T> res = new HttpResponse<T>(result);
-                                           //if error, there will be nothing to deserialize
-                                           if (!result.IsError)
+                                           try
                                            {
-                                               //deserialize
-                                               string data = Encoding.UTF8.GetString(result.RawBytes, 0,
-                                                                                result.RawBytes.Length);
-                                               var objData = JsonConvert.DeserializeObject<T>(data);
-                                               res.Data = objData;
+                                               //if error, there will be nothing to deserialize
+                                               if (!result.IsError)
+                                               {
+                                                   //deserialize
+                                                   string data = Encoding.UTF8.GetString(result.RawBytes, 0,
+                                                                                result.RawBytes.Length);
+                                                   var objData = JsonConvert.DeserializeObject<T>(data);
+                                                   res.Data = objData;
+
+                                               }
+                                           }
+                                           catch (Exception ex)
+                                           {
+                                               res.IsError = true;
+                                               res.Error = new ErrorResponse
+                                                               {
+                                                                   Message = new ErrorMessage
+                                                                                {
+                                                                                Message = ex.Message
+                                                                                }
+                                                               };
                                            }
                                            callback(res);
                                        });


unused namespace

unused namespace

Former-commit-id: 30a0e56b4aa70c1052a719aa3ae0f6856bcd0772

--- src/MassTransit/ServiceContainer.cs
+++ src/MassTransit/ServiceContainer.cs
@@ -15,7 +15,6 @@
 	using System;
 	using System.Collections.Generic;
 	using System.Linq;
-	using Diagnostics;
 	using Diagnostics.Introspection;
 	using Logging;
 	using Util;


[REF] RabbitMQ consumer only used in Consume method

--- src/MerQure.RMQ/Clients/Consumer.cs
+++ src/MerQure.RMQ/Clients/Consumer.cs
@@ -9,8 +9,6 @@
 {
     class Consumer : RabbitMQClient, IConsumer
     {
-        private EventingBasicConsumer consumer;
-
         public string QueueName { get; }

         public Consumer(IModel channel, string queueName)
@@ -23,7 +21,7 @@
         {
             this.Channel.BasicQos(0, 1, false);

-            consumer = new EventingBasicConsumer(Channel);
+            var consumer = new EventingBasicConsumer(Channel);
             consumer.Received += ((object sender, BasicDeliverEventArgs args) =>
             {
                 if (onMessageReceived != null)


Decoding firefox Login info with utf8 encoding

Firefox use UTF8 for login info storage. Since utf8 can decode ASCII characters(without extended codes) properly, the decoding method was changed to UTF8 for compatibility.

--- Firefox.cs
+++ Firefox.cs
@@ -294,7 +294,9 @@

 				try
 				{
-					result = Marshal.PtrToStringAnsi(reply.Data, reply.Length);
+					byte[] tmp = new byte[reply.Length];
+					Marshal.Copy(reply.Data, tmp, 0, reply.Length);
+					result = System.Text.Encoding.UTF8.GetString(tmp);
 				}
 				finally
 				{


Added debug-mode prefix

Added debug-mode prefix

--- src/NinjaCatDiscordBot/Constants.cs
+++ src/NinjaCatDiscordBot/Constants.cs
@@ -41,7 +41,11 @@
         public const ulong OwnerId = 191330317439598593;
         public const ulong BotsGuildId = 110373943822540800;

+#if DEBUG
         public const string CommandPrefix = "$njd-";
+#else
+        public const string CommandPrefix = "$nj-";
+#endif

         public const string AboutCommand = "about";
         public const string AboutCommandDesc = "get to know me";
@@ -99,6 +103,6 @@
             $"I was activated by <@191330317439598593> with the purpose of letting you know about the latest in Windows Insider builds, but I can do other things too.\n\n" +
             $"Your wish is my command, so type **{CommandPrefix}{HelpCommand}** for info on what I can do for you.";

-        #endregion
+#endregion
     }
 }


added upward list movement

added upward list movement

--- configurator/MegaMolConf/Form1.cs
+++ configurator/MegaMolConf/Form1.cs
@@ -434,10 +434,16 @@
                 case (Keys.Control | Keys.W):
                     CloseProjectTab(tabViews.SelectedTab);
                     break;
-                case (Keys.Control | Keys.Down):    // skip next 4 items
+                case (Keys.Control | Keys.Down):    // skip next 4 items downwards
                     try {
                         lbModules.SelectedIndex += 4;
                     } catch {}
+                    break;
+                case (Keys.Control | Keys.Up):    // skip next 4 items upwards
+                    try {
+                        lbModules.SelectedIndex -= 4;
+                    }
+                    catch { }
                     break;
             }
             return base.ProcessCmdKey(ref msg, keyData);


[Elb] Seal Tag

[Elb] Seal Tag

--- src/Amazon.Elb/Models/Tag.cs
+++ src/Amazon.Elb/Models/Tag.cs
@@ -2,7 +2,7 @@

 namespace Amazon.Elb
 {
-    public class Tag
+    public sealed class Tag
     {
         public Tag() { }


Mapping is now a class.

Mapping is now a class.

svn path=/trunk/Mono.Nat/; revision=77880

--- Mapping.cs
+++ Mapping.cs
@@ -30,35 +30,49 @@

 namespace Nat
 {
-    public struct Mapping
+    public class Mapping
     {
+        #region Private Fields
+
+        private int port;
+        private Protocol protocol;
+
+        #endregion Private Fields
+
+
+        #region Properties
+
         public int Port
         {
             get { return this.port; }
         }
-        private int port;
-

         public Protocol Protocol
         {
             get { return this.protocol; }
         }
-        private Protocol protocol;

+        #endregion Properties
+
+
+        #region Constructors

         public Mapping(int port, Protocol protocol)
         {
             this.port = port;
             this.protocol = protocol;
         }
-
+
+        #endregion Constructors
+
+
+        #region Methods
+
         public override bool Equals(object obj)
         {
-            if (!(obj is Mapping))
-                return false;
-
-            Mapping instance = (Mapping)obj;
-            return this.port == instance.port && this.protocol == instance.protocol;
+            Mapping other = obj as Mapping;
+            return other == null ? false : this.port == other.port
+                                        && this.protocol == other.protocol;
         }

         public override int GetHashCode()
@@ -66,14 +80,6 @@
             return this.port.GetHashCode() ^ this.protocol.GetHashCode();
         }

-        public static bool operator ==(Mapping instanceA, Mapping instanceB)
-        {
-            return instanceA.Equals(instanceB);
-        }
-
-        public static bool operator !=(Mapping instanceA, Mapping instanceB)
-        {
-          return !instanceA.Equals(instanceB);
-        }
+        #endregion Methods
     }
 }


Fix unintended assertions.

Fix unintended assertions.

--- open3mod/HierarchyInspectionView.cs
+++ open3mod/HierarchyInspectionView.cs
@@ -822,7 +822,7 @@
             var treeView = (TreeView)cms.SourceControl;

             var node = _tree.GetNodeAt(treeView.PointToClient(cms.Location));
-            Debug.Assert(node != null);
+            // Debug.Assert(node != null); // for whatever reason, this can happen
             return node;
         }

@@ -830,6 +830,10 @@
         private void OnContextMenuShowDetails(object sender, EventArgs e)
         {
             var node = GetTreeNodeForContextMenuEvent(sender);
+            if (node == null) // for whatever reason, this can happen
+            {
+                return;
+            }
             ShowDetailsForTreeNode(node);
         }

@@ -837,6 +841,10 @@
         private void OnContextMenuHideNode(object sender, EventArgs e)
         {
             var node = GetTreeNodeForContextMenuEvent(sender);
+            if (node == null) // for whatever reason, this can happen
+            {
+                return;
+            }
             if (IsNodePermanentlyHidden((Node)node.Tag))
             {
                 UnhideSubhierarchy(node);
@@ -851,6 +859,11 @@
         private void OnContextMenuPivotNode(object sender, EventArgs e)
         {
             var node = GetTreeNodeForContextMenuEvent(sender);
+            if (node == null) // for whatever reason, this can happen
+            {
+                return;
+            }
+
             var assimpNode = (Node) node.Tag;

             _scene.SetPivot(assimpNode);
@@ -969,6 +982,10 @@
         {
             var cm = (ContextMenuStrip) sender;
             var root = GetTreeNodeForContextMenuEvent(sender);
+            if(root == null) // for whatever reason, this can happen
+            {
+                return;
+            }
             var node = root.Tag as Node;
             Debug.Assert(node != null);


Remove IRequireHighFrequency from InputManager

Turns out it is not necessary

--- osu.Framework/Input/InputManager.cs
+++ osu.Framework/Input/InputManager.cs
@@ -16,7 +16,7 @@

 namespace osu.Framework.Input
 {
-    public abstract class InputManager : Container, IRequireHighFrequencyMousePosition
+    public abstract class InputManager : Container
     {
         /// <summary>
         /// The initial delay before key repeat begins.


Always yield the new state when creating distinct states

For cases where a custom InputState is being used, there was a chance it was getting lost during distinct state creation. This ensures at the end of creating distinct states we still return the new (original) state.

--- osu.Framework/Input/InputManager.cs
+++ osu.Framework/Input/InputManager.cs
@@ -842,21 +842,14 @@

             foreach (var incoming in states)
             {
-                if (incoming.Mouse == null && incoming.Keyboard == null && incoming.Joystick == null)
-                {
-                    // we still want to return at least one state change.
-                    yield return incoming;
-                }
-
                 if (incoming.Mouse != null)
                 {
-                    // necessary for high precision input (we always want to add at least one state)
-                    // this also cleans out any remnant delta values
-                    yield return createDistinctState(s =>
-                    {
-                        s.Mouse = (s.Mouse as MouseState)?.CloneWithoutDeltas() ?? new MouseState();
-                        s.Mouse.Position = incoming.Mouse.Position;
-                    });
+                    if (lastMouse.Position != incoming.Mouse.Position)
+                        yield return createDistinctState(s =>
+                        {
+                            s.Mouse = (s.Mouse as MouseState)?.CloneWithoutDeltas() ?? new MouseState();
+                            s.Mouse.Position = incoming.Mouse.Position;
+                        });

                     if (lastMouse.Wheel != incoming.Mouse.Wheel)
                         yield return createDistinctState(s =>
@@ -912,6 +905,8 @@
                             Buttons = s.Joystick.Buttons.Union(new[] { pressedButton }).ToArray()
                         });
                 }
+
+                yield return incoming;
             }
         }
     }


Reorganise methods in `PollingComponent`

--- osu.Game/Online/PollingComponent.cs
+++ osu.Game/Online/PollingComponent.cs
@@ -47,39 +47,13 @@
             pollIfNecessary();
         }

-        private bool pollIfNecessary()
+        /// <summary>
+        /// Immediately performs a <see cref="Poll"/>.
+        /// </summary>
+        public void PollImmediately()
         {
-            // we must be loaded so we have access to clock.
-            if (!IsLoaded) return false;
-
-            // there's already a poll process running.
-            if (pollingActive) return false;
-
-            // don't try polling if the time between polls hasn't been set.
-            if (TimeBetweenPolls.Value == 0) return false;
-
-            if (!lastTimePolled.HasValue)
-            {
-                doPoll();
-                return true;
-            }
-
-            if (Time.Current - lastTimePolled.Value > TimeBetweenPolls.Value)
-            {
-                doPoll();
-                return true;
-            }
-
-            // not enough time has passed since the last poll. we do want to schedule a poll to happen, though.
+            lastTimePolled = Time.Current - TimeBetweenPolls.Value;
             scheduleNextPoll();
-            return false;
-        }
-
-        private void doPoll()
-        {
-            scheduledPoll = null;
-            pollingActive = true;
-            Poll().ContinueWith(_ => pollComplete());
         }

         /// <summary>
@@ -90,13 +64,11 @@
             return Task.CompletedTask;
         }

-        /// <summary>
-        /// Immediately performs a <see cref="Poll"/>.
-        /// </summary>
-        public void PollImmediately()
+        private void doPoll()
         {
-            lastTimePolled = Time.Current - TimeBetweenPolls.Value;
-            scheduleNextPoll();
+            scheduledPoll = null;
+            pollingActive = true;
+            Poll().ContinueWith(_ => pollComplete());
         }

         /// <summary>
@@ -111,6 +83,33 @@
                 pollIfNecessary();
         }

+        private void pollIfNecessary()
+        {
+            // we must be loaded so we have access to clock.
+            if (!IsLoaded) return;
+
+            // there's already a poll process running.
+            if (pollingActive) return;
+
+            // don't try polling if the time between polls hasn't been set.
+            if (TimeBetweenPolls.Value == 0) return;
+
+            if (!lastTimePolled.HasValue)
+            {
+                doPoll();
+                return;
+            }
+
+            if (Time.Current - lastTimePolled.Value > TimeBetweenPolls.Value)
+            {
+                doPoll();
+                return;
+            }
+
+            // not enough time has passed since the last poll. we do want to schedule a poll to happen, though.
+            scheduleNextPoll();
+        }
+
         private void scheduleNextPoll()
         {
             scheduledPoll?.Cancel();


Hide top-right HUD overlay elements as part of HUD visibility

--- osu.Game/Screens/Play/HUDOverlay.cs
+++ osu.Game/Screens/Play/HUDOverlay.cs
@@ -74,7 +74,7 @@

         private bool holdingForHUD;

-        private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
+        private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter, topRightElements };

         public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
         {


added a refernce to the msdn page where the function was taken from


Fixed typos

Fixed typos

--- src/Common/ExceptionUtils.cs
+++ src/Common/ExceptionUtils.cs
@@ -183,9 +183,9 @@
         }

         /// <summary>
-        /// Executes a delegate and automatically retries it using exponential backoff if a specifc type of exception was raised.
-        /// </summary>
-        /// <typeparam name="TException">The type of exception to triger a retry.</typeparam>
+        /// Executes a delegate and automatically retries it using exponential backoff if a specific type of exception was raised.
+        /// </summary>
+        /// <typeparam name="TException">The type of exception to trigger a retry.</typeparam>
         /// <param name="action">The action to execute.</param>
         /// <param name="maxRetries">The maximum number of retries to attempt.</param>
         [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Generic exception catch only used to ensure safe random seeding.")]


Mac background browse button fix

Mac background browse button fix

Changing NSTextField.StringValue programmatically doesn't fire the
Changed handler!  Apparently this is the only place we rely on it.

--- mac-gui/MainWindowController.cs
+++ mac-gui/MainWindowController.cs
@@ -319,7 +319,10 @@
       partial void backgroundBrowseClicked(NSObject sender)
       {
          var relative = c.BrowseBackground();
-         if (relative != null) BackgroundBox.StringValue = relative;
+         if (relative == null) return;
+
+         BackgroundBox.StringValue = relative;
+         c.BackgroundChanged(relative);
       }
    }
 }


comment

comment

--- src/ConvNetSharp.Flow/Net.cs
+++ src/ConvNetSharp.Flow/Net.cs
@@ -35,6 +35,12 @@
             throw new NotImplementedException();
         }

+        /// <summary>
+        /// Creates a dictionary containing input and evaluates the output Op
+        /// </summary>
+        /// <param name="input">input</param>
+        /// <param name="isTraining">isTraining has no use here.</param>
+        /// <returns></returns>
         public Volume<T> Forward(Volume<T> input, bool isTraining = false)
         {
             this._dico["input"] = input;


Remove useless comparison

Remove useless comparison

--- src/DotNet/MD/ENCMetaData.cs
+++ src/DotNet/MD/ENCMetaData.cs
@@ -469,7 +469,7 @@
 					break;	// Never happens since rid is valid
 				if (key == key2)
 					return rid;
-				if (key2 > key && key2 != 0)
+				if (key2 > key)
 					ridHi = rid - 1;
 				else
 					ridLo = rid + 1;


Simplify display of command line argument help text.

--- src/Fixie.Console/Program.cs
+++ src/Fixie.Console/Program.cs
@@ -1,9 +1,9 @@
 namespace Fixie.Console
 {
     using System;
-    using System.Text;
     using Cli;
     using Execution;
+    using static System.Console;

     class Program
     {
@@ -23,41 +23,42 @@
             catch (CommandLineException exception)
             {
                 using (Foreground.Red)
-                    Console.WriteLine(exception.Message);
+                    WriteLine(exception.Message);

-                Console.WriteLine();
-                Console.WriteLine(Usage());
+                Help();
+
                 return FatalError;
             }
             catch (Exception exception)
             {
                 using (Foreground.Red)
-                    Console.WriteLine($"Fatal Error: {exception}");
+                    WriteLine($"Fatal Error: {exception}");
+
                 return FatalError;
             }
         }

-        static string Usage()
+        static void Help()
         {
-            return new StringBuilder()
-                .AppendLine("Usage: Fixie.Console.exe assembly-path [--report path] [--team-city <on|off>] [convention arguments]...")
-                .AppendLine()
-                .AppendLine()
-                .AppendLine("    assembly-path")
-                .AppendLine("        A path indicating the test assembly file. Exactly one test")
-                .AppendLine("        assembly must be specified.")
-                .AppendLine()
-                .AppendLine("    --report path")
-                .AppendLine("        Write test results to the specified path, using the xUnit XML format.")
-                .AppendLine()
-                .AppendLine("    --team-city <on|off>")
-                .AppendLine("        When this option is omitted, the runner detects the need for")
-                .AppendLine("        TeamCity-formatted console output. Use this option to force")
-                .AppendLine("        TeamCity output on or off.")
-                .AppendLine()
-                .AppendLine("    convention arguments")
-                .AppendLine("        Arbitrary arguments made available to conventions at runtime.")
-                .ToString();
+            WriteLine();
+            WriteLine("Usage: Fixie.Console.exe assembly-path [--report path] [--team-city <on|off>] [convention arguments]...");
+            WriteLine();
+            WriteLine();
+            WriteLine("    assembly-path");
+            WriteLine("        A path indicating the test assembly file. Exactly one test");
+            WriteLine("        assembly must be specified.");
+            WriteLine();
+            WriteLine("    --report path");
+            WriteLine("        Write test results to the specified path, using the xUnit XML format.");
+            WriteLine();
+            WriteLine("    --team-city <on|off>");
+            WriteLine("        When this option is omitted, the runner detects the need for");
+            WriteLine("        TeamCity-formatted console output. Use this option to force");
+            WriteLine("        TeamCity output on or off.");
+            WriteLine();
+            WriteLine("    convention arguments");
+            WriteLine("        Arbitrary arguments made available to conventions at runtime.");
+            WriteLine();
         }
     }
 }


Fix path combine.

Fix path combine.

--- src/HtmlGenerator/Program.cs
+++ src/HtmlGenerator/Program.cs
@@ -359,8 +359,8 @@

         private static void StampOverviewHtmlWithDate(string destinationFolder)
         {
-            var source = Path.Combine(destinationFolder, "wwwroot/overview.html");
-            var dst = Path.Combine(destinationFolder, "index/overview.html");
+            var source = Path.Combine(destinationFolder, "wwwroot", "overview.html");
+            var dst = Path.Combine(destinationFolder, "index", "overview.html");
             if (File.Exists(source))
             {
                 var text = File.ReadAllText(source);


Mapper.DynamicMap retired

Mapper.DynamicMap retired

--- src/Kirkin/Mapping/Mapper.cs
+++ src/Kirkin/Mapping/Mapper.cs
@@ -62,32 +62,6 @@
             }

             return new Mapper<T, T>(config.ProduceValidMemberMappings());
-        }
-
-        #endregion
-
-        #region Dynamic mapping proxies
-
-        /// <summary>
-        /// Creates a new target instance, executes mapping from
-        /// source to target and returns the newly created target instance.
-        /// Uses the default cached <see cref="IMapper{TSource, TTarget}"/> instance.
-        /// </summary>
-        [Obsolete("Use MapStrict.")]
-        public static TTarget DynamicMap<TSource, TTarget>(TSource source)
-            where TTarget : new()
-        {
-            return MapStrict<TSource, TTarget>(source);
-        }
-
-        /// <summary>
-        /// Executes mapping from source to target and returns the target instance.
-        /// Uses the default cached <see cref="IMapper{TSource, TTarget}"/> instance.
-        /// </summary>
-        [Obsolete("Use MapStrict.")]
-        public static TTarget DynamicMap<TSource, TTarget>(TSource source, TTarget target)
-        {
-            return MapStrict(source, target);
         }

         #endregion


Added AggressiveInlining to the Guard methods.

--- src/LineBot/Helpers/Guard.cs
+++ src/LineBot/Helpers/Guard.cs
@@ -15,17 +15,20 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.CompilerServices;

 namespace Line
 {
     internal sealed class Guard
     {
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotNull(string paramName, object value)
         {
             if (ReferenceEquals(value, null))
                 throw new ArgumentNullException(paramName);
         }

+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotNullOrEmpty(string paramName, string value)
         {
             NotNull(paramName, value);
@@ -34,6 +37,7 @@
                 throw new ArgumentException("Value cannot be empty.", paramName);
         }

+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotNullOrEmpty<T>(string paramName, T[] value)
         {
             NotNull(paramName, value);
@@ -42,6 +46,7 @@
                 throw new ArgumentException("Value cannot be empty.", paramName);
         }

+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void NotNullOrEmpty<T>(string paramName, IEnumerable<T> value)
         {
             NotNull(paramName, value);


close streams correctly, don't raise callbacks when no reader is set

--- src/Manos/Manos.IO/Stream.cs
+++ src/Manos/Manos.IO/Stream.cs
@@ -25,6 +25,133 @@
 			onData = null;
 			onError = null;
 			onEndOfStream = null;
+		}
+
+		protected class ReaderHandle : IDisposable
+		{
+			Stream parent;
+
+			public ReaderHandle (Stream parent)
+			{
+				this.parent = parent;
+			}
+
+			public void Dispose ()
+			{
+				if (parent.currentReader == this)
+					parent.CancelReader ();
+			}
+		}
+
+		public virtual IDisposable Read (Action<ByteBuffer> onData, Action<Exception> onError, Action onEndOfStream)
+		{
+			if (onData == null)
+				throw new ArgumentNullException ("onData");
+			if (onError == null)
+				throw new ArgumentNullException ("onError");
+			if (onEndOfStream == null)
+				throw new ArgumentNullException ("onClose");
+
+			this.onData = onData;
+			this.onError = onError;
+			this.onEndOfStream = onEndOfStream;
+
+			currentReader = new ReaderHandle (this);
+
+			return currentReader;
+		}
+
+		public virtual void Write (IEnumerable<ByteBuffer> data)
+		{
+			if (data == null)
+				throw new ArgumentNullException ("data");
+
+			if (writeQueue == null) {
+				writeQueue = new Queue<IEnumerable<ByteBuffer>> ();
+			}
+
+			writeQueue.Enqueue (data);
+		}
+
+		static IEnumerable<ByteBuffer> SingleBuffer (ByteBuffer buffer)
+		{
+			yield return buffer;
+		}
+
+		public virtual void Write (ByteBuffer data)
+		{
+			Write (SingleBuffer (data));
+		}
+
+		public virtual void Write (byte[] data)
+		{
+			Write (new ByteBuffer (data, 0, data.Length));
+		}
+
+		~Stream ()
+		{
+			Dispose (false);
+		}
+
+		public abstract long Position {
+			get;
+			set;
+		}
+
+		public abstract bool CanRead {
+			get;
+		}
+
+		public abstract bool CanWrite {
+			get;
+		}
+
+		public virtual bool CanSeek {
+			get { return false; }
+		}
+
+		public virtual bool CanTimeout {
+			get { return false; }
+		}
+
+		public virtual TimeSpan ReadTimeout {
+			get { throw new NotSupportedException (); }
+			set { throw new NotSupportedException (); }
+		}
+
+		public virtual TimeSpan WriteTimeout {
+			get { throw new NotSupportedException (); }
+			set { throw new NotSupportedException (); }
+		}
+
+		public abstract void ResumeReading ();
+
+		public abstract void ResumeReading (long forBytes);
+
+		public abstract void ResumeWriting ();
+
+		public abstract void PauseReading ();
+
+		public abstract void PauseWriting ();
+
+		public virtual void SeekBy (long delta)
+		{
+			throw new NotSupportedException ();
+		}
+
+		public virtual void SeekTo (long position)
+		{
+			throw new NotSupportedException ();
+		}
+
+		public abstract void Flush ();
+
+		public virtual void Close ()
+		{
+			if (currentReader != null) {
+				currentReader.Dispose ();
+				currentReader = null;
+			}
 			if (writeQueue != null) {
 				if (currentWriter != null) {
 					currentWriter.Dispose ();
@@ -35,132 +162,6 @@
 				writeQueue = null;
 			}
 		}
-
-		protected class ReaderHandle : IDisposable
-		{
-			Stream parent;
-
-			public ReaderHandle (Stream parent)
-			{
-				this.parent = parent;
-			}
-
-			public void Dispose ()
-			{
-				if (parent.currentReader == this)
-					parent.CancelReader ();
-			}
-		}
-
-		public virtual IDisposable Read (Action<ByteBuffer> onData, Action<Exception> onError, Action onEndOfStream)
-		{
-			if (onData == null)
-				throw new ArgumentNullException ("onData");
-			if (onError == null)
-				throw new ArgumentNullException ("onError");
-			if (onEndOfStream == null)
-				throw new ArgumentNullException ("onClose");
-
-			this.onData = onData;
-			this.onError = onError;
-			this.onEndOfStream = onEndOfStream;
-
-			currentReader = new ReaderHandle (this);
-
-			return currentReader;
-		}
-
-		public virtual void Write (IEnumerable<ByteBuffer> data)
-		{
-			if (data == null)
-				throw new ArgumentNullException ("data");
-
-			if (writeQueue == null) {
-				writeQueue = new Queue<IEnumerable<ByteBuffer>> ();
-			}
-
-			writeQueue.Enqueue (data);
-		}
-
-		static IEnumerable<ByteBuffer> SingleBuffer (ByteBuffer buffer)
-		{
-			yield return buffer;
-		}
-
-		public virtual void Write (ByteBuffer data)
-		{
-			Write (SingleBuffer (data));
-		}
-
-		public virtual void Write (byte[] data)
-		{
-			Write (new ByteBuffer (data, 0, data.Length));
-		}
-
-		~Stream ()
-		{
-			Dispose (false);
-		}
-
-		public abstract long Position {
-			get;
-			set;
-		}
-
-		public abstract bool CanRead {
-			get;
-		}
-
-		public abstract bool CanWrite {
-			get;
-		}
-
-		public virtual bool CanSeek {
-			get { return false; }
-		}
-
-		public virtual bool CanTimeout {
-			get { return false; }
-		}
-
-		public virtual TimeSpan ReadTimeout {
-			get { throw new NotSupportedException (); }
-			set { throw new NotSupportedException (); }
-		}
-
-		public virtual TimeSpan WriteTimeout {
-			get { throw new NotSupportedException (); }
-			set { throw new NotSupportedException (); }
-		}
-
-		public abstract void ResumeReading ();
-
-		public abstract void ResumeReading (long forBytes);
-
-		public abstract void ResumeWriting ();
-
-		public abstract void PauseReading ();
-
-		public abstract void PauseWriting ();
-
-		public virtual void SeekBy (long delta)
-		{
-			throw new NotSupportedException ();
-		}
-
-		public virtual void SeekTo (long position)
-		{
-			throw new NotSupportedException ();
-		}
-
-		public abstract void Flush ();
-
-		public virtual void Close ()
-		{
-			onData = null;
-			onError = null;
-			onEndOfStream = null;
-		}

 		public void Dispose ()
 		{
@@ -175,17 +176,23 @@

 		protected virtual void RaiseData (ByteBuffer data)
 		{
-			onData (data);
+			if (onData != null) {
+				onData (data);
+			}
 		}

 		protected virtual void RaiseError (Exception exception)
 		{
-			onError (exception);
+			if (onError != null) {
+				onError (exception);
+			}
 		}

 		protected virtual void RaiseEndOfStream ()
 		{
-			onEndOfStream ();
+			if (onEndOfStream != null) {
+				onEndOfStream ();
+			}
 		}

 		protected abstract int WriteSingleBuffer (ByteBuffer buffer);


Added emf

Added emf

--- src/MimeTypes/MimeTypeMap.cs
+++ src/MimeTypes/MimeTypeMap.cs
@@ -158,6 +158,7 @@
                 {".dxf", "application/x-dxf" },
                 {".dxr", "application/x-director"},
                 {".eml", "message/rfc822"},
+                {".emf", "image/x-emf"},
                 {".emz", "application/octet-stream"},
                 {".eot", "application/vnd.ms-fontobject"},
                 {".eps", "application/postscript"},


*** empty log message ***

*** empty log message ***

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@22

--- src/NHibernate/Type/IType.cs
+++ src/NHibernate/Type/IType.cs
@@ -24,13 +24,13 @@
 		/// This does not necessarily imply that the type actually represents an association.
 		/// </summary>
 		/// <returns></returns>
-		public bool IsAssociationType();
+		public bool IsAssociationType { get; }

 		/// <summary>
 		/// Is this type a collection type?
 		/// </summary>
 		/// <returns></returns>
-		public bool IsPersistentCollectionType();
+		public bool IsPersistentCollectionType { get; }

 		/// <summary>
 		/// Is this type a component type?
@@ -38,13 +38,13 @@
 		/// A component type may own collections or associations and hence must provide certain extra functionality.
 		/// </summary>
 		/// <returns></returns>
-		public bool IsComponentType();
+		public bool IsComponentType	{ get; }

 		/// <summary>
 		/// Is this type an entity type?
 		/// </summary>
 		/// <returns></returns>
-		public bool IsEntityType();
+		public bool IsEntityType { get; }

 		/// <summary>
 		/// Is this an "object" type,
@@ -52,7 +52,7 @@
 		/// </summary>
 		/// <returns></returns>
 		/// <exception cref="MappingException">MappingException</exception>
-		public boolean IsObjectType();
+		public boolean IsObjectType { get; }

 		/// <summary>
 		/// Return the SQL typecodes for the columns mapped by this type.
@@ -166,7 +166,7 @@
 		/// Returns the abbreviated name of the type.
 		/// </summary>
 		/// <returns>the Hibernate type name</returns>
-		public string GetName();
+		public string Name { get; }

 		/// <summary>
 		/// Return a deep copy of the persistent state, stopping at entities and at collections.
@@ -181,7 +181,7 @@
 		/// entities and collections are considered immutable because they manage their own internal state.)
 		/// </summary>
 		/// <returns></returns>
-		public bool IsMutable();
+		public bool IsMutable { get; }

 		/**TODO:
 		 * Return a cacheable "disassembled" representation of the object.


Updated tinyioc

Updated tinyioc

--- src/Nancy/TinyIoc/TinyIoC.cs
+++ src/Nancy/TinyIoc/TinyIoC.cs
@@ -2035,7 +2035,7 @@
                 }
                 catch (TinyIoCResolutionException ex)
                 {
-                    throw new TinyIoCResolutionException(typeof(RegisterImplementation), ex);
+                    throw new TinyIoCResolutionException(typeof(RegisterType), ex);
                 }
             }

@@ -2834,6 +2834,10 @@
                 {
                     return factory.GetObject(this, parameters, options);
                 }
+                catch (TinyIoCResolutionException)
+                {
+                    throw;
+                }
                 catch (Exception ex)
                 {
                     throw new TinyIoCResolutionException(registration.Type, ex);
@@ -2848,6 +2852,10 @@
                 {
                     return bubbledObjectFactory.GetObject(this, parameters, options);
                 }
+                catch (TinyIoCResolutionException)
+                {
+                    throw;
+                }
                 catch (Exception ex)
                 {
                     throw new TinyIoCResolutionException(registration.Type, ex);
@@ -2866,6 +2874,10 @@
                     try
                     {
                         return factory.GetObject(this, parameters, options);
+                    }
+                    catch (TinyIoCResolutionException)
+                    {
+                        throw;
                     }
                     catch (Exception ex)
                     {
@@ -2958,25 +2970,25 @@
         {
             var genericResolveAllMethod = this.GetType().GetGenericMethod(BindingFlags.Public | BindingFlags.Instance, "ResolveAll", type.GetGenericArguments(), new[] { typeof(bool) });

-            //#if GETPARAMETERS_OPEN_GENERICS
-            //            // Using MakeGenericMethod (slow) because we need to
-            //            // cast the IEnumerable or constructing the type wil fail.
-            //            // We may as well use the ResolveAll<ResolveType> public
-            //            // method to do this.
-            //            var resolveAllMethod = this.GetType().GetMethod("ResolveAll", new Type[] { });
-            //            var genericResolveAllMethod = resolveAllMethod.MakeGenericMethod(type.GetGenericArguments()[0]);
-            //#else
-            //            var resolveAllMethods =    from member in this.GetType().GetMembers()
-            //                                       where member.MemberType == MemberTypes.Method
-            //                                       where member.Name == "ResolveAll"
-            //                                       let method = member as MethodInfo
-            //                                       where method.IsGenericMethod
-            //                                       let genericMethod = method.MakeGenericMethod(type.GetGenericArguments()[0])
-            //                                       where genericMethod.GetParameters().Count() == 0
-            //                                       select genericMethod;
-
-            //            var genericResolveAllMethod = resolveAllMethods.First();
-            //#endif
+//#if GETPARAMETERS_OPEN_GENERICS
+//            // Using MakeGenericMethod (slow) because we need to
+//            // cast the IEnumerable or constructing the type wil fail.
+//            // We may as well use the ResolveAll<ResolveType> public
+//            // method to do this.
+//            var resolveAllMethod = this.GetType().GetMethod("ResolveAll", new Type[] { });
+//            var genericResolveAllMethod = resolveAllMethod.MakeGenericMethod(type.GetGenericArguments()[0]);
+//#else
+//            var resolveAllMethods =    from member in this.GetType().GetMembers()
+//                                       where member.MemberType == MemberTypes.Method
+//                                       where member.Name == "ResolveAll"
+//                                       let method = member as MethodInfo
+//                                       where method.IsGenericMethod
+//                                       let genericMethod = method.MakeGenericMethod(type.GetGenericArguments()[0])
+//                                       where genericMethod.GetParameters().Count() == 0
+//                                       select genericMethod;
+
+//            var genericResolveAllMethod = resolveAllMethods.First();
+//#endif
             return genericResolveAllMethod.Invoke(this, new object[] { false });
         }

@@ -3012,17 +3024,14 @@

             // Get constructors in reverse order based on the number of parameters
             // i.e. be as "greedy" as possible so we satify the most amount of dependencies possible
-            var ctors = from ctor in type.GetConstructors()
-                        orderby ctor.GetParameters().Count() descending
-                        select ctor;
-
-            foreach (var ctor in ctors)
-            {
-                if (CanConstruct(ctor, parameters, options))
-                    return ctor;
-            }
-
-            return null;
+            var ctors = this.GetTypeConstructors(type);
+
+            return ctors.FirstOrDefault(ctor => this.CanConstruct(ctor, parameters, options));
+        }
+
+        private IEnumerable<ConstructorInfo> GetTypeConstructors(Type type)
+        {
+            return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Count());
         }

         private object ConstructType(Type type, ResolveOptions options)
@@ -3043,7 +3052,13 @@
         private object ConstructType(Type type, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
         {
             if (constructor == null)
-                constructor = GetBestConstructor(type, parameters, options);
+            {
+                // Try and get the best constructor that we can construct
+                // if we can't construct any then get the constructor
+                // with the least number of parameters so we can throw a meaningful
+                // resolve exception
+                constructor = GetBestConstructor(type, parameters, options) ?? GetTypeConstructors(type).LastOrDefault();
+            }

             if (constructor == null)
                 throw new TinyIoCResolutionException(type);
@@ -3055,7 +3070,26 @@
             {
                 var currentParam = ctorParams[parameterIndex];

-                args[parameterIndex] = parameters.ContainsKey(currentParam.Name) ? parameters[currentParam.Name] : ResolveInternal(new TypeRegistration(currentParam.ParameterType), NamedParameterOverloads.Default, options);
+                try
+                {
+                    args[parameterIndex] = parameters.ContainsKey(currentParam.Name) ?
+                                            parameters[currentParam.Name] :
+                                            ResolveInternal(
+                                                new TypeRegistration(currentParam.ParameterType),
+                                                NamedParameterOverloads.Default,
+                                                options);
+                }
+                catch (TinyIoCResolutionException ex)
+                {
+                    // If a constructor parameter can't be resolved
+                    // it will throw, so wrap it and throw that this can't
+                    // be resolved.
+                    throw new TinyIoCResolutionException(type, ex);
+                }
+                catch (Exception ex)
+                {
+                    throw new TinyIoCResolutionException(type, ex);
+                }
             }

             try


Fix LocalInstant.ToString, which for some reason wasn't including the year, but was including "r-". Never used other than for debugging, fortunately.

--- src/NodaTime/LocalInstant.cs
+++ src/NodaTime/LocalInstant.cs
@@ -313,7 +313,7 @@
         /// </returns>
         public override string ToString()
         {
-            var pattern = LocalDateTimePattern.CreateWithInvariantCulture("r-MM-ddTHH:mm:ss LOC");
+            var pattern = LocalDateTimePattern.CreateWithInvariantCulture("yyyy-MM-ddTHH:mm:ss LOC");
             var utc = new LocalDateTime(new LocalInstant(Ticks));
             return pattern.Format(utc);
         }


Make ProgressInBytes/BlobProgress immutable structs

--- src/Portable/IBlobStorage.cs
+++ src/Portable/IBlobStorage.cs
@@ -8,12 +8,15 @@

     public struct ProgressInBytes
     {
-        public int Bytes;
-        public int TotalBytes;
+        public readonly int Bytes;
+        public readonly int TotalBytes;

-        public float Percentage
-        {
-            get { return TotalBytes > 0 ? (float)Bytes / TotalBytes : 0; }
+        public float Percentage => TotalBytes > 0 ? (float)Bytes / TotalBytes : 0;
+
+        public ProgressInBytes(int bytes, int totalBytes)
+        {
+            this.Bytes = bytes;
+            this.TotalBytes = totalBytes;
         }
     }

@@ -25,11 +28,18 @@
         Failed,
     }

-    public class BlobProgress
+    public struct BlobProgress
     {
-        public string Uri { get; set; }
-        public BlobProgressState State { get; set; }
-        public ProgressInBytes Progress { get; set; }
+        public readonly string Uri;
+        public readonly BlobProgressState State;
+        public readonly ProgressInBytes Progress;
+
+        public BlobProgress(string uri, BlobProgressState state, ProgressInBytes progress)
+        {
+            this.Uri = uri;
+            this.State = state;
+            this.Progress = progress;
+        }
     }

     public interface IBlobStorage
@@ -61,29 +71,34 @@
         }

         public static async Task Download(this IBlobStorage blob, string key, Action<BlobProgress> progress, CancellationToken cancellationToken = default(CancellationToken))
-        {
-            var info = new BlobProgress { State = BlobProgressState.Running };
-            progress(info);
+        {
+            progress(new BlobProgress(null, BlobProgressState.Running, default(ProgressInBytes)));

             if (string.IsNullOrEmpty(key))
-            {
-                info.State = BlobProgressState.Failed;
-                progress(info);
+            {
+                progress(new BlobProgress(null, BlobProgressState.Failed, default(ProgressInBytes)));
                 return;
             }

             try
             {
-                var progressInBytes = new Progress<ProgressInBytes>(p => { info.Progress = p; progress(info); });
-                await blob.Get(key, progressInBytes, cancellationToken).ConfigureAwait(false);
-                info.Uri = await blob.GetUri(key).ConfigureAwait(false);
-                info.State = BlobProgressState.Succeeded;
-                progress(info);
+                var sizeInBytes = 0;
+                var progressReporter = new Progress<ProgressInBytes>(p => progress(new BlobProgress(null, BlobProgressState.Running, p)));
+                using (var stream = await blob.Get(key, progressReporter, cancellationToken).ConfigureAwait(false))
+                {
+                    try
+                    {
+                        sizeInBytes = (int)stream.Length;
+                    }
+                    catch (NotSupportedException) { }
+                }
+
+                var uri = await blob.GetUri(key).ConfigureAwait(false);
+                progress(new BlobProgress(uri, BlobProgressState.Succeeded, new ProgressInBytes(sizeInBytes, sizeInBytes)));
             }
             catch
             {
-                info.State = BlobProgressState.Failed;
-                progress(info);
+                progress(new BlobProgress(null, BlobProgressState.Failed, default(ProgressInBytes)));
             }
         }
     }


Don't stop on first invalid token. Output non-matching brace as still a valid token

--- src/Scriban/Parsing/Lexer.cs
+++ src/Scriban/Parsing/Lexer.cs
@@ -124,7 +124,7 @@
                 }

                 // If we have errors or we are already at the end of the file, we don't continue
-                if (HasErrors || _token.Type == TokenType.Eof)
+                if (_token.Type == TokenType.Eof)
                 {
                     return false;
                 }
@@ -922,8 +922,9 @@
                         else
                         {
                             // Else we have a close brace but it is invalid
+                            AddError("Unexpected } while no matching {", _position, _position);
+                            // Remove the previous error token to still output a valid token
                             _token = new Token(TokenType.CloseBrace, _position, _position);
-                            AddError("Unexpected } while no matching {", _position, _position);
                             NextChar();
                         }
                     }


Remove extra casts to long and double

Remove extra casts to long and double

--- src/SimpleJson/SimpleJson.cs
+++ src/SimpleJson/SimpleJson.cs
@@ -1307,10 +1307,13 @@
                     return str;
             }
             else if (value is bool)
-                obj = value;
-            else if ((value is long && type == typeof(long)) || (value is double && type == typeof(double)))
-                obj = value;
-            else if ((value is double && type != typeof(double)) || (value is long && type != typeof(long)))
+                return value;
+
+            bool valueIsLong = value is long;
+            bool valueIsDouble = value is double;
+            if ((valueIsLong && type == typeof(long)) || (valueIsDouble && type == typeof(double)))
+                return value;
+            if ((valueIsDouble && type != typeof(double)) || (valueIsLong && type != typeof(long)))
             {
                 obj =
 #if NETFX_CORE


added ifNotNull method to sample test

added ifNotNull method to sample test

--- src/Tests/ExtensionsTests.cs
+++ src/Tests/ExtensionsTests.cs
@@ -154,7 +154,7 @@
                 new SampleModel() {Age = 33}
             };

-            models.Update(i => i.Type = ModelType.Sample);
+            models.IfNotNull(() => models.Update(i => i.Type = ModelType.Sample));

             models.ForEach(i => Assert.AreEqual(ModelType.Sample, i.Type));
         }


test for default format

--- Source/EventFlow/Logs/Log.cs
+++ Source/EventFlow/Logs/Log.cs
@@ -153,8 +153,8 @@
         bool Logging.ILog.Log(Logging.LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
         {
             int valueFromEnum = (int)logLevel;
-
-            Write((LogLevel) valueFromEnum, exception, messageFunc(), formatParameters);
+            string format = messageFunc != null ? messageFunc() : String.Empty;
+            Write((LogLevel) valueFromEnum, exception, format, formatParameters);
             return true;
         }
     }


build version: 3.9.71.7

build version: 3.9.71.7

--- Source/GlobalAssemblyInfo.cs
+++ Source/GlobalAssemblyInfo.cs
@@ -6,8 +6,8 @@
 using System.Reflection;

 [assembly: AssemblyCompany("canwell - IT Solutions")]
-[assembly: AssemblyVersion("3.9.71.6")]
-[assembly: AssemblyFileVersion("3.9.71.6")]
-[assembly: AssemblyInformationalVersion("3.9.71.6")]
+[assembly: AssemblyVersion("3.9.71.7")]
+[assembly: AssemblyFileVersion("3.9.71.7")]
+[assembly: AssemblyInformationalVersion("3.9.71.7")]
 [assembly: AssemblyCopyright("Copyright ©  2016")]


[AudioConverterFileConverter] Fixed setting the right category

--- AudioConverterFileConverter/AppDelegate.cs
+++ AudioConverterFileConverter/AppDelegate.cs
@@ -99,7 +99,7 @@
             // our default category -- we change this for conversion and playback appropriately
             try
             {
-                session.SetCategory(new NSString("AudioSessionCategory.SoloAmbientSound"));
+                session.SetCategory (AVAudioSessionCategory.SoloAmbient);
             }
             catch
             {


Woops, forgot to make it actually use the port

--- AuroraAssetEditor/Classes/FTPOperations.cs
+++ AuroraAssetEditor/Classes/FTPOperations.cs
@@ -7,6 +7,7 @@

 namespace AuroraAssetEditor.Classes {
     using System;
+    using System.Globalization;
     using System.IO;
     using System.Linq;
     using System.Net;
@@ -86,6 +87,12 @@
                                         Credentials = new NetworkCredential(_settings.Username, _settings.Password),
                                         Host = _settings.IpAddress
                                     };
+            int port;
+            if(!int.TryParse(_settings.Port, out port)) {
+                port = 21;
+                _settings.Port = port.ToString(CultureInfo.InvariantCulture);
+            }
+            _client.Port = port;
             SendStatusChanged("Connecting to {0}...", _settings.IpAddress);
             _client.Connect();
             if(!_client.IsConnected)


Improve pay button display options section

address #1111

--- BTCPayServer/Views/Stores/PayButton.cshtml
+++ BTCPayServer/Views/Stores/PayButton.cshtml
@@ -33,6 +33,20 @@
                 <input name="orderId" type="text" class="form-control" id="inputAddress" placeholder="(optional)"
                        v-model="srvModel.orderId" v-on:change="inputChanges">

+

+

+

+            Define parameters that define the purchase: price, currency and then optional description of purchase.
+

+            Generated HTML will be displayed at the bottom of this page and all you need is to paste that HTML into your final page.
+            Clicking on the button will redirect customer to checkout.
+

+

+

+
Pay button display options

+

+

+

                 Pay Button Image Url
                 <input name="payButtonImageUrl" type="text" class="form-control" id="inputAddress"
@@ -95,29 +109,34 @@
                     {{ errors.first('step') }}

-

-

-                    Use a simple input style
-                    <input name="simpleInput" type="checkbox" class="form-check"
-                           v-model="srvModel.simpleInput" v-on:change="inputChanges"
+

+

+                    <input name="simpleInput"
+                           id="simpleInput"
+                           type="checkbox"
+                           class="form-check-input"
+                           v-model="srvModel.simpleInput"
+                           v-on:change="inputChanges"
                            :class="{'is-invalid': errors.has('simpleInput') }">
+                    Use a simple input style
                     {{ errors.first('simpleInput') }}

-

-                   Fit button inline
-                   <input name="fitButtonInline" type="checkbox" class="form-check"
-                   v-model="srvModel.fitButtonInline" v-on:change="inputChanges"
-                   :class="{'is-invalid': errors.has('fitButtonInline') }">
+

+                   <input name="fitButtonInline"
+                          id="fitButtonInline"
+                          type="checkbox"
+                          class="form-check-input"
+                          v-model="srvModel.fitButtonInline"
+                          v-on:change="inputChanges"
+                          :class="{'is-invalid': errors.has('fitButtonInline') }">
+                   Fit button inline
                    {{ errors.first('fitButtonInline') }}

-

-            Define parameters that define the purchase: price, currency and then optional description of purchase.
-

-            Generated HTML will be displayed at the bottom of this page and all you need is to paste that HTML into your final page.
-            Clicking on the button will redirect customer to checkout.
+
Preview

+

@@ -175,14 +194,6 @@

-
-
Preview

-

-

-

-

-

-

Generated code


Optimize by StructList.

Optimize by StructList.

--- BTDB/KVDBLayer/Implementation/Compactor.cs
+++ BTDB/KVDBLayer/Implementation/Compactor.cs
@@ -76,26 +76,23 @@
                 if (!_keyValueDB.ContainsValuesAndDoesNotTouchGeneration(_fileStats.KeyRef(fileStat),
                         dontTouchGeneration)
                     || (usedFilesFromOldGenerations != null && Array.BinarySearch(usedFilesFromOldGenerations,
-                            _keyValueDB.GetGeneration(_fileStats.KeyRef(fileStat))) >= 0))
+                        _keyValueDB.GetGeneration(_fileStats.KeyRef(fileStat))) >= 0))
                     _fileStats.ValueRef(fileStat).MarkForbidToDelete();
             }
         }

         void MarkTotallyUselessFilesAsUnknown()
         {
-            List<uint> toRemoveFileIds = null;
+            var toRemoveFileIds = new StructList<uint>();
             foreach (var fileStat in _fileStats.Index)
             {
                 if (_fileStats.ValueRef(fileStat).Useless())
                 {
-                    if (toRemoveFileIds == null)
-                        toRemoveFileIds = new List<uint>();
                     toRemoveFileIds.Add(_fileStats.KeyRef(fileStat));
                 }
             }

-            if (toRemoveFileIds != null)
-                _keyValueDB.MarkAsUnknown(toRemoveFileIds);
+            if (toRemoveFileIds.Count > 0) _keyValueDB.MarkAsUnknown(toRemoveFileIds);
         }

         internal bool Run()
@@ -137,12 +134,13 @@
                 {
                     _keyValueDB.DereferenceRootNodeInternal(lastCommited);
                 }
+
                 MarkTotallyUselessFilesAsUnknown();
                 var totalWaste = CalcTotalWaste();
                 _keyValueDB.Logger?.CompactionStart(totalWaste);
                 if (IsWasteSmall(totalWaste))
                 {
-                    if (_keyValueDB.DistanceFromLastKeyIndex(_root) > (ulong)(_keyValueDB.MaxTrLogFileSize / 4))
+                    if (_keyValueDB.DistanceFromLastKeyIndex(_root) > (ulong) (_keyValueDB.MaxTrLogFileSize / 4))
                         _keyValueDB.CreateIndexFile(_cancellation, preserveKeyIndexGeneration);
                     _keyValueDB.FileCollection.DeleteAllUnknownFiles();
                     return false;
@@ -188,7 +186,9 @@
             while (true)
             {
                 var wastefullFileId =
-                    FindMostWastefullFile(firstIteration ? uint.MaxValue : _keyValueDB.MaxTrLogFileSize - writer.GetCurrentPosition());
+                    FindMostWastefullFile(firstIteration
+                        ? uint.MaxValue
+                        : _keyValueDB.MaxTrLogFileSize - writer.GetCurrentPosition());
                 firstIteration = false;
                 if (wastefullFileId == 0) break;
                 MoveValuesContent(writer, wastefullFileId, valueFileId);
@@ -200,11 +200,11 @@
             var valueFile = _keyValueDB.FileCollection.GetFile(valueFileId);
             valueFile.HardFlushTruncateSwitchToReadOnlyMode();
             _keyValueDB.Logger?.CompactionCreatedPureValueFile(valueFileId, valueFile.GetSize(),
-                (uint)_newPositionMap.Count, 28 *
+                (uint) _newPositionMap.Count, 28 *
 #if NETFRAMEWORK
                                               (ulong) _newPositionMap.Count
 #else
-                                              (ulong)_newPositionMap.EnsureCapacity(0)
+                                              (ulong) _newPositionMap.EnsureCapacity(0)
 #endif
             );
         }
@@ -220,7 +220,7 @@

         bool IsWasteSmall(ulong totalWaste)
         {
-            return totalWaste < (ulong)_keyValueDB.MaxTrLogFileSize / 4;
+            return totalWaste < (ulong) _keyValueDB.MaxTrLogFileSize / 4;
         }

         void MoveValuesContent(AbstractBufferedWriter writer, uint wastefullFileId, uint pvlFileId)
@@ -228,7 +228,7 @@
             const uint blockSize = 256 * 1024;
             var wasteFullStream = _keyValueDB.FileCollection.GetFile(wastefullFileId);
             var totalSize = wasteFullStream.GetSize();
-            var blocks = (int)((totalSize + blockSize - 1) / blockSize);
+            var blocks = (int) ((totalSize + blockSize - 1) / blockSize);
             var wasteInMemory = new byte[blocks][];
             var pos = 0UL;
             var readLimiter = new BytesPerSecondLimiter(_keyValueDB.CompactorReadBytesPerSecondLimit);
@@ -238,7 +238,7 @@
                 wasteInMemory[i] = new byte[blockSize];
                 var readSize = totalSize - pos;
                 if (readSize > blockSize) readSize = blockSize;
-                wasteFullStream.RandomRead(wasteInMemory[i].AsSpan(0, (int)readSize), pos, true);
+                wasteFullStream.RandomRead(wasteInMemory[i].AsSpan(0, (int) readSize), pos, true);
                 pos += readSize;
                 readLimiter.Limit(pos);
             }
@@ -246,21 +246,21 @@
             _keyValueDB.IterateRoot(_root, (valueFileId, valueOfs, valueSize) =>
             {
                 if (valueFileId != wastefullFileId) return;
-                var size = (uint)Math.Abs(valueSize);
-                _newPositionMap.Add(((ulong)wastefullFileId << 32) | valueOfs,
-                    ((ulong)pvlFileId << 32) + (ulong)writer.GetCurrentPosition());
+                var size = (uint) Math.Abs(valueSize);
+                _newPositionMap.Add(((ulong) wastefullFileId << 32) | valueOfs,
+                    ((ulong) pvlFileId << 32) + (ulong) writer.GetCurrentPosition());
                 pos = valueOfs;
                 while (size > 0)
                 {
                     _cancellation.ThrowIfCancellationRequested();
                     var blockId = pos / blockSize;
                     var blockStart = pos % blockSize;
-                    var writeSize = (uint)(blockSize - blockStart);
+                    var writeSize = (uint) (blockSize - blockStart);
                     if (writeSize > size) writeSize = size;
-                    writer.WriteBlock(wasteInMemory[blockId], (int)blockStart, (int)writeSize);
+                    writer.WriteBlock(wasteInMemory[blockId], (int) blockStart, (int) writeSize);
                     size -= writeSize;
                     pos += writeSize;
-                    _writerBytesPerSecondLimiter.Limit((ulong)writer.GetCurrentPosition());
+                    _writerBytesPerSecondLimiter.Limit((ulong) writer.GetCurrentPosition());
                 }
             });
         }
@@ -305,7 +305,7 @@
                 }

                 _fileStats.GetOrAddValueRef(file.Key) =
-                    new FileStat((uint)_keyValueDB.FileCollection.GetSize(file.Key));
+                    new FileStat((uint) _keyValueDB.FileCollection.GetSize(file.Key));
             }
         }

@@ -314,7 +314,7 @@
             _keyValueDB.IterateRoot(root, (valueFileId, valueOfs, valueSize) =>
             {
                 _cancellation.ThrowIfCancellationRequested();
-                _fileStats.GetOrFakeValueRef(valueFileId).AddLength((uint)Math.Abs(valueSize));
+                _fileStats.GetOrFakeValueRef(valueFileId).AddLength((uint) Math.Abs(valueSize));
             });
         }
     }