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 |
---|---|---|---|---|---|---|---|---|
6232ce720d23012f4113ff02737069d062a5b207 | Fix for #20. | gregoriusxu/aspnetboilerplate,FJQBT/ABP,expertmaksud/aspnetboilerplate,ShiningRush/aspnetboilerplate,liujunhua/aspnetboilerplate,carldai0106/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,Tobyee/aspnetboilerplate,beratcarsi/aspnetboilerplate,andmattia/aspnetboilerplate,ryancyq/aspnetboilerplate,ddNils/aspnetboilerplate,Tinkerc/aspnetboilerplate,AlexGeller/aspnetboilerplate,lemestrez/aspnetboilerplate,andmattia/aspnetboilerplate,690486439/aspnetboilerplate,yuzukwok/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,SXTSOFT/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,sagacite2/aspnetboilerplate,chendong152/aspnetboilerplate,verdentk/aspnetboilerplate,takintsft/aspnetboilerplate,s-takatsu/aspnetboilerplate,dVakulen/aspnetboilerplate,burakaydemir/aspnetboilerplate,backendeveloper/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Tobyee/aspnetboilerplate,AlexGeller/aspnetboilerplate,spraiin/aspnetboilerplate,4nonym0us/aspnetboilerplate,chenkaibin/aspnetboilerplate,ilyhacker/aspnetboilerplate,AntTech/aspnetboilerplate,nicklv/aspnetboilerplate,beratcarsi/aspnetboilerplate,chenkaibin/aspnetboilerplate,zquans/aspnetboilerplate,MetSystem/aspnetboilerplate,sagacite2/aspnetboilerplate,asauriol/aspnetboilerplate,expertmaksud/aspnetboilerplate,luenick/aspnetboilerplate,lidonghao1116/aspnetboilerplate,lemestrez/aspnetboilerplate,rucila/aspnetboilerplate,s-takatsu/aspnetboilerplate,Saviio/aspnetboilerplate,MaikelE/aspnetboilerplate-fork,luenick/aspnetboilerplate,jaq316/aspnetboilerplate,ZhaoRd/aspnetboilerplate,SecComm/aspnetboilerplate,saeedallahyari/aspnetboilerplate,jaq316/aspnetboilerplate,beratcarsi/aspnetboilerplate,backendeveloper/aspnetboilerplate,berdankoca/aspnetboilerplate,saeedallahyari/aspnetboilerplate,ShiningRush/aspnetboilerplate,carldai0106/aspnetboilerplate,fengyeju/aspnetboilerplate,luchaoshuai/aspnetboilerplate,690486439/aspnetboilerplate,jefferyzhang/aspnetboilerplate,SXTSOFT/aspnetboilerplate,MDSNet2016/aspnetboilerplate,4nonym0us/aspnetboilerplate,FJQBT/ABP,ZhaoRd/aspnetboilerplate,fengyeju/aspnetboilerplate,berdankoca/aspnetboilerplate,Sivalingaamorthy/aspnetboilerplate,virtualcca/aspnetboilerplate,ilyhacker/aspnetboilerplate,berdankoca/aspnetboilerplate,burakaydemir/aspnetboilerplate,4nonym0us/aspnetboilerplate,690486439/aspnetboilerplate,ZhaoRd/aspnetboilerplate,MaikelE/aspnetboilerplate-fork,oceanho/aspnetboilerplate,Tobyee/aspnetboilerplate,Tinkerc/aspnetboilerplate,MaikelE/aspnetboilerplate-fork,oceanho/aspnetboilerplate,lvjunlei/aspnetboilerplate,carldai0106/aspnetboilerplate,MDSNet2016/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,SecComm/aspnetboilerplate,carldai0106/aspnetboilerplate,SXTSOFT/aspnetboilerplate,lvjunlei/aspnetboilerplate,AlexGeller/aspnetboilerplate,azhe127/aspnetboilerplate,asauriol/aspnetboilerplate,gentledepp/aspnetboilerplate,anhuisunfei/aspnetboilerplate,AndHuang/aspnetboilerplate,ddNils/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,yuzukwok/aspnetboilerplate,hanu412/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,Saviio/aspnetboilerplate,daywrite/aspnetboilerplate,yhhno/aspnetboilerplate,zclmoon/aspnetboilerplate,yhhno/aspnetboilerplate,oceanho/aspnetboilerplate,azhe127/aspnetboilerplate,cato541265/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,virtualcca/aspnetboilerplate,s-takatsu/aspnetboilerplate,zquans/aspnetboilerplate,gregoriusxu/aspnetboilerplate,lemestrez/aspnetboilerplate,lidonghao1116/aspnetboilerplate,Sivalingaamorthy/aspnetboilerplate,AntTech/aspnetboilerplate,Nongzhsh/aspnetboilerplate,LenFon/aspnetboilerplate,dVakulen/aspnetboilerplate,gentledepp/aspnetboilerplate,lvjunlei/aspnetboilerplate,chendong152/aspnetboilerplate,andmattia/aspnetboilerplate,Nongzhsh/aspnetboilerplate,hanu412/aspnetboilerplate,verdentk/aspnetboilerplate,nicklv/aspnetboilerplate,spraiin/aspnetboilerplate,daywrite/aspnetboilerplate,ilyhacker/aspnetboilerplate,Nongzhsh/aspnetboilerplate,AndHuang/aspnetboilerplate,cato541265/aspnetboilerplate,takintsft/aspnetboilerplate,zclmoon/aspnetboilerplate,jaq316/aspnetboilerplate,daywrite/aspnetboilerplate,nineconsult/Kickoff2016Net,ryancyq/aspnetboilerplate,jefferyzhang/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ddNils/aspnetboilerplate,zquans/aspnetboilerplate,yuzukwok/aspnetboilerplate,liujunhua/aspnetboilerplate,rucila/aspnetboilerplate,SecComm/aspnetboilerplate,nineconsult/Kickoff2016Net,fengyeju/aspnetboilerplate,anhuisunfei/aspnetboilerplate,chenkaibin/aspnetboilerplate,ShiningRush/aspnetboilerplate,virtualcca/aspnetboilerplate,AndHuang/aspnetboilerplate,MetSystem/aspnetboilerplate,LenFon/aspnetboilerplate | src/Abp.Web.Mvc/Web/Mvc/Controllers/Localization/AbpLocalizationController.cs | src/Abp.Web.Mvc/Web/Mvc/Controllers/Localization/AbpLocalizationController.cs | using System;
using System.Web;
using System.Web.Mvc;
using Abp.Localization;
using Abp.Timing;
using Abp.Web.Mvc.Models;
namespace Abp.Web.Mvc.Controllers.Localization
{
public class AbpLocalizationController : AbpController
{
public virtual ActionResult ChangeCulture(string cultureName, string returnUrl = "")
{
if (!GlobalizationHelper.IsValidCultureCode(cultureName))
{
throw new AbpException("Unknown language: " + cultureName + ". It must be a valid culture!");
}
Response.Cookies.Add(new HttpCookie("Abp.Localization.CultureName", cultureName) { Expires = Clock.Now.AddYears(2) });
if (Request.IsAjaxRequest())
{
return Json(new MvcAjaxResponse(), JsonRequestBehavior.AllowGet);
}
if (!string.IsNullOrWhiteSpace(returnUrl))
{
return Redirect(returnUrl);
}
return Redirect(Request.ApplicationPath);
}
}
}
| using System;
using System.Web;
using System.Web.Mvc;
using Abp.Localization;
using Abp.Timing;
using Abp.Web.Mvc.Models;
namespace Abp.Web.Mvc.Controllers.Localization
{
public class AbpLocalizationController : AbpController
{
public ActionResult ChangeCulture(string cultureName, string returnUrl = "")
{
if (!GlobalizationHelper.IsValidCultureCode(cultureName))
{
throw new AbpException("Unknown language: " + cultureName + ". It must be a valid culture!");
}
Response.Cookies.Add(new HttpCookie("Abp.Localization.CultureName", cultureName) { Expires = Clock.Now.AddYears(2) });
if (Request.IsAjaxRequest())
{
return Json(new MvcAjaxResponse(), JsonRequestBehavior.AllowGet);
}
if (!string.IsNullOrWhiteSpace(returnUrl))
{
return Redirect(returnUrl);
}
return Redirect("/");
}
}
}
| mit | C# |
5c7d80ea0f83c5d2c5bdf9ace431ee799db81b39 | Update ToggleIsExpandedOnDoubleTappedBehavior.cs | XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors | src/Avalonia.Xaml.Interactions/Core/ToggleIsExpandedOnDoubleTappedBehavior.cs | src/Avalonia.Xaml.Interactions/Core/ToggleIsExpandedOnDoubleTappedBehavior.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Xaml.Interactivity;
namespace Avalonia.Xaml.Interactions.Core
{
/// <summary>
/// Toggles IsExpanded property of the associated TreeViewItem control on DoubleTapped event.
/// </summary>
public sealed class ToggleIsExpandedOnDoubleTappedBehavior : Behavior<Control>
{
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.DoubleTapped += DoubleTapped;
}
/// <summary>
/// Called when the behavior is being detached from its <see cref="Behavior.AssociatedObject"/>.
/// </summary>
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.DoubleTapped -= DoubleTapped;
}
private void DoubleTapped(object sender, RoutedEventArgs args)
{
var treeViewItem = AssociatedObject.Parent as TreeViewItem;
if (treeViewItem != null)
{
treeViewItem.IsExpanded = !treeViewItem.IsExpanded;
}
}
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Xaml.Interactivity;
namespace Avalonia.Xaml.Interactions.Core
{
/// <summary>
/// Toggles IsExpanded property of the associated TreeViewItem control on DoubleTapped event.
/// </summary>
public sealed class ToggleIsExpandedOnDoubleTappedBehavior : Behavior<Control>
{
/// <inheritdoc/>
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.DoubleTapped += DoubleTapped;
}
/// <inheritdoc/>
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.DoubleTapped -= DoubleTapped;
}
private void DoubleTapped(object sender, RoutedEventArgs args)
{
var treeViewItem = AssociatedObject.Parent as TreeViewItem;
if (treeViewItem != null)
{
treeViewItem.IsExpanded = !treeViewItem.IsExpanded;
}
}
}
}
| mit | C# |
dacb2a8e2b948d67909dcec61a80945a7059e1f3 | fix null or whitespace logic | bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core | util/Server/Program.cs | util/Server/Program.cs | using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Bit.Server
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole().AddDebug();
})
.ConfigureKestrel((context, options) => { });
var contentRoot = config.GetValue<string>("contentRoot");
if (!string.IsNullOrWhiteSpace(contentRoot))
{
builder.UseContentRoot(contentRoot);
}
else
{
builder.UseContentRoot(Directory.GetCurrentDirectory());
}
var webRoot = config.GetValue<string>("webRoot");
if (string.IsNullOrWhiteSpace(webRoot))
{
builder.UseWebRoot(webRoot);
}
var host = builder.Build();
host.Run();
}
}
}
| using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Bit.Server
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole().AddDebug();
})
.ConfigureKestrel((context, options) => { });
var contentRoot = config.GetValue<string>("contentRoot");
if (string.IsNullOrWhiteSpace(contentRoot))
{
builder.UseContentRoot(contentRoot);
}
else
{
builder.UseContentRoot(Directory.GetCurrentDirectory());
}
var webRoot = config.GetValue<string>("webRoot");
if (string.IsNullOrWhiteSpace(webRoot))
{
builder.UseWebRoot(webRoot);
}
var host = builder.Build();
host.Run();
}
}
}
| agpl-3.0 | C# |
1788ca7f71afbe46c46c442b25ea3507875a143d | Fix UserManager.cs | aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template | aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/UserManager.cs | aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/UserManager.cs | using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Abp.Authorization;
using Abp.Authorization.Users;
using Abp.Configuration;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using Abp.Organizations;
using Abp.Runtime.Caching;
using AbpCompanyName.AbpProjectName.Authorization.Roles;
using Abp.Authorization.Roles;
namespace AbpCompanyName.AbpProjectName.Authorization.Users
{
public class UserManager : AbpUserManager<Role, User>
{
public UserManager(
RoleManager roleManager,
UserStore store,
IOptions<IdentityOptions> optionsAccessor,
IPasswordHasher<User> passwordHasher,
IEnumerable<IUserValidator<User>> userValidators,
IEnumerable<IPasswordValidator<User>> passwordValidators,
ILookupNormalizer keyNormalizer,
IdentityErrorDescriber errors,
IServiceProvider services,
ILogger<UserManager<User>> logger,
IPermissionManager permissionManager,
IUnitOfWorkManager unitOfWorkManager,
ICacheManager cacheManager,
IRepository<OrganizationUnit, long> organizationUnitRepository,
IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository,
IOrganizationUnitSettings organizationUnitSettings,
ISettingManager settingManager,
IRepository<UserLogin, long> userLoginRepository)
: base(
roleManager,
store,
optionsAccessor,
passwordHasher,
userValidators,
passwordValidators,
keyNormalizer,
errors,
services,
logger,
permissionManager,
unitOfWorkManager,
cacheManager,
organizationUnitRepository,
userOrganizationUnitRepository,
organizationUnitSettings,
settingManager,
userLoginRepository)
{
}
}
}
| using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Abp.Authorization;
using Abp.Authorization.Users;
using Abp.Configuration;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using Abp.Organizations;
using Abp.Runtime.Caching;
using AbpCompanyName.AbpProjectName.Authorization.Roles;
namespace AbpCompanyName.AbpProjectName.Authorization.Users
{
public class UserManager : AbpUserManager<Role, User>
{
public UserManager(
RoleManager roleManager,
UserStore store,
IOptions<IdentityOptions> optionsAccessor,
IPasswordHasher<User> passwordHasher,
IEnumerable<IUserValidator<User>> userValidators,
IEnumerable<IPasswordValidator<User>> passwordValidators,
ILookupNormalizer keyNormalizer,
IdentityErrorDescriber errors,
IServiceProvider services,
ILogger<UserManager<User>> logger,
IPermissionManager permissionManager,
IUnitOfWorkManager unitOfWorkManager,
ICacheManager cacheManager,
IRepository<OrganizationUnit, long> organizationUnitRepository,
IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository,
IOrganizationUnitSettings organizationUnitSettings,
ISettingManager settingManager)
: base(
roleManager,
store,
optionsAccessor,
passwordHasher,
userValidators,
passwordValidators,
keyNormalizer,
errors,
services,
logger,
permissionManager,
unitOfWorkManager,
cacheManager,
organizationUnitRepository,
userOrganizationUnitRepository,
organizationUnitSettings,
settingManager)
{
}
}
}
| mit | C# |
0e78cc0663f49e8799f4305290da9ee1180290e9 | fix missing interface | corker/estuite | Estuite.Example/ProgramConfiguration.cs | Estuite.Example/ProgramConfiguration.cs | using Estuite.Example.Configuration;
using Estuite.StreamDispatcher.Azure;
using Estuite.StreamStore.Azure;
namespace Estuite.Example
{
public class ProgramConfiguration :
IStreamStoreConfiguration,
ICloudStorageAccountConfiguration,
IStreamDispatcherConfiguration
{
public string ConnectionString => "UseDevelopmentStorage=true";
public string EventTableName => "esEvents";
public string StreamTableName => "esStreams";
}
} | using Estuite.Example.Configuration;
using Estuite.StreamStore.Azure;
namespace Estuite.Example
{
public class ProgramConfiguration : IStreamStoreConfiguration, ICloudStorageAccountConfiguration
{
public string ConnectionString => "UseDevelopmentStorage=true";
public string TableName => "esStreams";
public string EventTableName => "esEvents";
}
} | mit | C# |
cfd1561946a4df25b2653187728eff7333ef195d | Add debug info to troubleshoot failing test | milkshakesoftware/PreMailer.Net | PreMailer.Net/PreMailer.Net/Sources/LinkTagCssSource.cs | PreMailer.Net/PreMailer.Net/Sources/LinkTagCssSource.cs | using System;
using System.Linq;
using System.Net;
using AngleSharp.Dom;
using PreMailer.Net.Downloaders;
namespace PreMailer.Net.Sources
{
public class LinkTagCssSource : ICssSource
{
private readonly Uri _downloadUri;
private string _cssContents;
public LinkTagCssSource(IElement node, Uri baseUri)
{
// There must be an href
var href = node.Attributes.First(a => a.Name.Equals("href", StringComparison.OrdinalIgnoreCase)).Value;
if (Uri.IsWellFormedUriString(href, UriKind.Relative) && baseUri != null)
{
_downloadUri = new Uri(baseUri, href);
}
else
{
// Assume absolute
_downloadUri = new Uri(href);
}
}
public string GetCss()
{
Console.WriteLine($"GetCss scheme: {_downloadUri.Scheme}");
if (IsSupported(_downloadUri.Scheme))
{
try
{
Console.WriteLine($"Will download from '{_downloadUri}' using {WebDownloader.SharedDownloader.GetType()}");
return _cssContents ?? (_cssContents = WebDownloader.SharedDownloader.DownloadString(_downloadUri));
} catch (WebException)
{
throw new WebException($"PreMailer.Net is unable to fetch the requested URL: {_downloadUri}");
}
}
return string.Empty;
}
private static bool IsSupported(string scheme)
{
return
scheme == "http" ||
scheme == "https" ||
scheme == "ftp" ||
scheme == "file";
}
}
} | using System;
using System.Linq;
using System.Net;
using AngleSharp.Dom;
using PreMailer.Net.Downloaders;
namespace PreMailer.Net.Sources
{
public class LinkTagCssSource : ICssSource
{
private readonly Uri _downloadUri;
private string _cssContents;
public LinkTagCssSource(IElement node, Uri baseUri)
{
// There must be an href
var href = node.Attributes.First(a => a.Name.Equals("href", StringComparison.OrdinalIgnoreCase)).Value;
if (Uri.IsWellFormedUriString(href, UriKind.Relative) && baseUri != null)
{
_downloadUri = new Uri(baseUri, href);
}
else
{
// Assume absolute
_downloadUri = new Uri(href);
}
}
public string GetCss()
{
if (IsSupported(_downloadUri.Scheme))
{
try
{
return _cssContents ?? (_cssContents = WebDownloader.SharedDownloader.DownloadString(_downloadUri));
} catch (WebException)
{
throw new WebException($"PreMailer.Net is unable to fetch the requested URL: {_downloadUri}");
}
}
return string.Empty;
}
private static bool IsSupported(string scheme)
{
return
scheme == "http" ||
scheme == "https" ||
scheme == "ftp" ||
scheme == "file";
}
}
} | mit | C# |
a68abfe5617b75b88746c1e6294c7d431c55d145 | update version | prodot/ReCommended-Extension | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2020 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.1.4.0")]
[assembly: AssemblyFileVersion("5.1.4")] | using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2020 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.1.3.0")]
[assembly: AssemblyFileVersion("5.1.3")] | apache-2.0 | C# |
d25527f6349dcd99958ab6c4ed1f79db6a7c82a2 | Move Kevin's blog to his new domain at powershellexplained.com | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/KevinMarquette.cs | src/Firehose.Web/Authors/KevinMarquette.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class KevinMarquette : IAmAMicrosoftMVP
{
public string FirstName => "Kevin";
public string LastName => "Marquette";
public string ShortBioOrTagLine => "Sr. DevOps Engineer, 2018 PowerShell Community Hero, Microsoft MVP, and SoCal PowerShell UserGroup Organizer.";
public string StateOrRegion => "Orange County, USA";
public string EmailAddress => "[email protected]";
public string TwitterHandle => "kevinmarquette";
public string GitHubHandle => "kevinmarquette";
public string GravatarHash => "d7d29e9573b5da44d9886df24fcc6142";
public GeoPosition Position => new GeoPosition(33.6800000,-117.7900000);
public Uri WebSite => new Uri("https://PowerShellExplained.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://powershellexplained.com/feed.xml"); } }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class KevinMarquette : IAmAMicrosoftMVP
{
public string FirstName => "Kevin";
public string LastName => "Marquette";
public string ShortBioOrTagLine => "Sr. DevOps Engineer, 2018 PowerShell Community Hero, Microsoft MVP, and SoCal PowerShell UserGroup Organizer.";
public string StateOrRegion => "Orange County, USA";
public string EmailAddress => "[email protected]";
public string TwitterHandle => "kevinmarquette";
public string GitHubHandle => "kevinmarquette";
public string GravatarHash => "d7d29e9573b5da44d9886df24fcc6142";
public GeoPosition Position => new GeoPosition(33.6800000,-117.7900000);
public Uri WebSite => new Uri("https://kevinmarquette.github.io");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://kevinmarquette.github.io/feed.xml"); } }
}
}
| mit | C# |
1ca254c418c5879dcd3f139109d506dc748881e3 | Fix ChangeConstructionNodeBehavior.Execute not being async | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs | Content.Server/GameObjects/Components/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs | #nullable enable
using System;
using Content.Server.GameObjects.Components.Construction;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
{
[Serializable]
public class ChangeConstructionNodeBehavior : IThresholdBehavior
{
public string Node { get; private set; } = string.Empty;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Node, "node", string.Empty);
}
public async void Execute(IEntity owner, DestructibleSystem system)
{
if (string.IsNullOrEmpty(Node) ||
!owner.TryGetComponent(out ConstructionComponent? construction))
{
return;
}
await construction.ChangeNode(Node);
}
}
}
| #nullable enable
using System;
using Content.Server.GameObjects.Components.Construction;
using Content.Server.GameObjects.EntitySystems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
{
[Serializable]
public class ChangeConstructionNodeBehavior : IThresholdBehavior
{
public string Node { get; private set; } = string.Empty;
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.Node, "node", string.Empty);
}
public void Execute(IEntity owner, DestructibleSystem system)
{
if (string.IsNullOrEmpty(Node) ||
!owner.TryGetComponent(out ConstructionComponent? construction))
{
return;
}
construction.ChangeNode(Node);
}
}
}
| mit | C# |
81c871c8c63bb60c23d1e04def6106a2c44b4ff7 | Make BasicScrollbar protected | ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework | osu.Framework/Graphics/Containers/BasicScrollContainer.cs | osu.Framework/Graphics/Containers/BasicScrollContainer.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Framework.Graphics.Containers
{
public class BasicScrollContainer : BasicScrollContainer<Drawable>
{
public BasicScrollContainer(Direction scrollDirection = Direction.Vertical)
: base(scrollDirection)
{
}
}
public class BasicScrollContainer<T> : ScrollContainer<T>
where T : Drawable
{
public BasicScrollContainer(Direction scrollDirection = Direction.Vertical)
: base(scrollDirection)
{
}
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new BasicScrollbar(direction);
protected class BasicScrollbar : ScrollbarContainer
{
private const float dim_size = 8;
public BasicScrollbar(Direction direction)
: base(direction)
{
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = FrameworkColour.YellowGreen
};
}
public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None)
{
Vector2 size = new Vector2(dim_size)
{
[(int)ScrollDirection] = val
};
this.ResizeTo(size, duration, easing);
}
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Shapes;
using osuTK;
namespace osu.Framework.Graphics.Containers
{
public class BasicScrollContainer : BasicScrollContainer<Drawable>
{
public BasicScrollContainer(Direction scrollDirection = Direction.Vertical)
: base(scrollDirection)
{
}
}
public class BasicScrollContainer<T> : ScrollContainer<T>
where T : Drawable
{
public BasicScrollContainer(Direction scrollDirection = Direction.Vertical)
: base(scrollDirection)
{
}
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new BasicScrollbar(direction);
private class BasicScrollbar : ScrollbarContainer
{
private const float dim_size = 8;
public BasicScrollbar(Direction direction)
: base(direction)
{
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = FrameworkColour.YellowGreen
};
}
public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None)
{
Vector2 size = new Vector2(dim_size)
{
[(int)ScrollDirection] = val
};
this.ResizeTo(size, duration, easing);
}
}
}
}
| mit | C# |
40d1c18bdabcd702bb4377a7702d2453391c3dd5 | Fix StyleCop warning SA1015 (closing generic brace spacing) | cshung/coreclr,cshung/coreclr,poizan42/coreclr,krk/coreclr,poizan42/coreclr,poizan42/coreclr,cshung/coreclr,krk/coreclr,cshung/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr,poizan42/coreclr,poizan42/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,krk/coreclr | src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Arm/Arm64/Sha1.PlatformNotSupported.cs | src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Arm/Arm64/Sha1.PlatformNotSupported.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.
#pragma warning disable IDE0060 // unused parameters
using System.Runtime.CompilerServices;
namespace System.Runtime.Intrinsics.Arm.Arm64
{
/// <summary>
/// This class provides access to the Arm64 SHA1 Crypto intrinsics
///
/// Arm64 CPU indicate support for this feature by setting
/// ID_AA64ISAR0_EL1.SHA1 is 1 or better
/// </summary>
[CLSCompliant(false)]
public static class Sha1
{
public static bool IsSupported { [Intrinsic] get { return false; } }
/// <summary>
/// Performs SHA1 hash update choose form.
/// vsha1cq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk)
/// </summary>
public static Vector128<uint> HashChoose(Vector128<uint> hash_abcd, uint hash_e, Vector128<uint> wk) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 hash update majority form.
/// vsha1mq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk)
/// </summary>
public static Vector128<uint> HashMajority(Vector128<uint> hash_abcd, uint hash_e, Vector128<uint> wk) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 hash update parity form.
/// vsha1pq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk)
/// </summary>
public static Vector128<uint> HashParity(Vector128<uint> hash_abcd, uint hash_e, Vector128<uint> wk) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 fixed rotate
/// vsha1h_u32 (uint32_t hash_e)
/// </summary>
public static uint FixedRotate(uint hash_e) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 schedule update 0
/// vsha1su0q_u32 (uint32x4_t w0_3, uint32x4_t w4_7, uint32x4_t w8_11)
/// </summary>
public static Vector128<uint> SchedulePart1(Vector128<uint> w0_3, Vector128<uint> w4_7, Vector128<uint> w8_11) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 schedule update 1
/// vsha1su1q_u32 (uint32x4_t tw0_3, uint32x4_t w12_15)
/// </summary>
public static Vector128<uint> SchedulePart2(Vector128<uint> tw0_3, Vector128<uint> w12_15) { throw new PlatformNotSupportedException(); }
}
}
| // 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.
#pragma warning disable IDE0060 // unused parameters
using System.Runtime.CompilerServices;
namespace System.Runtime.Intrinsics.Arm.Arm64
{
/// <summary>
/// This class provides access to the Arm64 SHA1 Crypto intrinsics
///
/// Arm64 CPU indicate support for this feature by setting
/// ID_AA64ISAR0_EL1.SHA1 is 1 or better
/// </summary>
[CLSCompliant(false)]
public static class Sha1
{
public static bool IsSupported { [Intrinsic] get { return false; } }
/// <summary>
/// Performs SHA1 hash update choose form.
/// vsha1cq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk)
/// </summary>
public static Vector128<uint> HashChoose(Vector128<uint> hash_abcd, uint hash_e, Vector128<uint>wk) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 hash update majority form.
/// vsha1mq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk)
/// </summary>
public static Vector128<uint> HashMajority(Vector128<uint> hash_abcd, uint hash_e, Vector128<uint>wk) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 hash update parity form.
/// vsha1pq_u32 (uint32x4_t hash_abcd, uint32_t hash_e, uint32x4_t wk)
/// </summary>
public static Vector128<uint> HashParity(Vector128<uint> hash_abcd, uint hash_e, Vector128<uint>wk) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 fixed rotate
/// vsha1h_u32 (uint32_t hash_e)
/// </summary>
public static uint FixedRotate(uint hash_e) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 schedule update 0
/// vsha1su0q_u32 (uint32x4_t w0_3, uint32x4_t w4_7, uint32x4_t w8_11)
/// </summary>
public static Vector128<uint> SchedulePart1(Vector128<uint> w0_3, Vector128<uint> w4_7, Vector128<uint> w8_11) { throw new PlatformNotSupportedException(); }
/// <summary>
/// Performs SHA1 schedule update 1
/// vsha1su1q_u32 (uint32x4_t tw0_3, uint32x4_t w12_15)
/// </summary>
public static Vector128<uint> SchedulePart2(Vector128<uint> tw0_3, Vector128<uint> w12_15) { throw new PlatformNotSupportedException(); }
}
}
| mit | C# |
b88d39eed6307727baf2a46afe31894c9d9bc8b5 | fix broken build | json-api-dotnet/JsonApiDotNetCore | test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitionExtensibilityPoints.cs | test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitionExtensibilityPoints.cs | using System;
using JetBrains.Annotations;
using JsonApiDotNetCore.Resources;
namespace JsonApiDotNetCoreTests.IntegrationTests
{
/// <summary>
/// Lists the various extensibility points on <see cref="IResourceDefinition{TResource,TId}" />.
/// </summary>
[Flags]
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public enum ResourceDefinitionExtensibilityPoints
{
None = 0,
OnApplyIncludes = 1,
OnApplyFilter = 1 << 1,
OnApplySort = 1 << 2,
OnApplyPagination = 1 << 3,
OnApplySparseFieldSet = 1 << 4,
OnRegisterQueryableHandlersForQueryStringParameters = 1 << 5,
GetMeta = 1 << 6,
OnPrepareWriteAsync = 1 << 7,
OnSetToOneRelationshipAsync = 1 << 8,
OnSetToManyRelationshipAsync = 1 << 9,
OnAddToRelationshipAsync = 1 << 10,
OnRemoveFromRelationshipAsync = 1 << 11,
OnWritingAsync = 1 << 12,
OnWriteSucceededAsync = 1 << 13,
OnDeserialize = 1 << 14,
OnSerialize = 1 << 15,
Reading = OnApplyIncludes | OnApplyFilter | OnApplySort | OnApplyPagination | OnApplySparseFieldSet |
OnRegisterQueryableHandlersForQueryStringParameters | GetMeta,
Writing = OnPrepareWriteAsync | OnSetToOneRelationshipAsync | OnSetToManyRelationshipAsync | OnAddToRelationshipAsync | OnRemoveFromRelationshipAsync |
OnWritingAsync | OnWriteSucceededAsync,
Serialization = OnDeserialize | OnSerialize,
All = Reading | Writing | Serialization
}
}
| using System;
using JsonApiDotNetCore.Resources;
namespace JsonApiDotNetCoreTests.IntegrationTests
{
/// <summary>
/// Lists the various extensibility points on <see cref="IResourceDefinition{TResource,TId}" />.
/// </summary>
[Flags]
public enum ResourceDefinitionExtensibilityPoints
{
None = 0,
OnApplyIncludes = 1,
OnApplyFilter = 1 << 1,
OnApplySort = 1 << 2,
OnApplyPagination = 1 << 3,
OnApplySparseFieldSet = 1 << 4,
OnRegisterQueryableHandlersForQueryStringParameters = 1 << 5,
GetMeta = 1 << 6,
OnPrepareWriteAsync = 1 << 7,
OnSetToOneRelationshipAsync = 1 << 8,
OnSetToManyRelationshipAsync = 1 << 9,
OnAddToRelationshipAsync = 1 << 10,
OnRemoveFromRelationshipAsync = 1 << 11,
OnWritingAsync = 1 << 12,
OnWriteSucceededAsync = 1 << 13,
OnDeserialize = 1 << 14,
OnSerialize = 1 << 15,
Reading = OnApplyIncludes | OnApplyFilter | OnApplySort | OnApplyPagination | OnApplySparseFieldSet |
OnRegisterQueryableHandlersForQueryStringParameters | GetMeta,
Writing = OnPrepareWriteAsync | OnSetToOneRelationshipAsync | OnSetToManyRelationshipAsync | OnAddToRelationshipAsync | OnRemoveFromRelationshipAsync |
OnWritingAsync | OnWriteSucceededAsync,
Serialization = OnDeserialize | OnSerialize,
All = Reading | Writing | Serialization
}
}
| mit | C# |
46767977fe293968cf7e8a27a77fe2fcb0577e3d | fix doc comment | jonsequitur/Alluvial | Alluvial/StreamCatchupError.cs | Alluvial/StreamCatchupError.cs | using System;
namespace Alluvial
{
/// <summary>
/// Provides information about an error that occurs while running a stream catchup.
/// </summary>
public class StreamCatchupError
{
/// <summary>
/// Initializes a new instance of the <see cref="StreamCatchupError"/> class.
/// </summary>
/// <param name="exception">The exception.</param>
/// <exception cref="System.ArgumentNullException"></exception>
public StreamCatchupError(Exception exception)
{
if (exception == null)
{
throw new ArgumentNullException(nameof(exception));
}
Exception = exception;
}
/// <summary>
/// A caught exception.
/// </summary>
public Exception Exception { get; }
/// <summary>
/// Gets a value indicating whether the catchup should continue.
/// </summary>
internal bool ShouldContinue { get; private set; }
/// <summary>
/// Notifie the catchup that it should continue despite the error.
/// </summary>
/// <remarks>By default, the catchup will stop when an exception is thrown.</remarks>
public void Continue() => ShouldContinue = true;
/// <summary>
/// Creates a <see cref="StreamCatchupError{TProjection}" /> instance.
/// </summary>
/// <typeparam name="TProjection">The type of the projection.</typeparam>
/// <param name="exception">The exception.</param>
/// <param name="projection">The projection.</param>
/// <returns></returns>
public static StreamCatchupError<TProjection> Create<TProjection>(Exception exception, TProjection projection) =>
new StreamCatchupError<TProjection>(exception, projection);
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String" /> that represents this instance.
/// </returns>
public override string ToString() =>
$"[StreamCatchupError] {(ShouldContinue ? "will continue" : "won't continue")} {Exception}";
}
} | using System;
namespace Alluvial
{
/// <summary>
/// Provides information about an error that occurs while running a stream catchup.
/// </summary>
public class StreamCatchupError
{
/// <summary>
/// Initializes a new instance of the <see cref="StreamCatchupError"/> class.
/// </summary>
/// <param name="exception">The exception.</param>
/// <exception cref="System.ArgumentNullException"></exception>
public StreamCatchupError(Exception exception)
{
if (exception == null)
{
throw new ArgumentNullException(nameof(exception));
}
Exception = exception;
}
/// <summary>
/// A caught exception.
/// </summary>
public Exception Exception { get; }
/// <summary>
/// Gets a value indicating whether the catchup should continue.
/// </summary>
internal bool ShouldContinue { get; private set; }
/// <summary>
/// Notified the catchup that the it should continue despite the error.
/// </summary>
public void Continue() => ShouldContinue = true;
/// <summary>
/// Creates a <see cref="StreamCatchupError{TProjection}" /> instance.
/// </summary>
/// <typeparam name="TProjection">The type of the projection.</typeparam>
/// <param name="exception">The exception.</param>
/// <param name="projection">The projection.</param>
/// <returns></returns>
public static StreamCatchupError<TProjection> Create<TProjection>(Exception exception, TProjection projection) =>
new StreamCatchupError<TProjection>(exception, projection);
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String" /> that represents this instance.
/// </returns>
public override string ToString() =>
$"[StreamCatchupError] {(ShouldContinue ? "will continue" : "won't continue")} {Exception}";
}
} | mit | C# |
496ca899963f164e1e754a674bff041b165a5e1e | fix proxy | rustamserg/command_console | command_console/ProxyConsole.cs | command_console/ProxyConsole.cs | using System;
using System.Threading;
namespace command_console
{
public class ProxyConsole : IConsole
{
public event OnCommandHandler OnCommand;
public bool IsAlive { get; private set; }
public int Width { get; private set; }
public int Height { get; private set; }
public ConsoleColor CommandColor { get; set; }
private Thread m_inputThread;
private AutoResetEvent m_blockEvent;
public void Init(ConsoleColor cmdColor)
{
Width = Console.WindowWidth;
Height = Console.WindowHeight;
Init(Width, Height, cmdColor);
}
public void Init(int width, int height, ConsoleColor cmdColor)
{
Width = width;
Height = height;
CommandColor = cmdColor;
Console.SetWindowSize (Width, Height);
Console.SetBufferSize (Width, Height);
}
public void Run(bool isBlocking)
{
m_inputThread = new Thread (Input);
m_inputThread.Start ();
IsAlive = true;
if (isBlocking) {
m_blockEvent = new AutoResetEvent (false);
m_blockEvent.WaitOne ();
}
IsAlive = true;
}
public void Stop()
{
IsAlive = false;
if (m_blockEvent != null)
m_blockEvent.Set ();
try {
if (m_inputThread.IsAlive)
m_inputThread.Abort();
}
catch (Exception) {}
}
public void Write (string line)
{
if (!IsAlive)
return;
Console.Write (line);
}
public void Write (string format, params object[] args)
{
if (!IsAlive)
return;
Console.Write (format, args);
}
public void WriteLine (string line)
{
if (!IsAlive)
return;
Console.WriteLine (line);
}
public void WriteLine (string format, params object[] args)
{
if (!IsAlive)
return;
Console.WriteLine (format, args);
}
private void Input()
{
while (IsAlive) {
string cmd = Console.ReadLine ();
if (OnCommand != null)
OnCommand (cmd);
}
}
}
}
| using System;
namespace command_console
{
public class ProxyConsole : IConsole
{
public event OnCommandHandler OnCommand;
public bool IsAlive { get; private set; }
public int Width { get; private set; }
public int Height { get; private set; }
public ConsoleColor CommandColor { get; set; }
public void Init(ConsoleColor cmdColor)
{
Width = Console.WindowWidth;
Height = Console.WindowHeight;
Init(Width, Height, cmdColor);
}
public void Init(int width, int height, ConsoleColor cmdColor)
{
Width = width;
Height = height;
CommandColor = cmdColor;
Console.SetWindowSize (Width, Height);
Console.SetBufferSize (Width, Height);
}
public void Run(bool isBlocking)
{
IsAlive = true;
while (IsAlive) {
string cmd = Console.ReadLine ();
if (OnCommand != null)
OnCommand (cmd);
}
}
public void Stop()
{
IsAlive = false;
}
public void Write (string line)
{
if (!IsAlive)
return;
Console.Write (line);
}
public void Write (string format, params object[] args)
{
if (!IsAlive)
return;
Console.Write (format, args);
}
public void WriteLine (string line)
{
if (!IsAlive)
return;
Console.WriteLine (line);
}
public void WriteLine (string format, params object[] args)
{
if (!IsAlive)
return;
Console.WriteLine (format, args);
}
}
}
| mit | C# |
04bbe4fc592f785d98e82b49a42727057cdf6d63 | Improve GetHttpContext (#838) | grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet | src/Grpc.AspNetCore.Server/ServerCallContextExtensions.cs | src/Grpc.AspNetCore.Server/ServerCallContextExtensions.cs | #region Copyright notice and license
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using Grpc.AspNetCore.Server.Internal;
using Microsoft.AspNetCore.Http;
namespace Grpc.Core
{
/// <summary>
/// Extension methods for ServerCallContext.
/// </summary>
public static class ServerCallContextExtensions
{
/// <summary>
/// Retrieve the <see cref="HttpContext"/> from the a call's <see cref="ServerCallContext"/>.
/// The HttpContext is only available when gRPC services are hosted by ASP.NET Core. An error will be
/// thrown if this method is used outside of ASP.NET Core.
/// Note that read-only usage of HttpContext is recommended as changes to the HttpContext are not synchronized
/// with the ServerCallContext.
/// </summary>
/// <param name="serverCallContext">The <see cref="ServerCallContext"/>.</param>
/// <returns>The call's <see cref="HttpContext"/>.</returns>
public static HttpContext GetHttpContext(this ServerCallContext serverCallContext)
{
if (serverCallContext == null)
{
throw new ArgumentNullException(nameof(serverCallContext));
}
var httpContextServerCallContext = serverCallContext as HttpContextServerCallContext;
if (httpContextServerCallContext == null)
{
throw new InvalidOperationException("Could not get HttpContext from ServerCallContext. HttpContext can only be accessed when gRPC services are hosted by ASP.NET Core.");
}
return httpContextServerCallContext.HttpContext;
}
}
}
| #region Copyright notice and license
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using Grpc.AspNetCore.Server.Internal;
using Microsoft.AspNetCore.Http;
namespace Grpc.Core
{
/// <summary>
/// Extension methods for ServerCallContext.
/// </summary>
public static class ServerCallContextExtensions
{
/// <summary>
/// Retrieve the <see cref="HttpContext"/> from a <see cref="ServerCallContext"/> if possible. Note that read-only access is
/// recommended as changes to the HttpContext is not synchronized with the ServerCallContext. The HttpContext is only available
/// when using gRPC with ASP.NET Core.
/// </summary>
/// <param name="serverCallContext">The <see cref="ServerCallContext"/> to extract from.</param>
/// <returns>The extracted <see cref="HttpContext"/>. If it cannot be extracted, an error will be thrown.</returns>
public static HttpContext GetHttpContext(this ServerCallContext serverCallContext)
{
var httpContextServerCallContext = serverCallContext as HttpContextServerCallContext;
if (httpContextServerCallContext == null)
{
throw new InvalidOperationException("Could not get HttpContext from ServerCallContext. HttpContext can only be accessed when gRPC services are hosted by Kestrel.");
}
return httpContextServerCallContext.HttpContext;
}
}
}
| apache-2.0 | C# |
8d45a95186ac2351f1647eecc8e83c84a8b876de | Update src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintDataTag.cs | diryboy/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,diryboy/roslyn,panopticoncentral/roslyn,genlu/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,aelij/roslyn,jmarolf/roslyn,bartdesmet/roslyn,gafter/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,dotnet/roslyn,eriawan/roslyn,aelij/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,tmat/roslyn,aelij/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,brettfo/roslyn,KevinRansom/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,heejaechang/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,brettfo/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,genlu/roslyn,sharwell/roslyn,dotnet/roslyn,eriawan/roslyn,sharwell/roslyn,bartdesmet/roslyn,gafter/roslyn,tannergooding/roslyn,mavasani/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,gafter/roslyn,KevinRansom/roslyn,jmarolf/roslyn,tannergooding/roslyn,genlu/roslyn,sharwell/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,heejaechang/roslyn,physhi/roslyn,tmat/roslyn,heejaechang/roslyn,weltkante/roslyn,KevinRansom/roslyn,mavasani/roslyn,jmarolf/roslyn,tmat/roslyn,weltkante/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,physhi/roslyn | src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintDataTag.cs | src/EditorFeatures/Core/InlineParameterNameHints/InlineParamNameHintDataTag.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.
#nullable enable
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
{
/// <summary>
/// The simple tag that only holds information regarding the associated parameter name
/// for the argument
/// </summary>
class InlineParamNameHintDataTag : ITag
{
public readonly string TagName;
public InlineParamNameHintDataTag(string name)
{
TagName = name;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
{
/// <summary>
/// The simple tag that only holds information regarding the associated parameter name
/// for the argument
/// </summary>
class InlineParamNameHintDataTag : ITag
{
public readonly string TagName;
public InlineParamNameHintDataTag(string name)
{
TagName = name;
}
}
}
| mit | C# |
28f3f3ede83b20cfb91d0ae7bff48336ce98e108 | fix Neodym year | mathnet/mathnet-iridium,cqwang/mathnet-iridium,cqwang/mathnet-iridium,cqwang/mathnet-iridium,mathnet/mathnet-iridium | src/app/MathNet.Neodym/Library/Properties/AssemblyInfo.cs | src/app/MathNet.Neodym/Library/Properties/AssemblyInfo.cs | // Math.NET Neodym, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
//
// Copyright (c) 2001-2008, Christoph Rüegg, http://christoph.ruegg.name
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security;
[assembly: AssemblyTitle("Math.NET Neodym: Signal Prozessing Library")]
[assembly: AssemblyDescription("http://mathnet.opensourcedotnet.info")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Math.NET Project")]
[assembly: AssemblyProduct("Math.NET")]
[assembly: AssemblyCopyright("Copyright © 2008, Math.NET Project")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted = false)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
[assembly: SecurityPermission(SecurityAction.RequestOptional, SkipVerification = true)] // TODO: remove - temp. fixes NCover issue
[assembly: SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode = true, Assertion = true, BindingRedirects = true)]
[assembly: FileIOPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: EnvironmentPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: ReflectionPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: RegistryPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.SocketPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.WebPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.DnsPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.Mail.SmtpPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.NetworkInformation.NetworkInformationPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: CLSCompliant(true)]
[assembly: Guid("4d30d62e-c708-411f-bc68-8da5621fcff7")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.*")] // even = release
[assembly: AssemblyFileVersion("1.0.0.0")]
| // Math.NET Neodym, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
//
// Copyright (c) 2001-2008, Christoph Rüegg, http://christoph.ruegg.name
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security;
[assembly: AssemblyTitle("Math.NET Neodym: Signal Prozessing Library")]
[assembly: AssemblyDescription("http://mathnet.opensourcedotnet.info")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Math.NET Project")]
[assembly: AssemblyProduct("Math.NET")]
[assembly: AssemblyCopyright("Copyright © 2007, Math.NET Project")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: PermissionSet(SecurityAction.RequestOptional, Unrestricted = false)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
[assembly: SecurityPermission(SecurityAction.RequestOptional, SkipVerification = true)] // TODO: remove - temp. fixes NCover issue
[assembly: SecurityPermission(SecurityAction.RequestRefuse, UnmanagedCode = true, Assertion = true, BindingRedirects = true)]
[assembly: FileIOPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: EnvironmentPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: ReflectionPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: RegistryPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.SocketPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.WebPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.DnsPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.Mail.SmtpPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: System.Net.NetworkInformation.NetworkInformationPermission(SecurityAction.RequestRefuse, Unrestricted = true)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: CLSCompliant(true)]
[assembly: Guid("4d30d62e-c708-411f-bc68-8da5621fcff7")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.*")] // even = release
[assembly: AssemblyFileVersion("1.0.0.0")]
| lgpl-2.1 | C# |
c253b75e5424bb598290118bbe264cf265ea4f3b | Remove dependency on IMessage from GetPeekLockMessageControl | drub0y/Obvs.AzureServiceBus | Obvs.AzureServiceBus/PeekLockMessage.cs | Obvs.AzureServiceBus/PeekLockMessage.cs | using System;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Obvs.AzureServiceBus.Infrastructure;
using Obvs.Types;
namespace Obvs.AzureServiceBus
{
public abstract class PeekLockMessage : IMessage
{
[NonSerialized]
private IMessagePeekLockControl _messagePeekLockControl;
[XmlIgnore]
[IgnoreDataMember]
internal IMessagePeekLockControl PeekLockControl
{
get
{
return _messagePeekLockControl;
}
set
{
#if DEBUG
if(value == null)
{
throw new ArgumentNullException();
}
#endif
_messagePeekLockControl = value;
}
}
}
public static class PeekLockControlMessageExtensions
{
public static IMessagePeekLockControl GetPeekLockControl<TMessage>(this TMessage message) where TMessage : class
{
if(message == null) throw new ArgumentNullException("message");
PeekLockMessage peekLockMessage = message as PeekLockMessage;
if(peekLockMessage == null)
{
throw new InvalidOperationException("The message is not valid for peek lock control. You must inherit from the PeekLockMessage class to opt-in to peek lock semantics.");
}
return peekLockMessage.PeekLockControl;
}
}
}
| using System;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Obvs.AzureServiceBus.Infrastructure;
using Obvs.Types;
namespace Obvs.AzureServiceBus
{
public abstract class PeekLockMessage : IMessage
{
[NonSerialized]
private IMessagePeekLockControl _messagePeekLockControl;
[XmlIgnore]
[IgnoreDataMember]
internal IMessagePeekLockControl PeekLockControl
{
get
{
return _messagePeekLockControl;
}
set
{
#if DEBUG
if(value == null)
{
throw new ArgumentNullException();
}
#endif
_messagePeekLockControl = value;
}
}
}
public static class PeekLockControlMessageExtensions
{
public static IMessagePeekLockControl GetPeekLockControl(this IMessage message)
{
if(message == null)
throw new ArgumentNullException("message");
PeekLockMessage peekLockMessage = message as PeekLockMessage;
if(peekLockMessage == null)
{
throw new InvalidOperationException("The message is not valid for peek lock control.");
}
return peekLockMessage.PeekLockControl;
}
}
}
| mit | C# |
12be467b2327ef9347612987e922176600a5b582 | add properties | Appleseed/base,Appleseed/base | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponse.cs | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/SolrResponse.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class SolrResponse
{
public SolrResponseItem[] docs { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class SolrResponse
{
}
}
| apache-2.0 | C# |
c266086ccb3ee6058c464062fb8915c862e419ed | Correct comment | Rustemt/oxyplot,BRER-TECH/oxyplot,H2ONaCl/oxyplot,HermanEldering/oxyplot,lynxkor/oxyplot,TheAlmightyBob/oxyplot,br111an/oxyplot,GeertvanHorrik/oxyplot,objorke/oxyplot,NilesDavis/oxyplot,TheAlmightyBob/oxyplot,Mitch-Connor/oxyplot,lynxkor/oxyplot,svendu/oxyplot,br111an/oxyplot,Mitch-Connor/oxyplot,H2ONaCl/oxyplot,freudenthal/oxyplot,Rustemt/oxyplot,freudenthal/oxyplot,olegtarasov/oxyplot,H2ONaCl/oxyplot,mattleibow/oxyplot,as-zhuravlev/oxyplot_wpf_fork,oxyplot/oxyplot,sevoku/oxyplot,jeremyiverson/oxyplot,Sbosanquet/oxyplot,Jonarw/oxyplot,TheAlmightyBob/oxyplot,BRER-TECH/oxyplot,Kaplas80/oxyplot,svendu/oxyplot,as-zhuravlev/oxyplot_wpf_fork,bbqchickenrobot/oxyplot,GeertvanHorrik/oxyplot,zur003/oxyplot,Kaplas80/oxyplot,GeertvanHorrik/oxyplot,olegtarasov/oxyplot,Sbosanquet/oxyplot,Isolocis/oxyplot,as-zhuravlev/oxyplot_wpf_fork,shoelzer/oxyplot,freudenthal/oxyplot,bbqchickenrobot/oxyplot,shoelzer/oxyplot,mattleibow/oxyplot,ze-pequeno/oxyplot,Jofta/oxyplot,sevoku/oxyplot,Mitch-Connor/oxyplot,HermanEldering/oxyplot,DotNetDoctor/oxyplot,Rustemt/oxyplot,objorke/oxyplot,br111an/oxyplot,shoelzer/oxyplot,bbqchickenrobot/oxyplot,lynxkor/oxyplot,svendu/oxyplot,jeremyiverson/oxyplot,jeremyiverson/oxyplot,objorke/oxyplot,Sbosanquet/oxyplot,DotNetDoctor/oxyplot | Source/OxyPlot/Foundation/IDataPoint.cs | Source/OxyPlot/Foundation/IDataPoint.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="IDataPoint.cs" company="OxyPlot">
// The MIT License (MIT)
//
// Copyright (c) 2014 OxyPlot contributors
//
// 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>
// <summary>
// Defines a point.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
/// <summary>
/// Defines a point.
/// </summary>
public interface IDataPoint
{
/// <summary>
/// Gets or sets the x-coordinate.
/// </summary>
/// <value>The x-coordinate.</value>
double X { get; set; }
/// <summary>
/// Gets or sets the y-coordinate.
/// </summary>
/// <value>The y-coordinate.</value>
double Y { get; set; }
}
/// <summary>
/// Provides extension methods for <see cref="IDataPoint" />.
/// </summary>
public static class DataPointExtensions
{
/// <summary>
/// Returns whether the coordinate contains a NaN value.
/// </summary>
/// <param name="p">The point to evaluate.</param>
/// <returns><c>true</c> if neither the X nor Y coordinates are NaN values; otherwise, <value><c>false</c></value>.</returns>
public static bool IsValid(this IDataPoint p)
{
return !double.IsNaN(p.X) && !double.IsNaN(p.Y);
}
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="IDataPoint.cs" company="OxyPlot">
// The MIT License (MIT)
//
// Copyright (c) 2014 OxyPlot contributors
//
// 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>
// <summary>
// Defines a point.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
/// <summary>
/// Defines a point.
/// </summary>
public interface IDataPoint
{
/// <summary>
/// Gets or sets the x-coordinate.
/// </summary>
/// <value>The x-coordinate.</value>
double X { get; set; }
/// <summary>
/// Gets or sets the y-coordinate.
/// </summary>
/// <value>The y-coordinate.</value>
double Y { get; set; }
}
/// <summary>
/// Provides extension methods for <see cref="IDataPoint" />.
/// </summary>
public static class DataPointExtensions
{
/// <summary>
/// Returns whether the coordinate contains a NaN value.
/// </summary>
/// <value><c>true</c></value>
/// <param name="p">The point to evaluate.</param>
/// <returns><value><c>true</c></value> if neither the X nor Y coordinates are NaN values; otherwise, <value><c>false</c></value>.</returns>
public static bool IsValid(this IDataPoint p)
{
return !double.IsNaN(p.X) && !double.IsNaN(p.Y);
}
}
} | mit | C# |
b37c26500448288ca97bfe31f80f9c840aa07e0c | throw ArgumentException at the end of `ConvertTo` method | serilog/serilog-settings-configuration,serilog/serilog-framework-configuration | src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationSectionArgumentValue.cs | src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationSectionArgumentValue.cs | using Serilog.Configuration;
using System;
using System.Reflection;
namespace Serilog.Settings.Configuration
{
class ConfigurationSectionArgumentValue : IConfigurationArgumentValue
{
readonly IConfigurationReader _configReader;
public ConfigurationSectionArgumentValue(IConfigurationReader configReader)
{
_configReader = configReader ?? throw new ArgumentNullException(nameof(configReader));
}
public object ConvertTo(Type toType)
{
var typeInfo = toType.GetTypeInfo();
if (!typeInfo.IsGenericType ||
typeInfo.GetGenericTypeDefinition() is Type genericType && genericType != typeof(Action<>))
{
throw new InvalidOperationException("Argument value should be of type Action<>.");
}
var configurationType = typeInfo.GenericTypeArguments[0];
if (configurationType == typeof(LoggerSinkConfiguration))
{
return new Action<LoggerSinkConfiguration>(_configReader.ApplySinks);
}
if (configurationType == typeof(LoggerConfiguration))
{
return new Action<LoggerConfiguration>(_configReader.Configure);
}
throw new ArgumentException($"Handling {configurationType} is not implemented.");
}
}
}
| using Serilog.Configuration;
using System;
using System.Reflection;
namespace Serilog.Settings.Configuration
{
class ConfigurationSectionArgumentValue : IConfigurationArgumentValue
{
readonly IConfigurationReader _configReader;
public ConfigurationSectionArgumentValue(IConfigurationReader configReader)
{
_configReader = configReader ?? throw new ArgumentNullException(nameof(configReader));
}
public object ConvertTo(Type toType)
{
var typeInfo = toType.GetTypeInfo();
if (!typeInfo.IsGenericType ||
typeInfo.GetGenericTypeDefinition() is Type genericType && genericType != typeof(Action<>))
{
throw new InvalidOperationException("Argument value should be of type Action<>.");
}
var configurationType = typeInfo.GenericTypeArguments[0];
if (configurationType == typeof(LoggerSinkConfiguration))
{
return new Action<LoggerSinkConfiguration>(_configReader.ApplySinks);
}
if (configurationType == typeof(LoggerConfiguration))
{
return new Action<LoggerConfiguration>(_configReader.Configure);
}
throw new Exception($"Handling {configurationType} is not implemented.");
}
}
}
| apache-2.0 | C# |
4000f588d22e3b2490a215ceafc68ddc47c35ba9 | bump version | poma/HotsStats | StatsDisplay/Properties/AssemblyInfo.cs | StatsDisplay/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HotsStats")]
[assembly: AssemblyDescription("An app that shows player stats in Heroes of the Storm")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotsStats")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.3")]
[assembly: AssemblyFileVersion("0.4.3")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HotsStats")]
[assembly: AssemblyDescription("An app that shows player stats in Heroes of the Storm")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotsStats")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.2")]
[assembly: AssemblyFileVersion("0.4.2")]
| mit | C# |
ebc6cdedd5b63d4eaf60dc1b1b71beb8fb3d4511 | fix test-core target | xbehave/xbehave.net,adamralph/xbehave.net | targets/Program.cs | targets/Program.cs | using System;
using System.Threading.Tasks;
using SimpleExec;
using static Bullseye.Targets;
using static SimpleExec.Command;
internal class Program
{
public static Task Main(string[] args)
{
Target("default", DependsOn("pack", "test"));
Target("build", () => RunAsync("dotnet", $"build --configuration Release /nologo"));
Target(
"pack",
DependsOn("build"),
ForEach("Xbehave.Core.nuspec", "Xbehave.nuspec"),
async nuspec =>
{
Environment.SetEnvironmentVariable("NUSPEC_FILE", nuspec, EnvironmentVariableTarget.Process);
await RunAsync("dotnet", $"pack src/Xbehave.Core --configuration Release --no-build /nologo");
});
Target(
"test-core",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework netcoreapp3.0 /nologo"));
Target(
"test-net",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework net472 /nologo"));
Target("test", DependsOn("test-core", "test-net"));
return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
}
}
| using System;
using System.Threading.Tasks;
using SimpleExec;
using static Bullseye.Targets;
using static SimpleExec.Command;
internal class Program
{
public static Task Main(string[] args)
{
Target("default", DependsOn("pack", "test"));
Target("build", () => RunAsync("dotnet", $"build --configuration Release /nologo"));
Target(
"pack",
DependsOn("build"),
ForEach("Xbehave.Core.nuspec", "Xbehave.nuspec"),
async nuspec =>
{
Environment.SetEnvironmentVariable("NUSPEC_FILE", nuspec, EnvironmentVariableTarget.Process);
await RunAsync("dotnet", $"pack src/Xbehave.Core --configuration Release --no-build /nologo");
});
Target(
"test-core",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework netcoreapp2.2 /nologo"));
Target(
"test-net",
DependsOn("build"),
() => RunAsync("dotnet", $"test --configuration Release --no-build --framework net472 /nologo"));
Target("test", DependsOn("test-core", "test-net"));
return RunTargetsAndExitAsync(args, ex => ex is NonZeroExitCodeException);
}
}
| mit | C# |
719ff8b0314f290f372cde9c2c64f8b0ceeab973 | Return new IDSContext if data is null | SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers | src/SFA.DAS.EmployerUsers.Web/Authentication/IdsContext.cs | src/SFA.DAS.EmployerUsers.Web/Authentication/IdsContext.cs | using System;
using System.Text;
using System.Web.Security;
using Newtonsoft.Json;
using NLog;
namespace SFA.DAS.EmployerUsers.Web.Authentication
{
public class IdsContext
{
public string ReturnUrl { get; set; }
public string ClientId { get; set; }
public static string CookieName => "IDS";
public static IdsContext ReadFrom(string data)
{
try
{
if (string.IsNullOrEmpty(data))
{
return new IdsContext();
}
var unEncData = Encoding.UTF8.GetString(MachineKey.Unprotect(Convert.FromBase64String(data)));
return JsonConvert.DeserializeObject<IdsContext>(unEncData);
}
catch (ArgumentException ex)
{
LogManager.GetCurrentClassLogger().Info(ex, ex.Message);
return new IdsContext();
}
catch (Exception ex)
{
LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
return new IdsContext();
}
}
}
} | using System;
using System.Text;
using System.Web.Security;
using Newtonsoft.Json;
using NLog;
namespace SFA.DAS.EmployerUsers.Web.Authentication
{
public class IdsContext
{
public string ReturnUrl { get; set; }
public string ClientId { get; set; }
public static string CookieName => "IDS";
public static IdsContext ReadFrom(string data)
{
try
{
var unEncData = Encoding.UTF8.GetString(MachineKey.Unprotect(Convert.FromBase64String(data)));
return JsonConvert.DeserializeObject<IdsContext>(unEncData);
}
catch (ArgumentException ex)
{
LogManager.GetCurrentClassLogger().Info(ex, ex.Message);
return new IdsContext();
}
catch (Exception ex)
{
LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
return new IdsContext();
}
}
}
} | mit | C# |
c48f504fe47cddbeb7563cfd643c21e69544ed3c | Fix package completion capturing | lAnubisl/PostTrack,lAnubisl/PostTrack,lAnubisl/PostTrack | Posttrack.BLL/PackageHelper.cs | Posttrack.BLL/PackageHelper.cs | using Posttrack.BLL.Properties;
using Posttrack.Data.Interfaces.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Posttrack.BLL
{
internal static class PackageHelper
{
internal static bool IsFinished(PackageDTO package)
{
string historyAction = package.History.First().Action;
return historyAction != null &&
(historyAction.ToLowerInvariant().Contains("вручено") ||
historyAction == "Отправление доставлено");
}
internal static bool IsInactivityPeriodElapsed(PackageDTO package)
{
return package.UpdateDate <= DateTime.Now.AddMonths(-Settings.Default.InactivityPeriodInMonths);
}
internal static bool IsStatusTheSame(ICollection<PackageHistoryItemDTO> history, PackageDTO package)
{
if (IsEmpty(history) && IsEmpty(package.History))
{
return true;
}
if (!IsEmpty(history) && !IsEmpty(package.History) && package.History.Count == history.Count)
{
return true;
}
return false;
}
internal static bool IsEmpty(IEnumerable<PackageHistoryItemDTO> history)
{
return history == null || !history.Any();
}
}
}
| using Posttrack.BLL.Properties;
using Posttrack.Data.Interfaces.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Posttrack.BLL
{
internal static class PackageHelper
{
internal static bool IsFinished(PackageDTO package)
{
string lastHistoryAction = package.History.First().Action;
return lastHistoryAction != null &&
(lastHistoryAction.Contains("Доставлено, вручено") ||
lastHistoryAction == "Отправление доставлено");
}
internal static bool IsInactivityPeriodElapsed(PackageDTO package)
{
return package.UpdateDate <= DateTime.Now.AddMonths(-Settings.Default.InactivityPeriodInMonths);
}
internal static bool IsStatusTheSame(ICollection<PackageHistoryItemDTO> history, PackageDTO package)
{
if (IsEmpty(history) && IsEmpty(package.History))
{
return true;
}
if (!IsEmpty(history) && !IsEmpty(package.History) && package.History.Count == history.Count)
{
return true;
}
return false;
}
internal static bool IsEmpty(IEnumerable<PackageHistoryItemDTO> history)
{
return history == null || !history.Any();
}
}
}
| apache-2.0 | C# |
d695e681f3d35930543c1f280c12cfaf34dbdf4d | Optimize Comments counting on containers | phillipsj/Orchard,tobydodds/folklife,armanforghani/Orchard,planetClaire/Orchard-LETS,MpDzik/Orchard,fortunearterial/Orchard,SzymonSel/Orchard,sebastienros/msc,Anton-Am/Orchard,OrchardCMS/Orchard,AdvantageCS/Orchard,andyshao/Orchard,spraiin/Orchard,Morgma/valleyviewknolls,harmony7/Orchard,salarvand/orchard,jimasp/Orchard,abhishekluv/Orchard,neTp9c/Orchard,yersans/Orchard,Sylapse/Orchard.HttpAuthSample,RoyalVeterinaryCollege/Orchard,geertdoornbos/Orchard,gcsuk/Orchard,fassetar/Orchard,salarvand/Portal,planetClaire/Orchard-LETS,arminkarimi/Orchard,jagraz/Orchard,patricmutwiri/Orchard,angelapper/Orchard,brownjordaninternational/OrchardCMS,Anton-Am/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,ehe888/Orchard,LaserSrl/Orchard,MpDzik/Orchard,RoyalVeterinaryCollege/Orchard,JRKelso/Orchard,SzymonSel/Orchard,fassetar/Orchard,gcsuk/Orchard,bigfont/orchard-continuous-integration-demo,sfmskywalker/Orchard,MpDzik/Orchard,OrchardCMS/Orchard,jimasp/Orchard,omidnasri/Orchard,AdvantageCS/Orchard,abhishekluv/Orchard,Serlead/Orchard,OrchardCMS/Orchard-Harvest-Website,sfmskywalker/Orchard,ehe888/Orchard,hhland/Orchard,jaraco/orchard,huoxudong125/Orchard,Ermesx/Orchard,mvarblow/Orchard,bigfont/orchard-cms-modules-and-themes,IDeliverable/Orchard,dburriss/Orchard,Dolphinsimon/Orchard,TalaveraTechnologySolutions/Orchard,AndreVolksdorf/Orchard,bigfont/orchard-cms-modules-and-themes,dozoft/Orchard,rtpHarry/Orchard,dozoft/Orchard,oxwanawxo/Orchard,vairam-svs/Orchard,cryogen/orchard,openbizgit/Orchard,kouweizhong/Orchard,qt1/Orchard,Inner89/Orchard,TalaveraTechnologySolutions/Orchard,omidnasri/Orchard,TaiAivaras/Orchard,Lombiq/Orchard,asabbott/chicagodevnet-website,hannan-azam/Orchard,vard0/orchard.tan,jtkech/Orchard,JRKelso/Orchard,yonglehou/Orchard,neTp9c/Orchard,bigfont/orchard-cms-modules-and-themes,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,bigfont/orchard-continuous-integration-demo,LaserSrl/Orchard,NIKASoftwareDevs/Orchard,Lombiq/Orchard,jimasp/Orchard,jersiovic/Orchard,escofieldnaxos/Orchard,enspiral-dev-academy/Orchard,grapto/Orchard.CloudBust,enspiral-dev-academy/Orchard,TaiAivaras/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,austinsc/Orchard,Serlead/Orchard,infofromca/Orchard,cooclsee/Orchard,bedegaming-aleksej/Orchard,MpDzik/Orchard,jtkech/Orchard,dozoft/Orchard,johnnyqian/Orchard,aaronamm/Orchard,TaiAivaras/Orchard,cooclsee/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,mvarblow/Orchard,cryogen/orchard,JRKelso/Orchard,xiaobudian/Orchard,jtkech/Orchard,dcinzona/Orchard-Harvest-Website,m2cms/Orchard,bigfont/orchard-continuous-integration-demo,vard0/orchard.tan,yersans/Orchard,SeyDutch/Airbrush,MetSystem/Orchard,jerryshi2007/Orchard,LaserSrl/Orchard,ericschultz/outercurve-orchard,spraiin/Orchard,MpDzik/Orchard,Dolphinsimon/Orchard,geertdoornbos/Orchard,geertdoornbos/Orchard,jagraz/Orchard,mvarblow/Orchard,cryogen/orchard,gcsuk/Orchard,Lombiq/Orchard,jagraz/Orchard,Praggie/Orchard,andyshao/Orchard,emretiryaki/Orchard,salarvand/orchard,brownjordaninternational/OrchardCMS,LaserSrl/Orchard,smartnet-developers/Orchard,kouweizhong/Orchard,xkproject/Orchard,bedegaming-aleksej/Orchard,dozoft/Orchard,yonglehou/Orchard,emretiryaki/Orchard,grapto/Orchard.CloudBust,alejandroaldana/Orchard,yonglehou/Orchard,jchenga/Orchard,vairam-svs/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,TalaveraTechnologySolutions/Orchard,Ermesx/Orchard,jtkech/Orchard,sfmskywalker/Orchard,m2cms/Orchard,planetClaire/Orchard-LETS,infofromca/Orchard,Inner89/Orchard,arminkarimi/Orchard,Praggie/Orchard,emretiryaki/Orchard,ehe888/Orchard,DonnotRain/Orchard,RoyalVeterinaryCollege/Orchard,tobydodds/folklife,DonnotRain/Orchard,OrchardCMS/Orchard,luchaoshuai/Orchard,luchaoshuai/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,grapto/Orchard.CloudBust,stormleoxia/Orchard,jchenga/Orchard,bigfont/orchard-cms-modules-and-themes,sfmskywalker/Orchard,IDeliverable/Orchard,abhishekluv/Orchard,MetSystem/Orchard,TalaveraTechnologySolutions/Orchard,kouweizhong/Orchard,kgacova/Orchard,infofromca/Orchard,neTp9c/Orchard,hannan-azam/Orchard,AndreVolksdorf/Orchard,jersiovic/Orchard,austinsc/Orchard,huoxudong125/Orchard,hbulzy/Orchard,marcoaoteixeira/Orchard,dozoft/Orchard,yonglehou/Orchard,qt1/orchard4ibn,luchaoshuai/Orchard,omidnasri/Orchard,ehe888/Orchard,mgrowan/Orchard,Morgma/valleyviewknolls,stormleoxia/Orchard,SzymonSel/Orchard,NIKASoftwareDevs/Orchard,Anton-Am/Orchard,IDeliverable/Orchard,jchenga/Orchard,dburriss/Orchard,bedegaming-aleksej/Orchard,xkproject/Orchard,JRKelso/Orchard,KeithRaven/Orchard,harmony7/Orchard,rtpHarry/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,planetClaire/Orchard-LETS,austinsc/Orchard,SouleDesigns/SouleDesigns.Orchard,jtkech/Orchard,yonglehou/Orchard,mgrowan/Orchard,KeithRaven/Orchard,omidnasri/Orchard,li0803/Orchard,jimasp/Orchard,phillipsj/Orchard,stormleoxia/Orchard,marcoaoteixeira/Orchard,MpDzik/Orchard,kgacova/Orchard,DonnotRain/Orchard,jersiovic/Orchard,SzymonSel/Orchard,OrchardCMS/Orchard,DonnotRain/Orchard,m2cms/Orchard,spraiin/Orchard,qt1/orchard4ibn,Praggie/Orchard,Inner89/Orchard,SzymonSel/Orchard,sfmskywalker/Orchard,sebastienros/msc,neTp9c/Orchard,ericschultz/outercurve-orchard,jaraco/orchard,arminkarimi/Orchard,fortunearterial/Orchard,fortunearterial/Orchard,xiaobudian/Orchard,fassetar/Orchard,LaserSrl/Orchard,SouleDesigns/SouleDesigns.Orchard,salarvand/Portal,Codinlab/Orchard,mvarblow/Orchard,marcoaoteixeira/Orchard,dburriss/Orchard,Codinlab/Orchard,RoyalVeterinaryCollege/Orchard,vard0/orchard.tan,Serlead/Orchard,OrchardCMS/Orchard-Harvest-Website,li0803/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,TaiAivaras/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Cphusion/Orchard,infofromca/Orchard,oxwanawxo/Orchard,KeithRaven/Orchard,grapto/Orchard.CloudBust,Sylapse/Orchard.HttpAuthSample,salarvand/orchard,patricmutwiri/Orchard,sebastienros/msc,Lombiq/Orchard,phillipsj/Orchard,OrchardCMS/Orchard-Harvest-Website,harmony7/Orchard,jagraz/Orchard,xiaobudian/Orchard,arminkarimi/Orchard,neTp9c/Orchard,bigfont/orchard-cms-modules-and-themes,AEdmunds/beautiful-springtime,hhland/Orchard,dcinzona/Orchard-Harvest-Website,arminkarimi/Orchard,Anton-Am/Orchard,qt1/orchard4ibn,aaronamm/Orchard,Cphusion/Orchard,omidnasri/Orchard,Inner89/Orchard,bigfont/orchard-continuous-integration-demo,kgacova/Orchard,harmony7/Orchard,jersiovic/Orchard,johnnyqian/Orchard,austinsc/Orchard,fortunearterial/Orchard,geertdoornbos/Orchard,Ermesx/Orchard,mvarblow/Orchard,asabbott/chicagodevnet-website,grapto/Orchard.CloudBust,Dolphinsimon/Orchard,spraiin/Orchard,asabbott/chicagodevnet-website,OrchardCMS/Orchard-Harvest-Website,cooclsee/Orchard,jerryshi2007/Orchard,vairam-svs/Orchard,angelapper/Orchard,qt1/Orchard,stormleoxia/Orchard,hannan-azam/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,patricmutwiri/Orchard,Lombiq/Orchard,hannan-azam/Orchard,kouweizhong/Orchard,sebastienros/msc,vard0/orchard.tan,AndreVolksdorf/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,SeyDutch/Airbrush,Inner89/Orchard,TalaveraTechnologySolutions/Orchard,bedegaming-aleksej/Orchard,aaronamm/Orchard,sebastienros/msc,patricmutwiri/Orchard,enspiral-dev-academy/Orchard,AndreVolksdorf/Orchard,cooclsee/Orchard,dcinzona/Orchard-Harvest-Website,marcoaoteixeira/Orchard,jaraco/orchard,Ermesx/Orchard,caoxk/orchard,dburriss/Orchard,Cphusion/Orchard,tobydodds/folklife,alejandroaldana/Orchard,mgrowan/Orchard,MetSystem/Orchard,rtpHarry/Orchard,yersans/Orchard,cooclsee/Orchard,JRKelso/Orchard,dcinzona/Orchard,dcinzona/Orchard,m2cms/Orchard,qt1/orchard4ibn,AEdmunds/beautiful-springtime,enspiral-dev-academy/Orchard,li0803/Orchard,KeithRaven/Orchard,kgacova/Orchard,abhishekluv/Orchard,johnnyqian/Orchard,vard0/orchard.tan,Cphusion/Orchard,omidnasri/Orchard,Serlead/Orchard,huoxudong125/Orchard,xkproject/Orchard,jerryshi2007/Orchard,escofieldnaxos/Orchard,emretiryaki/Orchard,IDeliverable/Orchard,luchaoshuai/Orchard,Ermesx/Orchard,Sylapse/Orchard.HttpAuthSample,johnnyqian/Orchard,Dolphinsimon/Orchard,Morgma/valleyviewknolls,geertdoornbos/Orchard,jimasp/Orchard,yersans/Orchard,Fogolan/OrchardForWork,RoyalVeterinaryCollege/Orchard,dcinzona/Orchard,hbulzy/Orchard,huoxudong125/Orchard,TalaveraTechnologySolutions/Orchard,omidnasri/Orchard,OrchardCMS/Orchard-Harvest-Website,abhishekluv/Orchard,mgrowan/Orchard,hhland/Orchard,yersans/Orchard,xiaobudian/Orchard,austinsc/Orchard,mgrowan/Orchard,SeyDutch/Airbrush,oxwanawxo/Orchard,qt1/orchard4ibn,bedegaming-aleksej/Orchard,Anton-Am/Orchard,openbizgit/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,phillipsj/Orchard,DonnotRain/Orchard,qt1/Orchard,SeyDutch/Airbrush,tobydodds/folklife,smartnet-developers/Orchard,xiaobudian/Orchard,hbulzy/Orchard,ericschultz/outercurve-orchard,NIKASoftwareDevs/Orchard,AdvantageCS/Orchard,aaronamm/Orchard,OrchardCMS/Orchard,alejandroaldana/Orchard,Morgma/valleyviewknolls,dcinzona/Orchard,dcinzona/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Serlead/Orchard,TaiAivaras/Orchard,fortunearterial/Orchard,smartnet-developers/Orchard,phillipsj/Orchard,planetClaire/Orchard-LETS,patricmutwiri/Orchard,vairam-svs/Orchard,hhland/Orchard,andyshao/Orchard,cryogen/orchard,escofieldnaxos/Orchard,ericschultz/outercurve-orchard,gcsuk/Orchard,ehe888/Orchard,rtpHarry/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,AdvantageCS/Orchard,Praggie/Orchard,huoxudong125/Orchard,Fogolan/OrchardForWork,asabbott/chicagodevnet-website,jchenga/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,sfmskywalker/Orchard,hhland/Orchard,jerryshi2007/Orchard,dcinzona/Orchard-Harvest-Website,stormleoxia/Orchard,salarvand/Portal,MetSystem/Orchard,emretiryaki/Orchard,openbizgit/Orchard,armanforghani/Orchard,NIKASoftwareDevs/Orchard,salarvand/Portal,Codinlab/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,AEdmunds/beautiful-springtime,AdvantageCS/Orchard,m2cms/Orchard,oxwanawxo/Orchard,sfmskywalker/Orchard,Cphusion/Orchard,luchaoshuai/Orchard,AEdmunds/beautiful-springtime,caoxk/orchard,armanforghani/Orchard,Fogolan/OrchardForWork,infofromca/Orchard,salarvand/Portal,vairam-svs/Orchard,jagraz/Orchard,SouleDesigns/SouleDesigns.Orchard,fassetar/Orchard,IDeliverable/Orchard,brownjordaninternational/OrchardCMS,qt1/Orchard,MetSystem/Orchard,Dolphinsimon/Orchard,Praggie/Orchard,Morgma/valleyviewknolls,marcoaoteixeira/Orchard,alejandroaldana/Orchard,johnnyqian/Orchard,brownjordaninternational/OrchardCMS,KeithRaven/Orchard,armanforghani/Orchard,oxwanawxo/Orchard,grapto/Orchard.CloudBust,xkproject/Orchard,andyshao/Orchard,andyshao/Orchard,gcsuk/Orchard,omidnasri/Orchard,angelapper/Orchard,angelapper/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,aaronamm/Orchard,Fogolan/OrchardForWork,jaraco/orchard,kgacova/Orchard,tobydodds/folklife,TalaveraTechnologySolutions/Orchard,escofieldnaxos/Orchard,TalaveraTechnologySolutions/Orchard,smartnet-developers/Orchard,qt1/orchard4ibn,qt1/Orchard,jersiovic/Orchard,hbulzy/Orchard,dburriss/Orchard,dcinzona/Orchard-Harvest-Website,enspiral-dev-academy/Orchard,angelapper/Orchard,caoxk/orchard,openbizgit/Orchard,kouweizhong/Orchard,fassetar/Orchard,alejandroaldana/Orchard,spraiin/Orchard,li0803/Orchard,Sylapse/Orchard.HttpAuthSample,salarvand/orchard,smartnet-developers/Orchard,openbizgit/Orchard,omidnasri/Orchard,Codinlab/Orchard,AndreVolksdorf/Orchard,brownjordaninternational/OrchardCMS,xkproject/Orchard,jerryshi2007/Orchard,li0803/Orchard,Sylapse/Orchard.HttpAuthSample,armanforghani/Orchard,SeyDutch/Airbrush,SouleDesigns/SouleDesigns.Orchard,vard0/orchard.tan,Codinlab/Orchard,abhishekluv/Orchard,escofieldnaxos/Orchard,jchenga/Orchard,OrchardCMS/Orchard-Harvest-Website,hbulzy/Orchard,salarvand/orchard,caoxk/orchard,dcinzona/Orchard-Harvest-Website,tobydodds/folklife,harmony7/Orchard,NIKASoftwareDevs/Orchard,Fogolan/OrchardForWork | src/Orchard.Web/Modules/Orchard.Comments/Drivers/CommentsContainerPartDriver.cs | src/Orchard.Web/Modules/Orchard.Comments/Drivers/CommentsContainerPartDriver.cs | using JetBrains.Annotations;
using Orchard.Comments.Models;
using Orchard.Comments.Services;
using Orchard.ContentManagement.Drivers;
namespace Orchard.Comments.Drivers {
[UsedImplicitly]
public class CommentsContainerPartDriver : ContentPartDriver<CommentsContainerPart> {
private readonly ICommentService _commentService;
public CommentsContainerPartDriver(ICommentService commentService) {
_commentService = commentService;
}
protected override DriverResult Display(CommentsContainerPart part, string displayType, dynamic shapeHelper) {
var commentsForCommentedContent = _commentService.GetCommentsForCommentedContent(part.ContentItem.Id);
return Combined(
ContentShape("Parts_Comments_Count",
() => shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: commentsForCommentedContent.Count(), PendingCount: commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count())),
ContentShape("Parts_Comments_Count_SummaryAdmin",
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(ContentPart: part, CommentCount: commentsForCommentedContent.Count(), PendingCount: commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count()))
);
}
}
} | using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Orchard.Comments.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Models;
namespace Orchard.Comments.Drivers {
[UsedImplicitly]
public class CommentsContainerPartDriver : ContentPartDriver<CommentsContainerPart> {
protected override DriverResult Display(CommentsContainerPart part, string displayType, dynamic shapeHelper) {
return Combined(
ContentShape("Parts_Comments_Count",
() => {
var childItems = GetChildItems(part);
return shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: GetCount(childItems), PendingCount: GetPendingCount(childItems));
}),
ContentShape("Parts_Comments_Count_SummaryAdmin",
() => {
var childItems = GetChildItems(part);
return shapeHelper.Parts_Comments_Count_SummaryAdmin(ContentPart: part, CommentCount: GetCount(childItems), PendingCount: GetPendingCount(childItems));
})
);
}
private static IEnumerable<ContentItem> GetChildItems(CommentsContainerPart part) {
return part.ContentItem.ContentManager.Query()
.Where<CommonPartRecord>(rec => rec.Container == part.ContentItem.Record).List();
}
private static int GetPendingCount(IEnumerable<ContentItem> parts) {
return parts.Aggregate(0, (seed, item) => seed + (item.Has<CommentsPart>() ? item.As<CommentsPart>().PendingComments.Count : 0));
}
private static int GetCount(IEnumerable<ContentItem> parts) {
return parts.Aggregate(0, (seed, item) => seed + (item.Has<CommentsPart>() ? item.As<CommentsPart>().Comments.Count : 0));
}
}
} | bsd-3-clause | C# |
8241e30dae4b225547eab00c6ecd8abfe7b8522e | add task to interface | Appleseed/base,Appleseed/base | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/IAlert.cs | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/IAlert.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
interface IAlert
{
List<UserAlert> GetUserAlertSchedules(string scheudle);
RootSolrObject GetSearchAlertViaSolr(string query);
Task SendAlert(string email, string link, RootSolrObject results);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
interface IAlert
{
List<UserAlert> GetUserAlertSchedules(string scheudle);
RootSolrObject GetSearchAlertViaSolr(string query);
}
}
| apache-2.0 | C# |
b2b6520b4361e722ba4f2c11e579fb866e23da73 | bump to version 1.2 | Terradue/DotNetTep,Terradue/DotNetTep | Terradue.Tep/Properties/AssemblyInfo.cs | Terradue.Tep/Properties/AssemblyInfo.cs | /*!
\namespace Terradue.Tep
@{
Terradue.Tep Software Package provides with all the functionalities specific to the TEP.
\xrefitem sw_version "Versions" "Software Package Version" 1.2
\xrefitem sw_link "Links" "Software Package List" [Terradue.Tep](https://git.terradue.com/sugar/Terradue.Tep)
\xrefitem sw_license "License" "Software License" [AGPL](https://git.terradue.com/sugar/Terradue.Tep/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref ServiceStack
\xrefitem sw_req "Require" "Software Dependencies" \ref log4net
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Portal
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Authentication.Umsso
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Cloud
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Github
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Metadata.EarthObservation
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.News
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenNebula
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.GeoJson
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.RdfEO
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Tumblr
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Twitter
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Ogc.OwsContext
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.WebService.Model
\ingroup Tep
@}
*/
/*!
\defgroup Tep Tep Modules
@{
This is a super component that encloses all Thematic Exploitation Platform related functional components.
Their main functionnalities are targeted to enhance the basic \ref Core functionalities for the thematic usage of the plaform.
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.Tep")]
[assembly: AssemblyDescription("Terradue Tep .Net library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.Tep")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Enguerran Boissier")]
[assembly: AssemblyProjectUrl("https://git.terradue.com/sugar/Terradue.Tep")]
[assembly: AssemblyLicenseUrl("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2")]
[assembly: AssemblyInformationalVersion("1.2")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] | /*!
\namespace Terradue.Tep
@{
Terradue.Tep Software Package provides with all the functionalities specific to the TEP.
\xrefitem sw_version "Versions" "Software Package Version" 1.1
\xrefitem sw_link "Links" "Software Package List" [Terradue.Tep](https://git.terradue.com/sugar/Terradue.Tep)
\xrefitem sw_license "License" "Software License" [AGPL](https://git.terradue.com/sugar/Terradue.Tep/LICENSE)
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch
\xrefitem sw_req "Require" "Software Dependencies" \ref ServiceStack
\xrefitem sw_req "Require" "Software Dependencies" \ref log4net
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Portal
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Authentication.Umsso
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Cloud
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Github
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.Metadata.EarthObservation
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.News
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenNebula
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.GeoJson
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.RdfEO
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Tumblr
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.OpenSearch.Twitter
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Ogc.OwsContext
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication
\xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.WebService.Model
\ingroup Tep
@}
*/
/*!
\defgroup Tep Tep Modules
@{
This is a super component that encloses all Thematic Exploitation Platform related functional components.
Their main functionnalities are targeted to enhance the basic \ref Core functionalities for the thematic usage of the plaform.
@}
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using NuGet4Mono.Extensions;
[assembly: AssemblyTitle("Terradue.Tep")]
[assembly: AssemblyDescription("Terradue Tep .Net library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Terradue")]
[assembly: AssemblyProduct("Terradue.Tep")]
[assembly: AssemblyCopyright("Terradue")]
[assembly: AssemblyAuthors("Enguerran Boissier")]
[assembly: AssemblyProjectUrl("https://git.terradue.com/sugar/Terradue.Tep")]
[assembly: AssemblyLicenseUrl("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1")]
[assembly: AssemblyInformationalVersion("1.1")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] | agpl-3.0 | C# |
ff16f1b1e2c218f907473905b15eda8beceb35c7 | Make ILanguageService public. | tang7526/roslyn,AmadeusW/roslyn,KamalRathnayake/roslyn,MichalStrehovsky/roslyn,yetangye/roslyn,bartdesmet/roslyn,zmaruo/roslyn,panopticoncentral/roslyn,MavenRain/roslyn,xoofx/roslyn,mattscheffer/roslyn,taylorjonl/roslyn,tmeschter/roslyn,khyperia/roslyn,aelij/roslyn,vcsjones/roslyn,vslsnap/roslyn,jramsay/roslyn,akoeplinger/roslyn,jeffanders/roslyn,sharadagrawal/Roslyn,sharadagrawal/Roslyn,ljw1004/roslyn,AnthonyDGreen/roslyn,jbhensley/roslyn,stephentoub/roslyn,jhendrixMSFT/roslyn,pjmagee/roslyn,rchande/roslyn,khyperia/roslyn,droyad/roslyn,jcouv/roslyn,yetangye/roslyn,furesoft/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,magicbing/roslyn,GuilhermeSa/roslyn,grianggrai/roslyn,davkean/roslyn,nemec/roslyn,kienct89/roslyn,YOTOV-LIMITED/roslyn,KamalRathnayake/roslyn,krishnarajbb/roslyn,jroggeman/roslyn,bbarry/roslyn,AlexisArce/roslyn,oberxon/roslyn,mmitche/roslyn,OmniSharp/roslyn,thomaslevesque/roslyn,DanielRosenwasser/roslyn,furesoft/roslyn,jasonmalinowski/roslyn,yeaicc/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,VitalyTVA/roslyn,tsdl2013/roslyn,sharadagrawal/TestProject2,yjfxfjch/roslyn,ManishJayaswal/roslyn,tvand7093/roslyn,mgoertz-msft/roslyn,davkean/roslyn,pdelvo/roslyn,devharis/roslyn,VPashkov/roslyn,jcouv/roslyn,FICTURE7/roslyn,reaction1989/roslyn,antiufo/roslyn,genlu/roslyn,tmeschter/roslyn,Giten2004/roslyn,leppie/roslyn,mavasani/roslyn,jamesqo/roslyn,wvdd007/roslyn,huoxudong125/roslyn,TyOverby/roslyn,abock/roslyn,KirillOsenkov/roslyn,VShangxiao/roslyn,MattWindsor91/roslyn,tmeschter/roslyn,jhendrixMSFT/roslyn,v-codeel/roslyn,pjmagee/roslyn,VShangxiao/roslyn,huoxudong125/roslyn,ahmedshuhel/roslyn,jhendrixMSFT/roslyn,basoundr/roslyn,1234-/roslyn,yjfxfjch/roslyn,aelij/roslyn,Hosch250/roslyn,balajikris/roslyn,tannergooding/roslyn,JohnHamby/roslyn,hanu412/roslyn,garryforreg/roslyn,bkoelman/roslyn,dovzhikova/roslyn,ilyes14/roslyn,wvdd007/roslyn,CaptainHayashi/roslyn,3F/roslyn,garryforreg/roslyn,agocke/roslyn,YOTOV-LIMITED/roslyn,paulvanbrenk/roslyn,panopticoncentral/roslyn,AArnott/roslyn,davkean/roslyn,magicbing/roslyn,mgoertz-msft/roslyn,Hosch250/roslyn,vslsnap/roslyn,mattwar/roslyn,AlexisArce/roslyn,paladique/roslyn,vcsjones/roslyn,jeremymeng/roslyn,vslsnap/roslyn,srivatsn/roslyn,DavidKarlas/roslyn,KevinH-MS/roslyn,mavasani/roslyn,leppie/roslyn,amcasey/roslyn,KashishArora/Roslyn,jmarolf/roslyn,KevinH-MS/roslyn,AnthonyDGreen/roslyn,OmniSharp/roslyn,panopticoncentral/roslyn,AlekseyTs/roslyn,mseamari/Stuff,jeremymeng/roslyn,dsplaisted/roslyn,eriawan/roslyn,stjeong/roslyn,yeaicc/roslyn,bkoelman/roslyn,mattscheffer/roslyn,zooba/roslyn,mavasani/roslyn,moozzyk/roslyn,ericfe-ms/roslyn,enginekit/roslyn,nemec/roslyn,weltkante/roslyn,MattWindsor91/roslyn,mirhagk/roslyn,a-ctor/roslyn,poizan42/roslyn,kelltrick/roslyn,dpoeschl/roslyn,bkoelman/roslyn,CaptainHayashi/roslyn,ValentinRueda/roslyn,chenxizhang/roslyn,natgla/roslyn,Felorati/roslyn,tang7526/roslyn,REALTOBIZ/roslyn,diryboy/roslyn,mono/roslyn,chenxizhang/roslyn,MattWindsor91/roslyn,genlu/roslyn,jkotas/roslyn,jmarolf/roslyn,rgani/roslyn,balajikris/roslyn,xoofx/roslyn,jramsay/roslyn,jbhensley/roslyn,DanielRosenwasser/roslyn,stebet/roslyn,yetangye/roslyn,DinoV/roslyn,mono/roslyn,dotnet/roslyn,stebet/roslyn,AnthonyDGreen/roslyn,mattscheffer/roslyn,mirhagk/roslyn,bartdesmet/roslyn,VPashkov/roslyn,DavidKarlas/roslyn,MihaMarkic/roslyn-prank,drognanar/roslyn,yetangye/roslyn,jramsay/roslyn,dpoeschl/roslyn,KevinRansom/roslyn,poizan42/roslyn,orthoxerox/roslyn,lorcanmooney/roslyn,KevinRansom/roslyn,budcribar/roslyn,heejaechang/roslyn,ErikSchierboom/roslyn,agocke/roslyn,jmarolf/roslyn,wschae/roslyn,v-codeel/roslyn,physhi/roslyn,supriyantomaftuh/roslyn,mono/roslyn,Pvlerick/roslyn,yjfxfjch/roslyn,KashishArora/Roslyn,jamesqo/roslyn,marksantos/roslyn,dpoeschl/roslyn,rchande/roslyn,JakeGinnivan/roslyn,hanu412/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,paladique/roslyn,drognanar/roslyn,antonssonj/roslyn,DustinCampbell/roslyn,enginekit/roslyn,VSadov/roslyn,ManishJayaswal/roslyn,MatthieuMEZIL/roslyn,orthoxerox/roslyn,amcasey/roslyn,RipCurrent/roslyn,jrharmon/roslyn,TyOverby/roslyn,diryboy/roslyn,brettfo/roslyn,robinsedlaczek/roslyn,DinoV/roslyn,physhi/roslyn,MattWindsor91/roslyn,ValentinRueda/roslyn,ahmedshuhel/roslyn,agocke/roslyn,mmitche/roslyn,dovzhikova/roslyn,akoeplinger/roslyn,diryboy/roslyn,HellBrick/roslyn,supriyantomaftuh/roslyn,sharwell/roslyn,lorcanmooney/roslyn,mattwar/roslyn,evilc0des/roslyn,amcasey/roslyn,ericfe-ms/roslyn,AArnott/roslyn,zmaruo/roslyn,natgla/roslyn,gafter/roslyn,jgglg/roslyn,SeriaWei/roslyn,stjeong/roslyn,wvdd007/roslyn,nagyistoce/roslyn,russpowers/roslyn,cston/roslyn,sharadagrawal/TestProject2,GuilhermeSa/roslyn,OmniSharp/roslyn,HellBrick/roslyn,stephentoub/roslyn,moozzyk/roslyn,jroggeman/roslyn,FICTURE7/roslyn,VitalyTVA/roslyn,devharis/roslyn,Giten2004/roslyn,stephentoub/roslyn,nemec/roslyn,Pvlerick/roslyn,moozzyk/roslyn,dsplaisted/roslyn,tannergooding/roslyn,oberxon/roslyn,CyrusNajmabadi/roslyn,DustinCampbell/roslyn,hanu412/roslyn,jonatassaraiva/roslyn,rchande/roslyn,budcribar/roslyn,jamesqo/roslyn,managed-commons/roslyn,droyad/roslyn,antiufo/roslyn,tvand7093/roslyn,bbarry/roslyn,weltkante/roslyn,ljw1004/roslyn,danielcweber/roslyn,nagyistoce/roslyn,MichalStrehovsky/roslyn,KirillOsenkov/roslyn,VShangxiao/roslyn,DustinCampbell/roslyn,JakeGinnivan/roslyn,jaredpar/roslyn,oberxon/roslyn,wschae/roslyn,dotnet/roslyn,akrisiun/roslyn,bbarry/roslyn,jeremymeng/roslyn,natgla/roslyn,Inverness/roslyn,dsplaisted/roslyn,KiloBravoLima/roslyn,huoxudong125/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,RipCurrent/roslyn,tvand7093/roslyn,khellang/roslyn,MichalStrehovsky/roslyn,jaredpar/roslyn,cybernet14/roslyn,jonatassaraiva/roslyn,Shiney/roslyn,jroggeman/roslyn,pdelvo/roslyn,mirhagk/roslyn,Maxwe11/roslyn,aanshibudhiraja/Roslyn,wschae/roslyn,JohnHamby/roslyn,tmat/roslyn,jkotas/roslyn,kuhlenh/roslyn,BugraC/roslyn,ValentinRueda/roslyn,KashishArora/Roslyn,KiloBravoLima/roslyn,lisong521/roslyn,OmarTawfik/roslyn,grianggrai/roslyn,ljw1004/roslyn,MavenRain/roslyn,poizan42/roslyn,jasonmalinowski/roslyn,kelltrick/roslyn,taylorjonl/roslyn,nagyistoce/roslyn,michalhosala/roslyn,kienct89/roslyn,kelltrick/roslyn,paladique/roslyn,dpen2000/roslyn,swaroop-sridhar/roslyn,DinoV/roslyn,nguerrera/roslyn,zmaruo/roslyn,vcsjones/roslyn,dotnet/roslyn,russpowers/roslyn,jonatassaraiva/roslyn,natidea/roslyn,managed-commons/roslyn,danielcweber/roslyn,MatthieuMEZIL/roslyn,swaroop-sridhar/roslyn,dovzhikova/roslyn,JakeGinnivan/roslyn,MavenRain/roslyn,jgglg/roslyn,xasx/roslyn,jkotas/roslyn,gafter/roslyn,basoundr/roslyn,basoundr/roslyn,zooba/roslyn,brettfo/roslyn,krishnarajbb/roslyn,dpen2000/roslyn,tsdl2013/roslyn,mseamari/Stuff,EricArndt/roslyn,paulvanbrenk/roslyn,kienct89/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,lorcanmooney/roslyn,YOTOV-LIMITED/roslyn,yeaicc/roslyn,Giten2004/roslyn,VSadov/roslyn,SeriaWei/roslyn,stebet/roslyn,jeffanders/roslyn,furesoft/roslyn,Maxwe11/roslyn,pdelvo/roslyn,rgani/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,nguerrera/roslyn,AlekseyTs/roslyn,tang7526/roslyn,akrisiun/roslyn,aanshibudhiraja/Roslyn,drognanar/roslyn,oocx/roslyn,DanielRosenwasser/roslyn,jeffanders/roslyn,paulvanbrenk/roslyn,JohnHamby/roslyn,michalhosala/roslyn,doconnell565/roslyn,jasonmalinowski/roslyn,TyOverby/roslyn,antiufo/roslyn,KamalRathnayake/roslyn,DavidKarlas/roslyn,OmarTawfik/roslyn,balajikris/roslyn,Felorati/roslyn,droyad/roslyn,rgani/roslyn,oocx/roslyn,lisong521/roslyn,3F/roslyn,HellBrick/roslyn,Inverness/roslyn,a-ctor/roslyn,evilc0des/roslyn,eriawan/roslyn,RipCurrent/roslyn,SeriaWei/roslyn,xoofx/roslyn,grianggrai/roslyn,heejaechang/roslyn,cston/roslyn,jgglg/roslyn,krishnarajbb/roslyn,evilc0des/roslyn,robinsedlaczek/roslyn,khellang/roslyn,Pvlerick/roslyn,jcouv/roslyn,Giftednewt/roslyn,swaroop-sridhar/roslyn,srivatsn/roslyn,a-ctor/roslyn,JohnHamby/roslyn,EricArndt/roslyn,tsdl2013/roslyn,v-codeel/roslyn,taylorjonl/roslyn,oocx/roslyn,AArnott/roslyn,kuhlenh/roslyn,weltkante/roslyn,khellang/roslyn,AlekseyTs/roslyn,zooba/roslyn,doconnell565/roslyn,mseamari/Stuff,genlu/roslyn,1234-/roslyn,ericfe-ms/roslyn,Inverness/roslyn,OmarTawfik/roslyn,ilyes14/roslyn,FICTURE7/roslyn,thomaslevesque/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,eriawan/roslyn,sharwell/roslyn,enginekit/roslyn,garryforreg/roslyn,devharis/roslyn,magicbing/roslyn,1234-/roslyn,cston/roslyn,3F/roslyn,REALTOBIZ/roslyn,shyamnamboodiripad/roslyn,natidea/roslyn,KiloBravoLima/roslyn,robinsedlaczek/roslyn,Felorati/roslyn,leppie/roslyn,ManishJayaswal/roslyn,gafter/roslyn,sharadagrawal/Roslyn,KevinRansom/roslyn,srivatsn/roslyn,ilyes14/roslyn,doconnell565/roslyn,mmitche/roslyn,cybernet14/roslyn,jrharmon/roslyn,jrharmon/roslyn,michalhosala/roslyn,MatthieuMEZIL/roslyn,ErikSchierboom/roslyn,sharadagrawal/TestProject2,thomaslevesque/roslyn,BugraC/roslyn,supriyantomaftuh/roslyn,cybernet14/roslyn,REALTOBIZ/roslyn,VSadov/roslyn,danielcweber/roslyn,stjeong/roslyn,VitalyTVA/roslyn,tannergooding/roslyn,MihaMarkic/roslyn-prank,aanshibudhiraja/Roslyn,bartdesmet/roslyn,jaredpar/roslyn,KevinH-MS/roslyn,GuilhermeSa/roslyn,KirillOsenkov/roslyn,budcribar/roslyn,BugraC/roslyn,EricArndt/roslyn,akoeplinger/roslyn,heejaechang/roslyn,AlexisArce/roslyn,Shiney/roslyn,natidea/roslyn,lisong521/roslyn,russpowers/roslyn,ManishJayaswal/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,marksantos/roslyn,jbhensley/roslyn,pjmagee/roslyn,nguerrera/roslyn,managed-commons/roslyn,xasx/roslyn,abock/roslyn,VPashkov/roslyn,CaptainHayashi/roslyn,Shiney/roslyn,khyperia/roslyn,mattwar/roslyn,kuhlenh/roslyn,DavidKarlas/roslyn,reaction1989/roslyn,reaction1989/roslyn,akrisiun/roslyn,abock/roslyn,orthoxerox/roslyn,Hosch250/roslyn,Giftednewt/roslyn,brettfo/roslyn,tmat/roslyn,aelij/roslyn,MihaMarkic/roslyn-prank,Maxwe11/roslyn,marksantos/roslyn,antonssonj/roslyn,chenxizhang/roslyn,tmat/roslyn,Giftednewt/roslyn,antonssonj/roslyn,ahmedshuhel/roslyn,xasx/roslyn,dpen2000/roslyn | Src/Workspaces/Core/LanguageServices/ILanguageService.cs | Src/Workspaces/Core/LanguageServices/ILanguageService.cs | // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.LanguageServices
{
/// <summary>
/// Empty interface just to mark language services.
/// </summary>
public interface ILanguageService
{
}
} | // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.LanguageServices
{
/// <summary>
/// Empty interface just to mark language services.
/// </summary>
internal interface ILanguageService
{
}
} | mit | C# |
b8a23c0c8842f275873ce097289be94cf3eae055 | Fix last world problem | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Behaviors/MnemonicSuggestionBehavior.cs | WalletWasabi.Gui/Behaviors/MnemonicSuggestionBehavior.cs | using Avalonia;
using Avalonia.Controls;
using Avalonia.Xaml.Interactivity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using WalletWasabi.Gui.Tabs.WalletManager;
namespace WalletWasabi.Gui.Behaviors
{
internal class MnemonicSuggestionBehavior : Behavior<TextBox>
{
private CompositeDisposable _disposables;
private static readonly AvaloniaProperty<IEnumerable<MnemonicViewModel>> SuggestionItemsProperty =
AvaloniaProperty.Register<MnemonicSuggestionBehavior, IEnumerable<MnemonicViewModel>>(nameof(SuggestionItems), defaultBindingMode: Avalonia.Data.BindingMode.TwoWay);
public IEnumerable<MnemonicViewModel> SuggestionItems
{
get => GetValue(SuggestionItemsProperty);
set => SetValue(SuggestionItemsProperty, value);
}
protected override void OnAttached()
{
_disposables = new CompositeDisposable();
base.OnAttached();
_disposables.Add(AssociatedObject.AddHandler(TextBox.KeyDownEvent, (sender, e) =>
{
if (e.Key == Avalonia.Input.Key.Tab)
{
HandleAutoUpdate();
e.Handled = true;
}
}));
}
protected override void OnDetaching()
{
base.OnDetaching();
_disposables.Dispose();
}
private void HandleAutoUpdate()
{
SuggestionItems.FirstOrDefault()?.OnSelected();
}
}
} | using Avalonia;
using Avalonia.Controls;
using Avalonia.Xaml.Interactivity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using WalletWasabi.Gui.Tabs.WalletManager;
namespace WalletWasabi.Gui.Behaviors
{
internal class MnemonicSuggestionBehavior : Behavior<TextBox>
{
private CompositeDisposable _disposables;
private static readonly AvaloniaProperty<IEnumerable<MnemonicViewModel>> SuggestionItemsProperty =
AvaloniaProperty.Register<MnemonicSuggestionBehavior, IEnumerable<MnemonicViewModel>>(nameof(SuggestionItems), defaultBindingMode: Avalonia.Data.BindingMode.TwoWay);
public IEnumerable<MnemonicViewModel> SuggestionItems
{
get => GetValue(SuggestionItemsProperty);
set => SetValue(SuggestionItemsProperty, value);
}
protected override void OnAttached()
{
_disposables = new CompositeDisposable();
base.OnAttached();
_disposables.Add(AssociatedObject.AddHandler(TextBox.KeyDownEvent, (sender, e) =>
{
if (e.Key == Avalonia.Input.Key.Tab)
{
HandleAutoUpdate();
e.Handled = true;
}
}));
}
protected override void OnDetaching()
{
base.OnDetaching();
_disposables.Dispose();
}
private void HandleAutoUpdate()
{
var textBox = AssociatedObject;
var text = textBox.Text;
var enteredWordList = text.Split(' ', StringSplitOptions.RemoveEmptyEntries);
var lastWorld = enteredWordList.LastOrDefault();
var suggestions = SuggestionItems;
if(suggestions.Count() == 1)
{
suggestions.First().OnSelected();
}
}
}
} | mit | C# |
3416955d8975a91ff542c9894a0faf6f2ea18e9c | Add another test to Log4NetResourceDecoratorTest.cs | SimonAntony/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,ajaypradeep/google-api-dotnet-client,sawanmishra/google-api-dotnet-client,abujehad139/google-api-dotnet-client,olofd/google-api-dotnet-client,duckhamqng/google-api-dotnet-client,mjacobsen4DFM/google-api-dotnet-client,LPAMNijoel/google-api-dotnet-client,nicolasdavel/google-api-dotnet-client,jskeet/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,LPAMNijoel/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,ajmal744/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,maha-khedr/google-api-dotnet-client,bacm/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,peleyal/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,kelvinRosa/google-api-dotnet-client,sqt-android/google-api-dotnet-client,initaldk/google-api-dotnet-client,googleapis/google-api-dotnet-client,chenneo/google-api-dotnet-client,ssett/google-api-dotnet-client,peleyal/google-api-dotnet-client,lli-klick/google-api-dotnet-client,amnsinghl/google-api-dotnet-client,hurcane/google-api-dotnet-client,asifshaon/google-api-dotnet-client,aoisensi/google-api-dotnet-client,MyOwnClone/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,kekewong/google-api-dotnet-client,ephraimncory/google-api-dotnet-client,duongnhyt/google-api-dotnet-client,hoangduit/google-api-dotnet-client,chrisdunelm/google-api-dotnet-client,shumaojie/google-api-dotnet-client,neil-119/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,jtattermusch/google-api-dotnet-client,PiRSquared17/google-api-dotnet-client,jesusog/google-api-dotnet-client,eydjey/google-api-dotnet-client,karishmal/google-api-dotnet-client,hurcane/google-api-dotnet-client,googleapis/google-api-dotnet-client,shumaojie/google-api-dotnet-client,neil-119/google-api-dotnet-client,Senthilvera/google-api-dotnet-client,hivie7510/google-api-dotnet-client,rburgstaler/google-api-dotnet-client,inetdream/google-api-dotnet-client,initaldk/google-api-dotnet-client,line21c/google-api-dotnet-client,jskeet/google-api-dotnet-client,ErAmySharma/google-api-dotnet-client,milkmeat/google-api-dotnet-client,amitla/google-api-dotnet-client,kapil-chauhan-ngi/google-api-dotnet-client,initaldk/google-api-dotnet-client,jskeet/google-api-dotnet-client,duongnhyt/google-api-dotnet-client,DJJam/google-api-dotnet-client,cdanielm58/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,arjunRanosys/google-api-dotnet-client,smarly-net/google-api-dotnet-client,ivannaranjo/google-api-dotnet-client,aoisensi/google-api-dotnet-client,peleyal/google-api-dotnet-client,googleapis/google-api-dotnet-client,mylemans/google-api-dotnet-client,luantn2/google-api-dotnet-client,pgallastegui/google-api-dotnet-client,joesoc/google-api-dotnet-client,amit-learning/google-api-dotnet-client,liuqiaosz/google-api-dotnet-client,hurcane/google-api-dotnet-client,hurcane/google-api-dotnet-client,amitla/google-api-dotnet-client,RavindraPatidar/google-api-dotnet-client,eshivakant/google-api-dotnet-client,jtattermusch/google-api-dotnet-client,Duikmeester/google-api-dotnet-client,eshangin/google-api-dotnet-client,MesutGULECYUZ/google-api-dotnet-client | Src/GoogleApis.Tools.CodeGen.Tests/Decorator/ResourceDecorator/Log4NetResourceDecoratorTest.cs | Src/GoogleApis.Tools.CodeGen.Tests/Decorator/ResourceDecorator/Log4NetResourceDecoratorTest.cs | using System;
using System.CodeDom;
using log4net;
using NUnit.Framework;
using Google.Apis.Discovery;
using Google.Apis.Tools.CodeGen.Decorator.ResourceDecorator;
namespace Google.Apis.Tools.CodeGen.Tests.Decorator.ResourceDecorator
{
[TestFixture()]
public class Log4NetResourceDecoratorTest : BaseResourceDecoratorTest
{
[Test()]
public void TestDecorateClass ()
{
var resourceClass = CreateDecoratedResourceClass(new Log4NetResourceDecorator());
Assert.AreEqual(1, resourceClass.Members.Count); // Assert One Member was added
var declaration = resourceClass.Members[0];
Assert.IsNotNull(declaration);
Assert.IsInstanceOf(typeof(CodeMemberField), declaration);
var field = (CodeMemberField)declaration;
Assert.AreEqual(Log4NetResourceDecorator.LoggerName, field.Name);
Assert.AreEqual(typeof(ILog).FullName, field.Type.BaseType);
Assert.IsNotNull(field.InitExpression);
// Partial compile so don't treat warning as errors yet.
CheckCompile(resourceClass, false, "Failed To Compile after Log4NetResourceDecorator.DecorateClass");
}
[Test()]
public void TestDecorateMethodBeforeExecute()
{
var decorator = new Log4NetResourceDecorator();
var resourceClass = CreateDecoratedResourceClass(decorator);
var codeMember = new CodeMemberMethod();
codeMember.Name = "OneTestMethod";
resourceClass.Members.Add(codeMember);
Resource resource = CreateResource("TestResource", SimpleResource);
decorator.DecorateMethodBeforeExecute(
resource,
resource.Methods["simpleMethod"],
codeMember);
Assert.AreEqual(1, codeMember.Statements.Count);
var statment = codeMember.Statements[0];
Assert.IsInstanceOf(typeof(CodeExpressionStatement), statment);
CodeMethodInvokeExpression methodInvoke = (CodeMethodInvokeExpression)((CodeExpressionStatement)statment).Expression;
Assert.AreEqual(1, methodInvoke.Parameters.Count);
Assert.IsInstanceOf(typeof(CodePrimitiveExpression), methodInvoke.Parameters[0]);
Assert.AreEqual("Executing TestResource.simpleMethod", ((CodePrimitiveExpression)methodInvoke.Parameters[0]).Value);
CheckCompile(resourceClass, false, "Failed To Compile after Log4NetResourDecorator.DecorteMethodBeforeExecute");
}
[Test()]
public void TestDecorateMethodAfterExecute()
{
var decorator = new Log4NetResourceDecorator();
var resourceClass = CreateDecoratedResourceClass(decorator);
var codeMember = new CodeMemberMethod();
codeMember.Name = "OneTestMethod";
resourceClass.Members.Add(codeMember);
Resource resource = CreateResource("TestResource", SimpleResource);
decorator.DecorateMethodBeforeExecute(
resource,
resource.Methods["simpleMethod"],
codeMember);
decorator.DecorateMethodAfterExecute(
resource,
resource.Methods["simpleMethod"],
codeMember);
Assert.AreEqual(2, codeMember.Statements.Count);
var statment = codeMember.Statements[1];
Assert.IsInstanceOf(typeof(CodeExpressionStatement), statment);
CodeMethodInvokeExpression methodInvoke = (CodeMethodInvokeExpression)((CodeExpressionStatement)statment).Expression;
Assert.AreEqual(1, methodInvoke.Parameters.Count);
Assert.IsInstanceOf(typeof(CodePrimitiveExpression), methodInvoke.Parameters[0]);
Assert.AreEqual("Done Executing TestResource.simpleMethod", ((CodePrimitiveExpression)methodInvoke.Parameters[0]).Value);
CheckCompile(resourceClass, false, "Failed To Compile after Log4NetResourDecorator.DecorateMethodAfterExecute");
}
}
}
| using System;
using System.CodeDom;
using log4net;
using NUnit.Framework;
using Google.Apis.Discovery;
using Google.Apis.Tools.CodeGen.Decorator.ResourceDecorator;
namespace Google.Apis.Tools.CodeGen.Tests.Decorator.ResourceDecorator
{
[TestFixture()]
public class Log4NetResourceDecoratorTest : BaseResourceDecoratorTest
{
[Test()]
public void TestDecorateClass ()
{
var resourceClass = CreateDecoratedResourceClass(new Log4NetResourceDecorator());
Assert.AreEqual(1, resourceClass.Members.Count); // Assert One Member was added
var declaration = resourceClass.Members[0];
Assert.IsNotNull(declaration);
Assert.IsInstanceOf(typeof(CodeMemberField), declaration);
var field = (CodeMemberField)declaration;
Assert.AreEqual(Log4NetResourceDecorator.LoggerName, field.Name);
Assert.AreEqual(typeof(ILog).FullName, field.Type.BaseType);
Assert.IsNotNull(field.InitExpression);
// Partial compile so don't treat warning as errors yet.
CheckCompile(resourceClass, false, "Failed To Compile after Log4NetResourceDecorator.DecorateClass");
}
[Test()]
public void TestDecorateMethodBeforeExecute()
{
var decorator = new Log4NetResourceDecorator();
var resourceClass = CreateDecoratedResourceClass(decorator);
var codeMember = new CodeMemberMethod();
codeMember.Name = "OneTestMethod";
resourceClass.Members.Add(codeMember);
Resource resource = CreateResource("TestResource", SimpleResource);
decorator.DecorateMethodBeforeExecute(
resource,
resource.Methods["simpleMethod"],
codeMember);
Assert.AreEqual(1, codeMember.Statements.Count);
var statment = codeMember.Statements[0];
Assert.IsInstanceOf(typeof(CodeExpressionStatement), statment);
CodeMethodInvokeExpression methodInvoke = (CodeMethodInvokeExpression)((CodeExpressionStatement)statment).Expression;
Assert.AreEqual(1, methodInvoke.Parameters.Count);
Assert.IsInstanceOf(typeof(CodePrimitiveExpression), methodInvoke.Parameters[0]);
Assert.AreEqual("Executing TestResource.simpleMethod", ((CodePrimitiveExpression)methodInvoke.Parameters[0]).Value);
CheckCompile(resourceClass, false, "Failed To Compile after Log4NetResourDecorator.DecorteMethodBeforeExecute");
}
}
}
| apache-2.0 | C# |
52c25d5081232d7610d4ae38db2f1841e509e67a | Print all route information to debug stream (Visual Studio Output panel). | kobake/AspNetCore.RouteAnalyzer,kobake/AspNetCore.RouteAnalyzer,kobake/AspNetCore.RouteAnalyzer | AspNetCore.RouteAnalyzer.SampleWebProject/Startup.cs | AspNetCore.RouteAnalyzer.SampleWebProject/Startup.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics;
namespace AspNetCore.RouteAnalyzer.SampleWebProject
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
private IRouteAnalyzer m_routeAnalyzer;
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddRouteAnalyzer();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
IApplicationLifetime applicationLifetime,
IRouteAnalyzer routeAnalyzer
)
{
m_routeAnalyzer = routeAnalyzer;
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRouteAnalyzer("/routes");
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
// Lifetime events
applicationLifetime.ApplicationStarted.Register(OnStarted);
applicationLifetime.ApplicationStopping.Register(OnStopping);
applicationLifetime.ApplicationStopped.Register(OnStopped);
}
void OnStarted()
{
var infos = m_routeAnalyzer.GetAllRouteInformations();
Debug.WriteLine("======== ALL ROUTE INFORMATION ========");
foreach(var info in infos)
{
Debug.WriteLine(info.ToString());
}
Debug.WriteLine("");
Debug.WriteLine("");
}
void OnStopping()
{
}
void OnStopped()
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace AspNetCore.RouteAnalyzer.SampleWebProject
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddRouteAnalyzer();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRouteAnalyzer("/routes");
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
}
}
}
| mit | C# |
9b995196ca0b5e0ac203d809ce8b826ccdee67df | Add constructor to the winners repository. | LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform | src/CompetitionPlatform/Data/AzureRepositories/Users/ProjectWinnersRepository.cs | src/CompetitionPlatform/Data/AzureRepositories/Users/ProjectWinnersRepository.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Table;
using AzureStorage.Tables;
namespace CompetitionPlatform.Data.AzureRepositories.Users
{
public class WinnerEntity : TableEntity, IWinnerData
{
public static string GeneratePartitionKey(string projectId)
{
return projectId;
}
public static string GenerateRowKey(string userId)
{
return userId;
}
public static WinnerEntity Create(IWinnerData src)
{
var result = new WinnerEntity
{
PartitionKey = GeneratePartitionKey(src.ProjectId),
RowKey = GenerateRowKey(src.WinnerId),
FullName = src.FullName,
Place = src.Place,
Result = src.Result,
Votes = src.Votes,
Score = src.Score
};
return result;
}
public string ProjectId { get; set; }
public string WinnerId { get; set; }
public string FullName { get; set; }
public int Place { get; set; }
public string Result { get; set; }
public int Votes { get; set; }
public int Score { get; set; }
}
public class ProjectWinnersRepository : IProjectWinnersRepository
{
private readonly IAzureTableStorage<WinnerEntity> _winnersStorage;
public ProjectWinnersRepository(IAzureTableStorage<WinnerEntity> winnersStorage)
{
_winnersStorage = winnersStorage;
}
public async Task<IWinnerData> GetAsync(string projectId, string userId)
{
var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);
var rowKey = WinnerEntity.GenerateRowKey(userId);
return await _winnersStorage.GetDataAsync(partitionKey, rowKey);
}
public async Task<IEnumerable<IWinnerData>> GetWinnersAsync(string projectId)
{
var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);
return await _winnersStorage.GetDataAsync(partitionKey);
}
public async Task SaveAsync(IWinnerData winnerData)
{
var newEntity = WinnerEntity.Create(winnerData);
await _winnersStorage.InsertAsync(newEntity);
}
}
}
| using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Table;
using AzureStorage.Tables;
namespace CompetitionPlatform.Data.AzureRepositories.Users
{
public class WinnerEntity : TableEntity, IWinnerData
{
public static string GeneratePartitionKey(string projectId)
{
return projectId;
}
public static string GenerateRowKey(string userId)
{
return userId;
}
public static WinnerEntity Create(IWinnerData src)
{
var result = new WinnerEntity
{
PartitionKey = GeneratePartitionKey(src.ProjectId),
RowKey = GenerateRowKey(src.WinnerId),
FullName = src.FullName,
Place = src.Place,
Result = src.Result,
Votes = src.Votes,
Score = src.Score
};
return result;
}
public string ProjectId { get; set; }
public string WinnerId { get; set; }
public string FullName { get; set; }
public int Place { get; set; }
public string Result { get; set; }
public int Votes { get; set; }
public int Score { get; set; }
}
public class ProjectWinnersRepository : IProjectWinnersRepository
{
private readonly IAzureTableStorage<WinnerEntity> _winnersStorage;
public async Task<IWinnerData> GetAsync(string projectId, string userId)
{
var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);
var rowKey = WinnerEntity.GenerateRowKey(userId);
return await _winnersStorage.GetDataAsync(partitionKey, rowKey);
}
public async Task<IEnumerable<IWinnerData>> GetWinnersAsync(string projectId)
{
var partitionKey = WinnerEntity.GeneratePartitionKey(projectId);
return await _winnersStorage.GetDataAsync(partitionKey);
}
public async Task SaveAsync(IWinnerData winnerData)
{
var newEntity = WinnerEntity.Create(winnerData);
await _winnersStorage.InsertAsync(newEntity);
}
}
}
| mit | C# |
8c0b51ad33c7241e782fb78c1c78433e9ec63cdc | Refactor unittest. | mariotoffia/FluentDocker,mariotoffia/FluentDocker,mariotoffia/FluentDocker,mariotoffia/FluentDocker | Ductus.FluentDockerTest/FluentContainerBasicTests.cs | Ductus.FluentDockerTest/FluentContainerBasicTests.cs | using System.Linq;
using Ductus.FluentDocker.Builders;
using Ductus.FluentDocker.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Ductus.FluentDockerTest
{
[TestClass]
public class FluentContainerBasicTests
{
[TestMethod]
public void BuildContainerRenderServiceInStoppedMode()
{
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:latest")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.Build())
{
Assert.AreEqual(ServiceRunningState.Stopped, container.State);
}
}
[TestMethod]
public void BuildAndStartContainerWithKeepContainerWillLeaveContainerInArchve()
{
string id;
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:latest")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.KeepContainer()
.Build())
{
id = container.Id;
Assert.IsNotNull(id);
}
// We shall have the container as stopped by now.
var cont =
new Hosts()
.Discover()
.Select(host => host.GetContainers().FirstOrDefault(x => x.Id == id))
.FirstOrDefault(container => null != container);
Assert.IsNotNull(cont);
cont.Remove(true);
}
[TestMethod]
public void BuildAndStartContainerWithCustomEnvironmentWillBeReflectedInGetConfiguration()
{
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:latest")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.Build())
{
container.Start();
var config = container.GetConfiguration();
Assert.AreEqual(ServiceRunningState.Running, container.State);
Assert.IsTrue(config.Config.Env.Any(x => x == "POSTGRES_PASSWORD=mysecretpassword"));
}
}
}
} | using System.Linq;
using Ductus.FluentDocker.Builders;
using Ductus.FluentDocker.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Ductus.FluentDockerTest
{
[TestClass]
public class FluentContainerBasicTests
{
[TestMethod]
public void BuildContainerRenderServiceInStoppedMode()
{
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:latest")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.Build())
{
Assert.AreEqual(ServiceRunningState.Stopped, container.State);
}
}
[TestMethod]
public void BuildAndStartContainerWithKeepContainerWillLeaveContainerInArchve()
{
string id;
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:latest")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.KeepContainer()
.Build())
{
id = container.Id;
}
Assert.IsNotNull(id);
bool found = false;
foreach (var host in new Hosts().Discover())
{
var container = host.GetContainers().FirstOrDefault(x => x.Id == id);
if (null == container)
{
continue;
}
found = true;
container.Remove(true);
break;
}
Assert.IsTrue(found);
}
[TestMethod]
public void BuildAndStartContainerWithCustomEnvironmentWillBeReflectedInGetConfiguration()
{
using (
var container =
new Builder().UseContainer()
.UseImage("postgres:latest")
.WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
.Build())
{
container.Start();
var config = container.GetConfiguration();
Assert.AreEqual(ServiceRunningState.Running, container.State);
Assert.IsTrue(config.Config.Env.Any(x => x == "POSTGRES_PASSWORD=mysecretpassword"));
}
}
}
} | apache-2.0 | C# |
9f5fe025b8e000365d4291ec99b3931f35656041 | fix mock adapter | splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net | IPTables.Net.TestFramework/MockIpsetBinaryAdapter.cs | IPTables.Net.TestFramework/MockIpsetBinaryAdapter.cs | using IPTables.Net.Iptables.IpSet;
using IPTables.Net.Iptables.IpSet.Adapter;
namespace IPTables.Net.TestFramework
{
public class MockIpsetBinaryAdapter: IpSetBinaryAdapter
{
private IpSetSets _sets;
public MockIpsetBinaryAdapter(MockIpsetSystemFactory systemFactory, IpSetSets sets = null)
: base(systemFactory)
{
SetSets(sets);
}
public void SetSets(IpSetSets sets)
{
_sets = sets;
}
public override IpSetSets SaveSets(IpTablesSystem iptables, string setName = null)
{
return _sets;
}
}
}
| using IPTables.Net.Iptables.IpSet;
using IPTables.Net.Iptables.IpSet.Adapter;
namespace IPTables.Net.TestFramework
{
public class MockIpsetBinaryAdapter: IpSetBinaryAdapter
{
private IpSetSets _sets;
public MockIpsetBinaryAdapter(MockIpsetSystemFactory systemFactory, IpSetSets sets = null)
: base(systemFactory)
{
SetSets(sets);
}
public void SetSets(IpSetSets sets)
{
_sets = sets;
}
public override IpSetSets SaveSets(IpTablesSystem iptables)
{
return _sets;
}
}
}
| apache-2.0 | C# |
424de41e3e63277e6646f8a1cf2aa0202b8d2ad4 | create establishment | rcadaoas/NoVacancy | NoVacancy.API/Controllers/EstablishmentController.cs | NoVacancy.API/Controllers/EstablishmentController.cs | using Ninject;
using NoVacancy.BL.IRepository;
using NoVacancy.DTO.DataTransferObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace NoVacancy.API.Controllers
{
public class EstablishmentController : BaseController
{
public IEstablishment _IRepository;
public EstablishmentController(IEstablishment _IRepository)
{
this._IRepository = _IRepository;
}
/// <summary>
/// Create a new Establishment
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
[HttpPost]
public HttpResponseMessage Create([FromBody] DTOEstablishment data)
{
try
{
var result = new DTOEstablishment();
result = _IRepository.CreateEstablishment(data);
return Request.CreateResponse(HttpStatusCode.Created, data);
}
catch (Exception)
{
return Request.CreateResponse(HttpStatusCode.BadRequest,"Could not create establishment. Please report to issue.");
}
}
public Object Get()
{
return new { Results = 1 };
}
}
}
| using Ninject;
using NoVacancy.BL.IRepository;
using NoVacancy.DTO.DataTransferObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace NoVacancy.API.Controllers
{
public class EstablishmentController : BaseController
{
public IEstablishment _IRepository;
public EstablishmentController(IEstablishment _IRepository)
{
this._IRepository = _IRepository;
}
[HttpPost]
public DTOEstablishment Create(DTOEstablishment data)
{
var result = new DTOEstablishment();
result = _IRepository.CreateEstablishment(data);
return result;
}
}
}
| mit | C# |
6766bd20b315e5c2f0de82d681fbc48b64678483 | Add a not finished Milestone class | zindlsn/RosaroterTiger | RosaroterPanterWPF/RosaroterPanterWPF/DataService.cs | RosaroterPanterWPF/RosaroterPanterWPF/DataService.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RosaroterPanterWPF
{
public class Color
{
public byte R { get; set; }
public byte G { get; set; }
public byte B { get; set; }
public Color()
{
R = 0;
G = 0;
B = 0;
}
public Color(byte r, byte g, byte b)
{
R = r;
G = g;
B = b;
}
public static readonly Color White = new Color(255, 255, 255);
}
public class Task
{
public Color Color { get; set; }
public string Description { get; set; }
public bool Completed { get; private set; }
public string Name { get; set; }
public double TotalTime { get; private set; }
public Task(string name, string description, Color color)
{
Name = name;
Description = description;
Color = color;
}
public Task(string name, string description) : this(name, description, Color.White)
{ }
public Task(string name) : this(name, string.Empty, Color.White)
{ }
public Task() : this(string.Empty, string.Empty, Color.White)
{ }
void Complete(double time)
{
Completed = true;
TotalTime = time;
}
}
public class Milestone
{
public List<Task> Tasks { get; set; }
public bool Completed { get; private set; }
public Milestone(int number_of_tasks)
{
Completed = false;
Tasks = new List<Task>(number_of_tasks);
}
public Milestone() : this(0)
{ }
void AddTask(Task task)
{
Tasks.Add(task);
}
}
public class DataService
{
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RosaroterPanterWPF
{
public class Color
{
public byte R { get; set; }
public byte G { get; set; }
public byte B { get; set; }
public Color()
{
R = 0;
G = 0;
B = 0;
}
public Color(byte r, byte g, byte b)
{
R = r;
G = g;
B = b;
}
public static readonly Color White = new Color(255, 255, 255);
}
public class Task
{
public Color Color { get; set; }
public string Description { get; set; }
public bool Finished { get; private set; }
public string Name { get; set; }
public double TotalTime { get; private set; }
public Task(string name, string description, Color color)
{
Name = name;
Description = description;
Color = color;
}
public Task(string name, string description) : this(name, description, Color.White)
{ }
public Task(string name) : this(name, string.Empty, Color.White)
{ }
public Task() : this(string.Empty, string.Empty, Color.White)
{ }
void Completed(double time)
{
Finished = true;
TotalTime = time;
}
}
}
| mit | C# |
4116e13da118852da61c9273a85a3c7a83510689 | Use IReadOnlyDictionary<K, V>.TryGetValue as possible | y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter | ThScoreFileConverter/Models/Th15/PracticeReplacer.cs | ThScoreFileConverter/Models/Th15/PracticeReplacer.cs | //-----------------------------------------------------------------------
// <copyright file="PracticeReplacer.cs" company="None">
// Copyright (c) IIHOSHI Yoshinori.
// Licensed under the BSD-2-Clause license. See LICENSE.txt file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------
#pragma warning disable SA1600 // Elements should be documented
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace ThScoreFileConverter.Models.Th15
{
// %T15PRAC[x][yy][z]
internal class PracticeReplacer : IStringReplaceable
{
private static readonly string Pattern = Utils.Format(
@"%T15PRAC({0})({1})({2})",
Parsers.LevelParser.Pattern,
Parsers.CharaParser.Pattern,
Parsers.StageParser.Pattern);
private readonly MatchEvaluator evaluator;
public PracticeReplacer(IReadOnlyDictionary<CharaWithTotal, IClearData> clearDataDictionary)
{
if (clearDataDictionary is null)
throw new ArgumentNullException(nameof(clearDataDictionary));
this.evaluator = new MatchEvaluator(match =>
{
var level = Parsers.LevelParser.Parse(match.Groups[1].Value);
var chara = (CharaWithTotal)Parsers.CharaParser.Parse(match.Groups[2].Value);
var stage = Parsers.StageParser.Parse(match.Groups[3].Value);
if (level == Level.Extra)
return match.ToString();
if (stage == Stage.Extra)
return match.ToString();
var key = (level, (StagePractice)stage);
return Utils.ToNumberString(
clearDataDictionary.TryGetValue(chara, out var clearData)
&& clearData.Practices.TryGetValue(key, out var practice)
? (practice.Score * 10) : default);
});
}
public string Replace(string input)
{
return Regex.Replace(input, Pattern, this.evaluator, RegexOptions.IgnoreCase);
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="PracticeReplacer.cs" company="None">
// Copyright (c) IIHOSHI Yoshinori.
// Licensed under the BSD-2-Clause license. See LICENSE.txt file in the project root for full license information.
// </copyright>
//-----------------------------------------------------------------------
#pragma warning disable SA1600 // Elements should be documented
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace ThScoreFileConverter.Models.Th15
{
// %T15PRAC[x][yy][z]
internal class PracticeReplacer : IStringReplaceable
{
private static readonly string Pattern = Utils.Format(
@"%T15PRAC({0})({1})({2})",
Parsers.LevelParser.Pattern,
Parsers.CharaParser.Pattern,
Parsers.StageParser.Pattern);
private readonly MatchEvaluator evaluator;
public PracticeReplacer(IReadOnlyDictionary<CharaWithTotal, IClearData> clearDataDictionary)
{
if (clearDataDictionary is null)
throw new ArgumentNullException(nameof(clearDataDictionary));
this.evaluator = new MatchEvaluator(match =>
{
var level = Parsers.LevelParser.Parse(match.Groups[1].Value);
var chara = (CharaWithTotal)Parsers.CharaParser.Parse(match.Groups[2].Value);
var stage = Parsers.StageParser.Parse(match.Groups[3].Value);
if (level == Level.Extra)
return match.ToString();
if (stage == Stage.Extra)
return match.ToString();
if (clearDataDictionary.ContainsKey(chara))
{
var key = (level, (StagePractice)stage);
var practices = clearDataDictionary[chara].Practices;
return Utils.ToNumberString(practices.ContainsKey(key) ? (practices[key].Score * 10) : default);
}
else
{
return Utils.ToNumberString(default(uint));
}
});
}
public string Replace(string input)
{
return Regex.Replace(input, Pattern, this.evaluator, RegexOptions.IgnoreCase);
}
}
}
| bsd-2-clause | C# |
e0199ce1db34fe46ec55bf24f760b565a6efb161 | fix readd command in message store. | IvanZheng/IFramework,IvanZheng/IFramework,IvanZheng/IFramework | Src/iFramework.Plugins/iFramework.Infrastructure.EntityFramework/MessageStoring/MessageStore.cs | Src/iFramework.Plugins/iFramework.Infrastructure.EntityFramework/MessageStoring/MessageStore.cs | using IFramework.Message;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using IFramework.Infrastructure;
namespace IFramework.EntityFramework
{
public class MessageStore : DbContext, IMessageStore
{
public DbSet<Command> Commands { get; set; }
public DbSet<DomainEvent> DomainEvents { get; set; }
public MessageStore()
: base("MessageStore")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Message>()
.Map<Command>(map => {
map.ToTable("Commands");
map.MapInheritedProperties();
})
.Map<DomainEvent>(map => {
map.ToTable("DomainEvents");
map.MapInheritedProperties();
});
}
public void Save(IMessageContext commandContext, string domainEventID)
{
try
{
var command = new Command(commandContext, domainEventID);
Commands.Add(command);
SaveChanges();
}
catch(Exception)
{
}
}
public void Save(IMessageContext commandContext, IEnumerable<IMessageContext> domainEventContexts)
{
try
{
var command = Commands.Find(commandContext.MessageID);
if (command == null)
{
command = new Command(commandContext);
Commands.Add(command);
}
}
catch(Exception)
{
// command may be readd!
}
domainEventContexts.ForEach(domainEventContext => {
var domainEvent = new DomainEvent(domainEventContext, commandContext.MessageID);
DomainEvents.Add(domainEvent);
});
SaveChanges();
}
}
}
| using IFramework.Message;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using IFramework.Infrastructure;
namespace IFramework.EntityFramework
{
public class MessageStore : DbContext, IMessageStore
{
public DbSet<Command> Commands { get; set; }
public DbSet<DomainEvent> DomainEvents { get; set; }
public MessageStore()
: base("MessageStore")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Message>()
.Map<Command>(map => {
map.ToTable("Commands");
map.MapInheritedProperties();
})
.Map<DomainEvent>(map => {
map.ToTable("DomainEvents");
map.MapInheritedProperties();
});
}
public void Save(IMessageContext commandContext, string domainEventID)
{
var command = new Command(commandContext, domainEventID);
Commands.Add(command);
SaveChanges();
}
public void Save(IMessageContext commandContext, IEnumerable<IMessageContext> domainEventContexts)
{
var command = Commands.Find(commandContext.MessageID);
if (command == null)
{
command = new Command(commandContext);
Commands.Add(command);
}
domainEventContexts.ForEach(domainEventContext => {
var domainEvent = new DomainEvent(domainEventContext, command.ID);
DomainEvents.Add(domainEvent);
});
SaveChanges();
}
}
}
| mit | C# |
cb362932f8f3c84028b0b150e2b1f83ba98cfb52 | Remove duplicate lines | gep13/GitVersion,asbjornu/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,gep13/GitVersion,GitTools/GitVersion | docs/input/docs/learn/branching-strategies/index.cshtml | docs/input/docs/learn/branching-strategies/index.cshtml | ---
Order: 4000
Title: Branching Strategies
Description: Information about the different branching strategies supported by GitVersion
RedirectFrom:
- docs/git-branching-strategies/overview
- docs/git-branching-strategies
- docs/examples
---
<img src="/docs/img/CommitGraph.png" alt="Commit graph">
<p>
At each commit sha GitVersion will calculate:
</p>
<pre><code class="language-shell">e137e9 -> 1.0.0+0
a5f6c5 -> 1.0.1+1
adb29a -> 1.0.1-feature-foo.1+1 (PR #5 Version: `1.0.1-PullRequest.5+2`)
7c2438 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`)
5f413b -> 1.0.1+4
d6155b -> 2.0.0-rc.1+0 (Before and after tag)
d53ab6 -> 2.0.0-rc.2+1 (Pre-release number was bumped because of the tag on previous commit)
b5d142 -> 2.0.0+0 (2.0.0 branch was merged, so main is now at 2.0.0)
</code></pre>
<p>
This is just a small sample of the way GitVersion works. The idea is you
just plug it in and you will get sensible version numbers by default. We
support the following branch types out of the box:
</p>
<ul>
<li><code>main</code></li>
<li><code>develop</code></li>
<li><code>hotfix/</code></li>
<li><code>feature/</code></li>
<li><code>support/</code></li>
<li><code>release/</code></li>
<li>pull requests (stash, github and a few others)</li>
</ul>
<p>
If you have other branch types GitVersion is entirely configuration driven,
so check out the <a href="/docs/reference/configuration">configuration</a>
section to make GitVersion work for you.
</p>
@Html.Partial("_ChildPages")
| ---
Order: 4000
Title: Branching Strategies
Description: Information about the different branching strategies supported by GitVersion
RedirectFrom:
- docs/git-branching-strategies/overview
- docs/git-branching-strategies
- docs/examples
---
<img src="/docs/img/CommitGraph.png" alt="Commit graph">
<p>
At each commit sha GitVersion will calculate:
</p>
<pre><code class="language-shell">e137e9 -> 1.0.0+0
a5f6c5 -> 1.0.1+1
adb29a -> 1.0.1-feature-foo.1+1 (PR #5 Version: `1.0.1-PullRequest.5+2`)
7c2438 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`)
5f413b -> 1.0.1+4
d6155b -> 2.0.0-rc.1+0 (Before and after tag)
d53ab6 -> 2.0.0-rc.2+1 (Pre-release number was bumped because of the tag on previous commit)
b5d142 -> 2.0.0+0 (2.0.0 branch was merged, so main is now at 2.0.0)
</code></pre>
<p>
This is just a small sample of the way GitVersion works. The idea is you
just plug it in and you will get sensible version numbers by default. We
support the following branch types out of the box:
</p>
<ul>
<li><code>main</code></li>
<li><code>develop</code></li>
<li><code>hotfix/</code></li>
<li><code>feature/</code></li>
<li><code>support/</code></li>
<li><code>release/</code></li>
<li>pull requests (stash, github and a few others)</li>
<li><code>main</code></li>
<li><code>main</code></li>
<li><code>main</code></li>
</ul>
<p>
If you have other branch types GitVersion is entirely configuration driven,
so check out the <a href="/docs/reference/configuration">configuration</a>
section to make GitVersion work for you.
</p>
@Html.Partial("_ChildPages")
| mit | C# |
fd1a66264c23580e2207dd2f402b09bf217b1855 | allow :new(string) | Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen | Dashen/ComponentName.cs | Dashen/ComponentName.cs | using System;
namespace Dashen
{
public class ComponentName
{
private readonly string _name;
public ComponentName(string name)
{
_name = name;
}
public ComponentName(object component)
:this(component.GetType().Name)
{
}
public override int GetHashCode()
{
return _name.GetHashCode();
}
public override bool Equals(object obj)
{
var other = obj as ComponentName;
if (other == null)
{
return false;
}
return string.Equals(_name, other._name, StringComparison.OrdinalIgnoreCase);
}
public override string ToString()
{
return _name;
}
public static ComponentName From(string name)
{
return new ComponentName(name);
}
}
}
| using System;
namespace Dashen
{
public class ComponentName
{
private readonly string _name;
private ComponentName(string name)
{
_name = name;
}
public ComponentName(object component)
:this(component.GetType().Name)
{
}
public override int GetHashCode()
{
return _name.GetHashCode();
}
public override bool Equals(object obj)
{
var other = obj as ComponentName;
if (other == null)
{
return false;
}
return string.Equals(_name, other._name, StringComparison.OrdinalIgnoreCase);
}
public override string ToString()
{
return _name;
}
public static ComponentName From(string name)
{
return new ComponentName(name);
}
}
}
| lgpl-2.1 | C# |
be6c32d4fc24332c0222eca32c835b6385ba695c | add exception handling | MistyKuu/bitbucket-for-visual-studio,MistyKuu/bitbucket-for-visual-studio | Source/GitClientVS.Infrastructure/Utils/ExceptionMapper.cs | Source/GitClientVS.Infrastructure/Utils/ExceptionMapper.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitBucket.REST.API.Exceptions;
namespace GitClientVS.Infrastructure.Utils
{
public static class ExceptionMapper
{
public static string Map(Exception ex)
{
if (ex is AuthorizationException)
return "Incorrect credentials";
if (ex is ForbiddenException)
return "Operation is Forbidden";
if (ex is RequestFailedException)
{
var failedEx = ((RequestFailedException)ex);
return failedEx.IsFriendlyMessage ? ex.Message : "Wrong request";
}
if (ex is UnauthorizedAccessException)
return "Unauthorized";
return $"Unknown error ({ex.GetType()}). Check logs for more info";
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitBucket.REST.API.Exceptions;
namespace GitClientVS.Infrastructure.Utils
{
public static class ExceptionMapper
{
public static string Map(Exception ex)
{
if (ex is AuthorizationException)
return "Incorrect credentials";
if (ex is ForbiddenException)
return "Insufficient privileges";
if (ex is RequestFailedException)
{
var failedEx = ((RequestFailedException)ex);
return failedEx.IsFriendlyMessage ? ex.Message : "Wrong request";
}
return "Unknown error";
}
}
}
| mit | C# |
58d7e4197809c986c62389e52b90e3465bf8b225 | Enable nullable on ImportTask | smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,ppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu | osu.Game/Database/ImportTask.cs | osu.Game/Database/ImportTask.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System.IO;
using osu.Game.IO.Archives;
using osu.Game.Utils;
using SharpCompress.Common;
namespace osu.Game.Database
{
/// <summary>
/// An encapsulated import task to be imported to an <see cref="ArchiveModelManager{TModel,TFileModel}"/>.
/// </summary>
public class ImportTask
{
/// <summary>
/// The path to the file (or filename in the case a stream is provided).
/// </summary>
public string Path { get; }
/// <summary>
/// An optional stream which provides the file content.
/// </summary>
public Stream? Stream { get; }
/// <summary>
/// Construct a new import task from a path (on a local filesystem).
/// </summary>
public ImportTask(string path)
{
Path = path;
}
/// <summary>
/// Construct a new import task from a stream.
/// </summary>
public ImportTask(Stream stream, string filename)
{
Path = filename;
Stream = stream;
}
/// <summary>
/// Retrieve an archive reader from this task.
/// </summary>
public ArchiveReader GetReader()
{
if (Stream != null)
return new ZipArchiveReader(Stream, Path);
return getReaderFrom(Path);
}
/// <summary>
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
/// </summary>
/// <param name="path">A file or folder path resolving the archive content.</param>
/// <returns>A reader giving access to the archive's content.</returns>
private ArchiveReader getReaderFrom(string path)
{
if (ZipUtils.IsZipArchive(path))
return new ZipArchiveReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read), System.IO.Path.GetFileName(path));
if (Directory.Exists(path))
return new LegacyDirectoryArchiveReader(path);
if (File.Exists(path))
return new LegacyFileArchiveReader(path);
throw new InvalidFormatException($"{path} is not a valid archive");
}
public override string ToString() => System.IO.Path.GetFileName(Path);
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.IO;
using osu.Game.IO.Archives;
using osu.Game.Utils;
using SharpCompress.Common;
namespace osu.Game.Database
{
/// <summary>
/// An encapsulated import task to be imported to an <see cref="ArchiveModelManager{TModel,TFileModel}"/>.
/// </summary>
public class ImportTask
{
/// <summary>
/// The path to the file (or filename in the case a stream is provided).
/// </summary>
public string Path { get; }
/// <summary>
/// An optional stream which provides the file content.
/// </summary>
public Stream Stream { get; }
/// <summary>
/// Construct a new import task from a path (on a local filesystem).
/// </summary>
public ImportTask(string path)
{
Path = path;
}
/// <summary>
/// Construct a new import task from a stream.
/// </summary>
public ImportTask(Stream stream, string filename)
{
Path = filename;
Stream = stream;
}
/// <summary>
/// Retrieve an archive reader from this task.
/// </summary>
public ArchiveReader GetReader()
{
if (Stream != null)
return new ZipArchiveReader(Stream, Path);
return getReaderFrom(Path);
}
/// <summary>
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
/// </summary>
/// <param name="path">A file or folder path resolving the archive content.</param>
/// <returns>A reader giving access to the archive's content.</returns>
private ArchiveReader getReaderFrom(string path)
{
if (ZipUtils.IsZipArchive(path))
return new ZipArchiveReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read), System.IO.Path.GetFileName(path));
if (Directory.Exists(path))
return new LegacyDirectoryArchiveReader(path);
if (File.Exists(path))
return new LegacyFileArchiveReader(path);
throw new InvalidFormatException($"{path} is not a valid archive");
}
public override string ToString() => System.IO.Path.GetFileName(Path);
}
}
| mit | C# |
0484fe8e9d16a8f97c1e79335c4b30f55194ea3c | Change token explanation (#1331) | RogueException/Discord.Net,AntiTcb/Discord.Net | docs/guides/getting_started/samples/first-bot/client.cs | docs/guides/getting_started/samples/first-bot/client.cs | private DiscordSocketClient _client;
public async Task MainAsync()
{
_client = new DiscordSocketClient();
_client.Log += Log;
// You can assign your bot token to a string, and pass that in to connect.
// This however is insecure, particularly if you plan to have your code hosted in a repository.
var token = "token";
// Some alternative options would be to keep your token in an Environment Variable or a standalone file.
// var token = Environment.GetEnvironmentVariable("NameOfYourEnvironmentVariable");
// var token = File.ReadAllText("token.txt");
// var token = JsonConvert.DeserializeObject<AConfigurationClass>(File.ReadAllText("config.json")).Token;
await _client.LoginAsync(TokenType.Bot, token);
await _client.StartAsync();
// Block this task until the program is closed.
await Task.Delay(-1);
}
| private DiscordSocketClient _client;
public async Task MainAsync()
{
_client = new DiscordSocketClient();
_client.Log += Log;
// Remember to keep token private or to read it from an
// external source! In this case, we are reading the token
// from an environment variable. If you do not know how to set-up
// environment variables, you may find more information on the
// Internet or by using other methods such as reading from
// a configuration.
await _client.LoginAsync(TokenType.Bot,
Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();
// Block this task until the program is closed.
await Task.Delay(-1);
} | mit | C# |
07acfd85ba41a3f5e6b85ac2bba9a34a7609e313 | remove unused parameter | qianlifeng/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,Wox-launcher/Wox | Wox.Infrastructure/Constant.cs | Wox.Infrastructure/Constant.cs | using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using JetBrains.Annotations;
namespace Wox.Infrastructure
{
public static class Constant
{
public const string Wox = "Wox";
public const string Plugins = "Plugins";
private static Assembly Assembly;
public static string ProgramDirectory;
public static string ExecutablePath;
public static string ApplicationDirectory;
public static string RootDirectory;
public static string PreinstalledDirectory;
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
public static string Version;
public static readonly int ThumbnailSize = 64;
public static string ImagesDirectory;
public static string DefaultIcon;
public static string ErrorIcon;
public static string PythonPath;
public static string EverythingSDKPath;
public static void Initialize()
{
Assembly = Assembly.GetExecutingAssembly();
Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
ImagesDirectory = Path.Combine(ProgramDirectory, "Images");
PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
}
}
}
| using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using JetBrains.Annotations;
namespace Wox.Infrastructure
{
public static class Constant
{
public const string Wox = "Wox";
public const string Plugins = "Plugins";
private static Assembly Assembly;
public static string ProgramDirectory;
public static string ExecutablePath;
public static string ApplicationDirectory;
public static string RootDirectory;
public static string PreinstalledDirectory;
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
public static string Version;
public static readonly int ThumbnailSize = 64;
public static string ImagesDirectory;
public static string DefaultIcon;
public static string ErrorIcon;
public static string PythonPath;
public static string EverythingSDKPath;
public static void Initialize(string workingDirectory = "")
{
Assembly = Assembly.GetExecutingAssembly();
Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
if (String.IsNullOrEmpty(workingDirectory))
{
ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
}
else
{
ProgramDirectory = workingDirectory;
}
ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
ImagesDirectory = Path.Combine(ProgramDirectory, "Images");
PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
}
}
}
| mit | C# |
f2a311735f883560b1699893b88b59361948b8e3 | Change company name - | cankoluman/Archetype-Serializer,cankoluman/Archetype-Serializer | ReferenceCms/7.1.4/Properties/AssemblyInfo.cs | ReferenceCms/7.1.4/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("_7._1._4.Properties")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Can Koluman")]
[assembly: AssemblyProduct("_7._1._4.Properties")]
[assembly: AssemblyCopyright("Copyright © Can Koluman 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b680bb3e-af6d-4f8f-9756-f46fd5efcce0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("_7._1._4.Properties")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("_7._1._4.Properties")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b680bb3e-af6d-4f8f-9756-f46fd5efcce0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
88b35751381d36d95ebe320e923be4f6169be780 | Remove unnecessary async/await from authentication filter. #12 | serilog-web/classic-webapi | src/SerilogWeb.Classic.WebApi/Classic/WebApi/StoreWebApInfoInHttpContextAuthenticationFilter.cs | src/SerilogWeb.Classic.WebApi/Classic/WebApi/StoreWebApInfoInHttpContextAuthenticationFilter.cs | using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace SerilogWeb.Classic.WebApi
{
internal class StoreWebApInfoInHttpContextAuthenticationFilter : IAuthenticationFilter
{
public bool AllowMultiple => false;
public Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken)
{
context.ActionContext.StoreWebApInfoInHttpContext();
return Task.FromResult(0);
}
public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken)
{
return Task.FromResult(0);
}
}
} | using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace SerilogWeb.Classic.WebApi
{
internal class StoreWebApInfoInHttpContextAuthenticationFilter : IAuthenticationFilter
{
public bool AllowMultiple => false;
public async Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken)
{
context.ActionContext.StoreWebApInfoInHttpContext();
await Task.FromResult(0);
}
public async Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken)
{
await Task.FromResult(0);
}
}
} | apache-2.0 | C# |
e429aa0157eb860ff02e528dad8e202e479fed7d | make error response fields readonly | sailthru/sailthru-net-client | Sailthru/Sailthru.Tests/Mock/ErrorResponse.cs | Sailthru/Sailthru.Tests/Mock/ErrorResponse.cs | using Newtonsoft.Json;
namespace Sailthru.Tests.Mock
{
public class ErrorResponse
{
[JsonProperty]
private readonly int error;
[JsonProperty]
private readonly string errormsg;
public ErrorResponse(int error, string errormsg)
{
this.error = error;
this.errormsg = errormsg;
}
}
} | using Newtonsoft.Json;
namespace Sailthru.Tests.Mock
{
public class ErrorResponse
{
[JsonProperty]
private int error;
[JsonProperty]
private string errormsg;
public ErrorResponse(int error, string errormsg)
{
this.error = error;
this.errormsg = errormsg;
}
}
} | mit | C# |
52b9a3f5e9a0096ff5529a223a317b8b489977ec | Remove unused using | EVAST9919/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,peppy/osu,ppy/osu,EVAST9919/osu,ZLima12/osu,peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,johnneijzen/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,2yangk23/osu,peppy/osu-new,ZLima12/osu,johnneijzen/osu | osu.Game/Rulesets/Mods/ModSuddenDeath.cs | osu.Game/Rulesets/Mods/ModSuddenDeath.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor, IApplicableRestartOnFail
{
public override string Name => "Sudden Death";
public override string ShortenedName => "SD";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Miss and fail.";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
public bool AllowRestart => true;
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
scoreProcessor.FailConditions += FailCondition;
}
protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0;
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Scoring;
using osu.Framework.Configuration;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModSuddenDeath : Mod, IApplicableToScoreProcessor, IApplicableRestartOnFail
{
public override string Name => "Sudden Death";
public override string ShortenedName => "SD";
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Miss and fail.";
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
public bool AllowRestart => true;
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
scoreProcessor.FailConditions += FailCondition;
}
protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0;
}
}
| mit | C# |
7596208a4ed6b9300cef306bc87aa1d8587e2847 | Bump Common Version (SMDH Changes) | usagirei/3DS-Theme-Editor | ThemeEditor.Common/Properties/AssemblyInfo.cs | ThemeEditor.Common/Properties/AssemblyInfo.cs | // --------------------------------------------------
// ThemeEditor.Common - 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("ThemeEditor.Common")]
[assembly: AssemblyDescription("Theme Editor Core Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Usagirei")]
[assembly: AssemblyProduct("ThemeEditor.Common")]
[assembly: AssemblyCopyright("Copyright © Usagirei 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("1be625e8-f696-4dcb-858a-a6f66ea3bace")]
// 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.7.0")]
[assembly: AssemblyFileVersion("1.0.7.1")]
| // --------------------------------------------------
// ThemeEditor.Common - 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("ThemeEditor.Common")]
[assembly: AssemblyDescription("Theme Editor Core Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Usagirei")]
[assembly: AssemblyProduct("ThemeEditor.Common")]
[assembly: AssemblyCopyright("Copyright © Usagirei 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("1be625e8-f696-4dcb-858a-a6f66ea3bace")]
// 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.1.0")]
[assembly: AssemblyFileVersion("1.0.7.1")]
| mit | C# |
c9ce7296093c72d9e487da89d86919433658b324 | Update AssemblyInfo.cs | lust4life/WebApiProxy,faniereynders/WebApiProxy | WebApiProxy.Server/Properties/AssemblyInfo.cs | WebApiProxy.Server/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("WebApi Proxy Provider")]
[assembly: AssemblyDescription("Provides an endpoint for ASP.NET Web Api services to serve a JavaScript proxy and metadata")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WebApiProxy")]
[assembly: AssemblyCopyright("Copyright © 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("bc78cf80-1cf9-46e7-abdd-88e9c49d656c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyInformationalVersion("1.2.0.*")]
[assembly: AssemblyVersion("1.2.1.*")]
| 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("WebApi Proxy Provider")]
[assembly: AssemblyDescription("Provides an endpoint for ASP.NET Web Api services to serve a JavaScript proxy and metadata")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WebApiProxy")]
[assembly: AssemblyCopyright("Copyright © 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("bc78cf80-1cf9-46e7-abdd-88e9c49d656c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyInformationalVersion("1.2.0.*")]
[assembly: AssemblyVersion("1.2.1.*")]
[assembly: AssemblyFileVersion("1.2.1.*")]
| mit | C# |
4286309dbb7cbf7280468b838a471f0b0efbd429 | Fix test failure on TOF | MattGal/wcf,StephenBonikowsky/wcf,ericstj/wcf,iamjasonp/wcf,dotnet/wcf,KKhurin/wcf,ElJerry/wcf,SajayAntony/wcf,dotnet/wcf,mconnew/wcf,SajayAntony/wcf,ericstj/wcf,imcarolwang/wcf,khdang/wcf,imcarolwang/wcf,zhenlan/wcf,MattGal/wcf,hongdai/wcf,khdang/wcf,imcarolwang/wcf,hongdai/wcf,ElJerry/wcf,zhenlan/wcf,mconnew/wcf,shmao/wcf,StephenBonikowsky/wcf,dotnet/wcf,mconnew/wcf,KKhurin/wcf,iamjasonp/wcf,shmao/wcf | src/System.Private.ServiceModel/tests/Scenarios/Security/TransportSecurity/Tcp/IdentityTests.cs | src/System.Private.ServiceModel/tests/Scenarios/Security/TransportSecurity/Tcp/IdentityTests.cs | using System;
using System.Collections;
using System.ServiceModel;
using System.ServiceModel.Security;
using System.Text;
using Xunit;
using Infrastructure.Common;
public static class IdentityTests
{
[Fact]
[OuterLoop]
// The product code will check the Dns identity from the server and throw if it does not match what is specified in DnsEndpointIdentity
public static void VerifyServiceIdentityMatchDnsEndpointIdentity()
{
string testString = "Hello";
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
EndpointAddress endpointAddress = new EndpointAddress(new Uri(Endpoints.Tcp_VerifyDNS_Address), new DnsEndpointIdentity(Endpoints.Tcp_VerifyDNS_HostName));
ChannelFactory<IWcfService> factory = new ChannelFactory<IWcfService>(binding, endpointAddress);
IWcfService serviceProxy = factory.CreateChannel();
try
{
var result = serviceProxy.Echo(testString);
Assert.Equal(testString, result);
factory.Close();
}
finally
{
ScenarioTestHelpers.CloseCommunicationObjects(factory);
}
}
[Fact]
[OuterLoop]
// Verify product throws MessageSecurityException when the Dns identity from the server does not match the expectation
public static void ServiceIdentityNotMatch_Throw_MessageSecurityException()
{
string testString = "Hello";
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
EndpointAddress endpointAddress = new EndpointAddress(new Uri(Endpoints.Tcp_VerifyDNS_Address), new DnsEndpointIdentity("wrongone"));
ChannelFactory<IWcfService> factory = new ChannelFactory<IWcfService>(binding, endpointAddress);
IWcfService serviceProxy = factory.CreateChannel();
try
{
var exception = Assert.Throws<MessageSecurityException>(() =>
{
var result = serviceProxy.Echo(testString);
Assert.Equal(testString, result);
});
Assert.True(exception.Message.Contains(Endpoints.Tcp_VerifyDNS_HostName), string.Format("Expected exception message contains: '{0}', actual: '{1}')", Endpoints.Tcp_VerifyDNS_HostName, exception.Message));
}
finally
{
ScenarioTestHelpers.CloseCommunicationObjects(factory);
}
}
}
| using System;
using System.Collections;
using System.ServiceModel;
using System.ServiceModel.Security;
using System.Text;
using Xunit;
using Infrastructure.Common;
public static class IdentityTests
{
[Fact]
[OuterLoop]
// The product code will check the Dns identity from the server and throw if it does not match what is specified in DnsEndpointIdentity
public static void VerifyServiceIdentityMatchDnsEndpointIdentity()
{
string testString = "Hello";
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
EndpointAddress endpointAddress = new EndpointAddress(new Uri(Endpoints.Tcp_VerifyDNS_Address), new DnsEndpointIdentity(Endpoints.Tcp_VerifyDNS_HostName));
ChannelFactory<IWcfService> factory = new ChannelFactory<IWcfService>(binding, endpointAddress);
IWcfService serviceProxy = factory.CreateChannel();
try
{
var result = serviceProxy.Echo(testString);
Assert.Equal(testString, result);
factory.Close();
}
finally
{
ScenarioTestHelpers.CloseCommunicationObjects(factory);
}
}
[Fact]
[OuterLoop]
// Verify product throws MessageSecurityException when the Dns identity from the server does not match the expectation
public static void ServiceIdentityNotMatch_Throw_MessageSecurityException()
{
string testString = "Hello";
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
EndpointAddress endpointAddress = new EndpointAddress(new Uri(Endpoints.Tcp_VerifyDNS_Address), new DnsEndpointIdentity("wrongone"));
ChannelFactory<IWcfService> factory = new ChannelFactory<IWcfService>(binding, endpointAddress);
IWcfService serviceProxy = factory.CreateChannel();
try
{
var exception = Assert.Throws<MessageSecurityException>(() =>
{
var result = serviceProxy.Echo(testString);
Assert.Equal(testString, result);
});
Assert.Contains(Endpoints.Tcp_VerifyDNS_HostName, exception.Message);
}
finally
{
ScenarioTestHelpers.CloseCommunicationObjects(factory);
}
}
}
| mit | C# |
bd122399ea10e3f01f12658efd3196b6f33d5390 | Fix segment ordering | Krusen/ErgastApi.Net | src/ErgastApi/Client/UrlSegmentInfo.cs | src/ErgastApi/Client/UrlSegmentInfo.cs | using System;
using System.Collections.Generic;
namespace ErgastApi.Client
{
public class UrlSegmentInfo : IComparable<UrlSegmentInfo>
{
public int? Order { get; set; }
public string Name { get; set; }
public string Value { get; set; }
public bool IsTerminator { get; set; }
public int CompareTo(UrlSegmentInfo other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;
var comparisons = new Func<UrlSegmentInfo, int>[]
{
CompareTerminator,
CompareOrder,
CompareName
};
foreach (var compareTo in comparisons)
{
var value = compareTo(other);
if (value != 0)
return value;
}
return 0;
}
private int CompareTerminator(UrlSegmentInfo other)
{
if (IsTerminator) return 1;
if (other.IsTerminator) return -1;
return 0;
}
private int CompareOrder(UrlSegmentInfo other)
{
if (Order == null && other.Order == null) return 0;
if (Order == null) return 1;
if (other.Order == null) return -1;
return Order.Value.CompareTo(other.Order.Value);
}
private int CompareName(UrlSegmentInfo other)
{
return string.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase);
}
}
} | using System;
using System.Collections.Generic;
namespace ErgastApi.Client
{
public class UrlSegmentInfo : IComparable<UrlSegmentInfo>
{
public int? Order { get; set; }
public string Name { get; set; }
public string Value { get; set; }
public bool IsTerminator { get; set; }
public int CompareTo(UrlSegmentInfo other)
{
if (ReferenceEquals(this, other)) return 0;
if (ReferenceEquals(null, other)) return 1;
var comparisons = new Func<UrlSegmentInfo, int>[]
{
CompareTerminator,
CompareOrder,
CompareName
};
foreach (var compareTo in comparisons)
{
var value = compareTo(other);
if (value != 0)
return value;
}
return 0;
}
private int CompareTerminator(UrlSegmentInfo other)
{
if (IsTerminator) return 1;
if (other.IsTerminator) return -1;
return 0;
}
private int CompareOrder(UrlSegmentInfo other)
{
if (Order == null) return 1;
if (other.Order == null) return -1;
return Order.Value.CompareTo(other.Order.Value);
}
private int CompareName(UrlSegmentInfo other)
{
return string.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase);
}
}
} | unlicense | C# |
9a2fb8ca6c26daf8cb926f8744cc550496e7e5d7 | Add test coverage for null mod on seeding screen | peppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu | osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs | osu.Game.Tournament.Tests/Screens/TestSceneSeedingScreen.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. 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.Tournament.Models;
using osu.Game.Tournament.Screens.Ladder.Components;
using osu.Game.Tournament.Screens.TeamIntro;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneSeedingScreen : TournamentTestScene
{
[Cached]
private readonly LadderInfo ladder = new LadderInfo
{
Teams =
{
new TournamentTeam
{
FullName = { Value = @"Japan" },
Acronym = { Value = "JPN" },
SeedingResults =
{
new SeedingResult
{
// Mod intentionally left blank.
Seed = { Value = 4 }
},
new SeedingResult
{
Mod = { Value = "DT" },
Seed = { Value = 8 }
}
}
}
}
};
[Test]
public void TestBasic()
{
AddStep("create seeding screen", () => Add(new SeedingScreen
{
FillMode = FillMode.Fit,
FillAspectRatio = 16 / 9f
}));
AddStep("set team to Japan", () => this.ChildrenOfType<SettingsTeamDropdown>().Single().Current.Value = ladder.Teams.Single());
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.TeamIntro;
namespace osu.Game.Tournament.Tests.Screens
{
public class TestSceneSeedingScreen : TournamentTestScene
{
[Cached]
private readonly LadderInfo ladder = new LadderInfo();
[BackgroundDependencyLoader]
private void load()
{
Add(new SeedingScreen
{
FillMode = FillMode.Fit,
FillAspectRatio = 16 / 9f
});
}
}
}
| mit | C# |
ce367bcc421f8865a4ef249767100667968a8bd9 | Fix invalid GC latency mode being set | ZLima12/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,DrabWeb/osu,EVAST9919/osu,DrabWeb/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,DrabWeb/osu,ZLima12/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,ppy/osu,peppy/osu-new,peppy/osu,johnneijzen/osu,ppy/osu,naoey/osu,smoogipoo/osu,naoey/osu,2yangk23/osu | osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs | osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Runtime;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Overlays.Settings.Sections.Debug
{
public class GCSettings : SettingsSubsection
{
protected override string Header => "Garbage Collector";
private readonly Bindable<LatencyMode> latencyMode = new Bindable<LatencyMode>();
private Bindable<GCLatencyMode> configLatencyMode;
[BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config)
{
Children = new Drawable[]
{
new SettingsEnumDropdown<LatencyMode>
{
LabelText = "Active mode",
Bindable = latencyMode
},
new SettingsButton
{
Text = "Force garbage collection",
Action = GC.Collect
},
};
configLatencyMode = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode);
configLatencyMode.BindValueChanged(v => latencyMode.Value = (LatencyMode)v, true);
latencyMode.BindValueChanged(v => configLatencyMode.Value = (GCLatencyMode)v);
}
private enum LatencyMode
{
Batch = GCLatencyMode.Batch,
Interactive = GCLatencyMode.Interactive,
LowLatency = GCLatencyMode.LowLatency,
SustainedLowLatency = GCLatencyMode.SustainedLowLatency
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Runtime;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
namespace osu.Game.Overlays.Settings.Sections.Debug
{
public class GCSettings : SettingsSubsection
{
protected override string Header => "Garbage Collector";
[BackgroundDependencyLoader]
private void load(FrameworkDebugConfigManager config)
{
Children = new Drawable[]
{
new SettingsEnumDropdown<GCLatencyMode>
{
LabelText = "Active mode",
Bindable = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode)
},
new SettingsButton
{
Text = "Force garbage collection",
Action = GC.Collect
},
};
}
}
}
| mit | C# |
b94bcd07e302a20e171ac36ec82b537097acf241 | Make _shouldEndSession false rather than null | stoiveyp/alexa-skills-dotnet,timheuer/alexa-skills-dotnet | Alexa.NET/Response/Response.cs | Alexa.NET/Response/Response.cs | using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
namespace Alexa.NET.Response
{
public class ResponseBody
{
[JsonProperty("outputSpeech", NullValueHandling = NullValueHandling.Ignore)]
public IOutputSpeech OutputSpeech { get; set; }
[JsonProperty("card", NullValueHandling = NullValueHandling.Ignore)]
public ICard Card { get; set; }
[JsonProperty("reprompt", NullValueHandling = NullValueHandling.Ignore)]
public Reprompt Reprompt { get; set; }
private bool? _shouldEndSession = false;
[JsonProperty("shouldEndSession", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShouldEndSession
{
get
{
var overrideDirectives = Directives?.OfType<IEndSessionDirective>();
if (overrideDirectives == null || !overrideDirectives.Any())
{
return _shouldEndSession;
}
var first = overrideDirectives.First().ShouldEndSession;
if (!overrideDirectives.All(od => od.ShouldEndSession == first))
{
return _shouldEndSession;
}
return first;
}
set => _shouldEndSession = value;
}
[JsonProperty("directives", NullValueHandling = NullValueHandling.Ignore)]
public IList<IDirective> Directives { get; set; } = new List<IDirective>();
public bool ShouldSerializeDirectives()
{
return Directives.Count > 0;
}
}
}
| using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
namespace Alexa.NET.Response
{
public class ResponseBody
{
[JsonProperty("outputSpeech", NullValueHandling = NullValueHandling.Ignore)]
public IOutputSpeech OutputSpeech { get; set; }
[JsonProperty("card", NullValueHandling = NullValueHandling.Ignore)]
public ICard Card { get; set; }
[JsonProperty("reprompt", NullValueHandling = NullValueHandling.Ignore)]
public Reprompt Reprompt { get; set; }
private bool? _shouldEndSession = null;
[JsonProperty("shouldEndSession", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShouldEndSession
{
get
{
var overrideDirectives = Directives?.OfType<IEndSessionDirective>();
if (overrideDirectives == null || !overrideDirectives.Any())
{
return _shouldEndSession;
}
var first = overrideDirectives.First().ShouldEndSession;
if (!overrideDirectives.All(od => od.ShouldEndSession == first))
{
return _shouldEndSession;
}
return first;
}
set => _shouldEndSession = value;
}
[JsonProperty("directives", NullValueHandling = NullValueHandling.Ignore)]
public IList<IDirective> Directives { get; set; } = new List<IDirective>();
public bool ShouldSerializeDirectives()
{
return Directives.Count > 0;
}
}
}
| mit | C# |
eb41b82996131d90157d2f5a25ac7c9807a06ec0 | Make dumy change in Sorter | michael-reichenauer/GitMind | GitMind/Utils/Sorter.cs | GitMind/Utils/Sorter.cs | using System.Collections.Generic;
namespace GitMind.Utils
{
internal static class Sorter
{
public static void Sort<T>(IList<T> list, IComparer<T> comparer)
{
CustomSort(list, comparer);
}
private static void CustomSort<T>(IList<T> list, IComparer<T> comparer)
{
for (int i = 0; i < list.Count; i++)
{
bool swapped = false;
T item = list[i];
for (int j = i + 1; j < list.Count; j++)
{
if (comparer.Compare(item, list[j]) > 0)
{
T tmp = list[j];
list.RemoveAt(j);
list.Insert(i, tmp);
swapped = true;
}
}
if (swapped)
{
i = i - 1;
}
}
}
//// private static void BubbleSort<T>(IList<T> list, IComparer<T> comparer)
//// {
//// bool swapped;;
//// do
//// {
//// swapped = false;
//// for (int i = 1; i < list.Count; i++)
//// {
//// int r = comparer.Compare(list[i - 1], list[i]);
//// if (r > 0)
//// {
//// T tmp = list[i - 1];
//// list[i - 1] = list[i];
//// list[i] = tmp;
//// swapped = true;
//// }
//// }
//// } while (swapped);
//// }
//// private static void InsertionSort<T>(IList<T> list, IComparer<T> comparer)
//// {
//// for (int i = 1; i < list.Count; i++)
//// {
//// int j = i;
//// while (j > 0 && comparer.Compare(list[j - 1], list[j]) > 0)
//// {
//// T tmp = list[j - 1];
//// list[j - 1] = list[j];
//// list[j] = tmp;
//// j = j - 1;
//// }
//// }
//// /*
//// for i ← 1 to length(A) - 1
//// j ← i
//// while j > 0 and A[j-1] > A[j]
//// swap A[j] and A[j-1]
//// j ← j - 1
//// end while
////end for
//// */
//// }
}
} | using System.Collections.Generic;
namespace GitMind.Utils
{
internal static class Sorter
{
public static void Sort<T>(IList<T> list, IComparer<T> comparer)
{
CustomSort(list, comparer);
}
private static void CustomSort<T>(IList<T> list, IComparer<T> comparer)
{
for (int i = 0; i < list.Count; i++)
{
bool swapped = false;
T item = list[i];
for (int j = i + 1; j < list.Count; j++)
{
if (comparer.Compare(item, list[j]) > 0)
{
T tmp = list[j];
list.RemoveAt(j);
list.Insert(i, tmp);
swapped = true;
}
}
if (swapped)
{
i = i - 1;
}
}
}
//// private static void BubbleSort<T>(IList<T> list, IComparer<T> comparer)
//// {
//// bool swapped;
//// do
//// {
//// swapped = false;
//// for (int i = 1; i < list.Count; i++)
//// {
//// int r = comparer.Compare(list[i - 1], list[i]);
//// if (r > 0)
//// {
//// T tmp = list[i - 1];
//// list[i - 1] = list[i];
//// list[i] = tmp;
//// swapped = true;
//// }
//// }
//// } while (swapped);
//// }
//// private static void InsertionSort<T>(IList<T> list, IComparer<T> comparer)
//// {
//// for (int i = 1; i < list.Count; i++)
//// {
//// int j = i;
//// while (j > 0 && comparer.Compare(list[j - 1], list[j]) > 0)
//// {
//// T tmp = list[j - 1];
//// list[j - 1] = list[j];
//// list[j] = tmp;
//// j = j - 1;
//// }
//// }
//// /*
//// for i ← 1 to length(A) - 1
//// j ← i
//// while j > 0 and A[j-1] > A[j]
//// swap A[j] and A[j-1]
//// j ← j - 1
//// end while
////end for
//// */
//// }
}
} | mit | C# |
ca248f14afef8195d244e5b74fd37854d2b0dc35 | Fix typo in Price class. | nozzlegear/ShopifySharp,clement911/ShopifySharp | ShopifySharp/Entities/Price.cs | ShopifySharp/Entities/Price.cs | using Newtonsoft.Json;
namespace ShopifySharp
{
public class Price
{
/// <summary>
/// The three-letter code (ISO 4217 format) for currency.
/// </summary>
[JsonProperty("currency_code")]
public string CurrencyCode { get; set; }
/// <summary>
/// The amount in the currency.
/// </summary>
[JsonProperty("amount")]
public decimal? Amount { get; set; }
}
} | using Newtonsoft.Json;
namespace ShopifySharp
{
public class Price
{
/// <summary>
/// The three-letter code (ISO 4217 format) for currency.
/// </summary>
[JsonProperty("currency_code")]
public string CurrencyCode { get; set; }
/// <summary>
/// The variant's price or compare-at price in the currency.
/// </summary>
[JsonProperty("amount")]
public string Amount { get; set; }
}
} | mit | C# |
99375eac810e105cdbedfbe6e7c76d285d59674d | Insert text instead of replacing whole buffer | mono/dbus-sharp-glib,mono/dbus-sharp-glib | glib/Test.cs | glib/Test.cs | // Copyright 2006 Alp Toker <[email protected]>
// This software is made available under the MIT License
// See COPYING for details
using System;
using GLib;
using Gtk;
using NDesk.DBus;
using org.freedesktop.DBus;
public class TestGLib
{
public static void OnClick (object o, EventArgs args)
{
foreach (string n in bus.ListNames ()) {
TextIter endIter = tv.Buffer.EndIter;
tv.Buffer.Insert (ref endIter, n + '\n');
}
}
static TextView tv;
static Bus bus;
public static void Main ()
{
DApplication.Init ();
Application.Init ();
tv = new TextView ();
ScrolledWindow sw = new ScrolledWindow ();
sw.Add (tv);
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (sw, true, true, 0);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("DBus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
bus = DApplication.Connection.GetObject<Bus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.Error.WriteLine ("NameAcquired: " + acquired_name);
};
string myName = bus.Hello ();
Console.Error.WriteLine ("myName: " + myName);
Application.Run ();
}
}
| // Copyright 2006 Alp Toker <[email protected]>
// This software is made available under the MIT License
// See COPYING for details
using System;
using GLib;
using Gtk;
using NDesk.DBus;
using org.freedesktop.DBus;
public class TestGLib
{
public static void OnClick (object o, EventArgs args)
{
Console.WriteLine ("click");
Console.WriteLine ();
foreach (string n in bus.ListNames ())
//Console.WriteLine (n);
tv.Buffer.Text += n+'\n';
}
static TextView tv;
static Bus bus;
public static void Main ()
{
DApplication.Init ();
Application.Init ();
tv = new TextView ();
ScrolledWindow sw = new ScrolledWindow ();
sw.Add (tv);
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (sw, true, true, 0);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("DBus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
bus = DApplication.Connection.GetObject<Bus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.Error.WriteLine ("NameAcquired: " + acquired_name);
};
string myName = bus.Hello ();
Console.Error.WriteLine ("myName: " + myName);
Application.Run ();
}
}
| mit | C# |
f21e084628464c224a0f5dc190af2ff7d1215f8c | Fix issue in naming of class in test file. | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | csharp/ql/test/library-tests/dataflow/patterns/Patterns.cs | csharp/ql/test/library-tests/dataflow/patterns/Patterns.cs | using System;
public record class RecordClass2(object Prop) { }
public record class Nested(RecordClass2 Record) { }
public class RecordPatterns
{
private void M1()
{
var o = Source<object>(1);
var r = new RecordClass2(o);
if (r is RecordClass2 { Prop: object p })
{
Sink(p); // $ MISSING: hasValueFlow=1
}
}
private void M2()
{
var o = Source<object>(2);
var r = new RecordClass2(o);
switch (r)
{
case RecordClass2 { Prop: object p }:
Sink(p); // $ MISSING: hasValueFlow=2
break;
}
}
private void M3()
{
var o = Source<object>(3);
var s = new Nested(new RecordClass2(o));
if (s is Nested { Record: { Prop: object p } })
{
Sink(p); // $ MISSING: hasValueFlow=3
}
}
private void M4()
{
var o = Source<object>(4);
var s = new Nested(new RecordClass2(o));
if (s is Nested { Record.Prop: object p })
{
Sink(p); // $ MISSING: hasValueFlow=4
}
}
public static void Sink(object o) { }
static T Source<T>(object source) => throw null;
}
| using System;
public record class RecordClass2(object Prop) { }
public record class Nested(RecordClass2 Record) { }
public class K
{
private void M1()
{
var o = Source<object>(1);
var r = new RecordClass2(o);
if (r is RecordClass2 { Prop: object p })
{
Sink(p); // $ MISSING: hasValueFlow=1
}
}
private void M2()
{
var o = Source<object>(2);
var r = new RecordClass2(o);
switch (r)
{
case RecordClass2 { Prop: object p }:
Sink(p); // $ MISSING: hasValueFlow=2
break;
}
}
private void M3()
{
var o = Source<object>(3);
var s = new Nested(new RecordClass2(o));
if (s is Nested { Record: { Prop: object p } })
{
Sink(p); // $ MISSING: hasValueFlow=3
}
}
private void M4()
{
var o = Source<object>(4);
var s = new Nested(new RecordClass2(o));
if (s is Nested { Record.Prop: object p })
{
Sink(p); // $ MISSING: hasValueFlow=4
}
}
public static void Sink(object o) { }
static T Source<T>(object source) => throw null;
}
| mit | C# |
6822af0101d292c87937350b06989b4e15615b55 | change debug text | JackCeparou/JackCeparouCompass | DevTool/DisplayActorsPlugin.cs | DevTool/DisplayActorsPlugin.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Turbo.Plugins.Default;
namespace Turbo.Plugins.Jack.DevTool
{
public class DisplayActorsPlugin : BasePlugin, IInGameWorldPainter
{
public GroundLabelDecorator Decorator { get; set; }
public DisplayActorsPlugin()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
Decorator = new GroundLabelDecorator(Hud)
{
TextFont = Hud.Render.CreateFont("consolas", 8, 255, 255, 255, 255, false, false, 255, 0, 0, 0, true),
};
}
public void PaintWorld(WorldLayer layer)
{
if (!Hud.Input.IsKeyDown(Keys.W) || layer != WorldLayer.Ground) return;
foreach (var actor in Hud.Game.Actors)
{
var text = string.Format("{0} : {1} {2}\n{3}, {4}, {5}\n{6}",
actor.SnoActor.Sno,
actor.SnoActor.NameLocalized,
actor.SnoActor.Kind,
actor.IsOperated ? "Operated" : "!Operated",
actor.IsClickable ? "Clickable" : "!Clickable",
actor.IsDisabled ? "Disabled" : "!Disabled",
actor.SnoActor.Code);
Decorator.Paint(actor, actor.FloorCoordinate, text);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Turbo.Plugins.Default;
namespace Turbo.Plugins.Jack.DevTool
{
public class DisplayActorsPlugin : BasePlugin, IInGameWorldPainter
{
public GroundLabelDecorator Decorator { get; set; }
public DisplayActorsPlugin()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
Decorator = new GroundLabelDecorator(Hud)
{
TextFont = Hud.Render.CreateFont("consolas", 10, 255, 255, 255, 255, false, false, 255, 0, 0, 0, true),
};
}
public void PaintWorld(WorldLayer layer)
{
if (!Hud.Input.IsKeyDown(Keys.W) || layer != WorldLayer.Ground) return;
foreach (var actor in Hud.Game.Actors)
{
var text = string.Format("{0}\n{1}\n{2}", actor.SnoActor.Sno, actor.SnoActor.NameEnglish, actor.SnoActor.Code);
Decorator.Paint(actor, actor.FloorCoordinate, text);
}
}
}
}
| mit | C# |
631b1eeb7b8db8e4c78ea50ccd560de331535462 | Fix 263 - Allow underscore when Regex matching classes for earlybound classes (#264) | scottdurow/SparkleXrm,scottdurow/SparkleXrm,scottdurow/SparkleXrm | spkl/SparkleXrm.Tasks/CrmSvcUtil/SourceCodeTypeExtractor.cs | spkl/SparkleXrm.Tasks/CrmSvcUtil/SourceCodeTypeExtractor.cs | namespace SparkleXrm.Tasks.CrmSvcUtil
{
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
public class SourceCodeTypeExtractor
{
private const string ClassPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[:_])+public\spartial[a-zA-Z0-9\s:\.,_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
private const string EnumPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[:])+public\senum[a-zA-Z0-9\s_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
public List<TypeContainer> ExtractTypes(string input)
{
var classMatches = new Regex(ClassPattern).Matches(input);
var result = (from Match match in classMatches
select new TypeContainer(ContainerType.ClassContainer, match.Value))
.ToList();
var enumMatches = new Regex(EnumPattern).Matches(input);
result.AddRange(from Match match in enumMatches
select new TypeContainer(ContainerType.EnumContainer, match.Value));
return result;
}
}
} | namespace SparkleXrm.Tasks.CrmSvcUtil
{
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
public class SourceCodeTypeExtractor
{
private const string ClassPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[:])+public\spartial[a-zA-Z0-9\s:\.,_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
private const string EnumPattern = @"([a-zA-Z0-9\(\"",\s\.\)\]\s\n\[:])+public\senum[a-zA-Z0-9\s_]+{(?:[^{}]|(?<open>{)|(?<-open>}))+(?(open)(?!))}";
public List<TypeContainer> ExtractTypes(string input)
{
var classMatches = new Regex(ClassPattern).Matches(input);
var result = (from Match match in classMatches
select new TypeContainer(ContainerType.ClassContainer, match.Value))
.ToList();
var enumMatches = new Regex(EnumPattern).Matches(input);
result.AddRange(from Match match in enumMatches
select new TypeContainer(ContainerType.EnumContainer, match.Value));
return result;
}
}
} | mit | C# |
b989e613ef63584b89e64cd9736227dc761e52b5 | Add support for IDictionary in object | loqu8/kvc | Loqu8.KVC/KVCWrapper.cs | Loqu8.KVC/KVCWrapper.cs | using System;
using MonoMac.Foundation;
using System.Reflection;
using System.ComponentModel;
using System.Collections;
namespace Loqu8.KVC
{
public class KVCWrapper : NSObject
{
private readonly Object _t;
private readonly Type _type;
public KVCWrapper (Object t)
{
_t = t;
_type = t.GetType ();
}
public override void SetValueForKeyPath (NSObject nsValue, NSString nsKeyPath)
{
var keyPath = nsKeyPath.ToString ();
var keys = keyPath.Split ('.');
Object target = _t;
PropertyInfo info;
for (int i = 0; i < keys.Length; i++) {
// Todo: target could be an IDictionary, IEnumerable or array, in which case access could be different, what if we get things like First/Last
if (target is IDictionary) {
var dict = (IDictionary)target;
if (!dict.Contains (keys [i]))
return;
target = dict [keys [i]];
continue;
}
info = target.GetType ().GetProperty (keys[i]);
if (info == null)
return;
if (i == keys.Length - 1) {
WillChangeValue (keys[0]);
info.SetValue (target, nsValue.ToObject (info.PropertyType), null);
DidChangeValue (keys[0]);
} else {
target = info.GetValue (target, null);
}
}
}
public override void SetValueForKey (NSObject value, NSString key)
{
// should not be called
var info = _type.GetProperty (key.ToString ());
info.SetValue (_t, value.ToObject(info.PropertyType), null);
}
public override NSObject ValueForKeyPath (NSString nsKeyPath)
{
var keyPath = nsKeyPath.ToString ();
var keys = keyPath.Split ('.');
Object target = _t;
foreach (var key in keys) {
if (target is IDictionary) {
var dict = (IDictionary)target;
if (!dict.Contains (key))
return;
target = dict [key];
continue;
}
target = ValueForKey (target, key);
}
return target.ToNSObject ();
}
public override NSObject ValueForKey (NSString nsKey)
{
var target = ValueForKey (_t, nsKey.ToString());
return target.ToNSObject ();
}
protected static Object ValueForKey (Object target, String key)
{
// Todo: target could be an IDictionary, IEnumerable or array, in which case access could be different, what if we get things like First/Last
var type = target.GetType ();
PropertyInfo info = type.GetProperty (key);
return info.GetValue (target, null);
}
}
}
| using System;
using MonoMac.Foundation;
using System.Reflection;
using System.ComponentModel;
namespace Loqu8.KVC
{
public class KVCWrapper : NSObject
{
private readonly Object _t;
private readonly Type _type;
public KVCWrapper (Object t)
{
_t = t;
_type = t.GetType ();
}
public override void SetValueForKeyPath (NSObject nsValue, NSString nsKeyPath)
{
var keyPath = nsKeyPath.ToString ();
var keys = keyPath.Split ('.');
Object target = _t;
PropertyInfo info;
for (int i = 0; i < keys.Length; i++) {
// Todo: target could be an IDictionary, IEnumerable or array, in which case access could be different, what if we get things like First/Last
info = target.GetType ().GetProperty (keys[i]);
if (i == keys.Length - 1) {
WillChangeValue (keys[0]);
info.SetValue (target, nsValue.ToObject (info.PropertyType), null);
DidChangeValue (keys[0]);
} else {
target = info.GetValue (target, null);
}
}
}
public override void SetValueForKey (NSObject value, NSString key)
{
// should not be called
var info = _type.GetProperty (key.ToString ());
info.SetValue (_t, value.ToObject(info.PropertyType), null);
}
public override NSObject ValueForKeyPath (NSString nsKeyPath)
{
var keyPath = nsKeyPath.ToString ();
var keys = keyPath.Split ('.');
Object target = _t;
foreach (var key in keys) {
target = ValueForKey (target, key);
}
return target.ToNSObject ();
}
public override NSObject ValueForKey (NSString nsKey)
{
var target = ValueForKey (_t, nsKey.ToString());
return target.ToNSObject ();
}
protected static Object ValueForKey (Object target, String key)
{
// Todo: target could be an IDictionary, IEnumerable or array, in which case access could be different, what if we get things like First/Last
var type = target.GetType ();
PropertyInfo info = type.GetProperty (key);
return info.GetValue (target, null);
}
}
}
| mit | C# |
50b99545309c63b89b83845c7661357c0a3eb8d2 | fix sample build config | bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents,xamarin/XamarinComponents,bholmes/XamarinComponents | Mac/ITSwitch/build.cake | Mac/ITSwitch/build.cake |
#load "../../common.cake"
var TARGET = Argument ("t", Argument ("target", "Default"));
var buildSpec = new BuildSpec () {
Libs = new ISolutionBuilder [] {
new DefaultSolutionBuilder {
SolutionPath = "./source/ITSwitch.sln",
Configuration = "Release",
BuildsOn = BuildPlatforms.Mac,
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/ITSwitch/bin/Release/ITSwitch.dll",
ToDirectory = "./output/unified/"
},
}
},
},
Samples = new ISolutionBuilder [] {
new DefaultSolutionBuilder { SolutionPath = "./samples/ITSwitchSample/ITSwitchSample.sln", Configuration = "Release", BuildsOn = BuildPlatforms.Mac },
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/ITSwitch.nuspec", BuildsOn = BuildPlatforms.Mac },
},
Components = new [] {
new Component { ManifestDirectory = "./component", BuildsOn = BuildPlatforms.Mac},
},
};
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
|
#load "../../common.cake"
var TARGET = Argument ("t", Argument ("target", "Default"));
var buildSpec = new BuildSpec () {
Libs = new ISolutionBuilder [] {
new DefaultSolutionBuilder {
SolutionPath = "./source/ITSwitch.sln",
Configuration = "Release",
BuildsOn = BuildPlatforms.Mac,
OutputFiles = new [] {
new OutputFileCopy {
FromFile = "./source/ITSwitch/bin/Release/ITSwitch.dll",
ToDirectory = "./output/unified/"
},
}
},
},
Samples = new ISolutionBuilder [] {
new IOSSolutionBuilder { SolutionPath = "./samples/ITSwitchSample/ITSwitchSample.sln", Configuration = "Release|iPhone", BuildsOn = BuildPlatforms.Mac },
},
NuGets = new [] {
new NuGetInfo { NuSpec = "./nuget/ITSwitch.nuspec", BuildsOn = BuildPlatforms.Mac },
},
Components = new [] {
new Component { ManifestDirectory = "./component", BuildsOn = BuildPlatforms.Mac},
},
};
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
RunTarget (TARGET);
| mit | C# |
1a0dea0dc22ef8f7678a693a25d9e5ce08b566b8 | add test for GetEnumUnderlyingType | sailro/cecil,kzu/cecil,jbevain/cecil,saynomoo/cecil,SiliconStudio/Mono.Cecil,xen2/cecil,ttRevan/cecil,fnajera-rac-de/cecil,furesoft/cecil,gluck/cecil,mono/cecil,cgourlay/cecil,joj/cecil | rocks/Test/Mono.Cecil.Tests/TypeDefinitionRocksTests.cs | rocks/Test/Mono.Cecil.Tests/TypeDefinitionRocksTests.cs | using System;
using System.Linq;
using Mono.Cecil.Rocks;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class TypeDefinitionRocksTests {
class Foo {
static Foo ()
{
}
public Foo (int a)
{
}
public Foo (int a, string s)
{
}
public static void Bar ()
{
}
void Baz ()
{
}
}
[Test]
public void GetConstructors ()
{
var foo = typeof (Foo).ToDefinition ();
var ctors = foo.GetConstructors ().ToArray ();
Assert.AreEqual (3, ctors.Length);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.cctor()", ctors [0].FullName);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.ctor(System.Int32)", ctors [1].FullName);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.ctor(System.Int32,System.String)", ctors [2].FullName);
}
[Test]
public void GetStaticConstructor ()
{
var foo = typeof (Foo).ToDefinition ();
var cctor = foo.GetStaticConstructor ();
Assert.IsNotNull (cctor);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.cctor()", cctor.FullName);
}
[Test]
public void GetMethods ()
{
var foo = typeof (Foo).ToDefinition ();
var methods = foo.GetMethods ().ToArray ();
Assert.AreEqual (2, methods.Length);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::Bar()", methods [0].FullName);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::Baz()", methods [1].FullName);
}
enum Pan : byte {
Pin,
Pon,
}
[Test]
public void GetEnumUnderlyingType ()
{
var pan = typeof (Pan).ToDefinition ();
Assert.IsNotNull (pan);
Assert.IsTrue (pan.IsEnum);
var underlying_type = pan.GetEnumUnderlyingType ();
Assert.IsNotNull (underlying_type);
Assert.AreEqual ("System.Byte", underlying_type.FullName);
}
}
} | using System;
using System.Linq;
using Mono.Cecil.Rocks;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class TypeDefinitionRocksTests {
class Foo {
static Foo ()
{
}
public Foo (int a)
{
}
public Foo (int a, string s)
{
}
public static void Bar ()
{
}
void Baz ()
{
}
}
[Test]
public void GetConstructors ()
{
var foo = typeof (Foo).ToDefinition ();
var ctors = foo.GetConstructors ().ToArray ();
Assert.AreEqual (3, ctors.Length);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.cctor()", ctors [0].FullName);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.ctor(System.Int32)", ctors [1].FullName);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.ctor(System.Int32,System.String)", ctors [2].FullName);
}
[Test]
public void GetStaticConstructor ()
{
var foo = typeof (Foo).ToDefinition ();
var cctor = foo.GetStaticConstructor ();
Assert.IsNotNull (cctor);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::.cctor()", cctor.FullName);
}
[Test]
public void GetMethods ()
{
var foo = typeof (Foo).ToDefinition ();
var methods = foo.GetMethods ().ToArray ();
Assert.AreEqual (2, methods.Length);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::Bar()", methods [0].FullName);
Assert.AreEqual ("System.Void Mono.Cecil.Tests.TypeDefinitionRocksTests/Foo::Baz()", methods [1].FullName);
}
}
} | mit | C# |
ce3cd1b3742efbe8a03ecd3e3f2fc67d89870f51 | add missing built in types to scope. previously only included declarations. seems like it should not include declarations at all?! | ecologylab/BigSemanticsCSharp | Ecologylab.BigSemantics/MetadataNS/Builtins/Declarations/MetadataBuiltinDeclarationsTranslationScope.cs | Ecologylab.BigSemantics/MetadataNS/Builtins/Declarations/MetadataBuiltinDeclarationsTranslationScope.cs |
using Ecologylab.BigSemantics.MetaMetadataNS;
using Ecologylab.BigSemantics.MetadataNS.Builtins;
using Ecologylab.Collections;
using Simpl.Fundamental.Generic;
using Simpl.Serialization;
using Simpl.Serialization.Attributes;
using System;
using System.Collections;
using System.Collections.Generic;
// Developer should proof-read this TranslationScope before using it for production.
namespace Ecologylab.BigSemantics.MetadataNS.Builtins.Declarations
{
public class MetadataBuiltinDeclarationsTranslationScope
{
public MetadataBuiltinDeclarationsTranslationScope()
{ }
public static SimplTypesScope Get()
{
return SimplTypesScope.Get("repository_builtin_declarations_scope",
typeof(AnnotateDeclaration),
typeof(AssignPrimaryLinkDeclaration),
typeof(AudioDeclaration),
typeof(ClippableDocumentDeclaration),
typeof(ClippingDeclaration<>),
typeof(CreativeActDeclaration),
typeof(CurateLinkDeclaration),
typeof(DebugMetadataDeclaration),
typeof(DocumentDeclaration),
typeof(DocumentMetadataWrapDeclaration),
typeof(HtmlTextDeclaration),
typeof(ImageClippingDeclaration),
typeof(ImageClipping),
typeof(ImageDeclaration),
typeof(Image),
typeof(ImageSelfmadeDeclaration),
typeof(ImageSelfmade),
typeof(MetadataDeclaration),
typeof(RichArtifactDeclaration<>),
typeof(RichDocumentDeclaration),
typeof(RichDocument),
typeof(SequencedClippableDocumentDeclaration),
typeof(TextClippingDeclaration),
typeof(TextSelfmadeDeclaration),
typeof(VideoDeclaration));
}
}
}
|
using Ecologylab.BigSemantics.MetaMetadataNS;
using Ecologylab.BigSemantics.MetadataNS.Builtins;
using Ecologylab.Collections;
using Simpl.Fundamental.Generic;
using Simpl.Serialization;
using Simpl.Serialization.Attributes;
using System;
using System.Collections;
using System.Collections.Generic;
// Developer should proof-read this TranslationScope before using it for production.
namespace Ecologylab.BigSemantics.MetadataNS.Builtins.Declarations
{
public class MetadataBuiltinDeclarationsTranslationScope
{
public MetadataBuiltinDeclarationsTranslationScope()
{ }
public static SimplTypesScope Get()
{
return SimplTypesScope.Get("repository_builtin_declarations_scope",
typeof(AnnotateDeclaration),
typeof(AssignPrimaryLinkDeclaration),
typeof(AudioDeclaration),
typeof(ClippableDocumentDeclaration),
typeof(ClippingDeclaration<>),
typeof(CreativeActDeclaration),
typeof(CurateLinkDeclaration),
typeof(DebugMetadataDeclaration),
typeof(DocumentDeclaration),
typeof(DocumentMetadataWrapDeclaration),
typeof(HtmlTextDeclaration),
typeof(ImageClippingDeclaration),
typeof(ImageDeclaration),
typeof(ImageSelfmadeDeclaration),
typeof(MetadataDeclaration),
typeof(RichArtifactDeclaration<>),
typeof(RichDocumentDeclaration),
typeof(SequencedClippableDocumentDeclaration),
typeof(TextClippingDeclaration),
typeof(TextSelfmadeDeclaration),
typeof(VideoDeclaration));
}
}
}
| apache-2.0 | C# |
bb595f7ee170b5d7cf8eb580333fe8701762b366 | Update Note.cs | vdaron/MusicXml.Net | MusicXml/Domain/Note.cs | MusicXml/Domain/Note.cs | using System.Xml;
namespace MusicXml.Domain
{
public class Note
{
internal Note()
{
Type = string.Empty;
Duration = -1;
Voice = -1;
Staff = -1;
IsChordTone = false;
}
public string Type { get; internal set; }
public int Voice { get; internal set; }
public int Duration { get; internal set; }
public Lyric Lyric { get; internal set; }
public Pitch Pitch { get; internal set; }
public int Staff { get; internal set; }
public bool IsChordTone { get; internal set; }
public bool IsRest { get; internal set; }
public string Accidental { get; internal set; }
}
}
| namespace MusicXml.Domain
{
public class Note
{
internal Note()
{
Type = string.Empty;
Duration = -1;
Voice = -1;
Staff = -1;
IsChordTone = false;
}
public string Type { get; internal set; }
public int Voice { get; internal set; }
public int Duration { get; internal set; }
public Lyric Lyric { get; internal set; }
public Pitch Pitch { get; internal set; }
public int Staff { get; internal set; }
public bool IsChordTone { get; internal set; }
public bool IsRest { get; internal set; }
}
}
| bsd-3-clause | C# |
7e36c523d9579b22c68a347dd62f5dcb914d77d9 | Update Index.cshtml | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/Home/Index.cshtml | Anlab.Mvc/Views/Home/Index.cshtml | @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
@* <h2 style="color: blue">PLEASE NOTE: New rates will take effect December 16th. Work orders for samples not received by December 16th will need to be re-created so as to capture the new rates.</h2> *@
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses.
</p>
<p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the
operation of a number of analytical methods and instruments.</p>
<p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory.
We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service
as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/>
Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:[email protected]">[email protected]</a></p>
</address>
</div>
| @{
ViewData["Title"] = "Home Page";
}
<div class="col-8">
<h2 style="color: blue">PLEASE NOTE: New rates will take effect December 16th. Work orders for samples not received by December 16th will need to be re-created so as to capture the new rates.</h2>
<h2 style="color: blue">Also Note: During the upcoming Holiday period, there will be limited staffing. We will be closed December 24, 25, 31, and January 1.<br/>
Sample Receiving Hours will be 8am to 3pm December 23, 26, 27, 30.<br/>
Normal Hours resume January 2.</h2>
<p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p>
<p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses.
</p>
<p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the
operation of a number of analytical methods and instruments.</p>
<p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory.
We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service
as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/>
Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p>
</div>
<div class="col-4">
<address>
<p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:[email protected]">[email protected]</a></p>
</address>
</div>
| mit | C# |
187209bd1a772bd47052cad5ac7309b7aedcf6f3 | Make the language XML file optional | MeltWS/proshine,bobus15/proshine,Silv3rPRO/proshine | PROProtocol/Language.cs | PROProtocol/Language.cs | using System.Collections.Generic;
using System.IO;
using System.Xml;
namespace PROProtocol
{
public class Language
{
private const string FileName = "Resources/Lang.xml";
private Dictionary<string, string> _texts = new Dictionary<string, string>();
public Language()
{
if (File.Exists(FileName))
{
XmlDocument xml = new XmlDocument();
xml.Load(FileName);
LoadXmlDocument(xml);
}
}
private void LoadXmlDocument(XmlDocument xml)
{
XmlNode languageNode = xml.DocumentElement.GetElementsByTagName("English")[0];
if (languageNode != null)
{
foreach (XmlElement textNode in languageNode)
{
_texts.Add(textNode.GetAttribute("name"), textNode.InnerText);
}
}
}
public string GetText(string name)
{
return _texts[name];
}
public string Replace(string originalText)
{
if (originalText.IndexOf('$') != -1)
{
foreach (var text in _texts)
{
originalText = originalText.Replace("$" + text.Key, text.Value);
}
}
return originalText;
}
}
}
| using System.Collections.Generic;
using System.Xml;
namespace PROProtocol
{
public class Language
{
private Dictionary<string, string> _texts;
public Language()
{
XmlDocument xml = new XmlDocument();
xml.Load("Resources/Lang.xml");
_texts = new Dictionary<string, string>();
XmlNode languageNode = xml.DocumentElement.GetElementsByTagName("English")[0];
if (languageNode != null)
{
foreach (XmlElement textNode in languageNode)
{
_texts.Add(textNode.GetAttribute("name"), textNode.InnerText);
}
}
}
public string GetText(string name)
{
return _texts[name];
}
public string Replace(string originalText)
{
if (originalText.IndexOf('$') != -1)
{
foreach (var text in _texts)
{
originalText = originalText.Replace("$" + text.Key, text.Value);
}
}
return originalText;
}
}
}
| mit | C# |
ef7cf7dde328a43758faeca07057595c0eb92a8d | Use explicit type to cast back to SampleType. | alastairs/BobTheBuilder,fffej/BobTheBuilder | BobTheBuilder.Tests/BuildFacts.cs | BobTheBuilder.Tests/BuildFacts.cs | using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace BobTheBuilder.Tests
{
public class BuildFacts
{
[Fact]
public void CreateADynamicInstanceOfTheRequestedType()
{
var sut = A.BuilderFor<SampleType>();
var result = sut.Build();
Assert.IsAssignableFrom<dynamic>(result);
Assert.IsAssignableFrom<SampleType>(result);
}
[Theory, AutoData]
public void SetStringStateByName(string expected)
{
var sut = A.BuilderFor<SampleType>();
sut.WithStringProperty(expected);
SampleType result = sut.Build();
Assert.Equal(expected, result.StringProperty);
}
}
}
| using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace BobTheBuilder.Tests
{
public class BuildFacts
{
[Fact]
public void CreateADynamicInstanceOfTheRequestedType()
{
var sut = A.BuilderFor<SampleType>();
var result = sut.Build();
Assert.IsAssignableFrom<dynamic>(result);
Assert.IsAssignableFrom<SampleType>(result);
}
[Theory, AutoData]
public void SetStringStateByName(string expected)
{
var sut = A.BuilderFor<SampleType>();
sut.WithStringProperty(expected);
var result = sut.Build();
Assert.Equal(expected, result.StringProperty);
}
}
}
| apache-2.0 | C# |
625b74bbe0c2e3bb1d4defe8a7528d61b61194d0 | Reduce line length | EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils,EamonNerbonne/ValueUtils | ValueUtils/ReflectionHelper.cs | ValueUtils/ReflectionHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ValueUtils
{
static class ReflectionHelper
{
public static IEnumerable<Type> WalkMeaningfulInheritanceChain(Type type)
{
if (type.IsValueType) {
yield return type;
yield break;
}
while (type != typeof(object)) {
yield return type;
type = type.BaseType;
}
}
public static IEnumerable<FieldInfo> GetAllFields(Type type)
=> WalkMeaningfulInheritanceChain(type).Reverse()
.SelectMany(t => t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly));
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ValueUtils
{
static class ReflectionHelper
{
public static IEnumerable<Type> WalkMeaningfulInheritanceChain(Type type)
{
if (type.IsValueType) {
yield return type;
yield break;
}
while (type != typeof(object)) {
yield return type;
type = type.BaseType;
}
}
public static IEnumerable<FieldInfo> GetAllFields(Type type)
=> WalkMeaningfulInheritanceChain(type).Reverse().SelectMany(t=> t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly));
}
}
| apache-2.0 | C# |
65ea94a3f7576a07d5b2fdb463b46379a2f5fdf1 | change to search url class | Lakon/VideoAggregator | VideoAggregator/GuideBoxApi.cs | VideoAggregator/GuideBoxApi.cs | using System;
//using Json.Net;
namespace VideoAggregator
{
public class GuideBoxApiClass
{
string apiHome = "http://api-public.guidebox.com/v1.43/1/";
string apiKey = "rK4vt5WeKQvXmZgr8I0v7jbOVGCt9wtm/all/";
public string getSearchID(string searchID)
{
int limit1 = 1;
int limit2 = 25;
searchID = apiHome + apiKey + limit1.ToString () + "/" + limit2.ToString () + "/";
return searchID;
}
}
} | using System;
//using Json.Net;
namespace VideoAggregator
{
public class GuideBoxApiClass
{
string apiHome = "http://api-public.guidebox.com/v1.43/1/";
string apiKey = "rK4vt5WeKQvXmZgr8I0v7jbOVGCt9wtm/all/";
public string getShowID(string showID)
{
int limit1 = 1;
int limit2 = 25;
showID = apiHome + apiKey + limit1.ToString () + "/" + limit2.ToString () + "/";
return showID;
}
}
} | mit | C# |
dbaffcae3aa181eb275ef68d47c23b54e0497938 | Refactor GridViewDataSetDelegateViewModel | riganti/dotvvm,riganti/dotvvm,riganti/dotvvm,riganti/dotvvm | src/DotVVM.Samples.Common/ViewModels/ComplexSamples/GridViewDataSet/GridViewDataSetDelegateViewModel.cs | src/DotVVM.Samples.Common/ViewModels/ComplexSamples/GridViewDataSet/GridViewDataSetDelegateViewModel.cs | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotVVM.Framework.Controls;
using DotVVM.Framework.ViewModel;
namespace DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.GridViewDataSet
{
public class GridViewDataSetDelegateViewModel : DotvvmViewModelBase
{
public int CallDelegateCounter { get; set; } = 0;
public override Task Init()
{
DataSet = Framework.Controls.GridViewDataSet.Create(GetData, pageSize: 3);
return base.Init();
}
public GridViewDataSet<Data> DataSet { get; set; }
public int ItemsCount { get; set; } = 20;
private GridViewDataSetLoadedData<Data> GetData(IGridViewDataSetLoadOptions gridViewDataSetLoadOptions)
{
CallDelegateCounter++;
var queryable = TestDB(ItemsCount);
return queryable.GetDataFromQueryable(gridViewDataSetLoadOptions);
}
private IQueryable<Data> TestDB(int itemsCreatorCounter)
{
var dbdata = new List<Data>();
for (var i = 0; i < itemsCreatorCounter; i++)
{
dbdata.Add(new Data
{
Id = i,
Text = $"Item {i}"
});
}
return dbdata.AsQueryable();
}
}
public class Data
{
public int Id { get; set; }
public string Text { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using DotVVM.Framework.Controls;
using DotVVM.Framework.ViewModel;
namespace DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.GridViewDataSet
{
public class GridViewDataSetDelegateViewModel : DotvvmViewModelBase
{
public int CallDelegateCounter { get; set; } = 0;
public override Task Init()
{
DataSet = Framework.Controls.GridViewDataSet.Create(GetData, pageSize: 3);
return base.Init();
}
public GridViewDataSet<Data> DataSet { get; set; }
public int ItemsCount { get; set; } = 20;
private GridViewDataSetLoadedData<Data> GetData(IGridViewDataSetLoadOptions gridViewDataSetLoadOptions)
{
//Debug.WriteLine($"GetData id {Thread.CurrentThread.ManagedThreadId}");
CallDelegateCounter++;
var queryable = TestDB(ItemsCount);
return queryable.GetDataFromQueryable(gridViewDataSetLoadOptions);
}
private IQueryable<Data> TestDB(int itemsCreatorCounter)
{
var dbdata = new List<Data>();
for (var i = 0; i < itemsCreatorCounter; i++)
{
dbdata.Add(new Data
{
Id = i,
Text = $"Item {i}"
});
}
return dbdata.AsQueryable();
}
}
public class Data
{
public int Id { get; set; }
public string Text { get; set; }
}
} | apache-2.0 | C# |
2ad629ebb269b3fbd8fe6d34be16851800813833 | Implement internal constructor for RateCounterGauge unit testsing. | Microsoft/ApplicationInsights-SDK-Labs | AggregateMetrics/AggregateMetrics/AzureWebApp/RateCounter.cs | AggregateMetrics/AggregateMetrics/AzureWebApp/RateCounter.cs | namespace Microsoft.ApplicationInsights.Extensibility.AggregateMetrics.AzureWebApp
{
using System;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility.AggregateMetrics.Two;
/// <summary>
/// Struct for metrics dependant on time.
/// </summary>
public class RateCounterGauge : ICounterValue
{
private string name;
private double? lastValue;
private dynamic cacheHelper;
/// <summary>
/// DateTime object to keep track of the last time this metric was retrieved.
/// </summary>
private DateTimeOffset dateTime;
/// <summary>
/// Initializes a new instance of <see cref="RateCounterGauge"/> class.
/// This constructor is intended for Unit Tests.
/// </summary>
/// <param name="name"> Name of the counter variable.</param>
/// <param name="cache"> Cache object.</param>
internal RateCounterGauge(string name, dynamic cache)
{
this.name = name;
this.cacheHelper = cache;
}
/// <summary>
/// Initializes a new instance of the <see cref="RateCounterGauge"/> class.
/// </summary>
/// <param name="name"> Name of counter variable.</param>
public RateCounterGauge(string name)
{
this.name = name;
this.cacheHelper = CacheHelper.Instance;
}
/// <summary>
/// Returns the current value of the rate counter if enough information exists.
/// </summary>
/// <returns> MetricTelemetry object.</returns>
public MetricTelemetry GetValueAndReset()
{
MetricTelemetry metric = new MetricTelemetry();
metric.Name = this.name;
DateTimeOffset currentTime = System.DateTimeOffset.Now;
if (this.lastValue == null)
{
this.lastValue = cacheHelper;
this.dateTime = currentTime;
return metric;
}
metric.Value = ((double)this.lastValue - cacheHelper) / (currentTime.Second - this.dateTime.Second);
this.lastValue = cacheHelper;
this.dateTime = currentTime;
return metric;
}
}
}
| namespace Microsoft.ApplicationInsights.Extensibility.AggregateMetrics.AzureWebApp
{
using System;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility.AggregateMetrics.Two;
/// <summary>
/// Struct for metrics dependant on time.
/// </summary>
public class RateCounterGauge : ICounterValue
{
private string name;
private double? lastValue;
/// <summary>
/// DateTime object to keep track of the last time this metric was retrieved.
/// </summary>
private DateTimeOffset dateTime;
/// <summary>
/// Initializes a new instance of the <see cref="RateCounterGauge"/> class.
/// </summary>
/// <param name="name"> Name of counter variable.</param>
public RateCounterGauge(string name)
{
this.name = name;
}
/// <summary>
/// Returns the current value of the rate counter if enough information exists.
/// </summary>
/// <returns> MetricTelemetry object.</returns>
public MetricTelemetry GetValueAndReset()
{
MetricTelemetry metric = new MetricTelemetry();
metric.Name = this.name;
DateTimeOffset currentTime = System.DateTimeOffset.Now;
if (this.lastValue == null)
{
this.lastValue = CacheHelper.Instance.GetCounterValue(this.name);
this.dateTime = currentTime;
return metric;
}
metric.Value = ((double)this.lastValue - CacheHelper.Instance.GetCounterValue(this.name)) / (currentTime.Second - this.dateTime.Second);
this.lastValue = CacheHelper.Instance.GetCounterValue(this.name);
this.dateTime = currentTime;
return metric;
}
}
}
| mit | C# |
54794ffd5094bfc87b204182632b394d09eb7dc2 | Fix path to annotations in tests | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/test/src/AnnotationsLoader.cs | resharper/resharper-unity/test/src/AnnotationsLoader.cs | using System;
using System.Collections.Generic;
using JetBrains.Application;
using JetBrains.Diagnostics;
using JetBrains.Metadata.Utils;
using JetBrains.ReSharper.Psi.ExtensionsAPI.ExternalAnnotations;
using JetBrains.TestFramework.Utils;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.Tests
{
[ShellComponent]
public class AnnotationsLoader : IExternalAnnotationsFileProvider
{
private readonly OneToSetMap<string, VirtualFileSystemPath> myAnnotations;
public AnnotationsLoader()
{
myAnnotations = new OneToSetMap<string, VirtualFileSystemPath>(StringComparer.OrdinalIgnoreCase);
var testDataPathBase = TestUtil.GetTestDataPathBase(GetType().Assembly).ToVirtualFileSystemPath();
var annotationsPath = testDataPathBase.Parent.Parent / "src" / "Unity" / "annotations";
Assertion.Assert(annotationsPath.ExistsDirectory, $"Cannot find annotations: {annotationsPath}");
var annotationFiles = annotationsPath.GetChildFiles();
foreach (var annotationFile in annotationFiles)
{
myAnnotations.Add(annotationFile.NameWithoutExtension, annotationFile);
}
}
public IEnumerable<VirtualFileSystemPath> GetAnnotationsFiles(AssemblyNameInfo assemblyName = null, VirtualFileSystemPath assemblyLocation = null)
{
if (assemblyName == null)
return myAnnotations.Values;
return myAnnotations[assemblyName.Name];
}
}
} | using System;
using System.Collections.Generic;
using JetBrains.Application;
using JetBrains.Diagnostics;
using JetBrains.Metadata.Utils;
using JetBrains.ReSharper.Psi.ExtensionsAPI.ExternalAnnotations;
using JetBrains.TestFramework.Utils;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity.Tests
{
[ShellComponent]
public class AnnotationsLoader : IExternalAnnotationsFileProvider
{
private readonly OneToSetMap<string, VirtualFileSystemPath> myAnnotations;
public AnnotationsLoader()
{
myAnnotations = new OneToSetMap<string, VirtualFileSystemPath>(StringComparer.OrdinalIgnoreCase);
var testDataPathBase = TestUtil.GetTestDataPathBase(GetType().Assembly).ToVirtualFileSystemPath();
var annotationsPath = testDataPathBase.Parent.Parent / "src" / "annotations";
Assertion.Assert(annotationsPath.ExistsDirectory, $"Cannot find annotations: {annotationsPath}");
var annotationFiles = annotationsPath.GetChildFiles();
foreach (var annotationFile in annotationFiles)
{
myAnnotations.Add(annotationFile.NameWithoutExtension, annotationFile);
}
}
public IEnumerable<VirtualFileSystemPath> GetAnnotationsFiles(AssemblyNameInfo assemblyName = null, VirtualFileSystemPath assemblyLocation = null)
{
if (assemblyName == null)
return myAnnotations.Values;
return myAnnotations[assemblyName.Name];
}
}
} | apache-2.0 | C# |
e85f4e522c5687292f9819b4a6667dd698f79fe2 | Rename LinkTest methods | pawotter/mastodon-api-cs | Mastodon.API.Tests/LinkTest.cs | Mastodon.API.Tests/LinkTest.cs | using System;
using NUnit.Framework;
using System.Net.Http.Headers;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Reflection;
namespace Mastodon.API.Tests
{
[TestFixture]
public class LinkTest
{
[Test]
public void CreateNextAndPrevLinkTest()
{
var str = TestUtils.GetResource("Mastodon.API.Tests.Resources.next_and_prev_link");
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.NotNull(link);
Assert.AreEqual(1860868, link.Value.MaxId);
Assert.AreEqual(1874433, link.Value.SinceId);
}
[Test]
public void CreateNextLinkTest()
{
var str = TestUtils.GetResource("Mastodon.API.Tests.Resources.next_link");
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.NotNull(link);
Assert.AreEqual(1860868, link.Value.MaxId);
Assert.Null(link.Value.SinceId);
}
[Test]
public void CreatePrevLinkTest()
{
var str = TestUtils.GetResource("Mastodon.API.Tests.Resources.prev_link");
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.NotNull(link);
Assert.Null(link.Value.MaxId);
Assert.AreEqual(1874433, link.Value.SinceId);
}
[Test]
public void CreateLinkTestWithEmptyString()
{
var str = "";
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.Null(link);
}
}
}
| using System;
using NUnit.Framework;
using System.Net.Http.Headers;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Reflection;
namespace Mastodon.API.Tests
{
[TestFixture]
public class LinkTest
{
[Test]
public void createNextAndPrevLinkTest()
{
var str = TestUtils.GetResource("Mastodon.API.Tests.Resources.next_and_prev_link");
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.NotNull(link);
Assert.AreEqual(1860868, link.Value.MaxId);
Assert.AreEqual(1874433, link.Value.SinceId);
}
[Test]
public void createNextLinkTest()
{
var str = TestUtils.GetResource("Mastodon.API.Tests.Resources.next_link");
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.NotNull(link);
Assert.AreEqual(1860868, link.Value.MaxId);
Assert.Null(link.Value.SinceId);
}
[Test]
public void createPrevLinkTest()
{
var str = TestUtils.GetResource("Mastodon.API.Tests.Resources.prev_link");
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.NotNull(link);
Assert.Null(link.Value.MaxId);
Assert.AreEqual(1874433, link.Value.SinceId);
}
[Test]
public void createLinkTestWithEmptyString()
{
var str = "";
var link = Link.CreateLinkFromHeaderLinkValue(str);
Assert.Null(link);
}
}
}
| mit | C# |
84e5d348c17551f4b013d52c99308626084c78bd | Add a playback state property to the playlist | flagbug/Espera.Network | Espera.Network/NetworkPlaylist.cs | Espera.Network/NetworkPlaylist.cs | using System.Collections.ObjectModel;
namespace Espera.Network
{
public class NetworkPlaylist
{
public int? CurrentIndex { get; set; }
public string Name { get; set; }
public NetworkPlaybackState PlaybackState { get; set; }
public int? RemainingVotes { get; set; }
public ReadOnlyCollection<NetworkSong> Songs { get; set; }
}
} | using System.Collections.ObjectModel;
namespace Espera.Network
{
public class NetworkPlaylist
{
public int? CurrentIndex { get; set; }
public string Name { get; set; }
public int? RemainingVotes { get; set; }
public ReadOnlyCollection<NetworkSong> Songs { get; set; }
}
} | mit | C# |
b919cbcf979b1fb7d50e77ff1b336c851805b183 | Mark get as obsolete to discourage use | opentable/hobknob-client-net,opentable/hobknob-client-net | HobknobClientNet/HobknobClient.cs | HobknobClientNet/HobknobClient.cs | using System;
namespace HobknobClientNet
{
public class HobknobClient : IDisposable
{
public event EventHandler<CacheUpdatedArgs> CacheUpdated;
public event EventHandler<CacheUpdateFailedArgs> CacheUpdateFailed;
private readonly FeatureToggleCache _featureToggleCache;
private readonly string _applicationName;
internal HobknobClient(FeatureToggleCache featureToggleCache, string applicationName)
{
_featureToggleCache = featureToggleCache;
_applicationName = applicationName;
_featureToggleCache.CacheUpdated += RaiseCacheUpdatedEvent;
_featureToggleCache.CacheUpdateFailed += RaiseCacheUpdateFailedEvent;
}
[Obsolete("Get is dangerous and will be removed in a future version. Use GetOrDefault instead")]
public bool Get(string toggleName)
{
var value = _featureToggleCache.Get(toggleName);
if (!value.HasValue)
{
throw new Exception(string.Format("Key not found for toggle {0}/{1}", _applicationName, toggleName));
}
return value.Value;
}
public bool GetOrDefault(string featureToggleName, bool defaultValue)
{
return _featureToggleCache.Get(featureToggleName).GetValueOrDefault(defaultValue);
}
private void RaiseCacheUpdatedEvent(object sender, CacheUpdatedArgs eventArgs)
{
if (CacheUpdated != null)
{
CacheUpdated(sender, eventArgs);
}
}
private void RaiseCacheUpdateFailedEvent(object sender, CacheUpdateFailedArgs eventArgs)
{
if (CacheUpdateFailed != null)
{
CacheUpdateFailed(sender, eventArgs);
}
}
public void Dispose()
{
_featureToggleCache.CacheUpdated -= RaiseCacheUpdatedEvent;
_featureToggleCache.CacheUpdateFailed -= RaiseCacheUpdateFailedEvent;
if (_featureToggleCache != null)
{
_featureToggleCache.Dispose();
}
}
}
}
| using System;
namespace HobknobClientNet
{
public class HobknobClient : IDisposable
{
public event EventHandler<CacheUpdatedArgs> CacheUpdated;
public event EventHandler<CacheUpdateFailedArgs> CacheUpdateFailed;
private readonly FeatureToggleCache _featureToggleCache;
private readonly string _applicationName;
internal HobknobClient(FeatureToggleCache featureToggleCache, string applicationName)
{
_featureToggleCache = featureToggleCache;
_applicationName = applicationName;
_featureToggleCache.CacheUpdated += RaiseCacheUpdatedEvent;
_featureToggleCache.CacheUpdateFailed += RaiseCacheUpdateFailedEvent;
}
public bool Get(string toggleName)
{
var value = _featureToggleCache.Get(toggleName);
if (!value.HasValue)
{
throw new Exception(string.Format("Key not found for toggle {0}/{1}", _applicationName, toggleName));
}
return value.Value;
}
public bool GetOrDefault(string featureToggleName, bool defaultValue)
{
return _featureToggleCache.Get(featureToggleName).GetValueOrDefault(defaultValue);
}
private void RaiseCacheUpdatedEvent(object sender, CacheUpdatedArgs eventArgs)
{
if (CacheUpdated != null)
{
CacheUpdated(sender, eventArgs);
}
}
private void RaiseCacheUpdateFailedEvent(object sender, CacheUpdateFailedArgs eventArgs)
{
if (CacheUpdateFailed != null)
{
CacheUpdateFailed(sender, eventArgs);
}
}
public void Dispose()
{
_featureToggleCache.CacheUpdated -= RaiseCacheUpdatedEvent;
_featureToggleCache.CacheUpdateFailed -= RaiseCacheUpdateFailedEvent;
if (_featureToggleCache != null)
{
_featureToggleCache.Dispose();
}
}
}
}
| mit | C# |
27cb3eda848c0262718bf4d1a0d3eba05299a86b | fix comparison | aloneartist/libsass-net,darrenkopp/libsass-net,am11/libsass-net,sass/libsass-net,aloneartist/libsass-net | libsassnet.Web/SassHandler.cs | libsassnet.Web/SassHandler.cs | using System;
using System.IO;
//Copyright (C) 2013 by TBAPI-0KA
//
//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.Web;
namespace LibSassNet.Web
{
public class SassHandler : IHttpHandler
{
private readonly ISassCompiler Compiler = new SassCompiler();
public void ProcessRequest(HttpContext context)
{
string path = context.Server.MapPath(String.Format("~{0}", context.Request.Path));
var file = new FileInfo(path);
if (!file.Name.StartsWith("_") && string.Equals(file.Extension, ".scss", StringComparison.OrdinalIgnoreCase))
{
string output = Compiler.CompileFile(path).CSS;
context.Response.ContentType = "text/css";
context.Response.Write(output);
} else if (file.Name.EndsWith(".css", StringComparison.OrdinalIgnoreCase) && string.Equals(file.Extension, ".map", StringComparison.OrdinalIgnoreCase))
{
string output = Compiler.CompileFile(path).SourceMap;
context.Response.Write(output);
}
}
public bool IsReusable { get { return true; } }
}
}
| using System;
using System.IO;
//Copyright (C) 2013 by TBAPI-0KA
//
//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.Web;
namespace LibSassNet.Web
{
public class SassHandler : IHttpHandler
{
private readonly ISassCompiler Compiler = new SassCompiler();
public void ProcessRequest(HttpContext context)
{
string path = context.Server.MapPath(String.Format("~{0}", context.Request.Path));
var file = new FileInfo(path);
if (!file.Name.StartsWith("_") && string.Equals(file.Extension, "scss", StringComparison.OrdinalIgnoreCase))
{
string output = Compiler.CompileFile(path).CSS;
context.Response.ContentType = "text/css";
context.Response.Write(output);
} else if (file.Name.EndsWith("css", StringComparison.OrdinalIgnoreCase) && string.Equals(file.Extension, "map", StringComparison.OrdinalIgnoreCase))
{
string output = Compiler.CompileFile(path).SourceMap;
context.Response.Write(output);
}
}
public bool IsReusable { get { return true; } }
}
}
| mit | C# |
4a8f099e5debe7ab4d532d4c726b0a83ef92d923 | update s | autumn009/TanoCSharpSamples | Chap4/デリゲート型はインスタンスを区別する/デリゲート型はインスタンスを区別する/Program.cs | Chap4/デリゲート型はインスタンスを区別する/デリゲート型はインスタンスを区別する/Program.cs | using System;
class A
{
internal string S;
internal void Say()
{
Console.WriteLine(S);
}
}
class Program
{
private static void doit(Action sayit)
{
sayit();
}
static void Main(string[] args)
{
A a = new A();
a.S = "I am one";
A b = new A();
b.S = "I am two";
doit(a.Say);
doit(b.Say);
}
}
| using System;
class A
{
internal string S;
internal void Say()
{
Console.WriteLine(S);
}
}
class Program
{
private static void doit(Action sayit)
{
sayit();
}
static void Main(string[] args)
{
A a = new A() { S = "I am one" };
A b = new A() { S = "I am two" };
doit(a.Say);
doit(b.Say);
}
}
| mit | C# |
ba58a54170a62529240753b60294c72b5d190d84 | Update Index.cshtml | senzacionale/jQuery.Validation.Unobtrusive.Native,johnnyreilly/jQuery.Validation.Unobtrusive.Native,johnnyreilly/jQuery.Validation.Unobtrusive.Native,johnnyreilly/jQuery.Validation.Unobtrusive.Native | jVUNDemo/Views/Home/Index.cshtml | jVUNDemo/Views/Home/Index.cshtml | @section metatags{
<meta name="Description" content="Provides MVC HTML helper extensions that marry jQuery Validation's native unobtrusive support for validation driven by HTML 5 data attributes with MVC's ability to generate data attributes from Model metadata. With this in place you can use jQuery Validation as it is - you don't need to include jquery.validate.unobtrusive.js.">
}
<h3>What is jQuery Validation Unobtrusive Native?</h3>
<p>jQuery Validation Unobtrusive Native is a collection of ASP.Net MVC HTML helper extensions. These make use of jQuery Validation's native support for validation driven by HTML 5 data attributes. Microsoft shipped <a href="http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html" target="_blank">jquery.validate.unobtrusive.js</a> back with MVC 3. It provided a way to apply data model validations to the client side using a combination of jQuery Validation and HTML 5 data attributes (that's the "unobtrusive" part).</p>
<p>The principal of this was and is fantastic. But since that time the jQuery Validation project has implemented its own support for driving validation unobtrusively (which shipped with <a href="http://jquery.bassistance.de/validate/changelog.txt" target="_blank">jQuery Validation 1.11.0</a>). The main advantages of using the native support over jquery.validate.unobtrusive.js are:</p>
<ol>
<li>Dynamically created form elements are parsed automatically. jquery.validate.unobtrusive.js does not support this whilst jQuery Validation does.<br />
@Html.ActionLink("See a demo", "Dynamic", "AdvancedDemo")<br /><br /></li>
<li>jquery.validate.unobtrusive.js restricts how you use jQuery Validation. If you want to use showErrors or something similar then you may find that you need to go native (or at least you may find that significantly easier than working with the jquery.validate.unobtrusive.js defaults)...<br />
@Html.ActionLink("See a demo", "Tooltip", "AdvancedDemo")<br /><br /></li>
<li>Send less code to your browser, make your browser to do less work, get a performance benefit (though in all honesty you'd probably have to be the Flash to actually notice the difference...)</li>
</ol>
<p>This project intends to be a bridge between MVC's inbuilt support for driving validation from data attributes and jQuery Validation's native support for the same. This is achieved by hooking into the MVC data attribute creation mechanism and using it to generate the data attributes used by jQuery Validation.</p>
<h4>Future Plans</h4>
<p>So far the basic set of the HtmlHelpers and their associated unobtrusive mappings have been implemented. If any have been missed then let me know. As time goes by I intend to:</p>
<ul>
<li>fill in any missing gaps there may be</li>
<li>maintain MVC 3, 4, 5 (and when the time comes 6+) versions of this on Nuget</li>
<li>get the unit test coverage to a good level and (most importantly)</li>
<li>create some really useful demos and documentation.</li>
</ul>
<p>Help is appreciated so feel free to pitch in! You can find the project on <a href="http://github.com/johnnyreilly/jQuery.Validation.Unobtrusive.Native" target="_blank">GitHub</a>...</p>
| @section metatags{
<meta name="Description" content="Provides MVC HTML helper extensions that marry jQuery Validation's native unobtrusive support for validation driven by HTML 5 data attributes with MVC's ability to generate data attributes from Model metadata. With this in place you can use jQuery Validation as it is - you don't need jquery.validate.unobtrusive.js.">
}
<h3>What is jQuery Validation Unobtrusive Native?</h3>
<p>jQuery Validation Unobtrusive Native is a collection of ASP.Net MVC HTML helper extensions. These make use of jQuery Validation's native support for validation driven by HTML 5 data attributes. Microsoft shipped <a href="http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html" target="_blank">jquery.validate.unobtrusive.js</a> back with MVC 3. It provided a way to apply data model validations to the client side using a combination of jQuery Validation and HTML 5 data attributes (that's the "unobtrusive" part).</p>
<p>The principal of this was and is fantastic. But since that time the jQuery Validation project has implemented its own support for driving validation unobtrusively (which shipped with <a href="http://jquery.bassistance.de/validate/changelog.txt" target="_blank">jQuery Validation 1.11.0</a>). The main advantages of using the native support over jquery.validate.unobtrusive.js are:</p>
<ol>
<li>Dynamically created form elements are parsed automatically. jquery.validate.unobtrusive.js does not support this whilst jQuery Validation does.<br />
@Html.ActionLink("See a demo", "Dynamic", "AdvancedDemo")<br /><br /></li>
<li>jquery.validate.unobtrusive.js restricts how you use jQuery Validation. If you want to use showErrors or something similar then you may find that you need to go native (or at least you may find that significantly easier than working with the jquery.validate.unobtrusive.js defaults)...<br />
@Html.ActionLink("See a demo", "Tooltip", "AdvancedDemo")<br /><br /></li>
<li>Send less code to your browser, make your browser to do less work, get a performance benefit (though in all honesty you'd probably have to be the Flash to actually notice the difference...)</li>
</ol>
<p>This project intends to be a bridge between MVC's inbuilt support for driving validation from data attributes and jQuery Validation's native support for the same. This is achieved by hooking into the MVC data attribute creation mechanism and using it to generate the data attributes used by jQuery Validation.</p>
<h4>Future Plans</h4>
<p>So far the basic set of the HtmlHelpers and their associated unobtrusive mappings have been implemented. If any have been missed then let me know. As time goes by I intend to:</p>
<ul>
<li>fill in any missing gaps there may be</li>
<li>maintain MVC 3, 4, 5 (and when the time comes 6+) versions of this on Nuget</li>
<li>get the unit test coverage to a good level and (most importantly)</li>
<li>create some really useful demos and documentation.</li>
</ul>
<p>Help is appreciated so feel free to pitch in! You can find the project on <a href="http://github.com/johnnyreilly/jQuery.Validation.Unobtrusive.Native" target="_blank">GitHub</a>...</p>
| mit | C# |
512974b97281c9e9e49fa2fcb9f12d07e4b93174 | Update BatchOperationHelper.cs | tiksn/TIKSN-Framework | TIKSN.Core/Data/BatchOperationHelper.cs | TIKSN.Core/Data/BatchOperationHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data
{
public static class BatchOperationHelper
{
public static Task BatchOperationAsync<T>(IEnumerable<T> entities, CancellationToken cancellationToken, Func<T, CancellationToken, Task> singleOperation)
{
if (entities == null)
{
throw new ArgumentNullException(nameof(entities));
}
if (singleOperation == null)
{
throw new ArgumentNullException(nameof(singleOperation));
}
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
public static Task<TResult[]> BatchOperationAsync<T, TResult>(IEnumerable<T> entities, CancellationToken cancellationToken, Func<T, CancellationToken, Task<TResult>> singleOperation)
{
if (entities == null)
{
throw new ArgumentNullException(nameof(entities));
}
if (singleOperation == null)
{
throw new ArgumentNullException(nameof(singleOperation));
}
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data
{
public static class BatchOperationHelper
{
public static Task BatchOperationAsync<T>(IEnumerable<T> entities, CancellationToken cancellationToken, Func<T, CancellationToken, Task> singleOperation)
{
if (entities == null)
throw new ArgumentNullException(nameof(entities));
if (singleOperation == null)
throw new ArgumentNullException(nameof(singleOperation));
var tasks = entities.Select(entity => singleOperation?.Invoke(entity, cancellationToken));
return Task.WhenAll(tasks);
}
}
} | mit | C# |
1ba392cbd559ee85b25a811b35d56f8eccd23281 | Fix bug about not redirecting to forums | leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net | JoinRpg.Portal/Controllers/Comments/CommentRedirectHelper.cs | JoinRpg.Portal/Controllers/Comments/CommentRedirectHelper.cs | using JoinRpg.DataModel;
using JoinRpg.Domain;
using Microsoft.AspNetCore.Mvc;
namespace JoinRpg.Portal.Controllers.Comments
{
internal static class CommentRedirectHelper
{
public static ActionResult RedirectToDiscussion(IUrlHelper Url, CommentDiscussion discussion, int? commentId = null)
{
var extra = commentId != null ? $"#comment{commentId}" : null;
var claim = discussion.GetClaim();
if (claim != null)
{
var actionLink = Url.Action("Edit", "Claim", new { claim.ClaimId, discussion.ProjectId });
return new RedirectResult(actionLink + extra);
}
var forumThread = discussion.GetForumThread();
if (forumThread != null)
{
var actionLink = Url.Action("ViewThread", "Forum", new { discussion.ProjectId, forumThread.ForumThreadId });
return new RedirectResult(actionLink + extra);
}
return new NotFoundResult();
}
}
}
| using JoinRpg.DataModel;
using JoinRpg.Domain;
using Microsoft.AspNetCore.Mvc;
namespace JoinRpg.Portal.Controllers.Comments
{
internal static class CommentRedirectHelper
{
public static ActionResult RedirectToDiscussion(IUrlHelper Url, CommentDiscussion discussion, int? commentId = null)
{
var extra = commentId != null ? $"#comment{commentId}" : null;
var claim = discussion.GetClaim();
if (claim != null)
{
var actionLink = Url.Action("Edit", "Claim", new { claim.ClaimId, discussion.ProjectId });
return new RedirectResult(actionLink + extra);
}
var forumThread = discussion.GetForumThread();
if (forumThread != null)
{
var actionLink = Url.Action("ViewThread", new { discussion.ProjectId, forumThread.ForumThreadId });
return new RedirectResult(actionLink + extra);
}
return new NotFoundResult();
}
}
}
| mit | C# |
2bd356c9f55c1076b156007f97d90cbf3b24f505 | Add support for BACS Debit as a `Capability` on `Account` | stripe/stripe-dotnet | src/Stripe.net/Entities/Accounts/AccountCapabilities.cs | src/Stripe.net/Entities/Accounts/AccountCapabilities.cs | namespace Stripe
{
using System;
using Newtonsoft.Json;
public class AccountCapabilities : StripeEntity<AccountCapabilities>
{
/// <summary>
/// The status of the BECS Direct Debit (AU) payments capability of the account, or whether
/// the account can directly process BECS Direct Debit (AU) charges.
/// </summary>
[JsonProperty("au_becs_debit_payments")]
public string AuBecsDebitPayments { get; set; }
/// <summary>
/// The status of the Bacs Direct Debits payments capability of the account, or whether the
/// account can directly process Bacs Direct Debits charges.
/// </summary>
[JsonProperty("bacs_debit_payments")]
public string BacsDebitPayments { get; set; }
/// <summary>
/// The status of the card issuing capability of the account, or whether you can use Issuing
/// to distribute funds on cards.
/// </summary>
[JsonProperty("card_issuing")]
public string CardIssuing { get; set; }
/// <summary>
/// The status of the card payments capability of the account, or whether the account can
/// directly process credit and debit card charges.
/// </summary>
[JsonProperty("card_payments")]
public string CardPayments { get; set; }
/// <summary>
/// The status of the JCB payments capability of the account, or whether the account (Japan
/// only) can directly process JCB credit card charges in JPY currency.
/// </summary>
[JsonProperty("jcb_payments")]
public string JcbPayments { get; set; }
/// <summary>
/// The status of the legacy payments capability of the account.
/// </summary>
[JsonProperty("legacy_payments")]
public string LegacyPayments { get; set; }
/// <summary>
/// The status of the tax reporting 1099-K (US) capability of the account.
/// </summary>
[JsonProperty("tax_reporting_us_1099_k")]
public string TaxReportingUs1099K { get; set; }
/// <summary>
/// The status of the tax reporting 1099-MISC (US) capability of the account.
/// </summary>
[JsonProperty("tax_reporting_us_1099_misc")]
public string TaxReportingUs1099Misc { get; set; }
/// <summary>
/// The status of the transfers capability of the account, or whether your platform can
/// transfer funds to the account.
/// </summary>
[JsonProperty("transfers")]
public string Transfers { get; set; }
}
}
| namespace Stripe
{
using System;
using Newtonsoft.Json;
public class AccountCapabilities : StripeEntity<AccountCapabilities>
{
/// <summary>
/// The status of the BECS Direct Debit (AU) payments capability of the account, or whether
/// the account can directly process BECS Direct Debit (AU) charges.
/// </summary>
[JsonProperty("au_becs_debit_payments")]
public string AuBecsDebitPayments { get; set; }
/// <summary>
/// The status of the card issuing capability of the account, or whether you can use Issuing
/// to distribute funds on cards.
/// </summary>
[JsonProperty("card_issuing")]
public string CardIssuing { get; set; }
/// <summary>
/// The status of the card payments capability of the account, or whether the account can
/// directly process credit and debit card charges.
/// </summary>
[JsonProperty("card_payments")]
public string CardPayments { get; set; }
/// <summary>
/// The status of the JCB payments capability of the account, or whether the account (Japan
/// only) can directly process JCB credit card charges in JPY currency.
/// </summary>
[JsonProperty("jcb_payments")]
public string JcbPayments { get; set; }
/// <summary>
/// The status of the legacy payments capability of the account.
/// </summary>
[JsonProperty("legacy_payments")]
public string LegacyPayments { get; set; }
/// <summary>
/// The status of the tax reporting 1099-K (US) capability of the account.
/// </summary>
[JsonProperty("tax_reporting_us_1099_k")]
public string TaxReportingUs1099K { get; set; }
/// <summary>
/// The status of the tax reporting 1099-MISC (US) capability of the account.
/// </summary>
[JsonProperty("tax_reporting_us_1099_misc")]
public string TaxReportingUs1099Misc { get; set; }
/// <summary>
/// The status of the transfers capability of the account, or whether your platform can
/// transfer funds to the account.
/// </summary>
[JsonProperty("transfers")]
public string Transfers { get; set; }
}
}
| apache-2.0 | C# |
63e7ba127bd1c6d5b5c12bfee299ca9940e6b0d9 | Fix up message severities. | modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS | DanTup.DartVS.Vsix/DartErrorListProvider.cs | DanTup.DartVS.Vsix/DartErrorListProvider.cs | using System;
using System.Linq;
using DanTup.DartAnalysis;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
namespace DanTup.DartVS
{
internal class DartErrorListProvider
{
DTE dte;
ErrorListProvider errorProvider;
internal DartErrorListProvider(DTE dte, DartPackage package)
{
this.dte = dte;
errorProvider = new ErrorListProvider(package);
}
internal void UpdateErrors(AnalysisErrorsNotification errorNotification)
{
errorProvider.SuspendRefresh();
RemoveErrorsForFile(errorNotification.File);
var errorTasks = errorNotification.Errors.Select(CreateErrorTask);
foreach (var error in errorTasks)
{
error.Navigate += (s, e) =>
{
error.Line++; // Line number seems 0-based in most places, but Navigate didn't get the memo :(
errorProvider.Navigate(error, new Guid(EnvDTE.Constants.vsViewKindCode));
error.Line--;
};
errorProvider.Tasks.Add(error);
}
errorProvider.ResumeRefresh();
errorProvider.Show();
errorProvider.ForceShowErrors();
}
void RemoveErrorsForFile(string path)
{
var staleTasks = errorProvider.Tasks.OfType<ErrorTask>().Where(t => t.Document == path).ToArray();
foreach (var staleTask in staleTasks)
errorProvider.Tasks.Remove(staleTask);
}
private ErrorTask CreateErrorTask(AnalysisError analysisError)
{
return new ErrorTask
{
ErrorCategory =
analysisError.Severity == AnalysisErrorSeverity.Error ? TaskErrorCategory.Error
: analysisError.Severity == AnalysisErrorSeverity.Warning ? TaskErrorCategory.Warning
: TaskErrorCategory.Message,
Text = analysisError.Message,
Document = analysisError.Location.File,
Line = analysisError.Location.StartLine - 1, // Line appears to be 0-based in VS! :-(
Column = analysisError.Location.StartColumn
};
}
}
}
| using System;
using System.Linq;
using DanTup.DartAnalysis;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
namespace DanTup.DartVS
{
internal class DartErrorListProvider
{
DTE dte;
ErrorListProvider errorProvider;
internal DartErrorListProvider(DTE dte, DartPackage package)
{
this.dte = dte;
errorProvider = new ErrorListProvider(package);
}
internal void UpdateErrors(AnalysisErrorsNotification errorNotification)
{
errorProvider.SuspendRefresh();
RemoveErrorsForFile(errorNotification.File);
var errorTasks = errorNotification.Errors.Select(CreateErrorTask);
foreach (var error in errorTasks)
{
error.Navigate += (s, e) =>
{
error.Line++; // Line number seems 0-based in most places, but Navigate didn't get the memo :(
errorProvider.Navigate(error, new Guid(EnvDTE.Constants.vsViewKindCode));
error.Line--;
};
errorProvider.Tasks.Add(error);
}
errorProvider.ResumeRefresh();
errorProvider.Show();
errorProvider.ForceShowErrors();
}
void RemoveErrorsForFile(string path)
{
var staleTasks = errorProvider.Tasks.OfType<ErrorTask>().Where(t => t.Document == path).ToArray();
foreach (var staleTask in staleTasks)
errorProvider.Tasks.Remove(staleTask);
}
private ErrorTask CreateErrorTask(AnalysisError analysisError)
{
return new ErrorTask
{
// TODO: This is bogus; they don't start with this anymore...
ErrorCategory =
analysisError.Message.StartsWith("hint") ? TaskErrorCategory.Message
: analysisError.Message.StartsWith("warning") ? TaskErrorCategory.Warning
: TaskErrorCategory.Error,
Text = analysisError.Message,
Document = analysisError.Location.File,
Line = analysisError.Location.StartLine - 1, // Line appears to be 0-based in VS! :-(
Column = analysisError.Location.StartColumn
};
}
}
}
| mit | C# |
dbb3f5c461cb6f941a9d36ebc93d7b0c8d46c22c | Bump version to 0.4.4 | NJAldwin/Pequot | Pequot/Properties/AssemblyInfo.cs | Pequot/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("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[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("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.4.*")]
[assembly: AssemblyFileVersion("0.4.4.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("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[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("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.3.*")]
[assembly: AssemblyFileVersion("0.4.3.0")]
| mit | C# |
8fecd8dcdc570f4ffb71706ca475950066eb6a4f | Fix sudden death not being applied on first run | peppy/osu-new,peppy/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu,UselessToucan/osu,johnneijzen/osu,NeoAdonis/osu,johnneijzen/osu,ZLima12/osu,ZLima12/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,2yangk23/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu | osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs | osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. 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.Game.Beatmaps;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.Mods;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests
{
public class TestSceneTaikoSuddenDeath : PlayerTestScene
{
public TestSceneTaikoSuddenDeath()
: base(new TaikoRuleset())
{
}
protected override bool AllowFail => true;
protected override Player CreatePlayer(Ruleset ruleset)
{
Mods.Value = Mods.Value.Concat(new[] { new TaikoModSuddenDeath() }).ToArray();
return new ScoreAccessiblePlayer();
}
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) =>
new TaikoBeatmap
{
HitObjects =
{
new Swell { StartTime = 1500 },
new Hit { StartTime = 100000 },
},
BeatmapInfo =
{
Ruleset = new TaikoRuleset().RulesetInfo
}
};
[Test]
public void TestSpinnerDoesNotFail()
{
bool judged = false;
AddStep("Setup judgements", () =>
{
judged = false;
((ScoreAccessiblePlayer)Player).ScoreProcessor.NewJudgement += b => judged = true;
});
AddUntilStep("swell judged", () => judged);
AddAssert("not failed", () => !Player.HasFailed);
}
private class ScoreAccessiblePlayer : TestPlayer
{
public ScoreAccessiblePlayer()
: base(false, false)
{
}
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. 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.Game.Beatmaps;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.Mods;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests
{
public class TestSceneTaikoSuddenDeath : PlayerTestScene
{
public TestSceneTaikoSuddenDeath()
: base(new TaikoRuleset())
{
}
protected override bool AllowFail => true;
protected override Player CreatePlayer(Ruleset ruleset) => new ScoreAccessiblePlayer();
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) =>
new TaikoBeatmap
{
HitObjects =
{
new Swell { StartTime = 1500 },
new Hit { StartTime = 100000 },
},
BeatmapInfo =
{
Ruleset = new TaikoRuleset().RulesetInfo
}
};
[Test]
public void TestSpinnerDoesNotFail()
{
bool judged = false;
AddStep("Setup judgements", () =>
{
judged = false;
Mods.Value = Mods.Value.Concat(new[] { new TaikoModSuddenDeath() }).ToArray();
((ScoreAccessiblePlayer)Player).ScoreProcessor.NewJudgement += b => judged = true;
});
AddUntilStep("swell judged", () => judged);
AddAssert("not failed", () => !Player.HasFailed);
}
private class ScoreAccessiblePlayer : TestPlayer
{
public ScoreAccessiblePlayer()
: base(false, false)
{
}
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
}
}
}
| mit | C# |
759e78f9bce449ae10abaaef713bf9a84524e60e | Update AssemblyInfo | dmayhak/HyperSlackers.ExtensionMethods | ExtensionMethods/Properties/AssemblyInfo.cs | ExtensionMethods/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("HyperSlackers.ExtensionMethods")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HyperSlackers")]
[assembly: AssemblyProduct("HyperSlackers.ExtensionMethods")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d21a03a-264e-4a18-accb-ba278c0784d7")]
// 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("2016.1.21.2202")]
[assembly: AssemblyFileVersion("2016.1.21.2202")]
| 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("ExtensionMethods")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtensionMethods")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d21a03a-264e-4a18-accb-ba278c0784d7")]
// 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("14.1020.1224.14")]
[assembly: AssemblyFileVersion("14.1020.1224.14")]
| mit | C# |
82fed7328c167b2347be5b0e8ef2d4b8cb3f198c | add choice on StringToken boundary | RushuiGuan/expression | Albatross.Expression/Tokens/StringLiteralToken.cs | Albatross.Expression/Tokens/StringLiteralToken.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Albatross.Expression.Exceptions;
namespace Albatross.Expression.Tokens {
/// <summary>
/// will take any string literal enclosed by double quotes. use back slash to escape.
/// Check the GetStringEscape function for escapable chars
/// </summary>
public class StringLiteralToken : IOperandToken {
public const char DoubleQuote = '"';
public const char EscapeChar = '\\';
public StringLiteralToken() : this(DoubleQuote) { }
public StringLiteralToken(char boundary) { Boundary = boundary; }
public virtual char Boundary { get; private set; }
public string Name { get; private set; }
public string Group { get { return "Literal"; } }
public bool Match(string expression, int start, out int next) {
next = expression.Length;
if (start < expression.Length) {
while (start < expression.Length && char.IsWhiteSpace(expression[start])) {
start++;
}
if (start < expression.Length && expression[start] == Boundary) {
StringBuilder sb = new StringBuilder();
bool escaped = false, closed = false;
char c;
int i;
for (i = start; i < expression.Length; i++) {
c = expression[i];
sb.Append(c);
if (c == Boundary && i != start && !escaped) {
closed = true;
break;
}
escaped = !escaped && c == EscapeChar;
}
if (!closed) {
throw new TokenParsingException("missing closing quote");
} else {
next = i + 1;
Name = sb.ToString();
return true;
}
}
}
return false;
}
char GetEscapedChar(char c) {
if (c == 'n') {
return '\n';
} else if (c == 't') {
return '\t';
} else if (c == Boundary || c == '\\') {
return c;
} else {
throw new TokenParsingException("Invalid string escape \\" + c);
}
}
public override string ToString() { return Name; }
public string EvalText(string format) {
return Name;
}
public IToken Clone() {
return new StringLiteralToken(Boundary) { Name = Name };
}
public object EvalValue(Func<string, object> context) {
StringBuilder sb = new StringBuilder();
bool escaped = false;
for (int i = 1; i < Name.Length - 1; i++) {
if (escaped) {
sb.Append(GetEscapedChar(Name[i]));
escaped = false;
} else {
escaped = Name[i] == EscapeChar;
if (!escaped) { sb.Append(Name[i]); }
}
}
return sb.ToString();
}
public bool IsVariable { get { return false; } }
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Albatross.Expression.Exceptions;
namespace Albatross.Expression.Tokens {
/// <summary>
/// will take any string literal enclosed by double quotes. use back slash to escape.
/// Check the GetStringEscape function for escapable chars
/// </summary>
public class StringLiteralToken : IOperandToken {
public const char StringLiteralQuote = '"';
public const char EscapeChar = '\\';
public string Name { get; private set; }
public string Group { get { return "Literal"; } }
public bool Match(string expression, int start, out int next) {
next = expression.Length;
if (start < expression.Length) {
while (start < expression.Length && char.IsWhiteSpace(expression[start])) {
start++;
}
if (start < expression.Length && expression[start] == StringLiteralQuote) {
StringBuilder sb = new StringBuilder();
bool escaped = false, closed = false;
char c;
int i;
for (i = start; i < expression.Length; i++) {
c = expression[i];
sb.Append(c);
if (c == StringLiteralQuote && i != start && !escaped) {
closed = true;
break;
}
escaped = !escaped && c == EscapeChar;
}
if (!closed) {
throw new TokenParsingException("missing closing quote");
} else {
next = i + 1;
Name = sb.ToString();
return true;
}
}
}
return false;
}
char GetEscapedChar(char c) {
switch (c) {
case 'n':
return '\n';
case 't':
return '\t';
case '"':
case '\\':
return c;
default:
throw new TokenParsingException("Invalid string escape \\" + c);
}
}
public override string ToString() { return Name; }
public string EvalText(string format) {
return Name;
}
public IToken Clone() {
return new StringLiteralToken() { Name = Name };
}
public static string Build(string input) {
return "\"" + input.Replace("\"", "\\\"") + "\"";
}
public object EvalValue(Func<string, object> context) {
StringBuilder sb = new StringBuilder();
bool escaped = false;
for (int i = 1; i < Name.Length - 1; i++) {
if (escaped) {
sb.Append(GetEscapedChar(Name[i]));
escaped = false;
} else {
escaped = Name[i] == EscapeChar;
if (!escaped) { sb.Append(Name[i]); }
}
}
return sb.ToString();
}
public bool IsVariable { get { return false; } }
}
} | mit | C# |
0809045d2304d4ca1457009e305d98dc3c23f6df | Check for podcast keywords (#513) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Extensions/SyndicationItemExtensions.cs | src/Firehose.Web/Extensions/SyndicationItemExtensions.cs | using System.Linq;
using System.ServiceModel.Syndication;
namespace Firehose.Web.Extensions
{
public static class SyndicationItemExtensions
{
public static bool ApplyDefaultFilter(this SyndicationItem item)
{
var hasXamarinCategory = false;
if (item.Categories.Count > 0)
hasXamarinCategory = item.Categories.Any(category =>
category.Name.ToLowerInvariant().Contains("xamarin"));
else if(item.ElementExtensions.Count > 0)
{
var element = item.ElementExtensions.Where(e => e.OuterName == "keywords").FirstOrDefault();
if(element != null)
{
var keywords = element.GetObject<string>();
hasXamarinCategory = keywords.ToLowerInvariant().Contains("xamarin");
}
}
var hasXamarinTitle = item.Title?.Text.ToLowerInvariant().Contains("xamarin") ?? false;
return hasXamarinTitle || hasXamarinCategory;
}
}
} | using System.Linq;
using System.ServiceModel.Syndication;
namespace Firehose.Web.Extensions
{
public static class SyndicationItemExtensions
{
public static bool ApplyDefaultFilter(this SyndicationItem item)
{
var hasXamarinCategory = false;
if (item.Categories.Count > 0)
hasXamarinCategory = item.Categories.Any(category =>
category.Name.ToLowerInvariant().Contains("xamarin"));
var hasXamarinTitle = item.Title?.Text.ToLowerInvariant().Contains("xamarin") ?? false;
return hasXamarinTitle || hasXamarinCategory;
}
}
} | mit | C# |
2d41f700d6fd8fc8e1604dd1e6922c441fce3e5c | Fix code. | Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex | backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsJsonTests.cs | backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsJsonTests.cs | // ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschränkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using FluentAssertions;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Core.TestHelpers;
using Xunit;
namespace Squidex.Domain.Apps.Core.Model.Apps
{
public class AppContributorsJsonTests
{
[Fact]
public void Should_serialize_and_deserialize()
{
var contributors = AppContributors.Empty;
contributors = contributors.Assign("1", Role.Developer);
contributors = contributors.Assign("2", Role.Editor);
contributors = contributors.Assign("3", Role.Owner);
var serialized = contributors.SerializeAndDeserialize();
serialized.Should().BeEquivalentTo(contributors);
}
}
}
| // ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschränkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using FluentAssertions;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Core.TestHelpers;
using Xunit;
namespace Squidex.Domain.Apps.Core.Model.Apps
{
public class AppContributorsJsonTests
{
[Fact]
public void #()
{
var contributors = AppContributors.Empty;
contributors = contributors.Assign("1", Role.Developer);
contributors = contributors.Assign("2", Role.Editor);
contributors = contributors.Assign("3", Role.Owner);
var serialized = contributors.SerializeAndDeserialize();
serialized.Should().BeEquivalentTo(contributors);
}
}
}
| mit | C# |
e4b296e16ee7b144e0529c7890328c14b7eb5389 | Use `OptIn` serialisation on `SkinInfo` to avoid writing unnecessary information | ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu | osu.Game/Skinning/SkinInfo.cs | osu.Game/Skinning/SkinInfo.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.IO;
using osu.Game.Models;
using Realms;
#nullable enable
namespace osu.Game.Skinning
{
[ExcludeFromDynamicCompile]
[MapTo("Skin")]
[JsonObject(MemberSerialization.OptIn)]
public class SkinInfo : RealmObject, IHasRealmFiles, IEquatable<SkinInfo>, IHasGuidPrimaryKey, ISoftDelete, IHasNamedFiles
{
internal static readonly Guid DEFAULT_SKIN = new Guid("2991CFD8-2140-469A-BCB9-2EC23FBCE4AD");
internal static readonly Guid CLASSIC_SKIN = new Guid("81F02CD3-EEC6-4865-AC23-FAE26A386187");
internal static readonly Guid RANDOM_SKIN = new Guid("D39DFEFB-477C-4372-B1EA-2BCEA5FB8908");
[PrimaryKey]
[JsonProperty]
public Guid ID { get; set; } = Guid.NewGuid();
[JsonProperty]
public string Name { get; set; } = string.Empty;
[JsonProperty]
public string Creator { get; set; } = string.Empty;
[JsonProperty]
public string InstantiationInfo { get; set; } = string.Empty;
public string Hash { get; set; } = string.Empty;
public bool Protected { get; set; }
public virtual Skin CreateInstance(IStorageResourceProvider resources)
{
var type = string.IsNullOrEmpty(InstantiationInfo)
// handle the case of skins imported before InstantiationInfo was added.
? typeof(LegacySkin)
: Type.GetType(InstantiationInfo).AsNonNull();
return (Skin)Activator.CreateInstance(type, this, resources);
}
public IList<RealmNamedFileUsage> Files { get; } = null!;
public bool DeletePending { get; set; }
public bool Equals(SkinInfo? other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
return ID == other.ID;
}
public override string ToString()
{
string author = string.IsNullOrEmpty(Creator) ? string.Empty : $"({Creator})";
return $"{Name} {author}".Trim();
}
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.IO;
using osu.Game.Models;
using Realms;
#nullable enable
namespace osu.Game.Skinning
{
[ExcludeFromDynamicCompile]
[MapTo("Skin")]
public class SkinInfo : RealmObject, IHasRealmFiles, IEquatable<SkinInfo>, IHasGuidPrimaryKey, ISoftDelete, IHasNamedFiles
{
internal static readonly Guid DEFAULT_SKIN = new Guid("2991CFD8-2140-469A-BCB9-2EC23FBCE4AD");
internal static readonly Guid CLASSIC_SKIN = new Guid("81F02CD3-EEC6-4865-AC23-FAE26A386187");
internal static readonly Guid RANDOM_SKIN = new Guid("D39DFEFB-477C-4372-B1EA-2BCEA5FB8908");
[PrimaryKey]
public Guid ID { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public string Creator { get; set; } = string.Empty;
public string Hash { get; set; } = string.Empty;
public bool Protected { get; set; }
public string InstantiationInfo { get; set; } = string.Empty;
public virtual Skin CreateInstance(IStorageResourceProvider resources)
{
var type = string.IsNullOrEmpty(InstantiationInfo)
// handle the case of skins imported before InstantiationInfo was added.
? typeof(LegacySkin)
: Type.GetType(InstantiationInfo).AsNonNull();
return (Skin)Activator.CreateInstance(type, this, resources);
}
public IList<RealmNamedFileUsage> Files { get; } = null!;
public bool DeletePending { get; set; }
public bool Equals(SkinInfo? other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
return ID == other.ID;
}
public override string ToString()
{
string author = string.IsNullOrEmpty(Creator) ? string.Empty : $"({Creator})";
return $"{Name} {author}".Trim();
}
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
}
}
| mit | C# |
fa029bf55d4f6874f0db6a163a90e76594164625 | Add test cases from roman => arabic to prove it works both ways | StormPooper/CSharpKatas | RomanKata.Tests/RomanKataTests.cs | RomanKata.Tests/RomanKataTests.cs | using NUnit.Framework;
namespace RomanKata.Tests
{
[TestFixture]
public class RomanKataTests
{
private NumberConverter _converter;
[TestFixtureSetUp]
public void NumberConverterSetup()
{
_converter = new NumberConverter();
}
[TestCase(1, "I")]
[TestCase(2, "II")]
[TestCase(3, "III")]
[TestCase(4, "IV")]
[TestCase(5, "V")]
[TestCase(6, "VI")]
[TestCase(9, "IX")]
[TestCase(10, "X")]
[TestCase(17, "XVII")]
[TestCase(29, "XXIX")]
[TestCase(34, "XXXIV")]
[TestCase(40, "XL")]
[TestCase(50, "L")]
[TestCase(64, "LXIV")]
[TestCase(90, "XC")]
[TestCase(100, "C")]
[TestCase(400, "CD")]
[TestCase(500, "D")]
[TestCase(900, "CM")]
[TestCase(1000, "M")]
[TestCase(1987, "MCMLXXXVII")]
[TestCase(2014, "MMXIV")]
public void Arabic_To_Roman(int arabic, string expected)
{
var result = _converter.ToRoman(arabic);
Assert.AreEqual(expected.ToUpper(), result);
}
[TestCase("I", 1)]
[TestCase("II", 2)]
[TestCase("III", 3)]
[TestCase("IV", 4)]
[TestCase("V", 5)]
[TestCase("VI", 6)]
[TestCase("IX", 9)]
[TestCase("X", 10)]
[TestCase("XVII", 17)]
[TestCase("XXIX", 29)]
[TestCase("XXXIV", 34)]
[TestCase("XL", 40)]
[TestCase("L", 50)]
[TestCase("LXIV", 64)]
[TestCase("XC", 90)]
[TestCase("C", 100)]
[TestCase("CD", 400)]
[TestCase("D", 500)]
[TestCase("CM", 900)]
[TestCase("M", 1000)]
[TestCase("MCMLXXXVII", 1987)]
[TestCase("MMXIV", 2014)]
public void Roman_To_Arabic(string roman, int expected)
{
var result = _converter.ToArabic(roman);
Assert.AreEqual(expected, result);
}
}
} | using NUnit.Framework;
namespace RomanKata.Tests
{
[TestFixture]
public class RomanKataTests
{
private NumberConverter _converter;
[TestFixtureSetUp]
public void NumberConverterSetup()
{
_converter = new NumberConverter();
}
[TestCase(1, "I")]
[TestCase(2, "II")]
[TestCase(3, "III")]
[TestCase(4, "IV")]
[TestCase(5, "V")]
[TestCase(6, "VI")]
[TestCase(9, "IX")]
[TestCase(10, "X")]
[TestCase(17, "XVII")]
[TestCase(29, "XXIX")]
[TestCase(34, "XXXIV")]
[TestCase(40, "XL")]
[TestCase(50, "L")]
[TestCase(64, "LXIV")]
[TestCase(90, "XC")]
[TestCase(100, "C")]
[TestCase(400, "CD")]
[TestCase(500, "D")]
[TestCase(900, "CM")]
[TestCase(1000, "M")]
[TestCase(1987, "MCMLXXXVII")]
[TestCase(2014, "MMXIV")]
public void Arabic_To_Roman(int arabic, string expected)
{
var result = _converter.ToRoman(arabic);
Assert.AreEqual(expected.ToUpper(), result);
}
[TestCase("I", 1)]
[TestCase("II", 2)]
[TestCase("III", 3)]
[TestCase("IV", 4)]
[TestCase("V", 5)]
[TestCase("VI", 6)]
[TestCase("IX", 9)]
public void Roman_To_Arabic(string roman, int expected)
{
var result = _converter.ToArabic(roman);
Assert.AreEqual(expected, result);
}
}
} | unlicense | C# |
eaf218924d30a6f2eb813dd7269da4e41826639c | Remove redundant namespaces | dmitrypetukhov/evangelism,dmitrypetukhov/evangelism,dmitrypetukhov/evangelism,dmitrypetukhov/evangelism | TwitterCrawlerDemo/source/Twitter.Listner.Console/Program.cs | TwitterCrawlerDemo/source/Twitter.Listner.Console/Program.cs | using Twitter.Streaming;
using Twitter.Streaming.Configurations;
namespace Twitter.Listner.Console
{
class Program
{
static void Main(string[] args)
{
var listner = new TwitterListner(new TwitterListnerConfiguration(), new EventHubConfiguration(), new ConsoleLogger());
listner.StartAsync().Wait();
System.Console.ReadLine();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Twitter.Streaming;
using Twitter.Streaming.Configurations;
namespace Twitter.Listner.Console
{
class Program
{
static void Main(string[] args)
{
var listner = new TwitterListner(new TwitterListnerConfiguration(), new EventHubConfiguration(), new ConsoleLogger());
listner.StartAsync().Wait();
System.Console.ReadLine();
}
}
}
| mit | C# |
862f69e6b952113bd0916dad1df3fbc8797882d9 | Update SolutionInfo for v0.2.0.1 | dustinleavins/KSMVVM.WPF | properties/SolutionInfo.cs | properties/SolutionInfo.cs | using System;
using System.Reflection;
[assembly: AssemblyVersion("0.2.0.1")]
[assembly: AssemblyFileVersion("0.2.0.1")]
[assembly: AssemblyCompany("Dustin Leavins")]
[assembly: AssemblyCopyright("Copyright © Dustin Leavins 2013,2014")] | using System;
using System.Reflection;
[assembly: AssemblyVersion("0.2")]
[assembly: AssemblyFileVersion("0.2")]
[assembly: AssemblyCompany("Dustin Leavins")]
[assembly: AssemblyCopyright("Copyright © Dustin Leavins 2013,2014")] | mit | C# |
57736d7d4de0fc1a872b8f46d0a5ec91ea336478 | Revert assembly version and assembly file version back to 0.2.0.0 | yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,stankovski/azure-sdk-for-net,olydis/azure-sdk-for-net,jamestao/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jamestao/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,hyonholee/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,hyonholee/azure-sdk-for-net,olydis/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,AzCiS/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,nathannfan/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,pilor/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,shutchings/azure-sdk-for-net,djyou/azure-sdk-for-net,btasdoven/azure-sdk-for-net,djyou/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,begoldsm/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,peshen/azure-sdk-for-net,shutchings/azure-sdk-for-net,btasdoven/azure-sdk-for-net,peshen/azure-sdk-for-net,nathannfan/azure-sdk-for-net,stankovski/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,atpham256/azure-sdk-for-net,mihymel/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,jamestao/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,pankajsn/azure-sdk-for-net,atpham256/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,hyonholee/azure-sdk-for-net,pilor/azure-sdk-for-net,begoldsm/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,begoldsm/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,peshen/azure-sdk-for-net,shutchings/azure-sdk-for-net,AzCiS/azure-sdk-for-net,pankajsn/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,pilor/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,AzCiS/azure-sdk-for-net,atpham256/azure-sdk-for-net,nathannfan/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,olydis/azure-sdk-for-net,pankajsn/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,mihymel/azure-sdk-for-net,markcowl/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jamestao/azure-sdk-for-net,djyou/azure-sdk-for-net,btasdoven/azure-sdk-for-net,mihymel/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net | src/ResourceManagement/CognitiveServices/Microsoft.Azure.Management.CognitiveServices/Properties/AssemblyInfo.cs | src/ResourceManagement/CognitiveServices/Microsoft.Azure.Management.CognitiveServices/Properties/AssemblyInfo.cs | //
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System.Reflection;
using System.Resources;
[assembly: AssemblyTitle("Microsoft Azure Cognitive Services Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Cognitive Services management functions for managing Microsoft Azure Cognitive Services accounts.")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
| //
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System.Reflection;
using System.Resources;
[assembly: AssemblyTitle("Microsoft Azure Cognitive Services Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Cognitive Services management functions for managing Microsoft Azure Cognitive Services accounts.")]
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
b963901032aa929b8e4d29cc1bf875b581fa7382 | fix build errror on game controller | nicholaschiasson/affliction | Assets/Scripts/GameController.cs | Assets/Scripts/GameController.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController : MonoBehaviour {
Camera camera;
List<Microorganism> selectedUnits;
Organ selectedOrgan;
// Use this for initialization
void Start () {
camera = this.GetComponent<Camera>();
selectedUnits = new List<Microorganism>();
selectedOrgan = null;
}
// Add an organism to the selected list. We can have multiple organisms selected for batch commands
public void selectOrganism(Microorganism unit, bool resetList)
{
//deselect a building if we have it selected
selectedOrgan = null;
if (resetList)
{
selectedUnits = new List<Microorganism>();
}
selectedUnits.Add(unit);
}
// We can only select One Building so we are always resetting the list
public void selectOrgan(Organ organ)
{
selectedUnits = new List<Microorganism>();
selectedOrgan = organ;
}
// Sending the action command to the selected lists and the location to which the action needs to be executed
private void doAction(Vector3 loc)
{
if (selectedOrgan)
{
selectedOrgan.doAction(loc);
}
else
{
foreach(Microorganism unit in selectedUnits)
{
unit.doAction(loc);
}
}
}
// Sending the action command to the selected lists and the location to which the action needs to be executed
private void doAction(Unit unit)
{
if (selectedOrgan)
{
selectedOrgan.doAction(unit);
}
else
{
foreach (Microorganism u in selectedUnits)
{
u.doAction(unit);
}
}
}
// Update is called once per frame
void Update () {
//todo implement raycasting to determine where a user clicked
// var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// Debug.DrawRay(ray.origin, ray.direction * 10, Color.red);
}
// Update called once per frame after every update
void LateUpdate()
{
float xAxisValue = Input.GetAxis("Horizontal");
float zAxisValue = Input.GetAxis("Vertical");
camera.transform.Translate(new Vector3(xAxisValue, 0.0f, zAxisValue), Space.World);
Debug.Log("Camera Coords: " + camera.transform.position.ToString());
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController : MonoBehaviour {
Camera camera;
List<Microorganism> selectedUnits;
Organ selectedOrgan;
// Use this for initialization
void Start () {
camera = this.GetComponent<Camera>();
selectedUnits = new List<Microorganism>();
selectedOrgan = null;
}
// Add an organism to the selected list. We can have multiple organisms selected for batch commands
public void selectOrganism(Microorganism unit, bool resetList)
{
//deselect a building if we have it selected
selectedOrgan = null;
if (resetList)
{
selectedUnits = new List<Microorganism>();
}
selectedUnits.Add(unit);
}
// We can only select One Building so we are always resetting the list
public void selectOrgan(Organ organ)
{
selectedUnits = new List<Microorganism>();
selectedOrgan = organ;
}
// Sending the action command to the selected lists and the location to which the action needs to be executed
private void doAction(Vector3 loc)
{
if (selectedOrgan)
{
selectedOrgan.doAction(loc);
}
else
{
foreach(Microorganism unit in selectedUnits)
{
unit.doAction(loc);
}
}
}
// Sending the action command to the selected lists and the location to which the action needs to be executed
private void doAction(Unit unit)
{
if (selectedOrgan)
{
selectedOrgan.doAction(unit);
}
else
{
foreach (Microorganism unit in selectedUnits)
{
unit.doAction(unit);
}
}
}
// Update is called once per frame
void Update () {
//todo implement raycasting to determine where a user clicked
// var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// Debug.DrawRay(ray.origin, ray.direction * 10, Color.red);
}
// Update called once per frame after every update
void LateUpdate()
{
float xAxisValue = Input.GetAxis("Horizontal");
float zAxisValue = Input.GetAxis("Vertical");
camera.transform.Translate(new Vector3(xAxisValue, 0.0f, zAxisValue), Space.World);
Debug.Log("Camera Coords: " + camera.transform.position.ToString());
}
}
| mit | C# |
591b0dab40e2f090f8421dee7021897a6e511db2 | Implement drawing | sakapon/Tutorials-2014 | LeapTutorial01/AirCanvas/MainWindow.xaml.cs | LeapTutorial01/AirCanvas/MainWindow.xaml.cs | using Leap;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace AirCanvas
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
const int ScreenWidth = 1920;
const int ScreenHeight = 1080;
const int MappingRate = 3;
Controller controller;
FrameListener listener;
Dictionary<int, Stroke> strokes = new Dictionary<int, Stroke>();
public MainWindow()
{
InitializeComponent();
Loaded += MainWindow_Loaded;
Closing += MainWindow_Closing;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
controller = new Controller();
listener = new FrameListener();
controller.AddListener(listener);
listener.FrameArrived += listener_FrameArrived;
}
void MainWindow_Closing(object sender, CancelEventArgs e)
{
controller.RemoveListener(listener);
listener.Dispose();
controller.Dispose();
}
void listener_FrameArrived(Leap.Frame frame)
{
var positions = frame.Pointables
.Where(p => p.IsValid)
.Where(p => p.StabilizedTipPosition.IsValid())
.Where(p => p.StabilizedTipPosition.z < 0)
.ToDictionary(p => p.Id, p => ToStylusPoint(p.StabilizedTipPosition));
Dispatcher.InvokeAsync(() =>
{
var idsToRemove = strokes.Keys.Except(positions.Keys).ToArray();
foreach (var id in idsToRemove)
{
strokes.Remove(id);
}
foreach (var item in positions)
{
if (strokes.ContainsKey(item.Key))
{
strokes[item.Key].StylusPoints.Add(item.Value);
}
else
{
var stroke = new Stroke(new StylusPointCollection(new[] { item.Value }));
strokes[item.Key] = stroke;
TheCanvas.Strokes.Add(stroke);
}
}
});
}
static StylusPoint ToStylusPoint(Leap.Vector v)
{
return new StylusPoint(ScreenWidth / 2 + MappingRate * v.x, ScreenHeight - MappingRate * v.y);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace AirCanvas
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
| mit | C# |
3b613ec8e873bddbdb13a435c7b02b22f0e42e4d | bump version | Fody/Validar | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Validar")]
[assembly: AssemblyProduct("Validar")]
[assembly: AssemblyVersion("1.4.8")]
[assembly: AssemblyFileVersion("1.4.8")]
| using System.Reflection;
[assembly: AssemblyTitle("Validar")]
[assembly: AssemblyProduct("Validar")]
[assembly: AssemblyVersion("1.4.7")]
[assembly: AssemblyFileVersion("1.4.7")]
| mit | C# |
b95e3a0cc34e931351a592a2d2c13b9f808d434c | bump version | Fody/MethodTimer,GeertvanHorrik/MethodTimer | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("MethodTimer")]
[assembly: AssemblyProduct("MethodTimer")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
| using System.Reflection;
[assembly: AssemblyTitle("MethodTimer")]
[assembly: AssemblyProduct("MethodTimer")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.