Removing Markdown from Push Payload

Removing Markdown from Push Payload

--- src/Eurofurence.App.Server.Services/PushNotifications/FirebaseChannelManager.cs
+++ src/Eurofurence.App.Server.Services/PushNotifications/FirebaseChannelManager.cs
@@ -5,6 +5,7 @@
 using System.Net.Http.Headers;
 using System.Text;
 using System.Threading.Tasks;
+using Eurofurence.App.Common.ExtensionMethods;
 using Eurofurence.App.Domain.Model.Abstractions;
 using Eurofurence.App.Domain.Model.Announcements;
 using Eurofurence.App.Domain.Model.PushNotifications;
@@ -41,8 +42,8 @@
                     data = new
                     {
                         Event = "Announcement",
-                        announcement.Title,
-                        Text = announcement.Content,
+                        Title = announcement.Title.RemoveMarkdown(),
+                        Text = announcement.Content.RemoveMarkdown(),
                         RelatedId = announcement.Id
                     },
                     to = $"/topics/{_configuration.TargetTopicAndroid}"
@@ -55,8 +56,8 @@
                         announcement_id = announcement.Id,
                     },
                     notification = new {
-                        title = announcement.Title,
-                        body = announcement.Content,
+                        title = announcement.Title.RemoveMarkdown(),
+                        body = announcement.Content.RemoveMarkdown(),
                         sound = "notification_default.caf"
                     },
                     content_available = true,


Fixed up a comment to be more detailed

Fixed up a comment to be more detailed

--- src/Hallmanac.CryptoHelpers/Hallmanac.CryptoHelpers_Net45/PasswordHashingSvc.cs
+++ src/Hallmanac.CryptoHelpers/Hallmanac.CryptoHelpers_Net45/PasswordHashingSvc.cs
@@ -27,8 +27,11 @@
         /// Creates a new instance of the PasswordEncryptionSvc. If the application has a global application salt, then pass
         /// that into this constructor otherwise the hashing will not match up.
         /// </summary>
-        /// <param name="globalApplicationSalt">The global application Salt is used to do an initial hash of the password
-        /// and then do a normal salt and hash of the password. The global app salt is kept secret inside Azure Key Vault
+        /// <param name="globalApplicationSalt">The Global Application Salt adds an extra layer of security to the password hashing
+        /// process by hashing each password with this salt first and then proceeding to the normal route of hashing a password. The
+        /// globalApplicationSalt itself is intended to be kept secret (i.e. stored in something like Azure Key Vault) which means that
+        /// even if someone were able to gain access to passwords they would not be able to brute force the password because, in theory,
+        /// they would not have access to the global application salt.
         /// </param>
         public PasswordHashingSvc(string globalApplicationSalt = null)
         {


Add deprecation message to LTv2 constructors

--- src/IBM.WatsonDeveloperCloud.LanguageTranslator.v2/LanguageTranslatorService.cs
+++ src/IBM.WatsonDeveloperCloud.LanguageTranslator.v2/LanguageTranslatorService.cs
@@ -34,12 +34,14 @@
         const string URL = "https://gateway.watsonplatform.net/language-translator/api";
         public LanguageTranslatorService() : base(SERVICE_NAME, URL)
         {
+            Console.WriteLine("Language Translator v3 is now available. The v2 Language Translator API will no longer be available after July 31, 2018. To take advantage of the latest service enhancements, migrate to the v3 API. View the [Migrating to Language Translator v3](https://console.bluemix.net/docs/services/language-translator/migrating.html) page for more information.");
             if(!string.IsNullOrEmpty(this.Endpoint))
                 this.Endpoint = URL;
         }

         public LanguageTranslatorService(string userName, string password) : this()
         {
+            Console.WriteLine("Language Translator v3 is now available. The v2 Language Translator API will no longer be available after July 31, 2018. To take advantage of the latest service enhancements, migrate to the v3 API. View the [Migrating to Language Translator v3](https://console.bluemix.net/docs/services/language-translator/migrating.html) page for more information.");
             if (string.IsNullOrEmpty(userName))
                 throw new ArgumentNullException(nameof(userName));

@@ -51,6 +53,7 @@

         public LanguageTranslatorService(TokenOptions options) : this()
         {
+            Console.WriteLine("Language Translator v3 is now available. The v2 Language Translator API will no longer be available after July 31, 2018. To take advantage of the latest service enhancements, migrate to the v3 API. View the [Migrating to Language Translator v3](https://console.bluemix.net/docs/services/language-translator/migrating.html) page for more information.");
             if (string.IsNullOrEmpty(options.IamApiKey) && string.IsNullOrEmpty(options.IamAccessToken))
                 throw new ArgumentNullException(nameof(options.IamAccessToken) + ", " + nameof(options.IamApiKey));
             if (!string.IsNullOrEmpty(options.ServiceUrl))
@@ -67,6 +70,7 @@

         public LanguageTranslatorService(IClient httpClient) : this()
         {
+            Console.WriteLine("Language Translator v3 is now available. The v2 Language Translator API will no longer be available after July 31, 2018. To take advantage of the latest service enhancements, migrate to the v3 API. View the [Migrating to Language Translator v3](https://console.bluemix.net/docs/services/language-translator/migrating.html) page for more information.");
             if (httpClient == null)
                 throw new ArgumentNullException(nameof(httpClient));


Fix API version compatiblity checking

Fix API version compatiblity checking

--- src/Tgstation.Server.Api/ApiHeaders.cs
+++ src/Tgstation.Server.Api/ApiHeaders.cs
@@ -106,7 +106,7 @@
 		/// </summary>
 		/// <param name="otherVersion">The <see cref="Version"/> to test</param>
 		/// <returns><see langword="true"/> if the given version is compatible with the API. <see langword="false"/> otherwise</returns>
-		public static bool CheckCompatibility(Version otherVersion) => !(Version.Major != (otherVersion?.Major ?? throw new ArgumentNullException(nameof(otherVersion))) || Version.Minor > otherVersion.Minor);
+		public static bool CheckCompatibility(Version otherVersion) => Version.Major == (otherVersion?.Major ?? throw new ArgumentNullException(nameof(otherVersion)));

 		/// <summary>
 		/// Construct <see cref="ApiHeaders"/> for JWT authentication


Add errors reading PE file to assembly error list

--- src/Microsoft.Fx.Portability.MetadataReader/ReflectionMetadataDependencyInfo.cs
+++ src/Microsoft.Fx.Portability.MetadataReader/ReflectionMetadataDependencyInfo.cs
@@ -58,26 +58,33 @@
         {
             _inputAssemblies.AsParallel().ForAll(filename =>
             {
-                foreach (var dependencies in GetDependencies(filename))
+                try
                 {
-                    var m = new MemberInfo
+                    foreach (var dependencies in GetDependencies(filename))
                     {
-                        MemberDocId = dependencies.MemberDocId,
-                        TypeDocId = dependencies.TypeDocId,
-                        DefinedInAssemblyIdentity = dependencies.DefinedInAssemblyIdentity
-                    };
+                        var m = new MemberInfo
+                        {
+                            MemberDocId = dependencies.MemberDocId,
+                            TypeDocId = dependencies.TypeDocId,
+                            DefinedInAssemblyIdentity = dependencies.DefinedInAssemblyIdentity
+                        };

-                    // Add this memberinfo
-                    var newassembly = new HashSet<AssemblyInfo> { dependencies.CallingAssembly };
+                        // Add this memberinfo
+                        var newassembly = new HashSet<AssemblyInfo> { dependencies.CallingAssembly };

-                    var assemblies = _cachedDependencies.AddOrUpdate(m, newassembly, (key, existingSet) =>
-                    {
-                        lock (existingSet)
+                        var assemblies = _cachedDependencies.AddOrUpdate(m, newassembly, (key, existingSet) =>
                         {
-                            existingSet.Add(dependencies.CallingAssembly);
-                        }
-                        return existingSet;
-                    });
+                            lock (existingSet)
+                            {
+                                existingSet.Add(dependencies.CallingAssembly);
+                            }
+                            return existingSet;
+                        });
+                    }
+                }
+                catch (InvalidPEAssemblyException)
+                {
+                    _assembliesWithError.Add(filename);
                 }
             });
         }
@@ -87,7 +94,7 @@
             using (var stream = File.OpenRead(assemblyLocation))
             using (var peFile = new PEReader(stream))
             {
-                var metadataReader = peFile.GetMetadataReader();
+                var metadataReader = GetMetadataReader(peFile);

                 var helper = new DependencyFinderEngineHelper(metadataReader, assemblyLocation);
                 helper.ComputeData();
@@ -95,11 +102,33 @@
                 // Remember this assembly as a user assembly.
                 _userAssemblies.Add(helper.CallingAssembly);

-                if (helper != null)
-                    return helper.MemberDependency;
-                else
-                    return null;
+                return helper.MemberDependency;
             }
+        }
+
+        /// <summary>
+        /// Attempt to get a MetadataReader.  Call this method instead of directly on PEReader so that
+        /// exceptions thrown by it are caught and propagated as a known InvalidPEAssemblyException
+        /// </summary>
+        /// <param name="peReader"></param>
+        /// <returns></returns>
+        private MetadataReader GetMetadataReader(PEReader peReader)
+        {
+            try
+            {
+                return peReader.GetMetadataReader();
+            }
+            catch (Exception e)
+            {
+                throw new InvalidPEAssemblyException(e);
+            }
+        }
+
+        private class InvalidPEAssemblyException : Exception
+        {
+            public InvalidPEAssemblyException(Exception inner)
+                : base("Not a valid assembly", inner)
+            { }
         }
     }
 }


PlayableSprite didn't respect AnimationSprite's freedoms * PlayableSprite didn't invoke base.Update and prevented Animations from updating

