and now fixup signed integral types; exhaustive tests run successfully

--- Jil/Deserialize/Methods.ReadNumbers.cs
+++ Jil/Deserialize/Methods.ReadNumbers.cs
@@ -143,12 +143,14 @@
                 if (c == -1) throw new DeserializationException("Expected digit", reader, true);
             }

+            var firstDigitZero = c == '0';
             c = c - '0';
             if (c < 0 || c > 9) throw new DeserializationException("Expected digit", reader, false);
             ret += c;

             // digit #2
             c = reader.Peek();
+            if (firstDigitZero && c == '0') throw new DeserializationException("Number cannot have leading zeros", reader, false);
             c = c - '0';
             if (c < 0 || c > 9) return (sbyte)(ret * (negative ? -1 : 1));
             reader.Read();
@@ -193,12 +195,14 @@
                 if (c == -1) throw new DeserializationException("Expected digit", reader, true);
             }

+            var firstDigitZero = c == '0';
             c = c - '0';
             if (c < 0 || c > 9) throw new DeserializationException("Expected digit", reader, false);
             ret += c;

             // digit #2
             c = reader.Peek();
+            if (firstDigitZero && c == '0') throw new DeserializationException("Number cannot have leading zeros", reader, false);
             c = c - '0';
             if (c < 0 || c > 9) return (short)(ret * (negative ? -1 : 1));
             reader.Read();
@@ -319,12 +323,14 @@
                 if (c == -1) throw new DeserializationException("Expected digit", reader, true);
             }

+            var firstDigitZero = c == '0';
             c = c - '0';
             if (c < 0 || c > 9) throw new DeserializationException("Expected digit", reader, false);
             ret += c;

             // digit #2
             c = reader.Peek();
+            if (firstDigitZero && c == '0') throw new DeserializationException("Number cannot have leading zeros", reader, false);
             c = c - '0';
             if (c < 0 || c > 9) return (int)(ret * (negative ? -1 : 1));
             reader.Read();
@@ -525,12 +531,14 @@
                 if (c == -1) throw new DeserializationException("Expected digit", reader, true);
             }

+            var firstDigitZero = c == '0';
             c = c - '0';
             if (c < 0 || c > 9) throw new DeserializationException("Expected digit", reader, false);
             ret += (uint)c;

             // digit #2
             c = reader.Peek();
+            if (firstDigitZero && c == '0') throw new DeserializationException("Number cannot have leading zeros", reader, false);
             c = c - '0';
             if (c < 0 || c > 9) return ((long)ret * (negative ? -1 : 1));
             reader.Read();


Generalized Moore's voting. Not proud

Generalized Moore's voting. Not proud

--- LeetCode/remote/majority_element_II.cs
+++ LeetCode/remote/majority_element_II.cs
@@ -13,11 +13,21 @@
         public int Count { get; set; }
     }

