Fixed alignment problem

Fixed alignment problem

--- Mosa/Platforms/x86/Architecture.cs
+++ Mosa/Platforms/x86/Architecture.cs
@@ -1,255 +1,255 @@
-/*
- * (c) 2008 MOSA - The Managed Operating System Alliance
- *
- * Licensed under the terms of the New BSD License.
- *
- * Authors:
- *  Michael Ruck (grover) <sharpos@michaelruck.de>
- *  Phil Garcia (tgiphil) <phil@thinkedge.com>
-*/
-
-using System;
-using System.Collections.Generic;
-
-using Mosa.Runtime.CompilerFramework;
-using Mosa.Runtime.CompilerFramework.Operands;
-using Mosa.Runtime.Metadata;
-using Mosa.Runtime.Metadata.Signatures;
-using Mosa.Platforms.x86.Constraints;
-
-namespace Mosa.Platforms.x86
-{
-
-	/// <summary>
-	/// This class provides a common base class for architecture
-	/// specific operations.
-	/// </summary>
-	public class Architecture : BasicArchitecture
-	{
-		/// <summary>
-		/// Defines the register set of the target architecture.
-		/// </summary>
-		private static readonly Register[] Registers = new Register[]
-        {
-            ////////////////////////////////////////////////////////
-            // 32-bit general purpose registers
-            ////////////////////////////////////////////////////////
-            GeneralPurposeRegister.EAX,
-            GeneralPurposeRegister.ECX,
-            GeneralPurposeRegister.EDX,
-            GeneralPurposeRegister.EBX,
-            GeneralPurposeRegister.ESI,
-            GeneralPurposeRegister.EDI,
-
-            ////////////////////////////////////////////////////////
-            // 128-bit floating point registers
-            ////////////////////////////////////////////////////////
-            SSE2Register.XMM0,
-            SSE2Register.XMM1,
-            SSE2Register.XMM2,
-            SSE2Register.XMM3,
-            SSE2Register.XMM4,
-            SSE2Register.XMM5,
-            SSE2Register.XMM6,
-            SSE2Register.XMM7
-        };
-
-		/// <summary>
-		/// Maps constraints to an instruction. Deprecated.
-		/// </summary>
-		private static readonly Dictionary<Type, Type> Constraints = new Dictionary<Type, Type>
-        {
-            { typeof(CPUx86.AddInstruction), typeof(GPRConstraint) },
-            { typeof(CPUx86.AdcInstruction), typeof(GPRConstraint) },
-            { typeof(CPUx86.DivInstruction), typeof(DivConstraint) },
-            { typeof(CPUx86.AndInstruction), typeof(LogicalAndConstraint) },
-            { typeof(CPUx86.OrInstruction), typeof(LogicalOrConstraint) },
-            { typeof(CPUx86.XorInstruction), typeof(LogicalXorConstraint) },
-            { typeof(CPUx86.MovInstruction), typeof(MoveConstraint) },
-            { typeof(CPUx86.MulInstruction), typeof(MulConstraint) },
-            { typeof(CPUx86.SarInstruction), typeof(ShiftConstraint) },
-            { typeof(CPUx86.ShlInstruction), typeof(ShiftConstraint) },
-            { typeof(CPUx86.ShrInstruction), typeof(ShiftConstraint) },
-            { typeof(CPUx86.SubInstruction), typeof(GPRConstraint) },
-        };
-
-		/// <summary>
-		/// Specifies the architecture features to use in generated code.
-		/// </summary>
-		private ArchitectureFeatureFlags _architectureFeatures;
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="Architecture"/> class.
-		/// </summary>
-		/// <param name="architectureFeatures">The features this architecture supports.</param>
-		private Architecture(ArchitectureFeatureFlags architectureFeatures)
-		{
-			_architectureFeatures = architectureFeatures;
-		}
-
-		/// <summary>
-		/// Retrieves the native integer size of the x86 platform.
-		/// </summary>
-		/// <value>This property always returns 32.</value>
-		public override int NativeIntegerSize
-		{
-			get { return 32; }
-		}
-
-		/// <summary>
-		/// Retrieves the register set of the x86 platform.
-		/// </summary>
-		public override Register[] RegisterSet
-		{
-			get { return Registers; }
-		}
-
-		/// <summary>
-		/// Retrieves the stack frame register of the x86.
-		/// </summary>
-		public override Register StackFrameRegister
-		{
-			get { return GeneralPurposeRegister.EBP; }
-		}
-
-		/// <summary>
-		/// Factory method for the Architecture class.
-		/// </summary>
-		/// <returns>The created architecture instance.</returns>
-		/// <param name="architectureFeatures">The features available in the architecture and code generation.</param>
-		/// <remarks>
-		/// This method creates an instance of an appropriate architecture class, which supports the specific
-		/// architecture features.
-		/// </remarks>
-		public static IArchitecture CreateArchitecture(ArchitectureFeatureFlags architectureFeatures)
-		{
-			if (architectureFeatures == ArchitectureFeatureFlags.AutoDetect)
-				architectureFeatures = ArchitectureFeatureFlags.MMX | ArchitectureFeatureFlags.SSE | ArchitectureFeatureFlags.SSE2;
-
-			return new Architecture(architectureFeatures);
-		}
-
-		/// <summary>
-		/// Creates a new result operand of the requested type.
-		/// </summary>
-		/// <param name="signatureType">The type requested.</param>
-		/// <param name="instructionLabel">The label of the instruction requesting the operand.</param>
-		/// <param name="operandStackIndex">The stack index of the operand.</param>
-		/// <returns>A new operand usable as a result operand.</returns>
-		public override Operand CreateResultOperand(SigType signatureType, int instructionLabel, int operandStackIndex)
-		{
-			return new RegisterOperand(signatureType, GeneralPurposeRegister.EAX);
-		}
-
-		/// <summary>
-		/// Extends the assembly compiler pipeline with x86 specific stages.
-		/// </summary>
-		/// <param name="assemblyCompilerPipeline">The assembly compiler pipeline to extend.</param>
-		public override void ExtendAssemblyCompilerPipeline(CompilerPipeline assemblyCompilerPipeline)
-		{
-		}
-
-		/// <summary>
-		/// Extends the method compiler pipeline with x86 specific stages.
-		/// </summary>
-		/// <param name="methodCompilerPipeline">The method compiler pipeline to extend.</param>
-		public override void ExtendMethodCompilerPipeline(CompilerPipeline methodCompilerPipeline)
-		{
-			// FIXME: Create a specific code generator instance using requested feature flags.
-			// FIXME: Add some more optimization passes, which take advantage of advanced x86 instructions
-			// and packed operations available with MMX/SSE extensions
-			methodCompilerPipeline.InsertAfter<PlatformStubStage>(
-				new IMethodCompilerStage[]
-                {
-					new InstructionLogger(),
-                    new LongOperandTransformationStage(),
-					new InstructionLogger(),
-                    new AddressModeConversionStage(),
-					new InstructionLogger(),
-                    new CILTransformationStage(),
-					new InstructionLogger(),
-                    new IRTransformationStage(),
-					new InstructionLogger(),
-					new TweakTransformationStage(),
-					new InstructionLogger(),
-					new MemToMemConversionStage(),
-					new InstructionLogger(),
-                });
-
-			methodCompilerPipeline.InsertAfter<IBlockOrderStage>(
-				new IMethodCompilerStage[]
-                {
-                    new SimplePeepholeOptimizationStage(),
-					new InstructionLogger(),
-                });
-
-			//FlowGraphVisualizationStage.Instance,
-		}
-
-		/// <summary>
-		/// Retrieves a calling convention object for the requested calling convention.
-		/// </summary>
-		/// <param name="callingConvention">One of the defined calling conventions.</param>
-		/// <returns>An instance of <see cref="ICallingConvention"/>.</returns>
-		/// <exception cref="System.NotSupportedException"><paramref name="callingConvention"/> is not a supported calling convention.</exception>
-		public override ICallingConvention GetCallingConvention(CallingConvention callingConvention)
-		{
-			switch (callingConvention) {
-				case CallingConvention.Default:
-					return new DefaultCallingConvention(this);
-
-				default:
-					throw new NotSupportedException();
-			}
-		}
-
-		/// <summary>
-		/// Gets the type memory requirements.
-		/// </summary>
-		/// <param name="signatureType">The signature type.</param>
-		/// <param name="memorySize">Receives the memory size of the type.</param>
-		/// <param name="alignment">Receives alignment requirements of the type.</param>
-		public override void GetTypeRequirements(SigType signatureType, out int memorySize, out int alignment)
-		{
-			if (signatureType == null)
-				throw new ArgumentNullException("signatureType");
-
-			switch (signatureType.Type) {
-				case CilElementType.U1: memorySize = alignment = 4; break;
-				case CilElementType.U2: memorySize = alignment = 4; break;
-				case CilElementType.U4: memorySize = alignment = 4; break;
-				case CilElementType.U8: memorySize = alignment = 8; break;
-				case CilElementType.I1: memorySize = alignment = 4; break;
-				case CilElementType.I2: memorySize = alignment = 4; break;
-				case CilElementType.I4: memorySize = alignment = 4; break;
-				case CilElementType.I8: memorySize = alignment = 8; break;
-				case CilElementType.R4: memorySize = alignment = 4; break;
-				case CilElementType.R8: memorySize = alignment = 8; break;
-				case CilElementType.Boolean: memorySize = alignment = 4; break;
-				case CilElementType.Char: memorySize = alignment = 4; break;
-				case CilElementType.Ptr: memorySize = alignment = 4; break;
-				case CilElementType.ValueType: memorySize = alignment = 4; break; // FIXME: HACK!
-				default: memorySize = alignment = 4; break;
-			}
-		}
-
-		/// <summary>
-		/// Gets the intrinsics instruction by type
-		/// </summary>
-		/// <param name="type">The type.</param>
-		/// <returns></returns>
-		public override IIntrinsicInstruction GetIntrinsicIntruction(Type type)
-		{
-			return CPUx86.Intrinsics.Get(type);
-		}
-
-		/// <summary>
-		/// Gets the code emitter.
-		/// </summary>
-		/// <returns></returns>
-		public override ICodeEmitter GetCodeEmitter()
-		{
-			return new MachineCodeEmitter();
-		}
-	}
+/*
+ * (c) 2008 MOSA - The Managed Operating System Alliance
+ *
+ * Licensed under the terms of the New BSD License.
+ *
+ * Authors:
+ *  Michael Ruck (grover) <sharpos@michaelruck.de>
+ *  Phil Garcia (tgiphil) <phil@thinkedge.com>
+*/
+
+using System;
+using System.Collections.Generic;
+
+using Mosa.Runtime.CompilerFramework;
+using Mosa.Runtime.CompilerFramework.Operands;
+using Mosa.Runtime.Metadata;
+using Mosa.Runtime.Metadata.Signatures;
+using Mosa.Platforms.x86.Constraints;
+
+namespace Mosa.Platforms.x86
+{
+
+	/// <summary>
+	/// This class provides a common base class for architecture
+	/// specific operations.
+	/// </summary>
+	public class Architecture : BasicArchitecture
+	{
+		/// <summary>
+		/// Defines the register set of the target architecture.
+		/// </summary>
+		private static readonly Register[] Registers = new Register[]
+        {
+            ////////////////////////////////////////////////////////
+            // 32-bit general purpose registers
+            ////////////////////////////////////////////////////////
+            GeneralPurposeRegister.EAX,
+            GeneralPurposeRegister.ECX,
+            GeneralPurposeRegister.EDX,
+            GeneralPurposeRegister.EBX,
+            GeneralPurposeRegister.ESI,
+            GeneralPurposeRegister.EDI,
+
+            ////////////////////////////////////////////////////////
+            // 128-bit floating point registers
+            ////////////////////////////////////////////////////////
+            SSE2Register.XMM0,
+            SSE2Register.XMM1,
+            SSE2Register.XMM2,
+            SSE2Register.XMM3,
+            SSE2Register.XMM4,
+            SSE2Register.XMM5,
+            SSE2Register.XMM6,
+            SSE2Register.XMM7
+        };
+
+		/// <summary>
+		/// Maps constraints to an instruction. Deprecated.
+		/// </summary>
+		private static readonly Dictionary<Type, Type> Constraints = new Dictionary<Type, Type>
+        {
+            { typeof(CPUx86.AddInstruction), typeof(GPRConstraint) },
+            { typeof(CPUx86.AdcInstruction), typeof(GPRConstraint) },
+            { typeof(CPUx86.DivInstruction), typeof(DivConstraint) },
+            { typeof(CPUx86.AndInstruction), typeof(LogicalAndConstraint) },
+            { typeof(CPUx86.OrInstruction), typeof(LogicalOrConstraint) },
+            { typeof(CPUx86.XorInstruction), typeof(LogicalXorConstraint) },
+            { typeof(CPUx86.MovInstruction), typeof(MoveConstraint) },
+            { typeof(CPUx86.MulInstruction), typeof(MulConstraint) },
+            { typeof(CPUx86.SarInstruction), typeof(ShiftConstraint) },
+            { typeof(CPUx86.ShlInstruction), typeof(ShiftConstraint) },
+            { typeof(CPUx86.ShrInstruction), typeof(ShiftConstraint) },
+            { typeof(CPUx86.SubInstruction), typeof(GPRConstraint) },
+        };
+
+		/// <summary>
+		/// Specifies the architecture features to use in generated code.
+		/// </summary>
+		private ArchitectureFeatureFlags _architectureFeatures;
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="Architecture"/> class.
+		/// </summary>
+		/// <param name="architectureFeatures">The features this architecture supports.</param>
+		private Architecture(ArchitectureFeatureFlags architectureFeatures)
+		{
+			_architectureFeatures = architectureFeatures;
+		}
+
+		/// <summary>
+		/// Retrieves the native integer size of the x86 platform.
+		/// </summary>
+		/// <value>This property always returns 32.</value>
+		public override int NativeIntegerSize
+		{
+			get { return 32; }
+		}
+
+		/// <summary>
+		/// Retrieves the register set of the x86 platform.
+		/// </summary>
+		public override Register[] RegisterSet
+		{
+			get { return Registers; }
+		}
+
+		/// <summary>
+		/// Retrieves the stack frame register of the x86.
+		/// </summary>
+		public override Register StackFrameRegister
+		{
+			get { return GeneralPurposeRegister.EBP; }
+		}
+
+		/// <summary>
+		/// Factory method for the Architecture class.
+		/// </summary>
+		/// <returns>The created architecture instance.</returns>
+		/// <param name="architectureFeatures">The features available in the architecture and code generation.</param>
+		/// <remarks>
+		/// This method creates an instance of an appropriate architecture class, which supports the specific
+		/// architecture features.
+		/// </remarks>
+		public static IArchitecture CreateArchitecture(ArchitectureFeatureFlags architectureFeatures)
+		{
+			if (architectureFeatures == ArchitectureFeatureFlags.AutoDetect)
+				architectureFeatures = ArchitectureFeatureFlags.MMX | ArchitectureFeatureFlags.SSE | ArchitectureFeatureFlags.SSE2;
+
+			return new Architecture(architectureFeatures);
+		}
+
+		/// <summary>
+		/// Creates a new result operand of the requested type.
+		/// </summary>
+		/// <param name="signatureType">The type requested.</param>
+		/// <param name="instructionLabel">The label of the instruction requesting the operand.</param>
+		/// <param name="operandStackIndex">The stack index of the operand.</param>
+		/// <returns>A new operand usable as a result operand.</returns>
+		public override Operand CreateResultOperand(SigType signatureType, int instructionLabel, int operandStackIndex)
+		{
+			return new RegisterOperand(signatureType, GeneralPurposeRegister.EAX);
+		}
+
+		/// <summary>
+		/// Extends the assembly compiler pipeline with x86 specific stages.
+		/// </summary>
+		/// <param name="assemblyCompilerPipeline">The assembly compiler pipeline to extend.</param>
+		public override void ExtendAssemblyCompilerPipeline(CompilerPipeline assemblyCompilerPipeline)
+		{
+		}
+
+		/// <summary>
+		/// Extends the method compiler pipeline with x86 specific stages.
+		/// </summary>
+		/// <param name="methodCompilerPipeline">The method compiler pipeline to extend.</param>
+		public override void ExtendMethodCompilerPipeline(CompilerPipeline methodCompilerPipeline)
+		{
+			// FIXME: Create a specific code generator instance using requested feature flags.
+			// FIXME: Add some more optimization passes, which take advantage of advanced x86 instructions
+			// and packed operations available with MMX/SSE extensions
+			methodCompilerPipeline.InsertAfter<PlatformStubStage>(
+				new IMethodCompilerStage[]
+                {
+					new InstructionLogger(),
+                    new LongOperandTransformationStage(),
+					new InstructionLogger(),
+                    new AddressModeConversionStage(),
+					new InstructionLogger(),
+                    new CILTransformationStage(),
+					new InstructionLogger(),
+                    new IRTransformationStage(),
+					new InstructionLogger(),
+					new TweakTransformationStage(),
+					new InstructionLogger(),
+					new MemToMemConversionStage(),
+					new InstructionLogger(),
+                });
+
+			methodCompilerPipeline.InsertAfter<IBlockOrderStage>(
+				new IMethodCompilerStage[]
+                {
+                    new SimplePeepholeOptimizationStage(),
+					new InstructionLogger(),
+                });
+
+			//FlowGraphVisualizationStage.Instance,
+		}
+
+		/// <summary>
+		/// Retrieves a calling convention object for the requested calling convention.
+		/// </summary>
+		/// <param name="callingConvention">One of the defined calling conventions.</param>
+		/// <returns>An instance of <see cref="ICallingConvention"/>.</returns>
+		/// <exception cref="System.NotSupportedException"><paramref name="callingConvention"/> is not a supported calling convention.</exception>
+		public override ICallingConvention GetCallingConvention(CallingConvention callingConvention)
+		{
+			switch (callingConvention) {
+				case CallingConvention.Default:
+					return new DefaultCallingConvention(this);
+
+				default:
+					throw new NotSupportedException();
+			}
+		}
+
+		/// <summary>
+		/// Gets the type memory requirements.
+		/// </summary>
+		/// <param name="signatureType">The signature type.</param>
+		/// <param name="memorySize">Receives the memory size of the type.</param>
+		/// <param name="alignment">Receives alignment requirements of the type.</param>
+		public override void GetTypeRequirements(SigType signatureType, out int memorySize, out int alignment)
+		{
+			if (signatureType == null)
+				throw new ArgumentNullException("signatureType");
+
+			switch (signatureType.Type) {
+				case CilElementType.U1: memorySize = alignment = 4; break;
+				case CilElementType.U2: memorySize = alignment = 4; break;
+				case CilElementType.U4: memorySize = alignment = 4; break;
+                case CilElementType.U8: memorySize = 8; alignment = 4; break;
+				case CilElementType.I1: memorySize = alignment = 4; break;
+				case CilElementType.I2: memorySize = alignment = 4; break;
+				case CilElementType.I4: memorySize = alignment = 4; break;
+                case CilElementType.I8: memorySize = 8; alignment = 4; break;
+				case CilElementType.R4: memorySize = alignment = 4; break;
+				case CilElementType.R8: memorySize = alignment = 8; break;
+				case CilElementType.Boolean: memorySize = alignment = 4; break;
+				case CilElementType.Char: memorySize = alignment = 4; break;
+				case CilElementType.Ptr: memorySize = alignment = 4; break;
+				case CilElementType.ValueType: memorySize = alignment = 4; break; // FIXME: HACK!
+				default: memorySize = alignment = 4; break;
+			}
+		}
+
+		/// <summary>
+		/// Gets the intrinsics instruction by type
+		/// </summary>
+		/// <param name="type">The type.</param>
+		/// <returns></returns>
+		public override IIntrinsicInstruction GetIntrinsicIntruction(Type type)
+		{
+			return CPUx86.Intrinsics.Get(type);
+		}
+
+		/// <summary>
+		/// Gets the code emitter.
+		/// </summary>
+		/// <returns></returns>
+		public override ICodeEmitter GetCodeEmitter()
+		{
+			return new MachineCodeEmitter();
+		}
+	}
 }


Add Bid Controller Test

Add Bid Controller Test

--- Tests/Cats.Tests/ControllersTests/BidControllerTest.cs
+++ Tests/Cats.Tests/ControllersTests/BidControllerTest.cs
@@ -18,19 +18,48 @@
         private IBidDetailService MockBidDetail;
         private IAdminUnitService MockAdminUnitService;
         private BidController _bidController;
+        private List<Bid> _bids;

         public BidControllerTest()
           {

-            //List<Bid> bidTest = new List<Bid>();
-            //{
-            //    new Bid()
-            //}
-            //;
-            // List<AdminUnit> adminUnitTest=new List<AdminUnit>();
-            //{
-            //    new AdminUnit() {AdminUnitID = 1, Name = "Afar", NameAM = null, AdminUnitTypeID = 2, ParentID = 1};
-            //}
+            List<Bid> bidTest = new List<Bid>();
+              {
+                  new Bid() { BidID=1,BidNumber ="PP452",StartDate=new DateTime(2012/10/10),EndDate=new DateTime(2013/12/11)};
+                  new Bid() { BidID = 2,BidNumber ="AAA123",StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11) };
+                  new Bid() { BidID = 3,BidNumber="QW123",StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11) };
+              }
+            ;
+             List<AdminUnit> adminUnitTest=new List<AdminUnit>();
+            {
+                new AdminUnit() {AdminUnitID = 1, Name = "Afar", NameAM = null, AdminUnitTypeID = 2, ParentID = 1};
+            }
+            ;
+
+            List<BidDetail> bidDetailTest=new List<BidDetail>();
+              {
+                  new BidDetail()
+                      {
+                          BidDetailID = 1,
+                          BidID = 1,
+                          RegionID = 2,
+                          AmountForPSNPProgram = 200,
+                          AmountForReliefProgram = 300,
+                          BidDocumentPrice = 10,
+                          CBO = 1000
+                      };
+                  new BidDetail()
+                  {
+                      BidDetailID = 2,
+                      BidID = 1,
+                      RegionID = 2,
+                      AmountForPSNPProgram = 200,
+                      AmountForReliefProgram = 300,
+                      BidDocumentPrice = 10,
+                      CBO = 1000
+                  };
+              }
+

              //Mock the Regional Request Service Using Moq
             Mock<IBidService> mockBidService = new Mock<IBidService>();
