RPC Service interface update

RPC Service interface update

--- Plugins/GraphDS/Services/Implementations/RemoteAPIService/ServiceContracts/IGraphElementService.cs
+++ Plugins/GraphDS/Services/Implementations/RemoteAPIService/ServiceContracts/IGraphElementService.cs
@@ -44,7 +44,7 @@
         /// <param name="myPropertyID">The ID of the interesing property</param>
         /// <returns>A Property</returns>
         [OperationContract]
-        object GetProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex, Int64 myPropertyID);
+        object GetProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement, Int64 myPropertyID);

         /// <summary>
@@ -53,14 +53,14 @@
         /// <param name="myPropertyID">The ID of the property</param>
         /// <returns>True if the property exists, otherwise false</returns>
         [OperationContract]
-        bool HasProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex, Int64 myPropertyID);
+        bool HasProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement, Int64 myPropertyID);

         /// <summary>
         /// Returns the count of the vertex properties
         /// </summary>
         /// <returns>An unsigned value</returns>
         [OperationContract]
-        int GetCountOfProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        int GetCountOfProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         /// <summary>
         /// Returns all properties
@@ -68,7 +68,7 @@
         /// <param name="myFilter">A function to filter properties</param>
         /// <returns>An IEnumerable of Property/Value</returns>
         [OperationContract]
-        List<Tuple<Int64, object>> GetAllProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        List<Tuple<Int64, object>> GetAllProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         /// <summary>
         /// Returns a property as string
@@ -76,7 +76,7 @@
         /// <param name="myPropertyID">The id of the property</param>
         /// <returns>The string representation of the property</returns>
         [OperationContract]
-        String GetPropertyAsString(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex, Int64 myPropertyID);
+        String GetPropertyAsString(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement, Int64 myPropertyID);

         #endregion

@@ -89,7 +89,7 @@
         /// <param name="myPropertyName">The name of the interesting unstructured property</param>
         /// <returns>The value of an unstructured property</returns>
         [OperationContract]
-        object GetUnstructuredProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex, string myPropertyName);
+        object GetUnstructuredProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement, string myPropertyName);

         /// <summary>
         /// Checks whether the graph element is in possession of a certain unstructered property
@@ -97,14 +97,14 @@
         /// <param name="myPropertyName">The name of the unstructured property</param>
         /// <returns>True if the property exists, otherwise false</returns>
         [OperationContract]
-        bool HasUnstructuredProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex, String myPropertyName);
+        bool HasUnstructuredProperty(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement, String myPropertyName);

         /// <summary>
         /// Returns the count of the unstructured vertex properties
         /// </summary>
         /// <returns>An unsigned value</returns>
         [OperationContract]
-        int GetCountOfUnstructuredProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        int GetCountOfUnstructuredProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         /// <summary>
         /// Returns all unstructured properties
@@ -112,7 +112,7 @@
         /// <param name="myFilter">A function to filter properties</param>
         /// <returns>An IEnumerable of NameOfProperty/Value</returns>
         [OperationContract]
