// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Osu.Skinning.Default
{
    public class KiaiFlash : BeatSyncedContainer
    {
        private const double fade_length = 80;

        private const float flash_opacity = 0.25f;

        public KiaiFlash()
        {
            EarlyActivationMilliseconds = 80;
            Blending = BlendingParameters.Additive;

            Child = new Box
            {
                RelativeSizeAxes = Axes.Both,
                Colour = Color4.White,
                Alpha = 0f,
            };
        }

        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            if (!effectPoint.KiaiMode)
                return;

            Child
                .FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint)
                .Then()
                .FadeOut(Math.Max(0, timingPoint.BeatLength - fade_length), Easing.OutSine);
        }
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Osu.Skinning.Default
{
    public class KiaiFlash : BeatSyncedContainer
    {
        private const double fade_length = 80;

        private const float flash_opacity = 0.25f;

        public KiaiFlash()
        {
            EarlyActivationMilliseconds = 80;
            Blending = BlendingParameters.Additive;

            Child = new Box
            {
                RelativeSizeAxes = Axes.Both,
                Colour = Color4.White,
                Alpha = 0f,
            };
        }

        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            if (!effectPoint.KiaiMode)
                return;

            Child
                .FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint)
                .Then()
                .FadeOut(Math.Max(fade_length, timingPoint.BeatLength - fade_length), Easing.OutSine);
        }
    }
}

Use a minimum fade length for clamping rather than zero

Co-authored-by: Bartłomiej Dach <809709723693c4e7ecc6f5379a3099c830279741@gmail.com>


using System;
using System.ComponentModel;
using System.Windows;
using DesktopWidgets.Classes;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;

namespace DesktopWidgets.Actions
{
    public abstract class ActionBase
    {
        [PropertyOrder(0)]
        [DisplayName("Delay")]
        public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0);

        [PropertyOrder(1)]
        [DisplayName("Show Errors")]
        public bool ShowErrors { get; set; } = false;

        public void Execute()
        {
            DelayedAction.RunAction((int) Delay.TotalMilliseconds, () =>
            {
                try
                {
                    ExecuteAction();
                }
                catch (Exception ex)
                {
                    if (ShowErrors)
                        Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}",
                            image: MessageBoxImage.Error);
                }
            });
        }

        protected virtual void ExecuteAction()
        {
        }
    }
}

using System;
using System.ComponentModel;
using System.Windows;
using DesktopWidgets.Classes;
using DesktopWidgets.Helpers;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;

namespace DesktopWidgets.Actions
{
    public abstract class ActionBase
    {
        [PropertyOrder(0)]
        [DisplayName("Delay")]
        public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0);

        [PropertyOrder(1)]
        [DisplayName("Works If Foreground Is Fullscreen")]
        public bool WorksIfForegroundIsFullscreen { get; set; }

        [PropertyOrder(2)]
        [DisplayName("Works If Muted")]
        public bool WorksIfMuted { get; set; }

        [PropertyOrder(3)]
        [DisplayName("Show Errors")]
        public bool ShowErrors { get; set; } = false;

        public void Execute()
        {
            if (!WorksIfMuted && App.IsMuted ||
                (!WorksIfForegroundIsFullscreen && FullScreenHelper.DoesAnyMonitorHaveFullscreenApp()))
                return;
            DelayedAction.RunAction((int) Delay.TotalMilliseconds, () =>
            {
                try
                {
                    ExecuteAction();
                }
                catch (Exception ex)
                {
                    if (ShowErrors)
                        Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}",
                            image: MessageBoxImage.Error);
                }
            });
        }

        protected virtual void ExecuteAction()
        {
        }
    }
}

Add action "Works If Muted", "Works If Foreground Is Fullscreen" options


using Xamarin.Forms;

namespace AppShell.Mobile.Views
{
    [ContentProperty("ShellContent")]
    public partial class ShellView : ContentView
    {
        public static readonly BindableProperty ShellContentProperty = BindableProperty.Create<ShellView, View>(d => d.ShellContent, null, propertyChanged: ShellContentPropertyChanged);
        public static readonly BindableProperty HasNavigationBarProperty = BindableProperty.Create<ShellView, bool>(x => x.HasNavigationBar, true, propertyChanged: OnHasNavigationBarChanged);

        public View ShellContent { get { return (View)GetValue(ShellContentProperty); } set { SetValue(ShellContentProperty, value); } }
        public bool HasNavigationBar { get { return (bool)GetValue(HasNavigationBarProperty); } set { SetValue(HasNavigationBarProperty, value); } }

        public static void ShellContentPropertyChanged(BindableObject d, View oldValue, View newValue)
        {
            ShellView shellView = d as ShellView;
            shellView.ShellContent = newValue;
        }

        private static void OnHasNavigationBarChanged(BindableObject d, bool oldValue, bool newValue)
        {
            ShellView shellView = d as ShellView;
            NavigationPage.SetHasNavigationBar(shellView, newValue);

            if (!newValue)
                shellView.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
        }

        public ShellView()
        {
            InitializeComponent();

            SetBinding(HasNavigationBarProperty, new Binding("HasNavigationBar"));
        }
    }
}

using Xamarin.Forms;

namespace AppShell.Mobile.Views
{
    [ContentProperty("ShellContent")]
    public partial class ShellView : ContentView
    {
        public static readonly BindableProperty ShellContentProperty = BindableProperty.Create<ShellView, View>(d => d.ShellContent, null, propertyChanged: ShellContentPropertyChanged);
        public static readonly BindableProperty HasNavigationBarProperty = BindableProperty.Create<ShellView, bool>(x => x.HasNavigationBar, true, propertyChanged: OnHasNavigationBarChanged);

        public View ShellContent { get { return (View)GetValue(ShellContentProperty); } set { SetValue(ShellContentProperty, value); } }
        public bool HasNavigationBar { get { return (bool)GetValue(HasNavigationBarProperty); } set { SetValue(HasNavigationBarProperty, value); } }

        public static void ShellContentPropertyChanged(BindableObject d, View oldValue, View newValue)
        {
            ShellView shellView = d as ShellView;
            shellView.ShellContentView.Content = newValue;
        }

        private static void OnHasNavigationBarChanged(BindableObject d, bool oldValue, bool newValue)
        {
            ShellView shellView = d as ShellView;
            NavigationPage.SetHasNavigationBar(shellView, newValue);

            if (!newValue)
                shellView.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
        }

        public ShellView()
        {
            InitializeComponent();

            SetBinding(HasNavigationBarProperty, new Binding("HasNavigationBar"));
        }
    }
}

Revert "Fixed compile error in shell view"

This reverts commit 87b52b03724b961dc2050ae8c37175ee660037e0.


using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;

namespace Meowtrix.osuAMT.Training.DataGenerator
{
    class OszArchive : Archive, IDisposable
    {
        public ZipArchive archive;

        private FileInfo fileinfo;

        public OszArchive(FileInfo file)
        {
            fileinfo = file;
            string name = file.Name;
            Name = name.EndsWith(".osz") ? name.Substring(0, name.Length - 4) : name;
        }

        public override string Name { get; }

        public void Dispose() => archive.Dispose();

        private void EnsureArchiveOpened()
        {
            if (archive == null)
                archive = new ZipArchive(fileinfo.OpenRead(), ZipArchiveMode.Read, false);
        }

        public override Stream OpenFile(string filename)
        {
            EnsureArchiveOpened();
            return archive.GetEntry(filename).Open();
        }