@@ -38,13 +67,13 @@
             Mock<IAdminUnitService> mockAdminUnitService=new Mock<IAdminUnitService>();

-            //mockBidService.Setup(m => m.GetAllBid()).Returns(bidTest);
+            mockBidService.Setup(m => m.GetAllBid()).Returns(bidTest);
            // mockAdminUnitService.Setup(m => m.FindBy(au => au.AdminUnitTypeID==2)).Returns(adminUnitTest);

             this.MockAdminUnitService = mockAdminUnitService.Object;
             this.MockBidService = mockBidService.Object;
-            //this.MockBidDetail = MockBidDetail.Object;
+

           }
@@ -53,25 +82,61 @@
         {
             _bidController=new BidController(MockBidService,MockBidDetail,MockAdminUnitService);
         }
+
+        [Test]
+        public void Bid_Controller_Constructor_Test()
+        {
+            try
+            {
+                _bidController=new BidController(MockBidService, MockBidDetail, MockAdminUnitService);
+            }
+            catch (Exception e)
+            {
+
+                Assert.Fail(e.Message);
+            }
+        }

+        [Test]
+        public void Can_fetch_all_Bid_Lists()
+        {
+             List<Bid> expected = new List<Bid>();
+              {
+                  new Bid() { BidID=1,BidNumber ="PP452",StartDate=new DateTime(2012/10/10),EndDate=new DateTime(2013/12/11)};
+                  new Bid() { BidID = 2,BidNumber ="AAA123",StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11) };
+              }
+            ;
+            List<Bid> actual = MockBidService.GetAllBid();
+            Assert.AreEqual(actual.Count,expected.Count);
+        }
+
         [Test]
         public void Bid_Index_Test()
         {
             ActionResult actual = _bidController.Index();
             ViewResult result = actual as ViewResult;
-            //String viewName = "Index";
             Assert.IsNotNull(result);
-            Assert.AreEqual("", result.ViewName);
         }
