Don't expose the peers list publicly, allow the user to get a copy of it though. Fixes possible threading issue

svn path=/trunk/bitsharp/; revision=96198

--- src/MonoTorrent/MonoTorrent.Tracker/SimpleTorrentManager.cs
+++ src/MonoTorrent/MonoTorrent.Tracker/SimpleTorrentManager.cs
@@ -106,16 +106,6 @@
             get { return downloaded.Number; }
         }

-
-        /// <summary>
-        /// The list of all peers being monitored by this manager
-        /// </summary>
-        public ICollection<Peer> Peers
-        {
-            get { return peers.Values; }
-        }
-
-
         /// <summary>
         /// The torrent being tracked
         /// </summary>
@@ -162,8 +152,15 @@

             Debug.WriteLine(string.Format("Adding: {0}", peer.ClientAddress));
             peers.Add(peer.ClientAddress.Address, peer);
-            buffer.Clear();
+            lock (buffer)
+                buffer.Clear();
             UpdateCounts();
+        }
+
+        public List<Peer> GetPeers()
+        {
+            lock (buffer)
+                return new List<Peer>(buffer);
         }

         /// <summary>
@@ -188,8 +185,11 @@

             int start = random.Next(0, peers.Count);

-            if (buffer.Count != peers.Values.Count)
-                buffer = new List<Peer>(peers.Values);
+            lock (buffer)
+            {
+                if (buffer.Count != peers.Values.Count)
+                    buffer = new List<Peer>(peers.Values);
+            }
             List<Peer> p = buffer;

             while (total > 0)
@@ -214,11 +214,11 @@

         internal void ClearZombiePeers(DateTime cutoff)
         {
-            IPAddress[] keys = new IPAddress[peers.Keys.Count];
-            peers.Keys.CopyTo(keys, 0);
-            foreach (IPAddress ip in keys)
-                if (peers[ip].LastAnnounceTime < cutoff)
-                    peers.Remove(ip);
+            lock (buffer)
+            {
+                buffer.ForEach(delegate(Peer p) { if (p.LastAnnounceTime < cutoff) peers.Remove(p.ClientAddress.Address); });
+                buffer.Clear();
+            }
         }

@@ -228,12 +228,13 @@
         /// <param name="peer">The peer to remove</param>
         internal void Remove(Peer peer)
         {
-            if(peer == null)
+            if (peer == null)
                 throw new ArgumentNullException("peer");

             Debug.WriteLine(string.Format("Removing: {0}", peer.ClientAddress));
             peers.Remove(peer.ClientAddress.Address);
-            buffer.Clear();
+            lock (buffer)
+                buffer.Clear();
             UpdateCounts();
         }

@@ -242,7 +243,7 @@
             int complete = 0;
             int incomplete = 0;

-            foreach (Peer p in peers.Values)
+            foreach (Peer p in buffer)
             {
                 if (p.HasCompleted)
                     complete++;


very minor change to chat logs - again

very minor change to chat logs - again

forgot "message deleted" message

--- src/NadekoBot/Modules/Administration/Commands/LogCommand.cs
+++ src/NadekoBot/Modules/Administration/Commands/LogCommand.cs
@@ -657,7 +657,7 @@
                         return;
                     var embed = new EmbedBuilder()
                         .WithOkColor()
-                        .WithTitle($"🗑 Message Deleted in {((ITextChannel)msg.Channel).Mention}")
+                        .WithTitle($"🗑 Message Deleted in #{((ITextChannel)msg.Channel).Name} ({((ITextChannel)msg.Channel).Id})")
                         .WithDescription($"{msg.Author}")
                         .AddField(efb => efb.WithName("Content").WithValue(msg.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false))
                         .AddField(efb => efb.WithName("Id").WithValue(msg.Id.ToString()).WithIsInline(false))


Only query database if a new tag is being added. (#7845)

--- src/Orchard.Web/Modules/Orchard.Tags/Services/TagService.cs
+++ src/Orchard.Web/Modules/Orchard.Tags/Services/TagService.cs
@@ -191,20 +191,22 @@
         }

         public void UpdateTagsForContentItem(ContentItem contentItem, IEnumerable<string> tagNamesForContentItem) {
-            var tags = tagNamesForContentItem.Select(CreateTag);
-            var newTagsForContentItem = new List<TagRecord>(tags);
+            var newTagsForContentItem = tagNamesForContentItem.Where(s => s != null).ToList();
             var currentTagsForContentItem = contentItem.As<TagsPart>().Record.Tags;

             foreach (var tagContentItem in currentTagsForContentItem) {
-                if (!newTagsForContentItem.Contains(tagContentItem.TagRecord)) {
+                var newTag = newTagsForContentItem.FirstOrDefault(t => t.Equals(tagContentItem.TagRecord.TagName, StringComparison.OrdinalIgnoreCase));
+
+                if (newTag == null) {
                     _contentTagRepository.Delete(tagContentItem);
                 }
-
-                newTagsForContentItem.Remove(tagContentItem.TagRecord);
+                else {
+                    newTagsForContentItem.Remove(newTag);
+                }
             }

             foreach (var newTagForContentItem in newTagsForContentItem) {
-                _contentTagRepository.Create(new ContentTagRecord { TagsPartRecord = contentItem.As<TagsPart>().Record, TagRecord = newTagForContentItem });
+                _contentTagRepository.Create(new ContentTagRecord { TagsPartRecord = contentItem.As<TagsPart>().Record, TagRecord = CreateTag(newTagForContentItem) });
             }

             contentItem.As<TagsPart>().CurrentTags = tagNamesForContentItem;


删除前置后置方法

删除前置后置方法

--- src/Rabbit.WeiXin/Handlers/Impl/MessageHandlerMiddleware.cs
+++ src/Rabbit.WeiXin/Handlers/Impl/MessageHandlerMiddleware.cs
@@ -47,9 +47,7 @@
             Context = context;

             var requestMessage = context.GetRequestMessage();
-
-            OnRequestBefore(requestMessage);
-
+
             IResponseMessage responseMessage;
             switch (requestMessage.MessageType)
             {
@@ -95,9 +93,7 @@
                 responseMessage.CreateTime = DateTime.Now;
                 responseMessage.FromUserName = requestMessage.ToUserName;
                 responseMessage.ToUserName = requestMessage.FromUserName;
-            }
-
-            OnRequestAfter(requestMessage, responseMessage);
+            }

             context.SetResponseMessage(responseMessage);

@@ -107,26 +103,7 @@
         #endregion Overrides of HandlerMiddleware

         #region Receive Message
-
-        /// <summary>
-        /// 前置处理
-        /// </summary>
-        /// <param name="requestMessage">请求消息</param>
-        public virtual void OnRequestBefore(IRequestMessageBase requestMessage)
-        {
-
-        }
-
-        /// <summary>
-        /// 后置处理
-        /// </summary>
-        /// <param name="requestMessage">请求消息</param>
-        /// <param name="responseMessage">响应消息</param>
-        public virtual void OnRequestAfter(IRequestMessageBase requestMessage, IResponseMessage responseMessage)
-        {
-
-        }
-
+
         /// <summary>
         /// 文字类型请求
         /// </summary>


removed empty line

removed empty line

--- src/Scripting/Core/Hosting/CommandLine/CommandLineRunner.cs
+++ src/Scripting/Core/Hosting/CommandLine/CommandLineRunner.cs
@@ -121,7 +121,6 @@
                 return CommonCompiler.Failed;
             }

-
             var cancellationToken = new CancellationToken();

             if (_compiler.Arguments.InteractiveMode)


Minor cleanup

Minor cleanup

--- src/Server/FileSystem/Builder/ProjectRootSnapshotBuilder.cs
+++ src/Server/FileSystem/Builder/ProjectRootSnapshotBuilder.cs
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

+using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;


Added GetFloatArray, GetSingleArray and GetDoubleArray extension methods to the JObjectExtensions class

--- src/Skybrud.Essentials/Json/Extensions/JObjectExtensions.cs
+++ src/Skybrud.Essentials/Json/Extensions/JObjectExtensions.cs
@@ -591,6 +591,36 @@
         }

         /// <summary>
+        /// Gets an array of <see cref="float"/> from the token matching the specified <paramref name="path"/>.
+        /// </summary>
+        /// <param name="obj">The instance of <see cref="JObject"/>.</param>
+        /// <param name="path">A <see cref="string"/> that contains a JPath expression.</param>
+        /// <returns>The token value as an array of <see cref="float"/>.</returns>
+        public static float[] GetFloatArray(this JObject obj, string path) {
+            return GetArrayItems<float>(obj, path);
+        }
+
+        /// <summary>
+        /// Gets an array of <see cref="float"/> from the token matching the specified <paramref name="path"/>.
+        /// </summary>
+        /// <param name="obj">The instance of <see cref="JObject"/>.</param>
+        /// <param name="path">A <see cref="string"/> that contains a JPath expression.</param>
+        /// <returns>The token value as an array of <see cref="float"/>.</returns>
+        public static float[] GetSingleArray(this JObject obj, string path) {
+            return GetArrayItems<float>(obj, path);
+        }
+
+        /// <summary>
+        /// Gets an array of <see cref="double"/> from the token matching the specified <paramref name="path"/>.
+        /// </summary>
+        /// <param name="obj">The instance of <see cref="JObject"/>.</param>
+        /// <param name="path">A <see cref="string"/> that contains a JPath expression.</param>
+        /// <returns>The token value as an array of <see cref="double"/>.</returns>
+        public static double[] GetDoubleArray(this JObject obj, string path) {
+            return GetArrayItems<double>(obj, path);
+        }
+
+        /// <summary>
         /// Gets an array of <see cref="JObject"/> from the token matching the specified <paramref name="path"/>.
         /// </summary>
         /// <param name="obj">The instance of <see cref="JObject"/>.</param>


Fix descriptions of two properties of InlineKeyboardButton

--- src/Telegram.Bot/Types/ReplyMarkups/InlineKeyboardButton.cs
+++ src/Telegram.Bot/Types/ReplyMarkups/InlineKeyboardButton.cs
@@ -20,7 +20,7 @@
         public string Url { get; set; }

         /// <summary>
-        /// Data to be sent in a callback query to the bot when button is pressed
+        /// Optional. Data to be sent in a callback query to the bot when button is pressed
         /// </summary>
         [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
         public string CallbackData { get; set; }
@@ -44,7 +44,7 @@
         public string SwitchInlineQueryCurrentChat { get; set; }

         /// <summary>
-        /// Optimal. Description of the game that will be launched when the user presses the button.
+        /// Optional. Description of the game that will be launched when the user presses the button.
         /// </summary>
         /// <remarks>
         /// Note: This type of button must always be the first button in the first row.
@@ -156,4 +156,4 @@
                 ? default
                 : WithCallbackData(textAndCallbackData);
     }
-}+}


StreamReliabilityTests now uses correct connection string, and restarts silo every time

--- src/TesterInternal/StreamingTests/StreamReliabilityTests.cs
+++ src/TesterInternal/StreamingTests/StreamReliabilityTests.cs
@@ -27,7 +27,7 @@
     [DeploymentItem("Config_AzureStreamProviders.xml")]
     [DeploymentItem("ClientConfig_AzureStreamProviders.xml")]
     [DeploymentItem("OrleansProviders.dll")]
