TakeEvery return value documentation; closes #139

--- MoreLinq/TakeEvery.cs
+++ MoreLinq/TakeEvery.cs
@@ -1,13 +1,13 @@
 #region License and Terms
 // MoreLINQ - Extensions to LINQ to Objects
 // Copyright (c) 2008 Jonathan Skeet. All rights reserved.
-//
+//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
-//
+//
 //     http://www.apache.org/licenses/LICENSE-2.0
-//
+//
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,11 +24,14 @@
     static partial class MoreEnumerable
     {
         /// <summary>
-        /// Returns every N-th element of a source sequence.
+        /// Returns every N-th element of a sequence.
         /// </summary>
         /// <typeparam name="TSource">Type of the source sequence</typeparam>
         /// <param name="source">Source sequence</param>
         /// <param name="step">Number of elements to bypass before returning the next element.</param>
+        /// <returns>
+        /// A sequence with every N-th element of the input sequence.
+        /// </returns>
         /// <remarks>
         /// This operator uses deferred execution and streams its results.
         /// </remarks>
@@ -39,7 +42,7 @@
         /// </code>
         /// The <c>result</c> variable, when iterated over, will yield 1, 3 and 5, in turn.
         /// </example>
-
+
         public static IEnumerable<TSource> TakeEvery<TSource>(this IEnumerable<TSource> source, int step)
         {
             if (source == null) throw new ArgumentNullException("source");


[NtTypes] Correctly compute buffer size allocated for ObjectTypesInformation (#18)

* [NtTypes] Correctly compute buffer size allocated for ObjectTypesInformation

`ntdll.NtQueryObject` is one in a long list of natives API with a pretty
funny way to use it. It takes a buffer and a buffer size, and on success
fills out the bufffer and write the written length in a return_length
parameter.

However if the buffer is not big enough, the return status is set to
STATUS_INFO_LENGTH_MISMATCH inciting the developer to embiggen the input
buffer and re-attempt the call. However return_length parameter is also
sometimes set but it should not be relied upon as long as status is not
equal to STATUS_SUCCESS.

* [NtType] Remove GetTypesSize and roll back code into LoadTypes

Since we do a pretty complicate dance in order to fill out a buffer with
ObjectTypesInformation data, we might as well do it once and use the
result right away.

The CFG of LoadTypes is clearly not simple, and moreso since we use a
'using' statement to automatically liberate local heap buffers.

* [NtType] Simplify LoadType's CFG by explicitly throwing exceptions

--- NtApiDotNet/NtType.cs
+++ NtApiDotNet/NtType.cs
@@ -652,18 +652,6 @@
             return GetTypeByType<T>(true);
         }

-        private static int GetTypeSize()
-        {
-            using (var type_info = new SafeStructureInOutBuffer<ObjectAllTypesInformation>())
-            {
-                Dictionary<string, NtType> ret = new Dictionary<string, NtType>(StringComparer.OrdinalIgnoreCase);
-                NtStatus status = NtSystemCalls.NtQueryObject(SafeKernelObjectHandle.Null, ObjectInformationClass.ObjectTypesInformation,
-                    type_info, type_info.Length, out int return_length);
-                if (status != NtStatus.STATUS_INFO_LENGTH_MISMATCH)
-                    status.ToNtException();
-                return return_length;
-            }
-        }

         /// <summary>
         /// Get a fake type object. This can be used in access checking for operations which need an NtType object
@@ -698,30 +686,55 @@
         private static Dictionary<string, NtType> LoadTypes()
         {
             var type_factories = NtTypeFactory.GetAssemblyNtTypeFactories(Assembly.GetExecutingAssembly());
-            int type_size = GetTypeSize();
             Dictionary<string, NtType> ret = new Dictionary<string, NtType>(StringComparer.OrdinalIgnoreCase);

-            using (var type_info = new SafeStructureInOutBuffer<ObjectAllTypesInformation>(type_size, true))
-            {
-                int alignment = IntPtr.Size - 1;
-                NtSystemCalls.NtQueryObject(SafeKernelObjectHandle.Null, ObjectInformationClass.ObjectTypesInformation,
-                    type_info, type_info.Length, out int return_length).ToNtException();
-                ObjectAllTypesInformation result = type_info.Result;
-                IntPtr curr_typeinfo = type_info.DangerousGetHandle() + IntPtr.Size;
-                for (int count = 0; count < result.NumberOfTypes; ++count)
+            int size = 0x8000;
+            NtStatus status = NtStatus.STATUS_INFO_LENGTH_MISMATCH;
+
+            // repeatly try to fill out ObjectTypes buffer by increasing it's size between each attempt
+            while (size < 0x1000000)
+            {
+                using (var type_info = new SafeStructureInOutBuffer<ObjectAllTypesInformation>(size, true))
                 {
-                    ObjectTypeInformation info = (ObjectTypeInformation)Marshal.PtrToStructure(curr_typeinfo, typeof(ObjectTypeInformation));
-                    string name = info.Name.ToString();
-                    NtTypeFactory factory = type_factories.ContainsKey(name) ? type_factories[name] : _generic_factory;
-                    NtType ti = new NtType(count + 2, info, factory);
-                    ret[ti.Name] = ti;
-
-                    int offset = (info.Name.MaximumLength + alignment) & ~alignment;
-                    curr_typeinfo = info.Name.Buffer + offset;
-                }
-
-                return ret;
-            }
+                    status = NtSystemCalls.NtQueryObject(SafeKernelObjectHandle.Null, ObjectInformationClass.ObjectTypesInformation,
+                        type_info, type_info.Length, out int return_length);
+
+                    switch (status)
+                    {
+                        // if the input buffer is too small, double it's size and retry
+                        case NtStatus.STATUS_INFO_LENGTH_MISMATCH:
+                            size *= 2;
+                            break;
+
+                        // From this point, the return values of NtSystemCalls.NtQueryObject are considered correct
+                        case NtStatus.STATUS_SUCCESS:
+
+                            int alignment = IntPtr.Size - 1;
+                            ObjectAllTypesInformation result = type_info.Result;
+                            IntPtr curr_typeinfo = type_info.DangerousGetHandle() + IntPtr.Size;
+
+                            for (int count = 0; count < result.NumberOfTypes; ++count)
+                            {
+                                ObjectTypeInformation info = (ObjectTypeInformation)Marshal.PtrToStructure(curr_typeinfo, typeof(ObjectTypeInformation));
+                                string name = info.Name.ToString();
+                                NtTypeFactory factory = type_factories.ContainsKey(name) ? type_factories[name] : _generic_factory;
+                                NtType ti = new NtType(count + 2, info, factory);
+                                ret[ti.Name] = ti;
+
+                                int offset = (info.Name.MaximumLength + alignment) & ~alignment;
+                                curr_typeinfo = info.Name.Buffer + offset;
+                            }
+
+                            return ret;
+
+                        default:
+                            throw new NtException(status);
+                    }
+                }
+            }
+
+            // raise exception if the candidate buffer is over a MB.
+            throw new NtException(NtStatus.STATUS_INSUFFICIENT_RESOURCES);
         }

         /// <summary>


Visual Studio compatible error reporting.

--- Properties/Program.cs
+++ Properties/Program.cs
@@ -47,7 +47,7 @@

                 if (!directory.Exists)
                 {
-                    Error("The directory name is invalid.");
+                    Error(directory, "Directory name is invalid.");
                     Environment.Exit(1);
                 }

@@ -81,34 +81,34 @@

                 if (HasError)
                 {
-                    Warning("Aborting.");
+                    Console.WriteLine("Aborting.");
                 }
                 else
                 {
-                    Warning("Uploading...");
+                    Console.WriteLine("Uploading...");
                     var res = await store.Client.Documents.BulkAsync(bulk);
                     if (res.IsSuccess)
                     {
                         foreach (var row in res.Rows)
                         {
                             if (row.Succeeded) continue;
-                            Error("{0}: {1}", row.Id, row.Reason);
+                            Error(row.Id + ": " + row.Reason);
                         }
                     }
                     else
                     {
                         Error(res.Reason);
                     }
-                    Warning("Done!");
+                    Console.WriteLine("Done!");
                 }
             }
             catch (AggregateException e)
             {
-                foreach (var ie in e.InnerExceptions) Error(ie.Message);
-            }
-            catch (Exception e)
-            {
-                Error(e.Message);
+                foreach (var ie in e.InnerExceptions) Error(ie);
+            }
+            catch (Exception e)
+            {
+                Error(e);
             }
             finally
             {
@@ -173,7 +173,7 @@
         {
             var root = directory;
             if (root.Name == "_design") return;
-
+
             var docs = new Dictionary<string, JObject>();

             foreach (var file in root.EnumerateFiles("*.json"))
@@ -219,11 +219,11 @@

                     return doc;
                 }
-                Error("{0}: Document must be an object.", GetRelativePath(file));
-            }
-            catch (Exception e)
-            {
-                Error("{0}: {1}", GetRelativePath(file), e.Message);
+                Error(file, "Document must be an object literal.");
+            }
+            catch (Exception e)
+            {
+                Error(file, e);
             }
             return new JObject();
         }
@@ -278,7 +278,7 @@
             }
             catch (Exception e)
             {
-                Error("{0}: {1}", GetRelativePath(directory), e.Message);
+                Error(directory, e);
             }
             return result;
         }
@@ -305,7 +305,7 @@
             }
             catch (Exception e)
             {
-                Error("{0}: {1}", GetRelativePath(directory), e.Message);
+                Error(directory, e);
             }
             return result;
         }
@@ -315,7 +315,6 @@
         /// </summary>
         static string ParseJavaScript(FileInfo file)
         {
-            var path = GetRelativePath(file);
             try
             {
                 var code = File.ReadAllText(file.FullName);
@@ -340,13 +339,13 @@
                 }

                 parser.CompilerError += CompilerError;
-                parser.Parse(new DocumentContext(code) { FileContext = path });
+                parser.Parse(new DocumentContext(code) { FileContext = GetRelativePath(file) });

                 if (!HasError) return code.Replace(Environment.NewLine, "\n");
             }
             catch (Exception e)
             {
-                Error("{0}: {1}", path, e.Message);
+                Error(file, e);
             }
             return string.Empty;
         }
