2 more mnemonics

2 more mnemonics

svn path=/trunk/; revision=3565

--- src/MainWindow.cs
+++ src/MainWindow.cs
@@ -2964,11 +2964,11 @@
 		}

 		//if (last_tags_selected_count != tags_selected) {
-		((Gtk.Label)find_add_tag.Child).Text = String.Format (
+		((Gtk.Label)find_add_tag.Child).TextWithMnemonic = String.Format (
 			Catalog.GetPluralString ("Find _Selected Tag", "Find _Selected Tags", tags_selected), tags_selected
 		);

-		((Gtk.Label)find_add_tag_with.Child).Text = String.Format (
+		((Gtk.Label)find_add_tag_with.Child).TextWithMnemonic = String.Format (
 			Catalog.GetPluralString ("Find Selected Tag _With", "Find Selected Tags _With", tags_selected), tags_selected
 		);


Prevent infinite recursion when getting children of a YAML item when Dilithium is active


Fix bug where searching for collection element doesn't work

--- Cascara/Src/Interpreter/Symbol.cs
+++ Cascara/Src/Interpreter/Symbol.cs
@@ -171,10 +171,29 @@
                 return;
             }

+            string tempName = name;
+
+            // Read collection index and remove from symbol name (if applicable)
+            bool isSearchingForCollection = TryGetElementIndex(tempName, out int index);
+            if (isSearchingForCollection)
+            {
+                tempName = StripCollectionNotation(tempName);
+            }
+
             // Add entry to list if it exists in the current table
-            if (sym.symbolTable.TryGetValue(name, out Symbol entry))
-            {
-                results.Add(entry);
+            if (sym.symbolTable.TryGetValue(tempName, out Symbol entry))
+            {
+                if (isSearchingForCollection)
+                {
+                    if (entry.IsCollection && index < entry.ElementCount)
+                    {
+                        results.Add(entry.collectionSymbols[index]);
+                    }
+                }
+                else
+                {
+                    results.Add(entry);
+                }
             }

             // Search the parent table


default cropper can be upgraded

default cropper can be upgraded

--- idseefeld.de.imagecropper/imagecropper/DataEditor.cs
+++ idseefeld.de.imagecropper/imagecropper/DataEditor.cs
@@ -46,7 +46,7 @@

 		public DataEditor(umbraco.interfaces.IData Data, string Configuration)
 		{
-			data = (umbraco.cms.businesslogic.datatype.FileHandlerData) Data;
+			data = (umbraco.cms.businesslogic.datatype.FileHandlerData)Data;
 			config = new Config(Configuration);
 		}

@@ -326,66 +326,89 @@
 				}

 				// stored
-				if (xml.DocumentElement != null && xml.DocumentElement.ChildNodes.Count == config.presets.Count)
-				{
-					XmlNode xmlNode = xml.DocumentElement.ChildNodes[i];
-
-					string newUrl = xmlNode.Attributes["newUrl"] != null
-						? xmlNode.Attributes["newUrl"].Value : String.Empty;
-					if (!String.IsNullOrEmpty(newUrl))
+				if (xml.DocumentElement != null)
+				{
+					XmlNode xmlNode = null;
+					foreach (var child in xml.DocumentElement.ChildNodes)
 					{
-						config.versionedCropFiles.Add(newUrl);
+						if (((XmlNode)child).Attributes["name"].Value
+							.Equals(preset.Name, StringComparison.InvariantCultureIgnoreCase))
+						{
+							xmlNode = (XmlNode)child;
+							break;
+						}
 					}
-					int xml_x = Convert.ToInt32(xmlNode.Attributes["x"].Value);
-					int xml_y = Convert.ToInt32(xmlNode.Attributes["y"].Value);
-					int xml_x2 = Convert.ToInt32(xmlNode.Attributes["x2"].Value);
-					int xml_y2 = Convert.ToInt32(xmlNode.Attributes["y2"].Value);
-
-					int xml_width = -1;
-					int xml_height = -1;
-					if (xmlNode.Attributes["width"] != null)
-						int.TryParse(xmlNode.Attributes["width"].Value, out xml_width);
-					if (xmlNode.Attributes["height"] != null)
-						int.TryParse(xmlNode.Attributes["height"].Value, out xml_height);
-
-					DateTime fileDate = Convert.ToDateTime(xml.DocumentElement.Attributes["date"].Value);
-					if (xml_width < 0 || xml_height < 0)
+					if (xmlNode == null)
+						xmlNode = xml.DocumentElement.ChildNodes[i];
+
+					if (xmlNode != null)
 					{
-						//update from previous version or default cropper: use default
-					}else if (xml_width > 0 && xml_height > 0
-						&& preset.TargetHeight > 0
-						&& preset.TargetWidth > 0
-						&& (preset.TargetWidth != xml_width || preset.TargetHeight != xml_height))
-					{
-						float targetAR = (float)preset.TargetWidth / preset.TargetHeight;
-						float xml_AR = (float)xml_width / xml_height;
-						if (targetAR < xml_AR)
-						{
-							//target is more portrait like then stored value
+						string newUrl = xmlNode.Attributes["newUrl"] != null
+							? xmlNode.Attributes["newUrl"].Value : String.Empty;
+						if (!String.IsNullOrEmpty(newUrl))
+						{
+							config.versionedCropFiles.Add(newUrl);
+						}
+						int xml_x = Convert.ToInt32(xmlNode.Attributes["x"].Value);
+						int xml_y = Convert.ToInt32(xmlNode.Attributes["y"].Value);
+						int xml_x2 = Convert.ToInt32(xmlNode.Attributes["x2"].Value);
+						int xml_y2 = Convert.ToInt32(xmlNode.Attributes["y2"].Value);
+
+						int xml_width = -1;
+						int xml_height = -1;
+						if (xmlNode.Attributes["width"] != null)
+							int.TryParse(xmlNode.Attributes["width"].Value, out xml_width);
+						if (xmlNode.Attributes["height"] != null)
+							int.TryParse(xmlNode.Attributes["height"].Value, out xml_height);
+						if (xml_width < 0 && xml_height < 0)
+						{
+							//update from previous version or default cropper: use preset values
+							xml_height = preset.TargetHeight;
+							xml_width = preset.TargetWidth;
+						}
+						DateTime fileDate = Convert.ToDateTime(xml.DocumentElement.Attributes["date"].Value);
+
+						string xml_name = xmlNode.Attributes["name"].Value;
+						//if (xml_width < 0 || xml_height < 0)
+						if (!xml_name.Equals(preset.Name, StringComparison.InvariantCultureIgnoreCase))
+						{
+							//cropper definiton is different: use default
+						}
+						else if (xml_width > 0 && xml_height > 0
+						   && preset.TargetHeight > 0
+						   && preset.TargetWidth > 0
+						   && (preset.TargetWidth != xml_width || preset.TargetHeight != xml_height))
+						{
+							float targetAR = (float)preset.TargetWidth / preset.TargetHeight;
+							float xml_AR = (float)xml_width / xml_height;
+							if (targetAR < xml_AR)
+							{
+								//target is more portrait like then stored value
+								crop.Y = xml_y;
+								crop.Y2 = xml_y2;
+								int newHeight = xml_y2 - xml_y;
+								int newWidth = (int)Math.Round(newHeight * targetAR);
+								crop.X = (xml_x2 - xml_x - newWidth) / 2 + xml_x;
+								crop.X2 = crop.X + newWidth;
+							}
+							else
+							{
+								//target is more landscape like then stored value
+								crop.X = xml_x;
+								crop.X2 = xml_x2;
+								int newWidth = xml_x2 - xml_x;
+								int newHeight = (int)Math.Round(newWidth / targetAR);
+								crop.Y = (xml_y2 - xml_y - newHeight) / 2 + xml_y;
+								crop.Y2 = crop.Y + newHeight;
+							}
+						}
+						else if (crop.X != xml_x || crop.X2 != xml_x2 || crop.Y != xml_y || crop.Y2 != xml_y2)
+						{
+							crop.X = xml_x;
 							crop.Y = xml_y;
+							crop.X2 = xml_x2;
 							crop.Y2 = xml_y2;
-							int newHeight = xml_y2 - xml_y;
-							int newWidth = (int)Math.Round(newHeight * targetAR);
-							crop.X = (xml_x2 - xml_x - newWidth) / 2 + xml_x;
-							crop.X2 = crop.X + newWidth;
-						}
-						else
-						{
-							//target is more landscape like then stored value
-							crop.X = xml_x;
-							crop.X2 = xml_x2;
-							int newWidth = xml_x2 - xml_x;
-							int newHeight = (int)Math.Round(newWidth / targetAR);
-							crop.Y = (xml_y2 - xml_y - newHeight) / 2 + xml_y;
-							crop.Y2 = crop.Y + newHeight;
-						}
-					}
-					else if (crop.X != xml_x || crop.X2 != xml_x2 || crop.Y != xml_y || crop.Y2 != xml_y2)
-					{
-						crop.X = xml_x;
-						crop.Y = xml_y;
-						crop.X2 = xml_x2;
-						crop.Y2 = xml_y2;
+						}
 					}
 				}


Fix permissions loading

Fix permissions loading

--- Chraft/Utils/PermissionHandler.cs
+++ Chraft/Utils/PermissionHandler.cs
@@ -56,7 +56,7 @@
             var preDisallowedList = new List<string>();
             var perm =
                 _permissionXml.Descendants("Users").Descendants("User").Where(
-                    n => (string) n.Attribute("Name") == client.Username.ToLower()).FirstOrDefault();
+                    n => ((string) n.Attribute("Name")).ToLower() == client.Username.ToLower()).FirstOrDefault();

             //default group we grab the first with default attrbute defined
             var gperm =


Proper light level check in the grass' grow methods.

--- Chraft/World/Blocks/BlockGrass.cs
+++ Chraft/World/Blocks/BlockGrass.cs
@@ -33,8 +33,8 @@
                                                                   block.Coords.WorldZ);

                 byte blockAboveId = (byte)chunk.GetType(oneUp);