-    public class StreamReliabilityTests : HostedTestClusterPerFixture
+    public class StreamReliabilityTests : HostedTestClusterPerTest
     {
         public TestContext TestContext { get; set; }
         public const string SMS_STREAM_PROVIDER_NAME = "SMSProvider";
@@ -43,6 +43,7 @@
         {
             SiloConfigFile = new FileInfo("Config_AzureStreamProviders.xml"),
             LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable,
+            DataConnectionString = StorageTestConstants.DataConnectionString,
         };

         private static readonly TestingClientOptions clientRunOptions = new TestingClientOptions


fixes n+1 query when assigning user types to users in user repo

--- src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
+++ src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
@@ -370,21 +370,12 @@

         private IEnumerable<IUser> ConvertFromDtos(IEnumerable<UserDto> dtos)
         {
-            var foundUserTypes = new Dictionary<short, IUserType>();
+            var userTypeIds = dtos.Select(x => Convert.ToInt32(x.Type)).ToArray();
+            var allUserTypes = _userTypeRepository.GetAll(userTypeIds);
+
             return dtos.Select(dto =>
-                {
-                    //first we need to get the user type
-                    IUserType userType;
-                    if (foundUserTypes.ContainsKey(dto.Type))
-                    {
-                        userType = foundUserTypes[dto.Type];
-                    }
-                    else
-                    {
-                        userType = _userTypeRepository.Get(dto.Type);
-                        //put it in the local cache
-                        foundUserTypes.Add(dto.Type, userType);
-                    }
+                {
+                    var userType = allUserTypes.Single(x => x.Id == dto.Type);

                     var userFactory = new UserFactory(userType);
                     return userFactory.BuildEntity(dto);


Fix service namespace and use config

Fix service namespace and use config

--- src/WebApiToTypeScript/Endpoints/AngularEndpointsService.cs
+++ src/WebApiToTypeScript/Endpoints/AngularEndpointsService.cs
@@ -28,8 +28,18 @@

         public void WriteServiceObjectToBlock(TypeScriptBlock serviceBlock, WebApiController webApiController)
         {
-            var controllerBlock = serviceBlock
-                .AddAndUseBlock($"public {webApiController.Name}: I{webApiController.Name}Service =");
+            TypeScriptBlock controllerBlock = null;
+
+            if (Config.GenerateService)
+            {
+                controllerBlock = serviceBlock
+                    .AddAndUseBlock($"public {webApiController.Name}: {Config.EndpointsNamespace}.{webApiController.Name}.I{webApiController.Name}Service =");
+            }
+            else
+            {
+                controllerBlock = serviceBlock
+                    .AddAndUseBlock($"public {webApiController.Name} =");
+            }

             var actions = webApiController.Actions;


Don't serialize null PeerHeader

Don't serialize null PeerHeader

--- BmpListener/Bmp/BmpMessage.cs
+++ BmpListener/Bmp/BmpMessage.cs
@@ -19,6 +19,7 @@
         }

         public BmpHeader BmpHeader { get; private set; }
+        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
         public PeerHeader PeerHeader { get; set; }

         public static BmpMessage GetBmpMessage(BmpHeader bmpHeader)


add support to MediaType for wildcards

add support to MediaType for wildcards

--- Core/MediaType.cs
+++ Core/MediaType.cs
@@ -95,7 +95,8 @@
         private const string
             // Valid characters for the super/subtypes in a media type. All
             // comparisons we do will be in lowercase, so we don't need capitals.
-            SuperSubTypeCharactersS = "abcedfghijklmnopqrstuvwxyz0123456789-."
+            SuperSubTypeCharactersS = "abcedfghijklmnopqrstuvwxyz0123456789-.",
+            WildcardString          = "*"
             ;
         private const char
             SubTypeSeparator        = '/',
@@ -103,7 +104,8 @@
             SuffixSeparator         = '+',
             PrefixSeparator         = '.',
             Dash                    = '-',
-            EqualsSign              = '='
+            EqualsSign              = '=',
+            WildcardChar            = '*'
             ;

         /// <summary>
@@ -197,6 +199,31 @@
                         type.SuperType = storage.ToString().ToLower();
                         // Clear the storage.
                         storage.Clear();
+                    }
+                    // If the character is a wildcard character, there
+                    // are some special rules we need to apply.
+                    else if (c == WildcardChar)
+                    {
+                        if (
+                            // The wildcard must be the only character in
+                            // a media type's super-type. So we need to
+                            // make sure that there are no characters
+                            // already in the storage.
+                            storage.Length > 0 ||
+                            // And we need to make sure that the next
+                            // character is the super-to-subtype separator.
+                            mediaType[i + 1] != SubTypeSeparator
+                            )
+                        {
+                            throw new ArgumentException(
+                                "The media type super-type contains a wildcard " +
+                                "in an invalid location."
+                                );
+                        }
+
+                        // If we're here, the presence of a wildcard is fine,
+                        // so we can add it to storage.
+                        storage.Append(c);
                     }
                     // Otherwise, we need to check that the character is
                     // valid.
@@ -293,6 +320,38 @@
                         // switch to the subtype state.
                         state = PState.SubType;
                     }
+                    // If the character is a wildcard character, there
+                    // are some special rules we need to apply.
+                    else if (c == WildcardChar)
+                    {
+                        if (
+                            // The wildcard must be the only character in
+                            // a media type's subtype. So we need to
+                            // make sure that there are no characters
+                            // already in the storage.
+                            storage.Length > 0 ||
+                            // This also needs to be the end of the prefix/subtype,
+                            // either because it's the end of the string; and
+                            i + 1 < mediaType.Length &&
+                            (
+                            // That the next character is the separator that
+                            // indicates the start of a suffix; or
+                                mediaType[i + 1] != SuffixSeparator ||
+                            // That the next character is a parameter separator
+                            // character.
+                                mediaType[i + 1] != ParameterSeparator
+                            ))
+                        {
+                            throw new ArgumentException(
+                                "The media type prefix/subtype contains a wildcard " +
+                                "in an invalid location."
+                                );
+                        }
+
+                        // If we're here, the presence of a wildcard is fine,
+                        // so we can add it to storage.
+                        storage.Append(c);
+                    }
                     // If we find one of these characters, we probably aren't
                     // in a prefix, and we may instead be in a subtype.
                     else if (c == SuffixSeparator || c == ParameterSeparator)
@@ -355,6 +414,38 @@
                         {
                             state = PState.Parameter;
                         }
+                    }
+                    // If the character is a wildcard character, there
+                    // are some special rules we need to apply.
+                    else if (c == WildcardChar)
+                    {
+                        if (
+                            // The wildcard must be the only character in
+                            // a media type's subtype. So we need to
+                            // make sure that there are no characters
+                            // already in the storage.
+                            storage.Length > 0 ||
+                            // This also needs to be the end of the subtype,
+                            // either because it's the end of the string; and
+                            i + 1 < mediaType.Length &&
+                            (
+                            // That the next character is the separator that
+                            // indicates the start of a suffix; or
+                                mediaType[i + 1] != SuffixSeparator ||
+                            // That the next character is a parameter separator
+                            // character.
+                                mediaType[i + 1] != ParameterSeparator
+                            ))
+                        {
+                            throw new ArgumentException(
+                                "The media type subtype contains a wildcard " +
+                                "in an invalid location."
+                                );
+                        }
+
+                        // If we're here, the presence of a wildcard is fine,
+                        // so we can add it to storage.
+                        storage.Append(c);
                     }
                     // The character is valid.
                     else if (SuperSubTypeCharacters.Contains(c))
@@ -526,6 +617,13 @@
         {
             get { return "application/json"; }
         }
+        /// <summary>
+        /// A wildcard media type that will match any media type.
+        /// </summary>
+        public static MediaType Wildcard
+        {
+            get { return "*/*"; }
+        }

         private MediaType() { }

@@ -714,12 +812,22 @@
                     .Equals(type.Suffix, StringComparison.OrdinalIgnoreCase);
             }

+            bool superEqual =
+                // Check to see whether either super-type is a wildcard.
+                this.SuperType == WildcardString ||
+                type.SuperType == WildcardString ||
+                // Just in case it isn't, case-insensitive comparison.
+                type.SuperType.Equals(this.SuperType, StringComparison.OrdinalIgnoreCase);
+            // Same as we did with the super-type.
+            bool subEqual =
+                this.SubType == WildcardString ||
+                type.SubType == WildcardString ||
+                type.SubType.Equals(this.SubType, StringComparison.OrdinalIgnoreCase);
+
             return
-                paramEqual &&
-                suffixEqual &&
+                paramEqual && suffixEqual &&
                 this.RegistrationTree == type.RegistrationTree &&
-                this.SuperType.Equals(type.SuperType, StringComparison.OrdinalIgnoreCase) &&
-                this.SubType.Equals(type.SubType, StringComparison.OrdinalIgnoreCase);
+                superEqual && subEqual;
         }

         /// <summary>


Handling dep injection + OnConnected

Handling dep injection + OnConnected

--- relmah/src/RElmah.Host.SignalR/Hubs/ErrorsHub.cs
+++ relmah/src/RElmah.Host.SignalR/Hubs/ErrorsHub.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Threading.Tasks;
 using Microsoft.AspNet.SignalR;
 using Microsoft.AspNet.SignalR.Hubs;

