Minor changes to zappercontroller

Minor changes to zappercontroller

--- Unity/zapper-shooter/Assets/Scripts/ZapperController.cs
+++ Unity/zapper-shooter/Assets/Scripts/ZapperController.cs
@@ -24,8 +24,8 @@

     private int getFrameCountForState(DisplayState state) {
         switch(state) {
-        case DisplayState.BLANK_FRAME: return 10;
-        case DisplayState.TARGET: return 10;
+        case DisplayState.BLANK_FRAME: return 2;
+        case DisplayState.TARGET: return 2;
         default: return -1;
         }
     }
@@ -75,6 +75,8 @@
                 moveTarget();
                 //createTarget();//Is this slow as hell? Move to constructor and only activate here
                 m_planeFrameCounter = 0;
+
+                Debug.LogFormat("Last frame time {0} ms", Time.deltaTime * 1000);
             }
             m_planeFrameCounter++;

@@ -84,6 +86,8 @@
             if (m_planeFrameCounter > getFrameCountForState(m_state)) {
                 m_state = DisplayState.IDLE;
                 m_planeFrameCounter = 0;
+
+                Debug.LogFormat("Last frame time {0} ms", Time.deltaTime * 1000);
             }
             m_planeFrameCounter++;


Callback emits a KeyValuePair now, with the raw event and the event name

--- src/csharp/emit-events.cs
+++ src/csharp/emit-events.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
+
 using Microsoft.Lync.Model;
 using Microsoft.Lync.Model.Conversation;
 using Microsoft.Lync.Model.Conversation.AudioVideo;
@@ -10,7 +11,6 @@

 public class Startup
 {
-
   public Task<object> BindToVideoChannelChanges(Func<object, Task<object>> callback) {
     System.Console.WriteLine("emit-events:BindToVideoChannelChanges");

@@ -18,14 +18,14 @@
     var videoChannel = ((AVModality)conversation.Modalities[ModalityTypes.AudioVideo]).VideoChannel;

     videoChannel.ActionAvailabilityChanged += (sender, e) => {
-      System.Console.WriteLine("emit-events:videoChannel:ActionAvailabilityChanged");
-      callback("videoChannel:ActionAvailabilityChanged:"+e.Action);
+      System.Console.WriteLine("emit-events:videoChannel:ActionAvailabilityChanged");
+      callback(new KeyValuePair<String, Object>("VideoChannel:ActionAvailabilityChanged", e));
       System.Console.WriteLine("emit-events:videoChannel:ActionAvailabilityChanged after callback");
     };

     videoChannel.StateChanged += (sender, e) => {
       System.Console.WriteLine("emit-events:videoChannel:StateChanged");
-      callback("videoChannel:StateChanged:"+e.NewState);
+      callback(new KeyValuePair<String, Object>("VideoChannel:StateChanged", e));
       System.Console.WriteLine("emit-events:videoChannel:StateChanged after callback");
     };

@@ -41,7 +41,7 @@

     avModality.ActionAvailabilityChanged += (sender, e) => {
       System.Console.WriteLine("emit-events:avModality:ActionAvailabilityChanged");
-      callback("avModality:ActionAvailabilityChanged:"+e.Action);
+      callback(new KeyValuePair<String, Object>("AvModality:ActionAvailabilityChanged:", e));
       System.Console.WriteLine("emit-events:avModality:ActionAvailabilityChanged after callback");

       if ( !videoChannelBound && ((AVModality)sender).CanInvoke(ModalityAction.Connect) ) {
@@ -52,7 +52,7 @@

     avModality.ModalityStateChanged += (sender, e) => {
       System.Console.WriteLine("emit-events:avModality:ModalityStateChanged");
-      callback("avModality:ModalityStateChanged:"+e.NewState);
+      callback(new KeyValuePair<String, Object>("AvModality:ModalityStateChanged:", e));
       System.Console.WriteLine("emit-events:avModality:ModalityStateChanged after callback");
     };

@@ -66,7 +66,7 @@

     conversation.StateChanged += (sender, e) => {
       System.Console.WriteLine("emit-events:conversation:StateChanged");
-      callback("conversation:StateChanged:"+e.NewState);
+      callback(new KeyValuePair<String, Object>("Conversation:StateChanged", e));
       System.Console.WriteLine("emit-events:conversation:StateChanged after callback");
     };

@@ -80,7 +80,7 @@

     ConversationManager.ConversationAdded += (sender, e) => {
       System.Console.WriteLine("emit-events:ConversationAdded");
-      callback("ConversationManager:ConversationAdded");
+      callback(new KeyValuePair<String, Object>("ConversationManager:ConversationAdded", e));
       System.Console.WriteLine("emit-events:ConversationAdded after callback");

       BindToConversationChanges(callback);
@@ -89,7 +89,7 @@

     ConversationManager.ConversationRemoved += (sender, e) => {
       System.Console.WriteLine("emit-events:ConversationRemoved");
-      callback("ConversationManager:ConversationRemoved");
+      callback(new KeyValuePair<String, Object>("ConversationManager:ConversationRemoved", e));
       System.Console.WriteLine("emit-events:ConversationRemoved after callback");
     };

@@ -99,7 +99,6 @@
   public async Task<object> Invoke(Func<object, Task<object>> callback)
   {
     System.Console.WriteLine("emit-events:Invoke");
-
     BindToConversationManagerChanges(callback);
     return null;
   }


[map.wp] Better logic for the tile load balancing.

--- Windows/Source/Map.Common/Models/EpflBuildingsSource.cs
+++ Windows/Source/Map.Common/Models/EpflBuildingsSource.cs
@@ -15,7 +15,7 @@
         // Parameters are the server number, the level, the zoon level, the X coordinate and the Y coordinate
         private const string Url = "http://plan-epfl-tile{0}.epfl.ch/batiments{1}-merc/{2}/{3:000/000/000}/{4:000/000/000}.png";
         private const int ServerCount = 5;
-        private static readonly Random Random = new Random();
+        private static uint _server = 0;

         /// <summary>
         /// Gets an Uri for the tile at the specified X/Y coordinates, zoom level and buildings level.
@@ -23,8 +23,8 @@
         public static Uri GetUri( int buildingsLevel, int x, int y, int zoomLevel )
         {
             y = FixY( y, zoomLevel );
-            int server = Random.Next( ServerCount );
-            return new Uri( string.Format( Url, server, buildingsLevel, zoomLevel, x, y ), UriKind.Absolute );
+            _server = ( _server + 1 ) % ServerCount;
+            return new Uri( string.Format( Url, _server, buildingsLevel, zoomLevel, x, y ), UriKind.Absolute );
         }

         /// <summary>


Preventing some excpetion while trying to convert to double

--- Fluent.Ribbon/Converters/ThicknessConverter.cs
+++ Fluent.Ribbon/Converters/ThicknessConverter.cs
@@ -49,8 +49,8 @@
         private static double TryConvertSingleValue(object value)
         {
             try
-            {
-                return System.Convert.ToDouble(value);
+            {
+                return (value as IConvertible)?.ToDouble(null) ?? 0;
             }
             catch
             {


Add ToPascalCase method

Add ToPascalCase method

--- FonctionsUtiles.Fred.Csharp/FunctionsString.cs
+++ FonctionsUtiles.Fred.Csharp/FunctionsString.cs
@@ -28,7 +28,7 @@
   using System.Text;
   using System.Text.RegularExpressions;
   using MathFunc = FunctionsMath;
-
+
   public class FunctionsString
   {
     /// <summary>
@@ -3052,5 +3052,89 @@

       //return result;
     }
+
+    public static string ToPascalCase(string s)
+    {
+      // TODO write unit tests for this method
+      return s.Substring(0, 1).ToUpper() + s.Substring(1).ToLower();
+    }
+
+    public static string ToTitleCase2(string s)
+    {
+      // TODO write unit tests for this method
+      //          <TestMethod()>
+      //    Public Sub ToTitleCaseTest()
+      //        Debug.Print("USA".ToTitleCase())
+      //        Debug.Print("usa".ToTitleCase())
+      //        Debug.Print("uSa".ToTitleCase())
+      //        Debug.Print("Sleepy Hollow".ToTitleCase())
+      //        Debug.Print("Z Nation".ToTitleCase())
+      //        Debug.Print("Hot In Cleveland".ToTitleCase())
+      //        Debug.Print("HOT IN CLEVELAND".ToTitleCase())
+      //        Debug.Print("once upon a time".ToTitleCase())
+      //        Debug.Print("ONCE UPON A TIME".ToTitleCase())
+      //    End Sub
+
+      //Test Result
+      //Hide   Copy Code
+
+      //USA
+
+      //USA
+
+      //USA
+
+      //Sleepy Hollow
+
+      //Z Nation
+
+      //Hot in Cleveland
+
+      //Hot in Cleveland
+
+      //Once Upon a Time
+
+      //Once Upon a Time
+
+      var upperCase = s.ToUpper();
+      var words = upperCase.Split(' ');
+      var minorWords = new[] {"ON", "IN", "AT", "OFF", "WITH", "TO", "AS", "BY",//prepositions
+                                       "THE", "A", "OTHER", "ANOTHER",//articles
+                                       "AND", "BUT", "ALSO", "ELSE", "FOR", "IF"};//conjunctions
+
+      var acronyms = new[] {"UK", "USA", "US",//countries
+                                       "BBC",//TV stations
+                                       "TV"};//others
+
+      //The first word.
+      //The first letter of the first word is always capital.
+      if (acronyms.Contains(words[0]))
+      {
+        words[0] = words[0].ToUpper();
+      }
+      else
+      {
+        words[0] = ToPascalCase(words[0]);
+      }
+
+      //The rest words.
+      for (int i = 0; i < words.Length; i++)
+      {
+        if (minorWords.Contains(words[i]))
+        {
+          words[i] = words[i].ToLower();
+        }
+        else if (acronyms.Contains(words[i]))
+        {
+          words[i] = words[i].ToUpper();
+        }
+        else
+        {
+          words[i] = ToPascalCase(words[i]);
+        }
+      }
+
+      return string.Join(" ", words);
+    }
   }
 }


Checks for an active provider before adding the version and name information

--- FoundationV3/Mobile/Detection/RequestHelper.cs
+++ FoundationV3/Mobile/Detection/RequestHelper.cs
@@ -140,7 +140,10 @@
                     WriteAssembly(writer);

                     // Record information about the active provider.
-                    WriteProvider(writer, WebProvider.ActiveProvider);
+                    if (WebProvider._activeProviderCreated)
+                    {
+                        WriteProvider(writer, WebProvider.ActiveProvider);
+                    }

                     // Record either the IP address of the client if not local or the IP
                     // address of the machine.
@@ -268,11 +271,8 @@
             if (provider != null)
             {
                 writer.WriteStartElement("DataSet");
-                if (provider.DataSet.Export != null)
-                {
-                    writer.WriteElementString("Export", provider.DataSet.Export.ToString());
-                }
-                writer.WriteElementString("Tag", provider.DataSet.Tag.ToString());
+                writer.WriteElementString("Version", provider.DataSet.Version.ToString());
+                writer.WriteElementString("Name", provider.DataSet.Name);
                 writer.WriteEndElement();
             }
         }


Better perf by caching branch list

Better perf by caching branch list

Conflicts:
	GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs

--- GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs
+++ GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs
@@ -58,12 +58,11 @@
                 if (!string.IsNullOrWhiteSpace(tfsPathParentBranch))
                     Trace.WriteLine("Parameter about parent branch will be ignored because this version of TFS is able to find the parent!");

-                Trace.WriteLine("Looking for all branches...");
-                var allTfsBranches = VersionControl.QueryRootBranchObjects(RecursionType.Full);
-                var tfsBranchToCreate = allTfsBranches.FirstOrDefault(b => b.Properties.RootItem.Item.ToLower() == tfsPathBranchToCreate.ToLower());
+                Trace.WriteLine("Looking to find branch '" + tfsPathBranchToCreate + "' in all TFS branches...");
+                var tfsBranchToCreate = AllTfsBranches.FirstOrDefault(b => b.Properties.RootItem.Item.ToLower() == tfsPathBranchToCreate.ToLower());
                 if (tfsBranchToCreate == null)
                 {
-                    throw new GitTfsException("error: TFS branches "+ tfsPathBranchToCreate +" not found!");
+                    throw new GitTfsException("error: TFS branches " + tfsPathBranchToCreate + " not found!");
                 }

                 if (tfsBranchToCreate.Properties.ParentBranch == null)
@@ -106,6 +105,18 @@
             {
                 Trace.WriteLine(ex.Message);
                 return base.GetRootChangesetForBranch(tfsPathBranchToCreate, tfsPathParentBranch);
+            }
+        }
+
+        private BranchObject[] _allTfsBranches;
+        private BranchObject[] AllTfsBranches
+        {
+            get
+            {
+                if (_allTfsBranches != null)
+                    return _allTfsBranches;
+                Trace.WriteLine("Looking for all branches...");
+                return _allTfsBranches = VersionControl.QueryRootBranchObjects(RecursionType.Full);
             }
         }


Optimize List Clear+Remove (#9540)

Optimize List Clear+Remove (#9540)

* List Clear+Remove
* Tail call Array.Clear

--- src/mscorlib/src/System/Collections/Generic/List.cs
+++ src/mscorlib/src/System/Collections/Generic/List.cs
@@ -12,14 +12,13 @@
 **
 **
 ===========================================================*/
-namespace System.Collections.Generic {
-
+namespace System.Collections.Generic
+{
     using System;
-    using System.Runtime;
-    using System.Runtime.Versioning;
     using System.Diagnostics;
     using System.Diagnostics.Contracts;
     using System.Collections.ObjectModel;
+    using Runtime.CompilerServices;

     // Implements a variable-size List that uses an array of objects to store the
     // elements. A List has a capacity, which is the allocated length
@@ -291,13 +290,23 @@

         // Clears the contents of List.
-        public void Clear() {
-            if (_size > 0)
+        public void Clear()
+        {
+            if (JitHelpers.ContainsReferences<T>())
             {
-                Array.Clear(_items, 0, _size); // Don't need to doc this but we clear the elements so that the gc can reclaim the references.
+                int size = _size;
                 _size = 0;
-            }
-            _version++;
+                _version++;
+                if (size > 0)
+                {
+                    Array.Clear(_items, 0, size); // Clear the elements so that the gc can reclaim the references.
+                }
+            }
+            else
+            {
+                _size = 0;
+                _version++;
+            }
         }

         // Contains returns true if the specified element is in the List.
@@ -852,9 +861,13 @@
                     // copy item to the free slot.
                     _items[freeIndex++] = _items[current++];
                 }
-            }
-
-            Array.Clear(_items, freeIndex, _size - freeIndex);
+            }
+
+            if (JitHelpers.ContainsReferences<T>())
+            {
+                Array.Clear(_items, freeIndex, _size - freeIndex); // Clear the elements so that the gc can reclaim the references.
+            }
+
             int result = _size - freeIndex;
             _size = freeIndex;
             _version++;
@@ -870,10 +883,14 @@
             }
             Contract.EndContractBlock();
             _size--;
-            if (index < _size) {
+            if (index < _size)
+            {
                 Array.Copy(_items, index + 1, _items, index, _size - index);
             }
-            _items[_size] = default(T);
+            if (JitHelpers.ContainsReferences<T>())
+            {
+                _items[_size] = default(T);
+            }
             _version++;
         }

@@ -898,8 +915,12 @@
                 if (index < _size) {
                     Array.Copy(_items, index + count, _items, index, _size - index);
                 }
-                Array.Clear(_items, _size, count);
+
                 _version++;
+                if (JitHelpers.ContainsReferences<T>())
+                {
+                    Array.Clear(_items, _size, count);
+                }
             }
         }


Save and reset the bound object on motion/pointer leave to a hover object

2008-05-22  Aaron Bockover  <abock@gnome.org>

    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs: Save and
    reset the bound object on motion/pointer leave to a hover object variable
    and draw the checkbox as prelit if that's set

svn path=/trunk/banshee/; revision=3959

--- Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
+++ Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
@@ -44,12 +44,17 @@
             int x = context.Area.X + xpad + ((cell_width - Size) / 2);
             int y = context.Area.Y + ypad + ((cell_height - Size) / 2);

+            if (state == StateType.Normal && last_hover_bound == BoundObjectParent) {
+                state = StateType.Prelight;
+            }
+
             Style.PaintCheck (context.Widget.Style, context.Drawable, state,
                 Value ? ShadowType.In : ShadowType.Out,
                 context.Clip, context.Widget, "cellcheck", x, y, Size, Size);
         }

         private object last_pressed_bound;
+        private object last_hover_bound;

         public bool ButtonEvent (int x, int y, bool pressed, Gdk.EventButton evnt)
         {
@@ -68,12 +73,18 @@

         public bool MotionEvent (int x, int y, Gdk.EventMotion evnt)
         {
-            return false;
+            if (last_hover_bound == BoundObjectParent) {
+                return false;
+            }
+
+            last_hover_bound = BoundObjectParent;
+            return true;
         }

         public bool PointerLeaveEvent ()
         {
-            return false;
+            last_hover_bound = null;
+            return true;
         }

         public void GetSize (out int width, out int height)


Delete Login.cs

Delete Login.cs

--- IdentityDemo_EmailConfirmation/Models/Login.cs
+++ IdentityDemo_EmailConfirmation/Models/Login.cs
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Web;
-using System.Web.Mvc;
-
-namespace IdentityDemo.Models
-{
-    public class Login
-    {
-        [Required]
-        public string Username { get; set; }
-
-        [Required]
-        public string Password { get; set; }
-
-        public bool RememberMe { get; set; }
-    }
-}


ルートデータからidを取得するメソッドを追加。

ルートデータからidを取得するメソッドを追加。

--- Implem.Pleasanter/Libraries/Requests/Routes.cs
+++ Implem.Pleasanter/Libraries/Requests/Routes.cs
@@ -23,5 +23,10 @@
         {
             return HttpContext.Current.Request.HttpMethod.ToLower();
         }
+
+        public static long Id()
+        {
+            return Url.RouteData("id").ToLong();
+        }
     }
 }