-                byte blockAboveLight = chunk.GetBlockLight(oneUp);
-                if ((blockAboveLight < 4 && BlockHelper.Instance(blockAboveId).Opacity > 2) || blockAboveLight >= 9)
+                byte? blockAboveLight = chunk.World.GetEffectiveLight(oneUp);
+                if (blockAboveLight != null && ((blockAboveLight < 4 && BlockHelper.Instance(blockAboveId).Opacity > 2) || blockAboveLight >= 9))
                     canGrow = true;
             }
             else
@@ -52,7 +52,9 @@

             UniversalCoords oneUp = UniversalCoords.FromWorld(block.Coords.WorldX, block.Coords.WorldY + 1, block.Coords.WorldZ);
             byte blockAboveId = (byte)chunk.GetType(oneUp);
-            byte blockAboveLight = chunk.GetBlockLight(oneUp);
+            byte? blockAboveLight = chunk.World.GetEffectiveLight(oneUp);
+            if (blockAboveLight == null)
+                return;
             if (blockAboveLight < 4 && BlockHelper.Instance(blockAboveId).Opacity > 2)
             {
                 if (block.World.Server.Rand.Next(3) == 0)
@@ -77,8 +79,8 @@
                 if (newBlockId != (byte)BlockData.Blocks.Dirt)
                     return;

-                byte newBlockAboveLight = nearbyChunk.GetBlockLight(x & 0xF, y + 1, z & 0xf);
-                if (newBlockAboveLight >= 4 && BlockHelper.Instance(newBlockId).Opacity <= 2)
+                byte? newBlockAboveLight = nearbyChunk.World.GetEffectiveLight(UniversalCoords.FromWorld(x, y + 1, z));
+                if (newBlockAboveLight != null && (newBlockAboveLight >= 4 && BlockHelper.Instance(newBlockId).Opacity <= 2))
                     nearbyChunk.SetBlockAndData(x & 0xF, y, z & 0xF, (byte)BlockData.Blocks.Grass, 0);
             }
         }