@@ -7,6 +8,22 @@
     [HubName("relmah-errors")]
     public class ErrorsHub : Hub
     {
+        private readonly IDispatcher _dispatcher;
+        private readonly IUserIdProvider _userIdProvider;
+
+        public ErrorsHub(IDispatcher dispatcher, IUserIdProvider userIdProvider)
+        {
+            _dispatcher = dispatcher;
+            _userIdProvider = userIdProvider;
+        }
+
+        public override Task OnConnected()
+        {
+            _dispatcher.Connect( _userIdProvider.GetUserId(Context.Request), a => Groups.Add(Context.ConnectionId, a));
+
+            return base.OnConnected();
+        }
+
         public void Monitor(IEnumerable<string> apps)
         {
             foreach (var app in apps)


Updated flow in Engine

Updated flow in Engine


Delete DataStorageUtils.cs

Delete DataStorageUtils.cs


List Pop

List Pop


If a script file is passed in, run it and exit


Deleting by session property should be case insensitive

--- Cache.Aspect/CacheProvider.cs
+++ Cache.Aspect/CacheProvider.cs
@@ -2,6 +2,7 @@

 namespace DbSoft.Cache.Aspect
 {
+    using System;
     using System.Collections.Generic;
     using System.Linq;
     using System.Runtime.Caching;
@@ -78,7 +79,7 @@
             }
             else
             {
-                var keys = _keys.Where(k => k.Contains(searchKey)).ToList();
+                var keys = _keys.Where(k => k.IndexOf(searchKey, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
                 foreach (var key in keys)
                 {
                     _keys.Remove(key);


Load categories when editing a post

Load categories when editing a post

--- src/managed/OpenLiveWriter.BlogClient/Clients/GoogleBloggerv3Client.cs
+++ src/managed/OpenLiveWriter.BlogClient/Clients/GoogleBloggerv3Client.cs
@@ -88,7 +88,7 @@
                 Permalink = post.Url,
                 Contents = post.Content,
                 DatePublished = post.Published.Value,
-                Keywords = string.Join(new string(LabelDelimiter,1), post.Labels ?? new List<string>())
+                Categories = post.Labels.Select(x => new BlogPostCategory(x)).ToArray()
             };
         }


changed tfooter to tfoot for valid html

changed tfooter to tfoot for valid html

--- Purchasing.Web/Views/Order/ReadOnly.cshtml
+++ Purchasing.Web/Views/Order/ReadOnly.cshtml
@@ -202,15 +202,15 @@

Line Item Split

-                                    @foreach (var split in line.Splits)
-                                    {
-

-                                            @(string.IsNullOrWhiteSpace(split.Account) ? "n/a" : split.Account)
-                                            @(string.IsNullOrWhiteSpace(split.SubAccount) ? "n/a" : split.SubAccount)
-                                            @(string.IsNullOrWhiteSpace(split.Project) ? "n/a" : split.Project)
-                                            @split.Amount
-

-                                    }
+                                        @foreach (var split in line.Splits)
+                                        {
+

+                                                @(string.IsNullOrWhiteSpace(split.Account) ? "n/a" : split.Account)
+                                                @(string.IsNullOrWhiteSpace(split.SubAccount) ? "n/a" : split.SubAccount)
+                                                @(string.IsNullOrWhiteSpace(split.Project) ? "n/a" : split.Project)
+                                                @split.Amount
+

+                                        }

@@ -226,11 +226,11 @@

                             @if (!string.IsNullOrWhiteSpace(line.Url))
                             {
-
Url: @line.Url

+
Url: @line.Url

                             }
                             @if (!string.IsNullOrWhiteSpace(line.Notes))
                             {
-
Notes: @line.Notes

+
Notes: @line.Notes

                             }

@@ -238,8 +238,7 @@
                 }
             }

-        <tfooter>
-
+

                 Subtotal:
@@ -260,8 +259,7 @@
                 Grand Total:
                 @Model.TotalFromDb

-
-        </tfooter>
+


Implement diagnostic SA1500 CurlyBracketsForMultiLineStatementsMustNotShareLine (fixes #101)

--- StyleCop.Analyzers/StyleCop.Analyzers/LayoutRules/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine.cs
+++ StyleCop.Analyzers/StyleCop.Analyzers/LayoutRules/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine.cs
@@ -2,6 +2,8 @@
 {
     using System.Collections.Immutable;
     using Microsoft.CodeAnalysis;
+    using Microsoft.CodeAnalysis.CSharp;
+    using Microsoft.CodeAnalysis.CSharp.Syntax;
     using Microsoft.CodeAnalysis.Diagnostics;

     /// <summary>
@@ -56,7 +58,7 @@
         /// </summary>
         public const string DiagnosticId = "SA1500";
         private const string Title = "Curly brackets for multi-line statements must not share line";
-        private const string MessageFormat = "TODO: Message format";
+        private const string MessageFormat = "Curly brackets for multi-line statements must not share line";
         private const string Category = "StyleCop.CSharp.LayoutRules";
         private const string Description = "The opening or closing curly bracket within a C# statement, element, or expression is not placed on its own line.";
         private const string HelpLink = "http://www.stylecop.com/docs/SA1500.html";
@@ -79,7 +81,82 @@
         /// <inheritdoc/>
         public override void Initialize(AnalysisContext context)
         {
-            // TODO: Implement analysis
+            context.RegisterSyntaxNodeAction(HandleNamespaceDeclarationSyntax, SyntaxKind.NamespaceDeclaration);
+            context.RegisterSyntaxNodeAction(HandleClassDeclarationSyntax, SyntaxKind.ClassDeclaration);
+            context.RegisterSyntaxNodeAction(HandleEnumDeclarationSyntax, SyntaxKind.EnumDeclaration);
+            context.RegisterSyntaxNodeAction(HandleInterfaceDeclarationSyntax, SyntaxKind.InterfaceDeclaration);
+            context.RegisterSyntaxNodeAction(HandleStructDeclarationSyntax, SyntaxKind.StructDeclaration);
+            context.RegisterSyntaxNodeAction(HandleAccessorListSyntax, SyntaxKind.AccessorList);
+            context.RegisterSyntaxNodeAction(HandleBlockSyntax, SyntaxKind.Block);
+        }
+
+        private void HandleNamespaceDeclarationSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((NamespaceDeclarationSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((NamespaceDeclarationSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void HandleClassDeclarationSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((ClassDeclarationSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((ClassDeclarationSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void HandleEnumDeclarationSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((EnumDeclarationSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((EnumDeclarationSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void HandleInterfaceDeclarationSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((InterfaceDeclarationSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((InterfaceDeclarationSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void HandleStructDeclarationSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((StructDeclarationSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((StructDeclarationSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void HandleAccessorListSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((AccessorListSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((AccessorListSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void HandleBlockSyntax(SyntaxNodeAnalysisContext context)
+        {
+            CheckCurlyBracketToken(context, ((BlockSyntax)context.Node).OpenBraceToken);
+            CheckCurlyBracketToken(context, ((BlockSyntax)context.Node).CloseBraceToken);
+        }
+
+        private void CheckCurlyBracketToken(SyntaxNodeAnalysisContext context, SyntaxToken token)
+        {
+            if (token.IsMissing)
+                return;
+
+            Location location = token.GetLocation();
+            int line = location.GetLineSpan().StartLinePosition.Line;
+
+            SyntaxToken previousToken = token.GetPreviousToken();
+            if (!previousToken.IsMissing)
+            {
+                if (previousToken.GetLocation().GetLineSpan().StartLinePosition.Line == line)
+                {
+                    context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
+                    // no need to report more than one instance for this token
+                    return;
+                }
+            }
+
+            SyntaxToken nextToken = token.GetNextToken();
+            if (!nextToken.IsMissing)
+            {
+                if (nextToken.GetLocation().GetLineSpan().StartLinePosition.Line == line)
+                    context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
+            }
         }
     }
 }


Fix rename saved encounter if some boss is killed during watching it.

--- CasualMeter/ShellViewModel.cs
+++ CasualMeter/ShellViewModel.cs
@@ -283,7 +283,7 @@
             _entityTracker.Update(message);

             var despawnNpc = message as SDespawnNpc;
-            if (despawnNpc != null)
+            if (despawnNpc != null && !DamageTracker.IsArchived)
             {
                 Entity ent = _entityTracker.GetOrPlaceholder(despawnNpc.NPC);
                 if (ent is NpcEntity)


Fixed errors

Fixed errors

--- CoCSharp/Data/Csv/CsvTable.cs
+++ CoCSharp/Data/Csv/CsvTable.cs
@@ -112,7 +112,7 @@
                         break;

                     default:
-                        throw new CsvSerializationException(string.Format("Unexpected data type '{0}'.", typeRow[i]));
+                        throw new CsvException(string.Format("Unexpected data type '{0}'.", typeRow[i]));
                 }
                 Table.Columns.Add(columnNames[i], type);
             }


Removed unnecessary conditionals.

Removed unnecessary conditionals.

--- QDMS/ExtensionMethods/SessionExtensions.cs
+++ QDMS/ExtensionMethods/SessionExtensions.cs
@@ -61,17 +61,7 @@
                 return true;
             }

-            if (p1start < p2start && p1end > p2start)
-            {
-                return true;
-            }
-
             if (p2start < p1end && p2end > p1end)
-            {
-                return true;
-            }
-
-            if (p2start < p1start && p2end > p1start)
             {
                 return true;
             }


Dont handle sessiosn events if object being disposed (missed SshCommand class)

--- Renci.SshClient/Renci.SshNet/SshCommand.cs
+++ Renci.SshClient/Renci.SshNet/SshCommand.cs
@@ -309,6 +309,10 @@

         private void Session_Disconnected(object sender, EventArgs e)
         {
+            //  If objected is disposed or being disposed don't handle this event
+            if (this._isDisposed)
+                return;
+
             this._exception = new SshConnectionException("An established connection was aborted by the software in your host machine.", DisconnectReason.ConnectionLost);

             this._sessionErrorOccuredWaitHandle.Set();
@@ -316,6 +320,10 @@

         private void Session_ErrorOccured(object sender, ExceptionEventArgs e)
         {
+            //  If objected is disposed or being disposed don't handle this event
+            if (this._isDisposed)
+                return;
+
             this._exception = e.Exception;

             this._sessionErrorOccuredWaitHandle.Set();


Buump Version to 0.9.7.5

Buump Version to 0.9.7.5

--- SPAD.Interfaces/Properties/AssemblyInfo.cs
+++ SPAD.Interfaces/Properties/AssemblyInfo.cs
@@ -38,5 +38,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("0.9.7.2")]
+[assembly: AssemblyVersion("0.9.7.5")]
 [assembly: AssemblyFileVersion("0.9.7.0")]


[Toolkit.Samples] Improved audio sample to demonstrate how to pause, resume and stop sound effects.

--- Samples/Toolkit/Desktop/Audio/AudioGame.cs
+++ Samples/Toolkit/Desktop/Audio/AudioGame.cs
@@ -31,7 +31,7 @@
     using System.Text;
     using System.Threading.Tasks;

-    class AudioGame :Game
+    class AudioGame : Game
     {
         private GraphicsDeviceManager graphicsDeviceManager;
         private KeyboardManager keyboardManager;
@@ -63,6 +63,7 @@

         private List<SoundTile> tiles;
         private bool play3D;
+        private bool isMusicPlaying;

         public AudioGame()
         {
@@ -75,7 +76,7 @@
             mouseManager = new MouseManager(this);
             IsMouseVisible = true;

-            random = new Random();
+            random = new Random();

             audioManager = new AudioManager(this);
             audioManager.EnableMasterVolumeLimiter();
@@ -84,10 +85,10 @@
             // Setup the relative directory to the executable directory
             // for loading contents with the ContentManager
             Content.RootDirectory = "Content";
-
-        }
-
-
+
+        }
+
+

         protected override void Initialize()
         {
@@ -97,7 +98,7 @@

         protected override void LoadContent()
-        {
+        {
             ergonWave = Content.Load<SoundEffect>("ergon.adpcm.wav");
             ergonWaveInstance = ergonWave.Create();
             ergonWaveInstance.IsLooped = true;
@@ -118,15 +119,15 @@

             // setup tests
-            tiles = new List<SoundTile>();
+            tiles = new List<SoundTile>();
             Rectangle border = new Rectangle();
             border.X = SoundTile.Padding.X;
             border.Y = SoundTile.Padding.Y;

-            AddTile(ref border, "Click to play looped SoundEffectInstance of " + ergonWave.Name, () => ergonWaveInstance.Play());
+            AddTile(ref border, "Click to play looped SoundEffectInstance of " + ergonWave.Name, PlayMusic, PauseMusic);
             AddTile(ref border, "Click to play 'PewPew' wave bank entry", () => waveBank.Play("PewPew"));
-            AddTile(ref border, "Click to play 'PewPew' wave bank entry with random pitch and pan", () => waveBank.Play("PewPew", 1,random.NextFloat(-1,1),random.NextFloat(-1,1)));
-            AddTile(ref border, "Click to play 'PewPew' with 3D audio", () => PlayAudio3D());
+            AddTile(ref border, "Click to play 'PewPew' wave bank entry with random pitch and pan", () => waveBank.Play("PewPew", 1, random.NextFloat(-1, 1), random.NextFloat(-1, 1)));
+            AddTile(ref border, "Click to play 'PewPew' with 3D audio", PlayAudio3D, StopAudio3D);

             // setup 3D
             geometryEffect = ToDisposeContent(new BasicEffect(GraphicsDevice)
@@ -140,45 +141,45 @@

             // Load the texture
             listenerTexture = Content.Load<Texture2D>("listen");
-            emitterTexture = Content.Load<Texture2D>("speaker");
+            emitterTexture = Content.Load<Texture2D>("speaker");
             geometryEffect.TextureEnabled = true;

             base.LoadContent();

         }

-        private void AddTile(ref Rectangle border, string label, Action playDelegate)
+        private void AddTile(ref Rectangle border, string label, Action playDelegate, Action stopDelegate = null)
         {
             Vector2 labelSize;
             labelSize = arial16BMFont.MeasureString(label);
             border.Width = (int)(labelSize.X + SoundTile.Padding.X * 2);
             border.Height = (int)(labelSize.Y + SoundTile.Padding.Y * 2);
-            tiles.Add(new SoundTile { Border = border, Label = label, PlayDelegate = playDelegate });
-            border.Y = border.Bottom + SoundTile.Padding.Y;
+            tiles.Add(new SoundTile { Border = border, Label = label, PlayDelegate = playDelegate, StopDelegate = stopDelegate });
+            border.Y = border.Bottom + SoundTile.Padding.Y;
         }

         protected override void UnloadContent()
-        {
+        {
             Utilities.Dispose(ref spriteBatch);
             Utilities.Dispose(ref primitiveBatch);
             Utilities.Dispose(ref primitiveBatchEffect);
-            base.UnloadContent();
-        }
-
+            base.UnloadContent();
+        }
+
         protected override void Update(GameTime gameTime)
         {
             var currentKey = keyboardManager.GetState();
-            var currentMouse = mouseManager.GetState();
+            var currentMouse = mouseManager.GetState();

             foreach (var tile in tiles)
             {
-                if (tile.Border.Contains(new Vector2(currentMouse.X * GraphicsDevice.Viewport.Width,currentMouse.Y * GraphicsDevice.Viewport.Height)))
+                if (tile.Border.Contains(new Vector2(currentMouse.X * GraphicsDevice.Viewport.Width, currentMouse.Y * GraphicsDevice.Viewport.Height)))
                 {
                     if (currentMouse.LeftButton.Pressed)
                     {
                         tile.BorderColor = Color.Green;
-                        tile.Play();
+                        tile.Toggle();
                     }
                     else
                     {
@@ -190,7 +191,7 @@
                     tile.BorderColor = Color.Gray;
                 }
             }
-
+

             keyboardState = currentKey;
             mouseState = currentMouse;
@@ -199,8 +200,8 @@
                 UpdateAudio3D(gameTime);

             base.Update(gameTime);
-        }
-
+        }
+
         protected override void Draw(GameTime gameTime)
         {
             // Clears the screen
@@ -214,7 +215,23 @@

             base.Draw(gameTime);
         }
-
+
+        private void PlayMusic()
+        {
+            if (isMusicPlaying)
+                ergonWaveInstance.Resume();
+            else
+            {
+                ergonWaveInstance.Play();
+                isMusicPlaying = true;
+            }
+        }
+
+        private void PauseMusic()
+        {
+            ergonWaveInstance.Pause();
+        }
+
         private void EnableSpatialAudioWithReverb()
         {
             audioManager.EnableSpatialAudio();
@@ -234,7 +251,7 @@
             listener = Matrix.LookAtRH(Vector3.Zero, new Vector3(0, 0, 8), Vector3.Up);
             listenerVelocity = Vector3.Zero;

-            emitter = Matrix.LookAtRH(new Vector3(0,0,8), Vector3.Zero, Vector3.Up);
+            emitter = Matrix.LookAtRH(new Vector3(0, 0, 8), Vector3.Zero, Vector3.Up);
             emitterVelocity = Vector3.Zero;

             audio3DEffectInstance = waveBank.Create("PewPew");
@@ -244,6 +261,17 @@
             play3D = true;
         }

+        private void StopAudio3D()
+        {
+            if (!play3D) return;
+
+            audio3DEffectInstance.Stop(true);
+            audio3DEffectInstance.Dispose();
+            audio3DEffectInstance = null;
+
+            play3D = false;
+        }
+
         private void UpdateAudio3D(GameTime gameTime)
         {
             var rotation = (float)gameTime.TotalGameTime.TotalSeconds * 2.0f;
@@ -309,8 +337,10 @@

         class SoundTile
         {
+            private bool isPlaying;
+
             public static Point Padding = new Point(4, 4);
-
+
             public Rectangle Border { get; set; }
             public Color BorderColor { get; set; }
             public string Label { get; set; }
@@ -322,10 +352,20 @@
                 BorderColor = Color.White;
             }

-            public void Play()
-            {
-                if (PlayDelegate != null)
-                    PlayDelegate();
+            public void Toggle()
+            {
+                if (isPlaying)
+                {
+                    if (StopDelegate != null)
+                        StopDelegate();
+                    isPlaying = false;
+                }
+                else
+                {
+                    if (PlayDelegate != null)
+                        PlayDelegate();
+                    isPlaying = StopDelegate != null;
+                }
             }
         }
     }


version 59

version 59

--- Scripts/Utility/Settings/ServerSettings.cs
+++ Scripts/Utility/Settings/ServerSettings.cs
@@ -51,7 +51,7 @@
 		private const string strVersion = "Version";
 		private static System.IO.TextWriter settingsWriter;

-		public const int latestVersion = 58; // in sequence of updates on steam
+		public const int latestVersion = 59; // in sequence of updates on steam

 		public static readonly int fileVersion;


Array -> IEnumerable optimization

Array -> IEnumerable optimization

--- SendSMS/Controllers/CountriesController.cs
+++ SendSMS/Controllers/CountriesController.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
 using System.Web.Http;
 using SendSMS.Models;

@@ -9,6 +10,6 @@
         private readonly SendSMSContext _db = new SendSMSContext();

         // GET: api/countries
-        public CountryData[] GetCountries() => _db.Countries.Select(CountryData.FromCountry).ToArray();
+        public IEnumerable<CountryData> GetCountries() => _db.Countries.Select(CountryData.FromCountry);
     }
 }


* Updated Serenity version to 0.7.1.0.

* Updated Serenity version to 0.7.1.0.

git-svn-id: 2a3af8afa05c9a5b9366548807b65075bef6225b@259 7c140d53-a5f7-2844-acf0-7413b3fec49d

--- SerenityWeb/Trunk/Serenity/SerenityInfo.cs
+++ SerenityWeb/Trunk/Serenity/SerenityInfo.cs
@@ -20,7 +20,7 @@
         /// <summary>
         /// Holds the version string for Serenity.
         /// </summary>
-        public const string Version = "0.7.0.0";
+        public const string Version = "0.7.1.0";
         /// <summary>
         /// Holds the copyright notice for Serenity.
         /// </summary>


Clarifying MediatR registration example

Clarifying MediatR registration example

--- samples/MediatR.Examples.StructureMap/Program.cs
+++ samples/MediatR.Examples.StructureMap/Program.cs
@@ -1,5 +1,6 @@
 using System.Threading.Tasks;
 using MediatR.Pipeline;
+using StructureMap.Pipeline;

 namespace MediatR.Examples.StructureMap
 {
@@ -23,8 +24,6 @@
                 cfg.Scan(scanner =>
                 {
                     scanner.AssemblyContainingType<Ping>();
-                    scanner.AssemblyContainingType<IMediator>();
-                    scanner.WithDefaultConventions();
                     scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<,>));
                     scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncRequestHandler<,>));
                     scanner.ConnectImplementationsToTypesClosing(typeof(ICancellableAsyncRequestHandler<,>));
@@ -40,6 +39,9 @@
                 cfg.For(typeof(IRequestPreProcessor<>)).Add(typeof(GenericRequestPreProcessor<>));
                 cfg.For(typeof(IRequestPostProcessor<,>)).Add(typeof(GenericRequestPostProcessor<,>));

+                // This is the default but let's be explicit. At most we should be container scoped.
+                cfg.For<IMediator>().LifecycleIs<TransientLifecycle>().Use<Mediator>();
+
                 cfg.For<SingleInstanceFactory>().Use<SingleInstanceFactory>(ctx => t => ctx.GetInstance(t));
                 cfg.For<MultiInstanceFactory>().Use<MultiInstanceFactory>(ctx => t => ctx.GetAllInstances(t));
                 cfg.For<TextWriter>().Use(Console.Out);


dumper gzip file

dumper gzip file

--- Dumper/Program.cs
+++ Dumper/Program.cs
@@ -3,6 +3,7 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
+using System.IO.Compression;
 using System.Linq;
 using System.Net;
 using System.Text;
@@ -44,7 +45,7 @@
             Directory.CreateDirectory(root);

             Console.WriteLine("Downloading index");
-            webClient.DownloadFile(host, Path.Combine(root, "index.html"));
+            Download(host, Path.Combine(root, "index.html"));

             foreach(var apbnKey in apbnKeys)
             {
@@ -58,7 +59,7 @@
                         var dir = Path.Combine(root, "bundles", bundle, apbnKey);
                         string url = host+"/bundles/"+bundle+"/"+apbnKey+"/"+regionId+".json";
                         Directory.CreateDirectory(dir);
-                        webClient.DownloadFile(url, Path.Combine(dir, regionId + ".json"));
+                        Download(url, Path.Combine(dir, regionId + ".json"));
                     }
                 }
             }
@@ -159,7 +160,7 @@
             Directory.CreateDirectory(root);

             Console.WriteLine("Downloading index");
-            webClient.DownloadFile(host, Path.Combine(root, "index.html"));
+            Download(host, Path.Combine(root, "index.html"));
         }

         private static void DumpP(string apbnKey, string dumpedRegionId)
@@ -174,7 +175,7 @@
                 var dir = Path.Combine(root, "bundles", bundle, apbnKey);
                 string url = host+"/bundles/"+bundle+"/"+apbnKey+"/"+regionId+".json";
                 Directory.CreateDirectory(dir);
-                webClient.DownloadFile(url, Path.Combine(dir, regionId + ".json"));
+                Download(url, Path.Combine(dir, regionId + ".json"));
             }
         }

@@ -188,7 +189,7 @@
                 var dir = Path.Combine(root, "bundles", bundle, apbnKey);
                 string url = host + "/bundles/" + bundle + "/" + apbnKey + "/" + regionId + ".json";
                 Directory.CreateDirectory(dir);
-                webClient.DownloadFile(url, Path.Combine(dir, regionId + ".json"));
+                Download(url, Path.Combine(dir, regionId + ".json"));
             }
         }

@@ -229,5 +230,25 @@

             }
         }
+
+        private static void Download(string url, string file)
+        {
+            webClient.DownloadFile(url, file);
+            Gunzip(file);
+        }
+
+        private static void Gunzip(string file)
+        {
+            using (var source = new FileStream(file, FileMode.Open, FileAccess.Read))
+            {
+                using (FileStream target = new FileStream(file+".gz", FileMode.Create, FileAccess.Write))
+                {
+                    using (GZipStream gzs = new GZipStream(target, CompressionLevel.Optimal))
+                    {
+                        source.CopyTo(gzs);
+                    }
+                }
+            }
+        }
     }
 }


change return type of Index.Query() to IReversibleQueryContext

--- DynamoDB/Index.cs
+++ DynamoDB/Index.cs
@@ -34,12 +34,12 @@
 		//     consistent (either non-async or not returning IAsyncEnumerable)
 		// That will ensure a consistent set of overloads and prevent users from needing to specify parameter names

-		IQueryContext Query(DynamoDBKeyValue hashKey, bool consistent = false);
-		IQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, bool consistent = false);
-		IQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, Values values, bool consistent = false);
-		IQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, bool consistent = false);
-		IQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, bool consistent = false);
-		IQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, Values values, bool consistent = false);
+		IReversibleQueryContext Query(DynamoDBKeyValue hashKey, bool consistent = false);
+		IReversibleQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, bool consistent = false);
+		IReversibleQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, Values values, bool consistent = false);
+		IReversibleQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, bool consistent = false);
+		IReversibleQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, bool consistent = false);
+		IReversibleQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, Values values, bool consistent = false);
 	}

 	internal class Index : IIndex
@@ -73,27 +73,27 @@
 		public IProvisionedThroughputInfo ProvisionedThroughput { get; private set; }

 		#region Query
-		public IQueryContext Query(DynamoDBKeyValue hashKey, bool consistent)
+		public IReversibleQueryContext Query(DynamoDBKeyValue hashKey, bool consistent)
 		{
 			return new QueryContext(table.Region, table.Name, Name, Schema.Key, hashKey, null, null, null, consistent);
 		}
-		public IQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, bool consistent)
+		public IReversibleQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, bool consistent)
 		{
 			return new QueryContext(table.Region, table.Name, Name, Schema.Key, hashKey, null, filter, null, consistent);
 		}
-		public IQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, Values values, bool consistent)
+		public IReversibleQueryContext Query(DynamoDBKeyValue hashKey, PredicateExpression filter, Values values, bool consistent)
 		{
 			return new QueryContext(table.Region, table.Name, Name, Schema.Key, hashKey, null, filter, values, consistent);
 		}