Corrected a logic error in botSearchBotOutfits which would cause it to return one result less than it should have.

--- InWorldz/InWorldz.Phlox.Engine/LSLSystemAPI.cs
+++ InWorldz/InWorldz.Phlox.Engine/LSLSystemAPI.cs
@@ -16100,9 +16100,12 @@
                     {
                         if(pattern == "" || iwMatchString(outfit, pattern, matchType) == 1)
                         {
-                            if(++count >= start && (end == -1 || count <=end))
+                            if (count >= start && (end == -1 || count <= end))
+                            {
                                 retVal.Add(outfit);
-                            if (end != -1 && count >= end)
+                            }
+                            count++;
+                            if (end != -1 && count > end)
                                 break;
                         }
                     }


Only display per operation timings if there are recorded

--- src/projects/MeepMeep/Output/ConsoleOutputWriter.cs
+++ src/projects/MeepMeep/Output/ConsoleOutputWriter.cs
@@ -72,19 +72,22 @@
             {
                 Console.WriteLine();
                 Console.WriteLine("[Completed workload: {0}]", workloadResult.Description);
-                Console.WriteLine("{0}[Thread: {1}]", Indent, workloadResult.ThreadName);
                 Console.WriteLine("{0}[Workload size: {1}]", Indent, workloadResult.WorkloadSize);
-                Console.WriteLine("{0}[Total docsize:{1}]", Indent, workloadResult.GetTotalDocSize());
-                Console.WriteLine("{0}[Total time (ms):{1}]", Indent, workloadResult.TimeTaken.TotalMilliseconds);
-                Console.WriteLine("{0}[Total operations:{1}]", Indent, workloadResult.CountOperations());
-                Console.WriteLine("{0}[Failed operations:{1}]", Indent, workloadResult.CountFailedOperations());
-                Console.WriteLine("{0}[Avg operation time (ms):{1}]", Indent, workloadResult.GetAverageOperationMs());
-                Console.WriteLine("{0}[Avg operations per/second:{1}]", Indent, workloadResult.CountOperations() / workloadResult.TimeTaken.Seconds);
-                Console.WriteLine("{0}[Min successful operation time (ms):{1}]", Indent, workloadResult.GetSuccessfulOperationMinDurationMs());
-                Console.WriteLine("{0}[Max successful operation time (ms):{1}]", Indent, workloadResult.GetSuccessfulOperationMaxDurationMs());
-                Console.WriteLine("{0}[95th percentile operation time (ms):{1}]", Indent, workloadResult.GetSuccessfullOperationPercentile(0.95));
-                Console.WriteLine("{0}[98th percentile operation time (ms):{1}]", Indent, workloadResult.GetSuccessfullOperationPercentile(0.98));
-                Console.WriteLine("{0}[99th percentile operation time (ms):{1}]", Indent, workloadResult.GetSuccessfullOperationPercentile(0.99));
+                Console.WriteLine("{0}[Total docsize: {1}]", Indent, workloadResult.GetTotalDocSize());
+                Console.WriteLine("{0}[Total operations: {1}]", Indent, workloadResult.CountOperations());
+                Console.WriteLine("{0}[Failed operations: {1}]", Indent, workloadResult.CountFailedOperations());
+                Console.WriteLine("{0}[Total time (ms): {1}]", Indent, workloadResult.TimeTaken.TotalMilliseconds);
+                Console.WriteLine("{0}[Avg operations per/second: {1}]", Indent, Math.Round(workloadResult.CountOperations() / workloadResult.TimeTaken.TotalSeconds));
+
+                if (workloadResult.HasPerOperationTimings())
+                {
+                    Console.WriteLine("{0}[Avg operation time (ms): {1}]", Indent, workloadResult.GetAverageOperationMs());
+                    Console.WriteLine("{0}[Min successful operation time (ms): {1}]", Indent, workloadResult.GetSuccessfulOperationMinDurationMs());
+                    Console.WriteLine("{0}[Max successful operation time (ms): {1}]", Indent, workloadResult.GetSuccessfulOperationMaxDurationMs());
+                    Console.WriteLine("{0}[95th percentile operation time (ms): {1}]", Indent, workloadResult.GetSuccessfullOperationPercentile(0.95));
+                    Console.WriteLine("{0}[98th percentile operation time (ms): {1}]", Indent, workloadResult.GetSuccessfullOperationPercentile(0.98));
+                    Console.WriteLine("{0}[99th percentile operation time (ms): {1}]", Indent, workloadResult.GetSuccessfullOperationPercentile(0.99));
+                }
             });
         }

