Update HopcroftKarp.cs

Update HopcroftKarp.cs

--- Algorithm.Sandbox/GraphAlgorithms/Matching/HopcroftKarp.cs
+++ Algorithm.Sandbox/GraphAlgorithms/Matching/HopcroftKarp.cs
@@ -8,7 +8,7 @@
 {

     /// <summary>
-    ///  Compute Max BiParitite Edges using Ford-Fukerson algorithm
+    ///  Compute Max BiParitite Edges using Hopcroft Karp algorithm
     /// </summary>
     /// <typeparam name="T"></typeparam>
     public class HopcroftKarpMatching<T>
@@ -63,7 +63,8 @@

                         var pathResult = DFS(graph.Vertices[vertex],
                           leftMatch, rightMatch, visited, true);
-
+
+                        //XOR remaining done here (partially done inside DFS)
                         foreach(var pair in pathResult)
                         {
                             if(pair.isRight)
@@ -84,7 +85,7 @@

             }

-            //now gather all group1 to group 2 edges in residual graph with positive flow
+            //now gather all
             var result = new AsArrayList<MatchEdge<T>>();

             foreach (var item in leftMatch)
@@ -144,7 +145,7 @@
                 if (pathResult!=null)
                 {
                     //XOR (partially done here by removing same edges)
-                    //other part of XOR (adding new ones) is done after this method is finished
+                    //other part of XOR (adding new ones) is done after DFS method is finished
                     if (leftMatch.ContainsKey(current.Value)
                         && leftMatch[current.Value].Equals(edge.Value.Value))
                     {


Link SEDE page to specific site

Link SEDE page to specific site

http://meta.stackexchange.com/questions/253626/link-sede-page-to-specific-site

Add  the a href from the Home/Index page to the site img tag on QuerySet/Index

--- App/StackExchange.DataExplorer/Views/QuerySet/Index.cshtml
+++ App/StackExchange.DataExplorer/Views/QuerySet/Index.cshtml
@@ -30,7 +30,9 @@
         }

-
+
+
+

@site.Tagline


Added new category type - COMMERCIAL

Added new category type - COMMERCIAL

--- AugmentedSzczecin/AugmentedSzczecin/Models/CategoryType.cs
+++ AugmentedSzczecin/AugmentedSzczecin/Models/CategoryType.cs
@@ -12,6 +12,7 @@
         POI,
         EVENT,
         PERSON,
+        COMMERCIAL,
         ALL
     }
 }


Only test image content when requested (not ==)

--- agg/Image/ImageBuffer.cs
+++ agg/Image/ImageBuffer.cs
@@ -1007,7 +1007,7 @@
 			return false;
 		}

-		public bool Equals(ImageBuffer b, int maxError = 0)
+		public bool Equals(ImageBuffer b, int maxError)
 		{
 			if (Width == b.Width
 				&& Height == b.Height


Pinning test Main

Pinning test Main

--- GCL.Syntax.Tests/ProgramTests.cs
+++ GCL.Syntax.Tests/ProgramTests.cs
@@ -18,6 +18,23 @@
     {
         [Fact]
         public static void Main()
+        {
+            var sourceCode = File.ReadAllText(@"TestData\SourceCode.txt");
+            var sourceTokens = File.ReadAllText(@"TestData\Tokens.txt");
+            var grammarCode = File.ReadAllText(@"TestData\GrammarGCL.txt");
+            var grammarTokens = File.ReadAllText(@"TestData\GrammarTokens.txt");
+
+            var codeParser = new CodeParser(new Lexer(sourceTokens),
+                grammarCode,
+                new Lexer(grammarTokens),
+                new GclCodeGenerator(),
+                new DynamicCodeProvider(),
+                new SemanticAnalysis());
+            codeParser.Parse(sourceCode);
+        }
+
+        [Fact]
+        public static void StubMain()
         {
             var sourceCode = File.ReadAllText(@"TestData\SourceCode.txt");
             var sourceTokens = File.ReadAllText(@"TestData\Tokens.txt");


Updated FRectangle methods Contains and Intersects

--- GameEngine/Drawing/FRectangle.cs
+++ GameEngine/Drawing/FRectangle.cs
@@ -15,10 +15,23 @@
         public float Width { get { return _width; } set { _width = value; } }
         public float Height { get { return _height; } set { _height = value; } }

+        public float Top { get { return _y; } }
+        public float Left { get { return _x; } }
+        public float Bottom { get { return _y + _height; } }
+        public float Right { get { return _x + _width; } }
+
         private float _x;
         private float _y;
         private float _width;
         private float _height;
+
+        public FRectangle(Rectangle Rectangle)
+        {
+            _x = Rectangle.X;
+            _y = Rectangle.Y;
+            _width = Rectangle.Width;
+            _height = Rectangle.Height;
+        }

         public FRectangle(float X, float Y, float Width, float Height)
         {
@@ -27,6 +40,61 @@
             _width = Width;
             _height = Height;
         }
+
+        public bool Intersects(FRectangle FRectangle)
+        {
+            return !(FRectangle.Right < this.Left
+                      || FRectangle.Left > this.Right
+                      || FRectangle.Bottom < this.Top
+                      || FRectangle.Top > this.Bottom );
+        }
+
+        public bool Contains(FRectangle FRectangle)
+        {
+            return !(FRectangle.Right < this.Left || FRectangle.Right > this.Right
+                     || FRectangle.Left < this.Left || FRectangle.Left > this.Right
+                     || FRectangle.Top < this.Top || FRectangle.Top > this.Bottom
+                     || FRectangle.Bottom < this.Top || FRectangle.Bottom > this.Bottom);
+        }
+
+        public bool Intersects(Rectangle Rectangle)
+        {
+            return Intersects(new FRectangle(Rectangle));
+        }
+
+        public bool Contains(Rectangle Rectangle)
+        {
+            return Contains(new FRectangle(Rectangle));
+        }
+
+        public Rectangle ToRectangle()
+        {
+            return new Rectangle(
+                (int)Math.Ceiling(X),
+                (int)Math.Ceiling(Y),
+                (int)Math.Ceiling(Width),
+                (int)Math.Ceiling(Height));
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (obj is FRectangle)
+                return this == (FRectangle)obj;
+            else
+                return false;
+        }
+
+        public override int GetHashCode()
+        {
+            return X.GetHashCode() + Y.GetHashCode() + Width.GetHashCode() + Height.GetHashCode();
+        }
+
+        public override string ToString()
+        {
+            return string.Format("FRectangle: X={0}, Y={1}, Width={2}, Height={3}", X, Y, Width, Height);
+        }
+
+        #region Static Operators

         public static FRectangle operator +(FRectangle FRectangle, Vector2 Vector)
         {
@@ -62,31 +130,6 @@
             return !(FRect1 == FRect2);
         }

-        public Rectangle ToRectangle()
-        {
-            return new Rectangle(
-                (int)Math.Ceiling(X),
-                (int)Math.Ceiling(Y),
-                (int)Math.Ceiling(Width),
-                (int)Math.Ceiling(Height));
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (obj is FRectangle)
-                return this == (FRectangle)obj;
-            else
-                return false;
-        }
-
-        public override int GetHashCode()
-        {
-            return X.GetHashCode() + Y.GetHashCode() + Width.GetHashCode() + Height.GetHashCode();
-        }
-
-        public override string ToString()
-        {
-            return string.Format("FRectangle: X={0}, Y={1}, Width={2}, Height={3}", X, Y, Width, Height);
-        }
+        #endregion
     }
 }


Ignore exception when file access time is not valid

When getting the value from FileSystemInfo.LastAccessTime, it will internally convert
the FILETIME value from Windows API to a DateTime. If the value represents a date after
12/31/9999 it will throw ArgumentOutOfRangeException, because this is not supported by
DateTime. Some file systems seem to set strange access timestamps on files, which
may lead to this exception being thrown. Since the last accessed timestamp is not
important such exceptions are now just silently ignored.

--- Duplicati/Library/Common/IO/SystemIOWindows.cs
+++ Duplicati/Library/Common/IO/SystemIOWindows.cs
@@ -508,7 +508,19 @@
         public IFileEntry FileEntry(string path)
         {
             var fileInfo = new FileInfo(AddExtendedDevicePathPrefix(path));
-            return new FileEntry(fileInfo.Name, fileInfo.Length, fileInfo.LastAccessTime, fileInfo.LastWriteTime);
+            var lastAccess = new DateTime();
+            try
+            {
+                // Internally this will convert the FILETIME value from Windows API to a
+                // DateTime. If the value represents a date after 12/31/9999 it will throw
+                // ArgumentOutOfRangeException, because this is not supported by DateTime.
+                // Some file systems seem to set strange access timestamps on files, which
+                // may lead to this exception being thrown. Since the last accessed
+                // timestamp is not important such exeptions are just silently ignored.
+                lastAccess = fileInfo.LastAccessTime;
+            }
+            catch { }
+            return new FileEntry(fileInfo.Name, fileInfo.Length, lastAccess, fileInfo.LastWriteTime);
         }

         public Dictionary<string, string> GetMetadata(string path, bool isSymlink, bool followSymlink)


remove spaces

remove spaces

--- Duplicati/Library/Common/IO/SystemIOWindows.cs
+++ Duplicati/Library/Common/IO/SystemIOWindows.cs
@@ -490,7 +490,7 @@

             // Only include the following key when its value is True.
             // This prevents unnecessary 'metadata change' detections when upgrading from
-            //   older versions (pre-2.0.5.101) that didn't store this value at all.
+            // older versions (pre-2.0.5.101) that didn't store this value at all.
             // When key is not present, its value is presumed False by the restore code.
             if (rules.AreAccessRulesProtected)
             {


Filter AllOpenSystemWindows list to items with assigned parents only

--- Gui/SystemWindow/SystemWindow.cs
+++ Gui/SystemWindow/SystemWindow.cs
@@ -31,6 +31,7 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Linq;

 namespace MatterHackers.Agg.UI
 {
@@ -99,7 +100,7 @@

 		public override void OnClosed(EventArgs e)
 		{
-            allOpenSystemWindows.Remove(this);
+			allOpenSystemWindows.Remove(this);
 			base.OnClosed(e);
 			if (Parent != null)
 			{
@@ -107,19 +108,19 @@
 			}
 		}

-        static List<SystemWindow> allOpenSystemWindows = new List<SystemWindow>();
-        public static List<SystemWindow> AllOpenSystemWindows
-        {
-            get
-            {
-                return new List<SystemWindow>(allOpenSystemWindows);
-            }
-        }
+		static List<SystemWindow> allOpenSystemWindows = new List<SystemWindow>();
+		public static List<SystemWindow> AllOpenSystemWindows
+		{
+			get
+			{
+				return allOpenSystemWindows.Where(window => window.Parent != null).ToList();
+			}
+		}

 		public SystemWindow(double width, double height)
 			: base(width, height, SizeLimitsToSet.None)
 		{
-            ToolTipManager = new ToolTipManager(this);
+			ToolTipManager = new ToolTipManager(this);
 			if (globalSystemWindowCreator == null)
 			{
 				string pluginPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
@@ -131,7 +132,7 @@
 				globalSystemWindowCreator = systemWindowCreatorFinder.Plugins[0];
 			}

-            allOpenSystemWindows.Add(this);
+			allOpenSystemWindows.Add(this);
 		}

 		public override Vector2 MinimumSize
@@ -210,9 +211,9 @@
 #endif
 		}

-        public void SetHoveredWidget(GuiWidget widgetToShowToolTipFor)
-        {
-            ToolTipManager.SetHoveredWidget(widgetToShowToolTipFor);
-        }
-    }
+		public void SetHoveredWidget(GuiWidget widgetToShowToolTipFor)
+		{
+			ToolTipManager.SetHoveredWidget(widgetToShowToolTipFor);
+		}
+	}
 }


Allow statements to end with EOF instead of forcing a newline for every evaluated statement

