Add in checks to try and create OracleDataAccess.Client ahead of System.Data.OracleClient - this then requires special handling of the NClob - as this can be dealt with as a string by ODP.Net

--- src/Elmah/OracleErrorLog.cs
+++ src/Elmah/OracleErrorLog.cs
@@ -125,7 +125,7 @@

         static OracleErrorLog()
         {
-            if (/* !TryAndCreateDbProviderFactory("Oracle.DataAccess.Client2") && */
+            if (!TryAndCreateDbProviderFactory("Oracle.DataAccess.Client") &&
                 !TryAndCreateDbProviderFactory("System.Data.OracleClient"))
                 return;

@@ -294,12 +294,22 @@
                     AddProviderSpecificTypeParameter(command, "tempblob", _clobDbType).Direction = ParameterDirection.Output;
                     command.ExecuteNonQuery();

-                    // now we can get a handle to the NClob
-                    var xmlLob = (Stream)parameters[0].Value;
-                    // create a temporary buffer in which to store the XML
-                    var tempbuff = Encoding.Unicode.GetBytes(errorXml);
-                    // and finally we can write to it!
-                    xmlLob.Write(tempbuff,0,tempbuff.Length);
+                    object xmlValue;
+
+                    if (parameters[0].Value is string)
+                    {
+                        xmlValue = errorXml + "<!-- " + new string('a', 70000) + " -->";
+                    }
+                    else
+                    {
+                        // now we can get a handle to the NClob
+                        var xmlLob = (Stream)parameters[0].Value;
+                        // create a temporary buffer in which to store the XML
+                        var tempbuff = Encoding.Unicode.GetBytes(errorXml);
+                        // and finally we can write to it!
+                        xmlLob.Write(tempbuff, 0, tempbuff.Length);
+                        xmlValue = xmlLob;
+                    }

                     command.CommandText = SchemaOwner + "pkg_elmah$log_error.LogError";
                     command.CommandType = CommandType.StoredProcedure;
@@ -312,7 +322,7 @@
                     AddGenericTypeParameter(command, "v_Source", DbType.String).Value = error.Source;
                     AddGenericTypeParameter(command, "v_Message", DbType.String).Value = error.Message;
                     AddGenericTypeParameter(command, "v_User", DbType.String).Value = error.User;
-                    AddProviderSpecificTypeParameter(command, "v_AllXml", _clobDbType).Value = xmlLob;
+                    AddProviderSpecificTypeParameter(command, "v_AllXml", _clobDbType).Value = xmlValue;
                     AddGenericTypeParameter(command, "v_StatusCode", DbType.Int32).Value = error.StatusCode;
                     AddGenericTypeParameter(command, "v_TimeUtc", DbType.DateTime).Value = error.Time.ToUniversalTime();

@@ -420,19 +430,20 @@
                 AddProviderSpecificTypeParameter(command, "v_AllXml", _clobDbType).Direction = ParameterDirection.Output;

                 command.ExecuteNonQuery();
-                var xmlLob = (Stream)command.Parameters["v_AllXml"].Value;
-
-                var streamreader = new StreamReader(xmlLob, Encoding.Unicode);
-                var cbuffer = new char[1000];
-                int actual;
-                var sb = new StringBuilder();
-                while((actual = streamreader.Read(cbuffer, 0, cbuffer.Length)) >0)
-                    sb.Append(cbuffer, 0, actual);
-                errorXml = sb.ToString();
-            }
-
-            if (errorXml == null)
-                return null;
+                errorXml = command.Parameters["v_AllXml"].Value as string;
+                if (errorXml == null)
+                {
+                    var xmlLob = (Stream) command.Parameters["v_AllXml"].Value;
+
+                    var streamreader = new StreamReader(xmlLob, Encoding.Unicode);
+                    var cbuffer = new char[1000];
+                    int actual;
+                    var sb = new StringBuilder();
+                    while ((actual = streamreader.Read(cbuffer, 0, cbuffer.Length)) > 0)
+                        sb.Append(cbuffer, 0, actual);
+                    errorXml = sb.ToString();
+                }
+            }

             var error = ErrorXml.DecodeString(errorXml);
             return new ErrorLogEntry(this, id, error);


Children as property

Children as property

--- src/GraphicObjects/Group.cs
+++ src/GraphicObjects/Group.cs
@@ -20,10 +20,16 @@
 		#endregion

         bool _multiSelect = false;
+		List<GraphicObject> children = new List<GraphicObject>();

         public GraphicObject activeWidget;