@@ -356,7 +355,6 @@
         /// </summary>
         static JToken ParseJson(FileInfo file)
         {
-            var path = GetRelativePath(file);
             try
             {
                 var json = File.ReadAllText(file.FullName);
@@ -365,8 +363,8 @@
                 settings.MinifyCode = false;
                 settings.Format = JavaScriptFormat.JSON;
                 settings.SourceMode = JavaScriptSourceMode.Expression;
-
-                var minifier = new Minifier { FileName = path };
+
+                var minifier = new Minifier { FileName = GetRelativePath(file) };
                 json = minifier.MinifyJavaScript(json, settings);
                 minifier.ErrorList.ForEach(CompilerError);

@@ -374,9 +372,9 @@
             }
             catch (Exception e)
             {
-                Error("{0}: {1}", path, e.Message);
-            }
-            return JValue.CreateNull();
+                Error(file, e);
+            }
+            return new JObject();
         }

         /// <summary>
@@ -384,7 +382,6 @@
         /// </summary>
         static string ParseText(FileInfo file)
         {
-            var path = GetRelativePath(file);
             try
             {
                 var text = File.ReadAllText(file.FullName);
@@ -394,11 +391,11 @@
                     return text.Replace(Environment.NewLine, "\n");
                 }

-                Error("{0}: Binary file found.", path);
-            }
-            catch (Exception e)
-            {
-                Error("{0}: {1}", path, e.Message);
+                Error(file, "Binary file found.");
+            }
+            catch (Exception e)
+            {
+                Error(file, e);
             }
             return string.Empty;
         }
@@ -409,30 +406,37 @@
             return Uri.UnescapeDataString(baseUri.MakeRelativeUri(new Uri(info.FullName)).ToString());
         }

+        #region Error Handling
+
         static bool HasError { get { return Environment.ExitCode != 0; } }

+        static void Error(Exception exception)
+        {
+            Error(exception.Message.Replace(Environment.NewLine, " "));
+        }
+
+        static void Error(FileSystemInfo info, Exception exception)
+        {
+            Error(info, exception.Message.Replace(Environment.NewLine, " "));
+        }
+
+        static void Error(FileSystemInfo info, string message)
+        {
+            Error(GetRelativePath(info), message);
+        }
+
+        static void Error(string origin, string message)
+        {
+            Console.Error.WriteLine(origin + ": error: " + message);
+            Environment.ExitCode = 1;
+        }
+
         static void Error(string message)
         {
-            Console.Error.WriteLine(message);
+            Console.Error.WriteLine("Fatal error: " + message);
             Environment.ExitCode = 1;
         }

-        static void Error(string format, params object[] args)
-        {
-            Console.Error.WriteLine(format, args);
-            Environment.ExitCode = 1;
-        }
-
-        static void Warning(string message)
-        {
-            Console.WriteLine(message);
-        }
-
-        static void Warning(string format, params object[] args)
-        {
-            Console.WriteLine(format, args);
-        }
-
         static void CompilerError(object sender, ContextErrorEventArgs e)
         {
             CompilerError(e.Error);
@@ -442,13 +446,16 @@
         {
             if (error.IsError)
             {
-                Error("{0}", error);
+                Console.Error.WriteLine(error);
+                Environment.ExitCode = 1;
             }
             else
             {
-                Warning("{0}", error);
-            }
-        }
+                Console.WriteLine(error);
+            }
+        }
+
+        #endregion

         class AllDocsValue
         {


Skip RealmResults creation and create handle directly.

--- Realm.Shared/Realm.cs
+++ Realm.Shared/Realm.cs
@@ -597,9 +597,7 @@

             foreach (var objectClass in objectClasses)
             {
-                var parameterizedType = realmResultsType.MakeGenericType(objectClass);
-                var all = Activator.CreateInstance(parameterizedType, this, true);
-                var resultsHandle = (ResultsHandle)objectClass.GetProperty("ResultsHandle").GetValue(all);
+                var resultsHandle = MakeResultsForTable(objectClass);
                 NativeResults.clear(resultsHandle);
             }
         }


starting the subreddit class

starting the subreddit class

--- RedditWP/Subreddit.cs
+++ RedditWP/Subreddit.cs
@@ -3,10 +3,134 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;

 namespace RedditWP
 {
-    public class Subreddit
+    public class Subreddit : Thing
     {
+        private const string SubredditPostUrl = "/r/{0}.json";
+        private const string SubredditNewUrl = "/r/{0}/new.json?sort=new";
+        private const string SubscribeUrl = "/api/subscribe";
+        private const string GetSettingsUrl = "/r/{0}/about/edit.json";
+        private const string GetReducedSettingsUrl = "/r/{0}/about.json";
+        private const string ModqueueUrl = "/r/{0}/about/modqueue.json";
+        private const string UnmoderatedUrl = "/r/{0}/about/unmoderated.json";
+        private const string FlairTemplateUrl = "/api/flairtemplate";
+        private const string ClearFlairTemplatesUrl = "/api/clearflairtemplates";
+        private const string SetUserFlairUrl = "/api/flair";
+        private const string StylesheetUrl = "/r/{0}/about/stylesheet.json";
+        private const string UploadImageUrl = "/api/upload_sr_img";
+        private const string FlairSelectorUrl = "/api/flairselector";
+        private const string AcceptModeratorInviteUrl = "/api/accept_moderator_invite";
+        private const string LeaveModerationUrl = "/api/unfriend";
+        private const string FrontPageUrl = "/.json";
+        private const string SubmitLinkUrl = "/api/submit";
+
+        [JsonIgnore]
+        private Reddit Reddit { get; set; }
+
+        [JsonProperty("created")]
+        [JsonConverter(typeof(UnixTimestampConverter))]
+        public DateTime? Created { get; set; }
+        [JsonProperty("description")]
+        public string Description { get; set; }
+        [JsonProperty("description_html")]
+        public string DescriptionHTML { get; set; }
+        [JsonProperty("display_name")]
+        public string DisplayName { get; set; }
+        [JsonProperty("header_img")]
+        public string HeaderImage { get; set; }
+        [JsonProperty("header_title")]
+        public string HeaderTitle { get; set; }
+        [JsonProperty("over18")]
+        public bool? NSFW { get; set; }
+        [JsonProperty("public_description")]
+        public string PublicDescription { get; set; }
+        [JsonProperty("subscribers")]
+        public int? Subscribers { get; set; }
+        [JsonProperty("accounts_active")]
+        public int? ActiveUsers { get; set; }
+        [JsonProperty("title")]
+        public string Title { get; set; }
+        [JsonProperty("url")]
+        public string Url { get; set; }
+        [JsonIgnore]
+        public string Name { get; set; }
+
+        /// <summary>
+        /// This constructor only exists for internal use and serialization.
+        /// You would be wise not to use it.
+        /// </summary>
+        public Subreddit()
+            : base(null)
+        {
+        }
+
+        protected internal Subreddit(Reddit reddit, JToken json)
+            : base(json)
+        {
+            Reddit = reddit;
+            JsonConvert.PopulateObject(json["data"].ToString(), this, reddit.JsonSerializerSettings);
+            Name = Url;
+            if (Name.StartsWith("/r/"))
+                Name = Name.Substring(3);
+            if (Name.StartsWith("r/"))
+                Name = Name.Substring(2);
+            Name = Name.TrimEnd('/');
+        }
+
+        public static Subreddit GetRSlashAll(Reddit reddit)
+        {
+            var rSlashAll = new Subreddit
+            {
+                DisplayName = "/r/all",
+                Title = "/r/all",
+                Url = "/r/all",
+                Name = "all",
+                Reddit = reddit
+            };
+            return rSlashAll;
+        }
+
+        public static Subreddit GetFrontPage(Reddit reddit)
+        {
+            var frontPage = new Subreddit
+            {
+                DisplayName = "Front Page",
+                Title = "reddit: the front page of the internet",
+                Url = "/",
+                Name = "/",
+                Reddit = reddit
+            };
+            return frontPage;
+        }
+
+        public Listing<Post> GetPosts()
+        {
+            if (Name == "/")
+                return new Listing<Post>(Reddit, "/.json");
+            return new Listing<Post>(Reddit, string.Format(SubredditPostUrl, Name));
+        }
+
+        public Listing<Post> GetNew()
+        {
+            if (Name == "/")
+                return new Listing<Post>(Reddit, "/new.json");
+            return new Listing<Post>(Reddit, string.Format(SubredditNewUrl, Name));
+        }
+
+        public Listing<VotableThing> GetModQueue()
+        {
+            return new Listing<VotableThing>(Reddit, string.Format(ModqueueUrl, Name));
+        }
+
+        public Listing<Post> GetUnmoderatedLinks()
+        {
+            return new Listing<Post>(Reddit, string.Format(UnmoderatedUrl, Name));
+        }
+
+
     }
 }


Palette selector can now influence index tiles

--- Riverback/MainForm.cs
+++ Riverback/MainForm.cs
@@ -374,7 +374,7 @@
         {
             if (isLevelLoaded) {
                 bankPaletteNum = (byte)(levelEditor.Level.PaletteIndex[(int)numericUpDown_tilePalette.Value] - 1);
-                updateImages(false, true, true, false, false, false);
+                updateImages(false, true, true, false, false, true);
             }
         }

@@ -888,8 +888,9 @@
             if (tileIndexNum >= tileAmount)
                 i = 1;
             int tileNum = tileIndexNum - (i * tileAmount);
