Removed old code.

Removed old code.

--- JetBlack.MessageBus.Common/Network/StreamExtensions.cs
+++ JetBlack.MessageBus.Common/Network/StreamExtensions.cs
@@ -32,36 +32,6 @@
                             break;

                         observer.OnNext(buffer.Result);
-                    }
-
-                    observer.OnCompleted();
-                }
-                catch (Exception error)
-                {
-                    observer.OnError(error);
-                }
-            });
-        }
-
-        public static IObservable<DisposableValue<ArraySegment<byte>>> ToFrameStreamObservableOld(this Stream stream, BufferManager bufferManager)
-        {
-            return Observable.Create<DisposableValue<ArraySegment<byte>>>(async (observer, token) =>
-            {
-                var headerBuffer = new byte[sizeof(int)];
-
-                try
-                {
-                    while (!token.IsCancellationRequested)
-                    {
-                        if (await stream.ReadBytesCompletelyAsync(headerBuffer, headerBuffer.Length, token) != headerBuffer.Length)
-                            break;
-                        var length = BitConverter.ToInt32(headerBuffer, 0);
-
-                        var buffer = bufferManager.TakeBuffer(length);
-                        if (await stream.ReadBytesCompletelyAsync(buffer, length, token) != length)
-                            break;
-
-                        observer.OnNext(DisposableValue.Create(new ArraySegment<byte>(buffer, 0, length), Disposable.Create(() => bufferManager.ReturnBuffer(buffer))));
                     }

                     observer.OnCompleted();


add tests for CompareByPrecedence

add tests for CompareByPrecedence


Added support for culture-sensitive formatting.

Allow to format log events using IFormatProvider.

--- test/Serilog.Tests/Support/Some.cs
+++ test/Serilog.Tests/Support/Some.cs
@@ -2,7 +2,6 @@
 using System.IO;
 using System.Linq;
 using System.Threading;
-using Serilog.Core;
 using Serilog.Events;
 using Serilog.Parsing;

@@ -15,6 +14,11 @@
         public static int Int()
         {
             return Interlocked.Increment(ref Counter);
+        }
+
+        public static decimal Decimal()
+        {
+            return Int() + 0.123m;
         }

         public static string String(string tag = null)


Remove serverURI from test config

Remove serverURI from test config

--- test/Stormpath.Owin.NowinHarness/Program.cs
+++ test/Stormpath.Owin.NowinHarness/Program.cs
@@ -61,13 +61,6 @@
             {
                 LibraryUserAgent = "nowin/0.22.2",
                 ViewRenderer = new PrecompiledViewRenderer(logger),
-                Configuration = new StormpathConfiguration
-                {
-                    Web = new WebConfiguration()
-                    {
-                        ServerUri = "http://localhost:8080"
-                    }
-                },
                 Logger = logger,
                 PreRegistrationHandler = (ctx, ct) =>
                 {


Added checks for the cell index

Added checks for the cell index

--- AngleSharp.Core.Tests/Library/DOMTable.cs
+++ AngleSharp.Core.Tests/Library/DOMTable.cs
@@ -846,6 +846,48 @@
             Assert.AreEqual(0, MakeRowElement("tbody", "tr", "td", "table", "tfoot").IndexInSection);
         }

+        [Test]
+        public void TableForCellsWithoutAParentCellIndexShouldBeMissing()
+        {
+            var document = DocumentBuilder.Html("");
+            var th = document.CreateElement("th") as IHtmlTableHeaderCellElement;
+            Assert.AreEqual(-1, th.Index);
+            var td = document.CreateElement("td") as IHtmlTableDataCellElement;
+            Assert.AreEqual(-1, td.Index);
+        }
+
+        [Test]
+        public void TableForCellsWhoseParentIsNotRowCellIndexShouldBeMissing()
+        {
+            var document = DocumentBuilder.Html("");
+            var table = document.CreateElement("table");
+            var th = table.AppendChild(document.CreateElement("th")) as IHtmlTableHeaderCellElement;
+            Assert.AreEqual(-1, th.Index);
+            var td = table.AppendChild(document.CreateElement("td")) as IHtmlTableDataCellElement;
+            Assert.AreEqual(-1, td.Index);
+        }
+
+        [Test]
+        public void TableForCellsWhoseParentIsNotARowCellIndexShouldBeMissing()
+        {
+            var document = DocumentBuilder.Html("");
+            var tr = document.CreateElement("", "tr");
+            var th = tr.AppendChild(document.CreateElement("th")) as IHtmlTableHeaderCellElement;
+            Assert.AreEqual(-1, th.Index);
+            var td = tr.AppendChild(document.CreateElement("td")) as IHtmlTableDataCellElement;
+            Assert.AreEqual(-1, td.Index);
+        }
+
+        [Test]
+        public void TableForCellsWhoseParentIsARowCellIndexShouldBeTheIndex()
+        {
+            var document = DocumentBuilder.Html("");
+            var tr = document.CreateElement("tr");
+            var th = tr.AppendChild(document.CreateElement("th")) as IHtmlTableHeaderCellElement;
+            Assert.AreEqual(0, th.Index);
+            var td = tr.AppendChild(document.CreateElement("td")) as IHtmlTableDataCellElement;
+            Assert.AreEqual(1, td.Index);
+        }

         static IHtmlTableRowElement MakeRowElement(params String[] names)
         {


FieldXE examples

FieldXE examples

--- ApiExamples/CSharp/ApiExamples/ExField.cs
+++ ApiExamples/CSharp/ApiExamples/ExField.cs
@@ -174,7 +174,7 @@
             DocumentBuilder builder = new DocumentBuilder(doc);

             builder.InsertField(FieldType.FieldNone, false);
-
+
             MemoryStream stream = new MemoryStream();
             doc.Save(stream, SaveFormat.Docx);

@@ -1710,7 +1710,7 @@
             doc.Save(MyDir + @"\Artifacts\Field.Citation.docx");
             //ExEnd
         }
-
+
         [Test]
         public void FieldData()
         {
@@ -1725,7 +1725,7 @@
             Assert.AreEqual(" DATA ", field.GetFieldCode());
             //ExEnd
         }
-
+
         [Test]
         public void FieldInclude()
         {
@@ -1813,7 +1813,7 @@
             doc.Save(MyDir + @"\Artifacts\Field.Database.docx");
             //ExEnd
         }
-
+
         [Test]
         public void FieldIncludePicture()
         {
@@ -1890,8 +1890,8 @@
             return fieldIncludeText;
         }
         //ExEnd
-
-        [Test]
+
+        [Test]
         [Ignore("WORDSNET-17545")]
         public void FieldHyperlink()
         {
@@ -1950,7 +1950,7 @@

             // Create a data table for the mail merge
             // The name of the column that contains our image filenames needs to match the name of our merge field
-            System.Data.DataTable dataTable = CreateDataTable("Images", "ImageColumn",
+            System.Data.DataTable dataTable = CreateDataTable("Images", "ImageColumn",
                 new string[]
                 {
                     MyDir + @"Images\Aspose.Words.gif",
@@ -1996,7 +1996,7 @@
             }

             public void FieldMerging(FieldMergingArgs e)
-            {
+            {
                 throw new NotImplementedException();
             }

@@ -2017,5 +2017,118 @@
             private readonly MergeFieldImageDimensionUnit mUnit;
         }
         //ExEnd
+
+        [Test]
+        [Ignore("WORDSNET-17524")]
+        public void FieldXE()
+        {
+            //ExStart
+            //ExFor:FieldIndex
+            //ExFor:FieldIndex.BookmarkName
+            //ExFor:FieldIndex.CrossReferenceSeparator
+            //ExFor:FieldIndex.EntryType
+            //ExFor:FieldIndex.HasPageNumberSeparator
+            //ExFor:FieldIndex.HasSequenceName
+            //ExFor:FieldIndex.Heading
+            //ExFor:FieldIndex.LanguageId
+            //ExFor:FieldIndex.LetterRange
+            //ExFor:FieldIndex.NumberOfColumns
+            //ExFor:FieldIndex.PageNumberListSeparator
+            //ExFor:FieldIndex.PageNumberSeparator
+            //ExFor:FieldIndex.PageRangeSeparator
+            //ExFor:FieldIndex.RunSubentriesOnSameLine
+            //ExFor:FieldIndex.SequenceName
+            //ExFor:FieldIndex.SequenceSeparator
+            //ExFor:FieldIndex.UseYomi
+            //ExFor:FieldXE
+            //ExFor:FieldXE.EntryType
+            //ExFor:FieldXE.HasPageRangeBookmarkName
+            //ExFor:FieldXE.IsBold
+            //ExFor:FieldXE.IsItalic
+            //ExFor:FieldXE.PageNumberReplacement
+            //ExFor:FieldXE.PageRangeBookmarkName
+            //ExFor:FieldXE.Text
+            //ExFor:FieldXE.Yomi
+            //ExSummary:Shows how to populate an index field with index entries.
+            Document doc = new Document();
+            DocumentBuilder builder = new DocumentBuilder(doc);
+
+            // Create an index field which will contain all the index entries
+            FieldIndex index = (FieldIndex)builder.InsertField(FieldType.FieldIndex, true);
+
+            // Bookmark that will encompass a section that we want to index
+            string mainBookmarkName = "MainBookmark";
+            builder.StartBookmark(mainBookmarkName);
+            index.BookmarkName = mainBookmarkName;
+            index.CrossReferenceSeparator = ":";
+            index.Heading = ">";
+            index.LanguageId = "1033";
+            index.LetterRange = "a-j";
+            index.NumberOfColumns = "2";
+            index.PageNumberListSeparator = "|";
+            index.PageNumberSeparator = "|";
+            index.PageRangeSeparator = "/";
+            index.UseYomi = true;
+            index.RunSubentriesOnSameLine = false;
+            index.SequenceName = "Chapter";
+            index.SequenceSeparator = ":";
+            Assert.IsTrue(index.HasPageNumberSeparator);
+            Assert.IsTrue(index.HasSequenceName);
+
+            // Our index will take up page 1
+            builder.InsertBreak(BreakType.PageBreak);
+
+            // Use a document builder to insert an index entry
+            // Index entries are not added to the index manually, it will find them on its own
+            FieldXE indexEntry = (FieldXE)builder.InsertField(FieldType.FieldIndexEntry, true);
+            indexEntry.Text = "Index entry 1";
+            indexEntry.EntryType = "Type1";
+            indexEntry.IsBold = true;
+            indexEntry.IsItalic = true;
+            Assert.AreEqual(false, indexEntry.HasPageRangeBookmarkName);
+
+            // We can insert a bookmark and have the index field point to it
+            string subBookmarkName = "MyBookmark";
+            builder.StartBookmark(subBookmarkName);
+            builder.Writeln("Bookmark text contents.");
+            builder.EndBookmark(subBookmarkName);
+
+            // Put the bookmark and index entry field on different pages
+            // Our index will use the page that the bookmark is on, not that of the index entry field, as the page number
+            builder.InsertBreak(BreakType.PageBreak);
+            indexEntry = (FieldXE)builder.InsertField(FieldType.FieldIndexEntry, true);
+            indexEntry.Text = "Index entry 2";
+            indexEntry.EntryType = "Type1";
+            indexEntry.PageRangeBookmarkName = subBookmarkName;
+            Assert.AreEqual(true, indexEntry.HasPageRangeBookmarkName);
+
+            // We can use the PageNumberReplacement property to point to any page we want, even one that may not exist
+            builder.InsertBreak(BreakType.PageBreak);
+            indexEntry = (FieldXE)builder.InsertField(FieldType.FieldIndexEntry, true);
+            indexEntry.Text = "Index entry 3";
+            indexEntry.EntryType = "Type1";
+            indexEntry.PageNumberReplacement = "999";
+
+            // If we are using an East Asian language, we can sort entries phonetically (using Furigana) instead of alphabetically
+            indexEntry = (FieldXE)builder.InsertField(FieldType.FieldIndexEntry, true);
+            indexEntry.Text = "漢字";
+            indexEntry.EntryType = "Type1";
+
+            // The Yomi field will contain the character looked up for sorting
+            indexEntry.Yomi = "か";
+
+            // If we are sorting phonetically, we need to notify the index
+            index.UseYomi = true;
+
+            // For all our entry fields, we set the entry type to "Type1"
+            // Our field index will not list those entries unless we set its entry type to that of the entries
+            index.EntryType = "Type1";
+
+            builder.EndBookmark(mainBookmarkName);
+
+            doc.UpdateFields();
+            doc.Save(MyDir + @"\Artifacts\Field.XE.docx");
+            //ExEnd
+        }
     }
 }


Added support for the revoke mandate api call

--- Mollie.Api/Client/MandateClient.cs
+++ Mollie.Api/Client/MandateClient.cs
@@ -18,5 +18,9 @@
         public async Task<MandateResponse> CreateMandateAsync(string customerId, MandateRequest request) {
             return await this.PostAsync<MandateResponse>($"customers/{customerId}/mandates", request).ConfigureAwait(false);
         }
+
+        public async Task RevokeMandate(string customerId, string mandateId) {
+            await this.DeleteAsync($"customers/{customerId}/mandates{mandateId}").ConfigureAwait(false);
+        }
     }
 }


Allow parameters to be passed to initialization via resolve

--- MonoCross.Navigation/TypeLoader.cs
+++ MonoCross.Navigation/TypeLoader.cs
@@ -12,7 +12,7 @@
         private readonly bool _singletonInstance;
         private object _instance;
         private readonly Type _instanceType;
-        private readonly Func<object> _initialize;
+        private readonly Func<object[], object> _initialize;

         #region Constructors

@@ -20,14 +20,14 @@
         /// Initializes a new <see cref="TypeLoader"/> instance.
         /// </summary>
         /// <param name="instanceType">The <see cref="System.Type"/> to manage.</param>
-        public TypeLoader(Type instanceType) : this(instanceType, false, null) { }
+        public TypeLoader(Type instanceType) : this(instanceType, false) { }

         /// <summary>
         /// Initializes a new <see cref="TypeLoader"/> instance.
         /// </summary>
         /// <param name="instanceType">The <see cref="System.Type"/> to manage.</param>
         /// <param name="isSingleton"><c>true</c> to create and cache the instance; otherwise <c>false</c> to create every time.</param>
-        public TypeLoader(Type instanceType, bool isSingleton) : this(instanceType, isSingleton, null) { }
+        public TypeLoader(Type instanceType, bool isSingleton) : this(instanceType, isSingleton, (Func<object[], object>)null) { }

         /// <summary>
         /// Initializes a new <see cref="TypeLoader"/> instance.
@@ -40,16 +40,39 @@
         /// Initializes a new <see cref="TypeLoader"/> instance.
         /// </summary>
         /// <param name="instanceType">The <see cref="System.Type"/> to manage.</param>
+        /// <param name="initialization">A method that initializes the object.</param>
+        public TypeLoader(Type instanceType, Func<object[], object> initialization) : this(instanceType, false, initialization) { }
+
+        /// <summary>
+        /// Initializes a new <see cref="TypeLoader"/> instance.
+        /// </summary>
+        /// <param name="instanceType">The <see cref="System.Type"/> to manage.</param>
         /// <param name="isSingleton"><c>true</c> to create and cache the instance; otherwise <c>false</c> to create every time.</param>
         /// <param name="initialization">A method that initializes the object.</param>
         public TypeLoader(Type instanceType, bool isSingleton, Func<object> initialization)
         {
+            if (instanceType == null) throw new ArgumentNullException("instanceType");
+
+            _singletonInstance = isSingleton;
+            _instanceType = instanceType;
+            _initialize = p => initialization();
+            _instance = null;
+        }
+
+        /// <summary>
+        /// Initializes a new <see cref="TypeLoader"/> instance.
+        /// </summary>
+        /// <param name="instanceType">The <see cref="System.Type"/> to manage.</param>
+        /// <param name="isSingleton"><c>true</c> to create and cache the instance; otherwise <c>false</c> to create every time.</param>
+        /// <param name="initialization">A method that initializes the object.</param>
+        public TypeLoader(Type instanceType, bool isSingleton, Func<object[], object> initialization)
+        {
+            if (instanceType == null) throw new ArgumentNullException("instanceType");
+
             _singletonInstance = isSingleton;
             _instanceType = instanceType;
             _initialize = initialization;
             _instance = null;
-
-            if (instanceType == null) throw new ArgumentNullException("instanceType");
         }

         /// <summary>
@@ -143,7 +166,7 @@
             }
             else
             {
-                retval = _initialize();
+                retval = _initialize(parameters);
             }

             if (_singletonInstance)


Remove failing test after proving it will halt builds.

--- Mustachio.Tests/TemplateFixture.cs
+++ Mustachio.Tests/TemplateFixture.cs
@@ -9,12 +9,6 @@
 {
     public class TemplateFixture
     {
-
-        [Fact]
-        public void TestTravis()
-        {
-            throw new Exception("Ensuring unit tests fail in travis will halt build before publish.");
-        }

         [Fact]
         public void TemplateRendersContentWithNoVariables()


Add RemoveDuplicateNodes.

Add RemoveDuplicateNodes.

--- N2.Visualizer/Recovery/Recovery.cs
+++ N2.Visualizer/Recovery/Recovery.cs
@@ -1,8 +1,10 @@
 //#region Пролог
 #define DebugOutput
+using System.Collections;
 using JetBrains.Util;
 using N2.Internal;

+using NB = Nemerle.Builtins;
 using IntRuleCallKey = Nemerle.Builtins.Tuple<int, N2.Internal.RuleCallKey>;

 using System;
@@ -197,20 +199,66 @@
     {
       ParseAlternativeNode.DownToTop(nodes, RemoveChildrenIfAllChildrenIsEmpty);
       RemoveSuccessfullyParsed(nodes);
-      //RemoveDuplicateTopNodes(nodes);
+      RemoveDuplicateNodes(nodes);

       var bestNodes = FindBestNodes(nodes);
       return bestNodes;
     }

-    private static void RemoveDuplicateTopNodes(List<ParseAlternativeNode> nodes)
-    {
-      ParseAlternativeNode.DownToTop(nodes, RemoveDuplicateTopNodes);
-    }
-
-    private static void RemoveDuplicateTopNodes(ParseAlternativeNode node)
-    {
-      //node.Children.GroupBy(c => new { c.Frame.RuleKey, c.Frame.TextPos,  });
+    /// <summary>
+    /// Удаляет спекулятивные альтернативы, если среди результатов есть аналогичные не спекулятивные, а так же альтернативы у которых все дочерние
+    /// элементы удалены как успешно спарсившиеся или пустышки, и у альтернативы несходится TP и Start.
+    /// </summary>
+    private static void RemoveDuplicateNodes(List<ParseAlternativeNode> nodes)
+    {
+      ParseAlternativeNode.DownToTop(nodes, RemoveDuplicateNodes);
+    }
+
+    private static void RemoveDuplicateNodes(ParseAlternativeNode node)
+    {
+      var groups = node.Children.GroupBy(c => Create(c.Frame.RuleKey, c.ParseAlternative)).ToList();
+
+      foreach (var group in groups)
+      {
+        var g = group.ToList();
+
+        if (g.Count <= 1)
+          continue;
+
+        var index = g.FindIndex(n => !n.Frame.IsSpeculative && n.Frame.FailState == n.Frame.FailState2); // Ищем индекс не спекулятивного стека.
+        if (index >= 0)
+        {
+          // удаляем все кроме не спекулятивного стека
+          for (int i = 0; i < g.Count; i++)
+            if (i != index)
+              g[i].Remove();
+
+          return;
+        }
+
+        if (g.Any(n => n.Frame.TextPos < n.ParseAlternative.Start && n.IsTop))
+        {
+          var result = g.Where(n => n.Frame.TextPos < n.ParseAlternative.Start && n.IsTop).ToList();
+
+          if (g.Count == result.Count)
+            Debug.Assert(false, "У нас остались только невалидные альтернативы (n.Frame.TextPos < n.ParseAlternative.Start)");
+
+          foreach (var n in result)
+            n.Remove();
+
+          return;
+        }
+      }
+    }
+
+    private static NB.Tuple<T1, T2> Create<T1, T2>(T1 field1, T2 field2)
+    {
+      return new NB.Tuple<T1, T2>(field1, field2);
+    }
+
+    private static NB.Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 field1, T2 field2, T3 field3)
+    {
+      return new NB.Tuple<T1, T2, T3>(field1, field2, field3);
     }

     private static void RemoveSuccessfullyParsed(List<ParseAlternativeNode> nodes)
@@ -281,74 +329,6 @@
       }
       foreach (var child in node.Children)
         child.Remove();
-    }
-
-    private static List<RecoveryStackFrame> SelectBestFrames(List<RecoveryStackFrame> allFrames, int skipCount)
-    {
-      var bestFrames = new List<RecoveryStackFrame>();
-
-      for (int i = allFrames.Count - 1; i >= 0; --i)
-      {
-        var frame = allFrames[i];
-
-        if (!frame.Best)
-          continue;
-
-        if (!HasChildren(frame))
-        {
-          if (frame.Children.Count != 0)
-          {
-          }
-          bestFrames.Add(frame);
-          continue;
-        }
-
-        switch (frame.Id)
-        {
-          case 283: break;
-        }
-
-        // Отбрасывает всех потомков у которых свойство Best == false
-        var children0 = RecoveryUtils.OnlyBastFrames(frame);
-        // отбрасывает потомков не съедающих символов, в случае если они ростут из состяния допускающего пустую строку (цикл или необязательное правило)
-        // TODO: 1. Следующая эвристика отбрасывает вполне корректные альтернативы, которые могут пропарситься ниже по стеку.
-        // Например, в "случае class A {A(){ batch /*<-*/AddPart(); }}" выбрасываются варианты с проскипаным идентификатором.
-        var children1 = children0;//RecoveryUtils.FilterEmptyChildrenWhenFailSateCanParseEmptySting(frame, children0, skipCount);
-        // отберат фреймы которые которые продолжают парсинг с состояния облом. Такое может случиться если была пропущена грязь, а сразу за ней
-        // идет корректная конструкция. Пример из джейсона: {a:.2}. Здесь "." - это грязь за которой идет корректное Value. Фильтрация производится
-        // только если среди потомков есть подпадающие под условия.
-        var children2 = RecoveryUtils.FilterTopFramesWhichRecoveredOnFailStateIfExists(children1); // TODO: Похоже это дело дублирует FilterFailSateEqualsStateIfExists
-        // Если все потомки парсят пустую строку (во всех путях пропарсивания васех потомков ParentsEat == 0), то отбираем потомков с наименьшей глубиной (Depth).
-        // TODO: FilterBetterEmptyIfAllEmpty выбирает подветвь содержащую Extensible -> Postfix когда есть альтернатива с Extensible -> Prefix, которую нужно предпочитать
-        // Так что FilterBetterEmptyIfAllEmpty не применима.
-        var children3 = children2; // children2.FilterBetterEmptyIfAllEmpty();
-        // Если среди потомков есть фреймы пропарсившие код (у которых End >= 0), то отбираем их, отбрасывая фреймы пропарсившие с Fail-мо.
-        // TODO: Возожно нужно делать это более осторожно, так как при наличии нескольких ошибок Fail-фреймы могут оказаться более предпочтительным. Но возможно они отфильтруются раньше.
-        var children4 = RecoveryUtils.FilterNonFailedFrames(children3);
-        // Для каждой группы потомков с одинаковым местом фэйла (TextPos) отбираем такие которые начали парситься с меньшего состояния (подправила).
-        //var children5 = RecoveryUtils.SelectMinFailSateIfTextPosEquals(children4);
-        var children5 = children4;
-        // Отбрасываем потомков все альтеративы которых пропарсили пустую строку.
-        // TODO: 2. См. TODO 1.
-        var children6 = children5; //RecoveryUtils.FilterEmptyChildren(children5, skipCount);
-        var children9 = children6;//FilterNotEmpyPrefixChildren(frame, children6);
-
-        var bettreChildren = children9;
-        var poorerChildren = RecoveryUtils.SubstractSet(frame.Children, bettreChildren);
-
-        if (poorerChildren.Count > 0)
-          RecoveryUtils.ResetChildrenBestProperty(poorerChildren);
-
-        if (bettreChildren.Count == 0)
-          bestFrames.Add(frame);
-      }
-
-      return bestFrames;
-    }
-
-    private static bool HasChildren(RecoveryStackFrame frame)
-    {
-      return frame.Children.Any(c => c.Best);
     }

     private static List<RecoveryStackFrame> FilterBestIfExists(List<RecoveryStackFrame> bestFrames)
@@ -1233,6 +1213,58 @@
 	  {
 	    return alternatives0.Where(a => a.End >= 0).ToList();
 	  }
+
+    public static bool LongerThan<T>(this IEnumerable<T> collection, int count)
+    {
+      Debug.Assert(count >= 0);
+
+      // ReSharper disable once PossibleMultipleEnumeration
+      int len = TryGetFastCount<T>(collection);
+
+      if (len >= 0)
+        return len > count;
+
+      var num = 0;
+
+      foreach (var obj in collection)
+        if (++num > count)
+          return true;
+
+      return false;
+    }
+
+    public static bool CountIs<T>(this IEnumerable<T> collection, int exactCount)
+    {
+      int count = TryGetFastCount<T>(collection);
+      if (count >= 0)
+        return count == exactCount;
+
+      var num = 0;
+
+      foreach (var obj in collection)
+      {
+        if (++num > exactCount)
+          return false;
+      }
+      return num == exactCount;
+    }
+
+    public static int TryGetFastCount<T>(this IEnumerable<T> collection)
+    {
+      var collection1 = collection as ICollection<T>;
+      if (collection1 != null)
+        return collection1.Count;
+
+      var collection2 = collection as ICollection;
+      if (collection2 != null)
+        return collection2.Count;
+
+      var str = collection as string;
+      if (str != null)
+        return str.Length;
+
+      return -1;
+    }
   }

   static class ParseAlternativesVisializer


debug async method

debug async method

--- NConcern/NConcern.Debug/Program.cs
+++ NConcern/NConcern.Debug/Program.cs
@@ -17,6 +17,16 @@
         public async Task<int> AddAsync(int a, int b)
         {
             return await Task.Run(() => this.Add(a, b));
+        }
+
+        public int AddFailed(int a, int b)
+        {
+            throw new InvalidOperationException("bug");
+        }
+
+        public async Task<int> AddFailedAsync(int a, int b)
+        {
+            return await Task.Run(() => this.AddFailed(a, b));
         }
     }

@@ -68,6 +78,9 @@
             Aspect.Weave<ResourceTechnicalAspect<Resource1>>(Metadata<Calculator>.Method(_Calculator => _Calculator.Add(Argument<int>.Value, Argument<int>.Value)));
             Aspect.Weave<ResourceTechnicalAspect<Resource2>>(Metadata<Calculator>.Method(_Calculator => _Calculator.AddAsync(Argument<int>.Value, Argument<int>.Value)));

+            Aspect.Weave<ResourceTechnicalAspect<Resource1>>(Metadata<Calculator>.Method(_Calculator => _Calculator.AddFailed(Argument<int>.Value, Argument<int>.Value)));
+            Aspect.Weave<ResourceTechnicalAspect<Resource2>>(Metadata<Calculator>.Method(_Calculator => _Calculator.AddFailedAsync(Argument<int>.Value, Argument<int>.Value)));
+
             //Create calculator.
             var _calculator = new Calculator();

@@ -76,6 +89,24 @@

             //Call async method.
             int result1 = _calculator.AddAsync(2, 3).Result;
+
+            //Call synchronous method.
+            try
+            {
+                var _result2 = _calculator.AddFailed(2, 3);
+            }
+            catch (Exception e)
+            {
+            }
+
+            //Call async method.
+            try
+            {
+                int result3 = _calculator.AddFailedAsync(2, 3).Result;
+            }
+            catch (Exception e)
+            {
+            }
         }
     }
 }


