Finished Serializing Dimension Types

Finished Serializing Dimension Types

--- Synthetic.Revit.JSON/SerializeJSON.cs
+++ Synthetic.Revit.JSON/SerializeJSON.cs
@@ -336,7 +336,7 @@
             Type elemClass = assembly.GetType(serialElementType.Class);
             SerialDimensionType serialDimType = (SerialDimensionType)serialElementType;

-            if (elemClass == typeof(RevitDB.DimensionType))
+            if (elemClass == typeof(RevitDB.DimensionType)  || elemClass == typeof(RevitDB.SpotDimensionType))
             {
                 elem = SerialDimensionType.CreateDimensionType(serialDimType, document);
             }


Fix bitmap serialization with indexed format bitmaps

--- TAUtil.Gdi/Bitmap/BitmapSerializer.cs
+++ TAUtil.Gdi/Bitmap/BitmapSerializer.cs
@@ -34,7 +34,7 @@
         public void Serialize(Stream output, Bitmap bitmap)
         {
             Rectangle r = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
-            BitmapData data = bitmap.LockBits(r, ImageLockMode.ReadOnly, bitmap.PixelFormat);
+            BitmapData data = bitmap.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

             int length = bitmap.Width * bitmap.Height;


Delete TransformationRule.cs

Delete TransformationRule.cs

--- Tangent.Parsing/TransformationRule.cs
+++ Tangent.Parsing/TransformationRule.cs
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tangent.Intermediate;
-
-namespace Tangent.Parsing
-{
-    public abstract class TransformationRule
-    {
-        public abstract TransformationResult TryReduce(List<Expression> buffer);
-    }
-}


extract AdjustExtensionArgs

extract AdjustExtensionArgs

--- src/Boo.Lang/Runtime/DynamicDispatching/AbstractDispatcherFactory.cs
+++ src/Boo.Lang/Runtime/DynamicDispatching/AbstractDispatcherFactory.cs
@@ -55,10 +55,17 @@
 		}

 		protected object[] GetExtensionArgs()
-		{
-			object[] extensionArgs = new object[_arguments.Length + 1];
-			extensionArgs[0] = _target;
-			Array.Copy(_arguments, 0, extensionArgs, 1, _arguments.Length);
+		{
+			return AdjustExtensionArgs(_target, _arguments);
+		}
+
+		private static object[] AdjustExtensionArgs(object target, object[] originalArguments)
+		{
+			if (originalArguments == null)
+				return new object[] { target };
+			var extensionArgs = new object[originalArguments.Length + 1];
+			extensionArgs[0] = target;
+			Array.Copy(originalArguments, 0, extensionArgs, 1, originalArguments.Length);
 			return extensionArgs;
 		}

@@ -75,7 +82,7 @@
 		protected Dispatcher EmitExtensionDispatcher(CandidateMethod found)
 		{
 #if NO_SYSTEM_REFLECTION_EMIT
-			throw new NotImplementedException();
+			return (target, args) => found.DynamicInvoke(null, AdjustExtensionArgs(target, args));
 #else
 			return new Emitters.ExtensionMethodDispatcherEmitter(found, GetArgumentTypes()).Emit();
 #endif


csi: Add response file directory to the search paths

--- src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs
+++ src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs
@@ -47,7 +47,8 @@
             List<Diagnostic> diagnostics = new List<Diagnostic>();
             List<string> flattenedArgs = new List<string>();
             List<string> scriptArgs = IsScriptRunner ? new List<string>() : null;
-            FlattenArgs(args, diagnostics, flattenedArgs, scriptArgs, baseDirectory);
+            List<string> responsePaths = IsScriptRunner ? new List<string>() : null;
+            FlattenArgs(args, diagnostics, flattenedArgs, scriptArgs, baseDirectory, responsePaths);

             string appConfigPath = null;
             bool displayLogo = true;
@@ -1165,7 +1166,7 @@
                 ParseAndResolveReferencePaths(null, additionalReferenceDirectories, baseDirectory, libPaths, MessageID.IDS_LIB_ENV, diagnostics);
             }

-            ImmutableArray<string> referencePaths = BuildSearchPaths(sdkDirectory, libPaths);
+            ImmutableArray<string> referencePaths = BuildSearchPaths(sdkDirectory, libPaths, responsePaths);

             ValidateWin32Settings(win32ResourceFile, win32IconFile, win32ManifestFile, outputKind, diagnostics);

@@ -1438,7 +1439,7 @@
             }
         }

-        private static ImmutableArray<string> BuildSearchPaths(string sdkDirectoryOpt, List<string> libPaths)
+        private ImmutableArray<string> BuildSearchPaths(string sdkDirectoryOpt, List<string> libPaths, List<string> responsePathsOpt)
         {
             var builder = ArrayBuilder<string>.GetInstance();

@@ -1455,6 +1456,14 @@

             // libpath
             builder.AddRange(libPaths);
+
+            // csi adds paths of the response file(s) to the search paths, so that we can initialize the script environment
+            // with references relative to csi.exe (e.g. System.ValueTuple.dll).
+            if (responsePathsOpt != null)
+            {
+                Debug.Assert(IsScriptRunner);
+                builder.AddRange(responsePathsOpt);
+            }

             return builder.ToImmutableAndFree();
         }


An exception is thrown when subscription ID resolver fails. Consumers can expliciltly specify to silently continue.

--- src/Elders.Cronus.DomainModeling/Projections/ProjectionDefinition.cs
+++ src/Elders.Cronus.DomainModeling/Projections/ProjectionDefinition.cs
@@ -21,6 +21,11 @@
         where TState : new()
         where TId : IBlobId
     {
+        /// <summary>
+        /// Signals the engine to skip this event without raising an error.
+        /// </summary>
+        public static IBlobId Skip => new ContinueId();
+
         private readonly Dictionary<Type, List<Func<IEvent, IBlobId>>> subscriptionResolvers;

         public ProjectionDefinition()
@@ -42,7 +47,8 @@
             foreach (var subscriptionResolver in subscriptionResolvers[@event.GetType()])
             {
                 IBlobId resolvedId = subscriptionResolver(@event);
-                if (resolvedId is null) continue;
+                if (resolvedId is null || resolvedId is ContinueId)
+                    continue;

                 yield return resolvedId;
             }
@@ -68,57 +74,75 @@
             ((IHaveState)this).State = state ?? new TState();
         }

-        protected ProjectionDefinition<TState, TId> Subscribe<TEvent>(Func<TEvent, IBlobId> projectionId)
+        /// <summary>
+        ///
+        /// </summary>
+        /// <typeparam name="TEvent"></typeparam>
+        /// <param name="projectionId"></param>
+        /// <param name="fallback">The fallback function in case the projectionId function fails.</param>
+        /// <returns></returns>
+        protected ProjectionDefinition<TState, TId> Subscribe<TEvent>(Func<TEvent, IBlobId> projectionId, Func<TEvent, IBlobId> fallback = null)
             where TEvent : IEvent
         {
             Type eventType = typeof(TEvent);

             if (subscriptionResolvers.ContainsKey(eventType))
-                subscriptionResolvers[eventType].Add(Safe(projectionId));
+                subscriptionResolvers[eventType].Add(Safe(projectionId, fallback));
             else
-                subscriptionResolvers.Add(typeof(TEvent), new List<Func<IEvent, IBlobId>>() { Safe(projectionId) });
+                subscriptionResolvers.Add(typeof(TEvent), new List<Func<IEvent, IBlobId>>() { Safe(projectionId, fallback) });

             return this;

-            static Func<IEvent, IBlobId> Safe(Func<TEvent, IBlobId> projectionId)
+            static Func<IEvent, IBlobId> Safe(Func<TEvent, IBlobId> projectionId, Func<TEvent, IBlobId> fallback)
             {
                 return x =>
                 {
                     try { return projectionId((TEvent)x); }
                     catch (Exception ex)
                     {
-                        // TODO: Add Warn log ex
-                        return default;
+                        if (fallback is null == false)
+                            return fallback((TEvent)x);
+
+                        // TODO: Add ERROR log ex
+                        throw;
                     }
                 };
             }
         }

         // Used by replay projection atm
-        protected ProjectionDefinition<TState, TId> Subscribe<TEvent>(Func<TEvent, TId> projectionId)
+        protected ProjectionDefinition<TState, TId> Subscribe<TEvent>(Func<TEvent, TId> projectionId, Func<TEvent, TId> fallback = null)
             where TEvent : IEvent
         {
             Type eventType = typeof(TEvent);

             if (subscriptionResolvers.ContainsKey(eventType))
-                subscriptionResolvers[eventType].Add(Safe(projectionId));
+                subscriptionResolvers[eventType].Add(Safe(projectionId, fallback));
             else
-                subscriptionResolvers.Add(typeof(TEvent), new List<Func<IEvent, IBlobId>>() { Safe(projectionId) });
+                subscriptionResolvers.Add(typeof(TEvent), new List<Func<IEvent, IBlobId>>() { Safe(projectionId, fallback) });

             return this;

-            static Func<IEvent, IBlobId> Safe(Func<TEvent, TId> projectionId)
+            static Func<IEvent, IBlobId> Safe(Func<TEvent, TId> projectionId, Func<TEvent, TId> fallback)
             {
                 return x =>
                 {
                     try { return projectionId((TEvent)x); }
                     catch (Exception ex)
                     {
-                        // TODO: Add Warn log ex
-                        return default;
+                        if (fallback is null == false)
+                            return fallback((TEvent)x);
+
+                        // TODO: Add Warn ERROR ex
+                        throw;
                     }
                 };
             }
         }
     }
+
+    public class ContinueId : IBlobId
+    {
+        public byte[] RawId => null;
+    }
 }


PRG to avoid subsequent form submission attempts on page refresh.

--- src/ExpressiveAnnotations.MvcWebSample/Controllers/HomeController.cs
+++ src/ExpressiveAnnotations.MvcWebSample/Controllers/HomeController.cs
@@ -7,7 +7,7 @@
     public class HomeController : BaseController
     {
         public ActionResult Index()
-        {
+        {
             var model = new Query
             {
                 GoAbroad = true,
@@ -18,6 +18,9 @@
                 LatestSuggestedReturnDate = DateTime.Today.AddMonths(1),
                 ContactDetails = new Contact()
             };
+
+            ViewBag.Success = TempData["Success"];
+
             return View("Home", model);
         }

@@ -25,7 +28,11 @@
         public ActionResult Index(Query model)
         {
             if (ModelState.IsValid)
-                ViewBag.Success = "Success";
+            {
+                TempData["Success"] = "Query successfully submitted";
+                return RedirectToAction("Index"); // PRG to avoid subsequent form submission attempts on page refresh (http://en.wikipedia.org/wiki/Post/Redirect/Get)
+            }
+
             return View("Home", model);
         }
     }


Update test

Update test

--- Test/Flurl.Test/Http/RedirectTests.cs
+++ Test/Flurl.Test/Http/RedirectTests.cs
@@ -33,7 +33,7 @@
 				.With(call => call.RedirectedFrom.Request.Url.ToString() == "http://redir.com/foo");
 			HttpTest.ShouldHaveCalled("http://redir.com/redir2/redir3?x=1&y=2#foo").WithVerb(HttpMethod.Get).WithRequestBody("")
 				.With(call => call.RedirectedFrom.Request.Url.ToString() == "http://redir.com/redir2");
-			HttpTest.ShouldHaveCalled("http://otherredir.com/bar/?a=b").WithVerb(HttpMethod.Get).WithRequestBody("")
+			HttpTest.ShouldHaveCalled("http://otherredir.com/bar/?a=b#foo").WithVerb(HttpMethod.Get).WithRequestBody("")
 				.With(call => call.RedirectedFrom.Request.Url.ToString() == "http://redir.com/redir2/redir3?x=1&y=2#foo");
 		}


