Return cached task at synchronous completion

--- src/System.IO.FileSystem/src/System/IO/Win32FileStream.cs
+++ src/System.IO.FileSystem/src/System/IO/Win32FileStream.cs
@@ -577,7 +577,7 @@
 #if USE_OVERLAPPED
             if (_isAsync)
             {
-                Task<int> writeTask = WriteInternalCoreAsync(_buffer, 0, _writePos, CancellationToken.None);
+                Task writeTask = WriteInternalCoreAsync(_buffer, 0, _writePos, CancellationToken.None);
                 // With our Whidbey async IO & overlapped support for AD unloads,
                 // we don't strictly need to block here to release resources
                 // since that support takes care of the pinning & freeing the
@@ -1394,7 +1394,7 @@
         }

         [System.Security.SecuritySafeCritical]  // auto-generated
-        unsafe private Task<int> WriteInternalCoreAsync(byte[] bytes, int offset, int numBytes, CancellationToken cancellationToken)
+        private unsafe Task WriteInternalCoreAsync(byte[] bytes, int offset, int numBytes, CancellationToken cancellationToken)
         {
             Debug.Assert(!_handle.IsClosed, "!_handle.IsClosed");
             Debug.Assert(_parent.CanWrite, "_parent.CanWrite");
@@ -1458,9 +1458,10 @@
                 // For pipes, when they are closed on the other side, they will come here.
                 if (errorCode == ERROR_NO_DATA)
                 {
-                    // Not an error, but EOF.  AsyncFSCallback will NOT be
-                    // called.  Call the user callback here.
+                    // Not an error, but EOF. AsyncFSCallback will NOT be called.
+                    // Completing TCS and return cached task allowing the GC to collect TCS.
                     completionSource.SetCompletedSynchronously(0);
+                    return Task.CompletedTask;
                 }
                 else if (errorCode != ERROR_IO_PENDING)
                 {


Optimize recursion of System.Net.Http.HttpRuleParser.GetExpressionLength (#35959)

Optimize recursion of System.Net.Http.HttpRuleParser.GetExpressionLength

--- src/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs
+++ src/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs
@@ -12,7 +12,7 @@
     internal static class HttpRuleParser
     {
         private static readonly bool[] s_tokenChars = CreateTokenChars();
-        private const int maxNestedCount = 5;
+        private const int MaxNestedCount = 5;

         internal const char CR = (char)13;
         internal const char LF = (char)10;
@@ -306,14 +306,12 @@

         internal static HttpParseResult GetCommentLength(string input, int startIndex, out int length)
         {
-            int nestedCount = 0;
-            return GetExpressionLength(input, startIndex, '(', ')', true, ref nestedCount, out length);
+            return GetExpressionLength(input, startIndex, '(', ')', true, 1, out length);
         }

         internal static HttpParseResult GetQuotedStringLength(string input, int startIndex, out int length)
         {
-            int nestedCount = 0;
-            return GetExpressionLength(input, startIndex, '"', '"', false, ref nestedCount, out length);
+            return GetExpressionLength(input, startIndex, '"', '"', false, 1, out length);
         }

         // quoted-pair = "\" CHAR
@@ -354,7 +352,7 @@
         // comments, resulting in a stack overflow exception. In addition having more than 1 nested comment (if any)
         // is unusual.
         private static HttpParseResult GetExpressionLength(string input, int startIndex, char openChar,
-            char closeChar, bool supportsNesting, ref int nestedCount, out int length)
+            char closeChar, bool supportsNesting, int nestedCount, out int length)
         {
             Debug.Assert(input != null);
             Debug.Assert((startIndex >= 0) && (startIndex < input.Length));
@@ -385,43 +383,35 @@
                 // If we support nested expressions and we find an open-char, then parse the nested expressions.
                 if (supportsNesting && (input[current] == openChar))
                 {
-                    nestedCount++;
-                    try
+                    // Check if we exceeded the number of nested calls.
+                    if (nestedCount > MaxNestedCount)
                     {
-                        // Check if we exceeded the number of nested calls.
-                        if (nestedCount > maxNestedCount)
-                        {
+                        return HttpParseResult.InvalidFormat;
+                    }
+
+                    int nestedLength = 0;
+                    HttpParseResult nestedResult = GetExpressionLength(input, current, openChar, closeChar,
+                        supportsNesting, nestedCount + 1, out nestedLength);
+
+                    switch (nestedResult)
+                    {
+                        case HttpParseResult.Parsed:
+                            current += nestedLength; // Add the length of the nested expression and continue.
+                            break;
+
+                        case HttpParseResult.NotParsed:
+                            Debug.Fail("'NotParsed' is unexpected: We started nested expression " +
+                                "parsing, because we found the open-char. So either it's a valid nested " +
+                                "expression or it has invalid format.");
+                            break;
+
+                        case HttpParseResult.InvalidFormat:
+                            // If the nested expression is invalid, we can't continue, so we fail with invalid format.
                             return HttpParseResult.InvalidFormat;
-                        }
-
-                        int nestedLength = 0;
-                        HttpParseResult nestedResult = GetExpressionLength(input, current, openChar, closeChar,
-                            supportsNesting, ref nestedCount, out nestedLength);
-
-                        switch (nestedResult)
-                        {
-                            case HttpParseResult.Parsed:
-                                current += nestedLength; // Add the length of the nested expression and continue.
-                                break;
-
-                            case HttpParseResult.NotParsed:
-                                Debug.Fail("'NotParsed' is unexpected: We started nested expression " +
-                                    "parsing, because we found the open-char. So either it's a valid nested " +
-                                    "expression or it has invalid format.");
-                                break;
-
-                            case HttpParseResult.InvalidFormat:
-                                // If the nested expression is invalid, we can't continue, so we fail with invalid format.
-                                return HttpParseResult.InvalidFormat;
-
-                            default:
-                                Debug.Fail("Unknown enum result: " + nestedResult);
-                                break;
-                        }
-                    }
-                    finally
-                    {
-                        nestedCount--;
+
+                        default:
+                            Debug.Fail("Unknown enum result: " + nestedResult);
+                            break;
                     }

                     // after nested call we continue with parsing


[modify]: Script->Robot.Commandへの変換を書いてる

--- block-program/Communication/CommunicationService.cs
+++ block-program/Communication/CommunicationService.cs
@@ -28,7 +28,8 @@
                 this.RobotPort.PortName = value;
             }
         }
-        public Script RobotScript { get; private set; }
+        private Dictionary<Command, List<InstructionBlock>> _robotScript;
+        private Command _currentInstructionType;
         private bool _isRunning = false;
         public bool IsRunning
         {
@@ -57,6 +58,7 @@
                 StopBits = STOPBITS
             };
             this.RobotPortName = portname;
+            this._robotScript = new Dictionary<Command, List<InstructionBlock>>();
             this.RobotPort.DataReceived += DataReceived;
         }

@@ -78,6 +80,11 @@
             string indata = port.ReadExisting();
             byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(indata);
             var packet = new Robot.Robot2PcPacket(data);
+            this.UpdateCurrentCommand(packet.SensorID, packet.SensorValue);
+        }
+
+        private void UpdateCurrentCommand(byte sensorID, ushort sensorValue)
+        {
         }

         protected void Do(Robot.Command command)
@@ -89,6 +96,18 @@
             }
         }

+        private void RunLoop()
+        {
+            while (this.IsRunning)
+            {
+                var script = this._robotScript;
+                var currentInstruction = this._currentInstructionType;
+                foreach(var instruction in this._robotScript[currentInstruction])
+                {
+                }
+            }
+        }
+
         private async void RunAsync()
         {
             try
@@ -96,28 +115,33 @@
                 this.RobotPort.Open();
                 this.IsRunning = this.RobotPort.IsOpen;
             }
-            catch(Exception e)
+            catch(Exception)
             {
                 return;
             }
             await Task.Run(() =>
             {
-                while (this.IsRunning)
-                {
-                    var script = this.RobotScript;
-                    foreach(var routine in this.RobotScript.Routines)
-                    {
-                        routine.
-                    }
-                }
+                this.RunLoop();
             });
-            this.RobotPort.Close();
-
+            this.RobotPort.Close();
+        }
+
+        private Dictionary<Command, List<InstructionBlock>> LoadScript(Myxini.Recognition.Script script)
+        {
+            var dst = new Dictionary<Command, List<InstructionBlock>>();
+            foreach(var routine in script.Routines)
+            {
+                dst.Add(
+                    routine.Trigger.CommandIdentification,
+                    new List<InstructionBlock>(routine.Instructions)
+                );
+            }
+            return dst;
         }

         public void Run(Myxini.Recognition.Script script)
         {
-            this.RobotScript = script;
+            this._robotScript = this.LoadScript(script);
             this.RunAsync();
         }


[fix]: つづり訂正

[fix]: つづり訂正

スペル間違ってたので修正しました

