Lucene.Net.Core.Search.FilteredQuery refactor: renamed fields camelCase

--- src/Lucene.Net.Core/Search/FilteredQuery.cs
+++ src/Lucene.Net.Core/Search/FilteredQuery.cs
@@ -38,8 +38,8 @@
     /// <seealso cref=     CachingWrapperFilter </seealso>
     public class FilteredQuery : Query
     {
-        private readonly Query Query_Renamed; // LUCENENET TODO: Rename (private)
-        private readonly Filter Filter_Renamed; // LUCENENET TODO: Rename (private)
+        private readonly Query query;
+        private readonly Filter filter;
         private readonly FilterStrategy strategy;

         /// <summary>
@@ -71,8 +71,8 @@
                 throw new System.ArgumentException("FilterStrategy can not be null");
             }
             this.strategy = strategy;
-            this.Query_Renamed = query;
-            this.Filter_Renamed = filter;
+            this.query = query;
+            this.filter = filter;
         }

         /// <summary>
@@ -81,20 +81,20 @@
         /// </summary>
         public override Weight CreateWeight(IndexSearcher searcher)
         {
-            Weight weight = Query_Renamed.CreateWeight(searcher);
+            Weight weight = query.CreateWeight(searcher);
             return new WeightAnonymousInnerClassHelper(this, weight);
         }

         private class WeightAnonymousInnerClassHelper : Weight
         {
-            private readonly FilteredQuery OuterInstance;
-
-            private Lucene.Net.Search.Weight Weight;
+            private readonly FilteredQuery outerInstance;
+
+            private Lucene.Net.Search.Weight weight;

             public WeightAnonymousInnerClassHelper(FilteredQuery outerInstance, Lucene.Net.Search.Weight weight)
             {
-                this.OuterInstance = outerInstance;
-                this.Weight = weight;
+                this.outerInstance = outerInstance;
+                this.weight = weight;
             }

             public override bool ScoresDocsOutOfOrder
@@ -104,18 +104,18 @@

             public override float GetValueForNormalization()
             {
-                return Weight.GetValueForNormalization() * OuterInstance.Boost * OuterInstance.Boost; // boost sub-weight
+                return weight.GetValueForNormalization() * outerInstance.Boost * outerInstance.Boost; // boost sub-weight
             }

             public override void Normalize(float norm, float topLevelBoost)
             {
-                Weight.Normalize(norm, topLevelBoost * OuterInstance.Boost); // incorporate boost
+                weight.Normalize(norm, topLevelBoost * outerInstance.Boost); // incorporate boost
             }

             public override Explanation Explain(AtomicReaderContext ir, int i)
             {
-                Explanation inner = Weight.Explain(ir, i);
-                Filter f = OuterInstance.Filter_Renamed;
+                Explanation inner = weight.Explain(ir, i);
+                Filter f = outerInstance.filter;
                 DocIdSet docIdSet = f.GetDocIdSet(ir, ir.AtomicReader.LiveDocs);
                 DocIdSetIterator docIdSetIterator = docIdSet == null ? DocIdSetIterator.Empty() : docIdSet.GetIterator();
                 if (docIdSetIterator == null)
@@ -139,38 +139,38 @@
             {
                 get
                 {
-                    return OuterInstance;
+                    return outerInstance;
                 }
             }

             // return a filtering scorer
             public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
             {
-                Debug.Assert(OuterInstance.Filter_Renamed != null);
-
-                DocIdSet filterDocIdSet = OuterInstance.Filter_Renamed.GetDocIdSet(context, acceptDocs);
+                Debug.Assert(outerInstance.filter != null);
+
+                DocIdSet filterDocIdSet = outerInstance.filter.GetDocIdSet(context, acceptDocs);
                 if (filterDocIdSet == null)
                 {
                     // this means the filter does not accept any documents.
                     return null;
                 }

-                return OuterInstance.strategy.FilteredScorer(context, Weight, filterDocIdSet);
+                return outerInstance.strategy.FilteredScorer(context, weight, filterDocIdSet);
             }

             // return a filtering top scorer
             public override BulkScorer BulkScorer(AtomicReaderContext context, bool scoreDocsInOrder, Bits acceptDocs)
             {
-                Debug.Assert(OuterInstance.Filter_Renamed != null);
-
-                DocIdSet filterDocIdSet = OuterInstance.Filter_Renamed.GetDocIdSet(context, acceptDocs);
+                Debug.Assert(outerInstance.filter != null);
+
+                DocIdSet filterDocIdSet = outerInstance.filter.GetDocIdSet(context, acceptDocs);
                 if (filterDocIdSet == null)
                 {
                     // this means the filter does not accept any documents.
                     return null;
                 }

-                return OuterInstance.strategy.FilteredBulkScorer(context, Weight, scoreDocsInOrder, filterDocIdSet);
+                return outerInstance.strategy.FilteredBulkScorer(context, weight, scoreDocsInOrder, filterDocIdSet);
             }
         }

@@ -182,15 +182,15 @@
         /// </summary>
         private sealed class QueryFirstScorer : Scorer
         {
-            private readonly Scorer Scorer; // LUCENENET TODO: Rename (private)
-            private int ScorerDoc = -1; // LUCENENET TODO: Rename (private)
-            private readonly Bits FilterBits; // LUCENENET TODO: Rename (private)
+            private readonly Scorer scorer;
+            private int scorerDoc = -1;
+            private readonly Bits filterBits;

             internal QueryFirstScorer(Weight weight, Bits filterBits, Scorer other)
                 : base(weight)
             {
-                this.Scorer = other;
-                this.FilterBits = filterBits;
+                this.scorer = other;
+                this.filterBits = filterBits;
             }

             public override int NextDoc()
@@ -198,86 +198,86 @@
                 int doc;
                 for (; ; )
                 {
-                    doc = Scorer.NextDoc();
-                    if (doc == Scorer.NO_MORE_DOCS || FilterBits.Get(doc))
+                    doc = scorer.NextDoc();
+                    if (doc == Scorer.NO_MORE_DOCS || filterBits.Get(doc))
                     {
-                        return ScorerDoc = doc;
+                        return scorerDoc = doc;
                     }
                 }
             }

             public override int Advance(int target)
             {
-                int doc = Scorer.Advance(target);
-                if (doc != Scorer.NO_MORE_DOCS && !FilterBits.Get(doc))
-                {
-                    return ScorerDoc = NextDoc();
+                int doc = scorer.Advance(target);
+                if (doc != Scorer.NO_MORE_DOCS && !filterBits.Get(doc))
+                {
+                    return scorerDoc = NextDoc();
                 }
                 else
                 {
-                    return ScorerDoc = doc;
+                    return scorerDoc = doc;
                 }
             }

             public override int DocID
             {
-                get { return ScorerDoc; }
+                get { return scorerDoc; }
             }

             public override float Score()
             {
-                return Scorer.Score();
+                return scorer.Score();
             }

             public override int Freq
             {
-                get { return Scorer.Freq; }
+                get { return scorer.Freq; }
             }

             public override ICollection<ChildScorer> Children
             {
                 get
                 {
-                    return new[] { new ChildScorer(Scorer, "FILTERED") };
+                    return new[] { new ChildScorer(scorer, "FILTERED") };
                 }
             }

             public override long Cost()
             {
-                return Scorer.Cost();
+                return scorer.Cost();
             }
         }

         private class QueryFirstBulkScorer : BulkScorer
         {
-            private readonly Scorer Scorer; // LUCENENET TODO: Rename (private)
-            private readonly Bits FilterBits; // LUCENENET TODO: Rename (private)
+            private readonly Scorer scorer;
+            private readonly Bits filterBits;

             public QueryFirstBulkScorer(Scorer scorer, Bits filterBits)
             {
-                this.Scorer = scorer;
-                this.FilterBits = filterBits;
+                this.scorer = scorer;
+                this.filterBits = filterBits;
             }

             public override bool Score(Collector collector, int maxDoc)
             {
                 // the normalization trick already applies the boost of this query,
                 // so we can use the wrapped scorer directly:
-                collector.SetScorer(Scorer);
-                if (Scorer.DocID == -1)
-                {
-                    Scorer.NextDoc();
+                collector.SetScorer(scorer);
+                if (scorer.DocID == -1)
+                {
+                    scorer.NextDoc();
                 }
                 while (true)
                 {
-                    int scorerDoc = Scorer.DocID;
+                    int scorerDoc = scorer.DocID;
                     if (scorerDoc < maxDoc)
                     {
-                        if (FilterBits.Get(scorerDoc))
+                        if (filterBits.Get(scorerDoc))
                         {
                             collector.Collect(scorerDoc);
                         }
-                        Scorer.NextDoc();
+                        scorer.NextDoc();
                     }
                     else
                     {
@@ -285,7 +285,7 @@
                     }
                 }

-                return Scorer.DocID != Scorer.NO_MORE_DOCS;
+                return scorer.DocID != Scorer.NO_MORE_DOCS;
             }
         }

@@ -297,109 +297,109 @@
         /// </summary>
         private class LeapFrogScorer : Scorer
         {
-            private readonly DocIdSetIterator Secondary; // LUCENENET TODO: Rename (private)
-            private readonly DocIdSetIterator Primary; // LUCENENET TODO: Rename (private)
-            private readonly Scorer Scorer; // LUCENENET TODO: Rename (private)
-            protected int PrimaryDoc = -1;  // LUCENENET TODO: Rename (private)
-            protected int SecondaryDoc = -1; // LUCENENET TODO: Rename (private)
+            private readonly DocIdSetIterator secondary;
+            private readonly DocIdSetIterator primary;
+            private readonly Scorer scorer;
+            protected int m_primaryDoc = -1;
+            protected int m_secondaryDoc = -1;

             protected internal LeapFrogScorer(Weight weight, DocIdSetIterator primary, DocIdSetIterator secondary, Scorer scorer)
                 : base(weight)
             {
-                this.Primary = primary;
-                this.Secondary = secondary;
-                this.Scorer = scorer;
+                this.primary = primary;
+                this.secondary = secondary;
+                this.scorer = scorer;
             }

             private int AdvanceToNextCommonDoc()
             {
                 for (; ; )
                 {
-                    if (SecondaryDoc < PrimaryDoc)
+                    if (m_secondaryDoc < m_primaryDoc)
                     {
-                        SecondaryDoc = Secondary.Advance(PrimaryDoc);
+                        m_secondaryDoc = secondary.Advance(m_primaryDoc);
                     }
-                    else if (SecondaryDoc == PrimaryDoc)
+                    else if (m_secondaryDoc == m_primaryDoc)
                     {
-                        return PrimaryDoc;
+                        return m_primaryDoc;
                     }
                     else
                     {
-                        PrimaryDoc = Primary.Advance(SecondaryDoc);
+                        m_primaryDoc = primary.Advance(m_secondaryDoc);
                     }
                 }
             }

             public override sealed int NextDoc()
             {
-                PrimaryDoc = PrimaryNext();
+                m_primaryDoc = PrimaryNext();
                 return AdvanceToNextCommonDoc();
             }

             protected virtual int PrimaryNext()
             {
-                return Primary.NextDoc();
+                return primary.NextDoc();
             }

             public override sealed int Advance(int target)
             {
-                if (target > PrimaryDoc)
-                {
-                    PrimaryDoc = Primary.Advance(target);
+                if (target > m_primaryDoc)
+                {
+                    m_primaryDoc = primary.Advance(target);
                 }
                 return AdvanceToNextCommonDoc();
             }

             public override sealed int DocID
             {
-                get { return SecondaryDoc; }
+                get { return m_secondaryDoc; }
             }

             public override sealed float Score()
             {
-                return Scorer.Score();
+                return scorer.Score();
             }

             public override sealed int Freq
             {
-                get { return Scorer.Freq; }
+                get { return scorer.Freq; }
             }

             public override sealed ICollection<ChildScorer> Children
             {
                 get
                 {
-                    return new[] { new ChildScorer(Scorer, "FILTERED") };
+                    return new[] { new ChildScorer(scorer, "FILTERED") };
                 }
             }

             public override long Cost()
             {
-                return Math.Min(Primary.Cost(), Secondary.Cost());
+                return Math.Min(primary.Cost(), secondary.Cost());
             }
         }

         // TODO once we have way to figure out if we use RA or LeapFrog we can remove this scorer
         private sealed class PrimaryAdvancedLeapFrogScorer : LeapFrogScorer
         {
-            private readonly int FirstFilteredDoc; // LUCENENET TODO: Rename (private)
+            private readonly int firstFilteredDoc;

             internal PrimaryAdvancedLeapFrogScorer(Weight weight, int firstFilteredDoc, DocIdSetIterator filterIter, Scorer other)
                 : base(weight, filterIter, other, other)
             {
-                this.FirstFilteredDoc = firstFilteredDoc;
-                this.PrimaryDoc = firstFilteredDoc; // initialize to prevent and advance call to move it further
+                this.firstFilteredDoc = firstFilteredDoc;
+                this.m_primaryDoc = firstFilteredDoc; // initialize to prevent and advance call to move it further
             }

             protected override int PrimaryNext()
             {
-                if (SecondaryDoc != -1)
+                if (m_secondaryDoc != -1)
                 {
                     return base.PrimaryNext();
                 }
                 else
                 {
-                    return FirstFilteredDoc;
+                    return firstFilteredDoc;
                 }
             }
         }
@@ -411,12 +411,12 @@
         /// </summary>
         public override Query Rewrite(IndexReader reader)
         {
-            Query queryRewritten = Query_Renamed.Rewrite(reader);
-
-            if (queryRewritten != Query_Renamed)
+            Query queryRewritten = query.Rewrite(reader);
+
+            if (queryRewritten != query)
             {
                 // rewrite to a new FilteredQuery wrapping the rewritten query
-                Query rewritten = new FilteredQuery(queryRewritten, Filter_Renamed, strategy);
+                Query rewritten = new FilteredQuery(queryRewritten, filter, strategy);
                 rewritten.Boost = this.Boost;
                 return rewritten;
             }
@@ -433,7 +433,7 @@
         {
             get
             {
-                return Query_Renamed;
+                return query;
             }
         }

@@ -443,7 +443,7 @@
         {
             get
             {
-                return Filter_Renamed;
+                return filter;
             }
         }

@@ -469,9 +469,9 @@
         {
             StringBuilder buffer = new StringBuilder();
             buffer.Append("filtered(");
-            buffer.Append(Query_Renamed.ToString(s));
+            buffer.Append(query.ToString(s));
             buffer.Append(")->");
-            buffer.Append(Filter_Renamed);
+            buffer.Append(filter);
             buffer.Append(ToStringUtils.Boost(Boost));
             return buffer.ToString();
         }
@@ -490,7 +490,7 @@
             }
             Debug.Assert(o is FilteredQuery);
             FilteredQuery fq = (FilteredQuery)o;
-            return fq.Query_Renamed.Equals(this.Query_Renamed) && fq.Filter_Renamed.Equals(this.Filter_Renamed) && fq.strategy.Equals(this.strategy);
+            return fq.query.Equals(this.query) && fq.filter.Equals(this.filter) && fq.strategy.Equals(this.strategy);
         }

         /// <summary>
@@ -499,8 +499,8 @@
         {
             int hash = base.GetHashCode();
             hash = hash * 31 + strategy.GetHashCode();
-            hash = hash * 31 + Query_Renamed.GetHashCode();
-            hash = hash * 31 + Filter_Renamed.GetHashCode();
+            hash = hash * 31 + query.GetHashCode();
+            hash = hash * 31 + filter.GetHashCode();
             return hash;
         }

@@ -662,11 +662,11 @@

         private sealed class LeapFrogFilterStrategy : FilterStrategy
         {
-            private readonly bool ScorerFirst; // LUCENENET TODO: Rename (private)
+            private readonly bool scorerFirst;

             internal LeapFrogFilterStrategy(bool scorerFirst)
             {
-                this.ScorerFirst = scorerFirst;
+                this.scorerFirst = scorerFirst;
             }

             public override Scorer FilteredScorer(AtomicReaderContext context, Weight weight, DocIdSet docIdSet)
@@ -684,7 +684,7 @@
                     return null;
                 }

-                if (ScorerFirst)
+                if (scorerFirst)
                 {
                     return new LeapFrogScorer(weight, scorer, filterIter, scorer);
                 }


Irony-based version can now parse MinCaml

--- src/MinCamlSharp.Compiler/MinCamlGrammar.cs
+++ src/MinCamlSharp.Compiler/MinCamlGrammar.cs
@@ -1,13 +1,126 @@
-using Irony.Parsing;
+using System;
+using Irony.Parsing;

 namespace MinCamlSharp.Compiler
 {
+	/// <summary>
+	/// Based on https://github.com/steshaw/mincaml/blob/master/parser.mly
+	/// </summary>
 	[Language("MinCaml", "0.1", "Minimal subset of Objective Caml")]
 	public class MinCamlGrammar : Grammar
 	{
 		 public MinCamlGrammar()
 		 {
-
+			 // Terminals
+			 var LPAREN = ToTerm("(", "LParen");
+			 var RPAREN = ToTerm(")", "RParen");
+			 var TRUE = ToTerm("true", "True");
+			 var FALSE = ToTerm("false", "False");
+			 var NOT = ToTerm("not", "Not");
+			 var NUMBER = new NumberLiteral("Number")
+			 {
+				 DefaultFloatType = TypeCode.Single,
+				 DefaultIntTypes = new[] { TypeCode.Int32 }
+			 };
+			 var MINUS = ToTerm("-", "Minus");
+			 var PLUS = ToTerm("+", "Plus");
+			 var MINUS_DOT = ToTerm("-.", "MinusDot");
+			 var PLUS_DOT = ToTerm("+.", "PlusDot");
+			 var AST_DOT = ToTerm("*.", "AstDot");
+			 var SLASH_DOT = ToTerm("*.", "SlashDot");
+			 var EQUAL = ToTerm("=", "Equal");
+			 var LESS_GREATER = ToTerm("<>", "LessGreater");
+			 var LESS_EQUAL = ToTerm("<=", "LessEqual");
+			 var GREATER_EQUAL = ToTerm(">=", "GreaterEqual");
+			 var LESS = ToTerm("<", "Less");
+			 var GREATER = ToTerm(">", "Greater");
+			 var IF = ToTerm("if", "If");
+			 var THEN = ToTerm("then", "Then");
+			 var ELSE = ToTerm("else", "Else");
+			 var LET = ToTerm("let", "Let");
+			 var IN = ToTerm("in", "In");
+			 var REC = ToTerm("rec", "Rec");
+			 var COMMA = ToTerm(",", "Comma");
+			 var UNDERSCORE = ToTerm("_", "Underscore");
+			 var ARRAY_CREATE = ToTerm("Array.create", "Array.create");
+			 var DOT = ToTerm(".", "Dot");
+			 var LESS_MINUS = ToTerm("<-", "LessMinus");
+			 var SEMICOLON = ToTerm(";", "Semicolon");
+			 var IDENT = new IdentifierTerminal("Identifier")
+			 {
+				 AllFirstChars = "abcdefghijklmnopqrstuvwxyz",
+				 AllChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_"
+			 };
+
+			 var BlockComment = new CommentTerminal("BlockComment", "(*", "*)");
+			 NonGrammarTerminals.Add(BlockComment);
+
+			 // Non-terminals
+			 var boolean_literal = new NonTerminal("boolean_literal");
+			 boolean_literal.Rule = TRUE | FALSE;
+
+			 var exp = new NonTerminal("exp");
+
+			 var simpleExp = new NonTerminal("simple_exp");
+			 simpleExp.Rule =
+				 LPAREN + exp + RPAREN
+				 | LPAREN + RPAREN
+				 | boolean_literal
+				 | NUMBER
+				 | IDENT
+				 | simpleExp + DOT + LPAREN + exp + RPAREN;
+
+			 var formalArgs = new NonTerminal("formal_args");
+			 formalArgs.Rule =
+				 IDENT + formalArgs
+				 | IDENT;
+
+			 var fundef = new NonTerminal("fundef");
+			 fundef.Rule = IDENT + formalArgs + EQUAL + exp;
+
+			 var actualArgs = new NonTerminal("actual_args");
+			 actualArgs.Rule =
+				 actualArgs + simpleExp
+				 | simpleExp;
+
+			 var elems = new NonTerminal("elems");
+			 elems.Rule =
+				 elems + COMMA + exp
+				 | exp + COMMA + exp;
+
+			 var pat = new NonTerminal("pat");
+			 pat.Rule =
+				 pat + COMMA + IDENT
+				 | IDENT + COMMA + IDENT;
+
+			 exp.Rule =
+				simpleExp
+				| NOT + exp
+				| MINUS + exp
+				| exp + PLUS + exp
+				| exp + MINUS + exp
+				| exp + EQUAL + exp
+				| exp + LESS_GREATER + exp
+				| exp + LESS + exp
+				| exp + GREATER + exp
+				| exp + LESS_EQUAL + exp
+				| exp + GREATER_EQUAL + exp
+				| IF + exp + THEN + exp + ELSE + exp
+				| MINUS_DOT + exp
+				| exp + PLUS_DOT + exp
+				| exp + MINUS_DOT + exp
+				| exp + AST_DOT + exp
+				| exp + SLASH_DOT + exp
+				| LET + IDENT + EQUAL + exp + IN + exp
+				| LET + REC + fundef + IN + exp
+				| exp + actualArgs
+				| elems
+				| LET + LPAREN + pat + RPAREN + EQUAL + exp + IN + exp
+				| simpleExp + DOT + LPAREN + exp + RPAREN + LESS_MINUS + exp
+				| exp + SEMICOLON + exp
+				| ARRAY_CREATE + simpleExp + simpleExp;
+
+			 Root = exp;
 		 }
 	}
 }


Minor

Minor

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@3480

--- src/NHibernate/SqlCommand/SqlCommandInfo.cs
+++ src/NHibernate/SqlCommand/SqlCommandInfo.cs
@@ -1,4 +1,3 @@
-using System;
 using System.Data;
 using NHibernate.SqlTypes;

@@ -6,8 +5,8 @@
 {
 	public class SqlCommandInfo
 	{
-		private SqlString text;
-		private SqlType[] parameterTypes;
+		private readonly SqlString text;
+		private readonly SqlType[] parameterTypes;

 		public SqlCommandInfo(SqlString text, SqlType[] parameterTypes)
 		{


Fix build warnings

Fix build warnings

--- src/NerdBank.GitVersioning/GitExtensions.cs
+++ src/NerdBank.GitVersioning/GitExtensions.cs
@@ -178,7 +178,7 @@
         /// Looks up the commit that matches a specified version number.
         /// </summary>
         /// <param name="repo">The repository to search for a matching commit.</param>
-        /// <param name="version">The version previously obtained from <see cref="GetIdAsVersion(Commit, string)"/>.</param>
+        /// <param name="version">The version previously obtained from <see cref="GetIdAsVersion(Commit, string, int?)"/>.</param>
         /// <param name="repoRelativeProjectDirectory">
         /// The repo-relative project directory from which <paramref name="version"/> was originally calculated.
         /// </param>
@@ -196,7 +196,7 @@
         /// Looks up the commits that match a specified version number.
         /// </summary>
         /// <param name="repo">The repository to search for a matching commit.</param>
-        /// <param name="version">The version previously obtained from <see cref="GetIdAsVersion(Commit, string)"/>.</param>
+        /// <param name="version">The version previously obtained from <see cref="GetIdAsVersion(Commit, string, int?)"/>.</param>
         /// <param name="repoRelativeProjectDirectory">The repo-relative project directory from which <paramref name="version"/> was originally calculated.</param>
         /// <returns>The matching commits, or an empty enumeration if no match is found.</returns>
         public static IEnumerable<Commit> GetCommitsFromVersion(this Repository repo, Version version, string repoRelativeProjectDirectory = null)


Read Name separator

Read Name separator

--- src/Nest/Aggregations/AggregateFormatter.cs
+++ src/Nest/Aggregations/AggregateFormatter.cs
@@ -768,6 +768,7 @@
 				keyAsString = reader.ReadString();
 				reader.ReadNext(); // ,
 				reader.ReadNext(); // "doc_count"
+				reader.ReadNext(); // :
 			}

 			var docCount = reader.ReadInt64();


LogContext (OmniSharp.Script)

LogContext (OmniSharp.Script)

--- src/OmniSharp.Script/ScriptProjectSystem.cs
+++ src/OmniSharp.Script/ScriptProjectSystem.cs
@@ -45,7 +45,7 @@
             _compilationDependencyResolver = new CompilationDependencyResolver(type =>
             {
                 // Prefix with "OmniSharp" so that we make it through the log filter.
-                var categoryName = $"OmniSharp.{type.FullName}";
+                var categoryName = $"OmniSharp.Script.{type.FullName}";
                 var dependencyResolverLogger = loggerFactory.CreateLogger(categoryName);
                 return ((level, message) =>
                 {


simple pool

simple pool

--- src/Core/Pool.cs
+++ src/Core/Pool.cs
@@ -1,21 +1,27 @@
 using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Collections.Concurrent;

 namespace CnDream.Core
 {
     public abstract class Pool<T> : IPool<T>
     {
-        protected T[] FreeObjects;
+        protected ConcurrentBag<T> FreeObjects;

         public virtual T Acquire()
         {
-            throw new NotImplementedException();
+            if ( FreeObjects.TryTake(out var result) || CreateObject(out result) )
+            {
+                return result;
+            }
+            else
+            {
+                throw new NotImplementedException();
+            }
         }

         public virtual void Release( T t )
         {
-            throw new NotImplementedException();
+            FreeObjects.Add(t);
         }

         protected abstract bool CreateObject( out T obj );


Reserved some command result types for future use

--- src/Procon.Core.Shared/CommandResultType.cs
+++ src/Procon.Core.Shared/CommandResultType.cs
@@ -50,6 +50,14 @@
         /// <summary>
         /// A limit has been exceeded when attempting to execute the command.
         /// </summary>
-        LimitExceeded
+        LimitExceeded,
+        /// <summary>
+        /// The command is essentially canceled, but is continuing asynchronously.
+        /// </summary>
+        ContinuedAsynchronously,
+        /// <summary>
+        /// The command has times out while executing asynchronously
+        /// </summary>
+        TimeoutAsynchronously,
     }
 }


Fix Sign Ascii to UTF8

Fix Sign Ascii to UTF8

--- src/QlikConnectorPSExecute/CryptoManager.cs
+++ src/QlikConnectorPSExecute/CryptoManager.cs
@@ -81,8 +81,8 @@
                 var sig = Convert.FromBase64String(sign);
                 ISigner signer = SignerUtilities.GetSigner(algorithm);
                 signer.Init(false, PublicKey);
-
-                var msgBytes = Encoding.Default.GetBytes(data);
+
+                var msgBytes = Encoding.UTF8.GetBytes(data);
                 signer.BlockUpdate(msgBytes, 0, msgBytes.Length);
                 return signer.VerifySignature(sig);
             }
@@ -112,7 +112,7 @@
             rsa.ImportParameters(rsaParameters);

             var sha = new SHA256CryptoServiceProvider();
-            var hash = sha.ComputeHash(Encoding.ASCII.GetBytes(data));
+            var hash = sha.ComputeHash(Encoding.UTF8.GetBytes(data));
             var id = CryptoConfig.MapNameToOID(algorithm);
             var sig = rsa.SignHash(hash, id);


Added logging

Added logging

--- src/SuperGlue.Web.Output/TransformOutput.cs
+++ src/SuperGlue.Web.Output/TransformOutput.cs
@@ -1,38 +1,47 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Threading.Tasks;

 namespace SuperGlue.Web.Output
 {
-	using AppFunc = Func<IDictionary<string, object>, Task>;
+    using AppFunc = Func<IDictionary<string, object>, Task>;

-	public class TransformOutput
-	{
-		private readonly AppFunc _next;
+    public class TransformOutput
+    {
+        private readonly AppFunc _next;

-		public TransformOutput(AppFunc next)
-		{
-			if (next == null)
-				throw new ArgumentNullException(nameof(next));
+        public TransformOutput(AppFunc next)
+        {
+            if (next == null)
+                throw new ArgumentNullException(nameof(next));

-			_next = next;
-		}
+            _next = next;
+        }

-		public async Task Invoke(IDictionary<string, object> environment)
-		{
-			var transformers = environment.ResolveAll<ITransformOutput>();
+        public async Task Invoke(IDictionary<string, object> environment)
+        {
+            var transformers = environment.ResolveAll<ITransformOutput>().ToList();

-			var output = environment.GetOutputResult();
+            var output = environment.GetOutputResult();

-			if (output != null)
-			{
-				foreach (var transformer in transformers)
-					output = await transformer.Transform(output, environment).ConfigureAwait(false);
+            if (output == null)
+                environment.Log("Skipping transformers as we don't have any output", LogLevel.Debug);

-				environment.SetOutputResult(output);
-			}
+            if (output != null)
+            {
+                environment.Log($"Going to transform output using {transformers.Count} transformers", LogLevel.Debug);

-			await _next(environment).ConfigureAwait(false);
-		}
-	}
+                foreach (var transformer in transformers)
+                {
+                    output = await transformer.Transform(output, environment).ConfigureAwait(false);
+                    environment.Log($"Finished transforming using transformer {transformer.GetType().FullName}", LogLevel.Debug);
+                }
+
+                environment.SetOutputResult(output);
+            }
+
+            await _next(environment).ConfigureAwait(false);
+        }
+    }
 }


Refactoring

Refactoring

--- Applications/Rss/Reader/Models/Rss/RssOpml.cs
+++ Applications/Rss/Reader/Models/Rss/RssOpml.cs
@@ -172,6 +172,7 @@
             IRssEntry parent, IDictionary<Uri, RssFeed> filter) =>
             src.GetElements("outline")
                .Select(e => IsEntry(e) ? ToEntry(e, parent) : ToCategory(e, parent, filter))
+               .OfType<IRssEntry>()
                .Where(e => e is RssCategory rc && rc.Children.Count > 0 ||
                            e is RssEntry re && re.Uri != null && !filter.ContainsKey(re.Uri));

@@ -187,14 +188,16 @@
         /* ----------------------------------------------------------------- */
         private IRssEntry ToEntry(XElement src, IRssEntry parent)
         {
-            var uri = GetUri(src, "xmlUrl", default(Uri));
-            return new RssEntry(Context)
-            {
-                Parent = parent,
-                Uri    = uri,
-                Link   = GetUri(src, "htmlUrl", uri),
-                Title  = GetTitle(src, uri),
-            } as IRssEntry;
+            var uri = GetUri(src, "xmlUrl", null);
+            return uri == null ?
+                   default(IRssEntry) :
+                   new RssEntry(Context)
+                   {
+                       Parent = parent,
+                       Uri    = uri,
+                       Link   = GetUri(src, "htmlUrl", uri),
+                       Title  = GetTitle(src, uri.ToString()),
+                   };
         }

         /* ----------------------------------------------------------------- */
@@ -212,7 +215,7 @@
             var dest = new RssCategory(Context)
             {
                 Parent = parent,
-                Title  = (string)src.Attribute("title") ?? Properties.Resources.MessageNewCategory,
+                Title  = GetTitle(src, Properties.Resources.MessageNewCategory),
             };

             foreach (var item in Convert(src, dest, filter)) dest.Children.Add(item);
@@ -254,10 +257,9 @@
         /// </summary>
         ///
         /* ----------------------------------------------------------------- */
-        private string GetTitle(XElement src, Uri uri) =>
+        private string GetTitle(XElement src, string alternate) =>
             (string)src.Attribute("text")  ??
-            (string)src.Attribute("title") ??
-            uri?.ToString();
+            (string)src.Attribute("title") ?? alternate;

         #endregion


Text change in Lable for LT Gap Analysis chart

--- MOE.Common/Business/LeftTurnGapAnalysis/LeftTurnGapAnalysis.cs
+++ MOE.Common/Business/LeftTurnGapAnalysis/LeftTurnGapAnalysis.cs
@@ -72,7 +72,7 @@
                 (x.EventCode == EVENT_GREEN || x.EventCode == EVENT_RED)));

             var detectorsToUse = new List<Models.Detector>();
-            DetectionTypeStr = "Lane-By-Lane Count";
+            DetectionTypeStr = "Detector Type: Lane-By-Lane Count";

             //Use only lane-by-lane count detectors if they exists, otherwise check for stop bar
             detectorsToUse = approach.GetAllDetectorsOfDetectionType(4);
@@ -80,7 +80,7 @@
             if (!detectorsToUse.Any())
             {
                 detectorsToUse = approach.GetAllDetectorsOfDetectionType(6);
-                DetectionTypeStr = "Stop Bar Presence";
+                DetectionTypeStr = "Detector Type: Stop Bar Presence";

                 //If no detectors of either type for this approach, skip it
                 if (!detectorsToUse.Any())


Setting up the white screen at awake (maybe it's better)

--- Core/Camera2D.cs
+++ Core/Camera2D.cs
@@ -36,20 +36,11 @@
     }

-    void Start()
+    void Awake()
     {
         // The whiteScreen could be disabled to avoid click over it while working
         if (whiteScreen.gameObject.activeSelf == false)
             whiteScreen.gameObject.SetActive(true);
-
-
-        // Fix children layer
-        Transform[] children = GetComponentsInChildren<Transform>();
-        for (int i = 0; i < children.Length; i++)
-        {
-            if (children[i] == transform) continue;
-            children[i].localPosition = new Vector3(children[i].localPosition.x, children[i].localPosition.y, childrenZLayer);
-        }

         // White Screen adjustment
@@ -64,6 +55,18 @@
             }
         })
         .ttAdd(1).ttRepeat();
+    }
+
+
+    void Start()
+    {
+        // Fix children layer
+        Transform[] children = GetComponentsInChildren<Transform>();
+        for (int i = 0; i < children.Length; i++)
+        {
+            if (children[i] == transform) continue;
+            children[i].localPosition = new Vector3(children[i].localPosition.x, children[i].localPosition.y, childrenZLayer);
+        }
     }


Cleanup dead code

Cleanup dead code

--- src/TimeZoneNames.DataBuilder/Downloader.cs
+++ src/TimeZoneNames.DataBuilder/Downloader.cs
@@ -23,12 +23,6 @@
             await DownloadAsync(url3, Path.Combine(dir, @"common\supplemental"));
         }

-        public static async Task DownloadTzdbAsync(string dir)
-        {
-            const string url = "http://www.iana.org/time-zones/repository/tzdata-latest.tar.gz";
-            await DownloadAndExtractAsync(url, dir);
-        }
-
         public static async Task DownloadNzdAsync(string dir)
         {
             const string url = "http://nodatime.org/tzdb/latest.txt";
@@ -37,11 +31,6 @@
                 var dataUrl = (await result.Content.ReadAsStringAsync()).TrimEnd();
                 await DownloadAsync(dataUrl, dir);
             }
-        }
-
-        public static string GetTempDir()
-        {
-            return Path.GetTempPath() + Path.GetRandomFileName().Substring(0, 8);
         }

         private static async Task DownloadAsync(string url, string dir)


