Use new static HashData methods for .NET 6+ targets

--- osu.Framework/Extensions/ExtensionMethods.cs
+++ osu.Framework/Extensions/ExtensionMethods.cs
@@ -267,6 +267,9 @@
         /// <returns>A lower-case hex string representation of the hash (64 characters).</returns>
         public static string ComputeSHA2Hash(this string str)
         {
+#if NET6_0_OR_GREATER
+            return SHA256.HashData(Encoding.UTF8.GetBytes(str)).toLowercaseHex();
+#endif
             using (var alg = SHA256.Create())
                 return alg.ComputeHash(Encoding.UTF8.GetBytes(str)).toLowercaseHex();
         }
@@ -285,6 +288,9 @@

         public static string ComputeMD5Hash(this string input)
         {
+#if NET6_0_OR_GREATER
+            return MD5.HashData(Encoding.UTF8.GetBytes(input)).toLowercaseHex();
+#endif
             using (var md5 = MD5.Create())
                 return md5.ComputeHash(Encoding.UTF8.GetBytes(input)).toLowercaseHex();
         }


Always resolve the innermost exception to allow for easier debugging

--- osu.Framework/Extensions/ExtensionMethods.cs
+++ osu.Framework/Extensions/ExtensionMethods.cs
@@ -153,7 +153,13 @@
         public static void ThrowIfFaulted(this Task task)
         {
             if (task.IsFaulted)
-                ExceptionDispatchInfo.Capture(task.Exception?.InnerException).Throw();
+            {
+                Exception e = task.Exception;
+                while (e?.InnerException != null)
+                    e = e.InnerException;
+
+                ExceptionDispatchInfo.Capture(e).Throw();
+            }
         }

         /// <summary>


Add 'raw' and 'newline' attribute functionality

--- Src/WHampson.Bft/TemplateProcessor.cs
+++ Src/WHampson.Bft/TemplateProcessor.cs
@@ -349,10 +349,26 @@
                 throw TemplateException.Create(elem, fmt, Keywords.Echo);
             }

-            EnsureAttributes(elem, Keywords.Comment, Keywords.Message);
+            EnsureAttributes(elem, Keywords.Comment, Keywords.Message, Keywords.Newline, Keywords.Raw);

             string message = GetAttributeValue<string>(elem, Keywords.Message, true, null);
-            echoWriter.WriteLine(message);
+            bool hasNewline = GetAttributeValue<bool>(elem, Keywords.Newline, false, true);
+            bool isRaw = GetAttributeValue<bool>(elem, Keywords.Raw, false, false);
+
+            if (!isRaw)
+            {
+                message = ResolveVariables(message);
+                message = ResolveEscapeSequences(message);
+            }
+
+            if (hasNewline)
+            {
+                echoWriter.WriteLine(message);
+            }
+            else
+            {
+                echoWriter.Write(message);
+            }

             return 0;
         }
@@ -522,22 +538,7 @@

         private string ProcessMessageAttribute(XAttribute attr)
         {
-            try
-            {
-                string msg = ResolveVariables(attr.Value);
-                msg = ResolveEscapeSequences(msg);
-
-                return msg;
-            }
-            catch (Exception e)
-            {
-                if (e is FormatException || e is TemplateException)
-                {
-                    throw TemplateException.Create(e, attr, e.Message);
-                }
-
-                throw;
-            }
+            return attr.Value;
         }

         private string ProcessNameAttribute(XAttribute attr)
@@ -552,16 +553,25 @@
             return attr.Value;
         }

-        private string ProcessNewlineAttribute(XAttribute attr)
-        {
-            // TODO
-            return "";
-        }
-
-        private string ProcessRawAttribute(XAttribute attr)
-        {
-            // TODO
-            return "";
+        private bool ProcessNewlineAttribute(XAttribute attr)
+        {
+            return ProcessBooleanAttribute(attr);
+        }
+
+        private bool ProcessRawAttribute(XAttribute attr)
+        {
+            return ProcessBooleanAttribute(attr);
+        }
+
+        private bool ProcessBooleanAttribute(XAttribute attr)
+        {
+            if (!bool.TryParse(attr.Value, out bool val))
+            {
+                string fmt = "'{0}' is not a valid boolean value.";
+                throw TemplateException.Create(attr, fmt, attr.Value);
+            }
+
+            return val;
         }

         /// <summary>
@@ -732,8 +742,8 @@
             attributeActionMap[Keywords.Kind] = (AttributeProcessAction<TypeInfo>) ProcessKindAttribute;
             attributeActionMap[Keywords.Message] = (AttributeProcessAction<string>) ProcessMessageAttribute;
             attributeActionMap[Keywords.Name] = (AttributeProcessAction<string>) ProcessNameAttribute;
-            attributeActionMap[Keywords.Newline] = (AttributeProcessAction<string>) ProcessNewlineAttribute;
-            attributeActionMap[Keywords.Raw] = (AttributeProcessAction<string>) ProcessRawAttribute;
+            attributeActionMap[Keywords.Newline] = (AttributeProcessAction<bool>) ProcessNewlineAttribute;
+            attributeActionMap[Keywords.Raw] = (AttributeProcessAction<bool>) ProcessRawAttribute;
         }

         private static byte[] LoadFile(string filePath)


Move click to resume cursor scaling responsibility to container

--- osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
+++ osu.Game.Rulesets.Osu/UI/OsuResumeOverlay.cs
@@ -17,6 +17,7 @@
 {
     public class OsuResumeOverlay : ResumeOverlay
     {
+        private Container cursorScaleContainer;
         private OsuClickToResumeCursor clickToResumeCursor;

         private OsuCursorContainer localCursorContainer;
@@ -28,23 +29,24 @@
         [BackgroundDependencyLoader]
         private void load()
         {
-            Add(clickToResumeCursor = new OsuClickToResumeCursor { ResumeRequested = Resume });
+            Add(cursorScaleContainer = new Container
+            {
+                RelativePositionAxes = Axes.Both,
+                Child = clickToResumeCursor = new OsuClickToResumeCursor { ResumeRequested = Resume }
+            });
         }

         public override void Show()
         {
             base.Show();
-            clickToResumeCursor.ShowAt(GameplayCursor.ActiveCursor.Position);
+            cursorScaleContainer.MoveTo(GameplayCursor.ActiveCursor.Position);
+            clickToResumeCursor.Appear();

             if (localCursorContainer == null)
             {
                 Add(localCursorContainer = new OsuCursorContainer());

-                localCursorContainer.CursorScale.BindValueChanged(scale =>
-                {
-                    clickToResumeCursor.CursorScale = scale.NewValue;
-                    clickToResumeCursor.Scale = new Vector2(scale.NewValue);
-                }, true);
+                localCursorContainer.CursorScale.BindValueChanged(scale => cursorScaleContainer.Scale = new Vector2(scale.NewValue), true);
             }
         }

@@ -63,8 +65,6 @@
             public override bool HandlePositionalInput => true;

             public Action ResumeRequested;
-
-            public float CursorScale;

             public OsuClickToResumeCursor()
             {
@@ -91,7 +91,7 @@
                     case OsuAction.RightButton:
                         if (!IsHovered) return false;

-                        this.ScaleTo(2 * CursorScale, TRANSITION_TIME, Easing.OutQuint);
+                        this.ScaleTo(2, TRANSITION_TIME, Easing.OutQuint);

                         ResumeRequested?.Invoke();
                         return true;
@@ -102,11 +102,10 @@

             public bool OnReleased(OsuAction action) => false;

-            public void ShowAt(Vector2 activeCursorPosition) => Schedule(() =>
+            public void Appear() => Schedule(() =>
             {
                 updateColour();
-                this.MoveTo(activeCursorPosition);
-                this.ScaleTo(4 * CursorScale).Then().ScaleTo(CursorScale, 1000, Easing.OutQuint);
+                this.ScaleTo(4).Then().ScaleTo(1, 1000, Easing.OutQuint);
             });

             private void updateColour()


Update SumOfSelfPowers.cs

Update SumOfSelfPowers.cs

--- Sum_Of_Self_Powers/SumOfSelfPowers.cs
+++ Sum_Of_Self_Powers/SumOfSelfPowers.cs
@@ -6,7 +6,7 @@
 	{
 		public static void Main(string[] args)
 		{
-			if (args.Length < 1)
+			if (args.Length != 1)
 			{
 				Console.WriteLine("This program requires 1 integer input");
 				Environment.Exit(0);


Skip removal confirmation in FileSystemContainers

- User must manually remove anyway
- Issue MatterHackers/MCCentral#3373
Skip removal validation on FileSystemContainer children

--- Library/Widgets/PrintLibraryWidget.cs
+++ Library/Widgets/PrintLibraryWidget.cs
@@ -838,23 +838,29 @@
 			var libraryItems = libraryView.SelectedItems.Select(p => p.Model);
 			if (libraryItems.Any())
 			{
-				var container = libraryView.ActiveContainer as ILibraryWritableContainer;
-				if (container != null)
-				{
-					StyledMessageBox.ShowMessageBox(
-						(doDelete) =>
-						{
-							if (doDelete)
+				if (libraryView.ActiveContainer is ILibraryWritableContainer container)
+				{
+					if (container is FileSystemContainer)
+					{
+						container.Remove(libraryItems);
+						libraryView.SelectedItems.Clear();
+					}
+					else
+					{
+						StyledMessageBox.ShowMessageBox(
+							(doDelete) =>
 							{
-								container.Remove(libraryItems);
-								libraryView.SelectedItems.Clear();
-							}
-						},
-						"Are you sure you want to remove the currently selected items?".Localize(),
-						"Remove Items?".Localize(),
-						StyledMessageBox.MessageType.YES_NO,
-						"Remove".Localize());
-
+								if (doDelete)
+								{
+									container.Remove(libraryItems);
+									libraryView.SelectedItems.Clear();
+								}
+							},
+							"Are you sure you want to remove the currently selected items?".Localize(),
+							"Remove Items?".Localize(),
+							StyledMessageBox.MessageType.YES_NO,
+							"Remove".Localize());
+					}
 				}
 			}
 		}


Allow negative GAF frame offsets

Allow negative GAF frame offsets

--- TAUtil/Gaf/Structures/GafFrameData.cs
+++ TAUtil/Gaf/Structures/GafFrameData.cs
@@ -6,8 +6,8 @@
     {
         public ushort Width;
         public ushort Height;
-        public ushort XPos;
-        public ushort YPos;
+        public short XPos;
+        public short YPos;
         public byte TransparencyIndex;
         public bool Compressed;
         public ushort FramePointers;
@@ -19,8 +19,8 @@
         {
             e.Width = b.ReadUInt16();
             e.Height = b.ReadUInt16();
-            e.XPos = b.ReadUInt16();
-            e.YPos = b.ReadUInt16();
+            e.XPos = b.ReadInt16();
+            e.YPos = b.ReadInt16();
             e.TransparencyIndex = b.ReadByte();
             e.Compressed = b.ReadBoolean();
             e.FramePointers = b.ReadUInt16();


don't create a new random

don't create a new random

--- TCC.Core/Windows/SplashScreen.xaml.cs
+++ TCC.Core/Windows/SplashScreen.xaml.cs
@@ -20,8 +20,7 @@
             InitializeComponent();
             try
             {
-                var r = new Random();
-                var path = Path.Combine(App.ResourcesPath, $"images/splash/{r.Next(1, 15)}.jpg");
+                var path = Path.Combine(App.ResourcesPath, $"images/splash/{App.Random.Next(1, 15)}.jpg");
                 var bm = new BitmapImage();
                 bm.BeginInit();
                 bm.UriSource = new Uri(path, UriKind.Absolute);


Use Array.Empty

Use Array.Empty

--- tests/SixLabors.Fonts.Tests/GlyphTests.cs
+++ tests/SixLabors.Fonts.Tests/GlyphTests.cs
@@ -29,7 +29,12 @@
             TrueTypeGlyphMetrics glyphMetrics = new(
                 (StreamFontMetrics)metrics,
                 codePoint,
-                new GlyphVector(new Vector2[0], new bool[0], new ushort[0], new Bounds(0, metrics.UnitsPerEm, 0, metrics.UnitsPerEm), Array.Empty<byte>()),
+                new GlyphVector(
+                    Array.Empty<Vector2>(),
+                    Array.Empty<bool>(),
+                    Array.Empty<ushort>(),
+                    new Bounds(0, metrics.UnitsPerEm, 0, metrics.UnitsPerEm),
+                    Array.Empty<byte>()),
                 0,
                 0,
                 0,


Add logs in contents page

Add logs in contents page

--- Locana/Pages/ContentsGridPage.xaml.cs
+++ Locana/Pages/ContentsGridPage.xaml.cs
@@ -277,7 +277,7 @@

             RemoteStorageId = tuple?.Item2;

-            DebugUtil.Log(() => "OnNavigatedTo: " + tuple);
+            DebugUtil.Log(() => "OnNavigatedTo: " + TargetStorageType);

             UpdateInnerState(ViewerState.Single);

@@ -327,6 +327,7 @@

             if (((Application.Current) as App).IsFunctionLimited && TargetStorageType != StorageType.Local)
             {
+                DebugUtil.Log(() => "Showing end of trial message");
                 CautionText.Text = SystemUtil.GetStringResource("TrialMessage");
                 CautionText.Visibility = Visibility.Visible;
                 MoreInfoButton.Visibility = Visibility.Visible;
@@ -617,6 +618,7 @@

         private async void LoadContents()
         {
+            DebugUtil.Log(() => "Start loading contents");
             reloadLater = false;
             ChangeProgressText(SystemUtil.GetStringResource("Progress_LoadingLocalContents"));

@@ -625,6 +627,7 @@

             if (Operator.ContentsCollection.Count == 0)
             {
+                DebugUtil.Log(() => "No content detected");
                 CautionText.Text = SystemUtil.GetStringResource("Viewer_NoContents");
                 CautionText.Visibility = Visibility.Visible;
             }
@@ -957,16 +960,18 @@
                         ext = null;
                         break;
                 }
+                DebugUtil.Log(() => "Download movie content");
                 MediaDownloader.Instance.EnqueueVideo(new Uri(source.Source.OriginalUrl), source.Source.Name, ext);
             }
             else if (ApplicationSettings.GetInstance().PrioritizeOriginalSizeContents && source.Source.OriginalUrl != null)
             {
+                DebugUtil.Log(() => "Download original size image");
                 MediaDownloader.Instance.EnqueueImage(new Uri(source.Source.OriginalUrl), source.Source.Name,
                     source.Source.MimeType == MimeType.Jpeg ? ".jpg" : null);
             }
             else
             {
-                // Fallback to large size image
+                DebugUtil.Log(() => "Fallback to large size image");
                 MediaDownloader.Instance.EnqueueImage(new Uri(source.Source.LargeUrl), source.Source.Name, ".jpg");
             }
         }


Simulation adds linear solutions for components by name

--- Circuit/Simulation.cs
+++ Circuit/Simulation.cs
@@ -189,8 +189,12 @@
             // Create a global variable for the value of each f0.
             foreach (Arrow i in f0)
                 globals[i.Left] = new GlobalExpr<double>(0.0, i.Left.ToString());
-        }
-
+
+            // Add solutions for the voltage across all the components.
+            linear.AddRange(Circuit.Components.OfType<TwoTerminal>()
+                .Select(i => Arrow.New(Call.New(ExprFunction.New(i.Name, t), t), i.V)));
+        }
+
         /// <summary>
         /// Clear all state from the simulation.
         /// </summary>


Added Function support

Added Function support

--- LogicAppTemplate/TemplateGenerator.cs
+++ LogicAppTemplate/TemplateGenerator.cs
@@ -292,6 +292,31 @@
                         definition["actions"][action.Name]["cases"][switchcase.Name] = handleActions(definition["actions"][action.Name]["cases"][switchcase.Name].ToObject<JObject>());
                     }
                 }
+                else if (type == "function")
+                {
+                    var curr = ((JObject)definition["actions"][action.Name]["inputs"]["function"]).Value<string>("id");
+
+                    Regex rgx = new Regex(@"\/subscriptions\/(?<subscription>[0-9a-zA-Z-]*)\/resourceGroups\/(?<resourcegroup>[a-zA-Z0-9-]*)\/providers\/Microsoft.Web\/sites\/(?<functionApp>[a-zA-Z0-9-]*)\/functions\/(?<functionName>.*)");
+                    var matches = rgx.Match(curr);
+
+                    curr = curr.Replace(matches.Groups["subscription"].Value, "',subscription().subscriptionId,'");
+
+                    if (LogicAppResourceGroup == matches.Groups["resourcegroup"].Value)
+                    {
+                        curr = curr.Replace(matches.Groups["resourcegroup"].Value, "', resourceGroup().name,'");
+                    }
+                    else
+                    {
+                        curr = curr.Replace(matches.Groups["resourcegroup"].Value, "', parameters('" + AddTemplateParameter(action.Name + "-ResourceGroup", "string", matches.Groups["resourcegroup"].Value) + "'),'");
+                    }
+
+                    curr = curr.Replace(matches.Groups["functionApp"].Value, "', parameters('" + AddTemplateParameter(action.Name + "-FunctionApp", "string", matches.Groups["functionApp"].Value) + "'),'");
+                    curr = curr.Replace(matches.Groups["functionName"].Value, "', parameters('" + AddTemplateParameter(action.Name + "-FunctionName", "string", matches.Groups["functionName"].Value) + "'),'");
+
+                    curr = "[concat('" + curr + "')]";
+
+                    definition["actions"][action.Name]["inputs"]["function"]["id"] = curr;
+                }
                 else
                 {
                     var api = action.Value.SelectToken("inputs.host.api");


fixed a minor coding mistake

fixed a minor coding mistake

--- MSOE.MediaComplete/MainWindow.xaml.cs
+++ MSOE.MediaComplete/MainWindow.xaml.cs
@@ -611,8 +611,8 @@

         private void TextChanged(object sender, TextChangedEventArgs e)
         {
-            if (!_changedBoxes.Contains((TextBox) e.OriginalSource) && !SongTitle.IsReadOnly)
-                _changedBoxes.Add((TextBox) e.OriginalSource);
+            if (!_changedBoxes.Contains((TextBox)sender) && !SongTitle.IsReadOnly)
+                _changedBoxes.Add((TextBox)sender);
         }
     }
 }


Fixed invalid check.

Fixed invalid check.

--- Magick.NET/Core/Helpers/EnumHelper.cs
+++ Magick.NET/Core/Helpers/EnumHelper.cs
@@ -43,7 +43,8 @@
     public static bool HasFlag<TEnum>(TEnum value, TEnum flag)
       where TEnum : struct, IConvertible
     {
-      return (value.ToUInt32(CultureInfo.InvariantCulture) & flag.ToUInt32(CultureInfo.InvariantCulture)) != 0;
+      uint flagValue = flag.ToUInt32(CultureInfo.InvariantCulture);
+      return (value.ToUInt32(CultureInfo.InvariantCulture) & flagValue) == flagValue;
     }

     public static TEnum Parse<TEnum>(int value, TEnum defaultValue)


added log tests

added log tests

--- Manatee.Json.Tests/JsonOptionsTest.cs
+++ Manatee.Json.Tests/JsonOptionsTest.cs
@@ -336,5 +336,53 @@
 		}

 		#endregion
+
+		#region Logging
+
+		[Test]
+		public void NoLogTest()
+		{
+			int storedValue = 0;
+
+			int PrintValue(int value)
+			{
+				storedValue = value;
+				return value;
+			}
+
+			var log = JsonOptions.Log;
+			try
+			{
+				JsonOptions.Log = null;
+				JsonOptions.Log?.Verbose($"changing storedValue to {PrintValue(4)}");
+
+				Assert.AreEqual(0, storedValue);
+			}
+			catch (Exception e)
+			{
+				JsonOptions.Log = log;
+				throw;
+			}
+		}
+
+		[Test]
+		public void LogTest()
+		{
+			int storedValue = 0;
+
+			int PrintValue(int value)
+			{
+				storedValue = value;
+				return value;
+			}
+
+			// Test suite sets log
+			Assert.IsNotNull(JsonOptions.Log);
+			JsonOptions.Log?.Verbose($"changing storedValue to {PrintValue(4)}");
+
+			Assert.AreEqual(4, storedValue);
+		}
+
+		#endregion
 	}
 }


Fix missing condition in if statement.

Fix missing condition in if statement.

--- MaterialSkin/Controls/MaterialForm.cs
+++ MaterialSkin/Controls/MaterialForm.cs
@@ -498,7 +498,7 @@
             if (buttonState == ButtonState.MinOver && showMin)
                 g.FillRectangle(hoverBrush, showMax ? minButtonBounds : maxButtonBounds);

-            if (buttonState == ButtonState.MinDown)
+            if (buttonState == ButtonState.MinDown && showMin)
                 g.FillRectangle(downBrush, showMax ? minButtonBounds : maxButtonBounds);

             if (buttonState == ButtonState.MaxOver && showMax)


Off by one

Off by one

--- LynnaLab/Core/Area.cs
+++ LynnaLab/Core/Area.cs
@@ -192,7 +192,7 @@
                                 addr++) {
                             int tile = (addr-0x8800)/16;
                             tile -= 128;
-                            if (tile <= 0)
+                            if (tile < 0)
                                 tile += 256;
                             foreach (byte metatile in usedTileList[tile]) {
                                 tileImagesCache[metatile] = null;


fix operator matching

fix operator matching

--- CobaltAHK/Operator.cs
+++ CobaltAHK/Operator.cs
@@ -19,7 +19,7 @@

 		public virtual bool Matches(string op)
 		{
-			return Code == op.ToUpper();
+			return Code.ToUpper() == op.ToUpper();
 		}

 		#region fields


task 89

task 89

--- NET4/NET4/Euler/P089_RomanNumerals.cs
+++ NET4/NET4/Euler/P089_RomanNumerals.cs
@@ -1,6 +1,8 @@
-using System.Collections;
+using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
+using System.Text;
 using PDNUtils.Runner;
 using PDNUtils.Runner.Attributes;

@@ -23,17 +25,1170 @@
         [Run(1)]
         public void SolveIt()
         {
-            var n = FromRoman(new[] { R.M, R.D, R.C, R.C, R.L, R.X, R.V, R.I });
+            /*var roman = ToRoman(19);
+            roman = ToRoman(357);
+            roman = ToRoman(1357);
+            roman = ToRoman(2452);
+            roman = ToRoman(948);
+            var seq = GetRomanSeq("MDCLIXVIII").ToList();
+            FromRoman(seq);
+            long n = FromRoman(new[] { R.M, R.D, R.C, R.C, R.L, R.X, R.V, R.I });
+            */
+
+            StringReader sr = new StringReader(data);
+            string line;
+            StringBuilder sbRes = new StringBuilder();
+            int saved = 0;
+            while ((line = sr.ReadLine()) != null)
+            {
+                var romanTrim = line.Trim();
+                var r = FromRoman(GetRomanSeq(romanTrim).ToList());
+                var newR = ToRoman(r);
+                var diff = romanTrim.Length - newR.Length;
+                saved += diff;
+                sbRes.AppendLine(newR);
+            }
+
+            DebugFormat("oldLength={0} newLength={1} diff={2} saved={3}", data.Length, sbRes.Length, data.Length - sbRes.Length, saved);
         }

-        static int FromRoman(IEnumerable<R> romanNumbers)
+        static long FromRoman(IList<R> romanNumbers)
         {
-            return 0;
+            long val = 0;
+            R current, next;
+            int length = romanNumbers.Count;
+            int pos = 0;
+
+            foreach (var r in romanNumbers)
+            {
+                current = next = r;
+                if (pos++ < length - 1)
+                    next = romanNumbers[pos];
+                int mul = ((int)current >= (int)next) ? 1 : -1;
+                val += mul * (int)current;
+            }
+
+            return val;
         }

-        static IEnumerable<R> ToRoman(int n)
+        static string ToRoman(long n)
         {
-            return Enumerable.Empty<R>();
+            List<R> roman = new List<R>(10);
+
+            long buf = n;
+            int mul;
+
+            if (buf >= 1000)
+            {
+                mul = (int)(buf / (int)R.M);
+                buf -= (int)R.M * mul;
+                roman.AddRange(Enumerable.Repeat(R.M, mul));
+            }
+
+            if (buf >= 900)
+            {
+                buf -= 900;
+                roman.Add(R.C);
+                roman.Add(R.M);
+            }
+
+            if (900 > buf && buf >= 500)
+            {
+                roman.Add(R.D);
+                buf -= 500;
+                mul = (int)(buf / (int)R.C);
+                buf -= (int)R.C * mul;
+                roman.AddRange(Enumerable.Repeat(R.C, mul));
+            }
+
+            if (buf >= 400)
+            {
+                buf -= 400;
+                roman.Add(R.C);
+                roman.Add(R.D);
+            }
+
+            if (buf >= 100)
+            {
+                mul = (int)(buf / (int)R.C);
+                buf -= (int)R.C * mul;
+                roman.AddRange(Enumerable.Repeat(R.C, mul));
+            }
+
+            if (buf >= 90)
+            {
+                buf -= 90;
+                roman.Add(R.C);
+                roman.Add(R.M);
+            }
+
+            if (90 > buf && buf >= 50)
+            {
+                roman.Add(R.L);
+                buf -= 50;
+                mul = (int)(buf / (int)R.X);
+                buf -= (int)R.X * mul;
+                roman.AddRange(Enumerable.Repeat(R.X, mul));
+            }
+
+            if (buf >= 40)
+            {
+                buf -= 40;
+                roman.Add(R.X);
+                roman.Add(R.L);
+            }
+
+            if (buf >= 10)
+            {
+                mul = (int)(buf / (int)R.X);
+                buf -= (int)R.X * mul;
+                roman.AddRange(Enumerable.Repeat(R.X, mul));
+            }
+
+            if (buf == 9)
+            {
+                buf -= 9;
+                roman.Add(R.I);
+                roman.Add(R.X);
+            }
+
+            if (9 > buf && buf >= 5)
+            {
+                roman.Add(R.V);
+                buf -= 5;
+                mul = (int)(buf / (int)R.I);
+                buf -= (int)R.I * mul;
+                roman.AddRange(Enumerable.Repeat(R.I, mul));
+            }
+
+            if (buf == 4)
+            {
+                buf -= 4;
+                roman.Add(R.I);
+                roman.Add(R.V);
+            }
+
+            if (buf >= 1)
+            {
+                mul = (int)(buf / (int)R.I);
+                buf -= (int)R.I * mul;
+                roman.AddRange(Enumerable.Repeat(R.I, mul));
+            }
+
+            if (buf != 0)
+                throw new Exception("wrong " + buf);
+
+            return roman.Select(r => r.ToString()).Aggregate((e1, e2) => e1 + e2);
         }
+
+        static IEnumerable<R> GetRomanSeq(string roman)
+        {
+            R r;
+            foreach (var c in roman.ToUpperInvariant())
+                if (Enum.TryParse<R>(c.ToString(), true, out r))
+                    yield return r;
+        }
+
+        private const string data =
+@"MMMMDCLXXII
+MMDCCCLXXXIII
+MMMDLXVIIII
+MMMMDXCV
+DCCCLXXII
+MMCCCVI
+MMMCDLXXXVII
+MMMMCCXXI
+MMMC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XCII
+MMXXVIII
+MMMMCCCXXX
+XXXXVIIII";
     }
 }


