Add virtual overrides for pivotpointshighlow computations (#5987)

* Add base class for pivotpointshighlow

* abstracts do not work well with python switch to virtuals and use pivotpointhighlow as base implementation

* added missing documentatino header

* moved reset back to original location

--- Indicators/PivotPointsHighLow.cs
+++ Indicators/PivotPointsHighLow.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
  * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
  *
@@ -26,8 +26,8 @@
     /// </summary>
     public class PivotPointsHighLow : IndicatorBase<IBaseDataBar>, IIndicatorWarmUpPeriodProvider
     {
-        private readonly int _lengthHigh;
-        private readonly int _lengthLow;
+        private readonly int _surroundingBarsCountForHighPoint;
+        private readonly int _surroundingBarsCountForLowPoint;
         private readonly RollingWindow<IBaseDataBar> _windowHighs;
         private readonly RollingWindow<IBaseDataBar> _windowLows;
         // Stores information of that last N pivot points
@@ -46,40 +46,42 @@
         /// <summary>
         /// Required period, in data points, for the indicator to be ready and fully initialized.
         /// </summary>
-        public int WarmUpPeriod { get; }
+        public int WarmUpPeriod { get; protected set; }

         /// <summary>
         /// Creates a new instance of <see cref="PivotPointsHighLow"/> indicator with an equal high and low length
         /// </summary>
-        /// <param name="length">The length parameter here defines the number of surround bars that we compare against the current bar high and lows for the max/min </param>
+        /// <param name="surroundingBarsCount">The length parameter here defines the number of surrounding bars that we compare against the current bar high and lows for the max/min </param>
         /// <param name="lastStoredValues">The number of last stored indicator values</param>
-        public PivotPointsHighLow(int length, int lastStoredValues = 100)
-            : this($"PivotPointsHighLow({length})", length, length, lastStoredValues)
+        public PivotPointsHighLow(int surroundingBarsCount, int lastStoredValues = 100)
+            : this($"PivotPointsHighLow({surroundingBarsCount})", surroundingBarsCount, surroundingBarsCount, lastStoredValues)
         { }

         /// <summary>
         /// Creates a new instance of <see cref="PivotPointsHighLow"/> indicator
         /// </summary>
-        /// <param name="lengthHigh">The number of surrounding bars whose high values should be less than the current bar's for the bar high to be marked as high pivot point</param>
-        /// <param name="lengthLow">The number of surrounding bars whose low values should be more than the current bar's for the bar low to be marked as low pivot point</param>
+        /// <param name="surroundingBarsCountForHighPoint">The number of surrounding bars whose high values should be less than the current bar's for the bar high to be marked as high pivot point</param>
+        /// <param name="surroundingBarsCountForLowPoint">The number of surrounding bars whose low values should be more than the current bar's for the bar low to be marked as low pivot point</param>
         /// <param name="lastStoredValues">The number of last stored indicator values</param>
-        public PivotPointsHighLow(int lengthHigh, int lengthLow, int lastStoredValues = 100)
-            : this($"PivotPointsHighLow({lengthHigh},{lengthLow})", lengthHigh, lengthLow, lastStoredValues)
+        public PivotPointsHighLow(int surroundingBarsCountForHighPoint, int surroundingBarsCountForLowPoint, int lastStoredValues = 100)
+            : this($"PivotPointsHighLow({surroundingBarsCountForHighPoint},{surroundingBarsCountForLowPoint})", surroundingBarsCountForHighPoint, surroundingBarsCountForLowPoint, lastStoredValues)
         { }

+
         /// <summary>
         /// Creates a new instance of <see cref="PivotPointsHighLow"/> indicator
         /// </summary>
         /// <param name="name">The name of an indicator</param>
-        /// <param name="lengthHigh">The number of surrounding bars whose high values should be less than the current bar's for the bar high to be marked as high pivot point</param>
-        /// <param name="lengthLow">The number of surrounding bars whose low values should be more than the current bar's for the bar low to be marked as low pivot point</param>
+        /// <param name="surroundingBarsCountForHighPoint">The number of surrounding bars whose high values should be less than the current bar's for the bar high to be marked as high pivot point</param>
+        /// <param name="surroundingBarsCountForLowPoint">The number of surrounding bars whose low values should be more than the current bar's for the bar low to be marked as low pivot point</param>
         /// <param name="lastStoredValues">The number of last stored indicator values</param>
-        public PivotPointsHighLow(string name, int lengthHigh, int lengthLow, int lastStoredValues = 100) : base(name)
-        {
-            _lengthHigh = lengthHigh;
-            _lengthLow = lengthLow;
-            _windowHighs = new RollingWindow<IBaseDataBar>(2 * lengthHigh + 1);
-            _windowLows = new RollingWindow<IBaseDataBar>(2 * _lengthLow + 1);
+        public PivotPointsHighLow(string name, int surroundingBarsCountForHighPoint, int surroundingBarsCountForLowPoint, int lastStoredValues = 100)
+            : base(name)
+        {
+            _surroundingBarsCountForHighPoint = surroundingBarsCountForHighPoint;
+            _surroundingBarsCountForLowPoint = surroundingBarsCountForLowPoint;
+            _windowHighs = new RollingWindow<IBaseDataBar>(2 * surroundingBarsCountForHighPoint + 1);
+            _windowLows = new RollingWindow<IBaseDataBar>(2 * _surroundingBarsCountForLowPoint + 1);
             _windowPivotPoints = new RollingWindow<PivotPoint>(lastStoredValues);
             WarmUpPeriod = Math.Max(_windowHighs.Size, _windowLows.Size);
         }
@@ -94,65 +96,104 @@
             _windowHighs.Add(input);
             _windowLows.Add(input);

-            PivotPoint high = null, low = null;
+            PivotPoint highPoint = null, lowPoint = null;

             if (_windowHighs.IsReady)
             {
-                var isHigh = true;
-                var middlePoint = _windowHighs[_lengthHigh];
-                for (var k = 0; k < _windowHighs.Size && isHigh; k++)
+                highPoint = FindNextHighPivotPoint(_windowHighs, _surroundingBarsCountForHighPoint);
+            }
+
+            if (_windowLows.IsReady)
+            {
+                lowPoint = FindNextLowPivotPoint(_windowLows, _surroundingBarsCountForLowPoint);
+            }
+
+            OnNewPivotPointFormed(highPoint);
+            OnNewPivotPointFormed(lowPoint);
+
+            return ConvertToComputedValue(highPoint, lowPoint);
+        }
+
+        /// <summary>
+        /// Looks for the next low pivot point.
+        /// </summary>
+        /// <param name="windowLows">rolling window that tracks the lows</param>
+        /// <param name="midPointIndexOrSurroundingBarsCount">The midpoint index or surrounding bars count for lows</param>
+        /// <returns>pivot point if found else null</returns>
+        protected virtual PivotPoint FindNextLowPivotPoint(RollingWindow<IBaseDataBar> windowLows, int midPointIndexOrSurroundingBarsCount)
+        {
+            var isLow = true;
+            var middlePoint = windowLows[midPointIndexOrSurroundingBarsCount];
+            for (var k = 0; k < windowLows.Size && isLow; k++)
+            {
+                if (k == midPointIndexOrSurroundingBarsCount)
                 {
-                    // Skip the middle point
-                    if (k == _lengthHigh)
-                    {
-                        continue;
-                    }
-
-                    // Check if current high is below middle point high
-                    isHigh = _windowHighs[k].High < middlePoint.High;
+                    continue;
                 }

-                if (isHigh)
+                isLow = windowLows[k].Low > middlePoint.Low;
+            }
+
+            PivotPoint low = null;
+            if (isLow)
+            {
+                low = new PivotPoint(PivotPointType.Low, middlePoint.Low, middlePoint.EndTime);
+            }
+
+            return low;
+        }
+
+        /// <summary>
+        /// Looks for the next high pivot point.
+        /// </summary>
+        /// <param name="windowHighs">rolling window that tracks the highs</param>
+        /// <param name="midPointIndexOrSurroundingBarsCount">The midpoint index or surrounding bars count for highs</param>
+        /// <returns>pivot point if found else null</returns>
+        protected virtual PivotPoint FindNextHighPivotPoint(RollingWindow<IBaseDataBar> windowHighs, int midPointIndexOrSurroundingBarsCount)
+        {
+            var isHigh = true;
+            var middlePoint = windowHighs[midPointIndexOrSurroundingBarsCount];
+            for (var k = 0; k < windowHighs.Size && isHigh; k++)
+            {
+                // Skip the middle point
+                if (k == midPointIndexOrSurroundingBarsCount)
                 {
-                    high = new PivotPoint(PivotPointType.High, middlePoint.High, middlePoint.EndTime);
+                    continue;
                 }
-            }
-
-            if (_windowLows.IsReady)
-            {
-                var isLow = true;
-                var middlePoint = _windowLows[_lengthLow];
-                for (var k = 0; k < _windowLows.Size && isLow; k++)
-                {
-                    if (k == _lengthLow)
-                    {
-                        continue;
-                    }
-
-                    isLow = _windowLows[k].Low > middlePoint.Low;
-                }
-
-                if (isLow)
-                {
-                    low = new PivotPoint(PivotPointType.Low, middlePoint.Low, middlePoint.EndTime);
-                }
-            }
-
-            if (high != null)
-            {
-                OnNewPivotPointFormed(high);
-                if (low != null)
+
+                // Check if current high is below middle point high
+                isHigh = windowHighs[k].High < middlePoint.High;
+            }
+
+            PivotPoint high = null;
+            if (isHigh)
+            {
+                high = new PivotPoint(PivotPointType.High, middlePoint.High, middlePoint.EndTime);
+            }
+
+            return high;
+        }
+
+        /// <summary>
+        /// Method for converting high and low pivot points to a decimal value.
+        /// </summary>
+        /// <param name="highPoint">new high point or null</param>
+        /// <param name="lowPoint">new low point or null</param>
+        /// <returns>a decimal value representing the values of high and low pivot points</returns>
+        protected virtual decimal ConvertToComputedValue(PivotPoint highPoint, PivotPoint lowPoint)
+        {
+            if (highPoint != null)
+            {
+                if (lowPoint != null)
                 {
                     // Can be the bar forms both high and low pivot points at the same time
-                    OnNewPivotPointFormed(low);
                     return (decimal)PivotPointType.Both;
                 }
                 return (decimal)PivotPointType.High;
             }

-            if (low != null)
-            {
-                OnNewPivotPointFormed(low);
+            if (lowPoint != null)
+            {
                 return (decimal)PivotPointType.Low;
             }

@@ -204,10 +245,13 @@
         /// <summary>
         /// Invokes NewPivotPointFormed event
         /// </summary>
-        protected virtual void OnNewPivotPointFormed(PivotPoint pivotPoint)
-        {
-            _windowPivotPoints.Add(pivotPoint);
-            NewPivotPointFormed?.Invoke(this, new PivotPointsEventArgs(pivotPoint));
+        private void OnNewPivotPointFormed(PivotPoint pivotPoint)
+        {
+            if (pivotPoint != null)
+            {
+                _windowPivotPoints.Add(pivotPoint);
+                NewPivotPointFormed?.Invoke(this, new PivotPointsEventArgs(pivotPoint));
+            }
         }
     }


fix: fixes error when output path not exist

Closes #14

--- IngameScriptBuilder/Generator.cs
+++ IngameScriptBuilder/Generator.cs
@@ -87,13 +87,12 @@
                 Clipboard.SetText(result);
                 Console.WriteLine("Script copied to Clipboard.");
             } else {
-                var outputPath = Path.GetFullPath(projectPath);
+                var outputPath = Path.GetFullPath(output);
                 var outputDirectory = Path.GetDirectoryName(outputPath);
-                if (!Directory.Exists(outputDirectory)) {
-                    if (outputDirectory != null) {
-                        Directory.CreateDirectory(outputDirectory);
-                    }
-                }
+                if (outputDirectory != null) {
+                    Directory.CreateDirectory(outputDirectory);
+                }
+
                 using (var writer = new StreamWriter(output)) {
                     await writer.WriteAsync(result);
                     Console.WriteLine($"Script written to file: {output}");


img.azyobuzi.net に合わせて、pic.twitter.comの画像サイズを戻した

This reverts commit 71e391992e231fc798ef4eb0269801c6c8a235f7.

--- Inscribe/Storage/TweetStorage.cs
+++ Inscribe/Storage/TweetStorage.cs
@@ -335,7 +335,7 @@
                     {
                         String expand = null;
                         if (i.GetChildValue("media_url") != null)
-                            expand = i.GetChildValue("media_url").Value + ":large";
+                            expand = i.GetChildValue("media_url").Value;
                         if (String.IsNullOrWhiteSpace(expand) && i.GetChildValue("expanded_url") != null)
                             expand = i.GetChildValue("expanded_url").Value;
                         if (String.IsNullOrWhiteSpace(expand) && i.GetChildValue("url") != null)


Managed to forget a key value on my Location model

--- InsectCatalog/Models/Location.cs
+++ InsectCatalog/Models/Location.cs
@@ -8,6 +8,8 @@
 {
     public class Location : IComparable
     {
+        [Key]
+        public string LocationId { get; set; }
         [Required]
         public double Latitude { get; set; }
         [Required]


scrolling

scrolling

--- InternetTester/Form1.Designer.cs
+++ InternetTester/Form1.Designer.cs
@@ -121,6 +121,7 @@
             this.dHistory.Multiline = true;
             this.dHistory.Name = "dHistory";
             this.dHistory.ReadOnly = true;
+            this.dHistory.ScrollBars = System.Windows.Forms.ScrollBars.Both;
             this.dHistory.Size = new System.Drawing.Size(630, 485);
             this.dHistory.TabIndex = 1;
             //


git-svn-id: https://jumony.svn.codeplex.com/svn/trunk@64376 2327b42d-5241-43d6-9e2a-de5ac946f064

--- Ivony.Html.Web.Mvc/JumonyView.cs
+++ Ivony.Html.Web.Mvc/JumonyView.cs
@@ -37,6 +37,10 @@
     {
       ViewContext = viewContext;
       Render( writer );
+
+      var strings = new string[0];
+      object[] objects = strings;
+
     }


TODO note

TODO note

--- LanguageExt.Process/Session/SessionSync.cs
+++ LanguageExt.Process/Session/SessionSync.cs
@@ -10,6 +10,7 @@

 namespace LanguageExt.Session
 {
+    /// TODO: Session sync for new nodes coming online
     class SessionSync
     {
         const string SessionsNotify = "sys-sessions-notify";


Contains dupes III - stupid confusing problem

--- LeetCode/remote/contains_duplicates_III.cs
+++ LeetCode/remote/contains_duplicates_III.cs
@@ -9,6 +9,78 @@
 using System.Linq;

 public class Solution {
+    class Dequeue
+    {
+        private LinkedList<int> storage = new LinkedList<int>();
+
+        public Dequeue()
+        {
+            Empty = true;
+        }
+
+        public void Add(int x, Func<int, int, bool> comparer)
+        {
+            while (storage.Count > 0 && comparer(storage.Last(), x))
+            {
+                storage.RemoveLast();
+            }
+
+            storage.AddLast(x);
+            Empty = false;
+        }
+
+        public void Remove(int x)
+        {
+            if (storage.Count > 0 && storage.First() == x)
+            {
+                storage.RemoveFirst();
+            }
+
+            Empty = storage.Count == 0;
+        }
+
+        public int Head {
+            get {
+                return storage.First();
+            }
+        }
+
+        public bool Empty {
+            get;
+            private set;
+        }
+    }
+
+    public bool ContainsNearbyAlmostDuplicate(int[] nums, int k, int t) {
+        var max = new Dequeue();
+        var min = new Dequeue();
+        for (var i = 0; i < Math.Min(k, nums.Length); i++)
+        {
+            max.Add(nums[i], (a, b) => a >= b);
+            min.Add(nums[i], (a, b) => a < b);
+        }
+
+        if (!max.Empty && !min.Empty && max.Head - min.Head <= t)
+        {
+            return true;
+        }
+
+        for (var i = k; i < nums.Length; i++)
+        {
+            max.Add(nums[i], (a, b) => a >= b);
+            min.Add(nums[i], (a, b) => a < b);
+            max.Remove(nums[i - k]);
+            min.Remove(nums[i - k]);
+
+            if (!max.Empty && !min.Empty && max.Head - min.Head <= t)
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     public bool ContainsNearbyAlmostDuplicate(int[] nums, int k, int t) {
         var set = new SortedDictionary<int, int>();


Fix comments.

Fix comments.

--- Libraries/Sources/Events/ValueEventArgs.cs
+++ Libraries/Sources/Events/ValueEventArgs.cs
@@ -27,8 +27,8 @@
     /// ValueEventArgs
     ///
     /// <summary>
-    /// ValueEventArgs(T), ValueCancelEventArgs(T), ValueChangedEventArgs(T)
-    /// オブジェクトを生成するための補助クラスです。
+    /// Provides methods to create a new instance of the ValueEventArgs(T),
+    /// ValueCancelEventArgs(T), or ValueChangedEventArgs(T) classes.
     /// </summary>
     ///
     /* --------------------------------------------------------------------- */
@@ -41,10 +41,11 @@
         /// Create
         ///
         /// <summary>
-        /// ValueEventArgs(T) オブジェクトを生成します。
-        /// </summary>
-        ///
-        /// <param name="value">設定値</param>
+        /// Creates a new instance of the ValueEventArgs(T) class with the
+        /// specified value.
+        /// </summary>
+        ///
+        /// <param name="value">Value to use for the event.</param>
         ///
         /* ----------------------------------------------------------------- */
         public static ValueEventArgs<T> Create<T>(T value) =>
@@ -55,11 +56,14 @@
         /// Create
         ///
         /// <summary>
-        /// ValueCancelEventArgs(T) オブジェクトを生成します。
-        /// </summary>
-        ///
-        /// <param name="value">設定値</param>
-        /// <param name="cancel">キャンセルするかどうか</param>
+        /// Creates a new instance of the ValueCancelEventArgs(T) class
+        /// with the specified arguments.
+        /// </summary>
+        ///
+        /// <param name="value">Value to use for the event.</param>
+        /// <param name="cancel">
+        /// true to cancel the event; otherwise, false.
+        /// </param>
         ///
         /* ----------------------------------------------------------------- */
         public static ValueCancelEventArgs<T> Create<T>(T value, bool cancel) =>
@@ -70,11 +74,12 @@
         /// Create
         ///
         /// <summary>
-        /// ValueChangedEventArgs(T) オブジェクトを生成します。
-        /// </summary>
-        ///
-        /// <param name="oldvalue">変更前の値</param>
-        /// <param name="newvalue">変更後の値</param>
+        /// Creates a new instance of the ValueChangedEventArgs(T) class
+        /// with the specified arguments.
+        /// </summary>
+        ///
+        /// <param name="oldvalue">Value before changed.</param>
+        /// <param name="newvalue">Value after changed.</param>
         ///
         /// <remarks>
         /// bool 型の値を指定すると ValueCancelEventArgs(T) のオブジェクトが
@@ -163,7 +168,8 @@
         ///
         /// <summary>
         /// Initializes a new instance of the ValueCancelEventArgs class
-        /// with the specified arguments.
+        /// with the specified value. The Cancel property is set to
+        /// false.
         /// </summary>
         ///
         /// <param name="value">Value to use for the event.</param>
@@ -255,7 +261,7 @@
         /// OldValue
         ///
         /// <summary>
-        /// Gets the value before changed.
+        /// Gets a value before changed by the event.
         /// </summary>
         ///
         /* ----------------------------------------------------------------- */
@@ -266,7 +272,7 @@
         /// NewValue
         ///
         /// <summary>
-        /// Gets the value after changed.
+        /// Gets a value after changed by the event.
         /// </summary>
         ///
         /* ----------------------------------------------------------------- */


bug fixes.  adding generation of .targets file inside the nuspec stuff.

--- gen_build.cs
+++ gen_build.cs
@@ -30,7 +30,7 @@

 	public string get_dest_subpath()
 	{
-		return string.Format("{0}\\{1}\\{2}\\", get_category(), env, cpu);
+		return string.Format("{0}\\{1}\\{2}", get_category(), env, cpu);
 	}

 	public string get_name()
@@ -99,7 +99,7 @@

 	public string get_dest_subpath()
 	{
-		return string.Format("{0}\\{1}\\{2}\\", get_category(), env, cpu);
+		return string.Format("{0}\\{1}\\{2}", get_category(), env, cpu);
 	}

 	public string get_project_filename()
@@ -207,11 +207,11 @@
 	{
 		if (is_portable())
 		{
-			return string.Format("{0}\\{1}\\", get_category(), env);
+			return string.Format("{0}\\{1}", get_category(), env);
 		}
 		else
 		{
-			return string.Format("{0}\\{1}\\{2}\\{3}\\", get_category(), env, nat, cpu);
+			return string.Format("{0}\\{1}\\{2}\\{3}", get_category(), env, nat, cpu);
 		}
 	}

@@ -1437,7 +1437,7 @@
 		settings.Indent = true;
 		settings.OmitXmlDeclaration = false;

-		using (XmlWriter f = XmlWriter.Create(Path.Combine(top, "sqlitepcl.nuspec"), settings))
+		using (XmlWriter f = XmlWriter.Create(Path.Combine(top, "SQLitePCL.raw.nuspec"), settings))
 		{
 			f.WriteStartDocument();
 			f.WriteComment("Automatically generated");
@@ -1445,6 +1445,7 @@
 			f.WriteStartElement("package", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd");

 			f.WriteStartElement("metadata");
+			f.WriteAttributeString("minClientVersion", "2.5");

 			f.WriteElementString("id", "SQLitePCL.raw");
 			f.WriteElementString("version", "0.1.0-alpha");
@@ -1508,9 +1509,36 @@

 			}

+			f.WriteStartElement("file");
+			f.WriteAttributeString("src", "SQLitePCL.raw.targets");
+			f.WriteAttributeString("target", "build\\native\\");
+			f.WriteEndElement(); // file
+
 			f.WriteEndElement(); // files

 			f.WriteEndElement(); // package
+
+			f.WriteEndDocument();
+		}
+	}
+
+	private static void gen_nuget_targets(string top)
+	{
+		XmlWriterSettings settings = new XmlWriterSettings();
+		settings.Indent = true;
+		settings.OmitXmlDeclaration = false;
+
+		using (XmlWriter f = XmlWriter.Create(Path.Combine(top, "SQLitePCL.raw.targets"), settings))
+		{
+			f.WriteStartDocument();
+			f.WriteComment("Automatically generated");
+
+			f.WriteStartElement("Project", "http://schemas.microsoft.com/developer/msbuild/2003");
+			f.WriteAttributeString("ToolsVersion", "4.0");
+
+			// TODO
+
+			f.WriteEndElement(); // Project

 			f.WriteEndDocument();
 		}
@@ -1569,6 +1597,8 @@
 		// --------------------------------

 		gen_nuspec(top);
+
+		gen_nuget_targets(top);
 	}
 }


projections: use aggregateStore.replayAll to re-run events

--- Magistrate/Domain/Services/SystemFacade.cs
+++ Magistrate/Domain/Services/SystemFacade.cs
@@ -23,19 +23,16 @@
 		public SystemFacade(IEventStore eventStore)
 		{
 			_projections = new SystemProjections();
-			_eventStore = new ProjectionEventStore(eventStore, _projections.Project);
+			var es = new ProjectionEventStore(eventStore, _projections.Project);

-			_store = new AggregateStore<Guid>(_eventStore);
+			_store = new AggregateStore<Guid>(es);
 		}

 		public void Load()
 		{
-			using (var reader = _eventStore.CreateReader<Guid>(MagistrateStream))
-			{
-				reader
-					.LoadAllEvents()
-					.ForEach(_projections.Project);
-			}
+			_store
+				.ReplayAll(MagistrateStream)
+				.ForEach(_projections.Project);
 		}

 		public UserReadModel CreateUser(MagistrateUser currentUser, string key, string name)


Improve preferences form layout

Improve preferences form layout

--- Mappy/UI/Forms/PreferencesForm.Designer.cs
+++ Mappy/UI/Forms/PreferencesForm.Designer.cs
@@ -37,8 +37,12 @@
             this.button6 = new System.Windows.Forms.Button();
             this.panel1 = new System.Windows.Forms.Panel();
             this.panel2 = new System.Windows.Forms.Panel();
+            this.panel3 = new System.Windows.Forms.Panel();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.panel1.SuspendLayout();
             this.panel2.SuspendLayout();
+            this.panel3.SuspendLayout();
+            this.groupBox1.SuspendLayout();
             this.SuspendLayout();
             //
             // listView1
@@ -47,7 +51,7 @@
             this.listView1.Location = new System.Drawing.Point(0, 0);
             this.listView1.MultiSelect = false;
             this.listView1.Name = "listView1";
-            this.listView1.Size = new System.Drawing.Size(540, 368);
+            this.listView1.Size = new System.Drawing.Size(332, 242);
             this.listView1.TabIndex = 0;
             this.listView1.UseCompatibleStateImageBehavior = false;
             this.listView1.View = System.Windows.Forms.View.List;
@@ -94,8 +98,9 @@
             //
             // button5
             //
+            this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.button5.DialogResult = System.Windows.Forms.DialogResult.OK;
-            this.button5.Location = new System.Drawing.Point(3, 3);
+            this.button5.Location = new System.Drawing.Point(291, 4);
             this.button5.Name = "button5";
             this.button5.Size = new System.Drawing.Size(75, 23);
             this.button5.TabIndex = 5;
@@ -105,8 +110,9 @@
             //
             // button6
             //
+            this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.button6.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.button6.Location = new System.Drawing.Point(84, 3);
+            this.button6.Location = new System.Drawing.Point(372, 4);
             this.button6.Name = "button6";
             this.button6.Size = new System.Drawing.Size(75, 23);
             this.button6.TabIndex = 6;
@@ -120,9 +126,9 @@
             this.panel1.Controls.Add(this.button1);
             this.panel1.Controls.Add(this.button2);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
-            this.panel1.Location = new System.Drawing.Point(458, 0);
+            this.panel1.Location = new System.Drawing.Point(332, 0);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(82, 338);
+            this.panel1.Size = new System.Drawing.Size(82, 242);
             this.panel1.TabIndex = 7;
             //
             // panel2
@@ -130,24 +136,50 @@
             this.panel2.Controls.Add(this.button6);
             this.panel2.Controls.Add(this.button5);
             this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.panel2.Location = new System.Drawing.Point(0, 338);
+            this.panel2.Location = new System.Drawing.Point(0, 285);
             this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(540, 30);
+            this.panel2.Size = new System.Drawing.Size(450, 30);
             this.panel2.TabIndex = 8;
+            //
+            // panel3
+            //
+            this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.panel3.Controls.Add(this.listView1);
+            this.panel3.Controls.Add(this.panel1);
+            this.panel3.Location = new System.Drawing.Point(6, 19);
+            this.panel3.Name = "panel3";
+            this.panel3.Size = new System.Drawing.Size(414, 242);
+            this.panel3.TabIndex = 9;
+            //
+            // groupBox1
+            //
+            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.groupBox1.Controls.Add(this.panel3);
+            this.groupBox1.Location = new System.Drawing.Point(12, 12);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(426, 267);
+            this.groupBox1.TabIndex = 10;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "Search Paths";
             //
             // PreferencesForm
             //
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(540, 368);
-            this.Controls.Add(this.panel1);
+            this.ClientSize = new System.Drawing.Size(450, 315);
+            this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.panel2);
-            this.Controls.Add(this.listView1);
             this.Name = "PreferencesForm";
             this.Text = "Preferences";
             this.Load += new System.EventHandler(this.PreferencesFormLoad);
             this.panel1.ResumeLayout(false);
             this.panel2.ResumeLayout(false);
+            this.panel3.ResumeLayout(false);
+            this.groupBox1.ResumeLayout(false);
             this.ResumeLayout(false);

         }
@@ -163,5 +195,7 @@
         private System.Windows.Forms.Button button6;
         private System.Windows.Forms.Panel panel1;
         private System.Windows.Forms.Panel panel2;
+        private System.Windows.Forms.Panel panel3;
+        private System.Windows.Forms.GroupBox groupBox1;
     }
 }


support for Xamarin.Mac 2.0 fixes #40

support for Xamarin.Mac 2.0 fixes #40

--- gen_build.cs
+++ gen_build.cs
@@ -152,9 +152,13 @@
 		items_pcl.Add(new config_pcl { env="ios", api="pinvoke", what="packaged_sqlite3", cpu="anycpu"});
 		items_pcl.Add(new config_pcl { env="ios", api="pinvoke", what="packaged_sqlcipher", cpu="anycpu"});

-		items_pcl.Add(new config_pcl { env="unified", api="pinvoke", what="sqlite3", cpu="anycpu"});
-		items_pcl.Add(new config_pcl { env="unified", api="pinvoke", what="packaged_sqlite3", cpu="anycpu"});
-		items_pcl.Add(new config_pcl { env="unified", api="pinvoke", what="packaged_sqlcipher", cpu="anycpu"});
+		items_pcl.Add(new config_pcl { env="unified_ios", api="pinvoke", what="sqlite3", cpu="anycpu"});
+		items_pcl.Add(new config_pcl { env="unified_ios", api="pinvoke", what="packaged_sqlite3", cpu="anycpu"});
+		items_pcl.Add(new config_pcl { env="unified_ios", api="pinvoke", what="packaged_sqlcipher", cpu="anycpu"});
+
+		items_pcl.Add(new config_pcl { env="unified_mac", api="pinvoke", what="sqlite3", cpu="anycpu"});
+		items_pcl.Add(new config_pcl { env="unified_mac", api="pinvoke", what="packaged_sqlite3", cpu="anycpu"});
+		items_pcl.Add(new config_pcl { env="unified_mac", api="pinvoke", what="packaged_sqlcipher", cpu="anycpu"});

 		items_pcl.Add(new config_pcl { env="net45", api="pinvoke", what="sqlite3", cpu="anycpu"});
 		items_pcl.Add(new config_pcl { env="net45", api="pinvoke", what="sqlite3", cpu="x86"});
@@ -583,8 +587,10 @@
 		{
 			case "ios":
 				return "MonoTouch";
-			case "unified":
+			case "unified_ios":
 				return "Xamarin.iOS10";
+			case "unified_mac":
+				return "Xamarin.Mac20";
 			case "android":
 				return "MonoAndroid";
 			case "net45":
@@ -758,7 +764,8 @@
 	private const string GUID_FOLDER = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
 	private const string GUID_PCL = "{786C830F-07A1-408B-BD7F-6EE04809D6DB}";
 	private const string GUID_IOS = "{6BC8ED88-2882-458C-8E55-DFD12B67127B}";
-	private const string GUID_UNIFIED = "{FEACFBD2-3405-455C-9665-78FE426C6842}";
+	private const string GUID_UNIFIED_IOS = "{FEACFBD2-3405-455C-9665-78FE426C6842}";
+	private const string GUID_UNIFIED_MAC = "{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1}";
 	private const string GUID_ANDROID = "{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}";
 	private const string GUID_WINRT = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";
 	private const string GUID_WP8 = "{C089C8C0-30E0-4E22-80C0-CE093F111A43}";
@@ -1540,8 +1547,11 @@
 					case "ios":
 						write_project_type_guids(f, GUID_IOS, GUID_CSHARP);
 						break;
-					case "unified":
-						write_project_type_guids(f, GUID_UNIFIED, GUID_CSHARP);
+					case "unified_ios":
+						write_project_type_guids(f, GUID_UNIFIED_IOS, GUID_CSHARP);
+						break;
+					case "unified_mac":
+						write_project_type_guids(f, GUID_UNIFIED_MAC, GUID_CSHARP);
 						break;
 					case "android":
 						write_project_type_guids(f, GUID_ANDROID, GUID_CSHARP);
@@ -1568,6 +1578,11 @@
 			f.WriteString("Debug");

 			f.WriteEndElement(); // Configuration
+
+			if (cfg.env == "unified_mac") {
+				f.WriteElementString ("TargetFrameworkVersion", "v2.0");
+				f.WriteElementString ("TargetFrameworkIdentifier", "Xamarin.Mac");
+			}

 			f.WriteElementString("SchemaVersion", "2.0");
 			f.WriteElementString("Platform", cfg.cpu.Replace(" ", ""));
@@ -1595,7 +1610,8 @@
 				case "ios":
 					defines.Add("PLATFORM_IOS");
 					break;
-				case "unified":
+				case "unified_ios":
+				case "unified_mac":
 					defines.Add("PLATFORM_UNIFIED");
 					break;
 				case "android":
@@ -1677,7 +1693,11 @@
 						{
 							defines.Add("PINVOKE_FROM_PACKAGED_SQLITE3");
 						}
-						else if (cfg.env == "unified")
+						else if (cfg.env == "unified_ios")
+						{
+							defines.Add("PINVOKE_FROM_INTERNAL_SQLITE3");
+						}
+						else if (cfg.env == "unified_mac")
 						{
 							defines.Add("PINVOKE_FROM_INTERNAL_SQLITE3");
 						}
@@ -1699,7 +1719,11 @@
 						{
 							defines.Add("PINVOKE_FROM_PACKAGED_SQLCIPHER");
 						}
-						else if (cfg.env == "unified")
+						else if (cfg.env == "unified_ios")
+						{
+							defines.Add("PINVOKE_FROM_INTERNAL_SQLCIPHER");
+						}
+						else if (cfg.env == "unified_mac")
 						{
 							defines.Add("PINVOKE_FROM_INTERNAL_SQLCIPHER");
 						}
@@ -1759,7 +1783,8 @@
 			switch (cfg.env)
 			{
 				case "ios":
-				case "unified":
+				case "unified_ios":
+				case "unified_mac":
 				case "android":
 				case "net45":
 				case "net40":
@@ -1769,8 +1794,11 @@
 			}
 			switch (cfg.env)
 			{
-				case "unified":
+				case "unified_ios":
 					write_reference(f, "Xamarin.iOS");
+					break;
+				case "unified_mac":
+					write_reference(f, "Xamarin.Mac");
 					break;
 				case "ios":
 					write_reference(f, "monotouch");
@@ -1863,7 +1891,7 @@

 				switch (cfg.env)
 				{
-					case "unified":
+					case "unified_ios":
 						f.WriteStartElement("Import");
 						f.WriteAttributeString("Project", "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.CSharp.targets");
 						f.WriteEndElement(); // Import
@@ -1897,6 +1925,40 @@
                             f.WriteEndElement(); // ItemGroup
                         }
 						break;
+					case "unified_mac":
+						f.WriteStartElement("Import");
+						f.WriteAttributeString("Project", "$(MSBuildExtensionsPath)\\Xamarin\\Mac\\Xamarin.Mac.CSharp.targets");
+						f.WriteEndElement(); // Import
+
+						if (cfg.what == "packaged_sqlite3")
+						{
+							f.WriteStartElement("ItemGroup");
+							// TODO warning says this is deprecated
+							f.WriteStartElement("ManifestResourceWithNoCulture");
+							f.WriteAttributeString("Include", Path.Combine(root, "apple\\libs\\mac\\packaged_sqlite3.a"));
+							f.WriteElementString("Link", "packaged_sqlite3.a");
+							f.WriteEndElement(); // ManifestResourceWithNoCulture
+							f.WriteEndElement(); // ItemGroup
+						}
+						if (cfg.what == "packaged_sqlcipher")
+						{
+							f.WriteStartElement("ItemGroup");
+
+							// TODO warning says this is deprecated
+							f.WriteStartElement("ManifestResourceWithNoCulture");
+							f.WriteAttributeString("Include", Path.Combine(root, "apple\\libs\\mac\\packaged_sqlcipher.a"));
+							f.WriteElementString("Link", "packaged_sqlcipher.a");
+							f.WriteEndElement(); // ManifestResourceWithNoCulture
+
+							// TODO warning says this is deprecated
+							f.WriteStartElement("ManifestResourceWithNoCulture");
+							f.WriteAttributeString("Include", Path.Combine(root, "apple\\libs\\mac\\libcrypto.a"));
+							f.WriteElementString("Link", "libcrypto.a");
+							f.WriteEndElement(); // ManifestResourceWithNoCulture
+
+							f.WriteEndElement(); // ItemGroup
+						}
+						break;
 					case "ios":
 						f.WriteStartElement("Import");
 						f.WriteAttributeString("Project", "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.MonoTouch.CSharp.targets");
@@ -2033,8 +2095,11 @@
 				case "ios":
 					write_project_type_guids(f, GUID_IOS, GUID_CSHARP);
 					break;
-				case "unified":
-					write_project_type_guids(f, GUID_UNIFIED, GUID_CSHARP);
+				case "unified_ios":
+					write_project_type_guids(f, GUID_UNIFIED_IOS, GUID_CSHARP);
+					break;
+				case "unified_mac":
+					write_project_type_guids(f, GUID_UNIFIED_MAC, GUID_CSHARP);
 					break;
 				case "android":
 					write_project_type_guids(f, GUID_ANDROID, GUID_CSHARP);
@@ -2063,6 +2128,11 @@
 			f.WriteString("Debug");

 			f.WriteEndElement(); // Configuration
+
+			if (cfg.env == "unified_mac") {
+				f.WriteElementString ("TargetFrameworkVersion", "v2.0");
+				f.WriteElementString ("TargetFrameworkIdentifier", "Xamarin.Mac");
+			}

 			f.WriteElementString("SchemaVersion", "2.0");
 			//f.WriteElementString("Platform", cfg.cpu.Replace(" ", ""));
@@ -2090,7 +2160,8 @@
 				case "ios":
 					defines.Add("PLATFORM_IOS");
 					break;
-				case "unified":
+				case "unified_ios":
+				case "unified_mac":
 					defines.Add("PLATFORM_UNIFIED");
 					break;
 				case "android":
@@ -2162,7 +2233,8 @@
 			f.WriteStartElement("ItemGroup");
 			switch (cfg.env)
 			{
-				case "unified":
+				case "unified_ios":
+				case "unified_mac":
 				case "ios":
 				case "android":
 					break;
@@ -2179,8 +2251,11 @@
 			}
 			switch (cfg.env)
 			{
-				case "unified":
+				case "unified_ios":
 					write_reference(f, "Xamarin.iOS");
+					break;
+				case "unified_mac":
+					write_reference (f, "Xamarin.Mac");
 					break;
 				case "ios":
 					write_reference(f, "monotouch");
@@ -2264,9 +2339,14 @@

 				switch (cfg.env)
 				{
-					case "unified":
+					case "unified_ios":
 						f.WriteStartElement("Import");
 						f.WriteAttributeString("Project", "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.CSharp.targets");
+						f.WriteEndElement(); // Import
+						break;
+					case "unified_mac":
+						f.WriteStartElement("Import");
+						f.WriteAttributeString("Project", "$(MSBuildExtensionsPath)\\Xamarin\\Mac\\Xamarin.Mac.CSharp.targets");
 						f.WriteEndElement(); // Import
 						break;
 					case "ios":
@@ -2805,22 +2885,22 @@
                         );

 #if not // TODO a targets file here would be helpful for Xam studio mac stuff.  but then all of net45 needs to move from lib to build.
-                string tname = string.Format("{0}.targets", "unified");
+                string tname = string.Format("{0}.targets", "unified_ios");

 		f.WriteComment("empty directory in lib to avoid nuget adding a reference to the bait");

-		Directory.CreateDirectory(Path.Combine(Path.Combine(top, "empty"), config_pcl.get_nuget_framework_name("unified")));
+		Directory.CreateDirectory(Path.Combine(Path.Combine(top, "empty"), config_pcl.get_nuget_framework_name("unified_ios")));

 		f.WriteStartElement("file");
-		f.WriteAttributeString("src", string.Format("empty\\{0}\\", config_pcl.get_nuget_framework_name("unified")));
-		f.WriteAttributeString("target", string.Format("lib\\{0}", config_pcl.get_nuget_framework_name("unified")));
+		f.WriteAttributeString("src", string.Format("empty\\{0}\\", config_pcl.get_nuget_framework_name("unified_ios")));
+		f.WriteAttributeString("target", string.Format("lib\\{0}", config_pcl.get_nuget_framework_name("unified_ios")));
 		f.WriteEndElement(); // file

                 gen_nuget_targets_android_or_unified_packaged_sqlite3(top, tname, a);

                 f.WriteStartElement("file");
                 f.WriteAttributeString("src", tname);
-                f.WriteAttributeString("target", string.Format("build\\{0}\\{1}.targets", config_pcl.get_nuget_framework_name("unified"), id));
+                f.WriteAttributeString("target", string.Format("build\\{0}\\{1}.targets", config_pcl.get_nuget_framework_name("unified_ios"), id));
                 f.WriteEndElement(); // file
 #endif
             }
@@ -2828,7 +2908,7 @@
                 // --------------------------------
             {
                 var a = projects.find_pcls(
-                    "unified",
+                    "unified_ios",
                     "pinvoke",
                     null,
                     "anycpu",
@@ -2838,26 +2918,58 @@
                         a
                         );

-                string tname = string.Format("{0}.targets", "unified");
+                string tname = string.Format("{0}.targets", "unified_ios");

 		f.WriteComment("empty directory in lib to avoid nuget adding a reference to the bait");

-		Directory.CreateDirectory(Path.Combine(Path.Combine(top, "empty"), config_pcl.get_nuget_framework_name("unified")));
+		Directory.CreateDirectory(Path.Combine(Path.Combine(top, "empty"), config_pcl.get_nuget_framework_name("unified_ios")));

 		f.WriteStartElement("file");
-		f.WriteAttributeString("src", string.Format("empty\\{0}\\", config_pcl.get_nuget_framework_name("unified")));
-		f.WriteAttributeString("target", string.Format("lib\\{0}", config_pcl.get_nuget_framework_name("unified")));
+		f.WriteAttributeString("src", string.Format("empty\\{0}\\", config_pcl.get_nuget_framework_name("unified_ios")));
+		f.WriteAttributeString("target", string.Format("lib\\{0}", config_pcl.get_nuget_framework_name("unified_ios")));
 		f.WriteEndElement(); // file

                 gen_nuget_targets_android_or_unified_packaged_sqlite3(top, tname, a);

                 f.WriteStartElement("file");
                 f.WriteAttributeString("src", tname);
-                f.WriteAttributeString("target", string.Format("build\\{0}\\{1}.targets", config_pcl.get_nuget_framework_name("unified"), id));
+                f.WriteAttributeString("target", string.Format("build\\{0}\\{1}.targets", config_pcl.get_nuget_framework_name("unified_ios"), id));
                 f.WriteEndElement(); // file
             }

                 // --------------------------------
+			{
+				var a = projects.find_pcls(
+					"unified_mac",
+					"pinvoke",
+					null,
+					"anycpu",
+					null
+				);
+				write_nuspec_file_entries(f, "build",
+					a
+				);
+
+				string tname = string.Format("{0}.targets", "unified_mac");
+
+				f.WriteComment("empty directory in lib to avoid nuget adding a reference to the bait");
+
+				Directory.CreateDirectory(Path.Combine(Path.Combine(top, "empty"), config_pcl.get_nuget_framework_name("unified_mac")));
+
+				f.WriteStartElement("file");
+				f.WriteAttributeString("src", string.Format("empty\\{0}\\", config_pcl.get_nuget_framework_name("unified_mac")));
+				f.WriteAttributeString("target", string.Format("lib\\{0}", config_pcl.get_nuget_framework_name("unified_mac")));
+				f.WriteEndElement(); // file
+
+				gen_nuget_targets_android_or_unified_packaged_sqlite3(top, tname, a);
+
+				f.WriteStartElement("file");
+				f.WriteAttributeString("src", tname);
+				f.WriteAttributeString("target", string.Format("build\\{0}\\{1}.targets", config_pcl.get_nuget_framework_name("unified_mac"), id));
+				f.WriteEndElement(); // file
+			}
+
+			// --------------------------------
             {
                 var a = projects.find_pcls(
                     "android",
@@ -2895,7 +3007,8 @@
 			Dictionary<string, string> pcl_env_pinvoke = new Dictionary<string, string>();
 			pcl_env_pinvoke["ios"] = null;
 			// not here: pcl_env_pinvoke["android"] = null;
-			// not here: pcl_env_pinvoke["unified"] = null;
+			// not here: pcl_env_pinvoke["unified_ios"] = null;
+			// not here: pcl_env_pinvoke["unified_mac"] = null;
 			pcl_env_pinvoke["net45"] = null;
 			pcl_env_pinvoke["net40"] = null;
 			pcl_env_pinvoke["winrt80"] = null;
@@ -2915,7 +3028,8 @@
 						);

 				if ("ios" == env) continue; // Xamarin.iOS classic can't do .targets files
-				if ("unified" == env) continue; // TODO fix this to handle packaged sqlite
+				if ("unified_ios" == env) continue; // TODO fix this to handle packaged sqlite
+				if ("unified_mac" == env) continue; // TODO fix this to handle packaged sqlite
 				if ("android" == env) continue; // TODO fix this to handle packaged sqlite

 				string tname = string.Format("{0}.targets", env);


Fixed flaky TCP proxy test (#68)

Fixed flaky TCP proxy test (#68)

--- MbDotNet.Tests/Acceptance/ImposterTests.cs
+++ MbDotNet.Tests/Acceptance/ImposterTests.cs
@@ -132,6 +132,8 @@
 				using (var stream = client.GetStream())
 				{
 					await stream.WriteAsync(data, 0, data.Length);
+					await stream.FlushAsync();
+					await stream.ReadAsync(new byte[6], 0, 6);
 				}
 			}


fix problems in prev commit with rename of sqlcipher to e_sqlcipher

--- gen_build.cs
+++ gen_build.cs
@@ -46,6 +46,10 @@
 		SO,
 	}

+	// in cb, the sqlcipher builds do not have the e_ prefix.
+	// we do this so we can continue to build v1.
+	// but in v2, we want things to be called e_sqlcipher.
+
 	static string AsString_basename_in_cb(this WhichLib e)
 	{
 		switch (e)
@@ -68,9 +72,8 @@
 		}
 	}

-	static string AsString_libname_in_nupkg(this WhichLib e, LibSuffix suffix)
-	{
-		var basename = e.AsString_basename_in_nupkg();
+	static string basename_to_libname(string basename, LibSuffix suffix)
+	{
 		switch (suffix)
 		{
 			case LibSuffix.DLL:
@@ -82,6 +85,18 @@
 			default:
 				throw new NotImplementedException();
 		}
+	}
+
+	static string AsString_libname_in_nupkg(this WhichLib e, LibSuffix suffix)
+	{
+		var basename = e.AsString_basename_in_nupkg();
+		return basename_to_libname(basename, suffix);
+	}
+
+	static string AsString_libname_in_cb(this WhichLib e, LibSuffix suffix)
+	{
+		var basename = e.AsString_basename_in_cb();
+		return basename_to_libname(basename, suffix);
 	}

 	static string AsString(this TFM e)
@@ -155,56 +170,23 @@
 			);
 	}

-	private static void write_nuspec_file_entry_native(string src, string rid, XmlWriter f)
+	private static void write_nuspec_file_entry_native(string src, string rid, string filename, XmlWriter f)
 	{
 		write_nuspec_file_entry(
 			src,
-			string.Format("runtimes\\{0}\\native\\", rid),
+			string.Format("runtimes\\{0}\\native\\{1}", rid, filename),
 			f
 			);
 	}

-	private static void write_nuspec_file_entry_nativeassets(string src, string rid, TFM tfm, XmlWriter f)
+	private static void write_nuspec_file_entry_nativeassets(string src, string rid, TFM tfm, string filename, XmlWriter f)
 	{
 		write_nuspec_file_entry(
 			src,
-			string.Format("runtimes\\{0}\\nativeassets\\{1}\\", rid, tfm.AsString()),
+			string.Format("runtimes\\{0}\\nativeassets\\{1}\\{2}", rid, tfm.AsString(), filename),
 			f
 			);
 	}
-
-	// --------------------------------
-
-	// in cb, the sqlcipher builds do not have the e_ prefix.
-	// we do this so we can continue to build v1.
-	// but in v2, we want things to be called e_sqlcipher.
-	// so we have these special functions here to change names.
-
-	const string E_SQLCIPHER_DLL = "e_sqlcipher.dll";
-	const string E_SQLCIPHER_DYLIB = "libe_sqlcipher.dylib";
-	const string E_SQLCIPHER_SO = "libe_sqlcipher.so";
-
-	private static void write_nuspec_file_entry_native_rename(string src, string rid, string newname, XmlWriter f)
-	{
-		f.WriteComment("note rename in next line");
-		write_nuspec_file_entry(
-			src,
-			string.Format("runtimes\\{0}\\native\\{1}", rid, newname),
-			f
-			);
-	}
-
-	private static void write_nuspec_file_entry_nativeassets_rename(string src, string rid, TFM tfm, string newname, XmlWriter f)
-	{
-		f.WriteComment("note rename in next line");
-		write_nuspec_file_entry(
-			src,
-			string.Format("runtimes\\{0}\\nativeassets\\{1}\\{2}", rid, tfm.AsString(), newname),
-			f
-			);
-	}
-
-	// --------------------------------

 	private static void write_empty(XmlWriter f, string top, TFM tfm)
     {
@@ -425,8 +407,9 @@
 		string arch
 		)
 	{
-		var name = lib.AsString_basename_in_cb();
-		return Path.Combine(cb_bin, name, "win", toolset, flavor, arch, string.Format("{0}.dll", name));
+		var dir_name = lib.AsString_basename_in_cb();
+		var lib_name = lib.AsString_libname_in_cb(LibSuffix.DLL);
+		return Path.Combine(cb_bin, dir_name, "win", toolset, flavor, arch, lib_name);
 	}

 	static string make_cb_path_linux(
@@ -435,8 +418,9 @@
 		string cpu
 		)
 	{
-		var name = lib.AsString_basename_in_cb();
-		return Path.Combine(cb_bin, name, "linux", cpu, string.Format("lib{0}.so", name));
+		var dir_name = lib.AsString_basename_in_cb();
+		var lib_name = lib.AsString_libname_in_cb(LibSuffix.SO);
+		return Path.Combine(cb_bin, dir_name, "linux", cpu, lib_name);
 	}

 	static string make_cb_path_mac(
@@ -444,8 +428,9 @@
 		WhichLib lib
 		)
 	{
-		var name = lib.AsString_basename_in_cb();
-		return Path.Combine(cb_bin, name, "mac", string.Format("lib{0}.dylib", name));
+		var dir_name = lib.AsString_basename_in_cb();
+		var lib_name = lib.AsString_libname_in_cb(LibSuffix.DYLIB);
+		return Path.Combine(cb_bin, dir_name, "mac", lib_name);
 	}

 	static void write_nuspec_file_entry_native_linux(
@@ -456,9 +441,26 @@
 		XmlWriter f
 		)
 	{
+		var filename = lib.AsString_libname_in_nupkg(LibSuffix.SO);
 		write_nuspec_file_entry_native(
 			make_cb_path_linux(cb_bin, lib, cpu_in_cb),
 			rid,
+			filename,
+			f
+			);
+	}
+
+	static void write_nuspec_file_entry_native_mac(
+		WhichLib lib,
+		string cb_bin,
+		XmlWriter f
+		)
+	{
+		var filename = lib.AsString_libname_in_nupkg(LibSuffix.DYLIB);
+		write_nuspec_file_entry_native(
+			make_cb_path_mac(cb_bin, lib),
+			"osx-x64",
+			filename,
 			f
 			);
 	}
@@ -473,9 +475,11 @@
 		XmlWriter f
 		)
 	{
+		var filename = lib.AsString_libname_in_nupkg(LibSuffix.DLL);
 		write_nuspec_file_entry_native(
 			make_cb_path_win(cb_bin, lib, toolset, flavor, cpu),
 			rid,
+			filename,
 			f
 			);
 	}
@@ -493,11 +497,7 @@
 		write_nuspec_file_entry_native_win(lib, cb_bin, "v140", "appcontainer", "x64", "win10-x64", f);
 		write_nuspec_file_entry_native_win(lib, cb_bin, "v140", "appcontainer", "x86", "win10-x86", f);

-		write_nuspec_file_entry_native(
-			make_cb_path_mac(cb_bin, lib),
-			"osx-x64",
-			f
-			);
+		write_nuspec_file_entry_native_mac(lib, cb_bin, f);

 		write_nuspec_file_entry_native_linux(lib, cb_bin, "x64", "linux-x64", f);
 		write_nuspec_file_entry_native_linux(lib, cb_bin, "x86", "linux-x86", f);
@@ -1118,7 +1118,7 @@

             tw.WriteLine("../nuget pack {0}.bundle_green.nuspec", gen.ROOT_NAME);
             tw.WriteLine("../nuget pack {0}.bundle_e_sqlite3.nuspec", gen.ROOT_NAME);
-            tw.WriteLine("../nuget pack {0}.bundle_sqlcipher.nuspec", gen.ROOT_NAME);
+            tw.WriteLine("../nuget pack {0}.bundle_e_sqlcipher.nuspec", gen.ROOT_NAME);
             tw.WriteLine("../nuget pack {0}.bundle_zetetic.nuspec", gen.ROOT_NAME);
             tw.WriteLine("../nuget pack {0}.bundle_winsqlite3.nuspec", gen.ROOT_NAME);

@@ -1138,7 +1138,7 @@

 			tw.WriteLine("../nuget push -Source {2} {0}.bundle_green.{1}.nupkg", gen.ROOT_NAME, NUSPEC_VERSION, src);
 			tw.WriteLine("../nuget push -Source {2} {0}.bundle_e_sqlite3.{1}.nupkg", gen.ROOT_NAME, NUSPEC_VERSION, src);
-			tw.WriteLine("../nuget push -Source {2} {0}.bundle_sqlcipher.{1}.nupkg", gen.ROOT_NAME, NUSPEC_VERSION, src);
+			tw.WriteLine("../nuget push -Source {2} {0}.bundle_e_sqlcipher.{1}.nupkg", gen.ROOT_NAME, NUSPEC_VERSION, src);
 			tw.WriteLine("../nuget push -Source {2} {0}.bundle_zetetic.{1}.nupkg", gen.ROOT_NAME, NUSPEC_VERSION, src);
 			tw.WriteLine("../nuget push -Source {2} {0}.bundle_winsqlite3.{1}.nupkg", gen.ROOT_NAME, NUSPEC_VERSION, src);
 		}


Added MountebankException

Added MountebankException

--- MbDotNet/Exceptions/MountebankException.cs
+++ MbDotNet/Exceptions/MountebankException.cs
@@ -6,5 +6,10 @@
     public class MountebankException : Exception
     {
         public MountebankException(string message) : base(message) { }
+
+        public void Test()
+        {
+            var obj = new { Key = "x", Value = "y" };
+        }
     }
 }


code cleanup

code cleanup

--- Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
+++ Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
@@ -32,13 +32,11 @@
 using System.Reflection.Emit;
 using System.Collections.Generic;
 using System.Runtime.CompilerServices;
+using System.Threading;

 using Mono.Debugger.Soft;
 using Mono.Debugging.Evaluation;
 using Mono.Debugging.Client;
-
-using ST = System.Threading;
-using Mono.Debugging.Backend;

 namespace Mono.Debugging.Soft
 {
@@ -68,40 +66,43 @@

 		public override string CallToString (EvaluationContext ctx, object obj)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
-
 			if (obj == null)
 				return null;
-
-			if (obj is StringMirror)
-				return ((StringMirror)obj).Value;
-
-			if (obj is EnumMirror)
-				return ((EnumMirror) obj).StringValue;
-
-			if (obj is PrimitiveValue)
-				return ((PrimitiveValue)obj).Value.ToString ();
-
-			if (obj is PointerValue)
-				return string.Format ("0x{0:x}", ((PointerValue)obj).Address);
-
-			if ((obj is StructMirror) && ((StructMirror)obj).Type.IsPrimitive) {
+
+			var str = obj as StringMirror;
+			if (str != null)
+				return str.Value;
+
+			var em = obj as EnumMirror;
+			if (em != null)
+				return em.StringValue;
+
+			var primitive = obj as PrimitiveValue;
+			if (primitive != null)
+				return primitive.Value.ToString ();
+
+			var pointer = obj as PointerValue;
+			if (pointer != null)
+				return string.Format ("0x{0:x}", pointer.Address);
+
+			var cx = (SoftEvaluationContext) ctx;
+			var sm = obj as StructMirror;
+			var om = obj as ObjectMirror;
+
+			if (sm != null && sm.Type.IsPrimitive) {
 				// Boxed primitive
-				StructMirror sm = (StructMirror) obj;
 				if (sm.Fields.Length > 0 && (sm.Fields[0] is PrimitiveValue))
-					return ((PrimitiveValue)sm.Fields[0]).Value.ToString ();
-			} else if ((obj is ObjectMirror) && cx.Options.AllowTargetInvoke) {
-				ObjectMirror ob = (ObjectMirror) obj;
-				MethodMirror method = OverloadResolve (cx, ob.Type, "ToString", null, new TypeMirror[0], true, false, false);
+					return ((PrimitiveValue) sm.Fields[0]).Value.ToString ();
+			} else if (om != null && cx.Options.AllowTargetInvoke) {
+				var method = OverloadResolve (cx, om.Type, "ToString", null, new TypeMirror[0], true, false, false);
 				if (method != null && method.DeclaringType.FullName != "System.Object") {
-					StringMirror res = cx.RuntimeInvoke (method, obj, new Value[0]) as StringMirror;
+					var res = cx.RuntimeInvoke (method, obj, new Value[0]) as StringMirror;
 					return res != null ? res.Value : null;
 				}
-			} else if ((obj is StructMirror) && cx.Options.AllowTargetInvoke) {
-				StructMirror ob = (StructMirror) obj;
-				MethodMirror method = OverloadResolve (cx, ob.Type, "ToString", null, new TypeMirror[0], true, false, false);
+			} else if (sm != null && cx.Options.AllowTargetInvoke) {
+				var method = OverloadResolve (cx, sm.Type, "ToString", null, new TypeMirror[0], true, false, false);
 				if (method != null && method.DeclaringType.FullName != "System.ValueType") {
-					StringMirror res = cx.RuntimeInvoke (method, obj, new Value[0]) as StringMirror;
+					var res = cx.RuntimeInvoke (method, obj, new Value[0]) as StringMirror;
 					return res != null ? res.Value : null;
 				}
 			}
@@ -111,35 +112,39 @@

 		public override object TryConvert (EvaluationContext ctx, object obj, object targetType)
 		{
-			object res = TryCast (ctx, obj, targetType);
+			var res = TryCast (ctx, obj, targetType);

 			if (res != null || obj == null)
 				return res;

-			object otype = GetValueType (ctx, obj);
-			if (otype is Type) {
-				if (targetType is TypeMirror)
-					targetType = Type.GetType (((TypeMirror)targetType).FullName, false);
+			var otype = GetValueType (ctx, obj) as Type;
+
+			if (otype != null) {
+				var tm = targetType as TypeMirror;
+				if (tm != null)
+					targetType = Type.GetType (tm.FullName, false);

-				Type tt = targetType as Type;
+				var tt = targetType as Type;
 				if (tt != null) {
 					try {
-						if (obj is PrimitiveValue)
-							obj = ((PrimitiveValue)obj).Value;
+						var primitive = obj as PrimitiveValue;
+						if (primitive != null)
+							obj = primitive.Value;
+
 						res = System.Convert.ChangeType (obj, tt);
 						return CreateValue (ctx, res);
 					} catch {
-					}
-				}
-			}
+						return null;
+					}
+				}
+			}
+
 			return null;
 		}

 		static TypeCastDelegate GenerateTypeCastDelegate (string methodName, Type fromType, Type toType)
 		{
-			var argTypes = new Type[] {
-				typeof (object)
-			};
+			var argTypes = new [] { typeof (object) };
 			var method = new DynamicMethod (methodName, typeof (object), argTypes, true);
 			ILGenerator il = method.GetILGenerator ();
 			ConstructorInfo ctorInfo;
@@ -149,7 +154,7 @@
 			il.Emit (OpCodes.Ldarg_0);
 			il.Emit (OpCodes.Unbox_Any, fromType);

-			if (fromType.IsSubclassOf (typeof (System.Nullable))) {
+			if (fromType.IsSubclassOf (typeof (Nullable))) {
 				PropertyInfo propInfo = fromType.GetProperty ("Value");
 				methodInfo = propInfo.GetGetMethod ();

@@ -161,9 +166,7 @@
 			}

 			if (!convertOps.TryGetValue (toType, out conv)) {
-				argTypes = new Type[] {
-					fromType
-				};
+				argTypes = new [] { fromType };

 				if (toType == typeof (string)) {
 					methodInfo = fromType.GetMethod ("ToString", new Type[0]);
@@ -190,24 +193,24 @@

 		static object DynamicCast (object value, Type target)
 		{
-			string methodName = string.Format ("CastFrom{0}To{1}", value.GetType ().Name, target.Name);
-			TypeCastDelegate method = GenerateTypeCastDelegate (methodName, value.GetType (), target);
+			var methodName = string.Format ("CastFrom{0}To{1}", value.GetType ().Name, target.Name);
+			var method = GenerateTypeCastDelegate (methodName, value.GetType (), target);

 			return method.Invoke (value);
 		}

 		object TryForceCast (EvaluationContext ctx, Value value, TypeMirror fromType, TypeMirror toType)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
+			var cx = (SoftEvaluationContext) ctx;
 			MethodMirror method;

-			method = OverloadResolve (cx, toType, "op_Explicit", null, new TypeMirror[] { fromType }, false, true, false);
+			method = OverloadResolve (cx, toType, "op_Explicit", null, new [] { fromType }, false, true, false);
 			if (method != null)
-				return cx.RuntimeInvoke (method, toType, new Value[] { value });
-
-			method = OverloadResolve (cx, toType, "op_Implicit", null, new TypeMirror[] { fromType }, false, true, false);
+				return cx.RuntimeInvoke (method, toType, new [] { value });
+
+			method = OverloadResolve (cx, toType, "op_Implicit", null, new [] { fromType }, false, true, false);
 			if (method != null)
-				return cx.RuntimeInvoke (method, toType, new Value[] { value });
+				return cx.RuntimeInvoke (method, toType, new [] { value });

 			// Finally, try a ctor...
 			try {
@@ -217,26 +220,27 @@
 			}
 		}

-		public override object TryCast (EvaluationContext ctx, object obj, object targetType)
-		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
-			TypeMirror toType = targetType as TypeMirror;
+		public override object TryCast (EvaluationContext ctx, object val, object type)
+		{
+			var cx = (SoftEvaluationContext) ctx;
+			var toType = type as TypeMirror;
 			TypeMirror fromType;
-
-			if (obj == null)
+
+			if (val == null)
 				return null;

-			object valueType = GetValueType (ctx, obj);
-			if (valueType is TypeMirror) {
-				fromType = (TypeMirror) valueType;
-
+			var valueType = GetValueType (ctx, val);
+
+			fromType = valueType as TypeMirror;
+
+			if (fromType != null) {
 				if (toType != null && toType.IsAssignableFrom (fromType))
-					return obj;
+					return val;

 				// Try casting the primitive type of the enum
-				EnumMirror em = obj as EnumMirror;
+				var em = val as EnumMirror;
 				if (em != null)
-					return TryCast (ctx, CreateValue (ctx, em.Value), targetType);
+					return TryCast (ctx, CreateValue (ctx, em.Value), type);

 				if (toType == null)
 					return null;
@@ -246,91 +250,98 @@
 				if (toType.CSharpName == "string") {
 					method = OverloadResolve (cx, fromType, "ToString", null, new TypeMirror[0], true, false, false);
 					if (method != null)
-						return cx.RuntimeInvoke (method, obj, new Value[0]);
+						return cx.RuntimeInvoke (method, val, new Value[0]);
 				}

 				if (fromType.IsGenericType && fromType.FullName.StartsWith ("System.Nullable`1", StringComparison.Ordinal)) {
 					method = OverloadResolve (cx, fromType, "get_Value", null, new TypeMirror[0], true, false, false);
 					if (method != null) {
-						obj = cx.RuntimeInvoke (method, obj, new Value[0]);
-						return TryCast (ctx, obj, targetType);
-					}
-				}
-
-				return TryForceCast (ctx, (Value) obj, fromType, toType);
-			} else if (valueType is Type) {
+						val = cx.RuntimeInvoke (method, val, new Value[0]);
+						return TryCast (ctx, val, type);
+					}
+				}
+
+				return TryForceCast (ctx, (Value) val, fromType, toType);
+			}
+
+			var vtype = valueType as Type;
+
+			if (vtype != null) {
 				if (toType != null) {
 					if (toType.IsEnum) {
-						PrimitiveValue casted = TryCast (ctx, obj, toType.EnumUnderlyingType) as PrimitiveValue;
+						var casted = TryCast (ctx, val, toType.EnumUnderlyingType) as PrimitiveValue;
 						if (casted == null)
 							return null;
 						return cx.Session.VirtualMachine.CreateEnumMirror (toType, casted);
 					}

-					targetType = Type.GetType (toType.FullName, false);
+					type = Type.GetType (toType.FullName, false);
 				}

-				Type tt = targetType as Type;
+				var tt = type as Type;
 				if (tt != null) {
-					if (tt.IsAssignableFrom ((Type) valueType))
-						return obj;
+					if (tt.IsAssignableFrom (vtype))
+						return val;

 					try {
 						if (tt.IsPrimitive || tt == typeof (string)) {
-							if (obj is PrimitiveValue)
-								obj = ((PrimitiveValue) obj).Value;
-
-							if (obj == null)
+							var primitive = val as PrimitiveValue;
+
+							if (primitive != null)
+								val = primitive.Value;
+
+							if (val == null)
 								return null;

 							object res;

 							try {
 								if (tt == typeof (bool))
-									res = (bool) obj;
+									res = (bool) val;
 								else if (tt == typeof (byte))
-									res = (byte) obj;
+									res = (byte) val;
 								else if (tt == typeof (sbyte))
-									res = (sbyte) obj;
+									res = (sbyte) val;
 								else if (tt == typeof (char))
-									res = (char) obj;
+									res = (char) val;
 								else if (tt == typeof (short))
-									res = (short) obj;
+									res = (short) val;
 								else if (tt == typeof (ushort))
-									res = (ushort) obj;
+									res = (ushort) val;
 								else if (tt == typeof (int))
-									res = (int) obj;
+									res = (int) val;
 								else if (tt == typeof (uint))
-									res = (uint) obj;
+									res = (uint) val;
 								else if (tt == typeof (long))
-									res = (long) obj;
+									res = (long) val;
 								else if (tt == typeof (ulong))
-									res = (ulong) obj;
+									res = (ulong) val;
 								else if (tt == typeof (float))
-									res = (float) obj;
+									res = (float) val;
 								else if (tt == typeof (double))
-									res = (double) obj;
+									res = (double) val;
 								else if (tt == typeof (decimal))
-									res = (decimal) obj;
+									res = (decimal) val;
 								else if (tt == typeof (string))
-									res = (string) obj;
+									res = (string) val;
 								else if (tt == typeof (DateTime))
-									res = (DateTime) obj;
+									res = (DateTime) val;
 								else
-									res = obj;
+									res = val;
 							} catch {
-								res = DynamicCast (obj, tt);
+								res = DynamicCast (val, tt);
 							}

 							return CreateValue (ctx, res);
-						} else {
-							fromType = (TypeMirror) ForceLoadType (ctx, ((Type) valueType).FullName);
-							if (toType == null)
-								toType = (TypeMirror) ForceLoadType (ctx, tt.FullName);
-
-							return TryForceCast (ctx, (Value) obj, fromType, toType);
 						}
+
+						fromType = (TypeMirror) ForceLoadType (ctx, ((Type) valueType).FullName);
+						if (toType == null)
+							toType = (TypeMirror) ForceLoadType (ctx, tt.FullName);
+
+						return TryForceCast (ctx, (Value) val, fromType, toType);
 					} catch {
+						return null;
 					}
 				}
 			}
@@ -357,29 +368,27 @@

 		public override object CreateTypeObject (EvaluationContext ctx, object type)
 		{
-			TypeMirror t = (TypeMirror) type;
-			return t.GetTypeObject ();
+			return ((TypeMirror) type).GetTypeObject ();
 		}

 		public override object CreateValue (EvaluationContext ctx, object type, params object[] args)
 		{
 			ctx.AssertTargetInvokeAllowed ();

-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
-			TypeMirror t = (TypeMirror) type;
-
-			TypeMirror[] types = new TypeMirror [args.Length];
-			Value[] values = new Value[args.Length];
+			var cx = (SoftEvaluationContext) ctx;
+			var tm = (TypeMirror) type;
+
+			var types = new TypeMirror [args.Length];
+			var values = new Value[args.Length];
+
 			for (int n = 0; n < args.Length; n++) {
 				types[n] = ToTypeMirror (ctx, GetValueType (ctx, args[n]));
 				values[n] = (Value) args[n];
 			}

-			MethodMirror ctor = OverloadResolve (cx, t, ".ctor", null, types, true, true, true);
-			if (ctor == null)
-				return null;
-
-			return t.NewInstance (cx.Thread, ctor, values);
+			var ctor = OverloadResolve (cx, tm, ".ctor", null, types, true, true, true);
+
+			return ctor != null ? tm.NewInstance (cx.Thread, ctor, values) : null;
 		}

 		public override object CreateValue (EvaluationContext ctx, object value)
@@ -400,7 +409,7 @@

 		public override bool NullableHasValue (EvaluationContext ctx, object type, object obj)
 		{
-			ValueReference hasValue = GetMember (ctx, type, obj, "has_value");
+			var hasValue = GetMember (ctx, type, obj, "has_value");

 			return (bool) hasValue.ObjectValue;
 		}
@@ -412,45 +421,48 @@

 		public override object GetEnclosingType (EvaluationContext ctx)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
-			return cx.Frame.Method.DeclaringType;
+			return ((SoftEvaluationContext) ctx).Frame.Method.DeclaringType;
 		}

 		public override string[] GetImportedNamespaces (EvaluationContext ctx)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
-			HashSet<string> namespaces = new HashSet<string> ();
+			var namespaces = new HashSet<string> ();
+			var cx = (SoftEvaluationContext) ctx;
+
 			foreach (TypeMirror type in cx.Session.GetAllTypes ())
 				namespaces.Add (type.Namespace);

-			string[] nss = new string [namespaces.Count];
+			var nss = new string [namespaces.Count];
 			namespaces.CopyTo (nss);
+
 			return nss;
 		}

 		public override ValueReference GetIndexerReference (EvaluationContext ctx, object target, object[] indices)
 		{
 			object valueType = GetValueType (ctx, target);
-			TypeMirror targetType = null;
-
-			if (valueType is Type)
-				targetType = (TypeMirror) ForceLoadType (ctx, ((Type) valueType).FullName);
-			else if (valueType is TypeMirror)
-				targetType = (TypeMirror) valueType;
-			else
-				return null;
-
-			Value[] values = new Value [indices.Length];
-			TypeMirror[] types = new TypeMirror [indices.Length];
-			for (int n=0; n<indices.Length; n++) {
-				types [n] = ToTypeMirror (ctx, GetValueType (ctx, indices [n]));
-				values [n] = (Value) indices [n];
-			}
-
-			List<MethodMirror> candidates = new List<MethodMirror> ();
-			List<PropertyInfoMirror> props = new List<PropertyInfoMirror> ();
-
-			TypeMirror type = targetType;
+			var targetType = valueType as TypeMirror;
+
+			if (targetType == null) {
+				var tt = valueType as Type;
+
+				if (tt == null)
+					return null;
+
+				targetType = (TypeMirror) ForceLoadType (ctx, tt.FullName);
+			}
+
+			var values = new Value [indices.Length];
+			var types = new TypeMirror [indices.Length];
+			for (int n = 0; n < indices.Length; n++) {
+				types[n] = ToTypeMirror (ctx, GetValueType (ctx, indices[n]));
+				values[n] = (Value) indices[n];
+			}
+
+			var candidates = new List<MethodMirror> ();
+			var props = new List<PropertyInfoMirror> ();
+
+			var type = targetType;
 			while (type != null) {
 				foreach (PropertyInfoMirror prop in type.GetProperties ()) {
 					MethodMirror met = prop.GetGetMethod (true);
@@ -462,22 +474,23 @@
 				type = type.BaseType;
 			}

-			MethodMirror idx = OverloadResolve ((SoftEvaluationContext) ctx, targetType, null, null, types, candidates, true);
+			var idx = OverloadResolve ((SoftEvaluationContext) ctx, targetType, null, null, types, candidates, true);
 			int i = candidates.IndexOf (idx);
-
-			MethodMirror getter = props[i].GetGetMethod (true);
-			if (getter == null)
-				return null;
-
-			return new PropertyValueReference (ctx, props[i], target, null, getter, values);
+
+			var getter = props[i].GetGetMethod (true);
+
+			return getter != null ? new PropertyValueReference (ctx, props[i], target, null, getter, values) : null;
 		}

 		static bool InGeneratedClosureOrIteratorType (EvaluationContext ctx)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
+			var cx = (SoftEvaluationContext) ctx;
+
 			if (cx.Frame.Method.IsStatic)
 				return false;
-			TypeMirror tm = cx.Frame.Method.DeclaringType;
+
+			var tm = cx.Frame.Method.DeclaringType;
+
 			return IsGeneratedType (tm);
 		}

@@ -593,8 +606,8 @@
 		ValueReference GetHoistedThisReference (SoftEvaluationContext cx)
 		{
 			try {
-				Value val = cx.Frame.GetThis ();
-				TypeMirror type = (TypeMirror) GetValueType (cx, val);
+				var val = cx.Frame.GetThis ();
+				var type = (TypeMirror) GetValueType (cx, val);
 				return GetHoistedThisReference (cx, type, val);
 			} catch (AbsentInformationException) {
 			}
@@ -603,7 +616,7 @@

 		ValueReference GetHoistedThisReference (SoftEvaluationContext cx, TypeMirror type, object val)
 		{
-			foreach (FieldInfoMirror field in type.GetFields ()) {
+			foreach (var field in type.GetFields ()) {
 				if (IsHoistedThisReference (field))
 					return new FieldValueReference (cx, field, val, type, "this", ObjectValueFlags.Literal);

@@ -628,7 +641,8 @@

 		protected override ValueReference OnGetLocalVariable (EvaluationContext ctx, string name)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
+			var cx = (SoftEvaluationContext) ctx;
+
 			if (InGeneratedClosureOrIteratorType (cx))
 				return FindByName (OnGetLocalVariables (cx), v => v.Name, name, ctx.CaseSensitive);

@@ -656,7 +670,8 @@

 		protected override IEnumerable<ValueReference> OnGetLocalVariables (EvaluationContext ctx)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
+			var cx = (SoftEvaluationContext) ctx;
+
 			if (InGeneratedClosureOrIteratorType (cx)) {
 				ValueReference vthis = GetThisReference (cx);
 				return GetHoistedLocalVariables (cx, vthis).Union (GetLocalVariables (cx));
@@ -1050,7 +1065,7 @@

 		public override object GetType (EvaluationContext ctx, string name, object[] typeArgs)
 		{
-			SoftEvaluationContext cx = (SoftEvaluationContext) ctx;
+			var cx = (SoftEvaluationContext) ctx;

 			int i = name.IndexOf (',');
 			if (i != -1) {
@@ -1071,39 +1086,47 @@

 			if (typeArgs != null && typeArgs.Length > 0) {
 				string args = "";
-				foreach (object t in typeArgs) {
+
+				foreach (var argType in typeArgs) {
 					if (args.Length > 0)
 						args += ",";
+
+					var atm = argType as TypeMirror;
 					string tn;
-					if (t is TypeMirror) {
-						TypeMirror atm = (TypeMirror) t;
+
+					if (atm == null) {
+						var att = (Type) argType;
+
+						tn = att.FullName + "," + att.Assembly.GetName ();
+					} else {
 						tn = atm.FullName + "," + atm.Assembly.GetName ();
-					} else {
-						Type atm = (Type) t;
-						tn = atm.FullName + "," + atm.Assembly.GetName ();
-					}
+					}
+
 					if (tn.IndexOf (',') != -1)
 						tn = "[" + tn + "]";
+
 					args += tn;
 				}
+
 				name += "[" +args + "]";
 			}

-			TypeMirror tm = cx.Session.GetType (name);
+			var tm = cx.Session.GetType (name);
 			if (tm != null)
 				return tm;

-			foreach (AssemblyMirror asm in cx.Domain.GetAssemblies ()) {
+			foreach (var asm in cx.Domain.GetAssemblies ()) {
 				tm = asm.GetType (name, false, false);
 				if (tm != null)
 					return tm;
 			}
+
 			return null;
 		}

 		public override object GetParentType (EvaluationContext ctx, object type)
 		{
-			TypeMirror tm = type as TypeMirror;
+			var tm = type as TypeMirror;

 			if (tm != null) {
 				int plus = tm.FullName.LastIndexOf ('+');
@@ -1116,14 +1139,16 @@

 		public override IEnumerable<object> GetNestedTypes (EvaluationContext ctx, object type)
 		{
-			TypeMirror t = (TypeMirror) type;
-			foreach (TypeMirror nt in t.GetNestedTypes ())
-				yield return nt;
+			var tm = (TypeMirror) type;
+
+			foreach (var nested in tm.GetNestedTypes ())
+				yield return nested;
 		}

 		public override string GetTypeName (EvaluationContext ctx, object type)
 		{
-			TypeMirror tm = type as TypeMirror;
+			var tm = type as TypeMirror;
+
 			if (tm != null) {
 				if (IsGeneratedType (tm)) {
 					// Return the name of the container-type.
@@ -1133,7 +1158,7 @@
 				return tm.FullName;
 			}

-			return ((Type)type).FullName;
+			return ((Type) type).FullName;
 		}

 		public override object GetValueType (EvaluationContext ctx, object val)
@@ -1151,9 +1176,9 @@
 			if (val is PointerValue)
 				return ((PointerValue) val).Type;
 			if (val is PrimitiveValue) {
-				PrimitiveValue pv = (PrimitiveValue) val;
+				var pv = (PrimitiveValue) val;
 				if (pv.Value == null)
-					return typeof(Object);
+					return typeof (object);

 				return pv.Value.GetType ();
 			}
@@ -1163,15 +1188,14 @@

 		public override object GetBaseType (EvaluationContext ctx, object type)
 		{
-			if (type is TypeMirror)
-				return ((TypeMirror)type).BaseType;
-
-			return null;
+			var tm = type as TypeMirror;
+
+			return tm != null ? tm.BaseType : null;
 		}

 		public override bool HasMethod (EvaluationContext ctx, object targetType, string methodName, object[] genericTypeArgs, object[] argTypes, BindingFlags flags)
 		{
-			SoftEvaluationContext soft = (SoftEvaluationContext) ctx;
+			var soft = (SoftEvaluationContext) ctx;
 			TypeMirror[] typeArgs = null;
 			TypeMirror[] types = null;

@@ -1195,18 +1219,16 @@
 				}
 			}

-			MethodMirror method = OverloadResolve (soft, (TypeMirror) targetType, methodName, typeArgs, types, (flags & BindingFlags.Instance) != 0, (flags & BindingFlags.Static) != 0, false);
+			var method = OverloadResolve (soft, (TypeMirror) targetType, methodName, typeArgs, types, (flags & BindingFlags.Instance) != 0, (flags & BindingFlags.Static) != 0, false);
+
 			return method != null;
 		}

 		public override bool IsExternalType (EvaluationContext ctx, object type)
 		{
-			TypeMirror tm = type as TypeMirror;
-
-			if (tm != null)
-				return ((SoftEvaluationContext) ctx).Session.IsExternalCode (tm);
-
-			return true;
+			var tm = type as TypeMirror;
+
+			return tm == null || ((SoftEvaluationContext)ctx).Session.IsExternalCode (tm);
 		}

 		public override bool IsString (EvaluationContext ctx, object val)
@@ -1221,14 +1243,16 @@

 		public override bool IsValueType (object type)
 		{
-			TypeMirror t = type as TypeMirror;
-			return t != null && t.IsValueType;
+			var tm = type as TypeMirror;
+
+			return tm != null && tm.IsValueType;
 		}

 		public override bool IsClass (EvaluationContext ctx, object type)
 		{
-			TypeMirror t = type as TypeMirror;
-			return t != null && (t.IsClass || t.IsValueType) && !t.IsPrimitive;
+			var tm = type as TypeMirror;
+
+			return tm != null && (tm.IsClass || tm.IsValueType) && !tm.IsPrimitive;
 		}

 		public override bool IsNull (EvaluationContext ctx, object val)
@@ -1253,7 +1277,7 @@

 		protected override TypeDisplayData OnGetTypeDisplayData (EvaluationContext ctx, object type)
 		{
-			SoftEvaluationContext soft = (SoftEvaluationContext) ctx;
+			var soft = (SoftEvaluationContext) ctx;

 			Dictionary<string, DebuggerBrowsableState> memberData = null;
 			bool isCompilerGenerated = false;
@@ -1426,18 +1450,18 @@

 			soft.AssertTargetInvokeAllowed ();

-			TypeMirror[] genericTypes = new TypeMirror [genericTypeArgs != null ? genericTypeArgs.Length : 0];
+			var genericTypes = new TypeMirror [genericTypeArgs != null ? genericTypeArgs.Length : 0];
 			for (int n = 0; n < genericTypes.Length; n++)
 				genericTypes[n] = ToTypeMirror (soft, genericTypeArgs[n]);

-			TypeMirror[] types = new TypeMirror [argTypes.Length];
+			var types = new TypeMirror [argTypes.Length];
 			for (int n = 0; n < argTypes.Length; n++)
 				types[n] = ToTypeMirror (soft, argTypes[n]);

-			MethodMirror method = OverloadResolve (soft, type, methodName, genericTypes, types, target != null, target == null, true);
-
-			ParameterInfoMirror[] mparams = method.GetParameters ();
-			Value[] values = new Value [argValues.Length];
+			var method = OverloadResolve (soft, type, methodName, genericTypes, types, target != null, target == null, true);
+			var mparams = method.GetParameters ();
+			var values = new Value [argValues.Length];
+
 			for (int n = 0; n < argValues.Length; n++) {
 				var param_type = mparams[n].ParameterType;

@@ -1472,9 +1496,9 @@

 		public static MethodMirror OverloadResolve (SoftEvaluationContext ctx, TypeMirror type, string methodName, TypeMirror[] genericTypeArgs, TypeMirror[] argTypes, bool allowInstance, bool allowStatic, bool throwIfNotFound)
 		{
-			List<MethodMirror> candidates = new List<MethodMirror> ();
+			var candidates = new List<MethodMirror> ();
 			var cache = ctx.Session.OverloadResolveCache;
-			TypeMirror currentType = type;
+			var currentType = type;

 			while (currentType != null) {
 				MethodMirror[] methods = null;
@@ -1498,7 +1522,7 @@
 					}
 				}

-				foreach (MethodMirror method in methods) {
+				foreach (var method in methods) {
 					if (method.Name == methodName || (!ctx.CaseSensitive && method.Name.Equals (methodName, StringComparison.CurrentCultureIgnoreCase))) {
 						MethodMirror actualMethod;

@@ -1508,7 +1532,7 @@
 							actualMethod = method;
 						}

-						ParameterInfoMirror[] parms = actualMethod.GetParameters ();
+						var parms = actualMethod.GetParameters ();
 						if (argTypes == null || parms.Length == argTypes.Length && ((actualMethod.IsStatic && allowStatic) || (!actualMethod.IsStatic && allowInstance)))
 							candidates.Add (actualMethod);
 					}
@@ -1532,11 +1556,11 @@

 		static bool IsApplicable (SoftEvaluationContext ctx, MethodMirror method, TypeMirror[] genericTypeArgs, TypeMirror[] types, out string error, out int matchCount)
 		{
-			ParameterInfoMirror[] mparams = method.GetParameters ();
+			var mparams = method.GetParameters ();
 			matchCount = 0;

 			for (int i = 0; i < types.Length; i++) {
-				TypeMirror param_type = mparams[i].ParameterType;
+				var param_type = mparams[i].ParameterType;

 				if (param_type.FullName == types[i].FullName) {
 					matchCount++;
@@ -1608,9 +1632,9 @@
 			}

 			// Ok, now we need to find an exact match.
+			bool repeatedBestCount = false;
 			MethodMirror match = null;
 			int bestCount = -1;
-			bool repeatedBestCount = false;

 			foreach (MethodMirror method in candidates) {
 				string error;
@@ -1656,7 +1680,7 @@
 		public override object TargetObjectToObject (EvaluationContext ctx, object obj)
 		{
 			if (obj is StringMirror) {
-				StringMirror mirror = (StringMirror) obj;
+				var mirror = (StringMirror) obj;
 				string str;

 				if (ctx.Options.EllipsizeStrings) {
@@ -1677,12 +1701,16 @@
 				}

 				return str;
-			} else if (obj is PrimitiveValue) {
+			}
+
+			if (obj is PrimitiveValue)
 				return ((PrimitiveValue)obj).Value;
-			} else if (obj is PointerValue) {
+
+			if (obj is PointerValue)
 				return new IntPtr (((PointerValue)obj).Address);
-			} else if (obj is StructMirror) {
-				StructMirror sm = (StructMirror) obj;
+
+			if (obj is StructMirror) {
+				var sm = (StructMirror) obj;

 				if (sm.Type.IsPrimitive) {
 					// Boxed primitive
@@ -1691,13 +1719,15 @@
 					if (sm.Fields.Length > 0 && (sm.Fields[0] is PrimitiveValue))
 						return ((PrimitiveValue)sm.Fields[0]).Value;
 				} else if (sm.Type.FullName == "System.Decimal") {
-					SoftEvaluationContext soft = (SoftEvaluationContext) ctx;
-					MethodMirror method = OverloadResolve (soft, sm.Type, "GetBits", null, new TypeMirror[1] { sm.Type }, false, true, false);
+					var soft = (SoftEvaluationContext) ctx;
+
+					var method = OverloadResolve (soft, sm.Type, "GetBits", null, new [] { sm.Type }, false, true, false);
+
 					if (method != null) {
 						ArrayMirror array;

 						try {
-							array = sm.Type.InvokeMethod (soft.Thread, method, new Value[1] { sm }, InvokeOptions.DisableBreakpoints | InvokeOptions.SingleThreaded) as ArrayMirror;
+							array = sm.Type.InvokeMethod (soft.Thread, method, new [] { sm }, InvokeOptions.DisableBreakpoints | InvokeOptions.SingleThreaded) as ArrayMirror;
 						} catch {
 							array = null;
 						} finally {
@@ -1705,7 +1735,8 @@
 						}

 						if (array != null) {
-							int[] bits = new int [4];
+							var bits = new int[4];
+
 							for (int i = 0; i < 4; i++)
 								bits[i] = (int) TargetObjectToObject (ctx, array[i]);

@@ -1714,6 +1745,7 @@
 					}
 				}
 			}
+
 			return base.TargetObjectToObject (ctx, obj);
 		}
 	}
@@ -1722,7 +1754,7 @@
 	{
 		const InvokeOptions options = InvokeOptions.DisableBreakpoints | InvokeOptions.SingleThreaded;

-		readonly ST.ManualResetEvent shutdownEvent = new ST.ManualResetEvent (false);
+		readonly ManualResetEvent shutdownEvent = new ManualResetEvent (false);
 		readonly SoftEvaluationContext ctx;
 		readonly MethodMirror function;
 		readonly Value[] args;
@@ -1799,14 +1831,10 @@
 			} catch (InvocationException ex) {
 				if (!Aborting && ex.Exception != null) {
 					string ename = ctx.Adapter.GetValueTypeName (ctx, ex.Exception);
-					ValueReference vref = ctx.Adapter.GetMember (ctx, null, ex.Exception, "Message");
-					if (vref != null) {
-						exception = new Exception (ename + ": " + (string)vref.ObjectValue);
-						return;
-					} else {
-						exception = new Exception (ename);
-						return;
-					}
+					var vref = ctx.Adapter.GetMember (ctx, null, ex.Exception, "Message");
+
+					exception = vref != null ? new Exception (ename + ": " + (string) vref.ObjectValue) : new Exception (ename);
+					return;
 				}
 				exception = ex;
 			} catch (Exception ex) {
@@ -1840,7 +1868,7 @@
 		{
 			if (handle == null)
 				return true;
-			int res = ST.WaitHandle.WaitAny (new ST.WaitHandle[] { handle.AsyncWaitHandle, shutdownEvent }, timeout);
+			int res = WaitHandle.WaitAny (new WaitHandle[] { handle.AsyncWaitHandle, shutdownEvent }, timeout);
 			if (res == 0) {
 				EndInvoke ();
 				return true;


Fixed string formatter

Fixed string formatter

--- Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
+++ Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
@@ -460,7 +460,7 @@

 			string typeName = ctx.Adapter.GetDisplayTypeName (ctx, type);

-			throw new EvaluatorException ("Constructor not found for type `{1}'.", typeName);
+			throw new EvaluatorException ("Constructor not found for type `{0}'.", typeName);
 		}

 		public override object CreateValue (EvaluationContext ctx, object value)


Fixed stepping over recursive call with breakpoint which redid step since it was at same location, but on different frame depth

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -96,6 +96,7 @@
 		string remoteProcessName;
 		long currentAddress = -1;
 		IAsyncResult connection;
+		int currentStackDepth;
 		ProcessInfo[] procs;
 		Thread eventHandler;
 		VirtualMachine vm;
@@ -834,6 +835,7 @@
 			try {
 				thread.SetIP (location);
 				currentAddress = location.ILOffset;
+				currentStackDepth = frames.Length;
 			} catch (ArgumentException) {
 				throw new NotSupportedException ();
 			}
@@ -1770,7 +1772,8 @@
 						if (breakpoints.TryGetValue (be.Request, out binfo)) {
 							if (currentStepRequest != null &&
 							    binfo.Location.ILOffset == currentAddress &&
-							    e.Thread.Id == currentStepRequest.Thread.Id)
+							    e.Thread.Id == currentStepRequest.Thread.Id &&
+								currentStackDepth == e.Thread.GetFrames ().Length)
 								redoCurrentStep = true;

 							breakEvent = binfo.BreakEvent;
@@ -1822,6 +1825,7 @@
 				if (backtrace.FrameCount > 0) {
 					var frame = backtrace.GetFrame (0) as SoftDebuggerStackFrame;
 					currentAddress = frame != null ? frame.Address : -1;
+					currentStackDepth = backtrace.FrameCount;

 					if (frame != null && steppedInto) {
 						if (ContinueOnStepInto (frame.StackFrame.Method)) {


Set JMC fix to repair tests: BreakpointsAndSteppingTests.BreakpointInsideOneLineDelegateAsync BreakpointsAndSteppingTests.DebuggerHiddenMethod BreakpointsAndSteppingTests.DebuggerNonUserCodeMethod BreakpointsAndSteppingTests.DebuggerStepThroughMethod

--- Mono.Debugging.Win32/CorDebuggerSession.cs
+++ Mono.Debugging.Win32/CorDebuggerSession.cs
@@ -513,6 +513,7 @@

 			string file = e.Module.Assembly.Name;
 			var newDocuments = new Dictionary<string, DocInfo> ();
+			var justMyCode = false;
 			ISymbolReader reader = null;
 			if (file.IndexOfAny (badPathChars) == -1) {
 				try {
@@ -520,6 +521,9 @@
 						SymSearchPolicies.AllowOriginalPathAccess | SymSearchPolicies.AllowReferencePathAccess);
 					if (reader != null) {
 						OnDebuggerOutput (false, string.Format("Symbols for module {0} loaded", file));
+						// set JMC to true only when we got the reader.
+						// When module JMC is true, debugger will step into it
+						justMyCode = true;
 						foreach (ISymbolDocument doc in reader.GetDocuments ()) {
 							if (string.IsNullOrEmpty (doc.URL))
 								continue;
@@ -535,22 +539,13 @@
 				catch (Exception ex) {
 					OnDebuggerOutput (true, string.Format ("Debugger Error: {0}\n", ex.Message));
 				}
-				try {
-					e.Module.SetJmcStatus (true, null);
-				}
-				catch {
-					// somewhen exceptions is thrown
-				}
-			}
-			else {
-				// Flag modules without debug info as not JMC. In this way
-				// the debugger won't try to step into them
-				try {
-					e.Module.SetJmcStatus (false, null);
-				}
-				catch {
-					// somewhen exceptions is thrown
-				}
+			}
+			try {
+				e.Module.SetJmcStatus (justMyCode, null);
+			}
+			catch (COMException ex) {
+				// somewhen exceptions is thrown
+				DebuggerLoggingService.LogMessage ("Exception during setting JMC: {0}", ex.Message);
 			}

 			lock (documents) {


Refactor TextureRegion

Refactor TextureRegion

--- MonoHaven.Client/Graphics/TextureRegion.cs
+++ MonoHaven.Client/Graphics/TextureRegion.cs
@@ -1,41 +1,30 @@
 using System;
 using System.Drawing;
 using System.IO;
+using OpenTK;

 namespace MonoHaven.Graphics
 {
 	public class TextureRegion : Drawable
 	{
-		private readonly Texture texture;
-		private readonly bool isOwner;
-		private readonly int x;
-		private readonly int y;
-		private RectangleF textureBounds;
+		private readonly Texture tex;
+		private readonly Vector2 uv;
+		private readonly Vector2 uv2;
+		private readonly bool ownsTexture;

-		public TextureRegion(Texture texture, Rectangle region, bool isOwner = false)
-			: this(texture, region.X, region.Y, region.Width, region.Height, isOwner)
+		public TextureRegion(Texture tex, RectangleF region, bool ownsTexture = false)
 		{
+			this.tex = tex;
+			this.ownsTexture = ownsTexture;
+			this.uv = new Vector2(region.X / tex.Width, region.Y / tex.Height);
+			this.uv2 = new Vector2(region.Right / tex.Width, region.Bottom / tex.Height);
+			this.Width = (int)region.Width;
+			this.Height = (int)region.Height;
 		}

-		public TextureRegion(
-			Texture texture,
-			int x,
-			int y,
-			int width,
-			int height,
-			bool isOwner = false)
+		public TextureRegion(Texture tex, int x, int y, int w, int h, bool ownsTexture = false)
+			: this(tex, new RectangleF(x, y, w, h), ownsTexture)
 		{
-			this.texture = texture;
-			this.isOwner = isOwner;
-			this.x = x;
-			this.y = y;
-			this.Width = width;
-			this.Height = height;
-			this.textureBounds = RectangleF.FromLTRB(
-				(float)x / texture.Width,
-				(float)y / texture.Height,
-				(float)(x + width) / texture.Width,
-				(float)(y + height) / texture.Height);
 		}

 		public static TextureRegion FromBitmap(byte[] bitmapData)
@@ -56,28 +45,26 @@

 		public override void Dispose()
 		{
-			if (isOwner)
-				texture.Dispose();
+			if (ownsTexture)
+				tex.Dispose();
 		}

 		public override void Draw(SpriteBatch batch, int x, int y, int w, int h)
 		{
-			batch.Draw(texture, x, y, w, h,
-				textureBounds.Left, textureBounds.Top,
-				textureBounds.Right, textureBounds.Bottom);
+			batch.Draw(tex, x, y, w, h, uv.X, uv.Y, uv2.X, uv2.Y);
 		}

 		public TextureRegion Update(Bitmap bitmap)
 		{
-			texture.Bind();
-			texture.Update(x, y, bitmap);
+			tex.Bind();
+			tex.Update((int)(tex.Width * uv.X), (int)(tex.Height * uv.Y), bitmap);
 			return this;
 		}

 		public TextureRegion Update(RawImage image)
 		{
-			texture.Bind();
-			texture.Update(x, y, image);
+			tex.Bind();
+			tex.Update((int)(tex.Width * uv.X), (int)(tex.Height * uv.Y), image);
 			return this;
 		}
 	}


Updated mobile columns.

Updated mobile columns.

--- MoviePicker.WebApp/Views/Home/Index.cshtml
+++ MoviePicker.WebApp/Views/Home/Index.cshtml
@@ -204,7 +204,8 @@

-

+
+

 				@*BEGIN Accordion body*@

@@ -212,22 +213,22 @@

 					@foreach (var movie in Model.Miners.First().Movies)
 					{
+						int minerCount = 0;
+

-
-
-

-
+
+
+

+

-

-
-

-

-

+

@movie.Cost BUX

@movie.Name

@@ -253,13 +254,14 @@

-

+

 								@foreach (var miner in Model.Miners.Skip(2))
 								{
 									var minerMovie = miner.Movies.FirstOrDefault(item => item.Name == movie.Name);
 									var lastWeek = Model.Miners.Last().Movies?.FirstOrDefault(item => item.Name == movie.Name);
 									var errorStyle = !string.IsNullOrEmpty(miner.Error) ? @" color: #cc3333;" : string.Empty;
+									var colorBackgroundStyle = minerCount % 2 == 0 ? "background-color:hsl(0, 0%, 90%);" : string.Empty;

 									decimal percent = 0;

@@ -267,16 +269,18 @@
 									{
 										percent = (minerMovie.EarningsBase - lastWeek.EarningsBase) / lastWeek.EarningsBase * 100;
 									}
-

+

 										@miner.Abbreviation

-

-										 @string.Format("{0}", miner.Error ?? minerMovie?.EarningsBase.ToString("N0"))
+

+										 @string.Format("{0}", string.IsNullOrEmpty(miner.Error) ? minerMovie?.EarningsBase.ToString("N0") : miner.Error)

-

+

 										 @string.Format("{0}", percent != 0 ? " " + percent.ToString("N0") + "%" : string.Empty)

-				}
+
+									minerCount++;
+								}


googie is evil, no need to credit him

googie is evil, no need to credit him

--- NadekoBot/Commands/VoicePlusTextCommand.cs
+++ NadekoBot/Commands/VoicePlusTextCommand.cs
@@ -9,13 +9,6 @@
 using ChPermOverride = Discord.ChannelPermissionOverrides;

 namespace NadekoBot.Commands {
-    /// <summary>
-    /// This is an ingenious idea by @Googie2149 a few months back.
-    /// He never got around to implementing it, so i grew impatient
-    /// and did it myself. Googie is cool guy and a creator of RoboNitori
-    /// You can check out his server here: https://discord.gg/0ZgChoTkuxAzARfF
-    /// sowwy googie ;(
-    /// </summary>
     internal class VoicePlusTextCommand : DiscordCommand {

         public VoicePlusTextCommand(DiscordModule module) : base(module) {


removed -

removed -

--- NadekoBot/Modules/Pokemon/PokemonModule.cs
+++ NadekoBot/Modules/Pokemon/PokemonModule.cs
@@ -253,7 +253,7 @@
                                 return;
                             }
                             var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(NadekoBot.Config.CurrencyName[0]);
--                            await e.Channel.SendMessage($"{e.User.Name} healed {usr.Name} for {targetStats.MaxHp - HP} HP with {(vowelFirst ? "an" : "a")} {NadekoBot.Config.CurrencySign}");
+                            await e.Channel.SendMessage($"{e.User.Name} healed {usr.Name} for {targetStats.MaxHp - HP} HP with {(vowelFirst ? "an" : "a")} {NadekoBot.Config.CurrencySign}");
                             return;
                         }
                         else


actually use the type.

actually use the type.

--- Newtonsoft.Json.Comparer/JTokenComparer.cs
+++ Newtonsoft.Json.Comparer/JTokenComparer.cs
@@ -40,7 +40,7 @@

             var type = token1 == null ? token2.Type : token1.Type;

-            switch (token1.Type)
+            switch (type)
             {
                 case JTokenType.None:
                     throw new NotImplementedException();


Fixed UX for Removing all Ignores

Fixed UX for Removing all Ignores

--- NoAdsHere/Commands/Ignores/IgnoreModule.cs
+++ NoAdsHere/Commands/Ignores/IgnoreModule.cs
@@ -104,7 +104,7 @@
         [RequirePermission(AccessLevel.HighModerator)]
         public async Task RemoveAll(IGuildUser guildUser)
         {
-            var ignores = _unit.Ignores.Get(guildUser);
+            var ignores = _unit.Ignores.Get(guildUser).ToList();

             if (ignores.Any())
             {
@@ -123,7 +123,7 @@
         [RequirePermission(AccessLevel.HighModerator)]
         public async Task RemoveAll(IRole role)
         {
-            var ignores = _unit.Ignores.Get(role);
+            var ignores = _unit.Ignores.Get(role).ToList();

             if (ignores.Any())
             {
@@ -183,7 +183,7 @@
         public async Task Remove(string blocktype, IGuildUser guildUser)
         {
             var type = BlockModule.ParseBlockType(blocktype.ToLower());
-            var ignore = _unit.Ignores.Get(guildUser).Where(ig => ig.BlockType == type).FirstOrDefault();
+            var ignore = _unit.Ignores.Get(guildUser).FirstOrDefault(ig => ig.BlockType == type);

             if (ignore != null)
             {
@@ -202,7 +202,7 @@
         public async Task Remove(string blocktype, IRole role)
         {
             var type = BlockModule.ParseBlockType(blocktype.ToLower());
-            var ignore = _unit.Ignores.Get(role).Where(ig => ig.BlockType == type).FirstOrDefault();
+            var ignore = _unit.Ignores.Get(role).FirstOrDefault(ig => ig.BlockType == type);

             if (ignore != null)
             {


Rename columns/rowsize + type

Rename columns/rowsize + type

--- osu.Framework/Graphics/Containers/TableContainer.cs
+++ osu.Framework/Graphics/Containers/TableContainer.cs
@@ -41,19 +41,19 @@
             }
         }

-        private Column[] columns = Array.Empty<Column>();
+        private TableColumn[] columns = Array.Empty<TableColumn>();

         /// <summary>
         /// Describes the columns of this <see cref="TableContainer"/>.
         /// Each index of this array applies to the respective column index inside <see cref="Content"/>.
         /// </summary>
         [CanBeNull]
-        public Column[] Columns
+        public TableColumn[] Columns
         {
             get => columns;
             set
             {
-                value = value ?? Array.Empty<Column>();
+                value = value ?? Array.Empty<TableColumn>();

                 if (columns == value)
                     return;
@@ -64,21 +64,21 @@
             }
         }

-        private Dimension rowDimension;
+        private Dimension rowSize;

         /// <summary>
         /// Explicit dimensions for rows. The dimension is applied to every row of this <see cref="TableContainer"/>
         /// </summary>
         [CanBeNull]
-        public Dimension RowDimension
-        {
-            get => rowDimension;
-            set
-            {
-                if (rowDimension == value)
-                    return;
-
-                rowDimension = value;
+        public Dimension RowSize
+        {
+            get => rowSize;
+            set
+            {
+                if (rowSize == value)
+                    return;
+
+                rowSize = value;

                 updateContent();
             }
@@ -151,7 +151,7 @@
                 grid.Content = getContentWithHeaders().ToJagged();

                 grid.ColumnDimensions = columns.Select(c => c.Dimension).ToArray();
-                grid.RowDimensions = Enumerable.Repeat(rowDimension ?? new Dimension(), totalRows).ToArray();
+                grid.RowDimensions = Enumerable.Repeat(rowSize ?? new Dimension(), totalRows).ToArray();
             }

             updateAnchors();
@@ -231,10 +231,10 @@
                 grid.AutoSizeAxes |= Axes.Y;
         }

-        protected virtual Drawable CreateHeader(int index, [CanBeNull] Column column) => new SpriteText { Text = column?.Header ?? string.Empty };
+        protected virtual Drawable CreateHeader(int index, [CanBeNull] TableColumn column) => new SpriteText { Text = column?.Header ?? string.Empty };
     }

-    public class Column
+    public class TableColumn
     {
         public readonly string Header;

@@ -242,7 +242,7 @@

         public readonly Dimension Dimension;

-        public Column(string header = null, Anchor anchor = Anchor.TopLeft, Dimension dimension = null)
+        public TableColumn(string header = null, Anchor anchor = Anchor.TopLeft, Dimension dimension = null)
         {
             Header = header ?? "";
             Anchor = anchor;