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 |
|---|---|---|---|---|---|---|---|---|
74099187c91db8f6aed567853dee73518b11d1ea | Add MikeV's Config Patch | mderoy/SlackMe | slackme/Slack/SlackInfo.cs | slackme/Slack/SlackInfo.cs | using System;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using NiceIO;
namespace slackme.Slack
{
public class SlackInfo
{
private const char ConfigurationDelimiter = '=';
private const string ConfigurationFileName = "slackme.cfg";
public string HookUrl;
public string Channel;
public string Username;
bool TryParseConfig()
{
string username = "";
string hookurl = "";
NPath configurationFilePath = LocateConfigurationFilePath();
if (configurationFilePath.Exists())
{
foreach (string line in configurationFilePath.ReadAllLines())
{
if (line.Contains("slackurl"))
{
hookurl = line.Split(ConfigurationDelimiter).Last();
}
if (line.Contains("username"))
{
username = line.Split(ConfigurationDelimiter).Last();
}
}
if (hookurl != "" && username != "")
{
Channel = "@" + username;
HookUrl = hookurl;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
return true;
}
public SlackInfo()
{
if (!TryParseConfig())
{
Console.WriteLine("Unable to Parse slackme.cfg");
Environment.Exit(1);
}
Username = "Slack Me!";
}
private NPath LocateConfigurationFilePath()
{
var assemblyDirectory = typeof(SlackMe).Assembly.Location.ToNPath().Parent;
var possibleConfigPath = assemblyDirectory.Combine(ConfigurationFileName);
if (possibleConfigPath.Exists())
return possibleConfigPath;
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile).ToNPath().Combine(ConfigurationFileName);
}
}
} | using System;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using NiceIO;
namespace slackme.Slack
{
public class SlackInfo
{
private const char ConfigurationDelimiter = '=';
public string HookUrl;
public string Channel;
public string Username;
bool TryParseConfig()
{
string username = "";
string hookurl = "";
string filename = "slackme.cfg";
NPath configurationFilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile).ToNPath().Combine(filename);
if (configurationFilePath.Exists())
{
foreach (string line in configurationFilePath.ReadAllLines())
{
if (line.Contains("slackurl"))
{
hookurl = line.Split(ConfigurationDelimiter).Last();
}
if (line.Contains("username"))
{
username = line.Split(ConfigurationDelimiter).Last();
}
}
if (hookurl != "" && username != "")
{
Channel = "@" + username;
HookUrl = hookurl;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
return true;
}
public SlackInfo()
{
if (!TryParseConfig())
{
Console.WriteLine("Unable to Parse slackme.cfg");
Environment.Exit(1);
}
Username = "Slack Me!";
}
}
} | mit | C# |
473b8d8004d83618d46dcf93ec8934e78ac5cd5b | make RegisteredTypeBsonSerializer public | OBeautifulCode/OBeautifulCode.Serialization | OBeautifulCode.Serialization.Bson/BsonSerializers/RegisteredTypeBsonSerializer{T}.cs | OBeautifulCode.Serialization.Bson/BsonSerializers/RegisteredTypeBsonSerializer{T}.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="RegisteredTypeBsonSerializer{T}.cs" company="OBeautifulCode">
// Copyright (c) OBeautifulCode 2018. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace OBeautifulCode.Serialization.Bson
{
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using OBeautifulCode.Assertion.Recipes;
/// <summary>
/// The serializer that is used when <see cref="TypeToRegisterForBson"/> specifies a <see cref="BsonSerializerBuilder"/>.
/// </summary>
/// <typeparam name="T">The type that the backing serializer was registered with.</typeparam>
/// <remarks>
/// This class simply wraps the serializer that is generated by <see cref="BsonSerializerBuilder"/>.
/// The behavior of <see cref="RelatedTypesToInclude"/> is such that that <see cref="BsonSerializerBuilder"/>
/// could be specified for one type, but then get applied to other types. For example, if
/// <see cref="RelatedTypesToInclude.Descendants"/> is specified and the type has descendants, then those
/// descendants will get registered with the specified serializer. However, an <see cref="IBsonSerializer"/>
/// only supports a single type in <see cref="IBsonSerializer.ValueType"/>. We are not really sure how this
/// property is used and whether it even matters, because the serializer will get registered for each
/// individual type (e.g. once for the original type and once for each descendant) via
/// <see cref="BsonSerializer.RegisterSerializer"/>. Is there an problem if the type being registered doesn't
/// match the type of the serializer? This class exists for safety/to avoid any cases where it does matter.
/// </remarks>
public class RegisteredTypeBsonSerializer<T> : SerializerBase<T>
{
private readonly IBsonSerializer backingSerializer;
/// <summary>
/// Initializes a new instance of the <see cref="RegisteredTypeBsonSerializer{T}"/> class.
/// </summary>
/// <param name="backingSerializer">The backing serializer.</param>
public RegisteredTypeBsonSerializer(
IBsonSerializer backingSerializer)
{
new { backingSerializer }.AsArg().Must().NotBeNull();
this.backingSerializer = backingSerializer;
}
/// <inheritdoc />
public override T Deserialize(
BsonDeserializationContext context,
BsonDeserializationArgs args)
{
var result = (T)this.backingSerializer.Deserialize(context, args);
return result;
}
/// <inheritdoc />
public override void Serialize(
BsonSerializationContext context,
BsonSerializationArgs args,
T value)
{
this.backingSerializer.Serialize(context, args, value);
}
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="RegisteredTypeBsonSerializer{T}.cs" company="OBeautifulCode">
// Copyright (c) OBeautifulCode 2018. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace OBeautifulCode.Serialization.Bson
{
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using OBeautifulCode.Assertion.Recipes;
/// <summary>
/// The serializer that is used when <see cref="TypeToRegisterForBson"/> specifies a <see cref="BsonSerializerBuilder"/>.
/// </summary>
/// <typeparam name="T">The type that the backing serializer was registered with.</typeparam>
/// <remarks>
/// This class simply wraps the serializer that is generated by <see cref="BsonSerializerBuilder"/>.
/// The behavior of <see cref="RelatedTypesToInclude"/> is such that that <see cref="BsonSerializerBuilder"/>
/// could be specified for one type, but then get applied to other types. For example, if
/// <see cref="RelatedTypesToInclude.Descendants"/> is specified and the type has descendants, then those
/// descendants will get registered with the specified serializer. However, an <see cref="IBsonSerializer"/>
/// only supports a single type in <see cref="IBsonSerializer.ValueType"/>. We are not really sure how this
/// property is used and whether it even matters, because the serializer will get registered for each
/// individual type (e.g. once for the original type and once for each descendant) via
/// <see cref="BsonSerializer.RegisterSerializer"/>. Is there an problem if the type being registered doesn't
/// match the type of the serializer? This class exists for safety/to avoid any cases where it does matter.
/// </remarks>
internal class RegisteredTypeBsonSerializer<T> : SerializerBase<T>
{
private readonly IBsonSerializer backingSerializer;
/// <summary>
/// Initializes a new instance of the <see cref="RegisteredTypeBsonSerializer{T}"/> class.
/// </summary>
/// <param name="backingSerializer">The backing serializer.</param>
public RegisteredTypeBsonSerializer(
IBsonSerializer backingSerializer)
{
new { backingSerializer }.AsArg().Must().NotBeNull();
this.backingSerializer = backingSerializer;
}
/// <inheritdoc />
public override T Deserialize(
BsonDeserializationContext context,
BsonDeserializationArgs args)
{
var result = (T)this.backingSerializer.Deserialize(context, args);
return result;
}
/// <inheritdoc />
public override void Serialize(
BsonSerializationContext context,
BsonSerializationArgs args,
T value)
{
this.backingSerializer.Serialize(context, args, value);
}
}
} | mit | C# |
cfc6e2175d2fc9ae36b60402ed4a210d55ff33df | Add missing header to MostPlayedBeatmapsContainer | peppy/osu,peppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu | osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs | osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.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.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer<APIUserMostPlayedBeatmap>
{
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
: base(user, "No records. :(", "Most Played Beatmaps")
{
ItemsPerPage = 5;
}
[BackgroundDependencyLoader]
private void load()
{
ItemsContainer.Direction = FillDirection.Vertical;
}
protected override APIRequest<List<APIUserMostPlayedBeatmap>> CreateRequest() =>
new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap model) =>
new DrawableMostPlayedBeatmap(model.GetBeatmapInfo(Rulesets), model.PlayCount);
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer<APIUserMostPlayedBeatmap>
{
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
: base(user, "No records. :(")
{
ItemsPerPage = 5;
}
[BackgroundDependencyLoader]
private void load()
{
ItemsContainer.Direction = FillDirection.Vertical;
}
protected override APIRequest<List<APIUserMostPlayedBeatmap>> CreateRequest() =>
new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap model) =>
new DrawableMostPlayedBeatmap(model.GetBeatmapInfo(Rulesets), model.PlayCount);
}
}
| mit | C# |
2ca7a99be425acf2d9743041beba6d2604f9f2ce | Update BlockType of switch statement. | cston/roslyn,cston/roslyn,Giftednewt/roslyn,xoofx/roslyn,mattwar/roslyn,davkean/roslyn,tvand7093/roslyn,MattWindsor91/roslyn,kelltrick/roslyn,a-ctor/roslyn,wvdd007/roslyn,tmat/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mavasani/roslyn,jkotas/roslyn,gafter/roslyn,amcasey/roslyn,mmitche/roslyn,VSadov/roslyn,srivatsn/roslyn,diryboy/roslyn,AArnott/roslyn,AmadeusW/roslyn,drognanar/roslyn,CyrusNajmabadi/roslyn,zooba/roslyn,stephentoub/roslyn,tvand7093/roslyn,orthoxerox/roslyn,OmarTawfik/roslyn,abock/roslyn,eriawan/roslyn,gafter/roslyn,reaction1989/roslyn,bbarry/roslyn,davkean/roslyn,bbarry/roslyn,yeaicc/roslyn,khyperia/roslyn,ErikSchierboom/roslyn,bbarry/roslyn,vslsnap/roslyn,MattWindsor91/roslyn,AlekseyTs/roslyn,brettfo/roslyn,panopticoncentral/roslyn,diryboy/roslyn,bartdesmet/roslyn,Hosch250/roslyn,swaroop-sridhar/roslyn,CaptainHayashi/roslyn,lorcanmooney/roslyn,xasx/roslyn,robinsedlaczek/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,physhi/roslyn,eriawan/roslyn,heejaechang/roslyn,amcasey/roslyn,akrisiun/roslyn,CaptainHayashi/roslyn,nguerrera/roslyn,shyamnamboodiripad/roslyn,jkotas/roslyn,DustinCampbell/roslyn,Giftednewt/roslyn,mgoertz-msft/roslyn,paulvanbrenk/roslyn,weltkante/roslyn,VSadov/roslyn,paulvanbrenk/roslyn,robinsedlaczek/roslyn,orthoxerox/roslyn,jasonmalinowski/roslyn,reaction1989/roslyn,heejaechang/roslyn,AArnott/roslyn,MattWindsor91/roslyn,akrisiun/roslyn,aelij/roslyn,mattscheffer/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,srivatsn/roslyn,yeaicc/roslyn,KevinRansom/roslyn,wvdd007/roslyn,aelij/roslyn,jamesqo/roslyn,genlu/roslyn,weltkante/roslyn,jamesqo/roslyn,tmat/roslyn,KevinRansom/roslyn,tannergooding/roslyn,OmarTawfik/roslyn,kelltrick/roslyn,Hosch250/roslyn,OmarTawfik/roslyn,xasx/roslyn,gafter/roslyn,dpoeschl/roslyn,mavasani/roslyn,dotnet/roslyn,pdelvo/roslyn,jmarolf/roslyn,brettfo/roslyn,AlekseyTs/roslyn,tmeschter/roslyn,DustinCampbell/roslyn,abock/roslyn,MichalStrehovsky/roslyn,mattwar/roslyn,AnthonyDGreen/roslyn,akrisiun/roslyn,davkean/roslyn,jasonmalinowski/roslyn,drognanar/roslyn,KirillOsenkov/roslyn,a-ctor/roslyn,TyOverby/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,dpoeschl/roslyn,kelltrick/roslyn,shyamnamboodiripad/roslyn,mattscheffer/roslyn,genlu/roslyn,yeaicc/roslyn,ErikSchierboom/roslyn,jcouv/roslyn,jamesqo/roslyn,heejaechang/roslyn,tmeschter/roslyn,mmitche/roslyn,mgoertz-msft/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,jeffanders/roslyn,MattWindsor91/roslyn,bartdesmet/roslyn,jmarolf/roslyn,mavasani/roslyn,pdelvo/roslyn,mattscheffer/roslyn,sharwell/roslyn,sharwell/roslyn,TyOverby/roslyn,VSadov/roslyn,bkoelman/roslyn,jkotas/roslyn,lorcanmooney/roslyn,tvand7093/roslyn,jcouv/roslyn,KevinH-MS/roslyn,tmeschter/roslyn,agocke/roslyn,orthoxerox/roslyn,KevinH-MS/roslyn,a-ctor/roslyn,srivatsn/roslyn,KevinH-MS/roslyn,khyperia/roslyn,robinsedlaczek/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,khyperia/roslyn,genlu/roslyn,reaction1989/roslyn,weltkante/roslyn,dpoeschl/roslyn,CyrusNajmabadi/roslyn,AnthonyDGreen/roslyn,nguerrera/roslyn,brettfo/roslyn,DustinCampbell/roslyn,vslsnap/roslyn,mattwar/roslyn,bkoelman/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Hosch250/roslyn,agocke/roslyn,dotnet/roslyn,diryboy/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,swaroop-sridhar/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,eriawan/roslyn,cston/roslyn,tannergooding/roslyn,zooba/roslyn,jeffanders/roslyn,tmat/roslyn,pdelvo/roslyn,CaptainHayashi/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,jeffanders/roslyn,jcouv/roslyn,jmarolf/roslyn,xoofx/roslyn,wvdd007/roslyn,nguerrera/roslyn,sharwell/roslyn,xoofx/roslyn,MichalStrehovsky/roslyn,drognanar/roslyn,stephentoub/roslyn,mmitche/roslyn,bkoelman/roslyn,amcasey/roslyn,vslsnap/roslyn,TyOverby/roslyn,zooba/roslyn,abock/roslyn,lorcanmooney/roslyn,xasx/roslyn,dotnet/roslyn,AArnott/roslyn,physhi/roslyn,AnthonyDGreen/roslyn,KirillOsenkov/roslyn,paulvanbrenk/roslyn,panopticoncentral/roslyn,agocke/roslyn,physhi/roslyn,Giftednewt/roslyn | src/Features/CSharp/Portable/Structure/Providers/SwitchStatementStructureProvider.cs | src/Features/CSharp/Portable/Structure/Providers/SwitchStatementStructureProvider.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 System.Threading;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Structure;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CSharp.Structure
{
internal class SwitchStatementStructureProvider : AbstractSyntaxNodeStructureProvider<SwitchStatementSyntax>
{
protected override void CollectBlockSpans(
SwitchStatementSyntax node,
ArrayBuilder<BlockSpan> spans,
CancellationToken cancellationToken)
{
spans.Add(new BlockSpan(
isCollapsible: true,
textSpan: TextSpan.FromBounds(node.CloseParenToken.Span.End, node.CloseBraceToken.Span.End),
hintSpan: node.Span,
type: BlockTypes.Conditional));
}
}
} | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Structure;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CSharp.Structure
{
internal class SwitchStatementStructureProvider : AbstractSyntaxNodeStructureProvider<SwitchStatementSyntax>
{
protected override void CollectBlockSpans(
SwitchStatementSyntax node,
ArrayBuilder<BlockSpan> spans,
CancellationToken cancellationToken)
{
spans.Add(new BlockSpan(
isCollapsible: true,
textSpan: TextSpan.FromBounds(node.CloseParenToken.Span.End, node.CloseBraceToken.Span.End),
hintSpan: node.Span,
type: BlockTypes.Statement));
}
}
} | apache-2.0 | C# |
0243e16175a0da5d22e280941dc3c75f3c06bfbb | increment patch to 0.8.1 | adamralph/liteguard,liteguard/liteguard,liteguard/liteguard,adamralph/liteguard | src/CommonAssemblyInfo.cs | src/CommonAssemblyInfo.cs | // <copyright file="CommonAssemblyInfo.cs" company="LiteGuard contributors">
// Copyright (c) LiteGuard contributors. All rights reserved.
// </copyright>
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LiteGuard contributors")]
[assembly: AssemblyCopyright("Copyright © LiteGuard contributors. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("LiteGuard")]
[assembly: AssemblyVersion("0.8.1.0")]
[assembly: AssemblyFileVersion("0.8.1.0")]
[assembly: AssemblyInformationalVersion("0.8.1")]
| // <copyright file="CommonAssemblyInfo.cs" company="LiteGuard contributors">
// Copyright (c) LiteGuard contributors. All rights reserved.
// </copyright>
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LiteGuard contributors")]
[assembly: AssemblyCopyright("Copyright © LiteGuard contributors. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("LiteGuard")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
[assembly: AssemblyInformationalVersion("0.9.0")]
| mit | C# |
845b89ff5b746609298f6c2884b824d57487a5e7 | Bump version number to 1.0.1.0 | da2x/EdgeDeflector | EdgeDeflector/Properties/AssemblyInfo.cs | EdgeDeflector/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("EdgeDeflector")]
[assembly: AssemblyDescription("Rewrites microsoft-edge URI addresses into standard http URI addresses.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdgeDeflector")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("64e191bc-e8ce-4190-939e-c77a75aa0e28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Maintenance Number
// Build Number
//
// 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.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EdgeDeflector")]
[assembly: AssemblyDescription("Rewrites microsoft-edge URI addresses into standard http URI addresses.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EdgeDeflector")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("64e191bc-e8ce-4190-939e-c77a75aa0e28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
e32bdef19607de0720c2b4f2b4a3f2d72d374cae | Update XML comments of ContentSource | atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata | src/Atata/ContentSource.cs | src/Atata/ContentSource.cs | using OpenQA.Selenium;
namespace Atata
{
/// <summary>
/// Specifies the content source of a component.
/// </summary>
public enum ContentSource
{
/// <summary>
/// Uses <see cref="IWebElement.Text"/> property of component scope <see cref="IWebElement"/> element.
/// </summary>
Text,
/// <summary>
/// Uses <c>textContent</c> attribute of component scope <see cref="IWebElement"/> element.
/// </summary>
TextContent,
/// <summary>
/// Uses <c>innerHTML</c> attribute of component scope <see cref="IWebElement"/> element.
/// </summary>
InnerHtml,
/// <summary>
/// Uses <c>value</c> attribute of component scope <see cref="IWebElement"/> element.
/// </summary>
Value,
/// <summary>
/// Uses the concatenation of child nested text values.
/// Executes the script that gets <c>childNodes</c> of component scope <see cref="IWebElement"/> element, filters only <c>Node.TEXT_NODE</c> and concatenates the <c>textContent</c> values of these nodes.
/// </summary>
ChildTextNodes,
/// <summary>
/// Uses the concatenation of child nested text values trimming each text.
/// Executes the script that gets <c>childNodes</c> of component scope <see cref="IWebElement"/> element, filters only <c>Node.TEXT_NODE</c>, gets <c>textContent</c> of each node, trims each value and concatenates them.
/// </summary>
ChildTextNodesTrimmed,
/// <summary>
/// Uses the concatenation of child nested text values trimming each text part and joining with <c>" "</c> separator.
/// Executes the script that gets <c>childNodes</c> of component scope <see cref="IWebElement"/> element, filters only <c>Node.TEXT_NODE</c>, gets <c>textContent</c> of each node, trims each value and concatenates them delimiting with <c>" "</c> character.
/// </summary>
ChildTextNodesTrimmedAndSpaceJoined
}
}
| using OpenQA.Selenium;
namespace Atata
{
/// <summary>
/// Specifies the content source of a component.
/// </summary>
public enum ContentSource
{
/// <summary>
/// Uses <see cref="IWebElement.Text"/> property of component scope <see cref="IWebElement"/> element.
/// </summary>
Text,
/// <summary>
/// Uses <c>textContent</c> attribute of component scope <see cref="IWebElement"/> element.
/// </summary>
TextContent,
/// <summary>
/// Uses <c>innerHTML</c> attribute of component scope <see cref="IWebElement"/> element.
/// </summary>
InnerHtml,
/// <summary>
/// Uses <c>value</c> attribute of component scope <see cref="IWebElement"/> element.
/// </summary>
Value,
/// <summary>
/// Executes the script that gets <c>childNodes</c> of component scope <see cref="IWebElement"/> element, filters only <c>Node.TEXT_NODE</c> and concatenates the <c>textContent</c> values of these nodes.
/// Basically gets only child nested text.
/// </summary>
ChildTextNodes,
/// <summary>
/// Executes the script that gets <c>childNodes</c> of component scope <see cref="IWebElement"/> element, filters only <c>Node.TEXT_NODE</c>, gets <c>textContent</c> of each node, trims each value and concatenates them.
/// Basically gets only child nested text trimming each part.
/// </summary>
ChildTextNodesTrimmed,
/// <summary>
/// Uses the concatenation of child nested text values trimming each text part and joining with <c>" "</c> separator.
/// Executes the script that gets <c>childNodes</c> of component scope <see cref="IWebElement"/> element, filters only <c>Node.TEXT_NODE</c>, gets <c>textContent</c> of each node, trims each value and concatenates them delimiting with <c>" "</c> character.
/// </summary>
ChildTextNodesTrimmedAndSpaceJoined
}
}
| apache-2.0 | C# |
a4e320bc5294edcc3f73aa8d758bbcf539e957ec | Bump version to 0.6.1 | ar3cka/Journalist | src/SolutionInfo.cs | src/SolutionInfo.cs | // <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.6.1")]
[assembly: AssemblyInformationalVersionAttribute("0.6.1")]
[assembly: AssemblyFileVersionAttribute("0.6.1")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.6.1";
}
}
| // <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.6.0")]
[assembly: AssemblyInformationalVersionAttribute("0.6.0")]
[assembly: AssemblyFileVersionAttribute("0.6.0")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.6.0";
}
}
| apache-2.0 | C# |
ee6b6e3cf2e2d0e745518e9ba3bf4b52f20a712d | Bump version to 0.6.4 | ar3cka/Journalist | src/SolutionInfo.cs | src/SolutionInfo.cs | // <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.6.4")]
[assembly: AssemblyInformationalVersionAttribute("0.6.4")]
[assembly: AssemblyFileVersionAttribute("0.6.4")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.6.4";
}
}
| // <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.6.3")]
[assembly: AssemblyInformationalVersionAttribute("0.6.3")]
[assembly: AssemblyFileVersionAttribute("0.6.3")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.6.3";
}
}
| apache-2.0 | C# |
bd30bf12afdfaf5d82c65b7ec8db6eaa78f5ca46 | Fix status bar color in Archive status. | LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform | src/CompetitionPlatform/Views/Project/ProjectDetailsStatusBarPartial.cshtml | src/CompetitionPlatform/Views/Project/ProjectDetailsStatusBarPartial.cshtml | @model CompetitionPlatform.Models.ProjectViewModels.ProjectDetailsStatusBarViewModel
@{
var showDeadline = false;
var showParticipantCount = false;
var participantCount = (Model.ParticipantsCount == 1) ? Model.ParticipantsCount + " participant" : Model.ParticipantsCount + " participants";
var deadline = "";
var color = "";
var status = @Model.Status.ToString().ToUpper();
}
@switch (Model.Status)
{
case Status.Initiative:
color = "blue";
break;
case Status.CompetitionRegistration:
color = "green";
showDeadline = true;
showParticipantCount = true;
deadline = Model.CompetitionRegistrationDeadline.ToString("MMMM dd");
status = "COMPETITION REGISTRATION";
break;
case Status.Implementation:
color = "red";
showDeadline = true;
deadline = Model.ImplementationDeadline.ToString("MMMM dd");
break;
case Status.Voting:
color = "yellow";
showDeadline = true;
deadline = Model.VotingDeadline.ToString("MMMM dd");
break;
case Status.Archive:
color = "grey";
break;
}
<!--green, red, yellow, blue-->
<div class="progress progress--@color">
<div class="progress__bar" style="width: @Model.StatusCompletionPercent%"></div>
<div class="progress__content">
<div class="row">
<div class="col-sm-6">
<div class="progress__title">@status</div>
</div>
<div class="col-sm-6 text-right">
<ul class="progress__info">
@if (showParticipantCount)
{
<li><i class="icon icon--participate"></i> @participantCount</li>
}
@if (showDeadline)
{
<li><i class="icon icon--deadline"></i> @deadline</li>
}
</ul>
</div>
</div>
</div>
</div>
| @model CompetitionPlatform.Models.ProjectViewModels.ProjectDetailsStatusBarViewModel
@{
var showDeadline = false;
var showParticipantCount = false;
var participantCount = (Model.ParticipantsCount == 1) ? Model.ParticipantsCount + " participant" : Model.ParticipantsCount + " participants";
var deadline = "";
var color = "";
var status = @Model.Status.ToString().ToUpper();
}
@switch (Model.Status)
{
case Status.Initiative:
color = "blue";
break;
case Status.CompetitionRegistration:
color = "green";
showDeadline = true;
showParticipantCount = true;
deadline = Model.CompetitionRegistrationDeadline.ToString("MMMM dd");
status = "COMPETITION REGISTRATION";
break;
case Status.Implementation:
color = "red";
showDeadline = true;
deadline = Model.ImplementationDeadline.ToString("MMMM dd");
break;
case Status.Voting:
color = "yellow";
showDeadline = true;
deadline = Model.VotingDeadline.ToString("MMMM dd");
break;
case Status.Archive:
color = "#b2b8bf";
break;
}
<!--green, red, yellow, blue-->
<div class="progress progress--@color">
<div class="progress__bar" style="width: @Model.StatusCompletionPercent%"></div>
<div class="progress__content">
<div class="row">
<div class="col-sm-6">
<div class="progress__title">@status</div>
</div>
<div class="col-sm-6 text-right">
<ul class="progress__info">
@if (showParticipantCount)
{
<li><i class="icon icon--participate"></i> @participantCount</li>
}
@if (showDeadline)
{
<li><i class="icon icon--deadline"></i> @deadline</li>
}
</ul>
</div>
</div>
</div>
</div>
| mit | C# |
40141904f8ccb3e6c414dbf7ab2a13d32be818c1 | Upgrade to newer version | brandonseydel/MailChimp.Net | MailChimp.Net/Properties/AssemblyInfo.cs | MailChimp.Net/Properties/AssemblyInfo.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Brandon Seydel">
// N/A
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MailChimp.Net.V3")]
[assembly: AssemblyDescription("A .NET Wrapper for Mail Chimp v3.0 API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brandon Seydel")]
[assembly: AssemblyProduct("MailChimp.Net.V3")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74f62c2b-b935-4284-85de-df37f62a431c")]
// 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.6.7")]
[assembly: AssemblyFileVersion("1.0.0.0")] | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Brandon Seydel">
// N/A
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MailChimp.Net.V3")]
[assembly: AssemblyDescription("A .NET Wrapper for Mail Chimp v3.0 API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brandon Seydel")]
[assembly: AssemblyProduct("MailChimp.Net.V3")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74f62c2b-b935-4284-85de-df37f62a431c")]
// 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.6.6")]
[assembly: AssemblyFileVersion("1.0.0.0")] | mit | C# |
ede4235884d852989275ba305411991dc7a3806e | Increase HP gain of bananas | ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,peppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu | osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs | osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.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.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Judgements
{
public class CatchBananaJudgement : CatchJudgement
{
public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 1100;
}
}
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return DEFAULT_MAX_HEALTH_INCREASE * 0.75;
}
}
public override bool ShouldExplodeFor(JudgementResult result) => true;
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Judgements
{
public class CatchBananaJudgement : CatchJudgement
{
public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 1100;
}
}
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 0.01;
}
}
public override bool ShouldExplodeFor(JudgementResult result) => true;
}
}
| mit | C# |
8dc9323e2e7eb104439a620c974a6617e1645816 | Remove SecurityTransparent from Server | mdavid/nuget,mdavid/nuget | NuPack.Server/Properties/AssemblyInfo.cs | NuPack.Server/Properties/AssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("NuGet.Server")]
[assembly: AssemblyDescription("Sample Web Application used to host a read-only NuGet feed")]
| using System.Reflection;
using System.Security;
[assembly: AssemblyTitle("NuGet.Server")]
[assembly: AssemblyDescription("Sample Web Application used to host a read-only NuGet feed")]
[assembly: SecurityTransparent] | apache-2.0 | C# |
a184188108b4f9f52f66725ff4026ed0ad710ad1 | Fix typo | nbarbettini/corefx,Winsto/corefx,gabrielPeart/corefx,Petermarcu/corefx,MaggieTsang/corefx,alphonsekurian/corefx,misterzik/corefx,andyhebear/corefx,claudelee/corefx,dkorolev/corefx,parjong/corefx,mokchhya/corefx,SGuyGe/corefx,BrennanConroy/corefx,janhenke/corefx,Winsto/corefx,rahku/corefx,tstringer/corefx,rajansingh10/corefx,oceanho/corefx,shana/corefx,janhenke/corefx,the-dwyer/corefx,lggomez/corefx,nchikanov/corefx,dkorolev/corefx,DnlHarvey/corefx,zhangwenquan/corefx,twsouthwick/corefx,vijaykota/corefx,Jiayili1/corefx,mmitche/corefx,richlander/corefx,YoupHulsebos/corefx,fffej/corefx,ptoonen/corefx,Chrisboh/corefx,scott156/corefx,billwert/corefx,mmitche/corefx,krk/corefx,jlin177/corefx,dkorolev/corefx,mokchhya/corefx,ptoonen/corefx,akivafr123/corefx,pallavit/corefx,pallavit/corefx,vrassouli/corefx,arronei/corefx,tijoytom/corefx,tijoytom/corefx,zhenlan/corefx,vs-team/corefx,gregg-miskelly/corefx,tstringer/corefx,Frank125/corefx,mellinoe/corefx,mmitche/corefx,uhaciogullari/corefx,uhaciogullari/corefx,uhaciogullari/corefx,andyhebear/corefx,rjxby/corefx,heXelium/corefx,mellinoe/corefx,jlin177/corefx,ViktorHofer/corefx,alexandrnikitin/corefx,nchikanov/corefx,shrutigarg/corefx,manu-silicon/corefx,parjong/corefx,uhaciogullari/corefx,twsouthwick/corefx,billwert/corefx,khdang/corefx,mellinoe/corefx,tstringer/corefx,rubo/corefx,dhoehna/corefx,kkurni/corefx,mazong1123/corefx,nelsonsar/corefx,Jiayili1/corefx,destinyclown/corefx,Chrisboh/corefx,viniciustaveira/corefx,nbarbettini/corefx,josguil/corefx,dkorolev/corefx,mokchhya/corefx,shana/corefx,weltkante/corefx,akivafr123/corefx,ericstj/corefx,stephenmichaelf/corefx,larsbj1988/corefx,mokchhya/corefx,zhenlan/corefx,ravimeda/corefx,richlander/corefx,bitcrazed/corefx,cydhaselton/corefx,EverlessDrop41/corefx,parjong/corefx,rahku/corefx,ptoonen/corefx,billwert/corefx,kyulee1/corefx,Alcaro/corefx,vijaykota/corefx,pgavlin/corefx,anjumrizwi/corefx,Ermiar/corefx,mokchhya/corefx,lggomez/corefx,manu-silicon/corefx,vrassouli/corefx,Priya91/corefx-1,ViktorHofer/corefx,krytarowski/corefx,nelsonsar/corefx,shahid-pk/corefx,benpye/corefx,comdiv/corefx,s0ne0me/corefx,cartermp/corefx,shmao/corefx,iamjasonp/corefx,alphonsekurian/corefx,billwert/corefx,jlin177/corefx,stephenmichaelf/corefx,huanjie/corefx,manu-silicon/corefx,benpye/corefx,chenxizhang/corefx,jhendrixMSFT/corefx,wtgodbe/corefx,shimingsg/corefx,zmaruo/corefx,690486439/corefx,shrutigarg/corefx,jeremymeng/corefx,ellismg/corefx,nchikanov/corefx,jcme/corefx,Priya91/corefx-1,krytarowski/corefx,vijaykota/corefx,shimingsg/corefx,comdiv/corefx,tstringer/corefx,chaitrakeshav/corefx,n1ghtmare/corefx,axelheer/corefx,Petermarcu/corefx,Alcaro/corefx,weltkante/corefx,manu-silicon/corefx,FiveTimesTheFun/corefx,popolan1986/corefx,ellismg/corefx,Priya91/corefx-1,Frank125/corefx,josguil/corefx,rahku/corefx,dtrebbien/corefx,vs-team/corefx,Ermiar/corefx,oceanho/corefx,shmao/corefx,rajansingh10/corefx,Ermiar/corefx,stephenmichaelf/corefx,misterzik/corefx,nchikanov/corefx,benpye/corefx,jlin177/corefx,tijoytom/corefx,cydhaselton/corefx,Chrisboh/corefx,arronei/corefx,brett25/corefx,pallavit/corefx,rjxby/corefx,shahid-pk/corefx,jhendrixMSFT/corefx,dtrebbien/corefx,richlander/corefx,vidhya-bv/corefx-sorting,weltkante/corefx,jhendrixMSFT/corefx,fgreinacher/corefx,erpframework/corefx,rjxby/corefx,Alcaro/corefx,stone-li/corefx,dhoehna/corefx,krk/corefx,marksmeltzer/corefx,rjxby/corefx,mafiya69/corefx,manu-silicon/corefx,gabrielPeart/corefx,PatrickMcDonald/corefx,matthubin/corefx,cartermp/corefx,DnlHarvey/corefx,weltkante/corefx,stephenmichaelf/corefx,krytarowski/corefx,Jiayili1/corefx,jcme/corefx,Yanjing123/corefx,Jiayili1/corefx,s0ne0me/corefx,fffej/corefx,ellismg/corefx,vs-team/corefx,nchikanov/corefx,twsouthwick/corefx,the-dwyer/corefx,ellismg/corefx,yizhang82/corefx,seanshpark/corefx,vidhya-bv/corefx-sorting,CherryCxldn/corefx,fernando-rodriguez/corefx,twsouthwick/corefx,marksmeltzer/corefx,shiftkey-tester/corefx,pallavit/corefx,mazong1123/corefx,Petermarcu/corefx,larsbj1988/corefx,SGuyGe/corefx,billwert/corefx,anjumrizwi/corefx,shimingsg/corefx,zmaruo/corefx,brett25/corefx,seanshpark/corefx,khdang/corefx,lggomez/corefx,erpframework/corefx,Yanjing123/corefx,krk/corefx,Petermarcu/corefx,matthubin/corefx,dhoehna/corefx,Yanjing123/corefx,claudelee/corefx,mafiya69/corefx,destinyclown/corefx,gkhanna79/corefx,stormleoxia/corefx,janhenke/corefx,vidhya-bv/corefx-sorting,fgreinacher/corefx,benpye/corefx,viniciustaveira/corefx,lydonchandra/corefx,scott156/corefx,khdang/corefx,n1ghtmare/corefx,iamjasonp/corefx,bpschoch/corefx,cydhaselton/corefx,matthubin/corefx,stephenmichaelf/corefx,benjamin-bader/corefx,brett25/corefx,rahku/corefx,josguil/corefx,parjong/corefx,DnlHarvey/corefx,ravimeda/corefx,scott156/corefx,Chrisboh/corefx,n1ghtmare/corefx,MaggieTsang/corefx,Jiayili1/corefx,dsplaisted/corefx,CloudLens/corefx,CherryCxldn/corefx,anjumrizwi/corefx,rubo/corefx,elijah6/corefx,Priya91/corefx-1,cartermp/corefx,DnlHarvey/corefx,zhenlan/corefx,dsplaisted/corefx,yizhang82/corefx,bitcrazed/corefx,pgavlin/corefx,690486439/corefx,dotnet-bot/corefx,jmhardison/corefx,ravimeda/corefx,ericstj/corefx,kkurni/corefx,mazong1123/corefx,erpframework/corefx,ptoonen/corefx,rubo/corefx,zhenlan/corefx,dotnet-bot/corefx,JosephTremoulet/corefx,nbarbettini/corefx,shimingsg/corefx,MaggieTsang/corefx,bitcrazed/corefx,VPashkov/corefx,stormleoxia/corefx,billwert/corefx,Jiayili1/corefx,rubo/corefx,alexandrnikitin/corefx,seanshpark/corefx,akivafr123/corefx,nbarbettini/corefx,tijoytom/corefx,shahid-pk/corefx,seanshpark/corefx,alphonsekurian/corefx,gkhanna79/corefx,mellinoe/corefx,gregg-miskelly/corefx,krytarowski/corefx,jeremymeng/corefx,josguil/corefx,krytarowski/corefx,shimingsg/corefx,jcme/corefx,ravimeda/corefx,marksmeltzer/corefx,alexperovich/corefx,krk/corefx,jmhardison/corefx,manu-silicon/corefx,Chrisboh/corefx,vrassouli/corefx,claudelee/corefx,huanjie/corefx,chenkennt/corefx,iamjasonp/corefx,shimingsg/corefx,YoupHulsebos/corefx,FiveTimesTheFun/corefx,jeremymeng/corefx,janhenke/corefx,destinyclown/corefx,lggomez/corefx,thiagodin/corefx,JosephTremoulet/corefx,benjamin-bader/corefx,jlin177/corefx,PatrickMcDonald/corefx,alexperovich/corefx,cydhaselton/corefx,krk/corefx,parjong/corefx,bpschoch/corefx,marksmeltzer/corefx,mafiya69/corefx,yizhang82/corefx,690486439/corefx,cartermp/corefx,elijah6/corefx,vidhya-bv/corefx-sorting,stormleoxia/corefx,mmitche/corefx,richlander/corefx,cartermp/corefx,brett25/corefx,kkurni/corefx,shahid-pk/corefx,Petermarcu/corefx,dotnet-bot/corefx,yizhang82/corefx,dotnet-bot/corefx,wtgodbe/corefx,heXelium/corefx,mazong1123/corefx,spoiledsport/corefx,larsbj1988/corefx,the-dwyer/corefx,iamjasonp/corefx,kkurni/corefx,cydhaselton/corefx,ViktorHofer/corefx,seanshpark/corefx,jcme/corefx,josguil/corefx,benpye/corefx,pallavit/corefx,ViktorHofer/corefx,cnbin/corefx,adamralph/corefx,shiftkey-tester/corefx,YoupHulsebos/corefx,tijoytom/corefx,pgavlin/corefx,690486439/corefx,nbarbettini/corefx,iamjasonp/corefx,bpschoch/corefx,fernando-rodriguez/corefx,elijah6/corefx,SGuyGe/corefx,MaggieTsang/corefx,benjamin-bader/corefx,shmao/corefx,Priya91/corefx-1,CherryCxldn/corefx,BrennanConroy/corefx,comdiv/corefx,weltkante/corefx,the-dwyer/corefx,VPashkov/corefx,twsouthwick/corefx,iamjasonp/corefx,gregg-miskelly/corefx,alexperovich/corefx,CloudLens/corefx,fgreinacher/corefx,kyulee1/corefx,oceanho/corefx,stone-li/corefx,YoupHulsebos/corefx,andyhebear/corefx,Winsto/corefx,gabrielPeart/corefx,kyulee1/corefx,KrisLee/corefx,elijah6/corefx,ericstj/corefx,misterzik/corefx,claudelee/corefx,n1ghtmare/corefx,adamralph/corefx,stephenmichaelf/corefx,benjamin-bader/corefx,jmhardison/corefx,billwert/corefx,KrisLee/corefx,nelsonsar/corefx,stephenmichaelf/corefx,axelheer/corefx,elijah6/corefx,bitcrazed/corefx,iamjasonp/corefx,stone-li/corefx,shimingsg/corefx,Ermiar/corefx,weltkante/corefx,heXelium/corefx,mokchhya/corefx,khdang/corefx,VPashkov/corefx,Ermiar/corefx,erpframework/corefx,lydonchandra/corefx,kkurni/corefx,ericstj/corefx,lydonchandra/corefx,spoiledsport/corefx,jhendrixMSFT/corefx,elijah6/corefx,popolan1986/corefx,jcme/corefx,stormleoxia/corefx,wtgodbe/corefx,zhenlan/corefx,elijah6/corefx,richlander/corefx,ravimeda/corefx,lggomez/corefx,gkhanna79/corefx,zhenlan/corefx,twsouthwick/corefx,tijoytom/corefx,alexandrnikitin/corefx,rjxby/corefx,rahku/corefx,andyhebear/corefx,spoiledsport/corefx,rahku/corefx,Ermiar/corefx,richlander/corefx,alphonsekurian/corefx,Jiayili1/corefx,chenkennt/corefx,Ermiar/corefx,rajansingh10/corefx,axelheer/corefx,dhoehna/corefx,huanjie/corefx,SGuyGe/corefx,chaitrakeshav/corefx,pallavit/corefx,rahku/corefx,the-dwyer/corefx,zhangwenquan/corefx,jmhardison/corefx,wtgodbe/corefx,parjong/corefx,parjong/corefx,janhenke/corefx,shmao/corefx,fffej/corefx,adamralph/corefx,yizhang82/corefx,mellinoe/corefx,CherryCxldn/corefx,stone-li/corefx,anjumrizwi/corefx,Yanjing123/corefx,akivafr123/corefx,PatrickMcDonald/corefx,fffej/corefx,dotnet-bot/corefx,stone-li/corefx,SGuyGe/corefx,mafiya69/corefx,richlander/corefx,benjamin-bader/corefx,scott156/corefx,benjamin-bader/corefx,bpschoch/corefx,krk/corefx,thiagodin/corefx,ptoonen/corefx,JosephTremoulet/corefx,n1ghtmare/corefx,benpye/corefx,cartermp/corefx,mazong1123/corefx,alexperovich/corefx,MaggieTsang/corefx,jlin177/corefx,zmaruo/corefx,kyulee1/corefx,axelheer/corefx,Frank125/corefx,pgavlin/corefx,lggomez/corefx,vidhya-bv/corefx-sorting,CloudLens/corefx,MaggieTsang/corefx,shmao/corefx,ViktorHofer/corefx,Chrisboh/corefx,dotnet-bot/corefx,matthubin/corefx,janhenke/corefx,larsbj1988/corefx,YoupHulsebos/corefx,CloudLens/corefx,shiftkey-tester/corefx,chenkennt/corefx,khdang/corefx,tstringer/corefx,gkhanna79/corefx,zmaruo/corefx,vrassouli/corefx,EverlessDrop41/corefx,wtgodbe/corefx,ravimeda/corefx,stone-li/corefx,zhenlan/corefx,YoupHulsebos/corefx,dhoehna/corefx,chenxizhang/corefx,thiagodin/corefx,BrennanConroy/corefx,jhendrixMSFT/corefx,jcme/corefx,mazong1123/corefx,wtgodbe/corefx,oceanho/corefx,shiftkey-tester/corefx,chaitrakeshav/corefx,jlin177/corefx,huanjie/corefx,the-dwyer/corefx,axelheer/corefx,comdiv/corefx,ViktorHofer/corefx,vs-team/corefx,ptoonen/corefx,shrutigarg/corefx,xuweixuwei/corefx,VPashkov/corefx,fgreinacher/corefx,popolan1986/corefx,krytarowski/corefx,zhangwenquan/corefx,ellismg/corefx,dtrebbien/corefx,gkhanna79/corefx,dhoehna/corefx,alexperovich/corefx,akivafr123/corefx,gregg-miskelly/corefx,wtgodbe/corefx,xuweixuwei/corefx,chaitrakeshav/corefx,lggomez/corefx,josguil/corefx,ptoonen/corefx,cnbin/corefx,dotnet-bot/corefx,alexandrnikitin/corefx,thiagodin/corefx,twsouthwick/corefx,axelheer/corefx,dtrebbien/corefx,weltkante/corefx,seanshpark/corefx,YoupHulsebos/corefx,yizhang82/corefx,KrisLee/corefx,rjxby/corefx,mafiya69/corefx,JosephTremoulet/corefx,cnbin/corefx,jhendrixMSFT/corefx,zhangwenquan/corefx,Petermarcu/corefx,mellinoe/corefx,Alcaro/corefx,JosephTremoulet/corefx,gabrielPeart/corefx,jhendrixMSFT/corefx,nchikanov/corefx,690486439/corefx,chenxizhang/corefx,shmao/corefx,arronei/corefx,dsplaisted/corefx,shana/corefx,ViktorHofer/corefx,PatrickMcDonald/corefx,jeremymeng/corefx,DnlHarvey/corefx,nbarbettini/corefx,ericstj/corefx,MaggieTsang/corefx,alexperovich/corefx,Yanjing123/corefx,mmitche/corefx,alexperovich/corefx,shahid-pk/corefx,Petermarcu/corefx,krk/corefx,FiveTimesTheFun/corefx,alexandrnikitin/corefx,marksmeltzer/corefx,Frank125/corefx,Priya91/corefx-1,shmao/corefx,khdang/corefx,the-dwyer/corefx,mafiya69/corefx,ericstj/corefx,tstringer/corefx,kkurni/corefx,heXelium/corefx,fernando-rodriguez/corefx,mmitche/corefx,alphonsekurian/corefx,JosephTremoulet/corefx,rajansingh10/corefx,rjxby/corefx,viniciustaveira/corefx,viniciustaveira/corefx,xuweixuwei/corefx,nchikanov/corefx,bitcrazed/corefx,ericstj/corefx,DnlHarvey/corefx,stone-li/corefx,s0ne0me/corefx,ravimeda/corefx,alphonsekurian/corefx,nelsonsar/corefx,mazong1123/corefx,jeremymeng/corefx,marksmeltzer/corefx,PatrickMcDonald/corefx,s0ne0me/corefx,cnbin/corefx,ellismg/corefx,seanshpark/corefx,EverlessDrop41/corefx,manu-silicon/corefx,nbarbettini/corefx,krytarowski/corefx,shrutigarg/corefx,SGuyGe/corefx,yizhang82/corefx,lydonchandra/corefx,shana/corefx,dhoehna/corefx,gkhanna79/corefx,rubo/corefx,alphonsekurian/corefx,JosephTremoulet/corefx,cydhaselton/corefx,KrisLee/corefx,marksmeltzer/corefx,shahid-pk/corefx,cydhaselton/corefx,DnlHarvey/corefx,gkhanna79/corefx,mmitche/corefx,tijoytom/corefx | src/System.Collections.Concurrent/src/System/Collections/Concurrent/PlatformHelper.cs | src/System.Collections.Concurrent/src/System/Collections/Concurrent/PlatformHelper.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Threading
{
/// <summary>
/// A helper class to get the number of processors, it updates the number of processors every sampling interval
/// </summary>
internal static class PlatformHelper
{
private const int PROCESSOR_COUNT_REFRESH_INTERVAL_MS = 30000; // How often to refresh the count, in milliseconds.
private static volatile int s_processorCount; // The last count seen.
private static volatile int s_lastProcessorCountRefreshTicks; // The last time we refreshed.
/// <summary>
/// Gets the number of available processors
/// </summary>
internal static int ProcessorCount
{
get
{
int now = Environment.TickCount;
if (s_processorCount == 0 || (now - s_lastProcessorCountRefreshTicks) >= PROCESSOR_COUNT_REFRESH_INTERVAL_MS)
{
s_processorCount = Environment.ProcessorCount;
s_lastProcessorCountRefreshTicks = now;
}
return s_processorCount;
}
}
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.Threading
{
/// <summary>
/// A helper class to get the number of preocessors, it updates the numbers of processors every sampling interval
/// </summary>
internal static class PlatformHelper
{
private const int PROCESSOR_COUNT_REFRESH_INTERVAL_MS = 30000; // How often to refresh the count, in milliseconds.
private static volatile int s_processorCount; // The last count seen.
private static volatile int s_lastProcessorCountRefreshTicks; // The last time we refreshed.
/// <summary>
/// Gets the number of available processors
/// </summary>
internal static int ProcessorCount
{
get
{
int now = Environment.TickCount;
if (s_processorCount == 0 || (now - s_lastProcessorCountRefreshTicks) >= PROCESSOR_COUNT_REFRESH_INTERVAL_MS)
{
s_processorCount = Environment.ProcessorCount;
s_lastProcessorCountRefreshTicks = now;
}
return s_processorCount;
}
}
}
}
| mit | C# |
bbed9e597b1a7ac70889daa37e179e7d3addf5e1 | Send Chunks without a packet quee. | SharpMC/SharpMC,Myvar/SharpMC | SharpMC/Networking/Packages/ChunkData.cs | SharpMC/Networking/Packages/ChunkData.cs | // Distrubuted under the MIT license
// ===================================================
// SharpMC uses the permissive 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.
//
// ©Copyright Kenny van Vulpen - 2015
using SharpMC.Utils;
using SharpMC.Worlds;
namespace SharpMC.Networking.Packages
{
internal class ChunkData : Package<ChunkData>
{
public ChunkColumn Chunk;
public bool Queee = false;
public bool Unloader = false;
public ChunkData(ClientWrapper client) : base(client)
{
SendId = 0x21;
}
public ChunkData(ClientWrapper client, MSGBuffer buffer) : base(client, buffer)
{
SendId = 0x21;
}
public override void Write()
{
if (Buffer != null)
{
Buffer.WriteVarInt(SendId);
Buffer.Write(Chunk.GetBytes(Unloader));
Buffer.FlushData(Queee);
}
}
}
} | // Distrubuted under the MIT license
// ===================================================
// SharpMC uses the permissive 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.
//
// ©Copyright Kenny van Vulpen - 2015
using SharpMC.Utils;
using SharpMC.Worlds;
namespace SharpMC.Networking.Packages
{
internal class ChunkData : Package<ChunkData>
{
public ChunkColumn Chunk;
public bool Queee = true;
public bool Unloader = false;
public ChunkData(ClientWrapper client) : base(client)
{
SendId = 0x21;
}
public ChunkData(ClientWrapper client, MSGBuffer buffer) : base(client, buffer)
{
SendId = 0x21;
}
public override void Write()
{
if (Buffer != null)
{
Buffer.WriteVarInt(SendId);
Buffer.Write(Chunk.GetBytes(Unloader));
Buffer.FlushData(Queee);
}
}
}
} | mit | C# |
3416e43e2cd2cbbfdbb9d7309735296d3fa8ee88 | Fix config BasePath | amweiss/WeatherLink | src/WeatherLink/Startup.cs | src/WeatherLink/Startup.cs | using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.PlatformAbstractions;
using Swashbuckle.Swagger.Model;
using System.IO;
using WeatherLink.Models;
using WeatherLink.Services;
namespace WeatherLink
{
internal class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("src/WeatherLink/appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"src/WeatherLinkappsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseStaticFiles();
app.UseMvc();
app.UseSwagger();
app.UseSwaggerUi();
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services
services.AddMvc();
services.AddOptions();
// Add custom services
services.Configure<WeatherLinkSettings>(Configuration);
services.AddTransient<ITrafficAdviceService, WeatherBasedTrafficAdviceService>();
services.AddTransient<IGeocodeService, GoogleMapsGeocodeService>();
services.AddTransient<IDistanceToDurationService, GoogleMapsDistanceToDurationService>();
services.AddTransient<IDarkSkyService, HourlyAndMinutelyDarkSkyService>();
// Configure swagger
services.AddSwaggerGen();
services.ConfigureSwaggerGen(options =>
{
options.SingleApiVersion(new Info
{
Version = "v1",
Title = "Weather Link",
Description = "An API to get weather based advice.",
TermsOfService = "None"
});
options.IncludeXmlComments(GetXmlCommentsPath());
options.DescribeAllEnumsAsStrings();
});
}
private string GetXmlCommentsPath()
{
var app = PlatformServices.Default.Application;
return Path.Combine(app.ApplicationBasePath, Path.ChangeExtension(app.ApplicationName, "xml"));
}
}
} | using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.PlatformAbstractions;
using Swashbuckle.Swagger.Model;
using System.IO;
using WeatherLink.Models;
using WeatherLink.Services;
namespace WeatherLink
{
internal class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath($"{env.ContentRootPath}/src/WeatherLink")
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseStaticFiles();
app.UseMvc();
app.UseSwagger();
app.UseSwaggerUi();
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services
services.AddMvc();
services.AddOptions();
// Add custom services
services.Configure<WeatherLinkSettings>(Configuration);
services.AddTransient<ITrafficAdviceService, WeatherBasedTrafficAdviceService>();
services.AddTransient<IGeocodeService, GoogleMapsGeocodeService>();
services.AddTransient<IDistanceToDurationService, GoogleMapsDistanceToDurationService>();
services.AddTransient<IDarkSkyService, HourlyAndMinutelyDarkSkyService>();
// Configure swagger
services.AddSwaggerGen();
services.ConfigureSwaggerGen(options =>
{
options.SingleApiVersion(new Info
{
Version = "v1",
Title = "Weather Link",
Description = "An API to get weather based advice.",
TermsOfService = "None"
});
options.IncludeXmlComments(GetXmlCommentsPath());
options.DescribeAllEnumsAsStrings();
});
}
private string GetXmlCommentsPath()
{
var app = PlatformServices.Default.Application;
return Path.Combine(app.ApplicationBasePath, Path.ChangeExtension(app.ApplicationName, "xml"));
}
}
} | mit | C# |
46c5126e1064dd32dbb532587e32c508eb162131 | Add tests for warrior damage (#1595) | exercism/xcsharp,exercism/xcsharp | exercises/concept/wizards-and-warriors/WizardsAndWarriorsTests.cs | exercises/concept/wizards-and-warriors/WizardsAndWarriorsTests.cs | using Xunit;
using Exercism.Tests;
public class RolePlayingGameTests
{
[Fact]
public void Describe_wizard()
{
var wizard = new Wizard();
Assert.Equal("Character is a Wizard", wizard.ToString());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Describe_warrior()
{
var warrior = new Warrior();
Assert.Equal("Character is a Warrior", warrior.ToString());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Warrior_is_not_vulnerable()
{
var warrior = new Warrior();
Assert.False(warrior.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Wizard_is_vulnerable()
{
var wizard = new Wizard();
Assert.True(wizard.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Wizard_with_prepared_spell_is_not_vulnerable()
{
var wizard = new Wizard();
wizard.PrepareSpell();
Assert.False(wizard.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Wizard_with_no_prepared_spell_is_vulnerable()
{
var wizard = new Wizard();
Assert.True(wizard.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Attack_points_for_wizard_with_prepared_spell()
{
var wizard = new Wizard();
var warrior = new Warrior();
wizard.PrepareSpell();
Assert.Equal(12, wizard.DamagePoints(warrior));
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Attack_points_for_wizard_with_no_prepared_spell()
{
var wizard = new Wizard();
var otherWizard = new Wizard();
Assert.Equal(3, wizard.DamagePoints(otherWizard));
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Attack_points_for_warrior_with_vulnerable_target()
{
var warrior = new Warrior();
var wizard = new Wizard();
Assert.Equal(10, warrior.DamagePoints(wizard));
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Attack_points_for_warrior_with_non_vulnerable_target()
{
var warrior = new Warrior();
var wizard = new Wizard();
wizard.PrepareSpell();
Assert.Equal(6, warrior.DamagePoints(wizard));
}
}
| using Xunit;
using Exercism.Tests;
public class RolePlayingGameTests
{
[Fact]
public void Describe_wizard()
{
var wizard = new Wizard();
Assert.Equal("Character is a Wizard", wizard.ToString());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Describe_warrior()
{
var warrior = new Warrior();
Assert.Equal("Character is a Warrior", warrior.ToString());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Warrior_is_not_vulnerable()
{
var warrior = new Warrior();
Assert.False(warrior.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Wizard_is_vulnerable()
{
var wizard = new Wizard();
Assert.True(wizard.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Wizard_with_prepared_spell_is_not_vulnerable()
{
var wizard = new Wizard();
wizard.PrepareSpell();
Assert.False(wizard.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Wizard_with_no_prepared_spell_is_vulnerable()
{
var wizard = new Wizard();
Assert.True(wizard.Vulnerable());
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Attack_points_for_wizard_with_prepared_spell()
{
var wizard = new Wizard();
var warrior = new Warrior();
wizard.PrepareSpell();
Assert.Equal(12, wizard.DamagePoints(warrior));
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Attack_points_for_wizard_with_no_prepared_spell()
{
var wizard = new Wizard();
var otherWizard = new Wizard();
Assert.Equal(3, wizard.DamagePoints(otherWizard));
}
}
| mit | C# |
b1d98a0ac5f6cc8d72df4c7bb5292e7a2b4b1745 | Set IdleDetector delay to 100ms | danelkhen/fsync | src/fsync/IdleDetector.cs | src/fsync/IdleDetector.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace fsync
{
class IdleDetector
{
public void Start()
{
if (Timeout == TimeSpan.Zero)
throw new Exception();
Timer = new Timer(Timer_callback);
}
public TimeSpan Timeout { get; set; }
//DateTime LastPing;
[MethodImpl(MethodImplOptions.Synchronized)]
public void Ping()
{
//LastPing = DateTime.Now;
Timer.Change(Timeout, TimeSpan.FromMilliseconds(100));
}
[MethodImpl(MethodImplOptions.Synchronized)]
private void Timer_callback(object state)
{
if (Idle != null)
Idle();
}
public Action Idle;
private Timer Timer;
[MethodImpl(MethodImplOptions.Synchronized)]
public void Stop()
{
Timer.Change(-1, -1);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace fsync
{
class IdleDetector
{
public void Start()
{
if (Timeout == TimeSpan.Zero)
throw new Exception();
Timer = new Timer(Timer_callback);
}
public TimeSpan Timeout { get; set; }
//DateTime LastPing;
[MethodImpl(MethodImplOptions.Synchronized)]
public void Ping()
{
//LastPing = DateTime.Now;
Timer.Change(Timeout, TimeSpan.FromMilliseconds(-1));
}
[MethodImpl(MethodImplOptions.Synchronized)]
private void Timer_callback(object state)
{
if (Idle != null)
Idle();
}
public Action Idle;
private Timer Timer;
[MethodImpl(MethodImplOptions.Synchronized)]
public void Stop()
{
Timer.Change(-1, -1);
}
}
}
| apache-2.0 | C# |
e1dfe364b22690d5eada9900119b3efca2879a5e | Fix lifetime performance regression. | Nabile-Rahmani/osu,UselessToucan/osu,smoogipooo/osu,EVAST9919/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,Drezi126/osu,peppy/osu-new,naoey/osu,EVAST9919/osu,DrabWeb/osu,naoey/osu,peppy/osu,peppy/osu,Damnae/osu,Frontear/osuKyzer,DrabWeb/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,ZLima12/osu,smoogipoo/osu,DrabWeb/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,2yangk23/osu,ZLima12/osu,2yangk23/osu,naoey/osu,NeoAdonis/osu,ppy/osu | osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs | osu.Game/Rulesets/Objects/Drawables/DrawableScrollingHitObject.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Configuration;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects.Drawables
{
/// <summary>
/// A basic class that overrides <see cref="DrawableHitObject{TObject, TJudgement}"/> and implements <see cref="IScrollingHitObject"/>.
/// </summary>
public abstract class DrawableScrollingHitObject<TObject, TJudgement> : DrawableHitObject<TObject, TJudgement>, IScrollingHitObject
where TObject : HitObject
where TJudgement : Judgement
{
public BindableDouble LifetimeOffset { get; } = new BindableDouble();
protected DrawableScrollingHitObject(TObject hitObject)
: base(hitObject)
{
}
private double? lifetimeStart;
public override double LifetimeStart
{
get { return lifetimeStart ?? HitObject.StartTime - LifetimeOffset; }
set { lifetimeStart = value; }
}
private double? lifetimeEnd;
public override double LifetimeEnd
{
get
{
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
return lifetimeEnd ?? endTime + LifetimeOffset;
}
set { lifetimeEnd = value; }
}
protected override void AddNested(DrawableHitObject<TObject, TJudgement> h)
{
var scrollingHitObject = h as IScrollingHitObject;
scrollingHitObject?.LifetimeOffset.BindTo(LifetimeOffset);
base.AddNested(h);
}
}
} | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Configuration;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects.Drawables
{
/// <summary>
/// A basic class that overrides <see cref="DrawableHitObject{TObject, TJudgement}"/> and implements <see cref="IScrollingHitObject"/>.
/// </summary>
public abstract class DrawableScrollingHitObject<TObject, TJudgement> : DrawableHitObject<TObject, TJudgement>, IScrollingHitObject
where TObject : HitObject
where TJudgement : Judgement
{
public BindableDouble LifetimeOffset { get; } = new BindableDouble();
protected DrawableScrollingHitObject(TObject hitObject)
: base(hitObject)
{
}
public override double LifetimeStart
{
get { return Math.Min(HitObject.StartTime - LifetimeOffset, base.LifetimeStart); }
set { base.LifetimeStart = value; }
}
public override double LifetimeEnd
{
get
{
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
return Math.Max(endTime + LifetimeOffset, base.LifetimeEnd);
}
set { base.LifetimeEnd = value; }
}
protected override void AddNested(DrawableHitObject<TObject, TJudgement> h)
{
var scrollingHitObject = h as IScrollingHitObject;
scrollingHitObject?.LifetimeOffset.BindTo(LifetimeOffset);
base.AddNested(h);
}
}
} | mit | C# |
8bcb1c4a62a572e92ccbb14e0e91f1a9545ba96b | fix tailoring recipe ID logic (#403) | Pathoschild/StardewMods | ContentPatcher/Framework/InternalConstants.cs | ContentPatcher/Framework/InternalConstants.cs | using System;
using System.Reflection;
using StardewValley.GameData.Crafting;
using StardewValley.GameData.FishPond;
using StardewValley.GameData.Movies;
namespace ContentPatcher.Framework
{
/// <summary>Internal constant values.</summary>
public static class InternalConstants
{
/*********
** Fields
*********/
/// <summary>The character used as an input argument separator.</summary>
public const string InputArgSeparator = ":";
/// <summary>The character used as a separator between the mod ID and token name for a mod-provided token.</summary>
public const string ModTokenSeparator = "/";
/// <summary>A prefix for player names when specified as an input argument.</summary>
public const string PlayerNamePrefix = "@";
/*********
** Methods
*********/
/// <summary>Get the key for a list asset entry.</summary>
/// <typeparam name="TValue">The list value type.</typeparam>
/// <param name="entity">The entity whose ID to fetch.</param>
public static string GetListAssetKey<TValue>(TValue entity)
{
switch (entity)
{
case ConcessionTaste entry:
return entry.Name;
case FishPondData entry:
return string.Join(",", entry.RequiredTags);
case MovieCharacterReaction entry:
return entry.NPCName;
case TailorItemRecipe entry:
return string.Join(",", entry.FirstItemTags) + "|" + string.Join(",", entry.SecondItemTags);
default:
PropertyInfo property = entity.GetType().GetProperty("ID");
if (property != null)
return property.GetValue(entity)?.ToString();
throw new NotSupportedException($"No ID implementation for list asset value type {typeof(TValue).FullName}.");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using StardewValley.GameData.Crafting;
using StardewValley.GameData.FishPond;
using StardewValley.GameData.Movies;
namespace ContentPatcher.Framework
{
/// <summary>Internal constant values.</summary>
public static class InternalConstants
{
/*********
** Fields
*********/
/// <summary>The character used as an input argument separator.</summary>
public const string InputArgSeparator = ":";
/// <summary>The character used as a separator between the mod ID and token name for a mod-provided token.</summary>
public const string ModTokenSeparator = "/";
/// <summary>A prefix for player names when specified as an input argument.</summary>
public const string PlayerNamePrefix = "@";
/*********
** Methods
*********/
/// <summary>Get the key for a list asset entry.</summary>
/// <typeparam name="TValue">The list value type.</typeparam>
/// <param name="entity">The entity whose ID to fetch.</param>
public static string GetListAssetKey<TValue>(TValue entity)
{
switch (entity)
{
case ConcessionTaste entry:
return entry.Name;
case FishPondData entry:
return string.Join(",", entry.RequiredTags);
case MovieCharacterReaction entry:
return entry.NPCName;
case TailorItemRecipe entry:
IList<string> keyParts = new List<string>();
if (entry.FirstItemTags.Any())
keyParts.Add($"L:{string.Join(",", entry.FirstItemTags)}");
if (entry.SecondItemTags.Any())
keyParts.Add($"R:{string.Join(",", entry.SecondItemTags)}");
return string.Join("|", keyParts);
default:
PropertyInfo property = entity.GetType().GetProperty("ID");
if (property != null)
return property.GetValue(entity)?.ToString();
throw new NotSupportedException($"No ID implementation for list asset value type {typeof(TValue).FullName}.");
}
}
}
}
| mit | C# |
858138ac3e171ba759b885d831f820cf4fc2c2e4 | Make internals visible to Fluent.WbTstr assembly | wbtstr/wbtstr | Source/WbTstr/Properties/AssemblyInfo.cs | Source/WbTstr/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("WbTstr.UnitTests")]
[assembly: InternalsVisibleTo("WbTstr.IntegrationTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: InternalsVisibleTo("WbTstr.Fluent")]
// 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("WbTstr")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mirabeau")]
[assembly: AssemblyProduct("WbTstr")]
[assembly: AssemblyCopyright("Copyright © Mirabeau 2016-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4e7e864b-cb6b-4449-b632-89cd13546e7c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("WbTstr.UnitTests")]
[assembly: InternalsVisibleTo("WbTstr.IntegrationTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
// 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("WbTstr")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mirabeau")]
[assembly: AssemblyProduct("WbTstr")]
[assembly: AssemblyCopyright("Copyright © Mirabeau 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4e7e864b-cb6b-4449-b632-89cd13546e7c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| bsd-3-clause | C# |
7b7fe789a84cfb303ae1fe8a42d1fbf2c24e4349 | update file transport to new TransportDefinition | WojcikMike/docs.particular.net | samples/custom-transport/Version_6/Shared/FileTransport.cs | samples/custom-transport/Version_6/Shared/FileTransport.cs |
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Performance.TimeToBeReceived;
using NServiceBus.Routing;
using NServiceBus.Settings;
using NServiceBus.Transports;
#region TransportDefinition
public class FileTransport : TransportDefinition
{
public override bool RequiresConnectionString => false;
protected override TransportInfrastructure Initialize(SettingsHolder settings, string connectionString)
{
return new FileTransportInfrastructure();
}
public override string ExampleConnectionStringForErrorMessage { get; } = "";
}
public class FileTransportInfrastructure : TransportInfrastructure
{
public override TransportReceiveInfrastructure ConfigureReceiveInfrastructure()
{
return new TransportReceiveInfrastructure(() => new FileTransportMessagePump(), () => new FileTransportQueueCreator(), () => Task.FromResult(StartupCheckResult.Success));
}
public override TransportSendInfrastructure ConfigureSendInfrastructure()
{
return new TransportSendInfrastructure(() => new Dispatcher(), () => Task.FromResult(StartupCheckResult.Success));
}
public override TransportSubscriptionInfrastructure ConfigureSubscriptionInfrastructure()
{
throw new NotImplementedException();
}
public override EndpointInstance BindToLocalEndpoint(EndpointInstance instance)
{
return instance;
}
public override string ToTransportAddress(LogicalAddress logicalAddress)
{
return Path.Combine(logicalAddress.EndpointInstance.Endpoint.ToString(),
logicalAddress.EndpointInstance.Discriminator ?? "",
logicalAddress.Qualifier ?? "");
}
public override IEnumerable<Type> DeliveryConstraints
{
get { yield return typeof(DiscardIfNotReceivedBefore);}
}
public override TransportTransactionMode TransactionMode => TransportTransactionMode.SendsAtomicWithReceive;
public override OutboundRoutingPolicy OutboundRoutingPolicy => new OutboundRoutingPolicy(OutboundRoutingType.Unicast, OutboundRoutingType.Unicast, OutboundRoutingType.Unicast);
}
#endregion |
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Performance.TimeToBeReceived;
using NServiceBus.Routing;
using NServiceBus.Settings;
using NServiceBus.Transports;
#region TransportDefinition
public class FileTransport : TransportDefinition
{
/// <summary>
/// Used by implementations to control if a connection string is necessary.
/// </summary>
public override bool RequiresConnectionString => false;
/// <summary>
/// Gets an example connection string to use when reporting lack of configured connection string to the user.
/// </summary>
public override string ExampleConnectionStringForErrorMessage { get; } = "";
/// <summary>
/// Gets the highest supported transaction mode for the this transport.
/// </summary>
public override TransportTransactionMode GetSupportedTransactionMode() => TransportTransactionMode.SendsAtomicWithReceive;
/// <summary>
/// Will be called if the transport has indicated that it has native support for pub sub.
/// Creates a transport address for the input queue defined by a logical address.
/// </summary>
public override IManageSubscriptions GetSubscriptionManager()
{
throw new NotImplementedException();
}
/// <summary>
/// Returns the discriminator for this endpoint instance.
/// </summary>
public override EndpointInstance BindToLocalEndpoint(EndpointInstance instance, ReadOnlySettings settings)
{
return instance;
}
/// <summary>
/// Configures transport for receiving.
/// </summary>
protected override TransportReceivingConfigurationResult ConfigureForReceiving(TransportReceivingConfigurationContext context)
{
return new TransportReceivingConfigurationResult(() => new FileTransportMessagePump(), () => new FileTransportQueueCreator(), () => Task.FromResult(StartupCheckResult.Success));
}
/// <summary>
/// Configures transport for sending.
/// </summary>
protected override TransportSendingConfigurationResult ConfigureForSending(TransportSendingConfigurationContext context)
{
return new TransportSendingConfigurationResult(() => new Dispatcher(), () => Task.FromResult(StartupCheckResult.Success));
}
/// <summary>
/// Returns the list of supported delivery constraints for this transport.
/// </summary>
public override IEnumerable<Type> GetSupportedDeliveryConstraints()
{
return new List<Type>
{
typeof(DiscardIfNotReceivedBefore)
};
}
/// <summary>
/// Converts a given logical address to the transport address.
/// </summary>
/// <param name="logicalAddress">The logical address.</param>
/// <returns>The transport address.</returns>
public override string ToTransportAddress(LogicalAddress logicalAddress)
{
return Path.Combine(logicalAddress.EndpointInstance.Endpoint.ToString(),
logicalAddress.EndpointInstance.Discriminator ?? "",
logicalAddress.Qualifier ?? "");
}
/// <summary>
/// Returns the outbound routing policy selected for the transport.
/// </summary>
public override OutboundRoutingPolicy GetOutboundRoutingPolicy(ReadOnlySettings settings)
{
return new OutboundRoutingPolicy(OutboundRoutingType.Unicast, OutboundRoutingType.Unicast, OutboundRoutingType.Unicast);
}
}
#endregion | apache-2.0 | C# |
8a4e11e684507f8533b0e5d42787d4dec53232bc | Make it possible to choose the naming scheme for AssemblyEventRegistry | tlycken/RdbmsEventStore | src/RdbmsEventStore/EventRegistry/AssemblyEventRegistry.cs | src/RdbmsEventStore/EventRegistry/AssemblyEventRegistry.cs | using System;
using System.Linq;
using System.Reflection;
namespace RdbmsEventStore.EventRegistry
{
public class AssemblyEventRegistry : SimpleEventRegistry
{
public AssemblyEventRegistry(Type markerType)
: this(markerType, type => type.Name, type => true)
{
}
public AssemblyEventRegistry(Type markerType, Func<Type, bool> inclusionPredicate)
: this(markerType, type => type.Name, inclusionPredicate)
{
}
public AssemblyEventRegistry(Type markerType, Func<Type, string> namer)
: this(markerType, namer, type => true)
{
}
public AssemblyEventRegistry(Type markerType, Func<Type, string> namer, Func<Type, bool> inclusionPredicate)
: base(markerType
.GetTypeInfo()
.Assembly
.GetTypes()
.Where(inclusionPredicate)
.ToDictionary(namer, type => type))
{
}
}
} | using System;
using System.Linq;
using System.Reflection;
namespace RdbmsEventStore.EventRegistry
{
public class AssemblyEventRegistry : SimpleEventRegistry
{
public AssemblyEventRegistry(Type markerType) : this(markerType, type => true)
{
}
public AssemblyEventRegistry(Type markerType, Func<Type, bool> inclusionPredicate)
: base(markerType
.GetTypeInfo()
.Assembly
.GetTypes()
.Where(inclusionPredicate)
.ToDictionary(type => type.Name, type => type))
{
}
}
} | mit | C# |
4a71d7830a7325ecc960366e2bdb4fce20f30d68 | Mark `SubscriptionProrate` as obsolete on `UpcomingInvoiceOptions` | stripe/stripe-dotnet | src/Stripe.net/Services/Invoices/UpcomingInvoiceOptions.cs | src/Stripe.net/Services/Invoices/UpcomingInvoiceOptions.cs | namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class UpcomingInvoiceOptions : BaseOptions
{
[JsonProperty("coupon")]
public string Coupon { get; set; }
[JsonProperty("customer")]
public string Customer { get; set; }
[JsonProperty("discounts")]
public List<InvoiceDiscountOptions> Discounts { get; set; }
[JsonProperty("invoice_items")]
public List<InvoiceUpcomingInvoiceItemOptions> InvoiceItems { get; set; }
[JsonProperty("schedule")]
public string Schedule { get; set; }
[JsonProperty("subscription_billing_cycle_anchor")]
[JsonConverter(typeof(AnyOfConverter))]
public AnyOf<DateTime?, SubscriptionBillingCycleAnchor> SubscriptionBillingCycleAnchor { get; set; }
[JsonProperty("subscription_cancel_at")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionCancelAt { get; set; }
[JsonProperty("subscription_cancel_at_period_end")]
public bool? SubscriptionCancelAtPeriodEnd { get; set; }
[JsonProperty("subscription_cancel_now")]
public bool? SubscriptionCancelNow { get; set; }
[JsonProperty("subscription_default_tax_rates")]
public List<string> SubscriptionDefaultTaxRates { get; set; }
[JsonProperty("subscription")]
public string Subscription { get; set; }
[JsonProperty("subscription_items")]
public List<InvoiceSubscriptionItemOptions> SubscriptionItems { get; set; }
[Obsolete("Use SubscriptionProrationBehavior instead.")]
[JsonProperty("subscription_prorate")]
public bool? SubscriptionProrate { get; set; }
[JsonProperty("subscription_proration_behavior")]
public string SubscriptionProrationBehavior { get; set; }
[JsonProperty("subscription_proration_date")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionProrationDate { get; set; }
[JsonProperty("subscription_start_date")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionStartDate { get; set; }
[JsonProperty("subscription_trial_end")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionTrialEnd { get; set; }
[JsonProperty("subscription_trial_from_plan")]
public bool? SubscriptionTrialFromPlan { get; set; }
}
}
| namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class UpcomingInvoiceOptions : BaseOptions
{
[JsonProperty("coupon")]
public string Coupon { get; set; }
[JsonProperty("customer")]
public string Customer { get; set; }
[JsonProperty("discounts")]
public List<InvoiceDiscountOptions> Discounts { get; set; }
[JsonProperty("invoice_items")]
public List<InvoiceUpcomingInvoiceItemOptions> InvoiceItems { get; set; }
[JsonProperty("schedule")]
public string Schedule { get; set; }
[JsonProperty("subscription_billing_cycle_anchor")]
[JsonConverter(typeof(AnyOfConverter))]
public AnyOf<DateTime?, SubscriptionBillingCycleAnchor> SubscriptionBillingCycleAnchor { get; set; }
[JsonProperty("subscription_cancel_at")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionCancelAt { get; set; }
[JsonProperty("subscription_cancel_at_period_end")]
public bool? SubscriptionCancelAtPeriodEnd { get; set; }
[JsonProperty("subscription_cancel_now")]
public bool? SubscriptionCancelNow { get; set; }
[JsonProperty("subscription_default_tax_rates")]
public List<string> SubscriptionDefaultTaxRates { get; set; }
[JsonProperty("subscription")]
public string Subscription { get; set; }
[JsonProperty("subscription_items")]
public List<InvoiceSubscriptionItemOptions> SubscriptionItems { get; set; }
[JsonProperty("subscription_prorate")]
public bool? SubscriptionProrate { get; set; }
[JsonProperty("subscription_proration_behavior")]
public string SubscriptionProrationBehavior { get; set; }
[JsonProperty("subscription_proration_date")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionProrationDate { get; set; }
[JsonProperty("subscription_start_date")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionStartDate { get; set; }
[JsonProperty("subscription_trial_end")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? SubscriptionTrialEnd { get; set; }
[JsonProperty("subscription_trial_from_plan")]
public bool? SubscriptionTrialFromPlan { get; set; }
}
}
| apache-2.0 | C# |
c0a27eac6ecab6cb013f48c8a5ae3b1db828285c | Change Namespace | muhammedikinci/FuzzyCore | FuzzyCore/ConcreteCommands/GetFile_Command.cs | FuzzyCore/ConcreteCommands/GetFile_Command.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FuzzyCore.Server.Data;
using FuzzyCore.Server.Commands;
namespace FuzzyCore.Server
{
public class GetFile_Command : Command
{
public GetFile_Command(JsonCommand comm) : base(comm)
{
}
public override void Execute()
{
GetFile GetFileComm = new GetFile();
GetFileComm.GetFileBytes(Comm);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using fuzzyControl.Server.Data;
using fuzzyControl.Server.Commands;
namespace fuzzyControl.Server
{
public class GetFile_Command : Command
{
public GetFile_Command(JsonCommand comm) : base(comm)
{
}
public override void Execute()
{
GetFile GetFileComm = new GetFile();
GetFileComm.GetFileBytes(Comm);
}
}
}
| mit | C# |
5a93548729260d40276ce27c403dc2e81d7d4237 | Fix trip cell distance label. | Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving | XamarinApp/MyTrips/MyTrips.iOS/Screens/TripsTableViewController.cs | XamarinApp/MyTrips/MyTrips.iOS/Screens/TripsTableViewController.cs | using Foundation;
using System;
using UIKit;
using MyTrips.ViewModel;
using Humanizer;
namespace MyTrips.iOS
{
public partial class TripsTableViewController : UITableViewController
{
const string TRIP_CELL_IDENTIFIER = "TRIP_CELL_IDENTIFIER";
PastTripsViewModel ViewModel { get; set; }
public TripsTableViewController (IntPtr handle) : base (handle)
{
}
public override async void ViewDidLoad()
{
base.ViewDidLoad();
// TODO: Grab data for UITableView.
ViewModel = new PastTripsViewModel();
await ViewModel.ExecuteLoadPastTripsCommandAsync();
}
#region UITableViewSource
public override nint RowsInSection(UITableView tableView, nint section)
{
return ViewModel.Trips.Count;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
// No need to check for null; storyboards always return a dequeable cell.
var cell = tableView.DequeueReusableCell(TRIP_CELL_IDENTIFIER) as TripTableViewCell;
if (cell == null)
{
cell = new TripTableViewCell(new NSString(TRIP_CELL_IDENTIFIER));
}
var trip = ViewModel.Trips[indexPath.Row];
cell.LocationName = trip.TripId;
cell.TimeAgo = trip.TimeAgo;
cell.Distance = trip.TotalDistance;
return cell;
}
#endregion
}
} | using Foundation;
using System;
using UIKit;
using MyTrips.ViewModel;
using Humanizer;
namespace MyTrips.iOS
{
public partial class TripsTableViewController : UITableViewController
{
const string TRIP_CELL_IDENTIFIER = "TRIP_CELL_IDENTIFIER";
PastTripsViewModel ViewModel { get; set; }
public TripsTableViewController (IntPtr handle) : base (handle)
{
}
public override async void ViewDidLoad()
{
base.ViewDidLoad();
// TODO: Grab data for UITableView.
ViewModel = new PastTripsViewModel();
await ViewModel.ExecuteLoadPastTripsCommandAsync();
}
#region UITableViewSource
public override nint RowsInSection(UITableView tableView, nint section)
{
return ViewModel.Trips.Count;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
// No need to check for null; storyboards always return a dequeable cell.
var cell = tableView.DequeueReusableCell(TRIP_CELL_IDENTIFIER) as TripTableViewCell;
if (cell == null)
{
cell = new TripTableViewCell(new NSString(TRIP_CELL_IDENTIFIER));
}
var trip = ViewModel.Trips[indexPath.Row];
cell.LocationName = trip.TripId;
cell.TimeAgo = trip.TimeAgo;
cell.Distance = $"{trip.TotalDistance} miles";
return cell;
}
#endregion
}
} | mit | C# |
b25d435f58cceebdaa4c6749de73eba4c605874d | add 4K character read buffer to StreamTokenizer | mvbalaw/EtlGate,mvbalaw/EtlGate,mvbalaw/EtlGate | src/EtlGate.Core/StreamTokenizer.cs | src/EtlGate.Core/StreamTokenizer.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace EtlGate.Core
{
public interface IStreamTokenizer
{
IEnumerable<Token> Tokenize(Stream stream, params char[] specials);
}
public class StreamTokenizer : IStreamTokenizer
{
public const string ErrorSpecialCharactersMustBeSpecified = "Special characters must be specified.";
public const string ErrorStreamCannotBeNull = "Stream cannot be null.";
private const int ReadBufferSize = 4096;
public IEnumerable<Token> Tokenize(Stream stream, params char[] specials)
{
if (stream == null)
{
throw new ArgumentException(ErrorStreamCannotBeNull, "stream");
}
if (specials == null)
{
throw new ArgumentException(ErrorSpecialCharactersMustBeSpecified, "specials");
}
var lookup = new bool[char.MaxValue];
foreach (var ch in specials)
{
lookup[ch] = true;
}
var data = new StringBuilder();
using (var reader = new StreamReader(stream))
{
var next = new char[ReadBufferSize];
int count;
do
{
count = reader.Read(next, 0, ReadBufferSize);
if (count == 0)
{
break;
}
for (var i = 0; i < count; i++)
{
var ch = next[i];
if (!lookup[ch])
{
data.Append(ch);
continue;
}
if (data.Length > 0)
{
yield return new Token(TokenType.Data, data.ToString());
data.Length = 0;
}
yield return new Token(TokenType.Special, new String(next, i, 1));
}
} while (count > 0);
}
if (data.Length > 0)
{
yield return new Token(TokenType.Data, data.ToString());
data.Length = 0;
}
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace EtlGate.Core
{
public interface IStreamTokenizer
{
IEnumerable<Token> Tokenize(Stream stream, params char[] specials);
}
public class StreamTokenizer : IStreamTokenizer
{
public const string ErrorSpecialCharactersMustBeSpecified = "Special characters must be specified.";
public const string ErrorStreamCannotBeNull = "Stream cannot be null.";
public IEnumerable<Token> Tokenize(Stream stream, params char[] specials)
{
if (stream == null)
{
throw new ArgumentException(ErrorStreamCannotBeNull, "stream");
}
if (specials == null)
{
throw new ArgumentException(ErrorSpecialCharactersMustBeSpecified, "specials");
}
var lookup = new bool[char.MaxValue];
foreach (var ch in specials)
{
lookup[ch] = true;
}
var data = new StringBuilder();
using (var reader = new StreamReader(stream))
{
var next = new char[1];
int count;
do
{
count = reader.Read(next, 0, 1);
if (count == 0)
{
break;
}
if (!lookup[next[0]])
{
data.Append(next[0]);
continue;
}
if (data.Length > 0)
{
yield return new Token(TokenType.Data, data.ToString());
data.Length = 0;
}
yield return new Token(TokenType.Special, new String(next));
} while (count > 0);
}
if (data.Length > 0)
{
yield return new Token(TokenType.Data, data.ToString());
data.Length = 0;
}
}
}
} | mit | C# |
74168057c5e79e0118fbffc43533596c35a3ef12 | add one more possible character to the description variable definition | LiberisLabs/CompaniesHouse.NET,kevbite/CompaniesHouse.NET | src/LiberisLabs.CompaniesHouse/Description/DescriptionProvider.cs | src/LiberisLabs.CompaniesHouse/Description/DescriptionProvider.cs | using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;
namespace LiberisLabs.CompaniesHouse.Description
{
public class DescriptionProvider
{
private static readonly Regex _pattern = new Regex(@"({[a-zA-Z0-9.-_]*})");
public static string GetDescription(string format, JObject values)
{
if (values != null)
{
foreach (Match match in _pattern.Matches(format))
{
var placeHolder = match.Value;
var variableName = placeHolder.TrimStart('{').TrimEnd('}');
var variableValue = values.SelectToken(variableName);
if (variableValue != null)
{
format = format.Replace(placeHolder, variableValue.Value<string>());
}
}
}
return format;
}
}
}
| using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;
namespace LiberisLabs.CompaniesHouse.Description
{
public class DescriptionProvider
{
private static readonly Regex _pattern = new Regex(@"({[a-zA-Z0-9.-]*})");
public static string GetDescription(string format, JObject values)
{
if (values != null)
{
foreach (Match match in _pattern.Matches(format))
{
var placeHolder = match.Value;
var variableName = placeHolder.TrimStart('{').TrimEnd('}');
var variableValue = values.SelectToken(variableName);
if (variableValue != null)
{
format = format.Replace(placeHolder, variableValue.Value<string>());
}
}
}
return format;
}
}
}
| mit | C# |
15500a9f9931b22aee4e316a489559c8c123d977 | Fix BaseRecord load | SixLabors/Fonts | src/SixLabors.Fonts/Tables/AdvancedTypographic/GPos/BaseRecord.cs | src/SixLabors.Fonts/Tables/AdvancedTypographic/GPos/BaseRecord.cs | // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.Fonts.Tables.AdvancedTypographic.GPos
{
internal readonly struct BaseRecord
{
/// <summary>
/// Initializes a new instance of the <see cref="BaseRecord"/> struct.
/// </summary>
/// <param name="reader">The big endian binary reader.</param>
/// <param name="classCount">The class count.</param>
/// <param name="offset">Offset to the from beginning of BaseArray table.</param>
public BaseRecord(BigEndianBinaryReader reader, ushort classCount, long offset)
{
// +--------------+-----------------------------------+----------------------------------------------------------------------------------------+
// | Type | Name | Description |
// +==============+===================================+========================================================================================+
// | Offset16 | baseAnchorOffsets[markClassCount] | Array of offsets (one per mark class) to Anchor tables. |
// | | | Offsets are from beginning of BaseArray table, ordered by class (offsets may be NULL). |
// +--------------+-----------------------------------+----------------------------------------------------------------------------------------+
this.BaseAnchorTables = new AnchorTable[classCount];
for (int i = 0; i < classCount; i++)
{
ushort baseAnchorOffset = reader.ReadOffset16();
this.BaseAnchorTables[i] = AnchorTable.Load(reader, offset + baseAnchorOffset);
}
}
/// <summary>
/// Gets the base anchor tables.
/// </summary>
public AnchorTable[] BaseAnchorTables { get; }
}
}
| // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.Fonts.Tables.AdvancedTypographic.GPos
{
internal readonly struct BaseRecord
{
/// <summary>
/// Initializes a new instance of the <see cref="BaseRecord"/> struct.
/// </summary>
/// <param name="reader">The big endian binary reader.</param>
/// <param name="classCount">The class count.</param>
/// <param name="offset">Offset to the from beginning of BaseArray table.</param>
public BaseRecord(BigEndianBinaryReader reader, ushort classCount, long offset)
{
// +--------------+-----------------------------------+----------------------------------------------------------------------------------------+
// | Type | Name | Description |
// +==============+===================================+========================================================================================+
// | Offset16 | baseAnchorOffsets[markClassCount] | Array of offsets (one per mark class) to Anchor tables. |
// | | | Offsets are from beginning of BaseArray table, ordered by class (offsets may be NULL). |
// +--------------+-----------------------------------+----------------------------------------------------------------------------------------+
this.BaseAnchorTables = new AnchorTable[classCount];
for (int i = 0; i < classCount; i++)
{
ushort baseAnchorOffset = reader.ReadOffset16();
// Restore stream offset, after reading anchor table.
long readerPosition = reader.BaseStream.Position;
this.BaseAnchorTables[i] = AnchorTable.Load(reader, offset + baseAnchorOffset);
reader.BaseStream.Position = readerPosition;
}
}
/// <summary>
/// Gets the base anchor tables.
/// </summary>
public AnchorTable[] BaseAnchorTables { get; }
}
}
| apache-2.0 | C# |
61905857e0aaebee11657d4e5f11239808a40543 | Update NumberChainValidator.cs | kenshinthebattosai/KenChainer | KenChainer/Validators/NumberChainValidator.cs | KenChainer/Validators/NumberChainValidator.cs | using System.Linq;
using System.Text.RegularExpressions;
using KenChainer.Core;
namespace KenChainer.Validators
{
/// <summary>
/// Default rules for the problem go here.
/// Currently there are 3 rules:
/// Only 7 numbers
/// Only 6 operators
/// All 4 operators must be used
/// 2 operators must be used twice
/// </summary>
public class NumberChainValidator : INumberChainValidator
{
private static readonly Regex Operators = new Regex("\\+|\\-|x|\\/",
RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline);
public bool IsValid(NumberChain numberChain)
{
try
{
// Only seven numbers
if (numberChain.Length != 7)
return false;
var operators =
Operators.Matches(numberChain.ToString()).Cast<object>().Select(x => x.ToString()).ToList();
// Only 6 operators
if (operators.Count != 6) return false;
// All 4 operators should be used
var grouped = operators.GroupBy(x => x);
if (grouped.Count() != 4) return false;
// Maximum of 2 operators can be used twice
var groupedByCount = grouped.GroupBy(x => x.Count());
var countOfOperatorsUsedTwice = groupedByCount.FirstOrDefault(x => x.Key == 2)?.Count();
if (countOfOperatorsUsedTwice != 2)
return false;
// Validated
return true;
}
catch
{
return false;
}
}
}
}
| using System.Linq;
using System.Text.RegularExpressions;
using KenChainer.Core;
namespace KenChainer.Validators
{
/// <summary>
/// Defaults rules for the problem go here.
/// Currently there are 3 rules:
/// Only 7 numbers
/// Only 6 operators
/// All 4 operators must be used
/// 2 operators must be used twice
/// </summary>
public class NumberChainValidator : INumberChainValidator
{
private static readonly Regex Operators = new Regex("\\+|\\-|x|\\/",
RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline);
public bool IsValid(NumberChain numberChain)
{
try
{
// Only seven numbers
if (numberChain.Length != 7)
return false;
var operators =
Operators.Matches(numberChain.ToString()).Cast<object>().Select(x => x.ToString()).ToList();
// Only 6 operators
if (operators.Count != 6) return false;
// All 4 operators should be used
var grouped = operators.GroupBy(x => x);
if (grouped.Count() != 4) return false;
// Maximum of 2 operators can be used twice
var groupedByCount = grouped.GroupBy(x => x.Count());
var countOfOperatorsUsedTwice = groupedByCount.FirstOrDefault(x => x.Key == 2)?.Count();
if (countOfOperatorsUsedTwice != 2)
return false;
// Validated
return true;
}
catch
{
return false;
}
}
}
} | mit | C# |
c2c6b5a65e329c10acb3799af33837b59ceffcfc | update connectionstring | Pondidum/Ledger.Stores.Postgres,Pondidum/Ledger.Stores.Postgres | Ledger.Stores.Postgres.Tests/PostgresFixture.cs | Ledger.Stores.Postgres.Tests/PostgresFixture.cs | using System;
using System.Collections.Generic;
using System.Data;
using Dapper;
using Npgsql;
namespace Ledger.Stores.Postgres.Tests
{
public class PostgresFixture : IDisposable
{
public const string ConnectionString = "PORT=5432;TIMEOUT=60;POOLING=True;MINPOOLSIZE=1;MAXPOOLSIZE=20;COMMANDTIMEOUT=20;COMPATIBLE=2.1.3.0;HOST=10.0.75.2;USER ID=postgres;PASSWORD=postgres;DATABASE=postgres";
public static readonly EventStoreContext TestContext = new EventStoreContext("TestStream", new DefaultTypeResolver());
public NpgsqlConnection Connection { get; set; }
private readonly List<string> _streams;
public PostgresFixture()
{
_streams = new List<string>();
Connection = new NpgsqlConnection(ConnectionString);
Connection.Open();
var create = new CreateGuidAggregateTablesCommand(Connection);
create.Execute(TestContext.StreamName);
DropOnDispose(TestContext.StreamName);
}
public void DropOnDispose(string streamName)
{
_streams.Add(streamName);
}
public void Dispose()
{
try
{
foreach (var stream in _streams)
{
Connection.Execute($"drop table if exists {TableBuilder.EventsName(stream)};");
Connection.Execute($"drop table if exists {TableBuilder.SnapshotsName(stream)};");
}
}
catch (Exception)
{
//omg
}
if (Connection.State != ConnectionState.Closed)
{
Connection.Close();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Data;
using Dapper;
using Npgsql;
namespace Ledger.Stores.Postgres.Tests
{
public class PostgresFixture : IDisposable
{
public const string ConnectionString = "PORT=5432;TIMEOUT=60;POOLING=True;MINPOOLSIZE=1;MAXPOOLSIZE=20;COMMANDTIMEOUT=20;COMPATIBLE=2.1.3.0;HOST=192.168.99.100;USER ID=postgres;PASSWORD=postgres;DATABASE=postgres";
public static readonly EventStoreContext TestContext = new EventStoreContext("TestStream", new DefaultTypeResolver());
public NpgsqlConnection Connection { get; set; }
private readonly List<string> _streams;
public PostgresFixture()
{
_streams = new List<string>();
Connection = new NpgsqlConnection(ConnectionString);
Connection.Open();
var create = new CreateGuidAggregateTablesCommand(Connection);
create.Execute(TestContext.StreamName);
DropOnDispose(TestContext.StreamName);
}
public void DropOnDispose(string streamName)
{
_streams.Add(streamName);
}
public void Dispose()
{
try
{
foreach (var stream in _streams)
{
Connection.Execute($"drop table if exists {TableBuilder.EventsName(stream)};");
Connection.Execute($"drop table if exists {TableBuilder.SnapshotsName(stream)};");
}
}
catch (Exception)
{
//omg
}
if (Connection.State != ConnectionState.Closed)
{
Connection.Close();
}
}
}
}
| lgpl-2.1 | C# |
993295a0d9ca682f38aee59979c4130fd3609364 | Update objects in batches during select | PearMed/Pear-Interaction-Engine | Assets/Pear.InteractionEngine/Examples/KeyboardController/Scripts/SelectWithKeyboard.cs | Assets/Pear.InteractionEngine/Examples/KeyboardController/Scripts/SelectWithKeyboard.cs | using System;
using Pear.InteractionEngine.Controllers;
using Pear.InteractionEngine.Controllers.Behaviors;
using Pear.InteractionEngine.Interactables;
using Pear.InteractionEngine.Properties;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
namespace Pear.InteractionEngine.Examples
{
[RequireComponent (typeof(GazeHover))]
public class SelectWithKeyboard : ControllerBehavior<Controller>, IGameObjectPropertyEvent<bool>
{
[Tooltip("Selection key")]
public KeyCode SelectKey = KeyCode.P;
public delegate void SelectedEventHandler(GameObject gameObject);
public event SelectedEventHandler SelectedEvent;
private GazeHover _hoverOnGaze;
GameObject _lastSelectedObj;
private List<GameObjectProperty<bool>> _properties = new List<GameObjectProperty<bool>>();
// Use this for initialization
void Start()
{
_hoverOnGaze = GetComponent<GazeHover>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyUp(SelectKey) && _hoverOnGaze.HoveredObject != null)
{
List<GameObjectProperty<bool>> selectedProperties = _properties.Where(p => p.Owner == _hoverOnGaze.HoveredObject).ToList();
if (selectedProperties.Count > 0)
{
GameObjectProperty<bool> representativeProp = selectedProperties.First();
if (representativeProp.Value)
{
selectedProperties.ForEach(p => p.Value = false);
_lastSelectedObj = null;
}
else
{
selectedProperties.ForEach(p => p.Value = true);
if (SelectedEvent != null)
SelectedEvent(representativeProp.Owner);
if(_lastSelectedObj != null)
_properties.Where(p => p.Owner == _lastSelectedObj).ToList().ForEach(p => p.Value = false);
_lastSelectedObj = representativeProp.Owner;
}
}
}
}
public void RegisterProperty(GameObjectProperty<bool> property)
{
_properties.Add(property);
}
public void UnregisterProperty(GameObjectProperty<bool> property)
{
_properties.Remove(property);
}
}
} | using System;
using Pear.InteractionEngine.Controllers;
using Pear.InteractionEngine.Controllers.Behaviors;
using Pear.InteractionEngine.Interactables;
using Pear.InteractionEngine.Properties;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
namespace Pear.InteractionEngine.Examples
{
[RequireComponent (typeof(GazeHover))]
public class SelectWithKeyboard : ControllerBehavior<Controller>, IGameObjectPropertyEvent<bool>
{
[Tooltip("Selection key")]
public KeyCode SelectKey = KeyCode.P;
public delegate void SelectedEventHandler(GameObject gameObject);
public event SelectedEventHandler SelectedEvent;
private GazeHover _hoverOnGaze;
GameObjectProperty<bool> _lastSelectedProperty;
private List<GameObjectProperty<bool>> _properties = new List<GameObjectProperty<bool>>();
// Use this for initialization
void Start()
{
_hoverOnGaze = GetComponent<GazeHover>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyUp(SelectKey) && _hoverOnGaze.HoveredObject != null)
{
GameObjectProperty<bool> selectedProperty = _properties.FirstOrDefault(p => p.Owner == _hoverOnGaze.HoveredObject);
if(selectedProperty != null)
{
if (selectedProperty.Value)
{
selectedProperty.Value = false;
_lastSelectedProperty = null;
}
else
{
selectedProperty.Value = true;
if (SelectedEvent != null)
SelectedEvent(selectedProperty.Owner);
if (_lastSelectedProperty != null)
_lastSelectedProperty.Value = false;
_lastSelectedProperty = selectedProperty;
}
}
}
}
public void RegisterProperty(GameObjectProperty<bool> property)
{
_properties.Add(property);
}
public void UnregisterProperty(GameObjectProperty<bool> property)
{
_properties.Remove(property);
}
}
} | mit | C# |
cc8c2683fd6cc90a145d3fd58ba3c1b46acf98eb | Fix issue in a converter | FabienLavocat/kodi-remote | src/KodiRemote.Wp81/Converters/ShorterStringConverter.cs | src/KodiRemote.Wp81/Converters/ShorterStringConverter.cs | using System;
using System.Globalization;
using System.Windows.Data;
namespace KodiRemote.Wp81.Converters
{
public class ShorterStringConverter : IValueConverter
{
public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || parameter == null) return string.Empty;
int max;
if (!int.TryParse(parameter.ToString(), out max)) return value;
string str = value.ToString();
if (str.Length <= max) return str;
return str.Substring(0, max - 3) + "...";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
} | using System;
using System.Globalization;
using System.Windows.Data;
namespace KodiRemote.Wp81.Converters
{
public class ShorterStringConverter : IValueConverter
{
public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = value.ToString();
int max;
if (!int.TryParse(parameter.ToString(), out max)) return str;
if (str.Length <= max) return str;
return str.Substring(0, max - 3) + "...";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
} | mit | C# |
c6846f14520b96924d37f067b64d1cc7f36ebe34 | Reduce lock contention on method239 | HelloKitty/317refactor | src/Rs317.Client.OpenTK/Rendering/OpenTKImageProducer.cs | src/Rs317.Client.OpenTK/Rendering/OpenTKImageProducer.cs | using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.CompilerServices;
namespace Rs317.Sharp
{
public sealed class OpenTKImageProducer : BaseRsImageProducer<OpenTKRsGraphicsContext>, IOpenTKImageRenderable
{
private Bitmap image { get; }
private FasterPixel FasterPixel { get; }
public bool isDirty { get; private set; } = true; //Always initially dirty.
public IntPtr ImageDataPointer { get; }
public Rectangle ImageLocation { get; private set; }
public object SyncObject { get; } = new object();
private bool accessedPixelBuffer { get; set; } = false;
public OpenTKImageProducer(int width, int height)
: base(width, height)
{
image = new Bitmap(width, height);
BitmapData data = image.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, image.PixelFormat);
ImageDataPointer = data.Scan0;
image.UnlockBits(data);
FasterPixel = new FasterPixel(image);
initDrawingArea();
ImageLocation = new Rectangle(0, 0, width, height);
}
public void ConsumeDirty()
{
lock (SyncObject)
isDirty = false;
}
public override int[] pixels
{
get
{
lock (SyncObject)
accessedPixelBuffer = true;
return base.pixels;
}
}
protected override void OnBeforeInternalDrawGraphics(int x, int z)
{
method239();
}
protected override void InternalDrawGraphics(int x, int y, IRSGraphicsProvider<OpenTKRsGraphicsContext> rsGraphicsProvider)
{
ImageLocation = new Rectangle(x, y, width, height);
//It's only dirty if they accessed the pixel buffer.
//TODO: We can optimize around this in the client itself.
lock (SyncObject)
{
if(accessedPixelBuffer)
isDirty = true;
accessedPixelBuffer = false;
}
}
private void method239()
{
FasterPixel.Lock();
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
int value = pixels[x + y * width];
//fastPixel.SetPixel(x, y, Color.FromArgb((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF));
FasterPixel.SetPixel(x, y, (byte)(value >> 16), (byte)(value >> 8), (byte)value, 255);
}
}
FasterPixel.Unlock(true);
}
}
}
| using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.CompilerServices;
namespace Rs317.Sharp
{
public sealed class OpenTKImageProducer : BaseRsImageProducer<OpenTKRsGraphicsContext>, IOpenTKImageRenderable
{
private Bitmap image { get; }
private FasterPixel FasterPixel { get; }
public bool isDirty { get; private set; } = true; //Always initially dirty.
public IntPtr ImageDataPointer { get; }
public Rectangle ImageLocation { get; private set; }
public object SyncObject { get; } = new object();
private bool accessedPixelBuffer { get; set; } = false;
public OpenTKImageProducer(int width, int height)
: base(width, height)
{
image = new Bitmap(width, height);
BitmapData data = image.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, image.PixelFormat);
ImageDataPointer = data.Scan0;
image.UnlockBits(data);
FasterPixel = new FasterPixel(image);
initDrawingArea();
ImageLocation = new Rectangle(0, 0, width, height);
}
public void ConsumeDirty()
{
lock (SyncObject)
isDirty = false;
}
public override int[] pixels
{
get
{
lock (SyncObject)
accessedPixelBuffer = true;
return base.pixels;
}
}
protected override void OnBeforeInternalDrawGraphics(int x, int z)
{
lock(SyncObject)
method239();
}
protected override void InternalDrawGraphics(int x, int y, IRSGraphicsProvider<OpenTKRsGraphicsContext> rsGraphicsProvider)
{
ImageLocation = new Rectangle(x, y, width, height);
//It's only dirty if they accessed the pixel buffer.
//TODO: We can optimize around this in the client itself.
lock (SyncObject)
{
if(accessedPixelBuffer)
isDirty = true;
accessedPixelBuffer = false;
}
}
private void method239()
{
FasterPixel.Lock();
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
int value = pixels[x + y * width];
//fastPixel.SetPixel(x, y, Color.FromArgb((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF));
FasterPixel.SetPixel(x, y, (byte)(value >> 16), (byte)(value >> 8), (byte)value, 255);
}
}
FasterPixel.Unlock(true);
}
}
}
| mit | C# |
dae91f2b020bace153f24f92582a626ea2937212 | Add Load(); | dataccountzXJ9/Lynx | Lynx/Core/Core.cs | Lynx/Core/Core.cs | using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Microsoft.Extensions.DependencyInjection;
using Discord.WebSocket;
using System;
using Lynx.Handler;
using Lynx.Database;
namespace Lynx
{
public class Core
{
static void Main(string[] args) => new Core().Start().GetAwaiter().GetResult();
DiscordSocketClient Client;
CommandHandler Handler;
EventsHandler EHandler;
public async Task Start()
{
Client = new DiscordSocketClient(new DiscordSocketConfig
{
MessageCacheSize = 500000,
LogLevel = LogSeverity.Verbose,
});
await Client.CheckBotConfig();
await EventsHandler.Load();
await Client.LoginAsync(TokenType.Bot, Client.LoadBotConfig().BotToken);
await Client.StartAsync();
Client.Log += (Log) => Task.Run(() =>
Services.Log.CLog(Services.Source.Client, Log.Message));
var provider = ConfigureServices();
Handler = new CommandHandler(provider);
EHandler = new EventsHandler(provider);
await Handler.ConfigureAsync();
await Task.Delay(-1);
}
IServiceProvider ConfigureServices()
{
var services = new ServiceCollection()
.AddSingleton(Client)
.AddSingleton(new CommandService(new CommandServiceConfig { CaseSensitiveCommands = false, ThrowOnError = false }));
var provider = new DefaultServiceProviderFactory().CreateServiceProvider(services);
return provider;
}
}
} | using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Microsoft.Extensions.DependencyInjection;
using Discord.WebSocket;
using System;
using Lynx.Handler;
using Lynx.Database;
namespace Lynx
{
public class Core
{
static void Main(string[] args) => new Core().Start().GetAwaiter().GetResult();
DiscordSocketClient Client;
CommandHandler Handler;
EventsHandler EHandler;
public async Task Start()
{
Client = new DiscordSocketClient(new DiscordSocketConfig
{
MessageCacheSize = 500000,
LogLevel = LogSeverity.Verbose,
});
await Client.CheckBotConfig();
await Client.CheckMuteList();
await Client.LoginAsync(TokenType.Bot, Client.LoadBotConfig().BotToken);
await Client.StartAsync();
Client.Log += (Log) => Task.Run(() =>
Services.Log.CLog(Services.Source.Client, Log.Message));
var provider = ConfigureServices();
Handler = new CommandHandler(provider);
EHandler = new EventsHandler(provider);
await Handler.ConfigureAsync();
await Task.Delay(-1);
}
IServiceProvider ConfigureServices()
{
var services = new ServiceCollection()
.AddSingleton(Client)
.AddSingleton(new CommandService(new CommandServiceConfig { CaseSensitiveCommands = false, ThrowOnError = false }));
var provider = new DefaultServiceProviderFactory().CreateServiceProvider(services);
return provider;
}
}
} | mit | C# |
22fb17422f63d3b8a8220a006768909f2dbc64fa | handle -? and /? arguments as help | EdwardBlair/cli,blackdwarf/cli,Faizan2304/cli,ravimeda/cli,svick/cli,ravimeda/cli,EdwardBlair/cli,harshjain2/cli,livarcocc/cli-1,dasMulli/cli,blackdwarf/cli,Faizan2304/cli,ravimeda/cli,blackdwarf/cli,dasMulli/cli,johnbeisner/cli,svick/cli,EdwardBlair/cli,johnbeisner/cli,livarcocc/cli-1,blackdwarf/cli,dasMulli/cli,harshjain2/cli,Faizan2304/cli,livarcocc/cli-1,harshjain2/cli,johnbeisner/cli,svick/cli | src/dotnet/ParseResultExtensions.cs | src/dotnet/ParseResultExtensions.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
namespace Microsoft.DotNet.Cli
{
public static class ParseResultExtensions
{
public static void ShowHelp(this ParseResult parseResult) =>
Console.WriteLine(parseResult.Command().HelpView());
public static void ShowHelpOrErrorIfAppropriate(this ParseResult parseResult)
{
var appliedCommand = parseResult.AppliedCommand();
if (appliedCommand.HasOption("help") ||
appliedCommand.Arguments.Contains("-?") ||
appliedCommand.Arguments.Contains("/?"))
{
// NOTE: this is a temporary stage in refactoring toward the ClicCommandLineParser being used at the CLI entry point.
throw new HelpException(parseResult.Command().HelpView());
}
if (parseResult.Errors.Any())
{
throw new CommandParsingException(
string.Join(Environment.NewLine,
parseResult.Errors.Select(e => e.Message)));
}
}
}
} | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
namespace Microsoft.DotNet.Cli
{
public static class ParseResultExtensions
{
public static void ShowHelp(this ParseResult parseResult) =>
Console.WriteLine(parseResult.Command().HelpView());
public static void ShowHelpOrErrorIfAppropriate(this ParseResult parseResult)
{
if (parseResult.AppliedCommand().HasOption("help"))
{
// NOTE: this is a temporary stage in refactoring toward the ClicCommandLineParser being used at the CLI entry point.
throw new HelpException(parseResult.Command().HelpView());
}
if (parseResult.Errors.Any())
{
throw new CommandParsingException(
string.Join(Environment.NewLine,
parseResult.Errors.Select(e => e.Message)));
}
}
}
} | mit | C# |
9555301483ea98f22230e2e5f45392856cc0b753 | Use case-sensitive path for showModal.js (#1728) | c0g1t8/allReady,stevejgordon/allReady,HTBox/allReady,VishalMadhvani/allReady,bcbeatty/allReady,HamidMosalla/allReady,anobleperson/allReady,MisterJames/allReady,arst/allReady,HamidMosalla/allReady,dpaquette/allReady,GProulx/allReady,anobleperson/allReady,mgmccarthy/allReady,mgmccarthy/allReady,c0g1t8/allReady,stevejgordon/allReady,binaryjanitor/allReady,c0g1t8/allReady,arst/allReady,GProulx/allReady,MisterJames/allReady,HamidMosalla/allReady,GProulx/allReady,VishalMadhvani/allReady,binaryjanitor/allReady,chinwobble/allReady,gitChuckD/allReady,BillWagner/allReady,HTBox/allReady,jonatwabash/allReady,dpaquette/allReady,MisterJames/allReady,bcbeatty/allReady,chinwobble/allReady,jonatwabash/allReady,chinwobble/allReady,GProulx/allReady,arst/allReady,MisterJames/allReady,BillWagner/allReady,binaryjanitor/allReady,dpaquette/allReady,binaryjanitor/allReady,bcbeatty/allReady,BillWagner/allReady,dpaquette/allReady,VishalMadhvani/allReady,HTBox/allReady,anobleperson/allReady,HTBox/allReady,gitChuckD/allReady,anobleperson/allReady,stevejgordon/allReady,jonatwabash/allReady,mgmccarthy/allReady,gitChuckD/allReady,mgmccarthy/allReady,gitChuckD/allReady,bcbeatty/allReady,c0g1t8/allReady,arst/allReady,stevejgordon/allReady,jonatwabash/allReady,HamidMosalla/allReady,BillWagner/allReady,VishalMadhvani/allReady,chinwobble/allReady | AllReadyApp/Web-App/AllReady/Views/Event/_EventScripts.cshtml | AllReadyApp/Web-App/AllReady/Views/Event/_EventScripts.cshtml | @using AllReady.ViewModels.Event
@model EventViewModel
<script type="text/javascript">
$(document).ready(function() {
getGeoCoordinates('@Model.Location?.Address1',
'@Model.Location?.Address2',
'@Model.Location?.City',
'@Model.Location?.State',
'@Model.Location?.PostalCode',
'@Model.Location?.Country',
function(result) {
var positionCoordsList = [
{ latitude: result.latitude, longitude: result.longitude }
];
$("#bingMap").css("width", "300px").css("height", "300px");
renderBingMap('bingMap', positionCoordsList);
});
});
var modelStuff = @Json.Serialize(new
{
tasks = Model.Tasks,
userTasks = Model.UserTasks,
eventSkills = Model.RequiredSkills,
userSkills = Model.UserSkills,
signupModelSeed = Model.SignupModel,
eventTitle = Model.Title,
isSignedIn = User.Identity.IsAuthenticated,
loginUrl = "/Account/Login?ReturnUrl=/Event/" + @Model.Id
});
</script>
<script type="text/javascript" src="~/js/ko.bindings.js"></script>
<script type="text/javascript" src="~/lib/knockout-mapping/knockout.mapping.js"></script>
<script type="text/javascript" src="~/js/event.js"></script>
<script type="text/javascript" src="~/js/showModal.js"></script>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> | @using AllReady.ViewModels.Event
@model EventViewModel
<script type="text/javascript">
$(document).ready(function() {
getGeoCoordinates('@Model.Location?.Address1',
'@Model.Location?.Address2',
'@Model.Location?.City',
'@Model.Location?.State',
'@Model.Location?.PostalCode',
'@Model.Location?.Country',
function(result) {
var positionCoordsList = [
{ latitude: result.latitude, longitude: result.longitude }
];
$("#bingMap").css("width", "300px").css("height", "300px");
renderBingMap('bingMap', positionCoordsList);
});
});
var modelStuff = @Json.Serialize(new
{
tasks = Model.Tasks,
userTasks = Model.UserTasks,
eventSkills = Model.RequiredSkills,
userSkills = Model.UserSkills,
signupModelSeed = Model.SignupModel,
eventTitle = Model.Title,
isSignedIn = User.Identity.IsAuthenticated,
loginUrl = "/Account/Login?ReturnUrl=/Event/" + @Model.Id
});
</script>
<script type="text/javascript" src="~/js/ko.bindings.js"></script>
<script type="text/javascript" src="~/lib/knockout-mapping/knockout.mapping.js"></script>
<script type="text/javascript" src="~/js/event.js"></script>
<script type="text/javascript" src="~/js/showmodal.js"></script>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script> | mit | C# |
a6207d817d3cf6ec4070d99c20d72b6a97f25573 | Update Rage.cs (#47) | BosslandGmbH/BuddyWing.DefaultCombat | trunk/DefaultCombat/Routines/Advanced/Juggernaut/Rage.cs | trunk/DefaultCombat/Routines/Advanced/Juggernaut/Rage.cs | // Copyright (C) 2011-2016 Bossland GmbH
// See the file LICENSE for the source code's detailed license
using Buddy.BehaviorTree;
using DefaultCombat.Core;
using DefaultCombat.Helpers;
namespace DefaultCombat.Routines
{
internal class Rage : RotationBase
{
public override string Name
{
get { return "Juggernaut Rage"; }
}
public override Composite Buffs
{
get
{
return new PrioritySelector(
Spell.Buff("Unnatural Might")
);
}
}
public override Composite Cooldowns
{
get
{
return new PrioritySelector(
Spell.Buff("Unleash", ret => Me.IsStunned),
Spell.Buff("Saber Reflect", ret => Me.HealthPercent <= 90),
Spell.Buff("Saber Ward", ret => Me.HealthPercent <= 70),
Spell.Buff("Endure Pain", ret => Me.HealthPercent <= 30),
Spell.Buff("Enrage", ret => Me.ActionPoints <= 6)
);
}
}
public override Composite SingleTarget
{
get
{
return new PrioritySelector(
Spell.Cast("Saber Throw", ret => !DefaultCombat.MovementDisabled && Me.CurrentTarget.Distance >= 0.5f && Me.CurrentTarget.Distance <= 3f),
Spell.Cast("Force Charge", ret => !DefaultCombat.MovementDisabled && Me.CurrentTarget.Distance >= 1f && Me.CurrentTarget.Distance <= 3f),
//Movement
CombatMovement.CloseDistance(Distance.Melee),
//Rotation
Spell.Cast("Vicious Throw", ret => Me.CurrentTarget.HealthPercent <= 30),
Spell.Cast("Smash", ret => Me.BuffCount("Shockwave") == 3 && Me.HasBuff("Dominate") && Me.CurrentTarget.Distance <= 0.5f),
Spell.Cast("Force Choke", ret => Me.BuffCount("Shockwave") < 4),
Spell.Cast("Force Crush", ret => Me.BuffCount("Shockwave") < 4),
Spell.Cast("Obliterate", ret => Me.HasBuff("Shockwave")),
Spell.Cast("Force Scream", ret => Me.HasBuff("Battle Cry") || Me.ActionPoints >= 5),
Spell.Cast("Ravage"),
Spell.Cast("Vicious Slash"),
Spell.Cast("Sundering Assault", ret => Me.CurrentTarget.DebuffCount("Armor Reduced") <= 5),
Spell.Cast("Assault")
);
}
}
public override Composite AreaOfEffect
{
get
{
return new Decorator(ret => Targeting.ShouldPbaoe,
new PrioritySelector(
Spell.Cast("Smash"),
Spell.Cast("Sweeping Slash")
));
}
}
}
}
| // Copyright (C) 2011-2016 Bossland GmbH
// See the file LICENSE for the source code's detailed license
using Buddy.BehaviorTree;
using DefaultCombat.Core;
using DefaultCombat.Helpers;
namespace DefaultCombat.Routines
{
internal class Rage : RotationBase
{
public override string Name
{
get { return "Juggernaut Rage"; }
}
public override Composite Buffs
{
get
{
return new PrioritySelector(
Spell.Buff("Shii-Cho Form"),
Spell.Buff("Unnatural Might")
);
}
}
public override Composite Cooldowns
{
get
{
return new PrioritySelector(
Spell.Buff("Unleash", ret => Me.IsStunned),
Spell.Buff("Saber Reflect", ret => Me.HealthPercent <= 90),
Spell.Buff("Saber Ward", ret => Me.HealthPercent <= 70),
Spell.Buff("Endure Pain", ret => Me.HealthPercent <= 30),
Spell.Buff("Enrage", ret => Me.ActionPoints <= 6)
);
}
}
public override Composite SingleTarget
{
get
{
return new PrioritySelector(
Spell.Cast("Saber Throw",
ret => !DefaultCombat.MovementDisabled && Me.CurrentTarget.Distance >= 0.5f && Me.CurrentTarget.Distance <= 3f),
Spell.Cast("Force Charge",
ret => !DefaultCombat.MovementDisabled && Me.CurrentTarget.Distance >= 1f && Me.CurrentTarget.Distance <= 3f),
//Movement
CombatMovement.CloseDistance(Distance.Melee),
//Rotation
Spell.Cast("Vicious Throw", ret => Me.CurrentTarget.HealthPercent <= 30),
Spell.Cast("Smash",
ret => Me.BuffCount("Shockwave") == 3 && Me.HasBuff("Dominate") && Me.CurrentTarget.Distance <= 0.5f),
Spell.Cast("Force Choke", ret => Me.BuffCount("Shockwave") < 4),
Spell.Cast("Force Crush", ret => Me.BuffCount("Shockwave") < 4),
Spell.Cast("Obliterate", ret => Me.HasBuff("Shockwave")),
Spell.Cast("Force Scream", ret => Me.HasBuff("Battle Cry") || Me.ActionPoints >= 5),
Spell.Cast("Ravage"),
Spell.Cast("Vicious Slash"),
Spell.Cast("Sundering Assault", ret => Me.CurrentTarget.DebuffCount("Armor Reduced") <= 5),
Spell.Cast("Assault")
);
}
}
public override Composite AreaOfEffect
{
get
{
return new Decorator(ret => Targeting.ShouldPbaoe,
new PrioritySelector(
Spell.Cast("Smash"),
Spell.Cast("Sweeping Slash")
));
}
}
}
} | apache-2.0 | C# |
98cfddf47be301ca3f03f41275164feb72c695d8 | Fix tabs | WojcikMike/docs.particular.net | Snippets/Snippets_6/Persistence/Custom/Usage.cs | Snippets/Snippets_6/Persistence/Custom/Usage.cs | namespace Snippets4.Persistence.Custom
{
using NServiceBus;
class Usage
{
public Usage()
{
#region PersistTimeoutsInterfaces
public interface IPersistTimeouts
{
//TODO: modify once v6 fix is ready
}
#endregion
}
}
}
| namespace Snippets4.Persistence.Custom
{
using NServiceBus;
class Usage
{
public Usage()
{
#region PersistTimeoutsInterfaces
public interface IPersistTimeouts
{
//TODO: modify once v6 fix is ready
}
#endregion
}
}
} | apache-2.0 | C# |
2b56238a6037b227e1d8a755174af535baf91b3a | Clean up engine bindings assembly info. | rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D | Source/Urho3D/CSharp/Properties/AssemblyInfo.cs | Source/Urho3D/CSharp/Properties/AssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Urho3DNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Urho3D")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Urho3DNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Urho3D")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58DA6FEF-5C52-4CB9-9E0E-C9621ABFAB76")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
996f4774a7059e2ffca65f935350f39e80410501 | Fix !lb! token in ingameOverlay | Piotrekol/StreamCompanion,Piotrekol/StreamCompanion | osu!StreamCompanion/Code/Modules/MapDataGetters/FileMap/FileMapDataGetter.cs | osu!StreamCompanion/Code/Modules/MapDataGetters/FileMap/FileMapDataGetter.cs | using System;
using System.Collections.Generic;
using osu_StreamCompanion.Code.Core.DataTypes;
using osu_StreamCompanion.Code.Interfaces;
using osu_StreamCompanion.Code.Modules.MapDataParsers.Parser1;
namespace osu_StreamCompanion.Code.Modules.MapDataGetters.FileMap
{
public class FileMapDataGetter : IModule, IMapDataGetter,IDisposable
{
public bool Started { get; set; }
private readonly FileMapManager _fileMapManager = new FileMapManager();
private ILogger _logger;
public void Start(ILogger logger)
{
_logger = logger;
Started = true;
}
public void SetNewMap(MapSearchResult map)
{
var ingamePatterns = new List<string>();
foreach (var s in map.FormatedStrings)
{
var name = $"SC-{s.Name}";
if (s.ShowInOsu)
{
ingamePatterns.Add(name);
}
string valueToWrite = (s.SaveEvent & map.Action) != 0 ? s.GetFormatedPattern() : " ";
if (s.ShowInOsu)
{
var configName = "conf-" + name;
var valueName = "value-" + name;
var config = $"{s.XPosition} {s.YPosition} {s.Color.R} {s.Color.G} {s.Color.B} {s.FontName.Replace(' ','/')} {s.FontSize}";
_fileMapManager.Write(configName, config);
if (!s.IsMemoryFormat)
_fileMapManager.Write(valueName, valueToWrite.Replace("\r", ""));
}
if (!s.IsMemoryFormat)
_fileMapManager.Write(name, valueToWrite);
}
_fileMapManager.Write("Sc-ingamePatterns", string.Join(" ", ingamePatterns)+" ");
}
public void Dispose()
{
_fileMapManager.Write("Sc-ingamePatterns", " ");
}
}
} | using System;
using System.Collections.Generic;
using osu_StreamCompanion.Code.Core.DataTypes;
using osu_StreamCompanion.Code.Interfaces;
using osu_StreamCompanion.Code.Modules.MapDataParsers.Parser1;
namespace osu_StreamCompanion.Code.Modules.MapDataGetters.FileMap
{
public class FileMapDataGetter : IModule, IMapDataGetter,IDisposable
{
public bool Started { get; set; }
private readonly FileMapManager _fileMapManager = new FileMapManager();
private ILogger _logger;
public void Start(ILogger logger)
{
_logger = logger;
Started = true;
}
public void SetNewMap(MapSearchResult map)
{
var ingamePatterns = new List<string>();
foreach (var s in map.FormatedStrings)
{
var name = $"SC-{s.Name}";
if (s.ShowInOsu)
{
ingamePatterns.Add(name);
}
string valueToWrite = (s.SaveEvent & map.Action) != 0 ? s.GetFormatedPattern() : " ";
if (s.ShowInOsu)
{
var configName = "conf-" + name;
var valueName = "value-" + name;
var config = $"{s.XPosition} {s.YPosition} {s.Color.R} {s.Color.G} {s.Color.B} {s.FontName.Replace(' ','/')} {s.FontSize}";
_fileMapManager.Write(configName, config);
if (!s.IsMemoryFormat)
_fileMapManager.Write(valueName, valueToWrite);
}
if (!s.IsMemoryFormat)
_fileMapManager.Write(name, valueToWrite);
}
_fileMapManager.Write("Sc-ingamePatterns", string.Join(" ", ingamePatterns)+" ");
}
public void Dispose()
{
_fileMapManager.Write("Sc-ingamePatterns", " ");
}
}
} | mit | C# |
f2fa90c7b22a2dc970fbd00d21c269d151523964 | add IgnorePhone identity configuration extension | tc-dev/tc-dev.Core | src/tc-dev.Core.Infrastructure/EntityFramework/Configurations/IdentityConfigurations.cs | src/tc-dev.Core.Infrastructure/EntityFramework/Configurations/IdentityConfigurations.cs | using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using tc_dev.Core.Infrastructure.Identity.Models;
namespace tc_dev.Core.Infrastructure.EntityFramework.Configurations
{
public static class IdentityConfigurations
{
public static void Configure(this EntityTypeConfiguration<AppIdentityUser> source) {
source
.ToTable("IdentityUser")
.Property(m => m.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
public static void Configure(this EntityTypeConfiguration<AppIdentityRole> source) {
source
.ToTable("IdentityRole")
.Property(m => m.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
public static void Configure(this EntityTypeConfiguration<AppIdentityUserRole> source) {
source
.ToTable("IdentityUserRole");
}
public static void Configure(this EntityTypeConfiguration<AppIdentityUserLogin> source) {
source
.ToTable("IdentityUserLogin");
}
public static void Configure(this EntityTypeConfiguration<AppIdentityUserClaim> source) {
source
.ToTable("IdentityUserClaim")
.Property(m => m.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
public static void IgnorePhone(this EntityTypeConfiguration<AppIdentityUser> source) {
source
.Ignore(m => m.PhoneNumber)
.Ignore(m => m.PhoneNumberConfirmed);
}
}
}
| using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using tc_dev.Core.Infrastructure.Identity.Models;
namespace tc_dev.Core.Infrastructure.EntityFramework.Configurations
{
public static class IdentityConfigurations
{
public static void Configure(this EntityTypeConfiguration<AppIdentityUser> source) {
source
.ToTable("IdentityUser")
.Property(m => m.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
public static void Configure(this EntityTypeConfiguration<AppIdentityRole> source) {
source
.ToTable("IdentityRole")
.Property(m => m.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
public static void Configure(this EntityTypeConfiguration<AppIdentityUserRole> source) {
source
.ToTable("IdentityUserRole");
}
public static void Configure(this EntityTypeConfiguration<AppIdentityUserLogin> source) {
source
.ToTable("IdentityUserLogin");
}
public static void Configure(this EntityTypeConfiguration<AppIdentityUserClaim> source) {
source
.ToTable("IdentityUserClaim")
.Property(m => m.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
}
}
| mit | C# |
bc70754dbeeeabaaf90d59f73b33b70384fb35f5 | Remove unused method on DateTimeOffsetConvertrer and consolidated code | HamidMosalla/allReady,MisterJames/allReady,binaryjanitor/allReady,c0g1t8/allReady,anobleperson/allReady,HTBox/allReady,binaryjanitor/allReady,chinwobble/allReady,arst/allReady,bcbeatty/allReady,arst/allReady,MisterJames/allReady,c0g1t8/allReady,shanecharles/allReady,VishalMadhvani/allReady,bcbeatty/allReady,bcbeatty/allReady,pranap/allReady,GProulx/allReady,jonatwabash/allReady,MisterJames/allReady,shanecharles/allReady,mipre100/allReady,bcbeatty/allReady,enderdickerson/allReady,mgmccarthy/allReady,pranap/allReady,anobleperson/allReady,HTBox/allReady,enderdickerson/allReady,dpaquette/allReady,colhountech/allReady,forestcheng/allReady,mipre100/allReady,BillWagner/allReady,GProulx/allReady,GProulx/allReady,HamidMosalla/allReady,mipre100/allReady,dpaquette/allReady,dpaquette/allReady,pranap/allReady,GProulx/allReady,mipre100/allReady,forestcheng/allReady,chinwobble/allReady,BillWagner/allReady,arst/allReady,forestcheng/allReady,HTBox/allReady,VishalMadhvani/allReady,enderdickerson/allReady,BillWagner/allReady,stevejgordon/allReady,gitChuckD/allReady,jonatwabash/allReady,chinwobble/allReady,jonatwabash/allReady,colhountech/allReady,mgmccarthy/allReady,stevejgordon/allReady,HTBox/allReady,stevejgordon/allReady,chinwobble/allReady,JowenMei/allReady,MisterJames/allReady,anobleperson/allReady,gitChuckD/allReady,arst/allReady,jonatwabash/allReady,VishalMadhvani/allReady,enderdickerson/allReady,VishalMadhvani/allReady,binaryjanitor/allReady,mgmccarthy/allReady,HamidMosalla/allReady,gitChuckD/allReady,JowenMei/allReady,gitChuckD/allReady,forestcheng/allReady,dpaquette/allReady,stevejgordon/allReady,colhountech/allReady,pranap/allReady,HamidMosalla/allReady,mgmccarthy/allReady,shanecharles/allReady,shanecharles/allReady,c0g1t8/allReady,BillWagner/allReady,binaryjanitor/allReady,colhountech/allReady,JowenMei/allReady,anobleperson/allReady,JowenMei/allReady,c0g1t8/allReady | AllReadyApp/Web-App/AllReady/Providers/DateTimeOffsetConverter.cs | AllReadyApp/Web-App/AllReady/Providers/DateTimeOffsetConverter.cs | using System;
namespace AllReady.Providers
{
public interface IConvertDateTimeOffset
{
DateTimeOffset ConvertDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0);
}
public class DateTimeOffsetConverter : IConvertDateTimeOffset
{
public DateTimeOffset ConvertDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0)
{
var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
return new DateTimeOffset(dateTimeOffset.Year, dateTimeOffset.Month, dateTimeOffset.Day, hour, minute, second, timeZoneInfo.GetUtcOffset(dateTimeOffset));
}
}
} | using System;
namespace AllReady.Providers
{
public interface IConvertDateTimeOffset
{
DateTimeOffset ConvertDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0);
DateTimeOffset ConvertDateTimeOffsetTo(TimeZoneInfo timeZoneInfo, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0);
}
public class DateTimeOffsetConverter : IConvertDateTimeOffset
{
public DateTimeOffset ConvertDateTimeOffsetTo(string timeZoneId, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0)
{
return ConvertDateTimeOffsetTo(FindSystemTimeZoneBy(timeZoneId), dateTimeOffset, hour, minute, second);
}
public DateTimeOffset ConvertDateTimeOffsetTo(TimeZoneInfo timeZoneInfo, DateTimeOffset dateTimeOffset, int hour = 0, int minute = 0, int second = 0)
{
return new DateTimeOffset(dateTimeOffset.Year, dateTimeOffset.Month, dateTimeOffset.Day, hour, minute, second, timeZoneInfo.GetUtcOffset(dateTimeOffset));
//both of these implemenations lose the ability to specificy the hour, minute and second unless the given dateTimeOffset value being passed into this method
//already has those values set
//1.
//return TimeZoneInfo.ConvertTime(dateTimeOffset, timeZoneInfo);
//2.
//var timeSpan = timeZoneInfo.GetUtcOffset(dateTimeOffset);
//return dateTimeOffset.ToOffset(timeSpan);
}
private static TimeZoneInfo FindSystemTimeZoneBy(string timeZoneId)
{
return TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
}
}
} | mit | C# |
d34e25bae73834a91e592c2036b8e40918d8ac88 | Fix Client breaking NRE when using edit field on Canister GUI #2826 | Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,Necromunger/unitystation | UnityProject/Assets/Scripts/UI/InputFieldFocus.cs | UnityProject/Assets/Scripts/UI/InputFieldFocus.cs | using System;
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
/// Input field that would properly focus
/// and ignore movement and whatnot while it's focused
[Serializable]
public class InputFieldFocus : InputField
{
/// <summary>
/// Button that will cause the field to lose focus
/// </summary>
public KeyCode ExitButton = KeyCode.Escape;
//disabling auto focus on enable temporarily because it causes NREs
// protected override void OnEnable() {
// base.OnEnable();
// StartCoroutine( SelectDelayed() );
// }
/// Waiting one frame to init
private IEnumerator SelectDelayed()
{
yield return WaitFor.EndOfFrame;
Select();
}
private IEnumerator DelayedEnableInput()
{
yield return WaitFor.EndOfFrame;
EnableInput();
}
private void DisableInput()
{
UIManager.IsInputFocus = true;
UIManager.PreventChatInput = true;
}
private void EnableInput()
{
UIManager.IsInputFocus = false;
UIManager.PreventChatInput = false;
}
protected override void OnDisable()
{
base.OnDisable();
if(gameObject.activeInHierarchy)
StartCoroutine(DelayedEnableInput());
}
public override void OnSelect( BaseEventData eventData )
{
base.OnSelect( eventData );
DisableInput();
}
public override void OnPointerClick( PointerEventData eventData )
{
base.OnPointerClick( eventData );
DisableInput();
}
/// <summary>
/// This event is called when the input field is deselected.
/// </summary>
/// <param name="eventData">Data for the event</param>
public override void OnDeselect( BaseEventData eventData )
{
base.OnDeselect( eventData );
}
public override void OnSubmit( BaseEventData eventData )
{
base.OnSubmit( eventData );
StartCoroutine(DelayedEnableInput());
}
private void OnGUI()
{
if ( Event.current.keyCode == ExitButton )
{
OnDeselect(new BaseEventData( EventSystem.current ));
}
}
} | using System;
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
/// Input field that would properly focus
/// and ignore movement and whatnot while it's focused
[Serializable]
public class InputFieldFocus : InputField
{
/// <summary>
/// Button that will cause the field to lose focus
/// </summary>
public KeyCode ExitButton = KeyCode.Escape;
//disabling auto focus on enable temporarily because it causes NREs
// protected override void OnEnable() {
// base.OnEnable();
// StartCoroutine( SelectDelayed() );
// }
/// Waiting one frame to init
private IEnumerator SelectDelayed()
{
yield return WaitFor.EndOfFrame;
Select();
}
private IEnumerator DelayedEnableInput()
{
yield return WaitFor.EndOfFrame;
EnableInput();
}
private void DisableInput()
{
UIManager.IsInputFocus = true;
UIManager.PreventChatInput = true;
}
private void EnableInput()
{
UIManager.IsInputFocus = false;
UIManager.PreventChatInput = false;
}
protected override void OnDisable()
{
base.OnDisable();
if(gameObject.activeInHierarchy)
StartCoroutine(DelayedEnableInput());
}
public override void OnSelect( BaseEventData eventData )
{
base.OnSelect( eventData );
DisableInput();
}
public override void OnPointerClick( PointerEventData eventData )
{
base.OnPointerClick( eventData );
DisableInput();
}
public override void OnDeselect( BaseEventData eventData )
{
base.OnDeselect( eventData );
StartCoroutine(DelayedEnableInput());
}
public override void OnSubmit( BaseEventData eventData )
{
base.OnSubmit( eventData );
StartCoroutine(DelayedEnableInput());
}
private void OnGUI()
{
if ( Event.current.keyCode == ExitButton )
{
OnDeselect(new BaseEventData( EventSystem.current ));
}
}
} | agpl-3.0 | C# |
e298a39bb699660267c348b10cbdcb94445b002a | Fix the typo after code review | neo4j/neo4j-dotnet-driver,neo4j/neo4j-dotnet-driver,ali-ince/neo4j-dotnet-driver | Neo4j.Driver/Neo4j.Driver.Tests/Result/SummaryBuilderTests.cs | Neo4j.Driver/Neo4j.Driver.Tests/Result/SummaryBuilderTests.cs | // Copyright (c) 2002-2016 "Neo Technology,"
// Network Engine for Objects in Lund AB [http://neotechnology.com]
//
// This file is part of Neo4j.
//
// 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 FluentAssertions;
using Neo4j.Driver.Internal.Result;
using Xunit;
namespace Neo4j.Driver.Tests
{
public class SummaryBuilderTests
{
[Theory]
[InlineData("bolt://localhost:7687", "1.2.3", "ServerInfo{Address=localhost:7687, Version=1.2.3}")]
[InlineData("bolt://127.0.0.1:7687", "1.2.3", "ServerInfo{Address=127.0.0.1:7687, Version=1.2.3}")]
// If no port provided, it will be port=-1. This should never happen as we always default to 7687 if no port provided.
[InlineData("bolt://localhost", "1.2.3", "ServerInfo{Address=localhost:-1, Version=1.2.3}")]
[InlineData("https://neo4j.com:9999", "1.2.3", "ServerInfo{Address=neo4j.com:9999, Version=1.2.3}")]
public void CreateServerInfoCorrectly(string uriStr, string version, string expected)
{
var uri = new Uri(uriStr);
var serverInfo = new ServerInfo(uri);
serverInfo.Version = version;
serverInfo.ToString().Should().Be(expected);
}
}
} | // Copyright (c) 2002-2016 "Neo Technology,"
// Network Engine for Objects in Lund AB [http://neotechnology.com]
//
// This file is part of Neo4j.
//
// 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 FluentAssertions;
using Neo4j.Driver.Internal.Result;
using Xunit;
namespace Neo4j.Driver.Tests
{
public class SummaryBuilderTests
{
[Theory]
[InlineData("bolt://localhost:7687", "1.2.3", "ServerInfo{Address=localhost:7687, Version=1.2.3}")]
[InlineData("bolt://127.0.1:7687", "1.2.3", "ServerInfo{Address=127.0.1:7687, Version=1.2.3}")]
// If no port provided, it will be port=-1. This should never happen as we always default to 7687 if no port provided.
[InlineData("bolt://localhost", "1.2.3", "ServerInfo{Address=localhost:-1, Version=1.2.3}")]
[InlineData("https://neo4j.com:9999", "1.2.3", "ServerInfo{Address=neo4j.com:9999, Version=1.2.3}")]
public void CreateServerInfoCorrectly(string uriStr, string version, string expected)
{
var uri = new Uri(uriStr);
var serverInfo = new ServerInfo(uri);
serverInfo.Version = version;
serverInfo.ToString().Should().Be(expected);
}
}
} | apache-2.0 | C# |
a7f4c926f019dff2b2ebbf7c25e99836afdd9af7 | fix bug when file opened, cannot be rewritten. (#2044) | pascalberger/docfx,pascalberger/docfx,superyyrrzz/docfx,pascalberger/docfx,dotnet/docfx,dotnet/docfx,dotnet/docfx,superyyrrzz/docfx,superyyrrzz/docfx | src/Microsoft.DocAsCode.Common/FileAbstractLayer/LinkFileWriter.cs | src/Microsoft.DocAsCode.Common/FileAbstractLayer/LinkFileWriter.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Common
{
using System;
using System.Collections.Generic;
using System.IO;
public class LinkFileWriter : FileWriterBase
{
private readonly Dictionary<RelativePath, PathMapping> _mapping =
new Dictionary<RelativePath, PathMapping>();
public LinkFileWriter(string outputFolder)
: base(outputFolder) { }
#region Overrides
public override void Copy(PathMapping sourceFilePath, RelativePath destFilePath)
{
var key = destFilePath.GetPathFromWorkingFolder();
var pm = new PathMapping(key, sourceFilePath.PhysicalPath)
{
Properties = sourceFilePath.Properties,
};
lock (_mapping)
{
_mapping[key] = pm;
}
}
public override Stream Create(RelativePath file)
{
var key = file.GetPathFromWorkingFolder();
bool getResult;
PathMapping pm;
lock (_mapping)
{
getResult = _mapping.TryGetValue(key, out pm);
}
if (getResult && pm.PhysicalPath.StartsWith(OutputFolder))
{
try
{
return File.Create(Environment.ExpandEnvironmentVariables(pm.PhysicalPath));
}
catch (IOException)
{
}
}
var pair = CreateRandomFileStream();
pm = new PathMapping(key, Path.Combine(OutputFolder, pair.Item1));
lock (_mapping)
{
_mapping[key] = pm;
}
return pair.Item2;
}
public override IFileReader CreateReader()
{
lock (_mapping)
{
return new IndexedLinkFileReader(_mapping);
}
}
#endregion
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Common
{
using System;
using System.Collections.Generic;
using System.IO;
public class LinkFileWriter : FileWriterBase
{
private readonly Dictionary<RelativePath, PathMapping> _mapping =
new Dictionary<RelativePath, PathMapping>();
public LinkFileWriter(string outputFolder)
: base(outputFolder) { }
#region Overrides
public override void Copy(PathMapping sourceFilePath, RelativePath destFilePath)
{
var key = destFilePath.GetPathFromWorkingFolder();
var pm = new PathMapping(key, sourceFilePath.PhysicalPath)
{
Properties = sourceFilePath.Properties,
};
lock (_mapping)
{
_mapping[key] = pm;
}
}
public override Stream Create(RelativePath file)
{
var key = file.GetPathFromWorkingFolder();
bool getResult;
PathMapping pm;
lock (_mapping)
{
getResult = _mapping.TryGetValue(key, out pm);
}
if (getResult && pm.PhysicalPath.StartsWith(OutputFolder))
{
return File.Create(Environment.ExpandEnvironmentVariables(pm.PhysicalPath));
}
var pair = CreateRandomFileStream();
pm = new PathMapping(key, Path.Combine(OutputFolder, pair.Item1));
lock (_mapping)
{
_mapping[key] = pm;
}
return pair.Item2;
}
public override IFileReader CreateReader()
{
lock (_mapping)
{
return new IndexedLinkFileReader(_mapping);
}
}
#endregion
}
}
| mit | C# |
d0e735f1de8c09cb7fb8d4509c109cade07288c0 | make messageTemplate static | SimonCropp/NServiceBus.Serilog | src/NServiceBus.Serilog/MessageAudit/LogIncomingMessageBehavior.cs | src/NServiceBus.Serilog/MessageAudit/LogIncomingMessageBehavior.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Pipeline;
using Serilog.Events;
using Serilog.Parsing;
class LogIncomingMessageBehavior : Behavior<IIncomingLogicalMessageContext>
{
static MessageTemplate messageTemplate;
static LogIncomingMessageBehavior()
{
var templateParser = new MessageTemplateParser();
messageTemplate = templateParser.Parse("Receive message {MessageType} {MessageId}.");
}
public class Registration : RegisterStep
{
public Registration()
: base(
stepId: $"Serilog{nameof(LogIncomingMessageBehavior)}",
behavior: typeof(LogIncomingMessageBehavior),
description: "Logs incoming messages")
{
InsertBefore("MutateIncomingMessages");
}
}
public override Task Invoke(IIncomingLogicalMessageContext context, Func<Task> next)
{
var message = context.Message;
var properties = new List<LogEventProperty>();
var logger = context.Logger();
if (logger.BindProperty("Message", message.Instance, out var messageProperty))
{
properties.Add(messageProperty);
}
properties.AddRange(logger.BuildHeaders(context.Headers));
logger.WriteInfo(messageTemplate, properties);
return next();
}
} | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Pipeline;
using Serilog.Events;
using Serilog.Parsing;
class LogIncomingMessageBehavior : Behavior<IIncomingLogicalMessageContext>
{
MessageTemplate messageTemplate;
public LogIncomingMessageBehavior()
{
var templateParser = new MessageTemplateParser();
messageTemplate = templateParser.Parse("Receive message {MessageType} {MessageId}.");
}
public class Registration : RegisterStep
{
public Registration()
: base(
stepId: $"Serilog{nameof(LogIncomingMessageBehavior)}",
behavior: typeof(LogIncomingMessageBehavior),
description: "Logs incoming messages")
{
InsertBefore("MutateIncomingMessages");
}
}
public override Task Invoke(IIncomingLogicalMessageContext context, Func<Task> next)
{
var message = context.Message;
var properties = new List<LogEventProperty>();
var logger = context.Logger();
if (logger.BindProperty("Message", message.Instance, out var messageProperty))
{
properties.Add(messageProperty);
}
properties.AddRange(logger.BuildHeaders(context.Headers));
logger.WriteInfo(messageTemplate, properties);
return next();
}
} | mit | C# |
8e1216a7507cb9dd5f25da411b2db06b90f598e9 | add providecodebase to force loading these dlls from extension dir | MistyKuu/bitbucket-for-visual-studio,MistyKuu/bitbucket-for-visual-studio | Source/GitClientVS.VisualStudio.UI/Properties/AssemblyInfo.cs | Source/GitClientVS.VisualStudio.UI/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
// 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("VSIXProject1")]
[assembly: AssemblyDescription("")]
[assembly: ProvideCodeBase(AssemblyName = "System.Reactive.Core", CodeBase = @"$PackageFolder$\System.Reactive.Core.dll")]
[assembly: ProvideCodeBase(AssemblyName = "System.Reactive.Interfaces", CodeBase = @"$PackageFolder$\System.Reactive.Interfaces.dll")]
[assembly: ProvideCodeBase(AssemblyName = "System.Reactive.Linq", CodeBase = @"$PackageFolder$\System.Reactive.Linq.dll")]
[assembly: ProvideCodeBase(AssemblyName = "System.Reactive.PlatformServices", CodeBase = @"$PackageFolder$\System.Reactive.PlatformServices.dll")]
[assembly: ProvideCodeBase(AssemblyName = "System.Reactive.Windows.Threading", CodeBase = @"$PackageFolder$\System.Reactive.Windows.Threading.dll")]
[assembly: ProvideCodeBase(AssemblyName = "ReactiveUI", CodeBase = @"$PackageFolder$\ReactiveUI.dll")]
[assembly: ProvideCodeBase(AssemblyName = "Splat", CodeBase = @"$PackageFolder$\Splat.dll")]
// 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)]
// 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.*")]
| 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("VSIXProject1")]
[assembly: AssemblyDescription("")]
// 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)]
// 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.*")]
| mit | C# |
8d6e9442a4e00a57f3cba64f2863623bcc6b8802 | Add NavBarViewModel to MainViewModel. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/MainViewModel.cs | WalletWasabi.Fluent/ViewModels/MainViewModel.cs | using Avalonia.Threading;
using NBitcoin;
using ReactiveUI;
using System.Reactive;
using System.Threading.Tasks;
using WalletWasabi.Gui.ViewModels;
using Global = WalletWasabi.Gui.Global;
namespace WalletWasabi.Fluent.ViewModels
{
public class MainViewModel : ViewModelBase, IScreen
{
private Global _global;
private StatusBarViewModel _statusBar;
private string _title = "Wasabi Wallet";
private NavBarViewModel _navBar;
public MainViewModel(Global global)
{
_global = global;
Network = global.Network;
StatusBar = new StatusBarViewModel(global.DataDir, global.Network, global.Config, global.HostedServices, global.BitcoinStore.SmartHeaderChain, global.Synchronizer, global.LegalDocuments);
NavBar = new NavBarViewModel(global.WalletManager, global.UiConfig);
Dispatcher.UIThread.Post(async () =>
{
await Task.Delay(5000);
Router.Navigate.Execute(new HomeViewModel(this));
});
}
public static MainViewModel Instance { get; internal set; }
public RoutingState Router { get; } = new RoutingState();
public ReactiveCommand<Unit, IRoutableViewModel> GoNext { get; }
public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
public Network Network { get; }
public NavBarViewModel NavBar
{
get { return _navBar; }
set { this.RaiseAndSetIfChanged(ref _navBar, value); }
}
public StatusBarViewModel StatusBar
{
get { return _statusBar; }
set { this.RaiseAndSetIfChanged(ref _statusBar, value); }
}
public string Title
{
get => _title;
internal set => this.RaiseAndSetIfChanged(ref _title, value);
}
public void Initialize()
{
// Temporary to keep things running without VM modifications.
MainWindowViewModel.Instance = new MainWindowViewModel(_global.Network, _global.UiConfig, _global.WalletManager, null, null, false);
StatusBar.Initialize(_global.Nodes.ConnectedNodes);
if (Network != Network.Main)
{
Title += $" - {Network}";
}
}
}
}
| using Avalonia.Threading;
using NBitcoin;
using ReactiveUI;
using System.Reactive;
using System.Threading.Tasks;
using WalletWasabi.Gui.ViewModels;
using Global = WalletWasabi.Gui.Global;
namespace WalletWasabi.Fluent.ViewModels
{
public class MainViewModel : ViewModelBase, IScreen
{
private Global _global;
private StatusBarViewModel _statusBar;
private string _title = "Wasabi Wallet";
public MainViewModel(Global global)
{
_global = global;
Network = global.Network;
StatusBar = new StatusBarViewModel(global.DataDir, global.Network, global.Config, global.HostedServices, global.BitcoinStore.SmartHeaderChain, global.Synchronizer, global.LegalDocuments);
Dispatcher.UIThread.Post(async () =>
{
await Task.Delay(5000);
Router.Navigate.Execute(new HomeViewModel(this));
});
}
public static MainViewModel Instance { get; internal set; }
public RoutingState Router { get; } = new RoutingState();
public ReactiveCommand<Unit, IRoutableViewModel> GoNext { get; }
public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
public Network Network { get; }
public StatusBarViewModel StatusBar
{
get { return _statusBar; }
set { this.RaiseAndSetIfChanged(ref _statusBar, value); }
}
public string Title
{
get => _title;
internal set => this.RaiseAndSetIfChanged(ref _title, value);
}
public void Initialize()
{
// Temporary to keep things running without VM modifications.
MainWindowViewModel.Instance = new MainWindowViewModel(_global.Network, _global.UiConfig, _global.WalletManager, null, null, false);
StatusBar.Initialize(_global.Nodes.ConnectedNodes);
if (Network != Network.Main)
{
Title += $" - {Network}";
}
}
}
}
| mit | C# |
c5f43d7d6ec4bd7c80b29f7dfa8988b4dad3a69e | Make the interface public. | dermeister0/TimesheetParser,dermeister0/TimesheetParser | Source/Heavysoft.TimesheetParser.PluginInterfaces/ICrm.cs | Source/Heavysoft.TimesheetParser.PluginInterfaces/ICrm.cs | using System.Security;
using System.Threading.Tasks;
namespace Heavysoft.TimesheetParser.PluginInterfaces
{
public interface ICrm
{
Task<bool> Login(string login, SecureString password);
Task<bool> Login(string token);
}
} | using System.Security;
using System.Threading.Tasks;
namespace Heavysoft.TimesheetParser.PluginInterfaces
{
internal interface ICrm
{
Task<bool> Login(string login, SecureString password);
Task<bool> Login(string token);
}
} | mit | C# |
46336573bed434db2b5d3f6ac08a600ccf074cf7 | Update CompositeEventTelemeter.cs | tiksn/TIKSN-Framework | TIKSN.Core/Analytics/Telemetry/CompositeEventTelemeter.cs | TIKSN.Core/Analytics/Telemetry/CompositeEventTelemeter.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using TIKSN.Configuration;
namespace TIKSN.Analytics.Telemetry
{
public class CompositeEventTelemeter : IEventTelemeter
{
private readonly IPartialConfiguration<CommonTelemetryOptions> commonConfiguration;
private readonly IEnumerable<IEventTelemeter> eventTelemeters;
public CompositeEventTelemeter(IPartialConfiguration<CommonTelemetryOptions> commonConfiguration,
IEnumerable<IEventTelemeter> eventTelemeters)
{
this.commonConfiguration = commonConfiguration;
this.eventTelemeters = eventTelemeters;
}
public async Task TrackEventAsync(string name)
{
if (this.commonConfiguration.GetConfiguration().IsEventTrackingEnabled)
{
foreach (var eventTelemeter in this.eventTelemeters)
{
try
{
await eventTelemeter.TrackEventAsync(name).ConfigureAwait(false);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
}
}
public async Task TrackEventAsync(string name, IDictionary<string, string> properties)
{
if (this.commonConfiguration.GetConfiguration().IsEventTrackingEnabled)
{
foreach (var eventTelemeter in this.eventTelemeters)
{
try
{
await eventTelemeter.TrackEventAsync(name, properties).ConfigureAwait(false);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using TIKSN.Configuration;
namespace TIKSN.Analytics.Telemetry
{
public class CompositeEventTelemeter : IEventTelemeter
{
private readonly IPartialConfiguration<CommonTelemetryOptions> commonConfiguration;
private readonly IEnumerable<IEventTelemeter> eventTelemeters;
public CompositeEventTelemeter(IPartialConfiguration<CommonTelemetryOptions> commonConfiguration,
IEnumerable<IEventTelemeter> eventTelemeters)
{
this.commonConfiguration = commonConfiguration;
this.eventTelemeters = eventTelemeters;
}
public async Task TrackEvent(string name)
{
if (this.commonConfiguration.GetConfiguration().IsEventTrackingEnabled)
{
foreach (var eventTelemeter in this.eventTelemeters)
{
try
{
await eventTelemeter.TrackEvent(name);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
}
}
public async Task TrackEvent(string name, IDictionary<string, string> properties)
{
if (this.commonConfiguration.GetConfiguration().IsEventTrackingEnabled)
{
foreach (var eventTelemeter in this.eventTelemeters)
{
try
{
await eventTelemeter.TrackEvent(name, properties);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
}
}
}
}
| mit | C# |
77dbbe6f342e0dcce5b2991773b5cf1b8752afce | Add a placeholder cover URL for users. | tacchinotacchi/osu,naoey/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,Damnae/osu,smoogipoo/osu,ZLima12/osu,peppy/osu,smoogipoo/osu,ZLima12/osu,UselessToucan/osu,peppy/osu,Nabile-Rahmani/osu,RedNesto/osu,osu-RP/osu-RP,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,DrabWeb/osu,smoogipoo/osu,EVAST9919/osu,EVAST9919/osu,johnneijzen/osu,peppy/osu-new,naoey/osu,nyaamara/osu,DrabWeb/osu,UselessToucan/osu,Drezi126/osu,DrabWeb/osu,naoey/osu,johnneijzen/osu,Frontear/osuKyzer,NeoAdonis/osu,2yangk23/osu,smoogipooo/osu,NeoAdonis/osu | osu.Game/Users/User.cs | osu.Game/Users/User.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Users
{
public class User
{
[JsonProperty(@"id")]
public long Id = 1;
[JsonProperty(@"username")]
public string Username;
public Country Country;
public Team Team;
[JsonProperty(@"colour")]
public string Colour;
public string CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg";
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Users
{
public class User
{
[JsonProperty(@"id")]
public long Id = 1;
[JsonProperty(@"username")]
public string Username;
public Country Country;
public Team Team;
[JsonProperty(@"colour")]
public string Colour;
}
}
| mit | C# |
672a5122737a7c55789e98cf4ca4d06e6c9ecce3 | remove unnecessary usings | yanggujun/commonsfornet,yanggujun/commonsfornet | src/Commons.Collections/Queue/MinPriorityQueue.cs | src/Commons.Collections/Queue/MinPriorityQueue.cs | // Copyright CommonsForNET.
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You 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;
namespace Commons.Collections.Queue
{
/// <summary>
///
/// </summary>
public class MinPriorityQueue<T> : AbstractPriorityQueue<T>, IPriorityQueue<T>
{
public MinPriorityQueue()
: this(Comparer<T>.Default)
{
}
public MinPriorityQueue(IComparer<T> comparer)
: this(comparer.Compare)
{
}
public MinPriorityQueue(Comparison<T> comparer) : this (null, comparer)
{
}
public MinPriorityQueue(IEnumerable<T> items, Comparison<T> comparer) : base(items, (x1, x2) => comparer(x1, x2) < 0)
{
}
}
}
| // Copyright CommonsForNET.
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You 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;
using System.Collections.Generic;
using Commons.Utils;
namespace Commons.Collections.Queue
{
/// <summary>
///
/// </summary>
public class MinPriorityQueue<T> : AbstractPriorityQueue<T>, IPriorityQueue<T>
{
public MinPriorityQueue()
: this(Comparer<T>.Default)
{
}
public MinPriorityQueue(IComparer<T> comparer)
: this(comparer.Compare)
{
}
public MinPriorityQueue(Comparison<T> comparer) : this (null, comparer)
{
}
public MinPriorityQueue(IEnumerable<T> items, Comparison<T> comparer) : base(items, (x1, x2) => comparer(x1, x2) < 0)
{
}
}
}
| apache-2.0 | C# |
1136186fd7d6adcb7345301f3ee1fd2f2dd2f357 | Add implementation for sample data client factory | LukeTillman/killrvideo-csharp,LukeTillman/killrvideo-csharp,LukeTillman/killrvideo-csharp | src/KillrVideo.SampleData/ServiceClientFactory.cs | src/KillrVideo.SampleData/ServiceClientFactory.cs | using System;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using KillrVideo.Comments;
using KillrVideo.Protobuf.Clients;
using KillrVideo.Ratings;
using KillrVideo.Statistics;
using KillrVideo.UserManagement;
using KillrVideo.VideoCatalog;
namespace KillrVideo.SampleData
{
/// <summary>
/// Factory that gets service clients needed by message handlers.
/// </summary>
[Export(typeof(IServiceClientFactory))]
public class ServiceClientFactory : IServiceClientFactory
{
private readonly IChannelFactory _channelFactory;
// Cached lazy client instances
private readonly Lazy<Task<CommentsService.CommentsServiceClient>> _commentsClient;
private readonly Lazy<Task<RatingsService.RatingsServiceClient>> _ratingsClient;
private readonly Lazy<Task<UserManagementService.UserManagementServiceClient>> _usersClient;
private readonly Lazy<Task<StatisticsService.StatisticsServiceClient>> _statsClient;
private readonly Lazy<Task<VideoCatalogService.VideoCatalogServiceClient>> _videosClient;
public ServiceClientFactory(IChannelFactory channelFactory)
{
if (channelFactory == null) throw new ArgumentNullException(nameof(channelFactory));
_channelFactory = channelFactory;
// Create clients on demand and reuse them
_commentsClient = new Lazy<Task<CommentsService.CommentsServiceClient>>(CreateCommentsClient);
_ratingsClient = new Lazy<Task<RatingsService.RatingsServiceClient>>(CreateRatingsClient);
_usersClient = new Lazy<Task<UserManagementService.UserManagementServiceClient>>(CreateUsersClient);
_statsClient = new Lazy<Task<StatisticsService.StatisticsServiceClient>>(CreateStatsClient);
_videosClient = new Lazy<Task<VideoCatalogService.VideoCatalogServiceClient>>(CreateVideosClient);
}
public Task<CommentsService.CommentsServiceClient> GetCommentsClientAsync()
{
return _commentsClient.Value;
}
private async Task<CommentsService.CommentsServiceClient> CreateCommentsClient()
{
var channel = await _channelFactory.GetChannelAsync(CommentsService.Descriptor).ConfigureAwait(false);
return CommentsService.NewClient(channel);
}
public Task<RatingsService.RatingsServiceClient> GetRatingsClientAsync()
{
return _ratingsClient.Value;
}
private async Task<RatingsService.RatingsServiceClient> CreateRatingsClient()
{
var channel = await _channelFactory.GetChannelAsync(RatingsService.Descriptor).ConfigureAwait(false);
return RatingsService.NewClient(channel);
}
public Task<UserManagementService.UserManagementServiceClient> GetUsersClientAsync()
{
return _usersClient.Value;
}
private async Task<UserManagementService.UserManagementServiceClient> CreateUsersClient()
{
var channel = await _channelFactory.GetChannelAsync(UserManagementService.Descriptor).ConfigureAwait(false);
return UserManagementService.NewClient(channel);
}
public Task<StatisticsService.StatisticsServiceClient> GetStatsClientAsync()
{
return _statsClient.Value;
}
private async Task<StatisticsService.StatisticsServiceClient> CreateStatsClient()
{
var channel = await _channelFactory.GetChannelAsync(StatisticsService.Descriptor).ConfigureAwait(false);
return StatisticsService.NewClient(channel);
}
public Task<VideoCatalogService.VideoCatalogServiceClient> GetVideoClientAsync()
{
return _videosClient.Value;
}
private async Task<VideoCatalogService.VideoCatalogServiceClient> CreateVideosClient()
{
var channel = await _channelFactory.GetChannelAsync(VideoCatalogService.Descriptor).ConfigureAwait(false);
return VideoCatalogService.NewClient(channel);
}
}
}
| using System;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using KillrVideo.Comments;
using KillrVideo.Protobuf.Clients;
using KillrVideo.Ratings;
using KillrVideo.Statistics;
using KillrVideo.UserManagement;
using KillrVideo.VideoCatalog;
namespace KillrVideo.SampleData
{
/// <summary>
/// Factory that gets service clients needed by message handlers.
/// </summary>
[Export(typeof(IServiceClientFactory))]
public class ServiceClientFactory : IServiceClientFactory
{
private readonly IChannelFactory _channelFactory;
public ServiceClientFactory(IChannelFactory channelFactory)
{
if (channelFactory == null) throw new ArgumentNullException(nameof(channelFactory));
_channelFactory = channelFactory;
}
public Task<CommentsService.CommentsServiceClient> GetCommentsClientAsync()
{
throw new NotImplementedException();
}
public Task<RatingsService.RatingsServiceClient> GetRatingsClientAsync()
{
throw new NotImplementedException();
}
public Task<UserManagementService.UserManagementServiceClient> GetUsersClientAsync()
{
throw new NotImplementedException();
}
public Task<StatisticsService.StatisticsServiceClient> GetStatsClientAsync()
{
throw new NotImplementedException();
}
public Task<VideoCatalogService.VideoCatalogServiceClient> GetVideoClientAsync()
{
throw new NotImplementedException();
}
}
}
| apache-2.0 | C# |
f4746152accf17496e94972e3d25ba9ed983f67d | Implement FuncAny<bool> version of F.Filter using existing overload | farity/farity | Farity/Filter.cs | Farity/Filter.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace Farity
{
public static partial class F
{
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(Func<T, bool> predicate, IEnumerable<T> source)
=> source.Where(predicate);
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(FuncAny<bool> predicate, IEnumerable<T> source)
=> Filter((T item) => predicate(item), source);
}
} | using System;
using System.Collections.Generic;
using System.Linq;
namespace Farity
{
public static partial class F
{
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(Func<T, bool> predicate, IEnumerable<T> source)
=> source.Where(predicate);
/// <summary>
/// Takes a predicate and an enumerable, and returns an enumerable of the same type containing the members of the given
/// enumerable which satisfy the given predicate. Pure functions are recommended as predicates.
/// </summary>
/// <typeparam name="T">The type of elements in the source.</typeparam>
/// <param name="predicate">The predicate function to filter with.</param>
/// <param name="source">The source of elements to filter.</param>
/// <returns>An enumerable with the elements filtered with the predicate.</returns>
public static IEnumerable<T> Filter<T>(FuncAny<bool> predicate, IEnumerable<T> source)
=> source.Where(item => predicate(item));
}
} | mit | C# |
ff9d1e1385319a0c7a4b5787133e4c51a2719522 | Update PushalotMetricTelemeter.cs | tiksn/TIKSN-Framework | TIKSN.Core/Analytics/Telemetry/Pushalot/PushalotMetricTelemeter.cs | TIKSN.Core/Analytics/Telemetry/Pushalot/PushalotMetricTelemeter.cs | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TIKSN.Configuration;
namespace TIKSN.Analytics.Telemetry.Pushalot
{
public class PushalotMetricTelemeter : PushalotTelemeterBase, IMetricTelemeter
{
public PushalotMetricTelemeter(IPartialConfiguration<PushalotOptions> pushalotConfiguration)
: base(pushalotConfiguration)
{
}
public async Task TrackMetric(string metricName, decimal metricValue) =>
await this.SendMessage("Metric", string.Format("{0}: {1}", metricName, metricValue));
protected override IEnumerable<string> GetAuthorizationTokens(PushalotOptions pushalotConfiguration) =>
pushalotConfiguration.MetricAuthorizationTokens;
protected override IEnumerable<string> GetAuthorizationTokens(PushalotOptions pushalotConfiguration,
TelemetrySeverityLevel severityLevel) => Enumerable.Empty<string>();
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TIKSN.Configuration;
namespace TIKSN.Analytics.Telemetry.Pushalot
{
public class PushalotMetricTelemeter : PushalotTelemeterBase, IMetricTelemeter
{
public PushalotMetricTelemeter(IPartialConfiguration<PushalotOptions> pushalotConfiguration)
: base(pushalotConfiguration)
{
}
public async Task TrackMetric(string metricName, decimal metricValue)
{
await SendMessage("Metric", string.Format("{0}: {1}", metricName, metricValue));
}
protected override IEnumerable<string> GetAuthorizationTokens(PushalotOptions pushalotConfiguration)
{
return pushalotConfiguration.MetricAuthorizationTokens;
}
protected override IEnumerable<string> GetAuthorizationTokens(PushalotOptions pushalotConfiguration, TelemetrySeverityLevel severityLevel)
{
return Enumerable.Empty<string>();
}
}
} | mit | C# |
a4851ab53ca5076d2e2b89fcb76a1357e9cf3b32 | fix connection tests | JetBrains/YouTrackSharp,JetBrains/YouTrackSharp | tests/YouTrackSharp.Tests/Integration/ConnectionHttpClientTests.cs | tests/YouTrackSharp.Tests/Integration/ConnectionHttpClientTests.cs | using System.Threading.Tasks;
using JetBrains.Annotations;
using Xunit;
using YouTrackSharp.Tests.Infrastructure;
namespace YouTrackSharp.Tests.Integration
{
[UsedImplicitly]
public partial class ConnectionTests
{
public class GetAuthenticatedHttpClient
{
[Theory]
[MemberData(nameof(Connections.TestData.ValidConnections), MemberType = typeof(Connections.TestData))]
public async Task Valid_Connection_Returns_Authenticated_HttpClient(Connection connection)
{
// Arrange & Act
var httpClient = await connection.GetAuthenticatedApiClient();
var result = await httpClient.UsersMeAsync("id,guest");
Assert.Equal(false, result.Guest);
}
[Theory]
[MemberData(nameof(Connections.TestData.InvalidConnections), MemberType = typeof(Connections.TestData))]
public async Task Invalid_Connection_Throws_UnauthorizedConnectionException(Connection connection)
{
// Act & Assert
await Assert.ThrowsAsync<UnauthorizedConnectionException>(
async () => await connection.GetAuthenticatedApiClient());
}
}
}
} | using System.Threading.Tasks;
using JetBrains.Annotations;
using Xunit;
using YouTrackSharp.Tests.Infrastructure;
namespace YouTrackSharp.Tests.Integration
{
[UsedImplicitly]
public partial class ConnectionTests
{
public class GetAuthenticatedHttpClient
{
[Theory]
[MemberData(nameof(Connections.TestData.ValidConnections), MemberType = typeof(Connections.TestData))]
public async Task Valid_Connection_Returns_Authenticated_HttpClient(Connection connection)
{
// Arrange & Act
var httpClient = await connection.GetAuthenticatedHttpClient();
var response = await httpClient.GetAsync("api/admin/users/me");
// Assert
Assert.True(response.IsSuccessStatusCode);
}
[Theory]
[MemberData(nameof(Connections.TestData.InvalidConnections), MemberType = typeof(Connections.TestData))]
public async Task Invalid_Connection_Throws_UnauthorizedConnectionException(Connection connection)
{
// Act & Assert
await Assert.ThrowsAsync<UnauthorizedConnectionException>(
async () => await connection.GetAuthenticatedHttpClient());
}
}
}
} | apache-2.0 | C# |
3dd77aa562c73d5b2ba227f9f7ad7c3ca6456141 | add checked and unchecked events | jpbruyere/Crow,jpbruyere/Crow | src/GraphicObjects/RadioButton.cs | src/GraphicObjects/RadioButton.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using OpenTK.Graphics.OpenGL;
using Cairo;
using winColors = System.Drawing.Color;
using System.Diagnostics;
using System.Xml.Serialization;
using OpenTK.Input;
using System.ComponentModel;
namespace Crow
{
[DefaultTemplate("#Crow.Templates.RadioButton.goml")]
public class RadioButton : TemplatedControl
{
string caption;
string image;
bool isChecked;
#region CTOR
public RadioButton() : base(){}
#endregion
public event EventHandler Checked;
public event EventHandler Unchecked;
#region GraphicObject overrides
[XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
public override bool Focusable
{
get { return base.Focusable; }
set { base.Focusable = value; }
}
[XmlAttributeAttribute()][DefaultValue(-1)]
public override int Height {
get { return base.Height; }
set { base.Height = value; }
}
#endregion
[XmlAttributeAttribute()][DefaultValue("RadioButton")]
public string Caption {
get { return caption; }
set {
if (caption == value)
return;
caption = value;
NotifyValueChanged ("Caption", caption);
}
}
[XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.radiobutton.svg")]
public string Image {
get { return image; }
set {
if (image == value)
return;
image = value;
NotifyValueChanged ("Image", image);
}
}
[XmlAttributeAttribute()][DefaultValue(false)]
public bool IsChecked
{
get { return isChecked; }
set
{
isChecked = value;
NotifyValueChanged ("IsChecked", value);
if (isChecked) {
NotifyValueChanged ("SvgSub", "checked");
Checked.Raise (this, null);
} else {
NotifyValueChanged ("SvgSub", "unchecked");
Unchecked.Raise (this, null);
}
}
}
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
Group pg = Parent as Group;
if (pg != null) {
foreach (RadioButton c in pg.Children.OfType<RadioButton>())
c.IsChecked = (c == this);
} else
IsChecked = !IsChecked;
base.onMouseClick (sender, e);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using OpenTK.Graphics.OpenGL;
using Cairo;
using winColors = System.Drawing.Color;
using System.Diagnostics;
using System.Xml.Serialization;
using OpenTK.Input;
using System.ComponentModel;
namespace Crow
{
[DefaultTemplate("#Crow.Templates.RadioButton.goml")]
public class RadioButton : TemplatedControl
{
string caption;
string image;
bool isChecked;
#region CTOR
public RadioButton() : base(){}
#endregion
#region GraphicObject overrides
[XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
public override bool Focusable
{
get { return base.Focusable; }
set { base.Focusable = value; }
}
[XmlAttributeAttribute()][DefaultValue(-1)]
public override int Height {
get { return base.Height; }
set { base.Height = value; }
}
#endregion
[XmlAttributeAttribute()][DefaultValue("RadioButton")]
public string Caption {
get { return caption; }
set {
if (caption == value)
return;
caption = value;
NotifyValueChanged ("Caption", caption);
}
}
[XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.radiobutton.svg")]
public string Image {
get { return image; }
set {
if (image == value)
return;
image = value;
NotifyValueChanged ("Image", image);
}
}
[XmlAttributeAttribute()][DefaultValue(false)]
public bool IsChecked
{
get { return isChecked; }
set
{
isChecked = value;
NotifyValueChanged ("IsChecked", value);
if (isChecked)
NotifyValueChanged ("SvgSub", "checked");
else
NotifyValueChanged ("SvgSub", "unchecked");
}
}
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
Group pg = Parent as Group;
if (pg != null) {
foreach (RadioButton c in pg.Children.OfType<RadioButton>())
c.IsChecked = (c == this);
} else
IsChecked = !IsChecked;
base.onMouseClick (sender, e);
}
}
}
| mit | C# |
b44853c0301d13b397665533c79d403c00c1718b | Write an additional line after creating application | appharbor/appharbor-cli | src/AppHarbor/Commands/CreateCommand.cs | src/AppHarbor/Commands/CreateCommand.cs | using System;
using System.Linq;
namespace AppHarbor.Commands
{
public class CreateCommand : ICommand
{
private readonly IAppHarborClient _appHarborClient;
private readonly IApplicationConfiguration _applicationConfiguration;
public CreateCommand(IAppHarborClient appHarborClient, IApplicationConfiguration applicationConfiguration)
{
_appHarborClient = appHarborClient;
_applicationConfiguration = applicationConfiguration;
}
public void Execute(string[] arguments)
{
if (arguments.Length == 0)
{
throw new CommandException("An application name must be provided to create an application");
}
var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault());
Console.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.ID);
Console.WriteLine("");
_applicationConfiguration.SetupApplication(result.ID, _appHarborClient.GetUser());
}
}
}
| using System;
using System.Linq;
namespace AppHarbor.Commands
{
public class CreateCommand : ICommand
{
private readonly IAppHarborClient _appHarborClient;
private readonly IApplicationConfiguration _applicationConfiguration;
public CreateCommand(IAppHarborClient appHarborClient, IApplicationConfiguration applicationConfiguration)
{
_appHarborClient = appHarborClient;
_applicationConfiguration = applicationConfiguration;
}
public void Execute(string[] arguments)
{
if (arguments.Length == 0)
{
throw new CommandException("An application name must be provided to create an application");
}
var result = _appHarborClient.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault());
Console.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.ID);
_applicationConfiguration.SetupApplication(result.ID, _appHarborClient.GetUser());
}
}
}
| mit | C# |
6c13029c8277bfaf02a6a26bb0ee7c48d2a14381 | fix requireTp | os2kitos/kitos,os2kitos/kitos,os2kitos/kitos,os2kitos/kitos | Presentation.Web/Infrastructure/Attributes/RequireTopOnOdataThroughKitosTokenAttribute.cs | Presentation.Web/Infrastructure/Attributes/RequireTopOnOdataThroughKitosTokenAttribute.cs | using System.Net;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Core.ApplicationServices.Authentication;
using Serilog;
namespace Presentation.Web.Infrastructure.Attributes
{
public class RequireTopOnOdataThroughKitosTokenAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
var authContext = (IAuthenticationContext)actionContext.ControllerContext.Configuration.DependencyResolver.GetService(typeof(IAuthenticationContext));
var logger = (ILogger)actionContext.ControllerContext.Configuration.DependencyResolver.GetService(typeof(ILogger));
if (actionContext.Request.RequestUri.AbsoluteUri.Contains("/odata/") && authContext.Method == AuthenticationMethod.KitosToken)
{
if (!actionContext.Request.RequestUri.AbsoluteUri.Contains("$top="))
{
logger.Warning("Request spørger om data gennem ODATA uden \"top\" argumentet til at begrænse udtrækket (paging fejl)");
actionContext.Response = new HttpResponseMessage
{
StatusCode = HttpStatusCode.BadRequest,
Content = new StringContent("Pagination required. Missing 'top' query parameter on ODATA request")
};
}
}
base.OnActionExecuting(actionContext);
}
}
} | using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Core.ApplicationServices.Authentication;
using Serilog;
namespace Presentation.Web.Infrastructure.Attributes
{
public class RequireTopOnOdataThroughKitosTokenAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
var authContext = (IAuthenticationContext)actionContext.ControllerContext.Configuration.DependencyResolver.GetService(typeof(IAuthenticationContext));
var logger = (ILogger)actionContext.ControllerContext.Configuration.DependencyResolver.GetService(typeof(ILogger));
if (actionContext.Request.RequestUri.AbsoluteUri.Contains("/odata/") && authContext.Method == AuthenticationMethod.KitosToken)
{
if (!actionContext.Request.RequestUri.AbsoluteUri.Contains("$top="))
{
logger.Warning("Request spørger om data gennem ODATA uden \"top\" argumentet til at begrænse udtrækket (paging fejl)");
}
base.OnActionExecuting(actionContext);
}
else
{
base.OnActionExecuting(actionContext);
}
}
}
} | mpl-2.0 | C# |
41b2e6b34bbe4ad68542271bb901cb037b5fe198 | set taskstate to new when creating | Recensys/ReviewIT-backend,Recensys/ReviewIT-backend | ReviewIT-Backend/RecensysCoreRepository/EFRepository/Repositories/TaskConfigRepository.cs | ReviewIT-Backend/RecensysCoreRepository/EFRepository/Repositories/TaskConfigRepository.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using RecensysCoreRepository.DTOs;
using RecensysCoreRepository.EFRepository.Entities;
using RecensysCoreRepository.Repositories;
namespace RecensysCoreRepository.EFRepository.Repositories
{
public class TaskConfigRepository: ITaskConfigRepository
{
private readonly RecensysContext _context;
public TaskConfigRepository(RecensysContext context)
{
if (context == null) throw new ArgumentNullException($"{nameof(context)} is null");
_context = context;
}
public void Dispose()
{
_context.Dispose();
}
public int Create(int stageId, int articleId, int ownerId, int[] requestedFields)
{
// add the task
var task = new Entities.Task
{
ArticleId = articleId,
StageId = stageId,
UserId = ownerId,
TaskType = TaskType.Review,
TaskState = TaskState.New
};
// add all requested data to the task. If it already exists, add that, or create a new data entity.
foreach (var rf in requestedFields)
{
var storedDataValue = (from d in _context.Data
where d.ArticleId == articleId && rf == d.FieldId
select d).SingleOrDefault();
if (storedDataValue == null)
{
storedDataValue = new Data
{
ArticleId = articleId,
FieldId = rf,
Value = ""
};
}
task.Data.Add(storedDataValue);
}
_context.Tasks.Add(task);
_context.SaveChanges();
return task.Id;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using RecensysCoreRepository.DTOs;
using RecensysCoreRepository.EFRepository.Entities;
using RecensysCoreRepository.Repositories;
namespace RecensysCoreRepository.EFRepository.Repositories
{
public class TaskConfigRepository: ITaskConfigRepository
{
private readonly RecensysContext _context;
public TaskConfigRepository(RecensysContext context)
{
if (context == null) throw new ArgumentNullException($"{nameof(context)} is null");
_context = context;
}
public void Dispose()
{
_context.Dispose();
}
public int Create(int stageId, int articleId, int ownerId, int[] requestedFields)
{
// add the task
var task = new Entities.Task
{
ArticleId = articleId,
StageId = stageId,
UserId = ownerId,
TaskType = TaskType.Review
};
// add all requested data to the task. If it already exists, add that, or create a new data entity.
foreach (var rf in requestedFields)
{
var storedDataValue = (from d in _context.Data
where d.ArticleId == articleId && rf == d.FieldId
select d).SingleOrDefault();
if (storedDataValue == null)
{
storedDataValue = new Data
{
ArticleId = articleId,
FieldId = rf,
Value = ""
};
}
task.Data.Add(storedDataValue);
}
_context.Tasks.Add(task);
_context.SaveChanges();
return task.Id;
}
}
}
| mit | C# |
42e33dde0c718188afcaa41cbdf4bd8d731fac9a | Make tests actually test | johnneijzen/osu,NeoAdonis/osu,2yangk23/osu,peppy/osu,2yangk23/osu,johnneijzen/osu,peppy/osu,EVAST9919/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,peppy/osu-new | osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.cs | osu.Game.Tests/Visual/UserInterface/TestSceneNowPlayingOverlay.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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneNowPlayingOverlay : OsuTestScene
{
[Cached]
private MusicController musicController = new MusicController();
private WorkingBeatmap currentTrack;
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
var np = new NowPlayingOverlay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
};
Add(musicController);
Add(np);
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"hide", () => np.Hide());
}
[Test]
public void TestPrevTrackBehavior()
{
AddStep(@"Play track", () =>
{
musicController.NextTrack();
currentTrack = Beatmap.Value;
});
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddAssert(@"Check action is restart track", () => musicController.PreviousTrack() == PreviousTrackResult.Restart);
AddAssert(@"Check track didn't change", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000));
AddAssert(@"Check action is previous track", () => musicController.PreviousTrack() == PreviousTrackResult.Previous);
}
}
}
| // 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
{
[TestFixture]
public class TestSceneNowPlayingOverlay : OsuTestScene
{
[Cached]
private MusicController musicController = new MusicController();
private WorkingBeatmap currentTrack;
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
var np = new NowPlayingOverlay
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
};
Add(musicController);
Add(np);
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"hide", () => np.Hide());
}
[Test]
public void TestPrevTrackBehavior()
{
AddStep(@"Play track", () =>
{
musicController.NextTrack();
currentTrack = Beatmap.Value;
});
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddStep(@"Call PrevTrack", () => musicController.PreviousTrack());
AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 2 second", () => musicController.SeekTo(2000));
AddStep(@"Call PrevTrack", () => musicController.PreviousTrack());
// If the track isn't changing, check the current track's time instead
AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value || currentTrack.Track.CurrentTime < 2000);
}
}
}
| mit | C# |
e58a4e401531baca85d57f07b8d1093997fae01c | Tidy up image credits | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | samples/misc/NodeServicesExamples/Views/Home/ImageResizing.cshtml | samples/misc/NodeServicesExamples/Views/Home/ImageResizing.cshtml | <h1>Image Resizing</h1>
<p>
This sample shows how the NPM module <a href="https://www.npmjs.com/package/sharp"><code>sharp</code></a>
can be used for dynamic image resizing from within an ASP.NET Core application. There is one copy of the
following image on disk, but we can set up an MVC action method that returns it resized to fit within an
arbitrary width and height.
</p>
<p>
<strong>Dependencies:</strong> On Windows and Linux, there are no native dependencies. Just running
<code>npm install</code> is enough. On OS X, however, you need to have <code>libvips</code> installed,
which you can get through <a href="http://brew.sh/">Homebrew</a> by running
<code>brew install homebrew/science/vips</code>.
</p>
<h3>100px wide [<a href="/resize/images/parrot.jpg?maxWidth=100">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=100" />
<h3>200px wide [<a href="/resize/images/parrot.jpg?maxWidth=200">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=200" />
<h3>400px wide [<a href="/resize/images/parrot.jpg?maxWidth=400">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=400" />
<h3>800px wide [<a href="/resize/images/parrot.jpg?maxWidth=800">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=800" />
<p>
<strong>Credit:</strong>
<em><a href="https://www.flickr.com/photos/dcoetzee/3572948635">Parrot</a>
by <a href="https://www.flickr.com/photos/dcoetzee/">D Coetzee</a>
is dedicated to the <a href="http://creativecommons.org/publicdomain/zero/1.0/">public domain (CC0)</a></em>
</p>
| <h1>Image Resizing</h1>
<p>
This sample shows how the NPM module <a href="https://www.npmjs.com/package/sharp"><code>sharp</code></a>
can be used for dynamic image resizing from within an ASP.NET Core application. There is one copy of the
following image on disk, but we can set up an MVC action method that returns it resized to fit within an
arbitrary width and height.
</p>
<p>
<strong>Dependencies:</strong> On Windows and Linux, there are no native dependencies. Just running
<code>npm install</code> is enough. On OS X, however, you need to have <code>libvips</code> installed,
which you can get through <a href="http://brew.sh/">Homebrew</a> by running
<code>brew install homebrew/science/vips</code>.
</p>
<p>
<em><a href="https://www.flickr.com/photos/dcoetzee/3572948635">Parrot</a>
by <a href="https://www.flickr.com/photos/dcoetzee/">D Coetzee</a>
is dedicated to the <a href="http://creativecommons.org/publicdomain/zero/1.0/">public domain (CC0)</a></em>
</p>
<h3>100px wide [<a href="/resize/images/parrot.jpg?maxWidth=100">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=100" />
<h3>200px wide [<a href="/resize/images/parrot.jpg?maxWidth=200">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=200" />
<h3>400px wide [<a href="/resize/images/parrot.jpg?maxWidth=400">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=400" />
<h3>800px wide [<a href="/resize/images/parrot.jpg?maxWidth=800">open</a>]</h3>
<img src="/resize/images/parrot.jpg?maxWidth=800" />
| apache-2.0 | C# |
17d515101addaeb61b5a2a998552032a2554ea16 | Update logon provider enums | mj1856/SimpleImpersonation | src/LogonProvider.cs | src/LogonProvider.cs | using System;
namespace SimpleImpersonation
{
/// <summary>
/// Specifies the type of login provider used.
/// http://msdn.microsoft.com/en-us/library/windows/desktop/aa378184.aspx
/// </summary>
public enum LogonProvider
{
/// <summary>
/// Use the standard logon provider for the system. The default provider is "Negotiate".
/// However, if you pass NULL for the domain name and the user name is not in UPN format, then the default provider is "NTLM".
/// </summary>
Default = 0,
/// <summary>
/// Use the NTLM logon provider.
/// </summary>
NTLM = 2,
/// <summary>
/// Use the Negotiate logon provider.
/// </summary>
Negotiate = 3,
/// <summary>
/// Use the WINNT35 logon provider.
/// </summary>
[Obsolete("This logon provider has been deprecated and should no longer be used.")]
WINNT35 = 1,
/// <summary>
/// Use the WINNT40 logon provider.
/// </summary>
[Obsolete("This enumeration value is obsolete. To use this provider, specify LogonProvider.NTLM instead.")]
WINNT40 = 2,
/// <summary>
/// Use the WINNT50 logon provider.
/// </summary>
[Obsolete("This enumeration value is obsolete. To use this provider, specify LogonProvider.Negotiate instead.")]
WINNT50 = 3,
}
}
| namespace SimpleImpersonation
{
/// <summary>
/// Specifies the type of login provider used.
/// http://msdn.microsoft.com/en-us/library/windows/desktop/aa378184.aspx
/// </summary>
public enum LogonProvider
{
/// <summary>
/// Use the standard logon provider for the system.
/// The default security provider is negotiate, unless you pass NULL for the domain name and the user name
/// is not in UPN format. In this case, the default provider is NTLM.
/// NOTE: Windows 2000/NT: The default security provider is NTLM.
/// </summary>
Default = 0,
WINNT35 = 1,
WINNT40 = 2,
WINNT50 = 3,
}
}
| mit | C# |
42bc663c6fd08ae6a34ba5edcd516f56972fd9e1 | add interface for HobknobClientFactory | opentable/hobknob-client-net,opentable/hobknob-client-net | HobknobClientNet/HobknobClientFactory.cs | HobknobClientNet/HobknobClientFactory.cs | using System;
namespace HobknobClientNet
{
public interface IHobknobClientFactory
{
IHobknobClient Create(string etcdHost, int etcdPort, string applicationName, TimeSpan cacheUpdateInterval);
}
public class HobknobClientFactory : IHobknobClientFactory
{
public IHobknobClient Create(string etcdHost, int etcdPort, string applicationName, TimeSpan cacheUpdateInterval)
{
var etcdKeysPath = string.Format("http://{0}:{1}/v2/keys/", etcdHost, etcdPort);
var etcdClient = new EtcdClient(new Uri(etcdKeysPath));
var featureToggleProvider = new FeatureToggleProvider(etcdClient, applicationName);
var featureToggleCache = new FeatureToggleCache(featureToggleProvider, cacheUpdateInterval);
var hobknobClient = new HobknobClient(featureToggleCache, applicationName);
featureToggleCache.Initialize();
return hobknobClient;
}
}
}
| using System;
namespace HobknobClientNet
{
public class HobknobClientFactory
{
public IHobknobClient Create(string etcdHost, int etcdPort, string applicationName, TimeSpan cacheUpdateInterval)
{
var etcdKeysPath = string.Format("http://{0}:{1}/v2/keys/", etcdHost, etcdPort);
var etcdClient = new EtcdClient(new Uri(etcdKeysPath));
var featureToggleProvider = new FeatureToggleProvider(etcdClient, applicationName);
var featureToggleCache = new FeatureToggleCache(featureToggleProvider, cacheUpdateInterval);
var hobknobClient = new HobknobClient(featureToggleCache, applicationName);
featureToggleCache.Initialize();
return hobknobClient;
}
}
}
| mit | C# |
1a61e3912b16a9a41cc7c12588c2a10899ad2b4a | Update the what is new | ucdavis/CRP,ucdavis/CRP,ucdavis/CRP | CRP.Mvc/Views/Home/AdminHome.cshtml | CRP.Mvc/Views/Home/AdminHome.cshtml | @{
ViewBag.Title = "AdminHome";
Layout = "~/Views/Shared/_PublicLayout.cshtml";
}
@section NavButtons
{
<div class="pull-right">
@Html.Partial("_LogonPartial")
</div>
}
<div class="boundary">
<h2>Administration Tools</h2>
<p>
@Html.ActionLink("Items", "List", "ItemManagement", null, new { @class = "btn" })
</p>
<p>
@Html.ActionLink("Question Sets", "List", "QuestionSet", null, new { @class = "btn" })
</p>
<p>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Administrative Screens <span class="caret"></span></button>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Transaction Lookup", "AdminLookup", "Transaction")</li>
<li class="divider"></li>
<li>@Html.ActionLink("Application Management", "Index", "ApplicationManagement")</li>
<li>@Html.ActionLink("System Reports", "ViewSystemReport", "Report")</li>
<li>@Html.ActionLink("Manage Users", "ManageUsers", "Account")</li>
</ul>
</div>
</p>
<hr/>
<p>
<a class="btn btn-green" href="https://github.com/ucdavis/CRP/wiki" target="_blank">What's New (May 8, 2018)</a>
</p>
</div>
| @{
ViewBag.Title = "AdminHome";
Layout = "~/Views/Shared/_PublicLayout.cshtml";
}
@section NavButtons
{
<div class="pull-right">
@Html.Partial("_LogonPartial")
</div>
}
<div class="boundary">
<h2>Administration Tools</h2>
<p>
@Html.ActionLink("Items", "List", "ItemManagement", null, new { @class = "btn" })
</p>
<p>
@Html.ActionLink("Question Sets", "List", "QuestionSet", null, new { @class = "btn" })
</p>
<p>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Administrative Screens <span class="caret"></span></button>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Transaction Lookup", "AdminLookup", "Transaction")</li>
<li class="divider"></li>
<li>@Html.ActionLink("Application Management", "Index", "ApplicationManagement")</li>
<li>@Html.ActionLink("System Reports", "ViewSystemReport", "Report")</li>
<li>@Html.ActionLink("Manage Users", "ManageUsers", "Account")</li>
</ul>
</div>
</p>
<hr/>
<p>
<a class="btn btn-green" href="https://github.com/ucdavis/CRP/wiki" target="_blank">What's New (April 9, 2018)</a>
</p>
</div>
| mit | C# |
0cb927d32ad582360b4f9d0e58fe71af527175ca | Add missing using statement in word-count | GKotfis/csharp,robkeim/xcsharp,exercism/xcsharp,GKotfis/csharp,exercism/xcsharp,ErikSchierboom/xcsharp,ErikSchierboom/xcsharp,robkeim/xcsharp | word-count/Example.cs | word-count/Example.cs | using System;
using System.Text.RegularExpressions;
using System.Collections.Generic;
public class Phrase
{
private readonly string _phrase;
public Phrase(string phrase)
{
if (phrase == null) throw new ArgumentNullException("phrase");
_phrase = phrase;
}
public IDictionary<string, int> WordCount()
{
var counts = new Dictionary<string, int>();
Match match = Regex.Match(_phrase.ToLower(), @"\w+'\w+|\w+");
while(match.Success)
{
string word = match.Value;
if(!counts.ContainsKey(word))
{
counts[word] = 0;
}
counts[word]++;
match = match.NextMatch();
}
return counts;
}
} | using System.Text.RegularExpressions;
using System.Collections.Generic;
public class Phrase
{
private readonly string _phrase;
public Phrase(string phrase)
{
if (phrase == null) throw new ArgumentNullException("phrase");
_phrase = phrase;
}
public IDictionary<string, int> WordCount()
{
var counts = new Dictionary<string, int>();
Match match = Regex.Match(_phrase.ToLower(), @"\w+'\w+|\w+");
while(match.Success)
{
string word = match.Value;
if(!counts.ContainsKey(word))
{
counts[word] = 0;
}
counts[word]++;
match = match.NextMatch();
}
return counts;
}
} | mit | C# |
32374684d49e4c45332f33a89ef1153cedaa635d | fix infinte loop on update Unitset | LagoVista/DeviceAdmin | src/LagoVista.IoT.DeviceAdmin.CloudRepos/Repos/UnitSetRepo.cs | src/LagoVista.IoT.DeviceAdmin.CloudRepos/Repos/UnitSetRepo.cs | using LagoVista.Core.PlatformSupport;
using LagoVista.IoT.DeviceAdmin.Models;
using LagoVista.CloudStorage.DocumentDB;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
using LagoVista.IoT.DeviceAdmin.Interfaces.Repos;
namespace LagoVista.IoT.DeviceAdmin.CloudRepos.Repos
{
public class UnitSetRepo : DocumentDBRepoBase<UnitSet>, IUnitSetRepo
{
public UnitSetRepo(IDeviceRepoSettings settings, ILogger logger) : base(settings.DeviceDocDbStorage.Uri, settings.DeviceDocDbStorage.AccessKey, settings.DeviceDocDbStorage.ResourceName, logger)
{
}
protected override bool ShouldConsolidateCollections
{
get
{
return true;
}
}
public Task AddUnitSetAsync(UnitSet unitSet)
{
return CreateDocumentAsync(unitSet);
}
public Task UpdateUnitSetAsync(UnitSet unitSet)
{
return UpsertDocumentAsync(unitSet);
}
public Task<UnitSet> GetUnitSetAsync(string unitSetId)
{
return GetDocumentAsync(unitSetId);
}
public async Task<bool> QueryKeyInUseAsync(string key, string orgId)
{
var items = await base.QueryAsync(attr => (attr.OwnerOrganization.Id == orgId || attr.IsPublic == true) && attr.Key == key);
return items.Any();
}
public async Task<IEnumerable<UnitSetSummary>> GetUnitSetsForOrgAsync(string orgId)
{
var items = await base.QueryAsync(qry => qry.IsPublic == true || qry.OwnerOrganization.Id == orgId);
return from item in items
select item.CreateUnitSetSummary();
}
}
}
| using LagoVista.Core.PlatformSupport;
using LagoVista.IoT.DeviceAdmin.Models;
using LagoVista.CloudStorage.DocumentDB;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
using LagoVista.IoT.DeviceAdmin.Interfaces.Repos;
namespace LagoVista.IoT.DeviceAdmin.CloudRepos.Repos
{
public class UnitSetRepo : DocumentDBRepoBase<UnitSet>, IUnitSetRepo
{
public UnitSetRepo(IDeviceRepoSettings settings, ILogger logger) : base(settings.DeviceDocDbStorage.Uri, settings.DeviceDocDbStorage.AccessKey, settings.DeviceDocDbStorage.ResourceName, logger)
{
}
protected override bool ShouldConsolidateCollections
{
get
{
return true;
}
}
public Task AddUnitSetAsync(UnitSet unitSet)
{
return CreateDocumentAsync(unitSet);
}
public Task UpdateUnitSetAsync(UnitSet unitSet)
{
return UpdateUnitSetAsync(unitSet);
}
public Task<UnitSet> GetUnitSetAsync(string unitSetId)
{
return GetDocumentAsync(unitSetId);
}
public async Task<bool> QueryKeyInUseAsync(string key, string orgId)
{
var items = await base.QueryAsync(attr => (attr.OwnerOrganization.Id == orgId || attr.IsPublic == true) && attr.Key == key);
return items.Any();
}
public async Task<IEnumerable<UnitSetSummary>> GetUnitSetsForOrgAsync(string orgId)
{
var items = await base.QueryAsync(qry => qry.IsPublic == true || qry.OwnerOrganization.Id == orgId);
return from item in items
select item.CreateUnitSetSummary();
}
}
}
| mit | C# |
6a8d0a26885034cb44bbdcc7c64105d9b733e2ea | Bump version | Deadpikle/NetSparkle,Deadpikle/NetSparkle | AssemblyInfo.cs | 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("NetSparkle")]
[assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetSparkle")]
[assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("279448fc-5103-475e-b209-68f3268df7b5")]
// 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.19.0")]
[assembly: AssemblyFileVersion("0.19.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("NetSparkle")]
[assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetSparkle")]
[assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("279448fc-5103-475e-b209-68f3268df7b5")]
// 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.18.3")]
[assembly: AssemblyFileVersion("0.18.3")]
| mit | C# |
727d70e9d87e64e30d9a87fc942b8282a595ec63 | Fix assembly version | Seddryck/NBi,Seddryck/NBi | AssemblyInfo.cs | AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
// 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: AssemblyCompany("NBi Team - Cédric L. Charlier")]
[assembly: AssemblyProduct("NBi")]
[assembly: AssemblyCopyright("Copyright © Cédric L. Charlier 2012-2015")]
[assembly: AssemblyDescription("NBi is a testing framework (add-on to NUnit) for Microsoft Business Intelligence platform and Data Access. The main goal of this framework is to let users create tests with a declarative approach based on an Xml syntax. By the means of NBi, you don't need to develop C# code to specify your tests! Either, you don't need Visual Studio to compile your test suite. Just create an Xml file and let the framework interpret it and play your tests. The framework is designed as an add-on of NUnit but with the possibility to port it easily to other testing frameworks.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//Reference the testing class to ensure access to internal members
[assembly: InternalsVisibleTo("NBi.Testing")]
// 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.14.0.*")] | using System.Reflection;
using System.Runtime.CompilerServices;
// 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: AssemblyCompany("NBi Team - Cédric L. Charlier")]
[assembly: AssemblyProduct("NBi")]
[assembly: AssemblyCopyright("Copyright © Cédric L. Charlier 2012-2015")]
[assembly: AssemblyDescription("NBi is a testing framework (add-on to NUnit) for Microsoft Business Intelligence platform and Data Access. The main goal of this framework is to let users create tests with a declarative approach based on an Xml syntax. By the means of NBi, you don't need to develop C# code to specify your tests! Either, you don't need Visual Studio to compile your test suite. Just create an Xml file and let the framework interpret it and play your tests. The framework is designed as an add-on of NUnit but with the possibility to port it easily to other testing frameworks.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//Reference the testing class to ensure access to internal members
[assembly: InternalsVisibleTo("NBi.Testing")]
// 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.13.0.*")] | apache-2.0 | C# |
3494f759cd42630f21877d70fe45cef4d65f941d | add Id back to Details dto | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Services/FilterListService/FilterListDetailsDto.cs | src/FilterLists.Services/FilterListService/FilterListDetailsDto.cs | using System;
namespace FilterLists.Services.FilterListService
{
public class FilterListDetailsDto
{
public int Id { get; set; }
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
public DateTime? DiscontinuedDate { get; set; }
public string DonateUrl { get; set; }
public string EmailAddress { get; set; }
public string ForumUrl { get; set; }
public string HomeUrl { get; set; }
public string IssuesUrl { get; set; }
public string Name { get; set; }
public string PolicyUrl { get; set; }
public DateTime? PublishedDate { get; set; }
public string SubmissionUrl { get; set; }
public string ViewUrl { get; set; }
}
} | using System;
namespace FilterLists.Services.FilterListService
{
public class FilterListDetailsDto
{
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
public DateTime? DiscontinuedDate { get; set; }
public string DonateUrl { get; set; }
public string EmailAddress { get; set; }
public string ForumUrl { get; set; }
public string HomeUrl { get; set; }
public string IssuesUrl { get; set; }
public string Name { get; set; }
public string PolicyUrl { get; set; }
public DateTime? PublishedDate { get; set; }
public string SubmissionUrl { get; set; }
public string ViewUrl { get; set; }
}
} | mit | C# |
14223f2db7d167fafdcdd4fd77d8cefcc7d01ebb | Revert back to using ControlCharacterVerseData until CharacterDetailData is added (PG-39) | sillsdev/Glyssen,sillsdev/Glyssen | DevTools/BiblicalTerms/Processor.cs | DevTools/BiblicalTerms/Processor.cs | using System.Collections.Generic;
using System.IO;
using System.Linq;
using Palaso.Xml;
using ProtoScript.Character;
namespace DevTools.BiblicalTerms
{
public class Processor
{
public static void Process()
{
var list = XmlSerializationHelper.DeserializeFromFile<BiblicalTermsList>("..\\..\\Resources\\BiblicalTerms.xml");
List<Term> filteredList = list.Terms
.Where(t => t.CategoryIds.Contains("PN")) //PN = proper name
.Where(t => t.Domain.Contains("person") || t.Domain.Contains("group") || t.Domain.Contains("title") || t.Domain.Contains("supernatural beings and powers"))
.Where(t => !t.Id.EndsWith("(DC)")) //don't want deuterocanon
.ToList();
// See what domains we are working with
//List<string> domains = filteredList.Distinct(Term.DomainComparer).Select(t => t.Domain).ToList();
//domains.Sort();
//File.WriteAllLines("..\\..\\Resources\\temporary\\UniqueDomains.txt", domains);
// I used this to ensure there were no categories we didn't expect to sneak in
//List<string> categories = filteredList.Where(t => t.CategoryIds.Count > 1).Select(t => t.CategoryIds[1]).ToList();
//categories.Sort();
//File.WriteAllLines("..\\..\\Resources\\temporary\\categories.txt", categories);
filteredList.Sort(new Term.GlossDomainComparer());
//File.WriteAllLines("..\\..\\Resources\\temporary\\ProperNames.txt", filteredList.Distinct(Term.GlossComparer).Select(t => t.ToTabDelimited()));
// var controlData = CharacterDetailData.Singleton.GetAll();
var controlData = ControlCharacterVerseData.Singleton.GetAllQuoteInfo();
File.WriteAllLines("..\\..\\Resources\\temporary\\duplicatedInControl.txt", filteredList.Select(t => t.Gloss).Intersect(controlData.Select(c => c.Character)));
var notInControlList = filteredList.Where(t => !controlData.Select(c => c.Character).Contains(t.Gloss));
//File.WriteAllLines("..\\..\\Resources\\temporary\\notInControl.txt", notInControlList.Select(t => t.ToTabDelimited()));
var combinedWithoutDuplicates = new BiblicalTermsList { Terms = notInControlList.ToList() }.CombinedReferencesWithoutDuplicates();
File.WriteAllLines("..\\..\\Resources\\temporary\\NamesWithReferencesOnSameLine.txt", combinedWithoutDuplicates.Select(t => t.ToTabDelimited()));
File.WriteAllLines("..\\..\\Resources\\temporary\\NamesWithReferencesOnSeparateLines.txt", combinedWithoutDuplicates.Select(t => t.ToTabDelimitedOneReferencePerLine()));
}
}
}
| using System.Collections.Generic;
using System.IO;
using System.Linq;
using Palaso.Xml;
using ProtoScript.Character;
namespace DevTools.BiblicalTerms
{
public class Processor
{
public static void Process()
{
var list = XmlSerializationHelper.DeserializeFromFile<BiblicalTermsList>("..\\..\\Resources\\BiblicalTerms.xml");
List<Term> filteredList = list.Terms
.Where(t => t.CategoryIds.Contains("PN")) //PN = proper name
.Where(t => t.Domain.Contains("person") || t.Domain.Contains("group") || t.Domain.Contains("title") || t.Domain.Contains("supernatural beings and powers"))
.Where(t => !t.Id.EndsWith("(DC)")) //don't want deuterocanon
.ToList();
// See what domains we are working with
//List<string> domains = filteredList.Distinct(Term.DomainComparer).Select(t => t.Domain).ToList();
//domains.Sort();
//File.WriteAllLines("..\\..\\Resources\\temporary\\UniqueDomains.txt", domains);
// I used this to ensure there were no categories we didn't expect to sneak in
//List<string> categories = filteredList.Where(t => t.CategoryIds.Count > 1).Select(t => t.CategoryIds[1]).ToList();
//categories.Sort();
//File.WriteAllLines("..\\..\\Resources\\temporary\\categories.txt", categories);
filteredList.Sort(new Term.GlossDomainComparer());
//File.WriteAllLines("..\\..\\Resources\\temporary\\ProperNames.txt", filteredList.Distinct(Term.GlossComparer).Select(t => t.ToTabDelimited()));
var controlData = CharacterDetailData.Singleton.GetAll();
File.WriteAllLines("..\\..\\Resources\\temporary\\duplicatedInControl.txt", filteredList.Select(t => t.Gloss).Intersect(controlData.Select(c => c.Character)));
var notInControlList = filteredList.Where(t => !controlData.Select(c => c.Character).Contains(t.Gloss));
//File.WriteAllLines("..\\..\\Resources\\temporary\\notInControl.txt", notInControlList.Select(t => t.ToTabDelimited()));
var combinedWithoutDuplicates = new BiblicalTermsList { Terms = notInControlList.ToList() }.CombinedReferencesWithoutDuplicates();
File.WriteAllLines("..\\..\\Resources\\temporary\\NamesWithReferencesOnSameLine.txt", combinedWithoutDuplicates.Select(t => t.ToTabDelimited()));
File.WriteAllLines("..\\..\\Resources\\temporary\\NamesWithReferencesOnSeparateLines.txt", combinedWithoutDuplicates.Select(t => t.ToTabDelimitedOneReferencePerLine()));
}
}
}
| mit | C# |
1ae2fe66c0ea2cadc29e1e591b18861b7b7162f3 | add logging of GitHub API errors | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Agent/Infrastructure/Clients/AgentGitHubClient.cs | src/FilterLists.Agent/Infrastructure/Clients/AgentGitHubClient.cs | using System.Collections.Generic;
using System.Threading.Tasks;
using FilterLists.Agent.AppSettings;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Octokit;
namespace FilterLists.Agent.Infrastructure.Clients
{
public interface IAgentGitHubClient
{
Task<IReadOnlyList<Issue>> GetAllIssues(RepositoryIssueRequest repositoryIssueRequest);
Task<Issue> CreateIssue(NewIssue newIssue);
Task<Issue> UpdateIssue(int issueNumber, IssueUpdate updateIssue);
}
public class AgentGitHubClient : IAgentGitHubClient
{
private readonly GitHubClient _gitHubClient;
private readonly GitHub _gitHubOptions;
private readonly ILogger<AgentGitHubClient> _logger;
public AgentGitHubClient(IOptions<GitHub> gitHubOptions, ILogger<AgentGitHubClient> logger)
{
_gitHubOptions = gitHubOptions.Value;
_logger = logger;
_gitHubClient = new GitHubClient(new ProductHeaderValue(_gitHubOptions.ProductHeaderValue))
{
Credentials = new Credentials(_gitHubOptions.PersonalAccessToken)
};
}
public async Task<IReadOnlyList<Issue>> GetAllIssues(RepositoryIssueRequest repositoryIssueRequest)
{
try
{
return await _gitHubClient.Issue.GetAllForRepository(_gitHubOptions.RepositoryOwner,
_gitHubOptions.Repository, repositoryIssueRequest);
}
catch (ApiException ex)
{
_logger.LogError(ex, "Failed getting all Issues from the GitHub API.");
return null;
}
}
public async Task<Issue> CreateIssue(NewIssue newIssue)
{
try
{
return await _gitHubClient.Issue.Create(_gitHubOptions.RepositoryOwner, _gitHubOptions.Repository,
newIssue);
}
catch (ApiException ex)
{
_logger.LogError(ex, "Failed creating Issue with the GitHub API.");
return null;
}
}
public async Task<Issue> UpdateIssue(int issueNumber, IssueUpdate updateIssue)
{
try
{
return await _gitHubClient.Issue.Update(_gitHubOptions.RepositoryOwner, _gitHubOptions.Repository,
issueNumber, updateIssue);
}
catch (ApiException ex)
{
_logger.LogError(ex, "Failed updating Issue with the GitHub API.");
return null;
}
}
}
} | using System.Collections.Generic;
using System.Threading.Tasks;
using FilterLists.Agent.AppSettings;
using Microsoft.Extensions.Options;
using Octokit;
namespace FilterLists.Agent.Infrastructure.Clients
{
public interface IAgentGitHubClient
{
Task<IReadOnlyList<Issue>> GetAllIssues(RepositoryIssueRequest repositoryIssueRequest);
Task<Issue> CreateIssue(NewIssue newIssue);
Task<Issue> UpdateIssue(int issueNumber, IssueUpdate updateIssue);
}
public class AgentGitHubClient : IAgentGitHubClient
{
private readonly GitHubClient _gitHubClient;
private readonly GitHub _gitHubOptions;
public AgentGitHubClient(IOptions<GitHub> gitHubOptions)
{
_gitHubOptions = gitHubOptions.Value;
_gitHubClient = new GitHubClient(new ProductHeaderValue(_gitHubOptions.ProductHeaderValue))
{
Credentials = new Credentials(_gitHubOptions.PersonalAccessToken)
};
}
public async Task<IReadOnlyList<Issue>> GetAllIssues(RepositoryIssueRequest repositoryIssueRequest)
{
return await _gitHubClient.Issue.GetAllForRepository(_gitHubOptions.RepositoryOwner,
_gitHubOptions.Repository, repositoryIssueRequest);
}
public async Task<Issue> CreateIssue(NewIssue newIssue)
{
return await _gitHubClient.Issue.Create(_gitHubOptions.RepositoryOwner, _gitHubOptions.Repository,
newIssue);
}
public async Task<Issue> UpdateIssue(int issueNumber, IssueUpdate updateIssue)
{
return await _gitHubClient.Issue.Update(_gitHubOptions.RepositoryOwner, _gitHubOptions.Repository,
issueNumber, updateIssue);
}
}
} | mit | C# |
0d5cf281e876341b76e8c38fb4bbae8f20e09df9 | test commit | olebg/Movie-Theater-Project | MovieTheater/MovieTheater.Models/Hall.cs | MovieTheater/MovieTheater.Models/Hall.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MovieTheater.Models
{
public class Hall
{
public int MyProperty { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MovieTheater.Models
{
class Hall
{
}
}
| mit | C# |
dbc26c3534e37108497ae64e040ba32101988fa6 | Add failing test assertion | peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu | osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.cs | osu.Game.Tests/Visual/Gameplay/TestSceneDrawableStoryboardSprite.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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Skinning;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Drawables;
using osuTK;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneDrawableStoryboardSprite : SkinnableTestScene
{
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
[Cached]
private Storyboard storyboard { get; set; } = new Storyboard();
private IEnumerable<DrawableStoryboardSprite> sprites => this.ChildrenOfType<DrawableStoryboardSprite>();
[Test]
public void TestSkinSpriteDisallowedByDefault()
{
const string lookup_name = "hitcircleoverlay";
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = false);
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
assertSpritesFromSkin(false);
}
[Test]
public void TestAllowLookupFromSkin()
{
const string lookup_name = "hitcircleoverlay";
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = true);
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
assertSpritesFromSkin(true);
AddAssert("skinnable sprite has correct size", () => sprites.Any(s => Precision.AlmostEquals(s.ChildrenOfType<SkinnableSprite>().Single().Size, new Vector2(128, 128))));
}
private DrawableStoryboardSprite createSprite(string lookupName, Anchor origin, Vector2 initialPosition)
=> new DrawableStoryboardSprite(
new StoryboardSprite(lookupName, origin, initialPosition)
).With(s =>
{
s.LifetimeStart = double.MinValue;
s.LifetimeEnd = double.MaxValue;
});
private void assertSpritesFromSkin(bool fromSkin) =>
AddAssert($"sprites are {(fromSkin ? "from skin" : "from storyboard")}",
() => sprites.All(sprite => sprite.ChildrenOfType<SkinnableSprite>().Any() == fromSkin));
}
}
| // 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.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Skinning;
using osu.Game.Storyboards;
using osu.Game.Storyboards.Drawables;
using osuTK;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneDrawableStoryboardSprite : SkinnableTestScene
{
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
[Cached]
private Storyboard storyboard { get; set; } = new Storyboard();
[Test]
public void TestSkinSpriteDisallowedByDefault()
{
const string lookup_name = "hitcircleoverlay";
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = false);
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
assertSpritesFromSkin(false);
}
[Test]
public void TestAllowLookupFromSkin()
{
const string lookup_name = "hitcircleoverlay";
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = true);
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.Centre, Vector2.Zero)));
assertSpritesFromSkin(true);
}
private DrawableStoryboardSprite createSprite(string lookupName, Anchor origin, Vector2 initialPosition)
=> new DrawableStoryboardSprite(
new StoryboardSprite(lookupName, origin, initialPosition)
).With(s =>
{
s.LifetimeStart = double.MinValue;
s.LifetimeEnd = double.MaxValue;
});
private void assertSpritesFromSkin(bool fromSkin) =>
AddAssert($"sprites are {(fromSkin ? "from skin" : "from storyboard")}",
() => this.ChildrenOfType<DrawableStoryboardSprite>()
.All(sprite => sprite.ChildrenOfType<SkinnableSprite>().Any() == fromSkin));
}
}
| mit | C# |
ede5abdba4eb0f88806c38790c7a622546f70af9 | Fix unstable multiplayer room ordering when selection is made | NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu,ppy/osu,UselessToucan/osu,ppy/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu-new | osu.Game/Screens/OnlinePlay/Components/SelectionPollingComponent.cs | osu.Game/Screens/OnlinePlay/Components/SelectionPollingComponent.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.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Components
{
/// <summary>
/// A <see cref="RoomPollingComponent"/> that polls for the currently-selected room.
/// </summary>
public class SelectionPollingComponent : RoomPollingComponent
{
[Resolved]
private Bindable<Room> selectedRoom { get; set; }
[Resolved]
private IRoomManager roomManager { get; set; }
[BackgroundDependencyLoader]
private void load()
{
selectedRoom.BindValueChanged(_ =>
{
if (IsLoaded)
PollImmediately();
});
}
private GetRoomRequest pollReq;
protected override Task Poll()
{
if (!API.IsLoggedIn)
return base.Poll();
if (selectedRoom.Value?.RoomID.Value == null)
return base.Poll();
var tcs = new TaskCompletionSource<bool>();
pollReq?.Cancel();
pollReq = new GetRoomRequest(selectedRoom.Value.RoomID.Value.Value);
pollReq.Success += result =>
{
// existing rooms need to be ordered by their position because the received of NotifyRoomsReceives expects to be able to sort them based on this order.
var rooms = new List<Room>(roomManager.Rooms.OrderBy(r => r.Position.Value));
int index = rooms.FindIndex(r => r.RoomID.Value == result.RoomID.Value);
if (index < 0)
return;
rooms[index] = result;
NotifyRoomsReceived(rooms);
tcs.SetResult(true);
};
pollReq.Failure += _ => tcs.SetResult(false);
API.Queue(pollReq);
return tcs.Task;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Components
{
/// <summary>
/// A <see cref="RoomPollingComponent"/> that polls for the currently-selected room.
/// </summary>
public class SelectionPollingComponent : RoomPollingComponent
{
[Resolved]
private Bindable<Room> selectedRoom { get; set; }
[Resolved]
private IRoomManager roomManager { get; set; }
[BackgroundDependencyLoader]
private void load()
{
selectedRoom.BindValueChanged(_ =>
{
if (IsLoaded)
PollImmediately();
});
}
private GetRoomRequest pollReq;
protected override Task Poll()
{
if (!API.IsLoggedIn)
return base.Poll();
if (selectedRoom.Value?.RoomID.Value == null)
return base.Poll();
var tcs = new TaskCompletionSource<bool>();
pollReq?.Cancel();
pollReq = new GetRoomRequest(selectedRoom.Value.RoomID.Value.Value);
pollReq.Success += result =>
{
var rooms = new List<Room>(roomManager.Rooms);
int index = rooms.FindIndex(r => r.RoomID.Value == result.RoomID.Value);
if (index < 0)
return;
rooms[index] = result;
NotifyRoomsReceived(rooms);
tcs.SetResult(true);
};
pollReq.Failure += _ => tcs.SetResult(false);
API.Queue(pollReq);
return tcs.Task;
}
}
}
| mit | C# |
75858dbde4c4c9e858ee00dd511e38e62a6c385b | Fix last commit | atompacman/ConfitureCreative | Assets/Script/PlayerController.cs | Assets/Script/PlayerController.cs | using UnityEngine;
using System.Collections;
[System.Serializable]
public class Boundary
{
public float xMin, xMax, yMin, yMax;
}
public class PlayerController : MonoBehaviour {
public Boundary boundary;
public float speed = 10.0f;
public Vector3 tilt;
public Vector3 externalVelocity = Vector3.zero;
private Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void FixedUpdate () {
float moveHorizontal = -Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, moveVertical, -1.0f);
rb.velocity = speed * movement + externalVelocity;
rb.position = new Vector3
(
Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
Mathf.Clamp(rb.position.y, boundary.yMin, boundary.yMax),
rb.position.z
);
rb.rotation = Quaternion.Euler(rb.velocity.y * + tilt.x, rb.velocity.x * -tilt.y, rb.velocity.x * -tilt.z);
}
}
| using UnityEngine;
using System.Collections;
[System.Serializable]
public class Boundary
{
public float xMin, xMax, yMin, yMax;
}
public class PlayerController : MonoBehaviour {
public Boundary boundary;
public float speed = 10.0f;
public Vector3 tilt;
private Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void FixedUpdate () {
float moveHorizontal = -Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, moveVertical, -1.0f);
rb.velocity = speed * movement;
rb.position = new Vector3
(
Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
Mathf.Clamp(rb.position.y, boundary.yMin, boundary.yMax),
rb.position.z
);
rb.rotation = Quaternion.Euler(rb.velocity.y * + tilt.x, rb.velocity.x * -tilt.y, rb.velocity.x * -tilt.z);
}
}
| mit | C# |
c74f89d58a38afa9e9c6da0692019b16e5907250 | bump version to 2.6.0 | piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker | Piwik.Tracker/Properties/AssemblyInfo.cs | Piwik.Tracker/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.0")]
| bsd-3-clause | C# |
ab6a3d0aaac7366105c3d3377d108053ea1bb790 | Update SMSTodayAMController.cs | dkitchen/bpcc,dkitchen/bpcc | src/BPCCScheduler.Web/Controllers/SMSTodayAMController.cs | src/BPCCScheduler.Web/Controllers/SMSTodayAMController.cs | using BPCCScheduler.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Twilio;
namespace BPCCScheduler.Controllers
{
public class SMSTodayAMController : SMSApiController
{
//public IEnumerable<SMSMessage> Get()
public string Get()
{
//any appointment today after last-night midnight, but before today noon
var lastNightMidnight = DateTime.Now.Date;
var ret = "";
ret += lastNightMidnight.ToLongDateString();
ret += " " + lastNightMidnight.ToLongTimeString()
var todayNoon = lastNightMidnight.AddHours(12);
ret += " " + todayNoon.ToLongDateString();
ret += " " + todayNoon.ToLongTimeString()
return ret;
var appts = base.AppointmentContext.Appointments.ToList() //materialize for date conversion
.Where(i => i.Date.ToLocalTime() > lastNightMidnight && i.Date.ToLocalTime() < todayNoon);
var messages = new List<SMSMessage>();
foreach (var appt in appts)
{
var body = string.Format("BPCC Reminder: Appointment this morning at {0}",
appt.Date.ToLocalTime().ToShortTimeString());
var cell = string.Format("+1{0}", appt.Cell);
messages.Add(base.SendSmsMessage(cell, body));
}
//return messages;
}
}
}
| using BPCCScheduler.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Twilio;
namespace BPCCScheduler.Controllers
{
public class SMSTodayAMController : SMSApiController
{
//public IEnumerable<SMSMessage> Get()
public string Get()
{
//any appointment today after last-night midnight, but before today noon
var lastNightMidnight = DateTime.Now.Date;
var ret = "";
ret += lastNightMidnight.ToLongDateString();
var todayNoon = lastNightMidnight.AddHours(12);
return ret;
var appts = base.AppointmentContext.Appointments.ToList() //materialize for date conversion
.Where(i => i.Date.ToLocalTime() > lastNightMidnight && i.Date.ToLocalTime() < todayNoon);
var messages = new List<SMSMessage>();
foreach (var appt in appts)
{
var body = string.Format("BPCC Reminder: Appointment this morning at {0}",
appt.Date.ToLocalTime().ToShortTimeString());
var cell = string.Format("+1{0}", appt.Cell);
messages.Add(base.SendSmsMessage(cell, body));
}
//return messages;
}
}
}
| mit | C# |
56eef4dc8286fa9433865f4307bdd2f1367ebaa5 | Revert "UWP Sample checks for running state" | bitbonk/Caliburn.Micro | samples/Caliburn.Micro.HelloUWP/Caliburn.Micro.HelloUWP/App.xaml.cs | samples/Caliburn.Micro.HelloUWP/Caliburn.Micro.HelloUWP/App.xaml.cs | using System;
using System.Collections.Generic;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Caliburn.Micro.HelloUWP.Messages;
using Caliburn.Micro.HelloUWP.ViewModels;
namespace Caliburn.Micro.HelloUWP
{
public sealed partial class App
{
private WinRTContainer _container;
private IEventAggregator _eventAggregator;
public App()
{
InitializeComponent();
}
protected override void Configure()
{
_container = new WinRTContainer();
_container.RegisterWinRTServices();
_container
.PerRequest<ShellViewModel>()
.PerRequest<DeviceViewModel>();
_eventAggregator = _container.GetInstance<IEventAggregator>();
}
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
// Note we're using DisplayRootViewFor (which is view model first)
// this means we're not creating a root frame and just directly
// inserting ShellView as the Window.Content
DisplayRootViewFor<ShellViewModel>();
// It's kinda of weird having to use the event aggregator to pass
// a value to ShellViewModel, could be an argument for allowing
// parameters or launch arguments
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
_eventAggregator.PublishOnUIThread(new ResumeStateMessage());
}
}
protected override void OnSuspending(object sender, SuspendingEventArgs e)
{
_eventAggregator.PublishOnUIThread(new SuspendStateMessage(e.SuspendingOperation));
}
protected override object GetInstance(Type service, string key)
{
return _container.GetInstance(service, key);
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return _container.GetAllInstances(service);
}
protected override void BuildUp(object instance)
{
_container.BuildUp(instance);
}
}
}
| using System;
using System.Collections.Generic;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Caliburn.Micro.HelloUWP.Messages;
using Caliburn.Micro.HelloUWP.ViewModels;
namespace Caliburn.Micro.HelloUWP
{
public sealed partial class App
{
private WinRTContainer _container;
private IEventAggregator _eventAggregator;
public App()
{
InitializeComponent();
}
protected override void Configure()
{
_container = new WinRTContainer();
_container.RegisterWinRTServices();
_container
.PerRequest<ShellViewModel>()
.PerRequest<DeviceViewModel>();
_eventAggregator = _container.GetInstance<IEventAggregator>();
}
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
if (args.PreviousExecutionState == ApplicationExecutionState.Running)
return;
// Note we're using DisplayRootViewFor (which is view model first)
// this means we're not creating a root frame and just directly
// inserting ShellView as the Window.Content
DisplayRootViewFor<ShellViewModel>();
// It's kinda of weird having to use the event aggregator to pass
// a value to ShellViewModel, could be an argument for allowing
// parameters or launch arguments
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
_eventAggregator.PublishOnUIThread(new ResumeStateMessage());
}
}
protected override void OnSuspending(object sender, SuspendingEventArgs e)
{
_eventAggregator.PublishOnUIThread(new SuspendStateMessage(e.SuspendingOperation));
}
protected override object GetInstance(Type service, string key)
{
return _container.GetInstance(service, key);
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return _container.GetAllInstances(service);
}
protected override void BuildUp(object instance)
{
_container.BuildUp(instance);
}
}
}
| mit | C# |
d4daefff68cd3f28534139e5348a580a77e8991d | Build and publish nuget package | RockFramework/Rock.StaticDependencyInjection,bfriesen/Rock.StaticDependencyInjection | src/Properties/AssemblyInfo.cs | src/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("Rock.StaticDependencyInjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rock.StaticDependencyInjection")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6ce9fe22-010d-441a-b954-7c924537a503")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.2")]
[assembly: AssemblyInformationalVersion("1.1.2")]
| 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("Rock.StaticDependencyInjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rock.StaticDependencyInjection")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6ce9fe22-010d-441a-b954-7c924537a503")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.1")]
[assembly: AssemblyInformationalVersion("1.1.1")]
| mit | C# |
ca2ac41a3b1cfaada71e2255e7ed99e546d4a653 | Remove duplicate line | elmahio/elmah.io.log4net | src/Elmah.Io.AspNetCore.Log4Net/ElmahIoLog4NetMiddleware.cs | src/Elmah.Io.AspNetCore.Log4Net/ElmahIoLog4NetMiddleware.cs | using log4net;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Elmah.Io.AspNetCore.Log4Net
{
public class ElmahIoLog4NetMiddleware
{
private readonly RequestDelegate _next;
public ElmahIoLog4NetMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
LogicalThreadContext.Properties["url"] = context.Request?.Path.Value;
LogicalThreadContext.Properties["method"] = context.Request?.Method;
LogicalThreadContext.Properties["statuscode"] = context.Response.StatusCode;
LogicalThreadContext.Properties["user"] = context.User?.Identity?.Name;
LogicalThreadContext.Properties["servervariables"] = ServerVariables(context);
LogicalThreadContext.Properties["cookies"] = Cookies(context);
LogicalThreadContext.Properties["form"] = Form(context);
LogicalThreadContext.Properties["querystring"] = QueryString(context);
await _next.Invoke(context);
}
private Dictionary<string, string> QueryString(HttpContext context)
{
return context.Request?.Query?.Keys.ToDictionary(k => k, k => context.Request.Query[k].ToString());
}
private Dictionary<string, string> Form(HttpContext context)
{
try
{
return context.Request?.Form?.Keys.ToDictionary(k => k, k => context.Request.Form[k].ToString());
}
catch (InvalidOperationException)
{
// Request not a form POST or similar
}
return new Dictionary<string, string>();
}
private Dictionary<string, string> Cookies(HttpContext context)
{
return context.Request?.Cookies?.Keys.ToDictionary(k => k, k => context.Request.Cookies[k].ToString());
}
private Dictionary<string, string> ServerVariables(HttpContext context)
{
return context.Request?.Headers?.Keys.ToDictionary(k => k, k => context.Request.Headers[k].ToString());
}
}
}
| using log4net;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Elmah.Io.AspNetCore.Log4Net
{
public class ElmahIoLog4NetMiddleware
{
private readonly RequestDelegate _next;
public ElmahIoLog4NetMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
LogicalThreadContext.Properties["url"] = context.Request?.Path.Value;
LogicalThreadContext.Properties["method"] = context.Request?.Method;
LogicalThreadContext.Properties["statuscode"] = context.Response.StatusCode;
LogicalThreadContext.Properties["user"] = context.User?.Identity?.Name;
LogicalThreadContext.Properties["user"] = context.User?.Identity?.Name;
LogicalThreadContext.Properties["servervariables"] = ServerVariables(context);
LogicalThreadContext.Properties["cookies"] = Cookies(context);
LogicalThreadContext.Properties["form"] = Form(context);
LogicalThreadContext.Properties["querystring"] = QueryString(context);
await _next.Invoke(context);
}
private Dictionary<string, string> QueryString(HttpContext context)
{
return context.Request?.Query?.Keys.ToDictionary(k => k, k => context.Request.Query[k].ToString());
}
private Dictionary<string, string> Form(HttpContext context)
{
try
{
return context.Request?.Form?.Keys.ToDictionary(k => k, k => context.Request.Form[k].ToString());
}
catch (InvalidOperationException)
{
// Request not a form POST or similar
}
return new Dictionary<string, string>();
}
private Dictionary<string, string> Cookies(HttpContext context)
{
return context.Request?.Cookies?.Keys.ToDictionary(k => k, k => context.Request.Cookies[k].ToString());
}
private Dictionary<string, string> ServerVariables(HttpContext context)
{
return context.Request?.Headers?.Keys.ToDictionary(k => k, k => context.Request.Headers[k].ToString());
}
}
}
| apache-2.0 | C# |
b473dbdc7a8efc68e8fec0c06d4ad82449da805b | modify ProtocolBufSerializer.cs implementation. | tangxuehua/ecommon,Aaron-Liu/ecommon | src/Extensions/ECommon.ProtocolBuf/ProtocolBufSerializer.cs | src/Extensions/ECommon.ProtocolBuf/ProtocolBufSerializer.cs | using System;
using System.IO;
using ECommon.Serializing;
using ProtoBuf;
namespace ECommon.ProtocolBuf
{
public class ProtocolBufSerializer : IBinarySerializer
{
public byte[] Serialize(object obj)
{
using (var stream = new MemoryStream())
{
Serializer.Serialize(stream, obj);
return stream.ToArray();
}
}
public T Deserialize<T>(byte[] data) where T : class
{
using (var stream = new MemoryStream(data))
{
return Serializer.Deserialize<T>(stream);
}
}
public object Deserialize(byte[] data, Type type)
{
using (var stream = new MemoryStream(data))
{
return Serializer.NonGeneric.Deserialize(type, stream);
}
}
}
}
| using System;
using System.IO;
using System.Runtime.Serialization;
using ECommon.Serializing;
using ProtoBuf;
namespace ECommon.ProtocolBuf
{
public class ProtocolBufSerializer : IBinarySerializer
{
public byte[] Serialize(object obj)
{
using (var stream = new MemoryStream())
{
Serializer.Serialize(stream, obj);
return stream.ToArray();
}
}
public T Deserialize<T>(byte[] data) where T : class
{
using (var stream = new MemoryStream(data))
{
var instance = FormatterServices.GetUninitializedObject(typeof(T)) as T;
Serializer.Merge(stream, instance);
return instance;
}
}
public object Deserialize(byte[] data, Type type)
{
using (var stream = new MemoryStream(data))
{
var instance = FormatterServices.GetUninitializedObject(type);
Serializer.NonGeneric.Merge(stream, instance);
return instance;
}
}
}
}
| mit | C# |
c75d8748f496a39146327330950a469746233db8 | Enable tests parallelization for all build configurations | atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata | src/Atata.Tests/NUnitSettings.cs | src/Atata.Tests/NUnitSettings.cs | using NUnit.Framework;
[assembly: Parallelizable(ParallelScope.Fixtures)]
| #if DEBUG
using NUnit.Framework;
[assembly: LevelOfParallelism(4)]
[assembly: Parallelizable(ParallelScope.Fixtures)]
#endif
| apache-2.0 | C# |
dc5466adda364c36010e0716f4703fa35930861b | Allow OuterLoop on a class | naamunds/buildtools,nguerrera/buildtools,tarekgh/buildtools,ChadNedzlek/buildtools,ericstj/buildtools,alexperovich/buildtools,jthelin/dotnet-buildtools,jhendrixMSFT/buildtools,schaabs/buildtools,maririos/buildtools,mmitche/buildtools,dotnet/buildtools,roncain/buildtools,maririos/buildtools,roncain/buildtools,MattGal/buildtools,joperezr/buildtools,weshaggard/buildtools,maririos/buildtools,weshaggard/buildtools,alexperovich/buildtools,ericstj/buildtools,naamunds/buildtools,chcosta/buildtools,weshaggard/buildtools,roncain/buildtools,schaabs/buildtools,AlexGhiondea/buildtools,MattGal/buildtools,jhendrixMSFT/buildtools,jthelin/dotnet-buildtools,stephentoub/buildtools,AlexGhiondea/buildtools,naamunds/buildtools,karajas/buildtools,MattGal/buildtools,stephentoub/buildtools,alexperovich/buildtools,tarekgh/buildtools,ericstj/buildtools,JeremyKuhne/buildtools,jhendrixMSFT/buildtools,JeremyKuhne/buildtools,jhendrixMSFT/buildtools,karajas/buildtools,ianhays/buildtools,ChadNedzlek/buildtools,maririos/buildtools,ianhays/buildtools,stephentoub/buildtools,chcosta/buildtools,schaabs/buildtools,naamunds/buildtools,mmitche/buildtools,joperezr/buildtools,mmitche/buildtools,jthelin/dotnet-buildtools,JeremyKuhne/buildtools,chcosta/buildtools,tarekgh/buildtools,ChadNedzlek/buildtools,mmitche/buildtools,weshaggard/buildtools,joperezr/buildtools,nguerrera/buildtools,ianhays/buildtools,venkat-raman251/buildtools,ericstj/buildtools,chcosta/buildtools,roncain/buildtools,venkat-raman251/buildtools,crummel/dotnet_buildtools,jthelin/dotnet-buildtools,pgavlin/buildtools,JeremyKuhne/buildtools,alexperovich/buildtools,karajas/buildtools,nguerrera/buildtools,stephentoub/buildtools,alexperovich/buildtools,crummel/dotnet_buildtools,dotnet/buildtools,dotnet/buildtools,ChadNedzlek/buildtools,MattGal/buildtools,mmitche/buildtools,schaabs/buildtools,ianhays/buildtools,AlexGhiondea/buildtools,nguerrera/buildtools,joperezr/buildtools,tarekgh/buildtools,joperezr/buildtools,dotnet/buildtools,karajas/buildtools,FiveTimesTheFun/buildtools,tarekgh/buildtools,crummel/dotnet_buildtools,crummel/dotnet_buildtools,MattGal/buildtools,AlexGhiondea/buildtools | src/xunit.netcore.extensions/Attributes/OuterLoopAttribute.cs | src/xunit.netcore.extensions/Attributes/OuterLoopAttribute.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Xunit.Sdk;
namespace Xunit
{
/// <summary>
/// Apply this attribute to your test method to specify a outer-loop category.
/// </summary>
[TraitDiscoverer("Xunit.NetCore.Extensions.OuterLoopTestsDiscoverer", "Xunit.NetCore.Extensions")]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
public class OuterLoopAttribute : Attribute, ITraitAttribute
{
public OuterLoopAttribute() { }
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Xunit.Sdk;
namespace Xunit
{
/// <summary>
/// Apply this attribute to your test method to specify a outer-loop category.
/// </summary>
[TraitDiscoverer("Xunit.NetCore.Extensions.OuterLoopTestsDiscoverer", "Xunit.NetCore.Extensions")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class OuterLoopAttribute : Attribute, ITraitAttribute
{
public OuterLoopAttribute() { }
}
}
| mit | C# |
fbfa98171296a67c7a394b6d3a7c6056d3a61367 | Rename handle parameter | ektrah/nsec | src/Cryptography/SharedSecret.cs | src/Cryptography/SharedSecret.cs | using System;
using System.Diagnostics;
using static Interop.Libsodium;
namespace NSec.Cryptography
{
[DebuggerDisplay("Size = {Size}")]
public sealed class SharedSecret : IDisposable
{
private readonly SecureMemoryHandle _handle;
internal SharedSecret(
SecureMemoryHandle sharedSecretHandle)
{
Debug.Assert(sharedSecretHandle != null);
sharedSecretHandle.MakeReadOnly();
_handle = sharedSecretHandle;
}
public int Size => _handle.Length;
internal SecureMemoryHandle Handle => _handle;
public static SharedSecret Import(
ReadOnlySpan<byte> sharedSecret)
{
if (sharedSecret.Length > 128)
throw new ArgumentException(Error.ArgumentExceptionMessage, nameof(sharedSecret));
Sodium.Initialize();
SecureMemoryHandle sharedSecretHandle = null;
bool success = false;
try
{
SecureMemoryHandle.Alloc(sharedSecret.Length, out sharedSecretHandle);
sharedSecretHandle.Import(sharedSecret);
success = true;
}
finally
{
if (!success && sharedSecretHandle != null)
{
sharedSecretHandle.Dispose();
}
}
return new SharedSecret(sharedSecretHandle);
}
public void Dispose()
{
_handle.Dispose();
}
}
}
| using System;
using System.Diagnostics;
using static Interop.Libsodium;
namespace NSec.Cryptography
{
[DebuggerDisplay("Size = {Size}")]
public sealed class SharedSecret : IDisposable
{
private readonly SecureMemoryHandle _handle;
internal SharedSecret(
SecureMemoryHandle handle)
{
Debug.Assert(handle != null);
handle.MakeReadOnly();
_handle = handle;
}
public int Size => _handle.Length;
internal SecureMemoryHandle Handle => _handle;
public static SharedSecret Import(
ReadOnlySpan<byte> sharedSecret)
{
if (sharedSecret.Length > 128)
throw new ArgumentException(Error.ArgumentExceptionMessage, nameof(sharedSecret));
Sodium.Initialize();
SecureMemoryHandle sharedSecretHandle = null;
bool success = false;
try
{
SecureMemoryHandle.Alloc(sharedSecret.Length, out sharedSecretHandle);
sharedSecretHandle.Import(sharedSecret);
success = true;
}
finally
{
if (!success && sharedSecretHandle != null)
{
sharedSecretHandle.Dispose();
}
}
return new SharedSecret(sharedSecretHandle);
}
public void Dispose()
{
_handle.Dispose();
}
}
}
| mit | C# |
8cc0b1db3bfb5f4050309636ab292c7a6f8b34d9 | Update ParameterBuilder.cs | giserh/raml-dotnet-parser,giserh/raml-dotnet-parser | Raml.Parser/Builders/ParameterBuilder.cs | Raml.Parser/Builders/ParameterBuilder.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Raml.Parser.Expressions;
namespace Raml.Parser.Builders
{
public class ParameterBuilder
{
public Parameter Build(IDictionary<string, object> dynamicRaml)
{
var parameter = new Parameter();
parameter.Type = dynamicRaml.ContainsKey("type") ? (string) dynamicRaml["type"] : null;
parameter.Required = dynamicRaml.ContainsKey("required") && (bool) dynamicRaml["required"];
parameter.DisplayName = dynamicRaml.ContainsKey("displayName") ? (string) dynamicRaml["displayName"] : null;
parameter.Description = dynamicRaml.ContainsKey("description") ? (string) dynamicRaml["description"] : null;
parameter.Enum = GetEnum(dynamicRaml);
parameter.Repeat = dynamicRaml.ContainsKey("repeat") && (bool) dynamicRaml["repeat"];
parameter.Example = dynamicRaml.ContainsKey("example") ? dynamicRaml["example"].ToString() : null;
parameter.Default = dynamicRaml.ContainsKey("default") ? (dynamicRaml["default"] != null ? dynamicRaml["default"].ToString() : null) : null;
parameter.Pattern = dynamicRaml.ContainsKey("pattern") ? (string) dynamicRaml["pattern"] : null;
parameter.MinLength = dynamicRaml.ContainsKey("minLength") ? Convert.ToInt32(dynamicRaml["minLength"]) : (int?) null;
parameter.MaxLength = dynamicRaml.ContainsKey("maxLength") ? Convert.ToInt32(dynamicRaml["maxLength"]) : (int?) null;
parameter.Minimum = dynamicRaml.ContainsKey("minimum") ? Convert.ToDecimal(dynamicRaml["minimum"]) : (decimal?) null;
parameter.Maximum = dynamicRaml.ContainsKey("maximum") ? Convert.ToDecimal(dynamicRaml["maximum"]) : (decimal?) null;
return parameter;
}
private static IEnumerable<string> GetEnum(IDictionary<string, object> dynamicRaml)
{
if (!dynamicRaml.ContainsKey("enum")) return null;
var objects = ((object[]) dynamicRaml["enum"]);
return objects.Select(obj => obj.ToString()).ToArray();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Raml.Parser.Expressions;
namespace Raml.Parser.Builders
{
public class ParameterBuilder
{
public Parameter Build(IDictionary<string, object> dynamicRaml)
{
var parameter = new Parameter();
parameter.Type = dynamicRaml.ContainsKey("type") ? (string) dynamicRaml["type"] : null;
parameter.Required = dynamicRaml.ContainsKey("required") && (bool) dynamicRaml["required"];
parameter.DisplayName = dynamicRaml.ContainsKey("displayName") ? (string) dynamicRaml["displayName"] : null;
parameter.Description = dynamicRaml.ContainsKey("description") ? (string) dynamicRaml["description"] : null;
parameter.Enum = GetEnum(dynamicRaml);
parameter.Repeat = dynamicRaml.ContainsKey("repeat") && (bool) dynamicRaml["repeat"];
parameter.Example = dynamicRaml.ContainsKey("example") ? dynamicRaml["example"].ToString() : null;
parameter.Default = dynamicRaml.ContainsKey("default") ? (dynamicRaml["default"] != null ? dynamicRaml["default"].ToString() : null) : null;
parameter.Pattern = dynamicRaml.ContainsKey("pattern") ? (string) dynamicRaml["pattern"] : null;
parameter.MinLength = dynamicRaml.ContainsKey("minLength") ? Convert.ToInt32(dynamicRaml["default"]) : (int?) null;
parameter.MaxLength = dynamicRaml.ContainsKey("maxLength") ? Convert.ToInt32(dynamicRaml["maxLength"]) : (int?) null;
parameter.Minimum = dynamicRaml.ContainsKey("minimum") ? Convert.ToDecimal(dynamicRaml["minimum"]) : (decimal?) null;
parameter.Maximum = dynamicRaml.ContainsKey("maximum") ? Convert.ToDecimal(dynamicRaml["maximum"]) : (decimal?) null;
return parameter;
}
private static IEnumerable<string> GetEnum(IDictionary<string, object> dynamicRaml)
{
if (!dynamicRaml.ContainsKey("enum")) return null;
var objects = ((object[]) dynamicRaml["enum"]);
return objects.Select(obj => obj.ToString()).ToArray();
}
}
} | apache-2.0 | C# |
333f9c1d1436913b6343b31d0a1aacf31539c5b0 | Update FolderInfo.cs | EricZimmerman/RegistryPlugins | RegistryPlugin.FirstFolder/FolderInfo.cs | RegistryPlugin.FirstFolder/FolderInfo.cs | using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.FirstFolder
{
public class FolderInfo:IValueOut
{
public FolderInfo(string exeName, string folderName, int mruPos, DateTimeOffset? openedOn)
{
Executable = exeName;
FolderName = folderName;
MRUPosition = mruPos;
OpenedOn = openedOn?.UtcDateTime;
}
public string Executable { get; }
public string FolderName { get; }
public int MRUPosition { get; }
public DateTime? OpenedOn { get; }
public override string ToString()
{
return $"Exe: {Executable}, Folder: {FolderName}, Mru: {MRUPosition}";
}
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Exe: {Executable} Folder: {FolderName}";
public string BatchValueData2 => $"Opened: {OpenedOn?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => $"Mru: {MRUPosition}";
}
}
| using System;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.FirstFolder
{
public class FolderInfo:IValueOut
{
public FolderInfo(string exeName, string folderName, int mruPos, DateTimeOffset? openedOn)
{
Executable = exeName;
FolderName = folderName;
MRUPosition = mruPos;
OpenedOn = openedOn?.UtcDateTime;
}
public string Executable { get; }
public string FolderName { get; }
public int MRUPosition { get; }
public DateTime? OpenedOn { get; }
public override string ToString()
{
return $"Exe: {Executable}, Folder: {FolderName}, Mru: {MRUPosition}";
}
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Exe: {Executable} Folder: {FolderName}";
public string BatchValueData2 => $"Opened: {OpenedOn?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff})";
public string BatchValueData3 => $"Mru: {MRUPosition}";
}
} | mit | C# |
48ecf95e1b3e4cb66cabcceefaf7c031b2e1f716 | add IntPtr ctor to RatingEntry | arfbtwn/banshee,ixfalia/banshee,babycaseny/banshee,stsundermann/banshee,Carbenium/banshee,ixfalia/banshee,babycaseny/banshee,babycaseny/banshee,GNOME/banshee,GNOME/banshee,arfbtwn/banshee,ixfalia/banshee,dufoli/banshee,dufoli/banshee,dufoli/banshee,arfbtwn/banshee,Dynalon/banshee-osx,babycaseny/banshee,ixfalia/banshee,Dynalon/banshee-osx,arfbtwn/banshee,stsundermann/banshee,Dynalon/banshee-osx,arfbtwn/banshee,Dynalon/banshee-osx,babycaseny/banshee,dufoli/banshee,babycaseny/banshee,Dynalon/banshee-osx,Carbenium/banshee,dufoli/banshee,Carbenium/banshee,stsundermann/banshee,Carbenium/banshee,GNOME/banshee,GNOME/banshee,Dynalon/banshee-osx,stsundermann/banshee,stsundermann/banshee,stsundermann/banshee,dufoli/banshee,ixfalia/banshee,ixfalia/banshee,GNOME/banshee,babycaseny/banshee,GNOME/banshee,babycaseny/banshee,Carbenium/banshee,ixfalia/banshee,Carbenium/banshee,arfbtwn/banshee,stsundermann/banshee,stsundermann/banshee,arfbtwn/banshee,Dynalon/banshee-osx,Dynalon/banshee-osx,arfbtwn/banshee,ixfalia/banshee,dufoli/banshee,GNOME/banshee,dufoli/banshee,GNOME/banshee | src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/RatingEntry.cs | src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/RatingEntry.cs | //
// RatingEditorField.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Banshee.Gui.TrackEditor
{
public class RatingEntry : Hyena.Widgets.RatingEntry, IEditorField
{
public RatingEntry ()
{
AlwaysShowEmptyStars = true;
}
protected RatingEntry (IntPtr raw) : base (raw)
{
}
public void SetAsReadOnly ()
{
Sensitive = false;
}
}
}
| //
// RatingEditorField.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Banshee.Gui.TrackEditor
{
public class RatingEntry : Hyena.Widgets.RatingEntry, IEditorField
{
public RatingEntry ()
{
AlwaysShowEmptyStars = true;
}
public void SetAsReadOnly ()
{
Sensitive = false;
}
}
}
| mit | C# |
717114e61e8e7748c1e11f741a17d4854c5ae43b | address some code-analysis warnings. | jwChung/Experimentalism,jwChung/Experimentalism | src/Experiment.AutoFixture.NuGetFiles/FirstClassTheoremAttribute.cs | src/Experiment.AutoFixture.NuGetFiles/FirstClassTheoremAttribute.cs | using System;
using System.Reflection;
using Jwc.Experiment;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Kernel;
namespace Jwc.Experiment
{
/// <summary>
/// A test attribute used to adorn methods that creates first-class
/// executable test cases. This attribute supports to generate auto data
/// using the AutoFixture library.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class FirstClassTheoremAttribute : BaseFirstClassTheoremAttribute
{
/// <summary>
/// Creates an instance of <see cref="ITestFixture" />.
/// </summary>
/// <param name="testMethod">The test method</param>
/// <returns>
/// The created fixture.
/// </returns>
public override ITestFixture CreateTestFixture(MethodInfo testMethod)
{
if (testMethod == null)
{
throw new ArgumentNullException("testMethod");
}
return new AutoFixtureAdapter(new SpecimenContext(new Fixture()));
}
}
} | using System;
using System.Reflection;
using Jwc.Experiment;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Kernel;
namespace Jwc.Experiment
{
/// <summary>
/// A test attribute used to adorn methods that creates first-class
/// executable test cases. This attribute supports to generate auto data
/// using the AutoFixture library.
/// </summary>
public class FirstClassTheoremAttribute : BaseFirstClassTheoremAttribute
{
/// <summary>
/// Creates an instance of <see cref="ITestFixture" />.
/// </summary>
/// <param name="testMethod">The test method</param>
/// <returns>
/// The created fixture.
/// </returns>
public override ITestFixture CreateTestFixture(MethodInfo testMethod)
{
if (testMethod == null)
{
throw new ArgumentNullException("testMethod");
}
return new AutoFixtureAdapter(new SpecimenContext(new Fixture()));
}
}
} | mit | C# |
8d5e6dcf4de42d827c198238b6d644417f722679 | fix FullName and IGenericContext.Type | saynomoo/cecil,SiliconStudio/Mono.Cecil,ttRevan/cecil,gluck/cecil,cgourlay/cecil,xen2/cecil,fnajera-rac-de/cecil,jbevain/cecil,sailro/cecil,mono/cecil,kzu/cecil,joj/cecil,furesoft/cecil | Mono.Cecil/GenericInstanceMethod.cs | Mono.Cecil/GenericInstanceMethod.cs | //
// GenericInstanceMethod.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2010 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using Mono.Collections.Generic;
namespace Mono.Cecil {
public sealed class GenericInstanceMethod : MethodSpecification, IGenericInstance, IGenericContext {
Collection<TypeReference> arguments;
public bool HasGenericArguments {
get { return !arguments.IsNullOrEmpty (); }
}
public Collection<TypeReference> GenericArguments {
get {
if (arguments == null)
arguments = new Collection<TypeReference> ();
return arguments;
}
}
public override bool IsGenericInstance {
get { return true; }
}
IGenericParameterProvider IGenericContext.Method {
get { return ElementMethod; }
}
IGenericParameterProvider IGenericContext.Type {
get { return ElementMethod.DeclaringType; }
}
public override string FullName {
get {
var signature = new StringBuilder ();
var method = this.ElementMethod;
signature.Append (method.ReturnType.FullName);
signature.Append (" ");
signature.Append (method.DeclaringType.FullName);
signature.Append ("::");
signature.Append (method.Name);
this.GenericInstanceFullName (signature);
this.MethodSignatureFullName (signature);
return signature.ToString ();
}
}
public GenericInstanceMethod (MethodReference method)
: base (method)
{
}
}
}
| //
// GenericInstanceMethod.cs
//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2010 Jb Evain
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using Mono.Collections.Generic;
namespace Mono.Cecil {
public sealed class GenericInstanceMethod : MethodSpecification, IGenericInstance, IGenericContext {
Collection<TypeReference> arguments;
public bool HasGenericArguments {
get { return !arguments.IsNullOrEmpty (); }
}
public Collection<TypeReference> GenericArguments {
get {
if (arguments == null)
arguments = new Collection<TypeReference> ();
return arguments;
}
}
public override bool IsGenericInstance {
get { return true; }
}
IGenericParameterProvider IGenericContext.Method {
get { return ElementMethod; }
}
public GenericInstanceMethod (MethodReference method)
: base (method)
{
}
public override string ToString ()
{
var signature = new StringBuilder ();
var method = this.ElementMethod;
signature.Append (method.ReturnType.FullName);
signature.Append (" ");
signature.Append (method.DeclaringType.FullName);
signature.Append ("::");
signature.Append (method.Name);
this.GenericInstanceFullName (signature);
this.MethodSignatureFullName (signature);
return signature.ToString ();
}
}
}
| mit | C# |
2ab161fc6cdf2143ac0d688b3bd1e5e4afabf591 | Allow a local version of NuGet.exe (#140) | NuKeeperDotNet/NuKeeper,skolima/NuKeeper,AnthonySteele/NuKeeper,skolima/NuKeeper,skolima/NuKeeper,AnthonySteele/NuKeeper,skolima/NuKeeper,NuKeeperDotNet/NuKeeper,AnthonySteele/NuKeeper,AnthonySteele/NuKeeper,NuKeeperDotNet/NuKeeper,NuKeeperDotNet/NuKeeper | NuKeeper/NuGet/Process/NuGetPath.cs | NuKeeper/NuGet/Process/NuGetPath.cs | using System;
using System.IO;
using System.Linq;
namespace NuKeeper.NuGet.Process
{
public static class NuGetPath
{
public static string FindExecutable()
{
var localNugetPath = FindLocalNuget();
if (!string.IsNullOrEmpty(localNugetPath))
{
return localNugetPath;
}
return FindNugetInPackagesUnderProfile();
}
private static string FindLocalNuget()
{
var appDir = AppDomain.CurrentDomain.BaseDirectory;
var fullPath = Path.Combine(appDir, "NuGet.exe");
if (File.Exists(fullPath))
{
return fullPath;
}
return string.Empty;
}
private static string FindNugetInPackagesUnderProfile()
{
var profile = Environment.GetEnvironmentVariable("userprofile");
if (string.IsNullOrWhiteSpace(profile))
{
throw new Exception("Could not find user profile path");
}
var commandlinePackageDir = Path.Combine(profile, ".nuget\\packages\\nuget.commandline");
if (!Directory.Exists(commandlinePackageDir))
{
throw new Exception("Could not find nuget commandline path: " + commandlinePackageDir);
}
var highestVersion = Directory.GetDirectories(commandlinePackageDir)
.OrderByDescending(n => n)
.FirstOrDefault();
if (string.IsNullOrWhiteSpace(highestVersion))
{
throw new Exception("Could not find a version of nuget.commandline");
}
var nugetProgramPath = Path.Combine(highestVersion, "tools\\NuGet.exe");
return Path.GetFullPath(nugetProgramPath);
}
}
}
| using System;
using System.IO;
using System.Linq;
namespace NuKeeper.NuGet.Process
{
public static class NuGetPath
{
public static string FindExecutable()
{
var profile = Environment.GetEnvironmentVariable("userprofile");
if (string.IsNullOrWhiteSpace(profile))
{
throw new Exception("Could not find user profile path");
}
var commandlinePackageDir = Path.Combine(profile, ".nuget\\packages\\nuget.commandline");
if (!Directory.Exists(commandlinePackageDir))
{
throw new Exception("Could not find nuget commandline path: " + commandlinePackageDir);
}
var highestVersion = Directory.GetDirectories(commandlinePackageDir)
.OrderByDescending(n => n)
.FirstOrDefault();
if (string.IsNullOrWhiteSpace(highestVersion))
{
throw new Exception("Could not find a version of nuget.commandline");
}
var nugetProgramPath = Path.Combine(highestVersion, "tools\\NuGet.exe");
return Path.GetFullPath(nugetProgramPath);
}
}
}
| apache-2.0 | C# |
a5736806b52d0e272300fb2411059d512ae9c730 | Remove debug log | Evorlor/Wok-n-Roll | Assets/Scripts/Core.cs | Assets/Scripts/Core.cs | using UnityEngine;
using System.Collections;
using System;
public class Core : MonoBehaviour {
private static Core instance;
public static Core GetInstance()
{
return instance;
}
private bool EnableShackingStyle = false;
private int ShackingTimes = 2;
private int currentShackingTime = 0;
private bool debounced = false;
private bool started = true;
public float TimeToSkip = -1.0f;
private float timeDuration = 0.0f;
private int ScoreValue = 1;
public int Score = 0;
// Use this for initialization
void Start () {
instance = this;
}
// Update is called once per frame
void Update () {
if (started)
{
Action action = InstructionManager.Instance.GetCurrentInstruction().action;
if (TimeToSkip >= 0.0f)
{
timeDuration += Time.deltaTime;
if (timeDuration >= TimeToSkip)
{
started = nextStep();
return;
}
}
if (Control.GetInstance().GetInput(action))
{
if (action == Action.Jump)
{
for (int i = (int)Action.BEGIN + 1; i < (int)Action.SIZE; i++)
{
if (i == (int)Action.Jump)
continue;
if (Control.GetInstance().GetInput((Action)i))
return;
}
Score += ScoreValue;
started = nextStep();
}
else
{
if (debounced || !EnableShackingStyle) {
debounced = false;
currentShackingTime++;
if ((currentShackingTime >= ShackingTimes) || !EnableShackingStyle)
{
currentShackingTime = 0;
Score += ScoreValue;
started = nextStep();
}
}
}
} else
{
debounced = true;
}
}
}
public bool IsStarted()
{
return started;
}
private bool nextStep()
{
bool valid = true;
try
{
InstructionManager.Instance.NextInstruction();
}
catch (InvalidOperationException)
{
valid = false;
}
return valid;
}
public void StartCooking()
{
started = true;
}
}
| using UnityEngine;
using System.Collections;
using System;
public class Core : MonoBehaviour {
private static Core instance;
public static Core GetInstance()
{
return instance;
}
private bool EnableShackingStyle = false;
private int ShackingTimes = 2;
private int currentShackingTime = 0;
private bool debounced = false;
private bool started = true;
public float TimeToSkip = -1.0f;
private float timeDuration = 0.0f;
private int ScoreValue = 1;
public int Score = 0;
// Use this for initialization
void Start () {
instance = this;
}
// Update is called once per frame
void Update () {
if (started)
{
Action action = InstructionManager.Instance.GetCurrentInstruction().action;
if (TimeToSkip >= 0.0f)
{
timeDuration += Time.deltaTime;
if (timeDuration >= TimeToSkip)
{
started = nextStep();
return;
}
}
if (Control.GetInstance().GetInput(action))
{
if (action == Action.Jump)
{
for (int i = (int)Action.BEGIN + 1; i < (int)Action.SIZE; i++)
{
if (i == (int)Action.Jump)
continue;
if (Control.GetInstance().GetInput((Action)i))
return;
}
Score += ScoreValue;
started = nextStep();
}
else
{
if (debounced || !EnableShackingStyle) {
debounced = false;
currentShackingTime++;
if ((currentShackingTime >= ShackingTimes) || !EnableShackingStyle)
{
currentShackingTime = 0;
Score += ScoreValue;
started = nextStep();
Debug.Log(Score);
}
}
}
} else
{
debounced = true;
}
}
}
public bool IsStarted()
{
return started;
}
private bool nextStep()
{
bool valid = true;
try
{
InstructionManager.Instance.NextInstruction();
}
catch (InvalidOperationException)
{
valid = false;
}
return valid;
}
public void StartCooking()
{
started = true;
}
}
| mit | C# |
0f725f64ec9e4058ca3e075200b49e6d1806bce0 | reformat CreateReturnsCorrectSpecimen. | jwChung/Experimentalism,jwChung/Experimentalism | test/Experiment.AutoFixtureUnitTest/AutoFixtureAdapterTest.cs | test/Experiment.AutoFixtureUnitTest/AutoFixtureAdapterTest.cs | using System;
using Xunit;
namespace Jwc.Experiment
{
public class AutoFixtureAdapterTest
{
[Fact]
public void SutIsTestFixture()
{
var sut = new AutoFixtureAdapter(new FakeSpecimenContext());
Assert.IsAssignableFrom<ITestFixture>(sut);
}
[Fact]
public void SpecimenContextIsCorrect()
{
var expected = new FakeSpecimenContext();
var sut = new AutoFixtureAdapter(expected);
var actual = sut.SpecimenContext;
Assert.Equal(expected, actual);
}
[Fact]
public void InitializeWithNullContextThrows()
{
Assert.Throws<ArgumentNullException>(() => new AutoFixtureAdapter(null));
}
[Fact]
public void CreateReturnsCorrectSpecimen()
{
var request = new object();
var expected = new object();
var context = new FakeSpecimenContext
{
OnResolve = r =>
{
Assert.Equal(request, r);
return expected;
}
};
var sut = new AutoFixtureAdapter(context);
var actual = sut.Create(request);
Assert.Equal(expected, actual);
}
}
} | using System;
using Xunit;
namespace Jwc.Experiment
{
public class AutoFixtureAdapterTest
{
[Fact]
public void SutIsTestFixture()
{
var sut = new AutoFixtureAdapter(new FakeSpecimenContext());
Assert.IsAssignableFrom<ITestFixture>(sut);
}
[Fact]
public void SpecimenContextIsCorrect()
{
var expected = new FakeSpecimenContext();
var sut = new AutoFixtureAdapter(expected);
var actual = sut.SpecimenContext;
Assert.Equal(expected, actual);
}
[Fact]
public void InitializeWithNullContextThrows()
{
Assert.Throws<ArgumentNullException>(() => new AutoFixtureAdapter(null));
}
[Fact]
public void CreateReturnsCorrectSpecimen()
{
var context = new FakeSpecimenContext();
var request = new object();
var expected = new object();
context.OnResolve = r =>
{
Assert.Equal(request, r);
return expected;
};
var sut = new AutoFixtureAdapter(context);
var actual = sut.Create(request);
Assert.Equal(expected, actual);
}
}
} | mit | C# |
80ea9f85f2a4ff61e5513252d018881e2504c7c5 | Test push for appveyor nuget restore | PeterRyder/Check-Up-2 | CheckUp2/MainWindow.cs | CheckUp2/MainWindow.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CheckUp2 {
public partial class MainWindow : Form {
public MainWindow() {
InitializeComponent();
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CheckUp2 {
public partial class MainWindow : Form {
public MainWindow() {
InitializeComponent();
}
}
}
| mit | C# |
f819e3ba4708308b06f15f60ff81c87df15c3bcc | use test environment in ListAllKeyboards test | mccarthyrb/libpalaso,tombogle/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,marksvc/libpalaso,sillsdev/libpalaso,andrew-polk/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,andrew-polk/libpalaso,darcywong00/libpalaso,JohnThomson/libpalaso,glasseyes/libpalaso,mccarthyrb/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,gtryus/libpalaso,hatton/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,chrisvire/libpalaso,marksvc/libpalaso,darcywong00/libpalaso,marksvc/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,darcywong00/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,sillsdev/libpalaso,chrisvire/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,glasseyes/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,hatton/libpalaso | PalasoUIWindowsForms.Tests/Keyboarding/IBusAdaptorTestsWithIBus.cs | PalasoUIWindowsForms.Tests/Keyboarding/IBusAdaptorTestsWithIBus.cs | #if MONO
using System;
using NUnit.Framework;
using Palaso.Reporting;
using Palaso.UI.WindowsForms.Keyboarding;
using System.Collections.Generic;
namespace PalasoUIWindowsForms.Tests.Keyboarding
{
[TestFixture]
[Category("SkipOnTeamCity")]
public class IBusAdaptorTestsWithIBus
{
[Test]
[Category("IBus")]
public void EngineAvailable_ReturnsTrue()
{
using (var e = new IBusEnvironmentForTest(true))
{
Assert.IsTrue(IBusAdaptor.EngineAvailable);
}
}
[Test]
[Category("IBus")]
public void KeyboardDescriptors_ListAllKeyboards()
{
using (var e = new IBusEnvironmentForTest(true))
{
Console.WriteLine("ListAllKeyboards");
foreach (var keyboard in IBusAdaptor.KeyboardDescriptors)
{
Console.WriteLine("Name {0}, Id {1}", keyboard.ShortName, keyboard.Id);
}
}
}
[Test]
[Category("IBus")]
public void Deactivate_SwitchesBackToDefaultKeyboard()
{
using (var e = new IBusEnvironmentForTest(true))
{
IBusAdaptor.ActivateKeyboard(IBusEnvironmentForTest.OtherKeyboard);
IBusAdaptor.Deactivate();
string actual = IBusAdaptor.GetActiveKeyboard();
Assert.AreEqual(IBusEnvironmentForTest.DefaultKeyboard, actual);
}
}
[Test]
[Category("IBus")]
public void ActivateKeyBoard_IBusHasKeyboard_GetCurrentKeyboardReturnsActivatedKeyboard()
{
using (var e = new IBusEnvironmentForTest(true))
{
//IBusAdaptor.Deactivate();
IBusAdaptor.ActivateKeyboard("m17n:am:sera");
Assert.AreEqual("m17n:am:sera", KeyboardController.GetActiveKeyboard());
IBusAdaptor.Deactivate();
}
}
[Test]
[Category("IBus")]
public void ActivateKeyBoard_IBusDoesNotHaveKeyboard_Throws()
{
using (var e = new IBusEnvironmentForTest(true))
{
Assert.Throws<ArgumentOutOfRangeException>(
() => IBusAdaptor.ActivateKeyboard("Nonexistent Keyboard")
);
}
}
[Test]
[Category("IBus")]
public void DefaultKeyboardName_AfterOpenConnection_ReturnsEnglish()
{
IBusAdaptor.EnsureConnection();
string actual = IBusAdaptor.DefaultKeyboardName;
Assert.AreEqual("m17n:en:ispell", actual); // An assumption. Should actually be the zeroth element in the list of available keyboards.
}
}
}
#endif | #if MONO
using System;
using NUnit.Framework;
using Palaso.Reporting;
using Palaso.UI.WindowsForms.Keyboarding;
using System.Collections.Generic;
namespace PalasoUIWindowsForms.Tests.Keyboarding
{
[TestFixture]
[Category("SkipOnTeamCity")]
public class IBusAdaptorTestsWithIBus
{
[Test]
[Category("IBus")]
public void EngineAvailable_ReturnsTrue()
{
using (var e = new IBusEnvironmentForTest(true))
{
Assert.IsTrue(IBusAdaptor.EngineAvailable);
}
}
[Test]
[Category("IBus")]
public void KeyboardDescriptors_ListAllKeyboards()
{
Console.WriteLine("ListAllKeyboards");
foreach (var keyboard in IBusAdaptor.KeyboardDescriptors)
{
Console.WriteLine("Name {0}, Id {1}", keyboard.ShortName, keyboard.Id);
}
}
[Test]
[Category("IBus")]
public void Deactivate_SwitchesBackToDefaultKeyboard()
{
using (var e = new IBusEnvironmentForTest(true))
{
IBusAdaptor.ActivateKeyboard(IBusEnvironmentForTest.OtherKeyboard);
IBusAdaptor.Deactivate();
string actual = IBusAdaptor.GetActiveKeyboard();
Assert.AreEqual(IBusEnvironmentForTest.DefaultKeyboard, actual);
}
}
[Test]
[Category("IBus")]
public void ActivateKeyBoard_IBusHasKeyboard_GetCurrentKeyboardReturnsActivatedKeyboard()
{
using (var e = new IBusEnvironmentForTest(true))
{
//IBusAdaptor.Deactivate();
IBusAdaptor.ActivateKeyboard("m17n:am:sera");
Assert.AreEqual("m17n:am:sera", KeyboardController.GetActiveKeyboard());
IBusAdaptor.Deactivate();
}
}
[Test]
[Category("IBus")]
public void ActivateKeyBoard_IBusDoesNotHaveKeyboard_Throws()
{
using (var e = new IBusEnvironmentForTest(true))
{
Assert.Throws<ArgumentOutOfRangeException>(
() => IBusAdaptor.ActivateKeyboard("Nonexistent Keyboard")
);
}
}
[Test]
[Category("IBus")]
public void DefaultKeyboardName_AfterOpenConnection_ReturnsEnglish()
{
IBusAdaptor.EnsureConnection();
string actual = IBusAdaptor.DefaultKeyboardName;
Assert.AreEqual("m17n:en:ispell", actual); // An assumption. Should actually be the zeroth element in the list of available keyboards.
}
}
}
#endif | mit | C# |
5276a071bf57f04389c4db4857fb47bdf6afd839 | Update FileGetOptions.cs | A51UK/File-Repository | File-Repository/FileGetOptions.cs | File-Repository/FileGetOptions.cs | /*
* Copyright 2017 Craig Lee Mark 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 File_Repository.Enum;
using System;
using System.Collections.Generic;
using System.Text;
namespace File_Repository
{
public class FileGetOptions
{
public string Folder { get; set; } = string.Empty;
public string Key { get; set; } = string.Empty;
public FileTransferOptions FileTransfer { get; set; } = FileTransferOptions.Stream;
public string Address { get; set; } = string.Empty;
public CloudSecureOptions CloudSecure { get; set; } = CloudSecureOptions.defualt;
public string SecureFileLocation { get; set; } = string.Empty;
public string ConfigurationString { get; set; } = string.Empty;
public TimeSpan SecureLinkTimeToLive { get; set; } = new TimeSpan(1, 0, 0);
}
}
| /*
* Copyright 2017 Criag Lee Mark 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 File_Repository.Enum;
using System;
using System.Collections.Generic;
using System.Text;
namespace File_Repository
{
public class FileGetOptions
{
public string Folder { get; set; } = string.Empty;
public string Key { get; set; } = string.Empty;
public FileTransferOptions FileTransfer { get; set; } = FileTransferOptions.Stream;
public string Address { get; set; } = string.Empty;
public CloudSecureOptions CloudSecure { get; set; } = CloudSecureOptions.defualt;
public string SecureFileLocation { get; set; } = string.Empty;
public string ConfigurationString { get; set; } = string.Empty;
public TimeSpan SecureLinkTimeToLive { get; set; } = new TimeSpan(1, 0, 0);
}
}
| apache-2.0 | C# |
f147d29788ba10fb7978e0ed54d37b4d2c5b7f4a | Switch TabItem also on nested Controls in Header | icsharpcode/WpfDesigner | WpfDesign.Designer/Project/Extensions/TabItemClickableExtension.cs | WpfDesign.Designer/Project/Extensions/TabItemClickableExtension.cs | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.WpfDesign.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
/// <summary>
/// Makes TabItems clickable.
/// </summary>
[ExtensionFor(typeof(FrameworkElement))]
[ExtensionServer(typeof(PrimarySelectionExtensionServer))]
public sealed class TabItemClickableExtension : DefaultExtension
{
/// <summary/>
protected override void OnInitialized()
{
// When tab item becomes primary selection, make it the active tab page in its parent tab control.
var t = this.ExtendedItem;
while (t != null) {
if (t.Component is TabItem) {
var tabItem = (TabItem) t.Component;
var tabControl = tabItem.Parent as TabControl;
if (tabControl != null) {
tabControl.SelectedItem = tabItem;
}
}
t = t.Parent;
}
}
}
}
| // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.Windows.Controls;
using ICSharpCode.WpfDesign.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
/// <summary>
/// Makes TabItems clickable.
/// </summary>
[ExtensionFor(typeof(TabItem))]
[ExtensionServer(typeof(PrimarySelectionExtensionServer))]
public sealed class TabItemClickableExtension : DefaultExtension
{
/// <summary/>
protected override void OnInitialized()
{
// When tab item becomes primary selection, make it the active tab page in its parent tab control.
TabItem tabItem = (TabItem)this.ExtendedItem.Component;
TabControl tabControl = tabItem.Parent as TabControl;
if (tabControl != null) {
tabControl.SelectedItem = tabItem;
}
}
}
}
| mit | C# |
4efdcacaff96b1bf3d014f5692cf549ef2453643 | Fix build | GNOME/banshee,allquixotic/banshee-gst-sharp-work,Carbenium/banshee,stsundermann/banshee,Carbenium/banshee,GNOME/banshee,babycaseny/banshee,directhex/banshee-hacks,lamalex/Banshee,directhex/banshee-hacks,Dynalon/banshee-osx,Carbenium/banshee,dufoli/banshee,mono-soc-2011/banshee,directhex/banshee-hacks,stsundermann/banshee,dufoli/banshee,eeejay/banshee,babycaseny/banshee,stsundermann/banshee,ixfalia/banshee,GNOME/banshee,mono-soc-2011/banshee,stsundermann/banshee,arfbtwn/banshee,eeejay/banshee,stsundermann/banshee,stsundermann/banshee,eeejay/banshee,directhex/banshee-hacks,ixfalia/banshee,ixfalia/banshee,Dynalon/banshee-osx,dufoli/banshee,arfbtwn/banshee,arfbtwn/banshee,mono-soc-2011/banshee,Dynalon/banshee-osx,eeejay/banshee,ixfalia/banshee,GNOME/banshee,arfbtwn/banshee,petejohanson/banshee,babycaseny/banshee,petejohanson/banshee,stsundermann/banshee,directhex/banshee-hacks,allquixotic/banshee-gst-sharp-work,allquixotic/banshee-gst-sharp-work,arfbtwn/banshee,petejohanson/banshee,lamalex/Banshee,GNOME/banshee,dufoli/banshee,mono-soc-2011/banshee,allquixotic/banshee-gst-sharp-work,allquixotic/banshee-gst-sharp-work,GNOME/banshee,dufoli/banshee,dufoli/banshee,babycaseny/banshee,arfbtwn/banshee,petejohanson/banshee,eeejay/banshee,arfbtwn/banshee,Carbenium/banshee,Dynalon/banshee-osx,Dynalon/banshee-osx,Dynalon/banshee-osx,petejohanson/banshee,lamalex/Banshee,ixfalia/banshee,babycaseny/banshee,mono-soc-2011/banshee,babycaseny/banshee,mono-soc-2011/banshee,stsundermann/banshee,GNOME/banshee,mono-soc-2011/banshee,Dynalon/banshee-osx,Carbenium/banshee,babycaseny/banshee,GNOME/banshee,dufoli/banshee,arfbtwn/banshee,directhex/banshee-hacks,lamalex/Banshee,lamalex/Banshee,Dynalon/banshee-osx,Carbenium/banshee,ixfalia/banshee,ixfalia/banshee,petejohanson/banshee,allquixotic/banshee-gst-sharp-work,dufoli/banshee,lamalex/Banshee,babycaseny/banshee,ixfalia/banshee | src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteSpeakersWidget.cs | src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteSpeakersWidget.cs | //
// RemoteSpeakersWidget.cs
//
// Author:
// Brad Taylor <brad@getcoded.net>
//
// Copyright (C) 2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using Mono.Unix;
using Gtk;
using Hyena.Widgets;
using Banshee.Gui;
using Banshee.Base;
using Banshee.ServiceStack;
using Banshee.Sources;
namespace Banshee.RemoteAudio
{
public class RemoteSpeakersWidget : HBox
{
public RemoteSpeakersWidget () : base ()
{
Spacing = 3;
Label label = new Label (Catalog.GetString ("_Speaker:"));
PackStart (label, false, false, 0);
RemoteSpeakersComboBox combo = new RemoteSpeakersComboBox ();
label.MnemonicWidget = combo;
PackStart (combo, false, false, 0);
ShowAll ();
}
}
}
| //
// RemoteSpeakersWidget.cs
//
// Author:
// Brad Taylor <brad@getcoded.net>
//
// Copyright (C) 2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using Gtk;
using Hyena.Widgets;
using Banshee.Gui;
using Banshee.Base;
using Banshee.ServiceStack;
using Banshee.Sources;
namespace Banshee.RemoteAudio
{
public class RemoteSpeakersWidget : HBox
{
public RemoteSpeakersWidget () : base ()
{
Spacing = 3;
Label label = new Label (Catalog.GetString ("_Speaker:"));
PackStart (label, false, false, 0);
RemoteSpeakersComboBox combo = new RemoteSpeakersComboBox ();
label.MnemonicWidget = combo;
PackStart (combo, false, false, 0);
ShowAll ();
}
}
}
| mit | C# |
695b40e38099c12697ac8e7a9a311e18d354f6fb | Fix NumberFormatInfo.GetInstance test | twsouthwick/corefx,tijoytom/corefx,BrennanConroy/corefx,ericstj/corefx,ravimeda/corefx,wtgodbe/corefx,cydhaselton/corefx,Ermiar/corefx,fgreinacher/corefx,richlander/corefx,billwert/corefx,shimingsg/corefx,weltkante/corefx,alexperovich/corefx,rjxby/corefx,dotnet-bot/corefx,yizhang82/corefx,zhenlan/corefx,cydhaselton/corefx,fgreinacher/corefx,yizhang82/corefx,rahku/corefx,lggomez/corefx,shimingsg/corefx,wtgodbe/corefx,krk/corefx,rahku/corefx,mazong1123/corefx,twsouthwick/corefx,parjong/corefx,gkhanna79/corefx,gkhanna79/corefx,stephenmichaelf/corefx,rahku/corefx,dhoehna/corefx,ptoonen/corefx,parjong/corefx,stephenmichaelf/corefx,marksmeltzer/corefx,dhoehna/corefx,Jiayili1/corefx,wtgodbe/corefx,jlin177/corefx,the-dwyer/corefx,MaggieTsang/corefx,krytarowski/corefx,marksmeltzer/corefx,JosephTremoulet/corefx,YoupHulsebos/corefx,krk/corefx,jlin177/corefx,rahku/corefx,krytarowski/corefx,marksmeltzer/corefx,nbarbettini/corefx,nchikanov/corefx,Petermarcu/corefx,twsouthwick/corefx,DnlHarvey/corefx,Jiayili1/corefx,krytarowski/corefx,rubo/corefx,weltkante/corefx,richlander/corefx,Petermarcu/corefx,weltkante/corefx,ravimeda/corefx,yizhang82/corefx,elijah6/corefx,nbarbettini/corefx,dhoehna/corefx,richlander/corefx,rjxby/corefx,weltkante/corefx,Ermiar/corefx,Petermarcu/corefx,ptoonen/corefx,stone-li/corefx,dhoehna/corefx,axelheer/corefx,parjong/corefx,rjxby/corefx,billwert/corefx,mazong1123/corefx,rjxby/corefx,gkhanna79/corefx,ericstj/corefx,Ermiar/corefx,nbarbettini/corefx,parjong/corefx,Jiayili1/corefx,Jiayili1/corefx,zhenlan/corefx,MaggieTsang/corefx,mmitche/corefx,axelheer/corefx,Petermarcu/corefx,rahku/corefx,gkhanna79/corefx,ravimeda/corefx,elijah6/corefx,cydhaselton/corefx,JosephTremoulet/corefx,twsouthwick/corefx,mmitche/corefx,gkhanna79/corefx,weltkante/corefx,stephenmichaelf/corefx,fgreinacher/corefx,the-dwyer/corefx,YoupHulsebos/corefx,billwert/corefx,marksmeltzer/corefx,mazong1123/corefx,ptoonen/corefx,DnlHarvey/corefx,ravimeda/corefx,nchikanov/corefx,nchikanov/corefx,jlin177/corefx,krytarowski/corefx,YoupHulsebos/corefx,mmitche/corefx,alexperovich/corefx,weltkante/corefx,nbarbettini/corefx,krytarowski/corefx,ericstj/corefx,wtgodbe/corefx,elijah6/corefx,billwert/corefx,nchikanov/corefx,Jiayili1/corefx,ravimeda/corefx,YoupHulsebos/corefx,rubo/corefx,parjong/corefx,axelheer/corefx,MaggieTsang/corefx,elijah6/corefx,tijoytom/corefx,axelheer/corefx,richlander/corefx,seanshpark/corefx,parjong/corefx,tijoytom/corefx,parjong/corefx,seanshpark/corefx,dotnet-bot/corefx,ericstj/corefx,stephenmichaelf/corefx,elijah6/corefx,DnlHarvey/corefx,stone-li/corefx,Petermarcu/corefx,marksmeltzer/corefx,stephenmichaelf/corefx,seanshpark/corefx,alexperovich/corefx,ptoonen/corefx,ptoonen/corefx,twsouthwick/corefx,BrennanConroy/corefx,shimingsg/corefx,ViktorHofer/corefx,lggomez/corefx,shimingsg/corefx,seanshpark/corefx,seanshpark/corefx,lggomez/corefx,ViktorHofer/corefx,yizhang82/corefx,cydhaselton/corefx,DnlHarvey/corefx,wtgodbe/corefx,MaggieTsang/corefx,nchikanov/corefx,nbarbettini/corefx,mazong1123/corefx,ViktorHofer/corefx,ViktorHofer/corefx,Ermiar/corefx,BrennanConroy/corefx,alexperovich/corefx,wtgodbe/corefx,Jiayili1/corefx,richlander/corefx,stone-li/corefx,dhoehna/corefx,yizhang82/corefx,axelheer/corefx,DnlHarvey/corefx,rahku/corefx,zhenlan/corefx,dhoehna/corefx,nbarbettini/corefx,nbarbettini/corefx,ericstj/corefx,mazong1123/corefx,billwert/corefx,YoupHulsebos/corefx,zhenlan/corefx,krytarowski/corefx,rjxby/corefx,Ermiar/corefx,mazong1123/corefx,gkhanna79/corefx,nchikanov/corefx,stone-li/corefx,rubo/corefx,richlander/corefx,dotnet-bot/corefx,rubo/corefx,JosephTremoulet/corefx,yizhang82/corefx,JosephTremoulet/corefx,rjxby/corefx,zhenlan/corefx,wtgodbe/corefx,ericstj/corefx,stone-li/corefx,lggomez/corefx,stephenmichaelf/corefx,weltkante/corefx,DnlHarvey/corefx,Ermiar/corefx,krk/corefx,tijoytom/corefx,krytarowski/corefx,mmitche/corefx,JosephTremoulet/corefx,elijah6/corefx,the-dwyer/corefx,dotnet-bot/corefx,marksmeltzer/corefx,dhoehna/corefx,rjxby/corefx,ViktorHofer/corefx,billwert/corefx,mmitche/corefx,alexperovich/corefx,dotnet-bot/corefx,ViktorHofer/corefx,elijah6/corefx,Ermiar/corefx,alexperovich/corefx,rahku/corefx,ravimeda/corefx,JosephTremoulet/corefx,dotnet-bot/corefx,gkhanna79/corefx,shimingsg/corefx,twsouthwick/corefx,krk/corefx,jlin177/corefx,ericstj/corefx,richlander/corefx,Petermarcu/corefx,jlin177/corefx,MaggieTsang/corefx,billwert/corefx,MaggieTsang/corefx,alexperovich/corefx,jlin177/corefx,MaggieTsang/corefx,ravimeda/corefx,mazong1123/corefx,tijoytom/corefx,stephenmichaelf/corefx,YoupHulsebos/corefx,marksmeltzer/corefx,stone-li/corefx,twsouthwick/corefx,mmitche/corefx,Jiayili1/corefx,ptoonen/corefx,seanshpark/corefx,tijoytom/corefx,shimingsg/corefx,ptoonen/corefx,JosephTremoulet/corefx,cydhaselton/corefx,YoupHulsebos/corefx,the-dwyer/corefx,lggomez/corefx,nchikanov/corefx,fgreinacher/corefx,yizhang82/corefx,mmitche/corefx,cydhaselton/corefx,the-dwyer/corefx,the-dwyer/corefx,tijoytom/corefx,krk/corefx,seanshpark/corefx,cydhaselton/corefx,shimingsg/corefx,axelheer/corefx,ViktorHofer/corefx,krk/corefx,Petermarcu/corefx,dotnet-bot/corefx,krk/corefx,lggomez/corefx,rubo/corefx,the-dwyer/corefx,zhenlan/corefx,zhenlan/corefx,jlin177/corefx,stone-li/corefx,lggomez/corefx,DnlHarvey/corefx | src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoGetInstance.cs | src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoGetInstance.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class NumberFormatInfoGetInstance
{
public static IEnumerable<object[]> GetInstance_TestData()
{
CultureInfo frFRCulture = new CultureInfo("fr-FR");
yield return new object[] { frFRCulture, frFRCulture.NumberFormat };
yield return new object[] { frFRCulture.NumberFormat, frFRCulture.NumberFormat };
yield return new object[] { new CustomFormatProvider(), CustomFormatProvider.CustomFormat };
yield return new object[] { new InvalidFormatProvider(), NumberFormatInfo.CurrentInfo };
yield return new object[] { null, NumberFormatInfo.CurrentInfo };
}
[Theory]
[MemberData(nameof(GetInstance_TestData))]
public void GetInstance(IFormatProvider formatProvider, NumberFormatInfo expected)
{
NumberFormatInfo nfi = NumberFormatInfo.GetInstance(formatProvider);
Assert.Equal(expected.CurrencyDecimalDigits, nfi.CurrencyDecimalDigits);
Assert.Equal(expected.CurrencyDecimalSeparator, nfi.CurrencyDecimalSeparator);
Assert.Equal(expected.CurrencyGroupSeparator, nfi.CurrencyGroupSeparator);
Assert.Equal(expected.CurrencyGroupSizes, nfi.CurrencyGroupSizes);
Assert.Equal(expected.CurrencyNegativePattern, nfi.CurrencyNegativePattern);
Assert.Equal(expected.CurrencyPositivePattern, nfi.CurrencyPositivePattern);
Assert.Equal(expected.CurrencySymbol, nfi.CurrencySymbol);
Assert.Equal(expected.NaNSymbol, nfi.NaNSymbol);
Assert.Equal(expected.NegativeInfinitySymbol, nfi.NegativeInfinitySymbol);
Assert.Equal(expected.NegativeSign, nfi.NegativeSign);
Assert.Equal(expected.NumberDecimalDigits, nfi.NumberDecimalDigits);
Assert.Equal(expected.NumberDecimalSeparator, nfi.NumberDecimalSeparator);
Assert.Equal(expected.NumberGroupSeparator, nfi.NumberGroupSeparator);
Assert.Equal(expected.NumberGroupSizes, nfi.NumberGroupSizes);
Assert.Equal(expected.NumberNegativePattern, nfi.NumberNegativePattern);
Assert.Equal(expected.PercentDecimalDigits, nfi.PercentDecimalDigits);
Assert.Equal(expected.PercentDecimalSeparator, nfi.PercentDecimalSeparator);
Assert.Equal(expected.PercentGroupSeparator, nfi.PercentGroupSeparator);
Assert.Equal(expected.PercentGroupSizes, nfi.PercentGroupSizes);
Assert.Equal(expected.PercentNegativePattern, nfi.PercentNegativePattern);
Assert.Equal(expected.PercentPositivePattern, nfi.PercentPositivePattern);
Assert.Equal(expected.PercentSymbol, nfi.PercentSymbol);
Assert.Equal(expected.PositiveInfinitySymbol, nfi.PositiveInfinitySymbol);
Assert.Equal(expected.PerMilleSymbol, nfi.PerMilleSymbol);
Assert.Equal(expected.PositiveSign, nfi.PositiveSign);
}
private class CustomFormatProvider : IFormatProvider
{
public static NumberFormatInfo CustomFormat { get; } = new CultureInfo("fr-FR").NumberFormat;
public object GetFormat(Type formatType) => CustomFormat;
}
private class InvalidFormatProvider : IFormatProvider
{
public object GetFormat(Type formatType) => "hello";
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class NumberFormatInfoGetInstance
{
public static IEnumerable<object[]> GetInstance_TestData()
{
CultureInfo frFRCulture = new CultureInfo("fr-FR");
yield return new object[] { frFRCulture, frFRCulture.NumberFormat };
yield return new object[] { frFRCulture.NumberFormat, frFRCulture.NumberFormat };
yield return new object[] { new CustomFormatProvider(), CustomFormatProvider.CustomFormat };
yield return new object[] { new InvalidFormatProvider(), NumberFormatInfo.CurrentInfo };
yield return new object[] { null, NumberFormatInfo.CurrentInfo };
}
[Theory]
[MemberData(nameof(GetInstance_TestData))]
public void GetInstance(IFormatProvider formatProvider, NumberFormatInfo expected)
{
Assert.Equal(expected, NumberFormatInfo.GetInstance(formatProvider));
}
private class CustomFormatProvider : IFormatProvider
{
public static NumberFormatInfo CustomFormat { get; } = new CultureInfo("fr-FR").NumberFormat;
public object GetFormat(Type formatType) => CustomFormat;
}
private class InvalidFormatProvider : IFormatProvider
{
public object GetFormat(Type formatType) => "hello";
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.