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
4474c8be125d6236046733da43d63ffcd92fcb14
Set nuget package version to 2.0.0-beta1
andrewdavey/cassette,damiensawyer/cassette,honestegg/cassette,andrewdavey/cassette,andrewdavey/cassette,honestegg/cassette,BluewireTechnologies/cassette,BluewireTechnologies/cassette,honestegg/cassette,damiensawyer/cassette,damiensawyer/cassette
src/SharedAssemblyInfo.cs
src/SharedAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyCompany("Andrew Davey")] [assembly: AssemblyProduct("Cassette")] [assembly: AssemblyCopyright("Copyright © 2011 Andrew Davey")] [assembly: AssemblyInformationalVersion("2.0.0-beta1")] [assembly: AssemblyVersion("2.0.0.*")] [assembly: AssemblyFileVersion("2.0.0.0")]
using System.Reflection; [assembly: AssemblyCompany("Andrew Davey")] [assembly: AssemblyProduct("Cassette")] [assembly: AssemblyCopyright("Copyright © 2011 Andrew Davey")] // NOTE: When changing this version, also update Cassette.MSBuild\Cassette.targets to match. [assembly: AssemblyInformationalVersion("2.0.0")] [assembly: AssemblyVersion("2.0.0.*")] [assembly: AssemblyFileVersion("2.0.0.0")]
mit
C#
db09845c8a454a697a53744fcb2b4668c748338d
tweak snapshot LintRawRule
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Services/Snapshot/RawRuleLinterExtensions.cs
src/FilterLists.Services/Snapshot/RawRuleLinterExtensions.cs
using System; namespace FilterLists.Services.Snapshot { public static class RawRuleLinterExtensions { public static string LintRawRule(this string rule) { rule = rule.Trim(); rule = rule.DropIfTooLong(); rule = rule?.DropIfComment(); rule = rule?.DropIfContainsBackslashSingleQuote(); rule = rule?.TrimSingleBackslashFromEnd(); rule = rule?.DropIfEmpty(); return rule; } private static string DropIfTooLong(this string rule) => rule.Length > 8192 ? null : rule; private static string DropIfComment(this string rule) => rule.StartsWith(@"!", StringComparison.Ordinal) && !rule.StartsWith(@"!#", StringComparison.Ordinal) || rule.StartsWith(@"!##", StringComparison.Ordinal) ? null : rule; private static string DropIfContainsBackslashSingleQuote(this string rule) => rule.Contains(@"\'") ? null : rule; private static string TrimSingleBackslashFromEnd(this string rule) => rule.EndsWith(@"\", StringComparison.Ordinal) && !rule.EndsWith(@"\\", StringComparison.Ordinal) ? rule.Remove(rule.Length - 1) : rule; private static string DropIfEmpty(this string rule) => rule == string.Empty ? null : rule; } }
namespace FilterLists.Services.Snapshot { public static class RawRuleLinterExtensions { public static string LintRawRule(this string rule) { rule = rule?.TrimLeadingAndTrailingWhitespace(); rule = rule?.DropIfEmpty(); rule = rule?.DropIfComment(); rule = rule?.DropIfTooLong(); rule = rule?.DropIfContainsBackslashSingleQuote(); rule = rule?.TrimSingleBackslashFromEnd(); return rule; } private static string TrimLeadingAndTrailingWhitespace(this string rule) { char[] charsToTrim = {' ', '\t'}; return rule.Trim(charsToTrim); } private static string DropIfEmpty(this string rule) => rule == "" ? null : rule; private static string DropIfComment(this string rule) => rule.StartsWith(@"!") && !rule.StartsWith(@"!#") || rule.StartsWith(@"!##") ? null : rule; private static string DropIfTooLong(this string rule) => rule.Length > 8192 ? null : rule; private static string DropIfContainsBackslashSingleQuote(this string rule) => rule.Contains(@"\'") ? null : rule; private static string TrimSingleBackslashFromEnd(this string rule) => rule.EndsWith(@"\") && !rule.EndsWith(@"\\") ? rule.Remove(rule.Length - 1) : rule; } }
mit
C#
f0b215c0b562906d2eee66554c3b91c8e5a3238c
Support added for HTML comment removal
anuraj/HtmlMinificationMiddleware
src/HtmlMinificationMiddleware/HtmlMinificationMiddleware.cs
src/HtmlMinificationMiddleware/HtmlMinificationMiddleware.cs
namespace DotnetThoughts.AspNet { using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using System.IO; using System.Threading.Tasks; using System.Text; using System.Text.RegularExpressions; public class HtmlMinificationMiddleware { private RequestDelegate _next; public HtmlMinificationMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext context) { var stream = context.Response.Body; using (var buffer = new MemoryStream()) { context.Response.Body = buffer; await _next(context); var isHtml = context.Response.ContentType?.ToLower().Contains("text/html"); buffer.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(buffer)) { string responseBody = await reader.ReadToEndAsync(); if (context.Response.StatusCode == 200 && isHtml.GetValueOrDefault()) { responseBody = Regex.Replace(responseBody, @">\s+<", "><", RegexOptions.Compiled); responseBody = Regex.Replace(responseBody, @"<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->", "", RegexOptions.Compiled); } using (var memoryStream = new MemoryStream()) { var bytes = Encoding.UTF8.GetBytes(responseBody); memoryStream.Write(bytes, 0, bytes.Length); memoryStream.Seek(0, SeekOrigin.Begin); await memoryStream.CopyToAsync(stream, bytes.Length); } } } } } }
namespace DotnetThoughts.AspNet { using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using System.IO; using System.Threading.Tasks; using System.Text; using System.Text.RegularExpressions; public class HtmlMinificationMiddleware { private RequestDelegate _next; public HtmlMinificationMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext context) { var stream = context.Response.Body; using (var buffer = new MemoryStream()) { context.Response.Body = buffer; await _next(context); var isHtml = context.Response.ContentType?.ToLower().Contains("text/html"); buffer.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(buffer)) { string responseBody = await reader.ReadToEndAsync(); if (context.Response.StatusCode == 200 && isHtml.GetValueOrDefault()) { responseBody = Regex.Replace(responseBody, @">\s+<", "><", RegexOptions.Compiled); } using (var memoryStream = new MemoryStream()) { var bytes = Encoding.UTF8.GetBytes(responseBody); memoryStream.Write(bytes, 0, bytes.Length); memoryStream.Seek(0, SeekOrigin.Begin); await memoryStream.CopyToAsync(stream, bytes.Length); } } } } } }
mit
C#
4c6286a3ca1929cbe5c96410ea8121da00f65a40
Fix license header
peppy/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,johnneijzen/osu,ZLima12/osu,EVAST9919/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,2yangk23/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,UselessToucan/osu
osu.Game/Screens/Play/QuickExit.cs
osu.Game/Screens/Play/QuickExit.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; using osu.Game.Overlays; namespace osu.Game.Screens.Play { public class QuickExit : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction> { public bool OnPressed(GlobalAction action) { if (action != GlobalAction.QuickExit) return false; BeginConfirm(); return true; } public bool OnReleased(GlobalAction action) { if (action != GlobalAction.QuickExit) return false; AbortConfirm(); return true; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCEusing System; using osu.Framework.Input.Bindings; using osu.Game.Input.Bindings; using osu.Game.Overlays; namespace osu.Game.Screens.Play { public class QuickExit : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction> { public bool OnPressed(GlobalAction action) { if (action != GlobalAction.QuickExit) return false; BeginConfirm(); return true; } public bool OnReleased(GlobalAction action) { if (action != GlobalAction.QuickExit) return false; AbortConfirm(); return true; } } }
mit
C#
d9ac6a4a2ca374f7937e193a647599c68817946f
Add SecurityCode
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
src/SFA.DAS.EmployerUsers.Web/Models/ChangeEmailViewModel.cs
src/SFA.DAS.EmployerUsers.Web/Models/ChangeEmailViewModel.cs
namespace SFA.DAS.EmployerUsers.Web.Models { public class ChangeEmailViewModel : ViewModelBase { public string NewEmailAddress { get; set; } public string ConfirmEmailAddress { get; set; } public string UserId { get; set; } public string ClientId { get; set; } public string ReturnUrl { get; set; } public string NewEmailAddressError => GetErrorMessage(nameof(NewEmailAddress)); public string ConfirmEmailAddressError => GetErrorMessage(nameof(ConfirmEmailAddress)); public string SecurityCode { get; set; } } }
namespace SFA.DAS.EmployerUsers.Web.Models { public class ChangeEmailViewModel : ViewModelBase { public string NewEmailAddress { get; set; } public string ConfirmEmailAddress { get; set; } public string UserId { get; set; } public string ClientId { get; set; } public string ReturnUrl { get; set; } public string NewEmailAddressError => GetErrorMessage(nameof(NewEmailAddress)); public string ConfirmEmailAddressError => GetErrorMessage(nameof(ConfirmEmailAddress)); } }
mit
C#
5226130c7b7c7fe006ecd141e03067360c47ae33
Add edit link to soldier list
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
BatteryCommander.Web/Views/Soldier/List.cshtml
BatteryCommander.Web/Views/Soldier/List.cshtml
@model IEnumerable<BatteryCommander.Common.Models.Soldier> @{ ViewBag.Title = "Soldiers"; } <h2>@ViewBag.Title</h2> <div class="btn-group" role="group"> @Html.ActionLink("Add a Soldier", "New", null, new { @class = "btn btn-primary" }) @Html.ActionLink("Bulk Add/Edit Soldiers", "Bulk", null, new { @class = "btn btn-default" }) @Html.ActionLink("Include Inactive Soldiers", "List", new { activeOnly = false }, new { @class = "btn btn-default" }) </div> <table class="table table-striped"> <tr> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Rank)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().LastName)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().FirstName)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Group)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Position)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().MOS)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Notes)</th> <th></th> </tr> @foreach (var soldier in Model) { <tr> <td>@Html.DisplayFor(s => soldier.Rank, new { UseShortName = true })</td> <td>@Html.DisplayFor(s => soldier.LastName)</td> <td>@Html.DisplayFor(s => soldier.FirstName)</td> <td>@Html.DisplayFor(s => soldier.Group)</td> <td>@Html.DisplayFor(s => soldier.Position)</td> <td>@Html.DisplayFor(s => soldier.MOS, new { UseShortName = true })</td> <td>@Html.DisplayFor(s => soldier.Notes)</td> <td> @Html.ActionLink("View", "View", new { soldierId = soldier.Id }, new { @class = "btn btn-default" }) @Html.ActionLink("Edit", "Edit", new { soldierId = soldier.Id }, new { @class = "btn btn-default" })< </td> </tr> } </table>
@model IEnumerable<BatteryCommander.Common.Models.Soldier> @{ ViewBag.Title = "Soldiers"; } <h2>@ViewBag.Title</h2> <div class="btn-group" role="group"> @Html.ActionLink("Add a Soldier", "New", null, new { @class = "btn btn-primary" }) @Html.ActionLink("Bulk Add/Edit Soldiers", "Bulk", null, new { @class = "btn btn-default" }) @Html.ActionLink("Include Inactive Soldiers", "List", new { activeOnly = false }, new { @class = "btn btn-default" }) </div> <table class="table table-striped"> <tr> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Rank)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().LastName)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().FirstName)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Group)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Position)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().MOS)</th> <th>@Html.DisplayNameFor(s => s.FirstOrDefault().Notes)</th> <th></th> </tr> @foreach (var soldier in Model) { <tr> <td>@Html.DisplayFor(s => soldier.Rank, new { UseShortName = true })</td> <td>@Html.DisplayFor(s => soldier.LastName)</td> <td>@Html.DisplayFor(s => soldier.FirstName)</td> <td>@Html.DisplayFor(s => soldier.Group)</td> <td>@Html.DisplayFor(s => soldier.Position)</td> <td>@Html.DisplayFor(s => soldier.MOS, new { UseShortName = true })</td> <td>@Html.DisplayFor(s => soldier.Notes)</td> <td>@Html.ActionLink("View", "View", new { soldierId = soldier.Id }, new { @class = "btn btn-default" })</td> </tr> } </table>
mit
C#
3be386c98623555cacc933554a66d3996fa78597
Remove unnecessary methods.
toqueteos/bacon
Assets/EndlessFloor.cs
Assets/EndlessFloor.cs
using UnityEngine; using System.Collections; public class EndlessFloor : MonoBehaviour { public int offset = 0; void OnTriggerEnter(Collider other) { Vector3 pos = other.transform.position; pos.z -= offset; other.transform.position = pos; } }
using UnityEngine; using System.Collections; public class EndlessFloor : MonoBehaviour { public int offset = 0; void Start() { } void Update() { } void OnTriggerEnter(Collider other) { Vector3 pos = other.transform.position; pos.z -= offset; other.transform.position = pos; } }
mit
C#
3cde2f5467f380603b50981532dd7a219dabcb6b
Update AssemblyInfo.cs
shutchings/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,olydis/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,AzCiS/azure-sdk-for-net,nathannfan/azure-sdk-for-net,begoldsm/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,mihymel/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,pankajsn/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,samtoubia/azure-sdk-for-net,smithab/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,djyou/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,nathannfan/azure-sdk-for-net,btasdoven/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,r22016/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,peshen/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pankajsn/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,mihymel/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,begoldsm/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,mihymel/azure-sdk-for-net,AzCiS/azure-sdk-for-net,smithab/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,smithab/azure-sdk-for-net,pilor/azure-sdk-for-net,samtoubia/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,djyou/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,atpham256/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,r22016/azure-sdk-for-net,AzCiS/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,shutchings/azure-sdk-for-net,r22016/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,samtoubia/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jamestao/azure-sdk-for-net,btasdoven/azure-sdk-for-net,jamestao/azure-sdk-for-net,jamestao/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,peshen/azure-sdk-for-net,peshen/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,begoldsm/azure-sdk-for-net,olydis/azure-sdk-for-net,pilor/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,jamestao/azure-sdk-for-net,hyonholee/azure-sdk-for-net,btasdoven/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,nathannfan/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,stankovski/azure-sdk-for-net,olydis/azure-sdk-for-net,djyou/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,atpham256/azure-sdk-for-net,samtoubia/azure-sdk-for-net,shutchings/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,pankajsn/azure-sdk-for-net,markcowl/azure-sdk-for-net,stankovski/azure-sdk-for-net,atpham256/azure-sdk-for-net,pilor/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net
src/ResourceManagement/Logic/LogicManagement/Properties/AssemblyInfo.cs
src/ResourceManagement/Logic/LogicManagement/Properties/AssemblyInfo.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure Logic App Management Library")] [assembly: AssemblyDescription("Provides Microsoft Azure Logic App management operations.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.2.1.0")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Microsoft Azure Logic App Management Library")] [assembly: AssemblyDescription("Provides Microsoft Azure Logic App management operations.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
6d1ccdbfa4c9f2893757b7079aa35c0475a384ce
Remove ResultFormat.None
Microsoft/dotnet-apiport,conniey/dotnet-apiport,JJVertical/dotnet-apiport,twsouthwick/dotnet-apiport,twsouthwick/dotnet-apiport,mjrousos/dotnet-apiport-old,mjrousos/dotnet-apiport,mjrousos/dotnet-apiport,conniey/dotnet-apiport,Microsoft/dotnet-apiport,conniey/dotnet-apiport,Microsoft/dotnet-apiport,JJVertical/dotnet-apiport
src/components/Microsoft.Fx.Portability/Reporting/ObjectModel/ResultFormat.cs
src/components/Microsoft.Fx.Portability/Reporting/ObjectModel/ResultFormat.cs
 namespace Microsoft.Fx.Portability.Reporting.ObjectModel { public enum ResultFormat { Excel, HTML, Json } }
 namespace Microsoft.Fx.Portability.Reporting.ObjectModel { public enum ResultFormat { None, Excel, HTML, Json } }
mit
C#
a5c5fb0c6258d51f346fc5c6be189b9487828600
Add VisitErrorNode() to HmlListener
lou1306/CIV,lou1306/CIV
CIV.Hml/HmlListener.cs
CIV.Hml/HmlListener.cs
using System; using CIV.Common; namespace CIV.Hml { class HmlListener : HmlParserBaseListener { public HmlFormula RootFormula { get; private set; } readonly HmlFactory factory = new HmlFactory(); public override void EnterBaseHml(HmlParser.BaseHmlContext context) { RootFormula = factory.Create(context.hml()); } public override void VisitErrorNode(Antlr4.Runtime.Tree.IErrorNode node) { throw new ParsingFailedException(node.Parent.GetText()); } } }
using System; namespace CIV.Hml { class HmlListener : HmlParserBaseListener { public HmlFormula RootFormula { get; private set; } readonly HmlFactory factory = new HmlFactory(); public override void EnterBaseHml(HmlParser.BaseHmlContext context) { RootFormula = factory.Create(context.hml()); } } }
mit
C#
0e83165be3221d2273b313ce38ffa09fe30179c9
fix comment + explain behavior
NServiceKit/NServiceKit.Text,gerryhigh/ServiceStack.Text,mono/ServiceStack.Text,mono/ServiceStack.Text,gerryhigh/ServiceStack.Text,NServiceKit/NServiceKit.Text
tests/ServiceStack.Text.Tests/JsonTests/BackingFieldTests.cs
tests/ServiceStack.Text.Tests/JsonTests/BackingFieldTests.cs
using System; using NUnit.Framework; namespace ServiceStack.Text.Tests.JsonTests { #region Test types public class GetOnlyWithBacking { long backing; public GetOnlyWithBacking(long i) { backing = i; } public long Property { get { return backing; } } } public class GetSetWithBacking { long backing; public GetSetWithBacking(long i) { Property = i; } public long Property { get { return backing; } set { backing = value; } } } #endregion [TestFixture] public class BackingFieldTests { [Test] public void Backed_get_set_properties_can_be_deserialised() { var original = new GetSetWithBacking(123344044); var str1 = original.ToJson(); var copy = str1.FromJson<GetSetWithBacking>(); Console.WriteLine(str1); Assert.That(copy.Property, Is.EqualTo(original.Property)); } [Ignore("By Design: Deserialization doesn't use constructor injection, Properties need to be writeable")] [Test] public void Backed_get_properties_can_be_deserialised() { var original = new GetOnlyWithBacking(123344044); var str1 = original.ToJson(); var copy = str1.FromJson<GetOnlyWithBacking>(); Console.WriteLine(str1); // ReflectionExtensions.cs Line 417 is being used to determine *deserialisable* // for properties type based on if the property is *readable*, not *writable* -- by design //Rule: To be emitted properties should be readable, to be deserialized properties should be writeable Assert.That(copy.Property, Is.EqualTo(original.Property)); } } }
using System; using NUnit.Framework; namespace ServiceStack.Text.Tests.JsonTests { #region Test types public class GetOnlyWithBacking { long backing; public GetOnlyWithBacking(long i) { backing = i; } public long Property { get { return backing; } } } public class GetSetWithBacking { long backing; public GetSetWithBacking(long i) { Property = i; } public long Property { get { return backing; } set { backing = value; } } } #endregion [TestFixture] public class BackingFieldTests { [Test] public void Backed_get_set_properties_can_be_deserialised() { var original = new GetSetWithBacking(123344044); var str1 = original.ToJson(); var copy = str1.FromJson<GetSetWithBacking>(); Console.WriteLine(str1); Assert.That(copy.Property, Is.EqualTo(original.Property)); } [Ignore("By Design: Deserialization doesn't use constructor injection, Properties need to be writeable")] [Test] public void Backed_get_properties_can_be_deserialised() { var original = new GetOnlyWithBacking(123344044); var str1 = original.ToJson(); var copy = str1.FromJson<GetOnlyWithBacking>(); Console.WriteLine(str1); // ReflectionExtensions.cs Line 417 is being used to determine *deserialisable* // for properties type based on if the property is *readable*, not *writable* // TODO: Fix this! Assert.That(copy.Property, Is.EqualTo(original.Property)); } } }
bsd-3-clause
C#
9e585cac71769a5ff720a7d43e3c314e97e5eb96
Use input value as seed in AxisInput to prevent initial spike
mysticfall/Alensia
Assets/Alensia/Core/Input/AxisInput.cs
Assets/Alensia/Core/Input/AxisInput.cs
using System.Collections.Generic; using System.Linq; using UniRx; using UnityEngine; using UnityEngine.Assertions; using static UnityEngine.Input; namespace Alensia.Core.Input { public class AxisInput : ModifierInput<float>, IAxisInput { public string Axis { get; } public float? Smoothing { get; } public AxisInput(string axis) : this(axis, null, Enumerable.Empty<ITrigger>().ToList()) { } public AxisInput(string axis, float? smoothing) : this(axis, smoothing, Enumerable.Empty<ITrigger>().ToList()) { } public AxisInput(string axis, float? smoothing, IList<ITrigger> modifiers) : base(modifiers) { Assert.IsTrue(!smoothing.HasValue || smoothing.Value > 0, "smoothing > 0"); Assert.IsNotNull(axis, "axis != null"); Axis = axis; Smoothing = smoothing; } protected override IObservable<float> Observe(IObservable<long> onTick) { if (!Smoothing.HasValue) { return onTick.Select(_ => GetAxis(Axis)); } var smoothing = Smoothing.Value; return onTick .Select(_ => GetAxis(Axis)) .Scan(GetAxis(Axis), (previous, current) => Mathf.Lerp(previous, current, Time.deltaTime / smoothing)); } } }
using System.Collections.Generic; using System.Linq; using UniRx; using UnityEngine; using UnityEngine.Assertions; using static UnityEngine.Input; namespace Alensia.Core.Input { public class AxisInput : ModifierInput<float>, IAxisInput { public string Axis { get; } public float? Smoothing { get; } public AxisInput(string axis) : this(axis, null, Enumerable.Empty<ITrigger>().ToList()) { } public AxisInput(string axis, float? smoothing) : this(axis, smoothing, Enumerable.Empty<ITrigger>().ToList()) { } public AxisInput(string axis, float? smoothing, IList<ITrigger> modifiers) : base(modifiers) { Assert.IsNotNull(axis, "axis != null"); Axis = axis; Smoothing = smoothing; } protected override IObservable<float> Observe(IObservable<long> onTick) { if (Smoothing.HasValue) { return onTick .Select(_ => GetAxis(Axis)) .Scan((previous, current) => Mathf.Lerp(previous, current, Time.deltaTime / Smoothing.Value)); } return onTick.Select(_ => GetAxis(Axis)); } } }
apache-2.0
C#
28911062a62db90bbf863fcdad6dacfe13471bc5
Fix car movement input in editor
android/games-samples,android/games-samples,android/games-samples,android/games-samples
trivialkart/trivialkart-unity/Assets/Scripts/Controller/Game/CarMove.cs
trivialkart/trivialkart-unity/Assets/Scripts/Controller/Game/CarMove.cs
// Copyright 2022 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using UnityEngine; /// <summary> /// A component script for a specific car game object. /// It controls movement of a specific car in the play mode. /// CarMove script is added as a component to every car game object in the play mode. /// </summary> public class CarMove : MonoBehaviour { public GameObject tapToDriveText; public CarName carName; private Rigidbody2D _rigidbody2D; private GameManager _gameManger; private CarList.Car _carObj; private Gas _gas; private const float NoVelocity = 0.01f; private void Start() { _gameManger = FindObjectOfType<GameManager>(); // Get the carObj corresponding to the car game object the script attached to. _carObj = CarList.GetCarByName(carName); _rigidbody2D = GetComponent<Rigidbody2D>(); _gas = transform.parent.gameObject.GetComponent<Gas>(); } private void Update() { // Check for fresh touches and see if they touched the car. for (int i = 0; i < Input.touchCount; ++i) { var touch = Input.GetTouch(i); if (touch.phase == TouchPhase.Began) { Debug.Log("NCT_TOUCH 1"); ProcessTouch(touch.position); } } // left mouse button #if UNITY_EDITOR if (Input.GetMouseButtonDown(0)) { Debug.Log("NCT_TOUCH 2"); ProcessTouch(Input.mousePosition); } #endif } private void ProcessTouch(Vector2 touchPosition) { Ray touchRay = Camera.main.ScreenPointToRay(touchPosition); RaycastHit2D touchHit = Physics2D.Raycast(touchRay.origin, touchRay.direction); if (touchHit.rigidbody == _rigidbody2D) { if (_rigidbody2D.velocity.magnitude < NoVelocity && _gas.HasGas() && _gameManger.IsInPlayCanvas()) { Drive(); } } } private void Drive() { tapToDriveText.SetActive(false); _rigidbody2D.AddForce(new Vector2(_carObj.Speed, 0)); } }
// Copyright 2022 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using UnityEngine; /// <summary> /// A component script for a specific car game object. /// It controls movement of a specific car in the play mode. /// CarMove script is added as a component to every car game object in the play mode. /// </summary> public class CarMove : MonoBehaviour { public GameObject tapToDriveText; public CarName carName; private Rigidbody2D _rigidbody2D; private GameManager _gameManger; private CarList.Car _carObj; private Gas _gas; private const float NoVelocity = 0.01f; private void Start() { _gameManger = FindObjectOfType<GameManager>(); // Get the carObj corresponding to the car game object the script attached to. _carObj = CarList.GetCarByName(carName); _rigidbody2D = GetComponent<Rigidbody2D>(); _gas = transform.parent.gameObject.GetComponent<Gas>(); } private void Update() { // Check for fresh touches and see if they touched the car. for (int i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { Ray touchRay = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit2D touchHit = Physics2D.Raycast(touchRay.origin, touchRay.direction); if (touchHit.rigidbody == _rigidbody2D) { if (_rigidbody2D.velocity.magnitude < NoVelocity && _gas.HasGas() && _gameManger.IsInPlayCanvas()) { Drive(); } } } } } private void Drive() { tapToDriveText.SetActive(false); _rigidbody2D.AddForce(new Vector2(_carObj.Speed, 0)); } }
apache-2.0
C#
b13aba07a1968f6d6273327766fd41b135c33668
Change Always(x) so that it doesn't depend on the 'true' literal
Logicalshift/Reason
LogicalShift.Reason/Clause.cs
LogicalShift.Reason/Clause.cs
using LogicalShift.Reason.Api; using LogicalShift.Reason.Clauses; using System; using System.Linq; namespace LogicalShift.Reason { /// <summary> /// Methods for creating an altering clauses /// </summary> public static class Clause { /// <summary> /// Creates a new negative Horn clause /// </summary> public static IClause If(params ILiteral[] literals) { if (literals == null) throw new ArgumentNullException("literals"); if (literals.Any(literal => literal == null)) throw new ArgumentException("Null literals are not allowed", "literals"); return new NegativeClause(literals); } /// <summary> /// Adds a positive literal to a negative Horn clause /// </summary> public static IClause Then(this IClause negativeHornClause, ILiteral then) { if (negativeHornClause == null) throw new ArgumentNullException("negativeHornClause"); if (negativeHornClause.Implies != null) throw new ArgumentException("Clause already has an implication", "negativeHornClause"); if (then == null) throw new ArgumentNullException("then"); return new PositiveClause(negativeHornClause, then); } /// <summary> /// Returns a clause indicating that a literal is unconditionally true /// </summary> public static IClause Always(ILiteral always) { return If().Then(always); } } }
using LogicalShift.Reason.Api; using LogicalShift.Reason.Clauses; using System; using System.Linq; namespace LogicalShift.Reason { /// <summary> /// Methods for creating an altering clauses /// </summary> public static class Clause { /// <summary> /// Creates a new negative Horn clause /// </summary> public static IClause If(params ILiteral[] literals) { if (literals == null) throw new ArgumentNullException("literals"); if (literals.Any(literal => literal == null)) throw new ArgumentException("Null literals are not allowed", "literals"); return new NegativeClause(literals); } /// <summary> /// Adds a positive literal to a negative Horn clause /// </summary> public static IClause Then(this IClause negativeHornClause, ILiteral then) { if (negativeHornClause == null) throw new ArgumentNullException("negativeHornClause"); if (negativeHornClause.Implies != null) throw new ArgumentException("Clause already has an implication", "negativeHornClause"); if (then == null) throw new ArgumentNullException("then"); return new PositiveClause(negativeHornClause, then); } /// <summary> /// Returns a clause indicating that a literal is unconditionally true /// </summary> public static IClause Always(ILiteral always) { return If(Literal.True()).Then(always); } } }
apache-2.0
C#
6a198d1c906bfe482669453bbf5426d75908890f
Fix popups
danielchalmers/SteamAccountSwitcher
SteamAccountSwitcher/Popup.cs
SteamAccountSwitcher/Popup.cs
#region using System.Windows; using SteamAccountSwitcher.Properties; #endregion namespace SteamAccountSwitcher { internal class Popup { public static MessageBoxResult Show(string text, MessageBoxButton btn = MessageBoxButton.OK, MessageBoxImage img = MessageBoxImage.Information, MessageBoxResult defaultbtn = MessageBoxResult.OK) { if (Settings.Default.DontShowPopups) return MessageBoxResult.Yes; return MessageBox.Show(App.SwitchWindow, text, Resources.AppName, btn, img, defaultbtn); } } }
#region using System.Windows; using SteamAccountSwitcher.Properties; #endregion namespace SteamAccountSwitcher { internal class Popup { public static MessageBoxResult Show(string text, MessageBoxButton btn = MessageBoxButton.OK, MessageBoxImage img = MessageBoxImage.Information, MessageBoxResult defaultbtn = MessageBoxResult.OK) { if (Settings.Default.DontShowPopups) return MessageBoxResult.Yes; var msg = MessageBox.Show(text, Resources.AppName, btn, img, defaultbtn); return msg; } } }
mit
C#
9786d73b4eeccd6bccbe8bf2037235af5fa05760
Fix :bug:
Zalodu/Schedutalk,Zalodu/Schedutalk
Schedutalk/Schedutalk/Schedutalk/Logic/KTHPlaces/KTHPlacesDataFetcher.cs
Schedutalk/Schedutalk/Schedutalk/Logic/KTHPlaces/KTHPlacesDataFetcher.cs
using Newtonsoft.Json; using Org.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Runtime.Serialization.Json; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Schedutalk.Logic.KTHPlaces { class KTHPlacesDataFetcher { const string APIKEY = "NZfvZYDhIqDrPZvsnkY0Ocb5qJPlQNwh1BsVEH5H"; HttpRequestor httpRequestor; public RoomDataContract getRoomData(string placeName) { httpRequestor = new HttpRequestor(); string recivedData = httpRequestor.getJSONAsString(getRoomExistRequestMessage, placeName); RoomExistsDataContract roomExistsDataContract; try { roomExistsDataContract = JsonConvert.DeserializeObject<RoomExistsDataContract>(recivedData); } catch { return null; } bool roomExists = roomExistsDataContract.Exists; if (roomExists) { recivedData = httpRequestor.getJSONAsString(getRoomDataRequestMessage, placeName); RoomDataContract roomDataContract = JsonConvert.DeserializeObject<RoomDataContract>(recivedData); return roomDataContract; } return null; } public HttpRequestMessage getRoomExistRequestMessage(string room) { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, @"https://www.kth.se/api/places/v3/room/exists/" + room + "?api_key=" + APIKEY); Debug.WriteLine(request.RequestUri.ToString()); return request; } public HttpRequestMessage getRoomDataRequestMessage(string room) { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, @"https://www.kth.se/api/places/v3/room/name/" + room + "?api_key=" + APIKEY); return request; } } }
using Newtonsoft.Json; using Org.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Runtime.Serialization.Json; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Schedutalk.Logic.KTHPlaces { class KTHPlacesDataFetcher { const string APIKEY = "NZfvZYDhIqDrPZvsnkY0Ocb5qJPlQNwh1BsVEH5H"; HttpRequestor httpRequestor; public RoomDataContract getRoomData(string placeName) { httpRequestor = new HttpRequestor(); string recivedData = httpRequestor.getJSONAsString(getRoomExistRequestMessage, placeName); RoomExistsDataContract roomExistsDataContract = JsonConvert.DeserializeObject<RoomExistsDataContract>(recivedData); bool roomExists = roomExistsDataContract.Exists; if (roomExists) { recivedData = httpRequestor.getJSONAsString(getRoomDataRequestMessage, placeName); RoomDataContract roomDataContract = JsonConvert.DeserializeObject<RoomDataContract>(recivedData); return roomDataContract; } return null; } public HttpRequestMessage getRoomExistRequestMessage(string room) { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, @"https://www.kth.se/api/places/v3/room/exists/" + room + "?api_key=" + APIKEY); return request; } public HttpRequestMessage getRoomDataRequestMessage(string room) { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, @"https://www.kth.se/api/places/v3/room/name/" + room + "?api_key=" + APIKEY); return request; } } }
mit
C#
6d5171c7509e0e709034f525a5e50270861f394f
Bump version
programcsharp/griddly,programcsharp/griddly,jehhynes/griddly,nickdevore/griddly,nickdevore/griddly,jehhynes/griddly,programcsharp/griddly
Build/CommonAssemblyInfo.cs
Build/CommonAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyProduct("Griddly")] [assembly: AssemblyCopyright("Copyright © 2015 Chris Hynes and Data Research Group")] [assembly: ComVisible(false)] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.5.9")] [assembly: AssemblyFileVersion("1.5.9")] //[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyProduct("Griddly")] [assembly: AssemblyCopyright("Copyright © 2015 Chris Hynes and Data Research Group")] [assembly: ComVisible(false)] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.5.8")] [assembly: AssemblyFileVersion("1.5.8")] //[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]
mit
C#
d34e313012f4b7f2de4146ef4beb08abf56954e0
Fix line endings in Displayable.
Misterblue/convoar,Misterblue/convoar
convoar/Displayable.cs
convoar/Displayable.cs
/* * Copyright (c) 2017 Robert Adams * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OMV = OpenMetaverse; namespace org.herbal3d.convoar { /// <summary> /// A set of classes that hold viewer displayable items. These can be /// meshes, procedures, or whatever. /// </summary> public class Displayable { public OMV.Vector3 offsetPosition; public OMV.Quaternion offsetRotation; public DisplayableRenderable renderable; public DisplayableList children; public Displayable() { offsetPosition = OMV.Vector3.Zero; offsetRotation = OMV.Quaternion.Identity; renderable = null; children = new DisplayableList(); } public Displayable(DisplayableRenderable pRenderable) { offsetPosition = OMV.Vector3.Zero; offsetRotation = OMV.Quaternion.Identity; renderable = pRenderable; children = new DisplayableList(); } } public class DisplayableList: List<Displayable> { } /// <summary> /// The parent class of the renderable parts of the displayable. /// Could be a mesh or procedure or whatever. /// </summary> public abstract class DisplayableRenderable { } /// <summary> /// A group of meshes that make up a renderable item /// </summary> public class RenderableMeshGroup : DisplayableRenderable { public List<RenderableMesh> meshes; } public class RenderableMesh { public MeshHandle mesh; public MaterialHandle material; } }
/* * Copyright (c) 2017 Robert Adams * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OMV = OpenMetaverse; namespace org.herbal3d.convoar { /// <summary> /// A set of classes that hold viewer displayable items. These can be /// meshes, procedures, or whatever. /// </summary> public class Displayable { } public class DisplayableList: List<Displayable> { } public class DisplayableNode { public OMV.Vector3 offsetPosition; public OMV.Quaternion offsetRotation; public DisplayableRenderable renderable; public DisplayableNodeList children; public DisplayableNode() { offsetPosition = OMV.Vector3.Zero; offsetRotation = OMV.Quaternion.Identity; renderable = null; children = new DisplayableNodeList(); } public DisplayableNode(DisplayableRenderable pRenderable) { offsetPosition = OMV.Vector3.Zero; offsetRotation = OMV.Quaternion.Identity; renderable = pRenderable; children = new DisplayableNodeList(); } } public class DisplayableNodeList: List<DisplayableNode> { } /// <summary> /// The parent class of the renderable parts of the displayable. /// Could be a mesh or procedure or whatever. /// </summary> public abstract class DisplayableRenderable { } /// <summary> /// A group of meshes that make up a renderable item /// </summary> public class RenderableMeshGroup : DisplayableRenderable { public List<RenderableMesh> meshes; } public class RenderableMesh { public MeshHandle mesh; public MaterialHandle material; } }
apache-2.0
C#
964c116d98cd06e88c868f85aee30cff9966e198
use FunBookData.Create(); in category menu
dzhenko/FunBook,dzhenko/FunBook
FunBook/FunBook.WebForms/FunAreaPages/FunMasterPage.master.cs
FunBook/FunBook.WebForms/FunAreaPages/FunMasterPage.master.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using FunBook.Data; namespace FunBook.WebForms.FunAreaPages { public partial class FunMasterPage : MasterPage { FunBookData db = FunBookData.Create(); protected void Page_Load(object sender, EventArgs e) { categories.DataSource = db.Categories.All().ToList(); categories.DataBind(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using FunBook.Data; namespace FunBook.WebForms.FunAreaPages { public partial class FunMasterPage : MasterPage { FunBookDbContext db = new FunBookDbContext(); protected void Page_Load(object sender, EventArgs e) { categories.DataSource = db.Categories.ToList(); categories.DataBind(); } } }
mit
C#
41d3129e6bcd1e68ffc8da374a6cdccacc7f21e7
Convert HTTP status codes to gRPC status codes when converting LROs
jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/gcloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet
apis/Google.Cloud.Compute.V1/Google.Cloud.Compute.V1/OperationToLroResponse.cs
apis/Google.Cloud.Compute.V1/Google.Cloud.Compute.V1/OperationToLroResponse.cs
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using lro = Google.LongRunning; using wkt = Google.Protobuf.WellKnownTypes; using Google.Api.Gax.Grpc.Rest; // Note: this will eventually be generated in ComputeLroAdaptation.g.cs. It's the last bit of generator work we need to do. namespace Google.Cloud.Compute.V1 { partial class Operation { internal lro::Operation ToLroResponse(string name) { // TODO: Work this out much more carefully. In particular, consider whether a Compute LRO can complete successfully with errors... var proto = new lro::Operation { // Derived from [(google.cloud.operation_field) = STATUS] Done = Status == Types.Status.Done, // Taken from [(google.cloud.operation_field) = NAME] Name = name, // Always pack the raw response as metadata Metadata = wkt::Any.Pack(this) }; if (proto.Done) { // Only pack the raw response as the LRO Response if we're done proto.Response = proto.Metadata; } // Derived from [(google.cloud.operation_field) = ERROR_CODE] and [(google.cloud.operation_field) = ERROR_MESSAGE] if (HasHttpErrorStatusCode) { proto.Error = new Rpc.Status { // gRPC status codes directly correspond to values in google.rpc.Code Code = (int) RestGrpcAdapter.ConvertHttpStatusCode(HttpErrorStatusCode), Message = HttpErrorMessage }; } return proto; } } }
// Copyright 2021 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using lro = Google.LongRunning; using wkt = Google.Protobuf.WellKnownTypes; // Note: this will eventually be generated in ComputeLroAdaptation.g.cs. It's the last bit of generator work we need to do. namespace Google.Cloud.Compute.V1 { partial class Operation { internal lro::Operation ToLroResponse(string name) { // TODO: Work this out much more carefully. In particular, consider whether a Compute LRO can complete successfully with errors... var proto = new lro::Operation { // Derived from [(google.cloud.operation_field) = STATUS] Done = Status == Types.Status.Done, // Taken from [(google.cloud.operation_field) = NAME] Name = name, // Always pack the raw response as metadata Metadata = wkt::Any.Pack(this) }; if (proto.Done) { // Only pack the raw response as the LRO Response if we're done proto.Response = proto.Metadata; } // Derived from [(google.cloud.operation_field) = ERROR_CODE] and [(google.cloud.operation_field) = ERROR_MESSAGE] if (HasHttpErrorStatusCode) { // FIXME: Convert the HTTP status code into a suitable Rpc.Status code. proto.Error = new Rpc.Status { Code = HttpErrorStatusCode, Message = HttpErrorMessage }; } return proto; } } }
apache-2.0
C#
6ef289a21c89cd2c416248ed0d1bbe6738c769f4
Add VotingOnly node role (#4276)
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/Cluster/NodesInfo/NodeRole.cs
src/Nest/Cluster/NodesInfo/NodeRole.cs
using System.Runtime.Serialization; using Elasticsearch.Net; namespace Nest { [StringEnum] public enum NodeRole { [EnumMember(Value = "master")] Master, [EnumMember(Value = "data")] Data, [EnumMember(Value = "client")] Client, [EnumMember(Value = "ingest")] Ingest, [EnumMember(Value = "ml")] MachineLearning, [EnumMember(Value = "voting_only")] VotingOnly, } }
using System.Runtime.Serialization; using Elasticsearch.Net; namespace Nest { [StringEnum] public enum NodeRole { [EnumMember(Value = "master")] Master, [EnumMember(Value = "data")] Data, [EnumMember(Value = "client")] Client, [EnumMember(Value = "ingest")] Ingest, [EnumMember(Value = "ml")] MachineLearning } }
apache-2.0
C#
6b650f6172e92c8ee037fd1f8180e0e1486b5e14
Rename GamepadMappingType._empty to GamepadMappingType.None
bridgedotnet/Bridge,bridgedotnet/Bridge,AndreyZM/Bridge,AndreyZM/Bridge,AndreyZM/Bridge,bridgedotnet/Bridge,bridgedotnet/Bridge,AndreyZM/Bridge
Html5/GamepadMappingType.cs
Html5/GamepadMappingType.cs
namespace Bridge.Html5 { [External] [Name("String")] [Enum(Emit.StringName)] public enum GamepadMappingType { [Name("")] None, [Name("standard")] Standard } }
namespace Bridge.Html5 { [External] [Name("String")] [Enum(Emit.StringName)] public enum GamepadMappingType { [Name("standard")] Standard, [Name("")] _empty } }
apache-2.0
C#
bba2a5610bb50a6f94fc233e571048a31c8905a5
bump version
ParticularLabs/SetStartupProjects
src/SetStartupProjects/AssemblyInfo.cs
src/SetStartupProjects/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("SetStartupProjects")] [assembly: AssemblyProduct("SetStartupProjects")] [assembly: AssemblyCopyright("Copyright © NServiceBus Ltd")] [assembly: AssemblyVersion("1.2.2")] [assembly: AssemblyFileVersion("1.2.2")] [assembly: InternalsVisibleTo("Tests")]
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("SetStartupProjects")] [assembly: AssemblyProduct("SetStartupProjects")] [assembly: AssemblyCopyright("Copyright © NServiceBus Ltd")] [assembly: AssemblyVersion("1.2.1")] [assembly: AssemblyFileVersion("1.2.1")] [assembly: InternalsVisibleTo("Tests")]
mit
C#
e0d597ce4b2a47619c0d4e1d60cb7f11fdb834d3
change url
DotNetRu/App,DotNetRu/App
DotNetRu.Utils/Helpers/AboutThisApp.cs
DotNetRu.Utils/Helpers/AboutThisApp.cs
namespace DotNetRu.Utils.Helpers { public static class AboutThisApp { public const string AppLinkProtocol = "dotnetru"; public const string PackageName = "com.dotnetru.app"; public const string AppName = "DotNetRu"; public const string CompanyName = "DotNetRu"; public const string Developer = "DotNetRu Team"; public const string DotNetRuLink = "http://dotnet.ru/"; public const string SpbLink = "https://vk.com/SpbDotNet"; public const string SaratovLink = "https://vk.com/SarDotNet"; public const string KrasnoyarskLink = "https://vk.com/KryDotNet"; public const string MoscowLink = "https://vk.com/MskDotNet"; public const string DeveloperWebsite = "http://dotnet.ru"; public const string MontemagnoWebsite = "https://montemagno.com"; public const string OpenSourceUrl = "https://github.com/DotNetRu/App"; public const string IssueTracker = "https://github.com/DotNetRu/App/issues"; // TODO fix, should be link to oss licenses public const string OpenSourceNoticeUrl = "https://github.com/DotNetRu/App/blob/master/LICENSE.md"; // TODO: use the domain name of the site you want to integrate AppLinks with public const string AppLinksBaseDomain = "TODO"; public const string SessionsSiteSubdirectory = "Sessions"; public const string SpeakersSiteSubdirectory = "Speakers"; public const string Copyright = "Copyright 2018 - DotNetRu"; public const string Credits = "The DotNetRu mobile app were handcrafted by DotNetRu, based on the great work done by Xamarin.\n\n" + "DotNetRu Team:\n" + "Anatoly Kulakov\n" + "Pavel Fedotovsky\n" + "Yury Belousov\n" + "Sergey Polezhaev\n\n" + "Many thanks to James Montemagno!\n\n" + "...and of course you!"; } }
namespace DotNetRu.Utils.Helpers { public static class AboutThisApp { public const string AppLinkProtocol = "dotnetru"; public const string PackageName = "com.dotnetru.app"; public const string AppName = "DotNetRu"; public const string CompanyName = "DotNetRu"; public const string Developer = "DotNetRu Team"; public const string DotNetRuLink = "https://vk.com/DotNetRu"; public const string SpbLink = "https://vk.com/SpbDotNet"; public const string SaratovLink = "https://vk.com/SarDotNet"; public const string KrasnoyarskLink = "https://vk.com/KryDotNet"; public const string MoscowLink = "https://vk.com/MskDotNet"; public const string DeveloperWebsite = "http://dotnet.ru"; public const string MontemagnoWebsite = "https://montemagno.com"; public const string OpenSourceUrl = "https://github.com/DotNetRu/App"; public const string IssueTracker = "https://github.com/DotNetRu/App/issues"; // TODO fix, should be link to oss licenses public const string OpenSourceNoticeUrl = "https://github.com/DotNetRu/App/blob/master/LICENSE.md"; // TODO: use the domain name of the site you want to integrate AppLinks with public const string AppLinksBaseDomain = "TODO"; public const string SessionsSiteSubdirectory = "Sessions"; public const string SpeakersSiteSubdirectory = "Speakers"; public const string Copyright = "Copyright 2018 - DotNetRu"; public const string Credits = "The DotNetRu mobile app were handcrafted by DotNetRu, based on the great work done by Xamarin.\n\n" + "DotNetRu Team:\n" + "Anatoly Kulakov\n" + "Pavel Fedotovsky\n" + "Yury Belousov\n" + "Sergey Polezhaev\n\n" + "Many thanks to James Montemagno!\n\n" + "...and of course you!"; } }
mit
C#
7760912ffcb638e36c025e465ef9b299912fab59
Fix initial value not propagating
peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
osu.Framework/Statistics/GlobalStatistic.cs
osu.Framework/Statistics/GlobalStatistic.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; namespace osu.Framework.Statistics { public class GlobalStatistic<T> : IGlobalStatistic { public string Group { get; } public string Name { get; } public IBindable<string> DisplayValue => displayValue; private readonly Bindable<string> displayValue = new Bindable<string>(); public Bindable<T> Bindable { get; } = new Bindable<T>(); public T Value { get => Bindable.Value; set => Bindable.Value = value; } public GlobalStatistic(string group, string name) { Group = group; Name = name; Bindable.BindValueChanged(val => displayValue.Value = val.NewValue.ToString(), true); } public virtual void Clear() => Bindable.SetDefault(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Bindables; namespace osu.Framework.Statistics { public class GlobalStatistic<T> : IGlobalStatistic { public string Group { get; } public string Name { get; } public IBindable<string> DisplayValue => displayValue; private readonly Bindable<string> displayValue = new Bindable<string>(); public Bindable<T> Bindable { get; } = new Bindable<T>(); public T Value { get => Bindable.Value; set => Bindable.Value = value; } public GlobalStatistic(string group, string name) { Group = group; Name = name; Bindable.ValueChanged += val => displayValue.Value = val.NewValue.ToString(); } public virtual void Clear() => Bindable.SetDefault(); } }
mit
C#
15970d6d517149f449edbfa464d7747e8387fb36
change register back button to call login.Show instead of SetActive
NoScopeProductions/Gravi-Cube
Assets/Scripts/UI/Manager/RegisterManager.cs
Assets/Scripts/UI/Manager/RegisterManager.cs
using System; using System.Collections; using JetBrains.Annotations; using Parse; using UnityEngine; using UnityEngine.UI; namespace UI.Manager { [UsedImplicitly] public class RegisterManager : MonoBehaviour { [SerializeField, UsedImplicitly] private InputField _username; [SerializeField, UsedImplicitly] private InputField _email; [SerializeField, UsedImplicitly] private InputField _password; [SerializeField, UsedImplicitly] private InputField _confirmPassword; [SerializeField, UsedImplicitly] private GameObject _loginPanel; [UsedImplicitly] public void RegisterAction() { StartCoroutine(RegisterCoroutine()); } private IEnumerator RegisterCoroutine() { if (!_password.text.Equals(_confirmPassword.text)) { Debug.LogError("Passwords do not match!"); yield return null; } var user = new ParseUser { Username = _username.text, Password = _password.text, Email = _email.text }; var signUpTask = user.SignUpAsync().ContinueWith(task => { if (!task.IsFaulted && !task.IsCanceled) return; foreach (var exception in task.Exception.InnerExceptions) { Debug.LogError(exception.Message); } }); while (!signUpTask.IsCompleted) yield return null; Debug.Log("Sign Up Successful"); _loginPanel.GetComponent<LoginManager>().Show(); gameObject.SetActive(false); } } }
using System; using System.Collections; using JetBrains.Annotations; using Parse; using UnityEngine; using UnityEngine.UI; namespace UI.Manager { [UsedImplicitly] public class RegisterManager : MonoBehaviour { [SerializeField, UsedImplicitly] private InputField _username; [SerializeField, UsedImplicitly] private InputField _email; [SerializeField, UsedImplicitly] private InputField _password; [SerializeField, UsedImplicitly] private InputField _confirmPassword; [SerializeField, UsedImplicitly] private GameObject _loginPanel; [UsedImplicitly] public void RegisterAction() { StartCoroutine(RegisterCoroutine()); } private IEnumerator RegisterCoroutine() { if (!_password.text.Equals(_confirmPassword.text)) { Debug.LogError("Passwords do not match!"); yield return null; } var user = new ParseUser { Username = _username.text, Password = _password.text, Email = _email.text }; var signUpTask = user.SignUpAsync().ContinueWith(task => { if (!task.IsFaulted && !task.IsCanceled) return; foreach (var exception in task.Exception.InnerExceptions) { Debug.LogError(exception.Message); } }); while (!signUpTask.IsCompleted) yield return null; Debug.Log("Sign Up Successful"); _loginPanel.SetActive(true); gameObject.SetActive(false); } } }
mit
C#
6001cf6fa90ce4e444d5aec94cd8af6daa0593ae
Update version number
hudl/HudlFfmpeg
Hudl.Ffmpeg/Properties/AssemblyInfo.cs
Hudl.Ffmpeg/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("Hudl.FFmpeg")] [assembly: AssemblyDescription("Library for transcoding and creating special media effects.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hudl")] [assembly: AssemblyProduct("Hudl.FFmpeg")] [assembly: AssemblyCopyright("Copyright © 2013")] [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)] [assembly: InternalsVisibleTo("Hudl.FFmpeg.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("06757495-d5ae-4f2d-9d6b-6b17cacbf798")] // 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: AssemblyInformationalVersion("2.1.2.0")] [assembly: AssemblyFileVersion("2.1.2.0")] [assembly: AssemblyVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Hudl.FFmpeg")] [assembly: AssemblyDescription("Library for transcoding and creating special media effects.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hudl")] [assembly: AssemblyProduct("Hudl.FFmpeg")] [assembly: AssemblyCopyright("Copyright © 2013")] [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)] [assembly: InternalsVisibleTo("Hudl.FFmpeg.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("06757495-d5ae-4f2d-9d6b-6b17cacbf798")] // 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: AssemblyInformationalVersion("2.1.1.0")] [assembly: AssemblyFileVersion("2.1.1.0")] [assembly: AssemblyVersion("1.0.0.0")]
apache-2.0
C#
172a9644b79f6f7c4883d0dd383a70209e7f2449
Remove trailing slashes from baseUrl in .NET to prevent double slashes in URL
joshmgrant/selenium,amikey/selenium,yukaReal/selenium,mestihudson/selenium,clavery/selenium,lukeis/selenium,lukeis/selenium,krosenvold/selenium,MeetMe/selenium,SeleniumHQ/selenium,telefonicaid/selenium,xsyntrex/selenium,gregerrag/selenium,alexec/selenium,asashour/selenium,gurayinan/selenium,sebady/selenium,houchj/selenium,stupidnetizen/selenium,GorK-ChO/selenium,onedox/selenium,jabbrwcky/selenium,freynaud/selenium,alb-i986/selenium,MCGallaspy/selenium,livioc/selenium,Sravyaksr/selenium,jerome-jacob/selenium,bartolkaruza/selenium,SeleniumHQ/selenium,sri85/selenium,i17c/selenium,jsakamoto/selenium,gotcha/selenium,oddui/selenium,5hawnknight/selenium,Jarob22/selenium,freynaud/selenium,mojwang/selenium,skurochkin/selenium,denis-vilyuzhanin/selenium-fastview,freynaud/selenium,manuelpirez/selenium,sag-enorman/selenium,stupidnetizen/selenium,houchj/selenium,manuelpirez/selenium,rplevka/selenium,aluedeke/chromedriver,rrussell39/selenium,AutomatedTester/selenium,tkurnosova/selenium,carsonmcdonald/selenium,tarlabs/selenium,GorK-ChO/selenium,skurochkin/selenium,rrussell39/selenium,alb-i986/selenium,onedox/selenium,TikhomirovSergey/selenium,minhthuanit/selenium,markodolancic/selenium,knorrium/selenium,compstak/selenium,slongwang/selenium,gemini-testing/selenium,dkentw/selenium,jsakamoto/selenium,dandv/selenium,joshmgrant/selenium,dandv/selenium,freynaud/selenium,valfirst/selenium,DrMarcII/selenium,jsarenik/jajomojo-selenium,gabrielsimas/selenium,carlosroh/selenium,joshmgrant/selenium,chrsmithdemos/selenium,SouWilliams/selenium,Ardesco/selenium,onedox/selenium,5hawnknight/selenium,isaksky/selenium,DrMarcII/selenium,sankha93/selenium,houchj/selenium,knorrium/selenium,mestihudson/selenium,dandv/selenium,soundcloud/selenium,misttechnologies/selenium,clavery/selenium,meksh/selenium,tkurnosova/selenium,quoideneuf/selenium,jabbrwcky/selenium,blueyed/selenium,asolntsev/selenium,isaksky/selenium,arunsingh/selenium,krosenvold/selenium,joshbruning/selenium,juangj/selenium,sri85/selenium,titusfortner/selenium,blackboarddd/selenium,lilredindy/selenium,jsakamoto/selenium,davehunt/selenium,GorK-ChO/selenium,BlackSmith/selenium,pulkitsinghal/selenium,skurochkin/selenium,dbo/selenium,uchida/selenium,misttechnologies/selenium,asashour/selenium,lukeis/selenium,gregerrag/selenium,kalyanjvn1/selenium,alb-i986/selenium,lmtierney/selenium,joshmgrant/selenium,sevaseva/selenium,minhthuanit/selenium,denis-vilyuzhanin/selenium-fastview,denis-vilyuzhanin/selenium-fastview,amikey/selenium,houchj/selenium,tbeadle/selenium,dkentw/selenium,sebady/selenium,krosenvold/selenium,blueyed/selenium,jsarenik/jajomojo-selenium,aluedeke/chromedriver,p0deje/selenium,skurochkin/selenium,valfirst/selenium,DrMarcII/selenium,yukaReal/selenium,DrMarcII/selenium,lukeis/selenium,HtmlUnit/selenium,SevInf/IEDriver,p0deje/selenium,jabbrwcky/selenium,sankha93/selenium,wambat/selenium,lmtierney/selenium,Ardesco/selenium,minhthuanit/selenium,jknguyen/josephknguyen-selenium,sankha93/selenium,blueyed/selenium,davehunt/selenium,soundcloud/selenium,rovner/selenium,blueyed/selenium,denis-vilyuzhanin/selenium-fastview,alb-i986/selenium,tarlabs/selenium,uchida/selenium,krmahadevan/selenium,rplevka/selenium,titusfortner/selenium,telefonicaid/selenium,lmtierney/selenium,dcjohnson1989/selenium,joshbruning/selenium,s2oBCN/selenium,aluedeke/chromedriver,temyers/selenium,clavery/selenium,chrisblock/selenium,rovner/selenium,twalpole/selenium,bmannix/selenium,customcommander/selenium,sankha93/selenium,RamaraoDonta/ramarao-clone,AutomatedTester/selenium,bmannix/selenium,carlosroh/selenium,amar-sharma/selenium,twalpole/selenium,juangj/selenium,TheBlackTuxCorp/selenium,dcjohnson1989/selenium,misttechnologies/selenium,customcommander/selenium,joshbruning/selenium,o-schneider/selenium,gregerrag/selenium,sri85/selenium,Appdynamics/selenium,lrowe/selenium,soundcloud/selenium,quoideneuf/selenium,manuelpirez/selenium,chrisblock/selenium,carlosroh/selenium,GorK-ChO/selenium,SeleniumHQ/selenium,SevInf/IEDriver,SevInf/IEDriver,sebady/selenium,pulkitsinghal/selenium,tbeadle/selenium,Jarob22/selenium,xmhubj/selenium,joshbruning/selenium,compstak/selenium,tbeadle/selenium,p0deje/selenium,bmannix/selenium,MCGallaspy/selenium,aluedeke/chromedriver,telefonicaid/selenium,slongwang/selenium,mach6/selenium,krosenvold/selenium,titusfortner/selenium,lrowe/selenium,AutomatedTester/selenium,SevInf/IEDriver,thanhpete/selenium,GorK-ChO/selenium,minhthuanit/selenium,gemini-testing/selenium,telefonicaid/selenium,tarlabs/selenium,MCGallaspy/selenium,alexec/selenium,xsyntrex/selenium,Tom-Trumper/selenium,TheBlackTuxCorp/selenium,dcjohnson1989/selenium,BlackSmith/selenium,juangj/selenium,lilredindy/selenium,Ardesco/selenium,AutomatedTester/selenium,chrisblock/selenium,jknguyen/josephknguyen-selenium,customcommander/selenium,knorrium/selenium,denis-vilyuzhanin/selenium-fastview,SouWilliams/selenium,minhthuanit/selenium,joshmgrant/selenium,MCGallaspy/selenium,SouWilliams/selenium,Sravyaksr/selenium,mestihudson/selenium,misttechnologies/selenium,meksh/selenium,yukaReal/selenium,dcjohnson1989/selenium,mach6/selenium,livioc/selenium,eric-stanley/selenium,doungni/selenium,mojwang/selenium,sri85/selenium,krmahadevan/selenium,temyers/selenium,amikey/selenium,dbo/selenium,5hawnknight/selenium,actmd/selenium,tkurnosova/selenium,gotcha/selenium,HtmlUnit/selenium,alb-i986/selenium,pulkitsinghal/selenium,gregerrag/selenium,TheBlackTuxCorp/selenium,tarlabs/selenium,twalpole/selenium,mojwang/selenium,skurochkin/selenium,alb-i986/selenium,o-schneider/selenium,isaksky/selenium,rovner/selenium,amikey/selenium,pulkitsinghal/selenium,lmtierney/selenium,Herst/selenium,lrowe/selenium,knorrium/selenium,sebady/selenium,joshbruning/selenium,Dude-X/selenium,i17c/selenium,quoideneuf/selenium,dibagga/selenium,dibagga/selenium,livioc/selenium,skurochkin/selenium,soundcloud/selenium,RamaraoDonta/ramarao-clone,MeetMe/selenium,quoideneuf/selenium,rovner/selenium,SeleniumHQ/selenium,gabrielsimas/selenium,TikhomirovSergey/selenium,rplevka/selenium,xsyntrex/selenium,Jarob22/selenium,TheBlackTuxCorp/selenium,oddui/selenium,TikhomirovSergey/selenium,soundcloud/selenium,dkentw/selenium,uchida/selenium,zenefits/selenium,isaksky/selenium,amikey/selenium,TikhomirovSergey/selenium,isaksky/selenium,i17c/selenium,sevaseva/selenium,sri85/selenium,DrMarcII/selenium,slongwang/selenium,asashour/selenium,rrussell39/selenium,gorlemik/selenium,xsyntrex/selenium,uchida/selenium,TikhomirovSergey/selenium,Appdynamics/selenium,anshumanchatterji/selenium,blueyed/selenium,minhthuanit/selenium,anshumanchatterji/selenium,dbo/selenium,Herst/selenium,gregerrag/selenium,sri85/selenium,compstak/selenium,compstak/selenium,jsarenik/jajomojo-selenium,alexec/selenium,quoideneuf/selenium,GorK-ChO/selenium,p0deje/selenium,lrowe/selenium,lrowe/selenium,manuelpirez/selenium,mach6/selenium,krosenvold/selenium,blueyed/selenium,doungni/selenium,gabrielsimas/selenium,MeetMe/selenium,davehunt/selenium,carsonmcdonald/selenium,juangj/selenium,customcommander/selenium,sevaseva/selenium,bartolkaruza/selenium,arunsingh/selenium,RamaraoDonta/ramarao-clone,chrisblock/selenium,bartolkaruza/selenium,arunsingh/selenium,stupidnetizen/selenium,dibagga/selenium,joshbruning/selenium,mojwang/selenium,tkurnosova/selenium,HtmlUnit/selenium,JosephCastro/selenium,manuelpirez/selenium,carsonmcdonald/selenium,telefonicaid/selenium,chrisblock/selenium,jerome-jacob/selenium,minhthuanit/selenium,Appdynamics/selenium,davehunt/selenium,SeleniumHQ/selenium,onedox/selenium,Dude-X/selenium,joshuaduffy/selenium,telefonicaid/selenium,tkurnosova/selenium,clavery/selenium,sebady/selenium,JosephCastro/selenium,eric-stanley/selenium,sankha93/selenium,jabbrwcky/selenium,skurochkin/selenium,p0deje/selenium,Tom-Trumper/selenium,zenefits/selenium,s2oBCN/selenium,sri85/selenium,bartolkaruza/selenium,RamaraoDonta/ramarao-clone,bartolkaruza/selenium,gabrielsimas/selenium,DrMarcII/selenium,SeleniumHQ/selenium,Dude-X/selenium,markodolancic/selenium,freynaud/selenium,soundcloud/selenium,SeleniumHQ/selenium,Appdynamics/selenium,anshumanchatterji/selenium,yukaReal/selenium,gregerrag/selenium,kalyanjvn1/selenium,sri85/selenium,uchida/selenium,stupidnetizen/selenium,blueyed/selenium,TikhomirovSergey/selenium,bmannix/selenium,pulkitsinghal/selenium,bmannix/selenium,doungni/selenium,vveliev/selenium,markodolancic/selenium,bartolkaruza/selenium,xmhubj/selenium,blackboarddd/selenium,knorrium/selenium,HtmlUnit/selenium,o-schneider/selenium,carsonmcdonald/selenium,blueyed/selenium,gotcha/selenium,sebady/selenium,orange-tv-blagnac/selenium,5hawnknight/selenium,gemini-testing/selenium,meksh/selenium,joshmgrant/selenium,tarlabs/selenium,Appdynamics/selenium,xmhubj/selenium,gotcha/selenium,sebady/selenium,mojwang/selenium,vveliev/selenium,titusfortner/selenium,p0deje/selenium,amar-sharma/selenium,asolntsev/selenium,bayandin/selenium,slongwang/selenium,dandv/selenium,Tom-Trumper/selenium,quoideneuf/selenium,HtmlUnit/selenium,dbo/selenium,compstak/selenium,meksh/selenium,Herst/selenium,krmahadevan/selenium,actmd/selenium,chrsmithdemos/selenium,chrsmithdemos/selenium,o-schneider/selenium,aluedeke/chromedriver,bayandin/selenium,carsonmcdonald/selenium,gemini-testing/selenium,doungni/selenium,asolntsev/selenium,alexec/selenium,MeetMe/selenium,carlosroh/selenium,Appdynamics/selenium,krosenvold/selenium,orange-tv-blagnac/selenium,tarlabs/selenium,jsakamoto/selenium,p0deje/selenium,sankha93/selenium,markodolancic/selenium,5hawnknight/selenium,valfirst/selenium,rrussell39/selenium,dimacus/selenium,krmahadevan/selenium,actmd/selenium,zenefits/selenium,isaksky/selenium,jerome-jacob/selenium,Dude-X/selenium,Jarob22/selenium,carlosroh/selenium,asashour/selenium,jsarenik/jajomojo-selenium,telefonicaid/selenium,joshuaduffy/selenium,TikhomirovSergey/selenium,bmannix/selenium,eric-stanley/selenium,alb-i986/selenium,asolntsev/selenium,HtmlUnit/selenium,yukaReal/selenium,twalpole/selenium,SouWilliams/selenium,sevaseva/selenium,dbo/selenium,dimacus/selenium,pulkitsinghal/selenium,knorrium/selenium,aluedeke/chromedriver,livioc/selenium,gorlemik/selenium,krmahadevan/selenium,rplevka/selenium,sevaseva/selenium,orange-tv-blagnac/selenium,HtmlUnit/selenium,amar-sharma/selenium,jsakamoto/selenium,compstak/selenium,skurochkin/selenium,sag-enorman/selenium,MCGallaspy/selenium,RamaraoDonta/ramarao-clone,dibagga/selenium,asashour/selenium,i17c/selenium,joshbruning/selenium,titusfortner/selenium,tarlabs/selenium,5hawnknight/selenium,temyers/selenium,rovner/selenium,lilredindy/selenium,orange-tv-blagnac/selenium,Sravyaksr/selenium,joshbruning/selenium,sag-enorman/selenium,asashour/selenium,rovner/selenium,misttechnologies/selenium,chrsmithdemos/selenium,joshuaduffy/selenium,gabrielsimas/selenium,doungni/selenium,5hawnknight/selenium,lmtierney/selenium,TheBlackTuxCorp/selenium,bmannix/selenium,Dude-X/selenium,joshuaduffy/selenium,blackboarddd/selenium,JosephCastro/selenium,quoideneuf/selenium,petruc/selenium,mestihudson/selenium,jerome-jacob/selenium,bayandin/selenium,HtmlUnit/selenium,temyers/selenium,amar-sharma/selenium,sebady/selenium,lrowe/selenium,Jarob22/selenium,Sravyaksr/selenium,xmhubj/selenium,s2oBCN/selenium,juangj/selenium,gotcha/selenium,asolntsev/selenium,doungni/selenium,Herst/selenium,rplevka/selenium,gemini-testing/selenium,kalyanjvn1/selenium,tbeadle/selenium,amar-sharma/selenium,rovner/selenium,sag-enorman/selenium,aluedeke/chromedriver,alexec/selenium,RamaraoDonta/ramarao-clone,amar-sharma/selenium,joshuaduffy/selenium,gregerrag/selenium,clavery/selenium,vveliev/selenium,orange-tv-blagnac/selenium,chrisblock/selenium,s2oBCN/selenium,thanhpete/selenium,krosenvold/selenium,Dude-X/selenium,titusfortner/selenium,knorrium/selenium,twalpole/selenium,xsyntrex/selenium,sevaseva/selenium,joshmgrant/selenium,temyers/selenium,anshumanchatterji/selenium,tkurnosova/selenium,markodolancic/selenium,stupidnetizen/selenium,misttechnologies/selenium,sag-enorman/selenium,tarlabs/selenium,SevInf/IEDriver,markodolancic/selenium,tkurnosova/selenium,chrsmithdemos/selenium,zenefits/selenium,thanhpete/selenium,lrowe/selenium,chrisblock/selenium,dbo/selenium,SouWilliams/selenium,compstak/selenium,rovner/selenium,Herst/selenium,JosephCastro/selenium,arunsingh/selenium,dbo/selenium,wambat/selenium,actmd/selenium,rrussell39/selenium,SeleniumHQ/selenium,quoideneuf/selenium,dimacus/selenium,oddui/selenium,customcommander/selenium,thanhpete/selenium,Tom-Trumper/selenium,zenefits/selenium,DrMarcII/selenium,alexec/selenium,MeetMe/selenium,valfirst/selenium,Jarob22/selenium,alb-i986/selenium,AutomatedTester/selenium,Appdynamics/selenium,sag-enorman/selenium,SeleniumHQ/selenium,sankha93/selenium,jabbrwcky/selenium,Ardesco/selenium,jknguyen/josephknguyen-selenium,joshmgrant/selenium,davehunt/selenium,dandv/selenium,s2oBCN/selenium,compstak/selenium,manuelpirez/selenium,SevInf/IEDriver,jsarenik/jajomojo-selenium,lukeis/selenium,RamaraoDonta/ramarao-clone,carlosroh/selenium,juangj/selenium,jabbrwcky/selenium,AutomatedTester/selenium,petruc/selenium,jsakamoto/selenium,onedox/selenium,actmd/selenium,rplevka/selenium,petruc/selenium,krmahadevan/selenium,asashour/selenium,petruc/selenium,Tom-Trumper/selenium,lilredindy/selenium,jerome-jacob/selenium,mach6/selenium,valfirst/selenium,MeetMe/selenium,manuelpirez/selenium,dcjohnson1989/selenium,xmhubj/selenium,Tom-Trumper/selenium,Appdynamics/selenium,denis-vilyuzhanin/selenium-fastview,doungni/selenium,s2oBCN/selenium,eric-stanley/selenium,kalyanjvn1/selenium,tarlabs/selenium,temyers/selenium,jsarenik/jajomojo-selenium,dbo/selenium,arunsingh/selenium,customcommander/selenium,HtmlUnit/selenium,gorlemik/selenium,jknguyen/josephknguyen-selenium,customcommander/selenium,MCGallaspy/selenium,lukeis/selenium,wambat/selenium,mojwang/selenium,denis-vilyuzhanin/selenium-fastview,vveliev/selenium,dimacus/selenium,gurayinan/selenium,jabbrwcky/selenium,gorlemik/selenium,jsakamoto/selenium,houchj/selenium,twalpole/selenium,jsakamoto/selenium,krmahadevan/selenium,i17c/selenium,zenefits/selenium,rplevka/selenium,blackboarddd/selenium,dimacus/selenium,jsarenik/jajomojo-selenium,dibagga/selenium,BlackSmith/selenium,twalpole/selenium,GorK-ChO/selenium,lmtierney/selenium,tkurnosova/selenium,o-schneider/selenium,dbo/selenium,orange-tv-blagnac/selenium,davehunt/selenium,Herst/selenium,s2oBCN/selenium,blackboarddd/selenium,markodolancic/selenium,gabrielsimas/selenium,kalyanjvn1/selenium,lrowe/selenium,MeetMe/selenium,bartolkaruza/selenium,manuelpirez/selenium,vveliev/selenium,sankha93/selenium,wambat/selenium,dkentw/selenium,5hawnknight/selenium,gabrielsimas/selenium,carsonmcdonald/selenium,valfirst/selenium,wambat/selenium,joshmgrant/selenium,chrsmithdemos/selenium,Dude-X/selenium,jknguyen/josephknguyen-selenium,isaksky/selenium,alexec/selenium,asolntsev/selenium,soundcloud/selenium,carsonmcdonald/selenium,joshbruning/selenium,stupidnetizen/selenium,stupidnetizen/selenium,o-schneider/selenium,oddui/selenium,carlosroh/selenium,arunsingh/selenium,wambat/selenium,amikey/selenium,gurayinan/selenium,oddui/selenium,joshuaduffy/selenium,kalyanjvn1/selenium,MeetMe/selenium,TikhomirovSergey/selenium,jsarenik/jajomojo-selenium,xsyntrex/selenium,lrowe/selenium,tbeadle/selenium,wambat/selenium,sag-enorman/selenium,o-schneider/selenium,GorK-ChO/selenium,denis-vilyuzhanin/selenium-fastview,mach6/selenium,chrsmithdemos/selenium,bayandin/selenium,dcjohnson1989/selenium,lukeis/selenium,xmhubj/selenium,jerome-jacob/selenium,BlackSmith/selenium,gemini-testing/selenium,blackboarddd/selenium,meksh/selenium,Jarob22/selenium,slongwang/selenium,yukaReal/selenium,vveliev/selenium,chrisblock/selenium,chrsmithdemos/selenium,gorlemik/selenium,gorlemik/selenium,yukaReal/selenium,minhthuanit/selenium,meksh/selenium,SouWilliams/selenium,dandv/selenium,clavery/selenium,JosephCastro/selenium,kalyanjvn1/selenium,dkentw/selenium,bayandin/selenium,eric-stanley/selenium,xsyntrex/selenium,amar-sharma/selenium,GorK-ChO/selenium,s2oBCN/selenium,Ardesco/selenium,dcjohnson1989/selenium,valfirst/selenium,petruc/selenium,o-schneider/selenium,aluedeke/chromedriver,petruc/selenium,JosephCastro/selenium,i17c/selenium,SouWilliams/selenium,mestihudson/selenium,asashour/selenium,davehunt/selenium,rrussell39/selenium,Sravyaksr/selenium,doungni/selenium,AutomatedTester/selenium,chrsmithdemos/selenium,oddui/selenium,HtmlUnit/selenium,carsonmcdonald/selenium,customcommander/selenium,titusfortner/selenium,oddui/selenium,yukaReal/selenium,uchida/selenium,orange-tv-blagnac/selenium,davehunt/selenium,gurayinan/selenium,titusfortner/selenium,onedox/selenium,livioc/selenium,rrussell39/selenium,jsarenik/jajomojo-selenium,carlosroh/selenium,soundcloud/selenium,stupidnetizen/selenium,denis-vilyuzhanin/selenium-fastview,gregerrag/selenium,onedox/selenium,BlackSmith/selenium,meksh/selenium,jknguyen/josephknguyen-selenium,orange-tv-blagnac/selenium,RamaraoDonta/ramarao-clone,amar-sharma/selenium,jabbrwcky/selenium,vveliev/selenium,eric-stanley/selenium,carsonmcdonald/selenium,xsyntrex/selenium,stupidnetizen/selenium,gurayinan/selenium,livioc/selenium,dibagga/selenium,quoideneuf/selenium,thanhpete/selenium,lmtierney/selenium,orange-tv-blagnac/selenium,mach6/selenium,misttechnologies/selenium,p0deje/selenium,gotcha/selenium,tbeadle/selenium,valfirst/selenium,SevInf/IEDriver,clavery/selenium,AutomatedTester/selenium,houchj/selenium,gurayinan/selenium,SevInf/IEDriver,BlackSmith/selenium,petruc/selenium,BlackSmith/selenium,krmahadevan/selenium,houchj/selenium,mojwang/selenium,5hawnknight/selenium,mestihudson/selenium,slongwang/selenium,thanhpete/selenium,MeetMe/selenium,anshumanchatterji/selenium,doungni/selenium,s2oBCN/selenium,bmannix/selenium,krosenvold/selenium,telefonicaid/selenium,sag-enorman/selenium,wambat/selenium,TheBlackTuxCorp/selenium,TheBlackTuxCorp/selenium,gotcha/selenium,temyers/selenium,uchida/selenium,knorrium/selenium,JosephCastro/selenium,freynaud/selenium,o-schneider/selenium,Tom-Trumper/selenium,zenefits/selenium,actmd/selenium,Herst/selenium,AutomatedTester/selenium,gemini-testing/selenium,thanhpete/selenium,xmhubj/selenium,jknguyen/josephknguyen-selenium,asolntsev/selenium,gorlemik/selenium,Ardesco/selenium,telefonicaid/selenium,mestihudson/selenium,dibagga/selenium,Dude-X/selenium,mestihudson/selenium,Dude-X/selenium,pulkitsinghal/selenium,i17c/selenium,thanhpete/selenium,Sravyaksr/selenium,SouWilliams/selenium,rrussell39/selenium,gemini-testing/selenium,dkentw/selenium,gregerrag/selenium,TikhomirovSergey/selenium,kalyanjvn1/selenium,pulkitsinghal/selenium,livioc/selenium,mach6/selenium,SeleniumHQ/selenium,dkentw/selenium,titusfortner/selenium,livioc/selenium,manuelpirez/selenium,bartolkaruza/selenium,arunsingh/selenium,juangj/selenium,asolntsev/selenium,gurayinan/selenium,houchj/selenium,onedox/selenium,actmd/selenium,xmhubj/selenium,xsyntrex/selenium,joshuaduffy/selenium,actmd/selenium,gorlemik/selenium,sri85/selenium,slongwang/selenium,anshumanchatterji/selenium,lilredindy/selenium,clavery/selenium,sankha93/selenium,krosenvold/selenium,minhthuanit/selenium,dcjohnson1989/selenium,kalyanjvn1/selenium,livioc/selenium,valfirst/selenium,jabbrwcky/selenium,meksh/selenium,zenefits/selenium,anshumanchatterji/selenium,BlackSmith/selenium,meksh/selenium,rovner/selenium,mojwang/selenium,JosephCastro/selenium,markodolancic/selenium,lilredindy/selenium,davehunt/selenium,sebady/selenium,temyers/selenium,houchj/selenium,titusfortner/selenium,lilredindy/selenium,amikey/selenium,JosephCastro/selenium,petruc/selenium,Sravyaksr/selenium,BlackSmith/selenium,twalpole/selenium,dimacus/selenium,compstak/selenium,joshuaduffy/selenium,Jarob22/selenium,mach6/selenium,isaksky/selenium,freynaud/selenium,freynaud/selenium,gabrielsimas/selenium,uchida/selenium,anshumanchatterji/selenium,bmannix/selenium,customcommander/selenium,gurayinan/selenium,joshmgrant/selenium,eric-stanley/selenium,oddui/selenium,dandv/selenium,jknguyen/josephknguyen-selenium,arunsingh/selenium,dandv/selenium,joshmgrant/selenium,jerome-jacob/selenium,amar-sharma/selenium,TheBlackTuxCorp/selenium,onedox/selenium,i17c/selenium,rrussell39/selenium,jsakamoto/selenium,amikey/selenium,valfirst/selenium,pulkitsinghal/selenium,xmhubj/selenium,juangj/selenium,blueyed/selenium,juangj/selenium,Tom-Trumper/selenium,jknguyen/josephknguyen-selenium,wambat/selenium,SeleniumHQ/selenium,Ardesco/selenium,petruc/selenium,twalpole/selenium,Ardesco/selenium,eric-stanley/selenium,gabrielsimas/selenium,lilredindy/selenium,bartolkaruza/selenium,Tom-Trumper/selenium,dimacus/selenium,MCGallaspy/selenium,vveliev/selenium,blackboarddd/selenium,lukeis/selenium,dandv/selenium,slongwang/selenium,dibagga/selenium,jerome-jacob/selenium,tbeadle/selenium,Sravyaksr/selenium,bayandin/selenium,gotcha/selenium,lmtierney/selenium,DrMarcII/selenium,zenefits/selenium,actmd/selenium,dibagga/selenium,lmtierney/selenium,mojwang/selenium,Jarob22/selenium,dkentw/selenium,dimacus/selenium,Sravyaksr/selenium,krmahadevan/selenium,alb-i986/selenium,bayandin/selenium,uchida/selenium,DrMarcII/selenium,titusfortner/selenium,chrisblock/selenium,SevInf/IEDriver,tbeadle/selenium,sag-enorman/selenium,Herst/selenium,vveliev/selenium,amikey/selenium,misttechnologies/selenium,bayandin/selenium,aluedeke/chromedriver,MCGallaspy/selenium,MCGallaspy/selenium,lilredindy/selenium,RamaraoDonta/ramarao-clone,dcjohnson1989/selenium,sevaseva/selenium,rplevka/selenium,knorrium/selenium,gotcha/selenium,clavery/selenium,misttechnologies/selenium,joshuaduffy/selenium,slongwang/selenium,gemini-testing/selenium,gorlemik/selenium,asashour/selenium,gurayinan/selenium,Appdynamics/selenium,oddui/selenium,arunsingh/selenium,sevaseva/selenium,Herst/selenium,mestihudson/selenium,markodolancic/selenium,jerome-jacob/selenium,isaksky/selenium,i17c/selenium,blackboarddd/selenium,freynaud/selenium,bayandin/selenium,SouWilliams/selenium,dimacus/selenium,p0deje/selenium,dkentw/selenium,valfirst/selenium,skurochkin/selenium,yukaReal/selenium,lukeis/selenium,tkurnosova/selenium,eric-stanley/selenium,carlosroh/selenium,thanhpete/selenium,Ardesco/selenium,TheBlackTuxCorp/selenium,rplevka/selenium,tbeadle/selenium,soundcloud/selenium,temyers/selenium,mach6/selenium,alexec/selenium,alexec/selenium,sevaseva/selenium,anshumanchatterji/selenium,blackboarddd/selenium,asolntsev/selenium
dotnet/src/Selenium.WebDriverBackedSelenium/Internal/SeleniumEmulation/Open.cs
dotnet/src/Selenium.WebDriverBackedSelenium/Internal/SeleniumEmulation/Open.cs
using System; using System.Collections.Generic; using System.Text; using OpenQA.Selenium; using Selenium.Internal.SeleniumEmulation; namespace Selenium.Internal.SeleniumEmulation { /// <summary> /// Defines the command for the open keyword. /// </summary> internal class Open : SeleneseCommand { private Uri baseUrl; /// <summary> /// Initializes a new instance of the <see cref="Open"/> class. /// </summary> /// <param name="baseUrl">The base URL to open with the command.</param> public Open(Uri baseUrl) { this.baseUrl = baseUrl; } /// <summary> /// Handles the command. /// </summary> /// <param name="driver">The driver used to execute the command.</param> /// <param name="locator">The first parameter to the command.</param> /// <param name="value">The second parameter to the command.</param> /// <returns>The result of the command.</returns> protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value) { string urlToOpen = this.ConstructUrl(locator); driver.Url = urlToOpen; return null; } private string ConstructUrl(string path) { string urlToOpen = path.Contains("://") ? path : this.baseUrl.ToString().TrimEnd('/') + (!path.StartsWith("/", StringComparison.Ordinal) ? "/" : string.Empty) + path; return urlToOpen; } } }
using System; using System.Collections.Generic; using System.Text; using OpenQA.Selenium; using Selenium.Internal.SeleniumEmulation; namespace Selenium.Internal.SeleniumEmulation { /// <summary> /// Defines the command for the open keyword. /// </summary> internal class Open : SeleneseCommand { private Uri baseUrl; /// <summary> /// Initializes a new instance of the <see cref="Open"/> class. /// </summary> /// <param name="baseUrl">The base URL to open with the command.</param> public Open(Uri baseUrl) { this.baseUrl = baseUrl; } /// <summary> /// Handles the command. /// </summary> /// <param name="driver">The driver used to execute the command.</param> /// <param name="locator">The first parameter to the command.</param> /// <param name="value">The second parameter to the command.</param> /// <returns>The result of the command.</returns> protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value) { string urlToOpen = this.ConstructUrl(locator); driver.Url = urlToOpen; return null; } private string ConstructUrl(string path) { string urlToOpen = path.Contains("://") ? path : this.baseUrl.ToString() + (!path.StartsWith("/", StringComparison.Ordinal) ? "/" : string.Empty) + path; return urlToOpen; } } }
apache-2.0
C#
a37ace94010227f3be4d3edc23614bc326f06c6f
Fix #93: ReferenceFinder should return public types only (#95)
Fody/NullGuard
Fody/ReferenceFinder.cs
Fody/ReferenceFinder.cs
using System.Collections.Generic; using System.Linq; using Mono.Cecil; public partial class ModuleWeaver { public MethodReference ArgumentNullExceptionConstructor; public MethodReference ArgumentNullExceptionWithMessageConstructor; public MethodReference InvalidOperationExceptionConstructor; public MethodReference DebugAssertMethod; void AddAssemblyIfExists(string name, List<TypeDefinition> types) { try { var assembly = AssemblyResolver.Resolve(new AssemblyNameReference(name, null)); if (assembly != null) { types.AddRange(assembly.MainModule.Types.Where(type => type.IsPublic)); } } catch (AssemblyResolutionException) { LogInfo($"Failed to resolve '{name}'. So skipping its types."); } } public void FindReferences() { var types = new List<TypeDefinition>(); AddAssemblyIfExists("mscorlib", types); AddAssemblyIfExists("System.Runtime", types); AddAssemblyIfExists("System", types); AddAssemblyIfExists("netstandard", types); AddAssemblyIfExists("System.Diagnostics.Debug", types); var argumentNullException = types.FirstOrThrow(x => x.Name == "ArgumentNullException", "ArgumentNullException"); ArgumentNullExceptionConstructor = ModuleDefinition.ImportReference(argumentNullException.Methods.First(x => x.IsConstructor && x.Parameters.Count == 1 && x.Parameters[0].ParameterType.Name == "String")); ArgumentNullExceptionWithMessageConstructor = ModuleDefinition.ImportReference(argumentNullException.Methods.First(x => x.IsConstructor && x.Parameters.Count == 2 && x.Parameters[0].ParameterType.Name == "String" && x.Parameters[1].ParameterType.Name == "String")); var invalidOperationException = types.FirstOrThrow(x => x.Name == "InvalidOperationException", "InvalidOperationException"); InvalidOperationExceptionConstructor = ModuleDefinition.ImportReference(invalidOperationException.Methods.First(x => x.IsConstructor && x.Parameters.Count == 1 && x.Parameters[0].ParameterType.Name == "String")); var debug = types.FirstOrThrow(x => x.Name == "Debug", "Debug"); DebugAssertMethod = ModuleDefinition.ImportReference(debug.Methods.First(x => x.IsStatic && x.Parameters.Count == 2 && x.Parameters[0].ParameterType.Name == "Boolean" && x.Parameters[1].ParameterType.Name == "String")); } }
using System.Collections.Generic; using System.Linq; using Mono.Cecil; public partial class ModuleWeaver { public MethodReference ArgumentNullExceptionConstructor; public MethodReference ArgumentNullExceptionWithMessageConstructor; public MethodReference InvalidOperationExceptionConstructor; public MethodReference DebugAssertMethod; void AddAssemblyIfExists(string name, List<TypeDefinition> types) { try { var assembly = AssemblyResolver.Resolve(new AssemblyNameReference(name, null)); if (assembly != null) { types.AddRange(assembly.MainModule.Types); } } catch (AssemblyResolutionException) { LogInfo($"Failed to resolve '{name}'. So skipping its types."); } } public void FindReferences() { var types = new List<TypeDefinition>(); AddAssemblyIfExists("mscorlib", types); AddAssemblyIfExists("System.Runtime", types); AddAssemblyIfExists("System", types); AddAssemblyIfExists("netstandard", types); AddAssemblyIfExists("System.Diagnostics.Debug", types); var argumentNullException = types.FirstOrThrow(x => x.Name == "ArgumentNullException", "ArgumentNullException"); ArgumentNullExceptionConstructor = ModuleDefinition.ImportReference(argumentNullException.Methods.First(x => x.IsConstructor && x.Parameters.Count == 1 && x.Parameters[0].ParameterType.Name == "String")); ArgumentNullExceptionWithMessageConstructor = ModuleDefinition.ImportReference(argumentNullException.Methods.First(x => x.IsConstructor && x.Parameters.Count == 2 && x.Parameters[0].ParameterType.Name == "String" && x.Parameters[1].ParameterType.Name == "String")); var invalidOperationException = types.FirstOrThrow(x => x.Name == "InvalidOperationException", "InvalidOperationException"); InvalidOperationExceptionConstructor = ModuleDefinition.ImportReference(invalidOperationException.Methods.First(x => x.IsConstructor && x.Parameters.Count == 1 && x.Parameters[0].ParameterType.Name == "String")); var debug = types.FirstOrThrow(x => x.Name == "Debug", "Debug"); DebugAssertMethod = ModuleDefinition.ImportReference(debug.Methods.First(x => x.IsStatic && x.Parameters.Count == 2 && x.Parameters[0].ParameterType.Name == "Boolean" && x.Parameters[1].ParameterType.Name == "String")); } }
mit
C#
d572a32c59e2260a224fcecb1650c9b253edfe84
Fix build warning
jmelosegui/pinvoke,vbfox/pinvoke,AArnott/pinvoke
src/UxTheme.Desktop/UxTheme+MARGINS.cs
src/UxTheme.Desktop/UxTheme+MARGINS.cs
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. namespace PInvoke { using System; using System.Runtime.InteropServices; /// <content> /// Contains the <see cref="MARGINS"/> nested type. /// </content> public partial class UxTheme { /// <summary> /// Returned by the <see cref="GetThemeMargins(SafeThemeHandle, User32.SafeDCHandle, int, int, int, RECT*, out MARGINS)"/> function to define the margins of windows that have visual styles applied. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct MARGINS { /// <summary> /// Width of the left border that retains its size. /// </summary> public int cxLeftWidth; /// <summary> /// Width of the right border that retains its size. /// </summary> public int cxRightWidth; /// <summary> /// Height of the top border that retains its size. /// </summary> public int cyTopHeight; /// <summary> /// Height of the bottom border that retains its size. /// </summary> public int cyBottomHeight; } } }
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. namespace PInvoke { using System; using System.Runtime.InteropServices; /// <content> /// Contains the <see cref="MARGINS"/> nested type. /// </content> public partial class UxTheme { /// <summary> /// Returned by the <see cref="GetThemeMargins"/> function to define the margins of windows that have visual styles applied. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct MARGINS { /// <summary> /// Width of the left border that retains its size. /// </summary> public int cxLeftWidth; /// <summary> /// Width of the right border that retains its size. /// </summary> public int cxRightWidth; /// <summary> /// Height of the top border that retains its size. /// </summary> public int cyTopHeight; /// <summary> /// Height of the bottom border that retains its size. /// </summary> public int cyBottomHeight; } } }
mit
C#
a7755d50eff2b471e204df27c168a13d150324f7
Fix bad logic stopping the UrlSegmentProvider from being installed. Fixes #2.
ryanlewis/seo-metadata,ryanmcdonough/seo-metadata,ryanmcdonough/seo-metadata,ryanlewis/seo-metadata,ryanmcdonough/seo-metadata,ryanlewis/seo-metadata
app/Epiphany.SeoMetadata/SeoMetadataStartup.cs
app/Epiphany.SeoMetadata/SeoMetadataStartup.cs
using System; using System.Configuration; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Strings; namespace Epiphany.SeoMetadata { public class SeoMetadataStartup : ApplicationEventHandler { protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { bool ignoreSegmentProvider; var hasKey = Boolean.TryParse(ConfigurationManager.AppSettings["SeoMetadata.NoSegmentProvider"], out ignoreSegmentProvider); if (!hasKey || !ignoreSegmentProvider) { UrlSegmentProviderResolver.Current.InsertTypeBefore(typeof(DefaultUrlSegmentProvider), typeof(SeoMetadataUrlSegmentProvider)); LogHelper.Info<SeoMetadataStartup>("Configured SeoMetadataUrlSegmentProvider"); } base.ApplicationStarting(umbracoApplication, applicationContext); } } }
using System; using System.Configuration; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Strings; namespace Epiphany.SeoMetadata { public class SeoMetadataStartup : ApplicationEventHandler { protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { bool ignoreSegmentProvider; var hasKey = Boolean.TryParse(ConfigurationManager.AppSettings["SeoMetadata.NoSegmentProvider"], out ignoreSegmentProvider); if (hasKey && !ignoreSegmentProvider) { UrlSegmentProviderResolver.Current.InsertTypeBefore(typeof(DefaultUrlSegmentProvider), typeof(SeoMetadataUrlSegmentProvider)); LogHelper.Info<SeoMetadataStartup>("Configured SeoMetadataUrlSegmentProvider"); } base.ApplicationStarting(umbracoApplication, applicationContext); } } }
mit
C#
458c12cfb16c937b215a7372bc41be843fdc9d9d
Update VacancyClosed.cshtml
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/VacancyClosed.cshtml
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/VacancyClosed.cshtml
@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel @{ var applicationsTextSuffix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? (Model.NoOfApplications.Value.Equals(1) ? "application" : "applications") : ""; var applicationsTextPrefix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? "View" : ""; } <section class="dashboard-section"> <h2 class="section-heading heading-large"> Your apprenticeship advert </h2> <p>You've created an advert for your apprenticeship.</p> <table class="responsive"> <tr> <th scope="row" class="tw-35"> Title </th> <td class="tw-65"> @(Model?.Title) </td> </tr> <tr> <th scope="row" class="tw-35"> Closing date </th> <td class="tw-65"> @(Model.ClosedDateText) </td> </tr> <tr> <th scope="row" class="tw-35"> Applications </th> <td class="tw-65"> <a href="@Model.ManageVacancyUrl" class="govuk-link">@applicationsTextPrefix @(!Model.NoOfApplications.GetValueOrDefault().Equals(0) ? $"{Model.NoOfApplications.Value}" : "No applications yet") @applicationsTextSuffix</a> </td> </tr> <tr> <th scope="row"> Status </th> <td> <strong class="govuk-tag govuk-tag--inactive">CLOSED</strong> </td> </tr> </table> <p> <a href="@Url.EmployerCommitmentsV2Action("unapproved/inform")" role="button" draggable="false" class="button"> Add apprentice details </a> </p> </section>
@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel @{ var applicationsTextSuffix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? (Model.NoOfApplications.Value.Equals(1) ? "application" : "applications") : ""; var applicationsTextPrefix = !Model.NoOfApplications.GetValueOrDefault().Equals(0) ? "View" : ""; } <section class="dashboard-section"> <h2 class="section-heading heading-large"> Your apprenticeship advert </h2> <p>You've created an advert for your apprenticeship.</p> <table class="responsive"> <tr> <th scope="row" class="tw-35"> Title </th> <td class="tw-65"> @(Model?.Title) </td> </tr> <tr> <th scope="row" class="tw-35"> Closing date </th> <td class="tw-65"> @(Model.ClosedDateText) </td> </tr> <tr> <th scope="row" class="tw-35"> Applications </th> <td class="tw-65"> <a href="@Model.ManageVacancyUrl" class="govuk-link">@applicationsTextPrefix @(!Model.NoOfApplications.GetValueOrDefault().Equals(0) ? $"{Model.NoOfApplications.Value}" : "No applications yet") @applicationsTextSuffix</a> </td> </tr> <tr> <th scope="row"> Status </th> <td> <strong class="govuk-tag govuk-tag--inactive">CLOSED</strong> </td> </tr> </table> <p> <a href="@Url.EmployerCommitmentsAction("apprentices/inform")" role="button" draggable="false" class="button"> Add apprentice details </a> </p> </section>
mit
C#
9d45cf85ad9cfaeef5e29d8880af66fdc3348b56
Add coments to ProductDto.cs.
harrison314/MapperPerformace
MapperPerformace/Testing/ProductDto.cs
MapperPerformace/Testing/ProductDto.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MapperPerformace.Testing { /// <summary> /// Dto represents <see cref="MapperPerformace.Ef.Product"/>. /// </summary> [System.Diagnostics.DebuggerDisplay("Id: {ProductID}, Count: {ProductListPriceHistories.Count}")] public class ProductDto { public int ProductID { get; set; } public string Name { get; set; } public string ProductNumber { get; set; } public bool MakeFlag { get; set; } public bool FinishedGoodsFlag { get; set; } public string Color { get; set; } public short SafetyStockLevel { get; set; } public short ReorderPoint { get; set; } public decimal StandardCost { get; set; } public decimal ListPrice { get; set; } public string Size { get; set; } public string SizeUnitMeasureCode { get; set; } public string WeightUnitMeasureCode { get; set; } public Nullable<decimal> Weight { get; set; } public int DaysToManufacture { get; set; } public string ProductLine { get; set; } public string Class { get; set; } public string Style { get; set; } public Nullable<int> ProductSubcategoryID { get; set; } public Nullable<int> ProductModelID { get; set; } public System.DateTime SellStartDate { get; set; } public DateTime? SellEndDate { get; set; } public DateTime? DiscontinuedDate { get; set; } public System.Guid rowguid { get; set; } public System.DateTime ModifiedDate { get; set; } public List<ProductListPriceHistoryDto> ProductListPriceHistories { get; set; } /// <summary> /// Initializes a new instance of the <see cref="ProductDto"/> class. /// </summary> public ProductDto() { this.ProductListPriceHistories = new List<ProductListPriceHistoryDto>(); } } /// <summary> /// Dto represents <see cref="MapperPerformace.Ef.ProductListPriceHistory"/>. /// </summary> public class ProductListPriceHistoryDto { /// <summary> /// Gets or sets the start date. Id PK. /// </summary> public DateTime StartDate { get; set; } public int ProductID { get; set; } public DateTime? EndDate { get; set; } public decimal ListPrice { get; set; } public System.DateTime ModifiedDate { get; set; } /// <summary> /// Initializes a new instance of the <see cref="ProductListPriceHistoryDto"/> class. /// </summary> public ProductListPriceHistoryDto() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MapperPerformace.Testing { [System.Diagnostics.DebuggerDisplay("Id: {ProductID}, Count: {ProductListPriceHistories.Count}")] public class ProductDto { public int ProductID { get; set; } public string Name { get; set; } public string ProductNumber { get; set; } public bool MakeFlag { get; set; } public bool FinishedGoodsFlag { get; set; } public string Color { get; set; } public short SafetyStockLevel { get; set; } public short ReorderPoint { get; set; } public decimal StandardCost { get; set; } public decimal ListPrice { get; set; } public string Size { get; set; } public string SizeUnitMeasureCode { get; set; } public string WeightUnitMeasureCode { get; set; } public Nullable<decimal> Weight { get; set; } public int DaysToManufacture { get; set; } public string ProductLine { get; set; } public string Class { get; set; } public string Style { get; set; } public Nullable<int> ProductSubcategoryID { get; set; } public Nullable<int> ProductModelID { get; set; } public System.DateTime SellStartDate { get; set; } public Nullable<System.DateTime> SellEndDate { get; set; } public Nullable<System.DateTime> DiscontinuedDate { get; set; } public System.Guid rowguid { get; set; } public System.DateTime ModifiedDate { get; set; } public List<ProductListPriceHistoryDto> ProductListPriceHistories { get; set; } public ProductDto() { this.ProductListPriceHistories = new List<ProductListPriceHistoryDto>(); } } public class ProductListPriceHistoryDto { public int ProductID { get; set; } public System.DateTime StartDate { get; set; } public Nullable<System.DateTime> EndDate { get; set; } public decimal ListPrice { get; set; } public System.DateTime ModifiedDate { get; set; } public ProductListPriceHistoryDto() { } } }
mit
C#
08b3ed7f093eaac592b38db86f45ac25e1081e80
Add WaitForExit to Archive build task
andrew-polk/libpalaso,gtryus/libpalaso,marksvc/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,hatton/libpalaso,darcywong00/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,hatton/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,chrisvire/libpalaso,gtryus/libpalaso,mccarthyrb/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,marksvc/libpalaso,sillsdev/libpalaso,mccarthyrb/libpalaso,hatton/libpalaso,glasseyes/libpalaso,darcywong00/libpalaso,tombogle/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,gmartin7/libpalaso,chrisvire/libpalaso,sillsdev/libpalaso,darcywong00/libpalaso,marksvc/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,ermshiperete/libpalaso
Palaso.MSBuildTasks/Archive/Archive.cs
Palaso.MSBuildTasks/Archive/Archive.cs
using System; using System.Diagnostics; using System.IO; using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Palaso.BuildTasks.Archive { public class Archive : Task { [Required] public ITaskItem[] InputFilePaths { get; set; } [Required] public string Command { get; set; } [Required] public string OutputFileName { get; set; } public string BasePath { get; set; } public string WorkingDir { get; set; } public override bool Execute() { string filePathString = FlattenFilePaths(InputFilePaths, ' ', false); var startInfo = new ProcessStartInfo(ExecutableName()); startInfo.Arguments = Arguments() + " " + filePathString; startInfo.WorkingDirectory = String.IsNullOrEmpty(WorkingDir) ? BasePath : WorkingDir; var process = Process.Start(startInfo); process.WaitForExit(); return true; } internal string ExecutableName() { switch (Command) { case "Tar": return "tar"; } return String.Empty; } internal string Arguments() { switch (Command) { case "Tar": return "-cvzf " + OutputFileName; } return String.Empty; } internal string TrimBaseFromFilePath(string filePath) { string result = filePath; if (result.StartsWith(BasePath)) { result = filePath.Substring(BasePath.Length); if (result.StartsWith("/") || result.StartsWith("\\")) result = result.TrimStart(new[] {'/', '\\'}); } return result; } internal string FlattenFilePaths(ITaskItem[] items, char delimeter, bool withQuotes) { var sb = new StringBuilder(); bool haveStarted = false; foreach (var item in items) { if (haveStarted) { sb.Append(delimeter); } string filePath = TrimBaseFromFilePath(item.ItemSpec); if (filePath.Contains(" ") || withQuotes) { sb.Append('"'); sb.Append(filePath); sb.Append('"'); } else { sb.Append(filePath); } haveStarted = true; } return sb.ToString(); } private void SafeLog(string msg, params object[] args) { try { Debug.WriteLine(string.Format(msg,args)); Log.LogMessage(msg,args); } catch (Exception) { //swallow... logging fails in the unit test environment, where the log isn't really set up } } } }
using System; using System.Diagnostics; using System.IO; using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Palaso.BuildTasks.Archive { public class Archive : Task { [Required] public ITaskItem[] InputFilePaths { get; set; } [Required] public string Command { get; set; } [Required] public string OutputFileName { get; set; } public string BasePath { get; set; } public string WorkingDir { get; set; } public override bool Execute() { string filePathString = FlattenFilePaths(InputFilePaths, ' ', false); var startInfo = new ProcessStartInfo(ExecutableName()); startInfo.Arguments = Arguments() + " " + filePathString; startInfo.WorkingDirectory = String.IsNullOrEmpty(WorkingDir) ? BasePath : WorkingDir; Process.Start(startInfo); return true; } internal string ExecutableName() { switch (Command) { case "Tar": return "tar"; } return String.Empty; } internal string Arguments() { switch (Command) { case "Tar": return "-cvzf " + OutputFileName; } return String.Empty; } internal string TrimBaseFromFilePath(string filePath) { string result = filePath; if (result.StartsWith(BasePath)) { result = filePath.Substring(BasePath.Length); if (result.StartsWith("/") || result.StartsWith("\\")) result = result.TrimStart(new[] {'/', '\\'}); } return result; } internal string FlattenFilePaths(ITaskItem[] items, char delimeter, bool withQuotes) { var sb = new StringBuilder(); bool haveStarted = false; foreach (var item in items) { if (haveStarted) { sb.Append(delimeter); } string filePath = TrimBaseFromFilePath(item.ItemSpec); if (filePath.Contains(" ") || withQuotes) { sb.Append('"'); sb.Append(filePath); sb.Append('"'); } else { sb.Append(filePath); } haveStarted = true; } return sb.ToString(); } private void SafeLog(string msg, params object[] args) { try { Debug.WriteLine(string.Format(msg,args)); Log.LogMessage(msg,args); } catch (Exception) { //swallow... logging fails in the unit test environment, where the log isn't really set up } } } }
mit
C#
a46f0103eed359a29c0cfbfd01f348db5d835bb2
Use CopyRecursive as extension method
dkoeb/f-spot,nathansamson/F-Spot-Album-Exporter,mono/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,dkoeb/f-spot,mono/f-spot,NguyenMatthieu/f-spot,GNOME/f-spot,dkoeb/f-spot,mono/f-spot,nathansamson/F-Spot-Album-Exporter,Sanva/f-spot,mans0954/f-spot,mans0954/f-spot,GNOME/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,dkoeb/f-spot,mono/f-spot,Yetangitu/f-spot,Sanva/f-spot,mono/f-spot,dkoeb/f-spot,GNOME/f-spot,Sanva/f-spot,Yetangitu/f-spot,NguyenMatthieu/f-spot,Yetangitu/f-spot,mono/f-spot,Sanva/f-spot,mans0954/f-spot,Yetangitu/f-spot,Sanva/f-spot,GNOME/f-spot,mans0954/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,NguyenMatthieu/f-spot,mans0954/f-spot,nathansamson/F-Spot-Album-Exporter
src/Utils/FileExtensions.cs
src/Utils/FileExtensions.cs
/* * FSpot.Utils.FileExtensions.cs * * Author(s) * Paul Wellner Bou <paul@purecodes.org> * * This is free software. See COPYING for details. */ using System; using System.IO; using Mono.Unix; using GLib; namespace FSpot.Utils { public static class FileExtensions { public static bool CopyRecursive (this GLib.File source, GLib.File target, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback callback) { bool result = true; GLib.FileType ft = source.QueryFileType (GLib.FileQueryInfoFlags.None, cancellable); Log.Debug (Catalog.GetString("Try to copy {0} -> {1}"), source.Path, target.Path); if (ft != GLib.FileType.Directory) { Log.Debug (Catalog.GetString("Copying {0} -> {1}"), source.Path, target.Path); return source.Copy (target, flags, cancellable, callback); } if (!target.Exists) { Log.Debug ("Creating directory: "+target.Path); result = result && target.MakeDirectoryWithParents (cancellable); } GLib.FileEnumerator fe = source.EnumerateChildren ("standard::name", GLib.FileQueryInfoFlags.None, cancellable); GLib.FileInfo fi = fe.NextFile (); while (fi != null) { GLib.File source_file = GLib.FileFactory.NewForPath (Path.Combine (source.Path, fi.Name)); GLib.File target_file = GLib.FileFactory.NewForPath (Path.Combine (target.Path, fi.Name)); Log.Debug (Catalog.GetString("CopyRecursive {0} -> {1}"), source_file.Path, target_file.Path); result = result && source_file.CopyRecursive(target_file, flags, cancellable, callback); fi = fe.NextFile (); } fe.Close (cancellable); return result; } } }
/* * FSpot.Utils.FileExtensions.cs * * Author(s) * Paul Wellner Bou <paul@purecodes.org> * * This is free software. See COPYING for details. */ using System; using System.IO; using Mono.Unix; using GLib; namespace FSpot.Utils { public static class FileExtensions { public static bool CopyRecursive (this GLib.File source, GLib.File target, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback callback) { bool result = true; GLib.FileType ft = source.QueryFileType (GLib.FileQueryInfoFlags.None, cancellable); Log.Debug (Catalog.GetString("Try to copy {0} -> {1}"), source.Path, target.Path); if (ft != GLib.FileType.Directory) { Log.Debug (Catalog.GetString("Copying {0} -> {1}"), source.Path, target.Path); return source.Copy (target, flags, cancellable, callback); } if (!target.Exists) { Log.Debug ("Creating directory: "+target.Path); result = result && target.MakeDirectoryWithParents (cancellable); } GLib.FileEnumerator fe = source.EnumerateChildren ("standard::name", GLib.FileQueryInfoFlags.None, cancellable); GLib.FileInfo fi = fe.NextFile (); while (fi != null) { GLib.File source_file = GLib.FileFactory.NewForPath (Path.Combine (source.Path, fi.Name)); GLib.File target_file = GLib.FileFactory.NewForPath (Path.Combine (target.Path, fi.Name)); Log.Debug (Catalog.GetString("CopyRecursive {0} -> {1}"), source_file.Path, target_file.Path); result = result && CopyRecursive(source_file, target_file, flags, cancellable, callback); fi = fe.NextFile (); } fe.Close (cancellable); return result; } } }
mit
C#
56f0e4254e68d5c90e6d718fad731517cfbcd2b4
modifica creata
gaggiga/academyOvernetLuglio2017
Yoox.StringCalculatorKata/Yoox.StringCalculatorKataTest/StringCalculatorTest.cs
Yoox.StringCalculatorKata/Yoox.StringCalculatorKataTest/StringCalculatorTest.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Yoox.StringCalculatorKata; namespace Yoox.StringCalculatorKataTest { [TestClass] public class StringCalculatorTest { StringCalculator sck; public StringCalculatorTest() { sck = new StringCalculator(); } [TestMethod] public void Add_Should_ReturnZero_When_NumbersIsEmpty() { Assert.AreEqual(0, sck.Add("")); } [TestMethod] public void Add_Should_ReturnTheNumber_When_NumbersContainsSingleNumber() { var input = new string[] { "0", "1", "255" }; foreach(var i in input) { Assert.AreEqual(Int32.Parse(i), sck.Add(i)); } } [TestMethod] public void Add_Should_ReturnTheSum_When_NumbersContainsTwoNumbers() { Assert.AreEqual(3, sck.Add("1,2")); Assert.AreEqual(157, sck.Add("145,12")); Assert.AreEqual(1166, sck.Add("347,819")); } [TestMethod] public void Add_Should_ReturnTheSum_When_NumbersContainsMoreThenTwoNumbers() { Assert.AreEqual(158, sck.Add("145,12,1")); Assert.AreEqual(1171, sck.Add("347,819,4,1")); } [TestMethod] public void Add_Should_ReturnTheSum_When_NumbersContainsNewLine() { Assert.AreEqual(158, sck.Add("145,12\n1")); Assert.AreEqual(1171, sck.Add("347\n819,4,1")); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Yoox.StringCalculatorKata; namespace Yoox.StringCalculatorKataTest { [TestClass] public class StringCalculatorTest { StringCalculator sck; public StringCalculatorTest() { sck = new StringCalculator(); } [TestMethod] public void Add_Should_ReturnZero_When_NumbersIsEmpty() { Assert.AreEqual(0, sck.Add("")); } [TestMethod] public void Add_Should_ReturnTheNumber_When_NumbersContainsSingleNumber() { var input = new string[] { "0", "1", "255" }; foreach(var i in input) { Assert.AreEqual(Int32.Parse(i), sck.Add(i)); } } [TestMethod] public void Add_Should_ReturnTheSum_When_NumbersContainsTwoNumbers() { Assert.AreEqual(3, sck.Add("1,2")); Assert.AreEqual(157, sck.Add("145,12")); Assert.AreEqual(1166, sck.Add("347,819")); } } }
mit
C#
e3d14c8223f74e486f0f553558075685e0917b2d
Change EventData type
twilio/twilio-csharp,IRlyDontKnow/twilio-csharp,mplacona/twilio-csharp
src/Twilio.Monitor/Model/Event.cs
src/Twilio.Monitor/Model/Event.cs
using System; using System.Collections; using System.Collections.Generic; namespace Twilio.Monitor { /// <summary> /// An Event instance resource represents a single Twilio Event. /// </summary> public class Event : TwilioBase { /// <summary> /// The unique ID for this Event. /// </summary> public string Sid { get; set; } /// <summary> /// The unique ID of the Account that owns this Event. /// </summary> public string AccountSid { get; set; } /// <summary> /// The unique ID of the actor that generated this Event. /// </summary> public string ActorSid { get; set; } /// <summary> /// The type of actor that generated this Event. /// </summary> public string ActorType { get; set; } /// <summary> /// This Event's description. /// </summary> public string Description { get; set; } /// <summary> /// The date at which this Event was generated. /// </summary> public DateTime EventDate { get; set; } /// <summary> /// The type of this Event. /// </summary> public string EventType { get; set; } /// <summary> /// The unique ID of the resource for this Event. /// </summary> public string ResourceSid { get; set; } /// <summary> /// The resource type of this Event. /// </summary> public string ResourceType { get; set; } /// <summary> /// The source of this Event. /// </summary> public string Source { get; set; } /// <summary> /// The source IP address of this Event. /// </summary> public string SourceIpAddress { get; set; } /// <summary> /// The data involved in this Event. /// </summary> public Dictionary<string, Dictionary<string, Object>> EventData { get; set; } /// <summary> /// Gets or sets the links. /// </summary> public Dictionary<string, string> Links { get; set; } } }
using System; using System.Collections.Generic; namespace Twilio.Monitor { /// <summary> /// An Event instance resource represents a single Twilio Event. /// </summary> public class Event : TwilioBase { /// <summary> /// The unique ID for this Event. /// </summary> public string Sid { get; set; } /// <summary> /// The unique ID of the Account that owns this Event. /// </summary> public string AccountSid { get; set; } /// <summary> /// The unique ID of the actor that generated this Event. /// </summary> public string ActorSid { get; set; } /// <summary> /// The type of actor that generated this Event. /// </summary> public string ActorType { get; set; } /// <summary> /// This Event's description. /// </summary> public string Description { get; set; } /// <summary> /// The date at which this Event was generated. /// </summary> public DateTime EventDate { get; set; } /// <summary> /// The type of this Event. /// </summary> public string EventType { get; set; } /// <summary> /// The unique ID of the resource for this Event. /// </summary> public string ResourceSid { get; set; } /// <summary> /// The resource type of this Event. /// </summary> public string ResourceType { get; set; } /// <summary> /// The source of this Event. /// </summary> public string Source { get; set; } /// <summary> /// The source IP address of this Event. /// </summary> public string SourceIpAddress { get; set; } /// <summary> /// The data involved in this Event. /// </summary> public Dictionary<string, Object> EventData { get; set; } /// <summary> /// Gets or sets the links. /// </summary> public Dictionary<string, string> Links { get; set; } } }
mit
C#
e519b6f8890ecd08a207427081cbefd27b306e24
Add comment to Auth Login action describing redirect
GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet
aspnet/4-auth/Controllers/SessionController.cs
aspnet/4-auth/Controllers/SessionController.cs
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System.Web; using System.Web.Mvc; using Microsoft.Owin.Security; namespace GoogleCloudSamples.Controllers { // [START login] public class SessionController : Controller { public ActionResult Login() { // Redirect to the Google OAuth 2.0 user consent screen HttpContext.GetOwinContext().Authentication.Challenge( new AuthenticationProperties { RedirectUri = "/" }, "Google" ); return new HttpUnauthorizedResult(); } // ... // [END login] // [START logout] public ActionResult Logout() { Request.GetOwinContext().Authentication.SignOut(); return Redirect("/"); } // [END logout] } }
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System.Web; using System.Web.Mvc; using Microsoft.Owin.Security; namespace GoogleCloudSamples.Controllers { // [START login] public class SessionController : Controller { // GET: Session/Login public ActionResult Login() { HttpContext.GetOwinContext().Authentication.Challenge( new AuthenticationProperties { RedirectUri = "/" }, "Google" ); return new HttpUnauthorizedResult(); } // ... // [END login] // [START logout] // GET: Session/Logout public ActionResult Logout() { Request.GetOwinContext().Authentication.SignOut(); return Redirect("/"); } // [END logout] } }
apache-2.0
C#
fe258cc73a8500b987bef99cc76c5c968487536b
Add registration options for documentSymbol request
PowerShell/PowerShellEditorServices
src/PowerShellEditorServices.Protocol/LanguageServer/WorkspaceSymbols.cs
src/PowerShellEditorServices.Protocol/LanguageServer/WorkspaceSymbols.cs
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer { public enum SymbolKind { File = 1, Module = 2, Namespace = 3, Package = 4, Class = 5, Method = 6, Property = 7, Field = 8, Constructor = 9, Enum = 10, Interface = 11, Function = 12, Variable = 13, Constant = 14, String = 15, Number = 16, Boolean = 17, Array = 18, } public class SymbolInformation { public string Name { get; set; } public SymbolKind Kind { get; set; } public Location Location { get; set; } public string ContainerName { get; set;} } public class DocumentSymbolRequest { public static readonly RequestType<DocumentSymbolParams, SymbolInformation[], object, TextDocumentRegistrationOptions> Type = RequestType<DocumentSymbolParams, SymbolInformation[], object, TextDocumentRegistrationOptions>.Create("textDocument/documentSymbol"); } /// <summary> /// Parameters for a DocumentSymbolRequest /// </summary> public class DocumentSymbolParams { /// <summary> /// The text document. /// </summary> public TextDocumentIdentifier TextDocument { get; set; } } public class WorkspaceSymbolRequest { public static readonly RequestType<WorkspaceSymbolParams, SymbolInformation[], object, object> Type = RequestType<WorkspaceSymbolParams, SymbolInformation[], object, object>.Create("workspace/symbol"); } public class WorkspaceSymbolParams { public string Query { get; set;} } }
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer { public enum SymbolKind { File = 1, Module = 2, Namespace = 3, Package = 4, Class = 5, Method = 6, Property = 7, Field = 8, Constructor = 9, Enum = 10, Interface = 11, Function = 12, Variable = 13, Constant = 14, String = 15, Number = 16, Boolean = 17, Array = 18, } public class SymbolInformation { public string Name { get; set; } public SymbolKind Kind { get; set; } public Location Location { get; set; } public string ContainerName { get; set;} } public class DocumentSymbolRequest { public static readonly RequestType<DocumentSymbolParams, SymbolInformation[], object, object> Type = RequestType<DocumentSymbolParams, SymbolInformation[], object, object>.Create("textDocument/documentSymbol"); } /// <summary> /// Parameters for a DocumentSymbolRequest /// </summary> public class DocumentSymbolParams { /// <summary> /// The text document. /// </summary> public TextDocumentIdentifier TextDocument { get; set; } } public class WorkspaceSymbolRequest { public static readonly RequestType<WorkspaceSymbolParams, SymbolInformation[], object, object> Type = RequestType<WorkspaceSymbolParams, SymbolInformation[], object, object>.Create("workspace/symbol"); } public class WorkspaceSymbolParams { public string Query { get; set;} } }
mit
C#
380c6e4c6f0a4740b541a449efdc7993a1bdae74
Use separator when joining string attributes
JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET
SpotifyAPI/Web/Util.cs
SpotifyAPI/Web/Util.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace SpotifyAPI.Web { public static class Util { public static string GetStringAttribute<T>(this T en, String separator) where T : struct, IConvertible { Enum e = (Enum)(object)en; IEnumerable<StringAttribute> attributes = Enum.GetValues(typeof(T)) .Cast<T>() .Where(v => e.HasFlag((Enum)(object)v)) .Select(v => typeof(T).GetField(v.ToString(CultureInfo.InvariantCulture))) .Select(f => f.GetCustomAttributes(typeof(StringAttribute), false)[0]) .Cast<StringAttribute>(); List<String> list = new List<String>(); attributes.ToList().ForEach(element => list.Add(element.Text)); return string.Join(separator, list); } } public sealed class StringAttribute : Attribute { public String Text { get; set; } public StringAttribute(String text) { Text = text; } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; namespace SpotifyAPI.Web { public static class Util { public static string GetStringAttribute<T>(this T en, String separator) where T : struct, IConvertible { Enum e = (Enum)(object)en; IEnumerable<StringAttribute> attributes = Enum.GetValues(typeof(T)) .Cast<T>() .Where(v => e.HasFlag((Enum)(object)v)) .Select(v => typeof(T).GetField(v.ToString(CultureInfo.InvariantCulture))) .Select(f => f.GetCustomAttributes(typeof(StringAttribute), false)[0]) .Cast<StringAttribute>(); List<String> list = new List<String>(); attributes.ToList().ForEach(element => list.Add(element.Text)); return string.Join(" ", list); } } public sealed class StringAttribute : Attribute { public String Text { get; set; } public StringAttribute(String text) { Text = text; } } }
mit
C#
ba9dc7d0a285f97e49a25752c277fed5169bb6ef
refactor services
wangkanai/Detection
test/Services/DetectionServiceTests.cs
test/Services/DetectionServiceTests.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.Http; using Xunit; namespace Wangkanai.Detection.Services { public class UserAgentServiceTests { [Fact] public void Ctor_IServiceProvider_Success() { string userAgent = "Agent"; var context = new DefaultHttpContext(); context.Request.Headers["User-Agent"] = userAgent; var accessor = new HttpContextAccessor {HttpContext = context}; var useragentService = new UserAgentService(accessor); Assert.NotNull(useragentService.Context); Assert.NotNull(useragentService.UserAgent); Assert.Equal(userAgent, useragentService.UserAgent.ToString()); } [Fact] public void Ctor_Null_ThrowsArgumentNullException() { Assert.Throws<ArgumentNullException>(() => new UserAgentService(null)); } [Fact] public void Ctor_HttpContextAccessorNotResolved_ThrowsArgumentNullException() { Assert.Throws<ArgumentNullException>(() => new UserAgentService(new HttpContextAccessor())); } [Fact] public void Ctor_HttpContextNull_ThrowsArgumentNullException() { var accessor = new HttpContextAccessor(); Assert.Null(accessor.HttpContext); Assert.Throws<ArgumentNullException>(() => new UserAgentService(accessor)); } } }
// 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.Http; using Xunit; namespace Wangkanai.Detection.Services { public class UserAgentServiceTests { [Fact] public void Ctor_IServiceProvider_Success() { string userAgent = "Agent"; var context = new DefaultHttpContext(); context.Request.Headers["User-Agent"] = userAgent; var accessor = new HttpContextAccessor {HttpContext = context}; var useragentService = new UserAgentService(accessor); Assert.NotNull(useragentService.Context); Assert.NotNull(useragentService.UserAgent); Assert.Equal(userAgent, useragentService.UserAgent.ToString()); } [Fact] public void Ctor_Null_ThrowsArgumentNullException() { Assert.Throws<ArgumentNullException>(() => new UserAgentService(null)); } [Fact] public void Ctor_HttpContextAccessorNotResolved_ThrowsArgumentNullException() { Assert.Throws<ArgumentNullException>(() => new UserAgentService(new HttpContextAccessor())); } [Fact] public void Ctor_HttpContextNull_ThrowsArgumentNullException() { var accessor = new HttpContextAccessor(); Assert.Null(accessor.HttpContext); Assert.Throws<ArgumentNullException>(() => new UserAgentService(accessor)); } private class ServiceProvider : IServiceProvider { public IHttpContextAccessor HttpContextAccessor { get; set; } public object GetService(Type serviceType) => HttpContextAccessor; } } }
apache-2.0
C#
d6486991046a63d07fda73645e3026f276dcca8a
Fix Typo on Content History
pushrbx/squidex,Squidex/squidex,pushrbx/squidex,pushrbx/squidex,Squidex/squidex,pushrbx/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,pushrbx/squidex
src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs
src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschränkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.History; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; namespace Squidex.Domain.Apps.Entities.Contents { public sealed class ContentHistoryEventsCreator : HistoryEventsCreatorBase { public ContentHistoryEventsCreator(TypeNameRegistry typeNameRegistry) : base(typeNameRegistry) { AddEventMessage<ContentCreated>( "created {[Schema]} content item."); AddEventMessage<ContentUpdated>( "updated {[Schema]} content item."); AddEventMessage<ContentDeleted>( "deleted {[Schema]} content item."); AddEventMessage<ContentStatusChanged>( "changed status of {[Schema]} content item to {[Status]}."); } protected override Task<HistoryEventToStore> CreateEventCoreAsync(Envelope<IEvent> @event) { var channel = $"contents.{@event.Headers.AggregateId()}"; var result = ForEvent(@event.Payload, channel); if (@event.Payload is SchemaEvent schemaEvent) { result = result.AddParameter("Schema", schemaEvent.SchemaId.Name); } if (@event.Payload is ContentStatusChanged contentStatusChanged) { result = result.AddParameter("Status", contentStatusChanged.Status); } return Task.FromResult(result); } } }
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschränkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Threading.Tasks; using Squidex.Domain.Apps.Entities.History; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; namespace Squidex.Domain.Apps.Entities.Contents { public sealed class ContentHistoryEventsCreator : HistoryEventsCreatorBase { public ContentHistoryEventsCreator(TypeNameRegistry typeNameRegistry) : base(typeNameRegistry) { AddEventMessage<ContentCreated>( "created {[Schema]} content item to."); AddEventMessage<ContentUpdated>( "updated {[Schema]} content item."); AddEventMessage<ContentDeleted>( "deleted {[Schema]} content item."); AddEventMessage<ContentStatusChanged>( "changed status of {[Schema]} content item to {[Status]}."); } protected override Task<HistoryEventToStore> CreateEventCoreAsync(Envelope<IEvent> @event) { var channel = $"contents.{@event.Headers.AggregateId()}"; var result = ForEvent(@event.Payload, channel); if (@event.Payload is SchemaEvent schemaEvent) { result = result.AddParameter("Schema", schemaEvent.SchemaId.Name); } if (@event.Payload is ContentStatusChanged contentStatusChanged) { result = result.AddParameter("Status", contentStatusChanged.Status); } return Task.FromResult(result); } } }
mit
C#
4c77aed687a819e67844c9bb8e6ff6cb362e350b
Implement IPropertyDescriptorInitializer to validate properties on initializing
evicertia/HermaFx,evicertia/HermaFx,evicertia/HermaFx
HermaFx.SettingsAdapter/SettingsAttribute.cs
HermaFx.SettingsAdapter/SettingsAttribute.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; namespace HermaFx.Settings { [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)] public sealed class SettingsAttribute : Attribute, IPropertyDescriptorInitializer { public const string DEFAULT_PREFIX_SEPARATOR = ":"; /// <summary> /// Gets or sets the key prefix. /// </summary> /// <value> /// The key prefix. /// </value> public string KeyPrefix { get; } /// <summary> /// Gets or sets the prefix separator. /// </summary> /// <value> /// The prefix separator. /// </value> public string PrefixSeparator { get; set; } public SettingsAttribute() { PrefixSeparator = DEFAULT_PREFIX_SEPARATOR; } public SettingsAttribute(string keyPrefix) : this() { KeyPrefix = keyPrefix; } #region IPropertyDescriptorInitializer public int ExecutionOrder => DictionaryBehaviorAttribute.LastExecutionOrder; public void Initialize(PropertyDescriptor propertyDescriptor, object[] behaviors) { propertyDescriptor.Fetch = true; } public IDictionaryBehavior Copy() { return this; } #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HermaFx.Settings { [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)] public sealed class SettingsAttribute : Attribute { public const string DEFAULT_PREFIX_SEPARATOR = ":"; /// <summary> /// Gets or sets the key prefix. /// </summary> /// <value> /// The key prefix. /// </value> public string KeyPrefix { get; } /// <summary> /// Gets or sets the prefix separator. /// </summary> /// <value> /// The prefix separator. /// </value> public string PrefixSeparator { get; set; } public SettingsAttribute() { PrefixSeparator = DEFAULT_PREFIX_SEPARATOR; } public SettingsAttribute(string keyPrefix) : this() { KeyPrefix = keyPrefix; } } }
mit
C#
3d6dcba826f4e151db2a570f782f18bc33c8eaa0
Remove duplicates from sorted array II - Linq
Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews
LeetCode/remove_duplicates_sorted_array_2.cs
LeetCode/remove_duplicates_sorted_array_2.cs
using System; using System.Linq; using System.Collections.Generic; static class Program { static int RemoveDupes(this int[] a) { int write = 1; int read = 0; bool same = false; int count = 0; for (int i = 1; i < a.Length; i++) { read = i; if (same && a[read] == a[write]) { count++; continue; } same = a[read] == a[write]; a[write++] = a[read]; } return a.Length - count; } static int[] RemoveDupes2(this int[] v) { return v.Aggregate(new List<int>(), (a, b) => { if (a.Count(x => x == b) < 2) { a.Add(b); } return a; }).ToArray(); } static void Main() { int[] a = new int[] {1, 1, 1, 2, 2, 3, 3, 3}; int c = RemoveDupes(a); for (int i = 0; i < c; i++) { Console.Write("{0} ", a[i]); } Console.WriteLine(); foreach (int x in RemoveDupes2(a)) { Console.Write("{0} ", x); } Console.WriteLine(); } }
using System; static class Program { static int RemoveDupes(this int[] a) { int write = 1; int read = 0; bool same = false; int count = 0; for (int i = 1; i < a.Length; i++) { read = i; if (same && a[read] == a[write]) { count++; continue; } same = a[read] == a[write]; a[write++] = a[read]; } return a.Length - count; } static void Main() { int[] a = new int[] {1, 1, 1, 2, 2, 3, 3, 3}; int c = RemoveDupes(a); for (int i = 0; i < c; i++) { Console.Write("{0} ", a[i]); } Console.WriteLine(); } }
mit
C#
a372b6d897b36fa833f42590134bd41d60467d00
add http context
SignalGo/SignalGo-full-net
SignalGo.Server.Owin/OwinClientInfo.cs
SignalGo.Server.Owin/OwinClientInfo.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; #if (!NETSTANDARD) using Microsoft.Owin; #else using Microsoft.AspNetCore.Http; #endif using SignalGo.Server.Models; using SignalGo.Server.ServiceManager; namespace SignalGo.Server.Owin { public class OwinClientInfo : HttpClientInfo { public OwinClientInfo(ServerBase serverBase) : base(serverBase) { } public Action<int> ChangeStatusAction { get; set; } public override bool IsOwinClient { get { return true; } } #if (!NETSTANDARD) public IOwinContext OwinContext { get; set; } #else /// <summary> /// http context of /// </summary> public HttpContext HttpContext { get; set; } #endif public override IDictionary<string, string[]> ResponseHeaders { get; set; } public override IDictionary<string, string[]> RequestHeaders { get; set; } public override string GetRequestHeaderValue(string header) { if (!RequestHeaders.ContainsKey(header)) return null; return RequestHeaders[header].FirstOrDefault(); } public override void ChangeStatusCode(HttpStatusCode statusCode) { ChangeStatusAction?.Invoke((int)statusCode); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; #if (!NETSTANDARD) using Microsoft.Owin; #endif using SignalGo.Server.Models; using SignalGo.Server.ServiceManager; namespace SignalGo.Server.Owin { public class OwinClientInfo : HttpClientInfo { public OwinClientInfo(ServerBase serverBase) : base(serverBase) { } public Action<int> ChangeStatusAction { get; set; } public override bool IsOwinClient { get { return true; } } #if (!NETSTANDARD) public IOwinContext OwinContext { get; set; } #endif public override IDictionary<string, string[]> ResponseHeaders { get; set; } public override IDictionary<string, string[]> RequestHeaders { get; set; } public override string GetRequestHeaderValue(string header) { if (!RequestHeaders.ContainsKey(header)) return null; return RequestHeaders[header].FirstOrDefault(); } public override void ChangeStatusCode(HttpStatusCode statusCode) { ChangeStatusAction?.Invoke((int)statusCode); } } }
mit
C#
ce0854174ade23c0f60e830535409b9502f059cf
Fix ZoneMarker: replace DaemonEngineZone with DaemonZone and add missing ILanguageAspZone
ulrichb/ImplicitNullability,ulrichb/ImplicitNullability,ulrichb/ImplicitNullability
Src/ImplicitNullability.Plugin/ZoneMarker.cs
Src/ImplicitNullability.Plugin/ZoneMarker.cs
using JetBrains.Application.BuildScript.Application.Zones; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.Asp; using JetBrains.ReSharper.Psi.CSharp; namespace ImplicitNullability.Plugin { [ZoneDefinition] [ZoneDefinitionConfigurableFeature(AssemblyConsts.Title, AssemblyConsts.Description, /*IsInProductSection:*/ false)] public interface IImplicitNullabilityZone : IPsiLanguageZone, IRequire<ILanguageCSharpZone>, IRequire<DaemonZone>, IRequire<ILanguageAspZone /* for AspImplicitTypeMember */> { } [ZoneMarker] public class ZoneMarker : IRequire<IImplicitNullabilityZone> { } }
using JetBrains.Application.BuildScript.Application.Zones; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; namespace ImplicitNullability.Plugin { [ZoneDefinition] [ZoneDefinitionConfigurableFeature(AssemblyConsts.Title, AssemblyConsts.Description, /*IsInProductSection:*/ false)] public interface IImplicitNullabilityZone : IPsiLanguageZone, IRequire<ILanguageCSharpZone>, IRequire<DaemonEngineZone> { } [ZoneMarker] public class ZoneMarker : IRequire<IImplicitNullabilityZone> { } }
mit
C#
3f95c0691d42cf90b435caf0964915d1b0346c9d
set zero version
michaelschnyder/todo-sample,michaelschnyder/todo-sample,michaelschnyder/todo-sample
ToDoSample.WebApi/Properties/AssemblyInfo.cs
ToDoSample.WebApi/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("ToDoSample.WebApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyCompany("Zuehlke Technology Group")] [assembly: AssemblyProduct("ToDoSample.WebApi")] [assembly: AssemblyCopyright("Copyright © Zuehlke Technology Group 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif // 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("5abdc20e-1f95-4574-ab32-55ab64b47bdf")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyInformationalVersion("0.0.0.0+abcdef123")] [assembly: AssemblyFileVersion("0.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ToDoSample.WebApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyCompany("Zuehlke Technology Group")] [assembly: AssemblyProduct("ToDoSample.WebApi")] [assembly: AssemblyCopyright("Copyright © Zuehlke Technology Group 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif // 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("5abdc20e-1f95-4574-ab32-55ab64b47bdf")] // 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: AssemblyInformationalVersion("0.0.0.0+abcdef123")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
cc8abd5231e585212227d46f285b8854563f8a02
implement DefineButtonCxformTag writing
Alexx999/SwfSharp
SwfSharp/Tags/DefineButtonCxformTag.cs
SwfSharp/Tags/DefineButtonCxformTag.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SwfSharp.Structs; using SwfSharp.Utils; namespace SwfSharp.Tags { public class DefineButtonCxformTag : SwfTag { public ushort ButtonId { get; set; } public CXformStruct ButtonColorTransform { get; set; } public DefineButtonCxformTag(int size) : base(TagType.DefineButtonCxform, size) { } internal override void FromStream(BitReader reader, byte swfVersion) { ButtonId = reader.ReadUI16(); ButtonColorTransform = CXformStruct.CreateFromStream(reader); } internal override void ToStream(BitWriter writer, byte swfVersion) { writer.WriteUI16(ButtonId); ButtonColorTransform.ToStream(writer); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SwfSharp.Structs; using SwfSharp.Utils; namespace SwfSharp.Tags { public class DefineButtonCxformTag : SwfTag { public ushort ButtonId { get; set; } public CXformStruct ButtonColorTransform { get; set; } public DefineButtonCxformTag(int size) : base(TagType.DefineButtonCxform, size) { } internal override void FromStream(BitReader reader, byte swfVersion) { ButtonId = reader.ReadUI16(); ButtonColorTransform = CXformStruct.CreateFromStream(reader); } internal override void ToStream(BitWriter writer, byte swfVersion) { throw new NotImplementedException(); } } }
mit
C#
378202509898ba6103af2b06a1f9910a2179617a
Build config for PhysX on IOS
zmij/pg_async,zmij/tip-http,zmij/tip-http,zmij/tip-http,zmij/tip-http
Source/Awm/Awm.Build.cs
Source/Awm/Awm.Build.cs
// Copyright 2015 Mail.Ru Group. All Rights Reserved. using UnrealBuildTool; public class Awm : ModuleRules { public Awm(TargetInfo Target) { PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AIModule", "PhysX", "APEX" } ); PrivateDependencyModuleNames.AddRange(new string[] { "AwmLoadingScreen" }); // Additional plugins PrivateDependencyModuleNames.AddRange(new string[] { "VaRestPlugin" }); // iOS requires special build process if (Target.Platform == UnrealTargetPlatform.IOS) { PublicDependencyModuleNames.Remove("APEX"); PublicDependencyModuleNames.Remove("PhysX"); SetupModulePhysXAPEXSupport(Target); } } }
// Copyright 2015 Mail.Ru Group. All Rights Reserved. using UnrealBuildTool; public class Awm : ModuleRules { public Awm(TargetInfo Target) { PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AIModule" } ); PrivateDependencyModuleNames.AddRange(new string[] { "AwmLoadingScreen" }); // Additional plugins PrivateDependencyModuleNames.AddRange(new string[] { "VaRestPlugin" }); // Uncomment if you are using Slate UI // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); // Uncomment if you are using online features // PrivateDependencyModuleNames.Add("OnlineSubsystem"); // if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) // { // if (UEBuildConfiguration.bCompileSteamOSS == true) // { // DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam"); // } // } } }
artistic-2.0
C#
d2a1278e5b63a7f27fee038454cda7da5cd16169
fix typo
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Transactions/OperationMerger.cs
WalletWasabi/Transactions/OperationMerger.cs
using NBitcoin; using System; using System.Collections.Generic; using System.Linq; using System.Text; using WalletWasabi.Models; namespace WalletWasabi.Transactions { public static class OperationMerger { /// <summary> /// Merges the operations in a way that it leaves the order, but two consecutive remove or append cannot follow each other. /// </summary> public static IEnumerable<ITxStoreOperation> Merge(IEnumerable<ITxStoreOperation> operations) { var tempToAppends = new List<SmartTransaction>(); var tempToRemoves = new List<uint256>(); bool wasLastOpAppend = operations.First() is Append; foreach (ITxStoreOperation op in operations) { if (wasLastOpAppend) { if (op is Append opApp) { tempToAppends.AddRange(opApp.Transactions); } else if (op is Remove opRem) { yield return new Append(tempToAppends); tempToAppends = new List<SmartTransaction>(); tempToRemoves.AddRange(opRem.Transactions); } } else { if (op is Remove opRem) { tempToRemoves.AddRange(opRem.Transactions); } else if (op is Append opApp) { yield return new Remove(tempToRemoves); tempToRemoves = new List<uint256>(); tempToAppends.AddRange(opApp.Transactions); } } wasLastOpAppend = op is Append; } if (tempToAppends.Any()) { yield return new Append(tempToAppends); } if (tempToRemoves.Any()) { yield return new Remove(tempToRemoves); } } } }
using NBitcoin; using System; using System.Collections.Generic; using System.Linq; using System.Text; using WalletWasabi.Models; namespace WalletWasabi.Transactions { public static class OperationMerger { /// <summary> /// Merges the operations in a way that it leaves the order, but two consequtive remove or append cannot follow each other. /// </summary> public static IEnumerable<ITxStoreOperation> Merge(IEnumerable<ITxStoreOperation> operations) { var tempToAppends = new List<SmartTransaction>(); var tempToRemoves = new List<uint256>(); bool wasLastOpAppend = operations.First() is Append; foreach (ITxStoreOperation op in operations) { if (wasLastOpAppend) { if (op is Append opApp) { tempToAppends.AddRange(opApp.Transactions); } else if (op is Remove opRem) { yield return new Append(tempToAppends); tempToAppends = new List<SmartTransaction>(); tempToRemoves.AddRange(opRem.Transactions); } } else { if (op is Remove opRem) { tempToRemoves.AddRange(opRem.Transactions); } else if (op is Append opApp) { yield return new Remove(tempToRemoves); tempToRemoves = new List<uint256>(); tempToAppends.AddRange(opApp.Transactions); } } wasLastOpAppend = op is Append; } if (tempToAppends.Any()) { yield return new Append(tempToAppends); } if (tempToRemoves.Any()) { yield return new Remove(tempToRemoves); } } } }
mit
C#
0617f9062799e1504f229570418909323256ca4c
Revert accidental name change
xamarin/XamarinStripe,haithemaraissia/XamarinStripe
XamarinStripe/StripeCard.cs
XamarinStripe/StripeCard.cs
/* * Copyright 2011 - 2012 Xamarin, Inc. * * Author(s): * Gonzalo Paniagua Javier (gonzalo@xamarin.com) * Joe Dluzen (jdluzen@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using Newtonsoft.Json; namespace Xamarin.Payments.Stripe { [JsonObject (MemberSerialization.OptIn)] public class StripeCard : StripeObject { [JsonProperty (PropertyName = "type")] public string Type { get; set; } [JsonProperty (PropertyName = "country")] public string Country { get; set; } [JsonProperty (PropertyName = "exp_month")] public int ExpirationMonth { get; set; } [JsonProperty (PropertyName = "exp_year")] public int ExpirationYear { get; set; } [JsonProperty (PropertyName = "last4")] public string Last4 { get; set; } [JsonProperty (PropertyName = "cvc_check")] public StripeCvcCheck CvcCheck { get; set; } [JsonProperty (PropertyName = "address_country")] public StripeObject AddressCountry { get; set; } [JsonProperty (PropertyName = "address_state")] public StripeObject AddressState { get; set; } [JsonProperty (PropertyName = "address_zip")] public StripeObject AddressZip { get; set; } [JsonProperty (PropertyName = "address_line1")] public StripeObject AddressLine1 { get; set; } [JsonProperty (PropertyName = "address_line2")] public StripeObject AddressLine2 { get; set; } [JsonProperty (PropertyName = "address_zip_check")] public string AddressZipCheck { get; set; } [JsonProperty (PropertyName = "name")] public string Name { get; set; } [JsonProperty (PropertyName = "fingerprint")] public string Fingerprint { get; set; } } }
/* * Copyright 2011 - 2012 Xamarin, Inc. * * Author(s): * Gonzalo Paniagua Javier (gonzalo@xamarin.com) * Joe Dluzen (jdluzen@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using Newtonsoft.Json; namespace Xamarin.Payments.Stripe { [JsonObject (MemberSerialization.OptIn)] public class StripeCard : StripeObject { [JsonProperty (PropertyName = "type")] public string Type { get; set; } [JsonProperty (PropertyName = "country")] public string Country { get; set; } [JsonProperty (PropertyName = "exp_month")] public int ExpirationMonth { get; set; } [JsonProperty (PropertyName = "exp_year")] public int ExpirationYear { get; set; } [JsonProperty (PropertyName = "last4")] public string Last4 { get; set; } [JsonProperty (PropertyName = "cvc_check")] public StripeCvcCheck CvcCheck { get; set; } [JsonProperty (PropertyName = "country")] public StripeObject AddressCountry { get; set; } [JsonProperty (PropertyName = "address_state")] public StripeObject AddressState { get; set; } [JsonProperty (PropertyName = "address_zip")] public StripeObject AddressZip { get; set; } [JsonProperty (PropertyName = "address_line1")] public StripeObject AddressLine1 { get; set; } [JsonProperty (PropertyName = "address_line2")] public StripeObject AddressLine2 { get; set; } [JsonProperty (PropertyName = "address_zip_check")] public string AddressZipCheck { get; set; } [JsonProperty (PropertyName = "name")] public string Name { get; set; } [JsonProperty (PropertyName = "fingerprint")] public string Fingerprint { get; set; } } }
apache-2.0
C#
38f74b32505ee021a02d0fa0df0fbf04f0fda9bc
Update OSTests.cs
StefanoRaggi/Lean,jameschch/Lean,StefanoRaggi/Lean,redmeros/Lean,JKarathiya/Lean,redmeros/Lean,StefanoRaggi/Lean,QuantConnect/Lean,StefanoRaggi/Lean,JKarathiya/Lean,kaffeebrauer/Lean,Jay-Jay-D/LeanSTP,Jay-Jay-D/LeanSTP,AlexCatarino/Lean,kaffeebrauer/Lean,jameschch/Lean,kaffeebrauer/Lean,Jay-Jay-D/LeanSTP,AlexCatarino/Lean,QuantConnect/Lean,AlexCatarino/Lean,Jay-Jay-D/LeanSTP,redmeros/Lean,AnshulYADAV007/Lean,StefanoRaggi/Lean,kaffeebrauer/Lean,JKarathiya/Lean,kaffeebrauer/Lean,AlexCatarino/Lean,jameschch/Lean,AnshulYADAV007/Lean,jameschch/Lean,AnshulYADAV007/Lean,AnshulYADAV007/Lean,QuantConnect/Lean,jameschch/Lean,redmeros/Lean,QuantConnect/Lean,Jay-Jay-D/LeanSTP,JKarathiya/Lean,AnshulYADAV007/Lean
Tests/Common/OSTests.cs
Tests/Common/OSTests.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using NUnit.Framework; namespace QuantConnect.Tests.Common { [TestFixture] public class OSTests { [Test] public void GetServerStatisticsDoesntThrow() { var serverStatistics = OS.GetServerStatistics(); //var maxKeyLength = serverStatistics.Keys.Max(x => x.Length); //foreach (var statistic in serverStatistics) //{ // Console.WriteLine("{0, -" + maxKeyLength + "} - {1}", statistic.Key, statistic.Value); //} } [Test] public void GetDriveCorrectly() { var expectedDrive = Path.GetPathRoot(Assembly.GetAssembly(GetType()).Location); var expectedDriveInfo = new DriveInfo(expectedDrive); var totalSizeInMegaBytes = (int)(expectedDriveInfo.TotalSize / (1024 * 1024)); Assert.AreEqual(totalSizeInMegaBytes, OS.DriveTotalSpace); } } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using NUnit.Framework; namespace QuantConnect.Tests.Common { [TestFixture] public class OSTests { [Test] public void GetServerStatisticsDoesntThrow() { var serverStatistics = OS.GetServerStatistics(); //var maxKeyLength = serverStatistics.Keys.Max(x => x.Length); //foreach (var statistic in serverStatistics) //{ // Console.WriteLine("{0, -" + maxKeyLength + "} - {1}", statistic.Key, statistic.Value); //} } } }
apache-2.0
C#
eb70ae788c9e037edca47f767265621d2af5b80e
Store max combo in ScoreProcessor.
UselessToucan/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,Frontear/osuKyzer,ppy/osu,ppy/osu,nyaamara/osu,theguii/osu,Nabile-Rahmani/osu,peppy/osu,Drezi126/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,DrabWeb/osu,naoey/osu,smoogipoo/osu,johnneijzen/osu,johnneijzen/osu,2yangk23/osu,osu-RP/osu-RP,EVAST9919/osu,naoey/osu,RedNesto/osu,naoey/osu,DrabWeb/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,Damnae/osu,NotKyon/lolisu,peppy/osu,smoogipooo/osu,DrabWeb/osu,ZLima12/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,tacchinotacchi/osu,smoogipoo/osu,default0/osu
osu.Game/Modes/ScoreProcesssor.cs
osu.Game/Modes/ScoreProcesssor.cs
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using osu.Framework.Configuration; using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes { public class ScoreProcessor { public virtual Score GetScore() => new Score(); public BindableDouble TotalScore = new BindableDouble { MinValue = 0 }; public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 }; public BindableInt Combo = new BindableInt(); public BindableInt MaximumCombo = new BindableInt(); public List<JudgementInfo> Judgements = new List<JudgementInfo>(); public virtual void AddJudgement(JudgementInfo judgement) { Judgements.Add(judgement); UpdateCalculations(); judgement.ComboAtHit = (ulong)Combo.Value; if (Combo.Value > MaximumCombo.Value) MaximumCombo.Value = Combo.Value; } /// <summary> /// Update any values that potentially need post-processing on a judgement change. /// </summary> protected virtual void UpdateCalculations() { } } }
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using osu.Framework.Configuration; using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes { public class ScoreProcessor { public virtual Score GetScore() => new Score(); public BindableDouble TotalScore = new BindableDouble { MinValue = 0 }; public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 }; public BindableInt Combo = new BindableInt(); public List<JudgementInfo> Judgements = new List<JudgementInfo>(); public virtual void AddJudgement(JudgementInfo judgement) { Judgements.Add(judgement); UpdateCalculations(); judgement.ComboAtHit = (ulong)Combo.Value; } /// <summary> /// Update any values that potentially need post-processing on a judgement change. /// </summary> protected virtual void UpdateCalculations() { } } }
mit
C#
048c832afb8e002bca548d08d86f32a5eb5f25c9
Fix rotation on 0x60 0x43 step 1 attack packet
HelloKitty/Booma.Proxy
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60PlayerAttackStepOneCommand.cs
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60PlayerAttackStepOneCommand.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { //https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x43 [WireDataContract] [SubCommand60(SubCommand60OperationCode.AttackStepOne)] public sealed class Sub60PlayerAttackStepOneCommand : BaseSubCommand60, IMessageContextIdentifiable, ISerializationEventListener { /// <inheritdoc /> [WireMember(1)] public byte Identifier { get; } //Unknown 1 byte always follows id [WireMember(2)] private byte unk1 { get; } //TODO: The calculation we're doing to init or parse this is wrong. It does not match the binary packet //TODO: We must figure out how to exactly compute this value, test cases show off by 1 bit. /// <summary> /// The raw rotation value /// that is sent over the network. /// </summary> [WireMember(3)] private short RawNetworkRotation { get; set; } /// <summary> /// The rotation about the Y-axis. /// </summary> public float YAxisRotation { get; private set; } //TODO: Is this anything but padding? [WireMember(4)] private short unk2 { get; } /// <inheritdoc /> public Sub60PlayerAttackStepOneCommand(byte identifier, float yAxisRotation) : this() { Identifier = identifier; YAxisRotation = yAxisRotation; } //Serializer ctor private Sub60PlayerAttackStepOneCommand() { CommandSize = 8 / 4; } //The below serialization event callbacks will properly handle the network rotation //conversion /// <inheritdoc /> public void OnBeforeSerialization() { RawNetworkRotation = (short)(YAxisRotation * 180f); } /// <inheritdoc /> public void OnAfterDeserialization() { YAxisRotation = RawNetworkRotation / 180f; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { //https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x43 [WireDataContract] [SubCommand60(SubCommand60OperationCode.AttackStepOne)] public sealed class Sub60PlayerAttackStepOneCommand : BaseSubCommand60, IMessageContextIdentifiable { /// <inheritdoc /> [WireMember(1)] public byte Identifier { get; } //Unknown 1 byte always follows id [WireMember(2)] private byte unk1 { get; } //TODO: The calculation we're doing to init or parse this is wrong. It does not match the binary packet //TODO: We must figure out how to exactly compute this value, test cases show off by 1 bit. /// <summary> /// The raw rotation value /// that is sent over the network. /// </summary> [WireMember(3)] private short RawNetworkRotation { get; set; } /// <summary> /// The rotation about the Y-axis. /// </summary> public float YAxisRotation { get; private set; } //TODO: Is this anything but padding? [WireMember(4)] private short unk2 { get; } /// <inheritdoc /> public Sub60PlayerAttackStepOneCommand(byte identifier, float yAxisRotation) : this() { Identifier = identifier; YAxisRotation = yAxisRotation; } //Serializer ctor private Sub60PlayerAttackStepOneCommand() { CommandSize = 8 / 4; } //The below serialization event callbacks will properly handle the network rotation //conversion /// <inheritdoc /> public void OnBeforeSerialization() { RawNetworkRotation = (short)(YAxisRotation * 180f); } /// <inheritdoc /> public void OnAfterDeserialization() { YAxisRotation = RawNetworkRotation / 180f; } } }
agpl-3.0
C#
af95e2143f2289e9a3167b921c6b06840f5344e9
remove user agent string
dkackman/Sunlight.Net
SunlightAPI/SunlightService.cs
SunlightAPI/SunlightService.cs
using System.Linq; using System.Collections.Generic; using System.Text; using System.Net; using System.Threading.Tasks; using System.Diagnostics; using PortableRest; namespace SunlightAPI { class SunlightService { string _root; string apikey_param; public SunlightService(string root, string api_key) { _root = root; apikey_param = "&apikey=" + api_key; } public async Task<T> Get<T>(string endPoint, IDictionary<string, object> parms) where T : class { Debug.Assert(parms != null); var client = new RestClient(); client.BaseUrl = _root; string resource = FormatResource(endPoint, parms); Debug.WriteLine(resource); var request = new RestRequest(resource); return await client.ExecuteAsync<T>(request); } /// <summary> /// I cannot get the PortableRest client to put the parameters on the url so we'll do it ourselves /// </summary> /// <param name="endPoint"></param> /// <param name="parms"></param> /// <returns></returns> private string FormatResource(string endPoint, IDictionary<string, object> parms) { if (parms.Count == 0) return ""; // ignore and params where the value is null var nonNulls = parms.Where(kvp => kvp.Value != null); // format the first param without an & StringBuilder builder = new StringBuilder(endPoint + "?"); var first = nonNulls.First(); builder.AppendFormat("{0}={1}", WebUtility.UrlEncode(first.Key), WebUtility.UrlEncode(first.Value.ToString())); // now append all subsequent params with an & foreach (var kvp in nonNulls.Skip(1)) builder.AppendFormat("&{0}={1}", WebUtility.UrlEncode(kvp.Key), WebUtility.UrlEncode(kvp.Value.ToString())); // add our api key builder.Append(apikey_param); return builder.ToString(); } } }
using System.Linq; using System.Collections.Generic; using System.Text; using System.Net; using System.Threading.Tasks; using System.Diagnostics; using PortableRest; namespace SunlightAPI { class SunlightService { string _root; string apikey_param; public SunlightService(string root, string api_key) { _root = root; apikey_param = "&apikey=" + api_key; } public async Task<T> Get<T>(string endPoint, IDictionary<string, object> parms) where T : class { Debug.Assert(parms != null); var client = new RestClient(); client.BaseUrl = _root; client.UserAgent = "Sunlight client for Windows Phone 8 (v0.01)"; string resource = FormatResource(endPoint, parms); Debug.WriteLine(resource); var request = new RestRequest(resource); return await client.ExecuteAsync<T>(request); } /// <summary> /// I cannot get the PortableRest client to put the parameters on the url so we'll do it ourselves /// </summary> /// <param name="endPoint"></param> /// <param name="parms"></param> /// <returns></returns> private string FormatResource(string endPoint, IDictionary<string, object> parms) { if (parms.Count == 0) return ""; // ignore and params where the value is null var nonNulls = parms.Where(kvp => kvp.Value != null); // format the first param without an & StringBuilder builder = new StringBuilder(endPoint + "?"); var first = nonNulls.First(); builder.AppendFormat("{0}={1}", WebUtility.UrlEncode(first.Key), WebUtility.UrlEncode(first.Value.ToString())); // now append all subsequent params with an & foreach (var kvp in nonNulls.Skip(1)) builder.AppendFormat("&{0}={1}", WebUtility.UrlEncode(kvp.Key), WebUtility.UrlEncode(kvp.Value.ToString())); // add our api key builder.Append(apikey_param); return builder.ToString(); } } }
mit
C#
b8155af8d4b1ba452f481e02866933b509d44e4b
Update ResultStatus.cs
zoosk/testrail-client
TestRail/Types/ResultStatus.cs
TestRail/Types/ResultStatus.cs
namespace TestRail.Types { /// <summary>the enumeration represents the status of a test result</summary> public enum ResultStatus { /// <summary>the test has not been run</summary> Untested = 3, /// <summary>the test passed</summary> Passed = 1, /// <summary>the test is blocked</summary> Blocked = 2, /// <summary>the test needs to be rerun</summary> Retest = 4, /// <summary>the test failed</summary> Failed = 5, /// <summary>custom status 1</summary> CustomStatus1 = 6, /// <summary>custom status 2</summary> CustomStatus2 = 7, /// <summary>custom status 3</summary> CustomStatus3 = 8, /// <summary>custom status 4</summary> CustomStatus4 = 9, /// <summary>custom status 5</summary> CustomStatus5 = 10, /// <summary>custom status 6</summary> CustomStatus6 = 11, /// <summary>custom status 7</summary> CustomStatus7 = 12, } /// <summary>extension methods for the status enum</summary> public static class ResultStatusExtensions { /// <summary>gets the value of the enum as a string</summary> /// <param name="s">the status</param> /// <returns>the value of the status enum as a string</returns> public static string ValueAsString(this ResultStatus s) { return ((int)s).ToString(); } } }
namespace TestRail.Types { /// <summary>the enumeration represents the status of a test result</summary> public enum ResultStatus { /// <summary>the test has not been run</summary> Untested = 0, /// <summary>the test passed</summary> Passed = 1, /// <summary>the test is blocked</summary> Blocked = 2, /// <summary>the test needs to be rerun</summary> Retest = 4, /// <summary>the test failed</summary> Failed = 5, /// <summary>custom status 1</summary> CustomStatus1 = 6, /// <summary>custom status 2</summary> CustomStatus2 = 7, /// <summary>custom status 3</summary> CustomStatus3 = 8, /// <summary>custom status 4</summary> CustomStatus4 = 9, /// <summary>custom status 5</summary> CustomStatus5 = 10, /// <summary>custom status 6</summary> CustomStatus6 = 11, /// <summary>custom status 7</summary> CustomStatus7 = 12, } /// <summary>extension methods for the status enum</summary> public static class ResultStatusExtensions { /// <summary>gets the value of the enum as a string</summary> /// <param name="s">the status</param> /// <returns>the value of the status enum as a string</returns> public static string ValueAsString(this ResultStatus s) { return ((int)s).ToString(); } } }
apache-2.0
C#
9486712f5670267080778ffa389cb70e2e5ca6ef
Write the test for the reset behavior.
ocoanet/moq4,breyed/moq4,LeonidLevin/moq4,kulkarnisachin07/moq4,Moq/moq4,kolomanschaft/moq4,madcapsoftware/moq4,JohanLarsson/moq4,AhmedAssaf/moq4,AhmedAssaf/moq4,HelloKitty/moq4,RobSiklos/moq4,jeremymeng/moq4,ramanraghur/moq4,cgourlay/moq4,iskiselev/moq4,chkpnt/moq4
UnitTests/OccurrenceFixture.cs
UnitTests/OccurrenceFixture.cs
using System; using Xunit; namespace Moq.Tests { public class OccurrenceFixture { [Fact] public void OnceDoesNotThrowOnSecondCallIfCountWasResetBefore() { var mock = new Mock<IFoo>(); mock.Setup(foo => foo.Execute("ping")) .Returns("ack") .AtMostOnce(); Assert.Equal("ack", mock.Object.Execute("ping")); mock.ResetCallCounts(o => o.Execute("ping")); MockException mex = Assert.DoesNotThrow<MockException>(() => mock.Object.Execute("ping")); Assert.Equal(MockException.ExceptionReason.MoreThanOneCall, mex.Reason); } [Fact] [Obsolete] public void OnceThrowsOnSecondCall() { var mock = new Mock<IFoo>(); mock.Setup(foo => foo.Execute("ping")) .Returns("ack") .AtMostOnce(); Assert.Equal("ack", mock.Object.Execute("ping")); MockException mex = Assert.Throws<MockException>(() => mock.Object.Execute("ping")); Assert.Equal(MockException.ExceptionReason.MoreThanOneCall, mex.Reason); } [Fact] [Obsolete] public void RepeatThrowsOnNPlusOneCall() { var repeat = 5; var mock = new Mock<IFoo>(); mock.Setup(foo => foo.Execute("ping")) .Returns("ack") .AtMost(5); var calls = 0; MockException mex = Assert.Throws<MockException>(() => { while (calls <= repeat + 1) { mock.Object.Execute("ping"); calls++; } Assert.True(false, "should fail on two calls"); }); Assert.Equal(MockException.ExceptionReason.MoreThanNCalls, mex.Reason); Assert.Equal(calls, repeat); } public interface IFoo { int Value { get; set; } int Echo(int value); void Submit(); string Execute(string command); } } }
using System; using Xunit; namespace Moq.Tests { public class OccurrenceFixture { [Fact] [Obsolete] public void OnceThrowsOnSecondCall() { var mock = new Mock<IFoo>(); mock.Setup(foo => foo.Execute("ping")) .Returns("ack") .AtMostOnce(); Assert.Equal("ack", mock.Object.Execute("ping")); MockException mex = Assert.Throws<MockException>(() => mock.Object.Execute("ping")); Assert.Equal(MockException.ExceptionReason.MoreThanOneCall, mex.Reason); } [Fact] [Obsolete] public void RepeatThrowsOnNPlusOneCall() { var repeat = 5; var mock = new Mock<IFoo>(); mock.Setup(foo => foo.Execute("ping")) .Returns("ack") .AtMost(5); var calls = 0; MockException mex = Assert.Throws<MockException>(() => { while (calls <= repeat + 1) { mock.Object.Execute("ping"); calls++; } Assert.True(false, "should fail on two calls"); }); Assert.Equal(MockException.ExceptionReason.MoreThanNCalls, mex.Reason); Assert.Equal(calls, repeat); } public interface IFoo { int Value { get; set; } int Echo(int value); void Submit(); string Execute(string command); } } }
bsd-3-clause
C#
286066b2886e4b2c16dc01ba1dbf27efc88bacff
teste 45
gsmgabriela/Vai-Fundos
VaiFundos/VaiFundos/Program.cs
VaiFundos/VaiFundos/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VaiFundos { class Program { static void Main(string[] args) { //Olá Mundo! //OLA HALANA SAÌ DAQUI!!! //Vai fi! // vam bora !!! } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VaiFundos { class Program { static void Main(string[] args) { //Olá Mundo! //OLA HALANA SAÌ DAQUI!!! //Vai fi! } } }
mit
C#
7b9ebe63e8076e4c4008181dd0d2f465e783650b
Fix comment.
MichalStrehovsky/roslyn,agocke/roslyn,gafter/roslyn,MichalStrehovsky/roslyn,abock/roslyn,weltkante/roslyn,heejaechang/roslyn,tannergooding/roslyn,brettfo/roslyn,physhi/roslyn,nguerrera/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,abock/roslyn,sharwell/roslyn,tmat/roslyn,MichalStrehovsky/roslyn,KirillOsenkov/roslyn,tmat/roslyn,reaction1989/roslyn,jmarolf/roslyn,agocke/roslyn,VSadov/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,genlu/roslyn,bartdesmet/roslyn,physhi/roslyn,KevinRansom/roslyn,diryboy/roslyn,aelij/roslyn,ErikSchierboom/roslyn,davkean/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,eriawan/roslyn,abock/roslyn,swaroop-sridhar/roslyn,wvdd007/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,reaction1989/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,tannergooding/roslyn,brettfo/roslyn,aelij/roslyn,sharwell/roslyn,genlu/roslyn,aelij/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,davkean/roslyn,panopticoncentral/roslyn,gafter/roslyn,KevinRansom/roslyn,sharwell/roslyn,gafter/roslyn,heejaechang/roslyn,VSadov/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,eriawan/roslyn,agocke/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,weltkante/roslyn,reaction1989/roslyn,bartdesmet/roslyn,jmarolf/roslyn,stephentoub/roslyn,VSadov/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,davkean/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,wvdd007/roslyn,dotnet/roslyn,tannergooding/roslyn,nguerrera/roslyn,swaroop-sridhar/roslyn,jasonmalinowski/roslyn,physhi/roslyn,jmarolf/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,brettfo/roslyn,swaroop-sridhar/roslyn,mgoertz-msft/roslyn
src/Features/Core/Portable/EmbeddedLanguages/IEmbeddedLanguageFeatures.cs
src/Features/Core/Portable/EmbeddedLanguages/IEmbeddedLanguageFeatures.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.DocumentHighlighting; using Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices; namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages { /// <summary> /// Services related to a specific embedded language. /// </summary> internal interface IEmbeddedLanguageFeatures : IEmbeddedLanguage { /// <summary> /// A optional highlighter that can highlight spans for an embedded language string. /// </summary> IDocumentHighlightsService DocumentHighlightsService { get; } /// <summary> /// An optional analyzer that produces diagnostics for an embedded language string. /// </summary> AbstractBuiltInCodeStyleDiagnosticAnalyzer DiagnosticAnalyzer { get; } /// <summary> /// An optional completion provider that can provide completion items. /// </summary> CompletionProvider CompletionProvider { get; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.DocumentHighlighting; using Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices; namespace Microsoft.CodeAnalysis.Features.EmbeddedLanguages { /// <summary> /// Services related to a specific embedded language. /// </summary> internal interface IEmbeddedLanguageFeatures : IEmbeddedLanguage { /// <summary> /// A optional highlighter that can highlight spans for an embedded language string. /// </summary> IDocumentHighlightsService DocumentHighlightsService { get; } /// <summary> /// An optional analyzer that produces diagnostics for an embedded language string. /// </summary> AbstractBuiltInCodeStyleDiagnosticAnalyzer DiagnosticAnalyzer { get; } /// <summary> /// An optional completion provider that can provider completion items. /// </summary> CompletionProvider CompletionProvider { get; } } }
mit
C#
1d30525e2288bc3df89e6a41ff904d5ef1d41f00
Update UserRepository.cs
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/UserRepository.cs
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/UserRepository.cs
using System; using System.Data; using System.Threading.Tasks; using Dapper; using SFA.DAS.EAS.Domain.Data.Repositories; using SFA.DAS.EAS.Domain.Models.UserProfile; namespace SFA.DAS.EAS.Infrastructure.Data { public class UserRepository : IUserRepository { private readonly Lazy<EmployerAccountsDbContext> _db; public UserRepository(Lazy<EmployerAccountsDbContext> db) { _db = db; } public Task Upsert(User user) { var parameters = new DynamicParameters(); parameters.Add("@email", user.Email, DbType.String); parameters.Add("@userRef", new Guid(user.UserRef), DbType.Guid); parameters.Add("@firstName", user.FirstName, DbType.String); parameters.Add("@lastName", user.LastName, DbType.String); parameters.Add("@correlationId", null, DbType.String); return _db.Value.Database.Connection.ExecuteAsync( sql: "[employer_account].[UpsertUser] @userRef, @email, @firstName, @lastName, @correlationId", param: parameters, commandType: CommandType.Text, transaction: _db.Value.Database.CurrentTransaction.UnderlyingTransaction); } } }
using System; using System.Data; using System.Threading.Tasks; using Dapper; using SFA.DAS.EAS.Domain.Data.Repositories; using SFA.DAS.EAS.Domain.Models.UserProfile; namespace SFA.DAS.EAS.Infrastructure.Data { public class UserRepository : IUserRepository { private readonly Lazy<EmployerAccountsDbContext> _db; public UserRepository(Lazy<EmployerAccountsDbContext> db) { _db = db; } public Task Upsert(User user) { var parameters = new DynamicParameters(); parameters.Add("@email", user.Email, DbType.String); parameters.Add("@userRef", new Guid(user.UserRef), DbType.Guid); parameters.Add("@firstName", user.FirstName, DbType.String); parameters.Add("@lastName", user.LastName, DbType.String); parameters.Add("@correlationId", null, DbType.String); return _db.Value.Database.Connection.ExecuteAsync( sql: "[employer_account].[UpsertUser] @userRef, @email, @firstName, @lastName, @correlationId", param: parameters, commandType: CommandType.Text); } } }
mit
C#
6e21d33999b493783a68500cabbffdefa7c986ab
Update events.cs
AntiTcb/Discord.Net,Confruggy/Discord.Net,RogueException/Discord.Net
docs/guides/concepts/samples/events.cs
docs/guides/concepts/samples/events.cs
using Discord; using Discord.WebSocket; public class Program { private DiscordSocketClient _client; static void Main(string[] args) => new Program().MainAsync().GetAwaiter().GetResult(); public async Task MainAsync() { // When working with events that have Cacheable<IMessage, ulong> parameters, // you must enable the message cache in your config settings if you plan to // use the cached message entity. var _config = new DiscordSocketConfig { MessageCacheSize = 100 }; _client = new DiscordSocketClient(_config); await _client.LoginAsync(TokenType.Bot, "bot token"); await _client.StartAsync(); _client.MessageUpdated += MessageUpdated; _client.Ready += () => { Console.WriteLine("Bot is connected!"); return Task.CompletedTask; } await Task.Delay(-1); } private async Task MessageUpdated(Cacheable<IMessage, ulong> before, SocketMessage after, ISocketMessageChannel channel) { // If the message was not in the cache, downloading it will result in getting a copy of `after`. var message = await before.GetOrDownloadAsync(); Console.WriteLine($"{message} -> {after}"); } }
using Discord; using Discord.WebSocket; public class Program { private DiscordSocketClient _client; static void Main(string[] args) => new Program().MainAsync().GetAwaiter().GetResult(); public async Task MainAsync() { // When working with events that have Cacheable<IMessage, ulong> parameters, // you must enable the message cache in your config settings if you plan to // use the cached message entity. _config = new DiscordSocketConfig { MessageCacheSize = 100 }; _client = new DiscordSocketClient(_config); await _client.LoginAsync(TokenType.Bot, "bot token"); await _client.StartAsync(); _client.MessageUpdated += MessageUpdated; _client.Ready += () => { Console.WriteLine("Bot is connected!"); return Task.CompletedTask; } await Task.Delay(-1); } private async Task MessageUpdated(Cacheable<IMessage, ulong> before, SocketMessage after, ISocketMessageChannel channel) { // If the message was not in the cache, downloading it will result in getting a copy of `after`. var message = await before.GetOrDownloadAsync(); Console.WriteLine($"{message} -> {after}"); } }
mit
C#
de4f639a14f1646260a97c71e74aa211a19dbf13
Fix error in control not null not reporting result type error
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade/Core/Addml/Processes/ControlNotNull.cs
src/Arkivverket.Arkade/Core/Addml/Processes/ControlNotNull.cs
using System.Collections.Generic; using Arkivverket.Arkade.Core.Addml.Definitions; using Arkivverket.Arkade.Resources; using Arkivverket.Arkade.Tests; using Arkivverket.Arkade.Util; namespace Arkivverket.Arkade.Core.Addml.Processes { public class ControlNotNull : AddmlProcess { private readonly TestId _id = new TestId(TestId.TestKind.Addml, 20); public const string Name = "Control_NotNull"; private readonly HashSet<FieldIndex> _containsNullValues = new HashSet<FieldIndex>(); private readonly List<TestResult> _testResults = new List<TestResult>(); public override TestId GetId() { return _id; } public override string GetName() { return Name; } public override string GetDescription() { return Messages.ControlNotNullDescription; } public override TestType GetTestType() { return TestType.ContentControl; } protected override List<TestResult> GetTestResults() { return _testResults; } protected override void DoRun(FlatFile flatFile) { } protected override void DoRun(Record record) { } protected override void DoEndOfFile() { foreach (FieldIndex index in _containsNullValues) { _testResults.Add(new TestResult(ResultType.Error, AddmlLocation.FromFieldIndex(index), string.Format(Messages.ControlNotNullMessage))); } _containsNullValues.Clear(); } protected override void DoRun(Field field) { FieldIndex index = field.Definition.GetIndex(); if (_containsNullValues.Contains(index)) { // We have already found a null value, just return return; } string value = field.Value; bool isNull = field.Definition.Type.IsNull(value); if (isNull) { _containsNullValues.Add(index); } } } }
using System.Collections.Generic; using Arkivverket.Arkade.Core.Addml.Definitions; using Arkivverket.Arkade.Resources; using Arkivverket.Arkade.Tests; using Arkivverket.Arkade.Util; namespace Arkivverket.Arkade.Core.Addml.Processes { public class ControlNotNull : AddmlProcess { private readonly TestId _id = new TestId(TestId.TestKind.Addml, 20); public const string Name = "Control_NotNull"; private readonly HashSet<FieldIndex> _containsNullValues = new HashSet<FieldIndex>(); private readonly List<TestResult> _testResults = new List<TestResult>(); public override TestId GetId() { return _id; } public override string GetName() { return Name; } public override string GetDescription() { return Messages.ControlNotNullDescription; } public override TestType GetTestType() { return TestType.ContentControl; } protected override List<TestResult> GetTestResults() { return _testResults; } protected override void DoRun(FlatFile flatFile) { } protected override void DoRun(Record record) { } protected override void DoEndOfFile() { foreach (FieldIndex index in _containsNullValues) { _testResults.Add(new TestResult(ResultType.Success, AddmlLocation.FromFieldIndex(index), string.Format(Messages.ControlNotNullMessage))); } _containsNullValues.Clear(); } protected override void DoRun(Field field) { FieldIndex index = field.Definition.GetIndex(); if (_containsNullValues.Contains(index)) { // We have already found a null value, just return return; } string value = field.Value; bool isNull = field.Definition.Type.IsNull(value); if (isNull) { _containsNullValues.Add(index); } } } }
agpl-3.0
C#
517f6b7b2eba6989e39a29eb1ec72a8ab673434d
Add a comment.
TTExtensions/MouseClickSimulator
TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/FishingSpotFlavor.cs
TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/FishingSpotFlavor.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TTMouseclickSimulator.Core.Environment; namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing { public enum FishingSpotFlavor : int { PunchlinePlace = 0, LighthouseLane, // Halloween flavors PunchlinePlaceHalloween = 100 } public class FishingSpotFlavorData { // TODO: We should allow the XML project file to specify these parameters so they // don't need to be hard-coded in the source code. That way users could add other fishing // places using the XML project file. private static readonly Dictionary<FishingSpotFlavor, FishingSpotFlavorData> elements = new Dictionary<FishingSpotFlavor, FishingSpotFlavorData>(); static FishingSpotFlavorData() { elements.Add(FishingSpotFlavor.PunchlinePlace, new FishingSpotFlavorData(new Coordinates(260, 196), new Coordinates(1349, 626), new ScreenshotColor(22, 140, 116), 13)); elements.Add(FishingSpotFlavor.LighthouseLane, new FishingSpotFlavorData(new Coordinates(187, 170 - 19), new Coordinates(187 + 1241, 170 - 19 + 577), new ScreenshotColor(38, 81, 135), new AbstractFishingRodAction.Tolerance(7, 15, 6))); elements.Add(FishingSpotFlavor.PunchlinePlaceHalloween, new FishingSpotFlavorData(new Coordinates(260, 196), new Coordinates(1349, 626), new ScreenshotColor(10, 76, 76), 8)); } public static FishingSpotFlavorData GetDataFromItem(FishingSpotFlavor item) { return elements[item]; } public Coordinates Scan1 { get; } public Coordinates Scan2 { get; } public ScreenshotColor BubbleColor { get; } public AbstractFishingRodAction.Tolerance Tolerance { get; } public FishingSpotFlavorData(Coordinates scan1, Coordinates scan2, ScreenshotColor bubbleColor, AbstractFishingRodAction.Tolerance tolerance) { this.Scan1 = scan1; this.Scan2 = scan2; this.BubbleColor = bubbleColor; this.Tolerance = tolerance; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TTMouseclickSimulator.Core.Environment; namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing { public enum FishingSpotFlavor : int { PunchlinePlace = 0, LighthouseLane, // Halloween flavors PunchlinePlaceHalloween = 100 } public class FishingSpotFlavorData { private static readonly Dictionary<FishingSpotFlavor, FishingSpotFlavorData> elements = new Dictionary<FishingSpotFlavor, FishingSpotFlavorData>(); static FishingSpotFlavorData() { elements.Add(FishingSpotFlavor.PunchlinePlace, new FishingSpotFlavorData(new Coordinates(260, 196), new Coordinates(1349, 626), new ScreenshotColor(22, 140, 116), 13)); elements.Add(FishingSpotFlavor.LighthouseLane, new FishingSpotFlavorData(new Coordinates(187, 170 - 19), new Coordinates(187 + 1241, 170 - 19 + 577), new ScreenshotColor(38, 81, 135), new AbstractFishingRodAction.Tolerance(7, 15, 6))); elements.Add(FishingSpotFlavor.PunchlinePlaceHalloween, new FishingSpotFlavorData(new Coordinates(260, 196), new Coordinates(1349, 626), new ScreenshotColor(10, 76, 76), 8)); } public static FishingSpotFlavorData GetDataFromItem(FishingSpotFlavor item) { return elements[item]; } public Coordinates Scan1 { get; } public Coordinates Scan2 { get; } public ScreenshotColor BubbleColor { get; } public AbstractFishingRodAction.Tolerance Tolerance { get; } public FishingSpotFlavorData(Coordinates scan1, Coordinates scan2, ScreenshotColor bubbleColor, AbstractFishingRodAction.Tolerance tolerance) { this.Scan1 = scan1; this.Scan2 = scan2; this.BubbleColor = bubbleColor; this.Tolerance = tolerance; } } }
mit
C#
b5ef7dc953441261cd893f3fa2cf8f3f228a2473
Include top left encoded targa in benchmark
nickbabcock/Pfim,nickbabcock/Pfim
src/Pfim.Benchmarks/TargaBenchmark.cs
src/Pfim.Benchmarks/TargaBenchmark.cs
using System.IO; using BenchmarkDotNet.Attributes; using FreeImageAPI; using ImageMagick; using DS = DevILSharp; namespace Pfim.Benchmarks { public class TargaBenchmark { [Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga", "rgb24_top_left")] public string Payload { get; set; } private byte[] data; [GlobalSetup] public void SetupData() { data = File.ReadAllBytes(Payload); DS.Bootstrap.Init(); } [Benchmark] public IImage Pfim() => Targa.Create(new MemoryStream(data)); [Benchmark] public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data)); [Benchmark] public int ImageMagick() { var settings = new MagickReadSettings {Format = MagickFormat.Tga}; using (var image = new MagickImage(new MemoryStream(data), settings)) { return image.Width; } } [Benchmark] public int DevILSharp() { using (var image = DS.Image.Load(data, DS.ImageType.Tga)) { return image.Width; } } [Benchmark] public int TargaImage() { using (var image = new Paloma.TargaImage(new MemoryStream(data))) { return image.Stride; } } } }
using System.IO; using BenchmarkDotNet.Attributes; using FreeImageAPI; using ImageMagick; using DS = DevILSharp; namespace Pfim.Benchmarks { public class TargaBenchmark { [Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga")] public string Payload { get; set; } private byte[] data; [GlobalSetup] public void SetupData() { data = File.ReadAllBytes(Payload); DS.Bootstrap.Init(); } [Benchmark] public IImage Pfim() => Targa.Create(new MemoryStream(data)); [Benchmark] public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data)); [Benchmark] public int ImageMagick() { var settings = new MagickReadSettings {Format = MagickFormat.Tga}; using (var image = new MagickImage(new MemoryStream(data), settings)) { return image.Width; } } [Benchmark] public int DevILSharp() { using (var image = DS.Image.Load(data, DS.ImageType.Tga)) { return image.Width; } } [Benchmark] public int TargaImage() { using (var image = new Paloma.TargaImage(new MemoryStream(data))) { return image.Stride; } } } }
mit
C#
a7f914b7df81cc3a41a35bbbf605bad03261a257
Refactor puzzle 24
martincostello/project-euler
src/ProjectEuler/Puzzles/Puzzle024.cs
src/ProjectEuler/Puzzles/Puzzle024.cs
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System.Collections.Generic; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=24</c>. This class cannot be inherited. /// </summary> internal sealed class Puzzle024 : Puzzle { /// <inheritdoc /> public override string Question => "What is the millionth lexicographic permutation of the digits 0-9?"; /// <inheritdoc /> protected override int SolveCore(string[] args) { var collection = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var nextDigits = new List<int>(collection); var usedDigits = new List<int>(); int targetLength = collection.Length; int remaining = 1000000 - 1; for (int i = 1; i < targetLength; i++) { int rangeSize = Maths.Factorial(targetLength - i); int nextDigitIndex = remaining / rangeSize; remaining = remaining % rangeSize; usedDigits.Add(nextDigits[nextDigitIndex]); nextDigits.RemoveAt(nextDigitIndex); if (remaining == 0) { usedDigits.AddRange(nextDigits); break; } } Answer = Maths.FromDigits(usedDigits); return 0; } } }
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=24</c>. This class cannot be inherited. /// </summary> internal sealed class Puzzle024 : Puzzle { /// <inheritdoc /> public override string Question => "What is the millionth lexicographic permutation of the digits 0-9?"; /// <inheritdoc /> protected override int SolveCore(string[] args) { var collection = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var millionthPermutation = Maths.Permutations(collection) .Skip(999999) .First() .ToList(); Answer = Maths.FromDigits(millionthPermutation); return 0; } } }
apache-2.0
C#
fd47c165578409337b9df8665adee1575865ce2f
Revert "a"
MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps
Source/Site/Microsoft.Deployment.Site.Service/OptionsHttpMessageHandler.cs
Source/Site/Microsoft.Deployment.Site.Service/OptionsHttpMessageHandler.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web.Http; namespace Microsoft.Deployment.Site.Service { public class OptionsHttpMessageHandler : DelegatingHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { if (request.Method == HttpMethod.Options) { var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer(); var controllerRequested = request.GetRouteData().Values["controller"] as string; var supportedMethods = apiExplorer.ApiDescriptions .Where(d => { var controller = d.ActionDescriptor.ControllerDescriptor.ControllerName; return string.Equals(controller, controllerRequested, StringComparison.OrdinalIgnoreCase); }) .Select(d => d.HttpMethod.Method) .Distinct(); if (!supportedMethods.Any()) { return Task.Factory.StartNew(() => request.CreateResponse(HttpStatusCode.NotFound)); } List<string> supportedHeaders = new List<string>() { "OperationId", "UserGeneratedId", "TemplateName", "UserId", "SessionId", "UniqueId", "operationid", "usergeneratedid", "templatename", "userid", "sessionid", "uniqueid" }; return Task.Factory.StartNew(() => { var response = new HttpResponseMessage(HttpStatusCode.OK); //response.Headers.Add("Access-Control-Allow-Methods", string.Join(",", supportedMethods)); //response.Headers.Add("Access-Control-Allow-Headers", string.Join(",", supportedHeaders)); return response; }); } return base.SendAsync(request, cancellationToken); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web.Http; namespace Microsoft.Deployment.Site.Service { public class OptionsHttpMessageHandler : DelegatingHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { if (request.Method == HttpMethod.Options) { var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer(); var controllerRequested = request.GetRouteData().Values["controller"] as string; var supportedMethods = apiExplorer.ApiDescriptions .Where(d => { var controller = d.ActionDescriptor.ControllerDescriptor.ControllerName; return string.Equals(controller, controllerRequested , StringComparison.OrdinalIgnoreCase); }) .Select(d => d.HttpMethod.Method) .Distinct(); if (!supportedMethods.Any()) { return Task.Factory.StartNew(() => request.CreateResponse(HttpStatusCode.NotFound)); } List<string> supportedHeaders = new List<string>() { "OperationId", "UserGeneratedId", "TemplateName", "UserId", "SessionId", "UniqueId", "operationid", "usergeneratedid", "templatename", "userid", "sessionid", "uniqueid" }; return Task.Factory.StartNew(() => { var response = new HttpResponseMessage(HttpStatusCode.OK); //response.Headers.Add("Access-Control-Allow-Methods", string.Join(",", supportedMethods)); //response.Headers.Add("Access-Control-Allow-Headers", string.Join(",", supportedHeaders)); return response; }); } return base.SendAsync(request, cancellationToken); } } }
mit
C#
4db7577448a89f777bbc4b7b78b8ec927103b321
Fix #181 that directory could be removed by user when wox running.
Wox-launcher/Wox,lances101/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,lances101/Wox,qianlifeng/Wox
Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs
Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using Wox.Infrastructure.Storage.UserSettings; namespace Wox.Plugin.SystemPlugins.Program.ProgramSources { public class FileSystemProgramSource : AbstractProgramSource { private string baseDirectory; public FileSystemProgramSource(string baseDirectory) { this.baseDirectory = baseDirectory; } public FileSystemProgramSource(ProgramSource source):this(source.Location) { this.BonusPoints = source.BonusPoints; } public override List<Program> LoadPrograms() { List<Program> list = new List<Program>(); if (Directory.Exists(baseDirectory)) { GetAppFromDirectory(baseDirectory, list); FileChangeWatcher.AddWatch(baseDirectory); } return list; } private void GetAppFromDirectory(string path, List<Program> list) { try { foreach (string file in Directory.GetFiles(path)) { if (UserSettingStorage.Instance.ProgramSuffixes.Split(';').Any(o => file.EndsWith("." + o))) { Program p = CreateEntry(file); list.Add(p); } } foreach (var subDirectory in Directory.GetDirectories(path)) { GetAppFromDirectory(subDirectory, list); } } catch (UnauthorizedAccessException e) { Debug.WriteLine(string.Format("Can't access to directory {0}", path), "WoxDebug"); } catch (DirectoryNotFoundException e) { //no-operation } } public override string ToString() { return typeof(FileSystemProgramSource).Name + ":" + this.baseDirectory; } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using Wox.Infrastructure.Storage.UserSettings; namespace Wox.Plugin.SystemPlugins.Program.ProgramSources { public class FileSystemProgramSource : AbstractProgramSource { private string baseDirectory; public FileSystemProgramSource(string baseDirectory) { this.baseDirectory = baseDirectory; } public FileSystemProgramSource(ProgramSource source):this(source.Location) { this.BonusPoints = source.BonusPoints; } public override List<Program> LoadPrograms() { List<Program> list = new List<Program>(); if (Directory.Exists(baseDirectory)) { GetAppFromDirectory(baseDirectory, list); FileChangeWatcher.AddWatch(baseDirectory); } return list; } private void GetAppFromDirectory(string path, List<Program> list) { try { foreach (string file in Directory.GetFiles(path)) { if (UserSettingStorage.Instance.ProgramSuffixes.Split(';').Any(o => file.EndsWith("." + o))) { Program p = CreateEntry(file); list.Add(p); } } foreach (var subDirectory in Directory.GetDirectories(path)) { GetAppFromDirectory(subDirectory, list); } } catch (UnauthorizedAccessException e) { Debug.WriteLine(string.Format("Can't access to directory {0}",path),"WoxDebug"); } } public override string ToString() { return typeof(FileSystemProgramSource).Name + ":" + this.baseDirectory; } } }
mit
C#
cc8cf7191a3cdff5d586120ac3fcb5f51323d60c
Set default value for no depot mode.
earalov/Skylines-ElevatedTrainStationTrack
Options.cs
Options.cs
 using MetroOverhaul.Detours; using MetroOverhaul.OptionsFramework.Attibutes; namespace MetroOverhaul { [Options("MetroOverhaul")] public class Options { private const string UNSUBPREP = "Unsubscribe Prep"; private const string GENERAL = "General settings"; public Options() { improvedPassengerTrainAi = true; improvedMetroTrainAi = true; metroUi = true; ghostMode = false; depotsNotRequiredMode = false; } [Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)] public bool metroUi { set; get; } [Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)] public bool depotsNotRequiredMode { set; get; } [Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))] public bool improvedPassengerTrainAi { set; get; } [Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))] public bool improvedMetroTrainAi { set; get; } [Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)] public bool ghostMode { set; get; } } }
 using MetroOverhaul.Detours; using MetroOverhaul.OptionsFramework.Attibutes; namespace MetroOverhaul { [Options("MetroOverhaul")] public class Options { private const string UNSUBPREP = "Unsubscribe Prep"; private const string STYLES = "Additional styles"; private const string GENERAL = "General settings"; public Options() { improvedPassengerTrainAi = true; improvedMetroTrainAi = true; metroUi = true; ghostMode = false; } [Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)] public bool metroUi { set; get; } [Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)] public bool depotsNotRequiredMode { set; get; } [Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))] public bool improvedPassengerTrainAi { set; get; } [Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))] public bool improvedMetroTrainAi { set; get; } [Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)] public bool ghostMode { set; get; } } }
mit
C#
7b60ae3ca5b8d783d38efb6a5bff0ff568da1d20
fix outputs and async task
kreuzhofer/AzureLargeFileUploader
Program.cs
Program.cs
using System; using System.IO; using System.Threading.Tasks; namespace AzureLargeFileUploader { class Program { static int Main(string[] args) { if (args.Length != 4) { Help(); return -1; } var fileToUpload = args[0]; if (!File.Exists(fileToUpload)) { Console.WriteLine("File does not exist: "+fileToUpload); Help(); } var containerName = args[1]; var storageAccountName = args[2]; var storageAccountKey = args[3]; var connectionString = $"DefaultEndpointsProtocol=https;AccountName={storageAccountName};AccountKey={storageAccountKey}"; Header(); LargeFileUploaderUtils.Log = Console.WriteLine; var task = LargeFileUploaderUtils.UploadAsync(fileToUpload, connectionString, containerName, (sender, i) => { }); Task.WaitAll(task); return 0; } private static void Header() { Console.WriteLine("********************************************************************************"); Console.WriteLine("Azure Large File Uploader, (C)2016 by Daniel Kreuzhofer (@dkreuzh), MIT License"); Console.WriteLine("Source code is available at https://github.com/kreuzhofer/AzureLargeFileUploader"); Console.WriteLine("********************************************************************************"); } private static void Help() { Console.WriteLine(); Header(); Console.WriteLine("USAGE: AzureLargeFileUploader.exe <FileToUpload> <Container> <StorageAccountName> <StorageAccountKey>"); } } }
using System; using System.IO; namespace AzureLargeFileUploader { class Program { static int Main(string[] args) { if (args.Length != 4) { Help(); return -1; } var fileToUpload = args[0]; if (!File.Exists(fileToUpload)) { Console.WriteLine("File does not exist: "+fileToUpload); Help(); } var containerName = args[1]; var storageAccountName = args[2]; var storageAccountKey = args[3]; var connectionString = $"DefaultEndpointsProtocol=https;AccountName={storageAccountName};AccountKey={storageAccountKey}"; LargeFileUploaderUtils.Log = Console.WriteLine; LargeFileUploaderUtils.UploadAsync(fileToUpload, connectionString, containerName, (sender, i) => { }); return 0; } private static void Help() { Console.WriteLine(); Console.WriteLine("********************************************************************************"); Console.WriteLine("Azure Large File Uploader, (C)2016 by Daniel Kreuzhofer (@dkreuzh), MIT License"); Console.WriteLine("Source code is available at https://github.com/kreuzhofer/AzureLargeFileUploader"); Console.WriteLine("********************************************************************************"); Console.WriteLine("USAGE: AzureLargeFileUploader.exe <FileToUpload> <Container> <StorageAccountName> <StorageAccountKey>"); } } }
mit
C#
28271253fb5004a5eeb1995de44b5ea1ba533351
Correct method name
douglasPinheiro/Selenium-Webdriver-helpers
src/SeleniumWebdriverHelpers/SeleniumWebdriverHelpers/SelectExtensions.cs
src/SeleniumWebdriverHelpers/SeleniumWebdriverHelpers/SelectExtensions.cs
using OpenQA.Selenium; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SeleniumWebdriverHelpers { public static class SelectExtensions { public static IWebElement SelectElement(this IWebDriver browser, By locator) { return browser.FindElement(locator); } public static IEnumerable<IWebElement> SelectElements(this IWebDriver browser, By locator) { return browser.FindElements(locator); } public static IWebElement SelectElementByText(this IWebDriver browser, By locator, string text) { return browser.FindElements(locator) .Where(d => d.GetText() == text) .SingleOrDefault(); } public static IEnumerable<IWebElement> SelectElementsByText(this IWebDriver browser, By locator, string text) { return browser.FindElements(locator) .Where(d => d.GetText() == text); } public static IWebElement SelectElementByAttribute(this IWebDriver browser, By locator, string attribute, string value) { return browser.FindElements(locator) .Where(d => d.GetAttribute(attribute) == value) .SingleOrDefault(); } public static IEnumerable<IWebElement> SelectElementByAttribute(this IWebDriver browser, By locator, string attribute, string value) { return browser.FindElements(locator) .Where(d => d.GetAttribute(attribute) == value); } } }
using OpenQA.Selenium; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SeleniumWebdriverHelpers { public static class SelectExtensions { public static IWebElement SelectElement(this IWebDriver browser, By locator) { return browser.FindElement(locator); } public static IEnumerable<IWebElement> SelectElements(this IWebDriver browser, By locator) { return browser.FindElements(locator); } public static IWebElement SelectElementByText(this IWebDriver browser, By locator, string text) { return browser.FindElements(locator) .Where(d => d.GetText() == text) .SingleOrDefault(); } public static IEnumerable<IWebElement> SelectElementsByText(this IWebDriver browser, By locator, string text) { return browser.FindElements(locator) .Where(d => d.GetText() == text); } public static IWebElement SelectElementByAttribute(this IWebDriver browser, By locator, string attribute, string value) { return browser.FindElements(locator) .Where(d => d.GetAttribute(attribute) == value) .SingleOrDefault(); } public static IEnumerable<IWebElement> SelectElementsByText(this IWebDriver browser, By locator, string attribute, string value) { return browser.FindElements(locator) .Where(d => d.GetAttribute(attribute) == value); } } }
mit
C#
def90ff51a85337bbb156d6e1386ad11632782aa
Rename tests
JohanLarsson/Gu.Analyzers
Gu.Analyzers.Test/GU0060EnumMemberValueConflictsWithAnother/Diagnostics.cs
Gu.Analyzers.Test/GU0060EnumMemberValueConflictsWithAnother/Diagnostics.cs
namespace Gu.Analyzers.Test.GU0060EnumMemberValueConflictsWithAnother { using System.Threading.Tasks; using NUnit.Framework; internal class Diagnostics : DiagnosticVerifier<Analyzers.GU0060EnumMemberValueConflictsWithAnother> { [Test] public async Task ExplicitValueSharing() { var testCode = @" using System; [Flags] public enum Bad2 { A = 1, B = 2, ↓Baaaaaaad = 2 }"; var expected = this.CSharpDiagnostic() .WithLocationIndicated(ref testCode) .WithMessage("Enum member value conflicts with another."); await this.VerifyCSharpDiagnosticAsync(new[] { testCode }, expected) .ConfigureAwait(false); } [Test] public async Task ExplicitValueSharingWithBitwiseSum() { var testCode = @" using System; [Flags] public enum Bad { A = 1, B = 2, ↓Baaaaaaad = 3 }"; var expected = this.CSharpDiagnostic() .WithLocationIndicated(ref testCode) .WithMessage("Enum member value conflicts with another."); await this.VerifyCSharpDiagnosticAsync(new[] { testCode }, expected) .ConfigureAwait(false); } } }
namespace Gu.Analyzers.Test.GU0060EnumMemberValueConflictsWithAnother { using System.Threading.Tasks; using NUnit.Framework; internal class Diagnostics : DiagnosticVerifier<Analyzers.GU0060EnumMemberValueConflictsWithAnother> { [Test] public async Task ImplicitValueSharing() { var testCode = @" using System; [Flags] public enum Bad2 { A = 1, B = 2, ↓Baaaaaaad = 2 }"; var expected = this.CSharpDiagnostic() .WithLocationIndicated(ref testCode) .WithMessage("Enum member value conflicts with another."); await this.VerifyCSharpDiagnosticAsync(new[] { testCode }, expected) .ConfigureAwait(false); } [Test] public async Task ImplicitValueSharingWithBitwiseSum() { var testCode = @" using System; [Flags] public enum Bad { A = 1, B = 2, ↓Baaaaaaad = 3 }"; var expected = this.CSharpDiagnostic() .WithLocationIndicated(ref testCode) .WithMessage("Enum member value conflicts with another."); await this.VerifyCSharpDiagnosticAsync(new[] { testCode }, expected) .ConfigureAwait(false); } } }
mit
C#
a1b3cc7a7d1a39a313c1a0e8de072deb46940a63
add extra arg in non-test
palette-software/PaletteInsightAgent,palette-software/PaletteInsightAgent,palette-software/PaletteInsightAgent,palette-software/PaletteInsightAgent
test/PaletteInsightAgent.UnitTests/LogPoller/LogPollerTest.cs
test/PaletteInsightAgent.UnitTests/LogPoller/LogPollerTest.cs
using System; using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using PaletteInsightAgent.LogPoller; using TypeMock.ArrangeActAssert; namespace UnitTestLogPoller { [TestClass] public class LogPollerTest { [TestMethod, Isolated] public void TestLogFileWatcher() { // Arrange string[] testFiles = { "testFile1", "testFile2" }; string testFolder = "testFolder"; string testFilter = "testFilter"; Isolate.WhenCalled(() => Directory.GetFiles(testFolder, testFilter)).WillReturn(testFiles); // Act LogFileWatcher watcher = new LogFileWatcher(testFolder, testFilter, 10000); // Assert Assert.IsNotNull(watcher); //LogFileWatcher.stateOfFiles.ContainsKey(testFiles[0]); } } }
using System; using System.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using PaletteInsightAgent.LogPoller; using TypeMock.ArrangeActAssert; namespace UnitTestLogPoller { [TestClass] public class LogPollerTest { [TestMethod, Isolated] public void TestLogFileWatcher() { // Arrange string[] testFiles = { "testFile1", "testFile2" }; string testFolder = "testFolder"; string testFilter = "testFilter"; Isolate.WhenCalled(() => Directory.GetFiles(testFolder, testFilter)).WillReturn(testFiles); // Act LogFileWatcher watcher = new LogFileWatcher(testFolder, testFilter); // Assert Assert.IsNotNull(watcher); //LogFileWatcher.stateOfFiles.ContainsKey(testFiles[0]); } } }
mit
C#
4797f9de8f62d3e0682144757ba9e7f69a287ee3
Update RasterBandReader.cs
LANDIS-II-Foundation/Landis-Spatial-Modeling-Library
src/RasterIO.Gdal/RasterBandReader.cs
src/RasterIO.Gdal/RasterBandReader.cs
// Contributors: // James Domingo, Green Code LLC namespace Landis.RasterIO.Gdal { /// <summary> /// A reader for a particular GDAL raster band. /// </summary> public class RasterBandReader<T> where T : struct { private OSGeo.GDAL.Band gdalBand; private BlockDimensions blockDimensions; private GdalBandIO.ReadBlock<T> readBlock; public RasterBandReader(OSGeo.GDAL.Band gdalBand, GdalBandIO.ReadBlock<T> readBlock) { this.gdalBand = gdalBand; this.readBlock = readBlock; gdalBand.GetBlockSize(out blockDimensions.XSize, out blockDimensions.YSize); } public BlockDimensions BlockSize { get { return blockDimensions; } } public int Rows { get { return gdalBand.YSize; } } public int Columns { get { return gdalBand.XSize; } } public void ReadBlock(BandBlock<T> block) { readBlock(gdalBand, block); } } }
// Copyright 2010 Green Code LLC // All rights reserved. // // The copyright holders license this file under the New (3-clause) BSD // License (the "License"). You may not use this file except in // compliance with the License. A copy of the License is available at // // http://www.opensource.org/licenses/BSD-3-Clause // // and is included in the NOTICE.txt file distributed with this work. // // Contributors: // James Domingo, Green Code LLC namespace Landis.RasterIO.Gdal { /// <summary> /// A reader for a particular GDAL raster band. /// </summary> public class RasterBandReader<T> where T : struct { private OSGeo.GDAL.Band gdalBand; private BlockDimensions blockDimensions; private GdalBandIO.ReadBlock<T> readBlock; public RasterBandReader(OSGeo.GDAL.Band gdalBand, GdalBandIO.ReadBlock<T> readBlock) { this.gdalBand = gdalBand; this.readBlock = readBlock; gdalBand.GetBlockSize(out blockDimensions.XSize, out blockDimensions.YSize); } public BlockDimensions BlockSize { get { return blockDimensions; } } public int Rows { get { return gdalBand.YSize; } } public int Columns { get { return gdalBand.XSize; } } public void ReadBlock(BandBlock<T> block) { readBlock(gdalBand, block); } } }
apache-2.0
C#
01e59d0a9e07cc8cd0e7c108c88747ffe3ab24e9
increment minor version,
jwChung/Experimentalism,jwChung/Experimentalism
build/CommonAssemblyInfo.cs
build/CommonAssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.17.0")] [assembly: AssemblyInformationalVersion("0.17.0")] /* * Version 0.17.0 * * - [FIX-BEAKING-CHANGE] Conceals the SpecimenBuilder class from public API. * * - [NEW] Provides ObjectDisposalAssertion to test that a member correctly * implements IDisposable. * * - [FIX-BEAKING-CHANGE] Renames DisplayNameVisitor to DisplayNameCollector. * * - [NEW] Adds new extensions methods to IdiomaticExtensions for selecting * members to verify idiomatic assertions. */
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.16.1")] [assembly: AssemblyInformationalVersion("0.16.1")] /* * Version 0.17.0 * * - [FIX-BEAKING-CHANGE] Conceals the SpecimenBuilder class from public API. * * - [NEW] Provides ObjectDisposalAssertion to test that a member correctly * implements IDisposable. * * - [FIX-BEAKING-CHANGE] Renames DisplayNameVisitor to DisplayNameCollector. * * - [NEW] Adds new extensions methods to IdiomaticExtensions for selecting * members to verify idiomatic assertions. */
mit
C#
5969c3e7cc40c4ba6a8597c09a3e8653ad5d773b
Bump to 0.6.0
mgrosperrin/commandlineparser
src/CommonFiles/VersionAssemblyInfo.cs
src/CommonFiles/VersionAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")] [assembly:AssemblyInformationalVersion("0.6.0")]
using System.Reflection; [assembly: AssemblyVersion("0.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")] [assembly:AssemblyInformationalVersion("0.6.0-beta1")]
mit
C#
1936d480018c2bfc7910a8a4734f7493eb4ac0af
Save did not work with generic ActiveRecord objects.
castleproject/Castle.Transactions,castleproject/Castle.Transactions,castleproject/Castle.Facilities.Wcf-READONLY,carcer/Castle.Components.Validator,castleproject/castle-READONLY-SVN-dump,castleproject/Castle.Facilities.Wcf-READONLY,codereflection/Castle.Components.Scheduler,castleproject/castle-READONLY-SVN-dump,castleproject/castle-READONLY-SVN-dump,castleproject/Castle.Transactions
MonoRail/Castle.MonoRail.ActiveRecordScaffold/Utils/CommonOperationUtils.cs
MonoRail/Castle.MonoRail.ActiveRecordScaffold/Utils/CommonOperationUtils.cs
// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace Castle.MonoRail.ActiveRecordScaffold { using System; using System.Reflection; using System.Collections; using Castle.ActiveRecord; using Castle.Components.Binder; using Castle.MonoRail.Framework; public abstract class CommonOperationUtils { internal static object[] FindAll(Type type) { return FindAll(type, null); } internal static object[] FindAll(Type type, String customWhere) { MethodInfo findAll = type.GetMethod("FindAll", BindingFlags.Static | BindingFlags.Public, null, new Type[0], null); object[] items = null; if (findAll != null) { items = (object[]) findAll.Invoke(null, null); } else { IList list = ActiveRecordMediator.FindAll(type); items = new object[list.Count]; list.CopyTo(items, 0); } return items; } internal static void SaveInstance(object instance, Controller controller, ArrayList errors, IDictionary prop2Validation) { if (instance is ActiveRecordValidationBase) { ActiveRecordValidationBase instanceBase = instance as ActiveRecordValidationBase; if (!instanceBase.IsValid()) { errors.AddRange(instanceBase.ValidationErrorMessages); prop2Validation = instanceBase.PropertiesValidationErrorMessage; } else { instanceBase.Save(); } } else { ActiveRecordMediator.Save( instance ); } } internal static object ReadPkFromParams(Controller controller, PropertyInfo keyProperty) { String id = controller.Context.Params["id"]; if (id == null) { throw new ScaffoldException("Can't edit without the proper id"); } return ConvertUtils.Convert(keyProperty.PropertyType, "id", controller.Params, null); } } }
// Copyright 2004-2006 Castle Project - http://www.castleproject.org/ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace Castle.MonoRail.ActiveRecordScaffold { using System; using System.Reflection; using System.Collections; using Castle.ActiveRecord; using Castle.Components.Binder; using Castle.MonoRail.Framework; public abstract class CommonOperationUtils { internal static object[] FindAll(Type type) { return FindAll(type, null); } internal static object[] FindAll(Type type, String customWhere) { MethodInfo findAll = type.GetMethod("FindAll", BindingFlags.Static | BindingFlags.Public, null, new Type[0], null); object[] items = null; if (findAll != null) { items = (object[]) findAll.Invoke(null, null); } else { IList list = ActiveRecordMediator.FindAll(type); items = new object[list.Count]; list.CopyTo(items, 0); } return items; } internal static void SaveInstance(object instance, Controller controller, ArrayList errors, IDictionary prop2Validation) { if (instance is ActiveRecordValidationBase) { ActiveRecordValidationBase instanceBase = instance as ActiveRecordValidationBase; if (!instanceBase.IsValid()) { errors.AddRange(instanceBase.ValidationErrorMessages); prop2Validation = instanceBase.PropertiesValidationErrorMessage; } else { instanceBase.Save(); } } else { ActiveRecordBase instanceBase = instance as ActiveRecordBase; instanceBase.Save(); } } internal static object ReadPkFromParams(Controller controller, PropertyInfo keyProperty) { String id = controller.Context.Params["id"]; if (id == null) { throw new ScaffoldException("Can't edit without the proper id"); } return ConvertUtils.Convert(keyProperty.PropertyType, "id", controller.Params, null); } } }
apache-2.0
C#
65f0de9224389ffd8982f13c9da58c5068eb2526
Remove LocatorId generation code from DTO since the locator id will be generated by a SQL CLR function
Paymentsense/Dapper.SimpleSave
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/AddProspectDto.cs
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/AddProspectDto.cs
using System; namespace PS.Mothership.Core.Common.Dto.Merchant { public class AddProspectDto { public string CompanyName { get; set; } public string LocatorId { get; set; } public long MainPhoneCountryKey { get; set; } public string MainPhoneNumber { get; set; } public Guid ContactGuid { get; set; } public Guid AddressGuid { get; set; } public Guid MainPhoneGuid { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PS.Mothership.Core.Common.Dto.Merchant { public class AddProspectDto { public string CompanyName { get; set; } public string LocatorId { get { var id = Convert.ToString(((CompanyName.GetHashCode() ^ DateTime.UtcNow.Ticks.GetHashCode()) & 0xffffff) | 0x1000000, 16).Substring(1); return id; } } public long MainPhoneCountryKey { get; set; } public string MainPhoneNumber { get; set; } public Guid ContactGuid { get; set; } public Guid AddressGuid { get; set; } public Guid MainPhoneGuid { get; set; } } }
mit
C#
87d6e1099df41fd986e920fda27349df2b329218
Put Program class in Console App template inside namespace
nkolev92/sdk,nkolev92/sdk
src/Templates/ProjectTemplates/CSharp/.NETCore/CSharpConsoleApplication/Program.cs
src/Templates/ProjectTemplates/CSharp/.NETCore/CSharpConsoleApplication/Program.cs
using System; namespace $safeprojectname$ { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }
using System; class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } }
mit
C#
a21f5e0f144cf884312182ceae4aba016be9afb3
Move fields up
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Tor/Socks5/Models/Fields/OctetFields/AtypField.cs
WalletWasabi/Tor/Socks5/Models/Fields/OctetFields/AtypField.cs
using System.Net; using System.Net.Sockets; using WalletWasabi.Helpers; using WalletWasabi.Tor.Socks5.Models.Bases; namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields { public class AtypField : OctetSerializableBase { // https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt // IPv6 is not supported in CONNECT commands. public static readonly AtypField IPv4 = new AtypField(0x01); public static readonly AtypField DomainName = new AtypField(0x03); public AtypField(byte value) { ByteValue = value; } public AtypField(string dstAddr) { dstAddr = Guard.NotNullOrEmptyOrWhitespace(nameof(dstAddr), dstAddr, true); if (IPAddress.TryParse(dstAddr, out IPAddress address)) { Guard.Same($"{nameof(address)}.{nameof(address.AddressFamily)}", AddressFamily.InterNetwork, address.AddressFamily); ByteValue = IPv4.ToByte(); } else { ByteValue = DomainName.ToByte(); } } } }
using System.Net; using System.Net.Sockets; using WalletWasabi.Helpers; using WalletWasabi.Tor.Socks5.Models.Bases; namespace WalletWasabi.Tor.Socks5.Models.Fields.OctetFields { public class AtypField : OctetSerializableBase { public AtypField(byte value) { ByteValue = value; } public AtypField(string dstAddr) { dstAddr = Guard.NotNullOrEmptyOrWhitespace(nameof(dstAddr), dstAddr, true); if (IPAddress.TryParse(dstAddr, out IPAddress address)) { Guard.Same($"{nameof(address)}.{nameof(address.AddressFamily)}", AddressFamily.InterNetwork, address.AddressFamily); ByteValue = IPv4.ToByte(); } else { ByteValue = DomainName.ToByte(); } } // https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt // IPv6 is not supported in CONNECT commands. public static readonly AtypField IPv4 = new AtypField(0x01); public static AtypField DomainName = new AtypField(0x03); } }
mit
C#
d43bc6bc5371ae0b319f40f67eb52dd52b12187f
test cases for movement of tv shows
davidwhitney/UTorrentPostDownloadScript
UTorrentPostDownloadScript.Test.Unit/Features/Sorting/DetectAndSortTvSeriesTests.cs
UTorrentPostDownloadScript.Test.Unit/Features/Sorting/DetectAndSortTvSeriesTests.cs
using System.Collections.Specialized; using System.Configuration.Abstractions; using System.IO.Abstractions; using Moq; using NUnit.Framework; using UTorrentPostDownloadScript.Features.Sorting; using UTorrentPostDownloadScript.UtorrentApi; namespace UTorrentPostDownloadScript.Test.Unit.Features.Sorting { [TestFixture] public class DetectAndSortTvSeriesTests { private DetectAndSortTvSeries _dasts; private AppSettingsExtended _appSettings; private Mock<IFileSystem> _mockFileSystem; private Mock<DirectoryBase> _mockDirectory; private Mock<FileBase> _mockFile; [SetUp] public void SetUp() { _mockFileSystem = new Mock<IFileSystem>(); _mockDirectory = new Mock<DirectoryBase>(); _mockFile = new Mock<FileBase>(); _mockFileSystem.Setup(x => x.Directory).Returns(_mockDirectory.Object); _mockFileSystem.Setup(x => x.File).Returns(_mockFile.Object); SetupAppSettings(); } private void SetupAppSettings(NameValueCollection nvc = null) { nvc = nvc ?? new NameValueCollection(); _appSettings = new AppSettingsExtended(nvc); _dasts = new DetectAndSortTvSeries(); } [TestCase("SomeShow.S03E01", "c:\\something\\#TV\\SomeShow\\Season 3\\SomeShow.S03E01")] [TestCase("SomeShow.S3E1", "c:\\something\\#TV\\SomeShow\\Season 3\\SomeShow.S3E1")] [TestCase("SomeShow.S3E01", "c:\\something\\#TV\\SomeShow\\Season 3\\SomeShow.S3E01")] public void Handle_WhenDirectoryIsPatternedLikeATvShow_(string tvShowFormat, string expectedLocation) { var originalDir = "c:\\something\\" + tvShowFormat; var @params = new UtorrentCommandLineParameters { DirectoryWhereFilesAreSaved = originalDir }; _dasts.Handle(@params); _mockDirectory.Verify(x => x.Move(originalDir, expectedLocation)); } } }
using System.Collections.Specialized; using System.Configuration.Abstractions; using System.IO.Abstractions; using Moq; using NUnit.Framework; using UTorrentPostDownloadScript.Features.Sorting; using UTorrentPostDownloadScript.UtorrentApi; namespace UTorrentPostDownloadScript.Test.Unit.Features.Sorting { [TestFixture] public class DetectAndSortTvSeriesTests { private DetectAndSortTvSeries _dasts; private AppSettingsExtended _appSettings; private Mock<IFileSystem> _mockFileSystem; private Mock<DirectoryBase> _mockDirectory; private Mock<FileBase> _mockFile; [SetUp] public void SetUp() { _mockFileSystem = new Mock<IFileSystem>(); _mockDirectory = new Mock<DirectoryBase>(); _mockFile = new Mock<FileBase>(); _mockFileSystem.Setup(x => x.Directory).Returns(_mockDirectory.Object); _mockFileSystem.Setup(x => x.File).Returns(_mockFile.Object); SetupAppSettings(); } private void SetupAppSettings(NameValueCollection nvc = null) { nvc = nvc ?? new NameValueCollection(); _appSettings = new AppSettingsExtended(nvc); _dasts = new DetectAndSortTvSeries(); } [TestCase("SomeShow.S03E01")] [TestCase("SomeShow.S3E1")] [TestCase("SomeShow.S3E01")] public void Handle_WhenDirectoryIsPatternedLikeATvShow_(string tvShowFormat) { var originalDir = "c:\\something\\" + tvShowFormat; var @params = new UtorrentCommandLineParameters { DirectoryWhereFilesAreSaved = originalDir }; _dasts.Handle(@params); _mockDirectory.Verify(x=>x.Move(originalDir, "c:\\something\\#TV\\SomeShow\\Season 3\\" + tvShowFormat)); } } }
mit
C#
f6f2e8b8dd40b708bd60cb74f4af9a67a2b736a9
Fix bug workflow.JavaScriptWorkflowScriptEvaluator (#3314)
OrchardCMS/Brochard,stevetayloruk/Orchard2,petedavis/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2,xkproject/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2
src/OrchardCore.Modules/OrchardCore.Workflows/Scripting/JavaScriptWorkflowScriptEvaluator.cs
src/OrchardCore.Modules/OrchardCore.Workflows/Scripting/JavaScriptWorkflowScriptEvaluator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using OrchardCore.Modules; using OrchardCore.Scripting; using OrchardCore.Workflows.Models; using OrchardCore.Workflows.Services; namespace OrchardCore.Workflows.Evaluators { public class JavaScriptWorkflowScriptEvaluator : IWorkflowScriptEvaluator { private readonly IScriptingManager _scriptingManager; private readonly IEnumerable<IWorkflowExecutionContextHandler> _workflowContextHandlers; private readonly ILogger<JavaScriptWorkflowScriptEvaluator> _logger; public JavaScriptWorkflowScriptEvaluator( IScriptingManager scriptingManager, IEnumerable<IWorkflowExecutionContextHandler> workflowContextHandlers, IStringLocalizer<JavaScriptWorkflowScriptEvaluator> localizer, ILogger<JavaScriptWorkflowScriptEvaluator> logger ) { _scriptingManager = scriptingManager; _workflowContextHandlers = workflowContextHandlers; _logger = logger; T = localizer; } private IStringLocalizer T { get; } public async Task<T> EvaluateAsync<T>(WorkflowExpression<T> expression, WorkflowExecutionContext workflowContext, params IGlobalMethodProvider[] scopedMethodProviders) { if (String.IsNullOrWhiteSpace(expression.Expression)) { return await Task.FromResult<T>(default(T)); } var workflowType = workflowContext.WorkflowType; var directive = $"js:{expression}"; var expressionContext = new WorkflowExecutionScriptContext(workflowContext); await _workflowContextHandlers.InvokeAsync(async x => await x.EvaluatingScriptAsync(expressionContext), _logger); var methodProviders = scopedMethodProviders.Concat(expressionContext.ScopedMethodProviders); return (T)_scriptingManager.Evaluate(directive, null, null, methodProviders); } } }
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using OrchardCore.Modules; using OrchardCore.Scripting; using OrchardCore.Workflows.Models; using OrchardCore.Workflows.Services; namespace OrchardCore.Workflows.Evaluators { public class JavaScriptWorkflowScriptEvaluator : IWorkflowScriptEvaluator { private readonly IScriptingManager _scriptingManager; private readonly IEnumerable<IWorkflowExecutionContextHandler> _workflowContextHandlers; private readonly ILogger<JavaScriptWorkflowScriptEvaluator> _logger; public JavaScriptWorkflowScriptEvaluator( IScriptingManager scriptingManager, IEnumerable<IWorkflowExecutionContextHandler> workflowContextHandlers, IStringLocalizer<JavaScriptWorkflowScriptEvaluator> localizer, ILogger<JavaScriptWorkflowScriptEvaluator> logger ) { _scriptingManager = scriptingManager; _workflowContextHandlers = workflowContextHandlers; _logger = logger; T = localizer; } private IStringLocalizer T { get; } public async Task<T> EvaluateAsync<T>(WorkflowExpression<T> expression, WorkflowExecutionContext workflowContext, params IGlobalMethodProvider[] scopedMethodProviders) { var workflowType = workflowContext.WorkflowType; var directive = $"js:{expression}"; var expressionContext = new WorkflowExecutionScriptContext(workflowContext); await _workflowContextHandlers.InvokeAsync(async x => await x.EvaluatingScriptAsync(expressionContext), _logger); var methodProviders = scopedMethodProviders.Concat(expressionContext.ScopedMethodProviders); return (T)_scriptingManager.Evaluate(directive, null, null, methodProviders); } } }
bsd-3-clause
C#
a7f5340c1fc2a75a0e951d98d275a65588ed30cd
Fix semicolon delimiter tests class name
stsrki/fluentmigrator,igitur/fluentmigrator,spaccabit/fluentmigrator,amroel/fluentmigrator,spaccabit/fluentmigrator,fluentmigrator/fluentmigrator,fluentmigrator/fluentmigrator,stsrki/fluentmigrator,amroel/fluentmigrator,igitur/fluentmigrator
test/FluentMigrator.Tests/Unit/Loggers/TextWriterSemicolonDelimiterTests.cs
test/FluentMigrator.Tests/Unit/Loggers/TextWriterSemicolonDelimiterTests.cs
#region License // // Copyright (c) 2018, Fluent Migrator Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.IO; using FluentMigrator.Runner; using FluentMigrator.Runner.Logging; using Microsoft.Extensions.Logging; using NUnit.Framework; using Shouldly; namespace FluentMigrator.Tests.Unit.Loggers { public class TextWriterSemicolonDelimiterTests { private StringWriter stringWriter; private SqlScriptFluentMigratorLoggerOptions options; private ILoggerFactory loggerFactory; private ILogger logger; private string Output => stringWriter.ToString(); [SetUp] public void SetUp() => stringWriter = new StringWriter(); [Test] public void WhenEnabledSqlShouldHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = true }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldBe($"DELETE Blah;{Environment.NewLine}"); } [Test] public void WhenDisabledSqlShouldNotHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = false }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldNotContain(";"); } } }
#region License // // Copyright (c) 2018, Fluent Migrator Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #endregion using System; using System.IO; using FluentMigrator.Runner; using FluentMigrator.Runner.Logging; using Microsoft.Extensions.Logging; using NUnit.Framework; using Shouldly; namespace FluentMigrator.Tests.Unit.Loggers { public class TextWriterSemicolonDelimiter { private StringWriter stringWriter; private SqlScriptFluentMigratorLoggerOptions options; private ILoggerFactory loggerFactory; private ILogger logger; private string Output => stringWriter.ToString(); [SetUp] public void SetUp() => stringWriter = new StringWriter(); [Test] public void WhenEnabledSqlShouldHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = true }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldBe($"DELETE Blah;{Environment.NewLine}"); } [Test] public void WhenDisabledSqlShouldNotHaveSemicolonDelimiter() { options = new SqlScriptFluentMigratorLoggerOptions() { OutputSemicolonDelimiter = false }; loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new SqlScriptFluentMigratorLoggerProvider(stringWriter, options)); logger = loggerFactory.CreateLogger("Test"); logger.LogSql("DELETE Blah"); Output.ShouldNotContain(";"); } } }
apache-2.0
C#
8ef3f829813112b0bf12cf7a33234205956187a8
Refactor TwoCompatibleFields test
vanashimko/MPP.Mapper
MapperTests/DtoMapperTests.cs
MapperTests/DtoMapperTests.cs
using System; using Xunit; using Mapper; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Moq; namespace Mapper.Tests { public class DtoMapperTests { [Fact] public void Map_NullPassed_ExceptionThrown() { IMapper mapper = new DtoMapper(); Assert.Throws<ArgumentNullException>(() => mapper.Map<object, object>(null)); } [Fact] public void Map_TwoCompatibleFields_TwoFieldsAssigned() { IMapper mapper = new DtoMapper(); var source = new Source { FirstProperty = 1, SecondProperty = "a", ThirdProperty = 3.14, FourthProperty = 2 }; var expected = new Destination { FirstProperty = source.FirstProperty, SecondProperty = source.SecondProperty, }; Destination actual = mapper.Map<Source, Destination>(source); Assert.Equal(expected, actual); } [Fact] public void Map_CacheMiss_GetCacheForDidNotCalled() { var mockCache = new Mock<IMappingFunctionsCache>(); IMapper mapper = new DtoMapper(mockCache.Object); mapper.Map<object, object>(new object()); mockCache.Verify(cache => cache.GetCacheFor<object, object>(It.IsAny<MappingEntryInfo>()), Times.Never); } [Fact] public void Map_CacheHit_GetCacheForCalled() { var mockCache = new Mock<IMappingFunctionsCache>(); mockCache.Setup(mock => mock.HasCacheFor(It.IsAny<MappingEntryInfo>())).Returns(true); mockCache.Setup(mock => mock.GetCacheFor<object, object>(It.IsAny<MappingEntryInfo>())).Returns(x => x); IMapper mapper = new DtoMapper(mockCache.Object); mapper.Map<object, object>(new object()); mockCache.Verify(cache => cache.GetCacheFor<object, object>(It.IsAny<MappingEntryInfo>()), Times.Once); } } }
using System; using Xunit; using Mapper; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Moq; namespace Mapper.Tests { public class DtoMapperTests { [Fact] public void Map_NullPassed_ExceptionThrown() { IMapper mapper = new DtoMapper(); Assert.Throws<ArgumentNullException>(() => mapper.Map<object, object>(null)); } [Fact] public void Map_TwoCompatibleFields_TwoFieldsAssigned() { IMapper mapper = new DtoMapper(); var source = new Source { FirstProperty = 1, SecondProperty = "a", ThirdProperty = 3.14, FourthProperty = 2 }; Destination expected = new Destination { FirstProperty = 1, SecondProperty = "a", }; Destination actual = mapper.Map<Source, Destination>(source); Assert.Equal(expected, actual); } [Fact] public void Map_CacheMiss_GetCacheForDidNotCalled() { var mockCache = new Mock<IMappingFunctionsCache>(); IMapper mapper = new DtoMapper(mockCache.Object); mapper.Map<object, object>(new object()); mockCache.Verify(cache => cache.GetCacheFor<object, object>(It.IsAny<MappingEntryInfo>()), Times.Never); } [Fact] public void Map_CacheHit_GetCacheForCalled() { var mockCache = new Mock<IMappingFunctionsCache>(); mockCache.Setup(mock => mock.HasCacheFor(It.IsAny<MappingEntryInfo>())).Returns(true); mockCache.Setup(mock => mock.GetCacheFor<object, object>(It.IsAny<MappingEntryInfo>())).Returns(x => x); IMapper mapper = new DtoMapper(mockCache.Object); mapper.Map<object, object>(new object()); mockCache.Verify(cache => cache.GetCacheFor<object, object>(It.IsAny<MappingEntryInfo>()), Times.Once); } } }
mit
C#
0d5bf63946fe5fbb5acf3e0efe7bfde9f1d9cb7e
Add events to UrhoAppView. Fixes https://forums.xamarin.com/discussion/82700/best-way-to-launch-hololens-application-from-xamarin-forms#latest
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
Bindings/HoloLens/UrhoAppViewSource.cs
Bindings/HoloLens/UrhoAppViewSource.cs
using System; using Windows.ApplicationModel.Core; using Urho.HoloLens; namespace Urho { public class UrhoAppViewSource<T> : IFrameworkViewSource where T : HoloApplication { readonly ApplicationOptions opts; public event Action<UrhoAppView> UrhoAppViewCreated; public UrhoAppViewSource() { } public UrhoAppViewSource(ApplicationOptions opts) { this.opts = opts; } public IFrameworkView CreateView() { var appView = UrhoAppView.Create<T>(opts); UrhoAppViewCreated?.Invoke(appView); return appView; } } }
using Windows.ApplicationModel.Core; using Urho.HoloLens; namespace Urho { public class UrhoAppViewSource<T> : IFrameworkViewSource where T : HoloApplication { readonly ApplicationOptions opts; public UrhoAppViewSource() { } public UrhoAppViewSource(ApplicationOptions opts) { this.opts = opts; } public IFrameworkView CreateView() => UrhoAppView.Create<T>(opts); } }
mit
C#
95256c7268fc0487ed8aa08309e9c34e09b57b51
Fix image offset in ImageButton down state
iridinite/shiftdrive
Client/ImageButton.cs
Client/ImageButton.cs
/* ** Project ShiftDrive ** (C) Mika Molenkamp, 2016. */ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace ShiftDrive { /// <summary> /// Represents an interactive button with an image label. /// </summary> internal sealed class ImageButton : Button { private Texture2D image; private Rectangle? imageSource; private Vector2 imageSize; private Color imageColor; public ImageButton(int order, int x, int y, int width, int height, Texture2D image) : base(order, x, y, width, height) { this.image = image; imageColor = Color.White; SetSourceRect(null); } public ImageButton(int order, int x, int y, int width, int height, Texture2D image, Color color) : this(order, x, y, width, height, image) { imageColor = color; } public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); if (expand < 1f) return; int textOffset = (state == 2) ? 2 : 0; spriteBatch.Draw(image, new Rectangle( (int)(x + width / 2 - imageSize.X / 2), (int)(y + height / 2 - imageSize.Y / 2 + textOffset), (int)imageSize.X, (int)imageSize.Y), imageSource, imageColor); } public void SetSourceRect(Rectangle? rect) { imageSource = rect; imageSize = rect.HasValue ? new Vector2(rect.Value.Width, rect.Value.Height) : new Vector2(image.Width, image.Height); } } }
/* ** Project ShiftDrive ** (C) Mika Molenkamp, 2016. */ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace ShiftDrive { /// <summary> /// Represents an interactive button with an image label. /// </summary> internal sealed class ImageButton : Button { private Texture2D image; private Rectangle? imageSource; private Vector2 imageSize; private Color imageColor; public ImageButton(int order, int x, int y, int width, int height, Texture2D image) : base(order, x, y, width, height) { this.image = image; imageColor = Color.White; SetSourceRect(null); } public ImageButton(int order, int x, int y, int width, int height, Texture2D image, Color color) : this(order, x, y, width, height, image) { imageColor = color; } public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); if (expand < 1f) return; int textOffset = (state == 2) ? 4 : 0; spriteBatch.Draw(image, new Rectangle( (int)(x + width / 2 - imageSize.X / 2), (int)(y + height / 2 - imageSize.Y / 2 + textOffset), (int)imageSize.X, (int)imageSize.Y), imageSource, imageColor); } public void SetSourceRect(Rectangle? rect) { imageSource = rect; imageSize = rect.HasValue ? new Vector2(rect.Value.Width, rect.Value.Height) : new Vector2(image.Width, image.Height); } } }
bsd-3-clause
C#
ebd73a748d00a6afaa212b3d8b140a800fa58636
bump version
user1568891/PropertyChanged,0x53A/PropertyChanged,Fody/PropertyChanged
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyCompany("Simon Cropp and Contributors")] [assembly: AssemblyDescription("Fody add-in for injecting INotifyPropertyChanged code into properties.")] [assembly: AssemblyVersion("1.50.2")] [assembly: AssemblyFileVersion("1.50.2")]
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyCompany("Simon Cropp and Contributors")] [assembly: AssemblyDescription("Fody add-in for injecting INotifyPropertyChanged code into properties.")] [assembly: AssemblyVersion("1.50.1")] [assembly: AssemblyFileVersion("1.50.1")]
mit
C#
e56fe70ecf2541a953074f13cb4504c0edbb571e
bump version
Fody/Immutable
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("Immutable")] [assembly: AssemblyProduct("Immutable")] [assembly: AssemblyVersion("0.2.2.1")] [assembly: AssemblyFileVersion("0.2.2.1")]
using System.Reflection; [assembly: AssemblyTitle("Immutable")] [assembly: AssemblyProduct("Immutable")] [assembly: AssemblyVersion("0.2.2.0")] [assembly: AssemblyFileVersion("0.2.2.0")]
mit
C#
7f6acc7328fb98aae6111c504e18a1d4fcd99a84
Update Index.cshtml
Longfld/ASPNETcoreAngularJWT,Longfld/ASPNETcoreAngularJWT,Longfld/ASPNETcoreAngularJWT,Longfld/ASPNETcoreAngularJWT
Views/Home/Index.cshtml
Views/Home/Index.cshtml
<!doctype html> <html> <head> <title>ASP.NET Angular JWT</title> <base href="~/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,300,100" /> <link href="node_modules/@@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet"> <link rel="stylesheet" href="styles.css" /> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('app').catch(console.error.bind(console)); </script> </head> <body> <app-root>Loading...</app-root> </body> </html>
<!doctype html> <html> <head> <title>webapp</title> <base href="~/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,300,100" /> <link href="node_modules/@@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet"> <link rel="stylesheet" href="styles.css" /> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('app').catch(console.error.bind(console)); </script> </head> <body> <app-root>Loading...</app-root> </body> </html>
mit
C#
f2001dfb00f02c41debf028a006a988dbb2b2750
Add event to serialization.
pushrbx/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,pushrbx/squidex,pushrbx/squidex,pushrbx/squidex,pushrbx/squidex,Squidex/squidex
src/Squidex.Domain.Apps.Core.Operations/HandleRules/EnrichedEvents/EnrichedEvent.cs
src/Squidex.Domain.Apps.Core.Operations/HandleRules/EnrichedEvents/EnrichedEvent.cs
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using Newtonsoft.Json; using NodaTime; using Squidex.Infrastructure; using Squidex.Shared.Users; namespace Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents { public abstract class EnrichedEvent { public NamedId<Guid> AppId { get; set; } public RefToken Actor { get; set; } public Instant Timestamp { get; set; } public string Name { get; set; } public long Version { get; set; } [JsonIgnore] public abstract Guid AggregateId { get; } [JsonIgnore] public IUser User { get; set; } } }
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using Newtonsoft.Json; using NodaTime; using Squidex.Infrastructure; using Squidex.Shared.Users; namespace Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents { public abstract class EnrichedEvent { [JsonIgnore] public abstract Guid AggregateId { get; } public NamedId<Guid> AppId { get; set; } public RefToken Actor { get; set; } public Instant Timestamp { get; set; } public long Version { get; set; } [JsonIgnore] public string Name { get; set; } [JsonIgnore] public IUser User { get; set; } } }
mit
C#
45a5557c8e8b7ab82cc372b1fcd1c4f527b81068
add subject information as additional claims
elerch/SAML2,alexrster/SAML2
src/Owin.Security.Saml/Saml20AssertionExtensions.cs
src/Owin.Security.Saml/Saml20AssertionExtensions.cs
using SAML2; using System; using System.Linq; using System.Security.Claims; using SAML2.Schema.Core; using System.Collections.Generic; namespace Owin.Security.Saml { internal static class Saml20AssertionExtensions { public static ClaimsIdentity ToClaimsIdentity(this Saml20Assertion value, string authenticationType, string nameType = null, string roleType = null) { if (value == null) throw new ArgumentNullException("value"); return new ClaimsIdentity(value.Attributes.Select(a => a.ToClaim(value.Issuer)).Concat(ClaimsFromSubject(value.Subject, value.Issuer)), authenticationType, nameType, roleType); } private static IEnumerable<Claim> ClaimsFromSubject(NameId subject, string issuer) { if (subject == null) yield break; if (subject.Value != null) { yield return new Claim("sub", subject.Value, ClaimValueTypes.String, issuer); // openid connect yield return new Claim(ClaimTypes.NameIdentifier, subject.Value, ClaimValueTypes.String, issuer); // saml } } } }
using SAML2; using System; using System.Linq; using System.Security.Claims; namespace Owin.Security.Saml { internal static class Saml20AssertionExtensions { public static ClaimsIdentity ToClaimsIdentity(this Saml20Assertion value, string authenticationType, string nameType = null, string roleType = null) { if (value == null) throw new ArgumentNullException("value"); return new ClaimsIdentity(value.Attributes.Select(a => a.ToClaim(value.Issuer)), authenticationType, nameType, roleType); } } }
mpl-2.0
C#
b045bf7195e08286a58967ca9adbfeb8c5159c48
Fix integration test
sonvister/Binance
test/Binance.Tests/Integration/DepthWebSocketClientTest.cs
test/Binance.Tests/Integration/DepthWebSocketClientTest.cs
//#define INTEGRATION using System; using System.Threading; using System.Threading.Tasks; using Binance.WebSocket; using Moq; using Xunit; namespace Binance.Tests.Integration { public class DepthWebSocketClientTest { [Fact] public void SubscribeThrows() { var client = new DepthWebSocketClient(new Mock<IWebSocketStream>().Object); Assert.Throws<ArgumentNullException>("symbol", () => client.Subscribe(null)); } [Fact] public void SubscribeTwiceIgnored() { var symbol = Symbol.LTC_USDT; var client = new DepthWebSocketClient(new BinanceWebSocketStream()); client.Subscribe(symbol); client.Subscribe(symbol); } #if INTEGRATION [Fact] public async Task SubscribeCallback() { var symbol = Symbol.LTC_USDT; var client = new DepthWebSocketClient(new BinanceWebSocketStream()); using (var cts = new CancellationTokenSource()) { var task = client.SubscribeAndStreamAsync(symbol, args => { // NOTE: The first event will cancel the client ...could be a while. // ReSharper disable once AccessToDisposedClosure cts.Cancel(); }, cts.Token); await task; } } #endif } }
//#define INTEGRATION using System; using System.Threading; using System.Threading.Tasks; using Binance.WebSocket; using Moq; using Xunit; namespace Binance.Tests.Integration { public class DepthWebSocketClientTest { [Fact] public void SubscribeThrows() { var client = new DepthWebSocketClient(new Mock<IWebSocketStream>().Object); Assert.Throws<ArgumentNullException>("symbol", () => client.Subscribe(null)); } [Fact] public void SubscribeTwiceIgnored() { var symbol = Symbol.LTC_USDT; var client = new DepthWebSocketClient(new BinanceWebSocketStream()); client.Subscribe(symbol); client.Subscribe(symbol); } #if INTEGRATION [Fact] public async Task SubscribeCallback() { var symbol = Symbol.LTC_USDT; var client = new DepthWebSocketClient(new BinanceWebSocketStream()); using (var cts = new CancellationTokenSource()) { var task = client.StreamAsync(symbol, args => { // NOTE: The first event will cancel the client ...could be a while. // ReSharper disable once AccessToDisposedClosure cts.Cancel(); }, cts.Token); await task; } } #endif } }
mit
C#
e0c4f28f423c4a139986f3acdbaf0a28a160225c
Solve build related issue
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs
Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs
using Microsoft.AspNetCore.Mvc; using Promact.Trappist.DomainModel.Models.Question; using Promact.Trappist.Repository.Questions; using System; namespace Promact.Trappist.Core.Controllers { [Route("api")] public class QuestionsController : Controller { private readonly IQuestionRepository _questionsRepository; public QuestionsController(IQuestionRepository questionsRepository) { _questionsRepository = questionsRepository; } /// <summary> /// Add single multiple answer question into model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> /// <param name="singleMultipleAnswerQuestionOption"></param> /// <returns></returns> [Route("single-multiple-question")] [HttpPost] public IActionResult AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption) { _questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleAnswerQuestion, singleMultipleAnswerQuestionOption); return Ok(); } } }
using Microsoft.AspNetCore.Mvc; using Promact.Trappist.DomainModel.Models.Question; using Promact.Trappist.Repository.Questions; using System; namespace Promact.Trappist.Core.Controllers { [Route("api")] public class QuestionsController : Controller { private readonly IQuestionRepository _questionsRepository; public QuestionsController(IQuestionRepository questionsRepository) { _questionsRepository = questionsRepository; } [Route("single-multiple-question")] [HttpPost] /// <summary> /// Add single multiple answer question into model /// </summary> /// <param name="singleMultipleAnswerQuestion"></param> public IActionResult AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption) { _questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleAnswerQuestion, singleMultipleAnswerQuestionOption); return Ok(); } } }
mit
C#
98d313a8f2d47bf2b52a2253a359558e47c35e7d
Add WithIndex extension method
KodamaSakuno/Sakuno.Base
src/Sakuno.Base/Collections/EnumerableExtensions.cs
src/Sakuno.Base/Collections/EnumerableExtensions.cs
using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Sakuno.Collections { [EditorBrowsable(EditorBrowsableState.Never)] public static class EnumerableExtensions { public static bool AnyNull<T>(this IEnumerable<T> source) where T : class { foreach (var item in source) if (item == null) return true; return false; } public static IEnumerable<TSource> NotOfType<TSource, TExclusion>(this IEnumerable<TSource> source) { foreach (var item in source) { if (item is TExclusion) continue; yield return item; } } public static IEnumerable<(TSource Item, int Index)> WithIndex<TSource>(this IEnumerable<TSource> source) { var index = -1; foreach (var item in source) { index = checked(index + 1); yield return (item, index); } } public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> source) => source.OrderBy(IdentityFunction<T>.Instance); public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> items, IComparer<T> comparer) => items.OrderBy(IdentityFunction<T>.Instance, comparer); public static IEnumerable<(T Item, bool IsLast)> EnumerateItemAndIfIsLast<T>(this IEnumerable<T> items) { using (var enumerator = items.GetEnumerator()) { var last = default(T); if (!enumerator.MoveNext()) yield break; var shouldYield = false; do { if (shouldYield) yield return (last, false); shouldYield = true; last = enumerator.Current; } while (enumerator.MoveNext()); yield return (last, true); } } } }
using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Sakuno.Collections { [EditorBrowsable(EditorBrowsableState.Never)] public static class EnumerableExtensions { public static bool AnyNull<T>(this IEnumerable<T> source) where T : class { foreach (var item in source) if (item == null) return true; return false; } public static IEnumerable<TSource> NotOfType<TSource, TExclusion>(this IEnumerable<TSource> source) { foreach (var item in source) { if (item is TExclusion) continue; yield return item; } } public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> source) => source.OrderBy(IdentityFunction<T>.Instance); public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> items, IComparer<T> comparer) => items.OrderBy(IdentityFunction<T>.Instance, comparer); public static IEnumerable<(T Item, bool IsLast)> EnumerateItemAndIfIsLast<T>(this IEnumerable<T> items) { using (var enumerator = items.GetEnumerator()) { var last = default(T); if (!enumerator.MoveNext()) yield break; var shouldYield = false; do { if (shouldYield) yield return (last, false); shouldYield = true; last = enumerator.Current; } while (enumerator.MoveNext()); yield return (last, true); } } } }
mit
C#
10fc3eefe498291daf62f9c5d1358aac7fb1f45c
Revert "[mscorlib] RuntimeWrappedException mono updates."
stormleoxia/referencesource,ludovic-henry/referencesource,evincarofautumn/referencesource,esdrubal/referencesource,directhex/referencesource,mono/referencesource
mscorlib/system/runtime/compilerservices/RuntimeWrappedException.cs
mscorlib/system/runtime/compilerservices/RuntimeWrappedException.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================= ** ** Class: RuntimeWrappedException ** ** ** Purpose: The exception class uses to wrap all non-CLS compliant exceptions. ** ** =============================================================================*/ namespace System.Runtime.CompilerServices { using System; using System.Runtime.Serialization; using System.Runtime.Remoting; using System.Security.Permissions; using System.Diagnostics.Contracts; [Serializable] public sealed class RuntimeWrappedException : Exception { private RuntimeWrappedException(Object thrownObject) : base(Environment.GetResourceString("RuntimeWrappedException")) { SetErrorCode(System.__HResults.COR_E_RUNTIMEWRAPPED); m_wrappedException = thrownObject; } public Object WrappedException { get { return m_wrappedException; } } private Object m_wrappedException; [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); base.GetObjectData(info, context); info.AddValue("WrappedException", m_wrappedException, typeof(Object)); } internal RuntimeWrappedException(SerializationInfo info, StreamingContext context) : base(info, context) { m_wrappedException = info.GetValue("WrappedException", typeof(Object)); } } }
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================= ** ** Class: RuntimeWrappedException ** ** ** Purpose: The exception class uses to wrap all non-CLS compliant exceptions. ** ** =============================================================================*/ namespace System.Runtime.CompilerServices { using System; using System.Runtime.Serialization; using System.Runtime.Remoting; using System.Security.Permissions; using System.Diagnostics.Contracts; [Serializable] public sealed class RuntimeWrappedException : Exception { #if MONO // Called by the runtime private RuntimeWrappedException() : base(Environment.GetResourceString("RuntimeWrappedException")) { SetErrorCode(System.__HResults.COR_E_RUNTIMEWRAPPED); } #endif private RuntimeWrappedException(Object thrownObject) : base(Environment.GetResourceString("RuntimeWrappedException")) { SetErrorCode(System.__HResults.COR_E_RUNTIMEWRAPPED); m_wrappedException = thrownObject; } public Object WrappedException { get { return m_wrappedException; } } private Object m_wrappedException; [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); base.GetObjectData(info, context); info.AddValue("WrappedException", m_wrappedException, typeof(Object)); } internal RuntimeWrappedException(SerializationInfo info, StreamingContext context) : base(info, context) { m_wrappedException = info.GetValue("WrappedException", typeof(Object)); } } }
mit
C#
c3aecdcaf9fe4cd87a97c9323092b68ca5e81277
Update AzureNotificationHubs.cs
jorisbrauns/Cordova-Azure-Notificationhubs,jorisbrauns/Cordova-Azure-Notificationhubs,jorisbrauns/Cordova-Azure-Notificationhubs
src/windows/AzureNotificationHubs/AzureNotificationHubs.cs
src/windows/AzureNotificationHubs/AzureNotificationHubs.cs
using System; using Windows.Networking.PushNotifications; using Microsoft.WindowsAzure.Messaging; using Windows.Foundation; using System.Threading.Tasks; using System.IO; using System.Runtime.Serialization.Json; using Windows.UI.Popups; namespace AzureNotificationHubs { public sealed class AzureNotificationHubs { private static TaskCompletionSource<string> levelCompletionSource = new TaskCompletionSource<string>(); public static IAsyncOperation<string> register(string hubname, string connectionString) { return RegisterNotificationHub(hubname, connectionString).AsAsyncOperation(); } private static async Task<string> RegisterNotificationHub(string hubname, string connectionString) { levelCompletionSource = new TaskCompletionSource<string>(); RegisterHub(hubname, connectionString); return await levelCompletionSource.Task; } private static async void RegisterHub(string hubname, string connectionString) { var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var hub = new NotificationHub(hubname, connectionString); var result = await hub.RegisterNativeAsync(channel.Uri); // Displays the registration ID so you know it was successful if (result.RegistrationId != null) { levelCompletionSource.SetResult(result.RegistrationId); } else { levelCompletionSource.SetResult("RegistrationId is null"); } } } }
using System; using Windows.Networking.PushNotifications; using Microsoft.WindowsAzure.Messaging; using Windows.Foundation; using System.Threading.Tasks; using System.IO; using System.Runtime.Serialization.Json; using Windows.UI.Popups; namespace AzureNotificationHubs { public sealed class AzureNotificationHubs { private static TaskCompletionSource<string> levelCompletionSource = new TaskCompletionSource<string>(); public static IAsyncOperation<string> register(string hubname, string connectionString) { return RegisterNotificationHub(hubname, connectionString).AsAsyncOperation(); } private static async Task<string> RegisterNotificationHub(string hubname, string connectionString) { levelCompletionSource = new TaskCompletionSource<string>(); RegisterHub(hubname, connectionString); return await levelCompletionSource.Task; } private static async void RegisterHub(string hubname, string connectionString) { var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var hub = new NotificationHub(hubname, connectionString); var result = await hub.RegisterNativeAsync(channel.Uri); // Displays the registration ID so you know it was successful if (result.RegistrationId != null) { levelCompletionSource.SetResult(result.RegistrationId); } else { levelCompletionSource.SetResult("RegistrationId is null"); } } //private static string Serialize(Type type, object obj) //{ // using (var stream = new MemoryStream()) // { // var jsonSer = new DataContractJsonSerializer(type); // jsonSer.WriteObject(stream, obj); // stream.Position = 0; // return new StreamReader(stream).ReadToEnd(); // } //} } }
mit
C#
f3eb1b587d919a18e934ef52211ccaa15a77fc69
Make TexturedVertex2D depth internal
ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework
osu.Framework/Graphics/OpenGL/Vertices/TexturedVertex2D.cs
osu.Framework/Graphics/OpenGL/Vertices/TexturedVertex2D.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Runtime.InteropServices; using osuTK; using osuTK.Graphics; using osuTK.Graphics.ES30; namespace osu.Framework.Graphics.OpenGL.Vertices { [StructLayout(LayoutKind.Sequential)] public struct TexturedVertex2D : IEquatable<TexturedVertex2D>, IVertex { [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 Position; [VertexMember(4, VertexAttribPointerType.Float)] public Color4 Colour; [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 TexturePosition; [VertexMember(4, VertexAttribPointerType.Float)] public Vector4 TextureRect; [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 BlendRange; [VertexMember(1, VertexAttribPointerType.Float)] internal float Depth; public bool Equals(TexturedVertex2D other) => Position.Equals(other.Position) && TexturePosition.Equals(other.TexturePosition) && Colour.Equals(other.Colour) && TextureRect.Equals(other.TextureRect) && BlendRange.Equals(other.BlendRange) && Depth.Equals(other.Depth); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Runtime.InteropServices; using osuTK; using osuTK.Graphics; using osuTK.Graphics.ES30; namespace osu.Framework.Graphics.OpenGL.Vertices { [StructLayout(LayoutKind.Sequential)] public struct TexturedVertex2D : IEquatable<TexturedVertex2D>, IVertex { [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 Position; [VertexMember(4, VertexAttribPointerType.Float)] public Color4 Colour; [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 TexturePosition; [VertexMember(4, VertexAttribPointerType.Float)] public Vector4 TextureRect; [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 BlendRange; [VertexMember(1, VertexAttribPointerType.Float)] public float Depth; public bool Equals(TexturedVertex2D other) => Position.Equals(other.Position) && TexturePosition.Equals(other.TexturePosition) && Colour.Equals(other.Colour) && TextureRect.Equals(other.TextureRect) && BlendRange.Equals(other.BlendRange) && Depth.Equals(other.Depth); } }
mit
C#
b650a2b43172335c106f896fa44af372acf69c47
Add missing namespace
killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MixedRealityToolkit/Interfaces/InputSystem/IMixedRealityMouseDeviceManager.cs
Assets/MixedRealityToolkit/Interfaces/InputSystem/IMixedRealityMouseDeviceManager.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; namespace Microsoft.MixedReality.Toolkit.Input { /// <summary> /// Interface defining a mouse input device manager. /// </summary> public interface IMixedRealityMouseDeviceManager : IMixedRealityInputDeviceManager { /// <summary> /// Typed representation of the ConfigurationProfile property. /// </summary> [ObsoleteAttribute("The MouseInputProfile property has been deprecated and will be removed in a future version of MRTK.")] MixedRealityMouseInputProfile MouseInputProfile { get; } /// <summary> /// Gets or sets a multiplier value used to adjust the speed of the mouse cursor. /// </summary> float CursorSpeed { get; set; } /// <summary> /// Gets or sets a multiplier value used to adjust the speed of the mouse wheel. /// </summary> float WheelSpeed { get; set; } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Input; using System; /// <summary> /// Interface defining a mouse input device manager. /// </summary> public interface IMixedRealityMouseDeviceManager : IMixedRealityInputDeviceManager { /// <summary> /// Typed representation of the ConfigurationProfile property. /// </summary> [ObsoleteAttribute("The MouseInputProfile property has been deprecated and will be removed in a future version of MRTK.")] MixedRealityMouseInputProfile MouseInputProfile { get; } /// <summary> /// Gets or sets a multiplier value used to adjust the speed of the mouse cursor. /// </summary> float CursorSpeed { get; set; } /// <summary> /// Gets or sets a multiplier value used to adjust the speed of the mouse wheel. /// </summary> float WheelSpeed { get; set; } }
mit
C#
ca361f553700358c1eda48c77bfd138444e6c1a2
Fix tests
progaudi/MsgPack.Light,roman-kozachenko/MsgPack.Light
src/msgpack.light/CompiledLambdaActivatorFactory.cs
src/msgpack.light/CompiledLambdaActivatorFactory.cs
using System; using System.Linq; using System.Linq.Expressions; // ReSharper disable once RedundantUsingDirective using System.Reflection; namespace ProGaudi.MsgPack.Light { public class CompiledLambdaActivatorFactory { public static Func<object> GetActivator(Type type) { #if PROGAUDI_NETCORE var ctor = type.GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Length == 0 && !x.IsStatic); #else var ctor = type.GetConstructor(Type.EmptyTypes); #endif //make a NewExpression that calls the //ctor with the args we just created var newExp = Expression.New(ctor); //create a lambda with the New //Expression as body and our param object[] as arg var lambda = Expression.Lambda(typeof(Func<object>), newExp); //compile it return (Func<object>)lambda.Compile(); } } }
using System; using System.Linq; using System.Linq.Expressions; // ReSharper disable once RedundantUsingDirective using System.Reflection; namespace ProGaudi.MsgPack.Light { public class CompiledLambdaActivatorFactory { public static Func<object> GetActivator(Type type) { #if PROGAUDI_NETCORE var ctor = type.GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Length == 0); #else var ctor = type.GetConstructor(Type.EmptyTypes); #endif //make a NewExpression that calls the //ctor with the args we just created var newExp = Expression.New(ctor); //create a lambda with the New //Expression as body and our param object[] as arg var lambda = Expression.Lambda(typeof(Func<object>), newExp); //compile it return (Func<object>)lambda.Compile(); } } }
mit
C#
516312d9a6b4d1481521e5a6f3f5e7f738903632
Unify device manufacturer string
dotMorten/AllJoynDeviceSimulator,dotMorten/AllJoynDeviceSimulator
src/AdapterLib/MockBulbDevice.cs
src/AdapterLib/MockBulbDevice.cs
/* * AllJoyn Device Service Bridge for Philips Hue * * Copyright (c) Morten Nielsen * All rights reserved. * * MIT License * * 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. */ namespace AdapterLib { internal class MockBulbDevice : AdapterDevice { static int id = 0; public MockBulbDevice(MockLightingServiceHandler handler) : base(handler.Name, "MockDevices Inc", "Mock Bulb", "1", handler.Id, "") { base.LightingServiceHandler = handler; Icon = new AdapterIcon("ms-appx:///AdapterLib/Icons/Light.png"); } } }
/* * AllJoyn Device Service Bridge for Philips Hue * * Copyright (c) Morten Nielsen * All rights reserved. * * MIT License * * 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. */ namespace AdapterLib { internal class MockBulbDevice : AdapterDevice { static int id = 0; public MockBulbDevice(MockLightingServiceHandler handler) : base(handler.Name, "MockLight Inc", "Mock Bulb", "1", handler.Id, "") { base.LightingServiceHandler = handler; Icon = new AdapterIcon("ms-appx:///AdapterLib/Icons/Light.png"); } } }
mit
C#
a7f00bac976a2a3bfe75670e60dcbb6413c79f55
Use the correct namespace on the static content module.
mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,jmptrader/manos,jmptrader/manos
data/mango-tool/layouts/default/StaticContentModule.cs
data/mango-tool/layouts/default/StaticContentModule.cs
using System; using System.IO; using Mango; // // This the default StaticContentModule that comes with all Mango apps // if you do not wish to serve any static content with Mango you can // remove its route handler from <YourApp>.cs's constructor and delete // this file. // // All Content placed on the Content/ folder should be handled by this // module. // namespace $APPNAME { public class StaticContentModule : MangoModule { public StaticContentModule () { Get ("*", Content); } public static void Content (IMangoContext ctx) { string path = ctx.Request.LocalPath; if (path.StartsWith ("/")) path = path.Substring (1); if (File.Exists (path)) { ctx.Response.SendFile (path); } else ctx.Response.StatusCode = 404; } } }
using System; using System.IO; using Mango; // // This the default StaticContentModule that comes with all Mango apps // if you do not wish to serve any static content with Mango you can // remove its route handler from <YourApp>.cs's constructor and delete // this file. // // All Content placed on the Content/ folder should be handled by this // module. // namespace AppNameFoo { public class StaticContentModule : MangoModule { public StaticContentModule () { Get ("*", Content); } public static void Content (IMangoContext ctx) { string path = ctx.Request.LocalPath; if (path.StartsWith ("/")) path = path.Substring (1); if (File.Exists (path)) { ctx.Response.SendFile (path); } else ctx.Response.StatusCode = 404; } } }
mit
C#