Fix comment.

Fix comment.

--- src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs
+++ src/Features/Core/Portable/Diagnostics/Analyzers/IDEDiagnosticIds.cs
@@ -16,7 +16,7 @@
         public const string PopulateSwitchDiagnosticId = "IDE0010";
         public const string AddBracesDiagnosticId = "IDE0011";

-        // IDE0012-IDE0015 deprecated and replaced with PreferBuiltInTypeDiagnosticId and PreferFrameworkTypeDiagnosticId
+        // IDE0012-IDE0015 deprecated and replaced with PreferBuiltInOrFrameworkTypeDiagnosticId
         //public const string PreferIntrinsicPredefinedTypeInDeclarationsDiagnosticId = "IDE0012";
         //public const string PreferIntrinsicPredefinedTypeInMemberAccessDiagnosticId = "IDE0013";
         //public const string PreferFrameworkTypeInDeclarationsDiagnosticId = "IDE0014";


[Samples] Add CellView expansion example

--- TestApps/Samples/Samples/ListView1.cs
+++ TestApps/Samples/Samples/ListView1.cs
@@ -21,8 +21,9 @@
 			ListStore store = new ListStore (name, icon, text, icon2, progress);
 			list.DataSource = store;
 			list.Columns.Add ("Name", icon, name);
-			list.Columns.Add ("Text", icon2, text);
+			list.Columns.Add ("Text", new TextCellView (text, true), new ImageCellView (icon2));
 			list.Columns.Add ("Progress", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress });
+			list.Columns[1].CanResize = true;

 			var png = Image.FromResource (typeof(App), "class.png");


Modify solution variables for clarity

Modify solution variables for clarity

--- src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs
+++ src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs
@@ -29,10 +29,10 @@
         {
         }

-        public async Task<WorkspaceEdit?> HandleRequestAsync(Solution solution, RenameParams request, ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
+        public async Task<WorkspaceEdit?> HandleRequestAsync(Solution oldSolution, RenameParams request, ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
         {
             WorkspaceEdit? workspaceEdit = null;
-            var document = solution.GetDocumentFromURI(request.TextDocument.Uri);
+            var document = oldSolution.GetDocumentFromURI(request.TextDocument.Uri);
             if (document != null)
             {
                 var renameService = document.Project.LanguageServices.GetRequiredService<IEditorInlineRenameService>();
@@ -44,26 +44,26 @@
                     return workspaceEdit;
                 }

-                var renameLocationSet = await renameInfo.FindRenameLocationsAsync(solution.Workspace.Options, cancellationToken).ConfigureAwait(false);
-                var renameReplacementInfo = await renameLocationSet.GetReplacementsAsync(request.NewName, solution.Workspace.Options, cancellationToken).ConfigureAwait(false);
+                var renameLocationSet = await renameInfo.FindRenameLocationsAsync(oldSolution.Workspace.Options, cancellationToken).ConfigureAwait(false);
+                var renameReplacementInfo = await renameLocationSet.GetReplacementsAsync(request.NewName, oldSolution.Workspace.Options, cancellationToken).ConfigureAwait(false);

                 var renamedSolution = renameReplacementInfo.NewSolution;
-                var solutionChanges = renamedSolution.GetChanges(solution);
+                var solutionChanges = renamedSolution.GetChanges(oldSolution);

                 // Linked files can correspond to multiple roslyn documents each with changes.  W merge the changes in the linked files so that all linked documents have the same text.
                 // Then we can just take the text changes from the first document to avoid returning duplicate edits.
-                var solutionWithLinkedFileChangesMerged = await renamedSolution.WithMergedLinkedFileChangesAsync(solution, solutionChanges, cancellationToken: cancellationToken).ConfigureAwait(false);
-                solutionChanges = solutionWithLinkedFileChangesMerged.GetChanges(solution);
+                renamedSolution = await renamedSolution.WithMergedLinkedFileChangesAsync(oldSolution, solutionChanges, cancellationToken: cancellationToken).ConfigureAwait(false);
+                solutionChanges = renamedSolution.GetChanges(oldSolution);
                 var changedDocuments = solutionChanges
                     .GetProjectChanges()
                     .SelectMany(p => p.GetChangedDocuments(onlyGetDocumentsWithTextChanges: true))
-                    .GroupBy(docId => solutionWithLinkedFileChangesMerged.GetRequiredDocument(docId).FilePath, StringComparer.OrdinalIgnoreCase).Select(group => group.First());
+                    .GroupBy(docId => renamedSolution.GetRequiredDocument(docId).FilePath, StringComparer.OrdinalIgnoreCase).Select(group => group.First());

                 using var _ = ArrayBuilder<TextDocumentEdit>.GetInstance(out var documentEdits);
                 foreach (var docId in changedDocuments)
                 {
-                    var oldDoc = solution.GetRequiredDocument(docId);
-                    var newDoc = solutionWithLinkedFileChangesMerged.GetRequiredDocument(docId);
+                    var oldDoc = oldSolution.GetRequiredDocument(docId);
+                    var newDoc = renamedSolution.GetRequiredDocument(docId);

                     var textChanges = await newDoc.GetTextChangesAsync(oldDoc, cancellationToken).ConfigureAwait(false);
                     var oldText = await oldDoc.GetTextAsync(cancellationToken).ConfigureAwait(false);


Make sure we reset state properly after cloning/creating

--- src/GitHub.VisualStudio/TeamExplorer/Connect/GitHubConnectSection.cs
+++ src/GitHub.VisualStudio/TeamExplorer/Connect/GitHubConnectSection.cs
@@ -199,6 +199,7 @@
                     else
                         HandleClonedRepo(newrepo);

+                    isCreating = isCloning = false;
                     var repo = await ApiFactory.Create(newrepo.CloneUrl).GetRepository();
                     newrepo.SetIcon(repo.Private, repo.Fork);
                 }


use Source in Binding

use Source in Binding

--- src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/BindingExtension.cs
+++ src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/BindingExtension.cs
@@ -43,6 +43,7 @@
                 Mode = Mode,
                 Path = pathInfo.Path,
                 Priority = Priority,
+                Source = Source,
                 RelativeSource = pathInfo.RelativeSource ?? RelativeSource,
                 DefaultAnchor = new WeakReference(GetDefaultAnchor((ITypeDescriptorContext)serviceProvider))
             };


TH07: Fix the bug in the case of the initial score.dat

--- ThScoreFileConverter/Th07Converter.cs
+++ ThScoreFileConverter/Th07Converter.cs
@@ -778,32 +778,38 @@
                                 case 1:     // MaxBonus
                                     return Utils.Accumulate<CardAttack>(
                                         this.allScoreData.cardAttacks, new Converter<CardAttack, uint>(
-                                            attack => attack.MaxBonuses[chara])).ToString();
+                                            attack => ((attack != null) ? attack.MaxBonuses[chara] : 0)))
+                                            .ToString();
                                 case 2:     // clear count
                                     return Utils.Accumulate<CardAttack>(
                                         this.allScoreData.cardAttacks, new Converter<CardAttack, int>(
-                                            attack => attack.ClearCounts[chara])).ToString();
+                                            attack => ((attack != null) ? attack.ClearCounts[chara] : 0)))
+                                            .ToString();
                                 case 3:     // trial count
                                     return Utils.Accumulate<CardAttack>(
                                         this.allScoreData.cardAttacks, new Converter<CardAttack, int>(
-                                            attack => attack.TrialCounts[chara])).ToString();
+                                            attack => ((attack != null) ? attack.TrialCounts[chara] : 0)))
+                                            .ToString();
                                 default:    // unreachable
                                     return match.ToString();
                             }
                         else if ((0 < number) && (number <= NumCards))
                         {
-                            var cardAttack = this.allScoreData.cardAttacks[number - 1];
-                            switch (type)
-                            {
-                                case 1:     // MaxBonus
-                                    return cardAttack.MaxBonuses[chara].ToString();
-                                case 2:     // clear count
-                                    return cardAttack.ClearCounts[chara].ToString();
-                                case 3:     // trial count
-                                    return cardAttack.TrialCounts[chara].ToString();
-                                default:    // unreachable
-                                    return cardAttack.ToString();
-                            }
+                            var attack = this.allScoreData.cardAttacks[number - 1];
+                            if (attack != null)
+                                switch (type)
+                                {
+                                    case 1:     // MaxBonus
+                                        return attack.MaxBonuses[chara].ToString();
+                                    case 2:     // clear count
+                                        return attack.ClearCounts[chara].ToString();
+                                    case 3:     // trial count
+                                        return attack.TrialCounts[chara].ToString();
+                                    default:    // unreachable
+                                        return match.ToString();
+                                }
+                            else
+                                return "0";
                         }
                         else
                             return match.ToString();
@@ -828,15 +834,13 @@

                         if ((0 < number) && (number <= NumCards))
                         {
-                            var cardAttack = this.allScoreData.cardAttacks[number - 1];
+                            var attack = this.allScoreData.cardAttacks[number - 1];
                             if (type == "N")
-                                return cardAttack.hasTried()
-                                    ? Encoding.Default.GetString(cardAttack.CardName) : "??????????";
+                                return ((attack != null) && attack.hasTried())
+                                    ? Encoding.Default.GetString(attack.CardName) : "??????????";
                             else
-                            {
-                                return cardAttack.hasTried()
-                                    ? CardLevelTable[cardAttack.Number].ToString() : "?????";
-                            }
+                                return ((attack != null) && attack.hasTried())
+                                    ? CardLevelTable[attack.Number].ToString() : "?????";
                         }
                         else
                             return match.ToString();