        public override IEnumerable<Stream> OpenOsuFiles()
        {
            EnsureArchiveOpened();
            return archive.Entries.Where(x => x.Name.EndsWith(".osu")).Select(e => e.Open());
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;

namespace Meowtrix.osuAMT.Training.DataGenerator
{
    class OszArchive : Archive, IDisposable
    {
        public ZipArchive archive;

        private FileInfo fileinfo;

        public OszArchive(FileInfo file)
        {
            fileinfo = file;
            string name = file.Name;
            Name = name.EndsWith(".osz") ? name.Substring(0, name.Length - 4) : name;
        }

        public override string Name { get; }

        public void Dispose() => archive.Dispose();

        private void EnsureArchiveOpened()
        {
            if (archive == null)
                archive = new ZipArchive(fileinfo.OpenRead(), ZipArchiveMode.Read, false);
        }

        public override Stream OpenFile(string filename)
        {
            EnsureArchiveOpened();
            var temp = new MemoryStream();
            using (var deflate = archive.GetEntry(filename).Open())
            {
                deflate.CopyTo(temp);
                temp.Seek(0, SeekOrigin.Begin);
                return temp;
            }
        }

        public override IEnumerable<Stream> OpenOsuFiles()
        {
            EnsureArchiveOpened();
            return archive.Entries.Where(x => x.Name.EndsWith(".osu")).Select(e => e.Open());
        }
    }
}

Copy deflate stream to temporary memory stream.


using System.Net.Http.Formatting;
using System.Web.Http.ModelBinding;

using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.Trees;
using Umbraco.Web.WebApi.Filters;

namespace uSync8.BackOffice.Controllers.Trees
{
    [Tree(Constants.Applications.Settings, uSync.Trees.uSync,
        TreeGroup = uSync.Trees.Group,
        TreeTitle = uSync.Name, SortOrder = 35)]
    [PluginController(uSync.Name)]
    public class uSyncTreeController : TreeController
    {
        protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
        {
            var root = base.CreateRootNode(queryStrings);

            root.RoutePath = $"{Constants.Applications.Settings}/{uSync.Trees.uSync}/dashboard";
            root.Icon = "icon-infinity";
            root.HasChildren = false;
            root.MenuUrl = null;

            return root;
        }

        protected override MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
        {
            return null;
        }

        protected override TreeNodeCollection GetTreeNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
        {
            return new TreeNodeCollection();
        }
    }
}

using System.Net.Http.Formatting;
using System.Web.Http.ModelBinding;

using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.Trees;
using Umbraco.Web.WebApi.Filters;

namespace uSync8.BackOffice.Controllers.Trees
{
    [Tree(Constants.Applications.Settings, uSync.Trees.uSync,
        TreeGroup = uSync.Trees.Group,
        TreeTitle = uSync.Name, SortOrder = 35)]
    [PluginController(uSync.Name)]
    public class uSyncTreeController : TreeController
    {
        protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
        {
            var root = base.CreateRootNode(queryStrings);

            root.RoutePath = $"{this.SectionAlias}/{uSync.Trees.uSync}/dashboard";
            root.Icon = "icon-infinity";
            root.HasChildren = false;
            root.MenuUrl = null;

            return root;
        }

        protected override MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
        {
            return null;
        }

        protected override TreeNodeCollection GetTreeNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings)
        {
            return new TreeNodeCollection();
        }
    }
}

Remove reference to settings section in routePath (so we can move the tree in theory)


using RethinkDb.DatumConverters;

namespace RethinkDb.Newtonsoft.Configuration
{
    public class NewtonSerializer : AggregateDatumConverterFactory
    {
        public NewtonSerializer() : base(
            PrimitiveDatumConverterFactory.Instance,
            TupleDatumConverterFactory.Instance,
            AnonymousTypeDatumConverterFactory.Instance,
            BoundEnumDatumConverterFactory.Instance,
            NullableDatumConverterFactory.Instance,
            NewtonsoftDatumConverterFactory.Instance
        )
        {
        }
    }
}

using RethinkDb.DatumConverters;

namespace RethinkDb.Newtonsoft.Configuration
{
    public class NewtonSerializer : AggregateDatumConverterFactory
    {
        public NewtonSerializer() : base(
            PrimitiveDatumConverterFactory.Instance,
            TupleDatumConverterFactory.Instance,
            AnonymousTypeDatumConverterFactory.Instance,
            BoundEnumDatumConverterFactory.Instance,
            NullableDatumConverterFactory.Instance,
            NamedValueDictionaryDatumConverterFactory.Instance,
            NewtonsoftDatumConverterFactory.Instance
        )
        {
        }
    }
}

Add NamedValueDictionaryDatumConverterFactory to newtonsoft converter

Allows access to the .Keys colllection of a Dictionary<string,object>,
in an expression.


using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ExRam.Gremlinq.Core.Projections;
using ExRam.Gremlinq.Core.Steps;

namespace ExRam.Gremlinq.Core
{
    public static class EnumerableExtensions
    {
        public static Traversal ToTraversal(this IEnumerable<Step> steps) => new(
            steps is Step[] array
                ? (Step[])array.Clone()
                : steps.ToArray(),
            Projection.Empty);

        internal static bool InternalAny(this IEnumerable enumerable)
        {
            var enumerator = enumerable.GetEnumerator();

            return enumerator.MoveNext();
        }

        internal static IAsyncEnumerable<TElement> ToNonNullAsyncEnumerable<TElement>(this IEnumerable enumerable)
        {
            return AsyncEnumerable.Create(Core);

            async IAsyncEnumerator<TElement> Core(CancellationToken ct)
            {
                foreach (TElement element in enumerable)
                {
                    ct.ThrowIfCancellationRequested();

                    if (element is not null)
                        yield return element;
                }
            }
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using ExRam.Gremlinq.Core.Projections;
using ExRam.Gremlinq.Core.Steps;

namespace ExRam.Gremlinq.Core
{
    public static class EnumerableExtensions
    {
        public static Traversal ToTraversal(this IEnumerable<Step> steps) => new(
            steps is Step[] array
                ? (Step[])array.Clone()
                : steps.ToArray(),
            Projection.Empty);

        internal static bool InternalAny(this IEnumerable enumerable)
        {
            if (enumerable is ICollection collection)
                return collection.Count > 0;

            var enumerator = enumerable.GetEnumerator();

            try
            {
                return enumerator.MoveNext();
            }
            finally
            {
                if (enumerator is IDisposable disposable)
                    disposable.Dispose();
            }
        }

        internal static IAsyncEnumerable<TElement> ToNonNullAsyncEnumerable<TElement>(this IEnumerable enumerable)
        {
            return AsyncEnumerable.Create(Core);

            async IAsyncEnumerator<TElement> Core(CancellationToken ct)
            {
                foreach (TElement element in enumerable)
                {
                    ct.ThrowIfCancellationRequested();

                    if (element is not null)
                        yield return element;
                }
            }
        }
    }
}

Rework InternalAny to take IDisposables into account and short-cut on ICollections.


using System.Collections.Generic;
using HarryPotterUnity.Cards.Generic;
using HarryPotterUnity.Tween;
using UnityEngine;

namespace HarryPotterUnity.Utils
{
    public static class GameManager {

        public const int PreviewLayer = 9;
        public const int CardLayer = 10;
        public const int ValidChoiceLayer = 11;
        public const int IgnoreRaycastLayer = 2;
        public const int DeckLayer = 12;

        public static byte NetworkIdCounter;
        public static readonly List<GenericCard> AllCards = new List<GenericCard>();

        public static Camera PreviewCamera;

        public static readonly TweenQueue TweenQueue = new TweenQueue();

        public static void DisableCards(List<GenericCard> cards)
        {
            cards.ForEach(card => card.Disable());
        }

        public static void EnableCards(List<GenericCard> cards)
        {
            cards.ForEach(card => card.Enable());
        }
    }
}

using System.Collections.Generic;
using HarryPotterUnity.Cards.Generic;
using HarryPotterUnity.Tween;
using UnityEngine;

namespace HarryPotterUnity.Utils
{
    public static class GameManager {

        public const int PREVIEW_LAYER = 9;
        public const int CARD_LAYER = 10;
        public const int VALID_CHOICE_LAYER = 11;
        public const int IGNORE_RAYCAST_LAYER = 2;
        public const int DECK_LAYER = 12;

        public static byte _networkIdCounter;

        public static readonly List<GenericCard> AllCards = new List<GenericCard>();

        public static Camera _previewCamera;

        public static readonly TweenQueue TweenQueue = new TweenQueue();

        public static void DisableCards(List<GenericCard> cards)
        {
            cards.ForEach(card => card.Disable());
        }

        public static void EnableCards(List<GenericCard> cards)
        {
            cards.ForEach(card => card.Enable());
        }
    }
}

Rename some variables for consistency

Rename some variables for consistency


using System;

namespace Table {
  public class Table {
    public int Width;
    public int Spacing;

    public Table(int width, int spacing) {
      Width = width;
      Spacing = spacing;
    }
  }
}

using System;

namespace Hangman {
  public class Table {
    public int Width;
    public int Spacing;

    public Table(int width, int spacing) {
      Width = width;
      Spacing = spacing;
    }
  }
}

Make the namespace uniform accross the project


using System;

using Mono.VisualC.Interop;
using Mono.VisualC.Interop.ABI;

namespace Qt {
	// Will be internal; public for testing
        public static class Libs {
                public static CppLibrary QtCore = null;
                public static CppLibrary QtGui = null;

                static Libs ()
                {
                        string lib;
                        CppAbi abi;
                        if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                        { // for Windows...
                                lib = "{0}d4.dll";
                                abi = new MsvcAbi ();
                        } else { // for Mac...
                                lib = "/Library/Frameworks/{0}.framework/Versions/Current/{0}";
                                abi = new ItaniumAbi ();
                        }

                        QtCore = new CppLibrary (string.Format(lib, "QtCore"), abi);
                        QtGui  = new CppLibrary (string.Format(lib, "QtGui"),  abi);
                }
        }
}

using System;

using Mono.VisualC.Interop;
using Mono.VisualC.Interop.ABI;

namespace Qt {
	// Will be internal; public for testing
        public static class Libs {
                public static CppLibrary QtCore = null;
                public static CppLibrary QtGui = null;

                static Libs ()
                {
                        string lib;
                        CppAbi abi;
						if (Environment.OSVersion.Platform == PlatformID.Unix) {
							lib = "{0}.so";
							abi = new ItaniumAbi ();
                        } else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
                        { // for Windows...
                                lib = "{0}d4.dll";
                                abi = new MsvcAbi ();
                        } else { // for Mac...
                                lib = "/Library/Frameworks/{0}.framework/Versions/Current/{0}";
                                abi = new ItaniumAbi ();
                        }

                        QtCore = new CppLibrary (string.Format(lib, "QtCore"), abi);
                        QtGui  = new CppLibrary (string.Format(lib, "QtGui"),  abi);
                }
        }
}

Use proper library/abi for qt on linux.

Use proper library/abi for qt on linux.


@using RightpointLabs.ConferenceRoom.Domain
@model IEnumerable<RightpointLabs.ConferenceRoom.Domain.Models.Entities.DeviceEntity>
@{
    var buildings = (Dictionary<string, string>)ViewBag.Buildings;
    var rooms = (Dictionary<string, string>)ViewBag.Rooms;
}

    @Html.ActionLink("Create New", "Create")

            @Html.DisplayNameFor(model => model.Id)

            @Html.DisplayNameFor(model => model.BuildingId)

            @Html.DisplayNameFor(model => model.ControlledRoomIds)

@foreach (var item in Model) {

            @buildings.TryGetValue(item.Id)

            @(null == item.BuildingId ? "" : buildings.TryGetValue(item.BuildingId))

            @string.Join(", ", item.ControlledRoomIds.Select(_ => rooms.TryGetValue(_)))

            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })

}

@using RightpointLabs.ConferenceRoom.Domain
@model IEnumerable<RightpointLabs.ConferenceRoom.Domain.Models.Entities.DeviceEntity>
@{
    var buildings = (Dictionary<string, string>)ViewBag.Buildings;
    var rooms = (Dictionary<string, string>)ViewBag.Rooms;
}

    @Html.ActionLink("Create New", "Create")