-
-            Bitmap tileImg = levelEditor.Banks[bankIndex].getTileImage(tileNum, 15, TileDrawer.TILE_WIDTH);
+
+            byte bankPaletteNumber = (byte)(levelEditor.Level.PaletteIndex[(int)numericUpDown_tilePalette.Value] - 1);
+            Bitmap tileImg = levelEditor.Banks[bankIndex].getTileImage(tileNum, bankPaletteNumber, TileDrawer.TILE_WIDTH);
             Point mouseCoords = coordConverterTileIndex.getMouseCoordsFromTileNumber(tileNum);
             TileDrawer.clearTileOnCanvas(g, fillBrush, mouseCoords.X, mouseCoords.Y + (i * 1024), TILEMAP_SCALE);
             TileDrawer.drawTileOnCanvas(tileImg, g, mouseCoords.X, mouseCoords.Y + (i * 1024), false, false, TILEMAP_SCALE);


Improved dateTime parsing on different culture systems

--- RohlikAPI/Products.cs
+++ RohlikAPI/Products.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Net.Http;
 using System.Text.RegularExpressions;
@@ -103,7 +104,15 @@
             var dateTimeString = dateTimeNode.InnerText;
             dateTimeString = dateTimeString.Replace("Do", "");
             dateTimeString = Regex.Replace(dateTimeString, @"\s", "");
-            return DateTime.Parse(dateTimeString);
+            try
+            {
+                var dateTime = DateTime.Parse(dateTimeString, CultureInfo.CurrentCulture);
+                return dateTime;
+            }
+            catch (FormatException ex)
+            {
+                throw new FormatException($"Failed to parse datetime string: {dateTimeString}. Culture was {CultureInfo.CurrentCulture}. Ex: {ex}");
+            }
         }

         private string GetAllProductsString(string category)


Row height exception for GroupBox Gui controls.

--- Rusty/Core/Gui/Gui.cs
+++ Rusty/Core/Gui/Gui.cs
@@ -1349,7 +1349,14 @@
                                 if (int.TryParse(arg, out n))
                                 {
                                     if (control.Parent != null && control.Parent.Font != null)
-                                        control.Size = new Size(control.Size.Width, (int)(n * control.Parent.Font.GetHeight()));
+                                    {
+                                        var h = (int)(n * control.Parent.Font.GetHeight());
+
+                                        if (control is GroupBox)
+                                            h += control.ClientSize.Height;
+
+                                        control.Size = new Size(control.Size.Width, h);
+                                    }
                                 }
                                 else
                                     append = true;


Updated Helpers

Updated Helpers

--- Shared/jobHelpers.csx
+++ Shared/jobHelpers.csx
@@ -36,7 +36,7 @@
         }
         else
         {
-            presetPath = Path.Combine(homePath, @"site\repository\media-functions-for-logic-app\presets\" + presetfilename);
+            presetPath = Path.Combine(homePath, @"site\repository\azurefunctions\Presets\" + presetfilename);
         }

         string Configuration = File.ReadAllText(presetPath).Replace(stringtoreplace, value);


Increment patch -> 0.8.1

Increment patch -> 0.8.1

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -2,6 +2,6 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;

-[assembly: AssemblyVersion("0.8.0.0")]
-[assembly: AssemblyFileVersion("0.8.0.0")]
-[assembly: AssemblyInformationalVersion("0.8.0")]
+[assembly: AssemblyVersion("0.8.1.0")]
+[assembly: AssemblyFileVersion("0.8.1.0")]
+[assembly: AssemblyInformationalVersion("0.8.1")]


Publishing ${project_name} 2.6.4.2

Publishing ${project_name} 2.6.4.2

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -25,5 +25,5 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("2.6.4.1")]
-[assembly: AssemblyFileVersion("2.6.4.1")]
+[assembly: AssemblyVersion("2.6.4.2")]
+[assembly: AssemblyFileVersion("2.6.4.2")]


Fix the test for type deriving from IList<string> in the resolver: typeof(IList<string>).Name doesn't contain the templated type, so we would enter the ifs with any IList.

--- Sharpmake/Resolver.cs
+++ Sharpmake/Resolver.cs
@@ -511,18 +511,15 @@
                             SetResolved(memberPath);
                         }
                     }
-                    else if (fieldInfo.FieldType.GetInterface(typeof(IList<string>).Name) != null)
+                    else if (fieldValue is IList<string>)
                     {
                         if (CanWriteFieldValue(fieldInfo))
                         {
                             SetResolving(memberPath);
                             IList<string> values = fieldValue as IList<string>;

-                            if (values != null)
-                            {
-                                for (int i = 0; i < values.Count; ++i)
-                                    values[i] = Resolve(values[i], fallbackValue);
-                            }
+                            for (int i = 0; i < values.Count; ++i)
+                                values[i] = Resolve(values[i], fallbackValue);

                             SetResolved(memberPath);
                         }
@@ -566,16 +563,14 @@

                             SetResolved(memberPath);
                         }
-                        else if (propertyInfo.PropertyType.GetInterface(typeof(IList<string>).Name) != null)
+                        else if (propertyValue is IList<string>)
                         {
                             SetResolving(memberPath);
                             IList<string> values = propertyValue as IList<string>;

-                            if (values != null)
-                            {
-                                for (int i = 0; i < values.Count; ++i)
-                                    values[i] = Resolve(values[i], fallbackValue);
-                            }
+                            for (int i = 0; i < values.Count; ++i)
+                                values[i] = Resolve(values[i], fallbackValue);
+
                             SetResolved(memberPath);
                         }
                         else if (propertyInfo.PropertyType.IsClass)


Expose GenerateFastBuildAllOnlyForConfThatNeedIt as a property of the Solution

--- Sharpmake/Solution.cs
+++ Sharpmake/Solution.cs
@@ -51,6 +51,12 @@
         public bool FastBuildAllSlnDependencyFromExe = false;

         /// <summary>
+        /// In case we've generated a "FastBuildAll" project, this flag will determine if we generate it for all
+        /// the configurations, or only the ones that need it
+        /// </summary>
+        public bool GenerateFastBuildAllOnlyForConfThatNeedIt = true;
+
+        /// <summary>
         /// For adding additional files/folders to the solution
         /// Keys are names of the directories in the virtual solution hierarchy, values are paths
         /// </summary>
@@ -460,7 +466,6 @@

         private bool _resolved = false;
         private bool _dependenciesResolved = false;
-        private bool _generateFastBuildAllOnlyForConfThatNeedIt = true;

         private void Initialize(Type targetType, Type configurationType)
         {
@@ -527,7 +532,7 @@
                     var solutionConf = projectsToBuildInSolutionConfig.Item1;
                     var projectConfigsToBuild = projectsToBuildInSolutionConfig.Item2;

-                    if (_generateFastBuildAllOnlyForConfThatNeedIt && projectConfigsToBuild.Count == 1)
+                    if (GenerateFastBuildAllOnlyForConfThatNeedIt && projectConfigsToBuild.Count == 1)
                         continue;

                     var solutionTarget = solutionConf.Target;
@@ -563,7 +568,7 @@
                     var solutionConf = projectsToBuildInSolutionConfig.Item1;
                     var projectConfigsToBuild = projectsToBuildInSolutionConfig.Item2;

-                    if (_generateFastBuildAllOnlyForConfThatNeedIt && projectConfigsToBuild.Count == 1)
+                    if (GenerateFastBuildAllOnlyForConfThatNeedIt && projectConfigsToBuild.Count == 1)
                         continue;

                     var solutionTarget = solutionConf.Target;


Review and refactor #6

Review and refactor #6

--- SikuliSharp/Sikuli.cs
+++ SikuliSharp/Sikuli.cs
@@ -20,34 +20,23 @@

 		public static string RunProject(string projectPath)
 		{
+			return RunProject(projectPath, null);
+		}
+
+		public static string RunProject(string projectPath, string args)
+		{
 			if (projectPath == null) throw new ArgumentNullException("projectPath");

-			if(!Directory.Exists(projectPath))
+			if (!Directory.Exists(projectPath))
 				throw new DirectoryNotFoundException(string.Format("Project not found in path '{0}'", projectPath));

 			var processFactory = new SikuliScriptProcessFactory();
-			using (var process = processFactory.Start(string.Format("-r {0}", projectPath)))
+			using (var process = processFactory.Start(string.Format("-r {0} {1}", projectPath, args)))
 			{
 				var output = process.StandardOutput.ReadToEnd();
 				process.WaitForExit();
 				return output;
 			}
 		}
-
-        public static string RunProject(string projectPath, string args)
-        {
-            if (projectPath == null) throw new ArgumentNullException("projectPath");
-
-            if (!Directory.Exists(projectPath))
-                throw new DirectoryNotFoundException(string.Format("Project not found in path '{0}'", projectPath));
-
-            var processFactory = new SikuliScriptProcessFactory();
-            using (var process = processFactory.Start(string.Format("-r {0} {1}", projectPath, args)))
-            {
-                var output = process.StandardOutput.ReadToEnd();
-                process.WaitForExit();
-                return output;
-            }
-        }
-    }
+	}
 }


simql

simql

--- SimQL/SimQLProgram.cs
+++ SimQL/SimQLProgram.cs
@@ -46,10 +46,6 @@
 		            else
 		            {
                         valueResult = tempResult[queryParam].Value<string>();
-		                if (queryParam.Equals("x"))
-		                {
-		                    throw new Exception("3.14".Equals(valueResult).ToString());
-		                }
                     }


Update AlienEmpire.cs

Update AlienEmpire.cs