Nothing changed

Nothing changed

--- NUnit.Tests/Presenter/Presenter.cs
+++ NUnit.Tests/Presenter/Presenter.cs
@@ -15,6 +15,9 @@
             this._view.Loaded += _view_Loaded;
         }

+        /// <summary>
+        ///
+        /// </summary>
         private void _view_Loaded()
         {
             _view.Render("Hello World");


Added Minimum and Maximum values

Added Minimum and Maximum values

--- NativeUI/Items/UIMenuSliderItem.cs
+++ NativeUI/Items/UIMenuSliderItem.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Drawing;

 namespace NativeUI
@@ -12,16 +12,54 @@
         protected UIResRectangle _rectangleSlider;
         protected UIResRectangle _rectangleDivider;

+        protected int _min = 0;
         protected int _value = 0;
+        protected int _max = 100;

         /// <summary>
         /// Triggered when the slider is changed.
         /// </summary>
         public event ItemSliderEvent OnSliderChanged;
-
+
+
         /// <summary>
-        /// Returns the value of the slider.
+        /// The minimum value of the slider.
+        /// </summary>
+        public int Minimum
+        {
+            get
+            {
+                return _min;
+            }
+            set
+            {
+                if (value < 0)
+                    _min = 0;
+                else
+                    _min = value;
+            }
+        }
+        /// <summary>
+        /// The maximum value of the slider.
+        /// </summary>
+        public int Maximum
+        {
+            get
+            {
+                return _max;
+            }
+            set
+            {
+                _min = value;
+                if (_value > value)
+                {
+                    _value = value;
+                }
+            }
+        }
+        /// <summary>
+        /// Curent value of the slider.
         /// </summary>
         public int Value
         {
@@ -31,7 +69,9 @@
             }
             set
             {
-                if (value > 100)
+                if (value < _min)
+                    _value = 0;
+                else if (value > _max)
                     _value = 100;
                 else
                     _value = value;


按下enter，觸發button event（use accept button)

--- NoticeRepeatFile/Form1.Designer.cs
+++ NoticeRepeatFile/Form1.Designer.cs
@@ -157,6 +157,7 @@
             //
             // Form1
             //
+            this.AcceptButton = this.button2;
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(689, 378);


Renamed ObjectAttributes to AttributeFlags.

--- NtObjectManager/NtObjectCmdlets.cs
+++ NtObjectManager/NtObjectCmdlets.cs
@@ -33,7 +33,8 @@
         /// <para type="description">Object Attribute flags used during Open/Create calls.</para>
         /// </summary>
         [Parameter]
-        public AttributeFlags ObjectAttributes { get; set; }
+        [Alias("ObjectAttributes")]
+        public AttributeFlags AttributesFlags { get; set; }

         /// <summary>
         /// <para type="description">Set to provide an explicit security descriptor to a newly created object.</para>
@@ -68,7 +69,7 @@
         /// </summary>
         protected NtObjectBaseNoPathCmdlet()
         {
-            ObjectAttributes = AttributeFlags.CaseInsensitive;
+            AttributesFlags = AttributeFlags.CaseInsensitive;
         }

         /// <summary>
@@ -106,7 +107,7 @@
         /// </summary>
         protected override void ProcessRecord()
         {
-            WriteObject(CreateObject(null, ObjectAttributes, null, SecurityQualityOfService, SecurityDescriptor), true);
+            WriteObject(CreateObject(null, AttributesFlags, null, SecurityQualityOfService, SecurityDescriptor), true);
         }

         #region IDisposable Support
@@ -330,7 +331,7 @@
                     }
                     builder.Append(@"\");
                 }