@@ -858,77 +862,94 @@
             return new Regex(pattern, RegexOptions.IgnoreCase)
                 .Replace(input, new MatchEvaluator(match =>
                 {
-                    var level =
-                        (LevelWithTotal)Utils.ParseEnum<LevelShortWithTotal>(match.Groups[1].Value, true);
-                    var chara =
-                        (CharaWithTotal)Utils.ParseEnum<CharaShortWithTotal>(match.Groups[2].Value, true);
-                    var stage = int.Parse(match.Groups[3].Value);
-                    var type = int.Parse(match.Groups[4].Value);
-
-                    Predicate<CardAttack> findCard = (attack => false);
-
-                    if (level == LevelWithTotal.Total)
-                    {
-                        if (stage == 0)     // total
+                    try
+                    {
+                        var level =
+                            (LevelWithTotal)Utils.ParseEnum<LevelShortWithTotal>(match.Groups[1].Value, true);
+                        var chara =
+                            (CharaWithTotal)Utils.ParseEnum<CharaShortWithTotal>(match.Groups[2].Value, true);
+                        var stage = int.Parse(match.Groups[3].Value);
+                        var type = int.Parse(match.Groups[4].Value);
+
+                        Predicate<CardAttack> findCard = (attack => false);
+
+                        if (level == LevelWithTotal.Total)
                         {
-                            if (type == 1)
-                                findCard = (attack => (attack.ClearCounts[chara] > 0));
+                            if (stage == 0)     // total
+                            {
+                                if (type == 1)
+                                    findCard = (attack =>
+                                        ((attack != null) && (attack.ClearCounts[chara] > 0)));
+                                else
+                                    findCard = (attack =>
+                                        ((attack != null) && (attack.TrialCounts[chara] > 0)));
+                            }
                             else
-                                findCard = (attack => (attack.TrialCounts[chara] > 0));
+                            {
+                                var st = (Stage)(stage - 1);
+                                if (type == 1)
+                                    findCard = (attack =>
+                                        ((attack != null) &&
+                                        StageCardTable[st].Contains(attack.Number) &&
+                                        (attack.ClearCounts[chara] > 0)));
+                                else
+                                    findCard = (attack =>
+                                        ((attack != null) &&
+                                        StageCardTable[st].Contains(attack.Number) &&
+                                        (attack.TrialCounts[chara] > 0)));
+                            }
                         }
-                        else
+                        else if ((level == LevelWithTotal.Extra) || (level == LevelWithTotal.Phantasm))
                         {
-                            var st = (Stage)(stage - 1);
+                            var st = (level == LevelWithTotal.Extra) ? Stage.Extra : Stage.Phantasm;
                             if (type == 1)
                                 findCard = (attack =>
-                                    (StageCardTable[st].Contains(attack.Number) &&
+                                    ((attack != null) &&
+                                    StageCardTable[st].Contains(attack.Number) &&
                                     (attack.ClearCounts[chara] > 0)));
                             else
                                 findCard = (attack =>
-                                    (StageCardTable[st].Contains(attack.Number) &&
-                                    (attack.TrialCounts[chara] > 0)));
-                        }
-                    }
-                    else if ((level == LevelWithTotal.Extra) || (level == LevelWithTotal.Phantasm))
-                    {
-                        var st = (level == LevelWithTotal.Extra) ? Stage.Extra : Stage.Phantasm;
-                        if (type == 1)
-                            findCard = (attack =>
-                                (StageCardTable[st].Contains(attack.Number) &&
-                                (attack.ClearCounts[chara] > 0)));
-                        else
-                            findCard = (attack =>
-                                (StageCardTable[st].Contains(attack.Number) &&
-                                (attack.TrialCounts[chara] > 0)));
-                    }
-                    else
-                    {
-                        var lv = (Level)level;
-                        if (stage > 0)
-                        {
-                            if (type == 1)
-                                findCard = (attack =>
-                                    ((CardLevelTable[attack.Number] == lv) &&
-                                    (attack.ClearCounts[chara] > 0)));
-                            else
-                                findCard = (attack =>
-                                    ((CardLevelTable[attack.Number] == lv) &&
+                                    ((attack != null) &&
+                                    StageCardTable[st].Contains(attack.Number) &&
                                     (attack.TrialCounts[chara] > 0)));
                         }
                         else
                         {
-                            if (type == 1)
-                                findCard = (attack =>
-                                    ((CardLevelTable[attack.Number] == lv) &&
-                                    (attack.ClearCounts[chara] > 0)));
+                            var lv = (Level)level;
+                            if (stage > 0)
+                            {
+                                if (type == 1)
+                                    findCard = (attack =>
+                                        ((attack != null) &&
+                                        (CardLevelTable[attack.Number] == lv) &&
+                                        (attack.ClearCounts[chara] > 0)));
+                                else
+                                    findCard = (attack =>
+                                        ((attack != null) &&
+                                        (CardLevelTable[attack.Number] == lv) &&
+                                        (attack.TrialCounts[chara] > 0)));
+                            }
                             else
-                                findCard = (attack =>
-                                    ((CardLevelTable[attack.Number] == lv) &&
-                                    (attack.TrialCounts[chara] > 0)));
+                            {
+                                if (type == 1)
+                                    findCard = (attack =>
+                                        ((attack != null) &&
+                                        (CardLevelTable[attack.Number] == lv) &&
+                                        (attack.ClearCounts[chara] > 0)));
+                                else
+                                    findCard = (attack =>
+                                        ((attack != null) &&
+                                        (CardLevelTable[attack.Number] == lv) &&
+                                        (attack.TrialCounts[chara] > 0)));
+                            }
                         }
-                    }
-
-                    return Utils.CountIf<CardAttack>(this.allScoreData.cardAttacks, findCard).ToString();
+
+                        return Utils.CountIf<CardAttack>(this.allScoreData.cardAttacks, findCard).ToString();
+                    }
+                    catch
+                    {
+                        return match.ToString();
+                    }
                 }));
         }


Changed single line if statement

Changed single line if statement

--- src/NUnitFramework/framework/Internal/Execution/CompositeWorkItem.cs
+++ src/NUnitFramework/framework/Internal/Execution/CompositeWorkItem.cs
@@ -279,8 +279,13 @@
             {
                 var xKey = int.MaxValue;
                 var yKey = int.MaxValue;
-                if (x.Test.Properties.ContainsKey(PropertyNames.Order)) xKey=(int)x.Test.Properties[PropertyNames.Order][0];
-                if (y.Test.Properties.ContainsKey(PropertyNames.Order)) yKey=(int)y.Test.Properties[PropertyNames.Order][0];
+
+                if (x.Test.Properties.ContainsKey(PropertyNames.Order))
+                    xKey =(int)x.Test.Properties[PropertyNames.Order][0];
+
+                if (y.Test.Properties.ContainsKey(PropertyNames.Order))
+                    yKey =(int)y.Test.Properties[PropertyNames.Order][0];
+
                 return xKey.CompareTo(yKey);
             }
         }


#663 Remove unnecessary code from HorizonYamlFileGeneratorHelper.GenerateService

--- src/SIM.ContainerInstaller/Modules/HorizonYamlFileGeneratorHelper.cs
+++ src/SIM.ContainerInstaller/Modules/HorizonYamlFileGeneratorHelper.cs
@@ -94,12 +94,10 @@

     public KeyValuePair<YamlNode, YamlNode> GenerateService(IEnumerable<IYamlFileGeneratorHelper> helpers)
     {
-      HorizonYamlFileGeneratorHelper horizonYamlFileGeneratorHelper = helpers.OfType<HorizonYamlFileGeneratorHelper>().FirstOrDefault();
-
       List<KeyValuePair<YamlNode, YamlNode>> nodes = new List<KeyValuePair<YamlNode, YamlNode>>();

-      nodes.Add(new KeyValuePair<YamlNode, YamlNode>(new YamlScalarNode("image"), new YamlScalarNode(horizonYamlFileGeneratorHelper.HorizonImagePath)));
-      nodes.Add(new KeyValuePair<YamlNode, YamlNode>(new YamlScalarNode("isolation"), new YamlScalarNode(horizonYamlFileGeneratorHelper.IsolationNode)));
+      nodes.Add(new KeyValuePair<YamlNode, YamlNode>(new YamlScalarNode("image"), new YamlScalarNode(HorizonImagePath)));
+      nodes.Add(new KeyValuePair<YamlNode, YamlNode>(new YamlScalarNode("isolation"), new YamlScalarNode(IsolationNode)));

       bool includeSXA = false;
       if (helpers.OfType<SxaYamlFileGeneratorHelper>().Any())
@@ -115,7 +113,7 @@
       }*/

       YamlMappingNode environmentYamlMappingNode = new YamlMappingNode();
-      foreach (KeyValuePair<string, string> envVariable in horizonYamlFileGeneratorHelper.GetHorizonEnvironmentVariables(includeSXA, includeSCCH))
+      foreach (KeyValuePair<string, string> envVariable in GetHorizonEnvironmentVariables(includeSXA, includeSCCH))
       {
         if (bool.TryParse(envVariable.Value, out bool result))
         {
@@ -134,7 +132,7 @@
       )));

       YamlSequenceNode labelsYamlSequenceNode = new YamlSequenceNode();
-      foreach (string label in horizonYamlFileGeneratorHelper.GetHorizonLabels())
+      foreach (string label in GetHorizonLabels())
       {
         labelsYamlSequenceNode.Add(new YamlScalarNode(label) { Style = YamlDotNet.Core.ScalarStyle.DoubleQuoted });
       }


Disable for netfx (#19102)

Disable for netfx (#19102)

--- src/System.Security.Cryptography.Algorithms/tests/HmacSha512Tests.cs
+++ src/System.Security.Cryptography.Algorithms/tests/HmacSha512Tests.cs
@@ -21,6 +21,7 @@
         protected override int BlockSize { get { return 128; } }

         [Fact]
+        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework implements this, Core does not")]
         public void ProduceLegacyHmacValues()
         {
             using (var h = new HMACSHA512())


Added default error message pointing to help

--- ImageTiler/Program.cs
+++ ImageTiler/Program.cs
@@ -76,7 +76,7 @@
             }
             catch (Exception e)
             {
-                Console.WriteLine(e.Message);
+                Console.WriteLine("Use -h for help.");
                 Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
             }
         }


Rename fields in Application class

Rename fields in Application class

--- src/git-istage/Application.cs
+++ src/git-istage/Application.cs
@@ -23,11 +23,11 @@
         private Label _footer;
         private PatchDocument _document;
         private StringBuilder _inputLineDigits = new StringBuilder();
-        private bool _helpShowed;
+        private bool _helpShowing;
         ConsoleCommand[] _commands;

-        private int selectedLineBeforeHelpPageShowed;
-        private int topLineBeforeHelpPageShowed;
+        private int selectedLineBeforeHelpWasShown;
+        private int topLineBeforeHelpWasShown;

         public Application(string repositoryPath, string pathToGit)
         {
@@ -168,7 +168,7 @@

         private void UpdateHeader()
         {
-            if (_helpShowed)
+            if (_helpShowing)
             {
                 _header.Text = "Keyboard shortcuts";
                 return;
@@ -184,7 +184,7 @@

         private void UpdateFooter()
         {
-            if (_helpShowed)
+            if (_helpShowing)
             {
                 _footer.Text = string.Empty;
                 return;
@@ -229,25 +229,25 @@

         private void Commit()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             RunGit("commit -v");
         }

         private void CommitAmend()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             RunGit("commit -v --amend");
         }

         private void Stash()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             RunGit("stash -u -k");
         }

         private void ToggleBetweenWorkingDirectoryAndStaging()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             _viewStage = !_viewStage;

             UpdateRepository();
@@ -255,14 +255,14 @@

         private void IncreaseContext()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             _contextLines++;
             UpdateRepository();
         }

         private void DecreaseContext()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             if (_contextLines == 0)
                 return;

@@ -272,14 +272,14 @@

         private void ToogleFullDiff()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             _fullFileDiff = !_fullFileDiff;
             UpdateRepository();
         }

         private void ToggleWhitespace()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             _view.VisibleWhitespace = !_view.VisibleWhitespace;
         }