--- Source/AlienEmpire.cs
+++ Source/AlienEmpire.cs
@@ -25,6 +25,7 @@

             public void Tick(float deltaTime)
             {
+                //see if the system works, press K to spawn a new randomly placed fleet.
                 if(Input.GetKeyUp(KeyCode.K))
                 {
                     AlienFleet newFleet = new AlienFleet();


Convert to CLRF

Convert to CLRF

--- SteamAuth/SteamWeb.cs
+++ SteamAuth/SteamWeb.cs
@@ -1,137 +1,137 @@
-using System;
-using System.Collections.Specialized;
-using System.IO;
-using System.Net;
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Net;
 using System.Threading.Tasks;

-namespace SteamAuth
-{
-    public class SteamWeb
-    {
-        /// <summary>
-        /// Perform a mobile login request
-        /// </summary>
-        /// <param name="url">API url</param>
-        /// <param name="method">GET or POST</param>
-        /// <param name="data">Name-data pairs</param>
-        /// <param name="cookies">current cookie container</param>
-        /// <returns>response body</returns>
-        public static string MobileLoginRequest(string url, string method, NameValueCollection data = null, CookieContainer cookies = null, NameValueCollection headers = null)
-        {
-            return Request(url, method, data, cookies, headers, APIEndpoints.COMMUNITY_BASE + "/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client");
-        }
-
-        public static string Request(string url, string method, NameValueCollection data = null, CookieContainer cookies = null, NameValueCollection headers = null, string referer = APIEndpoints.COMMUNITY_BASE)
-        {
-            string query = (data == null ? string.Empty : string.Join("&", Array.ConvertAll(data.AllKeys, key => String.Format("{0}={1}", WebUtility.UrlEncode(key), WebUtility.UrlEncode(data[key])))));
-            if (method == "GET")
-            {
-                url += (url.Contains("?") ? "&" : "?") + query;
-            }
-
-            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
-            request.Method = method;
-            request.Accept = "text/javascript, text/html, application/xml, text/xml, */*";
-            request.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Google Nexus 4 - 4.1.1 - API 16 - 768x1280 Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
-            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
-            request.Referer = referer;
-
-            if (headers != null)
-            {
-                request.Headers.Add(headers);
-            }
-
-            if (cookies != null)
-            {
-                request.CookieContainer = cookies;
-            }
-
-            if (method == "POST")
-            {
-                request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
-                request.ContentLength = query.Length;
-
-                StreamWriter requestStream = new StreamWriter(request.GetRequestStream());
-                requestStream.Write(query);
-                requestStream.Close();
-            }
-
-            try
-            {
-                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
-                {
-                    if (response.StatusCode != HttpStatusCode.OK)
-                    {
-                        return null;
-                    }
-
-                    using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
-                    {
-                        string responseData = responseStream.ReadToEnd();
-                        return responseData;
-                    }
-                }
-            }
-            catch (WebException)
-            {
-                return null;
-            }
-        }
-
-        public static async Task<string> RequestAsync(string url, string method, NameValueCollection data = null, CookieContainer cookies = null, NameValueCollection headers = null, string referer = APIEndpoints.COMMUNITY_BASE)
-        {
-            string query = (data == null ? string.Empty : string.Join("&", Array.ConvertAll(data.AllKeys, key => String.Format("{0}={1}", WebUtility.UrlEncode(key), WebUtility.UrlEncode(data[key])))));
-            if (method == "GET")
-            {
-                url += (url.Contains("?") ? "&" : "?") + query;
-            }
-
-            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
-            request.Method = method;
-            request.Accept = "text/javascript, text/html, application/xml, text/xml, */*";
-            request.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Google Nexus 4 - 4.1.1 - API 16 - 768x1280 Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
-            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
-            request.Referer = referer;
-
-            if (headers != null)
-            {
-                request.Headers.Add(headers);
-            }
-
-            if (cookies != null)
-            {
-                request.CookieContainer = cookies;
-            }
-
-            if (method == "POST")
-            {
-                request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
-                request.ContentLength = query.Length;
-
-                StreamWriter requestStream = new StreamWriter(request.GetRequestStream());
-                requestStream.Write(query);
-                requestStream.Close();
-            }
-
-            try
-            {
+namespace SteamAuth
+{
+    public class SteamWeb
+    {
+        /// <summary>
+        /// Perform a mobile login request
+        /// </summary>
+        /// <param name="url">API url</param>
+        /// <param name="method">GET or POST</param>
+        /// <param name="data">Name-data pairs</param>
+        /// <param name="cookies">current cookie container</param>
+        /// <returns>response body</returns>
+        public static string MobileLoginRequest(string url, string method, NameValueCollection data = null, CookieContainer cookies = null, NameValueCollection headers = null)
+        {
+            return Request(url, method, data, cookies, headers, APIEndpoints.COMMUNITY_BASE + "/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client");
+        }
+
+        public static string Request(string url, string method, NameValueCollection data = null, CookieContainer cookies = null, NameValueCollection headers = null, string referer = APIEndpoints.COMMUNITY_BASE)
+        {
+            string query = (data == null ? string.Empty : string.Join("&", Array.ConvertAll(data.AllKeys, key => String.Format("{0}={1}", WebUtility.UrlEncode(key), WebUtility.UrlEncode(data[key])))));
+            if (method == "GET")
+            {
+                url += (url.Contains("?") ? "&" : "?") + query;
+            }
+
+            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+            request.Method = method;
+            request.Accept = "text/javascript, text/html, application/xml, text/xml, */*";
+            request.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Google Nexus 4 - 4.1.1 - API 16 - 768x1280 Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
+            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
+            request.Referer = referer;
+
+            if (headers != null)
+            {
+                request.Headers.Add(headers);
+            }
+
+            if (cookies != null)
+            {
+                request.CookieContainer = cookies;
+            }
+
+            if (method == "POST")
+            {
+                request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
+                request.ContentLength = query.Length;
+
+                StreamWriter requestStream = new StreamWriter(request.GetRequestStream());
+                requestStream.Write(query);
+                requestStream.Close();
+            }
+
+            try
+            {
+                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
+                {
+                    if (response.StatusCode != HttpStatusCode.OK)
+                    {
+                        return null;
+                    }
+
+                    using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
+                    {
+                        string responseData = responseStream.ReadToEnd();
+                        return responseData;
+                    }
+                }
+            }
+            catch (WebException)
+            {
+                return null;
+            }
+        }
+
+        public static async Task<string> RequestAsync(string url, string method, NameValueCollection data = null, CookieContainer cookies = null, NameValueCollection headers = null, string referer = APIEndpoints.COMMUNITY_BASE)
+        {
+            string query = (data == null ? string.Empty : string.Join("&", Array.ConvertAll(data.AllKeys, key => String.Format("{0}={1}", WebUtility.UrlEncode(key), WebUtility.UrlEncode(data[key])))));
+            if (method == "GET")
+            {
+                url += (url.Contains("?") ? "&" : "?") + query;
+            }
+
+            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+            request.Method = method;
+            request.Accept = "text/javascript, text/html, application/xml, text/xml, */*";
+            request.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Google Nexus 4 - 4.1.1 - API 16 - 768x1280 Build/JRO03S) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
+            request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
+            request.Referer = referer;
+
+            if (headers != null)
+            {
+                request.Headers.Add(headers);
+            }
+
+            if (cookies != null)
+            {
+                request.CookieContainer = cookies;
+            }
+
+            if (method == "POST")
+            {
+                request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
+                request.ContentLength = query.Length;
+
+                StreamWriter requestStream = new StreamWriter(request.GetRequestStream());
+                requestStream.Write(query);
+                requestStream.Close();
+            }
+
+            try
+            {
                 HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync();

-                if (response.StatusCode != HttpStatusCode.OK)
-                {
-                    return null;
-                }
-
-                using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
-                {
-                    string responseData = responseStream.ReadToEnd();
-                    return responseData;
-                }
-            }
-            catch (WebException)
-            {
-                return null;
-            }
-        }
-    }
-}
+                if (response.StatusCode != HttpStatusCode.OK)
+                {
+                    return null;
+                }
+
+                using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
+                {
+                    string responseData = responseStream.ReadToEnd();
+                    return responseData;
+                }
+            }
+            catch (WebException)
+            {
+                return null;
+            }
+        }
+    }
+}


Added Purge verb to Tapeti.Cmd

Added Purge verb to Tapeti.Cmd

--- Tapeti.Cmd/Program.cs
+++ Tapeti.Cmd/Program.cs
@@ -120,6 +120,17 @@
         }