-        List<Tuple<String, Object>> GetAllUnstructuredProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        List<Tuple<String, Object>> GetAllUnstructuredProperties(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         /// <summary>
         /// Returns an unstructured property as string
@@ -120,7 +120,7 @@
         /// <param name="myPropertyName">The name of the unstructured property</param>
         /// <returns>The string representation of the property</returns>
         [OperationContract]
-        String GetUnstructuredPropertyAsString(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex, String myPropertyName);
+        String GetUnstructuredPropertyAsString(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement, String myPropertyName);

         #endregion

@@ -130,7 +130,7 @@
         /// Gets the comment of this graph element
         /// </summary>
         [OperationContract]
-        String Comment(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        String Comment(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         #endregion

@@ -140,7 +140,7 @@
         /// The date the graph element has been created
         /// </summary>
         [OperationContract]
-        long CreationDate(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        long CreationDate(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         #endregion

@@ -150,7 +150,7 @@
         /// The date the graph element has been modified the last time
         /// </summary>
         [OperationContract]
-        long ModificationDate(SecurityToken mySecToken, ServiceTransactionToken myTransToken, ServiceVertexInstance myVertex);
+        long ModificationDate(SecurityToken mySecToken, ServiceTransactionToken myTransToken, AGraphElement myGraphElement);

         #endregion
     }


Updated tooltip on subscriptions

Updated tooltip on subscriptions

--- Src/SwqlStudio/ObjectExplorer/ObjectExplorer.cs
+++ Src/SwqlStudio/ObjectExplorer/ObjectExplorer.cs
@@ -671,13 +671,28 @@
             node.ImageKey = GetImageKey(table);
             node.SelectedImageKey = node.ImageKey;
             node.Tag = table;
-            node.ToolTipText = string.Format(
-                @"{0}
+            if (table.IsIndication)
+            {
+                node.ToolTipText += string.Format(@"{0}
+Base type: {1}
+CanSubscribe: {2}",
+                    table.FullName, table.BaseType, connection.CanCreateSubscription);
+            }
+            else
+            {
+
+                node.ToolTipText = string.Format(
+                    @"{0}
 Base type: {1}
 CanCreate: {2}
 CanUpdate: {3}
 CanDelete: {4}",
-                table.FullName, table.BaseType, table.CanCreate, table.CanUpdate, table.CanDelete);
+                    table.FullName,
+                    table.BaseType,
+                    table.CanCreate,
+                    table.CanUpdate,
+                    table.CanDelete);
+            }

             // Add keys
             AddPropertiesToNode(node, table.Properties.Where(c => c.IsKey));


Fix: Live tokens not updating because of them being registered after OutputPatterns are loaded

--- StreamCompanionTypes/DataTypes/OutputPattern.cs
+++ StreamCompanionTypes/DataTypes/OutputPattern.cs
@@ -13,7 +13,7 @@
 {
     public class OutputPattern : EventArgs, INotifyPropertyChanged, ICloneable
     {
-        private static readonly List<string> LiveTokenNames = new List<string>();
+        private static readonly ObservableCollection<string> LiveTokenNames = new ObservableCollection<string>();

         private string _name;
         private string _pattern = "Your pattern text";
@@ -24,8 +24,10 @@
         [IgnoreDataMember]
         public Tokens Replacements;

+        private static readonly ReadOnlyObservableCollection<string> ReadOnlyLiveTokenNames = new ReadOnlyObservableCollection<string>(LiveTokenNames);
+
         [IgnoreDataMember]
-        public ReadOnlyCollection<string> MemoryFormatTokens => LiveTokenNames.AsReadOnly();
+        public ReadOnlyObservableCollection<string> MemoryFormatTokens => ReadOnlyLiveTokenNames;

         [DisplayName("Name")]
         [JsonProperty(PropertyName = "Name")]
@@ -44,6 +46,7 @@
             }
         }

+        private static int counter = 0;
         [JsonProperty(PropertyName = "Pattern")]
         [DisplayName("Pattern")]
         public string Pattern
@@ -57,8 +60,19 @@
                 }

                 _pattern = value;
-                IsMemoryFormat = MemoryFormatTokens.Select(s => s.ToLower()).Any(value.ToLower().Contains);
+                SetMemoryFormat();
+
                 OnPropertyChanged(nameof(Pattern));
+            }
+        }
+
+        private void SetMemoryFormat()
+        {
+            IsMemoryFormat = MemoryFormatTokens.Select(s => s.ToLower()).Any(_pattern.ToLower().Contains);
+            if (IsMemoryFormat)
+            {
+                counter++;
+                var a = 1;
             }
         }

@@ -129,6 +143,11 @@
         [IgnoreDataMember]
         [DisplayName("Memory format")]
         public bool IsMemoryFormat { get; private set; }
+
+        public OutputPattern()
+        {
+            LiveTokenNames.CollectionChanged += (_, __) => SetMemoryFormat();
+        }

         public object Clone()
         {


u CacheKey

u CacheKey

--- SmartSql/Abstractions/Cache/CacheKey.cs
+++ SmartSql/Abstractions/Cache/CacheKey.cs
@@ -3,7 +3,6 @@
 using System.Text;
 using System.Reflection;
 using System.Linq;
-
 namespace SmartSql.Abstractions.Cache
 {
     public class CacheKey
@@ -13,43 +12,28 @@
         /// </summary>
         public String Prefix { get; set; } = "SmartSql-Cache";
         public IRequestContext RequestContext { get; private set; }
-
         public String RequestQueryString
         {
             get
             {
-                if (RequestContext.Request == null)
-                {
-                    return "Null";
-                }
+                if (RequestContext.Request == null) { return "Null"; }
                 var properties = RequestContext.Request.GetType().GetProperties().ToList().OrderBy(p => p.Name);
                 StringBuilder strBuilder = new StringBuilder();
                 foreach (var property in properties)
                 {
                     var val = property.GetValue(RequestContext.Request);
                     strBuilder.AppendFormat("&{0}", val);
-                    //strBuilder.AppendFormat("&{0}={1}", property.Name, val);
                 }
                 return strBuilder.ToString().Trim('&');
             }
         }
-
         public String Key { get { return $"{Prefix}:{RequestContext.FullSqlId}:{RequestQueryString}"; } }
-
         public CacheKey(RequestContext context)
         {
             RequestContext = context;
         }
-        public override string ToString()
-        {
-            return Key;
-        }
-
-        public override int GetHashCode()
-        {
-            return Key.GetHashCode();
-        }
-
+        public override string ToString() => Key;
+        public override int GetHashCode() => Key.GetHashCode();
         public override bool Equals(object obj)
         {
             if (this == obj) return true;


Refactorings

Refactorings

--- Styx/Illias/ExtensionMethods/DebugExtensions.cs
+++ Styx/Illias/ExtensionMethods/DebugExtensions.cs
@@ -17,8 +17,6 @@

 #region Usings

-using System;
-using System.Threading;
 using System.Diagnostics;
 using System.Runtime.CompilerServices;

@@ -42,7 +40,7 @@
         public static void Log(params String[] Text)
         {
             if (Text.IsNeitherNullNorEmpty())
-                Debug.WriteLine("[" + DateTime.Now.ToString() + "] " + String.Concat(Text));
+                Debug.WriteLine(String.Concat("[", Timestamp.Now, "] ", String.Concat(Text)));
         }

         #endregion
@@ -56,7 +54,7 @@
         public static void LogT(params String[] Text)
         {
             if (Text.IsNeitherNullNorEmpty())
-                Debug.WriteLine("[" + DateTime.Now.ToString() + " T:" + Thread.CurrentThread.ManagedThreadId.ToString() + "] " + String.Concat(Text));
+                Debug.WriteLine(String.Concat("[", Timestamp.Now, " T:", Thread.CurrentThread.ManagedThreadId, "] ", String.Concat(Text)));
         }

         #endregion
@@ -70,8 +68,8 @@
         /// <param name="Exception">The exception.</param>
         public static void Log(String Message, Exception Exception)
         {
-            if (Exception != null)
-                Debug.WriteLine(String.Concat("[", DateTime.Now, "] ", Message ?? "", Environment.NewLine, Exception.Message, Environment.NewLine,
+            if (Exception is not null)
+                Debug.WriteLine(String.Concat("[", Timestamp.Now, "] ", Message ?? "", Environment.NewLine, Exception.Message, Environment.NewLine,
                                               Exception.StackTrace, Environment.NewLine));
         }

@@ -86,8 +84,8 @@
         /// <param name="Source">The source of the exception.</param>
         public static void Log(Exception Exception, String Source)
         {
-            if (Exception != null)
-                Debug.WriteLine(String.Concat("[", DateTime.Now, "] ", Source ?? "", " led to an exception: ", Exception.Message, Environment.NewLine,
+            if (Exception is not null)
+                Debug.WriteLine(String.Concat("[", Timestamp.Now, "] ", Source ?? "", " led to an exception: ", Exception.Message, Environment.NewLine,
                                               Exception.StackTrace, Environment.NewLine));
         }

@@ -102,8 +100,8 @@
         /// <param name="Source">The source of the exception.</param>
         public static void LogException(Exception Exception, [CallerMemberName] String Source = "")
         {
-            if (Exception != null)
-                Debug.WriteLine(String.Concat("[", DateTime.Now, "] ", Source ?? "", " led to an exception: ", Environment.NewLine,
+            if (Exception is not null)
+                Debug.WriteLine(String.Concat("[", Timestamp.Now, "] ", Source ?? "", " led to an exception: ", Environment.NewLine,
                                 Exception.Message,    Environment.NewLine,
                                 Exception.StackTrace, Environment.NewLine));
         }


GameOver View

GameOver View

--- Snake-DesignPatterns/Views/VGameOver.cs
+++ Snake-DesignPatterns/Views/VGameOver.cs
@@ -24,10 +24,10 @@
         public static void PrintHitTheWall(int Score, int Lifes)
         {
             Console.ForegroundColor = ConsoleColor.Red;
-            Console.SetCursorPosition(30, 20);
+            Console.SetCursorPosition(30, 21);
             Console.WriteLine(" The Snake Hit the wall and DIED .");
             Console.ForegroundColor = ConsoleColor.Green;
-            Console.SetCursorPosition(30, 21);
+            Console.SetCursorPosition(30, 22);
             Console.WriteLine("Your Score is : " + Score);


Update SagaBasics.cs

Update SagaBasics.cs

This page only shows the NHibernate example of a MySagaFinder.FindBy() method. I added a RavenDb example since I couldn't find any example of this online. People shouldn't have to dig up NServiceBus.RavenDb source code to figure out how to do this (I had to)! The paragraph below this snippet needs to be updated a bit once you merge this example.

--- Snippets/Snippets_5/Sagas/SagaBasics.cs
+++ Snippets/Snippets_5/Sagas/SagaBasics.cs
@@ -270,6 +270,7 @@
     {
         #region saga-finder

+        // NHibernate example:
         public class MySagaFinder : IFindSagas<MySagaData>.Using<Message2>
         {
             public NHibernateStorageContext StorageContext { get; set; }
@@ -277,12 +278,25 @@
             public MySagaData FindBy(Message2 message)
             {
                 //your custom finding logic here, e.g.
-                return StorageContext.Session.QueryOver<MySagaData>()
-                                        .Where(x => x.SomeID == message.SomeID && x.SomeData == message.SomeData)
-                                        .SingleOrDefault();
-            }
-        }
-
+                return StorageContext.Session
+                                        .QueryOver<MySagaData>()
+                                        .SingleOrDefault(x => x.SomeID == message.SomeID && x.SomeData == message.SomeData)
+            }
+        }
+
+        // RavenDb example:
+        public class MySagaFinder : IFindSagas<MySagaData>.Using<Message2>
+        {
+            public ISessionProvider SessionProvider { get; set; }
+
+            public MySagaData FindBy(Message2 message)
+            {
+                //your custom finding logic here, e.g.
+                return SessionProvider.Session
+                                        .Query<MySagaData>()
+                                        .SingleOrDefault(x => x.SomeID == message.SomeID && x.SomeData == message.SomeData);
+            }
+        }
         #endregion

         public class MySagaData : IContainSagaData
@@ -372,4 +386,4 @@

         #endregion
     }
-}+}


Fixed a comment.

Fixed a comment.

--- System.CommandLine.Parser/CommandLineVisitor.cs
+++ System.CommandLine.Parser/CommandLineVisitor.cs
@@ -223,8 +223,7 @@
             // Parses the value of the parameter
             Parameter parameter = this.Visit(context.value());

-            // Adds the parameter to the result set
-            // Adds all the flags to the result set
+            // Adds the parameters to the result set
             foreach (char flag in context.UnixStyleFlaggedIdentifiers().GetText().Replace("-", string.Empty).ToList())
             {
                 string parameterName = flag.ToString();


Re-introduced Light Shader in Hero

Re-introduced Light Shader in Hero

--- Some2DRPG/Some2DRPG/GameObjects/Hero.cs
+++ Some2DRPG/Some2DRPG/GameObjects/Hero.cs
@@ -56,6 +56,12 @@
             LightSource.PositionType = LightPositionType.Relative;
         }

+        public override void PostInitialize(GameTime gameTime, TeeEngine engine)
+        {
+            LightShader lightShader = (LightShader) engine.GetPostGameShader("LightShader");
+            lightShader.LightSources.Add(LightSource);
+        }
+
         public override void LoadContent(ContentManager content)
         {
             base.LoadContent(content);


Tests.Routing - fix RenderRouteHandlerTests

--- src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
+++ src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
@@ -45,7 +45,9 @@

         Template CreateTemplate(string alias)
         {
-            var template = new Template(alias, alias, alias);
+            var path = "template";
+            var name = "Template";
+            var template = new Template(path, name, alias);
             template.Content = ""; // else saving throws with a dirty internal error
             ApplicationContext.Services.FileService.SaveTemplate(template);
             return template;
@@ -80,11 +82,17 @@
         [TestCase("home-\\234^^*32page")]
         [TestCase("home-page")]
         [TestCase("home-page")]
-		[TestCase("Home-Page")]
+		[TestCase("Home-Page")]
 		[TestCase("HomePage")]
 		[TestCase("homePage")]
-		public void Umbraco_Route_User_Defined_Controller_Action(string templateName)
+        [TestCase("site1/template2")]
+        [TestCase("site1\\template2")]
+        public void Umbraco_Route_User_Defined_Controller_Action(string templateName)
 		{
+            // NOTE - here we create templates with crazy aliases... assuming that these
+            // could exist in the database... yet creating templates should sanitize
+            // aliases one way or another...
+
             var template = CreateTemplate(templateName);
             var route = RouteTable.Routes["Umbraco_default"];
 			var routeData = new RouteData() {Route = route};
@@ -100,7 +108,8 @@
 			handler.GetHandlerForRoute(routingContext.UmbracoContext.HttpContext.Request.RequestContext, docRequest);
 			Assert.AreEqual("CustomDocument", routeData.Values["controller"].ToString());
 		    Assert.AreEqual(
-		        global::umbraco.cms.helpers.Casing.SafeAlias(templateName),
+                //global::umbraco.cms.helpers.Casing.SafeAlias(template.Alias),
+                template.Alias.ToSafeAlias(),
 		        routeData.Values["action"].ToString());
 		}


--- TableDependency.SqlClient/SqlTableDependency.cs
+++ TableDependency.SqlClient/SqlTableDependency.cs
@@ -504,6 +504,10 @@
                     sqlCommand.ExecuteNonQuery();
                     this.WriteTraceMessage(TraceLevel.Verbose, $"Procedure {_dataBaseObjectsNamingConvention} created.");

+                    // Begin conversation
+                    this.ConversationHandle = this.BeginConversation(sqlCommand);
+                    this.WriteTraceMessage(TraceLevel.Verbose, $"Conversation with handler {this.ConversationHandle} started.");
+
                     // Trigger
                     var declareVariableStatement = this.PrepareDeclareVariableStatement(interestedColumns);
                     var selectForSetVariablesStatement = this.PrepareSelectForSetVariables(interestedColumns);
@@ -540,10 +544,6 @@
                     sqlCommand.CommandText = $"ALTER QUEUE [{_schemaName}].[{_dataBaseObjectsNamingConvention}_Sender] WITH ACTIVATION (PROCEDURE_NAME = [{_schemaName}].[{_dataBaseObjectsNamingConvention}_QueueActivationSender], MAX_QUEUE_READERS = 1, EXECUTE AS {this.QueueExecuteAs.ToUpper()}, STATUS = ON);";
                     sqlCommand.ExecuteNonQuery();

-                    // Begin conversation
-                    this.ConversationHandle = this.BeginConversation(sqlCommand);
-                    this.WriteTraceMessage(TraceLevel.Verbose, $"Conversation with handler {this.ConversationHandle} started.");
-
                     // Persist all objects
                     transaction.Commit();
                 }


Add assert for sentence (and title) case transform

--- osu.Framework.Tests/Localisation/LocalisationTest.cs
+++ osu.Framework.Tests/Localisation/LocalisationTest.cs
@@ -265,16 +265,22 @@

             var uppercasedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_STRING_EN, FakeStorage.LOCALISABLE_STRING_EN).ToUpper());
             var lowercasedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_STRING_EN, FakeStorage.LOCALISABLE_STRING_EN).ToLower());
+            var titleCasedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_STRING_EN, FakeStorage.LOCALISABLE_STRING_EN).ToTitle());
+            var sentenceCasedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_STRING_EN, FakeStorage.LOCALISABLE_STRING_EN).ToSentence());

             config.SetValue(FrameworkSetting.Locale, "en");

             Assert.AreEqual("LOCALISED EN", uppercasedText.Value);
             Assert.AreEqual("localised en", lowercasedText.Value);