--- Sharp2D/Sharp2D/Game/Sprites/PlayableSprite.cs
+++ Sharp2D/Sharp2D/Game/Sprites/PlayableSprite.cs
@@ -24,6 +24,8 @@

         public override void Update()
         {
+            base.Update();
+
             var count = Screen.TickCount;
             var delta = count - _lastTick;


1. Support symbol server url with SAS token. 2. Add SourceServerTargetFullUrl property to reterive sourceserver target from symbol pdb. 3. Support sha1 checksum

--- src/TraceEvent/Symbols/SymbolReader.cs
+++ src/TraceEvent/Symbols/SymbolReader.cs
@@ -194,6 +194,11 @@
                             cache = path.DefaultSymbolCache();

                         pdbPath = GetFileFromServer(element.Target, pdbIndexPath, Path.Combine(cache, pdbIndexPath));
+                        if (pdbPath != null)
+                        {
+                            // we have downloaded the symbol from server to local cache, just return
+                            return pdbPath;
+                        }
                     }
                     else
                     {
@@ -746,12 +751,7 @@
                 {
                     if (Uri.IsWellFormedUriString(serverPath, UriKind.Absolute))
                     {
-                        var fullUri = serverPath;
-                        var tail = pdbIndexPath.Replace('\\', '/');
-                        if (!tail.StartsWith("/"))
-                            fullUri += "/" + tail;
-                        else
-                            fullUri += tail;
+                        var fullUri = BuildFullUri(serverPath, pdbIndexPath);
                         try
                         {
                             var req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(fullUri);
@@ -861,6 +861,28 @@
         }

         /// <summary>
+        /// Build the full uri from server path and pdb index path
+        /// </summary>
+        private string BuildFullUri(string serverPath, string pdbIndexPath)
+        {
+            var tail = pdbIndexPath.Replace('\\', '/');
+            if (!tail.StartsWith("/", StringComparison.Ordinal))
+                tail = "/" + tail;
+
+            // The server path can contain query parameters (eg, Azure storage SAS token).
+            // Append the pdb index to the path part.
+            var query = serverPath.IndexOf('?');
+            if (query > 0)
+            {
+                return serverPath.Insert(query, tail);
+            }
+            else
+            {
+                return serverPath + tail;
+            }
+        }
+
+        /// <summary>
         /// This just copies a stream to a file path with logging.
         /// </summary>
         private int CopyStreamToFile(Stream fromStream, string fromUri, string fullDestPath, ref bool canceled)
@@ -2000,10 +2022,31 @@
         /// The path of the file at the time the source file was built.
         /// </summary>
         public string BuildTimeFilePath { get; internal set; }
+
+        /// <summary>
+        /// Get the expanded SRCSRVTRG value in the PDB's SRCSRV stream.
+        /// If the value is in a valid absolute uri format (eg, https://abc/file.cs), return the value.
+        /// Otherwise, return null.
+        /// </summary>
+        public string SourceServerTargetFullUrl
+        {
+            get
+            {
+                string target, command;
+                GetSourceServerTargetAndCommand(out target, out command);
+
+                if (!string.IsNullOrEmpty(target) && Uri.IsWellFormedUriString(target, UriKind.Absolute))
+                    return target;
+                else
+                    return null;
+            }
+        }
+
         /// <summary>
         /// true if the PDB has a checksum for the data in the source file.
         /// </summary>
         public bool HasChecksum { get { return m_hash != null; } }
+
         /// <summary>
         /// This may fetch things from the source server, and thus can be very slow, which is why it is not a property.
         /// </summary>
@@ -2099,6 +2142,7 @@
             log.WriteLine("[Could not find source for {0}]", BuildTimeFilePath);
             return null;
         }
+
         /// <summary>
         /// If GetSourceFile is called and 'requireChecksumMatch' == false then you can call this property to
         /// determine if the checksum actually matched or not.   This will return true if the original
@@ -2114,6 +2158,85 @@
         }

         #region private
+        /// <summary>
+        /// Get the source server target (SRCSRVTRG) and command (SRCSRVCMD) from the symbol pdb
+        /// </summary>
+        /// <param name="targVar">Specify the value for %targ% variable. If the value is null, %targ% variable will not be expanded.</param>
+        private void GetSourceServerTargetAndCommand(out string target, out string command, string targVar = null)
+        {
+            target = null;
+            command = null;
+
+            var log = m_symbolModule.m_reader.m_log;
+            log.WriteLine("*** Looking up {0} using source server", BuildTimeFilePath);
+
+            var srcServerPdb = m_symbolModule.PdbForSourceServer;
+            if (srcServerPdb == null)
+            {
+                log.WriteLine("*** Could not find PDB to look up source server information");
+                return;
+            }
+
+            string srcsvcStream = srcServerPdb.GetSrcSrvStream();
+            if (srcsvcStream == null)
+            {
+                log.WriteLine("*** Could not find srcsrv stream in PDB file");
+                return;
+            }
+
+            log.WriteLine("*** Found srcsrv stream in PDB file. of size {0}", srcsvcStream.Length);
+            StringReader reader = new StringReader(srcsvcStream);
+
+            bool inSrc = false;
+            bool inVars = false;
+            var vars = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+
+            if (targVar != null)
+                vars.Add("targ", targVar);
+
+            for (;;)
+            {
+                var line = reader.ReadLine();
+                if (line == null)
+                    break;
+
+                // log.WriteLine("Got srcsrv line {0}", line);
+                if (line.StartsWith("SRCSRV: "))
+                {
+                    inSrc = line.StartsWith("SRCSRV: source files");
+                    inVars = line.StartsWith("SRCSRV: variables");
+                    continue;
+                }
+                if (inSrc)
+                {
+                    var pieces = line.Split('*');
+                    if (pieces.Length >= 2)
+                    {
+                        var buildTimePath = pieces[0];
+                        // log.WriteLine("Found source {0} in the PDB", buildTimePath);
+                        if (string.Compare(BuildTimeFilePath, buildTimePath, StringComparison.OrdinalIgnoreCase) == 0)
+                        {
+                            // Create variables for each of the pieces.
+                            for (int i = 0; i < pieces.Length; i++)
+                                vars.Add("var" + (i + 1).ToString(), pieces[i]);
+
+                            target = SourceServerFetchVar("SRCSRVTRG", vars);
+                            command = SourceServerFetchVar("SRCSRVCMD", vars);
+
+                            return;
+                        }
+                    }
+                }
+                else if (inVars)
+                {
+                    // Gather up the KEY=VALUE pairs into a dictionary.
+                    var m = Regex.Match(line, @"^(\w+)=(.*?)\s*$");
+                    if (m.Success)
+                        vars[m.Groups[1].Value] = m.Groups[2].Value;
+                }
+            }
+        }
+
         /// <summary>
         /// Try to fetch the source file associated with 'buildTimeFilePath' from the symbol server
         /// information from the PDB from 'pdbPath'.   Will return a path to the returned file (uses
@@ -2138,175 +2261,105 @@
         string GetSourceFromSrcServer()
         {
             var log = m_symbolModule.m_reader.m_log;
-            log.WriteLine("*** Looking up {0} using source server", BuildTimeFilePath);
-
-            var srcServerPdb = m_symbolModule.PdbForSourceServer;
-            if (srcServerPdb == null)
-            {
-                log.WriteLine("*** Could not find PDB to look up source server information");
-                return null;
-            }
-
-            string srcsvcStream = srcServerPdb.GetSrcSrvStream();
-            if (srcsvcStream == null)
-            {
-                log.WriteLine("*** Could not find srcsrv stream in PDB file");
-                return null;
-            }
-
-            log.WriteLine("*** Found srcsrv stream in PDB file. of size {0}", srcsvcStream.Length);
-            StringReader reader = new StringReader(srcsvcStream);
-
-            bool inSrc = false;
-            bool inVars = false;
-            var vars = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
             var cacheDir = m_symbolModule.m_reader.SourceCacheDirectory;
-            vars.Add("targ", cacheDir);
-            for (;;)
-            {
-                var line = reader.ReadLine();
-                if (line == null)
-                    break;
-
-                // log.WriteLine("Got srcsrv line {0}", line);
-                if (line.StartsWith("SRCSRV: "))
-                {
-                    inSrc = line.StartsWith("SRCSRV: source files");
-                    inVars = line.StartsWith("SRCSRV: variables");
-                    continue;
-                }
-                if (inSrc)
-                {
-                    var pieces = line.Split('*');
-                    if (pieces.Length >= 2)
-                    {
-                        var buildTimePath = pieces[0];
-                        // log.WriteLine("Found source {0} in the PDB", buildTimePath);
-                        if (string.Compare(BuildTimeFilePath, buildTimePath, StringComparison.OrdinalIgnoreCase) == 0)
+
+            string target, fetchCmdStr;
+            GetSourceServerTargetAndCommand(out target, out fetchCmdStr, cacheDir);
+
+            if (target != null)
+            {
+                if (!target.StartsWith(cacheDir, StringComparison.OrdinalIgnoreCase))
+                {
+                    // if target is not in cache dir, it means it's from a remote server.
+                    Uri uri = null;
+                    if (Uri.TryCreate(target, UriKind.Absolute, out uri))
+                    {
+                        target = null;
+                        var newTarget = Path.Combine(cacheDir, uri.AbsolutePath.TrimStart('/').Replace('/', '\\'));
+                        if (m_symbolModule.m_reader.GetPhysicalFileFromServer(uri.GetLeftPart(UriPartial.Authority), uri.AbsolutePath, newTarget))
+                            target = newTarget;
+
+                        if (target == null)
                         {
-                            // Create variables for each of the pieces.
-                            for (int i = 0; i < pieces.Length; i++)
-                                vars.Add("var" + (i + 1).ToString(), pieces[i]);
-
-                            var target = SourceServerFetchVar("SRCSRVTRG", vars);
-                            if (!target.StartsWith(cacheDir, StringComparison.OrdinalIgnoreCase))
+                            log.WriteLine("Could not fetch {0} from web", uri.AbsoluteUri);
+                            return null;
+                        }
+                    }
+                    else
+                    {
+                        log.WriteLine("Source Server string {0} is targeting an unsafe location.  Giving up.", target);
+                        return null;
+                    }
+                }
+
+                if (!File.Exists(target) && fetchCmdStr != null)
+                {
+                    log.WriteLine("Trying to generate the file {0}.", target);
+                    var toolsDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName);
+                    var archToolsDir = Path.Combine(toolsDir, Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"));
+
+                    // Find the EXE to do the source server fetch.  We only support SD.exe and TF.exe.
+                    string addToPath = null;
+#if !PUBLIC_ONLY                // SD.exe is a Microsoft-internal source code control system.
+                    if (fetchCmdStr.StartsWith("sd.exe ", StringComparison.OrdinalIgnoreCase))
+                    {
+                        if (!File.Exists(Path.Combine(archToolsDir, "sd.exe")))
+                            log.WriteLine("WARNING: Could not find sd.exe that should have been deployed at {0}", archToolsDir);
+                        addToPath = archToolsDir;
+                    }
+                    else
+#endif
+                    if (fetchCmdStr.StartsWith("tf.exe ", StringComparison.OrdinalIgnoreCase))
+                    {
+                        var tfExe = Command.FindOnPath("tf.exe");
+                        if (tfExe == null)
+                        {
+                            tfExe = FindTfExe();
+                            if (tfExe == null)
                             {
-                                if (Uri.IsWellFormedUriString(target, UriKind.Absolute))
-                                {
-                                    var url = target;
-                                    target = null;
-                                    if (vars.ContainsKey("HTTP_ALIAS"))
-                                    {
-                                        string prefix = vars["HTTP_ALIAS"];
-                                        log.WriteLine("HTTP_ALIAS = {0}.", prefix);
-                                        if (url.StartsWith(prefix))
-                                        {
-                                            var relPath = url.Substring(prefix.Length);
-                                            var newTarget = Path.Combine(cacheDir, relPath.TrimStart('/').Replace('/', '\\'));
-                                            if (m_symbolModule.m_reader.GetPhysicalFileFromServer(prefix, relPath, newTarget))
-                                                target = newTarget;
-                                        }
-                                        else
-                                            log.WriteLine("target does not have HTTP_ALIAS as a prefix");
-                                    }
-                                    else
-                                    {
-                                        var uri = new Uri(url);
-                                        var newTarget = Path.Combine(cacheDir, uri.AbsolutePath.TrimStart('/').Replace('/', '\\'));
-                                        if (m_symbolModule.m_reader.GetPhysicalFileFromServer(uri.GetLeftPart(UriPartial.Authority), uri.AbsolutePath, newTarget))
-                                            target = newTarget;
-                                    }
-
-                                    if (target == null)
-                                    {
-                                        log.WriteLine("Could not fetch {0} from web", url);
-                                        return null;
-                                    }
-                                }
-                                else
-                                {
-                                    log.WriteLine("Source Server string {0} is targeting an unsafe location.  Giving up.", target);
-                                    return null;
-                                }
+                                log.WriteLine("Could not find TF.exe, place it on the PATH environment variable to fix this.");
+                                return null;
                             }
-                            if (!File.Exists(target))
-                            {
-                                log.WriteLine("Trying to generate the file {0}.", target);
-                                var fetchCmdStr = SourceServerFetchVar("SRCSRVCMD", vars);
-                                var toolsDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName);
-                                var archToolsDir = Path.Combine(toolsDir, Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"));
-
-                                // Find the EXE to do the source server fetch.  We only support SD.exe and TF.exe.
-                                string addToPath = null;
-#if !PUBLIC_ONLY                // SD.exe is a Microsoft-internal source code control system.
-                                if (fetchCmdStr.StartsWith("sd.exe ", StringComparison.OrdinalIgnoreCase))
-                                {
-                                    if (!File.Exists(Path.Combine(archToolsDir, "sd.exe")))
-                                        log.WriteLine("WARNING: Could not find sd.exe that should have been deployed at {0}", archToolsDir);
-                                    addToPath = archToolsDir;
-                                }
-                                else
-#endif
-                                    if (fetchCmdStr.StartsWith("tf.exe ", StringComparison.OrdinalIgnoreCase))
-                                {
-                                    var tfExe = Command.FindOnPath("tf.exe");
-                                    if (tfExe == null)
-                                    {
-                                        tfExe = FindTfExe();
-                                        if (tfExe == null)
-                                        {
-                                            log.WriteLine("Could not find TF.exe, place it on the PATH environment variable to fix this.");
-                                            return null;
-                                        }
-                                        addToPath = Path.GetDirectoryName(tfExe);
-                                    }
-                                }
-                                else
-                                {
-                                    log.WriteLine("Source Server command is not recognized as safe (sd.exe or tf.exe), failing.");
-                                    return null;
-                                }
-                                Directory.CreateDirectory(Path.GetDirectoryName(target));
-                                fetchCmdStr = "cmd /c " + fetchCmdStr;
-                                var options = new CommandOptions().AddOutputStream(log).AddNoThrow();
-                                if (addToPath != null)
-                                    options = options.AddEnvironmentVariable("PATH", addToPath + ";%PATH%");
-
-                                log.WriteLine("Source Server command {0}.", fetchCmdStr);
-                                var fetchCmd = Command.Run(fetchCmdStr, options);
-                                if (fetchCmd.ExitCode != 0)
-                                    log.WriteLine("Source Server command failed with exit code {0}", fetchCmd.ExitCode);
-                                if (File.Exists(target))
-                                {
-                                    // If TF.exe command files it might still create an empty output file.   Fix that
-                                    if (new FileInfo(target).Length == 0)
-                                    {
-                                        File.Delete(target);
-                                        target = null;
-                                    }
-                                }
-                                else
-                                    target = null;
-
-                                if (target == null)
-                                    log.WriteLine("Source Server command failed to produce the output file.");
-                                else
-                                    log.WriteLine("Source Server command succeeded creating {0}", target);
-                            }
-                            else
-                                log.WriteLine("Found an existing source server file {0}.", target);
-                            return target;
+                            addToPath = Path.GetDirectoryName(tfExe);
                         }
                     }
-                }
-                else if (inVars)
-                {
-                    // Gather up the KEY=VALUE pairs into a dictionary.
-                    var m = Regex.Match(line, @"^(\w+)=(.*?)\s*$");
-                    if (m.Success)
-                        vars[m.Groups[1].Value] = m.Groups[2].Value;
-                }
-            }
+                    else
+                    {
+                        log.WriteLine("Source Server command is not recognized as safe (sd.exe or tf.exe), failing.");
+                        return null;
+                    }
+                    Directory.CreateDirectory(Path.GetDirectoryName(target));
+                    fetchCmdStr = "cmd /c " + fetchCmdStr;
+                    var options = new CommandOptions().AddOutputStream(log).AddNoThrow();
+                    if (addToPath != null)
+                        options = options.AddEnvironmentVariable("PATH", addToPath + ";%PATH%");
+
+                    log.WriteLine("Source Server command {0}.", fetchCmdStr);
+                    var fetchCmd = Command.Run(fetchCmdStr, options);
+                    if (fetchCmd.ExitCode != 0)
+                        log.WriteLine("Source Server command failed with exit code {0}", fetchCmd.ExitCode);
+                    if (File.Exists(target))
+                    {
+                        // If TF.exe command files it might still create an empty output file.   Fix that
+                        if (new FileInfo(target).Length == 0)
+                        {
+                            File.Delete(target);
+                            target = null;
+                        }
+                    }
+                    else
+                        target = null;
+
+                    if (target == null)
+                        log.WriteLine("Source Server command failed to produce the output file.");
+                    else
+                        log.WriteLine("Source Server command succeeded creating {0}", target);
+                }
+                else
+                    log.WriteLine("Found an existing source server file {0}.", target);
+                return target;
+            }
+
             log.WriteLine("Did not find source file in the set of source files in the PDB.");
             return null;
         }
@@ -2467,9 +2520,8 @@
             // 1 CALG_MD5 checksum generated with the MD5 hashing algorithm.
             // 2 CALG_SHA1 checksum generated with the SHA1 hashing algorithm.
             m_hashType = sourceFile.checksumType;
-            if (m_hashType != 1 && m_hashType != 0)
-            {
-                // TODO does anyone use SHA1?
+            if (m_hashType != 2 && m_hashType != 1 && m_hashType != 0)
+            {
                 Debug.Assert(false, "Unknown hash type");
                 m_hashType = 0;
             }
@@ -2477,12 +2529,12 @@
             {
                 // MD5 is 16 bytes
                 // SHA1 is 20 bytes
-                m_hash = new byte[16];
+                m_hash = m_hashType == 1 ? new byte[16] : new byte[20];

                 uint bytesFetched;
                 fixed (byte* bufferPtr = m_hash)
                     sourceFile.get_checksum((uint)m_hash.Length, out bytesFetched, out *bufferPtr);
-                Debug.Assert(bytesFetched == 16);
+                Debug.Assert(bytesFetched == m_hash.Length);
             }
         }


Diposing should unload BusinessViewModelListBase

--- src/MvvmScarletToolkit.Observables/ViewModels/Base/BusinessViewModelListBase.cs
+++ src/MvvmScarletToolkit.Observables/ViewModels/Base/BusinessViewModelListBase.cs
@@ -159,11 +159,19 @@
                 && !_unloadCommand.IsBusy;
         }

-        protected override void Dispose(bool disposing)
+        protected override async void Dispose(bool disposing)
         {
             if (_disposed)
             {
                 throw new ObjectDisposedException(nameof(ViewModelListBase<TViewModel>));
+            }
+
+            if (disposing)
+            {
+                if (IsLoaded && !IsBusy)
+                {
+                    await Unload(CancellationToken.None);
+                }
             }

             base.Dispose(disposing);


830: don't forget to SetFontNameDuplicatedHandler() before load

--- src/PixelFarm/PaintLab.YourImplementation/0_Bootstrap/CommonTextServiceSetup.cs
+++ src/PixelFarm/PaintLab.YourImplementation/0_Bootstrap/CommonTextServiceSetup.cs
@@ -57,6 +57,10 @@

             s_isInit = true;
             s_intalledTypefaces = new InstalledTypefaceCollection();
+            s_intalledTypefaces.SetFontNameDuplicatedHandler((existing, newone) =>
+            {
+                return FontNameDuplicatedDecision.Skip;
+            });
             s_intalledTypefaces.LoadSystemFonts();
             s_intalledTypefaces.SetFontNotFoundHandler((collection, fontName, subFam) =>
             {
@@ -66,7 +70,7 @@
                 {
                     default:
                         {
-
+
                         }
                         break;
                     case "SANS-SERIF":


Skip scanning of long paths

Skip scanning of long paths

Fixes #5

The .Net APIs does not handle filenames longer than 260 chars. There are
ways to get around this, see for example
http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx

But this is not a priority, the current version seems to work in most
cases.

--- src/VersionTools.Cli/ProjectScanner.cs
+++ src/VersionTools.Cli/ProjectScanner.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.IO;
 using System.Linq;
 using VersionTools.Lib;
@@ -19,7 +20,7 @@
         private void ScanDirectory(DirectoryInfo directory, List<Project> projects, Semver currentVersion) {
             var versionFile = directory.GetFiles("version.txt").SingleOrDefault();
             if (versionFile != null) {
-                Program.VerboseOut(Verbose.Scanning, "Found version.txt");
+                Program.VerboseOut(Verbose.Scanning, "Found version.txt at {0}", directory.FullName);
                 var parser = new VersionFileParser(versionFile);
                 var parsedVersion = parser.GetVersion();

@@ -41,7 +42,7 @@
             if (projFile != null || nuspecFile != null) {
                 // We say that this is a project if it has either a projfile or a nuspec file.
                 var projName = directory.Name;
-                Program.VerboseOut(Verbose.Scanning, "Found project {0}", projName);
+                Program.VerboseOut(Verbose.Scanning, "Found project {0} at {1}", projName, directory.FullName);

                 var project = new Project {
                     Name    = projName,
@@ -58,7 +59,11 @@
                 foreach (var directoryInfo in directories) {
                     try {
                         ScanDirectory(directoryInfo, projects, currentVersion);
-                    } catch (Exception e) { /* TODO: Remove try/catch and write better handling of file paths longer than 260 characters */ }
+                    }
+                    catch (PathTooLongException e) {
+                         Program.VerboseOut(Verbose.Warning,
+                             "Skipping subdir {0}; path too long", directoryInfo.FullName);
+                    }
                 }
             }
         }


Added yes to possibilities for trade and fixed some shit typing

--- SoraBot-v2/SoraBot-v2/Services/WaifuService.cs
+++ SoraBot-v2/SoraBot-v2/Services/WaifuService.cs
@@ -199,7 +199,7 @@
                 {
                     x.IsInline = false;
                     x.Name = "Accept?";
-                    x.Value = "You can accept this trade by writing `y` and decline by writing anything else.";
+                    x.Value = "You can accept this trade by writing `y` or `yes` and decline by writing anything else.";
                 });

                 await context.Channel.SendMessageAsync("", embed: eb.Build());
@@ -217,7 +217,7 @@
                     return;
                 }

-                if (!response.Content.Equals("y", StringComparison.OrdinalIgnoreCase))
+                if (!StringIsYes(response.Content))
                 {
                     await context.Channel.SendMessageAsync("", embed:
                         Utility.ResultFeedback(Utility.RedFailiureEmbed, Utility.SuccessLevelEmoji[2],
@@ -406,7 +406,7 @@
                         Description = $"You are about to sell {waifu.Name} which is " +
                                       $"a {GetRarityString(waifu.Rarity)}!\n" +
                                       $"If you still want to sell please respond with " +
-                                      $"`yes` or `y`.",
+                                      $"`yes` or `y` and decline by writing anything else.",
                         ThumbnailUrl = waifu.ImageUrl,
                         Footer = Utility.RequestedBy(context.User)
                     };


Make sure old gizmo is removed when a new one is spawned.

--- Source/BetterManeuvering/ManeuverController.cs
+++ Source/BetterManeuvering/ManeuverController.cs
@@ -201,16 +201,16 @@
 								else if (pcr.solver.maneuverNodes.Count > lastManeuverIndex)
 								{
 									if (pcr.solver.maneuverNodes[lastManeuverIndex].attachedGizmo == null)
-									{
-										pcr.SetMouseOverGizmo(true);
+                                    {
+                                        pcr.SetMouseOverGizmo(true);
 										pcr.solver.maneuverNodes[lastManeuverIndex].AttachGizmo(MapView.ManeuverNodePrefab, pcr);
 									}
 								}
 								else
 								{
 									if (pcr.solver.maneuverNodes[0].attachedGizmo == null)
-									{
-										pcr.SetMouseOverGizmo(true);
+                                    {
+                                        pcr.SetMouseOverGizmo(true);
 										pcr.solver.maneuverNodes[0].AttachGizmo(MapView.ManeuverNodePrefab, pcr);
 									}
 								}
@@ -597,13 +597,13 @@
 		}

 		private void gizmoSpawn(ManeuverGizmo gizmo)
-		{
-			if (gizmo == null)
+        {
+            if (gizmo == null)
 				return;

 			if (currentGizmo != null)
-			{
-				if (snapPanel != null)
+            {
+                if (snapPanel != null)
 				{
 					if (snapPanel.Locked)
 					{
@@ -625,7 +625,10 @@
 						Destroy(inputPanel);
 				}

-				snapPanel = null;
+                currentGizmo.Terminate();
+                currentGizmo = null;
+
+                snapPanel = null;
 				inputPanel = null;
 			}

@@ -646,21 +649,21 @@
 				currentNode = node;
 				break;
 			}
-
-			//RectTransform plusRect = currentGizmo.deleteBtn.GetComponent<RectTransform>();
-			//maneuverLog("Delete Button Rect Anchored: {0:F4}\nPosition: {1:F4}\nPivot: {2:F4}\nAnchor Min: {3:F4}\nAnchor Max: {4:F4}\nScale: {5:F4}\nRotation: {6:F4}\nLocal Rotation: {7:F4}\nSize: {8:F4}"
-			//, logLevels.log
-			//, plusRect.anchoredPosition3D
-			//, plusRect.position
-			//, plusRect.pivot
-			//, plusRect.anchorMin
-			//, plusRect.anchorMax
-			//, plusRect.localScale
-			//, plusRect.rotation.eulerAngles
-			//, plusRect.localRotation.eulerAngles
-			//, plusRect.sizeDelta);
-
-			attachGizmoHandlers();
+
+            //RectTransform plusRect = currentGizmo.deleteBtn.GetComponent<RectTransform>();
+            //maneuverLog("Delete Button Rect Anchored: {0:F4}\nPosition: {1:F4}\nPivot: {2:F4}\nAnchor Min: {3:F4}\nAnchor Max: {4:F4}\nScale: {5:F4}\nRotation: {6:F4}\nLocal Rotation: {7:F4}\nSize: {8:F4}"
+            //, logLevels.log
+            //, plusRect.anchoredPosition3D
+            //, plusRect.position
+            //, plusRect.pivot
+            //, plusRect.anchorMin
+            //, plusRect.anchorMax
+            //, plusRect.localScale
+            //, plusRect.rotation.eulerAngles
+            //, plusRect.localRotation.eulerAngles
+            //, plusRect.sizeDelta);
+
+            attachGizmoHandlers();

 			if (settings.showManeuverCycle)
 				attachCycleButtons();


If security exceptions occur when reading the registry, write the exceptions to the activity log.

--- src/VisualStudio/RegistryKeyWrapper.cs
+++ src/VisualStudio/RegistryKeyWrapper.cs
@@ -25,9 +25,10 @@
                     return new RegistryKeyWrapper(key);
                 }
             }
-            catch (SecurityException)
+            catch (SecurityException ex)
             {
                 // If the user doesn't have access to the registry, then we'll return null
+                ExceptionHelper.WriteToActivityLog(ex);
             }

             return null;
@@ -39,9 +40,10 @@
             {
                 return _registryKey.GetValue(name);
             }
-            catch (SecurityException)
+            catch (SecurityException ex)
             {
                 // If the user doesn't have access to the registry, then we'll return null
+                ExceptionHelper.WriteToActivityLog(ex);
                 return null;
             }
         }


Improved handling of default PackageInstallationOptions using null coalescing

--- Source/OpenIIoT.Core/Package/PackageManager.cs
+++ Source/OpenIIoT.Core/Package/PackageManager.cs
@@ -390,11 +390,6 @@
             logger.EnterMethod(xLogger.Params(fqn, options, publicKey));
             logger.Info($"Installing Package '{fqn}'...");

-            if (options == default(PackageInstallationOptions))
-            {
-                options = new PackageInstallationOptions();
-            }
-
             IResult retVal = new Result();
             IPackage findResult = FindPackage(fqn);

@@ -408,8 +403,8 @@
                 string destination = Platform.Directories.Plugins;
                 destination = Path.Combine(destination, findResult.FQN);

-                bool overwrite = options.Overwrite;
-                bool skipVerification = options.SkipVerification;
+                bool overwrite = options?.Overwrite ?? false;
+                bool skipVerification = options?.SkipVerification ?? false;

                 logger.Debug($"Install directory: '{destination}'; overwrite={overwrite}, skipVerification={skipVerification}");


Fix generating resources the wrong way round in the PCL branch.

This fixes issue 161.

--- src/ZoneInfoCompiler/ResourceOutput.cs
+++ src/ZoneInfoCompiler/ResourceOutput.cs
@@ -76,9 +76,9 @@
                 case ResourceOutputType.NodaResource:
                     return new NodaResourceWriter(name);
                 case ResourceOutputType.ResX:
+                    return new ResXResourceWriter(name);
+                case ResourceOutputType.Resource:
                     return new ResourceWriter(name);
-                case ResourceOutputType.Resource:
-                    return new ResXResourceWriter(name);
                 default:
                     throw new ArgumentException("Invalid resource type", "type");
             }


-Tests

-Tests

--- Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs
+++ Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs
@@ -53,6 +53,35 @@
     [TestFixture]
     public class DynamicTests : TestFixtureBase
     {
+        [Test]
+        public void AccessPropertyValue()
+        {
+            string rawJson = @"{
+  ""task"": {
+    ""dueDate"": ""2012-12-03T00:00:00""
+  }
+}";
+
+            dynamic dyn = JsonConvert.DeserializeObject<dynamic>(rawJson);
+            DateTime dueDate = dyn.task.dueDate.Value;
+
+            Assert.AreEqual(new DateTime(2012, 12, 3, 0, 0, 0, DateTimeKind.Unspecified), dueDate);
+        }
+
+        [Test]
+        public void PropertyDoesNotEqualNull()
+        {
+            dynamic session = JsonConvert.DeserializeObject<dynamic>("{}");
+            if (session.sessionInfo != null)
+            {
+                Assert.Fail();
+            }
+            else
+            {
+                Assert.Pass();
+            }
+        }
+
         private void UpdateValueCount(IDictionary<string, int> counts, dynamic d)
         {
             string s = d.ToString();


Make sure the JSON result was decoded successfully.

--- StarbucksScraper/Program.cs
+++ StarbucksScraper/Program.cs
@@ -73,11 +73,11 @@
                         response = client.Execute<StarbucksResults>(request);
                         attempts++;
                     }
-                    while (response != null && response.StatusCode != System.Net.HttpStatusCode.OK && attempts < threshold && response.ErrorMessage != "");
-
-                    if (response == null || response.StatusCode != System.Net.HttpStatusCode.OK)
-                    {
-                        throw new Exception("Response was null or status code was invalid and we're out of retries.");
+                    while (response != null && response.Data != null && response.StatusCode != System.Net.HttpStatusCode.OK && attempts < threshold && response.ErrorMessage != "");
+
+                    if (response == null || response.Data == null || response.StatusCode != System.Net.HttpStatusCode.OK)
+                    {
+                        throw new Exception("Response was null, we couldn't decode the result, or status code was invalid and we're out of retries.");
                     }

                     Console.WriteLine("Got {0} in response.", response.Data.Paging.Returned);


Use `OsuAnimatedButton` as base for `ControlItemClose`

--- osu.Game/Overlays/Chat/ChannelControl/ControlItemClose.cs
+++ osu.Game/Overlays/Chat/ChannelControl/ControlItemClose.cs
@@ -6,56 +6,28 @@
 using osu.Framework.Allocation;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Sprites;
-using osu.Framework.Input.Events;
 using osu.Game.Graphics;
-using osu.Game.Graphics.Containers;
+using osu.Game.Graphics.UserInterface;
 using osuTK;

 namespace osu.Game.Overlays.Chat.ChannelControl
 {
-    public class ControlItemClose : OsuClickableContainer
+    public class ControlItemClose : OsuAnimatedButton
     {
-        private readonly SpriteIcon icon;
-
-        [Resolved]
-        private OsuColour osuColour { get; set; } = null!;
-
-        public ControlItemClose()
+        [BackgroundDependencyLoader]
+        private void load(OsuColour osuColour)
         {
             Alpha = 0f;
             Size = new Vector2(20);
-            Child = icon = new SpriteIcon
+            Add(new SpriteIcon
             {
                 Anchor = Anchor.Centre,
                 Origin = Anchor.Centre,
                 Scale = new Vector2(0.75f),
                 Icon = FontAwesome.Solid.TimesCircle,
                 RelativeSizeAxes = Axes.Both,
-            };
-        }
-
-        protected override bool OnMouseDown(MouseDownEvent e)
-        {
-            icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
-            return base.OnMouseDown(e);
-        }
-
-        protected override void OnMouseUp(MouseUpEvent e)
-        {
-            icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
-            base.OnMouseUp(e);
-        }
-
-        protected override bool OnHover(HoverEvent e)
-        {
-            icon.FadeColour(osuColour.Red1, 200, Easing.OutQuint);
-            return base.OnHover(e);
-        }
-
-        protected override void OnHoverLost(HoverLostEvent e)
-        {
-            icon.FadeColour(Colour4.White, 200, Easing.OutQuint);
-            base.OnHoverLost(e);
+                Colour = osuColour.Red1,
+            });
         }
     }
 }


Show editor file choosers in a popover rather than inline

Supersedes and closes #14370.
Closes #14367.

--- osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs
+++ osu.Game/Screens/Edit/Setup/FileChooserLabelledTextBox.cs
@@ -8,22 +8,27 @@
 using System.Threading.Tasks;
 using osu.Framework.Allocation;
 using osu.Framework.Bindables;
+using osu.Framework.Extensions;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Cursor;
+using osu.Framework.Graphics.UserInterface;
 using osu.Framework.Input.Events;
 using osu.Game.Database;
 using osu.Game.Graphics.Containers;
 using osu.Game.Graphics.UserInterface;
 using osu.Game.Graphics.UserInterfaceV2;
+using osuTK;

 namespace osu.Game.Screens.Edit.Setup
 {
     /// <summary>
     /// A labelled textbox which reveals an inline file chooser when clicked.
     /// </summary>
-    internal class FileChooserLabelledTextBox : LabelledTextBox, ICanAcceptFiles
+    internal class FileChooserLabelledTextBox : LabelledTextBox, ICanAcceptFiles, IHasPopover
     {
         private readonly string[] handledExtensions;
+
         public IEnumerable<string> HandledExtensions => handledExtensions;

         /// <summary>
@@ -51,22 +56,8 @@
                 Origin = Anchor.Centre,
                 RelativeSizeAxes = Axes.X,
                 CornerRadius = CORNER_RADIUS,
-                OnFocused = DisplayFileChooser
+                OnFocused = this.ShowPopover
             };
-
-        public void DisplayFileChooser()
-        {
-            OsuFileSelector fileSelector;
-
-            Target.Child = fileSelector = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions)
-            {
-                RelativeSizeAxes = Axes.X,
-                Height = 400,
-                CurrentFile = { BindTarget = currentFile }
-            };
-
-            sectionsContainer.ScrollTo(fileSelector);
-        }

         protected override void LoadComplete()
         {
@@ -111,5 +102,23 @@
                 GetContainingInputManager().TriggerFocusContention(this);
             }
         }
+
+        public Popover GetPopover() => new FileChooserPopover(handledExtensions, currentFile);
+
+        private class FileChooserPopover : OsuPopover
+        {
+            public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo> currentFile)
+            {
+                Child = new Container
+                {
+                    Size = new Vector2(600, 400),
+                    Child = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions)
+                    {
+                        RelativeSizeAxes = Axes.Both,
+                        CurrentFile = { BindTarget = currentFile }
+                    },
+                };
+            }
+        }
     }
 }


port change from AutobahnTester in SignalR (#148)

We increased the retry count (by just removing ours and using the default) because the app seems to be slow to start on macOS

--- test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs
+++ test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs
@@ -131,7 +131,7 @@
             {
                 cancellationToken.ThrowIfCancellationRequested();
                 return client.GetAsync(result.ApplicationBaseUri);
-            }, logger, CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, result.HostShutdownToken).Token, retryCount: 5);
+            }, logger, CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, result.HostShutdownToken).Token);
             resp.EnsureSuccessStatusCode();

             cancellationToken.ThrowIfCancellationRequested();