Improved interactive layer performance when using fast repetitive macros

- Should help #673


Update CloudinaryTest.cs

Update CloudinaryTest.cs

--- Cloudinary.Test/CloudinaryTest.cs
+++ Cloudinary.Test/CloudinaryTest.cs
@@ -793,7 +793,7 @@

             var requestParams = new ListResourcesByModerationParams()
             {
-                MaxResults = 1000,
+                MaxResults = 500,
                 ModerationKind = "manual",
             };

@@ -1205,7 +1205,7 @@
                 var listParams = new ListResourcesParams()
                 {
                     NextCursor = nextCursor,
-                    MaxResults = 1000
+                    MaxResults = 500
                 };

                 var existingResources = m_cloudinary.ListResources(listParams);


drawing now emits show entity earleir

drawing now emits show entity earleir

--- SabberStoneCore/Actions/Generic.cs
+++ SabberStoneCore/Actions/Generic.cs
@@ -81,12 +81,13 @@
                     c.Graveyard.Add(playable);
                     return false;
                 }
-                c.Game.Log(LogLevel.INFO, BlockType.PLAY, "AddHandPhase", $"adding to hand {playable}.");
-                c.Hand.Add(playable);

                 // add draw block show entity
                 if (c.Game.History && playable != null)
                     c.Game.PowerHistory.Add(PowerHistoryBuilder.ShowEntity(playable));