-		public IQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, bool consistent)
+		public IReversibleQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, bool consistent)
 		{
 			return new QueryContext(table.Region, table.Name, Name, Schema.Key, hashKey, projection, null, null, consistent);
 		}
-		public IQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, bool consistent)
+		public IReversibleQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, bool consistent)
 		{
 			return new QueryContext(table.Region, table.Name, Name, Schema.Key, hashKey, projection, filter, null, consistent);
 		}
-		public IQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, Values values, bool consistent)
+		public IReversibleQueryContext Query(DynamoDBKeyValue hashKey, ProjectionExpression projection, PredicateExpression filter, Values values, bool consistent)
 		{
 			return new QueryContext(table.Region, table.Name, Name, Schema.Key, hashKey, projection, filter, values, consistent);
 		}


Rotating cube demo works

Rotating cube demo works

NOTE: Vertex winding of cube model is definitely wrong

--- Magnesium.Metal/MetalSample/MetalSample/GameViewController.cs
+++ Magnesium.Metal/MetalSample/MetalSample/GameViewController.cs
@@ -237,6 +237,7 @@
 			catch (Exception ex)
 			{
 				Console.WriteLine(ex.Message);
+				throw ex;
 			}
 		}

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

 		public void Draw(MTKView view)
 		{
-			//Render();
+			Render();
 		}

 		Vector3[] positionVboData = new Vector3[]{
@@ -704,6 +705,7 @@
 			catch (Exception ex)
 			{
 				Console.WriteLine(ex.Message);
+				throw ex;
 			}
 		}


