Checks if pdb file exist before trying to read symbols.  If it doesnt, the test will now appear but you can't jump to the source code for test  #276

--- src/NUnitTestAdapter/NavigationDataProvider.cs
+++ src/NUnitTestAdapter/NavigationDataProvider.cs
@@ -41,10 +41,7 @@
             // TODO: Once NUnit is changed, try to simplify this.
             while (true)
             {
-                methodDef = typeDef
-                    .GetMethods()
-                    .Where(o => o.Name == methodName)
-                    .FirstOrDefault();
+                methodDef = typeDef.GetMethods().FirstOrDefault(o => o.Name == methodName);

                 if (methodDef != null)
                     break;
@@ -74,9 +71,13 @@
 #endif
         }

+        static bool DoesPdbFileExist(string filepath) => File.Exists(Path.ChangeExtension(filepath, ".pdb"));
+
+
         static IDictionary<string, TypeDefinition> CacheTypes(string assemblyPath)
         {
-            var readerParameters = new ReaderParameters() { ReadSymbols = true };
+            var readsymbols = DoesPdbFileExist(assemblyPath);
+            var readerParameters = new ReaderParameters { ReadSymbols = readsymbols};
             var module = ModuleDefinition.ReadModule(assemblyPath, readerParameters);

             var types = new Dictionary<string, TypeDefinition>();


Fix #2299 by not allowing $top to return more results than max page size.

--- src/NuGetGallery/DataServices/SearchAdaptor.cs
+++ src/NuGetGallery/DataServices/SearchAdaptor.cs
@@ -176,7 +176,7 @@
                 int top;
                 if(int.TryParse(topStr, out top))
                 {
-                    searchFilter.Take = top;
+                    searchFilter.Take = Math.Min(top, SearchAdaptor.MaxPageSize);
                 }
             }


Fixed performance regression in networking

--- src/Orleans/Messaging/IncomingMessageBuffer.cs
+++ src/Orleans/Messaging/IncomingMessageBuffer.cs
@@ -41,7 +41,12 @@

         public List<ArraySegment<byte>> BuildReceiveBuffer()
         {
-            AdjustBuffer();
+            // Opportunistic reset to start of buffer
+            if (decodeOffset == receiveOffset)
+            {
+                decodeOffset = 0;
+                receiveOffset = 0;
+            }
             return ByteArrayBuilder.BuildSegmentList(readBuffer, receiveOffset);
         }

@@ -62,12 +67,6 @@
         {
             msg = null;

-            // if we read the entire buffer, assume we could have read more if buffer was bigger, and increase buffer size.
-            if (receiveOffset == currentBufferSize && currentBufferSize < maxSustainedBufferSize)
-            {
-                GrowBuffer();
-            }
-
             // Is there enough read into the buffer to continue (at least read the lengths?)
             if (receiveOffset - decodeOffset < CalculateKnownMessageSize())
                 return false;
@@ -131,28 +130,19 @@
             headerLength = 0;
             bodyLength = 0;

+            AdjustBuffer();
+
             return true;
         }

         /// <summary>
         /// This call cleans up the buffer state to make it optimal for next read.
-        /// If all the messages were read from the buffer, the decode and receive offsets are moved to the start of the buffer.
-        /// If there is a partial message left, the leading chunks, used by any processed messages, are removed, from the front
+        /// The leading chunks, used by any processed messages, are removed from the front
         ///   of the buffer and added to the back.   Decode and receiver offsets are adjusted accordingly.
-        /// In either case, if the buffer was grown over the max sustained buffer size (to read a large message) it is shrunken.
+        /// If the buffer was grown over the max sustained buffer size (to read a large message) it is shrunken.
         /// </summary>
         private void AdjustBuffer()
         {
-            // Opportunistic reset to start of buffer, this should be the most common call path.
-            // If decodeoffset matches receiveoffset, we've processed all the messages in buffer, so we can reset both offsets to start of buffer,
-            //   Unless the current buffer size is over the max sustain size, in which we want to adjust buffers to shrink it.
-            if (decodeOffset == receiveOffset && currentBufferSize <= maxSustainedBufferSize)
-            {
-                decodeOffset = 0;
-                receiveOffset = 0;
-                return;
-            }
-
             // drop buffers consumed by messages and adjust offsets
             // TODO: This can be optimized further. Linked lists?
             int consumedBytes = 0;


runtime: deadlock fix, use of ConcurrentDictionary

removed unnecessary locking, fixed potential deadlock
simplified code

--- src/Peachpie.Runtime/Reflection/PhpTypeInfo.cs
+++ src/Peachpie.Runtime/Reflection/PhpTypeInfo.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
@@ -376,12 +377,7 @@
         /// <summary>
         /// Cache of resolved <see cref="PhpTypeInfo"/> corresponding to <see cref="RuntimeTypeHandle"/>.
         /// </summary>
-        readonly static Dictionary<RuntimeTypeHandle, PhpTypeInfo> s_cache = new Dictionary<RuntimeTypeHandle, PhpTypeInfo>();
-
-        /// <summary>
-        /// RW lock used ot access underlaying cache.
-        /// </summary>
-        readonly static ReaderWriterLockSlim s_lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
+        readonly static ConcurrentDictionary<Type, PhpTypeInfo> s_cache = new ConcurrentDictionary<Type, PhpTypeInfo>();

         /// <summary>
         /// Gets <see cref="PhpTypeInfo"/> of given <typeparamref name="TType"/>.
@@ -406,53 +402,22 @@
                 type = type.GetElementType() ?? throw new InvalidOperationException();
             }

-            PhpTypeInfo result = null;
-            var handle = type.TypeHandle;
-
-            // lookup cache first
-            s_lock.EnterUpgradeableReadLock();
-            try
-            {
-                if (!s_cache.TryGetValue(handle, out result))
-                {
-                    s_lock.EnterWriteLock();
-                    try
-                    {
-                        if (s_cache.TryGetValue(handle, out result))
-                        {
-                            // double checked lock
-                        }
-                        else if (type.IsGenericTypeDefinition) // TODO: or type.IsByRefLike - netstandard2.1
-                        {
-                            // generic type definition cannot be used as a type parameter for GetPhpTypeInfo<T>
-                            // just instantiate the type info and cache the result
-                            result = new PhpTypeInfo(type);
-                        }
-                        else
-                        {
-                            // invoke GetPhpTypeInfo<TType>() dynamically and cache the result
-                            result = (PhpTypeInfo)s_getPhpTypeInfo_T
-                                .MakeGenericMethod(type)
-                                .Invoke(null, Array.Empty<object>());
-                        }
-
-                        //
-                        s_cache[handle] = result;
-                    }
-                    finally
-                    {
-                        s_lock.ExitWriteLock();
-                    }
-                }
-            }
-            finally
-            {
-                s_lock.ExitUpgradeableReadLock();
-            }
-
-            //
-            Debug.Assert(result != null);
-            return result;
+            return s_cache.GetOrAdd(type, t =>
+            {
+                if (t.IsGenericTypeDefinition) // TODO: or type.IsByRefLike - netstandard2.1
+                {
+                    // generic type definition cannot be used as a type parameter for GetPhpTypeInfo<T>
+                    // just instantiate the type info and cache the result
+                    return new PhpTypeInfo(t);
+                }
+                else
+                {
+                    // invoke GetPhpTypeInfo<TType>() dynamically and cache the result
+                    return (PhpTypeInfo)s_getPhpTypeInfo_T
+                        .MakeGenericMethod(t)
+                        .Invoke(null, Array.Empty<object>());
+                }
+            });
         }

         /// <summary>
@@ -461,25 +426,12 @@
         /// <param name="handle">Type handle of the CLR type.</param>
         public static PhpTypeInfo GetPhpTypeInfo(this RuntimeTypeHandle handle)
         {
-            PhpTypeInfo result = null;
-
-            if (handle.Equals(default))
-            {
-                return null;
-            }
-
-            // lookup cache first
-            s_lock.EnterReadLock();
-            try
-            {
-                s_cache.TryGetValue(handle, out result);
-            }
-            finally
-            {
-                s_lock.ExitReadLock();
-            }
-
-            return result ?? GetPhpTypeInfo(Type.GetTypeFromHandle(handle));
+            if (handle.Value != IntPtr.Zero)
+            {
+                return GetPhpTypeInfo(Type.GetTypeFromHandle(handle));
+            }
+
+            return null;
         }

         /// <summary>
@@ -542,44 +494,25 @@
         /// <summary>
         /// Cached functions that creates an empty instance (instance of a class without calling its PHP constructor).
         /// </summary>
-        readonly static Dictionary<PhpTypeInfo, Func<Context, object>> s_emptyObjectActivators = new Dictionary<PhpTypeInfo, Func<Context, object>>();
+        readonly static ConcurrentDictionary<PhpTypeInfo, Func<Context, object>> s_emptyObjectActivators = new ConcurrentDictionary<PhpTypeInfo, Func<Context, object>>();

         /// <summary>
         /// Creates instance of the class without invoking its constructor.
         /// </summary>
         public static object CreateUninitializedInstance(this PhpTypeInfo phptype, Context ctx)
         {
-            Func<Context, object> activator;
-
-            s_lock.EnterUpgradeableReadLock();
-            try
-            {
-                if (!s_emptyObjectActivators.TryGetValue(phptype, out activator))
-                {
-                    s_lock.EnterWriteLock();
-                    try
-                    {
-                        if (!s_emptyObjectActivators.TryGetValue(phptype, out activator) &&
-                            !TryBuildCreateEmptyObjectFunc(phptype, out activator))
-                        {
-                            activator = (_ctx) =>
-                            {
-                                throw new NotSupportedException();
-                            };
-                        }
-
-                        s_emptyObjectActivators[phptype] = activator;
-                    }
-                    finally
-                    {
-                        s_lock.ExitWriteLock();
-                    }
-                }
-            }
-            finally
-            {
-                s_lock.ExitUpgradeableReadLock();
-            }
+            Func<Context, object> activator = s_emptyObjectActivators.GetOrAdd(phptype, t =>
+            {
+                if (!TryBuildCreateEmptyObjectFunc(t, out var activator))
+                {
+                    activator = (_ctx) =>
+                    {
+                        throw new NotSupportedException();
+                    };
+                }
+
+                return activator;
+            });

             return activator(ctx);
         }


removed unnecessary use of TypeInfo

removed unnecessary use of TypeInfo