Logging, /me timestamp and tags

Logging, /me timestamp and tags

/me now shows timestamp, and the Dev/Mod tags.
Server messages are timestamped.
Fixed logging where it wasn't logging the /me commands.

--- Helpers/ChatHelper.cs
+++ Helpers/ChatHelper.cs
@@ -27,11 +27,60 @@

             if ((CommandType)message.command == CommandType.Me)
             {
+                string LogFile = "";
+                string LogText = "";
+                string LogDir = @"Logs\";
+                if ((MessageType)message.type == MessageType.Message)
+                {
+                    LogFile = message.channel + DateTime.Now.ToString(".dd") + ".txt";
+                    LogText += DateTime.Now.ToString("[HH:mm] ");
+                    LogDir += @"Channel\" + DateTime.Now.ToString("MMMM_yyyy") + @"\";
+                }
+                else if ((MessageType)message.type == MessageType.PrivateMessage)
+                {
+                    LogFile = message.channel + ".txt";
+                    LogText += DateTime.Now.ToString("[dd/MM/yy | HH:mm] ");
+                    LogDir += @"PMs\";
+                }
+                else if ((MessageType)message.type == MessageType.Team)
+                {
+                    LogFile = "Team.txt";
+                    LogText += DateTime.Now.ToString("[HH:mm] ");
+                }
+                if (Program.Config.ShowTimeStamp)
+                {
+                    WriteText(window, DateTime.Now.ToString("[HH:mm] "), (Program.Config.ColorBlindMode ? Color.Black : Program.Config.NormalTextColor.ToColor()));
+                }
+                if (message.from.rank > 0)
+                {
+                    WriteText(window, "[", (Program.Config.ColorBlindMode ? Color.Black : Program.Config.NormalTextColor.ToColor()));
+                    if (message.from.rank == 1 || message.from.rank == 4)
+                    {
+                        WriteText(window, "Dev", (Program.Config.ColorBlindMode ? Color.Black : message.RankColor()));
+                        LogText += "[Dev]";
+                    }
+                    else if (message.from.rank == 2 || message.from.rank == 3)
+                    {
+                        WriteText(window, "Mod", (Program.Config.ColorBlindMode ? Color.Black : message.RankColor()));
+                        LogText += "[Mod]";
+                    }
+                    else if (message.from.rank == 99)
+                    {
+                        LogText += "[Dev]";
+                        WriteText(window, "Dev", (Program.Config.ColorBlindMode ? Color.Black : message.RankColor()));
+                    }
+                    WriteText(window, "]", (Program.Config.ColorBlindMode ? Color.Black : Program.Config.NormalTextColor.ToColor()));
+                }
                 WriteText(window, message.message, Program.Config.MeMsgColor.ToColor());
+                LogText += message.message.Trim();
+                if (LogFile != "")
+                    if (!Directory.Exists(LogDir))
+                        Directory.CreateDirectory(LogDir);
+                File.AppendAllText(LogDir + LogFile, LogText + Environment.NewLine);
             }
             else if ((MessageType)message.type == MessageType.Team && (CommandType)message.command == CommandType.TeamServerMessage)
             {
-                WriteText(window, "[TeamMessage] " + message.message,(Program.Config.ColorBlindMode ? Color.Black : Program.Config.ServerMsgColor.ToColor()));
+                WriteText(window, DateTime.Now.ToString("[HH:mm]") + "[TeamMessage] " + message.message,(Program.Config.ColorBlindMode ? Color.Black : Program.Config.ServerMsgColor.ToColor()));
             }
             else if ((MessageType)message.type == MessageType.Message || (MessageType)message.type == MessageType.PrivateMessage || (MessageType)message.type == MessageType.Team)
             {
@@ -87,18 +136,16 @@
                 //    FormatText(message.message.Trim(), window);
                 string LogFile = "";
                 string LogDirectory = @"Logs\";
-                if (!Directory.Exists(LogDirectory))
-                    Directory.CreateDirectory(LogDirectory);
                 if ((MessageType)message.type == MessageType.Message)
                 {
-                    LogDirectory += @"Channel\" + DateTime.Now.ToString("MMMM_yyyy") + @"\"; ;
-                    LogText += DateTime.Now.ToString("[HH:mm]");
+                    LogDirectory += @"Channel\" + DateTime.Now.ToString("MMMM_yyyy") + @"\";
+                    LogText = DateTime.Now.ToString("[HH:mm] ") + LogText;
                     LogFile = message.channel + DateTime.Now.ToString(".dd") + ".txt";
                 }
                 else if ((MessageType)message.type == MessageType.PrivateMessage)
                 {
                     LogDirectory += @"PMs\"; ;
-                    LogText += DateTime.Now.ToString("[dd MM yy | HH:mm] ");
+                    LogText = DateTime.Now.ToString("[dd/MM/yy | HH:mm] ") + LogText;
                     LogFile = message.channel + ".txt";
                 }
                 else if ((MessageType)message.type == MessageType.Team)
@@ -112,6 +159,10 @@
             }
             else if ((MessageType)message.type == MessageType.System || (MessageType)message.type == MessageType.Server)
             {
+                if (Program.Config.ShowTimeStamp)
+                {
+                    WriteText(window, DateTime.Now.ToString("[HH:mm] "), (Program.Config.ColorBlindMode ? Color.Black : Program.Config.NormalTextColor.ToColor()));
+                }
                 WriteText(window,"[", (Program.Config.ColorBlindMode ? Color.Black : Program.Config.NormalTextColor.ToColor()));
                 WriteText(window, ((MessageType)message.type).ToString() ,(Program.Config.ColorBlindMode ? Color.Black : message.MessageColor()));
                 WriteText(window, "]: ", (Program.Config.ColorBlindMode ? Color.Black : Program.Config.NormalTextColor.ToColor()));


Rename tests

Rename tests

Former-commit-id: 22fa52f656850a3ff2f00c27f5bfc784e975f001

--- Tests/GeneratorAPI/GenerationTests.cs
+++ Tests/GeneratorAPI/GenerationTests.cs
@@ -358,7 +358,7 @@
             Author = "Robert",
             Description = "Do should not do anything."
         )]