            @Html.DisplayNameFor(model => model.Id)

            @Html.DisplayNameFor(model => model.BuildingId)

            @Html.DisplayNameFor(model => model.ControlledRoomIds)

@foreach (var item in Model) {

            @item.Id

            @(null == item.BuildingId ? "" : buildings.TryGetValue(item.BuildingId))

            @string.Join(", ", (item.ControlledRoomIds ?? new string[0]).Select(_ => rooms.TryGetValue(_)))

            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })

}

Fix up some room display issues

Fix up some room display issues


// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

using System;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace CefSharp.Wpf.Rendering
{
    public class InteropBitmapInfo : WpfBitmapInfo
    {
        private static readonly PixelFormat PixelFormat = PixelFormats.Bgra32;

        public InteropBitmap Bitmap { get; private set; }

        public InteropBitmapInfo()
        {
            BytesPerPixel = PixelFormat.BitsPerPixel / 8;
        }

        public override bool CreateNewBitmap
        {
            get { return Bitmap == null; }
        }

        public override void ClearBitmap()
        {
            Bitmap = null;
        }

        public override void Invalidate()
        {
            if (Bitmap != null)
            {
                Bitmap.Invalidate();
            }
        }

        public override BitmapSource CreateBitmap()
        {
            var stride = Width * BytesPerPixel;

            if (FileMappingHandle == IntPtr.Zero)
            {
                ClearBitmap();
            }
            else
            {
                Bitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(FileMappingHandle, Width, Height, PixelFormat, stride, 0);
            }

            return Bitmap;
        }
    }
}

// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

using System;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace CefSharp.Wpf.Rendering
{
    public class InteropBitmapInfo : WpfBitmapInfo
    {
        private static readonly PixelFormat PixelFormat = PixelFormats.Bgra32;

        public InteropBitmap Bitmap { get; private set; }

        public InteropBitmapInfo()
        {
            BytesPerPixel = PixelFormat.BitsPerPixel / 8;
        }

        public override bool CreateNewBitmap
        {
            get { return Bitmap == null; }
        }

        public override void ClearBitmap()
        {
            Bitmap = null;
        }

        public override void Invalidate()
        {
            if (Bitmap != null)
            {
                Bitmap.Invalidate();
            }
        }

        public override BitmapSource CreateBitmap()
        {
            var stride = Width * BytesPerPixel;

            // Unable to create bitmap without valid File Handle (Most likely control is being disposed)
            if (FileMappingHandle == IntPtr.Zero)
            {
                return null;
            }
            else
            {
                Bitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(FileMappingHandle, Width, Height, PixelFormat, stride, 0);
            }

            return Bitmap;
        }
    }
}

Return null immediately if file handle is not valid


using System;
using System.Reflection;

namespace AdoNetProfiler
{
    /// <summary>
    /// The factory to create the object of <see cref="IProfiler"/>.
    /// </summary>
    public class AdoNetProfilerFactory
    {
        // ConstructorInfo is faster than Func<IProfiler> when invoking.
        private static ConstructorInfo _constructor;

        /// <summary>
        /// Initialize the setting for profiling of database accessing with ADO.NET.
        /// </summary>
        /// <param name="profilerType">The type to implement <see cref="IProfiler"/>.</param>
        public static void Initialize(Type profilerType)
        {
            if (profilerType == null)
                throw new ArgumentNullException(nameof(profilerType));

            if (profilerType != typeof(IProfiler))
                throw new ArgumentException($"The type must be {typeof(IProfiler).FullName}.", nameof(profilerType));

            var constructor = profilerType.GetConstructor(Type.EmptyTypes);

            if (constructor == null)
                throw new InvalidOperationException("There is no default constructor. The profiler must have it.");

            _constructor = constructor;
        }

        public static IProfiler GetProfiler()
        {
            return (IProfiler)_constructor.Invoke(null);
        }
    }
}

using System;
using System.Reflection;
using System.Threading;

namespace AdoNetProfiler
{
    /// <summary>
    /// The factory to create the object of <see cref="IProfiler"/>.
    /// </summary>
    public class AdoNetProfilerFactory
    {
        // ConstructorInfo is faster than Func<IProfiler> when invoking.
        private static ConstructorInfo _constructor;

        private static bool _initialized = false;
        private static readonly ReaderWriterLockSlim _readerWriterLockSlim = new ReaderWriterLockSlim();

        /// <summary>
        /// Initialize the setting for profiling of database accessing with ADO.NET.
        /// </summary>
        /// <param name="profilerType">The type to implement <see cref="IProfiler"/>.</param>
        public static void Initialize(Type profilerType)
        {
            if (profilerType == null)
                throw new ArgumentNullException(nameof(profilerType));

            if (profilerType != typeof(IProfiler))
                throw new ArgumentException($"The type must be {typeof(IProfiler).FullName}.", nameof(profilerType));

            _readerWriterLockSlim.ExecuteWithReadLock(() =>
            {
                if (_initialized)
                    throw new InvalidOperationException("This factory class has already initialized.");

                var constructor = profilerType.GetConstructor(Type.EmptyTypes);

                if (constructor == null)
                    throw new InvalidOperationException("There is no default constructor. The profiler must have it.");

                _constructor = constructor;

                _initialized = true;
            });
        }

        public static IProfiler GetProfiler()
        {
            return _readerWriterLockSlim.ExecuteWithWriteLock(() =>
            {
                if (!_initialized)
                    throw new InvalidOperationException("This factory class has not initialized yet.");

                return (IProfiler)_constructor.Invoke(null);
            });
        }
    }
}

Use the lock in the factory class.

Use the lock in the factory class.


using KenticoInspector.Core.Models;
using System;
using System.Collections.Generic;

namespace KenticoInspector.Core
{
    public abstract class AbstractReport : IReport
    {
        public string Codename => GetCodename(this.GetType());

        public static string GetCodename(Type reportType) {
            return GetDirectParentNamespace(reportType);
        }

        public abstract IList<Version> CompatibleVersions { get; }

        public virtual IList<Version> IncompatibleVersions => new List<Version>();

        public abstract IList<string> Tags { get; }

        public abstract ReportResults GetResults();

        private static string GetDirectParentNamespace(Type reportType)
        {
            var fullNameSpace = reportType.Namespace;
            var indexAfterLastPeriod = fullNameSpace.LastIndexOf('.') + 1;
            return fullNameSpace.Substring(indexAfterLastPeriod, fullNameSpace.Length - indexAfterLastPeriod);
        }
    }
}

using KenticoInspector.Core.Models;
using System;
using System.Collections.Generic;

namespace KenticoInspector.Core
{
    public abstract class AbstractReport<T> : IReport, IWithMetadata<T> where T : new()
    {
        public string Codename => GetCodename(this.GetType());

        public static string GetCodename(Type reportType) {
            return GetDirectParentNamespace(reportType);
        }

        public abstract IList<Version> CompatibleVersions { get; }

        public virtual IList<Version> IncompatibleVersions => new List<Version>();

        public abstract IList<string> Tags { get; }

        public abstract Metadata<T> Metadata { get; }

        public abstract ReportResults GetResults();

        private static string GetDirectParentNamespace(Type reportType)
        {
            var fullNameSpace = reportType.Namespace;
            var indexAfterLastPeriod = fullNameSpace.LastIndexOf('.') + 1;
            return fullNameSpace.Substring(indexAfterLastPeriod, fullNameSpace.Length - indexAfterLastPeriod);
        }
    }
}

Add metadata support to abstract report

Add metadata support to abstract report


using System;
using System.Web;
using System.Web.Routing;

namespace Cassette
{
    public class ModuleRequestHandler<T> : IHttpHandler
        where T : Module
    {
        public ModuleRequestHandler(IModuleContainer<T> moduleContainer, RequestContext requestContext)
        {
            this.moduleContainer = moduleContainer;
            this.requestContext = requestContext;
        }

        readonly IModuleContainer<T> moduleContainer;
        readonly RequestContext requestContext;

        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext _)
        {
            var path = requestContext.RouteData.GetRequiredString("path");
            var index = path.LastIndexOf('_');
            if (index >= 0)
            {
                path = path.Substring(0, index);
            }
            var module = moduleContainer.FindModuleByPath(path);
            var response = requestContext.HttpContext.Response;
            if (module == null)
            {
                response.StatusCode = 404;
            }
            else
            {
                response.Cache.SetCacheability(HttpCacheability.Public);
                response.Cache.SetMaxAge(TimeSpan.FromDays(365));
                response.ContentType = module.ContentType;
                using (var assetStream = module.Assets[0].OpenStream())
                {
                    assetStream.CopyTo(response.OutputStream);
                }
            }
        }
    }
}

using System;
using System.Web;
using System.Web.Routing;

namespace Cassette.Web
{
    public class ModuleRequestHandler<T> : IHttpHandler
        where T : Module
    {
        public ModuleRequestHandler(IModuleContainer<T> moduleContainer, RequestContext requestContext)
        {
            this.moduleContainer = moduleContainer;
            this.requestContext = requestContext;
        }

        readonly IModuleContainer<T> moduleContainer;
        readonly RequestContext requestContext;

        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext _)
        {
            var path = requestContext.RouteData.GetRequiredString("path");
            var index = path.LastIndexOf('_');
            if (index >= 0)
            {
                path = path.Substring(0, index);
            }
            var module = moduleContainer.FindModuleByPath(path);
            var response = requestContext.HttpContext.Response;
            if (module == null)
            {
                response.StatusCode = 404;
            }
            else
            {
                response.Cache.SetCacheability(HttpCacheability.Public);
                response.Cache.SetMaxAge(TimeSpan.FromDays(365));
                response.ContentType = module.ContentType;
                using (var assetStream = module.Assets[0].OpenStream())
                {
                    assetStream.CopyTo(response.OutputStream);
                }
            }
        }
    }
}

Move class into correct namespace.