+
+                c.Game.Log(LogLevel.INFO, BlockType.PLAY, "AddHandPhase", $"adding to hand {playable}.");
+                c.Hand.Add(playable);

                 return true;
             };


Add random number to public ID of upload test

Avoid clashing with a resource loaded in a previous test.

--- Cloudinary.Test/CloudinaryTest.cs
+++ Cloudinary.Test/CloudinaryTest.cs
@@ -17,6 +17,7 @@
     [TestFixture]
     public class CloudinaryTest
     {
+        private const string TEST_TAG = "cloudinarydotnet_test";
         Account m_account;
         Cloudinary m_cloudinary;
         string m_testImagePath;
@@ -352,8 +353,9 @@
             var uploadParams = new ImageUploadParams()
             {
                 File = new FileDescription(m_testImagePath),
-                PublicId = "test_raw_overwrite",
-                Overwrite = false
+                PublicId = "test_raw_overwrite" + new Random().Next(),
+                Overwrite = false,
+                Tags = TEST_TAG
             };

             var img1 = m_cloudinary.Upload(uploadParams, "raw");


Issue with VS 2015 compatibility

Issue with VS 2015 compatibility

--- CodeJam.Data/Migrations/Runner.cs
+++ CodeJam.Data/Migrations/Runner.cs
@@ -47,7 +47,7 @@
         {
             public bool PreviewOnly { get; set; }
             public int Timeout { get; set; }
-            public string ProviderSwitches => string.Empty;
+            public string ProviderSwitches { get { return string.Empty; } }
         }

         private readonly MigrationRunner _runner;


Made SharpRaven.Data.SentryException.Stacktrace into a property.

--- SharpRaven/Data/SentryException.cs
+++ SharpRaven/Data/SentryException.cs
@@ -25,7 +25,7 @@
         /// The stacktrace of the exception.
         /// </summary>
         [JsonProperty(PropertyName = "stacktrace")]
-        public SentryStacktrace Stacktrace;
+        public SentryStacktrace Stacktrace { get; set; }

         public SentryException(Exception e) {


support !Interactive for RemoveDuplicatesIfNecessary

--- Signum.Engine/Engine/SqlBuilder.cs
+++ Signum.Engine/Engine/SqlBuilder.cs
@@ -357,26 +357,34 @@

                 var columns = uniqueIndex.Columns.ToString(c => c.Name.SqlEscape(), ", ");

-
-                if (SafeConsole.Ask($"There are {count} rows in {uniqueIndex.Table.Name} with the same {columns}. Generate DELETE duplicates script?"))
+                if (rep.Interactive)
                 {
-                    return new SqlPreCommandSimple($@"DELETE {uniqueIndex.Table.Name}
+                    if (SafeConsole.Ask($"There are {count} rows in {uniqueIndex.Table.Name} with the same {columns}. Generate DELETE duplicates script?"))
+                        return RemoveDuplicates(uniqueIndex, primaryKey, columns, commentedOut: false);
+
+                    return null;
+                }
+                else
+                {
+                    return RemoveDuplicates(uniqueIndex, primaryKey, columns, commentedOut: true);
+                }
+            }
+            catch (Exception)
+            {
+                return new SqlPreCommandSimple($"-- Impossible to determine duplicates in new index {uniqueIndex.IndexName}");
+
+            }
+        }
+
+        private static SqlPreCommand RemoveDuplicates(UniqueIndex uniqueIndex, IColumn primaryKey, string columns, bool commentedOut)
+        {
+            return new SqlPreCommandSimple($@"DELETE {uniqueIndex.Table.Name}
 WHERE {primaryKey.Name} NOT IN
 (
     SELECT MIN({primaryKey.Name})
     FROM {uniqueIndex.Table.Name}
     GROUP BY {columns}
-)");
-                }
-
-                return null;
-
-            }
-            catch (Exception e)
-            {
-                return new SqlPreCommandSimple($"-- Impossible to determine duplicates in new index {uniqueIndex.IndexName}");
-
-            }
+)".Let(txt => commentedOut ? txt.Indent(2, '-') : txt));
         }

         public static SqlPreCommand CreateIndexBasic(Index index, bool forHistoryTable)


Refactored Engine.ProcessCommand() method - replaced switch with delegate-dictionary/

--- Source/GameFifteen.Logic/Engine.cs
+++ Source/GameFifteen.Logic/Engine.cs
@@ -19,6 +19,7 @@
         private Player player;
         private bool isGameOver;
         private GridMemory gridMemory;