Convert an null reference to VlcInstance to IntPtr.Zero

--- src/Vlc.DotNet.Core.Interops/VlcInstance.cs
+++ src/Vlc.DotNet.Core.Interops/VlcInstance.cs
@@ -21,6 +21,9 @@

         public static implicit operator IntPtr(VlcInstance instance)
         {
+            if (instance == null)
+                return IntPtr.Zero;
+
             return instance.Pointer;
         }
     }


solved sorting issue

solved sorting issue

--- src/Web/Models/GroupedByInitialInBatches.cs
+++ src/Web/Models/GroupedByInitialInBatches.cs
@@ -17,7 +17,7 @@
 		public static IEnumerable<GroupedByInitialInBatches> Collection(IEnumerable<Snapshot> snapshots, Func<Snapshot, string> text, int batchSize)
 		{
 			return snapshots.GroupBy(i => text(i)[0])
-				.OrderBy(StringComparer.OrdinalIgnoreCase.Equals)
+				.OrderBy(g => g.Key, Comparer<char>.Default)
 				.Select(g => new GroupedByInitialInBatches(g, batchSize));
 		}
 	}


Typo on Ensure fixed

Typo on Ensure fixed

--- src/WebApiContrib/Caching/CachingHandler.cs
+++ src/WebApiContrib/Caching/CachingHandler.cs
@@ -171,7 +171,7 @@
 			};
 		}