Move class into correct namespace.


// The code is new, but the idea is from http://wiki.tcl.tk/9563

using System;
using System.Runtime.InteropServices;

namespace Irule
{
    public class TclInterp : IDisposable
    {
        [DllImport("libtcl.dylib")]
        protected static extern IntPtr Tcl_CreateInterp();

        [DllImport("libtcl.dylib")]
        protected static extern int Tcl_Init(IntPtr interp);

        [DllImport("libtcl.dylib")]
        protected static extern int Tcl_Eval(IntPtr interp, string script);

        [DllImport("libtcl.dylib")]
        protected static extern IntPtr Tcl_GetStringResult(IntPtr interp);

        [DllImport("libtcl.dylib")]
        protected static extern void Tcl_DeleteInterp(IntPtr interp);

        [DllImport("libtcl.dylib")]
        protected static extern void Tcl_Finalize();

        private IntPtr interp;
        private bool disposed;

        public TclInterp()
        {
            interp = Tcl_CreateInterp();
            Tcl_Init(interp);

            disposed = false;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing && interp != IntPtr.Zero)
                {
                    Tcl_DeleteInterp(interp);
                    Tcl_Finalize();
                }

                interp = IntPtr.Zero;
                disposed = true;
            }
        }

        public string Eval(string text)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Attempt to use disposed Tcl interpreter");
            }

            Tcl_Eval(interp, text);
            var result  = Tcl_GetStringResult(interp);
            return Marshal.PtrToStringAnsi(result);
        }
    }
}

// The code is new, but the idea is from http://wiki.tcl.tk/9563

using System;
using System.Runtime.InteropServices;

namespace Irule
{
    public class TclInterp : IDisposable
    {
        [DllImport("tcl8.4")]
        protected static extern IntPtr Tcl_CreateInterp();

        [DllImport("tcl8.4")]
        protected static extern int Tcl_Init(IntPtr interp);

        [DllImport("tcl8.4")]
        protected static extern int Tcl_Eval(IntPtr interp, string script);

        [DllImport("tcl8.4")]
        protected static extern IntPtr Tcl_GetStringResult(IntPtr interp);

        [DllImport("tcl8.4")]
        protected static extern void Tcl_DeleteInterp(IntPtr interp);

        [DllImport("tcl8.4")]
        protected static extern void Tcl_Finalize();

        private IntPtr interp;
        private bool disposed;

        public TclInterp()
        {
            interp = Tcl_CreateInterp();
            Tcl_Init(interp);

            disposed = false;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing && interp != IntPtr.Zero)
                {
                    Tcl_DeleteInterp(interp);
                    Tcl_Finalize();
                }

                interp = IntPtr.Zero;
                disposed = true;
            }
        }

        public string Eval(string text)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Attempt to use disposed Tcl interpreter");
            }

            Tcl_Eval(interp, text);
            var result  = Tcl_GetStringResult(interp);
            return Marshal.PtrToStringAnsi(result);
        }
    }
}

Load Tcl in a cross-platform way

Load Tcl in a cross-platform way


using System;
using Engine.cgimin.material.simpletexture;
using Engine.cgimin.object3d;
using Engine.cgimin.texture;
using OpenTK;

namespace Mugo
{
	class PizzaModel : ClonedObject<PizzaModelInternal>, ITunnelSegementElementModel
	{
		private static readonly SimpleTextureMaterial material = new SimpleTextureMaterial();

		public float Radius => radius;

		public new Matrix4 Transformation {
			get { return base.Transformation; }
			set { base.Transformation = value; }
		}

		public void Draw ()
		{
			material.Draw(this, internalObject.TextureId);
		}
	}

	internal class PizzaModelInternal : ObjLoaderObject3D
	{
		private const String objFilePath = "data/objects/Pizza.model";
		private const String texturePath = "data/textures/Pizza.png";

		public PizzaModelInternal () : base (objFilePath)
		{
			TextureId = TextureManager.LoadTexture (texturePath);
			Transformation *= Matrix4.CreateScale (0.2f);
			Transformation *= Matrix4.CreateRotationY (MathHelper.DegreesToRadians (90));
			Transformation *= Matrix4.CreateRotationX (MathHelper.DegreesToRadians (90));
			Transformation *= Matrix4.CreateTranslation (0f, 1.5f, -TunnelSegmentConfig.Depth / 2f);

			DefaultTransformation = Transformation;
		}

		public int TextureId { get; private set; }

		public Matrix4 DefaultTransformation { get; }
	}
}

using System;
using Engine.cgimin.material.simpletexture;
using Engine.cgimin.object3d;
using Engine.cgimin.texture;
using OpenTK;

namespace Mugo
{
	class PizzaModel : ClonedObject<PizzaModelInternal>, ITunnelSegementElementModel
	{
		private static readonly SimpleTextureMaterial material = new SimpleTextureMaterial();

		public float Radius => radius;

		public new Matrix4 Transformation {
			get { return base.Transformation; }
			set { base.Transformation = value; }
		}

		public void Draw ()
		{
			material.Draw(this, internalObject.TextureId);
		}
	}

	internal class PizzaModelInternal : ObjLoaderObject3D
	{
		private const String objFilePath = "data/objects/Pizza.model";
		private const String texturePath = "data/textures/Pizza.png";

		public PizzaModelInternal () : base (objFilePath, 0.2f)
		{
			TextureId = TextureManager.LoadTexture (texturePath);
			Transformation *= Matrix4.CreateRotationY (MathHelper.DegreesToRadians (90));
			Transformation *= Matrix4.CreateRotationX (MathHelper.DegreesToRadians (90));
			Transformation *= Matrix4.CreateTranslation (0f, 1.5f, -TunnelSegmentConfig.Depth / 2f);

			DefaultTransformation = Transformation;
		}

		public int TextureId { get; private set; }

		public Matrix4 DefaultTransformation { get; }
	}
}

Move scale operation to base constructor.

This fixes the incorrect radius calculation.


/*Problem 9. Sum of n Numbers

    Write a program that enters a number n and after that enters more n numbers and calculates and prints their sum.
    Note: You may need to use a for-loop.

Examples:
numbers 	sum
3 	        90
20
60
10

5 	        6.5
2
-1
-0.5
4
2

1 	        1
1
*/

using System;

class SumOfNNumbers
{
    static void Main()
    {
        Console.Title = "Sum of n Numbers"; //Changing the title of the console.

        Console.Write("Please, enter an integer n: ");
        int n = int.Parse(Console.ReadLine());
        double sum = 0;
        for (int i = 1; i <= n; i++)
        {
            sum += double.Parse(Console.ReadLine());
        }
        Console.WriteLine("\nsum = " + sum);

        Console.ReadKey(); // Keeping the console opened.
    }
}

/*Problem 9. Sum of n Numbers

    Write a program that enters a number n and after that enters more n numbers and calculates and prints their sum.
    Note: You may need to use a for-loop.

Examples:
numbers 	sum
3 	        90
20
60
10

5 	        6.5
2
-1
-0.5
4
2

1 	        1
1
*/

using System;

class SumOfNNumbers
{
    static void Main()
    {
        Console.Title = "Sum of n Numbers"; //Changing the title of the console.

        Console.Write("Please, enter an integer n and n numbers after that.\nn: ");
        int n = int.Parse(Console.ReadLine());
        double sum = 0;
        for (int i = 1; i <= n; i++)
        {
            Console.Write("number {0}: ", i);
            sum += double.Parse(Console.ReadLine());
        }
        Console.WriteLine("\nsum = " + sum);

        Console.ReadKey(); // Keeping the console opened.
    }
}

Update to Problem 9. Sum of n Numbers

Update to Problem 9. Sum of n Numbers


using System;
using System.Linq;
using AutoFixture.Xunit2;
using Shouldly;
using Xunit;

namespace Lloyd.AzureMailGateway.Models.Tests
{
    public class EMailBuilderTests
    {
        //[Fact]
        //public void BuilderShouldReturnNonNullEMailInstance()
        //{
        //    // Arrange
        //    var builder = new EMailBuilder();

        //    // Act
        //    var email = new EMailBuilder().Build();

        //    // Assert

        //}

        [Fact]
        public void BuildShouldThrowOnInvalidState()
        {
            // Arrange
            var builder = new EMailBuilder();

            // Act / Assert
            Should.Throw<InvalidOperationException>(() => new EMailBuilder().Build());
        }

        [Theory, AutoData]
        public void BuilderShouldSetToAndFromProperties(Address toAddress, Address fromAddress)
        {
            // Arrange
            var builder = new EMailBuilder();

            // Act
            builder
                .To(toAddress.EMail, toAddress.Name)
                .From(fromAddress.EMail, fromAddress.Name);

            var email = builder.Build();

            // Assert
            email.To.Addresses.First().EMail.ShouldBe(toAddress.EMail);
            email.To.Addresses.First().Name.ShouldBe(toAddress.Name);
        }
    }
}

using System;
using System.Linq;
using AutoFixture.Xunit2;
using Shouldly;
using Xunit;

namespace Lloyd.AzureMailGateway.Models.Tests
{
    public class EMailBuilderTests
    {
        [Fact]
        public void BuildShouldThrowOnInvalidState()
        {
            // Arrange
            var builder = new EMailBuilder();

            // Act / Assert
            Should.Throw<InvalidOperationException>(() => new EMailBuilder().Build());
        }

        [Theory, AutoData]
        public void BuilderShouldSetToAndFromProperties(Address toAddress, Address fromAddress)
        {
            // Arrange
            var builder = new EMailBuilder();

            // Act
            builder
                .To(toAddress.EMail, toAddress.Name)
                .From(fromAddress.EMail, fromAddress.Name);

            var email = builder.Build();

            // Assert
            email.To.Addresses.First().EMail.ShouldBe(toAddress.EMail);
            email.To.Addresses.First().Name.ShouldBe(toAddress.Name);
        }
    }
}