+    //
+    //  Submission Details
+    //  64 / 64 test cases passed.
+    //      Status: Accepted
+    //      Runtime: 596 ms
+    //
+    //          Submitted: 0 minutes ago
+    //
+    //  https://leetcode.com/submissions/detail/50653272/
+    //
     public IList<int> MajorityElement(int[] nums) {
         var pairs = new List<Pair>();
         foreach (var num in nums)
         {
-            if (pairs.Count < 2)
+            if (pairs.Count < nums.Length / 3 + 3)
             {
                 pairs.Add(new Pair { Value = num, Count = 1 });
                 continue;
@@ -44,7 +54,6 @@
             }
         }

-        Console.WriteLine(String.Join(", ", pairs.Select(x => x.Value + " . " + x.Count + " ")));
         return pairs
                .Select(x => x.Value)
                .Distinct()
@@ -59,6 +68,7 @@
         Console.WriteLine(String.Join(", ", s.MajorityElement(new [] { 1, 1, 1, 3, 3, 2, 2, 2 })));
         Console.WriteLine(String.Join(", ", s.MajorityElement(new [] { 2, 2, 1, 3 })));
         Console.WriteLine(String.Join(", ", s.MajorityElement(new [] { 4, 2, 1, 1 })));
+        Console.WriteLine(String.Join(", ", s.MajorityElement(new [] { 1, 2 })));
         Console.WriteLine(String.Join(", ", s.MajorityElement(
                                                 Enumerable
                                                 .Repeat(1, 6)


added more tests. (strict setup)

added more tests. (strict setup)

--- MoqTipsAndTricks/BasketManagerTests.cs
+++ MoqTipsAndTricks/BasketManagerTests.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Linq;
 using Moq;
 using Xunit;
@@ -9,37 +10,38 @@
     {
         [Fact]
         [Trait("Category", "1")]
-        public void AllMockedByDefault()
+        public void ShouldThrowAnExceptionIfNonVirtualClassMethodsAndPropertiesUsed()
         {
             var basketMock = new Mock<Basket>();
             var basketManager = new BasketManager(basketMock.Object);

-            basketManager.AddProduct(It.IsAny<Product>());
+            basketManager.AddProduct(new Product());

-            basketMock.Verify(basket => basket.AddProduct(new Product()));
+            //basketMock.Verify(basket => basket.AddProduct(new Product()));
+            Assert.ThrowsAny<Exception>(() => basketMock.Verify(basket => basket.AddProduct(new Product())));
         }

-        //[Fact]
-        //[Trait("Category", "1")]
-        //public void AllMockedByDefault()
-        //{
-        //    var basketMock = new Mock<IBasket>();
-        //    var basketManager = new BasketManagerWithInterface(basketMock.Object);
-
-        //    basketMock.Setup(basket => basket.AddProduct(new Product()));
-        //    basketManager.AddProduct(new Product());
-
-        //    basketMock.Verify(basket => basket.AddProduct(It.IsAny<Product>()));
-        //}
-
         [Fact]
-        [Trait("Category", "2")]
-        public void dd()
+        [Trait("Category", "1")]
+        public void AllMockedByDefault()
         {
             var basketMock = new Mock<IBasket>();
             var basketManager = new BasketManagerWithInterface(basketMock.Object);
+
+            basketManager.AddProduct(new Product());

-           //basketMock.Setup(basket => basket.AddProduct(new Product()));
+            basketMock.Verify(basket => basket.AddProduct(It.IsAny<Product>()));
+        }
+
+        [Fact]
+        [Trait("Category", "1")]
+        public void StrictSetup()
+        {
+            var basketMock = new Mock<IBasket>(MockBehavior.Strict);
+            var basketManager = new BasketManagerWithInterface(basketMock.Object);
+            basketMock.Setup(basket => basket.AddProduct(It.IsAny<Product>()));
+            //basketMock.Setup(basket => basket.AddProduct(new Product()));
+
             basketManager.AddProduct(new Product());

             basketMock.Verify(basket => basket.AddProduct(It.IsAny<Product>()));


hotfix

hotfix

--- MotorwaySimulator/MotorwaySimulator.cs
+++ MotorwaySimulator/MotorwaySimulator.cs
@@ -946,7 +946,7 @@
             ChosenInterArrivalVariationPercentage = -1;

             ActiveStoppingTime = StoppingTime;
-            .
+
             int laneWidth = VehicleWidthPixels + (2 * LaneMarginPixels);

             // Calculate the size of the road


fixed nclang dll location.

fixed nclang dll location.

--- NClang/NClang.Native/CSharpSpecific.cs
+++ NClang/NClang.Native/CSharpSpecific.cs
@@ -7,7 +7,7 @@
 {
 	static partial class LibClang
 	{
-        public const string LibraryName = "NativeLibs/libclang";
+        public const string LibraryName = "libclang";
         public const System.Runtime.InteropServices.CallingConvention LibraryCallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl;

 		public static ClangFile Wrap (this IntPtr cxFile)


collison has to be more robust

collison has to be more robust

--- NanoGames.Games/Banana/Intersection.cs
+++ NanoGames.Games/Banana/Intersection.cs
@@ -18,7 +18,7 @@
         public bool IsTrue = false;
         public Vector Point;

-        private double epsilon = 0.000001;
+        private double epsilon = 0.001;

         public Intersection(Vector p11, Vector p12, Vector p21, Vector p22)
         {


Tidied up code and added basic !includeCurrentData logic copied over from NavigationHyperLink

--- Navigation/Mvc/MvcStateRouteHandler.cs
+++ Navigation/Mvc/MvcStateRouteHandler.cs
@@ -45,17 +45,16 @@
 			var link = queryString["refreshajax"];
 			if (link != null)
 			{
-				var toData = new Dictionary<string, object>();
-				foreach (NavigationDataItem item in new NavigationData(true))
+				var toData = new NavigationData(true);
+				foreach (NavigationDataItem item in StateContext.Data)
 				{
-					if (!item.Value.Equals(string.Empty) && !StateContext.State.DefaultOrDerived(item.Key, item.Value))
-						toData[item.Key] = item.Value;
+					if (item.Value.Equals(string.Empty) || StateContext.State.DefaultOrDerived(item.Key, item.Value))
+						toData[item.Key] = null;
 				}
 				StateController.NavigateLink(State, link, NavigationMode.Mock);
-				var currentData = new NavigationData(true);
+				RefreshAjaxInfo.GetInfo(requestContext.HttpContext).Data = new NavigationData(true);
 				var includeCurrentData = false;
-				if (queryString["includecurrent"] != null)
-					includeCurrentData = bool.Parse(queryString["includecurrent"]);
+				bool.TryParse(queryString["includecurrent"], out includeCurrentData);
 				var currentDataKeys = GetCurrentDataKeyEnumerator(queryString["currentkeys"] ?? string.Empty);
 				if (includeCurrentData)
 				{
@@ -64,11 +63,11 @@
 				}
 				else
 				{
+					var currentData = new NavigationData(currentDataKeys);
 					StateContext.Data.Clear();
+					StateContext.Data.Add(currentData);
 				}
-				foreach (var item in toData)
-					StateContext.Data[item.Key] = item.Value;
-				RefreshAjaxInfo.GetInfo(requestContext.HttpContext).Data = currentData;
+				StateContext.Data.Add(toData);
 			}
 			return base.GetHttpHandler(requestContext);
 		}


Remove readkey

Remove readkey

--- NeuralNetwork/NeuralLibrary/Trainer.cs
+++ NeuralNetwork/NeuralLibrary/Trainer.cs
@@ -69,7 +69,6 @@
                 }

 #if DEBUG
-                Console.ReadKey();
                 Console.WriteLine("Epoch {0}: Error = {1}", epoch, error);
 #endif
             }


CSharp plugins with dependencies will now fail correctly when their batch fails

--- Oxide.Ext.CSharp/CSharpPluginLoader.cs
+++ Oxide.Ext.CSharp/CSharpPluginLoader.cs
@@ -181,6 +181,12 @@
                 {
                     var plugin_names = plugins.Select(pl => pl.Name);
                     var standalone_plugins = plugins.Where(pl => !pl.Requires.Any(r => plugin_names.Contains(r))).ToArray();
+                    foreach (var plugin in standalone_plugins) plugins.Remove(plugin);
+                    foreach (var plugin in plugins)
+                    {
+                        plugin.OnCompilationFailed();
+                        PluginErrors[plugin.Name] = "Batch containing dependencies failed to compile";
+                    }
                     if (standalone_plugins.Length < 1)
                     {
                         Interface.Oxide.LogError($"A batch of {plugins.Count} plugins failed to compile");


Possible bugfix to base brush. Only play if !isplaying.

--- PitchPaint/Assets/Scripts/BaseBrush.cs
+++ PitchPaint/Assets/Scripts/BaseBrush.cs
@@ -76,7 +76,8 @@
         //pt.sample = TestClip;
         currentLine.GetComponent<Line>().AddPoint(pt,true);
 		pt.sample = pt.GetComponent<AudioSource> ();
-		pt.sample.Play ();
+		if(!pt.sample.isPlaying)
+			pt.sample.Play ();
     }

     void MoveCurrentCylinder(Vector3 lastPos, Vector3 currentPos)
@@ -101,7 +102,8 @@
 			//pt.sample = TestClip;
 			currentLine.GetComponent<Line>().AddPoint(pt,true);
 			pt.sample = pt.GetComponent<AudioSource> ();
-			pt.sample.Play ();
+			if(!pt.sample.isPlaying)
+				pt.sample.Play ();
 			currentTime = 0;
             lastPoint = handPos;
 		}


assembly version

assembly version

--- PocketSharp/Properties/AssemblyInfo.cs
+++ PocketSharp/Properties/AssemblyInfo.cs
@@ -22,5 +22,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("4.1.5")]
-[assembly: AssemblyFileVersion("4.1.5")]+[assembly: AssemblyVersion("4.1.5.1")]
+[assembly: AssemblyFileVersion("4.1.5.1")]


Fixed an offset error in buffering

Fixed an offset error in buffering

--- Providers/Network/NetworkConnection.cs
+++ Providers/Network/NetworkConnection.cs
@@ -269,11 +269,14 @@
 				}

 				if (remainingData < length)
+				{
+					bufferOffset += remainingData;
 					break;
+				}

 				DeliverMessage (p, buffer, messageOffset);
 				messageOffset += length;
-				bufferOffset += length;
+				bufferOffset = messageOffset;
 				remainingData -= length;
 			}


Refactor basic implementation of #125

Refactor basic implementation of #125

--- R7.Documents.Dnn/EditDocuments.ascx.cs
+++ R7.Documents.Dnn/EditDocuments.ascx.cs
@@ -227,11 +227,24 @@

         void LoadDocument ()
         {
+            var moduleTitle = ModuleController.Instance.GetModule (ModuleId, TabId, false).ModuleTitle;
+            AppendToControlTitle (moduleTitle);
+
             if (ItemId == null) {
+                AppendToControlTitle (LocalizeString ("NewDocument.Text"));
                 LoadNewDocument ();
             }
             else {
-                LoadExistingDocument (ItemId.Value);
+                var document = DocumentsDataProvider.Instance.GetDocument (ItemId.Value, ModuleId);
+                if (document == null) {
+                    AddLog ("Security violation: Attempt to access document not related to the module.",
+                        EventLogController.EventLogType.ADMIN_ALERT);
+                    Response.Redirect (Globals.NavigateURL (), true);
+                    return;
+                }
+
+                AppendToControlTitle (document.Title);
+                LoadExistingDocument (document);
             }
         }

@@ -240,7 +253,8 @@
             try {
                 lstOwner.SelectedValue = UserId.ToString ();
                 txtOwner.Text = UserInfo.DisplayName;
-            } catch (Exception ex) {
+            }
+            catch (Exception ex) {
                 // defensive code only, would only happen if the owner user has been deleted
                 Exceptions.LogException (ex);
             }
@@ -257,67 +271,56 @@
             }

             ctlUrl.NewWindow = DocumentsConfig.Instance.NewWindow;
-
-            AdjustControlTitle (LocalizeString ("NewDocument.Text"));
-        }
-
-        void LoadExistingDocument (int documentId)
-        {
-            var document = DocumentsDataProvider.Instance.GetDocument (documentId, ModuleId);
-            if (document != null) {
-                txtTitle.Text = document.Title;
-                txtDescription.Text = document.Description;
-                chkForceDownload.Checked = document.ForceDownload;
-                dtStartDate.SelectedDate = document.StartDate;
-                dtEndDate.SelectedDate = document.EndDate;
-                txtLinkAttributes.Text = document.LinkAttributes;
-                chkIsFeatured.Checked = document.IsFeatured;
-                dtCreatedDate.SelectedDate = document.CreatedDate;
-                dtLastModifiedDate.SelectedDate = document.ModifiedDate;
-                txtSortIndex.Text = document.SortOrderIndex.ToString ();
-
-                if (!string.IsNullOrEmpty (document.Url)) {
-                    ctlUrl.Url = document.Url;
-                }
-
-                // test to see if the document has been removed/deleted
-                if (CheckFileExists (document.Url)) {
-                    CheckFileSecurity (document.Url);
-                }
-
-                txtOwner.Text = UserHelper.GetUserDisplayName (PortalId, document.OwnedByUserId) ?? LocalizeString ("None_Specified");
-
-                if (txtCategory.Visible) {
-                    txtCategory.Text = document.Category;
+        }
+
+        void LoadExistingDocument (IDocument document)
+        {
+            txtTitle.Text = document.Title;
+            txtDescription.Text = document.Description;
+            chkForceDownload.Checked = document.ForceDownload;
+            dtStartDate.SelectedDate = document.StartDate;
+            dtEndDate.SelectedDate = document.EndDate;
+            txtLinkAttributes.Text = document.LinkAttributes;
+            chkIsFeatured.Checked = document.IsFeatured;
+            dtCreatedDate.SelectedDate = document.CreatedDate;
+            dtLastModifiedDate.SelectedDate = document.ModifiedDate;
+            txtSortIndex.Text = document.SortOrderIndex.ToString ();
+
+            if (!string.IsNullOrEmpty (document.Url)) {
+                ctlUrl.Url = document.Url;
+            }
+
+            // test to see if the document has been removed/deleted
+            if (CheckFileExists (document.Url)) {
+                CheckFileSecurity (document.Url);
+            }
+
+            txtOwner.Text = UserHelper.GetUserDisplayName (PortalId, document.OwnedByUserId) ?? LocalizeString ("None_Specified");
+
+            if (txtCategory.Visible) {
+                txtCategory.Text = document.Category;
+            } else {
+                // look for the category by name
+                var found = lstCategory.Items.FindByText (document.Category);
+                if (found != null) {
+                    lstCategory.SelectedValue = found.Value;
                 } else {
-                    // look for the category by name
-                    var found = lstCategory.Items.FindByText (document.Category);
+                    // legacy support, do a fall-back
+                    found = lstCategory.Items.FindByValue (document.Category);
                     if (found != null) {
                         lstCategory.SelectedValue = found.Value;
-                    } else {
-                        // legacy support, do a fall-back
-                        found = lstCategory.Items.FindByValue (document.Category);
-                        if (found != null) {
-                            lstCategory.SelectedValue = found.Value;
-                        }
-                    }
-                }
-
-                // FIXME: Audit data not preserved between postbacks
-                ctlAudit.CreatedByUser = UserHelper.GetUserDisplayName (PortalId, document.CreatedByUserId) ?? LocalizeString ("None_Specified");
-                ctlAudit.CreatedDate = document.CreatedDate.ToString ();
-                ctlAudit.LastModifiedByUser = UserHelper.GetUserDisplayName (PortalId, document.ModifiedByUserId) ?? LocalizeString ("None_Specified");
-                ctlAudit.LastModifiedDate = document.ModifiedDate.ToString ();
-
-                ctlUrlTracking.URL = document.Url;
-                ctlUrlTracking.ModuleID = ModuleId;
-
-                AdjustControlTitle (document.Title);
-            }
-            else {
-                AddLog ("Security violation: Attempt to access document not related to the module.", EventLogController.EventLogType.ADMIN_ALERT);
-                Response.Redirect (Globals.NavigateURL (), true);
-            }
+                    }
+                }
+            }
+
+            // FIXME: Audit data not preserved between postbacks
+            ctlAudit.CreatedByUser = UserHelper.GetUserDisplayName (PortalId, document.CreatedByUserId) ?? LocalizeString ("None_Specified");
+            ctlAudit.CreatedDate = document.CreatedDate.ToString ();
+            ctlAudit.LastModifiedByUser = UserHelper.GetUserDisplayName (PortalId, document.ModifiedByUserId) ?? LocalizeString ("None_Specified");
+            ctlAudit.LastModifiedDate = document.ModifiedDate.ToString ();
+
+            ctlUrlTracking.URL = document.Url;
+            ctlUrlTracking.ModuleID = ModuleId;

             btnAdd.Visible = false;
             btnUpdate.Visible = true;
@@ -678,11 +681,9 @@
             }
         }

-        void AdjustControlTitle (string appendix)
-        {
-            const string separator = " > ";
-            var module = ModuleController.Instance.GetModule (ModuleId, TabId, false);
-            ((CDefault) Page).Title = ((CDefault) Page).Title.Append (module.ModuleTitle, separator).Append (appendix, separator);
+        void AppendToControlTitle (string appendix)
+        {
+            ((CDefault) Page).Title = ((CDefault) Page).Title.Append (appendix, " > ");
         }
     }
 }


SignDigest implementation alternative with SHA1

--- RSAKeyVaultProvider/KeyVaultContext.cs
+++ RSAKeyVaultProvider/KeyVaultContext.cs
@@ -58,6 +58,10 @@
         internal async Task<byte[]> SignDigestAsync(byte[] digest, HashAlgorithmName hashAlgorithm)
         {
             var algorithm = SignatureAlgorithmTranslator.SignatureAlgorithmToJwsAlgId(hashAlgorithm);
+
+            if (hashAlgorithm == HashAlgorithmName.SHA1)
+                digest = CreateSHA1Digest(digest);
+
             var signature = await client.SignAsync(KeyIdentifier.Identifier, algorithm, digest).ConfigureAwait(false);
             return signature.Result;
         }
@@ -68,7 +72,26 @@
             var data = await client.DecryptAsync(KeyIdentifier.Identifier, algorithm, cipherText).ConfigureAwait(false);
             return data.Result;
         }