--- EOBot/Interpreter/States/StatementEvaluator.cs
+++ EOBot/Interpreter/States/StatementEvaluator.cs
@@ -22,7 +22,7 @@
                     || Evaluate<KeywordEvaluator>(input)
                     || Evaluate<LabelEvaluator>(input)
                     || Evaluate<FunctionEvaluator>(input))
-                    && input.Expect(BotTokenType.NewLine);
+                    && (input.Expect(BotTokenType.NewLine) || input.Expect(BotTokenType.EOF));
         }

         private bool Evaluate<T>(ProgramState input)


Minor refactoring.

Minor refactoring.

--- Easy.Common/Extensions/EnumerableExtensions.cs
+++ Easy.Common/Extensions/EnumerableExtensions.cs
@@ -101,9 +101,7 @@
         [DebuggerStepThrough]
         public static T SelectRandom<T>(this IEnumerable<T> sequence, Random random)
         {
-            // Optimization for ICollection<T>
-            var collection = sequence as ICollection<T>;
-            if (collection != null)
+            if (sequence is ICollection<T> collection)
             {
                 return collection.ElementAt(random.Next(collection.Count));
             }


add another type to invoke-scriptanalyzer cmdlet

--- Engine/Commands/InvokeScriptAnalyzerCommand.cs
+++ Engine/Commands/InvokeScriptAnalyzerCommand.cs
@@ -25,6 +25,7 @@
         SupportsShouldProcess = true,
         HelpUri = "https://go.microsoft.com/fwlink/?LinkId=525914")]
     [OutputType(typeof(DiagnosticRecord))]
+    [OutputType(typeof(SuppressedRecord))]
     public class InvokeScriptAnalyzerCommand : PSCmdlet, IOutputWriter
     {
         #region Private variables


Update currency ui item and display.

Update currency ui item and display.

--- Engine/Game/App/BaseApp/BaseGameProfileRPGs.cs
+++ Engine/Game/App/BaseApp/BaseGameProfileRPGs.cs
@@ -427,8 +427,9 @@
         base.Reset();
         username = ProfileConfigs.defaultPlayerName;
     }
-
-    // upgrades_applied
+
+    // ----------------------------------------------------------
+    // UPGRADES_APPLIED

     public virtual double GetUpgradesApplied() {
         return GetUpgradesApplied(0.0);
@@ -444,8 +445,9 @@
     public virtual void SetUpgradesApplied(double val) {
         SetAttributeDoubleValue(GameItemRPGAttributes.upgrades_applied, val);
     }
-
-    // upgrades
+
+    // ----------------------------------------------------------
+    // UPGRADES

     public virtual double AddUpgrades(double val) {
         double upgrades = GetUpgrades();
@@ -478,8 +480,9 @@
     public virtual void SetUpgrades(double val) {
         SetAttributeDoubleValue(GameItemRPGAttributes.upgrades, val);
     }
-
-    // customizations
+
+    // ----------------------------------------------------------
+    // CUSTOMIZATIONS

     public virtual void SetValue(string code, object value) {
         DataAttribute att = new DataAttribute();
@@ -495,24 +498,18 @@
         return GetAttributesList("rpg");
     }

-
+    // ----------------------------------------------------------
     // CURRENCY

     public virtual double AddCurrency(double val) {
-        double currency = GetCurrency();
-        currency += val;
-        SetCurrency(currency);
-        return currency;
+        double v = GetCurrency();
+        v += val;
+        SetCurrency(v);
+        return v;
     }

     public virtual double SubtractCurrency(double val) {
-        double currency = GetCurrency();
-        if(val > 0) {
-            val = -val;
-        }
-        currency += val;
-        SetCurrency(currency);
-        return currency;
+        return AddCurrency(-val);
     }

     public virtual double GetCurrency() {
@@ -544,8 +541,23 @@
     public virtual void SetGamePlayerProgressCurrency(double attValue) {
         SetAttributeDoubleValue(BaseGameProfileRPGAttributes.ATT_PROGRESS_CURRENCY, attValue);
     }
-
+
+    // ----------------------------------------------------------
     // RPG - Player specific
+
+    // -------------
+    // XP
+
+    public virtual double AddGamePlayerProgressXP(double val) {
+        double v = GetGamePlayerProgressXP();
+        v += val;
+        SetGamePlayerProgressXP(v);
+        return v;
+    }
+
+    public virtual double SubtractGamePlayerProgressXP(double val) {
+        return AddGamePlayerProgressXP(-val);
+    }

     public double GetGamePlayerProgressXP() {
         return GetGamePlayerProgressXP(10.0);
@@ -561,6 +573,20 @@
     public void SetGamePlayerProgressXP(double attValue) {
         SetAttributeDoubleValue(BaseGameProfileRPGAttributes.ATT_PROGRESS_XP, attValue);
     }
+
+    // -------------
+    // LEVEL
+
+    public virtual double AddGamePlayerProgressLevel(double val) {
+        double v = GetGamePlayerProgressLevel();
+        v += val;
+        SetGamePlayerProgressLevel(v);
+        return v;
+    }
+
+    public virtual double SubtractGamePlayerProgressLevel(double val) {
+        return AddGamePlayerProgressLevel(-val);
+    }

     public double GetGamePlayerProgressLevel() {
         return GetGamePlayerProgressLevel(0.0);
@@ -577,6 +603,20 @@
     public void SetGamePlayerProgressLevel(double attValue) {
         SetAttributeDoubleValue(BaseGameProfileRPGAttributes.ATT_PROGRESS_LEVEL, attValue);
     }
+
+    // -------------
+    // HEALTH
+
+    public virtual double AddGamePlayerProgressHealth(double val) {
+        double v = GetGamePlayerProgressHealth();
+        v += val;
+        SetGamePlayerProgressHealth(v);
+        return v;
+    }
+
+    public virtual double SubtractGamePlayerProgressHealth(double val) {
+        return AddGamePlayerProgressHealth(-val);
+    }

     public double GetGamePlayerProgressHealth() {
         return GetGamePlayerProgressHealth(1.0);
@@ -593,6 +633,20 @@
     public void SetGamePlayerProgressHealth(double attValue) {
         SetAttributeDoubleValue(BaseGameProfileRPGAttributes.ATT_PROGRESS_HEALTH, attValue);
     }
+
+    // -------------
+    // ENERGY
+
+    public virtual double AddGamePlayerProgressEnergy(double val) {
+        double v = GetGamePlayerProgressEnergy();
+        v += val;
+        SetGamePlayerProgressEnergy(v);
+        return v;
+    }
+
+    public virtual double SubtractGamePlayerProgressEnergy(double val) {
+        return AddGamePlayerProgressEnergy(-val);
+    }

     public double GetGamePlayerProgressEnergy() {
         return GetGamePlayerProgressEnergy(0.0);


Prevent Utf8StringToNative.GetInstance getting optimized out

--- Facepunch.Steamworks/Utility/SteamInterface.cs
+++ Facepunch.Steamworks/Utility/SteamInterface.cs
@@ -31,6 +31,7 @@
 				return;
 			}

+			PreservationHack();
 			throw new System.Exception( "Trying to initialize Steam Interface but Steam not initialized" );
 		}

@@ -109,5 +110,15 @@
 		}

 		public abstract void InitInternals();
+
+		internal void PreservationHack()
+		{
+			//
+			// Stop Utf8StringToNative.GetInstance getting culled by stuff like Unity's
+			// asselmbly optimization stuff. Here we just call it so it can't not exist.
+			//
+			var i = Utf8StringToNative.GetInstance( "don't cull this function" );
+			i.GetNativeDataSize();
+		}
 	}
 }


assume: first name that starts with A gets 10% discount

--- src/payroll/Views/Home/About.cshtml
+++ src/payroll/Views/Home/About.cshtml
@@ -11,7 +11,7 @@

The cost of benefits is $1000/year for each employee

Each dependent, children and possibly a spouse, is additional deduction of $500/year

-
Anyone whose name startis with 'A' gets a 10% discount, employee or dependent

+
Anyone whose first name startis with 'A' gets a 10% discount, employee or dependent

Other assumptions for simplicity:


Fix overlooked assignment.

Fix overlooked assignment.

--- src/Avalonia.Layout/Layoutable.cs
+++ src/Avalonia.Layout/Layoutable.cs
@@ -535,7 +535,7 @@

                     if (!double.IsNaN(heightCache))
                     {
-                        height = Height;
+                        height = heightCache;
                     }
                 }


Properly restore the previous EGL context

--- src/Avalonia.OpenGL/EglContext.cs
+++ src/Avalonia.OpenGL/EglContext.cs
@@ -35,21 +35,28 @@
             private readonly IntPtr _display;
             private IntPtr _context, _read, _draw;

-            public RestoreContext(EglInterface egl)
+            public RestoreContext(EglInterface egl, IntPtr defDisplay)
             {
                 _egl = egl;
                 _display = _egl.GetCurrentDisplay();
+                if (_display == IntPtr.Zero)
+                    _display = defDisplay;
                 _context = _egl.GetCurrentContext();
                 _read = _egl.GetCurrentSurface(EGL_READ);
                 _draw = _egl.GetCurrentSurface(EGL_DRAW);
             }

-            public void Dispose() => _egl.MakeCurrent(_display, _draw, _read, _context);
+            public void Dispose()
+            {
+                _egl.MakeCurrent(_display, _draw, _read, _context);
+            }
+
         }

         public IDisposable MakeCurrent()
         {
-            var old = new RestoreContext(_egl);
+            var old = new RestoreContext(_egl, _disp.Handle);
+            _egl.MakeCurrent(_disp.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
             if (!_egl.MakeCurrent(_disp.Handle, IntPtr.Zero, IntPtr.Zero, Context))
                 throw OpenGlException.GetFormattedException("eglMakeCurrent", _egl);
             return old;
@@ -57,8 +64,9 @@

         public IDisposable MakeCurrent(EglSurface surface)
         {
-            var old = new RestoreContext(_egl);
+            var old = new RestoreContext(_egl, _disp.Handle);
             var surf = surface ?? OffscreenSurface;
+            _egl.MakeCurrent(_disp.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
             if (!_egl.MakeCurrent(_disp.Handle, surf.DangerousGetHandle(), surf.DangerousGetHandle(), Context))
                 throw OpenGlException.GetFormattedException("eglMakeCurrent", _egl);
             return old;


helper apis moved to extensions

helper apis moved to extensions

--- Gunter/src/Data/Dtos/TableDto.cs
+++ Gunter/src/Data/Dtos/TableDto.cs
@@ -80,6 +80,8 @@
         public TableDto(params string[] names) : this(names.Select(SoftString.Create))
         {
         }
+
+        internal IEnumerable<ColumnDto> Columns => _columnByName.Values;

         [NotNull]
         public RowDto<T> LastRow => _rows.LastOrDefault() ?? throw new InvalidOperationException("There are no rows.");
@@ -97,19 +99,33 @@
             return newRow;
         }

-        public void Add(IEnumerable<T> values)
-        {
-            var newRow = NewRow();
-            foreach (var (column, value) in _columnByName.Values.Zip(values, (column, value) => (column, value)))
-            {
-                newRow[column.Name] = value;
-            }
-        }
-
-        public void Add(params T[] values) => Add((IEnumerable<T>)values);
+        //public void Add(IEnumerable<T> values)
+        //{
+        //    var newRow = NewRow();
+        //    foreach (var (column, value) in _columnByName.Values.Zip(values, (column, value) => (column, value)))
+        //    {
+        //        newRow[column.Name] = value;
+        //    }
+        //}
+
+        //public void Add(params T[] values) => Add((IEnumerable<T>)values);

         [NotNull, ItemNotNull]
         public IEnumerable<IEnumerable<T>> Dump() => _rows.Select(row => row.Dump());
+    }
+
+    public static class TableDtoExtensions
+    {
+        public static void Add<T>(this TableDto<T> table, IEnumerable<T> values)
+        {
+            var newRow = table.NewRow();
+            foreach (var (column, value) in table.Columns.Zip(values, (column, value) => (column, value)))
+            {
+                newRow[column.Name] = value;
+            }
+        }
+
+        public static void Add<T>(this TableDto<T> table, params T[] values) => table.Add((IEnumerable<T>)values);
     }

     internal class ColumnDto


Implementation of GenerateUniqueFilename method

--- FonctionsUtiles.Fred.Csharp/FunctionsString.cs
+++ FonctionsUtiles.Fred.Csharp/FunctionsString.cs
@@ -1720,6 +1720,7 @@

       string result = string.Empty;
       // TODO to complete
+      string[] charactersToBeSearchFrom = new string[26 + 26 + 10 + 10];

       return result;
     }


Refactogings

Refactogings

--- Hermod/HTTP/Request/APIKey_Id.cs
+++ Hermod/HTTP/Request/APIKey_Id.cs
@@ -26,12 +26,23 @@
 namespace org.GraphDefined.Vanaheimr.Hermod.HTTP
 {

+    /// <summary>
+    /// Extention methods for API key identifications.
+    /// </summary>
     public static class APIKeyIdExtentions
     {

+        /// <summary>
+        /// Indicates whether this API key identifications is null or empty.
+        /// </summary>
+        /// <param name="APIKey">An API key identifications.</param>
         public static Boolean IsNullOrEmpty(this APIKey_Id? APIKey)
             => !APIKey.HasValue || APIKey.Value.IsNullOrEmpty;

+        /// <summary>
+        /// Indicates whether this API key identifications is NOT null or empty.
+        /// </summary>
+        /// <param name="APIKey">An API key identifications.</param>
         public static Boolean IsNotNullOrEmpty(this APIKey_Id? APIKey)
             => APIKey.HasValue && APIKey.Value.IsNotNullOrEmpty;


重写 Parent 虚拟属性。

重写 Parent 虚拟属性。

--- src/Controls/DataItemContainer.cs
+++ src/Controls/DataItemContainer.cs
@@ -72,6 +72,16 @@
 		}
 		#endregion

+		#region 重写属性
+		public override Control Parent
+		{
+			get
+			{
+				return base.Parent ?? _owner.Parent;
+			}
+		}
+		#endregion
+
 		#region 显式实现
 		int IDataItemContainer.DataItemIndex
 		{


Use colors

Use colors

--- src/Core2D.Avalonia/Editor/Log.cs
+++ src/Core2D.Avalonia/Editor/Log.cs
@@ -12,7 +12,10 @@
         {
             if (Enabled)
             {
-                Console.WriteLine("[Info] " + value);
+                var color = Console.ForegroundColor;
+                Console.ForegroundColor = ConsoleColor.White;
+                Console.WriteLine(value);
+                Console.ForegroundColor = color;
             }
         }

@@ -20,7 +23,10 @@
         {
             if (Enabled)
             {
-                Console.WriteLine("[Warning] " + value);
+                var color = Console.ForegroundColor;
+                Console.ForegroundColor = ConsoleColor.Yellow;
+                Console.WriteLine(value);
+                Console.ForegroundColor = color;
             }
         }

@@ -28,7 +34,10 @@
         {
             if (Enabled)
             {
-                Console.WriteLine("[Error] " + value);
+                var color = Console.ForegroundColor;
+                Console.ForegroundColor = ConsoleColor.Red;
+                Console.WriteLine(value);
+                Console.ForegroundColor = color;
             }
         }
     }


Added TRAVIS_CI #if.

Added TRAVIS_CI #if.

--- src/EasyBuild/Resources2JSTask.cs
+++ src/EasyBuild/Resources2JSTask.cs
@@ -1,4 +1,5 @@
-using System;
+#if !TRAVIS_CI
+using System;
 using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
 using System.Globalization;
@@ -119,9 +120,8 @@

             using (var fileStream = new StreamWriter(File.Open(serializationFilename, FileMode.Create, FileAccess.Write), Encoding.UTF8))
             {
-                foreach (var rt in m_resourceTypes)
+                ForEachResource((rt, rm) =>
                 {
-                    var rm = new ResourceManager(rt);
                     var normalizedResourceName = NormalizePropertyName(rt.Name);
                     fileStream.WriteLine("globalization.{0} = {{", normalizedResourceName);

@@ -148,7 +148,7 @@
                     }

                     fileStream.WriteLine("}};", normalizedResourceName);
-                }
+                });
             }
         }