-                objects.Add((NtObject)CreateObject(ResolvePath(), ObjectAttributes, Root, SecurityQualityOfService, SecurityDescriptor));
+                objects.Add((NtObject)CreateObject(ResolvePath(), AttributesFlags, Root, SecurityQualityOfService, SecurityDescriptor));
                 finished = true;
             }
             finally
@@ -352,7 +353,7 @@
             VerifyParameters();
             try
             {
-                WriteObject(CreateObject(ResolvePath(), ObjectAttributes, Root, SecurityQualityOfService, SecurityDescriptor), true);
+                WriteObject(CreateObject(ResolvePath(), AttributesFlags, Root, SecurityQualityOfService, SecurityDescriptor), true);
             }
             catch (NtException ex)
             {
@@ -484,7 +485,7 @@
         protected override object CreateObject(ObjectAttributes obj_attributes)
         {
             string type_name = string.IsNullOrWhiteSpace(TypeName) ? null : TypeName;
-            return NtObject.OpenWithType(type_name, ResolvePath(), Root, ObjectAttributes, Access, SecurityQualityOfService);
+            return NtObject.OpenWithType(type_name, ResolvePath(), Root, AttributesFlags, Access, SecurityQualityOfService);
         }
     }


Rename variables to use camelCase

Rename variables to use camelCase

--- OpenKh.Patcher/PatcherProcessor.cs
+++ OpenKh.Patcher/PatcherProcessor.cs
@@ -45,7 +45,7 @@
                 {
                     var originalFile = GetOriginalAssetPath(fileName);
                     if (File.Exists(originalFile))
-                        File.Copy(originalFile, dstFile);
+                        File.Copy(originalFile, dstFile,true);
                 }
             }
         }