Updated Emf renderer

Updated Emf renderer

--- Dependencies/Renderer.WinForms/EmfRenderer.cs
+++ Dependencies/Renderer.WinForms/EmfRenderer.cs
@@ -83,10 +83,10 @@
         /// <param name="style"></param>
         /// <param name="scale"></param>
         /// <returns></returns>
-        private Pen ToPen(ShapeStyle style, Func<double, float> scale)
+        private Pen ToPen(BaseStyle style, Func<double, float> scale)
         {
             var pen = new Pen(ToColor(style.Stroke), (float)(style.Thickness / _state.Zoom));
-            switch (style.LineStyle.LineCap)
+            switch (style.LineCap)
             {
                 case Test2d.LineCap.Flat:
                     pen.StartCap = System.Drawing.Drawing2D.LineCap.Flat;
@@ -104,12 +104,12 @@
                     pen.DashCap = System.Drawing.Drawing2D.DashCap.Round;
                     break;
             }
-            if (style.LineStyle.Dashes != null)
+            if (style.Dashes != null)
             {
                 // TODO: Convert to correct dash values.
-                pen.DashPattern = style.LineStyle.Dashes.Select(x => (float)x).ToArray();
-            }
-            pen.DashOffset = (float)style.LineStyle.DashOffset;
+                pen.DashPattern = style.Dashes.Select(x => (float)x).ToArray();
+            }
+            pen.DashOffset = (float)style.DashOffset;
             return pen;
         }