@@ -187,20 +187,20 @@
             }
         }

-        /////// <summary>
-        /////// Executa a action para cada resource informado pelo usuário da linha de comando.
-        /////// </summary>
-        /////// <param name="action">A ação a ser executada.</param>
-        ////[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
-        ////private void ForEachResource(Action<Type, ResourceManager> action)
-        ////{
-        ////    ExceptionHelper.ThrowIfNull("action", action);
-
-        ////    foreach (var r in m_resourceTypes)
-        ////    {
-        ////        action(r, new ResourceManager(r));
-        ////    }
-        ////}
+        /// <summary>
+        /// Executa a action para cada resource informado pelo usuário da linha de comando.
+        /// </summary>
+        /// <param name="action">A ação a ser executada.</param>
+        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0")]
+        private void ForEachResource(Action<Type, ResourceManager> action)
+        {
+            ExceptionHelper.ThrowIfNull("action", action);
+
+            foreach (var r in m_resourceTypes)
+            {
+                action(r, new ResourceManager(r));
+            }
+        }

         /// <summary>
         /// Obtém as propriedades do resource que serão serializadas.
@@ -245,3 +245,4 @@
         #endregion
     }
 }
+#endif


Separate the yielding of test case parameters from the construction of Case objects, as a step towards giving end users more control over parameterization of tests.

--- src/Fixie/Internal/ClassRunner.cs
+++ src/Fixie/Internal/ClassRunner.cs
@@ -8,6 +8,8 @@

     class ClassRunner
     {
+        static readonly object[] EmptyParameters = {};
+
         readonly Bus bus;
         readonly Execution execution;
         readonly MethodDiscoverer methodDiscoverer;
@@ -55,8 +57,8 @@
                     runCasesInvokedByLifecycle = true;

                     foreach (var method in orderedMethods)
-                        foreach (var @case in YieldCases(method, summary))
-                            Run(@case, caseLifecycle, summary);
+                        foreach (var parameters in YieldInvocations(method, summary))
+                            Run(method, parameters, caseLifecycle, summary);
                 };

                 var runContext = isOnlyTestClass && methods.Count == 1
@@ -105,11 +107,11 @@
             }
         }

-        IEnumerable<Case> YieldCases(MethodInfo method, ExecutionSummary summary)
+        IEnumerable<object?[]> YieldInvocations(MethodInfo method, ExecutionSummary summary)
         {
             if (method.GetParameters().Length == 0)
             {
-                yield return new Case(method);
+                yield return EmptyParameters;
                 yield break;
             }

@@ -139,7 +141,7 @@
                     }

                     generatedInputParameters = true;
-                    yield return new Case(method, parameters);
+                    yield return parameters;
                 }
             }

@@ -156,8 +158,10 @@
             }
         }

