Modified CanExecute conditions.

Modified CanExecute conditions.

--- Ocell/Helpers/Commands.cs
+++ Ocell/Helpers/Commands.cs
@@ -13,14 +13,14 @@
 using System.Linq;
 using DanielVaughan;
 using DanielVaughan.Services;
-
+using System.Collections.Generic;
 namespace Ocell.Commands
 {
     public class ReplyCommand : ICommand
     {
         public bool CanExecute(object parameter)
         {
-            return parameter is ITweetable;
+            return parameter is ITweetable && Config.Accounts.Any();
         }

         public void Execute(object parameter)
@@ -48,16 +48,17 @@
     {
         public bool CanExecute(object parameter)
         {
-            return parameter is TwitterStatus;
+            return parameter is ITweetable && Config.Accounts.Any() && DataTransfer.CurrentAccount != null;
         }

         public void Execute(object parameter)
         {
             ITweetable tweet = (ITweetable)parameter;
             DataTransfer.ReplyId = tweet.Id;
-            DataTransfer.Text = "";
+            DataTransfer.Text = "@" + tweet.Author.ScreenName + " ";
             foreach (string user in StringManipulator.GetUserNames(tweet.Text))
-                DataTransfer.Text += "@" + user + " ";
+                if(DataTransfer.CurrentAccount != null && user != DataTransfer.CurrentAccount.ScreenName)
+                    DataTransfer.Text += "@" + user + " ";

             Dependency.Resolve<INavigationService>().Navigate(Uris.WriteTweet);
         }
@@ -77,7 +78,7 @@
         public void Execute(object parameter)
         {
             Dependency.Resolve<IMessageService>().SetLoadingBar(true);
-            ServiceDispatcher.GetService(DataTransfer.CurrentAccount).Retweet(((ITweetable)parameter).Id, (sts, resp) =>
+            ServiceDispatcher.GetService(DataTransfer.CurrentAccount).Retweet(((ITweetable)parameter).Id, (sts, resp) =>
             {
                 Dependency.Resolve<IMessageService>().ShowLightNotification("Retweeted!");
             });
@@ -98,15 +99,15 @@
         public void Execute(object parameter)
         {
             TwitterStatus param = (TwitterStatus)parameter;
-            if(param.IsFavorited)
+            if (param.IsFavorited)
                 ServiceDispatcher.GetService(DataTransfer.CurrentAccount).UnfavoriteTweet(param.Id, (sts, resp) =>
                 {
                     Dependency.Resolve<IMessageService>().ShowLightNotification("Unfavorited!");
                 });
             else
-                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).FavoriteTweet(param.Id, (sts, resp) =>
-                {
-                    Dependency.Resolve<IMessageService>().ShowLightNotification("Favorited!");
+                ServiceDispatcher.GetService(DataTransfer.CurrentAccount).FavoriteTweet(param.Id, (sts, resp) =>
+                {
+                    Dependency.Resolve<IMessageService>().ShowLightNotification("Favorited!");
                 });
         }

@@ -130,8 +131,11 @@
                     Result = MessageBox.Show("Are you sure you want to delete the account @" + User.ScreenName, "", MessageBoxButton.OKCancel);
                     if (Result == MessageBoxResult.OK)
                     {
-                        foreach(var item in Config.Columns.Where(item => item.User == User))
+                        // Make a copy: removing while iterating causes an error.
+                        var copy = new List<TwitterResource>(Config.Columns.Where(item => item.User == User));
+                        foreach (var item in copy)
                             Config.Columns.Remove(item);
+
                         Config.SaveColumns();
                         Config.Accounts.Remove(User);
                         Config.SaveAccounts();
@@ -158,11 +162,11 @@
             {
                 var isProtected = ProtectedAccounts.SwitchAccountState(parameter as UserToken);
                 string msg;
-                if(isProtected)
+                if (isProtected)
                     msg = "protected!";
                 else
                     msg = "unprotected!";
-                Dependency.Resolve<IMessageService>().ShowLightNotification("Account "+ msg);
+                Dependency.Resolve<IMessageService>().ShowLightNotification("Account " + msg);
             }
             catch (Exception)
             {


Forgot to add the AddGacReferenceProcessor into list of available IReferenceProcessor types

--- OmniSharp/Bootstrapper.cs
+++ OmniSharp/Bootstrapper.cs
@@ -29,7 +29,7 @@
         {
             base.ConfigureApplicationContainer(container);
             container.Register(_solution);
-			container.RegisterMultiple<IReferenceProcessor>(new []{typeof(AddProjectReferenceProcessor), typeof(AddFileReferenceProcessor)});
+			container.RegisterMultiple<IReferenceProcessor>(new []{typeof(AddProjectReferenceProcessor), typeof(AddFileReferenceProcessor), typeof(AddGacReferenceProcessor)});
         }
     }
 }


Simplify DoubleQueue to eliminate redundant sempahore work.

Exclusion is already guaranteed by the lock on m_syncRoot.
Semaphore could not allow more than one thread in these sections anyway since the underlying SDK structures are not thread-safe.

--- OpenSim/Framework/Util.cs
+++ OpenSim/Framework/Util.cs
@@ -2296,11 +2296,6 @@
         private Queue<T> m_highQueue = new Queue<T>();

         private object m_syncRoot = new object();
-        private Semaphore m_s = new Semaphore(0, 1);
-
-        public DoubleQueue()
-        {
-        }

         public virtual int Count
         {
@@ -2329,11 +2324,7 @@
         private void Enqueue(Queue<T> q, T data)
         {
             lock (m_syncRoot)
-            {
                 q.Enqueue(data);
-                m_s.WaitOne(0);
-                m_s.Release();
-            }
         }

         public virtual T Dequeue()
@@ -2363,42 +2354,31 @@

         public bool Dequeue(TimeSpan wait, ref T res)
         {
-            if (!m_s.WaitOne(wait))
+            if (!Monitor.TryEnter(m_syncRoot, wait))
                 return false;

-            lock (m_syncRoot)
+            try
             {
                 if (m_highQueue.Count > 0)
                     res = m_highQueue.Dequeue();
                 else if (m_lowQueue.Count > 0)
                     res = m_lowQueue.Dequeue();

-                if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
-                    return true;
-
-                try
-                {
-                    m_s.Release();
-                }
-                catch
-                {
-                }
-
                 return true;
             }
+            finally
+            {
+                Monitor.Exit(m_syncRoot);
+            }
         }

         public virtual void Clear()
         {
-
             lock (m_syncRoot)
             {
-                // Make sure sem count is 0
-                m_s.WaitOne(0);
-
                 m_lowQueue.Clear();
                 m_highQueue.Clear();
             }
         }
     }
-}
+}


Fix a NRE happening when dispose is called.  It was calling OnExit() which would cause multiple calls to an object that had already been exited.

--- src/base_nodes/CCNode.cs
+++ src/base_nodes/CCNode.cs
@@ -657,8 +657,12 @@
 				CCNode[] elements = Children.Elements;
 				for (int i = 0, count = Children.count; i < count; i++)
 				{
-					elements[i].OnExit();
-					elements [i].Parent = null;
+					if (elements [i] != null)
+					{
+						if (!elements[i].isCleaned)
+							elements [i].OnExit ();
+						elements [i].Parent = null;
+					}
 				}
 			}


AdventureSample - create Objects.Hide method for Show(..., 0)

--- projects/AdventureSample/src/Adventure/adventure.cs
+++ projects/AdventureSample/src/Adventure/adventure.cs
@@ -909,7 +909,7 @@
             {
                 PRINT("THE LADDER SINKS UNDER YOUR WEIGHT!");
                 PRINT("IT DISAPPEARS INTO THE GROUND!");
-                objects.Show(7, 0);
+                objects.Hide(7);
             }
         }
         else
@@ -1061,7 +1061,7 @@
             PRINT("THE GUARD, NOTICING YOUR SWORD,");
             PRINT("WISELY RETREATS INTO THE CASTLE.");
             map[16, 0] = 17;
-            objects.Show(13, 0);
+            objects.Hide(13);
         }

         return VerbResult.Idle;
@@ -1182,6 +1182,8 @@
         public ObjectRef Get(int id) => new ObjectRef(id, this.objectNames[id], this.objectTags[id], this.objectRooms[id]);

         public void Show(int id, int room) => this.objectRooms[id] = room;
+
+        public void Hide(int id) => this.Show(id, 0);

         private void InitObjects()
         {


Fix namespace issue in Playground.XamarinIOS

--- realm/Tests/Playground.XamarinIOS/ViewController.cs
+++ realm/Tests/Playground.XamarinIOS/ViewController.cs
@@ -1,6 +1,6 @@
 using System;
 using UIKit;
-using RealmNet.Interop;
+using RealmNet;
 using RealmNet;
 using System.Linq;
 using System.IO;


Update V11 table index query with filter definition

--- src/SJP.Schematic.PostgreSql/Queries/GetV11TableIndexes.cs
+++ src/SJP.Schematic.PostgreSql/Queries/GetV11TableIndexes.cs
@@ -35,7 +35,7 @@
     i.relname as ""{ nameof(Result.IndexName) }"",
     idx.indisunique as ""{ nameof(Result.IsUnique) }"",
     idx.indisprimary as ""{ nameof(Result.IsPrimary) }"",
-    idx.indpred as ""{nameof(Result.FilterDefinition)}"",
+    pg_catalog.pg_get_expr(idx.indpred, idx.indrelid) as ""{nameof(Result.FilterDefinition)}"",
     idx.indnkeyatts as ""{ nameof(Result.KeyColumnCount) }"",
     pg_catalog.generate_subscripts(idx.indkey, 1) as ""{ nameof(Result.IndexColumnId) }"",
     pg_catalog.unnest(array(
@@ -57,4 +57,4 @@
     t.relkind = 'r'
     and t.relname = @{ nameof(Query.TableName) }
     and ns.nspname = @{ nameof(Query.SchemaName) }";
-}+}


Event enrichers from config refactoring

Event enrichers from config refactoring

--- src/Serilog/Settings/KeyValuePairs/KeyValuePairSettings.cs
+++ src/Serilog/Settings/KeyValuePairs/KeyValuePairSettings.cs
@@ -81,10 +81,6 @@
                 loggerConfiguration.Enrich.WithProperty(name, enrichProperyDirective.Value);
             }

-            var eventEnricherDirectives = directives.Where(dir =>
-                dir.Key.StartsWith(EnrichWithEventEnricherPrefix) && !dir.Key.StartsWith(EnrichWithPropertyDirectivePrefix) && dir.Key.Length > EnrichWithEventEnricherPrefix.Length)
-                .Select(dir => dir.Key.Substring(EnrichWithEventEnricherPrefix.Length));
-
             var splitWriteTo = new Regex(WriteToDirectiveRegex);

             var sinkDirectives = (from wt in directives
@@ -98,53 +94,57 @@
                                   }
                                   group call by call.Method).ToList();