-		private void EnusreRulesSetup()
+		private void EnsureRulesSetup()
 		{
 			if (RequestInterceptionRules == null)
 			{


Catch FormatException coming from Convert.ChangeType. (#1635)

String.TrimEnd has a new overload for a single char in .NET Core 2.0. However, when MSBuild encounters this new overload first, it throws a FormatException which is not caught - breaking the build.

The fix is to catch the FormatException just like an InvalidCastException and continue searching the rest of the reflection MethodInfos for a match.

Fix #1634

--- src/XMakeBuildEngine/Evaluation/Expander.cs
+++ src/XMakeBuildEngine/Evaluation/Expander.cs
@@ -3608,9 +3608,13 @@
                         }
                     }
                 }
+                // The coercion failed therefore we return null
                 catch (InvalidCastException)
                 {
-                    // The coercion failed therefore we return null
+                    return null;
+                }
+                catch (FormatException)
+                {
                     return null;
                 }


Reuse Cairo.ImageSurface instance until the window has been resized

--- src/Xwt.Sdl/Xwt.SdlBackend/WindowBackend.cs
+++ src/Xwt.Sdl/Xwt.SdlBackend/WindowBackend.cs
@@ -36,7 +36,7 @@
 		#region Properties
 		internal static Dictionary<uint, WeakReference> windowCache = new Dictionary<uint, WeakReference>();
 		IntPtr window;