-
+
+        private static byte[] CreateSHA1Digest(byte[] digest)
+        {
+            var hashAlgorithm = SHA1.Create();
+            byte[] hash = hashAlgorithm.ComputeHash(digest);
+
+            if (hash == null || hash.Length == 0)
+                throw new ArgumentNullException(nameof(hash));
+
+            byte[] newPkcs1Digest = null;
+
+            if (hash.Length != 20)
+                throw new ArgumentException("Invalid hash value");
+
+            newPkcs1Digest = new byte[] { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+            Array.Copy(hash, 0, newPkcs1Digest, newPkcs1Digest.Length - hash.Length, hash.Length);
+
+            return newPkcs1Digest;
+        }
+
         /// <summary>
         /// Returns true if properly constructed. If default, then false.
         /// </summary>


Made ClassInstanceNode a BaseWrapperNode.

--- ReClass.NET/Nodes/ClassInstanceNode.cs
+++ ReClass.NET/Nodes/ClassInstanceNode.cs
@@ -5,7 +5,7 @@

 namespace ReClassNET.Nodes
 {
-	public class ClassInstanceNode : BaseReferenceNode
+	public class ClassInstanceNode : BaseWrapperNode
 	{
 		public override int MemorySize => InnerNode.MemorySize;

@@ -21,6 +21,11 @@
 		{
 			InnerNode = ClassNode.Create();
 			InnerNode.Intialize();
+		}
+
+		public override bool CanChangeInnerNodeTo(BaseNode node)
+		{
+			return node is ClassNode;
 		}

 		public override Size Draw(ViewInfo view, int x, int y)


Test debug log

Test debug log

--- RemoteTaskServer/TaskServer/Packets.cs
+++ RemoteTaskServer/TaskServer/Packets.cs
@@ -48,22 +48,25 @@
                     //the only non encrypted packet allowed is the first handshake
                     try
                     {
-                        var validHandshake = JObject.Parse((string) packetData);
+                        var validHandshake = JObject.Parse(packetData.ToString());
                         var endpoint = validHandshake["endpoint"].ToString().Trim().ToLower();
                         if (!endpoint.Equals("aeshandshake"))
                         {
+                            Console.WriteLine("Invalid 1");
                             PacketType = PacketType.InvalidOrEmptyPacket;
                             return;
                         }
                         //prevent sending a new aes key pair after a handshake has already taken place
                         if (client.AesShook)
                         {
+                            Console.WriteLine("Invalid 2");
                             PacketType = PacketType.InvalidOrEmptyPacket;
                             return;
                         }
                     }
-                    catch (Exception)
+                    catch (Exception e)
                     {
+                        Console.WriteLine("Invalid " + e.Message);
                         PacketType = PacketType.InvalidOrEmptyPacket;
                         return;
                     }
@@ -76,8 +79,9 @@
             {
                 deserializedPacket = JObject.Parse((string) packetData);
             }
-            catch (Exception)
+            catch (Exception e)
             {
+                Console.WriteLine("Invalid 23 "  + e.Message);
                 PacketType = PacketType.InvalidOrEmptyPacket;
                 return;
             }
@@ -87,8 +91,9 @@
                 {
                     Endpoint = deserializedPacket["endpoint"].ToString().Trim().ToLower();
                 }
-                catch (Exception)
-                {
+                catch (Exception e)
+                {
+                    Console.WriteLine("Invalid endpoint " + e.Message);
                     PacketType = PacketType.InvalidOrEmptyPacket;
                     return;
                 }


TaskSample - remove result from MatchFunc task (unnecessary/unused)

--- projects/TaskSample/TaskSample.Core/Extensions/FuncTaskExtensions.cs
+++ projects/TaskSample/TaskSample.Core/Extensions/FuncTaskExtensions.cs
@@ -13,7 +13,7 @@
     {
         public static async Task<T> FirstAsync<T>(this IEnumerable<Func<CancellationToken, Task<T>>> funcs, Predicate<T> pred)
         {
-            var tasks = new List<Task<T>>();
+            var tasks = new List<Task>();
             using (MatchFunc<T> match = new MatchFunc<T>(pred))
             {
                 foreach (Func<CancellationToken, Task<T>> func in funcs)
@@ -23,7 +23,7 @@
                         break;
                     }

-                    Task<T> task = match.RunAsync(func);
+                    Task task = match.RunAsync(func);
                     tasks.Add(task);
                 }

@@ -60,12 +60,11 @@
                 }
             }

-            public async Task<T> RunAsync(Func<CancellationToken, Task<T>> func)
+            public async Task RunAsync(Func<CancellationToken, Task<T>> func)
             {
-                T result = default(T);
                 try
                 {
-                    result = await func(this.cts.Token);
+                    T result = await func(this.cts.Token);
                     if (this.pred(result))
                     {
                         this.firstResult = Tuple.Create(result);
@@ -75,8 +74,6 @@
                 catch (Exception)
                 {
                 }
-
-                return result;
             }

             public void Dispose()


Add missing MessagesBatchSize parameter in AppSettingsBusConfiguration

--- src/Abc.Zebus.Directory/Configuration/AppSettingsBusConfiguration.cs
+++ src/Abc.Zebus.Directory/Configuration/AppSettingsBusConfiguration.cs
@@ -11,6 +11,7 @@
             StartReplayTimeout = AppSettings.Get("Bus.Persistence.StartReplayTimeout", 30.Seconds());
             IsDirectoryPickedRandomly = AppSettings.Get("Bus.Directory.PickRandom", true);
             IsErrorPublicationEnabled = AppSettings.Get("Bus.IsErrorPublicationEnabled", true);
+            MessagesBatchSize = AppSettings.Get("Bus.MessagesBatchSize", 100);
         }

         public string[] DirectoryServiceEndPoints { get { return new string[0]; } }
@@ -20,5 +21,6 @@
         public TimeSpan StartReplayTimeout { get; private set; }
         public bool IsDirectoryPickedRandomly { get; private set; }
         public bool IsErrorPublicationEnabled { get; private set; }
+        public int MessagesBatchSize { get; private set; }
     }
 }


Fix major logical errors in MovementManager

--- src/Booma.Proxy.Client.Unity.Ship/Services/Entity/MovementManager.cs
+++ src/Booma.Proxy.Client.Unity.Ship/Services/Entity/MovementManager.cs
@@ -62,21 +62,31 @@
 					//Though this should never happen
 					//Reentrant lock will also prevent anything from changing
 					//so this is safe.
-					if(CurrentState == null)
+					if(CurrentState != null)
+					{
 						Update(entity, currentTime);
+						return;
+					}
+					else
+						throw new InvalidOperationException($"Dequeued a NULL State in {nameof(MovementManager)} for Entity: {entity} Id: {EntityGuid.GetEntityId(entity)}");
 				}

 				//TODO: We should cache finished call maybe
 				//The case where we have a non-null currentstate is done
 				//or we we have queued up movement states and the current state is low priority/skippable.
-				if(CurrentState.isFinished || (CurrentState.isSkippable && MovementStates.Count == 0))
+				if(CurrentState.isSkippable && MovementStates.Count != 0)
 				{
+					//Error in logic was here originally, it tried to dequeue a new state if the
+					//above expression was true. The issue was, it's possible for a state to be finished and not have anything more to dequeue.
+					//Because of that we should only handle skippable AND something left in there.
+					//isFinished can be handled last.
 					CurrentState = MovementStates.Dequeue();

 					//This may seem weird, but calling into the same method again here recursively makes sense
 					//because it'll check if the next state is finished (probably not) or is skippable and we have more.
 					//It will eventually run out of skippable states or we'll find one that isn't skippable
 					Update(entity, currentTime);
+					return;
 				}

 				//At this point the CurrentState is either finished, unskippable or we've got no more states left.


Removed tracing message referencing unused configuration setting 'AllowEmailChangeWhenEmailIsUsername'

--- src/BrockAllen.MembershipReboot/AccountService/UserAccountService.cs
+++ src/BrockAllen.MembershipReboot/AccountService/UserAccountService.cs
@@ -1847,7 +1847,7 @@

             if (Configuration.EmailIsUsername)
             {
-                Tracing.Verbose("[UserAccountService.VerifyEmailFromKey] security setting EmailIsUsername is true and AllowEmailChangeWhenEmailIsUsername is true, so changing username: {0}, to: {1}", account.Username, account.Email);
+                Tracing.Verbose("[UserAccountService.VerifyEmailFromKey] security setting EmailIsUsername is true, so changing username: {0}, to: {1}", account.Username, account.Email);
                 account.Username = account.Email;
             }

@@ -1874,7 +1874,7 @@

             if (Configuration.EmailIsUsername)
             {
-                Tracing.Verbose("[UserAccountService.SetConfirmedEmail] security setting EmailIsUsername is true and AllowEmailChangeWhenEmailIsUsername is true, so changing username: {0}, to: {1}", account.Username, account.Email);
+                Tracing.Verbose("[UserAccountService.SetConfirmedEmail] security setting EmailIsUsername is true, so changing username: {0}, to: {1}", account.Username, account.Email);
                 account.Username = account.Email;
             }


[TrackInfoDisplay] Fix a memory leak (bgo#555365)

Signed-off-by: Alexander Kojevnikov <e46fc836cca3acec03944314d1457c2ae6c68ef3@kojevnikov.com>

--- src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
+++ src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
@@ -406,6 +406,9 @@
             string artwork_id = track.ArtworkId;
             if (current_artwork_id != artwork_id || force) {
                 current_artwork_id = artwork_id;
+                if (incoming_image != null && current_image != incoming_image && !IsMissingImage (incoming_image)) {
+                    ((IDisposable)incoming_image).Dispose ();
+                }
                 incoming_image = artwork_manager.LookupScaleSurface (artwork_id, ArtworkSizeRequest);
             }

@@ -414,6 +417,9 @@
             }

             if (track == current_track) {
+                if (current_image != null && current_image != incoming_image && !IsMissingImage (current_image)) {
+                    ((IDisposable)current_image).Dispose ();
+                }
                 current_image = incoming_image;
             }
         }


Add lock/using tests.

Add lock/using tests.

--- src/EditorFeatures/CSharpTest/Structure/BlockSyntaxStructureTests.cs
+++ src/EditorFeatures/CSharpTest/Structure/BlockSyntaxStructureTests.cs
@@ -84,5 +84,41 @@
             await VerifyBlockSpansAsync(code,
                 Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: false));
         }
+
+        [Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
+        public async Task TestUsing1()
+        {
+            const string code = @"
+class C
+{
+    void M()
+    {
+        {|hint:using (foo){|textspan:
+        {$$
+        }|}|}
+    }
+}";
+
+            await VerifyBlockSpansAsync(code,
+                Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: false));
+        }
+
+        [Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
+        public async Task TestLock1()
+        {
+            const string code = @"
+class C
+{
+    void M()
+    {
+        {|hint:lock (foo){|textspan:
+        {$$
+        }|}|}
+    }
+}";
+
+            await VerifyBlockSpansAsync(code,
+                Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: false));
+        }
     }
 }


undo test

undo test

--- RoomArrangement/RoomGeneticElements.cs
+++ RoomArrangement/RoomGeneticElements.cs
@@ -131,7 +131,6 @@
 				}
 			}

-			// test
 			return fitnessList.Average();
 		}


Improving test representation in report