@@ -338,7 +338,7 @@

         private void SelectUp()
         {
-            if (_helpShowed)
+            if (_helpShowing)
             {
                 ScrollUp();
                 return;
@@ -353,7 +353,7 @@

         private void SelectDown()
         {
-            if (_helpShowed)
+            if (_helpShowing)
             {
                 ScrollDown();
                 return;
@@ -412,7 +412,7 @@

         private void GoPreviousFile()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             var i = _view.SelectedLine;
             if (i < 0)
                 return;
@@ -424,7 +424,7 @@

         private void GoNextFile()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             var i = _view.SelectedLine;
             if (i < 0)
                 return;
@@ -436,7 +436,7 @@

         private void GoPreviousHunk()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             var i = _view.SelectedLine;
             if (i < 0)
                 return;
@@ -447,7 +447,7 @@

         private void GoNextHunk()
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             var i = _view.SelectedLine;
             if (i < 0)
                 return;
@@ -526,30 +526,30 @@

         private void AppendLineDigit(char digit)
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             _inputLineDigits.Append(digit);
             UpdateFooter();
         }

         private void ShowHelpPage()
         {
-            if (_helpShowed)
-            {
-                _helpShowed = false;
-
-                _view.SelectedLine = selectedLineBeforeHelpPageShowed == -1 ? 0 : selectedLineBeforeHelpPageShowed;
-                _view.TopLine = topLineBeforeHelpPageShowed;
+            if (_helpShowing)
+            {
+                _helpShowing = false;
+
+                _view.SelectedLine = selectedLineBeforeHelpWasShown == -1 ? 0 : selectedLineBeforeHelpWasShown;
+                _view.TopLine = topLineBeforeHelpWasShown;

                 UpdateRepository();
                 return;
             }

-            selectedLineBeforeHelpPageShowed = _view.SelectedLine;
-            topLineBeforeHelpPageShowed = _view.TopLine;
+            selectedLineBeforeHelpWasShown = _view.SelectedLine;
+            topLineBeforeHelpWasShown = _view.TopLine;

             _view.Document = new Help().GetKeyboardShortcutsInfo(_commands);

-            _helpShowed = true;
+            _helpShowing = true;

             UpdateHeader();
             UpdateFooter();
@@ -563,7 +563,7 @@

         private void ApplyPatch(PatchDirection direction, bool entireHunk)
         {
-            if (_helpShowed) return;
+            if (_helpShowing) return;
             if (_view.SelectedLine < 0)
                 return;


Add ? as shortcut to show help page

Add ? as shortcut to show help page

--- src/git-istage/Application.cs
+++ src/git-istage/Application.cs
@@ -82,7 +82,8 @@
                 new ConsoleCommand(AppendLineDigit7, ConsoleKey.D7, "Append digit 7 to line."),
                 new ConsoleCommand(AppendLineDigit8, ConsoleKey.D8, "Append digit 8 to line."),
                 new ConsoleCommand(AppendLineDigit9, ConsoleKey.D9, "Append digit 9 to line."),
-                new ConsoleCommand(ShowHelpPage, ConsoleKey.F1, "Show / hide help page")
+                new ConsoleCommand(ShowHelpPage, ConsoleKey.F1, "Show / hide help page"),
+                new ConsoleCommand(ShowHelpPage, ConsoleKey.Oem2, ConsoleModifiers.Shift, "Show / hide help page")
             };

             Console.CursorVisible = false;


add test case for #167

add test case for #167

--- src/cs/tests_xunit.cs
+++ src/cs/tests_xunit.cs
@@ -121,6 +121,35 @@
         }

         [Fact]
+        public void test_column_blob_overload_167()
+        {
+            using (sqlite3 db = ugly.open(":memory:"))
+            {
+                const int len = 100;
+
+                db.exec("CREATE TABLE foo (b blob);");
+                db.exec("INSERT INTO foo (b) VALUES (randomblob(?))", len);
+
+                using (sqlite3_stmt stmt = db.prepare("SELECT b FROM foo;"))
+                {
+                    stmt.step();
+
+                    var ba1 = stmt.column_blob(0);
+
+                    const int offset = 7;
+
+                    var ba2 = new byte[len + offset];
+                    stmt.column_blob(0, ba2, offset);
+                    for (int i=0; i<ba1.Length; i++)
+                    {
+                        Assert.Equal(ba1[i], ba2[i + offset]);
+                    }
+                }
+            }
+
+        }
+
+        [Fact]
         public void test_blob_read()
         {
             using (sqlite3 db = ugly.open(":memory:"))


Add Game.Table: a collection of white card sets on the table

- Add GameThread
- Make some functions private

--- cac/Game.cs
+++ cac/Game.cs
@@ -3,6 +3,7 @@
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;

 namespace cac
@@ -14,7 +15,9 @@
         private BlackCard CurrentCard;
         private List<WhiteCard> WhiteDeck;
         private List<BlackCard> BlackDeck;
+        private List<List<WhiteCard>> Table;
         private GameSettings Settings;
+        private Thread GameThread;

         public Game(string[] parameters)
         {
@@ -22,11 +25,13 @@
             this.State = GameState.Lobby;
             this.WhiteDeck = this.LoadWhiteDeck("/data/white.txt");
             this.BlackDeck = this.LoadBlackDeck("/data/black.txt");
+            this.Table = new List<List<WhiteCard>>();

             this.Settings = new GameSettings(parameters);
+            this.GameThread = new Thread(DealingState);
         }

-        public List<WhiteCard> LoadWhiteDeck(string path)
+        private List<WhiteCard> LoadWhiteDeck(string path)
         {
             List<WhiteCard> deck = new List<WhiteCard>();
             StreamReader sr = new StreamReader(path);
@@ -39,7 +44,7 @@
             return deck;
         }

-        public List<BlackCard> LoadBlackDeck(string path)
+        private List<BlackCard> LoadBlackDeck(string path)
         {
             List<BlackCard> deck = new List<BlackCard>();
             StreamReader sr = new StreamReader(path);
@@ -63,11 +68,10 @@
             this.WhiteDeck.Shuffle();
             this.BlackDeck.Shuffle();

-            // Players should have already joined the game by this point.
-            this.DealingState();
+            this.GameThread.Start();
         }

-        public void DealingState()
+        private void DealingState()
         {
             this.State = GameState.Dealing;

@@ -87,6 +91,18 @@
         private void PlayingState()
         {
             this.State = GameState.Playing;
+
+            while(this.Table.Count < this.Players.Count)
+            {
+                // Wait for players to submit their cards
+            }
+
+            this.JudgingState();
+        }
+
+        private void JudgingState()
+        {
+            this.State = GameState.Judging;
         }

         public void AddPlayer(Player player)
@@ -106,7 +122,7 @@
             }
         }

-        public void DealCards(Player player)
+        private void DealCards(Player player)
         {
             while (player.Hand.Count <= Constants.MAX_HAND &&
                    this.WhiteDeck.Count > 0)


Acceptance tests.

Acceptance tests.

--- dotnet/Tests/Tests.cs
+++ dotnet/Tests/Tests.cs
@@ -28,5 +28,41 @@
             currentUser.AccountKey.ShouldEqual(_accountKey);
             currentUser.Username.ShouldEqual(_username);
         }
+
+        [Test]
+        public void should_add_a_list()
+        {
+
+        }
+
+        [Test]
+        public void should_update_a_list()
+        {
+
+        }
+
+        [Test]
+        public void should_get_a_list()
+        {
+
+        }
+
+        [Test]
+        public void should_get_lists()
+        {
+
+        }
+
+        [Test]
+        public void should_upload_data()
+        {
+
+        }
+
+        [Test]
+        public void should_download_data()
+        {
+
+        }
     }
 }


Re-remove file that came back in the merge

--HG--
branch : net-3.5
extra : convert_revision : charlie%40nunit.com-20090918010733-apdh692du7x3h2s6

--- src/tests/Shared/Framework/Constraints/SerializableConstraintTest.cs
+++ src/tests/Shared/Framework/Constraints/SerializableConstraintTest.cs
@@ -1,83 +0,0 @@
-// ***********************************************************************
-// Copyright (c) 2007 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-using System;
-using System.Collections;
-#if CLR_2_0
-using System.Collections.Generic;
-#endif
-
-namespace NUnit.Framework.Constraints.Tests
-{
-    [TestFixture]
-    public class BinarySerializableTest : ConstraintTestBaseWithArgumentException
-    {
-		[SetUp]
-        public void SetUp()
-        {
-            theConstraint = new BinarySerializableConstraint();
-            expectedDescription = "binary serializable";
-            stringRepresentation = "<binaryserializable>";
-        }
-
-        object[] SuccessData = new object[] { 1, "a", new ArrayList(), new InternalWithSerializableAttributeClass() };
-
-        object[] FailureData = new object[] { new InternalClass() };
-
-        string[] ActualValues = new string[] { "<InternalClass>" };
-
-        object[] InvalidData = new object[] { null };
-    }
-
-    [TestFixture]
-    public class XmlSerializableTest : ConstraintTestBaseWithArgumentException
-    {
-        [SetUp]
-        public void SetUp()
-        {
-            theConstraint = new XmlSerializableConstraint();
-            expectedDescription = "xml serializable";
-            stringRepresentation = "<xmlserializable>";
-        }
-
-        object[] SuccessData = new object[] { 1, "a", new ArrayList() };
-
-#if CLR_2_0
-		object[] FailureData = new object[] { new Dictionary<string, string>(), new InternalClass(), new InternalWithSerializableAttributeClass() };
-        string[] ActualValues = new string[] { "<Dictionary`2>", "<InternalClass>", "<InternalWithSerializableAttributeClass>" };
-#else
-		object[] FailureData = new object[] { new InternalClass(), new InternalWithSerializableAttributeClass() };
-		string[] ActualValues = new string[] { "<InternalClass>", "<InternalWithSerializableAttributeClass>" };
-#endif
-
-
-        object[] InvalidData = new object[] { null };
-    }
-
-    internal class InternalClass
-    {}
-
-    [Serializable]
-    internal class InternalWithSerializableAttributeClass
-    {}
-}


Fixed alignment issue.

Fixed alignment issue.

--- NtApiDotNet/NtFile.cs
+++ NtApiDotNet/NtFile.cs
@@ -1923,15 +1923,6 @@
         public byte Sid;
     }

-    [StructLayout(LayoutKind.Sequential), DataStart("FileName")]
-    public struct FindBySidOutput
-    {
-        public int NextEntryOffset;
-        public int FileIndex;
-        public int FileNameLength;
-        public ushort FileName;
-    }
-
 #pragma warning restore 1591

     /// <summary>
@@ -4321,8 +4312,10 @@
         /// <remarks>For this method to work you need Quota enabled on the volume.</remarks>
         public IEnumerable<string> FindFilesBySid(Sid sid)
         {
-            FindBySidData input = new FindBySidData();
-            input.Restart = 1;
+            FindBySidData input = new FindBySidData
+            {
+                Restart = 1
+            };
             byte[] sid_buffer = sid.ToArray();

             using (var buffer = input.ToBuffer(sid_buffer.Length, true))
@@ -4344,6 +4337,7 @@
                             yield break;
                         }

+                        // First entry seems to be empty, but process anyway.
                         int ofs = 0;

                         while (ofs < length)
@@ -4355,7 +4349,7 @@
                                 yield return res_buffer.Data.ReadUnicodeString(result.NameLength / 2);
                             }

-                            int total_length = (4 + result.NameLength + 7) & ~7;
+                            int total_length = (4 + result.NameLength + 8) & ~7;
                             ofs += total_length;
                         }
                         // Modify restart to 0.


All dlls are now extracted from the plugins folder on init and saved into an accessible path for loading.

--- Duality/DualityApp.cs
+++ Duality/DualityApp.cs
@@ -760,7 +760,7 @@
 			Log.Core.Write("Scanning for core plugins...");
 			Log.Core.PushIndent();