Adjusting the name of the main worksheet.

--- MarWac.Merlin/SourceDrivers/ExcelConfigurationSourceDriver.cs
+++ MarWac.Merlin/SourceDrivers/ExcelConfigurationSourceDriver.cs
@@ -183,6 +183,7 @@

         private class Writer
         {
+            private const string MainSheetName = "ConfigurationDictionary";
             private readonly Configuration _configuration;
             private readonly ConfigurableEnvironment[] _environments;
             private static readonly string[] HeaderColumnNames = {"Name", "Description", "Default"};
@@ -197,7 +198,7 @@
             {
                 var content = new XStreamingElement(Ns + "Workbook",
                     new XAttribute(XNamespace.Xmlns + "ss", Ns),
-                    new XStreamingElement(Ns + "Worksheet", new XAttribute(Ns + "Name", "Sheet1"),
+                    new XStreamingElement(Ns + "Worksheet", new XAttribute(Ns + "Name", MainSheetName),
                         new XStreamingElement(Ns + "Table",
                             CreateHeaderRow(),
                             CreateParameterRows())));


Fix spelling

Fix spelling

--- MatterControlLib/CustomWidgets/NozzleOffsetTemplatePrinter.cs
+++ MatterControlLib/CustomWidgets/NozzleOffsetTemplatePrinter.cs
@@ -132,7 +132,7 @@
 				y2 = y1 - sectionHeight - (nozzleWidth * 1.5);
 				y3 = y2 - 5;

-				bool drawGlpyphs = false;
+				bool drawGlyphs = false;

 				var inverseTransform = gcodeSketch.Transform;
 				inverseTransform.invert();
@@ -151,7 +151,7 @@

 						gcodeSketch.Speed = 500;

-						PrintLineEnd(gcodeSketch, drawGlpyphs, i, currentPos);
+						PrintLineEnd(gcodeSketch, drawGlyphs, i, currentPos);

 						gcodeSketch.Speed = 1800;

@@ -230,9 +230,9 @@
 			}
 		}

-		private static void PrintLineEnd(GCodeSketch turtle, bool drawGlpyphs, int i, Vector2 currentPos)
-		{
-			if (drawGlpyphs && CalibrationLine.Glyphs.TryGetValue(i, out IVertexSource vertexSource))
+		private static void PrintLineEnd(GCodeSketch turtle, bool drawGlyphs, int i, Vector2 currentPos)
+		{
+			if (drawGlyphs && CalibrationLine.Glyphs.TryGetValue(i, out IVertexSource vertexSource))
 			{
 				var flattened = new FlattenCurves(vertexSource);


Beaterクラスにコンストラクタを追加

Beaterクラスにコンストラクタを追加

--- MusicXMLUtils/Structure/Direction/Percussion/Beater/Beater.cs
+++ MusicXMLUtils/Structure/Direction/Percussion/Beater/Beater.cs
@@ -46,5 +46,14 @@

         [XmlText]
         public BeaterValue Value { get; set; }
+
+        public Beater()
+        {
+        }
+
+        public Beater(BeaterValue value)
+        {
+            this.Value = value;
+        }
     }
 }


Technicalクラスにregionを追加

Technicalクラスにregionを追加

--- MusicXMLUtils/Structure/Note/Notations/Technical/Technical.cs
+++ MusicXMLUtils/Structure/Note/Notations/Technical/Technical.cs
@@ -38,6 +38,7 @@
     [XmlType("technical")]
     public class Technical : ItemHolder<TechnicalItem>
     {
+        #region -- Public Properties --
         [XmlElement("arrow", typeof(Arrow))]
         [XmlElement("bend", typeof(Bend))]
         [XmlElement("double-tongue", typeof(EmptyPlacement))]
@@ -68,5 +69,6 @@
         [XmlElement("ItemsElementName")]
         [XmlIgnore]
         public override TechnicalItem[] ItemsElementName { get; set; }
+        #endregion
     }
 }


minor: change method doc on GetTextureHandler.TryParseRange(), mainly to trigger another build

--- OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -315,8 +315,8 @@
         /// for start.</remarks>
         /// <returns></returns>
         /// <param name='header'></param>
-        /// <param name='start'>Undefined if the parse fails.</param>
-        /// <param name='end'>Undefined if the parse fails.</param>
+        /// <param name='start'>Start of the range.  Undefined if this was not a number.</param>
+        /// <param name='end'>End of the range.  Will be -1 if no end specified.  Undefined if there was a raw string but this was not a number.</param>
         private bool TryParseRange(string header, out int start, out int end)
         {
             start = end = 0;


add load baked terrain methods. missing file

--- OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
+++ OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
@@ -89,6 +89,7 @@
         /// <param name="sizeZ">the Z dimension of the region being filled</param>
         /// <returns>Heightfield data</returns>
         TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ);
+        TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ);

         // Legacy version kept for downward compabibility
         double[,] LoadTerrain(UUID regionID);


Fix cell show property (#193)

Fix cell show property (#193)

Co-authored-by: BARBE Nicolas <cb30535a9168d7960135d03acfbe12e620b67ef1@econocom.com>

--- OpenXMLSDK.Engine/Word/ReportEngine/Renders/CellExtensions.cs
+++ OpenXMLSDK.Engine/Word/ReportEngine/Renders/CellExtensions.cs
@@ -73,7 +73,7 @@
             }

             if (!cell.Show)
-                return wordCell;
+                return null;

             if (cell.ChildElements.Any(x => x is Models.TemplateModel))
             {


Corrected ZeroIdString to use ZeroId.ToString()

--- Lib/ObjectId.cs
+++ Lib/ObjectId.cs
@@ -55,7 +55,7 @@
         static ObjectId()
         {
             ZeroId = new ObjectId(0, 0, 0, 0, 0);
-            ZeroIdString = ZeroIdString.ToString();
+            ZeroIdString = ZeroId.ToString();
         }


fix UpdateByFkChange

fix UpdateByFkChange

--- Signum.Engine/Engine/SchemaSynchronizer.cs
+++ Signum.Engine/Engine/SchemaSynchronizer.cs
@@ -9,6 +9,7 @@
 using Signum.Entities;
 using Signum.Engine.SchemaInfoTables;
 using System.Text.RegularExpressions;
+using Signum.Engine.Linq;

 namespace Signum.Engine
 {
@@ -120,11 +121,12 @@
                         (cn, difCol) => SqlPreCommand.Combine(Spacing.Simple,
                                     difCol.DefaultConstraintName.HasText() ? SqlBuilder.AlterTableDropConstraint(tab.Name, difCol.DefaultConstraintName) : null,
                                     SqlBuilder.AlterTableDropColumn(tab, cn)),
-                        (cn, tabCol, difCol) => SqlPreCommand.Combine(Spacing.Simple,
+                        (cn, tabCol, difCol) =>SqlPreCommand.Combine(Spacing.Simple,
                             difCol.Name == tabCol.Name ? null : SqlBuilder.RenameColumn(tab, difCol.Name, tabCol.Name),
-                            difCol.Equals(tabCol) ? null : SqlBuilder.AlterTableAlterColumn(tab, tabCol)),
-                            Spacing.Simple)),
-                    Spacing.Double);
+                            difCol.Equals(tabCol) ? null : SqlBuilder.AlterTableAlterColumn(tab, tabCol),
+                            UpdateByFkChange(tn, difCol, tabCol, replacements)),
+                        Spacing.Simple)),
+                 Spacing.Double);

             var tableReplacements = replacements.TryGetC(Replacements.KeyTables);
             if (tableReplacements != null)
@@ -180,6 +182,28 @@
                 }, Spacing.Double);

             return SqlPreCommand.Combine(Spacing.Triple, dropIndices, dropForeignKeys, tables, syncEnums, addForeingKeys, addIndices);