@@ -302,54 +302,54 @@
                     switch (source.Type)
                     {
                         case "trsr":
-                            var TrsrList = Kh2.SystemData.Trsr.Read(stream).ToDictionary(x => x.Id, x => x);
+                            var trsrList = Kh2.SystemData.Trsr.Read(stream).ToDictionary(x => x.Id, x => x);
                             var moddedTrsr = deserializer.Deserialize<Dictionary<int, Kh2.SystemData.Trsr>>(sourceText);
                             foreach (KeyValuePair<int, Kh2.SystemData.Trsr> treasure in moddedTrsr)
                             {
-                                TrsrList[treasure.Value.Id].ItemId = treasure.Value.ItemId;
+                                trsrList[treasure.Value.Id].ItemId = treasure.Value.ItemId;
                             }
-                                Kh2.SystemData.Trsr.Write(stream.SetPosition(0), TrsrList.Values);
+                                Kh2.SystemData.Trsr.Write(stream.SetPosition(0), trsrList.Values);
                             break;

                         case "item":
-                            var ItemList = Kh2.SystemData.Item.Read(stream);
+                            var itemList = Kh2.SystemData.Item.Read(stream);
                             var moddedItem = deserializer.Deserialize<Kh2.SystemData.Item>(sourceText);
-                            ItemList = moddedItem;
-                            ItemList.Write(stream.SetPosition(0));
+                            itemList = moddedItem;
+                            itemList.Write(stream.SetPosition(0));
                             break;

                         case "fmlv":
-                            var FormList = Kh2.Battle.Fmlv.Read(stream).ToDictionary(x => String.Concat(x.FormFm, x.FormLevel), x => x);
+                            var formList = Kh2.Battle.Fmlv.Read(stream).ToDictionary(x => String.Concat(x.FormFm, x.FormLevel), x => x);
                             var moddedForms = deserializer.Deserialize<Dictionary<string, Kh2.Battle.Fmlv.Level>>(sourceText);
                             foreach (KeyValuePair<string, Kh2.Battle.Fmlv.Level> form in moddedForms)
                             {
-                                FormList[form.Key].Ability = form.Value.Ability;
-                                FormList[form.Key].LevelGrowthAbility = form.Value.LevelGrowthAbility;
-                                FormList[form.Key].Exp = form.Value.Exp;
+                                formList[form.Key].Ability = form.Value.Ability;
+                                formList[form.Key].LevelGrowthAbility = form.Value.LevelGrowthAbility;
+                                formList[form.Key].Exp = form.Value.Exp;
                             }
-                            Kh2.Battle.Fmlv.Write(stream.SetPosition(0), FormList.Values);
+                            Kh2.Battle.Fmlv.Write(stream.SetPosition(0), formList.Values);
                             break;

                         case "lvup":
-                            var LevelList = Kh2.Battle.Lvup.Read(stream);
+                            var levelList = Kh2.Battle.Lvup.Read(stream);
                             var moddedLevels = deserializer.Deserialize<Kh2.Battle.Lvup>(sourceText);
                             int i = 0;
                             foreach (Kh2.Battle.Lvup.PlayableCharacter character in moddedLevels.Characters)
                             {
-                                LevelList.Characters[i].Levels = character.Levels;
+                                levelList.Characters[i].Levels = character.Levels;
                                 i++;
                             }
-                            LevelList.Write(stream.SetPosition(0));
+                            levelList.Write(stream.SetPosition(0));
                             break;

                         case "bons":
-                            var BonusList = Kh2.Battle.Bons.Read(stream).ToDictionary(x => String.Concat(x.RewardId, characterMap.FirstOrDefault(y => y.Value == x.CharacterId).Key), x => x);
+                            var bonusList = Kh2.Battle.Bons.Read(stream).ToDictionary(x => String.Concat(x.RewardId, characterMap.FirstOrDefault(y => y.Value == x.CharacterId).Key), x => x);
                             var moddedBonus = deserializer.Deserialize<Dictionary<string, Kh2.Battle.Bons>>(sourceText);
                             foreach (KeyValuePair<string, Kh2.Battle.Bons> bonus in moddedBonus)
                             {
-                                BonusList[bonus.Key] = bonus.Value;
+                                bonusList[bonus.Key] = bonus.Value;
                             }
-                            Kh2.Battle.Bons.Write(stream.SetPosition(0), BonusList.Values);
+                            Kh2.Battle.Bons.Write(stream.SetPosition(0), bonusList.Values);
                             break;

                         default:


Tweah head bake:
* Skin is drawn last on the head
* Apply hair pattern on top of the hair texture

git-svn-id: e915c4f8b2ea2a6e63cbe989b51c0994a698cc26@3084 52acb1d6-8a22-11de-b505-999d5b087335

--- OpenMetaverse/Imaging/BakeLayer.cs
+++ OpenMetaverse/Imaging/BakeLayer.cs
@@ -116,22 +116,22 @@
                 InitBakedLayerColor(textures[0].Color);
             }

-            // If we don't have skin textures, apply defaults
-            bool noSkinTexture = textures.Count == 0 || textures[0].Texture == null;
-
-            if (noSkinTexture && bakeType == BakeType.Head)
+            // Do we have skin texture?
+            bool SkinTexture = textures.Count > 0 && textures[0].Texture != null;
+
+            if (bakeType == BakeType.Head)
             {
                 DrawLayer(LoadResourceLayer("head_color.tga"), false);
                 AddAlpha(bakedTexture.Image, LoadResourceLayer("head_alpha.tga"));
                 MultiplyLayerFromAlpha(bakedTexture.Image, LoadResourceLayer("head_skingrain.tga"));
             }

-            if (noSkinTexture && bakeType == BakeType.UpperBody)
+            if (!SkinTexture && bakeType == BakeType.UpperBody)
             {
                 DrawLayer(LoadResourceLayer("upperbody_color.tga"), false);
             }

-            if (noSkinTexture && bakeType == BakeType.LowerBody)
+            if (!SkinTexture && bakeType == BakeType.LowerBody)
             {
                 DrawLayer(LoadResourceLayer("lowerbody_color.tga"), false);
             }
@@ -139,7 +139,12 @@
             // Layer each texture on top of one other, applying alpha masks as we go
             for (int i = 0; i < textures.Count; i++)
             {
+                // Skip if we have no texture on this layer
                 if (textures[i].Texture == null) continue;
+
+                // Don't draw skin on head bake first
+                // For head bake skin texture is drawn last, go figure
+                if (bakeType == BakeType.Head && i == 0) continue;

                 ManagedImage texture = textures[i].Texture.Image.Clone();
                 //File.WriteAllBytes(bakeType + "-texture-layer-" + i + ".tga", texture.ExportTGA());
@@ -150,6 +155,18 @@
                 {
                     try { texture.ResizeNearestNeighbor(bakeWidth, bakeHeight); }
                     catch (Exception) { continue; }
+                }
+
+                // Special case for hair layer for the head bake
+                // If we don't have skin texture, we discard hair alpha
+                // and apply hair pattern over the texture
+                if (!SkinTexture && bakeType == BakeType.Head && i == 1)
+                {
+                    if (texture.Alpha != null)
+                    {
+                        for (int j = 0; j < texture.Alpha.Length; j++) texture.Alpha[j] = (byte)255;
+                    }
+                    MultiplyLayerFromAlpha(texture, LoadResourceLayer("head_hair.tga"));
                 }

                 // Aply tint and alpha masks except for skin that has a texture
@@ -195,17 +212,28 @@
                             }
                         }

-                        // Finally, apply combined alpha mask to the cloned texture
+                        // Apply combined alpha mask to the cloned texture
                         if (addedMasks > 0)
                             AddAlpha(texture, combinedMask);
                         //File.WriteAllBytes(bakeType + "-masked-texture-" + i + ".tga", texture.ExportTGA());
                     }
                 }

-                // Only skirt and head bake have alpha channels
-                bool useAlpha = i == 0 && (bakeType == BakeType.Head || BakeType == BakeType.Skirt);
+                bool useAlpha = i == 0 && (BakeType == BakeType.Skirt);
                 DrawLayer(texture, useAlpha);
                 //File.WriteAllBytes(bakeType + "-layer-" + i + ".tga", texture.ExportTGA());
+            }
+
+            // For head, we add skin last
+            if (SkinTexture && bakeType == BakeType.Head)
+            {
+                ManagedImage texture = textures[0].Texture.Image.Clone();
+                if (texture.Width != bakeWidth || texture.Height != bakeHeight)
+                {
+                    try { texture.ResizeNearestNeighbor(bakeWidth, bakeHeight); }
+                    catch (Exception) { }
+                }
+                DrawLayer(texture, false);
             }

             // We are done, encode asset for finalized bake
@@ -541,4 +569,4 @@
         }
         #endregion
     }
-}
+}


Added remote logging log level wrappers

Added remote logging log level wrappers

--- Oxide.Core/Logging/RemoteLogger.cs
+++ Oxide.Core/Logging/RemoteLogger.cs
@@ -83,12 +83,37 @@

         public static void Debug(string message)
         {
-            var assembly = Assembly.GetCallingAssembly();
-            var culprit = GetCurrentMethod();
-            var body = JsonConvert.SerializeObject(new Report("debug", assembly, culprit, message));
-            Interface.Oxide.LogWarning("Requesting: " + url);
-            Interface.Oxide.LogDebug(body);
-            webrequests.EnqueuePost(url, body, (a, b) => Interface.Oxide.LogDebug("Request complete: " + a + " -> " + b), null, BuildHeaders());
+            SendReport("debug", Assembly.GetCallingAssembly(), GetCurrentMethod(), message);
+        }
+
+        public static void Info(string message)
+        {
+            SendReport("info", Assembly.GetCallingAssembly(), GetCurrentMethod(), message);
+        }
+
+        public static void Warning(string message)
+        {
+            SendReport("warning", Assembly.GetCallingAssembly(), GetCurrentMethod(), message);
+        }
+
+        public static void Error(string message)
+        {
+            SendReport("error", Assembly.GetCallingAssembly(), GetCurrentMethod(), message);
+        }
+
+        public static void Exception(string message, Exception exception)
+        {
+            SendReport("exception", Assembly.GetCallingAssembly(), GetCurrentMethod(), message, exception.ToString());
+        }
+
+        private static void SendReport(string level, Assembly assembly, string culprit, string message, string exception = null)
+        {
+            var body = JsonConvert.SerializeObject(new Report(level, assembly, culprit, message, exception.ToString()));
+            webrequests.EnqueuePost(url, body, OnReportSent, null, BuildHeaders());
+        }
+
+        private static void OnReportSent(int code, string response)
+        {
         }

         [MethodImpl(MethodImplOptions.NoInlining)]


Update EffortConnection.cs

Update EffortConnection.cs

--- Main/Source/Effort.Shared/Provider/EffortConnection.cs
+++ Main/Source/Effort.Shared/Provider/EffortConnection.cs
@@ -23,12 +23,12 @@
 // --------------------------------------------------------------------------------------------

+using System.Collections.Generic;
 using System.Data.Entity;
 using System.Linq;
 using System.Reflection;
 using Effort.Internal.CommandActions;
 using Effort.Shared.Provider;