+
+
         [Test]
-        public void Create_Bid_Test()
+        public void Edit_Bid_Test()
         {
-            List<Bid> bidTests=new List<Bid>();
+            List<Bid> expected = new List<Bid>();
             {
-                new Bid {BidID=1,BidNumber="ADC",StartDate="",EndDate=""};
+                new Bid() { BidID = 1, BidNumber = "PP452", StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11) };
+                new Bid() { BidID = 2, BidNumber = "AAA123", StartDate = new DateTime(2012 / 10 / 10), EndDate = new DateTime(2013 / 12 / 11) };
             }
-            var result = _bidController.Create(bidTests);
-            Assert.IsTrue(result);
+            ;
+            List<Bid> actual = (List<Bid>) MockBidService.Get(m => m.BidID == 1);
+            Assert.AreEqual(actual,expected);
+
+            foreach (var bidExpected in expected)
+            {
+                Assert.IsTrue(actual.Contains(actual.Find(r => r.BidID == bidExpected.BidID)));
+            }
+            Assert.AreEqual(expected, actual);
+
         }
     }
 }


Add support for switching Network Device pools

--- MultiMiner.TUI/MinerApplication.cs
+++ MultiMiner.TUI/MinerApplication.cs
@@ -315,7 +315,7 @@
             commandProcessor.RegisterCommand(
                 CommandNames.Network,
                 CommandAliases.Network,
-                "<start|stop|restart|reboot|hide|pin|rename> <ip[:port]|id> [name]",
+                "start|stop|restart|reboot|switch|hide|pin|name ip[:port]|id [pool#|name]",
                 HandeNetworkCommand);

             commandProcessor.RegisterCommand(
@@ -1218,6 +1218,20 @@
                             AddNotification(String.Format("{0} renamed to {1}", networkDevice.Path, lastWords));
                             return true; //early exit - success
                         }
+                        else if (verb.Equals(ArgumentNames.Switch, StringComparison.OrdinalIgnoreCase))
+                        {
+                            var index = -1;
+                            if (int.TryParse(lastWords, out index))
+                            {
+                                index--;
+                                if (app.SetNetworkDevicePoolIndex(networkDevice, index))
+                                    AddNotification(String.Format("Switching {0} to pool #{1}", networkDevice.Path, lastWords));
+                                else
+                                    AddNotification(String.Format("Pool #{0} is invalid for {1}", lastWords, networkDevice.Path));
+
+                                return true; //early exit - success
+                            }
+                        }
                     }
                 }
             }


Delete SpellBase.cs

Delete SpellBase.cs

--- Thresh_Beta_Fixed/Thresh_Beta_Fixed/Model/SpellBase.cs
+++ Thresh_Beta_Fixed/Thresh_Beta_Fixed/Model/SpellBase.cs
@@ -1,67 +0,0 @@
-using EloBuddy;
-using EloBuddy.SDK;
-using EloBuddy.SDK.Menu.Values;
-using SharpDX;
-using System.Collections.Generic;
-
-namespace Thresh_Beta_Fixed.Model
-{
-        public enum SpellType
-        {
-            Self,
-            Targeted,
-            Linear,
-            Circular,
-            Cone,
-            Unknown
-        }
-        public class CustomSettings
-        {
-            public int AllowedCollisionCount = int.MaxValue;
-            public int CastDelay;
-            public int HitChancePercent;
-            public int Range;
-            public GameObject Source;
-            public int Speed;
-            public SpellType Type = SpellType.Unknown;
-            public int Width;
-        }
-    public class SpellBase
-    {
-        private readonly Dictionary<Obj_AI_Base, float> _cachedDamage = new Dictionary<Obj_AI_Base, float>();
-        private readonly Dictionary<int, Dictionary<int, Dictionary<int, bool>>> _cachedIsOnSegment =
-            new Dictionary<int, Dictionary<int, Dictionary<int, bool>>>();
-        private readonly Dictionary<int, Dictionary<int, bool>> _cachedObjectsInRange =
-            new Dictionary<int, Dictionary<int, bool>>();
-        private readonly List<Obj_AI_Base> _enemyHeroes = new List<Obj_AI_Base>();
-        private readonly List<Obj_AI_Base> _enemyMinions = new List<Obj_AI_Base>();
-        private readonly List<Obj_AI_Base> _killableMinions = new List<Obj_AI_Base>();
-        private readonly List<Obj_AI_Base> _laneClearMinions = new List<Obj_AI_Base>();
-        private readonly List<Obj_AI_Base> _monsters = new List<Obj_AI_Base>();
-        public readonly Dictionary<int, Dictionary<int, PredictionResult>> CachedPredictions =
-            new Dictionary<int, Dictionary<int, PredictionResult>>();
-        public bool EnemyHeroesCanBeCalculated;
-        public bool EnemyMinionsCanBeCalculated;
-        public bool LaneClearMinionsCanBeCalculated;
-        public bool MonstersCanBeCalculated;
-        private string _name;
-        private int _speed;
-        private int _width;
-        public int AllowedCollisionCount = int.MaxValue;
-        public bool Aoe;
-        public int CastDelay;
-        public bool CollidesWithYasuoWall = true;
-        public int LastCastTime;
-        public Vector3 LastEndPosition;
-        public int LastSentTime;
-        public Vector3 LastStartPosition;
-        public float MinHitChancePercent = 60f;
-        public int Range;
-        public GameObject RangeCheckSourceObject = MyChampion.MyThresh;
-        public Slider Slider;
-        public SpellSlot Slot;
-        public GameObject SourceObject = MyChampion.MyThresh;
-        public SpellType Type;
-
-    }
-}


(fix) #23 Channel names are not being lost anymore when a ChannelState is received for whatever other property update. Also fixed the same issue in PermissionQuery and ServerSync.

