Getting rid of CaptionHeight and CornerRadius

--- src/ControlzEx/Behaviors/WindowChromeBehavior.cs
+++ src/ControlzEx/Behaviors/WindowChromeBehavior.cs
@@ -45,26 +45,6 @@
         public static readonly DependencyProperty ResizeBorderThicknessProperty =
             DependencyProperty.Register(nameof(ResizeBorderThickness), typeof(Thickness), typeof(WindowChromeBehavior), new PropertyMetadata(GetDefaultResizeBorderThickness()));

-        public double CaptionHeight
-        {
-            get { return (double)this.GetValue(CaptionHeightProperty); }
-            set { this.SetValue(CaptionHeightProperty, value); }
-        }
-
-        // Using a DependencyProperty as the backing store for CaptionHeight.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty CaptionHeightProperty =
-            DependencyProperty.Register(nameof(CaptionHeight), typeof(double), typeof(WindowChromeBehavior), new PropertyMetadata(0D));
-
-        public CornerRadius CornerRadius
-        {
-            get { return (CornerRadius)this.GetValue(CornerRadiusProperty); }
-            set { this.SetValue(CornerRadiusProperty, value); }
-        }
-
-        // Using a DependencyProperty as the backing store for CornerRadius.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty CornerRadiusProperty =
-            DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(WindowChromeBehavior), new PropertyMetadata(new CornerRadius(0D)));
-
         public Thickness GlassFrameThickness
         {
             get { return (Thickness)this.GetValue(GlassFrameThicknessProperty); }
@@ -176,9 +156,9 @@
             this.windowChrome = new WindowChrome();

             BindingOperations.SetBinding(this.windowChrome, WindowChrome.ResizeBorderThicknessProperty, new Binding { Path = new PropertyPath(ResizeBorderThicknessProperty), Source = this });
-            BindingOperations.SetBinding(this.windowChrome, WindowChrome.CaptionHeightProperty, new Binding { Path = new PropertyPath(CaptionHeightProperty), Source = this });
-            BindingOperations.SetBinding(this.windowChrome, WindowChrome.CornerRadiusProperty, new Binding { Path = new PropertyPath(CornerRadiusProperty), Source = this });
             BindingOperations.SetBinding(this.windowChrome, WindowChrome.GlassFrameThicknessProperty, new Binding { Path = new PropertyPath(GlassFrameThicknessProperty), Source = this });
+            this.windowChrome.CaptionHeight = 0;
+            this.windowChrome.CornerRadius = default(CornerRadius);
             this.windowChrome.UseAeroCaptionButtons = false;

             // port: Is forwarded by code in IgnoreTaskbarOnMaximizePropertyChangedCallback


DNN-10163 - AddLogSettings now returns 401 status if user has admin role

--- src/Modules/Manage/Dnn.PersonaBar.AdminLogs/Services/AdminLogsController.cs
+++ src/Modules/Manage/Dnn.PersonaBar.AdminLogs/Services/AdminLogsController.cs
@@ -412,6 +412,11 @@
         {
             try
             {
+                var isAdmin = UserInfo.Roles.Contains(PortalSettings.AdministratorRoleName);
+                if (isAdmin)
+                {
+                    return Request.CreateResponse(HttpStatusCode.Unauthorized);
+                }
                 request.LogTypePortalID = UserInfo.IsSuperUser ? request.LogTypePortalID : PortalId.ToString();

                 var logTypeConfigInfo = JObject.FromObject(request).ToObject<LogTypeConfigInfo>();


Style cleanup

Style cleanup

--- src/CorpAxe.Examples/Examples.Console/Program.cs
+++ src/CorpAxe.Examples/Examples.Console/Program.cs
@@ -5,6 +5,7 @@
     using System.IO;
     using System.Net;
     using System.Text;
+
     using Newtonsoft.Json;
     using Newtonsoft.Json.Converters;

@@ -116,7 +117,7 @@

             var dynamicEvent = GetEventById(accessToken, eventId);

-            Console.WriteLine("Id created: {0}", eventId.ToString());
+            Console.WriteLine("Id created: {0}", eventId);
             Console.WriteLine("Id retrieved: {0}", dynamicEvent.id.ToString());

             Console.ReadLine();
@@ -125,7 +126,7 @@
         public static string GetAccessToken(string consumerKey, string consumerSecret, string username, string password)
         {
             var request = (HttpWebRequest)WebRequest.Create(BaseApiUrl + "api/token");
-            var authorizationHeader = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(consumerKey + ":" + consumerSecret));
+            var authorizationHeader = Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(consumerKey + ":" + consumerSecret));
             request.Headers.Add("Authorization", "Basic " + authorizationHeader);
             request.Accept = string.Format("application/json; version={0}", ApiVersion);
             request.ContentType = "application/x-www-form-urlencoded";
@@ -159,7 +160,7 @@

         public static dynamic GetEventById(string accessToken, long eventId)
         {
-            var request = (HttpWebRequest)WebRequest.Create(BaseApiUrl + "api/events/" + eventId.ToString());
+            var request = (HttpWebRequest)WebRequest.Create(BaseApiUrl + "api/events/" + eventId);
             request.Headers.Add("Authorization", "Bearer " + accessToken);
             request.Accept = string.Format("application/json; version={0}", ApiVersion);
             request.ContentType = "application/json";
@@ -173,14 +174,20 @@
         {
             using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
             {
-                if (response.StatusCode == HttpStatusCode.OK)
+                if (response != null)
                 {
-                    using (var stream = response.GetResponseStream())
+                    if (response.StatusCode == HttpStatusCode.OK)
                     {
-                        using (var reader = new StreamReader(stream))
+                        using (var stream = response.GetResponseStream())
                         {
-                            var converter = new ExpandoObjectConverter();
-                            return JsonConvert.DeserializeObject<ExpandoObject>(reader.ReadToEnd(), converter);
+                            if (stream != null)
+                            {
+                                using (var reader = new StreamReader(stream))
+                                {
+                                    var converter = new ExpandoObjectConverter();
+                                    return JsonConvert.DeserializeObject<ExpandoObject>(reader.ReadToEnd(), converter);
+                                }
+                            }
                         }
                     }
                 }


Updated user tests

Updated user tests

--- RoomReservationSystem/Core.UnitTest/CreateInstance.cs
+++ RoomReservationSystem/Core.UnitTest/CreateInstance.cs
@@ -8,16 +8,23 @@
     public class CreateInstance
     {
         IRoom _room1 = new Room('A', 2, 9, 6, Permission.Student);
-        IRoom _room2 = new Room('A', 2, 15, 6, Permission.Student);
-        IRoom _room3 = new Room('A', 2, 115, 6, Permission.Student);
+        IRoom _room2 = new Room('A', 2, 15, 6, Permission.Teacher);
+        IRoom _room3 = new Room('A', 2, 115, 6, Permission.Admin);

         IUser _student = new User("matt2694", "matt2694@edu.eal.dk", Permission.Student);
         IUser _teacher = new User("alhe", "alhe@eal.dk", Permission.Teacher);
         IUser _admin = new User("frje", "frje@eal.dk", Permission.Admin);

-        Reservation _reservation1;
-        Reservation _reservation2;
-        Reservation _reservation3;
+        DateTime _dateFrom = new DateTime(2016, 4, 29, 8, 0, 0);
+        DateTime _dateTo = new DateTime(2016, 4, 29, 16, 0, 0);
+
+        [TestInitialize]
+        public void TestInitialize()
+        {
+            Reservation _reservation1 = new Reservation(_student, _room1, 6, _dateFrom, _dateTo);
+            Reservation _reservation2 = new Reservation(_teacher, _room2, 6, _dateFrom, _dateTo);
+            Reservation _reservation3 = new Reservation(_admin, _room3, 6, _dateFrom, _dateTo);
+        }

         [TestMethod]
         public void CanCreateRoomInstanceID1()
@@ -62,9 +69,21 @@
         }

         [TestMethod]
-        public void CanCreateRoomInstanceMinPermissionLevel()
+        public void CanCreateRoomInstanceMinPermissionLevel1()
         {
             Assert.AreEqual(Permission.Student, _room1.MinPermissionLevel);
+        }
+
+        [TestMethod]
+        public void CanCreateRoomInstanceMinPermissionLevel2()
+        {
+            Assert.AreEqual(Permission.Teacher, _room2.MinPermissionLevel);
+        }
+
+        [TestMethod]
+        public void CanCreateRoomInstanceMinPermissionLevel3()
+        {
+            Assert.AreEqual(Permission.Admin, _room3.MinPermissionLevel);
         }

         [TestMethod]


ContentTypes: Fixing and DRYing Type/Part/Field display and technical name validation, code styling, fixes #906 #7770

--- src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs
+++ src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs
@@ -28,19 +28,19 @@
         private readonly ShellSettings _settings;

         public AdminController(
-            IOrchardServices orchardServices,
-            IContentDefinitionService contentDefinitionService,
+            IOrchardServices orchardServices,
+            IContentDefinitionService contentDefinitionService,
             IContentDefinitionManager contentDefinitionManager,
             IPlacementService placementService,
             Lazy<IEnumerable<IShellSettingsManagerEventHandler>> settingsManagerEventHandlers,
-            ShellSettings settings
-            ) {
+            ShellSettings settings) {
             Services = orchardServices;
             _contentDefinitionService = contentDefinitionService;
             _contentDefinitionManager = contentDefinitionManager;
             _placementService = placementService;
             _settingsManagerEventHandlers = settingsManagerEventHandlers;
             _settings = settings;
+
             T = NullLocalizer.Instance;
         }

@@ -64,7 +64,7 @@
             if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to create a content type.")))
                 return new HttpUnauthorizedResult();

-            return View(new CreateTypeViewModel { DisplayName = suggestion, Name = suggestion.ToSafeName() });
+            return View(new CreateTypeViewModel { DisplayName = suggestion?.Trim(), Name = suggestion?.ToSafeName() });
         }

         [HttpPost, ActionName("Create")]
@@ -72,37 +72,33 @@
             if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to create a content type.")))
                 return new HttpUnauthorizedResult();

-            viewModel.DisplayName = viewModel.DisplayName ?? String.Empty;
-            viewModel.Name = viewModel.Name ?? String.Empty;
-
-            if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) {
-                ModelState.AddModelError("DisplayName", T("The Display Name name can't be empty.").ToString());
-            }
-
-            if (String.IsNullOrWhiteSpace(viewModel.Name)) {
-                ModelState.AddModelError("Name", T("The Content Type Id can't be empty.").ToString());
-            }
-
-            if (_contentDefinitionService.GetTypes().Any(t => String.Equals(t.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) {
-                ModelState.AddModelError("Name", T("A type with the same Id already exists.").ToString());
-            }
-
-            if (!String.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) {
-                ModelState.AddModelError("Name", T("The technical name must start with a letter.").ToString());
-            }
-
-            if (_contentDefinitionService.GetTypes().Any(t => String.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) {
-                ModelState.AddModelError("DisplayName", T("A type with the same Display Name already exists.").ToString());
+
+            ValidateDisplayName(viewModel.DisplayName);
+
+            // Additional Display Name validation.
+            if (!string.IsNullOrWhiteSpace(viewModel.DisplayName) &&
+                _contentDefinitionService.GetTypes().Any(t => string.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("DisplayName", T("A content type with this display name already exists.").Text);
+            }
+
+            ValidateTechnicalName(viewModel.Name);
+
+            // Additional Technical Name validation.
+            if (!string.IsNullOrWhiteSpace(viewModel.Name) &&
+                _contentDefinitionService.GetTypes().Any(t => string.Equals(t.Name.ToSafeName(), viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("Name", T("A content type with this technical name already exists.").Text);
             }

             if (!ModelState.IsValid) {
                 Services.TransactionManager.Cancel();
+
                 return View(viewModel);
             }

+
             var contentTypeDefinition = _contentDefinitionService.AddType(viewModel.Name, viewModel.DisplayName);
-
-            // adds CommonPart by default
+
+            // CommonPart is added by default to all Content Types.
             _contentDefinitionService.AddPartToType("CommonPart", viewModel.Name);

             var typeViewModel = new EditTypeViewModel(contentTypeDefinition);
@@ -116,14 +112,14 @@
         public ActionResult ContentTypeName(string displayName, int version) {
             return Json(new {
                 result = _contentDefinitionService.GenerateContentTypeNameFromDisplayName(displayName),
-                version = version
+                version
             });
         }

         public ActionResult FieldName(string partName, string displayName, int version) {
             return Json(new {
                 result = _contentDefinitionService.GenerateFieldNameFromDisplayName(partName, displayName),
-                version = version
+                version
             });
         }

@@ -133,8 +129,7 @@

             var typeViewModel = _contentDefinitionService.GetType(id);

-            if (typeViewModel == null)
-                return HttpNotFound();
+            if (typeViewModel == null) return HttpNotFound();

             return View(typeViewModel);
         }
@@ -145,12 +140,11 @@

             var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(id);

-            if (contentTypeDefinition == null)
-                return HttpNotFound();
+            if (contentTypeDefinition == null) return HttpNotFound();

             var placementModel = new EditPlacementViewModel {
                 PlacementSettings = contentTypeDefinition.GetPlacement(PlacementType.Editor),
-                AllPlacements = _placementService.GetEditorPlacement(id).OrderBy(x => x.PlacementSettings.Position, new FlatPositionComparer()).ThenBy(x => x.PlacementSettings.ShapeType).ToList(),
+                AllPlacements = _placementService.GetEditorPlacement(id).OrderBy(x => x.PlacementSettings.Position, new FlatPositionComparer()).ThenBy(x => x.PlacementSettings.ShapeType).ToList(),
                 ContentTypeDefinition = contentTypeDefinition,
             };

@@ -165,37 +159,35 @@

             var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(id);

-            if (contentTypeDefinition == null)
-                return HttpNotFound();
+            if (contentTypeDefinition == null) return HttpNotFound();

             var allPlacements = _placementService.GetEditorPlacement(id).ToList();
             var result = new List<PlacementSettings>(contentTypeDefinition.GetPlacement(PlacementType.Editor));

             contentTypeDefinition.ResetPlacement(PlacementType.Editor);

-            foreach(var driverPlacement in viewModel.AllPlacements) {
-                // if the placement has changed, persist it
+            foreach (var driverPlacement in viewModel.AllPlacements) {
+                // Save placement changes, if there's any.
                 if (!allPlacements.Any(x => x.PlacementSettings.Equals(driverPlacement.PlacementSettings))) {
                     result = result.Where(x => !x.IsSameAs(driverPlacement.PlacementSettings)).ToList();
                     result.Add(driverPlacement.PlacementSettings);
                 }
             }

-            foreach(var placementSetting in result) {
-                contentTypeDefinition.Placement(PlacementType.Editor,
-                                placementSetting.ShapeType,
-                                placementSetting.Differentiator,
-                                placementSetting.Zone,
-                                placementSetting.Position);
-
-            }
-
-            // persist changes
+            foreach (var placementSetting in result)
+                contentTypeDefinition.Placement(
+                    PlacementType.Editor,
+                    placementSetting.ShapeType,
+                    placementSetting.Differentiator,
+                    placementSetting.Zone,
+                    placementSetting.Position);
+
+            // Persist placement changes.
             _contentDefinitionManager.StoreTypeDefinition(contentTypeDefinition);

             _settingsManagerEventHandlers.Value.Invoke(x => x.Saved(_settings), Logger);

-            return RedirectToAction("EditPlacement", new {id});
+            return RedirectToAction("EditPlacement", new { id });
         }

         [HttpPost, ActionName("EditPlacement")]
@@ -206,12 +198,11 @@

             var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(id);

-            if (contentTypeDefinition == null)
-                return HttpNotFound();
+            if (contentTypeDefinition == null) return HttpNotFound();

             contentTypeDefinition.ResetPlacement(PlacementType.Editor);

-            // persist changes
+            // Persist placement reset.
             _contentDefinitionManager.StoreTypeDefinition(contentTypeDefinition);

             _settingsManagerEventHandlers.Value.Invoke(x => x.Saved(_settings), Logger);
@@ -227,28 +218,31 @@

             var typeViewModel = _contentDefinitionService.GetType(id);

-            if (typeViewModel == null)
-                return HttpNotFound();
+            if (typeViewModel == null) return HttpNotFound();

             var edited = new EditTypeViewModel();
+
             TryUpdateModel(edited);
-            typeViewModel.DisplayName = edited.DisplayName ?? string.Empty;
-
-            if ( String.IsNullOrWhiteSpace(typeViewModel.DisplayName) ) {
-                ModelState.AddModelError("DisplayName", T("The Content Type name can't be empty.").ToString());
-            }
-
-            if ( _contentDefinitionService.GetTypes().Any(t => String.Equals(t.DisplayName.Trim(), typeViewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase) && !String.Equals(t.Name, id)) ) {
-                ModelState.AddModelError("DisplayName", T("A type with the same name already exists.").ToString());
-            }
-
-            if (!ModelState.IsValid)
-                return View(typeViewModel);
+
+
+            ValidateDisplayName(edited.DisplayName);
+
+            // Additional Display Name validation.
+            if (!string.IsNullOrWhiteSpace(edited.DisplayName) &&
+                _contentDefinitionService.GetTypes().Any(t => string.Equals(t.DisplayName.Trim(), edited.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("DisplayName", T("A content type with this display name already exists.").Text);
+            }
+
+            if (!ModelState.IsValid) return View(typeViewModel);
+
+
+            typeViewModel.DisplayName = edited.DisplayName;

             _contentDefinitionService.AlterType(typeViewModel, this);

             if (!ModelState.IsValid) {
                 Services.TransactionManager.Cancel();
+
                 return View(typeViewModel);
             }

@@ -265,13 +259,12 @@

             var typeViewModel = _contentDefinitionService.GetType(id);

-            if (typeViewModel == null)
-                return HttpNotFound();
+            if (typeViewModel == null) return HttpNotFound();

             _contentDefinitionService.RemoveType(id, true);

             Services.Notifier.Information(T("\"{0}\" has been removed.", typeViewModel.DisplayName));
-
+
             return RedirectToAction("List");
         }

@@ -281,14 +274,13 @@

             var typeViewModel = _contentDefinitionService.GetType(id);

-            if (typeViewModel == null)
-                return HttpNotFound();
+            if (typeViewModel == null) return HttpNotFound();

             var typePartNames = new HashSet<string>(typeViewModel.Parts.Select(tvm => tvm.PartDefinition.Name));

             var viewModel = new AddPartsViewModel {
                 Type = typeViewModel,
-                PartSelections = _contentDefinitionService.GetParts(false/*metadataPartsOnly*/)
+                PartSelections = _contentDefinitionService.GetParts(metadataPartsOnly: false)
                     .Where(cpd => !typePartNames.Contains(cpd.Name) && cpd.Settings.GetModel<ContentPartSettings>().Attachable)
                     .Select(cpd => new PartSelectionViewModel { PartName = cpd.Name, PartDisplayName = cpd.DisplayName, PartDescription = cpd.Description })
                     .ToList()
@@ -304,25 +296,26 @@

             var typeViewModel = _contentDefinitionService.GetType(id);

-            if (typeViewModel == null)
-                return HttpNotFound();
+            if (typeViewModel == null) return HttpNotFound();

             var viewModel = new AddPartsViewModel();
-            if (!TryUpdateModel(viewModel))
-                return AddPartsTo(id);
+
+            if (!TryUpdateModel(viewModel)) return AddPartsTo(id);

             var partsToAdd = viewModel.PartSelections.Where(ps => ps.IsSelected).Select(ps => ps.PartName);
             foreach (var partToAdd in partsToAdd) {
                 _contentDefinitionService.AddPartToType(partToAdd, typeViewModel.Name);
+
                 Services.Notifier.Information(T("The \"{0}\" part has been added.", partToAdd));
             }

             if (!ModelState.IsValid) {
                 Services.TransactionManager.Cancel();
+
                 return AddPartsTo(id);
             }

-            return RedirectToAction("Edit", new {id});
+            return RedirectToAction("Edit", new { id });
         }

         public ActionResult RemovePartFrom(string id) {
@@ -332,12 +325,12 @@
             var typeViewModel = _contentDefinitionService.GetType(id);

             var viewModel = new RemovePartViewModel();
-            if (typeViewModel == null
-                || !TryUpdateModel(viewModel)
-                || !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
+            if (typeViewModel == null || !TryUpdateModel(viewModel) ||
+                !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
                 return HttpNotFound();

             viewModel.Type = typeViewModel;
+
             return View(viewModel);
         }

@@ -349,9 +342,8 @@
             var typeViewModel = _contentDefinitionService.GetType(id);

             var viewModel = new RemovePartViewModel();
-            if (typeViewModel == null
-                || !TryUpdateModel(viewModel)
-                || !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
+            if (typeViewModel == null || !TryUpdateModel(viewModel) ||
+                !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
                 return HttpNotFound();

             _contentDefinitionService.RemovePartFromType(viewModel.Name, typeViewModel.Name);
@@ -359,12 +351,13 @@
             if (!ModelState.IsValid) {
                 Services.TransactionManager.Cancel();
                 viewModel.Type = typeViewModel;
+
                 return View(viewModel);
             }

             Services.Notifier.Information(T("The \"{0}\" part has been removed.", viewModel.Name));

-            return RedirectToAction("Edit", new {id});
+            return RedirectToAction("Edit", new { id });
         }

         #endregion
@@ -374,7 +367,7 @@
         public ActionResult ListParts() {
             return View(new ListContentPartsViewModel {
                 // only user-defined parts (not code as they are not configurable)
-                Parts = _contentDefinitionService.GetParts(true/*metadataPartsOnly*/)
+                Parts = _contentDefinitionService.GetParts(metadataPartsOnly: true)
             });
         }

@@ -382,7 +375,7 @@
             if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to create a content part.")))
                 return new HttpUnauthorizedResult();

-            return View(new CreatePartViewModel { Name = suggestion.ToSafeName() });
+            return View(new CreatePartViewModel { Name = suggestion?.ToSafeName() });
         }

         [HttpPost, ActionName("CreatePart")]
@@ -390,20 +383,28 @@
             if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to create a content part.")))
                 return new HttpUnauthorizedResult();

-            if (_contentDefinitionManager.GetPartDefinition(viewModel.Name) != null)
-                ModelState.AddModelError("Name", T("Cannot add part named '{0}'. It already exists.", viewModel.Name).ToString());
-
-            if (!ModelState.IsValid)
-                return View(viewModel);
+
+            ValidateTechnicalName(viewModel.Name);
+
+            // Additional Technical Name validation.
+            if (!string.IsNullOrWhiteSpace(viewModel.Name) &&
+                _contentDefinitionManager.ListPartDefinitions().Any(t => string.Equals(t.Name.ToSafeName(), viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("Name", T("A content part with this technical name already exists.").Text);
+            }
+
+            if (!ModelState.IsValid) return View(viewModel);
+

             var partViewModel = _contentDefinitionService.AddPart(viewModel);

             if (partViewModel == null) {
                 Services.Notifier.Information(T("The content part could not be created."));
+
                 return View(viewModel);
             }

             Services.Notifier.Information(T("The \"{0}\" content part has been created.", partViewModel.Name));
+
             return RedirectToAction("EditPart", new { id = partViewModel.Name });
         }

@@ -413,8 +414,7 @@

             var partViewModel = _contentDefinitionService.GetPart(id);

-            if (partViewModel == null)
-                return HttpNotFound();
+            if (partViewModel == null) return HttpNotFound();

             return View(partViewModel);
         }
@@ -427,16 +427,15 @@

             var partViewModel = _contentDefinitionService.GetPart(id);

-            if (partViewModel == null)
-                return HttpNotFound();
-
-            if (!TryUpdateModel(partViewModel))
-                return View(partViewModel);
+            if (partViewModel == null) return HttpNotFound();
+
+            if (!TryUpdateModel(partViewModel)) return View(partViewModel);

             _contentDefinitionService.AlterPart(partViewModel, this);

             if (!ModelState.IsValid) {
                 Services.TransactionManager.Cancel();
+
                 return View(partViewModel);
             }

@@ -447,18 +446,16 @@

         [HttpPost, ActionName("EditPart")]
         [FormValueRequired("submit.Delete")]
-        public ActionResult DeletePart(string id)
-        {
+        public ActionResult DeletePart(string id) {
             if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to delete a content part.")))
                 return new HttpUnauthorizedResult();

             var partViewModel = _contentDefinitionService.GetPart(id);

-            if (partViewModel == null)
-                return HttpNotFound();
+            if (partViewModel == null) return HttpNotFound();

             _contentDefinitionService.RemovePart(id);
-
+
             Services.Notifier.Information(T("\"{0}\" has been removed.", partViewModel.DisplayName));

             return RedirectToAction("ListParts");
@@ -470,13 +467,13 @@

             var partViewModel = _contentDefinitionService.GetPart(id);

+            // If the specified Part doesn't exist, try to find a matching Type,
+            // where the implicit Part with the same name can be created to store Fields.
             if (partViewModel == null) {
-                //id passed in might be that of a type w/ no implicit field
                 var typeViewModel = _contentDefinitionService.GetType(id);
-                if (typeViewModel != null)
-                    partViewModel = new EditPartViewModel(new ContentPartDefinition(id));
-                else
-                    return HttpNotFound();
+
+                if (typeViewModel == null) return HttpNotFound();
+                else partViewModel = new EditPartViewModel(new ContentPartDefinition(id));
             }

             var viewModel = new AddFieldViewModel {
@@ -494,44 +491,32 @@

             var partViewModel = _contentDefinitionService.GetPart(id);
             var typeViewModel = _contentDefinitionService.GetType(id);
+
+            // If the specified Part doesn't exist, try to find a matching Type,
+            // where the implicit Part with the same name can be created to store Fields.
             if (partViewModel == null) {
-                // id passed in might be that of a type w/ no implicit field
-                if (typeViewModel != null) {
-                    partViewModel = new EditPartViewModel {Name = typeViewModel.Name};
-                    _contentDefinitionService.AddPart(new CreatePartViewModel {Name = partViewModel.Name});
+                if (typeViewModel == null) return HttpNotFound();
+                else {
+                    partViewModel = _contentDefinitionService.AddPart(new CreatePartViewModel { Name = typeViewModel.Name });
                     _contentDefinitionService.AddPartToType(partViewModel.Name, typeViewModel.Name);
                 }
-                else {
-                    return HttpNotFound();
-                }
-            }
-
-            viewModel.DisplayName = viewModel.DisplayName ?? String.Empty;
-            viewModel.DisplayName = viewModel.DisplayName.Trim();
-            viewModel.Name = viewModel.Name ?? String.Empty;
-
-            if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) {
-                ModelState.AddModelError("DisplayName", T("The Display Name name can't be empty.").ToString());
-            }
-
-            if (String.IsNullOrWhiteSpace(viewModel.Name)) {
-                ModelState.AddModelError("Name", T("The Technical Name can't be empty.").ToString());
-            }
-
-            if (_contentDefinitionService.GetPart(partViewModel.Name).Fields.Any(t => String.Equals(t.Name.Trim(), viewModel.Name.Trim(), StringComparison.OrdinalIgnoreCase))) {
-                ModelState.AddModelError("Name", T("A field with the same name already exists.").ToString());
-            }
-
-            if (!String.IsNullOrWhiteSpace(viewModel.Name) && !viewModel.Name[0].IsLetter()) {
-                ModelState.AddModelError("Name", T("The technical name must start with a letter.").ToString());
-            }
-
-            if (!String.Equals(viewModel.Name, viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase)) {
-                ModelState.AddModelError("Name", T("The technical name contains invalid characters.").ToString());
-            }
-
-            if (_contentDefinitionService.GetPart(partViewModel.Name).Fields.Any(t => String.Equals(t.DisplayName.Trim(), Convert.ToString(viewModel.DisplayName).Trim(), StringComparison.OrdinalIgnoreCase))) {
-                ModelState.AddModelError("DisplayName", T("A field with the same Display Name already exists.").ToString());
+            }
+
+
+            ValidateDisplayName(viewModel.DisplayName);
+
+            // Additional Display Name validation.
+            if (!string.IsNullOrWhiteSpace(viewModel.DisplayName) &&
+                partViewModel.Fields.Any(t => string.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("DisplayName", T("A content field with this display name already exists.").Text);
+            }
+
+            ValidateTechnicalName(viewModel.Name);
+
+            // Additional Technical Name validation.
+            if (!string.IsNullOrWhiteSpace(viewModel.Name) &&
+                partViewModel.Fields.Any(t => string.Equals(t.Name.ToSafeName(), viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("Name", T("A content field with this technical name already exists.").Text);
             }

             if (!ModelState.IsValid) {
@@ -543,22 +528,20 @@
                 return View(viewModel);
             }

+
             try {
                 _contentDefinitionService.AddFieldToPart(viewModel.Name, viewModel.DisplayName, viewModel.FieldTypeName, partViewModel.Name);
             }
             catch (Exception ex) {
                 Services.Notifier.Information(T("The \"{0}\" field was not added. {1}", viewModel.DisplayName, ex.Message));
                 Services.TransactionManager.Cancel();
+
                 return AddFieldTo(id);
             }

             Services.Notifier.Information(T("The \"{0}\" field has been added.", viewModel.DisplayName));

-            if (typeViewModel != null) {
-                return RedirectToAction("Edit", new {id});
-            }
-
-            return RedirectToAction("EditPart", new { id });
+            return typeViewModel == null ? RedirectToAction("EditPart", new { id }) : RedirectToAction("Edit", new { id });
         }

         public ActionResult EditField(string id, string name) {
@@ -567,15 +550,11 @@

             var partViewModel = _contentDefinitionService.GetPart(id);

-            if (partViewModel == null) {
-                return HttpNotFound();
-            }
+            if (partViewModel == null) return HttpNotFound();

             var fieldViewModel = partViewModel.Fields.FirstOrDefault(x => x.Name == name);

-            if(fieldViewModel == null) {
-                return HttpNotFound();
-            }
+            if (fieldViewModel == null) return HttpNotFound();

             var viewModel = new EditFieldNameViewModel {
                 Name = fieldViewModel.Name,
@@ -591,50 +570,35 @@
             if (!Services.Authorizer.Authorize(Permissions.EditContentTypes, T("Not allowed to edit a content type.")))
                 return new HttpUnauthorizedResult();

-            if (viewModel == null)
-                return HttpNotFound();
-
-            var partViewModel = _contentDefinitionService.GetPart(id);
-
-            if (partViewModel == null) {
-                return HttpNotFound();
-            }
-
-            // prevent null reference exception in validation
-            viewModel.DisplayName = viewModel.DisplayName ?? String.Empty;
-
-            // remove extra spaces
-            viewModel.DisplayName = viewModel.DisplayName.Trim();
-
-            if (String.IsNullOrWhiteSpace(viewModel.DisplayName)) {
-                ModelState.AddModelError("DisplayName", T("The Display Name name can't be empty.").ToString());
-            }
-
-            if (_contentDefinitionService.GetPart(partViewModel.Name).Fields.Any(t => t.Name != viewModel.Name && String.Equals(t.DisplayName.Trim(), viewModel.DisplayName.Trim(), StringComparison.OrdinalIgnoreCase))) {
-                ModelState.AddModelError("DisplayName", T("A field with the same Display Name already exists.").ToString());
-            }
-
-            if (!ModelState.IsValid) {
-                return View(viewModel);
-            }
+            if (viewModel == null) return HttpNotFound();
+
+            var partViewModel = _contentDefinitionService.GetPart(id);
+
+            if (partViewModel == null) return HttpNotFound();
+
+
+            ValidateTechnicalName(viewModel.Name);
+
+            // Additional Technical Name validation.
+            if (!string.IsNullOrWhiteSpace(viewModel.Name) &&
+                partViewModel.Fields.Any(t => string.Equals(t.Name.ToSafeName(), viewModel.Name.ToSafeName(), StringComparison.OrdinalIgnoreCase))) {
+                ModelState.AddModelError("Name", T("A content field with this technical name already exists.").Text);
+            }
+
+            if (!ModelState.IsValid) return View(viewModel);
+

             var field = _contentDefinitionManager.GetPartDefinition(id).Fields.FirstOrDefault(x => x.Name == viewModel.Name);

-            if(field == null) {
-                return HttpNotFound();
-            }
+            if (field == null) return HttpNotFound();

             _contentDefinitionService.AlterField(partViewModel, viewModel);

             Services.Notifier.Information(T("Display name changed to {0}.", viewModel.DisplayName));

-            // redirect to the type editor if a type exists with this name
-            var typeViewModel = _contentDefinitionService.GetType(id);
-            if (typeViewModel != null) {
-                return RedirectToAction("Edit", new { id });
-            }
-
-            return RedirectToAction("EditPart", new { id });
+            // Redirect to the type editor if a type exists with this name.
+            return _contentDefinitionService.GetType(id) == null ?
+                RedirectToAction("EditPart", new { id }) : RedirectToAction("Edit", new { id });
         }

         public ActionResult RemoveFieldFrom(string id) {
@@ -644,12 +608,13 @@
             var partViewModel = _contentDefinitionService.GetPart(id);

             var viewModel = new RemoveFieldViewModel();
-            if (partViewModel == null
-                || !TryUpdateModel(viewModel)
-                || !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
+
+            if (partViewModel == null || !TryUpdateModel(viewModel) ||
+                !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
                 return HttpNotFound();

             viewModel.Part = partViewModel;
+
             return View(viewModel);
         }

@@ -661,9 +626,8 @@
             var partViewModel = _contentDefinitionService.GetPart(id);

             var viewModel = new RemoveFieldViewModel();
-            if (partViewModel == null
-                || !TryUpdateModel(viewModel)
-                || !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
+            if (partViewModel == null || !TryUpdateModel(viewModel) ||
+                !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
                 return HttpNotFound();

             _contentDefinitionService.RemoveFieldFromPart(viewModel.Name, partViewModel.Name);
@@ -671,21 +635,49 @@
             if (!ModelState.IsValid) {
                 Services.TransactionManager.Cancel();
                 viewModel.Part = partViewModel;
+
                 return View(viewModel);
             }

             Services.Notifier.Information(T("The \"{0}\" field has been removed.", viewModel.Name));

-            if (_contentDefinitionService.GetType(id) != null)
-                return RedirectToAction("Edit", new { id });
-
-            return RedirectToAction("EditPart", new { id });
+            // Redirect to the type editor if a type exists with this name.
+            return _contentDefinitionService.GetType(id) == null ?
+                RedirectToAction("EditPart", new { id }) : RedirectToAction("Edit", new { id });
         }

         #endregion

+
+        private void ValidateDisplayName(string displayName) {
+            if (string.IsNullOrWhiteSpace(displayName)) {
+                ModelState.AddModelError("DisplayName", T("The display name name can't be empty.").Text);
+            }
+            else if (!string.Equals(displayName, displayName.Trim(), StringComparison.OrdinalIgnoreCase)) {
+                ModelState.AddModelError("DisplayName", T("The display name starts and/or ends with whitespace characters.").Text);
+            }
+        }
+
+        private void ValidateTechnicalName(string technicalName) {
+            if (string.IsNullOrWhiteSpace(technicalName)) {
+                ModelState.AddModelError("Name", T("The technical name (Id) can't be empty.").Text);
+            }
+            else {
+                var safeTechnicalName = technicalName.ToSafeName();
+
+                if (!string.Equals(technicalName, safeTechnicalName, StringComparison.OrdinalIgnoreCase)) {
+                    ModelState.AddModelError("Name", T("The technical name contains invalid (non-alphanumeric) characters.").Text);
+                }
+
+                if (!safeTechnicalName.FirstOrDefault().IsLetter()) {
+                    ModelState.AddModelError("Name", T("The technical name must start with a letter.").Text);
+                }
+            }
+        }
+
+
         bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
-            return base.TryUpdateModel(model, prefix, includeProperties, excludeProperties);
+            return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
         }

         void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) {


If a column starts with a digit, prefix with _.

Patch thanks to jared.m.barboza.

Fixes issue 198.

git-svn-id: 1800f71f313d917366f95485fa960eed04b40598@1311 33146b6e-df29-0410-a1ca-39be37fb9416

--- src/DbLinq/Vendor/Implementation/SchemaLoader.cs
+++ src/DbLinq/Vendor/Implementation/SchemaLoader.cs
@@ -38,6 +38,7 @@
 using DbLinq.Factory;
 using DbLinq.Schema;
 using DbLinq.Schema.Dbml;
+using System.Text.RegularExpressions;

 namespace DbLinq.Vendor.Implementation
 {
@@ -237,6 +238,8 @@
             return CreateTableName(dbTableName, dbSchema, nameAliases, nameFormat, GetExtraction(dbTableName));
         }

+        Regex startsWithNumber = new Regex(@"^\d", RegexOptions.Compiled);
+
         /// <summary>
         /// Creates the name of the column.
         /// </summary>
@@ -265,6 +268,10 @@
             var tableName = CreateTableName(dbTableName, dbSchema, nameAliases, nameFormat);
             if (columnName.PropertyName == tableName.ClassName)
                 columnName.PropertyName = columnName.PropertyName + "1";
+
+            if (startsWithNumber.IsMatch(columnName.PropertyName))
+                columnName.PropertyName = "_" + columnName.PropertyName;
+
             columnName.DbName = dbColumnName;
             return columnName;
         }


1954.1

--- src/PixelFarm/PixelFarm.DrawingGL/DrawingGL/RenderSuface/GLRenderSurface.cs
+++ src/PixelFarm/PixelFarm.DrawingGL/DrawingGL/RenderSuface/GLRenderSurface.cs
@@ -296,11 +296,9 @@

             if (_originKind == RenderSurfaceOrientation.LeftTop)
             {
-                if (!_shareRes.IsFilpAndPulldownHint)
-                {
-                    _shareRes.OrthoView = _rendersx._orthoFlipY_and_PullDown;
-                    _shareRes.IsFilpAndPulldownHint = true;
-                }
+                //essential here
+                _shareRes.OrthoView = _rendersx._orthoFlipY_and_PullDown;
+                _shareRes.IsFilpAndPulldownHint = true;
             }
             else
             {


Fix the loading ADFS metadata

Fix the loading ADFS metadata

--- src/DrWatson.Adfs.Metadata/AdfsMetadataLoader.cs
+++ src/DrWatson.Adfs.Metadata/AdfsMetadataLoader.cs
@@ -17,12 +17,7 @@
         public AdfsMetadataLoader(string adfsBaseUrl)
         {
             Loader = () =>
-            {
-                using (var client = new HttpClient())
-                {
-                    return client.GetStringAsync(GetMetadataUrl(adfsBaseUrl));
-                }
-            };
+                new HttpClient().GetStringAsync(GetMetadataUrl(adfsBaseUrl));
         }

         public AdfsMetadataLoader(Func<Task<string>> loader)


CON-663-add-colons

--- src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/VacancyStatus.cshtml
+++ src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/VacancyStatus.cshtml
@@ -17,17 +17,17 @@

@vacancy.TrainingTitle

VAC @vacancy.Reference

-
Closing date

+
Closing date:

@(vacancy.ClosingDate.HasValue ? vacancy.ClosingDate.Value.ToGdsFormat() : "-")

     @{ if (numberOfApplications.HasValue)
         {
-
Applications

+
Applications:

@numberOfApplications.Value

         }
     }

-
Status

+
Status:

@vacancy.Status

@actionLinkText


update public API with ShouldSatisfyAllConditions<T> methods

--- src/Shouldly.Tests/ConventionTests/ApprovePublicAPI.ShouldlyApi.approved.cs
+++ src/Shouldly.Tests/ConventionTests/ApprovePublicAPI.ShouldlyApi.approved.cs
@@ -506,6 +506,9 @@
     [Shouldly.ShouldlyMethodsAttribute()]
     public class static ShouldSatisfyAllConditionsTestExtensions
     {
+        public static void ShouldSatisfyAllConditions<T>(this T actual, params System.Action<>[] conditions) { }
+        public static void ShouldSatisfyAllConditions<T>(this T actual, string customMessage, params System.Action<>[] conditions) { }
+        public static void ShouldSatisfyAllConditions<T>(this T actual, System.Func<string> customMessage, params System.Action<>[] conditions) { }
         public static void ShouldSatisfyAllConditions(this object actual, params System.Action[] conditions) { }
         public static void ShouldSatisfyAllConditions(this object actual, string customMessage, params System.Action[] conditions) { }
         public static void ShouldSatisfyAllConditions(this object actual, System.Func<string> customMessage, params System.Action[] conditions) { }


split attribute test into two

split attribute test into two

--- src/EnumerableToDataReader.Test/TestAttribute.cs
+++ src/EnumerableToDataReader.Test/TestAttribute.cs
@@ -26,6 +26,18 @@
                 {
                     Assert.Equal(2, dr.FieldCount);
                     Assert.Equal(cnt, dr.GetInt32(dr.GetOrdinal("a")));
+                    cnt++;
+                }
+            }
+        }
+        [Fact]
+        public void TestCustomName()
+        {
+            using (var dr = Enumerable.Range(0, 10).Select(i => new AttributeTestClass() { a = i, b = i.ToString(), c = i }).AsDataReader())
+            {
+                int cnt = 0;
+                while (dr.Read())
+                {
                     Assert.Equal((double)cnt, dr.GetDouble(dr.GetOrdinal("x")));
                     cnt++;
                 }


Avoiding tags

Avoiding tags

--- src/GitVersionCore/BuildServers/GitHubActions.cs
+++ src/GitVersionCore/BuildServers/GitHubActions.cs
@@ -50,8 +50,13 @@
             var value = Environment.GetEnvironmentVariable("GITHUB_REF");
             if (!string.IsNullOrWhiteSpace(value))
             {
-                value = value.Substring("refs/heads/".Length);
-                return value;
+                const string refsHeads = "refs/heads/";
+
+                if (value.StartsWith(refsHeads))
+                {
+                    value = value.Substring(refsHeads.Length);
+                    return value;
+                }
             }

             return base.GetCurrentBranch(usingDynamicRepos);


style(core.utilities): change test names

--- tests/DotNetCore.Core.UnitTests/Utilities/ExceptionUtilsTests.cs
+++ tests/DotNetCore.Core.UnitTests/Utilities/ExceptionUtilsTests.cs
@@ -9,7 +9,7 @@
     {
         [TestCase(null, null)]
         [TestCase("paramName", "message")]
-        public void ThrowIfNull_ThrowsNull(string paramName, string message)
+        public void ThrowIfNull_ThrowsWhenNull(string paramName, string message)
         {
             string nullThing = null;

@@ -18,7 +18,7 @@

         [TestCase(null, null)]
         [TestCase("paramName", "message")]
-        public void ThrowIfNull_DoesNotThrow(string paramName, string message)
+        public void ThrowIfNull_DoesNotThrowWhenNotNull(string paramName, string message)
         {
             string notNullThing = "im not null";


Fix XSD tests broken by recent change (#21475)

--- src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Add_URL.cs
+++ src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Add_URL.cs
@@ -271,7 +271,7 @@

         //====================TFS_298991 XMLSchemaSet.Compile of an XSD containing with a large number of elements results in a System.StackOverflow error

-        private void GenerateSequenceXsdFile(int size, string xsdFileName)
+        private string GenerateSequenceXsdFile(int size, string xsdFileName)
         {
             // generate the xsd file, the file is some thing like this
             //-------------------------------------------------------
@@ -291,36 +291,40 @@
             //</xsd:element>
             //</xsd:schema>
             //------------------------------------------------------
-            StreamWriter sw = new StreamWriter(new FileStream(Path.Combine(TestDirectory, xsdFileName), FileMode.Create, FileAccess.Write));
-
-            string head = @"<?xml version='1.0'?>
-            <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >";
-
-            string body = @" <xsd:element name='myFields'>
-                              <xsd:complexType>
-                               <xsd:sequence>";
-
-            string end = @"    </xsd:sequence>
-                              </xsd:complexType>
-                            </xsd:element>
-                          </xsd:schema>";
-
-            sw.WriteLine(head);
-
-            for (int ii = 0; ii < size; ++ii)
-                sw.WriteLine("       <xsd:element name='field{0}' />", ii);
-
-            sw.WriteLine(body);
-
-            for (int ii = 0; ii < size; ++ii)
-                sw.WriteLine("  <xsd:element ref='field{0}' minOccurs='0' />", ii);
-
-            sw.WriteLine(end);
-
-            sw.Dispose();
-        }
-
-        private void GenerateChoiceXsdFile(int size, string xsdFileName)
+            string path = Path.Combine(TestDirectory, xsdFileName);
+
+            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
+            using (StreamWriter sw = new StreamWriter(fs))
+            {
+                string head = @"<?xml version='1.0'?>
+                <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >";
+
+                string body = @" <xsd:element name='myFields'>
+                                  <xsd:complexType>
+                                   <xsd:sequence>";
+
+                string end = @"    </xsd:sequence>
+                                  </xsd:complexType>
+                                </xsd:element>
+                              </xsd:schema>";
+
+                sw.WriteLine(head);
+
+                for (int ii = 0; ii < size; ++ii)
+                    sw.WriteLine("       <xsd:element name='field{0}' />", ii);
+
+                sw.WriteLine(body);
+
+                for (int ii = 0; ii < size; ++ii)
+                    sw.WriteLine("  <xsd:element ref='field{0}' minOccurs='0' />", ii);
+
+                sw.WriteLine(end);
+            }
+
+            return path;
+        }
+
+        private string GenerateChoiceXsdFile(int size, string xsdFileName)
         {
             // generate the xsd file, the file is some thing like this
             //-------------------------------------------------------
@@ -340,33 +344,37 @@
             //</xsd:element>
             //</xsd:schema>
             //------------------------------------------------------
-            StreamWriter sw = new StreamWriter(new FileStream(Path.Combine(TestDirectory, xsdFileName), FileMode.Create, FileAccess.Write));
-
-            string head = @"<?xml version='1.0'?>
-            <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >";
-
-            string body = @" <xsd:element name='myFields'>
-                              <xsd:complexType>
-                               <xsd:choice>";
-
-            string end = @"    </xsd:choice>
-                              </xsd:complexType>
-                            </xsd:element>
-                          </xsd:schema>";
-
-            sw.WriteLine(head);
-
-            for (int ii = 0; ii < size; ++ii)
-                sw.WriteLine("       <xsd:element name='field{0}' />", ii);
-
-            sw.WriteLine(body);
-
-            for (int ii = 0; ii < size; ++ii)
-                sw.WriteLine("  <xsd:element ref='field{0}' minOccurs='0' />", ii);
-
-            sw.WriteLine(end);
-
-            sw.Dispose();
+            string path = Path.Combine(TestDirectory, xsdFileName);
+
+            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
+            using (StreamWriter sw = new StreamWriter(fs))
+            {
+                string head = @"<?xml version='1.0'?>
+                <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >";
+
+                string body = @" <xsd:element name='myFields'>
+                                  <xsd:complexType>
+                                   <xsd:choice>";
+
+                string end = @"    </xsd:choice>
+                                  </xsd:complexType>
+                                </xsd:element>
+                              </xsd:schema>";
+
+                sw.WriteLine(head);
+
+                for (int ii = 0; ii < size; ++ii)
+                    sw.WriteLine("       <xsd:element name='field{0}' />", ii);
+
+                sw.WriteLine(body);
+
+                for (int ii = 0; ii < size; ++ii)
+                    sw.WriteLine("  <xsd:element ref='field{0}' minOccurs='0' />", ii);
+
+                sw.WriteLine(end);
+            }
+
+            return path;
         }

         public void verifyXsd(string file)
@@ -383,31 +391,25 @@
             }
         }

-        [OuterLoop]
         [Theory]
         [InlineData(1000, "1000s.xsd")]
         //[Variation(Desc = "Bug 298991 XMLSchemaSet.Compile cause StackOverflow - Sequence, 5000", Params = new object[] { 5000, "5000s.xsd" })]
         //[Variation(Desc = "Bug 298991 XMLSchemaSet.Compile cause StackOverflow - Sequence, 10000", Params = new object[] { 10000, "10000s.xsd" })]
         public void bug298991Sequence(int size, string xsdFileName)
         {
-            GenerateSequenceXsdFile(size, xsdFileName);
+            xsdFileName = GenerateSequenceXsdFile(size, xsdFileName);

             verifyXsd(xsdFileName);
-
-            return;
-        }
-
-        [OuterLoop]
+        }
+
         [Theory]
         [InlineData(5000, "5000c.xsd")]
         //[Variation(Desc = "Bug 298991 XMLSchemaSet.Compile cause StackOverflow - Choice, 5000", Params = new object[] { 5000, "5000c.xsd" })]
         public void bug298991Choice(int size, string xsdFileName)
         {
-            GenerateChoiceXsdFile(size, xsdFileName);
+            xsdFileName = GenerateChoiceXsdFile(size, xsdFileName);

             verifyXsd(xsdFileName);
-
-            return;
         }
     }
 }


remove unused field

remove unused field

--- src/HttpMock.Unit.Tests/RequestProcessorTests.cs
+++ src/HttpMock.Unit.Tests/RequestProcessorTests.cs
@@ -14,7 +14,6 @@
 		private IHttpResponseDelegate _httpResponseDelegate;
 		private IMatchingRule _ruleThatReturnsFirstHandler;
 		private IMatchingRule _ruleThatReturnsNoHandlers;
-		private IStubResponse _defaultResponse;
 		private RequestHandlerFactory _requestHandlerFactory;

 		[SetUp]
@@ -23,8 +22,6 @@
 			_requestHandlerFactory = new RequestHandlerFactory(_processor);
 			_dataProducer = MockRepository.GenerateStub<IDataProducer>();
 			_httpResponseDelegate = MockRepository.GenerateStub<IHttpResponseDelegate>();
-
-			_defaultResponse = MockRepository.GenerateStub<IStubResponse>();

 			_ruleThatReturnsFirstHandler = MockRepository.GenerateStub<IMatchingRule>();
 			_ruleThatReturnsFirstHandler.Stub(x => x.IsEndpointMatch(null, new HttpRequestHead())).IgnoreArguments().Return(true).Repeat.Once();


Fixed a problem with the renaming dialog. We can't just remove the file ending on the given new project name, because it could be company.domain.project.

--- src/VSX/Twainsoft.SolutionRenamer.VSPackage/GUI/RenameProjectDialog.xaml.cs
+++ src/VSX/Twainsoft.SolutionRenamer.VSPackage/GUI/RenameProjectDialog.xaml.cs
@@ -74,6 +74,7 @@
             // => That's not allowed!
             if (projectExists || currentProjectHierarchy != null)
             {
+                // ToDo: Change this to the WPF counterpart!
                 MessageBox.Show(
                     string.Format(
                         "The project '{0}' already exists in the solution respectively the file system. Please choose a different project name.",
@@ -94,7 +95,7 @@

         public string GetProjectName()
         {
-            return Path.GetFileNameWithoutExtension(ProjectName.Text.Trim());
+            return ProjectName.Text.Trim().Replace(".csproj", "");
         }

         private bool CheckProjects(string newProjectName)


added space input to XNA sample

added space input to XNA sample

--- src/ImGui.NET.SampleProgram.XNA/ImGuiRenderer.cs
+++ src/ImGui.NET.SampleProgram.XNA/ImGuiRenderer.cs
@@ -158,6 +158,7 @@
             _keys.Add(io.KeyMap[(int)ImGuiKey.Backspace] = (int)Keys.Back);
             _keys.Add(io.KeyMap[(int)ImGuiKey.Enter] = (int)Keys.Enter);
             _keys.Add(io.KeyMap[(int)ImGuiKey.Escape] = (int)Keys.Escape);
+            _keys.Add(io.KeyMap[(int)ImGuiKey.Space] = (int)Keys.Space);
             _keys.Add(io.KeyMap[(int)ImGuiKey.A] = (int)Keys.A);
             _keys.Add(io.KeyMap[(int)ImGuiKey.C] = (int)Keys.C);
             _keys.Add(io.KeyMap[(int)ImGuiKey.V] = (int)Keys.V);


Added ToPrioritizedDictionary for Lazy<T, TMetadata>.

--- src/Kephas.Core/Composition/CompositionHelper.cs
+++ src/Kephas.Core/Composition/CompositionHelper.cs
@@ -18,6 +18,7 @@
     using Kephas.Data;
     using Kephas.Diagnostics.Contracts;
     using Kephas.Resources;
+    using Kephas.Services;
     using Kephas.Services.Composition;

     /// <summary>
@@ -56,9 +57,138 @@
             Requires.NotNull(keyFunc, nameof(keyFunc));
             Requires.NotNull(valueFunc, nameof(valueFunc));

+            return serviceFactories
+                .Order()
+                .ToPrioritizedDictionary<TService, TServiceMetadata, TKey, TValue, IExportFactory<TService, TServiceMetadata>>(
+                    f => f.Metadata,
+                    keyFunc,
+                    valueFunc,
+                    keyComparer);
+        }
+
+        /// <summary>
+        /// Converts this collection of service factories to a dictionary.
+        /// </summary>
+        /// <remarks>
+        /// If, for the same key, there are multiple matching services, their override priority and
+        /// processing priority is considered, in this order. Further, if both of these priorities are
+        /// equal, then a <see cref="DuplicateKeyException"/> occurs.
+        /// </remarks>
+        /// <exception cref="DuplicateKeyException">Thrown when a Duplicate Key error condition occurs.</exception>
+        /// <typeparam name="TService">Type of the service.</typeparam>
+        /// <typeparam name="TServiceMetadata">Type of the service metadata.</typeparam>
+        /// <typeparam name="TKey">Type of the dictionary key.</typeparam>
+        /// <typeparam name="TValue">Type of the dictionary value.</typeparam>
+        /// <param name="serviceFactories">The service factories.</param>
+        /// <param name="keyFunc">The key function.</param>
+        /// <param name="valueFunc">The value function.</param>
+        /// <param name="keyComparer">Optional. The key comparer.</param>
+        /// <returns>
+        /// The given data converted to a IDictionary<TKey,TValue>.
+        /// </returns>
+        public static IDictionary<TKey, TValue> ToPrioritizedDictionary<TService, TServiceMetadata, TKey, TValue>(
+            this IEnumerable<Lazy<TService, TServiceMetadata>> serviceFactories,
+            Func<Lazy<TService, TServiceMetadata>, TKey> keyFunc,
+            Func<Lazy<TService, TServiceMetadata>, TValue> valueFunc,
+            IEqualityComparer<TKey>? keyComparer = null)
+            where TServiceMetadata : AppServiceMetadata
+        {
+            Requires.NotNull(serviceFactories, nameof(serviceFactories));
+            Requires.NotNull(keyFunc, nameof(keyFunc));
+            Requires.NotNull(valueFunc, nameof(valueFunc));
+
+            return serviceFactories
+                .Order()
+                .ToPrioritizedDictionary<TService, TServiceMetadata, TKey, TValue, Lazy<TService, TServiceMetadata>>(
+                    f => f.Metadata,
+                    keyFunc,
+                    valueFunc,
+                    keyComparer);
+        }
+
+        /// <summary>
+        /// Converts this collection of service factories to a dictionary.
+        /// </summary>
+        /// <remarks>
+        /// If, for the same key, there are multiple matching services, their override priority and
+        /// processing priority is considered, in this order. Further, if both of these priorities are
+        /// equal, then a <see cref="DuplicateKeyException"/> occurs.
+        /// </remarks>
+        /// <typeparam name="TService">Type of the service.</typeparam>
+        /// <typeparam name="TServiceMetadata">Type of the service metadata.</typeparam>
+        /// <typeparam name="TKey">Type of the key.</typeparam>
+        /// <param name="serviceFactories">The service factories.</param>
+        /// <param name="keyFunc">The key function.</param>
+        /// <param name="keyComparer">Optional. The key comparer.</param>
+        /// <returns>
+        /// The given data converted to an IDictionary<TKey,TValue>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static IDictionary<TKey, IExportFactory<TService, TServiceMetadata>> ToPrioritizedDictionary<TService, TServiceMetadata, TKey>(
+            this IEnumerable<IExportFactory<TService, TServiceMetadata>> serviceFactories,
+            Func<IExportFactory<TService, TServiceMetadata>, TKey> keyFunc,
+            IEqualityComparer<TKey>? keyComparer = null)
+            where TServiceMetadata : AppServiceMetadata
+        {
+            return serviceFactories
+                .Order()
+                .ToPrioritizedDictionary<TService, TServiceMetadata, TKey, IExportFactory<TService, TServiceMetadata>, IExportFactory<TService, TServiceMetadata>>(
+                    f => f.Metadata,
+                    keyFunc,
+                    f => f,
+                    keyComparer);
+            return serviceFactories.ToPrioritizedDictionary(keyFunc, f => f, keyComparer);
+        }
+
+        /// <summary>
+        /// Converts this collection of service factories to a dictionary.
+        /// </summary>
+        /// <remarks>
+        /// If, for the same key, there are multiple matching services, their override priority and
+        /// processing priority is considered, in this order. Further, if both of these priorities are
+        /// equal, then a <see cref="DuplicateKeyException"/> occurs.
+        /// </remarks>
+        /// <typeparam name="TService">Type of the service.</typeparam>
+        /// <typeparam name="TServiceMetadata">Type of the service metadata.</typeparam>
+        /// <typeparam name="TKey">Type of the key.</typeparam>
+        /// <param name="serviceFactories">The service factories.</param>
+        /// <param name="keyFunc">The key function.</param>
+        /// <param name="keyComparer">Optional. The key comparer.</param>
+        /// <returns>
+        /// The given data converted to an IDictionary<TKey,TValue>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static IDictionary<TKey, Lazy<TService, TServiceMetadata>> ToPrioritizedDictionary<TService, TServiceMetadata, TKey>(
+            this IEnumerable<Lazy<TService, TServiceMetadata>> serviceFactories,
+            Func<Lazy<TService, TServiceMetadata>, TKey> keyFunc,
+            IEqualityComparer<TKey>? keyComparer = null)
+            where TServiceMetadata : AppServiceMetadata
+        {
+            return serviceFactories
+                .Order()
+                .ToPrioritizedDictionary<TService, TServiceMetadata, TKey, Lazy<TService, TServiceMetadata>, Lazy<TService, TServiceMetadata>>(
+                    f => f.Metadata,
+                    keyFunc,
+                    f => f,
+                    keyComparer);
+        }
+
+        private static IDictionary<TKey, TValue> ToPrioritizedDictionary<TService, TServiceMetadata, TKey, TValue, T>(
+            this IEnumerable<T> serviceFactories,
+            Func<T, TServiceMetadata> metadataFunc,
+            Func<T, TKey> keyFunc,
+            Func<T, TValue> valueFunc,
+            IEqualityComparer<TKey>? keyComparer = null)
+            where TServiceMetadata : AppServiceMetadata
+        {
+            Requires.NotNull(serviceFactories, nameof(serviceFactories));
+            Requires.NotNull(keyFunc, nameof(keyFunc));
+            Requires.NotNull(valueFunc, nameof(valueFunc));
+
             var dictionary = keyComparer == null ? new Dictionary<TKey, TValue>() : new Dictionary<TKey, TValue>(keyComparer);

-            var factoryProjection = serviceFactories.Select(f => (key: keyFunc(f), meta: f.Metadata, factory: f));
+            var factoryProjection = serviceFactories
+                .Select(f => (key: keyFunc(f), meta: metadataFunc(f), factory: f));
             var orderedFactories = (keyComparer == null
                                        ? factoryProjection.GroupBy(e => e.key)
                                        : factoryProjection.GroupBy(e => e.key, e => e, keyComparer))
@@ -74,7 +204,6 @@
                 }
                 else
                 {
-                    group = group.OrderBy(e => e.meta.OverridePriority).ThenBy(e => e.meta.ProcessingPriority).ToList();
                     var g0meta = group[0].meta;
                     var g1meta = group[1].meta;
                     if (g0meta.OverridePriority == g1meta.OverridePriority
@@ -89,32 +218,5 @@

             return dictionary;
         }
-
-        /// <summary>
-        /// Converts this collection of service factories to a dictionary.
-        /// </summary>
-        /// <remarks>
-        /// If, for the same key, there are multiple matching services, their override priority and
-        /// processing priority is considered, in this order. Further, if both of these priorities are
-        /// equal, then a <see cref="DuplicateKeyException"/> occurs.
-        /// </remarks>
-        /// <typeparam name="TService">Type of the service.</typeparam>
-        /// <typeparam name="TServiceMetadata">Type of the service metadata.</typeparam>
-        /// <typeparam name="TKey">Type of the key.</typeparam>
-        /// <param name="serviceFactories">The service factories.</param>
-        /// <param name="keyFunc">The key function.</param>
-        /// <param name="keyComparer">Optional. The key comparer.</param>
-        /// <returns>
-        /// The given data converted to an IDictionary<TKey,TValue>.
-        /// </returns>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static IDictionary<TKey, IExportFactory<TService, TServiceMetadata>> ToPrioritizedDictionary<TService, TServiceMetadata, TKey>(
-            this IEnumerable<IExportFactory<TService, TServiceMetadata>> serviceFactories,
-            Func<IExportFactory<TService, TServiceMetadata>, TKey> keyFunc,
-            IEqualityComparer<TKey>? keyComparer = null)
-            where TServiceMetadata : AppServiceMetadata
-        {
-            return serviceFactories.ToPrioritizedDictionary(keyFunc, f => f, keyComparer);
-        }
     }
 }


Ignore extra elements in project record

Ignore extra elements in project record

Depending on how we initialize the Mongo connection, it may or may not
run the code that sets BsonIgnoreExtraElements on MongoProjectRecord
instances. Since this was causing some trouble, we'll just set this
attribute explicitly.

--- src/LfMerge/MongoConnector/MongoProjectRecord.cs
+++ src/LfMerge/MongoConnector/MongoProjectRecord.cs
@@ -3,10 +3,12 @@
 using System;
 using MongoDB.Driver;
 using MongoDB.Bson;
+using MongoDB.Bson.Serialization.Attributes;
 using LfMerge.LanguageForge.Config;

 namespace LfMerge
 {
+	[BsonIgnoreExtraElements]
 	public class MongoProjectRecord
 	{
 		public const string ProjectsCollectionName = "projects";


Implementation of the mouse toggle event

--- src/Libraries/jQuery/jQuery.Core/jQueryObject.cs
+++ src/Libraries/jQuery/jQuery.Core/jQueryObject.cs
@@ -3433,6 +3433,17 @@
         }

         /// <summary>
+        /// Bind two or more handlers to the matched elements, to be executed on alternate clicks.
+        /// </summary>
+        /// <param name="evenEventHandler">A function to execute every even time the element is clicked.</param>
+        /// <param name="oddEventHandler">A function to execute every odd time the element is clicked.</param>
+        /// <param name="eventHandlers">Additional handlers to cycle through after clicks.</param>
+        /// <returns>The current jQueryObject.</returns>
+        public jQueryObject Toggle(jQueryEventHandler evenEventHandler, jQueryEventHandler oddEventHandler, params jQueryEventHandler[] eventHandlers) {
+            return null;
+        }
+
+        /// <summary>
         /// Toggles the specified class from each of the set of matched elements.
         /// </summary>
         /// <param name="className">The class to toggle.</param>


Rubrica - Fix ricerca

Rubrica - Fix ricerca

--- src/backend/SO115App.Persistence.MongoDB/GestioneRubrica/Enti/GetRubrica.cs
+++ src/backend/SO115App.Persistence.MongoDB/GestioneRubrica/Enti/GetRubrica.cs
@@ -65,11 +65,12 @@

             var lstCodiciPin = listaPin.Select(c => c.Codice).ToList();

-            var lstEnti = _dbContext.RubricaCollection.Find(c => lstCodiciPin.Distinct().Contains(c.CodSede)).ToList()
-                .Where(c => c.Descrizione.ToLower().Contains(text) || c.Email.ToLower().Contains(text) || c.Indirizzo.ToLower().Contains(text)).ToList();
+            var lstEnti = _dbContext.RubricaCollection.Find(c => lstCodiciPin.Distinct().Contains(c.CodSede)).ToList();
+
+            var listaFiltrata =  lstEnti.Where(c => c.Descrizione.ToLower().Contains(text)).ToList();

             //GESTIONE RICORSIVITA'
-            var result = FiltraByRicorsività(listaPin, lstEnti);
+            var result = FiltraByRicorsività(listaPin, listaFiltrata);

             //RECUPERO LE CATEGORIE
             var lstCodiciCategorie = result.Select(c => c.CodCategoria.ToString()).Distinct().ToArray();


Version 0.9.0

Version 0.9.0

--- src/MasterAssemblyInfo.cs
+++ src/MasterAssemblyInfo.cs
@@ -4,6 +4,6 @@
 [assembly: AssemblyCompany("Anil Mujagić")]
 [assembly: AssemblyCopyright("© Anil Mujagić")]

-[assembly: AssemblyVersion("0.8.1.0")]
-[assembly: AssemblyFileVersion("0.8.1.0")]
-[assembly: AssemblyInformationalVersion("0.8.1")]
+[assembly: AssemblyVersion("0.9.0.0")]
+[assembly: AssemblyFileVersion("0.9.0.0")]
+[assembly: AssemblyInformationalVersion("0.9.0")]


Comment out the program provider class

Comment out the program provider class

--- src/MIDebugEngine/AD7.Impl/AD7ProgramProvider.cs
+++ src/MIDebugEngine/AD7.Impl/AD7ProgramProvider.cs
@@ -1,90 +1,89 @@
 // Copyright (c) Microsoft. All rights reserved.
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.

-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Runtime.InteropServices;
-using Microsoft.VisualStudio.Debugger.Interop;
-using System.Diagnostics;
+//***************************************************************************
+// The MI Engine doesn't currently need a program provider, as we don't support the attach to process dialog. But
+// keep this code arround as someday we will likely want to.
+//***************************************************************************

-namespace Microsoft.MIDebugEngine
-{
-    // This class implments IDebugProgramProvider2.
-    // This registered interface allows the session debug manager (SDM) to obtain information about programs
-    // that have been "published" through the IDebugProgramPublisher2 interface.
-    [ComVisible(true)]
-    [Guid("af721e28-535b-47e4-be3b-6ffc4621aa96")]
-    public class AD7ProgramProvider : IDebugProgramProvider2
-    {
-        public AD7ProgramProvider()
-        {
-        }
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using System.Runtime.InteropServices;
+//using System.Diagnostics;

-        #region IDebugProgramProvider2 Members
+//namespace Microsoft.MIDebugEngine
+//{
+//    [ComVisible(true)]
+//    [Guid("af721e28-535b-47e4-be3b-6ffc4621aa96")]
+//    public class AD7ProgramProvider : IDebugProgramProvider2
+//    {
+//        public AD7ProgramProvider()
+//        {
+//        }

-        // Obtains information about programs running, filtered in a variety of ways.
-        int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] processArray)
-        {
-            processArray[0] = new PROVIDER_PROCESS_DATA();
+//        #region IDebugProgramProvider2 Members

-            Debug.Fail("Will this be called?");
+//        // Obtains information about programs running, filtered in a variety of ways.
+//        int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] processArray)
+//        {
+//            processArray[0] = new PROVIDER_PROCESS_DATA();

-            if ((Flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0)
-            {
-                // The debugger is asking the engine to return the program nodes it can debug. The
-                // sample engine claims that it can debug all processes, and returns exsactly one
-                // program node for each process. A full-featured debugger may wish to examine the
-                // target process and determine if it understands how to debug it.
+//            if ((Flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0)
+//            {
+//                // The debugger is asking the engine to return the program nodes it can debug. The
+//                // sample engine claims that it can debug all processes, and returns exsactly one
+//                // program node for each process. A full-featured debugger may wish to examine the
+//                // target process and determine if it understands how to debug it.

-                IDebugProgramNode2 node = (IDebugProgramNode2)(new AD7ProgramNode(ProcessId));
+//                IDebugProgramNode2 node = (IDebugProgramNode2)(new AD7ProgramNode(ProcessId));

-                IntPtr[] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) };
+//                IntPtr[] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) };

-                IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length);
-                Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length);
+//                IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length);
+//                Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length);

-                processArray[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES;
-                processArray[0].ProgramNodes.Members = destinationArray;
-                processArray[0].ProgramNodes.dwCount = (uint)programNodes.Length;
+//                processArray[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES;
+//                processArray[0].ProgramNodes.Members = destinationArray;
+//                processArray[0].ProgramNodes.dwCount = (uint)programNodes.Length;

-                return Constants.S_OK;
-            }
+//                return Constants.S_OK;
+//            }

-            return Constants.S_FALSE;
-        }
+//            return Constants.S_FALSE;
+//        }

-        // Gets a program node, given a specific process ID.
-        int IDebugProgramProvider2.GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 programNode)
-        {
-            // This method is used for Just-In-Time debugging support, which this program provider does not support
-            programNode = null;
-            return Constants.E_NOTIMPL;
-        }
+//        // Gets a program node, given a specific process ID.
+//        int IDebugProgramProvider2.GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 programNode)
+//        {
+//            // This method is used for Just-In-Time debugging support, which this program provider does not support
+//            programNode = null;
+//            return Constants.E_NOTIMPL;
+//        }

-        // Establishes a locale for any language-specific resources needed by the DE. This engine only supports Enu.
-        int IDebugProgramProvider2.SetLocale(ushort wLangID)
-        {
-            return Constants.S_OK;
-        }
+//        // Establishes a locale for any language-specific resources needed by the DE. This engine only supports Enu.
+//        int IDebugProgramProvider2.SetLocale(ushort wLangID)
+//        {
+//            return Constants.S_OK;
+//        }

-        // Establishes a callback to watch for provider events associated with specific kinds of processes
-        int IDebugProgramProvider2.WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 ad7EventCallback)
-        {
-            // The sample debug engine is a native debugger, and can therefore always provide a program node
-            // in GetProviderProcessData. Non-native debuggers may wish to implement this method as a way
-            // of monitoring the process before code for their runtime starts. For example, if implementing a
-            // 'foo script' debug engine, one could attach to a process which might eventually run 'foo script'
-            // before this 'foo script' started.
-            //
-            // To implement this method, an engine would monitor the target process and call AddProgramNode
-            // when the target process started running code which was debuggable by the engine. The
-            // enum_PROVIDER_FLAGS.PFLAG_ATTACHED_TO_DEBUGGEE flag indicates if the request is to start
-            // or stop watching the process.
+//        // Establishes a callback to watch for provider events associated with specific kinds of processes
+//        int IDebugProgramProvider2.WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 ad7EventCallback)
+//        {
+//            // The sample debug engine is a native debugger, and can therefore always provide a program node
+//            // in GetProviderProcessData. Non-native debuggers may wish to implement this method as a way
+//            // of monitoring the process before code for their runtime starts. For example, if implementing a
+//            // 'foo script' debug engine, one could attach to a process which might eventually run 'foo script'
+//            // before this 'foo script' started.
+//            //
+//            // To implement this method, an engine would monitor the target process and call AddProgramNode
+//            // when the target process started running code which was debuggable by the engine. The
+//            // enum_PROVIDER_FLAGS.PFLAG_ATTACHED_TO_DEBUGGEE flag indicates if the request is to start
+//            // or stop watching the process.

-            return Constants.S_OK;
-        }
+//            return Constants.S_OK;
+//        }

-        #endregion
-    }
-}
+//        #endregion
+//    }
+//}


Both /api and /api/ works for API calls.

--- src/Main/Hadouken.Impl/Http/DefaultHttpServer.cs
+++ src/Main/Hadouken.Impl/Http/DefaultHttpServer.cs
@@ -111,7 +111,7 @@
                         var httpContext = new HttpContext(context);
                         string url = httpContext.Request.Url.AbsolutePath;

-                        var result = ((url == "/api" && httpContext.Request.QueryString["action"] != null) ? FindAndExecuteAction(httpContext) : CheckFileSystem(httpContext));
+                        var result = (((url == "/api" || url == "/api/") && httpContext.Request.QueryString["action"] != null) ? FindAndExecuteAction(httpContext) : CheckFileSystem(httpContext));

                         if (result != null)
                         {


Updated Assembly Info values - Description, Company, Copyright etc.

--- src/NLog.AzureStorage/Properties/AssemblyInfo.cs
+++ src/NLog.AzureStorage/Properties/AssemblyInfo.cs
@@ -6,11 +6,11 @@
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 [assembly: AssemblyTitle("NLog.AzureStorage")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Custom NLog Target for sending logs to Azure Storage Blobs")]
 [assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
+[assembly: AssemblyCompany("Nick Heppleston")]
 [assembly: AssemblyProduct("NLog.AzureStorage")]
-[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

@@ -32,5 +32,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.1.0.0")]
+[assembly: AssemblyFileVersion("0.1.0.0")]


Exracting "default instance" activation into private method

We'll add to this later, especially with the string stuff.

--- src/NanoBuilder/NanoBuilder/ParameterComposer.cs
+++ src/NanoBuilder/NanoBuilder/ParameterComposer.cs
@@ -20,6 +20,19 @@
       {
          _typeInspector = typeInspector;
          _constructorMatcher = constructorMatcher;
+      }
+
+      private TParameterType Default<TParameterType>()
+      {
+         var type = typeof( TParameterType );
+         TParameterType instance = default( TParameterType );
+
+         if ( type.IsInterface && _interfaceMapper != null )
+         {
+            instance = (TParameterType) _interfaceMapper.CreateForInterface( typeof( TParameterType ) );
+         }
+
+         return instance;
       }

       /// <summary>
@@ -58,13 +71,7 @@
       /// <returns>The same <see cref="ParameterComposer{T}"/>.</returns>
       public ParameterComposer<T> Skip<TParameterType>()
       {
-         var type = typeof( TParameterType );
-         TParameterType instance = default( TParameterType );
-
-         if ( type.IsInterface && _interfaceMapper != null )
-         {
-            instance = (TParameterType) _interfaceMapper.CreateForInterface( typeof( TParameterType ) );
-         }
+         TParameterType instance = Default<TParameterType>();

          _typeMap.Add( instance );


Muted toast notifications.

Muted toast notifications.

--- src/Neptunium/Core/UI/NepAppUIManagerNotifier.cs
+++ src/Neptunium/Core/UI/NepAppUIManagerNotifier.cs
@@ -19,6 +19,10 @@
             ToastContent content = new ToastContent()
             {
                 Launch = "now-playing",
+                Audio = new ToastAudio()
+                {
+                    Silent = true,
+                },
                 Visual = new ToastVisual()
                 {
                     BindingGeneric = new ToastBindingGeneric()


use case insensitive comparison when checking duplicate serial numbers

--- Server/src/HetsApi/Controllers/EquipmentController.cs
+++ Server/src/HetsApi/Controllers/EquipmentController.cs
@@ -761,7 +761,7 @@
                     .Include(x => x.LocalArea.ServiceArea.District)
                     .Include(x => x.Owner)
                     .Include(x => x.DistrictEquipmentType)
-                    .Where(x => x.SerialNumber == serialNumber &&
+                    .Where(x => x.SerialNumber.ToLower() == serialNumber.ToLower() &&
                                 x.EquipmentId != id &&
                                 x.DistrictEquipmentType.EquipmentTypeId == equipmentTypeId &&
                                 x.EquipmentStatusTypeId == statusId)
@@ -773,7 +773,7 @@
                     .Include(x => x.LocalArea.ServiceArea.District)
                     .Include(x => x.Owner)
                     .Include(x => x.DistrictEquipmentType)
-                    .Where(x => x.SerialNumber == serialNumber &&
+                    .Where(x => x.SerialNumber.ToLower() == serialNumber.ToLower() &&
                                 x.EquipmentId != id &&
                                 x.EquipmentStatusTypeId == statusId)
                     .ToList();


HETS-1003 - Add time popup takes a long time to load

--- Server/src/HetsApi/Controllers/EquipmentController.cs
+++ Server/src/HetsApi/Controllers/EquipmentController.cs
@@ -110,22 +110,30 @@
             int? statusId = StatusHelper.GetStatusId(HetEquipment.StatusApproved, "equipmentStatus", _context);
             if (statusId == null) return new ObjectResult(new HetsResponse("HETS-23", ErrorViewModel.GetDescription("HETS-23", _configuration)));

-            int? projectStatusId = StatusHelper.GetStatusId(HetProject.StatusActive, "projectStatus", _context);
-            if (projectStatusId == null) return new ObjectResult(new HetsResponse("HETS-23", ErrorViewModel.GetDescription("HETS-23", _configuration)));
+            // get fiscal year
+            HetDistrictStatus status = _context.HetDistrictStatus.AsNoTracking()
+                .First(x => x.DistrictId == districtId);
+
+            int? fiscalYear = status.CurrentFiscalYear;
+            if (fiscalYear == null) return new ObjectResult(new HetsResponse("HETS-01", ErrorViewModel.GetDescription("HETS-01", _configuration)));
+
+            // fiscal year in the status table stores the "start" of the year
+            DateTime fiscalYearStart = new DateTime((int)fiscalYear, 3, 31);

             // get all approved equipment for this district (and any projects they're associated with)
             IEnumerable<EquipmentLiteProjects> equipment = _context.HetRentalAgreement.AsNoTracking()
+                .Include(x => x.Project)
                 .Include(x => x.Equipment)
-                .Where(x => x.EquipmentId != null &&
-                            x.ProjectId != null &&
-                            x.Equipment.LocalArea.ServiceArea.DistrictId == districtId &&
+                .Where(x => x.Equipment.LocalArea.ServiceArea.DistrictId == districtId &&
                             x.Equipment.EquipmentStatusTypeId == statusId &&
-                            x.Project.ProjectStatusTypeId == projectStatusId)
-                .GroupBy(x => x.EquipmentId, (id, agreements) => new EquipmentLiteProjects
-                {
-                    EquipmentCode = agreements.First().Equipment.EquipmentCode,
-                    Id = id.Value,
-                    ProjectIds = agreements.Select(y => y.ProjectId.Value).ToList(),
+                            x.Project.DbCreateTimestamp > fiscalYearStart)
+                .Select(x => new EquipmentLiteProjects
+                {
+                    EquipmentCode = x.Equipment.EquipmentCode,
+                    Id = x.ProjectId ?? 0,
+                    ProjectIds = _context.HetProject
+                        .Where(y => y.ProjectId == x.ProjectId)
+                        .Select(y => y.ProjectId).ToList()
                 })
                 .OrderBy(x => x.EquipmentCode);


Delete _OrderRoundPanel_Partial.cshtml

Delete _OrderRoundPanel_Partial.cshtml

--- DemoProject/DemoProject/Views/Home/_OrderRoundPanel_Partial.cshtml
+++ DemoProject/DemoProject/Views/Home/_OrderRoundPanel_Partial.cshtml
@@ -1,26 +0,0 @@
-
-@model DemoProject.Models.Order
-
-@Html.DevExpress().RoundPanel(settings =>
-{
-    settings.Name = "OrderRoundPanel";
-    settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
-    settings.View = DevExpress.Web.View.Standard;
-    settings.AllowCollapsingByHeaderClick = true;
-    settings.ShowCollapseButton = true;
-    settings.EnableAnimation = false;
-    settings.HeaderText = "Order";
-
-    settings.Collapsed = false;
-
-    settings.CallbackRouteValues = new
-    {
-        Controller = "Home",
-        Action = "_OrderRoundPanel_Partial"
-
-            };
-    settings.SetContent(() =>
-    {
-               Html.RenderPartial("_OrderInfo_Partial", Model);
-    });
-}).GetHtml()


--- Demos/CSharpGL.Demos/13SimplexNoise/Form13SimplexNoise.FormLoad.cs
+++ Demos/CSharpGL.Demos/13SimplexNoise/Form13SimplexNoise.FormLoad.cs
@@ -47,7 +47,7 @@
             }
             {
                 var frmPropertyGrid = new FormProperyGrid();
-                frmPropertyGrid.DisplayObject(this);
+                frmPropertyGrid.DisplayObject(this.simplexNoiseRenderer);
                 frmPropertyGrid.Show();
             }
         }


simplex4


Votes virkar á Result Request

Votes virkar á Result Request

--- Skermstafir/Views/Shared/_SearchResultRequests.cshtml
+++ Skermstafir/Views/Shared/_SearchResultRequests.cshtml
@@ -30,7 +30,7 @@

-
%
00NI
+
% @request.Votes.Count

 				@request.Name


Fix again

Fix again

--- Source/Classic/Libs/ManagedIrbis/Source/MarcRecord.cs
+++ Source/Classic/Libs/ManagedIrbis/Source/MarcRecord.cs
@@ -316,6 +316,8 @@
             return Fields.GetSubFieldValue(tag, code);
         }

+#if CLASSIC || NETCORE
+
         /// <summary>
         /// Простейшее форматирование поля/подполя.
         /// </summary>
@@ -332,6 +334,8 @@

             return result;
         }
+
+#endif

         /// <summary>
         /// Assign database name to the record.


fixed bug when renaming on a main thread

--- Source/Driver/Refactoring/Passes/ThreadRefactoring.cs
+++ Source/Driver/Refactoring/Passes/ThreadRefactoring.cs
@@ -152,6 +152,10 @@
       {
         cmd.callee = cmd.callee + "$" + tid.Name;
       }
+      else if (thread.IsMain)
+      {
+        cmd.callee = cmd.callee + "$" + thread.Name;
+      }
       else
       {
         cmd.callee = cmd.callee + "$" + thread.Name + "$" + thread.Id.Name;
@@ -167,8 +171,18 @@
         if (callee != null && Utilities.ShouldAccessFunction(callee.Name))
         {
           this.ParseAndRenameNestedFunctions(thread, callee, tid);
-          (expr as IdentifierExpr).Name = (expr as IdentifierExpr).Name + "$" +
-            thread.Name + "$" + thread.Id.Name;
+
+          var suffix = "";
+          if (thread.IsMain)
+          {
+            suffix = "$" + thread.Name;
+          }
+          else
+          {
+            suffix = "$" + thread.Name + "$" + thread.Id.Name;
+          }
+
+          (expr as IdentifierExpr).Name = (expr as IdentifierExpr).Name + suffix;
         }
       }
     }
@@ -199,8 +213,18 @@
           }

           this.ParseAndRenameNestedFunctions(thread, callee, tid);
-          (rhs as IdentifierExpr).Name = (rhs as IdentifierExpr).Name + "$" +
-            thread.Name + "$" + thread.Id.Name;
+
+          var suffix = "";
+          if (thread.IsMain)
+          {
+            suffix = "$" + thread.Name;
+          }
+          else
+          {
+            suffix = "$" + thread.Name + "$" + thread.Id.Name;
+          }
+
+          (rhs as IdentifierExpr).Name = (rhs as IdentifierExpr).Name + suffix;
         }
       }
     }
@@ -256,8 +280,18 @@
             }

             this.ParseAndRenameNestedFunctions(thread, callee, tid);
-            (expr as IdentifierExpr).Name = (expr as IdentifierExpr).Name + "$" +
-              thread.Name + "$" + thread.Id.Name;
+
+            var suffix = "";
+            if (thread.IsMain)
+            {
+              suffix = "$" + thread.Name;
+            }
+            else
+            {
+              suffix = "$" + thread.Name + "$" + thread.Id.Name;
+            }
+
+            (expr as IdentifierExpr).Name = (expr as IdentifierExpr).Name + suffix;
           }
         }
       }


Delete organization when the owner is deleted implemented.

--- Source/Services/GoDrive.Services.Data/UsersService.cs
+++ Source/Services/GoDrive.Services.Data/UsersService.cs
@@ -75,6 +75,20 @@

             if (userToDelete != null)
             {
+                if (userToDelete.OrganizationId != null)
+                {
+                    var organizationToDelete = this.organizations
+                        .All()
+                        .Where(x => x.Id == userToDelete.OrganizationId)
+                        .FirstOrDefault();
+
+                    if (organizationToDelete != null)
+                    {
+                        this.organizations.Delete(organizationToDelete);
+                        this.organizations.Save();
+                    }
+                }
+
                 this.users.HardDelete(userToDelete);
                 this.users.Save();
             }


[Toolkit.Graphics] Fix instantiation of GeometryShader with StreamOutput on level 10.0

--- Source/Toolkit/SharpDX.Toolkit.Graphics/EffectPool.cs
+++ Source/Toolkit/SharpDX.Toolkit.Graphics/EffectPool.cs
@@ -197,12 +197,17 @@
                             if (soElements != null)
                             {
                                 // Calculate the strides
-                                var soStrides = new [] { 0, 0, 0, 0 };
+                                var soStrides = new List<int>();
                                 foreach (var streamOutputElement in soElements)
                                 {
+                                    for (int i = soStrides.Count; i < (streamOutputElement.Stream+1); i++)
+                                    {
+                                        soStrides.Add(0);
+                                    }
+
                                     soStrides[streamOutputElement.Stream] += streamOutputElement.ComponentCount * sizeof(float);
                                 }
-                                shader = new GeometryShader(graphicsDevice, bytecodeRaw, soElements, soStrides, soRasterizedStream);
+                                shader = new GeometryShader(graphicsDevice, bytecodeRaw, soElements, soStrides.ToArray(), soRasterizedStream);
                             }
                             else
                             {


Uncommented support for python 3.7 on windows

--- Source/UnrealEnginePython/UnrealEnginePython.Build.cs
+++ Source/UnrealEnginePython/UnrealEnginePython.Build.cs
@@ -18,7 +18,7 @@

     private string[] windowsKnownPaths =
     {
-       // "C:/Program Files/Python37",
+        "C:/Program Files/Python37",
         "C:/Program Files/Python36",
         "C:/Program Files/Python35",
         "C:/Python27",


Update resumable_upload link

Update resumable_upload link

--- Src/GoogleApis/Apis/[Media]/Upload/ResumableUpload.cs
+++ Src/GoogleApis/Apis/[Media]/Upload/ResumableUpload.cs
@@ -785,7 +785,7 @@
     /// The version with two types contains both a request object and a response object.
     /// </summary>
     /// <remarks>
-    /// See: http://code.google.com/apis/gdata/docs/resumable_upload.html for
+    /// See: https://developers.google.com/gdata/docs/resumable_upload for
     /// information on the protocol.
     /// </remarks>
     /// <typeparam name="TRequest">