--- block-program/Communication/Robot/Pc2RobotPacket.cs
+++ block-program/Communication/Robot/Pc2RobotPacket.cs
@@ -11,7 +11,7 @@
         enum PacketIndex : int
         {
             HEAD_HIGH = 0,
-            HEAD_LOw,
+            HEAD_LOW,
             ROBOT_ID,
             INTERRUPT_COMAND_ID,
             PROP1,
@@ -32,12 +32,12 @@
         {
             get
             {
-                return (UInt16)(((UInt16)(((UInt16)this._packetData[(int)PacketIndex.HEAD_HIGH]) << 8 )) & ((UInt16)this._packetData[(int)PacketIndex.HEAD_LOw]));
+                return (UInt16)(((UInt16)(((UInt16)this._packetData[(int)PacketIndex.HEAD_HIGH]) << 8 )) & ((UInt16)this._packetData[(int)PacketIndex.HEAD_LOW]));
             }
             set
             {
                 this._packetData[(int)PacketIndex.HEAD_HIGH] = (byte)((value >> 8) & 0xff);
-                this._packetData[(int)PacketIndex.HEAD_LOw] = (byte)(value & 0xff);
+                this._packetData[(int)PacketIndex.HEAD_LOW] = (byte)(value & 0xff);
             }
         }
         public byte RobotID


refactor, rename

refactor, rename

--- EyeshotBugs/Bug13207.cs
+++ EyeshotBugs/Bug13207.cs
@@ -17,7 +17,7 @@
     public class Bug13207
     {
         [Fact]
-        public async void GridBoxSizeChangesRandomly()
+        public async void GridBorderChanges()
         {
             await Eyeshot.RunSTADesktop
             (async () =>


Fix crashes on 32bit devices

Fix crashes on 32bit devices

--- Facebook.iOS/build.cake
+++ Facebook.iOS/build.cake
@@ -244,7 +244,7 @@

 void BuildSdkOnPodfile (Artifact artifact)
 {
-	var platforms = new [] { Platform.iOSArm64, Platform.iOSArmV7, Platform.iOSSimulator64, Platform.iOSSimulator };
+	var platforms = new [] { baseBuildArch, Platform.iOSArm64, Platform.iOSSimulator64, Platform.iOSSimulator };

 	var podsProject = "./Pods/Pods.xcodeproj";
 	var workingDirectory = $"./externals/{artifact.Id}";


clean up

clean up

--- Fody/MethodProcessor.cs
+++ Fody/MethodProcessor.cs
@@ -9,9 +9,7 @@
 {
    public  ReferenceFinder ReferenceFinder;
    public TypeSystem TypeSystem;
-
     public InterceptorFinder InterceptorFinder;
-
     public MethodDefinition Method;
     MethodBody body;
     ILProcessor ilProcessor;
@@ -20,7 +18,7 @@
     {
         try
         {
-            InnerProcessNonVoid();
+            InnerProcess();
         }
         catch (Exception exception)
         {
@@ -28,34 +26,20 @@
         }
     }

-    void InnerProcessNonVoid()
+    void InnerProcess()
     {
         body = Method.Body;
         body.SimplifyMacros();
         ilProcessor = body.GetILProcessor();
-
-        var instructions = body.Instructions;
-
+
         var returnInstruction = FixReturns();

-        Instruction firstInstruction;
-        if (Method.IsConstructor)
-        {
-            firstInstruction = instructions.Skip(2).First();
-        }
-        else
-        {
-            firstInstruction = instructions.First();
-        }
-
+        var firstInstruction = FirstInstructionSkipCtor();
+
         var beforeReturn = Instruction.Create(OpCodes.Nop);
         ilProcessor.InsertBefore(returnInstruction, beforeReturn);

-        var stopwatchVar = InjectStopwatch();
-
-        var writeTimeIl = GetWriteTimeIL(stopwatchVar);
-
-        InjectWriteIl(writeTimeIl, returnInstruction);
+        InjectIlForFinaly(returnInstruction);

         var handler = new ExceptionHandler(ExceptionHandlerType.Finally)
             {
@@ -68,6 +52,15 @@
         body.ExceptionHandlers.Add(handler);
         body.InitLocals = true;
         body.OptimizeMacros();
+    }
+
+    Instruction FirstInstructionSkipCtor()
+    {
+        if (Method.IsConstructor)
+        {
+            return body.Instructions.Skip(2).First();
+        }
+        return body.Instructions.First();
     }

     Instruction FixReturns()
@@ -112,8 +105,14 @@
         }
     }

-    void InjectWriteIl(List<Instruction> writeTimeIl, Instruction beforeThis)
+    void InjectIlForFinaly(Instruction beforeThis)
     {
+
+        var stopwatchVar = InjectStopwatch();
+
+        var writeTimeIl = GetWriteTimeIL(stopwatchVar);
+
+
         foreach (var instruction in writeTimeIl)
         {
             ilProcessor.InsertBefore(beforeThis, instruction);


Small improvements to the calculation engine

--- Jace/CalculationEngine.cs
+++ Jace/CalculationEngine.cs
@@ -15,22 +15,29 @@
         private readonly CultureInfo cultureInfo;
         private readonly Dictionary<string, Func<Dictionary<string, double>, double>> executionFunctionCache;
         private readonly bool cacheEnabled;
+        private readonly bool optimizerEnabled;

         public CalculationEngine()
-            : this(CultureInfo.CurrentCulture, ExecutionMode.Interpreted)
+            : this(CultureInfo.CurrentCulture, ExecutionMode.Compiled)
+        {
+        }
+
+        public CalculationEngine(CultureInfo cultureInfo)
+            : this(cultureInfo, ExecutionMode.Compiled)
         {
         }

         public CalculationEngine(CultureInfo cultureInfo, ExecutionMode executionMode)
-            : this(cultureInfo, executionMode, true)
+            : this(cultureInfo, executionMode, true, true)
         {
         }

-        public CalculationEngine(CultureInfo cultureInfo, ExecutionMode executionMode, bool cacheEnabled)
+        public CalculationEngine(CultureInfo cultureInfo, ExecutionMode executionMode, bool cacheEnabled, bool optimizerEnabled)
         {
             this.executionFunctionCache = new Dictionary<string, Func<Dictionary<string, double>, double>>();
             this.cultureInfo = cultureInfo;
             this.cacheEnabled = cacheEnabled;
+            this.optimizerEnabled = optimizerEnabled;

             if (executionMode == ExecutionMode.Interpreted)
                 executor = new Interpreter();


[untested wip]

[untested wip]


fix GetValueName1Level test

fix GetValueName1Level test

--- src/google-cloud/test-unit/Datastore/DatastoreOrmTests.cs
+++ src/google-cloud/test-unit/Datastore/DatastoreOrmTests.cs
@@ -87,10 +87,8 @@
         [Fact]
         public void GetValueName_1_level_only()
         {
-            var actual = Record.Exception(() => orm.GetValueName<ValueNameVictim>(x => x.TheDeeper.DangerIs));
-
-            Assert.IsType<ArgumentException>(actual);
-            Assert.StartsWith("The given expression does not point to a member", actual.Message);
+            var actual = orm.GetValueName<ValueNameVictim>(x => x.TheDeeper.DangerIs);
+            Assert.Equal("DangerIs", actual);
         }

         [Fact]


test improvement

test improvement

--- samples/IosGestureTest.cs
+++ samples/IosGestureTest.cs
@@ -45,7 +45,7 @@
         [Test()]
         public void GestureTestCase()
         {
-            IOSElement e = driver.FindElementByClassName("TextField1");
+            IOSElement e = driver.FindElementByName("TextField1");
             driver.Tap(1, e, 2000);
             driver.Zoom(e);
             driver.Pinch(e);


Added Either.Reverse(), Either.Try()

Added Either.Reverse(), Either.Try()

--- KitchenSink.Lib/Either.cs
+++ KitchenSink.Lib/Either.cs
@@ -1,4 +1,5 @@
 using System;
+using KitchenSink.Extensions;
 using static KitchenSink.Operators;

 namespace KitchenSink
@@ -16,6 +17,20 @@
             condition()
             ? new Either<A, B>(true, consequent(), default)
             : new Either<A, B>(false, default, alternative());
+
+        public static Either<A, E> Try<A, E>(Func<A> f, Func<E, E> g) where E : Exception
+        {
+            try
+            {
+                return f();
+            }
+            catch (E e)
+            {
+                return g(e);
+            }
+        }
+
+        public static Maybe<E> Try<E>(Action f) where E : Exception => Try<Unit, E>(f.AsFunc(), Id).RightMaybe;

         public static Either<C, B> Select<A, B, C>(
             this Either<A, B> e,
@@ -103,6 +118,8 @@
             }
         }

+        public Either<B, A> Reverse() => Branch(RightOf<B, A>, LeftOf<B, A>);
+
         public override string ToString() => IsLeft ? $"Left({Left})" : $"Right({Right})";
         public override int GetHashCode() => IsLeft ? Left.GetHashCode() : Right.GetHashCode();


Revert "refactor(archival): ♻ internalize IUnitOfWork"

This reverts commit 3f40dc6990f527844494cae11676f3dc7a9682df.

--- services/Archival/FilterLists.Archival.Infrastructure/SeedWork/IUnitOfWork.cs
+++ services/Archival/FilterLists.Archival.Infrastructure/SeedWork/IUnitOfWork.cs
@@ -2,7 +2,7 @@

 namespace FilterLists.Archival.Infrastructure.SeedWork
 {
-    internal interface IUnitOfWork : IDisposable
+    public interface IUnitOfWork : IDisposable
     {
         void Commit();
     }


Update access level of Ev3MotorSteerViewModel class.

--- dev/src/Ev3Controller/ViewModel/Ev3MotorSteerViewModel.cs
+++ dev/src/Ev3Controller/ViewModel/Ev3MotorSteerViewModel.cs
@@ -9,7 +9,7 @@
     public class Ev3MotorSteerViewModel : ViewModelBase
     {
         #region
-        Ev3MotorSteerViewModel()
+        public Ev3MotorSteerViewModel()
         {
             this.TargetMotorOutput = 0;
             this.TargetSteer = 0;


Also match parent command definition when checking command instance equality.

--- LibTextPet/Msg/Command.cs
+++ LibTextPet/Msg/Command.cs
@@ -202,7 +202,10 @@
 				return false;
 			}

-			if (this.Definition != otherCmd.Definition) {
+			if (this.Definition != otherCmd.Definition &&
+				this.Definition != otherCmd.Definition.Parent &&
+				this.Definition.Parent != otherCmd.Definition &&
+				this.Definition.Parent != otherCmd.Definition.Parent) {
 				return false;
 			}


Make owner drop-down optional on newticket page if {{{restrict_owner}}} option is enabled. Closes #1296.

git-svn-id: eda3d06fcef731589ace1b284159cead3416df9b@1356 af82e41b-90c4-0310-8c96-b1721e28e2e2

--- templates/newticket.cs
+++ templates/newticket.cs
@@ -60,7 +60,7 @@
    call:hdf_select(newticket.milestones, "milestone", newticket.milestone, 1) ?>

    Assign to:<?cs
    if:len(newticket.users) ?><?cs
-    call:hdf_select(newticket.users, "owner", newticket.owner, 0) ?><?cs
+    call:hdf_select(newticket.users, "owner", newticket.owner, 1) ?><?cs
    else ?>
     <input type="text" id="owner" name="owner" size="20" value="<?cs
       var:newticket.owner ?>" /><?cs


Refactor ObjectValidator class slightly

Refactor ObjectValidator class slightly

Make some local variable have more meaningful name.

--- source/Khala.Messaging.Contracts/Messaging/DataAnnotations/ObjectValidator.cs
+++ source/Khala.Messaging.Contracts/Messaging/DataAnnotations/ObjectValidator.cs
@@ -37,14 +37,14 @@
             object instance,
             out ValidationResult validationResult)
         {
-            ValidationResult result = ValidationResult.Success;
+            ValidationResult captured = ValidationResult.Success;

             Visitor.Visit(
                 instance,
                 breakOnFirstError: true,
-                onError: error => result = error.ValidationResult);
-
-            validationResult = result;
+                onError: error => captured = error.ValidationResult);
+
+            validationResult = captured;
             return validationResult == ValidationResult.Success;
         }


Added Enumerable.Enumerate to run iterators.

--- LordJZ/Linq/Enumerable.cs
+++ LordJZ/Linq/Enumerable.cs
@@ -1,13 +1,19 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;

 namespace LordJZ.Linq
 {
     public static partial class Enumerable
     {
+        public static void Enumerate<T>(this IEnumerable<T> collection)
+        {
+            Contract.Requires(collection != null);
+
+            IEnumerator<T> enumerator = collection.GetEnumerator();
+            while (enumerator.MoveNext())
+            {
+                // do nothing
+            }
+        }
     }
 }


new regexes for bold and italic (strict only), fixing various problems

--- MarkdownSharp/Markdown.cs
+++ MarkdownSharp/Markdown.cs
@@ -1354,13 +1354,13 @@

         private static Regex _bold = new Regex(@"(\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1",
             RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
-        private static Regex _strictBold = new Regex(@"([\W_]|^) (\*\*|__) (?=\S) ([^\r]*?\S[\*_]*) \2 (?=[\W_]|$)",
-            RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
+        private static Regex _strictBold = new Regex(@"(^|[\W_])(?:(?!\1)|(?=^))(\*|_)\2(?=\S)(.*?\S)\2\2(?!\2)(?=[\W_]|$)",
+            RegexOptions.Singleline | RegexOptions.Compiled);

         private static Regex _italic = new Regex(@"(\*|_) (?=\S) (.+?) (?<=\S) \1",
             RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
-        private static Regex _strictItalic = new Regex(@"([\W_]|^) (\*|_) (?=\S) ([^\r\*_]*?\S) \2 (?=[\W_]|$)",
-            RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Compiled);
+        private static Regex _strictItalic = new Regex(@"(^|[\W_])(?:(?!\1)|(?=^))(\*|_)(?=\S)((?:(?!\2).)*?\S)\2(?!\2)(?=[\W_]|$)",
+            RegexOptions.Singleline | RegexOptions.Compiled);

         /// <summary>
         /// Turn Markdown *italics* and **bold** into HTML strong and em tags


Update MethodCaptureDelegator.cs

Update MethodCaptureDelegator.cs

Handle null parameter to go(object[] args)

--- MethodCaptureDelegator.cs
+++ MethodCaptureDelegator.cs
@@ -32,7 +32,12 @@

         public object go(object[] args)
         {
-            args = args.Take(args.Length-1).ToArray();
+            if (args == null) { args = new object[] { }; }
+            else
+            {
+                args = args.Take(args.Length-1).ToArray();
+            }
+
             return new Func<object>(() => {
                 MethodBase method = null;


Introduce GetCollection<T>.

Introduce GetCollection<T>.

--- MongoDBDriver/Database.cs
+++ MongoDBDriver/Database.cs
@@ -51,9 +51,23 @@
             }
         }

+        /// <summary>
+        /// Gets the collection.
+        /// </summary>
+        /// <param name="name">The name.</param>
+        /// <returns></returns>
         public IMongoCollection GetCollection(String name){
-            IMongoCollection col = new MongoCollection<Document>(this.connection, this.Name, name);
-            return col;
+            return new MongoCollection<Document>(this.connection, this.Name, name);
+        }
+
+        /// <summary>
+        /// Gets the collection.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="name">The name.</param>
+        /// <returns></returns>
+        public IMongoCollection<T> GetCollection<T>(String name) where T : class{
+            return new MongoCollection<T>(this.connection, this.Name, name);
         }

         /// <summary>


isolate event listener crash for Node

isolate event listener crash for Node

--- NBitcoin/Protocol/Node.cs
+++ NBitcoin/Protocol/Node.cs
@@ -8,6 +8,7 @@
 using System.Linq;
 using System.Net;
 using System.Net.Sockets;
+using System.Reflection;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
@@ -254,15 +255,40 @@
 		public event NodeStateEventHandler StateChanged;
 		private void OnStateChanged(NodeState previous)
 		{
-			if(StateChanged != null)
-			{
-				try
-				{
-					StateChanged(this, previous);
-				}
-				catch(Exception ex)
-				{
-					TraceCorrelation.LogInside(() => NodeServerTrace.Error("Error while Disconnected event raised", ex));
+			var stateChanged = StateChanged;
+			if(stateChanged != null)
+			{
+				foreach(var handler in stateChanged.GetInvocationList().Cast<NodeStateEventHandler>())
+				{
+					try
+					{
+						handler.DynamicInvoke(this, previous);
+					}
+					catch(TargetInvocationException ex)
+					{
+						TraceCorrelation.LogInside(() => NodeServerTrace.Error("Error while StateChanged event raised", ex.InnerException));
+					}
+				}
+			}
+		}
+
+
+		public event NodeEventMessageIncoming MessageReceived;
+		protected void OnMessageReceived(IncomingMessage message)
+		{
+			var messageReceived = MessageReceived;
+			if(messageReceived != null)
+			{
+				foreach(var handler in messageReceived.GetInvocationList().Cast<NodeEventMessageIncoming>())
+				{
+					try
+					{
+						handler.DynamicInvoke(this, message);
+					}
+					catch(TargetInvocationException ex)
+					{
+						TraceCorrelation.LogInside(() => NodeServerTrace.Error("Error while OnMessageReceived event raised", ex.InnerException));
+					}
 				}
 			}
 		}
@@ -270,15 +296,19 @@
 		public event NodeEventHandler Disconnected;
 		private void OnDisconnected()
 		{
-			if(Disconnected != null)
-			{
-				try
-				{
-					Disconnected(this);
-				}
-				catch(Exception ex)
-				{
-					TraceCorrelation.LogInside(() => NodeServerTrace.Error("Error while Disconnected event raised", ex));
+			var disconnected = Disconnected;
+			if(disconnected != null)
+			{
+				foreach(var handler in disconnected.GetInvocationList().Cast<NodeEventHandler>())
+				{
+					try
+					{
+						handler.DynamicInvoke(this);
+					}
+					catch(TargetInvocationException ex)
+					{
+						TraceCorrelation.LogInside(() => NodeServerTrace.Error("Error while Disconnected event raised", ex.InnerException));
+					}
 				}
 			}
 		}
@@ -525,14 +555,6 @@
 		{
 			get;
 			private set;
-		}
-
-		public event NodeEventMessageIncoming MessageReceived;
-		protected void OnMessageReceived(IncomingMessage message)
-		{
-			var messageReceived = MessageReceived;
-			if(messageReceived != null)
-				messageReceived(this, message);
 		}

 		bool _ReuseBuffer;


Fix possible nullreference, improve exception handling

--- NTumbleBit.CLI/Program.cs
+++ NTumbleBit.CLI/Program.cs
@@ -133,16 +133,19 @@

 		private static T Retry<T>(int count, Func<T> act)
 		{
-			Exception ex = null;
+			var exceptions = new List<Exception>();
 			for(int i = 0; i < count; i++)
 			{
 				try
 				{
 					return act();
 				}
-				catch(Exception exx) { ex = exx; }
+				catch(Exception ex)
+				{
+					exceptions.Add(ex);
+				}
 			}
-			throw ex;
+			throw new AggregateException(exceptions);
 		}

 		public static string GetDefaultConfigurationFile(string dataDirectory, Network network)


Обертка для метода получения текущей песни юзера LastFM. Костыльно правда, может потом ОТРЕФАКТОРЮ

--- Networks/LastFM/LastFM.cs
+++ Networks/LastFM/LastFM.cs
@@ -23,7 +23,6 @@
         /// <returns>True: Обложка найдена</returns>
         public bool FindCover(Song song)
         {
-
             Track tmpTrack = TrackGetInfo(song.Artist, song.Name);
             Artist tmpArtist;

@@ -78,6 +77,33 @@

         // Так как в данный момент используется только обложка, то тут небольшой избыток получаемой с API инфы
         // В песпективе, из этого всего можно сделать аналог ластфмовского скробллера
+
+
+        /// <summary>
+        /// Возвращает объект, представляющий текущую песню, прослушиваемую пользователем.
+        /// Либо null, если ничего не слушает.
+        /// Либо вообще вылетает, ибо я не могу в тестинг
+        /// </summary>
+        /// <param name="user">Имя пользователя</param>
+        /// <returns>Текущая прослушиваемая песня, либо null - если её нет</returns>
+        private Track UserGetCurrentTrack(string user)
+        {
+            const string method = "user.getrecenttracks";
+
+            string resp = APIRequest(method, new Dictionary<string, string>() { { "user", user } });
+
+            var o = JToken.Parse(resp);
+
+            bool isAnythingPlayed = (bool)o.SelectToken("recenttracks.track[0].@attr.nowplaying");
+
+            if (isAnythingPlayed)
+            {
+                return TrackGetInfo((string)o.SelectToken("recenttracks.track[0].artist.#text"),
+                    (string)o.SelectToken("recenttracks.track[0].name"));
+            }
+
+            return null;
+        }

         private Track TrackGetInfo(string artist, string name)
         {


Fix typo.

Fix typo.

--- NtApiDotNet/NtSecurity.cs
+++ NtApiDotNet/NtSecurity.cs
@@ -718,7 +718,7 @@
         Allowed = 0x0,
         Denied = 0x1,
         Audit = 0x2,
-        Alerm = 0x3,
+        Alarm = 0x3,
         AllowedCompound = 0x4,
         AllowedObject = 0x5,
         DeniedObject = 0x6,


archiveFilename isn't converted using server.MapPath(), therefore you can't specify the path like "~\d$\temp\DepolySource\source.zip".
If you try to, you would get an error like this:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Projects\DeployPoc_SLN\DeployPoc\bin\Debug\~\d$\temp\DepolySource\source.zip'.

With this change the source file can be a direct path like "d:\temp\something.zip", or a server relative path like "~\d$\temp\something.zip".

--- product/dropkick/Configuration/Dsl/Files/ProtoUnzipArchiveTask.cs
+++ product/dropkick/Configuration/Dsl/Files/ProtoUnzipArchiveTask.cs
@@ -34,7 +34,8 @@
 		public override void RegisterRealTasks(PhysicalServer server)
 		{
 			var to = server.MapPath(_to);
-			var task = new UnzipArchiveTask(_archiveFilename, to, _options, _path);
+			var archiveFilename = server.MapPath(_archiveFilename);
+			var task = new UnzipArchiveTask(archiveFilename, to, _options, _path);
 			server.AddTask(task);
 		}
 	}


Remove System.Data.SqlClient as a default namespace

This seems to be the case since LINQPad 6.

--- src/LinqPad.cs
+++ src/LinqPad.cs
@@ -82,7 +82,6 @@
             "System.Collections",
             "System.Collections.Generic",
             "System.Data",
-            "System.Data.SqlClient",
             "System.Diagnostics",
             "System.IO",
             "System.Linq",


A few more generic REST routes to try stuff with

--- src/Program.cs
+++ src/Program.cs
@@ -12,14 +12,16 @@

         static WebServerRoute[] routes =
         {
-            new WebServerRoute("GET", "/test/", GetResponse1),
-            new WebServerRoute("GET", "/test2/{arg}/", GetResponse2)
+            new WebServerRoute("GET", "/test/", GetTestResponse),
+            new WebServerRoute("GET", "/test2/{arg}/", GetGenericResponse),
+            new WebServerRoute("GET", "/test2/{arg}/{arg2}", GetGenericResponse),
+            new WebServerRoute("GET", "/test2/{arg}/{arg2}/{arg3}", GetGenericResponse),
         };

-        private static void GetResponse1(HttpListenerRequest request, string[] requestParts, HttpListenerResponse response)
+        private static void GetTestResponse(HttpListenerRequest request, string[] requestParts, HttpListenerResponse response)
         {
             StringBuilder sb = new StringBuilder();
-            sb.AppendFormat("
First page 1.

{0}

", DateTime.Now);
+            sb.AppendFormat("
Sample Test Page

{0}

", DateTime.Now);
             int x = 0;
             foreach(var part in requestParts)
             {
@@ -29,10 +31,10 @@
             WebServer.SetResponse(response, sb.ToString());
         }

-        private static void GetResponse2(HttpListenerRequest request, string[] requestParts, HttpListenerResponse response)
+        private static void GetGenericResponse(HttpListenerRequest request, string[] requestParts, HttpListenerResponse response)
         {
             StringBuilder sb = new StringBuilder();
-            sb.AppendFormat("
Second page 2.

{0}

", DateTime.Now);
+            sb.AppendFormat("
Generic Handler

{0}

", DateTime.Now);
             int x = 0;
             foreach (var part in requestParts)
             {


Fixes #6. Now Events are correctly ordered

--- src/Program.cs
+++ src/Program.cs
@@ -84,7 +84,7 @@
             using (var shindyContext = new Shindy.Data.SqlServer.ShindyContext())
             {

-                foreach (Dnm.Event evnt in events.Events)
+                foreach (Dnm.Event evnt in events.Events.OrderBy(e=>e.EventDateTime))
                 {
                     evnt.EventDateTime = evnt.EventDateTime.ToUniversalTime();


MainClass#ReadSkeletonFileメソッドを追加

MainClass#ReadSkeletonFileメソッドを追加

--- src/Program.cs
+++ src/Program.cs
@@ -44,6 +44,27 @@
         }

         #region -- Private Static Methods --
+
+        /// <summary>
+        /// 指定されたスケルトンファイルを読み込み、文字列として取得します。
+        /// </summary>
+        /// <returns>読み込まれたファイルの内容。</returns>
+        /// <param name="path">読み込まれるスケルトンファイルのパス。</param>
+        private static string ReadSkeletonFile(string path)
+        {
+            try
+            {
+                return File.ReadAllText(path);
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine("スケルトンファイルを読み取れません. {0}", ex.Message);
+                Environment.Exit(ExitCode.FileCannotOpened);
+            }
+
+            // cannot reach
+            return null;
+        }

         /// <summary>
         /// 文字列の配列を結合した文字列を生成します。


Use net instead of v to describe framework version

--- src/build.cake
+++ src/build.cake
@@ -308,7 +308,7 @@

         var project = ParseProject(slnProject.Path);
         var dill = slnProject.Path.GetDirectory().CombineWithFilePath(File($"./bin/{configuration}/{project.AssemblyName}.dll"));
-        var target = "lib/" + project.TargetFrameworkVersion.Replace(".", "");
+        var target = "lib/" + project.TargetFrameworkVersion.Replace(".", "").Replace("v", "net");

         var nuGetPackSettings   = new NuGetPackSettings {
             Id                       = project.AssemblyName,


Fixed the order of two file names used in a warning.

--- OpenSim/Framework/Util.cs
+++ OpenSim/Framework/Util.cs
@@ -1303,7 +1303,7 @@
                 }
                 catch (Exception e)
                 {
-                    m_log.WarnFormat("[UTILS]: Exception copying configuration file {0} to {1}: {2}", configFile, exampleConfigFile, e.Message);
+                    m_log.WarnFormat("[UTILS]: Exception copying configuration file {0} to {1}: {2}", exampleConfigFile, configFile, e.Message);
                     return false;
                 }
             }


Added COMPRESSION_FORMAT enum

Added COMPRESSION_FORMAT enum

--- PInvoke/Kernel32/WinNT.cs
+++ PInvoke/Kernel32/WinNT.cs
@@ -185,6 +185,26 @@
 		[return: MarshalAs(UnmanagedType.U1)]
 		public delegate bool SecureMemoryCacheCallback(IntPtr Addr, SizeT Range);

+		/// A bitmask that specifies the compression format.
+		[PInvokeData("winnt.h")]
+		public enum COMPRESSION_FORMAT : ushort
+		{
+			/// No compression.
+			COMPRESSION_FORMAT_NONE = 0x0000,
+
+			/// The system default for compression.
+			COMPRESSION_FORMAT_DEFAULT = 0x0001,
+
+			/// The LZNT1 compression algorithm is used.
+			COMPRESSION_FORMAT_LZNT1 = 0x0002,
+
+			/// The Xpress LZ77 compression algorithm is used.
+			COMPRESSION_FORMAT_XPRESS = 0x0003,
+
+			/// The Xpress LZ77+Huffman compression algorithm is used.
+			COMPRESSION_FORMAT_XPRESS_HUFF = 0x0004,
+		}
+
 		/// The flags that control the enforcement of the minimum and maximum working set sizes.
 		[PInvokeData("winnt.h")]
 		[Flags]


Refactoring PathStorage -> VertexStorage

--- Pathfinding/PathFinder.cs
+++ Pathfinding/PathFinder.cs
@@ -652,9 +652,9 @@
 		public WayPointsToRemove RemovePointList { get; }
 		public IntPointPathNetwork Waypoints { get; } = new IntPointPathNetwork();

-		public static PathStorage CreatePathStorage(List<List<IntPoint>> polygons)
-		{
-			PathStorage output = new PathStorage();
+		public static VertexStorage CreatePathStorage(List<List<IntPoint>> polygons)
+		{
+			VertexStorage output = new VertexStorage();

 			foreach (List<IntPoint> polygon in polygons)
 			{


delete obsoleted attribute.

delete obsoleted attribute.

--- Plugin/EnumDescription.cs
+++ Plugin/EnumDescription.cs
@@ -7,116 +7,10 @@
  * $Id: EnumDescription.cs,v 1.9 2012/03/18 10:57:33 kzmi Exp $
  */
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Reflection;
-using System.Diagnostics;

 namespace Poderosa.Util {
-
-    //整数のenum値に表記をつけたり相互変換したりする　構造上
-    /// <summary>
-    ///
-    /// </summary>
-    /// <exclude/>
-    [Obsolete]
-    [AttributeUsage(AttributeTargets.Enum)]
-    public class EnumDescAttribute : Attribute {
-
-        private Type _type;
-        private Type _enumListItemType;
-
-        [Obsolete]
-        public EnumDescAttribute(Type t) {
-            Init(t);
-        }
-
-        [Obsolete]
-        public void Init(Type t) {
-            _type = t;
-            _enumListItemType = typeof(EnumListItem<>).MakeGenericType(_type);
-        }
-
-        [Obsolete]
-        public virtual string GetDescription(ValueType i) {
-            if (i.GetType() != _type)
-                throw new ArgumentException("Type unmatch", "i");
-
-            object item = _enumListItemType.GetMethod("CreateListItem").Invoke(null, new object[] { i });
-            return item.ToString();
-        }
-
-        [Obsolete]
-        public virtual string GetRawDescription(ValueType i) {
-            if (i.GetType() != _type)
-                throw new ArgumentException("Type unmatch", "i");
-
-            object item = _enumListItemType.GetMethod("CreateListItemWithTextID").Invoke(null, new object[] { i });
-            return item.ToString();
-        }
-
-        [Obsolete]
-        public virtual ValueType FromDescription(string v, ValueType d) {
-            if (d.GetType() != _type)
-                throw new ArgumentException("Type unmatch", "d");
-
-            if (v == null)
-                return d;
-
-            Array items = (Array)_enumListItemType.GetMethod("GetListItems").Invoke(null, null);
-            foreach (object item in items) {
-                if (v == item.ToString()) {
-                    return (ValueType)item.GetType().GetProperty("Value").GetValue(item, null);
-                }
-            }
-
-            return d;
-        }
-
-        [Obsolete]
-        public virtual string GetName(ValueType i) {
-            if (i.GetType() != _type)
-                throw new ArgumentException("Type unmatch", "i");
-
-            return i.ToString();
-        }
-
-        [Obsolete]
-        public virtual ValueType FromName(string v) {
-            return (ValueType)Enum.Parse(_type, v);
-        }
-
-        [Obsolete]
-        public virtual ValueType FromName(string v, ValueType d) {
-            if (d.GetType() != _type)
-                throw new ArgumentException("Type unmatch", "d");
-
-            if (v == null)
-                return d;
-
-            try {
-                return (ValueType)Enum.Parse(_type, v);
-            }
-            catch (Exception) {
-                return d;
-            }
-        }
-
-        [Obsolete]
-        public virtual string[] DescriptionCollection() {
-            Array items = (Array)_enumListItemType.GetMethod("GetListItems").Invoke(null, null);
-            string[] texts = new string[items.Length];
-            for (int i = 0; i < items.Length; i++)
-                texts[i] = items.GetValue(i).ToString();
-            return texts;
-        }
-
-        [Obsolete]
-        public static EnumDescAttribute For(Type type) {
-            return new EnumDescAttribute(type);
-        }
-
-    }

     /// <summary>
     /// Attribute to define the description of an enum value.


fix search

fix search

--- PowerWallet/Extensions.cs
+++ PowerWallet/Extensions.cs
@@ -28,14 +28,15 @@
             bindable.RoutedCommand = command;
             bindable.CommandBinding = new CommandBinding(command);
             bindable.SetBinding(BindableCommandBinding.CommandProperty, binding);
+            var method = typeof(FrameworkElement).GetMethod("AddLogicalChild", BindingFlags.NonPublic | BindingFlags.Instance);
+            method.Invoke(element, new[] { bindable });
+            element.Resources.Add(Guid.NewGuid(), bindable); //Prevent GC from collecting BindableCommandBinding
             element.CommandBindings.Add(bindable.CommandBinding);
-            var method = typeof(FrameworkElement).GetMethod("AddLogicalChild", BindingFlags.NonPublic | BindingFlags.Instance);
-            method.Invoke(element, new[]{bindable});
             return bindable.CommandBinding;
         }
     }

-    public class BindableCommandBinding : FrameworkElement
+    class BindableCommandBinding : FrameworkElement
     {


Base64Stream: Fixes to ensure corrupt base64 data is not written

--- PreviewIo/Base64Stream.cs
+++ PreviewIo/Base64Stream.cs
@@ -8,7 +8,7 @@
 {
 	internal class Base64Stream : Stream
 	{
-		private MemoryStream _dataStream;
+		private readonly MemoryStream _dataStream;
 		private readonly bool _readOnly;
 		private readonly Stream _underlyingStream;

@@ -72,8 +72,9 @@

 		public override void Close()
 		{
-			FlushAsync(CancellationToken.None).Wait();
-
+			_Flush();
+
+			_dataStream.SetLength(0);
 			_dataStream.Close();

 			if (_underlyingStream != null)
@@ -105,26 +106,26 @@
 		}

 		public override void Flush()
-		{
-			FlushAsync(CancellationToken.None).Wait();
-		}
+		{ }

 		public override Task FlushAsync(CancellationToken cancellationToken)
 		{
-			return Task.Factory.StartNew(() =>
-			{
-				if (_readOnly)
-					return;
-
-				var base64String = Convert.ToBase64String(_dataStream.ToArray());
-				var base64Data = Encoding.UTF8.GetBytes(base64String);
-
-				_underlyingStream.Write(base64Data, 0, base64Data.Length);
-				_underlyingStream.Flush();
-
-				_dataStream.Position = 0;
-				_dataStream.SetLength(0);
-			});
+			return Task.FromResult(0);
+		}
+
+		private void _Flush()
+		{
+			if (_readOnly)
+				return;
+
+			var base64String = Convert.ToBase64String(_dataStream.ToArray());
+			var base64Data = Encoding.UTF8.GetBytes(base64String);
+
+			_underlyingStream.Write(base64Data, 0, base64Data.Length);
+			_underlyingStream.Flush();
+
+			_dataStream.Position = 0;
+			_dataStream.SetLength(0);
 		}

 		public override long Length


update

update

--- src/Microsoft.NetCore.Analyzers/Core/Security/DoNotUseObsoleteKDFAlgorithm.cs
+++ src/Microsoft.NetCore.Analyzers/Core/Security/DoNotUseObsoleteKDFAlgorithm.cs
@@ -74,10 +74,16 @@
                     }

                     var typeSymbol = methodSymbol.ContainingType;
+
+                    if (typeSymbol == null)
+                    {
+                        return;
+                    }
+
                     var methodName = methodSymbol.Name;

-                    if (passwordDeriveBytesTypeSymbol.Equals(typeSymbol) ||
-                        rfc2898DeriveBytesTypeSymbol.Equals(typeSymbol) &&
+                    if (typeSymbol.Equals(passwordDeriveBytesTypeSymbol) ||
+                        typeSymbol.Equals(rfc2898DeriveBytesTypeSymbol) &&
                         methodName == "CryptDeriveKey")
                     {
                         operationAnalysisContext.ReportDiagnostic(


Update ContentPicker.Edit.cshtml link

Update ContentPicker.Edit.cshtml link

Update for issue #6267

--- src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.Edit.cshtml
+++ src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.Edit.cshtml
@@ -50,7 +50,7 @@

-                        @Html.ItemEditLink(contentItem) @if (!contentItem.HasPublished()){<text> - </text>@T("Not Published")}
+                        @Html.ItemAdminLink(contentItem) @if (!contentItem.HasPublished()){<text> - </text>@T("Not Published")}

                         @T("Remove")
@@ -63,4 +63,4 @@
     @T("Add")
     <input type="hidden" name="@selectedItemsFieldName" />
     @hint
-</fieldset>+</fieldset>


Revert "Fixing ShapeDesigner"

Revert "Fixing ShapeDesigner"

This reverts commit 6eb32a93df3c3874f6ab05213cdf43f7bf217a08.

--- src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs
+++ src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs
@@ -2,6 +2,7 @@
 using System.Linq;
 using System.Text;
 using System.Web.Routing;
+using System.Xml.Linq;
 using Orchard.DisplayManagement.Descriptors;
 using Orchard.DisplayManagement.Implementation;
 using Orchard.DisplayManagement.Shapes;
@@ -11,15 +12,16 @@
 using Orchard.Themes;
 using Orchard.UI;
 using Orchard.UI.Admin;
+using System.Web;

 namespace Orchard.DesignerTools.Services {
     [OrchardFeature("Orchard.DesignerTools")]
     public class ShapeTracingFactory : IShapeFactoryEvents, IShapeDisplayEvents {
+        private readonly WorkContext _workContext;
         private readonly IShapeTableManager _shapeTableManager;
         private readonly IThemeManager _themeManager;
         private readonly IWebSiteFolder _webSiteFolder;
         private readonly IAuthorizer _authorizer;
-        private readonly IWorkContextAccessor _workContextAccessor;
         private bool _processing;

         private int _shapeId;
@@ -31,7 +33,7 @@
             IWebSiteFolder webSiteFolder,
             IAuthorizer authorizer
             ) {
-            _workContextAccessor = workContextAccessor;
+            _workContext = workContextAccessor.GetContext();
             _shapeTableManager = shapeTableManager;
             _themeManager = themeManager;
             _webSiteFolder = webSiteFolder;
@@ -39,17 +41,13 @@
         }

         private bool IsActivable() {
-            var workContext = _workContextAccessor.GetContext();
-
             // activate on front-end only
-            if (AdminFilter.IsApplied(new RequestContext(workContext.HttpContext, new RouteData())))
+            if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData())))
                 return false;

             // if not logged as a site owner, still activate if it's a local request (development machine)
-            if (!_authorizer.Authorize(StandardPermissions.SiteOwner)) {
-
-                return workContext.HttpContext.Request.IsLocal;
-            }
+            if (!_authorizer.Authorize(StandardPermissions.SiteOwner))
+                return _workContext.HttpContext.Request.IsLocal;

             return true;
         }
@@ -78,8 +76,7 @@
                 && context.ShapeType != "DateTimeRelative") {

                 var shapeMetadata = (ShapeMetadata)context.Shape.Metadata;
-                var workContext = _workContextAccessor.GetContext();
-                var currentTheme = workContext.CurrentTheme;
+                var currentTheme = _workContext.CurrentTheme;
                 var shapeTable = _shapeTableManager.GetShapeTable(currentTheme.Id);

                 if (!shapeTable.Descriptors.ContainsKey(shapeMetadata.Type)) {
@@ -102,8 +99,7 @@

             var shape = context.Shape;
             var shapeMetadata = (ShapeMetadata) context.Shape.Metadata;
-            var workContext = _workContextAccessor.GetContext();
-            var currentTheme = _themeManager.GetRequestTheme(workContext.HttpContext.Request.RequestContext);
+            var currentTheme = _themeManager.GetRequestTheme(_workContext.HttpContext.Request.RequestContext);
             var shapeTable = _shapeTableManager.GetShapeTable(currentTheme.Id);

             if (!shapeMetadata.Wrappers.Contains("ShapeTracingWrapper")) {


Adding refresh for clientRequestId

Adding refresh for clientRequestId

--- src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs
+++ src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs
@@ -77,13 +77,17 @@
             }
         }

+        protected void RefreshClientRequestId()
+        {
+            clientRequestId = Guid.NewGuid().ToString() + "-" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ssZ") + "-PS";
+        }
+
         public void InitializeAzureBackupCmdlet(string rgName, string rName)
         {
             resourceGroupName = rgName;
             resourceName = rName;

-            clientRequestId = Guid.NewGuid().ToString() + "-" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ssZ") + "-PS";
-
+            RefreshClientRequestId();
             WriteDebug(string.Format("Initialized AzureBackup Cmdlet, ClientRequestId: {0}, ResourceGroupName: {1}, ResourceName : {2}", this.clientRequestId, resourceGroupName, resourceName));

             CmdletCancellationToken = cancellationTokenSource.Token;


Copy changes on the Team view page

Copy changes on the Team view page

--- src/SFA.DAS.EmployerApprenticeshipsService.Web/Views/EmployerTeam/View.cshtml
+++ src/SFA.DAS.EmployerApprenticeshipsService.Web/Views/EmployerTeam/View.cshtml
@@ -22,7 +22,7 @@
         else
         {

-                Invite members, control what they can do, delete members and cancel or resend invitations.
+                Invite members, control what they can do, remove members and cancel or resend invitations.

         }

@@ -43,7 +43,7 @@

-
Team member

+
User name

What they can do

Status

@@ -76,9 +76,9 @@

                                     View
+                                       - href="@Url.Action("Review", new { accountId = Model.Data.AccountId, email = teamMember.Email })">Edit

-

+

                     }


Improve way how fixture is bootup.

Improve way how fixture is bootup.

--- src/Slp.Evi.Storage/Slp.Evi.Test.System/Sparql/Vendor/MsSqlSparqlTestSuite.cs
+++ src/Slp.Evi.Storage/Slp.Evi.Test.System/Sparql/Vendor/MsSqlSparqlTestSuite.cs
@@ -12,8 +12,11 @@
         public MsSqlSparqlFixture()
         {
             // Prepare all databases beforehand
-            var bootUp = SparqlTestSuite.TestData.Select(x => x[0]).Cast<string>().Distinct()
-                .Select(x => base.GetStorage(x));
+            var datasetsToBootup = SparqlTestSuite.TestData.Select(x => x[0]).Cast<string>().Distinct();
+            foreach (var dataset in datasetsToBootup)
+            {
+                GetStorage(dataset);
+            }
         }

         protected override ISqlDatabase GetSqlDb()


added support for SilentNulls in Javascript compiler

--- src/Spark/Compiler/Javascript/ChunkVisitors/JavascriptGeneratedCodeVisitor.cs
+++ src/Spark/Compiler/Javascript/ChunkVisitors/JavascriptGeneratedCodeVisitor.cs
@@ -43,6 +43,11 @@

         protected override void Visit(SendExpressionChunk chunk)
         {
+            if (chunk.SilentNulls)
+                _source.Append("if(typeof(")
+                       .Append(chunk.Code)
+                       .Append(") != 'undefined') ");
+
             _source.Append("Output.Write(").Append(chunk.Code).AppendLine(");");
         }


Enhancements to error handling of AsyncWww utility methods

--- src/UnityFx.Async.AssetStore/Assets/Plugins/UnityFx.Async/Scripts/AsyncWww.cs
+++ src/UnityFx.Async.AssetStore/Assets/Plugins/UnityFx.Async/Scripts/AsyncWww.cs
@@ -21,10 +21,13 @@
 		/// <param name="url">The URI of the text to download.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetBytesAsync(string, object)"/>
 		public static IAsyncOperation<string> GetTextAsync(string url, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 			var webRequest = UnityWebRequest.Get(url);
 			var result = new Helpers.WebRequestResult<string>(webRequest, userState);
 			result.Start();
@@ -37,10 +40,13 @@
 		/// <param name="url">The URI of the binary content to download.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetTextAsync(string, object)"/>
 		public static IAsyncOperation<byte[]> GetBytesAsync(string url, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 			var webRequest = UnityWebRequest.Get(url);
 			var result = new Helpers.WebRequestResult<byte[]>(webRequest);
 			result.Start();
@@ -53,10 +59,13 @@
 		/// <param name="url">The URI of the asset bundle to download.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundleAsync(string, Hash128, uint, object)"/>
 		public static IAsyncOperation<AssetBundle> GetAssetBundleAsync(string url, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2018_1_OR_NEWER
 			var webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url);
 #else
@@ -76,10 +85,13 @@
 		/// <param name="crc">If nonzero, this number will be compared to the checksum of the downloaded asset bundle data. If the CRCs do not match, an error will be logged and the asset bundle will not be loaded. If set to zero, CRC checking will be skipped.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundleAsync(string, object)"/>
 		public static IAsyncOperation<AssetBundle> GetAssetBundleAsync(string url, Hash128 hash, uint crc, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2018_1_OR_NEWER
 			var webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url, hash, crc);
 #else
@@ -98,10 +110,13 @@
 		/// <param name="assetName">Name of the prefab to load. If <see langword="null"/> the first asset of the matching type is loaded.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundleAssetAsync(string, Hash128, uint, string, object)"/>
 		public static IAsyncOperation<T> GetAssetBundleAssetAsync<T>(string url, string assetName, object userState = null) where T : UnityEngine.Object
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2018_1_OR_NEWER
 			var webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url);
 #else
@@ -122,10 +137,13 @@
 		/// <param name="assetName">Name of the prefab to load. If <see langword="null"/> the first asset of the matching type is loaded.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundleAssetAsync(string, string, object)"/>
 		public static IAsyncOperation<T> GetAssetBundleAssetAsync<T>(string url, Hash128 hash, uint crc, string assetName, object userState = null) where T : UnityEngine.Object
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2018_1_OR_NEWER
 			var webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url, hash, crc);
 #else
@@ -164,6 +182,7 @@
 		/// <param name="prefabName">Name of the prefab to load. If <see langword="null"/> the first prefab is loaded.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundlePrefabAsync(string, Hash128, uint, string, object)"/>
 		public static IAsyncOperation<GameObject> GetAssetBundlePrefabAsync(string url, string prefabName, object userState = null)
@@ -180,6 +199,7 @@
 		/// <param name="prefabName">Name of the prefab to load. If <see langword="null"/> the first prefab is loaded.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundlePrefabAsync(string, string, object)"/>
 		public static IAsyncOperation<GameObject> GetAssetBundlePrefabAsync(string url, Hash128 hash, uint crc, string prefabName, object userState = null)
@@ -194,6 +214,7 @@
 		/// <param name="prefabName">Name of the prefab to load. If <see langword="null"/> the first prefab is loaded.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="assetBundle"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundlePrefabAsync(string, Hash128, uint, string, object)"/>
 		public static IAsyncOperation<GameObject> GetAssetBundlePrefabAsync(AssetBundle assetBundle, string prefabName, object userState = null)
@@ -209,10 +230,13 @@
 		/// <param name="loadMode">Scene load mode.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundleSceneAsync(string, Hash128, uint, string, LoadSceneMode, object)"/>
 		public static IAsyncOperation<Scene> GetAssetBundleSceneAsync(string url, string sceneName, LoadSceneMode loadMode, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2018_1_OR_NEWER
 			var webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url);
 #else
@@ -234,10 +258,13 @@
 		/// <param name="loadMode">Scene load mode.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAssetBundleSceneAsync(string, string, LoadSceneMode, object)"/>
 		public static IAsyncOperation<Scene> GetAssetBundleSceneAsync(string url, Hash128 hash, uint crc, string sceneName, LoadSceneMode loadMode, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2018_1_OR_NEWER
 			var webRequest = UnityWebRequestAssetBundle.GetAssetBundle(url, hash, crc);
 #else
@@ -257,6 +284,7 @@
 		/// <param name="loadMode">Scene load mode.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="assetBundle"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the load process.</returns>
 		public static IAsyncOperation<Scene> GetAssetBundleSceneAsync(AssetBundle assetBundle, string sceneName, LoadSceneMode loadMode, object userState = null)
 		{
@@ -276,10 +304,13 @@
 		/// <param name="url">The URI of the audio clip to download.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAudioClipAsync(string, AudioType, object)"/>
 		public static IAsyncOperation<AudioClip> GetAudioClipAsync(string url, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2017_1_OR_NEWER
 			var webRequest = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.UNKNOWN);
 #else
@@ -298,10 +329,13 @@
 		/// <param name="audioType">The type of audio encoding for the downloaded audio clip.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetAudioClipAsync(string, object)"/>
 		public static IAsyncOperation<AudioClip> GetAudioClipAsync(string url, AudioType audioType, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2017_1_OR_NEWER
 			var webRequest = UnityWebRequestMultimedia.GetAudioClip(url, audioType);
 #else
@@ -319,10 +353,13 @@
 		/// <param name="url">The URI of the texture to download.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetTextureAsync(string, bool, object)"/>
 		public static IAsyncOperation<Texture2D> GetTextureAsync(string url, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2017_1_OR_NEWER
 			var webRequest = UnityWebRequestTexture.GetTexture(url, false);
 #else
@@ -341,10 +378,13 @@
 		/// <param name="nonReadable">If <see langword="true"/>, the texture's raw data will not be accessible to script. This can conserve memory.</param>
 		/// <param name="userState">User-defined data.</param>
 		/// <exception cref="ArgumentNullException">Thrown if <paramref name="url"/> is <see langword="null"/>.</exception>
+		/// <exception cref="ArgumentException">Thrown if <paramref name="url"/> is an empty string.</exception>
 		/// <returns>An operation that can be used to track the download process.</returns>
 		/// <seealso cref="GetTextureAsync(string, object)"/>
 		public static IAsyncOperation<Texture2D> GetTextureAsync(string url, bool nonReadable, object userState = null)
 		{
+			ThrowIfInvalidUrl(url);
+
 #if UNITY_2017_1_OR_NEWER
 			var webRequest = UnityWebRequestTexture.GetTexture(url, nonReadable);
 #else
@@ -440,6 +480,24 @@
 		#endregion

 		#region implementation
+
+		private static void ThrowIfInvalidUrl(string url)
+		{
+			if (url == null)
+			{
+				throw new ArgumentNullException("url");
+			}
+
+#if NET35
+			if (string.IsNullOrEmpty(url))
+#else
+			if (string.IsNullOrWhiteSpace(url))
+#endif
+			{
+				throw new ArgumentException("Invalid URL.", "url");
+			}
+		}
+
 		#endregion
 	}
 }


Rename variable

Rename variable

--- src/wp8/BackgroundMode.cs
+++ src/wp8/BackgroundMode.cs
@@ -32,7 +32,7 @@
         /// </summary>
         /// Flag gibt an, ob die App im Hintergrund wach gehalten werden soll
         /// </summary>
-        private static bool isEnabled = true;
+        private static bool IsEnabled = true;

         /// </summary>
         /// Lokalisiert das Smartphone
@@ -71,7 +71,7 @@
         /// </summary>
         public static void Enable ()
         {
-            isEnabled = true;
+            IsEnabled = true;
         }

         /// </summary>
@@ -79,7 +79,7 @@
         /// </summary>
         public static void Disable ()
         {
-            isEnabled = false;
+            IsEnabled = false;

             Deactivate();
         }
@@ -98,7 +98,7 @@
         /// </summary>
         public static void Activate ()
         {
-            if (Geolocator == null && isEnabled && IsServiceAvailable())
+            if (Geolocator == null && IsEnabled && IsServiceAvailable())
             {
                 Geolocator = new Geolocator();


Hide some usings when used in PCL (OCD in full effect)

--- src/LibLog/LibLog.cs
+++ src/LibLog/LibLog.cs
@@ -1,4 +1,4 @@
-//===============================================================================
+//===============================================================================
 // LibLog
 //
 // https://github.com/damianh/LibLog
@@ -55,7 +55,9 @@
     using System;
 #if !LIBLOG_PROVIDERS_ONLY
     using System.Diagnostics;
+#if !LIBLOG_PORTABLE
     using System.Runtime.CompilerServices;
+#endif
 #endif

 #if LIBLOG_PROVIDERS_ONLY
@@ -719,12 +721,16 @@
 {
     using System;
     using System.Collections.Generic;
+#if !LIBLOG_PORTABLE
     using System.Diagnostics;
+#endif
     using System.Globalization;
     using System.Linq;
     using System.Linq.Expressions;
     using System.Reflection;
+#if !LIBLOG_PORTABLE
     using System.Text;
+#endif
     using System.Text.RegularExpressions;

     internal abstract class LogProviderBase : ILogProvider


Retrait des insultes dans les commentaires...

--- JarvisWeb/JarvisBook.cs
+++ JarvisWeb/JarvisBook.cs
@@ -37,10 +37,13 @@
     public partial class JarvisBook : Form
     {
         private SpeechSynthesizer vocalSynth;
-        public List<string> menu;
-        public List<string> action;
-
-        public HtmlElement currentMessage;
+        private List<string> menu;
+        private List<string> action;
+
+        private string pageName;
+
+        private HtmlElement currentMessage;
+        private HtmlElement currentComment;

         public JarvisBook()
         {
@@ -55,6 +58,7 @@
         {
             this.listBox1.KeyPress -= MenuKeyPressHandler;
             this.listBox1.PreviewKeyDown -= ReadPostsKeyPressHandler;
+            this.listBox1.PreviewKeyDown -= ReadCommentsKeyPressHandler;
             this.listBox1.SelectedIndexChanged -= ReadMenuOnChange;
             this.listBox1.SelectedIndexChanged -= InfoMenuOnChange;
         }
@@ -69,32 +73,41 @@
                 {
                     command = splitCommand[0];
                 }
-                string commandArg = "";
+                string commandArg1 = "";
+                string commandArg2 = "";
                 if (splitCommand.Length > 1)
                 {
-                    for (int i = 1; i < splitCommand.Length; i++)
-                    {
-                        commandArg += splitCommand[i] + ' ';
+                    commandArg1 = splitCommand[1];
+                }
+                if (splitCommand.Length > 2)
+                {
+                    for (int i = 2; i < splitCommand.Length; i++)
+                    {
+                        commandArg2 += splitCommand[i] + ' ';
                     }
                 }
                 if (command == "GOTOACTU")
                 {
                     webBrowser.Navigate("https://www.facebook.com");
+                    this.pageName = "Actualités";
                     this.LoadMenuWall();
                 }
                 else if (command == "GOTOGROUPS")
                 {
                     webBrowser.Navigate("https://www.facebook.com/groups/?category=membership");
+                    this.pageName = "Liste des Groupes";
                     webBrowser.DocumentCompleted += PopulateMenuWithGroups;
                 }
                 else if (command == "GOTOFRIENDS")
                 {
                     webBrowser.Navigate("https://www.facebook.com/sven.taton/friends_all");
+                    this.pageName = "Liste des Amis";
                     this.LoadMenuWall();
                 }
                 else if (command == "GOTOMYPAGE")
                 {
                     webBrowser.Navigate("https://www.facebook.com");
+                    this.pageName = "Ma page";
                     this.LoadMenuWall();
                 }
                 else if (command == "BACKTOMAINMENU")
@@ -112,7 +125,8 @@
                 }
                 else if (command == "GOTOURL")
                 {
-                    webBrowser.Navigate(commandArg);
+                    this.pageName = commandArg2;
+                    webBrowser.Navigate(commandArg1);
                     this.LoadMenuWall();
                 }
             }
@@ -133,12 +147,35 @@
                 this.currentMessage = null;
                 this.LoadMenuWall();
             }
+            else if (e.KeyCode == Keys.Right)
+            {
+                this.LoadMenuInfoReadComments();
+            }
+        }
+
+        public void ReadCommentsKeyPressHandler(Object sender, PreviewKeyDownEventArgs e)
+        {
+            if (e.KeyCode == Keys.Up)
+            {
+                this.FocusPrevComment();
+            }
+            else if (e.KeyCode == Keys.Down)
+            {
+                this.FocusNextComment();
+            }
+            else if (e.KeyCode == Keys.Left)
+            {
+                this.currentComment = null;
+                this.LoadMenuInfoReadPosts();
+            }
         }

         private void LoadMenuMain()
         {
             this.menu = new List<string>();
             this.action = new List<string>();
+            this.menu.Add("Menu Principal. Début du menu.");
+            this.action.Add("VOID");
             this.menu.Add("Actualités");
             this.action.Add("GOTOACTU");
             this.menu.Add("Groupes");
@@ -153,16 +190,18 @@
             {
                 this.listBox1.Items.Add(s);
             }
+            this.listBox1.KeyPress += MenuKeyPressHandler;
+            this.listBox1.SelectedIndexChanged += ReadMenuOnChange;
             this.listBox1.SelectedIndex = 0;
             this.listBox1.Select();
-            this.listBox1.KeyPress += MenuKeyPressHandler;
-            this.listBox1.SelectedIndexChanged += ReadMenuOnChange;
         }

         private void LoadMenuWall()
         {
             this.menu = new List<string>();
             this.action = new List<string>();
+            this.menu.Add("Menu Principal. Début du menu.");
+            this.action.Add("VOID");
             this.menu.Add("Lire les messages");
             this.action.Add("READPOSTS");
             this.menu.Add("Ecrire un nouveau message");
@@ -175,10 +214,10 @@
             {
                 this.listBox1.Items.Add(s);
             }
+            this.listBox1.KeyPress += MenuKeyPressHandler;
+            this.listBox1.SelectedIndexChanged += ReadMenuOnChange;
             this.listBox1.SelectedIndex = 0;
             this.listBox1.Select();
-            this.listBox1.KeyPress += MenuKeyPressHandler;
-            this.listBox1.SelectedIndexChanged += ReadMenuOnChange;
         }

         private void LoadMenuInfoReadPosts()
@@ -199,14 +238,96 @@
             {
                 this.listBox1.Items.Add(s);
             }
+            this.listBox1.PreviewKeyDown += ReadPostsKeyPressHandler;
+            this.listBox1.SelectedIndexChanged += InfoMenuOnChange;
             this.listBox1.ClearSelected();
             this.listBox1.Select();
-            this.listBox1.PreviewKeyDown += ReadPostsKeyPressHandler;
+        }
+
+        private void LoadMenuInfoReadComments()
+        {
+            this.menu = new List<string>();
+            this.action = new List<string>();
+            this.menu.Add("Lecture des commentaires");
+            this.action.Add("VOID");
+            this.menu.Add("Haut : Commentaire précedent");
+            this.action.Add("VOID");
+            this.menu.Add("Bas : Commentaire suivant");
+            this.action.Add("VOID");
+            this.menu.Add("Gauche : Retour");
+            this.action.Add("VOID");
+            this.ClearMenuDelegates();
+            this.listBox1.Items.Clear();
+            foreach (string s in this.menu)
+            {
+                this.listBox1.Items.Add(s);
+            }
+            this.listBox1.PreviewKeyDown += ReadCommentsKeyPressHandler;
             this.listBox1.SelectedIndexChanged += InfoMenuOnChange;
+            this.listBox1.ClearSelected();
+            this.listBox1.Select();
+        }
+
+        private void PopulateMenuWithGroups(object sender, EventArgs e)
+        {
+            this.webBrowser.DocumentCompleted -= PopulateMenuWithGroups;
+
+            this.menu = new List<string>();
+            this.action = new List<string>();
+
+            HtmlDocument doc = webBrowser.Document;
+
+            foreach (HtmlElement el0 in doc.All)
+            {
+                if (el0.TagName == "A")
+                {
+                    if (el0.GetAttribute("className") == "groupsRecommendedTitle")
+                    {
+                        this.menu.Add(DataFromHtmlElement(el0));
+                        this.action.Add("GOTOURL " + el0.GetAttribute("href"));
+                    }
+                }
+            }
+
+            this.menu.Add("Retour");
+            this.action.Add("BACKTOMAINMENU");
+
+            this.ClearMenuDelegates();
+            this.listBox1.Items.Clear();
+            foreach (string s in this.menu)
+            {
+                this.listBox1.Items.Add(s);
+            }
+            this.listBox1.SelectedIndex = 0;
+            this.listBox1.Select();
+            this.listBox1.KeyPress += MenuKeyPressHandler;
+            this.listBox1.SelectedIndexChanged += ReadMenuOnChange;
+        }
+
+        private void UnfoldFullPage()
+        {
+            HtmlDocument doc = webBrowser.Document;
+
+            foreach (HtmlElement el0 in doc.All)
+            {
+                if (el0.GetAttribute("className") == "UFIPagerLink")
+                {
+                    el0.InvokeMember("Click");
+                }
+                else if (el0.GetAttribute("className").Contains(" fss"))
+                {
+                    if (el0.Parent.GetAttribute("className") == "UFICommentBody")
+                    {
+                        el0.InvokeMember("Click");
+                    }
+                }
+            }
         }

         private void FocusPrevMessage()
         {
+            this.UnfoldFullPage();
+
             HtmlDocument doc = webBrowser.Document;
             HtmlElement lastFound = null;

@@ -244,6 +365,8 @@

         private void FocusNextMessage()
         {
+            this.UnfoldFullPage();
+
             HtmlDocument doc = webBrowser.Document;

             int index = 0;
@@ -337,40 +460,122 @@
             this.currentMessage.ScrollIntoView(true);
         }

-        private void PopulateMenuWithGroups(object sender, EventArgs e)
-        {
-            this.webBrowser.DocumentCompleted -= PopulateMenuWithGroups;
-
-            this.menu = new List<string>();
-            this.action = new List<string>();
-
+        private void FocusPrevComment()
+        {
+            if (this.currentMessage == null)
+            {
+                return;
+            }
+            if (this.currentComment == null)
+            {
+                return;
+            }
+
+            HtmlElement lastFound = null;
+
+            foreach (HtmlElement el0 in currentMessage.All)
+            {
+                if (el0.GetAttribute("className") == "UFICommentContentBlock")
+                {
+                    if (el0 == this.currentComment)
+                    {
+                        break;
+                    }
+                    lastFound = el0;
+                }
+            }
+
+            if (lastFound != null)
+            {
+                this.currentComment = lastFound;
+            }
+
+            if (this.currentComment != null)
+            {
+                this.FocusCurrentComment();
+            }
+        }
+
+        private void FocusNextComment()
+        {
             HtmlDocument doc = webBrowser.Document;

-            foreach (HtmlElement el0 in doc.All)
-            {
-                if (el0.TagName == "A")
-                {
-                    if (el0.GetAttribute("className") == "groupsRecommendedTitle")
-                    {
-                        this.menu.Add(DataFromHtmlElement(el0));
-                        this.action.Add("GOTOURL " + el0.GetAttribute("href"));
-                    }
-                }
-            }
-
-            this.menu.Add("Retour");
-            this.action.Add("BACKTOMAINMENU");
-
-            this.ClearMenuDelegates();
-            this.listBox1.Items.Clear();
-            foreach (string s in this.menu)
-            {
-                this.listBox1.Items.Add(s);
-            }
-            this.listBox1.SelectedIndex = 0;
-            this.listBox1.Select();
-            this.listBox1.KeyPress += MenuKeyPressHandler;
-            this.listBox1.SelectedIndexChanged += ReadMenuOnChange;
+            int index = 0;
+            bool found = false;
+            foreach (HtmlElement el0 in this.currentMessage.All)
+            {
+                if (el0.GetAttribute("className") == "UFICommentContentBlock")
+                {
+                    index++;
+                    if (found == true)
+                    {
+                        this.currentComment = el0;
+                        break;
+                    }
+                    else if (this.currentComment == null)
+                    {
+                        this.currentComment = el0;
+                        break;
+                    }
+                    else if (el0 == this.currentComment)
+                    {
+                        found = true;
+                    }
+                }
+            }
+
+            if (currentComment != null)
+            {
+                this.FocusCurrentComment();
+            }
+        }
+
+        private void FocusCurrentComment()
+        {
+            string author = "Anonyme";
+            string date = "inconnu";
+            string content = "";
+            int likesCount = 0;
+
+            foreach (HtmlElement el2 in this.currentComment.All)
+            {
+                if (el2.GetAttribute("className").Contains("UFICommentActorName"))
+                {
+                    author = DataFromHtmlElement(el2.FirstChild);
+                }
+                else if (el2.TagName == "ABBR")
+                {
+                    date = UnixTimeStampToDateTime(el2.GetAttribute("data-utime")).ToShortDateString();
+                }
+                else if (el2.GetAttribute("className") == "UFICommentBody")
+                {
+                    foreach (HtmlElement el3 in el2.All)
+                    {
+                        content += DataFromHtmlElement(el3) + " ";
+                    }
+                }
+                else if (el2.GetAttribute("className") == "UFICommentLikeButton")
+                {
+                    foreach (HtmlElement el3 in el2.All)
+                    {
+                        if (el3.TagName == "SPAN")
+                        {
+                            int tmpLikesCount = 0;
+                            int.TryParse(DataFromHtmlElement(el3), out tmpLikesCount);
+                            likesCount = tmpLikesCount;
+                        }
+                    }
+                }
+            }
+
+            string voiceOutput = "";
+            voiceOutput += "Commentaire de " + author + " le " + date + " : " + content + ". " + likesCount + " personnes aiment.";
+            output.Text = voiceOutput;
+            this.vocalSynth.SpeakAsyncCancelAll();
+            this.vocalSynth.SpeakAsync(voiceOutput);
+
+            this.currentComment.Focus();
+            this.currentComment.ScrollIntoView(true);
         }

         private void FocusNewMessageBox()
@@ -516,7 +721,6 @@
             }
         }

-        // Putain si ça marche ça va être un joyeux bordel, mais c'est marrant.
         private void CommentEverythingOnScreen()
         {
             output.Text = "";
@@ -536,7 +740,6 @@
             }
         }

-        // Putain si ça marche ça va être un joyeux bordel, mais c'est marrant.
         private void LikeEverythingOnScreen()
         {
             output.Text = "";
@@ -695,12 +898,17 @@
             output.Text = (b - a).ToString();
         }

+        private void CancelAndSpeak(string s)
+        {
+            this.vocalSynth.SpeakAsyncCancelAll();
+            this.vocalSynth.SpeakAsync(s);
+        }
+
         private void ReadMenuOnChange(object sender, EventArgs e)
         {
-            this.vocalSynth.SpeakAsyncCancelAll();
             if (this.listBox1.SelectedItem != null)
             {
-                this.vocalSynth.SpeakAsync(this.listBox1.SelectedItem.ToString());
+                this.CancelAndSpeak(this.listBox1.SelectedItem.ToString());
             }
         }


fixed two unit test that failed when added filtering to Events.RegisterHandler

--- src/Nvents/Events.cs
+++ src/Nvents/Events.cs
@@ -66,7 +66,7 @@
 			{
 				registerHandler
 					.MakeGenericMethod(new Type[] { eventType })
-					.Invoke(null, new object[] { handler });
+					.Invoke(null, new object[] { handler, null });
 			}
 		}


bug fix on readTableBinary for longs

bug fix on readTableBinary for longs

--- primitives.cs
+++ primitives.cs
@@ -775,7 +775,7 @@
             else if (x.GetType() == typeof(A<long>) && (x.Rank == 1 || x.Rank == 0)) {
                 var rowIndices = (x as A<long>).Ravel;
                 var v = yt.Clone();
-                v.indices = rowIndices;
+                v.indices = v.indices == null ? rowIndices : rowIndices.Select(xv => v.indices[xv]).ToArray();
                 return v.WrapA();
             }
             else if (x.GetType() == typeof(A<JString>) && x.Rank < 2) {
@@ -2689,7 +2689,7 @@
                         else if (spec.StartsWith("l")) {
                             var rows = num / sizeof(long);
                             long[] arr = new long[num];
-                            System.Runtime.InteropServices.Marshal.Copy(IntPtr.Add(new IntPtr(ptr), 0), arr, 0, (int)num);
+                            System.Runtime.InteropServices.Marshal.Copy(IntPtr.Add(new IntPtr(ptr), 0), arr, 0, (int)rows);
                             val = new A<long>(new long[] { rows }) { Ravel = arr };
                         }
                         view.SafeMemoryMappedViewHandle.ReleasePointer();


add 'this' to locals for table expressions

--- primitives.cs
+++ primitives.cs
@@ -2291,6 +2291,7 @@
                 for (var ii = 0; ii < newY.Columns.Length; ii++) {
                     locals[JTable.SafeColumnName(newY.Columns[ii])] = newY.Rows[ii].val;
                 }
+                locals["this"] = newY.WrapA();

                 var oldLocals = Parser.LocalNames;
                 Parser.LocalNames = locals;


solution

solution

--- leetcode/C_sharp/online_judge/leetcode/easy/Problem104.cs
+++ leetcode/C_sharp/online_judge/leetcode/easy/Problem104.cs
@@ -12,11 +12,11 @@
         {
             if (root != null)
             {
-                Math.Max(MaxDepth(root.left), MaxDepth(root.right));
+                return 1 + Math.Max(MaxDepth(root.left), MaxDepth(root.right));
             }
             else
             {
-                return 1;
+                return 0;
             }
         }
     }


Progress bar now clamps invalid progress values. Removed scale. Added width and height properties.

--- 2HourGame/View/ProgressBar.cs
+++ 2HourGame/View/ProgressBar.cs
@@ -16,18 +16,35 @@

         public Color FillColor { get; set; }
         public Color EmptyColor { get; set; }
-        public float Scale { get; set; }
         public Vector2 Position { get; set; }

+        float progress;
         /// <summary>
-        /// [0.0f - 1.0f]
+        /// Clamped to [0.0f - 1.0f]
         /// </summary>
-        public float Progress { get; set; }
+        public float Progress {
+            get { return progress; }
+            set
+            {
+                progress = MathHelper.Clamp(value, 0.0f, 1.0f);
+            }
+        }
+        Vector2 Scale { get; set; }
+        public float Width
+        {
+            get { return Scale.X * Texture.Width; }
+            set { Scale = new Vector2(Scale.X * value / Texture.Width, Scale.Y); }
+        }
+        public float Height
+        {
+            get { return Scale.Y * Texture.Height; }
+            set { Scale = new Vector2(Scale.X, Scale.Y * value / Texture.Height); }
+        }

         public ProgressBar() {
             FillColor = Color.Green;
             EmptyColor = Color.Yellow;
-            Scale = 1.0f;
+            Scale = Vector2.One;
         }

         public void LoadContent(ITextureManager textureManager)


git-svn-id: svn://svn.hahoyer.dyndns.org/migrep1/trunk/Reni@4156 c0adb3ac-85ad-b347-9a16-a660ac379d24

--- src/reni2/Code/BitCast.cs
+++ src/reni2/Code/BitCast.cs
@@ -119,14 +119,12 @@
             if (TargetSize == Size && TargetSize == SignificantSize)
                 return new LeafElement[]{precedingElement};
             if (TargetSize != Size)
-            {
                 return new LeafElement[]
                            {
                                new BitArrayOp(precedingElement.OpToken, precedingElement.Size + Size - TargetSize,
                                               precedingElement.LeftSize, precedingElement.RightSize),
                                new BitCast(Size, Size, SignificantSize)
                            };
-            }
             return null;
         }


Updated ToDos and added "future plans"

Updated ToDos and added "future plans"

--- AST/CodeGen/CodeGenOptions.cs
+++ AST/CodeGen/CodeGenOptions.cs
@@ -48,3 +48,143 @@

 	//Methods enter ate Left,0 in ... They can exit at multiple places
 }
+
+
+/* PLAN FOR METHOD FINDING
+
+2 Lanes Left : For Jump In and Jump Back
+1 Lane Right from Code for Jump out (goes up -> and then left down)
+
+On Finding Stack:[Target, Params, BackJump]
+On Found   Stack:[Params, BackJump]
+On Run     Stack:[???, BackJump]
+On Leave   Stack:[Result, BackJump] --> then swap [BackJump, Result]
+(Every Method becomes return 0; appended)
+(Even normal return; return Value 0)
+
+#################
+
+[!] BackJump Locations MUST have Y-DIstance from >= 3
+(Method In Jump also - but this should be always given (EVALUATE !!!, perhaps force MethodSize >= 3))
+
+##### CODE ######
+
+1
+-
+:
+!
+#
+>
+|
+
+####################
+
+v:-1<
+>#v_>
+  > v
+
+
+#####################
+
+v_v#   <<<<<<< // 0-> Right Lane || 1 -> Left Lane
+|#|
+|#|
+|#|
+L: BackJump (5x3 Jmpr)
+R: InJump   (1x7 Jmpr)
+
+
+#####################
+
+Alternative: flooding stack with all needed vals: (i think preferable)
+
+$_v#!:-1<\1
+  >0\   ^
+
+==> Stack:[5] becomes Stack:[1,0,0,0,0]
+
+==> kein 1-:! mehr
+nurnoch:
+
+#
+>@
+|
+
+
+################## EXAMPLE #############
+
+v
+#
+>3v
+?1v4
+>2v
+v <
+> :."=",                   v
+
+v          $_v#!:-1<\1     <
+             >0\   ^
+
+v
+v
+
+#
+>    "1",@
+|
+
+#
+>    "2",@
+|
+
+#
+>    "3",@
+|
+
+#
+>    "4",@
+|
+
+#
+>    "5",@
+|
+
+
+*/
+
+/*
+
+// Encode dynamically Base-9 number
+
+v      ########## >>#$>#<  @
+>  9:* ## 5471 ## 0>\:9`|
+       ##########  ^+*9\<
+
+#### Digits in Base-9 ####
+
+8Bit  = ~  3 B9
+32Bit = ~ 10 B9
+64Bit = ~ 20 B9
+
+
+##########################
+Generate Random Nmbr
+##########################
+
+v              ,,+55+49  <
+v      >>v               .
+v      21v      >>#$>#<  ^
+> 59>#v?^>\1-:#v_>\:4`|
+      3>0^       ^+*4\<
+    ^          <
+      >  ^
+
+########### RPOGRAM IDEAS #######
+
+Find way through Labyrinth thats written on display (recursive / Bruteforce)
+Maze Generation
+Solve Sudoku Thats inputted on Display (recursive Bruteforce)
+Generate Sudoku on Display
+Quicksort input
+Befunge Interpreter
+Generate  Math Question and check answers
+
+*/


Rig our module initializer to register stuff

--- Akavache/ModuleInitializer.cs
+++ Akavache/ModuleInitializer.cs
@@ -1,6 +1,9 @@
 /// <summary>
 /// Used by the ModuleInit. All code inside the Initialize method is ran as soon as the assembly is loaded.
 /// </summary>
+using Splat;
+using Akavache;
+
 public static class ModuleInitializer
 {
     /// <summary>
@@ -8,6 +11,10 @@
     /// </summary>
     public static void Initialize()
     {
-
+        Locator.RegisterResolverCallbackChanged(() =>
+        {
+            if (Locator.CurrentMutable == null) return;
+            Locator.CurrentMutable.InitializeAkavache();
+        });
     }
 }


Removed unused usings

Removed unused usings

--- AngleSharp/Html/HtmlParser.cs
+++ AngleSharp/Html/HtmlParser.cs
@@ -1,13 +1,10 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Text;
 using AngleSharp.DOM;
-using AngleSharp.DOM.Collections;
 using AngleSharp.DOM.Html;
 using AngleSharp.DOM.Mathml;
 using AngleSharp.DOM.Svg;
-using AngleSharp.DOM.Xml;
 using System.Threading.Tasks;
 using System.Diagnostics;

@@ -18,7 +15,7 @@
     /// 8.2.5 Tree construction, on the following page:
     /// http://www.w3.org/html/wg/drafts/html/master/syntax.html
     /// </summary>
-    //[DebuggerStepThrough]
+    [DebuggerStepThrough]
     public class HtmlParser : IParser
     {
         #region Members