--- MumbleSharp/BasicMumbleProtocol.cs
+++ MumbleSharp/BasicMumbleProtocol.cs
@@ -182,15 +182,33 @@
         /// <param name="channelState"></param>
         public virtual void ChannelState(ChannelState channelState)
         {
-            var channel = ChannelDictionary.AddOrUpdate(channelState.ChannelId, i => new Channel(this, channelState.ChannelId, channelState.Name, channelState.Parent)
-            {
-                Temporary = channelState.Temporary,
-                Description = channelState.Description,
-                Position = channelState.Position
-            },
+            if(!channelState.ShouldSerializeChannelId())
+                throw new InvalidOperationException($"{nameof(ChannelState)} must provide a {channelState.ChannelId}.");
+
+            var channel = ChannelDictionary.AddOrUpdate(channelState.ChannelId, i =>
+                {
+                    //Add new channel to the dictionary
+                    return new Channel(this, channelState.ChannelId, channelState.Name, channelState.Parent)
+                    {
+                        Temporary = channelState.Temporary,
+                        Description = channelState.Description,
+                        Position = channelState.Position
+                    };
+                },
                 (i, c) =>
                 {
-                    c.Name = channelState.Name;
+                    //Update existing channel in the dictionary
+                    if (channelState.ShouldSerializeName())
+                        c.Name = channelState.Name;
+                    if (channelState.ShouldSerializeParent())
+                        c.Parent = channelState.Parent;
+                    if (channelState.ShouldSerializeTemporary())
+                        c.Temporary = channelState.Temporary;
+                    if (channelState.ShouldSerializeDescription())
+                        c.Description = channelState.Description;
+                    if (channelState.ShouldSerializePosition())
+                        c.Position = channelState.Position;
+
                     return c;
                 }
             );
@@ -257,30 +275,36 @@
             if (userState.ShouldSerializeSession())
             {
                 bool added = false;
-                User user = UserDictionary.AddOrUpdate(userState.Session, i => {
+                User user = UserDictionary.AddOrUpdate(userState.Session, i =>
+                {
+                    //Add new user to the dictionary
                     added = true;
                     return new User(this, userState.Session, _audioSampleRate, _audioSampleBits, _audioSampleChannels);
-                }, (i, u) => u);
-
-                if (userState.ShouldSerializeSelfDeaf())
-                    user.SelfDeaf = userState.SelfDeaf;
-                if (userState.ShouldSerializeSelfMute())
-                    user.SelfMuted = userState.SelfMute;
-                if (userState.ShouldSerializeMute())
-                    user.Muted = userState.Mute;
-                if (userState.ShouldSerializeDeaf())
-                    user.Deaf = userState.Deaf;
-                if (userState.ShouldSerializeSuppress())
-                    user.Suppress = userState.Suppress;
-                if (userState.ShouldSerializeName())
-                    user.Name = userState.Name;
-                if (userState.ShouldSerializeComment())
-                    user.Comment = userState.Comment;
-
-                if (userState.ShouldSerializeChannelId())
-                    user.Channel = ChannelDictionary[userState.ChannelId];
-                else if(user.Channel == null)
-                    user.Channel = RootChannel;
+                }, (i, u) =>
+                {
+                    //Update existing user in the dictionary
+                    if (userState.ShouldSerializeSelfDeaf())
+                        u.SelfDeaf = userState.SelfDeaf;
+                    if (userState.ShouldSerializeSelfMute())
+                        u.SelfMuted = userState.SelfMute;
+                    if (userState.ShouldSerializeMute())
+                        u.Muted = userState.Mute;
+                    if (userState.ShouldSerializeDeaf())
+                        u.Deaf = userState.Deaf;
+                    if (userState.ShouldSerializeSuppress())
+                        u.Suppress = userState.Suppress;
+                    if (userState.ShouldSerializeName())
+                        u.Name = userState.Name;
+                    if (userState.ShouldSerializeComment())
+                        u.Comment = userState.Comment;
+
+                    if (userState.ShouldSerializeChannelId())
+                        u.Channel = ChannelDictionary[userState.ChannelId];
+                    else if (u.Channel == null)
+                        u.Channel = RootChannel;
+
+                    return u;
+                });

                 //if (added)
                     UserJoined(user);
@@ -347,18 +371,23 @@
         {
             if (permissionQuery.Flush)
             {
-                foreach(var channel in ChannelDictionary.Values)
+                foreach (var channel in ChannelDictionary.Values)
                 {
                     channel.Permissions = 0; // Permissions.DEFAULT_PERMISSIONS;
                 }
             }
-            else
+            else if (permissionQuery.ShouldSerializeChannelId())
             {
                 Channel channel;
                 if (!ChannelDictionary.TryGetValue(permissionQuery.ChannelId, out channel))
-                    throw new Exception($"Recieved a {nameof(PermissionQuery)} for an unknown channel ({permissionQuery.ChannelId})");
-
-                channel.Permissions = (Permission)permissionQuery.Permissions;
+                    throw new InvalidOperationException($"{nameof(PermissionQuery)} provided an unknown {permissionQuery.ChannelId}.");
+
+                if (permissionQuery.ShouldSerializePermissions())
+                    channel.Permissions = (Permission)permissionQuery.Permissions;
+            }
+            else
+            {
+                throw new InvalidOperationException($"{nameof(PermissionQuery)} must provide either {nameof(permissionQuery.Flush)} or {nameof(permissionQuery.ChannelId)}.");
             }
         }

@@ -407,8 +436,13 @@
             if (LocalUser != null)
                 throw new InvalidOperationException("Second ServerSync Received");

+            if (!serverSync.ShouldSerializeSession())
+                throw new InvalidOperationException($"{nameof(ServerSync)} must provide a {nameof(serverSync.Session)}.");
+
             //Get the local user
             LocalUser = UserDictionary[serverSync.Session];
+
+            //TODO: handle the serverSync.WelcomeText, serverSync.Permissions, serverSync.MaxBandwidth

             _encodingBuffer = new AudioEncodingBuffer(_audioSampleRate, _audioSampleBits, _audioSampleChannels, _audioFrameSize);
             _encodingThread.Start();
@@ -572,7 +606,7 @@
         public virtual void TextMessage(TextMessage textMessage)
         {
             User user;
-            if (!UserDictionary.TryGetValue(textMessage.Actor, out user))   //If we don't know the user for this packet, just ignore it
+            if (!textMessage.ShouldSerializeActor() || !UserDictionary.TryGetValue(textMessage.Actor, out user))   //If we don't know the user for this packet, just ignore it
                 return;

             if (textMessage.ChannelIds == null || textMessage.ChannelIds.Length == 0)


prevent bad requests causing infinite request loop

--- Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+++ Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
@@ -229,6 +229,17 @@
             ProxyServer proxyServer, IPEndPoint upStreamEndPoint, ExternalProxy externalProxy,
             CancellationToken cancellationToken)
         {
+            if (remoteHostName == "localhost"
+                || remoteHostName == "127.0.0.1"
+                || remoteHostName == Dns.GetHostName())
+            {
+                if (server.ProxyEndPoints.Any(x => x.Port == remotePort))
+                {
+                    throw new Exception($"A client is making HTTP request to one of the listening ports of this proxy {remoteHostName}:{remotePort}");
+                }
+            }
+
+
             bool useUpstreamProxy = false;

             // check if external proxy is set for HTTP/HTTPS
@@ -472,7 +483,8 @@
                         }
                     }
                 }
-                catch (Exception e) {
+                catch (Exception e)
+                {
                     server.ExceptionFunc(new Exception("An error occurred when disposing server connections.", e));
                 }
                 finally


fix larvae growing into xeno despite being dead


currently the UtilJsonApiSerializer will throw an exception if it reaches a { get; private set; } property such as bool Initializer { get; private set; } in PermissionSet

--- Util-JsonApiSerializer/ResourceConfigurationBuilder.cs
+++ Util-JsonApiSerializer/ResourceConfigurationBuilder.cs
@@ -318,12 +318,12 @@
             var instance = Expression.Parameter(typeof(object), "i");
             var argument = Expression.Parameter(typeof(object), "a");

-            if (propertyInfo.SetMethod != null)
+            if (propertyInfo.SetMethod != null && propertyInfo.SetMethod.IsPublic)
             {
                 var setterCall = Expression.Call(
-              Expression.Convert(instance, propertyInfo.DeclaringType),
-              propertyInfo.GetSetMethod(),
-              Expression.Convert(argument, propertyInfo.PropertyType));
+                  Expression.Convert(instance, propertyInfo.DeclaringType),
+                  propertyInfo.GetSetMethod(),
+                  Expression.Convert(argument, propertyInfo.PropertyType));

                 Expression<Action<object, object>> expression = Expression.Lambda<Action<object, object>>(setterCall, instance, argument);


Audit. If it is even used...

Audit. If it is even used...

--- Purchasing.Mvc/Services/AuditInterceptor.cs
+++ Purchasing.Mvc/Services/AuditInterceptor.cs
@@ -2,6 +2,7 @@
 using System.Security.Principal;
 using NHibernate;
 using Purchasing.Core.Domain;
+using Purchasing.Core.Helpers;
 using UCDArch.Core.PersistanceSupport;

 namespace Purchasing.Mvc.Services
@@ -44,7 +45,7 @@

             var audit = new Audit
             {
-                AuditDate = DateTime.Now,
+                AuditDate = DateTime.UtcNow.ToPacificTime(),
                 ObjectName = entity.GetType().Name,
                 ObjectId = id == null ? null : id.ToString(),
                 Username = string.IsNullOrEmpty(Principal.Identity.Name) ? "NoUser" : Principal.Identity.Name


updated api call to support methods != GET and POST data

--- Purchasing.Web/Services/UservoiceService.cs
+++ Purchasing.Web/Services/UservoiceService.cs
@@ -1,7 +1,7 @@
 using System.Linq;
 using System.Net;
+using System.Text;
 using System.Web.Configuration;
-using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Purchasing.Web.Helpers;
 using System.Collections.Generic;
@@ -44,7 +44,7 @@
         {
             string endpoint = CreateEndpoint("/api/v1/forums/{0}/suggestions.json?category={1}&sort=newest&per_page=100");

-            var result = PerformQuery(endpoint);
+            var result = PerformApiCall(endpoint);

             var allIssues = JObject.Parse(result);
             var openIssues = allIssues["suggestions"].Children().Where(x => x["closed_at"].Value<string>() == null).ToList();
@@ -60,11 +60,20 @@
             return issues.Where(x => x["status"].Value<string>() == status).ToList();
         }

+        public void SetIssueStatus(int id, string status)
+        {
+            string endpoint = string.Format("/api/v1/forums/{0}/suggestions/{1}/respond.json", ForumId, id);
+
+            var data = string.Format("notify=false&response[status]={0}", status);
+
+            PerformApiCall(endpoint, "PUT", data);
+        }
+
         public int GetActiveIssuesCount()
         {
             string endpoint = CreateEndpoint("/api/v1/forums/{0}/categories.json");

-            var result = JObject.Parse(PerformQuery(endpoint));
+            var result = JObject.Parse(PerformApiCall(endpoint));

             var issueCategory =
                 result["categories"].Children().Single(c => c["name"].Value<string>() == "Issues");
@@ -77,9 +86,10 @@
         /// </summary>
         /// <param name="endpoint">/api/... </param>
         /// <param name="method">GET/POST/PUT/DELETE</param>
+        /// <param name="data">Request data, ex: field1=abc&field2=def12</param>
         /// <remarks>http://developer.uservoice.com/docs/api-public/</remarks>
         /// <returns>Result string from API call</returns>
-        private string PerformQuery(string endpoint, string method = "GET")
+        private string PerformApiCall(string endpoint, string method = "GET", string data = null)
         {
             var query = ApiUrlBase + endpoint;

@@ -89,8 +99,18 @@

             var header = oauth.GenerateAuthzHeader(query, method);

-            var req = WebRequest.Create(query);
+            var req = (HttpWebRequest)WebRequest.Create(query);
             req.Headers.Add("Authorization", header);
+
+            if (data != null)
+            {
+                byte[] byteArray = Encoding.UTF8.GetBytes(data);
+                req.ContentType = "application/x-www-form-urlencoded";
+                req.ContentLength = byteArray.Length;
+                var dataStream = req.GetRequestStream();
+                dataStream.Write(byteArray, 0, byteArray.Length);
+                dataStream.Close();
+            }

             using (var response = (HttpWebResponse) req.GetResponse())
             {


Revert "ui fixes"

Revert "ui fixes"

This reverts commit c0eea5ac39bf1ae3d72fa096d41e8ededfe262b0.

--- RTFrontend/RenderSettingsWindow.Designer.cs
+++ RTFrontend/RenderSettingsWindow.Designer.cs
@@ -45,9 +45,9 @@
             this.label7 = new System.Windows.Forms.Label();
             this.maxRecursionDepth = new System.Windows.Forms.NumericUpDown();
             this.haltOnException = new System.Windows.Forms.CheckBox();
+            this.saveButton = new System.Windows.Forms.Button();
             this.label8 = new System.Windows.Forms.Label();
             this.sampleCount = new System.Windows.Forms.NumericUpDown();
-            this.saveButton = new System.Windows.Forms.Button();
             this.liveRendering = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.resHeight)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.resWidth)).BeginInit();
@@ -124,12 +124,12 @@
             //
             this.renderButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
             this.renderButton.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.renderButton.Location = new System.Drawing.Point(2, 250);
+            this.renderButton.Location = new System.Drawing.Point(123, 250);
             this.renderButton.Margin = new System.Windows.Forms.Padding(2);
             this.renderButton.Name = "renderButton";
-            this.renderButton.Size = new System.Drawing.Size(117, 53);
+            this.renderButton.Size = new System.Drawing.Size(118, 53);
             this.renderButton.TabIndex = 10;
-            this.renderButton.Text = "Render";
+            this.renderButton.Text = "Render / Cancel";
             this.renderButton.UseVisualStyleBackColor = true;
             this.renderButton.Click += new System.EventHandler(this.renderButton_Click);
             //
@@ -186,8 +186,8 @@
             this.tableLayoutPanel1.Controls.Add(this.haltOnException, 1, 8);
             this.tableLayoutPanel1.Controls.Add(this.label8, 0, 9);
             this.tableLayoutPanel1.Controls.Add(this.sampleCount, 1, 9);
-            this.tableLayoutPanel1.Controls.Add(this.saveButton, 1, 11);
-            this.tableLayoutPanel1.Controls.Add(this.renderButton, 0, 11);
+            this.tableLayoutPanel1.Controls.Add(this.renderButton, 1, 11);
+            this.tableLayoutPanel1.Controls.Add(this.saveButton, 0, 11);
             this.tableLayoutPanel1.Controls.Add(this.liveRendering, 1, 10);
             this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
@@ -336,6 +336,18 @@
             this.haltOnException.Text = "Halt on exception";
             this.haltOnException.UseVisualStyleBackColor = true;
             //
+            // saveButton
+            //
+            this.saveButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+            this.saveButton.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.saveButton.Location = new System.Drawing.Point(3, 251);
+            this.saveButton.Name = "saveButton";
+            this.saveButton.Size = new System.Drawing.Size(115, 51);
+            this.saveButton.TabIndex = 11;
+            this.saveButton.Text = "Save";
+            this.saveButton.UseVisualStyleBackColor = true;
+            this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
+            //
             // label8
             //
             this.label8.AutoSize = true;
@@ -367,18 +379,6 @@
             0,
             0,
             0});
-            //
-            // saveButton
-            //
-            this.saveButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
-            this.saveButton.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.saveButton.Location = new System.Drawing.Point(124, 251);
-            this.saveButton.Name = "saveButton";
-            this.saveButton.Size = new System.Drawing.Size(116, 51);
-            this.saveButton.TabIndex = 11;
-            this.saveButton.Text = "Save";
-            this.saveButton.UseVisualStyleBackColor = true;
-            this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
             //
             // liveRendering
             //


Made method public.

Made method public.

--- ReClass.NET/MemoryScanner/PatternScanner.cs
+++ ReClass.NET/MemoryScanner/PatternScanner.cs
@@ -71,7 +71,7 @@
 		/// <param name="pattern">The pattern to search.</param>
 		/// <param name="data">The data to scan.</param>
 		/// <returns>The index in data where the pattern was found or -1 otherwise.</returns>
-		private static int FindPattern(BytePattern pattern, byte[] data)
+		public static int FindPattern(BytePattern pattern, byte[] data)
 		{
 			Contract.Requires(pattern != null);
 			Contract.Requires(data != null);


Update SIL.Core.Desktop with Acknowledgements

--- SIL.Core.Desktop/Properties/AssemblyInfo.cs
+++ SIL.Core.Desktop/Properties/AssemblyInfo.cs
@@ -2,6 +2,7 @@
 using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+using SIL.Acknowledgements;

 // General Information about an assembly is controlled through the following
 // set of attributes. Change these attribute values to modify the information
@@ -21,3 +22,6 @@
 [assembly: CLSCompliant(true)]

 [assembly: InternalsVisibleTo("SIL.Core.Desktop.Tests")]
+
+[assembly: Acknowledgement("NDesk.DBus", Name = "NDesk.DBus", Url = "https://www.nuget.org/packages/NDesk.DBus/",
+	LicenseUrl = "https://opensource.org/licenses/MIT", Copyright = "Copyright © 2006 Alp Toker", Location = "./NDesk.DBus.dll")]


Fixed player to run properly both in editor and as standalone.  The way the player sandbox stuff works still really needs some refactoring.

--- Scripts/DependencyInjection/Util/ZenUtil.cs
+++ Scripts/DependencyInjection/Util/ZenUtil.cs
@@ -110,6 +110,12 @@
             Application.LoadLevel(levelName);
         }

+        public static void LoadLevelAdditive(string levelName, Action<DiContainer> extraBindings)
+        {
+            CompositionRoot.ExtraBindingsLookup = extraBindings;
+            Application.LoadLevelAdditive(levelName);
+        }
+
         public class InjectInfo
         {
             public bool Optional;


separate common initialization into sub methods

--- Serenity.Web/Common/CommonInitialization.cs
+++ Serenity.Web/Common/CommonInitialization.cs
@@ -17,30 +17,56 @@
     {
         public static void Run()
         {
+            InitializeServiceLocator();
+            InitializeSelfAssemblies();
+            InitializeCaching();
+            InitializeConfigurationSystem();
+            InitializeLocalTexts();
+            InitializeDynamicScripts();
+        }
+
+        public static void InitializeServiceLocator()
+        {
             if (!Dependency.HasResolver)
             {
                 var container = new MunqContainer();
                 Dependency.SetResolver(container);
             }
+        }

+        public static void InitializeSelfAssemblies()
+        {
             var selfAssemblies = BuildManager.GetReferencedAssemblies()
                 .Cast<Assembly>()
-                .Where(x =>
+                .Where(x =>
                     x.FullName.Contains("Serenity") ||
                     x.GetReferencedAssemblies().Any(a => a.Name.Contains("Serenity")));

             ExtensibilityHelper.SelfAssemblies = AssemblySorter.Sort(selfAssemblies).ToArray();
+        }

+        public static void InitializeCaching()
+        {
             var registrar = Dependency.Resolve<IDependencyRegistrar>();
-
-            if (Dependency.TryResolve<IConfigurationRepository>() == null)
-                registrar.RegisterInstance<IConfigurationRepository>("Application", new ApplicationConfigurationRepository());

             if (Dependency.TryResolve<ILocalCache>() == null)
                 registrar.RegisterInstance<ILocalCache>(new HttpRuntimeCache());

             if (Dependency.TryResolve<IDistributedCache>() == null)
                 registrar.RegisterInstance<IDistributedCache>(new DistributedCacheEmulator());
+        }
+
+        public static void InitializeConfigurationSystem()
+        {
+            var registrar = Dependency.Resolve<IDependencyRegistrar>();
+
+            if (Dependency.TryResolve<IConfigurationRepository>() == null)
+                registrar.RegisterInstance<IConfigurationRepository>("Application", new ApplicationConfigurationRepository());
+        }
+
+        public static void InitializeLocalTexts()
+        {
+            var registrar = Dependency.Resolve<IDependencyRegistrar>();

             if (Dependency.TryResolve<ILocalTextRegistry>() == null)
                 registrar.RegisterInstance<ILocalTextRegistry>(new LocalTextRegistry());
@@ -50,7 +76,10 @@
             EntityLocalTexts.Initialize();
             NestedLocalTextRegistration.AddFromScripts(HostingEnvironment.MapPath("~/Scripts/serenity/texts/"));
             NestedLocalTextRegistration.AddFromScripts(HostingEnvironment.MapPath("~/Scripts/site/texts/"));
+        }

+        public static void InitializeDynamicScripts()
+        {
             LookupScriptRegistration.RegisterLookupScripts();
             RunStartupRegistrars<ScriptRegistrarAttribute>();
             FormScriptRegistration.RegisterFormScripts();


SB-402

--- Server/SchoolBusAPI/Services/UserService.cs
+++ Server/SchoolBusAPI/Services/UserService.cs
@@ -403,15 +403,18 @@
         {
             var data = _context.UserRoles
                 .AsNoTracking()
-                .Where(ur => ur.Role.Name == Roles.Inspector)
-                .Select(ur => ur.User);
+                .Where(ur => ur.Role.Name == Roles.Inspector);

             if (includeInactive == null || includeInactive == false)
             {
-                data = data.Where(u => u.Active == true);
-            }
-
-            var result = Mapper.Map<List<InspectorViewModel>>(data);
+                data = data.Where(ur => !ur.ExpiryDate.HasValue || ur.ExpiryDate == DateTime.MinValue || ur.ExpiryDate > DateTime.Now);
+            }
+
+            var inspectors = data
+                .Select(ur => ur.User)
+                .Where(u => u.Active == true);
+
+            var result = Mapper.Map<List<InspectorViewModel>>(inspectors);

             return new ObjectResult(result);
         }


Mark InternalsVisibleTo the tests project, to allow whitebox testing.

--- ServerHost.xunit/Properties/AssemblyInfo.cs
+++ ServerHost.xunit/Properties/AssemblyInfo.cs
@@ -35,3 +35,5 @@
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]
+
+[assembly:InternalsVisibleTo("ServerHost.Tests")]


Remove invalid cast

Remove invalid cast

--- SlicerConfiguration/UIFields/DoubleField.cs
+++ SlicerConfiguration/UIFields/DoubleField.cs
@@ -40,7 +40,7 @@
 		protected override string ConvertValue(string newValue)
 		{
 			double.TryParse(newValue, out double currentValue);
-			doubleValue  = (int)currentValue;
+			doubleValue  = currentValue;

 			return doubleValue.ToString();
 		}


verify TimeSync (#2772)

verify TimeSync (#2772)

--- Source/ACE.Server/Network/NetworkSession.cs
+++ Source/ACE.Server/Network/NetworkSession.cs
@@ -8,9 +8,12 @@
 using System.Text;

 using ACE.Common.Cryptography;
+using ACE.Entity.Enum;
 using ACE.Server.Entity;
+using ACE.Server.Entity.Actions;
 using ACE.Server.Network.Enum;
 using ACE.Server.Network.GameMessages;
+using ACE.Server.Network.GameMessages.Messages;
 using ACE.Server.Network.Handlers;
 using ACE.Server.Network.Managers;

@@ -387,7 +390,10 @@

             // If we have an EchoRequest flag, we should flag to respond with an echo response on next send.
             if (packet.Header.HasFlag(PacketHeaderFlags.EchoRequest))
+            {
                 FlagEcho(packet.HeaderOptional.EchoRequestClientTime);
+                VerifyEcho(packet.HeaderOptional.EchoRequestClientTime);
+            }

             // If we have an AcknowledgeSequence flag, we can clear our cached packet buffer up to that sequence.
             if (packet.Header.HasFlag(PacketHeaderFlags.AckSequence))
@@ -518,6 +524,75 @@
             {
                 packetLog.DebugFormat("[{0}] Ready to handle out of order fragment {1}", session.LoggingIdentifier, lastReceivedFragmentSequence + 1);
                 HandleFragment(message);
+            }
+        }
+
+        //private List<EchoStamp> EchoStamps = new List<EchoStamp>();
+
+        private static int EchoLogInterval = 5;
+        private static int EchoInterval = 10;
+        private static float EchoThreshold = 2.0f;
+        private static float DiffThreshold = 0.01f;
+
+        private float lastClientTime;
+        private DateTime lastServerTime;
+
+        private double lastDiff;
+        private int echoDiff;
+
+        private void VerifyEcho(float clientTime)
+        {
+            if (session.Player == null || session.logOffRequestTime != DateTime.MinValue)
+                return;
+
+            var serverTime = DateTime.UtcNow;
+
+            if (lastClientTime == 0)
+            {
+                lastClientTime = clientTime;
+                lastServerTime = serverTime;
+                return;
+            }
+
+            var serverTimeDiff = serverTime - lastServerTime;
+            var clientTimeDiff = clientTime - lastClientTime;
+
+            var diff = Math.Abs(serverTimeDiff.TotalSeconds - clientTimeDiff);
+
+            if (diff > EchoThreshold && diff - lastDiff > DiffThreshold)
+            {
+                lastDiff = diff;
+                echoDiff++;
+
+                if (echoDiff >= EchoLogInterval)
+                    log.Warn($"{session.Player.Name} - TimeSync error: {echoDiff} (diff: {diff})");
+
+                if (echoDiff >= EchoInterval)
+                {
+                    log.Error($"{session.Player.Name} - disconnected for speedhacking");
+
+                    var actionChain = new ActionChain();
+                    actionChain.AddAction(session.Player, () =>
+                    {
+                        //session.Network.EnqueueSend(new GameMessageBootAccount(session));
+                        session.Network.EnqueueSend(new GameMessageSystemChat($"TimeSync: client speed error", ChatMessageType.Broadcast));
+                        session.LogOffPlayer();
+
+                        echoDiff = 0;
+                        lastDiff = 0;
+                        lastClientTime = 0;
+
+                    });
+                    actionChain.EnqueueChain();
+                }
+            }
+            else if (echoDiff > 0)
+            {
+                if (echoDiff > EchoLogInterval)
+                    log.Warn($"{session.Player.Name} - Diff: {diff}");
+
+                lastDiff = 0;
+                echoDiff = 0;
             }
         }


Minor code style cleanup

Minor code style cleanup

--- Source/Converters/fsIEnumerableConverter.cs
+++ Source/Converters/fsIEnumerableConverter.cs
@@ -151,7 +151,7 @@
     }

     public class fsIEnumerableConverter : fsConverter {
-        private fsIEnumerableSerializationAdapter[] _adaptors = new fsIEnumerableSerializationAdapter[] {
+        private readonly fsIEnumerableSerializationAdapter[] _adaptors = {
             new fsIDictionaryAdapter(),
             new fsReflectedAdapter()
         };


Engine: Removed validmoves parameter

Engine: Removed validmoves parameter

--- Mzinga.Shared/Engine/GameEngine.cs
+++ Mzinga.Shared/Engine/GameEngine.cs
@@ -163,14 +163,7 @@
                         Pass();
                         break;
                     case "validmoves":
-                        if (paramCount == 0)
-                        {
-                            ValidMoves();
-                        }
-                        else
-                        {
-                            ValidMoves(split[1]);
-                        }
+                        ValidMoves();
                         break;
                     case "bestmove":
                         if (paramCount == 0)
@@ -351,27 +344,6 @@
             ConsoleOut(validMoves.ToString());
         }

-        private void ValidMoves(string pieceName)
-        {
-            if (null == _gameBoard)
-            {
-                throw new NoBoardException();
-            }
-
-            if (string.IsNullOrWhiteSpace(pieceName))
-            {
-                throw new ArgumentNullException(pieceName);
-            }
-
-            if (_gameBoard.GameIsOver)
-            {
-                throw new GameIsOverException();
-            }
-
-            MoveSet validMoves = _gameBoard.GetValidMoves(EnumUtils.ParseShortName(pieceName));
-            ConsoleOut(validMoves.ToString());
-        }
-
         private void BestMove()
         {
             if (null == _gameBoard)


continued fix for removing dependency on system.web

--- src/Google.Maps/Location.cs
+++ src/Google.Maps/Location.cs
@@ -40,7 +40,7 @@
 		/// <returns></returns>
 		public virtual string GetAsUrlParameter()
 		{
-			return Uri.EscapeDataString(this.ToString());
+			return System.Uri.EscapeDataString(this.ToString());
 		}

 		/// <summary>


Added an error handler for mdx to throw a ConnectionException

--- NBi.Core/Query/QueryAdomdEngine.cs
+++ NBi.Core/Query/QueryAdomdEngine.cs
@@ -106,6 +106,10 @@
                 {
                     throw new ConnectionException(ex, connectionString);
                 }
+                catch (AdomdErrorResponseException ex)
+                {
+                    throw new ConnectionException(ex, connectionString);
+                }

                 // capture time after execution
                 DateTime timeAfter = DateTime.Now;


added serializable to the Location class

--- src/Google.Maps/Location.cs
+++ src/Google.Maps/Location.cs
@@ -8,6 +8,7 @@
     /// <summary>
     /// A general free-text location, usually for specifying an address or particular place for Google Maps.
     /// </summary>
+	[Serializable]
     public class Location
     {
 		protected Location()


Fixes app freeze on Init

Fixes app freeze on Init

Per https://alpha.app.net/jaredsinclair/post/18555292, this resolves
cases where the app would freeze on the call to
CGFont.CreateFromProvider.

--- NControl.Controls.iOS/NControls.cs
+++ NControl.Controls.iOS/NControls.cs
@@ -25,6 +25,7 @@
 				s.Read (data, 0, data.Length);

 				var dataProvider = new CGDataProvider (data, 0, data.Length);
+				var familyNames = UIFont.FamilyNames; //fixes app freeze in some cases: https://alpha.app.net/jaredsinclair/post/18555292
 				var cgFont = CGFont.CreateFromProvider (dataProvider);
 				NSError error;


Renames a test.

Renames a test.

--- NFluent.Tests/EqualRelatedTests.cs
+++ NFluent.Tests/EqualRelatedTests.cs
@@ -179,11 +179,11 @@

         [Test]
         [ExpectedException(typeof(FluentCheckException), MatchType = MessageMatch.Regex, ExpectedMessage = "\nThe checked value is different from the expected one.\nThe checked value:\n\\t\\[John\\] with HashCode: \\[.*\\]\nThe expected value:\n\\t\\[John\\] with HashCode: \\[.*\\]")]
-        public void WeCanAlsoSeeTheDifferenceBetweenTwoDifferentInstancesOfTheSameTypeWhichHaveSameToString()
-        {
-            // e.g.: "\nExpecting:\n\t[John] of type: [NFluent.Tests.Person] with HashCode: [45523402]\n but was\n\t[John] of type: [NFluent.Tests.Person] with HashCode: [35287174]."
+        public void WeCanAlsoSeeTheDifferenceBetweenTwoDifferentInstancesOfTheSameTypeWhithIdenticalToString()
+        {
             Person dad = new Person { Name = "John" };
             Person uncle = new Person { Name = "John" };
+
             Check.That(uncle).IsEqualTo(dad);
         }


Marked 'UserStore' as obsolete, to make people use the 'Neo4jUserStore'

--- Neo4j.AspNet.Identity/UserStore.cs
+++ Neo4j.AspNet.Identity/UserStore.cs
@@ -10,6 +10,7 @@

 namespace Neo4j.AspNet.Identity
 {
+    [Obsolete("Please switch to using the Neo4j.AspNet.Identity.Neo4jUserStore class instead", true)]
     public class UserStore<TUser> : IUserLoginStore<TUser>, IUserClaimStore<TUser>, IUserRoleStore<TUser>,
         IUserPasswordStore<TUser>, IUserSecurityStampStore<TUser>, IUserStore<TUser>, IUserEmailStore<TUser>
         where TUser : IdentityUser


Add lock when set value. Reset _data after read()

--- OBDLibrary/ObdLibUWP/ObdWrapper.cs
+++ OBDLibrary/ObdLibUWP/ObdWrapper.cs
@@ -14,7 +14,8 @@
     public class ObdWrapper
     {
         const uint BufSize = 64;
-        const int Interval = 1000;
+        const int Interval = 500;
+        const string DefValue = "";
         private StreamSocket _socket = null;
         private RfcommDeviceService _service = null;
         DataReader dataReaderObject = null;
@@ -23,18 +24,20 @@
         bool _connected = true;
         Dictionary<string, string> _data = null;
         bool _running = true;
+        private Object _lock = new Object();
+

         public async void Init()
         {
             //initialize _data
             this._data = new Dictionary<string, string>();
-            this._data.Add("spd", "");  //Speed
-            this._data.Add("bp", "");   //BarometricPressure
-            this._data.Add("rpm", "");  //RPM
-            this._data.Add("ot", "");   //OutsideTemperature
-            this._data.Add("it", "");   //InsideTemperature
-            this._data.Add("efr", "");  //EngineFuelRate
-            this._data.Add("vin", "");  //VIN
+            this._data.Add("spd", DefValue);  //Speed
+            this._data.Add("bp", DefValue);   //BarometricPressure
+            this._data.Add("rpm", DefValue);  //RPM
+            this._data.Add("ot", DefValue);   //OutsideTemperature
+            this._data.Add("it", DefValue);   //InsideTemperature
+            this._data.Add("efr", DefValue);  //EngineFuelRate
+            this._data.Add("vin", DefValue);  //VIN

             DeviceInformationCollection DeviceInfoCollection = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
             var numDevices = DeviceInfoCollection.Count();
@@ -91,7 +94,7 @@
                     //while (true)
                     //{
                     //    await Task.Delay(2000);
-                    //    Read();
+                    //    var dse = Read();
                     //}
                 }
             }
@@ -109,42 +112,63 @@
             {
                 string s;
                 s = await GetVIN();
-                _data["vin"] = s;
+                lock(_lock)
+                {
+                    _data["vin"] = s;
+                }
                 while (true)
                 {
                     s = await GetSpeed();
                     if (s != "ERROR")
-                        _data["spd"] = s;
+                        lock (_lock)
+                        {
+                            _data["spd"] = s;
+                        }
                     if (!this._running)
                         break;
                     await Task.Delay(Interval);
                     s = await GetBarometricPressure();
                     if (s != "ERROR")
-                        _data["bp"] = s;
+                        lock (_lock)
+                        {
+                            _data["bp"] = s;
+                        }
                     if (!this._running)
                         break;
                     await Task.Delay(Interval);
                     s = await GetRPM();
                     if (s != "ERROR")
-                        _data["rpm"] = s;
+                        lock (_lock)
+                        {
+                            _data["rpm"] = s;
+                        }
                     if (!this._running)
                         break;
                     await Task.Delay(Interval);
                     s = await GetOutsideTemperature();
                     if (s != "ERROR")
-                        _data["ot"] = s;
+                        lock (_lock)
+                        {
+                            _data["ot"] = s;
+                        }
                     if (!this._running)
                         break;
                     await Task.Delay(Interval);
                     s = await GetInsideTemperature();
                     if (s != "ERROR")
-                        _data["it"] = s;
+                        lock (_lock)
+                        {
+                            _data["it"] = s;
+                        }
                     if (!this._running)
                         break;
                     await Task.Delay(Interval);
                     s = await GetEngineFuelRate();
                     if (s != "ERROR")
-                        _data["efr"] = s;
+                        lock (_lock)
+                        {
+                            _data["efr"] = s;
+                        }
                     if (!this._running)
                         break;
                     await Task.Delay(Interval);
@@ -349,28 +373,21 @@
                 //if there is no connection
                 return null;
             }
-            return _data;
-            //Dictionary<string, string> ret = new Dictionary<string, string>();
-            //string s;
-            //s = await GetSpeed();
-            //if (s != "ERROR")
-            //    ret.Add("0D", s);
-            //s = await GetBarometricPressure();
-            //if(s != "ERROR")
-            //    ret.Add("33", s);
-            //s = await GetRPM();
-            //if (s != "ERROR")
-            //    ret.Add("0C", s);
-            //s = await GetOutsideTemperature();
-            //if (s != "ERROR")
-            //    ret.Add("46", s);
-            //s = await GetInsideTemperature();
-            //if (s != "ERROR")
-            //    ret.Add("0F", s);
-            //s = await GetEngineFuelRate();
-            //if (s != "ERROR")
-            //    ret.Add("5E", s);
-            //return ret;
+            var ret = new Dictionary<string, string>();
+            lock (_lock)
+            {
+                foreach (var key in _data.Keys)
+                {
+                    ret.Add(key, _data[key]);
+                }
+                _data["spd"] = DefValue;  //Speed
+                _data["bp"] = DefValue;   //BarometricPressure
+                _data["rpm"] = DefValue;  //RPM
+                _data["ot"] = DefValue;   //OutsideTemperature
+                _data["it"] = DefValue;   //InsideTemperature
+                _data["efr"] = DefValue;  //EngineFuelRate
+            }
+            return ret;
         }

         private async Task<string> SendAndReceive(string msg)


Fix unhandled exception when closing application
Fix WinXp compatibility issue

git-svn-id: 7042c477d8c606b0fce0972d3845362a4b89b6ea@66284 4ef1bfeb-0a34-4d02-9305-240e5b07a168

--- src/Log2Console/MainForm.cs
+++ src/Log2Console/MainForm.cs
@@ -25,6 +25,7 @@
     public partial class MainForm : Form, ILogMessageNotifiable
     {
         private readonly bool _firstStartup;
+        private readonly bool _isWin7orLater;
         private readonly WindowRestorer _windowRestorer;

         private readonly DockExtender _dockExtender;
@@ -97,6 +98,7 @@
                                                        UserSettings.Instance.Layout.WindowState);

             // Windows 7 CodePack (Taskbar icons and progress)
+            try
             {
                 // Taskbar Progress
                 TaskbarManager.Instance.ApplicationId = Text;
@@ -109,21 +111,28 @@

                 // Auto Scroll Btn
                 _autoScrollWinbarBtn =
-                    new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap) autoLogToggleBtn.Image).GetHicon()),
+                    new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap)autoLogToggleBtn.Image).GetHicon()),
                                                autoLogToggleBtn.ToolTipText);
                 _autoScrollWinbarBtn.Click += (sender, args) => autoLogToggleBtn_Click(sender, null);

                 // Clear All Btn
                 _clearAllWinbarBtn =
-                    new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap) clearLoggersBtn.Image).GetHicon()),
+                    new ThumbnailToolbarButton(Icon.FromHandle(((Bitmap)clearLoggersBtn.Image).GetHicon()),
                                                clearLoggersBtn.ToolTipText);
                 _clearAllWinbarBtn.Click += (sender, args) => ClearAll();

                 // Add Btns