@@ -301,8 +301,14 @@
         {
             var _gfx = gfx as Graphics;

-            Brush fill = ToSolidBrush(line.Style.Fill);
-            Pen stroke = ToPen(line.Style, _scaleToPage);
+            Brush fillLine = ToSolidBrush(line.Style.Fill);
+            Pen strokeLine = ToPen(line.Style, _scaleToPage);
+
+            Brush fillStartArrow = ToSolidBrush(line.Style.StartArrowStyle.Fill);
+            Pen strokeStartArrow = ToPen(line.Style.StartArrowStyle, _scaleToPage);
+
+            Brush fillEndArrow = ToSolidBrush(line.Style.EndArrowStyle.Fill);
+            Pen strokeEndArrow = ToPen(line.Style.EndArrowStyle, _scaleToPage);

             double _x1 = line.Start.X + dx;
             double _y1 = line.Start.Y + dy;
@@ -316,8 +322,8 @@
             float x2 = _scaleToPage(_x2);
             float y2 = _scaleToPage(_y2);

-            var sas = line.Style.LineStyle.StartArrowStyle;
-            var eas = line.Style.LineStyle.EndArrowStyle;
+            var sas = line.Style.StartArrowStyle;
+            var eas = line.Style.EndArrowStyle;
             float a1 = (float)(Math.Atan2(y1 - y2, x1 - x2) * 180.0 / Math.PI);
             float a2 = (float)(Math.Atan2(y2 - y1, x2 - x1) * 180.0 / Math.PI);

@@ -353,7 +359,7 @@
                         var rect = new Rect2(x1 - sizeX1, y1 - radiusY1, sizeX1, sizeY1);
                         var gs = _gfx.Save();
                         _gfx.MultiplyTransform(t1);
-                        DrawRectangleInternal(_gfx, fill, stroke, sas.IsFilled, ref rect);
+                        DrawRectangleInternal(_gfx, fillStartArrow, strokeStartArrow, sas.IsFilled, ref rect);
                         _gfx.Restore(gs);
                     }
                     break;