+            Assert.AreEqual("Localised EN", titleCasedText.Value);
+            Assert.AreEqual("Localised EN", sentenceCasedText.Value);

             config.SetValue(FrameworkSetting.Locale, "tr");

             Assert.AreEqual("LOCALİSED TR (İ/I)", uppercasedText.Value);
             Assert.AreEqual("localised tr (i/ı)", lowercasedText.Value);
+            Assert.AreEqual("Localised TR (İ/I)", titleCasedText.Value);
+            Assert.AreEqual("Localised TR (i/I)", sentenceCasedText.Value);
         }

         [Test]


refactored the tests to make its intention more clear

--- src/NHibernate.Test/DriverTest/FirebirdClientDriverFixture.cs
+++ src/NHibernate.Test/DriverTest/FirebirdClientDriverFixture.cs
@@ -1,4 +1,5 @@
-using NHibernate.Driver;
+using System.Data;
+using NHibernate.Driver;
 using NUnit.Framework;
 using SharpTestsEx;

@@ -18,38 +19,48 @@
 		public void ConnectionPooling_OpenThenCloseThenOpenAnotherOne_OnlyOneConnectionIsPooled()
 		{
 			MakeDriver();
-			var connection1 = _driver.CreateConnection();
-			var connection2 = _driver.CreateConnection();
-			connection1.ConnectionString = _connectionString;
-			connection2.ConnectionString = _connectionString;
+			var connection1 = MakeConnection();
+			var connection2 = MakeConnection();

+			//open first connection
 			connection1.Open();
-			//return the connection1 to the pool
+			VerifyCountOfEstablishedConnectionsIs(1);
+
+			//return it to the pool
 			connection1.Close();
+			VerifyCountOfEstablishedConnectionsIs(1);
+
 			//open the second connection
 			connection2.Open();
+			VerifyCountOfEstablishedConnectionsIs(1);

-			var physicalConnections = GetEstablishedConnections();
-			physicalConnections.Should().Be(1);
+			//return it to the pool
+			connection2.Close();
+			VerifyCountOfEstablishedConnectionsIs(1);
 		}

 		[Test]
 		public void ConnectionPooling_OpenThenCloseTwoAtTheSameTime_TowConnectionsArePooled()
 		{
 			MakeDriver();
-			var connection1 = _driver.CreateConnection();
-			var connection2 = _driver.CreateConnection();
-			connection1.ConnectionString = _connectionString;
-			connection2.ConnectionString = _connectionString;
+			var connection1 = MakeConnection();
+			var connection2 = MakeConnection();

+			//open first connection
 			connection1.Open();
+			VerifyCountOfEstablishedConnectionsIs(1);
+
+			//open second one
 			connection2.Open();
-			//return both to the pool
+			VerifyCountOfEstablishedConnectionsIs(2);
+
+			//return connection1 to the pool
 			connection1.Close();
+			VerifyCountOfEstablishedConnectionsIs(2);
+
+			//return connection2 to the pool
 			connection2.Close();
-
-			var physicalConnections = GetEstablishedConnections();
-			physicalConnections.Should().Be(2);
+			VerifyCountOfEstablishedConnectionsIs(2);
 		}

 		#endregion
@@ -64,6 +75,19 @@

 			_driver = new FirebirdClientDriver();
 			_connectionString = cfg.GetProperty("connection.connection_string");
+		}
+
+		private IDbConnection MakeConnection()
+		{
+			var result = _driver.CreateConnection();
+			result.ConnectionString = _connectionString;
+			return result;
+		}
+
+		private void VerifyCountOfEstablishedConnectionsIs(int expectedCount)
+		{
+			var physicalConnections = GetEstablishedConnections();
+			physicalConnections.Should().Be(expectedCount);
 		}

 		private int GetEstablishedConnections()


Add failing test case

Add failing test case

--- osu.Framework.Tests/Localisation/LocalisationTest.cs
+++ osu.Framework.Tests/Localisation/LocalisationTest.cs
@@ -351,6 +351,33 @@
             Assert.AreEqual("number 12.34 with number 98.76% EN and number romanised EN EN", text.Value);
         }

+        [Test]
+        public void TestTranslatableComplexStringUsesFallbackFormatWithTranslatedParts()
+        {
+            const string nested_key = FakeStorage.LOCALISABLE_NUMBER_FORMAT_STRING_EN;
+
+            manager.AddLanguage("fr", new FakeStorage("fr"));
+
+            var text = manager.GetLocalisedString(new TranslatableString("_", "{0} / {1} / {2}",
+                new LocalisableFormattableString(12.34, "0.00"),
+                new TranslatableString(nested_key, nested_key, new LocalisableFormattableString(0.9876, "0.00%")),
+                new TranslatableString(nested_key, nested_key, new RomanisableString("unicode", "romanised"))));
+
+            Assert.AreEqual("12.34 / number 98.76% EN / number unicode EN", text.Value);
+
+            config.SetValue(FrameworkSetting.Locale, "fr");
+
+            Assert.AreEqual("12,34 / number 98,76% FR / number unicode FR", text.Value);
+
+            config.SetValue(FrameworkSetting.ShowUnicode, false);
+
+            Assert.AreEqual("12,34 / number 98,76% FR / number romanised FR", text.Value);
+
+            config.SetValue(FrameworkSetting.Locale, "en");
+
+            Assert.AreEqual("12.34 / number 98.76% EN / number romanised EN", text.Value);
+        }
+
         private class FakeFrameworkConfigManager : FrameworkConfigManager
         {
             protected override string Filename => null;


add missing new line

add missing new line

--- osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs
+++ osu.Game.Rulesets.Osu/Mods/OsuModDifficultyAdjust.cs
@@ -49,4 +49,4 @@
             Value = 5,
         };
     }
-}+}


DOMDocument has overridable constructor

DOMDocument has overridable constructor

Originally checked in by DEVSENSE\Jakub on 2012-01-02 14:37:40.923 as Changeset 2260

git-tfs-id: [https://devsense.visualstudio.com/DefaultCollection]$/Phalanger/Main;C6391

--- Source/Extensions/XmlDom/DomDocument.cs
+++ Source/Extensions/XmlDom/DomDocument.cs
@@ -21,7 +21,6 @@
 using System.Runtime.InteropServices;

 using PHP.Core;
-using System.Diagnostics;

 namespace PHP.Library.Xml
 {
@@ -43,7 +42,6 @@

 		private bool _formatOutput;
 		private bool _validateOnParse;
-        internal bool _isHtmlDocument;

 		/// <summary>
 		/// Returns "#document".
@@ -654,8 +652,6 @@
 				instance = new DOMDocument();
 			}
 			else static_call = false;
-
-            instance._isHtmlDocument = false;

 			using (PhpStream stream = PhpStream.Open(fileName, "rt"))
 			{
@@ -677,12 +673,12 @@
 				}
 				catch (XmlException e)
 				{
-                    PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, fileName));
+					PhpException.Throw(PhpError.Warning, e.Message);
 					return false;
 				}
 				catch (IOException e)
 				{
-                    PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, fileName));
+					PhpException.Throw(PhpError.Warning, e.Message);
 					return false;
 				}
 			}
@@ -710,54 +706,33 @@
 			}
 			else static_call = false;

-            var result = instance.loadXMLInternal(xmlString, options, false);
-            return static_call ? instance : (object)result;
-		}
-
-        /// <summary>
-        /// Loads provided XML string into this <see cref="DOMDocument"/>.
-        /// </summary>
-        /// <param name="xmlString">String representing XML document.</param>
-        /// <param name="options">PHP options.</param>
-        /// <param name="isHtml">Whether the <paramref name="xmlString"/> represents XML generated from HTML document (then it may contain some invalid XML characters).</param>
-        /// <returns></returns>
-        private bool loadXMLInternal(string xmlString, int options, bool isHtml)
-        {
-            this._isHtmlDocument = isHtml;
-
-            var stream = new StringReader(xmlString);
-
-            try
-			{
-                XmlReaderSettings settings = new XmlReaderSettings();
-
-                // validating XML reader
-                if (this._validateOnParse)
+			try
+			{
+				if (instance._validateOnParse)
+				{
+					// create a validating XML reader
+					XmlReaderSettings settings = new XmlReaderSettings();
 #pragma warning disable 618
-                    settings.ValidationType = ValidationType.Auto;
+					settings.ValidationType = ValidationType.Auto;
 #pragma warning restore 618

-                // do not check invalid characters in HTML (XML)
-                if (isHtml)
-                    settings.CheckCharacters = false;
-
-                // load the document
-                this.XmlDocument.Load(XmlReader.Create(stream, settings));
-
-                // done
-                return true;
+					instance.XmlDocument.Load(XmlReader.Create(new StringReader(xmlString), settings));
+				}
+				else instance.XmlDocument.LoadXml(xmlString);
 			}
 			catch (XmlException e)
 			{
-                PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, null));
+				PhpException.Throw(PhpError.Warning, e.Message);
 				return false;
 			}
 			catch (IOException e)
 			{
-                PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, null));
+				PhpException.Throw(PhpError.Warning, e.Message);
 				return false;
 			}
-        }
+
+			return (static_call ? instance : (object)true);
+		}

 		/// <summary>
 		/// Saves the XML document to the specified stream.
@@ -788,12 +763,12 @@
 				}
 				catch (XmlException e)
 				{
-                    PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, fileName));
+					PhpException.Throw(PhpError.Warning, e.Message);
 					return null;
 				}
 				catch (IOException e)
 				{
-                    PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, fileName));
+					PhpException.Throw(PhpError.Warning, e.Message);
 					return false;
 				}

@@ -839,109 +814,40 @@
 			}
 		}