-using Effort.Internal.CommandActions;

 namespace Effort.Provider
 {


fix open .nuspec files

fix open .nuspec files

--- PackageExplorer/MainWindow.xaml.cs
+++ PackageExplorer/MainWindow.xaml.cs
@@ -162,7 +162,7 @@
                 {
                     using (var str = ManifestUtility.ReadManifest(tempFile))
                     {
-                        var builder = new PackageBuilder(str, Path.GetDirectoryName(tempFile));
+                        var builder = new PackageBuilder(str, Path.GetDirectoryName(packagePath));
                         package = builder.Build();
                     }
                 }


Update PlexDirHelper.cs

Update PlexDirHelper.cs

Minor cleanup

--- PlexServiceCommon/PlexDirHelper.cs
+++ PlexServiceCommon/PlexDirHelper.cs
@@ -18,11 +18,7 @@
 			result = String.Empty;
 			var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"));

-			var architecture = RegistryView.Registry32;
-			if (is64Bit)
-			{
-				architecture = RegistryView.Registry64;
-			}
+			var architecture = is64Bit ? RegistryView.Registry64 : RegistryView.Registry32;

 			using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture)
 				.OpenSubKey(@"Software\Plex, Inc.\Plex Media Server");


Finish PCB drawing

Finish PCB drawing

--- PlotterWin10/DvdPlotter/Painter.cs
+++ PlotterWin10/DvdPlotter/Painter.cs
@@ -211,7 +211,7 @@
             var w = 11;

             // outer frame
-            for (var i = 0; i < w; i++)
+            for (var i = 0; i < w/2; i++)
             {
                 plotter.GoToXY(i, i);
                 plotter.GoToXY(300-i, i);


fixup

fixup

--- Plugins/Wox.Plugin.Program/Main.cs
+++ Plugins/Wox.Plugin.Program/Main.cs
@@ -38,7 +38,7 @@
                 _uwpStorage = new BinaryStorage<UWP.Application[]>("UWP");
                 _uwps = _uwpStorage.TryLoad(new UWP.Application[] { });
             });
-            Log.Info($"|Wox.Plugin.Program.Main|Number of preload win32 programs<{_win32s.Length}>");
+            Log.Info($"|Wox.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>");
             Log.Info($"|Wox.Plugin.Program.Main|Number of preload uwps <{_uwps.Length}>");
             Task.Run(() =>
             {


Refactoring to use the new ReflectionExtensions helper method for the self test convention

--- tests/FixieSpec.Tests/SelfTestConvention.cs
+++ tests/FixieSpec.Tests/SelfTestConvention.cs
@@ -17,9 +17,7 @@
             Classes
                 .NameEndsWith("Tests")
                 .InTheSameNamespaceAs(typeof(SelfTestConvention))
-                .Where(type =>
-                    type.GetConstructors()
-                    .All(constructorInfo => constructorInfo.GetParameters().Length == 0));
+                .Where(type => type.HasOnlyDefaultConstructor());

             Methods.Where(method => method.IsPublic && method.IsVoid());


Build and print the trie

Build and print the trie

--- ProgrammingPraxis/red_squiggles.cs
+++ ProgrammingPraxis/red_squiggles.cs
@@ -13,7 +13,39 @@
     private class Node
     {
         internal Dictionary<char, Node> Next = new Dictionary<char, Node>();
-        bool IsWord = false;
+        internal bool IsWord = false;
+
+        public override String ToString()
+        {
+            return String.Format("[Node.IsWord:{0} {1}]",
+                                 IsWord,
+                                 String.Join(", ", Next.Select(x =>
+                                                               String.Format("{0} => {1}", x.Key, x.Value.ToString()))));
+        }
+    }
+
+    private readonly Node Root = new Node();
+
+    public void Add(String s)
+    {
+        Node current = Root;
+        for (int i = 0; i < s.Length; i++)
+        {
+            Node next;
+            if (!current.Next.TryGetValue(s[i], out next))
+            {
+                next = new Node();
+                current.Next[s[i]] = next;
+            }
+
+            next.IsWord = i == s.Length - 1;
+            current = next;
+        }
+    }
+
+    public override String ToString()
+    {
+        return Root.ToString();
     }
 }

@@ -27,8 +59,10 @@
             String line;
             while ((line = reader.ReadLine()) != null)
             {
-                Console.WriteLine(line);
+                trie.Add(line);
             }
         }
+
+        Console.WriteLine(trie);
     }
 }


Bump to 1.4.1

Bump to 1.4.1

--- ArchiSteamFarm/Properties/AssemblyInfo.cs
+++ ArchiSteamFarm/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.4.0.0")]
-[assembly: AssemblyFileVersion("1.4.0.0")]
+[assembly: AssemblyVersion("1.4.1.0")]
+[assembly: AssemblyFileVersion("1.4.1.0")]


Check for missing logger config.

Check for missing logger config.

--- Assets/Scripts/System/LogOutputHandler.cs
+++ Assets/Scripts/System/LogOutputHandler.cs
@@ -37,11 +37,13 @@
   }

     public IEnumerator SendData(WWWForm form) {
-        string token = GM.options.logger["token"];
-        string url = "http://logs-01.loggly.com/inputs/" + token;
+        if (GM.options.logger != null) {
+            string token = GM.options.logger["token"];
+            string url = "http://logs-01.loggly.com/inputs/" + token;

-        // Send WWW Form to Loggly, replace TOKEN with your unique ID from Loggly
-        WWW sendLog = new WWW(url, form);
-        yield return sendLog;
+            // Send WWW Form to Loggly, replace TOKEN with your unique ID from Loggly
+            WWW sendLog = new WWW(url, form);
+            yield return sendLog;
+        }
     }
 }


Applying patch from issue 83, more additions (and a code cleanup) to GroupManager

git-svn-id: c32cf1ecefca26b8770d7b0740bc0c5c174087e4@1106 c754d5e9-d413-0410-bcdf-9574c9dba6b7

--- libsecondlife/GroupManager.cs
+++ libsecondlife/GroupManager.cs
@@ -30,6 +30,8 @@

 namespace libsecondlife
 {
+    #region Structs
+
     ///
     /// Avatar group management
     ///
@@ -193,6 +195,18 @@
         public int NumVotes;
     }

+    public struct GroupProposal
+    {
+
+        public string VoteText;
+
+        public int Quorum;
+
+        public float Majority;
+
+        public int Duration;
+    }
+
     ///
     ///
     ///
@@ -272,7 +286,7 @@
     ///
     /// A single transaction made by a group
     ///
-    public class Transaction
+    public struct Transaction
     {
         ///
         public string Time;
@@ -285,6 +299,105 @@
         ///
         public int Amount;
     }
+
+    ///
+    /// Struct representing a group notice
+    ///
+    public struct GroupNotice
+    {
+        ///
+        public string Subject;
+        ///
+        public string Message;
+        ///
+        public LLUUID AttachmentID;
+        ///
+        public LLUUID OwnerID;
+
+        ///
+        ///
+        ///
+        /// <returns></returns>
+        public byte[] SerializeAttachment()
+        {
+            if (OwnerID == null || OwnerID == LLUUID.Zero || AttachmentID == null || AttachmentID == LLUUID.Zero)
+                return new byte[0];
+            //I guess this is how this works, no gaurentees
+            string lsd = "<llsd><item_id>" + AttachmentID.ToString() + "</item_id><owner_id>"
+                + OwnerID.ToString() + "</owner_id></llsd>";
+            return Helpers.StringToField(lsd);
+        }
+    }
+
+    #endregion Structs
+
+    #region Enums
+
+    ///
+    /// Role update flags
+    ///
+    public enum GroupRoleUpdate : uint
+    {
+        NoUpdate,
+        UpdateData,
+        UpdatePowers,
+        UpdateAll,
+        Create,
+        Delete
+    }
+
+    ///
+    /// Group role powers flags
+    ///
+    [Flags]
+    public enum GroupRolePowers : long
+    {
+        None = 0,
+        Invite = 1 << 1,
+        Eject = 1 << 2,
+        ChangeOptions = 1 << 3,
+        CreateRole = 1 << 4,
+        DeleteRole = 1 << 5,
+        RoleProperties = 1 << 6,
+        AssignMemberLimited = 1 << 7,
+        AssignMember = 1 << 8,
+        RemoveMember = 1 << 9,
+        ChangeActions = 1 << 10,
+        ChangeIdentity = 1 << 11,
+        LandDeed = 1 << 12,
+        LandRelease = 1 << 13,
+        LandSetSale = 1 << 14,
+        LandDevideJoin = 1 << 15,
+        FindPlaces = 1 << 17,
+        LandChangeIdentity = 1 << 18,
+        SetLandingPoint = 1 << 19,
+        ChangeMedia = 1 << 20,
+        LandEdit = 1 << 21,
+        LandOptions = 1 << 22,
+        AllowEditLand = 1 << 23,
+        AllowFly = 1 << 24,
+        AllowRez = 1 << 25,
+        AllowLandmark = 1 << 26,
+        AllowSetHome = 1 << 28,
+        LandManageAllowed = 1 << 29,
+        LandManageBanned = 1 << 30,
+        LandManagePasses = 1 << 31,
+        LandEjectAndFreeze = 1 << 32,
+        ReturnGroupOwned = 1 << 48,
+        ReturnGroupSet = 1 << 33,
+        ReturnNonGroup = 1 << 34,
+        LandGardening = 1 << 35,
+        DeedObject = 1 << 36,
+        ObjectManipulate = 1 << 38,
+        ObjectSetForSale = 1 << 39,
+        Accountable = 1 << 40,
+        SendNotices = 1 << 42,
+        ReceiveNotices = 1 << 43,
+        StartProposal = 1 << 44,
+        VoteOnProposal = 1 << 45
+    }
+
+    #endregion Enums

     ///
     /// Handles all network traffic related to reading and writing group