Remove obsolete unit test (null check - can no longer be null)


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RemiCover_UmbrellaBehaviour : MonoBehaviour {

    public float verticalPosition;

	// Use this for initialization
	void Start () {
        Cursor.visible = false;
    }

    // Update is called once per frame
    void Update() {
        Vector2 mousePosition = CameraHelper.getCursorPosition();
        this.transform.position = new Vector2(mousePosition.x, verticalPosition);
    }

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RemiCover_UmbrellaBehaviour : MonoBehaviour {

    public float verticalPosition;

	// Use this for initialization
	void Start () {
        Cursor.visible = false;
    }

    // Update is called once per frame
    void Update() {
		if (!MicrogameController.instance.getVictory())
			return;
        Vector2 mousePosition = CameraHelper.getCursorPosition();
        this.transform.position = new Vector2(mousePosition.x, verticalPosition);
    }

}

Stop umbrella on player loss

Stop umbrella on player loss

Basically sends the message to the player that they're done and messed
up


using System.Collections.Generic;
using Mond.Compiler.Expressions;

namespace Mond.Compiler.Parselets
{
    class ObjectParselet : IPrefixParselet
    {
        public Expression Parse(Parser parser, Token token)
        {
            var values = new List<KeyValuePair<string, Expression>>();

            while (!parser.Match(TokenType.RightBrace))
            {
                var identifier = parser.Take(TokenType.Identifier);
                parser.Take(TokenType.Colon);
                var value = parser.ParseExpession();

                values.Add(new KeyValuePair<string, Expression>(identifier.Contents, value));

                if (!parser.Match(TokenType.Comma))
                    break;

                parser.Take(TokenType.Comma);
            }

            parser.Take(TokenType.RightBrace);

            return new ObjectExpression(token, values);
        }
    }
}

using System.Collections.Generic;
using Mond.Compiler.Expressions;

namespace Mond.Compiler.Parselets
{
    class ObjectParselet : IPrefixParselet
    {
        public Expression Parse(Parser parser, Token token)
        {
            var values = new List<KeyValuePair<string, Expression>>();

            while (!parser.Match(TokenType.RightBrace))
            {
                var identifier = parser.Take(TokenType.Identifier);

                Expression value;

                if (parser.Match(TokenType.Comma) || parser.Match(TokenType.RightBrace))
                {
                    value = new IdentifierExpression(identifier);
                }
                else
                {
                    parser.Take(TokenType.Colon);
                    value = parser.ParseExpession();
                }

                values.Add(new KeyValuePair<string, Expression>(identifier.Contents, value));

                if (!parser.Match(TokenType.Comma))
                    break;

                parser.Take(TokenType.Comma);
            }

            parser.Take(TokenType.RightBrace);

            return new ObjectExpression(token, values);
        }
    }
}

Add support for array-like object declarations


using System;
using System.IO;
using System.Text;

namespace YGOSharp.Network.Utils
{
    public static class BinaryExtensions
    {
        public static void WriteUnicode(this BinaryWriter writer, string text, int len)
        {
            byte[] unicode = Encoding.Unicode.GetBytes(text);
            byte[] result = new byte[len * 2];
            int max = len * 2 - 2;
            Array.Copy(unicode, result, unicode.Length > max ? max : unicode.Length);
            writer.Write(result);
        }

        public static string ReadUnicode(this BinaryReader reader, int len)
        {
            byte[] unicode = reader.ReadBytes(len * 2);
            string text = Encoding.Unicode.GetString(unicode);
            text = text.Substring(0, text.IndexOf('\0'));
            return text;
        }

        public static byte[] ReadToEnd(this BinaryReader reader)
        {
            return reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace YGOSharp.Network.Utils
{
    public static class BinaryExtensions
    {
        public static void WriteUnicode(this BinaryWriter writer, string text, int len)
        {
            byte[] unicode = Encoding.Unicode.GetBytes(text);
            byte[] result = new byte[len * 2];
            int max = len * 2 - 2;
            Array.Copy(unicode, result, unicode.Length > max ? max : unicode.Length);
            writer.Write(result);
        }

        public static string ReadUnicode(this BinaryReader reader, int len)
        {
            byte[] unicode = reader.ReadBytes(len * 2);
            string text = Encoding.Unicode.GetString(unicode);
            int index = text.IndexOf('\0');
            if (index > 0) text = text.Substring(0, index);
            return text;
        }

        public static byte[] ReadToEnd(this BinaryReader reader)
        {
            return reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
        }
    }
}

Fix a crash if we receive a too long unicode string


using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SyncTrayzor.SyncThing.Api
{
    public class ItemStartedEventData
    {
        [JsonProperty("item")]
        public string Item { get; set; }

        [JsonProperty("folder")]
        public string Folder { get; set; }
    }

    public class ItemStartedEvent : Event
    {
        [JsonProperty("data")]
        public ItemStartedEventData Data { get; set; }

        public override void Visit(IEventVisitor visitor)
        {
            visitor.Accept(this);
        }

        public override string ToString()
        {
            return String.Format("<ItemStarted ID={0} Time={1} Item={2} Folder={3}>", this.Id, this.Time, this.Data.Item, this.Data.Folder);
        }
    }
}

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SyncTrayzor.SyncThing.Api
{
    public class ItemStartedEventDetails
    {
        [JsonProperty("Name")]
        public string Name { get; set; }

        [JsonProperty("Flags")]
        public int Flags { get; set; }

        [JsonProperty("Modified")]
        public long Modified { get; set; } // Is this supposed to be a DateTime?

        [JsonProperty("Version")]
        public int Version { get; set; }

        [JsonProperty("LocalVersion")]
        public int LocalVersion { get; set; }

        [JsonProperty("NumBlocks")]
        public int NumBlocks { get; set; }
    }

    public class ItemStartedEventData
    {
        [JsonProperty("item")]
        public string Item { get; set; }

        [JsonProperty("folder")]
        public string Folder { get; set; }

        [JsonProperty("details")]
        public ItemStartedEventDetails Details { get; set; }
    }

    public class ItemStartedEvent : Event
    {
        [JsonProperty("data")]
        public ItemStartedEventData Data { get; set; }

        public override void Visit(IEventVisitor visitor)
        {
            visitor.Accept(this);
        }

        public override string ToString()
        {
            return String.Format("<ItemStarted ID={0} Time={1} Item={2} Folder={3} Name={4} Flags={5} Modified={6} Version={7} LocalVersion={8} NumBlocks={9}>",
                this.Id, this.Time, this.Data.Item, this.Data.Folder, this.Data.Details.Name, this.Data.Details.Flags, this.Data.Details.Modified,
                this.Data.Details.Version, this.Data.Details.LocalVersion, this.Data.Details.NumBlocks);
        }
    }
}

Support details for ItemStarted event

Support details for ItemStarted event


using System;

namespace osu.Game.Online.RealtimeMultiplayer
{
    public class NotJoinedRoomException : Exception
    {
        public NotJoinedRoomException()
            : base("This user has not yet joined a multiplayer room.")
        {
        }
    }
}

Add missing final newline in file

Add missing final newline in file


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace MusicRandomizer
{
    public partial class NewPlaylistForm : Form
    {
        public String name;

        public NewPlaylistForm()
        {
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
           name = txtName.Text;

            // Check to make sure the user actually entered a name
            if (name.Length == 0)
            {
                MessageBox.Show("Please enter in a name.");
                return;
            }

            // Check for invalid characters in the filename
            foreach (char c in Path.GetInvalidFileNameChars())
            {
                if (name.Contains(c))
                {
                    MessageBox.Show("There are invalid characters in the playlist name.");
                    return;
                }
            }

            // Check to make sure this name isn't already taken
            String[] playlists = Directory.GetFiles("playlists");
            foreach (String playlist in playlists)
            {
                if (playlist.Equals(name))
                {
                    MessageBox.Show("This playlist already exists.");
                    return;
                }
            }

            // Create the playlist
            using (FileStream writer = File.OpenWrite("playlists\\" + name + ".xml"))
            {
                MainForm.serializer.Serialize(writer, new List<MusicFile>());
            }

            this.Close();
        }

    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace MusicRandomizer
{
    public partial class NewPlaylistForm : Form
    {
        public String name;

        public NewPlaylistForm()
        {
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
           name = txtName.Text;

            // Check to make sure the user actually entered a name
            if (name.Length == 0)
            {
                MessageBox.Show("Please enter in a name.");
                return;
            }

            // Check for invalid characters in the filename
            foreach (char c in Path.GetInvalidFileNameChars())
            {
                if (name.Contains(c))
                {
                    MessageBox.Show("There are invalid characters in the playlist name.");
                    return;
                }
            }

            // Check to make sure this name isn't already taken
            if (File.Exists("playlists\\" + name + ".xml"))
            {
                MessageBox.Show("That playlist already exists.");
                return;
            }

            // Create the playlist
            using (FileStream writer = File.OpenWrite("playlists\\" + name + ".xml"))
            {
                MainForm.serializer.Serialize(writer, new List<MusicFile>());
            }

            this.Close();
        }

    }
}

MusicRandomizer: Fix a bug where you could create an already existing playlist


using System;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;

namespace DesktopWidgets.Widgets.PictureSlideshow
{
    public class Settings : WidgetSettingsBase
    {
        public Settings()
        {
            Width = 384;
            Height = 216;
        }

        [Category("General")]
        [DisplayName("Root Folder")]
        public string RootPath { get; set; }

        [Category("General")]
        [DisplayName("Allowed File Extensions")]
        public string FileFilterExtension { get; set; } = ".jpg|.jpeg|.png|.bmp|.gif|.ico|.tiff|.wmp";

        [Category("General")]
        [DisplayName("Maximum File Size (bytes)")]
        public double FileFilterSize { get; set; } = 1024000;

        [Category("General")]
        [DisplayName("Next Image Interval")]
        public TimeSpan ChangeInterval { get; set; } = TimeSpan.FromSeconds(15);

        [Category("General")]
        [DisplayName("Shuffle")]
        public bool Shuffle { get; set; } = true;

        [Category("General")]
        [DisplayName("Recursive")]
        public bool Recursive { get; set; } = false;

        [Category("General")]
        [DisplayName("Current Image Path")]
        public string ImageUrl { get; set; }

        [Category("General")]
        [DisplayName("Allow Dropping Images")]
        public bool AllowDropFiles { get; set; } = true;

        [Category("General")]
        [DisplayName("Freeze")]
        public bool Freeze { get; set; }
    }
}

using System;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;

namespace DesktopWidgets.Widgets.PictureSlideshow
{
    public class Settings : WidgetSettingsBase
    {
        public Settings()
        {
            Width = 384;
            Height = 216;
        }

        [Category("General")]
        [DisplayName("Image Folder Path")]
        public string RootPath { get; set; }

        [Category("General")]
        [DisplayName("Allowed File Extensions")]
        public string FileFilterExtension { get; set; } = ".jpg|.jpeg|.png|.bmp|.gif|.ico|.tiff|.wmp";

        [Category("General")]
        [DisplayName("Maximum File Size (bytes)")]
        public double FileFilterSize { get; set; } = 1024000;

        [Category("General")]
        [DisplayName("Next Image Interval")]
        public TimeSpan ChangeInterval { get; set; } = TimeSpan.FromSeconds(15);

        [Category("General")]
        [DisplayName("Shuffle")]
        public bool Shuffle { get; set; } = true;

        [Category("General")]
        [DisplayName("Recursive")]
        public bool Recursive { get; set; } = false;

        [Category("General")]
        [DisplayName("Current Image Path")]
        public string ImageUrl { get; set; }

        [Category("General")]
        [DisplayName("Allow Dropping Images")]
        public bool AllowDropFiles { get; set; } = true;

        [Category("General")]
        [DisplayName("Freeze")]
        public bool Freeze { get; set; }
    }
}

Change "Slideshow" "Root Folder" option name


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
    /// <summary>
    /// A hit used specifically for drum rolls, where spawning flying hits is required.
    /// </summary>
    public class DrawableFlyingHit : DrawableHit
    {
        public DrawableFlyingHit(DrawableDrumRollTick drumRollTick)
            : base(new IgnoreHit
            {
                StartTime = drumRollTick.HitObject.StartTime + drumRollTick.Result.TimeOffset,
                IsStrong = drumRollTick.HitObject.IsStrong,
                Type = drumRollTick.JudgementType
            })
        {
            HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            ApplyResult(r => r.Type = r.Judgement.MaxResult);
        }
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
    /// <summary>
    /// A hit used specifically for drum rolls, where spawning flying hits is required.
    /// </summary>
    public class DrawableFlyingHit : DrawableHit
    {
        public DrawableFlyingHit(DrawableDrumRollTick drumRollTick)
            : base(new IgnoreHit
            {
                StartTime = drumRollTick.HitObject.StartTime + drumRollTick.Result.TimeOffset,
                IsStrong = drumRollTick.HitObject.IsStrong,
                Type = drumRollTick.JudgementType
            })
        {
            HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            ApplyResult(r => r.Type = r.Judgement.MaxResult);
        }

        protected override void LoadSamples()
        {
            // block base call - flying hits are not supposed to play samples
            // the base call could overwrite the type of this hit
        }
    }
}

Fix rim flying hits changing colour

Fix rim flying hits changing colour


using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace Working_with_images
{
    /// <summary>
    /// The UIApplicationDelegate for the application. This class is responsible for launching the
    /// User Interface of the application, as well as listening (and optionally responding) to
    /// application events from iOS.
    /// </summary>
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        // class-level declarations
        UIWindow window;

        /// <summary>
        /// This method is invoked when the application has loaded and is ready to run. In this
        /// method you should instantiate the window, load the UI into it and then make the window
        /// visible.
        /// </summary>
        /// <remarks>
        /// You have 5 seconds to return from this method, or iOS will terminate your application.
        /// </remarks>
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace Working_with_images
{
    /// <summary>
    /// The UIApplicationDelegate for the application. This class is responsible for launching the
    /// User Interface of the application, as well as listening (and optionally responding) to
    /// application events from iOS.
    /// </summary>
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        // class-level declarations
        UIWindow window;

        // Added contoller. As of MonoTouch 5.0.2, applications are expected to
        // have a root view controller at the end of application launch

        UIViewController controller;
        UILabel label;

        /// <summary>
        /// This method is invoked when the application has loaded and is ready to run. In this
        /// method you should instantiate the window, load the UI into it and then make the window
        /// visible.
        /// </summary>
        /// <remarks>
        /// You have 5 seconds to return from this method, or iOS will terminate your application.
        /// </remarks>
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            controller = new UIViewController ();
            controller.View.BackgroundColor = UIColor.White;

            label = new UILabel();
            label.Frame = new System.Drawing.RectangleF(10 ,10, UIScreen.MainScreen.Bounds.Width, 50);
            label.Text = "Hello, Working with Images";

            controller.View.AddSubview(label);

            window.RootViewController = controller;

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
    }
}

Update Mike's Working with Images sample.


using UnityEngine;
using System.Collections;

public sealed class HUD : MonoBehaviour {
	private int frameCount = 0;
	private float dt = 0.0F;
	private float fps = 0.0F;
	private float updateRate = 4.0F;

	void Start () {

	}

	void Update () {
		frameCount++;
		dt += Time.deltaTime;
		if (dt > 1.0F / updateRate) {
			fps = frameCount / dt ;
			frameCount = 0;
			dt -= 1.0F / updateRate;
		}
	}

	void OnGUI () {
		GUI.Label(new Rect(10, 10, 150, 100), "Current FPS: " + ((int)fps).ToString());
		GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 0, 0), "This is a crosshair");
	}
}

using UnityEngine;
using System.Collections;

public sealed class HUD : MonoBehaviour {
	private int FrameCount = 0;
	private float DeltaTime = 0.0F;
	private float FPS = 0.0F;
	private float UpdateRate = 5.0F;

	void Start () {

	}

	void Update () {
		FrameCount++;
		DeltaTime += Time.deltaTime;
		if (DeltaTime > 1.0F / UpdateRate) {
			FPS = FrameCount / DeltaTime ;
			FrameCount = 0;
			DeltaTime -= 1.0F / UpdateRate;
		}
	}

	void OnGUI () {
		GUI.Label(new Rect(10, 10, 150, 100), "Current FPS: " + ((int)FPS).ToString());
		GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 0, 0), "This is a crosshair");
	}
}

Change some some syntax conventions.

Change some some syntax conventions.


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;

namespace osu.Game.Graphics.UserInterfaceV2
{
    public class RoundedButton : OsuButton, IFilterable
    {
        public override float Height
        {
            get => base.Height;
            set
            {
                base.Height = value;

                if (IsLoaded)
                    updateCornerRadius();
            }
        }

        [BackgroundDependencyLoader(true)]
        private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
        {
            BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            updateCornerRadius();
        }

        private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2;

        public virtual IEnumerable<string> FilterTerms => new[] { Text.ToString() };

        public bool MatchingFilter
        {
            set => this.FadeTo(value ? 1 : 0);
        }

        public bool FilteringActive { get; set; }
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK.Graphics;

namespace osu.Game.Graphics.UserInterfaceV2
{
    public class RoundedButton : OsuButton, IFilterable
    {
        public override float Height
        {
            get => base.Height;
            set
            {
                base.Height = value;

                if (IsLoaded)
                    updateCornerRadius();
            }
        }

        [BackgroundDependencyLoader(true)]
        private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
        {
            if (BackgroundColour == Color4.White)
                BackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            updateCornerRadius();
        }

        private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2;

        public virtual IEnumerable<string> FilterTerms => new[] { Text.ToString() };

        public bool MatchingFilter
        {
            set => this.FadeTo(value ? 1 : 0);
        }

        public bool FilteringActive { get; set; }
    }
}

Fix rounded buttons not allowing custom colour specifications


using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using System;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;

namespace SampleApp
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(async context =>
            {
                Console.WriteLine("{0} {1}{2}{3}",
                    context.Request.Method,
                    context.Request.PathBase,
                    context.Request.Path,
                    context.Request.QueryString);

                if (context.IsWebSocketRequest)
                {
                    var webSocket = await context.AcceptWebSocketAsync();
                    await EchoAsync(webSocket);
                }
                else
                {
                    context.Response.ContentLength = 11;
                    context.Response.ContentType = "text/plain";
                    await context.Response.WriteAsync("Hello world");
                }
            });
        }

        public async Task EchoAsync(WebSocket webSocket)
        {
            var buffer = new ArraySegment<byte>(new byte[8192]);
            for (; ;)
            {
                var result = await webSocket.ReceiveAsync(
                    buffer,
                    CancellationToken.None);

                if (result.MessageType == WebSocketMessageType.Close)
                {
                    return;
                }
                else if (result.MessageType == WebSocketMessageType.Text)
                {
                    Console.WriteLine("{0}", System.Text.Encoding.UTF8.GetString(buffer.Array, 0, result.Count));
                }

                await webSocket.SendAsync(
                    new ArraySegment<byte>(buffer.Array, 0, result.Count),
                    result.MessageType,
                    result.EndOfMessage,
                    CancellationToken.None);
            }
        }
    }
}

using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;

namespace SampleApp
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(async context =>
            {
                Console.WriteLine("{0} {1}{2}{3}",
                    context.Request.Method,
                    context.Request.PathBase,
                    context.Request.Path,
                    context.Request.QueryString);

                context.Response.ContentLength = 11;
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync("Hello world");
            });
        }
    }
}