Improving test representation in report

--- selenium-csharp-sample-solution/selenium-csharp-sample-project/model/AccountData.cs
+++ selenium-csharp-sample-solution/selenium-csharp-sample-project/model/AccountData.cs
@@ -6,5 +6,10 @@
     {
         public string Username { get; set; }
         public string Password { get; set; }
+
+        public override string ToString()
+        {
+            return "Username=" + Username + ", Password=" + Password;
+        }
     }
 }


Drop "-message" from all message names

Drop "-message" from all message names

--- src/Glimpse.Common/Internal/Messaging/DefaultMessageTypeProcessor.cs
+++ src/Glimpse.Common/Internal/Messaging/DefaultMessageTypeProcessor.cs
@@ -17,7 +17,15 @@
             return typeInfo.BaseTypes(true)
                 .Concat(typeInfo.ImplementedInterfaces)
                 .Except(_exclusions)
-                .Select(t => t.KebabCase());
+                .Select(t =>
+                {
+                    var result = t.KebabCase();
+
+                    if (result.EndsWith("-message"))
+                        return result.Substring(0, result.Length - 8);
+
+                    return result;
+                });
         }
     }
 }


Fixed to monitor connection to broker

Fixed to monitor connection to broker

--- src/MassTransit.ActiveMqTransport/Transport/SessionContextFactory.cs
+++ src/MassTransit.ActiveMqTransport/Transport/SessionContextFactory.cs
@@ -83,7 +83,15 @@
                 }
             });

-            _connectionCache.Send(connectionPipe, cancellationToken).ConfigureAwait(false);
+            var connectionTask = _connectionCache.Send(connectionPipe, cancellationToken);
+
+            Task NotifyCreateCanceled(Task task) => asyncContext.CreateCanceled();
+
+            connectionTask.ContinueWith(NotifyCreateCanceled, TaskContinuationOptions.OnlyOnCanceled);
+
+            Task NotifyCreateFaulted(Task task) => asyncContext.CreateFaulted(task.Exception);
+
+            connectionTask.ContinueWith(NotifyCreateFaulted, TaskContinuationOptions.OnlyOnFaulted);
         }
     }
 }


Return last block from SocketInput when data is fully consumed

- This reduces Kestrel's memory usage for idle connections.

--- src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/SocketInput.cs
+++ src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/SocketInput.cs
@@ -53,18 +53,21 @@

         public MemoryPoolBlock IncomingStart()
         {
-            const int minimumSize = 2048;
-
-            if (_tail != null && minimumSize <= _tail.Data.Offset + _tail.Data.Count - _tail.End)
-            {
-                _pinned = _tail;
-            }
-            else
-            {
-                _pinned = _memory.Lease();
-            }
-
-            return _pinned;
+            lock (_sync)
+            {
+                const int minimumSize = 2048;
+
+                if (_tail != null && minimumSize <= _tail.Data.Offset + _tail.Data.Count - _tail.End)
+                {
+                    _pinned = _tail;
+                }
+                else
+                {
+                    _pinned = _memory.Lease();
+                }
+
+                return _pinned;
+            }
         }

         public void IncomingComplete(int count, Exception error)
@@ -112,14 +115,17 @@
         {
             Debug.Assert(_pinned != null);

-            if (_pinned != null)
-            {
-                if (_pinned != _tail)
-                {
-                    _memory.Return(_pinned);
-                }
-
-                _pinned = null;
+            lock (_sync)
+            {
+                if (_pinned != null)
+                {
+                    if (_pinned != _tail)
+                    {
+                        _memory.Return(_pinned);
+                    }
+
+                    _pinned = null;
+                }
             }
         }

@@ -172,18 +178,31 @@
                         }

                         returnStart = _head;
-                        returnEnd = consumed.Block;
-                        _head = consumed.Block;
-                        _head.Start = consumed.Index;
+
+                        var consumedAll = !consumed.IsDefault && consumed.IsEnd;
+                        if (consumedAll && _pinned != _tail)
+                        {
+                            // Everything has been consumed and no data is being written to the
+                            // _tail block, so return all blocks between _head and _tail inclusive.
+                            returnEnd = null;
+                            _head = null;
+                            _tail = null;
+                        }
+                        else
+                        {
+                            returnEnd = consumed.Block;
+                            _head = consumed.Block;
+                            _head.Start = consumed.Index;
+                        }

                         // Must call Subtract() after _head has been advanced, to avoid producer starting too early and growing
                         // buffer beyond max length.
                         _bufferSizeControl?.Subtract(lengthConsumed);
                     }

-                    if (!examined.IsDefault &&
-                        examined.IsEnd &&
-                        ReadingInput)
+                    // If _head is null, everything has been consumed and examined.
+                    var examinedAll = (!examined.IsDefault && examined.IsEnd) || _head == null;
+                    if (examinedAll && ReadingInput)
                     {
                         _manualResetEvent.Reset();


Fix to .grdel and .byedel

Fix to .grdel and .byedel

--- src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs
+++ src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs
@@ -55,7 +55,7 @@
                             {
                                 var t = Task.Run(async () =>
                                 {
-                                    await Task.Delay(conf.AutoDeleteGreetMessagesTimer * 1000).ConfigureAwait(false); // 5 minutes
+                                    await Task.Delay(conf.AutoDeleteByeMessagesTimer * 1000).ConfigureAwait(false); // 5 minutes
                                     try { await toDelete.DeleteAsync().ConfigureAwait(false); } catch { }
                                 });
                             }
@@ -90,7 +90,7 @@
                                     try
                                     {
                                         var toDelete = await channel.SendMessageAsync(msg.SanitizeMentions()).ConfigureAwait(false);
-                                        if (conf.AutoDeleteByeMessagesTimer > 0)
+                                        if (conf.AutoDeleteGreetMessagesTimer > 0)
                                         {
                                             var t = Task.Run(async () =>
                                             {


Prevent ContentFilter to fails if a wrong alias is provided. (#1366)

--- src/OrchardCore.Modules/OrchardCore.Contents/Liquid/ContentFilter.cs
+++ src/OrchardCore.Modules/OrchardCore.Contents/Liquid/ContentFilter.cs
@@ -31,8 +31,12 @@
             if (mode.ToStringValue() == "alias")
             {
                 var contentItemId = await _contentAliasManager.GetContentItemIdAsync(input.ToStringValue());
-                var contentItem = await _contentManager.GetAsync(contentItemId, latest ? VersionOptions.Latest : VersionOptions.Published);
-                return FluidValue.Create(contentItem);
+
+                if (contentItemId != null)
+                {
+                    var contentItem = await _contentManager.GetAsync(contentItemId, latest ? VersionOptions.Latest : VersionOptions.Published);
+                    return FluidValue.Create(contentItem);
+                }
             }
             else if (mode.ToStringValue() == "version")
             {


Remove double casting.

Remove double casting.

--- src/Our.Umbraco.Ditto/ComponentModel/TypeConverters/EnumConverter.cs
+++ src/Our.Umbraco.Ditto/ComponentModel/TypeConverters/EnumConverter.cs
@@ -83,11 +83,11 @@
             {
                 long convertedValue = 0;
                 Type type = typeof(TEnum);
-                IEnumerable<string> enumerable = (IEnumerable<string>)value;
+                List<string> enumerable = ((IEnumerable<string>)value).ToList();

                 if (enumerable.Any())
                 {
-                    foreach (string v in (IEnumerable<string>)value)
+                    foreach (string v in enumerable)
                     {
                         TEnum fallback;
                         Enum.TryParse(v, true, out fallback);


Added comments regarding retired rule identifiers

--- src/PerformanceSensitiveAnalyzers/Core/ExplicitAllocationAnalyzer.cs
+++ src/PerformanceSensitiveAnalyzers/Core/ExplicitAllocationAnalyzer.cs
@@ -14,6 +14,8 @@
         public const string ArrayCreationRuleId = "HAA0501";
         public const string ObjectCreationRuleId = "HAA0502";
         public const string AnonymousObjectCreationRuleId = "HAA0503";
+        // HAA0504 is retired and should not be reused
+        // HAA0505 is retired and should not be reused
         public const string LetCauseRuleId = "HAA0506";

         private static readonly LocalizableString s_localizableArrayCreationRuleTitleAndMessage = new LocalizableResourceString(nameof(PerformanceSensitiveAnalyzersResources.NewArrayRuleTitleAndMessage), PerformanceSensitiveAnalyzersResources.ResourceManager, typeof(PerformanceSensitiveAnalyzersResources));


1479: DrawingGLFontPrinter

1479: DrawingGLFontPrinter

--- src/PixelFarm/PixelFarm.Drawing.GLES/Painter/DrawingGLFontPrinter.cs
+++ src/PixelFarm/PixelFarm.Drawing.GLES/Painter/DrawingGLFontPrinter.cs
@@ -205,13 +205,7 @@
             //_currentTextureKind = TextureKind.StencilGreyScale;

             _myGLBitmapFontMx = new MySimpleGLBitmapFontManager(TextureKind.StencilLcdEffect, textServices);
-            //change this to fit yours.
-            _myGLBitmapFontMx.SetCurrentScriptLangs(
-                new ScriptLang[]
-                {
-                    ScriptLangs.Latin,
-                    ScriptLangs.Thai //eg. Thai, for test with complex script, you can change to your own
-                });
+

             //test textures...


Remove code.

Remove code.

--- src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs
+++ src/EditorFeatures/Core/Implementation/Organizing/OrganizeDocumentCommandHandler.cs
@@ -116,32 +116,6 @@
             }
         }

-        private void SortImports(ITextBuffer subjectBuffer, CancellationToken cancellationToken)
-        {
-            var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
-            if (document != null)
-            {
-                var newDocument = OrganizeImportsService.OrganizeImportsAsync(document, subjectBuffer.GetOption(OrganizerOptions.PlaceSystemNamespaceFirst), cancellationToken).WaitAndGetResult(cancellationToken);
-                if (document != newDocument)
-                {
-                    ApplyTextChange(document, newDocument);
-                }
-            }
-        }
-
-        private void RemoveUnusedImports(ITextBuffer subjectBuffer, CancellationToken cancellationToken)
-        {
-            var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
-            if (document != null)
-            {
-                var newDocument = document.GetLanguageService<IRemoveUnnecessaryImportsService>().RemoveUnnecessaryImportsAsync(document, cancellationToken).WaitAndGetResult(cancellationToken);
-                if (document != newDocument)
-                {
-                    ApplyTextChange(document, newDocument);
-                }
-            }
-        }
-
         private void SortAndRemoveUnusedImports(ITextBuffer subjectBuffer, CancellationToken cancellationToken)
         {
             var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
@@ -161,4 +135,4 @@
             oldDocument.Project.Solution.Workspace.ApplyDocumentChanges(newDocument, CancellationToken.None);
         }
     }
-}
+}


Tightened up the code

Tightened up the code

--- mobius-strip/mobius-strip/MainForm.cs
+++ mobius-strip/mobius-strip/MainForm.cs
@@ -57,10 +57,10 @@
     public void OnResize()
     {
       Graphics g = this.CreateGraphics();
-      int fw = (int)g.MeasureString("H", textBox1.Font).Width;
+      float fw = g.MeasureString("H", textBox1.Font).Width - 4.5f;
       g.Dispose();

-      decimal result = this.Width * (decimal)1.45 / fw;
+      float result = this.Width / fw;
       this.width = (int)Math.Floor(result);

       result = this.Height / (textBox1.Font.Height);


add missing $

add missing $

--- src/SFA.DAS.Commitments.Infrastructure/Data/JobProgressRepository.cs
+++ src/SFA.DAS.Commitments.Infrastructure/Data/JobProgressRepository.cs
@@ -38,7 +38,7 @@

         public async Task Set_AddEpaToApprenticeships_LastSubmissionEventId(long lastSubmissionEventId)
         {
-            _logger.Debug("Setting last (processed by AddEpaToApprenticeships) SubmissionEvent Id to {lastSubmissionEventId}");
+            _logger.Debug($"Setting last (processed by AddEpaToApprenticeships) SubmissionEvent Id to {lastSubmissionEventId}");

             await WithConnection(async connection =>
             {


comment removed.

comment removed.

--- src/SFA.DAS.EAS.Web/Views/EmployerCommitments/Acknowledgement.cshtml
+++ src/SFA.DAS.EAS.Web/Views/EmployerCommitments/Acknowledgement.cshtml
@@ -10,7 +10,7 @@

-

+

                     Reference


CON-1143 - Added to throw exception if the UPN is not available in the claims

--- src/SFA.DAS.EmployerAccounts.Web/Extensions/SupportUserExtensions.cs
+++ src/SFA.DAS.EmployerAccounts.Web/Extensions/SupportUserExtensions.cs
@@ -20,10 +20,10 @@
         private const string Staff = "Staff";
         private const string Employer = "Employer";
         private const string HashedAccountId = "HashedAccountId";
-        private const string ESF = "ESF";
+        private const string ServiceClaimTier2Role = "ESF";
         private const string Tier2User = "Tier2User";
         private const string ConsoleUser = "ConsoleUser";
-        private const string ESS = "ESS";
+        private const string ServiceClaimTier1Role = "ESS";
         private const string serviceClaimType = "http://service/service";
         private static ILogger Logger;

@@ -93,7 +93,7 @@
                     {"role-type", claimsIdentity.RoleClaimType}
                 });

-                if (notification.AuthenticationTicket.Identity.HasClaim(serviceClaimType, ESF))
+                if (notification.AuthenticationTicket.Identity.HasClaim(serviceClaimType, ServiceClaimTier2Role))
                 {
                     Logger.Debug("Adding Tier2 Role");
                     claimsIdentity.AddClaim(new Claim(ClaimTypes.Role, Tier2User));
@@ -101,27 +101,39 @@
                     Logger.Debug("Adding ConsoleUser Role");
                     claimsIdentity.AddClaim(new Claim(ClaimTypes.Role, ConsoleUser));
                 }
-                else if (notification.AuthenticationTicket.Identity.HasClaim(serviceClaimType, ESS))
+                else if (notification.AuthenticationTicket.Identity.HasClaim(serviceClaimType, ServiceClaimTier1Role))
                 {
                     Logger.Debug("Adding ConsoleUser Role");
                     claimsIdentity.AddClaim(new Claim(ClaimTypes.Role, ConsoleUser));
                 }
                 else
                 {
+                    Logger.Error("Service Claim Type not available to identify the Role");
                     throw new SecurityTokenValidationException();
                 }

                 var firstName = claimsIdentity.Claims.SingleOrDefault(x => x.Type == ClaimTypes.GivenName)?.Value;
                 var lastName = claimsIdentity.Claims.SingleOrDefault(x => x.Type == ClaimTypes.Surname)?.Value;
                 var userEmail = claimsIdentity.Claims.Single(x => x.Type == ClaimTypes.Upn).Value;
-
-                claimsIdentity.AddClaim(new Claim(ClaimTypes.Email, userEmail));
+
                 claimsIdentity.AddClaim(new Claim(ClaimTypes.Name, $"{firstName} {lastName}"));
-                claimsIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userEmail));
+
+                if (!string.IsNullOrEmpty(userEmail))
+                {
+                    claimsIdentity.AddClaim(new Claim(ClaimTypes.Email, userEmail));
+                    claimsIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userEmail));
+                }
+                else
+                {
+                    Logger.Error("Upn not available in the claims to identify UserEmail");
+                    throw new SecurityTokenValidationException();
+                }
+
             }
             catch (Exception ex)
             {
                 Logger.Error(ex, "IDAMS Authentication Callback Error");
+                throw new SecurityTokenValidationException();
             }

             Logger.Debug("End of callback");


CON-479-fix-nservicebus-message-conventions

--- src/SFA.DAS.Commitments.Api/DependencyResolution/EndpointConfigurationExtensions.cs
+++ src/SFA.DAS.Commitments.Api/DependencyResolution/EndpointConfigurationExtensions.cs
@@ -17,8 +17,13 @@
         {
             var conventions = config.Conventions();
             conventions.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("SFA.DAS.CommitmentsV2.Messages.Commands"));
-            conventions.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("SFA.DAS.CommitmentsV2.Messages.Events"));
-            conventions.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("SFA.DAS.Commitments.Events"));
+
+            conventions.DefiningEventsAs(t => t.Namespace != null &&
+            (
+            t.Namespace.StartsWith("SFA.DAS.CommitmentsV2.Messages.Events") ||
+            t.Namespace.StartsWith("SFA.DAS.Commitments.Events"
+            )));
+
             return config;
         }
     }