-                TaskbarManager.Instance.ThumbnailToolbars.AddButtons(Handle,
+                TaskbarManager.Instance.ThumbnailToolbars.AddButtons(Handle,
                     _pauseWinbarBtn, _autoScrollWinbarBtn, _clearAllWinbarBtn);
-            }
-
+
+                _isWin7orLater = true;
+            }
+            catch (Exception)
+            {
+                // Not running on Win 7?
+                _isWin7orLater = false;
+            }
+
             ApplySettings(true);

             _eventQueue = new Queue<LogMessage>();
@@ -188,24 +197,39 @@

         protected override void OnFormClosing(FormClosingEventArgs e)
         {
-            _logMsgTimer.Dispose();
-            _logMsgTimer = null;
-
-            _taskbarProgressTimer.Dispose();
-            _taskbarProgressTimer = null;
-
-            if (UserSettings.Instance.Layout.LogListViewColumnsWidths == null)
-                UserSettings.Instance.Layout.LogListViewColumnsWidths = new int[logListView.Columns.Count];
-            for (int i = 0; i < logListView.Columns.Count; i++)
-            {
-                UserSettings.Instance.Layout.LogListViewColumnsWidths[i] = logListView.Columns[i].Width;
-            }
-
-            UserSettings.Instance.Layout.Set(
-                _windowRestorer.WindowPosition, _windowRestorer.WindowState, logDetailPanel, loggerPanel);
-
-            UserSettings.Instance.Save();
-            UserSettings.Instance.Close();
+            try
+            {
+                if (_logMsgTimer != null)
+                {
+                    _logMsgTimer.Dispose();
+                    _logMsgTimer = null;
+                }
+
+                if (_taskbarProgressTimer != null)
+                {
+                    _taskbarProgressTimer.Dispose();
+                    _taskbarProgressTimer = null;
+                }
+
+                if (UserSettings.Instance.Layout.LogListViewColumnsWidths == null)
+                {
+                    UserSettings.Instance.Layout.LogListViewColumnsWidths = new int[logListView.Columns.Count];
+                }
+
+                for (int i = 0; i < logListView.Columns.Count; i++)
+                {
+                    UserSettings.Instance.Layout.LogListViewColumnsWidths[i] = logListView.Columns[i].Width;
+                }
+
+                UserSettings.Instance.Layout.Set(
+                    _windowRestorer.WindowPosition, _windowRestorer.WindowState, logDetailPanel, loggerPanel);
+
+                UserSettings.Instance.Save();
+                UserSettings.Instance.Close();
+            }
+            catch (Exception)
+            {
+            }
         }

         protected override void OnLoad(EventArgs e)
