ArrayConvert.ToByteメソッドの実装を変更

ArrayConvert.ToByteメソッドの実装を変更

--- src/ArrayConvert.cs
+++ src/ArrayConvert.cs
@@ -82,20 +82,21 @@
             short tmp;
             byte* b0 = (byte*)&tmp, b1 = b0 + 1;

-            if (reverse)
-                for (int i = offset, j = 0, length = offset + count; i < length; i++)
-                {
-                    tmp = src[i];
-                    dst[j++] = *b0;
-                    dst[j++] = *b1;
-                }
-            else
-                for (int i = offset, j = 0, length = offset + count; i < length; i++)
-                {
-                    tmp = src[i];
-                    dst[j++] = *b1;
-                    dst[j++] = *b0;
-                }
+            for (int i = offset, j = 0, length = offset + count; i < length; i++)
+            {
+                tmp = src[i];
+
+                if (reverse)
+                {
+                    dst[j++] = *b0;
+                    dst[j++] = *b1;
+                }
+                else
+                {
+                    dst[j++] = *b1;
+                    dst[j++] = *b0;
+                }
+            }
         }
         #endregion


More unused code removal

More unused code removal

--- BARABAS.cs
+++ BARABAS.cs
@@ -1341,17 +1341,6 @@
 		ih.Index = i;
 		list.Add(ih);
 	}
-}
-
-// get all ingots residing in storage
-List < ItemHelper > getAllStorageIngots(string name = null) {
-	List < ItemHelper > list = new List < ItemHelper > ();
-	var blocks = getStorage();
-	foreach (var block in blocks) {
-		var inv = block.GetInventory(0);
-		getAllIngots(inv, name, list);
-	}
-	return list;
 }

 // get all ingots residing in storage


More string sanitation for adding in usernames repository

--- twitch-tv-viewer/Services/UsernameRepository.cs
+++ twitch-tv-viewer/Services/UsernameRepository.cs
@@ -20,13 +20,13 @@

         public void AddUsername(string username)
         {
-            Settings.Default.Usernames.Add(username.ToLower());
+            Settings.Default.Usernames.Add(username.ToLower().Trim());
             Settings.Default.Save();
         }

         public void RemoveUsername(string username)
         {
-            Settings.Default.Usernames.Remove(username.ToLower());
+            Settings.Default.Usernames.Remove(username.ToLower().Trim());
             Settings.Default.Save();
         }
     }


Fixed writing incorrect path in GetChildItems()

--- PsFtpProvider/FtpProvider.cs
+++ PsFtpProvider/FtpProvider.cs
@@ -90,7 +90,7 @@
 		{
 			foreach (var item in PSDriveInfo.GetChildItems(path, recurse))
 			{
-				WriteItemObject(item, PSDriveInfo.Site.Hostname + item.FullName, item.Type == FtpFileSystemObjectType.Directory);
+				WriteItemObject(item, item.FullName, item.Type == FtpFileSystemObjectType.Directory);
 			}
 		}


Allow pinch rotation by default

Allow pinch rotation by default

--- Samples/Mapsui.Samples.Android/Activity1.cs
+++ Samples/Mapsui.Samples.Android/Activity1.cs
@@ -39,6 +39,7 @@
             mapControl.Map = InfoLayersSample.CreateMap();
             mapControl.Map.Info+= MapOnInfo;
             mapControl.Map.Viewport.ViewportChanged += ViewportOnViewportChanged;
+            mapControl.AllowPinchRotation = true;

             FindViewById<RelativeLayout>(Resource.Id.mainLayout).AddView(_popup = CreatePopup());
         }


Reapply close button hover color override after StyleButton resets it.

--- Sandra.UI/AppTemplate/MenuCaptionBarForm.cs
+++ Sandra.UI/AppTemplate/MenuCaptionBarForm.cs
@@ -58,6 +58,7 @@
         private Color titleBarForeColor;
         private Color titleBarHoverColor;
         private Color titleBarHoverBorderColor;
+        private Color? closeButtonHoverColorOverride;

         public MenuCaptionBarForm()
         {
@@ -159,6 +160,7 @@
         /// </summary>
         public void SetCloseButtonHoverColor(Color value)
         {
+            closeButtonHoverColorOverride = value;
             closeButton.FlatAppearance.MouseOverBackColor = value;
         }

@@ -167,6 +169,7 @@
         /// </summary>
         public void ResetCloseButtonHoverColor()
         {
+            closeButtonHoverColorOverride = null;
             closeButton.FlatAppearance.MouseOverBackColor = titleBarHoverColor;
         }

@@ -242,6 +245,12 @@
             }

             new[] { minimizeButton, maximizeButton, saveButton, closeButton }.ForEach(StyleButton);
+
+            if (closeButtonHoverColorOverride != null)
+            {
+                // Reapply override after StyleButton reset the hover color.
+                closeButton.FlatAppearance.MouseOverBackColor = closeButtonHoverColorOverride.Value;
+            }

             if (inDarkMode)
             {


ScadaComm: allow creating KPProperties with cmdLine=null

--- ScadaComm/ScadaCommCommon/Devices/KPView.cs
+++ ScadaComm/ScadaCommCommon/Devices/KPView.cs
@@ -125,11 +125,9 @@
             {
                 if (customParams == null)
                     throw new ArgumentNullException("customParams");
-                if (cmdLine == null)
-                    throw new ArgumentNullException("cmdLine");

                 CustomParams = customParams;
-                CmdLine = cmdLine;
+                CmdLine = cmdLine ?? "";
                 Modified = false;
             }


Made OrderBy(Name) and OrderBy(name) work the same as OrderBy(nodeName)

--- umbraco.MacroEngines.Juno/RazorDynamicNode/DynamicQueryable.cs
+++ umbraco.MacroEngines.Juno/RazorDynamicNode/DynamicQueryable.cs
@@ -249,7 +249,7 @@
             {
                 value = (firstFuncResult as Func<DynamicNode, object>)(node);
             }
-            if (firstFuncResult.GetType().IsValueType)
+            if (firstFuncResult.GetType().IsValueType || firstFuncResult is string)
             {
                 value = firstFuncResult;
             }


fix ToDataTable

fix ToDataTable

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

         public DataTable ToDataTable(DataTableValueConverter converter = null)
         {
-            if (converter != null)
+            if (converter == null)
                 converter = new InvariantDataTableValueConverter();

             DataTable dt = new DataTable("Table");


codigos jerarquicos actualizar ruta codigos hijos  y ciclos

(TFS CS 6665)

--- Signum.Entities/Patterns/LockeableEntity.cs
+++ Signum.Entities/Patterns/LockeableEntity.cs
@@ -10,7 +10,7 @@
 namespace Signum.Entities.Patterns
 {
     [Serializable]
-    public abstract class LockeableEntity : Entity
+    public abstract class LockableEntity : Entity
     {
         bool locked;
         public bool Locked


Adjust imbue chance (#1425)

Adjust imbue chance (#1425)

--- Source/ACE.Server/Managers/RecipeManager.cs
+++ Source/ACE.Server/Managers/RecipeManager.cs
@@ -160,10 +160,17 @@
             var successChance = SkillCheck.GetSkillChance((int)skill.Current, difficulty);

             // imbue: divide success by 3
+            if (recipe.Recipe.SalvageType == 2)
+            {
+                successChance /= 3.0f;
+
+                if (player.AugmentationBonusImbueChance > 0)
+                    successChance += player.AugmentationBonusImbueChance * 0.05f;
+            }

             // handle rare foolproof material
-            //if (tool.WeenieClassId >= 30094 && tool.WeenieClassId <= 30106)
-                //successChance = 1.0f;
+            if (tool.WeenieClassId >= 30094 && tool.WeenieClassId <= 30106)
+                successChance = 1.0f;

             // check for player option: 'Use Crafting Chance of Success Dialog'
             if (player.GetCharacterOption(CharacterOption.UseCraftingChanceOfSuccessDialog) && !confirmed)


Fixed AudioManager

Fixed AudioManager

--- Source/Code/Companion/Audio/AudioManager.cs
+++ Source/Code/Companion/Audio/AudioManager.cs
@@ -81,8 +81,7 @@
 			}
 			musicInstance = DualityApp.Sound.PlaySound (music);
 			musicInstance.Looped = looped;
-			musicInstance.Volume = 0f;
-			musicInstance.FadeTo (volume, fadeSeconds);
+			musicInstance.BeginFadeIn (fadeSeconds);
 		}

 		/// <summary>


Indentation Code Style Adjustments

Indentation Code Style Adjustments

--- Source/Core/Duality/Components/Transform.cs
+++ Source/Core/Duality/Components/Transform.cs
@@ -659,16 +659,16 @@
 			base.OnCopyDataTo(targetObj, operation);
 			Transform target = targetObj as Transform;

-			target.ignoreParent		= this.ignoreParent;
-
-			target.pos				= this.pos;
-			target.angle			= this.angle;
-			target.scale			= this.scale;
-
-			target.posAbs			= this.posAbs;
-			target.angleAbs			= this.angleAbs;
-			target.scaleAbs			= this.scaleAbs;
-			target.rotationDirAbs	= this.rotationDirAbs;
+			target.ignoreParent   = this.ignoreParent;
+
+			target.pos            = this.pos;
+			target.angle          = this.angle;
+			target.scale          = this.scale;
+
+			target.posAbs         = this.posAbs;
+			target.angleAbs       = this.angleAbs;
+			target.scaleAbs       = this.scaleAbs;
+			target.rotationDirAbs = this.rotationDirAbs;

 			// Update absolute transformation data, because the target is relative to a different parent.
 			target.UpdateAbs();


Implemented exchange rate

Implemented exchange rate


improve Mesh (VertexData)

improve Mesh (VertexData)


turn utxo scanner off

turn utxo scanner off


Mobile version hide now admin and create buttons

--- Source/PayItForward.WebForms/Site.Master.cs
+++ Source/PayItForward.WebForms/Site.Master.cs
@@ -50,15 +50,16 @@

         protected void master_Page_PreLoad(object sender, EventArgs e)
         {
-
             if (!this.Page.User.IsInRole("Admin"))
             {
                 this.admin.Visible = false;
+                this.a2.Visible = false;
             }

             if (!this.Page.User.IsInRole("User") && !this.Page.User.IsInRole("Admin"))
             {
                 this.createStory.Visible = false;
+                this.A1.Visible = false;
             }

             if (!IsPostBack)


Performance fix for the histogram

Performance fix for the histogram

Former-commit-id: f87222095d338f50dad4528eafc6f8d843f9acd0 [formerly 91353af796925e296f37efa7d5b84aa3a0c4dea5]
Former-commit-id: 489d25abe67aabf3e72ff7fbfe7e6079d8b19084 [formerly a42d1e8c4953888d9a921a94cb96d968754185aa]
Former-commit-id: fabc4cec5b6b10440c1dd61f3c61c390164c67ae
Former-commit-id: 287ea50cd38a2fa5a98bb48d28da058da98435a9

--- Source/RawParser/View/UIHelper/Histogram.cs
+++ Source/RawParser/View/UIHelper/Histogram.cs
@@ -20,20 +20,17 @@
                  });
             for (int i = 0; i < value.Length; i++)
             {
-                value[i] = (int)(value[i]/((height*width)/ (256 *10)));
-            }
-            for (int i = 0; i < value.Length; i++)
-            {
                 Line line = null;
+                int widthstep = (int)(value.Length / histogramCanvas.ActualWidth);
                 await CoreApplication.MainView.CoreWindow.Dispatcher
                      .RunAsync(CoreDispatcherPriority.Normal, () =>
                      {
-                         int widthstep = (int)(value.Length / histogramCanvas.ActualWidth);
+                         value[i] = (int)(value[i] / ((height * width) / (256 * 10)));
                          line = new Line();
                          line.Stroke = new SolidColorBrush(Colors.Black);
                          line.StrokeThickness = 1;

-                         line.X1 = line.X2 = (int)(i * widthstep);
+                         line.X1 = line.X2 = (i * widthstep);
                          line.Y1 = histogramCanvas.Height;
                          line.Y2 = (int)(histogramCanvas.Height - value[i]);


Minor bugfix

Minor bugfix

--- SpecFlow.Reporting.WebApp/WebAppReporter.cs
+++ SpecFlow.Reporting.WebApp/WebAppReporter.cs
@@ -148,7 +148,7 @@
             {
                 var pattern = "(?:<!-- step-details-marker: begin -->)(.*?)(?:<!-- step-details-marker: end -->)";

-                var replacement = File.ReadAllText(Settings.StepDetailsTemplateFile);
+				var replacement = File.ReadAllText(Settings.StepDetailsTemplateFile) + "'+\""; ;
                 replacement = Regex.Replace(replacement, "(\r|\n)", "\\n");
                 replacement = replacement.Replace("'", "\'");


comment fix

comment fix

--- Stratis.Bitcoin/Utilities/LinqExtensions.cs
+++ Stratis.Bitcoin/Utilities/LinqExtensions.cs
@@ -5,9 +5,8 @@
 namespace Stratis.Bitcoin.Utilities
 {
     /// <summary>
-    /// Extension methods for collections.
+    /// Extension methods for IEnumerable interface.
     /// </summary>
-    /// <remarks>TODO: Why is this called LinqExtensions? Wouldn't CollectionsExtensions be better?</remarks>
     public static class LinqExtensions
     {
         /// <summary>


Added testcase, included bigger numbers

Added testcase, included bigger numbers

--- StringCalcKata.Tests/StringCalcKataTests.cs
+++ StringCalcKata.Tests/StringCalcKataTests.cs
@@ -24,11 +24,13 @@
             Assert.AreEqual(expected, result);
         }

-        [Test]
-        public void CalculateAnyNumberSum()
+        [TestCase("2,2,2", 6)]
+        [TestCase("8,16,32", 56)]
+        [TestCase("8,16,32,64,128", 248)]
+        public void CalculateAnyNumberSum(string sum, int expected)
         {
-            var result = Calculator.Add("2,2,2");
-            Assert.AreEqual(6, result);
+            var result = Calculator.Add(sum);
+            Assert.AreEqual(expected, result);
         }
     }
 }


More intelligent error reporting from EventQueueClient

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

--- libsecondlife/Capabilities/EventQueueClient.cs
+++ libsecondlife/Capabilities/EventQueueClient.cs
@@ -26,6 +26,7 @@

 using System;
 using System.Net;
+using System.Threading;
 using libsecondlife.StructuredData;

 namespace libsecondlife.Capabilities
@@ -144,8 +145,16 @@
                 }
                 else if (!e.Cancelled && !Helpers.StringContains(message, "502"))
                 {
-                    SecondLife.LogStatic("Unrecognized caps exception from " + _Client.Location  +
-                        ": " + e.Error.Message, Helpers.LogLevel.Warning);
+                    if (e.Error.InnerException != null)
+                    {
+                        SecondLife.LogStatic("Unrecognized caps exception from " + _Client.Location +
+                            ": " + e.Error.InnerException.Message, Helpers.LogLevel.Warning);
+                    }
+                    else
+                    {
+                        SecondLife.LogStatic("Unrecognized caps exception from " + _Client.Location +
+                            ": " + e.Error.Message, Helpers.LogLevel.Warning);
+                    }
                 }
             }
             else if (!e.Cancelled && e.Result != null)


Remove unused badgeStyle argument in DrawLog

--- Console.cs
+++ Console.cs
@@ -142,7 +142,7 @@

         #endregion

-        void DrawLog(Log log, GUIStyle logStyle, GUIStyle badgeStyle)
+        void DrawLog(Log log, GUIStyle logStyle)
         {
             GUI.contentColor = logTypeColors[log.type];

@@ -171,9 +171,6 @@

         void DrawLogList()
         {
-            GUIStyle badgeStyle = GUI.skin.box;
-            badgeStyle.fontSize = logFontSize;
-
             GUIStyle logStyle = GUI.skin.label;
             logStyle.fontSize = logFontSize;

@@ -188,7 +185,7 @@

                     if (lastVisibleLog.HasValue)
                     {
-                        DrawLog(lastVisibleLog.Value, logStyle, badgeStyle);
+                        DrawLog(lastVisibleLog.Value, logStyle);
                     }
                 }
                 else
@@ -200,7 +197,7 @@
                             continue;
                         }

-                        DrawLog(log, logStyle, badgeStyle);
+                        DrawLog(log, logStyle);
                     }
                 }
             }


Add new `collapseLogOnStart` option

Add new `collapseLogOnStart` option

Permits collapsing of log messages by default, if enabled

--- Console.cs
+++ Console.cs
@@ -1,7 +1,9 @@
 using System;
 using System.Collections.Generic;
+using UnityEngine;
+#if UNITY_EDITOR
 using UnityEditor;
-using UnityEngine;
+#endif

 namespace Consolation
 {
@@ -38,6 +40,9 @@
         [SerializeField, Tooltip("Number of logs to keep before removing old ones.")]
         int maxLogCount = 1000;

+        [SerializeField, Tooltip("Whether log messages are collapsed by default or not.")]
+        bool collapseLogOnStart;
+
         [SerializeField, Tooltip("Font size to display log entries with.")]
         int logFontSize = 12;

@@ -116,6 +121,11 @@
             if (openOnStart)
             {
                 isVisible = true;
+            }
+
+            if (collapseLogOnStart)
+            {
+                isCollapsed = true;
             }
         }

@@ -430,6 +440,7 @@
         SerializedProperty toggleThresholdSeconds;
         SerializedProperty restrictLogCount;
         SerializedProperty maxLogCount;
+        SerializedProperty collapseLogOnStart;
         SerializedProperty logFontSize;
         SerializedProperty scaleFactor;

@@ -443,6 +454,7 @@
             toggleThresholdSeconds = serializedObject.FindProperty("toggleThresholdSeconds");
             restrictLogCount = serializedObject.FindProperty("restrictLogCount");
             maxLogCount = serializedObject.FindProperty("maxLogCount");
+            collapseLogOnStart = serializedObject.FindProperty("collapseLogOnStart");
             logFontSize = serializedObject.FindProperty("logFontSize");
             scaleFactor = serializedObject.FindProperty("scaleFactor");
         }