+            var eventEnricherDirectives = (from er in directives
+                                           where er.Key.StartsWith(EnrichWithEventEnricherPrefix) && !er.Key.StartsWith(EnrichWithPropertyDirectivePrefix) && er.Key.Length > EnrichWithEventEnricherPrefix.Length
+                                           let match = er.Key.Substring(EnrichWithEventEnricherPrefix.Length)
+                                           let call = new MethodArgumentValue
+                                           {
+                                               Method = match
+                                           }
+                                           group call by call.Method).ToList();
+
             if (sinkDirectives.Any() || eventEnricherDirectives.Any())
             {
                 var configurationAssemblies = LoadConfigurationAssemblies(directives);

-                ApplyDirectives(eventEnricherDirectives, () => FindEventEnricherConfigurationMethods(configurationAssemblies), loggerConfiguration.Enrich);
-                ApplyDirectives(sinkDirectives, () => FindSinkConfigurationMethods(configurationAssemblies), loggerConfiguration.WriteTo);
-            }
-        }
-
-        private static void ApplyDirectives(IEnumerable<string> directives, Func<IList<MethodInfo>> getConfigurationMethods, object loggerConfigMethod)
-        {
-            var directivesGrouped = directives.Select(d => new MethodArgumentValue { Method = d }).GroupBy(m => m.Method).ToList();
-            ApplyDirectives(directivesGrouped, getConfigurationMethods, loggerConfigMethod);
-        }
-
-
-        private static void ApplyDirectives(List<IGrouping<string, MethodArgumentValue>> directives, Func<IList<MethodInfo>> getConfigurationMethods, object loggerConfigMethod)
-        {
-            if (directives.Any())
-            {
-                var configurationMethods = getConfigurationMethods();
-
-                foreach (var directiveInfo in directives)
+                if (sinkDirectives.Any())
                 {
-                    var target = configurationMethods
-                        .Where(m => m.Name == directiveInfo.Key &&
-                            m.GetParameters().Skip(1).All(p =>
+                    ApplyDirectives(sinkDirectives, FindSinkConfigurationMethods(configurationAssemblies), loggerConfiguration.WriteTo);
+                }
+
+                if (eventEnricherDirectives.Any())
+                {
+                    ApplyDirectives(eventEnricherDirectives, FindEventEnricherConfigurationMethods(configurationAssemblies), loggerConfiguration.Enrich);
+                }
+            }
+        }
+
+        private static void ApplyDirectives(List<IGrouping<string, MethodArgumentValue>> directives, IList<MethodInfo> configurationMethods, object loggerConfigMethod)
+        {
+            foreach (var directiveInfo in directives)
+            {
+                var target = configurationMethods
+                    .Where(m => m.Name == directiveInfo.Key &&
+                        m.GetParameters().Skip(1).All(p =>
 #if NET40
-                            (p.Attributes & ParameterAttributes.HasDefault) != ParameterAttributes.None
+                        (p.Attributes & ParameterAttributes.HasDefault) != ParameterAttributes.None
 #else
-                            p.HasDefaultValue
+                        p.HasDefaultValue
 #endif
-                            || directiveInfo.Any(s => s.Argument == p.Name)))
-                        .OrderByDescending(m => m.GetParameters().Length)
-                        .FirstOrDefault();
-
-                    if (target != null)
-                    {
-
-                        var call = (from p in target.GetParameters().Skip(1)
-                                    let directive = directiveInfo.FirstOrDefault(s => s.Argument == p.Name)
-                                    select directive == null ? p.DefaultValue : ConvertToType(directive.Value, p.ParameterType)).ToList();
-
-                        call.Insert(0, loggerConfigMethod);
-
-                        target.Invoke(null, call.ToArray());
-                    }
+                        || directiveInfo.Any(s => s.Argument == p.Name)))
+                    .OrderByDescending(m => m.GetParameters().Length)
+                    .FirstOrDefault();
+
+                if (target != null)
+                {
+
+                    var call = (from p in target.GetParameters().Skip(1)
+                                let directive = directiveInfo.FirstOrDefault(s => s.Argument == p.Name)
+                                select directive == null ? p.DefaultValue : ConvertToType(directive.Value, p.ParameterType)).ToList();
+
+                    call.Insert(0, loggerConfigMethod);
+
+                    target.Invoke(null, call.ToArray());
                 }
             }
         }


Add description for logging to the file upgrade task

--- src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs
+++ src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs
@@ -1,159 +1,161 @@
-using System;
-using System.IO;
-using System.Threading;
-using NAppUpdate.Framework.Common;
-using NAppUpdate.Framework.Utils;
-
-namespace NAppUpdate.Framework.Tasks
-{
-	[Serializable]
-	[UpdateTaskAlias("fileUpdate")]
-	public class FileUpdateTask : UpdateTaskBase
-	{
-		[NauField("localPath", "The local path of the file to update", true)]
-		public string LocalPath { get; set; }
-
-		[NauField("updateTo",
-			"File name on the remote location; same name as local path will be used if left blank"
-			, false)]
-		public string UpdateTo { get; set; }
-
-		[NauField("sha256-checksum", "SHA-256 checksum to validate the file after download (optional)", false)]
-		public string Sha256Checksum { get; set; }
-
-		[NauField("hotswap",
-			"Default update action is a cold update; check here if a hot file swap should be attempted"
-			, false)]
-		public bool CanHotSwap { get; set; }
-
-		private string _destinationFile, _backupFile, _tempFile;
-
-		public override void Prepare(Sources.IUpdateSource source)
-		{
-			if (string.IsNullOrEmpty(LocalPath))
-			{
-				UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "FileUpdateTask: LocalPath is empty, task is a noop");
-				return; // Errorneous case, but there's nothing to prepare to, and by default we prefer a noop over an error
-			}
-
-			string fileName;
-			if (!string.IsNullOrEmpty(UpdateTo))
-				fileName = UpdateTo;
-			else
-				fileName = LocalPath;
-
-			_tempFile = null;
-
-			string baseUrl = UpdateManager.Instance.BaseUrl;
-			string tempFileLocal = Path.Combine(UpdateManager.Instance.Config.TempFolder, Guid.NewGuid().ToString());
-
-			UpdateManager.Instance.Logger.Log("FileUpdateTask: Downloading {0} with BaseUrl of {1} to {2}", fileName, baseUrl, tempFileLocal);
-
-			if (!source.GetData(fileName, baseUrl, OnProgress, ref tempFileLocal))
-				throw new UpdateProcessFailedException("FileUpdateTask: Failed to get file from source");
-
-			_tempFile = tempFileLocal;
-			if (_tempFile == null)
-				throw new UpdateProcessFailedException("FileUpdateTask: Failed to get file from source");
-
-			if (!string.IsNullOrEmpty(Sha256Checksum))
-			{
-				string checksum = Utils.FileChecksum.GetSHA256Checksum(_tempFile);
-				if (!checksum.Equals(Sha256Checksum))
-					throw new UpdateProcessFailedException(string.Format("FileUpdateTask: Checksums do not match; expected {0} but got {1}", Sha256Checksum, checksum));
-			}
-
-			_destinationFile = Path.Combine(Path.GetDirectoryName(UpdateManager.Instance.ApplicationPath), LocalPath);
-			UpdateManager.Instance.Logger.Log("FileUpdateTask: Prepared successfully; destination file: {0}", _destinationFile);
-		}
-
-		public override TaskExecutionStatus Execute(bool coldRun)
-		{
-			if (string.IsNullOrEmpty(LocalPath))
-			{
-				UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "FileUpdateTask: LocalPath is empty, task is a noop");
-				return TaskExecutionStatus.Successful; // Errorneous case, but there's nothing to prepare to, and by default we prefer a noop over an error
-			}
-
-			var dirName = Path.GetDirectoryName(_destinationFile);
-			if (!Directory.Exists(dirName))
-				Utils.FileSystem.CreateDirectoryStructure(dirName, false);
-
-			// Create a backup copy if target exists
-			if (_backupFile == null && File.Exists(_destinationFile))
-			{
-				if (!Directory.Exists(Path.GetDirectoryName(Path.Combine(UpdateManager.Instance.Config.BackupFolder, LocalPath))))
-					Utils.FileSystem.CreateDirectoryStructure(
-						Path.GetDirectoryName(Path.Combine(UpdateManager.Instance.Config.BackupFolder, LocalPath)), false);
-				_backupFile = Path.Combine(UpdateManager.Instance.Config.BackupFolder, LocalPath);
-				File.Copy(_destinationFile, _backupFile, true);
-			}
-
-			// Only allow execution if the apply attribute was set to hot-swap, or if this is a cold run
-			if (CanHotSwap || coldRun)
-			{
-				if (File.Exists(_destinationFile))
-				{
-					//if (FileSystem.IsExeRunning(_destinationFile))
-					//{
-					//    UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "Process {0} is still running", _destinationFile);
-					//    Thread.Sleep(1000); // TODO: retry a few times and throw after a while
-					//}
-
-					if (!PermissionsCheck.HaveWritePermissionsForFileOrFolder(_destinationFile))
-					{
-						if (coldRun)
-						{
-							UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "Don't have permissions to touch {0}", _destinationFile);
-							File.Delete(_destinationFile); // get the original exception from the system
-						}
-						CanHotSwap = false;
-					}
-				}
-
-				try
-				{
-					if (File.Exists(_destinationFile))
-						File.Delete(_destinationFile);
-					File.Move(_tempFile, _destinationFile);
-					_tempFile = null;
-				}
-				catch (Exception ex)
-				{
-					if (coldRun)
-					{
-						ExecutionStatus = TaskExecutionStatus.Failed;
-						throw new UpdateProcessFailedException("Could not replace the file", ex);
-					}
-
-					// Failed hot swap file tasks should now downgrade to cold tasks automatically
-					CanHotSwap = false;
-				}
-			}
-
-			if (coldRun || CanHotSwap)
-				// If we got thus far, we have completed execution
-				return TaskExecutionStatus.Successful;
-
-			// Otherwise, figure out what restart method to use
-			if (File.Exists(_destinationFile) && !Utils.PermissionsCheck.HaveWritePermissionsForFileOrFolder(_destinationFile))
-			{
-				return TaskExecutionStatus.RequiresPrivilegedAppRestart;
-			}
-			return TaskExecutionStatus.RequiresAppRestart;
-		}
-
-		public override bool Rollback()
-		{
-			if (string.IsNullOrEmpty(_destinationFile))
-				return true;
-
-			// Copy the backup copy back to its original position
-			if (File.Exists(_destinationFile))
-				File.Delete(_destinationFile);
-			File.Copy(_backupFile, _destinationFile, true);
-
-			return true;
-		}
-	}
-}
+using System;
+using System.IO;
+using System.Threading;
+using NAppUpdate.Framework.Common;
+using NAppUpdate.Framework.Utils;
+
+namespace NAppUpdate.Framework.Tasks
+{
+	[Serializable]
+	[UpdateTaskAlias("fileUpdate")]
+	public class FileUpdateTask : UpdateTaskBase
+	{
+		[NauField("localPath", "The local path of the file to update", true)]
+		public string LocalPath { get; set; }
+
+		[NauField("updateTo",
+			"File name on the remote location; same name as local path will be used if left blank"
+			, false)]
+		public string UpdateTo { get; set; }
+
+		[NauField("sha256-checksum", "SHA-256 checksum to validate the file after download (optional)", false)]
+		public string Sha256Checksum { get; set; }
+
+		[NauField("hotswap",
+			"Default update action is a cold update; check here if a hot file swap should be attempted"
+			, false)]
+		public bool CanHotSwap { get; set; }
+
+		private string _destinationFile, _backupFile, _tempFile;
+
+		public override void Prepare(Sources.IUpdateSource source)
+		{
+		    Description = string.Format("Copy file: {0}", LocalPath);
+
+			if (string.IsNullOrEmpty(LocalPath))
+			{
+				UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "FileUpdateTask: LocalPath is empty, task is a noop");
+				return; // Errorneous case, but there's nothing to prepare to, and by default we prefer a noop over an error
+			}
+
+			string fileName;
+			if (!string.IsNullOrEmpty(UpdateTo))
+				fileName = UpdateTo;
+			else
+				fileName = LocalPath;
+
+			_tempFile = null;
+
+			string baseUrl = UpdateManager.Instance.BaseUrl;
+			string tempFileLocal = Path.Combine(UpdateManager.Instance.Config.TempFolder, Guid.NewGuid().ToString());
+
+			UpdateManager.Instance.Logger.Log("FileUpdateTask: Downloading {0} with BaseUrl of {1} to {2}", fileName, baseUrl, tempFileLocal);
+
+			if (!source.GetData(fileName, baseUrl, OnProgress, ref tempFileLocal))
+				throw new UpdateProcessFailedException("FileUpdateTask: Failed to get file from source");
+
+			_tempFile = tempFileLocal;
+			if (_tempFile == null)
+				throw new UpdateProcessFailedException("FileUpdateTask: Failed to get file from source");
+
+			if (!string.IsNullOrEmpty(Sha256Checksum))
+			{
+				string checksum = Utils.FileChecksum.GetSHA256Checksum(_tempFile);
+				if (!checksum.Equals(Sha256Checksum))
+					throw new UpdateProcessFailedException(string.Format("FileUpdateTask: Checksums do not match; expected {0} but got {1}", Sha256Checksum, checksum));
+			}
+
+			_destinationFile = Path.Combine(Path.GetDirectoryName(UpdateManager.Instance.ApplicationPath), LocalPath);
+			UpdateManager.Instance.Logger.Log("FileUpdateTask: Prepared successfully; destination file: {0}", _destinationFile);
+		}
+
+		public override TaskExecutionStatus Execute(bool coldRun)
+		{
+			if (string.IsNullOrEmpty(LocalPath))
+			{
+				UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "FileUpdateTask: LocalPath is empty, task is a noop");
+				return TaskExecutionStatus.Successful; // Errorneous case, but there's nothing to prepare to, and by default we prefer a noop over an error
+			}
+
+			var dirName = Path.GetDirectoryName(_destinationFile);
+			if (!Directory.Exists(dirName))
+				Utils.FileSystem.CreateDirectoryStructure(dirName, false);
+
+			// Create a backup copy if target exists
+			if (_backupFile == null && File.Exists(_destinationFile))
+			{
+				if (!Directory.Exists(Path.GetDirectoryName(Path.Combine(UpdateManager.Instance.Config.BackupFolder, LocalPath))))
+					Utils.FileSystem.CreateDirectoryStructure(
+						Path.GetDirectoryName(Path.Combine(UpdateManager.Instance.Config.BackupFolder, LocalPath)), false);
+				_backupFile = Path.Combine(UpdateManager.Instance.Config.BackupFolder, LocalPath);
+				File.Copy(_destinationFile, _backupFile, true);
+			}
+
+			// Only allow execution if the apply attribute was set to hot-swap, or if this is a cold run
+			if (CanHotSwap || coldRun)
+			{
+				if (File.Exists(_destinationFile))
+				{
+					//if (FileSystem.IsExeRunning(_destinationFile))
+					//{
+					//    UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "Process {0} is still running", _destinationFile);
+					//    Thread.Sleep(1000); // TODO: retry a few times and throw after a while
+					//}
+
+					if (!PermissionsCheck.HaveWritePermissionsForFileOrFolder(_destinationFile))
+					{
+						if (coldRun)
+						{
+							UpdateManager.Instance.Logger.Log(Logger.SeverityLevel.Warning, "Don't have permissions to touch {0}", _destinationFile);
+							File.Delete(_destinationFile); // get the original exception from the system
+						}
+						CanHotSwap = false;
+					}
+				}
+
+				try
+				{
+					if (File.Exists(_destinationFile))
+						File.Delete(_destinationFile);
+					File.Move(_tempFile, _destinationFile);
+					_tempFile = null;
+				}
+				catch (Exception ex)
+				{
+					if (coldRun)
+					{
+						ExecutionStatus = TaskExecutionStatus.Failed;
+						throw new UpdateProcessFailedException("Could not replace the file", ex);
+					}
+
+					// Failed hot swap file tasks should now downgrade to cold tasks automatically
+					CanHotSwap = false;
+				}
+			}
+
+			if (coldRun || CanHotSwap)
+				// If we got thus far, we have completed execution
+				return TaskExecutionStatus.Successful;
+
+			// Otherwise, figure out what restart method to use
+			if (File.Exists(_destinationFile) && !Utils.PermissionsCheck.HaveWritePermissionsForFileOrFolder(_destinationFile))
+			{
+				return TaskExecutionStatus.RequiresPrivilegedAppRestart;
+			}
+			return TaskExecutionStatus.RequiresAppRestart;
+		}
+
+		public override bool Rollback()
+		{
+			if (string.IsNullOrEmpty(_destinationFile))
+				return true;
+
+			// Copy the backup copy back to its original position
+			if (File.Exists(_destinationFile))
+				File.Delete(_destinationFile);
+			File.Copy(_backupFile, _destinationFile, true);
+
+			return true;
+		}
+	}
+}