--- src/Peachpie.Runtime/Reflection/PhpTypeInfo.cs
+++ src/Peachpie.Runtime/Reflection/PhpTypeInfo.cs
@@ -118,8 +118,7 @@

                 if (_lazyCreatorProtected == null || _lazyCreatorProtected != _lazyCreator) // in case protected creator == public creator, we can skip following checks
                 {
-                    var callerinfo = caller.GetTypeInfo();
-                    if (callerinfo.IsAssignableFrom(_type) || _type.IsAssignableFrom(callerinfo))
+                    if (caller.IsAssignableFrom(_type) || _type.IsAssignableFrom(caller))
                     {
                         // creation including protected|public .ctors
                         return this.Creator_protected;
@@ -229,28 +228,23 @@
             return _lazyCreatorProtected;
         }

-        internal PhpTypeInfo(TypeInfo t)
+        internal PhpTypeInfo(Type/*!*/t)
         {
             Debug.Assert(t != null);
-            _type = t;
-
-            Name = ResolvePhpTypeName(_type, GetPhpTypeAttribute());
+            _type = t.GetTypeInfo();
+
+            Name = ResolvePhpTypeName(t, GetPhpTypeAttribute());

             // register type in extension tables
             ExtensionsAppContext.ExtensionsTable.AddType(this);
         }

-        internal PhpTypeInfo(Type t)
-            : this(t.GetTypeInfo())
-        {
-        }
-
         PhpTypeAttribute GetPhpTypeAttribute() => _type.GetCustomAttribute<PhpTypeAttribute>(false);

         /// <summary>
         /// Resolves PHP-like type name.
         /// </summary>
-        static string ResolvePhpTypeName(TypeInfo tinfo, PhpTypeAttribute attr)
+        static string ResolvePhpTypeName(Type tinfo, PhpTypeAttribute attr)
         {
             string name = null;

@@ -385,7 +379,7 @@
             // invoke GetPhpTypeInfo<TType>() dynamically and cache the result
             if (result == null)
             {
-                if (type.GetTypeInfo().IsGenericTypeDefinition)
+                if (type.IsGenericTypeDefinition)
                 {
                     // generic type definition cannot be used as a type parameter for GetPhpTypeInfo<T>
                     // just instantiate the type info and cache the result


Fix to the header & footer links

Fix to the header & footer links

--- src/Red-Folder.com/Views/Shared/_Layout.cshtml
+++ src/Red-Folder.com/Views/Shared/_Layout.cshtml
@@ -68,7 +68,7 @@

-
+

                         <button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-1">
@@ -80,10 +80,10 @@

-
Services

-
Blog

-
Projects

-
My Bio

+
Services

+
Blog

+
Projects

+
My Bio

@@ -108,8 +108,8 @@

Home

Services

Blog

-
Projects

-
My Bio

+
Projects

+
My Bio

Red Folder Consultancy Limited © @DateTime.Now.Year


Modified a bit for RequestStream.cs, into the year 2015

--- websocket-sharp/Net/RequestStream.cs
+++ websocket-sharp/Net/RequestStream.cs
@@ -8,7 +8,7 @@
  * The MIT License
  *
  * Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
- * Copyright (c) 2012-2014 sta.blockhead
+ * Copyright (c) 2012-2015 sta.blockhead
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal


Fix bug in unique user sim

Fix bug in unique user sim

--- PostSimulationAnalysisOldRuntime/Program.cs
+++ PostSimulationAnalysisOldRuntime/Program.cs
@@ -103,7 +103,6 @@
                         while (malicious.Count > 0 && malicious.Peek().GetScoreForCondition(conditionNumber) >= blockThreshold)
                         {
                             Trial t = malicious.Dequeue();
-                            falsePositiveUsers.Add(t.UserID);
                             if (t.IsClientAProxyIP)
                                 falseNegativeWithProxy--;
                             if (t.IsIpInBenignPool)
@@ -116,6 +115,7 @@
                         while (benign.Count > 0 && benign.Peek().GetScoreForCondition(conditionNumber) >= blockThreshold)
                         {
                             Trial t = benign.Dequeue();
+                            falsePositiveUsers.Add(t.UserID);
                             if (t.IsIpInAttackersPool)
                                 falsePositivesWithAttackerIp++;
                             if (t.IsClientAProxyIP)


Area Defense Part 1

Area Defense Part 1

This is a rough draft, make it work layout for how Area defense will
work. First the Fire Controls will be looped through until an
appropriate one is found, then all the missiles in the star system that
FC is in have to be tested. The actual work of shooting down missiles,
and marking them as destroyed/removing ordnance groups from simulations
is not done for area defense yet.

Later on separating the PD FC lists out by star system will make this
more efficient if that is required.

--- Pulsar4X/Pulsar4X.Lib/Entities/SimEntity.cs
+++ Pulsar4X/Pulsar4X.Lib/Entities/SimEntity.cs
@@ -115,14 +115,13 @@
                 P[loop].SensorSweep(CurrentTick);
             }

-            /// <summary>
+            /*/// <summary>
             /// Insert Area Defense/ AMM Defense here.
             /// </summary>
             for (int loop = factionStart; loop < factionCount; loop++)
             {
                 AreaDefensiveFire(P[loop],RNG);
-            }
-#warning Area Defense / AMM Defense
+            }*/

             /// <summary>
             /// attempt to fire weapons at target here.
@@ -782,7 +781,165 @@
         /// <param name="RNG">"global" rng from further up.</param>
         public void AreaDefensiveFire(Faction Fact, Random RNG)
         {
-
+            /// <summary>
+            /// No point defense set FCs, just return.
+            /// </summary>
+            if (Fact.PointDefenseFC.Count == 0)
+            {
+                return;
+            }
+
+            /// <summary>
+            /// now loop through each BF in point defense FC.
+            /// This could be further optimized by system.
+            /// </summary>
+            foreach (KeyValuePair<ComponentTN, ShipTN> pair in Fact.PointDefenseFC)
+            {
+                StarSystem CurrentSystem = pair.Value.ShipsTaskGroup.Contact.CurrentSystem;
+
+                /// <summary>
+                /// No detected contacts in this system.
+                /// </summary>
+                if (Fact.DetectedContactLists.ContainsKey(CurrentSystem) == false)
+                {
+                    break;
+                }
+
+                /// <summary>
+                /// No missile contacts in this system.
+                /// </summary>
+                if (Fact.DetectedContactLists[CurrentSystem].DetectedMissileContacts.Count == 0)
+                {
+                    break;
+                }
+
+                /// <summary>
+                /// BFC
+                /// </summary>
+                if (Fact.PointDefenseFCType[pair.Key] == false && pair.Value.ShipBFC[pair.Key.componentIndex].pDState == PointDefenseState.AreaDefense)
+                {
+                    /// <summary>
+                    /// loop through every missile contact. will have to do distance checks here.
+                    /// </summary>
+                    foreach (KeyValuePair<OrdnanceGroupTN, FactionContact> MisPair in Fact.DetectedContactLists[CurrentSystem].DetectedMissileContacts)
+                    {
+                        /// <summary>
+                        /// Do a distance check on pair.Value vs the missile itself. if that checks out to be less than 10k km(or equal to zero), then
+                        /// check to see if the FC can shoot down said missile. This should never be run before a sensor sweep
+                        /// </summary>
+                        float dist = -1;
+
+                        int MissileID = CurrentSystem.SystemContactList.IndexOf(MisPair.Key.contact);
+                        int TGID = CurrentSystem.SystemContactList.IndexOf(pair.Value.ShipsTaskGroup.Contact);
+
+                        /// <summary>
+                        /// dist is in AU.
+                        /// </summary>
+                        dist = CurrentSystem.SystemContactList[MissileID].DistanceTable[TGID];
+
+                        /// <summary>
+                        /// Only bother with checks here that are within the maximum beam distance.
+                        /// </summary>
+                        if (dist <= Constants.Units.BEAM_AU_MAX)
+                        {
+                            float rangeAreaDefenseKm = pair.Value.ShipBFC[pair.Key.componentIndex].pDRange * 10.0f;
+                            float distKM = dist * (float)Constants.Units.KM_PER_AU;
+
+                            /// <summary>
+                            /// Additional paranoia check of range, I need to fix Area defense PD range values to ship bfc range in any event, that hasn't been done yet.
+                            /// </summary>
+                            float TotalRange = pair.Value.ShipBFC[pair.Key.componentIndex].beamFireControlDef.range * 2.0f;
+
+                            float range = rangeAreaDefenseKm;
+                            if (TotalRange < rangeAreaDefenseKm)
+                            {
+                                range = TotalRange;
+                            }
+
+                            /// <summary>
+                            /// the BFC is set for range defense and is in range of this missile.
+                            /// </summary>
+                            if (distKM <= range)
+                            {
+                                int increment = (int)Math.Floor((float)distKM / 1000.0f);
+
+                                /// <summary>
+                                /// Need to loop through until all missiles are shot down, or all the current BFC's linked weapons are expended
+                                //bool Intercept = pair.Value.ShipBFC[pair.Key.componentIndex].InterceptTarget(RNG, increment, pair.Value.CurrentSpeed, Missile, pair.Value.ShipsFaction,
+                                //                                                                                pair.Value.ShipsTaskGroup.Contact);
+#warning BFC Area Defense here
+                            }
+                        }
+                    }
+                }
+                /// <summary>
+                /// MFC
+                /// </summary>
+                else if (Fact.PointDefenseFCType[pair.Key] == true && pair.Value.ShipBFC[pair.Key.componentIndex].pDState >= PointDefenseState.AMM1v2 &&
+                    pair.Value.ShipBFC[pair.Key.componentIndex].pDState <= PointDefenseState.AMM5v1)
+                {
+                    foreach (KeyValuePair<OrdnanceGroupTN, FactionContact> MisPair in Fact.DetectedContactLists[CurrentSystem].DetectedMissileContacts)
+                    {
+                        /// <summary>
+                        /// Do a distance check on pair.Value vs the missile itself. if that checks out to be less than 10k km(or equal to zero), then
+                        /// check to see if the FC can shoot down said missile. This should never be run before a sensor sweep
+                        /// </summary>
+                        float dist = -1;
+
+                        int MissileID = CurrentSystem.SystemContactList.IndexOf(MisPair.Key.contact);
+                        int TGID = CurrentSystem.SystemContactList.IndexOf(pair.Value.ShipsTaskGroup.Contact);
+
+                        /// <summary>
+                        /// dist is in AU.
+                        /// </summary>
+                        dist = CurrentSystem.SystemContactList[MissileID].DistanceTable[TGID];
+
+                        float MFCEngageDistKm = pair.Value.ShipMFC[pair.Key.componentIndex].mFCSensorDef.maxRange;
+                        float rangeAreaDefenseKm = pair.Value.ShipMFC[pair.Key.componentIndex].pDRange * 10.0f;
+
+                        float range = rangeAreaDefenseKm;
+                        if (MFCEngageDistKm < rangeAreaDefenseKm)
+                        {
+                            range = MFCEngageDistKm;
+                        }
+
+                        int MSize = 0;
+                        int AltMSize = 0;
+                        if ((int)Math.Ceiling(MisPair.Key.missiles[0].missileDef.size) <= (Constants.OrdnanceTN.MissileResolutionMinimum + 6))
+                        {
+                            MSize = Constants.OrdnanceTN.MissileResolutionMinimum;
+                            AltMSize = 0;
+                        }
+                        else if ((int)Math.Ceiling(MisPair.Key.missiles[0].missileDef.size) <= (Constants.OrdnanceTN.MissileResolutionMaximum + 6))
+                        {
+                            MSize = (int)Math.Ceiling(MisPair.Key.missiles[0].missileDef.size);
+                            AltMSize = 0;
+                        }
+                        else if ((int)Math.Ceiling(MisPair.Key.missiles[0].missileDef.size) > (Constants.OrdnanceTN.MissileResolutionMaximum + 6))
+                        {
+                            MSize = -1;
+                            AltMSize = (int)Math.Ceiling(Math.Ceiling(MisPair.Key.missiles[0].missileDef.size) / 20.0);
+                        }
+
+                        int MFCRange = pair.Value.ShipMFC[pair.Key.componentIndex].mFCSensorDef.GetActiveDetectionRange(AltMSize, MSize);
+
+                        bool CanDetect = Fact.LargeDetection(CurrentSystem, dist, MFCRange);
+
+                        /// <summary>
+                        /// Can this MFC fire on the targetted missile?
+                        /// </summary>
+                        if (CanDetect == true && dist <= range)
+                        {
+                            /// <summary>
+                            /// Do AMM defense here. Check to see how many amms are targeted on this missile, if less than defense setting fire more.
+                            /// How do I handle 1v2 mode?
+                            /// </summary>
+#warning AMM Area Defense Here
+                        }
+
+                    }
+                }
+            }
         }
     }
 }


Fix ViewEmployee crash then PhotoFileID points to non-existing file

--- R7.University.Employee/ViewEmployee.ascx.cs
+++ R7.University.Employee/ViewEmployee.ascx.cs
@@ -178,6 +178,7 @@
 			var fullName = employee.FullName;
 			labelFullName.Text = fullName;

+			var imageVisible = false;
 			// Photo
 			if (!Utils.IsNull<int> (employee.PhotoFileID))
 			{
@@ -187,28 +188,37 @@
 				// imagePhoto.Height = image.Height;

 				var image = FileManager.Instance.GetFile (employee.PhotoFileID.Value);
-				var photoWidth = setting.PhotoWidth;
-
-				if (!Null.IsNull (photoWidth))
-				{
-					imagePhoto.Width = photoWidth;
-					imagePhoto.Height = (int)(image.Height * (float)photoWidth / image.Width);
-
-					imagePhoto.ImageUrl = string.Format(
-						"/imagehandler.ashx?fileid={0}&width={1}", employee.PhotoFileID, photoWidth);
-				}
-				else
-				{
-					// use original image
-					imagePhoto.Width = image.Width;
-					imagePhoto.Height = image.Height;
-					imagePhoto.ImageUrl = FileManager.Instance.GetUrl (image);
-				}
-
-				// set alt & title for photo
-				imagePhoto.AlternateText = fullName;
-				imagePhoto.ToolTip = fullName;
-			}
+				if (image != null)
+				{
+					var photoWidth = setting.PhotoWidth;
+
+					if (!Null.IsNull (photoWidth))
+					{
+						imagePhoto.Width = photoWidth;
+						imagePhoto.Height = (int)(image.Height * (float)photoWidth / image.Width);
+
+						imagePhoto.ImageUrl = string.Format (
+							"/imagehandler.ashx?fileid={0}&width={1}", employee.PhotoFileID, photoWidth);
+					}
+					else
+					{
+						// use original image
+						imagePhoto.Width = image.Width;
+						imagePhoto.Height = image.Height;
+						imagePhoto.ImageUrl = FileManager.Instance.GetUrl (image);
+					}
+
+					// set alt & title for photo
+					imagePhoto.AlternateText = fullName;
+					imagePhoto.ToolTip = fullName;
+
+					// make image visible
+					imageVisible = true;
+				}
+			}
+
+			// REVIEW: Need to add fallback image?
+			imagePhoto.Visible = imageVisible;

 			// Academic degree & title
 			var degreeAndTitle = Utils.FormatList (", ", employee.AcademicDegree, employee.AcademicTitle);


More descriptive error when SoX is missing.

--- RuneScapeCacheTools/SoundtrackCombineJob.cs
+++ RuneScapeCacheTools/SoundtrackCombineJob.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Diagnostics;
 using System.IO;
 using System.Threading;
@@ -150,7 +151,15 @@
 					//do the time consuming part on a task
 					var soxTask = new Task(() =>
 					{
-                        soxProcess.Start();
+						try
+						{
+							soxProcess.Start();
+						}
+						catch (Win32Exception ex)
+						{
+							throw new FileNotFoundException("SoX not found, can't combine audio.", ex);
+						}
+
 						soxProcess.WaitForExit();

 						if (soxProcess.ExitCode == 0)


Remove bridge code which now causes tag section unit tests to fail.

--- Sandra.Chess/Tests/ParseTrees.TagSection.cs
+++ Sandra.Chess/Tests/ParseTrees.TagSection.cs
@@ -22,7 +22,6 @@
 using Sandra.Chess.Pgn;
 using Sandra.Chess.Pgn.Temp;
 using System.Collections.Generic;
-using System.Linq;

 namespace Sandra.Chess.Tests
 {
@@ -35,10 +34,7 @@
         {
         };

-        internal static List<(string, ParseTree, PgnErrorCode[])> TagSectionParseTreesWithErrors()
-            => TagSectionParseTreesWithErrorsTemp().Select(x => (x.Item1, x.Item2, x.Item3.Where(code => code < PgnErrorCode.EmptyTag).ToArray())).ToList();
-
-        internal static List<(string, ParseTree, PgnErrorCode[])> TagSectionParseTreesWithErrorsTemp() => new List<(string, ParseTree, PgnErrorCode[])>
+        internal static List<(string, ParseTree, PgnErrorCode[])> TagSectionParseTreesWithErrors() => new List<(string, ParseTree, PgnErrorCode[])>
         {
             ("[", TagSectionOnly(TagPair(BracketOpen)),
                 new[] { PgnErrorCode.EmptyTag, PgnErrorCode.MissingTagBracketClose }),


Update ToolbarRenderer.cs for CommandParameter

instead of keeping the ICommand in the dictionary, keep the entire original ToolbarItem so that bindings are preserved and you can get a reference to the current CommandParameter, too.

--- SecondaryToolbarDemo/iOS/ToolbarRenderer.cs
+++ SecondaryToolbarDemo/iOS/ToolbarRenderer.cs
@@ -15,7 +15,7 @@
     {
         UIToolbar _toolbar;
         List<ToolbarItem> _secondaryItems;
-        readonly Dictionary<UIBarButtonItem, ICommand> _buttonCommands = new Dictionary<UIBarButtonItem, ICommand> ();
+        readonly Dictionary<UIBarButtonItem, ToolbarItem> _buttonCommands = new Dictionary<UIBarButtonItem, ToolbarItem> ();

         protected override void OnElementChanged (VisualElementChangedEventArgs e)
         {
@@ -41,7 +41,7 @@
                     button = Enum.TryParse<UIBarButtonSystemItem> (systemItemName, out systemItem)
                         ? new UIBarButtonItem (systemItem, ToolClicked)
                         : new UIBarButtonItem (tool.Text, UIBarButtonItemStyle.Plain, ToolClicked);
-                    _buttonCommands.Add (button, tool.Command);
+                    _buttonCommands.Add (button, tool);
                     tools.Add (button);
                 }

@@ -56,8 +56,8 @@
         void ToolClicked(object sender, EventArgs args)
         {
             var tool = sender as UIBarButtonItem;
-            var command = _buttonCommands [tool];
-            command.Execute (null);
+            var command = _buttonCommands[tool].Command;
+            command.Execute(_buttonCommands[tool].CommandParameter);
         }

         public override void ViewWillDisappear (bool animated)


line end

line end

--- Serenity.Script.UI/Editor/DateTimeEditor.cs
+++ Serenity.Script.UI/Editor/DateTimeEditor.cs
@@ -63,9 +63,9 @@
                 return null;
             });

-            J("

")
-                .Attribute("title", "set to now")
-                .InsertAfter(time)
+            J("

")
+                .Attribute("title", "set to now")
+                .InsertAfter(time)
                 .Click(e =>
                 {
                     if (this.Element.HasClass("readonly"))
@@ -153,7 +153,7 @@
             date.SetSeconds(0);
             date.SetMilliseconds(0);
             return date;
-        }
+        }

         public JsDate ValueAsDate
         {


Make ZmqDevice control methods virtual.

Make ZmqDevice control methods virtual.

--- src/proj/ZeroMQ/Sockets/ZmqDevice.cs
+++ src/proj/ZeroMQ/Sockets/ZmqDevice.cs
@@ -90,7 +90,7 @@
         /// <summary>
         /// Blocks the calling thread until the device terminates.
         /// </summary>
-        public void Join()
+        public virtual void Join()
         {
             this.runningEvent.WaitOne();
         }
@@ -105,7 +105,7 @@
         /// true if the device terminated; false if the device has not terminated after
         /// the amount of time specified by <paramref name="timeout"/> has elapsed.
         /// </returns>
-        public bool Join(TimeSpan timeout)
+        public virtual bool Join(TimeSpan timeout)
         {
             return this.runningEvent.WaitOne(timeout);
         }
@@ -113,7 +113,7 @@
         /// <summary>
         /// Terminate the device safely.
         /// </summary>
-        public void Stop()
+        public virtual void Stop()
         {
             this.IsRunning = false;
         }


red: add fatal log level to Help

red: add fatal log level to Help

--- src/test/Bau.Test.Acceptance/Help.cs
+++ src/test/Bau.Test.Acceptance/Help.cs
@@ -34,7 +34,7 @@
 Usage: scriptcs <baufile.csx> -- [tasks] [options]

 Options:
-  -l|-loglevel a|all|t|trace|d|debug|i*|info|w|warn|e|error|o|off
+  -l|-loglevel a|all|t|trace|d|debug|i*|info|w|warn|e|error|f|fatal|o|off
                Set the logging level.
   -t           Alias for -loglevel trace.
   -d           Alias for -loglevel debug.


Added comment

Added comment

--- src/SlackConnector/SlackConnector.cs
+++ src/SlackConnector/SlackConnector.cs
@@ -216,6 +216,7 @@
             await client.PostMessage(SlackKey, message.ChatHub.Id, message.Text, message.Attachments);
         }

+		//TODO: Cache newly created channel, and return if already exists
         public async Task<SlackChatHub> JoinDirectMessageChannel(string user)
         {
             if (string.IsNullOrEmpty(user))


Корректный тип исключения при невозможности добавить свойство глобального контекста из загрузчика.

--- src/ScriptEngine.HostedScript/LibraryLoader.cs
+++ src/ScriptEngine.HostedScript/LibraryLoader.cs
@@ -111,7 +111,15 @@
                 asClass = false
             });

-            _env.InjectGlobalProperty(null, moduleName, true);
+            try
+            {
+                _env.InjectGlobalProperty(null, moduleName, true);
+            }
+            catch (InvalidOperationException e)
+	        {
+                // символ уже определен
+                throw new RuntimeException(String.Format("Невозможно загрузить модуль {0}. Такой символ уже определен.", moduleName), e);
+            }
         }

         [ContextMethod("ЗагрузитьБиблиотеку", "LoadLibrary")]


FUNCTION LINQ: VB.NET power operator.

FUNCTION LINQ: VB.NET power operator.

--- src/Sooda/Linq/SoodaQueryProvider.cs
+++ src/Sooda/Linq/SoodaQueryProvider.cs
@@ -394,9 +394,9 @@
             throw new NotSupportedException(t.FullName + "." + mc.Method.Name);
         }

-        SoqlExpression TranslateCoalesce(BinaryExpression expr)
-        {
-            return new SoqlFunctionCallExpression("coalesce", TranslateExpression(expr.Left), TranslateExpression(expr.Right));
+        SoqlExpression TranslateToFunction(string function, BinaryExpression expr)
+        {
+            return new SoqlFunctionCallExpression(function, TranslateExpression(expr.Left), TranslateExpression(expr.Right));
         }

         SoqlPathExpression GetPrimaryKeyExpression()
@@ -429,6 +429,8 @@
                     return TranslateBinary((BinaryExpression) expr, SoqlBinaryOperator.Div);
                 case ExpressionType.Modulo:
                     return TranslateBinary((BinaryExpression) expr, SoqlBinaryOperator.Mod);
+                case ExpressionType.Power:
+                    return TranslateToFunction("power", (BinaryExpression) expr);
                 case ExpressionType.Negate:
                     return new SoqlUnaryNegationExpression(TranslateExpression(((UnaryExpression) expr).Operand));
                 case ExpressionType.Convert:
@@ -442,7 +444,7 @@
                 case ExpressionType.Not:
                     return new SoqlBooleanNegationExpression(TranslateBoolean(((UnaryExpression) expr).Operand));
                 case ExpressionType.Coalesce:
-                    return TranslateCoalesce((BinaryExpression) expr);
+                    return TranslateToFunction("coalesce", (BinaryExpression) expr);
                 case ExpressionType.Equal:
                     return TranslateRelational((BinaryExpression) expr, SoqlRelationalOperator.Equal);
                 case ExpressionType.NotEqual:


Cleanup

Cleanup

--- src/Squidex/Views/Shared/Docs.cshtml
+++ src/Squidex/Views/Shared/Docs.cshtml
@@ -10,11 +10,7 @@
     <meta name="viewport" content="width=device-width, initial-scale=1">

     <style>
-        body {
-            margin: 0;
-            padding: 0;
-            position: static;
-        }
+        body { margin: 0; padding: 0; }

         h1,
         .menu-header,


Updated to be nicer styled and showing Performance monitor properties

--- src/Web/ASPNetFileMonitorList.cshtml
+++ src/Web/ASPNetFileMonitorList.cshtml
@@ -1,6 +1,7 @@
 @using System.Reflection;
 @using System.Web;
 @using System.Collections;
+@using System.Diagnostics

 @model dynamic
 @{
@@ -35,72 +36,116 @@
     var dirMonSubdirsName = dirMonSubdirs == null ? null : dirMonSubdirs.GetType()
         .GetField("Directory", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)
         .GetValue(dirMonSubdirs);
-    var dirMonSubdirsIsDirMonAppPathInternal = dirMonSubdirs == null ? null : dirMonSubdirs.GetType()
+    var dirMonSubdirsIsDirMonAppPathInternal = dirMonSubdirs == null ? null : dirMonSubdirs.GetType()
         .GetField("_isDirMonAppPathInternal", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)
         .GetValue(dirMonSubdirs);
     var dirMonSubdirsDirMonCompletion = dirMonSubdirs == null ? null : dirMonSubdirs.GetType()
         .GetField("_dirMonCompletion", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)
         .GetValue(dirMonSubdirs);
 }
+
+<!DOCTYPE html>

-
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>FCN Viewer</title>
+    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />

-

-
FCN Mode

-

-
This is the detected FCN Mode: @fcnVal

-

-
FileChangesMonitor directory monitor hash table

-

-

+

+

+
FCN Mode

+

+
This is the detected FCN Mode: @fcnVal

+

+
FileChangesMonitor directory monitor hash table

+

+

                     Directory watched
                     File monitor count

-

-            @{
-                var totalFileWatchers = 0;
-            }
-            @foreach(System.Collections.DictionaryEntry d in dirs)
-            {
-                var fileMons = (Hashtable)d.Value.GetType()
-                    .GetField("_fileMons", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)
-                    .GetValue(d.Value);
-                totalFileWatchers += fileMons.Count;
-

-                    @d.Key
-                    @fileMons.Count
-

-            }
-

+

+                @{
+                    var totalFileWatchers = 0;
+                }
+                @foreach (System.Collections.DictionaryEntry d in dirs)
+                {
+                    var fileMons = (Hashtable) d.Value.GetType()
+                        .GetField("_fileMons", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)
+                        .GetValue(d.Value);
+
+                    //I'm not sure what the difference with the result of this is, the decompiled source
+                    //excludes file monitors that have something to do with "_cShortNames"
+                    var fileMonsCount = d.Value.GetType()
+                        .GetMethod("GetFileMonitorsCount", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase)
+                        .Invoke(d.Value, null);
+
+                    totalFileWatchers += fileMons.Count;
+

+                        @d.Key
+                        @fileMons.Count
+

+                }
+

                     @dirs.Count
                     @totalFileWatchers

-

-

-
FCN Mode 'Single' dir monitor properties

-

-
FileChangesMonitor._dirMonAppPathInternal = @dirMonAppPathInternal

-
@dirMonAppPathInternalName

-
_dirMonAppPathInternal._isDirMonAppPathInternal = @dirMonAppPathInternalIsDirMonAppPathInternal

-
_dirMonAppPathInternal._dirMonCompletion = @dirMonAppPathInternalDirMonCompletion

-

-
Normal sub dir monitor properties

-

-
FileChangesMonitor._dirMonSubdirs = @dirMonSubdirs

-
@dirMonSubdirsName

-
_dirMonSubdirs._isDirMonAppPathInternal = @dirMonSubdirsIsDirMonAppPathInternal

-
_dirMonSubdirs._dirMonCompletion = @dirMonSubdirsDirMonCompletion

-

+

+

+
FCN Mode 'Single' dir monitor properties

+

+
FileChangesMonitor._dirMonAppPathInternal = @dirMonAppPathInternal

+
@dirMonAppPathInternalName

+
_dirMonAppPathInternal._isDirMonAppPathInternal = @dirMonAppPathInternalIsDirMonAppPathInternal

+
_dirMonAppPathInternal._dirMonCompletion = @dirMonAppPathInternalDirMonCompletion

+

+
Normal sub dir monitor properties

+

+
FileChangesMonitor._dirMonSubdirs = @dirMonSubdirs

+
@dirMonSubdirsName

+
_dirMonSubdirs._isDirMonAppPathInternal = @dirMonSubdirsIsDirMonAppPathInternal

+
_dirMonSubdirs._dirMonCompletion = @dirMonSubdirsDirMonCompletion

+

+

+

+            @{
+                PerformanceCounter pc1 = new PerformanceCounter("ASP.NET Applications",
+                                                            "Requests Total",
+                                                            "__Total__");
+
+                PerformanceCounter pc2 = new PerformanceCounter("ASP.NET",
+                                                                "Application Restarts");
+
+                Type t = typeof(HttpRuntime).Assembly.GetType(
+                                                           "System.Web.DirMonCompletion");
+
+                int dirMonCount = (int)t.InvokeMember("_activeDirMonCompletions",
+                                                       BindingFlags.NonPublic
+                                                       | BindingFlags.Static
+                                                       | BindingFlags.GetField,
+                                                       null,
+                                                       null,
+                                                       null);
+
+                // The perf client polls the server every 400 milliseconds
+                System.Threading.Thread.Sleep(800);
+
+                //Response.Output.WriteLine(
+                //                        "Requests={0},Restarts={1},DirMonCompletions={2}",
+                //                        pc1.NextValue(),
+                //                        pc2.NextValue(),
+                //                        dirMonCount);
+            }
+
Performance monitor properties

+

+
ASP.NET Applications - Requests Total = @pc1.NextValue()

+
ASP.NET - Application Restarts = @pc2.NextValue()

+
DirMonCompletions = @dirMonCount

+

+


marked internals as obsolete

marked internals as obsolete

--- src/Xbehave.Net40/Deprecated/Step.cs
+++ src/Xbehave.Net40/Deprecated/Step.cs
@@ -8,21 +8,25 @@

     internal partial class Step : IStep
     {
+        [Obsolete("Use When().Teardown() instead.")]
         public IStep When(string message, Action body, Action dispose)
         {
             return message.When(body).Teardown(dispose);
         }

+        [Obsolete("Use When().Teardown() instead.")]
         public IStep Then(string message, Action body, Action dispose)
         {
             return message.Then(body).Teardown(dispose);
         }

+        [Obsolete("Use When().Teardown() instead.")]
         public IStep And(string message, Action body, Action dispose)
         {
             return message.And(body).Teardown(dispose);
         }

+        [Obsolete("Use When().Teardown() instead.")]
         public IStep But(string message, Action body, Action dispose)
         {
             return message.But(body).Teardown(dispose);


Mind Target value changes

Mind Target value changes

--- Sharpex2D/Framework/Game/Timing/Gameloop.cs
+++ Sharpex2D/Framework/Game/Timing/Gameloop.cs
@@ -34,12 +34,28 @@
         /// <summary>
         ///     Gets the TargetFrameTime.
         /// </summary>
-        public float TargetFrameTime { get; private set; }
+        public float TargetFrameTime
+        {
+            get { return _targetFrameTime; }
+            set
+            {
+                _targetFrameTime = value;
+                OnFpsChanged();
+            }
+        }

         /// <summary>
         ///     Gets the TargetUpdateTime.
         /// </summary>
-        public float TargetUpdateTime { get; private set; }
+        public float TargetUpdateTime
+        {
+            get { return _targetUpdateTime; }
+            set
+            {
+                _targetUpdateTime = value;
+                OnFpsChanged();
+            }
+        }

         /// <summary>
         ///     Indicates whether the GameLoop is running.
@@ -57,15 +73,7 @@
         /// <summary>
         ///     Gets or sets the Target FPS.
         /// </summary>
-        public float TargetFramesPerSecond
-        {
-            get { return _targetFramesPerSecond; }
-            set
-            {
-                _targetFramesPerSecond = value;
-                OnFpsChanged();
-            }
-        }
+        public float TargetFramesPerSecond { get; private set; }

         /// <summary>
         ///     Starts the GameLoop.
@@ -183,7 +191,8 @@
         private bool _cancelFlag;
         private Task _renderTask;
         private float _renderTime;
-        private float _targetFramesPerSecond;
+        private float _targetFrameTime;
+        private float _targetUpdateTime;
         private TimeSpan _totalGameTime;
         private float _unprocessedTicks;
         private Task _updateTask;
@@ -202,6 +211,8 @@
             _drawables = new List<IDrawable>();
             _updateables = new List<IUpdateable>();
             _totalGameTime = TimeSpan.FromSeconds(0);
+            TargetFrameTime = 16.666f;
+            TargetUpdateTime = 16.666f;
             _updateGameTime = new GameTime
             {
                 ElapsedGameTime = TargetUpdateTime,
@@ -222,14 +233,16 @@
         /// </summary>
         private void OnFpsChanged()
         {
-            float targetTime = 1000/TargetFramesPerSecond;
-            TargetFrameTime = targetTime;
-            TargetUpdateTime = targetTime;
-            SGL.GraphicsDevice.RefreshRate = TargetFramesPerSecond;
-
-            //publish event
-            SGL.Components.Get<EventManager>()
-                .Publish(new TargetFrameTimeChangedEvent(TargetFramesPerSecond, targetTime));
+            TargetFramesPerSecond = 1000/TargetFrameTime;
+
+            if (SGL.State == SGLState.Running)
+            {
+                SGL.GraphicsDevice.RefreshRate = TargetFramesPerSecond;
+
+                //publish event
+                SGL.Components.Get<EventManager>()
+                    .Publish(new TargetFrameTimeChangedEvent(TargetFramesPerSecond, TargetFrameTime));
+            }
         }

         /// <summary>
@@ -322,7 +335,7 @@
                 for (int index = 0; index < _drawables.Count; index++)
                 {
                     IDrawable drawable = _drawables[index];
-                    drawable.Render(SGL.CurrentRenderer, _renderGameTime);
+                    drawable.Render(SGL.RenderDevice, _renderGameTime);
                 }

                 sw.Stop();


fix ResultTable

fix ResultTable

--- Signum.Entities/DynamicQuery/ResultTable.cs
+++ Signum.Entities/DynamicQuery/ResultTable.cs
@@ -239,7 +239,8 @@

         public ResultTable(ResultColumn[] columns, int? totalElements, Pagination pagination)
         {
-            this.entityColumn = columns.Where(c => c.Column is _EntityColumn).SingleOrDefaultEx();
+            //this.entityColumn = columns.Where(c => c.Column is _EntityColumn).SingleOrDefaultEx();
+            this.entityColumn = columns.Where(c => c.Column is _EntityColumn).Distinct(c => c.Column.Token).SingleOrDefaultEx();
             this.columns = columns.Where(c => !(c.Column is _EntityColumn) && c.Column.Token.IsAllowed() == null).ToArray();

             int rowCount = columns.Select(a => a.Values.Count).Distinct().SingleEx(() => "Count");


missing publisher init

missing publisher init

--- SimpleChannel.Net/ZMQ/ZeroMqQueueChannel.cs
+++ SimpleChannel.Net/ZMQ/ZeroMqQueueChannel.cs
@@ -131,6 +131,7 @@

         private void InternalPut(object item, String routingKey)
         {
+            PublisherInit();
             try
             {
                 _publisherSocket.SendMoreFrame(Name).SendFrame(Serializer.Serialize(item));


made the sorting on the dropdown of reports a bit better

--- SimpleReport/Views/Designer/_Reports.cshtml
+++ SimpleReport/Views/Designer/_Reports.cshtml
@@ -4,7 +4,7 @@

                 Choose report to edit
-                <select ng-model="report" class="form-control" ng-options="item as item.Name group by item.Group for item in reportList | orderBy:'Group'" ng-change="reportDataChanged()"></select>
+                <select ng-model="report" class="form-control" ng-options="item as item.Name group by item.Group for item in reportList | orderBy:['Group','Name']" ng-change="reportDataChanged()"></select>

             <button class="btn btn-primary" ng-click="addNewReport()"> Add new</button>


Implemented demo-translation from DS3 to DS4

--- SokkaServer/Children/AirBenderDualShock3.cs
+++ SokkaServer/Children/AirBenderDualShock3.cs
@@ -3,12 +3,10 @@
 using System.Linq;
 using System.Net.NetworkInformation;
 using System.Runtime.InteropServices;
-using System.Text;
 using Nefarius.ViGEm.Client;
 using Nefarius.ViGEm.Client.Targets;
 using Nefarius.ViGEm.Client.Targets.DualShock4;
 using PInvoke;
-using Serilog;
 using SokkaServer.Children.DualShock3;
 using SokkaServer.Exceptions;

@@ -16,7 +14,8 @@
 {
     internal class AirBenderDualShock3 : AirBenderChildDevice
     {
-        private readonly byte[] _ledOffsets = { 0x02, 0x04, 0x08, 0x10 };
+        private readonly Dictionary<DualShock3Buttons, DualShock4Buttons> _btnMap;
+        private readonly DualShock4Controller _ds4;

         private readonly byte[] _hidOutputReport =
         {
@@ -29,9 +28,11 @@
             0x00, 0x00
         };

+        private readonly byte[] _ledOffsets = {0x02, 0x04, 0x08, 0x10};
+
         public AirBenderDualShock3(AirBender host, PhysicalAddress client) : base(host, client)
         {
-            _btnMap = new Dictionary<DualShock3Buttons, DualShock4Buttons>()
+            _btnMap = new Dictionary<DualShock3Buttons, DualShock4Buttons>
             {
                 {DualShock3Buttons.Select, DualShock4Buttons.Share},
                 {DualShock3Buttons.LeftThumb, DualShock4Buttons.ThumbLeft},
@@ -52,10 +53,6 @@
             _ds4.Connect();
         }

-        private readonly DualShock4Controller _ds4;
-
-        private Dictionary<DualShock3Buttons, DualShock4Buttons> _btnMap;
-
         protected override void OnInputReport(long l)
         {
             var requestSize = Marshal.SizeOf<AirBender.AIRBENDER_GET_DS3_INPUT_REPORT>();
@@ -73,19 +70,20 @@
                 int bytesReturned;
                 var ret = Kernel32.DeviceIoControl(
                     HostDevice.DeviceHandle,
-                    unchecked((int)AirBender.IOCTL_AIRBENDER_GET_DS3_INPUT_REPORT),
+                    unchecked((int) AirBender.IOCTL_AIRBENDER_GET_DS3_INPUT_REPORT),
                     requestBuffer, requestSize, requestBuffer, requestSize,
                     out bytesReturned, IntPtr.Zero);

                 if (!ret && Marshal.GetLastWin32Error() == AirBender.ERROR_DEV_NOT_EXIST)
-                {
                     OnChildDeviceDisconnected(EventArgs.Empty);
-                }

                 if (ret)
                 {
                     var resp = Marshal.PtrToStructure<AirBender.AIRBENDER_GET_DS3_INPUT_REPORT>(requestBuffer);

+                    //
+                    // TODO: demo-code, remove!
+                    //
                     var report = new DualShock3InputReport(resp.ReportBuffer);
                     var ds4Report = new DualShock4Report();

@@ -97,9 +95,29 @@
                     ds4Report.SetAxis(DualShock4Axes.RightTrigger, report.RightTrigger);

                     foreach (var engagedButton in report.EngagedButtons)
-                    {
                         ds4Report.SetButtons(_btnMap.Where(m => m.Key == engagedButton).Select(m => m.Value).ToArray());
-                    }
+
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadUp))
+                        ds4Report.SetDPad(DualShock4DPadValues.North);
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadRight))
+                        ds4Report.SetDPad(DualShock4DPadValues.East);
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadDown))
+                        ds4Report.SetDPad(DualShock4DPadValues.South);
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft))
+                        ds4Report.SetDPad(DualShock4DPadValues.West);
+
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadUp)
+                        && report.EngagedButtons.Contains(DualShock3Buttons.DPadRight))
+                        ds4Report.SetDPad(DualShock4DPadValues.Northeast);
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadRight)
+                        && report.EngagedButtons.Contains(DualShock3Buttons.DPadDown))
+                        ds4Report.SetDPad(DualShock4DPadValues.Southeast);
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadDown)
+                        && report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft))
+                        ds4Report.SetDPad(DualShock4DPadValues.Southwest);
+                    if (report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft)
+                        && report.EngagedButtons.Contains(DualShock3Buttons.DPadUp))
+                        ds4Report.SetDPad(DualShock4DPadValues.Northwest);

                     _ds4.SendReport(ds4Report);