+        }
+
+        private static SqlPreCommandSimple UpdateByFkChange(string tn, DiffColumn difCol, IColumn tabCol, Replacements replacements)
+        {
+            if (difCol.ForeingKey == null || tabCol.ReferenceTable == null)
+                return null;
+
+            var oldFK = replacements.Apply(Replacements.KeyTables, difCol.ForeingKey.TargetTable.Name);
+
+            if (oldFK == tabCol.ReferenceTable.Name.Name)
+                return null;
+
+            AliasGenerator ag = new AliasGenerator();
+
+            return new SqlPreCommandSimple(
+@"UPDATE {2}
+SET {0} = GetId{5}({4}.Id)
+FROM {1} {2}
+JOIN {3} {4} ON {2}.{0} = {4}.Id".Formato(tabCol.Name,
+                tn, ag.NextTableAlias(tn),
+                oldFK, ag.NextTableAlias(oldFK),
+                tabCol.ReferenceTable.Name.Name));
         }


fix replacements.Interactive

fix replacements.Interactive

--- Signum.Engine/Engine/SchemaSynchronizer.cs
+++ Signum.Engine/Engine/SchemaSynchronizer.cs
@@ -247,7 +247,7 @@
                             var disableSystemVersioning = (dif.TemporalType != SysTableTemporalType.None &&
                             (tab.SystemVersioned == null ||
                             !object.Equals(replacements.Apply(Replacements.KeyTables, dif.TemporalTableName.ToString()), tab.SystemVersioned.TableName.ToString()) ||
-                            (alterColumnToNotNullableHistory = NullabilityChanges(tab, dif) && SafeConsole.Ask($"Table {tab.Name} has nullability changes. Disable and re-enable System Versioning?"))) ?
+                            (alterColumnToNotNullableHistory = NullabilityChanges(tab, dif) && (replacements.Interactive ? SafeConsole.Ask($"Table {tab.Name} has nullability changes. Disable and re-enable System Versioning?") : true))) ?
                                 SqlBuilder.AlterTableDisableSystemVersioning(tab.Name).Do(a => a.GoAfter = true) : null);

                             var dropPeriod = (dif.Period != null &&
@@ -379,7 +379,7 @@
                         Dictionary<string, Index> modelIxs = modelIndices[tab];

                         var controlledIndexes = Synchronizer.SynchronizeScript(Spacing.Simple, modelIxs, dif.Indices,
-                            createNew: (i, mix) => mix is UniqueIndex || mix.Columns.Any(isNew) || SafeConsole.Ask(ref createMissingFreeIndexes, "Create missing non-unique index {0} in {1}?".FormatWith(mix.IndexName, tab.Name)) ? SqlBuilder.CreateIndex(mix, checkUnique: replacements) : null,
+                            createNew: (i, mix) => mix is UniqueIndex || mix.Columns.Any(isNew) || (replacements.Interactive ? SafeConsole.Ask(ref createMissingFreeIndexes, "Create missing non-unique index {0} in {1}?".FormatWith(mix.IndexName, tab.Name)) : true) ? SqlBuilder.CreateIndex(mix, checkUnique: replacements) : null,
                             removeOld: null,
                             mergeBoth: (i, mix, dix) => !dix.IndexEquals(dif, mix) ? SqlBuilder.CreateIndex(mix, checkUnique: replacements) :
                                 mix.IndexName != dix.IndexName ? SqlBuilder.RenameIndex(tab.Name, dix.IndexName, mix.IndexName) : null);
@@ -400,7 +400,7 @@
                         Dictionary<string, Index> modelIxs = modelIndices[tab].Where(kvp => kvp.Value.GetType() == typeof(Index)).ToDictionary();

                         var controlledIndexes = Synchronizer.SynchronizeScript(Spacing.Simple, modelIxs, dif.Indices,
-                            createNew: (i, mix) => mix is UniqueIndex || mix.Columns.Any(isNew) || SafeConsole.Ask(ref createMissingFreeIndexes, "Create missing non-unique index {0} in {1}?".FormatWith(mix.IndexName, tab.Name)) ? SqlBuilder.CreateIndexBasic(mix, forHistoryTable: true) : null,
+                            createNew: (i, mix) => mix is UniqueIndex || mix.Columns.Any(isNew) || (replacements.Interactive ? SafeConsole.Ask(ref createMissingFreeIndexes, "Create missing non-unique index {0} in {1}?".FormatWith(mix.IndexName, tab.Name)) : true) ? SqlBuilder.CreateIndexBasic(mix, forHistoryTable: true) : null,
                             removeOld: null,
                             mergeBoth: (i, mix, dix) => !dix.IndexEquals(dif, mix) ? SqlBuilder.CreateIndexBasic(mix, forHistoryTable: true) :
                                 mix.IndexName != dix.IndexName ? SqlBuilder.RenameIndex(tab.SystemVersioned.TableName, dix.IndexName, mix.IndexName) : null);


SubToken fix

SubToken fix

--- Signum.Entities/DynamicQuery/QueryUtils.cs
+++ Signum.Entities/DynamicQuery/QueryUtils.cs
@@ -209,7 +209,7 @@

         public static Func<bool> MergeEntityColumns = null;

-        static QueryToken SubToken(QueryToken token, QueryDescription qd, bool canAggregate, string key)
+        public static QueryToken SubToken(QueryToken token, QueryDescription qd, bool canAggregate, string key)
         {
             var result = SubTokenBasic(token, qd, key);

@@ -263,6 +263,9 @@
             if (token == null)
             {
                 var column = qd.Columns.SingleOrDefaultEx(a=>a.Name == key);
+
+                if (column == null)
+                    return null;

                 return new ColumnToken(column, qd.QueryName);
             }


locking help 2

locking help 2

--- SoraBot-v2/SoraBot-v2/Module/HelpModule.cs
+++ SoraBot-v2/SoraBot-v2/Module/HelpModule.cs
@@ -20,6 +20,7 @@
         }

         [Command("help2")]
+        [RequireOwner]
         public async Task Help2()
         {
             Dictionary<string, List<CommandInfo>> cmds = new Dictionary<string, List<CommandInfo>>();


remember to init

remember to init

--- Source/AirBreather.Csv/Rfc4180CsvReader.cs
+++ Source/AirBreather.Csv/Rfc4180CsvReader.cs
@@ -305,7 +305,7 @@
         {
             if ((parserFlags & ParserFlags.FieldDataSoFarExceedsMaxLength) == 0)
             {
-                if (cutFieldBufferConsumed + copyBuffer.Length <= cutFieldBuffer.Length)
+                if (cutFieldBufferConsumed + copyBuffer.Length <= CutFieldBuffer.Length)
                 {
                     copyBuffer.CopyTo(new Span<byte>(cutFieldBuffer, cutFieldBufferConsumed, copyBuffer.Length));
                     cutFieldBufferConsumed += copyBuffer.Length;


Ensure the reset event has been set for the message bus check

--- Source/Core/Utility/SystemHealthChecker.cs
+++ Source/Core/Utility/SystemHealthChecker.cs
@@ -96,7 +96,7 @@

                 var sw = Stopwatch.StartNew();
                 try {
-                    string id = await _queue.EnqueueAsync(message).AnyContext();
+                    await _queue.EnqueueAsync(message).AnyContext();
                     var queueStats = await _queue.GetQueueStatsAsync().AnyContext();
                     if (queueStats.Enqueued < 1)
                         return HealthCheckResult.NotHealthy("Queue Not Working: No items were enqueued.");
@@ -127,6 +127,7 @@

                 var sw = Stopwatch.StartNew();
                 try {
+                    _resetEvent.Reset();
                     await _messageBus.PublishAsync(message).AnyContext();
                     await Task.WhenAny(_resetEvent.WaitAsync(), TimeSpan.FromSeconds(2).ToCancellationToken().AsTask()).AnyContext();
                 } catch (Exception ex) {


#2798 #2808 Handle unloaded lazy loading property case

--- Source/Csla/DataPortalClient/LocalProxy.cs
+++ Source/Csla/DataPortalClient/LocalProxy.cs
@@ -81,8 +81,13 @@
         if (useApplicationContext is IManageProperties target)
         {
           foreach (var item in target.GetManagedProperties())
-            if (typeof(IUseApplicationContext).IsAssignableFrom(item.Type))
+          {
+            if (typeof(IUseApplicationContext).IsAssignableFrom(item.Type) &&
+              !((item.RelationshipType & RelationshipTypes.LazyLoad) == RelationshipTypes.LazyLoad) && !target.FieldExists(item))
+            {
               SetApplicationContext((IUseApplicationContext)target.ReadProperty(item), applicationContext);
+            }
+          }
         }
         if (useApplicationContext is IEnumerable list)
           foreach (var item in list)


Wrong Uri when using both "Chnage tracking" and "CRMGetListOptions" options.

--- dotnet/Xrm.Tools.WebAPI/CRMWebAPI.cs
+++ dotnet/Xrm.Tools.WebAPI/CRMWebAPI.cs
@@ -625,12 +625,16 @@
         {
             var fullurl = _apiUrl + uri;

-            if ((queryOptions != null) && (!string.IsNullOrEmpty(queryOptions.TrackChangesLink)))
-                fullurl = queryOptions.TrackChangesLink;
-
-            bool firstParam = true;
             if (queryOptions != null)
             {
+                bool firstParam = true;
+
+                if (!string.IsNullOrEmpty(queryOptions.TrackChangesLink))
+                {
+                    fullurl = queryOptions.TrackChangesLink;
+                    firstParam = false;
+                }
+
                 if (queryOptions.Select != null)
                 {


Add regression test for accidentally allowing removal of `$psEditor` (#1828)

--- test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs
+++ test/PowerShellEditorServices.Test/Extensions/ExtensionCommandTests.cs
@@ -179,5 +179,19 @@
             await Assert.ThrowsAsync<KeyNotFoundException>(
                 () => extensionCommandService.InvokeCommandAsync("test.scriptblock", editorContext)).ConfigureAwait(true);
         }
+
+        [Fact]
+        public async Task CannotRemovePSEditorVariable()
+        {
+            ActionPreferenceStopException exception = await Assert.ThrowsAsync<ActionPreferenceStopException>(
+                () => psesHost.ExecutePSCommandAsync<string>(
+                    new PSCommand().AddScript("Remove-Variable psEditor -ErrorAction Stop"),
+                    CancellationToken.None)
+            ).ConfigureAwait(true);
+
+            Assert.Equal(
+                "The running command stopped because the preference variable \"ErrorActionPreference\" or common parameter is set to Stop: Cannot remove variable psEditor because it is constant or read-only. If the variable is read-only, try the operation again specifying the Force option.",
+                exception.Message);
+        }
     }
 }


F-Spot Addin: modified to use new ProtocolInfo class

--- src/Mono.Upnp.Dcp/Mono.Upnp.Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1.FSpot/Service/FSpotContentDirectory.cs
+++ src/Mono.Upnp.Dcp/Mono.Upnp.Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1.FSpot/Service/FSpotContentDirectory.cs
@@ -38,6 +38,7 @@
 using UpnpPhoto = Mono.Upnp.Dcp.MediaServer1.ContentDirectory1.Av.Photo;
 using UpnpObject = Mono.Upnp.Dcp.MediaServer1.ContentDirectory1.Object;
 using System.Collections;
+using Mono.Upnp.Dcp.MediaServer1.ConnectionManager1;

 namespace Mono.Upnp.Dcp.MediaServer1.FSpot
 {
@@ -273,7 +274,7 @@
                 upnp_photo = new UpnpPhoto (photo_options, this, parent);

                 var resource_settings = new ResourceSettings (new Uri (string.Format ("{0}object?id={1}", prefix, upnp_photo.Id))) {
-                    ProtocolInfo = string.Format ("http-get:*:{0}:*", MimeTypeHelper.GetMimeType(photo.DefaultVersion.Uri))
+                    ProtocolInfo = new ProtocolInfo (Protocols.HttpGet, MimeTypeHelper.GetMimeType(photo.DefaultVersion.Uri))
                 };
                 upnp_photo.AddResource (new Resource (resource_settings));


cleanup of high score entering code

cleanup of high score entering code

--- SpaceAceWPF/SpaceAceWPF/MainWindow.xaml.cs
+++ SpaceAceWPF/SpaceAceWPF/MainWindow.xaml.cs
@@ -1026,30 +1026,19 @@
         private int hs_curLetter = 0;
         private void enterHighScore(bool player1)
         {
+            TextBlock[] nameChars = { hs_name0, hs_name1, hs_name2, hs_name3, hs_name4, hs_name5, hs_name6, hs_name7, hs_name8, hs_name9 };
+            Border[] borders = { hs_border0, hs_border1, hs_border2, hs_border3, hs_border4, hs_border5, hs_border6, hs_border7, hs_border8, hs_border9 };
+
             this.hs_header.Visibility = System.Windows.Visibility.Visible;
             this.hs_leftShip.Visibility = System.Windows.Visibility.Visible;
             this.hs_rightShip.Visibility = System.Windows.Visibility.Visible;
-            this.hs_info.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name0.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name1.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name2.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name3.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name4.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name5.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name6.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name7.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name8.Visibility = System.Windows.Visibility.Visible;
-            this.hs_name9.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border0.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border1.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border2.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border3.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border4.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border5.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border6.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border7.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border8.Visibility = System.Windows.Visibility.Visible;
-            this.hs_border9.Visibility = System.Windows.Visibility.Visible;
+            foreach (TextBlock nameChar in nameChars) {
+                nameChar.Visibility = System.Windows.Visibility.Visible;
+            }
+            foreach (Border border in borders)
+            {
+                border.Visibility = System.Windows.Visibility.Visible;
+            }
             this.pause_background.Opacity = 1;

             if(player1)
@@ -1132,30 +1121,21 @@
                     scoreboard.addHighScore(highScoreName.Trim(), score);
                     highScoreInput = InputType.none;

+                    TextBlock[] nameChars = { hs_name0, hs_name1, hs_name2, hs_name3, hs_name4, hs_name5, hs_name6, hs_name7, hs_name8, hs_name9 };
+                    Border[] borders = { hs_border0, hs_border1, hs_border2, hs_border3, hs_border4, hs_border5, hs_border6, hs_border7, hs_border8, hs_border9 };
+
                     this.hs_header.Visibility = System.Windows.Visibility.Collapsed;
                     this.hs_leftShip.Visibility = System.Windows.Visibility.Collapsed;
                     this.hs_rightShip.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_info.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name0.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name1.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name2.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name3.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name4.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name5.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name6.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name7.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name8.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_name9.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border0.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border1.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border2.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border3.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border4.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border5.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border6.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border7.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border8.Visibility = System.Windows.Visibility.Collapsed;
-                    this.hs_border9.Visibility = System.Windows.Visibility.Collapsed;
+                    foreach (TextBlock nameChar in nameChars)
+                    {
+                        nameChar.Visibility = System.Windows.Visibility.Collapsed;
+                    }
+                    foreach (Border border in borders)
+                    {
+                        border.Visibility = System.Windows.Visibility.Collapsed;
+                    }
+
                     this.pause_background.Opacity = 0;

                     highScoreInput = InputType.none;


Refactoring

Refactoring

--- src/Beetle.WebApi/Helper.cs
+++ src/Beetle.WebApi/Helper.cs
@@ -43,14 +43,12 @@
         }

         public static ObjectContent HandleResponse(ProcessResult processResult) {
+            var result = processResult.Result;
+
             var actionContext = processResult.ActionContext;
             var service = actionContext.Service;
             var config = actionContext.Config ?? service?.Config ?? BeetleConfig.Instance;
             var response = HttpContext.Current.Response;
-
-            var type = processResult.Result?.GetType() ?? typeof(object);
-            var formatter = CreateFormatter(config);
-            var retVal = new ObjectContent(type, processResult.Result, formatter);

             // set InlineCount header info if exists
             object inlineCount = processResult.InlineCount;
@@ -62,7 +60,9 @@
                 response.Headers.Add("X-UserData", userDataStr);
             }

-            return retVal;
+            var type = result?.GetType() ?? typeof(object);
+            var formatter = CreateFormatter(config);
+            return new ObjectContent(type, result, formatter);
         }

         public static void CheckRequestHash(string queryString) {
@@ -83,6 +83,10 @@
             throw new BeetleException(Server.Properties.Resources.AlteredRequestException);
         }

+        public static IDictionary<string, string> ToDictionary(this NameValueCollection nameValueCollection) {
+            return nameValueCollection.AllKeys.ToDictionary(k => k, k => nameValueCollection[k]);
+        }
+
         public static MediaTypeFormatter CreateFormatter(IBeetleConfig config) {
             var beetleConfig = config as BeetleConfig;
             var settings = beetleConfig != null ? beetleConfig.JsonSerializerSettings : BeetleConfig.Instance.JsonSerializerSettings;
@@ -92,9 +96,5 @@
             formatter.SupportedEncodings.Add(new UTF8Encoding(false, true));
             return formatter;
         }
-
-        public static IDictionary<string, string> ToDictionary(this NameValueCollection nameValueCollection) {
-            return nameValueCollection.AllKeys.ToDictionary(k => k, k => nameValueCollection[k]);
-        }
     }
 }


Updated ShapeBounds class

Updated ShapeBounds class

--- Test2d.Editor/Editor/Bounds/ShapeBounds.cs
+++ Test2d.Editor/Editor/Bounds/ShapeBounds.cs
@@ -116,12 +116,11 @@
         public static Rect2 GetPathBounds(XPath path, double dx, double dy)
         {
             var b = path.Geometry.Bounds;
-            var t = path.Transform;
             return Rect2.Create(
-                t.OffsetX + b.X + dx,
-                t.OffsetY + b.Y + dy,
-                t.OffsetX + b.X + b.Width + dx,
-                t.OffsetY + b.Y + b.Height + dy);
+                b.X + dx,
+                b.Y + dy,
+                b.X + b.Width + dx,
+                b.Y + b.Height + dy);
         }

         #endregion


add duplicate image to cache

add duplicate image to cache

--- Ubiquitous2/Model/ImageCacheDataService.cs
+++ Ubiquitous2/Model/ImageCacheDataService.cs
@@ -25,7 +25,11 @@
         private Dictionary<String, ImageCacheItem> bitmapImageCache = new Dictionary<string,ImageCacheItem>();
         public void AddImage( Uri uri, Stream stream )
         {
+            if (bitmapImageCache.ContainsKey(uri.OriginalString))
+                return;
+
             var item = new ImageCacheItem(stream);
+
             lock (cacheLock)
                 bitmapImageCache.Add(uri.OriginalString, item);


changed a bit of text

changed a bit of text

--- source/Cosmos.Build.Builder/BuildTasks/CreateSetupTask.cs
+++ source/Cosmos.Build.Builder/BuildTasks/CreateSetupTask.cs
@@ -41,7 +41,7 @@

             if (!File.Exists(innoSetupCompilerPath))
             {
-                throw new InvalidOperationException("An Inno Setup installation was detected, but the compiler doesn't exist!");
+                throw new InvalidOperationException($"An Inno Setup installation was detected, but no compiler exists at {innoSetupCompilerPath}");
             }

             return innoSetupCompilerPath;


Add an extra option for what string categories will be mapped to what FormattingKeywordEnum's

--- source/Glimpse.AspNet/PipelineInspector/TraceInspector.cs
+++ source/Glimpse.AspNet/PipelineInspector/TraceInspector.cs
@@ -318,6 +318,7 @@
                 case "quiet":
                     return FormattingKeywordEnum.Quiet;
                 case "timing":
+                case "loading":
                     return FormattingKeywordEnum.Loading;
                 case "selected":
                     return FormattingKeywordEnum.Selected;


peach.exe uses reflection for implicit refs

--- src/Compiler/peach/peach.cs
+++ src/Compiler/peach/peach.cs
@@ -48,6 +48,7 @@
                 typeof(Peachpie.Library.MySql.MySql).Assembly,  // MySql
                 typeof(Peachpie.Library.MsSql.MsSql).Assembly,  // MsSql
             };
+            var refs = assemblies.Distinct().Select(ass => "/r:" + ass.Location);

             Debug.Assert(refs.Any(r => r.Contains("System.Core")));
             Debug.Assert(refs.Any(r => r.Contains("Peachpie.Runtime")));


add a test for query with predicate

add a test for query with predicate

--- DocumentStores/CosmosDb/Halforbit.DataStores.DocumentStores.CosmosDb.Tests/CosmosDbDataStorePartitionedTests.cs
+++ DocumentStores/CosmosDb/Halforbit.DataStores.DocumentStores.CosmosDb.Tests/CosmosDbDataStorePartitionedTests.cs
@@ -71,6 +71,12 @@
                     .ToList();

                 Assert.Equal(2, result.Count);
+
+                var result2 = session
+                    .Query(k => k.PartitionId == values[0].PartitionId)
+                    .ToList();
+
+                Assert.Single(result2);
             }

             ClearDataStore(dataStore);


fix MySQL_InventoryRepository bug

fix MySQL_InventoryRepository bug

--- IsolatedIslandGame/IsolatedIslandGame.Database.MySQL/DatabaseElements/Repositories/MySQL_InventoryRepository.cs
+++ IsolatedIslandGame/IsolatedIslandGame.Database.MySQL/DatabaseElements/Repositories/MySQL_InventoryRepository.cs
@@ -102,7 +102,7 @@
             }
             foreach(var itemInfo in inventory.ItemInfos)
             {
-                DatabaseService.RepositoryList.InventoryItemInfoRepository.Update(itemInfo);
+                DatabaseService.RepositoryList.InventoryItemInfoRepository.Update(itemInfo, inventory.InventoryID);
             }
         }
         public override void Delete(int inventoryID)


GSF.TimeSeries: Added connection string parameter to ActionAdapterBase to configure the RoundToNearestTimestamp property of ConcentratorBase.

--- Source/Libraries/GSF.TimeSeries/Adapters/ActionAdapterBase.cs
+++ Source/Libraries/GSF.TimeSeries/Adapters/ActionAdapterBase.cs
@@ -861,6 +861,9 @@
             if (settings.TryGetValue("timeResolution", out setting))
                 TimeResolution = long.Parse(setting);

+            if (settings.TryGetValue("roundToNearestTimestamp", out setting))
+                RoundToNearestTimestamp = setting.ParseBoolean();
+
             if (settings.TryGetValue("allowPreemptivePublishing", out setting))
                 AllowPreemptivePublishing = setting.ParseBoolean();


Remove WikibaseItem. It's not exactly a page anyway.

--- WikiClientLibrary.Wikibase/WikibaseItem.cs
+++ WikiClientLibrary.Wikibase/WikibaseItem.cs
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using WikiClientLibrary.Pages;
-using WikiClientLibrary.Sites;
-
-namespace WikiClientLibrary.Wikibase
-{
-    /// <summary>
-    /// An item usually indicating an entity in the Wikibase.
-    /// </summary>
-    internal class WikibaseItem : WikiPage      // Reserved for future use.
-    {
-        /// <inheritdoc />
-        public WikibaseItem(WikiSite site, string title) : base(site, title)
-        {
-        }
-
-        /// <inheritdoc />
-        public WikibaseItem(WikiSite site, string title, int defaultNamespaceId) : base(site, title, defaultNamespaceId)
-        {
-        }
-
-        /// <inheritdoc />
-        internal WikibaseItem(WikiSite site) : base(site)
-        {
-        }
-    }
-}


Added bigger timeout for ex rate query

Added bigger timeout for ex rate query

--- Spinvoice.Infrastructure.DataAccess/ExchangeRateDataAccess.cs
+++ Spinvoice.Infrastructure.DataAccess/ExchangeRateDataAccess.cs
@@ -17,7 +17,7 @@
             using (var session = DocumentStore.OpenSession())
             {
                return session.Query<Rate>()
-                    .Customize(x => x.WaitForNonStaleResultsAsOfNow())
+                    .Customize(x => x.WaitForNonStaleResultsAsOfNow(TimeSpan.FromMinutes(2)))
                     .FirstOrDefault(r => r.Currency == currency && r.Date == date);
             }
         }


added SyntheticTest-Id

added SyntheticTest-Id

--- Templates/contents/AppInsightsHttpAvailability-CSharp/run.csx
+++ Templates/contents/AppInsightsHttpAvailability-CSharp/run.csx
@@ -13,6 +13,7 @@
 // For questions or feedbacks, please visit [Application Insights forum] https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=ApplicationInsights

 // setup synthetic headers used for client-server telemetry correlation
+private const string SyntheticTestId = "SyntheticTest-Id";
 private const string SyntheticTestRunId = "SyntheticTest-RunId";
 private const string SyntheticTestLocation = "SyntheticTest-Location";

@@ -21,7 +22,7 @@
 // [Configure Azure Function Application settings] https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings
 private static readonly TelemetryClient TelemetryClient = new TelemetryClient { InstrumentationKey = ConfigurationManager.AppSettings["AI_IKEY"] };

-// [CONFIGURATION_REQUIRED] configure test timeout for which the test should run
+// [CONFIGURATION_REQUIRED] configure test timeout accordingly for which your request should run
 private static readonly HttpClient HttpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };

 public static async Task Run(TimerInfo myTimer, TraceWriter log)