-		SDL.SDL_Surface windowSurface;
+		Cairo.ImageSurface drawingSurface;

 		uint id;
 		public uint WindowId {get{return id;}}
@@ -70,7 +70,12 @@
 		#region Extension
 		void UpdateViewPort()
 		{
-			windowSurface = SDL_.SDL_GetWindowSurface (window);
+			var windowSurface = SDL_.SDL_GetWindowSurface (window);
+
+			if (drawingSurface != null)
+				drawingSurface.Dispose ();
+
+			drawingSurface = new Cairo.ImageSurface (windowSurface.pixels, Cairo.Format.RGB24, windowSurface.w, windowSurface.h, windowSurface.pitch);
 		}

 		public WidgetBackend GetWidgetAt(double x, double y)
@@ -326,23 +331,21 @@
 				return false;
 			redraw = false;

-			using (var cairoSurface = new Cairo.ImageSurface (windowSurface.pixels, Cairo.Format.RGB24, windowSurface.w, windowSurface.h, windowSurface.pitch))
-			using(var cctxt = new Cairo.Context (cairoSurface))
-			{
-				var ctxt = new CairoBackend.CairoContextBackend (1, cctxt, cairoSurface);
-				cctxt.SetSourceRGB (1, 1, 1);
-				cctxt.Rectangle (0, 0, Width, Height);
-				cctxt.Fill ();
+
+			using (var drawingContext = new Cairo.Context (drawingSurface)) {
+				var ctxt = new CairoBackend.CairoContextBackend (1, drawingContext, drawingSurface);
+
+				if (clearBackground || invalidatedRegion.X <= padding.X || invalidatedRegion.Y <= padding.Y) {
+					drawingContext.SetSourceRGB (1, 1, 1);
+					drawingContext.Paint ();
+					clearBackground = false;
+				}

 				if (menu != null)
 					menu.Draw (ctxt, Width);

 				if (child != null) {
-					child.Draw (ctxt, new Rectangle (
-						padding.Left,
-						padding.Top + menuHeight,
-						Width - padding.Right,
-						Height - menuHeight - padding.Bottom));
+					child.Draw (ctxt, invalidatedRegion);
 				}
 				SDL.SDL_UpdateWindowSurface (window);
 			}


Added dragging function, as well as drawing the temp item stack, not tested yet

--- Navier-Boats/Navier-Boats/Navier-Boats/Game/Entities/Player.cs
+++ Navier-Boats/Navier-Boats/Navier-Boats/Game/Entities/Player.cs
@@ -36,6 +36,8 @@

         private int selectedItemIndex;

+        private int secondSelectedItemIndex;
+
         private List<Rectangle> invItemRects;

         private ItemStack tempItemStack;
@@ -236,6 +238,49 @@
                         }
                     }
                 }
+                if (curInvState == InventoryState.dragging)
+                {
+                    if (mouseState.LeftButton == ButtonState.Released)
+                    {
+                        foreach (Rectangle temp in invItemRects)
+                        {
+                            if (temp.Contains(new Point(mouseState.X, mouseState.Y)))
+                            {
+                                secondSelectedItemIndex = invItemRects.IndexOf(temp);
+                            }
+                            if (secondSelectedItemIndex == selectedItemIndex)
+                            {
+                                Items.Items[selectedItemIndex] = tempItemStack;
+                                tempItemStack = null;
+                                curInvState = InventoryState.nothing;
+                            }
+                            else
+                            {
+                                if (Items.Items[secondSelectedItemIndex].Item == tempItemStack.Item)
+                                {
+                                    Items.Items[secondSelectedItemIndex].Amount += Items.Items[selectedItemIndex].Amount;
+                                    if (Items.Items[secondSelectedItemIndex].Amount > 32)
+                                    {
+                                        Items.Items[secondSelectedItemIndex].Amount = 32;
+                                    }
+                                    tempItemStack = null;
+                                    secondSelectedItemIndex = -1;
+                                    selectedItemIndex = -1;
+                                    curInvState = InventoryState.nothing;
+                                }
+                                else
+                                {
+                                    Items.Items[selectedItemIndex] = Items.Items[secondSelectedItemIndex];
+                                    Items.Items[secondSelectedItemIndex] = tempItemStack;
+                                    tempItemStack = null;
+                                    secondSelectedItemIndex = -1;
+                                    selectedItemIndex = -1;
+                                    curInvState = InventoryState.nothing;
+                                }
+                            }
+                        }
+                    }
+                }
                 if (keyState.IsKeyDown(Keys.I))
                 {
                     if (!firstFrameI)
@@ -385,6 +430,11 @@
                         }
                     }
                 }