@@ -139,4 +142,4 @@
             }
         }
     }
-}+}


Fixing sqlite-net issue #137. Windows Store doesn't have InvariantCultureIgnoreCase, so use OrdinalIgnoreCase instead.

--- src/SQLite.cs
+++ src/SQLite.cs
@@ -391,7 +391,7 @@
 			foreach (var p in map.Columns) {
 				var found = false;
 				foreach (var c in existingCols) {
-					found = (string.Compare (p.Name, c.Name, StringComparison.InvariantCultureIgnoreCase) == 0);
+					found = (string.Compare (p.Name, c.Name, StringComparison.OrdinalIgnoreCase) == 0);
 					if (found)
 						break;
 				}
@@ -1096,7 +1096,7 @@

 			var map = GetMapping (objType);

-			var replacing = string.Compare (extra, "OR REPLACE", StringComparison.InvariantCultureIgnoreCase) == 0;
+			var replacing = string.Compare (extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0;

 			var cols = replacing ? map.InsertOrReplaceColumns : map.InsertColumns;
 			var vals = new object[cols.Length];
@@ -1540,7 +1540,7 @@
             }
             else
             {
-				var replacing = string.Compare (extra, "OR REPLACE", StringComparison.InvariantCultureIgnoreCase) == 0;
+				var replacing = string.Compare (extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0;

 				if (replacing) {
 					cols = InsertOrReplaceColumns;


removed unused Pattern#PatternNodes property

--- Jobs/DMT.VIR.Matcher.Local/Patterns/Pattern.cs
+++ Jobs/DMT.VIR.Matcher.Local/Patterns/Pattern.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -11,15 +12,6 @@
     public class Pattern : IPattern
     {
         private List<PatternNode> patternNodes;
-
-        /// <summary>
-        /// Gets or sets the nodes for the pattern.
-        /// </summary>
-        public IEnumerable<PatternNode> PatternNodes
-        {
-            get { return this.patternNodes; }
-            set { this.patternNodes = new List<PatternNode>(value); }
-        }

         public bool IsMatched
         {


Actually set StoreTimeSpanAsTicks flag

Actually set StoreTimeSpanAsTicks flag

--- src/SQLite.cs
+++ src/SQLite.cs
@@ -315,6 +315,7 @@
 			_open = true;

 			StoreDateTimeAsTicks = connectionString.StoreDateTimeAsTicks;
+            StoreTimeSpanAsTicks = connectionString.StoreTimeSpanAsTicks;
 			DateTimeStringFormat = connectionString.DateTimeStringFormat;
 			DateTimeStyle = connectionString.DateTimeStyle;


Oops, read/write lock bugs sorted out

Oops, read/write lock bugs sorted out

Impossible to modify users, because server salt creates a read lock,
while a write lock already existed.

--- plugins/extras/p5.auth/helpers/AuthenticationHelper.cs
+++ plugins/extras/p5.auth/helpers/AuthenticationHelper.cs
@@ -218,7 +218,7 @@
             // Verifying username is valid, since we'll need to create a folder for user
             VerifyUsernameValid (username);

-            // Creating user salt, and retrieving system salt
+            // Retrieving system salt before we enter write lock.
             var serverSalt = context.RaiseEvent (".p5.auth.get-server-salt").Get<string> (context);

             // Then salting password with user salt, before salting it with system salt
@@ -323,6 +323,9 @@
             if (args["username"] != null)
                 throw new LambdaSecurityException ("Cannot change username for user", args, context);

+            // Retrieving system salt before we enter write lock.
+            var serverSalt = context.RaiseEvent (".p5.auth.get-server-salt").Get<string> (context);
+
             // Locking access to password file as we edit user object
             AuthFile.ModifyAuthFile (
                 context,
@@ -339,9 +342,6 @@
                     if (!string.IsNullOrEmpty (password)) {

                         // Changing user's password
-                        // Creating user salt, and retrieving system salt
-                        var serverSalt = context.RaiseEvent (".p5.auth.get-server-salt").Get<string> (context);
-
                         // Then salting password with user salt and system, before salting it with system salt
                         var userPasswordFingerprint = context.RaiseEvent ("p5.crypto.hash.create-sha256", new Node ("", serverSalt + password)).Get<string> (context);
                         authFile ["users"][username]["password"].Value = userPasswordFingerprint;
@@ -414,15 +414,15 @@

             string username = context.Ticket.Username;

+            // Retrieving system salt before we enter write lock.
+            var serverSalt = context.RaiseEvent (".p5.auth.get-server-salt").Get<string> (context);
+
             // Locking access to password file as we edit user object
             AuthFile.ModifyAuthFile (
                 context,
                 delegate (Node authFile) {

                     // Changing user's password
-                    // Creating user salt, and retrieving system salt
-                    var serverSalt = context.RaiseEvent (".p5.auth.get-server-salt").Get<string> (context);
-
                     // Then salting password with user salt and system, before salting it with system salt
                     var userPasswordFingerprint = context.RaiseEvent ("p5.crypto.hash.create-sha256", new Node ("", serverSalt + password)).Get<string> (context);
                     authFile ["users"][username]["password"].Value = userPasswordFingerprint;


Allow null NSImage argument to NSTableView.SetIndicatorImage() to remove any previously set image for the specified column

--- src/appkit.cs
+++ src/appkit.cs
@@ -11179,7 +11179,7 @@
 		int ClickedRow { get; }

 		[Export ("setIndicatorImage:inTableColumn:")]
-		void SetIndicatorImage (NSImage anImage, NSTableColumn tableColumn);
+		void SetIndicatorImage ([NullAllowed] NSImage anImage, NSTableColumn tableColumn);

 		[Export ("indicatorImageInTableColumn:")]
 		NSImage GetIndicatorImage (NSTableColumn tableColumn);


removed some namespaces

removed some namespaces

--- src/ftx/ProgramOptions.cs
+++ src/ftx/ProgramOptions.cs
@@ -1,6 +1,4 @@
-using SecurityDriven.Inferno;
-using SecurityDriven.Inferno.Kdf;
-using System;
+using System;
 using System.IO;
 using System.IO.Compression;
 using System.Linq;


TeaTime 0.6 alpha

TeaTime 0.6 alpha

--- TeaTime.cs
+++ TeaTime.cs
@@ -1,4 +1,4 @@
-// TeaTime v0.5.9 alpha
+// TeaTime v0.6 alpha

 // By Andrés Villalobos [andresalvivar@gmail.com twitter.com/matnesis]
 // Special thanks to Antonio Zamora [twitter.com/tzamora] for the loop idea and testing.
@@ -160,7 +160,7 @@

     /// <summary>
     /// Main queue for all the timed callbacks.
-    /// #todo This can be optimized by using blueprints, maybe.
+    /// #todo This can be optimized by using blueprints (below), maybe.
     /// </summary>
     private static Dictionary<MonoBehaviour, Dictionary<string, List<ttTask>>> mainQueue = null;

@@ -170,22 +170,22 @@
     private static Dictionary<MonoBehaviour, Dictionary<string, List<ttTask>>> blueprints = null;

     /// <summary>
+    /// Current queue.
+    /// </summary>
+    private static Dictionary<MonoBehaviour, string> currentQueueName = null;
+
+    /// <summary>
     /// Queues currently running.
     /// </summary>
     private static Dictionary<MonoBehaviour, List<string>> runningQueues = null;

     /// <summary>
-    /// Current queue.
-    /// </summary>
-    private static Dictionary<MonoBehaviour, string> currentQueueName = null;
-
-    /// <summary>
-    /// Locked queues, by ttLock().
+    /// Locked queues by ttLock().
     /// </summary>
     private static Dictionary<MonoBehaviour, List<string>> lockedQueues = null;

     /// <summary>
-    /// Infinite queues, by ttRepeat(-1).
+    /// Infinite queues by ttRepeat(-1).
     /// </summary>
     private static Dictionary<MonoBehaviour, List<string>> infiniteQueues = null;

@@ -227,19 +227,6 @@

     /// <summary>
-    /// Prepares the dictionary for the queues running in the instance.
-    /// </summary>
-    private static void PrepareRunningQueues(MonoBehaviour instance)
-    {
-        if (runningQueues == null)
-            runningQueues = new Dictionary<MonoBehaviour, List<string>>();
-
-        if (runningQueues.ContainsKey(instance) == false)
-            runningQueues.Add(instance, new List<string>());
-    }
-
-
-    /// <summary>
     /// Prepares the dictionary for the current queue (last used) in the instance.
     /// </summary>
     private static void PrepareCurrentQueueName(MonoBehaviour instance)
@@ -254,6 +241,19 @@

     /// <summary>
+    /// Prepares the dictionary for the queues running in the instance.
+    /// </summary>
+    private static void PrepareRunningQueues(MonoBehaviour instance)
+    {
+        if (runningQueues == null)
+            runningQueues = new Dictionary<MonoBehaviour, List<string>>();
+
+        if (runningQueues.ContainsKey(instance) == false)
+            runningQueues.Add(instance, new List<string>());
+    }
+
+
+    /// <summary>
     /// Prepares the dictionary for the queues locked in the instance.
     /// </summary>
     private static void PrepareLockedQueues(MonoBehaviour instance)
@@ -535,7 +535,7 @@

     /// <summary>
-    /// Locks the current queue ignoring new appends until all his callbacks are done (locks until completion).
+    /// Locks the current queue ignoring new appends until all his callbacks are completed (i.e. WaitForCompletion).
     /// </summary>
     public static MonoBehaviour ttLock(this MonoBehaviour instance)
     {
@@ -558,7 +558,7 @@
     /// <summary>
     /// Repeat the current queue n times or infinite (n <= -1).
     /// </summary>
-    public static MonoBehaviour ttRepeat(this MonoBehaviour instance, int nTimes = 1)
+    public static MonoBehaviour ttRepeat(this MonoBehaviour instance, int n = 1)
     {
         PrepareCurrentQueueName(instance);

@@ -574,7 +574,7 @@
             return instance;

         // If infinite
-        if (nTimes < 0)
+        if (n < 0)
         {
             instance.tt(currentQueueName[instance]).ttLock();

@@ -587,7 +587,7 @@
         }

         // Repeat n
-        while (nTimes-- > 0)
+        while (n-- > 0)
         {
             mainQueue[instance][currentQueueName[instance]].AddRange(blueprints[instance][currentQueueName[instance]]);
         }
@@ -604,7 +604,7 @@
     public static MonoBehaviour tt(this MonoBehaviour instance, string queueName = null, bool resetQueue = false)
     {
         if (queueName == null)
-            queueName = DEFAULT_QUEUE_NAME + "_" + Time.time + "_" + UnityEngine.Random.Range(0, int.MaxValue);
+            queueName = DEFAULT_QUEUE_NAME + Time.time + UnityEngine.Random.Range(0, int.MaxValue);

         PrepareCurrentQueueName(instance);
         currentQueueName[instance] = queueName;
@@ -643,7 +643,7 @@
         if (infiniteQueues[instance].Contains(queueName))
             infiniteQueues[instance].Remove(queueName);

-        // Stop coroutines & clean
+        // Stop & clean coroutines
         foreach (IEnumerator coroutine in runningCoroutines[instance][queueName])
         {
             instance.StopCoroutine(coroutine);
@@ -674,7 +674,7 @@
         lockedQueues[instance].Clear();
         infiniteQueues[instance].Clear();

-        // Stop coroutines & clean
+        // Stop & clean coroutines
         foreach (KeyValuePair<string, List<IEnumerator>> coroutineList in runningCoroutines[instance])
         {
             foreach (IEnumerator coroutine in coroutineList.Value)
@@ -741,7 +741,7 @@
             }
         }

-        // Stop all coroutines & clean
+        // Stop & clean all coroutines
         if (runningCoroutines != null)
         {
             foreach (KeyValuePair<MonoBehaviour, Dictionary<string, List<IEnumerator>>> instanceDict in runningCoroutines)
@@ -820,23 +820,23 @@
         // The queue has stopped
         runningQueues[instance].Remove(queueName);

-        // Try again is there are new items, or
+        // Try again is there are new items
         if (mainQueue[instance][queueName].Count > 0)
         {
             instance.StartCoroutine(ExecuteQueue(instance, queueName));
         }
         else
         {
-            // If empty, repeat if the queue is infinite
-            if (IsInfinite(instance, queueName) == true)
+            // If empty, repeat if infinite
+            if (IsInfinite(instance, queueName))
             {
                 mainQueue[instance][queueName].AddRange(blueprints[instance][queueName]);
                 instance.StartCoroutine(ExecuteQueue(instance, queueName));
             }
             else
             {
-                // Remove the lock on non infinite queues
-                if (IsLocked(instance, queueName) == true)
+                // Queue completed, remove the lock
+                if (IsLocked(instance, queueName))
                     lockedQueues[instance].Remove(queueName);
             }
         }


Beginnings of an OpenSSH handler.

Beginnings of an OpenSSH handler.

--- ssh-handler/ssh-handler.cs
+++ ssh-handler/ssh-handler.cs
@@ -54,7 +54,7 @@
     {
         foreach (string location in Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator))
         {
-            string path = Path.Combine(location, "putty.exe");
+            string path = Path.Combine(location, program);
             if (File.Exists(path))
                 return path;
         }
@@ -94,11 +94,11 @@
     public bool Find()
     {
         if (path != null)
-            goto found;
-
-        foreach (RegistryHive hive in new RegistryHive[] { RegistryHive.CurrentUser, RegistryHive.LocalMachine })
-        {
-            IList<RegistryView> views = new List<RegistryView>(new RegistryView[] { RegistryView.Registry32 });
+            goto Found;
+
+        foreach (var hive in new RegistryHive[] { RegistryHive.CurrentUser, RegistryHive.LocalMachine })
+        {
+            var views = new List<RegistryView>(new RegistryView[] { RegistryView.Registry32 });
             if (Environment.Is64BitOperatingSystem)
                 views.Insert(0, RegistryView.Registry64);

@@ -113,7 +113,7 @@
                         if (File.Exists(path))
                         {
                             Debug.WriteLine("Found PuTTY in registry: {0}", path, null);
-                            goto found;
+                            goto Found;
                         }
                         else
                             path = null;
@@ -123,12 +123,12 @@
         if ((path = FindInPath("putty.exe")) != null)
         {
             Debug.WriteLine("Found PuTTY in path: {0}", path, null);
-            goto found;
+            goto Found;
         }

         return false;

-    found:
+    Found:
         path = path.Trim();
         return true;
     }
@@ -152,14 +152,106 @@
     }
 }

+public class Openssh : FindInPathMixin, Handler
+{
+    private Regex option = new Regex(@"^(?:/|--?)openssh(?:[:=](?<openssh_path>.*))?$", RegexOptions.IgnoreCase);
+    private string path = null;
+
+    public IList<string> Usages
+    {
+        get
+        {
+            return new string[]
+            {
+                "/openssh[:<openssh-path>] -- Use OpenSSH to connect",
+            };
+        }
+    }
+
+    public Option DoMatch(string arg)
+    {
+        Match match;
+
+        if ((match = option.Match(arg)).Success)
+        {
+            Group group = match.Groups["openssh_path"];
+            if (group.Success)
+                path = group.Value;
+            return Option.Set;
+        }
+        else
+            return Option.None;
+    }
+
+    public bool Find()
+    {
+        if (path != null)
+            goto Found;
+
+        foreach (var hive in new RegistryHive[] { RegistryHive.CurrentUser, RegistryHive.LocalMachine })
+        {
+            var views = new List<RegistryView>(new RegistryView[] { RegistryView.Registry32 });
+            if (Environment.Is64BitOperatingSystem)
+                views.Insert(0, RegistryView.Registry64);
+
+            foreach (RegistryView view in views)
+                using (RegistryKey baseKey = RegistryKey.OpenBaseKey(hive, view), key = baseKey.OpenSubKey(@"SOFTWARE\Cygwin\setup"))
+                    if (key != null)
+                    {
+                        string location = (string)key.GetValue("rootdir");
+                        if (location == null)
+                            continue;
+                        path = Path.Combine(location, "bin", "ssh.exe");
+                        if (File.Exists(path))
+                        {
+                            Debug.WriteLine("Found OpenSSH in registry: {0}", path, null);
+                            goto Found;
+                        }
+                        else
+                            path = null;
+                    }
+        }
+
+        if ((path = FindInPath("ssh.exe")) != null)
+        {
+            Debug.WriteLine("Found OpenSSH in path: {0}", path, null);
+            goto Found;
+        }
+
+        return false;
+
+    Found:
+        path = path.Trim();
+        return true;
+    }
+
+    public void Execute(Uri uri, string user, string password)
+    {
+        if (!Find())
+            throw new Exception("Could not find OpenSSH executable.");
+
+        StringBuilder args = new StringBuilder();
+        if (password != null)
+            Debug.WriteLine("Warning: OpenSSH does not support passing a password!");
+        if (uri.Port != -1)
+            args.AppendFormat("-p {0} ", uri.Port);
+        if (user != null)
+            args.AppendFormat("{0}@", user);
+        args.Append(uri.Host);
+
+        Debug.WriteLine("Running OpenSSH command: {0} {1}", path, args);
+        Process.Start(path, args.ToString());
+    }
+}
+
 public class SshHandler
 {
     private static IList<Handler> handlers = new Handler[]
     {
         new Putty(),
+        new Openssh(),
     };
     private static Handler handler = null;
-    private static string puttyPath = null;

     public static int Main(string[] args)
     {
@@ -220,6 +312,7 @@
             switch (handler.DoMatch(arg))
             {
             case Option.Set:
+                Debug.WriteLine("Setting handler: {0}", handler, null);
                 SshHandler.handler = handler;
                 goto case Option.Optional;
             case Option.Optional:


Update Vector4.cs

Update Vector4.cs

Optimized normalization.

--- Vector4.cs
+++ Vector4.cs
@@ -734,10 +734,13 @@

         public static void Normalize(ref Vector4 value, out Vector4 result)
         {
-            result = value;
-            if (value == ZERO) return;
-            float lengthInverse = 1.0f / value.Length();
-            if (lengthInverse < FMath.EPSILON) return;
+            float lengthSq = value.LengthSq();
+            if (lengthSq < FMath.EPSILON)
+            {
+                result = ZERO;
+                return;
+            }
+            float lengthInverse = 1.0f / FMath.Sqrt(lengthSq);
             result = new Vector4(value.X * lengthInverse, value.Y * lengthInverse, value.Z * lengthInverse, value.W * lengthInverse);
         }
         public static Vector4 Normalize(ref Vector4 value)


Version bump to 3.1.6.1 [TGSDeploy]

Version bump to 3.1.6.1 [TGSDeploy]

--- Version.cs
+++ Version.cs
@@ -12,6 +12,6 @@
 // [assembly: AssemblyVersion("1.0.*")]

 //It's impossible to make these a define, don't say I didn't warn you
-[assembly: AssemblyVersion("3.1.6.0")]
-[assembly: AssemblyFileVersion("3.1.6.0")]
-[assembly: AssemblyInformationalVersion("3.1.6.0")]
+[assembly: AssemblyVersion("3.1.6.1")]
+[assembly: AssemblyFileVersion("3.1.6.1")]
+[assembly: AssemblyInformationalVersion("3.1.6.1")]


Adds Json.Clone<T>(object o) that reflects the object and creates a new T using the data reflected from the object.

--- XtoJSON.cs
+++ XtoJSON.cs
@@ -57,7 +57,7 @@
 /// <summary> Quick access to Json parsing and reflection </summary>
 public static class Json {
 	/// <summary> Current version of library </summary>
-	public const string VERSION = "0.6.1";
+	public const string VERSION = "0.6.2";

 	/// <summary> Parse a json string into its JsonValue representation. </summary>
 	public static JsonValue Parse(string json) {
@@ -114,6 +114,17 @@
 		return GetValue<T>(val);
 	}

+	/// <summary>
+	/// Creates a clone of the object by reflecting its internal values, and constructing a new object
+	/// using the same values.
+	/// </summary>
+	/// <typeparam name="T">Type of object to get back</typeparam>
+	/// <param name="o">Source data to use</param>
+	/// <returns>A T object with the data provided by o</returns>
+	public static T Clone<T>(object o) {
+		JsonValue val = Reflect(o);
+		return GetValue<T>(val);
+	}

 	/// <summary> Get the expected type of the reflection of a code object. </summary>
 	public static JsonType ReflectedType(object o) {


Adds standard `XJS.Parse` method for creating program trees from source text

--- XJS/XJS.cs
+++ XJS/XJS.cs
@@ -7,7 +7,16 @@

 /// <summary> Container class for XJS language </summary>
 public static partial class XJS {
-
+
+	/// <summary> Parses program text into a tree representing the program </summary>
+	/// <param name="script"> Text of program to parse </param>
+	/// <returns> Node holding entire parsed program tree </returns>
+	public static Node Parse(string script) {
+		script = XJSHelpers.StripCStyleComments(script);
+		Tokenizer tokenizer = new Tokenizer(script);
+		return ParseProgram(tokenizer);
+	}
+
 	#region Constant type stuff
 	/// <summary> Keywords of the language </summary>
 	public static readonly string[] keywords = {


one way inference

one way inference

--- src/csharp/start-video.cs
+++ src/csharp/start-video.cs
@@ -20,7 +20,7 @@
     var conversation = GetConversation();
     var avModality = ((AVModality)conversation.Modalities[ModalityTypes.AudioVideo]);

-    var handler = (sender, e) => {
+    EventHandler<ModalityStateChangedEventArgs> handler = (sender, e) => {
       if (e.NewState != ModalityState.Connected) return;
       avModality.ModalityStateChanged -= handler;
       tcs.TrySetResult(true);


If the first lock doesn't succeed... lock, lock, and lock again?

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@999 52acb1d6-8a22-11de-b505-999d5b087335

--- libsecondlife-cs/InventorySystem/InventoryManager.cs
+++ libsecondlife-cs/InventorySystem/InventoryManager.cs
@@ -139,7 +139,10 @@
         private void ClearState()
         {
             FoldersByUUID.Clear();
-            FolderDownloadStatus.Clear();
+            lock (FolderDownloadStatus)
+            {
+                FolderDownloadStatus.Clear();
+            }
             alFolderRequestQueue.Clear();

             if (slClient.Self.InventoryRootFolderUUID != null)
@@ -647,8 +650,10 @@
         /// <param name="dr"></param>
         internal void RequestFolder(DownloadRequest_Folder dr)
         {
-
-            FolderDownloadStatus[dr.FolderID] = dr;
+            lock (FolderDownloadStatus)
+            {
+                FolderDownloadStatus[dr.FolderID] = dr;
+            }

             Packet packet = InvPacketHelper.FetchInventoryDescendents(
                             dr.FolderID
@@ -815,7 +820,18 @@
             LLUUID uuidFolderID = reply.AgentData.FolderID;

             // Get the original Descendent Request for this Packet
-            DownloadRequest_Folder dr = (DownloadRequest_Folder)FolderDownloadStatus[uuidFolderID];
+            DownloadRequest_Folder dr = null;
+            lock (FolderDownloadStatus)
+            {
+                if (FolderDownloadStatus.ContainsKey(uuidFolderID))
+                {
+                    dr = (DownloadRequest_Folder)FolderDownloadStatus[uuidFolderID];
+                }
+                else
+                {
+                    slClient.Log("Received an inventory descendent packet for a folder that was not in FolderDownloadStatus.", Helpers.LogLevel.Info);
+                }
+            }

             // Get the Inventory folder that we'll be updating
             InventoryFolder InvFolderUpdating = (InventoryFolder)FoldersByUUID[uuidFolderID];
@@ -988,7 +1004,10 @@
                 {
                     // Looks like after updating, we have all the descendents,
                     // remove from folder status.
-                    FolderDownloadStatus.Remove(uuidFolderID);
+                    lock (FolderDownloadStatus)
+                    {
+                        FolderDownloadStatus.Remove(uuidFolderID);
+                    }
                     dr.RequestComplete.Set();
                     if (OnRequestDownloadFinishedEvent != null)
                     {


- Issue #260: Double Entry Point Definition

--- src/cscs/ScriptParser.cs
+++ src/cscs/ScriptParser.cs
@@ -33,12 +33,15 @@
         }

         /// <summary>
-        /// Processes the imported script. Processing involves lookup for 'static Main' and renaming it so it does not
-        /// interfere with the 'static Main' of the primary script. After renaming is done the new content is saved in the
-        /// CS-Script cache and the new file location is returned. The saved file can be used late as an "included script".
-        /// This technique can be from 'precompiler' scripts.
-        /// <para>If the script file does not require renaming (static Main is not present) the method returns the
-        /// original script file location.</para>
+        /// Processes the imported script. Processing involves lookup for 'static Main' and renaming
+        /// it so it does not interfere with the 'static Main' of the primary script. After renaming
+        /// is done the new content is saved in the CS-Script cache and the new file location is
+        /// returned. The saved file can be used late as an "included script". This technique can be
+        /// from 'precompiler' scripts.
+        /// <para>
+        /// If the script file does not require renaming (static Main is not present) the method
+        /// returns the original script file location.
+        /// </para>
         /// </summary>
         /// <param name="scriptFile">The script file.</param>
         /// <returns>Path to the script file to be compiled and executed</returns>
@@ -94,12 +97,18 @@

         /// <summary>
         /// Resolves the NuGet packages into assemblies to be referenced by the script.
-        /// <para>If the package was never installed/downloaded yet CS-Script runtime will try to download it.</para>
-        /// <para>CS-Script will also analyze the installed package structure in try to reference compatible assemblies
-        /// from the package.</para>
-        /// </summary>
-        /// <param name="suppressDownloading">if set to <c>true</c> suppresses downloading the NuGet package.
-        /// Suppressing can be useful for the quick 'referencing' assessment.</param>
+        /// <para>
+        /// If the package was never installed/downloaded yet CS-Script runtime will try to download it.
+        /// </para>
+        /// <para>
+        /// CS-Script will also analyze the installed package structure in try to reference
+        /// compatible assemblies from the package.
+        /// </para>
+        /// </summary>
+        /// <param name="suppressDownloading">
+        /// if set to <c>true</c> suppresses downloading the NuGet package. Suppressing can be
+        /// useful for the quick 'referencing' assessment.
+        /// </param>
         /// <returns>Collection of the referenced assembly files.</returns>
         public string[] ResolvePackages(bool suppressDownloading = false)
         {
@@ -116,7 +125,8 @@
         public string[] Packages => packages.ToArray();

         /// <summary>
-        /// Collection of referenced assemblies. All assemblies are referenced either from command-line, code or resolved from referenced namespaces.
+        /// Collection of referenced assemblies. All assemblies are referenced either from
+        /// command-line, code or resolved from referenced namespaces.
         /// </summary>
         public string[] ReferencedAssemblies => referencedAssemblies.ToArray();

@@ -133,7 +143,7 @@
         /// Constructor.
         /// </summary>
         /// <param name="fileName">Script file name</param>
-        /// <param name="searchDirs">Extra ScriptLibrary directory </param>
+        /// <param name="searchDirs">Extra ScriptLibrary directory</param>
         public ScriptParser(string fileName, string[] searchDirs)
         {
             //if ((CSExecutor.ExecuteOptions.options != null && CSExecutor.options.useSmartCaching) && CSExecutor.ScriptCacheDir == "") //in case if ScriptParser is used outside of the script engine
@@ -146,8 +156,10 @@
         /// Constructor.
         /// </summary>
         /// <param name="fileName">Script file name</param>
-        /// <param name="searchDirs">Extra ScriptLibrary directory(s) </param>
-        /// <param name="throwOnError">flag to indicate if the file parsing/processing error should raise an exception</param>
+        /// <param name="searchDirs">Extra ScriptLibrary directory(s)</param>
+        /// <param name="throwOnError">
+        /// flag to indicate if the file parsing/processing error should raise an exception
+        /// </param>
         public ScriptParser(string fileName, string[] searchDirs, bool throwOnError)
         {
             this.throwOnError = throwOnError;
@@ -165,16 +177,14 @@
         /// <summary>
         /// Gets a value indicating whether the script being parsed is a web application script.
         /// </summary>
-        /// <value>
-        ///   <c>true</c> if the script is web application; otherwise, <c>false</c>.
-        /// </value>
+        /// <value><c>true</c> if the script is web application; otherwise, <c>false</c>.</value>
         public bool IsWebApp => this.fileParsers.FirstOrDefault()?.IsWebApp == true;

         /// <summary>
         /// Initialization of ScriptParser instance
         /// </summary>
         /// <param name="fileName">Script file name</param>
-        /// <param name="searchDirs">Extra ScriptLibrary directory(s) </param>
+        /// <param name="searchDirs">Extra ScriptLibrary directory(s)</param>

         void Init(string fileName, string[] searchDirs)
         {
@@ -247,7 +257,9 @@

                         this.fileParsers.Add(importedFile);
                         this.fileParsers.Sort(fileComparer);
-                        importedFile.fileNameImported = importedFile.fileName;
+
+                        if (importedFile.fileNameImported.IsEmpty())
+                            importedFile.fileNameImported = importedFile.fileName;

                         foreach (string namespaceName in importedFile.ReferencedNamespaces)
                             PushNamespace(namespaceName);
@@ -409,11 +421,13 @@
         }

         /// <summary>
-        /// Aggregates the references from the script and its imported scripts. It is a logical equivalent of CSExecutor.AggregateReferencedAssemblies
-        /// but optimized for later .NET versions (e.g LINQ) and completely decoupled. Thus it has no dependencies on internal state
-        /// (e.g. settings, options.shareHostAssemblies).
-        /// <para>It is the method to call for generating list of ref asms as part of the project info.</para>
-        ///
+        /// Aggregates the references from the script and its imported scripts. It is a logical
+        /// equivalent of CSExecutor.AggregateReferencedAssemblies but optimized for later .NET
+        /// versions (e.g LINQ) and completely decoupled. Thus it has no dependencies on internal
+        /// state (e.g. settings, options.shareHostAssemblies).
+        /// <para>
+        /// It is the method to call for generating list of ref asms as part of the project info.
+        /// </para>
         /// </summary>
         /// <param name="searchDirs">The search dirs.</param>
         /// <param name="defaultRefAsms">The default ref asms.</param>
@@ -428,7 +442,8 @@
             var refCodeAsms = this.ReferencedAssemblies
                                   .SelectMany(asm => AssemblyResolver.FindAssembly(asm.Replace("\"", ""), probingDirs)).ToArray();

-            // need to add default CLR assemblies as there will be no namespace->GAC assembly resolving as it is .NET Core
+            // need to add default CLR assemblies as there will be no namespace->GAC assembly
+            // resolving as it is .NET Core
             var clrDefaultAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName.StartsWith("System.")).Select(x => x.Location).ToArray();

             var refAsms = refPkAsms.Union(refPkAsms)
@@ -473,10 +488,8 @@
             {
                 try
                 {
-                    // need to ensure that item has extension in order to avoid interpreting
-                    // complex file names as simple name + extension:
-                    // System.Core -> System
-                    // System.dll  -> System
+                    // need to ensure that item has extension in order to avoid interpreting complex
+                    // file names as simple name + extension: System.Core -> System System.dll -> System
                     string name = item.GetFileNameWithoutExtension();
                     if (!asmNames.Contains(name))
                     {


Enabling test to run with the KB 957542 hotfix

git-svn-id: 6eea8ec865c4fa60105bc56808c028bdcf72a817@1687 079b0acf-d9fa-0310-9935-e5ade295c882

--- rhino-mocks/Rhino.Mocks.Tests/FieldsProblem/FieldProblem_MichaelR.cs
+++ rhino-mocks/Rhino.Mocks.Tests/FieldsProblem/FieldProblem_MichaelR.cs
@@ -53,8 +53,12 @@
 			methodOptions.Do((MyDelegate)delegate { return new object(); });
 		}

+		/// <summary>
+		/// If this fails with Execution Engine Exception, you need to install the hotfix
+		/// for KB 957542.
+		/// There is a bug in .Net 3.5 SP1 that this test exposes.
+		/// </summary>
 		[Test]
-		[Ignore("Ignoring for now because of framework bug in SP1: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361606")]
 		public void DoubleGeneric()
 		{
 			MockRepository mocks = new MockRepository();


Add test for static constructors

Add test for static constructors

--- src/Compilers/CSharp/Test/Symbol/Compilation/GetSemanticInfoTests.cs
+++ src/Compilers/CSharp/Test/Symbol/Compilation/GetSemanticInfoTests.cs
@@ -5794,20 +5794,20 @@
             var file1 = @"
 partial class C
 {
-    C() {}
+    static C() {}
 }
 ";

             var file2 = @"
 partial class C
 {
-    C() {}
+    static C() {}
 }
 ";
             var file3 = @"
 partial class C
 {
-    C() {}
+    static C() {}
 }
 ";

@@ -5822,6 +5822,50 @@
             model1.GetDeclarationDiagnostics().Verify();

             model2.GetDeclarationDiagnostics().Verify(
+                // (4,12): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types
+                Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 12));
+
+            model3.GetDeclarationDiagnostics().Verify(
+                // (4,12): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types
+                Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 12));
+
+            Assert.Equal(3, comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").StaticConstructors.Length);
+        }
+
+        [Fact]
+        public void PartialTypeDiagnostics_Constructors()
+        {
+            var file1 = @"
+partial class C
+{
+    C() {}
+}
+";
+
+            var file2 = @"
+partial class C
+{
+    C() {}
+}
+";
+            var file3 = @"
+partial class C
+{
+    C() {}
+}
+";
+
+            var tree1 = Parse(file1);
+            var tree2 = Parse(file2);
+            var tree3 = Parse(file3);
+            var comp = CreateCompilation(new[] { tree1, tree2, tree3 });
+            var model1 = comp.GetSemanticModel(tree1);
+            var model2 = comp.GetSemanticModel(tree2);
+            var model3 = comp.GetSemanticModel(tree3);
+
+            model1.GetDeclarationDiagnostics().Verify();
+
+            model2.GetDeclarationDiagnostics().Verify(
                 // (4,5): error CS0111: Type 'C' already defines a member called 'C' with the same parameter types
                 Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "C").WithArguments("C", "C").WithLocation(4, 5));

@@ -5831,7 +5875,6 @@

             Assert.Equal(3, comp.GlobalNamespace.GetMember<NamedTypeSymbol>("C").InstanceConstructors.Length);
         }
-

         [WorkItem(1076661, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1076661")]
         [Fact]


Removed nullable

Removed nullable

--- src/DatenMeister/Modules/Forms/FormCreator/FormCreator.ExtentForm.cs
+++ src/DatenMeister/Modules/Forms/FormCreator/FormCreator.ExtentForm.cs
@@ -246,6 +246,9 @@
         /// <returns>Created Extent form as MofObject</returns>
         public IElement CreateExtentFormForObject(IObject element, IExtent extent, CreationMode creationMode)
         {
+            if (_workspaceLogic == null)
+                throw new InvalidOperationException("WorkspaceLogic is null");
+
             var cache = new FormCreatorCache();

             var extentForm = _factory.create(_formAndFields.__ExtentForm);


Reorder using statements in FluentAction class

--- src/ExplicitlyImpl.AspNetCore.Mvc.FluentActions.Core/FluentAction.cs
+++ src/ExplicitlyImpl.AspNetCore.Mvc.FluentActions.Core/FluentAction.cs
@@ -239,41 +239,17 @@
             return new FluentAction<TP, TR, TU1>(Definition, usingDefinition);
         }

-        public virtual FluentAction<TP, TR, TP> UsingParent()
-        {
-            return new FluentAction<TP, TR, TP>(Definition, new FluentActionUsingParentDefinition
-            {
-                Type = typeof(TR)
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TP2> UsingParent<TP2>()
-        {
-            return new FluentAction<TP, TR, TP2>(Definition, new FluentActionUsingParentDefinition
-            {
-                Type = typeof(TP2)
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TR> UsingResult()
-        {
-            return new FluentAction<TP, TR, TR>(Definition, new FluentActionUsingResultDefinition
-            {
-                Type = typeof(TR)
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingService<TU1>()
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingServiceDefinition
+        public virtual FluentAction<TP, TR, TU1> UsingBody<TU1>()
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingBodyDefinition
             {
                 Type = typeof(TU1)
             });
         }

-        public virtual FluentAction<TP, TR, TU1> UsingService<TU1>(TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingServiceDefinition
+        public virtual FluentAction<TP, TR, TU1> UsingBody<TU1>(TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingBodyDefinition
             {
                 Type = typeof(TU1),
                 HasDefaultValue = true,
@@ -281,18 +257,74 @@
             });
         }

-        public virtual FluentAction<TP, TR, TU1> UsingRouteParameter<TU1>(string name)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingRouteParameterDefinition
+        public virtual FluentAction<TP, TR, TU1> UsingForm<TU1>()
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormDefinition
+            {
+                Type = typeof(TU1)
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingForm<TU1>(TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormDefinition
             {
                 Type = typeof(TU1),
-                Name = name
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingRouteParameter<TU1>(string name, TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingRouteParameterDefinition
+                HasDefaultValue = true,
+                DefaultValue = defaultValue
+            });
+        }
+
+        public virtual FluentAction<TP, TR, IFormFile> UsingFormFile(string name)
+        {
+            return new FluentAction<TP, TR, IFormFile>(Definition, new FluentActionUsingFormFileDefinition
+            {
+                Type = typeof(IFormFile),
+                Name = name
+            });
+        }
+
+        public virtual FluentAction<TP, TR, IEnumerable<IFormFile>> UsingFormFiles(string name)
+        {
+            return new FluentAction<TP, TR, IEnumerable<IFormFile>>(Definition, new FluentActionUsingFormFilesDefinition
+            {
+                Type = typeof(IEnumerable<IFormFile>),
+                Name = name
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingFormValue<TU1>(string key)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormValueDefinition
+            {
+                Type = typeof(TU1),
+                Key = key
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingFormValue<TU1>(string key, TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormValueDefinition
+            {
+                Type = typeof(TU1),
+                Key = key,
+                HasDefaultValue = true,
+                DefaultValue = defaultValue
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingHeader<TU1>(string name)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingHeaderParameterDefinition
+            {
+                Type = typeof(TU1),
+                Name = name
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingHeader<TU1>(string name, TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingHeaderParameterDefinition
             {
                 Type = typeof(TU1),
                 Name = name,
@@ -301,117 +333,11 @@
             });
         }

-        public virtual FluentAction<TP, TR, TU1> UsingQueryStringParameter<TU1>(string name)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingQueryStringParameterDefinition
-            {
-                Type = typeof(TU1),
-                Name = name
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingQueryStringParameter<TU1>(string name, TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingQueryStringParameterDefinition
-            {
-                Type = typeof(TU1),
-                Name = name,
-                HasDefaultValue = true,
-                DefaultValue = defaultValue
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingHeader<TU1>(string name)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingHeaderParameterDefinition
-            {
-                Type = typeof(TU1),
-                Name = name
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingHeader<TU1>(string name, TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingHeaderParameterDefinition
-            {
-                Type = typeof(TU1),
-                Name = name,
-                HasDefaultValue = true,
-                DefaultValue = defaultValue
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingBody<TU1>()
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingBodyDefinition
-            {
-                Type = typeof(TU1)
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingBody<TU1>(TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingBodyDefinition
-            {
-                Type = typeof(TU1),
-                HasDefaultValue = true,
-                DefaultValue = defaultValue
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingForm<TU1>()
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormDefinition
-            {
-                Type = typeof(TU1)
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingForm<TU1>(TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormDefinition
-            {
-                Type = typeof(TU1),
-                HasDefaultValue = true,
-                DefaultValue = defaultValue
-            });
-        }
-
-        public virtual FluentAction<TP, TR, IFormFile> UsingFormFile(string name)
-        {
-            return new FluentAction<TP, TR, IFormFile>(Definition, new FluentActionUsingFormFileDefinition
-            {
-                Type = typeof(IFormFile),
-                Name = name
-            });
-        }
-
-        public virtual FluentAction<TP, TR, IEnumerable<IFormFile>> UsingFormFiles(string name)
-        {
-            return new FluentAction<TP, TR, IEnumerable<IFormFile>>(Definition, new FluentActionUsingFormFilesDefinition
-            {
-                Type = typeof(IEnumerable<IFormFile>),
-                Name = name
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingFormValue<TU1>(string key)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormValueDefinition
-            {
-                Type = typeof(TU1),
-                Key = key
-            });
-        }
-
-        public virtual FluentAction<TP, TR, TU1> UsingFormValue<TU1>(string key, TU1 defaultValue)
-        {
-            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingFormValueDefinition
-            {
-                Type = typeof(TU1),
-                Key = key,
-                HasDefaultValue = true,
-                DefaultValue = defaultValue
+        public virtual FluentAction<TP, TR, HttpContext> UsingHttpContext()
+        {
+            return new FluentAction<TP, TR, HttpContext>(Definition, new FluentActionUsingHttpContextDefinition
+            {
+                Type = typeof(HttpContext)
             });
         }

@@ -445,11 +371,93 @@
             });
         }

-        public virtual FluentAction<TP, TR, HttpContext> UsingHttpContext()
-        {
-            return new FluentAction<TP, TR, HttpContext>(Definition, new FluentActionUsingHttpContextDefinition
-            {
-                Type = typeof(HttpContext)
+        public virtual FluentAction<TP, TR, TP> UsingParent()
+        {
+            return new FluentAction<TP, TR, TP>(Definition, new FluentActionUsingParentDefinition
+            {
+                Type = typeof(TR)
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TP2> UsingParent<TP2>()
+        {
+            return new FluentAction<TP, TR, TP2>(Definition, new FluentActionUsingParentDefinition
+            {
+                Type = typeof(TP2)
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingQueryStringParameter<TU1>(string name)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingQueryStringParameterDefinition
+            {
+                Type = typeof(TU1),
+                Name = name
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingQueryStringParameter<TU1>(string name, TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingQueryStringParameterDefinition
+            {
+                Type = typeof(TU1),
+                Name = name,
+                HasDefaultValue = true,
+                DefaultValue = defaultValue
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TR> UsingResult()
+        {
+            return new FluentAction<TP, TR, TR>(Definition, new FluentActionUsingResultDefinition
+            {
+                Type = typeof(TR)
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingRouteParameter<TU1>(string name)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingRouteParameterDefinition
+            {
+                Type = typeof(TU1),
+                Name = name
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingRouteParameter<TU1>(string name, TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingRouteParameterDefinition
+            {
+                Type = typeof(TU1),
+                Name = name,
+                HasDefaultValue = true,
+                DefaultValue = defaultValue
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingService<TU1>()
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingServiceDefinition
+            {
+                Type = typeof(TU1)
+            });
+        }
+
+        public virtual FluentAction<TP, TR, TU1> UsingService<TU1>(TU1 defaultValue)
+        {
+            return new FluentAction<TP, TR, TU1>(Definition, new FluentActionUsingServiceDefinition
+            {
+                Type = typeof(TU1),
+                HasDefaultValue = true,
+                DefaultValue = defaultValue
+            });
+        }
+
+        public virtual FluentAction<TP, TR, ITempDataDictionary> UsingTempData()
+        {
+            return new FluentAction<TP, TR, ITempDataDictionary>(Definition, new FluentActionUsingTempDataDefinition
+            {
+                Type = typeof(ITempDataDictionary)
             });
         }

@@ -466,14 +474,6 @@
             return new FluentAction<TP, TR, ViewDataDictionary>(Definition, new FluentActionUsingViewDataDefinition
             {
                 Type = typeof(ViewDataDictionary)
-            });
-        }
-
-        public virtual FluentAction<TP, TR, ITempDataDictionary> UsingTempData()
-        {
-            return new FluentAction<TP, TR, ITempDataDictionary>(Definition, new FluentActionUsingTempDataDefinition
-            {
-                Type = typeof(ITempDataDictionary)
             });
         }


Temporary workaround for TLS issue in computer vision API

--- src/IntelligentPx/IntelligentPx/PageModels/PhotoAnalysisPageModel.cs
+++ src/IntelligentPx/IntelligentPx/PageModels/PhotoAnalysisPageModel.cs
@@ -45,7 +45,13 @@

         private async void Analyze()
         {
-            AnalysisResult = await _computerVisionService.Analyze(Photo.Images.FullImage.HttpsUrl);
+            var url = ToHttp(Photo.Images.FullImage.HttpsUrl);  // ToHttp: Temoporary workaround for Analysis Service with specific TLS version/implementation
+            AnalysisResult = await _computerVisionService.Analyze(url);
+        }
+
+        private static string ToHttp(string httpsUrl)
+        {
+            return httpsUrl.Replace("https", "http");
         }
     }
 }


Checking if getting items from the POIStore results in exception

--- src/MobileApps/MyDriving/MyDriving/ViewModel/CurrentTripViewModel.cs
+++ src/MobileApps/MyDriving/MyDriving/ViewModel/CurrentTripViewModel.cs
@@ -291,7 +291,19 @@
                 Logger.Instance.Report(ex);
             }

-            List<POI> poiList = new List<POI>(await StoreManager.POIStore.GetItemsAsync(CurrentTrip.Id));
+            List<POI> poiList = new List<POI>();
+            try
+            {
+                poiList = new List<POI>(await StoreManager.POIStore.GetItemsAsync(CurrentTrip.Id));
+            }
+            catch (Exception ex)
+            {
+                //Intermittently, Sqlite will cause a crash for WinPhone saying "unable to set temporary directory"
+                //If this call fails, simply use an empty list of POIs
+                Logger.Instance.WriteLine("Unable to get POI Store Items.");
+                Logger.Instance.Report(ex);
+            }
+
             CurrentTrip.HardStops = poiList.Where(p => p.POIType == POIType.HardBrake).Count();
             CurrentTrip.HardAccelerations = poiList.Where(p => p.POIType == POIType.HardAcceleration).Count();


Bugfix - should be setting the value, not incrementing it

svn path=/trunk/bitsharp/; revision=108328

--- src/MonoTorrent/MonoTorrent.Client/PeerConnections/PeerIdInternal.cs
+++ src/MonoTorrent/MonoTorrent.Client/PeerConnections/PeerIdInternal.cs
@@ -528,7 +528,7 @@
         internal int HaveMessagesReceived
         {
             get { return this.haveMessagesReceived; }
-            set { this.haveMessagesReceived++; }
+            set { this.haveMessagesReceived = value; }
         }

         /// <summary>


Fix syntax

Fix syntax

--- src/Stormpath.AspNetCore.Middleware/Route/AbstractRouteMiddleware.cs
+++ src/Stormpath.AspNetCore.Middleware/Route/AbstractRouteMiddleware.cs
@@ -125,7 +125,7 @@

         private static string CreateFullUserAgent(HttpContext context)
         {
-            var userAgentBuilder = a(IFrameworkUserAgentBuilder)context.ApplicationServices.GetService(typeof(IFrameworkUserAgentBuilder));
+            var userAgentBuilder = (IFrameworkUserAgentBuilder)context.ApplicationServices.GetService(typeof(IFrameworkUserAgentBuilder));

             var callingAgent = string
                 .Join(" ", context.Request.Headers["X-Stormpath-Agent"])


Use ReflectionBasedSerializer for all serializers if any of mappings are soap mappings (#27803)

* Use ReflectionBasedSerializer for all serializers if any of mappings are soap mappings.

* Add check for deserialize.

--- src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs
+++ src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs
@@ -159,6 +159,7 @@
         internal string DefaultNamespace = null;
 #endif
         private Type _rootType;
+        private bool _isReflectionBasedSerializer = false;

         private static TempAssemblyCache s_cache = new TempAssemblyCache();
         private static volatile XmlSerializerNamespaces s_defaultNamespaces;
@@ -447,7 +448,7 @@
                     }
                     SerializePrimitive(xmlWriter, o, namespaces);
                 }
-                else if (ShouldUseReflectionBasedSerialization(_mapping))
+                else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
                 {
                     SerializeUsingReflection(xmlWriter, o, namespaces, encodingStyle, id);
                 }
@@ -587,7 +588,7 @@
                     }
                     return DeserializePrimitive(xmlReader, events);
                 }
-                else if (ShouldUseReflectionBasedSerialization(_mapping))
+                else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
                 {
                     return DeserializeUsingReflection(xmlReader, encodingStyle, events);
                 }
@@ -797,6 +798,7 @@
                 serializers[i] = new XmlSerializer();
                 serializers[i]._rootType = type;
                 serializers[i]._mapping = mappings[i];
+                serializers[i]._isReflectionBasedSerializer = true;
             }

             return serializers;


Test for fix of issue #3408

Test for fix of issue #3408

--- src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
+++ src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs
@@ -4092,6 +4092,20 @@
         });
     }

+    [Fact]
+    public static void DCS_ReadObject_XmlDictionaryReaderMaxStringContentLengthExceedsQuota()
+    {
+        DataContractSerializer dcs = new DataContractSerializer(typeof(TypeA));
+        int maxStringContentLength = 1024;
+        var type = new TypeA { Name = "BOOM!".PadLeft(maxStringContentLength + 1, ' ') };
+        MemoryStream ms = new MemoryStream();
+        dcs.WriteObject(ms, type);
+        ms.Position = 0;
+        XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(ms, new System.Xml.XmlDictionaryReaderQuotas() { MaxStringContentLength = maxStringContentLength });
+
+        Assert.Throws<System.Runtime.Serialization.SerializationException>(() => { dcs.ReadObject(reader); });
+    }
+
     private static T DeserializeString<T>(string stringToDeserialize, bool shouldReportDeserializationExceptions = true, DataContractSerializerSettings settings = null, Func<DataContractSerializer> serializerFactory = null)
     {
         DataContractSerializer dcs;


Add api to SecurityAlgorithmSuite.

Add api to SecurityAlgorithmSuite.

--- src/System.ServiceModel.Security/ref/System.ServiceModel.Security.cs
+++ src/System.ServiceModel.Security/ref/System.ServiceModel.Security.cs
@@ -126,6 +126,11 @@
         public abstract string DefaultAsymmetricSignatureAlgorithm { get; }
         public abstract int DefaultSignatureKeyDerivationLength { get; }
         public abstract int DefaultSymmetricKeyLength { get; }
+        public abstract bool IsSymmetricKeyLengthSupported(int length);
+        public abstract bool IsAsymmetricKeyLengthSupported(int length);
+        public static SecurityAlgorithmSuite Default { get; }
+        public static SecurityAlgorithmSuite Basic256 { get; }
+        internal static SecurityAlgorithmSuite Basic256Sha256 { get; }
     }
     public abstract partial class SecurityPolicyVersion
     {


Trying to add permissions to new queues that make sense instead of just the process owner.

Former-commit-id: b3ee68e77383ed99c672121654accd4bd584ff2e

--- src/Transports/MassTransit.Transports.Msmq/MsmqEndpointManagement.cs
+++ src/Transports/MassTransit.Transports.Msmq/MsmqEndpointManagement.cs
@@ -39,7 +39,10 @@

 			using (MessageQueue queue = MessageQueue.Create(_address.LocalName, transactional))
 			{
-				_log.Debug("A queue was created: " + _address + (transactional ? " (transactional)" : ""));
+				_log.Debug("A queue was created: " + _address + (transactional ? " (transactional)" : ""));
+
+                queue.SetPermissions("Administrators", MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
+                queue.SetPermissions("Everyone", MessageQueueAccessRights.WriteMessage, AccessControlEntryType.Allow);
 			}

 			VerifyQueueSendAndReceive();


[Code review] Simplified ValidationMandatory DeserializeConfiguration function.

--- src/formulate.app/Validations/Kinds/Mandatory/ValidationMandatory.cs
+++ src/formulate.app/Validations/Kinds/Mandatory/ValidationMandatory.cs
@@ -4,7 +4,6 @@
     // Namespaces.
     using core.Types;
     using Helpers;
-    using Newtonsoft.Json.Linq;
     using System;
     using System.Collections.Generic;
     using System.Linq;
@@ -50,21 +49,13 @@
         /// </returns>
         public object DeserializeConfiguration(string configuration, ValidationContext context)
         {
-            var config = new ValidationMandatoryConfiguration();
-            var configData = JsonHelper.Deserialize<JObject>(configuration);
-            var dynamicConfig = configData as dynamic;
-            var properties = configData.Properties().Select(x => x.Name);
-            var propertySet = new HashSet<string>(properties);
-            if (propertySet.Contains("message"))
+            var config = JsonHelper.Deserialize<ValidationMandatoryConfiguration>(configuration);
+
+            if (string.IsNullOrWhiteSpace(config.Message) == false)
             {
-                var message = dynamicConfig.message.Value as string;
-                config.Message = ValidationHelper.ReplaceMessageTokens(message, context);
+                config.Message = ValidationHelper.ReplaceMessageTokens(config.Message, context);
             }
-            if (propertySet.Contains("clientSideOnly"))
-            {
-                var clientSideOnly = dynamicConfig.clientSideOnly.Value as bool?;
-                config.ClientSideOnly = clientSideOnly.GetValueOrDefault();
-            }
+
             return config;
         }


Removing assertion that may be false

Removing assertion that may be false

--- src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs
+++ src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs
@@ -179,7 +179,6 @@
             s = await ProcessManager
                 .GetGitCreds(TestRepoMasterCleanSynchronized, Environment, GitEnvironment)
                 .StartAsAsync();
-            s.Should().NotBeNull();
         }
     }
 }


add additional log messages to arf/uwp workaround method

--- Assets/MixedRealityToolkit/Utilities/Editor/EditorProjectUtilities.cs
+++ Assets/MixedRealityToolkit/Utilities/Editor/EditorProjectUtilities.cs
@@ -128,6 +128,8 @@
         {
 #if !UNITY_2019_1_OR_NEWER

+            Debug.Log("Checking to see if the AR Foundation, UWP, .NET backend workaround needs to be applied.");
+
             bool reloadLocked = EditorAssemblyReloadManager.LockReloadAssemblies;
             if (reloadLocked)
             {
@@ -171,6 +173,10 @@
                     {
                         asmDef.Save(arFoundation.FullName);
                     }
+                    else
+                    {
+                        Debug.Log($"No changes required for {arFoundation.FullName}.");
+                    }
                 }

                 FileInfo arSubsystems = GetPackageCacheAssemblyDefinitionFile(
@@ -203,6 +209,10 @@
                     if (changed)
                     {
                         asmDef.Save(arSubsystems.FullName);
+                    }
+                    else
+                    {
+                        Debug.Log($"No changes required for {arSubsystems.FullName}.");
                     }
                 }
             }


added in all sensing probes and settings

--- ExampleSensingAgent.Shared/ExampleCapstoneAccelerationSensingAgent.cs
+++ ExampleSensingAgent.Shared/ExampleCapstoneAccelerationSensingAgent.cs
@@ -19,6 +19,7 @@
 using System.Linq;
 using Sensus;
 using Sensus.Probes.Movement;
+using Sensus.Probes.Location;
 using Sensus.Probes;
 using System.Threading;
 using Sensus.Extensions;
@@ -27,12 +28,8 @@
 namespace ExampleSensingAgent
 {
     /// <summary>
-    /// The sekeleton implementation for the capstone 2020 active sensing project
+    /// The sensing agent for the spring 2020 capstone active sensing project
     /// </summary>
-    /// <remarks>
-    /// TODO:
-    ///     (1) determine on/off sensor settings
-    /// </remarks>
     public class ExampleCapstoneAccelerationSensingAgent : SensingAgent
     {
         #region Private Classes
@@ -166,11 +163,10 @@
         /// <summary>
         /// Time during which the sensors are controlled by this class based on the results of the listening window and model
         /// </summary>
-        private TimeSpan PredictingWindow
+        private TimeSpan PredictingWindow
         {
             get
             {
-
                 return ControlCompletionCheckInterval;
             }

@@ -200,14 +196,69 @@
         /// The prediction threshold for determining if sensors should be turned on
         /// </summary>
         private double Threshold { get; set; }
+
+        /// <summary>
+        /// The data frequency at which data is recorded when a probe is under active control
+        /// </summary>
+        private int ProbeHz { get; set; }
+
+        /// <summary>
+        /// These are the probes that we'd like to turn on as part of the study
+        /// This list of probes came from Mehdi in an email
+        /// </summary>
+        private IEnumerable<IListeningProbe> Probes
+        {
+            get
+            {
+                IProbe probe;
+
+                //it is worth noting that there is a bug in TryGetProbe if it is called with a more specific interface than IProbe
+                //this is the reason why we pass in IProbe and then typecast to IListeningProbe after the probe is returned
+                if(Protocol.TryGetProbe<ILinearAccelerationDatum, IProbe>(out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+
+                if (Protocol.TryGetProbe<IAccelerometerDatum, IProbe>(out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+
+                if (Protocol.TryGetProbe<IGyroscopeDatum, IProbe>(out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+
+                if (Protocol.TryGetProbe<IAttitudeDatum, IProbe>(out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+
+                if (Protocol.TryGetProbe<IAltitudeDatum, IProbe>(out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+
+                if (Protocol.TryGetProbe<IMagnetometerDatum, IProbe> (out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+
+                if (Protocol.TryGetProbe<ICompassDatum, IProbe>(out probe))
+                {
+                    yield return (IListeningProbe)probe;
+                }
+            }
+        }
         #endregion

         #region Constructors
         public ExampleCapstoneAccelerationSensingAgent(): base("Capstone-2020", "ALM/TOD", default, default, default)
         {
-            ListeningWindow  = TimeSpan.FromSeconds(5);
-            PredictingWindow = TimeSpan.FromSeconds(5);
-            Threshold        = 0.5;
+            ListeningWindow  = TimeSpan.FromSeconds(10);  //provided by Mehdi in an email
+            PredictingWindow = TimeSpan.FromSeconds(300); //provided by Mehdi in an email
+            Threshold        = 0.5; //not provided
+            ProbeHz          = 20;  //provided by Mehdi in an email
         }
         #endregion

@@ -217,6 +268,7 @@
             ListeningWindow  = TimeSpan.FromSeconds(double.Parse(policy["cps-listening"].ToString()));
             PredictingWindow = TimeSpan.FromSeconds(double.Parse(policy["cps-predicting"].ToString()));
             Threshold        = double.Parse(policy["cps-threshold"].ToString());
+            ProbeHz          = int.Parse(policy["cps-hz"].ToString());

             return Task.CompletedTask;
         }
@@ -251,13 +303,31 @@
         {
             await base.OnStateChangedAsync(previousState, currentState, cancellationToken);

-            if (currentState == SensingAgentState.OpportunisticControl || currentState == SensingAgentState.ActiveControl)
-            {
-                // determine the appropriate sensor settings for an "on" prediction window
+            if (currentState == SensingAgentState.OpportunisticControl)
+            {
+                throw new Exception("Error, opportunistic control should be disabled for this agent");
+            }
+
+            if ( currentState == SensingAgentState.ActiveControl)
+            {
+                await SensusServiceHelper.KeepDeviceAwakeAsync();
+
+                foreach(var probe in Probes)
+                {
+                    probe.MaxDataStoresPerSecond = ProbeHz;
+                    await probe.RestartAsync(); //whether the probe is stopped or currently running this should refresh
+                }
             }
             else if (currentState == SensingAgentState.EndingControl)
             {
-                // determine the appropriate sensor settings for an "off" prediction window
+
+                foreach(var probe in Probes)
+                {
+                    probe.MaxDataStoresPerSecond = 20;
+                    await probe.StopAsync(); //whether or not the probe is already stopped this should not cause an issue
+                }
+
+                await SensusServiceHelper.LetDeviceSleepAsync();
             }
         }
         #endregion


Basic Help

Basic Help

--- fcfh/Program.cs
+++ fcfh/Program.cs
@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Linq;

 namespace fcfh
 {
@@ -7,22 +8,60 @@
     {
         static void Main(string[] args)
         {
+#if DEBUG
+            ShowHelp();
+            /*
             //OGG --> IMG
-            var Data = File.ReadAllBytes(@"C:\Users\Administrator\Desktop\x.ogg");
+            var Data = File.ReadAllBytes(@"C:\Users\Administrator\Desktop\Leaving The City.mp3");
             using (var MS = new MemoryStream(Data, false))
             {
-                File.WriteAllBytes(@"C:\Users\Administrator\Desktop\x.png", ImageWriter.CreateImageFromFile(MS, "x.ogg", true, true));
+                File.WriteAllBytes(@"C:\Users\Administrator\Desktop\x.png", ImageWriter.PixelMode.CreateImageFromFile(MS, "x.ogg", true, true));
             }
             //IMG --> OGG
             Data = File.ReadAllBytes(@"C:\Users\Administrator\Desktop\x.png");
             using (var MS = new MemoryStream(Data, false))
             {
-                File.WriteAllBytes(@"C:\Users\Administrator\Desktop\y.ogg", ImageWriter.CreateFileFromImage(MS));
+                File.WriteAllBytes(@"C:\Users\Administrator\Desktop\y.mp3", ImageWriter.PixelMode.CreateFileFromImage(MS));
             }
-
-
+            //*/
             Console.Error.WriteLine("#END");
             Console.ReadKey(true);
+#else
+            if (args.Length==0 || args.Contains("/?"))
+            {
+                ShowHelp();
+            }
+            else
+            {
+            }
+#endif
+
+        }
+
+        private static void ShowHelp()
+        {
+            Console.Error.WriteLine(@"{0} /{{e|d}} <infile> [outfile] [/readable] [/header source] [/pass [password]]
+
+Encodes and decodes information into images.
+This tool is not using steganography and literally just stores the data in an
+image container, but ensures that said container is valid.
+
+/e          - Encode a file into an image
+/d          - Decode a file from an image
+infile      - Source file
+outfile     - Destination file
+/readable   - Encodes content in binary readable form.
+              Only has an effect if encoding to 24 bit bitmap (.bmp),
+              because bitmap files are stored bottom up.
+/header     - Store content in a header instead of pixel data.
+              Be aware that some applications strip unknown headers.
+              The source argument is the file that is used as template.
+              Note: Some editors will strip unknown headers if you edit
+              the image file.
+/pass       - Encrypt/Decrypt using the given password.
+              This uses proper AES, recovery of content is impossible
+              if the password is lost. If no password is given, you
+              are prompted to enter one at runtime.", Tools.ProcessName);
         }

         /// <summary>
@@ -35,7 +74,7 @@
         {
             var C = new crypt.Crypt();
             C.GenerateSalt();
-            C.GeneratePassword(Password, 10000);
+            C.GeneratePassword(Password);
             using (var IN = new MemoryStream(Data, false))
             {
                 using (var OUT = new MemoryStream())


Fixing comments in CsDebugScript.VS.VSContext

--- Source/CsDebugScript.VS/VSContext.cs
+++ Source/CsDebugScript.VS/VSContext.cs
@@ -3,10 +3,19 @@

 namespace CsDebugScript.VS
 {
+    /// <summary>
+    /// Context for interacting with Visual Studio
+    /// </summary>
     internal static class VSContext
     {
+        /// <summary>
+        /// The debugger events (we need to store this in order to get events)
+        /// </summary>
         private static DebuggerEvents debuggerEvents;

+        /// <summary>
+        /// Gets the current debugging mode.
+        /// </summary>
         public static dbgDebugMode CurrentDebugMode
         {
             get
@@ -15,18 +24,40 @@
             }
         }

+        /// <summary>
+        /// Occurs when debugger enters break mode.
+        /// </summary>
         public static event Action DebuggerEnteredBreakMode;

+        /// <summary>
+        /// Occurs when debugger enters design mode.
+        /// </summary>
         public static event Action DebuggerEnteredDesignMode;

+        /// <summary>
+        /// Occurs when debugger enters run mode.
+        /// </summary>
         public static event Action DebuggerEnteredRunMode;

+        /// <summary>
+        /// Gets the service provider.
+        /// </summary>
         internal static IServiceProvider ServiceProvider { get; private set; }

+        /// <summary>
+        /// Gets the DTE.
+        /// </summary>
         internal static DTE DTE { get; private set; }

-        internal static VSDebugger VSDebugger;
+        /// <summary>
+        /// The VS debugger
+        /// </summary>
+        internal static VSDebugger VSDebugger { get; private set; }

+        /// <summary>
+        /// Sets the service provider.
+        /// </summary>
+        /// <param name="serviceProvider">The service provider.</param>
         public static void SetServiceProvider(IServiceProvider serviceProvider)
         {
             if (ServiceProvider != serviceProvider)
@@ -41,17 +72,30 @@
             }
         }

-        private static void DebuggerEvents_OnEnterRunMode(dbgEventReason Reason)
+        /// <summary>
+        /// Occurs when debugger enters run mode.
+        /// </summary>
+        /// <param name="reason">The reason.</param>
+        private static void DebuggerEvents_OnEnterRunMode(dbgEventReason reason)
         {
             DebuggerEnteredRunMode?.Invoke();
         }

-        private static void DebuggerEvents_OnEnterDesignMode(dbgEventReason Reason)
+        /// <summary>
+        /// Occurs when debugger enters design mode.
+        /// </summary>
+        /// <param name="reason">The reason.</param>
+        private static void DebuggerEvents_OnEnterDesignMode(dbgEventReason reason)
         {
             DebuggerEnteredDesignMode?.Invoke();
         }

-        private static void DebuggerEvents_OnEnterBreakMode(dbgEventReason Reason, ref dbgExecutionAction ExecutionAction)
+        /// <summary>
+        /// Occurs when debugger enters break mode.
+        /// </summary>
+        /// <param name="reason">The reason.</param>
+        /// <param name="executionAction">The execution action.</param>
+        private static void DebuggerEvents_OnEnterBreakMode(dbgEventReason reason, ref dbgExecutionAction executionAction)
         {
             DebuggerEnteredBreakMode?.Invoke();
             // TODO: VSDebugger?.UpdateCache();