Style change

Style change

--- src/SFA.DAS.EAS.Web/Views/EmployerManageApprentices/StatusChangeConfirmation.cshtml
+++ src/SFA.DAS.EAS.Web/Views/EmployerManageApprentices/StatusChangeConfirmation.cshtml
@@ -54,7 +54,7 @@
                             payments to their training provider. Any outstanding
                             payments for training up to this point will still be made.

-
You'll be able to return and resume the apprentice again
+
You'll be able to return and resume the apprentice again
                             later.

                         break;


Schema name placeholder to constant.

Schema name placeholder to constant.

--- src/Squidex.Domain.Apps.Core.Operations/HandleRules/Actions/AlgoliaActionHandler.cs
+++ src/Squidex.Domain.Apps.Core.Operations/HandleRules/Actions/AlgoliaActionHandler.cs
@@ -22,6 +22,7 @@
 {
     public sealed class AlgoliaActionHandler : RuleActionHandler<AlgoliaAction>
     {
+        private const string SchemaNamePlaceholder = "$SCHEMA_NAME";
         private readonly ConcurrentDictionary<(string AppId, string ApiKey, string IndexName), Index> clients = new ConcurrentDictionary<(string AppId, string ApiKey, string IndexName), Index>();
         private readonly JsonSerializer serializer;

@@ -45,7 +46,7 @@
             {
                 ruleData["ContentId"] = contentEvent.ContentId.ToString();
                 ruleData["Operation"] = "Upsert";
-                ruleData["IndexName"] = action.IndexName.Replace("$SCHEMA_NAME", contentEvent.SchemaId.Name);
+                ruleData["IndexName"] = action.IndexName.Replace(SchemaNamePlaceholder, contentEvent.SchemaId.Name);

                 var timestamp = @event.Headers.Timestamp().ToString();


Handle IDS errors and return general error page

--- src/SFA.DAS.EmployerUsers.Web/Authentication/CustomIdsViewService.cs
+++ src/SFA.DAS.EmployerUsers.Web/Authentication/CustomIdsViewService.cs
@@ -25,40 +25,29 @@
             _controllerFactory = controllerFactory;
         }

+        public override Task<Stream> Error(ErrorViewModel model)
+        {
+            var controller = GetController<ErrorController>();
+            var result = RenderGeneralErrorAction(controller);
+
+            return Task.FromResult(result);
+        }
         public override Task<Stream> AuthorizeResponse(AuthorizeResponseViewModel model)
         {
-            var controller = GetLoginController();
+            var controller = GetController<LoginController>();
             var result = RenderAuthorizeResponseAction(controller, model);

             return Task.FromResult(result);
         }
-
         public override Task<Stream> LoggedOut(LoggedOutViewModel model, SignOutMessage message)
         {
-            var controller = GetLoginController();
+            var controller = GetController<LoginController>();
             var result = RenderLogoutAction(controller, model, message);

             return Task.FromResult(result);
         }

-        private LoginController GetLoginController()
-        {
-            const string controllerName = "login";

-            var routeData = new RouteData();
-            routeData.Values.Add("controller", controllerName);
-
-            var httpContext = DuplicateAndWrapHttpContext(HttpContext.Current);
-
-            var requestContext = new RequestContext(httpContext, routeData);
-            var controller = _controllerFactory.CreateController(requestContext, controllerName) as LoginController;
-            if (controller != null)
-            {
-                controller.ControllerContext = new ControllerContext(httpContext, routeData, controller);
-            }
-
-            return controller;
-        }

         private HttpContextWrapper DuplicateAndWrapHttpContext(HttpContext current)
         {
@@ -75,7 +64,7 @@
                     request.Cookies.Set(cookie);
                 }
             }
-
+
             // Needed for "owin.environment"
             foreach (var key in current.Items.Keys)
             {
@@ -84,6 +73,36 @@

             return new HttpContextWrapper(context);
         }
+        private T GetController<T>(string controllerName = null)
+            where T : Controller
+        {
+            if (string.IsNullOrEmpty(controllerName))
+            {
+                var typeName = typeof(T).Name;
+                if (!typeName.EndsWith("Controller"))
+                {
+                    throw new System.Exception($"Cannot infer controller name of type {typeName}");
+                }
+
+                controllerName = typeName.Substring(0, typeName.Length - 10);
+            }
+
+            var routeData = new RouteData();
+            routeData.Values.Add("controller", controllerName);
+
+            var httpContext = DuplicateAndWrapHttpContext(HttpContext.Current);
+
+            var requestContext = new RequestContext(httpContext, routeData);
+            var controller = _controllerFactory.CreateController(requestContext, controllerName) as T;
+            if (controller != null)
+            {
+                controller.ControllerContext = new ControllerContext(httpContext, routeData, controller);
+            }
+
+            return controller;
+        }
+
+
         private Stream RenderAuthorizeResponseAction(LoginController controller, AuthorizeResponseViewModel model)
         {
             using (var outputWriter = new StringWriter())
@@ -94,7 +113,7 @@

                 var viewResult = controller.AuthorizeResponse(model);
                 viewResult.ExecuteResult(controller.ControllerContext);
-
+
                 outputWriter.Flush();
                 var content = outputWriter.ToString();

@@ -118,5 +137,24 @@
                 return new MemoryStream(Encoding.UTF8.GetBytes(content));
             }
         }