@@ -469,6 +481,7 @@
                 EditorGUILayout.PropertyField(maxLogCount);
             }

+            EditorGUILayout.PropertyField(collapseLogOnStart);
             EditorGUILayout.PropertyField(logFontSize);
             EditorGUILayout.PropertyField(scaleFactor);
             serializedObject.ApplyModifiedProperties();


Removing tab via context menu no longer possible in read only mode

--- Sources/ProfileTabControl.cs
+++ Sources/ProfileTabControl.cs
@@ -262,6 +262,8 @@
         /// <param name="Target">The tab that will be removed</param>
         public void ProfileTabRemove(TabPage Target)
         {
+            if (ReadOnlyMode) return; // control not editable
+
             // Remove tab but we still need to keep last regular one, the "New" and "Delete tabs.
             if (TabPages.Count <= 3) return;


Add notes to csharp example/test application

--- scripts/tests/csharp/Main.cs
+++ scripts/tests/csharp/Main.cs
@@ -1,5 +1,30 @@
 using System;
 using OtAPI;
+
+// This script demonstrates both the high-level AND low-level
+// OT API, in the C# language.
+//
+// (temporary instructions until more can be automated...)
+// Before building this test application, you will need to build the assembly
+// that contains the api for C#.
+// I create a build directory in the Open-Transactions root directory and
+// run ../configure form there. So, these paths will reference that location.
+// I am also running Linux/mono (need this tested in Windows - thanks)
+//
+// If you build right in the Open-Transactions directory, then remove the ../
+// found in the following...
+// Build the OtAPI.dll assembly:
+// bash ../build-aux/csharpcomp.sh mcs -o OtAPI.dll ../swig/glue/csharp/*.cs
+//
+// You should see OtAPI.dll in your directory. Copy that here to the directory
+// containing this test application. On Linux, run xbuild to compile.
+// In Windows, try msbuild.
+// Your application will be here: bin/Debug/csharp
+// Go there and run it with "mono csharp.exe" on Linux. Windows, just run it
+// directly.
+//
+// Also, make sure the server is running ('otserver')
+//

 namespace otest
 {
@@ -8,19 +33,57 @@
         public static void Main (string[] args)
         {
             OTAPI_Basic.AppStartup();
+
+            // These functions are perfect examples of the 'Low-level API',
+		        // which is useful for simple functions that don't require messaging
+		        // any OT servers. See OTAPI_Basic.h and OTAPI.h for the complete
+		        // low-level API.
+
             OTAPI_Basic.Init();
             OTAPI_Basic.LoadWallet();
+
+
+            // ---------------------------------------------------------
+            // Use the low-level API to see how many server contracts
+            // are in the user's wallet.
+

             int count = OTAPI_Basic.GetServerCount();

             Console.Out.WriteLine("Server count {0}", count.ToString());

+            // ---------------------------------------------------------
+
+            // OT MADE EASY  (high-level API)
+
+            // This object handles all the request/response going on with
+            // any servers, plus all the retries and synchronization. It's
+            // the 'High-level API'. See OTMadeEasy.h and OT_ME.h for the
+            // complete set of high-level API functions.
+
             OTMadeEasy otme = new OTMadeEasy();
+
+            // ---------------------------------------------------------
+            //
+            // Use the High-level API to download a user's public key from
+            // the server. (Obviously this will fail if the server is not
+            // running, or if the test data is not installed.)

             string strCheck = otme.check_user("tBy5mL14qSQXCJK7Uz3WlTOKRP9M0JZksA3Eg7EnnQ1",
                             "T1Q3wZWgeTUoaUvn9m1lzIK5tn5wITlzxzrGNI8qtaV",
                             "T1Q3wZWgeTUoaUvn9m1lzIK5tn5wITlzxzrGNI8qtaV");

+            // ---------------------------------------------------------
+            // objEasy.check_user corresponds to the command-line:
+            //   'opentxs checknym'
+            //
+            // It's a useful test because it shows whether a server message
+            // is successful, before going the extra step of trying a real
+            // financial transaction.
+            //
+            // Therefore we only need to verify the Message Success, and not
+            // any transaction success. (Remember, a successful message can
+            // still contain a failed transaction.)

             int nResult = otme.VerifyMessageSuccess(strCheck);

@@ -34,11 +97,38 @@
             else
                 Console.Out.WriteLine("Unexpected return value in check nym.");

+            // ---------------------------------------------------------
+            //
+            // Use the high-level API to withdraw some cash (1 silver gram)
+            // from FT's Silver account. (Obviously this will not work if the
+            // localhost server is not running, or if the test data is not
+            // installed to ~/.ot )

+            // This is a "real" financial transaction:
+            //
             string strWithdraw = otme.withdraw_cash("tBy5mL14qSQXCJK7Uz3WlTOKRP9M0JZksA3Eg7EnnQ1",
                                "T1Q3wZWgeTUoaUvn9m1lzIK5tn5wITlzxzrGNI8qtaV",
                                "eMldMMiKfJRO8B8yJjzcezs9xvSt7dkdlWt50e8CDxn", "1");

+            // ---------------------------------------------------------
+            // InterpretTransactionMsgReply
+            //
+            // This function first verifies whether the message itself was a
+            // success. (For example, what if the server was down, and never
+            // received it?)
+            //
+            // Once it verifies that the reply was successful as a message,
+            // then it peers deeper, to see whether the balance agreement was
+            // successful as well. (After all, any transaction is automatically
+            // rejected if the balance agreement is poorly-formed.)
+            //
+            // Then if the balance agreement was successful, then finally,
+            // this same function (InterpretTransactionMsgReply) checks to see
+            // whether the transaction ITSELF was successful. After all, maybe
+            // there was an error saving it back to disk on the server side
+            // and this caused the transaction to fail. Or maybe there wasn't
+            // enough money in the account. Etc. All of the above work is done
+            // in the below call:

             nResult = otme.InterpretTransactionMsgReply("tBy5mL14qSQXCJK7Uz3WlTOKRP9M0JZksA3Eg7EnnQ1",
                                                         "T1Q3wZWgeTUoaUvn9m1lzIK5tn5wITlzxzrGNI8qtaV",
@@ -54,10 +144,38 @@
             else
                 Console.Out.WriteLine("Unexpected return value in withdraw cash.");

+            // ---------------------------------------------------------
+
+            // At this point we're done. We've downloaded a public key from
+            // the OT server, and we've also withdrawn a little cash from the
+            // server. We've demonstrated that both the high-level and
+            // low-level OT APIs are operational through Python.
+
+            // So... we're done. Let's shutdown OT and finish execution.
+            // (Using the low-level API...)
             OTAPI_Basic.Output(0, "One more thing: Successfully used OT_API_Output.");

             OTAPI_Basic.AppShutdown();
+
+            // P.S. to see the complete OT high-level API:  OTMadeEasy.h
+            //  and to see the complete OT low-level  API:  OTAPI_Basic.h
+            //
+            // See the Open-Transactions/include/otapi folder for all
+            // relevant headers. OTMadeEasy is a wrapper for OT_ME, and
+            // OTAPI_Basic is a wrapper for OTAPI.
+            //
+            // One more thing: If you want to see a lot of free sample code
+            // similar to the above code, which shows you how to use all the
+            // different OT API function calls, check out this file:
+            //
+            //        Open-Transactions/scripts/ot/ot_commands.ot
+            //
+            // (It contains the complete implementation for a command-line
+            //  Open-Transactions client.)
+            // --------------------------------------
+
+
         }
     }
 }


duplicate check for repositories

duplicate check for repositories

--- SparseApp/MainWindow.xaml.cs
+++ SparseApp/MainWindow.xaml.cs
@@ -171,13 +171,20 @@

             if (result == true)
             {
-                Repository repository = new Repository()
-                {
-                    Path = dialog.SelectedPath
-                };
-
-                repo.Repositories.Add(repository);
-                lstRepositories.Items.Refresh();
+                if (repo.Repositories.Select(repository => repository.Path == dialog.SelectedPath).Count() == 0)
+                {
+                    Repository repository = new Repository()
+                    {
+                        Path = dialog.SelectedPath
+                    };
+
+                    repo.Repositories.Add(repository);
+                    lstRepositories.Items.Refresh();
+                }
+                else
+                {
+                    this.ShowMessageAsync("Repository already exists", "The selected folder \"" + dialog.SelectedPath + "\" has already been registered in Sparse.", MessageDialogStyle.Affirmative, new MetroDialogSettings() { AffirmativeButtonText = "OK" });
+                }
             }
         }