+        [Verb("purge", HelpText = "Removes all messages from a queue destructively.")]
+        public class PurgeOptions : CommonOptions
+        {
+            [Option('q', "queue", Required = true, HelpText = "The queue to purge.")]
+            public string QueueName { get; set; }
+
+            [Option("confirm", HelpText = "Confirms the purging of the specified queue. If not provided, an interactive prompt will ask for confirmation.", Default = false)]
+            public bool Confirm { get; set; }
+        }
+
+
         [Verb("example", HelpText = "Output an example SingleFileJSON formatted message.")]
         public class ExampleOptions
         {
@@ -129,11 +140,12 @@

         public static int Main(string[] args)
         {
-            return Parser.Default.ParseArguments<ExportOptions, ImportOptions, ShovelOptions, ExampleOptions>(args)
+            return Parser.Default.ParseArguments<ExportOptions, ImportOptions, ShovelOptions, PurgeOptions, ExampleOptions>(args)
                 .MapResult(
                     (ExportOptions o) => ExecuteVerb(o, RunExport),
                     (ImportOptions o) => ExecuteVerb(o, RunImport),
                     (ShovelOptions o) => ExecuteVerb(o, RunShovel),
+                    (PurgeOptions o) => ExecuteVerb(o, RunPurge),
                     (ExampleOptions o) => ExecuteVerb(o, RunExample),
                     errs =>
                     {
@@ -368,6 +380,30 @@
             };

             return factory.CreateConnection();
+        }
+
+
+        private static void RunPurge(PurgeOptions options)
+        {
+            if (!options.Confirm)
+            {
+                Console.Write($"Do you want to purge the queue '{options.QueueName}'? (Y/N) ");
+                var answer = Console.ReadLine();
+
+                if (string.IsNullOrEmpty(answer) || !answer.Equals("Y", StringComparison.CurrentCultureIgnoreCase))
+                    return;
+            }
+
+            uint messageCount;
+
+            using (var connection = GetConnection(options))
+            using (var channel = connection.CreateModel())
+            {
+                messageCount = channel.QueuePurge(options.QueueName);
+            }
+
+            Console.WriteLine($"{messageCount} message{(messageCount != 1 ? "s" : "")} purged from '{options.QueueName}'.");
+
         }


More management in Tr

More management in Tr

--- TranslateMe.WPF/Tr.cs
+++ TranslateMe.WPF/Tr.cs
@@ -127,46 +127,48 @@
         /// <returns></returns>
         public override object ProvideValue(IServiceProvider serviceProvider)
         {
-            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
-                return new Binding()
+            IProvideValueTarget service = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
+            if (service == null)
+            {
+                throw new InvalidOperationException("serviceProvider is not a IProvideValueTarget");
+            }
+
+            targetProperty = service.TargetProperty as DependencyProperty;
+            if (targetProperty == null)
+            {
+                throw new ArgumentException("TargetProperty is not a DependencyProperty");
+            }
+
+            targetObject = service.TargetObject as DependencyObject;
+            if (targetObject == null)
+            {
+                return this;
+            }
+
+            try
+            {
+                if (string.IsNullOrEmpty(TextId))
                 {
-                    Source = DefaultText ?? TextId ?? "Translated Text",
-                    FallbackValue = DefaultText ?? TextId ?? "Translated Text"
-                };
+                    if (targetObject != null && targetProperty != null)
+                    {
+                        string context = targetObject.GetContextByName();
+                        string obj = targetObject.FormatForTextId();
+                        string property = targetProperty.ToString();

-            if (serviceProvider.GetService(typeof(IProvideValueTarget)) is IProvideValueTarget target)
-            {
-                if (target.TargetObject.GetType().FullName == "System.Windows.SharedDp" || target.TargetObject is Setter)
-                    return this;
-
-                try
-                {
-
-                    targetObject = target.TargetObject as DependencyObject;
-                    targetProperty = target.TargetProperty as DependencyProperty;
-
-                    if (string.IsNullOrEmpty(TextId))
+                        TextId = $"{context}.{obj}.{property}";
+                    }
+                    else if (!string.IsNullOrEmpty(DefaultText))
                     {
-                        if (targetObject != null && targetProperty != null)
-                        {
-                            string context = targetObject.GetContextByName();
-                            string obj = targetObject.FormatForTextId();
-                            string property = targetProperty.ToString();
-
-                            TextId = $"{context}.{obj}.{property}";
-                        }
-                        else if (!string.IsNullOrEmpty(DefaultText))
-                        {
-                            TextId = DefaultText;
-                        }
+                        TextId = DefaultText;
                     }
                 }
-                catch (InvalidCastException)
-                {
-                    // For Xaml Design Time
-                    TextId = Guid.NewGuid().ToString();
-                }
             }
+            catch (InvalidCastException)
+            {
+                // For Xaml Design Time
+                TextId = Guid.NewGuid().ToString();
+            }
+

             return TM.Tr(TextId, DefaultText, LanguageId);
         }


Changed a for loop to a while loop

Changed a for loop to a while loop

--- Translator/Program.cs
+++ Translator/Program.cs
@@ -66,30 +66,27 @@
                             word = word.ToLower();

                             // save up to but not including the first vowel in the prefix
-                            for (int j = 0; j < word.Length; j++)
+                            int j = 0;
+                            while (j < word.Length && !vowelHash.Contains(word[j]))
                             {
-                                // save the first vowel and rest of the word in the stem
-                                if (vowelHash.Contains(word[j]))
-                                {
-                                    if (firstUpper)
-                                    {
-                                        stem = Char.ToUpper(word[j]) + word.Substring(j + 1);
-                                    }
-                                    else
-                                    {
-                                        stem = word.Substring(j);
-                                    }
-
-                                    // used to determine if is a word that begins with a vowel
-                                    if (!Ignite && charCount != 0 && String.Equals(word, stem.ToLower(), StringComparison.Ordinal))
-                                    {
-                                        ay = "yay";
-                                    }
-
-                                    break;
-                                }
-
                                 prefix += word[j];
+                                ++j;
+                            }
+
+                            // save first vowel till end in the stem
+                            if (firstUpper)
+                            {
+                                stem = Char.ToUpper(word[j]) + word.Substring(j + 1);
+                            }
+                            else
+                            {
+                                stem = word.Substring(j);
+                            }
+
+                            // used to determine if is a word that begins with a vowel
+                            if (!Ignite && charCount != 0 && String.Equals(word, stem.ToLower(), StringComparison.Ordinal))
+                            {
+                                ay = "yay";
                             }
                         }


Remove empty lines

Remove empty lines

--- Tron/Tron/TronGame.cs
+++ Tron/Tron/TronGame.cs
@@ -368,7 +368,7 @@
                     this.TimeTillAction = 15;
                 }

-                // Reset the game
+                // Reset the game
                 this.ResetGame(this.GameWon);
             }
             else
@@ -389,8 +389,6 @@
                 // Decrease the timer
                 this.TimeTillAction--;
             }
-
-
         }

         /// <summary>


adding error handling for token gather

adding error handling for token gather

--- Modules/Wow/WowApi.cs
+++ Modules/Wow/WowApi.cs
@@ -218,22 +218,27 @@
             return response;
         }

-        public static string GetWoWToken(string username, string password) {
-            System.Console.WriteLine("here");
-            string token = string.Empty;
-            HttpClient client = new HttpClient();
+        public static string GetWoWToken(string username, string password) {
+            string token = string.Empty;
             //httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Your Oauth token");
-            var content = new FormUrlEncodedContent(new[]
-            {
-                new KeyValuePair<string, string>("grant_type", "client_credentials"),
-                new KeyValuePair<string, string>("client_id", username),
-                new KeyValuePair<string, string>("client_secret", password)
-            });
-            var result =  client.PostAsync("https://us.battle.net/oauth/token", content);
-            var contentString =  result.Result.Content.ReadAsStringAsync();
-            ApiResponse response = JsonConvert.DeserializeObject<ApiResponse>(contentString.Result);
-            token = response.AccessToken;
-            System.Console.WriteLine($"Token: {token}");
+            try
+            {
+                HttpClient client = new HttpClient();
+                var content = new FormUrlEncodedContent(new[]
+                {
+                    new KeyValuePair<string, string>("grant_type", "client_credentials"),
+                    new KeyValuePair<string, string>("client_id", username),
+                    new KeyValuePair<string, string>("client_secret", password)
+                });
+                var result =  client.PostAsync("https://us.battle.net/oauth/token", content);
+                var contentString =  result.Result.Content.ReadAsStringAsync();
+                ApiResponse response = JsonConvert.DeserializeObject<ApiResponse>(contentString.Result);
+                token = response.AccessToken;
+            }
+            catch (Exception ex)
+            {
+                System.Console.WriteLine($"Error while getting token: [{ex.Message}]!");
+            }
             return token;
         }


fix(theme): fix random error on kerrb page titles

Random error surfaces when checking if the requestor is a bot. If a bot, writes page title in `<h1>` tag; else it wrapps title in CSS for positioning using jQuery. This fix adds a `try-catch-finally` in case of error checking user agent.

Closes #17

--- Themes/Kerrb/Views/Parts.Title.cshtml
+++ Themes/Kerrb/Views/Parts.Title.cshtml
@@ -4,12 +4,16 @@
   // figure out if this is a search bot
   var searchBots = new List<string>() {"teoma", "alexa", "froogle", "gigabot", "inktomi", "looksmart", "url_spider_sql", "firefly", "nationaldirectory", "ask jeeves", "tecnoseek", "infoseek", "webfindbot", "girafabot",  "crawler", "www.galaxy.com", "googlebot", "scooter", "slurp", "msnbot", "appie", "fast", "webbug", "spade", "zyborg", "rabaz", "baiduspider", "feedfetcher-google", "technoratisnoop", "rankivabot", "mediapartners-google", "sogou web spider", "webalta crawler", "facebookexternalhit"};
   var requesterIsBot = false;
-  foreach (var bot in searchBots){
-    if (Request.UserAgent.ToLower().Contains(bot))
-    {
-      requesterIsBot = true;
-      break;
+  try{
+    foreach (var bot in searchBots){
+      if (Request.UserAgent.ToLower().Contains(bot))
+      {
+        requesterIsBot = true;
+        break;
+      }
     }
+  } finally{
+    // swallow error... let requester is bot = default
   }
 }


Added an example of NameValueCollection GetValue and LiftM3 to the scrapbook

--- MonadApp/Scrapbook.cs
+++ MonadApp/Scrapbook.cs
@@ -2,6 +2,7 @@

 using System;
 using System.Collections.Generic;
+using System.Collections.Specialized;
 using MonadLib;

 namespace Monads
@@ -61,6 +62,22 @@
             var mc = Maybe.Just(12);
             var md1 = mc.LiftM(a => a * a); // returns Maybe<int>
             var md2 = mc.LiftM(a => Convert.ToString(a * a)); // returns Maybe<string>
+
+            var nameValueCollection = new NameValueCollection
+                {
+                    {"REF", "12345678"},
+                    {"SR", "AOL1234567"},
+                    {"Status", "S"}
+                };
+
+            Func<string, string, string, bool> f = (r, sr, status) => true;
+
+            var mresult = Maybe.LiftM3(
+                f,
+                nameValueCollection.GetValue("REF"),
+                nameValueCollection.GetValue("SR"),
+                nameValueCollection.GetValue("Status"));
+            Console.WriteLine("mresult: {0}", mresult.Match(b => b.ToString(), () => "Nothing"));
         }

         public static void EitherScrapbook()


fix comment

fix comment

--- Titanium.Web.Proxy/ResponseHandler.cs
+++ Titanium.Web.Proxy/ResponseHandler.cs
@@ -27,7 +27,7 @@
                 if (!args.WebSession.Response.ResponseBodyRead)
                     args.WebSession.Response.ResponseStream = args.WebSession.ServerConnection.Stream;

-                //If client request call back then do it
+                //If user requested call back then do it
                 if (BeforeResponse != null && !args.WebSession.Response.ResponseLocked)
                 {
                     Delegate[] invocationList = BeforeResponse.GetInvocationList();


Add default data: Platform, PlatformPrefix, Arch, ArchPrefix

--- MonoMod/MonoModder.cs
+++ MonoMod/MonoModder.cs
@@ -148,6 +148,13 @@
             Relinker = DefaultRelinker;
             MainRelinker = DefaultMainRelinker;
             PostRelinker = DefaultPostRelinker;
+
+            Data["Platform"] = (PlatformHelper.Current & ~Platform.X64).ToString();
+            Data["PlatformPrefix"] = (PlatformHelper.Current & ~Platform.X64).ToString().ToLowerInvariant() + "_";
+            Data["Arch"] = (PlatformHelper.Current & Platform.X64).ToString();
+            Data["Architecture"] = (PlatformHelper.Current & Platform.X64).ToString();
+            Data["ArchPrefix"] = (PlatformHelper.Current & Platform.X64).ToString().ToLowerInvariant() + "_";
+            Data["ArchitecturePrefix"] = (PlatformHelper.Current & Platform.X64).ToString().ToLowerInvariant() + "_";
         }

         public void SetupLegacy() {


修改 Update UpdateAsync 方法

修改 Update UpdateAsync 方法

--- ToolGood.ReadyGo3/SqlHelper.object.cs
+++ ToolGood.ReadyGo3/SqlHelper.object.cs
@@ -196,7 +196,7 @@
         /// <param name="condition">条件</param>
         /// <param name="ignoreFields"></param>
         /// <returns></returns>
-        public int Update<T1>(object set, object condition, params string[] ignoreFields) where T1 : class
+        public int Update<T1>(object set, object condition, IEnumerable<string> ignoreFields = null) where T1 : class
         {
             return Update<T1>(ConditionObjectToUpdateSetWhere(set, condition, ignoreFields));
         }
@@ -415,6 +415,7 @@
         }

+
         /// <summary>
         /// 根据条件更新对象
         /// </summary>
@@ -422,7 +423,7 @@
         /// <param name="condition">条件</param>
         /// <param name="ignoreFields"></param>
         /// <returns></returns>
-        public Task<int> UpdateAsync<T1>(object set, object condition, params string[] ignoreFields) where T1 : class
+        public Task<int> UpdateAsync<T1>(object set, object condition, IEnumerable<string> ignoreFields = null) where T1 : class
         {
             return UpdateAsync<T1>(ConditionObjectToUpdateSetWhere(set, condition, ignoreFields));
         }
@@ -492,9 +493,9 @@
             return stringBuilder.ToString();
         }