small woopsie

small woopsie

--- src/NadekoBot/Modules/Permissions/Permissions.cs
+++ src/NadekoBot/Modules/Permissions/Permissions.cs
@@ -84,7 +84,8 @@
                     foreach (var oc in oldCache)
                     {
                         if (i % 3 == 0)
-                            log.Info("Migrating Permissions #" + ++i + " - GuildId: " + oc.Key);
+                            log.Info("Migrating Permissions #" + i + " - GuildId: " + oc.Key);
+                        i++;
                         var gc = uow.GuildConfigs.For(oc.Key, set => set.Include(x => x.Permissions));

                         var oldPerms = oc.Value.RootPermission.AsEnumerable().Reverse().ToList();


Console will extend GameSystem instead of GameSystemBase

--- Paradox.Console/Console.cs
+++ Paradox.Console/Console.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using SiliconStudio.Core;
 using SiliconStudio.Core.Mathematics;
+using SiliconStudio.Paradox;
 using SiliconStudio.Paradox.Games;
 using SiliconStudio.Paradox.Graphics;
 using SiliconStudio.Paradox.Input;
@@ -13,13 +14,12 @@
     /// <summary>
     /// A game system which enables an in-game window for typing commands.
     /// </summary>
-    public partial class Console : GameSystemBase
+    public partial class Console : GameSystem
     {
         private readonly ICommandInterpreter _commandInterpreter;

         private bool _initialized;
-        private Texture2D _backgroundTexture;
-        private readonly InputManager _inputManager;
+        private Texture2D _backgroundTexture;
         private readonly GraphicsDeviceManager _graphicsDeviceManager;
         private SpriteFont _font;
         private float _padding;
@@ -62,8 +62,7 @@

             CharWidthMap = new Dictionary<char, float>();
             _commandInterpreter = commandInterpreter;
-            _graphicsDeviceManager = (GraphicsDeviceManager)registry.GetSafeServiceAs<IGraphicsDeviceManager>();
-            _inputManager = registry.GetSafeServiceAs<InputManager>();
+            _graphicsDeviceManager = (GraphicsDeviceManager)registry.GetSafeServiceAs<IGraphicsDeviceManager>();
             Font = font;
         }

@@ -351,12 +350,12 @@

         private void HandleInput()
         {
-            if (!_inputManager.IsKeyDown(_downKey))
+            if (!Input.IsKeyDown(_downKey))
             {
                 ResetRepeatingPresses();
             }

-            foreach (KeyEvent keyEvent in _inputManager.KeyEvents)
+            foreach (KeyEvent keyEvent in Input.KeyEvents)
             {
                 // We are only interested in key presses.
                 if (keyEvent.Type == KeyEventType.Released) continue;
@@ -398,7 +397,7 @@
                     string cmd = InputBuffer.Get();
                     // Determine if this is a line break or we should execute command straight away.
                     if (_actionDefinitions.BackwardTryGetValue(ConsoleAction.NextLineModifier, out modifier) &&
-                        _inputManager.IsKeyDown(modifier))
+                        Input.IsKeyDown(modifier))
                     {
                         OutputBuffer.AddCommandEntry(cmd);
                     }
@@ -434,9 +433,9 @@
                     return ConsoleProcessResult.Break;
                 case ConsoleAction.Autocomplete:
                     bool hasModifier = _actionDefinitions.BackwardTryGetValue(ConsoleAction.AutocompleteModifier, out modifier);
-                    if (hasModifier && !_inputManager.IsKeyDown(modifier)) return ConsoleProcessResult.None;
+                    if (hasModifier && !Input.IsKeyDown(modifier)) return ConsoleProcessResult.None;
                     bool canMoveBackwards = _actionDefinitions.BackwardTryGetValue(ConsoleAction.PreviousEntryModifier, out modifier);
-                    _commandInterpreter.Autocomplete(InputBuffer, !canMoveBackwards || !_inputManager.IsKeyDown(modifier));
+                    _commandInterpreter.Autocomplete(InputBuffer, !canMoveBackwards || !Input.IsKeyDown(modifier));
                     InputBuffer.Caret.MoveTo(InputBuffer.Length);
                     return ConsoleProcessResult.Break;
                 case ConsoleAction.MoveLeft:
@@ -465,7 +464,7 @@
                     return ConsoleProcessResult.Break;
                 case ConsoleAction.Paste:
                     _actionDefinitions.BackwardTryGetValue(ConsoleAction.CopyPasteModifier, out modifier);
-                    if (!_inputManager.IsKeyDown(modifier)) break;
+                    if (!Input.IsKeyDown(modifier)) break;
                     // TODO: Enable clipboard pasting. How to approach this in a cross-platform manner?
                     //string clipboardVal = Clipboard.GetText(TextDataFormat.Text);
                     //_currentInput.Append(clipboardVal);
@@ -473,7 +472,7 @@
                     return ConsoleProcessResult.Break;
                 case ConsoleAction.Tab:
                     _actionDefinitions.BackwardTryGetValue(ConsoleAction.TabModifier, out modifier);
-                    if (_inputManager.IsKeyDown(modifier))
+                    if (Input.IsKeyDown(modifier))
                     {
                         InputBuffer.RemoveTab();
                     }
@@ -497,7 +496,7 @@
             List<Keys> uppercaseModifiers;
             _actionDefinitions.BackwardTryGetValues(ConsoleAction.UppercaseModifier, out uppercaseModifiers);

-            bool toUpper = uppercaseModifiers != null && uppercaseModifiers.Any(x => _inputManager.IsKeyDown(x));
+            bool toUpper = uppercaseModifiers != null && uppercaseModifiers.Any(x => Input.IsKeyDown(x));

             InputBuffer.Write(toUpper
                 ? symbolPair.UppercaseSymbol


update

update

--- CSharpGL/0Foundations/OpenGLObjects/Rendering/RendererBase.cs
+++ CSharpGL/0Foundations/OpenGLObjects/Rendering/RendererBase.cs
@@ -49,9 +49,8 @@
         }

         /// <summary>
-        /// 用OpenGL初始化和渲染一个元素。
-        /// 只做初始化和渲染这两件事。
-        /// <para>Initialize and render something.</para>
+        /// 用OpenGL初始化和渲染一个模型。
+        /// <para>Initialize and render something with OpenGL.</para>
         /// </summary>
         public RendererBase()
         {


update

update


do not buffer CSV before writing do the response stream

--- src/WebApiContrib.Core.Formatter.Csv/CsvOutputFormatter.cs
+++ src/WebApiContrib.Core.Formatter.Csv/CsvOutputFormatter.cs
@@ -3,7 +3,6 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Reflection;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Mvc.Formatters;

@@ -24,15 +23,7 @@
         {
             ContentType = "text/csv";
             SupportedMediaTypes.Add(Microsoft.Net.Http.Headers.MediaTypeHeaderValue.Parse("text/csv"));
-
-            if (csvFormatterOptions == null)
-            {
-                throw new ArgumentNullException(nameof(csvFormatterOptions));
-            }
-
-            _options = csvFormatterOptions;
-
-            //SupportedEncodings.Add(Encoding.GetEncoding("utf-8"));
+            _options = csvFormatterOptions ?? throw new ArgumentNullException(nameof(csvFormatterOptions));
         }

         protected override bool CanWriteType(Type type)
@@ -73,17 +64,16 @@
                 itemType = type.GetElementType();
             }

-            StringWriter _stringWriter = new StringWriter();
+            var streamWriter = new StreamWriter(response.Body);

             if (_options.UseSingleLineHeaderInCsv)
             {
-                _stringWriter.WriteLine(
+                await streamWriter.WriteLineAsync(
                     string.Join<string>(
                         _options.CsvDelimiter, itemType.GetProperties().Select(x => x.Name)
                     )
                 );
             }
-

             foreach (var obj in (IEnumerable<object>)context.Object)
             {
@@ -94,11 +84,10 @@
                     }
                 );

-                string _valueLine = string.Empty;
+                string valueLine = string.Empty;

                 foreach (var val in vals)
                 {
-
                     if (val.Value != null)
                     {

@@ -114,20 +103,18 @@
                         if (_val.Contains("\n"))
                             _val = _val.Replace("\n", " ");

-                        _valueLine = string.Concat(_valueLine, _val, _options.CsvDelimiter);
+                        valueLine = string.Concat(valueLine, _val, _options.CsvDelimiter);

                     }
                     else
                     {
-                        _valueLine = string.Concat(_valueLine, string.Empty, _options.CsvDelimiter);
+                        valueLine = string.Concat(valueLine, string.Empty, _options.CsvDelimiter);
                     }
                 }

-                _stringWriter.WriteLine(_valueLine.TrimEnd(_options.CsvDelimiter.ToCharArray()));
+                await streamWriter.WriteLineAsync(valueLine.TrimEnd(_options.CsvDelimiter.ToCharArray()));
             }

-            var streamWriter = new StreamWriter(response.Body);
-            await streamWriter.WriteAsync(_stringWriter.ToString());
             await streamWriter.FlushAsync();
         }
     }