-			var pluginLibPaths = GetPluginLibPaths("*.core.dll");
+			var pluginLibPaths = GetPluginLibPaths("*.dll");

 #if __ANDROID__
 			foreach (string dllPath in pluginLibPaths)


Added WSL reparse tag.

Added WSL reparse tag.

--- NtApiDotNet/NtFile.cs
+++ NtApiDotNet/NtFile.cs
@@ -1068,6 +1068,7 @@
         CLOUD_F = 0x9000F01A,
         CLOUD_MASK = 0x0000F000,
         GVFS = 0x9000001C,
+        WSL_SYMLINK = 0xA000001D,
         STORAGE_SYNC = 0x8000001E,
         WCI_TOMBSTONE = 0xA000001F,
         UNHANDLED = 0x80000020,


generator: Fix indentation in Signal.cs

generator: Fix indentation in Signal.cs

Only whitespace changes, no real code change.

--- generator/Signal.cs
+++ generator/Signal.cs
@@ -113,43 +113,43 @@
 			get { return Name + "SignalDelegate"; }
 		}

-                private string EventArgsName {
-                        get {
-                                if (IsEventHandler)
-                                        return "EventArgs";
-                                else
-                                        return Name + "Args";
-                        }
-                }
-
-                private string EventArgsQualifiedName {
-                        get {
-                                if (IsEventHandler)
-                                        return "System.EventArgs";
-                                else
-                                        return container_type.NS + "." + Name + "Args";
-                        }
-                }
-
-                private string EventHandlerName {
-                        get {
-                                if (IsEventHandler)
-                                        return "EventHandler";
-                                else if (SymbolTable.Table [container_type.NS + Name + "Handler"] != null)
-                                        return Name + "EventHandler";
+		private string EventArgsName {
+			get {
+				if (IsEventHandler)
+					return "EventArgs";
 				else
-                                        return Name + "Handler";
-                        }
-                }
-
-                private string EventHandlerQualifiedName {
-                        get {
-                                if (IsEventHandler)
-                                        return "System.EventHandler";
-                                else
-                                        return container_type.NS + "." + EventHandlerName;
-                        }
-                }
+					return Name + "Args";
+			}
+		}
+
+		private string EventArgsQualifiedName {
+			get {
+				if (IsEventHandler)
+					return "System.EventArgs";
+				else
+					return container_type.NS + "." + Name + "Args";
+			}
+		}
+
+		private string EventHandlerName {
+			get {
+				if (IsEventHandler)
+					return "EventHandler";
+				else if (SymbolTable.Table [container_type.NS + Name + "Handler"] != null)
+					return Name + "EventHandler";
+		else
+					return Name + "Handler";
+			}
+		}
+
+		private string EventHandlerQualifiedName {
+			get {
+				if (IsEventHandler)
+					return "System.EventHandler";
+				else
+					return container_type.NS + "." + EventHandlerName;
+			}
+		}

 		private bool IsEventHandler {
 			get {


Refactor viewport setup into separate function

- Add `setupViewport` to handle retrieval of framebuffer size and
  viewport calibration

--- src/Program.cs
+++ src/Program.cs
@@ -63,10 +63,7 @@

             GLFW.SetKeyCallback(window, keyBindings);

-            int width = 0,
-                height = 0;
-            GLFW.GetFramebufferSize(window, ref width, ref height);
-            OpenGL.Viewport(0, 0, width, height);
+            setupViewport(window);

             // create the OpenGL Vertex Shader Object
             uint vertexShader = 0;
@@ -207,5 +204,12 @@
             }
             return program;
         }
+
+        private static void setupViewport(IntPtr window) {
+            int width = 0,
+                height = 0;
+            GLFW.GetFramebufferSize(window, ref width, ref height);
+            OpenGL.Viewport(0, 0, width, height);
+        }
     }
 }


remove donot destroy on dummy

remove donot destroy on dummy


默认开启分帧清理“过期”强引用

默认开启分帧清理“过期”强引用


modified:   Dragon/UnitTests/TestSymbol.cs

--- Dragon/UnitTests/TestSymbol.cs
+++ Dragon/UnitTests/TestSymbol.cs
@@ -63,6 +63,7 @@
             Assert.AreEqual(Dragon.Type.Float, arr.Of);
             Assert.AreEqual(42, arr.Size);
             Assert.AreEqual("[42] float", arr.ToString());
+            Assert.AreEqual(8 * 42, arr.Width);
         }
     }
 }


Add extra yaml test for not-null values

Add extra yaml test for not-null values

--- test/NetEscapades.Configuration.Yaml.Tests/YamlConfigurationTests.cs
+++ test/NetEscapades.Configuration.Yaml.Tests/YamlConfigurationTests.cs
@@ -84,6 +84,8 @@
                 nullValue2: Null
                 nullValue3: NULL
                 nullValue4: ~
+                notNull1: NUll
+                notNull2: NuLL
             ";

             var yamlConfigSrc = LoadProvider(yaml);
@@ -91,6 +93,8 @@
             Assert.Null(yamlConfigSrc.Get("nullValue2"));
             Assert.Null(yamlConfigSrc.Get("nullValue3"));
             Assert.Null(yamlConfigSrc.Get("nullValue4"));
+            Assert.NotNull(yamlConfigSrc.Get("notNull1"));
+            Assert.NotNull(yamlConfigSrc.Get("notNull2"));
         }

         [Fact]


Test automated build configuration

Test automated build configuration

--- tests/Microsoft.Graph.DotnetCore.Core.Test/Helpers/UrlHelperTests.cs
+++ tests/Microsoft.Graph.DotnetCore.Core.Test/Helpers/UrlHelperTests.cs
@@ -29,7 +29,7 @@

             var queryValues = UrlHelper.GetQueryOptions(uri);

-            Assert.Equal(0, queryValues.Count);
+            Assert.Equal(1, queryValues.Count);
         }

         [Fact]


Ignore yeppp test. All other tests pass.

--- tests/Spreads.Collections.Tests/Cursors/BatchMapValuesCursorTests.cs
+++ tests/Spreads.Collections.Tests/Cursors/BatchMapValuesCursorTests.cs
@@ -274,6 +274,7 @@
         }

         [Test]
+        [Ignore("Yeppp need rework and just throw it away. No test showed visivle gains yet.")]
         public void CouldAddWithYeppMathProvider() {

             var sm = new SortedChunkedMap<DateTime, double>();


Async code optimizations.

Async code optimizations.


Fix ReorgTestAsync.

Fix ReorgTestAsync.


obsługa SingleInstance #18

obsługa SingleInstance #18

--- RedmineLog/Program.cs
+++ RedmineLog/Program.cs
@@ -4,6 +4,7 @@
 using RedmineLog.Logic.Data;
 using RedmineLog.UI;
 using System;
+using System.Diagnostics;
 using System.Windows.Forms;

 namespace RedmineLog
@@ -18,6 +19,16 @@
         [STAThread]
         private static void Main()
         {
+            bool result;
+            var mutex = new System.Threading.Mutex(true, "UniqueAppId", out result);
+
+            if (!result)
+            {
+                MessageBox.Show("Another instance is already running.", "Warning",
+                                MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
+                return;
+            }
+
             (Kernel = new StandardKernel())
                        .Load(new Bindings(),
                              new UI.Bindings(),
@@ -30,11 +41,16 @@
             Application.SetCompatibleTextRenderingDefault(false);

             Application.Run(new frmMain());
+
+            GC.KeepAlive(mutex);
+
         }

         private static void OnUnhandledException(object sender, System.Threading.ThreadExceptionEventArgs e)
         {
             Program.Kernel.Get<Logger>().Error("Unhandled Exception ", e.Exception);
         }
+
+
     }
 }


version: Increment minor -> 0.11.0

version: Increment minor -> 0.11.0

https://github.com/awseward/bugsnag.net/compare/0.10.0...0.11.0

* chore: Remove IBugsnagger::*Async     https://github.com/awseward/Bugsnag.NET/pull/76
* chore: Remove static approach classes https://github.com/awseward/Bugsnag.NET/pull/77
* chore: Update paket bootstrapper      https://github.com/awseward/Bugsnag.NET/pull/75

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -2,6 +2,6 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;

-[assembly: AssemblyVersion("0.10.0.0")]
-[assembly: AssemblyFileVersion("0.10.0.0")]
-[assembly: AssemblyInformationalVersion("0.10.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
+[assembly: AssemblyInformationalVersion("0.11.0")]


update version

update version

--- SharedAssemblyInfo.cs
+++ SharedAssemblyInfo.cs
@@ -7,8 +7,8 @@
 [assembly: AssemblyCopyright("Copyright © CodePlex Foundation 2012-2017")]
 [assembly: AssemblyCompany("CodePlex Foundation")]

-[assembly: AssemblyVersion("17.1.2.0")]
-[assembly: AssemblyFileVersion("17.1.2.0")]
+[assembly: AssemblyVersion("18.1.0.0")]
+[assembly: AssemblyFileVersion("18.1.0.0")]

 [assembly: NeutralResourcesLanguage("en-US")]


Deleted unused class.

Deleted unused class.

--- SharprWowApi/Enums.cs
+++ SharprWowApi/Enums.cs
@@ -120,7 +120,4 @@
         Male = 0,
         Female = 1,
     }
-    public class Enums
-    {
-    }
 }


Fall back to downloading images if disk load fails

--- Funnier/FileCacher.cs
+++ Funnier/FileCacher.cs
@@ -35,29 +35,44 @@
             var path = builder.ToString();
             if (File.Exists(path))
             {
-                byte[] bytes = File.ReadAllBytes(path);
-                return NSData.FromArray(bytes);
+                try {
+                    byte[] bytes = File.ReadAllBytes(path);
+                    return NSData.FromArray(bytes);
+                } catch (Exception ex) {
+                    Console.WriteLine(ex);
+                    // okay, let's fall back to downloading the file
+                    if (downloadCacheMisses)
+                    {
+                        return FetchUrl(path, url);
+                    }
+                }
             }
             else if (downloadCacheMisses)
             {
-#if DEBUG
-                Console.WriteLine("FromUrl on thread {0}:{1}",
-                              System.Threading.Thread.CurrentThread.ManagedThreadId, System.Threading.Thread.CurrentThread.Name);
-#endif
-                try {
-                    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
-                    var data = NSData.FromUrl (new NSUrl (url));
-
-                    byte[] dataBytes = new byte[data.Length];
-
-                    System.Runtime.InteropServices.Marshal.Copy(data.Bytes, dataBytes, 0, Convert.ToInt32(data.Length));
-                    File.WriteAllBytes(path, dataBytes);
-                    return data;
-                } finally {
-                    UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
-                }
+                return FetchUrl(path, url);
             }
             return null;
+        }
+
+
+        private static NSData FetchUrl(string path, string url)
+        {
+#if DEBUG
+            Console.WriteLine("FromUrl on thread {0}:{1}",
+                          System.Threading.Thread.CurrentThread.ManagedThreadId, System.Threading.Thread.CurrentThread.Name);
+#endif
+            try {
+                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
+                var data = NSData.FromUrl (new NSUrl (url));
+
+                byte[] dataBytes = new byte[data.Length];
+
+                System.Runtime.InteropServices.Marshal.Copy(data.Bytes, dataBytes, 0, Convert.ToInt32(data.Length));
+                File.WriteAllBytes(path, dataBytes);
+                return data;
+            } finally {
+                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
+            }
         }
     }
 }