@@ -365,7 +371,7 @@
                         var gs = _gfx.Save();
                         _gfx.MultiplyTransform(t1);
                         var rect = new Rect2(x1 - sizeX1, y1 - radiusY1, sizeX1, sizeY1);
-                        DrawEllipseInternal(_gfx, fill, stroke, sas.IsFilled, ref rect);
+                        DrawEllipseInternal(_gfx, fillStartArrow, strokeStartArrow, sas.IsFilled, ref rect);
                         _gfx.Restore(gs);
                     }
                     break;
@@ -385,8 +391,8 @@
                         var p21 = pts[2];
                         var p12 = pts[3];
                         var p22 = pts[4];
-                        DrawLineInternal(_gfx, stroke, ref p11, ref p21);
-                        DrawLineInternal(_gfx, stroke, ref p12, ref p22);
+                        DrawLineInternal(_gfx, strokeStartArrow, ref p11, ref p21);
+                        DrawLineInternal(_gfx, strokeStartArrow, ref p12, ref p22);
                     }
                     break;
             }
@@ -412,7 +418,7 @@
                         var rect = new Rect2(x2 - sizeX2, y2 - radiusY2, sizeX2, sizeY2);
                         var gs = _gfx.Save();
                         _gfx.MultiplyTransform(t2);
-                        DrawRectangleInternal(_gfx, fill, stroke, eas.IsFilled, ref rect);
+                        DrawRectangleInternal(_gfx, fillEndArrow, strokeEndArrow, eas.IsFilled, ref rect);
                         _gfx.Restore(gs);
                     }
                     break;
@@ -424,7 +430,7 @@
                         var gs = _gfx.Save();
                         _gfx.MultiplyTransform(t2);
                         var rect = new Rect2(x2 - sizeX2, y2 - radiusY2, sizeX2, sizeY2);
-                        DrawEllipseInternal(_gfx, fill, stroke, eas.IsFilled, ref rect);
+                        DrawEllipseInternal(_gfx, fillEndArrow, strokeEndArrow, eas.IsFilled, ref rect);
                         _gfx.Restore(gs);
                     }
                     break;
@@ -444,16 +450,22 @@
                         var p21 = pts[2];
                         var p12 = pts[3];
                         var p22 = pts[4];
-                        DrawLineInternal(_gfx, stroke, ref p11, ref p21);
-                        DrawLineInternal(_gfx, stroke, ref p12, ref p22);
-                    }
-                    break;
-            }
-
-            _gfx.DrawLine(stroke, pt1, pt2);
-
-            fill.Dispose();
-            stroke.Dispose();
+                        DrawLineInternal(_gfx, strokeEndArrow, ref p11, ref p21);
+                        DrawLineInternal(_gfx, strokeEndArrow, ref p12, ref p22);
+                    }
+                    break;
+            }
+
+            _gfx.DrawLine(strokeLine, pt1, pt2);
+
+            fillLine.Dispose();
+            strokeLine.Dispose();
+
+            fillStartArrow.Dispose();
+            strokeStartArrow.Dispose();
+
+            fillEndArrow.Dispose();
+            strokeEndArrow.Dispose();
         }

         /// <summary>


Fixed max Y value for final experience graph

--- HeroesParserData/Graphs/MatchSummaryGraphs.cs
+++ HeroesParserData/Graphs/MatchSummaryGraphs.cs
@@ -15,6 +15,7 @@
         private string _graphTeam1Title;
         private bool _isTeamExperiencePieChartVisible;
         private bool _isTeamExperienceRowChartVisible;
+        private double _matchTeamExperienceMaxYValue;

         private SeriesCollection _matchTeamLevelsLineChartCollection;
         private SeriesCollection _matchTeam0ExperienceStackedGraphCollection;
@@ -27,7 +28,6 @@
         public Func<double, string> MatchTeamExperienceFormatter { get; set; }
         public Func<ChartPoint, string> MatchTeamExperiencePiePointLabel { get; set; }
         public string[] ExperienceTypesLabels { get; set; }
-        public double MatchTeamExperienceMaxYValue { get; set; }

         public string GraphTeam0Title
@@ -67,6 +67,16 @@
             {
                 _isTeamExperienceRowChartVisible = value;
                 RaisePropertyChangedEvent(nameof(IsTeamExperienceRowChartVisible));
+            }
+        }
+
+        public double MatchTeamExperienceMaxYValue
+        {
+            get { return _matchTeamExperienceMaxYValue; }
+            set
+            {
+                _matchTeamExperienceMaxYValue = value;
+                RaisePropertyChangedEvent(nameof(MatchTeamExperienceMaxYValue));
             }
         }


Update site extension test to verify status code instead of content.