-        /// <summary>
-        /// Processes HTML errors, if any.
-        /// </summary>
-        /// <param name="htmlDoc"><see cref="HtmlAgilityPack.HtmlDocument"/> instance to process errors from.</param>
-        /// <param name="filename">HTML file name or <c>null</c> if HTML has been loaded from a string.</param>
-        private void CheckHtmlErrors(HtmlAgilityPack.HtmlDocument/*!*/htmlDoc, string filename)
-        {
-            Debug.Assert(htmlDoc != null);
-
-            foreach (var error in htmlDoc.ParseErrors)
-            {
-                switch (error.Code)
-                {
-                    case HtmlAgilityPack.HtmlParseErrorCode.EndTagNotRequired:
-                    case HtmlAgilityPack.HtmlParseErrorCode.TagNotOpened:
-                        break;
-                    default:
-                        PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, error.Line, error.LinePosition, "(" + error.Code.ToString() + ")" + error.Reason, filename));
-                        break;
-                }
-            }
-        }
-
-		/// <summary>
-        /// Loads HTML from a string.
-		/// </summary>
-        /// <param name="source">
-        /// String containing HTML document.
-        /// </param>
-		[PhpVisible]
-        public object loadHTML(string source)
-		{
-            if (string.IsNullOrEmpty(source))
-                return false;
-
-            return loadHTML(new StringReader(source), null);
-		}
-
-        /// <summary>
-        /// Loads HTML from a file.
-        /// </summary>
-        /// <param name="sourceFile">
-        /// Path to a file containing HTML document.
-        /// </param>
-		[PhpVisible]
-		public object loadHTMLFile(string sourceFile)
-		{
-            using (PhpStream stream = PhpStream.Open(sourceFile, "rt"))
-            {
-                if (stream == null) return false;
-
-                return loadHTML(new StreamReader(stream.RawStream), sourceFile);
-            }
-		}
-
-        /// <summary>
-        /// Load HTML DOM from given <paramref name="stream"/>.
-        /// </summary>
-        private object loadHTML(TextReader stream, string filename)
-        {
-            HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
-
-            // setup HTML parser
-            htmlDoc.OptionOutputAsXml = true;
-            //htmlDoc.OptionOutputOriginalCase = true;  // NOTE: we need lower-cased names because of XPath queries
-            //htmlDoc.OptionFixNestedTags = true;
-            htmlDoc.OptionCheckSyntax = false;
-            htmlDoc.OptionUseIdAttribute = false;   // only needed when XPath navigator is used on htmlDoc
-            htmlDoc.OptionWriteEmptyNodes = true;
-
-            // load HTML (from string or a stream)
-            htmlDoc.Load(stream);
-
-            CheckHtmlErrors(htmlDoc, filename);
-
-            // save to string as XML
-            using (StringWriter sw = new StringWriter())
-            {
-                htmlDoc.Save(sw);
-
-                // load as XML
-                return this.loadXMLInternal(sw.ToString(), 0, true);
-            }
-        }
-
 		/// <summary>
 		/// Not implemented (TODO: need an HTML parser for this).
 		/// </summary>
 		[PhpVisible]
-		public object saveHTML()
-		{
-            //TODO: use the HTML parse to same HTML
-            return saveXML(null);
+		public void loadHTML(string source)
+		{
+			PhpException.Throw(PhpError.Warning, Resources.NotYetImplemented);
 		}

 		/// <summary>
 		/// Not implemented (TODO: need an HTML parser for this).
 		/// </summary>
 		[PhpVisible]
-        public object saveHTMLFile(string file)
-        {
-            //TODO: use the HTML parse to same HTML
-            return save(file, 0);
+		public void loadHTMLFile(string source)
+		{
+			PhpException.Throw(PhpError.Warning, Resources.NotYetImplemented);
+		}
+
+		/// <summary>
+		/// Not implemented (TODO: need an HTML parser for this).
+		/// </summary>
+		[PhpVisible]
+		public void saveHTML()
+		{
+			PhpException.Throw(PhpError.Warning, Resources.NotYetImplemented);
+		}
+
+		/// <summary>
+		/// Not implemented (TODO: need an HTML parser for this).
+		/// </summary>
+		[PhpVisible]
+		public void saveHTMLFile(string file)
+		{
+			PhpException.Throw(PhpError.Warning, Resources.NotYetImplemented);
 		}

 		#endregion
@@ -990,13 +896,13 @@
 				}
 				catch (XmlException e)
 				{
-                    PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_WARNING, 0, 0, 0, e.Message, schemaFile));
+					PhpException.Throw(PhpError.Warning, e.Message);
 					return false;
 				}
 				catch (IOException e)
 				{
-					PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_ERROR, 0, 0, 0, e.Message, schemaFile));
-                    return false;
+					PhpException.Throw(PhpError.Warning, e.Message);
+					return false;
 				}
 			}

@@ -1032,7 +938,7 @@
 			}
 			catch (XmlException e)
 			{
-                PhpLibXml.IssueXmlError(new PhpLibXml.XmlError(PhpLibXml.LIBXML_ERR_WARNING, 0, 0, 0, e.Message, null));
+				PhpException.Throw(PhpError.Warning, e.Message);
 				return false;
 			}


Add non-PM chat tabs to tests

Add non-PM chat tabs to tests

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

 using System;
@@ -196,12 +196,22 @@

         private class TestTabControl : ChannelTabControl
         {
-            protected override TabItem<Channel> CreateTabItem(Channel value) => new TestChannelTabItem(value);
+            protected override TabItem<Channel> CreateTabItem(Channel value)
+            {
+                switch (value.Type)
+                {
+                    case ChannelType.PM:
+                        return new TestPrivateChannelTabItem(value);
+
+                    default:
+                        return new TestChannelTabItem(value);
+                }
+            }

             public new IReadOnlyDictionary<Channel, TabItem<Channel>> TabMap => base.TabMap;
         }

-        private class TestChannelTabItem : PrivateChannelTabItem
+        private class TestChannelTabItem : ChannelTabItem
         {
             public TestChannelTabItem(Channel channel)
                 : base(channel)
@@ -210,5 +220,15 @@

             public new ClickableContainer CloseButton => base.CloseButton;
         }
+
+        private class TestPrivateChannelTabItem : PrivateChannelTabItem
+        {
+            public TestPrivateChannelTabItem(Channel channel)
+                : base(channel)
+            {
+            }
+
+            public new ClickableContainer CloseButton => base.CloseButton;
+        }
     }
 }


#18636: Fixing exception when deleting a role begin used

Work Item: 18636

--HG--
branch : 1.x

--- src/Orchard.Web/Modules/Orchard.Roles/Services/RoleService.cs
+++ src/Orchard.Web/Modules/Orchard.Roles/Services/RoleService.cs
@@ -16,17 +16,22 @@

         private readonly IRepository<RoleRecord> _roleRepository;
         private readonly IRepository<PermissionRecord> _permissionRepository;
+        private readonly IRepository<UserRolesPartRecord> _userRolesRepository;
         private readonly IEnumerable<IPermissionProvider> _permissionProviders;
         private readonly ICacheManager _cacheManager;
         private readonly ISignals _signals;