-        public void Do_Is_Not_Invoked_Before_Take() {
+        public void Do_Is_Not_Invoked_Before_Take_Is_Invoked() {
             string result = null;
             _generation.Do(s => result = s);
             Assert.IsNull(result);
@@ -368,7 +368,7 @@
             Author = "Robert",
             Description = "Do should be invoked."
         )]
-        public void Do_Is_Invoked_After_Take() {
+        public void Do_Is_Invoked_After_Take_Is_invoked() {
             string result = null;
             _generation
                 .Do(s => result = s)


Rolling logfiles bugfix

Rolling logfiles bugfix

--- Nav.Utilities/Logging/LoggerConfig.cs
+++ Nav.Utilities/Logging/LoggerConfig.cs
@@ -22,9 +22,9 @@
             LoggingConfiguration loggingConfiguration = new LoggingConfiguration();
             var fileTarget = new FileTarget {
                 FileName         = Path.Combine(logFolder, $"{logName}.log.xml"),
-                ArchiveFileName  = "{logName}.log.xml{#####}",
+                ArchiveFileName  = Path.Combine(logFolder, $"{logName}.log.xml.{{#####}}"),
                 ArchiveNumbering = ArchiveNumberingMode.Rolling,
-                MaxArchiveFiles  = 3,
+                MaxArchiveFiles  = 10,
                 ArchiveAboveSize = 1 * MB,
                 Layout           = new Log4JXmlEventLayout()
             };


Describe option better

Describe option better

--- NuGet.Extensions/Commands/Nugetify.cs
+++ NuGet.Extensions/Commands/Nugetify.cs
@@ -52,7 +52,7 @@
         [Option("NuSpec ID")]
         public string Id { get; set; }

-        [Option("Create NuSpecs for solution")]
+        [Option("Create a NuSpec for each processed project with nuspec dependencies on any package dependencies that were added")]
         public Boolean NuSpec { get; set; }

         [Option("NuSpec title")]


Fix debug log

Fix debug log

--- Injector/Injection.cs
+++ Injector/Injection.cs
@@ -336,11 +336,16 @@
             _csharpInstructionRemover.ReplaceByNopAt("FrontEndManager", "LateUpdate", 1);
             _csharpInstructionRemover.ReplaceByNopAt("FrontEndManager", "LateUpdate", 2);
             _csharpInstructionRemover.ReplaceByNopAt("FrontEndManager", "LateUpdate", 3);
-
-            _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 8);
-            _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 9);
+            _csharpInstructionRemover.ReplaceByNopAt("FrontEndManager", "LateUpdate", 4);
+            _csharpInstructionRemover.ReplaceByNopAt("FrontEndManager", "LateUpdate", 5);
+            _csharpInstructionRemover.ReplaceByNopAt("FrontEndManager", "LateUpdate", 6);
+
             _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 10);
             _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 11);
+            _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 12);
+            _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 13);
+            _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 14);
+            _csharpInstructionRemover.ReplaceByNopAt("Game", "Update", 15);
         }

         private void FixGameUpdateExceptionHandling()


todo for crv

todo for crv


Remote commands

Remote commands