+
+
+        private Stream RenderGeneralErrorAction(ErrorController controller)
+        {
+            using (var outputWriter = new StringWriter())
+            {
+                controller.ControllerContext.RequestContext.HttpContext.Response.Output = outputWriter;
+                controller.ControllerContext.RouteData.Values.Add("action", "General");
+
+                var viewResult = controller.General();
+                viewResult.ExecuteResult(controller.ControllerContext);
+
+                outputWriter.Flush();
+                var content = outputWriter.ToString();
+
+                return new MemoryStream(Encoding.UTF8.GetBytes(content));
+            }
+        }
+
     }
 }


Added the menu item to the main menu as well.

--- Sandra.UI.WF.Chess/MdiContainerForm.cs
+++ Sandra.UI.WF.Chess/MdiContainerForm.cs
@@ -190,6 +190,7 @@
                                         InteractiveGame.DemoteActiveVariation,
                                         InteractiveGame.BreakActiveVariation,
                                         InteractiveGame.DeleteActiveVariation,
+                                        StandardChessBoardForm.FlipBoard,
                                         StandardChessBoardForm.TakeScreenshot);

             UIMenuNode.Container viewMenu = new UIMenuNode.Container("View");


minor

minor

--- src/biz.dfch.CS.Osram.Lightify.Client.Tests/General/UriHelperTest.cs
+++ src/biz.dfch.CS.Osram.Lightify.Client.Tests/General/UriHelperTest.cs
@@ -55,16 +55,15 @@
         }

         [TestMethod]