-        public List<GraphicObject> Children = new List<GraphicObject>();
-
+
+        public virtual List<GraphicObject> Children {
+			get { return children; }
+			set {
+				children = value;
+			}
+		}
 		[XmlAttributeAttribute()][DefaultValue(false)]
         public bool MultiSelect
         {


Updated version numbers

Updated version numbers

--- src/Hosting/AssemblyInfo.cs
+++ src/Hosting/AssemblyInfo.cs
@@ -4,5 +4,5 @@
 [assembly: AssemblyTitle( "More.UI.Hosting" )]
 [assembly: AssemblyProduct( "More.UI.Hosting" )]
 [assembly: AssemblyDescription( "The user interface hosting library for the \"More\" framework." )]
-[assembly: AssemblyVersion( "1.3.0.0" )]
-[assembly: AssemblyInformationalVersion( "1.3.0" )]+[assembly: AssemblyVersion( "1.4.0.0" )]
+[assembly: AssemblyInformationalVersion( "1.4.0" )]


prevent exception when handle external command

--- src/NDock.Server/Program.cs
+++ src/NDock.Server/Program.cs
@@ -278,7 +278,12 @@

         static bool StopCommand(IBootstrap bootstrap, string[] arguments)
         {
-            var name = arguments[1];
+            var name = string.Empty;
+
+            if(arguments.Length > 1)
+            {
+                name = arguments[1];
+            }

             if (string.IsNullOrEmpty(name))
             {
@@ -301,7 +306,12 @@

         static bool StartCommand(IBootstrap bootstrap, string[] arguments)
         {
-            var name = arguments[1];
+            var name = string.Empty;
+
+            if (arguments.Length > 1)
+            {
+                name = arguments[1];
+            }

             if (string.IsNullOrEmpty(name))
             {


Remove invalid unit test and fix comments in test

--- test/unit/Locking/RedisDistributedAppLockTest.cs
+++ test/unit/Locking/RedisDistributedAppLockTest.cs
@@ -11,7 +11,7 @@
     public class RedisDistributedAppLockTest
     {
         [Fact]
-        public void Does_acquire_lock_using_redisclient()
+        public async Task Does_acquire_lock_using_redisclient()
         {
             var lockName = "the-lock";
             var client = A.Fake<IDatabase>(o => o.Strict());
@@ -25,7 +25,7 @@

             var handle = new RedisDistributedAppLock(manager);

-            handle.AcquireLockAsync(lockName);
+            await handle.AcquireLockAsync(lockName);

             A.CallTo(() => client.LockTake(
                     A<RedisKey>.That.Matches(str => str == lockName),
@@ -35,31 +35,6 @@
                 .MustHaveHappened();

             Assert.Equal(lockName, handle.Name);
-        }
-
-        [Fact]
-        public void Does_acquire_lock_using_redisclient_w_timeout()
-        {
-            var lockName = "the-lock";
-
-            var client = A.Fake<IDatabase>();
-            var manager = A.Fake<IConnectionMultiplexer>();
-            A.CallTo(() => manager.GetDatabase(A<int>.Ignored, A<object>.Ignored)).Returns(client);
-            A.CallTo(() => client.LockTake(
-                A<RedisKey>.That.Matches(str => str == lockName),
-                A<RedisValue>.Ignored,
-                A<TimeSpan>.Ignored,
-                A<CommandFlags>.Ignored)).Returns(true);
-
-            var handle = new RedisDistributedAppLock(manager);
-            handle.AcquireLockAsync(lockName, TimeSpan.FromSeconds(2));
-
-            A.CallTo(() => client.LockTake(
-                    A<RedisKey>.That.Matches(str => str == lockName),
-                    A<RedisValue>.Ignored,
-                    A<TimeSpan>.Ignored,
-                    A<CommandFlags>.Ignored))
-                .MustHaveHappened();
         }

         [Fact]
@@ -83,7 +58,7 @@
                 // empty on purpose
             }

-            // after using scope both client and underlying lock must be released
+            // after using scope underlying lock must be released
             A.CallTo(() => client.LockRelease(
                 A<RedisKey>.That.Matches(str => str == lockName),
                 A<RedisValue>.Ignored,
@@ -121,11 +96,12 @@
             var manager = A.Fake<IConnectionMultiplexer>();
             A.CallTo(() => manager.GetDatabase(A<int>.Ignored, A<object>.Ignored)).Returns(client);

+            var exceptionThrownDuringTest = new TimeoutException("test is faking it!");
             A.CallTo(() => client.LockTake(
                  A<RedisKey>.That.Matches(str => str == lockName),
                  A<RedisValue>.Ignored,
                  A<TimeSpan>.Ignored,
-                 A<CommandFlags>.Ignored)).Throws(new TimeoutException("test is faking it!"));
+                 A<CommandFlags>.Ignored)).Throws(exceptionThrownDuringTest);

             var handle = new RedisDistributedAppLock(manager);

@@ -133,6 +109,9 @@
             var ex = await Assert.ThrowsAsync<DistributedAppLockException>(
                 async () => await handle.AcquireLockAsync(lockName, TimeSpan.FromSeconds(2)));
             Assert.Equal(DistributedAppLockExceptionReason.Timeout, ex.Reason);
+            var innerEx = ex.InnerException;
+            Assert.NotNull(innerEx);
+            Assert.Equal(exceptionThrownDuringTest, innerEx);
         }

         [Fact]


Add try/catch for concurrency when creating a stream

--- src/Cedar.EventStore.Postgres/PostgresEventStore.cs
+++ src/Cedar.EventStore.Postgres/PostgresEventStore.cs
@@ -141,7 +141,9 @@
                     {
                         // create the stream as it doesn't exist

-                        using (
+                        try
+                        {
+                            using (
                             var command = new NpgsqlCommand(_scripts.Functions.CreateStream, connection, tx)
                             {
                                 CommandType
@@ -149,12 +151,27 @@
                                                       CommandType
                                                       .StoredProcedure
                             })
+                            {
+                                command.Parameters.AddWithValue(":stream_id", streamIdInfo.StreamId);
+                                command.Parameters.AddWithValue(":stream_id_original", streamIdInfo.StreamIdOriginal);
+
+                                streamIdInternal =
+                                    (int)await command.ExecuteScalarAsync(cancellationToken).NotOnCapturedContext();
+                            }
+                        }
+                        catch (NpgsqlException ex)
                         {
-                            command.Parameters.AddWithValue(":stream_id", streamIdInfo.StreamId);
-                            command.Parameters.AddWithValue(":stream_id_original", streamIdInfo.StreamIdOriginal);
-
-                            streamIdInternal =
-                                (int)await command.ExecuteScalarAsync(cancellationToken).NotOnCapturedContext();
+                            if (ex.Code == "40001")
+                            {
+                                // could not serialize access due to read/write dependencies among transactions
+                                throw new WrongExpectedVersionException(
+                                Messages.AppendFailedWrongExpectedVersion.FormatWith(streamId, expectedVersion), ex);
+                            }
+
+                            //if error code is 40001 the transaction is already rolled back
+                            tx.Rollback();
+
+                            throw;
                         }
                     }
                 }


Fix sidebar link for lykke wallet.

Fix sidebar link for lykke wallet.

--- src/CompetitionPlatform/Views/Shared/_Layout.cshtml
+++ src/CompetitionPlatform/Views/Shared/_Layout.cshtml
@@ -68,7 +68,7 @@

-
+


Update ConstructorGuards.cs

Update ConstructorGuards.cs

--- tests/SixLabors.Fonts.Tests/ConstructorGuards.cs
+++ tests/SixLabors.Fonts.Tests/ConstructorGuards.cs
@@ -11,12 +11,32 @@
         [Fact]
         public void FontClass_DefaultFontFamilyThrowsException()
         {
-            ArgumentException ex = Assert.Throws<ArgumentException>(() => new Font(default(FontFamily), 0f, FontStyle.Regular));
+            ArgumentException ex = Assert.Throws<ArgumentException>(
+                () => new Font(default(FontFamily), FontStyle.Regular));
+
+            Assert.Equal("family", ex.ParamName);
+        }
+
+        [Fact]
+        public void FontClass_DefaultFontFamilyWithSizeThrowsException()
+        {
+            ArgumentException ex = Assert.Throws<ArgumentException>(
+                () => new Font(default(FontFamily), 0f, FontStyle.Regular));
+
             Assert.Equal("family", ex.ParamName);
         }

         [Fact]
         public void FontClass_NullFontThrowsException()
+        {
+            ArgumentNullException ex = Assert.Throws<ArgumentNullException>(
+                () => new Font(null, FontStyle.Regular));
+
+            Assert.Equal("prototype", ex.ParamName);
+        }
+
+        [Fact]
+        public void FontClass_NullWithSizeFontThrowsException()
         {
             ArgumentNullException ex = Assert.Throws<ArgumentNullException>(
                 () => new Font(null, 0f, FontStyle.Regular));


Only send TorrentCompletedMessage if we have downloaded anything. Prevents messages being sent in error when adding torrents that already exist on disk etc.

--- src/Core/Hadouken.Core/BitTorrent/SessionHandler.cs
+++ src/Core/Hadouken.Core/BitTorrent/SessionHandler.cs
@@ -305,7 +305,10 @@
             var torrent = Torrent.CreateFromHandle(alert.Handle, _metadataRepository);
             if (_muted.Contains(torrent.InfoHash)) return;

-            _messageBus.Publish(new TorrentCompletedMessage(torrent));
+            if (torrent.TotalDownloadedBytes > 0)
+            {
+                _messageBus.Publish(new TorrentCompletedMessage(torrent));
+            }
         }

         public void Handle(TorrentPausedAlert alert)


regular backup

regular backup

--- SteamBot/KeyUserHandler.cs
+++ SteamBot/KeyUserHandler.cs
@@ -20,7 +20,6 @@
 		public TF2Value UserMetalAdded, NonTradeInventoryMetal, InventoryMetal, BotMetalAdded, ExcessRefined, KeysToScrap, AdditionalRefined, ChangeAdded, LeftoverMetal;
 		public static TF2Value SellPricePerKey = TF2Value.FromRef(19.11); //high
 		public static TF2Value BuyPricePerKey = TF2Value.FromRef(18.77); //low
-        //test

 		int KeysCanBuy, NonTradeKeysCanBuy, ValidateMetaltoKey, PreviousKeys, UserKeysAdded, BotKeysAdded, InventoryKeys, NonTradeInventoryKeys, IgnoringBot, ScamAttempt, NonTradeScrap, Scrap, ScrapAdded, NonTradeReclaimed, Reclaimed, ReclaimedAdded, NonTradeRefined, Refined, RefinedAdded, InvalidItem, NumKeys, TradeFrequency;


Initial implementation of GetResponse

Initial implementation of GetResponse

Untested but seems fine

--- StockFighter/APIWrapper.cs
+++ StockFighter/APIWrapper.cs
@@ -157,9 +157,9 @@
             return client;
         }

-        private static IRestResponse<TClass> GetResponse<TClass>(
+        private static T GetResponse<T>(
             Command command,
-            string[] args) where TClass new()
+            string[] args) where T : new()
         {
             var client = getClient();

@@ -169,9 +169,9 @@

             var request = new RestRequest(commandString);

-            IRestResponse<TClass> response = client.Execute<TClass>(request);
-
-
+            var response = client.Execute<T>(request);
+
+            return response.Data;
         }

         /// <summary>


Added APIPost base class

Added APIPost base class

--- StockFighter/APIWrapper.cs
+++ StockFighter/APIWrapper.cs
@@ -352,4 +352,12 @@
         /// </summary>
         public string error { get; set; }
     }
+
+    /// <summary>
+    /// Base class for all Post requests. Should be used for commonalities.
+    /// </summary>
+    public class APIPost
+    {
+
+    }
 }


Add new ConstructWith overload which doesn't flatten nested tuples; change others to delegate

--- Sawmill/RewriterBuilder.cs
+++ Sawmill/RewriterBuilder.cs
@@ -369,6 +369,30 @@
         /// <summary>
         /// Rebuild the subtype with the supplied function.
         /// </summary>
+        public static IRewriter<TBase> ConstructWith<T, TBase, TSub>(
+            this RewriterBuilderCase<T, TBase, TSub> builder,
+            Func<T, TSub> constructor
+        ) where TSub : TBase
+        {
+            if (builder == null)
+            {
+                throw new ArgumentNullException(nameof(builder));
+            }
+            if (constructor == null)
+            {
+                throw new ArgumentNullException(nameof(constructor));
+            }
+            return new CompletedRewriterBuilderCase<T, TBase, TSub>(
+                builder.GetChildrenDelegates.ToArray(),
+                builder.GetSetChildrenCtorArgs,
+                constructor,
+                builder.ChildrenCount
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function.
+        /// </summary>
         public static IRewriter<TBase> ConstructWith<TBase, TSub>(
             this RewriterBuilderCase<object, TBase, TSub> builder,
             Func<TSub> constructor
@@ -382,16 +406,13 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<object, TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
-                args => constructor(),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+            return builder.ConstructWith(
+                args => constructor()
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, TBase, TSub>(
             this RewriterBuilderCase<(object, U1), TBase, TSub> builder,
@@ -406,18 +427,15 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<(object, U1), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
-                args => constructor(
-                    args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+            return builder.ConstructWith(
+                args => constructor(
+                    args.Item2
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, TBase, TSub>(
             this RewriterBuilderCase<((object, U1), U2), TBase, TSub> builder,
@@ -432,19 +450,16 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<((object, U1), U2), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, U3, TBase, TSub>(
             this RewriterBuilderCase<(((object, U1), U2), U3), TBase, TSub> builder,
@@ -459,20 +474,17 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<(((object, U1), U2), U3), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item1.Item2,
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, U3, U4, TBase, TSub>(
             this RewriterBuilderCase<((((object, U1), U2), U3), U4), TBase, TSub> builder,
@@ -487,21 +499,18 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<((((object, U1), U2), U3), U4), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item1.Item1.Item2,
                     args.Item1.Item1.Item2,
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, U3, U4, U5, TBase, TSub>(
             this RewriterBuilderCase<(((((object, U1), U2), U3), U4), U5), TBase, TSub> builder,
@@ -516,22 +525,19 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<(((((object, U1), U2), U3), U4), U5), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item1.Item1.Item1.Item2,
                     args.Item1.Item1.Item1.Item2,
                     args.Item1.Item1.Item2,
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, U3, U4, U5, U6, TBase, TSub>(
             this RewriterBuilderCase<((((((object, U1), U2), U3), U4), U5), U6), TBase, TSub> builder,
@@ -546,9 +552,7 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<((((((object, U1), U2), U3), U4), U5), U6), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item1.Item1.Item1.Item1.Item2,
                     args.Item1.Item1.Item1.Item1.Item2,
@@ -556,13 +560,12 @@
                     args.Item1.Item1.Item2,
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, U3, U4, U5, U6, U7, TBase, TSub>(
             this RewriterBuilderCase<(((((((object, U1), U2), U3), U4), U5), U6), U7), TBase, TSub> builder,
@@ -577,9 +580,7 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<(((((((object, U1), U2), U3), U4), U5), U6), U7), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item1.Item1.Item1.Item1.Item1.Item2,
                     args.Item1.Item1.Item1.Item1.Item1.Item2,
@@ -588,13 +589,12 @@
                     args.Item1.Item1.Item2,
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
-            );
-        }
-
-        /// <summary>
-        /// Rebuild the subtype with the supplied function.
+                )
+            );
+        }
+
+        /// <summary>
+        /// Rebuild the subtype with the supplied function, after flattening the tuple.
         /// </summary>
         public static IRewriter<TBase> ConstructWith<U1, U2, U3, U4, U5, U6, U7, U8, TBase, TSub>(
             this RewriterBuilderCase<((((((((object, U1), U2), U3), U4), U5), U6), U7), U8), TBase, TSub> builder,
@@ -609,9 +609,7 @@
             {
                 throw new ArgumentNullException(nameof(constructor));
             }
-            return new CompletedRewriterBuilderCase<((((((((object, U1), U2), U3), U4), U5), U6), U7), U8), TBase, TSub>(
-                builder.GetChildrenDelegates.ToArray(),
-                builder.GetSetChildrenCtorArgs,
+            return builder.ConstructWith(
                 args => constructor(
                     args.Item1.Item1.Item1.Item1.Item1.Item1.Item1.Item2,
                     args.Item1.Item1.Item1.Item1.Item1.Item1.Item2,
@@ -621,8 +619,7 @@
                     args.Item1.Item1.Item2,
                     args.Item1.Item2,
                     args.Item2
-                ),
-                builder.ChildrenCount
+                )
             );
         }
     }


check Player._debuffList for null

check Player._debuffList for null

--- TCC.Core/Data/Pc/Player.cs
+++ TCC.Core/Data/Pc/Player.cs
@@ -272,7 +272,7 @@

             }
         }
-        public bool IsDebuffed => _debuffList.Count != 0;
+        public bool IsDebuffed => _debuffList?.Count != 0;
         public bool IsInCombat
         {
             get => _isInCombat;


With camera flipped also gradient bg texture needs flipped.

--- Shaders/RhinoBackground.cs
+++ Shaders/RhinoBackground.cs
@@ -362,9 +362,9 @@

 					gradient_colorramp279.ColorBand.Stops.Clear();
 					// bottom color on 0.0f
-					gradient_colorramp279.ColorBand.InsertColorStop(m_original_background.Color2AsFloat4, 0.0f);
+					gradient_colorramp279.ColorBand.InsertColorStop(m_original_background.Color2AsFloat4, 1.0f);
 					// top color on 1.0f
-					gradient_colorramp279.ColorBand.InsertColorStop(m_original_background.Color1AsFloat4, 1.0f);
+					gradient_colorramp279.ColorBand.InsertColorStop(m_original_background.Color1AsFloat4, 0.0f);

 					// rotate the window vector
 					gradienttexture278.Rotation = RenderEngine.CreateFloat4(0.0, 0.0, 1.570796);


Partially implement Sprite

Partially implement Sprite

It's missing the image/pixel loading aspect at the moment. Since it
depends on the renderer that is going to be used.

--- src/Rs317.Library/Sprite.cs
+++ src/Rs317.Library/Sprite.cs
@@ -1,7 +1,16 @@
+
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Net.Mime;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.Advanced;
+using SixLabors.ImageSharp.PixelFormats;

 public sealed class Sprite : DrawingArea
 {
-	public int pixels[];
+	public int[] pixels;

 	public int width;

@@ -23,7 +32,7 @@
 		maxWidth = indexStream.getUnsignedLEShort();
 		maxHeight = indexStream.getUnsignedLEShort();
 		int length = indexStream.getUnsignedByte();
-		int pixels[] = new int[length];
+		int[] pixels = new int[length];
 		for(int p = 0; p < length - 1; p++)
 		{
 			pixels[p + 1] = indexStream.get3Bytes();
@@ -64,29 +73,26 @@
 		}
 	}

-	public Sprite(byte abyte0[], Component component)
+	public Sprite(byte[] abyte0, Component component)
 	{
 		try
 		{
-			// Image image =
-			// Toolkit.getDefaultToolkit().getImage(signlink.findcachedir()+"mopar.jpg");
-			Image image = Toolkit.getDefaultToolkit().createImage(abyte0);
-			MediaTracker mediatracker = new MediaTracker(component);
-			mediatracker.addImage(image, 0);
-			mediatracker.waitForAll();
-			width = image.getWidth(component);
-			height = image.getHeight(component);
-			maxWidth = width;
-			maxHeight = height;
-			offsetX = 0;
-			offsetY = 0;
-			pixels = new int[width * height];
-			PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, width, height, pixels, 0, width);
-			pixelgrabber.grabPixels();
+			/*using(Image<Rgba32> loadedImage = Image.Load(new MemoryStream(abyte0)))
+			{
+				width = loadedImage.Width;
+				height = loadedImage.Height;
+				maxWidth = width;
+				maxHeight = height;
+				offsetX = 0;
+				offsetY = 0;
+
+				//TODO: Let's try to avoid an allocation here.
+				pixels = loadedImage.GetPixelSpan().ToArray().Select(p => );
+			}*/
 		}
 		catch(Exception _ex)
 		{
-			System.out.println("Error converting jpg");
+			Console.WriteLine("Error converting jpg");
 		}
 	}

@@ -100,7 +106,7 @@

 	public void adjustRGB(int adjustmentR, int adjustmentG, int adjustmentB)
 	{
-		for(int pixel = 0; pixel < pixels.length; pixel++)
+		for(int pixel = 0; pixel < pixels.Length; pixel++)
 		{
 			int originalColour = pixels[pixel];
 			if(originalColour != 0)
@@ -130,7 +136,7 @@
 	}

 	private void blockCopy(int destinationPointer, int copyLength, int k, int sourceBlockLength, int sourcePointer,
-			int destinationBlockLength, int source[], int destination[])
+			int destinationBlockLength, int[] source, int[] destination)
 	{
 		int blockCount = -(copyLength >> 2);
 		copyLength = -(copyLength & 3);
@@ -152,7 +158,7 @@
 		}
 	}

-	private void blockCopyAlpha(int sourcePointer, int blockCount, int destination[], int source[],
+	private void blockCopyAlpha(int sourcePointer, int blockCount, int[] destination, int[] source,
 			int sourceBlockLength, int i1, int destinationBlockLength, int alpha, int destinationPointer)
 	{
 		int sourceValue;// was parameter
@@ -165,7 +171,7 @@
 				if(sourceValue != 0)
 				{
 					int destinationValue = destination[destinationPointer];
-					destination[destinationPointer++] = ((sourceValue & 0xff00ff) * alpha
+					destination[destinationPointer++] = (int)((sourceValue & 0xff00ff) * alpha
 							+ (destinationValue & 0xff00ff) * destinationAlpha & 0xff00ff00)
 							+ ((sourceValue & 0xff00) * alpha + (destinationValue & 0xff00) * destinationAlpha
 									& 0xff0000) >> 8;
@@ -181,7 +187,7 @@
 		}
 	}

-	private void blockCopyTransparent(int destination[], int source[], int sourcePointer, int destinationPointer,
+	private void blockCopyTransparent(int[] destination, int[] source, int sourcePointer, int destinationPointer,
 			int copyLength, int i1, int destinationBlockLength, int sourceBlockLength)
 	{
 		int value;// was parameter
@@ -410,7 +416,7 @@
 		}
 	}

-	private void method355(int ai[], int i, byte abyte0[], int j, int ai1[], int k, int l, int i1, int j1, int k1)
+	private void method355(int[] ai, int i, byte[] abyte0, int j, int[] ai1, int k, int l, int i1, int j1, int k1)
 	{
 		int l1 = -(i >> 2);
 		i = -(i & 3);
@@ -468,8 +474,8 @@
 		{
 			int i2 = -width / 2;
 			int j2 = -height / 2;
-			int k2 = (int)(Math.sin(rotation) * 65536D);
-			int l2 = (int)(Math.cos(rotation) * 65536D);
+			int k2 = (int)(Math.Sin(rotation) * 65536D);
+			int l2 = (int)(Math.Cos(rotation) * 65536D);
 			k2 = k2 * hingeSize >> 8;
 			l2 = l2 * hingeSize >> 8;
 			int i3 = (centreX << 16) + (j2 * k2 + i2 * l2);
@@ -502,15 +508,15 @@
 		}
 	}

-	public void rotate(int height, int rotation, int widthMap[], int hingeSize, int ai1[], int centreY, int y, int x,
+	public void rotate(int height, int rotation, int[] widthMap, int hingeSize, int[] ai1, int centreY, int y, int x,
 			int width, int centreX)
 	{
 		try
 		{
 			int negativeCentreX = -width / 2;
 			int negativeCentreY = -height / 2;
-			int offsetY = (int)(Math.sin(rotation / 326.11000000000001D) * 65536D);
-			int offsetX = (int)(Math.cos(rotation / 326.11000000000001D) * 65536D);
+			int offsetY = (int)(Math.Sin(rotation / 326.11000000000001D) * 65536D);
+			int offsetX = (int)(Math.Cos(rotation / 326.11000000000001D) * 65536D);
 			offsetY = offsetY * hingeSize >> 8;
 			offsetX = offsetX * hingeSize >> 8;
 			int j3 = (centreX << 16) + (negativeCentreY * offsetY + negativeCentreX * offsetX);
@@ -542,10 +548,10 @@

 	public void trim()
 	{
-		int targetPixels[] = new int[maxWidth * maxHeight];
+		int[] targetPixels = new int[maxWidth * maxHeight];
 		for(int _y = 0; _y < height; _y++)
 		{
-			System.arraycopy(pixels, _y * width, targetPixels, _y + offsetY * maxWidth + offsetX, width);
+			System.Buffer.BlockCopy(pixels, _y * width, targetPixels, _y + offsetY * maxWidth + offsetX, width);
 		}

 		pixels = targetPixels;


pchplib: mt_rand

pchplib: mt_rand

--- src/Runtime/pchplib/Math.cs
+++ src/Runtime/pchplib/Math.cs
@@ -268,7 +268,6 @@

         public static int mt_rand()
         {
-            throw new NotImplementedException();
             return MTGenerator.Next();
         }


Insertion Sort

Insertion Sort


Fix incorrect TLS offset

Fix incorrect TLS offset

In the main thread both TLS offsets 0xC8 and 0xB8 (as of b2545) contain a pointer to the same allocator, but we didn't intend to access the one at 0xC8.


Basic navigation screen

Basic navigation screen

--- src/Sg.Web/SgWebSelfhost.cs
+++ src/Sg.Web/SgWebSelfhost.cs
@@ -143,13 +143,35 @@

         private static string NoSuchRepoPage(string repoPath)
         {
-            // TODO: a navigation page from here?
-            var sb = new StringBuilder();
-            sb.Append("<title>Not Found</title>");
-            sb.Append("
Not found
");
-            sb.Append("
The path at '"+repoPath+"' either does not exist, or is not part of a git repository
");
-            sb.Append("");
-            return sb.ToString();
+            var body = T.g("body");
+
+            if (Directory.Exists(repoPath)) { // navigation controls
+                var list = T.g("ul");
+                var up = Path.GetDirectoryName(repoPath);
+                if (up != null) list.Add (T.g("ol")["↩", T.g("a", "href",up)["Up"], T.g("br/")]);
+
+                foreach (var dir in Directory.GetDirectories(repoPath)) {
+                    var downName = Path.GetFileName(dir);
+                    list.Add(T.g("ol")[T.g("a", "href",dir)[downName]]);
+                }
+
+                body.Add(
+                    T.g("h1")["Navigation"],
+                    T.g("p")[repoPath],
+                    list
+                );
+            } else { // Not found message
+                body.Add(
+                    T.g("h1")["Not found"],
+                    T.g("p")["The path at '"+repoPath+"' either does not exist, or you don't have permission to view it"]
+                );
+            }
+
+            var page = T.g("html")[
+                T.g("head")[T.g("title")["No git repo found"]],
+                body
+            ];
+            return page.ToString();
         }

         static void WriteIcon(HttpListenerResponse rawResponse)


Added test to validate comments are no-op in signature validation

--- Tests/UnusualInputTests.cs
+++ Tests/UnusualInputTests.cs
@@ -1,4 +1,5 @@
 using Axinom.Cpix;
+using System;
 using System.IO;
 using System.Linq;
 using System.Text;
@@ -14,6 +15,70 @@
 	public sealed class UnusualInputTests
 	{
 		[Fact]
+		public void LoadDocument_WithXmlCommentsAddedAfterSigning_SuccessfullyValidatesSignature()
+		{
+			// The canonicalization we use excludes comments, so comments should have no effect on signature validity.
+
+			var document = new CpixDocument();
+			FillDocumentWithData(document);
+
+			document.Recipients.AddSignature(TestHelpers.Certificate4WithPrivateKey);
+			document.ContentKeys.AddSignature(TestHelpers.Certificate4WithPrivateKey);
+			document.UsageRules.AddSignature(TestHelpers.Certificate4WithPrivateKey);
+			document.SignedBy = TestHelpers.Certificate3WithPrivateKey;
+
+			var buffer = new MemoryStream();
+			document.Save(buffer);
+
+			// Let's now sprinkle comments all over the place.
+			var xmlDocument = new XmlDocument();
+
+			buffer.Position = 0;
+			xmlDocument.Load(buffer);
+
+			var namespaces = XmlHelpers.CreateCpixNamespaceManager(xmlDocument);
+
+			AddCommentAsChild(xmlDocument.DocumentElement);
+
+			AddCommentAsChild((XmlElement)xmlDocument.SelectSingleNode("/cpix:CPIX/cpix:DeliveryDataList", namespaces));
+			AddCommentAsChild((XmlElement)xmlDocument.SelectSingleNode("/cpix:CPIX/cpix:ContentKeyList", namespaces));
+			AddCommentAsChild((XmlElement)xmlDocument.SelectSingleNode("/cpix:CPIX/cpix:ContentKeyUsageRuleList", namespaces));
+
+			AddCommentAsChild((XmlElement)xmlDocument.SelectSingleNode("/cpix:CPIX/cpix:DeliveryDataList/cpix:DeliveryData", namespaces));
+			AddCommentAsChild((XmlElement)xmlDocument.SelectSingleNode("/cpix:CPIX/cpix:ContentKeyList/cpix:ContentKey", namespaces));
+			AddCommentAsChild((XmlElement)xmlDocument.SelectSingleNode("/cpix:CPIX/cpix:ContentKeyUsageRuleList/cpix:ContentKeyUsageRule", namespaces));
+
+			buffer.SetLength(0);
+
+			using (var writer = XmlWriter.Create(buffer, new XmlWriterSettings
+			{
+				Encoding = Encoding.UTF8,
+				CloseOutput = false,
+			}))
+			{
+				xmlDocument.Save(writer);
+			}
+
+			buffer.Position = 0;
+			document = CpixDocument.Load(buffer);
+
+			Assert.NotNull(document.SignedBy);
+			Assert.Equal(1, document.Recipients.SignedBy.Count());
+			Assert.Equal(1, document.ContentKeys.SignedBy.Count());
+			Assert.Equal(1, document.UsageRules.SignedBy.Count());
+
+			// And, of course, the data should still be there.
+			Assert.Equal(2, document.ContentKeys.Count);
+			Assert.Equal(2, document.Recipients.Count);
+			Assert.Equal(2, document.UsageRules.Count);
+		}
+
+		private static void AddCommentAsChild(XmlElement element)
+		{
+			element.AppendChild(element.OwnerDocument.CreateComment(Guid.NewGuid().ToString()));
+		}
+
+		[Fact]
 		public void LoadDocument_WithUtf16EncodedInput_Succeeds()
 		{
 			// We ensure that some non-ASCII text survives the encoding/decoding/signing process intact.


Fix help text

Fix help text

--- src/SyncReleases/Program.cs
+++ src/SyncReleases/Program.cs
@@ -48,7 +48,7 @@
                     "Options:",
                     { "h|?|help", "Display Help and exit", _ => {} },
                     { "r=|releaseDir=", "Path to a release directory to download to", v => releaseDir = v},
-                    { "u=|url=", "When pointing to GitHub, use the URL to the repository root page, else point to an existing RELEASES URL", v => repoUrl = v},
+                    { "u=|url=", "When pointing to GitHub, use the URL to the repository root page, else point to an existing remote Releases folder", v => repoUrl = v},
                     { "t=|token=", "The OAuth token to use as login credentials", v => token = v},
                 };


Handle CRC-32 element in SeekHead

Handle CRC-32 element in SeekHead

According to the specifications Top Level elements should include a CRC-32 element as a child segment. (http://matroska-org.github.io/matroska-specification/ordering.html)
A SeekHead is a top level element (https://matroska.org/technical/specs/index.html)
This patch handles a CRC-32 element if found in a SeekHead, don't return false otherwise the SeekHead is marked a corrupted and metadata is never written to the file while saving.

--- src/TagLib/Matroska/File.cs
+++ src/TagLib/Matroska/File.cs
@@ -744,6 +744,12 @@
 				EBMLreader ebml_seek = new EBMLreader(element, element.DataOffset + i);
 				MatroskaID matroska_id = ebml_seek.ID;

+				if (matroska_id == MatroskaID.CRC32) // Skip the CRC-32 element
+				{
+					i += ebml_seek.Size;
+					continue;
+				}
+
 				if (matroska_id != MatroskaID.Seek) return false; // corrupted SeekHead

 				ulong j = 0;


Don't allow empty strings in TryMatch

Don't allow empty strings in TryMatch

--- src/Txt.Core/TextScanner.cs
+++ src/Txt.Core/TextScanner.cs
@@ -131,17 +131,13 @@
             {
                 throw new ArgumentNullException(nameof(s));
             }
+            if (string.IsNullOrEmpty(s))
+            {
+                throw new ArgumentException($"Value cannot be empty. Test {nameof(Peek)} for -1 instead.", nameof(s));
+            }
             if (disposed)
             {
                 throw new ObjectDisposedException(nameof(TextScanner));
-            }
-            if (s.Length == 0)
-            {
-                if (textSource.Peek() == -1)
-                {
-                    return ScanResult.FromEndOfInput(s);
-                }
-                return ScanResult.FromMatch(string.Empty, s);
             }
             var offset = StartRecording();
             try


Avoid use of exceptions, fix directory type comparison

https://bugzilla.gnome.org/show_bug.cgi?id=619014

--- src/Utils/FileExtensions.cs
+++ src/Utils/FileExtensions.cs
@@ -19,32 +19,31 @@
 		public static bool CopyRecursive (this GLib.File source, GLib.File target, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback callback)
 		{
 			bool result = true;
-			try {
-				result = result && source.Copy (target, flags, cancellable, callback);
-			} catch (GLib.GException e) {
-				// copy recursively, assuming that source is a directory
-				// TODO: what is better: catching an exception each time a directory is copied or
-				// checking if source is a directory and/or checking here if
-				// error message == 'Can't recursively copy directory'?
-				GLib.FileType ft = source.QueryFileType (GLib.FileQueryInfoFlags.None, null);
-				if (ft.GetType () != GLib.FileType.Directory.GetType ())
-					throw e;
-
-				if (!target.Exists)
-					target.MakeDirectoryWithParents (null);
-
-				GLib.FileEnumerator fe = source.EnumerateChildren ("standard::*", GLib.FileQueryInfoFlags.None, null);
-				GLib.FileInfo fi = fe.NextFile ();
-				while (fi != null) {
-					GLib.File source_file = GLib.FileFactory.NewForPath (Path.Combine (source.Path, fi.Name));
-					GLib.File target_file = GLib.FileFactory.NewForPath (Path.Combine (target.Path, fi.Name));
-					Log.Debug (String.Format (Catalog.GetString("Copying {0} -> {1}"), source_file.Path, target_file.Path));
-					result = result && source_file.CopyRecursive(target_file, flags, cancellable, callback);
-					fi = fe.NextFile ();
-				}
-				fe.Close (cancellable);
+
+			GLib.FileType ft = source.QueryFileType (GLib.FileQueryInfoFlags.None, cancellable);
+
+			Log.Debug (Catalog.GetString("Try to copy {0} -> {1}"), source.Path, target.Path);
+
+			if (ft != GLib.FileType.Directory) {
+				Log.Debug (Catalog.GetString("Copying {0} -> {1}"), source.Path, target.Path);
+				return source.Copy (target, flags, cancellable, callback);
 			}

+			if (!target.Exists) {
+				Log.Debug ("Creating directory: "+target.Path);
+				result = result && target.MakeDirectoryWithParents (cancellable);
+			}
+
+			GLib.FileEnumerator fe = source.EnumerateChildren ("standard::name", GLib.FileQueryInfoFlags.None, cancellable);
+			GLib.FileInfo fi = fe.NextFile ();
+			while (fi != null) {
+				GLib.File source_file = GLib.FileFactory.NewForPath (Path.Combine (source.Path, fi.Name));
+				GLib.File target_file = GLib.FileFactory.NewForPath (Path.Combine (target.Path, fi.Name));
+				Log.Debug (Catalog.GetString("CopyRecursive {0} -> {1}"), source_file.Path, target_file.Path);
+				result = result && CopyRecursive(source_file, target_file, flags, cancellable, callback);
+				fi = fe.NextFile ();
+			}
+			fe.Close (cancellable);
 			return result;
 		}
 	}


CustomOverrides public property added - programmatic TinyMCE settings. See also: EditableRichTextAttribute, FreeTextArea.js

--- src/Framework/N2/Web/UI/WebControls/FreeTextArea.cs
+++ src/Framework/N2/Web/UI/WebControls/FreeTextArea.cs
@@ -1,121 +1,131 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Configuration;
-using System.Text;
-using System.Web.Hosting;
-using System.Web.UI.WebControls;
-using N2.Configuration;
-using N2.Resources;
-
-namespace N2.Web.UI.WebControls
-{
-	/// <summary>
-	/// A wrapper for the tinyMCE free text editor (http://tinymce.moxiecode.com).
-	/// </summary>
-	public class FreeTextArea : TextBox
-	{
-		static string configCssUrl;
-		static string configScriptUrl;
-		static NameValueCollection configSettings = new NameValueCollection();
-		static bool configEnabled = true;
-		static bool isInitalized = false;
-
-		public FreeTextArea()
-		{
-			TextMode = TextBoxMode.MultiLine;
-			CssClass = "freeTextArea";
-		}
-
-		public virtual bool EnableFreeTextArea
-		{
-			get { return (bool)(ViewState["EnableFreeTextArea"] ?? configEnabled); }
-			set { ViewState["EnableFreeTextArea"] = value; }
-		}
-
-		public virtual string DocumentBaseUrl
-		{
-			get { return (string)(ViewState["DocumentBaseUrl"]); }
-			set { ViewState["DocumentBaseUrl"] = value; }
-		}
-
-		protected override void OnInit(EventArgs e)
-		{
-			base.OnInit(e);
-
-			if (!isInitalized)
-			{
-				isInitalized = true;
-				var config = N2.Context.Current.Resolve<EditSection>();
-				if (config != null)
-				{
-					configCssUrl = Url.ResolveTokens(config.TinyMCE.CssUrl);
-					configScriptUrl = Url.ResolveTokens(config.TinyMCE.ScriptUrl);
-					configEnabled = config.TinyMCE.Enabled;
-					foreach (KeyValueConfigurationElement element in config.TinyMCE.Settings)
-					{
-						configSettings[element.Key] = element.Value;
-					}
-				}
-			}
-		}
-
-		protected override void OnPreRender(EventArgs e)
-		{
-			base.OnPreRender(e);
-
-			if (EnableFreeTextArea)
-			{
-				Register.JQuery(Page);
-				Register.TinyMCE(Page);
-				Register.JavaScript(Page, configScriptUrl ?? Url.ResolveTokens("{ManagementUrl}/Resources/Js/FreeTextArea.js"));
-
-				string script = string.Format("freeTextArea_init('{0}', {1});",
-					Url.Parse(Page.Engine().ManagementPaths.EditTreeUrl),
-					GetOverridesJson());
-				Page.ClientScript.RegisterStartupScript(GetType(), "FreeTextArea_" + ClientID, script, true);
-			}
-		}
-
-		protected virtual string GetOverridesJson()
-		{
-			IDictionary<string, string> overrides = new Dictionary<string, string>();
-			overrides["elements"] = ClientID;
-			overrides["content_css"] = configCssUrl ?? Url.ResolveTokens("{ManagementUrl}/Resources/Css/Editor.css");
-
-			string language = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
-			if (HostingEnvironment.VirtualPathProvider.FileExists(Url.ResolveTokens("{ManagementUrl}/Resources/tiny_mce/langs/" + language + ".js")))
-				overrides["language"] = language;
-
-			if (!string.IsNullOrEmpty(DocumentBaseUrl))
-				overrides["document_base_url"] = Page.ResolveUrl(DocumentBaseUrl);
-
-			foreach (string key in configSettings.AllKeys)
-				overrides[key] = configSettings[key];
-
-			return ToJsonString(overrides);
-		}
-
-		protected static string ToJsonString(IDictionary<string, string> collection)
-		{
-			var sb = new StringBuilder("{");
-
-			foreach (string key in collection.Keys)
-			{
-				string value = collection[key];
-				if (value == "true")
-					value = "true";
-				else if (value == "false")
-					value = "false";
-				else if (value == null)
-					value = "null";
-				else if (!value.StartsWith("[") && !value.StartsWith("{"))
-					value = "'" + value + "'";
-				sb.Append("'").Append(key).Append("': ").Append(value).Append(",");
-			}
-			if (sb.Length > 1)
-				sb.Length--; // remove trailing comma
-			return sb.Append("}").ToString();
-		}
-	}
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Text;
+using System.Web.Hosting;
+using System.Web.UI.WebControls;
+using N2.Configuration;
+using N2.Resources;
+
+namespace N2.Web.UI.WebControls
+{
+	/// <summary>
+	/// A wrapper for the tinyMCE free text editor (http://tinymce.moxiecode.com).
+	/// </summary>
+	public class FreeTextArea : TextBox
+	{
+		static string configCssUrl;
+		static string configScriptUrl;
+		static NameValueCollection configSettings = new NameValueCollection();
+		static bool configEnabled = true;
+		static bool isInitalized = false;
+                private Dictionary<string, string> customOverrides_ = new Dictionary<string, string>();
+
+		public FreeTextArea()
+		{
+			TextMode = TextBoxMode.MultiLine;
+			CssClass = "freeTextArea";
+		}
+
+		public virtual bool EnableFreeTextArea
+		{
+			get { return (bool)(ViewState["EnableFreeTextArea"] ?? configEnabled); }
+			set { ViewState["EnableFreeTextArea"] = value; }
+		}
+
+		public virtual string DocumentBaseUrl
+		{
+			get { return (string)(ViewState["DocumentBaseUrl"]); }
+			set { ViewState["DocumentBaseUrl"] = value; }
+		}
+
+                /// <summary> Custom TinyMCE config options </summary>
+                /// <remarks> Will override Web.config TinyMCE settings.
+                ///   See: http://tinymce.moxiecode.com/wiki.php/Configuration
+                /// </remarks>
+                public IDictionary<string, string> CustomOverrides { get { return customOverrides_; } }
+
+		protected override void OnInit(EventArgs e)
+		{
+			base.OnInit(e);
+
+			if (!isInitalized)
+			{
+				isInitalized = true;
+				var config = N2.Context.Current.Resolve<EditSection>();
+				if (config != null)
+				{
+					configCssUrl = Url.ResolveTokens(config.TinyMCE.CssUrl);
+					configScriptUrl = Url.ResolveTokens(config.TinyMCE.ScriptUrl);
+					configEnabled = config.TinyMCE.Enabled;
+					foreach (KeyValueConfigurationElement element in config.TinyMCE.Settings)
+					{
+						configSettings[element.Key] = element.Value;
+					}
+				}
+			}
+		}
+
+		protected override void OnPreRender(EventArgs e)
+		{
+			base.OnPreRender(e);
+
+			if (EnableFreeTextArea)
+			{
+				Register.JQuery(Page);
+				Register.TinyMCE(Page);
+				Register.JavaScript(Page, configScriptUrl ?? Url.ResolveTokens("{ManagementUrl}/Resources/Js/FreeTextArea.js"));
+
+				string script = string.Format("freeTextArea_init('{0}', {1});",
+					Url.Parse(Page.Engine().ManagementPaths.EditTreeUrl),
+					GetOverridesJson());
+				Page.ClientScript.RegisterStartupScript(GetType(), "FreeTextArea_" + ClientID, script, true);
+			}
+		}
+
+		protected virtual string GetOverridesJson()
+		{
+			IDictionary<string, string> overrides = new Dictionary<string, string>();
+			overrides["elements"] = ClientID;
+			overrides["content_css"] = configCssUrl ?? Url.ResolveTokens("{ManagementUrl}/Resources/Css/Editor.css");
+
+			string language = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
+			if (HostingEnvironment.VirtualPathProvider.FileExists(Url.ResolveTokens("{ManagementUrl}/Resources/tiny_mce/langs/" + language + ".js")))
+				overrides["language"] = language;
+
+			if (!string.IsNullOrEmpty(DocumentBaseUrl))
+				overrides["document_base_url"] = Page.ResolveUrl(DocumentBaseUrl);
+
+			foreach (string key in configSettings.AllKeys)
+				overrides[key] = configSettings[key];
+
+                        foreach (var item in CustomOverrides)
+				overrides[item.Key] = item.Value;
+
+			return ToJsonString(overrides);
+		}
+
+		protected static string ToJsonString(IDictionary<string, string> collection)
+		{
+			var sb = new StringBuilder("{");
+
+			foreach (string key in collection.Keys)
+			{
+				string value = collection[key];
+				if (value == "true")
+					value = "true";
+				else if (value == "false")
+					value = "false";
+				else if (value == null)
+					value = "null";
+				else if (!value.StartsWith("[") && !value.StartsWith("{"))
+					value = "'" + value + "'";
+				sb.Append("'").Append(key).Append("': ").Append(value).Append(",");
+			}
+			if (sb.Length > 1)
+				sb.Length--; // remove trailing comma
+			return sb.Append("}").ToString();
+		}
+	}
 }


added route type 717 - share taxi

added route type 717 - share taxi

--- src/GTFS/Entities/Enumerations/RouteTypeExtended.cs
+++ src/GTFS/Entities/Enumerations/RouteTypeExtended.cs
@@ -81,6 +81,7 @@
         RailReplacementBusService = 714,
         DemandandResponseBusService = 715,
         AllBusServices = 716,
+        ShareTaxiService = 717,
         TrolleybusService = 800,
         TramService = 900,
         CityTramService = 901,


Added `null` guards in BranchConfigurationCalculatorBranchConfigurationCalculato.LookupBranchConfiguration()`.

--- src/GitVersionCore/BranchConfigurationCalculator.cs
+++ src/GitVersionCore/BranchConfigurationCalculator.cs
@@ -4,6 +4,9 @@
     using System.Collections.Generic;
     using System.Linq;
     using System.Text.RegularExpressions;
+
+    using JetBrains.Annotations;
+
     using LibGit2Sharp;

     public class BranchConfigurationCalculator
@@ -35,10 +38,21 @@
             throw new Exception(string.Format(format, currentBranch.Name, string.Join(", ", matchingBranches.Select(b => b.Key))));
         }

-        static KeyValuePair<string, BranchConfig>[] LookupBranchConfiguration(Config config, Branch currentBranch)
+        static KeyValuePair<string, BranchConfig>[] LookupBranchConfiguration([NotNull] Config config, [NotNull] Branch currentBranch)
         {
+            if (config == null)
+            {
+                throw new ArgumentNullException("config");
+            }
+
+            if (currentBranch == null)
+            {
+                throw new ArgumentNullException("currentBranch");
+            }
+
             return config.Branches.Where(b => Regex.IsMatch(currentBranch.Name, "^" + b.Key, RegexOptions.IgnoreCase)).ToArray();
         }
+

         static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(bool onlyEvaluateTrackedBranches, IRepository repository, Commit currentCommit, Branch currentBranch, KeyValuePair<string, BranchConfig> keyValuePair, BranchConfig branchConfiguration, Config config, IList<Branch> excludedInheritBranches)
         {


Fix compilation bug

Fix compilation bug

--- src/Kephas.Core/Collections/CollectionExtensions.cs
+++ src/Kephas.Core/Collections/CollectionExtensions.cs
@@ -74,5 +74,4 @@
             return collection;
         }
     }
-}
 }


Consider MultiText empty if all contents are empty

This should be a fix for #131.

--- src/LfMerge.Core/LanguageForge/Model/LfMultiText.cs
+++ src/LfMerge.Core/LanguageForge/Model/LfMultiText.cs
@@ -11,7 +11,7 @@
 {
 	public class LfMultiText : Dictionary<string, LfStringField> // Note: NOT derived from LfFieldBase
 	{
-		public bool IsEmpty { get { return Count <= 0; } }
+		public bool IsEmpty { get { return (Count <= 0) || (this.All(kv => kv.Value == null || kv.Value.IsEmpty)); } }

 		public static LfMultiText FromFdoMultiString(IMultiAccessorBase other, ILgWritingSystemFactory wsManager)
 		{


Doc for showing external Dialogs (and add parameter to allow set the owner for it)

--- src/MahApps.Metro/Controls/Dialogs/DialogManager.cs
+++ src/MahApps.Metro/Controls/Dialogs/DialogManager.cs
@@ -533,9 +533,15 @@
             window.SetValue(MetroWindow.IsAnyDialogOpenPropertyKey, window.metroActiveDialogContainer.Children.Count > 0);
         }

-        public static BaseMetroDialog ShowDialogExternally(this BaseMetroDialog dialog)
-        {
-            Window win = SetupExternalDialogWindow(dialog);
+        /// <summary>
+        /// Create and show an external dialog.
+        /// </summary>
+        /// <param name="dialog">The dialog which will be shown externally.</param>
+        /// <param name="windowOwner">The owner for the external window. If it's null the main window will be use.</param>
+        /// <returns>The given dialog.</returns>
+        public static BaseMetroDialog ShowDialogExternally(this BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null)
+        {
+            Window win = SetupExternalDialogWindow(dialog, windowOwner);

             dialog.OnShown();
             win.Show();
@@ -543,9 +549,15 @@
             return dialog;
         }

-        public static BaseMetroDialog ShowModalDialogExternally(this BaseMetroDialog dialog)
-        {
-            Window win = SetupExternalDialogWindow(dialog);
+        /// <summary>
+        /// Create and show an external modal dialog.
+        /// </summary>
+        /// <param name="dialog">The dialog which will be shown externally.</param>
+        /// <param name="windowOwner">The owner for the external window. If it's null the main window will be use.</param>
+        /// <returns>The given dialog.</returns>
+        public static BaseMetroDialog ShowModalDialogExternally(this BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null)
+        {
+            Window win = SetupExternalDialogWindow(dialog, windowOwner);

             dialog.OnShown();
             win.ShowDialog();
@@ -569,9 +581,10 @@
             };
         }

-        private static Window SetupExternalDialogWindow(BaseMetroDialog dialog)
+        private static Window SetupExternalDialogWindow(BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null)
         {
             var win = CreateExternalWindow();
+            win.Owner = windowOwner ?? Application.Current.MainWindow;
             win.Width = SystemParameters.PrimaryScreenWidth;
             win.MinHeight = SystemParameters.PrimaryScreenHeight / 4.0;
             win.SizeToContent = SizeToContent.Height;


Tooltip: refactoring

Tooltip: refactoring

--- Unity/UI/TooltipTrigger.cs
+++ Unity/UI/TooltipTrigger.cs
@@ -4,6 +4,7 @@
 //       Allis Tauri <allista@gmail.com>
 //
 //  Copyright (c) 2019 Allis Tauri
+
 using UnityEngine;
 using UnityEngine.EventSystems;

@@ -14,9 +15,9 @@
         public string text;
         public float delay = 0.3f;
         public TooltipView.TooltipPosition position = TooltipView.TooltipPosition.BOTTOM;
-        float enterTime = -1;
+        private float enterTime = -1;

-        void Update()
+        private void Update()
         {
             if(enterTime < 0
                || Time.realtimeSinceStartup - enterTime < delay)


Improved zoomLevelCorrection.

Improved zoomLevelCorrection.

--- UniversalMapControl/Map.cs
+++ UniversalMapControl/Map.cs
@@ -287,7 +287,7 @@
             return rect;
         }

-        public virtual void ZoomToRect(ILocation l1, ILocation l2, double zoomCorrectionFactor = 0.9d)
+        public virtual void ZoomToRect(ILocation l1, ILocation l2, double zoomLevelCorrection = 0)
         {
             CartesianPoint c1 = ViewPortProjection.ToCartesian(l1);
             CartesianPoint c2 = ViewPortProjection.ToCartesian(l2);
@@ -299,7 +299,7 @@
             double fullZoomX = RenderSize.Width / rotatedBounds.Width;
             double fullZoomY = RenderSize.Height / rotatedBounds.Height;

-            double zoomLevel = ViewPortProjection.GetZoomLevel(Math.Min(fullZoomX, fullZoomY) * zoomCorrectionFactor);
+            double zoomLevel = ViewPortProjection.GetZoomLevel(Math.Min(fullZoomX, fullZoomY)) + zoomLevelCorrection;

             ViewPortCenter = new CartesianPoint((long)Math.Round(bounds.X + bounds.Width / 2d), (long)Math.Round(bounds.Y + bounds.Height / 2d));
             ZoomLevel = zoomLevel;


增加Win32委托处理工具

增加Win32委托处理工具

--- 01.Base/01.Common/Common/Win32Helper.cs
+++ 01.Base/01.Common/Common/Win32Helper.cs
@@ -17,107 +17,78 @@
         /// <summary>
         ///
         /// </summary>
-        public const Int32 GWL_STYLE = -16;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 SW_MAXIMIZE = 3;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 SWP_FRAMECHANGED = 0x0020;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 SWP_NOMOVE = 0x0002;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 SWP_NOSIZE = 0x0001;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 SWP_NOZORDER = 0x0004;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 WS_BORDER = (Int32)0x00800000L;
-        /// <summary>
-        ///
-        /// </summary>
-        public const Int32 WS_THICKFRAME = (Int32)0x00040000L;
-        /// <summary>
-        ///
-        /// </summary>
-        public IntPtr HWND_NOTOPMOST = new IntPtr(-2);
-        /// <summary>
-        ///
-        /// </summary>
         /// <param name="hObject"></param>
         /// <returns></returns>
         [DllImport("gdi32.dll", SetLastError = true)]
         public static extern bool DeleteObject(IntPtr hObject);
+
         /// <summary>
         ///
         /// </summary>
-        /// <param name="hWnd"></param>
-        /// <param name="nIndex"></param>
+        /// <param name="lpLibFileName"></param>
         /// <returns></returns>
-        [DllImport("user32.dll")]
-        public static extern Int32 GetWindowLong(IntPtr hWnd,
-            Int32 nIndex
-        );
+        [DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
+        public static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpLibFileName);

-        /// <summary>
-        /// 设置鼠标的坐标
-        /// </summary>
-        /// <param name="X"> 横坐标 </param>
-        /// <param name="Y"> 纵坐标 </param>
-        /// <returns></returns>
-
-        [DllImport("user32.dll")]
-        public static extern bool SetCursorPos(int X, int Y);
         /// <summary>
         ///
         /// </summary>
-        /// <param name="hWndChild"></param>
-        /// <param name="hWndNewParent"></param>
+        /// <param name="hModule"></param>
+        /// <param name="lpProcName"></param>
         /// <returns></returns>
-        [DllImport("user32.dll")]
-        public static extern IntPtr SetParent(IntPtr hWndChild,
-            IntPtr hWndNewParent
-        );
+        [DllImport("kernel32.dll", EntryPoint = "GetProcAddress")]
+        public static extern IntPtr GetProcAddress(IntPtr hModule, [MarshalAs(UnmanagedType.LPStr)] string lpProcName);
+
         /// <summary>
         ///
         /// </summary>
-        /// <param name="hWnd"></param>
-        /// <param name="nIndex"></param>
-        /// <param name="dwNewLong"></param>
+        /// <param name="hModule"></param>
         /// <returns></returns>
-        [DllImport("user32.dll")]
-        public static extern Int32 SetWindowLong(IntPtr hWnd,
-            Int32 nIndex,
-            Int32 dwNewLong
-        );
+        [DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
+        public static extern bool FreeLibrary(IntPtr hModule);
+
+        /// <summary>
+        /// 动态链接库-指针对象
+        /// </summary>
+        private IntPtr hLib;
+        /// <summary>
+        /// 是否回收完毕
+        /// </summary>
+        private bool _disposed;
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="DLLPath"></param>
+        public Win32Helper(String DLLPath)
+        {
+            hLib = LoadLibrary(DLLPath);
+        }
+
         /// <summary>
         ///
         /// </summary>
-        /// <param name="hWnd"></param>
-        /// <param name="hWndInsertAfter"></param>
-        /// <param name="X"></param>
-        /// <param name="Y"></param>
-        /// <param name="cx"></param>
-        /// <param name="cy"></param>
-        /// <param name="uFlags"></param>
-        /// <returns></returns>
-        [DllImport("user32.dll")]
-        public static extern Int32 SetWindowPos(IntPtr hWnd,
-            IntPtr hWndInsertAfter,
-            Int32 X,
-            Int32 Y,
-            Int32 cx,
-            Int32 cy,
-            UInt32 uFlags
-        );
+        ~Win32Helper()
+        {
+            FreeLibrary(hLib);
+        }
+
+        /// <summary>
+        /// 将要执行的函数转换为委托
+        /// </summary>
+        /// <param name="APIName"></param>
+        /// <param name="t"></param>
+        /// <returns></returns>
+        public Delegate Invoke(string APIName, Type t)
+        {
+            IntPtr api = GetProcAddress(hLib, APIName);
+            if (api == IntPtr.Zero)
+            {
+                return null;
+            }
+            else
+            {
+                return Marshal.GetDelegateForFunctionPointer(api, t);
+            }
+        }
     }
 }


Possessed.cs: Fix the bug of no comingout.

--- AIWolfPlayer/Possessed.cs
+++ AIWolfPlayer/Possessed.cs
@@ -20,9 +20,9 @@

         protected override void ChooseVoteCandidate()
         {
-            // 自分や死亡したエージェントを人狼と判定していて，生存している占い師は人狼候補
+            // 自分や殺されたエージェントを人狼と判定していて，生存している占い師は人狼候補
             var werewolves = DivinationList
-                .Where(j => j.Result == Species.WEREWOLF && (j.Target == Me || !Alive(j.Target))).Select(j => j.Agent);
+                .Where(j => j.Result == Species.WEREWOLF && (j.Target == Me || Killed(j.Target))).Select(j => j.Agent);
             // 対抗カミングアウトのエージェントは投票先候補
             var rivals = AliveOthers.Where(a => !werewolves.Contains(a) && GetCoRole(a) == Role.SEER);
             // 人狼と判定したエージェントは投票先候補
@@ -79,8 +79,8 @@

         public override string Talk()
         {
-            // 初日カミングアウト
-            if (!isCameout && Day == 0)
+            // 即占い師カミングアウト
+            if (!isCameout)
             {
                 TalkQueue.Enqueue(new Content(new ComingoutContentBuilder(Me, Role.SEER)));
                 isCameout = true;


Update

Update

--- Runtime/LibMono/Actor.cs
+++ Runtime/LibMono/Actor.cs
@@ -244,6 +244,14 @@
 			return ref entity;
 		}

+		public static Actor CreateFor(GameObject obj, bool pooled = false)
+		{
+			var actor = obj.transform.AddGetActor();
+			actor.isPooled = pooled;
+			actor.LaunchOnStart();
+			return actor;
+		}
+
 		public static Actor CreateFor(GameObject obj, HandleEntityComposer model, bool pooled = false)
 		{
 			var actor = obj.transform.AddGetActor();


Mark Rusty.WindowsAPI as non-CLS-compliant.

This fixes a lot of warnings. I think this is OK because it probably doesn't
make sense to use WindowsAPI. It might make sense to make it an internal
class, but I didn't want to do that because it'd be a breaking change.

--- Rusty/Windows/PInvoke.cs
+++ Rusty/Windows/PInvoke.cs
@@ -5,6 +5,7 @@

 namespace IronAHK.Rusty
 {
+    [CLSCompliant(false)]
     public partial class WindowsAPI
     {
         const string kernel32 = "kernel32.dll", shell32 = "shell32.dll", user32 = "user32.dll", version = "version.dll", winmm = "winmm.dll";


Make GetFirstSteamMasterID() fall back to SteamOwnerID in case no master users are specified

--- ArchiSteamFarm/Actions.cs
+++ ArchiSteamFarm/Actions.cs
@@ -434,7 +434,11 @@

 		internal void OnDisconnected() => HandledGifts.Clear();

-		private ulong GetFirstSteamMasterID() => Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderByDescending(steamID => steamID != Bot.SteamID).ThenBy(steamID => steamID).FirstOrDefault();
+		private ulong GetFirstSteamMasterID() {
+			ulong steamMasterID = Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Key != Bot.SteamID) && new SteamID(kv.Key).IsIndividualAccount && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderBy(steamID => steamID).FirstOrDefault();
+
+			return steamMasterID > 0 ? steamMasterID : (ASF.GlobalConfig.SteamOwnerID != 0) && new SteamID(ASF.GlobalConfig.SteamOwnerID).IsIndividualAccount ? ASF.GlobalConfig.SteamOwnerID : 0;
+		}

 		private static async Task LimitGiftsRequestsAsync() {
 			if (ASF.GiftsSemaphore == null) {


Fix up a log message. #245

Fix up a log message. #245

--- AtlasSSH/SSHConnection.cs
+++ AtlasSSH/SSHConnection.cs
@@ -183,8 +183,8 @@
             Trace.WriteLine("Initialization: prompt=" + prompt, "SSHConnection");
             if (prompt.Contains("\n"))
             {
-                Trace.WriteLine("Prmopt contains a \\n character: '{prompt}'");
-                throw new InvalidOperationException("Prmopt contains a \\n character: '{prompt}'");
+                Trace.WriteLine($"Prmopt contains a \\n character: '{prompt}'");
+                throw new InvalidOperationException($"Prmopt contains a \\n character: '{prompt}'");
             }
             return prompt;
         }


Wrote a homework

Wrote a homework

--- SecondTestApp/Program.cs
+++ SecondTestApp/Program.cs
@@ -5,7 +5,17 @@
     static void Main()
     {
         {
-            Console.WriteLine(DateTime.Now);
+            int a = 1;
+           for(int i = 2; i < 1000; i++)
+            {
+                a += 1;
+                if (a % 2 == 0)
+                {
+                    Console.WriteLine(-a);
+                }
+                else
+                    Console.WriteLine(a);
+            }

         }
     }


Make Re internal

Make Re internal

--- SemanticVersioning/Re.cs
+++ SemanticVersioning/Re.cs
@@ -2,7 +2,7 @@

 namespace SemanticVersioning
 {
-    public static class Re
+    internal static class Re
     {
         public static Regex Full = new Regex(ReSrc.Full, RegexOptions.Compiled);
         public static Regex Loose = new Regex(ReSrc.Loose, RegexOptions.Compiled);


* trunk/Site/Views/Search.cshtml

* trunk/Site/Views/Search.cshtml

--- Site/Views/Search.cshtml
+++ Site/Views/Search.cshtml
@@ -1,7 +1,4 @@
 @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
-@using Lucene.Net;
-@using Examine;
-@using Examine.LuceneEngine.SearchCriteria;

 @{
     Layout = "SW_Master.cshtml";
@@ -9,7 +6,7 @@

     int pageSize = 10; // How many items per page
     int page; // The page we are viewing
-    string searchTerm = Context.Request.QueryString["search"];
+    string searchTerm = Context.Request.QueryString["search"].ToLower();

     /* Set up parameters */

@@ -18,27 +15,21 @@
         page = 1;
     }

-    /* This is your basic query to select the nodes you want */
-
-    Examine.Providers.BaseSearchProvider baseSearchProvider = ExamineManager.Instance.DefaultSearchProvider;
-    IEnumerable<SearchResult> nodes = null;
-    //ISearchResults nodes = null;
-    Lucene.Net.Search.Searcher luceneSearcher = null;
+
     int totalNodes = 0;
     int totalPages = 0;

+    IEnumerable<IPublishedContent> nodes = null;
+
     if (!String.IsNullOrEmpty(searchTerm))
     {
-        //nodes = baseSearchProvider.Search(searchTerm, true);
-        var searchCriteria = Examine.ExamineManager.Instance.CreateSearchCriteria(Examine.SearchCriteria.BooleanOperation.And);
-
-        var query = searchCriteria.GroupedOr(
-            new string[] { "nodeName", "bodyText", "articleSummary"},searchTerm.Fuzzy(0.7f))
-            .Compile();
-
-        var results = baseSearchProvider.Search(query); //.OrderByDescending(x => x.Score)
-        luceneSearcher = ((Examine.LuceneEngine.SearchResults)results).LuceneSearcher;
-        nodes = results.OrderByDescending(x => x.Score);
+        var home = Model.Content.Ancestor();
+        nodes = home.Descendants().Where(n => n.DocumentTypeAlias != "Datefolder"
+                                        && n.DocumentTypeAlias != "Slide"
+                                        && n.DocumentTypeAlias != "Slideshow")
+                                  .Where(x =>
+                                       x.Name.ToLower().Contains(searchTerm) ||
+                                       x.GetPropertyValue<string>("bodyText").ToLower().Contains(searchTerm));

         totalNodes = nodes.Count();
         totalPages = (int)Math.Ceiling((double)totalNodes / (double)pageSize);
@@ -77,40 +68,30 @@
                 {

-
-                                @item.Fields["nodeName"]
+
+                                @item.Name

+
                         @{
                     string fieldName = "bodyText";
                     string searchHiglight = "";

-                    if (item.Fields.ContainsKey(fieldName))
+                    if (item.HasProperty(fieldName))
                     {
-                        string fieldValue = item.Fields[fieldName];
-                        searchHiglight = LuceneHighlightHelper.Instance.GetHighlight(fieldValue, fieldName, luceneSearcher, searchTerm);
+                        string fieldValue = item.GetPropertyValue<string>(fieldName);

-                        if (String.IsNullOrEmpty(searchHiglight))
-                        {
-                            searchHiglight = Umbraco.Truncate(fieldValue, 200).ToString();
-                        }
-                        else
-                        {
-                            searchHiglight = System.Text.RegularExpressions.Regex.Replace(searchHiglight, searchTerm, "" + searchTerm + "", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
-                        }
+                        fieldValue = Umbraco.StripHtml(fieldValue).ToString();
+                        searchHiglight = Umbraco.Truncate(fieldValue, 200).ToString();
+
+                        searchHiglight = System.Text.RegularExpressions.Regex.Replace(searchHiglight, searchTerm, "" + searchTerm + "", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
+
                     }
                         }

@Html.Raw(searchHiglight)

-
+

                 }

@@ -135,22 +116,23 @@

                 @Html.Raw(page == 1 ? "
" + library.GetDictionaryItem("firstpage") + "
"
-                                  : "
" + library.GetDictionaryItem("firstpage") + "
")
+                    : "
" + library.GetDictionaryItem("firstpage") + "
")
                 @Html.Raw(page == 1 ? "
" + library.GetDictionaryItem("prepage") + "
"
-                                  : "
" + library.GetDictionaryItem("prepage") + "
")
+                    : "
" + library.GetDictionaryItem("prepage") + "
")
                 @for (int p = 1; p < totalPages + 1; p++)
                 {
                     var selected = p == page ? " class=\"active\"" : "";

@p

                 }
                 @Html.Raw(page == totalPages ? "
" + library.GetDictionaryItem("nextpage") + "
"
-                                 : "
" + library.GetDictionaryItem("nextpage") + "
")
+                    : "
" + library.GetDictionaryItem("nextpage") + "
")
                 @Html.Raw(page == totalPages ? "
" + library.GetDictionaryItem("lastpage") + "
"
-                                 : "
" + library.GetDictionaryItem("lastpage") + "
")
+                    : "
" + library.GetDictionaryItem("lastpage") + "
")

-    @Html.Partial("ContentPanels", @Model.Content)
-
+
+

+


Added extra null check

Added extra null check

--- Calculators/Calculator.cs
+++ Calculators/Calculator.cs
@@ -795,7 +795,7 @@
             var valueLineTwo = "";
             var id = "";

-            var episodes = GetAllOwnedEpisodes();
+            var episodes = GetAllOwnedEpisodes().ToList();
             if (episodes.Any())
             {
                 var youngest = episodes.Aggregate((curMax, x) => (curMax == null || x.DateCreated > curMax.DateCreated ? x : curMax));
@@ -806,11 +806,11 @@

                     valueLineOne =
                         CheckMaxLength(numberOfTotalDays.Days == 0
-                            ? $"Today"
+                            ? "Today"
                             : $"{CheckForPlural("day", numberOfTotalDays.Days, "", "", false)} ago");

-                    valueLineTwo = CheckMaxLength($"{youngest.Series.Name} S{youngest.AiredSeasonNumber} E{youngest.IndexNumber} ");
+                    valueLineTwo = CheckMaxLength($"{youngest.Series?.Name} S{youngest.AiredSeasonNumber} E{youngest.IndexNumber} ");
                     id = youngest.Id.ToString();
                 }
             }


Fixed #346

Fixed #346

--- Client/Core/SystemCore.cs
+++ Client/Core/SystemCore.cs
@@ -197,9 +197,10 @@

         public static string GetUptime()
         {
-            int uptimeSec = Environment.TickCount/1000;
-            TimeSpan result = TimeSpan.FromSeconds(uptimeSec);
-            return string.Format("{0}d : {1}h : {2}m : {3}s", result.Days, result.Hours, result.Minutes, result.Seconds);
+            long ticks = Stopwatch.GetTimestamp();
+            double uptime = ((double)ticks) / Stopwatch.Frequency;
+            var uptimeSpan = TimeSpan.FromSeconds(uptime);
+            return string.Format("{0}d : {1}h : {2}m : {3}s", uptimeSpan.Days, uptimeSpan.Hours, uptimeSpan.Minutes, uptimeSpan.Seconds);
         }

         public static string GetUsername()


small refactor

small refactor

--- model/ZenVisitor.cs
+++ model/ZenVisitor.cs
@@ -59,12 +59,16 @@
 			_db.Tables.Add(t);
 		}

-		private string GetNodeTokenText(TSqlFragment fragment)
+		private static IEnumerable<TSqlParserToken> GetNodesInFragment(TSqlFragment fragment) {
+			return Enumerable.Range(fragment.FirstTokenIndex, fragment.LastTokenIndex - fragment.FirstTokenIndex).Select(x => fragment.ScriptTokenStream[x]);
+		}
+
+		private static string GetNodeTokenText(TSqlFragment fragment)
 		{
 			StringBuilder tokenText = new StringBuilder();
-			for (int counter = fragment.FirstTokenIndex; counter <= fragment.LastTokenIndex; counter++)
+			foreach (var token in GetNodesInFragment(fragment).Select(f => f.Text))
 			{
-				tokenText.Append(fragment.ScriptTokenStream[counter].Text);
+				tokenText.Append(token);
 			}

 			return tokenText.ToString();


Modified Add-SPOView to include Paged property

--- Commands/Lists/AddView.cs
+++ Commands/Lists/AddView.cs
@@ -45,7 +45,7 @@
             var list = List.GetList(SelectedWeb);
             if (list != null)
             {
-                var view = list.CreateView(Title, ViewType, Fields, RowLimit, SetAsDefault, Query, Paged, Personal);
+                var view = list.CreateView(Title, ViewType, Fields, RowLimit, SetAsDefault, Query, Personal, Paged);

                 WriteObject(view);
             }


decapitalized list

decapitalized list

--- Commands/Standard/list.cs
+++ Commands/Standard/list.cs
@@ -4,9 +4,9 @@

 namespace ReflectionCli
 {
-    public class List : ICommand
+    public class list : ICommand
     {
-        public List()
+        public list()
         {
             Console.WriteLine("Valid Commands:");

@@ -25,7 +25,7 @@
             });
         }

-        public List(string name)
+        public list(string name)
         {
             Console.WriteLine($"Valid Commands for {name}:");
             Program.ActiveAsm.ToList().ForEach(t =>


Restore original naming

Restore original naming

--- clipper_library/clipper.cs
+++ clipper_library/clipper.cs
@@ -4096,24 +4096,24 @@
 			}

 			double distSqrd = distance * distance;
-			OutPt currentOutPoint = outPts[0];
-			while (currentOutPoint.Idx == 0 && currentOutPoint.Next != currentOutPoint.Prev)
-			{
-				if (PointsAreClose(currentOutPoint.Pt, currentOutPoint.Prev.Pt, distSqrd))
-				{
-					currentOutPoint = ExcludeOp(currentOutPoint);
+			OutPt op = outPts[0];
+			while (op.Idx == 0 && op.Next != op.Prev)
+			{
+				if (PointsAreClose(op.Pt, op.Prev.Pt, distSqrd))
+				{
+					op = ExcludeOp(op);
 					cnt--;
 				}
-				else if (PointsAreClose(currentOutPoint.Prev.Pt, currentOutPoint.Next.Pt, distSqrd))
-				{
-					ExcludeOp(currentOutPoint.Next);
-					currentOutPoint = ExcludeOp(currentOutPoint);
+				else if (PointsAreClose(op.Prev.Pt, op.Next.Pt, distSqrd))
+				{
+					ExcludeOp(op.Next);
+					op = ExcludeOp(op);
 					cnt -= 2;
 				}
 				else
 				{
-					currentOutPoint.Idx = 1;
-					currentOutPoint = currentOutPoint.Next;
+					op.Idx = 1;
+					op = op.Next;
 				}
 			}

@@ -4122,19 +4122,19 @@
 			// the next point. The new middle point is very close to the new third point and so we collapse and remove the second point. We can remove and create
 			// a large flat on the edge of the circle.
 			HashSet<OutPt> removePoints = new HashSet<OutPt>();
-			OutPt loopStart = currentOutPoint;
+			OutPt loopStart = op;
 			bool first = true;
-			while ((first || currentOutPoint != loopStart)
-				&& currentOutPoint.Next != currentOutPoint.Prev)
-			{
-				if (SlopesNearCollinear(currentOutPoint.Prev.Pt, currentOutPoint.Pt, currentOutPoint.Next.Pt, distSqrd))
+			while ((first || op != loopStart)
+				&& op.Next != op.Prev)
+			{
+				if (SlopesNearCollinear(op.Prev.Pt, op.Pt, op.Next.Pt, distSqrd))
 				{
 					// we check if the new end point is collinear with all the points we already have accumulated.
 					// and collapse all the points in between
-					OutPt start = currentOutPoint.Prev; // -1
-					OutPt firstCheck = currentOutPoint; // 0
+					OutPt start = op.Prev; // -1
+					OutPt firstCheck = op; // 0
 					OutPt currentCheck = firstCheck; // 0
-					OutPt endCheck = currentOutPoint.Next; // 1
+					OutPt endCheck = op.Next; // 1
 					bool foundEnd = false;
 					while (!foundEnd
 						&& endCheck != start)
@@ -4166,11 +4166,11 @@
 						}
 					}

-					currentOutPoint = endCheck;
+					op = endCheck;
 				}
 				else
 				{
-					currentOutPoint = currentOutPoint.Next;
+					op = op.Next;
 				}

 				first = false;
@@ -4179,7 +4179,7 @@
 			// remove all the points that were collinear
 			foreach (OutPt remove in removePoints)
 			{
-				currentOutPoint = ExcludeOp(remove);
+				op = ExcludeOp(remove);
 				cnt--;
 			}

@@ -4187,8 +4187,8 @@
 			Path result = new Path(cnt);
 			for (int i = 0; i < cnt; ++i)
 			{
-				result.Add(currentOutPoint.Pt);
-				currentOutPoint = currentOutPoint.Next;
+				result.Add(op.Pt);
+				op = op.Next;
 			}
 			outPts = null;
 			return result;