ConstructType finished

ConstructType finished

--- Src/Pc/Compiler/PToCSharp.cs
+++ Src/Pc/Compiler/PToCSharp.cs
@@ -37,11 +37,13 @@
         //TODO(replace): these are Zing-related; used here for compilation only
         public static SyntaxNode PrtMkDefaultValue = MkCSharpDot("PRT_VALUE", "PrtMkDefaultValue");
         public static SyntaxNode PrtCloneValue = MkCSharpDot("PRT_VALUE", "PrtCloneValue");
+        public AST<Model> modelWithTypes;
         public PToCSharp(Compiler compiler, AST<Model> modelWithTypes, Dictionary<int, SourceInfo> idToSourceInfo, string csharpFileName)
             : base(compiler, modelWithTypes, idToSourceInfo)
         {
             this.csharpFileName = csharpFileName;
             this.typeContext = new TypeTranslationContext(this);
+            this.modelWithTypes = modelWithTypes;
             //GenerateTypeInfo(modelWithTypes);
         }

@@ -57,6 +59,7 @@
         //Possibly, all types-realted stuff should be moved to PToCSharp (similar to Zing compiler)
         //and  TypeTranslationContext to be instantiated in the PToCSharp constructor
         //After that, ConstructType in MkFunctionDecl can be replaced with TypeTranslationContext.ConstructType
+
         TypeTranslationContext typeContext;
         internal class TypeTranslationContext
         {
@@ -164,6 +167,10 @@
             private SyntaxNode ConstructType(FuncTerm type)
             {
                 string typeKind = ((Id)type.Function).Name;
+
+                //Debug only:
+                Console.WriteLine("typeKind in ConstructType: {0}", typeKind);
+
                 if (typeKind == "BaseType")
                 {
                     var primitiveType = ((Id)GetArgByIndex(type, 0)).Name;
@@ -221,13 +228,13 @@
                 }
                 else if (typeKind == "NameType")
                 {
+                    //throw new NotImplementedException();
                     //NameType is for enum values only; "synonym" types are expanded by the compiler
                     //TODO(expand): there's no ref to the enum type left in C# code, which would not allow
                     //to treat casts (enum->int) properly;
                     //therefore, code below would have to be changed, after PrtEnumType is defined in PrtTypes.cs.
-                    string typeName = "type_" + typeCount;
+                    string typeName = "typeNameType_" + typeCount;
                     var tmpVar = GetType(typeName);
-                    //TODO(question): same as in Zing compiler; is this correct?
                     AddTypeInitialization(MkCSharpSimpleExpressionStatement(tmpVar, MkCSharpObjectCreationExpression(IdentifierName("PrtIntType"))));
                     AddTypeDeclaration(MkCSharpFieldDeclaration(IdentifierName("PrtType"), typeName, Token(SyntaxKind.PublicKeyword),
                                                                    Token(SyntaxKind.StaticKeyword)));
@@ -235,61 +242,90 @@
                 }
                 else if (typeKind == "TupType")
                 {
-                    throw new NotImplementedException();
-                    //List<SyntaxNode> memberTypes = new List<SyntaxNode>();
-                    //while (type != null)
-                    //{
-                    //    memberTypes.Add(pTypeToZingExpr((FuncTerm)GetArgByIndex(type, 0)));
-                    //    type = GetArgByIndex(type, 1) as FuncTerm;
-                    //}
-                    //var tupleType = GetType();
-                    //AddTypeInitialization(MkCSharpSimpleExpressionStatement(tupleType, MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtMkTupType"), Factory.Instance.MkCnst(memberTypes.Count))));
+                    List<SyntaxNode> memberTypes = new List<SyntaxNode>();
+                    while (type != null)
+                    {
+                        memberTypes.Add(PTypeToCSharpExpr((FuncTerm)GetArgByIndex(type, 0)));
+                        type = GetArgByIndex(type, 1) as FuncTerm;
+                    }
+                    string typeName = "typeTupType_" + typeCount;
+                    var tmpVar = GetType(typeName);
+                    //TODO(improve): create a generic method for inserting CommaToken into a generic list
+                    List<SyntaxNodeOrToken> initializer = new List<SyntaxNodeOrToken>();
+                    foreach (var memberType in memberTypes)
+                    {
+                        initializer.Add(memberType);
+                        initializer.Add(Token(SyntaxKind.CommaToken));
+                    }
+                    initializer.RemoveAt(initializer.Count() - 1);
+                    //public static SyntaxNode MkCSharpArrayCreationExpression(TypeSyntax type, SyntaxNodeOrToken[] initializer)
+                    AddTypeInitialization(MkCSharpSimpleExpressionStatement(tmpVar, MkCSharpObjectCreationExpression(IdentifierName("PrtTupleType"),
+                        MkCSharpArrayCreationExpression("PrtType", initializer.ToArray()))));
+                    AddTypeDeclaration(MkCSharpFieldDeclaration(IdentifierName("PrtTupleType"), typeName, Token(SyntaxKind.PublicKeyword),
+                                                                   Token(SyntaxKind.StaticKeyword)));
+                    //TODO(confirm): what for is this code in PToZing.cs?
+                    //Looks like it is not needed now
                     //for (int i = 0; i < memberTypes.Count; i++)
                     //{
-                    //    //AddTypeInitialization(MkCSharpCallStmt(MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtSetFieldType"), tupleType, Factory.Instance.MkCnst(i), memberTypes[i])));
+                    //    AddTypeInitialization(MkZingCallStmt(MkZingCall(MkZingDot("PRT_TYPE", "PrtSetFieldType"), tupleType, Factory.Instance.MkCnst(i), memberTypes[i])));
                     //}
-                    //return tupleType;
+                    return tmpVar;

                 }
                 else if (typeKind == "NmdTupType")
                 {
-                    throw new NotImplementedException();
-                    //List<AST<Node>> memberNames = new List<AST<Node>>();
-                    //List<AST<Node>> memberTypes = new List<AST<Node>>();
-                    //while (type != null)
-                    //{
-                    //    var typeField = (FuncTerm)GetArgByIndex(type, 0);
-                    //    memberNames.Add(GetField(((Cnst)GetArgByIndex(typeField, 0)).GetStringValue()));
-                    //    memberTypes.Add(pTypeToZingExpr((FuncTerm)GetArgByIndex(typeField, 1)));
-                    //    type = GetArgByIndex(type, 1) as FuncTerm;
-                    //}
-                    //var tupleType = GetType();
-                    //AddTypeInitialization(MkCSharpAssign(tupleType, MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtMkNmdTupType"), Factory.Instance.MkCnst(memberTypes.Count))));
-                    //for (int i = 0; i < memberTypes.Count; i++)
-                    //{
-                    //    AddTypeInitialization(MkCSharpCallStmt(MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtSetFieldName"), tupleType, Factory.Instance.MkCnst(i), memberNames[i])));
-                    //    AddTypeInitialization(MkCSharpCallStmt(MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtSetFieldType"), tupleType, Factory.Instance.MkCnst(i), memberTypes[i])));
-                    //}
-                    //return tupleType;
-
+                    List<SyntaxNode> memberNames = new List<SyntaxNode>();
+                    List<SyntaxNode> memberTypes = new List<SyntaxNode>();
+
+                    while (type != null)
+                    {
+                        var typeField = (FuncTerm)GetArgByIndex(type, 0);
+                        string nameField = ((Cnst)GetArgByIndex(typeField, 0)).GetStringValue();
+                        memberNames.Add(MkCSharpStringLiteralExpression(nameField));
+                        memberTypes.Add(PTypeToCSharpExpr((FuncTerm)GetArgByIndex(typeField, 1)));
+                        type = GetArgByIndex(type, 1) as FuncTerm;
+                    }
+                    string typeName = "typeNmdTupType_" + typeCount;
+                    var tmpVar = GetType(typeName);
+
+                    List<SyntaxNodeOrToken> initializer = new List<SyntaxNodeOrToken>();
+                    int ind = 0;
+                    foreach (var memberName in memberNames)
+                    {
+                        initializer.Add(memberName);
+                        initializer.Add(Token(SyntaxKind.CommaToken));
+                        initializer.Add(memberTypes[ind++]);
+                        initializer.Add(Token(SyntaxKind.CommaToken));
+                    }
+                    initializer.RemoveAt(initializer.Count() - 1);
+
+                    AddTypeInitialization(MkCSharpSimpleExpressionStatement(tmpVar, MkCSharpObjectCreationExpression(IdentifierName("PrtNmdTupleType"),
+                        MkCSharpArrayCreationExpression("PrtType", initializer.ToArray()))));
+                    AddTypeDeclaration(MkCSharpFieldDeclaration(IdentifierName("PrtNmdTupleType"), typeName, Token(SyntaxKind.PublicKeyword),
+                                                                   Token(SyntaxKind.StaticKeyword)));
+                    return tmpVar;
                 }
                 else if (typeKind == "SeqType")
                 {
-                    throw new NotImplementedException();
-                    //var innerType = PTypeToZingExpr((FuncTerm)GetArgByIndex(type, 0));
-                    //var seqType = GetType();
-                    //AddTypeInitialization(MkCSharpAssign(seqType, MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtMkSeqType"), innerType)));
-                    //return seqType;
+                    SyntaxNode innerType = PTypeToCSharpExpr((FuncTerm)GetArgByIndex(type, 0));
+                    string typeName = "typeSeqType_" + typeCount;
+                    var tmpVar = GetType(typeName);
+                    AddTypeInitialization(MkCSharpSimpleExpressionStatement(tmpVar, MkCSharpObjectCreationExpression(IdentifierName("PrtSeqType"), innerType)));
+                    AddTypeDeclaration(MkCSharpFieldDeclaration(IdentifierName("PrtSeqType"), typeName, Token(SyntaxKind.PublicKeyword),
+                                                                   Token(SyntaxKind.StaticKeyword)));
+                    return tmpVar;
                 }
                 else
                 {
-                    throw new NotImplementedException();
                     // typeKind == "MapType"
-                    //var domType = PTypeToZingExpr((FuncTerm)GetArgByIndex(type, 0));
-                    //var codType = PTypeToZingExpr((FuncTerm)GetArgByIndex(type, 1));
-                    //var mapType = GetType();
-                    //AddTypeInitialization(MkCSharpAssign(mapType, MkCSharpCall(MkCSharpDot("PRT_TYPE", "PrtMkMapType"), domType, codType)));
-                    //return mapType;
+                    SyntaxNode keyType = PTypeToCSharpExpr((FuncTerm)GetArgByIndex(type, 0));
+                    SyntaxNode valType = PTypeToCSharpExpr((FuncTerm)GetArgByIndex(type, 1));
+                    string typeName = "typeMapType_" + typeCount;
+                    var tmpVar = GetType(typeName);
+                    AddTypeInitialization(MkCSharpSimpleExpressionStatement(tmpVar, MkCSharpObjectCreationExpression(IdentifierName("PrtMapType"), keyType, valType)));
+                    AddTypeDeclaration(MkCSharpFieldDeclaration(IdentifierName("PrtMapType"), typeName, Token(SyntaxKind.PublicKeyword),
+                                                                   Token(SyntaxKind.StaticKeyword)));
+                    return tmpVar;
                 }
             }
         }