+
+                if (tempItemStack != null)
+                {
+                    spriteBatch.Draw(tempItemStack.Item.ItemTexture, new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, (ConsoleVars.GetInstance().WindowHeight) / 11, (ConsoleVars.GetInstance().WindowHeight) / 11), Color.White);
+                }
             }
             else if (curState == PlayerState.dead)
             {


[Nodes] SwitchTexture2DNode tries to avoid n il output if switch pin has a single slice

--- Nodes/VVVV.DX11.Nodes/Nodes/Textures/2D/SwitchTexture2DNode.cs
+++ Nodes/VVVV.DX11.Nodes/Nodes/Textures/2D/SwitchTexture2DNode.cs
@@ -33,15 +33,37 @@

         public void Evaluate(int SpreadMax)
         {
-            this.FOutput.SliceCount = SpreadMax;
+

-            for (int i = 0; i < SpreadMax; i++)
+            if (this.FInSwitch.SliceCount == 1)
             {
-                int idx = VMath.Zmod(FInSwitch[i], FInputs.Count);
-
+                int idx = VMath.Zmod(FInSwitch[0], FInputs.Count);
                 var pin = FInputs[idx].IOObject;

-                this.FOutput[i] = pin.PluginIO.IsConnected ? pin[i] : new DX11Resource<DX11Texture2D>();
+                if (pin.SliceCount > 0)
+                {
+                    this.FOutput.SliceCount = pin.SliceCount;
+                    for (int i = 0; i < pin.SliceCount; i++)
+                    {
+                        this.FOutput[i] = pin.IsConnected ? pin[i] : new DX11Resource<DX11Texture2D>();
+                    }
+                }
+                else
+                {
+                    this.FOutput.SliceCount = SpreadMax;
+                }
+            }
+            else
+            {
+                this.FOutput.SliceCount = SpreadMax;
+                for (int i = 0; i < SpreadMax; i++)
+                {
+                    int idx = VMath.Zmod(FInSwitch[i], FInputs.Count);
+
+                    var pin = FInputs[idx].IOObject;
+
+                    this.FOutput[i] = pin.IsConnected ? pin[i] : new DX11Resource<DX11Texture2D>();
+                }
             }
         }


Revert "Fix for issue discussed in http://forum.pdfsharp.net/viewtopic.php?f=3&t=2381"

This reverts commit 5948137ec28a6299b36652afce10cf718c00812d.

Per thread discussion, this is unnecessary.

--- code/PdfSharp/PdfSharp.Drawing.Pdf/PdfGraphicsState.cs
+++ code/PdfSharp/PdfSharp.Drawing.Pdf/PdfGraphicsState.cs
@@ -23,7 +23,7 @@
 // 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
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 #endregion

@@ -52,10 +52,10 @@
   // of the product of all modifications. PDFlib uses this 'trick', but it does not work. Because of
   // rounding errors everything on the PDF page looks sloping after some resets. Saving and restoring
   // the graphics state is the only possible way to reset the CTM, but because the PDF restore operator
-  // 'Q' resets not only the CTM but all other graphics state values, we have to implement our own
-  // graphics state management. This is apparently the only safe way to give the XGrahics users the
+  // 'Q' resets not only the CTM but all other graphics state values, we have to implement our own
+  // graphics state management. This is apparently the only safe way to give the XGrahics users the
   // illusion that they can arbitrarily set the transformation matrix.
-  //
+  //
   // The current implementation is just a draft. Save/Restore works only once and clipping is not
   // correctly restored in some cases.

@@ -248,7 +248,7 @@

         if (colorMode != PdfColorMode.Cmyk)
         {
-          if (this.realizedFillColor.Argb != color.Argb)
+          if (this.realizedFillColor.Rgb != color.Rgb)
           {
             this.renderer.Append(PdfEncoders.ToString(color, PdfColorMode.Rgb));
             this.renderer.Append(" rg\n");


fix null reference

fix null reference

--- SnapMD.ConnectedCare.ApiModels/PatientMedicalHistoryProfile.cs
+++ SnapMD.ConnectedCare.ApiModels/PatientMedicalHistoryProfile.cs
@@ -19,7 +19,7 @@
         {
             MedicalConditions = new List<CustomCode>();
             InfantData = new NewbornRecord();
-            MedicalConditions = new List<CustomCode>();
+            MedicationAllergies = new List<CustomCode>();
             Surgeries = new List<SurgeryRecord>();
             Medications = new List<CustomCode>();
         }


[Toolkit.Compiler] Added check for non-existing collections

--- Source/Toolkit/SharpDX.Toolkit.Compiler/Model/ModelCompiler.cs
+++ Source/Toolkit/SharpDX.Toolkit.Compiler/Model/ModelCompiler.cs
@@ -535,16 +535,19 @@
                     if (mesh == otherMesh)
                         break;

-                    foreach (var bone in mesh.Bones)
-                    {
-                        foreach (var otherBone in otherMesh.Bones)
-                        {
-                            if (bone.Name == otherBone.Name)
+                    if (mesh.HasBones && otherMesh.HasBones)
+                    {
+                        foreach (var bone in mesh.Bones)
+                        {
+                            foreach (var otherBone in otherMesh.Bones)
                             {
-                                var offset = ConvertMatrix(bone.OffsetMatrix) * Matrix.Invert(ConvertMatrix(otherBone.OffsetMatrix));
-                                meshOffsets[Tuple.Create(mesh, otherMesh)] = offset;
-                                meshOffsets[Tuple.Create(otherMesh, mesh)] = Matrix.Invert(offset);
-                                break;
+                                if (bone.Name == otherBone.Name)
+                                {
+                                    var offset = ConvertMatrix(bone.OffsetMatrix) * Matrix.Invert(ConvertMatrix(otherBone.OffsetMatrix));
+                                    meshOffsets[Tuple.Create(mesh, otherMesh)] = offset;
+                                    meshOffsets[Tuple.Create(otherMesh, mesh)] = Matrix.Invert(offset);
+                                    break;
+                                }
                             }
                         }
                     }
@@ -585,11 +588,14 @@
                     if (otherMesh != mesh && !meshOffsets.ContainsKey(Tuple.Create(mesh, otherMesh)))
                         continue;

-                    foreach (var bone in otherMesh.Bones)
-                    {
-                        var boneNode = scene.RootNode.FindNode(bone.Name);
-                        if (!referenceMeshes.ContainsKey(boneNode))
-                            referenceMeshes.Add(boneNode, mesh);
+                    if (otherMesh.HasBones)
+                    {
+                        foreach (var bone in otherMesh.Bones)
+                        {
+                            var boneNode = scene.RootNode.FindNode(bone.Name);
+                            if (!referenceMeshes.ContainsKey(boneNode))
+                                referenceMeshes.Add(boneNode, mesh);
+                        }
                     }
                 }
             }


Correction of a List Index Out Of Bound

Correction of a List Index Out Of Bound

Correction of a List Index Out Of Bound when choose to spawn random event.

--- UnityProject/Assets/Scripts/UI/AdminTools/EventsManagerPage.cs
+++ UnityProject/Assets/Scripts/UI/AdminTools/EventsManagerPage.cs
@@ -53,19 +53,22 @@
 			index = 0;
 		}

-		// Instead of triggering the event right away, if we have an extra parameter page, we show it
-		List<EventScriptBase> listEvents = InGameEventsManager.Instance.GetListFromEnum(eventType);
-		if (listEvents[index - 1].parametersPageType != ParametersPageType.None)
+		if (index != 0) // Index 0 (Random Event) will never have a parameter page
 		{
-			GameObject parameterPage = eventsParametersPages.eventParameterPages.FirstOrDefault(p => p.ParametersPageType == listEvents[index - 1].parametersPageType).ParameterPage;
+			// Instead of triggering the event right away, if we have an extra parameter page, we show it
+			List<EventScriptBase> listEvents = InGameEventsManager.Instance.GetListFromEnum(eventType);
+			if (listEvents[index - 1].parametersPageType != ParametersPageType.None)
+			{
+				GameObject parameterPage = eventsParametersPages.eventParameterPages.FirstOrDefault(p => p.ParametersPageType == listEvents[index - 1].parametersPageType).ParameterPage;

-			if (parameterPage)
-			{
-				parameterPage.SetActive(true);
-				parameterPage.GetComponent<SicknessParametersPage>().SetBasicEventParameters(index, isFakeToggle.isOn, announceToggle.isOn, InGameEventType.Fun);
-				return;
+				if (parameterPage)
+				{
+					parameterPage.SetActive(true);
+					parameterPage.GetComponent<SicknessParametersPage>().SetBasicEventParameters(index, isFakeToggle.isOn, announceToggle.isOn, InGameEventType.Fun);
+					return;
+				}
 			}
-		}
+		}

 		ServerCommandVersionFourMessageClient.Send(ServerData.UserID, PlayerList.Instance.AdminToken, index, isFakeToggle.isOn, announceToggle.isOn, eventType, "CmdTriggerGameEvent");
 	}


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/Net/HttpUtility.cs
+++ websocket-sharp/Net/HttpUtility.cs
@@ -554,10 +554,19 @@
       AuthenticationSchemes scheme,
       string realm,
       string method,
-      Func<IIdentity, NetworkCredential> credentialsFinder)
-    {
-      if (response == null ||
-          !response.StartsWith (scheme.ToString (), StringComparison.OrdinalIgnoreCase))
+      Func<IIdentity, NetworkCredential> credentialsFinder
+    )
+    {
+      if (response == null)
+        return null;
+
+      if (!(scheme == AuthenticationSchemes.Basic || scheme == AuthenticationSchemes.Digest))
+        return null;
+
+      if (!response.StartsWith (scheme.ToString (), StringComparison.OrdinalIgnoreCase))
+        return null;
+
+      if (credentialsFinder == null)
         return null;

       var res = AuthenticationResponse.Parse (response);
@@ -578,15 +587,19 @@
       if (cred == null)
         return null;

-      var valid = scheme == AuthenticationSchemes.Basic
-                  ? ((HttpBasicIdentity) id).Password == cred.Password
-                  : scheme == AuthenticationSchemes.Digest
-                    ? ((HttpDigestIdentity) id).IsValid (cred.Password, realm, method, null)
-                    : false;
-
-      return valid
-             ? new GenericPrincipal (id, cred.Roles)
-             : null;
+      if (scheme == AuthenticationSchemes.Basic
+          && ((HttpBasicIdentity) id).Password != cred.Password
+      ) {
+        return null;
+      }
+
+      if (scheme == AuthenticationSchemes.Digest
+          && !((HttpDigestIdentity) id).IsValid (cred.Password, realm, method, null)
+      ) {
+        return null;
+      }
+
+      return new GenericPrincipal (id, cred.Roles);
     }

     internal static Encoding GetEncoding (string contentType)


GameInfo: Rewrite it for use in server.

GameInfo: Rewrite it for use in server.

--- AIWolfLib/GameInfo.cs
+++ AIWolfLib/GameInfo.cs
@@ -27,6 +27,49 @@
     [DataContract]
     public class GameInfo
     {
+        [DataMember(Name = "agent")]
+        int _agent = 0;
+
+        [DataMember(Name = "executedAgent")]
+        int _executedAgent = -1;
+
+        [DataMember(Name = "latestExecutedAgent")]
+        int _latestExecutedAgent = -1;
+
+        [DataMember(Name = "cursedFox")]
+        int _cursedFox = -1;
+
+        [DataMember(Name = "attackedAgent")]
+        int _attackedAgent = -1;
+
+        [DataMember(Name = "guardedAgent")]
+        int _guardedAgent = -1;
+
+        List<Vote> _voteList = new List<Vote>();
+        List<Vote> _latestVoteList = new List<Vote>();
+        List<Vote> _attackVoteList = new List<Vote>();
+        List<Vote> _latestAttackVoteList = new List<Vote>();
+        List<Talk> _talkList = new List<Talk>();
+        List<Whisper> _whisperList = new List<Whisper>();
+
+        [DataMember(Name = "statusMap")]
+        Dictionary<int, string> _statusMap = new Dictionary<int, string>();
+
+        [DataMember(Name = "roleMap")]
+        Dictionary<int, string> _roleMap = new Dictionary<int, string>();
+
+        [DataMember(Name = "remainTalkMap")]
+        Dictionary<int, int> _remainTalkMap = new Dictionary<int, int>();
+
+        [DataMember(Name = "remainWhisperMap")]
+        Dictionary<int, int> _remainWhisperMap = new Dictionary<int, int>();
+
+        List<Role> _existingRoleList = new List<Role>();
+
+        [DataMember(Name = "lastDeadAgentList")]
+        List<int> _lastDeadAgentList = new List<int>();
+
+
 #if JHELP
         /// <summary>
         /// 本日
@@ -37,7 +80,18 @@
         /// </summary>
 #endif
         [DataMember(Name = "day")]
-        public int Day { get; }
+        public int Day { get; set; }
+
+#if JHELP
+        /// <summary>
+        /// このゲーム情報を受け取るエージェントの役職
+        /// </summary>
+#else
+        /// <summary>
+        /// The role of player who receives this GameInfo.
+        /// </summary>
+#endif
+        public Role Role => RoleMap.ContainsKey(Agent) ? RoleMap[Agent] : Role.UNC;

 #if JHELP
         /// <summary>
@@ -48,30 +102,22 @@
         /// The agent who receives this GameInfo.
         /// </summary>
 #endif
-        public Agent Agent { get; }
-
-        /// <summary>
-        /// The index number of agent who receives this game information.
-        /// </summary>
-        [DataMember(Name = "agent")]
-        int _Agent { get; }
-
-#if JHELP
-        /// <summary>
-        /// このゲーム情報を受け取るエージェントの役職
-        /// </summary>
-#else
-        /// <summary>
-        /// The role of player who receives this GameInfo.
-        /// </summary>
-#endif
-        public Role Role
-        {
-            get
-            {
-                return RoleMap.ContainsKey(Agent) ? RoleMap[Agent] : Role.UNC;
-            }
-        }
+        public Agent Agent
+        {
+            get => Agent.GetAgent(_agent);
+            set => _agent = value == null ? -1 : value.AgentIdx;
+        }
+
+#if JHELP
+        /// <summary>
+        /// エージェントのリスト
+        /// </summary>
+#else
+        /// <summary>
+        /// The list of agents.
+        /// </summary>
+#endif
+        public List<Agent> AgentList => StatusMap.Keys.ToList();

 #if JHELP
         /// <summary>
@@ -85,7 +131,7 @@
         /// <remarks>Medium only.</remarks>
 #endif
         [DataMember(Name = "mediumResult")]
-        public Judge MediumResult { get; }
+        public Judge MediumResult { get; set; }

 #if JHELP
         /// <summary>
@@ -99,7 +145,7 @@
         /// <remarks>Seer only.</remarks>
 #endif
         [DataMember(Name = "divineResult")]
-        public Judge DivineResult { get; }
+        public Judge DivineResult { get; set; }

 #if JHELP
         /// <summary>
@@ -110,13 +156,11 @@
         /// The agent executed last night.
         /// </summary>
 #endif
-        public Agent ExecutedAgent { get; }
-
-        /// <summary>
-        /// The index number of the agent executed last night.
-        /// </summary>
-        [DataMember(Name = "executedAgent")]
-        int _ExecutedAgent { get; }
+        public Agent ExecutedAgent
+        {
+            get => Agent.GetAgent(_executedAgent);
+            set => _executedAgent = value == null ? -1 : value.AgentIdx;
+        }

 #if JHELP
         /// <summary>
@@ -127,13 +171,11 @@
         /// The latest executed agent.
         /// </summary>
 #endif
-        public Agent LatestExecutedAgent { get; }
-
-        /// <summary>
-        /// The index number of the latest executed agent.
-        /// </summary>
-        [DataMember(Name = "latestExecutedAgent")]
-        int _LatestExecutedAgent { get; }
+        public Agent LatestExecutedAgent
+        {
+            get => Agent.GetAgent(_latestExecutedAgent);
+            set => _latestExecutedAgent = value == null ? -1 : value.AgentIdx;
+        }

 #if JHELP
         /// <summary>
@@ -144,13 +186,11 @@
         /// The fox killed by curse.
         /// </summary>
 #endif
-        public Agent CursedFox { get; }
-
-        /// <summary>
-        /// The index number of the fox killed by curse.
-        /// </summary>
-        [DataMember(Name = "cursedFox")]
-        int _CursedFox { get; }
+        public Agent CursedFox
+        {
+            get => Agent.GetAgent(_cursedFox);
+            set => _cursedFox = value == null ? -1 : value.AgentIdx;
+        }

 #if JHELP
         /// <summary>
@@ -163,13 +203,11 @@
         /// </summary>
         /// <remarks>Werewolf only.</remarks>
 #endif
-        public Agent AttackedAgent { get; }
-
-        /// <summary>
-        /// The index number of the agent decided to be attacked.
-        /// </summary>
-        [DataMember(Name = "attackedAgent")]
-        int _AttackedAgent { get; }
+        public Agent AttackedAgent
+        {
+            get => Agent.GetAgent(_attackedAgent);
+            set => _attackedAgent = value == null ? -1 : value.AgentIdx;
+        }

 #if JHELP
         /// <summary>
@@ -180,13 +218,11 @@
         /// The agent guarded last night.
         /// </summary>
 #endif
-        public Agent GuardedAgent { get; }
-
-        /// <summary>
-        /// The index number of the agent guarded last night.
-        /// </summary>
-        [DataMember(Name = "guardedAgent")]
-        int _GuardedAgent { get; }
+        public Agent GuardedAgent
+        {
+            get => Agent.GetAgent(_guardedAgent);
+            set => _guardedAgent = value == null ? -1 : value.AgentIdx;
+        }

 #if JHELP
         /// <summary>
@@ -200,7 +236,11 @@
         /// <remarks>You can see who votes to who.</remarks>
 #endif
         [DataMember(Name = "voteList")]
-        public List<Vote> VoteList { get; }
+        public List<Vote> VoteList
+        {
+            get => _voteList;
+            set => _voteList = value == null ? new List<Vote>() : new List<Vote>(value);
+        }

 #if JHELP
         /// <summary>
@@ -214,7 +254,11 @@
         /// <remarks>You can see who votes to who.</remarks>
 #endif
         [DataMember(Name = "latestVoteList")]
-        public List<Vote> LatestVoteList { get; }
+        public List<Vote> LatestVoteList
+        {
+            get => _latestVoteList;
+            set => _latestVoteList = value == null ? new List<Vote>() : new List<Vote>(value);
+        }

 #if JHELP
         /// <summary>
@@ -228,7 +272,11 @@
         /// <remarks>Werewolf only.</remarks>
 #endif
         [DataMember(Name = "attackVoteList")]
-        public List<Vote> AttackVoteList { get; }
+        public List<Vote> AttackVoteList
+        {
+            get => _attackVoteList;
+            set => _attackVoteList = value == null ? new List<Vote>() : new List<Vote>(value);
+        }

 #if JHELP
         /// <summary>
@@ -242,7 +290,11 @@
         /// <remarks>Werewolf only.</remarks>
 #endif
         [DataMember(Name = "latestAttackVoteList")]
-        public List<Vote> LatestAttackVoteList { get; }
+        public List<Vote> LatestAttackVoteList
+        {
+            get => _latestAttackVoteList;
+            set => _latestAttackVoteList = value == null ? new List<Vote>() : new List<Vote>(value);
+        }

 #if JHELP
         /// <summary>
@@ -254,7 +306,11 @@
         /// </summary>
 #endif
         [DataMember(Name = "talkList")]
-        public List<Talk> TalkList { get; }
+        public List<Talk> TalkList
+        {
+            get => _talkList;
+            set => _talkList = value == null ? new List<Talk>() : new List<Talk>(value);
+        }

 #if JHELP
         /// <summary>
@@ -268,36 +324,24 @@
         /// <remarks>Werewolf only.</remarks>
 #endif
         [DataMember(Name = "whisperList")]
-        public List<Whisper> WhisperList { get; }
-
-#if JHELP
-        /// <summary>
-        /// 昨夜亡くなったエージェントのリスト
-        /// </summary>
-#else
-        /// <summary>
-        /// The list of agents who died last night.
-        /// </summary>
-#endif
-        public List<Agent> LastDeadAgentList { get; }
-
-        /// <summary>
-        /// The list of indexes of agents who died last night.
-        /// </summary>
-        [DataMember(Name = "lastDeadAgentList")]
-        List<int> _LastDeadAgentList { get; }
-
-#if JHELP
-        /// <summary>
-        /// このゲームにおいて存在する役職のリスト
-        /// </summary>
-#else
-        /// <summary>
-        /// The list of existing roles in this game.
-        /// </summary>
-#endif
-        [DataMember(Name = "existingRoleList")]
-        public List<Role> ExistingRoleList { get; }
+        public List<Whisper> WhisperList
+        {
+            get => _whisperList;
+            set => _whisperList = value == null ? new List<Whisper>() : new List<Whisper>(value);
+        }
+
+#if JHELP
+        /// <summary>
+        /// 生存しているエージェントのリスト
+        /// </summary>
+        /// <remarks>すべてのエージェントが死んだ場合，nullではなく空のリストを返す</remarks>
+#else
+        /// <summary>
+        /// The list of alive agents.
+        /// </summary>
+        /// <remarks>If all agents are dead, this returns an empty list, not null.</remarks>
+#endif
+        public List<Agent> AliveAgentList => AgentList.Where(a => StatusMap[a] == Status.ALIVE).ToList();

 #if JHELP
         /// <summary>
@@ -308,13 +352,11 @@
         /// The statuses of all agents.
         /// </summary>
 #endif
-        public Dictionary<Agent, Status> StatusMap { get; }
-
-        /// <summary>
-        /// The statuses of all agents.
-        /// </summary>
-        [DataMember(Name = "statusMap")]
-        Dictionary<int, string> _StatusMap { get; }
+        public Dictionary<Agent, Status> StatusMap
+        {
+            get => _statusMap.ToDictionary(p => Agent.GetAgent(p.Key), p => (Status)Enum.Parse(typeof(Status), p.Value));
+            set => _statusMap = value == null ? new Dictionary<int, string>() : value.ToDictionary(p => p.Key.AgentIdx, p => p.Value.ToString());
+        }

 #if JHELP
         /// <summary>
@@ -333,17 +375,11 @@
         /// If you are werewolf, you know other werewolves.
         /// </remarks>
 #endif
-        public Dictionary<Agent, Role> RoleMap { get; }
-
-        /// <summary>
-        /// The known roles of agents.
-        /// </summary>
-        /// <remarks>
-        /// If you are human, you know only yourself.
-        /// If you are werewolf, you know other werewolves.
-        /// </remarks>
-        [DataMember(Name = "roleMap")]
-        Dictionary<int, string> _RoleMap { get; }
+        public Dictionary<Agent, Role> RoleMap
+        {
+            get => _roleMap.ToDictionary(p => Agent.GetAgent(p.Key), p => (Role)Enum.Parse(typeof(Role), p.Value));
+            set => _roleMap = value == null ? new Dictionary<int, string>() : value.ToDictionary(p => p.Key.AgentIdx, p => p.Value.ToString());
+        }

 #if JHELP
         /// <summary>
@@ -354,13 +390,11 @@
         /// The number of opportunities to talk remaining.
         /// </summary>
 #endif
-        public Dictionary<Agent, int> RemainTalkMap { get; }
-
-        /// <summary>
-        /// The number of opportunities to talk remaining.
-        /// </summary>
-        [DataMember(Name = "remainTalkMap")]
-        Dictionary<int, int> _RemainTalkMap { get; }
+        public Dictionary<Agent, int> RemainTalkMap
+        {
+            get => _remainTalkMap.ToDictionary(p => Agent.GetAgent(p.Key), p => p.Value);
+            set => _remainTalkMap = value == null ? new Dictionary<int, int>() : value.ToDictionary(p => p.Key.AgentIdx, p => p.Value);
+        }

 #if JHELP
         /// <summary>
@@ -371,48 +405,48 @@
         /// The number of opportunities to whisper remaining.
         /// </summary>
 #endif
-        public Dictionary<Agent, int> RemainWhisperMap { get; }
-
-        /// <summary>
-        /// The number of opportunities to whisper remaining.
-        /// </summary>
-        [DataMember(Name = "remainWhisperMap")]
-        Dictionary<int, int> _RemainWhisperMap { get; }
-
-#if JHELP
-        /// <summary>
-        /// エージェントのリスト
-        /// </summary>
-#else
-        /// <summary>
-        /// The list of agents.
-        /// </summary>
-#endif
-        public List<Agent> AgentList
-        {
-            get
-            {
-                return StatusMap.Keys.ToList();
-            }
-        }
-
-#if JHELP
-        /// <summary>
-        /// 生存しているエージェントのリスト
-        /// </summary>
-        /// <remarks>すべてのエージェントが死んだ場合，nullではなく空のリストを返す</remarks>
-#else
-        /// <summary>
-        /// The list of alive agents.
-        /// </summary>
-        /// <remarks>If all agents are dead, this returns an empty list, not null.</remarks>
-#endif
-        public List<Agent> AliveAgentList
-        {
-            get
-            {
-                return AgentList.Where(a => StatusMap[a] == Status.ALIVE).ToList();
-            }
+        public Dictionary<Agent, int> RemainWhisperMap
+        {
+            get => _remainWhisperMap.ToDictionary(p => Agent.GetAgent(p.Key), p => p.Value);
+            set => _remainWhisperMap = value == null ? new Dictionary<int, int>() : value.ToDictionary(p => p.Key.AgentIdx, p => p.Value);
+        }
+
+#if JHELP
+        /// <summary>
+        /// このゲームにおいて存在する役職のリスト
+        /// </summary>
+#else
+        /// <summary>
+        /// The list of existing roles in this game.
+        /// </summary>
+#endif
+        [DataMember(Name = "existingRoleList")]
+        public List<Role> ExistingRoleList
+        {
+            get => _existingRoleList;
+            set => _existingRoleList = value == null ? new List<Role>() : new List<Role>(value);
+        }
+
+#if JHELP
+        /// <summary>
+        /// 昨夜亡くなったエージェントのリスト
+        /// </summary>
+#else
+        /// <summary>
+        /// The list of agents who died last night.
+        /// </summary>
+#endif
+        public List<Agent> LastDeadAgentList
+        {
+            get => _lastDeadAgentList.Select(i => Agent.GetAgent(i)).ToList();
+            set => _lastDeadAgentList = value == null ? new List<int>() : value.Select(a => a.AgentIdx).ToList();
+        }
+
+        /// <summary>
+        /// Initializes a new instance of this class.
+        /// </summary>
+        public GameInfo()
+        {
         }

         /// <summary>
@@ -450,113 +484,26 @@
             Dictionary<int, int> remainTalkMap, Dictionary<int, int> remainWhisperMap)
         {
             Day = day;
-            if (Day < 0)
-            {
-                Error.RuntimeError("Invalid day " + Day + ".");
-                Error.Warning("Force it to be 0.");
-                Day = 0;
-            }
-
-            Agent = Agent.GetAgent(agent);
-            if (Agent == null)
-            {
-                Error.RuntimeError("Agent must not be null.");
-                Error.Warning("Force it to be Agent[00].");
-                Agent = Agent.GetAgent(0);
-            }
-            _Agent = Agent.AgentIdx;
-
+            _agent = agent;
             MediumResult = mediumResult;
             DivineResult = divineResult;
-
-            ExecutedAgent = Agent.GetAgent(executedAgent);
-            _ExecutedAgent = ExecutedAgent == null ? -1 : ExecutedAgent.AgentIdx;
-
-            LatestExecutedAgent = Agent.GetAgent(latestExecutedAgent);
-            _LatestExecutedAgent = LatestExecutedAgent == null ? -1 : LatestExecutedAgent.AgentIdx;
-
-            CursedFox = Agent.GetAgent(cursedFox);
-            _CursedFox = CursedFox == null ? -1 : CursedFox.AgentIdx;
-
-            AttackedAgent = Agent.GetAgent(attackedAgent);
-            _AttackedAgent = AttackedAgent == null ? -1 : AttackedAgent.AgentIdx;
-
-            GuardedAgent = Agent.GetAgent(guardedAgent);
-            _GuardedAgent = GuardedAgent == null ? -1 : GuardedAgent.AgentIdx;
-
-            VoteList = voteList == null ? new List<Vote>() : voteList;
-            LatestVoteList = latestVoteList == null ? new List<Vote>() : latestVoteList;
-            AttackVoteList = attackVoteList == null ? new List<Vote>() : attackVoteList;
-            LatestAttackVoteList = latestAttackVoteList == null ? new List<Vote>() : latestAttackVoteList;
-            TalkList = talkList == null ? new List<Talk>() : talkList;
-            WhisperList = whisperList == null ? new List<Whisper>() : whisperList;
-            ExistingRoleList = existingRoleList == null ? new List<Role>() : existingRoleList;
-
-            LastDeadAgentList = new List<Agent>();
-            if (lastDeadAgentList != null)
-            {
-                foreach (var i in lastDeadAgentList)
-                {
-                    LastDeadAgentList.Add(Agent.GetAgent(i));
-                }
-            }
-            _LastDeadAgentList = LastDeadAgentList.Select(a => a.AgentIdx).ToList();
-
-            StatusMap = new Dictionary<Agent, Status>();
-            if (statusMap != null)
-            {
-                foreach (var p in statusMap)
-                {
-                    Status status;
-                    if (!Enum.TryParse(p.Value, out status))
-                    {
-                        Error.RuntimeError("Invalid status string " + p.Value + ".");
-                        Error.Warning("Force it to be Status.ALIVE.");
-                        status = Status.ALIVE;
-                    }
-                    StatusMap[Agent.GetAgent(p.Key)] = status;
-                }
-            }
-            _StatusMap = StatusMap.ToDictionary(p => p.Key.AgentIdx, p => p.Value.ToString());
-
-            RoleMap = new Dictionary<Agent, Role>();
-            if (roleMap != null)
-            {
-                foreach (var p in roleMap)
-                {
-                    Role role;
-                    if (!Enum.TryParse(p.Value, out role) || role == Role.UNC)
-                    {
-                        Error.RuntimeError("Invalid role string " + p.Value + ".");
-                        Error.Warning("It is removed from role map.");
-                    }
-                    else
-                    {
-                        RoleMap[Agent.GetAgent(p.Key)] = role;
-                    }
-                }
-            }
-            _RoleMap = RoleMap.Where(m => m.Value != Role.UNC).ToDictionary(m => m.Key.AgentIdx, m => m.Value.ToString());
-
-            RemainTalkMap = new Dictionary<Agent, int>();
-            if (remainTalkMap != null)
-            {
-                foreach (var p in remainTalkMap)
-                {
-                    RemainTalkMap[Agent.GetAgent(p.Key)] = p.Value;
-                }
-            }
-            _RemainTalkMap = RemainTalkMap.ToDictionary(p => p.Key.AgentIdx, p => p.Value);
-
-            RemainWhisperMap = new Dictionary<Agent, int>();
-            if (remainWhisperMap != null)
-            {
-                foreach (var p in remainWhisperMap)
-                {
-                    RemainWhisperMap[Agent.GetAgent(p.Key)] = p.Value;
-                }
-            }
-            _RemainWhisperMap = RemainWhisperMap.ToDictionary(p => p.Key.AgentIdx, p => p.Value);
+            _executedAgent = executedAgent;
+            _latestExecutedAgent = latestExecutedAgent;
+            _cursedFox = cursedFox;
+            _attackedAgent = attackedAgent;
+            _guardedAgent = guardedAgent;
+            _voteList = voteList;
+            _latestVoteList = latestVoteList;
+            _attackVoteList = attackVoteList;
+            _latestAttackVoteList = latestAttackVoteList;
+            _talkList = talkList;
+            _whisperList = whisperList;
+            _lastDeadAgentList = lastDeadAgentList;
+            _existingRoleList = existingRoleList;
+            _statusMap = statusMap;
+            _roleMap = roleMap;
+            _remainTalkMap = remainTalkMap;
+            _remainWhisperMap = remainWhisperMap;
         }
     }
 }