Finish merge.

Finish merge.

--- Sketchball/Program.cs
+++ Sketchball/Program.cs
@@ -29,8 +29,8 @@
             //f.Height = 500;

-            //Application.Run(new SelectionForm());
-            Application.Run(new PlayForm(new PinballMachine()) { Width = 800, Height = 700 });
+            Application.Run(new SelectionForm());
+            //Application.Run(new PlayForm(new PinballMachine()) { Width = 800, Height = 700 });

         }
     }


git-svn-id: http://localhost/svn/gear/trunk@53 f7f8973e-caa7-11de-a1cf-4bfa7bdbae30

--- GearEngine/Command.cs
+++ GearEngine/Command.cs
@@ -13,13 +13,6 @@
     /// </summary>
     public abstract class Command
     {
-        #region Methods
-        /// <summary>
-        /// When overridden in a derived class, performs the functionality associated with the current command.
-        /// </summary>
-        /// <param name="engine"></param>
-        public abstract void Execute(GameEngine engine);
-        #endregion
         #region Properties
         /// <summary>
         /// When implemented in a derived class, gets the <see cref="CommandId"/> of the current <see cref="Command"/>.
@@ -29,5 +22,12 @@
             get;
         }
         #endregion
+        #region Methods
+        /// <summary>
+        /// When overridden in a derived class, performs the functionality associated with the current command.
+        /// </summary>
+        /// <param name="engine"></param>
+        public abstract void Execute(GameEngine engine);
+        #endregion
     }
 }


Added material parameters for name, alphaCutoff and doubleSided to GLTFMaterial

--- Source/GLTFWrapper.cs
+++ Source/GLTFWrapper.cs
@@ -566,6 +566,13 @@
         /// </summary>
         public class GLTFMaterial
         {
+            /// <summary>
+            /// The user-defined name of this object
+            /// </summary>
+            public string name;
+            /// <summary>
+            /// A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering methodology
+            /// </summary>
             public GLTFMetallicRoughnessMaterial metallicRoughnessMaterial;
             /// <summary>
             /// Texture that contains tangent-space normal information
@@ -592,8 +599,16 @@
             /// </summary>
             public Vector4? emissiveFactor;

+            /// <summary>
+            /// Specifies whether the material is double sided
+            /// </summary>
+            public bool? doubleSided;
+
             public Material.AlphaModeEnum? alphaMode;
-
+            /// <summary>
+            /// The alpha cutoff value of the material
+            /// </summary>
+            public float? alphaCutoff;
             /// <summary>
             /// Adds a texture to the property components of the GLTFWrapper.
             /// </summary>
@@ -726,6 +741,18 @@
                 {
                     material.AlphaMode = alphaMode.Value;
                 }
+                if (alphaCutoff.HasValue)
+                {
+                    material.AlphaCutoff = alphaCutoff.Value;
+                }
+                if (name != null)
+                {
+                    material.Name = name;
+                }
+                if (doubleSided.HasValue)
+                {
+                    material.DoubleSided = doubleSided.Value;
+                }
                 return material;
             }


Move meshprimitive creation logic to mesh primitive wrapper

--- Source/GLTFWrapper.cs
+++ Source/GLTFWrapper.cs
@@ -60,129 +60,8 @@
                     foreach (GLTFMeshPrimitive meshPrimitive in mesh.meshPrimitives)
                     {
                         Dictionary<string, int> attributes = new Dictionary<string, int>();
-
-                        if (meshPrimitive.positions != null)
-                        {
-                            int bytelength = sizeof(float) * 3 * meshPrimitive.positions.Count();
-                            BufferView bufferView = new BufferView
-                            {
-                                Name = "Positions",
-                                Buffer = mesh_index,
-                                ByteLength = bytelength
-                            };
-                            if (byteOffset > 0)
-                            {
-                                bufferView.ByteOffset = byteOffset;
-
-                            }
-                            bufferViews.Add(bufferView);
-                            byteOffset += bytelength;
-
-                            //get the max and min values
-                            Vector3[] minMaxPositions = meshPrimitive.getMinMaxPositions();
-
-                            // Create Accessor
-                            Accessor accessor = new Accessor
-                            {
-                                Name = "Positions Accessor",
-                                BufferView = bufferViews.Count() - 1,
-                                ComponentType = Accessor.ComponentTypeEnum.FLOAT,
-                                Count = meshPrimitive.positions.Count(),
-                                Type = Accessor.TypeEnum.VEC3,
-                                Max = new[] { minMaxPositions[1].x, minMaxPositions[1].y, minMaxPositions[1].z },
-                                Min = new[] { minMaxPositions[0].x, minMaxPositions[0].y, minMaxPositions[0].z }
-                            };
-                            accessors.Add(accessor);
-                            geometryData.Writer.Write(meshPrimitive.positions.ToArray());
-                            attributes.Add("POSITION", accessors.Count() - 1);
-                        }
-                        if (meshPrimitive.normals != null)
-                        {
-                            // Create BufferView
-                            int bytelength = sizeof(float) * 3 * meshPrimitive.normals.Count();
-                            BufferView bufferView = new BufferView
-                            {
-                                Name = "Normals",
-                                Buffer = mesh_index,
-                                ByteLength = bytelength
-                            };
-                            if (byteOffset > 0)
-                            {
-                                bufferView.ByteOffset = byteOffset;
-
-                            }
-                            bufferViews.Add(bufferView);
-                            byteOffset += bytelength;
-
-                            //get the max and min values
-                            Vector3[] minMaxNormals = meshPrimitive.getMinMaxNormals();
-
-                            // Create Accessor
-                            Accessor accessor = new Accessor
-                            {
-                                Name = "Normals Accessor",
-                                BufferView = bufferViews.Count() - 1,
-                                ComponentType = Accessor.ComponentTypeEnum.FLOAT,
-                                Count = meshPrimitive.normals.Count(),
-                                Type = Accessor.TypeEnum.VEC3,
-                                Max = new[] { minMaxNormals[1].x, minMaxNormals[1].y, minMaxNormals[1].z },
-                                Min = new[] { minMaxNormals[0].x, minMaxNormals[0].y, minMaxNormals[0].z }
-                            };
-                            accessors.Add(accessor);
-                            attributes.Add("NORMAL", accessors.Count() - 1);
-                            geometryData.Writer.Write(meshPrimitive.normals.ToArray());
-                        }
-
-                        if (meshPrimitive.textureCoordSets != null)
-                        {
-                            //get the max and min values
-                            List<Vector2[]> minMaxTextureCoords = meshPrimitive.getMinMaxTextureCoords();
-
-                            for (int i = 0; i < meshPrimitive.textureCoordSets.Count; ++i)
-                            {
-                                List<Vector2> textureCoordSet = meshPrimitive.textureCoordSets[i];
-
-                                int bytelength = sizeof(float) * 2 * textureCoordSet.Count();
-                                BufferView bufferView = new BufferView
-                                {
-                                    Name = "texture coords " + (i + 1),
-                                    Buffer = mesh_index,
-                                    ByteLength = bytelength
-                                };
-                                if (byteOffset > 0)
-                                {
-                                    bufferView.ByteOffset = byteOffset;
-
-                                }
-                                bufferViews.Add(bufferView);
-                                byteOffset += bytelength;
-
-                                // Create Accessor
-                                Accessor accessor = new Accessor
-                                {
-                                    Name = "UV Accessor" + (i + 1),
-                                    BufferView = bufferViews.Count() - 1,
-                                    ComponentType = Accessor.ComponentTypeEnum.FLOAT,
-                                    Count = textureCoordSet.Count(),
-                                    Type = Accessor.TypeEnum.VEC2,
-                                    Max = new[] { minMaxTextureCoords[i][1].x, minMaxTextureCoords[i][1].y },
-                                    Min = new[] { minMaxTextureCoords[i][0].x, minMaxTextureCoords[i][0].y }
-                                };
-                                accessors.Add(accessor);
-                                attributes.Add("TEXCOORD_" + (i), accessors.Count() - 1);
-                                geometryData.Writer.Write(textureCoordSet.ToArray());
-                            }
-                        }
-                        MeshPrimitive mPrimitive = new MeshPrimitive
-                        {
-                            Attributes = attributes,
-                        };
-                        if (meshPrimitive.material != null)
-                        {
-                            Material material = meshPrimitive.material.createMaterial(samplers, images, textures);
-                            materials.Add(material);
-                            mPrimitive.Material = materials.Count() - 1;
-                        }
+                        MeshPrimitive mPrimitive = meshPrimitive.convertToMeshPrimitive(bufferViews, accessors, samplers, images, textures, materials, meshPrimitives, geometryData, ref byteOffset, mesh_index);
+
                         meshPrimitives.Add(mPrimitive);
                         glTFLoader.Schema.Buffer buffer = new glTFLoader.Schema.Buffer
                         {
@@ -499,6 +378,137 @@
                 }
                 Vector4[] results = { minVal, maxVal };
                 return results;
+            }
+
+            public MeshPrimitive convertToMeshPrimitive(List<BufferView> bufferViews, List<Accessor> accessors, List<Sampler> samplers, List<Image> images, List<Texture> textures, List<Material> materials, List<MeshPrimitive> meshPrimitives, Data geometryData, ref int byteOffset, int mesh_index)
+            {
+                Dictionary<string, int> attributes = new Dictionary<string, int>();
+
+                if (positions != null)
+                {
+                    int bytelength = sizeof(float) * 3 * positions.Count();
+                    BufferView bufferView = new BufferView
+                    {
+                        Name = "Positions",
+                        Buffer = mesh_index,
+                        ByteLength = bytelength
+                    };
+                    if (byteOffset > 0)
+                    {
+                        bufferView.ByteOffset = byteOffset;
+
+                    }
+                    bufferViews.Add(bufferView);
+                    byteOffset += bytelength;
+
+                    //get the max and min values
+                    Vector3[] minMaxPositions = getMinMaxPositions();
+
+                    // Create Accessor
+                    Accessor accessor = new Accessor
+                    {
+                        Name = "Positions Accessor",
+                        BufferView = bufferViews.Count() - 1,
+                        ComponentType = Accessor.ComponentTypeEnum.FLOAT,
+                        Count = positions.Count(),
+                        Type = Accessor.TypeEnum.VEC3,
+                        Max = new[] { minMaxPositions[1].x, minMaxPositions[1].y, minMaxPositions[1].z },
+                        Min = new[] { minMaxPositions[0].x, minMaxPositions[0].y, minMaxPositions[0].z }
+                    };
+                    accessors.Add(accessor);
+                    geometryData.Writer.Write(positions.ToArray());
+                    attributes.Add("POSITION", accessors.Count() - 1);
+                }
+                if (normals != null)
+                {
+                    // Create BufferView
+                    int bytelength = sizeof(float) * 3 * normals.Count();
+                    BufferView bufferView = new BufferView
+                    {
+                        Name = "Normals",
+                        Buffer = mesh_index,
+                        ByteLength = bytelength
+                    };
+                    if (byteOffset > 0)
+                    {
+                        bufferView.ByteOffset = byteOffset;
+
+                    }
+                    bufferViews.Add(bufferView);
+                    byteOffset += bytelength;
+
+                    //get the max and min values
+                    Vector3[] minMaxNormals = getMinMaxNormals();
+
+                    // Create Accessor
+                    Accessor accessor = new Accessor
+                    {
+                        Name = "Normals Accessor",
+                        BufferView = bufferViews.Count() - 1,
+                        ComponentType = Accessor.ComponentTypeEnum.FLOAT,
+                        Count = normals.Count(),
+                        Type = Accessor.TypeEnum.VEC3,
+                        Max = new[] { minMaxNormals[1].x, minMaxNormals[1].y, minMaxNormals[1].z },
+                        Min = new[] { minMaxNormals[0].x, minMaxNormals[0].y, minMaxNormals[0].z }
+                    };
+                    accessors.Add(accessor);
+                    attributes.Add("NORMAL", accessors.Count() - 1);
+                    geometryData.Writer.Write(normals.ToArray());
+                }
+
+                if (textureCoordSets != null)
+                {
+                    //get the max and min values
+                    List<Vector2[]> minMaxTextureCoords = getMinMaxTextureCoords();
+
+                    for (int i = 0; i < textureCoordSets.Count; ++i)
+                    {
+                        List<Vector2> textureCoordSet = textureCoordSets[i];
+
+                        int bytelength = sizeof(float) * 2 * textureCoordSet.Count();
+                        BufferView bufferView = new BufferView
+                        {
+                            Name = "texture coords " + (i + 1),
+                            Buffer = mesh_index,
+                            ByteLength = bytelength
+                        };
+                        if (byteOffset > 0)
+                        {
+                            bufferView.ByteOffset = byteOffset;
+
+                        }
+                        bufferViews.Add(bufferView);
+                        byteOffset += bytelength;
+
+                        // Create Accessor
+                        Accessor accessor = new Accessor
+                        {
+                            Name = "UV Accessor" + (i + 1),
+                            BufferView = bufferViews.Count() - 1,
+                            ComponentType = Accessor.ComponentTypeEnum.FLOAT,
+                            Count = textureCoordSet.Count(),
+                            Type = Accessor.TypeEnum.VEC2,
+                            Max = new[] { minMaxTextureCoords[i][1].x, minMaxTextureCoords[i][1].y },
+                            Min = new[] { minMaxTextureCoords[i][0].x, minMaxTextureCoords[i][0].y }
+                        };
+                        accessors.Add(accessor);
+                        attributes.Add("TEXCOORD_" + (i), accessors.Count() - 1);
+                        geometryData.Writer.Write(textureCoordSet.ToArray());
+                    }
+                }
+                MeshPrimitive mPrimitive = new MeshPrimitive
+                {
+                    Attributes = attributes,
+                };
+                if (material != null)
+                {
+                    Material nMaterial = material.createMaterial(samplers, images, textures);
+                    materials.Add(nMaterial);
+                    mPrimitive.Material = materials.Count() - 1;
+                }
+
+                return mPrimitive;
+
             }
         }