-        void Run(Case @case, Action<Case> caseLifecycle, ExecutionSummary summary)
-        {
+        void Run(MethodInfo method, object?[] parameters, Action<Case> caseLifecycle, ExecutionSummary summary)
+        {
+            var @case = new Case(method, parameters);
+
             Start(@case);

             Exception? caseLifecycleFailure = null;


AlsaMidiAccess: IMidiPortDetails instance to expose were wrong...

--- Commons.Music.Midi.DesktopShared/alsaseq/AlsaMidiAccess.cs
+++ Commons.Music.Midi.DesktopShared/alsaseq/AlsaMidiAccess.cs
@@ -118,12 +118,13 @@

 	public class AlsaMidiInput : IMidiInput {
 		AlsaSequencer seq;
-		AlsaMidiPortDetails port;
+		AlsaMidiPortDetails port, source_port;

 		public AlsaMidiInput (AlsaSequencer seq, AlsaMidiPortDetails appPort, AlsaMidiPortDetails sourcePort)
 		{
 			this.seq = seq;
 			this.port = appPort;
+			this.source_port = sourcePort;
 			byte [] buffer = new byte [0x200];
 			seq.StartListening (port.PortInfo.Port, buffer, (buf, start, len) => {
 				var args = new MidiReceivedEventArgs () { Data = buf, Start = start, Length = len, Timestamp = 0 };
@@ -131,7 +132,7 @@
 			});
 		}

-		public IMidiPortDetails Details => port;
+		public IMidiPortDetails Details => source_port;

 		public MidiPortConnectionState Connection { get; private set; }

@@ -157,15 +158,16 @@

 	public class AlsaMidiOutput : IMidiOutput {
 		AlsaSequencer seq;
-		AlsaMidiPortDetails port;
+		AlsaMidiPortDetails port, target_port;

 		public AlsaMidiOutput (AlsaSequencer seq, AlsaMidiPortDetails appPort, AlsaMidiPortDetails targetPort)
 		{
 			this.seq = seq;
 			this.port = appPort;
+			this.target_port = targetPort;
 		}

-		public IMidiPortDetails Details => port;
+		public IMidiPortDetails Details => target_port;

 		public MidiPortConnectionState Connection { get; private set; }


Disabled the type maps for va_list and std::list in the C# generator.

Signed-off-by: Dimitar Dobrev <ca751a5c976abad79158718440750fc638d19ebc@protonmail.com>

--- src/Generator/Types/Std/Stdlib.cs
+++ src/Generator/Types/Std/Stdlib.cs
@@ -8,7 +8,7 @@

 namespace CppSharp.Types.Std
 {
-    [TypeMap("va_list")]
+    [TypeMap("va_list", GeneratorKind = GeneratorKind.CLI)]
     public class VaList : TypeMap
     {
         public override string CLISignature(CLITypePrinterContext ctx)
@@ -346,7 +346,7 @@
         }
     }

-    [TypeMap("std::list")]
+    [TypeMap("std::list", GeneratorKind = GeneratorKind.CLI)]
     public class List : TypeMap
     {
         public override bool IsIgnored { get { return true; } }


quote arg in node test runner

quote arg in node test runner

--- HttpTwo.Tests/NodeHttp2Runner.cs
+++ HttpTwo.Tests/NodeHttp2Runner.cs
@@ -18,7 +18,7 @@
             var scriptPath = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "..", "..", "node-http2", "example", "server.js");

             process = new Process ();
-            process.StartInfo = new ProcessStartInfo ("/usr/local/bin/node", scriptPath);
+            process.StartInfo = new ProcessStartInfo ("node", "\"" + scriptPath + "\"");
             process.StartInfo.UseShellExecute = false;
             process.StartInfo.CreateNoWindow = true;
             process.StartInfo.EnvironmentVariables.Add ("HTTP2_PLAIN", "true");
@@ -40,6 +40,8 @@
                     LogHandler (e.Data);
             };

+            Console.WriteLine ("Running: {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
+
             process.Start ();
             process.BeginOutputReadLine ();
             process.BeginErrorReadLine ();


Work in progress

Work in progress

--- IISCI.Git/GitSourceController.cs
+++ IISCI.Git/GitSourceController.cs
@@ -41,7 +41,8 @@
                 options.CredentialsProvider = CredentialsHandler;
                 Remote remote = rep.Network.Remotes["origin"];
                 rep.Fetch(remote.Name, options);
-                rep.Reset(ResetMode.Hard);
+                var master = rep.Branches["master"];
+                var merge = rep.Merge(master, new Signature("IISCI", "iisci.iisci@iisci.iisci", DateTime.Now));
                 Console.WriteLine("Fetch successful");
             }


update

update

--- Demos/CSharpGL.Demos/01Renderer/Form01Renderer.FormLoad.cs
+++ Demos/CSharpGL.Demos/01Renderer/Form01Renderer.FormLoad.cs
@@ -27,7 +27,6 @@
                 // build several models
                 Random random = new Random();
                 var bufferables = new IBufferable[]{
-                    new Axis(),
                     new BigDipper(),
                     new Chain(new ChainModel(random.Next(7, 100), 5, 5)),
                     new Tetrahedron(),
@@ -37,7 +36,6 @@
                 };
                 var keys = new GeometryModel[]
                 {
-                    GeometryModel.Axis,
                     GeometryModel.BigDipper,
                     GeometryModel.Chain,
                     GeometryModel.Tetrahedron,
@@ -56,7 +54,6 @@
                 {
                     simpleShader,
                     simpleShader,
-                    simpleShader,
                     emitNormalLineShader,
                     emitNormalLineShader,
                     emitNormalLineShader,
@@ -72,7 +69,6 @@
                 {
                     simpleShaderPropertyNameMap,
                     simpleShaderPropertyNameMap,
-                    simpleShaderPropertyNameMap,
                     emitNormalLineShaderPropertyNameMap,
                     emitNormalLineShaderPropertyNameMap,
                     emitNormalLineShaderPropertyNameMap,
@@ -80,7 +76,6 @@
                 };
                 var positionNameInIBufferables = new string[]
                 {
-                    "position",
                     "position",
                     "position",
                     "position",
@@ -103,7 +98,7 @@
                         bufferable, shaders, propertyNameMap, positionNameInIBufferable);
                     pickableRenderer.Name = string.Format("Pickable: [{0}]", key);
                     pickableRenderer.Initialize();
-                    if (i > 2)
+                    if (i > 1)
                     {
                         pickableRenderer.SetUniform("normalLength", 0.5f);
                         pickableRenderer.SetUniform("showModel", true);
@@ -126,6 +121,19 @@
                     this.rendererDict.Add(key, renderer);
                 }
                 {
+                    SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Axis(partCount: 6));
+                    pickableRenderer.Initialize();
+                    var bufferable = pickableRenderer.Model;
+                    var highlightRenderer = new HighlightRenderer(
+                        bufferable, Points.strposition);
+                    highlightRenderer.Name = string.Format("Highlight: [{0}]", GeometryModel.Axis);
+                    highlightRenderer.Initialize();
+                    HighlightedPickableRenderer renderer = new HighlightedPickableRenderer(
+                        highlightRenderer, pickableRenderer);
+                    renderer.Initialize();
+                    this.rendererDict.Add(GeometryModel.Axis, renderer);
+                }
+                {
                     var points = new List<vec3>(){
                         new vec3(-4.0f, 0.0f, 0.0f),
                         new vec3(-6.0f, 4.0f, 0.0f),
@@ -137,7 +145,7 @@
                     var bufferable = pickableRenderer.Model;
                     var highlightRenderer = new HighlightRenderer(
                         bufferable, Points.strposition);
-                    highlightRenderer.Name = string.Format("Highlight: [{0}]", "Bezier1D");
+                    highlightRenderer.Name = string.Format("Highlight: [{0}]", GeometryModel.Bezier1D);
                     highlightRenderer.Initialize();
                     HighlightedPickableRenderer renderer = new HighlightedPickableRenderer(
                         highlightRenderer, pickableRenderer);
@@ -161,7 +169,7 @@
                     var bufferable = pickableRenderer.Model;
                     var highlightRenderer = new HighlightRenderer(
                         bufferable, Points.strposition);
-                    highlightRenderer.Name = string.Format("Highlight: [{0}]", "Bezier2D");
+                    highlightRenderer.Name = string.Format("Highlight: [{0}]", GeometryModel.Bezier2D);
                     highlightRenderer.Initialize();
                     HighlightedPickableRenderer renderer = new HighlightedPickableRenderer(
                         highlightRenderer, pickableRenderer);


update

update

--- Demos/CSharpGL.Demos/01Renderer/Form01Renderer.FormLoad.cs
+++ Demos/CSharpGL.Demos/01Renderer/Form01Renderer.FormLoad.cs
@@ -32,7 +32,6 @@
                     new Tetrahedron(),
                     new Cube(),
                     new Sphere(),
-                    new Teapot(),
                 };
                 var keys = new GeometryModel[]
                 {
@@ -41,7 +40,6 @@
                     GeometryModel.Tetrahedron,
                     GeometryModel.Cube,
                     GeometryModel.Sphere,
-                    GeometryModel.Teapot,
                 };
                 ShaderCode[] simpleShader = new ShaderCode[2];
                 simpleShader[0] = new ShaderCode(File.ReadAllText(@"shaders\Simple.vert"), ShaderType.VertexShader);
@@ -57,7 +55,6 @@
                     emitNormalLineShader,
                     emitNormalLineShader,
                     emitNormalLineShader,
-                    emitNormalLineShader,
                 };
                 var simpleShaderPropertyNameMap = new PropertyNameMap();
                 simpleShaderPropertyNameMap.Add("in_Position", "position");
@@ -72,11 +69,9 @@
                     emitNormalLineShaderPropertyNameMap,
                     emitNormalLineShaderPropertyNameMap,
                     emitNormalLineShaderPropertyNameMap,
-                    emitNormalLineShaderPropertyNameMap,
                 };
                 var positionNameInIBufferables = new string[]
                 {
-                    "position",
                     "position",
                     "position",
                     "position",
@@ -132,6 +127,19 @@
                         highlightRenderer, pickableRenderer);
                     renderer.Initialize();
                     this.rendererDict.Add(GeometryModel.Axis, renderer);
+                }
+                {
+                    SimpleRenderer pickableRenderer = SimpleRenderer.Create(new Teapot());
+                    pickableRenderer.Initialize();
+                    var bufferable = pickableRenderer.Model;
+                    var highlightRenderer = new HighlightRenderer(
+                        bufferable, Points.strposition);
+                    highlightRenderer.Name = string.Format("Highlight: [{0}]", GeometryModel.Teapot);
+                    highlightRenderer.Initialize();
+                    HighlightedPickableRenderer renderer = new HighlightedPickableRenderer(
+                        highlightRenderer, pickableRenderer);
+                    renderer.Initialize();
+                    this.rendererDict.Add(GeometryModel.Teapot, renderer);
                 }
                 {
                     var points = new List<vec3>(){


Use only main buffer to store remain data and new data

--- src/SharpConnect.MySql/Internal/Query.cs
+++ src/SharpConnect.MySql/Internal/Query.cs
@@ -152,8 +152,7 @@
         {
             ResultSetHeaderPacket resultPacket = new ResultSetHeaderPacket();
             resultPacket.ParsePacket(parser);
-
-
+
             this.tableHeader = new TableHeader();
             tableHeader.TypeCast = typeCast;
             tableHeader.NestTables = nestTables;
@@ -168,22 +167,17 @@
                 receiveBuffer = CheckLimit(fieldPacket.GetPacketLength(), receiveBuffer, DEFAULT_BUFFER_SIZE);
                 fieldPacket.ParsePacket(parser);
                 tableHeader.AddField(fieldPacket);
-                receiveBuffer = CheckBeforeParseHeader(receiveBuffer, (int)parser.Position, DEFAULT_BUFFER_SIZE);
-            }
-
-
-
+                CheckBeforeParseHeader(receiveBuffer, (int)parser.Position, DEFAULT_BUFFER_SIZE);
+            }
+
             EofPacket fieldEof = new EofPacket(protocol41);//if temp[4]=0xfe then eof packet
             fieldEof.ParsePacketHeader(parser);
             receiveBuffer = CheckLimit(fieldEof.GetPacketLength(), receiveBuffer, DEFAULT_BUFFER_SIZE);
             fieldEof.ParsePacket(parser);
-
-
-            receiveBuffer = CheckBeforeParseHeader(receiveBuffer, (int)parser.Position, DEFAULT_BUFFER_SIZE);
-
+
+            CheckBeforeParseHeader(receiveBuffer, (int)parser.Position, DEFAULT_BUFFER_SIZE);
             //-----
             lastRow = new RowDataPacket(tableHeader);
-
         }

         public bool ReadRow()
@@ -192,8 +186,7 @@
             {
                 return hasSomeRow = false;
             }
-
-
+
             switch (receiveBuffer[parser.Position + 4])
             {
                 case ERROR_CODE:
@@ -208,8 +201,7 @@
                         rowDataEof.ParsePacketHeader(parser);
                         receiveBuffer = CheckLimit(rowDataEof.GetPacketLength(), receiveBuffer, DEFAULT_BUFFER_SIZE);
                         rowDataEof.ParsePacket(parser);
-
-
+
                         return hasSomeRow = false;
                     }
                 default:
@@ -224,17 +216,14 @@
                         receiveBuffer = CheckLimit(lastRow.GetPacketLength(), receiveBuffer, DEFAULT_BUFFER_SIZE);
                         lastRow.ParsePacket(parser);
                         dbugConsole.WriteLine("After parse Row [Position] : " + parser.Position);
-                        receiveBuffer = CheckBeforeParseHeader(receiveBuffer, (int)parser.Position, DEFAULT_BUFFER_SIZE);
+                        CheckBeforeParseHeader(receiveBuffer, (int)parser.Position, DEFAULT_BUFFER_SIZE);
                         dbugConsole.WriteLine("After CheckBeforeParseHeader [Position] : " + parser.Position);
-
-
+
                         return hasSomeRow = true;
                     }
             }
         }
-
-
-
+
         internal MyStructData[] Cells
         {
             get
@@ -305,8 +294,6 @@
             int remainLength = (int)(parser.Length - parser.Position);
             if (packetLength > remainLength)
             {
-
-
                 int packetRemainLength = (int)packetLength - remainLength;
                 int newReceiveBuffLength = (packetLength > limit) ? packetRemainLength : limit;
                 int newBufferLength = newReceiveBuffLength + remainLength;
@@ -323,8 +310,7 @@
                     //just move
                     Buffer.BlockCopy(buffer, (int)parser.Position, buffer, 0, remainLength);
                 }
-
-
+
                 var socket = conn.socket;
                 int newReceive = remainLength + socket.Receive(buffer, remainLength, newReceiveBuffLength, SocketFlags.None);
                 int timeoutCountdown = 10000;
@@ -375,28 +361,26 @@
             //return outputBuff;
         }

-        byte[] CheckBeforeParseHeader(byte[] buffer, int position, int limit)
-        {
-            //TODO: check memory mx again
+        void CheckBeforeParseHeader(byte[] buffer, int position, int limit)
+        {
+            //todo: check memory mx again
             int remainLength = (int)parser.Length - position;
             if (remainLength < 5)//5 bytes --> 4 bytes from header and 1 byte for find packet type
             {
                 byte[] remainBuff = CopyBufferBlock(buffer, position, remainLength);
-                byte[] receiveBuff = new byte[limit];
+                remainBuff.CopyTo(buffer, 0);
+
                 var socket = conn.socket;
-                int newReceive = socket.Receive(receiveBuff);
-                int newBufferLength = newReceive + remainLength;
-                if (newBufferLength > buffer.Length)
-                {
-                    buffer = new byte[newBufferLength];
-                }
-                remainBuff.CopyTo(buffer, 0);
-                receiveBuff.CopyTo(buffer, remainLength);
-                parser.LoadNewBuffer(buffer, newReceive + remainLength);
-
+                int bufferRemain = buffer.Length - remainLength;
+                int available = socket.Available;
+                int expectedReceive = (available < bufferRemain ? available : bufferRemain);
+
+                int realReceive = socket.Receive(buffer, remainLength, expectedReceive, SocketFlags.None);
+                int newBufferLength = remainLength + realReceive;//sometime realReceive != expectedReceive
+                parser.LoadNewBuffer(buffer, newBufferLength);
                 dbugConsole.WriteLine("CheckBeforeParseHeader : LoadNewBuffer");
             }
-            return buffer;
+            //return buffer;
         }

         static string BindValues(string sql, CommandParameters values)
@@ -478,7 +462,6 @@
             }
             return strBuilder.ToString();
         }