@@ -138,7 +156,7 @@
             var requestBuffer = Marshal.AllocHGlobal(requestSize);

             Marshal.StructureToPtr(
-                new AirBender.AIRBENDER_SET_DS3_OUTPUT_REPORT()
+                new AirBender.AIRBENDER_SET_DS3_OUTPUT_REPORT
                 {
                     ClientAddress = ClientAddress.ToNativeBdAddr(),
                     ReportBuffer = _hidOutputReport
@@ -147,7 +165,7 @@

             var ret = Kernel32.DeviceIoControl(
                 HostDevice.DeviceHandle,
-                unchecked((int)AirBender.IOCTL_AIRBENDER_SET_DS3_OUTPUT_REPORT),
+                unchecked((int) AirBender.IOCTL_AIRBENDER_SET_DS3_OUTPUT_REPORT),
                 requestBuffer, requestSize, IntPtr.Zero, 0,
                 out bytesReturned, IntPtr.Zero);

@@ -161,4 +179,4 @@
             Marshal.FreeHGlobal(requestBuffer);
         }
     }
-}
+}


Add hack to show RoboLogs History link if deployer

This is a temporary solution until we build a secondary app to access logs and update entries in the new RoboLog database for robocopy logging.

--- Source/DTMF.Website/Views/Home/Index.cshtml
+++ Source/DTMF.Website/Views/Home/Index.cshtml
@@ -89,4 +89,8 @@
             });
         });
     </script>