@@ -531,7 +567,24 @@
                                        SyntaxKind.NumericLiteralExpression,
                                           Literal(index))))));
         }
-        //TODO(expand on any number of parameters)
+        //OmittedArraySizeExpression case only:
+        public static SyntaxNode MkCSharpArrayCreationExpression(string type, SyntaxNodeOrToken[] initializer)
+        {
+            //SyntaxNodeOrToken[] temp = new SyntaxNodeOrToken[initializer.Count()];
+            //temp = initializer;
+            return ArrayCreationExpression(
+                    ArrayType(IdentifierName(type))
+                    .WithRankSpecifiers(
+                         SingletonList<ArrayRankSpecifierSyntax>(
+                                    ArrayRankSpecifier(
+                                        SingletonSeparatedList<ExpressionSyntax>(
+                                            OmittedArraySizeExpression())))))
+                        .WithInitializer(
+                            InitializerExpression(
+                                            SyntaxKind.ArrayInitializerExpression,
+                                            SeparatedList<ExpressionSyntax>(initializer)));
+        }
+        //TODO(expand to any number of parameters)
         public static SyntaxNode MkCSharpObjectCreationExpression(SyntaxNode type, params SyntaxNode[] names)
         {
             //List<ArgumentSyntax> hd = new List<ArgumentSyntax>();
@@ -905,6 +958,147 @@
                 this.isGlobalStatic = isGlobalStatic;
                 this.owner = owner;
                 this.pToCSharp = pToCSharp;
+                GenerateTypeInfo(pToCSharp.modelWithTypes);
+            }
+            void GenerateTypeInfo(AST<Model> model)
+            {
+                var factBins = new Dictionary<string, LinkedList<AST<FuncTerm>>>();
+                model.FindAll(
+                    new NodePred[]
+                    {
+                    NodePredFactory.Instance.Star,
+                    NodePredFactory.Instance.MkPredicate(NodeKind.ModelFact)
+                    },
+
+                    (path, n) =>
+                    {
+                        var mf = (ModelFact)n;
+                        FuncTerm ft = (FuncTerm)mf.Match;
+                        pToCSharp.GetBin(factBins, ft).AddLast((AST<FuncTerm>)Factory.Instance.ToAST(ft));
+                    });
+
+                var terms = pToCSharp.GetBin(factBins, "TypeOf");
+                foreach (var term in terms)
+                {
+                    using (var it = term.Node.Args.GetEnumerator())
+                    {
+                        it.MoveNext();
+                        FuncTerm typingContext = (FuncTerm)it.Current;
+                        it.MoveNext();
+                        var expr = Factory.Instance.ToAST(it.Current);
+                        it.MoveNext();
+                        var type = it.Current as FuncTerm;
+                        if (type == null) continue;
+
+                        string typingContextKind = ((Id)typingContext.Function).Name;
+                        if (typingContextKind == "FunDecl")
+                        {
+                            string ownerName = pToCSharp.GetOwnerName(typingContext, 1, 0);
+                            string funName = GetName(typingContext, 0);
+                            if (ownerName == null)
+                            {
+                                pToCSharp.allStaticFuns[funName].typeInfo[expr] = type;
+                            }
+                            else
+                            {
+                                pToCSharp.allMachines[ownerName].funNameToFunInfo[funName].typeInfo[expr] = type;
+                            }
+                        }
+                        else
+                        {
+                            // typingContextKind == "AnonFunDecl"
+                            string ownerName = pToCSharp.GetOwnerName(typingContext, 0, 0);
+                            string funName = pToCSharp.anonFunToName[Factory.Instance.ToAST(typingContext)];
+                            if (ownerName == null)
+                            {
+                                pToCSharp.allStaticFuns[funName].typeInfo[expr] = type;
+                            }
+                            else
+                            {
+                                pToCSharp.allMachines[ownerName].funNameToFunInfo[funName].typeInfo[expr] = type;
+                            }
+                        }
+                    }
+                }
+
+                terms = pToCSharp.GetBin(factBins, "TranslatedTypeExpr");
+                foreach (var term in terms)
+                {
+                    using (var it = term.Node.Args.GetEnumerator())
+                    {
+                        it.MoveNext();
+                        var eType = (FuncTerm)it.Current;
+                        pToCSharp.typeContext.PTypeToCSharpExpr(eType);
+                    }
+                }
+
+                terms = pToCSharp.GetBin(factBins, "TypeExpansion");
+                foreach (var term in terms)
+                {
+                    using (var it = term.Node.Args.GetEnumerator())
+                    {
+                        it.MoveNext();
+                        var type = (FuncTerm)it.Current;
+                        it.MoveNext();
+                        var eType = (FuncTerm)it.Current;
+                        pToCSharp.typeContext.AddOriginalType(type, eType);
+                    }
+                }
+
+                terms = pToCSharp.GetBin(factBins, "LinkMap");
+                foreach (var term in terms)
+                {
+                    using (var it = term.Node.Args.GetEnumerator())
+                    {
+                        it.MoveNext();
+                        var createdIorM = ((Cnst)it.Current).GetStringValue();
+                        it.MoveNext();
+                        var createdM = ((Cnst)it.Current).GetStringValue();
+                        pToCSharp.linkMap.Add(createdIorM, createdM);
+                    }
+                }
+
+                terms = pToCSharp.GetBin(factBins, "MaxNumLocals");
+                foreach (var term in terms)
+                {
+                    using (var it = term.Node.Args.GetEnumerator())
+                    {
+                        it.MoveNext();
+                        FuncTerm typingContext = (FuncTerm)it.Current;
+                        string typingContextKind = ((Id)typingContext.Function).Name;
+                        if (!(typingContextKind == "FunDecl" || typingContextKind == "AnonFunDecl")) continue;
+                        it.MoveNext();
+                        var maxNumLocals = (int)((Cnst)it.Current).GetNumericValue().Numerator;
+
+                        if (typingContextKind == "FunDecl")
+                        {
+                            string ownerName = pToCSharp.GetOwnerName(typingContext, 1, 0);
+                            string funName = GetName(typingContext, 0);
+                            if (ownerName == null)
+                            {
+                                pToCSharp.allStaticFuns[funName].maxNumLocals = maxNumLocals;
+                            }
+                            else
+                            {
+                                pToCSharp.allMachines[ownerName].funNameToFunInfo[funName].maxNumLocals = maxNumLocals;
+                            }
+                        }
+                        else
+                        {
+                            // typingContextKind == "AnonFunDecl"
+                            string ownerName = pToCSharp.GetOwnerName(typingContext, 0, 0);
+                            string funName = pToCSharp.anonFunToName[Factory.Instance.ToAST(typingContext)];
+                            if (ownerName == null)
+                            {
+                                pToCSharp.allStaticFuns[funName].maxNumLocals = maxNumLocals;
+                            }
+                            else
+                            {
+                                pToCSharp.allMachines[ownerName].funNameToFunInfo[funName].maxNumLocals = maxNumLocals;
+                            }
+                        }
+                    }
+                }
             }
             public int LabelToId(string l)
             {
@@ -981,7 +1175,11 @@
                 //return locals.Select(loc => PToCSharp.MkCSharpVarDecl(loc.Item2, loc.Item1));
             }