--- Interfaces/IConSol.cs
+++ Interfaces/IConSol.cs
@@ -7,7 +7,7 @@
 {
     public interface IConSol
     {
-        void WriteLine(string line);
+        void WriteLine(string line);
     }

     public class ConSolCommandLine : IConSol


Seed a Variety of Example Themes

Seed a Variety of Example Themes

--- Portal.CMS.Entities/Seed/ThemeSeed.cs
+++ Portal.CMS.Entities/Seed/ThemeSeed.cs
@@ -18,11 +18,11 @@
                 fonts.Add(new Entities.Themes.Font { FontName = "Anagram", FontPath = "/Areas/Admin/Content/Fonts/Anagram.ttf", FontType = "truetype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "Architect", FontPath = "/Areas/Admin/Content/Fonts/ArchitectsDaughter.ttf", FontType = "truetype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "Blackout", FontPath = "/Areas/Admin/Content/Fonts/Blackout-2am.ttf", FontType = "truetype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
-                fonts.Add(new Entities.Themes.Font { FontName = "BreeSerif", FontPath = "/Areas/Admin/Content/Fonts/BreeSerif.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                fonts.Add(new Entities.Themes.Font { FontName = "BreeSerif", FontPath = "/Areas/Admin/Content/Fonts/BreeSerif-regular.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "Bubblegum", FontPath = "/Areas/Admin/Content/Fonts/BubblegumSans-Regular.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "CarbonType", FontPath = "/Areas/Admin/Content/Fonts/carbontype.ttf", FontType = "truetype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "DancingScript", FontPath = "/Areas/Admin/Content/Fonts/dancingscript-regular.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
-                fonts.Add(new Entities.Themes.Font { FontName = "GrandHotel-Regular", FontPath = "/Areas/Admin/Content/Fonts/BreeSerif.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                fonts.Add(new Entities.Themes.Font { FontName = "GrandHotel-Regular", FontPath = "/Areas/Admin/Content/Fonts/grandhotel-regular.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "Organo", FontPath = "/Areas/Admin/Content/Fonts/Organo.ttf", FontType = "truetype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "Railway", FontPath = "/Areas/Admin/Content/Fonts/Railway.otf", FontType = "opentype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
                 fonts.Add(new Entities.Themes.Font { FontName = "Roboto-Bold", FontPath = "/Areas/Admin/Content/Fonts/roboto-bold.ttf", FontType = "truetype", DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
@@ -39,9 +39,23 @@

             if (!context.Themes.Any())
             {
-                var defaultfont = context.Fonts.First(x => x.FontName == "Portal");
+                var fontList = context.Fonts.ToList();

-                themes.Add(new Entities.Themes.Theme { ThemeName = "Portal", TextFontId = defaultfont.FontId, TitleFontId = defaultfont.FontId, IsDefault = true, DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                var defaultFont = fontList.First(x => x.FontName == "Portal");
+                var allerDisplayFont= fontList.First(x => x.FontName == "AllerDisplay");
+                var snigletFont = fontList.First(x => x.FontName == "Sniglet");
+                var thinLineFont = fontList.First(x => x.FontName == "ThinLine");
+                var robotoThinFont = fontList.First(x => x.FontName == "Roboto-Thin");
+                var carbonFont = fontList.First(x => x.FontName == "CarbonType");
+                var bubblegumFont = fontList.First(x => x.FontName == "Bubblegum");
+                var dancingFont = fontList.First(x => x.FontName == "DancingScript");
+                var grandHotelFont = fontList.First(x => x.FontName == "GrandHotel-Regular");
+
+                themes.Add(new Entities.Themes.Theme { ThemeName = "Portal", TitleFontId = defaultFont.FontId, TextFontId = defaultFont.FontId, IsDefault = true, DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                themes.Add(new Entities.Themes.Theme { ThemeName = "Impact", TitleFontId = allerDisplayFont.FontId, TextFontId = snigletFont.FontId, IsDefault = false, DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                themes.Add(new Entities.Themes.Theme { ThemeName = "Futuristic", TitleFontId = thinLineFont.FontId, TextFontId = robotoThinFont.FontId, IsDefault = false, DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                themes.Add(new Entities.Themes.Theme { ThemeName = "Grim", TitleFontId = carbonFont.FontId, TextFontId = bubblegumFont.FontId, IsDefault = false, DateAdded = DateTime.Now, DateUpdated = DateTime.Now });
+                themes.Add(new Entities.Themes.Theme { ThemeName = "Elegant", TitleFontId = dancingFont.FontId, TextFontId = grandHotelFont.FontId, IsDefault = false, DateAdded = DateTime.Now, DateUpdated = DateTime.Now });

                 context.Themes.AddRange(themes);
             }


Support M mode display

Support M mode display

--- Project/DataModel/ShootingViewData.cs
+++ Project/DataModel/ShootingViewData.cs
@@ -616,6 +616,8 @@
                         return ExModeImage_S;
                     case ExposureMode.Program:
                         return ExModeImage_P;
+                    case ExposureMode.Manual:
+                        return ExModeImage_M;
                     case ExposureMode.Intelligent:
                         return ExModeImage_IA;
                     case ExposureMode.Superior:


EDIT: Allow fontawesome in CDNs for some pages

--- CollAction/Startup.cs
+++ CollAction/Startup.cs
@@ -178,14 +178,16 @@
                                                    .Sources.AddRange(new[]
                                                                      {
                                                                          "https://maxcdn.bootstrapcdn.com/",
-                                                                         "https://fonts.googleapis.com/"
+                                                                         "https://fonts.googleapis.com/",
+                                                                          "https://use.fontawesome.com/"
                                                                      }.Concat(Configuration["CspStyleSrc"]?.Split(";") ?? new string[0]));
                            cspBuilder.AddFontSrc().Self() // Only allow fonts from these sources, or configured sources
                                                   .Sources.AddRange(new[]
                                                                    {
                                                                        "https://maxcdn.bootstrapcdn.com/",
                                                                        "https://fonts.googleapis.com/",
-                                                                       "https://fonts.gstatic.com"
+                                                                       "https://fonts.gstatic.com",
+                                                                       "https://use.fontawesome.com/"
                                                                    }.Concat(Configuration["CspFontSrc"]?.Split(";") ?? new string[0]));
                            cspBuilder.AddFrameAncestors().Sources.AddRange(Configuration["CspFrameAncestors"]?.Split(";") ?? new string[0]); // Only allow configured sources
                            cspBuilder.AddMediaSrc().Self()
@@ -198,6 +200,7 @@
                                                            "https://ajax.aspnetcdn.com",
                                                            "https://www.googletagmanager.com",
                                                            "https://www.google-analytics.com",
+                                                           "https://use.fontawesome.com/",
                                                            "*.msecnd.net",
                                                            "'sha256-EHA5HNhe/+uz3ph6Fw34N85vHxX87fsJ5cH4KbZKIgU='"
                                                        }.Concat(Configuration["CspScriptSrc"]?.Split(";") ?? new string[0]));


bump version

bump version

--- CommonAssemblyInfo.cs
+++ CommonAssemblyInfo.cs
@@ -2,5 +2,5 @@

 [assembly: AssemblyTitle("Validar")]
 [assembly: AssemblyProduct("Validar")]
-[assembly: AssemblyVersion("1.3.0.0")]
-[assembly: AssemblyFileVersion("1.3.0.0")]
+[assembly: AssemblyVersion("1.4.0.0")]
+[assembly: AssemblyFileVersion("1.4.0.0")]


version

version

--- CommonAssemblyInfo.cs
+++ CommonAssemblyInfo.cs
@@ -2,6 +2,6 @@

 [assembly: AssemblyTitle("PropertyChanged")]
 [assembly: AssemblyProduct("PropertyChanged")]
-[assembly: AssemblyVersion("1.48.1")]
-[assembly: AssemblyFileVersion("1.48.1")]
+[assembly: AssemblyVersion("1.48.2")]
+[assembly: AssemblyFileVersion("1.48.2")]


Fix using

Fix using

* Clean-up deleted necessary using statements for UNIX compilation.

--- RDotNet.NativeLibrary/UnmanagedDll.cs
+++ RDotNet.NativeLibrary/UnmanagedDll.cs
@@ -2,6 +2,10 @@
 using System.Runtime.ConstrainedExecution;
 using System.Runtime.InteropServices;
 using System.Security.Permissions;
+#if UNIX
+using System.IO;
+using System.Linq;
+#endif

 namespace RDotNet.NativeLibrary
 {
@@ -128,38 +132,38 @@
       /// <returns>If the function succeeds, the return value is nonzero.</returns>
       [Obsolete("Set environment variable 'PATH' instead.")]
 #if UNIX
-		public static bool SetDllDirectory(string dllDirectory)
-		{
-			if (dllDirectory == null)
-			{
-				System.Environment.SetEnvironmentVariable(LibraryPath, DefaultSearchPath, EnvironmentVariableTarget.Process);
-			}
-			else if (dllDirectory == string.Empty)
-			{
-				throw new NotImplementedException();
-			}
-			else
-			{
-				if (!Directory.Exists(dllDirectory))
-				{
-					return false;
-				}
-				string path = System.Environment.GetEnvironmentVariable(LibraryPath, EnvironmentVariableTarget.Process);
-				if (string.IsNullOrEmpty(path))
-				{
-					path = dllDirectory;
-				}
-				else
-				{
-					path = dllDirectory + Path.PathSeparator + path;
-				}
-				System.Environment.SetEnvironmentVariable(LibraryPath, path, EnvironmentVariableTarget.Process);
-			}
-			return true;
-		}
-
-		private const string LibraryPath = "PATH";
-		private static readonly string DefaultSearchPath = System.Environment.GetEnvironmentVariable(LibraryPath, EnvironmentVariableTarget.Process);
+      public static bool SetDllDirectory(string dllDirectory)
+      {
+         if (dllDirectory == null)
+         {
+            System.Environment.SetEnvironmentVariable(LibraryPath, DefaultSearchPath, EnvironmentVariableTarget.Process);
+         }
+         else if (dllDirectory == string.Empty)
+         {
+            throw new NotImplementedException();
+         }
+         else
+         {
+            if (!Directory.Exists(dllDirectory))
+            {
+               return false;
+            }
+            string path = System.Environment.GetEnvironmentVariable(LibraryPath, EnvironmentVariableTarget.Process);
+            if (string.IsNullOrEmpty(path))
+            {
+               path = dllDirectory;
+            }
+            else
+            {
+               path = dllDirectory + Path.PathSeparator + path;
+            }
+            System.Environment.SetEnvironmentVariable(LibraryPath, path, EnvironmentVariableTarget.Process);
+         }
+         return true;
+      }
+
+      private const string LibraryPath = "PATH";
+      private static readonly string DefaultSearchPath = System.Environment.GetEnvironmentVariable(LibraryPath, EnvironmentVariableTarget.Process);
 #else
       [DllImport("kernel32.dll")]
       [return: MarshalAs(UnmanagedType.Bool)]
@@ -168,20 +172,20 @@
 #endif

 #if UNIX
-		private static IntPtr LoadLibrary(string filename)
-		{
-			const int RTLD_LAZY = 0x1;
-			if (filename.StartsWith("/"))
-			{
-				return dlopen(filename, RTLD_LAZY);
-			}
-			var searchPaths = (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator);
-			var dll = searchPaths.Select(directory => Path.Combine(directory, filename)).FirstOrDefault(File.Exists);
-			return dll == null ? IntPtr.Zero : dlopen(dll, RTLD_LAZY);
-		}
-
-		[DllImport("libdl")]
-		private static extern IntPtr dlopen([MarshalAs(UnmanagedType.LPStr)] string filename, int flag);
+      private static IntPtr LoadLibrary(string filename)
+      {
+         const int RTLD_LAZY = 0x1;
+         if (filename.StartsWith("/"))
+         {
+            return dlopen(filename, RTLD_LAZY);
+         }
+         var searchPaths = (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator);
+         var dll = searchPaths.Select(directory => Path.Combine(directory, filename)).FirstOrDefault(File.Exists);
+         return dll == null ? IntPtr.Zero : dlopen(dll, RTLD_LAZY);
+      }
+
+      [DllImport("libdl")]
+      private static extern IntPtr dlopen([MarshalAs(UnmanagedType.LPStr)] string filename, int flag);
 #else

       [DllImport("kernel32.dll")]
@@ -190,7 +194,7 @@
 #endif

 #if UNIX
-		[DllImport("libdl", EntryPoint = "dlclose")]
+      [DllImport("libdl", EntryPoint = "dlclose")]
 #else

       [DllImport("kernel32.dll")]
@@ -200,7 +204,7 @@
       private static extern bool FreeLibrary(IntPtr hModule);

 #if UNIX
-		[DllImport("libdl", EntryPoint = "dlsym")]
+      [DllImport("libdl", EntryPoint = "dlsym")]
 #else

       [DllImport("kernel32.dll", EntryPoint = "GetProcAddress")]


STO-11 Respect BrokerUnreachableExcept. interface

It also fixes STO-10

--- RabbitMQHare/RabbitConnectorCommon.cs
+++ RabbitMQHare/RabbitConnectorCommon.cs
@@ -76,8 +76,8 @@
         {
             bool ok = false;
             int retries = 0;
-            var exceptions = new Dictionary<int, Exception>(Math.Max(1, _settings.MaxConnectionRetry));
-            var attempts = new Dictionary<int, string>(Math.Max(1, _settings.MaxConnectionRetry));
+            var exceptions = new Dictionary<AmqpTcpEndpoint, Exception>(1);
+            var attempts = new Dictionary<AmqpTcpEndpoint, int>(1);
             while (!ok && (++retries < _settings.MaxConnectionRetry || _settings.MaxConnectionRetry == -1 || _settings.MaxConnectionRetry == System.Threading.Timeout.Infinite))
             {
                 try
@@ -91,8 +91,11 @@
                 }
                 catch (Exception e)
                 {
-                    exceptions[retries] = e;
-                    attempts[retries] = string.Format("{1} : Attempt {0}", retries, DateTime.UtcNow);
+                    var endpoint = new AmqpTcpEndpoint();
+                    if (_settings.ConnectionFactory != null && _settings.ConnectionFactory.Endpoint != null)
+                        endpoint = _settings.ConnectionFactory.Endpoint;
+                    exceptions[endpoint] = e;
+                    attempts[endpoint] = retries;
                     OnTemporaryConnectionFailureFailure(e);
                     Thread.Sleep(_settings.IntervalConnectionTries);
                 }


Comment about max possible graphic layers

--- Raccoon/Graphics/Drawables/Graphic.cs
+++ Raccoon/Graphics/Drawables/Graphic.cs
@@ -4,7 +4,7 @@
     public abstract class Graphic : IUpdatable, IRenderable {
         #region Public Members

-        public static int LayersCount = 10000;
+        public static int LayersCount = 10000; // Since we're using 24 bits depth-buffer, max layers count could be: 16777215

         #endregion Public Members


session access to allow auth

session access to allow auth

--- MiniMVC/Controller.cs
+++ MiniMVC/Controller.cs
@@ -16,12 +16,13 @@

 using System.Text.RegularExpressions;
 using System.Web;
+using System.Web.SessionState;

 namespace MiniMVC {
     /// <summary>
     /// Handles view plumbing
     /// </summary>
-    public abstract class Controller : IController, IHttpHandler {
+    public abstract class Controller : IController, IHttpHandler, IReadOnlySessionState {
         public abstract IResult Execute(HttpContextBase context);

         public virtual void ProcessRequest(HttpContext context) {


Fix opoint viewer not reseting image when cancelled

--- LF2.IDE/FormDesign.cs
+++ LF2.IDE/FormDesign.cs
@@ -846,7 +846,9 @@
 				backgroundWorker_CreateOpointCache.RunWorkerAsync();
 			}
 			else
+			{
 				backgroundWorker_CreateOpointCache.CancelAsync();
+			}
 		}

 		void CreateOpointCache(object sender, DoWorkEventArgs e)
@@ -912,6 +914,10 @@

 				try { mainForm.formEventLog.Log("Opoint Cache Created: " + stopWatch.Elapsed, true); }
 				catch { }
+			}
+			if (e.Cancelled)
+			{
+				tagBox.OPointImage = null;
 			}
 			button_CreateOpointCache.Text = cacheButtonString;
 			stopWatch.Reset();


added Set which is used for assignment 	modified:   Dragon/Source/Stmt.cs

--- Dragon/Source/Stmt.cs
+++ Dragon/Source/Stmt.cs
@@ -100,6 +100,7 @@
         }
     }

+
     public class Do : Stmt
     {
         public Expr Expr;
@@ -128,4 +129,32 @@
             this.Expr.Jumping(beginning, 0);
         }
     }
+
+
+    //for assignment
+    public class Set : Stmt
+    {
+        public Id Id;
+        public Expr Expr;
+
+        public Set(Id id, Expr expr)
+        {
+            this.Id = id;
+            this.Expr = expr;
+            if( null == this.Check(this.Id.Type, this.Expr.Type))
+                this.Error("type error");
+        }
+
+        public Type Check(Type lhs, Type rhs)
+        {
+            if (Dragon.Type.Numeric(lhs) && Dragon.Type.Numeric(rhs)) return rhs;//why rhs?
+            else if (lhs == Dragon.Type.Bool && rhs == Dragon.Type.Bool) return rhs;
+            else return null;
+        }
+
+        public override void Gen(int beginning, int after)
+        {
+            this.Emit(this.Id.ToString() + " = " + this.Expr.Gen().ToString());
+        }
+    }
 }


set of TODO items for the next round

set of TODO items for the next round

--- NSaga/SagaMediator.cs
+++ NSaga/SagaMediator.cs
@@ -34,31 +34,13 @@
             {
                 throw new ArgumentException("CorrelationId was not provided in the message. Please make sure you assign CorrelationId before initiating your Saga");
             }
+            //TODO Find saga
             //var saga = sagaRepository.Find(sagaMessage.CorrelationId);

-            //var initiatingMessage = sagaMessage as IInitiatingSagaMessage;
-            //if (initiatingMessage != null && saga != null)
-            //{
-            //    // saga with this CorrelationID already exists, can't initiate it again
-            //    throw new Exception("Saga have already been initialised");
-            //}
-
-            //if (initiatingMessage == null && saga == null)
-            //{
-            //    throw new Exception("Saga does not exist in the storage, but consumed message is not an initiating message. Please start Saga from IInitiatingMessage");
-            //}
-
-            //if (initiatingMessage != null)
-            //{
-            //    //var sagaType = sagaMessage.GetType(); //TODO find saga type that implements InitiatedBy<TSagaMessage>
-
-            //    //saga = sagaRepository.InitiateSaga(sagaType);
-            //    //var operationResult = saga.Initiate(sagaMessage);
-            //    //sagaRepository.Save(saga);
-            //    //return operationResult;
-            //}
-
-            //// saga should
+            //TODO check that saga exists
+            //TODO check that saga implements ConsumerOf<TMsg>
+            //TODO execute saga message
+            //TODO save saga into repository

             throw new NotImplementedException();
         }


Disabled spell checking from the text area.

--- Views/HqlPlaygroundAdmin/Index.cshtml
+++ Views/HqlPlaygroundAdmin/Index.cshtml
@@ -6,7 +6,7 @@
     @Html.ValidationSummary()
     <fieldset>
         @T("Query")
-        <textarea id="query" name="q" rows="15">@Model.Query</textarea>
+        <textarea id="query" name="q" rows="15" spellcheck="false">@Model.Query</textarea>
         @T("Result type:")
         <input type="radio" id="type-content" name="resultType" value="content" checked="@(Model.ResultType == "content")"/>
         Content Ids


Fixed test failure for CreateInstance with generic types.

--- Runtime/CoreLib.Plugin/OOPEmulator.cs
+++ Runtime/CoreLib.Plugin/OOPEmulator.cs
@@ -287,7 +287,7 @@
 				stmts.Add(new JsExpressionStatement(c.NamedConstructors.Reverse().Aggregate((JsExpression)JsExpression.Member(typeRef, Prototype), (right, ctor) => JsExpression.Assign(JsExpression.Member(JsExpression.Member(typeRef, ctor.Name), Prototype), right))));	// This generates a statement like {C}.ctor1.prototype = {C}.ctor2.prototype = {C}.prototoype
 			}

-			var defaultConstructor = c.CSharpTypeDefinition.GetConstructors().SingleOrDefault(x => x.Parameters.Count == 0 && x.IsPublic);
+			var defaultConstructor = Saltarelle.Compiler.Utils.SelfParameterize(c.CSharpTypeDefinition).GetConstructors().SingleOrDefault(x => x.Parameters.Count == 0 && x.IsPublic);
 			if (defaultConstructor != null) {
 				var sem = _metadataImporter.GetConstructorSemantics(defaultConstructor);
 				if (sem.Type != ConstructorScriptSemantics.ImplType.UnnamedConstructor && sem.Type != ConstructorScriptSemantics.ImplType.NotUsableFromScript) {


Map .NET Framework [4.5, 5.0) to target CSharp_v4_5

--- runtime/CSharp/Antlr4BuildTasks/Antlr4ClassGenerationTaskInternal.cs
+++ runtime/CSharp/Antlr4BuildTasks/Antlr4ClassGenerationTaskInternal.cs
@@ -285,7 +285,7 @@
                     string framework = TargetFrameworkVersion;
                     if (string.IsNullOrEmpty(framework))
                         framework = "v2.0";
-                    if (framework == "v4.5.1")
+                    if (framework.StartsWith("v4.5."))
                         framework = "v4.5";

                     string language;


Null check before adding using ICacheItemFactory

--- MemoryCacheT/Cache.cs
+++ MemoryCacheT/Cache.cs
@@ -105,12 +105,22 @@

         public void Add(KeyValuePair<TKey, TValue> keyValuePair)
         {
+            if (keyValuePair.Key == null)
+            {
+                throw new ArgumentNullException("key");
+            }
+
             ICacheItem<TValue> cacheItem = _cacheItemFactory.CreateInstance(keyValuePair.Value);
             Add(keyValuePair.Key, cacheItem);
         }

         public void Add(TKey key, TValue value)
         {
+            if(key == null)
+            {
+                throw new ArgumentNullException("key");
+            }
+
             ICacheItem<TValue> cacheItem = _cacheItemFactory.CreateInstance(value);
             Add(key, cacheItem);
         }


Workaround for "potentially dangerous Request.Form value" in more binding areas

--- WebEditor/WebEditor/Models/Element.cs
+++ WebEditor/WebEditor/Models/Element.cs
@@ -251,7 +251,7 @@
                             int dictionaryCount = 0;
                             foreach (var item in dictionary.Items.Values)
                             {
-                                object expressionValue = provider.GetValue(string.Format("{0}-key{1}", key, dictionaryCount)).ConvertTo(typeof(string));
+                                string expressionValue = GetValueProviderString(provider, string.Format("{0}-key{1}", key, dictionaryCount));
                                 switchResult.Attributes.Add(string.Format("key{0}", dictionaryCount), expressionValue);

                                 ElementSaveData.ScriptsSaveData caseScriptResult = new ElementSaveData.ScriptsSaveData();
@@ -363,9 +363,8 @@
                         else
                         {
                             string key = string.Format("{0}-simpleeditor", attributePrefix);
-                            ValueProviderResult value = provider.GetValue(key);
-                            if (value == null) return string.Empty;
-                            string simpleValue = value.ConvertTo(typeof(string)) as string;
+                            string simpleValue = GetValueProviderString(provider, key);
+                            if (simpleValue == null) return string.Empty;

                             switch (simpleEditor)
                             {
@@ -385,8 +384,7 @@
                     if (dropdownKeyValue == "expression")
                     {
                         string key = attributePrefix;
-                        ValueProviderResult value = provider.GetValue(key);
-                        return value == null ? null : value.ConvertTo(typeof(string));
+                        return GetValueProviderString(provider, key);
                     }
                     else
                     {
@@ -407,8 +405,7 @@
             else
             {
                 string key = attributePrefix;
-                ValueProviderResult value = provider.GetValue(key);
-                return value == null ? null : value.ConvertTo(typeof(string));
+                return GetValueProviderString(provider, key);
             }
         }


Added indexer to help address jehugaleahsa/SQLGeneration#4

--- SQLGeneration/Builders/FilterGroup.cs
+++ SQLGeneration/Builders/FilterGroup.cs
@@ -27,8 +27,8 @@
             {
                 _filters.Add(Tuple.Create(filter, conjunction));
             }
-        }
-
+        }
+
         /// <summary>
         /// Gets the filters in the filter group.
         /// </summary>
@@ -38,6 +38,19 @@
             {
                 return _filters.Select(pair => pair.Item1).ToArray();
             }
+        }
+
+        /// <summary>
+        /// Gets the filter with it's conjunction by a particular index.
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns></returns>
+        public Tuple<IFilter, Conjunction> this[int index]
+        {
+            get
+            {
+                return _filters[index];
+            }
         }

         /// <summary>


Remove unused JsonTokenizer.Json property.

--- Sandra.UI.WF/Storage/JsonTokenizer.cs
+++ Sandra.UI.WF/Storage/JsonTokenizer.cs
@@ -43,11 +43,6 @@
         private int currentIndex;
         private int firstUnusedIndex;
         private Func<IEnumerable<TextElement<JsonSymbol>>> currentTokenizer;
-
-        /// <summary>
-        /// Gets the JSON which is tokenized.
-        /// </summary>
-        public string Json => json;

         /// <summary>
         /// Initializes a new instance of <see cref="JsonTokenizer"/>.
@@ -468,7 +463,7 @@
         }

         /// <summary>
-        /// Tokenizes the source <see cref="Json"/> from start to end.
+        /// Tokenizes the source Json from start to end.
         /// </summary>
         /// <returns>
         /// An enumeration of <see cref="JsonSymbol"/> instances.


Added RemoveNodes and Detach extensions.

--- WmcSoft.Core/Xml/XmlNodeExtensions.cs
+++ WmcSoft.Core/Xml/XmlNodeExtensions.cs
@@ -148,23 +148,11 @@
         }

         public static int IndexOf(this XmlNode self) {
-            int index = 0;
-            foreach (XmlNode node in self.ParentNode.ChildNodes) {
-                if (self == node)
-                    return index;
-                index++;
-            }
-            return -1;
+            return IndexOf(self.ParentNode.ChildNodes, self);
         }

         public static int IndexOf(this XmlNode self, XmlNode child) {
-            int index = 0;
-            foreach (XmlNode node in self.ChildNodes) {
-                if (child == node)
-                    return index;
-                index++;
-            }
-            return -1;
+            return IndexOf(self.ChildNodes, child);
         }

         public static int IndexOf(this XmlNodeList self, XmlNode child) {
@@ -176,5 +164,105 @@
             }
             return -1;
         }
+
+        /// <summary>
+        /// Selects a list of nodes matching the XPath expression.
+        /// </summary>
+        /// <param name="node">The current node.</param>
+        /// <param name="xpath">The XPath expression.</param>
+        /// <returns>An <see cref="XmlNodeList"/> containing a collection of nodes matching the XPath query, once removed from the document.</returns>
+        /// <exception cref="XPathException">The XPath expression contains a prefix.</exception>
+        public static XmlNodeList RemoveNodes(this XmlNode node, string xpath) {
+            var list = node.SelectNodes(xpath);
+            DetachAll(list);
+            return list;
+        }
+
+        /// <summary>
+        /// Selects a list of nodes matching the XPath expression. Any prefixes found in
+        /// the XPath expression are resolved using the supplied System.Xml.XmlNamespaceManager.
+        /// </summary>
+        /// <param name="node">The current node.</param>
+        /// <param name="xpath">The XPath expression.</param>
+        /// <param name="nsmgr">An <see cref="XmlNamespaceManager"/> to use for resolving namespaces for prefixes in the XPath expression.</param>
+        /// <returns>An <see cref="XmlNodeList"/> containing a collection of nodes matching the XPath query, once removed from the document.</returns>
+        /// <exception cref="XPathException">The XPath expression contains a prefix which is not defined in the XmlNamespaceManager.</exception>
+        public static XmlNodeList RemoveNodes(this XmlNode node, string xpath, XmlNamespaceManager nsmgr) {
+            var list = node.SelectNodes(xpath, nsmgr);
+            DetachAll(list);
+            return list;
+        }
+
+        public static bool Detach(this XmlAttribute attr) {
+            var owner = attr.OwnerElement;
+            if (owner != null) {
+                owner.Attributes.Remove(attr);
+                return true;
+            }
+            return false;
+        }
+
+        public static bool Detach(this XmlNode node) {
+            if (node.ParentNode != null) {
+                node.ParentNode.RemoveChild(node);
+                return true;
+            }
+
+            switch (node.NodeType) {
+            case XmlNodeType.None:
+                break;
+            case XmlNodeType.Element:
+                break;
+            case XmlNodeType.Attribute:
+                return Detach((XmlAttribute)node);
+            case XmlNodeType.Text:
+                break;
+            case XmlNodeType.CDATA:
+                break;
+            case XmlNodeType.EntityReference:
+                break;
+            case XmlNodeType.Entity:
+                break;
+            case XmlNodeType.ProcessingInstruction:
+                break;
+            case XmlNodeType.Comment:
+                break;
+            case XmlNodeType.Document:
+                break;
+            case XmlNodeType.DocumentType:
+                break;
+            case XmlNodeType.DocumentFragment:
+                break;
+            case XmlNodeType.Notation:
+                break;
+            case XmlNodeType.Whitespace:
+                break;
+            case XmlNodeType.SignificantWhitespace:
+                break;
+            case XmlNodeType.EndElement:
+                break;
+            case XmlNodeType.EndEntity:
+                break;
+            case XmlNodeType.XmlDeclaration:
+                break;
+            default:
+                break;
+            }
+
+            return false;
+        }
+
+        public static void DetachAt(this XmlNodeList list, int index) {
+            var node = list[index];
+            Detach(node);
+        }
+
+        public static void DetachAll(this XmlNodeList list) {
+            var length = list.Count;
+            for (int i = 0; i < length; i++) {
+                var node = list[i];
+                Detach(node);
+            }
+        }
     }
 }


Create completed pomodoro in db async

Create completed pomodoro in db async

--- YAPA.Shared/Common/DashboardPlugin.cs
+++ YAPA.Shared/Common/DashboardPlugin.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading.Tasks;
 using YAPA.Shared.Contracts;

 namespace YAPA.Shared.Common
@@ -43,7 +44,10 @@

         private void _engine_OnPomodoroCompleted()
         {
-            _itemRepository.Add(new PomodoroEntity { Count = 1, DateTime = DateTime.UtcNow.Date });
+            Task.Run(() =>
+            {
+                _itemRepository.Add(new PomodoroEntity { Count = 1, DateTime = DateTime.UtcNow.Date });
+            });
         }
     }


SONARMSBRU-323 Fix Null assertion when encoding can't be guessed

--- SonarScanner.Shim/PropertiesWriter.cs
+++ SonarScanner.Shim/PropertiesWriter.cs
@@ -133,9 +133,10 @@
             AppendKeyValue(sb, guid, SonarProperties.ProjectName, project.ProjectName);
             AppendKeyValue(sb, guid, SonarProperties.ProjectBaseDir, project.GetProjectDirectory());

-            Debug.Assert(!string.IsNullOrWhiteSpace(project.Encoding), "Expecting a project with non-empty encoding");
-
-            AppendKeyValue(sb, guid, SonarProperties.SourceEncoding, project.Encoding.ToLowerInvariant());
+            if (!string.IsNullOrWhiteSpace(project.Encoding))
+            {
+                AppendKeyValue(sb, guid, SonarProperties.SourceEncoding, project.Encoding.ToLowerInvariant());
+            }

             if (fxCopReportFilePath != null)
             {


1L is the long number

1L is the long number

--- Source/Forms/BitMaskCheckedListBox.cs
+++ Source/Forms/BitMaskCheckedListBox.cs
@@ -38,7 +38,7 @@
       {
         long result = 0;
         for (int i = 0; i < this.Items.Count; i++)
-          if (this.GetItemChecked(i)) result |= (long)1 << i;
+          if (this.GetItemChecked(i)) result |= 1L << i;
         return result;
       }
       set
@@ -46,7 +46,7 @@
         this.BeginUpdate();
         for (int i = 0; i < this.Items.Count; i++)
         {
-          long j = (long)1 << i;
+          long j = 1L << i;
           bool nch = (value & j) == j;
           bool och = this.GetItemChecked(i);
           if (nch != och) this.SetItemChecked(i, nch);


Remove leftover Net45 conditionals

Remove leftover Net45 conditionals

--- Extensions/Ext.Uri.cs
+++ Extensions/Ext.Uri.cs
@@ -56,11 +56,7 @@
             if (data == null)
                 throw new ArgumentNullException(nameof(data));

-#if Net45
             return WebUtility.UrlEncode(data);
-#else
-            return Uri.EscapeDataString(data);
-#endif
         }

         /// <summary>
@@ -72,11 +68,7 @@
             if (data == null)
                 throw new ArgumentNullException(nameof(data));

-#if Net45
             return WebUtility.UrlDecode(data);
-#else
-            return Uri.UnescapeDataString(data);
-#endif
         }

         /// <summary>


Added additional CreateChild overload

Added additional CreateChild overload

--- Source/Miruken/Concurrency/Promise.cs
+++ Source/Miruken/Concurrency/Promise.cs
@@ -1121,7 +1121,7 @@

         protected virtual Promise<R> CreateChild<R>(Promise<R>.PromiseOwner owner)
         {
-            var child = new Promise<R>(_mode, (resolve, reject, onCancel) =>
+            var child = CreateChild<R>(_mode, (resolve, reject, onCancel) =>
             {
                 owner(resolve, reject);
                 onCancel(() =>
@@ -1134,6 +1134,12 @@
             if (_mode == ChildCancelMode.All)
                 Interlocked.Increment(ref _childCount);
             return child;
+        }
+
+        protected virtual Promise<R> CreateChild<R>(
+            ChildCancelMode mode, Promise<R>.CancellingPromiseOwner owner)
+        {
+            return new Promise<R>(_mode, owner);
         }

         public new T Wait()


Update UserTable.cs

Update UserTable.cs

Removed erroneous comma.

--- src/UserTable.cs
+++ src/UserTable.cs
@@ -250,7 +250,7 @@
             string commandText = @"
                 UPDATE ""AspNetUsers""
                    SET ""UserName"" = @userName, ""PasswordHash"" = @pswHash, ""SecurityStamp"" = @secStamp, ""Email""= @email,
-                       ""EmailConfirmed"" = @emailconfirmed,
+                       ""EmailConfirmed"" = @emailconfirmed
                  WHERE ""Id"" = @userId;";

             Dictionary<string, object> parameters = new Dictionary<string, object>();


Cannot change channel.

Cannot change channel.

--- Source/Norma.Eta/Models/ConnectOps.cs
+++ Source/Norma.Eta/Models/ConnectOps.cs
@@ -16,7 +16,10 @@
         public void Load()
         {
             if (!File.Exists(NormaConstants.OpsFile))
+            {
+                Operation = null;
                 return;
+            }
             using (var sr = File.OpenText(NormaConstants.OpsFile))
             {
                 var jsonSettings = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};


RoaringFangs.Events improvements Added fault tolerance for adding/removing event handlers that can't normally be added as persistent events in the editor.

--- Source/RoaringFangs/Utility/Events.cs
+++ Source/RoaringFangs/Utility/Events.cs
@@ -23,6 +23,8 @@
 */

 using UnityEngine.Events;
+using System;
+using UnityEngine;

 #if UNITY_EDITOR

@@ -34,12 +36,28 @@
 {
     public static class Events
     {
+        private static readonly string MessageWarnFallbackAdd =
+@"Attempted to add event listener with non-UnityEngine.Object target to UnityEvent.
+AddListenerAuto will use non-persistent fallback.";
+
+        private static readonly string MessageWarnFallbackRemove =
+@"Attempted to remove event listener with non-UnityEngine.Object target to UnityEvent.
+AddListenerAuto will use non-persistent fallback for.";
+
         #region Add

         public static void AddListenerAuto(UnityEvent @event, UnityAction listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.AddPersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.AddPersistentListener(@event, listener);
+            }
+            catch(ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackAdd);
+                @event.AddListener(listener);
+            }
 #else
             @event.AddListener(listener);
 #endif
@@ -48,7 +66,15 @@
         public static void AddListenerAuto<T0>(UnityEvent<T0> @event, UnityAction<T0> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.AddPersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.AddPersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackAdd);
+                @event.AddListener(listener);
+            }
 #else
             @event.AddListener(listener);
 #endif
@@ -57,7 +83,15 @@
         public static void AddListenerAuto<T0, T1>(UnityEvent<T0, T1> @event, UnityAction<T0, T1> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.AddPersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.AddPersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackAdd);
+                @event.AddListener(listener);
+            }
 #else
             @event.AddListener(listener);
 #endif
@@ -66,7 +100,15 @@
         public static void AddListenerAuto<T0, T1, T2>(UnityEvent<T0, T1, T2> @event, UnityAction<T0, T1, T2> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.AddPersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.AddPersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackAdd);
+                @event.AddListener(listener);
+            }
 #else
             @event.AddListener(listener);
 #endif
@@ -75,7 +117,15 @@
         public static void AddListenerAuto<T0, T1, T2, T3>(UnityEvent<T0, T1, T2, T3> @event, UnityAction<T0, T1, T2, T3> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.AddPersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.AddPersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackAdd);
+                @event.AddListener(listener);
+            }
 #else
             @event.AddListener(listener);
 #endif
@@ -88,7 +138,15 @@
         public static void RemoveListenerAuto(UnityEvent @event, UnityAction listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.RemovePersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.RemovePersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackRemove);
+                @event.RemoveListener(listener);
+            }
 #else
             @event.RemoveListener(listener);
 #endif
@@ -97,7 +155,15 @@
         public static void RemoveListenerAuto<T0>(UnityEvent<T0> @event, UnityAction<T0> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.RemovePersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.RemovePersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackRemove);
+                @event.RemoveListener(listener);
+            }
 #else
             @event.RemoveListener(listener);
 #endif
@@ -106,7 +172,15 @@
         public static void RemoveListenerAuto<T0, T1>(UnityEvent<T0, T1> @event, UnityAction<T0, T1> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.RemovePersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.RemovePersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackRemove);
+                @event.RemoveListener(listener);
+            }
 #else
             @event.RemoveListener(listener);
 #endif
@@ -115,7 +189,15 @@
         public static void RemoveListenerAuto<T0, T1, T2>(UnityEvent<T0, T1, T2> @event, UnityAction<T0, T1, T2> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.RemovePersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.RemovePersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackRemove);
+                @event.RemoveListener(listener);
+            }
 #else
             @event.RemoveListener(listener);
 #endif
@@ -124,7 +206,15 @@
         public static void RemoveListenerAuto<T0, T1, T2, T3>(UnityEvent<T0, T1, T2, T3> @event, UnityAction<T0, T1, T2, T3> listener)
         {
 #if UNITY_EDITOR
-            UnityEventTools.RemovePersistentListener(@event, listener);
+            try
+            {
+                UnityEventTools.RemovePersistentListener(@event, listener);
+            }
+            catch (ArgumentException)
+            {
+                Debug.LogWarning(MessageWarnFallbackRemove);
+                @event.RemoveListener(listener);
+            }
 #else
             @event.RemoveListener(listener);
 #endif


Removed app-specific code from shared IntelliMediaCore

--- Source/Unity/Views/AppIocBootstrap.cs
+++ Source/Unity/Views/AppIocBootstrap.cs
@@ -79,15 +79,9 @@
             Container.Resolve<ViewFactory>().Register<LoadingViewModel, LoadingView>();
             Container.Resolve<ViewFactory>().Register<SignInViewModel, SignInView>();
 			Container.Resolve<ViewFactory>().Register<MainMenuViewModel, MainMenuView>();
+
+			Container.Resolve<StageManager>().Reveal<SignInViewModel>().Start();

-			if (StraightToContent)
-			{
-				Container.Resolve<StageManager>().Reveal<MetaTutorIVH.ContentViewModel>().Start();
-			}
-			else
-			{
-				Container.Resolve<StageManager>().Reveal<SignInViewModel>().Start();
-			}
 		}
 	}
 }


Path.Combine causing issues in mono

Path.Combine causing issues in mono

--- Source/VBin.Uploader/UploadProgram.cs
+++ Source/VBin.Uploader/UploadProgram.cs
@@ -115,7 +115,7 @@

             Console.WriteLine();

-            foreach( var file in Directory.GetFiles( sourcePath ) )
+			foreach( var file in Directory.GetFiles( sourcePath ) )
             {
                 if( !fileSpecRegex.IsMatch( Path.GetFileName( file ) ) )
                 {
@@ -124,7 +124,7 @@

                 using( var strm = File.OpenRead( file ) )
                 {
-                    string remoteFileName = Path.Combine( basePath, Path.GetFileName( file ) );
+					string remoteFileName = basePath + Path.GetFileName( file );

                     Console.ForegroundColor = ConsoleColor.Cyan;
                     Console.WriteLine( "{0} -> {1}", file, remoteFileName );


port rev. 2600:
Issue 1653 consistent interpretation of mask penalty i: applied when 5+i=5 (i=0) consecutive modules are the same

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS05/]$/ZXingNet/trunk;C85977

--- Source/lib/qrcode/encoder/MaskUtil.cs
+++ Source/lib/qrcode/encoder/MaskUtil.cs
@@ -254,7 +254,7 @@
                   prevBit = bit;
                }
             }
-            if (numSameBitCells > 5)
+            if (numSameBitCells >= 5)
             {
                penalty += N1 + (numSameBitCells - 5);
             }


#46 Bad DataMatrix output

#46 Bad DataMatrix output

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS05/]$/ZXingNet/trunk;C90319

--- Source/lib/renderer/BitmapRenderer.cs
+++ Source/lib/renderer/BitmapRenderer.cs
@@ -146,6 +146,19 @@
          // calculating the scaling factor
          var pixelsizeWidth = width / matrix.Width;
          var pixelsizeHeight = height / matrix.Height;
+
+         if (pixelsizeWidth != pixelsizeHeight)
+         {
+            if (format == BarcodeFormat.QR_CODE ||
+                format == BarcodeFormat.AZTEC ||
+                format == BarcodeFormat.DATA_MATRIX ||
+                format == BarcodeFormat.MAXICODE ||
+                format == BarcodeFormat.PDF_417)
+            {
+               // symetric scaling
+               pixelsizeHeight = pixelsizeWidth = pixelsizeHeight < pixelsizeWidth ? pixelsizeHeight : pixelsizeWidth;
+            }
+         }

          // create the bitmap and lock the bits because we need the stride
          // which is the width of the image and possible padding bytes


Fixed Trade Offers

Fixed Trade Offers

--- SteamTrade/TradeOffer/OfferSession.cs
+++ SteamTrade/TradeOffer/OfferSession.cs
@@ -31,6 +31,7 @@
         {
             tradeId = "";
             var data = new NameValueCollection();
+            data.Add("sessionid", steamWeb.SessionId);
             data.Add("tradeofferid", tradeOfferId);

             string url = string.Format("https://steamcommunity.com/tradeoffer/{0}/accept", tradeOfferId);
@@ -70,6 +71,7 @@
         public bool Decline(string tradeOfferId)
         {
             var data = new NameValueCollection();
+            data.Add("sessionid", steamWeb.SessionId);
             data.Add("tradeofferid", tradeOfferId);

             string url = string.Format("https://steamcommunity.com/tradeoffer/{0}/decline", tradeOfferId);
@@ -107,6 +109,7 @@
         public bool Cancel(string tradeOfferId)
         {
             var data = new NameValueCollection();
+            data.Add("sessionid", steamWeb.SessionId);
             data.Add("tradeofferid", tradeOfferId);

             string url = string.Format("https://steamcommunity.com/tradeoffer/{0}/cancel", tradeOfferId);
@@ -158,6 +161,7 @@
             }

             var data = new NameValueCollection();
+            data.Add("sessionid", steamWeb.SessionId);
             data.Add("partner", otherSteamId.ConvertToUInt64().ToString());
             data.Add("tradeoffermessage", message);
             data.Add("json_tradeoffer", JsonConvert.SerializeObject(status, JsonSerializerSettings));
@@ -189,6 +193,7 @@
         public bool SendTradeOffer(string message, SteamID otherSteamId, TradeOffer.TradeStatus status, out string newTradeOfferId)
         {
             var data = new NameValueCollection();
+            data.Add("sessionid", steamWeb.SessionId);
             data.Add("partner", otherSteamId.ConvertToUInt64().ToString());
             data.Add("tradeoffermessage", message);
             data.Add("json_tradeoffer", JsonConvert.SerializeObject(status, JsonSerializerSettings));
@@ -219,6 +224,7 @@
             var offerToken = new OfferAccessToken() {TradeOfferAccessToken = token};

             var data = new NameValueCollection();
+            data.Add("sessionid", steamWeb.SessionId);
             data.Add("partner", otherSteamId.ConvertToUInt64().ToString());
             data.Add("tradeoffermessage", message);
             data.Add("json_tradeoffer", JsonConvert.SerializeObject(status, JsonSerializerSettings));


refactor

refactor

--- Stock.Trader.HuaTai/WebStockTrader.cs
+++ Stock.Trader.HuaTai/WebStockTrader.cs
@@ -456,7 +456,7 @@
                         CostPrice = si.cost_price,
                         CurrentAmount = si.current_amount,
                         EnableAmount = si.enable_amount,
-                        IncomeAmount = si.income_balance,
+                        IncomeAmount = (int)si.income_balance,
                         KeepCostPrice = si.keep_cost_price,
                         LastPrice = si.last_price
                     };


Assembly version bump

Assembly version bump

--- Strike.NET/Properties/AssemblyInfo.cs
+++ Strike.NET/Properties/AssemblyInfo.cs
@@ -39,5 +39,5 @@
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]

-[assembly: AssemblyVersion("1.1.0.0")]
-[assembly: AssemblyFileVersion("1.1.0.0")]+[assembly: AssemblyVersion("1.1.1.0")]
+[assembly: AssemblyFileVersion("1.1.1.0")]


FIx hashcode type.

FIx hashcode type.

Union<T1, T2, T3, T4> mistakenly uses the hashcode of value1 for value2.

--- SuccincT/Unions/Union{T1,T2,T3,T4}.cs
+++ SuccincT/Unions/Union{T1,T2,T3,T4}.cs
@@ -45,7 +45,7 @@
             _hashCodes = new Dictionary<Variant, Func<int>>
             {
                 { Variant.Case1, () => _value1.GetHashCode() },
-                { Variant.Case2, () => _value1.GetHashCode() },
+                { Variant.Case2, () => _value2.GetHashCode() },
                 { Variant.Case3, () => _value3.GetHashCode() },
                 { Variant.Case4, () => _value4.GetHashCode() }
             };
@@ -121,4 +121,4 @@
         private bool UnionsEqual(Union<T1, T2, T3, T4> testObject) =>
             Case == testObject.Case && _unionsMatch[Case](testObject);
     }
-}+}


Converted ActionFunction of superscribe node to property with backing field

--- Superscribe/Models/SuperscribeNode.cs
+++ Superscribe/Models/SuperscribeNode.cs
@@ -10,7 +10,9 @@

     public class SuperscribeNode : IEquatable<SuperscribeNode>
     {
-        public Func<dynamic, string, bool> activationFunction;
+        protected Func<dynamic, string, bool> activationFunction;
+
+        protected Action<dynamic, string> actionFunction;

         /// <summary>
         /// Base constructor for superscribe states
@@ -67,7 +69,17 @@

         public object Result { get; set; }

-        public Action<dynamic, string> ActionFunction { get; set; }
+        public Action<dynamic, string> ActionFunction
+        {
+            get
+            {
+                return this.actionFunction;
+            }
+            set
+            {
+                this.actionFunction = value;
+            }
+        }

         public List<FinalFunction> FinalFunctions { get; set; }