-}+}
+@if (Utilities.CanDeploy) {
+

+Daily RoboLogs
+}


Fix infinite recursion.

Fix infinite recursion.

As documented in
https://github.com/GoogleCloudPlatform/dotnet-docs-samples/issues/753

Change-Id: I4253dc8ac99623708e176dd064046affcb9985c1

--- kms/api/CloudKmsAspNetSample/Services/EncryptedFileProvider.cs
+++ kms/api/CloudKmsAspNetSample/Services/EncryptedFileProvider.cs
@@ -62,7 +62,7 @@

         public IDirectoryContents GetDirectoryContents(string subpath)
         {
-            var innerContents = GetDirectoryContents(subpath);
+            var innerContents = innerProvider.GetDirectoryContents(subpath);
             if (innerContents == null)
             {
                 return null;


Fix setting value using PropertyBinding in PCL build

--- Source/Eto/Forms/Binding/PropertyBinding.cs
+++ Source/Eto/Forms/Binding/PropertyBinding.cs
@@ -99,7 +99,11 @@
 		protected override T InternalGetValue(object dataItem)
 		{
 			EnsureProperty(dataItem);
-			if (descriptor != null && dataItem != null)
+			if (descriptor != null && dataItem != null
+				#if PCL
+				&& descriptor.CanRead
+				#endif
+				)
 			{
 				var propertyType = typeof(T);
 				object val = descriptor.GetValue(dataItem);
@@ -121,7 +125,13 @@
 		protected override void InternalSetValue(object dataItem, T value)
 		{
 			EnsureProperty(dataItem);
-			if (descriptor != null && dataItem != null)
+			if (descriptor != null && dataItem != null
+				#if PCL
+				&& descriptor.CanWrite
+				#else
+				&& !descriptor.IsReadOnly
+				#endif
+				)
 			{
 				var propertyType = descriptor.PropertyType;
 				object val = value;


Add plain Ljpeg decompressor

Add plain Ljpeg decompressor

Former-commit-id: 268965a3672dd8e26b7420a30cd67a13dafa7b6a [formerly 4951e81b0b3defda3506f4528d41af81d14169d6] [formerly 1a96aaf3be465cf0580351e07c2ae1d7cd90cdff [formerly 6e5e5ec66fe499d0189146cdf71fb636a99fb101] [formerly b49ceb3da2a45bde398d208b9ba2edbd6ddcd106] [formerly 54cf8e976249f44d80b0b1e41137b188ef3a5b1f [formerly fe9d1b0f5fd502749005ff48aafd6da4febcb9da]] [formerly 1a96aaf3be465cf0580351e07c2ae1d7cd90cdff [formerly 6e5e5ec66fe499d0189146cdf71fb636a99fb101] [formerly b49ceb3da2a45bde398d208b9ba2edbd6ddcd106] [formerly 54cf8e976249f44d80b0b1e41137b188ef3a5b1f [formerly fe9d1b0f5fd502749005ff48aafd6da4febcb9da]] [formerly 7cdb48dc7209835a16edb6e1858f463ff4f2b0ac [formerly 81d5984dda370dbb4e81a0fed51fef21d5bfdf8f]]]]
Former-commit-id: e6385b4bf311ae37eabf35e32cdafc04744febae
Former-commit-id: ee452754848d3dba9f69ca4afafb422a8691a5d1
Former-commit-id: 74ac65bcf886439bba51dd2e21bc834493384529
Former-commit-id: 05b556ceb0b6542dbe6e16226d1a76ac9d49fbe5
Former-commit-id: d877607bfdd4cd22faced5584cf6e961a2de44be [formerly 006167c31a9845728795c98c687220f5b6b281a3]
Former-commit-id: 70fbe092b4f775210ba5c0668bff4a8521ee52e8
Former-commit-id: 8ca5926e0ab556c20597a135af8952a629fd9599

--- Source/Raw.Net/Source/Decoder/LJpegPlain.cs
+++ Source/Raw.Net/Source/Decoder/LJpegPlain.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Linq;

 namespace RawNet
 {
@@ -10,18 +11,15 @@
     public class LJpegPlain : LJpegDecompressor
     {
         UInt32[] offset;
-        int[] slice_width;
-
-
-        LJpegPlain(TIFFBinaryReader file, RawImage img) :
-    base(file, img)
+        uint[] slice_width;
+
+
+        LJpegPlain(TIFFBinaryReader file, RawImage img) : base(file, img)
         {
-            offset = 0;
-            slice_width = 0;
         }

-        void decodeScan()
+        public override void decodeScan()
         {

             // Fix for Canon 6D mRaw, which has flipped width & height for some part of the image
@@ -35,9 +33,9 @@

             // If image attempts to decode beyond the image bounds, strip it.
             if ((frame.w * frame.cps + offX * mRaw.cpp) > mRaw.dim.x * mRaw.cpp)
-                skipX = ((frame.w * frame.cps + offX * mRaw.cpp) - mRaw.dim.x * mRaw.cpp) / frame.cps;
+                skipX = (uint)((frame.w * frame.cps + offX * mRaw.cpp) - mRaw.dim.x * mRaw.cpp) / frame.cps;
             if (frame.h + offY > (UInt32)mRaw.dim.y)
-                skipY = frame.h + offY - mRaw.dim.y;
+                skipY = (uint)(frame.h + offY - mRaw.dim.y);

             // Swap back (see above)
             if (mCanonFlipDim)
@@ -48,11 +46,11 @@
             }

             /* Correct wrong slice count (Canon G16) */
-            if (slicesW.size() == 1)
-                slicesW[0] = frame.w * frame.cps;
-
-            if (slicesW.empty())
-                slicesW.push_back(frame.w * frame.cps);
+            if (slicesW.Count == 1)
+                slicesW[0] = (int)(frame.w * frame.cps);
+
+            if (slicesW.Count == 0)
+                slicesW.Add((int)(frame.w * frame.cps));

             if (0 == frame.h || 0 == frame.w)
                 throw new RawDecoderException("LJpegPlain::decodeScan: Image width or height set to zero");
@@ -64,7 +62,7 @@
                     if (mRaw.isCFA)
                         throw new RawDecoderException("LJpegDecompressor::decodeScan: Cannot decode subsampled image to CFA data");

-                    if (mRaw.getCpp() != frame.cps)
+                    if (mRaw.cpp != frame.cps)
                         throw new RawDecoderException("LJpegDecompressor::decodeScan: Subsampled component count does not match image.");

                     if (pred == 1)
@@ -139,9 +137,10 @@

         void decodeScanLeftGeneric()
         {
+            /*
             _ASSERTE(slicesW.size() < 16);  // We only have 4 bits for slice number.
             _ASSERTE(!(slicesW.size() > 1 && skipX)); // Check if this is a valid state
-
+            */
             UInt32 comps = frame.cps;  // Components
             HuffmanTable[] dctbl = new HuffmanTable[4];   // Tables for up to 4 components
             UInt16[] predict;         // Prediction pointer
@@ -159,50 +158,50 @@

             for (UInt32 i = 0; i < comps; i++)
             {
-                dctbl[i] = &huff[frame.compInfo[i].dcTblNo];
+                dctbl[i] = huff[frame.compInfo[i].dcTblNo];
                 samplesH[i] = frame.compInfo[i].superH;
-                if (!isPowerOfTwo(samplesH[i]))
+                if (!Common.isPowerOfTwo(samplesH[i]))
                     throw new RawDecoderException("LJpegPlain::decodeScanLeftGeneric: Horizontal sampling is not power of two.");
                 maxSuperH = Math.Max(samplesH[i], maxSuperH);
                 samplesV[i] = frame.compInfo[i].superV;
-                if (!isPowerOfTwo(samplesV[i]))
+                if (!Common.isPowerOfTwo(samplesV[i]))
                     throw new RawDecoderException("LJpegPlain::decodeScanLeftGeneric: Vertical sampling is not power of two.");
                 maxSuperV = Math.Max(samplesV[i], maxSuperV);
                 samplesComp[i] = samplesV[i] * samplesH[i];
                 pixGroup += samplesComp[i];
             }

-            mRaw.metadata.subsampling.x = maxSuperH;
-            mRaw.metadata.subsampling.y = maxSuperV;
+            mRaw.metadata.subsampling.x = (int)maxSuperH;
+            mRaw.metadata.subsampling.y = (int)maxSuperV;

             //Prepare slices (for CR2)
-            UInt32 slices = (UInt32)slicesW.size() * (frame.h - skipY) / maxSuperV;
-            UInt16** imagePos = new UInt16*[slices + 1];
-            int* sliceWidth = new int[slices + 1];
+            UInt32 slices = (UInt32)slicesW.Count * (frame.h - skipY) / maxSuperV;
+            UInt16[] imagePos = new UInt16[(int)slices + 1];
+            uint[] sliceWidth = new uint[(int)slices + 1];

             UInt32 t_y = 0;
             UInt32 t_x = 0;
             UInt32 t_s = 0;
             UInt32 slice = 0;
             UInt32 pitch_s = mRaw.pitch / 2;  // Pitch in shorts
-            slice_width = new int[slices];
+            slice_width = new uint[slices];

             // This is divided by comps, since comps pixels are processed at the time
-            for (UInt32 i = 0; i < slicesW.size(); i++)
-                slice_width[i] = slicesW[i] / pixGroup / maxSuperH; // This is a guess, but works for sRaw1+2.
-
-            if (skipX && (maxSuperV > 1 || maxSuperH > 1))
+            for (Int32 i = 0; i < slicesW.Count; i++)
+                slice_width[i] = (uint)slicesW[i] / pixGroup / maxSuperH; // This is a guess, but works for sRaw1+2.
+
+            if (skipX != 0 && (maxSuperV > 1 || maxSuperH > 1))
             {
                 throw new RawDecoderException("LJpegPlain::decodeScanLeftGeneric: Cannot skip right border in subsampled mode");
             }
-            if (skipX)
-            {
-                slice_width[slicesW.size() - 1] -= skipX;
+            if (skipX != 0)
+            {
+                slice_width[slicesW.Count - 1] -= skipX;
             }

             for (slice = 0; slice < slices; slice++)
             {
-                imagePos[slice] = (UInt16*)&draw[(t_x + offX) * mRaw.getBpp() + ((offY + t_y) * mRaw.pitch)];
+                imagePos[slice] = draw[(t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)];
                 sliceWidth[slice] = slice_width[t_s];
                 t_y += maxSuperV;
                 if (t_y >= (frame.h - skipY))
@@ -214,7 +213,7 @@
             slice_width = null;

             // We check the final position. If bad slice sizes are given we risk writing outside the image
-            if (imagePos[slices - 1] >= (UInt16*)&mRaw.getData()[mRaw.pitch * mRaw.dim.y])
+            if (imagePos[slices - 1] >= mRaw.rawData[mRaw.pitch * mRaw.dim.y])
             {
                 throw new RawDecoderException("LJpegPlain::decodeScanLeft: Last slice out of bounds");
             }
@@ -222,9 +221,9 @@
             sliceWidth[slices] = sliceWidth[slices - 1];        // Extra offset to avoid branch in loop.

             // Predictors for components
-            int p[4];
+            int[] p = new int[4];
             UInt16[] dest = imagePos[0];
-
+            int destI = 0;
             // Always points to next slice
             slice = 1;
             UInt32 pixInSlice = sliceWidth[0];
@@ -241,23 +240,24 @@
                         // First pixel is not predicted, all other are.
                         if (y2 == 0 && x2 == 0)
                         {
-                            *dest = p[i] = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl[i]);
+                            p[i] = ((1 << (int)(frame.prec - Pt - 1)) + HuffDecode(ref dctbl[i]));
+                            dest[destI] = (ushort)p[i];
                         }
                         else
                         {
-                            p[i] += HuffDecode(dctbl[i]);
-                            _ASSERTE(p[i] >= 0 && p[i] < 65536);
-                            dest[x2 * comps + y2 * pitch_s] = p[i];
+                            p[i] += HuffDecode(ref dctbl[i]);
+                            // _ASSERTE(p[i] >= 0 && p[i] < 65536);
+                            dest[x2 * comps + y2 * pitch_s] = (ushort)p[i];
                         }
                     }
                 }
                 // Set predictor for this component
                 // Next component
-                dest++;
+                destI++;
             }

             // Increment destination to next group
-            dest += (maxSuperH - 1) * comps;
+            destI += (int)((maxSuperH - 1) * comps);
             x = maxSuperH;
             pixInSlice -= maxSuperH;

@@ -286,24 +286,24 @@
                         {
                             for (UInt32 x2 = 0; x2 < samplesH[i]; x2++)
                             {
-                                p[i] += HuffDecode(dctbl[i]);
-                                _ASSERTE(p[i] >= 0 && p[i] < 65536);
-                                dest[x2 * comps + y2 * pitch_s] = p[i];
+                                p[i] += HuffDecode(ref dctbl[i]);
+                                // _ASSERTE(p[i] >= 0 && p[i] < 65536);
+                                dest[x2 * comps + y2 * pitch_s + destI] = (ushort)p[i];
                             }
                         }
-                        dest++;
-                    }
-                    dest += (maxSuperH * comps) - comps;
+                        destI++;
+                    }
+                    destI += (int)((maxSuperH * comps) - comps);
                     pixInSlice -= maxSuperH;
                 }

-                if (skipX)
+                if (skipX != 0)
                 {
                     for (UInt32 sx = 0; sx < skipX; sx++)
                     {
                         for (UInt32 i = 0; i < comps; i++)
                         {
-                            HuffDecode(dctbl[i]);
+                            HuffDecode(ref dctbl[i]);
                         }
                     }
                 }
@@ -321,8 +321,6 @@
                 predict = dest;
                 x = 0;
             }
-            delete[] imagePos;
-            delete[] sliceWidth;
         }

         int COMPS = 3;
@@ -333,6 +331,7 @@

         void decodeScanLeft4_2_0()
         {
+            /*
             _ASSERTE(slicesW.size() < 16);  // We only have 4 bits for slice number.
             _ASSERTE(!(slicesW.size() > 1 && skipX)); // Check if this is a valid state
             _ASSERTE(frame.compInfo[0].superH == 2);   // Check if this is a valid state
@@ -343,10 +342,10 @@
             _ASSERTE(frame.compInfo[2].superV == 1);   // Check if this is a valid state
             _ASSERTE(frame.cps == COMPS);
             _ASSERTE(skipX == 0);
-
-            HuffmanTable[] dctbl1 = huff[frame.compInfo[0].dcTblNo];
-            HuffmanTable[] dctbl2 = huff[frame.compInfo[1].dcTblNo];
-            HuffmanTable[] dctbl3 = huff[frame.compInfo[2].dcTblNo];
+            */
+            HuffmanTable dctbl1 = huff[frame.compInfo[0].dcTblNo];
+            HuffmanTable dctbl2 = huff[frame.compInfo[1].dcTblNo];
+            HuffmanTable dctbl3 = huff[frame.compInfo[2].dcTblNo];

             UInt16[] predict;      // Prediction pointer

@@ -358,7 +357,7 @@
             UInt32 real_h = mCanonFlipDim ? frame.w : frame.h;

             //Prepare slices (for CR2)
-            UInt32 slices = (UInt32)slicesW.size() * (real_h - skipY) / 2;
+            UInt32 slices = (UInt32)slicesW.Count * (real_h - skipY) / 2;
             offset = new UInt32[slices + 1];

             UInt32 t_y = 0;
@@ -366,21 +365,21 @@
             UInt32 t_s = 0;
             UInt32 slice = 0;
             UInt32 pitch_s = mRaw.pitch / 2;  // Pitch in shorts
-            slice_width = new int[slices];
+            slice_width = new uint[slices];

             // This is divided by comps, since comps pixels are processed at the time
-            for (UInt32 i = 0; i < slicesW.size(); i++)
-                slice_width[i] = slicesW[i] / COMPS;
+            for (Int32 i = 0; i < slicesW.Count; i++)
+                slice_width[i] = (uint)(slicesW[i] / COMPS);

             for (slice = 0; slice < slices; slice++)
             {
-                offset[slice] = ((t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
-                _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
+                offset[slice] = (int)((t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)) | (int)(t_s << 28);
+                //_ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
                 t_y += 2;
                 if (t_y >= (real_h - skipY))
                 {
                     t_y = 0;
-                    t_x += slice_width[t_s++];
+                    t_x += (uint)slice_width[t_s++];
                 }
             }

@@ -392,15 +391,15 @@

             offset[slices] = offset[slices - 1];        // Extra offset to avoid branch in loop.

-            if (skipX)
-                slice_width[slicesW.size() - 1] -= skipX;
+            if (skipX != 0)
+                slice_width[slicesW.Count - 1] -= skipX;

             // Predictors for components
-            UInt16* dest = (UInt16*)&draw[offset[0] & 0x0fffffff];
+            UInt16[] dest = draw.Skip((int)(offset[0] & 0x0fffffff) / 2).ToArray();

             // Always points to next slice
             slice = 1;
-            UInt32 pixInSlice = slice_width[0];
+            UInt32 pixInSlice = (uint)slice_width[0];

             // Initialize predictors and decode one group.
             UInt32 x = 0;
@@ -408,14 +407,14 @@
             int p2;
             int p3;
             // First pixel is not predicted, all other are.
-            *dest = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl1);
-            p1 = dest[COMPS] = p1 + HuffDecode(dctbl1);
-            p1 = dest[pitch_s] = p1 + HuffDecode(dctbl1);
-            p1 = dest[COMPS + pitch_s] = p1 + HuffDecode(dctbl1);
+            *dest = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl1);
+            p1 = dest[COMPS] = p1 + HuffDecode(ref dctbl1);
+            p1 = dest[pitch_s] = p1 + HuffDecode(ref dctbl1);
+            p1 = dest[COMPS + pitch_s] = p1 + HuffDecode(ref dctbl1);
             predict = dest;

-            dest[1] = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl2);
-            dest[2] = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl3);
+            dest[1] = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl2);
+            dest[2] = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl3);

             // Skip next
             dest += COMPS * 2;