-        public RoleService(IRepository<RoleRecord> roleRepository,
-                           IRepository<PermissionRecord> permissionRepository,
-                           IEnumerable<IPermissionProvider> permissionProviders,
-                            ICacheManager cacheManager,
-            ISignals signals) {
+        public RoleService(
+            IRepository<RoleRecord> roleRepository,
+            IRepository<PermissionRecord> permissionRepository,
+            IRepository<UserRolesPartRecord> userRolesRepository,
+            IEnumerable<IPermissionProvider> permissionProviders,
+            ICacheManager cacheManager,
+            ISignals signals
+            ) {
             _roleRepository = roleRepository;
             _permissionRepository = permissionRepository;
+            _userRolesRepository = userRolesRepository;
             _permissionProviders = permissionProviders;
             _cacheManager = cacheManager;
             _signals = signals;
@@ -111,6 +116,12 @@
         }

         public void DeleteRole(int id) {
+
+            var currentUserRoleRecords = _userRolesRepository.Fetch(x => x.Role.Id == id);
+            foreach(var userRoleRecord in currentUserRoleRecords) {
+                _userRolesRepository.Delete(userRoleRecord);
+            }
+
             _roleRepository.Delete(GetRole(id));
             TriggerSignal();
         }


Use the new AliveObjects

Use the new AliveObjects

--- osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs
+++ osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs
@@ -64,7 +64,7 @@
             {
                 base.Update();

-                foreach (var obj in Objects)
+                foreach (var obj in AliveObjects)
                 {
                     var relativePosition = (Time.Current - obj.HitObject.StartTime) / TimeRange;


Fix tests

Fix tests

--- src/UnitTests/GitHub.App/Models/ModelServiceTests.cs
+++ src/UnitTests/GitHub.App/Models/ModelServiceTests.cs
@@ -13,8 +13,11 @@
 using Octokit;
 using Xunit;
 using System.Globalization;
+using System.Threading;
 using GitHub.Models;
 using GitHub.Primitives;
+using GitHub.Collections;
+using ReactiveUI;

 public class ModelServiceTests
 {
@@ -397,6 +400,8 @@
         [Fact]
         public async Task NonExpiredIndexReturnsCache()
         {
+            var expected = 5;
+
             var username = "octocat";
             var reponame = "repo";

@@ -414,7 +419,7 @@

             var indexKey = string.Format(CultureInfo.InvariantCulture, "{0}|{1}|pr", user.Login, repo.Name);

-            var prcache = Enumerable.Range(1, 5)
+            var prcache = Enumerable.Range(1, expected)
                 .Select(id => CreatePullRequest(user, id, ItemState.Open, "Cache " + id, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 0));

             // seed the cache
@@ -424,29 +429,36 @@
                 .SelectMany(item => CacheIndex.AddAndSaveToIndex(cache, indexKey, item).ToEnumerable())
                 .ToList();

-            var prlive = Observable.Range(1, 5)
-                .Select(id => CreatePullRequest(user, id, ItemState.Open, "Title " + id, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 0));
+            var prlive = Observable.Range(1, expected)
+                .Select(id => CreatePullRequest(user, id, ItemState.Open, "Live " + id, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 0))
+                .DelaySubscription(TimeSpan.FromMilliseconds(10));

             apiClient.GetPullRequestsForRepository(user.Login, repo.Name).Returns(prlive);

             await modelService.InsertUser(new AccountCacheItem(user));
-            var col = modelService.GetPullRequests(repo);
-
-            col.Subscribe();
-
-            await prlive;
-
-            Assert.Equal(prcache.Select(x =>
-                    new PullRequestModel(x.Number, x.Title, act, x.CreatedAt, x.UpdatedAt)),
-                col);
-
-            Assert.Collection(col, prcache.Select(
-                x => new Action<IPullRequestModel>(t => Assert.Equal(x.Title, t.Title))).ToArray());
+            var source = modelService.GetPullRequests(repo);
+            var col = new TrackingCollection<IPullRequestModel>(source);
+
+            var count = 0;
+            var evt = new ManualResetEvent(false);
+            col.Subscribe(t =>
+            {
+                if (++count == expected)
+                    evt.Set();
+            }, () => { });
+
+
+            evt.WaitOne();
+            evt.Reset();
+
+            Assert.Collection(col, col.Select(x => new Action<IPullRequestModel>(t => Assert.True(x.Title.StartsWith("Cache")))).ToArray());
         }

         [Fact]
         public async Task ExpiredIndexReturnsLive()
         {
+            var expected = 5;
+
             var username = "octocat";
             var reponame = "repo";

@@ -464,7 +476,7 @@

             var indexKey = string.Format(CultureInfo.InvariantCulture, "{0}|{1}|pr", user.Login, repo.Name);

-            var prcache = Enumerable.Range(1, 5)
+            var prcache = Enumerable.Range(1, expected)
                 .Select(id => CreatePullRequest(user, id, ItemState.Open, "Cache " + id, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 0));

             // seed the cache
@@ -479,25 +491,29 @@
             indexobj.UpdatedAt = DateTimeOffset.UtcNow - TimeSpan.FromMinutes(6);
             await cache.InsertObject(indexKey, indexobj);

-            var prlive = Observable.Range(1, 5)
-                .Select(id => CreatePullRequest(user, id, ItemState.Open, "Title " + id, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 0))
+            var prlive = Observable.Range(1, expected)
+                .Select(id => CreatePullRequest(user, id, ItemState.Open, "Live " + id, DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 0))
                 .DelaySubscription(TimeSpan.FromMilliseconds(10));

             apiClient.GetPullRequestsForRepository(user.Login, repo.Name).Returns(prlive);

             await modelService.InsertUser(new AccountCacheItem(user));
-            var col = modelService.GetPullRequests(repo);
-
-            col.Subscribe();
-
-            await prlive;
-
-            Assert.Equal(prlive.ToEnumerable().Select(x =>
-                    new PullRequestModel(x.Number, x.Title, act, x.CreatedAt, x.UpdatedAt)),
-                col);
-
-            Assert.Collection(col, prlive.ToEnumerable().Select(
-                x => new Action<IPullRequestModel>(t => Assert.Equal(x.Title, t.Title))).ToArray());
+            var source = modelService.GetPullRequests(repo);
+            var col = new TrackingCollection<IPullRequestModel>(source);
+
+            var count = 0;
+            var evt = new ManualResetEvent(false);
+            col.Subscribe(t =>
+            {
+                if (++count == expected * 2)
+                    evt.Set();
+            }, () => { });
+
+
+            evt.WaitOne();
+            evt.Reset();
+
+            Assert.Collection(col, col.Select(x => new Action<IPullRequestModel>(t => Assert.True(x.Title.StartsWith("Live")))).ToArray());
         }
     }


Fix TestCase failing in an infinite loop

--- osu.Game/Tests/Visual/TestCaseNotificationOverlay.cs
+++ osu.Game/Tests/Visual/TestCaseNotificationOverlay.cs
@@ -66,13 +66,11 @@

             progressingNotifications.RemoveAll(n => n.State == ProgressNotificationState.Completed);

-            while (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3)
+            if (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3)
             {
                 var p = progressingNotifications.FirstOrDefault(n => n.IsAlive && n.State == ProgressNotificationState.Queued);
-                if (p == null)
-                    break;
-
-                p.State = ProgressNotificationState.Active;
+                if (p != null)
+                    p.State = ProgressNotificationState.Active;
             }

             foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active))


Code cleanup.

Code cleanup.

--- src/VimeoDotNet/Authorization/AuthorizationClient.cs
+++ src/VimeoDotNet/Authorization/AuthorizationClient.cs
@@ -11,6 +11,7 @@

 namespace VimeoDotNet.Authorization
 {
+    /// <inheritdoc />
     /// <summary>
     /// Authorization client
     /// </summary>
@@ -19,13 +20,13 @@
         #region Private Properties

         /// <summary>
-        ///
+        /// Client Id
         /// </summary>
-        protected string ClientId { get; set; }
+        private string ClientId { get; }
         /// <summary>
-        ///
+        /// Client secret
         /// </summary>
-        protected string ClientSecret { get; set; }
+        private string ClientSecret { get; }

         #endregion

@@ -42,15 +43,7 @@
             ClientSecret = clientSecret;
         }

-        /// <summary>
-        /// Get authorization endpoint
-        /// </summary>
-        /// <param name="redirectUri">RedirectUri</param>
-        /// <param name="scope">Scope</param>
-        /// <param name="state">State</param>
-        /// <returns>Authorization endpoint</returns>
-        /// <exception cref="InvalidOperationException">Empty ClientId</exception>
-        /// <exception cref="ArgumentException">Empty redirectUri</exception>
+        /// <inheritdoc />
         public string GetAuthorizationEndpoint(string redirectUri, IEnumerable<string> scope, string state)
         {
             if (string.IsNullOrWhiteSpace(ClientId))
@@ -62,31 +55,21 @@
                 throw new ArgumentException("redirectUri should be a valid Uri");
             }

-            string queryString = BuildAuthorizeQueryString(redirectUri, scope, state);
+            var queryString = BuildAuthorizeQueryString(redirectUri, scope, state);
             return BuildUrl(Endpoints.Authorize, queryString);
         }

-        /// <summary>
-        /// GetAccessToken
-        /// </summary>
-        /// <param name="authorizationCode">AuthorizationCode</param>
-        /// <param name="redirectUri">RedirectUri</param>
-        /// <returns>Access token response</returns>
+        /// <inheritdoc />
         public AccessTokenResponse GetAccessToken(string authorizationCode, string redirectUri)
         {
             return GetAccessTokenAsync(authorizationCode, redirectUri).Result;
         }

-        /// <summary>
-        /// Get access token asynchronously
-        /// </summary>
-        /// <param name="authorizationCode">AuthorizationCode</param>
-        /// <param name="redirectUri">RedirectUri</param>
-        /// <returns>Access token response</returns>
+        /// <inheritdoc />
         public async Task<AccessTokenResponse> GetAccessTokenAsync(string authorizationCode, string redirectUri)
         {
-            ApiRequest request = BuildAccessTokenRequest(authorizationCode, redirectUri);
-            IApiResponse<AccessTokenResponse> result = await request.ExecuteRequestAsync<AccessTokenResponse>();
+            var request = BuildAccessTokenRequest(authorizationCode, redirectUri);
+            var result = await request.ExecuteRequestAsync<AccessTokenResponse>();
             return result.Content;
         }

@@ -102,7 +85,7 @@
         /// <returns>Access token request</returns>
         /// <exception cref="InvalidOperationException">Empty ClientId</exception>
         /// <exception cref="ArgumentException">Empty ClientSecret</exception>