Fixed typo in image reference commit id

Fixed typo in image reference commit id

--- docs/input/docs/learn/branching-strategies/index.cshtml
+++ docs/input/docs/learn/branching-strategies/index.cshtml
@@ -17,7 +17,7 @@

e137e9 -> 1.0.0+0
 a5f6c5 -> 1.0.1+1
 adb29a -> 1.0.1-feature-foo.1+1 (PR #5 Version: `1.0.1-PullRequest.5+2`)
-7c2438 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`)
+7c2430 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`)
 5f413b -> 1.0.1+4
 d6155b -> 2.0.0-rc.1+0 (Before and after tag)
 d53ab6 -> 2.0.0-rc.2+1 (Pre-release number was bumped because of the tag on previous commit)


refactor: Start Phrase ranking search

refactor: Start Phrase ranking search

--- APT/APT/Controller.cs
+++ APT/APT/Controller.cs
@@ -318,16 +318,16 @@
                     innerQueryHeaderBeforeJoin += "and ";
                 }
             }
-            if (words.Length > 1)
-                innerQueryHeaderBeforeJoin += "and ";
-            for (int i = 1; i < words.Length; i++)
-            {
-                innerQueryHeaderBeforeJoin += WhereSpecialPhraseSearchClause(i);
-                if (words.Length > 1 && i != words.Length - 1)
-                {
-                    innerQueryHeaderBeforeJoin += "and ";
-                }
-            }
+            //if (words.Length > 1)
+            //    innerQueryHeaderBeforeJoin += "and ";
+            //for (int i = 1; i < words.Length; i++)
+            //{
+            //    innerQueryHeaderBeforeJoin += WhereSpecialPhraseSearchClause(i);
+            //    if (words.Length > 1 && i != words.Length - 1)
+            //    {
+            //        innerQueryHeaderBeforeJoin += "and ";
+            //    }
+            //}

             string innerQueryHeaders = "select a.URL_ID,a.URLName,a.URL_Title,a.TotalNumberOfWords, total = ( ";
             for (int i = 0; i < words.Length; i++)
