using System.IO;
using System.Linq;
using SpotifyRecorder.Core.Abstractions.Entities;
using SpotifyRecorder.Core.Abstractions.Services;
using TagLib;
using TagLib.Id3v2;
using File = TagLib.File;

namespace SpotifyRecorder.Core.Implementations.Services
{
    public class ID3TagService : IID3TagService
    {
        public ID3Tags GetTags(RecordedSong song)
        {
            var tagFile = File.Create(new MemoryFileAbstraction(new MemoryStream(song.Data)));

            return new ID3Tags
            {
                Title = tagFile.Tag.Title,
                Artists = tagFile.Tag.Performers,
                Picture = tagFile.Tag.Pictures.FirstOrDefault()?.Data.Data
            };
        }

        public void UpdateTags(ID3Tags tags, RecordedSong song)
        {
            using (var stream = new MemoryStream(song.Data.Length + 1000))
            {
                stream.Write(song.Data, 0, song.Data.Length);
                stream.Position = 0;

                var tagFile = File.Create(new MemoryFileAbstraction(stream));

                tagFile.Tag.Title = tags.Title;
                tagFile.Tag.Performers = tags.Artists;

                if (tags.Picture != null)
                {
                    tagFile.Tag.Pictures = new IPicture[]
                    {
                        new Picture(new ByteVector(tags.Picture, tags.Picture.Length)),
                    };
                }

                tagFile.Save();

                song.Data = stream.ToArray();
            }
        }
    }
}

using System.IO;
using System.Linq;
using SpotifyRecorder.Core.Abstractions.Entities;
using SpotifyRecorder.Core.Abstractions.Services;
using TagLib;
using TagLib.Id3v2;
using File = TagLib.File;

namespace SpotifyRecorder.Core.Implementations.Services
{
    public class ID3TagService : IID3TagService
    {
        public ID3Tags GetTags(RecordedSong song)
        {
            var tagFile = File.Create(new MemoryFileAbstraction(new MemoryStream(song.Data)));

            return new ID3Tags
            {
                Title = tagFile.Tag.Title,
                Artists = tagFile.Tag.Performers,
                Picture = tagFile.Tag.Pictures.FirstOrDefault()?.Data.Data
            };
        }

        public void UpdateTags(ID3Tags tags, RecordedSong song)
        {
            using (var stream = new MemoryStream(song.Data.Length * 2))
            {
                stream.Write(song.Data, 0, song.Data.Length);
                stream.Position = 0;

                var tagFile = File.Create(new MemoryFileAbstraction(stream));

                tagFile.Tag.Title = tags.Title;
                tagFile.Tag.Performers = tags.Artists;

                if (tags.Picture != null)
                {
                    tagFile.Tag.Pictures = new IPicture[]
                    {
                        new Picture(new ByteVector(tags.Picture, tags.Picture.Length)),
                    };
                }

                tagFile.Save();

                song.Data = stream.ToArray();
            }
        }
    }
}

Improve how much space we reserve for tag changes


using System.Collections.Generic;
using Autofac.Core;

namespace Autofac
{
    /// <summary>
    /// The details of an individual request to resolve a service.
    /// </summary>
    public class ResolveRequest
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ResolveRequest"/> class.
        /// </summary>
        /// <param name="service">The service being resolved.</param>
        /// <param name="registration">The component registration for the service.</param>
        /// <param name="parameters">The parameters used when resolving the service.</param>
        /// <param name="decoratorTarget">The target component to be decorated.</param>
        public ResolveRequest(Service service, IComponentRegistration registration, IEnumerable<Parameter> parameters, IComponentRegistration? decoratorTarget = null)
        {
            Service = service;
            Registration = registration;
            Parameters = parameters;
            DecoratorTarget = decoratorTarget;
        }

        /// <summary>
        /// Gets the service being resolved.
        /// </summary>
        public Service Service { get; }

        /// <summary>
        /// Gets the component registration for the service being resolved.
        /// </summary>
        public IComponentRegistration Registration { get; }

        /// <summary>
        /// Gets the parameters used when resolving the service.
        /// </summary>
        public IEnumerable<Parameter> Parameters { get; }

        /// <summary>
        /// Gets the component registration for the decorator target if configured.
        /// </summary>2
        public IComponentRegistration? DecoratorTarget { get; }
    }
}

using System.Collections.Generic;
using Autofac.Core;

namespace Autofac
{
    /// <summary>
    /// The details of an individual request to resolve a service.
    /// </summary>
    public class ResolveRequest
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ResolveRequest"/> class.
        /// </summary>
        /// <param name="service">The service being resolved.</param>
        /// <param name="registration">The component registration for the service.</param>
        /// <param name="parameters">The parameters used when resolving the service.</param>
        /// <param name="decoratorTarget">The target component to be decorated.</param>
        public ResolveRequest(Service service, IComponentRegistration registration, IEnumerable<Parameter> parameters, IComponentRegistration? decoratorTarget = null)
        {
            Service = service;
            Registration = registration;
            Parameters = parameters;
            DecoratorTarget = decoratorTarget;
        }

        /// <summary>
        /// Gets the service being resolved.
        /// </summary>
        public Service Service { get; }

        /// <summary>
        /// Gets the component registration for the service being resolved.
        /// </summary>
        public IComponentRegistration Registration { get; }

        /// <summary>
        /// Gets the parameters used when resolving the service.
        /// </summary>
        public IEnumerable<Parameter> Parameters { get; }

        /// <summary>
        /// Gets the component registration for the decorator target if configured.
        /// </summary>
        public IComponentRegistration? DecoratorTarget { get; }
    }
}

Remove extra char that sneaked onto XML comment


// Copyright © 2010-2015 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 CefSharp.Internals;

namespace CefSharp
{
    internal static class InternalWebBrowserExtensions
    {
        internal static void SetHandlersToNull(this IWebBrowserInternal browser)
        {
            browser.ResourceHandlerFactory = null;
            browser.JsDialogHandler = null;
            browser.DialogHandler = null;
            browser.DownloadHandler = null;
            browser.KeyboardHandler = null;
            browser.LifeSpanHandler = null;
            browser.MenuHandler = null;
            browser.FocusHandler = null;
            browser.RequestHandler = null;
            browser.DragHandler = null;
            browser.GeolocationHandler = null;
        }
    }
}

// Copyright © 2010-2015 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 CefSharp.Internals;

namespace CefSharp
{
    internal static class InternalWebBrowserExtensions
    {
        internal static void SetHandlersToNull(this IWebBrowserInternal browser)
        {
            browser.DialogHandler = null;
            browser.RequestHandler = null;
            browser.DisplayHandler = null;
            browser.LoadHandler = null;
            browser.LifeSpanHandler = null;
            browser.KeyboardHandler = null;
            browser.JsDialogHandler = null;
            browser.DragHandler = null;
            browser.DownloadHandler = null;
            browser.MenuHandler = null;
            browser.FocusHandler = null;
            browser.ResourceHandlerFactory = null;
            browser.GeolocationHandler = null;
            browser.RenderProcessMessageHandler = null;
        }
    }
}

Set RenderProcessMessageHandler and LoadHandler to null on Dispose Reoder so they match the order in IWebBrowser so they're easier to compare