Remove redundant websocket sample code.

Remove redundant websocket sample code.


// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System.Collections.Generic;
using osu.Framework.Event;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
using OpenTK;

namespace osu.Framework.Input
{
    public class UserInputManager : PassThroughInputManager
    {
        protected override IEnumerable<InputHandler> InputHandlers => Host.AvailableInputHandlers;

        protected override bool HandleHoverEvents => Host.Window?.CursorInWindow ?? true;

        public UserInputManager()
        {
            UseParentInput = false;
        }

        public override void HandleInputStateChange(InputStateChangeEvent inputStateChange)
        {
            if (inputStateChange is MousePositionChangeEvent mousePositionChange)
            {
                var mouse = mousePositionChange.InputState.Mouse;
                // confine cursor
                if (Host.Window != null && (Host.Window.CursorState & CursorState.Confined) > 0)
                    mouse.Position = Vector2.Clamp(mouse.Position, Vector2.Zero, new Vector2(Host.Window.Width, Host.Window.Height));
            }

            if (inputStateChange is MouseScrollChangeEvent)
            {
                if (Host.Window != null && !Host.Window.CursorInWindow) return;
            }

            base.HandleInputStateChange(inputStateChange);
        }
    }
}

// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System.Collections.Generic;
using osu.Framework.Event;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
using OpenTK;