@@ -545,25 +569,25 @@

         private void OnTaskbarProgressTimer(object o)
         {
+            if (_isWin7orLater)
+            {
+                TaskbarManager.Instance.SetProgressState(_addedLogMessage
+                                                                ? TaskbarProgressBarState.Indeterminate
+                                                                : TaskbarProgressBarState.NoProgress);
+            }
+            _addedLogMessage = false;
+        }
+
+        private void quitBtn_Click(object sender, EventArgs e)
+        {
             try
             {
-                TaskbarManager.Instance.SetProgressState(_addedLogMessage
-                                                             ? TaskbarProgressBarState.Indeterminate
-                                                             : TaskbarProgressBarState.NoProgress);
+                Quit();
             }
             catch (Exception)
             {
-                // Not running on Win 7?
-            }
-            finally
-            {
-                _addedLogMessage = false;
-            }
-        }
-
-        private void quitBtn_Click(object sender, EventArgs e)
-        {
-            Quit();
+                Environment.Exit(0);
+            }
         }

         private void logListView_SelectedIndexChanged(object sender, EventArgs e)
@@ -730,7 +754,14 @@

         private void exitTrayMenuItem_Click(object sender, EventArgs e)
         {
-            Quit();
+            try
+            {
+                Quit();
+            }
+            catch (Exception)
+            {
+                Environment.Exit(0);
+            }
         }

         private void searchTextBox_TextChanged(object sender, EventArgs e)