-        protected ApiRequest BuildAccessTokenRequest(string authorizationCode, string redirectUri)
+        private ApiRequest BuildAccessTokenRequest(string authorizationCode, string redirectUri)
         {
             if (string.IsNullOrWhiteSpace(ClientId))
             {
@@ -122,9 +105,11 @@
                 throw new ArgumentException("redirectUri should be a valid Uri");
             }

-            var request = new ApiRequest(ClientId, ClientSecret);
-            request.Method = HttpMethod.Post;
-            request.Path = Endpoints.AccessToken;
+            var request = new ApiRequest(ClientId, ClientSecret)
+            {
+                Method = HttpMethod.Post,
+                Path = Endpoints.AccessToken
+            };
             SetAccessTokenQueryParams(request, authorizationCode, redirectUri);

             return request;
@@ -136,9 +121,9 @@
         /// <param name="route">Route</param>
         /// <param name="queryString">QueryString</param>
         /// <returns>URL</returns>
-        protected string BuildUrl(string route, string queryString)
+        private static string BuildUrl(string route, string queryString)
         {
-            return string.Format("{0}://{1}{2}{3}", Request.DefaultProtocol, Request.DefaultHostName, route, queryString);
+            return $"{Request.DefaultProtocol}://{Request.DefaultHostName}{route}{queryString}";
         }

         /// <summary>
@@ -147,7 +132,7 @@
         /// <param name="request">Request</param>
         /// <param name="authorizationCode">AuthorizationCode</param>
         /// <param name="redirectUri">RedirectUri</param>
-        protected void SetAccessTokenQueryParams(ApiRequest request, string authorizationCode, string redirectUri)
+        private static void SetAccessTokenQueryParams(IApiRequest request, string authorizationCode, string redirectUri)
         {
             request.Query.Add("grant_type", "authorization_code");
             request.Query.Add("code", authorizationCode);
@@ -161,23 +146,15 @@
         /// <param name="scope">Scope</param>
         /// <param name="state">State</param>
         /// <returns>Authorize query string</returns>
-        protected string BuildAuthorizeQueryString(string redirectUri, IEnumerable<string> scope, string state)
+        private string BuildAuthorizeQueryString(string redirectUri, IEnumerable<string> scope, string state)
         {
             var qsParams = new Dictionary<string, string>
             {
                 {"response_type", "code"},
                 {"client_id", ClientId},
-                {"redirect_uri", redirectUri}
+                {"redirect_uri", redirectUri},
+                {"scope", scope == null ? Scopes.Public : string.Join(" ", scope.ToArray())}
             };
-
-            if (scope == null)
-            {
-                qsParams.Add("scope", Scopes.Public);
-            }
-            else
-            {
-                qsParams.Add("scope", string.Join(" ", scope.ToArray()));
-            }

             if (!string.IsNullOrWhiteSpace(state))
             {
@@ -192,7 +169,7 @@
         /// </summary>
         /// <param name="queryParams">QueryParams</param>
         /// <returns>Query string</returns>
-        protected string GetQueryString(IDictionary<string, string> queryParams)
+        private static string GetQueryString(IDictionary<string, string> queryParams)
         {
             var sb = new StringBuilder("");
             foreach (var qsParam in queryParams)


Making TriggerEventWithShield async to avoid adding extra time to the command execution

That might be introduced by the CommandStarted/CommandFinished event handlers.

--- src/Vsix/Merq.Vsix/Components/CommandBusComponent.cs
+++ src/Vsix/Merq.Vsix/Components/CommandBusComponent.cs
@@ -24,7 +24,7 @@
 		[ImportingConstructor]
 		public CommandBusComponent([Import(typeof(Microsoft.VisualStudio.Shell.SVsServiceProvider))] IServiceProvider services)
 			: this((IComponentModel)services.GetService(typeof(SComponentModel)))
-		{
+		{
 		}

 		public CommandBusComponent(IComponentModel components)
@@ -74,7 +74,7 @@

 			Exception error = null;
 			var time = DateTime.UtcNow;
-			TriggerEventWithShield(CommandStarted, command);
+			TriggerEventWithShieldAsync(CommandStarted, command);
 			try
 			{
 				ForCommand().Execute((dynamic)command);
@@ -86,7 +86,7 @@
 			}
 			finally
 			{
-				TriggerEventWithShield(CommandFinished,
+				TriggerEventWithShieldAsync(CommandFinished,
 					new CommandFinishedEventArgs(
 						command,
 						error,
@@ -100,7 +100,7 @@

 			Exception error = null;
 			var time = DateTime.UtcNow;
-			TriggerEventWithShield(CommandStarted, command);
+			TriggerEventWithShieldAsync(CommandStarted, command);
 			try
 			{
 				return ForResult<TResult>().Execute((dynamic)command);
@@ -112,7 +112,7 @@
 			}
 			finally
 			{
-				TriggerEventWithShield(CommandFinished,
+				TriggerEventWithShieldAsync(CommandFinished,
 					new CommandFinishedEventArgs(
 						command,
 						error,
@@ -126,10 +126,10 @@

 			var time = DateTime.UtcNow;

-			TriggerEventWithShield(CommandStarted, command);
+			TriggerEventWithShieldAsync(CommandStarted, command);
 			var task = (Task)ForCommand().ExecuteAsync((dynamic)command, cancellation);
 			task.ContinueWith(t =>
-				TriggerEventWithShield(CommandFinished,
+				TriggerEventWithShieldAsync(CommandFinished,
 					new CommandFinishedEventArgs(
 						command,
 						t.Exception,
@@ -144,10 +144,10 @@

 			var time = DateTime.UtcNow;

-			TriggerEventWithShield(CommandStarted, command);
+			TriggerEventWithShieldAsync(CommandStarted, command);
 			var task = (Task<TResult>)ForResult<TResult>().ExecuteAsync((dynamic)command, cancellation);
 			task.ContinueWith(t =>
-				TriggerEventWithShield(CommandFinished,
+				TriggerEventWithShieldAsync(CommandFinished,
 					new CommandFinishedEventArgs(
 						command,
 						t.Exception,
@@ -156,19 +156,24 @@
 			return task;
 		}

-		void TriggerEventWithShield<T>(EventHandler<T> eventHandler, T args)
+		Task TriggerEventWithShieldAsync<T>(EventHandler<T> eventHandler, T args)
 		{
 			if (eventHandler != null)
 			{
-				foreach (var handler in eventHandler.GetInvocationList())
+				return Task.Run(() =>
 				{
-					try
+					foreach (var handler in eventHandler.GetInvocationList())
 					{
-						handler.DynamicInvoke(this, args);
+						try
+						{
+							handler.DynamicInvoke(this, args);
+						}
+						catch { }
 					}
-					catch { }
-				}
-			}
+				});
+			}
+
+			return Task.FromResult(true);
 		}

 		protected virtual void OnCommandStarted(IExecutable command)


Added missing method to workflow.

Added missing method to workflow.

--- src/Squidex.Domain.Apps.Entities/Contents/IContentWorkflow.cs
+++ src/Squidex.Domain.Apps.Entities/Contents/IContentWorkflow.cs
@@ -17,6 +17,8 @@

         Task<bool> IsValidNextStatus(IContentEntity content, Status2 next);

+        Task<bool> CanUpdateAsync(IContentEntity content);
+
         Task<Status2[]> GetNextsAsync(IContentEntity content);

         Task<Status2[]> GetAllAsync(ISchemaEntity schema);


Raj/SimonE add featur toggling for LiveChat on Article.cshtml

--- src/StockportWebapp/Views/stockportgov/Article/Article.cshtml
+++ src/StockportWebapp/Views/stockportgov/Article/Article.cshtml
@@ -1,4 +1,7 @@
 @model StockportWebapp.ViewModels.ArticleViewModel
+@using StockportWebapp.FeatureToggling
+@inject FeatureToggles featureToggles
+
 @{
     ViewData["Title"] = Model.Article.Title;
     ViewData["Description"] = Model.Article.Teaser;
@@ -11,7 +14,7 @@

-        <div id="uitest-page-has-loaded" class="l-body-section-filled @(Model.HasParentTopicWithSubItems() || Model.Article.LiveChatVisible
+


Fixing Error.GetHashCode() impl

Fixing Error.GetHashCode() impl

--- src/CommandLine/Error.cs
+++ src/CommandLine/Error.cs
@@ -127,7 +127,7 @@
         /// <remarks>A hash code for the current <see cref="System.Object"/>.</remarks>
         public override int GetHashCode()
         {
-            return Tag.GetHashCode();
+            return new { Tag, StopsProcessing }.GetHashCode();
         }

         /// <summary>


Disable some outerloop tests (#17623)

Disable some outerloop tests (#17623)

--- src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs
+++ src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs
@@ -111,6 +111,7 @@

         [OuterLoop] // TODO: Issue #11345
         [Theory, MemberData(nameof(EchoServers))]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #17621")] // show a debug assert window as it is failing in an Assert.
         public async Task PostUsingNoSpecifiedSemantics_UsesChunkedSemantics(Uri serverUri)
         {
             await PostHelper(serverUri, ExpectedContent, new StringContent(ExpectedContent),
@@ -137,6 +138,7 @@

         [OuterLoop] // TODO: Issue #11345
         [Theory, MemberData(nameof(BasicAuthEchoServers))]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #17621")] // show a debug assert window as it is failing in an Assert.
         public async Task PostRewindableContentUsingAuth_NoPreAuthenticate_Success(Uri serverUri)
         {
             HttpContent content = CustomContent.Create(ExpectedContent, true);
@@ -146,6 +148,7 @@

         [OuterLoop] // TODO: Issue #11345
         [Theory, MemberData(nameof(BasicAuthEchoServers))]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #17621")] // show a debug assert window as it is failing in an Assert.
         public async Task PostNonRewindableContentUsingAuth_NoPreAuthenticate_ThrowsInvalidOperationException(Uri serverUri)
         {
             HttpContent content = CustomContent.Create(ExpectedContent, false);


Make all mapped methods return Tasks

Make all mapped methods return Tasks

--- Source/GitReleaseManager.Cli/Program.cs
+++ Source/GitReleaseManager.Cli/Program.cs
@@ -41,7 +41,7 @@

             _mapper = AutoMapperConfiguration.Configure();

-            var result = Parser.Default.ParseArguments<CreateSubOptions, DiscardSubOptions, AddAssetSubOptions, CloseSubOptions, PublishSubOptions, ExportSubOptions, InitSubOptions, ShowConfigSubOptions, LabelSubOptions>(args)
+            return Parser.Default.ParseArguments<CreateSubOptions, DiscardSubOptions, AddAssetSubOptions, CloseSubOptions, PublishSubOptions, ExportSubOptions, InitSubOptions, ShowConfigSubOptions, LabelSubOptions>(args)
                 .WithParsed<BaseSubOptions>(CreateFiglet)
                 .MapResult(
                   (CreateSubOptions opts) => CreateReleaseAsync(opts),
@@ -50,12 +50,10 @@
                   (CloseSubOptions opts) => CloseMilestoneAsync(opts),
                   (PublishSubOptions opts) => PublishReleaseAsync(opts),
                   (ExportSubOptions opts) => ExportReleasesAsync(opts),
-                  (InitSubOptions opts) => Task.FromResult(CreateSampleConfigFile(opts)),
-                  (ShowConfigSubOptions opts) => Task.FromResult(ShowConfig(opts)),
+                  (InitSubOptions opts) => CreateSampleConfigFile(opts),
+                  (ShowConfigSubOptions opts) => ShowConfig(opts),
                   (LabelSubOptions opts) => CreateLabelsAsync(opts),
                   errs => Task.FromResult(1));
-
-            return result;
         }

         private static void CreateFiglet(BaseSubOptions options)
@@ -237,20 +235,20 @@
             }
         }

-        private static int CreateSampleConfigFile(InitSubOptions subOptions)
+        private static Task<int> CreateSampleConfigFile(InitSubOptions subOptions)
         {
             ConfigureLogging(subOptions.LogFilePath);

             ConfigurationProvider.WriteSample(subOptions.TargetDirectory ?? Environment.CurrentDirectory, _fileSystem);
-            return 0;
-        }
-
-        private static int ShowConfig(ShowConfigSubOptions subOptions)
+            return Task.FromResult(0);
+        }
+
+        private static Task<int> ShowConfig(ShowConfigSubOptions subOptions)
         {
             ConfigureLogging(subOptions.LogFilePath);

             Console.WriteLine(ConfigurationProvider.GetEffectiveConfigAsString(subOptions.TargetDirectory ?? Environment.CurrentDirectory, _fileSystem));
-            return 0;
+            return Task.FromResult(0);
         }

         private static async Task<int> CreateLabelsAsync(LabelSubOptions subOptions)


generate smaller dsa with keysize=1024 so that osx is happy

--- src/System.Security.Cryptography.Xml/tests/DSAKeyValueTest.cs
+++ src/System.Security.Cryptography.Xml/tests/DSAKeyValueTest.cs
@@ -127,12 +127,12 @@
         [Fact]
         public void ImportDSAKeyValue()
         {
-            string p = "nHoAAyz1ZrA/4ajJnY09oVYvr/juj6cJHhVKnrIpIlWRh2EHIFsDiHR7hFvTvvTwmPiNRKBqO7Q1LST5qabEkvbvhk11d5wwItTWmLqO969NkUzA2cTqebEdshDhnl8YN7DrkCdrYu0PE0ZL/ho5yp6aRYME/Zoq2qDet+He3v9ZkjlJLg5mLPK6Q6tmLeSNTob/6fABv1RCREsyvYegWp4TxLvrgb/fd6Wtt7GC4fwWQlBeRmBIYFklNcE2g6iYMQOkgM7D/a0YrhUI3Vy3vfFNR/kKF+OBhB82V+QPhqPbdkXA+StpwOYj48mHHyr3ZvmlQdHJSkEY/p5JFbG8vw==";
-            string q = "ni1fE84dSrJerbAmEAYI/0w+q97KSFmqrzUFyHk2V48=";
-            string g = "m46FXiDGgIUpO7ehefrbdGqVn1+VOEc6Cyxi5xKXIDTYtLST6wy+FPybWOuYv1Sya8AeEOmz6HAht/k3GQZwVkt1ZSZCJZw8/p/zwyHTST+NdnCHXGDGvFh/wnEa0UsmTBmqBsxPiCOahWXsQ4VvTI5exRsu+/qwc/Nqbw1K8eq6pzn67ZA2/RyLepLPZGBo9vkdPmYtFKRj3PmC7/mjVWfA3tyPa0coFIx9XtjPiVtnmG9lJ9dVhGIY2cO7j8iDdBLdx6enMu67sDyHlPBDpLYSRx2Qqkcy1IdlAyxF6fOnxsDBC/N7LXNHea52XQn1TO2CvbIG7KXI8SxLr+CVbA==";
-            string y = "Yt23Dtp7UT1h/HsE6qlLBX+PIwdK0N0p0wFdWmIkw91hD41Y7OKC5xXs5jkHqSfQtiGYsUaS4aYoxQiuE9wnjiPUEii5Zau7s3jVkeZAvmRDQkjvl6SPb7kNIcw2PYdL9wSsL1euaTCWeH6m7fhO0tBJN0INYFXZ3ca4bWBYwNgs2UgCooaoO2df6eMf/1rFSr5gDZLqOtGgXJTOvb1MO/R8pTmaNmbkpGp4X5ApbExzqyb9v4dPNna3qgPBJn0vwTw0RUyLPlFOjaMHBeoRuC77e2TNqVMXGxRRnlB25XJsCsFY/+bePsPQZXGIFB1gsMzDtB/M6WKcPuAsevZDrw==";
-            string seed = "3Y9u5gc5dVKPhwiUzwmMV09ojummGzJ87A0llG9ey60=";
-            string pgenCounter = "AWs=";
+            string p = "kkos0S7rZLGluCzOcQ/S9L79be47MxRp3kB07vkX+iin4daLcSo1pg/K9aP0UJzZAKUAyT8uj7jci6c5sfVWdqmlRqtm0mwnfh88JgmH/Eu5LkMrUAV2gDQ8Cs8ihd2UbbQ0s47P65qrINVpkHaNOFJbz8vcSP598kNLg73QKh0=";
+            string q = "l4A4DwlgltuK00dcNNW5Yw2SbcM=";
+            string g = "NiI1mc0jI7JQa21Pbxo2e87cJtUfO1kCor0LHbOk1T0W5h6uhIgdNwlmE/ARTqfcw+RamtHTEI9HfxTg1TCNPQnWYenEIOGaot0qRZs2a2WzD2xjictcEA2D8up0sqpK/qTcnNV9g6hcc3HAm9mU6DjQ21MOsIoYbQB1VW91FrA=";
+            string y = "Q2vVSH6O8/v6jJq4r3PQaCLKThnbRXxluEq9mEY0XnXTwefwTJ67fUcCxhJJhwh157gQN2LWmte5gnM11VJMWT07DLIGPb7he2wPRGmgnS4nkChGgJGKXss5unzFkX4m+BxCCXZrClrJyahlZWAJY5CbLanzHSZQtRHIDdINxf4=";
+            string seed = "zfYSHDy431BKUVSpA6KqGnCsbrE=";
+            string pgenCounter = "sg==";
             string dsaKeyXml = $@"<KeyInfo xmlns=""http://www.w3.org/2000/09/xmldsig#""><KeyValue><DSAKeyValue><P>{p}</P><Q>{q}</Q><G>{g}</G><Y>{y}</Y><Seed>{seed}</Seed><PgenCounter>{pgenCounter}</PgenCounter></DSAKeyValue></KeyValue></KeyInfo>";

             var expected = new Dictionary<string, string>()


Update appversion

Update appversion

--- Source/Norma.Eta/Models/AbemaApiHost.cs
+++ Source/Norma.Eta/Models/AbemaApiHost.cs
@@ -30,7 +30,7 @@
                 {
                     var token = _abemaTv.Root.Token(osName => "pc", osVersion => "1.0.0",
                                                     osLang => "ja", osTimezone => "Asia/Tokyo",
-                                                    appVersion => "v1.0.34");
+                                                    appVersion => "v1.0.41");
                     Debug.WriteLine($"AccessToken is valid : {token.Token}");
                 }
                 catch


expecting the exception to be thrown

expecting the exception to be thrown

--- Source/SODA.Tests/Unit/ResourceTests.cs
+++ Source/SODA.Tests/Unit/ResourceTests.cs
@@ -89,6 +89,7 @@

         [TestCase(StringMocks.EmptyInput)]
         [TestCase(StringMocks.NullInput)]
+        [ExpectedException(typeof(ArgumentException))]
         [Category("Resource")]
         public void GetRecord_With_Invalid_RecordId_Throws_ArugmentException(string input)
         {


[*] Исправлена ошибка при попытке поиска подзапроса из sql параметра

--- Source/SqlQuery/SelectQueryOptimizer.cs
+++ Source/SqlQuery/SelectQueryOptimizer.cs
@@ -294,7 +294,7 @@
         private static bool CheckColumn(IColumn column, IQueryExpression expr, ISelectQuery query, bool optimizeValues,
             bool optimizeColumns)
         {
-            if (expr is ISqlField || expr is IColumn)
+            if (expr is ISqlField || expr is IColumn || expr is ISqlParameter)
             {
                 return false;
             }


Adding braces

Adding braces

--- Tests/System/Threading/Tasks/ParallelForTest.cs
+++ Tests/System/Threading/Tasks/ParallelForTest.cs
@@ -156,19 +156,29 @@
         internal void RealRun()
         {
             if (_parameters.Api == Api.For64)
+            {
                 RunParallelFor64Test();
+            }
             else if (_parameters.Api == Api.For)
+            {
                 RunParallelForTest();
-            else
+            }
+            else
+            {
                 RunParallelForeachTest();
+            }

             // verify result
             for (int i = 0; i < _parameters.Count; i++)
+            {
                 Verify(i);
+            }

             // verify unique  index sequences if run WithLocal
             if (_parameters.LocalOption != ActionWithLocal.None)
+            {
                 VerifySequences();
+            }
         }

         private static List<int> ThreadLocalInit()
@@ -255,9 +265,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, Work);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, Work);
+                }
             }
             else
             {
@@ -271,9 +285,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, WorkWithIndexAndStopPartitioner);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, WorkWithIndexAndStopPartitioner);
+                }
             }
             else
             {
@@ -286,9 +304,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, ThreadLocalInit, WorkWithLocal, ThreadLocalFinally);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, ThreadLocalInit, WorkWithLocal, ThreadLocalFinally);
+                }
             }
             else
             {
@@ -301,9 +323,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, ThreadLocalInit, WorkWithLocalAndIndexPartitioner, ThreadLocalFinally);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, ThreadLocalInit, WorkWithLocalAndIndexPartitioner, ThreadLocalFinally);
+                }
             }
             else
             {
@@ -316,9 +342,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, _parallelOption, Work);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, _parallelOption, Work);
+                }
             }
             else
             {
@@ -331,9 +361,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, _parallelOption, WorkWithIndexAndStopPartitioner);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, _parallelOption, WorkWithIndexAndStopPartitioner);
+                }
             }
             else
             {
@@ -346,9 +380,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, _parallelOption, ThreadLocalInit, WorkWithLocal, ThreadLocalFinally);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, _parallelOption, ThreadLocalInit, WorkWithLocal, ThreadLocalFinally);
+                }
             }
             else
             {
@@ -361,9 +399,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, _parallelOption, ThreadLocalInit, WorkWithLocalAndIndexPartitioner, ThreadLocalFinally);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, _parallelOption, ThreadLocalInit, WorkWithLocalAndIndexPartitioner, ThreadLocalFinally);
+                }
             }
             else
             {
@@ -376,9 +418,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, _parallelOption, WorkWithStop);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, _parallelOption, WorkWithStop);
+                }
             }
             else
             {
@@ -391,9 +437,13 @@
             if (_parameters.ParallelForeachDataSourceType == DataSourceType.Partitioner)
             {
                 if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+                {
                     Parallel.ForEach(_rangePartitioner, WorkWithStop);
+                }
                 else
+                {
                     Parallel.ForEach(_partitioner, WorkWithStop);
+                }
             }
             else
             {
@@ -455,24 +505,38 @@
         {
             int length = _parameters.Count;
             if (length < 0)
+            {
                 length = 0;
+            }

             int[] arrayCollection = new int[length];
             for (int i = 0; i < length; i++)
+            {
                 arrayCollection[i] = _parameters.StartIndex + i;
+            }

             if (_parameters.Api == Api.ForeachOnArray)
+            {
                 _collection = arrayCollection;
+            }
             else if (_parameters.Api == Api.ForeachOnList)
+            {
                 _collection = new List<int>(arrayCollection);
-            else
+            }
+            else
+            {
                 _collection = arrayCollection;
+            }

             //if source is partitioner
             if (_parameters.PartitionerType == PartitionerType.RangePartitioner)
+            {
                 _rangePartitioner = PartitionerFactory.Create(_parameters.PartitionerType, _parameters.StartIndex, _parameters.StartIndex + _parameters.Count, _parameters.ChunkSize);
-            else
+            }
+            else
+            {
                 _partitioner = PartitionerFactory<int>.Create(_parameters.PartitionerType, _collection);
+            }

             if (_parameters.ParallelOption != WithParallelOption.None)
             {
@@ -489,18 +553,26 @@
                     {
                         // call Parallel.Foreach with ParallelLoopState and ParallelOptions
                         if (_parameters.Api == Api.Foreach)
+                        {
                             ParallelForEachWithOptionsAndState();
+                        }
                         else // call indexed version for array / list overloads - to avoid calling too many combinations
+                        {
                             ParallelForEachWithOptionsAndIndexAndState();
+                        }
                     }
                 }
                 else if (_parameters.LocalOption == ActionWithLocal.HasFinally)
                 {
                     // call Parallel.Foreach and ParallelLoopState<TLocal>, plus threadLocalFinally, plus ParallelOptions
                     if (_parameters.Api == Api.Foreach)
+                    {
                         ParallelForEachWithOptionsAndLocal();
+                    }
                     else // call indexed version for array / list overloads - to avoid calling too many combinations
+                    {
                         ParallelForEachWithOptionsAndLocalAndIndex();
+                    }
                 }
             }
             else
@@ -516,18 +588,26 @@
                     {
                         // call Parallel.Foreach with ParallelLoopState
                         if (_parameters.Api == Api.Foreach)
+                        {
                             ParallelForEachWithState();
+                        }
                         else // call indexed version for array / list overloads - to avoid calling too many combinations
+                        {
                             ParallelForEachWithIndexAndState();
+                        }
                     }
                 }
                 else if (_parameters.LocalOption == ActionWithLocal.HasFinally)
                 {
                     // call Parallel.Foreach and ParallelLoopState<TLocal>, plus threadLocalFinally
                     if (_parameters.Api == Api.Foreach)
+                    {
                         ParallelForeachWithLocal();
+                    }
                     else // call indexed version for array / list overloads - to avoid calling too many combinations
+                    {
                         ParallelForeachWithLocalAndIndex();
+                    }
                 }
             }
         }