namespace osu.Framework.Input
{
    public class UserInputManager : PassThroughInputManager
    {
        protected override IEnumerable<InputHandler> InputHandlers => Host.AvailableInputHandlers;

        protected override bool HandleHoverEvents => Host.Window?.CursorInWindow ?? true;

        public UserInputManager()
        {
            UseParentInput = false;
        }

        public override void HandleInputStateChange(InputStateChangeEvent inputStateChange)
        {
            switch (inputStateChange)
            {
                case MousePositionChangeEvent mousePositionChange:
                    var mouse = mousePositionChange.InputState.Mouse;
                    // confine cursor
                    if (Host.Window != null && (Host.Window.CursorState & CursorState.Confined) > 0)
                        mouse.Position = Vector2.Clamp(mouse.Position, Vector2.Zero, new Vector2(Host.Window.Width, Host.Window.Height));
                    break;

                case MouseScrollChangeEvent _:
                    if (Host.Window != null && !Host.Window.CursorInWindow)
                        return;
                    break;
            }

            base.HandleInputStateChange(inputStateChange);
        }
    }
}

Use switch instead of ifs

Use switch instead of ifs


using System;
using System.Linq;
using Autofac;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace Zermelo.App.UWP.Schedule
{
    public sealed partial class ScheduleView : Page
    {
        public ScheduleView()
        {
            this.InitializeComponent();

            NavigationCacheMode = NavigationCacheMode.Enabled;
        }

        ScheduleViewModel _viewModel;
        public ScheduleViewModel ViewModel => _viewModel ?? (_viewModel = (ScheduleViewModel)DataContext);

        private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            CalendarView.SelectedDates.Add(ViewModel.Date);
        }

        private void ScheduleListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            ViewModel.SelectedAppointment = e.ClickedItem as Appointment;
            Modal.IsModal = true;
        }

        private void CalendarView_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args)
        {
            if (args.AddedDates.Count > 0)
                ViewModel.Date = args.AddedDates.FirstOrDefault();
            else
                CalendarView.SelectedDates.Add(ViewModel.Date);
        }

        private void CalendarView_CalendarViewDayItemChanging(CalendarView sender, CalendarViewDayItemChangingEventArgs args)
        {
            var day = args.Item.Date.DayOfWeek;
            if (day == DayOfWeek.Saturday || day == DayOfWeek.Sunday)
                args.Item.IsBlackout = true;
        }
    }
}

using System;
using System.Linq;
using Autofac;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace Zermelo.App.UWP.Schedule
{
    public sealed partial class ScheduleView : Page
    {
        public ScheduleView()
        {
            this.InitializeComponent();

            NavigationCacheMode = NavigationCacheMode.Enabled;
        }

        ScheduleViewModel _viewModel;
        public ScheduleViewModel ViewModel => _viewModel ?? (_viewModel = (ScheduleViewModel)DataContext);

        private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (CalendarView.SelectedDates.Count < 1)
                CalendarView.SelectedDates.Add(ViewModel.Date);
        }

        private void ScheduleListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            ViewModel.SelectedAppointment = e.ClickedItem as Appointment;
            Modal.IsModal = true;
        }

        private void CalendarView_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args)
        {
            if (args.AddedDates.Count > 0)
                ViewModel.Date = args.AddedDates.FirstOrDefault();
            else
                CalendarView.SelectedDates.Add(ViewModel.Date);
        }

        private void CalendarView_CalendarViewDayItemChanging(CalendarView sender, CalendarViewDayItemChangingEventArgs args)
        {
            var day = args.Item.Date.DayOfWeek;
            if (day == DayOfWeek.Saturday || day == DayOfWeek.Sunday)
                args.Item.IsBlackout = true;
        }
    }
}

Fix crash when navigating back to ScheduleView

Because the Page got loaded, it tried to add the current date to CalendarView.SelectedDates, but since SelectionMode is set to a single item, it crashed when it loaded for the second time.


/*
 * Copyright (c) Dominick Baier, Brock Allen.  All rights reserved.
 * see license
 */
using System.Collections.Generic;

namespace Thinktecture.IdentityServer.WsFed.Models
{
    public class RelyingParty
    {
        public string Name { get; set; }
        public bool Enabled { get; set; }

        public string Realm { get; set; }
        public string ReplyUrl { get; set; }
        public string TokenType { get; set; }
        public int TokenLifeTime { get; set; }
        public Dictionary<string, string> ClaimMappings { get; set; }
    }
}

/*
 * Copyright (c) Dominick Baier, Brock Allen.  All rights reserved.
 * see license
 */
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;

namespace Thinktecture.IdentityServer.WsFed.Models
{
    public class RelyingParty
    {
        public string Name { get; set; }
        public bool Enabled { get; set; }

        public string Realm { get; set; }
        public string ReplyUrl { get; set; }
        public string TokenType { get; set; }
        public int TokenLifeTime { get; set; }
        public X509Certificate2 EncryptingCertificate { get; set; }
        public Dictionary<string, string> ClaimMappings { get; set; }
    }
}

Add encryption support to relying party model


namespace Umbraco.Core.Models.Entities
{
    /// <summary>
    /// Represents the path of a tree entity.
    /// </summary>
    public class TreeEntityPath
    {
        /// <summary>
        /// Gets or sets the identifier of the entity.
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the path of the entity.
        /// </summary>
        public string Path { get; set; }
    }
}

namespace Umbraco.Core.Models.Entities
{
    /// <summary>
    /// Represents the path of a tree entity.
    /// </summary>
    public class TreeEntityPath
    {
        /// <summary>
        /// Gets or sets the identifier of the entity.
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the path of the entity.
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// Proxy of the Id
        /// </summary>
        public int NodeId
        {
            get => Id;
            set => Id = value;
        }
    }
}

Fix issue where Id was not set when loading all entity paths


// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.

namespace PInvoke
{
    using System.Runtime.InteropServices;

    /// <content>
    /// Contains the <see cref="CHAR_INFO_ENCODING"/> nested type.
    /// </content>
    public partial class Kernel32
    {
        /// <summary>
        /// A union of the Unicode and Ascii encodings.
        /// </summary>
        [StructLayout(LayoutKind.Explicit)]
        public struct CHAR_INFO_ENCODING
        {
            /// <summary>
            /// Unicode character of a screen buffer character cell.
            /// </summary>
            [FieldOffset(0)]
            public ushort UnicodeChar;

            /// <summary>
            /// ANSI character of a screen buffer character cell.
            /// </summary>
            [FieldOffset(0)]
            public byte AsciiChar;
        }
    }
}

// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.

namespace PInvoke
{
    using System.Runtime.InteropServices;

    /// <content>
    /// Contains the <see cref="CHAR_INFO_ENCODING"/> nested type.
    /// </content>
    public partial class Kernel32
    {
        /// <summary>
        /// A union of the Unicode and Ascii encodings.
        /// </summary>
        [StructLayout(LayoutKind.Explicit)]
        public struct CHAR_INFO_ENCODING
        {
            /// <summary>
            /// Unicode character of a screen buffer character cell.
            /// </summary>
            [FieldOffset(0)]
            public char UnicodeChar;

            /// <summary>
            /// ANSI character of a screen buffer character cell.
            /// </summary>
            [FieldOffset(0)]
            public byte AsciiChar;
        }
    }
}

Use 'char' instead of 'ushort' for unicode character


@{
    ViewData["Title"] = "List of Articles I've Written";
}

Articles I've written

    <input type="text" class="search" placeholder="Filter by title/tag">

Monday Aug 28

Change Kestrel default url on Asp Net Core

            asp net core
            asp net core
            asp net core

Monday Aug 28

Change Kestrel default url on Asp Net Core

            asp net core
            asp net core
            asp net core

Monday Aug 28

Change Kestrel default url on Asp Net Core

            asp net core
            asp net core
            asp net core

Monday Aug 28

Change Kestrel default url on Asp Net Core

            asp net core
            asp net core
            asp net core

    Previous
    1
    2
    Next

@model IEnumerable<ArticleModel>
@{
    ViewData["Title"] = "List of Articles I've Written";
}

Articles I've written

    <input type="text" class="search" placeholder="Filter by title/tag">

    @foreach (var article in Model)
    {

@article.FormattedPublishedAt()

@article.Title

            @foreach (var tag in article.Tags)
            {
            @tag
            }

    }

Change static content to dynamic

Change static content to dynamic


using System;
using System.Numerics;

namespace DynamixelServo.Quadruped
{
    public class BasicQuadrupedGaitEngine : QuadrupedGaitEngine
    {
        private const int Speed = 10;

        private const int MaxForward = 5;
        private const int MinForward = -5;