Update ReadByte()

Update ReadByte()

--- Iced/Intel/Decoder.cs
+++ Iced/Intel/Decoder.cs
@@ -205,18 +205,16 @@

 		internal uint ReadByte() {
 			uint instrLen = state.instructionLength;
-			if (instrLen >= DecoderConstants.MaxInstructionLength) {
-				state.flags |= StateFlags.IsInvalid;
-				return 0;
-			}
-			uint b = (uint)reader.ReadByte();
-			Debug.Assert(b <= byte.MaxValue || b > int.MaxValue);
-			if (b > byte.MaxValue) {
-				state.flags |= StateFlags.IsInvalid;
-				return 0;
-			}
-			state.instructionLength = instrLen + 1;
-			return b;
+			if (instrLen < DecoderConstants.MaxInstructionLength) {
+				uint b = (uint)reader.ReadByte();
+				Debug.Assert(b <= byte.MaxValue || b > int.MaxValue);
+				if (b <= byte.MaxValue) {
+					state.instructionLength = instrLen + 1;
+					return b;
+				}
+			}
+			state.flags |= StateFlags.IsInvalid;
+			return 0;
 		}

 		[MethodImpl(MethodImplOptions.AggressiveInlining)]


Code layout

Code layout

Move the indexer up with the other properties.

--- InfiniMap/ChunkMap.cs
+++ InfiniMap/ChunkMap.cs
@@ -22,6 +22,12 @@

         public int Count { get { return _map.Values.Sum(c => c.Count); } }

+        public T this[int x, int y]
+        {
+            get { return Get(x, y); }
+            set { Put(x, y, value); }
+        }
+
         public bool Contains(T item)
         {
             return _map.Values.Any(chunk => chunk.Contains(item));
@@ -69,12 +75,6 @@
         {
             var chunk = GetChunk(x, y);
             chunk[x, y] = block;
-        }
-
-        public T this[int x, int y]
-        {
-            get { return Get(x, y); }
-            set { Put(x, y, value); }
         }

         private class Chunk<T> : IEnumerable<T>


fix build

fix build

--- JoinCSharp/Program.cs
+++ JoinCSharp/Program.cs
@@ -16,13 +16,13 @@
             var inputDirectory = args[0];
             if (!Directory.Exists(inputDirectory))
             {
-                Console.WriteLine($"{inputDirectory}: directory not found");
+                Console.WriteLine("{0}: directory not found", inputDirectory);
                 return 1;
             }
             var files = Directory.GetFiles(inputDirectory, "*.cs", SearchOption.AllDirectories);
             if (!files.Any())
             {
-                Console.WriteLine($"No .cs files found in folder {inputDirectory}");
+                Console.WriteLine("No .cs files found in folder {0}", inputDirectory);
                 return 1;
             }


Keep track of plugin setting dialogs in a Dictionary so that they don't

2007-04-19  Boyd Timothy <btimothy@novell.com>

        * Tomboy/Preferences.cs: Keep track of plugin setting dialogs in
          a Dictionary so that they don't have to be modal dialogs.

svn path=/trunk/; revision=1119

--- Tomboy/Preferences.cs
+++ Tomboy/Preferences.cs
@@ -1,5 +1,6 @@

 using System;
+using System.Collections.Generic;
 using Mono.Unix;
 using GConf.PropertyEditors;

@@ -156,6 +157,10 @@
 		Gtk.TextView plugin_filename;

 		Gtk.Button plugin_preferences;
+		// Keep track of the opened plugin settings dialogs so other windows
+		// can be interacted with (as opposed to opening these as modal
+		// dialogs).
+		Dictionary<PluginInfoAttribute, Gtk.Dialog> plugin_dialogs;

 		public PreferencesDialog (PluginManager plugin_manager)
 			: base ()
@@ -170,7 +175,9 @@

 			VBox.Spacing = 5;
 			ActionArea.Layout = Gtk.ButtonBoxStyle.End;
-
+
+			plugin_dialogs =
+				new Dictionary<PluginInfoAttribute, Gtk.Dialog> ();

 			// Notebook Tabs (Editing, Hotkeys)...

@@ -673,38 +680,70 @@
 			if (current_plugin == null)
 				return;

-			Gtk.Image icon =
-				new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Dialog);
-
-			Gtk.Label caption = new Gtk.Label();
-			caption.Markup = MakePluginTitle ();
-			caption.Xalign = 0;
-
-			Gtk.Widget preferences =
-				PluginManager.CreatePreferencesWidget (plugin_info);
-
-			Gtk.HBox hbox = new Gtk.HBox (false, 6);
-			Gtk.VBox vbox = new Gtk.VBox (false, 6);
-			vbox.BorderWidth = 6;
-
-			hbox.PackStart (icon, false, false, 0);
-			hbox.PackStart (caption, true, true, 0);
-			vbox.PackStart (hbox, false, false, 0);
-
-			vbox.PackStart (preferences, true, true, 0);
-			vbox.ShowAll ();
-
-			Gtk.Dialog dialog = new Gtk.Dialog (
-				string.Format (Catalog.GetString ("{0} Settings"),
-					       plugin_info.Name),
-				this,
-				Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.NoSeparator,
-				Gtk.Stock.Close, Gtk.ResponseType.Close);
-
-			dialog.VBox.PackStart (vbox, true, true, 0);
-
-			dialog.Run ();
-			dialog.Destroy();
+			Gtk.Dialog dialog = null;
+			if (plugin_dialogs.ContainsKey (plugin_info) == false) {
+				// This dialog isn't open already so create a new one
+				Gtk.Image icon =
+					new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Dialog);
+
+				Gtk.Label caption = new Gtk.Label();
+				caption.Markup = MakePluginTitle ();
+				caption.Xalign = 0;
+
+				Gtk.Widget preferences =
+					PluginManager.CreatePreferencesWidget (plugin_info);
+
+				Gtk.HBox hbox = new Gtk.HBox (false, 6);
+				Gtk.VBox vbox = new Gtk.VBox (false, 6);
+				vbox.BorderWidth = 6;
+
+				hbox.PackStart (icon, false, false, 0);
+				hbox.PackStart (caption, true, true, 0);
+				vbox.PackStart (hbox, false, false, 0);
+
+				vbox.PackStart (preferences, true, true, 0);
+				vbox.ShowAll ();
+
+				dialog = new Gtk.Dialog (
+					string.Format (Catalog.GetString ("{0} Settings"),
+						       plugin_info.Name),
+					this,
+					Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.NoSeparator,
+					Gtk.Stock.Close, Gtk.ResponseType.Close);
+
+				dialog.VBox.PackStart (vbox, true, true, 0);
+				dialog.DeleteEvent += PluginDialogDeleted;
+				dialog.Response += PluginDialogResponse;
+
+				// Store it off in our dictionary so we can present it again
+				dialog.Data ["PluginInfoAttribute"] = plugin_info;
+				plugin_dialogs [plugin_info] = dialog;
+			} else {
+				// It's already opened so just present it again
+				dialog = plugin_dialogs [plugin_info] as Gtk.Dialog;
+			}
+
+			dialog.Present ();
+		}
+
+		[GLib.ConnectBefore]
+		void PluginDialogDeleted (object sender, Gtk.DeleteEventArgs args)
+		{
+			// Remove the plugin_info from the plugin_dialogs Dictionary
+			Gtk.Dialog dialog = sender as Gtk.Dialog;
+			dialog.Hide ();
+
+			if (dialog.Data.ContainsKey ("PluginInfoAttribute")) {
+				plugin_dialogs.Remove (
+					dialog.Data ["PluginInfoAttribute"] as PluginInfoAttribute);
+			}
+
+			dialog.Destroy ();
+		}
+
+		void PluginDialogResponse (object sender, Gtk.ResponseArgs args)
+		{
+			PluginDialogDeleted (sender, null);
 		}

 		void SetupPropertyEditor (PropertyEditor peditor)


Fixed JoinChannel, also some refactoring

--- Twitchie2/Twitchie.cs
+++ Twitchie2/Twitchie.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Net.Sockets;
@@ -22,6 +21,7 @@
 		public List<TwitchIrcChannel> Channels { get; }
 		public ChatAccount Account { get; private set; }

+		#region Events
 		public event EventHandler<RawMessageEventArgs> OnRawMessage;
 		public event EventHandler<MessageEventArgs> OnMessage;
 		public event EventHandler<RoomStateEventArgs> OnRoomState;
@@ -33,6 +33,7 @@
 		public event EventHandler<ClearChatEventArgs> OnClearChat;
 		public event EventHandler<UserNoticeEventArgs> OnUserNotice;
 		public event EventHandler<MessageEventArgs> OnMention;