@@ -888,10 +919,13 @@
             pauseBtn.Image = _pauseLog ? Properties.Resources.Go16 : Properties.Resources.Pause16;
             pauseBtn.Checked = _pauseLog;

-            _pauseWinbarBtn.Icon = Icon.FromHandle(((Bitmap)pauseBtn.Image).GetHicon());
-
-            TaskbarManager.Instance.SetOverlayIcon(
-                _pauseLog ? Icon.FromHandle(Properties.Resources.Pause16.GetHicon()) : null, String.Empty);
+            if (_isWin7orLater)
+            {
+                _pauseWinbarBtn.Icon = Icon.FromHandle(((Bitmap) pauseBtn.Image).GetHicon());
+
+                TaskbarManager.Instance.SetOverlayIcon(
+                    _pauseLog ? Icon.FromHandle(Properties.Resources.Pause16.GetHicon()) : null, String.Empty);
+            }
         }

         private void goToFirstLogBtn_Click(object sender, EventArgs e)


give pCampBot a -h, -help option

give pCampBot a -h, -help option

--- OpenSim/Tools/pCampBot/pCampBot.cs
+++ OpenSim/Tools/pCampBot/pCampBot.cs
@@ -55,22 +55,42 @@
             //Set up our nifty config..  thanks to nini
             ArgvConfigSource cs = new ArgvConfigSource(args);

-            cs.AddSwitch("Startup", "botcount");
-            cs.AddSwitch("Startup", "loginuri");
+            cs.AddSwitch("Startup", "botcount","n");
+            cs.AddSwitch("Startup", "loginuri","l");
             cs.AddSwitch("Startup", "firstname");
             cs.AddSwitch("Startup", "lastname");
             cs.AddSwitch("Startup", "password");
+            cs.AddSwitch("Startup", "help","h");

             IConfig ol = cs.Configs["Startup"];
-            int botcount = ol.GetInt("botcount", 1);
-            BotManager bm = new BotManager();
-
-            //startup specified number of bots.  1 is the default
-            bm.dobotStartup(botcount, ol);
-            while (true)
-            {
-                MainConsole.Instance.Prompt();
+            if (ol.Get("help") != null) {
+                Help();
+            } else {
+                int botcount = ol.GetInt("botcount", 1);
+
+                BotManager bm = new BotManager();
+
+                //startup specified number of bots.  1 is the default
+                bm.dobotStartup(botcount, ol);
+                while (true)
+                {
+                    MainConsole.Instance.Prompt();
+                }
             }
+        }
+
+        public static void Help()
+        {
+            System.Console.WriteLine(
+                                     "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
+                                     "Spawns a set of bots to test an OpenSim region\n\n" +
+                                     "  -l, -loginuri      loginuri for sim to log into (required)\n" +
+                                     "  -n, -botcount      number of bots to start (default: 1)\n" +
+                                     "  -firstname         first name for the bot(s) (default: random string)\n" +
+                                     "  -lastname          lastname for the bot(s) (default: random string)\n" +
+                                     "  -password          password for the bots(s) (default: random string)\n" +
+                                     "  -h, -help          show this message"
+                                     );
         }
     }
 }


Don't log empty steps

Don't log empty steps

--- OptigemLdapSync/LoggingReporter.cs
+++ OptigemLdapSync/LoggingReporter.cs
@@ -8,6 +8,8 @@
         private readonly ITaskReporter wrappedReporter;

         private StreamWriter writer;
+
+        private string pendingProgress = null;

         public LoggingReporter(string logFile, ITaskReporter wrappedReporter)
         {
@@ -39,12 +41,18 @@

         public void Progress(string text)
         {
-            this.writer.WriteLine("  " + text);
+            this.pendingProgress = text;
             this.wrappedReporter?.Progress(text);
         }

         public void Log(string text)
         {
+            if (this.pendingProgress != null)
+            {
+                this.writer.WriteLine("  " + this.pendingProgress);
+                this.pendingProgress = null;
+            }
+
             this.writer.WriteLine("    " + text);
             this.wrappedReporter?.Log(text);
         }


added lock to prevent duplicate party members

--- TCC.Core/ViewModels/GroupWindowViewModel.cs
+++ TCC.Core/ViewModels/GroupWindowViewModel.cs
@@ -210,16 +210,19 @@
         public void AddOrUpdateMember(User p)
         {
             if (SettingsManager.IgnoreMeInGroupWindow && p.IsPlayer) return;
-            var user = Members.ToSyncArray().FirstOrDefault(x => x.PlayerId == p.PlayerId && x.ServerId == p.ServerId);
-            if (user == null)
-            {
-                Members.Add(p);
-                SendAddMessage(p.Name);
-                return;
-            }
-            user.Online = p.Online;
-            user.EntityId = p.EntityId;
-            user.IsLeader = p.IsLeader;
+            lock (_lock)
+            {
+                var user = Members.ToSyncArray().FirstOrDefault(x => x.PlayerId == p.PlayerId && x.ServerId == p.ServerId);
+                if (user == null)
+                {
+                    Members.Add(p);
+                    SendAddMessage(p.Name);
+                    return;
+                }
+                user.Online = p.Online;
+                user.EntityId = p.EntityId;
+                user.IsLeader = p.IsLeader;
+            }
         }
         private void SendAddMessage(string name)
         {


Fixes `recreate static directory` showing up for non-admins

--- TGS.ControlPanel/ControlPanel/StaticPage.cs
+++ TGS.ControlPanel/ControlPanel/StaticPage.cs
@@ -29,7 +29,7 @@
 		{
 			if (initializedStaticPage)
 				return;
-			if(Instance.Administration != null)
+			if(Instance.Administration == null)
 				RecreateStaticButton.Visible = false;
 			BuildFileList();
 			initializedStaticPage = true;


Fixed incorrect filename error exception

--- Oxide.Ext.CSharp/PluginCompiler.cs
+++ Oxide.Ext.CSharp/PluginCompiler.cs
@@ -123,7 +123,7 @@
                                 if (class_name != plugin.Name)
                                 {
                                     Interface.Oxide.LogError("Plugin filename is incorrect: {0}.cs (should be {1}.cs)", plugin.ScriptName, class_name);
-                                    plugin.CompilerErrors = string.Format("Plugin filename is incorrect (should be {1}.cs)", class_name);
+                                    plugin.CompilerErrors = string.Format("Plugin filename is incorrect: {0}.cs (should be {1}.cs)", plugin.ScriptName, class_name);
                                     RemovePlugin(compilation.plugins, plugin);
                                 }


Update SocketExtensions.cs

Update SocketExtensions.cs

--- src/Net/SocketExtensions.cs
+++ src/Net/SocketExtensions.cs
@@ -22,7 +22,7 @@
     using System.Net;
     using System.Net.Sockets;
     using System.Threading.Tasks;
-	using System.Runtime.InteropServices;
+    using System.Runtime.InteropServices;

     static class SocketExtensions
     {


Remove unused members

Remove unused members

--- PartPreviewWindow/PlatingHelper.cs
+++ PartPreviewWindow/PlatingHelper.cs
@@ -162,14 +162,6 @@
 			objectToMove.Matrix *= Matrix4X4.CreateTranslation(new Vector3(0, 0, zHeight - bounds.minXYZ.Z));
 		}

-		public static void CenterMeshGroupXY(List<MeshGroup> meshesGroupList, List<Matrix4X4> meshTransforms, int index)
-		{
-			AxisAlignedBoundingBox bounds = GetAxisAlignedBoundingBox(meshesGroupList[index], meshTransforms[index]);
-			Vector3 boundsCenter = (bounds.maxXYZ + bounds.minXYZ) / 2;
-
-			meshTransforms[index] *= Matrix4X4.CreateTranslation(new Vector3(-boundsCenter.X + bounds.XSize / 2, -boundsCenter.Y + bounds.YSize / 2, 0));
-		}
-
 		/// <summary>
 		/// Moves the target object to the first non-colliding position, starting from the lower left corner of the bounding box containing all sceneItems
 		/// </summary>
@@ -282,10 +274,6 @@
 			return true;
 		}

-		static AxisAlignedBoundingBox GetAxisAlignedBoundingBox(MeshGroup meshGroup, Matrix4X4 transform)
-		{
-			return meshGroup.GetAxisAlignedBoundingBox(transform);
-		}

 	}
 }