@@ -380,16 +380,16 @@
                     innerQueryParagraphsBeforeJoin += "and ";
                 }
             }
-            if (words.Length > 1)
-                innerQueryParagraphsBeforeJoin += "and ";
-            for (int i = 1; i < words.Length; i++)
-            {
-                innerQueryParagraphsBeforeJoin += WhereSpecialPhraseSearchClause(i);
-                if (words.Length > 1 && i != words.Length - 1)
-                {
-                    innerQueryParagraphsBeforeJoin += "and ";
-                }
-            }
+            //if (words.Length > 1)
+            //    innerQueryParagraphsBeforeJoin += "and ";
+            //for (int i = 1; i < words.Length; i++)
+            //{
+            //    innerQueryParagraphsBeforeJoin += WhereSpecialPhraseSearchClause(i);
+            //    if (words.Length > 1 && i != words.Length - 1)
+            //    {
+            //        innerQueryParagraphsBeforeJoin += "and ";
+            //    }
+            //}

             string innerQueryParagraphs = "select a.URL_ID,a.URLName,a.URL_Title,a.TotalNumberOfWords, total = ( ";
             for (int i = 0; i < words.Length; i++)
@@ -428,5 +428,31 @@
         }

+        string JoinsPhrase(string KWP_TableName, string[] words, int letterIndex)
+        {
+            //genereta 7aga zai el inner da bs replace kam 7aga kda
+            return "";
+        }
+        public DataTable RankedPhraseSearch(string[] words)
+        {
+
+/*
+left join
+(select url0.URL_ID ,count(kwp_t0.ID) as word
+from
+KeyWords w0,KeyWordsPosition_Paragraphs kwp_t0, Url_Container url0 ,
+KeyWords w1,KeyWordsPosition_Paragraphs kwp_t1, Url_Container url1
+where
+w0.KeyWords = 'the' and w0.KeyWord_ID = kwp_t0.KeyWord_ID and kwp_t0.URL_ID = url0.URL_ID and
+w1.KeyWords='seo' and w1.KeyWord_ID = kwp_t1.KeyWord_ID and kwp_t1.URL_ID = url1.URL_ID and
+url0.URL_ID = url1.URL_ID and
+kwp_t1.Position = kwp_t0.Position+1
+group by url0.URL_ID) c on bla bla
+*/
+            DataTable dy = null;
+            return dy;
+        }
+
+
     }
 }


dialog transitions work, for real, maybe

--- Assets/Annie/Scripts/DialogManager.cs
+++ Assets/Annie/Scripts/DialogManager.cs
@@ -23,6 +23,7 @@
 	public void SREDone(int sequence, float score){
 		currentSpeakerIndex++;
 		Debug.Log ("index after done: " + currentSpeakerIndex);
+		isPlaying = false;
 	}

 	// Update is called once per frame


Add an extension method that converts string to enum

--- Assets/MapzenGo/Helpers/Extensions.cs
+++ Assets/MapzenGo/Helpers/Extensions.cs
@@ -117,5 +117,21 @@

             return 2;
         }
+
+        public static T ConvertToEnum<T>(this string value) where T : new()
+        {
+            if (!typeof(T).IsEnum)
+                throw new NotSupportedException("T must be an Enum");
+
+            try
+            {
+                return (T)Enum.Parse(typeof(T), value, true);
+            }
+            catch
+            {
+                return default(T); // equivalent to (T)0
+                                   //return (T)Enum.Parse(typeof(T), "Unknown"));
+            }
+        }
     }
 }


Allow camera to go a bit lower.

Allow camera to go a bit lower.

--- Assets/Pyrite/Scripts/PyriteLoader.cs
+++ Assets/Pyrite/Scripts/PyriteLoader.cs
@@ -468,7 +468,7 @@
                     var lowestLod = pyriteQuery.DetailLevels.Last();
                     inputManager.SetInputLimits(
                         new Vector3(highestLod.ModelBoundsMin.x + lowestLod.WorldCubeScale.x /2,
-                        highestLod.ModelBoundsMin.z + _geometryBufferAltitudeTransform + lowestLod.WorldCubeScale.z / 4,
+                        highestLod.ModelBoundsMin.z + _geometryBufferAltitudeTransform + lowestLod.WorldCubeScale.z / 8,
                         highestLod.ModelBoundsMin.y  + lowestLod.WorldCubeScale.y / 2),
                         new Vector3(highestLod.ModelBoundsMax.x - lowestLod.WorldCubeScale.x / 2,
                         highestLod.ModelBoundsMax.z + _geometryBufferAltitudeTransform + (lowestLod.WorldCubeScale.z * 1.5f),


Implement activating game objects

Implement activating game objects

--- ActivateGameObject.cs
+++ ActivateGameObject.cs
@@ -91,9 +91,15 @@

         #region METHODS

+        /// <summary>
+        /// Activate all game object in list order.
+        /// </summary>
         public void Activate() {
+            foreach (var GO in GameObjects) {
+                GO.SetActive(true);
+            }
+        }

-        }
         #endregion

     }


"Fix" an uncommon video player crash when closing short videos

Closes #177

--- video/FormPlayer.cs
+++ video/FormPlayer.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Drawing;
 using System.Globalization;
+using System.Runtime.ExceptionServices;
 using System.Runtime.InteropServices;
 using System.Windows.Forms;
 using TweetDuck.Video.Controls;
@@ -107,6 +108,7 @@
             Environment.Exit(Program.CODE_MEDIA_ERROR);
         }