@@ -435,7 +434,7 @@
                             throw new RawDecoderException("LJpegPlain::decodeScanLeft: Ran out of slices");
                         UInt32 o = offset[slice++];
                         dest = (UInt16*)&draw[o & 0x0fffffff];  // Adjust destination for next pixel
-                        _ASSERTE((o & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
+                        //_ASSERTE((o & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
                         if ((o & 0x0fffffff) > mRaw.pitch * mRaw.dim.y)
                             throw new RawDecoderException("LJpegPlain::decodeScanLeft: Offset out of bounds");
                         pixInSlice = slice_width[o >> 28];
@@ -446,17 +445,17 @@
                             predict = dest;
                         }
                     }
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     *dest = p1;
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     dest[COMPS] = p1;
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     dest[pitch_s] = p1;
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     dest[pitch_s + COMPS] = p1;

-                    dest[1] = p2 = p2 + HuffDecode(dctbl2);
-                    dest[2] = p3 = p3 + HuffDecode(dctbl3);
+                    dest[1] = p2 = p2 + HuffDecode(ref dctbl2);
+                    dest[2] = p3 = p3 + HuffDecode(ref dctbl3);

                     dest += COMPS * 2;
                     pixInSlice -= 2;
@@ -466,8 +465,8 @@
                 p1 = predict[0];
                 p2 = predict[1];
                 p3 = predict[2];