-

         //public void Start(Socket socket, bool protocol41, ConnectionConfig config)
         //{
@@ -550,7 +533,6 @@
         //        resultSet.Add(rowDataEof);
         //    }
         //}
-
     }


fix list items <li> working properly

fix list items <li> working properly

--- src/HaagsTranslator/Translator.cs
+++ src/HaagsTranslator/Translator.cs
@@ -454,7 +454,9 @@

       //quick fixups
       new [] { "stgong>", "strong>"}, //fixups for <strong tag>
-      new [] { "kute;", "cute;" } // fixups for é tag
+      new [] { "kute;", "cute;" }, // fixups for é tag
+      new [] { "&ksedil;", "ç" }, // fixups for ç tag
+      new [] { "lie>", "li>" } // fixups for <li> tag
     };

     /// <summary>


Skip calc test on AppVeyor.

Skip calc test on AppVeyor.

Looks like there are windows bugs.
https://answers.microsoft.com/en-us/windows/forum/apps_windows_10-winapps/windows-10-calculator-app-fails-to-start/26298c02-0512-4a4b-b3b8-cf7391e55be0?auth=1
Not an important test.

--- Gu.Wpf.UiAutomation.UiTests/CalculatorTests.cs
+++ Gu.Wpf.UiAutomation.UiTests/CalculatorTests.cs
@@ -35,6 +35,11 @@
         [Test]
         public void CalculatorTest()
         {
+            if (WindowsVersion.IsAppVeyor())
+            {
+                return;
+            }
+
             using (var app = StartApplication())
             {
                 // Looks like it can take a long time on CI


Set pre-release check to false in not a parameter

--- HeroesMatchTracker/Views/StartupWindow.xaml.cs
+++ HeroesMatchTracker/Views/StartupWindow.xaml.cs
@@ -88,9 +88,9 @@
                 }

                 if (argsList.Contains("/pre-release"))
-                {
                     Database.SettingsDb().UserSettings.PreReleaseCheck = true;
-                }
+                else
+                    Database.SettingsDb().UserSettings.PreReleaseCheck = false;
             }
         }
     }


Added unit tests for formatting index sequence sets

--- UnitTests/Net/Imap/ImapUtilsTests.cs
+++ UnitTests/Net/Imap/ImapUtilsTests.cs
@@ -51,6 +51,50 @@
 		}

 		[Test]