-
+            private FuncTerm LookupType(Node node)
+            {
+                //return entityInfo.typeInfo[Factory.Instance.ToAST(node)];
+                return funInfo.typeInfo[Factory.Instance.ToAST(node)];
+            }
             #region FoldUnfod
             private IEnumerable<Node> Unfold(Node n)
             {


simplifed examples

simplifed examples

--- StringEnums.Tests/Example.cs
+++ StringEnums.Tests/Example.cs
@@ -4,23 +4,6 @@

 namespace StringEnums.Tests
 {
-    public sealed class OrderType : StringEnum<OrderType>
-    {
-        public static readonly OrderType Market = Create("MARKET");
-        public static readonly OrderType Limit = Create("LIMIT");
-    }
-
-    public class Example1
-    {
-        [Fact]
-        public void Test()
-        {
-            Assert.Equal("MARKET", OrderType.Market.ToString());
-
-            Assert.Equal(OrderType.Market, OrderType.ToStringEnum("MARKET"));
-        }
-    }
-
     public sealed class Location : StringEnum<Location>
     {
         public static readonly Location Undefined = Create("");
@@ -28,10 +11,18 @@
         public static readonly Location America = Create("America", "USA");
     }

-    public class Example2
+    public class Example1
     {
         [Fact]
         public void Test1()
+        {
+            Assert.Equal("Europe", Location.Europe.ToString());
+
+            Assert.Equal(Location.Europe, Location.ToStringEnum("Europe"));
+        }
+
+        [Fact]
+        public void Test2()
         {
             Assert.Equal(Location.America, Location.ToStringEnum("America"));
             Assert.Equal(Location.America, Location.ToStringEnum("USA"));
@@ -42,7 +33,7 @@
         }

         [Fact]
-        public void Test2()
+        public void Test3()
         {
             Assert.False(Location.Undefined.IsNewValue);
             Assert.False(Location.Europe.IsNewValue);
@@ -53,9 +44,9 @@
         }

         [Fact]
-        public void Test3()
+        public void Test4()
         {
-            Assert.Equal(new List<Location> { Location.Undefined, Location.Europe, Location.America }, Location.ToStringEnums());
+            Assert.Equal(new List<Location> { Location.Undefined, Location.Europe, Location.America, Location.ToStringEnum("NEW VALUE") }, Location.ToStringEnums());

             Location.SetStringComparer(StringComparer.OrdinalIgnoreCase);
             Assert.Equal(Location.ToStringEnum("SomeNewValue"), Location.ToStringEnum("SOMENewValue"));


version bump

version bump

--- src/SolutionInfo.cs
+++ src/SolutionInfo.cs
@@ -13,4 +13,4 @@

 [assembly: AssemblyVersion("4.3.0")]
 [assembly: AssemblyFileVersion("4.3.0")]
-[assembly: AssemblyInformationalVersion("4.3.0-beta01")]
+[assembly: AssemblyInformationalVersion("4.3.0")]


(build) Bumped version

(build) Bumped version

--- src/SolutionInfo.cs
+++ src/SolutionInfo.cs
@@ -1,4 +1,4 @@
 using System.Reflection

-[assembly: AssemblyVersion("0.3.0")]
-[assembly: AssemblyFileVersion("0.3.0")]
+[assembly: AssemblyVersion("0.7.0")]
+[assembly: AssemblyFileVersion("0.7.0")]


Review DbfBase class

Review DbfBase class

--- src/DotNetDbf/DbfBase.cs
+++ src/DotNetDbf/DbfBase.cs
@@ -194,9 +194,9 @@

             entity.GetType().GetProperties().ToList().ForEach(property =>
             {
-                if(Attribute.IsDefined(property, typeof(ColumnNameAttribute)))
-                {
-                    if (Attribute.IsDefined(property, typeof(PrimaryKeyAttribute)))
+                if(this.isPropertyColumn(property))
+                {
+                    if (this.isPrimaryKeyColumn(property))
                     {
                         whereFilter = getColumnName(property) + "=" + getFormattedValue(property, entity);
                     }


Fix crash when there are no updates available

--- src/HearThis/UI/Shell.cs
+++ src/HearThis/UI/Shell.cs
@@ -343,8 +343,8 @@
 		private void HandleAboutDialogCheckForUpdatesClick(object sender, EventArgs e)
 		{
 			var updateStatus = UpdateChecker.CheckForUpdatesAtUserRequest();
-			if (updateStatus == Sparkle.UpdateStatus.UpdateNotAvailable)
-				((SILAboutBox)sender).NotifyNoUpdatesAvailable();
+			if (sender is SILAboutBox aboutBox && updateStatus == Sparkle.UpdateStatus.UpdateNotAvailable)
+				aboutBox.NotifyNoUpdatesAvailable();
 		}

 		protected override void OnClosing(CancelEventArgs e)


Update Client.cs

Update Client.cs

--- src/Hprose.RPC/Client.cs
+++ src/Hprose.RPC/Client.cs
@@ -125,7 +125,8 @@
         }
         public async Task InvokeAsync(string fullname, object[] args = null, Settings settings = null) {
             var context = new ClientContext(this, null, settings);
-            await invokeManager.Handler(fullname, args, context).ContinueWith((_) => { }, TaskScheduler.Current).ConfigureAwait(false);
+            var task = invokeManager.Handler(fullname, args, context);
+            await task.ContinueWith((_) => { }, TaskScheduler.Current).ConfigureAwait(false);
             return;
         }
         public async Task<T> InvokeAsync<T>(string fullname, object[] args = null, Settings settings = null) {


DocGen: RenderText extra call removed

DocGen: RenderText extra call removed

--- ReferenceCore/ExtenderDoc.cs
+++ ReferenceCore/ExtenderDoc.cs
@@ -65,7 +65,7 @@
         IEnumerable<string> FormatMethodParams(MethodDoc methodDoc) {
             foreach(var param in methodDoc.Params) {
                 var header = _renderer.RenderText(param.Name, bold: true);
-                var type = _renderer.RenderText(_renderer.RenderText("Type: ", italic: true) + _renderer.RenderText(param.TypeName));
+                var type = _renderer.RenderText("Type: ", italic: true) + _renderer.RenderText(param.TypeName);

                 yield return
                     _renderer.RenderListItem(header, false, 1) +


Correctly handle null and expected type in byte array conversion method.

--- Rusty/Core/Common/Formats.cs
+++ Rusty/Core/Common/Formats.cs
@@ -132,6 +132,12 @@
         {
             if (value is string)
                 return Encoding.Unicode.GetBytes((string)value);
+
+            if (value is byte[])
+                return (byte[])value;
+
+            if (value == null)
+                return new byte[] { };

             var formatter = new BinaryFormatter();
             var writer = new MemoryStream();


more test helper documentation and mooooore stopwatches

--- Test/UnitTests/TestHelper.cs
+++ Test/UnitTests/TestHelper.cs
@@ -1,7 +1,7 @@
 using System;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
-using System.Reflection;

 namespace NoSQL.GraphDB.Test
 {
@@ -10,22 +10,77 @@
     /// </summary>
     public static class TestHelper
     {
+        /// <summary>
+        /// The load action
+        /// </summary>
+        /// <typeparam name="T">Type of the to be tested element</typeparam>
+        /// <returns>An instance of the to be loaded element</returns>
         public delegate T Load<out T>();
+
+        /// <summary>
+        /// The test action
+        /// </summary>
+        /// <typeparam name="T">The type of the to be tested element</typeparam>
+        /// <param name="toBeTestedElement">The to be tested element</param>
         public delegate void Test<in T>(T toBeTestedElement);
+
+        /// <summary>
+        /// The persist action
+        /// </summary>
+        /// <typeparam name="T">The type of the element that should be persisted</typeparam>
+        /// <param name="toBePersistedElement">The to be persisted element</param>
         public delegate void Persist<in T>(T toBePersistedElement);
+
+        /// <summary>
+        /// The reload action
+        /// </summary>
+        /// <typeparam name="T">The type of the element that should be reloaded</typeparam>
+        /// <returns>The reloaded element</returns>
         public delegate T Reload<out T>();
+
+        /// <summary>
+        /// The action that cleans up the mess
+        /// </summary>
         public delegate void Clean();

-
+        /// <summary>
+        /// Executes a test with persistence
+        /// </summary>
+        /// <typeparam name="T">The type of the thing that should be persisted</typeparam>
+        /// <param name="load">The load action</param>
+        /// <param name="test">The test action</param>
+        /// <param name="persist">The persist action</param>
+        /// <param name="reload">The reload action</param>
+        /// <param name="clean">The clean action</param>
         public static void ExecuteTestWithPersistence<T>(Load<T> load, Test<T> test, Persist<T> persist, Reload<T> reload, Clean clean)
         {
             try
             {
+                var sw = Stopwatch.StartNew();
+
                 var toBeTestedElement = load();
+                sw.Stop();
+                Debug.WriteLine(String.Format("LOAD: {0}ms", sw.Elapsed.TotalMilliseconds));
+
+                sw.Restart();
                 test(toBeTestedElement);
+                sw.Stop();
+                Debug.WriteLine(String.Format("TEST: {0}ms", sw.Elapsed.TotalMilliseconds));
+
+                sw.Restart();
                 persist(toBeTestedElement);
+                sw.Stop();
+                Debug.WriteLine(String.Format("PERSIST: {0}ms", sw.Elapsed.TotalMilliseconds));
+
+                sw.Restart();
                 toBeTestedElement = reload();
+                sw.Stop();
+                Debug.WriteLine(String.Format("RELOAD: {0}ms", sw.Elapsed.TotalMilliseconds));
+
+                sw.Restart();
                 test(toBeTestedElement);
+                sw.Stop();
+                Debug.WriteLine(String.Format("RETEST: {0}ms", sw.Elapsed.TotalMilliseconds));
             }
             finally
             {
@@ -36,6 +91,15 @@
             }
         }

+        /// <summary>
+        /// Executes a test with persistence
+        /// </summary>
+        /// <typeparam name="T">The type of the thing that should be persisted</typeparam>
+        /// <param name="load">The load action</param>
+        /// <param name="test">The test action</param>
+        /// <param name="persist">The persist action</param>
+        /// <param name="reload">The reload action</param>
+        /// <param name="saveGameName">The savegame filename</param>
         public static void ExecuteTestWithPersistence<T>(Load<T> load, Test<T> test, Persist<T> persist, Reload<T> reload, String saveGameName)
         {
             try
@@ -48,6 +112,10 @@
             }
         }

+        /// <summary>
+        /// Cleans up a save game
+        /// </summary>
+        /// <param name="pathToSaveGame">The path to the savegame</param>
         public static void Cleanup(String pathToSaveGame)
         {
             var fileName = Path.GetFileName(pathToSaveGame);


Dropped typeEntriesPos from for loop

Dropped typeEntriesPos from for loop

Co-authored-by: Graham Scott <aacecfa6a89ff8dd6defa3f73b9f8b32065689a1@users.noreply.github.com>


Seal NamespaceDeclaration

Seal NamespaceDeclaration


Improvement: Fix Grouping of returned artifacts


Add ability to save Untitled USTx after crash


Update InteractivePrompt.cs

Update InteractivePrompt.cs

--- src/InteractivePrompt.cs
+++ src/InteractivePrompt.cs
@@ -220,7 +220,7 @@
 			/*return String.Join(string.Empty, text.AsEnumerable().Select(
 				(c, i) => ((Char.IsUpper(c) || i == 0) ? " " + Char.ToUpper(c).ToString() : c.ToString())
 			)).Trim();*/
-			var converted = new Regex("([a-z]+)([A-Z])").Replace(fieldName, m => m.Groups[1].Value + " " + m.Groups[2].Value).Trim();
+			var converted = new Regex("([a-z]+)([A-Z])").Replace(text, m => m.Groups[1].Value + " " + m.Groups[2].Value).Trim();
 			return converted.Substring(0, 1).ToUpperInvariant() + converted.Substring(1);
 		}
 	}


Update InteractivePrompt.cs

Update InteractivePrompt.cs

--- src/InteractivePrompt.cs
+++ src/InteractivePrompt.cs
@@ -1,5 +1,8 @@
+using System;
 using System.Windows.Forms;
 using System.Drawing;
+using System.Collections.Generic;
+using System.Linq;

 namespace HallLibrary.Extensions
 {


Change assert

Change assert

--- Tests/Http/AttributeTests.cs
+++ Tests/Http/AttributeTests.cs
@@ -5,6 +5,8 @@
 using Xunit;
 using System.Threading.Tasks;
 using Tests.Helpers;
+using Xunit.Abstractions;
+using System.Linq;

 namespace Tests.Http
 {
@@ -43,7 +45,7 @@

                 var result = await client.GetJsonResponseAsync("api/people/123/usingJsonApiAttributeFilter");

-                Assert.NotNull(result["data"]["attributes"]["first-name"]);
+                Assert.NotEmpty(result["data"]["attributes"].Children());
             }
         }
     }


Changed expected result of C6_NullParentEmplyee() to 3 Expects that employee with null ReportsTo should also returned

git-svn-id: 1800f71f313d917366f95485fa960eed04b40598@597 33146b6e-df29-0410-a1ca-39be37fb9416

--- Tests/Test_NUnit/ReadTest.cs
+++ Tests/Test_NUnit/ReadTest.cs
@@ -188,7 +188,7 @@
                         };

             var list = query.ToList();
-            Assert.AreEqual(2, list.Count);
+            Assert.AreEqual(3, list.Count);
         }


Call Js before submit

Call Js before submit

--- WUI/Views/Race/Create.cshtml
+++ WUI/Views/Race/Create.cshtml
@@ -80,11 +80,7 @@

-        <input id="Créer les points" type="button" value="Ajouter les points à la course" onclick="save();"  class="btn btn-default"/>
-
-

-

-       <button type="submit" value="Créer la course" class="btn btn-default">Créer la course</button>
+       <button type="submit" value="Créer la course" class="btn btn-default" onclick="save();">Créer la course</button>
 }


Update BaseTest to be compatible with .NET 3.5

--- runtime/CSharp/Antlr4.Runtime.Test/BaseTest.cs
+++ runtime/CSharp/Antlr4.Runtime.Test/BaseTest.cs
@@ -5,14 +5,12 @@
     using System.Text;
     using Antlr4.Runtime.Misc;
     using Microsoft.VisualStudio.TestTools.UnitTesting;
+    using Microsoft.Win32;
     using Directory = System.IO.Directory;
     using DirectoryInfo = System.IO.DirectoryInfo;
     using File = System.IO.File;
     using IOException = System.IO.IOException;
     using Path = System.IO.Path;
-    using RegistryHive = Microsoft.Win32.RegistryHive;
-    using RegistryKey = Microsoft.Win32.RegistryKey;
-    using RegistryView = Microsoft.Win32.RegistryView;
     using StreamReader = System.IO.StreamReader;
     using TextReader = System.IO.TextReader;
     using Thread = System.Threading.Thread;
@@ -70,6 +68,45 @@
             tmpdir = dir;
         }

+        protected static string WindowsFolder
+        {
+            get
+            {
+#if NET_4_0
+                return Environment.GetFolderPath(Environment.SpecialFolder.Windows);
+#else
+                string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);
+                return Path.GetDirectoryName(systemFolder);
+#endif
+            }
+        }
+
+        protected static string UserProfile
+        {
+            get
+            {
+#if NET_4_0
+                return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+#else
+                string documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+                return Path.GetDirectoryName(documentsFolder);
+#endif
+            }
+        }
+
+        protected static string PathCombine(params string[] paths)
+        {
+#if NET_4_0
+            return Path.Combine(paths);
+#else
+            string result = paths[0];
+            for (int i = 1; i < paths.Length; i++)
+                result = Path.Combine(result, paths[i]);
+
+            return result;
+#endif
+        }
+
         /** Wow! much faster than compiling outside of VM. Finicky though.
          *  Had rules called r and modulo. Wouldn't compile til I changed to 'a'.
          */
@@ -78,8 +115,7 @@
             DirectoryInfo outputDir = new DirectoryInfo(tmpdir);
             try
             {
-                string windows = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
-                string compiler = Path.Combine(windows, "Microsoft.NET", "Framework64", "v4.0.30319", "csc.exe");
+                string compiler = PathCombine(WindowsFolder, "Microsoft.NET", "Framework64", "v4.0.30319", "csc.exe");

                 List<string> args = new List<string>();
                 args.AddRange(getCompileOptions());
@@ -114,7 +150,7 @@
                     args.Insert(1, "/out:Parser.dll");
                 }

-                System.Diagnostics.Process process = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(compiler, '"' + string.Join("\" \"", args) + '"')
+                System.Diagnostics.Process process = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(compiler, '"' + Utils.Join("\" \"", args) + '"')
                 {
                     UseShellExecute = false,
                     CreateNoWindow = true,
@@ -132,12 +168,12 @@
                 stderr.join();
                 if (stdout.ToString().Length > 0)
                 {
-                    Console.Error.WriteLine("compile stdout from: " + string.Join(" ", args));
+                    Console.Error.WriteLine("compile stdout from: " + Utils.Join(" ", args));
                     Console.Error.WriteLine(stdout);
                 }
                 if (stderr.ToString().Length > 0)
                 {
-                    Console.Error.WriteLine("compile stderr from: " + string.Join(" ", args));
+                    Console.Error.WriteLine("compile stderr from: " + Utils.Join(" ", args));
                     Console.Error.WriteLine(stderr);
                 }
                 int ret = process.ExitCode;
@@ -190,7 +226,11 @@
             get
             {
                 string javaKey = "SOFTWARE\\JavaSoft\\Java Runtime Environment";
+#if NET_4_0
                 using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Default).OpenSubKey(javaKey))
+#else
+                using (var baseKey = Registry.LocalMachine.OpenSubKey(javaKey))
+#endif
                 {
                     string currentVersion = baseKey.GetValue("CurrentVersion").ToString();
                     using (var homeKey = baseKey.OpenSubKey(currentVersion))
@@ -205,7 +245,7 @@
             {
                 string mavenHome = Environment.GetEnvironmentVariable("M2_HOME");
                 if (!Directory.Exists(mavenHome))
-                    mavenHome = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".m2");
+                    mavenHome = Path.Combine(UserProfile, ".m2");

                 return mavenHome;
             }
@@ -213,7 +253,7 @@

         protected virtual string GetMavenArtifact(string groupId, string artifactId, string version, string classifier = null)
         {
-            string folder = Path.Combine(MavenHome, "repository", groupId.Replace('.', Path.DirectorySeparatorChar), artifactId, version);
+            string folder = PathCombine(MavenHome, "repository", groupId.Replace('.', Path.DirectorySeparatorChar), artifactId, version);
             string fileNameFormat = string.IsNullOrEmpty(classifier) ? "{0}-{1}.jar" : "{0}-{1}-{2}.jar";
             string fileName = string.Format(fileNameFormat, artifactId, version, classifier);
             return Path.Combine(folder, fileName);
@@ -226,7 +266,7 @@
             writeFile(tmpdir, fileName, grammarStr);
             try
             {
-                string compiler = Path.Combine(JavaHome, "bin", "java.exe");
+                string compiler = PathCombine(JavaHome, "bin", "java.exe");

                 List<string> classpath = new List<string>();
                 classpath.Add(GetMavenArtifact("com.tunnelvisionlabs", "antlr4-csharp", "4.0.1-SNAPSHOT"));
@@ -237,7 +277,7 @@

                 List<string> options = new List<string>();
                 options.Add("-cp");
-                options.Add(string.Join(";", classpath));
+                options.Add(Utils.Join(";", classpath));
                 options.Add("org.antlr.v4.Tool");

                 options.AddRange(extraOptions);
@@ -248,7 +288,7 @@
                 options.Add("-Dlanguage=CSharp");
                 options.Add(grammarFileName);

-                System.Diagnostics.Process process = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(compiler, '"' + string.Join("\" \"", options) + '"')
+                System.Diagnostics.Process process = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(compiler, '"' + Utils.Join("\" \"", options) + '"')
                 {
                     UseShellExecute = false,
                     CreateNoWindow = true,
@@ -266,12 +306,12 @@
                 stderr.join();
                 if (stdout.ToString().Length > 0)
                 {
-                    Console.Error.WriteLine("compile stdout from: " + string.Join(" ", options));
+                    Console.Error.WriteLine("compile stdout from: " + Utils.Join(" ", options));
                     Console.Error.WriteLine(stdout);
                 }
                 if (stderr.ToString().Length > 0)
                 {
-                    Console.Error.WriteLine("compile stderr from: " + string.Join(" ", options));
+                    Console.Error.WriteLine("compile stderr from: " + Utils.Join(" ", options));
                     Console.Error.WriteLine(stderr);
                 }
                 int ret = process.ExitCode;
@@ -370,7 +410,7 @@
             if (parserName != null)
             {
                 files.Add(parserName + ".cs");
-                ISet<string> optionsSet = new HashSet<string>(extraOptions);
+                HashSet<string> optionsSet = new HashSet<string>(extraOptions);
                 if (!optionsSet.Contains("-no-listener"))
                 {
                     files.Add(grammarFileName.Substring(0, grammarFileName.LastIndexOf('.')) + "BaseListener.cs");


Issue 1210 fix toBitmap handling of stride

git-svn-id: b10e9e05a96f28f96949e4aa4212c55f640c8f96@2225 59b500cc-1b3d-0410-9834-0bbf25fbcc57

--- csharp/common/ByteMatrix.cs
+++ csharp/common/ByteMatrix.cs
@@ -137,38 +137,40 @@
 		/// <returns>A black and white bitmap converted from this ByteMatrix.</returns>
 		public Bitmap ToBitmap()
 		{
-			 const byte BLACK = 0;
-			 const byte WHITE = 255;
-			 int width = Width;
-			 int height = Height;
+			const byte BLACK = 0;
+			const byte WHITE = 255;
+			sbyte[][] array = this.Array;
+			int width = this.Width;
+			int height = this.Height;
+			//Here create the Bitmap to the known height, width and format
+			Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
+			//Create a BitmapData and Lock all pixels to be written
+			BitmapData bmpData =
+				bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height),
+										 ImageLockMode.WriteOnly, bmp.PixelFormat);

-			 // create the bitmap and lock the bits because we need the stride
-			 // which is the width of the image and possible padding bytes
-			 var bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
-			 var bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
-			 try
-			 {
-				var pixels = new byte[bmpData.Stride*height];
+			// If you wanted to support formats other than 8bpp, you should use Bitmap.GetPixelFormatSize(bmp.PixelFormat) to adjust the array size
+			byte[] pixels = new byte[bmpData.Stride * height];

-				for (int y = 0; y < height; y++)
-				{
-				   var offset = y*bmpData.Stride;
-				   for (var x = 0; x < width; x++)
-				   {
-					  pixels[offset + x] = this[x, y] ? BLACK : WHITE;
-				   }
-				}
+			int iPixelsCounter = 0;
+			for (int y = 0; y < height; y++)
+			{
+					int offset = y * width;
+					for (int x = 0; x < width; x++)
+					{
+						pixels[iPixelsCounter++] = array[y][x] == BLACK ? BLACK : WHITE;
+					}
+					iPixelsCounter += bmpData.Stride - width;
+			}

-				//Copy the data from the byte array into BitmapData.Scan0
-				Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length);
-			 }
-			 finally
-			 {
-				//Unlock the pixels
-				bmp.UnlockBits(bmpData);
-			 }
+			//Copy the data from the byte array into BitmapData.Scan0
+			System.Runtime.InteropServices.Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length);

-			 return bmp;
+			//Unlock the pixels
+			bmp.UnlockBits(bmpData);
+
+			//Return the bitmap
+			return bmp;
 		}
 	}
 }


Changed LineBasedAssetReferenceParser.cs to process entire file for references

--- src/Cassette/ModuleProcessing/LineBasedAssetReferenceParser.cs
+++ src/Cassette/ModuleProcessing/LineBasedAssetReferenceParser.cs
@@ -33,10 +33,6 @@
                     {
                         asset.AddReference(match.Groups["path"].Value, lineNumber);
                     }
-                    else
-                    {
-                        break;
-                    }
                 }
             }
         }


Remove errant TODO

Remove errant TODO

--- src/Compilers/CSharp/Portable/CommandLine/CommandLineParser.cs
+++ src/Compilers/CSharp/Portable/CommandLine/CommandLineParser.cs
@@ -1136,7 +1136,6 @@
                 OutputFileName = outputFileName,
                 PdbPath = pdbPath,
                 EmitPdb = emitPdb,
-                // TODO: pipe debugInformationFormat through this
                 OutputDirectory = outputDirectory,
                 DocumentationPath = documentationPath,
                 ErrorLogPath = errorLogPath,


Fix reentrancy

Fix reentrancy

--- src/Compilers/Core/Portable/Serialization/ObjectBinderState.cs
+++ src/Compilers/Core/Portable/Serialization/ObjectBinderState.cs
@@ -73,16 +73,19 @@

         public void RegisterTypeReader(Type type, Func<ObjectReader, object> typeReader)
         {
-            int index = _typeReaders.Count;
-            _types.Add(type);
-            _typeReaders.Add(typeReader);
-            _typeToIndex.Add(type, index);
+            if (!_typeToIndex.ContainsKey(type))
+            {
+                int index = _typeReaders.Count;
+                _types.Add(type);
+                _typeReaders.Add(typeReader);
+                _typeToIndex.Add(type, index);

-            // We may be a local copy of the object-binder-state.  Inform the primary
-            // binder of this new registration.  Note: there is no re-entrancy issue here
-            // as we've already updated our local state, so we'll bail out immediately
-            // when we get called back through GetOrAddTypeId.
-            ObjectBinder.RegisterTypeReader(type, typeReader);
+                // We may be a local copy of the object-binder-state.  Inform the primary
+                // binder of this new registration.  Note: there is no re-entrancy issue here
+                // as we've already updated our local state, so we'll bail out immediately
+                // when we get called back through RegisterTypeReader.
+                ObjectBinder.RegisterTypeReader(type, typeReader);
+            }
         }
     }
 }