/*
Copyright 2015 Google Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

using System.Reflection;

// Attributes common to all assemblies.

[assembly: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright 2016 Google Inc")]

[assembly: AssemblyVersion("1.11.0.*")]

[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

/*
Copyright 2015 Google Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

using System.Reflection;

// Attributes common to all assemblies.

[assembly: AssemblyCompany("Google Inc")]
[assembly: AssemblyCopyright("Copyright 2016 Google Inc")]

[assembly: AssemblyVersion("1.11.0.0")]

[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Fix revision number of support libraries to 0

Otherwise the libraries built from the Net45 and Portable projects
end up with different versions and strongnames.


using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;

namespace NuGetGallery
{
    public class PerFieldAnalyzer : PerFieldAnalyzerWrapper
    {
        public PerFieldAnalyzer()
            : base(new StandardAnalyzer(LuceneCommon.LuceneVersion), CreateFieldAnalyzers())
        {
        }

        private static IDictionary CreateFieldAnalyzers()
        {
            return new Dictionary<string, Analyzer>(StringComparer.OrdinalIgnoreCase)
            {
                { "Title", new TitleAnalyzer() }
            };
        }

        class TitleAnalyzer : Analyzer
        {
            private readonly Analyzer innerAnalyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion);

            public override TokenStream TokenStream(string fieldName, TextReader reader)
            {
                // Split the title based on IdSeparators, then run it through the standardAnalyzer
                string title = reader.ReadToEnd();
                string partiallyTokenized = String.Join(" ", title.Split(LuceneIndexingService.IdSeparators, StringSplitOptions.RemoveEmptyEntries));
                return innerAnalyzer.TokenStream(fieldName, new StringReader(partiallyTokenized));
            }
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;

namespace NuGetGallery
{
    public class PerFieldAnalyzer : PerFieldAnalyzerWrapper
    {
        public PerFieldAnalyzer()
            : base(new StandardAnalyzer(LuceneCommon.LuceneVersion), CreateFieldAnalyzers())
        {
        }

        private static IDictionary CreateFieldAnalyzers()
        {
            // For idAnalyzer we use the 'standard analyzer' but with no stop words (In, Of, The, etc are indexed).
            var stopWords = new Hashtable();
            StandardAnalyzer idAnalyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion, stopWords);

            return new Dictionary<string, Analyzer>(StringComparer.OrdinalIgnoreCase)
            {
                { "Id", idAnalyzer },
                { "Title", new TitleAnalyzer() },
            };
        }

        class TitleAnalyzer : Analyzer
        {
            private readonly StandardAnalyzer innerAnalyzer;

            public TitleAnalyzer()
            {
                // For innerAnalyzer we use the 'standard analyzer' but with no stop words (In, Of, The, etc are indexed).
                var stopWords = new Hashtable();
                innerAnalyzer = new StandardAnalyzer(LuceneCommon.LuceneVersion, stopWords);
            }

            public override TokenStream TokenStream(string fieldName, TextReader reader)
            {
                // Split the title based on IdSeparators, then run it through the innerAnalyzer
                string title = reader.ReadToEnd();
                string partiallyTokenized = String.Join(" ", title.Split(LuceneIndexingService.IdSeparators, StringSplitOptions.RemoveEmptyEntries));
                return innerAnalyzer.TokenStream(fieldName, new StringReader(partiallyTokenized));
            }
        }
    }
}

Stop filtering out stop words in package ids and titles.


using slang.Lexing.Rules.Extensions;
using slang.Lexing.Trees.Nodes;

namespace slang.Lexing.Trees.Transformers
{
    public static class OptionRuleExtensions
    {
        public static Node Transform (this Option rule, Node parent)
        {
            var option = rule.Value.Transform (parent);
            return option;
        }
    }
}

using slang.Lexing.Rules.Extensions;
using slang.Lexing.Trees.Nodes;

namespace slang.Lexing.Trees.Transformers
{
    public static class OptionRuleExtensions
    {
        public static Tree Transform (this Option rule, Node parent)
        {
            return new Tree ();
        }
    }
}

Implement transform to tree for option as skeleton only


using NUnit.Framework;

namespace VersionOne.SDK.APIClient.Tests.QueryTests
{
    [TestFixture]
    public class QueryFindTester
    {

        private EnvironmentContext _context;

        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _context = new EnvironmentContext();
        }

        [TestFixtureTearDown]
        public void TestFixtureTearDown()
        {
            _context = null;
        }

        [Test]
        public void FindMemberTest()
        {
            var assetType = _context.MetaModel.GetAssetType("Member");
            var query = new Query(assetType);
            var nameAttribute = assetType.GetAttributeDefinition("Username");
            query.Selection.Add(nameAttribute);
            query.Find = new QueryFind("admin", new AttributeSelection("Username", assetType));
            QueryResult result = _context.Services.Retrieve(query);
            Assert.AreEqual(1, result.TotalAvaliable);
        }
    }
}

using NUnit.Framework;

namespace VersionOne.SDK.APIClient.Tests.QueryTests
{
    [TestFixture]
    public class QueryFindTester
    {

        private EnvironmentContext _context;

        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _context = new EnvironmentContext();
        }

        [TestFixtureTearDown]
        public void TestFixtureTearDown()
        {
            _context = null;

        }

        [Test]
        public void FindMemberTest()
        {
            var memberType = _context.MetaModel.GetAssetType("Member");
            var memberQuery = new Query(memberType);
            var userNameAttr = memberType.GetAttributeDefinition("Username");
            memberQuery.Selection.Add(userNameAttr);
            memberQuery.Find = new QueryFind("admin", new AttributeSelection("Username", memberType));
            QueryResult result = _context.Services.Retrieve(memberQuery);
            foreach (var member in result.Assets)
            {
                var name = member.GetAttribute(userNameAttr).Value as string;
                Assert.IsNotNullOrEmpty(name);
                if (name != null) Assert.That(name.IndexOf("admin") > -1);
            }
        }
    }
}

Test that finds members with "admin" in username now works when there's more than one.


using System;
using System.IO;
using System.Windows;
using System.Windows.Threading;
using Pingy.Common;

namespace Pingy.Gui
{
    public partial class App : Application
    {
        private readonly static string defaultDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        private readonly static string defaultFileName = "Pingy.txt";

        private readonly static string defaultFilePath = Path.Combine(defaultDirectory, defaultFileName);

        public App()
            : this(defaultFilePath)
        { }

        public App(string path)
        {
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            InitializeComponent();

            MainWindowViewModel viewModel = new MainWindowViewModel(path);

            MainWindow = new MainWindow(viewModel);

            MainWindow.Show();
        }

        private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            if (e.Exception is Exception ex)
            {
                Log.Exception(ex, true);
            }
            else
            {
                Log.Message("an empty unhandled exception occurred");
            }
        }
    }
}

using System;
using System.IO;
using System.Windows;
using System.Windows.Threading;
using Pingy.Common;

namespace Pingy.Gui
{
    public partial class App : Application
    {
        private static readonly string defaultDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        private const string defaultFileName = "Pingy.txt";

        private readonly static string defaultFilePath = Path.Combine(defaultDirectory, defaultFileName);

        public App()
            : this(defaultFilePath)
        { }

        public App(string path)
        {
            if (String.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            InitializeComponent();

            MainWindowViewModel viewModel = new MainWindowViewModel(path);

            MainWindow = new MainWindow(viewModel);

            MainWindow.Show();
        }

        private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            if (e.Exception is Exception ex)
            {
                Log.Exception(ex, true);
            }
            else
            {
                Log.Message("an empty unhandled exception occurred");
            }
        }
    }
}

Mark field as const instead of static readonly


// 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.Graphics;
using osu.Game.Rulesets.UI;
using osuTK;

namespace osu.Game.Rulesets.Taiko.UI
{
    public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
    {
        private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
        private const float default_aspect = 16f / 9f;

        public TaikoPlayfieldAdjustmentContainer()
        {
            Anchor = Anchor.CentreLeft;
            Origin = Anchor.CentreLeft;
        }

        protected override void Update()
        {
            base.Update();

            float aspectAdjust = Math.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
            Size = new Vector2(1, default_relative_height * aspectAdjust);
        }
    }
}

// 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.Graphics;
using osu.Game.Rulesets.UI;
using osuTK;

namespace osu.Game.Rulesets.Taiko.UI
{
    public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
    {
        private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
        private const float default_aspect = 16f / 9f;

        protected override void Update()
        {
            base.Update();

            float aspectAdjust = Math.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
            Size = new Vector2(1, default_relative_height * aspectAdjust);

            // Position the taiko playfield exactly one playfield from the top of the screen.
            RelativePositionAxes = Axes.Y;
            Y = Size.Y;
        }
    }
}

Reposition taiko playfield to be closer to the top of the screen


namespace NuGetPackageVisualizer
{
    public class DgmlColorConfiguration : IColorConfiguration
    {
        public string VersionMismatchPackageColor
        {
            get { return "#FF0000"; }
        }

        public string PackageHasDifferentVersionsColor
        {
            get { return "#FCE428"; }
        }

        public string DefaultColor
        {
            get { return "#15FF00"; }
        }
    }
}

namespace NuGetPackageVisualizer
{
    public class DgmlColorConfiguration : IColorConfiguration
    {
        public string VersionMismatchPackageColor
        {
            get { return "#FF0000"; }
        }

        public string PackageHasDifferentVersionsColor
        {
            get { return "#FCE428"; }
        }

        public string DefaultColor
        {
            get { return "#339933"; }
        }
    }
}

Make the green slightly darker, so that the text is readable.


using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using Slp.Evi.Storage;
using Slp.Evi.Storage.Bootstrap;
using Slp.Evi.Storage.Database;

namespace Slp.Evi.Test.System.Sparql
{
    public abstract class SparqlFixture
    {
        private readonly ConcurrentDictionary<string, EviQueryableStorage> _storages = new ConcurrentDictionary<string, EviQueryableStorage>();

        private IEviQueryableStorageFactory GetStorageFactory()
        {
            var loggerFactory = new LoggerFactory();

            if (Environment.GetEnvironmentVariable("APPVEYOR") != "True")
            {
                loggerFactory.AddConsole(LogLevel.Trace);
            }

            return new DefaultEviQueryableStorageFactory(loggerFactory);
        }

        public EviQueryableStorage GetStorage(string storageName)
        {
            return _storages.GetOrAdd(storageName, CreateStorage);
        }

        private EviQueryableStorage CreateStorage(string storageName)
        {
            return SparqlTestHelpers.InitializeDataset(storageName, GetSqlDb(), GetStorageFactory());
        }

        protected abstract ISqlDatabase GetSqlDb();
    }
}

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using Slp.Evi.Storage;
using Slp.Evi.Storage.Bootstrap;
using Slp.Evi.Storage.Database;

namespace Slp.Evi.Test.System.Sparql
{
    public abstract class SparqlFixture
    {
        private readonly ConcurrentDictionary<string, EviQueryableStorage> _storages = new ConcurrentDictionary<string, EviQueryableStorage>();

        private IEviQueryableStorageFactory GetStorageFactory()
        {
            var loggerFactory = new LoggerFactory();

            //if (Environment.GetEnvironmentVariable("APPVEYOR") != "True")
            //{
            //    loggerFactory.AddConsole(LogLevel.Trace);
            //}

            return new DefaultEviQueryableStorageFactory(loggerFactory);
        }

        public EviQueryableStorage GetStorage(string storageName)
        {
            return _storages.GetOrAdd(storageName, CreateStorage);
        }

        private EviQueryableStorage CreateStorage(string storageName)
        {
            return SparqlTestHelpers.InitializeDataset(storageName, GetSqlDb(), GetStorageFactory());
        }

        protected abstract ISqlDatabase GetSqlDb();
    }
}

Disable logging so the performance profiling is more accurate.


using LazyLibrary.Storage;
using LazyLibrary.Storage.Memory;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace LazyLibrary.Tests.Storage.Memory
{
    [TestClass]
    public class MemoryRepositoryTests
    {
        [TestMethod]
        public void CanAdd()
        {
            var repo = new MemoryRepository<TestObject>();
            var obj = new TestObject();

            repo.Upsert(obj);

            Assert.IsTrue(repo.Get().Any(), "The object could not be added to the repository");
        }

        [TestMethod]
        public void CanGetById()
        {
            var repo = new MemoryRepository<TestObject>();
            var obj = new TestObject();

            repo.Upsert(obj);

            Assert.IsNotNull(repo.GetById(1), "The object could not be retrieved from the repository");
        }
    }
}

using LazyLibrary.Storage;
using LazyLibrary.Storage.Memory;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace LazyLibrary.Tests.Storage.Memory
{
    [TestClass]
    public class MemoryRepositoryTests
    {
        [TestMethod]
        public void CanAdd()
        {
            var repo = new MemoryRepository<TestObject>();
            var obj = new TestObject();

            repo.Upsert(obj);

            Assert.IsTrue(repo.Get().Any(), "The object could not be added to the repository");
        }

        [TestMethod]
        public void CanGetById()
        {
            var repo = new MemoryRepository<TestObject>();
            var obj = new TestObject();

            repo.Upsert(obj);

            Assert.IsNotNull(repo.GetById(1), "The object could not be retrieved from the repository");
        }

        [TestMethod]
        public void CanGetByLINQ()
        {
            var repo = new MemoryRepository<TestObject>();
            var objOne = new TestObject() { Name = "one" };
            var objTwo = new TestObject() { Name = "two" };

            repo.Upsert(objOne);
            repo.Upsert(objTwo);

            var result = repo.Get(x => x.Name == "one").SingleOrDefault();

            Assert.IsNotNull(result, "The object could not be retrieved from the repository");
            Assert.IsTrue(result.Equals(objOne), "The object could not be retrieved from the repository");
        }
    }
}

Test can get by LINQ statement

Test can get by LINQ statement


using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework.Constraints;

namespace NUnit.Framework.Api
{
    [TestFixture]
    public class NUnitIssue52
    {
        class SelfContainer : IEnumerable
        {
            public IEnumerator GetEnumerator() { yield return this; }
        }

        [Test]
        public void SelfContainedItemFoundInArray()
        {
            var item = new SelfContainer();
            var items = new SelfContainer[] { new SelfContainer(), item };

            // work around
            //Assert.True(((ICollection<SelfContainer>)items).Contains(item));

            // causes StackOverflowException
            //Assert.Contains(item, items);

            var equalityComparer = new NUnitEqualityComparer();
            var tolerance = Tolerance.Default;
            var equal = equalityComparer.AreEqual(item, items, ref tolerance);
            Assert.IsFalse(equal);
            //Console.WriteLine("test completed");
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using NUnit.Framework.Constraints;

namespace NUnit.Framework.Api
{
    [TestFixture]
    public class NUnitIssue52
    {
        [TestCaseSource(nameof(GetTestCases))]
        public void SelfContainedItemFoundInCollection<T>(T x, ICollection y)
        {
            var equalityComparer = new NUnitEqualityComparer();
            var tolerance = Tolerance.Default;
            var actualResult = equalityComparer.AreEqual(x, y, ref tolerance);

            Assert.IsFalse(actualResult);
            Assert.Contains(x, y);
        }

        [TestCaseSource(nameof(GetTestCases))]
        public void SelfContainedItemDoesntRecurseForever<T>(T x, ICollection y)
        {
            var equalityComparer = new NUnitEqualityComparer();
            var tolerance = Tolerance.Default;
            equalityComparer.ExternalComparers.Add(new DetectRecursionComparer(30));

            Assert.DoesNotThrow(() =>
            {
                var equality = equalityComparer.AreEqual(x, y, ref tolerance);
                Assert.IsFalse(equality);
                Assert.Contains(x, y);
            });
        }

        public static IEnumerable<TestCaseData> GetTestCases()
        {
            var item = new SelfContainer();
            var items = new SelfContainer[] { new SelfContainer(), item };

            yield return new TestCaseData(item, items);
        }

        private class DetectRecursionComparer : EqualityAdapter
        {
            private readonly int maxRecursion;

            [MethodImpl(MethodImplOptions.NoInlining)]
            public DetectRecursionComparer(int maxRecursion)
            {
                var callerDepth = new StackTrace().FrameCount - 1;
                this.maxRecursion = callerDepth + maxRecursion;
            }

            [MethodImpl(MethodImplOptions.NoInlining)]
            public override bool CanCompare(object x, object y)
            {
                var currentDepth = new StackTrace().FrameCount - 1;
                return currentDepth >= maxRecursion;
            }

            public override bool AreEqual(object x, object y)
            {
                throw new InvalidOperationException("Recurses");
            }
        }

        private class SelfContainer : IEnumerable
        {
            public IEnumerator GetEnumerator() { yield return this; }
        }
    }
}

Add test explicitly checking recursion

Add test explicitly checking recursion


namespace Serilog
{
    using System.IO;

    /// <summary>
    /// Enables hooking into log file lifecycle events
    /// </summary>
    public abstract class FileLifecycleHooks
    {
        /// <summary>
        /// Wraps <paramref name="sourceStream"/> in another stream, such as a GZipStream, then returns the wrapped stream
        /// </summary>
        /// <param name="sourceStream">The source log file stream</param>
        /// <returns>The wrapped stream</returns>
        public abstract Stream Wrap(Stream sourceStream);
    }
}

namespace Serilog
{
    using System.IO;

    /// <summary>
    /// Enables hooking into log file lifecycle events
    /// </summary>
    public abstract class FileLifecycleHooks
    {
        /// <summary>
        /// Wraps <paramref name="underlyingStream"/> in another stream, such as a GZipStream, then returns the wrapped stream
        /// </summary>
        /// <remarks>
        /// Serilog is responsible for disposing of the wrapped stream
        /// </remarks>
        /// <param name="underlyingStream">The underlying log file stream</param>
        /// <returns>The wrapped stream</returns>
        public abstract Stream Wrap(Stream underlyingStream);
    }
}

Add docs re wrapped stream ownership

Add docs re wrapped stream ownership


using System;
using System.Collections.Generic;
using System.Linq;

namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
	internal class ArraySerializationDelegateProvider : SerializationDelegateProviderBase
	{
		public override bool CanHandle(Type type)
		{
			return type.IsArray;
		}

		protected override Type[] GetTypeArguments(Type type)
		{
			return new[] { type.GetElementType() };
		}

		private static JsonValue _Encode<T>(T[] array, JsonSerializer serializer)
		{
			var json = new JsonArray();
			json.AddRange(array.Select(serializer.Serialize));
			return json;
		}
		private static T[] _Decode<T>(JsonValue json, JsonSerializer serializer)
		{
			var list = new List<T>();
			list.AddRange(json.Array.Select(serializer.Deserialize<T>));
			return list.ToArray();
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
	internal class ArraySerializationDelegateProvider : SerializationDelegateProviderBase
	{
		public override bool CanHandle(Type type)
		{
			return type.IsArray;
		}

		protected override Type[] GetTypeArguments(Type type)
		{
			return new[] { type.GetElementType() };
		}

		private static JsonValue _Encode<T>(T[] array, JsonSerializer serializer)
		{
			var values = new JsonValue[array.Length];
			for (int ii = 0; ii < array.Length; ++ii)
			{
				values[ii] = serializer.Serialize(array[ii]);
			}
			return new JsonArray(values);
		}
		private static T[] _Decode<T>(JsonValue json, JsonSerializer serializer)
		{
			var array = json.Array;
			var values = new T[array.Count];
			for (int ii = 0; ii < array.Count; ++ii)
			{
				values[ii] = serializer.Deserialize<T>(array[ii]);
			}
			return values;
		}
	}
}

Decrease allocations during array serialization/deserialization


using System;
using System.IO;
using Compilify.Models;

namespace Compilify.Services
{
    public class CSharpExecutor
    {
        public CSharpExecutor()
            : this(new CSharpCompilationProvider()) { }

        public CSharpExecutor(ICSharpCompilationProvider compilationProvider)
        {
            compiler = compilationProvider;
        }

        private readonly ICSharpCompilationProvider compiler;

        public object Execute(Post post)
        {
            var compilation = compiler.Compile(post);

            byte[] compiledAssembly;
            using (var stream = new MemoryStream())
            {
                var emitResult = compilation.Emit(stream);

                if (!emitResult.Success)
                {
                    return "[Compilation failed]";
                }

                compiledAssembly = stream.ToArray();
            }

            object result;
            using (var sandbox = new Sandbox("Sandbox", compiledAssembly))
            {
                result = sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5));
            }

            return result;
        }
    }
}

using System;
using System.IO;
using Compilify.Models;

namespace Compilify.Services
{
    public class CSharpExecutor
    {
        public CSharpExecutor()
            : this(new CSharpCompilationProvider()) { }

        public CSharpExecutor(ICSharpCompilationProvider compilationProvider)
        {
            compiler = compilationProvider;
        }

        private readonly ICSharpCompilationProvider compiler;

        public object Execute(Post post)
        {
            var compilation = compiler.Compile(post);

            byte[] compiledAssembly;
            using (var stream = new MemoryStream())
            {
                var emitResult = compilation.Emit(stream);

                if (!emitResult.Success)
                {
                    return "[Compilation failed]";
                }

                compiledAssembly = stream.ToArray();
            }

            object result;
            using (var sandbox = new Sandbox(compiledAssembly))
            {
                result = sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5));
            }

            return result;
        }
    }
}

Use simpler constructor when instantiating the Sandbox


using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("Affecto Authentication Server")]
[assembly: AssemblyProduct("Affecto Authentication Server")]
[assembly: AssemblyCompany("Affecto")]

[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-prerelease01")]

[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Tests")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Configuration.Tests")]

using System.Reflection;
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("Affecto Authentication Server")]
[assembly: AssemblyProduct("Affecto Authentication Server")]
[assembly: AssemblyCompany("Affecto")]

[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-prerelease02")]

[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Tests")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Configuration.Tests")]

Raise authentication server prerelease version number.


/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

using Borodar.RainbowFolders.Editor.Settings;
using UnityEditor;

namespace Borodar.RainbowFolders.Editor
{
    public static class RainbowFoldersMenu
    {
        [MenuItem("Rainbow Folders/Show Settings")]
        public static void OpenSettings()
        {
            var settings = RainbowFoldersSettings.Load();
            Selection.activeObject = settings;
        }
    }
}

/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

using Borodar.RainbowFolders.Editor.Settings;
using UnityEditor;

namespace Borodar.RainbowFolders.Editor
{
    public static class RainbowFoldersMenu
    {
        [MenuItem("Edit/Rainbow Folders Settings", false, 500)]
        public static void OpenSettings()
        {
            var settings = RainbowFoldersSettings.Load();
            Selection.activeObject = settings;
        }
    }
}

Move settings menu to the "Edit" category


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace SnowyImageCopy.Common
{
	public abstract class NotificationObject : INotifyPropertyChanged
	{
		public event PropertyChangedEventHandler PropertyChanged;

		protected void SetPropertyValue<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(storage, value))
				return;

			storage = value;
			RaisePropertyChanged(propertyName);
		}

		protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
		{
			if (propertyExpression is null)
				throw new ArgumentNullException(nameof(propertyExpression));

			if (!(propertyExpression.Body is MemberExpression memberExpression))
				throw new ArgumentException("The expression is not a member access expression.", nameof(propertyExpression));

			RaisePropertyChanged(memberExpression.Member.Name);
		}

		protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
	}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace SnowyImageCopy.Common
{
	public abstract class NotificationObject : INotifyPropertyChanged
	{
		public event PropertyChangedEventHandler PropertyChanged;

		protected bool SetPropertyValue<T>(ref T storage, in T value, [CallerMemberName] string propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(storage, value))
				return false;

			storage = value;
			RaisePropertyChanged(propertyName);
			return true;
		}

		protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
			PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

		protected static bool SetPropertyValue<T>(ref T storage, in T value, EventHandler<PropertyChangedEventArgs> handler, [CallerMemberName] string propertyName = null)
		{
			if (EqualityComparer<T>.Default.Equals(storage, value))
				return false;

			storage = value;
			RaisePropertyChanged(handler, propertyName);
			return true;
		}

		protected static void RaisePropertyChanged(EventHandler<PropertyChangedEventArgs> handler, [CallerMemberName] string propertyName = null) =>
			handler?.Invoke(null, new PropertyChangedEventArgs(propertyName));
	}
}

Refactor notification object and add methods for static property changed event


// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
//   Copyright © 2013 John Gietzen.  All Rights Reserved.
//   This source is subject to the MIT license.
//   Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------

namespace Weave
{
    using System.IO;
    using Weave.Compiler;
    using Weave.Parser;

    internal class Program
    {
        private static void Main(string[] args)
        {
            var input = File.ReadAllText(args[0]);

            var parser = new WeaveParser();
            var parsed = parser.Parse(input);

            var output = WeaveCompiler.Compile(parsed);

            File.WriteAllText(args[0] + ".cs", output.Code);
        }
    }
}

// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
//   Copyright © 2013 John Gietzen.  All Rights Reserved.
//   This source is subject to the MIT license.
//   Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------

namespace Weave
{
    using System.IO;
    using Weave.Compiler;
    using Weave.Parser;

    internal class Program
    {
        private static void Main(string[] args)
        {
            foreach (var arg in args)
            {
                var input = File.ReadAllText(arg);

                var parser = new WeaveParser();
                var parsed = parser.Parse(input, arg);

                var output = WeaveCompiler.Compile(parsed);

                File.WriteAllText(arg + ".cs", output.Code);
            }
        }
    }
}

Allow multiple files on the command line.


using UnityEngine;
using System.Collections;
using ArabicSupport;

public class FixArabic3DText : MonoBehaviour {

    public bool showTashkeel = true;
    public bool useHinduNumbers = true;

    // Use this for initialization
    void Start () {
        TextMesh textMesh = gameObject.GetComponent<TextMesh>();

        string fixedFixed = ArabicFixer.Fix(textMesh.text, showTashkeel, useHinduNumbers);

		gameObject.GetComponent<TextMesh>().text = fixedFixed;

        Debug.Log(fixedFixed);
	}

}

using UnityEngine;
using System.Collections;
using ArabicSupport;

public class FixArabic3DText : MonoBehaviour {

    public bool showTashkeel = true;
    public bool useHinduNumbers = true;

    // Use this for initialization
    void Start () {
        TextMesh textMesh = gameObject.GetComponent<TextMesh>();

        string fixedText = ArabicFixer.Fix(textMesh.text, showTashkeel, useHinduNumbers);

        gameObject.GetComponent<TextMesh>().text = fixedText;

        Debug.Log(fixedFixed);
    }

}

Make var name more descriptive

Make var name more descriptive

* Fix some whitespace issues (there was a mix of spaces and tabs).


using PvcCore;
using System.Collections.Generic;
using System.IO;

namespace PvcPlugins
{
    public class PvcLess : PvcPlugin
    {
        public override string[] SupportedTags
        {
            get
            {
                return new string[] { ".less" };
            }
        }

        public override IEnumerable<PvcStream> Execute(IEnumerable<PvcStream> inputStreams)
        {
            var lessEngine = new dotless.Core.LessEngine();
            var resultStreams = new List<PvcStream>();

            foreach (var inputStream in inputStreams)
            {
                var lessContent = inputStream.ToString();
                var cssContent = lessEngine.TransformToCss(lessContent, "");

                var resultStream = PvcUtil.StringToStream(cssContent, inputStream.StreamName);
                resultStreams.Add(resultStream);
            }

            return resultStreams;
        }
    }
}

using PvcCore;
using System.Collections.Generic;
using System.IO;

namespace PvcPlugins
{
    public class PvcLess : PvcPlugin
    {
        public override string[] SupportedTags
        {
            get
            {
                return new string[] { ".less" };
            }
        }

        public override IEnumerable<PvcStream> Execute(IEnumerable<PvcStream> inputStreams)
        {
            var lessEngine = new dotless.Core.LessEngine();
            var resultStreams = new List<PvcStream>();

            foreach (var inputStream in inputStreams)
            {
                var lessContent = inputStream.ToString();
                var cssContent = lessEngine.TransformToCss(lessContent, "");

                var newStreamName = Path.Combine(Path.GetDirectoryName(inputStream.StreamName), Path.GetFileNameWithoutExtension(inputStream.StreamName) + ".css");
                var resultStream = PvcUtil.StringToStream(cssContent, newStreamName);
                resultStreams.Add(resultStream);
            }

            return resultStreams;
        }
    }
}

Rename file to .css for new stream

Rename file to .css for new stream


using System.Linq;
using System.Reflection;

namespace Abp.Reflection
{
    public static class ProxyHelper
    {
        /// <summary>
        /// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object.
        /// </summary>
        public static object UnProxy(object obj)
        {
            if (obj.GetType().Namespace != "Castle.Proxies")
            {
                return obj;
            }

            var targetField = obj.GetType()
                .GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
                .FirstOrDefault(f => f.Name == "__target");

            if (targetField == null)
            {
                return obj;
            }

            return targetField.GetValue(obj);
        }
    }
}

using Castle.DynamicProxy;

namespace Abp.Reflection
{
    public static class ProxyHelper
    {
        /// <summary>
        /// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object.
        /// </summary>
        public static object UnProxy(object obj)
        {
            return ProxyUtil.GetUnproxiedInstance(obj);
        }
    }
}

Replace reflection to call API.

Replace reflection to call API.


using System;
using System.Drawing;

namespace DrawIt
{
    public static class FontHelpers
    {
        public static Font GetHeaderFont()
        {
            float fontSize = Configuration.GetSettingOrDefault<float>(Constants.Application.Header.FontSize, float.TryParse, Constants.Application.Defaults.HeaderTextSize);
            string fontName = Configuration.GetSetting(Constants.Application.Header.FontName) ?? "Calibri";
            FontStyle fontStyle = Configuration.GetSettingOrDefault<FontStyle>(Constants.Application.Header.FontStyle, Enum.TryParse<FontStyle>, FontStyle.Regular);

            return new Font(fontName, fontSize, fontStyle);
        }
    }
}

using System;
using System.Drawing;

namespace DrawIt
{
    public static class FontHelpers
    {
        public static Font GetHeaderFont()
        {
            float fontSize = Configuration.GetSettingOrDefault<float>(Constants.Application.Header.FontSize, float.TryParse, Constants.Application.Defaults.HeaderTextSize);
            string fontName = Configuration.GetSetting(Constants.Application.Header.FontName) ?? "Segoe Script";
            FontStyle fontStyle = Configuration.GetSettingOrDefault<FontStyle>(Constants.Application.Header.FontStyle, Enum.TryParse<FontStyle>, FontStyle.Regular);

            return new Font(fontName, fontSize, fontStyle);
        }
    }
}

Change the default font for the header.

Change the default font for the header.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Giles.Core.Runners;
using Giles.Core.Utility;
using NUnit.Core;
using NUnit.Core.Filters;

namespace Giles.Runner.NUnit
{
    public class NUnitRunner : IFrameworkRunner
    {
        IEnumerable<string> filters;

        public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
        {
            this.filters = filters;
            var remoteTestRunner = new RemoteTestRunner(0);
            var package = SetupTestPackager(assembly);
            remoteTestRunner.Load(package);
            var listener = new GilesNUnitEventListener();
            remoteTestRunner.Run(listener, GetFilters());
            return listener.SessionResults;
        }

        ITestFilter GetFilters()
        {
            var simpleNameFilter = new SimpleNameFilter(filters.ToArray());
            return simpleNameFilter;
        }

        public IEnumerable<string> RequiredAssemblies()
        {
            return new[]
                       {
                           Assembly.GetAssembly(typeof(NUnitRunner)).Location,
                           "nunit.core.dll", "nunit.core.interfaces.dll"
                       };
        }

        private static TestPackage SetupTestPackager(Assembly assembly)
        {
            return new TestPackage(assembly.FullName, new[] { assembly.Location });
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Giles.Core.Runners;
using NUnit.Core;
using NUnit.Core.Filters;

namespace Giles.Runner.NUnit
{
    public class NUnitRunner : IFrameworkRunner
    {
        IEnumerable<string> filters;

        public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
        {
            this.filters = filters;
            var remoteTestRunner = new RemoteTestRunner(0);
            var package = SetupTestPackager(assembly);
            remoteTestRunner.Load(package);
            var listener = new GilesNUnitEventListener();
            if (filters.Count() == 0)
                remoteTestRunner.Run(listener);
            else
                remoteTestRunner.Run(listener, GetFilters());
            return listener.SessionResults;
        }

        ITestFilter GetFilters()
        {
            var simpleNameFilter = new SimpleNameFilter(filters.ToArray());
            return simpleNameFilter;
        }

        public IEnumerable<string> RequiredAssemblies()
        {
            return new[]
                       {
                           Assembly.GetAssembly(typeof(NUnitRunner)).Location,
                           "nunit.core.dll", "nunit.core.interfaces.dll"
                       };
        }

        private static TestPackage SetupTestPackager(Assembly assembly)
        {
            return new TestPackage(assembly.FullName, new[] { assembly.Location });
        }
    }
}

Fix to not use a test filter in NUnit when no filters has been declared in Giles. This was causing NUnit to not run the tests


using System.Collections.Generic;
using System.Linq;

namespace Arkivverket.Arkade.Core.Base
{
    public class ArchiveXmlUnit
    {
        public ArchiveXmlFile File { get; }
        public List<ArchiveXmlSchema> Schemas { get; }

        public ArchiveXmlUnit(ArchiveXmlFile file, List<ArchiveXmlSchema> schemas)
        {
            File = file;
            Schemas = schemas;
        }

        public ArchiveXmlUnit(ArchiveXmlFile file, ArchiveXmlSchema schema)
            : this(file, new List<ArchiveXmlSchema> {schema})
        {
        }

        public bool AllFilesExists()
        {
            return !GetMissingFiles().Any();
        }

        public IEnumerable<string> GetMissingFiles()
        {
            var missingFiles = new List<string>();

            if (!File.Exists)
                missingFiles.Add(File.FullName);

            missingFiles.AddRange(
                from schema in
                    from schema in Schemas
                    where schema.IsUserProvided()
                    select (UserProvidedXmlSchema) schema
                where !schema.FileExists
                select schema.FullName
            );

            return missingFiles;
        }
    }
}

using System.Collections.Generic;
using System.Linq;

namespace Arkivverket.Arkade.Core.Base
{
    public class ArchiveXmlUnit
    {
        public ArchiveXmlFile File { get; }
        public List<ArchiveXmlSchema> Schemas { get; }

        public ArchiveXmlUnit(ArchiveXmlFile file, List<ArchiveXmlSchema> schemas)
        {
            File = file;
            Schemas = schemas;
        }

        public ArchiveXmlUnit(ArchiveXmlFile file, ArchiveXmlSchema schema)
            : this(file, new List<ArchiveXmlSchema> {schema})
        {
        }

        public bool AllFilesExists()
        {
            return !GetMissingFiles().Any();
        }

        public IEnumerable<string> GetMissingFiles()
        {
            var missingFiles = new List<string>();

            if (!File.Exists)
                missingFiles.Add(File.Name);

            missingFiles.AddRange(
                from schema in
                    from schema in Schemas
                    where schema.IsUserProvided()
                    select (UserProvidedXmlSchema) schema
                where !schema.FileExists
                select schema.FullName
            );

            return missingFiles;
        }
    }
}

Use name only for reporting missing file


using System;
using System.ComponentModel;
using System.Reflection;

namespace MarkEmbling.Utils.Extensions {
    public static class EnumExtensions {
        /// <summary>
        /// Gets the description of a field in an enumeration. If there is no
        /// description attribute, the raw name of the field is provided.
        /// </summary>
        /// <param name="value">Enum value</param>
        /// <returns>Description or raw name</returns>
        public static string GetDescription(this Enum value) {
            var field = value.GetType().GetField(value.ToString());
            var attribute = field.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;

            return attribute == null ? value.ToString() : attribute.Description;
        }
    }
}

using System;
using System.ComponentModel;
using System.Reflection;

namespace MarkEmbling.Utils.Extensions {
    public static class EnumExtensions {
        /// <summary>
        /// Gets the description of a field in an enumeration. If there is no
        /// description attribute, the raw name of the field is provided.
        /// </summary>
        /// <param name="value">Enum value</param>
        /// <returns>Description or raw name</returns>
        public static string GetDescription(this Enum value) {
            var field = value.GetType().GetRuntimeField(value.ToString());
            var attribute = field.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;

            return attribute == null ? value.ToString() : attribute.Description;
        }
    }
}

Tweak for .net Standard 1.1 compatibility


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

namespace Vikekh.Stepbot
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

using SlackAPI;
using System;
using System.Threading;

namespace Vikekh.Stepbot
{
	class Program
    {
        static void Main(string[] args)
        {
			var botAuthToken = "";
			var userAuthToken = "";
			var name = "@stepdot";
			var age = (new DateTime(2017, 1, 18) - DateTime.Now).Days / 365.0;
			var ageString = age.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);
			var version = "0.1.0";
			var mommy = "@vem";
			ManualResetEventSlim clientReady = new ManualResetEventSlim(false);
			SlackSocketClient client = new SlackSocketClient(botAuthToken);
			client.Connect((connected) =>
			{
				// This is called once the client has emitted the RTM start command
				clientReady.Set();
			}, () =>
			{
				// This is called once the RTM client has connected to the end point
			});
			client.OnMessageReceived += (message) =>
			{
				// Handle each message as you receive them
				Console.WriteLine(message.text);
				var textData = string.Format("hello w0rld my name is {0} I am {1} years old and my version is {2} and my mommy is {3}", name, ageString, version, mommy);
				client.SendMessage((x) => { }, message.channel, textData);
			};
			clientReady.Wait();
			Console.ReadLine();
		}
    }
}

Test receive and send message

Test receive and send message


using System;
using System.Collections.Generic;
using TimeSeries;
using TimeSeriesService.Client.TimeSeriesReference;

namespace TimeSeriesService.Client
{
    class Program
    {
        static void Main()
        {
            var proxy = new TimeSeriesServiceClient();
            var oneDataPoint = new List<DataPoint>
            {
                new DataPoint()
            }.ToArray();
            var oneDataPointResult = proxy.New(oneDataPoint);
            Console.WriteLine("Irregular: {0}", oneDataPointResult);

            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using TimeSeries;
using TimeSeriesService.Client.TimeSeriesReference;

namespace TimeSeriesService.Client
{
    class Program
    {
        static void Main()
        {
            var proxy = new TimeSeriesServiceClient();
            var oneDataPoint = new List<DataPoint>
            {
                new DataPoint()
            }.ToArray();
            var oneDataPointResult = proxy.New(oneDataPoint);
            Console.WriteLine("One data point: {0}", oneDataPointResult);

            var twoDataPoints = new List<DataPoint>
            {
                new DataPoint(),
                new DataPoint()
            }.ToArray();
            var twoDataPointsResult = proxy.New(twoDataPoints);
            Console.WriteLine("Two data points: {0}", twoDataPointsResult);

            var threeDataPoints = new List<DataPoint>
            {
                new DataPoint(),
                new DataPoint(),
                new DataPoint()
            }.ToArray();
            var threeDataPointsResult = proxy.New(threeDataPoints);
            Console.WriteLine("Three data points: {0}",
                threeDataPointsResult);

            Console.WriteLine();
            Console.WriteLine("--");
            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
    }
}

Add additional functional test cases.

Add additional functional test cases.

Add code to test for two data points (returning a `RegularTimeSeries`)
and for three data points (returning a `SetPointTimeSeries`).


using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Services;

namespace Thinktecture.IdentityServer.Core.EntityFramework
{
    public class ScopeStore : IScopeStore
    {
        private readonly string _connectionString;

        public ScopeStore(string connectionString)
        {
            _connectionString = connectionString;
        }

        public Task<IEnumerable<Models.Scope>> GetScopesAsync()
        {
            using (var db = new CoreDbContext(_connectionString))
            {
                var scopes = db.Scopes
                    .Include("ScopeClaims")
                    .ToArray();

                var models = scopes.ToList().Select(x => x.ToModel());

                return Task.FromResult(models);
            }
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Services;

namespace Thinktecture.IdentityServer.Core.EntityFramework
{
    public class ScopeStore : IScopeStore
    {
        private readonly string _connectionString;

        public ScopeStore(string connectionString)
        {
            _connectionString = connectionString;
        }

        public Task<IEnumerable<Models.Scope>> GetScopesAsync()
        {
            using (var db = new CoreDbContext(_connectionString))
            {
                var scopes = db.Scopes
                    .Include("ScopeClaims");

                var models = scopes.ToList().Select(x => x.ToModel());

                return Task.FromResult(models);
            }
        }
    }
}

Remove redundant LINQ method call

Remove redundant LINQ method call

ToList() already forces the IQueryable to execute. No need to call
ToArray() beforehand.


namespace Mappy.Util.ImageSampling
{
    using System.Drawing;

    public class NearestNeighbourWrapper : IPixelImage
    {
        private readonly IPixelImage source;

        public NearestNeighbourWrapper(IPixelImage source, int width, int height)
        {
            this.source = source;
            this.Width = width;
            this.Height = height;
        }

        public int Width { get; private set; }

        public int Height { get; private set; }

        public Color this[int x, int y]
        {
            get
            {
                int imageX = (int)((x / (float)this.Width) * this.source.Width);
                int imageY = (int)((y / (float)this.Height) * this.source.Height);
                return this.source[imageX, imageY];
            }
        }
    }
}

namespace Mappy.Util.ImageSampling
{
    using System.Drawing;

    public class NearestNeighbourWrapper : IPixelImage
    {
        private readonly IPixelImage source;

        public NearestNeighbourWrapper(IPixelImage source, int width, int height)
        {
            this.source = source;
            this.Width = width;
            this.Height = height;
        }

        public int Width { get; private set; }

        public int Height { get; private set; }

        public Color this[int x, int y]
        {
            get
            {
                // sample at the centre of each pixel
                float ax = x + 0.5f;
                float ay = y + 0.5f;

                int imageX = (int)((ax / this.Width) * this.source.Width);
                int imageY = (int)((ay / this.Height) * this.source.Height);
                return this.source[imageX, imageY];
            }
        }
    }
}

Fix small offset in low quality minimap image


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NiceIO;
using NUnit.Framework;
using SaferMutex.Tests.BaseSuites;

namespace SaferMutex.Tests.FileBased
{
    [TestFixture]
    public class ThreadedStressTestsV2 : BaseThreadedStressTests
    {
        protected override ISaferMutexMutex CreateMutexImplementation(bool initiallyOwned, string name, out bool owned, out bool createdNew)
        {
            return new SaferMutex.FileBased(initiallyOwned, name, Scope.CurrentProcess, out owned, out createdNew, _tempDirectory.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NiceIO;
using NUnit.Framework;
using SaferMutex.Tests.BaseSuites;

namespace SaferMutex.Tests.FileBased
{
    [TestFixture]
    public class ThreadedStressTestsV2 : BaseThreadedStressTests
    {
        protected override ISaferMutexMutex CreateMutexImplementation(bool initiallyOwned, string name, out bool owned, out bool createdNew)
        {
            return new SaferMutex.FileBased2(initiallyOwned, name, Scope.CurrentProcess, out owned, out createdNew, _tempDirectory.ToString());
        }
    }
}

Fix stress test not creating v2

Fix stress test not creating v2


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

namespace Hanc.AspNetAPI
{
    /// <summary>
    /// The options pattern uses custom options classes to represent a group of related settings.
    /// See Startup.cs and ValuesController.cs for implimentation code
    /// </summary>
    public class SecretOptions
    {
        public SecretOptions()
        {
            MacSecret = "default_secret";
        }
        public string MacSecret { get; set; }
        public string ApiKey { get; set; }
    }
    /// <summary>
    /// The options pattern uses custom options classes to represent a group of related settings.
    /// See Startup.cs and HelloController.cs for implimentation code
    /// </summary>
    public class HelloOptions
    {
        public HelloOptions()
        {
            HelloValue = "...";
        }
        public string HelloValue { get; set; }
    }
}

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

namespace Hanc.AspNetAPI
{
    /// <summary>
    /// The options pattern uses custom options classes to represent a group of related settings.
    /// See Startup.cs and ValuesController.cs for implimentation code
    /// </summary>
    public class SecretOptions
    {
        public SecretOptions()
        {
            MacSecret = "default_secret";
        }
        public string MacSecret { get; set; }
        public string AppId { get; set; }
        public bool RequireApiAuthToken { get; set; }
    }
    /// <summary>
    /// The options pattern uses custom options classes to represent a group of related settings.
    /// See Startup.cs and HelloController.cs for implimentation code
    /// </summary>
    public class HelloOptions
    {
        public HelloOptions()
        {
            HelloValue = "...";
        }
        public string HelloValue { get; set; }
    }
}

Change ApiKey to AppId add RequireApiAuthToken


using Avalonia;

namespace Sandbox
{
    public class Program
    {
        static void Main(string[] args)
        {
            AppBuilder.Configure<App>()
                .UsePlatformDetect()
                .LogToTrace()
                .StartWithClassicDesktopLifetime(args);
        }
    }
}

using Avalonia;

namespace Sandbox
{
    public class Program
    {
        static void Main(string[] args) => BuildAvaloniaApp()
            .StartWithClassicDesktopLifetime(args);

        public static AppBuilder BuildAvaloniaApp() =>
            AppBuilder.Configure<App>()
                .UsePlatformDetect()
                .LogToTrace();
    }
}

Make the designer work in the sandbox project.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using DataReader.BusinessLogic;
using DataReader.Models;

namespace DataReader.Controllers
{
    [RoutePrefix("api")]
    public class NameQueryController : ApiController
    {
        private readonly INameBusinessLogic _nameBusinessLogic;

        public NameQueryController(INameBusinessLogic nameBusinessLogic)
        {
            _nameBusinessLogic = nameBusinessLogic;
        }

        [Route("fullName/{id}")]
        [HttpGet]
        public async Task<IHttpActionResult> GetData(string id)
        {
            var result = default(NameDTO);
            try
            {
                result = _nameBusinessLogic.GetById(id);
            }
            catch (Exception ex)
            {
                return StatusCode(HttpStatusCode.ExpectationFailed);
            }

            return Ok(result);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using DataReader.BusinessLogic;
using DataReader.Models;

namespace DataReader.Controllers
{
    [RoutePrefix("api")]
    public class NameQueryController : ApiController
    {
        private readonly INameBusinessLogic _nameBusinessLogic;

        public NameQueryController(INameBusinessLogic nameBusinessLogic)
        {
            _nameBusinessLogic = nameBusinessLogic;
        }

        [Route("fullName/{id}")]
        [HttpGet]
        public IHttpActionResult GetName(string id)
        {
            var result = default(NameDTO);
            try
            {
                result = _nameBusinessLogic.GetById(id);
            }
            catch (Exception ex)
            {
                return StatusCode(HttpStatusCode.ExpectationFailed);
            }

            return Ok(result);
        }

        [Route("fullName")]
        [HttpGet]
        public IHttpActionResult GetAllNames()
        {
            var result = default(string[]);
            try
            {
                result = _nameBusinessLogic.GetAllNameIds();
            }
            catch (Exception ex)
            {
                return StatusCode(HttpStatusCode.ExpectationFailed);
            }

            return Ok(result);
        }
    }
}

Add GET All Names endpoint

Add GET All Names endpoint


using System;
using System.Linq;
using Microsoft.Practices.ObjectBuilder2;

namespace SignInCheckIn.Models.DTO
{
    public class ParticipantDto
    {
        public int EventParticipantId { get; set; }
        public int ParticipantId { get; set; }
        public int ContactId { get; set; }
        public int HouseholdId { get; set; }
        public int HouseholdPositionId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime DateOfBirth { get; set; }
        public bool Selected { get; set; } = false;
        public int ParticipationStatusId { get; set; }
        public int? AssignedRoomId { get; set; }
        public string AssignedRoomName { get; set; }
        public int? AssignedSecondaryRoomId { get; set; } // adventure club field
        public string AssignedSecondaryRoomName { get; set; } // adventure club field

        public string CallNumber
        {
            get
            {
                var c = $"0000{EventParticipantId}";
                return c.Substring(c.Length - 4);
            }
        }
    }
}

using System;
using System.Linq;
using Microsoft.Practices.ObjectBuilder2;

namespace SignInCheckIn.Models.DTO
{
    public class ParticipantDto
    {
        public int EventParticipantId { get; set; }
        public int ParticipantId { get; set; }
        public int ContactId { get; set; }
        public int HouseholdId { get; set; }
        public int HouseholdPositionId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime DateOfBirth { get; set; }
        public bool Selected { get; set; } = false;
        public int ParticipationStatusId { get; set; }
        public int? AssignedRoomId { get; set; }
        public string AssignedRoomName { get; set; }
        public int? AssignedSecondaryRoomId { get; set; } // adventure club field
        public string AssignedSecondaryRoomName { get; set; } // adventure club field

        public string CallNumber
        {
            // TODO Faking out a call number for now (last 4 of EventParticipantId), eventually need to store a real call number on Event Participant
            get
            {
                var c = $"0000{EventParticipantId}";
                return c.Substring(c.Length - 4);
            }
        }
    }
}

Add TODO on fake CallNumber

US5688: Add TODO on fake CallNumber


using MultiMiner.Xgminer.Api.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace MultiMiner.Xgminer.Api
{
    public class ApiContext
    {
        private TcpClient tcpClient;
        public ApiContext(int port)
        {
            tcpClient = new TcpClient("127.0.0.1", port);
        }

        public List<DeviceInformation> GetDeviceInformation()
        {
            string textResponse = GetResponse(ApiVerb.Devs);
            List<DeviceInformation> result = new List<DeviceInformation>();
            DeviceInformationParser.ParseTextForDeviceInformation(textResponse, result);
            return result;
        }

        public void QuitMining()
        {
            GetResponse(ApiVerb.Quit);
        }

        private string GetResponse(string apiVerb)
        {
            NetworkStream stream = tcpClient.GetStream();
            Byte[] request = System.Text.Encoding.ASCII.GetBytes(apiVerb);
            stream.Write(request, 0, request.Length);

            Byte[] responseBuffer = new Byte[4096];
            string response = string.Empty;
            int bytesRead = stream.Read(responseBuffer, 0, responseBuffer.Length);
            response = System.Text.Encoding.ASCII.GetString(responseBuffer, 0, bytesRead);
            return response;
        }
    }
}

using MultiMiner.Xgminer.Api.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace MultiMiner.Xgminer.Api
{
    public class ApiContext
    {
        private TcpClient tcpClient;
        public ApiContext(int port)
        {
            tcpClient = new TcpClient("127.0.0.1", port);
        }

        public List<DeviceInformation> GetDeviceInformation()
        {
            string textResponse = GetResponse(ApiVerb.Devs);
            List<DeviceInformation> result = new List<DeviceInformation>();
            DeviceInformationParser.ParseTextForDeviceInformation(textResponse, result);
            return result;
        }

        public void QuitMining()
        {
            GetResponse(ApiVerb.Quit);
        }

        private string GetResponse(string apiVerb)
        {
            NetworkStream tcpStream = tcpClient.GetStream();

            Byte[] request = Encoding.ASCII.GetBytes(apiVerb);
            tcpStream.Write(request, 0, request.Length);

            Byte[] responseBuffer = new Byte[4096];
            string response = string.Empty;
            do
            {
                int bytesRead = tcpStream.Read(responseBuffer, 0, responseBuffer.Length);
                response = response + Encoding.ASCII.GetString(responseBuffer, 0, bytesRead);
            } while (tcpStream.DataAvailable);

            return response;
        }
    }
}

Improve TCP reading code to read more than 4096 bytes if available


namespace Mapsui;

public class MPoint2
{
    public double X { get; set; }
    public double Y { get; set; }

}

using Mapsui.Utilities;

namespace Mapsui;

public class MPoint2
{
    public double X { get; set; }
    public double Y { get; set; }

    /// <summary>
    ///     Calculates a new point by rotating this point clockwise about the specified center point
    /// </summary>
    /// <param name="degrees">Angle to rotate clockwise (degrees)</param>
    /// <param name="centerX">X coordinate of point about which to rotate</param>
    /// <param name="centerY">Y coordinate of point about which to rotate</param>
    /// <returns>Returns the rotated point</returns>
    public MPoint Rotate(double degrees, double centerX, double centerY)
    {
        // translate this point back to the center
        var newX = X - centerX;
        var newY = Y - centerY;

        // rotate the values
        var p = Algorithms.RotateClockwiseDegrees(newX, newY, degrees);

        // translate back to original reference frame
        newX = p.X + centerX;
        newY = p.Y + centerY;

        return new MPoint(newX, newY);
    }

    /// <summary>
    ///     Calculates a new point by rotating this point clockwise about the specified center point
    /// </summary>
    /// <param name="degrees">Angle to rotate clockwise (degrees)</param>
    /// <param name="center">MPoint about which to rotate</param>
    /// <returns>Returns the rotated point</returns>
    public MPoint Rotate(double degrees, MPoint center)
    {
        return Rotate(degrees, center.X, center.Y);
    }
}

Add Rotate methods contributed by CLA signers


using System.Reflection;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles;

namespace Glimpse.Server.Resources
{
    public class ClientResource : IResourceStartup
    {
        public void Configure(IResourceBuilder resourceBuilder)
        {
            // TODO: Add HTTP Caching
            var options = new FileServerOptions();
            options.RequestPath = "/Client";
            options.EnableDefaultFiles = false;
            options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
            options.FileProvider = new EmbeddedFileProvider(typeof(ClientResource).GetTypeInfo().Assembly, "Glimpse.Server.Resources.Embed.Client");

            resourceBuilder.AppBuilder.UseFileServer(options);
        }

        public ResourceType Type => ResourceType.Client;
    }
}

using System.Reflection;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles;

namespace Glimpse.Server.Resources
{
    public class ClientResource : IResourceStartup
    {
        public void Configure(IResourceBuilder resourceBuilder)
        {
            // TODO: Add HTTP Caching
            var options = new FileServerOptions();
            options.RequestPath = "/Client";
            options.EnableDefaultFiles = false;
            options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
            options.FileProvider = new EmbeddedFileProvider(typeof(ClientResource).GetTypeInfo().Assembly, "Glimpse.Server.Resources.Embeded.Client");

            resourceBuilder.AppBuilder.UseFileServer(options);
        }

        public ResourceType Type => ResourceType.Client;
    }
}

Fix internal path for embedded client

Fix internal path for embedded client


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Version.cs" company="">
//   Copyright 2013 Thomas PIERRAIN
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//       http://www.apache.org/licenses/LICENSE-2.0
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Version.cs" company="">
//   Copyright 2013 Thomas PIERRAIN
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//       http://www.apache.org/licenses/LICENSE-2.0
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]

Update the version number to 1.4.0

Update the version number to 1.4.0


using System;
using System.Threading;
using System.Threading.Tasks;
using Bit.Core.Contracts;
using Bit.Core.Models;
using Bit.Model.Dtos;

namespace Bit.OData.ODataControllers
{
    public class JobsInfoController : DtoController<JobInfoDto>
    {
        public virtual IBackgroundJobWorker BackgroundJobWorker { get; set; }

        [Get]
        public virtual async Task<JobInfoDto> Get(string key, CancellationToken cancellationToken)
        {
            if (key == null)
                throw new ArgumentNullException(nameof(key));

            JobInfo jobInfo = await BackgroundJobWorker.GetJobInfoAsync(key, cancellationToken);

            return new JobInfoDto
            {
                Id = jobInfo.Id,
                CreatedAt = jobInfo.CreatedAt,
                State = jobInfo.State
            };
        }
    }
}

using Bit.Core.Contracts;
using Bit.Core.Models;
using Bit.Model.Dtos;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Bit.OData.ODataControllers
{
    public class JobsInfoController : DtoController<JobInfoDto>
    {
        public virtual IBackgroundJobWorker BackgroundJobWorker { get; set; }

        [Get]
        public virtual async Task<JobInfoDto> Get(string key, CancellationToken cancellationToken)
        {
            if (key == null)
                throw new ArgumentNullException(nameof(key));

            if (BackgroundJobWorker == null)
                throw new InvalidOperationException("No background job worker is configured");

            JobInfo jobInfo = await BackgroundJobWorker.GetJobInfoAsync(key, cancellationToken);

            return new JobInfoDto
            {
                Id = jobInfo.Id,
                CreatedAt = jobInfo.CreatedAt,
                State = jobInfo.State
            };
        }
    }
}

Check background job worker before using that in jobs info controller


using System.Windows;

namespace Kinugasa.UI
{
    /// <summary>
    /// Proxy class for binding sorce.
    /// </summary>
    public class BindingProxy : Freezable
    {
        /// <summary>
        /// Define dependencyProperty.
        /// </summary>
        public static readonly DependencyProperty DataProperty =
            DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));

        /// <summary>
        /// Create freezable object's instance.
        /// </summary>
        /// <returns></returns>
        protected override Freezable CreateInstanceCore()
        {
            return new BindingProxy();
        }

        /// <summary>
        /// Proxy property.
        /// </summary>
        public object Data
        {
            get { return (object)GetValue(DataProperty); }
            set { SetValue(DataProperty, value); }
        }
    }
}

using System.Windows;

/// <summary>
/// Provide userinterface components.
/// </summary>
namespace Kinugasa.UI
{
    /// <summary>
    /// Proxy class for binding sorce.
    /// </summary>
    public class BindingProxy : Freezable
    {
        /// <summary>
        /// Define dependencyProperty.
        /// </summary>
        public static readonly DependencyProperty DataProperty =
            DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));

        /// <summary>
        /// Create freezable object's instance.
        /// </summary>
        /// <returns></returns>
        protected override Freezable CreateInstanceCore()
        {
            return new BindingProxy();
        }

        /// <summary>
        /// Proxy property.
        /// </summary>
        public object Data
        {
            get { return (object)GetValue(DataProperty); }
            set { SetValue(DataProperty, value); }
        }
    }
}

Add xml comment on namespace.

Add xml comment on namespace.


namespace Winium.Desktop.Driver.CommandExecutors
{
    #region using

    using System.Windows.Automation;

    using Winium.Cruciatus.Extensions;
    using Winium.StoreApps.Common;

    #endregion

    internal class IsElementSelectedExecutor : CommandExecutorBase
    {
        #region Methods

        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.Elements.GetRegisteredElement(registeredKey);

            var controlType = element.GetAutomationPropertyValue<ControlType>(AutomationElement.ControlTypeProperty);
            if (controlType.Equals(ControlType.CheckBox))
            {
                return this.JsonResponse(ResponseStatus.Success, element.ToCheckBox().IsToggleOn);
            }

            var property = SelectionItemPattern.IsSelectedProperty;
            var isSelected = element.GetAutomationPropertyValue<bool>(property);

            return this.JsonResponse(ResponseStatus.Success, isSelected);
        }

        #endregion
    }
}

namespace Winium.Desktop.Driver.CommandExecutors
{
    #region using

    using System.Windows.Automation;

    using Winium.Cruciatus.Exceptions;
    using Winium.Cruciatus.Extensions;
    using Winium.StoreApps.Common;

    #endregion

    internal class IsElementSelectedExecutor : CommandExecutorBase
    {
        #region Methods

        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.Elements.GetRegisteredElement(registeredKey);

            var isSelected = false;

            try
            {
                var isTogglePattrenAvailable =
                    element.GetAutomationPropertyValue<bool>(AutomationElement.IsTogglePatternAvailableProperty);

                if (isTogglePattrenAvailable)
                {
                    var toggleStateProperty = TogglePattern.ToggleStateProperty;
                    var toggleState = element.GetAutomationPropertyValue<ToggleState>(toggleStateProperty);

                    isSelected = toggleState == ToggleState.On;
                }
            }
            catch (CruciatusException)
            {
                var selectionItemProperty = SelectionItemPattern.IsSelectedProperty;
                isSelected = element.GetAutomationPropertyValue<bool>(selectionItemProperty);
            }

            return this.JsonResponse(ResponseStatus.Success, isSelected);
        }

        #endregion
    }
}

Check IsTogglePatternAvailable insted of using ControlType


using System.Runtime.InteropServices;
using System.Reflection;

#if DEBUG
[assembly: AssemblyProduct("MeepMeep (Debug)")]
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyProduct("MeepMeep (Release)")]
[assembly: AssemblyConfiguration("Release")]
#endif

[assembly: AssemblyDescription("MeepMeep - A super simple workload utility for the Couchbase .Net client.")]
[assembly: AssemblyCompany("Daniel Wertheim")]
[assembly: AssemblyCopyright("Copyright © 2013 Daniel Wertheim")]
[assembly: AssemblyTrademark("")]

[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0")]

using System.Reflection;

#if DEBUG
[assembly: AssemblyProduct("MeepMeep (Debug)")]
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyProduct("MeepMeep (Release)")]
[assembly: AssemblyConfiguration("Release")]
#endif

[assembly: AssemblyDescription("MeepMeep - A super simple workload utility for the Couchbase .NET client.")]
[assembly: AssemblyCompany("Couchbase")]
[assembly: AssemblyCopyright("Copyright © 2017 Couchbase")]
[assembly: AssemblyTrademark("")]

[assembly: AssemblyVersion("0.1.0.*")]
[assembly: AssemblyFileVersion("0.1.0")]

Update AssemblyInfo to reference Couchbase as owner / copyright


@model List<Catalog>

Catalog

    @foreach (var catalog in Model)
    {

            @catalog.Title
            @catalog.Posts.Count()

    }

Update catalog list item style

Update catalog list item style

make it different from tag list item style


using Buddy.Swtor.Objects;

namespace DefaultCombat.Extensions
{
    public static class TorCharacterExtensions
    {
        public static bool ShouldDispel(this TorCharacter target, string debuffName)
        {
            if (target == null)
                return false;

            return target.HasDebuff(debuffName);
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using Buddy.Swtor.Objects;

namespace DefaultCombat.Extensions
{
    public static class TorCharacterExtensions
    {
        private static readonly IReadOnlyList<string> _dispellableDebuffs = new List<string>
        {
            "Hunting Trap",
            "Burning (Physical)"
        };

        public static bool ShouldDispel(this TorCharacter target)
        {
            return target != null && _dispellableDebuffs.Any(target.HasDebuff);
        }
    }
}

Return whether the target has any dispellable debuff


@using Orchard.ContentManagement.MetaData.Models
@{
    var containerId = (int) Model.ContainerId;
    var itemContentTypes = (IList<ContentTypeDefinition>)Model.ItemContentTypes;
}

        @Html.ActionLink(T("{0} Properties", Html.Raw((string)Model.ContainerDisplayName)).Text, "Edit", new { Area = "Contents", Id = (int)Model.ContainerId, ReturnUrl = Html.ViewContext.HttpContext.Request.RawUrl })

    @if (itemContentTypes.Any()) {
        foreach (var contentType in itemContentTypes) {
        @Html.ActionLink(T("New {0}", Html.Raw(contentType.DisplayName)).Text, "Create", "Admin", new { area = "Contents", id = contentType.Name, containerId }, new { @class = "button primaryAction create-content" })
        }
    }
    else {
        @Html.ActionLink(T("New Content").ToString(), "Create", "Admin", new { area = "Contents", containerId }, new { @class = "button primaryAction create-content" })
    }
    @T("Choose Items")

@using Orchard.ContentManagement.MetaData.Models
@{
    var containerId = (int) Model.ContainerId;
    var itemContentTypes = (IList<ContentTypeDefinition>)Model.ItemContentTypes;
}

        @Html.ActionLink(T("{0} Properties", (string)Model.ContainerDisplayName), "Edit", new { Area = "Contents", Id = (int)Model.ContainerId, ReturnUrl = Html.ViewContext.HttpContext.Request.RawUrl })

    @if (itemContentTypes.Any()) {
        foreach (var contentType in itemContentTypes) {
        @Html.ActionLink(T("New {0}", contentType.DisplayName), "Create", "Admin", new { area = "Contents", id = contentType.Name, containerId }, new { @class = "button primaryAction create-content" })
        }
    }
    else {
        @Html.ActionLink(T("New Content"), "Create", "Admin", new { area = "Contents", containerId }, new { @class = "button primaryAction create-content" })
    }
    @T("Choose Items")

Use new ActionLink extension method.

Use new ActionLink extension method.


using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: InternalsVisibleTo("FakeHttpContext.Tests")]

[assembly: AssemblyTitle("FakeHttpContext")]
[assembly: AssemblyDescription("Unit testing utilite for simulate HttpContext.Current.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vadim Zozulya")]
[assembly: AssemblyProduct("FakeHttpContext")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("36df5624-6d1a-4c88-8ba2-cb63e6d5dd0e")]

[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: InternalsVisibleTo("FakeHttpContext.Tests")]

[assembly: AssemblyTitle("FakeHttpContext")]
[assembly: AssemblyDescription("Unit testing utilite for simulate HttpContext.Current.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vadim Zozulya")]
[assembly: AssemblyProduct("FakeHttpContext")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("36df5624-6d1a-4c88-8ba2-cb63e6d5dd0e")]

[assembly: AssemblyVersion("0.1.1")]
[assembly: AssemblyFileVersion("0.1.1")]
[assembly: AssemblyInformationalVersion("0.1.1")]

Update package version to 0.1.1

Update package version to 0.1.1


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;

namespace Postal.AspNetCore
{
    public class EmailServiceOptions
    {
        public EmailServiceOptions()
        {
            CreateSmtpClient = () => new SmtpClient(Host, Port)
            {
                Credentials = new NetworkCredential(UserName, Password),
                EnableSsl = EnableSSL
            };
        }

        public string Host { get; set; }
        public int Port { get; set; }
        public bool EnableSSL { get; set; }
        public string FromAddress { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }

        public Func<SmtpClient> CreateSmtpClient { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;

namespace Postal.AspNetCore
{
    public class EmailServiceOptions
    {
        public EmailServiceOptions()
        {
            CreateSmtpClient = () => new SmtpClient(Host, Port)
            {
                UseDefaultCredentials = string.IsNullOrWhiteSpace(UserName),
                Credentials = string.IsNullOrWhiteSpace(UserName) ? null : new NetworkCredential(UserName, Password),
                EnableSsl = EnableSSL
            };
        }

        public string Host { get; set; }
        public int Port { get; set; }
        public bool EnableSSL { get; set; }
        public string FromAddress { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }

        public Func<SmtpClient> CreateSmtpClient { get; set; }
    }
}

Fix create smtpclient with UseDefaultCredentials