Update Game.Database.cs

Update Game.Database.cs

--- PokemonUnity.Shared/Application/Game.Database.cs
+++ PokemonUnity.Shared/Application/Game.Database.cs
@@ -402,9 +402,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -460,9 +460,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -562,9 +562,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -866,9 +866,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -919,9 +919,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -960,9 +960,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1029,9 +1029,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1216,9 +1216,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1294,9 +1294,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1362,9 +1362,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1423,9 +1423,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1503,9 +1503,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1592,9 +1592,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1656,9 +1656,9 @@
 				}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}
@@ -1981,9 +1981,9 @@
 				//}
 				return true;
 			} catch (SQLiteException e) {
-				//Debug.Log("SQL Exception Message:" + e.Message);
-				//Debug.Log("SQL Exception Code:" + e.ErrorCode.ToString());
-				//Debug.Log("SQL Exception Help:" + e.HelpLink);
+				GameDebug.LogError("SQL Exception Message:" + e.Message);
+				GameDebug.LogError("SQL Exception Code:" + e.ErrorCode.ToString());
+				GameDebug.LogError("SQL Exception Help:" + e.HelpLink);
 				return false;
 			}
 		}


Fix meta event 21h broadcast (port select)

--- src/MidiSplit/MidiSplit.cs
+++ src/MidiSplit/MidiSplit.cs
@@ -604,7 +604,7 @@
                     if (midiEvent.Message is MidiMetaMessage)
                     {
                         MidiMetaMessage metaMessage = midiEvent.Message as MidiMetaMessage;
-                        if ((byte)metaMessage.MetaType == 21) // Unofficial port select
+                        if ((byte)metaMessage.MetaType == 0x21) // Unofficial port select
                         {
                             broadcastToAllTracks = true;
                         }


Update parameter name

Update parameter name

--- PortableExtensions/System.String/String.Split.cs
+++ PortableExtensions/System.String/String.Split.cs
@@ -13,12 +13,12 @@
     {
         /// <summary>
         ///     Returns a string array that contains the substrings in this string that are
-        ///     delimited by the given seperator. A parameter specifies
+        ///     delimited by the given separator. A parameter specifies
         ///     whether to return empty array elements.
         /// </summary>
         /// <exception cref="ArgumentNullException">The string can not be null.</exception>
         /// <exception cref="ArgumentNullException">The separator can not be null.</exception>
-        /// <param name="str">The string to split.</param>
+        /// <param name="value">The string to split.</param>
         /// <param name="separator">A string that delimit the substrings in this string.</param>
         /// <param name="stringSplitOption">
         ///     <see cref="System.StringSplitOptions.RemoveEmptyEntries" /> to omit empty array elements
@@ -28,14 +28,14 @@
         /// <returns>
         ///     Returns an array whose elements contain the substrings in this string that are delimited by the separator.
         /// </returns>
-        public static String[] Split( this String str,
+        public static String[] Split( this String value,
                                       String separator,
                                       StringSplitOptions stringSplitOption = StringSplitOptions.None )
         {
-            str.ThrowIfNull( () => str );
+            value.ThrowIfNull( () => value );
             separator.ThrowIfNull( () => separator );

-            return str.Split( new[]
+            return value.Split( new[]
             {
                 separator
             },
@@ -49,7 +49,7 @@
         /// </summary>
         /// <exception cref="ArgumentNullException">The string can not be null.</exception>
         /// <exception cref="ArgumentNullException">The separator can not be null.</exception>
-        /// <param name="str">The string to split.</param>
+        /// <param name="value">The string to split.</param>
         /// <param name="separators">
         ///     An array of strings that delimit the substrings in this string, an empty
         ///     array that contains no delimiters, or null.
@@ -63,12 +63,12 @@
         ///     Returns an array whose elements contain the substrings in this string that are delimited
         ///     by one or more strings in separator.
         /// </returns>
-        public static String[] Split( this String str, StringSplitOptions stringSplitOption, params String[] separators )
+        public static String[] Split( this String value, StringSplitOptions stringSplitOption, params String[] separators )
         {
-            str.ThrowIfNull( () => str );
+            value.ThrowIfNull( () => value );
             separators.ThrowIfNull( () => separators );

-            return str.Split( separators, stringSplitOption );
+            return value.Split( separators, stringSplitOption );
         }
     }
 }


Removed count to get a better error message.

--- Tests/Magick.NET.Tests/Shared/MagickImageTests.cs
+++ Tests/Magick.NET.Tests/Shared/MagickImageTests.cs
@@ -2490,10 +2490,7 @@
             {
                 IEnumerable<string> names = image.ProfileNames;
                 Assert.IsNotNull(names);
-                Assert.AreEqual(5, names.Count());
-                Assert.AreEqual("8bim,exif,icc,iptc,xmp", string.Join(",", (from name in names
-                                                                            orderby name
-                                                                            select name).ToArray()));
+                Assert.AreEqual("8bim,exif,icc,iptc,xmp", string.Join(",", names));
             }

             using (IMagickImage image = new MagickImage(Files.RedPNG))


More changes. Still one failing unit test.

--- src/8-Int-Numbers-To-English/NumberConverter.cs
+++ src/8-Int-Numbers-To-English/NumberConverter.cs
@@ -54,16 +54,29 @@

                 while (modulus > 999)
                 {
+                    divisor -= 1000;
+                    modulus = number % divisor;
+                }
+
+                output.Append(GetThousandsValue(divisor));
+
+                if (modulus == 0)
+                {
+                    return output.ToString();
+                }
+
+                number = modulus;
+                divisor = 900;
+                modulus = number % divisor;
+                while (modulus > 100)
+                {
                     divisor -= 100;
                     modulus = number % divisor;
                 }

-                output.Append(GetThousandsValue(divisor));
-
-                while (modulus > 100)
-                {
-                    divisor -= 100;
-                    modulus = number % divisor;
+                if (divisor > 0)
+                {
+                    output.Append(" " + GetHundredsValue(divisor));
                 }

                 if (modulus > 99)


Fixed so that procedures can use keywords like CREATE and ALTER inside of them without this program breaking the proc into several changesets

--- RedgateToLiquibase/RedgateToLiquibase/Program.cs
+++ RedgateToLiquibase/RedgateToLiquibase/Program.cs
@@ -30,11 +30,12 @@
             string liquibaseRepoPath = @"C:\src\github\liquibase-template-for-MSSQL\db_repository";

             Handle(Path.Combine(redgateRepoPath, "Tables"), Path.Combine(liquibaseRepoPath, "Tables"));
+            Handle(Path.Combine(redgateRepoPath, "Assemblies"), Path.Combine(liquibaseRepoPath, "Assemblies"));
             Handle(Path.Combine(redgateRepoPath, "Security", "Schemas"), Path.Combine(liquibaseRepoPath, "Security", "Schemas"));
             Handle(Path.Combine(redgateRepoPath, "Security", "Users"), Path.Combine(liquibaseRepoPath, "Security", "Users"));
             Handle(Path.Combine(redgateRepoPath, "Security", "Roles"), Path.Combine(liquibaseRepoPath, "Security", "Roles"));
             Handle(Path.Combine(redgateRepoPath, "Views"), Path.Combine(liquibaseRepoPath, "Views"), true);
-            Handle(Path.Combine(redgateRepoPath, "Stored Procedures"), Path.Combine(liquibaseRepoPath, "Stored Procedures"), true);
+            Handle(Path.Combine(redgateRepoPath, "Stored Procedures"), Path.Combine(liquibaseRepoPath, "Stored Procedures"), true, false);
             Handle(Path.Combine(redgateRepoPath, "Functions"), Path.Combine(liquibaseRepoPath, "Functions"), true);
             Handle(Path.Combine(redgateRepoPath, "Types", "User-defined Data Types"), Path.Combine(liquibaseRepoPath, "Types", "User-defined Data Types"));

@@ -42,7 +43,7 @@
             Handle(Path.Combine(redgateRepoPath, "Storage", "Partition Functions"), Path.Combine(liquibaseRepoPath, "Storage", "Partition Functions"), true);
         }

-        private void Handle(string redgateObjectPath, string liquibaseObjectPath, bool runOnChanges = false)
+        private void Handle(string redgateObjectPath, string liquibaseObjectPath, bool runOnChanges = false, bool addChangeSetForEachDDL = true )
         {
             var objects = new List<FileInfo>();

@@ -51,7 +52,7 @@
                 FileInfo fi = new FileInfo(file);
                 objects.Add(fi);
                 var targetPath = Path.Combine(liquibaseObjectPath, fi.Name);
-                CreateLiquifiedFile(fi, targetPath, runOnChanges);
+                CreateLiquifiedFile(fi, targetPath, runOnChanges, addChangeSetForEachDDL);

                 Console.WriteLine(fi.Name);
             }
@@ -90,7 +91,7 @@
             File.WriteAllText(targetFilePath, string.Format(masterContentTemplate, sb.ToString()));
         }

-        private void CreateLiquifiedFile(FileInfo fi, string targetPath, bool runOnChanges)
+        private void CreateLiquifiedFile(FileInfo fi, string targetPath, bool runOnChanges, bool addChangeSetForEachDDL)
         {
             using (var writer = new StreamWriter(targetPath))
             using (var reader = new StreamReader(fi.FullName))
@@ -104,14 +105,14 @@
                 while (!reader.EndOfStream)
                 {
                     var line = reader.ReadLine();
-                    if (line.Trim().Equals("GO"))
+                    if (line.Trim().ToUpper().Equals("GO"))
                     {
                         // sometimes the GO statement is not at the begining of the line
                         line = "GO";
                     }
                     if (line.StartsWith("CREATE") || line.StartsWith("ALTER") || line.StartsWith("DROP"))
                     {
-                        if (!firstDDL)
+                        if (!firstDDL && addChangeSetForEachDDL)
                         {
                             writer.WriteLine(GetChangeSetComment(fi, runOnChanges));
                         }


Adds method information for Bridge.Tranlsator.Translator.ValidateProject. [bridgedotnet/Bridge#88]

--- Translator/Translator/Translator.ProjectReader.cs
+++ Translator/Translator/Translator.ProjectReader.cs
@@ -19,6 +19,10 @@
             this.ParsedSourceFiles = new List<ParsedSourceFile>();
         }

+        /// <summary>
+        /// Validates project and namespace names against conflicts with Bridge.NET namespaces.
+        /// </summary>
+        /// <param name="doc">XDocument reference of the .csproj file.</param>
         private void ValidateProject(XDocument doc)
         {
             var valid = true;


HW 1-4 E: Final

HW 1-4 E: Final

--- src/Algorithms/CorpAlgoCourse/HW-1-4-E-Fence.cs
+++ src/Algorithms/CorpAlgoCourse/HW-1-4-E-Fence.cs
@@ -19,10 +19,19 @@
         public static IEnumerable<object[]> InputData1 => new TheoryData<int[], int, int>
         {
             { new[] { 1, 2, 6, 1, 1, 7, 1 }, 3, 3 },
+            { new[] { 3, 1, 4, 1, 4, 6, 2, 1, 4, 6 }, 2, 7 },
+            { new[] { 1, 2, 6, 1, 1, 7, 1 }, 3, 3 },
+            { new[] { 1, 1, 1 }, 3, 1 },
+            { new[] { 20, 1 }, 1, 2 },
         };

         private static int Solve(int[] fences, int piano)
         {
+            if (fences.Length == piano)
+            {
+                return 1;
+            }
+
             int currentFences = 0;
             int minimumFences = 0;

@@ -34,14 +43,9 @@
             minimumFences = currentFences;
             int minimumIndex = 0;

-            if (fences.Length == piano)
+            for (int i = 1; i < fences.Length - piano + 1; i++)
             {
-                return minimumIndex;
-            }
-
-            for (int i = piano; i < fences.Length; i++)
-            {
-                currentFences = currentFences - fences[i - piano] + fences[i];
+                currentFences = currentFences - fences[i - 1] + fences[i + piano - 1];
                 if (currentFences < minimumFences)
                 {
                     minimumFences = currentFences;
@@ -49,7 +53,7 @@
                 }
             }

-            return minimumIndex;
+            return minimumIndex + 1;
         }

         private static void Main1()


Remove keyselector

Remove keyselector

--- src/AppStudio.DataProviders/DataProviderBase.cs
+++ src/AppStudio.DataProviders/DataProviderBase.cs
@@ -9,7 +9,7 @@
     public abstract class DataProviderBase<TConfig>
     {
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an async method, so nesting generic types is necessary.")]
-        public async Task<IEnumerable<TSchema>> LoadDataAsync<TSchema>(TConfig config, int maxRecords, IParser<TSchema> parser, Func<TSchema, object> keySelector = null) where TSchema : SchemaBase
+        public async Task<IEnumerable<TSchema>> LoadDataAsync<TSchema>(TConfig config, int maxRecords, IParser<TSchema> parser) where TSchema : SchemaBase
         {
             if (config == null)
             {
@@ -24,18 +24,9 @@
             var result = await GetDataAsync(config, maxRecords, parser);
             if (result != null)
             {
-                if (keySelector != null)
-                {
-                    return result
-                        .Take(maxRecords).OrderBy(keySelector)
-                        .ToList();
-                }
-                else
-                {
-                    return result
-                        .Take(maxRecords)
-                        .ToList();
-                }
+                return result
+                    .Take(maxRecords)
+                    .ToList();
             }
             return new TSchema[0];
         }
@@ -47,9 +38,9 @@
     public abstract class DataProviderBase<TConfig, TSchema> : DataProviderBase<TConfig> where TSchema : SchemaBase
     {
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an async method, so nesting generic types is necessary.")]
-        public async Task<IEnumerable<TSchema>> LoadDataAsync(TConfig config, int maxRecords = 20, Func<TSchema, object> keySelector = null)
+        public async Task<IEnumerable<TSchema>> LoadDataAsync(TConfig config, int maxRecords = 20)
         {
-            return await LoadDataAsync(config, maxRecords, GetDefaultParser(config), keySelector);
+            return await LoadDataAsync(config, maxRecords, GetDefaultParser(config));
         }

         public IParser<TSchema> GetDefaultParser(TConfig config)


mainline: changed back to use Socket.ConnectAsync to start a connect in ClientEngine

--- mainline/ClientEngine/TcpClientSession.cs
+++ mainline/ClientEngine/TcpClientSession.cs
@@ -47,8 +47,6 @@
         protected override void Connect()
         {
             m_SocketEventArgs.RemoteEndPoint = RemoteEndPoint;
-
-            Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, m_SocketEventArgs);

             if (!Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, m_SocketEventArgs))
                 ProcessAccept(m_SocketEventArgs);


Remove call to ToString, SettingsKey properties are not strings

--- ActionBar/PrinterSelector.cs
+++ ActionBar/PrinterSelector.cs
@@ -117,7 +117,7 @@
 		private void SettingChanged(object sender, EventArgs e)
 		{
 			string settingsName = (e as StringEventArgs)?.Data;
-			if (settingsName != null && settingsName == SettingsKey.printer_name.ToString())
+			if (settingsName != null && settingsName == SettingsKey.printer_name)
 			{
 				if (ProfileManager.Instance.ActiveProfile != null)
 				{


Cleanup.

Cleanup.

--- src/AutoMoq/Unity/AutoMockingBuilderStrategy.cs
+++ src/AutoMoq/Unity/AutoMockingBuilderStrategy.cs
@@ -1,16 +1,14 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Reflection;
 using Microsoft.Practices.ObjectBuilder2;
-using Microsoft.Practices.Unity;

 namespace AutoMoq.Unity
 {
     public class AutoMockingBuilderStrategy : BuilderStrategy
     {
+        private readonly IoC ioc;
         private readonly Mocking mocking;
-        private readonly IoC ioc;

         public AutoMockingBuilderStrategy(Mocking mocking, IoC ioc)
         {
@@ -48,7 +46,7 @@
                 }
                 catch
                 {
-                    var mockObject = mock.ActualObject as object;
+                    var mockObject = mock.ActualObject;
                     ioc.RegisterInstance(mockObject, abstractParameter);
                 }
             }


Fix status stuck issue

Fix status stuck issue

--- WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
+++ WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -2,6 +2,7 @@
 using AvalonStudio.Extensibility;
 using AvalonStudio.Shell;
 using NBitcoin.Protocol;
+using Nito.AsyncEx;
 using ReactiveUI;
 using System;
 using System.Collections.Generic;
@@ -33,6 +34,7 @@
 	public class StatusBarViewModel : ViewModelBase
 	{
 		private CompositeDisposable Disposables { get; } = new CompositeDisposable();
+		private AsyncLock StatusTextAnimationLock { get; }
 		private NodesCollection Nodes { get; }
 		private WasabiSynchronizer Synchronizer { get; }

@@ -58,6 +60,7 @@
 			BlocksLeft = 0;
 			FiltersLeft = synchronizer.GetFiltersLeft();
 			UseTor = Global.Config.UseTor.Value; // Don't make it dynamic, because if you change this config settings only next time will it activate.
+			StatusTextAnimationLock = new AsyncLock();

 			Observable.FromEventPattern<NodeEventArgs>(nodes, nameof(nodes.Added))
 				.Subscribe(x =>
@@ -148,24 +151,27 @@

 			this.WhenAnyValue(x => x.StatusText).Subscribe(async status =>
 			{
-				if (status.EndsWith(".")) // Then do animation.
-				{
-					string nextAnimation = null;
-					if (status.EndsWith("..."))
-					{
-						nextAnimation = status.TrimEnd("..", StringComparison.Ordinal);
-					}
-					else if (status.EndsWith("..") || status.EndsWith("."))
-					{
-						nextAnimation = $"{status}.";
-					}
-
-					if (nextAnimation != null)
-					{
-						await Task.Delay(1000);
-						if (StatusText == status) // If still the same.
+				using (await StatusTextAnimationLock.LockAsync()) // Without this lock the status get stuck once in a while.
+				{
+					if (status.EndsWith(".")) // Then do animation.
+					{
+						string nextAnimation = null;
+						if (status.EndsWith("..."))
 						{
-							StatusText = nextAnimation;
+							nextAnimation = status.TrimEnd("..", StringComparison.Ordinal);
+						}
+						else if (status.EndsWith("..") || status.EndsWith("."))
+						{
+							nextAnimation = $"{status}.";
+						}
+
+						if (nextAnimation != null)
+						{
+							await Task.Delay(1000);
+							if (StatusText == status) // If still the same.
+							{
+								StatusText = nextAnimation;
+							}
 						}
 					}
 				}


check sr false

check sr false

--- ArcGIS.Test/GeometryTests.cs
+++ ArcGIS.Test/GeometryTests.cs
@@ -98,6 +98,7 @@
             Assert.True(SpatialReference.WGS84 != null);
             Assert.True(null != SpatialReference.WGS84);
             Assert.True(new SpatialReference { Wkid = 2193 } != SpatialReference.WGS84);
+            Assert.False(SpatialReference.WGS84 != new SpatialReference { Wkid = SpatialReference.WGS84.Wkid });
         }
     }
 }


Implement https -> http redirections from ArchiBoT

--- ArchiSteamFarm/WebBrowser.cs
+++ ArchiSteamFarm/WebBrowser.cs
@@ -231,7 +231,7 @@
 			return null;
 		}

-		internal async Task<bool> UrlPost(string request, IEnumerable<KeyValuePair<string, string>> data = null, string referer = null) {
+		internal async Task<bool> UrlPost(string request, ICollection<KeyValuePair<string, string>> data = null, string referer = null) {
 			if (string.IsNullOrEmpty(request)) {
 				ArchiLogger.LogNullError(nameof(request));
 				return false;
@@ -381,7 +381,7 @@

 		private async Task<HttpResponseMessage> UrlGetToResponse(string request, string referer = null) {
 			if (!string.IsNullOrEmpty(request)) {
-				return await UrlRequest(request, HttpMethod.Get, null, referer).ConfigureAwait(false);
+				return await UrlRequest(new Uri(request), HttpMethod.Get, null, referer).ConfigureAwait(false);
 			}

 			ArchiLogger.LogNullError(nameof(request));
@@ -424,7 +424,7 @@

 		private async Task<HttpResponseMessage> UrlHeadToResponse(string request, string referer = null) {
 			if (!string.IsNullOrEmpty(request)) {
-				return await UrlRequest(request, HttpMethod.Head, null, referer).ConfigureAwait(false);
+				return await UrlRequest(new Uri(request), HttpMethod.Head, null, referer).ConfigureAwait(false);
 			}

 			ArchiLogger.LogNullError(nameof(request));
@@ -442,7 +442,7 @@
 			}
 		}

-		private async Task<string> UrlPostToContent(string request, IEnumerable<KeyValuePair<string, string>> data = null, string referer = null) {
+		private async Task<string> UrlPostToContent(string request, ICollection<KeyValuePair<string, string>> data = null, string referer = null) {
 			if (string.IsNullOrEmpty(request)) {
 				ArchiLogger.LogNullError(nameof(request));
 				return null;
@@ -477,23 +477,23 @@
 			return null;
 		}

-		private async Task<HttpResponseMessage> UrlPostToResponse(string request, IEnumerable<KeyValuePair<string, string>> data = null, string referer = null) {
+		private async Task<HttpResponseMessage> UrlPostToResponse(string request, ICollection<KeyValuePair<string, string>> data = null, string referer = null) {
 			if (!string.IsNullOrEmpty(request)) {
-				return await UrlRequest(request, HttpMethod.Post, data, referer).ConfigureAwait(false);
+				return await UrlRequest(new Uri(request), HttpMethod.Post, data, referer).ConfigureAwait(false);
 			}

 			ArchiLogger.LogNullError(nameof(request));
 			return null;
 		}

-		private async Task<HttpResponseMessage> UrlRequest(string request, HttpMethod httpMethod, IEnumerable<KeyValuePair<string, string>> data = null, string referer = null) {
-			if (string.IsNullOrEmpty(request) || (httpMethod == null)) {
-				ArchiLogger.LogNullError(nameof(request) + " || " + nameof(httpMethod));
+		private async Task<HttpResponseMessage> UrlRequest(Uri requestUri, HttpMethod httpMethod, ICollection<KeyValuePair<string, string>> data = null, string referer = null, byte maxRedirections = MaxRetries) {
+			if ((requestUri == null) || (httpMethod == null)) {
+				ArchiLogger.LogNullError(nameof(requestUri) + " || " + nameof(httpMethod));
 				return null;
 			}

 			HttpResponseMessage responseMessage;
-			using (HttpRequestMessage requestMessage = new HttpRequestMessage(httpMethod, request)) {
+			using (HttpRequestMessage requestMessage = new HttpRequestMessage(httpMethod, requestUri)) {
 				if (data != null) {
 					try {
 						requestMessage.Content = new FormUrlEncodedContent(data);
@@ -527,14 +527,27 @@
 				return responseMessage;
 			}

-			if (Debugging.IsUserDebugging) {
-				ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
-				ArchiLogger.LogGenericDebug(string.Format(Strings.StatusCode, responseMessage.StatusCode));
-				ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false)));
-			}
-
-			responseMessage.Dispose();
-			return null;
+			Uri redirectUri;
+			using (responseMessage) {
+				int status = (int) responseMessage.StatusCode;
+				if ((status >= 300) && (status <= 399) && (maxRedirections > 0)) {
+					redirectUri = responseMessage.Headers.Location;
+					if (!redirectUri.IsAbsoluteUri) {
+						redirectUri = new Uri(requestUri.GetLeftPart(UriPartial.Authority) + redirectUri);
+					}
+				} else {
+					if (!Debugging.IsDebugBuild) {
+						return null;
+					}
+
+					ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, requestUri));
+					ArchiLogger.LogGenericDebug(string.Format(Strings.StatusCode, responseMessage.StatusCode));
+					ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false)));
+					return null;
+				}
+			}
+
+			return await UrlRequest(redirectUri, httpMethod, data, referer, --maxRedirections).ConfigureAwait(false);
 		}
 	}
 }


log query params and SendStart

log query params and SendStart

--- Scripts/Services/SpeechToText/v1/SpeechToText.cs
+++ Scripts/Services/SpeechToText/v1/SpeechToText.cs
@@ -545,7 +545,7 @@
                 else
                 {
 #if ENABLE_DEBUGGING
-                    Log.Debug("SpeechToText", "Created listen socket. Model: {0}, Inactivity Timeout: {1}", WWW.EscapeURL(_recognizeModel));
+                    Log.Debug("SpeechToText", "Created listen socket. Model: {0}, parsedParams: {1}", WWW.EscapeURL(_recognizeModel), parsedParams);
 #endif
                 }

@@ -586,6 +586,9 @@
             start["word_confidence"] = EnableWordConfidence;

             _listenSocket.Send(new WSConnector.TextMessage(Json.Serialize(start)));
+#if ENABLE_DEBUGGING
+            Log.Debug("SpeechToText", "SendStart() with the following params: {0}", Json.Serialize(start));
+#endif
             _lastStartSent = DateTime.Now;
         }


Fixed stack overflow exception

Fixed stack overflow exception

--- AssemblyHasher/FileHasher.cs
+++ AssemblyHasher/FileHasher.cs
@@ -12,7 +12,7 @@
     {
         public static string Hash(params string[] filenames)
         {
-            return Hash(filenames);
+            return Hash(false, filenames);
         }

         public static string Hash(bool ignoreVersions, params string[] filenames)


display version text "TELChecker V0.X"

display version text "TELChecker V0.X"

--- Assets/CheckButtonControl.cs
+++ Assets/CheckButtonControl.cs
@@ -16,7 +16,10 @@
 public class CheckButtonControl : MonoBehaviour {

 	public const string kTitle = "<title>";
+	public const string kVersion = "TELChecker V0.2";
+
 	public Text resText; // to show check result
+	public Text verText; // to show version info
 	public InputField IFtelno; // for input telephone number
 	public InputField IFinfo; // to show/input hospital name

@@ -30,6 +33,7 @@
 		if (justStarted) {
 			justStarted = false;
 			file_import();
+			verText.text = kVersion;
 		}
 	}


Enable ads test mode if development build.

--- Assets/Scripts/AppManager.cs
+++ Assets/Scripts/AppManager.cs
@@ -20,13 +20,18 @@
 		GameConfig.InitializePrefs();

 		// Initialize ads
+		var adsTestMode = false;
+
+		#if DEVELOPMENT_BUILD
+			adsTestMode = true;
+		#endif

 		#if UNITY_IOS
-			Advertisement.Initialize("2805293", false);
+			Advertisement.Initialize("2805293", adsTestMode);
 		#endif

 		#if UNITY_ANDROID
-			Advertisement.Initialize("2805294", false);
+			Advertisement.Initialize("2805294", adsTestMode);
 		#endif

 	}


fixed a pivot handling bug

fixed a pivot handling bug

--- Assets/Scripts/UI/GObject.cs
+++ Assets/Scripts/UI/GObject.cs
@@ -783,7 +783,7 @@
                 _pivotAsAnchor = asAnchor;
                 if (displayObject != null)
                     displayObject.pivot = new Vector2(_pivotX, _pivotY);
-                if (_pivotAsAnchor) //displayObject的轴心参考宽高与GObject的参看宽高不一样的情况下，需要调整displayObject的位置
+                if (!_pivotAsAnchor) //displayObject的轴心参考宽高与GObject的参看宽高不一样的情况下，需要调整displayObject的位置
                     HandlePositionChanged();
             }
         }


Reorganize methods to remove analyzer warning

--- test/Host.UnitTests/BootstrapperTests.cs
+++ test/Host.UnitTests/BootstrapperTests.cs
@@ -3,7 +3,6 @@
     using System;
     using System.Collections.Generic;
     using System.Linq;
-    using System.Reflection;
     using System.Threading.Tasks;
     using Crest.Abstractions;
     using Crest.Host;
@@ -22,7 +21,7 @@
         private readonly IServiceLocator serviceLocator;
         private readonly IServiceRegister serviceRegister;

-        public BootstrapperTests()
+        private BootstrapperTests()
         {
             this.discoveryService = Substitute.For<IDiscoveryService>();
             this.discoveryService.GetDiscoveredTypes()
@@ -182,9 +181,14 @@
             [Fact]
             public void ShouldRegisterRoutes()
             {
+                Task ExampleMethod()
+                {
+                    return Task.CompletedTask;
+                }
+
                 var metadata = new RouteMetadata
                 {
-                    Method = typeof(Initialize).GetMethod(nameof(ExampleMethod), BindingFlags.Instance | BindingFlags.NonPublic),
+                    Method = ((Func<Task>)ExampleMethod).Method,
                     Path = "",
                     Verb = "",
                 };
@@ -221,11 +225,6 @@
                 this.bootstrapper.Initialize();

                 this.bootstrapper.RouteMapper.Should().NotBeNull();
-            }
-
-            private Task ExampleMethod()
-            {
-                return Task.CompletedTask;
             }

             internal class CannotInject : IFakeInterface


Add support for a new hash version

Add support for a new hash version

Add support for a new hash version, the previous one was applying a
Math.Pow on iterationCount which is completely wrong. Any password
hashed previously still work fine.

--- src/Scrypt/ScryptEncoder.cs
+++ src/Scrypt/ScryptEncoder.cs
@@ -42,7 +42,7 @@
         /// Size of salt in bytes.
         /// </summary>
         private const int SaltLength = 32;
-        private const int DefaultIterationCount = 14;
+        private const int DefaultIterationCount = 16384;
         private const int DefaultBlockSize = 8;
         private const int DefaultThreadCount = 1;

@@ -76,6 +76,11 @@
         /// </summary>
         public ScryptEncoder(int iterationCount, int blockSize, int threadCount, RandomNumberGenerator saltGenerator)
         {
+            if (iterationCount < 1)
+            {
+                throw new ArgumentOutOfRangeException("iterationCount", "IterationCount must be equal or greater than 1.");
+            }
+
             if (blockSize < 1)
             {
                 throw new ArgumentOutOfRangeException("blockSize", "BlockSize must be equal or greater than 1.");
@@ -111,14 +116,20 @@
                 throw new ArgumentNullException("hashedPassword");
             }

+            int version;
             int iterationCount;
             int blockSize;
             int threadCount;
             byte[] saltBytes;

-            ExtractHeader(hashedPassword, out iterationCount, out blockSize, out threadCount, out saltBytes);
-
-            return SafeEquals(Encode(password, saltBytes, iterationCount, blockSize, threadCount), hashedPassword);
+            ExtractHeader(hashedPassword, out version, out iterationCount, out blockSize, out threadCount, out saltBytes);
+
+            if (version == 0)
+            {
+                return SafeEquals(EncodeV0(password, saltBytes, iterationCount, blockSize, threadCount), hashedPassword);
+            }
+
+            return SafeEquals(EncodeV1(password, saltBytes, iterationCount, blockSize, threadCount), hashedPassword);
         }

         /// <summary>
@@ -135,7 +146,7 @@

             _saltGenerator.GetBytes(saltBytes);

-            return Encode(password, saltBytes, _iterationCount, _blockSize, _threadCount);
+            return EncodeV1(password, saltBytes, _iterationCount, _blockSize, _threadCount);
         }

         /// <summary>
@@ -149,15 +160,30 @@
             }

             var parts = hashedPassword.Split('$');
-            return parts.Length == 5 && parts[1] == "s0";
+
+            if (parts.Length != 5)
+            {
+                return false;
+            }
+
+            if (parts[1] != "s0" && parts[1] != "s1")
+            {
+                return false;
+            }
+
+            return true;
         }

         /// <summary>
         /// Hash a password using the scrypt scheme.
-        /// </summary>
-        private static string Encode(string password, byte[] saltBytes, int iterationCount, int blockSize, int threadCount)
-        {
-            var N = (long)Math.Pow(2, iterationCount);
+        ///
+        /// This is a DEPRECATED version.
+        /// This version was applying a Math.Pow on top of iterationCount
+        /// which is completely wrong.
+        /// </summary>
+        private static string EncodeV0(string password, byte[] saltBytes, int iterationCount, int blockSize, int threadCount)
+        {
+            var N = (int)Math.Pow(2, iterationCount);
             var r = blockSize;
             var p = threadCount;

@@ -165,7 +191,7 @@

             var hashed = CryptoScrypt(passwordBytes, saltBytes, N, r, p);

-            var config = Convert.ToString(iterationCount << 16 | blockSize << 8 | threadCount, 16);
+            var config = Convert.ToString(iterationCount << 16 | r << 8 | p, 16);

             var sb = new StringBuilder();

@@ -177,9 +203,38 @@
         }

         /// <summary>
+        /// Hash a password using the scrypt scheme.
+        /// </summary>
+        private static string EncodeV1(string password, byte[] saltBytes, int iterationCount, int blockSize, int threadCount)
+        {
+            var N = iterationCount;
+            var r = blockSize;
+            var p = threadCount;
+
+            if (N <= 1 || (N & (N - 1)) != 0)
+            {
+                throw new ArgumentException("iterationCount must be a power of two greater than 1", "iterationCount");
+            }
+
+            var passwordBytes = Encoding.UTF8.GetBytes(password);
+
+            var hashed = CryptoScrypt(passwordBytes, saltBytes, N, r, p);
+
+            var config = Convert.ToString(N << 16 | r << 8 | p, 16);
+
+            var sb = new StringBuilder();
+
+            sb.Append("$s1$").Append(config).Append('$');
+            sb.Append(Convert.ToBase64String(saltBytes)).Append('$');
+            sb.Append(Convert.ToBase64String(hashed));
+
+            return sb.ToString();
+        }
+
+        /// <summary>
         /// Extracts header from a hashed password.
         /// </summary>
-        private void ExtractHeader(string hashedPassword, out int iterationCount, out int blockSize, out int threadCount, out byte[] saltBytes)
+        private void ExtractHeader(string hashedPassword, out int version, out int iterationCount, out int blockSize, out int threadCount, out byte[] saltBytes)
         {
             if (!IsValid(hashedPassword))
             {
@@ -190,6 +245,7 @@

             var config = Convert.ToInt64(parts[2], 16);

+            version = parts[1][1] == '1' ? 1 : 0;
             iterationCount = (int)config >> 16 & 0xffff;
             blockSize = (int)config >> 8 & 0xff;
             threadCount = (int)config & 0xff;
@@ -417,7 +473,7 @@
         /// power of 2 greater than 1.  The arrays B, V, and XY must be aligned to a
         /// multiple of 64 bytes.
         /// </summary>
-        private unsafe static void SMix(byte* B, int r, long N, uint* V, uint* XY)
+        private unsafe static void SMix(byte* B, int r, int N, uint* V, uint* XY)
         {
             var X = XY;
             var Y = &XY[32 * r];
@@ -446,10 +502,10 @@
             }

             /* 6: for i = 0 to N - 1 do */
-            for (long i = 0, j = 0; i < N; i += 2)
+            for (var i = 0; i < N; i += 2)
             {
                 /* 7: j <-- Integerify(X) mod N */
-                j = Integerify(X, r) & (N - 1);
+                var j = Integerify(X, r) & (N - 1);

                 /* 8: X <-- H(X \xor V_j) */
                 BulkXor(X, &V[j * (32 * r)], 128 * r);
@@ -473,7 +529,7 @@
         /// <summary>
         /// Compute and returns the result.
         /// </summary>
-        private unsafe static byte[] CryptoScrypt(byte[] password, byte[] salt, long N, int r, int p)
+        private unsafe static byte[] CryptoScrypt(byte[] password, byte[] salt, int N, int r, int p)
         {
             var Ba = new byte[128 * r * p + 63];
             var XYa = new byte[256 * r + 63];
@@ -564,7 +620,7 @@
             }
 #endif
         }
-
+
         /// <summary>
         /// Checks if two strings are equal. Compares every char to prevent timing attacks.
         /// </summary>
@@ -573,17 +629,19 @@
         /// <returns>True if both strings are equal</returns>
         private static bool SafeEquals(string a, string b)
         {
-            if (a.Length != b.Length) {
+            if (a.Length != b.Length)
+            {
                 return false;
             }
             uint diff = 0;
-
-            for (int i = 0; i < a.Length; i++) {
+
+            for (int i = 0; i < a.Length; i++)
+            {
                 diff |= (uint)a[i] ^ (uint)b[i];
             }
-
+
             return diff == 0;
         }
         #endregion
     }
-}
+}


Start dev of 0.7.5.*

Start dev of 0.7.5.*

--- Sharpmake.Application/Properties/AssemblyInfo.cs
+++ Sharpmake.Application/Properties/AssemblyInfo.cs
@@ -44,4 +44,4 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.7.5.0")]
+[assembly: AssemblyVersion("0.7.5.*")]


Use a UrlTokenEncode to encode the random api key into its equivalent string representation using base 64 digits, which are usable for transmission on the URL. This prevents URL encoding issues.

--- Signum.Engine.Extensions/Rest/RestApiKeyLogic.cs
+++ Signum.Engine.Extensions/Rest/RestApiKeyLogic.cs
@@ -10,6 +10,7 @@
 using System.Security.Cryptography;
 using Signum.Entities;
 using Signum.Entities.Authorization;
+using System.Web;

 namespace Signum.Engine.Rest
 {
@@ -54,7 +55,7 @@
             {
                 byte[] tokenData = new byte[32];
                 rng.GetBytes(tokenData);
-                return Convert.ToBase64String(tokenData);
+                return HttpServerUtility.UrlTokenEncode(tokenData);
             }
         }
     }