-        private string ConditionObjectToUpdateSetWhere(object set, object condition, string[] ignoreFields)
-        {
-            if (set == null) {throw new ArgumentException("set is  null object!");}
+        private string ConditionObjectToUpdateSetWhere(object set, object condition, IEnumerable<string> ignoreFields)
+        {
+            if (set == null) { throw new ArgumentException("set is  null object!"); }

             StringBuilder stringBuilder = new StringBuilder();
             stringBuilder.Append("SET ");
@@ -502,7 +503,7 @@
             if (condition != null) {
                 if (condition.GetType() == typeof(string)) {
                     var str = ((string)condition).Trim();
-                    if (str.StartsWith("WHERE ", StringComparison.CurrentCultureIgnoreCase)==false) {
+                    if (str.StartsWith("WHERE ", StringComparison.CurrentCultureIgnoreCase) == false) {
                         stringBuilder.Append(" WHERE");
                     }
                     stringBuilder.Append(" ");
@@ -515,7 +516,7 @@
             return stringBuilder.ToString();
         }

-        private void ObjectToSql(StringBuilder stringBuilder, object condition, string middelStr, string[] ignoreFields)
+        private void ObjectToSql(StringBuilder stringBuilder, object condition, string middelStr, IEnumerable<string> ignoreFields)
         {
             if (condition is IEnumerable) { throw new ArgumentException("condition is IEnumerable object!"); }
             bool hasColumn = false;


Corrected shuffle when list.Count() > byte.MaxValue

--- UltraSonic/Static/ExtensionMethods.cs
+++ UltraSonic/Static/ExtensionMethods.cs
@@ -88,10 +88,13 @@
         {
             RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
             int n = list.Count;
+            int arraySize = (int)Math.Ceiling((double)n/byte.MaxValue);
+
             while (n > 1)
             {
-                byte[] box = new byte[1];
-                do provider.GetBytes(box); while (!(box[0] < n*(Byte.MaxValue/n)));
+                byte[] box = new byte[arraySize];
+                do provider.GetBytes(box);
+                while (!(box[0] < n*((Byte.MaxValue*arraySize)/n)));
                 int k = (box[0]%n);
                 n--;
                 T value = list[k];


Adding missing credit

Adding missing credit

--- UnicodeNormalization/Helpers/Deque.cs
+++ UnicodeNormalization/Helpers/Deque.cs
@@ -1,4 +1,27 @@
-using System;
+// https://github.com/tejacques/Deque
+
+// The MIT License (MIT)
+//
+// Copyright (c) 2013 Tom Jacques
+//
+// 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.Collections;
 using System.Collections.Generic;
 using System.Text;


Changes to movement checks

Changes to movement checks

I now made it so before checking to see if the spot is open, it first checks to make sure theres even a spot that exists (it avoids checking outside the board)

--- UnityQuoridor/Assets/Scripts/Agent.cs
+++ UnityQuoridor/Assets/Scripts/Agent.cs
@@ -72,10 +72,11 @@
             int nextPlayer = (p + 1) % 1;
             Board newBoard = new Board(node.State);
             #region Player 1's Successors
-            if (node.Player == PLAYER1)
+            if (node.Player == PLAYER1)  //first check in all if statemtents is the players position in relation to moving
             {
                 //Move up
-                if (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall)
+				if (playerStatus[p].x > 0 &&
+				 !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall)
                 {
                     newBoard.MoveUp(p, 1, 1);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveUp, p, 1, 1), nextPlayer));
@@ -83,7 +84,8 @@
                 else
                 {
                     // going up jumping over 1 player directly
-                    if (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall &&
+					if (playerStatus[p].x > 1 &&
+					 !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall &&
                      !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen &&
                      !boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall)
                     {
@@ -92,26 +94,30 @@
                         node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveUp, p, 1, 2), nextPlayer));
                     }
                     // going Up by 1 and Right by 1
-                    if (((!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then Right
+					if ((playerStatus[p].x > 0 && playerStatus[p].y < 8) && (
+						  (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then Right
                            boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
                           !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)
                           ||
                          (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Up
                            boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
-                          !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)))
+                          !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)
+						) )
                     {
                         newBoard = new Board(node.State);
                         newBoard.MoveUp(p, 1, 1, true);
                         node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveUp, p, 1, 1, true), nextPlayer));
                     }
                     //going Left by 1 AND Up by 1
-                    if (((!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then up
-                            boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
-                            !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)
+					if ((playerStatus[p].x > 0 && playerStatus[p].y > 0) && (
+						(!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then up
+                          boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
+                         !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)
                             ||
-                            (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then left
-                                boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
-                                !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)))
+                        (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then left
+                          boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
+                         !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)
+						) )
                     {
                         newBoard = new Board(node.State);
                         newBoard.MoveLeft(p, 1, 2, true);
@@ -120,14 +126,16 @@
                 }

                 //Move Left
-                if (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall)
+				if (playerStatus[p].y > 0 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall)
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveLeft(p, 1, 2);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveLeft, p, 1, 2), nextPlayer));
                 }
                 // going Left jumping over 1 player directly
-                else if (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall &&
+				else if (playerStatus[p].y > 1 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall &&
                  !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen &&
                  !boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall)
                 {
@@ -137,13 +145,16 @@
                 }

                 //Move Right
-                if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall)
+				if (playerStatus[p].y < 8 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall)
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveRight(p, 1, 0);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveRight, p, 1, 0), nextPlayer));
                 }
-                else if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall &&
+				//going Right by jumping over 1 player directly
+				else if (playerStatus[p].y < 7 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall &&
                  !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen &&
                  !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall)
                 {
@@ -154,7 +165,8 @@

                 //Move Down
                 // going down by 1 (checks on location and for walls)
-                if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall)
+				if (playerStatus[p].x < 8 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall)
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveDown(p, 1, 3);
@@ -163,37 +175,40 @@
                 else
                 {
                     // going down jumping over 1 player directly
-                    if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall &&
-                        !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen &&
-                        !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall)
+					if (playerStatus[p].x < 7 &&
+					 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall &&
+                     !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen &&
+                     !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall)
                     {
                         newBoard = new Board(node.State);
                         newBoard.MoveDown(p, 2, 3);
                         node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveDown, p, 2, 3), nextPlayer));
                     }
                     // going Down by 1 AND to the Left by 1
-                    if (
-                        ((!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going down then left
-                            boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
-                            !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen)
-                            ||
-                            (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then down
-                                boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
-                                !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)))
+					if ((playerStatus[p].x < 8 && playerStatus[p].y > 0) && (
+						(!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going down then left
+                          boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
+                         !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen)
+                          ||
+                        (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then down
+                          boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
+                         !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)
+					    ))
                     {
                         newBoard = new Board(node.State);
                         newBoard.MoveDown(p, 1, 3, true);
                         node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveDown, p, 1, 3, true), nextPlayer));
                     }
                     // going Right by 1 AND Down by 1
