commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
3b1c0389a305e71275f2bbf85c66a4feea769f33
add string format to PluralConverter
rudyhuyn/PluralNet
PluralNet.Shared/Converters/PluralConverter.cs
PluralNet.Shared/Converters/PluralConverter.cs
#if WINRT || SILVERLIGHT using Huyn.PluralNet; using System; using System.Globalization; #if WINRT using Windows.ApplicationModel.Resources; using Windows.UI.Xaml.Data; #endif #if SILVERLIGHT using System.Windows.Data; using System.Resources; #endif namespace Huyn.PluralNet.Converters { public class PluralConverter : IValueConverter { #if SILVERLIGHT public ResourceManager ResourceManager { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (ResourceManager == null) { throw new NullReferenceException("PluralConverter.ResourceManager can't be null"); } var key = parameter as string; if (string.IsNullOrWhiteSpace(key)) return ""; var number = (decimal)value; return string.Format(ResourceManager.GetPlural(key, number),number); } #endif #if WINRT public object Convert(object value, Type targetType, object parameter, string language) { var key = parameter as string; if (string.IsNullOrWhiteSpace(key)) return ""; var number = (decimal)value; var resource = ResourceLoader.GetForCurrentView(); return string.Format(resource.GetPlural(key, number),number); } #endif #if SILVERLIGHT || DESKTOP public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) #endif #if WINRT public object ConvertBack(object value, Type targetType, object parameter, string language) #endif { return null; } } } #endif
#if WINRT || SILVERLIGHT using Huyn.PluralNet; using System; using System.Globalization; #if WINRT using Windows.ApplicationModel.Resources; using Windows.UI.Xaml.Data; #endif #if SILVERLIGHT using System.Windows.Data; using System.Resources; #endif namespace Huyn.PluralNet.Converters { public class PluralConverter : IValueConverter { #if SILVERLIGHT public ResourceManager ResourceManager { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (ResourceManager == null) { throw new NullReferenceException("PluralConverter.ResourceManager can't be null"); } var key = parameter as string; if (string.IsNullOrWhiteSpace(key)) return ""; var number = (decimal)value; return ResourceManager.GetPlural(key, number); } #endif #if WINRT public object Convert(object value, Type targetType, object parameter, string language) { var key = parameter as string; if (string.IsNullOrWhiteSpace(key)) return ""; var number = (decimal)value; var resource = ResourceLoader.GetForCurrentView(); return resource.GetPlural(key, number); } #endif #if SILVERLIGHT || DESKTOP public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) #endif #if WINRT public object ConvertBack(object value, Type targetType, object parameter, string language) #endif { return null; } } } #endif
mit
C#
ad502608ac9be5269cb7dd08ec43ecf7659d95da
Update MicrosoftBannerAdUnitBundleTests.cs
tiksn/TIKSN-Framework
TIKSN.UnitTests.Shared/Advertising/MicrosoftBannerAdUnitBundleTests.cs
TIKSN.UnitTests.Shared/Advertising/MicrosoftBannerAdUnitBundleTests.cs
using FluentAssertions; using Xunit; namespace TIKSN.Advertising.Tests { public class MicrosoftBannerAdUnitBundleTests { [Fact] public void CreateMicrosoftBannerAdUnitBundle() { string applicationId = "b008491d-9b9b-4b78-9d5c-28e08b573268"; string adUnitId = "d34e3fdd-1840-455d-abab-f8698b5f3318"; var bundle = new MicrosoftBannerAdUnitBundle(applicationId, adUnitId); bundle.Production.ApplicationId.Should().Be(applicationId); bundle.Production.AdUnitId.Should().Be(adUnitId); bundle.Production.IsTest.Should().BeFalse(); bundle.DesignTime.IsTest.Should().BeTrue(); } } }
using FluentAssertions; using Xunit; namespace TIKSN.Advertising.Tests { public class MicrosoftBannerAdUnitBundleTests { [Fact] public void CreateMicrosoftBannerAdUnitBundle() { string tabletApplicationId = "b008491d-9b9b-4b78-9d5c-28e08b573268"; string tabletAdUnitId = "d34e3fdd-1840-455d-abab-f8698b5f3318"; string mobileApplicationId = "6d0d7c55-0f1a-4208-a7b9-a6943c84488a"; string mobileAdUnitId = "b7c073c3-5e40-47ae-b02b-eb2fa3f90036"; var bundle = new MicrosoftBannerAdUnitBundle(tabletApplicationId, tabletAdUnitId, mobileApplicationId, mobileAdUnitId); bundle.Tablet.ApplicationId.Should().Be(tabletApplicationId); bundle.Tablet.AdUnitId.Should().Be(tabletAdUnitId); bundle.Tablet.IsTest.Should().BeFalse(); bundle.Mobile.ApplicationId.Should().Be(mobileApplicationId); bundle.Mobile.AdUnitId.Should().Be(mobileAdUnitId); bundle.Mobile.IsTest.Should().BeFalse(); bundle.DesignTime.IsTest.Should().BeTrue(); } } }
mit
C#
976d1226cfd1194e181d7cbeddd9cd10492ae679
Update ILogProvider.cs
damianh/LibLog
src/LibLog/ILogProvider.cs
src/LibLog/ILogProvider.cs
using System; namespace YourRootNamespace.Logging { /// <summary> /// Represents a way to get a <see cref="Logger"/> /// </summary> #if LIBLOG_PROVIDERS_ONLY internal #else public #endif interface ILogProvider { /// <summary> /// Gets the specified named logger. /// </summary> /// <param name="name">Name of the logger.</param> /// <returns>The logger reference.</returns> Logger GetLogger(string name); /// <summary> /// Opens a nested diagnostics context. Not supported in EntLib logging. /// </summary> /// <param name="message">The message to add to the diagnostics context.</param> /// <returns>A disposable that when disposed removes the message from the context.</returns> IDisposable OpenNestedContext(string message); /// <summary> /// Opens a mapped diagnostics context. Not supported in EntLib logging. /// </summary> /// <param name="key">A key.</param> /// <param name="value">A value.</param> /// <param name="destructure">Determines whether to call the destructor or not.</param> /// <returns>A disposable that when disposed removes the map from the context.</returns> IDisposable OpenMappedContext(string key, object value, bool destructure = false); } }
using System; namespace YourRootNamespace.Logging { /// <summary> /// Represents a way to get a <see cref="ILog"/> /// </summary> #if LIBLOG_PROVIDERS_ONLY internal #else public #endif interface ILogProvider { /// <summary> /// Gets the specified named logger. /// </summary> /// <param name="name">Name of the logger.</param> /// <returns>The logger reference.</returns> Logger GetLogger(string name); /// <summary> /// Opens a nested diagnostics context. Not supported in EntLib logging. /// </summary> /// <param name="message">The message to add to the diagnostics context.</param> /// <returns>A disposable that when disposed removes the message from the context.</returns> IDisposable OpenNestedContext(string message); /// <summary> /// Opens a mapped diagnostics context. Not supported in EntLib logging. /// </summary> /// <param name="key">A key.</param> /// <param name="value">A value.</param> /// <param name="destructure">Determines whether to call the destructor or not.</param> /// <returns>A disposable that when disposed removes the map from the context.</returns> IDisposable OpenMappedContext(string key, object value, bool destructure = false); } }
mit
C#
8bf679db8be69f18ac06aba4972a14bcf5e8f513
Fix nullref in date text box
smoogipooo/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,peppy/osu-new,ppy/osu
osu.Game.Tournament/Components/DateTextBox.cs
osu.Game.Tournament/Components/DateTextBox.cs
// 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.Bindables; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; namespace osu.Game.Tournament.Components { public class DateTextBox : SettingsTextBox { public new Bindable<DateTimeOffset> Bindable { get => bindable; set { bindable = value.GetBoundCopy(); bindable.BindValueChanged(dto => base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); } } // hold a reference to the provided bindable so we don't have to in every settings section. private Bindable<DateTimeOffset> bindable = new Bindable<DateTimeOffset>(); public DateTextBox() { base.Bindable = new Bindable<string>(); ((OsuTextBox)Control).OnCommit = (sender, newText) => { try { bindable.Value = DateTimeOffset.Parse(sender.Text); } catch { // reset textbox content to its last valid state on a parse failure. bindable.TriggerChange(); } }; } } }
// 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.Bindables; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; namespace osu.Game.Tournament.Components { public class DateTextBox : SettingsTextBox { public new Bindable<DateTimeOffset> Bindable { get => bindable; set { bindable = value.GetBoundCopy(); bindable.BindValueChanged(dto => base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); } } // hold a reference to the provided bindable so we don't have to in every settings section. private Bindable<DateTimeOffset> bindable; public DateTextBox() { base.Bindable = new Bindable<string>(); ((OsuTextBox)Control).OnCommit = (sender, newText) => { try { bindable.Value = DateTimeOffset.Parse(sender.Text); } catch { // reset textbox content to its last valid state on a parse failure. bindable.TriggerChange(); } }; } } }
mit
C#
bc805eba6d23d12c67a2bc6ead642122fe10afbf
Update AssemblyInfo.cs
AdysTech/InfluxDB.Client.Net
AdysTech.InfluxDB.Client.Net/Properties/AssemblyInfo.cs
AdysTech.InfluxDB.Client.Net/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AdysTech.InfluxDB.Client.Net")] [assembly: AssemblyDescription(".Net client for InfluxDB")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("AdysTech")] [assembly: AssemblyProduct("AdysTech.InfluxDB.Client.Net")] [assembly: AssemblyCopyright("Copyright © AdysTech 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bbb8131a-a575-45f3-9306-a31673ad9875")] // 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("0.1.1.0")] [assembly: AssemblyFileVersion("0.1.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AdysTech.InfluxDB.Client.Net")] [assembly: AssemblyDescription(".Net client for InfluxDB")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("AdysTech")] [assembly: AssemblyProduct("AdysTech.InfluxDB.Client.Net")] [assembly: AssemblyCopyright("Copyright © AdysTech 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bbb8131a-a575-45f3-9306-a31673ad9875")] // 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("0.0.0.1")] [assembly: AssemblyFileVersion("0.0.0.1")]
mit
C#
cfe4a592c6710ef79821cb79a4fc5e3e50c9d436
bump to 1.17
Terradue/DotNetOpenSearch
Terradue.OpenSearch/Properties/AssemblyInfo.cs
Terradue.OpenSearch/Properties/AssemblyInfo.cs
/* * Copyright (C) 2010-2014 Terradue S.r.l. * * This file is part of Terradue.OpenSearch. * * Foobar is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Terradue.OpenSearch. * If not, see http://www.gnu.org/licenses/. */ /*! \namespace Terradue.OpenSearch @{ Terradue.OpenSearch is a .Net library that provides an engine perform OpenSearch query from a class or an URL to multiple and custom types of results \xrefitem sw_version "Versions" "Software Package Version" 1.17.0 \xrefitem sw_link "Link" "Software Package Link" [DotNetOpenSearch](https://github.com/Terradue/DotNetOpenSearch) \xrefitem sw_license "License" "Software License" [AGPL](https://github.com/DotNetOpenSearch/Terradue.OpenSearch/blob/master/LICENSE) \xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication \ingroup OpenSearch @} */ using System.Reflection; using System.Runtime.CompilerServices; using NuGet4Mono.Extensions; [assembly: AssemblyTitle("Terradue.OpenSearch")] [assembly: AssemblyDescription("Terradue.OpenSearch is a library targeting .NET 4.0 and above that provides an easy way to perform OpenSearch query from a class or an URL to multiple and custom types of results (Atom, Rdf...)")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Terradue")] [assembly: AssemblyProduct("Terradue.OpenSearch")] [assembly: AssemblyCopyright("Terradue")] [assembly: AssemblyAuthors("Emmanuel Mathot")] [assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearch")] [assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearch/blob/master/LICENSE")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.17.0.*")] [assembly: AssemblyInformationalVersion("1.17.0")]
/* * Copyright (C) 2010-2014 Terradue S.r.l. * * This file is part of Terradue.OpenSearch. * * Foobar is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Terradue.OpenSearch. * If not, see http://www.gnu.org/licenses/. */ /*! \namespace Terradue.OpenSearch @{ Terradue.OpenSearch is a .Net library that provides an engine perform OpenSearch query from a class or an URL to multiple and custom types of results \xrefitem sw_version "Versions" "Software Package Version" 1.16.1 \xrefitem sw_link "Link" "Software Package Link" [DotNetOpenSearch](https://github.com/Terradue/DotNetOpenSearch) \xrefitem sw_license "License" "Software License" [AGPL](https://github.com/DotNetOpenSearch/Terradue.OpenSearch/blob/master/LICENSE) \xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication \ingroup OpenSearch @} */ using System.Reflection; using System.Runtime.CompilerServices; using NuGet4Mono.Extensions; [assembly: AssemblyTitle("Terradue.OpenSearch")] [assembly: AssemblyDescription("Terradue.OpenSearch is a library targeting .NET 4.0 and above that provides an easy way to perform OpenSearch query from a class or an URL to multiple and custom types of results (Atom, Rdf...)")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Terradue")] [assembly: AssemblyProduct("Terradue.OpenSearch")] [assembly: AssemblyCopyright("Terradue")] [assembly: AssemblyAuthors("Emmanuel Mathot")] [assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearch")] [assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearch/blob/master/LICENSE")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.16.1.*")] [assembly: AssemblyInformationalVersion("1.16.1")]
agpl-3.0
C#
9c3e67e531424fe5453ee825db74582f8031e353
Use C# 9 top-level statements.
ejball/XmlDocMarkdown
src/xmldocmd/Program.cs
src/xmldocmd/Program.cs
using XmlDocMarkdown.Core; return XmlDocMarkdownApp.Run(args);
using XmlDocMarkdown.Core; namespace XmlDocMarkdown { public static class Program { public static int Main(string[] args) => XmlDocMarkdownApp.Run(args); } }
mit
C#
109c2ae56e5387d701827b55020a7311b94f0959
Fix SaaSBehavior
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
InfinniPlatform.SystemConfig/Properties/AssemblyInfo.cs
InfinniPlatform.SystemConfig/Properties/AssemblyInfo.cs
// 1 // 0 // 0 // 87 // 3dbb67e9-cec8-4cb9-979d-256ebb464baf // 4D908DD410F25EA9607950A27B66CB96 using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("InfinniPlatform.SystemConfig")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Infinnity Solutions")] [assembly: AssemblyProduct("InfinniPlatform")] [assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("3dbb67e9-cec8-4cb9-979d-256ebb464baf")] [assembly: AssemblyVersion("1.0.0.87")] [assembly: AssemblyFileVersion("1.0.0.87")] [assembly: InternalsVisibleTo("InfinniPlatform.SystemConfig.Tests")] [assembly: AssemblyDescription("InfinniPlatform.SystemConfig")]
// 1 // 0 // 0 // 86 // 3dbb67e9-cec8-4cb9-979d-256ebb464baf // D56B9499D7CBBDB3222BA7AE7D993849 using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("InfinniPlatform.SystemConfig")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Infinnity Solutions")] [assembly: AssemblyProduct("InfinniPlatform")] [assembly: AssemblyCopyright("Copyright © Infinnity Solutions 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("3dbb67e9-cec8-4cb9-979d-256ebb464baf")] [assembly: AssemblyVersion("1.0.0.86")] [assembly: AssemblyFileVersion("1.0.0.86")] [assembly: InternalsVisibleTo("InfinniPlatform.SystemConfig.Tests")] [assembly: AssemblyDescription("InfinniPlatform.SystemConfig")]
agpl-3.0
C#
995f7c2d6c93c0ee92587afbc286cc499a3265f4
Update Program.cs
SimonCropp/CaptureSnippets
src/GitHubMarkdownSnippets/Program.cs
src/GitHubMarkdownSnippets/Program.cs
using System; using System.IO; using CaptureSnippets; class Program { static void Main(string[] args) { var targetDirectory = GetTargetDirectory(args); try { DirectorySourceMarkdownProcessor.Run(targetDirectory); } catch (SnippetReadingException readingException) { Console.WriteLine($"Failed to read snippets: {readingException.Message}"); Environment.Exit(1); } catch (MarkdownProcessingException processingException) { Console.WriteLine($"Failed to process markdown files: {processingException.Message}"); Environment.Exit(1); } } static string GetTargetDirectory(string[] args) { if (args.Length > 1) { Console.WriteLine("Only one argument (target directory) is supported"); Environment.Exit(1); } if (args.Length == 1) { var targetDirectory = args[0]; if (Directory.Exists(targetDirectory)) { return targetDirectory; } Console.WriteLine($"Target directory does not exist: {targetDirectory}"); Environment.Exit(1); } var currentDirectory = Environment.CurrentDirectory; if (!GitRepoDirectoryFinder.IsInGitRepository(currentDirectory)) { Console.WriteLine($"The current directory does no exist with a .git repository. Pass in a target directory instead. Current directory: {currentDirectory}"); Environment.Exit(1); } return currentDirectory; } }
using System; using System.IO; using CaptureSnippets; class Program { static void Main(string[] args) { var targetDirectory = GetTargetDirectory(args); try { DirectorySourceMarkdownProcessor.Run(targetDirectory); } catch (SnippetReadingException snippetReadingException) { Console.WriteLine($"Failed to read snippets: {snippetReadingException.Message}"); Environment.Exit(1); } catch (MarkdownProcessingException markdownProcessingException) { Console.WriteLine($"Failed to process markdown files: {markdownProcessingException.Message}"); Environment.Exit(1); } } static string GetTargetDirectory(string[] args) { if (args.Length > 1) { Console.WriteLine("Only one argument (target directory) is supported"); Environment.Exit(1); } if (args.Length == 1) { var targetDirectory = args[0]; if (Directory.Exists(targetDirectory)) { return targetDirectory; } Console.WriteLine($"Target directory does not exist: {targetDirectory}"); Environment.Exit(1); } var currentDirectory = Environment.CurrentDirectory; if (!GitRepoDirectoryFinder.IsInGitRepository(currentDirectory)) { Console.WriteLine($"The current directory does no exist with a .git repository. Pass in a target directory instead. Current directory: {currentDirectory}"); Environment.Exit(1); } return currentDirectory; } }
mit
C#
eef32b80a765f179bf06845d09f3e83ba4684057
Improve usability of ODBFactory
WaltChen/NDatabase,WaltChen/NDatabase
src/Odb/ODBFactory.cs
src/Odb/ODBFactory.cs
namespace NDatabase.Odb { /// <summary> /// The NDatabase Factory to open new instance of local odb. /// </summary> public static class OdbFactory { private static string _last; /// <summary> /// Open a ODB database instance with a given name /// </summary> /// <param name="fileName"> The ODB database name </param> /// <returns> A local ODB implementation </returns> public static IOdb Open(string fileName) { _last = fileName; return Impl.Main.Odb.GetInstance(fileName); } /// <summary> /// Open a ODB database instance with a last given name /// </summary> /// <returns> A local ODB implementation </returns> public static IOdb OpenLast() { return Impl.Main.Odb.GetInstance(_last); } } }
using NDatabase.Odb.Impl.Main; namespace NDatabase.Odb { /// <summary> /// The NDatabase Factory to open new instance of local odb. /// </summary> public static class OdbFactory { /// <summary> /// Open a ODB database instance with a given name /// </summary> /// <param name="fileName"> The ODB database name </param> /// <returns> A local ODB implementation </returns> public static IOdb Open(string fileName) { return Impl.Main.Odb.GetInstance(fileName); } } }
apache-2.0
C#
44271088ec96b4d16ae44895650a9f08e7447d3a
Fix again
SuperJMN/Zafiro
Source/Zafiro.Core/UI/DialogMixin.cs
Source/Zafiro.Core/UI/DialogMixin.cs
using System; using System.Reactive.Linq; using ReactiveUI; namespace Zafiro.Core.UI { public static class DialogMixin { public static IDisposable HandleExceptionsFromCommand(this IDialogService dialogService, IReactiveCommand command, string title = null, string message = null) { return command.ThrownExceptions .SelectMany(exception => { return Observable.FromAsync( () => dialogService.Show(title ?? "An error has occurred", message ?? exception.Message)); }).Subscribe(); } } }
using System; using System.Reactive.Linq; using ReactiveUI; namespace Zafiro.Core.UI { public static class DialogMixin { public static IDisposable HandleExceptionsFromCommand<TInput, TOutput>(this IDialogService dialogService, IReactiveCommand command, string title = null, string message = null) { return command.ThrownExceptions .SelectMany(exception => { return Observable.FromAsync( () => dialogService.Show(title ?? "An error has occurred", message ?? exception.Message)); }).Subscribe(); } } }
mit
C#
573901248f0e63c51c0fb569e1f690014041fd4b
improve debugging query
kreeben/resin,kreeben/resin
src/Sir.Store/Term.cs
src/Sir.Store/Term.cs
using System; namespace Sir { /// <summary> /// A query term. /// </summary> public class Term { public IComparable Key { get; private set; } public AnalyzedString TokenizedString { get; set; } public long KeyId { get; set; } public int Index { get; set; } public string GetString() { var token = TokenizedString.Tokens[Index]; return TokenizedString.Original.Substring(token.offset, token.length); } public Term(IComparable key, AnalyzedString tokenizedString, int index) { Key = key; TokenizedString = tokenizedString; Index = index; } public override string ToString() { return string.Format("{0}:{1}", Key, GetString()); } } }
using System; namespace Sir { /// <summary> /// A query term. /// </summary> [System.Diagnostics.DebuggerDisplay("{Key}:{TokenizedString.Original}")] public class Term { public IComparable Key { get; private set; } public AnalyzedString TokenizedString { get; set; } public long KeyId { get; set; } public int Index { get; set; } public Term(IComparable key, AnalyzedString tokenizedString, int index) { Key = key; TokenizedString = tokenizedString; Index = index; } public override string ToString() { return string.Format("{0}:{1}", Key, TokenizedString.Original); } } }
mit
C#
4a97ddd736aece816e80746d00cf29784f53ece2
Add test TakeLastDisposesSequenceEnumerator
ddpruitt/morelinq,morelinq/MoreLINQ,fsateler/MoreLINQ,fsateler/MoreLINQ,morelinq/MoreLINQ,ddpruitt/morelinq
MoreLinq.Test/TakeLastTest.cs
MoreLinq.Test/TakeLastTest.cs
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. // // 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. #endregion using System; using NUnit.Framework; namespace MoreLinq.Test { [TestFixture] public class TakeLastTest { [Test] [ExpectedException(typeof(ArgumentNullException))] public void TakeLastNullSource() { MoreEnumerable.TakeLast<object>(null, 0); } [Test] public void TakeLast() { var result = new[]{ 12, 34, 56, 78, 910, 1112 }.TakeLast(3); result.AssertSequenceEqual(78, 910, 1112); } [Test] public void TakeLastOnSequenceShortOfCount() { var result = new[] { 12, 34, 56 }.TakeLast(5); result.AssertSequenceEqual(12, 34, 56); } [Test] public void TakeLastWithNegativeCount() { var result = new[] { 12, 34, 56 }.TakeLast(-2); Assert.IsFalse(result.GetEnumerator().MoveNext()); } [Test] public void TakeLastIsLazy() { new BreakingSequence<object>().TakeLast(1); } [Test] public void TakeLastDisposesSequenceEnumerator() { using (var seq = TestingSequence.Of(1,2,3)) { seq.TakeLast(1).Consume(); } } } }
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. // // 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. #endregion using System; using NUnit.Framework; namespace MoreLinq.Test { [TestFixture] public class TakeLastTest { [Test] [ExpectedException(typeof(ArgumentNullException))] public void TakeLastNullSource() { MoreEnumerable.TakeLast<object>(null, 0); } [Test] public void TakeLast() { var result = new[]{ 12, 34, 56, 78, 910, 1112 }.TakeLast(3); result.AssertSequenceEqual(78, 910, 1112); } [Test] public void TakeLastOnSequenceShortOfCount() { var result = new[] { 12, 34, 56 }.TakeLast(5); result.AssertSequenceEqual(12, 34, 56); } [Test] public void TakeLastWithNegativeCount() { var result = new[] { 12, 34, 56 }.TakeLast(-2); Assert.IsFalse(result.GetEnumerator().MoveNext()); } [Test] public void TakeLastIsLazy() { new BreakingSequence<object>().TakeLast(1); } } }
apache-2.0
C#
fb9186281fa55d2084144decb627d529f2f917d3
Fix unit list page
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Units/List.cshtml
Battery-Commander.Web/Views/Units/List.cshtml
@model IEnumerable<Unit> <h2>Units @Html.ActionLink("Add New", "New", "Units", null, new { @class = "btn btn-default" })</h2> <table class="table table-striped"> <thead> <tr> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Name)</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().UIC)</th> <th></th> </tr> </thead> <tbody> @foreach (var unit in Model) { <tr> <td>@Html.DisplayFor(s => unit)</td> <td>@Html.DisplayFor(s => unit.UIC)</td> <td> @Html.ActionLink("Edit", "Edit", new { unit.Id }) @Html.ActionLink("Soldiers", "Index", "Soldiers", new { unit = unit.Id }) </td> </tr> } </tbody> </table>
@model IEnumerable<Unit> <h2>Units @Html.ActionLink("Add New", "New", "Units", null, new { @class = "btn btn-default" })</h2> <table class="table table-striped"> <thead> <tr> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault())</th> <th>@Html.DisplayNameFor(_ => _.FirstOrDefault().UIC)</th> <th></th> </tr> </thead> <tbody> @foreach (var unit in Model) { <tr> <td>@Html.DisplayFor(s => unit)</td> <td>@Html.DisplayFor(s => unit.UIC)</td> <td> @Html.ActionLink("Edit", "Edit", new { unit.Id }) @Html.ActionLink("Soldiers", "Index", "Soldiers", new { unit = unit.Id }) </td> </tr> } </tbody> </table>
mit
C#
7d98263a8b5950516c091a8770ab108dc44757de
Extend character set of function names (including ".") (again)
Excel-DNA/IntelliSense
Source/ExcelDna.IntelliSense/UIMonitor/FormulaParser.cs
Source/ExcelDna.IntelliSense/UIMonitor/FormulaParser.cs
using System; using System.Linq; using System.Text.RegularExpressions; namespace ExcelDna.IntelliSense { static class FormulaParser { // Set from IntelliSenseDisplay.Initialize public static char ListSeparator = ','; // TODO: What's the Unicode situation? public static string forbiddenNameCharacters = @"\ /\-:;!@\#\$%\^&\*\(\)\+=,<>\[\]{}|'\"""; public static string functionNameRegex = "[" + forbiddenNameCharacters + "](?<functionName>[^" + forbiddenNameCharacters + "]*)$"; public static string functionNameGroupName = "functionName"; internal static bool TryGetFormulaInfo(string formulaPrefix, out string functionName, out int currentArgIndex) { formulaPrefix = Regex.Replace(formulaPrefix, "(\"[^\"]*\")|(\\([^\\(\\)]*\\))| ", string.Empty); while (Regex.IsMatch(formulaPrefix, "\\([^\\(\\)]*\\)")) { formulaPrefix = Regex.Replace(formulaPrefix, "\\([^\\(\\)]*\\)", string.Empty); } int lastOpeningParenthesis = formulaPrefix.LastIndexOf("(", formulaPrefix.Length - 1, StringComparison.Ordinal); if (lastOpeningParenthesis > -1) { var match = Regex.Match(formulaPrefix.Substring(0, lastOpeningParenthesis), functionNameRegex); if (match.Success) { functionName = match.Groups[functionNameGroupName].Value; currentArgIndex = formulaPrefix.Substring(lastOpeningParenthesis, formulaPrefix.Length - lastOpeningParenthesis).Count(c => c == ListSeparator); return true; } } functionName = null; currentArgIndex = -1; return false; } } }
using System; using System.Linq; using System.Text.RegularExpressions; namespace ExcelDna.IntelliSense { static class FormulaParser { // Set from IntelliSenseDisplay.Initialize public static char ListSeparator = ','; internal static bool TryGetFormulaInfo(string formulaPrefix, out string functionName, out int currentArgIndex) { formulaPrefix = Regex.Replace(formulaPrefix, "(\"[^\"]*\")|(\\([^\\(\\)]*\\))| ", string.Empty); while (Regex.IsMatch(formulaPrefix, "\\([^\\(\\)]*\\)")) { formulaPrefix = Regex.Replace(formulaPrefix, "\\([^\\(\\)]*\\)", string.Empty); } int lastOpeningParenthesis = formulaPrefix.LastIndexOf("(", formulaPrefix.Length - 1, StringComparison.Ordinal); if (lastOpeningParenthesis > -1) { var match = Regex.Match(formulaPrefix.Substring(0, lastOpeningParenthesis), @"[^\w.](?<functionName>[\w.]*)$"); if (match.Success) { functionName = match.Groups["functionName"].Value; currentArgIndex = formulaPrefix.Substring(lastOpeningParenthesis, formulaPrefix.Length - lastOpeningParenthesis).Count(c => c == ListSeparator); return true; } } functionName = null; currentArgIndex = -1; return false; } } }
mit
C#
cd08912fcbbf228e5ae722e79d6863dbd34b1228
Remove search page from top menu
TeaCommerce/Starter-kit-for-Umbraco,TeaCommerce/Starter-kit-for-Umbraco,TeaCommerce/Starter-kit-for-Umbraco
Source/Website/Views/Partials/Navigation/TopMenu.cshtml
Source/Website/Views/Partials/Navigation/TopMenu.cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ IPublishedContent currentContent = Model.Content, home = currentContent.AncestorOrSelf( 1 ); //Get all child items of home, except for the Cart page IReadOnlyList<IPublishedContent> menuItems = home.Children.Where( c => c.DocumentTypeAlias != "Cart" && c.DocumentTypeAlias != "productSearchPage" ).ToList(); string homeName = home.Name, homeCssClass = home.Id == currentContent.Id ? "active" : ""; } <!-- Static navbar --> <nav class="navbar navbar-default navbar-static-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">Tea Commerce Starter Kit</a> </div> <div class="navbar-right"> @Html.Partial( "Cart/Minicart" ) </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="@homeCssClass"><a href="/">@homeName</a></li> @foreach ( IPublishedContent menuItem in menuItems ) { string liCssClass = menuItem.IsAncestorOrSelf( currentContent ) ? "active" : ""; <li class="@liCssClass"><a href="@menuItem.Url">@menuItem.Name</a></li> } </ul> </div> </div> </nav>
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ IPublishedContent currentContent = Model.Content, home = currentContent.AncestorOrSelf( 1 ); //Get all child items of home, except for the Cart page IReadOnlyList<IPublishedContent> menuItems = home.Children.Where( c => c.DocumentTypeAlias != "Cart" ).ToList(); string homeName = home.Name, homeCssClass = home.Id == currentContent.Id ? "active" : ""; } <!-- Static navbar --> <nav class="navbar navbar-default navbar-static-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">Tea Commerce Starter Kit</a> </div> <div class="navbar-right"> @Html.Partial( "Cart/Minicart" ) </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="@homeCssClass"><a href="/">@homeName</a></li> @foreach ( IPublishedContent menuItem in menuItems ) { string liCssClass = menuItem.IsAncestorOrSelf( currentContent ) ? "active" : ""; <li class="@liCssClass"><a href="@menuItem.Url">@menuItem.Name</a></li> } </ul> </div> </div> </nav>
mit
C#
bb58997c7ad6465017d1961cec03939f5fef8f5e
Update to Unity 5.2 cleanup.
drawcode/game-lib-engine
Engine/Vehicle/AI/Scripts/ColliderFriction.cs
Engine/Vehicle/AI/Scripts/ColliderFriction.cs
using UnityEngine; using System.Collections; public class ColliderFriction : GameObjectBehavior { public float frictionValue=0; // Use this for initialization void Start () { collider.material.staticFriction = frictionValue; //collider.material.staticFriction2 = frictionValue; collider.material.dynamicFriction = frictionValue; //collider.material.dynamicFriction2 = frictionValue; } }
using UnityEngine; using System.Collections; public class ColliderFriction : GameObjectBehavior { public float frictionValue=0; // Use this for initialization void Start () { collider.material.staticFriction = frictionValue; collider.material.staticFriction2 = frictionValue; collider.material.dynamicFriction = frictionValue; collider.material.dynamicFriction2 = frictionValue; } }
mit
C#
9a996d3e2e2129efcdeb2ae411b644ce04ab67be
Fix version of .NET Framework used to look up XML documentation
ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab
source/NetFramework/Server/Platform/Net48AssemblyDocumentationResolver.cs
source/NetFramework/Server/Platform/Net48AssemblyDocumentationResolver.cs
using System.Collections.Generic; using System.IO; using System.Reflection; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using AshMind.Extensions; using System; using SharpLab.Server.Common.Internal; namespace SharpLab.Server.Owin.Platform { public class Net48AssemblyDocumentationResolver : IAssemblyDocumentationResolver { private static readonly string ReferenceAssemblyRootPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8"; public DocumentationProvider? GetDocumentation([NotNull] Assembly assembly) { foreach (var xmlPath in GetCandidatePaths(assembly)) { if (File.Exists(xmlPath)) return XmlDocumentationProvider.CreateFromFile(xmlPath); } return null; } private IEnumerable<string> GetCandidatePaths(Assembly assembly) { var file = assembly.GetAssemblyFileFromCodeBase(); yield return Path.ChangeExtension(file.FullName, ".xml"); yield return Path.Combine(ReferenceAssemblyRootPath, Path.ChangeExtension(file.Name, ".xml")); } } }
using System.Collections.Generic; using System.IO; using System.Reflection; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using AshMind.Extensions; using System; using SharpLab.Server.Common.Internal; namespace SharpLab.Server.Owin.Platform { public class Net48AssemblyDocumentationResolver : IAssemblyDocumentationResolver { private static readonly string ReferenceAssemblyRootPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7"; public DocumentationProvider? GetDocumentation([NotNull] Assembly assembly) { foreach (var xmlPath in GetCandidatePaths(assembly)) { if (File.Exists(xmlPath)) return XmlDocumentationProvider.CreateFromFile(xmlPath); } return null; } private IEnumerable<string> GetCandidatePaths(Assembly assembly) { var file = assembly.GetAssemblyFileFromCodeBase(); yield return Path.ChangeExtension(file.FullName, ".xml"); yield return Path.Combine(ReferenceAssemblyRootPath, Path.ChangeExtension(file.Name, ".xml")); } } }
bsd-2-clause
C#
d830e8b2eba3138acf350063ee92fc1d7d99addc
Extend RegisterConfigSettings to also register MicrosoftConsoleLayoutRenderer (#567)
NLog/NLog.Extensions.Logging
src/NLog.Extensions.Logging/Config/SetupExtensionsBuilderExtensions.cs
src/NLog.Extensions.Logging/Config/SetupExtensionsBuilderExtensions.cs
using Microsoft.Extensions.Configuration; using NLog.Config; namespace NLog.Extensions.Logging { /// <summary> /// Extension methods to setup NLog extensions, so they are known when loading NLog LoggingConfiguration /// </summary> public static class SetupExtensionsBuilderExtensions { /// <summary> /// Setup the MEL-configuration for the ${configsetting} layoutrenderer /// </summary> public static ISetupExtensionsBuilder RegisterConfigSettings(this ISetupExtensionsBuilder setupBuilder, IConfiguration configuration) { ConfigSettingLayoutRenderer.DefaultConfiguration = configuration; return setupBuilder.RegisterLayoutRenderer<ConfigSettingLayoutRenderer>("configsetting").RegisterLayoutRenderer<MicrosoftConsoleLayoutRenderer>("MicrosoftConsoleLayout"); } } }
using Microsoft.Extensions.Configuration; using NLog.Config; namespace NLog.Extensions.Logging { /// <summary> /// Extension methods to setup NLog extensions, so they are known when loading NLog LoggingConfiguration /// </summary> public static class SetupExtensionsBuilderExtensions { /// <summary> /// Setup the MEL-configuration for the ${configsetting} layoutrenderer /// </summary> public static ISetupExtensionsBuilder RegisterConfigSettings(this ISetupExtensionsBuilder setupBuilder, IConfiguration configuration) { ConfigSettingLayoutRenderer.DefaultConfiguration = configuration; return setupBuilder.RegisterLayoutRenderer<ConfigSettingLayoutRenderer>("configsetting"); } } }
bsd-2-clause
C#
986abf088bfff87c19e21d9dca47f09daa444584
Add property
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerFinance.Web/ViewModels/Transfers/IndexViewModel.cs
src/SFA.DAS.EmployerFinance.Web/ViewModels/Transfers/IndexViewModel.cs
namespace SFA.DAS.EmployerFinance.Web.ViewModels.Transfers { public class IndexViewModel { public bool RenderCreateTransfersPledgeButton { get; set; } public bool RenderApplicationListButton { get; set; } public bool CanViewPledgesSection { get; set; } public int PledgesCount { get; set; } public int ApplicationsCount { get; set; } public decimal StartingTransferAllowance { get; set; } public string FinancialYearString { get; set; } public string HashedAccountID { get; set; } } }
namespace SFA.DAS.EmployerFinance.Web.ViewModels.Transfers { public class IndexViewModel { public bool RenderCreateTransfersPledgeButton { get; set; } public bool RenderApplicationListButton { get; set; } public bool CanViewPledgesSection { get; set; } public int PledgesCount { get; set; } public int ApplicationsCount { get; set; } public decimal StartingTransferAllowance { get; set; } public string FinancialYearString { get; set; } } }
mit
C#
9a35a3ebbaede38d33e0433594ffde3c79ca6460
add cors policy
alkukampela/curling,alkukampela/curling,alkukampela/curling,alkukampela/curling,alkukampela/curling
results/Startup.cs
results/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace results { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseCors("MyPolicy"); app.UseMvc(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace results { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc(); } } }
mit
C#
3da2c78ba4433ffe48e1e5e7cb2ca55727bcca1b
check in rest
dbaeck/ai-playground,dbaeck/ai-playground,dbaeck/ai-playground,dbaeck/ai-playground
AIPlayground/AIPlayground/Search/Algorithm/GraphSearch/DepthFirstSearch.cs
AIPlayground/AIPlayground/Search/Algorithm/GraphSearch/DepthFirstSearch.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AIPlayground.Search.Problem; namespace AIPlayground.Search.Algorithm.GraphSearch { public class DepthFirstSearch:GraphSearch { public DepthFirstSearch(SearchProblem problem) : base(problem) { } public override SearchNode Search() { SearchNode current = null; SearchNode goal = null; while (Fringe.Any()) { current = Fringe.Pop(); if (Problem.GoalCheck(current.CurrentState)) return current; if (!ClosedList.Contains(current)) { Fringe.Push(CreateSearchNode(Problem.Expand(current.CurrentState), current)); //TODO: Implement as HashTable ClosedList.Add(current); } } return null; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AIPlayground.Search.Problem; namespace AIPlayground.Search.Algorithm.GraphSearch { public class DepthFirstSearch:GraphSearch { public DepthFirstSearch(SearchProblem problem) : base(problem) { } public override SearchNode Search() { SearchNode current = null; SearchNode goal = null; while (Fringe.Any()) { current = Fringe.Pop(); if (Problem.GoalCheck(current.CurrentState)) return current; if (!ClosedList.Contains(current)) { Fringe.Push(CreateSearchNode(Problem.Expand(current.CurrentState), current)); //TODO: Implement as HashTable ClosedList.Add(current); } } return null; } has } }
mit
C#
26fa1577d54b790488e66221268962a7b6cca1ae
Update Version.cs for SdkVersion = 5.7.4
plivo/plivo-dotnet,plivo/plivo-dotnet
src/Plivo/Version.cs
src/Plivo/Version.cs
using System; namespace Plivo { /// <summary> /// Version. /// </summary> public class Version { /// <summary> /// DotNet SDK version /// </summary> public const string SdkVersion = "5.7.4"; /// <summary> /// Plivo API version /// </summary> public const string ApiVersion = "v1"; } }
using System; namespace Plivo { /// <summary> /// Version. /// </summary> public class Version { /// <summary> /// DotNet SDK version /// </summary> public const string SdkVersion = "5.7.3"; /// <summary> /// Plivo API version /// </summary> public const string ApiVersion = "v1"; } }
mit
C#
77f7ee161e997fd9474097f63dba38a8cbd44722
Fix test file whitespace.
WebApiContrib/WebApiContrib.Formatting.Razor,WebApiContrib/WebApiContrib.Formatting.Razor,WebApiContrib/WebApiContrib.Formatting.Html,WebApiContrib/WebApiContrib.Formatting.Html,WebApiContrib/WebApiContrib.Formatting.RazorViewEngine,manesiotise/WebApiContrib.Formatting.Razor
test/WebApiContrib.Formatting.RazorViewEngine.Tests/ViewEngineTests.cs
test/WebApiContrib.Formatting.RazorViewEngine.Tests/ViewEngineTests.cs
using System.Net.Http; using NUnit.Framework; using WebApiContrib.Formatting.Html; using WebApiContrib.Formatting.Html.Configuration; using WebApiContrib.Formatting.Html.Formatters; using WebApiContrib.Formatting.Razor; namespace WebApiContrib.Formatting.RazorViewEngine.Tests { [TestFixture] public class ViewEngineTests { private HtmlMediaTypeViewFormatter _formatter; [SetUp] public void Before() { _formatter = new HtmlMediaTypeViewFormatter(); GlobalViews.DefaultViewParser = new RazorViewParser(); GlobalViews.DefaultViewLocator = new RazorViewLocator(); } [Test] public void render_simple_template() { var view = new View("Test1", new {Name = "foo"}); var content = new ObjectContent<View>(view, _formatter); var output = content.ReadAsStringAsync().Result; Assert.AreEqual("Hello foo! Welcome to Razor!", output); } [Test] public void render_template_with_embedded_layout() { var view = new View("Test2", new { Name = "foo" }); var content = new ObjectContent<View>(view, _formatter); var output = content.ReadAsStringAsync().Result; Assert.AreEqual("<html>Hello foo! Welcome to Razor!</html>", output); } [Test] public void render_template_with_specified_resolver() { var resolver = new EmbeddedResolver(this.GetType()); var formatter = new HtmlMediaTypeViewFormatter(null, new RazorViewLocator(), new RazorViewParser(resolver)); var view = new View("Test2", new { Name = "foo" }); var content = new ObjectContent<View>(view, formatter); var output = content.ReadAsStringAsync().Result; Assert.AreEqual("<html>Hello foo! Welcome to Razor!</html>", output); } } }
using System.IO; using System.Net.Http; using System.Reflection; using NUnit.Framework; using WebApiContrib.Formatting.Html; using WebApiContrib.Formatting.Html.Configuration; using WebApiContrib.Formatting.Html.Formatters; using WebApiContrib.Formatting.Razor; namespace WebApiContrib.Formatting.RazorViewEngine.Tests { [TestFixture] public class ViewEngineTests { private HtmlMediaTypeViewFormatter _formatter; [SetUp] public void Before() { _formatter = new HtmlMediaTypeViewFormatter(); GlobalViews.DefaultViewParser = new RazorViewParser(); GlobalViews.DefaultViewLocator = new RazorViewLocator(); } [Test] public void render_simple_template() { var view = new View("Test1", new {Name = "foo"}); var content = new ObjectContent<View>(view, _formatter); var output = content.ReadAsStringAsync().Result; Assert.AreEqual("Hello foo! Welcome to Razor!", output); } [Test] public void render_template_with_embedded_layout() { var view = new View("Test2", new { Name = "foo" }); var content = new ObjectContent<View>(view, _formatter); var output = content.ReadAsStringAsync().Result; Assert.AreEqual("<html>Hello foo! Welcome to Razor!</html>", output); } [Test] public void render_template_with_specified_resolver() { var resolver = new EmbeddedResolver(this.GetType()); var formatter = new HtmlMediaTypeViewFormatter(null, new RazorViewLocator(), new RazorViewParser(resolver)); var view = new View("Test2", new { Name = "foo" }); var content = new ObjectContent<View>(view, formatter); var output = content.ReadAsStringAsync().Result; Assert.AreEqual("<html>Hello foo! Welcome to Razor!</html>", output); } } }
mit
C#
3ce2451faaee30ab500f95262c130e940483201d
remove NET_40 pragma
ZocDoc/ZocBuild.Database
ZocBuild.Database/Util/DbCommandExtensions.cs
ZocBuild.Database/Util/DbCommandExtensions.cs
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZocBuild.Database.Util { internal static class DbCommandExtensions { public static async Task<IDataReader> ExecuteReaderAsync(this IDbCommand command) { var sqlCommand = command as SqlCommand; if (sqlCommand != null) { return await sqlCommand.ExecuteReaderAsync(); } else { return command.ExecuteReader(); } } public static async Task<int> ExecuteNonQueryAsync(this IDbCommand command) { var sqlCommand = command as SqlCommand; if (sqlCommand != null) { return await sqlCommand.ExecuteNonQueryAsync(); } else { return command.ExecuteNonQuery(); } } } }
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZocBuild.Database.Util { internal static class DbCommandExtensions { public static async Task<IDataReader> ExecuteReaderAsync(this IDbCommand command) { var sqlCommand = command as SqlCommand; if (sqlCommand != null) { #if NET_40 var asyncResult = sqlCommand.BeginExecuteReader(); return await Task.Factory.FromAsync<SqlDataReader>(asyncResult, sqlCommand.EndExecuteReader); #else return await sqlCommand.ExecuteReaderAsync(); #endif } else { return command.ExecuteReader(); } } #pragma warning disable 1998 public static async Task<int> ExecuteNonQueryAsync(this IDbCommand command) { var sqlCommand = command as SqlCommand; if (sqlCommand != null) { #if NET_40 var asyncResult = sqlCommand.BeginExecuteNonQuery(); return await Task.Factory.FromAsync<int>(asyncResult, sqlCommand.EndExecuteNonQuery); #else return await sqlCommand.ExecuteNonQueryAsync(); #endif } else { return command.ExecuteNonQuery(); } } #pragma warning restore 1998 } }
mit
C#
78b73245d8611c448e2b99714f4c56009ecf931c
revert bug in GetCSharpSimpleName
the-ress/HarshPoint,NaseUkolyCZ/HarshPoint,HarshPoint/HarshPoint
src/HarshPoint/Extensions/TypeInfoExtensions.cs
src/HarshPoint/Extensions/TypeInfoExtensions.cs
using System; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Text.RegularExpressions; namespace HarshPoint { public static class TypeInfoExtensions { public static String GetCSharpSimpleName(this TypeInfo typeInfo) { if (typeInfo == null) { throw Error.ArgumentNull(nameof(typeInfo)); } var nameWithoutArgCount = Regex.Replace(typeInfo.Name, "`\\d+$", String.Empty); var result = new StringBuilder(nameWithoutArgCount); if (typeInfo.IsGenericTypeDefinition) { AppendGenericArgumentsOrParameters( result, typeInfo.GenericTypeParameters ); } else if (typeInfo.IsGenericType) { AppendGenericArgumentsOrParameters( result, typeInfo.GenericTypeArguments ); } return result.ToString(); } private static void AppendGenericArgumentsOrParameters(StringBuilder result, IEnumerable<Type> argsOrParams) { if (!argsOrParams.Any()) { return; } const String Delimiter = ", "; result.Append('<'); foreach (var item in argsOrParams) { result.Append(GetCSharpSimpleName(item.GetTypeInfo())); result.Append(Delimiter); } result.Length -= Delimiter.Length; result.Append('>'); } } }
using System; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Text.RegularExpressions; namespace HarshPoint { public static class TypeInfoExtensions { public static String GetCSharpSimpleName(this TypeInfo typeInfo) { if (typeInfo == null) { throw Error.ArgumentNull(nameof(typeInfo)); } var result = new StringBuilder(); if (typeInfo.IsNested) { result.Append(typeInfo.DeclaringType.GetTypeInfo().GetCSharpSimpleName()); result.Append('.'); } var nameWithoutArgCount = Regex.Replace(typeInfo.Name, "`\\d+$", String.Empty); result.Append(nameWithoutArgCount); if (typeInfo.IsGenericTypeDefinition) { AppendGenericArgumentsOrParameters( result, typeInfo.GenericTypeParameters ); } else if (typeInfo.IsGenericType) { AppendGenericArgumentsOrParameters( result, typeInfo.GenericTypeArguments ); } return result.ToString(); } private static void AppendGenericArgumentsOrParameters(StringBuilder result, IEnumerable<Type> argsOrParams) { if (!argsOrParams.Any()) { return; } const String Delimiter = ", "; result.Append('<'); foreach (var item in argsOrParams) { result.Append(GetCSharpSimpleName(item.GetTypeInfo())); result.Append(Delimiter); } result.Length -= Delimiter.Length; result.Append('>'); } } }
bsd-2-clause
C#
57c46b18215c81594b1792aaa29fa40c28d38d57
Fix output for overloaded operators
JakeGinnivan/ApiApprover
src/PublicApiGenerator/CSharpOperatorKeyword.cs
src/PublicApiGenerator/CSharpOperatorKeyword.cs
using System.Collections.Generic; namespace PublicApiGenerator { internal static class CSharpOperatorKeyword { static readonly IDictionary<string, string> OperatorNameMap = new Dictionary<string, string> { { "op_False", "false" }, { "op_True", "true" }, { "op_Addition", "+" }, { "op_UnaryPlus", "+" }, { "op_Subtraction", "-" }, { "op_UnaryNegation", "-" }, { "op_Multiply", "*" }, { "op_Division", "/" }, { "op_Modulus", "%" }, { "op_Increment", "++" }, { "op_Decrement", "--" }, { "op_OnesComplement", "~" }, { "op_LogicalNot", "!" }, { "op_BitwiseAnd", "&" }, { "op_BitwiseOr", "|" }, { "op_ExclusiveOr", "^" }, { "op_LeftShift", "<<" }, { "op_RightShift", ">>" }, { "op_Equality", "==" }, { "op_Inequality", "!=" }, { "op_GreaterThan", ">" }, { "op_GreaterThanOrEqual", ">=" }, { "op_LessThan", "<" }, { "op_LessThanOrEqual", "<=" } }; public static string Get(string memberName) { return OperatorNameMap.TryGetValue(memberName, out string mappedMemberName) ? "operator " + mappedMemberName : memberName; } } }
using System.Collections.Generic; namespace PublicApiGenerator { internal static class CSharpOperatorKeyword { static readonly IDictionary<string, string> OperatorNameMap = new Dictionary<string, string> { { "op_Addition", "+" }, { "op_UnaryPlus", "+" }, { "op_Subtraction", "-" }, { "op_UnaryNegation", "-" }, { "op_Multiply", "*" }, { "op_Division", "/" }, { "op_Modulus", "%" }, { "op_Increment", "++" }, { "op_Decrement", "--" }, { "op_OnesComplement", "~" }, { "op_LogicalNot", "!" }, { "op_BitwiseAnd", "&" }, { "op_BitwiseOr", "|" }, { "op_ExclusiveOr", "^" }, { "op_LeftShift", "<<" }, { "op_RightShift", ">>" }, { "op_Equality", "==" }, { "op_Inequality", "!=" }, { "op_GreaterThan", ">" }, { "op_GreaterThanOrEqual", ">=" }, { "op_LessThan", "<" }, { "op_LessThanOrEqual", "<=" } }; public static string Get(string memberName) { return OperatorNameMap.TryGetValue(memberName, out string mappedMemberName) ? mappedMemberName : memberName; } } }
mit
C#
f41076681028dd7d90f4240cca533ab539b22a0c
Make it possible to configure time to pulse
GMJS/gmjs_ocs_dpt
IPOCS_Programmer/ObjectTypes/PointsMotor_Pulse.cs
IPOCS_Programmer/ObjectTypes/PointsMotor_Pulse.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IPOCS_Programmer.ObjectTypes { public class PointsMotor_Pulse : PointsMotor { public override byte motorTypeId { get { return 1; } } public byte ThrowLeftOutput { get; set; } public byte ThrowRightOutput { get; set; } public byte positionPin { get; set; } public bool reverseStatus { get; set; } public bool lowToThrow { get; set; } public byte timeToPulse { get; set; } public override List<byte> Serialize() { var vector = new List<byte>(); vector.Add(motorTypeId); vector.Add(this.ThrowLeftOutput); vector.Add(this.ThrowRightOutput); vector.Add(positionPin); vector.Add((byte)(reverseStatus ? 1 : 0)); vector.Add((byte)(lowToThrow ? 1 : 0)); vector.Add(this.timeToPulse); return vector; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IPOCS_Programmer.ObjectTypes { public class PointsMotor_Pulse : PointsMotor { public override byte motorTypeId { get { return 1; } } public byte ThrowLeftOutput { get; set; } public byte ThrowRightOutput { get; set; } public byte positionPin { get; set; } public bool reverseStatus { get; set; } public bool lowToThrow { get; set; } public override List<byte> Serialize() { var vector = new List<byte>(); vector.Add(motorTypeId); vector.Add(this.ThrowLeftOutput); vector.Add(this.ThrowRightOutput); vector.Add(positionPin); vector.Add((byte)(reverseStatus ? 1 : 0)); vector.Add((byte)(lowToThrow ? 1 : 0)); return vector; } } }
mit
C#
bbcf485005a0e070ecef82209649c49e8a5ac319
Fix comment
bartdesmet/roslyn,weltkante/roslyn,mavasani/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,dotnet/roslyn,bartdesmet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.IndentStyle.cs
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.IndentStyle.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.Formatting { internal partial class FormattingOptions2 { /// <summary> /// For use in the shared CodeStyle layer. Keep in syntax with FormattingOptions.IndentStyle. /// </summary> internal enum IndentStyle { None = 0, Block = 1, Smart = 2 } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace Microsoft.CodeAnalysis.Formatting { internal partial class FormattingOptions2 { /// <summary> /// For use in the shared CodeStyle layer. Keep in syntax with IndentStyle. /// </summary> internal enum IndentStyle { None = 0, Block = 1, Smart = 2 } } }
mit
C#
90d93adf2c088794123dd158a7f98525b662788f
Tweak the Monokai color theme
jamesqo/Repository,jamesqo/Repository,jamesqo/Repository
Repository/Internal/EditorServices/SyntaxHighlighting/MonokaiColorTheme.cs
Repository/Internal/EditorServices/SyntaxHighlighting/MonokaiColorTheme.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.Graphics; using Repository.EditorServices.SyntaxHighlighting; namespace Repository.Internal.EditorServices.SyntaxHighlighting { internal class MonokaiColorTheme : IColorTheme { public Color BackgroundColor => Color.Black; public Color GetForegroundColor(SyntaxKind kind) { // TODO: Based off VSCode's Monokai theme switch (kind) { case SyntaxKind.Annotation: return Color.SkyBlue; case SyntaxKind.BooleanLiteral: return Color.MediumPurple; case SyntaxKind.Comment: return Color.Gray; case SyntaxKind.ConstructorDeclaration: return Color.LightGreen; case SyntaxKind.Eof: return default(Color); case SyntaxKind.Identifier: return Color.White; case SyntaxKind.Keyword: return Color.HotPink; case SyntaxKind.MethodDeclaration: return Color.LightGreen; case SyntaxKind.MethodIdentifier: return Color.LightGreen; case SyntaxKind.NullLiteral: return Color.MediumPurple; case SyntaxKind.NumericLiteral: return Color.MediumPurple; case SyntaxKind.ParameterDeclaration: return Color.Orange; case SyntaxKind.Parenthesis: return Color.White; case SyntaxKind.StringLiteral: return Color.SandyBrown; case SyntaxKind.TypeDeclaration: return Color.LightGreen; case SyntaxKind.TypeIdentifier: return Color.SkyBlue; default: throw new NotSupportedException(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.Graphics; using Repository.EditorServices.SyntaxHighlighting; namespace Repository.Internal.EditorServices.SyntaxHighlighting { internal class MonokaiColorTheme : IColorTheme { public Color BackgroundColor => Color.Black; public Color GetForegroundColor(SyntaxKind kind) { // TODO: Based off VSCode's Monokai theme switch (kind) { case SyntaxKind.Annotation: return Color.SkyBlue; case SyntaxKind.BooleanLiteral: return Color.Purple; case SyntaxKind.Comment: return Color.Gray; case SyntaxKind.ConstructorDeclaration: return Color.LightGreen; case SyntaxKind.Eof: return default(Color); case SyntaxKind.Identifier: return Color.White; case SyntaxKind.Keyword: return Color.HotPink; case SyntaxKind.MethodDeclaration: return Color.LightGreen; case SyntaxKind.MethodIdentifier: return Color.LightGreen; case SyntaxKind.NullLiteral: return Color.Purple; case SyntaxKind.NumericLiteral: return Color.Purple; case SyntaxKind.ParameterDeclaration: return Color.Orange; case SyntaxKind.Parenthesis: return Color.White; case SyntaxKind.StringLiteral: return Color.Beige; case SyntaxKind.TypeDeclaration: return Color.LightGreen; case SyntaxKind.TypeIdentifier: return Color.LightGreen; default: throw new NotSupportedException(); } } } }
mit
C#
ab09e6f2fde0e7284d637cc84751e295659885f1
Bump for next version
adamcaudill/libsodium-net,fraga/libsodium-net,BurningEnlightenment/libsodium-net,adamcaudill/libsodium-net,tabrath/libsodium-core,deckar01/libsodium-net,deckar01/libsodium-net,bitbeans/libsodium-net,bitbeans/libsodium-net,BurningEnlightenment/libsodium-net,fraga/libsodium-net
libsodium-net/Properties/AssemblyInfo.cs
libsodium-net/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("libsodium-net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Adam Caudill")] [assembly: AssemblyProduct("libsodium-net")] [assembly: AssemblyCopyright("Copyright © Adam Caudill 2013 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bac54bf6-5a39-4ab5-90f1-746a9d6b06f4")] // 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("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("libsodium-net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Adam Caudill")] [assembly: AssemblyProduct("libsodium-net")] [assembly: AssemblyCopyright("Copyright © Adam Caudill 2013 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bac54bf6-5a39-4ab5-90f1-746a9d6b06f4")] // 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("0.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")]
mit
C#
f8166e54c07804ab7e143b0a425384ea2c436499
Use Interlocked
arfbtwn/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp,arfbtwn/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp
src/PendingCall.cs
src/PendingCall.cs
// Copyright 2007 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Threading; namespace NDesk.DBus { class PendingCall { Connection conn; Message reply = null; object lockObj = new object (); public PendingCall (Connection conn) { this.conn = conn; } int waiters = 0; public Message Reply { get { if (Thread.CurrentThread == conn.mainThread) { /* while (reply == null) conn.Iterate (); */ while (reply == null) conn.HandleMessage (conn.ReadMessage ()); conn.DispatchSignals (); } else { lock (lockObj) { Interlocked.Increment (ref waiters); while (reply == null) Monitor.Wait (lockObj); Interlocked.Decrement (ref waiters); } } return reply; } set { lock (lockObj) { reply = value; if (waiters > 0) Monitor.PulseAll (lockObj); if (Completed != null) Completed (reply); } } } public event Action<Message> Completed; } }
// Copyright 2007 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Threading; namespace NDesk.DBus { class PendingCall { Connection conn; Message reply = null; object lockObj = new object (); public PendingCall (Connection conn) { this.conn = conn; } int waiters = 0; public Message Reply { get { if (Thread.CurrentThread == conn.mainThread) { /* while (reply == null) conn.Iterate (); */ while (reply == null) conn.HandleMessage (conn.ReadMessage ()); conn.DispatchSignals (); } else { lock (lockObj) { waiters++; while (reply == null) Monitor.Wait (lockObj); waiters--; } } return reply; } set { lock (lockObj) { reply = value; if (waiters > 0) Monitor.PulseAll (lockObj); if (Completed != null) Completed (reply); } } } public event Action<Message> Completed; } }
mit
C#
8ed7510c1f513eec3bc081921a438c640bc0be2f
return null on Zero for reference types
signumsoftware/framework,signumsoftware/extensions,AlejandroCano/extensions,signumsoftware/extensions,signumsoftware/framework,MehdyKarimpour/extensions,MehdyKarimpour/extensions,AlejandroCano/extensions
Signum.Engine.MachineLearning.CNTK/CNTKDefault.cs
Signum.Engine.MachineLearning.CNTK/CNTKDefault.cs
using System; using Signum.Entities.MachineLearning; using Signum.Utilities; namespace Signum.Engine.MachineLearning.CNTK { public static class CNTKDefault { static readonly object Zero = 0; public static object GetDefaultValue(PredictorCodification c) { switch (c.Column.NullHandling) { case PredictorColumnNullHandling.Zero: return c.Column.Token.Type.IsClass || c.Column.Token.Type.IsInterface ? null : Zero; case PredictorColumnNullHandling.Error: throw new Exception($"Null found on {c.Column.Token} of {(c.Column is PredictorColumnSubQuery pcsq ? pcsq.SubQuery.ToString() : "MainQuery")}"); case PredictorColumnNullHandling.Average: return c.Average; case PredictorColumnNullHandling.Min: return c.Min; case PredictorColumnNullHandling.Max: return c.Max; default: throw new UnexpectedValueException(c.Column.NullHandling); } } } }
using System; using Signum.Entities.MachineLearning; using Signum.Utilities; namespace Signum.Engine.MachineLearning.CNTK { public static class CNTKDefault { public static object GetDefaultValue(PredictorCodification c) { switch (c.Column.NullHandling) { case PredictorColumnNullHandling.Zero: return 0; case PredictorColumnNullHandling.Error: throw new Exception($"Null found on {c.Column.Token} of {(c.Column is PredictorColumnSubQuery pcsq ? pcsq.SubQuery.ToString() : "MainQuery")}"); case PredictorColumnNullHandling.Average: return c.Average; case PredictorColumnNullHandling.Min: return c.Min; case PredictorColumnNullHandling.Max: return c.Max; default: throw new UnexpectedValueException(c.Column.NullHandling); } } } }
mit
C#
d15cc9a192a492f96aa91f479aec730f571f79d3
Delete usings
smoogipooo/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,default0/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,default0/osu-framework,DrabWeb/osu-framework
osu.Framework/Platform/Windows/WindowsGameWindow.cs
osu.Framework/Platform/Windows/WindowsGameWindow.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using OpenTK.Input; namespace osu.Framework.Platform.Windows { internal class WindowsGameWindow : DesktopGameWindow { protected override void OnKeyDown(KeyboardKeyEventArgs e) { if (e.Key == Key.F4 && e.Alt) { Exit(); return; } base.OnKeyDown(e); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Windows.Forms; using OpenTK.Input; namespace osu.Framework.Platform.Windows { internal class WindowsGameWindow : DesktopGameWindow { protected override void OnKeyDown(KeyboardKeyEventArgs e) { if (e.Key == Key.F4 && e.Alt) { Exit(); return; } base.OnKeyDown(e); } } }
mit
C#
a934c6a940c9bd4fde697e20534e17701792bf7d
Fix a unit test for new Delayer logic (immediate if possible)
charlenni/Mapsui,pauldendulk/Mapsui,charlenni/Mapsui
Tests/Mapsui.Tests/Fetcher/FeatureFetcherTests.cs
Tests/Mapsui.Tests/Fetcher/FeatureFetcherTests.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using Mapsui.Geometries; using Mapsui.Layers; using Mapsui.Providers; using NUnit.Framework; namespace Mapsui.Tests.Fetcher { [TestFixture] public class FeatureFetcherTests { [Test] public void TestFeatureFetcherDelay() { // arrange var extent = new BoundingBox(0, 0, 10, 10); var layer = new Layer { DataSource = new MemoryProvider(GenerateRandomPoints(extent, 25)), FetchingPostponedInMilliseconds = 0 }; var notifications = new List<bool>(); layer.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(Layer.Busy)) { notifications.Add(layer.Busy); } }; // act layer.RefreshData(extent, 1, true); // assert Task.Run(() => { while (notifications.Count < 2) { // just wait until we have two } }).GetAwaiter().GetResult(); Assert.IsTrue(notifications[0]); Assert.IsFalse(notifications[1]); } private static IEnumerable<IGeometry> GenerateRandomPoints(BoundingBox envelope, int count) { var random = new Random(); var result = new List<IGeometry>(); for (var i = 0; i < count; i++) { result.Add(new Point( random.NextDouble() * envelope.Width + envelope.Left, random.NextDouble() * envelope.Height + envelope.Bottom)); } return result; } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using Mapsui.Geometries; using Mapsui.Layers; using Mapsui.Providers; using NUnit.Framework; namespace Mapsui.Tests.Fetcher { [TestFixture] public class FeatureFetcherTests { [Test] public void TestFeatureFetcherDelay() { // arrange var extent = new BoundingBox(0, 0, 10, 10); var layer = new Layer { DataSource = new MemoryProvider(GenerateRandomPoints(extent, 25)), FetchingPostponedInMilliseconds = 0 }; // act layer.RefreshData(extent, 1, true); var notifications = new List<bool>(); layer.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(Layer.Busy)) { notifications.Add(layer.Busy); } }; // assert Task.Run(() => { while (notifications.Count < 2) { // just wait until we have two } }).GetAwaiter().GetResult(); Assert.IsTrue(notifications[0]); Assert.IsFalse(notifications[1]); } private static IEnumerable<IGeometry> GenerateRandomPoints(BoundingBox envelope, int count) { var random = new Random(); var result = new List<IGeometry>(); for (var i = 0; i < count; i++) { result.Add(new Point( random.NextDouble() * envelope.Width + envelope.Left, random.NextDouble() * envelope.Height + envelope.Bottom)); } return result; } } }
mit
C#
b00489faac8dec95784a1ef1217782616e516008
Bump to v2.3.0.0
bobus15/proshine,MeltWS/proshine,Silv3rPRO/proshine
PROShine/Properties/AssemblyInfo.cs
PROShine/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PROShine")] [assembly: AssemblyDescription("A free, open-source and advanced bot for Pokemon Revolution Online.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Silv3r")] [assembly: AssemblyProduct("PROShine")] [assembly: AssemblyCopyright("Copyright © Silv3r, 2016-2032")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // 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("2.3.0.0")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: NeutralResourcesLanguage("en")]
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PROShine")] [assembly: AssemblyDescription("A free, open-source and advanced bot for Pokemon Revolution Online.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Silv3r")] [assembly: AssemblyProduct("PROShine")] [assembly: AssemblyCopyright("Copyright © Silv3r, 2016-2032")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // 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("2.2.0.0")] [assembly: AssemblyFileVersion("2.2.0.0")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
21a26b9826158614f7ddc87f736ce207168804c3
Expand /Puzzle
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/ChessVariantsTraining/Views/Puzzle/Index.cshtml
src/ChessVariantsTraining/Views/Puzzle/Index.cshtml
@section Title {Puzzles start page} Choose one of the variants! <ul> <li>@Html.ActionLink("Antichess", "Train", "Puzzle", new { variant = "Antichess" }, null)</li> <li>@Html.ActionLink("Atomic", "Train", "Puzzle", new { variant = "Atomic" }, null)</li> <li>@Html.ActionLink("Horde", "Train", "Puzzle", new { variant = "Horde" })</li> <li>@Html.ActionLink("King of the Hill", "Train", "Puzzle", new { variant = "KingOfTheHill" }, null)</li> <li>@Html.ActionLink("Three-check", "Train", "Puzzle", new { variant = "ThreeCheck" }, null)</li> <li>@Html.ActionLink("Racing Kings", "Train", "Puzzle", new { variant = "RacingKings" }, null)</li> <li>@Html.ActionLink("Mixed (puzzles of all variants)", "Train", "Puzzle", new { variant = "Mixed" }, null)</li> </ul> ... or go to: <ul> <li>@Html.ActionLink("Timed training", "Index", "TimedTraining")</li> <li>@Html.ActionLink("Endgame training", "Index", "Endgames")</li> </ul>
@section Title {Puzzles start page} Choose one of the variants! <ul> <li>@Html.ActionLink("Antichess", "Train", "Puzzle", new { variant = "Antichess" }, null)</li> <li>@Html.ActionLink("Atomic", "Train", "Puzzle", new { variant = "Atomic" }, null)</li> <li>@Html.ActionLink("Horde", "Train", "Puzzle", new { variant = "Horde" })</li> <li>@Html.ActionLink("King of the Hill", "Train", "Puzzle", new { variant = "KingOfTheHill" }, null)</li> <li>@Html.ActionLink("Three-check", "Train", "Puzzle", new { variant = "ThreeCheck" }, null)</li> <li>@Html.ActionLink("Racing Kings", "Train", "Puzzle", new { variant = "RacingKings" }, null)</li> <li>@Html.ActionLink("Mixed (puzzles of all variants)", "Train", "Puzzle", new { variant = "Mixed" }, null)</li> </ul>
agpl-3.0
C#
14a21f1156ac4df4fa5521d248ddef0d7c3545e6
Remove unused method.
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Base/PropertyStore/ValueFrame.cs
src/Avalonia.Base/PropertyStore/ValueFrame.cs
using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Avalonia.Data; using Avalonia.Utilities; namespace Avalonia.PropertyStore { internal abstract class ValueFrame { private readonly AvaloniaPropertyValueStore<IValueEntry> _entries = new(); public int EntryCount => _entries.Count; public abstract bool IsActive { get; } public ValueStore? Owner { get; private set; } public BindingPriority Priority { get; protected set; } public bool Contains(AvaloniaProperty property) => _entries.Contains(property); public IValueEntry GetEntry(int index) => _entries[index]; public void SetOwner(ValueStore? owner) => Owner = owner; public bool TryGetEntry(AvaloniaProperty property, [NotNullWhen(true)] out IValueEntry? entry) { return _entries.TryGetValue(property, out entry); } public void OnBindingCompleted(IValueEntry binding) { Remove(binding.Property); Owner?.OnBindingCompleted(binding.Property, this); } public virtual void Dispose() { for (var i = 0; i < _entries.Count; ++i) _entries[i].Unsubscribe(); } protected void Add(IValueEntry value) { Debug.Assert(!value.Property.IsDirect); _entries.AddValue(value.Property, value); } protected void Remove(AvaloniaProperty property) => _entries.Remove(property); protected void Set(IValueEntry value) => _entries.SetValue(value.Property, value); } }
using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Avalonia.Data; using Avalonia.Utilities; namespace Avalonia.PropertyStore { internal abstract class ValueFrame { private readonly AvaloniaPropertyValueStore<IValueEntry> _entries = new(); public int EntryCount => _entries.Count; public abstract bool IsActive { get; } public ValueStore? Owner { get; private set; } public BindingPriority Priority { get; protected set; } public bool Contains(AvaloniaProperty property) => _entries.Contains(property); public IValueEntry GetEntry(int index) => _entries[index]; public void SetOwner(ValueStore? owner) => Owner = owner; public bool TryGet(AvaloniaProperty property, [NotNullWhen(true)] out IValueEntry? value) { return _entries.TryGetValue(property, out value); } public bool TryGetEntry(AvaloniaProperty property, [NotNullWhen(true)] out IValueEntry? entry) { return _entries.TryGetValue(property, out entry); } public void OnBindingCompleted(IValueEntry binding) { Remove(binding.Property); Owner?.OnBindingCompleted(binding.Property, this); } public virtual void Dispose() { for (var i = 0; i < _entries.Count; ++i) _entries[i].Unsubscribe(); } protected void Add(IValueEntry value) { Debug.Assert(!value.Property.IsDirect); _entries.AddValue(value.Property, value); } protected void Remove(AvaloniaProperty property) => _entries.Remove(property); protected void Set(IValueEntry value) => _entries.SetValue(value.Property, value); } }
mit
C#
ecceae45212326f756255de8a9a4062a287230f7
modify CatThreadLocal
chinaboard/PureCat
PureCat/Util/CatThreadLocal.cs
PureCat/Util/CatThreadLocal.cs
using System.Threading; using System.Collections.Concurrent; namespace PureCat.Util { public class CatThreadLocal<T> where T : class { private readonly ConcurrentDictionary<int, T> _mValues = new ConcurrentDictionary<int, T>(); public T Value { get { _mValues.TryGetValue(Thread.CurrentThread.ManagedThreadId, out T val); return val; } set { _mValues[Thread.CurrentThread.ManagedThreadId] = value; } } public void Dispose() { _mValues.TryRemove(Thread.CurrentThread.ManagedThreadId, out T obj); } } }
using System.Collections; using System.Threading; using System.Collections.Concurrent; namespace PureCat.Util { public class CatThreadLocal<T> where T : class { private readonly ConcurrentDictionary<int, T> _mValues = new ConcurrentDictionary<int, T>(); public T Value { get { T val = null; _mValues.TryGetValue(Thread.CurrentThread.ManagedThreadId, out val); return val; } set { _mValues[Thread.CurrentThread.ManagedThreadId] = value; } } public void Dispose() { T obj; _mValues.TryRemove(Thread.CurrentThread.ManagedThreadId, out obj); } } }
mit
C#
9563e329ea67bb7e1f58797f59a169af5e02a0b3
Fix binary GUIDs showing up in Mongo optionlists
sillsdev/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge
src/LfMerge/LanguageForge/Model/LfOptionListItem.cs
src/LfMerge/LanguageForge/Model/LfOptionListItem.cs
// Copyright (c) 2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson; using System; namespace LfMerge.LanguageForge.Model { public class LfOptionListItem { [BsonRepresentation(BsonType.String)] public Guid? Guid { get; set; } public string Key { get; set; } public string Value { get; set; } public string Abbreviation { get; set; } } }
// Copyright (c) 2016 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; namespace LfMerge.LanguageForge.Model { public class LfOptionListItem { public Guid? Guid { get; set; } public string Key { get; set; } public string Value { get; set; } public string Abbreviation { get; set; } } }
mit
C#
31ebb29d5f63ddd96d40c539ecf29b670bf181c0
Fix the spaces!
MiniProfiler/dotnet,MiniProfiler/dotnet
src/MiniProfiler.AspNetCore.Mvc/ProfileTagHelper.cs
src/MiniProfiler.AspNetCore.Mvc/ProfileTagHelper.cs
using Microsoft.AspNetCore.Razor.TagHelpers; using System.Threading.Tasks; namespace StackExchange.Profiling { /// <summary> /// Tag helper to profile child contents in ASP.NET Core views, e.g. /// &lt;profile name="My Step" /&gt; /// ...child content... /// &lt;/profile&gt; /// </summary> [HtmlTargetElement("profile", TagStructure = TagStructure.NormalOrSelfClosing)] public class ProfileTagHelper : TagHelper { /// <summary> /// The name of this <see cref="MiniProfiler"/> step. /// </summary> [HtmlAttributeName("name")] public string Name { get; set; } /// <summary> /// Processes this section, profiling the contents within. /// </summary> /// <param name="context">The context to render in.</param> /// <param name="output">The output to render to.</param> public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { using (MiniProfiler.Current.Step(Name)) { output.Content = await output.GetChildContentAsync(); } } } }
using Microsoft.AspNetCore.Razor.TagHelpers; using System.Threading.Tasks; namespace StackExchange.Profiling { /// <summary> /// Tag helper to profile child contents in ASP.NET Core views, e.g. /// &lt;profile name="My Step" /&gt; /// ...child content... /// &lt;/profile&gt; /// </summary> [HtmlTargetElement("profile", TagStructure = TagStructure.NormalOrSelfClosing)] public class ProfileTagHelper : TagHelper { /// <summary> /// The name of this <see cref="MiniProfiler"/> step. /// </summary> [HtmlAttributeName("name")] public string Name { get; set; } /// <summary> /// Processes this section, profiling the contents within. /// </summary> /// <param name="context">The context to render in.</param> /// <param name="output">The output to render to.</param> public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { using(MiniProfiler.Current.Step(Name)) { output.Content = await output.GetChildContentAsync(); } } } }
mit
C#
70dfe1b5626cc47238637e77e3b7463e18ab15e9
Improve voicestats command output.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/NadekoBot/Modules/Utility/VoiceStatsCommands.cs
src/NadekoBot/Modules/Utility/VoiceStatsCommands.cs
using Discord; using Discord.Commands; using Mitternacht.Common.Attributes; using Mitternacht.Modules.Utility.Services; using Mitternacht.Services; using System; using System.Threading.Tasks; namespace Mitternacht.Modules.Utility { public partial class Utility { public class VoiceStatsCommands : MitternachtSubmodule<VoiceStatsService> { private readonly DbService _db; public VoiceStatsCommands(DbService db) { _db = db; } [MitternachtCommand, Description, Usage, Aliases] [RequireContext(ContextType.Guild)] public async Task VoiceStats(IGuildUser user = null) { user = user ?? Context.User as IGuildUser; using(var uow = _db.UnitOfWork) { if (uow.VoiceChannelStats.TryGetTime(user.Id, user.GuildId, out var time)) { var timespan = TimeSpan.FromSeconds(time); await ConfirmLocalized("voicestats_time", user.ToString(), $"{(timespan.Days > 0 ? $"{timespan:dd}d" : "")}{(timespan.Hours > 0 ? $"{timespan:hh}h" : "")}{(timespan.Minutes > 0 ? $"{timespan:mm}min" : "")}{timespan:ss}s").ConfigureAwait(false); } else await ConfirmLocalized("voicestats_untracked", user.ToString()).ConfigureAwait(false); } } [MitternachtCommand, Description, Usage, Aliases] [RequireContext(ContextType.Guild)] [OwnerOrGuildPermission(GuildPermission.Administrator)] public async Task VoiceStatsReset(IGuildUser user) { if (user == null) return; using(var uow = _db.UnitOfWork) { uow.VoiceChannelStats.Reset(user.Id, user.GuildId); await ConfirmLocalized("voicestats_reset", user.ToString()).ConfigureAwait(false); await uow.CompleteAsync().ConfigureAwait(false); } } } } }
using Discord; using Discord.Commands; using Mitternacht.Common.Attributes; using Mitternacht.Modules.Utility.Services; using Mitternacht.Services; using System; using System.Threading.Tasks; namespace Mitternacht.Modules.Utility { public partial class Utility { public class VoiceStatsCommands : MitternachtSubmodule<VoiceStatsService> { private readonly DbService _db; public VoiceStatsCommands(DbService db) { _db = db; } [MitternachtCommand, Description, Usage, Aliases] [RequireContext(ContextType.Guild)] public async Task VoiceStats(IGuildUser user = null) { user = user ?? Context.User as IGuildUser; using(var uow = _db.UnitOfWork) { if (uow.VoiceChannelStats.TryGetTime(user.Id, user.GuildId, out var time)) { var timespan = TimeSpan.FromSeconds(time); await ConfirmLocalized("voicestats_time", user.ToString(), $"{(timespan.Days > 0 ? $"{timespan:dd}d" : "")}{timespan:hh}h{timespan:mm}min{timespan:ss}s").ConfigureAwait(false); } else await ConfirmLocalized("voicestats_untracked", user.ToString()).ConfigureAwait(false); } } [MitternachtCommand, Description, Usage, Aliases] [RequireContext(ContextType.Guild)] [OwnerOrGuildPermission(GuildPermission.Administrator)] public async Task VoiceStatsReset(IGuildUser user) { if (user == null) return; using(var uow = _db.UnitOfWork) { uow.VoiceChannelStats.Reset(user.Id, user.GuildId); await ConfirmLocalized("voicestats_reset", user.ToString()).ConfigureAwait(false); await uow.CompleteAsync().ConfigureAwait(false); } } } } }
mit
C#
db4b574689b6f4c0a6cd63e35c704d13bae705ee
fix indentation
vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,vladkol/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MixedRealityToolkit/_Core/Utilities/Editor/EditorProjectUtilities.cs
Assets/MixedRealityToolkit/_Core/Utilities/Editor/EditorProjectUtilities.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEditor; #if UNITY_EDITOR namespace Microsoft.MixedReality.Toolkit.Core.Utilities.Editor { [InitializeOnLoad] internal class EditorProjectUtilities { /// <summary> /// Static constructor that allows for executing code on project load. /// </summary> static EditorProjectUtilities() { CheckMinimumEditorVersion(); } /// <summary> /// Checks that a supported version of Unity is being used with this project. /// </summary> /// <remarks> /// This method displays a message to the user allowing them to continue or to exit the editor. /// </remarks> public static void CheckMinimumEditorVersion() { #if !UNITY_2018_3_OR_NEWER DisplayIncorrectEditorVersionDialog(); #endif } /// <summary> /// Displays a message indicating that a project was loaded in an unsupported version of Unity and allows the user /// to continu or exit. /// </summary> private static void DisplayIncorrectEditorVersionDialog() { if (!EditorUtility.DisplayDialog( "Mixed Reality Toolkit", "The Mixed Reality Toolkit requires Unity 2018.3 or newer.\n\nUsing an older version of Unity may result in compile errors or incorrect behavior.", "Continue", "Close Editor")) { EditorApplication.Exit(0); } } } } #endif // UNITY_EDITOR
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEditor; #if UNITY_EDITOR namespace Microsoft.MixedReality.Toolkit.Core.Utilities.Editor { [InitializeOnLoad] internal class EditorProjectUtilities { /// <summary> /// Static constructor that allows for executing code on project load. /// </summary> static EditorProjectUtilities() { CheckMinimumEditorVersion(); } /// <summary> /// Checks that a supported version of Unity is being used with this project. /// </summary> /// <remarks> /// This method displays a message to the user allowing them to continue or to exit the editor. /// </remarks> public static void CheckMinimumEditorVersion() { #if !UNITY_2018_3_OR_NEWER DisplayIncorrectEditorVersionDialog(); #endif } /// <summary> /// Displays a message indicating that a project was loaded in an unsupported version of Unity and allows the user /// to continu or exit. /// </summary> private static void DisplayIncorrectEditorVersionDialog() { if (!EditorUtility.DisplayDialog( "Mixed Reality Toolkit", "The Mixed Reality Toolkit requires Unity 2018.3 or newer.\n\nUsing an older version of Unity may result in compile errors or incorrect behavior.", "Continue", "Close Editor")) { EditorApplication.Exit(0); } } } } #endif // UNITY_EDITOR
mit
C#
29df5476d7c56c2858c1c8426e1b54ae97f464a9
修复MessageController控制器的方法映射错误。 :taco:
Zongsoft/Zongsoft.Community
src/api/Http/Controllers/MessageController.cs
src/api/Http/Controllers/MessageController.cs
/* * _____ ______ * /_ / ____ ____ ____ _________ / __/ /_ * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ * /____/\____/_/ /_/\__ /____/\____/_/ \__/ * /____/ * * Authors: * 钟峰(Popeye Zhong) <9555843@qq.com> * * Copyright (C) 2015-2017 Zongsoft Corporation. All rights reserved. * * 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; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Authorization; using Zongsoft.Web; using Zongsoft.Data; using Zongsoft.Security.Membership; using Zongsoft.Community.Models; using Zongsoft.Community.Services; namespace Zongsoft.Community.Web.Http.Controllers { [Authorization] [Area("Community")] [Route("[area]/Messages")] public class MessageController : ApiControllerBase<Message, MessageService> { #region 构造函数 public MessageController(IServiceProvider serviceProvider) : base(serviceProvider) { } #endregion #region 公共方法 [HttpGet("{id}/Users")] public object GetUsers(ulong id, [FromQuery]bool? isRead = null, [FromQuery]Paging page = null) { return this.Paginate(this.DataService.GetUsers(id, isRead, page)); } #endregion } }
/* * _____ ______ * /_ / ____ ____ ____ _________ / __/ /_ * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ * /____/\____/_/ /_/\__ /____/\____/_/ \__/ * /____/ * * Authors: * 钟峰(Popeye Zhong) <9555843@qq.com> * * Copyright (C) 2015-2017 Zongsoft Corporation. All rights reserved. * * 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; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Authorization; using Zongsoft.Web; using Zongsoft.Data; using Zongsoft.Security.Membership; using Zongsoft.Community.Models; using Zongsoft.Community.Services; namespace Zongsoft.Community.Web.Http.Controllers { [Authorization] [Area("Community")] [Route("[area]/Messages")] public class MessageController : ApiControllerBase<Message, MessageService> { #region 构造函数 public MessageController(IServiceProvider serviceProvider) : base(serviceProvider) { } #endregion #region 公共方法 [ActionName("{id}/Users")] public object GetUsers(ulong id, [FromQuery]bool? isRead = null, [FromQuery]Paging page = null) { return this.Paginate(this.DataService.GetUsers(id, isRead, page)); } #endregion } }
apache-2.0
C#
24ed75009ff5c544961b8a829fa747c76e90ac04
add helper method InitializeDictionary
ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,verdentk/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate
src/Abp/Localization/Dictionaries/LocalizationDictionaryProviderBase.cs
src/Abp/Localization/Dictionaries/LocalizationDictionaryProviderBase.cs
using System.Collections.Generic; namespace Abp.Localization.Dictionaries { public abstract class LocalizationDictionaryProviderBase : ILocalizationDictionaryProvider { public string SourceName { get; private set; } public ILocalizationDictionary DefaultDictionary { get; protected set; } public IDictionary<string, ILocalizationDictionary> Dictionaries { get; private set; } protected LocalizationDictionaryProviderBase() { Dictionaries = new Dictionary<string, ILocalizationDictionary>(); } public void Initialize(string sourceName) { SourceName = sourceName; InitializeDictionaries(); } public void Extend(ILocalizationDictionary dictionary) { //Add ILocalizationDictionary existingDictionary; if (!Dictionaries.TryGetValue(dictionary.CultureInfo.Name, out existingDictionary)) { Dictionaries[dictionary.CultureInfo.Name] = dictionary; return; } //Override var localizedStrings = dictionary.GetAllStrings(); foreach (var localizedString in localizedStrings) { existingDictionary[localizedString.Name] = localizedString.Value; } } protected virtual void InitializeDictionaries() { } protected virtual void InitializeDictionary<TDictionary>(TDictionary dictionary, bool isDefault = false) where TDictionary : ILocalizationDictionary { if (Dictionaries.ContainsKey(dictionary.CultureInfo.Name)) { throw new AbpInitializationException(SourceName + " source contains more than one dictionary for the culture: " + dictionary.CultureInfo.Name); } Dictionaries[dictionary.CultureInfo.Name] = dictionary; if (isDefault) { if (DefaultDictionary != null) { throw new AbpInitializationException("Only one default localization dictionary can be for source: " + SourceName); } DefaultDictionary = dictionary; } } } }
using System.Collections.Generic; namespace Abp.Localization.Dictionaries { public abstract class LocalizationDictionaryProviderBase : ILocalizationDictionaryProvider { public string SourceName { get; private set; } public ILocalizationDictionary DefaultDictionary { get; protected set; } public IDictionary<string, ILocalizationDictionary> Dictionaries { get; private set; } protected LocalizationDictionaryProviderBase() { Dictionaries = new Dictionary<string, ILocalizationDictionary>(); } public void Initialize(string sourceName) { SourceName = sourceName; InitializeDictionaries(); } public void Extend(ILocalizationDictionary dictionary) { //Add ILocalizationDictionary existingDictionary; if (!Dictionaries.TryGetValue(dictionary.CultureInfo.Name, out existingDictionary)) { Dictionaries[dictionary.CultureInfo.Name] = dictionary; return; } //Override var localizedStrings = dictionary.GetAllStrings(); foreach (var localizedString in localizedStrings) { existingDictionary[localizedString.Name] = localizedString.Value; } } protected virtual void InitializeDictionaries() { } } }
mit
C#
c9466426b743471e36e4126f3637d44c00fc819c
Change field to local variable
smoogipooo/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new
osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs
osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs
using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.IO; namespace osu.Game.Tournament.Screens.Setup { internal class TournamentSwitcher : ActionableInfo { private OsuDropdown<string> dropdown; [Resolved] private TournamentGameBase game { get; set; } [BackgroundDependencyLoader] private void load(TournamentStorage storage) { string startupTournament = storage.CurrentTournament.Value; dropdown.Current = storage.CurrentTournament; dropdown.Items = storage.ListTournaments(); dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true); Action = () => game.GracefullyExit(); ButtonText = "Close osu!"; } protected override Drawable CreateComponent() { var drawable = base.CreateComponent(); FlowContainer.Insert(-1, dropdown = new OsuDropdown<string> { Width = 510 }); return drawable; } } }
using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Tournament.IO; namespace osu.Game.Tournament.Screens.Setup { internal class TournamentSwitcher : ActionableInfo { private OsuDropdown<string> dropdown; private string startupTournament; [Resolved] private TournamentGameBase game { get; set; } [BackgroundDependencyLoader] private void load(TournamentStorage storage) { startupTournament = storage.CurrentTournament.Value; dropdown.Current = storage.CurrentTournament; dropdown.Items = storage.ListTournaments(); dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true); Action = () => game.GracefullyExit(); ButtonText = "Close osu!"; } protected override Drawable CreateComponent() { var drawable = base.CreateComponent(); FlowContainer.Insert(-1, dropdown = new OsuDropdown<string> { Width = 510 }); return drawable; } } }
mit
C#
951a309d0447ed06c6691a2faed003bcf6c3e291
Increase placement testcase circlesize
UselessToucan/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,ppy/osu,NeoAdonis/osu,ZLima12/osu,UselessToucan/osu,DrabWeb/osu,ppy/osu,NeoAdonis/osu,johnneijzen/osu,naoey/osu,NeoAdonis/osu,ppy/osu,DrabWeb/osu,2yangk23/osu,smoogipoo/osu,DrabWeb/osu,smoogipoo/osu,ZLima12/osu,naoey/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,smoogipoo/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,naoey/osu,peppy/osu
osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs
osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Tests.Visual { [Cached(Type = typeof(IPlacementHandler))] public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler { private readonly Container hitObjectContainer; private PlacementMask currentMask; protected HitObjectPlacementMaskTestCase() { Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2; Add(hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = new FramedClock(new StopwatchClock()) }); } [BackgroundDependencyLoader] private void load() { Add(currentMask = CreateMask()); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs<IAdjustableClock>(new StopwatchClock()); return dependencies; } public void BeginPlacement(HitObject hitObject) { } public void EndPlacement(HitObject hitObject) { hitObjectContainer.Add(CreateHitObject(hitObject)); Remove(currentMask); Add(currentMask = CreateMask()); } public void Delete(HitObject hitObject) { } protected abstract DrawableHitObject CreateHitObject(HitObject hitObject); protected abstract PlacementMask CreateMask(); } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Tests.Visual { [Cached(Type = typeof(IPlacementHandler))] public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler { private readonly Container hitObjectContainer; private PlacementMask currentMask; protected HitObjectPlacementMaskTestCase() { Add(hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = new FramedClock(new StopwatchClock()) }); } [BackgroundDependencyLoader] private void load() { Add(currentMask = CreateMask()); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs<IAdjustableClock>(new StopwatchClock()); return dependencies; } public void BeginPlacement(HitObject hitObject) { } public void EndPlacement(HitObject hitObject) { hitObjectContainer.Add(CreateHitObject(hitObject)); Remove(currentMask); Add(currentMask = CreateMask()); } public void Delete(HitObject hitObject) { } protected abstract DrawableHitObject CreateHitObject(HitObject hitObject); protected abstract PlacementMask CreateMask(); } }
mit
C#
30a2daf07816546b08fe46dab65bd4da70847911
Update AppDbContext.cs
carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate
test/Abp.Zero.SampleApp.EntityFramework/EntityFramework/AppDbContext.cs
test/Abp.Zero.SampleApp.EntityFramework/EntityFramework/AppDbContext.cs
using System.ComponentModel.DataAnnotations.Schema; using System.Data.Common; using System.Data.Entity; using Abp.Zero.EntityFramework; using Abp.Zero.SampleApp.BookStore; using Abp.Zero.SampleApp.EntityHistory; using Abp.Zero.SampleApp.MultiTenancy; using Abp.Zero.SampleApp.Roles; using Abp.Zero.SampleApp.Users; namespace Abp.Zero.SampleApp.EntityFramework { public class AppDbContext : AbpZeroDbContext<Tenant, Role, User> { public DbSet<Book> Books { get; set; } public DbSet<Comment> Comments { get; set; } public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } public DbSet<Author> Authors { get; set; } public DbSet<Store> Stores { get; set; } public DbSet<UserTestEntity> UserTestEntities { get; set; } public AppDbContext(DbConnection existingConnection) : base(existingConnection, true) { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<Comment>().HasRequired(e => e.Post).WithMany(e => e.Comments); modelBuilder.Entity<Book>().ToTable("Books"); modelBuilder.Entity<Book>().Property(e => e.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); modelBuilder.Entity<Store>().Property(e => e.Id).HasColumnName("StoreId"); } } }
using System.ComponentModel.DataAnnotations.Schema; using System.Data.Common; using System.Data.Entity; using Abp.Zero.EntityFramework; using Abp.Zero.SampleApp.BookStore; using Abp.Zero.SampleApp.EntityHistory; using Abp.Zero.SampleApp.MultiTenancy; using Abp.Zero.SampleApp.Roles; using Abp.Zero.SampleApp.Users; namespace Abp.Zero.SampleApp.EntityFramework { public class AppDbContext : AbpZeroDbContext<Tenant, Role, User> { public DbSet<Book> Books { get; set; } public DbSet<Comment> Comments { get; set; } public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } public DbSet<Author> Authors { get; set; } public DbSet<Store> Stores { get; set; } public DbSet<UserTestEntity> UserTestEntities { get; set; } public AppDbContext(DbConnection existingConnection) : base(existingConnection, true) { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<Comment>().HasRequired(e => e.Post).WithMany(e => e.Comments); modelBuilder.Entity<Book>().ToTable("Books"); modelBuilder.Entity<Book>().Property(e => e.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); modelBuilder.Entity<Store>().Property(e => e.Id).HasColumnName("StoreId"); } } }
mit
C#
dd13e2508ae854c483b60afcfa8aadd994393bc5
Add note about toast height
UselessToucan/osu,ZLima12/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,peppy/osu,johnneijzen/osu,smoogipoo/osu,ZLima12/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu,smoogipoo/osu,johnneijzen/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu
osu.Game/Overlays/OSD/Toast.cs
osu.Game/Overlays/OSD/Toast.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osuTK.Graphics; namespace osu.Game.Overlays.OSD { public class Toast : Container { private readonly Container content; protected override Container<Drawable> Content => content; public Toast() { Anchor = Anchor.Centre; Origin = Anchor.Centre; Width = 240; // A toast's height is decided (and transformed) by the containing OnScreenDisplay. RelativeSizeAxes = Axes.Y; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.7f }, content = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, } }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osuTK.Graphics; namespace osu.Game.Overlays.OSD { public class Toast : Container { private readonly Container content; protected override Container<Drawable> Content => content; public Toast() { Anchor = Anchor.Centre; Origin = Anchor.Centre; Width = 240; RelativeSizeAxes = Axes.Y; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.7f }, content = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, } }; } } }
mit
C#
475b7c78d9295905ee3bf942d1994ca0a7f7cfbf
Call GetServerInfo asynchronously
tvdburgt/subtle
Subtle.Gui/AboutForm.cs
Subtle.Gui/AboutForm.cs
using System.Windows.Forms; using Octokit; using Subtle.Model; using Application = System.Windows.Forms.Application; namespace Subtle.Gui { public partial class AboutForm : Form { private const string RepositoryOwner = "tvdburgt"; private const string RepositoryName = "subtle"; private const string RepositoryUrl = "https://github.com/tvdburgt/subtle"; private readonly OSDbClient osdbClient; private readonly IGitHubClient githubClient; public AboutForm(OSDbClient osdbClient, IGitHubClient githubClient) { this.osdbClient = osdbClient; this.githubClient = githubClient; InitializeComponent(); LoadSubtleInfo(); LoadServerInfo(); } private async void LoadSubtleInfo() { siteLabel.Text = RepositoryUrl; siteLabel.Links[0].LinkData = RepositoryUrl; versionLabel.Text = $"v{Application.ProductVersion}"; var releases = await githubClient.Release.GetAll(RepositoryOwner, RepositoryName); var latest = releases[0]; latestVersionLabel.Text = $"{latest.TagName} ({latest.PublishedAt:d})"; latestVersionLabel.Links[0].LinkData = latest.HtmlUrl; } private async void LoadServerInfo() { var info = await osdbClient.GetServerInfoAsync(); apiLabel.Text = $"{info.ApiUrl} ({info.ApiVersion})"; subtitleCountLabel.Text = $"{int.Parse(info.SubtitleCount):n0}"; userCountLabel.Text = $"{info.OnlineUserCount:n0}"; clientCountLabel.Text = $"{info.OnlineClientCount:n0}"; subtitleQuotaLabel.Text = $"{info.DownloadQuota.Remaining:n0} (of {info.DownloadQuota.Limit:n0})"; responseTimeLabel.Text = $"{info.ResponseTime.TotalSeconds:0.000}s"; serverTimeLabel.Text = $"{info.ServerTime:0.000}s"; } private void OnLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start(e.Link.LinkData.ToString()); } private void versionLabel_Click(object sender, System.EventArgs e) { } } }
using System.Windows.Forms; using Octokit; using Subtle.Model; using Application = System.Windows.Forms.Application; namespace Subtle.Gui { public partial class AboutForm : Form { private const string RepositoryOwner = "tvdburgt"; private const string RepositoryName = "subtle"; private const string RepositoryUrl = "https://github.com/tvdburgt/subtle"; private readonly OSDbClient osdbClient; private readonly IGitHubClient githubClient; public AboutForm(OSDbClient osdbClient, IGitHubClient githubClient) { this.osdbClient = osdbClient; this.githubClient = githubClient; InitializeComponent(); LoadSubtleInfo(); LoadServerInfo(); } private async void LoadSubtleInfo() { siteLabel.Text = RepositoryUrl; siteLabel.Links[0].LinkData = RepositoryUrl; versionLabel.Text = $"v{Application.ProductVersion}"; var releases = await githubClient.Release.GetAll(RepositoryOwner, RepositoryName); var latest = releases[0]; latestVersionLabel.Text = $"{latest.TagName} ({latest.PublishedAt:d})"; latestVersionLabel.Links[0].LinkData = latest.HtmlUrl; } private async void LoadServerInfo() { var info = osdbClient.GetServerInfo(); apiLabel.Text = $"{info.ApiUrl} ({info.ApiVersion})"; subtitleCountLabel.Text = $"{int.Parse(info.SubtitleCount):n0}"; userCountLabel.Text = $"{info.OnlineUserCount:n0}"; clientCountLabel.Text = $"{info.OnlineClientCount:n0}"; subtitleQuotaLabel.Text = $"{info.DownloadQuota.Remaining:n0} (of {info.DownloadQuota.Limit:n0})"; responseTimeLabel.Text = $"{info.ResponseTime.TotalSeconds:0.000}s"; serverTimeLabel.Text = $"{info.ServerTime:0.000}s"; } private void OnLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start(e.Link.LinkData.ToString()); } private void versionLabel_Click(object sender, System.EventArgs e) { } } }
mit
C#
5a2220091e269710aedbec0509d20a3b4fa1e3ad
add filter for twitter user id
bodell/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,tonyeung/IdentityServer3,codeice/IdentityServer3,bestwpw/IdentityServer3,tonyeung/IdentityServer3,kouweizhong/IdentityServer3,tbitowner/IdentityServer3,remunda/IdentityServer3,bodell/IdentityServer3,uoko-J-Go/IdentityServer,tbitowner/IdentityServer3,ryanvgates/IdentityServer3,tbitowner/IdentityServer3,angelapper/IdentityServer3,roflkins/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,AscendXYZ/Thinktecture.IdentityServer.v3,codeice/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,yanjustino/IdentityServer3,tuyndv/IdentityServer3,IdentityServer/IdentityServer3,wondertrap/IdentityServer3,buddhike/IdentityServer3,ascoro/Thinktecture.IdentityServer.v3.Fork,Agrando/IdentityServer3,bestwpw/IdentityServer3,ryanvgates/IdentityServer3,paulofoliveira/IdentityServer3,uoko-J-Go/IdentityServer,huoxudong125/Thinktecture.IdentityServer.v3,chicoribas/IdentityServer3,charoco/IdentityServer3,jackswei/IdentityServer3,delloncba/IdentityServer3,18098924759/IdentityServer3,openbizgit/IdentityServer3,paulofoliveira/IdentityServer3,jonathankarsh/IdentityServer3,codeice/IdentityServer3,EternalXw/IdentityServer3,chicoribas/IdentityServer3,angelapper/IdentityServer3,openbizgit/IdentityServer3,iamkoch/IdentityServer3,ryanvgates/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,IdentityServer/IdentityServer3,jonathankarsh/IdentityServer3,tuyndv/IdentityServer3,faithword/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,uoko-J-Go/IdentityServer,wondertrap/IdentityServer3,jackswei/IdentityServer3,openbizgit/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,chicoribas/IdentityServer3,18098924759/IdentityServer3,faithword/IdentityServer3,remunda/IdentityServer3,buddhike/IdentityServer3,18098924759/IdentityServer3,roflkins/IdentityServer3,paulofoliveira/IdentityServer3,iamkoch/IdentityServer3,tonyeung/IdentityServer3,mvalipour/IdentityServer3,jonathankarsh/IdentityServer3,tuyndv/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,olohmann/IdentityServer3,AscendXYZ/Thinktecture.IdentityServer.v3,ascoro/Thinktecture.IdentityServer.v3.Fork,delRyan/IdentityServer3,SonOfSam/IdentityServer3,delloncba/IdentityServer3,Agrando/IdentityServer3,EternalXw/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,charoco/IdentityServer3,kouweizhong/IdentityServer3,iamkoch/IdentityServer3,delRyan/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,delloncba/IdentityServer3,delRyan/IdentityServer3,mvalipour/IdentityServer3,SonOfSam/IdentityServer3,yanjustino/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,EternalXw/IdentityServer3,buddhike/IdentityServer3,roflkins/IdentityServer3,olohmann/IdentityServer3,mvalipour/IdentityServer3,yanjustino/IdentityServer3,SonOfSam/IdentityServer3,remunda/IdentityServer3,faithword/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,Agrando/IdentityServer3,jackswei/IdentityServer3,bestwpw/IdentityServer3,olohmann/IdentityServer3,bodell/IdentityServer3,wondertrap/IdentityServer3,charoco/IdentityServer3,IdentityServer/IdentityServer3,kouweizhong/IdentityServer3,angelapper/IdentityServer3
source/Core/Services/DefaultExternalClaimsFilter.cs
source/Core/Services/DefaultExternalClaimsFilter.cs
using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Thinktecture.IdentityServer.Core.Models; namespace Thinktecture.IdentityServer.Core.Services { public class DefaultExternalClaimsFilter : IExternalClaimsFilter { protected string FacebookProviderName = "Facebook"; protected string TwitterProviderName = "Twitter"; public IEnumerable<Claim> Filter(IdentityProvider provider, IEnumerable<Claim> claims) { claims = NormalizeExternalClaimTypes(claims); claims = TransformSocialClaims(provider, claims); return claims; } protected virtual IEnumerable<Claim> NormalizeExternalClaimTypes(IEnumerable<Claim> incomingClaims) { return Thinktecture.IdentityServer.Core.Plumbing.ClaimMap.Map(incomingClaims); } protected virtual IEnumerable<Claim> TransformSocialClaims(IdentityProvider provider, IEnumerable<Claim> claims) { if (provider.Name == FacebookProviderName) { claims = TransformFacebookClaims(claims); } else if (provider.Name == TwitterProviderName) { claims = TransformTwitterClaims(claims); } return claims; } protected virtual IEnumerable<Claim> TransformFacebookClaims(IEnumerable<Claim> claims) { var nameClaim = claims.FirstOrDefault(x => x.Type == "urn:facebook:name"); if (nameClaim != null) { var list = claims.ToList(); list.Remove(nameClaim); list.RemoveAll(x => x.Type == Constants.ClaimTypes.Name); list.Add(new Claim(Constants.ClaimTypes.Name, nameClaim.Value)); return list; } return claims; } protected virtual IEnumerable<Claim> TransformTwitterClaims(IEnumerable<Claim> claims) { return claims.Where(x => x.Type != "urn:twitter:userid"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Thinktecture.IdentityServer.Core.Models; namespace Thinktecture.IdentityServer.Core.Services { public class DefaultExternalClaimsFilter : IExternalClaimsFilter { protected string FacebookProviderName = "Facebook"; public IEnumerable<Claim> Filter(IdentityProvider provider, IEnumerable<Claim> claims) { claims = NormalizeExternalClaimTypes(claims); claims = TransformSocialClaims(provider, claims); return claims; } protected virtual IEnumerable<Claim> NormalizeExternalClaimTypes(IEnumerable<Claim> incomingClaims) { return Thinktecture.IdentityServer.Core.Plumbing.ClaimMap.Map(incomingClaims); } protected virtual IEnumerable<Claim> TransformSocialClaims(IdentityProvider provider, IEnumerable<Claim> claims) { if (provider.Name == FacebookProviderName) { claims = TransformFacebookClaims(claims); } return claims; } protected virtual IEnumerable<Claim> TransformFacebookClaims(IEnumerable<Claim> claims) { var nameClaim = claims.FirstOrDefault(x => x.Type == "urn:facebook:name"); if (nameClaim != null) { var list = claims.ToList(); list.Remove(nameClaim); list.RemoveAll(x=>x.Type == Constants.ClaimTypes.Name); list.Add(new Claim(Constants.ClaimTypes.Name, nameClaim.Value)); return list; } return claims; } } }
apache-2.0
C#
9fb59a078a1157cddef0989cf03b75de15ee309e
remove redundant condition
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity
Assets/MRTK/SDK/Features/UX/Scripts/Utilities/ToggleHandVisualisation.cs
Assets/MRTK/SDK/Features/UX/Scripts/Utilities/ToggleHandVisualisation.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Input; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.UI { [AddComponentMenu("Scripts/MRTK/SDK/ToggleHandVisualisation")] public class ToggleHandVisualisation : MonoBehaviour { /// <summary> /// Toggles hand mesh visualization /// </summary> public void OnToggleHandMesh() { MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile; if (inputSystemProfile == null) { return; } MixedRealityHandTrackingProfile handTrackingProfile = inputSystemProfile.HandTrackingProfile; if (handTrackingProfile != null) { handTrackingProfile.EnableHandMeshVisualization = !handTrackingProfile.EnableHandMeshVisualization; } } /// <summary> /// Toggles hand joint visualization /// </summary> public void OnToggleHandJoint() { MixedRealityHandTrackingProfile handTrackingProfile = null; if ((CoreServices.InputSystem != null) && (CoreServices.InputSystem.InputSystemProfile != null)) { handTrackingProfile = CoreServices.InputSystem.InputSystemProfile.HandTrackingProfile; } if (handTrackingProfile != null) { handTrackingProfile.EnableHandJointVisualization = !handTrackingProfile.EnableHandJointVisualization; } } } }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Input; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.UI { [AddComponentMenu("Scripts/MRTK/SDK/ToggleHandVisualisation")] public class ToggleHandVisualisation : MonoBehaviour { /// <summary> /// Toggles hand mesh visualization /// </summary> public void OnToggleHandMesh() { MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile; if (inputSystemProfile == null) { return; } MixedRealityHandTrackingProfile handTrackingProfile = inputSystemProfile.HandTrackingProfile; if (handTrackingProfile != null) { handTrackingProfile.EnableHandMeshVisualization = !handTrackingProfile.EnableHandMeshVisualization; } } /// <summary> /// Toggles hand joint visualization /// </summary> public void OnToggleHandJoint() { MixedRealityHandTrackingProfile handTrackingProfile = null; if ((CoreServices.InputSystem != null) && (CoreServices.InputSystem.InputSystemProfile != null) && (CoreServices.InputSystem.InputSystemProfile != null)) { handTrackingProfile = CoreServices.InputSystem.InputSystemProfile.HandTrackingProfile; } if (handTrackingProfile != null) { handTrackingProfile.EnableHandJointVisualization = !handTrackingProfile.EnableHandJointVisualization; } } } }
mit
C#
31258effe72baa57d3ebfedef197aa32d0ffaa06
Increase horizontal camera turn speed
dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo
DynamixelServo.Quadruped.WebInterface/VideoStreaming/CameraController.cs
DynamixelServo.Quadruped.WebInterface/VideoStreaming/CameraController.cs
using System.Numerics; using DynamixelServo.Driver; namespace DynamixelServo.Quadruped.WebInterface.VideoStreaming { public class CameraController : ICameraController { private readonly DynamixelDriver _driver; private const byte HorizontalMotorIndex = 13; private const byte VerticalMotorIndex = 14; public CameraController(DynamixelDriver driver) { _driver = driver; CenterView(); } public void CenterView() { _driver.SetMovingSpeed(HorizontalMotorIndex, 300); _driver.SetMovingSpeed(VerticalMotorIndex, 300); _driver.SetGoalPositionInDegrees(HorizontalMotorIndex, 150); _driver.SetGoalPositionInDegrees(VerticalMotorIndex, 60); } public void StartMove(Vector2 direction) { const float deadzone = 0.5f; _driver.SetMovingSpeed(HorizontalMotorIndex, 30); _driver.SetMovingSpeed(VerticalMotorIndex, 20); if (direction.X > deadzone) { _driver.SetGoalPositionInDegrees(HorizontalMotorIndex, 0); } else if (direction.X < -deadzone) { _driver.SetGoalPositionInDegrees(HorizontalMotorIndex, 300); } if (direction.Y > deadzone) { _driver.SetGoalPositionInDegrees(VerticalMotorIndex, 270); } else if (direction.Y < -deadzone) { _driver.SetGoalPositionInDegrees(VerticalMotorIndex, 30); } } public void StopMove() { var currentPos = _driver.GetPresentPosition(HorizontalMotorIndex); _driver.SetGoalPosition(HorizontalMotorIndex, currentPos); currentPos = _driver.GetPresentPosition(VerticalMotorIndex); _driver.SetGoalPosition(VerticalMotorIndex, currentPos); } } }
using System.Numerics; using DynamixelServo.Driver; namespace DynamixelServo.Quadruped.WebInterface.VideoStreaming { public class CameraController : ICameraController { private readonly DynamixelDriver _driver; private const byte HorizontalMotorIndex = 13; private const byte VerticalMotorIndex = 14; public CameraController(DynamixelDriver driver) { _driver = driver; CenterView(); } public void CenterView() { _driver.SetMovingSpeed(HorizontalMotorIndex, 300); _driver.SetMovingSpeed(VerticalMotorIndex, 300); _driver.SetGoalPositionInDegrees(HorizontalMotorIndex, 150); _driver.SetGoalPositionInDegrees(VerticalMotorIndex, 60); } public void StartMove(Vector2 direction) { const float deadzone = 0.5f; _driver.SetMovingSpeed(HorizontalMotorIndex, 20); _driver.SetMovingSpeed(VerticalMotorIndex, 20); if (direction.X > deadzone) { _driver.SetGoalPositionInDegrees(HorizontalMotorIndex, 0); } else if (direction.X < -deadzone) { _driver.SetGoalPositionInDegrees(HorizontalMotorIndex, 300); } if (direction.Y > deadzone) { _driver.SetGoalPositionInDegrees(VerticalMotorIndex, 270); } else if (direction.Y < -deadzone) { _driver.SetGoalPositionInDegrees(VerticalMotorIndex, 30); } } public void StopMove() { var currentPos = _driver.GetPresentPosition(HorizontalMotorIndex); _driver.SetGoalPosition(HorizontalMotorIndex, currentPos); currentPos = _driver.GetPresentPosition(VerticalMotorIndex); _driver.SetGoalPosition(VerticalMotorIndex, currentPos); } } }
apache-2.0
C#
3f4ba93f4b3b925d310db8bce078c63606f2a76a
change default
davidbetz/nalarium
Nalarium/Text/Process.cs
Nalarium/Text/Process.cs
#region Copyright //+ Copyright David Betz 2008-2015 #endregion namespace Nalarium.Text { /// <summary> /// General text manipulation. /// </summary> public static class Process { /// <summary> /// Returns up to n-characters. /// </summary> /// <param name="text">Text</param> /// <param name="max">Character count</param> /// <param name="useEllipsis"></param> /// <param name="useHtmlEllipsis"></param> /// <returns></returns> public static string Max(string text, int max, bool useEllipsis = false, bool useHtmlEllipsis = false) { if (string.IsNullOrEmpty(text)) { return string.Empty; } if (useEllipsis && max > 3) { if (text.Length > max - 3) { return text.Substring(0, max - 3) + (useHtmlEllipsis ? "&hellip;" : "..."); } } if (text.Length > max) { return text.Substring(0, max); } return text; } } }
#region Copyright //+ Copyright David Betz 2008-2015 #endregion namespace Nalarium.Text { /// <summary> /// General text manipulation. /// </summary> public static class Process { /// <summary> /// Returns up to n-characters. /// </summary> /// <param name="text">Text</param> /// <param name="max">Character count</param> /// <param name="useEllipsis"></param> /// <param name="useHtmlEllipsis"></param> /// <returns></returns> public static string Max(string text, int max, bool useEllipsis = false, bool useHtmlEllipsis = true) { if (string.IsNullOrEmpty(text)) { return string.Empty; } if (useEllipsis && max > 3) { if (text.Length > max - 3) { return text.Substring(0, max - 3) + (useHtmlEllipsis ? "&hellip;" : "..."); } } if (text.Length > max) { return text.Substring(0, max); } return text; } } }
bsd-3-clause
C#
03ae9db7c5ad37b658f88de942285b1499e5d8e8
Fix versioning to 1.0.0 - adopting SemVer
managed-commons/managed-commons-getoptions,managed-commons/managed-commons-getoptions
Assembly/AssemblyInfo.cs
Assembly/AssemblyInfo.cs
// Commons.GetOptions Assembly Information // // Copyright ©2002-2014 Rafael 'Monoman' Teixeira, Managed Commons Team // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Commons.GetOptions")] [assembly: AssemblyDescription("Command line arguments parsing library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Managed Commons Project")] [assembly: AssemblyCopyright("Copyright ©2002-2014 Rafael 'Monoman' Teixeira, Managed Commons Team")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("1.0.2014.1")] [assembly: AssemblyProduct("Managed.Commons.GetOptions")] [assembly: AssemblyInformationalVersion("1.0")]
// Commons.GetOptions Assembly Information // // Copyright ©2002-2007 Rafael 'Monoman' Teixeira // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Commons.GetOptions")] [assembly: AssemblyDescription("Command line arguments parsing library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("WEBforAll Teleinformática S/C Ltda.")] [assembly: AssemblyCopyright("Copyright ©2002-2007 Rafael 'Monoman' Teixeira")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(true)] [assembly: AssemblyVersion("1.0.2007.1")] [assembly: AssemblyProduct("Managed.Commons.GetOptions")]
mit
C#
fc05cfef9adf8ca40ba2286944673fb8f6380b1c
Move OutboundSocket.Connect() out of constructor.
danbarua/NEventSocket,pragmatrix/NEventSocket,danbarua/NEventSocket,pragmatrix/NEventSocket
src/NEventSocket/OutboundSocket.cs
src/NEventSocket/OutboundSocket.cs
namespace NEventSocket { using System; using System.Net.Sockets; using System.Reactive.Linq; using System.Threading.Tasks; using Common.Logging; using NEventSocket.FreeSwitch; using NEventSocket.Sockets; public class OutboundSocket : EventSocket { private static readonly ILog Log = LogManager.GetCurrentClassLogger(); protected internal OutboundSocket(TcpClient tcpClient) : base(tcpClient) { } public async Task<CommandReply> Connect() { var result = await this.SendCommandAsync("connect"); this.disposables.Add( this.MessagesReceived.Where(x => x.ContentType == ContentTypes.DisconnectNotice) .Take(1) .Subscribe( _ => { Log.Debug("Disconnect Notice received."); this.Disconnect(); })); return result; } } }
namespace NEventSocket { using System; using System.Net.Sockets; using System.Reactive.Linq; using Common.Logging; using NEventSocket.FreeSwitch; using NEventSocket.Sockets; public class OutboundSocket : EventSocket { private static readonly ILog Log = LogManager.GetCurrentClassLogger(); protected internal OutboundSocket(TcpClient tcpClient) : base(tcpClient) { this.SendCommandAsync("connect") .ContinueWith(t => { if (t.IsCompleted) { this.disposables.Add( this.MessagesReceived.Where(x => x.ContentType == ContentTypes.DisconnectNotice) .Take(1) .Subscribe( _ => { Log.Debug("Disconnect Notice received."); this.Disconnect(); })); } }); } } }
mpl-2.0
C#
c31929597914ad1e1e8184a634250e48fc05d5fb
Send a MouseMove event between Down,Up
northwoodspd/uia,northwoodspd/uia,northwoodspd/uia,northwoodspd/uia
ext/UiaDll/UIA.Helper/Mouse.cs
ext/UiaDll/UIA.Helper/Mouse.cs
using System; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Automation; using System.Windows.Forms; namespace UIA.Helper { public class Mouse { [DllImport("user32.dll")] static extern void mouse_event(uint flags, uint x, uint y, uint data, int extraInfo); private const uint MOUSEEVENTLF_MOVE = 0x1; private const uint MOUSEEVENTLF_LEFTDOWN = 0x2; private const uint MOUSEEVENTLF_LEFTUP = 0x4; public static void Drag(int startX, int startY, int endX, int endY) { Cursor.Position = new System.Drawing.Point(startX, startY); Down(); Move((uint)((startX + endX) / 2), (uint)((startY + endY) / 2)); Cursor.Position = new System.Drawing.Point(endX, endY); Up(); } public static void ClickClickablePoint(AutomationElement element) { Click(element, element.GetClickablePoint); } public static void ClickCenter(AutomationElement element) { Click(element, () => Center(element)); } private static void Click(AutomationElement element, Func<Point> GetPoint) { element.ScrollToIfPossible(); element.TryToFocus(); var point = GetPoint(); Cursor.Position = new System.Drawing.Point((int)point.X, (int)point.Y); Down(); Up(); } private static void Up() { mouse_event(MOUSEEVENTLF_LEFTUP, 0, 0, 0, 0); } private static void Down() { mouse_event(MOUSEEVENTLF_LEFTDOWN, 0, 0, 0, 0); } private static void Move(uint x, uint y) { mouse_event(MOUSEEVENTLF_MOVE, x, y, 0, 0); } private static Point Center(AutomationElement element) { try { return element.GetClickablePoint(); } catch (Exception) { return element.Current.BoundingRectangle.Center(); } } } }
using System; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Automation; using System.Windows.Forms; namespace UIA.Helper { public class Mouse { [DllImport("user32.dll")] static extern void mouse_event(uint flags, uint x, uint y, uint data, int extraInfo); [Flags] public enum MouseEvent { Leftdown = 0x00000002, Leftup = 0x00000004, } private const uint MOUSEEVENTLF_LEFTDOWN = 0x2; private const uint MOUSEEVENTLF_LEFTUP = 0x4; public static void Drag(int startX, int startY, int endX, int endY) { Cursor.Position = new System.Drawing.Point(startX, startY); Down(); Cursor.Position = new System.Drawing.Point(endX, endY); Up(); } public static void ClickClickablePoint(AutomationElement element) { Click(element, element.GetClickablePoint); } public static void ClickCenter(AutomationElement element) { Click(element, () => Center(element)); } private static void Click(AutomationElement element, Func<Point> GetPoint) { element.ScrollToIfPossible(); element.TryToFocus(); var point = GetPoint(); Cursor.Position = new System.Drawing.Point((int) point.X, (int) point.Y); Down(); Up(); } private static void Up() { mouse_event(MOUSEEVENTLF_LEFTUP, 0, 0, 0, 0); } private static void Down() { mouse_event(MOUSEEVENTLF_LEFTDOWN, 0, 0, 0, 0); } private static Point Center(AutomationElement element) { try { return element.GetClickablePoint(); } catch (Exception) { return element.Current.BoundingRectangle.Center(); } } } }
mit
C#
d81771bf145e7e0de2e8734a962b21611429be56
Use references in the documentation (this also removes the spelling warning).
peopleware/net-ppwcode-vernacular-wcf
src/PPWCode.Vernacular.Wcf.I/Config/WcfConstants.cs
src/PPWCode.Vernacular.Wcf.I/Config/WcfConstants.cs
// Copyright 2014 by PeopleWare n.v.. // // 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. namespace PPWCode.Vernacular.Wcf.I.Config { public static class WcfConstants { /// <summary> /// Duplicates the <see cref="ExtensionScopeKey" /> property on /// <see cref="Castle.Facilities.WcfIntegration.WcfConstants" /> because it is internal defined. /// </summary> public const string ExtensionScopeKey = "scope"; } }
// Copyright 2014 by PeopleWare n.v.. // // 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. namespace PPWCode.Vernacular.Wcf.I.Config { public static class WcfConstants { /// <summary> /// Duplicates Castle.Facilities.WcfIntegration.WcfConstants.ExtensionScopeKey because it is internal defined. /// </summary> public const string ExtensionScopeKey = "scope"; } }
apache-2.0
C#
f6136797eab6de7f6436e60b2d0e8575a0e3ab89
return picture base_link from pictures class
mfilippov/vimeo-dot-net
src/VimeoDotNet/Models/Pictures.cs
src/VimeoDotNet/Models/Pictures.cs
using System.Collections.Generic; using JetBrains.Annotations; using Newtonsoft.Json; namespace VimeoDotNet.Models { /// <summary> /// User pictures /// </summary> public class Pictures { /// <summary> /// URI /// </summary> [PublicAPI] [JsonProperty(PropertyName = "uri")] public string Uri { get; set; } /// <summary> /// Active /// </summary> [PublicAPI] [JsonProperty(PropertyName = "active")] public bool Active { get; set; } /// <summary> /// Type /// </summary> [PublicAPI] [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// <summary> /// Sizes /// </summary> [PublicAPI] [JsonProperty(PropertyName = "sizes")] public List<Size> Sizes { get; set; } /// <summary> /// Resources key /// </summary> [PublicAPI] [JsonProperty(PropertyName = "resource_key")] public string ResourceKey { get; set; } /// <summary> /// The upload URL for the picture. This field appears when you create the picture resource for the first time. /// </summary> [PublicAPI] [JsonProperty(PropertyName = "base_link")] public string Link { get; set; } } }
using System.Collections.Generic; using JetBrains.Annotations; using Newtonsoft.Json; namespace VimeoDotNet.Models { /// <summary> /// User pictures /// </summary> public class Pictures { /// <summary> /// URI /// </summary> [PublicAPI] [JsonProperty(PropertyName = "uri")] public string Uri { get; set; } /// <summary> /// Active /// </summary> [PublicAPI] [JsonProperty(PropertyName = "active")] public bool Active { get; set; } /// <summary> /// Type /// </summary> [PublicAPI] [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// <summary> /// Sizes /// </summary> [PublicAPI] [JsonProperty(PropertyName = "sizes")] public List<Size> Sizes { get; set; } /// <summary> /// Resources key /// </summary> [PublicAPI] [JsonProperty(PropertyName = "resource_key")] public string ResourceKey { get; set; } } }
mit
C#
6bdf139df079e3e1f489d622f2dce501a68e03c6
Check for Enabled
angelapper/IdentityServer3,wondertrap/IdentityServer3,IdentityServer/IdentityServer3,angelapper/IdentityServer3,tonyeung/IdentityServer3,mvalipour/IdentityServer3,delloncba/IdentityServer3,kouweizhong/IdentityServer3,olohmann/IdentityServer3,paulofoliveira/IdentityServer3,codeice/IdentityServer3,iamkoch/IdentityServer3,faithword/IdentityServer3,18098924759/IdentityServer3,chicoribas/IdentityServer3,jonathankarsh/IdentityServer3,charoco/IdentityServer3,jackswei/IdentityServer3,roflkins/IdentityServer3,uoko-J-Go/IdentityServer,ryanvgates/IdentityServer3,chicoribas/IdentityServer3,SonOfSam/IdentityServer3,tonyeung/IdentityServer3,buddhike/IdentityServer3,buddhike/IdentityServer3,bestwpw/IdentityServer3,EternalXw/IdentityServer3,paulofoliveira/IdentityServer3,roflkins/IdentityServer3,iamkoch/IdentityServer3,codeice/IdentityServer3,Agrando/IdentityServer3,delRyan/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,AscendXYZ/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,yanjustino/IdentityServer3,iamkoch/IdentityServer3,IdentityServer/IdentityServer3,tbitowner/IdentityServer3,chicoribas/IdentityServer3,mvalipour/IdentityServer3,faithword/IdentityServer3,remunda/IdentityServer3,angelapper/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,openbizgit/IdentityServer3,delRyan/IdentityServer3,olohmann/IdentityServer3,jonathankarsh/IdentityServer3,uoko-J-Go/IdentityServer,codeice/IdentityServer3,bodell/IdentityServer3,mvalipour/IdentityServer3,SonOfSam/IdentityServer3,remunda/IdentityServer3,yanjustino/IdentityServer3,bodell/IdentityServer3,delloncba/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,ryanvgates/IdentityServer3,delRyan/IdentityServer3,remunda/IdentityServer3,wondertrap/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,tuyndv/IdentityServer3,openbizgit/IdentityServer3,tuyndv/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,bestwpw/IdentityServer3,EternalXw/IdentityServer3,Agrando/IdentityServer3,tbitowner/IdentityServer3,SonOfSam/IdentityServer3,faithword/IdentityServer3,buddhike/IdentityServer3,kouweizhong/IdentityServer3,Agrando/IdentityServer3,uoko-J-Go/IdentityServer,maz100/Thinktecture.IdentityServer.v3,delloncba/IdentityServer3,tuyndv/IdentityServer3,18098924759/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,paulofoliveira/IdentityServer3,charoco/IdentityServer3,yanjustino/IdentityServer3,18098924759/IdentityServer3,IdentityServer/IdentityServer3,tbitowner/IdentityServer3,bodell/IdentityServer3,jonathankarsh/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,EternalXw/IdentityServer3,bestwpw/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,ryanvgates/IdentityServer3,roflkins/IdentityServer3,tonyeung/IdentityServer3,openbizgit/IdentityServer3,jackswei/IdentityServer3,kouweizhong/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,charoco/IdentityServer3,olohmann/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,wondertrap/IdentityServer3,AscendXYZ/Thinktecture.IdentityServer.v3,jackswei/IdentityServer3
source/WsFed/Services/TestRelyingPartyService.cs
source/WsFed/Services/TestRelyingPartyService.cs
/* * Copyright (c) Dominick Baier, Brock Allen. All rights reserved. * see license */ using System; using System.Security.Claims; using Thinktecture.IdentityServer.WsFed.Models; namespace Thinktecture.IdentityServer.WsFed.Services { public class TestRelyingPartyService : IRelyingPartyService { public RelyingParty GetByRealm(string realm) { return new RelyingParty { Realm = "urn:testrp", Enabled = true, ReplyUrl = new Uri("https://web.local/idsrvrp/"), TokenType = Thinktecture.IdentityModel.Constants.TokenTypes.Saml2TokenProfile11, Claims = new[] { ClaimTypes.Name }, TokenLifeTime = 1 }; } } }
/* * Copyright (c) Dominick Baier, Brock Allen. All rights reserved. * see license */ using System; using System.Security.Claims; using Thinktecture.IdentityServer.WsFed.Models; namespace Thinktecture.IdentityServer.WsFed.Services { public class TestRelyingPartyService : IRelyingPartyService { public RelyingParty GetByRealm(string realm) { return new RelyingParty { Realm = "urn:testrp", ReplyUrl = new Uri("https://web.local/idsrvrp/"), TokenType = Thinktecture.IdentityModel.Constants.TokenTypes.Saml2TokenProfile11, Claims = new[] { ClaimTypes.Name }, TokenLifeTime = 1 }; } } }
apache-2.0
C#
7a753ad9e2750dcc6ee0f22b7748250edabf9e1f
Change grouping title colours to match white background
ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ZLima12/osu,NeoAdonis/osu,UselessToucan/osu,2yangk23/osu,UselessToucan/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,johnneijzen/osu,EVAST9919/osu,peppy/osu,EVAST9919/osu,johnneijzen/osu,ZLima12/osu,2yangk23/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new
osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs
osu.Game.Tournament/Screens/Ladder/Components/DrawableTournamentGrouping.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableTournamentGrouping : CompositeDrawable { public DrawableTournamentGrouping(TournamentGrouping grouping, bool losers = false) { AutoSizeAxes = Axes.Both; InternalChild = new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Text = grouping.Description.Value.ToUpper(), Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, new OsuSpriteText { Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), Font = "Exo2.0-Bold", Colour = Color4.Black, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, } }; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; namespace osu.Game.Tournament.Screens.Ladder.Components { public class DrawableTournamentGrouping : CompositeDrawable { public DrawableTournamentGrouping(TournamentGrouping grouping, bool losers = false) { AutoSizeAxes = Axes.Both; InternalChild = new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Text = grouping.Description.Value.ToUpper(), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, new OsuSpriteText { Text = ((losers ? "Losers " : "") + grouping.Name).ToUpper(), Font = "Exo2.0-Bold", Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre }, } }; } } }
mit
C#
6122ef5828afbbc9e55c098fdbf5f4b826457863
Fix for poorly migrated Script Library
ostat/Console,ostat/Console
Core/Host/CommandHelp.cs
Core/Host/CommandHelp.cs
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Management.Automation; using System.Text; using Cognifide.PowerShell.Core.Modules; using Cognifide.PowerShell.Core.Settings; using Sitecore.Configuration; using Sitecore.Data; using Sitecore.Data.Items; namespace Cognifide.PowerShell.Core.Host { public static class CommandHelp { public static IEnumerable<string> GetHelp(ScriptSession session, string command) { Collection<PSParseError> errors; Collection<PSToken> tokens = PSParser.Tokenize(command, out errors); PSToken lastPsToken = tokens.Where(t => t.Type == PSTokenType.Command).LastOrDefault(); if (lastPsToken != null) { session.Output.Clear(); string lastToken = lastPsToken.Content; session.SetVariable("helpFor", lastToken); var platformmodule = ModuleManager.GetModule("Platform"); Item scriptItem = Database.GetDatabase(platformmodule.Database) .GetItem(platformmodule.Path + "/Internal/Context Help/Command Help"); if (scriptItem == null) { scriptItem = Factory.GetDatabase(ApplicationSettings.ScriptLibraryDb) .GetItem(ApplicationSettings.ScriptLibraryPath + "Internal/Context Help/Command Help"); } session.ExecuteScriptPart(scriptItem["script"], true, true); var sb = new StringBuilder("<div id=\"HelpClose\">X</div>"); if (session.Output.Count == 0 || session.Output[0].LineType == OutputLineType.Error) { return new[] { "<div class='ps-help-command-name'>&nbsp;</div><div class='ps-help-header' align='center'>No Command in line or help information found</div><div class='ps-help-parameter' align='center'>Cannot provide help in this context.</div>" }; } session.Output.ForEach(l => sb.Append(l.Text)); session.Output.Clear(); var result = new[] {sb.ToString()}; return result; } return new[] {"No Command in line found - cannot provide help in this context."}; } } }
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Management.Automation; using System.Text; using Cognifide.PowerShell.Core.Modules; using Sitecore.Data; using Sitecore.Data.Items; namespace Cognifide.PowerShell.Core.Host { public static class CommandHelp { public static IEnumerable<string> GetHelp(ScriptSession session, string command) { Collection<PSParseError> errors; Collection<PSToken> tokens = PSParser.Tokenize(command, out errors); PSToken lastPsToken = tokens.Where(t => t.Type == PSTokenType.Command).LastOrDefault(); if (lastPsToken != null) { session.Output.Clear(); string lastToken = lastPsToken.Content; session.SetVariable("helpFor", lastToken); var platformmodule = ModuleManager.GetModule("Platform"); Item scriptItem = Database.GetDatabase(platformmodule.Database) .GetItem(platformmodule.Path + "/Internal/Context Help/Command Help"); session.ExecuteScriptPart(scriptItem["script"], true, true); var sb = new StringBuilder("<div id=\"HelpClose\">x</div>"); if (session.Output.Count == 0 || session.Output[0].LineType == OutputLineType.Error) { return new[] { "<div class='ps-help-command-name'>&nbsp;</div><div class='ps-help-header' align='center'>No Command in line or help information found</div><div class='ps-help-parameter' align='center'>Cannot provide help in this context.</div>" }; } session.Output.ForEach(l => sb.Append(l.Text)); session.Output.Clear(); var result = new[] {sb.ToString()}; return result; } return new[] {"No Command in line found - cannot provide help in this context."}; } } }
mit
C#
77f6724ca33850c359218c6c0f7bd1c00c13191c
Fix link to account page while in admin area
mtian/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery,skbkontur/NuGetGallery,skbkontur/NuGetGallery,projectkudu/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,ScottShingler/NuGetGallery,grenade/NuGetGallery_download-count-patch
src/NuGetGallery/Views/Shared/UserDisplay.cshtml
src/NuGetGallery/Views/Shared/UserDisplay.cshtml
<div class="user-display"> @if (!User.Identity.IsAuthenticated) { string returnUrl = ViewData.ContainsKey(Constants.ReturnUrlViewDataKey) ? (string)ViewData[Constants.ReturnUrlViewDataKey] : Request.RawUrl; <span class="welcome"> <a href="@Url.LogOn(returnUrl)" title="Register for an account or sign in with an existing account">Register / Sign in</a> </span> } else { <span class="welcome"><a href="@Url.Action("Account", "Users", new { area = "" })">@(User.Identity.Name)</a></span> <text>/</text> <span class="user-actions"> <a href="@Url.LogOff()">Sign out</a> </span> } </div>
<div class="user-display"> @if (!User.Identity.IsAuthenticated) { string returnUrl = ViewData.ContainsKey(Constants.ReturnUrlViewDataKey) ? (string)ViewData[Constants.ReturnUrlViewDataKey] : Request.RawUrl; <span class="welcome"> <a href="@Url.LogOn(returnUrl)" title="Register for an account or sign in with an existing account">Register / Sign in</a> </span> } else { <span class="welcome"><a href="@Url.Action(actionName: "Account", controllerName: "Users")">@(User.Identity.Name)</a></span> <text>/</text> <span class="user-actions"> <a href="@Url.LogOff()">Sign out</a> </span> } </div>
apache-2.0
C#
7e10a151d2b2aca2a74c641e6b8230e03c689b12
Fix order of title/message in dialog
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
src/SyncTrayzor/Utils/SafeSyncthingExtensions.cs
src/SyncTrayzor/Utils/SafeSyncthingExtensions.cs
using Stylet; using SyncTrayzor.Localization; using SyncTrayzor.SyncThing; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace SyncTrayzor.Utils { public static class SafeSyncthingExtensions { public static async Task StartWithErrorDialogAsync(this ISyncThingManager syncThingManager, IWindowManager windowManager) { try { await syncThingManager.StartAsync(); } catch (Win32Exception e) { if (e.ErrorCode != -2147467259) throw; // Possibly "This program is blocked by group policy. For more information, contact your system administrator" caused // by e.g. CryptoLocker? windowManager.ShowMessageBox( Localizer.Translate("Dialog_SyncthingBlockedByGroupPolicy_Message", e.Message, syncThingManager.ExecutablePath), Localizer.Translate("Dialog_SyncthingBlockedByGroupPolicy_Title"), MessageBoxButton.OK, icon: MessageBoxImage.Error); } catch (SyncThingDidNotStartCorrectlyException) { // Haven't translated yet - still debugging windowManager.ShowMessageBox( "Syncthing started running, but we were enable to connect to it. Please report this as a bug", "Syncthing didn't start correctly", MessageBoxButton.OK, icon: MessageBoxImage.Error); } } } }
using Stylet; using SyncTrayzor.Localization; using SyncTrayzor.SyncThing; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace SyncTrayzor.Utils { public static class SafeSyncthingExtensions { public static async Task StartWithErrorDialogAsync(this ISyncThingManager syncThingManager, IWindowManager windowManager) { try { await syncThingManager.StartAsync(); } catch (Win32Exception e) { if (e.ErrorCode != -2147467259) throw; // Possibly "This program is blocked by group policy. For more information, contact your system administrator" caused // by e.g. CryptoLocker? windowManager.ShowMessageBox( Localizer.Translate("Dialog_SyncthingBlockedByGroupPolicy_Message", e.Message, syncThingManager.ExecutablePath), Localizer.Translate("Dialog_SyncthingBlockedByGroupPolicy_Title"), MessageBoxButton.OK, icon: MessageBoxImage.Error); } catch (SyncThingDidNotStartCorrectlyException) { // Haven't translated yet - still debugging windowManager.ShowMessageBox( "Syncthing didn't start correctly", "Syncthing started running, but we were enable to connect to it. Please report this as a bug", MessageBoxButton.OK, icon: MessageBoxImage.Error); } } } }
mit
C#
07391565989e8200ab496fffff8b62a14ddcc53f
Add back responsive view
wangkanai/Detection
src/DependencyInjection/BuilderExtensions/Responsive.cs
src/DependencyInjection/BuilderExtensions/Responsive.cs
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved. // The Apache v2. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection.Extensions; using Wangkanai.Detection.Hosting; using Wangkanai.Detection.Services; namespace Microsoft.Extensions.DependencyInjection { public static class ResponsiveBuilderExtensions { public static IDetectionBuilder AddResponsiveService(this IDetectionBuilder builder) { if (builder is null) throw new ArgumentNullException(nameof(builder)); builder.Services.TryAddTransient<IResponsiveService, ResponsiveService>(); builder.Services.AddRazorViewLocation(); builder.Services.AddRazorPagesConventions(); return builder; } public static IDetectionBuilder AddSessionServices(this IDetectionBuilder builder) { // Add Session to services builder.Services.AddDistributedMemoryCache(); builder.Services.AddSession( options => { options.Cookie.Name = "Detection"; options.IdleTimeout = TimeSpan.FromSeconds(10); options.Cookie.IsEssential = true; }); return builder; } private static IServiceCollection AddRazorViewLocation(this IServiceCollection services) => services.Configure<RazorViewEngineOptions>(options => { options.ViewLocationExpanders.Add(new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix)); options.ViewLocationExpanders.Add(new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Subfolder)); options.ViewLocationExpanders.Add(new ResponsivePageLocationExpander()); }); private static IServiceCollection AddRazorPagesConventions(this IServiceCollection services) { services.AddRazorPages(options => { options.Conventions.Add(new ResponsivePageRouteModelConvention()); }); services.AddSingleton<MatcherPolicy, ResponsivePageMatcherPolicy>(); return services; } } }
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved. // The Apache v2. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection.Extensions; using Wangkanai.Detection.Hosting; using Wangkanai.Detection.Services; namespace Microsoft.Extensions.DependencyInjection { public static class ResponsiveBuilderExtensions { public static IDetectionBuilder AddResponsiveService(this IDetectionBuilder builder) { if (builder is null) throw new ArgumentNullException(nameof(builder)); builder.Services.TryAddTransient<IResponsiveService, ResponsiveService>(); builder.Services.AddRazorViewLocation(); builder.Services.AddRazorPagesLocation(); return builder; } public static IDetectionBuilder AddSessionServices(this IDetectionBuilder builder) { // Add Session to services builder.Services.AddDistributedMemoryCache(); builder.Services.AddSession( options => { options.Cookie.Name = "Detection"; options.IdleTimeout = TimeSpan.FromSeconds(10); options.Cookie.IsEssential = true; }); return builder; } private static IServiceCollection AddRazorViewLocation(this IServiceCollection services) => services.Configure<RazorViewEngineOptions>(options => { //options.ViewLocationExpanders.Add(new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix)); //options.ViewLocationExpanders.Add(new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Subfolder)); options.ViewLocationExpanders.Add(new ResponsivePageLocationExpander()); }); private static IServiceCollection AddRazorPagesLocation(this IServiceCollection services) { services.AddRazorPages(options => { options.Conventions.Add(new ResponsivePageRouteModelConvention()); }); services.AddSingleton<MatcherPolicy, ResponsivePageMatcherPolicy>(); return services; } } }
apache-2.0
C#
e4af71d1098cf2d044f4179fe8e59a3dfe18f964
update assembly info
jamesmontemagno/InAppBillingPlugin
src/Plugin.InAppBilling.tvOS/Properties/AssemblyInfo.cs
src/Plugin.InAppBilling.tvOS/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Plugin.InAppBilling")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Plugin.InAppBilling")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("79036eb1-a7be-45c4-97f2-061eec984bec")] // 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.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Plugin.InAppBilling.tvOS")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Plugin.InAppBilling.tvOS")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("79036eb1-a7be-45c4-97f2-061eec984bec")] // 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.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
660213a27fe34117a6b462dcb081db88bf673721
clarify warning
strotz/pustota,strotz/pustota,strotz/pustota
src/Pustota.Maven/Validation/ProjecModulesValidation.cs
src/Pustota.Maven/Validation/ProjecModulesValidation.cs
using System.Collections.Generic; using Pustota.Maven.Models; namespace Pustota.Maven.Validation { class ProjecModulesValidation : IProjectValidator { public IEnumerable<IProjectValidationProblem> Validate(IExecutionContext context, IProject project) { foreach (var module in project.Operations().AllModules) { var extractor = new ProjectDataExtractor(); IProject moduleProject; if (context.TryGetModule(project, module.Path, out moduleProject)) { if (extractor.Extract(project).Version.IsSnapshot && !extractor.Extract(moduleProject).Version.IsSnapshot) { yield return new ValidationProblem("modulereleasesnapshot") { ProjectReference = project, Severity = ProblemSeverity.ProjectWarning, Description = string.Format("try to build module in release during snapshot build: {0}", module.Path) }; } } else { yield return new ValidationProblem("modulemissing") { ProjectReference = project, Severity = ProblemSeverity.ProjectWarning, Description = string.Format("module {0} not found", module.Path) }; } // REVIEW: move to tree integrity // if (_repository.AllProjects.FirstOrDefault(p => PathOperations.ArePathesEqual(moduleProjectPath, p.FullPath)) == null) // { // string details = string.Format("Project contains a module '{0}', but corresponding project hasn't been loaded", module.Path); // var fix = new DelegatedFix // { // Title = "Try to load the module", // DelegatedAction = () => _repository.LoadOneProject(moduleProjectPath) // }; // var error = new ValidationError(project, "Module hasn't been loaded", details, ErrorLevel.Error); // error.AddFix(fix); // ValidationErrors.Add(error); // continue; // } } } } }
using System.Collections.Generic; using Pustota.Maven.Models; namespace Pustota.Maven.Validation { class ProjecModulesValidation : IProjectValidator { public IEnumerable<IProjectValidationProblem> Validate(IExecutionContext context, IProject project) { foreach (var module in project.Operations().AllModules) { var extractor = new ProjectDataExtractor(); IProject moduleProject; if (context.TryGetModule(project, module.Path, out moduleProject)) { if (extractor.Extract(project).Version.IsSnapshot && !extractor.Extract(moduleProject).Version.IsSnapshot) { yield return new ValidationProblem("modulereleasesnapshot") { ProjectReference = project, Severity = ProblemSeverity.ProjectWarning, Description = string.Format("release has SNAPSHOT module {0}", module.Path) }; } } else { yield return new ValidationProblem("modulemissing") { ProjectReference = project, Severity = ProblemSeverity.ProjectWarning, Description = string.Format("module {0} not found", module.Path) }; } // REVIEW: move to tree integrity // if (_repository.AllProjects.FirstOrDefault(p => PathOperations.ArePathesEqual(moduleProjectPath, p.FullPath)) == null) // { // string details = string.Format("Project contains a module '{0}', but corresponding project hasn't been loaded", module.Path); // var fix = new DelegatedFix // { // Title = "Try to load the module", // DelegatedAction = () => _repository.LoadOneProject(moduleProjectPath) // }; // var error = new ValidationError(project, "Module hasn't been loaded", details, ErrorLevel.Error); // error.AddFix(fix); // ValidationErrors.Add(error); // continue; // } } } } }
mit
C#
d301375ee5d2ed6d4b065656c569f204029e7f73
test travis
riguelbf/SWITCH-OVER
src/SWITCH-OVER.Crosscutting.Ioc/ApiRegisterServices.cs
src/SWITCH-OVER.Crosscutting.Ioc/ApiRegisterServices.cs
using Microsoft.Extensions.DependencyInjection; namespace SWITCH_OVER.Crosscutting.Ioc { public class ApiRegisterServices { public static void Register(IServiceCollection services) { // } } }
using Microsoft.Extensions.DependencyInjection; namespace SWITCH_OVER.Crosscutting.Ioc { public class ApiRegisterServices { public static void Register(IServiceCollection services) { } } }
mit
C#
94e9242b08947f73d1c389221e828c9d918ce7c8
Update BlobStructure.cs
fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation
UnityProject/Assets/Scripts/Systems/Antagonists/Antags/Blob/BlobStructure.cs
UnityProject/Assets/Scripts/Systems/Antagonists/Antags/Blob/BlobStructure.cs
using System; using System.Collections; using System.Collections.Generic; using Light2D; using UnityEngine; namespace Blob { /// <summary> /// Class used as a data holder on an object, all logic is in BlobPlayer /// </summary> public class BlobStructure : MonoBehaviour { public bool isCore; public bool isNode; public bool isResource; public bool isFactory; public bool isReflective; public bool isStrong; public bool isNormal; public LightSprite lightSprite = null; public SpriteHandler spriteHandler = null; [HideInInspector] public Integrity integrity; [HideInInspector] public List<Vector2Int> expandCoords = new List<Vector2Int>(); [HideInInspector] public List<Vector2Int> healthPulseCoords = new List<Vector2Int>(); [HideInInspector] public bool nodeDepleted; [HideInInspector] public Vector3Int location; public string overmindName; [HideInInspector] public Armor initialArmor; [HideInInspector] public Resistances initialResistances; private bool initialSet; private void OnEnable() { integrity = GetComponent<Integrity>(); if(initialSet || integrity == null) return; initialSet = true; initialArmor = integrity.Armor; initialResistances = integrity.Resistances; } private void OnDisable() { if(integrity == null) return; integrity.OnWillDestroyServer.RemoveAllListeners(); integrity.OnApplyDamage.RemoveAllListeners(); } } }
using System; using System.Collections; using System.Collections.Generic; using Light2D; using UnityEngine; namespace Blob { /// <summary> /// Class used as a data holder on an object, all logic is in BlobPlayer /// </summary> public class BlobStructure : MonoBehaviour { public bool isCore; public bool isNode; public bool isResource; public bool isFactory; public bool isReflective; public bool isStrong; public bool isNormal; public LightSprite lightSprite = null; public SpriteHandler spriteHandler = null; [HideInInspector] public Integrity integrity; [HideInInspector] public List<Vector2Int> expandCoords = new List<Vector2Int>(); [HideInInspector] public List<Vector2Int> healthPulseCoords = new List<Vector2Int>(); [HideInInspector] public bool nodeDepleted; [HideInInspector] public Vector3Int location; public string overmindName; [HideInInspector] public Armor initialArmor; [HideInInspector] public Resistances initialResistances; private bool initialSet; private void OnEnable() { integrity = GetComponent<Integrity>(); if(initialSet) return; initialSet = true; initialArmor = integrity.Armor; initialResistances = integrity.Resistances; } private void OnDisable() { if(integrity == null) return; integrity.OnWillDestroyServer.RemoveAllListeners(); integrity.OnApplyDamage.RemoveAllListeners(); } } }
agpl-3.0
C#
bf76b803309e3d6fdd83d9ac776d92f9f3833005
Make tests pass
kgiszewski/Archetype,kipusoep/Archetype,kipusoep/Archetype,kjac/Archetype,Nicholas-Westby/Archetype,kjac/Archetype,Nicholas-Westby/Archetype,tomfulton/Archetype,tomfulton/Archetype,imulus/Archetype,tomfulton/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype,kipusoep/Archetype,kjac/Archetype,imulus/Archetype,imulus/Archetype,kgiszewski/Archetype
app/Umbraco/Umbraco.Archetype/PropertyConverters/ArchetypeValueConverter.cs
app/Umbraco/Umbraco.Archetype/PropertyConverters/ArchetypeValueConverter.cs
using System; using System.Collections.Generic; using System.Linq; using Archetype.Umbraco.Extensions; using Archetype.Umbraco.Models; using Newtonsoft.Json; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; namespace Archetype.Umbraco.PropertyConverters { [PropertyValueType(typeof(Models.Archetype))] [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] public class ArchetypeValueConverter : PropertyValueConverterBase { public ServiceContext Services { get { return ApplicationContext.Current.Services; } } public override bool IsConverter(PublishedPropertyType propertyType) { return propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditorAlias); } public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) { var defaultValue = new Models.Archetype(); if (source == null) return defaultValue; var sourceString = source.ToString(); if (!sourceString.DetectIsJson()) return defaultValue; var archetype = new ArchetypeHelper().DeserializeJsonToArchetype(source.ToString(), (propertyType != null ? propertyType.DataTypeId : -1)); return archetype; } } }
using System; using System.Collections.Generic; using System.Linq; using Archetype.Umbraco.Extensions; using Archetype.Umbraco.Models; using Newtonsoft.Json; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors; using Umbraco.Core.Services; namespace Archetype.Umbraco.PropertyConverters { [PropertyValueType(typeof(Models.Archetype))] [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] public class ArchetypeValueConverter : PropertyValueConverterBase { public ServiceContext Services { get { return ApplicationContext.Current.Services; } } public override bool IsConverter(PublishedPropertyType propertyType) { return propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditorAlias); } public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) { var defaultValue = new Models.Archetype(); if (source == null) return defaultValue; var sourceString = source.ToString(); if (!sourceString.DetectIsJson()) return defaultValue; var archetype = new ArchetypeHelper().DeserializeJsonToArchetype(source.ToString(), propertyType.DataTypeId); return archetype; } } }
mit
C#
70dca263a7a2df2a0c87dd159cefecc6c5570556
Update CollectionTests.cs
hiddenswitch/Meteor-Unity,hiddenswitch/Meteor-Unity
Tests/CollectionTests.cs
Tests/CollectionTests.cs
#if TESTS using System; using Meteor; using UnityEngine; using Extensions; using System.Collections; using System.Linq; using UnTested; namespace Meteor.Tests { [TestFixture] public class CollectionTests : ConnectionTestDependency { public class TestCollection1Type : MongoDocument { public string field1; public TestCollection1Subtype field2; public TestCollection1Type() {} } public class TestCollection1Subtype { public int field3; public object field4; public TestCollection1Subtype() {} } public CollectionTests () { } // These tests are intended to be run against a test meteor server [Test] public IEnumerator NoSideEffects() { var noSideEffectsCall = Method<string>.Call ("noSideEffects"); yield return (Coroutine)noSideEffectsCall; Assert.AreEqual (noSideEffectsCall.Response, "done"); } [Test] public IEnumerator SubscribeAndGetRecords() { var startSubscribeAndGetRecordsTest = Method.Call ("startSubscribeAndGetRecordsTest"); yield return (Coroutine)startSubscribeAndGetRecordsTest; var collection = Collection<TestCollection1Type>.Create ("testCollection1"); yield return (Coroutine)Subscription.Subscribe ("testCollection1"); foreach (var item in collection) { Debug.Log (item.Serialize ()); if (item.field1 == "string 1") { Assert.AreEqual (item.field2.field3, 3); } else if (item.field1 == "string 2") { Assert.AreEqual (item.field2.field3, 30); } else { Assert.IsTrue (false); } } collection.OnAdded += (string arg1, TestCollection1Type arg2) => { Assert.IsNotNull(arg2.field2); }; collection.OnChanged += (arg1, arg2) => { Assert.AreEqual (arg2.field2.field3, 100); }; var method = Method<string>.Call ("updateRecord"); yield return (Coroutine)method; Assert.IsNotNull (method.Response); yield break; } } } #endif
#if TESTS using System; using Meteor; using UnityEngine; using Extensions; using System.Collections; using System.Linq; using UnTested; namespace Meteor.Tests { [TestFixture] public class CollectionTests : ConnectionTestDependency { public class TestCollection1Type : MongoDocument { public string field1; public TestCollection1Subtype field2; public TestCollection1Type() {} } public class TestCollection1Subtype { public int field3; public object field4; public TestCollection1Subtype() {} } public CollectionTests () { } [Test] public IEnumerator NoSideEffects() { var noSideEffectsCall = Method<string>.Call ("noSideEffects"); yield return (Coroutine)noSideEffectsCall; Assert.AreEqual (noSideEffectsCall.Response, "done"); } [Test] public IEnumerator SubscribeAndGetRecords() { var startSubscribeAndGetRecordsTest = Method.Call ("startSubscribeAndGetRecordsTest"); yield return (Coroutine)startSubscribeAndGetRecordsTest; var collection = Collection<TestCollection1Type>.Create ("testCollection1"); yield return (Coroutine)Subscription.Subscribe ("testCollection1"); foreach (var item in collection) { Debug.Log (item.Serialize ()); if (item.field1 == "string 1") { Assert.AreEqual (item.field2.field3, 3); } else if (item.field1 == "string 2") { Assert.AreEqual (item.field2.field3, 30); } else { Assert.IsTrue (false); } } collection.OnAdded += (string arg1, TestCollection1Type arg2) => { Assert.IsNotNull(arg2.field2); }; collection.OnChanged += (arg1, arg2) => { Assert.AreEqual (arg2.field2.field3, 100); }; var method = Method<string>.Call ("updateRecord"); yield return (Coroutine)method; Assert.IsNotNull (method.Response); yield break; } } } #endif
mit
C#
c2fe34ad50bd44595a1be2eedb48527130612d6b
add new services to mapimage plugin
brnkhy/MapzenGo,brnkhy/MapzenGo
Assets/MapzenGo/Models/Plugins/MapImagePlugin.cs
Assets/MapzenGo/Models/Plugins/MapImagePlugin.cs
using System; using System.Collections.Generic; using MapzenGo.Models.Plugins; using UniRx; using UnityEngine; namespace MapzenGo.Models.Plugins { public class MapImagePlugin : Plugin { public enum TileServices { Default, Satellite, Terrain, Toner, Watercolor } public TileServices TileService = TileServices.Default; private string[] TileServiceUrls = new string[] { "http://b.tile.openstreetmap.org/", "http://b.tile.openstreetmap.us/usgs_large_scale/", "http://tile.stamen.com/terrain-background/", "http://a.tile.stamen.com/toner/", "https://stamen-tiles.a.ssl.fastly.net/watercolor/" }; public override void Create(Tile tile) { base.Create(tile); var go = GameObject.CreatePrimitive(PrimitiveType.Quad).transform; go.name = "map"; go.SetParent(tile.transform, true); go.localScale = new Vector3((float)tile.Rect.Width, (float)tile.Rect.Width, 1); go.rotation = Quaternion.AngleAxis(90, new Vector3(1, 0, 0)); go.localPosition = Vector3.zero; go.localPosition -= new Vector3(0, 1, 0); var rend = go.GetComponent<Renderer>(); rend.material = tile.Material; var url = TileServiceUrls[(int)TileService] + tile.Zoom + "/" + tile.TileTms.x + "/" + tile.TileTms.y + ".png"; ObservableWWW.GetWWW(url).Subscribe( success => { rend.material.mainTexture = new Texture2D(512, 512, TextureFormat.DXT5, false); rend.material.color = new Color(1f, 1f, 1f, 1f); success.LoadImageIntoTexture((Texture2D)rend.material.mainTexture); }, error => { Debug.Log(error); }); } } }
using System; using System.Collections.Generic; using MapzenGo.Models.Plugins; using UniRx; using UnityEngine; namespace MapzenGo.Models.Plugins { public class MapImagePlugin : Plugin { public string MapImageUrlBase = "http://b.tile.openstreetmap.org/"; public override void Create(Tile tile) { base.Create(tile); var go = GameObject.CreatePrimitive(PrimitiveType.Quad).transform; go.name = "map"; go.SetParent(tile.transform, true); go.localScale = new Vector3((float)tile.Rect.Width, (float)tile.Rect.Width, 1); go.rotation = Quaternion.AngleAxis(90, new Vector3(1, 0, 0)); go.localPosition = Vector3.zero; go.localPosition -= new Vector3(0, 1, 0); var rend = go.GetComponent<Renderer>(); rend.material = tile.Material; var url = MapImageUrlBase + tile.Zoom + "/" + tile.TileTms.x + "/" + tile.TileTms.y + ".png"; ObservableWWW.GetWWW(url).Subscribe( success => { rend.material.mainTexture = new Texture2D(512, 512, TextureFormat.DXT5, false); rend.material.color = new Color(1f, 1f, 1f, 1f); success.LoadImageIntoTexture((Texture2D)rend.material.mainTexture); }, error => { Debug.Log(error); }); } } }
mit
C#
49d1859bd10c6cffdc049c460d035db9fe6a241f
Fix build
gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer
Client/Systems/SettingsSys/SettingsStructures.cs
Client/Systems/SettingsSys/SettingsStructures.cs
using LunaClient.Systems.PlayerColorSys; using System; using System.Collections.Generic; using UnityEngine; namespace LunaClient.Systems.SettingsSys { [Serializable] public class SettingStructure { public string Language { get; set; } = "English"; public string PlayerName { get; set; } = "Player"; public int ConnectionTries { get; set; } = 3; public int InitialConnectionMsTimeout { get; set; } = 5000; public int SendReceiveMsInterval { get; set; } = 3; public int MsBetweenConnectionTries { get; set; } = 3000; public int HearbeatMsInterval { get; set; } = 2000; public bool DisclaimerAccepted { get; set; } = false; public Color PlayerColor { get; set; } = PlayerColorSystem.GenerateRandomColor(); public string SelectedFlag { get; set; } = "Squad/Flags/default"; public List<ServerEntry> Servers { get; set; } = new List<ServerEntry>(); public int InitialConnectionSyncTimeRequests { get; set; } = 10; public bool RevertEnabled { get; set; } public int MaxGroupsPerPlayer { get; set; } = 1; public bool OverrideIntegrator { get; set; } public bool PositionInterpolation { get; set; } = true; /* * You can use this debug switches for testing purposes. * For example do one part or the code or another in case the debugX is on/off * NEVER upload the code with those switches in use as some other developer might need them!!!!! */ public bool Debug1 { get; set; } = false; public bool Debug2 { get; set; } = false; public bool Debug3 { get; set; } = false; public bool Debug4 { get; set; } = false; public bool Debug5 { get; set; } = false; public bool Debug6 { get; set; } = false; public bool Debug7 { get; set; } = false; public bool Debug8 { get; set; } = false; public bool Debug9 { get; set; } = false; } [Serializable] public class ServerEntry { public int Port { get; set; } = 8800; public string Name { get; set; } = "Local"; public string Address { get; set; } = "127.0.0.1"; public string Password { get; set; } = string.Empty; } }
using LunaClient.Systems.PlayerColorSys; using System; using System.Collections.Generic; using UnityEngine; namespace LunaClient.Systems.SettingsSys { [Serializable] public class SettingStructure { public string Language { get; set; } = "English"; public string PlayerName { get; set; } = "Player"; public int ConnectionTries { get; set; } = 3; public int InitialConnectionMsTimeout { get; set; } = 5000; public int SendReceiveMsInterval { get; set; } = 3; public int MsBetweenConnectionTries { get; set; } = 3000; public int HearbeatMsInterval { get; set; } = 2000; public bool DisclaimerAccepted { get; set; } = false; public Color PlayerColor { get; set; } = PlayerColorSystem.GenerateRandomColor(); public string SelectedFlag { get; set; } = "Squad/Flags/default"; public List<ServerEntry> Servers { get; set; } = new List<ServerEntry>(); public int InitialConnectionSyncTimeRequests { get; set; } = 10; public bool RevertEnabled { get; set; } public int MaxGroupsPerPlayer { get; set; } = 1; public bool OverrideIntegrator { get; set; } public bool PositionInterpolation { get; set; } = true; #if DEBUG /* * You can use this debug switches for testing purposes. * For example do one part or the code or another in case the debugX is on/off * NEVER upload the code with those switches in use as some other developer might need them!!!!! */ public bool Debug1 { get; set; } = false; public bool Debug2 { get; set; } = false; public bool Debug3 { get; set; } = false; public bool Debug4 { get; set; } = false; public bool Debug5 { get; set; } = false; public bool Debug6 { get; set; } = false; public bool Debug7 { get; set; } = false; public bool Debug8 { get; set; } = false; public bool Debug9 { get; set; } = false; #endif } [Serializable] public class ServerEntry { public int Port { get; set; } = 8800; public string Name { get; set; } = "Local"; public string Address { get; set; } = "127.0.0.1"; public string Password { get; set; } = string.Empty; } }
mit
C#
d2dc79d8ef663356c6d1111ae5707618fc4e59a9
Add DX11Layout and DX11Shader as dx resources
id144/dx11-vvvv,id144/dx11-vvvv,id144/dx11-vvvv
Core/VVVV.DX11.Core/Rendering/Layer/DX11Layer.cs
Core/VVVV.DX11.Core/Rendering/Layer/DX11Layer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SlimDX.Direct3D11; using VVVV.PluginInterfaces.V1; using FeralTic.DX11; using FeralTic.DX11.Resources; namespace VVVV.DX11 { [Obsolete("This does access IPluginIO, which fails in case of multi core access, this will be removed in next release, use RenderTaskDelegate instead")] public delegate void RenderDelegate<T>(IPluginIO pin, DX11RenderContext context, T settings); public delegate void RenderTaskDelegate<T>(IPluginIO pin, DX11RenderContext context, T settings); public class DX11BaseLayer<T> : IDX11Resource { public RenderDelegate<T> Render; public bool PostUpdate { get { return true; } } public void Dispose() { } } /// <summary> /// DX11 Layer provide simple interface to tell which pin they need /// </summary> public class DX11Layer : DX11BaseLayer<DX11RenderSettings> { } public class DX11Shader: IDX11Resource { public DX11ShaderInstance Shader { get; private set; } public DX11Shader(DX11ShaderInstance instance) { this.Shader = instance; } public void Dispose() { //Owned, do nothing } } public class DX11Layout : IDX11Resource { public InputLayout Layout { get; private set; } public DX11Layout(InputLayout layout) { this.Layout = layout; } public void Dispose() { if (this.Layout != null) { this.Layout.Dispose(); this.Layout = null; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SlimDX.Direct3D11; using VVVV.PluginInterfaces.V1; using FeralTic.DX11; using FeralTic.DX11.Resources; namespace VVVV.DX11 { [Obsolete("This does access IPluginIO, which fails in case of multi core access, this will be removed in next release, use RenderTaskDelegate instead")] public delegate void RenderDelegate<T>(IPluginIO pin, DX11RenderContext context, T settings); public delegate void RenderTaskDelegate<T>(IPluginIO pin, DX11RenderContext context, T settings); public class DX11BaseLayer<T> : IDX11Resource { public RenderDelegate<T> Render; public bool PostUpdate { get { return true; } } public void Dispose() { } } /// <summary> /// DX11 Layer provide simple interface to tell which pin they need /// </summary> public class DX11Layer : DX11BaseLayer<DX11RenderSettings> { } }
bsd-3-clause
C#
b75c0236ffd0f865ec61ae0047d38fb1f681c481
extend the DataGridView with UIA.Extensions
modulexcite/RAutomation,jarmo/RAutomation,modulexcite/RAutomation,jarmo/RAutomation,jarmo/RAutomation,jarmo/RAutomation,modulexcite/RAutomation,modulexcite/RAutomation
ext/WindowsForms/WindowsForms/DataGridView.cs
ext/WindowsForms/WindowsForms/DataGridView.cs
using System; using System.Windows.Forms; using FizzWare.NBuilder; using UIA.Extensions; namespace WindowsForms { public partial class DataGridView : Form { public DataGridView() { InitializeComponent(); dataGridView1.AsTable(); } public class Person { // ReSharper disable UnusedMember.Local public String FirstName { get; set; } public String LastName { get; set; } public int Age { get; set; } public String City { get; set; } public String State { get; set; } // ReSharper restore UnusedMember.Local } private void DataGridView_Load(object sender, EventArgs e) { var dataSource = new BindingSource(); foreach (var person in Builder<Person>.CreateListOfSize(50).Build()) { dataSource.Add(person); } dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = dataSource; } private void buttonClose_Click(object sender, EventArgs e) { Close(); } } }
using System; using System.Linq; using System.Windows.Forms; using FizzWare.NBuilder; namespace WindowsForms { public partial class DataGridView : Form { public DataGridView() { InitializeComponent(); } public class Person { // ReSharper disable UnusedMember.Local public String FirstName { get; set; } public String LastName { get; set; } public int Age { get; set; } public String City { get; set; } public String State { get; set; } // ReSharper restore UnusedMember.Local } private void DataGridView_Load(object sender, EventArgs e) { var dataSource = new BindingSource(); foreach (var person in Builder<Person>.CreateListOfSize(50).Build()) { dataSource.Add(person); } dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = dataSource; } private void buttonClose_Click(object sender, EventArgs e) { Close(); } } }
mit
C#
a8fece7f218bffac5010d6d06086979f35de39ef
Fix sync issue
Evorlor/Fitachi,Evorlor/Fitachi,Evorlor/Fitachi
Assets/Scripts/AdventureScripts/AdventuringPlayer.cs
Assets/Scripts/AdventureScripts/AdventuringPlayer.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class AdventuringPlayer : MonoBehaviour { private int AttackDamage; private float attackSpeed; public float weakenPlayerMultiplier = 10.0f; List<Enemy> enemies = new List<Enemy>(); // Use this for initialization IEnumerator Start () { yield return FitbitRestClient.GetProfile(); yield return FitbitRestClient.GetActiviesLifeTimeState(); attackSpeed = float.Parse(FitbitRestClient.Activities.lifetime.total.distance) / 2 / weakenPlayerMultiplier; AttackDamage = (int)(float.Parse(FitbitRestClient.Activities.lifetime.total.distance) / weakenPlayerMultiplier); enemies = new List<Enemy>(); InvokeRepeating("attackEnemies", 0, attackSpeed); Physics.queriesHitTriggers = true; } // Update is called once per frame void Update () { } void OnTriggerEnter2D(Collider2D attackedMonster) { if (attackedMonster.tag=="Monster") { enemies.Add(attackedMonster.GetComponent<Enemy>()); } } void OnTriggerExit2D(Collider2D attackedMonster) { if (attackedMonster.tag == "Monster") { enemies.Remove(attackedMonster.GetComponent<Enemy>()); } } private void attackEnemies() { foreach (Enemy monster in enemies) { monster.TakeDamage(AttackDamage); } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class AdventuringPlayer : MonoBehaviour { private int AttackDamage; private float attackSpeed; public float weakenPlayerMultiplier = 10.0f; List<Enemy> enemies = new List<Enemy>(); void Awake() { attackSpeed = float.Parse(FitbitRestClient.Activities.lifetime.total.distance) / 2 / weakenPlayerMultiplier; AttackDamage = (int)(float.Parse(FitbitRestClient.Activities.lifetime.total.distance) / weakenPlayerMultiplier); } // Use this for initialization void Start () { enemies = new List<Enemy>(); InvokeRepeating("attackEnemies", 0, attackSpeed); Physics.queriesHitTriggers = true; } // Update is called once per frame void Update () { } void OnTriggerEnter2D(Collider2D attackedMonster) { if (attackedMonster.tag=="Monster") { enemies.Add(attackedMonster.GetComponent<Enemy>()); } } void OnTriggerExit2D(Collider2D attackedMonster) { if (attackedMonster.tag == "Monster") { enemies.Remove(attackedMonster.GetComponent<Enemy>()); } } private void attackEnemies() { foreach (Enemy monster in enemies) { monster.TakeDamage(AttackDamage); } } }
mit
C#
e7add19b9b51ffc439758fc481ced1667a55320b
Add sanity checking for AVPlayerLayer
martijn00/XamarinMediaManager,bubavanhalen/XamarinMediaManager,modplug/XamarinMediaManager,mike-rowley/XamarinMediaManager,martijn00/XamarinMediaManager,mike-rowley/XamarinMediaManager
MediaManager/Plugin.MediaManager.iOS/VideoSurface.cs
MediaManager/Plugin.MediaManager.iOS/VideoSurface.cs
using System; using AVFoundation; using CoreGraphics; using Foundation; using Plugin.MediaManager.Abstractions; using UIKit; namespace Plugin.MediaManager.iOS { public class VideoSurface : UIView, IVideoSurface { public override void LayoutSubviews() { base.LayoutSubviews(); if (Layer.Sublayers == null || Layer.Sublayers.Length == 0) return; foreach (var layer in Layer.Sublayers) { var avPlayerLayer = layer as AVPlayerLayer; if (avPlayerLayer != null) avPlayerLayer.Frame = Bounds; } } } }
using AVFoundation; using Plugin.MediaManager.Abstractions; using UIKit; namespace Plugin.MediaManager.iOS { public class VideoSurface : UIView, IVideoSurface { public override void LayoutSubviews() { foreach (var layer in Layer.Sublayers) { var avPlayerLayer = layer as AVPlayerLayer; if (avPlayerLayer != null) avPlayerLayer.Frame = Bounds; } base.LayoutSubviews(); } } }
mit
C#
023318f7ca7dd8b4825f1ed74cb310ca0525d2e4
Increment the app version.
ladimolnar/BitcoinBlockchain
Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs
Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BitcoinBlockchain")] [assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ladislau Molnar")] [assembly: AssemblyProduct("BitcoinBlockchain")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4d8ebb2b-d182-4106-8d15-5fb864de6706")] // 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.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BitcoinBlockchain")] [assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ladislau Molnar")] [assembly: AssemblyProduct("BitcoinBlockchain")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4d8ebb2b-d182-4106-8d15-5fb864de6706")] // 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.1.3.0")] [assembly: AssemblyFileVersion("1.1.3.0")]
apache-2.0
C#
81475e7baee5f7f5314c7e9c34d542835cc9a935
Fix user name detection for some regions
Gl0/CasualMeter,lunyx/CasualMeter
Tera.Core/Game/Messages/Server/LoginServerMessage.cs
Tera.Core/Game/Messages/Server/LoginServerMessage.cs
// Copyright (c) Gothos // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Tera.Game.Messages { public class LoginServerMessage : ParsedMessage { public EntityId Id { get; private set; } public uint PlayerId { get; private set; } public string Name { get; private set; } public string GuildName { get; private set; } public PlayerClass Class { get { return RaceGenderClass.Class; } } public RaceGenderClass RaceGenderClass { get; private set; } internal LoginServerMessage(TeraMessageReader reader) : base(reader) { reader.Skip(10); RaceGenderClass = new RaceGenderClass(reader.ReadInt32()); Id = reader.ReadEntityId(); reader.Skip(4); PlayerId = reader.ReadUInt32(); //reader.Skip(260); //This network message doesn't have a fixed size between different region reader.Skip(220); var nameFirstBit = false; while (true) { var b = reader.ReadByte(); if (b == 0x80) { nameFirstBit = true; continue; } if (b == 0x3F && nameFirstBit) { break; } nameFirstBit = false; } reader.Skip(9); Name = reader.ReadTeraString(); } } }
// Copyright (c) Gothos // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Tera.Game.Messages { public class LoginServerMessage : ParsedMessage { public EntityId Id { get; private set; } public uint PlayerId { get; private set; } public string Name { get; private set; } public string GuildName { get; private set; } public PlayerClass Class { get { return RaceGenderClass.Class; } } public RaceGenderClass RaceGenderClass { get; private set; } internal LoginServerMessage(TeraMessageReader reader) : base(reader) { reader.Skip(10); RaceGenderClass = new RaceGenderClass(reader.ReadInt32()); Id = reader.ReadEntityId(); reader.Skip(4); PlayerId = reader.ReadUInt32(); reader.Skip(260); Name = reader.ReadTeraString(); } } }
mit
C#
9aa219c6f5dbbe3c3a6ff857c3e3613ea7f58b61
test commit
lukaspicha/SimplyCounter
Models/TimeStampModel.cs
Models/TimeStampModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SimplyCounter.Models { /// <summary> /// TimeStampModel, implements ICounter. /// </summary> public class TimeStampModel : ICounter { private int value; private int maxValue; private TimeStampModel nextTimeStamp; /// <summary> /// Create a new TimeStamp with params. /// </summary> /// <param name="initValue">Init (start) value.</param> /// <param name="maxValue">Max value of TimeStamp.</param> /// <param name="nextTimeStamp">Next Timestamp of this TimeStamp.</param> public TimeStampModel(int initValue, int maxValue, TimeStampModel nextTimeStamp) { this.value = initValue; this.maxValue = maxValue; this.nextTimeStamp = nextTimeStamp; } /// <summary> /// Increase a this TimeStamp. /// If value is equal maxValue, this value set to zero and call Increase() of nextTimeStamp. /// </summary> public void Increase() { this.value++; if (this.value == this.maxValue) { this.value = 0; if(this.nextTimeStamp != null) this.nextTimeStamp.Increase(); } } public void Test() { } /// <summary> /// Gets next TimeStamp. /// </summary> public TimeStampModel NextTimeStamp { get { return this.nextTimeStamp; } } /// <summary> /// Gets actual value of Timestamp. /// </summary> public int Value { get { return this.value; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SimplyCounter.Models { /// <summary> /// TimeStampModel, implements ICounter. /// </summary> public class TimeStampModel : ICounter { private int value; private int maxValue; private TimeStampModel nextTimeStamp; /// <summary> /// Create a new TimeStamp with params. /// </summary> /// <param name="initValue">Init (start) value.</param> /// <param name="maxValue">Max value of TimeStamp.</param> /// <param name="nextTimeStamp">Next Timestamp of this TimeStamp.</param> public TimeStampModel(int initValue, int maxValue, TimeStampModel nextTimeStamp) { this.value = initValue; this.maxValue = maxValue; this.nextTimeStamp = nextTimeStamp; } /// <summary> /// Increase a this TimeStamp. /// If value is equal maxValue, this value set to zero and call Increase() of nextTimeStamp. /// </summary> public void Increase() { this.value++; if (this.value == this.maxValue) { this.value = 0; if(this.nextTimeStamp != null) this.nextTimeStamp.Increase(); } } /// <summary> /// Gets next TimeStamp. /// </summary> public TimeStampModel NextTimeStamp { get { return this.nextTimeStamp; } } /// <summary> /// Gets actual value of Timestamp. /// </summary> public int Value { get { return this.value; } } } }
mit
C#
26a4701bf4545d1b4d47349e0737b7f0385f7559
Fix Account Controller unittest
skynode/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,albertodall/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,dotnet-architecture/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,skynode/eShopOnContainers,dotnet-architecture/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers
test/Services/UnitTest/Account/AccountControllerTest.cs
test/Services/UnitTest/Account/AccountControllerTest.cs
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.WebMVC.Controllers; using Moq; using System.Security.Claims; using Xunit; namespace UnitTest.Account { public class AccountControllerTest { private readonly Mock<HttpContext> _httpContextMock; public AccountControllerTest() { _httpContextMock = new Mock<HttpContext>(); } [Fact] public void Signin_with_token_success() { //Arrange var fakeCP = GenerateFakeClaimsIdentity(); var mockAuth = new Mock<AuthenticationManager>(); _httpContextMock.Setup(x => x.User) .Returns(new ClaimsPrincipal(fakeCP)); _httpContextMock.Setup(c => c.Authentication) .Returns(mockAuth.Object); //Act var accountController = new AccountController(); accountController.ControllerContext.HttpContext = _httpContextMock.Object; var actionResult = accountController.SignIn("").Result; //Assert var redirectResult = Assert.IsType<RedirectToActionResult>(actionResult); Assert.Equal(redirectResult.ActionName, "Index"); Assert.Equal(redirectResult.ControllerName, "Catalog"); } private ClaimsIdentity GenerateFakeClaimsIdentity() { var ci = new ClaimsIdentity(); ci.AddClaim(new Claim("access_token", "fakeToken")); return ci; } } }
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.WebMVC.Controllers; using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Moq; using System; using System.Collections.Generic; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Xunit; namespace UnitTest.Account { public class AccountControllerTest { private readonly Mock<HttpContext> _httpContextMock; public AccountControllerTest() { _httpContextMock = new Mock<HttpContext>(); } [Fact] public void Signin_with_token_success() { //Arrange var fakeCP = GenerateFakeClaimsIdentity(); var mockAuth = new Mock<AuthenticationManager>(); _httpContextMock.Setup(x => x.User) .Returns(new ClaimsPrincipal(fakeCP)); _httpContextMock.Setup(c => c.Authentication) .Returns(mockAuth.Object); //Act var accountController = new AccountController(); accountController.ControllerContext.HttpContext = _httpContextMock.Object; var actionResult = accountController.SignIn("").Result; //Assert var redirectResult = Assert.IsType<RedirectToActionResult>(actionResult); Assert.Equal(redirectResult.ActionName, "Index"); Assert.Equal(redirectResult.ControllerName, "Catalog"); } private ClaimsIdentity GenerateFakeClaimsIdentity() { var ci = new ClaimsIdentity(); ci.AddClaim(new Claim("access_token", "fakeToken")); return ci; } } }
mit
C#
ebbbaec2be2c5342b2ca7661491f0b7d4749f071
Update AssemblyInfo
lanayotech/vagrant-manager-windows
Lanayo.VagrantManager/Properties/AssemblyInfo.cs
Lanayo.VagrantManager/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Vagrant Manager")] [assembly: AssemblyDescription("Manage your vagrant machines in one place with Vagrant Manager for Windows")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Lanayo Technologies")] [assembly: AssemblyProduct("Vagrant Manager Windows")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8112b028-3778-4dc7-b5c7-e864b2849c96")] // 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.0.0.7")] [assembly: AssemblyFileVersion("1.0.0.7")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Vagrant Manager")] [assembly: AssemblyDescription("Manage your vagrant machines in one place with Vagrant Manager for Windows")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Lanayo Technologies")] [assembly: AssemblyProduct("Vagrant Manager Windows")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8112b028-3778-4dc7-b5c7-e864b2849c96")] // 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.0.0.6")] [assembly: AssemblyFileVersion("1.0.0.6")]
mit
C#
1f0537422af99bf356e27c11b492897010e757a6
Update AddWorksheetsToExistingExcelFile.cs
asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Worksheets/Management/AddWorksheetsToExistingExcelFile.cs
Examples/CSharp/Worksheets/Management/AddWorksheetsToExistingExcelFile.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Management { public class AddWorksheetsToExistingExcelFile { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Adding a new worksheet to the Workbook object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Setting the name of the newly added worksheet worksheet.Name = "My Worksheet"; //Saving the Excel file workbook.Save(dataDir + "output.out.xls"); //Closing the file stream to free all resources fstream.Close(); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Management { public class AddWorksheetsToExistingExcelFile { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Creating a file stream containing the Excel file to be opened FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open); //Instantiating a Workbook object //Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); //Adding a new worksheet to the Workbook object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Setting the name of the newly added worksheet worksheet.Name = "My Worksheet"; //Saving the Excel file workbook.Save(dataDir + "output.out.xls"); //Closing the file stream to free all resources fstream.Close(); } } }
mit
C#
bcfbfcf97563dee3cbbf556c82fa1b0c6a00d0bd
Test change
michael-reichenauer/GitMind
GitMind/Common/ExceptionHandling.cs
GitMind/Common/ExceptionHandling.cs
using System; using System.Diagnostics; using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; using GitMind.Utils; namespace GitMind.Common { internal static class ExceptionHandling { private static bool hasDisplayedErrorMessageBox; private static bool hasFailed; public static void Init() { // Add the event handler for handling UI thread exceptions to the event Application.Current.DispatcherUnhandledException += (s, e) => HandleException("dispatcher exception", e.Exception); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += (s, e) => HandleException("app domain exception", e.ExceptionObject as Exception); // Log exceptions that hasn't been handled when a Task is finalized. TaskScheduler.UnobservedTaskException += (s, e) => HandleException("unobserved task exception", e.Exception); } private static void HandleException(string errorType, Exception exception) { if (hasFailed) { return; } hasFailed = true; string errorMessage = $"Unhandled {errorType}\n{exception}"; Log.Error(errorMessage); if (Debugger.IsAttached) { // NOTE: If you end up here a task resulted in an unhandled exception Debugger.Break(); } else { Shutdown(errorMessage, exception); } } public static void Shutdown(string errorMessage, Exception e) { var dispatcher = GetApplicationDispatcher(); if (dispatcher.CheckAccess()) { ShowExceptionDialog(errorMessage, e); } else { dispatcher.Invoke(() => ShowExceptionDialog(errorMessage, e)); } if (Debugger.IsAttached) { Debugger.Break(); } Environment.FailFast(errorMessage, e); } private static void ShowExceptionDialog(string errorMessage, Exception e) { if (hasDisplayedErrorMessageBox) { return; } hasDisplayedErrorMessageBox = true; MessageBox.Show( Application.Current.MainWindow, errorMessage, "GitMind - Unhandled Exception", MessageBoxButton.OK, MessageBoxImage.Error); } private static Dispatcher GetApplicationDispatcher() => Application.Current?.Dispatcher ?? Dispatcher.CurrentDispatcher; } }
using System; using System.Diagnostics; using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; using GitMind.Utils; namespace GitMind.Common { internal static class ExceptionHandling { private static bool hasDisplayedErrorMessageBox; private static bool hasFailed; public static void Init() { // Add the event handler for handling UI thread exceptions to the event. Application.Current.DispatcherUnhandledException += (s, e) => HandleException("dispatcher exception", e.Exception); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += (s, e) => HandleException("app domain exception", e.ExceptionObject as Exception); // Log exceptions that hasn't been handled when a Task is finalized. TaskScheduler.UnobservedTaskException += (s, e) => HandleException("unobserved task exception", e.Exception); } private static void HandleException(string errorType, Exception exception) { if (hasFailed) { return; } hasFailed = true; string errorMessage = $"Unhandled {errorType}\n{exception}"; Log.Error(errorMessage); if (Debugger.IsAttached) { // NOTE: If you end up here a task resulted in an unhandled exception Debugger.Break(); } else { Shutdown(errorMessage, exception); } } public static void Shutdown(string errorMessage, Exception e) { var dispatcher = GetApplicationDispatcher(); if (dispatcher.CheckAccess()) { ShowExceptionDialog(errorMessage, e); } else { dispatcher.Invoke(() => ShowExceptionDialog(errorMessage, e)); } if (Debugger.IsAttached) { Debugger.Break(); } Environment.FailFast(errorMessage, e); } private static void ShowExceptionDialog(string errorMessage, Exception e) { if (hasDisplayedErrorMessageBox) { return; } hasDisplayedErrorMessageBox = true; MessageBox.Show( Application.Current.MainWindow, errorMessage, "GitMind - Unhandled Exception", MessageBoxButton.OK, MessageBoxImage.Error); } private static Dispatcher GetApplicationDispatcher() => Application.Current?.Dispatcher ?? Dispatcher.CurrentDispatcher; } }
mit
C#
0503477ef636b39e581a7e325d463c3246183c83
Update AssemblyInfo.cs
304NotModified/NLog.Web,mmaitre314/NLog.Web,NLog/NLog.Web
NLog.Web/Properties/AssemblyInfo.cs
NLog.Web/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("NLog.Web")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NLog")] [assembly: AssemblyProduct("NLog.Web")] [assembly: AssemblyCopyright("Copyright © NLog 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("76508ba5-3321-41a4-90b4-99958822f19b")] // 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.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("NLog.Web")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("NLog.Web")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("76508ba5-3321-41a4-90b4-99958822f19b")] // 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.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
bsd-3-clause
C#
23fdd1af4486ee4c3b403f7cfa5cfeaa96af591c
Update SheetFilterOperator.cs
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
main/Smartsheet/Api/Models/SheetFilterOperator.cs
main/Smartsheet/Api/Models/SheetFilterOperator.cs
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2018 SmartsheetClient // %% // 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. // %[license] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Smartsheet.Api.Models { /// <summary> /// How to combine sheet filter criteria /// </summary> public enum SheetFilterOperator { AND, OR } }
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2018 SmartsheetClient // %% // 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. // %[license] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Smartsheet.Api.Models { /// <summary> /// How to combine sheet filter criteria /// </summary> public enum SheetFilterOperator { AND, OR } }
apache-2.0
C#
4d94053c5a60654fb19b4c7a66278445223934e1
Update LoadDocumentFromUrl.cs
groupdocsconversion/GroupDocs_Conversion_NET,groupdocsconversion/GroupDocs_Conversion_NET
Examples/GroupDocs.Conversion.Examples.CSharp/AdvancedUsage/Loading/LoadingDocumentsFromDifferentSources/LoadDocumentFromUrl.cs
Examples/GroupDocs.Conversion.Examples.CSharp/AdvancedUsage/Loading/LoadingDocumentsFromDifferentSources/LoadDocumentFromUrl.cs
using System; using System.IO; using System.Net; using GroupDocs.Conversion.Options.Convert; namespace GroupDocs.Conversion.Examples.CSharp.AdvancedUsage { /// <summary> /// This example demonstrates how to download and convert document. /// </summary> class LoadDocumentFromUrl { public static void Run() { string url = "https://github.com/groupdocs-conversion/GroupDocs.Conversion-for-.NET/blob/master/Examples/GroupDocs.Conversion.Examples.CSharp/Resources/SampleFiles/sample.docx?raw=true"; string outputDirectory = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputDirectory, "converted.pdf"); using (Converter converter = new Converter(() => GetRemoteFile(url))) { PdfConvertOptions options = new PdfConvertOptions(); converter.Convert(outputFile, options); } Console.WriteLine($"\nSource document converted successfully.\nCheck output in {outputDirectory}."); } private static Stream GetRemoteFile(string url) { WebRequest request = WebRequest.Create(url); using (WebResponse response = request.GetResponse()) return GetFileStream(response); } private static Stream GetFileStream(WebResponse response) { MemoryStream fileStream = new MemoryStream(); using (Stream responseStream = response.GetResponseStream()) responseStream.CopyTo(fileStream); fileStream.Position = 0; return fileStream; } } }
using System; using System.IO; using System.Net; using GroupDocs.Conversion.Options.Convert; namespace GroupDocs.Conversion.Examples.CSharp.AdvancedUsage { /// <summary> /// This example demonstrates how to download and convert document. /// </summary> class LoadDocumentFromUrl { public static void Run() { string url = "https://github.com/groupdocs-conversion/GroupDocs.Conversion-for-.NET/blob/master/Examples/Resources/SampleFiles/sample.docx?raw=true"; string outputDirectory = Constants.GetOutputDirectoryPath(); string outputFile = Path.Combine(outputDirectory, "converted.pdf"); using (Converter converter = new Converter(() => GetRemoteFile(url))) { PdfConvertOptions options = new PdfConvertOptions(); converter.Convert(outputFile, options); } Console.WriteLine($"\nSource document converted successfully.\nCheck output in {outputDirectory}."); } private static Stream GetRemoteFile(string url) { WebRequest request = WebRequest.Create(url); using (WebResponse response = request.GetResponse()) return GetFileStream(response); } private static Stream GetFileStream(WebResponse response) { MemoryStream fileStream = new MemoryStream(); using (Stream responseStream = response.GetResponseStream()) responseStream.CopyTo(fileStream); fileStream.Position = 0; return fileStream; } } }
mit
C#
fd21e87670ebde3018e43a550aff6ef9b30383f9
Disable adjusting volume via "select next" and "select previous" as fallbacks
UselessToucan/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,peppy/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu
osu.Game/Overlays/Volume/VolumeControlReceptor.cs
osu.Game/Overlays/Volume/VolumeControlReceptor.cs
// 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.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; namespace osu.Game.Overlays.Volume { public class VolumeControlReceptor : Container, IScrollBindingHandler<GlobalAction>, IHandleGlobalKeyboardInput { public Func<GlobalAction, bool> ActionRequested; public Func<GlobalAction, float, bool, bool> ScrollActionRequested; public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false; public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false; public void OnReleased(GlobalAction action) { } } }
// 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.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; namespace osu.Game.Overlays.Volume { public class VolumeControlReceptor : Container, IScrollBindingHandler<GlobalAction>, IHandleGlobalKeyboardInput { public Func<GlobalAction, bool> ActionRequested; public Func<GlobalAction, float, bool, bool> ScrollActionRequested; public bool OnPressed(GlobalAction action) { // if nothing else handles selection actions in the game, it's safe to let volume be adjusted. switch (action) { case GlobalAction.SelectPrevious: action = GlobalAction.IncreaseVolume; break; case GlobalAction.SelectNext: action = GlobalAction.DecreaseVolume; break; } return ActionRequested?.Invoke(action) ?? false; } public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false; public void OnReleased(GlobalAction action) { } } }
mit
C#
24d0b84a7227601a74e3e775c981bbc345ea54a0
Update LoggingSetupBase.cs
tiksn/TIKSN-Framework
TIKSN.Core/Analytics/Logging/LoggingSetupBase.cs
TIKSN.Core/Analytics/Logging/LoggingSetupBase.cs
using Microsoft.Extensions.Logging; namespace TIKSN.Analytics.Logging { public abstract class LoggingSetupBase : ILoggingSetup { public virtual void Setup(ILoggingBuilder loggingBuilder) => loggingBuilder.AddDebug(); } }
using Microsoft.Extensions.Logging; namespace TIKSN.Analytics.Logging { public abstract class LoggingSetupBase : ILoggingSetup { public virtual void Setup(ILoggingBuilder loggingBuilder) { loggingBuilder.AddDebug(); } } }
mit
C#
f3c967ef20e658b40c8a5217ed89f4f7a5de9de0
Add method to extract rotation part of matrix
Weingartner/SolidworksAddinFramework
SolidworksAddinFramework/Geometry/Matrix4x4Extensions.cs
SolidworksAddinFramework/Geometry/Matrix4x4Extensions.cs
using System.DoubleNumerics; using System.Text; namespace SolidworksAddinFramework.Geometry { public static class Matrix4x4Extensions { public static Matrix4x4 CreateFromAxisAngleOrigin(PointDirection3 p, double angle) { return Matrix4x4.CreateTranslation(-p.Point) *Matrix4x4.CreateFromAxisAngle(p.Direction.Unit(), angle) *Matrix4x4.CreateTranslation(p.Point); } public static Matrix4x4 CreateFromEdgeAngleOrigin(Edge3 p, double angle) { return CreateFromAxisAngleOrigin(new PointDirection3(p.A,p.Delta),angle); } public static Matrix4x4 ExtractRotationPart(this Matrix4x4 m) { Vector3 dScale; Quaternion dRotation; Vector3 dTranslation; Matrix4x4.Decompose(m, out dScale, out dRotation, out dTranslation); return Matrix4x4.CreateFromQuaternion(dRotation); } } }
using System.DoubleNumerics; namespace SolidworksAddinFramework.Geometry { public static class Matrix4x4Extensions { public static Matrix4x4 CreateFromAxisAngleOrigin(PointDirection3 p, double angle) { return Matrix4x4.CreateTranslation(-p.Point) *Matrix4x4.CreateFromAxisAngle(p.Direction.Unit(), angle) *Matrix4x4.CreateTranslation(p.Point); } public static Matrix4x4 CreateFromEdgeAngleOrigin(Edge3 p, double angle) { return CreateFromAxisAngleOrigin(new PointDirection3(p.A,p.Delta),angle); } } }
mit
C#
8c622e6333b2d4454fc277b6b48f65a9ddc297cf
Change image folder
frozenskys/appy-christmas,frozenskys/appy-christmas
src/ProductApi/Startup.cs
src/ProductApi/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging; using System.IO; namespace ProductApi { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) { builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSwaggerGen(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\images")), RequestPath = new PathString("/images") }); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUi(); } } }
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Logging; using System.IO; namespace ProductApi { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) { builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSwaggerGen(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), @"src\ProductApi\wwwroot\images")), RequestPath = new PathString("/images") }); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUi(); } } }
mit
C#
37b5ea38c33427f58936c0d0723b2052171d0f48
Update RavenUnitOfWorkFactoryOptions.cs
tiksn/TIKSN-Framework
TIKSN.Core/Data/RavenDB/RavenUnitOfWorkFactoryOptions.cs
TIKSN.Core/Data/RavenDB/RavenUnitOfWorkFactoryOptions.cs
namespace TIKSN.Data.RavenDB { public class RavenUnitOfWorkFactoryOptions<TUnitOfWork> where TUnitOfWork : IUnitOfWork { public string[] Urls { get; set; } public string Database { get; set; } } }
namespace TIKSN.Data.RavenDB { public class RavenUnitOfWorkFactoryOptions<TUnitOfWork> where TUnitOfWork : IUnitOfWork { public string[] Urls { get; set; } public string Database { get; set; } } }
mit
C#
c3002c17396bc85454ec0c36c0dcb6c59042c0ac
Remove debug statement
wwarby/TraktSharp
TraktSharp.Examples.Wpf/ViewModels/AuthorizeViewModel.cs
TraktSharp.Examples.Wpf/ViewModels/AuthorizeViewModel.cs
using System; using TraktSharp.Examples.Wpf.Interfaces; namespace TraktSharp.Examples.Wpf.ViewModels { internal class AuthorizeViewModel : ViewModelBase, ICloseable { private string _address; public bool Completed { get; private set; } public event EventHandler<System.EventArgs> RequestClose; internal AuthorizeViewModel(TraktClient traktClient) { Client = traktClient; Address = Client.Authentication.OAuthAuthorizationUri.AbsoluteUri; } internal TraktClient Client { get; } public string Address { get => _address; set { _address = value; if (_address.StartsWith(Client.Authentication.OAuthRedirectUri, StringComparison.CurrentCultureIgnoreCase)) { HandleCallback(value); } NotifyPropertyChanged(); } } private void HandleCallback(string address) { Client.Authentication.ParseOAuthAuthorizationResponse(address); Completed = true; var handler = RequestClose; handler?.Invoke(this, new System.EventArgs()); } } }
using System; using System.Diagnostics; using TraktSharp.Examples.Wpf.Interfaces; namespace TraktSharp.Examples.Wpf.ViewModels { internal class AuthorizeViewModel : ViewModelBase, ICloseable { private string _address; public bool Completed { get; private set; } public event EventHandler<System.EventArgs> RequestClose; internal AuthorizeViewModel(TraktClient traktClient) { Client = traktClient; Address = Client.Authentication.OAuthAuthorizationUri.AbsoluteUri; } internal TraktClient Client { get; } public string Address { get => _address; set { Debug.WriteLine(value); _address = value; if (_address.StartsWith(Client.Authentication.OAuthRedirectUri, StringComparison.CurrentCultureIgnoreCase)) { HandleCallback(value); } NotifyPropertyChanged(); } } private void HandleCallback(string address) { Client.Authentication.ParseOAuthAuthorizationResponse(address); Completed = true; var handler = RequestClose; handler?.Invoke(this, new System.EventArgs()); } } }
mit
C#
5c4e0297d31ed0bd2c676b64325dbd8dc69306e7
Implement new item
SnowflakePowered/snowflake,RonnChyran/snowflake,faint32/snowflake-1,RonnChyran/snowflake,faint32/snowflake-1,faint32/snowflake-1,RonnChyran/snowflake,SnowflakePowered/snowflake,SnowflakePowered/snowflake
Snowflake.Tests/Fakes/FakeGameInfo.cs
Snowflake.Tests/Fakes/FakeGameInfo.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Game; namespace Snowflake.Tests.Fakes { internal class FakeGameInfo : IGameInfo { public string CRC32 { get { throw new NotImplementedException(); } } public string FileName { get { throw new NotImplementedException(); } } public string UUID { get { throw new NotImplementedException(); } } public string PlatformID { get { throw new NotImplementedException(); } } public string Name { get { throw new NotImplementedException(); } } public IDictionary<string, string> Metadata { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public Information.MediaStore.IMediaStore MediaStore { get { throw new NotImplementedException(); } } public string MediaStoreKey { get { throw new NotImplementedException(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Snowflake.Game; namespace Snowflake.Tests.Fakes { internal class FakeGameInfo : IGameInfo { public string CRC32 { get { throw new NotImplementedException(); } } public string FileName { get { throw new NotImplementedException(); } } public string UUID { get { throw new NotImplementedException(); } } public string PlatformID { get { throw new NotImplementedException(); } } public string Name { get { throw new NotImplementedException(); } } public IDictionary<string, string> Metadata { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public Information.MediaStore.IMediaStore MediaStore { get { throw new NotImplementedException(); } } } }
mpl-2.0
C#
8e26e83f0adb67a937598e94a82ce2ee40fca709
Add PDB stream index checks.
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
src/AsmResolver.Symbols.Pdb/SerializedPdbImage.cs
src/AsmResolver.Symbols.Pdb/SerializedPdbImage.cs
using System; using System.Collections.Generic; using AsmResolver.Symbols.Pdb.Metadata.Dbi; using AsmResolver.Symbols.Pdb.Metadata.Info; using AsmResolver.Symbols.Pdb.Msf; using AsmResolver.Symbols.Pdb.Records; namespace AsmResolver.Symbols.Pdb; /// <summary> /// Provides an implementation for a PDB image that is read from an input MSF file. /// </summary> public class SerializedPdbImage : PdbImage { private readonly MsfFile _file; /// <summary> /// Interprets a PDB image from the provided MSF file. /// </summary> /// <param name="file">The MSF file to read from.</param> public SerializedPdbImage(MsfFile file) { _file = file; if (InfoStream.StreamIndex >= file.Streams.Count) throw new BadImageFormatException("MSF file does not contain a PDB Info stream."); if (InfoStream.StreamIndex >= file.Streams.Count) throw new BadImageFormatException("MSF file does not contain a PDB Info stream."); InfoStream = InfoStream.FromReader(file.Streams[InfoStream.StreamIndex].CreateReader()); DbiStream = DbiStream.FromReader(file.Streams[DbiStream.StreamIndex].CreateReader()); } internal InfoStream InfoStream { get; } internal DbiStream DbiStream { get; } /// <inheritdoc /> protected override IList<SymbolRecord> GetSymbols() { var result = new List<SymbolRecord>(); int index = DbiStream.SymbolRecordStreamIndex; if (index >= _file.Streams.Count) return result; var reader = _file.Streams[DbiStream.SymbolRecordStreamIndex].CreateReader(); while (reader.CanRead(sizeof(ushort) * 2)) { result.Add(SymbolRecord.FromReader(ref reader)); } return result; } }
using System.Collections.Generic; using AsmResolver.Symbols.Pdb.Metadata.Dbi; using AsmResolver.Symbols.Pdb.Metadata.Info; using AsmResolver.Symbols.Pdb.Msf; using AsmResolver.Symbols.Pdb.Records; namespace AsmResolver.Symbols.Pdb; /// <summary> /// Provides an implementation for a PDB image that is read from an input MSF file. /// </summary> public class SerializedPdbImage : PdbImage { private readonly MsfFile _file; /// <summary> /// Interprets a PDB image from the provided MSF file. /// </summary> /// <param name="file">The MSF file to read from.</param> public SerializedPdbImage(MsfFile file) { _file = file; InfoStream = InfoStream.FromReader(file.Streams[InfoStream.StreamIndex].CreateReader()); DbiStream = DbiStream.FromReader(file.Streams[DbiStream.StreamIndex].CreateReader()); } internal InfoStream InfoStream { get; } internal DbiStream DbiStream { get; } /// <inheritdoc /> protected override IList<SymbolRecord> GetSymbols() { var result = new List<SymbolRecord>(); int index = DbiStream.SymbolRecordStreamIndex; if (index >= _file.Streams.Count) return result; var reader = _file.Streams[DbiStream.SymbolRecordStreamIndex].CreateReader(); while (reader.CanRead(sizeof(ushort) * 2)) { result.Add(SymbolRecord.FromReader(ref reader)); } return result; } }
mit
C#
93b74f21c13b61712b497adec8ed7ac0367a93aa
Make Type[].Description null reference safe
pardeike/Harmony
Harmony/Tools/Extensions.cs
Harmony/Tools/Extensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace Harmony { public static class GeneralExtensions { public static string Description(this Type[] parameters) { if (parameters == null) return "NULL"; var types = parameters.Select(p => p == null ? "null" : p.FullName); return "(" + types.Aggregate("", (s, x) => s == null ? x : s.Length == 0 ? x : (s != "" ? s + ", " : "") + x) + ")"; } public static string FullDescription(this MethodBase method) { return method.DeclaringType.FullName + "." + method.Name + method.GetParameters().Select(p => p.ParameterType).ToArray().Description(); } public static Type[] Types(this ParameterInfo[] pinfo) { return pinfo.Select(pi => pi.ParameterType).ToArray(); } public static T GetValueSafe<S, T>(this Dictionary<S, T> dictionary, S key) { T result; if (dictionary.TryGetValue(key, out result)) return result; return default(T); } public static T GetTypedValue<T>(this Dictionary<string, object> dictionary, string key) { object result; if (dictionary.TryGetValue(key, out result)) if (result is T) return (T)result; return default(T); } } public static class CollectionExtensions { public static void Do<T>(this IEnumerable<T> sequence, Action<T> action) { if (sequence == null) return; var enumerator = sequence.GetEnumerator(); while (enumerator.MoveNext()) action(enumerator.Current); } public static void DoIf<T>(this IEnumerable<T> sequence, Func<T, bool> condition, Action<T> action) { sequence.Where(condition).Do(action); } public static IEnumerable<T> Add<T>(this IEnumerable<T> sequence, T item) { return (sequence ?? Enumerable.Empty<T>()).Concat(new[] { item }); } public static T[] AddRangeToArray<T>(this T[] sequence, T[] items) { return (sequence ?? Enumerable.Empty<T>()).Concat(items).ToArray(); } public static T[] AddToArray<T>(this T[] sequence, T item) { return Add(sequence, item).ToArray(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace Harmony { public static class GeneralExtensions { public static string Description(this Type[] parameters) { var types = parameters.Select(p => p == null ? "null" : p.FullName); return "(" + types.Aggregate("", (s, x) => s == null ? x : s.Length == 0 ? x : (s != "" ? s + ", " : "") + x) + ")"; } public static string FullDescription(this MethodBase method) { return method.DeclaringType.FullName + "." + method.Name + method.GetParameters().Select(p => p.ParameterType).ToArray().Description(); } public static Type[] Types(this ParameterInfo[] pinfo) { return pinfo.Select(pi => pi.ParameterType).ToArray(); } public static T GetValueSafe<S, T>(this Dictionary<S, T> dictionary, S key) { T result; if (dictionary.TryGetValue(key, out result)) return result; return default(T); } public static T GetTypedValue<T>(this Dictionary<string, object> dictionary, string key) { object result; if (dictionary.TryGetValue(key, out result)) if (result is T) return (T)result; return default(T); } } public static class CollectionExtensions { public static void Do<T>(this IEnumerable<T> sequence, Action<T> action) { if (sequence == null) return; var enumerator = sequence.GetEnumerator(); while (enumerator.MoveNext()) action(enumerator.Current); } public static void DoIf<T>(this IEnumerable<T> sequence, Func<T, bool> condition, Action<T> action) { sequence.Where(condition).Do(action); } public static IEnumerable<T> Add<T>(this IEnumerable<T> sequence, T item) { return (sequence ?? Enumerable.Empty<T>()).Concat(new[] { item }); } public static T[] AddRangeToArray<T>(this T[] sequence, T[] items) { return (sequence ?? Enumerable.Empty<T>()).Concat(items).ToArray(); } public static T[] AddToArray<T>(this T[] sequence, T item) { return Add(sequence, item).ToArray(); } } }
mit
C#
0c6a0a2ea36c3b9944b4d640f68334793fadb4b3
Update MediaContent
messagebird/csharp-rest-api
MessageBird/Objects/Conversations/MediaContent.cs
MessageBird/Objects/Conversations/MediaContent.cs
using Newtonsoft.Json; namespace MessageBird.Objects.Conversations { public class MediaContent { [JsonProperty("url")] public string Url { get; set; } [JsonProperty("caption")] public string Caption { get; set; } } }
using Newtonsoft.Json; namespace MessageBird.Objects.Conversations { public class MediaContent { [JsonProperty("url")] public string Url { get; set; } } }
isc
C#
8df30b843610c91d619c6bd738b398fcfeb87072
Update Clan
FICTURE7/CoCSharp,FICTURE7/CoCSharp,FICTURE7/CoCSharp
CoCSharp/Logic/Clan.cs
CoCSharp/Logic/Clan.cs
namespace CoCSharp.Logic { /// <summary> /// Represents a Clash of Clans clan (Alliance). /// </summary> public class Clan { /// <summary> /// Initializes a new instance of the <see cref="Clan"/>. /// </summary> public Clan() { // Space } /// <summary> /// Gets or sets the ID of the <see cref="Clan"/>. /// </summary> public long ID { get; set; } /// <summary> /// Gets or sets the name of the <see cref="Clan"/>. /// </summary> public string Name { get; set; } /// <summary> /// Gets or sets the level of the <see cref="Clan"/>. /// </summary> public int Level { get; set; } /// <summary> /// Gets or sets the badge of the <see cref="Clan"/>. /// </summary> public int Badge { get; set; } /// <summary> /// Get or sets the role of the avatar. /// </summary> public int Role { get; set; } /// <summary> ///Invite type of the clan /// </summary> public int InviteType { get; set; } /// <summary> /// Member count of the clan. /// </summary> public int MemberCount { get; set; } /// <summary> /// Total number of trophies. /// </summary> public int TotalTrophies { get; set; } /// <summary> /// Required number of trophies to join. /// </summary> public int RequiredTrophies { get; set; } /// <summary> /// Total number of wars won. /// </summary> public int WarsWon { get; set; } /// <summary> /// Total number of wars lost. /// </summary> public int WarsLost { get; set; } /// <summary> /// Total number of wars tried. /// </summary> public int WarsTried { get; set; } /// <summary> /// Language of the clan. /// </summary> public int Language { get; set; } /// <summary> /// War frequency of the clan. /// </summary> public int WarFrequency { get; set; } /// <summary> /// Location of the clan. /// </summary> public int Location { get; set; } /// <summary> /// PerkPoints of the clan /// </summary> public int PerkPoints { get; set; } /// <summary> /// Clan wars win streak /// </summary> public int WinStreak { get; set; } /// <summary> /// Is public or not /// </summary> public bool WarLogsPublic { get; set; } } }
namespace CoCSharp.Logic { /// <summary> /// Represents a Clash of Clans clan (Alliance). /// </summary> public class Clan { /// <summary> /// Initializes a new instance of the <see cref="Clan"/>. /// </summary> public Clan() { // Space } /// <summary> /// Gets or sets the ID of the <see cref="Clan"/>. /// </summary> public long ID { get; set; } /// <summary> /// Gets or sets the name of the <see cref="Clan"/>. /// </summary> public string Name { get; set; } /// <summary> /// Gets or sets the level of the <see cref="Clan"/>. /// </summary> public int Level { get; set; } /// <summary> /// Gets or sets the badge of the <see cref="Clan"/>. /// </summary> public int Badge { get; set; } /// <summary> /// Get or sets the role of the avatar. /// </summary> public int Role { get; set; } } }
mit
C#
d97257b82f93e2b00cd8853affc3c385bfab38f2
reset stream position
Bushtree/documentz-backend
Documentz/Controllers/AttachmentsController.cs
Documentz/Controllers/AttachmentsController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using System.IO; using Documentz.Repositories; using Documentz.Models; using Documentz.Services; namespace Documentz.Controllers { [Route("api/[controller]")] public class AttachmentsController : Controller { private readonly IStoredItemService storedItemService; public AttachmentsController(IStoredItemService service) => storedItemService = service; // GET: api/values [HttpGet] public async Task<IEnumerable<dynamic>> GetAsync(string id) { return await storedItemService.GetAttachmentsAsync(id); } // GET api/values/5 // [HttpGet("{id}")] // public async Task<JsonResult> Get(string id) // { // var res = await DocumentDbRepository<StoredItem>.GetAttachment(id); // var memory = new MemoryStream(); // await res.CopyToAsync(memory); // var reader = new StreamReader(memory); // return Json(await reader.ReadToEndAsync()); // } // POST api/values [HttpPost] public async Task<IActionResult> PostAsync([FromForm] string documentId, [FromForm] IEnumerable<IFormFile> files) { var list = files.ToList(); if (!list.Any()) { return BadRequest("Empty file list"); } foreach(var file in list) { var memory = new MemoryStream(); await file.CopyToAsync(memory); memory.Seek(0, SeekOrigin.Begin); // await DocumentDbRepository<StoredItem>.AddAttachment(documentId, memory); await storedItemService.AddAttachmentAsync(documentId, memory); } return Ok(); } // PUT api/values/5 [HttpPut("{id}")] public void Put(int id, [FromBody]string value) { } // DELETE api/values/5 [HttpDelete("{id}")] public void Delete(int id) { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using System.IO; using Documentz.Repositories; using Documentz.Models; using Documentz.Services; namespace Documentz.Controllers { [Route("api/[controller]")] public class AttachmentsController : Controller { private readonly IStoredItemService storedItemService; public AttachmentsController(IStoredItemService service) => storedItemService = service; // GET: api/values [HttpGet("{id}")] public async Task<IEnumerable<dynamic>> GetAsync(string id) { return await storedItemService.GetAttachmentsAsync(id); } // GET api/values/5 // [HttpGet("{id}")] // public async Task<JsonResult> Get(string id) // { // var res = await DocumentDbRepository<StoredItem>.GetAttachment(id); // var memory = new MemoryStream(); // await res.CopyToAsync(memory); // var reader = new StreamReader(memory); // return Json(await reader.ReadToEndAsync()); // } // POST api/values [HttpPost] public async Task<IActionResult> PostAsync([FromForm]string documentId, [FromForm] IEnumerable<IFormFile> files) { var list = files.ToList(); if (!list.Any()) { return BadRequest("Empty file list"); } var path = Path.GetTempFileName(); foreach(var file in list) { var memory = new MemoryStream(); await file.CopyToAsync(memory); // await DocumentDbRepository<StoredItem>.AddAttachment(documentId, memory); await storedItemService.AddAttachmentAsync(documentId, memory); } return Ok(); } // PUT api/values/5 [HttpPut("{id}")] public void Put(int id, [FromBody]string value) { } // DELETE api/values/5 [HttpDelete("{id}")] public void Delete(int id) { } } }
mit
C#
373fe46e6c804223ccc1a3fdc80aabea849e2009
Update EvenFibonacciNumbers.cs
DuckBoss/Programming-Challenges,DuckBoss/Programming-Challenges,DuckBoss/Programming-Challenges,DuckBoss/Programming-Challenges
Even_Fibonacci_Numbers/EvenFibonacciNumbers.cs
Even_Fibonacci_Numbers/EvenFibonacciNumbers.cs
using System; namespace EvenFibonacciNumbers { class MainClass { public static void Main(string[] args) { if (args.Length != 3) { Console.WriteLine("This program requires 2 starting integers, and the max terms to count!\n"); Environment.Exit(0); } int start1 = Convert.ToInt32(args[0]); int start2 = Convert.ToInt32(args[1]); int maxCount = Convert.ToInt32(args[2]); if (maxCount < 2) maxCount = 2; int[] fullList = new int[maxCount]; fullList[0] = start1; fullList[1] = start2; for (int i = 2; i < maxCount; i++) fullList[i] = fullList[i - 1] + fullList[i-2]; Console.Write("Result - {"); for (int i = 0; i < fullList.Length; i++) if (fullList[i] % 2 == 0) Console.Write($" {fullList[i]}"); Console.Write(" }"); Console.WriteLine(); Console.ReadKey(); } } }
using System; namespace EvenFibonacciNumbers { class MainClass { public static void Main(string[] args) { if (args.Length != 3) { Console.WriteLine("This program requires 2 starting integers, and the max terms to count!\n"); Environment.Exit(0); } int start1 = Convert.ToInt32(args[0]); int start2 = Convert.ToInt32(args[1]); int maxCount = Convert.ToInt32(args[2]); if (maxCount < 2) maxCount = 2; int[] fullList = new int[maxCount]; fullList[0] = start1; fullList[1] = start2; for (int i = 2; i < maxCount; i++) fullList[i] = fullList[i - 1] + fullList[i-2]; Console.Write("Result - {"); for (int i = 0; i < fullList.Length; i++) { if (fullList[i] % 2 == 0) { Console.Write($" {fullList[i]}"); } } Console.Write(" }"); Console.WriteLine(); Console.ReadKey(); } } }
unlicense
C#