-                _ASSERTE(pixInSlice == 0);  // Ensure, that there is a slice shift at new line
-                                            // Check if we are still within the file.
+                // _ASSERTE(pixInSlice == 0);  // Ensure, that there is a slice shift at new line
+                // Check if we are still within the file.
                 bits.checkPos();

                 x = 0;
@@ -476,6 +475,7 @@

         void decodeScanLeft4_2_2()
         {
+            /*
             _ASSERTE(slicesW.size() < 16);  // We only have 4 bits for slice number.
             _ASSERTE(!(slicesW.size() > 1 && skipX)); // Check if this is a valid state
             _ASSERTE(frame.compInfo[0].superH == 2);   // Check if this is a valid state
@@ -486,41 +486,41 @@
             _ASSERTE(frame.compInfo[2].superV == 1);   // Check if this is a valid state
             _ASSERTE(frame.cps == COMPS);
             _ASSERTE(skipX == 0);
-
-            HuffmanTable* dctbl1 = &huff[frame.compInfo[0].dcTblNo];
-            HuffmanTable* dctbl2 = &huff[frame.compInfo[1].dcTblNo];
-            HuffmanTable* dctbl3 = &huff[frame.compInfo[2].dcTblNo];
+            */
+            HuffmanTable dctbl1 = huff[frame.compInfo[0].dcTblNo];
+            HuffmanTable dctbl2 = huff[frame.compInfo[1].dcTblNo];
+            HuffmanTable dctbl3 = huff[frame.compInfo[2].dcTblNo];

             mRaw.metadata.subsampling.x = 2;
             mRaw.metadata.subsampling.y = 1;

-            UInt16* predict;      // Prediction pointer
-
-            byte* draw = mRaw.getData();
+            UInt16 predict;      // Prediction pointer
+
+            byte[] draw = mRaw.rawData;

             //Prepare slices (for CR2)
-            UInt32 slices = (UInt32)slicesW.size() * (frame.h - skipY);
-            offset = new UInt32[slices + 1];
+            UInt32 slices = (UInt32)slicesW.Count * (frame.h - skipY);
+            offset = new Int32[slices + 1];

             UInt32 t_y = 0;
             UInt32 t_x = 0;
             UInt32 t_s = 0;
             UInt32 slice = 0;
-            slice_width = new int[slices];
+            slice_width = new uint[slices];

             // This is divided by comps, since comps pixels are processed at the time
-            for (UInt32 i = 0; i < slicesW.size(); i++)
-                slice_width[i] = slicesW[i] / 2;
+            for (Int32 i = 0; i < slicesW.Count; i++)
+                slice_width[i] = (uint)slicesW[i] / 2;

             for (slice = 0; slice < slices; slice++)
             {
-                offset[slice] = ((t_x + offX) * mRaw.getBpp() + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
-                _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
+                offset[slice] = (int)(((t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)) | (t_s << 28));
+                //_ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
                 t_y++;
                 if (t_y >= (frame.h - skipY))
                 {
                     t_y = 0;
-                    t_x += slice_width[t_s++];
+                    t_x += (uint)slice_width[t_s++];
                 }
             }
             if ((offset[slices - 1] & 0x0fffffff) >= mRaw.pitch * mRaw.dim.y)
@@ -530,8 +530,8 @@

             offset[slices] = offset[slices - 1];        // Extra offset to avoid branch in loop.

-            if (skipX)
-                slice_width[slicesW.size() - 1] -= skipX;
+            if (skipX != 0)
+                slice_width[slicesW.Count - 1] -= skipX;

             // Predictors for components
             UInt16* dest = (UInt16*)&draw[offset[0] & 0x0fffffff];
@@ -547,11 +547,11 @@
             int p3;
             // First pixel is not predicted, all other are.
             *dest = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl1);
-            p1 = dest[COMPS] = p1 + HuffDecode(dctbl1);
+            p1 = dest[COMPS] = p1 + HuffDecode(ref dctbl1);
             predict = dest;

-            dest[1] = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl2);
-            dest[2] = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl3);
+            dest[1] = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl2);
+            dest[2] = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl3);

             // Skip to next
             dest += COMPS * 2;