Add function to get the .NET Framework version.

--- src/SilDev/EnvironmentEx.cs
+++ src/SilDev/EnvironmentEx.cs
@@ -5,7 +5,7 @@
 // ==============================================
 //
 // Filename: EnvironmentEx.cs
-// Version:  2017-05-12 12:15
+// Version:  2017-05-22 18:01
 //
 // Copyright (c) 2017, Si13n7 Developments (r)
 // All rights reserved.
@@ -34,6 +34,7 @@
         private static List<string> _cmdLineArgs = new List<string>();
         private static bool _cmdLineArgsQuotes = true;
         private static string _commandLine = string.Empty;
+        private static Version _version;

         /// <summary>
         ///     Provides filtering and sorting options, and returns a string <see cref="List{T}"/>
@@ -314,6 +315,39 @@
         }

         /// <summary>
+        ///     Gets a <see cref="System.Version"/> object that describes the major, minor and
+        ///     build numbers of the common language runtime.
+        /// </summary>
+        public static Version Version
+        {
+            get
+            {
+                if (_version != null)
+                    return _version;
+                var release = Reg.Read(Registry.LocalMachine, @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", "Release", 0);
+                if (release > 460805)
+                    _version = new Version(4, 7, 1);
+                else if (release >= 460798)
+                    _version = new Version(4, 7, 0);
+                else if (release >= 394802)
+                    _version = new Version(4, 6, 2);
+                else if (release >= 394254)
+                    _version = new Version(4, 6, 1);
+                else if (release >= 393295)
+                    _version = new Version(4, 6, 0);
+                else if (release >= 379893)
+                    _version = new Version(4, 5, 2);
+                else if (release >= 378675)
+                    _version = new Version(4, 5, 1);
+                else if (release >= 378389)
+                    _version = new Version(4, 5, 0);
+                else
+                    _version = Environment.Version;
+                return _version;
+            }
+        }
+
+        /// <summary>
         ///     Determines whether the system restoring is enabled.
         /// </summary>
         public static bool SystemRestoringIsEnabled =>


faster refresh

faster refresh

--- src/Sir.Store/NodeReader.cs
+++ src/Sir.Store/NodeReader.cs
@@ -50,6 +50,8 @@

         private void OnFileChanged(object sender, FileSystemEventArgs e)
         {
+            this.Log($"to be refreshed: {_ixpFileName}");
+
             _root = null;
         }

@@ -73,26 +75,26 @@

                 _root = new VectorNode();

-                using (var vectorStream = _sessionFactory.CreateReadStream(_vecFileName))
-                using (var ixStream = _sessionFactory.CreateReadStream(_ixFileName))
-                //using (var queue = new ProducerConsumerQueue<VectorNode>(Build, int.Parse(_config.Get("write_thread_count"))))
-                {
-                    foreach (var (offset, length) in _pages)
-                    {
-                        ixStream.Seek(offset, SeekOrigin.Begin);
-
-                        var tree = VectorNode.DeserializeTree(ixStream, vectorStream, length);
+                this.Log($"refreshing {_ixpFileName}");
+
+                Parallel.ForEach(_pages, page =>
+                {
+                    using (var vectorStream = _sessionFactory.CreateReadStream(_vecFileName))
+                    using (var ixStream = _sessionFactory.CreateReadStream(_ixFileName))
+                    {
+                        ixStream.Seek(page.offset, SeekOrigin.Begin);
+
+                        var tree = VectorNode.DeserializeTree(ixStream, vectorStream, page.length);

                         foreach (var node in tree.All())
                         {
                             _root.Add(node, VectorNode.TermIdenticalAngle, VectorNode.TermFoldAngle);
                         }

-                        //queue.Enqueue(tree);
-
-                        this.Log($"deserialized tree at {offset}");
-                    }
-                }
+                        this.Log($"deserialized tree at {page.offset}");
+                    }
+                });
+

                 this.Log($"deserialized {_pages.Count} index segments in {time.Elapsed}");


Refactor.

Refactor.

--- src/SparkPost/DataMapper.cs
+++ src/SparkPost/DataMapper.cs
@@ -33,16 +33,18 @@

         public virtual IDictionary<string, object> ToDictionary(Transmission transmission)
         {
-            var dictionary = new Dictionary<string, object>
-            {
+            var data = new Dictionary<string, object>
+            {
+                ["substitution_data"] =
+                    transmission.SubstitutionData != null && transmission.SubstitutionData.Keys.Any()
+                        ? transmission.SubstitutionData
+                        : null,
                 ["recipients"] = transmission.ListId != null
                     ? (object) new Dictionary<string, object> {["list_id"] = transmission.ListId}
                     : transmission.Recipients.Select(ToDictionary)
             };
-            if (transmission.SubstitutionData != null && transmission.SubstitutionData.Keys.Any())
-                dictionary["substitution_data"] = transmission.SubstitutionData;
-
-            var result = WithCommonConventions(transmission, dictionary);
+
+            var result = WithCommonConventions(transmission, data);

             CcHandling.SetAnyCCsInTheHeader(transmission, result);


Updated changelog for next release

Updated changelog for next release

--- src/Tailviewer/Changelog.cs
+++ src/Tailviewer/Changelog.cs
@@ -48,6 +48,31 @@
 			AddV070();
 			AddV071();
 			AddV080();
+			AddV081();
+		}
+
+		private static void AddV081()
+		{
+			var features = new[]
+			{
+				"Added folder data sources", // https://github.com/Kittyfisto/Tailviewer/issues/125
+				"The font size is now configurable", // https://github.com/Kittyfisto/Tailviewer/issues/53
+			};
+			var bugfixes = new[]
+			{
+				"The proxy password box allows the user to change focus away from it", // https://github.com/Kittyfisto/Tailviewer/issues/188
+				"Fixed installer license display" // https://github.com/Kittyfisto/Tailviewer/issues/194
+			};
+			var misc = new[]
+			{
+				"Bookmarks are stored/restored in between sessions", // https://github.com/Kittyfisto/Tailviewer/issues/66
+				"Titlebar contains more information about selected files", // https://github.com/Kittyfisto/Tailviewer/issues/127
+				"Installer now stops tailviewer if necessary" // https://github.com/Kittyfisto/Tailviewer/issues/150
+			};
+			var releaseDate = new DateTime(2019, 06, 23);
+			var version = new Version(0, 8, 1);
+			var change = new Change(releaseDate, version, features, bugfixes, misc);
+			AllChanges.Add(change);
 		}

 		private static void AddV080()


Remove support for absolute paths - a breaking change.

--- src/Zip/ZipNameTransform.cs
+++ src/Zip/ZipNameTransform.cs
@@ -54,7 +54,6 @@
 		/// </summary>
 		public ZipNameTransform()
 		{
-			relativePath_ = true;
 		}

 		/// <summary>
@@ -63,42 +62,12 @@
 		/// <param name="trimPrefix">The string to trim from front of paths if found.</param>
 		public ZipNameTransform(string trimPrefix)
 		{
-			relativePath_ = true;
-			trimPrefix_ = trimPrefix;
-		}
-
-		/// <summary>
-		/// Initialize a new instance of <see cref="ZipNameTransform"></see>
-		/// </summary>
-		/// <param name="useRelativePaths">If true relative paths are created,
-		/// if false absolute paths are created. </param>
-		/// <remarks>
-		/// Absolute paths are not compatible with the Zip specification although
-		/// archivers can create them.  If maximum compatability is important
-		/// always user relative paths.
-		/// </remarks>
-		public ZipNameTransform(bool useRelativePaths)
-		{
-			relativePath_ = useRelativePaths;
-		}
-
-		/// <summary>
-		/// Initialize a new instance of <see cref="ZipNameTransform"></see>
-		/// </summary>
-		/// <param name="useRelativePaths">If true relative paths are created,
-		/// if false absolute paths are created. </param>
-		/// <param name="trimPrefix">The string to trim from front of paths if found.</param>
-		/// <remarks>
-		/// Absolute paths are not compatible with the Zip specification. If maximum compatability is important
-		/// always use relative paths.
-		/// </remarks>
-		public ZipNameTransform(bool useRelativePaths, string trimPrefix)
-		{
-			trimPrefix_ = trimPrefix;
-			relativePath_ = useRelativePaths;
-		}
+			if ( trimPrefix != null ) {
+				trimPrefix_ = trimPrefix.ToLower();
+			}
+		}
+		#endregion

-		#endregion
 		/// <summary>
 		/// Static constructor.
 		/// </summary>
@@ -140,11 +109,8 @@
 					name += "/";
 				}
 			}
-			else if ( !relativePath_ ) {
-				name = "/";
-			}
 			else {
-				throw new ZipException("Cannot have empty directory name");
+				throw new ZipException("Cannot have an empty directory name");
 			}
 			return name;
 		}
@@ -157,7 +123,8 @@
 		public string TransformFile(string name)
 		{
 			if (name != null) {
-				if ( (trimPrefix_ != null) && (name.IndexOf(trimPrefix_) == 0) ) {
+				string lowerName = name.ToLower();
+				if ( (trimPrefix_ != null) && (lowerName.IndexOf(trimPrefix_) == 0) ) {
 					name = name.Substring(trimPrefix_.Length);
 				}

@@ -169,14 +136,8 @@

 				name = name.Replace(@"\", "/");

-				if ( relativePath_ ) {
-					while ( (name.Length > 0) && (name[0] == '/')) {
-						name = name.Remove(0, 1);
-					}
-				} else {
-					if ( (name.Length > 0) && (name[0] != '/')) {
-						name = name.Insert(0, "/");
-					}
+				while ( (name.Length > 0) && (name[0] == '/')) {
+					name = name.Remove(0, 1);
 				}
 			}
 			else {
@@ -200,7 +161,7 @@
 		/// <param name="name">The name to test.</param>
 		/// <param name="relaxed">If true checking is relaxed about windows file names and absolute paths.</param>
 		/// <returns>Returns true if the name is a valid zip name; false otherwise.</returns>
-		/// <remarks>Zip path names are actually in unix format,
+		/// <remarks>Zip path names are actually in Unix format,
 		/// and should only contain relative paths.
 		/// This means that any path stored should not contain a drive or
 		/// device letter, or a leading slash.  All slashes should forward slashes '/'.
@@ -249,7 +210,6 @@

 		#region Instance Fields
 		string trimPrefix_;
-		bool relativePath_;
 		#endregion
 		#region Class Fields
 		static readonly char[] InvalidEntryChars;