Fire Closed event at the end of reading loop

--- Project/StreamProcessor.cs
+++ Project/StreamProcessor.cs
@@ -118,6 +118,7 @@
                         }
                     }
                     Log("End of reading loop");
+                    OnClosed(null);
                 });
                 return true;
             }


Bump version

Bump version

[skip ci]

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


set version to 0.2.0

set version to 0.2.0

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


- release 3.31.2704

- release 3.31.2704

--- Properties/AssemblyInfo.cs
+++ Properties/AssemblyInfo.cs
@@ -9,7 +9,7 @@
 //      Revision -.Net framework

 //---------------------------- WinForms Viewer -------------------------------------------------
-[assembly: AssemblyInformationalVersion("3.30.2704")]  //Should be equal to save property of Patagames.Pdf assembly
+[assembly: AssemblyInformationalVersion("3.31.2704")]  //Should be equal to save property of Patagames.Pdf assembly
 [assembly: AssemblyVersion("3.15.12." +
 #if DOTNET20
 "20"


Version 1.8

Version 1.8

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


Updated MVC integration description to say MVC 4 rather than MVC 3.

--- Properties/AssemblyInfo.cs
+++ Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@
 using Autofac.Integration.Mvc;

 [assembly: AssemblyTitle("Autofac.Integration.Mvc")]
-[assembly: AssemblyDescription("Autofac ASP.NET MVC 3 Integration")]
+[assembly: AssemblyDescription("Autofac ASP.NET MVC 4 Integration")]
 [assembly: InternalsVisibleTo("Autofac.Tests.Integration.Mvc, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6")]
 [assembly: PreApplicationStartMethod(typeof(PreApplicationStartCode), "Start")]
 [assembly: ComVisible(false)]


Updating version information

Updating version information

--- Properties/AssemblyInfo.cs
+++ Properties/AssemblyInfo.cs
@@ -1,35 +1,18 @@
 using System.Reflection;
 using System.Runtime.InteropServices;

-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
 [assembly: AssemblyTitle("Batzendev.RemoteDesktopLockPrevent")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("Batzendev")]
 [assembly: AssemblyProduct("Batzendev.RemoteDesktopLockPrevent")]
-[assembly: AssemblyCopyright("Copyright © Bastian Schmidt 2014")]
+[assembly: AssemblyCopyright("Copyright © Bastian Schmidt 2014 - 2015")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]

-// The following GUID is for the ID of the typelib if this project is exposed to COM
 [assembly: Guid("14b8eccc-ffb9-4219-aaba-1d20e4a0e6dd")]

-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]+[assembly: AssemblyVersion("1.0.1.0")]
+[assembly: AssemblyFileVersion("1.0.1.0")]


- release 4.74.2704

- release 4.74.2704

--- Properties/AssemblyInfo.cs
+++ Properties/AssemblyInfo.cs
@@ -9,7 +9,7 @@
 //      Revision -.Net framework

 //---------------------------- WinForms Viewer -------------------------------------------------
-[assembly: AssemblyInformationalVersion("4.73.2704")]  //Should be equal to the same property of Patagames.Pdf assembly
+[assembly: AssemblyInformationalVersion("4.74.2704")]  //Should be equal to the same property of Patagames.Pdf assembly
 [assembly: AssemblyVersion("4.22.17." +
 #if DOTNET20
 "20"


DateTime::createFromFormat handles NULL args

fixes https://github.com/peachpiecompiler/peachpie/issues/820

--- src/Peachpie.Library/DateTime/DateTimeParsing.cs
+++ src/Peachpie.Library/DateTime/DateTimeParsing.cs
@@ -1554,9 +1554,11 @@
         /// <returns>Parsed date information.</returns>
         public static DateInfo ParseFromFormat(string format, string str, out DateTimeErrors errors)
         {
-            if (format == null) throw new ArgumentNullException(nameof(format));
-            if (str == null) throw new ArgumentNullException(nameof(str));
-
+            // `null` is handled in the same way as empty string "" // https://github.com/peachpiecompiler/peachpie/issues/820
+            format ??= string.Empty;
+            str ??= string.Empty;
+
+            //
             errors = null;

             var time = new DateInfo();


Add new user constructor tests

Add new user constructor tests

--- src/ZobShop.Tests/Models/UserTests/UserConstructorTests.cs
+++ src/ZobShop.Tests/Models/UserTests/UserConstructorTests.cs
@@ -22,5 +22,45 @@

             Assert.IsInstanceOf<IdentityUser>(user);
         }
+
+        [TestCase("pesho", "pesho@pesho.com", "Peter", "0881768356", "1 Peshova street")]
+        public void Constructor_ShouldSetUsernameCorrectly(string username, string email, string name, string phoneNumber, string address)
+        {
+            var user = new User(username, email, name, phoneNumber, address);
+
+            Assert.AreEqual(username, user.UserName);
+        }
+
+        [TestCase("pesho", "pesho@pesho.com", "Peter", "0881768356", "1 Peshova street")]
+        public void Constructor_ShouldSetNameCorrectly(string username, string email, string name, string phoneNumber, string address)
+        {
+            var user = new User(username, email, name, phoneNumber, address);
+
+            Assert.AreEqual(name, user.Name);
+        }
+
+        [TestCase("pesho", "pesho@pesho.com", "Peter", "0881768356", "1 Peshova street")]
+        public void Constructor_ShouldSeEmailCorrectly(string username, string email, string name, string phoneNumber, string address)
+        {
+            var user = new User(username, email, name, phoneNumber, address);
+
+            Assert.AreEqual(email, user.Email);
+        }
+
+        [TestCase("pesho", "pesho@pesho.com", "Peter", "0881768356", "1 Peshova street")]
+        public void Constructor_ShouldSetPhoneNumberCorrectly(string username, string email, string name, string phoneNumber, string address)
+        {
+            var user = new User(username, email, name, phoneNumber, address);
+
+            Assert.AreEqual(phoneNumber, user.PhoneNumber);
+        }
+
+        [TestCase("pesho", "pesho@pesho.com", "Peter", "0881768356", "1 Peshova street")]
+        public void Constructor_ShouldSetAddressCorrectly(string username, string email, string name, string phoneNumber, string address)
+        {
+            var user = new User(username, email, name, phoneNumber, address);
+
+            Assert.AreEqual(address, user.Address);
+        }
     }
 }


Allow prefixes and suffixes to declare shared locals

--- Torch/Managers/PatchManager/DecoratedMethod.cs
+++ Torch/Managers/PatchManager/DecoratedMethod.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel.Design;
 using System.Diagnostics;
 using System.Linq;
 using System.Reflection;
@@ -65,7 +66,8 @@
         {
             if (_pinnedPatch.HasValue)
             {
-                _log.Debug($"Revert {_method.DeclaringType?.FullName}#{_method.Name}({string.Join(", ", _method.GetParameters().Select(x => x.ParameterType.Name))})");
+                _log.Debug(
+                    $"Revert {_method.DeclaringType?.FullName}#{_method.Name}({string.Join(", ", _method.GetParameters().Select(x => x.ParameterType.Name))})");
                 AssemblyMemory.WriteMemory(_revertAddress, _revertData);
                 _revertData = null;
                 _pinnedPatch.Value.Free();
@@ -74,14 +76,16 @@
         }

         #region Create
+
         private int _patchSalt = 0;
+
         private DynamicMethod AllocatePatchMethod()
         {
             Debug.Assert(_method.DeclaringType != null);
             var methodName = _method.Name + $"_{_patchSalt++}";
             var returnType = _method is MethodInfo meth ? meth.ReturnType : typeof(void);
             var parameters = _method.GetParameters();
-            var parameterTypes = (_method.IsStatic ? Enumerable.Empty<Type>() : new[] { typeof(object) })
+            var parameterTypes = (_method.IsStatic ? Enumerable.Empty<Type>() : new[] {typeof(object)})
                 .Concat(parameters.Select(x => x.ParameterType)).ToArray();

             var patchMethod = new DynamicMethod(methodName, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard,
@@ -98,6 +102,7 @@
         public const string INSTANCE_PARAMETER = "__instance";
         public const string RESULT_PARAMETER = "__result";
         public const string PREFIX_SKIPPED_PARAMETER = "__prefixSkipped";
+        public const string LOCAL_PARAMETER = "__local";

         public DynamicMethod ComposePatchedMethod()
@@ -112,6 +117,7 @@
                     MethodTranspiler.IntegrityAnalysis(LogLevel.Info, il);
                 }
             }
+
             MethodTranspiler.EmitMethod(il, generator);

             try
@@ -126,13 +132,17 @@
                     ctx.Read();
                     MethodTranspiler.IntegrityAnalysis(LogLevel.Warn, ctx.Instructions);
                 }
+
                 throw;
             }
+
             return method;
         }
+
         #endregion

         #region Emit