@@ -581,13 +581,13 @@
                             predict = dest;
                         }
                     }
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     *dest = p1;
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     dest[COMPS] = p1;

-                    dest[1] = p2 = p2 + HuffDecode(dctbl2);
-                    dest[2] = p3 = p3 + HuffDecode(dctbl3);
+                    dest[1] = p2 = p2 + HuffDecode(ref dctbl2);
+                    dest[2] = p3 = p3 + HuffDecode(ref dctbl3);

                     dest += COMPS * 2;
                     pixInSlice -= 2;
@@ -607,16 +607,16 @@
         void decodeScanLeft2Comps()
         {
             int COMPS = 2;
-            _ASSERTE(slicesW.size() < 16);  // We only have 4 bits for slice number.
-            _ASSERTE(!(slicesW.size() > 1 && skipX)); // Check if this is a valid state
+            //_ASSERTE(slicesW.size() < 16);  // We only have 4 bits for slice number.
+            //_ASSERTE(!(slicesW.size() > 1 && skipX)); // Check if this is a valid state

             byte* draw = mRaw.getData();
             // First line
-            HuffmanTable* dctbl1 = &huff[frame.compInfo[0].dcTblNo];
-            HuffmanTable* dctbl2 = &huff[frame.compInfo[1].dcTblNo];
+            HuffmanTable dctbl1 = huff[frame.compInfo[0].dcTblNo];
+            HuffmanTable dctbl2 = huff[frame.compInfo[1].dcTblNo];

             //Prepare slices (for CR2)
-            UInt32 slices = (UInt32)slicesW.size() * (frame.h - skipY);
+            UInt32 slices = (UInt32)slicesW.Count * (frame.h - skipY);
             offset = new UInt32[slices + 1];

             UInt32 t_y = 0;
@@ -626,13 +626,13 @@
             UInt32 cw = (frame.w - skipX);
             for (slice = 0; slice < slices; slice++)
             {
-                offset[slice] = ((t_x + offX) * mRaw.getBpp() + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
-                _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
+                offset[slice] = ((t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
+                // _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
                 t_y++;
                 if (t_y == (frame.h - skipY))
                 {
                     t_y = 0;
-                    t_x += slicesW[t_s++];
+                    t_x += (uint)slicesW[(int)t_s++];
                 }
             }
             // We check the final position. If bad slice sizes are given we risk writing outside the image
@@ -642,22 +642,22 @@
             }
             offset[slices] = offset[slices - 1];        // Extra offset to avoid branch in loop.

-            slice_width = new int[slices];
+            slice_width = new uint[slices];

             // This is divided by comps, since comps pixels are processed at the time
-            for (UInt32 i = 0; i < slicesW.size(); i++)
-                slice_width[i] = slicesW[i] / COMPS;
-
-            if (skipX)
-                slice_width[slicesW.size() - 1] -= skipX;
+            for (Int32 i = 0; i < slicesW.Count; i++)
+                slice_width[i] = (uint)(slicesW[i] / COMPS);
+
+            if (skipX != 0)
+                slice_width[slicesW.Count - 1] -= skipX;

             // First pixels are obviously not predicted
             int p1;
             int p2;
             UInt16* dest = (UInt16*)&draw[offset[0] & 0x0fffffff];
             UInt16* predict = dest;
-            *dest++ = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl1);
-            *dest++ = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl2);
+            *dest++ = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl1);
+            *dest++ = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl2);

             slice = 1;    // Always points to next slice
             UInt32 pixInSlice = slice_width[0] - 1;  // Skip first pixel
@@ -667,12 +667,12 @@
             {
                 for (; x < cw; x++)
                 {
-                    int diff = HuffDecode(dctbl1);
+                    int diff = HuffDecode(ref dctbl1);
                     p1 += diff;
                     *dest++ = (UInt16)p1;
                     //    _ASSERTE(p1 >= 0 && p1 < 65536);

-                    diff = HuffDecode(dctbl2);
+                    diff = HuffDecode(ref dctbl2);
                     p2 += diff;
                     *dest++ = (UInt16)p2;
                     //      _ASSERTE(p2 >= 0 && p2 < 65536);
@@ -689,12 +689,12 @@
                     }
                 }

-                if (skipX)
+                if (skipX != 0)
                 {
                     for (UInt32 i = 0; i < skipX; i++)
                     {
-                        HuffDecode(dctbl1);
-                        HuffDecode(dctbl2);
+                        HuffDecode(ref dctbl1);
+                        HuffDecode(ref dctbl2);
                     }
                 }

@@ -713,12 +713,12 @@
             int COMPS = 3;
             byte* draw = mRaw.getData();
             // First line