@@ -29,6 +30,13 @@
     if (myTimer.IsPastDue)
     {
         log.Warning($"[Warning]: Timer is running late! Last ran at: {myTimer.ScheduleStatus.Last}");
+    }
+
+    // [CONFIGURATION_REQUIRED] provide {testName} accordingly for your test function
+    string testName = "AvailabilityTestFunction";
+    if (!HttpClient.DefaultRequestHeaders.Contains(SyntheticTestId))
+    {
+        HttpClient.DefaultRequestHeaders.Add(SyntheticTestId, testName);
     }

     // REGION_NAME is a default environment variable that comes with App Service
@@ -40,7 +48,7 @@

     // [CONFIGURATION_REQUIRED] configure {uri} and {contentMatch} accordingly for your web app
     await AvailabilityTestRun(
-        name: "AvailabilityTestFunction",
+        name: testName,
         location: location,
         uri: "https://azure.microsoft.com/en-us/services/application-insights",
         contentMatch: "Application Insights",
@@ -56,6 +64,7 @@
     string operationId = Guid.NewGuid().ToString();
     log.Verbose($"[Verbose]: Operation ID is {operationId}");

+    // always update the run Id for every run
     if (HttpClient.DefaultRequestHeaders.Contains(SyntheticTestRunId))
     {
         HttpClient.DefaultRequestHeaders.Remove(SyntheticTestRunId);


Update XML doc comment

Update XML doc comment

--- src/DotNet/Writer/USHeap.cs
+++ src/DotNet/Writer/USHeap.cs
@@ -20,7 +20,7 @@
 		}

 		/// <summary>
-		/// Populate strings from an existing <see cref="USStream"/> (eg. to preserve
+		/// Populates strings from an existing <see cref="USStream"/> (eg. to preserve
 		/// string tokens)
 		/// </summary>
 		/// <param name="usStream">The #US stream with the original content</param>


Entity Framework doesn't implement a "SaveOrUpdate" method so the Save method checks to see if the entitly is transient and should be marked added or modified in the context

--- ToolKit.Data.EntityFramework/EntityFrameworkRepositoryBase.cs
+++ ToolKit.Data.EntityFramework/EntityFrameworkRepositoryBase.cs
@@ -1,8 +1,6 @@
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Data.Entity;

 namespace ToolKit.Data.EntityFramework
 {
@@ -64,6 +62,8 @@
         /// <param name="entity">The entity.</param>
         public void Save(T entity)
         {
+            Context.Entry(entity).State = entity.IsTransient() ? EntityState.Added : EntityState.Modified;
+
             Context.Save(entity);
         }


* Removal of application filtering from AccessErrorLog

--- src/Elmah/AccessErrorLog.cs
+++ src/Elmah/AccessErrorLog.cs
@@ -221,10 +221,7 @@
             using (OleDbCommand command = connection.CreateCommand())
             {
                 command.CommandType = CommandType.Text;
-                command.CommandText = "SELECT COUNT(*) FROM Elmah_Error WHERE Application = @Application";
-
-                OleDbParameterCollection parameters = command.Parameters;
-                parameters.Add("@Application", OleDbType.VarChar, _maxAppNameLength).Value = ApplicationName;
+                command.CommandText = "SELECT COUNT(*) FROM Elmah_Error";

                 connection.Open();
                 int totalCount = (int)command.ExecuteScalar();
@@ -246,7 +243,6 @@
                     sql.Append("SELECT TOP ");
                     sql.Append(maxRecords.ToString());
                     sql.Append(" TimeUtc, SequenceNumber FROM Elmah_Error ");
-                    sql.Append("WHERE Application = @Application ");
                     sql.Append("ORDER BY TimeUtc DESC, SequenceNumber DESC) ");
                     sql.Append("ORDER BY TimeUtc ASC, SequenceNumber ASC) AS i ");
                     sql.Append("INNER JOIN Elmah_Error AS e ON i.SequenceNumber = e.SequenceNumber ");
@@ -317,12 +313,10 @@
             {
                 command.CommandText = "SELECT   AllXml " +
                                       "FROM     Elmah_Error " +
-                                      "WHERE    Application = @Application " +
-                                      "AND      ErrorId = @ErrorId";
+                                      "WHERE    ErrorId = @ErrorId";
                 command.CommandType = CommandType.Text;

                 OleDbParameterCollection parameters = command.Parameters;
-                parameters.Add("@Application", OleDbType.VarChar, _maxAppNameLength).Value = ApplicationName;
                 parameters.Add("@ErrorId", OleDbType.VarChar, 32).Value = errorGuid.ToString("N");

                 connection.Open();


Improve NameState performance as a Dictionary key

Default GetHashCode and Equals of a ValueType (struct) is based on
reflection and quite slow. So we need to implement them to improve
performance when building a GUIStyle, getting or setting a style
property.

--- src/ImGui/Style/GUIStyle.cs
+++ src/ImGui/Style/GUIStyle.cs
@@ -13,6 +13,31 @@
         {
             public StylePropertyName Name { get; set; }
             public GUIState State { get; set; }
+
+            public override int GetHashCode()
+            {
+                unchecked // Overflow is fine, just wrap
+                {
+                    int hash = 17;
+                    hash = hash * 23 + this.Name.GetHashCode();
+                    hash = hash * 23 + this.State.GetHashCode();
+                    return hash;
+                }
+            }
+
+            public override bool Equals(object obj)
+            {
+                if (obj is NameState)
+                {
+                    return this.Equals((NameState)obj);
+                }
+                return false;
+            }
+
+            public bool Equals(NameState nameState)
+            {
+                return nameState.Name == this.Name && nameState.State == this.State;
+            }
         }

         /// <summary>


cleanup in chat.cs

cleanup in chat.cs

--- src/JabbR-Core/Hubs/Chat.cs
+++ src/JabbR-Core/Hubs/Chat.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Linq;
 using Newtonsoft.Json;
+using System.Threading;
 using System.Diagnostics;
 using JabbR_Core.Services;
 using JabbR_Core.Commands;
@@ -13,10 +14,6 @@
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.Extensions.Options;
 using Microsoft.EntityFrameworkCore;
-using System.Threading;
-using System.Net.Http;
-using Microsoft.AspNetCore.Identity;
-using JabbR_Core.Controllers;

 namespace JabbR_Core.Hubs
 {
@@ -629,7 +626,7 @@
             foreach (var client in clients)
             {
                 DisconnectClient(client.Id);
-                Clients.Client(clientId).logOut();
+                Clients.Client(client.Id).logOut();
             }
         }


Multi-part method bodies should have MethodDebugInfo.Document set to nil

--- src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/SequencePointEnumerator.cs
+++ src/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/SequencePointEnumerator.cs
@@ -17,15 +17,15 @@
         private int _previousNonHiddenStartLine;
         private ushort _previousNonHiddenStartColumn;

-        public unsafe SequencePointEnumerator(byte* buffer, int length, DocumentHandle primaryDocument)
-            : this(MemoryBlock.CreateChecked(buffer, length), primaryDocument)
-        {
-        }
-
-        internal SequencePointEnumerator(MemoryBlock block, DocumentHandle primaryDocument)
+        public unsafe SequencePointEnumerator(byte* buffer, int length, DocumentHandle document)
+            : this(MemoryBlock.CreateChecked(buffer, length), document)
+        {
+        }
+
+        internal SequencePointEnumerator(MemoryBlock block, DocumentHandle document)
         {
             _reader = new BlobReader(block);
-            _current = new SequencePoint(primaryDocument, -1);
+            _current = new SequencePoint(document, -1);
             _previousNonHiddenStartLine = -1;
             _previousNonHiddenStartColumn = 0;
         }
@@ -45,6 +45,11 @@
             {
                 // header (skip local signature rid):
                 _reader.ReadCompressedInteger();
+
+                if (document.IsNil)
+                {
+                    document = ReadDocumentHandle();
+                }

                 // IL offset:
                 offset = _reader.ReadCompressedInteger();


fix #163 - implement unix timestamp

fix #163 - implement unix timestamp

--- src/Acr.UserDialogs.Android/Builders/DatePromptBuilder.cs
+++ src/Acr.UserDialogs.Android/Builders/DatePromptBuilder.cs
@@ -55,8 +55,10 @@
         static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
         public static long ToUnixTimestamp(this DateTime dateTime)
         {
-            var utc = TimeZoneInfo.ConvertTimeToUtc(dateTime);
-            return Convert.ToInt64((utc - Epoch).TotalSeconds);
+            //var utc = TimeZoneInfo.ConvertTimeToUtc(dateTime);
+            var utc = dateTime.ToUniversalTime();
+            var ms = utc.Subtract(Epoch).TotalMilliseconds;
+            return Convert.ToInt64(ms);
         }
     }
 }