+
         private IEnumerable<MsilInstruction> EmitPatched(Func<Type, bool, MsilLocal> declareLocal)
         {
             var methodBody = _method.GetMethodBody();
@@ -142,6 +152,7 @@
                 Debug.Assert(localVar.LocalType != null);
                 declareLocal(localVar.LocalType, localVar.IsPinned);
             }
+
             var instructions = new List<MsilInstruction>();
             var specialVariables = new Dictionary<string, MsilLocal>();

@@ -157,6 +168,7 @@
                     || Prefixes.Any(x => x.ReturnType == typeof(bool)))
                     resultVariable = declareLocal(returnType, false);
             }
+
             if (resultVariable != null)
                 instructions.AddRange(resultVariable.SetToDefault());
             MsilLocal prefixSkippedVariable = null;
@@ -169,6 +181,23 @@

             if (resultVariable != null)
                 specialVariables.Add(RESULT_PARAMETER, resultVariable);
+
+            // Create special variables
+            foreach (var m in Prefixes.Concat(Suffixes))
+            foreach (var param in m.GetParameters())
+                if (param.Name.StartsWith(LOCAL_PARAMETER))
+                {
+                    var requiredType = param.ParameterType.IsByRef ? param.ParameterType.GetElementType() : param.ParameterType;
+                    if (specialVariables.TryGetValue(param.Name, out var existingParam))
+                    {
+                        if (existingParam.Type != requiredType)
+                            throw new ArgumentException(
+                                $"Trying to use injected local {param.Name} for {m.DeclaringType?.FullName}#{m.ToString()} with type {requiredType} but a local with the same name already exists with type {existingParam.Type}",
+                                param.Name);
+                    }
+                    else
+                        specialVariables.Add(param.Name, declareLocal(requiredType, false));
+                }

             foreach (MethodInfo prefix in Prefixes)
             {
@@ -179,6 +208,7 @@
                     throw new Exception(
                         $"Prefixes must return void or bool.  {prefix.DeclaringType?.FullName}.{prefix.Name} returns {prefix.ReturnType}");
             }
+
             instructions.AddRange(MethodTranspiler.Transpile(_method, (x) => declareLocal(x, false), Transpilers, labelAfterOriginalContent));

             instructions.Add(new MsilInstruction(OpCodes.Nop).LabelWith(labelAfterOriginalContent));
@@ -192,6 +222,7 @@
                 instructions.Add(new MsilInstruction(OpCodes.Ldc_I4_1));
                 instructions.Add(new MsilInstruction(OpCodes.Stloc).InlineValue(prefixSkippedVariable));
             }
+
             instructions.Add(new MsilInstruction(OpCodes.Nop).LabelWith(notSkip));

             foreach (MethodInfo suffix in Suffixes)
@@ -200,6 +231,7 @@
                 if (suffix.ReturnType != typeof(void))
                     throw new Exception($"Suffixes must return void.  {suffix.DeclaringType?.FullName}.{suffix.Name} returns {suffix.ReturnType}");
             }
+
             if (resultVariable != null)
                 instructions.Add(new MsilInstruction(OpCodes.Ldloc).InlineValue(resultVariable));
             instructions.Add(new MsilInstruction(OpCodes.Ret));
@@ -218,11 +250,14 @@
                 switch (param.Name)
                 {
                     case INSTANCE_PARAMETER:
+                    {
                         if (_method.IsStatic)
                             throw new Exception("Can't use an instance parameter for a static method");
                         yield return new MsilInstruction(OpCodes.Ldarg_0);
                         break;
+                    }
                     case PREFIX_SKIPPED_PARAMETER:
+                    {
                         if (param.ParameterType != typeof(bool))
                             throw new Exception($"Prefix skipped parameter {param.ParameterType} must be of type bool");
                         if (param.ParameterType.IsByRef || param.IsOut)
@@ -232,8 +267,10 @@
                         else
                             yield return new MsilInstruction(OpCodes.Ldc_I4_0);
                         break;
+                    }
                     case RESULT_PARAMETER:
-                        Type retType = param.ParameterType.IsByRef
+                    {
+                        var retType = param.ParameterType.IsByRef
                             ? param.ParameterType.GetElementType()
                             : param.ParameterType;
                         if (retType == null || !retType.IsAssignableFrom(specialVariables[RESULT_PARAMETER].Type))
@@ -241,7 +278,16 @@
                         yield return new MsilInstruction(param.ParameterType.IsByRef ? OpCodes.Ldloca : OpCodes.Ldloc)
                             .InlineValue(specialVariables[RESULT_PARAMETER]);
                         break;
+                    }
                     default:
+                    {
+                        if (specialVariables.TryGetValue(param.Name, out var specialVar))
+                        {
+                            yield return new MsilInstruction(param.ParameterType.IsByRef ? OpCodes.Ldloca : OpCodes.Ldloc)
+                                .InlineValue(specialVar);
+                            break;
+                        }
+
                         ParameterInfo declParam = _method.GetParameters().FirstOrDefault(x => x.Name == param.Name);
                         if (declParam == null)
                             throw new Exception($"Parameter name {param.Name} not found");
@@ -258,11 +304,15 @@
                             yield return new MsilInstruction(OpCodes.Ldarg).InlineValue(new MsilArgument(paramIdx));
                             yield return EmitExtensions.EmitDereference(declParam.ParameterType);
                         }
+
                         break;
+                    }
                 }
             }
+
             yield return new MsilInstruction(OpCodes.Call).InlineValue(patch);
         }
+
         #endregion
     }
-}
+}