+        private IDictionary<Command, Action> commands;

         public Engine(IRenderer renderer, IUserInterface userInterface, IGameInitializater gameInitializer)
         {
@@ -29,6 +30,7 @@
             this.scoreBoard = Scoreboard.Instance;
             this.player = new Player();
             this.gridMemory = new GridMemory();
+            this.commands = FillCommands();
         }

         public void Run()
@@ -59,35 +61,41 @@

         public void ProcessCommand(Command command)
         {
-            switch (command)
+            if (commands.ContainsKey(command))
             {
-                case Command.Restart:
-                    this.StartNewGame();
-                    break;
-                case Command.Top:
-                    this.renderer.PrintScoreboard(this.scoreBoard);
-                    break;
-                case Command.Exit:
-                    this.ProcessExitCommand();
-                    break;
-                case Command.Save:
-                    this.ProcessSaveCommand();
-                    break;
-                case Command.Load:
-                    this.ProcessLoadCommand();
-                    break;
-                case Command.Move:
-                    this.ProcessMoveCommand();
-                    break;
-                case Command.Invalid:
-                default:
-                    throw new ArgumentException("Invalid Command!");
+                commands[command]();
             }
+
+        }
+
+        private IDictionary<Command,Action> FillCommands()
+        {
+            this.commands = new Dictionary<Command,Action>();
+            Action startNewGame = this.StartNewGame;
+            Action printScoreBoard = this.PrintScoreBoard;
+            Action processExitCommand = this.ProcessExitCommand;
+            Action processLoadCommand = this.ProcessLoadCommand;
+            Action processMoveCommand = this.ProcessMoveCommand;
+            Action processSaveCommand = this.ProcessSaveCommand;
+            Action processInvalidCommand = () => new ArgumentException("Invalid Command!");
+            commands.Add(Command.Restart, startNewGame);
+            commands.Add(Command.Top, printScoreBoard);
+            commands.Add(Command.Exit, processExitCommand);
+            commands.Add(Command.Save, processSaveCommand);
+            commands.Add(Command.Load, processLoadCommand);
+            commands.Add(Command.Move, processMoveCommand);
+            commands.Add(Command.Invalid, processInvalidCommand);
+            return this.commands;
         }

         private bool IsGameOver()
         {
             return this.grid.IsSorted;
+        }
+
+        private void PrintScoreBoard()
+        {
+            this.renderer.PrintScoreboard(this.scoreBoard);
         }

         //TODO : refactor


Improved duplicate example error message.

--- tools/Imagination.APIDocGenerator/ExampleStore.cs
+++ tools/Imagination.APIDocGenerator/ExampleStore.cs
@@ -153,7 +153,7 @@
                             }
                             else
                             {
-                                SerialisationLog.Error(string.Concat("An example already exists for ", currentExample.ClassName, ".", currentExample.MethodName, ".", currentExample.ExampleType.ToString()));
+                                SerialisationLog.Error(string.Concat("An example already exists for ", currentExample.ClassName, ".", currentExample.MethodName, ".", currentExample.ExampleType.ToString(), "files: [", currentExample.DocFilename, ", ", _Examples[key].DocFilename, "]"));
                             }
                         }
                     }


CCStats is now static

CCStats is now static