+		#endregion

 		public Twitchie() : base()
 		{
@@ -55,21 +56,18 @@
 			}
 			catch (SocketException ex)
 			{
-#if DEBUG
-				Debug.WriteLine(ex.Message);
-#endif
+				throw ex;
 			}
 		}

 		public void AddChannels(IEnumerable<TwitchIrcChannel> channels) => Channels.AddRange(channels);

 		public void AddChannel(TwitchIrcChannel channel) => Channels.Add(channel);
+
 		public void AddChannel(string channel) => Channels.Add(new TwitchIrcChannel(channel));

 		public void Login(ChatAccount account)
-		{
-			Login(account.Nickname, account.OauthToken);
-		}
+			=> Login(account.Nickname, account.OauthToken);

 		public void Login(string nickname, string password)
 		{
@@ -182,11 +180,17 @@
 		public void JoinChannel(string name)
 		{
 			var channel = Channels.FirstOrDefault(x => x.Name == name);
-			if (channel != null)
+			if (channel == null)
+			{
+				channel = new TwitchIrcChannel(name);
+
+				channel.Join();
+				Channels.Add(channel);
 				return;
-
-			channel.Join();
-			Channels.Add(channel);
+			}
+
+			if (!channel.Joined)
+				channel.Join();
 		}

 		public void Disconnect()
@@ -208,6 +212,8 @@
 				cts?.Dispose();
 				tcpClient?.Dispose();

+				Channels.Clear();
+
 				base.Dispose();
 			}
 		}


Added GetDna by System.Type to recipe and data

--- UMADLL/UMA/UMAData.cs
+++ UMADLL/UMA/UMAData.cs
@@ -195,6 +195,16 @@
 				return null;
 			}

+			public UMADnaBase GetDna(Type type)
+			{
+				UMADnaBase dna;
+				if(umaDna.TryGetValue(type, out dna))
+				{
+					return dna;
+				}
+				return null;
+			}
+
             public T GetOrCreateDna<T>()
                 where T : UMADnaBase
             {
@@ -504,6 +514,11 @@
 			return umaRecipe.GetAllDna();
 		}

+		public UMADnaBase GetDna(Type type)
+		{
+			return umaRecipe.GetDna(type);
+		}
+
 		public T GetDna<T>()
             where T : UMADnaBase
 	    {


ユニットテストを追加

ユニットテストを追加

まだGetPagesを実装していないのでビルドはできません

--- UnitTest/Sdx/Pager.cs
+++ UnitTest/Sdx/Pager.cs
@@ -7,6 +7,7 @@
 using System.Linq;
 using System.Globalization;
 using System.Reflection;
+using System.Collections.Generic;

 #if ON_VISUAL_STUDIO
 using FactAttribute = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
@@ -89,5 +90,34 @@
       Assert.False(pager.HasNext);
       Assert.True(pager.HasPrev);
     }
+
+    [Fact]
+    public void TestPages()
+    {
+      var perPage = 3;
+      var totalCount = 35;
+      var pager = new Sdx.Pager(perPage, totalCount);
+      pager.SetPage("5");
+
+      var numberList = new List<int>(){};
+      var isCurrentList = new List<bool>(){};
+
+      pager.GetPages(5).ForEach(page => {
+        numberList.Add(page.page);
+        isCurrentList.Add(page.is_current);
+      });
+
+      Assert.Equal(3, numberList[0]);
+      Assert.Equal(4, numberList[1]);
+      Assert.Equal(5, numberList[2]);
+      Assert.Equal(6, numberList[3]);
+      Assert.Equal(7, numberList[4]);
+
+      Assert.Equal(false, isCurrentList[0]);
+      Assert.Equal(false, isCurrentList[1]);
+      Assert.Equal(true, isCurrentList[2]);
+      Assert.Equal(false, isCurrentList[3]);
+      Assert.Equal(false, isCurrentList[4]);
+    }
   }
 }


correct naming

correct naming

--- Warden/Windows/Api.cs
+++ Warden/Windows/Api.cs
@@ -189,6 +189,28 @@
         private static int GetWinLogonId(ref uint sessionId)
         {
             foreach (var p in Process.GetProcessesByName("winlogon"))
+            {
+                try
+                {
+                    if (p.SessionId != sessionId) continue;
+                    return p.Id;
+                }
+                catch
+                {
+                    // Ignore forbidden processes so we can get a list of processes we do have access to
+                }
+            }
+            return 0;
+        }
+
+        /// <summary>
+        /// Finds the WinLogon process ID for the active session
+        /// </summary>
+        /// <param name="sessionId"></param>
+        /// <returns></returns>
+        private static int GetExplorerId(ref uint sessionId)
+        {
+            foreach (var p in Process.GetProcessesByName("explorer"))
             {
                 try
                 {
@@ -340,7 +362,7 @@
             var startInfo = new STARTUPINFO();
             var procInfo = new PROCESS_INFORMATION();
             var pEnv = IntPtr.Zero;
-            IntPtr explorerToken = IntPtr.Zero, hPToken = IntPtr.Zero, hProcess = IntPtr.Zero;
+            IntPtr winLogonToken = IntPtr.Zero, hPToken = IntPtr.Zero, hProcess = IntPtr.Zero;
             startInfo.cb = Marshal.SizeOf(typeof(STARTUPINFO));
             try
             {
@@ -364,18 +386,18 @@
                     throw new WardenLaunchException("CreateEnvironmentBlock failed.");
                 }

-                var explorerId = GetWinLogonId(ref activeSessionId);
-                if (explorerId == 0)
-                {
-                    throw new WardenLaunchException("Finding Explorer process ID failed.");
+                var winLogonId = GetWinLogonId(ref activeSessionId);
+                if (winLogonId == 0)
+                {
+                    throw new WardenLaunchException("Finding WinLogon process ID failed.");
                 }

                 // obtain a handle to the winlogon process
-                hProcess = OpenProcess(MAXIMUM_ALLOWED, false, (uint) explorerId);
+                hProcess = OpenProcess(MAXIMUM_ALLOWED, false, (uint) winLogonId);
                 // obtain a handle to the access token of the winlogon process
                 if (!OpenProcessToken(hProcess, TOKEN_ALL_ACCESS, ref hPToken))
                 {
-                    throw new WardenLaunchException("failed to open explorer process token.");
+                    throw new WardenLaunchException("failed to open WinLogon process token.");
                 }

@@ -387,14 +409,16 @@
                 var sa = new SECURITY_ATTRIBUTES();
                 sa.Length = Marshal.SizeOf(sa);

+
                 // copy the access token of the explorer process; the newly created token will be a primary token
-                if (!DuplicateTokenEx(hPToken, MAXIMUM_ALLOWED, ref sa, (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, (int)TokenType.Primary, ref explorerToken))
+                if (!DuplicateTokenEx(hPToken, MAXIMUM_ALLOWED, ref sa, (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, (int)TokenType.Primary, ref winLogonToken))
                 {
                     throw new WardenLaunchException("Unable to duplicate security token");
                 }

+                var d = IntPtr.Zero;
                 // create a new process in the current user's logon session
-                if (!CreateProcessAsUser(explorerToken,
+                if (!CreateProcessAsUser(winLogonToken,
                     appPath, // file to execute
                     arguments,  // command line
                     ref sa, // pointer to process SECURITY_ATTRIBUTES
@@ -418,7 +442,7 @@
                 CloseHandle(hProcess);
                 CloseHandle(hPToken);
                 CloseHandle(hUserToken);
-                CloseHandle(explorerToken);
+                CloseHandle(winLogonToken);
                 if (pEnv != IntPtr.Zero)
                 {
                     DestroyEnvironmentBlock(pEnv);


Got rid of another unnecessary use of IsInitializing

--- MimeKit/MimeEntity.cs
+++ MimeKit/MimeEntity.cs
@@ -141,11 +141,6 @@
 			set {
 				if (disposition == value)
 					return;
-
-				if (IsInitializing) {
-					disposition = value;
-					return;
-				}

 				if (disposition != null) {
 					disposition.Changed -= ContentDispositionChanged;


update

update

--- Week8.Demo/Program.cs
+++ Week8.Demo/Program.cs
@@ -15,7 +15,6 @@
         static List<Car> LireVoitures()
         {
             List<Car> voitures = new List<Car>();
-
             bool lectureTermine = false; //la lecture n'est pas terminée
             while (!lectureTermine) //tant que la lecture n'est pas terminée
             {
@@ -42,11 +41,11 @@
                 }
                 catch (InvalidColorException ex)
                 {
-                    Console.WriteLine("Couleur invalide!");
+                    Console.WriteLine("Couleur invalide!\n" + ex.Message);
                 }
                 catch (InvalidModelException ex)
                 {
-                    Console.WriteLine("Modele invalide!");
+                    Console.WriteLine("Modele invalide!\n" + ex.Message);
                 }
                 catch (Exception ex)
                 {


YAMLParser: remove main thread sleep hack from a few years ago

As YAMLParser isn't parallel, and the file operations close before returning, this SHOULD NOT have ever been necessary.
On one(?) host, there were bugs that this resolved.
It would occasionally threw exceptions without sleeps between successive file operations.
It didn't/doesn't make sense to me, either... but... stopped happening with these shenanigans in place.

If YAMLParser starts throwing exceptions after this, open a ticket.

--- YAMLParser/Program.cs
+++ YAMLParser/Program.cs
@@ -121,7 +121,6 @@
                     try
                     {
                         File.Delete(s);
-                        Thread.Sleep(100);
                     }
                     catch (Exception e)
                     {
@@ -145,7 +144,6 @@
                     try
                     {
                         File.Delete(s);
-                        Thread.Sleep(100);
                     }
                     catch (Exception e)
                     {
@@ -169,26 +167,21 @@
             foreach (MsgsFile file in files)
             {
                 file.Write(outputdir);
-                Thread.Sleep(10);
             }
             foreach (SrvsFile file in srvfiles)
             {
                 file.Write(outputdir);
-                Thread.Sleep(10);
             }
             File.WriteAllText(outputdir + "\\MessageTypes.cs", ToString().Replace("FauxMessages", "Messages"));
-            Thread.Sleep(100);
         }

         public static void GenerateProject(List<MsgsFile> files, List<SrvsFile> srvfiles, bool istemp)
         {
             if (!Directory.Exists((istemp ? outputdir : outputdir) + "\\Properties"))
                 Directory.CreateDirectory((istemp ? outputdir : outputdir) + "\\Properties");
-            Thread.Sleep(10);
             File.WriteAllText((istemp ? outputdir : outputdir) + "\\SerializationHelper.cs", Templates.SerializationHelper);
             File.WriteAllText((istemp ? outputdir : outputdir) + "\\Interfaces.cs", Templates.Interfaces);
             File.WriteAllText((istemp ? outputdir : outputdir) + "\\Properties\\AssemblyInfo.cs", Templates.AssemblyInfo);
-            Thread.Sleep(100);
             string[] lines = Templates.MessagesProj.Split('\n');
             string output = "";
             for (int i = 0; i < lines.Length; i++)
@@ -219,7 +212,6 @@
             }
             File.WriteAllText((istemp ? (outputdir + "\\" + name + ".csproj") : (outputdir + "\\" + name + ".csproj")), output);
             File.WriteAllText((istemp ? outputdir : outputdir) + "\\.gitignore", "*");
-            Thread.Sleep(100);
         }

         private static string __where_be_at_my_vc____is;