+		public void TestFormattingSimpleIndexRange ()
+		{
+			int[] indexes = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+			const string expect = "1:9";
+			string actual;
+
+			actual = ImapUtils.FormatIndexSet (indexes);
+			Assert.AreEqual (expect, actual, "Formatting a simple range of indexes failed.");
+		}
+
+		[Test]
+		public void TestFormattingNonSequentialIndexes ()
+		{
+			int[] indexes = { 1, 3, 5, 7, 9 };
+			const string expect = "1,3,5,7,9";
+			string actual;
+
+			actual = ImapUtils.FormatIndexSet (indexes);
+			Assert.AreEqual (expect, actual, "Formatting a non-sequential list of indexes.");
+		}
+
+		[Test]
+		public void TestFormattingComplexSetOfIndexes ()
+		{
+			int[] indexes = { 1, 2, 3, 5, 6, 9, 10, 11, 12, 15, 19, 20 };
+			const string expect = "1:3,5:6,9:12,15,19:20";
+			string actual;
+
+			actual = ImapUtils.FormatIndexSet (indexes);
+			Assert.AreEqual (expect, actual, "Formatting a complex list of indexes.");
+		}
+
+		[Test]
+		public void TestFormattingReversedIndexes ()
+		{
+			int[] indexes = { 20, 19, 15, 12, 11, 10, 9, 6, 5, 3, 2, 1 };
+			const string expect = "20:19,15,12:9,6:5,3:1";
+			string actual;
+
+			actual = ImapUtils.FormatIndexSet (indexes);
+			Assert.AreEqual (expect, actual, "Formatting a complex list of indexes.");
+		}
+
+		[Test]
 		public void TestFormattingSimpleUidRange ()
 		{
 			UniqueId[] uids = {


Corrected calibration of binoculars.

Corrected calibration of binoculars.

--- UnityScripts_Binoculars/MouseLook.cs
+++ UnityScripts_Binoculars/MouseLook.cs
@@ -41,7 +41,7 @@
     public float calibZ = 0.0F;

     public float offsetX = 0.0F;
-    public float offsetY = 335.0F;
+    public float offsetY = 0.0F;
     public float offsetZ = 0.0F;

     [DllImport("UnityServerPlugin")]


Fixed a bot UUID check that used null instead of UUID.Zero

Not sure how this even compiled before since UUID is a struct (cannot be
null or assigned a reference).

--- InWorldz/InWorldz.Phlox.Engine/LSLSystemAPI.cs
+++ InWorldz/InWorldz.Phlox.Engine/LSLSystemAPI.cs
@@ -16854,7 +16854,7 @@
                 UUID userID;
                 if (!UUID.TryParse(avatar, out userID))
                 {
-                    if (World.CommsManager.UserService.Name2Key(avatar) == null)
+                    if (World.CommsManager.UserService.Name2Key(avatar) == UUID.Zero)
                         return ScriptBaseClass.BOT_USER_NOT_FOUND;
                 }


Lucene.Net.Index.TermsEnum: Changed to use TermsEnum object itself from Current property to expose its interface during a foreach loop (see #279, #212)

--- src/Lucene.Net/Index/TermsEnum.cs
+++ src/Lucene.Net/Index/TermsEnum.cs
@@ -58,7 +58,9 @@

         /// <inheritdoc/>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public BytesRef Current => Term; // LUCENENET specific - made into enumerator for foreach
+        public TermsEnum Current => this; // LUCENENET specific - made into enumerator for foreach
+
+        BytesRef IBytesRefEnumerator.Current => Term;

         /// <summary>
         /// Moves to the next item in the <see cref="TermsEnum"/>.


Expose SuppressGCTransitionAttribute (#41997)

--- src/System.Runtime/ref/System.Runtime.cs
+++ src/System.Runtime/ref/System.Runtime.cs
@@ -7184,6 +7184,11 @@
         public StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind layoutKind) { }
         public System.Runtime.InteropServices.LayoutKind Value { get { throw null; } }
     }
+    [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited = false)]
+    public sealed partial class SuppressGCTransitionAttribute : System.Attribute
+    {
+        public SuppressGCTransitionAttribute() { }
+    }
 }
 namespace System.Runtime.Remoting
 {


Fix: Choose just one

Fix: Choose just one

--- VB.PowerManager/View/MenuComposer.cs
+++ VB.PowerManager/View/MenuComposer.cs
@@ -25,6 +25,8 @@

         private void AddMenuItemToMenu(IMenuItemProxy menuItemProxy)
         {
+            itemsNotifier.Attach(menuItemProxy);
+
             contextMenu.MenuItems.Add((MenuItem)menuItemProxy.GetRealObject());
         }


Replaced hard coded path separator

Replaced hard coded path separator

--- IntegrationTestDS3/IntegrationTestDS3Client.cs
+++ IntegrationTestDS3/IntegrationTestDS3Client.cs
@@ -457,7 +457,7 @@

         private void PutObject(IDs3Client client, JobObject obj, JobResponse bulkResult)
         {
-            var fileToPut = File.OpenRead($"{testDirectoryBigFolderForMaxBlob}\\{obj.Name}");
+			var fileToPut = File.OpenRead(testDirectoryBigFolderForMaxBlob + Path.DirectorySeparatorChar + obj.Name);
             var contentStream = new PutObjectRequestStream(fileToPut, obj.Offset, obj.Length);
             var putObjectRequest = new PutObjectRequest(
                 bulkResult.BucketName,


Remove unused file.

Remove unused file.

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

--- src/MonoTorrent.Dht/BigInteger.cs
+++ src/MonoTorrent.Dht/BigInteger.cs
@@ -1,1411 +0,0 @@
-#if !DISABLE_DHT
-//
-// BigInteger.cs - Big Integer implementation
-//
-// Authors:
-//	Ben Maurer
-//	Chew Keong TAN
-//	Sebastien Pouliot <sebastien@ximian.com>
-//	Pieter Philippaerts <Pieter@mentalis.org>
-//
-// Copyright (c) 2003 Ben Maurer
-// All rights reserved
-//
-// Copyright (c) 2002 Chew Keong TAN
-// All rights reserved.
-//
-// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Security.Cryptography;
-
-namespace MonoTorrent.Dht
-{
-
-    internal class BigInteger
-    {
-
-        #region Data Storage
-
-        /// <summary>
-        /// The Length of this BigInteger
-        /// </summary>
-        uint length = 1;
-
-        /// <summary>
-        /// The data for this BigInteger
-        /// </summary>
-        uint[] data;
-
-        #endregion
-
-        #region Constants
-
-        /// <summary>
-        /// Default length of a BigInteger in bytes
-        /// </summary>
-        const uint DEFAULT_LEN = 20;
-
-
-        public enum Sign : int
-        {
-            Negative = -1,
-            Zero = 0,
-            Positive = 1
-        };
-
-        #region Exception Messages
-        const string WouldReturnNegVal = "Operation would return a negative value";
-        #endregion
-
-        #endregion
-
-        #region Constructors
-
-        public BigInteger()
-        {
-            data = new uint[DEFAULT_LEN];
-            this.length = DEFAULT_LEN;
-        }
-
-        public BigInteger(uint ui)
-        {
-            data = new uint[] { ui };
-        }
-
-        public BigInteger(uint[] ui)
-        {
-            data = ui;
-            length = (uint)data.Length;
-            Normalize();
-        }
-
-        public BigInteger(Sign sign, uint len)
-        {
-            this.data = new uint[len];
-            this.length = len;
-        }
-
-        public BigInteger(BigInteger bi)
-        {
-            this.data = (uint[])bi.data.Clone();
-            this.length = bi.length;
-        }
-
-        public BigInteger(BigInteger bi, uint len)
-        {
-
-            this.data = new uint[len];
-
-            for (uint i = 0; i < bi.length; i++)
-                this.data[i] = bi.data[i];
-
-            this.length = bi.length;
-        }
-
-        #endregion
-
-        #region Conversions
-
-        public BigInteger(byte[] inData)
-        {
-            length = (uint)inData.Length >> 2;
-            int leftOver = inData.Length & 0x3;
-
-            // length not multiples of 4
-            if (leftOver != 0) length++;
-
-            data = new uint[length];
-
-            for (int i = inData.Length - 1, j = 0; i >= 3; i -= 4, j++)
-            {
-                data[j] = (uint)(
-                    (inData[i - 3] << (3 * 8)) |
-                    (inData[i - 2] << (2 * 8)) |
-                    (inData[i - 1] << (1 * 8)) |
-                    (inData[i])
-                    );
-            }
-
-            switch (leftOver)
-            {
-                case 1: data[length - 1] = (uint)inData[0]; break;
-                case 2: data[length - 1] = (uint)((inData[0] << 8) | inData[1]); break;
-                case 3: data[length - 1] = (uint)((inData[0] << 16) | (inData[1] << 8) | inData[2]); break;
-            }
-
-            this.Normalize();
-        }
-
-
-        public static implicit operator BigInteger(uint value)
-        {
-            return (new BigInteger(value));
-        }
-
-        #endregion
-
-        #region Operators
-
-        public static BigInteger operator +(BigInteger bi1, BigInteger bi2)
-        {
-            if (bi1 == 0)
-                return new BigInteger(bi2);
-            else if (bi2 == 0)
-                return new BigInteger(bi1);
-            else
-                return Kernel.AddSameSign(bi1, bi2);
-        }
-
-        public static BigInteger operator -(BigInteger bi1, BigInteger bi2)
-        {
-            if (bi2 == 0)
-                return new BigInteger(bi1);
-
-            if (bi1 == 0)
-                throw new ArithmeticException(WouldReturnNegVal);
-
-            switch (Kernel.Compare(bi1, bi2))
-            {
-
-                case Sign.Zero:
-                    return 0;
-
-                case Sign.Positive:
-                    return Kernel.Subtract(bi1, bi2);
-
-                case Sign.Negative:
-                    throw new ArithmeticException(WouldReturnNegVal);
-                default:
-                    throw new Exception();
-            }
-        }
-
-        public static int operator %(BigInteger bi, int i)
-        {
-            if (i > 0)
-                return (int)Kernel.DwordMod(bi, (uint)i);
-            else
-                return -(int)Kernel.DwordMod(bi, (uint)-i);
-        }
-
-        public static uint operator %(BigInteger bi, uint ui)
-        {
-            return Kernel.DwordMod(bi, (uint)ui);
-        }
-
-        public static BigInteger operator %(BigInteger bi1, BigInteger bi2)
-        {
-            return Kernel.multiByteDivide(bi1, bi2)[1];
-        }
-
-        public static BigInteger operator /(BigInteger bi, int i)
-        {
-            if (i > 0)
-                return Kernel.DwordDiv(bi, (uint)i);
-
-            throw new ArithmeticException(WouldReturnNegVal);
-        }
-
-        public static BigInteger operator /(BigInteger bi1, BigInteger bi2)
-        {
-            return Kernel.multiByteDivide(bi1, bi2)[0];
-        }
-
-        public static BigInteger operator *(BigInteger bi1, BigInteger bi2)
-        {
-            if (bi1 == 0 || bi2 == 0) return 0;
-
-            //
-            // Validate pointers
-            //
-            if (bi1.data.Length < bi1.length) throw new IndexOutOfRangeException("bi1 out of range");
-            if (bi2.data.Length < bi2.length) throw new IndexOutOfRangeException("bi2 out of range");
-
-            BigInteger ret = new BigInteger(Sign.Positive, bi1.length + bi2.length);
-
-            Kernel.Multiply(bi1.data, 0, bi1.length, bi2.data, 0, bi2.length, ret.data, 0);
-
-            ret.Normalize();
-            return ret;
-        }
-
-        public static BigInteger operator *(BigInteger bi, int i)
-        {
-            if (i < 0) throw new ArithmeticException(WouldReturnNegVal);
-            if (i == 0) return 0;
-            if (i == 1) return new BigInteger(bi);
-
-            return Kernel.MultiplyByDword(bi, (uint)i);
-        }
-
-        public static BigInteger operator <<(BigInteger bi1, int shiftVal)
-        {
-            return Kernel.LeftShift(bi1, shiftVal);
-        }
-
-        public static BigInteger operator >>(BigInteger bi1, int shiftVal)
-        {
-            return Kernel.RightShift(bi1, shiftVal);
-        }
-
-        #endregion
-
-        #region Bitwise
-
-        public int BitCount()
-        {
-            this.Normalize();
-
-            uint value = data[length - 1];
-            uint mask = 0x80000000;
-            uint bits = 32;
-
-            while (bits > 0 && (value & mask) == 0)
-            {
-                bits--;
-                mask >>= 1;
-            }
-            bits += ((length - 1) << 5);
-
-            return (int)bits;
-        }
-
-
-        public bool TestBit(int bitNum)
-        {
-            if (bitNum < 0) throw new IndexOutOfRangeException("bitNum out of range");
-
-            uint bytePos = (uint)bitNum >> 5;             // divide by 32
-            byte bitPos = (byte)(bitNum & 0x1F);    // get the lowest 5 bits
-
-            uint mask = (uint)1 << bitPos;
-            return ((this.data[bytePos] | mask) == this.data[bytePos]);
-        }
-
-        public void SetBit(uint bitNum, bool value)
-        {
-            uint bytePos = bitNum >> 5;             // divide by 32
-
-            if (bytePos < this.length)
-            {
-                uint mask = (uint)1 << (int)(bitNum & 0x1F);
-                if (value)
-                    this.data[bytePos] |= mask;
-                else
-                    this.data[bytePos] &= ~mask;
-            }
-        }
-
-        public byte[] GetBytes()
-        {
-            if (this == 0) return new byte[1];
-
-            int numBits = BitCount();
-            int numBytes = numBits >> 3;
-            if ((numBits & 0x7) != 0)
-                numBytes++;
-
-            byte[] result = new byte[numBytes];
-
-            int numBytesInWord = numBytes & 0x3;
-            if (numBytesInWord == 0) numBytesInWord = 4;
-
-            int pos = 0;
-            for (int i = (int)length - 1; i >= 0; i--)
-            {
-                uint val = data[i];
-                for (int j = numBytesInWord - 1; j >= 0; j--)
-                {
-                    result[pos + j] = (byte)(val & 0xFF);
-                    val >>= 8;
-                }
-                pos += numBytesInWord;
-                numBytesInWord = 4;
-            }
-            return result;
-        }
-
-        #endregion
-
-        #region Compare
-
-        public static bool operator ==(BigInteger bi1, uint ui)
-        {
-            if (bi1.length != 1) bi1.Normalize();
-            return bi1.length == 1 && bi1.data[0] == ui;
-        }
-
-        public static bool operator !=(BigInteger bi1, uint ui)
-        {
-            if (bi1.length != 1) bi1.Normalize();
-            return !(bi1.length == 1 && bi1.data[0] == ui);
-        }
-
-        public static bool operator ==(BigInteger bi1, BigInteger bi2)
-        {
-            // we need to compare with null
-            if ((bi1 as object) == (bi2 as object))
-                return true;
-            if (null == bi1 || null == bi2)
-                return false;
-            return Kernel.Compare(bi1, bi2) == 0;
-        }
-
-        public static bool operator !=(BigInteger bi1, BigInteger bi2)
-        {
-            // we need to compare with null
-            if ((bi1 as object) == (bi2 as object))
-                return false;
-            if (null == bi1 || null == bi2)
-                return true;
-            return Kernel.Compare(bi1, bi2) != 0;
-        }
-
-        public static bool operator >(BigInteger bi1, BigInteger bi2)
-        {
-            return Kernel.Compare(bi1, bi2) > 0;
-        }
-
-        public static bool operator <(BigInteger bi1, BigInteger bi2)
-        {
-            return Kernel.Compare(bi1, bi2) < 0;
-        }
-
-        public static bool operator >=(BigInteger bi1, BigInteger bi2)
-        {
-            return Kernel.Compare(bi1, bi2) >= 0;
-        }
-
-        public static bool operator <=(BigInteger bi1, BigInteger bi2)
-        {
-            return Kernel.Compare(bi1, bi2) <= 0;
-        }
-
-        public Sign Compare(BigInteger bi)
-        {
-            return Kernel.Compare(this, bi);
-        }
-
-        #endregion
-
-        #region Formatting
-
-        public string ToString(uint radix)
-        {
-            return ToString(radix, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-        }
-
-        public string ToString(uint radix, string characterSet)
-        {
-            if (characterSet.Length < radix)
-                throw new ArgumentException("charSet length less than radix", "characterSet");
-            if (radix == 1)
-                throw new ArgumentException("There is no such thing as radix one notation", "radix");
-
-            if (this == 0) return "0";
-            if (this == 1) return "1";
-
-            string result = "";
-
-            BigInteger a = new BigInteger(this);
-
-            while (a != 0)
-            {
-                uint rem = Kernel.SingleByteDivideInPlace(a, radix);
-                result = characterSet[(int)rem] + result;
-            }
-
-            return result;
-        }
-
-        #endregion
-
-        #region Misc
-
-        /// <summary>
-        ///     Normalizes this by setting the length to the actual number of
-        ///     uints used in data and by setting the sign to Sign.Zero if the
-        ///     value of this is 0.
-        /// </summary>
-        private void Normalize()
-        {
-            // Normalize length
-            while (length > 0 && data[length - 1] == 0) length--;
-
-            // Check for zero
-            if (length == 0)
-                length++;
-        }
-
-        #endregion
-
-        #region Object Impl
-
-        public override int GetHashCode()
-        {
-            uint val = 0;
-
-            for (uint i = 0; i < this.length; i++)
-                val ^= this.data[i];
-
-            return (int)val;
-        }
-
-        public override string ToString()
-        {
-            return ToString(10);
-        }
-
-        public override bool Equals(object o)
-        {
-            if (o == null) return false;
-            if (o is int) return (int)o >= 0 && this == (uint)o;
-
-            return Kernel.Compare(this, (BigInteger)o) == 0;
-        }
-
-        #endregion
-
-        #region Number Theory
-
-        public BigInteger ModPow(BigInteger exp, BigInteger n)
-        {
-            ModulusRing mr = new ModulusRing(n);
-            return mr.Pow(this, exp);
-        }
-
-        #endregion
-
-
-
-        public sealed class ModulusRing
-        {
-
-            BigInteger mod, constant;
-
-            public ModulusRing(BigInteger modulus)
-            {
-                this.mod = modulus;
-
-                // calculate constant = b^ (2k) / m
-                uint i = mod.length << 1;
-
-                constant = new BigInteger(Sign.Positive, i + 1);
-                constant.data[i] = 0x00000001;
-
-                constant = constant / mod;
-            }
-
-            public void BarrettReduction(BigInteger x)
-            {
-                BigInteger n = mod;
-                uint k = n.length,
-                    kPlusOne = k + 1,
-                    kMinusOne = k - 1;
-
-                // x < mod, so nothing to do.
-                if (x.length < k) return;
-
-                BigInteger q3;
-
-                //
-                // Validate pointers
-                //
-                if (x.data.Length < x.length) throw new IndexOutOfRangeException("x out of range");
-
-                // q1 = x / b^ (k-1)
-                // q2 = q1 * constant
-                // q3 = q2 / b^ (k+1), Needs to be accessed with an offset of kPlusOne
-
-                // TODO: We should the method in HAC p 604 to do this (14.45)
-                q3 = new BigInteger(Sign.Positive, x.length - kMinusOne + constant.length);
-                Kernel.Multiply(x.data, kMinusOne, x.length - kMinusOne, constant.data, 0, constant.length, q3.data, 0);
-
-                // r1 = x mod b^ (k+1)
-                // i.e. keep the lowest (k+1) words
-
-                uint lengthToCopy = (x.length > kPlusOne) ? kPlusOne : x.length;
-
-                x.length = lengthToCopy;
-                x.Normalize();
-
-                // r2 = (q3 * n) mod b^ (k+1)
-                // partial multiplication of q3 and n
-
-                BigInteger r2 = new BigInteger(Sign.Positive, kPlusOne);
-                Kernel.MultiplyMod2p32pmod(q3.data, (int)kPlusOne, (int)q3.length - (int)kPlusOne, n.data, 0, (int)n.length, r2.data, 0, (int)kPlusOne);
-
-                r2.Normalize();
-
-                if (r2 <= x)
-                {
-                    Kernel.MinusEq(x, r2);
-                }
-                else
-                {
-                    BigInteger val = new BigInteger(Sign.Positive, kPlusOne + 1);
-                    val.data[kPlusOne] = 0x00000001;
-
-                    Kernel.MinusEq(val, r2);
-                    Kernel.PlusEq(x, val);
-                }
-
-                while (x >= n)
-                    Kernel.MinusEq(x, n);
-            }
-
-            public BigInteger Multiply(BigInteger a, BigInteger b)
-            {
-                if (a == 0 || b == 0) return 0;
-
-                if (a > mod)
-                    a %= mod;
-
-                if (b > mod)
-                    b %= mod;
-
-                BigInteger ret = a * b;
-                BarrettReduction(ret);
-
-                return ret;
-            }
-
-            public BigInteger Difference(BigInteger a, BigInteger b)
-            {
-                Sign cmp = Kernel.Compare(a, b);
-                BigInteger diff;
-
-                switch (cmp)
-                {
-                    case Sign.Zero:
-                        return 0;
-                    case Sign.Positive:
-                        diff = a - b; break;
-                    case Sign.Negative:
-                        diff = b - a; break;
-                    default:
-                        throw new Exception();
-                }
-
-                if (diff >= mod)
-                {
-                    if (diff.length >= mod.length << 1)
-                        diff %= mod;
-                    else
-                        BarrettReduction(diff);
-                }
-                if (cmp == Sign.Negative)
-                    diff = mod - diff;
-                return diff;
-            }
-
-            public BigInteger Pow(BigInteger a, BigInteger k)
-            {
-                BigInteger b = new BigInteger(1);
-                if (k == 0)
-                    return b;
-
-                BigInteger A = a;
-                if (k.TestBit(0))
-                    b = a;
-
-                int bitCount = k.BitCount();
-                for (int i = 1; i < bitCount; i++)
-                {
-                    A = Multiply(A, A);
-                    if (k.TestBit(i))
-                        b = Multiply(A, b);
-                }
-                return b;
-            }
-
-
-            public BigInteger Pow(uint b, BigInteger exp)
-            {
-                return Pow(new BigInteger(b), exp);
-            }
-
-        }
-
-        private sealed class Kernel
-        {
-
-            #region Addition/Subtraction
-
-            /// <summary>
-            /// Adds two numbers with the same sign.
-            /// </summary>
-            /// <param name="bi1">A BigInteger</param>
-            /// <param name="bi2">A BigInteger</param>
-            /// <returns>bi1 + bi2</returns>
-            public static BigInteger AddSameSign(BigInteger bi1, BigInteger bi2)
-            {
-                uint[] x, y;
-                uint yMax, xMax, i = 0;
-
-                // x should be bigger
-                if (bi1.length < bi2.length)
-                {
-                    x = bi2.data;
-                    xMax = bi2.length;
-                    y = bi1.data;
-                    yMax = bi1.length;
-                }
-                else
-                {
-                    x = bi1.data;
-                    xMax = bi1.length;
-                    y = bi2.data;
-                    yMax = bi2.length;
-                }
-
-                BigInteger result = new BigInteger(Sign.Positive, xMax + 1);
-
-                uint[] r = result.data;
-
-                ulong sum = 0;
-
-                // Add common parts of both numbers
-                do
-                {
-                    sum = ((ulong)x[i]) + ((ulong)y[i]) + sum;
-                    r[i] = (uint)sum;
-                    sum >>= 32;
-                } while (++i < yMax);
-
-                // Copy remainder of longer number while carry propagation is required
-                bool carry = (sum != 0);
-
-                if (carry)
-                {
-
-                    if (i < xMax)
-                    {
-                        do
-                            carry = ((r[i] = x[i] + 1) == 0);
-                        while (++i < xMax && carry);
-                    }
-
-                    if (carry)
-                    {
-                        r[i] = 1;
-                        result.length = ++i;
-                        return result;
-                    }
-                }
-
-                // Copy the rest
-                if (i < xMax)
-                {
-                    do
-                        r[i] = x[i];
-                    while (++i < xMax);
-                }
-
-                result.Normalize();
-                return result;
-            }
-
-            public static BigInteger Subtract(BigInteger big, BigInteger small)
-            {
-                BigInteger result = new BigInteger(Sign.Positive, big.length);
-
-                uint[] r = result.data, b = big.data, s = small.data;
-                uint i = 0, c = 0;
-
-                do
-                {
-
-                    uint x = s[i];
-                    if (((x += c) < c) | ((r[i] = b[i] - x) > ~x))
-                        c = 1;
-                    else
-                        c = 0;
-
-                } while (++i < small.length);
-
-                if (i == big.length) goto fixup;
-
-                if (c == 1)
-                {
-                    do
-                        r[i] = b[i] - 1;
-                    while (b[i++] == 0 && i < big.length);
-
-                    if (i == big.length) goto fixup;
-                }
-
-                do
-                    r[i] = b[i];
-                while (++i < big.length);
-
-            fixup:
-
-                result.Normalize();
-                return result;
-            }
-
-            public static void MinusEq(BigInteger big, BigInteger small)
-            {
-                uint[] b = big.data, s = small.data;
-                uint i = 0, c = 0;
-
-                do
-                {
-                    uint x = s[i];
-                    if (((x += c) < c) | ((b[i] -= x) > ~x))
-                        c = 1;
-                    else
-                        c = 0;
-                } while (++i < small.length);
-
-                if (i == big.length) goto fixup;
-
-                if (c == 1)
-                {
-                    do
-                        b[i]--;
-                    while (b[i++] == 0 && i < big.length);
-                }
-
-            fixup:
-
-                // Normalize length
-                while (big.length > 0 && big.data[big.length - 1] == 0) big.length--;
-
-                // Check for zero
-                if (big.length == 0)
-                    big.length++;
-
-            }
-
-            public static void PlusEq(BigInteger bi1, BigInteger bi2)
-            {
-                uint[] x, y;
-                uint yMax, xMax, i = 0;
-                bool flag = false;
-
-                // x should be bigger
-                if (bi1.length < bi2.length)
-                {
-                    flag = true;
-                    x = bi2.data;
-                    xMax = bi2.length;
-                    y = bi1.data;
-                    yMax = bi1.length;
-                }
-                else
-                {
-                    x = bi1.data;
-                    xMax = bi1.length;
-                    y = bi2.data;
-                    yMax = bi2.length;
-                }
-
-                uint[] r = bi1.data;
-
-                ulong sum = 0;
-
-                // Add common parts of both numbers
-                do
-                {
-                    sum += ((ulong)x[i]) + ((ulong)y[i]);
-                    r[i] = (uint)sum;
-                    sum >>= 32;
-                } while (++i < yMax);
-
-                // Copy remainder of longer number while carry propagation is required
-                bool carry = (sum != 0);
-
-                if (carry)
-                {
-
-                    if (i < xMax)
-                    {
-                        do
-                            carry = ((r[i] = x[i] + 1) == 0);
-                        while (++i < xMax && carry);
-                    }
-
-                    if (carry)
-                    {
-                        r[i] = 1;
-                        bi1.length = ++i;
-                        return;
-                    }
-                }
-
-                // Copy the rest
-                if (flag && i < xMax - 1)
-                {
-                    do
-                        r[i] = x[i];
-                    while (++i < xMax);
-                }
-
-                bi1.length = xMax + 1;
-                bi1.Normalize();
-            }
-
-            #endregion
-
-            #region Compare
-
-            /// <summary>
-            /// Compares two BigInteger
-            /// </summary>
-            /// <param name="bi1">A BigInteger</param>
-            /// <param name="bi2">A BigInteger</param>
-            /// <returns>The sign of bi1 - bi2</returns>
-            public static Sign Compare(BigInteger bi1, BigInteger bi2)
-            {
-                //
-                // Step 1. Compare the lengths
-                //
-                uint l1 = bi1.length, l2 = bi2.length;
-
-                while (l1 > 0 && bi1.data[l1 - 1] == 0) l1--;
-                while (l2 > 0 && bi2.data[l2 - 1] == 0) l2--;
-
-                if (l1 == 0 && l2 == 0) return Sign.Zero;
-
-                // bi1 len < bi2 len
-                if (l1 < l2) return Sign.Negative;
-                // bi1 len > bi2 len
-                else if (l1 > l2) return Sign.Positive;
-
-                //
-                // Step 2. Compare the bits
-                //
-
-                uint pos = l1 - 1;
-
-                while (pos != 0 && bi1.data[pos] == bi2.data[pos]) pos--;
-
-                if (bi1.data[pos] < bi2.data[pos])
-                    return Sign.Negative;
-                else if (bi1.data[pos] > bi2.data[pos])
-                    return Sign.Positive;
-                else
-                    return Sign.Zero;
-            }
-
-            #endregion
-
-            #region Division
-
-            #region Dword
-
-            /// <summary>
-            /// Performs n / d and n % d in one operation.
-            /// </summary>
-            /// <param name="n">A BigInteger, upon exit this will hold n / d</param>
-            /// <param name="d">The divisor</param>
-            /// <returns>n % d</returns>
-            public static uint SingleByteDivideInPlace(BigInteger n, uint d)
-            {
-                ulong r = 0;
-                uint i = n.length;
-
-                while (i-- > 0)
-                {
-                    r <<= 32;
-                    r |= n.data[i];
-                    n.data[i] = (uint)(r / d);
-                    r %= d;
-                }
-                n.Normalize();
-
-                return (uint)r;
-            }
-
-            public static uint DwordMod(BigInteger n, uint d)
-            {
-                ulong r = 0;
-                uint i = n.length;
-
-                while (i-- > 0)
-                {
-                    r <<= 32;
-                    r |= n.data[i];
-                    r %= d;
-                }
-
-                return (uint)r;
-            }
-
-            public static BigInteger DwordDiv(BigInteger n, uint d)
-            {
-                BigInteger ret = new BigInteger(Sign.Positive, n.length);
-
-                ulong r = 0;
-                uint i = n.length;
-
-                while (i-- > 0)
-                {
-                    r <<= 32;
-                    r |= n.data[i];
-                    ret.data[i] = (uint)(r / d);
-                    r %= d;
-                }
-                ret.Normalize();
-
-                return ret;
-            }
-
-            public static BigInteger[] DwordDivMod(BigInteger n, uint d)
-            {
-                BigInteger ret = new BigInteger(Sign.Positive, n.length);
-
-                ulong r = 0;
-                uint i = n.length;
-
-                while (i-- > 0)
-                {
-                    r <<= 32;
-                    r |= n.data[i];
-                    ret.data[i] = (uint)(r / d);
-                    r %= d;
-                }
-                ret.Normalize();
-
-                BigInteger rem = (uint)r;
-
-                return new BigInteger[] { ret, rem };
-            }
-
-            #endregion
-
-            #region BigNum
-
-            public static BigInteger[] multiByteDivide(BigInteger bi1, BigInteger bi2)
-            {
-                if (Kernel.Compare(bi1, bi2) == Sign.Negative)
-                    return new BigInteger[2] { 0, new BigInteger(bi1) };
-
-                bi1.Normalize(); bi2.Normalize();
-
-                if (bi2.length == 1)
-                    return DwordDivMod(bi1, bi2.data[0]);
-
-                uint remainderLen = bi1.length + 1;
-                int divisorLen = (int)bi2.length + 1;
-
-                uint mask = 0x80000000;
-                uint val = bi2.data[bi2.length - 1];
-                int shift = 0;
-                int resultPos = (int)bi1.length - (int)bi2.length;
-
-                while (mask != 0 && (val & mask) == 0)
-                {
-                    shift++; mask >>= 1;
-                }
-
-                BigInteger quot = new BigInteger(Sign.Positive, bi1.length - bi2.length + 1);
-                BigInteger rem = (bi1 << shift);
-
-                uint[] remainder = rem.data;
-
-                bi2 = bi2 << shift;
-
-                int j = (int)(remainderLen - bi2.length);
-                int pos = (int)remainderLen - 1;
-
-                uint firstDivisorByte = bi2.data[bi2.length - 1];
-                ulong secondDivisorByte = bi2.data[bi2.length - 2];
-
-                while (j > 0)
-                {
-                    ulong dividend = ((ulong)remainder[pos] << 32) + (ulong)remainder[pos - 1];
-
-                    ulong q_hat = dividend / (ulong)firstDivisorByte;
-                    ulong r_hat = dividend % (ulong)firstDivisorByte;
-
-                    do
-                    {
-
-                        if (q_hat == 0x100000000 ||
-                            (q_hat * secondDivisorByte) > ((r_hat << 32) + remainder[pos - 2]))
-                        {
-                            q_hat--;
-                            r_hat += (ulong)firstDivisorByte;
-
-                            if (r_hat < 0x100000000)
-                                continue;
-                        }
-                        break;
-                    } while (true);
-
-                    //
-                    // At this point, q_hat is either exact, or one too large
-                    // (more likely to be exact) so, we attempt to multiply the
-                    // divisor by q_hat, if we get a borrow, we just subtract
-                    // one from q_hat and add the divisor back.
-                    //
-
-                    uint t;
-                    uint dPos = 0;
-                    int nPos = pos - divisorLen + 1;
-                    ulong mc = 0;
-                    uint uint_q_hat = (uint)q_hat;
-                    do
-                    {
-                        mc += (ulong)bi2.data[dPos] * (ulong)uint_q_hat;
-                        t = remainder[nPos];
-                        remainder[nPos] -= (uint)mc;
-                        mc >>= 32;
-                        if (remainder[nPos] > t) mc++;
-                        dPos++; nPos++;
-                    } while (dPos < divisorLen);
-
-                    nPos = pos - divisorLen + 1;
-                    dPos = 0;
-
-                    // Overestimate
-                    if (mc != 0)
-                    {
-                        uint_q_hat--;
-                        ulong sum = 0;
-
-                        do
-                        {
-                            sum = ((ulong)remainder[nPos]) + ((ulong)bi2.data[dPos]) + sum;
-                            remainder[nPos] = (uint)sum;
-                            sum >>= 32;
-                            dPos++; nPos++;
-                        } while (dPos < divisorLen);
-
-                    }
-
-                    quot.data[resultPos--] = (uint)uint_q_hat;
-
-                    pos--;
-                    j--;
-                }
-
-                quot.Normalize();
-                rem.Normalize();
-                BigInteger[] ret = new BigInteger[2] { quot, rem };
-
-                if (shift != 0)
-                    ret[1] >>= shift;
-
-                return ret;
-            }
-
-            #endregion
-
-            #endregion
-
-            #region Shift
-            public static BigInteger LeftShift(BigInteger bi, int n)
-            {
-                if (n == 0) return new BigInteger(bi, bi.length + 1);
-
-                int w = n >> 5;
-                n &= ((1 << 5) - 1);
-
-                BigInteger ret = new BigInteger(Sign.Positive, bi.length + 1 + (uint)w);
-
-                uint i = 0, l = bi.length;
-                if (n != 0)
-                {
-                    uint x, carry = 0;
-                    while (i < l)
-                    {
-                        x = bi.data[i];
-                        ret.data[i + w] = (x << n) | carry;
-                        carry = x >> (32 - n);
-                        i++;
-                    }
-                    ret.data[i + w] = carry;
-                }
-                else
-                {
-                    while (i < l)
-                    {
-                        ret.data[i + w] = bi.data[i];
-                        i++;
-                    }
-                }
-
-                ret.Normalize();
-                return ret;
-            }
-
-            public static BigInteger RightShift(BigInteger bi, int n)
-            {
-                if (n == 0) return new BigInteger(bi);
-
-                int w = n >> 5;
-                int s = n & ((1 << 5) - 1);
-
-                BigInteger ret = new BigInteger(Sign.Positive, bi.length - (uint)w + 1);
-                uint l = (uint)ret.data.Length - 1;
-
-                if (s != 0)
-                {
-
-                    uint x, carry = 0;
-
-                    while (l-- > 0)
-                    {
-                        x = bi.data[l + w];
-                        ret.data[l] = (x >> n) | carry;
-                        carry = x << (32 - n);
-                    }
-                }
-                else
-                {
-                    while (l-- > 0)
-                        ret.data[l] = bi.data[l + w];
-
-                }
-                ret.Normalize();
-                return ret;
-            }
-
-            #endregion
-
-            #region Multiply
-
-            public static BigInteger MultiplyByDword(BigInteger n, uint f)
-            {
-                BigInteger ret = new BigInteger(Sign.Positive, n.length + 1);
-
-                uint i = 0;
-                ulong c = 0;
-
-                do
-                {
-                    c += (ulong)n.data[i] * (ulong)f;
-                    ret.data[i] = (uint)c;
-                    c >>= 32;
-                } while (++i < n.length);
-                ret.data[i] = (uint)c;
-                ret.Normalize();
-                return ret;
-
-            }
-
-            /// <summary>
-            /// Multiplies the data in x [xOffset:xOffset+xLen] by
-            /// y [yOffset:yOffset+yLen] and puts it into
-            /// d [dOffset:dOffset+xLen+yLen].
-            /// </summary>
-            /// <remarks>
-            /// This code is unsafe! It is the caller's responsibility to make
-            /// sure that it is safe to access x [xOffset:xOffset+xLen],
-            /// y [yOffset:yOffset+yLen], and d [dOffset:dOffset+xLen+yLen].
-            /// </remarks>
-            public static unsafe void Multiply(uint[] x, uint xOffset, uint xLen, uint[] y, uint yOffset, uint yLen, uint[] d, uint dOffset)
-            {
-                fixed (uint* xx = x, yy = y, dd = d)
-                {
-                    uint* xP = xx + xOffset,
-                        xE = xP + xLen,
-                        yB = yy + yOffset,
-                        yE = yB + yLen,
-                        dB = dd + dOffset;
-
-                    for (; xP < xE; xP++, dB++)
-                    {
-
-                        if (*xP == 0) continue;
-
-                        ulong mcarry = 0;
-
-                        uint* dP = dB;
-                        for (uint* yP = yB; yP < yE; yP++, dP++)
-                        {
-                            mcarry += ((ulong)*xP * (ulong)*yP) + (ulong)*dP;
-
-                            *dP = (uint)mcarry;
-                            mcarry >>= 32;
-                        }
-
-                        if (mcarry != 0)
-                            *dP = (uint)mcarry;
-                    }
-                }
-            }
-
-            /// <summary>
-            /// Multiplies the data in x [xOffset:xOffset+xLen] by
-            /// y [yOffset:yOffset+yLen] and puts the low mod words into
-            /// d [dOffset:dOffset+mod].
-            /// </summary>
-            /// <remarks>
-            /// This code is unsafe! It is the caller's responsibility to make
-            /// sure that it is safe to access x [xOffset:xOffset+xLen],
-            /// y [yOffset:yOffset+yLen], and d [dOffset:dOffset+mod].
-            /// </remarks>
-            public static unsafe void MultiplyMod2p32pmod(uint[] x, int xOffset, int xLen, uint[] y, int yOffest, int yLen, uint[] d, int dOffset, int mod)
-            {
-                fixed (uint* xx = x, yy = y, dd = d)
-                {
-                    uint* xP = xx + xOffset,
-                        xE = xP + xLen,
-                        yB = yy + yOffest,
-                        yE = yB + yLen,
-                        dB = dd + dOffset,
-                        dE = dB + mod;
-
-                    for (; xP < xE; xP++, dB++)
-                    {
-
-                        if (*xP == 0) continue;
-
-                        ulong mcarry = 0;
-                        uint* dP = dB;
-                        for (uint* yP = yB; yP < yE && dP < dE; yP++, dP++)
-                        {
-                            mcarry += ((ulong)*xP * (ulong)*yP) + (ulong)*dP;
-
-                            *dP = (uint)mcarry;
-                            mcarry >>= 32;
-                        }
-
-                        if (mcarry != 0 && dP < dE)
-                            *dP = (uint)mcarry;
-                    }
-                }
-            }
-
-
-            #endregion
-
-            #region Number Theory
-
-            public static BigInteger gcd(BigInteger a, BigInteger b)
-            {
-                BigInteger x = a;
-                BigInteger y = b;
-
-                BigInteger g = y;
-
-                while (x.length > 1)
-                {
-                    g = x;
-                    x = y % x;
-                    y = g;
-
-                }
-                if (x == 0) return g;
-
-                // TODO: should we have something here if we can convert to long?
-
-                //
-                // Now we can just do it with single precision. I am using the binary gcd method,
-                // as it should be faster.
-                //
-
-                uint yy = x.data[0];
-                uint xx = y % yy;
-
-                int t = 0;
-
-                while (((xx | yy) & 1) == 0)
-                {
-                    xx >>= 1; yy >>= 1; t++;
-                }
-                while (xx != 0)
-                {
-                    while ((xx & 1) == 0) xx >>= 1;
-                    while ((yy & 1) == 0) yy >>= 1;
-                    if (xx >= yy)
-                        xx = (xx - yy) >> 1;
-                    else
-                        yy = (yy - xx) >> 1;
-                }
-
-                return yy << t;
-            }
-
-
-            public static BigInteger modInverse(BigInteger bi, BigInteger modulus)
-            {
-                if (modulus.length == 1) return modInverse(bi, modulus.data[0]);
-
-                BigInteger[] p = { 0, 1 };
-                BigInteger[] q = new BigInteger[2];    // quotients
-                BigInteger[] r = { 0, 0 };             // remainders
-
-                int step = 0;
-
-                BigInteger a = modulus;
-                BigInteger b = bi;
-
-                ModulusRing mr = new ModulusRing(modulus);
-
-                while (b != 0)
-                {
-
-                    if (step > 1)
-                    {
-
-                        BigInteger pval = mr.Difference(p[0], p[1] * q[0]);
-                        p[0] = p[1]; p[1] = pval;
-                    }
-
-                    BigInteger[] divret = multiByteDivide(a, b);
-
-                    q[0] = q[1]; q[1] = divret[0];
-                    r[0] = r[1]; r[1] = divret[1];
-                    a = b;
-                    b = divret[1];
-
-                    step++;
-                }
-
-                if (r[0] != 1)
-                    throw (new ArithmeticException("No inverse!"));
-
-                return mr.Difference(p[0], p[1] * q[0]);
-
-            }
-            #endregion
-        }
-
-        internal BigInteger Xor(BigInteger other)
-        {
-            int len = (int)Math.Min(this.data.Length, other.data.Length);
-            uint[] result = new uint[len];
-
-            for (int i = 0; i < len; i++)
-                result[i] = this.data[i] ^ other.data[i];
-
-            return new BigInteger(result);
-        }
-
-        internal static BigInteger Pow(BigInteger value, uint p)
-        {
-            BigInteger b = value;
-            for (int i = 0; i < p; i++)
-                value = value * b;
-            return value;
-        }
-    }
-}
-#endif


Update Compiler.cs (#279)

Update Compiler.cs (#279)

--- src/Neo.Compiler.MSIL/Compiler.cs
+++ src/Neo.Compiler.MSIL/Compiler.cs
@@ -159,7 +159,10 @@
         /// <returns>Assembly</returns>
         public static Assembly CompileVBFiles(string[] filenames, string[] references, bool releaseMode = true)
         {
-            var tree = filenames.Select(u => VisualBasicSyntaxTree.ParseText(File.ReadAllText(u))).ToArray();
+            var tree = filenames.Select(u => VisualBasicSyntaxTree.ParseText(
+                            File.ReadAllText(u),
+                            path: u,
+                            encoding: System.Text.Encoding.UTF8)).ToArray();
             var op = new VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: releaseMode ? OptimizationLevel.Release : OptimizationLevel.Debug);
             return Assembly.Create(VisualBasicCompilation.Create("SmartContract", tree, CreateReferences(references), op));
         }
@@ -173,7 +176,10 @@
         /// <returns>Assembly</returns>
         public static Assembly CompileCSFiles(string[] filenames, string[] references, bool releaseMode = true)
         {
-            var tree = filenames.Select(u => CSharpSyntaxTree.ParseText(File.ReadAllText(u))).ToArray();
+            var tree = filenames.Select(u => CSharpSyntaxTree.ParseText(
+                            File.ReadAllText(u),
+                            path: u,
+                            encoding: System.Text.Encoding.UTF8)).ToArray();
             var op = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: releaseMode ? OptimizationLevel.Release : OptimizationLevel.Debug);
             return Assembly.Create(CSharpCompilation.Create("SmartContract", tree, CreateReferences(references), op));
         }