-                    if (
-                     ((!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Down
-                        boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
-                       !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)
+					if ((playerStatus[p].x < 8 && playerStatus[p].y < 8) && (
+                     (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Down
+                       boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
+                      !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)
                        ||
-                      (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going Down then Right
-                        boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
-                       !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen)))
+                     (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going Down then Right
+                       boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
+                      !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen)
+					   ))
                     {
                         newBoard = new Board(node.State);
                         newBoard.MoveRight(p, 1, 0, true);
@@ -206,9 +221,8 @@
             //Player 2 prioritizes moving down -> left or right -> Wall -> Up (tentative Move Ordering)
             //Move Down
             // going down by 1 (checks on location and for walls)
-            //Move Down
-            // going down by 1 (checks on location and for walls)
-            if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall)
+			if (playerStatus[p].x < 8 &&
+			 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall)
             {
                 newBoard = new Board(node.State);
                 newBoard.MoveDown(p, 1, 3);
@@ -217,7 +231,8 @@
             else
             {
                 // going down jumping over 1 player directly
-                if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall &&
+				if (playerStatus[p].x < 7 &&
+					!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall &&
                     !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen &&
                     !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall)
                 {
@@ -226,24 +241,24 @@
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveDown, p, 2, 3), nextPlayer));
                 }
                 // going Down by 1 AND to the Left by 1
-                if (
-                    ((!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going down then left
-                        boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
-                        !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen)
-                        ||
-                        (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then down
-                            boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
-                            !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)))
+				if ((playerStatus[p].x < 8 && playerStatus[p].y > 0) && (
+                  (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going down then left
+                    boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
+                   !boardStatus[playerStatus[p].x + 1, playerStatus[p].y].isOpen)
+                    ||
+                  (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then down
+                    boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
+                   !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)))
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveDown(p, 1, 3, true);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveDown, p, 1, 3, true), nextPlayer));
                 }
                 // going Right by 1 AND Down by 1
-                if (
-                 ((!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Down
-                    boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
-                   !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)
+				if ((playerStatus[p].x < 8 && playerStatus[p].y < 8) && (
+                 (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Down
+                   boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
+                  !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)
                    ||
                   (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasBotWall && //going Down then Right
                     boardStatus[playerStatus[p].x + 1, playerStatus[p].y].hasBotWall &&
@@ -257,16 +272,18 @@

             //Move Left
-            if (playerStatus[p].y - 1 >= 0)
-            {
-                if (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall)
+         //   if (playerStatus[p].y - 1 >= 0)
+          //  {
+				if (playerStatus[p].y > 0 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall)
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveLeft(p, 1, 2);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveLeft, p, 1, 2), nextPlayer));
                 }
                 // going Left jumping over 1 player directly
-                else if (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall &&
+			else if (playerStatus[p].y > 1 &&
+				 !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall &&
                  !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen &&
                  !boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall)
                 {
@@ -274,15 +291,18 @@
                     newBoard.MoveLeft(p, 2, 2);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveLeft, p, 2, 2), nextPlayer));
                 }
-            }
+            //}
             //Move Right
-            if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall)
+			if (playerStatus[p].y < 8 &&
+			 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall)
             {
                 newBoard = new Board(node.State);
                 newBoard.MoveRight(p, 1, 0);
                 node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveRight, p, 1, 0), nextPlayer));
             }
-            else if (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall &&
+			//going Right jumping over 1 player directly
+			else if (playerStatus[p].y < 7 &&
+			 !boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall &&
              !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen &&
              !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall)
             {
@@ -292,7 +312,8 @@
             }

             //Move up
-            if (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall)
+			if (playerStatus[p].x > 0 &&
+			 !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall)
             {
                 newBoard.MoveUp(p, 1, 1);
                 node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveUp, p, 1, 1), nextPlayer));
@@ -300,7 +321,8 @@
             else
             {
                 // going up jumping over 1 player directly
-                if (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall &&
+				if (playerStatus[p].x > 1 &&
+				 !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall &&
                  !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen &&
                  !boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall)
                 {
@@ -309,26 +331,28 @@
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveUp, p, 1, 2), nextPlayer));
                 }
                 // going Up by 1 and Right by 1
-                if (((!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then Right
-                       boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
-                      !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)
-                      ||
-                     (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Up
-                       boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
-                      !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)))
+				if ((playerStatus[p].x > 0 && playerStatus[p].y < 8) && (
+				 (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then Right
+                   boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
+                  !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)
+                   ||
+                 (!boardStatus[playerStatus[p].x, playerStatus[p].y].hasRightWall && //going Right then Up
+                   boardStatus[playerStatus[p].x, playerStatus[p].y + 1].hasRightWall &&
+                  !boardStatus[playerStatus[p].x, playerStatus[p].y + 1].isOpen)))
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveUp(p, 1, 1, true);
                     node.Children.Add(new Node(newBoard, 0, new ActionFunction(newBoard.MoveUp, p, 1, 1, true), nextPlayer));
                 }
                 //going Left by 1 AND Up by 1
-                if (((!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then up
-                        boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
-                        !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)
-                        ||
-                        (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then left
-                            boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
-                            !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)))
+				if ((playerStatus[p].x > 0 && playerStatus[p].y > 0) && (
+				 (!boardStatus[playerStatus[p].x, playerStatus[p].y - 1].hasRightWall && //going left then up
+                   boardStatus[playerStatus[p].x, playerStatus[p].y - 2].hasRightWall &&
+                  !boardStatus[playerStatus[p].x, playerStatus[p].y - 1].isOpen)
+                   ||
+                 (!boardStatus[playerStatus[p].x - 1, playerStatus[p].y].hasBotWall && //going up then left
+                   boardStatus[playerStatus[p].x - 2, playerStatus[p].y].hasBotWall &&
+                  !boardStatus[playerStatus[p].x - 1, playerStatus[p].y].isOpen)))
                 {
                     newBoard = new Board(node.State);
                     newBoard.MoveLeft(p, 1, 2, true);


fix endings

fix endings

--- app/Simpler/Data/Tasks/BuildDynamic.cs
+++ app/Simpler/Data/Tasks/BuildDynamic.cs
@@ -1,56 +1,56 @@
 using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Dynamic;
-
-namespace Simpler.Data.Tasks
-{
-    public class BuildDynamic : InOutTask<BuildDynamic.Input, BuildDynamic.Output>
-    {
-        public class Input
-        {
-            public IDataRecord DataRecord { get; set; }
-        }
-
-        public class Output
-        {
-            public dynamic Object { get; set; }
-        }
-
-        class Dynamic : DynamicObject
-        {
-            readonly Dictionary<string, object> _members = new Dictionary<string, object>();
-
-            public override bool TryGetMember(GetMemberBinder binder, out object result)
-            {
-                return _members.TryGetValue(binder.Name, out result);
-            }
-
-            public override bool TrySetMember(SetMemberBinder binder, object value)
-            {
-                _members[binder.Name.ToLower()] = value;
-                return true;
-            }
-
-            public void AddMember(string memberName, object memberValue)
-            {
-                _members[memberName] = memberValue;
-            }
-        }
-
+using System.Collections.Generic;
+using System.Data;
+using System.Dynamic;
+
+namespace Simpler.Data.Tasks
+{
+    public class BuildDynamic : InOutTask<BuildDynamic.Input, BuildDynamic.Output>
+    {
+        public class Input
+        {
+            public IDataRecord DataRecord { get; set; }
+        }
+
+        public class Output
+        {
+            public dynamic Object { get; set; }
+        }
+
+        class Dynamic : DynamicObject
+        {
+            readonly Dictionary<string, object> _members = new Dictionary<string, object>();
+
+            public override bool TryGetMember(GetMemberBinder binder, out object result)
+            {
+                return _members.TryGetValue(binder.Name, out result);
+            }
+
+            public override bool TrySetMember(SetMemberBinder binder, object value)
+            {
+                _members[binder.Name.ToLower()] = value;
+                return true;
+            }
+
+            public void AddMember(string memberName, object memberValue)
+            {
+                _members[memberName] = memberValue;
+            }
+        }
+
         public override void Execute()
         {
-            Out.Object = new ExpandoObject();
-            var OutObject = Out.Object as IDictionary<string, Object>;
-            for (var i = 0; i < In.DataRecord.FieldCount; i++)
-            {
-                var columnName = In.DataRecord.GetName(i);
-                var columnValue = In.DataRecord[columnName];
-                if (columnValue.GetType() != typeof(System.DBNull))
+            Out.Object = new ExpandoObject();
+            var OutObject = Out.Object as IDictionary<string, Object>;
+            for (var i = 0; i < In.DataRecord.FieldCount; i++)
+            {
+                var columnName = In.DataRecord.GetName(i);
+                var columnValue = In.DataRecord[columnName];
+                if (columnValue.GetType() != typeof(System.DBNull))
                 {
-                    OutObject.Add(columnName, columnValue);
-                }
-            }
-        }
-    }
-}
+                    OutObject.Add(columnName, columnValue);
+                }
+            }
+        }
+    }
+}


Make need update check to exclude considering instead of on hold

--- anime-downloader/Classes/Xml/AnimeCollection.cs
+++ anime-downloader/Classes/Xml/AnimeCollection.cs
@@ -56,7 +56,7 @@

         public IEnumerable<Anime> Watching => Animes.Where(a => a.Status == "Watching");

-        public IEnumerable<Anime> NeedsUpdates => Animes.Where(a => a.MyAnimeList.NeedsUpdating && !a.Status.Equals("On Hold"));
+        public IEnumerable<Anime> NeedsUpdates => Animes.Where(a => a.MyAnimeList.NeedsUpdating && !a.Status.Equals("Considering"));

         /// <summary>
         ///     A flag that will save any change in the xml schema as soon as it happens.


Cleanup.

Cleanup.


Fix casing of Sha `Commit Sha: xyz` -> `Commit SHA-1 hash: xyz`  for `dotnet --info` output.

--- src/dotnet/Program.cs
+++ src/dotnet/Program.cs
@@ -182,8 +182,8 @@
             var commitSha = GetCommitSha() ?? "N/A";
             Reporter.Output.WriteLine();
             Reporter.Output.WriteLine("Product Information:");
-            Reporter.Output.WriteLine($" Version:     {Product.Version}");
-            Reporter.Output.WriteLine($" Commit Sha:  {commitSha}");
+            Reporter.Output.WriteLine($" Version:            {Product.Version}");
+            Reporter.Output.WriteLine($" Commit SHA-1 hash:  {commitSha}");
             Reporter.Output.WriteLine();
             Reporter.Output.WriteLine("Runtime Environment:");
             Reporter.Output.WriteLine($" OS Name:     {RuntimeEnvironment.OperatingSystem}");


