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
2833d15dd90ce91e16803695629b3866f609d0c4
Fix Bug
linezero/NETCoreBBS,linezero/NETCoreBBS
src/NetCoreBBS/Views/Shared/_PagerPartial.cshtml
src/NetCoreBBS/Views/Shared/_PagerPartial.cshtml
@{ var pageindex = Convert.ToInt32(ViewBag.PageIndex); var pagecount = Convert.ToInt32(ViewBag.PageCount); pagecount = pagecount == 0 ? 1 : pagecount; pageindex = pageindex > pagecount ? pagecount : pageindex; var path = Context.Request.Path.Value; var query = string.Empty; var querys = Context.Request.Query; foreach (var item in querys) { if (!item.Key.Equals("page")) { query += $"{item.Key}={item.Value}&"; } } query = query == string.Empty ? "?" : "?" + query; path += query; var pagestart = pageindex - 2 > 0 ? pageindex - 2 : 1; var pageend = pagestart + 5 >= pagecount ? pagecount : pagestart + 5; } <ul class="pagination"> <li class="prev previous_page @(pageindex == 1 ? "disabled" : "")"> <a href="@(pageindex==1?"#":$"{path}page={pageindex - 1}")">&#8592; 上一页</a> </li> <li @(pageindex == 1 ? "class=active" : "")><a rel="start" href="@(path)page=1">1</a></li> @if (pagestart > 2) { <li class="disabled"><a href="#">&hellip;</a></li> } @for (int i = pagestart; i < pageend; i++) { if (i > 1) { <li @(pageindex == i ? "class=active" : "")><a rel="next" href="@(path)page=@i">@i</a></li> } } @if (pageend < pagecount) { <li class="disabled"><a href="#">&hellip;</a></li> } @if (pagecount > 1) { <li @(pageindex == pagecount ? "class=active" : "")><a rel="end" href="@(path)page=@pagecount">@pagecount</a></li> } <li class="next next_page @(pageindex==pagecount?"disabled":"")"> <a rel="next" href="@(pageindex==pagecount?"#":$"{path}page={pageindex + 1}")">下一页 &#8594;</a> </li> </ul>
@{ var pageindex = Convert.ToInt32(ViewBag.PageIndex); var pagecount = Convert.ToInt32(ViewBag.PageCount); var path = Context.Request.Path.Value; var query = string.Empty; var querys = Context.Request.Query; foreach (var item in querys) { if (!item.Key.Equals("page")) { query += $"{item.Key}={item.Value}&"; } } query = query == string.Empty ? "?" : "?" + query; path += query; var pagestart = pageindex - 2 > 0 ? pageindex - 2 : 1; var pageend = pagestart + 5 >= pagecount ? pagecount : pagestart + 5; } <ul class="pagination"> <li class="prev previous_page @(pageindex == 1 ? "disabled" : "")"> <a href="@(pageindex==1?"#":$"{path}page={pageindex - 1}")">&#8592; 上一页</a> </li> <li @(pageindex == 1 ? "class=active" : "")><a rel="start" href="@(path)page=1">1</a></li> @if (pagestart > 2) { <li class="disabled"><a href="#">&hellip;</a></li> } @for (int i = pagestart; i < pageend; i++) { if (i > 1) { <li @(pageindex == i ? "class=active" : "")><a rel="next" href="@(path)page=@i">@i</a></li> } } @if (pageend < pagecount) { <li class="disabled"><a href="#">&hellip;</a></li> } @if (pagecount > 1) { <li @(pageindex == pagecount ? "class=active" : "")><a rel="end" href="@(path)page=@pagecount">@pagecount</a></li> } <li class="next next_page @(pageindex==pagecount?"disabled":"")"> <a rel="next" href="@(pageindex==pagecount?"#":$"{path}page={pageindex + 1}")">下一页 &#8594;</a> </li> </ul>
mit
C#
2ec0bdb25de7b05d81bae063c10d3be004b3f722
Bump version to beta2
kevinkuszyk/FluentAssertions.Ioc.Ninject,kevinkuszyk/FluentAssertions.Ioc.Ninject
src/FluentAssertions.Ioc.Ninject/Properties/AssemblyInfo.cs
src/FluentAssertions.Ioc.Ninject/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("FluentAssertions.Ioc.Ninject")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Kevin Kuszyk")] [assembly: AssemblyProduct("FluentAssertions.Ioc.Ninject")] [assembly: AssemblyCopyright("Copyright © Kevin Kuszyk 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("eb2c95ef-fc68-4d39-9c44-483e9a476c2a")] // 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")] [assembly: AssemblyInformationalVersion("1.0.0-beta2")]
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("FluentAssertions.Ioc.Ninject")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Kevin Kuszyk")] [assembly: AssemblyProduct("FluentAssertions.Ioc.Ninject")] [assembly: AssemblyCopyright("Copyright © Kevin Kuszyk 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("eb2c95ef-fc68-4d39-9c44-483e9a476c2a")] // 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")] [assembly: AssemblyInformationalVersion("1.0.0-beta1")]
apache-2.0
C#
f542fd0a88d6eead63519507e93a560ee6bfdd3e
Update LiteralInlineRenderer.cs
lunet-io/markdig
src/Markdig/Renderers/Html/Inlines/LiteralInlineRenderer.cs
src/Markdig/Renderers/Html/Inlines/LiteralInlineRenderer.cs
// Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. using Markdig.Syntax.Inlines; namespace Markdig.Renderers.Html.Inlines { /// <summary> /// A HTML renderer for a <see cref="LiteralInline"/>. /// </summary> /// <seealso cref="Markdig.Renderers.Html.HtmlObjectRenderer{Markdig.Syntax.Inlines.LiteralInline}" /> public class LiteralInlineRenderer : HtmlObjectRenderer<LiteralInline> { protected override void Write(HtmlRenderer renderer, LiteralInline obj) { if (renderer.EnableHtmlForInline) renderer.WriteEscape(obj.Content); else renderer.Write(obj.Content); } } }
// Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. using Markdig.Syntax.Inlines; namespace Markdig.Renderers.Html.Inlines { /// <summary> /// A HTML renderer for a <see cref="LiteralInline"/>. /// </summary> /// <seealso cref="Markdig.Renderers.Html.HtmlObjectRenderer{Markdig.Syntax.Inlines.LiteralInline}" /> public class LiteralInlineRenderer : HtmlObjectRenderer<LiteralInline> { protected override void Write(HtmlRenderer renderer, LiteralInline obj) { renderer.WriteEscape(ref obj.Content); } } }
bsd-2-clause
C#
3abef03e282e097c880ab96927295fce3c785f30
Remove unnecessary #nullable disable
KevinRansom/roslyn,bartdesmet/roslyn,mavasani/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,diryboy/roslyn,sharwell/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,KevinRansom/roslyn,diryboy/roslyn,mavasani/roslyn,diryboy/roslyn,sharwell/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,sharwell/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn
src/Workspaces/Core/Portable/Workspace/Solution/BranchId.cs
src/Workspaces/Core/Portable/Workspace/Solution/BranchId.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. using System.Diagnostics; using System.Threading; namespace Microsoft.CodeAnalysis { /// <summary> /// solution branch Id /// </summary> [DebuggerDisplay("{_id}")] internal class BranchId { private static int s_nextId; #pragma warning disable IDE0052 // Remove unread private members private readonly int _id; #pragma warning restore IDE0052 // Remove unread private members private BranchId(int id) => _id = id; internal static BranchId GetNextId() => new(Interlocked.Increment(ref s_nextId)); } }
// 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. #nullable disable using System.Diagnostics; using System.Threading; namespace Microsoft.CodeAnalysis { /// <summary> /// solution branch Id /// </summary> [DebuggerDisplay("{_id}")] internal class BranchId { private static int s_nextId; #pragma warning disable IDE0052 // Remove unread private members private readonly int _id; #pragma warning restore IDE0052 // Remove unread private members private BranchId(int id) => _id = id; internal static BranchId GetNextId() => new(Interlocked.Increment(ref s_nextId)); } }
mit
C#
de94482856f7d5f1f9e6eba4024ad20c68985fee
Bump version
oozcitak/imagelistview
ImageListView/Properties/AssemblyInfo.cs
ImageListView/Properties/AssemblyInfo.cs
// ImageListView - A listview control for image files // Copyright (C) 2009 Ozgur Ozcitak // // 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. // // Ozgur Ozcitak ([email protected]) 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("ImageListView")] [assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Özgür Özçıtak")] [assembly: AssemblyProduct("ImageListView")] [assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")] [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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")] // 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("13.7.2.0")] [assembly: AssemblyFileVersion("13.7.2.0")]
// ImageListView - A listview control for image files // Copyright (C) 2009 Ozgur Ozcitak // // 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. // // Ozgur Ozcitak ([email protected]) 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("ImageListView")] [assembly: AssemblyDescription("A ListView like control for displaying image files with asynchronously loaded thumbnails.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Özgür Özçıtak")] [assembly: AssemblyProduct("ImageListView")] [assembly: AssemblyCopyright("Copyright © 2013 Özgür Özçıtak")] [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("3eb67a8d-4c80-4c11-944d-c99ef0ec7eb9")] // 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("13.7.1.0")] [assembly: AssemblyFileVersion("13.7.1.0")]
apache-2.0
C#
01b65e860643982510d68bd81e63a8d3c992b410
mark only product as ALPHA
jumulr/MahApps.Metro,ye4241/MahApps.Metro,p76984275/MahApps.Metro,Jack109/MahApps.Metro,Danghor/MahApps.Metro,pfattisc/MahApps.Metro,chuuddo/MahApps.Metro,psinl/MahApps.Metro,MahApps/MahApps.Metro,batzen/MahApps.Metro,xxMUROxx/MahApps.Metro,Evangelink/MahApps.Metro
MahApps.Metro/Properties/AssemblyInfo.cs
MahApps.Metro/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Markup; [assembly: AssemblyCopyright("Copyright © MahApps.Metro 2014")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviours")] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyTitleAttribute("MahApps.Metro")] [assembly: AssemblyDescriptionAttribute("Toolkit for creating Metro styled WPF apps")] [assembly: AssemblyProductAttribute("MahApps.Metro 1.0.0-ALPHA")] [assembly: InternalsVisibleTo("Mahapps.Metro.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Markup; [assembly: AssemblyCopyright("Copyright © MahApps.Metro 2014")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Behaviours")] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/shared", "MahApps.Metro.Converters")] [assembly: XmlnsDefinition("http://metro.mahapps.com/winfx/xaml/controls", "MahApps.Metro.Controls")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyTitleAttribute("MahApps.Metro ALPHA")] [assembly: AssemblyDescriptionAttribute("Toolkit for creating Metro styled WPF apps")] [assembly: AssemblyProductAttribute("MahApps.Metro ALPHA")] [assembly: InternalsVisibleTo("Mahapps.Metro.Tests")]
mit
C#
7814084a9932b1511c3eac762ca43a3b0f982653
Bump version
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University/Properties/AssemblyInfo.cs
R7.University/Properties/AssemblyInfo.cs
using System.Reflection; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("R7.University")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("R7.Labs")] [assembly: AssemblyProduct("R7.University")] [assembly: AssemblyCopyright("Roman M. Yagodin")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("2.1.0.*")] [assembly: AssemblyInformationalVersion("2.1")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
using System.Reflection; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("R7.University")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("R7.Labs")] [assembly: AssemblyProduct("R7.University")] [assembly: AssemblyCopyright("Roman M. Yagodin")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("2.1.0.*")] [assembly: AssemblyInformationalVersion("2.1-beta.1")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
agpl-3.0
C#
f52753454d8a8a3287ebf1e40d7e99337f709c56
Update LevelGrading.cs
afroraydude/First_Unity_Game,afroraydude/First_Unity_Game,afroraydude/First_Unity_Game
Real_Game/Assets/Scripts/LevelGrading.cs
Real_Game/Assets/Scripts/LevelGrading.cs
using UnityEngine; using System.Collections; public class LevelGrading : MonoBehaviour { //public int; void Start() { } void Update() { } }
using UnityEngine; using System.Collections; public class LevelGrading : MonoBehaviour {
mit
C#
b56878bebd6d64e1cc71ba78cd47098cc247f8a4
fix behaviour
icarus-consulting/Yaapii.Atoms
tests/Yaapii.Atoms.Tests/Enumerable/DivergencyTests.cs
tests/Yaapii.Atoms.Tests/Enumerable/DivergencyTests.cs
using System.Collections.Generic; using Xunit; namespace Yaapii.Atoms.Enumerable.Test { public sealed class DivergencyTests { [Fact] public void Empty() { Assert.Empty( new Divergency<string>( new EnumerableOf<string>("a", "b"), new EnumerableOf<string>("a", "b") ) ); } [Theory] [InlineData(new string[] { "a", "b", "c" }, new string[] { "a", "b", "e" }, new string[] { "c", "e" })] [InlineData(new string[] { "a", "b" }, new string[] { "c", "d" }, new string[] { "a", "b", "c", "d" })] public void MatchesString(IEnumerable<string> a, IEnumerable<string> b, IEnumerable<string> expected) { Assert.Equal( expected, new Divergency<string>( a, b ) ); } [Theory] [InlineData(new int[] { 5, 6 }, new int[] { 1, 2 }, new int[] { 5, 6, 1, 2 })] [InlineData(new int[] { 1, 2 }, new int[] { 1 }, new int[] { 2 })] public void MatchesInt(IEnumerable<int> a, IEnumerable<int> b, IEnumerable<int> expected) { Assert.Equal( expected, new Divergency<int>( a, b ) ); } } }
using System.Collections.Generic; using Xunit; namespace Yaapii.Atoms.Enumerable.Test { public sealed class DivergencyTests { [Fact] public void Empty() { Assert.Empty( new Divergency<string>( new EnumerableOf<string>("a", "b"), new EnumerableOf<string>("a", "b") ) ); } [Theory] [InlineData(new string[] { "a", "b", "c" }, new string[] { "a", "b", "e" }, new string[] { "c", "e" })] [InlineData(new string[] { "a", "b" }, new string[] { "c", "d" }, new string[] { "a", "b", "c", "d" })] public void MatchesString(IEnumerable<string> a, IEnumerable<string> b, IEnumerable<string> expected) { Assert.Equal( expected, new Divergency<string>( a, b ) ); } [Theory] [InlineData(new int[] { 5, 6 }, new int[] { 1, 2 }, new int[] { 1, 2, 5, 6 })] [InlineData(new int[] { 1, 2 }, new int[] { 1 }, new int[] { 2 })] public void MatchesInt(IEnumerable<int> a, IEnumerable<int> b, IEnumerable<int> expected) { Assert.Equal( expected, new Divergency<int>( a, b ) ); } } }
mit
C#
d4760f546794cc82ce65507d5b22ef2da5762f3d
include userId in IX_umbracoExternalLogin_LoginProvider
arknu/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS
src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs
src/Umbraco.Infrastructure/Persistence/Dtos/ExternalLoginDto.cs
using System; using NPoco; using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations; using Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions; namespace Umbraco.Cms.Infrastructure.Persistence.Dtos { [TableName(TableName)] [ExplicitColumns] [PrimaryKey("Id")] internal class ExternalLoginDto { public const string TableName = Cms.Core.Constants.DatabaseSchema.Tables.ExternalLogin; [Column("id")] [PrimaryKeyColumn] public int Id { get; set; } // TODO: This is completely missing a FK!!? ... IIRC that is because we want to change this to a GUID // to support both members and users for external logins and that will not have any referential integrity // This should be part of the members task for enabling external logins. [Column("userId")] [Index(IndexTypes.NonClustered)] public int UserId { get; set; } [Column("loginProvider")] [Length(400)] [NullSetting(NullSetting = NullSettings.NotNull)] [Index(IndexTypes.UniqueNonClustered, ForColumns = "loginProvider,userId", Name = "IX_" + TableName + "_LoginProvider")] public string LoginProvider { get; set; } [Column("providerKey")] [Length(4000)] [NullSetting(NullSetting = NullSettings.NotNull)] [Index(IndexTypes.NonClustered, ForColumns = "loginProvider,providerKey", Name = "IX_" + TableName + "_ProviderKey")] public string ProviderKey { get; set; } [Column("createDate")] [Constraint(Default = SystemMethods.CurrentDateTime)] public DateTime CreateDate { get; set; } /// <summary> /// Used to store any arbitrary data for the user and external provider - like user tokens returned from the provider /// </summary> [Column("userData")] [NullSetting(NullSetting = NullSettings.Null)] [SpecialDbType(SpecialDbTypes.NTEXT)] public string UserData { get; set; } } }
using System; using NPoco; using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations; using Umbraco.Cms.Infrastructure.Persistence.DatabaseModelDefinitions; namespace Umbraco.Cms.Infrastructure.Persistence.Dtos { [TableName(TableName)] [ExplicitColumns] [PrimaryKey("Id")] internal class ExternalLoginDto { public const string TableName = Cms.Core.Constants.DatabaseSchema.Tables.ExternalLogin; [Column("id")] [PrimaryKeyColumn] public int Id { get; set; } // TODO: This is completely missing a FK!!? ... IIRC that is because we want to change this to a GUID // to support both members and users for external logins and that will not have any referential integrity // This should be part of the members task for enabling external logins. [Column("userId")] [Index(IndexTypes.NonClustered)] public int UserId { get; set; } [Column("loginProvider")] [Length(4000)] // TODO: This value seems WAY too high, this is just a name [NullSetting(NullSetting = NullSettings.NotNull)] [Index(IndexTypes.UniqueNonClustered, Name = "IX_" + TableName + "_LoginProvider")] public string LoginProvider { get; set; } [Column("providerKey")] [Length(4000)] [NullSetting(NullSetting = NullSettings.NotNull)] [Index(IndexTypes.NonClustered, ForColumns = "loginProvider,providerKey", Name = "IX_" + TableName + "_ProviderKey")] public string ProviderKey { get; set; } [Column("createDate")] [Constraint(Default = SystemMethods.CurrentDateTime)] public DateTime CreateDate { get; set; } /// <summary> /// Used to store any arbitrary data for the user and external provider - like user tokens returned from the provider /// </summary> [Column("userData")] [NullSetting(NullSetting = NullSettings.Null)] [SpecialDbType(SpecialDbTypes.NTEXT)] public string UserData { get; set; } } }
mit
C#
560ade640c5b84b893d0adecb8bea717a539f835
Add Ok
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
src/backend/SO115App.Models/Classi/Condivise/EnteIntervenuto.cs
src/backend/SO115App.Models/Classi/Condivise/EnteIntervenuto.cs
//----------------------------------------------------------------------- // <copyright file="EntiIntervenuti.cs" company="CNVVF"> // Copyright (C) 2017 - CNVVF // // This file is part of SOVVF. // SOVVF is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // SOVVF 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see http://www.gnu.org/licenses/. // </copyright> //----------------------------------------------------------------------- using System.Collections.Generic; namespace SO115App.API.Models.Classi.Condivise { /// <summary> /// DTO di inserimento sulla Basedati /// </summary> public class EnteIntervenuto { public string Id { get; set; } /// <summary> /// Codice dell'Ente intervenuto /// </summary> public int Codice { get; set; } /// <summary> /// Descrizione dell'Ente intervenuto ( Es. ACEA ) /// </summary> public string Descrizione { get; set; } public string CodSede { get; set; } public bool Ricorsivo { get; set; } public int CodCategoria { get; set; } public string Indirizzo { get; set; } public string Cap { get; set; } public string CodComune { get; set; } public string SiglaProvincia { get; set; } public string Zona { get; set; } public string NoteEnte { get; set; } public string Email { get; set; } public List<EnteTelefoni> Telefoni { get; set; } } }
//----------------------------------------------------------------------- // <copyright file="EntiIntervenuti.cs" company="CNVVF"> // Copyright (C) 2017 - CNVVF // // This file is part of SOVVF. // SOVVF is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // SOVVF 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see http://www.gnu.org/licenses/. // </copyright> //----------------------------------------------------------------------- using System.Collections.Generic; namespace SO115App.API.Models.Classi.Condivise { /// <summary> /// DTO di inserimento sulla Basedati /// </summary> public class EnteIntervenuto { public string Id { get; set; } /// <summary> /// Codice dell'Ente intervenuto /// </summary> public int Codice { get; set; } /// <summary> /// Descrizione dell'Ente intervenuto ( Es. ACEA ) /// </summary> public string Descrizione { get; set; } public string CodSede { get; set; } public bool Ricorsivo { get; set; } public int CodCategoria { get; set; } public string Indirizzo { get; set; } public string Cap { get; set; } public string CodComune { get; set; } public string SiglaProvincia { get; set; } public string Zona { get; set; } public string NoteEnte { get; set; } public string Email { get; set; } public List<EnteTelefoni> Telefoni { get; set; } } }
agpl-3.0
C#
1e2dd2d568a36daa6fa28a36ef18be8a9cbd893c
Add object's IsNull & IsNotNull extentions
DataGenSoftware/DataGen.Extensions
DataGenExtensions/DataGenExtensions/ObjectExtensions.cs
DataGenExtensions/DataGenExtensions/ObjectExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataGenExtensions { public static class ObjectExtensions { public static bool IsNull(this object objectInstance) { return objectInstance == null; } public static bool IsNotNull(this object objectInstance) { return !objectInstance.IsNull(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataGenExtensions { public static class ObjectExtensions { } }
mit
C#
da67cba4f63de2263a3021ceb5cda17d29e4bd43
fix evaluation of ParameterExpression
DanielLavrushin/LinqToSolr
LinqToSolr/Query/LinqToSolrProvider.cs
LinqToSolr/Query/LinqToSolrProvider.cs
using System; using System.Collections; using System.Linq; using System.Linq.Expressions; using LinqToSolr.Expressions; using LinqToSolr.Services; using LinqToSolr.Data; namespace LinqToSolr.Query { public class LinqToSolrProvider: IQueryProvider { internal Type ElementType; internal ILinqToSolrService Service; internal bool IsEnumerable; public LinqToSolrProvider(ILinqToSolrService service) { Service = service; ElementType = Service.ElementType; } public IQueryable CreateQuery(Expression expression) { ElementType = TypeSystem.GetElementType(expression.Type); try { return (IQueryable)Activator.CreateInstance(typeof(LinqToSolrQueriable<>).MakeGenericType(ElementType), new object[] { this, expression }); } catch (System.Reflection.TargetInvocationException ex) { throw ex.InnerException; } } public IQueryable<TElement> CreateQuery<TElement>(Expression expression) { return new LinqToSolrQueriable<TElement>(this, expression); } public object Execute(Expression expression) { var query = GetSolrQuery(expression).Query(ElementType); return IsEnumerable ? query : ((IEnumerable)query).Cast<object>().FirstOrDefault(); } public TResult Execute<TResult>(Expression expression) { IsEnumerable = (typeof(TResult).Name == "IEnumerable`1"); var result = Execute(expression); return (TResult)result; } internal ILinqToSolrService GetSolrQuery(Expression expression) { var elementType = TypeSystem.GetElementType(expression.Type); Service.ElementType = elementType; var qt = new LinqToSolrQueryTranslator(Service); expression = Evaluator.PartialEval(expression, e => e.NodeType != ExpressionType.Parameter && !typeof(IQueryable).IsAssignableFrom(e.Type)); Service.CurrentQuery = Service.CurrentQuery ?? new LinqToSolrQuery(); Service.CurrentQuery.FilterUrl = qt.Translate(BooleanVisitor.Process(expression)); return Service; } } }
using System; using System.Collections; using System.Linq; using System.Linq.Expressions; using LinqToSolr.Expressions; using LinqToSolr.Services; using LinqToSolr.Data; namespace LinqToSolr.Query { public class LinqToSolrProvider: IQueryProvider { internal Type ElementType; internal ILinqToSolrService Service; internal bool IsEnumerable; public LinqToSolrProvider(ILinqToSolrService service) { Service = service; ElementType = Service.ElementType; } public IQueryable CreateQuery(Expression expression) { ElementType = TypeSystem.GetElementType(expression.Type); try { return (IQueryable)Activator.CreateInstance(typeof(LinqToSolrQueriable<>).MakeGenericType(ElementType), new object[] { this, expression }); } catch (System.Reflection.TargetInvocationException ex) { throw ex.InnerException; } } public IQueryable<TElement> CreateQuery<TElement>(Expression expression) { return new LinqToSolrQueriable<TElement>(this, expression); } public object Execute(Expression expression) { var query = GetSolrQuery(expression).Query(ElementType); return IsEnumerable ? query : ((IEnumerable)query).Cast<object>().FirstOrDefault(); } public TResult Execute<TResult>(Expression expression) { IsEnumerable = (typeof(TResult).Name == "IEnumerable`1"); var result = Execute(expression); return (TResult)result; } internal ILinqToSolrService GetSolrQuery(Expression expression) { var elementType = TypeSystem.GetElementType(expression.Type); Service.ElementType = elementType; var qt = new LinqToSolrQueryTranslator(Service); expression = Evaluator.PartialEval(expression); Service.CurrentQuery = Service.CurrentQuery ?? new LinqToSolrQuery(); Service.CurrentQuery.FilterUrl = qt.Translate(BooleanVisitor.Process(expression)); return Service; } } }
mit
C#
1dee5521e7fe29234933997779927e18a6952bce
Remove leftover unused variable
NTumbleBit/NTumbleBit,DanGould/NTumbleBit
NTumbleBit/BouncyCastle/crypto/paddings/Pkcs7Padding.cs
NTumbleBit/BouncyCastle/crypto/paddings/Pkcs7Padding.cs
using NTumbleBit.BouncyCastle.Security; namespace NTumbleBit.BouncyCastle.Crypto.Paddings { /** * A padder that adds Pkcs7/Pkcs5 padding to a block. */ internal class Pkcs7Padding : IBlockCipherPadding { /** * Initialise the padder. * * @param random - a SecureRandom if available. */ public void Init() { // nothing to do. } /** * Return the name of the algorithm the cipher implements. * * @return the name of the algorithm the cipher implements. */ public string PaddingName { get { return "PKCS7"; } } /** * add the pad bytes to the passed in block, returning the * number of bytes added. */ public int AddPadding( byte[] input, int inOff) { byte code = (byte)(input.Length - inOff); while(inOff < input.Length) { input[inOff] = code; inOff++; } return code; } /** * return the number of pad bytes present in the block. */ public int PadCount( byte[] input) { byte countAsByte = input[input.Length - 1]; int count = countAsByte; if(count < 1 || count > input.Length) throw new InvalidCipherTextException("pad block corrupted"); for(int i = 2; i <= count; i++) { if(input[input.Length - i] != countAsByte) throw new InvalidCipherTextException("pad block corrupted"); } return count; } } }
using NTumbleBit.BouncyCastle.Security; namespace NTumbleBit.BouncyCastle.Crypto.Paddings { /** * A padder that adds Pkcs7/Pkcs5 padding to a block. */ internal class Pkcs7Padding : IBlockCipherPadding { /** * Initialise the padder. * * @param random - a SecureRandom if available. */ public void Init( SecureRandom random) { // nothing to do. } /** * Return the name of the algorithm the cipher implements. * * @return the name of the algorithm the cipher implements. */ public string PaddingName { get { return "PKCS7"; } } /** * add the pad bytes to the passed in block, returning the * number of bytes added. */ public int AddPadding( byte[] input, int inOff) { byte code = (byte)(input.Length - inOff); while(inOff < input.Length) { input[inOff] = code; inOff++; } return code; } /** * return the number of pad bytes present in the block. */ public int PadCount( byte[] input) { byte countAsByte = input[input.Length - 1]; int count = countAsByte; if(count < 1 || count > input.Length) throw new InvalidCipherTextException("pad block corrupted"); for(int i = 2; i <= count; i++) { if(input[input.Length - i] != countAsByte) throw new InvalidCipherTextException("pad block corrupted"); } return count; } } }
mit
C#
d0e0090a14921cdfa1dcf4290eb91755f6a5b222
Update AssemblyInfo.cs
patrickhuber/Pliant
libraries/Pliant/Properties/AssemblyInfo.cs
libraries/Pliant/Properties/AssemblyInfo.cs
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("Pliant")] [assembly: AssemblyDescription("An Earley parsing library.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Patrick Huber")] [assembly: AssemblyProduct("Pliant")] [assembly: AssemblyCopyright("Copyright © Patrick Huber 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("cf64ceb7-ea45-4176-9f40-029bc55685c7")] // 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.5.2.0")] [assembly: AssemblyFileVersion("0.5.2.0")]
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("Pliant")] [assembly: AssemblyDescription("An Earley parsing library.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Patrick Huber")] [assembly: AssemblyProduct("Pliant")] [assembly: AssemblyCopyright("Copyright © Patrick Huber 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("cf64ceb7-ea45-4176-9f40-029bc55685c7")] // 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.5.1.0")] [assembly: AssemblyFileVersion("0.5.1.0")]
mit
C#
8324ad588d63e5e3933749241ed6aabd67959ee1
Remove limit check on data extraction queries
SlicingDice/slicingdice-dot-net
Slicer/Utils/Validators/DataExtractionQueryValidator.cs
Slicer/Utils/Validators/DataExtractionQueryValidator.cs
using Slicer.Utils.Exceptions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Slicer.Utils.Validators { // Validates data extraction queries public class DataExtractionQueryValidator { Dictionary<string, dynamic> Query; public DataExtractionQueryValidator(Dictionary<string, dynamic> query) { this.Query = query; } // Validate data extraction query, if the query is valid will return true public bool Validator() { if (this.Query.ContainsKey("fields")) { var fields = this.Query["fields"]; if (fields.Count > 10) { throw new InvalidQueryException("The key 'fields' in data extraction result must have up to 10 fields."); } } return true; } } }
using Slicer.Utils.Exceptions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Slicer.Utils.Validators { // Validates data extraction queries public class DataExtractionQueryValidator { Dictionary<string, dynamic> Query; public DataExtractionQueryValidator(Dictionary<string, dynamic> query) { this.Query = query; } // Validate data extraction query, if the query is valid will return true public bool Validator() { if (this.Query.ContainsKey("limit")) { var limitValue = (int) this.Query["limit"]; if (limitValue > 100) { throw new InvalidQueryException("The field 'limit' has a value max of 100."); } } if (this.Query.ContainsKey("fields")) { var fields = this.Query["fields"]; if (fields.Count > 10) { throw new InvalidQueryException("The key 'fields' in data extraction result must have up to 10 fields."); } } return true; } } }
mit
C#
208e55634d482a89c53f1e4349218539fb0d7f29
Add comment at line35
arobertov/SoftUniExercises
DayofWeek/DayofWeek.cs
DayofWeek/DayofWeek.cs
using System; namespace DayofWeek { //....Add comment ...................// class DayofWeek { static void Main(string[] args) { var numDay = int.Parse(Console.ReadLine()); switch (numDay) { case 1: Console.WriteLine("Monday"); break; case 2: Console.WriteLine("Tuesday"); break; case 3: Console.WriteLine("Wednesday"); break; case 4: Console.WriteLine("Thursday"); break; case 5: Console.WriteLine("Friday"); break; case 6: Console.WriteLine("Saturday"); break; case 7: Console.WriteLine("Sunday"); break; default: Console.WriteLine("Error"); break; //.... Error break code ....// } } } }
using System; namespace DayofWeek { //....Add comment ...................// class DayofWeek { static void Main(string[] args) { var numDay = int.Parse(Console.ReadLine()); switch (numDay) { case 1: Console.WriteLine("Monday"); break; case 2: Console.WriteLine("Tuesday"); break; case 3: Console.WriteLine("Wednesday"); break; case 4: Console.WriteLine("Thursday"); break; case 5: Console.WriteLine("Friday"); break; case 6: Console.WriteLine("Saturday"); break; case 7: Console.WriteLine("Sunday"); break; default: Console.WriteLine("Error"); break; } } } }
mit
C#
79efec24a259c9c4a7ee11bf344d088506a446eb
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/Properties/AssemblyInfo.cs
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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © 2016")] [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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.17.*")]
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("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © 2016")] [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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // 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.16.*")]
mit
C#
1cc812014411ee90170f4df0d8d2d364ced66568
Fix importer error #555
dotless/dotless,dotless/dotless
src/dotless.AspNet/HandlerImpl.cs
src/dotless.AspNet/HandlerImpl.cs
namespace dotless.Core { using Abstractions; using Input; using Response; public class HandlerImpl { public readonly IHttp Http; public readonly IResponse Response; public readonly ILessEngine Engine; public readonly IFileReader FileReader; public HandlerImpl(IHttp http, IResponse response, ILessEngine engine, IFileReader fileReader) { Http = http; Response = response; Engine = engine; FileReader = fileReader; } public void Execute() { var localPath = Http.Context.Request.Url.LocalPath; var source = FileReader.GetFileContents(localPath); // Due to the Importer is a singleton, we should always reset the already imported files (#555) Engine.ResetImports(); Response.WriteHeaders(); Response.WriteCss(Engine.TransformToCss(source, localPath)); } } }
namespace dotless.Core { using Abstractions; using Input; using Response; public class HandlerImpl { public readonly IHttp Http; public readonly IResponse Response; public readonly ILessEngine Engine; public readonly IFileReader FileReader; public HandlerImpl(IHttp http, IResponse response, ILessEngine engine, IFileReader fileReader) { Http = http; Response = response; Engine = engine; FileReader = fileReader; } public void Execute() { var localPath = Http.Context.Request.Url.LocalPath; var source = FileReader.GetFileContents(localPath); Response.WriteHeaders(); Response.WriteCss(Engine.TransformToCss(source, localPath)); } } }
apache-2.0
C#
a7cb2b8c30f0beb0191a99133d07f094dd2034fa
Update svn properties.
ft-/opensim-optimizations-wip,rryk/omp-server,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-extras,RavenB/opensim,N3X15/VoxelSim,AlphaStaxLLC/taiga,intari/OpenSimMirror,justinccdev/opensim,OpenSimian/opensimulator,AlexRa/opensim-mods-Alex,BogusCurry/arribasim-dev,N3X15/VoxelSim,QuillLittlefeather/opensim-1,Michelle-Argus/ArribasimExtract,ft-/arribasim-dev-extras,QuillLittlefeather/opensim-1,cdbean/CySim,ft-/arribasim-dev-tests,AlphaStaxLLC/taiga,BogusCurry/arribasim-dev,BogusCurry/arribasim-dev,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TechplexEngineer/Aurora-Sim,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,intari/OpenSimMirror,ft-/opensim-optimizations-wip,N3X15/VoxelSim,QuillLittlefeather/opensim-1,allquixotic/opensim-autobackup,rryk/omp-server,bravelittlescientist/opensim-performance,AlphaStaxLLC/taiga,RavenB/opensim,ft-/arribasim-dev-extras,ft-/arribasim-dev-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,N3X15/VoxelSim,TomDataworks/opensim,ft-/arribasim-dev-extras,N3X15/VoxelSim,ft-/arribasim-dev-tests,QuillLittlefeather/opensim-1,RavenB/opensim,Michelle-Argus/ArribasimExtract,bravelittlescientist/opensim-performance,QuillLittlefeather/opensim-1,N3X15/VoxelSim,ft-/opensim-optimizations-wip-tests,M-O-S-E-S/opensim,RavenB/opensim,OpenSimian/opensimulator,AlphaStaxLLC/taiga,allquixotic/opensim-autobackup,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-tests,justinccdev/opensim,ft-/arribasim-dev-tests,TomDataworks/opensim,ft-/arribasim-dev-extras,TechplexEngineer/Aurora-Sim,M-O-S-E-S/opensim,intari/OpenSimMirror,AlexRa/opensim-mods-Alex,Michelle-Argus/ArribasimExtract,zekizeki/agentservice,ft-/opensim-optimizations-wip-tests,OpenSimian/opensimulator,TomDataworks/opensim,justinccdev/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,TomDataworks/opensim,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip-extras,justinccdev/opensim,zekizeki/agentservice,rryk/omp-server,zekizeki/agentservice,ft-/arribasim-dev-tests,OpenSimian/opensimulator,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip,AlphaStaxLLC/taiga,AlphaStaxLLC/taiga,cdbean/CySim,ft-/opensim-optimizations-wip-extras,TechplexEngineer/Aurora-Sim,intari/OpenSimMirror,allquixotic/opensim-autobackup,rryk/omp-server,AlexRa/opensim-mods-Alex,AlexRa/opensim-mods-Alex,cdbean/CySim,TomDataworks/opensim,ft-/opensim-optimizations-wip-tests,TomDataworks/opensim,ft-/arribasim-dev-extras,RavenB/opensim,justinccdev/opensim,QuillLittlefeather/opensim-1,justinccdev/opensim,cdbean/CySim,ft-/opensim-optimizations-wip-extras,zekizeki/agentservice,AlexRa/opensim-mods-Alex,rryk/omp-server,OpenSimian/opensimulator,ft-/opensim-optimizations-wip,M-O-S-E-S/opensim,bravelittlescientist/opensim-performance,AlphaStaxLLC/taiga,cdbean/CySim,N3X15/VoxelSim,N3X15/VoxelSim,ft-/arribasim-dev-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,AlexRa/opensim-mods-Alex,OpenSimian/opensimulator,RavenB/opensim,M-O-S-E-S/opensim,M-O-S-E-S/opensim,bravelittlescientist/opensim-performance,allquixotic/opensim-autobackup,zekizeki/agentservice,TomDataworks/opensim,bravelittlescientist/opensim-performance,zekizeki/agentservice,BogusCurry/arribasim-dev,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip-extras,bravelittlescientist/opensim-performance,AlphaStaxLLC/taiga,Michelle-Argus/ArribasimExtract,TechplexEngineer/Aurora-Sim,M-O-S-E-S/opensim,QuillLittlefeather/opensim-1,intari/OpenSimMirror,OpenSimian/opensimulator,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,BogusCurry/arribasim-dev,rryk/omp-server,intari/OpenSimMirror,cdbean/CySim,ft-/arribasim-dev-extras
OpenSim/Region/Environment/Modules/Terrain/ITerrainModule.cs
OpenSim/Region/Environment/Modules/Terrain/ITerrainModule.cs
namespace OpenSim.Region.Environment.Modules.Terrain { public interface ITerrainModule { void LoadFromFile(string filename); void SaveToFile(string filename); } }
namespace OpenSim.Region.Environment.Modules.Terrain { public interface ITerrainModule { void LoadFromFile(string filename); void SaveToFile(string filename); } }
bsd-3-clause
C#
7bc2d94fd15dd8310912432c6b88dfde2a61c820
Use types instead of fully qualified names.
GetTabster/Tabster
Tabster.Core/Plugins/ITabsterPlugin.cs
Tabster.Core/Plugins/ITabsterPlugin.cs
using System; namespace Tabster.Core.Plugins { public interface ITabsterPlugin { string Name { get; } string Description { get; } string Author { get; } string Version { get; } Type[] Types { get; } } }
namespace Tabster.Core.Plugins { public interface ITabsterPlugin { string Name { get; } string Description { get; } string Author { get; } string Version { get; } string[] PluginClasses { get; } } }
apache-2.0
C#
546bdf061850b4a0ab38b915e4b1d9788223593a
remove default value init .-.
smoogipoo/osu,johnneijzen/osu,peppy/osu-new,peppy/osu,ppy/osu,naoey/osu,ZLima12/osu,DrabWeb/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,DrabWeb/osu,naoey/osu,smoogipoo/osu,johnneijzen/osu,smoogipooo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,DrabWeb/osu,ZLima12/osu,UselessToucan/osu,UselessToucan/osu,2yangk23/osu,naoey/osu,NeoAdonis/osu,EVAST9919/osu,NeoAdonis/osu,2yangk23/osu,peppy/osu
osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs
osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using OpenTK; namespace osu.Game.Rulesets.Osu.Mods { internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects { public override string Name => "Arrange"; public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING"; public override double ScoreMultiplier => 1.05; public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) { drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); } private float theta; private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) { var hitObject = (OsuHitObject) drawable.HitObject; // repeat points get their position data from the slider. if (hitObject is RepeatPoint) return; Vector2 originalPosition = drawable.Position; // avoiding that the player can see the abroupt move. const int pre_time_offset = 1000; using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); } // That way slider ticks come all from the same direction. if (hitObject is HitCircle || hitObject is Slider) theta += 0.4f; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using OpenTK; namespace osu.Game.Rulesets.Osu.Mods { internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects { public override string Name => "Arrange"; public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING"; public override double ScoreMultiplier => 1.05; public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) { drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); } private float theta = 0; private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) { var hitObject = (OsuHitObject) drawable.HitObject; // repeat points get their position data from the slider. if (hitObject is RepeatPoint) return; Vector2 originalPosition = drawable.Position; // avoiding that the player can see the abroupt move. const int pre_time_offset = 1000; using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); } // That way slider ticks come all from the same direction. if (hitObject is HitCircle || hitObject is Slider) theta += 0.4f; } } }
mit
C#
dc8a47fa81c90d2e8f2ad3b28d8b9a65618b89fe
Remove unused code.
winddyhe/knight
knight-client/Hotfix/KnightHotfix/Core/GUI/ViewModel.cs
knight-client/Hotfix/KnightHotfix/Core/GUI/ViewModel.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine.UI; namespace Knight.Hotfix.Core { public class ViewModel { public Action<string> PropertyChanged; public object GetPropValue(string rVaribleName) { Type rType = this.GetType(); var rModelProp = rType.GetProperty(rVaribleName, HotfixReflectAssists.flags_public); object rModelValue = null; if (rModelProp != null) { rModelValue = rModelProp.GetValue(this); } return rModelValue; } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine.UI; namespace Knight.Hotfix.Core { public class ViewModel { public Action<string> PropertyChanged; public bool IsOpened; public bool IsClosed; public object GetPropValue(string rVaribleName) { Type rType = this.GetType(); var rModelProp = rType.GetProperty(rVaribleName, HotfixReflectAssists.flags_public); object rModelValue = null; if (rModelProp != null) { rModelValue = rModelProp.GetValue(this); } return rModelValue; } } }
mit
C#
57758e322a8436da83d9961541e7266300e5b6aa
Add possibility to register events on App, like we do on HTML DOM
felladrin/unity3d-mvc
Scripts/Application.cs
Scripts/Application.cs
using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class Application : MonoBehaviour { public ModelContainer Model; public ControllerContainer Controller; public ViewContainer View; private Dictionary<string, UnityEvent> eventDictionary = new Dictionary<string, UnityEvent>(); /// <summary> /// Add listener to a given event. /// </summary> /// <param name="eventName">Name of the event.</param> /// <param name="listener">Callback function.</param> public void AddEventListener(string eventName, UnityAction listener) { UnityEvent e; if (eventDictionary.TryGetValue(eventName, out e)) { e.AddListener(listener); } else { e = new UnityEvent(); e.AddListener(listener); eventDictionary.Add(eventName, e); } } /// <summary> /// Remove listener from a given event. /// </summary> /// <param name="eventName">Name of the event.</param> /// <param name="listener">Callback function.</param> public void RemoveEventListener(string eventName, UnityAction listener) { UnityEvent e; if (eventDictionary.TryGetValue(eventName, out e)) { e.RemoveListener(listener); } } /// <summary> /// Triggers all registered callbacks of a given event. /// </summary> public void TriggerEvent(string eventName) { UnityEvent e; if (eventDictionary.TryGetValue(eventName, out e)) { e.Invoke(); } } }
using UnityEngine; public class Application : MonoBehaviour { public ModelContainer Model; public ControllerContainer Controller; public ViewContainer View; }
mit
C#
3f10a919543432a7ed38422b7b643c536ee8e8bb
enable request tracing when debugger attached
CatenaLogic/JiraCli
src/JiraCli/Actions/ActionBase.cs
src/JiraCli/Actions/ActionBase.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ActionBase.cs" company="CatenaLogic"> // Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace JiraCli { using System; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Atlassian.Jira; using Atlassian.Jira.Remote; using Catel; using Catel.Logging; using Catel.Reflection; public abstract class ActionBase : IAction { private static readonly ILog Log = LogManager.GetCurrentClassLogger(); public string Name { get; set; } public string Description { get; set; } public string ArgumentsUsage { get; set; } public void Validate(Context context) { context.ValidateContext(); ValidateContext(context); } protected abstract void ValidateContext(Context context); public async Task<bool> Execute(Context context) { Argument.IsNotNull(() => context); try { await Task.Factory.StartNew(() => ExecuteWithContext(context)); return true; } catch (Exception ex) { Log.Error(exception: ex); return false; } } protected abstract void ExecuteWithContext(Context context); protected IJiraRestClient CreateJira(Context context) { Argument.IsNotNull(() => context); var type = TypeCache.GetType("Atlassian.Jira.Remote.JiraRestServiceClient"); var constructor = type.GetConstructorsEx().First(); var jiraRestClient = (IJiraRestClient) constructor.Invoke(new object[] { context.JiraUrl, context.UserName, context.Password, new JiraRestClientSettings { EnableRequestTrace = Debugger.IsAttached } }); return jiraRestClient; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ActionBase.cs" company="CatenaLogic"> // Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace JiraCli { using System; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Atlassian.Jira; using Atlassian.Jira.Remote; using Catel; using Catel.Logging; using Catel.Reflection; public abstract class ActionBase : IAction { private static readonly ILog Log = LogManager.GetCurrentClassLogger(); public string Name { get; set; } public string Description { get; set; } public string ArgumentsUsage { get; set; } public void Validate(Context context) { context.ValidateContext(); ValidateContext(context); } protected abstract void ValidateContext(Context context); public async Task<bool> Execute(Context context) { Argument.IsNotNull(() => context); try { await Task.Factory.StartNew(() => ExecuteWithContext(context)); return true; } catch (Exception ex) { Log.Error(ex); return false; } } protected abstract void ExecuteWithContext(Context context); protected IJiraRestClient CreateJira(Context context) { Argument.IsNotNull(() => context); var type = TypeCache.GetType("Atlassian.Jira.Remote.JiraRestServiceClient"); var constructor = type.GetConstructorsEx().First(); var jiraRestClient = (IJiraRestClient) constructor.Invoke(new object[] { context.JiraUrl, context.UserName, context.Password, new JiraRestClientSettings { EnableRequestTrace = Debugger.IsAttached } }); return jiraRestClient; } } }
mit
C#
428095786a3116b4c8f92a5a578860dc8f611c0d
Improve naming of tests to clearly indicate the feature to be tested
oliverzick/Delizious-Filtering
src/Library.Test/LessThanTests.cs
src/Library.Test/LessThanTests.cs
#region Copyright and license // // <copyright file="LessThanTests.cs" company="Oliver Zick"> // // Copyright (c) 2016 Oliver Zick. All rights reserved. // // </copyright> // // <author>Oliver Zick</author> // // <license> // // 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> #endregion namespace Delizious.Filtering { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public sealed class LessThanTests { [TestMethod] public void Match_Fails_When_Value_To_Match_Is_Greater_Than_Reference() { Assert.IsFalse(Match.LessThan(0).Matches(1)); } [TestMethod] public void Match_Fails_When_Value_To_Match_And_Reference_Are_Equal() { Assert.IsFalse(Match.LessThan(0).Matches(0)); } [TestMethod] public void Match_Succeeds_When_Value_To_Match_Is_Less_Than_Reference() { Assert.IsTrue(Match.LessThan(0).Matches(-1)); } [TestMethod] [ExpectedException(typeof(ArgumentNullException))] public void Throws_Exception_On_Creation_When_Reference_Is_Null() { Match.LessThan<string>(null); } } }
#region Copyright and license // // <copyright file="LessThanTests.cs" company="Oliver Zick"> // // Copyright (c) 2016 Oliver Zick. All rights reserved. // // </copyright> // // <author>Oliver Zick</author> // // <license> // // 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> #endregion namespace Delizious.Filtering { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public sealed class LessThanTests { [TestMethod] public void Fail__When_Value_Is_Greater_Than_Reference() { Assert.IsFalse(Match.LessThan(0).Matches(1)); } [TestMethod] public void Fail__When_Reference_And_Value_Are_Equal() { Assert.IsFalse(Match.LessThan(0).Matches(0)); } [TestMethod] public void Succeed__When_Value_Is_Less_Than_Reference() { Assert.IsTrue(Match.LessThan(0).Matches(-1)); } [TestMethod] [ExpectedException(typeof(ArgumentNullException))] public void Throw_Exception__When_Reference_Is_Null() { Match.LessThan<string>(null); } } }
apache-2.0
C#
4651589b1f43a27640237e502cf61374343625d4
Fix existing user check
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/AtomicChessPuzzles/DbRepositories/UserRepository.cs
src/AtomicChessPuzzles/DbRepositories/UserRepository.cs
using MongoDB.Driver; using AtomicChessPuzzles.Models; using MongoDB.Bson; namespace AtomicChessPuzzles.DbRepositories { public class UserRepository : IUserRepository { MongoSettings settings; IMongoCollection<User> userCollection; public UserRepository() { settings = new MongoSettings(); GetCollection(); } private void GetCollection() { MongoClient client = new MongoClient(settings.MongoConnectionString); userCollection = client.GetDatabase(settings.Database).GetCollection<User>(settings.UserCollectionName); } public bool Add(User user) { var found = userCollection.FindSync<User>(new ExpressionFilterDefinition<User>(x => x.Username == user.Username)); if (found == null || found.Any()) return false; userCollection.InsertOne(user); return true; } public void Update(User user) { userCollection.ReplaceOne(new ExpressionFilterDefinition<User>(x => x.Username == user.Username), user); } public void Delete(User user) { userCollection.DeleteOne(new ExpressionFilterDefinition<User>(x => x.Username == user.Username)); } } }
using MongoDB.Driver; using AtomicChessPuzzles.Models; using MongoDB.Bson; namespace AtomicChessPuzzles.DbRepositories { public class UserRepository : IUserRepository { MongoSettings settings; IMongoCollection<User> userCollection; public UserRepository() { settings = new MongoSettings(); GetCollection(); } private void GetCollection() { MongoClient client = new MongoClient(settings.MongoConnectionString); userCollection = client.GetDatabase(settings.Database).GetCollection<User>(settings.UserCollectionName); } public bool Add(User user) { var found = userCollection.FindSync<User>(new ExpressionFilterDefinition<User>(x => x.Username == user.Username)); if (found == null || !found.Any()) return false; userCollection.InsertOne(user); return true; } public void Update(User user) { userCollection.ReplaceOne(new ExpressionFilterDefinition<User>(x => x.Username == user.Username), user); } public void Delete(User user) { userCollection.DeleteOne(new ExpressionFilterDefinition<User>(x => x.Username == user.Username)); } } }
agpl-3.0
C#
f2a8e7a893a444ce4307859862ea7ba3e501b448
Fix event name of RequestLog. (#37043)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Middleware/HttpLogging/src/HttpLoggingExtensions.cs
src/Middleware/HttpLogging/src/HttpLoggingExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.HttpLogging { internal static partial class HttpLoggingExtensions { public static void RequestLog(this ILogger logger, HttpRequestLog requestLog) => logger.Log( LogLevel.Information, new EventId(1, "RequestLog"), requestLog, exception: null, formatter: HttpRequestLog.Callback); public static void ResponseLog(this ILogger logger, HttpResponseLog responseLog) => logger.Log( LogLevel.Information, new EventId(2, "ResponseLog"), responseLog, exception: null, formatter: HttpResponseLog.Callback); [LoggerMessage(3, LogLevel.Information, "RequestBody: {Body}", EventName = "RequestBody")] public static partial void RequestBody(this ILogger logger, string body); [LoggerMessage(4, LogLevel.Information, "ResponseBody: {Body}", EventName = "ResponseBody")] public static partial void ResponseBody(this ILogger logger, string body); [LoggerMessage(5, LogLevel.Debug, "Decode failure while converting body.", EventName = "DecodeFailure")] public static partial void DecodeFailure(this ILogger logger, Exception ex); [LoggerMessage(6, LogLevel.Debug, "Unrecognized Content-Type for body.", EventName = "UnrecognizedMediaType")] public static partial void UnrecognizedMediaType(this ILogger logger); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.HttpLogging { internal static partial class HttpLoggingExtensions { public static void RequestLog(this ILogger logger, HttpRequestLog requestLog) => logger.Log( LogLevel.Information, new EventId(1, "RequestLogLog"), requestLog, exception: null, formatter: HttpRequestLog.Callback); public static void ResponseLog(this ILogger logger, HttpResponseLog responseLog) => logger.Log( LogLevel.Information, new EventId(2, "ResponseLog"), responseLog, exception: null, formatter: HttpResponseLog.Callback); [LoggerMessage(3, LogLevel.Information, "RequestBody: {Body}", EventName = "RequestBody")] public static partial void RequestBody(this ILogger logger, string body); [LoggerMessage(4, LogLevel.Information, "ResponseBody: {Body}", EventName = "ResponseBody")] public static partial void ResponseBody(this ILogger logger, string body); [LoggerMessage(5, LogLevel.Debug, "Decode failure while converting body.", EventName = "DecodeFailure")] public static partial void DecodeFailure(this ILogger logger, Exception ex); [LoggerMessage(6, LogLevel.Debug, "Unrecognized Content-Type for body.", EventName = "UnrecognizedMediaType")] public static partial void UnrecognizedMediaType(this ILogger logger); } }
apache-2.0
C#
06cf3e6e24a30b90c2fcf75729252765cd0d67c5
Remove duplicate code in CharEnumerator
yizhang82/corert,schellap/corert,manu-silicon/corert,manu-silicon/corert,krytarowski/corert,shrah/corert,sandreenko/corert,schellap/corert,manu-silicon/corert,tijoytom/corert,kyulee1/corert,mjp41/corert,gregkalapos/corert,sandreenko/corert,tijoytom/corert,tijoytom/corert,kyulee1/corert,gregkalapos/corert,gregkalapos/corert,schellap/corert,mjp41/corert,botaberg/corert,krytarowski/corert,krytarowski/corert,gregkalapos/corert,kyulee1/corert,botaberg/corert,yizhang82/corert,shrah/corert,yizhang82/corert,yizhang82/corert,botaberg/corert,mjp41/corert,manu-silicon/corert,schellap/corert,schellap/corert,sandreenko/corert,shrah/corert,botaberg/corert,manu-silicon/corert,shrah/corert,kyulee1/corert,tijoytom/corert,krytarowski/corert,mjp41/corert,sandreenko/corert,mjp41/corert
src/System.Private.CoreLib/src/System/CharEnumerator.cs
src/System.Private.CoreLib/src/System/CharEnumerator.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. /*============================================================ ** ** ** ** Purpose: Enumerates the characters on a string. skips range ** checks. ** ** ============================================================*/ using System.Collections; using System.Collections.Generic; namespace System { internal sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable { private String _str; private int _index; private char _currentElement; internal CharEnumerator(String str) { _str = str; _index = -1; } //public Object Clone() { // return MemberwiseClone(); //} public bool MoveNext() { if (_index < (_str.Length - 1)) { _index++; _currentElement = _str[_index]; return true; } else _index = _str.Length; return false; } public void Dispose() { if (_str != null) _index = _str.Length; _str = null; } /// <internalonly/> Object IEnumerator.Current { get { return Current; } } public char Current { get { if (_index == -1) throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); if (_index >= _str.Length) throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); return _currentElement; } } public void Reset() { _currentElement = (char)0; _index = -1; } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. /*============================================================ ** ** ** ** Purpose: Enumerates the characters on a string. skips range ** checks. ** ** ============================================================*/ using System.Collections; using System.Collections.Generic; namespace System { internal sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable { private String _str; private int _index; private char _currentElement; internal CharEnumerator(String str) { _str = str; _index = -1; } //public Object Clone() { // return MemberwiseClone(); //} public bool MoveNext() { if (_index < (_str.Length - 1)) { _index++; _currentElement = _str[_index]; return true; } else _index = _str.Length; return false; } public void Dispose() { if (_str != null) _index = _str.Length; _str = null; } /// <internalonly/> Object IEnumerator.Current { get { if (_index == -1) throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); if (_index >= _str.Length) throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); return _currentElement; } } public char Current { get { if (_index == -1) throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); if (_index >= _str.Length) throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); return _currentElement; } } public void Reset() { _currentElement = (char)0; _index = -1; } } }
mit
C#
39dac47e863cd5f30574a35a0eb2383ef6c90183
Update the API.
jorik041/maccore,mono/maccore,cwensley/maccore
src/Foundation/NSRunLoop.cs
src/Foundation/NSRunLoop.cs
using System; using System.Runtime.InteropServices; namespace MonoMac.Foundation { public enum NSRunLoopMode { Default, Common, #if MONOMAC ConnectionReply = 2, ModalPanel, EventTracking, #else // iOS-specific Enums start in 100 to avoid conflicting with future extensions to MonoMac UITracking = 100, #endif // If it is not part of these enumerations Other = 1000 } public partial class NSRunLoop { static NSString GetRealMode (string mode) { if (mode == NSDefaultRunLoopMode) return NSDefaultRunLoopMode; else if (mode == NSRunLoopCommonModes) return NSRunLoopCommonModes; else if (mode == UITrackingRunLoopMode) return UITrackingRunLoopMode; else return new NSString (mode); } static NSString FromEnum (NSRunLoopMode mode) { switch (mode){ case NSRunLoopMode.Common: return NSRunLoopCommonModes; case NSRunLoopMode.UITracking: return UITrackingRunLoopMode; #if MONOMAC case NSRunLoopMode.ConnectionReply: return NSRunLoopConnectionReplyMode; case NSRunLoopMode.ModalPanel: return NSRunLoopModalPanelMode; case NSRunLoopMode.EventTracking: return NSRunLoopEventTracking; #endif default: case NSRunLoopMode.Default: return NSDefaultRunLoopMode; } } [Obsolete ("Use AddTimer (NSTimer, NSRunLoopMode)")] public void AddTimer (NSTimer timer, string forMode) { AddTimer (timer, GetRealMode (forMode)); } public void AddTimer (NSTimer timer, NSRunLoopMode forMode) { AddTimer (timer, FromEnum (forMode)); } [Obsolete ("Use LimitDateForMode (NSRunLoopMode) instead")] public NSDate LimitDateForMode (string mode) { return LimitDateForMode (GetRealMode (mode)); } public NSDate LimitDateForMode (NSRunLoopMode mode) { return LimitDateForMode (FromEnum (mode)); } [Obsolete ("Use AcceptInputForMode (NSRunLoopMode, NSDate)")] public void AcceptInputForMode (string mode, NSDate limitDate) { AcceptInputForMode (GetRealMode (mode), limitDate); } public void AcceptInputForMode (NSRunLoopMode mode, NSDate limitDate) { AcceptInputForMode (FromEnum (mode), limitDate); } public void Stop () { GetCFRunLoop ().Stop (); } public void WakeUp () { GetCFRunLoop ().WakeUp (); } public bool RunUntil (NSRunLoopMode mode, NSDate limitDate) { return RunUntil (FromEnum (mode), limitDate); } public NSRunLoopMode CurrentRunLoopMode { get { var mode = CurrentMode; if (mode == NSDefaultRunLoopMode) return NSRunLoopMode.Default; if (mode == NSRunLoopCommonModes) return NSRunLoopMode.Common; #if MONOMAC if (mode == NSRunLoopConnectionReplyMode) return NSRunLoopMode.Connection; if (mode == NSRunLoopModalPanelMode) return NSRunLoopMode.ModalPanel; if (mode == NSRunLoopEventTracking) return NSRunLoopMode.EventTracking; #else if (mode == UITrackingRunLoopMode) return NSRunLoopMode.UITracking; #endif return NSRunLoopMode.Other; } } } }
using System; using System.Runtime.InteropServices; namespace MonoMac.Foundation { public enum NSRunLoopMode { Default, Common, #if MONOMAC ConnectionReply, ModalPanel, EventTracking #endif } public partial class NSRunLoop { static NSString GetRealMode (string mode) { if (mode == NSDefaultRunLoopMode) return NSDefaultRunLoopMode; else if (mode == NSRunLoopCommonModes) return NSRunLoopCommonModes; else return new NSString (mode); } static NSString FromEnum (NSRunLoopMode mode) { switch (mode){ case NSRunLoopMode.Common: return NSRunLoopCommonModes; #if MONOMAC case NSRunLoopMode.ConnectionReply: return NSRunLoopConnectionReplyMode; case NSRunLoopMode.ModalPanel: return NSRunLoopModalPanelMode; case NSRunLoopMode.EventTracking: return NSRunLoopEventTracking; #endif default: case NSRunLoopMode.Default: return NSDefaultRunLoopMode; } } [Obsolete ("Use AddTimer (NSTimer, NSString)")] public void AddTimer (NSTimer timer, string forMode) { AddTimer (timer, GetRealMode (forMode)); } public void AddTimer (NSTimer timer, NSRunLoopMode forMode) { AddTimer (timer, FromEnum (forMode)); } [Obsolete ("Use LimitDateForMode (NSString) instead")] public NSDate LimitDateForMode (string mode) { return LimitDateForMode (GetRealMode (mode)); } public NSDate LimitDateForMode (NSRunLoopMode mode) { return LimitDateForMode (FromEnum (mode)); } [Obsolete ("Use AcceptInputForMode (NSString, NSDate)")] public void AcceptInputForMode (string mode, NSDate limitDate) { AcceptInputForMode (GetRealMode (mode), limitDate); } public void AcceptInputForMode (NSRunLoopMode mode, NSDate limitDate) { AcceptInputForMode (FromEnum (mode), limitDate); } public void Stop () { GetCFRunLoop ().Stop (); } public void WakeUp () { GetCFRunLoop ().WakeUp (); } } }
apache-2.0
C#
4e915a6d1e02d4871d09106895f9f4171d6a5dc1
add more tests
RevensofT/.Net-Anarchy
Anarchy.Facts/RawCopyFacts.cs
Anarchy.Facts/RawCopyFacts.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; using Anarchy; using Xunit.Abstractions; namespace Anarchy.Facts { public class RawCopyFacts { private readonly ITestOutputHelper output; public RawCopyFacts(ITestOutputHelper output) { this.output = output; } private void displayResult<T>(string binary, T value, byte[] dest) { output.WriteLine("From: {0} ({1})", binary, value); for (int i = 0; i < dest.Length; i++) { output.WriteLine("Dest: [{0}] = {1} ({2})", i, System.Convert.ToString(dest[i], toBase: 2).PadLeft(8, '0'), dest[i]); } } [Fact] public void FromShortToTwoBytes() { string binary = "00001011" + "00001101"; short value = System.Convert.ToInt16(binary, fromBase: 2); byte[] dest = new byte[2]; Convert.RawCopyTo(ref value, ref dest[0], 2); Assert.Equal("1101", System.Convert.ToString(dest[0], toBase:2)); Assert.Equal("1011", System.Convert.ToString(dest[1], toBase:2)); displayResult(binary, value, dest); } [Fact] public void FromInt32ToFourBytes() { string binary = "00001011" + "00001101" + "11001100" + "10101100"; int value = System.Convert.ToInt32(binary, fromBase: 2); byte[] dest = new byte[4]; Convert.RawCopyTo(ref value, ref dest[0], 4); Assert.Equal("10101100", System.Convert.ToString(dest[0], toBase: 2)); Assert.Equal("11001100", System.Convert.ToString(dest[1], toBase: 2)); Assert.Equal("1101", System.Convert.ToString(dest[2], toBase: 2)); Assert.Equal("1011", System.Convert.ToString(dest[3], toBase: 2)); displayResult(binary, value, dest); } [Fact] public void FromByteToInt32() { byte source = System.Convert.ToByte("11001100", fromBase: 2); string binary = "00000000" + "00000000" + "00000000" + "00000000"; int dest = System.Convert.ToInt32(binary, fromBase: 2); Convert.RawCopyTo(ref source, ref dest, 1); Assert.Equal("000000000000000000000000" + "11001100", System.Convert.ToString(dest, toBase: 2).PadLeft(32, '0')); } [Fact] public void FromShortToInt32() { short source = System.Convert.ToInt16("11001100" + "10101100", fromBase: 2); string binary = "00000000" + "00000000" + "00000000" + "00000000"; int dest = System.Convert.ToInt32(binary, fromBase: 2); Convert.RawCopyTo(ref source, ref dest, 2); Assert.Equal("0000000000000000" + "11001100" + "10101100", System.Convert.ToString(dest, toBase: 2).PadLeft(32, '0')); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; using Anarchy; using Xunit.Abstractions; namespace Anarchy.Facts { public class RawCopyFacts { private readonly ITestOutputHelper output; public RawCopyFacts(ITestOutputHelper output) { this.output = output; } private void displayResult<T>(string binary, T value, byte[] dest) { output.WriteLine("From: {0} ({1})", binary, value); for (int i = 0; i < dest.Length; i++) { output.WriteLine("Dest: [{0}] = {1} ({2})", i, System.Convert.ToString(dest[i], toBase: 2).PadLeft(8, '0'), dest[i]); } } [Fact] public void FromShortToTwoBytes() { string binary = "00001011" + "00001101"; short value = System.Convert.ToInt16(binary, fromBase: 2); byte[] dest = new byte[2]; Convert.RawCopyTo(ref value, ref dest[0], 2); Assert.Equal("1101", System.Convert.ToString(dest[0], toBase:2)); Assert.Equal("1011", System.Convert.ToString(dest[1], toBase:2)); displayResult(binary, value, dest); } [Fact] public void FromInt32ToTwoBytes() { string binary = "00001011" + "00001101" + "11001100" + "10101100"; int value = System.Convert.ToInt32(binary, fromBase: 2); byte[] dest = new byte[4]; Convert.RawCopyTo(ref value, ref dest[0], 4); Assert.Equal("10101100", System.Convert.ToString(dest[0], toBase: 2)); Assert.Equal("11001100", System.Convert.ToString(dest[1], toBase: 2)); Assert.Equal("1101", System.Convert.ToString(dest[2], toBase: 2)); Assert.Equal("1011", System.Convert.ToString(dest[3], toBase: 2)); displayResult(binary, value, dest); } } }
apache-2.0
C#
1c05897fa16e0e8633788d2e364db140ca3a4a8b
Delete symlink if it's already there
bitcrazed/CreateSymlinkApp,bitcrazed/CreateSymlinkApp,bitcrazed/CreateSymlinkApp
src/MainPage.xaml.cs
src/MainPage.xaml.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace CreateSymlink { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { enum SYMBOLIC_LINK_FLAG : int { File = 0x00, Directory = 0x01 }; [DllImport("kernel32.dll")] static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, SYMBOLIC_LINK_FLAG dwFlags); public MainPage() { this.InitializeComponent(); } private void CreateSymlinkButton_Click(object sender, RoutedEventArgs e) { const string linkFile = @"C:\Temp\hosts.txt"; // Delete the symlink if it already exists. File.Delete(linkFile); bool result = CreateSymbolicLink( linkFile, @"C:\Windows\System32\Drivers\Etc\Hosts", SYMBOLIC_LINK_FLAG.File); if (true == result) { CreateSymlinksResultMessageBox.Text = "Symlink Created"; } else { CreateSymlinksResultMessageBox.Text = "Symlink Creation Failed"; } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace CreateSymlink { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { enum SYMBOLIC_LINK_FLAG : int { File = 0x00, Directory = 0x01 }; [DllImport("kernel32.dll")] static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, SYMBOLIC_LINK_FLAG dwFlags); public MainPage() { this.InitializeComponent(); } private void CreateSymlinkButton_Click(object sender, RoutedEventArgs e) { bool result = CreateSymbolicLink( @"C:\hosts.txt", @"C:\Windows\System32\Drivers\Etc\Hosts", SYMBOLIC_LINK_FLAG.File); if (true == result) { CreateSymlinksResultMessageBox.Text = "Symlink Created"; } else { CreateSymlinksResultMessageBox.Text = "Symlink Creation Failed"; } } } }
mit
C#
60540f2b95fca15c8014ac5bc66e4823ccf47eb4
Add proper default constructot to StrengthPotion
manio143/ShadowsOfShadows
src/Items/StrengthPotion.cs
src/Items/StrengthPotion.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; namespace ShadowsOfShadows.Items { [ItemType(ItemType.Potion)] public class StrengthPotion : TimedConsumable { [XmlIgnore] public int AP { get; private set; } public StrengthPotion() : this(new TimeSpan(0, 0, 10)) { } public StrengthPotion(TimeSpan duration) : base("Strength Potion", "Attack power 3\n", duration) { AP = 3; } public override void Use() { base.Use(); Screen.MainConsole.Player.AttackPower += AP; } public override void EndEffect() { Screen.MainConsole.Player.AttackPower -= AP; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; namespace ShadowsOfShadows.Items { [ItemType(ItemType.Potion)] public class StrengthPotion : TimedConsumable { [XmlIgnore] public int AP { get; private set; } public StrengthPotion() : base("Strength Potion") { } public StrengthPotion(TimeSpan duration) : base("Strength Potion", "Attack power 3\n", duration) { AP = 3; } public override void Use() { base.Use(); Screen.MainConsole.Player.AttackPower += AP; } public override void EndEffect() { Screen.MainConsole.Player.AttackPower -= AP; } } }
mit
C#
64778fa78b3a4167d89b2af3f36068087a1f0aa8
Add using Curry
GrahamClark/NRamda
src/NRamdaLib/NRamda.Add.cs
src/NRamdaLib/NRamda.Add.cs
using System; namespace NRamdaLib { public static partial class NRamda { public static int Add(int x, int y) { return x + y; } public static Func<int, int> Add(int x) { return Curry<int, int, int>(Add)(x); } public static float Add(float x, float y) { return x + y; } public static Func<float, float> Add(float x) { return Curry<float, float, float>(Add)(x); } public static double Add(double x, double y) { return x + y; } public static Func<double, double> Add(double x) { return Curry<double, double, double>(Add)(x); } public static decimal Add(decimal x, decimal y) { return x + y; } public static Func<decimal, decimal> Add(decimal x) { return Curry<decimal, decimal, decimal>(Add)(x); } } }
using System; namespace NRamdaLib { public static partial class NRamda { public static int Add(int x, int y) { return x + y; } public static Func<int, int> Add(int x) { return y => x + y; } public static float Add(float x, float y) { return x + y; } public static Func<float, float> Add(float x) { return y => x + y; } public static double Add(double x, double y) { return x + y; } public static Func<double, double> Add(double x) { return y => x + y; } public static decimal Add(decimal x, decimal y) { return x + y; } public static Func<decimal, decimal> Add(decimal x) { return y => x + y; } } }
mit
C#
a5a9197ea9a457613ac31e0afb95bf29053ef00e
Update VehicleType.cs
vivet/GoogleApi
GoogleApi/Entities/Maps/Directions/Response/Enums/VehicleType.cs
GoogleApi/Entities/Maps/Directions/Response/Enums/VehicleType.cs
namespace GoogleApi.Entities.Maps.Directions.Response.Enums { /// <summary> /// VehicleType. /// </summary> public enum VehicleType { /// <summary> /// All other vehicles will return this type. /// </summary> Other, /// <summary> /// Rail. /// </summary> Rail, /// <summary> /// Light rail transit. /// </summary> Metro_Rail, /// <summary> /// Underground light rail. /// </summary> Subway, /// <summary> /// Above ground light rail. /// </summary> Tram, /// <summary> /// Monorail. /// </summary> Monorail, /// <summary> /// Heavy rail. /// </summary> Heavy_Rail, /// <summary> /// Commuter rail. /// </summary> Commuter_Train, /// <summary> /// High speed train. /// </summary> High_Speed_Train, /// <summary> /// Bus. /// </summary> Bus, /// <summary> /// Intercity bus. /// </summary> Intercity_Bus, /// <summary> /// Trolleybus. /// </summary> Trolleybus, /// <summary> /// Share taxi is a kind of bus with the ability to drop off and pick up passengers anywhere on its route. /// </summary> Share_Taxi, /// <summary> /// Ferry. /// </summary> Ferry, /// <summary> /// A vehicle that operates on a cable, usually on the ground. Aerial cable cars may be of the type GONDOLA_LIFT. /// </summary> Cable_Car, /// <summary> /// An aerial cable car. /// </summary> Gondola_Lift, /// <summary> /// A vehicle that is pulled up a steep incline by a cable. A Funicular typically consists of two cars, with each car acting as a counterweight for the other. /// </summary> Funicular } }
namespace GoogleApi.Entities.Maps.Directions.Response.Enums { /// <summary> /// VehicleType. /// </summary> public enum VehicleType { /// <summary> /// All other vehicles will return this type. /// </summary> Other, /// <summary> /// Rail. /// </summary> Rail, /// <summary> /// Light rail transit. /// </summary> MetroRail, /// <summary> /// Underground light rail. /// </summary> Subway, /// <summary> /// Above ground light rail. /// </summary> Tram, /// <summary> /// Monorail. /// </summary> Monorail, /// <summary> /// Heavy rail. /// </summary> HeavyRail, /// <summary> /// Commuter rail. /// </summary> CommuterTrain, /// <summary> /// High speed train. /// </summary> HighSpeedTrain, /// <summary> /// Bus. /// </summary> Bus, /// <summary> /// Intercity bus. /// </summary> IntercityBus, /// <summary> /// Trolleybus. /// </summary> Trolleybus, /// <summary> /// Share taxi is a kind of bus with the ability to drop off and pick up passengers anywhere on its route. /// </summary> ShareTaxi, /// <summary> /// Ferry. /// </summary> Ferry, /// <summary> /// A vehicle that operates on a cable, usually on the ground. Aerial cable cars may be of the type GONDOLA_LIFT. /// </summary> CableCar, /// <summary> /// An aerial cable car. /// </summary> GondolaLift, /// <summary> /// A vehicle that is pulled up a steep incline by a cable. A Funicular typically consists of two cars, with each car acting as a counterweight for the other. /// </summary> Funicular } }
mit
C#
4abd29d7b280e236edd0f22804693685b0793695
Update Feature1.cs
Mattgyver317/GitTest1,Mattgyver317/GitTest1
ConsoleApp1/ConsoleApp1/Feature1.cs
ConsoleApp1/ConsoleApp1/Feature1.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Feature1 { public int Add() { var x1 = 1; var x2 = 2; var sum = x1 + x2; return sum; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Feature1 { public int Add() { int x1 = 1; int x2 = 2; int sum = x1 + x2; return sum; } } }
mit
C#
bccc0db64d0a53ffcdf7f035c44e5e87d56a6b6a
Remove redundant “private” keywords
lou1306/CIV,lou1306/CIV
CIV/Processes/ProcessProxy.cs
CIV/Processes/ProcessProxy.cs
using System; using System.Collections.Generic; using static CIV.Ccs.CcsParser; namespace CIV.Processes { public class ProcessProxy : IProcess { protected ProcessContext context; protected ProcessFactory factory; IProcess _real; IProcess RealProcess => _real ?? (_real = factory.Create(context)); public ProcessProxy(ProcessFactory factory, ProcessContext context) { this.factory = factory; this.context = context; } IEnumerable<Transition> IProcess.Transitions() => RealProcess.Transitions(); } }
using System; using System.Collections.Generic; using static CIV.Ccs.CcsParser; namespace CIV.Processes { public class ProcessProxy : IProcess { protected ProcessContext context; protected ProcessFactory factory; private IProcess _real; private IProcess RealProcess => _real ?? (_real = factory.Create(context)); public ProcessProxy(ProcessFactory factory, ProcessContext context) { this.factory = factory; this.context = context; } IEnumerable<Transition> IProcess.Transitions() => RealProcess.Transitions(); } }
mit
C#
9c388682286b8a778fcfb627c6c717677c11a4c9
Add missing end parenthesis
momo-the-monster/workshop-trails
Assets/PDXcc/Trails/Code/SetLabelFromBlendmode.cs
Assets/PDXcc/Trails/Code/SetLabelFromBlendmode.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; namespace pdxcc { [RequireComponent(typeof(Text))] public class SetLabelFromBlendmode : MonoBehaviour { internal Text field; void OnEnable() { MomoMirror.OnSwitched += OnSwitched; } void OnDisable() { MomoMirror.OnSwitched -= OnSwitched; } void Start() { field = GetComponent<Text>(); } void OnSwitched ( MomoMirror.BlendModes b ) { field.text = "Blend: " + b.ToString(); } } }
using UnityEngine; using System.Collections; using UnityEngine.UI; namespace pdxcc { [RequireComponent(typeof(Text)] public class SetLabelFromBlendmode : MonoBehaviour { internal Text field; void OnEnable() { MomoMirror.OnSwitched += OnSwitched; } void OnDisable() { MomoMirror.OnSwitched -= OnSwitched; } void Start() { field = GetComponent<Text>(); } void OnSwitched ( MomoMirror.BlendModes b ) { field.text = "Blend: " + b.ToString(); } } }
mit
C#
001c1e5d0fe04323caae7571bc075a61c8fab4bf
Adjust log file path
StefanoFiumara/Harry-Potter-Unity
Assets/Scripts/HarryPotterUnity/Utils/HPLogger.cs
Assets/Scripts/HarryPotterUnity/Utils/HPLogger.cs
using System; using System.IO; using UnityEngine; namespace HarryPotterUnity.Utils { public static class HpLogger { private static readonly string LogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "HP-TCG.log"); static HpLogger() { File.WriteAllText(LogFilePath, string.Empty); using (var writer = new StreamWriter(LogFilePath)) { writer.WriteLine("------------------------------------"); writer.WriteLine("------- Harry Potter TCG Log -------"); writer.WriteLine("------------------------------------"); writer.WriteLine("Current Time: {0:MMM dd yyyy HH:mm:ss}", DateTime.Now); writer.WriteLine(); } } public static void Write(string text) { using (var writer = new StreamWriter(LogFilePath, append: true)) { string msg = string.Format("{0:HH:mm:ss} -- {1}", DateTime.Now, text); writer.WriteLine(msg); } Debug.Log(text); } } }
using System; using System.IO; using UnityEngine; namespace HarryPotterUnity.Utils { public static class HpLogger { private static readonly string LogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "HP-TCG-LOG.txt"); static HpLogger() { File.WriteAllText(LogFilePath, string.Empty); using (var writer = new StreamWriter(LogFilePath)) { writer.WriteLine("------------------------------------"); writer.WriteLine("------- Harry Potter TCG Log -------"); writer.WriteLine("------------------------------------"); writer.WriteLine("Current Time: {0:YYYY MM-dd HH:mm:ss}", DateTime.Now); writer.WriteLine(); } } public static void Write(string text) { using (var writer = new StreamWriter(LogFilePath, append: true)) { string msg = string.Format("{0:MM-dd HH:mm:ss} -- {1}", DateTime.Now, text); writer.WriteLine(msg); } Debug.Log(text); } } }
mit
C#
16caec9b6beb823fa33d4b5a71929b10494917d8
Bump version to 15.2.0.33717
HearthSim/HearthDb
HearthDb/Properties/AssemblyInfo.cs
HearthDb/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("HearthDb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HearthSim")] [assembly: AssemblyProduct("HearthDb")] [assembly: AssemblyCopyright("Copyright © HearthSim 2019")] [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("7ed14243-e02b-4b94-af00-a67a62c282f0")] // 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("15.2.0.33717")] [assembly: AssemblyFileVersion("15.2.0.33717")]
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("HearthDb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HearthSim")] [assembly: AssemblyProduct("HearthDb")] [assembly: AssemblyCopyright("Copyright © HearthSim 2019")] [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("7ed14243-e02b-4b94-af00-a67a62c282f0")] // 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("15.0.4.33402")] [assembly: AssemblyFileVersion("15.0.4.33402")]
mit
C#
f86641db945bcf9e2f2c7fd8b1079fc2c977e95d
add tests for extra interface aggregates
Pondidum/Ledger,Pondidum/Ledger
Ledger.Tests/AggregateStoreTests.cs
Ledger.Tests/AggregateStoreTests.cs
using System; using System.Collections.Generic; using System.Linq; using Ledger.Acceptance.TestObjects; using Ledger.Infrastructure; using Ledger.Stores; using Shouldly; using Xunit; namespace Ledger.Tests { public class AggregateStoreTests { private readonly InMemoryEventStore<Guid> _backing; private readonly AggregateStore<Guid> _store; public AggregateStoreTests() { _backing = new InMemoryEventStore<Guid>(); _store = new AggregateStore<Guid>(_backing); } [Fact] public void When_a_single_event_is_saved() { var aggregate = new TestAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<TestAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(0); aggregate .SequenceID .ShouldBe(0); } [Fact] public void When_multiple_events_are_saved() { var aggregate = new TestAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); aggregate.AddEvent(new TestEvent()); aggregate.AddEvent(new TestEvent()); aggregate.AddEvent(new TestEvent()); _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<TestAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(3); aggregate .SequenceID .ShouldBe(3); } [Fact] public void When_an_event_is_saved_onto_a_saved_aggregate() { var aggregate = new TestAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); //0 aggregate.AddEvent(new TestEvent()); //1 aggregate.AddEvent(new TestEvent()); //2 aggregate.AddEvent(new TestEvent()); //3 _store.Save(aggregate); aggregate.AddEvent(new TestEvent()); //4 _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<TestAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(4); aggregate .SequenceID .ShouldBe(4); } [Fact] public void When_the_aggregate_implements_another_interface() { var aggregate = new InterfaceAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<InterfaceAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(0); aggregate .SequenceID .ShouldBe(0); } public interface IKeyed { string Key { get; } } public class InterfaceAggregate : AggregateRoot<Guid>, IKeyed { public string Key { get; set; } public void AddEvent(DomainEvent @event) { ApplyEvent(@event); } public void AddEvents(IEnumerable<DomainEvent> events) { events.ForEach(AddEvent); } private void Handle(TestEvent @event) { } public void GenerateID() { ID = Guid.NewGuid(); } } } }
using System; using System.Linq; using Ledger.Acceptance.TestObjects; using Ledger.Stores; using Shouldly; using Xunit; namespace Ledger.Tests { public class AggregateStoreTests { private readonly InMemoryEventStore<Guid> _backing; private readonly AggregateStore<Guid> _store; public AggregateStoreTests() { _backing = new InMemoryEventStore<Guid>(); _store = new AggregateStore<Guid>(_backing); } [Fact] public void When_a_single_event_is_saved() { var aggregate = new TestAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<TestAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(0); aggregate .SequenceID .ShouldBe(0); } [Fact] public void When_multiple_events_are_saved() { var aggregate = new TestAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); aggregate.AddEvent(new TestEvent()); aggregate.AddEvent(new TestEvent()); aggregate.AddEvent(new TestEvent()); _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<TestAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(3); aggregate .SequenceID .ShouldBe(3); } [Fact] public void When_an_event_is_saved_onto_a_saved_aggregate() { var aggregate = new TestAggregate(); aggregate.GenerateID(); aggregate.AddEvent(new TestEvent()); //0 aggregate.AddEvent(new TestEvent()); //1 aggregate.AddEvent(new TestEvent()); //2 aggregate.AddEvent(new TestEvent()); //3 _store.Save(aggregate); aggregate.AddEvent(new TestEvent()); //4 _store.Save(aggregate); _backing .LoadEvents(_store.Conventions<TestAggregate>(), aggregate.ID) .Last() .Sequence .ShouldBe(4); aggregate .SequenceID .ShouldBe(4); } } }
lgpl-2.1
C#
ad0ea92b07b588cf960facaa3b09270fe394e16d
Edit the assembly description and release 2.0.0.0
bobus15/proshine,Silv3rPRO/proshine,MeltWS/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.0.0.0")] [assembly: AssemblyFileVersion("2.0.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 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.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
43a52c414c045e51afe6c531fad1f06f91ed9f5a
Bump version to 1.5.2
milkshakesoftware/PreMailer.Net,kendallb/PreMailer.Net
PreMailer.Net/GlobalAssemblyInfo.cs
PreMailer.Net/GlobalAssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: AssemblyProduct("PreMailer.Net")] [assembly: AssemblyCompany("Milkshake Software")] [assembly: AssemblyCopyright("Copyright © Milkshake Software 2016")] [assembly: AssemblyVersion("1.5.2.0")] [assembly: AssemblyFileVersion("1.5.2.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: AssemblyProduct("PreMailer.Net")] [assembly: AssemblyCompany("Milkshake Software")] [assembly: AssemblyCopyright("Copyright © Milkshake Software 2016")] [assembly: AssemblyVersion("1.5.1.0")] [assembly: AssemblyFileVersion("1.5.1.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif
mit
C#
4622de907721385b894c1e85d7694e85748eab9a
change to custom IQueryable interface
YoloDev/elephanet,jmkelly/elephanet,YoloDev/elephanet,jmkelly/elephanet
Elephanet/IDocumentSession.cs
Elephanet/IDocumentSession.cs
using System; using System.Collections.Generic; using System.Linq; namespace Elephanet { public interface IDocumentSession : IDisposable { void Delete<T>(T entity); T Load<T>(Guid id); T[] Load<T>(params Guid[] ids); T[] Load<T>(IEnumerable<Guid> ids); IJsonbQueryable<T> Query<T>(); void SaveChanges(); void Store<T>(T entity); } }
using System; using System.Collections.Generic; using System.Linq; namespace Elephanet { public interface IDocumentSession : IDisposable { void Delete<T>(T entity); T Load<T>(Guid id); T[] Load<T>(params Guid[] ids); T[] Load<T>(IEnumerable<Guid> ids); IQueryable<T> Query<T>(); void SaveChanges(); void Store<T>(T entity); } }
mit
C#
db2fd22e538b1508ba4c921c406038fb05f2a799
Add implement class LuryException
lury-lang/lury,nokok/lury,HaiTo/lury
src/Lury/Runtime/Exception/LuryException.cs
src/Lury/Runtime/Exception/LuryException.cs
// // LuryException.cs // // Author: // Tomona Nanase <[email protected]> // // The MIT License (MIT) // // Copyright (c) 2015 Tomona Nanase // // 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 Lury.Compiling.Lexer; using Lury.Compiling.Utils; namespace Lury.Runtime { public class LuryException : Exception { #region -- Public Methods -- public LuryExceptionType ExceptionType { get; private set; } public string SourceCode { get; private set; } public CharPosition Position { get; private set; } public int CharLength { get; private set; } #endregion #region -- Constructors -- public LuryException(LuryExceptionType type, params object[] messageParams) : this(type, null, CharPosition.Empty, 0, messageParams) { } public LuryException(LuryExceptionType type, Token token, params object[] messageParams) : this(type, token.SourceCode, token.Position, token.Length, messageParams) { } public LuryException(LuryExceptionType type, string sourceCode, CharPosition position, int length, params object[] messageParams) { this.ExceptionType = type; this.SourceCode = sourceCode; this.Position = position; this.CharLength = length; this.Message = type.GetMessage(messageParams); } #endregion } }
// // LuryException.cs // // Author: // Tomona Nanase <[email protected]> // // The MIT License (MIT) // // Copyright (c) 2015 Tomona Nanase // // 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 Lury.Compiling.Lexer; using Lury.Compiling.Utils; namespace Lury.Runtime { public abstract class LuryException : Exception { public LuryException(LuryExceptionType type) { throw new NotImplementedException(); } public LuryException(LuryExceptionType type, Token token) { throw new NotImplementedException(); } public LuryException(LuryExceptionType type, string source, CharPosition position, int length) { throw new NotImplementedException(); } } }
mit
C#
e2dec29fad652a19912d0cce4ca364d407dc0960
Add some exception handling
SteveLasker/AspNetCoreMultiProject,SteveLasker/AspNetCoreMultiProject
src/Web/Controllers/Magic8BallController.cs
src/Web/Controllers/Magic8BallController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using System.Net.Http; using Newtonsoft.Json; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace Web.Controllers { public class Magic8BallController : Controller { private string _doSomethingBaseAddress; private string _doSomethingAPIUrl; public Magic8BallController() { _doSomethingBaseAddress = "http://api"; _doSomethingAPIUrl = "/Magic8Ball"; } // GET: /<controller>/ public async Task<IActionResult> Index() { HttpResponseMessage response = null; // // Get the HttpRequest // try { HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, _doSomethingBaseAddress + _doSomethingAPIUrl); response = await client.SendAsync(request); } catch (Exception ex) { Console.WriteLine(ex.ToString()); // eat the exception for now... } // // Return a response from the Crazy 8 Ball Service // if (response != null && response.IsSuccessStatusCode) { List<Dictionary<String, String>> responseElements = new List<Dictionary<String, String>>(); JsonSerializerSettings settings = new JsonSerializerSettings(); String responseString = await response.Content.ReadAsStringAsync(); ViewData["Answer"] = responseString; } return View(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using System.Net.Http; using Newtonsoft.Json; // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 namespace Web.Controllers { public class Magic8BallController : Controller { private string _doSomethingBaseAddress; private string _doSomethingAPIUrl; public Magic8BallController() { _doSomethingBaseAddress = "http://api"; _doSomethingAPIUrl = "/Magic8Ball"; } // GET: /<controller>/ public async Task<IActionResult> Index() { // // Get the HttpRequest // HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, _doSomethingBaseAddress + _doSomethingAPIUrl); HttpResponseMessage response = await client.SendAsync(request); // // Return a response from the Crazy 8 Ball Service // if (response.IsSuccessStatusCode) { List<Dictionary<String, String>> responseElements = new List<Dictionary<String, String>>(); JsonSerializerSettings settings = new JsonSerializerSettings(); String responseString = await response.Content.ReadAsStringAsync(); ViewData["Answer"] = responseString; } return View(); } } }
mit
C#
c19a9093d62763a463ea1e3f706e5afe8be189ab
Fix out of sync bugs
insthync/LiteNetLibManager,insthync/LiteNetLibManager
Scripts/GameApi/LiteNetLibPlayer.cs
Scripts/GameApi/LiteNetLibPlayer.cs
using System.Collections; using System.Collections.Generic; using LiteNetLib; namespace LiteNetLibHighLevel { public class LiteNetLibPlayer { public LiteNetLibGameManager Manager { get; protected set; } public NetPeer Peer { get; protected set; } public long ConnectId { get { return Peer.ConnectId; } } internal readonly Dictionary<uint, LiteNetLibIdentity> SpawnedObjects = new Dictionary<uint, LiteNetLibIdentity>(); public LiteNetLibPlayer(LiteNetLibGameManager manager, NetPeer peer) { Manager = manager; Peer = peer; } internal void DestoryAllObjects() { var objectIds = new List<uint>(SpawnedObjects.Keys); foreach (var objectId in objectIds) Manager.Assets.NetworkDestroy(objectId); } } }
using System.Collections; using System.Collections.Generic; using LiteNetLib; namespace LiteNetLibHighLevel { public class LiteNetLibPlayer { public LiteNetLibGameManager Manager { get; protected set; } public NetPeer Peer { get; protected set; } public long ConnectId { get { return Peer.ConnectId; } } public readonly Dictionary<uint, LiteNetLibIdentity> SpawnedObjects = new Dictionary<uint, LiteNetLibIdentity>(); public LiteNetLibPlayer(LiteNetLibGameManager manager, NetPeer peer) { Manager = manager; Peer = peer; } internal void DestoryAllObjects() { foreach (var spawnedObject in SpawnedObjects) Manager.Assets.NetworkDestroy(spawnedObject.Key); } } }
mit
C#
9327a571ac267a38500149ca84f8c419d77e8b84
Fix string format in error message
ZocDoc/ZocBuild.Database
ZocBuild.Database/Errors/MismatchedSchemaError.cs
ZocBuild.Database/Errors/MismatchedSchemaError.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZocBuild.Database.Errors { public class MismatchedSchemaError : BuildErrorBase { public MismatchedSchemaError(string objectName, string expected, string actual) { ActualSchemaName = actual; ExpectedSchemaName = expected; ObjectName = objectName; } public string ActualSchemaName { get; private set; } public string ExpectedSchemaName { get; private set; } public string ObjectName { get; private set; } public override string ErrorType { get { return "Mismatched Schema"; } } public override string GetMessage() { return string.Format("Cannot use script of schema {2} for {0} when expecting schema {1}.", ObjectName, ExpectedSchemaName, ActualSchemaName); } public override BuildItem.BuildStatusType Status { get { return BuildItem.BuildStatusType.ScriptError; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ZocBuild.Database.Errors { public class MismatchedSchemaError : BuildErrorBase { public MismatchedSchemaError(string objectName, string expected, string actual) { ActualSchemaName = actual; ExpectedSchemaName = expected; ObjectName = objectName; } public string ActualSchemaName { get; private set; } public string ExpectedSchemaName { get; private set; } public string ObjectName { get; private set; } public override string ErrorType { get { return "Mismatched Schema"; } } public override string GetMessage() { return string.Format("Cannot use script of schema {2} for {1} when expecting schema {0}.", ObjectName, ExpectedSchemaName, ActualSchemaName); } public override BuildItem.BuildStatusType Status { get { return BuildItem.BuildStatusType.ScriptError; } } } }
mit
C#
99d769e55753dca3c3a514c4ed9c41ce7d5d10c4
update to fix test resources tobe found again
ericnewton76/gmaps-api-net
src/Google.Maps.Test/Integrations/HttpGetResponseFromResource.cs
src/Google.Maps.Test/Integrations/HttpGetResponseFromResource.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; using System.IO; namespace Google.Maps.Test.Integrations { public class HttpGetResponseFromResource : Google.Maps.Internal.Http.HttpGetResponse { System.Reflection.Assembly S_testAssembly = Assembly.GetAssembly(typeof(HttpGetResponseFromResource)); public HttpGetResponseFromResource(Uri uri) : base(uri) { } private string _resourcePath; public string BaseResourcePath { get { return this._resourcePath; } set { this._resourcePath = value; } } protected override System.IO.StreamReader GetStreamReader(Uri uri) { string outputType = uri.Segments[uri.Segments.Length - 1]; System.Text.StringBuilder queryString = new StringBuilder(uri.OriginalString.Substring(uri.OriginalString.IndexOf("?") + 1)); queryString.Replace("&sensor=false", ""); //clear off sensor=false queryString.Replace("&sensor=true", ""); // clear off sensor=true //have to replace certain characters that wont work for a path queryString.Replace("&", "$") .Replace("%20", "+") .Replace("%2C", ",") .Replace("|", "!") .Replace("%", "~"); string resourcePath = this.BaseResourcePath + string.Format(".{0}_queries.{1}.{0}", outputType, queryString.ToString()); Stream resourceStream = S_testAssembly.GetManifestResourceStream(resourcePath); if(resourceStream == null) { string message = string.Format( @"Failed to find resource for query '{0}'. BaseResourcePath: '{2}' Resource path used: '{1}' Ensure a file exists at that resource path and the file has its Build Action set to ""Embedded Resource"".", queryString.ToString(), resourcePath, BaseResourcePath); throw new FileNotFoundException(message); } return new StreamReader(resourceStream); } } public class HttpGetResponseFromResourceFactory : Google.Maps.Internal.Http.HttpGetResponseFactory { public HttpGetResponseFromResourceFactory(string baseResourcePath) { this.BaseResourcePath = baseResourcePath; } public string BaseResourcePath { get; set; } public override Internal.Http.HttpGetResponse CreateResponse(Uri uri) { return new HttpGetResponseFromResource(uri) { BaseResourcePath = this.BaseResourcePath }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; using System.IO; namespace Google.Maps.Test.Integrations { public class HttpGetResponseFromResource : Google.Maps.Internal.Http.HttpGetResponse { System.Reflection.Assembly S_testAssembly = Assembly.GetAssembly(typeof(HttpGetResponseFromResource)); public HttpGetResponseFromResource(Uri uri) : base(uri) { } private string _resourcePath; public string BaseResourcePath { get { return this._resourcePath; } set { this._resourcePath = value; } } protected override System.IO.StreamReader GetStreamReader(Uri uri) { string outputType = uri.Segments[uri.Segments.Length - 1]; System.Text.StringBuilder queryString = new StringBuilder(uri.OriginalString.Substring(uri.OriginalString.IndexOf("?") + 1)); queryString.Replace("&sensor=false", ""); //clear off sensor=false queryString.Replace("&sensor=true", ""); // clear off sensor=true //have to replace any remaining ampersands with $ due to filename limitations. queryString.Replace("&", "$").Replace("|", "!").Replace("%", "~"); string resourcePath = this.BaseResourcePath + string.Format(".{0}_queries.{1}.{0}", outputType, queryString.ToString()); Stream resourceStream = S_testAssembly.GetManifestResourceStream(resourcePath); if(resourceStream == null) { string message = string.Format( @"Failed to find resource for query '{0}'. BaseResourcePath: '{2}' Resource path used: '{1}' Ensure a file exists at that resource path and the file has its Build Action set to ""Embedded Resource"".", queryString.ToString(), resourcePath, BaseResourcePath); throw new FileNotFoundException(message); } return new StreamReader(resourceStream); } } public class HttpGetResponseFromResourceFactory : Google.Maps.Internal.Http.HttpGetResponseFactory { public HttpGetResponseFromResourceFactory(string baseResourcePath) { this.BaseResourcePath = baseResourcePath; } public string BaseResourcePath { get; set; } public override Internal.Http.HttpGetResponse CreateResponse(Uri uri) { return new HttpGetResponseFromResource(uri) { BaseResourcePath = this.BaseResourcePath }; } } }
apache-2.0
C#
283fc2c21663a00345f9e95981b67265789cceea
Update IQuoteRepository.cs
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,halitalf/NadekoMods,Youngsie1997/NadekoBot,Nielk1/NadekoBot,miraai/NadekoBot,Taknok/NadekoBot,powered-by-moe/MikuBot,ShadowNoire/NadekoBot,Blacnova/NadekoBot,shikhir-arora/NadekoBot,ScarletKuro/NadekoBot,WoodenGlaze/NadekoBot,Midnight-Myth/Mitternacht-NEW,PravEF/EFNadekoBot,Midnight-Myth/Mitternacht-NEW,gfrewqpoiu/NadekoBot,Grinjr/NadekoBot
src/NadekoBot/Services/Database/Repositories/IQuoteRepository.cs
src/NadekoBot/Services/Database/Repositories/IQuoteRepository.cs
using NadekoBot.Services.Database.Models; using System.Collections.Generic; using System.Threading.Tasks; namespace NadekoBot.Services.Database.Repositories { public interface IQuoteRepository : IRepository<Quote> { IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword); Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword); Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text); IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take); } }
using NadekoBot.Services.Database.Models; using System.Collections.Generic; using System.Threading.Tasks; namespace NadekoBot.Services.Database.Repositories { public interface IQuoteRepository : IRepository<Quote> { IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword); Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword); IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take); } }
mit
C#
c45e6b3d58af63299aea992848370fced532c6e8
Make ConnectHelper.ConnectAsync return ValueTask<Stream> (#24244)
ravimeda/corefx,zhenlan/corefx,Jiayili1/corefx,seanshpark/corefx,ericstj/corefx,shimingsg/corefx,tijoytom/corefx,wtgodbe/corefx,wtgodbe/corefx,wtgodbe/corefx,parjong/corefx,twsouthwick/corefx,ptoonen/corefx,Jiayili1/corefx,Ermiar/corefx,ravimeda/corefx,Ermiar/corefx,axelheer/corefx,ericstj/corefx,axelheer/corefx,ericstj/corefx,shimingsg/corefx,seanshpark/corefx,Jiayili1/corefx,shimingsg/corefx,zhenlan/corefx,fgreinacher/corefx,Ermiar/corefx,ravimeda/corefx,seanshpark/corefx,ViktorHofer/corefx,tijoytom/corefx,seanshpark/corefx,shimingsg/corefx,ravimeda/corefx,parjong/corefx,wtgodbe/corefx,shimingsg/corefx,Ermiar/corefx,parjong/corefx,zhenlan/corefx,zhenlan/corefx,Jiayili1/corefx,seanshpark/corefx,parjong/corefx,ViktorHofer/corefx,BrennanConroy/corefx,wtgodbe/corefx,ericstj/corefx,mmitche/corefx,axelheer/corefx,Ermiar/corefx,fgreinacher/corefx,mmitche/corefx,axelheer/corefx,twsouthwick/corefx,wtgodbe/corefx,axelheer/corefx,ViktorHofer/corefx,twsouthwick/corefx,twsouthwick/corefx,zhenlan/corefx,BrennanConroy/corefx,axelheer/corefx,parjong/corefx,ptoonen/corefx,Jiayili1/corefx,parjong/corefx,ptoonen/corefx,tijoytom/corefx,ptoonen/corefx,tijoytom/corefx,tijoytom/corefx,mmitche/corefx,ptoonen/corefx,ViktorHofer/corefx,ravimeda/corefx,ravimeda/corefx,ravimeda/corefx,tijoytom/corefx,Ermiar/corefx,parjong/corefx,mmitche/corefx,shimingsg/corefx,tijoytom/corefx,twsouthwick/corefx,seanshpark/corefx,Jiayili1/corefx,BrennanConroy/corefx,zhenlan/corefx,ericstj/corefx,zhenlan/corefx,ViktorHofer/corefx,seanshpark/corefx,wtgodbe/corefx,ericstj/corefx,fgreinacher/corefx,mmitche/corefx,ViktorHofer/corefx,ptoonen/corefx,twsouthwick/corefx,ptoonen/corefx,mmitche/corefx,Jiayili1/corefx,ViktorHofer/corefx,shimingsg/corefx,fgreinacher/corefx,twsouthwick/corefx,mmitche/corefx,ericstj/corefx,Ermiar/corefx
src/System.Net.Http/src/System/Net/Http/Managed/ConnectHelper.cs
src/System.Net.Http/src/System/Net/Http/Managed/ConnectHelper.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. using System.IO; using System.Net.Sockets; using System.Threading.Tasks; namespace System.Net.Http { internal static class ConnectHelper { public static async ValueTask<Stream> ConnectAsync(string host, int port) { var socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; try { // TODO #23151: cancellation support? await (IPAddress.TryParse(host, out IPAddress address) ? socket.ConnectAsync(address, port) : socket.ConnectAsync(host, port)).ConfigureAwait(false); } catch (SocketException se) { socket.Dispose(); throw new HttpRequestException(se.Message, se); } return new NetworkStream(socket, ownsSocket: true); } } }
// 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. using System.Net.Sockets; using System.Threading.Tasks; namespace System.Net.Http { internal static class ConnectHelper { public static async ValueTask<NetworkStream> ConnectAsync(string host, int port) { var socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; try { // TODO #23151: cancellation support? await (IPAddress.TryParse(host, out IPAddress address) ? socket.ConnectAsync(address, port) : socket.ConnectAsync(host, port)).ConfigureAwait(false); } catch (SocketException se) { socket.Dispose(); throw new HttpRequestException(se.Message, se); } return new NetworkStream(socket, ownsSocket: true); } } }
mit
C#
a827b5583f1a11287f4443ed0adec61fb783cd3d
Fix typo
tgstation/tgstation-server-tools,tgstation/tgstation-server,tgstation/tgstation-server
src/Tgstation.Server.Host/Database/PostgresSqlDatabaseContext.cs
src/Tgstation.Server.Host/Database/PostgresSqlDatabaseContext.cs
using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Diagnostics; using Tgstation.Server.Host.Configuration; namespace Tgstation.Server.Host.Database { /// <summary> /// <see cref="DatabaseContext{TParentContext}"/> for PostgresSQL. /// </summary> sealed class PostgresSqlDatabaseContext : DatabaseContext<PostgresSqlDatabaseContext> { /// <summary> /// Construct a <see cref="SqlServerDatabaseContext"/> /// </summary> /// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param> /// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext{TParentContext}"/></param> /// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext{TParentContext}"/></param> /// <param name="logger">The <see cref="ILogger"/> for the <see cref="DatabaseContext{TParentContext}"/></param> public PostgresSqlDatabaseContext( DbContextOptions<PostgresSqlDatabaseContext> dbContextOptions, IOptions<DatabaseConfiguration> databaseConfiguration, IDatabaseSeeder databaseSeeder, ILogger<PostgresSqlDatabaseContext> logger) : base(dbContextOptions, databaseConfiguration, databaseSeeder, logger) { } /// <inheritdoc /> protected override void OnConfiguring(DbContextOptionsBuilder options) { base.OnConfiguring(options); options.UseNpgsql(DatabaseConfiguration.ConnectionString, x => x.EnableRetryOnFailure()); } /// <inheritdoc /> protected override void ValidateDatabaseType() { if (!Debugger.IsAttached) throw new NotImplementedException("PostgresSQL implementation is not complete yet!"); if (DatabaseType != DatabaseType.PostgresSql) throw new InvalidOperationException("Invalid DatabaseType for PostgresSqlDatabaseContext!"); } } }
using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Diagnostics; using Tgstation.Server.Host.Configuration; namespace Tgstation.Server.Host.Database { /// <summary> /// <see cref="DatabaseContext{TParentContext}"/> for PostgresSQL. /// </summary> sealed class PostgresSqlDatabaseContext : DatabaseContext<PostgresSqlDatabaseContext> { /// <summary> /// Construct a <see cref="SqlServerDatabaseContext"/> /// </summary> /// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param> /// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext{TParentContext}"/></param> /// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext{TParentContext}"/></param> /// <param name="logger">The <see cref="ILogger"/> for the <see cref="DatabaseContext{TParentContext}"/></param> public PostgresSqlDatabaseContext( DbContextOptions<PostgresSqlDatabaseContext> dbContextOptions, IOptions<DatabaseConfiguration> databaseConfiguration, IDatabaseSeeder databaseSeeder, ILogger<PostgresSqlDatabaseContext> logger) : base(dbContextOptions, databaseConfiguration, databaseSeeder, logger) { } /// <inheritdoc /> protected override void OnConfiguring(DbContextOptionsBuilder options) { base.OnConfiguring(options); options.UseNpgsql(DatabaseConfiguration.ConnectionString, x => x.EnableRetryOnFailure()); } /// <inheritdoc /> protected override void ValidateDatabaseType() { if (!Debugger.IsAttached) throw new NotImplementedException("PostgresSQL implementation is not complete yet!"); if (DatabaseType != DatabaseType.PostgresSql) throw new InvalidOperationException("Invalid DatabaseType for SqliteDatabaseContext!"); } } }
agpl-3.0
C#
527ef91396ce2715acf21c7d96e08373bca1f596
fix #14
nerai/Unlog
src/Unlog.AdditionalTargets/WpfRtfLogTarget.cs
src/Unlog.AdditionalTargets/WpfRtfLogTarget.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; using Unlog; using Unlog.Util; namespace Unlog.AdditionalTargets { public class WpfRtfLogTarget : ILogTarget { private readonly RichTextBox _RTF; private Color _Fore; private Color _Back; public WpfRtfLogTarget (RichTextBox rtf) { _RTF = rtf; ResetColors (); } public void Write (string s) { _RTF.Dispatcher.Invoke ((Action) (() => { var range = new TextRange (_RTF.Document.ContentEnd, _RTF.Document.ContentEnd); range.Text = s; range.ApplyPropertyValue (TextElement.ForegroundProperty, new SolidColorBrush (_Fore)); range.ApplyPropertyValue (TextElement.BackgroundProperty, new SolidColorBrush (_Back)); _RTF.ScrollToEnd (); })); } public void SetForegroundColor (ConsoleColor c) { var dcol = c.ToRGB (); _Fore = Color.FromArgb (dcol.A, dcol.R, dcol.G, dcol.B); } public void SetBackgroundColor (ConsoleColor c) { var dcol = c.ToRGB (); _Back = Color.FromArgb (dcol.A, dcol.R, dcol.G, dcol.B); } public void ResetColors () { _Fore = Colors.Black; _Back = Colors.White; } public void Flush () { // empty } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; using Unlog; using Unlog.Util; namespace Unlog.AdditionalTargets { public class WpfRtfLogTarget : ILogTarget { private readonly RichTextBox _RTF; private System.Drawing.Color? _Fore = null; private System.Drawing.Color? _Back = null; public WpfRtfLogTarget (RichTextBox rtf) { _RTF = rtf; } public void Write (string s) { _RTF.Dispatcher.Invoke ((Action) (() => { var range = new TextRange (_RTF.Document.ContentEnd, _RTF.Document.ContentEnd); range.Text = s; if (_Fore != null) { var dcol = _Fore.Value; var mcol = Color.FromArgb (dcol.A, dcol.R, dcol.G, dcol.B); var brush = new SolidColorBrush (mcol); range.ApplyPropertyValue (TextElement.ForegroundProperty, brush); } if (_Back != null) { var dcol = _Back.Value; var mcol = Color.FromArgb (dcol.A, dcol.R, dcol.G, dcol.B); var brush = new SolidColorBrush (mcol); range.ApplyPropertyValue (TextElement.BackgroundProperty, brush); } _RTF.ScrollToEnd (); })); } public void SetForegroundColor (ConsoleColor c) { _Fore = c.ToRGB (); } public void SetBackgroundColor (ConsoleColor c) { _Back = c.ToRGB (); } public void ResetColors () { _Fore = null; _Back = null; } public void Flush () { // empty } } }
mit
C#
dc457a0445cb0c845c2364bce4a7e7b97ee2c425
Replace test Guid with empty Guid.
WillemRB/serilog-sinks-glip
test/GlipTests.cs
test/GlipTests.cs
using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using Serilog.Events; using Serilog.Parsing; namespace Serilog.Sinks.Glip.Tests { [TestClass] public class GlipTests { private ILogger _logger; [TestInitialize] public void Initialize() { var webhook = Guid.Parse("00000000-0000-0000-0000-000000000000"); _logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.Sink(new GlipSink(webhook)) .CreateLogger(); } [TestMethod] public void HelloWorldTest() { _logger.Information("Hello World"); } [TestMethod] public void PropertyTest() { var properties = new List<LogEventProperty>(); properties.Add(new LogEventProperty("activity", new ScalarValue("Activity"))); properties.Add(new LogEventProperty("body", new ScalarValue("Body"))); properties.Add(new LogEventProperty("icon", new ScalarValue("http://tinyurl.com/pn46fgp"))); properties.Add(new LogEventProperty("title", new ScalarValue("Title"))); var messageTemplate = new MessageTemplateParser().Parse("The value of the 'body' property: {body}"); var logEvent = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null, messageTemplate, properties); _logger.Write(logEvent); } [TestMethod] public void OtherTest() { var body = "Message Body"; var activity = "Running Tests"; _logger.Write(LogEventLevel.Information, "{body}", body, activity); } } }
using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using Serilog.Events; using Serilog.Parsing; namespace Serilog.Sinks.Glip.Tests { [TestClass] public class GlipTests { private ILogger _logger; [TestInitialize] public void Initialize() { var webhook = Guid.Parse("efc66d30-2f14-4acc-b07b-f27e2cf69cd7"); _logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.Sink(new GlipSink(webhook)) .CreateLogger(); } [TestMethod] public void HelloWorldTest() { _logger.Information("Hello World"); } [TestMethod] public void PropertyTest() { var properties = new List<LogEventProperty>(); properties.Add(new LogEventProperty("activity", new ScalarValue("Activity"))); properties.Add(new LogEventProperty("body", new ScalarValue("Body"))); properties.Add(new LogEventProperty("icon", new ScalarValue("http://tinyurl.com/pn46fgp"))); properties.Add(new LogEventProperty("title", new ScalarValue("Title"))); var messageTemplate = new MessageTemplateParser().Parse("The value of the 'body' property: {body}"); var logEvent = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null, messageTemplate, properties); _logger.Write(logEvent); } [TestMethod] public void OtherTest() { var body = "Message Body"; var activity = "Running Tests"; _logger.Write(LogEventLevel.Information, "{body}", body, activity); } } }
mit
C#
3e25b24d0196663f6f3788aca7b4dd3e19d62420
remove unnecessary comment
rvdkooy/BrockAllen.MembershipReboot,tomascassidy/BrockAllen.MembershipReboot,vinneyk/BrockAllen.MembershipReboot,DosGuru/MembershipReboot,brockallen/BrockAllen.MembershipReboot,eric-swann-q2/BrockAllen.MembershipReboot,vankooch/BrockAllen.MembershipReboot,rajendra1809/BrockAllen.MembershipReboot
BrockAllen.MembershipReboot/Models/UserClaim.cs
BrockAllen.MembershipReboot/Models/UserClaim.cs
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BrockAllen.MembershipReboot { public class UserClaim { [Key] public virtual int ID { get; set; } public virtual string Type { get; set; } public virtual string Value { get; set; } } }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BrockAllen.MembershipReboot { public class UserClaim { [Key] public virtual int ID { get; set; } //public virtual UserAccount User { get; set; } public virtual string Type { get; set; } public virtual string Value { get; set; } } }
bsd-3-clause
C#
bba57874bceb6fa2d3eaea33448fc4475f0939cd
Put UseServices extension method in Microsoft.AspNet
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNet.RequestContainer/ContainerExtensions.cs
src/Microsoft.AspNet.RequestContainer/ContainerExtensions.cs
using System; using System.Reflection; using System.Collections.Generic; using System.Linq; using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.DependencyInjection; using Microsoft.AspNet.DependencyInjection.Fallback; using Microsoft.AspNet.RequestContainer; namespace Microsoft.AspNet { public static class ContainerExtensions { public static IBuilder UseMiddleware(this IBuilder builder, Type middleware, params object[] args) { // TODO: move this ext method someplace nice return builder.Use(next => { var typeActivator = builder.ApplicationServices.GetService<ITypeActivator>(); var instance = typeActivator.CreateInstance(builder.ApplicationServices, middleware, new[] { next }.Concat(args).ToArray()); var methodinfo = middleware.GetTypeInfo().GetDeclaredMethod("Invoke"); return (RequestDelegate)methodinfo.CreateDelegate(typeof(RequestDelegate), instance); }); } public static IBuilder UseServices(this IBuilder builder) { return builder.UseMiddleware(typeof(ContainerMiddleware)); } public static IBuilder UseServices(this IBuilder builder, IServiceProvider applicationServices) { builder.ApplicationServices = applicationServices; return builder.UseMiddleware(typeof(ContainerMiddleware)); } public static IBuilder UseServices(this IBuilder builder, IEnumerable<IServiceDescriptor> applicationServices) { return builder.UseServices(services => services.Add(applicationServices)); } public static IBuilder UseServices(this IBuilder builder, Action<ServiceCollection> configureServices) { var serviceCollection = new ServiceCollection(); configureServices(serviceCollection); builder.ApplicationServices = serviceCollection.BuildServiceProvider(builder.ApplicationServices); return builder.UseMiddleware(typeof(ContainerMiddleware)); } } }
using System; using System.Reflection; using System.Collections.Generic; using System.Linq; using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.DependencyInjection; using Microsoft.AspNet.DependencyInjection.Fallback; namespace Microsoft.AspNet.RequestContainer { public static class ContainerExtensions { public static IBuilder UseMiddleware(this IBuilder builder, Type middleware, params object[] args) { // TODO: move this ext method someplace nice return builder.Use(next => { var typeActivator = builder.ApplicationServices.GetService<ITypeActivator>(); var instance = typeActivator.CreateInstance(builder.ApplicationServices, middleware, new[] { next }.Concat(args).ToArray()); var methodinfo = middleware.GetTypeInfo().GetDeclaredMethod("Invoke"); return (RequestDelegate)methodinfo.CreateDelegate(typeof(RequestDelegate), instance); }); } public static IBuilder UseServices(this IBuilder builder) { return builder.UseMiddleware(typeof(ContainerMiddleware)); } public static IBuilder UseServices(this IBuilder builder, IServiceProvider applicationServices) { builder.ApplicationServices = applicationServices; return builder.UseMiddleware(typeof(ContainerMiddleware)); } public static IBuilder UseServices(this IBuilder builder, IEnumerable<IServiceDescriptor> applicationServices) { return builder.UseServices(services => services.Add(applicationServices)); } public static IBuilder UseServices(this IBuilder builder, Action<ServiceCollection> configureServices) { var serviceCollection = new ServiceCollection(); configureServices(serviceCollection); builder.ApplicationServices = serviceCollection.BuildServiceProvider(builder.ApplicationServices); return builder.UseMiddleware(typeof(ContainerMiddleware)); } } }
apache-2.0
C#
098a77a14154666399bcfb46d7eee97df6433e1a
Implement role assignment.
enarod/enarod-web-api,enarod/enarod-web-api,enarod/enarod-web-api
Infopulse.EDemocracy.Web/Auth/AuthRepository.cs
Infopulse.EDemocracy.Web/Auth/AuthRepository.cs
using Infopulse.EDemocracy.Common.Extensions; using Infopulse.EDemocracy.Web.Auth; using Infopulse.EDemocracy.Web.Auth.Models; using Infopulse.EDemocracy.Web.Models; using Microsoft.AspNet.Identity; using System; using System.Data.Entity; using System.Linq; using System.Threading.Tasks; using Infopulse.EDemocracy.Model.Enum; namespace Infopulse.EDemocracy.Data.Repositories { public class AuthRepository : IDisposable { private AuthContext authContext; private ApplicationUserManager applicationUserManager; public AuthRepository() { authContext = new AuthContext(); applicationUserManager = new ApplicationUserManager(new ApplicationUserStore(authContext)); } public async Task<IdentityResult> RegisterUser(UserModel userModel) { try { var user = new ApplicationUser { UserName = userModel.UserEmail, Email = userModel.UserEmail, EmailConfirmed = false }; var result = await applicationUserManager.CreateAsync(user, userModel.Password); return result; } catch (Exception exc) { throw exc.GetMostInnerException(); } } public async Task<ApplicationUser> FindUser(string userName, string password) { var user = await applicationUserManager.FindAsync(userName, password); return user; } public void AssignRole(string userEmail, params Role[] roles) { var user = authContext.Users .Include(u => u.Roles) .SingleOrDefault(u => u.Email == userEmail); if(user == null) throw new Exception($"User [{userEmail}] not found."); var userRoleIds = user.Roles.Select(ur => ur.RoleId).ToList(); foreach (var role in roles.Where(r => !userRoleIds.Contains((int)r))) { user.Roles.Add(new ApplicationUserRole() { UserId = user.Id, RoleId = (int)role }); } authContext.SaveChanges(); } public void RemoveRole(string userEmail, params Role[] roles) { var user = authContext.Users .Include(u => u.Roles) .SingleOrDefault(u => u.Email == userEmail); if (user == null) throw new Exception($"User [{userEmail}] not found."); var userRoleIds = user.Roles.Select(ur => ur.RoleId).ToList(); foreach (var roleToDelete in roles.Where(r => userRoleIds.Contains((int)r)).Select(role => user.Roles.SingleOrDefault(ur => ur.RoleId == (int)role))) { user.Roles.Remove(roleToDelete); } authContext.SaveChanges(); } public void Dispose() { authContext.Dispose(); applicationUserManager.Dispose(); } } }
using Infopulse.EDemocracy.Common.Extensions; using Infopulse.EDemocracy.Web.Auth; using Infopulse.EDemocracy.Web.Auth.Models; using Infopulse.EDemocracy.Web.Models; using Microsoft.AspNet.Identity; using System; using System.Threading.Tasks; namespace Infopulse.EDemocracy.Data.Repositories { public class AuthRepository : IDisposable { private AuthContext authContext; private ApplicationUserManager applicationUserManager; public AuthRepository() { authContext = new AuthContext(); applicationUserManager = new ApplicationUserManager(new ApplicationUserStore(authContext)); } public async Task<IdentityResult> RegisterUser(UserModel userModel) { try { var user = new ApplicationUser { UserName = userModel.UserEmail, Email = userModel.UserEmail, EmailConfirmed = false }; var result = await applicationUserManager.CreateAsync(user, userModel.Password); return result; } catch (Exception exc) { throw exc.GetMostInnerException(); } } public async Task<ApplicationUser> FindUser(string userName, string password) { var user = await applicationUserManager.FindAsync(userName, password); return user; } public void Dispose() { authContext.Dispose(); applicationUserManager.Dispose(); } } }
cc0-1.0
C#
522b56a017091cc22a6809f76ef78e27bd7ed42b
fix docs
Pathoschild/StardewMods
LookupAnything/Framework/Models/FishData/FishSpawnData.cs
LookupAnything/Framework/Models/FishData/FishSpawnData.cs
using System.Linq; namespace Pathoschild.Stardew.LookupAnything.Framework.Models.FishData { /// <summary>Spawning rules for a fish.</summary> internal class FishSpawnData { /********* ** Accessors *********/ /// <summary>The fish ID.</summary> public int FishID { get; } /// <summary>Where the fish will spawn.</summary> public FishSpawnLocationData[] Locations { get; } /// <summary>When the fish will spawn.</summary> public FishSpawnTimeOfDayData[] TimesOfDay { get; } /// <summary>The weather in which the fish will spawn.</summary> public FishSpawnWeather Weather { get; } /// <summary>The minimum fishing level.</summary> public int MinFishingLevel { get; } /// <summary>Whether the fish can only be caught once.</summary> public bool IsUnique { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="fishID">The fish ID.</param> /// <param name="locations">Where the fish will spawn.</param> /// <param name="timesOfDay">When the fish will spawn.</param> /// <param name="weather">The weather in which the fish will spawn.</param> /// <param name="minFishingLevel">The minimum fishing level.</param> /// <param name="isUnique">Whether the fish can only be caught once.</param> public FishSpawnData(int fishID, FishSpawnLocationData[] locations, FishSpawnTimeOfDayData[] timesOfDay, FishSpawnWeather weather, int minFishingLevel, bool isUnique) { this.FishID = fishID; this.Locations = locations; this.TimesOfDay = timesOfDay; this.Weather = weather; this.MinFishingLevel = minFishingLevel; this.IsUnique = isUnique; } /// <summary>Get whether the fish is available in a given location name.</summary> /// <param name="locationName">The location name to match.</param> public bool MatchesLocation(string locationName) { return this.Locations.Any(p => p.MatchesLocation(locationName)); } } }
using System.Linq; namespace Pathoschild.Stardew.LookupAnything.Framework.Models.FishData { /// <summary>Spawning rules for a fish.</summary> internal class FishSpawnData { /********* ** Accessors *********/ /// <summary>The fish ID.</summary> public int FishID { get; } /// <summary>Where the fish will spawn.</summary> public FishSpawnLocationData[] Locations { get; } /// <summary>When the fish will spawn.</summary> public FishSpawnTimeOfDayData[] TimesOfDay { get; } /// <summary>The weather in which the fish will spawn.</summary> public FishSpawnWeather Weather { get; } /// <summary>The minimum fishing level.</summary> public int MinFishingLevel { get; } /// <summary>Whether the fish can only be caught once.</summary> public bool IsUnique { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="fishID">The fish ID.</param> /// <param name="locations">Where the fish will spawn.</param> /// <param name="timesOfDay">When the fish will spawn.</param> /// <param name="weather">The weather in which the fish will spawn.</param> /// <param name="minFishingLevel">The minimum fishing level.</param> /// <param name="isUnique">Whether the fish can only be caught once.</param> public FishSpawnData(int fishID, FishSpawnLocationData[] locations, FishSpawnTimeOfDayData[] timesOfDay, FishSpawnWeather weather, int minFishingLevel, bool isUnique) { this.FishID = fishID; this.Locations = locations; this.TimesOfDay = timesOfDay; this.Weather = weather; this.MinFishingLevel = minFishingLevel; this.IsUnique = isUnique; } /// <summary>Get whether the fish is available in given location name.</summary> public bool MatchesLocation(string currentLocationName) { return this.Locations.Any(p => p.MatchesLocation(currentLocationName)); } } }
mit
C#
555e3fdca7bdec693fc248126c06821406e375a2
return to good work unit tests for ci on appveyor
wangkanai/Detection
test/DependencyInjection/ApplicationBuilderExtensionsTest.cs
test/DependencyInjection/ApplicationBuilderExtensionsTest.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.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Moq; using Xunit; namespace Wangkanai.Detection.DependencyInjection { public class DetectionApplicationBuilderExtensionsTest { [Fact] public void UseDetection_ThrowsInvalidOptionException_IfDetectionMarkerServiceIsNotRegistered() { // Arrange var serviceProvider = new Mock<IServiceProvider>(); serviceProvider .Setup(s => s.GetService(typeof(ILoggerFactory))) .Returns(Mock.Of<NullLoggerFactory>()); var applicationBuilderMock = new Mock<IApplicationBuilder>(); applicationBuilderMock .Setup(s => s.ApplicationServices) .Returns(serviceProvider.Object); // Act var exception = Assert.Throws<InvalidOperationException>( () => applicationBuilderMock.Object.UseDetection()); // Assert Assert.Equal("AddDetection is not added to ConfigureServices(...)", exception.Message); } } }
// 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.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Moq; using Xunit; namespace Wangkanai.Detection.DependencyInjection { public class DetectionApplicationBuilderExtensionsTest { [Fact] public void UseDetection_ThrowsInvalidOptionException_IfDetectionMarkerServiceIsNotRegistered() { // Arrange var serviceProvider = new Mock<IServiceProvider>(); serviceProvider .Setup(s => s.GetService(typeof(ILoggerFactory))) .Returns(Mock.Of<NullLoggerFactory>()); var applicationBuilderMock = new Mock<IApplicationBuilder>(); applicationBuilderMock .Setup(s => s.ApplicationServices) .Returns(serviceProvider.Object); // Act var exception = Assert.Throws<InvalidOperationException>( () => applicationBuilderMock.Object.UseDetection()); // Assert Assert.Equal("AddDetection() is not added to ConfigureServices(...)", exception.Message); } } }
apache-2.0
C#
5dc54ae24c537db2eee5a3c105031014f10ddec5
Bump version to 0.16.1
ar3cka/Journalist
src/SolutionInfo.cs
src/SolutionInfo.cs
// <auto-generated/> using System.Reflection; [assembly: AssemblyProductAttribute("Journalist")] [assembly: AssemblyVersionAttribute("0.16.1")] [assembly: AssemblyInformationalVersionAttribute("0.16.1")] [assembly: AssemblyFileVersionAttribute("0.16.1")] [assembly: AssemblyCompanyAttribute("Anton Mednonogov")] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.16.1"; } }
// <auto-generated/> using System.Reflection; [assembly: AssemblyProductAttribute("Journalist")] [assembly: AssemblyVersionAttribute("0.16.0")] [assembly: AssemblyInformationalVersionAttribute("0.16.0")] [assembly: AssemblyFileVersionAttribute("0.16.0")] [assembly: AssemblyCompanyAttribute("Anton Mednonogov")] namespace System { internal static class AssemblyVersionInformation { internal const string Version = "0.16.0"; } }
apache-2.0
C#
5d1995292c819fb10dd3ddcca3d5238c0080f2ae
Allow to disable the application-starter
csteeg/BoC,RalfvandenBurg/BoC,RvanDalen/BoC,bplasmeijer/BoC,RvanDalen/BoC,RalfvandenBurg/BoC,bplasmeijer/BoC,csteeg/BoC
Src/Commons/Web/ApplicationStarterHttpModule.cs
Src/Commons/Web/ApplicationStarterHttpModule.cs
using System; using System.Configuration; using System.Web; using System.Web.Configuration; using Microsoft.Web.Infrastructure; namespace BoC.Web { public class ApplicationStarterHttpModule : IHttpModule { private static object lockObject = new object(); private static bool startWasCalled = false; public static volatile bool Disabled = false; public static void StartApplication() { if (Disabled || startWasCalled || Initializer.Executed) return; try { lock (lockObject) { var disabled = WebConfigurationManager.AppSettings["BoC.Web.DisableAutoStart"]; if ("true".Equals(disabled, StringComparison.InvariantCultureIgnoreCase)) { Disabled = true; return; } if (startWasCalled) return; Initializer.Execute(); startWasCalled = true; } } catch { InfrastructureHelper.UnloadAppDomain(); throw; } } public void Init(HttpApplication context) { if (Disabled) return; context.BeginRequest += (sender, args) => StartApplication(); if (!Disabled && !startWasCalled) { try { context.Application.Lock(); StartApplication(); } finally { context.Application.UnLock(); } } } public void Dispose() { } } }
using System.Web; using Microsoft.Web.Infrastructure; namespace BoC.Web { public class ApplicationStarterHttpModule : IHttpModule { private static object lockObject = new object(); private static bool startWasCalled = false; public static void StartApplication() { if (startWasCalled || Initializer.Executed) return; try { lock (lockObject) { if (startWasCalled) return; Initializer.Execute(); startWasCalled = true; } } catch { InfrastructureHelper.UnloadAppDomain(); throw; } } public void Init(HttpApplication context) { context.BeginRequest += (sender, args) => StartApplication(); if (!startWasCalled) { try { context.Application.Lock(); StartApplication(); } finally { context.Application.UnLock(); } } } public void Dispose() { } } }
mit
C#
54c9a88171bb561df97562fd26f8a7e9af1ac2d0
Bump version.
mennowo/Gu.Wpf.DataGrid2D,JohanLarsson/Gu.Wpf.DataGrid2D
Gu.Wpf.DataGrid2D/Properties/AssemblyInfo.cs
Gu.Wpf.DataGrid2D/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows.Markup; [assembly: AssemblyTitle("Gu.Wpf.DataGrid2D")] [assembly: AssemblyDescription("Attached properties for DataGrid to enable binding to 2D sources.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Johan Larsson")] [assembly: AssemblyProduct("Gu.Wpf.DataGrid2D")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("f04cba4d-f4f6-4dfd-99bb-de7679060281")] [assembly: AssemblyVersion("0.2.1.2")] [assembly: AssemblyFileVersion("0.2.1.2")] [assembly: XmlnsDefinition("http://gu.se/DataGrid2D", "Gu.Wpf.DataGrid2D")] [assembly: XmlnsPrefix("http://gu.se/DataGrid2D", "dataGrid2D")] [assembly: NeutralResourcesLanguageAttribute("en")] [assembly: InternalsVisibleTo("Gu.Wpf.DataGrid2D.Tests", AllInternalsVisible = true)]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows.Markup; [assembly: AssemblyTitle("Gu.Wpf.DataGrid2D")] [assembly: AssemblyDescription("Attached properties for DataGrid to enable binding to 2D sources.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Johan Larsson")] [assembly: AssemblyProduct("Gu.Wpf.DataGrid2D")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("f04cba4d-f4f6-4dfd-99bb-de7679060281")] [assembly: AssemblyVersion("0.2.1.1")] [assembly: AssemblyFileVersion("0.2.1.1")] [assembly: XmlnsDefinition("http://gu.se/DataGrid2D", "Gu.Wpf.DataGrid2D")] [assembly: XmlnsPrefix("http://gu.se/DataGrid2D", "dataGrid2D")] [assembly: NeutralResourcesLanguageAttribute("en")] [assembly: InternalsVisibleTo("Gu.Wpf.DataGrid2D.Tests", AllInternalsVisible = true)]
mit
C#
2838bec788110a9dcbd9c1a96900ebd3cff2f04f
fix label to invites
prozum/solitude
Solitude.Android/Activities/OfferActivity.cs
Solitude.Android/Activities/OfferActivity.cs
using System; using System.Collections.Generic; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using System.Threading; namespace DineWithaDane.Android { [Activity(Label = "Invites", Icon = "@drawable/Invitation_Icon")] public class OfferActivity : DrawerActivity { protected OfferList Tilelist { get; set; } protected override void OnCreate(Bundle savedInstanceState) { // setting up and drawer base.OnCreate(savedInstanceState); //Shows spinner to indicate loading ShowSpinner(); ThreadPool.QueueUserWorkItem(o => { //Fetch offers from server PrepareLooper(); var offers = MainActivity.CIF.RequestOffers(); View view; if (offers.Count != 0) { var adapter = new OfferListAdapter(this, offers); Tilelist = new OfferList(this, adapter, (s, e) => AcceptOffer(), (s, e) => DeclineOffer()); view = Tilelist; } else { view = new TextView(this); (view as TextView).Text = Resources.GetString(Resource.String.message_offer_nothing_here); } //Clear screen and show the found offers RunOnUiThread(() => { ClearLayout(); Content.AddView(view); }); }); } protected void AcceptOffer() { MainActivity.CIF.ReplyOffer(true, Tilelist.PopFocus()); NoMoreOffers(); } protected void DeclineOffer() { MainActivity.CIF.ReplyOffer(false, Tilelist.PopFocus()); NoMoreOffers(); } protected void NoMoreOffers() { if (Tilelist.Count == 0) { var text = new TextView(this); text.Text = Resources.GetString(Resource.String.message_offer_no_more); Content.RemoveAllViews(); Content.AddView(text); } } } }
using System; using System.Collections.Generic; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using System.Threading; namespace DineWithaDane.Android { [Activity(Label = "Offer", Icon = "@drawable/Invitation_Icon")] public class OfferActivity : DrawerActivity { protected OfferList Tilelist { get; set; } protected override void OnCreate(Bundle savedInstanceState) { // setting up and drawer base.OnCreate(savedInstanceState); //Shows spinner to indicate loading ShowSpinner(); ThreadPool.QueueUserWorkItem(o => { //Fetch offers from server PrepareLooper(); var offers = MainActivity.CIF.RequestOffers(); View view; if (offers.Count != 0) { var adapter = new OfferListAdapter(this, offers); Tilelist = new OfferList(this, adapter, (s, e) => AcceptOffer(), (s, e) => DeclineOffer()); view = Tilelist; } else { view = new TextView(this); (view as TextView).Text = Resources.GetString(Resource.String.message_offer_nothing_here); } //Clear screen and show the found offers RunOnUiThread(() => { ClearLayout(); Content.AddView(view); }); }); } protected void AcceptOffer() { MainActivity.CIF.ReplyOffer(true, Tilelist.PopFocus()); NoMoreOffers(); } protected void DeclineOffer() { MainActivity.CIF.ReplyOffer(false, Tilelist.PopFocus()); NoMoreOffers(); } protected void NoMoreOffers() { if (Tilelist.Count == 0) { var text = new TextView(this); text.Text = Resources.GetString(Resource.String.message_offer_no_more); Content.RemoveAllViews(); Content.AddView(text); } } } }
mit
C#
b89a6bea4c4a710bf87ca7a2c95d5872d1e45333
Make DrawableDate adjustable
ppy/osu,smoogipooo/osu,2yangk23/osu,UselessToucan/osu,naoey/osu,johnneijzen/osu,DrabWeb/osu,smoogipoo/osu,ZLima12/osu,DrabWeb/osu,peppy/osu,ZLima12/osu,NeoAdonis/osu,peppy/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,EVAST9919/osu,peppy/osu-new,smoogipoo/osu,DrabWeb/osu,NeoAdonis/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu,2yangk23/osu,ppy/osu,naoey/osu,EVAST9919/osu,NeoAdonis/osu,naoey/osu
osu.Game/Graphics/DrawableDate.cs
osu.Game/Graphics/DrawableDate.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using Humanizer; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics { public class DrawableDate : OsuSpriteText, IHasTooltip { private DateTimeOffset date; public DateTimeOffset Date { get => date; set { if (date == value) return; date = value.ToLocalTime(); if (LoadState >= LoadState.Ready) updateTime(); } } public DrawableDate(DateTimeOffset date) { Font = "Exo2.0-RegularItalic"; Date = date; } [BackgroundDependencyLoader] private void load() { updateTime(); } protected override void LoadComplete() { base.LoadComplete(); Scheduler.Add(updateTimeWithReschedule); } private void updateTimeWithReschedule() { updateTime(); var diffToNow = DateTimeOffset.Now.Subtract(Date); double timeUntilNextUpdate = 1000; if (diffToNow.TotalSeconds > 60) { timeUntilNextUpdate *= 60; if (diffToNow.TotalMinutes > 60) { timeUntilNextUpdate *= 60; if (diffToNow.TotalHours > 24) timeUntilNextUpdate *= 24; } } Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); } protected virtual string Format() => Date.Humanize(); private void updateTime() => Text = Format(); public virtual string TooltipText => string.Format($"{Date:MMMM d, yyyy h:mm tt \"UTC\"z}"); } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using Humanizer; using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics { public class DrawableDate : OsuSpriteText, IHasTooltip { protected readonly DateTimeOffset Date; public DrawableDate(DateTimeOffset date) { Font = "Exo2.0-RegularItalic"; Date = date.ToLocalTime(); } [BackgroundDependencyLoader] private void load() { updateTime(); } protected override void LoadComplete() { base.LoadComplete(); Scheduler.Add(updateTimeWithReschedule); } private void updateTimeWithReschedule() { updateTime(); var diffToNow = DateTimeOffset.Now.Subtract(Date); double timeUntilNextUpdate = 1000; if (diffToNow.TotalSeconds > 60) { timeUntilNextUpdate *= 60; if (diffToNow.TotalMinutes > 60) { timeUntilNextUpdate *= 60; if (diffToNow.TotalHours > 24) timeUntilNextUpdate *= 24; } } Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); } protected virtual string Format() => Date.Humanize(); private void updateTime() => Text = Format(); public virtual string TooltipText => string.Format($"{Date:MMMM d, yyyy h:mm tt \"UTC\"z}"); } }
mit
C#
f75709c1519ec0ac1f52e812cd4132449a663b36
Bump version to 1.4, since there's new API and stuff
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity
common/SolutionInfo.cs
common/SolutionInfo.cs
#pragma warning disable 436 using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2016-2019")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { private const string GitHubForUnityVersion = "1.4.0"; internal const string VersionForAssembly = GitHubForUnityVersion; // If this is an alpha, beta or other pre-release, mark it as such as shown below internal const string Version = GitHubForUnityVersion; // GitHubForUnityVersion + "-beta1" } }
#pragma warning disable 436 using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyProduct("GitHub for Unity")] [assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)] [assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)] [assembly: ComVisible(false)] [assembly: AssemblyCompany("GitHub, Inc.")] [assembly: AssemblyCopyright("Copyright GitHub, Inc. 2016-2019")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("TestUtils", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("UnitTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("IntegrationTests", AllInternalsVisible = true)] [assembly: InternalsVisibleTo("TaskSystemIntegrationTests", AllInternalsVisible = true)] //Required for NSubstitute [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2", AllInternalsVisible = true)] //Required for Unity compilation [assembly: InternalsVisibleTo("Assembly-CSharp-Editor", AllInternalsVisible = true)] namespace System { internal static class AssemblyVersionInformation { private const string GitHubForUnityVersion = "1.3.2"; internal const string VersionForAssembly = GitHubForUnityVersion; // If this is an alpha, beta or other pre-release, mark it as such as shown below internal const string Version = GitHubForUnityVersion; // GitHubForUnityVersion + "-beta1" } }
mit
C#
fa233fec17d1873ff911d99df18bed8e0f496d7f
test 'getLatestEvents'
Pondidum/Ledger.Stores.Fs,Pondidum/Ledger.Stores.Fs
Ledger.Stores.Fs.Tests/EventSaveLoadTests.cs
Ledger.Stores.Fs.Tests/EventSaveLoadTests.cs
using System; using System.IO; using System.Linq; using NSubstitute; using Shouldly; using TestsDomain.Events; using Xunit; namespace Ledger.Stores.Fs.Tests { public class EventSaveLoadTests : IDisposable { private readonly string _root; public EventSaveLoadTests() { _root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(_root); } [Fact] public void The_events_should_keep_types() { var toSave = new DomainEvent[] { new NameChangedByDeedPoll {NewName = "Deed"}, new FixNameSpelling {NewName = "Fix"}, }; var id = Guid.NewGuid(); var store = new FileEventStore(_root); store.SaveEvents(id, toSave); var loaded = store.LoadEvents(id); loaded.First().ShouldBeOfType<NameChangedByDeedPoll>(); loaded.Last().ShouldBeOfType<FixNameSpelling>(); } [Fact] public void Only_events_for_the_correct_aggregate_are_returned() { var first = Guid.NewGuid(); var second = Guid.NewGuid(); var store = new FileEventStore(_root); store.SaveEvents(first, new[] { new FixNameSpelling { NewName = "Fix" } }); store.SaveEvents(second, new[] { new NameChangedByDeedPoll { NewName = "Deed" } }); var loaded = store.LoadEvents(first); loaded.Single().ShouldBeOfType<FixNameSpelling>(); } [Fact] public void Only_the_latest_sequence_is_returned() { var first = Guid.NewGuid(); var second = Guid.NewGuid(); var store = new FileEventStore(_root); store.SaveEvents(first, new[] { new FixNameSpelling { SequenceID = 4 } }); store.SaveEvents(first, new[] { new FixNameSpelling { SequenceID = 5 } }); store.SaveEvents(second, new[] { new NameChangedByDeedPoll { SequenceID = 6 } }); store .GetLatestSequenceFor(first) .ShouldBe(5); } [Fact] public void Loading_events_since_only_gets_events_after_the_sequence() { var toSave = new DomainEvent[] { new NameChangedByDeedPoll { SequenceID = 3 }, new FixNameSpelling { SequenceID = 4 }, new FixNameSpelling { SequenceID = 5 }, new FixNameSpelling { SequenceID = 6 }, }; var id = Guid.NewGuid(); var store = new FileEventStore(_root); store.SaveEvents(id, toSave); var loaded = store.LoadEventsSince(id, 4); loaded.Select(x => x.SequenceID).ShouldBe(new[] { 5, 6 }); } public void Dispose() { try { Directory.Delete(_root, true); } catch (Exception) { } } } }
using System; using System.IO; using System.Linq; using NSubstitute; using Shouldly; using TestsDomain.Events; using Xunit; namespace Ledger.Stores.Fs.Tests { public class EventSaveLoadTests : IDisposable { private readonly string _root; public EventSaveLoadTests() { _root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(_root); } [Fact] public void The_events_should_keep_types() { var toSave = new DomainEvent[] { new NameChangedByDeedPoll {NewName = "Deed"}, new FixNameSpelling {NewName = "Fix"}, }; var id = Guid.NewGuid(); var store = new FileEventStore(_root); store.SaveEvents(id, toSave); var loaded = store.LoadEvents(id); loaded.First().ShouldBeOfType<NameChangedByDeedPoll>(); loaded.Last().ShouldBeOfType<FixNameSpelling>(); } [Fact] public void Only_events_for_the_correct_aggregate_are_returned() { var first = Guid.NewGuid(); var second = Guid.NewGuid(); var store = new FileEventStore(_root); store.SaveEvents(first, new[] { new FixNameSpelling { NewName = "Fix" } }); store.SaveEvents(second, new[] { new NameChangedByDeedPoll { NewName = "Deed" } }); var loaded = store.LoadEvents(first); loaded.Single().ShouldBeOfType<FixNameSpelling>(); } public void Dispose() { try { Directory.Delete(_root, true); } catch (Exception) { } } } }
lgpl-2.1
C#
9a2d651f180afe465887fa4eb2d13c6e6089b903
add example to delete a row (PetaPoco)
jgraber/MicroORM_examples,jgraber/MicroORM_examples,jgraber/MicroORM_examples
MicroORM_Dapper/MicroORM_PetaPoco/Program.cs
MicroORM_Dapper/MicroORM_PetaPoco/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MicroORM_Dapper; using PetaPoco; namespace MicroORM_PetaPoco { class Program { static void Main(string[] args) { ReadData(); WriteData(); UpdateData(); DeleteData(); } private static void ReadData() { Console.WriteLine("Get all books"); var database = new Database("OrmConnection"); var books = database.Query<Book>("SELECT * FROM BOOK;"); foreach (var book in books) { Console.WriteLine(book); } } private static void WriteData() { Book book = new Book() { Title = "PetaPoco - The Book", Summary = "Another Micro ORM", Pages = 200, Rating = 5 }; var database = new Database("OrmConnection"); database.Insert("Book", "Id", book); Console.WriteLine("Inserted book with PetaPoco:"); Console.WriteLine(book); } private static void UpdateData() { var database = new Database("OrmConnection"); var book = database.Query<Book>("SELECT TOP 1 * FROM Book ORDER BY Id desc").Single(); book.Title = "An Updated Title for PetaPoco"; database.Update("Book", "Id", book); var updatedBook = database.Query<Book>("SELECT * FROM Book WHERE Id = @0", book.Id).Single(); Console.WriteLine("The updated book with PetaPoco:"); Console.WriteLine(updatedBook); } private static void DeleteData() { var database = new Database("OrmConnection"); var book = database.Query<Book>("SELECT TOP 1 * FROM Book ORDER BY Id desc").Single(); database.Delete("Book", "Id", book); var result = database.Query<Book>("SELECT * FROM Book WHERE Id = @0", book.Id).SingleOrDefault(); Console.WriteLine("Book with id {0} still exists? {1}", book.Id, result != null); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MicroORM_Dapper; using PetaPoco; namespace MicroORM_PetaPoco { class Program { static void Main(string[] args) { ReadData(); WriteData(); UpdateData(); } private static void ReadData() { Console.WriteLine("Get all books"); var database = new Database("OrmConnection"); var books = database.Query<Book>("SELECT * FROM BOOK;"); foreach (var book in books) { Console.WriteLine(book); } } private static void WriteData() { Book book = new Book() { Title = "PetaPoco - The Book", Summary = "Another Micro ORM", Pages = 200, Rating = 5 }; var database = new Database("OrmConnection"); database.Insert("Book", "Id", book); Console.WriteLine("Inserted book with PetaPoco:"); Console.WriteLine(book); } private static void UpdateData() { var database = new Database("OrmConnection"); var book = database.Query<Book>("SELECT TOP 1 * FROM Book ORDER BY Id desc").Single(); book.Title = "An Updated Title for PetaPoco"; database.Update("Book", "Id", book); var updatedBook = database.Query<Book>("SELECT * FROM Book WHERE Id = @0", book.Id).Single(); Console.WriteLine("The updated book with PetaPoco:"); Console.WriteLine(updatedBook); } } }
apache-2.0
C#
8c9bba88a2fb9fcbf580d0cf957d59a8b36cf15c
Remove unnecessary debugging code
GeorgeHahn/SOVND
SOVND.Lib/Handlers/SortedPlaylistProvider.cs
SOVND.Lib/Handlers/SortedPlaylistProvider.cs
using System; using System.Collections.Generic; using SOVND.Lib.Models; using System.Linq; using Anotar.NLog; using SOVND.Lib.Utils; namespace SOVND.Lib.Handlers { public class SortedPlaylistProvider : PlaylistProviderBase, ISortedPlaylistProvider { public List<Song> Songs { get; private set; } /// <summary> /// Gets the song at the top of the list /// </summary> /// <returns></returns> public Song GetTopSong() { if (Songs.Count == 0) return null; Songs.Sort(); // TODO Ability to toggle verbose debugging like this at runtime //var first = Songs[0].Votetime; //for (int i = 0; i < Songs.Count; i++) // LogTo.Debug("Song {0}: {1} has {2} votes at {3} (o {4})", i, Songs[i].track?.Name, Songs[i].Votes, Songs[i].Votetime, Songs[i].Votetime - first); return Songs[0]; } internal override void AddSong(Song song) { // TODO Should intelligently insert songs Songs.Add(song); Songs.Sort(); } internal override void ClearSongVotes(string id) { var songs = Songs.Where(x => x.SongID == id); if (songs.Count() > 1) LogTo.Error("Songs in list should be unique"); var song = songs.First(); // TODO Maybe Song should know where and how to publish itself / or hook into a service that can handle publishing changes song.Votes = 0; song.Voters = ""; song.Votetime = Time.Timestamp(); Songs.Sort(); } public SortedPlaylistProvider(IMQTTSettings settings) : base(settings) { Songs = new List<Song>(); } } }
using System; using System.Collections.Generic; using SOVND.Lib.Models; using System.Linq; using Anotar.NLog; using SOVND.Lib.Utils; namespace SOVND.Lib.Handlers { public class SortedPlaylistProvider : PlaylistProviderBase, ISortedPlaylistProvider { public List<Song> Songs { get; private set; } /// <summary> /// Gets the song at the top of the list /// </summary> /// <returns></returns> public Song GetTopSong() { if (Songs.Count == 0) return null; Songs.Sort(); var first = Songs[0].Votetime; for (int i = 0; i < Songs.Count; i++) LogTo.Debug("Song {0}: {1} has {2} votes at {3} (o {4})", i, Songs[i].track?.Name, Songs[i].Votes, Songs[i].Votetime, Songs[i].Votetime - first); return Songs[0]; } internal override void AddSong(Song song) { // TODO Should intelligently insert songs Songs.Add(song); Songs.Sort(); } internal override void ClearSongVotes(string id) { var songs = Songs.Where(x => x.SongID == id); if (songs.Count() > 1) LogTo.Error("Songs in list should be unique"); var song = songs.First(); // TODO Maybe Song should know where and how to publish itself / or hook into a service that can handle publishing changes song.Votes = 0; song.Voters = ""; song.Votetime = Time.Timestamp(); Songs.Sort(); } public SortedPlaylistProvider(IMQTTSettings settings) : base(settings) { Songs = new List<Song>(); } } }
epl-1.0
C#
1c8cc5c0b4506e6bf4f0fcd5c5be80d0e47b95dc
Remove max size argument
thedoritos/unimgpicker,thedoritos/unimgpicker,thedoritos/unimgpicker
Assets/Unimgpicker/Scripts/PickerAndroid.cs
Assets/Unimgpicker/Scripts/PickerAndroid.cs
#if UNITY_ANDROID using UnityEngine; namespace Kakera { internal class PickerAndroid : IPicker { private static readonly string PickerClass = "com.kakeragames.unimgpicker.Picker"; public void Show(string title, string outputFileName, int maxSize) { using (var picker = new AndroidJavaClass(PickerClass)) { picker.CallStatic("show", title, outputFileName); } } } } #endif
#if UNITY_ANDROID using UnityEngine; namespace Kakera { internal class PickerAndroid : IPicker { private static readonly string PickerClass = "com.kakeragames.unimgpicker.Picker"; public void Show(string title, string outputFileName, int maxSize) { using (var picker = new AndroidJavaClass(PickerClass)) { picker.CallStatic("show", title, outputFileName, maxSize); } } } } #endif
mit
C#
aceefcdf7061d87ff91e4ebd765ddee9b3d9b1a4
Rename EmptyServiceProvicer to EmptyServiceProvider
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Http/Http.Abstractions/src/Extensions/EndpointBuilder.cs
src/Http/Http.Abstractions/src/Extensions/EndpointBuilder.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Builder; /// <summary> /// A base class for building an new <see cref="Endpoint"/>. /// </summary> public abstract class EndpointBuilder { /// <summary> /// Gets or sets the delegate used to process requests for the endpoint. /// </summary> public RequestDelegate? RequestDelegate { get; set; } /// <summary> /// Gets or sets the informational display name of this endpoint. /// </summary> public string? DisplayName { get; set; } /// <summary> /// Gets the collection of metadata associated with this endpoint. /// </summary> public IList<object> Metadata { get; } = new List<object>(); /// <summary> /// Gets the <see cref="IServiceProvider"/> associated with the endpoint. /// </summary> public IServiceProvider ApplicationServices { get; set; } = EmptyServiceProvider.Instance; /// <summary> /// Creates an instance of <see cref="Endpoint"/> from the <see cref="EndpointBuilder"/>. /// </summary> /// <returns>The created <see cref="Endpoint"/>.</returns> public abstract Endpoint Build(); private sealed class EmptyServiceProvider : IServiceProvider { public static EmptyServiceProvider Instance { get; } = new EmptyServiceProvider(); public object? GetService(Type serviceType) => null; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.Builder; /// <summary> /// A base class for building an new <see cref="Endpoint"/>. /// </summary> public abstract class EndpointBuilder { /// <summary> /// Gets or sets the delegate used to process requests for the endpoint. /// </summary> public RequestDelegate? RequestDelegate { get; set; } /// <summary> /// Gets or sets the informational display name of this endpoint. /// </summary> public string? DisplayName { get; set; } /// <summary> /// Gets the collection of metadata associated with this endpoint. /// </summary> public IList<object> Metadata { get; } = new List<object>(); /// <summary> /// Gets the <see cref="IServiceProvider"/> associated with the endpoint. /// </summary> public IServiceProvider ApplicationServices { get; set; } = EmptyServiceProvicer.Instance; /// <summary> /// Creates an instance of <see cref="Endpoint"/> from the <see cref="EndpointBuilder"/>. /// </summary> /// <returns>The created <see cref="Endpoint"/>.</returns> public abstract Endpoint Build(); private sealed class EmptyServiceProvicer : IServiceProvider { public static EmptyServiceProvicer Instance { get; } = new EmptyServiceProvicer(); public object? GetService(Type serviceType) => null; } }
apache-2.0
C#
dde78358898e5be320c36b7a99821abf5641322f
call ExpTest from Main
MattWindsor91/roslyn,CaptainHayashi/roslyn,CaptainHayashi/roslyn,MattWindsor91/roslyn,MattWindsor91/roslyn,CaptainHayashi/roslyn,MattWindsor91/roslyn
concepts/code/BeautifulDifferentiation/Program.cs
concepts/code/BeautifulDifferentiation/Program.cs
using System; using System.Concepts.Prelude; /// <summary> /// Implementation of parts of Conal Elliot's Beautiful Differentiation. /// </summary> namespace BeautifulDifferentiation { public class Program { public static A F<A, implicit FloatA>(A z) where FloatA : Floating<A> => Sqrt(FromInteger(3) * Sin(z)); public static A G<A, implicit FloatA>(A z) where FloatA : Floating<A> => (FromInteger(3) * Asinh(z)) * Log(z); public static void Test<implicit FDA>() where FDA : Floating<D<double>> { var d = new D<double>(2.0, 1.0); var d2 = F(d); var d3 = G(d); Console.Out.WriteLine($"D {d.X} {d.DX}"); Console.Out.WriteLine($"D {d2.X} {d2.DX}"); Console.Out.WriteLine($"D {d3.X} {d3.DX}"); } public static void TestHigherOrder<implicit FHDA>() where FHDA : Floating<HoD<double>> { var d = HoD<double>.Id(2.0); var d2 = F(d); var d3 = G(d); Console.Out.WriteLine($"HD {d.X} {d.DX.Value.X} {d.DX.Value.DX.Value.X}"); Console.Out.WriteLine($"HD {d2.X} {d2.DX.Value.X} {d2.DX.Value.DX.Value.X}"); Console.Out.WriteLine($"HD {d3.X} {d3.DX.Value.X} {d3.DX.Value.DX.Value.X}"); } public static void Main() { Test<Mark1.FloatingDA<double>>(); Test<Mark2.FloatingDA<double>>(); TestHigherOrder<HoMark2.FloatingDA<double>>(); Test<Mark3.FloatingDA<double>>(); ExpTest.Test(); } } }
using System; using System.Concepts.Prelude; /// <summary> /// Implementation of parts of Conal Elliot's Beautiful Differentiation. /// </summary> namespace BeautifulDifferentiation { public class Program { public static A F<A, implicit FloatA>(A z) where FloatA : Floating<A> => Sqrt(FromInteger(3) * Sin(z)); public static A G<A, implicit FloatA>(A z) where FloatA : Floating<A> => (FromInteger(3) * Asinh(z)) * Log(z); public static void Test<implicit FDA>() where FDA : Floating<D<double>> { var d = new D<double>(2.0, 1.0); var d2 = F(d); var d3 = G(d); Console.Out.WriteLine($"D {d.X} {d.DX}"); Console.Out.WriteLine($"D {d2.X} {d2.DX}"); Console.Out.WriteLine($"D {d3.X} {d3.DX}"); } public static void TestHigherOrder<implicit FHDA>() where FHDA : Floating<HoD<double>> { var d = HoD<double>.Id(2.0); var d2 = F(d); var d3 = G(d); Console.Out.WriteLine($"HD {d.X} {d.DX.Value.X} {d.DX.Value.DX.Value.X}"); Console.Out.WriteLine($"HD {d2.X} {d2.DX.Value.X} {d2.DX.Value.DX.Value.X}"); Console.Out.WriteLine($"HD {d3.X} {d3.DX.Value.X} {d3.DX.Value.DX.Value.X}"); } public static void Main() { Test<Mark1.FloatingDA<double>>(); Test<Mark2.FloatingDA<double>>(); TestHigherOrder<HoMark2.FloatingDA<double>>(); Test<Mark3.FloatingDA<double>>(); } } }
apache-2.0
C#
a33bb46b045898cfd1c5b20d4e467c7c979ee7cb
Convert to NFluent
dirkrombauts/pickles,irfanah/pickles,picklesdoc/pickles,picklesdoc/pickles,blorgbeard/pickles,blorgbeard/pickles,irfanah/pickles,ludwigjossieaux/pickles,picklesdoc/pickles,magicmonty/pickles,dirkrombauts/pickles,ludwigjossieaux/pickles,ludwigjossieaux/pickles,magicmonty/pickles,magicmonty/pickles,dirkrombauts/pickles,picklesdoc/pickles,blorgbeard/pickles,magicmonty/pickles,dirkrombauts/pickles,blorgbeard/pickles,irfanah/pickles,irfanah/pickles
src/Pickles/Pickles.Test/Extensions/StringExtensionsTests.cs
src/Pickles/Pickles.Test/Extensions/StringExtensionsTests.cs
using System; using NFluent; using NUnit.Framework; using PicklesDoc.Pickles.Extensions; namespace PicklesDoc.Pickles.Test.Extensions { [TestFixture] public class StringExtensionsTests { [Test] public void IsNullOrWhiteSpace_ContentPresent_ReturnsFalse() { string s = "some text"; bool result = s.IsNullOrWhiteSpace(); Check.That(result).IsFalse(); } [Test] public void IsNullOrWhiteSpace_EmptyString_ReturnsTrue() { string s = ""; bool result = s.IsNullOrWhiteSpace(); Check.That(result).IsTrue(); } [Test] public void IsNullOrWhiteSpace_NullArgument_ReturnsTrue() { string s = null; bool result = s.IsNullOrWhiteSpace(); Check.That(result).IsTrue(); } [Test] public void IsNullOrWhiteSpace_WhiteSpace_ReturnsTrue() { string s = " "; bool result = s.IsNullOrWhiteSpace(); Check.That(result).IsTrue(); } } }
using System; using NUnit.Framework; using PicklesDoc.Pickles.Extensions; namespace PicklesDoc.Pickles.Test.Extensions { [TestFixture] public class StringExtensionsTests { [Test] public void IsNullOrWhiteSpace_ContentPresent_ReturnsFalse() { string s = "some text"; bool result = s.IsNullOrWhiteSpace(); Assert.IsFalse(result); } [Test] public void IsNullOrWhiteSpace_EmptyString_ReturnsTrue() { string s = ""; bool result = s.IsNullOrWhiteSpace(); Assert.IsTrue(result); } [Test] public void IsNullOrWhiteSpace_NullArgument_ReturnsTrue() { string s = null; // ReSharper disable ExpressionIsAlwaysNull bool result = s.IsNullOrWhiteSpace(); // ReSharper restore ExpressionIsAlwaysNull Assert.IsTrue(result); } [Test] public void IsNullOrWhiteSpace_WhiteSpace_ReturnsTrue() { string s = " "; bool result = s.IsNullOrWhiteSpace(); Assert.IsTrue(result); } } }
apache-2.0
C#
0aee46701a778a6f6044bc53c41fe50c1400f3a8
Change log lvl for history engine disable logging
delawarePro/sitecore-data-blaster
src/Sitecore.DataBlaster/Load/Processors/SyncHistoryTable.cs
src/Sitecore.DataBlaster/Load/Processors/SyncHistoryTable.cs
using System.Diagnostics; using Sitecore.Configuration; using Sitecore.DataBlaster.Load.Sql; namespace Sitecore.DataBlaster.Load.Processors { public class SyncHistoryTable : ISyncInTransaction { public void Process(BulkLoadContext loadContext, BulkLoadSqlContext sqlContext) { if (!loadContext.UpdateHistory.GetValueOrDefault()) return; if (loadContext.ItemChanges.Count == 0) return; // In Sitecore 9, history engine is disabled by default if (!HistoryEngineEnabled(loadContext)) { loadContext.Log.Info($"Skipped updating history because history engine is not enabled."); return; } var stopwatch = Stopwatch.StartNew(); var sql = sqlContext.GetEmbeddedSql(loadContext, "Sql.09.UpdateHistory.sql"); sqlContext.ExecuteSql(sql, commandProcessor: cmd => cmd.Parameters.AddWithValue("@UserName", Sitecore.Context.User.Name)); loadContext.Log.Info($"Updated history: {(int) stopwatch.Elapsed.TotalSeconds}s"); } private bool HistoryEngineEnabled(BulkLoadContext context) { var db = Factory.GetDatabase(context.Database, true); return db.Engines.HistoryEngine.Storage != null; } } }
using System.Diagnostics; using Sitecore.Configuration; using Sitecore.DataBlaster.Load.Sql; namespace Sitecore.DataBlaster.Load.Processors { public class SyncHistoryTable : ISyncInTransaction { public void Process(BulkLoadContext loadContext, BulkLoadSqlContext sqlContext) { if (!loadContext.UpdateHistory.GetValueOrDefault()) return; if (loadContext.ItemChanges.Count == 0) return; // In Sitecore 9, history engine is disabled by default if (!HistoryEngineEnabled(loadContext)) { loadContext.Log.Warn($"Skipped updating history because history engine is not enabled"); return; } var stopwatch = Stopwatch.StartNew(); var sql = sqlContext.GetEmbeddedSql(loadContext, "Sql.09.UpdateHistory.sql"); sqlContext.ExecuteSql(sql, commandProcessor: cmd => cmd.Parameters.AddWithValue("@UserName", Sitecore.Context.User.Name)); loadContext.Log.Info($"Updated history: {(int) stopwatch.Elapsed.TotalSeconds}s"); } private bool HistoryEngineEnabled(BulkLoadContext context) { var db = Factory.GetDatabase(context.Database, true); return db.Engines.HistoryEngine.Storage != null; } } }
mit
C#
195956de122bcb0e5965423ab9969e811036b163
bump version
Fody/PropertyChanged,0x53A/PropertyChanged,user1568891/PropertyChanged
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyVersion("1.46.1")] [assembly: AssemblyFileVersion("1.46.1")]
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyVersion("1.46.0")] [assembly: AssemblyFileVersion("1.46.0")]
mit
C#
b9f16684affd99c532f67e74341920bb342ad558
bump version
Fody/MethodTimer
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("MethodTimer")] [assembly: AssemblyProduct("MethodTimer")] [assembly: AssemblyVersion("1.19.0")] [assembly: AssemblyFileVersion("1.19.0")]
using System.Reflection; [assembly: AssemblyTitle("MethodTimer")] [assembly: AssemblyProduct("MethodTimer")] [assembly: AssemblyVersion("1.18.0")] [assembly: AssemblyFileVersion("1.18.0")]
mit
C#
916b370591003f8f895c795910464b2b11676ae8
Disable classic MSIE engine. References #220
rickbeerendonk/React.NET,rickbeerendonk/React.NET,ShikiGami/React.NET,chriscamplejohn/React.NET,reactjs/React.NET,reactjs/React.NET,ShikiGami/React.NET,reactjs/React.NET,chriscamplejohn/React.NET,rickbeerendonk/React.NET,reactjs/React.NET,ShikiGami/React.NET,rickbeerendonk/React.NET,chriscamplejohn/React.NET,reactjs/React.NET,chriscamplejohn/React.NET,ShikiGami/React.NET,reactjs/React.NET
src/React.Core/AssemblyRegistration.cs
src/React.Core/AssemblyRegistration.cs
/* * Copyright (c) 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.Msie.Configuration; using JavaScriptEngineSwitcher.V8; using React.TinyIoC; namespace React { /// <summary> /// Handles registration of core ReactJS.NET components. /// </summary> public class AssemblyRegistration : IAssemblyRegistration { /// <summary> /// Gets the IoC container. Try to avoid using this and always use constructor injection. /// This should only be used at the root level of an object heirarchy. /// </summary> public static TinyIoCContainer Container { get { return TinyIoCContainer.Current; } } /// <summary> /// Registers standard components in the React IoC container /// </summary> /// <param name="container">Container to register components in</param> public void Register(TinyIoCContainer container) { // One instance shared for the whole app container.Register<IReactSiteConfiguration>((c, o) => ReactSiteConfiguration.Configuration); container.Register<IFileCacheHash, FileCacheHash>().AsPerRequestSingleton(); container.Register<IJavaScriptEngineFactory, JavaScriptEngineFactory>().AsSingleton(); container.Register<IReactEnvironment, ReactEnvironment>().AsPerRequestSingleton(); RegisterSupportedEngines(container); } /// <summary> /// Registers JavaScript engines that may be able to run in the current environment /// </summary> /// <param name="container"></param> private void RegisterSupportedEngines(TinyIoCContainer container) { if (JavaScriptEngineUtils.EnvironmentSupportsClearScript()) { container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new V8JsEngine(), Priority = 10 }, "ClearScriptV8"); } if (JavaScriptEngineUtils.EnvironmentSupportsVroomJs()) { container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new VroomJsEngine(), Priority = 10 }, "VroomJs"); } container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.ChakraEdgeJsRt }), Priority = 20 }, "MsieChakraEdgeRT"); container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.ChakraIeJsRt }), Priority = 30 }, "MsieChakraIeRT"); container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.ChakraActiveScript }), Priority = 40 }, "MsieChakraActiveScript"); } } }
/* * Copyright (c) 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.Msie.Configuration; using JavaScriptEngineSwitcher.V8; using React.TinyIoC; namespace React { /// <summary> /// Handles registration of core ReactJS.NET components. /// </summary> public class AssemblyRegistration : IAssemblyRegistration { /// <summary> /// Gets the IoC container. Try to avoid using this and always use constructor injection. /// This should only be used at the root level of an object heirarchy. /// </summary> public static TinyIoCContainer Container { get { return TinyIoCContainer.Current; } } /// <summary> /// Registers standard components in the React IoC container /// </summary> /// <param name="container">Container to register components in</param> public void Register(TinyIoCContainer container) { // One instance shared for the whole app container.Register<IReactSiteConfiguration>((c, o) => ReactSiteConfiguration.Configuration); container.Register<IFileCacheHash, FileCacheHash>().AsPerRequestSingleton(); container.Register<IJavaScriptEngineFactory, JavaScriptEngineFactory>().AsSingleton(); container.Register<IReactEnvironment, ReactEnvironment>().AsPerRequestSingleton(); RegisterSupportedEngines(container); } /// <summary> /// Registers JavaScript engines that may be able to run in the current environment /// </summary> /// <param name="container"></param> private void RegisterSupportedEngines(TinyIoCContainer container) { if (JavaScriptEngineUtils.EnvironmentSupportsClearScript()) { container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new V8JsEngine(), Priority = 10 }, "ClearScriptV8"); } if (JavaScriptEngineUtils.EnvironmentSupportsVroomJs()) { container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new VroomJsEngine(), Priority = 10 }, "VroomJs"); } container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.ChakraEdgeJsRt }), Priority = 20 }, "MsieChakraEdgeRT"); container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.ChakraIeJsRt }), Priority = 30 }, "MsieChakraIeRT"); container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.ChakraActiveScript }), Priority = 40 }, "MsieChakraActiveScript"); container.Register(new JavaScriptEngineFactory.Registration { Factory = () => new MsieJsEngine(new MsieConfiguration { EngineMode = JsEngineMode.Classic }), Priority = 50 }, "MsieClassic"); } } }
bsd-3-clause
C#
0e7526f647d6a52e45e32bbca11f066f700cfa54
Use default polling interval
HangfireIO/Hangfire.Highlighter,HangfireIO/Hangfire.Highlighter,HangfireIO/Hangfire.Highlighter
HangFire.Highlighter/Startup.cs
HangFire.Highlighter/Startup.cs
using Hangfire.Dashboard; using Hangfire.Highlighter; using Hangfire.Highlighter.Jobs; using Microsoft.Owin; using Owin; [assembly:OwinStartup(typeof(Startup))] namespace Hangfire.Highlighter { public class Startup { public void Configuration(IAppBuilder app) { app.MapSignalR(); GlobalConfiguration.Configuration.UseSqlServerStorage("HighlighterDb"); RecurringJob.AddOrUpdate<SnippetHighlighter>(x => x.CleanUp(), "0 0 * * *"); var options = new DashboardOptions { AuthorizationFilters = new IAuthorizationFilter[0] }; app.UseHangfireDashboard("/hangfire", options); app.UseHangfireServer(); } } }
using System; using Hangfire.Dashboard; using Hangfire.Highlighter; using Hangfire.Highlighter.Jobs; using Hangfire.SqlServer; using Microsoft.Owin; using Owin; [assembly:OwinStartup(typeof(Startup))] namespace Hangfire.Highlighter { public class Startup { public void Configuration(IAppBuilder app) { app.MapSignalR(); GlobalConfiguration.Configuration.UseSqlServerStorage( "HighlighterDb", new SqlServerStorageOptions { QueuePollInterval = TimeSpan.FromSeconds(1) }); RecurringJob.AddOrUpdate<SnippetHighlighter>(x => x.CleanUp(), "0 0 * * *"); var options = new DashboardOptions { AuthorizationFilters = new IAuthorizationFilter[0] }; app.UseHangfireDashboard("/hangfire", options); app.UseHangfireServer(); } } }
mit
C#
4f83af81d78b6e996ffdf0e286a3ef8e04577ad1
Update alt text in workgroup. Did say edit/details order, not workgroup.
ucdavis/Purchasing,ucdavis/Purchasing,ucdavis/Purchasing
Purchasing.Web/Views/Workgroup/Index.cshtml
Purchasing.Web/Views/Workgroup/Index.cshtml
@model IEnumerable<Purchasing.Core.Domain.Workgroup> @{ ViewBag.Title = "Index"; } @section SubNav { <ul class="navigation"> <li>@Html.ActionLink("Create New", "CreateWorkgroup","Wizard", new{} ,new {@class="button"})</li> </ul> } <table class="datatable"> <thead> <tr> <th></th> <th> Name </th> <th> Administrative </th> <th> IsActive </th> <th></th> </tr> </thead> <tbody> @{ var odd = false; } @foreach (var item in Model) { <tr class="@(odd ? "odd": "even")"> <td> <a href='@Url.Action("Details", new {id=item.Id})' class="ui-icon ui-icon-document" title="Workgroup details"> </a> <a href='@Url.Action("Edit", new {id=item.Id})' class="ui-icon ui-icon-pencil" title="Edit workgroup"> </a> </td> <td> @item.Name </td> <td> @item.Administrative </td> <td> @item.IsActive </td> <td> <a href='@Url.Action("Delete", new { id = item.Id })' class="ui-icon ui-icon-trash" title="Delete workgroup"> </a> </td> </tr> odd = !odd; } </tbody> </table>
@model IEnumerable<Purchasing.Core.Domain.Workgroup> @{ ViewBag.Title = "Index"; } @section SubNav { <ul class="navigation"> <li>@Html.ActionLink("Create New", "CreateWorkgroup","Wizard", new{} ,new {@class="button"})</li> </ul> } <table class="datatable"> <thead> <tr> <th></th> <th> Name </th> <th> Administrative </th> <th> IsActive </th> <th></th> </tr> </thead> <tbody> @{ var odd = false; } @foreach (var item in Model) { <tr class="@(odd ? "odd": "even")"> <td> <a href='@Url.Action("Details", new {id=item.Id})' class="ui-icon ui-icon-document" title="Order details"> </a> <a href='@Url.Action("Edit", new {id=item.Id})' class="ui-icon ui-icon-pencil" title="Edit order"> </a> </td> <td> @item.Name </td> <td> @item.Administrative </td> <td> @item.IsActive </td> <td> <a href='@Url.Action("Delete", new { id = item.Id })' class="ui-icon ui-icon-trash" title="Delete title"> </a> </td> </tr> odd = !odd; } </tbody> </table>
mit
C#
0d70429cf04813f571a9cc1b4b05ce5a0d44d15b
Change default background color to be more grey
SteamDatabase/ValveResourceFormat
GUI/Utils/Settings.cs
GUI/Utils/Settings.cs
using System.Collections.Generic; using System.Drawing; using System.IO; namespace GUI.Utils { internal static class Settings { public static List<string> GameSearchPaths { get; } = new List<string>(); public static Color BackgroundColor { get; set; } public static void Load() { BackgroundColor = Color.FromArgb(60, 60, 60); // TODO: Be dumb about it for now. if (!File.Exists("gamepaths.txt")) { return; } GameSearchPaths.AddRange(File.ReadAllLines("gamepaths.txt")); } public static void Save() { File.WriteAllLines("gamepaths.txt", GameSearchPaths); } } }
using System.Collections.Generic; using System.Drawing; using System.IO; namespace GUI.Utils { internal static class Settings { public static List<string> GameSearchPaths { get; } = new List<string>(); public static Color BackgroundColor { get; set; } = Color.Black; public static void Load() { // TODO: Be dumb about it for now. if (!File.Exists("gamepaths.txt")) { return; } GameSearchPaths.AddRange(File.ReadAllLines("gamepaths.txt")); } public static void Save() { File.WriteAllLines("gamepaths.txt", GameSearchPaths); } } }
mit
C#
34ff5016a46fb8e974940a580e4c378f6dc2a885
add all AQ clauses for swagger
trenoncourt/AutoQueryable
src/AutoQueryable.AspNetCore.Swagger/AutoQueryableOperationFilter.cs
src/AutoQueryable.AspNetCore.Swagger/AutoQueryableOperationFilter.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using AutoQueryable.AspNetCore.Filter.FilterAttributes; using Microsoft.AspNetCore.Authorization; using Newtonsoft.Json; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; namespace AutoQueryable.AspNetCore.Swagger { public class AutoQueryableOperationFilter : IOperationFilter { public void Apply(Operation operation, OperationFilterContext context) { // Policy names map to scopes var controllerScopes = context.ApiDescription.ActionAttributes() .OfType<AutoQueryableAttribute>(); if (controllerScopes.Any()) { if (operation.Parameters == null) { operation.Parameters = new List<IParameter>(); } operation.Parameters.Add(CreateParameter(context, "select")); operation.Parameters.Add(CreateParameter(context, "take", typeof(int))); operation.Parameters.Add(CreateParameter(context, "skip", typeof(int))); operation.Parameters.Add(CreateParameter(context, "first")); operation.Parameters.Add(CreateParameter(context, "last")); operation.Parameters.Add(CreateParameter(context, "orderby")); operation.Parameters.Add(CreateParameter(context, "orderbydesc")); operation.Parameters.Add(CreateParameter(context, "wrapwith")); operation.Parameters.Add(CreateParameter(context, "pagesize")); } } private NonBodyParameter CreateParameter(OperationFilterContext context, string name, Type type = null) { type = type ?? typeof(string); Schema schema = context.SchemaRegistry.GetOrRegister(type); return new NonBodyParameter { In = "query", Name = name, Type = schema?.Type, Format = schema?.Format }; } } }
using System.Linq; using AutoQueryable.AspNetCore.Filter.FilterAttributes; using Microsoft.AspNetCore.Authorization; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; namespace AutoQueryable.AspNetCore.Swagger { public class AutoQueryableOperationFilter : IOperationFilter { public void Apply(Operation operation, OperationFilterContext context) { // Policy names map to scopes var controllerScopes = context.ApiDescription.ActionAttributes() .OfType<AutoQueryableAttribute>(); if (controllerScopes.Any()) { Schema schema = context.SchemaRegistry.GetOrRegister(typeof(string)); operation.Parameters.Add(new NonBodyParameter { In = "query", Name = "select", Type = schema.Type, Format = schema.Format }); } } } }
mit
C#
5ba07e9d19d1ec1924a832d58424026d2fb1f0ac
use Jil
MaxHorstmann/ArinWhois.NET,keithjjones/ArinWhois.NET
src/Client/ArinClient.cs
src/Client/ArinClient.cs
using System; using System.Net; using System.Threading.Tasks; using ArinWhois.Model; using Jil; namespace ArinWhois.Client { public class ArinClient { private const string BaseUrl = "http://whois.arin.net/rest"; public async Task<Response> QueryNetworkAsync(string ip) { using (var wc = new WebClient()) { var query = string.Format("net/NET-{0}-1/pft", ip.Replace(".", "-")); var response = await wc.DownloadStringTaskAsync(GetRequestUrl(query)); var json = JSON.Deserialize<Response>(response); return json; } } private static Uri GetRequestUrl(string query) { return new Uri(string.Format("{0}/{1}.json", BaseUrl, query)); } } }
using System; using System.Net; using System.Threading.Tasks; using ArinWhois.Model; namespace ArinWhois.Client { public class ArinClient { private const string BaseUrl = "http://whois.arin.net/rest"; public async Task<Response> QueryNetworkAsync(string ip) { using (var wc = new WebClient()) { var query = string.Format("net/NET-{0}-1/pft", ip.Replace(".", "-")); var response = await wc.DownloadStringTaskAsync(GetRequestUrl(query)); return null; // TODO toJSON } } private static Uri GetRequestUrl(string query) { return new Uri(string.Format("{0}/{1}.json", BaseUrl, query)); } } }
mit
C#
5fc2d12c3aee31b292bde4569fccf902b99f4d14
Fix mail format
christophwille/myhaflinger.com,christophwille/myhaflinger.com,christophwille/myhaflinger.com
site/App_Code/MailManager.cs
site/App_Code/MailManager.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using RazorEngine; using RazorEngine.Templating; namespace MyHaflinger { public static partial class MailManager { public static readonly string AnfrageTemplate = @"<!DOCTYPE html> <html> <body> <h1>Anfrage myhaflinger.com</h1> <p>Name: @Model.Name</p> <p>Email: @Model.Email</p> <p>Betreff: @Model.Subject</p> <p>Nachricht:</p> <p>@Model.Message</p> </body> </html>"; public static void SendAnfrageFormularMail(MailJson mm) { // https://github.com/Antaris/RazorEngine var msgToSend = Engine.Razor.RunCompile(AnfrageTemplate, "anfrageTemplateKey", null, mm); var emailSvc = new SmtpMailService(new ConfigurationService()); emailSvc.SendMail("myhaflinger.com Kontaktformular", msgToSend, isBodyHtml:true); } private static string ReadHtmlTemplate(string templateFileName) { string filename = HttpContext.Current.Server.MapPath("~/App_Data/" + templateFileName); return System.IO.File.ReadAllText(filename); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using RazorEngine; using RazorEngine.Templating; namespace MyHaflinger { public static partial class MailManager { public static readonly string AnfrageTemplate = "Name: @Model.Name\r\nEmail: @Model.Email\r\nBetreff: @Model.Subject\r\nNachricht: \r\[email protected]\r\n"; public static void SendAnfrageFormularMail(MailJson mm) { // https://github.com/Antaris/RazorEngine var msgToSend = Engine.Razor.RunCompile(AnfrageTemplate, "anfrageTemplateKey", null, mm); var emailSvc = new SmtpMailService(new ConfigurationService()); emailSvc.SendMail("myhaflinger.com Kontaktformular", msgToSend, isBodyHtml:true); } private static string ReadHtmlTemplate(string templateFileName) { string filename = HttpContext.Current.Server.MapPath("~/App_Data/" + templateFileName); return System.IO.File.ReadAllText(filename); } } }
mit
C#
31f8d6a7924b97c62a18d3ffcf3b788c2f58d18a
support passing cookies in by header
pshort/nsupertest
NSuperTest/HttpRequestClient.cs
NSuperTest/HttpRequestClient.cs
using System; using System.Net.Http; namespace NSuperTest { internal class HttpRequestClient : IHttpRequestClient { private HttpClientHandler handler; private HttpClient client; public HttpRequestClient(string baseUri) { handler = new HttpClientHandler {UseCookies = false}; client = new HttpClient(handler); client.BaseAddress = new Uri(baseUri); } public HttpResponseMessage MakeRequest(HttpRequestMessage message) { return client.SendAsync(message).Result; } } }
using System; using System.Net.Http; namespace NSuperTest { internal class HttpRequestClient : IHttpRequestClient { private HttpClient client; public HttpRequestClient(string baseUri) { client = new HttpClient(); client.BaseAddress = new Uri(baseUri); } public HttpResponseMessage MakeRequest(HttpRequestMessage message) { return client.SendAsync(message).Result; } } }
mit
C#
0d168a662143c4412ab70d2132ee9ee14dc058aa
Install default rules only if no customs are provided
mono/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp,arfbtwn/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp
src/Monitor.cs
src/Monitor.cs
// Copyright 2006 Alp Toker <[email protected]> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTest { public static void Main (string[] args) { string addr = Address.SessionBus; if (args.Length == 1) { string arg = args[0]; switch (arg) { case "--system": addr = Address.SystemBus; break; case "--session": addr = Address.SessionBus; break; default: Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]"); Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used."); return; } } Connection conn = new Connection (false); conn.Open (addr); conn.Authenticate (); ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; Bus bus = conn.GetObject<Bus> (name, opath); bus.NameAcquired += delegate (string acquired_name) { Console.WriteLine ("NameAcquired: " + acquired_name); }; bus.Hello (); //hack to process the NameAcquired signal synchronously conn.HandleSignal (conn.ReadMessage ()); if (args.Length > 1) { //install custom match rules only for (int i = 1 ; i != args.Length ; i++) bus.AddMatch (args[i]); } else { //no custom match rules, install the defaults bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); } while (true) { Message msg = conn.ReadMessage (); Console.WriteLine ("Message:"); Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); //foreach (HeaderField hf in msg.HeaderFields) // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields) Console.WriteLine ("\t" + field.Key + ": " + field.Value); if (msg.Body != null) { Console.WriteLine ("\tBody:"); MessageReader reader = new MessageReader (msg); //TODO: this needs to be done more intelligently try { foreach (DType dtype in msg.Signature.Data) { if (dtype == DType.Invalid) continue; object arg; reader.GetValue (dtype, out arg); Console.WriteLine ("\t\t" + dtype + ": " + arg); } } catch { Console.WriteLine ("\t\tmonitor is too dumb to decode message body"); } } Console.WriteLine (); } } }
// Copyright 2006 Alp Toker <[email protected]> // This software is made available under the MIT License // See COPYING for details using System; using System.Collections.Generic; using NDesk.DBus; using org.freedesktop.DBus; public class ManagedDBusTest { public static void Main (string[] args) { string addr = Address.SessionBus; if (args.Length == 1) { string arg = args[0]; switch (arg) { case "--system": addr = Address.SystemBus; break; case "--session": addr = Address.SessionBus; break; default: Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]"); return; } } Connection conn = new Connection (false); conn.Open (addr); conn.Authenticate (); ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; Bus bus = conn.GetObject<Bus> (name, opath); bus.NameAcquired += delegate (string acquired_name) { Console.WriteLine ("NameAcquired: " + acquired_name); }; bus.Hello (); //hack to process the NameAcquired signal synchronously conn.HandleSignal (conn.ReadMessage ()); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); //custom match rules if (args.Length > 1) for (int i = 1 ; i != args.Length ; i++) bus.AddMatch (args[i]); while (true) { Message msg = conn.ReadMessage (); Console.WriteLine ("Message:"); Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); //foreach (HeaderField hf in msg.HeaderFields) // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields) Console.WriteLine ("\t" + field.Key + ": " + field.Value); if (msg.Body != null) { Console.WriteLine ("\tBody:"); MessageReader reader = new MessageReader (msg); //TODO: this needs to be done more intelligently try { foreach (DType dtype in msg.Signature.Data) { if (dtype == DType.Invalid) continue; object arg; reader.GetValue (dtype, out arg); Console.WriteLine ("\t\t" + dtype + ": " + arg); } } catch { Console.WriteLine ("\t\tmonitor is too dumb to decode message body"); } } Console.WriteLine (); } } }
mit
C#
fb0685dee75cba5cf25b6c4a5971c4b6ad8f8470
Rollback functionality and hash computing
PowerMogli/Rabbit.Db
src/Micro+/Entity/EntityInfo.cs
src/Micro+/Entity/EntityInfo.cs
using System; using System.Collections.Generic; using System.Linq; using MicroORM.Materialization; using MicroORM.Reflection; using MicroORM.Mapping; namespace MicroORM.Entity { internal sealed class EntityInfo { internal EntityInfo() { this.EntityState = EntityState.None; this.ValueSnapshot = new Dictionary<string, int>(); this.ChangesSnapshot = new Dictionary<string, int>(); this.LastCallTime = DateTime.Now; } internal bool CanBeRemoved { get { return DateTime.Now.Subtract(this.LastCallTime) > TimeSpan.FromMinutes(2); } } internal EntityState EntityState { get; set; } internal Dictionary<string, int> ValueSnapshot { get; set; } internal Dictionary<string, int> ChangesSnapshot { get; set; } internal DateTime LastCallTime { get; set; } internal void ClearChanges() { this.ChangesSnapshot.Clear(); } internal void MergeChanges() { foreach (var change in this.ChangesSnapshot) { this.ValueSnapshot[change.Key] = change.Value; } ClearChanges(); } internal void ComputeSnapshot<TEntity>(TEntity entity) { this.ValueSnapshot = EntityHashSetManager.ComputeEntityHashSet(entity); } internal KeyValuePair<string, object>[] ComputeUpdateValues<TEntity>(TEntity entity) { Dictionary<string, int> entityHashSet = EntityHashSetManager.ComputeEntityHashSet(entity); KeyValuePair<string, object>[] entityValues = RemoveUnusedPropertyValues<TEntity>(entity); Dictionary<string, object> valuesToUpdate = new Dictionary<string, object>(); foreach (var kvp in entityHashSet) { var oldHash = this.ValueSnapshot[kvp.Key]; if (oldHash.Equals(kvp.Value) == false) { valuesToUpdate.Add(kvp.Key, entityValues.FirstOrDefault(kvp1 => kvp1.Key == kvp.Key).Value); this.ChangesSnapshot.Add(kvp.Key, kvp.Value); } } return valuesToUpdate.ToArray(); } private KeyValuePair<string, object>[] RemoveUnusedPropertyValues<TEntity>(TEntity entity) { KeyValuePair<string, object>[] entityValues = ParameterTypeDescriptor.ToKeyValuePairs(new object[] { entity }); TableInfo tableInfo = TableInfo<TEntity>.GetTableInfo; return entityValues.Where(kvp => tableInfo.DbTable.DbColumns.Any(column => column.Name == kvp.Key)).ToArray(); } } }
using System.Collections.Generic; using System; namespace MicroORM.Entity { internal sealed class EntityInfo { internal EntityInfo() { this.EntityState = EntityState.None; this.EntityHashSet = new Dictionary<string, string>(); this.LastCallTime = DateTime.Now; } internal bool CanBeRemoved { get { return DateTime.Now.Subtract(this.LastCallTime) > TimeSpan.FromMinutes(2); } } internal EntityState EntityState { get; set; } internal Dictionary<string, string> EntityHashSet { get; set; } internal DateTime LastCallTime { get; set; } } }
apache-2.0
C#
e58e8182a5c4cf8fca874230fe4312dd26222fae
Fix bad propertyname for Watch.Meta in master, relates to #2839
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/XPack/Watcher/Watch.cs
src/Nest/XPack/Watcher/Watch.cs
using System.Collections.Generic; using Newtonsoft.Json; namespace Nest { [JsonObject] public class Watch { [JsonProperty("metadata")] public IReadOnlyDictionary<string, object> Meta { get; internal set; } [JsonProperty("input")] public IInputContainer Input { get; internal set; } [JsonProperty("condition")] public IConditionContainer Condition { get; internal set; } [JsonProperty("trigger")] public ITriggerContainer Trigger { get; internal set; } [JsonProperty("transform")] public ITransformContainer Transform { get; internal set; } [JsonProperty("actions")] [JsonConverter(typeof(ActionsJsonConverter))] public Actions Actions { get; internal set; } [JsonProperty("status")] public WatchStatus Status { get; internal set; } [JsonProperty("throttle_period")] public string ThrottlePeriod { get; internal set; } } }
using System.Collections.Generic; using Newtonsoft.Json; namespace Nest { [JsonObject] public class Watch { [JsonProperty("meta")] public IReadOnlyDictionary<string, object> Meta { get; internal set; } [JsonProperty("input")] public IInputContainer Input { get; internal set; } [JsonProperty("condition")] public IConditionContainer Condition { get; internal set; } [JsonProperty("trigger")] public ITriggerContainer Trigger { get; internal set; } [JsonProperty("transform")] public ITransformContainer Transform { get; internal set; } [JsonProperty("actions")] [JsonConverter(typeof(ActionsJsonConverter))] public Actions Actions { get; internal set; } [JsonProperty("status")] public WatchStatus Status { get; internal set; } [JsonProperty("throttle_period")] public string ThrottlePeriod { get; internal set; } } }
apache-2.0
C#
f3b8a8a440116bd0153a58dc6c8d2178445bf26c
Format for output window message changed
msawczyn/EFDesigner,msawczyn/EFDesigner,msawczyn/EFDesigner
src/DslPackage/CustomCode/Messages.cs
src/DslPackage/CustomCode/Messages.cs
using System; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; namespace Sawczyn.EFDesigner.EFModel { internal static class Messages { private static readonly string MessagePaneTitle = "Entity Framework Designer"; private static IVsOutputWindow _outputWindow; private static IVsOutputWindow OutputWindow => _outputWindow ?? (_outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow); private static IVsOutputWindowPane _outputWindowPane; private static IVsOutputWindowPane OutputWindowPane { get { if (_outputWindowPane == null) { Guid paneGuid = new Guid(Constants.EFDesignerOutputPane); OutputWindow?.GetPane(ref paneGuid, out _outputWindowPane); if (_outputWindowPane == null) { OutputWindow?.CreatePane(ref paneGuid, MessagePaneTitle, 1, 1); OutputWindow?.GetPane(ref paneGuid, out _outputWindowPane); } } return _outputWindowPane; } } public static void AddError(string message) { AddMessage(message, "Error"); } public static void AddWarning(string message) { AddMessage(message, "Warning"); } public static void AddMessage(string message, string prefix = null) { OutputWindowPane?.OutputString($"{(string.IsNullOrWhiteSpace(prefix) ? "" : prefix + ": ")}{message}{(message.EndsWith("\n") ? "" : "\n")}"); OutputWindowPane?.Activate(); } } }
using System; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; namespace Sawczyn.EFDesigner.EFModel { internal static class Messages { private static readonly string MessagePaneTitle = "Entity Framework Designer"; private static IVsOutputWindow _outputWindow; private static IVsOutputWindow OutputWindow => _outputWindow ?? (_outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow); private static IVsOutputWindowPane _outputWindowPane; private static IVsOutputWindowPane OutputWindowPane { get { if (_outputWindowPane == null) { Guid paneGuid = new Guid(Constants.EFDesignerOutputPane); OutputWindow?.GetPane(ref paneGuid, out _outputWindowPane); if (_outputWindowPane == null) { OutputWindow?.CreatePane(ref paneGuid, MessagePaneTitle, 1, 1); OutputWindow?.GetPane(ref paneGuid, out _outputWindowPane); } } return _outputWindowPane; } } public static void AddError(string message) { OutputWindowPane?.OutputString($"Error: {message}"); OutputWindowPane?.Activate(); } public static void AddWarning(string message) { OutputWindowPane?.OutputString($"Warning: {message}"); OutputWindowPane?.Activate(); } public static void AddMessage(string message) { OutputWindowPane?.OutputString(message); OutputWindowPane?.Activate(); } } }
mit
C#
bb491f56c7d21c64afec3d42cea36812f312900b
Fix startup
NSwag/NSwag,quails4Eva/NSwag,quails4Eva/NSwag,RSuter/NSwag,RSuter/NSwag,RSuter/NSwag,NSwag/NSwag,RSuter/NSwag,quails4Eva/NSwag,RSuter/NSwag,quails4Eva/NSwag,NSwag/NSwag,NSwag/NSwag
src/NSwag.Sample.NETCore21/Startup.cs
src/NSwag.Sample.NETCore21/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using NSwag.AspNetCore; namespace NSwag.Sample.NETCore21 { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwagger(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseMvc(); app.UseSwaggerUi3WithApiExplorer(); } } }
using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using NSwag.AspNetCore; using NSwag.SwaggerGeneration; using NSwag.SwaggerGeneration.AspNetCore; namespace NSwag.Sample.NETCore21 { public class MySettingsFactory : SwaggerGeneratorSettingsFactoryBase<AspNetCoreToSwaggerGeneratorSettings, IServiceProvider> { protected override async Task ConfigureAsync(AspNetCoreToSwaggerGeneratorSettings settings, IServiceProvider context) { settings.Title = "Hello from settings factory!"; } } public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwagger(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseMvc(); app.UseSwaggerWithApiExplorer(settings => settings.SettingsFactory = new MySettingsFactory()); app.UseSwagger(typeof(Startup).Assembly, settings => settings.SwaggerRoute = "/oldswagger.json"); app.UseSwaggerUi3WithApiExplorer(); //app.UseSwagger(typeof(Startup).Assembly, settings => settings.SwaggerRoute = "/oldswagger.json"); } } }
mit
C#
0082d559145649066e3c16370f609f9fc94fef15
Allow custom date format when displaying published state
rtpHarry/Orchard,omidnasri/Orchard,LaserSrl/Orchard,fassetar/Orchard,OrchardCMS/Orchard,yersans/Orchard,bedegaming-aleksej/Orchard,AdvantageCS/Orchard,gcsuk/Orchard,yersans/Orchard,Serlead/Orchard,ehe888/Orchard,Serlead/Orchard,Dolphinsimon/Orchard,hbulzy/Orchard,AdvantageCS/Orchard,LaserSrl/Orchard,hbulzy/Orchard,fassetar/Orchard,ehe888/Orchard,gcsuk/Orchard,Fogolan/OrchardForWork,omidnasri/Orchard,AdvantageCS/Orchard,aaronamm/Orchard,omidnasri/Orchard,omidnasri/Orchard,omidnasri/Orchard,Lombiq/Orchard,omidnasri/Orchard,AdvantageCS/Orchard,jimasp/Orchard,Serlead/Orchard,LaserSrl/Orchard,IDeliverable/Orchard,jersiovic/Orchard,rtpHarry/Orchard,bedegaming-aleksej/Orchard,hbulzy/Orchard,aaronamm/Orchard,aaronamm/Orchard,gcsuk/Orchard,IDeliverable/Orchard,aaronamm/Orchard,omidnasri/Orchard,hbulzy/Orchard,rtpHarry/Orchard,rtpHarry/Orchard,jimasp/Orchard,Lombiq/Orchard,rtpHarry/Orchard,bedegaming-aleksej/Orchard,jimasp/Orchard,omidnasri/Orchard,Fogolan/OrchardForWork,OrchardCMS/Orchard,Lombiq/Orchard,ehe888/Orchard,Dolphinsimon/Orchard,ehe888/Orchard,OrchardCMS/Orchard,Lombiq/Orchard,Fogolan/OrchardForWork,Lombiq/Orchard,jimasp/Orchard,yersans/Orchard,Serlead/Orchard,aaronamm/Orchard,LaserSrl/Orchard,bedegaming-aleksej/Orchard,Serlead/Orchard,yersans/Orchard,IDeliverable/Orchard,fassetar/Orchard,bedegaming-aleksej/Orchard,OrchardCMS/Orchard,jimasp/Orchard,gcsuk/Orchard,Dolphinsimon/Orchard,fassetar/Orchard,Fogolan/OrchardForWork,Dolphinsimon/Orchard,hbulzy/Orchard,jersiovic/Orchard,ehe888/Orchard,IDeliverable/Orchard,Fogolan/OrchardForWork,AdvantageCS/Orchard,gcsuk/Orchard,omidnasri/Orchard,fassetar/Orchard,jersiovic/Orchard,Dolphinsimon/Orchard,jersiovic/Orchard,OrchardCMS/Orchard,yersans/Orchard,jersiovic/Orchard,LaserSrl/Orchard,IDeliverable/Orchard
src/Orchard.Web/Core/Common/Shapes.cs
src/Orchard.Web/Core/Common/Shapes.cs
using System; using System.Web; using System.Web.Mvc; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.Localization; using Orchard.Mvc.Html; namespace Orchard.Core.Common { public class Shapes : IShapeTableProvider { public Shapes() { T = NullLocalizer.Instance; } public Localizer T { get; set; } public void Discover(ShapeTableBuilder builder) { builder.Describe("Body_Editor") .OnDisplaying(displaying => { string flavor = displaying.Shape.EditorFlavor; displaying.ShapeMetadata.Alternates.Add("Body_Editor__" + flavor); }); } [Shape] public IHtmlString PublishedState(dynamic Display, DateTime createdDateTimeUtc, DateTime? publisheddateTimeUtc, LocalizedString customDateFormat) { if (!publisheddateTimeUtc.HasValue) { return T("Draft"); } return Display.DateTime(DateTimeUtc: createdDateTimeUtc, CustomFormat: customDateFormat); } [Shape] public IHtmlString PublishedWhen(dynamic Display, DateTime? dateTimeUtc) { if (dateTimeUtc == null) return T("as a Draft"); return Display.DateTimeRelative(DateTimeUtc: dateTimeUtc); } } }
using System; using System.Web; using System.Web.Mvc; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.Localization; using Orchard.Mvc.Html; namespace Orchard.Core.Common { public class Shapes : IShapeTableProvider { public Shapes() { T = NullLocalizer.Instance; } public Localizer T { get; set; } public void Discover(ShapeTableBuilder builder) { builder.Describe("Body_Editor") .OnDisplaying(displaying => { string flavor = displaying.Shape.EditorFlavor; displaying.ShapeMetadata.Alternates.Add("Body_Editor__" + flavor); }); } [Shape] public IHtmlString PublishedState(dynamic Display, DateTime createdDateTimeUtc, DateTime? publisheddateTimeUtc) { if (!publisheddateTimeUtc.HasValue) { return T("Draft"); } return Display.DateTime(DateTimeUtc: createdDateTimeUtc); } [Shape] public IHtmlString PublishedWhen(dynamic Display, DateTime? dateTimeUtc) { if (dateTimeUtc == null) return T("as a Draft"); return Display.DateTimeRelative(DateTimeUtc: dateTimeUtc); } } }
bsd-3-clause
C#
5784b8452f0624fefd8e55178b4233a9c33b58ac
Fix suppresion file encoding
John-Hart/autorest,devigned/autorest,Azure/azure-sdk-for-java,devigned/autorest,jhendrixMSFT/autorest,amarzavery/AutoRest,John-Hart/autorest,jianghaolu/AutoRest,tbombach/autorest,Azure/azure-sdk-for-java,Azure/autorest,tbombach/autorest,fhoring/autorest,stankovski/AutoRest,AzCiS/autorest,jhancock93/autorest,garimakhulbe/autorest,sharadagarwal/autorest,lmazuel/autorest,garimakhulbe/autorest,anudeepsharma/autorest,BurtBiel/autorest,matthchr/autorest,BurtBiel/autorest,csmengwan/autorest,brodyberg/autorest,jhancock93/autorest,Azure/autorest,tbombach/autorest,veronicagg/autorest,garimakhulbe/autorest,annatisch/autorest,amarzavery/AutoRest,haocs/autorest,csmengwan/autorest,sergey-shandar/autorest,yugangw-msft/autorest,tbombach/autorest,hovsepm/AutoRest,veronicagg/autorest,begoldsm/autorest,jhendrixMSFT/autorest,fhoring/autorest,selvasingh/azure-sdk-for-java,vulcansteel/autorest,xingwu1/autorest,garimakhulbe/autorest,balajikris/autorest,vishrutshah/autorest,vishrutshah/autorest,yugangw-msft/autorest,annatisch/autorest,garimakhulbe/autorest,matthchr/autorest,devigned/autorest,jkonecki/autorest,stankovski/AutoRest,annatisch/autorest,ljhljh235/AutoRest,brodyberg/autorest,lmazuel/autorest,hovsepm/AutoRest,vulcansteel/autorest,John-Hart/autorest,sharadagarwal/autorest,matthchr/autorest,hovsepm/AutoRest,vulcansteel/autorest,veronicagg/autorest,garimakhulbe/autorest,jhancock93/autorest,stankovski/AutoRest,balajikris/autorest,fhoring/autorest,yugangw-msft/autorest,veronicagg/autorest,haocs/autorest,anudeepsharma/autorest,dsgouda/autorest,vishrutshah/autorest,amarzavery/AutoRest,jhendrixMSFT/autorest,jianghaolu/AutoRest,ljhljh235/AutoRest,jhancock93/autorest,haocs/autorest,matthchr/autorest,annatisch/autorest,Azure/autorest,lmazuel/autorest,sharadagarwal/autorest,sharadagarwal/autorest,anudeepsharma/autorest,ljhljh235/AutoRest,brodyberg/autorest,haocs/autorest,amarzavery/AutoRest,xingwu1/autorest,tbombach/autorest,hovsepm/AutoRest,balajikris/autorest,balajikris/autorest,John-Hart/autorest,yaqiyang/autorest,garimakhulbe/autorest,dsgouda/autorest,yugangw-msft/autorest,jhancock93/autorest,BurtBiel/autorest,matthchr/autorest,brodyberg/autorest,sergey-shandar/autorest,tbombach/autorest,haocs/autorest,xingwu1/autorest,selvasingh/azure-sdk-for-java,annatisch/autorest,jianghaolu/AutoRest,jhancock93/autorest,olydis/autorest,tbombach/autorest,begoldsm/autorest,anudeepsharma/autorest,vishrutshah/autorest,dsgouda/autorest,BurtBiel/autorest,BurtBiel/autorest,yaqiyang/autorest,dsgouda/autorest,matthchr/autorest,balajikris/autorest,annatisch/autorest,garimakhulbe/autorest,AzCiS/autorest,selvasingh/azure-sdk-for-java,navalev/azure-sdk-for-java,vulcansteel/autorest,brodyberg/autorest,veronicagg/autorest,devigned/autorest,jianghaolu/AutoRest,fearthecowboy/autorest,sharadagarwal/autorest,AzCiS/autorest,anudeepsharma/autorest,begoldsm/autorest,balajikris/autorest,sergey-shandar/autorest,sharadagarwal/autorest,yaqiyang/autorest,begoldsm/autorest,tbombach/autorest,AzCiS/autorest,jianghaolu/AutoRest,begoldsm/autorest,vulcansteel/autorest,John-Hart/autorest,veronicagg/autorest,devigned/autorest,hovsepm/AutoRest,lmazuel/autorest,lmazuel/autorest,yaqiyang/autorest,jhendrixMSFT/autorest,sergey-shandar/autorest,yugangw-msft/autorest,sharadagarwal/autorest,stankovski/AutoRest,veronicagg/autorest,AzCiS/autorest,John-Hart/autorest,stankovski/AutoRest,yugangw-msft/autorest,navalev/azure-sdk-for-java,annatisch/autorest,fhoring/autorest,fhoring/autorest,jhancock93/autorest,ljhljh235/AutoRest,vishrutshah/autorest,fhoring/autorest,fearthecowboy/autorest,vulcansteel/autorest,stankovski/AutoRest,jkonecki/autorest,sergey-shandar/autorest,csmengwan/autorest,haocs/autorest,vishrutshah/autorest,amarzavery/AutoRest,xingwu1/autorest,csmengwan/autorest,lmazuel/autorest,jkonecki/autorest,devigned/autorest,xingwu1/autorest,yugangw-msft/autorest,csmengwan/autorest,John-Hart/autorest,olydis/autorest,jkonecki/autorest,hovsepm/AutoRest,anudeepsharma/autorest,hovsepm/AutoRest,BurtBiel/autorest,balajikris/autorest,garimakhulbe/autorest,amarzavery/AutoRest,AzCiS/autorest,hovsepm/AutoRest,balajikris/autorest,csmengwan/autorest,anudeepsharma/autorest,dsgouda/autorest,annatisch/autorest,lmazuel/autorest,Azure/autorest,yugangw-msft/autorest,sharadagarwal/autorest,matthchr/autorest,begoldsm/autorest,jianghaolu/AutoRest,fhoring/autorest,hovsepm/AutoRest,devigned/autorest,dsgouda/autorest,dsgouda/autorest,sergey-shandar/autorest,devigned/autorest,anudeepsharma/autorest,annatisch/autorest,lmazuel/autorest,xingwu1/autorest,vulcansteel/autorest,amarzavery/AutoRest,matthchr/autorest,vishrutshah/autorest,dsgouda/autorest,fhoring/autorest,navalev/azure-sdk-for-java,brodyberg/autorest,veronicagg/autorest,veronicagg/autorest,Azure/azure-sdk-for-java,BurtBiel/autorest,jianghaolu/AutoRest,begoldsm/autorest,jhancock93/autorest,jhancock93/autorest,brodyberg/autorest,lmazuel/autorest,ljhljh235/AutoRest,jkonecki/autorest,haocs/autorest,xingwu1/autorest,Azure/azure-sdk-for-java,AzCiS/autorest,vishrutshah/autorest,haocs/autorest,sergey-shandar/autorest,ljhljh235/AutoRest,jianghaolu/AutoRest,navalev/azure-sdk-for-java,brjohnstmsft/autorest,Azure/azure-sdk-for-java,anudeepsharma/autorest,csmengwan/autorest,sergey-shandar/autorest,devigned/autorest,stankovski/AutoRest,amarzavery/AutoRest,begoldsm/autorest,ljhljh235/AutoRest,navalev/azure-sdk-for-java,fhoring/autorest,yugangw-msft/autorest,sergey-shandar/autorest,xingwu1/autorest,ljhljh235/AutoRest,csmengwan/autorest,haocs/autorest,yaqiyang/autorest,balajikris/autorest,John-Hart/autorest,yaqiyang/autorest,brodyberg/autorest,yaqiyang/autorest,AzCiS/autorest,tbombach/autorest,BurtBiel/autorest,stankovski/AutoRest,jianghaolu/AutoRest,brjohnstmsft/autorest,dsgouda/autorest,matthchr/autorest,yaqiyang/autorest,begoldsm/autorest,amarzavery/AutoRest,vishrutshah/autorest
AutoRest/Generators/Extensions/Azure.Extensions/GlobalSuppressions.cs
AutoRest/Generators/Extensions/Azure.Extensions/GlobalSuppressions.cs
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. // // To add a suppression to this file, right-click the message in the // Code Analysis results, point to "Suppress Message", and click // "In Suppression File". // You do not need to add suppressions to this file manually. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.Rest.Generator.Azure.AzureExtensions.#AddPageableMethod(Microsoft.Rest.Generator.ClientModel.ServiceClient,Microsoft.Rest.Generator.CodeNamer)")]
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. // // To add a suppression to this file, right-click the message in the // Code Analysis results, point to "Suppress Message", and click // "In Suppression File". // You do not need to add suppressions to this file manually. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Scope = "member", Target = "Microsoft.Rest.Generator.Azure.AzureExtensions.#AddPageableMethod(Microsoft.Rest.Generator.ClientModel.ServiceClient,Microsoft.Rest.Generator.CodeNamer)")]
mit
C#
5f9be0f6f7728439e14bcb26f035ef592faa0902
Add clipping for Gtk2 context
residuum/xwt,antmicro/xwt,mminns/xwt,TheBrainTech/xwt,akrisiun/xwt,mminns/xwt,sevoku/xwt,iainx/xwt,hwthomas/xwt,mono/xwt,hamekoz/xwt,directhex/xwt,lytico/xwt,steffenWi/xwt,cra0zy/xwt
Xwt.Gtk/Xwt.GtkBackend/CanvasBackendGtk2.cs
Xwt.Gtk/Xwt.GtkBackend/CanvasBackendGtk2.cs
// // CanvasBackendGtk.cs // // Author: // Vsevolod Kukol <[email protected]> // // Copyright (c) 2014 Vsevolod Kukol // // 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.Linq; using Xwt.CairoBackend; namespace Xwt.GtkBackend { partial class CustomCanvas { protected override void OnSizeRequested (ref Gtk.Requisition requisition) { base.OnSizeRequested (ref requisition); foreach (var cr in children.ToArray ()) cr.Key.SizeRequest (); } protected override bool OnExposeEvent (Gdk.EventExpose evnt) { var a = evnt.Area; using (var ctx = CreateContext ()) { // Set context Origin from initial Cairo CTM (to ensure new Xwt CTM is Identity Matrix) ctx.Origin.X = ctx.Context.Matrix.X0; ctx.Origin.Y = ctx.Context.Matrix.Y0; // Gdk Expose event supplies the area to be redrawn - but need to adjust X,Y for context Origin Rectangle dirtyRect = new Rectangle (a.X-ctx.Origin.X, a.Y-ctx.Origin.Y, a.Width, a.Height); ctx.Context.Rectangle (dirtyRect.X, dirtyRect.Y, dirtyRect.Width, dirtyRect.Height); ctx.Context.Clip (); OnDraw (dirtyRect, ctx); } return base.OnExposeEvent (evnt); } } }
// // CanvasBackendGtk.cs // // Author: // Vsevolod Kukol <[email protected]> // // Copyright (c) 2014 Vsevolod Kukol // // 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.Linq; using Xwt.CairoBackend; namespace Xwt.GtkBackend { partial class CustomCanvas { protected override void OnSizeRequested (ref Gtk.Requisition requisition) { base.OnSizeRequested (ref requisition); foreach (var cr in children.ToArray ()) cr.Key.SizeRequest (); } protected override bool OnExposeEvent (Gdk.EventExpose evnt) { var ctx = CreateContext (); // Set context Origin from initial Cairo CTM (to ensure new Xwt CTM is Identity Matrix) ctx.Origin.X = ctx.Context.Matrix.X0; ctx.Origin.Y = ctx.Context.Matrix.Y0; // Gdk Expose event supplies the area to be redrawn - but need to adjust X,Y for context Origin var a = evnt.Area; Rectangle dirtyRect = new Rectangle (a.X-ctx.Origin.X, a.Y-ctx.Origin.Y, a.Width, a.Height); OnDraw (dirtyRect, ctx); return base.OnExposeEvent (evnt); } } }
mit
C#
9bdf99e28afe5cc35e16cfb60674d3733b1e7dc1
add space
cartermp/dnx-apps
libs/lib/src/Lib/Lib.cs
libs/lib/src/Lib/Lib.cs
using System; #if NET40 using System.Net; #else using System.Net.Http; using System.Threading.Tasks; #endif using System.Text.RegularExpressions; namespace Lib { public class Library { #if NET40 private readonly WebClient _client = new WebClient(); private readonly object _locker = new object(); #else private readonly HttpClient _client = new HttpClient(); #endif #if NET40 public string GetDotNetCount() { string url = "http://www.dotnetfoundation.org/"; var uri = new Uri(url); string result = ""; lock(_locker) { result = _client.DownloadString(uri); } int dotNetCount = Regex.Matches(result, ".NET").Count; return $"Dotnet Foundation mentions .NET {dotNetCount} times!"; } #else public async Task<string> GetDotNetCountAsync() { string url = "http://www.dotnetfoundation.org/"; var result = await _client.GetStringAsync(url); int dotNetCount = Regex.Matches(result, ".NET").Count; return $"dotnetfoundation.org mentions .NET {dotNetCount} times in its HTML!"; } #endif } }
using System; #if NET40 using System.Net; #else using System.Net.Http; using System.Threading.Tasks; #endif using System.Text.RegularExpressions; namespace Lib { public class Library { #if NET40 private readonly WebClient _client = new WebClient(); private readonly object _locker = new object(); #else private readonly HttpClient _client = new HttpClient(); #endif #if NET40 public string GetDotNetCount() { string url = "http://www.dotnetfoundation.org/"; var uri = new Uri(url); string result = ""; lock(_locker) { result = _client.DownloadString(uri); } int dotNetCount = Regex.Matches(result, ".NET").Count; return $"Dotnet Foundation mentions .NET {dotNetCount} times!"; } #else public async Task<string> GetDotNetCountAsync() { string url = "http://www.dotnetfoundation.org/"; var result = await _client.GetStringAsync(url); int dotNetCount = Regex.Matches(result, ".NET").Count; return $"dotnetfoundation.orgmentions .NET {dotNetCount} times in its HTML!"; } #endif } }
mit
C#
3a7547d2df9fc178c0e62ea0ca4441e6028eba74
use GetClientCertAsync
MienDev/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4
samples/Clients/src/SampleApi/ConfirmationValidationMiddleware.cs
samples/Clients/src/SampleApi/ConfirmationValidationMiddleware.cs
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; using System; using System.Threading.Tasks; namespace SampleApi { // this middleware validate the cnf claim (if present) against the thumbprint of the X.509 client certificate for the current client public class ConfirmationValidationMiddleware { private readonly RequestDelegate _next; public ConfirmationValidationMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext ctx) { if (ctx.User.Identity.IsAuthenticated) { var cnfJson = ctx.User.FindFirst("cnf")?.Value; if (!String.IsNullOrWhiteSpace(cnfJson)) { var certResult = await ctx.AuthenticateAsync("x509"); if (!certResult.Succeeded) { await ctx.ChallengeAsync("x509"); return; } var cert = await ctx.Connection.GetClientCertificateAsync(); if (cert == null) { await ctx.ChallengeAsync("x509"); return; } var thumbprint = cert.Thumbprint; var cnf = JObject.Parse(cnfJson); var sha256 = cnf.Value<string>("x5t#S256"); if (String.IsNullOrWhiteSpace(sha256) || !thumbprint.Equals(sha256, StringComparison.OrdinalIgnoreCase)) { await ctx.ChallengeAsync("token"); return; } } } await _next(ctx); } } }
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; using System; using System.Threading.Tasks; namespace SampleApi { // this middleware validate the cnf claim (if present) against the thumbprint of the X.509 client certificate for the current client public class ConfirmationValidationMiddleware { private readonly RequestDelegate _next; public ConfirmationValidationMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext ctx) { if (ctx.User.Identity.IsAuthenticated) { var cnfJson = ctx.User.FindFirst("cnf")?.Value; if (!String.IsNullOrWhiteSpace(cnfJson)) { var certResult = await ctx.AuthenticateAsync("x509"); if (!certResult.Succeeded) { await ctx.ChallengeAsync("x509"); return; } var cert = ctx.Connection.ClientCertificate; if (cert == null) { await ctx.ChallengeAsync("x509"); return; } var thumbprint = cert.Thumbprint; var cnf = JObject.Parse(cnfJson); var sha256 = cnf.Value<string>("x5t#S256"); if (String.IsNullOrWhiteSpace(sha256) || !thumbprint.Equals(sha256, StringComparison.OrdinalIgnoreCase)) { await ctx.ChallengeAsync("token"); return; } } } await _next(ctx); } } }
apache-2.0
C#
bddd89f9e08728756450804f86b411b4b73e75d2
disable backup for cache
mgj/fetcher,mgj/fetcher
Fetcher.Touch/Services/FetcherRepositoryStoragePathService.cs
Fetcher.Touch/Services/FetcherRepositoryStoragePathService.cs
using artm.Fetcher.Core.Services; using Foundation; using System; using System.IO; namespace artm.Fetcher.Touch.Services { public class FetcherRepositoryStoragePathService : IFetcherRepositoryStoragePathService { public string GetPath(string filename = "fetcher.db3") { var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var cache = Path.Combine(documents, "..", "Library", "Caches"); var fullPath = Path.Combine(cache, filename); if (File.Exists(fullPath)) { NSFileManager.SetSkipBackupAttribute(fullPath, true); } return fullPath; } } }
using artm.Fetcher.Core.Services; using System; using System.IO; namespace artm.Fetcher.Touch.Services { public class FetcherRepositoryStoragePathService : IFetcherRepositoryStoragePathService { public string GetPath(string filename = "fetcher.db3") { var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var cache = Path.Combine(documents, "..", "Library", "Caches"); var fullPath = Path.Combine(cache, filename); return fullPath; } } }
apache-2.0
C#
8824fe2ac60814da50f4afbdabc074c1e00205ea
Fix erros after rebase. #381
Sitecore/Sitecore-Instance-Manager
src/SIM.Sitecore9Installer/Validation/Validators/BaseValidator.cs
src/SIM.Sitecore9Installer/Validation/Validators/BaseValidator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Task = SIM.Sitecore9Installer.Tasks.Task; namespace SIM.Sitecore9Installer.Validation.Validators { public abstract class BaseValidator:IValidator { public BaseValidator() { this.Data = new Dictionary<string, string>(); } public virtual IEnumerable<ValidationResult> Evaluate(IEnumerable<Task> tasks) { List<ValidationResult> results = new List<ValidationResult>(); foreach (Task task in tasks) { IEnumerable<InstallParam> tParams = task.LocalParams.Where(p => !this.GetParamNames().Any()|| this.GetParamNames().Contains(p.Name)); if (tParams.Any()||!task.LocalParams.Any()) { results.AddRange(this.GetErrorsForTask(task,tParams)); } } if (!results.Any()) { results.Add(new ValidationResult(ValidatorState.Success, string.Empty, null)); } return results; } protected abstract IEnumerable<ValidationResult> GetErrorsForTask(Task task, IEnumerable<InstallParam> paramsToValidate); public Dictionary<string, string> Data { get; set; } protected virtual IEnumerable<string> GetParamNames() { if (this.Data.ContainsKey("ParamNames")) { return this.Data["ParamNames"].Split(','); } return new string[0]; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Task = SIM.Sitecore9Installer.Tasks.Task; namespace SIM.Sitecore9Installer.Validation.Validators { public abstract class BaseValidator:IValidator { public BaseValidator() { this.Data = new Dictionary<string, string>(); } public virtual IEnumerable<ValidationResult> Evaluate(IEnumerable<Task> tasks) { List<ValidationResult> results = new List<ValidationResult>(); foreach (Task task in tasks) { IEnumerable<InstallParam> tParams = task.LocalParams.Where(p => this.GetParamNames().Contains(p.Name)); if (tParams.Any()) { results.AddRange(this.GetErrorsForTask(task,tParams)); } } if (!results.Any()) { results.Add(new ValidationResult(ValidatorState.Success, string.Empty, null)); } return results; } protected abstract IEnumerable<ValidationResult> GetErrorsForTask(Task task, IEnumerable<InstallParam> paramsToValidate); public Dictionary<string, string> Data { get; set; } protected virtual IEnumerable<string> GetParamNames() { if (this.Data.ContainsKey("ParamNames")) { return this.Data["ParamNames"].Split(','); } return new string[0]; } } }
mit
C#
4e1e235aa969422cbae9282035ca4dcb8db1b80a
Add tests
skonves/Konves.ChordPro
tests/Konves.ChordPro.UnitTests/DirectiveComponentsTestFixture.cs
tests/Konves.ChordPro.UnitTests/DirectiveComponentsTestFixture.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Konves.ChordPro.UnitTests { [TestClass] public class DirectiveComponentsTestFixture { [TestMethod] public void TryParseTest() { DoTryParseTest("{asdf:qwerty}", true, "asdf", string.Empty, "qwerty"); DoTryParseTest(" { asdf : qwerty } ", true, "asdf", string.Empty, "qwerty"); DoTryParseTest("{asdf abc:qwerty}", true, "asdf", "abc", "qwerty"); DoTryParseTest(" { asdf abc : qwerty asdf } ", true, "asdf", "abc", "qwerty asdf"); DoTryParseTest("{asdf:qwerty}#Comment", true, "asdf", string.Empty, "qwerty"); DoTryParseTest(" { asdf : qwerty } # Comment", true, "asdf", string.Empty, "qwerty"); DoTryParseTest("{asdf abc:qwerty}# Comment", true, "asdf", "abc", "qwerty"); DoTryParseTest(" { asdf abc : qwerty asdf } # Comment", true, "asdf", "abc", "qwerty asdf"); DoTryParseTest("{}", false, null, null, null); DoTryParseTest("asdf", false, null, null, null); DoTryParseTest("{:asdf}", false, null, null, null); // DoTryParseTest("{asdf asdf asdf:asdf}", false, null, null, null); } private void DoTryParseTest(string input, bool expectedResult, string expectedKey, string expectedSubKey, string expectedValue) { // Arrange DirectiveComponents components; // Act bool result = DirectiveComponents.TryParse(input, out components); // Assert Assert.AreEqual(expectedResult, result); Assert.AreEqual(expectedKey, components?.Key); Assert.AreEqual(expectedSubKey, components?.SubKey); Assert.AreEqual(expectedValue, components?.Value); } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Konves.ChordPro.UnitTests { [TestClass] public class DirectiveComponentsTestFixture { [TestMethod] public void TryParseTest() { DoTryParseTest("{asdf:qwerty}", true, "asdf", string.Empty, "qwerty"); DoTryParseTest(" { asdf : qwerty } ", true, "asdf", string.Empty, "qwerty"); DoTryParseTest("{asdf abc:qwerty}", true, "asdf", "abc", "qwerty"); DoTryParseTest(" { asdf abc : qwerty asdf } ", true, "asdf", "abc", "qwerty asdf"); DoTryParseTest("{asdf:qwerty}#Comment", true, "asdf", string.Empty, "qwerty"); DoTryParseTest(" { asdf : qwerty } # Comment", true, "asdf", string.Empty, "qwerty"); DoTryParseTest("{asdf abc:qwerty}# Comment", true, "asdf", "abc", "qwerty"); DoTryParseTest(" { asdf abc : qwerty asdf } # Comment", true, "asdf", "abc", "qwerty asdf"); DoTryParseTest("{}", false, null, null, null); } private void DoTryParseTest(string input, bool expectedResult, string expectedKey, string expectedSubKey, string expectedValue) { // Arrange DirectiveComponents components; // Act bool result = DirectiveComponents.TryParse(input, out components); // Assert Assert.AreEqual(expectedResult, result); Assert.AreEqual(expectedKey, components?.Key); Assert.AreEqual(expectedSubKey, components?.SubKey); Assert.AreEqual(expectedValue, components?.Value); } } }
apache-2.0
C#
fad460d69e4a133b05de63d502288eca3066a56b
Add ability to save commands mapping
StanislavUshakov/ArduinoWindowsRemoteControl
ArduinoWindowsRemoteControl/Services/RemoteCommandParserService.cs
ArduinoWindowsRemoteControl/Services/RemoteCommandParserService.cs
using Arduino; using ArduinoWindowsRemoteControl.Repositories; using Core.Interfaces; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ArduinoWindowsRemoteControl.Services { /// <summary> /// Service that returns parsers for different remote input devices /// </summary> public class RemoteCommandParserService { #region Private Fields private DictionaryRepository _dictionaryRepository; #endregion #region Constructor public RemoteCommandParserService() { _dictionaryRepository = new DictionaryRepository(); } #endregion #region Public Methods public ArduinoRemoteCommandParser LoadArduinoCommandParser(string filename) { var dictionary = _dictionaryRepository.Load<int, RemoteCommand>(filename); return new ArduinoRemoteCommandParser(dictionary); } public void SaveArduinoCommandParser(ArduinoRemoteCommandParser commandParser, string filename) { _dictionaryRepository.Save(commandParser.CommandsMapping, filename); } #endregion } }
using Arduino; using ArduinoWindowsRemoteControl.Repositories; using Core.Interfaces; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ArduinoWindowsRemoteControl.Services { /// <summary> /// Service that returns parsers for different remote input devices /// </summary> public class RemoteCommandParserService { #region Private Fields private DictionaryRepository _dictionaryRepository; #endregion #region Constructor public RemoteCommandParserService() { _dictionaryRepository = new DictionaryRepository(); } #endregion #region Public Methods public ArduinoRemoteCommandParser LoadArduinoCommandParser(string filename) { var dictionary = _dictionaryRepository.Load<int, RemoteCommand>(filename); return new ArduinoRemoteCommandParser(dictionary); } public void SaveArduinoCommandParser(ArduinoRemoteCommandParser commandParser, string filename) { } #endregion } }
mit
C#
c6f89d31a915d25917ae683424ced705d96c21d3
Rename Url -> QueryString (typo)
erik-kallen/SaltarelleCompiler,drysart/SaltarelleCompiler,ProdigySim/SaltarelleCompiler,Saltarelle/SaltarelleCompiler,ProdigySim/SaltarelleCompiler,enginekit/SaltarelleCompiler,kenneyw/SaltarelleCompiler,jamescourtney/SaltarelleCompiler,ayo10/SaltarelleCompiler,marwijn/SaltarelleCompiler,AstrorEnales/SaltarelleCompiler,chenxustu1/SaltarelleCompiler,valeriob/SaltarelleCompiler,ayo10/SaltarelleCompiler,Saltarelle/SaltarelleCompiler,enginekit/SaltarelleCompiler,AstrorEnales/SaltarelleCompiler,kenneyw/SaltarelleCompiler,marwijn/SaltarelleCompiler,erik-kallen/SaltarelleCompiler,drysart/SaltarelleCompiler,valeriob/SaltarelleCompiler,jam40jeff/SaltarelleCompiler,marwijn/SaltarelleCompiler,chenxustu1/SaltarelleCompiler,valeriob/SaltarelleCompiler,x335/SaltarelleCompiler,jam40jeff/SaltarelleCompiler,drysart/SaltarelleCompiler,chenxustu1/SaltarelleCompiler,x335/SaltarelleCompiler,ProdigySim/SaltarelleCompiler,jam40jeff/SaltarelleCompiler,n9/SaltarelleCompiler,n9/SaltarelleCompiler,jamescourtney/SaltarelleCompiler,kenneyw/SaltarelleCompiler,jamescourtney/SaltarelleCompiler
Runtime/src/Libraries/NodeJS/QueryStringModule/QueryString.cs
Runtime/src/Libraries/NodeJS/QueryStringModule/QueryString.cs
using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; namespace NodeJS.QueryStringModule { [Imported] [GlobalMethods] [ModuleName("querystring")] public static class QueryString { public static string Stringify(JsDictionary obj) { return null; } public static string Stringify(JsDictionary obj, string sep) { return null; } public static string Stringify(JsDictionary obj, string sep, string eq) { return null; } public static JsDictionary Parse(string str) { return null; } public static JsDictionary Parse(string str, string sep) { return null; } public static JsDictionary Parse(string str, string sep, string eq) { return null; } public static JsDictionary Parse(string str, string sep, string eq, ParseOptions options) { return null; } } }
using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; namespace NodeJS.QueryStringModule { [Imported] [GlobalMethods] [ModuleName("querystring")] public static class Url { public static string Stringify(JsDictionary obj) { return null; } public static string Stringify(JsDictionary obj, string sep) { return null; } public static string Stringify(JsDictionary obj, string sep, string eq) { return null; } public static JsDictionary Parse(string str) { return null; } public static JsDictionary Parse(string str, string sep) { return null; } public static JsDictionary Parse(string str, string sep, string eq) { return null; } public static JsDictionary Parse(string str, string sep, string eq, ParseOptions options) { return null; } } }
apache-2.0
C#
39b8b77860f7ecb5e548d9ca12140d1834024133
Update MessagePackSerializer.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/MessagePack/MessagePackSerializer.cs
TIKSN.Core/Serialization/MessagePack/MessagePackSerializer.cs
using System.IO; using MsgPack.Serialization; namespace TIKSN.Serialization.MessagePack { public class MessagePackSerializer : SerializerBase<byte[]> { private readonly SerializationContext _serializationContext; public MessagePackSerializer(SerializationContext serializationContext) => this._serializationContext = serializationContext; protected override byte[] SerializeInternal<T>(T obj) { var serializer = this._serializationContext.GetSerializer<T>(); using var stream = new MemoryStream(); serializer.Pack(stream, obj); return stream.ToArray(); } } }
using System.IO; using MsgPack.Serialization; namespace TIKSN.Serialization.MessagePack { public class MessagePackSerializer : SerializerBase<byte[]> { private readonly SerializationContext _serializationContext; public MessagePackSerializer(SerializationContext serializationContext) => this._serializationContext = serializationContext; protected override byte[] SerializeInternal<T>(T obj) { var serializer = this._serializationContext.GetSerializer<T>(); using (var stream = new MemoryStream()) { serializer.Pack(stream, obj); return stream.ToArray(); } } } }
mit
C#
ec28e9a8a6a86c26913cf6bcf97e011e6d617b69
Fix build
blebougge/Catel
src/Catel.Core/Catel.Core.Shared/Runtime/Serialization/Models/SerializableKeyValuePair.cs
src/Catel.Core/Catel.Core.Shared/Runtime/Serialization/Models/SerializableKeyValuePair.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="SerializableKeyValuePair.cs" company="Catel development team"> // Copyright (c) 2008 - 2015 Catel development team. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace Catel.Runtime.Serialization { using System; /// <summary> /// Serializable key value pair. /// </summary> #if NET [Serializable] #endif public class SerializableKeyValuePair { /// <summary> /// Gets or sets the key. /// </summary> /// <value>The key.</value> public object Key { get; set; } /// <summary> /// Gets or sets the type of the key. /// </summary> /// <value>The type of the key.</value> [ExcludeFromSerialization] public Type KeyType { get; set; } /// <summary> /// Gets or sets the value. /// </summary> /// <value>The value.</value> public object Value { get; set; } /// <summary> /// Gets or sets the type of the value. /// </summary> /// <value>The type of the value.</value> [ExcludeFromSerialization] public Type ValueType { get; set; } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="SerializableKeyValuePair.cs" company="Catel development team"> // Copyright (c) 2008 - 2015 Catel development team. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace Catel.Runtime.Serialization { using System; /// <summary> /// Serializable key value pair. /// </summary> [Serializable] public class SerializableKeyValuePair { /// <summary> /// Gets or sets the key. /// </summary> /// <value>The key.</value> public object Key { get; set; } /// <summary> /// Gets or sets the type of the key. /// </summary> /// <value>The type of the key.</value> [ExcludeFromSerialization] public Type KeyType { get; set; } /// <summary> /// Gets or sets the value. /// </summary> /// <value>The value.</value> public object Value { get; set; } /// <summary> /// Gets or sets the type of the value. /// </summary> /// <value>The type of the value.</value> [ExcludeFromSerialization] public Type ValueType { get; set; } } }
mit
C#