callbacks prefixed with `\` handled

callbacks prefixed with `\` handled

fixes https://github.com/peachpiecompiler/peachpie/issues/518

--- src/Peachpie.Runtime/Reflection/RoutinesTable.cs
+++ src/Peachpie.Runtime/Reflection/RoutinesTable.cs
@@ -160,21 +160,29 @@
         /// <returns><see cref="RoutineInfo"/> instance or <c>null</c> if routine with given name is not declared.</returns>
         public RoutineInfo GetDeclaredRoutine(string name)
         {
-            int index;
-            if (_nameToIndex.TryGetValue(name, out index))
-            {
-                if (index > 0)
-                {
-                    var routines = _contextRoutines;
-                    if (index <= routines.Length)
-                    {
-                        return routines[index - 1];
-                    }
-                }
-                else
-                {
-                    Debug.Assert(index != 0);
-                    return _appRoutines[-index - 1];
+            if (!string.IsNullOrEmpty(name))
+            {
+                if (name[0] == '\\')
+                {
+                    name = name.Substring(1);
+                }
+
+                int index;
+                if (_nameToIndex.TryGetValue(name, out index))
+                {
+                    if (index > 0)
+                    {
+                        var routines = _contextRoutines;
+                        if (index <= routines.Length)
+                        {
+                            return routines[index - 1];
+                        }
+                    }
+                    else
+                    {
+                        Debug.Assert(index != 0);
+                        return _appRoutines[-index - 1];
+                    }
                 }
             }


removed the last constant

removed the last constant

--- Nez-PCL/Math/Matrix2D.cs
+++ Nez-PCL/Math/Matrix2D.cs
@@ -14,15 +14,14 @@
 	{
 		#region Public Fields

-		public float M11;
+		public float M11; // x scale
 		public float M12;

 		public float M21;
-		public float M22;
-
-		public float M31;
-		public float M32;
-		public float M33; // 1
+		public float M22; // y scale
+
+		public float M31; // x translation
+		public float M32; // y translation

 		#endregion

@@ -44,12 +43,12 @@
 		{
 			get
 			{
-				return new Vector2( this.M31, this.M32 );
+				return new Vector2( M31, M32 );
 			}
 			set
 			{
-				this.M31 = value.X;
-				this.M32 = value.Y;
+				M31 = value.X;
+				M32 = value.Y;
 			}
 		}

@@ -89,35 +88,34 @@
 		{
 			get
 			{
-				return new Vector2( this.M11, this.M22 );
+				return new Vector2( M11, M22 );
 			}
 			set
 			{
-				this.M11 = value.X;
-				this.M22 = value.Y;
+				M11 = value.X;
+				M22 = value.Y;
 			}
 		}

 		#endregion

-		static Matrix2D identity = new Matrix2D( 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f );
+		static Matrix2D identity = new Matrix2D( 1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f );

 		/// <summary>
 		/// Constructs a matrix.
 		/// </summary>
-		public Matrix2D( float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32, float m33 )
-		{
-			this.M11 = m11;
-			this.M12 = m12;
-
-			this.M21 = m21;
-			this.M22 = m22;
-
-			this.M31 = m31;
-			this.M32 = m32;
-			this.M33 = m33;
+		public Matrix2D( float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32 )
+		{
+			M11 = m11;
+			M12 = m12;
+
+			M21 = m21;
+			M22 = m22;
+
+			M31 = m31;
+			M32 = m32;
 		}

@@ -139,7 +137,6 @@

 			matrix1.M31 += matrix2.M31;
 			matrix1.M32 += matrix2.M32;
-			matrix1.M33 += matrix2.M33;

 			return matrix1;
 		}
@@ -161,7 +158,6 @@

 			result.M31 = matrix1.M31 + matrix2.M31;
 			result.M32 = matrix1.M32 + matrix2.M32;
-			result.M33 = matrix1.M33 + matrix2.M33;
 		}

@@ -253,7 +249,6 @@

 			result.M31 = 0;
 			result.M32 = 0;
-			result.M33 = 1;
 		}

@@ -285,7 +280,6 @@

 			result.M31 = 0;
 			result.M32 = 0;
-			result.M33 = 1;
 		}

@@ -319,7 +313,6 @@

 			result.M31 = position.X;
 			result.M32 = position.Y;
-			result.M33 = 1;
 		}

@@ -341,7 +334,6 @@
 		/// </summary>
 		/// <param name="xPosition">X coordinate of translation.</param>
 		/// <param name="yPosition">Y coordinate of translation.</param>
-		/// <param name="zPosition">Z coordinate of translation.</param>
 		/// <param name="result">The translation <see cref="Matrix2D"/> as an output parameter.</param>
 		public static void CreateTranslation( float xPosition, float yPosition, out Matrix2D result )
 		{
@@ -353,7 +345,6 @@

 			result.M31 = xPosition;
 			result.M32 = yPosition;
-			result.M33 = 1;
 		}

@@ -367,15 +358,14 @@
 		{
 			var det = 1 / matrix.Determinant();

-			result.M11 = matrix.M22 * matrix.M33 * det;
-			result.M12 = -matrix.M33 * matrix.M12 * det;
-
-			result.M21 = -matrix.M33 * matrix.M21 * det;
-			result.M22 = matrix.M33 * matrix.M11 * det;
+			result.M11 = matrix.M22 * det;
+			result.M12 = -matrix.M12 * det;
+
+			result.M21 = -matrix.M21 * det;
+			result.M22 = matrix.M11 * det;

 			result.M31 = ( matrix.M32 * matrix.M21 - matrix.M31 * matrix.M22 ) * det;
 			result.M32 = -( matrix.M32 * matrix.M11 - matrix.M31 * matrix.M12 ) * det;
-			result.M33 = 1;
 		}

@@ -395,7 +385,6 @@

 			matrix1.M31 = matrix1.M31 / matrix2.M31;
 			matrix1.M32 = matrix1.M32 / matrix2.M32;
-			matrix1.M33 = matrix1.M33 / matrix2.M33;
 			return matrix1;
 		}

@@ -416,7 +405,6 @@

 			result.M31 = matrix1.M31 / matrix2.M31;
 			result.M32 = matrix1.M32 / matrix2.M32;
-			result.M33 = matrix1.M33 / matrix2.M33;
 		}

@@ -437,7 +425,6 @@

 			matrix1.M31 = matrix1.M31 * num;
 			matrix1.M32 = matrix1.M32 * num;
-			matrix1.M33 = matrix1.M33 * num;

 			return matrix1;
 		}
@@ -460,7 +447,6 @@

 			result.M31 = matrix1.M31 * num;
 			result.M32 = matrix1.M32 * num;
-			result.M33 = matrix1.M33 * num;
 		}

@@ -481,7 +467,6 @@

 			matrix1.M31 = matrix1.M31 + ( ( matrix2.M31 - matrix1.M31 ) * amount );
 			matrix1.M32 = matrix1.M32 + ( ( matrix2.M32 - matrix1.M32 ) * amount );
-			matrix1.M33 = matrix1.M33 + ( ( matrix2.M33 - matrix1.M33 ) * amount );
 			return matrix1;
 		}

@@ -503,7 +488,6 @@

 			result.M31 = matrix1.M31 + ( ( matrix2.M31 - matrix1.M31 ) * amount );
 			result.M32 = matrix1.M32 + ( ( matrix2.M32 - matrix1.M32 ) * amount );
-			result.M33 = matrix1.M33 + ( ( matrix2.M33 - matrix1.M33 ) * amount );
 		}

@@ -515,15 +499,14 @@
 		/// <returns>Result of the matrix multiplication.</returns>
 		public static Matrix2D Multiply( Matrix2D matrix1, Matrix2D matrix2 )
 		{
-			var m11 = ( ( ( matrix1.M11 * matrix2.M11 ) + ( matrix1.M12 * matrix2.M21 ) ) );
-			var m12 = ( ( ( matrix1.M11 * matrix2.M12 ) + ( matrix1.M12 * matrix2.M22 ) ) );
-
-			var m21 = ( ( ( matrix1.M21 * matrix2.M11 ) + ( matrix1.M22 * matrix2.M21 ) ) );
-			var m22 = ( ( ( matrix1.M21 * matrix2.M12 ) + ( matrix1.M22 * matrix2.M22 ) ) );
-
-			var m31 = ( ( ( matrix1.M31 * matrix2.M11 ) + ( matrix1.M32 * matrix2.M21 ) ) + ( matrix1.M33 * matrix2.M31 ) );
-			var m32 = ( ( ( matrix1.M31 * matrix2.M12 ) + ( matrix1.M32 * matrix2.M22 ) ) + ( matrix1.M33 * matrix2.M32 ) );
-			var m33 = matrix1.M33 * matrix2.M33;
+			var m11 = ( matrix1.M11 * matrix2.M11 ) + ( matrix1.M12 * matrix2.M21 );
+			var m12 = ( matrix1.M11 * matrix2.M12 ) + ( matrix1.M12 * matrix2.M22 );
+
+			var m21 = ( matrix1.M21 * matrix2.M11 ) + ( matrix1.M22 * matrix2.M21 );
+			var m22 = ( matrix1.M21 * matrix2.M12 ) + ( matrix1.M22 * matrix2.M22 );
+
+			var m31 = ( matrix1.M31 * matrix2.M11 ) + ( matrix1.M32 * matrix2.M21 ) + matrix2.M31;
+			var m32 = ( matrix1.M31 * matrix2.M12 ) + ( matrix1.M32 * matrix2.M22 ) + matrix2.M32;

 			matrix1.M11 = m11;
 			matrix1.M12 = m12;
@@ -533,7 +516,6 @@

 			matrix1.M31 = m31;
 			matrix1.M32 = m32;
-			matrix1.M33 = m33;
 			return matrix1;
 		}

@@ -546,15 +528,14 @@
 		/// <param name="result">Result of the matrix multiplication as an output parameter.</param>
 		public static void Multiply( ref Matrix2D matrix1, ref Matrix2D matrix2, out Matrix2D result )
 		{
-			var m11 = ( ( ( matrix1.M11 * matrix2.M11 ) + ( matrix1.M12 * matrix2.M21 ) ) );
-			var m12 = ( ( ( matrix1.M11 * matrix2.M12 ) + ( matrix1.M12 * matrix2.M22 ) ) );
-
-			var m21 = ( ( ( matrix1.M21 * matrix2.M11 ) + ( matrix1.M22 * matrix2.M21 ) ) );
-			var m22 = ( ( ( matrix1.M21 * matrix2.M12 ) + ( matrix1.M22 * matrix2.M22 ) ) );
-
-			var m31 = ( ( ( matrix1.M31 * matrix2.M11 ) + ( matrix1.M32 * matrix2.M21 ) ) + ( matrix1.M33 * matrix2.M31 ) );
-			var m32 = ( ( ( matrix1.M31 * matrix2.M12 ) + ( matrix1.M32 * matrix2.M22 ) ) + ( matrix1.M33 * matrix2.M32 ) );
-			var m33 = matrix1.M33 * matrix2.M33;
+			var m11 = ( matrix1.M11 * matrix2.M11 ) + ( matrix1.M12 * matrix2.M21 );
+			var m12 = ( matrix1.M11 * matrix2.M12 ) + ( matrix1.M12 * matrix2.M22 );
+
+			var m21 = ( matrix1.M21 * matrix2.M11 ) + ( matrix1.M22 * matrix2.M21 );
+			var m22 = ( matrix1.M21 * matrix2.M12 ) + ( matrix1.M22 * matrix2.M22 );
+
+			var m31 = ( matrix1.M31 * matrix2.M11 ) + ( matrix1.M32 * matrix2.M21 ) + matrix2.M31;
+			var m32 = ( matrix1.M31 * matrix2.M12 ) + ( matrix1.M32 * matrix2.M22 ) + matrix2.M32;

 			result.M11 = m11;
 			result.M12 = m12;
@@ -564,7 +545,6 @@

 			result.M31 = m31;
 			result.M32 = m32;
-			result.M33 = m33;
 		}

@@ -584,7 +564,6 @@

 			matrix1.M31 *= scaleFactor;
 			matrix1.M32 *= scaleFactor;
-			matrix1.M33 *= scaleFactor;
 			return matrix1;
 		}

@@ -605,7 +584,6 @@

 			result.M31 = matrix1.M31 * scaleFactor;
 			result.M32 = matrix1.M32 * scaleFactor;
-			result.M33 = matrix1.M33 * scaleFactor;
 		}

@@ -625,7 +603,6 @@

 			matrix1.M31 = matrix1.M31 + matrix2.M31;
 			matrix1.M32 = matrix1.M32 + matrix2.M32;
-			matrix1.M33 = matrix1.M33 + matrix2.M33;
 			return matrix1;
 		}

@@ -646,7 +623,6 @@

 			matrix1.M31 = matrix1.M31 / matrix2.M31;
 			matrix1.M32 = matrix1.M32 / matrix2.M32;
-			matrix1.M33 = matrix1.M33 / matrix2.M33;
 			return matrix1;
 		}

@@ -668,7 +644,6 @@

 			matrix.M31 = matrix.M31 * num;
 			matrix.M32 = matrix.M32 * num;
-			matrix.M33 = matrix.M33 * num;
 			return matrix;
 		}

@@ -689,8 +664,7 @@
 				matrix1.M22 == matrix2.M22 &&

 				matrix1.M31 == matrix2.M31 &&
-				matrix1.M32 == matrix2.M32 &&
-				matrix1.M33 == matrix2.M33
+				matrix1.M32 == matrix2.M32
 				);
 		}

@@ -711,8 +685,7 @@
 				matrix1.M22 != matrix2.M22 ||

 				matrix1.M31 != matrix2.M31 ||
-				matrix1.M32 != matrix2.M32 ||
-				matrix1.M33 != matrix2.M33
+				matrix1.M32 != matrix2.M32
 				);
 		}

@@ -728,15 +701,14 @@
 		/// </remarks>
 		public static Matrix2D operator *( Matrix2D matrix1, Matrix2D matrix2 )
 		{
-			var m11 = ( ( ( matrix1.M11 * matrix2.M11 ) + ( matrix1.M12 * matrix2.M21 ) ) );
-			var m12 = ( ( ( matrix1.M11 * matrix2.M12 ) + ( matrix1.M12 * matrix2.M22 ) ) );
-
-			var m21 = ( ( ( matrix1.M21 * matrix2.M11 ) + ( matrix1.M22 * matrix2.M21 ) ) );
-			var m22 = ( ( ( matrix1.M21 * matrix2.M12 ) + ( matrix1.M22 * matrix2.M22 ) ) );
-
-			var m31 = ( ( ( matrix1.M31 * matrix2.M11 ) + ( matrix1.M32 * matrix2.M21 ) ) + ( matrix1.M33 * matrix2.M31 ) );
-			var m32 = ( ( ( matrix1.M31 * matrix2.M12 ) + ( matrix1.M32 * matrix2.M22 ) ) + ( matrix1.M33 * matrix2.M32 ) );
-			var m33 = matrix1.M33 * matrix2.M33;
+			var m11 = ( matrix1.M11 * matrix2.M11 ) + ( matrix1.M12 * matrix2.M21 );
+			var m12 = ( matrix1.M11 * matrix2.M12 ) + ( matrix1.M12 * matrix2.M22 );
+
+			var m21 = ( matrix1.M21 * matrix2.M11 ) + ( matrix1.M22 * matrix2.M21 );
+			var m22 = ( matrix1.M21 * matrix2.M12 ) + ( matrix1.M22 * matrix2.M22 );
+
+			var m31 = ( matrix1.M31 * matrix2.M11 ) + ( matrix1.M32 * matrix2.M21 ) + matrix2.M31;
+			var m32 = ( matrix1.M31 * matrix2.M12 ) + ( matrix1.M32 * matrix2.M22 ) + matrix2.M32;

 			matrix1.M11 = m11;
 			matrix1.M12 = m12;
@@ -746,7 +718,6 @@

 			matrix1.M31 = m31;
 			matrix1.M32 = m32;
-			matrix1.M33 = m33;

 			return matrix1;
 		}
@@ -768,7 +739,6 @@

 			matrix.M31 = matrix.M31 * scaleFactor;
 			matrix.M32 = matrix.M32 * scaleFactor;
-			matrix.M33 = matrix.M33 * scaleFactor;
 			return matrix;
 		}

@@ -789,7 +759,6 @@

 			matrix1.M31 = matrix1.M31 - matrix2.M31;
 			matrix1.M32 = matrix1.M32 - matrix2.M32;
-			matrix1.M33 = matrix1.M33 - matrix2.M33;
 			return matrix1;
 		}

@@ -809,7 +778,6 @@

 			matrix.M31 = -matrix.M31;
 			matrix.M32 = -matrix.M32;
-			matrix.M33 = -matrix.M33;
 			return matrix;
 		}

@@ -830,7 +798,6 @@

 			matrix1.M31 = matrix1.M31 - matrix2.M31;
 			matrix1.M32 = matrix1.M32 - matrix2.M32;
-			matrix1.M33 = matrix1.M33 - matrix2.M33;
 			return matrix1;
 		}

@@ -851,7 +818,6 @@

 			result.M31 = matrix1.M31 - matrix2.M31;
 			result.M32 = matrix1.M32 - matrix2.M32;
-			result.M33 = matrix1.M33 - matrix2.M33;
 		}

@@ -884,10 +850,8 @@

 			ret.M31 = 0;
 			ret.M32 = 0;
-			ret.M33 = matrix.M33;
 			result = ret;
 		}
-

 		#endregion

@@ -912,10 +876,9 @@
 		/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
 		public override bool Equals( object obj )
 		{
-			var isEqual = false;
 			if( obj is Matrix2D )
-				isEqual = this.Equals( (Matrix2D)obj );
-			return isEqual;
+				return Equals( (Matrix2D)obj );
+			return false;
 		}

@@ -925,7 +888,7 @@
 		/// <returns>Hash code of this <see cref="Matrix2D"/>.</returns>
 		public override int GetHashCode()
 		{
-			return this.M11.GetHashCode() + this.M12.GetHashCode() + this.M21.GetHashCode() + this.M22.GetHashCode() + this.M31.GetHashCode() + this.M32.GetHashCode() + this.M33.GetHashCode();
+			return M11.GetHashCode() + M12.GetHashCode() + M21.GetHashCode() + M22.GetHashCode() + M31.GetHashCode() + M32.GetHashCode();
 		}

@@ -935,7 +898,7 @@
 			(
 				mat.M11, mat.M12, 0, 0,
 				mat.M21, mat.M22, 0, 0,
-				0, 0, mat.M33, 0,
+				0, 0, 1, 0,
 				mat.M31, mat.M32, 0, 1
 			);
 		}
@@ -957,7 +920,7 @@
 		{
 			return "{M11:" + M11 + " M12:" + M12 + "}"
 				+ " {M21:" + M21 + " M22:" + M22 + "}"
-				+ " {M31:" + M31 + " M32:" + M32 + " M33:" + M33 + "}";
+				+ " {M31:" + M31 + " M32:" + M32 + "}";
 		}

 		#endregion


refactor(examples):autoformat discovery examples

--- Examples/ServiceExamples/Scripts/ExampleDiscovery.cs
+++ Examples/ServiceExamples/Scripts/ExampleDiscovery.cs
@@ -331,7 +331,7 @@

         Log.Debug("TestDiscovery.RunTest()", "Discovery examples complete.");
     }
-
+
     #region Check State
     private IEnumerator CheckEnvironmentState(float waitTime)
     {
@@ -372,7 +372,7 @@
     {
         Log.Debug("ExampleDiscovery.OnGetEnvironments()", "Discovery - GetEnvironments Response: {0}", customData["json"].ToString());

-        foreach(var environment in resp.environments)
+        foreach (var environment in resp.environments)
         {
             if (environment.read_only == false)
             {
@@ -380,7 +380,7 @@
                 _environmentId = environment.environment_id;
             }
         }
-
+
         _getEnvironmentsTested = true;
     }


Fixes for device parsing - handle keyValuePairs.Count == 0 and "MHS 1s"

--- MultiMiner.Xgminer.Api/Parsers/DeviceInformationParser.cs
+++ MultiMiner.Xgminer.Api/Parsers/DeviceInformationParser.cs
@@ -23,43 +23,52 @@
                   .Select(value => value.Split('='))
                   .ToDictionary(pair => pair[0], pair => pair[1]);

-                DeviceInformation newDevice = new DeviceInformation();
+                //seen Count == 0 with user API logs
+                if (keyValuePairs.Count > 0)
+                {
+                    DeviceInformation newDevice = new DeviceInformation();

-                newDevice.Kind = keyValuePairs.ElementAt(0).Key;
-                newDevice.Index = int.Parse(keyValuePairs[newDevice.Kind]);
-                newDevice.Enabled = keyValuePairs["Enabled"].Equals("Y");
-                newDevice.Status = keyValuePairs["Status"];
+                    newDevice.Kind = keyValuePairs.ElementAt(0).Key;
+                    newDevice.Index = int.Parse(keyValuePairs[newDevice.Kind]);
+                    newDevice.Enabled = keyValuePairs["Enabled"].Equals("Y");
+                    newDevice.Status = keyValuePairs["Status"];

-                //the RPC API returns numbers formatted en-US, e.g. 1,000.00
-                //specify CultureInfo.InvariantCulture for parsing or unhandled exceptions will
-                //occur on other locales
-                //can test for this with:
-                //Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU");
-                //Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");
+                    //the RPC API returns numbers formatted en-US, e.g. 1,000.00
+                    //specify CultureInfo.InvariantCulture for parsing or unhandled exceptions will
+                    //occur on other locales
+                    //can test for this with:
+                    //Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU");
+                    //Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");

-                if (newDevice.Kind.Equals("GPU"))
-                {
-                    if (keyValuePairs.ContainsKey("Temperature")) //check required for bfgminer
-                        newDevice.Temperature = double.Parse(keyValuePairs["Temperature"], CultureInfo.InvariantCulture);
-                    newDevice.FanSpeed = int.Parse(keyValuePairs["Fan Speed"], CultureInfo.InvariantCulture);
-                    newDevice.FanPercent = int.Parse(keyValuePairs["Fan Percent"], CultureInfo.InvariantCulture);
-                    newDevice.GpuClock = int.Parse(keyValuePairs["GPU Clock"], CultureInfo.InvariantCulture);
-                    newDevice.MemoryClock = int.Parse(keyValuePairs["Memory Clock"], CultureInfo.InvariantCulture);
-                    newDevice.GpuVoltage = double.Parse(keyValuePairs["GPU Voltage"], CultureInfo.InvariantCulture);
-                    newDevice.GpuActivity = int.Parse(keyValuePairs["GPU Activity"], CultureInfo.InvariantCulture);
-                    newDevice.PowerTune = int.Parse(keyValuePairs["Powertune"], CultureInfo.InvariantCulture);
-                    newDevice.Intensity = keyValuePairs["Intensity"];
+                    if (newDevice.Kind.Equals("GPU"))
+                    {
+                        if (keyValuePairs.ContainsKey("Temperature")) //check required for bfgminer
+                            newDevice.Temperature = double.Parse(keyValuePairs["Temperature"], CultureInfo.InvariantCulture);
+                        newDevice.FanSpeed = int.Parse(keyValuePairs["Fan Speed"], CultureInfo.InvariantCulture);
+                        newDevice.FanPercent = int.Parse(keyValuePairs["Fan Percent"], CultureInfo.InvariantCulture);
+                        newDevice.GpuClock = int.Parse(keyValuePairs["GPU Clock"], CultureInfo.InvariantCulture);
+                        newDevice.MemoryClock = int.Parse(keyValuePairs["Memory Clock"], CultureInfo.InvariantCulture);
+                        newDevice.GpuVoltage = double.Parse(keyValuePairs["GPU Voltage"], CultureInfo.InvariantCulture);
+                        newDevice.GpuActivity = int.Parse(keyValuePairs["GPU Activity"], CultureInfo.InvariantCulture);
+                        newDevice.PowerTune = int.Parse(keyValuePairs["Powertune"], CultureInfo.InvariantCulture);
+                        newDevice.Intensity = keyValuePairs["Intensity"];
+                    }
+
+                    newDevice.AverageHashrate = double.Parse(keyValuePairs["MHS av"], CultureInfo.InvariantCulture) * 1000;
+
+                    //seen both MHS 5s and MHS 1s
+                    if (keyValuePairs.ContainsKey("MHS 5s"))
+                        newDevice.CurrentHashrate = double.Parse(keyValuePairs["MHS 5s"], CultureInfo.InvariantCulture) * 1000;
+                    else if (keyValuePairs.ContainsKey("MHS 1s"))
+                        newDevice.CurrentHashrate = double.Parse(keyValuePairs["MHS 1s"], CultureInfo.InvariantCulture) * 1000;
+
+                    newDevice.AcceptedShares = int.Parse(keyValuePairs["Accepted"], CultureInfo.InvariantCulture);
+                    newDevice.RejectedShares = int.Parse(keyValuePairs["Rejected"], CultureInfo.InvariantCulture);
+                    newDevice.HardwareErrors = int.Parse(keyValuePairs["Hardware Errors"], CultureInfo.InvariantCulture);
+                    newDevice.Utility = double.Parse(keyValuePairs["Utility"], CultureInfo.InvariantCulture);
+
+                    deviceInformation.Add(newDevice);
                 }
-
-                newDevice.AverageHashrate = double.Parse(keyValuePairs["MHS av"], CultureInfo.InvariantCulture) * 1000;
-                newDevice.CurrentHashrate = double.Parse(keyValuePairs["MHS 5s"], CultureInfo.InvariantCulture) * 1000;
-
-                newDevice.AcceptedShares = int.Parse(keyValuePairs["Accepted"], CultureInfo.InvariantCulture);
-                newDevice.RejectedShares = int.Parse(keyValuePairs["Rejected"], CultureInfo.InvariantCulture);
-                newDevice.HardwareErrors = int.Parse(keyValuePairs["Hardware Errors"], CultureInfo.InvariantCulture);
-                newDevice.Utility = double.Parse(keyValuePairs["Utility"], CultureInfo.InvariantCulture);
-
-                deviceInformation.Add(newDevice);
             }
         }
     }


Added a global exception handler in the UI
***NO_CI***

work-items: #128

--- src/PokerLeagueManager.UI.WPF/MainWindow.xaml.cs
+++ src/PokerLeagueManager.UI.WPF/MainWindow.xaml.cs
@@ -12,15 +12,21 @@
         {
             InitializeComponent();

+            Application.Current.DispatcherUnhandledException += GlobalExceptionHandler;
             Resolver.Container.RegisterInstance<IMainWindow>(this);

             ShowView(Resolver.Container.Resolve<ViewGamesListView>());
-            //// ShowView(Resolver.Container.Resolve<EnterGameResultsView>());
         }

         public void ShowView(object view)
         {
             this.Content = view;
         }
+
+        private void GlobalExceptionHandler(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+        {
+            MessageBox.Show(e.Exception.Message, "Unhandled Exception", MessageBoxButton.OK, MessageBoxImage.Error);
+            Application.Current.Shutdown();
+        }
     }
 }


調整排版

調整排版

調整排版

--- UartOscilloscope/CSharpFiles/UARTConnection.cs
+++ UartOscilloscope/CSharpFiles/UARTConnection.cs
@@ -22,13 +22,13 @@
 		{                                                                       //	進入UARTConnection建構子
 			UartComport = new SerialPort();                                     //	初始化UartComport串列埠物件
 		}                                                                       //	結束UARTConnection建構子
-		public void InitializeUARTConnectionSetting()                    //	InitializeUARTConnectionSetting方法，初始化UART連線參數
+		public void InitializeUARTConnectionSetting()							//	InitializeUARTConnectionSetting方法，初始化UART連線參數
 		{                                                                       //	進入InitializeUARTConnectionSetting方法
 			BaudRate = DefaultBaudRate;                                         //	預設BaudRate數值為DefaultBaudRate
 			ParitySetting = DefaultParitySetting;                               //	預設ParitySetting數值為0(無同位位元檢查)
 			DataBitsSetting = 8;                                                //	預設DataBitsSetting數值為8
 			ConnectedCOMPortNum = 0;                                            //	預設ConnectedCOMPortNum為0
-			UartComport_connected = false;                                     //	預設UartComport_connected值為False
+			UartComport_connected = false;										//	預設UartComport_connected值為False
 		}                                                                       //	結束InitializeUARTConnectionSetting方法
 		public static int Get_BaudRate()                                        //	Get_BaudRate方法
 		{                                                                       //	進入Get_BaudRate方法


Fix issue where the file name wasn't getting specified.

--- Naos.Database.MessageBus.Handlers/BackupMessageHandler.cs
+++ Naos.Database.MessageBus.Handlers/BackupMessageHandler.cs
@@ -7,6 +7,7 @@
 namespace Naos.Database.MessageBus.Handlers
 {
     using System;
+    using System.IO;

     using Its.Configuration;

@@ -26,10 +27,11 @@
             Action<string> logAction = s => { };

             var settings = Settings.Get<MessageHandlerSettings>();
+            var backupFileName = Path.Combine(settings.BackupDirectory, message.BackupName) + ".bak";
             var backupDetails = new BackupDetails()
                                     {
                                         Name = message.BackupName,
-                                        BackupTo = new Uri(settings.BackupDirectory),
+                                        BackupTo = new Uri(backupFileName),
                                         ChecksumOption = ChecksumOption.Checksum,
                                         Cipher = Cipher.NoEncryption,
                                         CompressionOption = CompressionOption.NoCompression,


cleanup

cleanup

--- src/PommaLabs.Thrower/Properties/AssemblyInfo.cs
+++ src/PommaLabs.Thrower/Properties/AssemblyInfo.cs
@@ -23,7 +23,6 @@

 using System;
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Security;


Fixed test bug

Fixed test bug

--- src/SFA.DAS.EmployerApprenticeshipsService.TestCommon/DependencyResolution/DefaultRegistry.cs
+++ src/SFA.DAS.EmployerApprenticeshipsService.TestCommon/DependencyResolution/DefaultRegistry.cs
@@ -43,7 +43,7 @@
             For<IConfiguration>().Use<EmployerApprenticeshipsServiceConfiguration>();

             For<ICache>().Use<InMemoryCache>();
-            For<IEventsApi>().Use(eventApi.Object);
+            For<IEventsApi>().Use(() => eventApi.Object);

             AddMediatrRegistrations();


Simplify write-only unit test.

Simplify write-only unit test.

--- FlatFiles.Test/SeparatedValueWriterMetadataTester.cs
+++ FlatFiles.Test/SeparatedValueWriterMetadataTester.cs
@@ -179,7 +179,7 @@
             var outputMapper = SeparatedValueTypeMapper.Define(() => new Person());
             outputMapper.Property(x => x.Name);
             outputMapper.Ignored();
-            outputMapper.CustomMapping(new RecordNumberColumn("RecordNumber") { IncludeSchema = true }).WithWriter(p => p.RecordNumber);
+            outputMapper.CustomMapping(new RecordNumberColumn("RecordNumber") { IncludeSchema = true });
             outputMapper.Ignored();
             outputMapper.Property(x => x.CreatedOn).OutputFormat("MM/dd/yyyy");


新增註解

新增註解

新增註解

--- UartOscilloscope/CSharpFiles/UARTConnection.cs
+++ UartOscilloscope/CSharpFiles/UARTConnection.cs
@@ -53,7 +53,7 @@
 		/// <summary>
 		/// GetBaudRate方法用於取得鮑率設定
 		/// </summary>
-		/// <returns></returns>
+		/// <returns>回傳值為UART鮑率設定</returns>
 		public int GetBaudRate()												//	GetBaudRate方法
 		{                                                                       //	進入GetBaudRate方法
 			return UartComport.BaudRate;                                        //	回傳BaudRate數值


Propagate the IsContainer property.

Propagate the IsContainer property.

--- NtApiDotNet/NtGeneric.cs
+++ NtApiDotNet/NtGeneric.cs
@@ -12,7 +12,6 @@
 //  See the License for the specific language governing permissions and
 //  limitations under the License.

-
 namespace NtApiDotNet
 {
     /// <summary>
@@ -20,6 +19,11 @@
     /// </summary>
     public class NtGeneric : NtObjectWithDuplicate<NtGeneric, GenericAccessRights>
     {
+        #region Private Members
+        private bool? _is_container;
+        #endregion
+
+        #region Constructors
         internal NtGeneric(SafeKernelObjectHandle handle) : base(handle)
         {
         }
@@ -30,7 +34,9 @@
             {
             }
         }
+        #endregion

+        #region Public Methods
         /// <summary>
         /// Convert the generic object to the best typed object.
         /// </summary>
@@ -49,5 +55,33 @@
         {
             return DuplicateHandle(Handle, throw_on_error).Map(h => NtType.FromHandle(h));
         }
+        #endregion
+
+        #region Public Properties
+        /// <summary>
+        /// Returns whether this object is a container.
+        /// </summary>
+        public override bool IsContainer
+        {
+            get
+            {
+                if (!_is_container.HasValue)
+                {
+                    using (var obj = ToTypedObject(false))
+                    {
+                        if (obj.IsSuccess)
+                        {
+                            _is_container = obj.Result.IsContainer;
+                        }
+                        else
+                        {
+                            _is_container = false;
+                        }
+                    }
+                }
+                return _is_container.Value;
+            }
+        }
+        #endregion
     }
 }


#369 VS Crash - NullReferenceException in Analysis code

--- Nodejs/Product/Analysis/Analysis/Analyzer/AnalysisUnit.cs
+++ Nodejs/Product/Analysis/Analysis/Analyzer/AnalysisUnit.cs
@@ -233,7 +233,8 @@
                 GetHashCode(),
                 Ast != null ? Ast.GetType().Name : "<unknown>",
                 GetType().Name,
-                Ast != null ? Ast.GetStart(ProjectEntry.Tree.LocationResolver) : SourceLocation.Invalid
+                Ast != null && ProjectEntry != null && ProjectEntry.Tree != null ?
+                    Ast.GetStart(ProjectEntry.Tree.LocationResolver) : SourceLocation.Invalid
             );
         }


switched to the more general base class (AbstractSyntaxClassifier)

--- src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/DiscardSyntaxClassifier.cs
+++ src/Workspaces/CSharp/Portable/Classification/SyntaxClassification/DiscardSyntaxClassifier.cs
@@ -13,18 +13,8 @@

 namespace Microsoft.CodeAnalysis.CSharp.Classification.Classifiers
 {
-    internal class DiscardSyntaxClassifier : AbstractNameSyntaxClassifier
+    internal class DiscardSyntaxClassifier : AbstractSyntaxClassifier
     {
-        protected override int? GetRightmostNameArity(SyntaxNode node)
-        {
-            return null;
-        }
-
-        protected override bool IsParentAnAttribute(SyntaxNode node)
-        {
-            return node.IsParentKind(SyntaxKind.Attribute);
-        }
-
         public override void AddClassifications(
            Workspace workspace,
            SyntaxNode syntax,
@@ -85,7 +75,7 @@
             }

             var symbolInfo = semanticModel.GetSymbolInfo(lambda, cancellationToken);
-            var symbol = TryGetSymbol(lambda, symbolInfo, semanticModel) as IMethodSymbol;
+            var symbol = symbolInfo.Symbol as IMethodSymbol;

             if (symbol == null)
             {
@@ -121,7 +111,7 @@
         private bool TryClassifySymbol(SyntaxNode syntax, SemanticModel semanticModel, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken)
         {
             var symbolInfo = semanticModel.GetSymbolInfo(syntax, cancellationToken);
-            var symbol = TryGetSymbol(syntax, symbolInfo, semanticModel);
+            var symbol = symbolInfo.Symbol;

             if (symbol?.Kind == SymbolKind.Discard)
             {


 * Fixed a bug in the server connection provider

git-svn-id: e2945e6dc2723cb01f425b5a7c3c201ce5019a89@325 080cfd25-d5d9-4c59-82ea-70d02a200d8b

--- Gablarski/Network/NetworkServerConnectionProvider.cs
+++ Gablarski/Network/NetworkServerConnectionProvider.cs
@@ -192,15 +192,11 @@
 				var tendpoint = (IPEndPoint)client.Client.RemoteEndPoint;
 				Trace.WriteLine ("[Server] Accepted TCP Connection from " + tendpoint);

-				uint nid = 1;
+				uint nid = 0;
 				NetworkServerConnection connection;
 				lock (connections)
 				{
-					for (; nid < UInt32.MaxValue; ++nid)
-					{
-						if (!connections.ContainsKey (nid))
-							break;
-					}
+					while (connections.ContainsKey (++nid)) ;

 					connection = new NetworkServerConnection (nid, tendpoint, client, new SocketValueWriter (this.udp, tendpoint));
 					connections.Add (nid, connection);


Added missing access right.

Added missing access right.

--- NtApiDotNet/NtProcess.cs
+++ NtApiDotNet/NtProcess.cs
@@ -24,19 +24,20 @@
     public enum ProcessAccessRights : uint
     {
         None = 0,
-        CreateProcess = 0x0080,
+        Terminate = 0x0001,
         CreateThread = 0x0002,
-        DupHandle = 0x0040,
-        QueryInformation = 0x0400,
-        QueryLimitedInformation = 0x1000,
-        SetLimitedInformation = 0x2000,
-        SetInformation = 0x0200,
-        SetQuota = 0x0100,
-        SuspendResume = 0x0800,
-        Terminate = 0x0001,
+        SetSessionId = 0x0004,
         VmOperation = 0x0008,
         VmRead = 0x0010,
         VmWrite = 0x0020,
+        DupHandle = 0x0040,
+        CreateProcess = 0x0080,
+        SetQuota = 0x0100,
+        SetInformation = 0x0200,
+        QueryInformation = 0x0400,
+        SuspendResume = 0x0800,
+        QueryLimitedInformation = 0x1000,
+        SetLimitedInformation = 0x2000,
         AllAccess = 0x1FFFFF,
         GenericRead = GenericAccessRights.GenericRead,
         GenericWrite = GenericAccessRights.GenericWrite,


Remove methods

Remove methods

--- src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorageService.cs
+++ src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorageService.cs
@@ -22,12 +22,6 @@
         public ValueTask<IPersistentStorage> GetStorageAsync(Solution solution, CancellationToken cancellationToken)
             => new(NoOpPersistentStorage.Instance);

-        public ValueTask<IPersistentStorage> GetStorageAsync(Solution solution, bool checkBranchId, CancellationToken cancellationToken)
-            => new(NoOpPersistentStorage.Instance);
-
-        public ValueTask<IPersistentStorage> GetStorageAsync(Workspace workspace, SolutionKey solutionKey, bool checkBranchId, CancellationToken cancellationToken)
-            => new(NoOpPersistentStorage.Instance);
-
         ValueTask<IChecksummedPersistentStorage> IChecksummedPersistentStorageService.GetStorageAsync(Solution solution, CancellationToken cancellationToken)
             => new(NoOpPersistentStorage.Instance);


Skip flaky websocket test (#8085)

Skip flaky websocket test (#8085)

--- src/SignalR/server/SignalR/test/EndToEndTests.cs
+++ src/SignalR/server/SignalR/test/EndToEndTests.cs
@@ -307,7 +307,7 @@
             }
         }

-        [ConditionalTheory]
+        [ConditionalTheory(Skip = "https://github.com/aspnet/AspNetCore-Internal/issues/1383")]
         [WebSocketsSupportedCondition]
         [InlineData(5 * 4096)]
         [InlineData(1000 * 4096 + 32)]


Added original base information.

Added original base information.

--- NtApiDotNet/NtSection.cs
+++ NtApiDotNet/NtSection.cs
@@ -486,6 +486,11 @@
         /// </summary>
         public SectionImageInformation ImageInformation => Query<SectionImageInformation>(SectionInformationClass.SectionImageInformation);

+        /// <summary>
+        /// Get original section base address.
+        /// </summary>
+        public long OriginalBase => Query<IntPtr>(SectionInformationClass.SectionOriginalBaseInformation).ToInt64();
+
         #endregion
     }
 }