Document generator now documents [NullAttribute, ThreadSafety]

--- tools/docfixer/document-generated-code.cs
+++ tools/docfixer/document-generated-code.cs
@@ -108,6 +108,26 @@
 		}
 	}

+	static XElement GetXmlNodeForMemberName (Type t, XDocument xdoc, string name)
+	{
+		var field = xdoc.XPathSelectElement ("Type/Members/Member[@MemberName='" + name + "']");
+		if (field == null){
+			if (!warnings_up_to_date.ContainsKey (t)){
+				Console.WriteLine ("Warning: {0} document is not up-to-date with the latest assembly (could not find Field <Member MemberName='{1}')", t, name);
+				warnings_up_to_date [t] = true;
+			}
+		}
+		return field;
+	}
+
+	static XElement GetXmlNodeFromExport (Type t, XDocument xdoc, string selector)
+	{
+		return (from m in xdoc.XPathSelectElements ("Type/Members/Member")
+			let a = m.XPathSelectElement ("Attributes/Attribute/AttributeName")
+			where a != null && a.Value.IndexOf ("MonoTouch.Foundation.Export(\"" + selector + "\"") != -1
+			select m).FirstOrDefault ();
+	}
+
 	//
 	// Handles fields, but perhaps this is better done in DocFixer to pull the definitions
 	// from the docs?
@@ -119,15 +139,11 @@
 			return;

 		var export = ((FieldAttribute) fieldAttr [0]).SymbolName;
-
-		var field = xdoc.XPathSelectElement ("Type/Members/Member[@MemberName='" + pi.Name + "']");
-		if (field == null){
-			if (!warnings_up_to_date.ContainsKey (t)){
-				Console.WriteLine ("Warning: {0} document is not up-to-date with the latest assembly (could not find Field <Member MemberName='{1}')", t, pi.Name);
-				warnings_up_to_date [t] = true;
-			}
-			return;
-		}
+
+		var field = GetXmlNodeForMemberName (t, xdoc, pi.Name);
+		if (field == null)
+			return;
+
 		var returnType = field.XPathSelectElement ("ReturnValue/ReturnType");
 		var summary = field.XPathSelectElement ("Docs/summary");
 		var remarks = field.XPathSelectElement ("Docs/remarks");
@@ -327,13 +343,50 @@
 			}
 		}
 	}
+
+	//
+	// This prepares a node that contains text, like this:
+	// <foo>To be added.</foo>
+	//
+	// to wrap the text in a para.
+	// <foo><para>To be added.</para></foo>
+	//
+	static void PrepareNakedNode (XElement element, bool addStub = true)
+	{
+		if (element.HasElements)
+			return;
+		var val = element.Value;
+		if (addStub && val == "To be added.")
+			val = "(More documentation for this node is coming)";
+
+		element.Value = "";
+		element.Add (XElement.Parse ("<para>" + val + "</para>"));
+	}
+
+
+	public static void AnnotateNullAllowedPropertyValue (Type t, XDocument xdoc, PropertyInfo pi)
+	{
+		var field = GetXmlNodeForMemberName (t, xdoc, pi.Name);
+		if (field == null)
+			return;
+		var value = field.XPathSelectElement ("Docs/value");
+		var toolgen_null_annotations = value.XPathSelectElement ("para[@tool='nullallowed']");
+		if (toolgen_null_annotations == null)
+			PrepareNakedNode (value);
+		else
+			toolgen_null_annotations.Remove ();
+
+		value.Add (XElement.Parse ("<para tool='nullallowed'>This value can be <see langword=\"null\"/>.</para>"));
+	}

 	public static void ProcessNSO (Type t, BaseTypeAttribute bta)
 	{
 		var xmldoc = GetDoc (t);
-		if (xmldoc == null)
-			return;
-
+		if (xmldoc == null){
+			Console.WriteLine ("Can not find docs for {0}", t);
+			return;
+		}
+
 		foreach (var pi in t.GatherProperties ()){
 			object [] attrs;
 			var kbd = false;
@@ -344,14 +397,100 @@
 					ProcessNotification (t, xmldoc, pi);
 				continue;
 			}
+			if (pi.GetCustomAttributes (typeof (NullAllowedAttribute), true).Length > 0){
+				AnnotateNullAllowedPropertyValue (t, xmldoc, pi);
+
+				//
+				// Propagate the [NullAllowed] from the WeakXXX to XXX
+				//
+				if (pi.Name.StartsWith ("Weak")){
+					var npi = t.GetProperty (pi.Name.Substring (4));
+
+					// Validate that the other property is actually a wrapper around this one.
+					if (npi != null && npi.GetCustomAttributes (typeof (WrapAttribute), true).Length > 0){
+						if (npi != null)
+							AnnotateNullAllowedPropertyValue (t, xmldoc, npi);
+					} else
+						Console.WriteLine ("Did not find matching {0}", pi.Name);
+
+				}
+			}
+			if (pi.GetCustomAttributes (typeof (ThreadSafeAttribute), true).Length > 0){
+				var field = GetXmlNodeForMemberName (t, xmldoc, pi.Name);
+				if (field == null)
+					return;
+				var remarks = field.XPathSelectElement ("Docs/remarks");
+				if (remarks != null)
+					AddThreadRemark (remarks, "This");
+			}
+		}
+		foreach (var mi in t.GatherMethods ()){
+			//
+			// Since it is a pain to go from a MethodInfo into an ECMA XML signature name
+			// we will lookup the method by the [Export] attribute
+			//

-		}
-
+			var attrs = mi.GetCustomAttributes (typeof (ExportAttribute), true);
+			if (attrs.Length == 0)
+				continue;
+			var ea = attrs [0] as ExportAttribute;
+			var node = GetXmlNodeFromExport (t, xmldoc, ea.Selector);
+			if (node == null){
+				Console.WriteLine ("Did not find the selector {0}", ea.Selector);
+				continue;
+			}
+
+			if (mi.GetCustomAttributes (typeof (ThreadSafeAttribute), true).Length > 0){
+				var remarks = node.XPathSelectElement ("Docs/remarks");
+				AddThreadRemark (remarks, "This");
+			}
+			foreach (var parameter in mi.GetParameters ()){
+				if (parameter.GetCustomAttributes (typeof (NullAllowedAttribute), true).Length > 0){
+					var par = node.XPathSelectElement ("Docs/param[@name='" + parameter.Name + "']");
+					if (par == null){
+						Console.WriteLine ("Did not find parameter {0} in {1}.{2}\n{3}", parameter.Name, t, mi, node);
+						continue;
+					}
+					var toolgen_null_annotations = par.XPathSelectElement ("para[@tool='nullallowed']");
+					if (toolgen_null_annotations == null)
+						PrepareNakedNode (par, addStub: false);
+					else
+						toolgen_null_annotations.Remove ();
+					par.Add (XElement.Parse ("<para tool='nullallowed'>This parameter can be <see langword=\"null\"/>.</para>"));
+				}
+			}
+		}
+
 		if (bta != null && bta.Events != null){
 			PopulateEvents (xmldoc, bta, t);
 		}
 	}
-
+
+	static void AddThreadRemark (XElement node, string msg)
+	{
+		var threadNode =  node.XPathSelectElement ("para[@tool='threads']");
+		if (threadNode == null)
+			PrepareNakedNode (node);
+		else
+			threadNode.Remove ();
+		node.Add (XElement.Parse ("<para tool='threads'>" + msg + " can be used from a background thread.</para>"));
+	}
+
+	public static void AnnotateThreadSafeType (Type t)
+	{
+		var xmldoc = GetDoc (t);
+		if (xmldoc == null){
+			Console.WriteLine ("Can not find docs for {0}", t);
+			return;
+		}
+		var typeRemarks = xmldoc.XPathSelectElement ("Type/Docs/remarks");
+		AddThreadRemark (typeRemarks, "The members of this class");
+
+		var memberRemarks = xmldoc.XPathSelectElements ("Type/Members/Member/Docs/remarks");
+		foreach (var mr in memberRemarks)
+			AddThreadRemark (mr, "This");
+	}
+
 	public static int Main (string [] args)
 	{
 		string dir = null;
@@ -404,6 +543,9 @@
 		}

 		foreach (Type t in assembly.GetTypes ()){
+			if (t.GetCustomAttributes (typeof (ThreadSafeAttribute), true).Length > 0)
+				AnnotateThreadSafeType (t);
+
 			if (debugDoc && mergeAppledocs){
 				string str = docGenerator.GetAppleDocFor (ToCecilType (t));
 				if (str == null){
@@ -412,7 +554,7 @@

 				continue;
 			}
-
+
 			if (debug != null && t.FullName != debug)
 				continue;


Fix another potential exception

Fix another potential exception

--- osu.Framework/Graphics/Textures/TextureStore.cs
+++ osu.Framework/Graphics/Textures/TextureStore.cs
@@ -75,7 +75,7 @@
             //Laziness ensure we are only ever creating the texture once (and blocking on other access until it is done).
             var cachedTex = textureCache.GetOrAdd(name, lazyCreator).Value;

-            if (cachedTex?.TextureGL?.IsDisposed == true)
+            if (cachedTex?.IsDisposed == true)
             {
                 textureCache.TryRemove(name, out _);
                 return Get(name);


Remove unused retrieval lock

Remove unused retrieval lock

--- osu.Framework/Graphics/Textures/TextureStore.cs
+++ osu.Framework/Graphics/Textures/TextureStore.cs
@@ -17,7 +17,6 @@
     public class TextureStore : ResourceStore<TextureUpload>
     {
         private readonly Dictionary<string, Texture> textureCache = new Dictionary<string, Texture>();
-        private readonly object retrievalLock = new object();

         private readonly All filteringMode;
         private readonly bool manualMipmaps;