-            HuffmanTable* dctbl1 = &huff[frame.compInfo[0].dcTblNo];
-            HuffmanTable* dctbl2 = &huff[frame.compInfo[1].dcTblNo];
-            HuffmanTable* dctbl3 = &huff[frame.compInfo[2].dcTblNo];
+            HuffmanTable dctbl1 = huff[frame.compInfo[0].dcTblNo];
+            HuffmanTable dctbl2 = huff[frame.compInfo[1].dcTblNo];
+            HuffmanTable dctbl3 = huff[frame.compInfo[2].dcTblNo];

             //Prepare slices (for CR2)
-            UInt32 slices = (UInt32)slicesW.size() * (frame.h - skipY);
+            UInt32 slices = (UInt32)slicesW.Count * (frame.h - skipY);
             offset = new UInt32[slices + 1];

             UInt32 t_y = 0;
@@ -727,13 +727,13 @@
             UInt32 slice = 0;
             for (slice = 0; slice < slices; slice++)
             {
-                offset[slice] = ((t_x + offX) * mRaw.getBpp() + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
-                _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
+                offset[slice] = ((t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
+               // _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
                 t_y++;
                 if (t_y == (frame.h - skipY))
                 {
                     t_y = 0;
-                    t_x += slicesW[t_s++];
+                    t_x += (uint)slicesW[(int)t_s++];
                 }
             }
             // We check the final position. If bad slice sizes are given we risk writing outside the image
@@ -744,14 +744,14 @@

             offset[slices] = offset[slices - 1];        // Extra offset to avoid branch in loop.

-            slice_width = new int[slices];
+            slice_width = new uint[slices];

             // This is divided by comps, since comps pixels are processed at the time
-            for (UInt32 i = 0; i < slicesW.size(); i++)
-                slice_width[i] = slicesW[i] / COMPS;
-
-            if (skipX)
-                slice_width[slicesW.size() - 1] -= skipX;
+            for (Int32 i = 0; i < slicesW.Count; i++)
+                slice_width[i] = (uint)(slicesW[i] / COMPS);
+
+            if (skipX !=0)
+                slice_width[slicesW.Count - 1] -= skipX;

             // First pixels are obviously not predicted
             int p1;
@@ -759,9 +759,9 @@
             int p3;
             UInt16* dest = (UInt16*)&draw[offset[0] & 0x0fffffff];
             UInt16* predict = dest;
-            *dest++ = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl1);
-            *dest++ = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl2);
-            *dest++ = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl3);
+            *dest++ = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl1);
+            *dest++ = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl2);
+            *dest++ = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl3);

             slice = 1;
             UInt32 pixInSlice = slice_width[0] - 1;
@@ -773,13 +773,13 @@
             {
                 for (; x < cw; x++)
                 {
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     *dest++ = (UInt16)p1;

-                    p2 += HuffDecode(dctbl2);
+                    p2 += HuffDecode(ref dctbl2);
                     *dest++ = (UInt16)p2;

-                    p3 += HuffDecode(dctbl3);
+                    p3 += HuffDecode(ref dctbl3);
                     *dest++ = (UInt16)p3;

                     if (0 == --pixInSlice)
@@ -790,18 +790,18 @@
                         dest = (UInt16*)&draw[o & 0x0fffffff];  // Adjust destination for next pixel
                         if ((o & 0x0fffffff) > mRaw.pitch * mRaw.dim.y)
                             throw new RawDecoderException("LJpegPlain::decodeScanLeft: Offset out of bounds");
-                        _ASSERTE((o >> 28) < slicesW.size());
+                        //_ASSERTE((o >> 28) < slicesW.size());
                         pixInSlice = slice_width[o >> 28];
                     }
                 }

-                if (skipX)
+                if (skipX != 0)
                 {
                     for (UInt32 i = 0; i < skipX; i++)
                     {
-                        HuffDecode(dctbl1);
-                        HuffDecode(dctbl2);
-                        HuffDecode(dctbl3);
+                        HuffDecode(ref dctbl1);
+                        HuffDecode(ref dctbl2);
+                        HuffDecode(ref  dctbl3);
                     }
                 }

@@ -819,22 +819,21 @@
         {
             int COMPS = 4;
             // First line
-            HuffmanTable* dctbl1 = &huff[frame.compInfo[0].dcTblNo];
-            HuffmanTable* dctbl2 = &huff[frame.compInfo[1].dcTblNo];
-            HuffmanTable* dctbl3 = &huff[frame.compInfo[2].dcTblNo];
-            HuffmanTable* dctbl4 = &huff[frame.compInfo[3].dcTblNo];
+            HuffmanTable dctbl1 = huff[frame.compInfo[0].dcTblNo];
+            HuffmanTable dctbl2 = huff[frame.compInfo[1].dcTblNo];
+            HuffmanTable dctbl3 = huff[frame.compInfo[2].dcTblNo];
+            HuffmanTable dctbl4 = huff[frame.compInfo[3].dcTblNo];

             if (mCanonDoubleHeight)
             {
                 frame.h *= 2;
-                mRaw.dim = iPoint2D(frame.w * 2, frame.h);
-                mRaw.destroyData();
-                mRaw.createData();
+                mRaw.dim = new iPoint2D((int)frame.w * 2, (int)frame.h);
+
             }
             byte* draw = mRaw.getData();

             //Prepare slices (for CR2)
-            UInt32 slices = (UInt32)slicesW.size() * (frame.h - skipY);
+            UInt32 slices = (UInt32)slicesW.Count * (frame.h - skipY);
             offset = new UInt32[slices + 1];

             UInt32 t_y = 0;
@@ -843,13 +842,13 @@
             UInt32 slice = 0;
             for (slice = 0; slice < slices; slice++)
             {
-                offset[slice] = ((t_x + offX) * mRaw.getBpp() + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
-                _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
+                offset[slice] = ((t_x + offX) * mRaw.bpp + ((offY + t_y) * mRaw.pitch)) | (t_s << 28);
+               // _ASSERTE((offset[slice] & 0x0fffffff) < mRaw.pitch * mRaw.dim.y);
                 t_y++;
                 if (t_y == (frame.h - skipY))
                 {
                     t_y = 0;
-                    t_x += slicesW[t_s++];
+                    t_x += (uint)slicesW[(int)t_s++];
                 }
             }
             // We check the final position. If bad slice sizes are given we risk writing outside the image
@@ -859,14 +858,14 @@
             }
             offset[slices] = offset[slices - 1];        // Extra offset to avoid branch in loop.

-            slice_width = new int[slices];
+            slice_width = new uint[slices];

             // This is divided by comps, since comps pixels are processed at the time
-            for (UInt32 i = 0; i < slicesW.size(); i++)
-                slice_width[i] = slicesW[i] / COMPS;
-
-            if (skipX)
-                slice_width[slicesW.size() - 1] -= skipX;
+            for (Int32 i = 0; i < slicesW.Count; i++)
+                slice_width[i] = (uint)(slicesW[i] / COMPS);
+
+            if (skipX != 0)
+                slice_width[slicesW.Count - 1] -= skipX;

             // First pixels are obviously not predicted
             int p1;
@@ -875,10 +874,10 @@
             int p4;
             UInt16* dest = (UInt16*)&draw[offset[0] & 0x0fffffff];
             UInt16* predict = dest;
-            *dest++ = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl1);
-            *dest++ = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl2);
-            *dest++ = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl3);
-            *dest++ = p4 = (1 << (frame.prec - Pt - 1)) + HuffDecode(dctbl4);
+            *dest++ = p1 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl1);
+            *dest++ = p2 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl2);
+            *dest++ = p3 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl3);
+            *dest++ = p4 = (1 << (frame.prec - Pt - 1)) + HuffDecode(ref dctbl4);

             slice = 1;
             UInt32 pixInSlice = slice_width[0] - 1;
@@ -893,16 +892,16 @@
             {
                 for (; x < cw; x++)
                 {
-                    p1 += HuffDecode(dctbl1);
+                    p1 += HuffDecode(ref dctbl1);
                     *dest++ = (UInt16)p1;

-                    p2 += HuffDecode(dctbl2);
+                    p2 += HuffDecode(ref dctbl2);
                     *dest++ = (UInt16)p2;

-                    p3 += HuffDecode(dctbl3);
+                    p3 += HuffDecode( ref dctbl3);
                     *dest++ = (UInt16)p3;

-                    p4 += HuffDecode(dctbl4);
+                    p4 += HuffDecode(ref dctbl4);
                     *dest++ = (UInt16)p4;

                     if (0 == --pixInSlice)
@@ -916,14 +915,14 @@
                         pixInSlice = slice_width[o >> 28];
                     }
                 }
-                if (skipX)
+                if (skipX != 0)
                 {
                     for (UInt32 i = 0; i < skipX; i++)
                     {
-                        HuffDecode(dctbl1);
-                        HuffDecode(dctbl2);
-                        HuffDecode(dctbl3);
-                        HuffDecode(dctbl4);
+                        HuffDecode(ref dctbl1);
+                        HuffDecode(ref dctbl2);
+                        HuffDecode(ref dctbl3);
+                        HuffDecode(ref dctbl4);
                     }
                 }
                 bits.checkPos();


[REEF-778] IMRU Map and Update task and driver have verbose setting on by default
This addressed the issue by
* Setting DriverConfiguration.CustomTraceLevel to Info

JIRA:[REEF-778](https://issues.apache.org/jira/browse/REEF-778)

This Closes #517

--- lang/cs/Org.Apache.REEF.IMRU/OnREEF/Client/REEFIMRUClient.cs
+++ lang/cs/Org.Apache.REEF.IMRU/OnREEF/Client/REEFIMRUClient.cs
@@ -23,6 +23,7 @@
 using Org.Apache.REEF.Client.API;
 using Org.Apache.REEF.Driver;
 using Org.Apache.REEF.IMRU.API;
+using Org.Apache.REEF.Driver.Bridge;
 using Org.Apache.REEF.IMRU.OnREEF.Driver;
 using Org.Apache.REEF.IMRU.OnREEF.Parameters;
 using Org.Apache.REEF.Network.Group.Config;
@@ -95,6 +96,7 @@
                         GenericType<IMRUDriver<TMapInput, TMapOutput, TResult>>.Class)
                     .Set(DriverConfiguration.OnEvaluatorFailed,
                         GenericType<IMRUDriver<TMapInput, TMapOutput, TResult>>.Class)
+                    .Set(DriverConfiguration.CustomTraceLevel, TraceLevel.Info.ToString())
                     .Build(),
                 TangFactory.GetTang().NewConfigurationBuilder()
                     .BindStringNamedParam<GroupCommConfigurationOptions.DriverId>(driverId)


Reacting to verbose rename

Reacting to verbose rename

--- samples/SessionSample/Startup.cs
+++ samples/SessionSample/Startup.cs
@@ -13,7 +13,7 @@
     {
         public Startup(ILoggerFactory loggerFactory)
         {
-            loggerFactory.AddConsole(LogLevel.Verbose);
+            loggerFactory.AddConsole(LogLevel.Debug);
         }

         public void ConfigureServices(IServiceCollection services)


Poll for changes less often

Poll for changes less often

There’s no need to check this every frame.

--- osu.Framework/Input/Handlers/Joystick/OpenTKJoystickHandler.cs
+++ osu.Framework/Input/Handlers/Joystick/OpenTKJoystickHandler.cs
@@ -41,7 +41,7 @@
                             handleState(device, newState);
                             FrameStatistics.Increment(StatisticsCounterType.JoystickEvents);
                         }
-                    }, 0, 0));
+                    }, 0, 500));
                 }
                 else
                 {