+        [HandleProcessCorruptedStateExceptions]
         private void timerSync_Tick(object sender, EventArgs e){
             if (NativeMethods.GetWindowRect(ownerHandle, out NativeMethods.RECT rect)){
                 int width = rect.Right-rect.Left+1;
@@ -139,9 +141,14 @@
                 }

                 if (controls.currentPosition > media.duration){ // pausing near the end of the video causes WMP to play beyond the end of the video wtf
-                    controls.stop();
-                    controls.currentPosition = 0;
-                    controls.play();
+                    try{
+                        controls.stop();
+                        controls.currentPosition = 0;
+                        controls.play();
+                    }catch(AccessViolationException){
+                        // something is super retarded here because shit gets disposed between the start of this method and
+                        // the controls.play() call even though it runs on the UI thread
+                    }
                 }

                 if (isCursorInside && !wasCursorInside){


enable/disable indent option.

enable/disable indent option.

--- src/TWCore/Watch.cs
+++ src/TWCore/Watch.cs
@@ -215,6 +215,10 @@
         /// <returns>Watch item</returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static WItem Create(string startMessage, string endMessage, LogLevel level) => WItem.CreateItem(startMessage, endMessage, level);
+        /// <summary>
+        /// Enable Watch stats lines indent
+        /// </summary>
+        public static bool EnableIndent { get; set; } = true;

         #region Nested Class
         /// <inheritdoc />
@@ -237,7 +241,7 @@
             {
                 double gTime;
                 double cTime;
-                var indent = new string(' ', (item.Id - 1) * 2);
+                var indent = EnableIndent ? new string(' ', (item.Id - 1) * 2) : string.Empty;
                 switch (item.Type)
                 {
                     case 0:


Counters on Watch

Counters on Watch

--- src/TWCore/Watch.cs
+++ src/TWCore/Watch.cs
@@ -15,11 +15,14 @@
  */

 using System;
+using System.Collections.Concurrent;
 using System.Diagnostics;
 using System.Runtime.CompilerServices;
 using System.Threading;
 using System.Threading.Tasks;
 using TWCore.Diagnostics.Log;
+using TWCore.Diagnostics.Status;
+
 // ReSharper disable UnusedMember.Global

 namespace TWCore
@@ -176,10 +179,25 @@
         /// <summary>
         /// Create a new watch item to log execution times
         /// </summary>
+        /// <param name="level">Log level</param>
+        /// <returns>Watch item</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static WItem Create(LogLevel level) => WItem.CreateItem(level);
+        /// <summary>
+        /// Create a new watch item to log execution times
+        /// </summary>
         /// <param name="message">Message before disposal</param>
         /// <returns>Watch item</returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static WItem Create(string message) => WItem.CreateItem(message);
+        /// <summary>
+        /// Create a new watch item to log execution times
+        /// </summary>
+        /// <param name="message">Message before disposal</param>
+        /// <param name="level">Log level</param>
+        /// <returns>Watch item</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static WItem Create(string message, LogLevel level) => WItem.CreateItem(message, level);
         /// <summary>
         /// Create a new watch item to log execution times
         /// </summary>
@@ -188,6 +206,15 @@
         /// <returns>Watch item</returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static WItem Create(string startMessage, string endMessage) => WItem.CreateItem(startMessage, endMessage);
+        /// <summary>
+        /// Create a new watch item to log execution times
+        /// </summary>
+        /// <param name="startMessage">Message start</param>
+        /// <param name="endMessage">Message before disposal</param>
+        /// <param name="level">Log level</param>
+        /// <returns>Watch item</returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static WItem Create(string startMessage, string endMessage, LogLevel level) => WItem.CreateItem(startMessage, endMessage, level);

         #region Nested Class
         /// <inheritdoc />
@@ -199,39 +226,45 @@
         {
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static readonly ObjectPool<WItem> ItemPools = new ObjectPool<WItem>(pool => new WItem(), i => i.Reset());
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static readonly Worker<LogStatItem> LogStatsWorker = new Worker<LogStatItem>(WorkerMethod);
+            [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static readonly StatusCounter DefaultCounter = new StatusCounter("Watch Counters");
+            [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static readonly ConcurrentDictionary<string, StatusCounter> Counters = new ConcurrentDictionary<string, StatusCounter>();
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static long _frequency = Stopwatch.Frequency;
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static int _watcherCount;
-
+
             [IgnoreStackFrameLog]
             [MethodImpl(MethodImplOptions.AggressiveInlining)]
             private static void WorkerMethod(LogStatItem item)
             {
                 double gTime;
                 double cTime;
+                var indent = new string(' ', (item.Id - 1) * 4);
                 switch (item.Type)
                 {
                     case 0:
-                        Core.Log.Stats(new string(' ', (item.Id - 1) * 4) + "[{0:00}-START] {1}", item.Id, item.Message);
+                        Core.Log.Write(item.Level, indent + string.Format("[{0:00}-START] {1}", item.Id, item.Message));
                         break;
                     case 1:
                         cTime = (item.LastTapTicks / _frequency) * 1000;
                         if (Math.Abs(item.LastTapTicks - item.GlobalTicks) > 0.0000001)
                         {
                             gTime = (item.GlobalTicks / _frequency) * 1000;
-                            Core.Log.Stats(new string(' ', (item.Id - 1) * 4) + "  [{0:00}-TAP, Time = {1:0.0000}ms, Cumulated = {2:0.0000}ms] {3}", item.Id, cTime, gTime, item.Message);
+                            Core.Log.Write(item.Level, indent + string.Format("  [{0:00}-TAP, Time = {1:0.0000}ms, Cumulated = {2:0.0000}ms] {3}", item.Id, cTime, gTime, item.Message));
                         }
                         else
                         {
-                            Core.Log.Stats(new string(' ', (item.Id - 1) * 4) + "  [{0:00}-TAP, Time = {1:0.0000}ms] {2}", item.Id, cTime, item.Message);
+                            Core.Log.Write(item.Level, indent + string.Format("  [{0:00}-TAP, Time = {1:0.0000}ms] {2}", item.Id, cTime, item.Message));
                         }
+                        //Counters.Register(item.Message, cTime);
                         break;
                     case 2:
                         cTime = (item.LastTapTicks / _frequency) * 1000;
                         gTime = (item.GlobalTicks / _frequency) * 1000;
+
                         if (Math.Abs(cTime - gTime) > 0.0000001)
-                            Core.Log.Stats(new string(' ', (item.Id - 1) * 4) + "[{0:00}-END, Time = {1:0.0000}ms, Total Time = {2:0.0000}ms] {3}", item.Id, cTime, gTime, item.Message);
+                            Core.Log.Write(item.Level, indent + string.Format("[{0:00}-END, Time = {1:0.0000}ms, Total Time = {2:0.0000}ms] {3}", item.Id, cTime, gTime, item.Message));
                         else
-                            Core.Log.Stats(new string(' ', (item.Id - 1) * 4) + "[{0:00}-END, Total Time = {1:0.0000}ms] {2}", item.Id, gTime, item.Message);
+                            Core.Log.Write(item.Level, indent + string.Format("[{0:00}-END, Total Time = {1:0.0000}ms] {2}", item.Id, gTime, item.Message));
+                        //Counters.Register(item.Message, cTime);
                         break;
                 }
             }
@@ -239,8 +272,11 @@
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private double _initTicks;
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private double _ticksTimestamp;
             [DebuggerBrowsable(DebuggerBrowsableState.Never)] private double _lastTapTicks;
+            [DebuggerBrowsable(DebuggerBrowsableState.Never)] private LogLevel _level;
             private int _id;
             private string _lastMessage;
+            private StatusCounter _counter = null;
+            private const string CounterPreffix = "Watch Counters: ";

             #region Properties
             /// <summary>
@@ -265,11 +301,13 @@
                 public readonly double LastTapTicks;
                 public readonly string Message;
                 public readonly int Type;
+                public readonly LogLevel Level;

                 [MethodImpl(MethodImplOptions.AggressiveInlining)]
-                public LogStatItem(int id, double globalTicks, double lastTapTicks, string message, int type)
+                public LogStatItem(int id, LogLevel level, double globalTicks, double lastTapTicks, string message, int type)
                 {
                     Id = id;
+                    Level = level;
                     GlobalTicks = globalTicks;
                     LastTapTicks = lastTapTicks;
                     Message = message;
@@ -286,6 +324,7 @@
                 _ticksTimestamp = Stopwatch.GetTimestamp();
                 _initTicks = _ticksTimestamp;
                 _lastTapTicks = _ticksTimestamp;
+                _level = LogLevel.Stats;
             }

             [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -293,6 +332,16 @@
             {
                 var item = ItemPools.New();
                 item._id = Interlocked.Increment(ref _watcherCount);
+                item._counter = DefaultCounter;
+                return item;
+            }
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            internal static WItem CreateItem(LogLevel level)
+            {
+                var item = ItemPools.New();
+                item._id = Interlocked.Increment(ref _watcherCount);
+                item._level = level;
+                item._counter = DefaultCounter;
                 return item;
             }
             [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -301,6 +350,18 @@
                 var item = ItemPools.New();
                 item._lastMessage = message;
                 item._id = Interlocked.Increment(ref _watcherCount);
+                item._counter = Counters.GetOrAdd(message, msg =>  new StatusCounter(CounterPreffix + msg));
+                item.StartedTap(message);
+                return item;
+            }
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            internal static WItem CreateItem(string message, LogLevel level)
+            {
+                var item = ItemPools.New();
+                item._lastMessage = message;
+                item._id = Interlocked.Increment(ref _watcherCount);
+                item._level = level;
+                item._counter = Counters.GetOrAdd(message, msg =>  new StatusCounter(CounterPreffix + msg));
                 item.StartedTap(message);
                 return item;
             }
@@ -310,6 +371,18 @@
                 var item = ItemPools.New();
                 item._lastMessage = lastMessage;
                 item._id = Interlocked.Increment(ref _watcherCount);
+                item._counter = Counters.GetOrAdd(startMessage, msg =>  new StatusCounter(CounterPreffix + msg));
+                item.StartedTap(startMessage);
+                return item;
+            }
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
+            internal static WItem CreateItem(string startMessage, string lastMessage, LogLevel level)
+            {
+                var item = ItemPools.New();
+                item._lastMessage = lastMessage;
+                item._id = Interlocked.Increment(ref _watcherCount);
+                item._level = level;
+                item._counter = Counters.GetOrAdd(startMessage, msg =>  new StatusCounter(CounterPreffix + msg));
                 item.StartedTap(startMessage);
                 return item;
             }
@@ -329,7 +402,8 @@
                 if (Core.Log.MaxLogLevel.HasFlag(LogLevel.Stats))
                 {
                     var globalTicks = currentTicks - _initTicks;
-                    LogStatsWorker.Enqueue(new LogStatItem(_id, globalTicks, _lastTapTicks, message, 1));
+                    LogStatsWorker.Enqueue(new LogStatItem(_id, _level, globalTicks, _lastTapTicks, message, 1));
+                    _counter.Register(message, (_lastTapTicks / _frequency) * 1000);
                 }
                 _ticksTimestamp = currentTicks;
             }
@@ -345,7 +419,7 @@
                 if (message != null && Core.Log.MaxLogLevel.HasFlag(LogLevel.Stats))
                 {
                     var globalTicks = currentTicks - _initTicks;
-                    LogStatsWorker.Enqueue(new LogStatItem(_id, globalTicks, _lastTapTicks, message, 0));
+                    LogStatsWorker.Enqueue(new LogStatItem(_id, _level, globalTicks, _lastTapTicks, message, 0));
                 }
                 _ticksTimestamp = currentTicks;
             }
@@ -361,7 +435,11 @@
                 if (message != null && Core.Log.MaxLogLevel.HasFlag(LogLevel.Stats))
                 {
                     var globalTicks = currentTicks - _initTicks;
-                    LogStatsWorker.Enqueue(new LogStatItem(_id, globalTicks, _lastTapTicks, message, 2));
+                    LogStatsWorker.Enqueue(new LogStatItem(_id, _level, globalTicks, _lastTapTicks, message, 2));
+                    if (_counter.Name == CounterPreffix + message)
+                        _counter.Register("Total", (_lastTapTicks / _frequency) * 1000);
+                    else
+                        _counter.Register(message, (_lastTapTicks / _frequency) * 1000);
                 }
                 _ticksTimestamp = currentTicks;
             }
@@ -384,7 +462,9 @@
                 _ticksTimestamp = Stopwatch.GetTimestamp();
                 _initTicks = _ticksTimestamp;
                 _lastTapTicks = _ticksTimestamp;
+                _level = LogLevel.Stats;
                 _disposedValue = false;
+                _counter = null;
             }
             #endregion


Fixing samples script

Fixing samples script

--- samples/script.cs
+++ samples/script.cs
@@ -3,8 +3,8 @@
 using CsScripts;
 import helper.cs;

-writeln(Modules.dummy.ImageName);
-writeln(Globals.car.GetName());
+Console.Error.WriteLine("This is sample error");
+HelpMe("It works!");

 writeln("All Modules: {0}", string.Join(", ", Module.All.Select(m => m.Name)));


close #3450 - don't let SplitBrainResolver log 'partition detected' messages when there are no unreachable nodes

--- src/core/Akka.Cluster/SplitBrainResolver.cs
+++ src/core/Akka.Cluster/SplitBrainResolver.cs
@@ -317,7 +317,7 @@

         private void HandleStabilityReached()
         {
-            if (Log.IsInfoEnabled)
+            if (Log.IsInfoEnabled && _unreachable.Any())
             {
                 Log.Info("A network partition detected - unreachable nodes: [{0}], remaining: [{1}]", string.Join(", ", _unreachable.Select(m => m.Address)), string.Join(", ", _reachable.Select(m => m.Address)));
             }