FIx test code(fix mistake)

FIx test code(fix mistake)

--- src/DotNetBlog.Web/Areas/Api/Controllers/CategoryController.cs
+++ src/DotNetBlog.Web/Areas/Api/Controllers/CategoryController.cs
@@ -24,7 +24,6 @@
         [HttpGet("all")]
         public async Task<IActionResult> All()
         {
-            throw new Exception("ALO");
             var list = await CategoryService.All();

             return Success(list);


Improve test method name for clarity.

Improve test method name for clarity.

--- src/Fixie.Tests/Execution/RunnerAppDomainCommunicationTests.cs
+++ src/Fixie.Tests/Execution/RunnerAppDomainCommunicationTests.cs
@@ -10,7 +10,7 @@
             typeof(Listener).ShouldBeSafeAppDomainCommunicationInterface();
         }

-        public void ShouldAllowRunnersToPerformTestDiscoveryAndExecutionThroughExecutionProxy()
+        public void ShouldAllowRunnersInOtherAppDomainsToPerformTestDiscoveryAndExecutionThroughExecutionProxy()
         {
             typeof(ExecutionProxy).ShouldBeSafeAppDomainCommunicationInterface();
         }


Update anti forgery helper as extension methods

--- src/GeekLearning.Test.Integration/Helpers/AntiForgeryHelper.cs
+++ src/GeekLearning.Test.Integration/Helpers/AntiForgeryHelper.cs
@@ -6,7 +6,7 @@
     using System.Threading.Tasks;

     // http://www.stefanhendriks.com/2016/05/11/integration-testing-your-asp-net-core-app-dealing-with-anti-request-forgery-csrf-formdata-and-cookies/