--- cocos2d/CCStats.cs
+++ cocos2d/CCStats.cs
@@ -7,6 +7,35 @@
 {

+    /// <summary>
+    /// From http://stackoverflow.com/questions/10889743/cocos2d-2-0-3-numbers-on-the-bottom-left by Steffen Itterheim:
+    ///
+    /// 82    -- number of draw calls
+    /// 0.016 -- time it took to render the frame
+    /// 60.0  -- frames per second
+    ///
+    /// The first number (82) is the number of draw calls (which is fairly high). Typically each node that renders
+    /// something on the screen (sprites, labels, particle fx, etc) increases that number by one. If you use
+    /// a CCSpriteBatchNode and add 100 sprites to it, it will increase the draw call only by 1.
+    ///
+    /// 82 is a pretty high draw call number - depending on the game's complexity and assuming it is well optimized to
+    /// reduce draw calls, the number of draw calls should be around 10 to 40. Assuming all 82 draw calls are sprites,
+    /// then creating a texture atlas out of the sprite images (use TexturePacker, Zwoptex, SpriteHelper) in order to
+    /// use CCSpriteBatchNode you could reduce the number of draw calls to 1. Draw calls are expensive, so it is very
+    /// important to keep that number down.
+    ///
+    /// The time it took to render a frame is in milliseconds. Since you need to draw a new frame every 0.016666666
+    /// seconds in order to achieve 60 frames per second (1/60 = 0,0166…) this number can tell you how close your game
+    /// is to dropping below 60 fps. Yours is pretty close, you have practically no room left for additional game logic
+    /// or visuals before the framerate will drop below 60 fps.
+    ///
+    /// The last number is the number of frames per second. This value, like the previous one, is averaged over several
+    /// frames so that it doesn't fluctuate as much (makes it hard to read).
+    ///
+    /// PS: one other thing to keep in mind is that the bottom two values become misleading can not be compared for
+    /// framerates below 15 fps. For example cocos2d might show 0.0 for the time it took to render a frame at such
+    /// a low framerate.
+    /// </summary>
     public class CCStats
     {

@@ -33,17 +62,13 @@
         CCLabelAtlas m_pGCLabel;

-        public CCStats ()
-        {
-            m_pStopwatch = new Stopwatch();
-        }
-
-
         public void Prepare ()
         {
             if (m_pFPSLabel == null) {
                 CCTexture2D texture;
                 CCTextureCache textureCache = CCTextureCache.SharedTextureCache;
+
+                m_pStopwatch = new Stopwatch();

                 try {
                     texture = !textureCache.Contains ("cc_fps_images") ? textureCache.AddImage (CCFPSImage.PngData, "cc_fps_images", SurfaceFormat.Bgra4444) : textureCache.TextureForKey ("cc_fps_images");


minor

minor

--- ConsoleApplication16/SubString.cs
+++ ConsoleApplication16/SubString.cs
@@ -37,6 +37,21 @@
                 return false;
             }
             return string.Compare(this.source, this.offset, other.source, other.offset, this.length, stringComparison) == 0;
+        }
+
+        public int Compare(SubString other, StringComparison stringComparison)
+        {
+            int compareResult = string.Compare(this.source, this.offset, other.source, other.offset, this.length, stringComparison);
+            if (compareResult == 0)
+            {
+                return this.length - other.length;
+            }
+            return compareResult;
+        }
+
+        public int Compare(string other, StringComparison stringComparison)
+        {
+
         }

         public override int GetHashCode()


Fixes lightning not colliding (#12553)

Fixes lightning not colliding (#12553)

--- Content.Server/Beam/BeamSystem.cs
+++ Content.Server/Beam/BeamSystem.cs
@@ -3,9 +3,7 @@
 using Content.Shared.Beam;
 using Content.Shared.Beam.Components;
 using Content.Shared.Interaction;
-using Content.Shared.Lightning;
 using Content.Shared.Physics;
-using Robust.Server.GameObjects;
 using Robust.Shared.Map;
 using Robust.Shared.Physics;
 using Robust.Shared.Physics.Collision.Shapes;
@@ -19,6 +17,8 @@
 {
     [Dependency] private readonly FixtureSystem _fixture = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
+    [Dependency] private readonly SharedPhysicsSystem _physics = default!;
+    [Dependency] private readonly SharedTransformSystem _transformSystem = default!;

     public override void Initialize()
     {
@@ -85,12 +85,13 @@
             {
                 ID = "BeamBody",
                 Hard = false,
-                CollisionMask = (int)CollisionGroup.ItemMask, //Change to MobMask
-                CollisionLayer = (int)CollisionGroup.MobLayer //Change to WallLayer
+                CollisionMask = (int)CollisionGroup.ItemMask,
+                CollisionLayer = (int)CollisionGroup.MobLayer
             };

             _fixture.TryCreateFixture(physics, fixture);
-            physics.BodyType = BodyType.Dynamic;
+            _physics.SetBodyType(physics, BodyType.Dynamic);
+            _physics.SetCanCollide(physics, true);

             var beamVisualizerEvent = new BeamVisualizerEvent(ent, distanceLength, userAngle, bodyState, shader);
             RaiseNetworkEvent(beamVisualizerEvent);


Tweak

Tweak

--- Core/Loyc.Collections/Other/Co.cs
+++ Core/Loyc.Collections/Other/Co.cs
@@ -64,7 +64,9 @@
 	/// richer; for example, it supports exceptions properly. If an exception is
 	/// thrown from within a nested iterator, the outer iterator is unable to catch
 	/// the exception; it will be thrown directly into whatever foreach loop (or
-	/// other code) that is enumerating the sequence.
+	/// other code) that is enumerating the sequence. On the other hand, async is
+	/// impoverished, since it can only produce a single output. Also, it is
+	/// difficult to control how and when async methods are executed.
 	/// <para/>
 	/// This class solves the same problem as <see cref="Loyc.Collections.NestedEnumerator{F,T}"/> in
 	/// a way that is very easy to use. You should use <see cref="Loyc.Collections.NestedEnumerator{F,T}"/>


Improved Append and Concat

Improved Append and Concat

- Added new overloads for Append and Concat
- Concat now delegates work to .NET when appropiate
- Improved performance for some cases prior .NET 4
- Small style fixes

--- Core/Theraot/Core/StringHelper.cs
+++ Core/Theraot/Core/StringHelper.cs
@@ -21,6 +21,11 @@
             return string.Concat(text, value1, value2);
         }

+        public static string Append(this string text, string value1, string value2, string value3)
+        {
+            return string.Concat(text, value1, value2, value3);
+        }
+
         public static string Append(this string text, params string[] values)
         {
             return string.Concat(text, values);
@@ -78,18 +83,87 @@
             return string.Concat(values);
         }

+        public static string Concat(object[] array, int arrayIndex)
+        {
+            if (array == null)
+            {
+                throw new ArgumentNullException("array");
+            }
+            if (arrayIndex < 0)
+            {
+                throw new ArgumentOutOfRangeException("arrayIndex", "Non-negative number is required.");
+            }
+            if (arrayIndex == array.Length)
+            {
+                return string.Empty;
+            }
+            return ConcatExtracted(array, arrayIndex, array.Length - arrayIndex);
+        }
+
+        public static string Concat(object[] array, int arrayIndex, int countLimit)
+        {
+            if (array == null)
+            {
+                throw new ArgumentNullException("array");
+            }
+            if (arrayIndex < 0)
+            {
+                throw new ArgumentOutOfRangeException("arrayIndex", "Non-negative number is required.");
+            }
+            if (countLimit < 0)
+            {
+                throw new ArgumentOutOfRangeException("countLimit", "Non-negative number is required.");
+            }
+            if (countLimit > array.Length - arrayIndex)
+            {
+                throw new ArgumentException("array", "startIndex plus countLimit is greater than the number of elements in array.");
+            }
+            if (arrayIndex == array.Length)
+            {
+                return string.Empty;
+            }
+            return ConcatExtracted(array, arrayIndex, countLimit);
+        }
+
+        public static string Concat(IEnumerable<string> values)
+        {
+#if NET20 || NET30 || NET35
+            if (values == null)
+            {
+                throw new ArgumentNullException("values");
+            }
+            var stringList = new List<string>();
+            int length = 0;
+            foreach (var item in values)
+            {
+                stringList.Add(item);
+                length += item.Length;
+            }
+            return ConcatExtractedExtracted(stringList.ToArray(), 0, stringList.Count, length);
+#else
+            return string.Concat(values);
+#endif
+        }
+
         public static string Concat<T>(IEnumerable<T> values)
         {
+#if NET20 || NET30 || NET35
             if (values == null)
             {
                 throw new ArgumentNullException("values");
             }
             var stringList = new List<string>();
+            int length = 0;
             foreach (var item in values)
             {
-                stringList.Add(item.ToString());
-            }
-            return ConcatExtracted(stringList.ToArray(), 0, stringList.Count);
+                var itemToString = item.ToString();
+                stringList.Add(itemToString);
+                length += itemToString.Length;
+            }
+            return ConcatExtractedExtracted(stringList.ToArray(), 0, stringList.Count, length);
+#else
+            return string.Concat(values);
+#endif
         }

         public static string End(this string text, int characterCount)
@@ -254,13 +328,14 @@
             }
             foreach (char character in value)
             {
-                if (!Char.IsWhiteSpace(character))
+                if (!char.IsWhiteSpace(character))
                 {
                     return false;
                 }
             }
             return true;
         }
+
         public static string Join(string separator, params string[] value)
         {
             if (ReferenceEquals(value, null))
@@ -271,7 +346,7 @@
             {
                 separator = string.Empty;
             }
-            return JoinExtracted (separator, value, 0, value.Length);
+            return JoinExtracted(separator, value, 0, value.Length);
         }

         public static string Join(string separator, string[] array, int arrayIndex)
@@ -615,6 +690,24 @@
             {
                 return _text.Substring(0, characterCount);
             }
+        }
+
+        private static string ConcatExtracted(object[] array, int startIndex, int count)
+        {
+            int length = 0;
+            int maxIndex = startIndex + count;
+            var newArray = new string[count];
+            for (int index = startIndex; index < maxIndex; index++)
+            {
+                var item = array[index];
+                if (!ReferenceEquals(item, null))
+                {
+                    var itemToString = item.ToString();
+                    newArray[index - startIndex] = itemToString;
+                    length += itemToString.Length;
+                }
+            }
+            return ConcatExtractedExtracted(newArray, 0, count, length);
         }

         private static string ConcatExtracted(string[] array, int startIndex, int count)
@@ -629,6 +722,11 @@
                     length += item.Length;
                 }
             }