@@ -292,6 +405,8 @@
     ///
     public class GroupManager
     {
+        #region Delegates
+
         ///
         /// Callback for the list of groups the avatar is currently a member of
         ///
@@ -338,6 +453,9 @@
         /// <param name="transactions"></param>
         public delegate void GroupAccountTransactionsCallback(GroupAccountTransactions transactions);

+        #endregion Delegates
+
+        #region Events

         ///
         public event CurrentGroupsCallback OnCurrentGroups;
@@ -357,6 +475,8 @@
         public event GroupAccountDetailsCallback OnGroupAccountDetails;
         ///
         //public event GroupAccountTransactionsCallback OnGroupAccountTransactions;
+
+        #endregion Events

         private SecondLife Client;
@@ -428,11 +548,7 @@
         public void BeginGetGroupMembers(LLUUID group)
         {
             LLUUID requestID = LLUUID.Random();
-
-            lock (GroupMembersCaches)
-            {
-                GroupMembersCaches[requestID] = new Dictionary<LLUUID, GroupMember>();
-            }
+            lock (GroupMembersCaches) GroupMembersCaches[requestID] = new Dictionary<LLUUID, GroupMember>();

             GroupMembersRequestPacket request = new GroupMembersRequestPacket();

@@ -451,11 +567,7 @@
         public void BeginGetGroupRoles(LLUUID group)
         {
             LLUUID requestID = LLUUID.Random();
-
-            lock (GroupRolesCaches)
-            {
-                GroupRolesCaches[requestID] = new Dictionary<LLUUID, GroupRole>();
-            }
+            lock (GroupRolesCaches) GroupRolesCaches[requestID] = new Dictionary<LLUUID, GroupRole>();

             GroupRoleDataRequestPacket request = new GroupRoleDataRequestPacket();

@@ -467,6 +579,10 @@
             Client.Network.SendPacket(request);
         }

+        ///
+        ///
+        ///
+        /// <param name="group"></param>
         public void BeginGetGroupRoleMembers(LLUUID group)
         {
             LLUUID requestID = LLUUID.Random();
@@ -500,6 +616,238 @@

             Client.Network.SendPacket(request);
         }
+
+        ///
+        /// Begin to get the group account summary
+        ///
+        /// <param name="group">The group's ID</param>
+        /// <param name="intervalDays">How long of an interval</param>
+        /// <param name="currentInterval">Which interval (0 for current, 1 for last)</param>
+        public void BeginGetGroupAccountSummary(LLUUID group, int intervalDays, int currentInterval)
+        {
+            GroupAccountSummaryRequestPacket p = new GroupAccountSummaryRequestPacket();
+            p.AgentData.AgentID = Client.Network.AgentID;
+            p.AgentData.SessionID = Client.Network.SessionID;
+            p.AgentData.GroupID = group;
+            p.MoneyData.RequestID = LLUUID.Random();
+            p.MoneyData.CurrentInterval = currentInterval;
+            p.MoneyData.IntervalDays = intervalDays;
+            Client.Network.SendPacket(p);
+        }
+
+        ///
+        /// Invites a user to a group
+        ///
+        /// <param name="group">The group to invite to.</param>
+        /// <param name="roles">A list of roles to invite a person to</param>
+        /// <param name="personkey">Key of person to invite</param>
+        public void Invite(LLUUID group, List<LLUUID> roles, LLUUID personkey)
+        {
+            libsecondlife.Packets.InviteGroupRequestPacket igp = new libsecondlife.Packets.InviteGroupRequestPacket();
+            igp.AgentData = new libsecondlife.Packets.InviteGroupRequestPacket.AgentDataBlock();
+            igp.AgentData.AgentID = Client.Network.AgentID;
+            igp.AgentData.SessionID = Client.Network.SessionID;
+            igp.GroupData = new libsecondlife.Packets.InviteGroupRequestPacket.GroupDataBlock();
+            igp.GroupData.GroupID = group;
+            List<libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock> idbs = new List<libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock>();
+            foreach (LLUUID role in roles)
+            {
+                libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock idb = new libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock();
+                idb.InviteeID = personkey;
+                idb.RoleID = role;
+                idbs.Add(idb);
+            }
+            igp.InviteData = idbs.ToArray();
+            Client.Network.SendPacket(igp);
+        }
+
+        ///
+        /// Create a new group. This method automaticaly deducts the group creation feild
+        ///
+        /// <param name="group">Group struct containing the new group info</param>
+        public void CreateGroup(Group group)
+        {
+            libsecondlife.Packets.CreateGroupRequestPacket cgrp = new CreateGroupRequestPacket();
+            //Fill in agent data
+            cgrp.AgentData = new CreateGroupRequestPacket.AgentDataBlock();
+            cgrp.AgentData.AgentID = Client.Network.AgentID;
+            cgrp.AgentData.SessionID = Client.Network.SessionID;
+            //Fill in group data
+            cgrp.GroupData = new CreateGroupRequestPacket.GroupDataBlock();
+            cgrp.GroupData.AllowPublish = group.AllowPublish;
+            cgrp.GroupData.Charter = Helpers.StringToField(group.Charter);
+            cgrp.GroupData.InsigniaID = group.InsigniaID;
+            cgrp.GroupData.MaturePublish = group.MaturePublish;
+            cgrp.GroupData.MembershipFee = group.MembershipFee;
+            cgrp.GroupData.Name = Helpers.StringToField(group.Name);
+            cgrp.GroupData.OpenEnrollment = group.OpenEnrollment;
+            cgrp.GroupData.ShowInList = group.ShowInList;
+            //Send it
+            Client.Network.SendPacket(cgrp);
+        }
+
+        ///
+        /// Update a group's profile and other information
+        ///
+        /// <param name="group">Group struct to update</param>
+        public void UpdateGroup(LLUUID id, Group group)
+        {
+            libsecondlife.Packets.UpdateGroupInfoPacket cgrp = new UpdateGroupInfoPacket();
+            //Fill in agent data
+            cgrp.AgentData = new UpdateGroupInfoPacket.AgentDataBlock();
+            cgrp.AgentData.AgentID = Client.Network.AgentID;
+            cgrp.AgentData.SessionID = Client.Network.SessionID;
+            //Fill in group data
+            cgrp.GroupData = new UpdateGroupInfoPacket.GroupDataBlock();
+            cgrp.GroupData.GroupID = id;
+            cgrp.GroupData.AllowPublish = group.AllowPublish;
+            cgrp.GroupData.Charter = Helpers.StringToField(group.Charter);
+            cgrp.GroupData.InsigniaID = group.InsigniaID;
+            cgrp.GroupData.MaturePublish = group.MaturePublish;
+            cgrp.GroupData.MembershipFee = group.MembershipFee;
+            cgrp.GroupData.OpenEnrollment = group.OpenEnrollment;
+            cgrp.GroupData.ShowInList = group.ShowInList;
+            //Send it
+            Client.Network.SendPacket(cgrp);
+        }
+
+        ///
+        /// Eject a user from a group
+        ///
+        /// <param name="group">Group to eject the user from</param>
+        /// <param name="member">Avatar's key to eject</param>
+        public void EjectUser(LLUUID group, LLUUID member)
+        {
+            libsecondlife.Packets.EjectGroupMemberRequestPacket eject = new EjectGroupMemberRequestPacket();
+            eject.AgentData = new EjectGroupMemberRequestPacket.AgentDataBlock();
+            eject.AgentData.AgentID = Client.Network.AgentID;
+            eject.AgentData.SessionID = Client.Network.SessionID;
+            //Group
+            eject.GroupData = new EjectGroupMemberRequestPacket.GroupDataBlock();
+            eject.GroupData.GroupID = group;
+            //People to eject
+            eject.EjectData = new EjectGroupMemberRequestPacket.EjectDataBlock[1];
+            eject.EjectData[0] = new EjectGroupMemberRequestPacket.EjectDataBlock();
+            eject.EjectData[0].EjecteeID = member;
+            //send it
+            Client.Network.SendPacket(eject);
+        }
+
+        ///
+        /// Update role information
+        ///
+        /// <param name="group">Group to update</param>
+        /// <param name="role">Role to update</param>
+        public void UpdateRole(LLUUID group, GroupRole role)
+        {
+            libsecondlife.Packets.GroupRoleUpdatePacket gru = new GroupRoleUpdatePacket();
+            gru.AgentData.AgentID = Client.Network.AgentID;
+            gru.AgentData.SessionID = Client.Network.SessionID;
+            gru.AgentData.GroupID = group;
+            gru.RoleData = new GroupRoleUpdatePacket.RoleDataBlock[1];
+            gru.RoleData[0].Name = Helpers.StringToField(role.Name);
+            gru.RoleData[0].Description = Helpers.StringToField(role.Description);
+            gru.RoleData[0].Powers = role.Powers;
+            gru.RoleData[0].Title = Helpers.StringToField(role.Title);
+            gru.RoleData[0].UpdateType = (byte)GroupRoleUpdate.UpdateAll;
+            Client.Network.SendPacket(gru);
+        }
+
+        ///
+        /// Create a new role
+        ///
+        /// <param name="group">Group to update</param>
+        /// <param name="role">Role to create</param>
+        public void CreateRole(LLUUID group, GroupRole role)
+        {
+            libsecondlife.Packets.GroupRoleUpdatePacket gru = new GroupRoleUpdatePacket();
+            gru.AgentData.AgentID = Client.Network.AgentID;
+            gru.AgentData.SessionID = Client.Network.SessionID;
+            gru.AgentData.GroupID = group;
+            gru.RoleData = new GroupRoleUpdatePacket.RoleDataBlock[1];
+            gru.RoleData[0].Name = Helpers.StringToField(role.Name);
+            gru.RoleData[0].Description = Helpers.StringToField(role.Description);
+            gru.RoleData[0].Powers = role.Powers;
+            gru.RoleData[0].Title = Helpers.StringToField(role.Title);
+            gru.RoleData[0].UpdateType = (byte)GroupRoleUpdate.Create;
+            Client.Network.SendPacket(gru);
+        }
+
+        ///
+        /// Remove an avatar from a role
+        ///
+        /// <param name="group">Group to update</param>
+        /// <param name="role">Role to be removed from</param>
+        /// <param name="member">Avatar to remove</param>
+        public void RemoveFromRole(LLUUID group, LLUUID role, LLUUID member)
+        {
+            libsecondlife.Packets.GroupRoleChangesPacket grc = new GroupRoleChangesPacket();
+            grc.AgentData.AgentID = Client.Network.AgentID;
+            grc.AgentData.SessionID = Client.Network.SessionID;
+            grc.AgentData.GroupID = group;
+            grc.RoleChange = new GroupRoleChangesPacket.RoleChangeBlock[1];
+            grc.RoleChange[0] = new GroupRoleChangesPacket.RoleChangeBlock();
+            //Add to members and role
+            grc.RoleChange[0].MemberID = member;
+            grc.RoleChange[0].RoleID = role;
+            //1 = Remove From Role
+            grc.RoleChange[0].Change = 1;
+            Client.Network.SendPacket(grc);
+        }
+
+        ///
+        /// Assign an avatar to a role
+        ///
+        /// <param name="group">Group to update</param>
+        /// <param name="role">Role to assign to</param>
+        /// <param name="member">Avatar to assign</param>
+        public void AddToRole(LLUUID group, LLUUID role, LLUUID member)
+        {
+            libsecondlife.Packets.GroupRoleChangesPacket grc = new GroupRoleChangesPacket();
+            grc.AgentData.AgentID = Client.Network.AgentID;
+            grc.AgentData.SessionID = Client.Network.SessionID;
+            grc.AgentData.GroupID = group;
+            grc.RoleChange = new GroupRoleChangesPacket.RoleChangeBlock[1];
+            grc.RoleChange[0] = new GroupRoleChangesPacket.RoleChangeBlock();
+            //Add to members and role
+            grc.RoleChange[0].MemberID = member;
+            grc.RoleChange[0].RoleID = role;
+            //0 = Add to Role
+            grc.RoleChange[0].Change = 0;
+            Client.Network.SendPacket(grc);
+        }
+
+        ///
+        ///
+        ///
+        /// <param name="group"></param>
+        /// <param name="notice"></param>
+        public void SendGroupNotice(LLUUID group, GroupNotice notice)
+        {
+            Client.Self.InstantMessage(Client.ToString(), group, notice.Subject + "|" + notice.Message,
+                LLUUID.Zero, MainAvatar.InstantMessageDialog.GroupNotice, MainAvatar.InstantMessageOnline.Online,
+                LLVector3.Zero, LLUUID.Zero, notice.SerializeAttachment());
+        }
+
+        ///
+        /// Start a group proposal (vote)
+        ///
+        /// <param name="group">The group to send it to</param>
+        /// <param name="prop">The proposal to start</param>
+        public void StartProposal(LLUUID group, GroupProposal prop)
+        {
+            StartGroupProposalPacket p = new StartGroupProposalPacket();
+            p.AgentData.AgentID = Client.Network.AgentID;
+            p.AgentData.SessionID = Client.Network.SessionID;
+            p.ProposalData.GroupID = group;
+            p.ProposalData.ProposalText = Helpers.StringToField(prop.VoteText);
+            p.ProposalData.Quorum = prop.Quorum;
+            p.ProposalData.Majority = prop.Majority;
+            p.ProposalData.Duration = prop.Duration;
+            Client.Network.SendPacket(p);
+        }
+
+        #region Packet Handlers

         private void GroupDataHandler(Packet packet, Simulator simulator)
         {
@@ -660,18 +1008,19 @@
                 if (GroupRolesMembersCaches.ContainsKey(members.AgentData.RequestID))
                 {
                     groupRoleMemberCache = GroupRolesMembersCaches[members.AgentData.RequestID];
-                    int i = 0;

                     foreach (GroupRoleMembersReplyPacket.MemberDataBlock block in members.MemberData)
                     {
                         KeyValuePair<LLUUID, LLUUID> rolemember =
                             new KeyValuePair<LLUUID, LLUUID>(block.RoleID, block.MemberID);

-                        groupRoleMemberCache[i++] = rolemember;
+                        groupRoleMemberCache.Add(rolemember);
                     }
                 }
             }
-            Console.WriteLine("ZOmg: " + groupRoleMemberCache.Count.ToString() + members.AgentData.TotalPairs.ToString());
+
+            Client.DebugLog("Pairs Ratio: " + groupRoleMemberCache.Count + "/" + members.AgentData.TotalPairs);
+
             // Check if we've received all the pairs that are showing up
             if (OnGroupRolesMembers != null && groupRoleMemberCache != null && groupRoleMemberCache.Count >= members.AgentData.TotalPairs)
             {
@@ -684,7 +1033,7 @@
         {
             //GroupActiveProposalItemReplyPacket proposal = (GroupActiveProposalItemReplyPacket)packet;

-            // TODO: Create a proposal class to represent the fields in a proposal item
+            // TODO: Create a proposal struct to represent the fields in a proposal item
         }

         private void GroupVoteHistoryItemHandler(Packet packet, Simulator simulator)
@@ -768,241 +1117,7 @@
             //    catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
             //}
         }
-        ///
-        /// Invites a user to a group
-        ///
-        /// <param name="group">The group to invite to.</param>
-        /// <param name="roles">A list of roles to invite a person to</param>
-        /// <param name="personkey">Key of person to invite</param>
-        public void Invite(LLUUID group, List<LLUUID> roles, LLUUID personkey)
-        {
-            libsecondlife.Packets.InviteGroupRequestPacket igp = new libsecondlife.Packets.InviteGroupRequestPacket();
-            igp.AgentData = new libsecondlife.Packets.InviteGroupRequestPacket.AgentDataBlock();
-            igp.AgentData.AgentID = Client.Network.AgentID;
-            igp.AgentData.SessionID = Client.Network.SessionID;
-            igp.GroupData = new libsecondlife.Packets.InviteGroupRequestPacket.GroupDataBlock();
-            igp.GroupData.GroupID = group;
-            List<libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock> idbs = new List<libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock>();
-            foreach (LLUUID role in roles)
-            {
-                libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock idb = new libsecondlife.Packets.InviteGroupRequestPacket.InviteDataBlock();
-                idb.InviteeID = personkey;
-                idb.RoleID = role;
-                idbs.Add(idb);
-            }
-            igp.InviteData = idbs.ToArray();
-            Client.Network.SendPacket(igp);
-        }
-        ///
-        /// Create a new group. This method automaticaly deducts the group creation feild
-        ///
-        /// <param name="group">Group struct containing the new group info</param>
-        public void CreateGroup(Group group)
-        {
-            libsecondlife.Packets.CreateGroupRequestPacket cgrp = new CreateGroupRequestPacket();
-            //Fill in agent data
-            cgrp.AgentData = new CreateGroupRequestPacket.AgentDataBlock();
-            cgrp.AgentData.AgentID = Client.Network.AgentID;
-            cgrp.AgentData.SessionID = Client.Network.SessionID;
-            //Fill in group data
-            cgrp.GroupData = new CreateGroupRequestPacket.GroupDataBlock();
-            cgrp.GroupData.AllowPublish = group.AllowPublish;
-            cgrp.GroupData.Charter = Helpers.StringToField(group.Charter);
-            cgrp.GroupData.InsigniaID = group.InsigniaID;
-            cgrp.GroupData.MaturePublish = group.MaturePublish;
-            cgrp.GroupData.MembershipFee = group.MembershipFee;
-            cgrp.GroupData.Name = Helpers.StringToField(group.Name);
-            cgrp.GroupData.OpenEnrollment = group.OpenEnrollment;
-            cgrp.GroupData.ShowInList = group.ShowInList;
-            //Send it
-            Client.Network.SendPacket(cgrp);
-        }
-        ///
-        /// Update a group's profile and other information
-        ///
-        /// <param name="group">Group struct to update</param>
-        public void UpdateGroup(Group group)
-        {
-            libsecondlife.Packets.UpdateGroupInfoPacket cgrp = new UpdateGroupInfoPacket();
-            //Fill in agent data
-            cgrp.AgentData = new UpdateGroupInfoPacket.AgentDataBlock();
-            cgrp.AgentData.AgentID = Client.Network.AgentID;
-            cgrp.AgentData.SessionID = Client.Network.SessionID;
-            //Fill in group data
-            cgrp.GroupData = new UpdateGroupInfoPacket.GroupDataBlock();
-            cgrp.GroupData.AllowPublish = group.AllowPublish;
-            cgrp.GroupData.Charter = Helpers.StringToField(group.Charter);
-            cgrp.GroupData.InsigniaID = group.InsigniaID;
-            cgrp.GroupData.MaturePublish = group.MaturePublish;
-            cgrp.GroupData.MembershipFee = group.MembershipFee;
-            cgrp.GroupData.OpenEnrollment = group.OpenEnrollment;
-            cgrp.GroupData.ShowInList = group.ShowInList;
-            //Send it
-            Client.Network.SendPacket(cgrp);
-        }
-        ///
-        /// Eject a user from a group
-        ///
-        /// <param name="group">Group to eject the user from</param>
-        /// <param name="member">Avatar's key to eject</param>
-        public void EjectUser(LLUUID group, LLUUID member)
-        {
-            libsecondlife.Packets.EjectGroupMemberRequestPacket eject = new EjectGroupMemberRequestPacket();
-            eject.AgentData = new EjectGroupMemberRequestPacket.AgentDataBlock();
-            eject.AgentData.AgentID = Client.Network.AgentID;
-            eject.AgentData.SessionID = Client.Network.SessionID;
-            //Group
-            eject.GroupData = new EjectGroupMemberRequestPacket.GroupDataBlock();
-            eject.GroupData.GroupID = group;
-            //People to eject
-            eject.EjectData = new EjectGroupMemberRequestPacket.EjectDataBlock[1];
-            eject.EjectData[0] = new EjectGroupMemberRequestPacket.EjectDataBlock();
-            eject.EjectData[0].EjecteeID = member;
-            //send it
-            Client.Network.SendPacket(eject);
-        }
-        ///
-        /// Update role information
-        ///
-        /// <param name="group">Group to update</param>
-        /// <param name="role">Role to update</param>
-        public void UpdateRole(LLUUID group, GroupRole role)
-        {
-            libsecondlife.Packets.GroupRoleUpdatePacket gru = new GroupRoleUpdatePacket();
-            gru.AgentData.AgentID = Client.Network.AgentID;
-            gru.AgentData.SessionID = Client.Network.SessionID;
-            gru.AgentData.GroupID = group;
-            gru.RoleData = new GroupRoleUpdatePacket.RoleDataBlock[1];
-            gru.RoleData[0].Name = Helpers.StringToField(role.Name);
-            gru.RoleData[0].Description = Helpers.StringToField(role.Description);
-            gru.RoleData[0].Powers = role.Powers;
-            gru.RoleData[0].Title = Helpers.StringToField(role.Title);
-            gru.RoleData[0].UpdateType = (byte)GroupRoleUpdate.UpdateAll;
-            Client.Network.SendPacket(gru);
-        }
-        ///
-        /// Create a new role
-        ///
-        /// <param name="group">Group to update</param>
-        /// <param name="role">Role to create</param>
-        public void CreateRole(LLUUID group, GroupRole role)
-        {
-            libsecondlife.Packets.GroupRoleUpdatePacket gru = new GroupRoleUpdatePacket();
-            gru.AgentData.AgentID = Client.Network.AgentID;
-            gru.AgentData.SessionID = Client.Network.SessionID;
-            gru.AgentData.GroupID = group;
-            gru.RoleData = new GroupRoleUpdatePacket.RoleDataBlock[1];
-            gru.RoleData[0].Name = Helpers.StringToField(role.Name);
-            gru.RoleData[0].Description = Helpers.StringToField(role.Description);
-            gru.RoleData[0].Powers = role.Powers;
-            gru.RoleData[0].Title = Helpers.StringToField(role.Title);
-            gru.RoleData[0].UpdateType = (byte)GroupRoleUpdate.Create;
-            Client.Network.SendPacket(gru);
-        }
-        ///
-        /// Remove an avatar from a role
-        ///
-        /// <param name="group">Group to update</param>
-        /// <param name="role">Role to be removed from</param>
-        /// <param name="member">Avatar to remove</param>
-        public void RemoveFromRole(LLUUID group, LLUUID role, LLUUID member)
-        {
-            libsecondlife.Packets.GroupRoleChangesPacket grc = new GroupRoleChangesPacket();
-            grc.AgentData.AgentID = Client.Network.AgentID;
-            grc.AgentData.SessionID = Client.Network.SessionID;
-            grc.AgentData.GroupID = group;
-            grc.RoleChange = new GroupRoleChangesPacket.RoleChangeBlock[1];
-            grc.RoleChange[0] = new GroupRoleChangesPacket.RoleChangeBlock();
-            //Add to members and role
-            grc.RoleChange[0].MemberID = member;
-            grc.RoleChange[0].RoleID = role;
-            //1 = Remove From Role
-            grc.RoleChange[0].Change = 1;
-            Client.Network.SendPacket(grc);
-        }
-        ///
-        /// Assign an avatar to a role
-        ///
-        /// <param name="group">Group to update</param>
-        /// <param name="role">Role to assign to</param>
-        /// <param name="member">Avatar to assign</param>
-        public void AddToRole(LLUUID group, LLUUID role, LLUUID member)
-        {
-            libsecondlife.Packets.GroupRoleChangesPacket grc = new GroupRoleChangesPacket();
-            grc.AgentData.AgentID = Client.Network.AgentID;
-            grc.AgentData.SessionID = Client.Network.SessionID;
-            grc.AgentData.GroupID = group;
-            grc.RoleChange = new GroupRoleChangesPacket.RoleChangeBlock[1];
-            grc.RoleChange[0] = new GroupRoleChangesPacket.RoleChangeBlock();
-            //Add to members and role
-            grc.RoleChange[0].MemberID = member;
-            grc.RoleChange[0].RoleID = role;
-            //0 = Add to Role
-            grc.RoleChange[0].Change = 0;
-            Client.Network.SendPacket(grc);
-        }
-
-        ///
-        /// Role update flags
-        ///
-        public enum GroupRoleUpdate : uint
-        {
-            NoUpdate,
-            UpdateData,
-            UpdatePowers,
-            UpdateAll,
-            Create,
-            Delete
-        }
-        ///
-        /// Group role powers flags
-        ///
-        [Flags]
-        public enum GroupRolePowers : long
-        {
-            None = 0,
-            Invite = 1 << 1,
-            Eject = 1 << 2,
-            ChangeOptions = 1 << 3,
-            CreateRole = 1 << 4,
-            DeleteRole = 1 << 5,
-            RoleProperties = 1 << 6,
-            AssignMemberLimited = 1 << 7,
-            AssignMember = 1 << 8,
-            RemoveMember = 1 << 9,
-            ChangeActions = 1 << 10,
-            ChangeIdentity = 1 << 11,
-            LandDeed = 1 << 12,
-            LandRelease = 1 << 13,
-            LandSetSale = 1 << 14,
-            LandDevideJoin = 1 << 15,
-            FindPlaces = 1 << 17,
-            LandChangeIdentity = 1 << 18,
-            SetLandingPoint = 1 << 19,
-            ChangeMedia = 1 << 20,
-            LandEdit = 1 << 21,
-            LandOptions = 1 << 22,
-            AllowEditLand = 1 << 23,
-            AllowFly = 1 << 24,
-            AllowRez = 1 << 25,
-            AllowLandmark = 1 << 26,
-            AllowSetHome = 1 << 28,
-            LandManageAllowed = 1 << 29,
-            LandManageBanned = 1 << 30,
-            LandManagePasses = 1 << 31,
-            LandEjectAndFreeze = 1 << 32,
-            ReturnGroupOwned = 1 << 48,
-            ReturnGroupSet = 1 << 33,
-            ReturnNonGroup = 1 << 34,
-            LandGardening = 1 << 35,
-            DeedObject = 1 << 36,
-            ObjectManipulate = 1 << 38,
-            ObjectSetForSale = 1 << 39,
-            Accountable = 1 << 40,
-            SendNotices = 1 << 42,
-            ReceiveNotices = 1 << 43,
-            StartProposal = 1 << 44,
-            VoteOnProposal = 1 << 45
-        }
+
+        #endregion Packet Handlers
     }
 }