        private const int LegDistance = 15;
        private const int LegHeight = -13;

        private bool _movingForward;
        private Vector3 _lastWrittenPosition = Vector3.Zero;

        public BasicQuadrupedGaitEngine(QuadrupedIkDriver driver) : base(driver)
        {
            Driver.Setup();
            Driver.StandUpfromGround();
            StartEngine();
        }

        protected override void EngineSpin()
        {
            var translate = Vector3.Zero;
            if (_movingForward)
            {
                translate.Y += Speed * 0.001f * TimeSincelastTick;
            }
            else
            {
                translate.Y -= Speed * 0.001f * TimeSincelastTick;
            }
            _lastWrittenPosition += translate;
            if (_movingForward && _lastWrittenPosition.Y > MaxForward)
            {
                _movingForward = false;
            }
            else if (!_movingForward && _lastWrittenPosition.Y < MinForward)
            {
                _movingForward = true;
            }
            Driver.MoveAbsoluteCenterMass(_lastWrittenPosition, LegDistance, LegHeight);
        }
    }
}

using System;
using System.Numerics;

namespace DynamixelServo.Quadruped
{
    public class BasicQuadrupedGaitEngine : QuadrupedGaitEngine
    {
        private const int Speed = 12;

        private int _currentIndex;

        private readonly Vector3[] _positions =
        {
            new Vector3(-5, 5, 3),
            new Vector3(5, 5, -3),
            new Vector3(5, -5, 3),
            new Vector3(-5, -5, -3)
        };

        private const float LegHeight = -11f;
        private const int LegDistance = 15;

        private Vector3 _lastWrittenPosition = Vector3.Zero;

        public BasicQuadrupedGaitEngine(QuadrupedIkDriver driver) : base(driver)
        {
            Driver.Setup();
            Driver.StandUpfromGround();
            StartEngine();
        }

        protected override void EngineSpin()
        {
            if (_lastWrittenPosition.Similar(_positions[_currentIndex], 0.25f))
            {
                _currentIndex++;
                if (_currentIndex >= _positions.Length)
                {
                    _currentIndex = 0;
                }
            }
            _lastWrittenPosition =
                _lastWrittenPosition.MoveTowards(_positions[_currentIndex], Speed * 0.001f * TimeSincelastTick);
            Driver.MoveAbsoluteCenterMass(_lastWrittenPosition, LegDistance, LegHeight);
        }
    }
}

Add simple interpolated motion driver

Add simple interpolated motion driver


namespace AnimalHope.Web
{
    using System.Web;
    using System.Web.Mvc;

    public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }
    }
}

namespace AnimalHope.Web
{
    using System.Web;
    using System.Web.Mvc;

    public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
            filters.Add(new ValidateInputAttribute(false));
        }
    }
}

Handle correctly the special HTML characters and tags


using System.Diagnostics;
using CommonBotLibrary.Interfaces.Models;
using RedditSharp.Things;

namespace CommonBotLibrary.Services.Models
{
    [DebuggerDisplay("{Url, nq}")]
    public class RedditResult : IWebpage
    {
        public RedditResult(Post post)
        {
            Title = post.Title;
            Url = post.Url.OriginalString;

            Post = post;
        }

        /// <summary>
        ///   The wrapped model returned by RedditSharp with more submission props.
        /// </summary>
        public Post Post { get; }
        public string Url { get; set; }
        public string Title { get; set; }

        public static implicit operator Post(RedditResult redditResult)
            => redditResult.Post;

        public enum PostCategory
        {
            New,
            Controversial,
            Rising,
            Hot,
            Top
        }
    }
}

using System.Diagnostics;
using CommonBotLibrary.Interfaces.Models;
using RedditSharp.Things;

namespace CommonBotLibrary.Services.Models
{
    [DebuggerDisplay("{Url, nq}")]
    public class RedditResult : IWebpage
    {
        public RedditResult(Post post)
        {
            Title = post.Title;
            Url = post.Url.OriginalString;

            Post = post;
        }

        /// <summary>
        ///   The wrapped model returned by RedditSharp with more submission props.
        /// </summary>
        public Post Post { get; }
        public string Url { get; set; }
        public string Title { get; set; }

        public static implicit operator Post(RedditResult redditResult)
            => redditResult.Post;

        public enum PostCategory
        {
            Hot,
            New,
            Controversial,
            Rising,
            Top
        }
    }
}

Make Hot the default reddit post category


// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;

namespace Roslyn.Test.Utilities
{
    public static class WaitHelper
    {
        public static void WaitForDispatchedOperationsToComplete(DispatcherPriority priority)
        {
            new FrameworkElement().Dispatcher.DoEvents();
        }

        public static void PumpingWait(this Task task)
        {
            PumpingWaitAll(new[] { task });
        }

        public static T PumpingWaitResult<T>(this Task<T> task)
        {
            PumpingWait(task);
            return task.Result;
        }

        public static void PumpingWaitAll(this IEnumerable<Task> tasks)
        {
            var smallTimeout = TimeSpan.FromMilliseconds(10);
            var taskArray = tasks.ToArray();
            var done = false;
            while (!done)
            {
                done = Task.WaitAll(taskArray, smallTimeout);
                if (!done)
                {
                    WaitForDispatchedOperationsToComplete(DispatcherPriority.ApplicationIdle);
                }
            }

            foreach (var task in tasks)
            {
                if (task.Exception != null)
                {
                    throw task.Exception;
                }
            }
        }
    }
}

// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;

namespace Roslyn.Test.Utilities
{
    public static class WaitHelper
    {
        public static void WaitForDispatchedOperationsToComplete(DispatcherPriority priority)
        {
            Action action = delegate { };
            new FrameworkElement().Dispatcher.Invoke(action, priority);
        }

        public static void PumpingWait(this Task task)
        {
            PumpingWaitAll(new[] { task });
        }

        public static T PumpingWaitResult<T>(this Task<T> task)
        {
            PumpingWait(task);
            return task.Result;
        }

        public static void PumpingWaitAll(this IEnumerable<Task> tasks)
        {
            var smallTimeout = TimeSpan.FromMilliseconds(10);
            var taskArray = tasks.ToArray();
            var done = false;
            while (!done)
            {
                done = Task.WaitAll(taskArray, smallTimeout);
                if (!done)
                {
                    WaitForDispatchedOperationsToComplete(DispatcherPriority.ApplicationIdle);
                }
            }

            foreach (var task in tasks)
            {
                if (task.Exception != null)
                {
                    throw task.Exception;
                }
            }
        }
    }
}

Revert change to pump in the wrong spot.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;

namespace AppHarbor
{
	class Program
	{
		static void Main(string[] args)
		{
			var container = new WindsorContainer()
				.Install(new AppHarborInstaller());

			var commandDispatcher = container.Resolve<CommandDispatcher>();

			try
			{
				commandDispatcher.Dispatch(args);
			}
			catch (DispatchException exception)
			{
				Console.WriteLine();
				Console.WriteLine("Error: {0}", exception.Message);
			}
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;

namespace AppHarbor
{
	class Program
	{
		static void Main(string[] args)
		{
			var container = new WindsorContainer()
				.Install(new AppHarborInstaller());

			var commandDispatcher = container.Resolve<CommandDispatcher>();

			try
			{
				commandDispatcher.Dispatch(args);
			}
			catch (DispatchException exception)
			{
				Console.WriteLine();
				using (new ForegroundColor(ConsoleColor.Red))
				{
					Console.WriteLine("Error: {0}", exception.Message);
				}
			}
		}
	}
}

Use red color when outputting error message


using System;
using System.Linq;
using System.Windows.Forms;
using NBi.UI.Genbi.Presenter;

namespace NBi.UI.Genbi.View.TestSuiteGenerator
{
    public partial class SettingsControl : UserControl
    {
        public SettingsControl()
        {
            InitializeComponent();
        }

        internal void DataBind(SettingsPresenter presenter)
        {
            if (presenter != null)
            {
                settingsName.DataSource = presenter.SettingsNames;

                settingsName.DataBindings.Add("SelectedItem", presenter, "SettingsNameSelected", true, DataSourceUpdateMode.OnValidation);
                settingsName.SelectedIndexChanged += (s, args) => settingsName.DataBindings["SelectedItem"].WriteValue();
                settingsValue.DataBindings.Add("Text", presenter, "SettingsValue", true, DataSourceUpdateMode.OnPropertyChanged);
            }
        }

        public Button AddCommand
        {
            get {return addReference;}
        }

        public Button RemoveCommand
        {
            get { return removeReference; }
        }

    }
}

using System;
using System.Linq;
using System.Windows.Forms;
using NBi.UI.Genbi.Presenter;

namespace NBi.UI.Genbi.View.TestSuiteGenerator
{
    public partial class SettingsControl : UserControl
    {
        public SettingsControl()
        {
            InitializeComponent();
        }

        internal void DataBind(SettingsPresenter presenter)
        {
            if (presenter != null)
            {
                settingsName.DataSource = presenter.SettingsNames;

                settingsName.DataBindings.Add("SelectedItem", presenter, "SettingsNameSelected", true, DataSourceUpdateMode.OnValidation);
                settingsName.SelectedIndexChanged += (s, args) => settingsName.DataBindings["SelectedItem"].WriteValue();
                settingsValue.TextChanged += (s, args) => presenter.UpdateValue((string)settingsName.SelectedValue, settingsValue.Text);
                settingsValue.DataBindings.Add("Text", presenter, "SettingsValue", true, DataSourceUpdateMode.OnPropertyChanged);
            }
        }

        private void toto(object s, EventArgs args)
        {
            MessageBox.Show("Hello");
        }

        public Button AddCommand
        {
            get {return addReference;}
        }

        public Button RemoveCommand
        {
            get { return removeReference; }
        }

    }
}

Fix issue that the changes to the connection strings were not registered before you're changing the focus to another connection string.