--- Kudu.FunctionalTests/SiteExtensionApiFacts.cs
+++ Kudu.FunctionalTests/SiteExtensionApiFacts.cs
@@ -634,9 +634,7 @@

                 TestTracer.Trace("GET request to verify package content has been removed wwwroot");
                 responseMessage = await client.GetAsync(appManager.SiteUrl);
-                responseContent = await responseMessage.Content.ReadAsStringAsync();
-                Assert.NotNull(responseContent);
-                Assert.True(responseContent.Contains("Forbidden"));
+                Assert.Equal(HttpStatusCode.Forbidden, responseMessage.StatusCode);
             });
         }

@@ -711,11 +709,10 @@

                 TestTracer.Trace("GET request to verify package content has been removed wwwroot");
                 responseMessage = await client.GetAsync(appManager.SiteUrl);
-                responseContent = await responseMessage.Content.ReadAsStringAsync();
-                Assert.NotNull(responseContent);
-                Assert.True(responseContent.Contains("Forbidden"));
-            });
-        }
+                Assert.Equal(HttpStatusCode.Forbidden, responseMessage.StatusCode);
+            });
+        }
+
         private async Task<HttpResponseMessage> PollAndVerifyAfterArmInstallation(RemoteSiteExtensionManager manager, string packageId)
         {
             TestTracer.Trace("Polling for status for '{0}'", packageId);


Made search work on file system folders (download)

--- Library/Provider/LibraryProviderFileSystem.cs
+++ Library/Provider/LibraryProviderFileSystem.cs
@@ -141,7 +141,7 @@
 				if (keywordFilter != value)
 				{
 					keywordFilter = value;
-					GetFilesAndCollectionsInCurrentDirectory();
+					GetFilesAndCollectionsInCurrentDirectory(keywordFilter.Trim() != "");
 				}
 			}
 		}
@@ -315,45 +315,83 @@
 			});
 		}

-		private void GetFilesAndCollectionsInCurrentDirectory()
-		{
-			currentDirectoryDirectories.Clear();
-			try
-			{
-				string[] directories = Directory.GetDirectories(Path.Combine(rootPath, currentDirectory));
-				foreach (string directoryName in directories)
-				{
-					if (keywordFilter.Trim() == string.Empty
-						|| Path.GetFileNameWithoutExtension(directoryName).Contains(keywordFilter))
+		private async void GetFilesAndCollectionsInCurrentDirectory(bool recursive = false)
+		{
+			List<string> newReadDirectoryDirectories = new List<string>();
+			List<string> newReadDirectoryFiles = new List<string>();
+
+			await Task.Run(() =>
+			{
+				try
+				{
+					string[] directories = null;
+					if (recursive)
+					{
+						directories = Directory.GetDirectories(Path.Combine(rootPath, currentDirectory), "*.*", SearchOption.AllDirectories);
+					}
+					else
+					{
+						directories = Directory.GetDirectories(Path.Combine(rootPath, currentDirectory));
+					}
+					foreach (string directoryName in directories)
 					{
 						string subPath = directoryName.Substring(rootPath.Length + 1);
-						currentDirectoryDirectories.Add(subPath);
-					}
-				}
-			}
-			catch (Exception)
-			{
-			}
-
-			currentDirectoryFiles.Clear();
-			try
-			{
-				string[] files = Directory.GetFiles(Path.Combine(rootPath, currentDirectory));
-				foreach (string filename in files)
-				{
-					if (ApplicationSettings.LibraryFilterFileExtensions.Contains(Path.GetExtension(filename).ToLower()))
-					{
-						if (keywordFilter.Trim() == string.Empty
-							|| Path.GetFileNameWithoutExtension(filename).Contains(keywordFilter))
+						newReadDirectoryDirectories.Add(subPath);
+					}
+				}
+				catch (Exception)
+				{
+				}
+
+				try
+				{
+					string upperFilter = keywordFilter.ToUpper();
+					string[] files = Directory.GetFiles(Path.Combine(rootPath, currentDirectory));
+					foreach (string filename in files)
+					{
+						if (ApplicationSettings.LibraryFilterFileExtensions.Contains(Path.GetExtension(filename).ToLower()))
 						{
-							currentDirectoryFiles.Add(filename);
+							if (upperFilter.Trim() == string.Empty
+								|| Path.GetFileNameWithoutExtension(filename.ToUpper()).Contains(upperFilter))
+							{
+								newReadDirectoryFiles.Add(filename);
+							}
 						}
 					}
-				}
-			}
-			catch (Exception)
-			{
-			}
+					if (recursive)
+					{
+						foreach (string directory in newReadDirectoryDirectories)
+						{
+							string subDirectory = Path.Combine(rootPath, directory);
+							string[] subDirectoryFiles = Directory.GetFiles(Path.Combine(rootPath, currentDirectory));
+							foreach (string filename in subDirectoryFiles)
+							{
+								if (ApplicationSettings.LibraryFilterFileExtensions.Contains(Path.GetExtension(filename).ToLower()))
+								{
+									if (keywordFilter.Trim() == string.Empty
+										|| Path.GetFileNameWithoutExtension(filename.ToUpper()).Contains(upperFilter))
+									{
+										newReadDirectoryFiles.Add(filename);
+									}
+								}
+							}
+						}
+					}
+				}
+				catch (Exception)
+				{
+				}
+			});
+
+			if (recursive)
+			{
+				currentDirectoryDirectories.Clear();
+			}
+			else
+			{
+				currentDirectoryDirectories = newReadDirectoryDirectories;
+			}
+			currentDirectoryFiles = newReadDirectoryFiles;

 			OnDataReloaded(null);
 		}


Updates to help screen off dependencies on MongoDB nuget packages

--- MongoRepository/Repository/MongoRepository.cs
+++ MongoRepository/Repository/MongoRepository.cs
@@ -9,6 +9,7 @@
 using MongoDB.Bson;
 using MongoDB.Bson.Serialization;
 using MongoDB.Bson.Serialization.Options;
+using MongoDB.Bson.Serialization.Serializers;
 using MongoDB.Driver;

 // ReSharper disable once CheckNamespace
@@ -24,6 +25,12 @@
         where TEntity : IEntity<TKey>
         where TKey : IEquatable<TKey>
     {
+        static MongoRepository()
+        {
+            // DeSerialize DateTime as local format (not utc) - the Json representation will still be ISODate
+            BsonSerializer.RegisterSerializer(typeof(DateTime), DateTimeSerializer.LocalInstance);
+        }
+
         /// <summary>
         /// Initializes a new instance of the MongoRepository class.
         /// Uses the Default App/Web.Config connectionstrings to fetch the connectionString and Database name.
@@ -100,7 +107,38 @@
                                                         CancellationToken cancellationToken = default(CancellationToken))
         {
             var filter = Builders<TEntity>.Filter.Eq(f => f.Id, id);
-            return await Collection.Find(filter).FirstOrDefaultAsync(cancellationToken: cancellationToken);
+            return await Collection.Find(filter).FirstOrDefaultAsync(cancellationToken);
+        }
+
+        /// <summary>
+        /// Returns the entity by an expression
+        /// </summary>
+        /// <param name="field">Expression </param>
+        /// <param name="value"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns>The entity.</returns>
+        public virtual async Task<TEntity> GetByExpressionAsync<TField>(Expression<Func<TEntity, TField>> field,
+                                                                        TField value,
+                                                                      //  expressionco
+                                                                        CancellationToken cancellationToken =
+                                                                            default(CancellationToken))
+        {
+            var filter = Builders<TEntity>.Filter.Eq(field, value);
+            return await Collection.Find(filter).FirstOrDefaultAsync(cancellationToken);
+        }
+
+        public virtual async Task<TEntity> GetByExpressionAsync<TField1, TField2>(
+            Expression<Func<TEntity, TField1>> field1,
+            TField1 value1,
+            Expression<Func<TEntity, TField2>> field2,
+            TField2 value2,
+            //  expressionco
+            CancellationToken cancellationToken =
+                default(CancellationToken))
+        {
+            var filter = Builders<TEntity>.Filter.And(Builders<TEntity>.Filter.Eq(field1, value1),
+                                                      Builders<TEntity>.Filter.Eq(field2, value2));
+            return await Collection.Find(filter).FirstOrDefaultAsync(cancellationToken);
         }

         /// <summary>
@@ -252,9 +290,7 @@
         public virtual async Task<bool> ExistsAsync(Expression<Func<TEntity, bool>> predicate,
                                                     CancellationToken cancellationToken = default(CancellationToken))
         {
-            //var filter = Builders<TEntity>.Filter.Where(predicate);
-            var test = await Collection.Find(predicate).Limit(1).ToListAsync();
-            return test.Any();
+            return await Collection.Find(predicate).AnyAsync(cancellationToken);
         }

         #region IQueryable<T>
@@ -370,6 +406,19 @@

     public static class MongoRepository
     {
+        public static void IgnorePropertiesInBson<TType>(
+           params string[] propertyNames)
+        {
+            BsonClassMap.RegisterClassMap<TType>(cm =>
+            {
+                cm.AutoMap();
+                foreach (string name in propertyNames)
+                {
+                    cm.UnmapProperty(name);
+                }
+            });
+        }
+
         public static BsonMemberMap SetDictionarySerializer(this BsonMemberMap memberMap,
                                                             DictionaryRepresentation representation)
         {


切换导航改为显示导航

切换导航改为显示导航

--- MyBootstrapSchool/Views/Shared/_Layout.cshtml
+++ MyBootstrapSchool/Views/Shared/_Layout.cshtml
@@ -58,7 +58,7 @@

-                    <button data-toggle="offcanvas" class="btn btn-primary btn-xs" type="button">切换导航</button>
+                    <button data-toggle="offcanvas" class="btn btn-primary btn-xs" type="button">显示导航</button>

                 @RenderBody()


i'm dropping VerifyGod() and adding IsGod(OSHttpRequest) instead, which actually now
takes a look at the HTTP request header and retrieves x-opensim-godkey (if it exists)
and compares that against the godkey from OpenSim.ini.

also, this makes AddStreamHandler() virtual so that it can be overridden.

--- OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -211,6 +211,7 @@

                 // Retrieve GOD key value, if any.
                 _godkey = _config.GetString("god_key", String.Empty);
+
                 // Retrive prefix if any.
                 _prefix = _config.GetString("prefix", "/admin");

@@ -242,7 +243,7 @@

         private List<RestStreamHandler> _handlers = new List<RestStreamHandler>();

-        public void AddRestStreamHandler(string httpMethod, string path, RestMethod method)
+        public virtual void AddRestStreamHandler(string httpMethod, string path, RestMethod method)
         {
             if (!IsEnabled) return;

@@ -258,13 +259,18 @@
             m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path);
         }

-
-        protected bool VerifyGod(string key)
-        {
-            if (String.IsNullOrEmpty(key)) return false;
+        public bool AddAgentHandler(string agentname, IHttpAgentHandler handler)
+        {
             if (!IsEnabled) return false;
-
-            return key == _godkey;
+            return _httpd.AddAgentHandler(agentname, handler);
+        }
+
+        protected bool IsGod(OSHttpRequest request)
+        {
+            string[] keys = request.Headers.GetValues("x-opensim-godkey");
+            if (null == keys) return false;
+            // we take the last key supplied
+            return keys[keys.Length-1] == _godkey;
         }

         public virtual void Close()


scale down position X and Y acording to region size on sending coarse Updates. Viewers need to scale up by same amount.

--- OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -242,6 +242,19 @@
             coarseLocations = new List<Vector3>();
             avatarUUIDs = new List<UUID>();

+            // coarse locations are sent as BYTE, so limited to the 255m max of normal regions
+            // try to work around that scale down X and Y acording to region size, so reducing the resolution
+            //
+            // viewers need to scale up
+            float scaleX = m_parentScene.RegionInfo.RegionSizeX / Constants.RegionSize;
+            if (scaleX == 0)
+                scaleX = 1.0f;
+            scaleX = 1.0f / scaleX;
+            float scaleY = m_parentScene.RegionInfo.RegionSizeY / Constants.RegionSize;
+            if (scaleY == 0)
+                    scaleY = 1.0f;
+            scaleY = 1.0f / scaleY;
+
             List<ScenePresence> presences = GetScenePresences();
             for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i)
             {
@@ -250,9 +263,11 @@
                 // If this presence is a child agent, we don't want its coarse locations
                 if (sp.IsChildAgent)
                     continue;
-
-                coarseLocations.Add(sp.AbsolutePosition);
-
+                Vector3 pos = sp.AbsolutePosition;
+                pos.X *= scaleX;
+                pos.Y *= scaleY;
+
+                coarseLocations.Add(pos);
                 avatarUUIDs.Add(sp.UUID);
             }
         }


Make mania use the new nested hitobject structure

--- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
+++ osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs
@@ -2,13 +2,12 @@
 // See the LICENCE file in the repository root for full licence text.

 using System.Diagnostics;
-using System.Linq;
 using osu.Framework.Bindables;
-using osu.Framework.Extensions.IEnumerableExtensions;
 using osu.Framework.Graphics;
 using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
 using osu.Framework.Graphics.Containers;
 using osu.Framework.Input.Bindings;
+using osu.Game.Rulesets.Objects;
 using osu.Game.Rulesets.Objects.Drawables;
 using osu.Game.Rulesets.Scoring;
 using osu.Game.Rulesets.UI.Scrolling;
@@ -22,8 +21,12 @@
     {
         public override bool DisplayResult => false;

-        public readonly DrawableNote Head;
-        public readonly DrawableNote Tail;
+        private readonly Container<DrawableHeadNote> headContainer;
+        private readonly Container<DrawableTailNote> tailContainer;
+        private readonly Container<DrawableHoldNoteTick> tickContainer;
+
+        public DrawableNote Head { get; private set; }
+        public DrawableNote Tail { get; private set; }

         private readonly BodyPiece bodyPiece;

@@ -40,48 +43,79 @@
         public DrawableHoldNote(HoldNote hitObject)
             : base(hitObject)
         {
-            Container<DrawableHoldNoteTick> tickContainer;
             RelativeSizeAxes = Axes.X;

             AddRangeInternal(new Drawable[]
             {
-                bodyPiece = new BodyPiece
-                {
-                    RelativeSizeAxes = Axes.X,
-                },
-                tickContainer = new Container<DrawableHoldNoteTick>
-                {
-                    RelativeSizeAxes = Axes.Both,
-                    ChildrenEnumerable = HitObject.NestedHitObjects.OfType<HoldNoteTick>().Select(tick => new DrawableHoldNoteTick(tick)
+                bodyPiece = new BodyPiece { RelativeSizeAxes = Axes.X },
+                tickContainer = new Container<DrawableHoldNoteTick> { RelativeSizeAxes = Axes.Both },
+                headContainer = new Container<DrawableHeadNote> { RelativeSizeAxes = Axes.Both },
+                tailContainer = new Container<DrawableTailNote> { RelativeSizeAxes = Axes.Both },
+            });
+
+            AccentColour.BindValueChanged(colour =>
+            {
+                bodyPiece.AccentColour = colour.NewValue;
+            }, true);
+        }
+
+        protected override void AddNested(DrawableHitObject h)
+        {
+            base.AddNested(h);
+
+            switch (h)
+            {
+                case DrawableHeadNote head:
+                    headContainer.Child = head;
+                    break;
+
+                case DrawableTailNote tail:
+                    tailContainer.Child = tail;
+                    break;
+
+                case DrawableHoldNoteTick tick:
+                    tickContainer.Add(tick);
+                    break;
+            }
+        }
+
+        protected override void ClearNested()
+        {
+            base.ClearNested();
+            headContainer.Clear();
+            tailContainer.Clear();
+            tickContainer.Clear();
+        }
+
+        protected override DrawableHitObject CreateNested(HitObject hitObject)
+        {
+            switch (hitObject)
+            {
+                case TailNote _:
+                    return Tail = new DrawableTailNote(this)
                     {
-                        HoldStartTime = () => holdStartTime
-                    })
-                },
-                Head = new DrawableHeadNote(this)
-                {
-                    Anchor = Anchor.TopCentre,
-                    Origin = Anchor.TopCentre
-                },
-                Tail = new DrawableTailNote(this)
-                {
-                    Anchor = Anchor.TopCentre,
-                    Origin = Anchor.TopCentre
-                }
-            });
-
-            foreach (var tick in tickContainer)
-                AddNested(tick);
-
-            AddNested(Head);
-            AddNested(Tail);
-
-            AccentColour.BindValueChanged(colour =>
-            {
-                bodyPiece.AccentColour = colour.NewValue;
-                Head.AccentColour.Value = colour.NewValue;
-                Tail.AccentColour.Value = colour.NewValue;
-                tickContainer.ForEach(t => t.AccentColour.Value = colour.NewValue);
-            }, true);
+                        Anchor = Anchor.TopCentre,
+                        Origin = Anchor.TopCentre,
+                        AccentColour = { BindTarget = AccentColour }
+                    };
+
+                case Note _:
+                    return Head = new DrawableHeadNote(this)
+                    {
+                        Anchor = Anchor.TopCentre,
+                        Origin = Anchor.TopCentre,
+                        AccentColour = { BindTarget = AccentColour }
+                    };
+
+                case HoldNoteTick tick:
+                    return new DrawableHoldNoteTick(tick)
+                    {
+                        HoldStartTime = () => holdStartTime,
+                        AccentColour = { BindTarget = AccentColour }
+                    };
+            }
+
+            return base.CreateNested(hitObject);
         }

         protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)