-    public class AntiForgeryHelper
+    public static class AntiForgeryHelper
     {
         public static string ExtractAntiForgeryToken(string htmlResponseText)
         {
@@ -16,7 +16,7 @@
             return match.Success ? match.Groups[1].Captures[0].Value : null;
         }

-        public static async Task<string> ExtractAntiForgeryToken(HttpResponseMessage response)
+        public static async Task<string> ExtractAntiForgeryTokenAsync(this HttpResponseMessage response)
         {
             string responseAsString = await response.Content.ReadAsStringAsync();
             return await Task.FromResult(ExtractAntiForgeryToken(responseAsString));


Add export for InlineCommentMarginEnabled

--- src/GitHub.InlineReviews/Margins/InlineCommentMarginEnabled.cs
+++ src/GitHub.InlineReviews/Margins/InlineCommentMarginEnabled.cs
@@ -5,8 +5,8 @@

 namespace GitHub.InlineReviews.Margins
 {
-    [Export(typeof(EditorOptionDefinition))]
-    [Name(OptionName)]
+    [Export(typeof(InlineCommentMarginEnabled))]
+    [Export(typeof(EditorOptionDefinition)), Name(OptionName)]
     public class InlineCommentMarginEnabled : ViewOptionDefinition<bool>
     {
         const string OptionName = "TextViewHost/InlineCommentMarginEnabled";


Reduce member accessibility.

Reduce member accessibility.

--- src/InteractiveWindow/Editor/InteractiveWindow.UIThreadOnly.cs
+++ src/InteractiveWindow/Editor/InteractiveWindow.UIThreadOnly.cs
@@ -80,17 +80,17 @@

             private readonly OutputBuffer _buffer;

-            private readonly ITextBuffer OutputBuffer;
-            private readonly ITextBuffer StandardInputBuffer;
-            private ITextBuffer CurrentLanguageBuffer;
-
-            private readonly TextWriter OutputWriter;
-            private readonly InteractiveWindowWriter ErrorOutputWriter;
+            public readonly ITextBuffer OutputBuffer;
+            public readonly ITextBuffer StandardInputBuffer;
+            public ITextBuffer CurrentLanguageBuffer { get; private set; }
+
+            public readonly TextWriter OutputWriter;
+            public readonly InteractiveWindowWriter ErrorOutputWriter;

             // the language engine and content type of the active submission:
-            private readonly IInteractiveEvaluator Evaluator;
-
-            private readonly IWpfTextView TextView;
+            public readonly IInteractiveEvaluator Evaluator;
+
+            public readonly IWpfTextView TextView;

             /// <remarks>Always access through <see cref="EditorOperations"/>.</remarks>
             private IEditorOperations _editorOperations;
@@ -195,7 +195,7 @@
                 State == State.ResettingAndReadingStandardInput;

             /// Implements <see cref="IInteractiveWindowOperations.ResetAsync"/>.
-            private async Task<ExecutionResult> ResetAsync(bool initialize)
+            public async Task<ExecutionResult> ResetAsync(bool initialize)
             {
                 try
                 {
@@ -235,18 +235,20 @@
             }

             /// Implements <see cref="IInteractiveWindow.Close"/>.
-            private void Close()
+            public void Close()
             {
                 TextView.Caret.PositionChanged -= _window.CaretPositionChanged;
                 TextView.Close();
             }

-            private void ClearHistory()
+            /// Implements <see cref="IInteractiveWindowOperations.ClearHistory"/>.
+            public void ClearHistory()
             {
                 _history.Clear();
             }

-            private void ClearView()
+            /// Implements <see cref="IInteractiveWindowOperations.ClearView"/>.
+            public void ClearView()
             {
                 if (ReadingStandardInput)
                 {
@@ -315,7 +317,8 @@
                 }
             }

-            private async Task<TextReader> ReadStandardInputAsync()
+            /// Implements the core of <see cref="IInteractiveWindow.ReadStandardInput"/>.
+            public async Task<TextReader> ReadStandardInputAsync()
             {
                 try
                 {
@@ -440,7 +443,7 @@
             }

             /// Implements <see cref="IInteractiveWindow.InsertCode"/>.
-            private void InsertCode(string text)
+            public void InsertCode(string text)
             {
                 if (ReadingStandardInput)
                 {
@@ -463,7 +466,7 @@
             }

             /// Implements the core of <see cref="IInteractiveWindow.SubmitAsync"/>.
-            private void Submit(PendingSubmission[] pendingSubmissions)
+            public void Submit(PendingSubmission[] pendingSubmissions)
             {
                 if (!ReadingStandardInput)
                 {
@@ -509,13 +512,13 @@
             }

             /// Implements <see cref="IInteractiveWindow.FlushOutput"/>.
-            private void FlushOutput()
+            public void FlushOutput()
             {
                 _buffer.Flush();
             }

             /// Implements <see cref="IInteractiveWindow.AddInput"/>.
-            private void AddInput(string command)
+            public void AddInput(string command)
             {
                 // If the language buffer is readonly then input can not be added. Return immediately.
                 // The language buffer gets marked as readonly in SubmitAsync method when input on the prompt
@@ -570,8 +573,9 @@

             ///
             /// Pastes from the clipboard into the text view
+            /// Implements <see cref="IInteractiveWindowOperations.Paste"/>.
             ///
-            private bool Paste()
+            public bool Paste()
             {
                 MoveCaretToClosestEditableBuffer();

@@ -674,7 +678,7 @@
                 TextView.Caret.EnsureVisible();
             }

-            private void PrepareForInput()
+            public void PrepareForInput()
             {
                 _buffer.Flush();

@@ -928,7 +932,7 @@
             /// WARNING: this has to be the only method that writes to the output buffer so that
             /// the output buffering counters are kept in sync.
             ///
-            private void AppendOutput(IEnumerable<string> output)
+            internal void AppendOutput(IEnumerable<string> output)
             {
                 Debug.Assert(output.Any());

@@ -1004,7 +1008,8 @@
                 PrepareForInput();
             }

-            private async Task ExecuteInputAsync()
+            /// Implements <see cref="IInteractiveWindowOperations.ExecuteInput"/>.
+            public async Task ExecuteInputAsync()
             {
                 try
                 {
@@ -1369,7 +1374,7 @@
             /// DO NOT REGISTER THIS AS AN EVENT HANDLER - it needs to happen on the UI thread.
             /// Use <see cref="InteractiveWindow.ProjectionBufferChanged"/>.
             /// </remarks>
-            private void ProjectionBufferChangedInternal(object sender, TextContentChangedEventArgs e)
+            internal void ProjectionBufferChangedInternal(object sender, TextContentChangedEventArgs e)
             {
                 // this is an edit performed in this event:
                 if (e.EditTag == SuppressPromptInjectionTag)
@@ -1614,7 +1619,7 @@
             /// DO NOT REGISTER THIS AS AN EVENT HANDLER - it needs to happen on the UI thread.
             /// Use <see cref="InteractiveWindow.CaretPositionChanged"/>.
             /// </remarks>
-            private void CaretPositionChangedInternal(object sender, CaretPositionChangedEventArgs e)
+            internal void CaretPositionChangedInternal(object sender, CaretPositionChangedEventArgs e)
             {
                 // make sure language buffer exist
                 if (CurrentLanguageBuffer == null)
@@ -1766,7 +1771,8 @@
                 return textToInsert;
             }

-            private void Cancel()
+            /// Implements <see cref="IInteractiveWindowOperations.Cancel"/>.
+            public void Cancel()
             {
                 ClearInput();
                 EditorOperations.MoveToEndOfDocument(false);
@@ -1786,7 +1792,8 @@
                 }
             }

-            private void HistoryPrevious(string search)
+            /// Implements <see cref="IInteractiveWindowOperations.HistoryPrevious"/>.
+            public void HistoryPrevious(string search)
             {
                 if (CurrentLanguageBuffer == null)
                 {
@@ -1807,7 +1814,8 @@
                 }
             }

-            private void HistoryNext(string search)
+            /// Implements <see cref="IInteractiveWindowOperations.HistoryNext"/>.
+            public void HistoryNext(string search)
             {
                 if (CurrentLanguageBuffer == null)
                 {
@@ -1866,13 +1874,15 @@
                 }
             }

-            private void HistorySearchNext()
+            /// Implements <see cref="IInteractiveWindowOperations.HistorySearchNext"/>.
+            public void HistorySearchNext()
             {
                 EnsureHistorySearch();
                 HistoryNext(_historySearch);
             }

-            private void HistorySearchPrevious()
+            /// Implements <see cref="IInteractiveWindowOperations.HistorySearchPrevious"/>.
+            public void HistorySearchPrevious()
             {
                 EnsureHistorySearch();
                 HistoryPrevious(_historySearch);
@@ -1902,8 +1912,9 @@

             ///
             /// Moves to the beginning of the line.
+            /// Implements <see cref="IInteractiveWindowOperations.Home"/>.
             ///
-            private void Home(bool extendSelection)
+            public void Home(bool extendSelection)
             {
                 var caret = TextView.Caret;

@@ -1957,8 +1968,9 @@

             ///
             /// Moves to the end of the line.
+            /// Implements <see cref="IInteractiveWindowOperations.End"/>.
             ///
-            private void End(bool extendSelection)
+            public void End(bool extendSelection)
             {
                 var caret = TextView.Caret;

@@ -1990,7 +2002,8 @@
                 }
             }

-            private void SelectAll()
+            /// Implements <see cref="IInteractiveWindowOperations.SelectAll"/>.
+            public void SelectAll()
             {
                 SnapshotSpan? span = GetContainingRegion(TextView.Caret.Position.BufferPosition);

@@ -2094,7 +2107,8 @@
                         textBuffer).Value);
             }

-            private bool Delete()
+            /// Implements <see cref="IInteractiveWindowOperations.Delete"/>.
+            public bool Delete()
             {
                 _historySearch = null;
                 bool handled = false;
@@ -2239,7 +2253,8 @@
                 minPromptLength = maxPromptLength = promptSpan.Length;
             }

-            private void Cut()
+            /// Implements <see cref="IInteractiveWindowOperations.Cut"/>.
+            public void Cut()
             {
                 if (TextView.Selection.IsEmpty)
                 {
@@ -2321,7 +2336,8 @@
                 }
             }

-            private void Copy()
+            /// Implements <see cref="IInteractiveWindowOperations2.Copy"/>.
+            public void Copy()
             {
                 CopySelection();
             }
@@ -2407,8 +2423,9 @@
                 return builder;
             }

-            private bool Backspace()
-           {
+            /// Implements <see cref="IInteractiveWindowOperations.Backspace"/>.
+            public bool Backspace()
+            {
                 bool handled = false;
                 if (!TextView.Selection.IsEmpty)
                 {
@@ -2483,7 +2500,8 @@
                 return result;
             }

-            private bool TrySubmitStandardInput()
+            /// Implements <see cref="IInteractiveWindowOperations.TrySubmitStandardInput"/>.
+            public bool TrySubmitStandardInput()
             {
                 _historySearch = null;
                 if (ReadingStandardInput)
@@ -2554,12 +2572,14 @@
                 AppendProjectionSpans(promptSpan, inputSpan);
             }

-            private bool BreakLine()
+            /// Implements <see cref="IInteractiveWindowOperations.BreakLine"/>.
+            public bool BreakLine()
             {
                 return HandlePostServicesReturn(false);
             }

-            private bool Return()
+            /// Implements <see cref="IInteractiveWindowOperations.Return"/>.
+            public bool Return()
             {
                 _historySearch = null;
                 return HandlePostServicesReturn(true);
@@ -2686,20 +2706,23 @@

             #region Output

-            private Span Write(string text)
+            /// Implements <see cref="IInteractiveWindow.Write(string)"/>.
+            public Span Write(string text)
             {
                 int result = _buffer.Write(text);
                 return new Span(result, (text != null ? text.Length : 0));
             }

-            private Span WriteLine(string text)
+            /// Implements <see cref="IInteractiveWindow.WriteLine(string)"/>.
+            public Span WriteLine(string text)
             {
                 int result = _buffer.Write(text);
                 _buffer.Write(_lineBreakString);
                 return new Span(result, (text != null ? text.Length : 0) + _lineBreakString.Length);
             }

-            private Span WriteError(string text)
+            /// Implements <see cref="IInteractiveWindow.WriteError(string)"/>.
+            public Span WriteError(string text)
             {
                 int result = _buffer.Write(text);
                 var res = new Span(result, (text != null ? text.Length : 0));
@@ -2707,7 +2730,8 @@
                 return res;
             }

-            private Span WriteErrorLine(string text)
+            /// Implements <see cref="IInteractiveWindow.WriteErrorLine(string)"/>.
+            public Span WriteErrorLine(string text)
             {
                 int result = _buffer.Write(text);
                 _buffer.Write(_lineBreakString);
@@ -2716,7 +2740,8 @@
                 return res;
             }

-            private void Write(UIElement element)
+            /// Implements <see cref="IInteractiveWindow.Write(UIElement)"/>.
+            public void Write(UIElement element)
             {
                 if (element == null)
                 {


Added comment to RegisterContext

Added comment to RegisterContext

--- src/Lix.Commons/Specifications/SpecificationExecutorFactory.cs
+++ src/Lix.Commons/Specifications/SpecificationExecutorFactory.cs
@@ -8,6 +8,11 @@
     {
         private readonly IDictionary<Type, Func<object>> contexts = new Dictionary<Type, Func<object>>();

+        /// <summary>
+        /// Registers a context that is used in the current instance of the <see cref="SpecificationExecutorFactory"/>.
+        /// </summary>
+        /// <param name="func">A function to be called to obtain the context.</param>
+        /// <typeparam name="TContext">The type of the context to register.</typeparam>
         public void RegisterContext<TContext>(Func<object> func)
         {
             this.contexts.Add(typeof(TContext), func);
@@ -39,7 +44,7 @@
         /// <returns>
         /// An instance of the <see cref="ISpecificationExecutor{TEntity}"/>.
         /// </returns>
-        ///<exception cref="InvalidOperationException"></exception>
+        /// <exception cref="InvalidOperationException"></exception>
         public ISpecificationExecutor<TEntity> GetExecutor<TSpecification, TEntity>(TSpecification specification, bool intercept)
             where TSpecification : ISpecification
             where TEntity : class


Hockey app is throwing errors in this spot for some reason.

--- src/Neptunium/Core/Stations/StationSupplementaryDataManager.cs
+++ src/Neptunium/Core/Stations/StationSupplementaryDataManager.cs
@@ -108,10 +108,10 @@
             }
             catch (Exception ex)
             {
-                Dictionary<string, string> data = new Dictionary<string, string>();
-                data.Add("BackgroundURI", uri.ToString());
+                //Dictionary<string, string> data = new Dictionary<string, string>();
+                //data.Add("BackgroundURI", uri.ToString());

-                Microsoft.HockeyApp.HockeyClient.Current.TrackException(ex, data);
+               // Microsoft.HockeyApp.HockeyClient.Current.TrackException(ex, data);
             }
             finally
             {


Changed the lifetime of the cookie to one year instead of session lifetime

--- src/Org.NerdBeers/Org.NerdBeers.Web/Modules/_NerdBeerModule.cs
+++ src/Org.NerdBeers/Org.NerdBeers.Web/Modules/_NerdBeerModule.cs
@@ -52,7 +52,7 @@
             });
             After.AddItemToEndOfPipeline(ctx =>
             {
-                ctx.Response.AddCookie("NerdGuid",Model.NerdGuid);
+                ctx.Response.AddCookie("NerdGuid",Model.NerdGuid,DateTime.Now.AddYears(1));
             });
         }


Fixed spelling

Fixed spelling

--- Test/Miruken.Tests/Callback/HandlerTests.cs
+++ Test/Miruken.Tests/Callback/HandlerTests.cs
@@ -1244,13 +1244,13 @@
         private class CustomHandler : Handler
         {
             [Handles]
-            public void HandleFooImplict(Foo foo)
+            public void HandleFooImplicit(Foo foo)
             {
                 ++foo.Handled;
             }

             [Handles]
-            public bool? HandleSpecialFooImplict(SpecialFoo foo, IHandler composer)
+            public bool? HandleSpecialFooImplicit(SpecialFoo foo, IHandler composer)
             {
                 ++foo.Handled;
                 foo.HasComposer = true;
@@ -1285,7 +1285,7 @@
             }

             [Handles]
-            public static void StaticHandleFooImplict(Foo foo)
+            public static void StaticHandleFooImplicit(Foo foo)
             {
                 ++foo.Handled;
             }


174.1: LineParameters

174.1: LineParameters

--- src/PixelFarm/PixelFarm.MiniAgg/07_Lines/1.3_LineParameters.cs
+++ src/PixelFarm/PixelFarm.MiniAgg/07_Lines/1.3_LineParameters.cs
@@ -23,11 +23,13 @@
     public struct LineParameters
     {
         //---------------------------------------------------------------------
-        public readonly int x1, y1, x2, y2, dx, dy, sx, sy;
+
+        public readonly int x1, y1, x2, y2, len;
+        readonly byte octant;
         public readonly bool vertical;
-        public readonly int inc;
-        public readonly int len;
-        public readonly int octant;
+        public readonly short inc;
+
+
         // The number of the octant is determined as a 3-bit value as follows:
         // bit 0 = vertical flag
         // bit 1 = sx < 0
@@ -51,29 +53,49 @@
         //   [2]          |          [3]
         //               <3>
         //                                                        0,1,2,3,4,5,6,7
-        public static readonly byte[] s_orthogonal_quadrant = { 0, 0, 1, 1, 3, 3, 2, 2 };
-        public static readonly byte[] s_diagonal_quadrant = { 0, 1, 2, 1, 0, 3, 2, 3 };
+        static readonly byte[] s_orthogonal_quadrant = { 0, 0, 1, 1, 3, 3, 2, 2 };
+        static readonly byte[] s_diagonal_quadrant = { 0, 1, 2, 1, 0, 3, 2, 3 };
         //---------------------------------------------------------------------
-        public LineParameters(int x1_, int y1_, int x2_, int y2_, int len_)
+        public LineParameters(int x1, int y1, int x2, int y2, int len)
         {
-            x1 = (x1_);
-            y1 = (y1_);
-            x2 = (x2_);
-            y2 = (y2_);
-            dx = (Math.Abs(x2_ - x1_));
-            dy = (Math.Abs(y2_ - y1_));
-            sx = ((x2_ > x1_) ? 1 : -1);
-            sy = ((y2_ > y1_) ? 1 : -1);
-            vertical = (dy >= dx);
-            inc = (vertical ? sy : sx);
-            len = (len_);
-            octant = ((sy & 4) | (sx & 2) | (vertical ? 1 : 0));
+            this.x1 = (x1);
+            this.y1 = (y1);
+            this.x2 = (x2);
+            this.y2 = (y2);
+
+            int sx = ((x2 > x1) ? 1 : -1); //sx =1 or -1
+            int sy = ((y2 > y1) ? 1 : -1); //sy = 1 or -1
+
+
+            //assign vertical value and evaluate inc value ***
+            this.inc = (short)((vertical = ((Math.Abs(x2 - x1)) >= (Math.Abs(y2 - y1)))) ?
+                        sy :
+                        sx); //inc is 1 or -1
+
+            this.len = (len);
+
+            //1 byte is enough
+            this.octant = (byte)((sy & 4) | (sx & 2) | (vertical ? 1 : 0));
         }

         //---------------------------------------------------------------------
         public uint OrthogonalQuadrant { get { return s_orthogonal_quadrant[octant]; } }
         public uint DiagonalQuadrant { get { return s_diagonal_quadrant[octant]; } }

+        public int dx
+        {
+            get
+            {
+                return Math.Abs(x2 - x1);
+            }
+        }
+        public int dy
+        {
+            get
+            {
+                return Math.Abs(y2 - y1);
+            }
+        }
         //---------------------------------------------------------------------
         public bool IsSameOrthogonalQuadrant(LineParameters lp)
         {


Added async support for GetImageKey

Added async support for GetImageKey

--- Test2d.UI.EtoForms.Shared/Forms/MainForm.cs
+++ Test2d.UI.EtoForms.Shared/Forms/MainForm.cs
@@ -54,7 +54,7 @@
             };
             _context.InitializeEditor(new Test2d.TraceLog());
             _context.Editor.Renderers[0].State.DrawShapeState = Test2d.ShapeState.Visible;
-            _context.Editor.GetImageKey = async () => GetImageKey();
+            _context.Editor.GetImageKey = async () => await GetImageKey();

             _state = new Test2d.ZoomState(_context, this.InvalidateContainer);

@@ -893,7 +893,7 @@
         ///
         /// </summary>
         /// <returns></returns>
-        public string GetImageKey()
+        public Task<string> GetImageKey()
         {
             var dlg = new OpenFileDialog();
             dlg.Filters.Add(new FileDialogFilter("All", ".*"));
@@ -903,7 +903,7 @@
                 var path = dlg.FileName;
                 var bytes = System.IO.File.ReadAllBytes(path);
                 var key = _context.Editor.Project.AddImageFromFile(path, bytes);
-                return key;
+                return Task.Run(() => key);
             }
             return null;
         }