+            return ConcatExtractedExtracted(array, startIndex, maxIndex, length);
+        }
+
+        private static string ConcatExtractedExtracted(string[] array, int startIndex, int maxIndex, int length)
+        {
             if (length <= 0)
             {
                 return string.Empty;
@@ -701,6 +799,7 @@
                 return result.ToString();
             }
         }
+
         /*[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", Justification = "By Design")]
         public static string ToString(this object obj, string onNull)
         {


auto-formatting

auto-formatting

--- DbLinq/Linq/Clause/ParseResult.cs
+++ DbLinq/Linq/Clause/ParseResult.cs
@@ -55,16 +55,16 @@

         public void addJoin(string joinStr)
         {
-            if( ! joins.Contains(joinStr) )
+            if (!joins.Contains(joinStr))
                 joins.Add(joinStr);
         }
-        public readonly Dictionary<Type,string> tablesUsed = new Dictionary<Type,string>();
-        public int MarkSbPosition(){ return sb.Length; }
+        public readonly Dictionary<Type, string> tablesUsed = new Dictionary<Type, string>();
+        public int MarkSbPosition() { return sb.Length; }
         public string Substring(int markedPos)
-        {
-            string full=sb.ToString(); return full.Substring(markedPos,full.Length-markedPos);
+        {
+            string full = sb.ToString(); return full.Substring(markedPos, full.Length - markedPos);
         }
-        public void Revert(int markedPos){ sb.Length=markedPos; }
+        public void Revert(int markedPos) { sb.Length = markedPos; }

         /// <summary>
         /// during building, append to our internal StringBuilder
@@ -72,11 +72,11 @@
         /// <param name="expr"></param>
         public void AppendString(string columnString)
         {
-            if(columnString==",")
+            if (columnString == ",")
             {
                 //end of prev columnString - user should really call EndField()
                 columns.Add(sb.ToString());
-                sb.Length=0;
+                sb.Length = 0;
                 return;
             }
             sb.Append(columnString);
@@ -89,7 +89,7 @@
         public void CopyInto(QueryProcessor qp, SqlExpressionParts sqlParts)
         {
             //sqlParts.whereList.Add( this.sb.ToString());
-            foreach(string key in qp.paramMap.Keys)
+            foreach (string key in qp.paramMap.Keys)
             {
                 //sqlParts.ParametersMap.Add(key, this.ParametersMap[key]);
                 sqlParts.ParametersMap[key] = qp.paramMap[key];
@@ -98,7 +98,7 @@
             foreach (var t1 in tablesUsed)
             {
                 TableAttribute tAttrib = AttribHelper.GetTableAttrib(t1.Key);
-                if(tAttrib!=null)
+                if (tAttrib != null)
                 {
                     //prepare fragment: "[order details] o$"
                     string fromClause = _vendor.GetFieldSafeName(tAttrib.Name) + " " + RemoveTransparentId(t1.Value);
@@ -106,7 +106,7 @@
                     sqlParts.AddFrom(fromClause);
                 }
             }
-            foreach(string joinStr in joins)
+            foreach (string joinStr in joins)
             {
                 sqlParts.JoinList.Add(joinStr);
             }
@@ -130,7 +130,7 @@

         public void EndField()
         {
-            if(this.sb.Length>0)
+            if (this.sb.Length > 0)
             {
                 columns.Add(sb.ToString());
                 sb.Length = 0;


Improve server wait and disconnect after each msg

--- Syndll2/SynelServer.cs
+++ Syndll2/SynelServer.cs
@@ -43,9 +43,9 @@
                     var history = new List<string>();

                     var receiver = new Receiver(stream);
-                    var signal = new SemaphoreSlim(1);
+                    var signal = new ManualResetEvent(false);

-                    receiver.MessageHandler += message =>
+                    receiver.MessageHandler = message =>
                         {
                             if (!history.Contains(message.RawResponse))
                             {
@@ -58,11 +58,15 @@
                                     action(notification);
                                 }
                             }
-                            signal.Release();
+                            signal.Set();
                         };
+
                     receiver.WatchStream();
-                    while (stream.CanRead)
-                        signal.Wait();
+
+                    // Wait until a message is received
+                    while (stream.CanRead && socket.Connected)
+                        if (signal.WaitOne(100))
+                            break;
                 });
             return new SynelServer(connection);
         }