Throw exception if no messaging scenario factory is set

The messaging scenario factory must be set, either via config, or by
calling MessagingScenarioFactory.SetCurrent. Failure to do so causes an
exception. The previous behavior was to fall back to the named pipe
messaging scenario factory.

--- Rock.Messaging/MQ/MessagingScenarioFactory.cs
+++ Rock.Messaging/MQ/MessagingScenarioFactory.cs
@@ -1,6 +1,5 @@
 using System;
 using Rock.Immutable;
-using Rock.Messaging.NamedPipes;
 using System.Configuration;

 namespace Rock.Messaging
@@ -13,8 +12,7 @@
         private static readonly Semimutable<IMessagingScenarioFactory> _messagingScenarioFactory =
             new Semimutable<IMessagingScenarioFactory>(CreateDefaultMessagingScenarioFactory);

-        private static IMessagingScenarioFactory _fallbackMessagingScenarioFactory =
-            new NamedPipeMessagingScenarioFactory();
+        private static IMessagingScenarioFactory _fallbackMessagingScenarioFactory;

         public static IMessagingScenarioFactory Current
         {
@@ -44,12 +42,17 @@
                 return
                     TryGetFactoryFromConfig(out value)
                         ? value
-                        : _fallbackMessagingScenarioFactory;
+                        : _fallbackMessagingScenarioFactory ?? ThrowNoMessagingScenarioFactoryFoundException();
             }
             finally
             {
                 _fallbackMessagingScenarioFactory = null;
             }
+        }
+
+        private static IMessagingScenarioFactory ThrowNoMessagingScenarioFactoryFoundException()
+        {
+            throw new InvalidOperationException("MessagingScenarioFactory.Current has no value. The value can be set via config or by calling the SetCurrent method.");
         }

         private static bool TryGetFactoryFromConfig(out IMessagingScenarioFactory factory)


Use HostConstants in the extensions.

Use HostConstants in the extensions.

--- SignalR/Abstractions/HostContextExtensions.cs
+++ SignalR/Abstractions/HostContextExtensions.cs
@@ -14,12 +14,12 @@

         public static bool IsDebuggingEnabled(this HostContext context)
         {
-            return context.GetValue<bool>("debugMode");
+            return context.GetValue<bool>(HostConstants.DebugMode);
         }

         public static bool SupportsWebSockets(this HostContext context)
         {
-            return context.GetValue<bool>("supportsWebSockets");
+            return context.GetValue<bool>(HostConstants.SupportsWebSockets);
         }
     }
 }


fix Name and FullName

fix Name and FullName

--- Signum.Entities.Extensions/Tree/TreeEntity.cs
+++ Signum.Entities.Extensions/Tree/TreeEntity.cs
@@ -40,12 +40,12 @@
         [Ignore]
         public bool IsSibling { get; set; }

-        [SqlDbType(Size = 100)]
-        [StringLengthValidator(AllowNulls = false, Min = 1, Max = 100)]
+        [SqlDbType(Size = 255)]
+        [StringLengthValidator(AllowNulls = false, Min = 1, Max = 255)]
         public string Name { get; set; }

         [NotNullable, SqlDbType(Size = 1000)]
-        [StringLengthValidator(AllowNulls = true, Min = 3, Max = 1000)] //Set by BL
+        [StringLengthValidator(AllowNulls = true, Min = 1, Max = 1000)] //Set by BL
         public string FullName { get; private set; }

         public void SetFullName(string newFullName)
@@ -60,7 +60,6 @@
             return ToStringExpression.Evaluate(this);
         }
     }
-

     [AutoInit]
     public static class TreeOperation


Fix error in build

Fix error in build

--HG--
extra : convert_revision : charlie%40nunit.org-20110515002026-hioqed70q23ja8wn

--- src/direct-runner/TestEventListener.cs
+++ src/direct-runner/TestEventListener.cs
@@ -25,7 +25,7 @@
 using System.IO;
 using NUnit.Framework.Api;