Fix that run does not stop after all tests are finished

--- src/AgUnit.Runner.Resharper90.TaskRunner/UnitTestRunner/Silverlight/Execution/TaskNode.cs
+++ src/AgUnit.Runner.Resharper90.TaskRunner/UnitTestRunner/Silverlight/Execution/TaskNode.cs
@@ -57,7 +57,10 @@

                 Status = TaskStatus.Running;

-                Environment.Server.TaskStarting(Task);
+                if (!(Task is SilverlightTask))
+                {
+                    Environment.Server.TaskStarting(Task);
+                }
             }
         }

@@ -75,7 +78,10 @@
                     child.NotifyFinished(null, TaskResult.Skipped);
                 }

-                Environment.Server.TaskFinished(Task, output, Result);
+                if (!(Task is SilverlightTask))
+                {
+                    Environment.Server.TaskFinished(Task, output, Result);
+                }

                 if (Parent != null && Parent.Children.All(c => c.Status == TaskStatus.Finished))
                 {
@@ -88,7 +94,10 @@
         {
             NotifyStarting();

-            Environment.Server.TaskException(Task, new[] { new TaskException(e) });
+            if (!(Task is SilverlightTask))
+            {
+                Environment.Server.TaskException(Task, new[] { new TaskException(e) });
+            }

             NotifyFinished(e.Message, result);
         }
@@ -99,7 +108,10 @@

             // TODO: We should pass the TypeName instead of FullMessage
             // TODO: Report inner exceptions recursively
-            Environment.Server.TaskException(Task, new[] { new TaskException(e.FullMessage, e.Message, e.StackTrace) });
+            if (!(Task is SilverlightTask))
+            {
+                Environment.Server.TaskException(Task, new[] { new TaskException(e.FullMessage, e.Message, e.StackTrace) });
+            }

             NotifyFinished(e.Message, result);
         }