-        public void CreateQueryStringWithReturnsQueryParametersAsString()
+        public void CreateQueryStringReturnsQueryParametersAsString()
         {
             // Arrange
-            var expectedQueryString = "maxSize=5&currentPage=1&limit=25";
+            var expectedQueryString = string.Format("?{0}={1}&{2}=true", Constants.QueryParameter.IDX, TestConstants.IDX_VALUE, Constants.QueryParameter.ON_OFF);

             var queryParameters = new Dictionary<string, object>()
             {
-                {"maxSize", 5},
-                {"currentPage", 1},
-                {"limit", "25"}
+                {Constants.QueryParameter.IDX, TestConstants.IDX_VALUE},
+                {Constants.QueryParameter.ON_OFF, true}
             };

             // Act


Created new method drawLastMoveArrow().

Created new method drawLastMoveArrow().

--- Sandra.UI.WF/StandardChessBoardForm.cs
+++ Sandra.UI.WF/StandardChessBoardForm.cs
@@ -410,59 +410,64 @@

         Pen lastMoveArrowPen;

+        private void drawLastMoveArrow(Graphics g, SquareLocation start, SquareLocation target)
+        {
+            Rectangle startSquareRect = PlayingBoard.GetSquareRectangle(start);
+            int startSquareCenterX = startSquareRect.X + startSquareRect.Width / 2;
+            int startSquareCenterY = startSquareRect.Y + startSquareRect.Height / 2;
+
+            Rectangle targetSquareRect = PlayingBoard.GetSquareRectangle(target);
+            int targetSquareCenterX = targetSquareRect.X + targetSquareRect.Width / 2;
+            int targetSquareCenterY = targetSquareRect.Y + targetSquareRect.Height / 2;
+
+            int deltaX = start.X - target.X;
+            int deltaY = start.Y - target.Y;
+
+            // Cut off the last segment over the target square.
+            int distance = Math.Max(Math.Abs(deltaX), Math.Abs(deltaY));
+
+            int endPointX = targetSquareCenterX - (targetSquareCenterX - startSquareCenterX) / distance * 3 / 8;
+            int endPointY = targetSquareCenterY - (targetSquareCenterY - startSquareCenterY) / distance * 3 / 8;
+
+            g.DrawLine(lastMoveArrowPen,
+                       endPointX, endPointY,
+                       startSquareCenterX, startSquareCenterY);
+
+            // Draw two lines from the end point at a 30 degrees angle to make an arrow.
+            double phi = Math.Atan2(deltaY, deltaX);
+
+            double arrow1Phi = phi - Math.PI / 6;
+            double arrow2Phi = phi + Math.PI / 6;
+
+            const double targetLength = 12;
+            double arrow1EndX = endPointX + Math.Cos(arrow1Phi) * targetLength;
+            double arrow1EndY = endPointY + Math.Sin(arrow1Phi) * targetLength;
+            double arrow2EndX = endPointX + Math.Cos(arrow2Phi) * targetLength;
+            double arrow2EndY = endPointY + Math.Sin(arrow2Phi) * targetLength;
+
+            lastMoveArrowPen.DashStyle = DashStyle.Solid;
+            lastMoveArrowPen.EndCap = LineCap.Round;
+            g.DrawLine(lastMoveArrowPen,
+                       endPointX, endPointY,
+                       (float)arrow1EndX, (float)arrow1EndY);
+            g.DrawLine(lastMoveArrowPen,
+                       endPointX, endPointY,
+                       (float)arrow2EndX, (float)arrow2EndY);
+            lastMoveArrowPen.DashStyle = DashStyle.Dot;
+            lastMoveArrowPen.EndCap = LineCap.RoundAnchor;
+        }
+
         private void playingBoard_Paint(object sender, PaintEventArgs e)
         {
-            var hoverSquare = PlayingBoard.HoverSquare;
-
             // Draw a dotted line between the centers of the squares of the last move.
             if (lastCommittedMove != null)
             {
-                Rectangle startSquareRect = PlayingBoard.GetSquareRectangle(lastCommittedMove.Start);
-                int startSquareCenterX = startSquareRect.X + startSquareRect.Width / 2;
-                int startSquareCenterY = startSquareRect.Y + startSquareRect.Height / 2;
-
-                Rectangle targetSquareRect = PlayingBoard.GetSquareRectangle(lastCommittedMove.Target);
-                int targetSquareCenterX = targetSquareRect.X + targetSquareRect.Width / 2;
-                int targetSquareCenterY = targetSquareRect.Y + targetSquareRect.Height / 2;
-
-                int deltaX = lastCommittedMove.Start.X - lastCommittedMove.Target.X;
-                int deltaY = lastCommittedMove.Start.Y - lastCommittedMove.Target.Y;
-
-                // Cut off the last segment over the target square.
-                int distance = Math.Max(Math.Abs(deltaX), Math.Abs(deltaY));
-
-                int endPointX = targetSquareCenterX - (targetSquareCenterX - startSquareCenterX) / distance * 3 / 8;
-                int endPointY = targetSquareCenterY - (targetSquareCenterY - startSquareCenterY) / distance * 3 / 8;
-
-                e.Graphics.DrawLine(lastMoveArrowPen,
-                                    endPointX, endPointY,
-                                    startSquareCenterX, startSquareCenterY);
-
-                // Draw two lines from the end point at a 30 degrees angle to make an arrow.
-                double phi = Math.Atan2(deltaY, deltaX);
-
-                double arrow1Phi = phi - Math.PI / 6;
-                double arrow2Phi = phi + Math.PI / 6;
-
-                const double targetLength = 12;
-                double arrow1EndX = endPointX + Math.Cos(arrow1Phi) * targetLength;
-                double arrow1EndY = endPointY + Math.Sin(arrow1Phi) * targetLength;
-                double arrow2EndX = endPointX + Math.Cos(arrow2Phi) * targetLength;
-                double arrow2EndY = endPointY + Math.Sin(arrow2Phi) * targetLength;
-
-                lastMoveArrowPen.DashStyle = DashStyle.Solid;
-                lastMoveArrowPen.EndCap = LineCap.Round;
-                e.Graphics.DrawLine(lastMoveArrowPen,
-                                    endPointX, endPointY,
-                                    (float)arrow1EndX, (float)arrow1EndY);
-                e.Graphics.DrawLine(lastMoveArrowPen,
-                                    endPointX, endPointY,
-                                    (float)arrow2EndX, (float)arrow2EndY);
-                lastMoveArrowPen.DashStyle = DashStyle.Dot;
-                lastMoveArrowPen.EndCap = LineCap.RoundAnchor;
+                drawLastMoveArrow(e.Graphics, lastCommittedMove.Start, lastCommittedMove.Target);
             }

             // Draw subtle corners just inside the edges of a legal target square.
+            var hoverSquare = PlayingBoard.HoverSquare;
+
             if (hoverSquare != null && PlayingBoard.IsMoving && !PlayingBoard.GetSquareOverlayColor(hoverSquare).IsEmpty)
             {
                 Rectangle hoverRect = PlayingBoard.GetSquareRectangle(hoverSquare);


(specs) remove logtoconsole logging

(specs) remove logtoconsole logging

--- src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs
+++ src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs
@@ -103,8 +103,6 @@
             {
                 reset();

-                MockLogger.LogMessagesToConsole = true;
-
                 var i = 0;
                 FaultTolerance.retry(3, () => { i += 1; }, waitDurationMilliseconds: 0);


ScadaServerCtrl: improve logging errors

ScadaServerCtrl: improve logging errors

--- ScadaServer/ScadaServerCtrl/FrmMain.cs
+++ ScadaServer/ScadaServerCtrl/FrmMain.cs
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Mikhail Shiryaev
+ * Copyright 2017 Mikhail Shiryaev
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
  *
  * Author   : Mikhail Shiryaev
  * Created  : 2013
- * Modified : 2016
+ * Modified : 2017
  */

 using Scada.Client;
@@ -682,9 +682,8 @@

         private void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
         {
-            string errMsg = CommonPhrases.UnhandledException + ":\r\n" + e.Exception.Message;
-            errLog.WriteAction(errMsg, Log.ActTypes.Exception);
-            ScadaUiUtils.ShowError(errMsg);
+            errLog.WriteException(e.Exception, CommonPhrases.UnhandledException);
+            ScadaUiUtils.ShowError(CommonPhrases.UnhandledException + ":\r\n" + e.Exception.Message);
         }

         private void FrmMain_Load(object sender, EventArgs e)


no need to be here..

no need to be here..

--- yafsrc/YAF.Controls/Base/BaseUserControl.cs
+++ yafsrc/YAF.Controls/Base/BaseUserControl.cs
@@ -1,40 +0,0 @@
-/* Yet Another Forum.NET
- * Copyright (C) 2003-2005 Bjrnar Henden
- * Copyright (C) 2006-2007 Jaben Cargman
- * http://www.yetanotherforum.net/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-using System;
-using System.Data;
-using YAF.Classes.Utils;
-
-namespace YAF.Controls
-{
-	/// <summary>
-	/// Summary description for ForumUsers.
-	/// </summary>
-	public class BaseUserControl : System.Web.UI.UserControl
-	{
-		public yaf_Context PageContext
-		{
-			get
-			{
-				return yaf_Context.Current;
-			}
-		}
-	}
-}


Add param hint for case of one of several key

--- Scripts/DapCore/util_/DapAttributes.cs
+++ Scripts/DapCore/util_/DapAttributes.cs
@@ -108,34 +108,69 @@
     }

     public static class DataDapParamExtension {
-        public static Data AddParamHint(this Data data, Type type, string fieldName) {
+        private static FieldInfo GetFieldInfo(Type type, string fieldName) {
             FieldInfo field = type.GetField(fieldName,
                                     BindingFlags.Public | BindingFlags.Static);
             if (field == null) {
                 Log.Error("public static field not found: {0}.{1}", type.FullName, fieldName);
-                return data;
+            }
+            return field;
+        }
+
+        private static bool GetParamHint(Type type, string fieldName, ref string key, ref string hint) {
+            FieldInfo field = type.GetField(fieldName,
+                                    BindingFlags.Public | BindingFlags.Static);
+            if (field == null) {
+                return false;
             }

             DapParam dapParam = DapParam.GetDapParam(field);
             if (dapParam == null) {
                 Log.Error("DapParam attribute not found: {0}.{1}", type.FullName, fieldName);
-                return data;
+                return false;
             }

-            string hint = string.Format("{0}", dapParam.ParamType.FullName);
+            key = field.GetValue(null).ToString();
+            hint = string.Format("{0}", dapParam.ParamType.FullName);
             if (dapParam.Optional) {
                 FieldInfo defaultField = type.GetField(DapParam.GetDefaultFieldName(fieldName),
                                         BindingFlags.Public | BindingFlags.Static);
                 if (field == null) {
-                    Log.Error("public static default field not found: {0}.{1}",
-                                type.FullName, DapParam.GetDefaultFieldName(fieldName));
                     hint = string.Format("{0} = N/A", hint);
                 } else {
                     hint = string.Format("{0} = {1}", hint, defaultField.GetValue(null));
                 }
             }
-            data.SetString(field.GetValue(null).ToString(), hint);

+            return true;
+        }
+
+        public static Data AddParamHint(this Data data, Type type, string fieldName) {
+            string key = null, hint = null;
+            if (GetParamHint(type, fieldName, ref key, ref hint)) {
+                data.SetString(key, hint);
+            }
+            return data;
+        }
+
+        public static Data AddOneOfParamHint(this Data data, Type type, params string[] fieldNames) {
+            string key = "";
+            string hint = "";
+
+            foreach (string fieldName in fieldNames) {
+                string oneKey = null, oneHint = null;
+                if (GetParamHint(type, fieldName, ref oneKey, ref oneHint)) {
+                    if (!string.IsNullOrEmpty(key)) {
+                        key += " | ";
+                        hint += ", ";
+                    }
+                    key += oneKey;
+                    hint += oneHint;
+                }
+            }
+            if (!string.IsNullOrEmpty(key)) {
+                data.SetString(key, hint);
+            }
             return data;
         }
     }


NodeEditorReflection: Catch ReflectionTypeLoadException (#131)

* NodeEditorReflection: Catch ReflectionTypeLoadException

Can happen if dll can not be loaded for some reason

* Removed unnecessary editor precompile tags

--- Scripts/Editor/NodeEditorReflection.cs
+++ Scripts/Editor/NodeEditorReflection.cs
@@ -75,7 +75,9 @@
             List<System.Type> types = new List<System.Type>();
             System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
             foreach (Assembly assembly in assemblies) {
-                types.AddRange(assembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t)).ToArray());
+                try {
+                    types.AddRange(assembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t)).ToArray());
+                } catch(ReflectionTypeLoadException) {}
             }
             return types.ToArray();
         }
@@ -162,4 +164,4 @@
             }
         }
     }
-}+}


Courses Ad (experimental)

Courses Ad (experimental)

--- Sibelius.Web/Views/Courses/Show.cshtml
+++ Sibelius.Web/Views/Courses/Show.cshtml
@@ -4,7 +4,25 @@
     ViewBag.MetaDescription = Model.Title;
     ViewBag.MetaKeywords = Model.Title + ",aprender, computación, software, programación, desarrollo, cursos, universidad";
 }
-
+

+

+

+
+
+
+
+
+

+
+

+

+

@Model.Title @Model.Year - @Model.Semester


Attempt to work around ExecutionContext issue


BulletinBoard

BulletinBoard

--- Site/Modules/Bulletins/Default.aspx.cs
+++ Site/Modules/Bulletins/Default.aspx.cs
@@ -16,11 +16,10 @@
 {
     public partial class Default : Core.SitePage
     {
-        private Bulletin _currentBulletin;
-        private Button but1;
-        private Button but2;
-        private string _moderator;
-        List<Control> controls = new List<Control>();
+        public static Bulletin CurrentBulletin;
+        private Control _baseControl;
+        private Control _editControl;
+
         protected override void OnLoad(EventArgs e)
         {
             base.OnLoad(e);
@@ -30,10 +29,7 @@
             //var items = CampusClient.GetBulletinBoard(SessionId);

             //Render(items);
-

-
-            _moderator = CampusClient.DeskIsModerator(SessionId);
             LoadBoard();
             foreach (var v in CampusClient.DeskGetAllowedProfiles())
             {
@@ -44,106 +40,16 @@
             {
                 drop2.Items.Add(v.Name);
             }
-
-
-        }
-
-        private void Render(IEnumerable<Campus.Common.BulletinBoard> items)
-        {
-            var sb = new StringBuilder();
-
-            sb.AppendLine("
");
-
-            foreach (var item in items)
-            {
-                sb.AppendLine("
");
-                sb.AppendLine("");
-                sb.AppendFormat("
{0}
", item.DateCreate);
-                sb.AppendFormat("{0}", String.IsNullOrEmpty(item.CreatorUserFullName) ? "Анонім" : item.CreatorUserFullName);
-                sb.AppendFormat("
{0}
", item.Subject);
-                sb.AppendFormat("
{0}
", item.Text);
-                sb.AppendLine("	");
-                sb.AppendLine("
");
-            }
-
-            sb.AppendLine("
");
-
-            bulletins.InnerHtml = sb.ToString();
-        }
-
-        public void ChangeBulletin()
-        {
-            int id = _currentBulletin.BulletinId;
-            string s = "";
-            string t = "";
-            foreach (var c in ActualBulletinDiv.Controls)
-            {
-                if (c is TextBox)
-                {
-                    var box = c as TextBox;
-                    if (box.ID == "tb_Txt")
-                    {
-                        t = box.Text;
-                    }
-                }
-            }
-            CampusClient.DeskAddBulletein(SessionId, "", t, id);
-        }
-
-        public void EditBulletin(Bulletin l)
-        {
-            _currentBulletin = l;
-            var box1 = new TextBox();
-            box1.ID = "tb_Sub";
-            box1.Text = l.Subject;
-            box1.Width = 500;
-
-            var box2 = new TextBox();
-            box2.ID = "tb_Txt";
-            box2.Text = l.Text;
-            box2.Width = 900;
-            box2.TextMode = TextBoxMode.MultiLine;
-            box2.Height = 300;
-
-
-            but1.Visible = true;
-            but2.Visible = true;
-            ActualBulletinDiv.Controls.Add(box1);
-            ActualBulletinDiv.Controls.Add(box2);
-        }
+        }
+

         void LoadBoard()
         {
-            var list = CampusClient.DeskGetActualBulletins(SessionId);
-            ActualBulletinDiv.InnerHtml = "";
-
-
-            var button1 = new Button();
-            button1.ID = "b1";
-            button1.Text = "Змінити";
-            button1.Click += (sender, args) =>
-            {
-                ChangeBulletin();
-                //LoadBoard();
-            };
-            button1.Visible = false;
-            but1 = button1;
-            var button2 = new Button();
-            button2.ID = "b2";
-            button2.Text = "Відмінити";
-            button2.Click += (sender, args) =>
-            {
-                LoadBoard();
-            };
-            button2.Visible = false;
-            but2 = button2;
-            ActualBulletinDiv.Controls.Add(button1);
-            ActualBulletinDiv.Controls.Add(button2);
-
-
-            ActualBulletinDiv.Controls.Add(new LiteralControl("
"));
+            var baseControl = new Control();
+            baseControl.ID = "base_board_control";
+            baseControl.Controls.Add(new LiteralControl("
"));
             int i = 0;
-            foreach (var l in list.Reverse())
+            foreach (var l in CampusClient.DeskGetActualBulletins(SessionId).Reverse())
             {
                 var ss = l;
                 string s = l.Subject;
@@ -162,11 +68,15 @@
                 b2.ID = "b2_" + i;
                 b2.Click += (source, args) =>
                 {
-                    EditBulletin(ss);
+                    _baseControl.Visible = false;
+                    _editControl.Visible = true;
+                    ((Label)_editControl.FindControl("board_edit_subject")).Text = l.Subject;
+                    ((TextBox)_editControl.FindControl("board_edit_text")).Text = l.Text;
+                    CurrentBulletin = l;
                 };

-                ActualBulletinDiv.Controls.Add(b1);
-                ActualBulletinDiv.Controls.Add(b2);
+                baseControl.Controls.Add(b1);
+                baseControl.Controls.Add(b2);
                 string header = "

" +
                                 l.Subject +
                                 "
	" +
@@ -187,11 +97,56 @@
                                 "
" +
                                 l.Text +
                                 "

";
-                ActualBulletinDiv.Controls.Add(new LiteralControl(txt));
+                baseControl.Controls.Add(new LiteralControl(txt));

                 i++;
             }
-            ActualBulletinDiv.Controls.Add(new LiteralControl("
"));
+            baseControl.Controls.Add(new LiteralControl("
"));
+            _baseControl = baseControl;
+            ActualBulletinDiv.Controls.Add(baseControl);
+
+            var editControl = new Control();
+            editControl.ID = "edit_board_control";
+
+            var box1 = new Label();
+            box1.ID = "board_edit_subject";
+            box1.Width = 800;
+            var box2 = new TextBox();
+            box2.ID = "board_edit_text";
+            box2.Width = 800;
+            box2.Height = 300;
+            box2.TextMode = TextBoxMode.MultiLine;
+            var button1 = new Button();
+            button1.ID = "board_edit_button";
+            button1.Text = "Accept";
+            button1.Click += ((sender, eventArgs) =>
+                {
+                    CampusClient.DeskAddBulletein(
+                        SessionId,
+                        "",
+                        ((TextBox)_editControl.FindControl("board_edit_text")).Text,
+                        Default.CurrentBulletin.BulletinId);
+                    _editControl.Visible = false;
+                    _baseControl.Visible = true;
+                });
+
+            var button2 = new Button();
+            button2.ID = "board_cancel_button";
+            button2.Text = "Cancel";
+            button2.Click += ((sender, eventArgs) =>
+                {
+                    _editControl.Visible = false;
+                    _baseControl.Visible = true;
+                });
+
+            editControl.Controls.Add(box1);
+            editControl.Controls.Add(box2);
+            editControl.Controls.Add(new LiteralControl("
"));
+            editControl.Controls.Add(button1);
+            editControl.Controls.Add(button2);
+            editControl.Visible = false;
+            _editControl = editControl;
+            ActualBulletinDiv.Controls.Add(editControl);
         }

         protected void add_buletin(object sender, EventArgs e)


(GH-819) Update Cake.Email reference from 1.0.0 to 1.0.2

--- Source/Cake.Recipe/Content/addins.cake
+++ Source/Cake.Recipe/Content/addins.cake
@@ -10,7 +10,7 @@
 #addin nuget:?package=MailKit&version=2.8.0
 #addin nuget:?package=MimeTypesMap&version=1.0.8
 #addin nuget:?package=Cake.Email.Common&version=0.4.2
-#addin nuget:?package=Cake.Email&version=1.0.0
+#addin nuget:?package=Cake.Email&version=1.0.2
 #addin nuget:?package=Cake.Figlet&version=2.0.0
 #addin nuget:?package=Cake.Gitter&version=1.0.2
 #addin nuget:?package=Cake.Incubator&version=6.0.0


Fixed an issue with the Spring adapter that caused it to swollow exceptions.


Add Properties.Get/SetValue for DrawingPointF, DrawingRectangleF and RectangleF

--- Source/SharpDX.Direct2D1/Properties.cs
+++ Source/SharpDX.Direct2D1/Properties.cs
@@ -130,6 +130,19 @@
         /// <param name="index"><para>The index of the property from which the data is to be obtained.</para></param>
         /// <returns>The value of the specified property by index.</returns>
         /// <unmanaged>HRESULT ID2D1Properties::GetValue([In] unsigned int index,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe DrawingPointF GetDrawingPointFValue(int index)
+        {
+            DrawingPointF value;
+            this.GetValue(index, PropertyType.Vector2, new IntPtr(&value), Utilities.SizeOf<DrawingPointF>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by index.
+        /// </summary>
+        /// <param name="index"><para>The index of the property from which the data is to be obtained.</para></param>
+        /// <returns>The value of the specified property by index.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValue([In] unsigned int index,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe Vector3 GetVector3Value(int index)
         {
             Vector3 value;
@@ -143,10 +156,49 @@
         /// <param name="index"><para>The index of the property from which the data is to be obtained.</para></param>
         /// <returns>The value of the specified property by index.</returns>
         /// <unmanaged>HRESULT ID2D1Properties::GetValue([In] unsigned int index,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe Color3 GetColor3Value(int index)
+        {
+            Color3 value;
+            this.GetValue(index, PropertyType.Vector3, new IntPtr(&value), Utilities.SizeOf<Color3>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by index.
+        /// </summary>
+        /// <param name="index"><para>The index of the property from which the data is to be obtained.</para></param>
+        /// <returns>The value of the specified property by index.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValue([In] unsigned int index,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe Vector4 GetVector4Value(int index)
         {
             Vector4 value;
             this.GetValue(index, PropertyType.Vector4, new IntPtr(&value), Utilities.SizeOf<Vector4>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by index.
+        /// </summary>
+        /// <param name="index"><para>The index of the property from which the data is to be obtained.</para></param>
+        /// <returns>The value of the specified property by index.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValue([In] unsigned int index,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe DrawingRectangleF GetDrawingRectangleFValue(int index)
+        {
+            DrawingRectangleF value;
+            this.GetValue(index, PropertyType.Vector4, new IntPtr(&value), Utilities.SizeOf<DrawingRectangleF>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by index.
+        /// </summary>
+        /// <param name="index"><para>The index of the property from which the data is to be obtained.</para></param>
+        /// <returns>The value of the specified property by index.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValue([In] unsigned int index,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe RectangleF GetRectangleFValue(int index)
+        {
+            RectangleF value;
+            this.GetValue(index, PropertyType.Vector4, new IntPtr(&value), Utilities.SizeOf<RectangleF>());
             return value;
         }

@@ -314,6 +366,19 @@
         /// <param name="name">The name of the property.</param>
         /// <returns>The value of the specified property by name.</returns>
         /// <unmanaged>HRESULT ID2D1Properties::GetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe DrawingPointF GetDrawingPointFValueByName(string name)
+        {
+            DrawingPointF value;
+            this.GetValueByName(name, PropertyType.Vector2, new IntPtr(&value), Utilities.SizeOf<DrawingPointF>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by name.
+        /// </summary>
+        /// <param name="name">The name of the property.</param>
+        /// <returns>The value of the specified property by name.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe Vector3 GetVector3ValueByName(string name)
         {
             Vector3 value;
@@ -327,10 +392,49 @@
         /// <param name="name">The name of the property.</param>
         /// <returns>The value of the specified property by name.</returns>
         /// <unmanaged>HRESULT ID2D1Properties::GetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe Color3 GetColor3ValueByName(string name)
+        {
+            Color3 value;
+            this.GetValueByName(name, PropertyType.Vector3, new IntPtr(&value), Utilities.SizeOf<Color3>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by name.
+        /// </summary>
+        /// <param name="name">The name of the property.</param>
+        /// <returns>The value of the specified property by name.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe Vector4 GetVector4ValueByName(string name)
         {
             Vector4 value;
             this.GetValueByName(name, PropertyType.Vector4, new IntPtr(&value), Utilities.SizeOf<Vector4>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by name.
+        /// </summary>
+        /// <param name="name">The name of the property.</param>
+        /// <returns>The value of the specified property by name.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe DrawingRectangleF GetDrawingRectangleFValueByName(string name)
+        {
+            DrawingRectangleF value;
+            this.GetValueByName(name, PropertyType.Vector4, new IntPtr(&value), Utilities.SizeOf<DrawingRectangleF>());
+            return value;
+        }
+
+        /// <summary>
+        /// Gets the value of the specified property by name.
+        /// </summary>
+        /// <param name="name">The name of the property.</param>
+        /// <returns>The value of the specified property by name.</returns>
+        /// <unmanaged>HRESULT ID2D1Properties::GetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[Out, Buffer] void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe RectangleF GetRectangleFValueByName(string name)
+        {
+            RectangleF value;
+            this.GetValueByName(name, PropertyType.Vector4, new IntPtr(&value), Utilities.SizeOf<RectangleF>());
             return value;
         }

@@ -500,6 +604,17 @@
         /// <param name="name">Name of the property</param>
         /// <param name="value">Value of the property</param>
         /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValueByName(string name, DrawingPointF value)
+        {
+            SetValueByName(name, PropertyType.Vector2, new IntPtr(&value), sizeof(DrawingPointF));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="name">Name of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe void SetValueByName(string name, Vector3 value)
         {
             SetValueByName(name, PropertyType.Vector3, new IntPtr(&value), sizeof(Vector3));
@@ -511,9 +626,42 @@
         /// <param name="name">Name of the property</param>
         /// <param name="value">Value of the property</param>
         /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValueByName(string name, Color3 value)
+        {
+            SetValueByName(name, PropertyType.Vector3, new IntPtr(&value), sizeof(Color3));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="name">Name of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe void SetValueByName(string name, Vector4 value)
         {
             SetValueByName(name, PropertyType.Vector4, new IntPtr(&value), sizeof(Vector4));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="name">Name of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValueByName(string name, DrawingRectangleF value)
+        {
+            SetValueByName(name, PropertyType.Vector4, new IntPtr(&value), sizeof(DrawingRectangleF));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="name">Name of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValueByName([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValueByName(string name, RectangleF value)
+        {
+            SetValueByName(name, PropertyType.Vector4, new IntPtr(&value), sizeof(RectangleF));
         }

         /// <summary>
@@ -669,6 +817,17 @@
         /// <param name="index">Index of the property</param>
         /// <param name="value">Value of the property</param>
         /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValue(int index, DrawingPointF value)
+        {
+            SetValue(index, PropertyType.Vector2, new IntPtr(&value), sizeof(DrawingPointF));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="index">Index of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe void SetValue(int index, Vector3 value)
         {
             SetValue(index, PropertyType.Vector3, new IntPtr(&value), sizeof(Vector3));
@@ -680,6 +839,17 @@
         /// <param name="index">Index of the property</param>
         /// <param name="value">Value of the property</param>
         /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValue(int index, Color3 value)
+        {
+            SetValue(index, PropertyType.Vector3, new IntPtr(&value), sizeof(Color3));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="index">Index of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe void SetValue(int index, Vector4 value)
         {
             SetValue(index, PropertyType.Vector4, new IntPtr(&value), sizeof(Vector4));
@@ -691,9 +861,42 @@
         /// <param name="index">Index of the property</param>
         /// <param name="value">Value of the property</param>
         /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValue(int index, DrawingRectangleF value)
+        {
+            SetValue(index, PropertyType.Vector4, new IntPtr(&value), sizeof(DrawingRectangleF));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="index">Index of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValue(int index, RectangleF value)
+        {
+            SetValue(index, PropertyType.Vector4, new IntPtr(&value), sizeof(RectangleF));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="index">Index of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
         public unsafe void SetValue(int index, Color4 value)
         {
             SetValue(index, PropertyType.Vector4, new IntPtr(&value), sizeof(Color4));
+        }
+
+        /// <summary>
+        /// Sets the named property to the given value.
+        /// </summary>
+        /// <param name="index">Index of the property</param>
+        /// <param name="value">Value of the property</param>
+        /// <unmanaged>HRESULT ID2D1Properties::SetValue([In] const wchar_t* name,[In] D2D1_PROPERTY_TYPE type,[In, Buffer] const void* data,[In] unsigned int dataSize)</unmanaged>
+        public unsafe void SetValue(int index, DrawingRectangleF value)
+        {
+            SetValue(index, PropertyType.Vector4, new IntPtr(&value), sizeof(DrawingRectangleF));
         }

         /// <summary>


Make button base background use base current background


Checked for File exists & de-commented Debug Feature that always saves on desktop

--- Addin/MasterModel/MasterModel/Shakespeare.cs
+++ Addin/MasterModel/MasterModel/Shakespeare.cs
@@ -5,6 +5,7 @@
 using System.Threading;
 using Inventor;
 using System.IO;
+using File = System.IO.File;

 namespace InvAddIn
@@ -53,7 +54,7 @@
         public Shakespeare(MasterM masterModel, string savePathChosenByUser)
         {
             //for testing purposes use desktop path, we can also use path chosen by user or path that directly saves the js-file into the web-app folder
-            //jscadPath = savePathChosenByUser;
+            jscadPath = savePathChosenByUser;

             //clear everything at start
             ListOfParameter.Clear();
@@ -186,6 +187,9 @@
         {
             //check for existing file
             //overwrite it? give hint? create copy?
+
+            if (File.Exists(jscadPath))
+                File.Delete(jscadPath);

             using (StreamWriter outputFile = new StreamWriter(jscadPath, true))
             {