@@ -676,7 +756,9 @@
                 }

                 if (index > (_parameters.StartIndex + (_parameters.Count / 2)))
+                {
                     state.Stop();
+                }
             }

             return threadLocalValue;
@@ -694,7 +776,9 @@
             }

             if (index > (_parameters.StartIndex + (_parameters.Count / 2)))
+            {
                 state.Stop();
+            }

             return threadLocalValue;
         }
@@ -715,7 +799,9 @@
             Work(i);

             if (index > (_parameters.Count / 2))
+            {
                 state.Stop();
+            }
         }

         // workload for Foreach overload that takes a range partitioner
@@ -761,7 +847,9 @@
             }

             if (i > (_parameters.StartIndex + (_parameters.Count / 2)))
+            {
                 state.Stop();
+            }

             return threadLocalValue;
         }
@@ -778,7 +866,9 @@
             }

             if (i > (_parameters.StartIndex64 + (_parameters.Count / 2)))
+            {
                 state.Stop();
+            }

             return threadLocalValue;
         }
@@ -821,7 +911,9 @@
         {
             Work(i);
             if (i > (_parameters.StartIndex + (_parameters.Count / 2)))
+            {
                 state.Stop(); // if the current index is in the second half range, try stop all
+            }
         }

         // workload for Foreach overload that takes a range partitioner