Add space to be like test without the omit

--- src/EditorFeatures/CSharpTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.cs
+++ src/EditorFeatures/CSharpTest/AddAccessibilityModifiers/AddAccessibilityModifiersTests.cs
@@ -258,6 +258,7 @@
             event Action I.e6 { add { } remote { } }

             static C() { }
+
             C() { }
             public C(int i) { }


Whitespace.

Whitespace.

--- src/Features/Core/Portable/IncrementalCaches/SymbolTreeInfoIncrementalAnalyzerProvider.cs
+++ src/Features/Core/Portable/IncrementalCaches/SymbolTreeInfoIncrementalAnalyzerProvider.cs
@@ -246,7 +246,7 @@
                     // Note, getting the info may fail (for example, bogus metadata).  That's ok.
                     // We still want to cache that result so that don't try to continuously produce
                     // this info over and over again.
-                    metadataInfo = new MetadataInfo( info, metadataInfo.ReferencingProjects ?? new HashSet<ProjectId>());
+                    metadataInfo = new MetadataInfo(info, metadataInfo.ReferencingProjects ?? new HashSet<ProjectId>());
                     _metadataPathToInfo.AddOrUpdate(key, metadataInfo, (_1, _2) => metadataInfo);
                 }


Quote file path to Orca

Quote file path to Orca

Fixes issue #14485 by making sure the resolved path is quoted in case it contains spaces.

--- src/Microsoft.Tools.WindowsInstaller.PowerShell/PowerShell/Commands/EditPackageCommand.cs
+++ src/Microsoft.Tools.WindowsInstaller.PowerShell/PowerShell/Commands/EditPackageCommand.cs
@@ -69,7 +69,7 @@
             {
                 // Open in Orca, if installed.
                 info.FileName = this.orcaPath;
-                info.Arguments = path;
+                info.Arguments = "\"" + path + "\"";
             }
             else
             {


Minor change to fix broken test

Minor change to fix broken test

--- source/Calamari.Tests/Fixtures/Conventions/UploadAzureCloudServicePackageConventionFixture.cs
+++ source/Calamari.Tests/Fixtures/Conventions/UploadAzureCloudServicePackageConventionFixture.cs
@@ -57,6 +57,7 @@
             const string packageFileName = "Acme.cspkg";
             var packageFilePath = Path.Combine(stagingDirectory, packageFileName);
             variables.Set(SpecialVariables.Package.NuGetPackageVersion, "1.0.0");
+            variables.Set(SpecialVariables.Action.Azure.CloudServicePackagePath, packageFilePath);
             fileSystem.EnumerateFiles(stagingDirectory, "*.cspkg")
                 .Returns(new[] { packageFilePath });
             fileSystem.OpenFile(packageFilePath, Arg.Any<FileMode>())


Fix one more violation

Fix one more violation

--- src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InitializeStaticFieldsInline.cs
+++ src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InitializeStaticFieldsInline.cs
@@ -113,7 +113,7 @@

             public bool Value
             {
-                get { return Interlocked.CompareExchange(ref zeroOrOne, TRUE_VALUE, TRUE_VALUE) == TRUE_VALUE; }
+                get => Interlocked.CompareExchange(ref zeroOrOne, TRUE_VALUE, TRUE_VALUE) == TRUE_VALUE;
                 set
                 {
                     if (value)


AdventureSample - simplify Open method

AdventureSample - simplify Open method

--- projects/AdventureSample/src/Adventure/adventure.cs
+++ projects/AdventureSample/src/Adventure/adventure.cs
@@ -1041,47 +1041,50 @@

     private void Open()
     {
-        if ((((noun.CompareTo("BOX")) != (0)) ? (-1) : (0)) != (0))
-        {
-            if ((((noun.CompareTo("CAB")) != (0)) ? (-1) : (0)) != (0))
-            {
-                if ((((noun.CompareTo("CAS")) != (0)) ? (-1) : (0)) != (0))
-                {
-                    PRINT(("") + ("YOU CAN'T OPEN THAT!"));
-                }
-                else if ((((currentRoom.CompareTo(18)) != (0)) ? (-1) : (0)) != (0))
-                {
-                    PRINT(("") + ("THERE'S NO CASE HERE!"));
-                }
-                else if ((((wearingGloves.CompareTo(1)) != (0)) ? (-1) : (0)) != (0))
-                {
-                    PRINT(("") + ("THE CASE IS ELECTRIFIED!"));
-                }
-                else
-                {
-                    PRINT(("") + ("THE GLOVES INSULATE AGAINST THE"));
-                    PRINT(("") + ("ELECTRICITY! THE CASE OPENS!"));
-                    objectRooms[(int)(15)] = (18);
-                }
-            }
-            else if ((((currentRoom.CompareTo(2)) != (0)) ? (-1) : (0)) != (0))
-            {
-                PRINT(("") + ("THERE'S NO CABINET HERE!"));
+        if (noun == "BOX")
+        {
+            if ((objectRooms[1] != currentRoom) && (objectRooms[1] != -1))
+            {
+                PRINT("THERE'S NO BOX HERE!");
             }
             else
             {
-                PRINT(("") + ("THERE'S SOMETHING INSIDE!"));
-                objectRooms[(int)(3)] = (2);
-            }
-        }
-        else if ((((int)(((objectRooms[(int)(1)].CompareTo(currentRoom)) != (0)) ? (-1) : (0))) & ((int)(((objectRooms[(int)(1)].CompareTo(-(1))) != (0)) ? (-1) : (0)))) != (0))
-        {
-            PRINT(("") + ("THERE'S NO BOX HERE!"));
-        }
-        else
-        {
-            objectRooms[(int)(6)] = (currentRoom);
-            PRINT(("") + ("SOMETHING FELL OUT!"));
+                objectRooms[6] = currentRoom;
+                PRINT("SOMETHING FELL OUT!");
+            }
+        }
+        else if (noun == "CAB")
+        {
+            if (currentRoom != 2)
+            {
+                PRINT("THERE'S NO CABINET HERE!");
+            }
+            else
+            {
+                PRINT("THERE'S SOMETHING INSIDE!");
+                objectRooms[3] = 2;
+            }
+        }
+        else if (noun == "CAS")
+        {
+            if (currentRoom != 18)
+            {
+                PRINT("THERE'S NO CASE HERE!");
+            }
+            else if (wearingGloves != 1)
+            {
+                PRINT("THE CASE IS ELECTRIFIED!");
+            }
+            else
+            {
+                PRINT("THE GLOVES INSULATE AGAINST THE");
+                PRINT("ELECTRICITY! THE CASE OPENS!");
+                objectRooms[15] = 18;
+            }
+        }
+        else
+        {
+            PRINT("YOU CAN'T OPEN THAT!");
         }
     }