-namespace NUnit.AdhocTestRunner
+namespace NUnit.DirectRunner
 {
     class TestEventListener : MarshalByRefObject, ITestListener
     {


We had an exception bug (serious one), due to me reintroducing SystemExceptionOccurred lately. Fixed now.

--- source/Cosmos.Assembler/Assembler.cs
+++ source/Cosmos.Assembler/Assembler.cs
@@ -176,7 +176,6 @@
     // Allows to emit footers to the code and datamember sections
     protected virtual void OnBeforeFlush() {
       DataMembers.AddRange(new DataMember[] { new DataMember("_end_data", new byte[0]) });
-      new Label("_end_code");
     }

     private uint mDataMemberCounter = 0;
@@ -255,6 +254,8 @@
       aOutput.WriteLine("SystemExceptionOccurred:");
       aOutput.WriteLine("\tret");
       aOutput.WriteLine("global Kernel_Start");
+      aOutput.WriteLine("_end_code:");
+
       aOutput.Flush();
     }


Setting TargetGroupConditions because Conditions are deprecated

--- source/DD4T.Factories/PageFactory.cs
+++ source/DD4T.Factories/PageFactory.cs
@@ -374,7 +374,7 @@
                         {
                             cp.ComponentTemplate = dcp.ComponentTemplate;
                         }
-                        cp.Conditions = dcp.Conditions;
+                        cp.TargetGroupConditions = dcp.TargetGroupConditions;
                     }
                     catch (ComponentPresentationNotFoundException)
                     {


Minor cleanup.

Minor cleanup.

--- source/MongoDB/DatabaseJavascript.cs
+++ source/MongoDB/DatabaseJavascript.cs
@@ -91,12 +91,12 @@
         /// </exception>
         public void CopyTo(Document[] array, int arrayIndex)
         {
-            var query = new Document().Add("$orderby", new Document().Add("_id", 1));
-            var idx = arrayIndex;
-            foreach(var doc in _collection.Find(query, array.Length - 1, arrayIndex).Documents)
+            var query = new Document("$orderby", new Document("_id", 1));
+            var index = arrayIndex;
+            foreach(var document in _collection.Find(query, array.Length - 1, arrayIndex).Documents)
             {
-                array[idx] = doc;
-                idx++;
+                array[index] = document;
+                index++;
             }
         }


Update Version

Update Version

--- source/RedArmory/AssemblyProperty.cs
+++ source/RedArmory/AssemblyProperty.cs
@@ -26,12 +26,12 @@
         /// <summary>
         /// アセンブリ マニフェストに含める、ファイル バージョンを定義します。
         /// </summary>
-        public const string FileVersion = "1.8.0.1";
+        public const string FileVersion = "1.8.0.2";

         /// <summary>
         /// アセンブリ マニフェストに含める、アセンブリ バージョンを定義します。
         /// </summary>
-        public const string Version = "1.8.0.1";
+        public const string Version = "1.8.0.2";

     }


Banco do Brasil - Registro R - Envio de % de Multa (boleto.PercMulta)

--- src/Boleto.Net/Banco/Banco_Brasil.cs
+++ src/Boleto.Net/Banco/Banco_Brasil.cs
@@ -1667,20 +1667,24 @@
                 {
                     // Código da multa 2 - percentual
                     _segmentoR += "2";
-                }
-                else if (boleto.ValorMulta > 0)
+                    _segmentoR += Utils.FitStringLength(boleto.DataMulta.ToString("ddMMyyyy"), 8, 8, '0', 0, true, true, false);
+                    _segmentoR += Utils.FitStringLength(boleto.PercMulta.ToString("0.00").Replace(",", ""), 15, 15, '0', 0, true, true, true);
+
+                } else if (boleto.ValorMulta > 0)
                 {
                     // Código da multa 1 - valor fixo
                     _segmentoR += "1";
-                }
-                else
+                    _segmentoR += Utils.FitStringLength(boleto.DataMulta.ToString("ddMMyyyy"), 8, 8, '0', 0, true, true, false);
+                    _segmentoR += Utils.FitStringLength(boleto.ValorMulta.ToString("0.00").Replace(",", ""), 15, 15, '0', 0, true, true, true);
+
+                } else
                 {
                     // Código da multa 0 - sem multa
                     _segmentoR += "0";
-                }
-
-                _segmentoR += Utils.FitStringLength(boleto.DataMulta.ToString("ddMMyyyy"), 8, 8, '0', 0, true, true, false);
-                _segmentoR += Utils.FitStringLength(boleto.ValorMulta.ToString("0.00").Replace(",", ""), 15, 15, '0', 0, true, true, true);
+                    _segmentoR += Utils.FitStringLength(boleto.DataMulta.ToString("ddMMyyyy"), 8, 8, '0', 0, true, true, false);
+                    _segmentoR += Utils.FitStringLength(boleto.ValorMulta.ToString("0.00").Replace(",", ""), 15, 15, '0', 0, true, true, true);
+                }
+
                 _segmentoR += _brancos110;
                 _segmentoR += "0000000000000000"; //16 zeros
                 _segmentoR += " "; //1 branco


Formatting

Formatting

--- src/Cake.AWS.S3/Manager/S3Manager.cs
+++ src/Cake.AWS.S3/Manager/S3Manager.cs
@@ -114,12 +114,14 @@
                     throw new ArgumentNullException("settings.SecretKey");
                 }

-                if(!String.IsNullOrEmpty(settings.SessionToken))
+                if (!String.IsNullOrEmpty(settings.SessionToken))
                 {
                     return new AmazonS3Client(settings.AccessKey, settings.SecretKey, settings.SessionToken, settings.Region);
                 }
-
-                return new AmazonS3Client(settings.AccessKey, settings.SecretKey, settings.Region);
+                else
+                {
+                    return new AmazonS3Client(settings.AccessKey, settings.SecretKey, settings.Region);
+                }
             }
             else
             {


Added offset to VoiceBuffer

Added offset to VoiceBuffer

--- src/Discord.Net.Audio/VoiceBuffer.cs
+++ src/Discord.Net.Audio/VoiceBuffer.cs
@@ -32,18 +32,18 @@
             _lock = new AsyncLock();
         }

-		public void Push(byte[] buffer, int bytes, CancellationToken cancelToken)
+		public void Push(byte[] buffer, int offset, int count, CancellationToken cancelToken)
 		{
 			if (cancelToken.IsCancellationRequested)
 				throw new OperationCanceledException("Client is disconnected.", cancelToken);

-            int wholeFrames = bytes / _frameSize;
+            int wholeFrames = count / _frameSize;
 			int expectedBytes = wholeFrames * _frameSize;
-			int lastFrameSize = bytes - expectedBytes;
+			int lastFrameSize = count - expectedBytes;

             using (_lock.Lock())
             {
-				for (int i = 0, pos = 0; i <= wholeFrames; i++, pos += _frameSize)
+				for (int i = 0, pos = offset; i <= wholeFrames; i++, pos += _frameSize)
 				{
 					//If the read cursor is in the next position, wait for it to move.
 					ushort nextPosition = _writeCursor;


Forms: CCGameView.iOS: Delay firing of load game event until entire platform initialised

* In particular, what to ensure viewport is correctly setup

--- src/EmbeddableView/CCGameView.iOS.cs
+++ src/EmbeddableView/CCGameView.iOS.cs
@@ -94,6 +94,7 @@
             LayerRetainsBacking = true;
             LayerColorFormat = EAGLColorFormat.RGBA8;
             ContextRenderingApi = EAGLRenderingAPI.OpenGLES2;
+
             CreateFrameBuffer();
         }

@@ -197,6 +198,9 @@
             GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, depthbuffer);
             GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferInternalFormat.DepthComponent16, newSize.Width, newSize.Height);
             GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferSlot.DepthAttachment, RenderbufferTarget.Renderbuffer, depthbuffer);
+
+            platformInitialised = true;
+            LoadGame();
         }

         #endregion Initialisation


Update feed uri, blog platform transition

--- src/Firehose.Web/Authors/JoshKing.cs
+++ src/Firehose.Web/Authors/JoshKing.cs
@@ -7,7 +7,7 @@

 namespace Firehose.Web.Authors
 {
-    public class JoshKing : IAmACommunityMember, IFilterMyBlogPosts
+    public class JoshKing : IAmACommunityMember
     {
         public string FirstName => "Josh";
         public string LastName => "King";
@@ -20,11 +20,6 @@
         public GeoPosition Position => new GeoPosition(-39.4928, 176.9120);

         public Uri WebSite => new Uri("https://king.geek.nz/");
-        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://king.geek.nz/feed.xml"); } }
-
-        public bool Filter(SyndicationItem item)
-        {
-            return item.Categories.Where(i => i.Name.Equals("powershell", StringComparison.OrdinalIgnoreCase)).Any();
-        }
+        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://king.geek.nz/tag/powershell/rss/"); } }
     }
 }


Make GitClient.ExtractFile always create a temp file.

GitService is not the place for the logic of opening the current file if
it's unchanged, and the logic was wrong anyway.

--- src/GitHub.App/Services/GitClient.cs
+++ src/GitHub.App/Services/GitClient.cs
@@ -137,36 +137,29 @@

         public async Task<string> ExtractFile(IRepository repository, string commitSha, string fileName)
         {
-            if (repository.Head.Tip.Sha == commitSha && repository.RetrieveStatus()[fileName].State == FileStatus.Unaltered)
+            var commit = repository.Lookup<Commit>(commitSha);
+            var blob = commit[fileName]?.Target as Blob;
+
+            var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+            var tempFileName = $"{Path.GetFileNameWithoutExtension(fileName)}@{commitSha}{Path.GetExtension(fileName)}";
+            var tempFile = Path.Combine(tempDir, tempFileName);
+
+            Directory.CreateDirectory(tempDir);
+
+            if (blob != null)
             {
-                return Path.Combine(repository.Info.Path, fileName);
+                using (var source = blob.GetContentStream(new FilteringOptions(fileName)))
+                using (var destination = File.OpenWrite(tempFile))
+                {
+                    await source.CopyToAsync(destination);
+                }
             }
             else
             {
-                var commit = repository.Lookup<Commit>(commitSha);
-                var blob = commit[fileName]?.Target as Blob;
+                File.Create(tempFile).Dispose();
+            }

-                var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
-                var tempFileName = $"{Path.GetFileNameWithoutExtension(fileName)}@{commitSha}{Path.GetExtension(fileName)}";
-                var tempFile = Path.Combine(tempDir, tempFileName);
-
-                Directory.CreateDirectory(tempDir);
-
-                if (blob != null)
-                {
-                    using (var source = blob.GetContentStream(new FilteringOptions(fileName)))
-                    using (var destination = File.OpenWrite(tempFile))
-                    {
-                        await source.CopyToAsync(destination);
-                    }
-                }
-                else
-                {
-                    File.Create(tempFile).Dispose();
-                }
-
-                return tempFile;
-            }
+            return tempFile;
         }

         static bool IsCanonical(string s)


aarggh god damn you, VS

aarggh god damn you, VS

--- src/Kerbalism/Database/VesselData.cs
+++ src/Kerbalism/Database/VesselData.cs
@@ -495,6 +495,8 @@
 			{
 				scansat_id.Add(Lib.Parse.ToUInt(s));
 			}
+
+			if (node.HasNode("ScienceLog")) ScienceLog.Load(node.GetNode("ScienceLog"));
 		}

 		public void Save(ConfigNode node)
@@ -525,6 +527,8 @@
 			{
 				node.AddValue("scansat_id", id.ToString());
 			}
+
+			ScienceLog.Save(node.AddNode("ScienceLog"));
 		}

 		#endregion