@@ -839,7 +931,9 @@
         {
             Work(i);
             if (i > (_parameters.StartIndex64 + (_parameters.Count / 2)))
+            {
                 state.Stop();
+            }
         }
     }


Menu {Save Load Clear} Buttons

Menu {Save Load Clear} Buttons

--- ArenaBuilder/Assets/Scripts/Arena/AdvanceBrain.cs
+++ ArenaBuilder/Assets/Scripts/Arena/AdvanceBrain.cs
@@ -77,6 +77,7 @@
         public static Matrix4x4 GUIMatrix;
         private readonly GUILocationHelper _location = new GUILocationHelper();
         private readonly string[] _menuStrings = {"Create", "Edit", "Erase", "Move"};
+        private readonly string[] _otherMenuStrings = {"Save", "Load", "Clear"};
         private bool _guiMenuToggle;
         private bool _inPlayMode;

@@ -123,7 +124,11 @@
             ShowGridLines = GUI.Toggle(new Rect(_location.Offset.x - 100, 0, 100, 60), ShowGridLines, "#", "Button");

             if (_guiMenuToggle)
+            {
                 DrawMenu();
+                DrawSaveLoadButtons();
+            }
+            DrawPlayControl();

             switch (BrainState)
             {
@@ -139,9 +144,6 @@
                     break;
             }

-            DrawPlayControl();
-            DrawSaveLoadButtons();
-
             GUI.matrix = Matrix4x4.identity;
         }

@@ -228,17 +230,37 @@

         private void DrawSaveLoadButtons()
         {
-            if (GUI.Button(new Rect(_location.Offset.x - 180, 70, 150, 90), "SAVE"))
-            {
-                GameGrid.SaveDataToXML(MapName);
-            }
-            if (GUI.Button(new Rect(_location.Offset.x - 180, 180, 150, 90), "LOAD"))
-            {
-                GameGrid.LoadDataFromXML(MapName, _deployableDictionary);
-            }
-            if (GUI.Button(new Rect(_location.Offset.x - 180, 290, 150, 90), "Clear"))
-            {
-                GameGrid.ClearEntireGrid();
+            Event e = Event.current;
+            for (int i = 0, n = _otherMenuStrings.Length; i < n; i++)
+            {
+                var buttonRect = new Rect(_location.Offset.x - 180, 70 + i*90, 150, 75);
+
+                if (e.isMouse && buttonRect.Contains(e.mousePosition))
+                {
+                    if (e.type == EventType.mouseDown)
+                    {
+                        _onGui = true;
+
+                        switch (i)
+                        {
+                            case 0:
+                                GameGrid.SaveDataToXML(MapName);
+                                break;
+                            case 1:
+                                GameGrid.LoadDataFromXML(MapName, _deployableDictionary);
+                                break;
+                            case 2:
+                                GameGrid.ClearEntireGrid();
+                                break;
+                        }
+                    }
+                    else
+                    {
+                        _onGui = false;
+                    }
+                }
+
+                GUI.Button(buttonRect, _otherMenuStrings[i]);
             }
         }


Dispose the surface.

Dispose the surface.

svn path=/trunk/; revision=2888

--- src/Editors/SoftFocus.cs
+++ src/Editors/SoftFocus.cs
@@ -79,6 +79,7 @@
 				Context ctx = new Context (dest);
 				effect.OnExpose (ctx, info.Bounds);
 				((IDisposable)ctx).Dispose ();
+				dest.Destroy ();

 				string tmp = ImageFile.TempPath (item.Current.DefaultVersionUri.LocalPath);
 				using (Gdk.Pixbuf output = Widgets.CairoUtils.CreatePixbuf (dest)) {


Fixed disposable

Fixed disposable

--- Sources/Silphid.Showzup/Sources/View.cs
+++ Sources/Silphid.Showzup/Sources/View.cs
@@ -102,8 +102,7 @@
                     image.enabled = true;

                     if (uri.Scheme == Scheme.Http || uri.Scheme == Scheme.Https || uri.Scheme == Scheme.StreamingAsset)
-                        Disposable.Create(x.Dispose)
-                            .AddTo(this);
+                        x.AddTo(this);
                 })
                 .AutoDetach()
                 .AsSingleUnitObservable();


Post Attributes

Post Attributes

--- Unity/Assets/Scripts/ConducttrPOSTattributes.cs
+++ Unity/Assets/Scripts/ConducttrPOSTattributes.cs
@@ -24,18 +24,18 @@
 		audience_email = GUI.TextField ( new Rect (90, 0, 200, 30), audience_email,25 );

 		attribute1 = GUI.TextField ( new Rect (90, 30, 100, 20), attribute1,25 );
-		attribute1 = GUI.TextField ( new Rect (90, 50, 100, 20), attribute2,25 );
-		attribute1 = GUI.TextField ( new Rect (90, 70, 100, 20), attribute3,25 );
+		attribute2 = GUI.TextField ( new Rect (90, 50, 100, 20), attribute2,25 );
+		attribute3 = GUI.TextField ( new Rect (90, 70, 100, 20), attribute3,25 );

 		if ( GUI.Button ( new Rect (90, 130, 200, 100) , "Set Attributes" ) ){ //just a button
-			setAttributes(audience_email,analSexSelected,askHIVSelected,completedSexActs,avatarHealth,communityHealth,condoms,attempts,avatarRisk,partnerRisk,avatarName,partnerName);
+			setAttributes(audience_email,attribute1,attribute2,attribute3);

 		}
 		if (Event.current.keyCode == KeyCode.Return) {

-			setAttributes(audience_email,analSexSelected,askHIVSelected,completedSexActs,avatarHealth,communityHealth,condoms,attempts,avatarRisk,partnerRisk,avatarName,partnerName);
+			setAttributes(audience_email,attribute1,attribute2,attribute3);
 		}
 	}

@@ -65,7 +65,7 @@
 		}
 	}

-	public void setAttributes(string audience_email, string analSexSelected, string askHIVSelected, string completedSexActs, string avatarHealth, string communityHealth, string condoms, string attempts, string avatarRisk, string partnerRisk, string avatarName, string partnerName){
+	public void setAttributes(string attribute1, string attribute2, string attribute3){
 		try{
 			//ServicePointManager.ServerCertificateValidationCallback =ValidateServerCertficate;
 			System.Net.ServicePointManager.ServerCertificateValidationCallback += (s,ce,ca,p) => true;


Remove unused attribute.

Remove unused attribute.

--- src/Generator/Library.cs
+++ src/Generator/Library.cs
@@ -3,15 +3,9 @@
 using System.Globalization;
 using System.Linq;
 using System.Text.RegularExpressions;
-using CppSharp.Generators;

 namespace CppSharp
 {
-    [AttributeUsage(AttributeTargets.Class)]
-    public class LibraryTransformAttribute : Attribute
-    {
-    }
-
     /// <summary>
     /// Used to massage the library types into something more .NET friendly.
     /// </summary>


Document recently added GenerationOutputMode option.

--- src/Generator/Options.cs
+++ src/Generator/Options.cs
@@ -155,6 +155,12 @@
             }
         }

+        /// <summary>
+        /// Sets the generation output mode which affects how output files are
+        /// generated, either as one output file per binding module, or as one
+        /// output file for each input translation unit.
+        /// Note: Currently only available for C# generator.
+        /// </summary>
         public GenerationOutputMode GenerationOutputMode { get; set; } =
             GenerationOutputMode.FilePerModule;