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 |
|---|---|---|---|---|---|---|---|---|
1399f98293d1e977ceb75d98922f1874ecc921db | Update ValuesOperator.cs | Flepper/flepper,Flepper/flepper | Flepper.QueryBuilder/Operators/Values/ValuesOperator.cs | Flepper.QueryBuilder/Operators/Values/ValuesOperator.cs | using System.Collections.Generic;
using System.Linq;
using System.Text;
using Flepper.QueryBuilder.Base;
namespace Flepper.QueryBuilder
{
internal class ValuesOperator : BaseQueryBuilder, IValuesOperator
{
public ValuesOperator(StringBuilder command, IDictionary<string, object> parameters) : base(command, parameters)
{
}
public IValuesOperator Values(params object[] values)
{
Command.AppendFormat("VALUES ({0})", string.Join(", ", Parameters.Skip(AddParameters(values)).Select(p => p.Key)));
return this;
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Text;
using Flepper.QueryBuilder.Base;
namespace Flepper.QueryBuilder
{
internal class ValuesOperator : BaseQueryBuilder, IValuesOperator
{
public ValuesOperator(StringBuilder command, IDictionary<string, object> parameters) : base(command, parameters)
{
}
public IValuesOperator Values(params object[] values)
{
var parametersCount = AddParameters(values);
Command.AppendFormat("VALUES ({0})", string.Join(", ", Parameters.Skip(parametersCount).Select(p => p.Key)));
return this;
}
}
}
| mit | C# |
199108106cc98e67216e1282a9f9852db5dc14c5 | Fix warning during compile (#1848) | HTBox/allReady,HTBox/allReady,gitChuckD/allReady,gitChuckD/allReady,VishalMadhvani/allReady,c0g1t8/allReady,jonatwabash/allReady,VishalMadhvani/allReady,anobleperson/allReady,jonatwabash/allReady,arst/allReady,c0g1t8/allReady,dpaquette/allReady,c0g1t8/allReady,bcbeatty/allReady,stevejgordon/allReady,stevejgordon/allReady,HTBox/allReady,bcbeatty/allReady,MisterJames/allReady,MisterJames/allReady,GProulx/allReady,HamidMosalla/allReady,HamidMosalla/allReady,anobleperson/allReady,c0g1t8/allReady,BillWagner/allReady,stevejgordon/allReady,stevejgordon/allReady,anobleperson/allReady,GProulx/allReady,binaryjanitor/allReady,dpaquette/allReady,arst/allReady,mgmccarthy/allReady,anobleperson/allReady,HTBox/allReady,GProulx/allReady,jonatwabash/allReady,mgmccarthy/allReady,jonatwabash/allReady,binaryjanitor/allReady,VishalMadhvani/allReady,gitChuckD/allReady,GProulx/allReady,BillWagner/allReady,BillWagner/allReady,gitChuckD/allReady,HamidMosalla/allReady,dpaquette/allReady,bcbeatty/allReady,VishalMadhvani/allReady,dpaquette/allReady,MisterJames/allReady,mgmccarthy/allReady,BillWagner/allReady,arst/allReady,HamidMosalla/allReady,bcbeatty/allReady,binaryjanitor/allReady,MisterJames/allReady,mgmccarthy/allReady,arst/allReady,binaryjanitor/allReady | AllReadyApp/Web-App/AllReady/Providers/ExternalUserInformationProviders/Providers/TwitterExternalUserInformationProvider.cs | AllReadyApp/Web-App/AllReady/Providers/ExternalUserInformationProviders/Providers/TwitterExternalUserInformationProvider.cs | using System.Security.Claims;
using System.Threading.Tasks;
using AllReady.Services.Twitter;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
namespace AllReady.Providers.ExternalUserInformationProviders.Providers
{
public class TwitterExternalUserInformationProvider : IProvideExternalUserInformation
{
private readonly ILogger _logger;
public TwitterExternalUserInformationProvider(ILogger<TwitterExternalUserInformationProvider> logger)
{
_logger = logger;
}
public Task<ExternalUserInformation> GetExternalUserInformation(ExternalLoginInfo externalLoginInfo)
{
var externalUserInformation = new ExternalUserInformation();
var screenName = externalLoginInfo.Principal.FindFirstValue("urn:twitter:screenname");
var email = externalLoginInfo.Principal.FindFirstValue(@"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress");
if (string.IsNullOrEmpty(email))
{
_logger.LogError($"Failed to retrieve user email address for user {screenName} from Twitter, this could be due to either the setup of the app (ensure the app requests email address permissions) or this user has a blank/unverified email in Twitter");
return Task.FromResult(externalUserInformation);
}
externalUserInformation.Email = email;
return Task.FromResult(externalUserInformation);
}
}
}
| using System.Security.Claims;
using System.Threading.Tasks;
using AllReady.Services.Twitter;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
namespace AllReady.Providers.ExternalUserInformationProviders.Providers
{
public class TwitterExternalUserInformationProvider : IProvideExternalUserInformation
{
private readonly ILogger _logger;
public TwitterExternalUserInformationProvider(ILogger<TwitterExternalUserInformationProvider> logger)
{
_logger = logger;
}
public async Task<ExternalUserInformation> GetExternalUserInformation(ExternalLoginInfo externalLoginInfo)
{
var externalUserInformation = new ExternalUserInformation();
var screenName = externalLoginInfo.Principal.FindFirstValue("urn:twitter:screenname");
var email = externalLoginInfo.Principal.FindFirstValue(@"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress");
if (string.IsNullOrEmpty(email))
{
_logger.LogError($"Failed to retrieve user email address for user {screenName} from Twitter, this could be due to either the setup of the app (ensure the app requests email address permissions) or this user has a blank/unverified email in Twitter");
return externalUserInformation;
}
externalUserInformation.Email = email;
return externalUserInformation;
}
}
} | mit | C# |
a619d1407f5edd91b1c44102df053ac900d5ff9b | Update CompactBinaryBondSerializer.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/Bond/CompactBinaryBondSerializer.cs | TIKSN.Core/Serialization/Bond/CompactBinaryBondSerializer.cs | using Bond.IO.Safe;
using Bond.Protocols;
namespace TIKSN.Serialization.Bond
{
public class CompactBinaryBondSerializer : SerializerBase<byte[]>
{
protected override byte[] SerializeInternal<T>(T obj)
{
var output = new OutputBuffer();
var writer = new CompactBinaryWriter<OutputBuffer>(output);
global::Bond.Serialize.To(writer, obj);
return output.Data.Array;
}
}
} | using Bond.IO.Safe;
using Bond.Protocols;
namespace TIKSN.Serialization.Bond
{
public class CompactBinaryBondSerializer : SerializerBase<byte[]>
{
protected override byte[] SerializeInternal(object obj)
{
var output = new OutputBuffer();
var writer = new CompactBinaryWriter<OutputBuffer>(output);
global::Bond.Serialize.To(writer, obj);
return output.Data.Array;
}
}
} | mit | C# |
4b49c8da8722d95490f4359af8a6b24e705e3806 | Update code | sakapon/Samples-2016,sakapon/Samples-2016 | MathSample/MontyHallConsole/Program.cs | MathSample/MontyHallConsole/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Blaze.Randomization;
namespace MontyHallConsole
{
class Program
{
static void Main(string[] args)
{
var loops = 10;
var trials = 10000;
for (var i = 0; i < loops; i++)
{
var wins = Enumerable.Repeat(false, trials)
.Count(_ => MontyHall.Execute());
Console.WriteLine($"{(double)wins / trials:P2}");
}
}
}
public static class MontyHall
{
const int Doors = 3;
static readonly int[] Indexes = Enumerable.Range(0, Doors).ToArray();
public static bool Execute()
{
var answer = Indexes.GetRandomElement();
var choice1 = Indexes.GetRandomElement();
var candidatesToOpen = Indexes
.Where(i => i != choice1)
.Where(i => i != answer)
.ToArray();
var open = candidatesToOpen.Shuffle()
.Take(Doors - 2)
.ToArray();
var choice2 = Indexes
.Except(open)
.Where(i => i != choice1)
.Single();
return answer == choice2;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Blaze.Randomization;
namespace MontyHallConsole
{
class Program
{
static void Main(string[] args)
{
var count = 1000;
var wins = Enumerable.Range(0, count)
.Count(i => MontyHall.Execute());
Console.WriteLine($"{(double)wins / count:P2}");
}
}
public static class MontyHall
{
const int Doors = 3;
static readonly int[] Indexes = Enumerable.Range(0, Doors).ToArray();
public static bool Execute()
{
var answer = Indexes.GetRandomElement();
var choice1 = Indexes.GetRandomElement();
var candidatesToOpen = Indexes
.Where(i => i != choice1)
.Where(i => i != answer)
.ToArray();
var open = candidatesToOpen.Shuffle()
.Take(Doors - 2)
.ToArray();
var choice2 = Indexes
.Except(open)
.Where(i => i != choice1)
.Single();
return answer == choice2;
}
}
}
| mit | C# |
10aae75ec6bac0932109b3820fee9e05fee6b39f | Return IHtmlString instead of MvcHtmlString from GetBlockListHtml | leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,madsoulswe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,arknu/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS | src/Umbraco.Web/BlockListTemplateExtensions.cs | src/Umbraco.Web/BlockListTemplateExtensions.cs | using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.Models.PublishedContent;
using System.Web;
namespace Umbraco.Web
{
public static class BlockListTemplateExtensions
{
public const string DefaultFolder = "BlockList/";
public const string DefaultTemplate = "Default";
public static IHtmlString GetBlockListHtml(this HtmlHelper html, BlockListModel model, string template = DefaultTemplate)
{
if (model?.Layout == null || !model.Layout.Any()) return new MvcHtmlString(string.Empty);
var view = DefaultFolder + template;
return html.Partial(view, model);
}
public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedProperty property, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);
public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);
public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias, string template)
{
if (propertyAlias == null) throw new ArgumentNullException(nameof(propertyAlias));
if (string.IsNullOrWhiteSpace(propertyAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyAlias));
var prop = contentItem.GetProperty(propertyAlias);
if (prop == null) throw new InvalidOperationException("No property type found with alias " + propertyAlias);
return GetBlockListHtml(html, prop?.GetValue() as BlockListModel, template);
}
public static IHtmlString GetBlockListHtml(this IPublishedProperty property, HtmlHelper html, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);
public static IHtmlString GetBlockListHtml(this IPublishedContent contentItem, HtmlHelper html, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);
public static IHtmlString GetBlockListHtml(this IPublishedContent contentItem, HtmlHelper html, string propertyAlias, string template) => GetBlockListHtml(html, contentItem, propertyAlias, template);
}
}
| using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Web
{
public static class BlockListTemplateExtensions
{
public const string DefaultFolder = "BlockList/";
public const string DefaultTemplate = "Default";
public static MvcHtmlString GetBlockListHtml(this HtmlHelper html, BlockListModel model, string template = DefaultTemplate)
{
if (model?.Layout == null || !model.Layout.Any()) return new MvcHtmlString(string.Empty);
var view = DefaultFolder + template;
return html.Partial(view, model);
}
public static MvcHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedProperty property, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);
public static MvcHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);
public static MvcHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias, string template)
{
if (propertyAlias == null) throw new ArgumentNullException(nameof(propertyAlias));
if (string.IsNullOrWhiteSpace(propertyAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyAlias));
var prop = contentItem.GetProperty(propertyAlias);
if (prop == null) throw new InvalidOperationException("No property type found with alias " + propertyAlias);
return GetBlockListHtml(html, prop?.GetValue() as BlockListModel, template);
}
public static MvcHtmlString GetBlockListHtml(this IPublishedProperty property, HtmlHelper html, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);
public static MvcHtmlString GetBlockListHtml(this IPublishedContent contentItem, HtmlHelper html, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);
public static MvcHtmlString GetBlockListHtml(this IPublishedContent contentItem, HtmlHelper html, string propertyAlias, string template) => GetBlockListHtml(html, contentItem, propertyAlias, template);
}
}
| mit | C# |
1a5dad9e9ae1bd8a4b65181e9039bf2af49ea865 | move method to top | tinohager/Nager.TemplateBuilder | Nager.TemplateBuilder/MessageFilter.cs | Nager.TemplateBuilder/MessageFilter.cs | using System;
using System.Runtime.InteropServices;
namespace Nager.TemplateBuilder
{
public class MessageFilter : IOleMessageFilter
{
// Class containing the IOleMessageFilter
// thread error-handling functions.
// Implement the IOleMessageFilter interface.
[DllImport("Ole32.dll")]
private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
// Start the filter.
public static void Register()
{
IOleMessageFilter newFilter = new MessageFilter();
CoRegisterMessageFilter(newFilter, out IOleMessageFilter oldFilter);
}
// Done with the filter, close it.
public static void Revoke()
{
CoRegisterMessageFilter(null, out IOleMessageFilter oldFilter);
}
// IOleMessageFilter functions.
// Handle incoming thread requests.
int IOleMessageFilter.HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo)
{
//Return the flag SERVERCALL_ISHANDLED.
return 0;
}
// Thread call was rejected, so try again.
int IOleMessageFilter.RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType)
{
if (dwRejectType == 2)
// flag = SERVERCALL_RETRYLATER.
{
// Retry the thread call immediately if return >=0 &
// <100.
return 99;
}
// Too busy; cancel call.
return -1;
}
int IOleMessageFilter.MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType)
{
//Return the flag PENDINGMSG_WAITDEFPROCESS.
return 2;
}
}
[ComImport, Guid("00000016-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IOleMessageFilter
{
[PreserveSig]
int HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo);
[PreserveSig]
int RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType);
[PreserveSig]
int MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType);
}
}
| using System;
using System.Runtime.InteropServices;
namespace Nager.TemplateBuilder
{
public class MessageFilter : IOleMessageFilter
{
// Class containing the IOleMessageFilter
// thread error-handling functions.
// Start the filter.
public static void Register()
{
IOleMessageFilter newFilter = new MessageFilter();
CoRegisterMessageFilter(newFilter, out IOleMessageFilter oldFilter);
}
// Done with the filter, close it.
public static void Revoke()
{
CoRegisterMessageFilter(null, out IOleMessageFilter oldFilter);
}
// IOleMessageFilter functions.
// Handle incoming thread requests.
int IOleMessageFilter.HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo)
{
//Return the flag SERVERCALL_ISHANDLED.
return 0;
}
// Thread call was rejected, so try again.
int IOleMessageFilter.RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType)
{
if (dwRejectType == 2)
// flag = SERVERCALL_RETRYLATER.
{
// Retry the thread call immediately if return >=0 &
// <100.
return 99;
}
// Too busy; cancel call.
return -1;
}
int IOleMessageFilter.MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType)
{
//Return the flag PENDINGMSG_WAITDEFPROCESS.
return 2;
}
// Implement the IOleMessageFilter interface.
[DllImport("Ole32.dll")]
private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
}
[ComImport, Guid("00000016-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IOleMessageFilter
{
[PreserveSig]
int HandleInComingCall(int dwCallType, IntPtr hTaskCaller, int dwTickCount, IntPtr lpInterfaceInfo);
[PreserveSig]
int RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType);
[PreserveSig]
int MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType);
}
}
| mit | C# |
6764644f231ff4b6e6a19f10fb1d65945597f24b | Fix wind Degree not using the right name for the json file | vb2ae/OpenWeatherMap.Standard,vb2ae/OpenWeatherMap.Standard,vb2ae/OpenWeatherMap.Standard | OpenWeatherMap.Standard/Models/Wind.cs | OpenWeatherMap.Standard/Models/Wind.cs | using Newtonsoft.Json;
using System;
namespace OpenWeatherMap.Standard.Models
{
/// <summary>
/// wind model
/// </summary>
[Serializable]
public class Wind : BaseModel
{
private float speed, gust;
private int deg;
/// <summary>
/// wind speed
/// </summary>
public float Speed
{
get => speed;
set => SetProperty(ref speed, value);
}
/// <summary>
/// wind degree
/// </summary>
[JsonProperty("deg")]
public int Degree
{
get => deg;
set => SetProperty(ref deg, value);
}
/// <summary>
/// gust
/// </summary>
public float Gust
{
get => gust;
set => SetProperty(ref gust, value);
}
}
}
| using System;
namespace OpenWeatherMap.Standard.Models
{
/// <summary>
/// wind model
/// </summary>
[Serializable]
public class Wind : BaseModel
{
private float speed, gust;
private int deg;
/// <summary>
/// wind speed
/// </summary>
public float Speed
{
get => speed;
set => SetProperty(ref speed, value);
}
/// <summary>
/// wind degree
/// </summary>
public int Degree
{
get => deg;
set => SetProperty(ref deg, value);
}
/// <summary>
/// gust
/// </summary>
public float Gust
{
get => gust;
set => SetProperty(ref gust, value);
}
}
}
| mit | C# |
ac79803f1bf3a9bf6b0a3094fb6b3875e9d862c0 | Update setting description summary | qianlifeng/Wox,Wox-launcher/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox | Plugins/Wox.Plugin.Program/Settings.cs | Plugins/Wox.Plugin.Program/Settings.cs | using System.Collections.Generic;
using System.IO;
using Wox.Plugin.Program.Programs;
namespace Wox.Plugin.Program
{
public class Settings
{
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
public List<DisabledProgramSource> DisabledProgramSources { get; set; } = new List<DisabledProgramSource>();
public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
public bool EnableStartMenuSource { get; set; } = true;
public bool EnableRegistrySource { get; set; } = true;
internal const char SuffixSeperator = ';';
/// <summary>
/// Contains user added folder location contents as well as all user disabled applications
/// </summary>
/// <remarks>
/// <para>Win32 class applications set UniqueIdentifier using their full file path</para>
/// <para>UWP class applications set UniqueIdentifier using their Application User Model ID</para>
/// <para>Custom user added program sources set UniqueIdentifier using their location</para>
/// </remarks>
public class ProgramSource
{
private string name;
public string Location { get; set; }
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
public bool Enabled { get; set; } = true;
public string UniqueIdentifier { get; set; }
}
public class DisabledProgramSource : ProgramSource { }
}
}
| using System.Collections.Generic;
using System.IO;
using Wox.Plugin.Program.Programs;
namespace Wox.Plugin.Program
{
public class Settings
{
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
public List<DisabledProgramSource> DisabledProgramSources { get; set; } = new List<DisabledProgramSource>();
public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
public bool EnableStartMenuSource { get; set; } = true;
public bool EnableRegistrySource { get; set; } = true;
internal const char SuffixSeperator = ';';
/// <summary>
/// Contains user added folder location contents as well as all user disabled applications
/// </summary>
/// <remarks>
/// <para>Win32 class applications sets UniqueIdentifier using their full file path</para>
/// <para>UWP class applications sets UniqueIdentifier using their Application User Model ID</para>
/// </remarks>
public class ProgramSource
{
private string name;
public string Location { get; set; }
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
public bool Enabled { get; set; } = true;
public string UniqueIdentifier { get; set; }
}
public class DisabledProgramSource : ProgramSource { }
}
}
| mit | C# |
05fbaacb272d81182ee0444b79fce29ba202745f | Use the user profile as scan entry point instead of drives like in Windows | awaescher/RepoZ,awaescher/RepoZ | RepoZ.Api.Mac/IO/MacDriveEnumerator.cs | RepoZ.Api.Mac/IO/MacDriveEnumerator.cs | using RepoZ.Api.IO;
using System;
using System.Linq;
namespace RepoZ.Api.Mac.IO
{
public class MacDriveEnumerator : IPathProvider
{
public string[] GetPaths()
{
return new string[] { Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) };
}
}
} | using RepoZ.Api.IO;
using System;
using System.Linq;
namespace RepoZ.Api.Mac.IO
{
public class MacDriveEnumerator : IPathProvider
{
public string[] GetPaths()
{
return System.IO.DriveInfo.GetDrives()
.Where(d => d.DriveType == System.IO.DriveType.Fixed)
.Where(p => !p.RootDirectory.FullName.StartsWith("/private", StringComparison.OrdinalIgnoreCase))
.Select(d => d.RootDirectory.FullName)
.ToArray();
}
}
} | mit | C# |
2ad7e0d33b825551157d7fab0ce829fb40df224a | Bump version to 11.4.0.25252 | HearthSim/HearthDb | HearthDb/Properties/AssemblyInfo.cs | HearthDb/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("11.4.0.25252")]
[assembly: AssemblyFileVersion("11.4.0.25252")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("11.2.0.24769")]
[assembly: AssemblyFileVersion("11.2.0.24769")]
| mit | C# |
53c8345feee4e9b468c013d3dfbcdff2ef8b46fc | Set the default parser to the Penguin Parser as it has better error reporting and is faster | GoeGaming/KVLib,RoyAwesome/KVLib | KVLib/KVParser.cs | KVLib/KVParser.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sprache;
using System.Text.RegularExpressions;
using KVLib.KeyValues;
namespace KVLib
{
/// <summary>
/// Parser entry point for reading Key Value strings
/// </summary>
public static class KVParser
{
public static IKVParser KV1 = new KeyValues.PenguinParser();
/// <summary>
/// Reads a line of text and returns the first Root key in the text
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
///
[Obsolete("Please use KVParser.KV1.Parse()")]
public static KeyValue ParseKeyValueText(string text)
{
return KV1.Parse(text);
}
/// <summary>
/// Reads a blob of text and returns an array of all root keys in the text
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
///
[Obsolete("Please use KVParser.KV1.ParseAll()")]
public static KeyValue[] ParseAllKVRootNodes(string text)
{
return KV1.ParseAll(text);
}
}
public class KeyValueParsingException : Exception
{
public KeyValueParsingException(string message, Exception inner)
: base(message, inner)
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sprache;
using System.Text.RegularExpressions;
using KVLib.KeyValues;
namespace KVLib
{
/// <summary>
/// Parser entry point for reading Key Value strings
/// </summary>
public static class KVParser
{
public static IKVParser KV1 = new KeyValues.SpracheKVParser();
/// <summary>
/// Reads a line of text and returns the first Root key in the text
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
///
[Obsolete("Please use KVParser.KV1.Parse()")]
public static KeyValue ParseKeyValueText(string text)
{
return KV1.Parse(text);
}
/// <summary>
/// Reads a blob of text and returns an array of all root keys in the text
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
///
[Obsolete("Please use KVParser.KV1.ParseAll()")]
public static KeyValue[] ParseAllKVRootNodes(string text)
{
return KV1.ParseAll(text);
}
}
public class KeyValueParsingException : Exception
{
public KeyValueParsingException(string message, Exception inner)
: base(message, inner)
{
}
}
}
| mit | C# |
ea9834fe7e5bb269c27e7daf22ab15ae1c522a00 | Add more GetByUsername tests | Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife | PhotoLife/PhotoLife.Services.Tests/UserServiceTests/GetByUsername_Should.cs | PhotoLife/PhotoLife.Services.Tests/UserServiceTests/GetByUsername_Should.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
namespace PhotoLife.Services.Tests.UserServiceTests
{
[TestFixture]
public class GetByUsername_Should
{
[TestCase("branimiri")]
[TestCase("not_branimiri")]
public void _CallRepository_GetAll_Method(string username)
{
//Arrange
var mockedRepository = new Mock<IRepository<User>>();
var mockedUnitOfWork = new Mock<IUnitOfWork>();
var userService = new UserService(mockedRepository.Object, mockedUnitOfWork.Object);
//Act
userService.GetUserByUsername(username);
//Assert
mockedRepository.Verify(r => r.GetAll(It.IsAny<Expression<Func<User,bool>>>()), Times.Once);
}
[TestCase("branimiri")]
[TestCase("not_branimiri")]
public void _ReturnCorrectly_GetAll_Method(string username)
{
//Arrange
var mockedUser = new Mock<User>();
var mockedRepository = new Mock<IRepository<User>>();
mockedRepository.Setup(r => r.GetAll(It.IsAny<Expression<Func<User, bool>>>())).Returns(new List<User> {mockedUser.Object});
var mockedUnitOfWork = new Mock<IUnitOfWork>();
var userService = new UserService(mockedRepository.Object, mockedUnitOfWork.Object);
//Act
var result = userService.GetUserByUsername(username);
//Assert
Assert.AreSame(mockedUser.Object, result);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
namespace PhotoLife.Services.Tests.UserServiceTests
{
[TestFixture]
public class GetByUsername_Should
{
[TestCase("branimiri")]
[TestCase("not_branimiri")]
public void _CallRepository_GetAll_Method(string username)
{
//Arrange
var mockedRepository = new Mock<IRepository<User>>();
var mockedUnitOfWork = new Mock<IUnitOfWork>();
var userService = new UserService(mockedRepository.Object, mockedUnitOfWork.Object);
//Act
userService.GetUserByUsername(username);
//Assert
mockedRepository.Verify(r => r.GetAll(It.IsAny<Expression<Func<User,bool>>>()), Times.Once);
}
}
}
| mit | C# |
ddc30c8b75faa4ef306bfce6313cd4124db5058a | Fix new post page | mattgwagner/alert-roster | alert-roster.web/Views/Home/New.cshtml | alert-roster.web/Views/Home/New.cshtml | @model alert_roster.web.Models.Message
@{
ViewBag.Title = "Post New Message";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Content, new { rows = "5", cols = "80" })
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Post" class="btn btn-default" />
</div>
</div>
</div>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
}
| @model alert_roster.web.Models.Message
@{
ViewBag.Title = "Create New Message";
}
<h2>@ViewBag.Title</h2>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Message</h4>
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Content)
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
| mit | C# |
5a54195cacf559c79f1255444a029be6b23ea881 | Add code to help with screenshot debugging | chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck | Core/Notification/Screenshot/TweetScreenshotManager.cs | Core/Notification/Screenshot/TweetScreenshotManager.cs | // Uncomment to keep screenshot windows visible for debugging
// #define NO_HIDE_SCREENSHOTS
using System;
using System.Windows.Forms;
using TweetDck.Core.Controls;
namespace TweetDck.Core.Notification.Screenshot{
sealed class TweetScreenshotManager : IDisposable{
private readonly Form owner;
private readonly Timer timeout;
private readonly Timer disposer;
private FormNotificationScreenshotable screenshot;
public TweetScreenshotManager(Form owner){
this.owner = owner;
this.timeout = new Timer{ Interval = 5000 };
this.timeout.Tick += timeout_Tick;
this.disposer = new Timer{ Interval = 1 };
this.disposer.Tick += disposer_Tick;
}
private void timeout_Tick(object sender, EventArgs e){
timeout.Stop();
screenshot.Location = ControlExtensions.InvisibleLocation;
disposer.Start();
}
private void disposer_Tick(object sender, EventArgs e){
disposer.Stop();
screenshot.Dispose();
screenshot = null;
}
public void Trigger(string html, int width, int height){
if (screenshot != null){
return;
}
screenshot = new FormNotificationScreenshotable(Callback, owner){
CanMoveWindow = () => false
};
screenshot.LoadNotificationForScreenshot(new TweetNotification(html, string.Empty, 0), width, height);
screenshot.Show();
timeout.Start();
}
private void Callback(){
if (!timeout.Enabled){
return;
}
timeout.Stop();
screenshot.TakeScreenshot();
#if !(DEBUG && NO_HIDE_SCREENSHOTS)
screenshot.Location = ControlExtensions.InvisibleLocation;
disposer.Start();
#else
screenshot.FormClosed += (sender, args) => disposer.Start();
#endif
}
public void Dispose(){
timeout.Dispose();
disposer.Dispose();
if (screenshot != null){
screenshot.Dispose();
}
}
}
}
| using System;
using System.Windows.Forms;
using TweetDck.Core.Controls;
namespace TweetDck.Core.Notification.Screenshot{
sealed class TweetScreenshotManager : IDisposable{
private readonly Form owner;
private readonly Timer timeout;
private readonly Timer disposer;
private FormNotificationScreenshotable screenshot;
public TweetScreenshotManager(Form owner){
this.owner = owner;
this.timeout = new Timer{ Interval = 5000 };
this.timeout.Tick += timeout_Tick;
this.disposer = new Timer{ Interval = 1 };
this.disposer.Tick += disposer_Tick;
}
private void timeout_Tick(object sender, EventArgs e){
timeout.Stop();
screenshot.Location = ControlExtensions.InvisibleLocation;
disposer.Start();
}
private void disposer_Tick(object sender, EventArgs e){
disposer.Stop();
screenshot.Dispose();
screenshot = null;
}
public void Trigger(string html, int width, int height){
if (screenshot != null){
return;
}
screenshot = new FormNotificationScreenshotable(Callback, owner){
CanMoveWindow = () => false
};
screenshot.LoadNotificationForScreenshot(new TweetNotification(html, string.Empty, 0), width, height);
screenshot.Show();
timeout.Start();
}
private void Callback(){
if (!timeout.Enabled){
return;
}
timeout.Stop();
screenshot.TakeScreenshot();
screenshot.Location = ControlExtensions.InvisibleLocation;
disposer.Start();
}
public void Dispose(){
timeout.Dispose();
disposer.Dispose();
if (screenshot != null){
screenshot.Dispose();
}
}
}
}
| mit | C# |
812498a15c77ae7467086667c87677a0cf554bed | Update index.cshtml | KovalNikita/apmathcloud | SITE/index.cshtml | SITE/index.cshtml | @{
var txt = DateTime.Now; // C#
int m = 1;
int b = 1;
double t_0 = 1;
double t_end = 100;
double z_0 = 0;
double z_d = 10;
double t1 = t_0;
double t2 = t_end;
double h = 0.1;
double width = 0.05;
var amplitudeRequest = Request.Params["amplitude"];
var amplitudeValue = 1;
var clear = int.TryParse(amplitudeRequest, out amplitudeValue);
var errorMssage = "no amplitude provided, please input http://apmath4oj.azurewebsites.net/mem.cshtml?amplitude=5";
}
<html>
<head>
<meta charset="utf-8">
<script src="./mathbox-bundle.min.js"></script>
<title>MathBox Test</title>
</head>
<body>
<script type="text/javascript">
@if(!clear){
Response.Write(String.Format("alert({0});", errorMssage));
}
mathbox = mathBox({
plugins: ['core', 'controls', 'cursor'],
controls: {
klass: THREE.OrbitControls
},
});
three = mathbox.three;
three.camera.position.set(3.5, 1.4, -2.3);
three.renderer.setClearColor(new THREE.Color(0x204060), 1.0);
time = 0
three.on('update', function () {
clock = three.Time.clock
time = clock / 4
});
view = mathbox
.unit({
scale: 720,
})
.cartesian({
range: [[-3, 3], [0, 6], [-3, 3]],
scale: [2, 2, 2],
});
view.axis({ axis: 1, width: 15 });
view.axis({ axis: 2, width: 15 });
view.axis({ axis: 3, width: 15 });
view.grid({
width: 5,
opacity: 0.5,
axes: [1, 3],
});
view.area({
id: 'sampler',
width: 83,
height: 83,
axes: [1, 3],
expr: function (emit, x, y, i, j) {
emit(x, 3 * (.5 + .5 * (Math.sin(x*@amplitudeValue + time) * Math.sin(y/@amplitudeValue + time))), y);
},
channels: 3,
});
view.surface({
lineX: true,
lineY: true,
shaded: true,
color: 0x5090FF,
width: 5,
});
surface = mathbox.select('surface')
</script>
</body>
</html>
| @{
var txt = DateTime.Now; // C#
int m = 1;
int b = 1;
double t_0 = 1;
double t_end = 100;
double z_0 = 0;
double z_d = 10;
double t1 = t_0;
double t2 = t_end;
double h = 0.1;
double width = 0.05;
}
<html>
<head>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
</body>
</html>
| mit | C# |
7a5b2aa5f6fcac4b77adb0392097f22f8592aa80 | Fix nested list item space before to 2 characters GH-14 | mysticmind/reversemarkdown-net | src/ReverseMarkdown/Converters/Li.cs | src/ReverseMarkdown/Converters/Li.cs |
using System;
using System.Linq;
using HtmlAgilityPack;
namespace ReverseMarkdown.Converters
{
public class Li
: ConverterBase
{
public Li(Converter converter)
: base(converter)
{
this.Converter.Register("li", this);
}
public override string Convert(HtmlNode node)
{
string content = this.TreatChildren(node);
string indentation = IndentationFor(node);
string prefix = PrefixFor(node);
return string.Format("{0}{1}{2}" + Environment.NewLine, indentation, prefix, content.Chomp());
}
private string PrefixFor(HtmlNode node)
{
if (node.ParentNode != null && node.ParentNode.Name == "ol")
{
// index are zero based hence add one
int index = node.ParentNode.SelectNodes("./li").IndexOf(node) + 1;
return string.Format("{0}. ",index);
}
else
{
return "- ";
}
}
private string IndentationFor(HtmlNode node)
{
int length = node.Ancestors("ol").Count() + node.Ancestors("ul").Count();
return new string(' ', Math.Max(length-1,0)*2);
}
}
}
|
using System;
using System.Linq;
using HtmlAgilityPack;
namespace ReverseMarkdown.Converters
{
public class Li
: ConverterBase
{
public Li(Converter converter)
: base(converter)
{
this.Converter.Register("li", this);
}
public override string Convert(HtmlNode node)
{
string content = this.TreatChildren(node);
string indentation = IndentationFor(node);
string prefix = PrefixFor(node);
return string.Format("{0}{1}{2}" + Environment.NewLine, indentation, prefix, content.Chomp());
}
private string PrefixFor(HtmlNode node)
{
if (node.ParentNode != null && node.ParentNode.Name == "ol")
{
// index are zero based hence add one
int index = node.ParentNode.SelectNodes("./li").IndexOf(node) + 1;
return string.Format("{0}. ",index);
}
else
{
return "- ";
}
}
private string IndentationFor(HtmlNode node)
{
int length = node.Ancestors("ol").Count() + node.Ancestors("ul").Count();
return new string(' ', Math.Max(length-1,0));
}
}
}
| mit | C# |
e900dc710b686f333678f8eb5aa0f7ca4c44ec33 | handle upper case text | martinlindhe/Punku | punku/Strings/Shift.cs | punku/Strings/Shift.cs | using System;
// FIXME: vad är skillnaden mellan Rot13? är det metoden...?
namespace Punku.Strings
{
/**
* Transform english text to a shifted form (a = a + shift)
*/
public class Shift
{
public char[] Table = new char[char.MaxValue];
public Shift (int shift)
{
for (int i = 0; i < char.MaxValue; i++)
Table [i] = (char)i;
for (int i = 'a'; i <= 'z'; i++) {
if (i + shift <= 'z')
Table [i] = (char)(i + shift);
else
Table [i] = (char)(i + shift - 'z' + 'a' - 1);
}
for (int i = 'A'; i <= 'Z'; i++) {
if (i + shift <= 'Z')
Table [i] = (char)(i + shift);
else
Table [i] = (char)(i + shift - 'Z' + 'A' - 1);
}
}
public string ShiftString (string s)
{
char[] arr = s.ToCharArray ();
for (int i = 0; i < arr.Length; i++)
arr [i] = Table [arr [i]];
return new string (arr);
}
public static string ShiftString (string s, int shift)
{
var x = new Shift (shift);
return x.ShiftString (s);
}
}
}
| using System;
// TODO: upper case!
// TODO: unit test for non-2-shifts
// FIXME: vad är skillnaden mellan Rot13? är det metoden...?
namespace Punku.Strings
{
/**
* Transform english text to a shifted form (a = a + shift)
*/
public class Shift
{
public char[] Table = new char[char.MaxValue];
public Shift (int shift)
{
for (int i = 0; i < char.MaxValue; i++)
Table [i] = (char)i;
for (int i = 'a'; i <= 'z'; i++) {
if (i + shift <= 'z')
Table [i] = (char)(i + shift);
else
Table [i] = (char)(i + shift - 'z' + 'a' - 1);
}
}
public string ShiftString (string s)
{
char[] arr = s.ToCharArray ();
for (int i = 0; i < arr.Length; i++)
arr [i] = Table [arr [i]];
return new string (arr);
}
public static string ShiftString (string s, int shift)
{
var x = new Shift (shift);
return x.ShiftString (s);
}
}
}
| mit | C# |
5b56eb108791de0a6cffc23662362d2102d945ba | Change map to satellite | Davidp809/PolymerDemo,Davidp809/PolymerDemo,Davidp809/PolymerDemo | PolymerDemo/Views/Home/Index.cshtml | PolymerDemo/Views/Home/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>Google Maps</h1>
<!-- Use element -->
<style>
google-map {
height: 600px;
}
</style>
<google-map latitude="41.2780" longitude="-81.3287" zoom="18" maptype="satellite">
<google-map-marker latitude="41.278" longitude="-81.328"
draggable="false" title="HELLO DANNER!"></google-map-marker>
</google-map>
</div> | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>Google Maps</h1>
<!-- Use element -->
<style>
google-map {
height: 600px;
}
</style>
<google-map latitude="41.2780" longitude="-81.3287" zoom="18">
<google-map-marker latitude="41.278" longitude="-81.328"
draggable="false" title="HELLO DANNER!"></google-map-marker>
</google-map>
</div> | mit | C# |
ccfa7f13eaab15e8ae98dc816f4a2f1280c43364 | Clean up | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Program.cs | src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Program.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace GrpcService_CSharp
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace GrpcService_CSharp
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients for macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| apache-2.0 | C# |
5c33bbc6fb5d6e1e0cfdfa3804a0cfd5dbd0e205 | Fix bug in DictionaryMemoryCache | rasmus/EventFlow | Source/EventFlow/Core/Caching/DictionaryMemoryCache.cs | Source/EventFlow/Core/Caching/DictionaryMemoryCache.cs | // The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rasmus Mikkelsen
// Copyright (c) 2015-2018 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using EventFlow.Logs;
namespace EventFlow.Core.Caching
{
/// <summary>
/// Simple cache that disregards expiration times and keeps everything forever,
/// useful when doing tests.
/// </summary>
public class DictionaryMemoryCache : Cache, IMemoryCache
{
private readonly ConcurrentDictionary<string, object> _cache = new ConcurrentDictionary<string, object>();
public DictionaryMemoryCache(
ILog log)
: base(log)
{
}
protected override Task SetAsync<T>(
CacheKey cacheKey,
DateTimeOffset absoluteExpiration,
T value,
CancellationToken cancellationToken)
{
_cache[cacheKey.Value] = value;
return Task.FromResult(0);
}
protected override Task SetAsync<T>(
CacheKey cacheKey,
TimeSpan slidingExpiration,
T value,
CancellationToken cancellationToken)
{
_cache[cacheKey.Value] = value;
return Task.FromResult(0);
}
protected override Task<T> GetAsync<T>(
CacheKey cacheKey,
CancellationToken cancellationToken)
{
return Task.FromResult(_cache.TryGetValue(cacheKey.Value, out var value)
? value as T
: default(T));
}
}
} | // The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rasmus Mikkelsen
// Copyright (c) 2015-2018 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using EventFlow.Logs;
namespace EventFlow.Core.Caching
{
/// <summary>
/// Simple cache that disregards expiration times and keeps everything forever,
/// useful when doing tests.
/// </summary>
public class DictionaryMemoryCache : Cache, IMemoryCache
{
private readonly ConcurrentDictionary<string, object> _cache = new ConcurrentDictionary<string, object>();
public DictionaryMemoryCache(
ILog log)
: base(log)
{
}
protected override Task SetAsync<T>(
CacheKey cacheKey,
DateTimeOffset absoluteExpiration,
T value,
CancellationToken cancellationToken)
{
_cache[cacheKey.Value] = value;
return Task.FromResult(0);
}
protected override Task SetAsync<T>(
CacheKey cacheKey,
TimeSpan slidingExpiration,
T value,
CancellationToken cancellationToken)
{
_cache[cacheKey.Value] = value;
return Task.FromResult(0);
}
protected override Task<T> GetAsync<T>(
CacheKey cacheKey,
CancellationToken cancellationToken)
{
var value = _cache[cacheKey.Value] as T;
return Task.FromResult(value);
}
}
} | mit | C# |
60d7c2c1aa0bfc3ce0aca5984272419136edbe42 | fix set favorite | NCTU-Isolated-Island/Isolated-Island-Game | IsolatedIslandGame/IsolatedIslandGame.Library/CommunicationInfrastructure/Operations/Handlers/PlayerOperationHandlers/SetFavoriteItemHandler.cs | IsolatedIslandGame/IsolatedIslandGame.Library/CommunicationInfrastructure/Operations/Handlers/PlayerOperationHandlers/SetFavoriteItemHandler.cs | using IsolatedIslandGame.Library.Items;
using IsolatedIslandGame.Protocol.Communication.OperationCodes;
using IsolatedIslandGame.Protocol.Communication.OperationParameters.Player;
using System.Collections.Generic;
namespace IsolatedIslandGame.Library.CommunicationInfrastructure.Operations.Handlers.PlayerOperationHandlers
{
class SetFavoriteItemHandler : PlayerOperationHandler
{
public SetFavoriteItemHandler(Player subject) : base(subject, 2)
{
}
internal override bool Handle(PlayerOperationCode operationCode, Dictionary<byte, object> parameters)
{
if (base.Handle(operationCode, parameters))
{
int inventoryID = (int)parameters[(byte)SetFavoriteItemParameterCode.InventoryID];
int inventoryItemInfoID = (int)parameters[(byte)SetFavoriteItemParameterCode.InventoryItemInfoID];
if(subject.Inventory.InventoryID == inventoryID)
{
lock (subject.Inventory)
{
if (subject.Inventory.ContainsInventoryItemInfo(inventoryItemInfoID))
{
InventoryItemInfo info;
subject.Inventory.FindInventoryItemInfo(inventoryItemInfoID, out info);
return true;
}
else
{
LogService.Error($"SetFavoriteItem error Player: {subject.IdentityInformation}, the ItemInfo is not existed InventoryItemInfoID: {inventoryItemInfoID}");
return false;
}
}
}
else
{
return false;
}
}
else
{
return false;
}
}
}
}
| using IsolatedIslandGame.Library.Items;
using IsolatedIslandGame.Protocol.Communication.OperationCodes;
using IsolatedIslandGame.Protocol.Communication.OperationParameters.Player;
using System.Collections.Generic;
namespace IsolatedIslandGame.Library.CommunicationInfrastructure.Operations.Handlers.PlayerOperationHandlers
{
class SetFavoriteItemHandler : PlayerOperationHandler
{
public SetFavoriteItemHandler(Player subject) : base(subject, 2)
{
}
internal override bool Handle(PlayerOperationCode operationCode, Dictionary<byte, object> parameters)
{
if (base.Handle(operationCode, parameters))
{
int inventoryID = (int)parameters[(byte)SetFavoriteItemParameterCode.InventoryID];
int inventoryItemInfoID = (int)parameters[(byte)SetFavoriteItemParameterCode.InventoryItemInfoID];
if(subject.Inventory.InventoryID == inventoryID)
{
lock (subject.Inventory)
{
if (subject.Inventory.ContainsInventoryItemInfo(inventoryItemInfoID))
{
InventoryItemInfo info;
subject.Inventory.FindInventoryItemInfo(inventoryItemInfoID, out info);
return true;
}
else
{
LogService.ErrorFormat("SetFavoriteItem error Player: {0}, the ItemInfo is not existed InventoryItemInfoID: {1}", inventoryItemInfoID);
return false;
}
}
}
else
{
return false;
}
}
else
{
return false;
}
}
}
}
| apache-2.0 | C# |
4ce4ed00c1e690198e463eb1040be4f9603b3a62 | Update FindWithTag.cs | carcarc/unity3d | FindWithTag.cs | FindWithTag.cs | private Generate gameGenerate;
void Start(){
//FindWithTag
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
{
gameGenerate = gameControllerObject.GetComponent<Generate>();
}
if (gameGenerate == null)
{
Debug.Log("Cannot find 'GameController' script");
}
}
| //FindWithTag
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
{
gameGenerate = gameControllerObject.GetComponent<Generate>();
}
if (gameGenerate == null)
{
Debug.Log("Cannot find 'GameController' script");
}
| mit | C# |
b438e7cdfd2400e230e8a8b19170cb0559e3793f | Update FreSharpController.cs | tuarua/WebViewANE,tuarua/WebViewANE,tuarua/WebViewANE,tuarua/WebViewANE,tuarua/WebViewANE,tuarua/WebViewANE,tuarua/WebViewANE | native_library/win/WebViewANE/CefSharpLib/CefSharpLib/FreSharpController.cs | native_library/win/WebViewANE/CefSharpLib/CefSharpLib/FreSharpController.cs | /*Copyright 2017 Tua Rua Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/
using System;
using System.Collections.Generic;
using TuaRua.FreSharp;
using FREObject = System.IntPtr;
using FREContext = System.IntPtr;
namespace CefSharpLib {
public abstract class FreSharpController {
public Dictionary<string, Func<FREContext, uint, FREObject[], FREObject>> FunctionsDict;
public static FreContextSharp Context;
public FREObject CallSharpFunction(string name, ref FREContext ctx, uint argc, FREObject[] argv) {
return FunctionsDict[name].Invoke(ctx, argc, argv);
}
public void SetFreContext(ref FREContext freContext) {
Context = new FreContextSharp(freContext);
}
public void Trace(string value) {
Context.DispatchEvent("TRACE", value);
}
}
}
| using System;
using System.Collections.Generic;
using TuaRua.FreSharp;
using FREObject = System.IntPtr;
using FREContext = System.IntPtr;
namespace CefSharpLib {
public abstract class FreSharpController {
public Dictionary<string, Func<FREContext, uint, FREObject[], FREObject>> FunctionsDict;
public static FreContextSharp Context;
public FREObject CallSharpFunction(string name, ref FREContext ctx, uint argc, FREObject[] argv) {
return FunctionsDict[name].Invoke(ctx, argc, argv);
}
public void SetFreContext(ref FREContext freContext) {
Context = new FreContextSharp(freContext);
}
public void Trace(string value) {
Context.DispatchEvent("TRACE", value);
}
}
}
| apache-2.0 | C# |
bd3386e770d86da2aee1c2cecf539b30dd6bf30f | Fix previously placed vertices in juice stream placement | ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu | osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs | osu.Game.Rulesets.Catch/Edit/Blueprints/Components/PlacementEditablePath.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Rulesets.Catch.Objects;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class PlacementEditablePath : EditablePath
{
/// <summary>
/// The original position of the last added vertex.
/// This is not same as the last vertex of the current path because the vertex ordering can change.
/// </summary>
private JuiceStreamPathVertex lastVertex;
public PlacementEditablePath(Func<float, double> positionToDistance)
: base(positionToDistance)
{
}
public void AddNewVertex()
{
var endVertex = Vertices[^1];
int index = AddVertex(endVertex.Distance, endVertex.X);
for (int i = 0; i < VertexCount; i++)
{
VertexStates[i].IsSelected = i == index;
VertexStates[i].IsFixed = i != index;
VertexStates[i].VertexBeforeChange = Vertices[i];
}
lastVertex = Vertices[index];
}
/// <summary>
/// Move the vertex added by <see cref="AddNewVertex"/> in the last time.
/// </summary>
public void MoveLastVertex(Vector2 screenSpacePosition)
{
Vector2 position = ToRelativePosition(screenSpacePosition);
double distanceDelta = PositionToDistance(position.Y) - lastVertex.Distance;
float xDelta = position.X - lastVertex.X;
MoveSelectedVertices(distanceDelta, xDelta);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Rulesets.Catch.Objects;
using osuTK;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
{
public class PlacementEditablePath : EditablePath
{
/// <summary>
/// The original position of the last added vertex.
/// This is not same as the last vertex of the current path because the vertex ordering can change.
/// </summary>
private JuiceStreamPathVertex lastVertex;
public PlacementEditablePath(Func<float, double> positionToDistance)
: base(positionToDistance)
{
}
public void AddNewVertex()
{
var endVertex = Vertices[^1];
int index = AddVertex(endVertex.Distance, endVertex.X);
for (int i = 0; i < VertexCount; i++)
{
VertexStates[i].IsSelected = i == index;
VertexStates[i].VertexBeforeChange = Vertices[i];
}
lastVertex = Vertices[index];
}
/// <summary>
/// Move the vertex added by <see cref="AddNewVertex"/> in the last time.
/// </summary>
public void MoveLastVertex(Vector2 screenSpacePosition)
{
Vector2 position = ToRelativePosition(screenSpacePosition);
double distanceDelta = PositionToDistance(position.Y) - lastVertex.Distance;
float xDelta = position.X - lastVertex.X;
MoveSelectedVertices(distanceDelta, xDelta);
}
}
}
| mit | C# |
be8a308923625761b3b5a40029dec975175aaf0a | Fix NRE in marking | Desolath/ConfuserEx3,yeaicc/ConfuserEx,engdata/ConfuserEx,Desolath/Confuserex,timnboys/ConfuserEx | Confuser.Core/ProtectionSettings.cs | Confuser.Core/ProtectionSettings.cs | using System;
using System.Collections.Generic;
namespace Confuser.Core {
/// <summary>
/// Protection settings for a certain component
/// </summary>
public class ProtectionSettings : Dictionary<ConfuserComponent, Dictionary<string, string>> {
/// <summary>
/// Initializes a new instance of the <see cref="ProtectionSettings" /> class.
/// </summary>
public ProtectionSettings() { }
/// <summary>
/// Initializes a new instance of the <see cref="ProtectionSettings" /> class
/// from an existing <see cref="ProtectionSettings" />.
/// </summary>
/// <param name="settings">The settings to copy from.</param>
public ProtectionSettings(ProtectionSettings settings) {
if (settings == null)
return;
foreach (var i in settings)
Add(i.Key, new Dictionary<string, string>(i.Value));
}
/// <summary>
/// Determines whether the settings is empty.
/// </summary>
/// <returns><c>true</c> if the settings is empty; otherwise, <c>false</c>.</returns>
public bool IsEmpty() {
return Count == 0;
}
}
} | using System;
using System.Collections.Generic;
namespace Confuser.Core {
/// <summary>
/// Protection settings for a certain component
/// </summary>
public class ProtectionSettings : Dictionary<ConfuserComponent, Dictionary<string, string>> {
/// <summary>
/// Initializes a new instance of the <see cref="ProtectionSettings" /> class.
/// </summary>
public ProtectionSettings() { }
/// <summary>
/// Initializes a new instance of the <see cref="ProtectionSettings" /> class
/// from an existing <see cref="ProtectionSettings" />.
/// </summary>
/// <param name="settings">The settings to copy from.</param>
public ProtectionSettings(ProtectionSettings settings) {
foreach (var i in settings)
Add(i.Key, new Dictionary<string, string>(i.Value));
}
/// <summary>
/// Determines whether the settings is empty.
/// </summary>
/// <returns><c>true</c> if the settings is empty; otherwise, <c>false</c>.</returns>
public bool IsEmpty() {
return Count == 0;
}
}
} | mit | C# |
a71357a8e2bd44e10873f9d56e66cb6937514e0b | Use racial attack bonus to compute current attack. | michaellperry/dof | DungeonsAndDragons/DOF/Character.cs | DungeonsAndDragons/DOF/Character.cs |
namespace DungeonsAndDragons.DOF
{
public class Character
{
public int Level { get; set; }
public int Strength { get; set; }
public int Dexterity { get; set; }
public IWeapon CurrentWeapon { get; set; }
public int StrengthModifier
{
get { return Strength / 2 - 5; }
}
public int DexterityModifier
{
get { return Dexterity / 2 - 5; }
}
public int BaseMeleeAttack
{
get { return Level / 2 + StrengthModifier; }
}
public int BaseRangedAttack
{
get { return Level / 2 + DexterityModifier; }
}
public int GetCurrentAttack(Creature creature)
{
if (CurrentWeapon.IsMelee)
return BaseMeleeAttack + CurrentWeapon.RacialAttackBonus(creature.Race);
else
return BaseRangedAttack + CurrentWeapon.RacialAttackBonus(creature.Race);
}
public void Equip(IWeapon weapon)
{
CurrentWeapon = weapon;
}
public bool Attack(Creature creature, int roll)
{
return GetCurrentAttack(creature) + roll >= creature.ArmorClass;
}
}
}
|
namespace DungeonsAndDragons.DOF
{
public class Character
{
public int Level { get; set; }
public int Strength { get; set; }
public int Dexterity { get; set; }
public IWeapon CurrentWeapon { get; set; }
public int StrengthModifier
{
get { return Strength / 2 - 5; }
}
public int DexterityModifier
{
get { return Dexterity / 2 - 5; }
}
public int BaseMeleeAttack
{
get { return Level / 2 + StrengthModifier; }
}
public int BaseRangedAttack
{
get { return Level / 2 + DexterityModifier; }
}
public int CurrentAttack
{
get
{
if (CurrentWeapon.IsMelee)
return BaseMeleeAttack + CurrentWeapon.AttackBonus;
else
return BaseRangedAttack + CurrentWeapon.AttackBonus;
}
}
public void Equip(IWeapon weapon)
{
CurrentWeapon = weapon;
}
public bool Attack(Creature creature, int roll)
{
return CurrentAttack + roll >= creature.ArmorClass;
}
}
}
| mit | C# |
5f79ad18d51b573127c6c40213f18ed60f7f2c1f | Strengthen syntax with extra parameters around the start parameter placed inside the generated length parameter. | nhibernate/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,alobakov/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,fredericDelaporte/nhibernate-core | src/NHibernate/Dialect/Function/EmulatedLengthSubstringFunction.cs | src/NHibernate/Dialect/Function/EmulatedLengthSubstringFunction.cs | using System.Collections;
using System.Text;
using NHibernate.Engine;
using NHibernate.SqlCommand;
using NHibernate.Type;
using System;
namespace NHibernate.Dialect.Function
{
/// <summary>
/// Provides a substring implementation of the form substring(expr, start, length)
/// for SQL dialects where the length argument is mandatory. If this is called
/// from HQL with only two arguments, this implementation will generate the length
/// parameter as (len(expr) + 1 - start).
/// </summary>
[Serializable]
public class EmulatedLengthSubstringFunction : StandardSQLFunction
{
/// <summary>
/// Initializes a new instance of the EmulatedLengthSubstringFunction class.
/// </summary>
public EmulatedLengthSubstringFunction()
: base("substring", NHibernateUtil.String)
{
}
#region ISQLFunction Members
public override SqlString Render(IList args, ISessionFactoryImplementor factory)
{
if (args.Count < 2 || args.Count > 3)
throw new QueryException("substring(): Incorrect number of parameters (expected 2 or 3, got " + args.Count + ")");
if (args.Count == 2)
{
// Have the DB calculate the length argument itself.
var lengthArg = new SqlString("len(", args[0], ") + 1 - (", args[1], ")");
args = new[] { args[0], args[1], lengthArg };
// Future possibility: Some databases, e.g. MSSQL, allows the length
// parameter to be larger than the number of characters in the string
// from start position to the end of the string. For such dialects,
// perhaps it is better performance to simply pass Int32.MaxValue as length?
}
return base.Render(args, factory);
}
#endregion
}
}
| using System.Collections;
using System.Text;
using NHibernate.Engine;
using NHibernate.SqlCommand;
using NHibernate.Type;
using System;
namespace NHibernate.Dialect.Function
{
/// <summary>
/// Provides a substring implementation of the form substring(expr, start, length)
/// for SQL dialects where the length argument is mandatory. If this is called
/// from HQL with only two arguments, this implementation will generate the length
/// parameter as (len(expr) + 1 - start).
/// </summary>
[Serializable]
public class EmulatedLengthSubstringFunction : StandardSQLFunction
{
/// <summary>
/// Initializes a new instance of the EmulatedLengthSubstringFunction class.
/// </summary>
public EmulatedLengthSubstringFunction()
: base("substring", NHibernateUtil.String)
{
}
#region ISQLFunction Members
public override SqlString Render(IList args, ISessionFactoryImplementor factory)
{
if (args.Count < 2 || args.Count > 3)
throw new QueryException("substring(): Incorrect number of parameters (expected 2 or 3, got " + args.Count + ")");
if (args.Count == 2)
{
// Have the DB calculate the length argument itself.
var lengthArg = new SqlString("len(", args[0], ") + 1 - ", args[1]);
args = new[] { args[0], args[1], lengthArg };
// Future possibility: Some databases, e.g. MSSQL, allows the length
// parameter to be larger than the number of characters in the string
// from start position to the end of the string. For such dialects,
// perhaps it is better performance to simply pass Int32.MaxValue as length?
}
return base.Render(args, factory);
}
#endregion
}
}
| lgpl-2.1 | C# |
0b280b32de15585d04b7c305404f76e8c0344efc | Add support for `ExpiryCheck` on Issuing `Authorization` | stripe/stripe-dotnet | src/Stripe.net/Entities/Issuing/Authorizations/VerificationData.cs | src/Stripe.net/Entities/Issuing/Authorizations/VerificationData.cs | namespace Stripe.Issuing
{
using Newtonsoft.Json;
public class VerificationData : StripeEntity<VerificationData>
{
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("address_line1_check")]
public string AddressLine1Check { get; set; }
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("address_zip_check")]
public string AddressZipCheck { get; set; }
/// <summary>
/// One of <c>success</c>, <c>failure</c>, <c>exempt</c>, or <c>none</c>.
/// </summary>
[JsonProperty("authentication")]
public string Authentication { get; set; }
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("cvc_check")]
public string CvcCheck { get; set; }
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("expiry_check")]
public string ExpiryCheck { get; set; }
}
}
| namespace Stripe.Issuing
{
using Newtonsoft.Json;
public class VerificationData : StripeEntity<VerificationData>
{
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("address_line1_check")]
public string AddressLine1Check { get; set; }
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("address_zip_check")]
public string AddressZipCheck { get; set; }
/// <summary>
/// One of <c>success</c>, <c>failure</c>, <c>exempt</c>, or <c>none</c>.
/// </summary>
[JsonProperty("authentication")]
public string Authentication { get; set; }
/// <summary>
/// One of <c>match</c>, <c>mismatch</c>, or <c>not_provided</c>.
/// </summary>
[JsonProperty("cvc_check")]
public string CvcCheck { get; set; }
}
}
| apache-2.0 | C# |
37f168a9d54f55001fb597b4624fe0fb831ac035 | Fix linux docker | Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server-tools | src/Tgstation.Server.Host.Watchdog/WindowsActiveAssemblyDeleter.cs | src/Tgstation.Server.Host.Watchdog/WindowsActiveAssemblyDeleter.cs | using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
namespace Tgstation.Server.Host.Watchdog
{
/// <summary>
/// See <see cref="IActiveAssemblyDeleter"/> for Windows systems
/// </summary>
sealed class WindowsActiveAssemblyDeleter : IActiveAssemblyDeleter
{
/// <summary>
/// Set a file located at <paramref name="path"/> to be deleted on reboot
/// </summary>
/// <param name="path">The file to delete on reboot</param>
[ExcludeFromCodeCoverage]
static void DeleteFileOnReboot(string path)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !NativeMethods.MoveFileEx(path, null, NativeMethods.MoveFileFlags.DelayUntilReboot))
throw new Win32Exception(Marshal.GetLastWin32Error());
}
/// <inheritdoc />
public void DeleteActiveAssembly(string assemblyPath)
{
if (assemblyPath == null)
throw new ArgumentNullException(nameof(assemblyPath));
//Can't use Path.GetTempFileName() because it may cross drives, which won't actually rename the file
var tmpLocation = String.Concat(assemblyPath, Guid.NewGuid());
File.Move(assemblyPath, tmpLocation);
DeleteFileOnReboot(tmpLocation);
}
}
}
| using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
namespace Tgstation.Server.Host.Watchdog
{
/// <summary>
/// See <see cref="IActiveAssemblyDeleter"/> for Windows systems
/// </summary>
sealed class WindowsActiveAssemblyDeleter : IActiveAssemblyDeleter
{
/// <summary>
/// Set a file located at <paramref name="path"/> to be deleted on reboot
/// </summary>
/// <param name="path">The file to delete on reboot</param>
[ExcludeFromCodeCoverage]
static void DeleteFileOnReboot(string path)
{
if (!NativeMethods.MoveFileEx(path, null, NativeMethods.MoveFileFlags.DelayUntilReboot))
throw new Win32Exception(Marshal.GetLastWin32Error());
}
/// <inheritdoc />
public void DeleteActiveAssembly(string assemblyPath)
{
if (assemblyPath == null)
throw new ArgumentNullException(nameof(assemblyPath));
//Can't use Path.GetTempFileName() because it may cross drives, which won't actually rename the file
var tmpLocation = String.Concat(assemblyPath, Guid.NewGuid());
File.Move(assemblyPath, tmpLocation);
DeleteFileOnReboot(tmpLocation);
}
}
}
| agpl-3.0 | C# |
76f177f93951d3ad7201904b53c534ae1ce5f204 | Fix trailing slash in Url | Pathio/excel-requests | Requests/Schema.cs | Requests/Schema.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Requests
{
public class Schema
{
public string Url { get; private set; }
public string Base { get; private set; }
public string Path { get; private set; }
public Schema(string url)
{
Url = url.TrimEnd(new char[] { '/' });
var baseAndPath = Url.Split('#');
Base = baseAndPath[0];
if (baseAndPath.Length == 2)
{
Path = baseAndPath[1];
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Requests
{
public class Schema
{
public string Url { get; private set; }
public string Base { get; private set; }
public string Path { get; private set; }
public Schema(string url)
{
Url = url.TrimEnd(new char[] { '/' });
var baseAndPath = url.Split('#');
Base = baseAndPath[0];
if (baseAndPath.Length == 2)
{
Path = baseAndPath[1];
}
}
}
}
| apache-2.0 | C# |
6e54db32e94d1166fa74b0391eafe1ddd6a49d9b | fix #3692 | AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,Perspex/Perspex,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia | src/Avalonia.Base/Data/Converters/FuncMultiValueConverter.cs | src/Avalonia.Base/Data/Converters/FuncMultiValueConverter.cs | // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Avalonia.Data.Converters
{
/// <summary>
/// A general purpose <see cref="IValueConverter"/> that uses a <see cref="Func{T1, TResult}"/>
/// to provide the converter logic.
/// </summary>
/// <typeparam name="TIn">The type of the inputs.</typeparam>
/// <typeparam name="TOut">The output type.</typeparam>
public class FuncMultiValueConverter<TIn, TOut> : IMultiValueConverter
{
private readonly Func<IEnumerable<TIn>, TOut> _convert;
/// <summary>
/// Initializes a new instance of the <see cref="FuncValueConverter{TIn, TOut}"/> class.
/// </summary>
/// <param name="convert">The convert function.</param>
public FuncMultiValueConverter(Func<IEnumerable<TIn>, TOut> convert)
{
_convert = convert;
}
/// <inheritdoc/>
public object Convert(IList<object> values, Type targetType, object parameter, CultureInfo culture)
{
//standard OfType skip null values, even they are valid for the Type
static IEnumerable<TIn> OfTypeWithDefaultSupport(IList<object> list)
{
foreach (object obj in list)
{
if (obj is TIn result)
{
yield return result;
}
else if (Equals(obj, default(TIn)))
{
yield return default(TIn);
}
}
}
var converted = OfTypeWithDefaultSupport(values).ToList();
if (converted.Count == values.Count)
{
return _convert(converted);
}
else
{
return AvaloniaProperty.UnsetValue;
}
}
}
}
| // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace Avalonia.Data.Converters
{
/// <summary>
/// A general purpose <see cref="IValueConverter"/> that uses a <see cref="Func{T1, TResult}"/>
/// to provide the converter logic.
/// </summary>
/// <typeparam name="TIn">The type of the inputs.</typeparam>
/// <typeparam name="TOut">The output type.</typeparam>
public class FuncMultiValueConverter<TIn, TOut> : IMultiValueConverter
{
private readonly Func<IEnumerable<TIn>, TOut> _convert;
/// <summary>
/// Initializes a new instance of the <see cref="FuncValueConverter{TIn, TOut}"/> class.
/// </summary>
/// <param name="convert">The convert function.</param>
public FuncMultiValueConverter(Func<IEnumerable<TIn>, TOut> convert)
{
_convert = convert;
}
/// <inheritdoc/>
public object Convert(IList<object> values, Type targetType, object parameter, CultureInfo culture)
{
var converted = values.OfType<TIn>().ToList();
if (converted.Count == values.Count)
{
return _convert(converted);
}
else
{
return AvaloniaProperty.UnsetValue;
}
}
}
}
| mit | C# |
995ccb7de6226dad84144864bb68740b4a1559b4 | Throw on null. | antiufo/roslyn,heejaechang/roslyn,physhi/roslyn,VitalyTVA/roslyn,natgla/roslyn,natgla/roslyn,AlexisArce/roslyn,ljw1004/roslyn,Pvlerick/roslyn,davkean/roslyn,antonssonj/roslyn,grianggrai/roslyn,xoofx/roslyn,pdelvo/roslyn,stebet/roslyn,aanshibudhiraja/Roslyn,vcsjones/roslyn,khellang/roslyn,genlu/roslyn,pdelvo/roslyn,OmarTawfik/roslyn,grianggrai/roslyn,KamalRathnayake/roslyn,yeaicc/roslyn,VSadov/roslyn,VPashkov/roslyn,michalhosala/roslyn,mavasani/roslyn,jaredpar/roslyn,srivatsn/roslyn,mattscheffer/roslyn,moozzyk/roslyn,lisong521/roslyn,jcouv/roslyn,drognanar/roslyn,VPashkov/roslyn,DustinCampbell/roslyn,davkean/roslyn,bkoelman/roslyn,devharis/roslyn,nagyistoce/roslyn,lisong521/roslyn,diryboy/roslyn,krishnarajbb/roslyn,AlekseyTs/roslyn,akrisiun/roslyn,tmeschter/roslyn,antonssonj/roslyn,EricArndt/roslyn,abock/roslyn,stephentoub/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,amcasey/roslyn,mirhagk/roslyn,brettfo/roslyn,Hosch250/roslyn,FICTURE7/roslyn,dotnet/roslyn,kienct89/roslyn,natidea/roslyn,enginekit/roslyn,dpoeschl/roslyn,ahmedshuhel/roslyn,natidea/roslyn,jeffanders/roslyn,balajikris/roslyn,HellBrick/roslyn,oberxon/roslyn,KevinRansom/roslyn,Maxwe11/roslyn,mirhagk/roslyn,ValentinRueda/roslyn,russpowers/roslyn,jbhensley/roslyn,KamalRathnayake/roslyn,ValentinRueda/roslyn,gafter/roslyn,Hosch250/roslyn,grianggrai/roslyn,mirhagk/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,physhi/roslyn,DustinCampbell/roslyn,CaptainHayashi/roslyn,TyOverby/roslyn,VPashkov/roslyn,tvand7093/roslyn,orthoxerox/roslyn,mgoertz-msft/roslyn,taylorjonl/roslyn,jonatassaraiva/roslyn,mattwar/roslyn,abock/roslyn,agocke/roslyn,RipCurrent/roslyn,agocke/roslyn,paulvanbrenk/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,AArnott/roslyn,russpowers/roslyn,abock/roslyn,AlexisArce/roslyn,ErikSchierboom/roslyn,nemec/roslyn,khellang/roslyn,bartdesmet/roslyn,OmarTawfik/roslyn,basoundr/roslyn,DustinCampbell/roslyn,dovzhikova/roslyn,khyperia/roslyn,panopticoncentral/roslyn,YOTOV-LIMITED/roslyn,MihaMarkic/roslyn-prank,wvdd007/roslyn,Pvlerick/roslyn,tannergooding/roslyn,oocx/roslyn,RipCurrent/roslyn,heejaechang/roslyn,Maxwe11/roslyn,jmarolf/roslyn,KiloBravoLima/roslyn,TyOverby/roslyn,v-codeel/roslyn,FICTURE7/roslyn,yjfxfjch/roslyn,budcribar/roslyn,managed-commons/roslyn,GuilhermeSa/roslyn,mattscheffer/roslyn,jamesqo/roslyn,swaroop-sridhar/roslyn,pjmagee/roslyn,khyperia/roslyn,sharwell/roslyn,yjfxfjch/roslyn,poizan42/roslyn,GuilhermeSa/roslyn,managed-commons/roslyn,nguerrera/roslyn,russpowers/roslyn,huoxudong125/roslyn,vslsnap/roslyn,jeffanders/roslyn,mseamari/Stuff,drognanar/roslyn,genlu/roslyn,jroggeman/roslyn,orthoxerox/roslyn,nemec/roslyn,supriyantomaftuh/roslyn,zooba/roslyn,stebet/roslyn,robinsedlaczek/roslyn,Shiney/roslyn,mseamari/Stuff,bbarry/roslyn,AArnott/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,Pvlerick/roslyn,tvand7093/roslyn,MattWindsor91/roslyn,srivatsn/roslyn,zmaruo/roslyn,aanshibudhiraja/Roslyn,stephentoub/roslyn,vcsjones/roslyn,kienct89/roslyn,dpoeschl/roslyn,HellBrick/roslyn,lorcanmooney/roslyn,ericfe-ms/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,enginekit/roslyn,ljw1004/roslyn,mmitche/roslyn,bkoelman/roslyn,bartdesmet/roslyn,Giftednewt/roslyn,xoofx/roslyn,natidea/roslyn,KamalRathnayake/roslyn,mgoertz-msft/roslyn,MatthieuMEZIL/roslyn,balajikris/roslyn,zooba/roslyn,jkotas/roslyn,drognanar/roslyn,cston/roslyn,sharadagrawal/Roslyn,Inverness/roslyn,xoofx/roslyn,KevinH-MS/roslyn,dovzhikova/roslyn,jonatassaraiva/roslyn,VitalyTVA/roslyn,amcasey/roslyn,jeffanders/roslyn,davkean/roslyn,3F/roslyn,CaptainHayashi/roslyn,evilc0des/roslyn,brettfo/roslyn,oocx/roslyn,aelij/roslyn,HellBrick/roslyn,OmarTawfik/roslyn,antiufo/roslyn,thomaslevesque/roslyn,supriyantomaftuh/roslyn,rgani/roslyn,mmitche/roslyn,gafter/roslyn,jhendrixMSFT/roslyn,natgla/roslyn,jbhensley/roslyn,mseamari/Stuff,MichalStrehovsky/roslyn,nagyistoce/roslyn,jasonmalinowski/roslyn,a-ctor/roslyn,genlu/roslyn,SeriaWei/roslyn,jkotas/roslyn,KevinRansom/roslyn,lorcanmooney/roslyn,dpoeschl/roslyn,3F/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,devharis/roslyn,khellang/roslyn,bbarry/roslyn,sharwell/roslyn,doconnell565/roslyn,eriawan/roslyn,AnthonyDGreen/roslyn,basoundr/roslyn,zmaruo/roslyn,KiloBravoLima/roslyn,tmat/roslyn,ilyes14/roslyn,antonssonj/roslyn,stephentoub/roslyn,EricArndt/roslyn,jhendrixMSFT/roslyn,nguerrera/roslyn,ValentinRueda/roslyn,leppie/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,budcribar/roslyn,MattWindsor91/roslyn,krishnarajbb/roslyn,tannergooding/roslyn,jkotas/roslyn,TyOverby/roslyn,rgani/roslyn,SeriaWei/roslyn,jaredpar/roslyn,EricArndt/roslyn,heejaechang/roslyn,doconnell565/roslyn,amcasey/roslyn,Shiney/roslyn,pjmagee/roslyn,bkoelman/roslyn,sharadagrawal/Roslyn,ErikSchierboom/roslyn,evilc0des/roslyn,huoxudong125/roslyn,tmeschter/roslyn,danielcweber/roslyn,leppie/roslyn,physhi/roslyn,budcribar/roslyn,zmaruo/roslyn,jeremymeng/roslyn,jmarolf/roslyn,vcsjones/roslyn,orthoxerox/roslyn,MichalStrehovsky/roslyn,MattWindsor91/roslyn,dotnet/roslyn,VShangxiao/roslyn,cston/roslyn,a-ctor/roslyn,AlekseyTs/roslyn,supriyantomaftuh/roslyn,swaroop-sridhar/roslyn,mattwar/roslyn,ahmedshuhel/roslyn,FICTURE7/roslyn,tang7526/roslyn,Shiney/roslyn,xasx/roslyn,yeaicc/roslyn,KevinRansom/roslyn,jroggeman/roslyn,robinsedlaczek/roslyn,MattWindsor91/roslyn,rgani/roslyn,v-codeel/roslyn,panopticoncentral/roslyn,VSadov/roslyn,thomaslevesque/roslyn,kienct89/roslyn,YOTOV-LIMITED/roslyn,tmat/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,jeremymeng/roslyn,ericfe-ms/roslyn,jasonmalinowski/roslyn,moozzyk/roslyn,lisong521/roslyn,oberxon/roslyn,paulvanbrenk/roslyn,mattwar/roslyn,poizan42/roslyn,michalhosala/roslyn,VShangxiao/roslyn,vslsnap/roslyn,robinsedlaczek/roslyn,taylorjonl/roslyn,yjfxfjch/roslyn,MatthieuMEZIL/roslyn,aanshibudhiraja/Roslyn,tang7526/roslyn,reaction1989/roslyn,tmat/roslyn,nguerrera/roslyn,AmadeusW/roslyn,mmitche/roslyn,Giftednewt/roslyn,Maxwe11/roslyn,khyperia/roslyn,ericfe-ms/roslyn,jcouv/roslyn,tvand7093/roslyn,evilc0des/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,nagyistoce/roslyn,ahmedshuhel/roslyn,kelltrick/roslyn,dovzhikova/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,taylorjonl/roslyn,leppie/roslyn,jroggeman/roslyn,jcouv/roslyn,MatthieuMEZIL/roslyn,GuilhermeSa/roslyn,wvdd007/roslyn,VitalyTVA/roslyn,ljw1004/roslyn,bbarry/roslyn,enginekit/roslyn,sharadagrawal/Roslyn,kelltrick/roslyn,zooba/roslyn,akrisiun/roslyn,tang7526/roslyn,Inverness/roslyn,eriawan/roslyn,jonatassaraiva/roslyn,diryboy/roslyn,magicbing/roslyn,jaredpar/roslyn,michalhosala/roslyn,antiufo/roslyn,KiloBravoLima/roslyn,MihaMarkic/roslyn-prank,AArnott/roslyn,Hosch250/roslyn,vslsnap/roslyn,agocke/roslyn,lorcanmooney/roslyn,sharwell/roslyn,jeremymeng/roslyn,YOTOV-LIMITED/roslyn,xasx/roslyn,MihaMarkic/roslyn-prank,tmeschter/roslyn,doconnell565/roslyn,dotnet/roslyn,mattscheffer/roslyn,poizan42/roslyn,oocx/roslyn,yeaicc/roslyn,mavasani/roslyn,VSadov/roslyn,balajikris/roslyn,bartdesmet/roslyn,pdelvo/roslyn,krishnarajbb/roslyn,cston/roslyn,danielcweber/roslyn,reaction1989/roslyn,gafter/roslyn,paulvanbrenk/roslyn,managed-commons/roslyn,panopticoncentral/roslyn,stebet/roslyn,ilyes14/roslyn,jamesqo/roslyn,devharis/roslyn,shyamnamboodiripad/roslyn,3F/roslyn,weltkante/roslyn,v-codeel/roslyn,huoxudong125/roslyn,Giftednewt/roslyn,basoundr/roslyn,KirillOsenkov/roslyn,srivatsn/roslyn,AlexisArce/roslyn,jbhensley/roslyn,akrisiun/roslyn,danielcweber/roslyn,kelltrick/roslyn,oberxon/roslyn,tannergooding/roslyn,magicbing/roslyn,Inverness/roslyn,MichalStrehovsky/roslyn,pjmagee/roslyn,CyrusNajmabadi/roslyn,moozzyk/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,xasx/roslyn,magicbing/roslyn,AmadeusW/roslyn,RipCurrent/roslyn,a-ctor/roslyn,mavasani/roslyn,jamesqo/roslyn,CaptainHayashi/roslyn,reaction1989/roslyn,AnthonyDGreen/roslyn,thomaslevesque/roslyn,nemec/roslyn,KevinH-MS/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,AnthonyDGreen/roslyn,SeriaWei/roslyn,KevinH-MS/roslyn,jhendrixMSFT/roslyn,brettfo/roslyn,ilyes14/roslyn,VShangxiao/roslyn | src/EditorFeatures/Core/Tagging/AsynchronousTaggerContext.cs | src/EditorFeatures/Core/Tagging/AsynchronousTaggerContext.cs | using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.Tagging
{
internal class AsynchronousTaggerContext<TTag, TState> where TTag : ITag
{
public TState State { get; set; }
public IEnumerable<DocumentSnapshotSpan> SpansToTag { get; }
public SnapshotPoint? CaretPosition { get; }
public TextChangeRange? TextChangeRange { get; }
public CancellationToken CancellationToken { get; }
internal IEnumerable<DocumentSnapshotSpan> spansTagged;
internal ImmutableArray<ITagSpan<TTag>>.Builder tagSpans = ImmutableArray.CreateBuilder<ITagSpan<TTag>>();
internal AsynchronousTaggerContext(
TState state,
IEnumerable<DocumentSnapshotSpan> spansToTag,
SnapshotPoint? caretPosition,
TextChangeRange? textChangeRange,
CancellationToken cancellationToken)
{
this.State = state;
this.SpansToTag = spansToTag;
this.CaretPosition = caretPosition;
this.TextChangeRange = textChangeRange;
this.CancellationToken = cancellationToken;
this.spansTagged = spansToTag;
}
public void AddTag(ITagSpan<TTag> tag)
{
tagSpans.Add(tag);
}
/// <summary>
/// Used to allow taggers to indicate what spans were actually tagged. This is useful
/// when the tagger decides to tag a different span than the entire file. If a sub-span
/// of a document is tagged then the tagger infrastructure will keep previously computed
/// tags from before and after the sub-span and merge them with the newly produced tags.
/// </summary>
public void SetSpansTagged(IEnumerable<DocumentSnapshotSpan> spansTagged)
{
if (spansTagged == null)
{
throw new ArgumentNullException(nameof(spansTagged));
}
this.spansTagged = spansTagged;
}
}
}
| using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.Tagging
{
internal class AsynchronousTaggerContext<TTag, TState> where TTag : ITag
{
public TState State { get; set; }
public IEnumerable<DocumentSnapshotSpan> SpansToTag { get; }
public SnapshotPoint? CaretPosition { get; }
public TextChangeRange? TextChangeRange { get; }
public CancellationToken CancellationToken { get; }
internal IEnumerable<DocumentSnapshotSpan> spansTagged;
internal ImmutableArray<ITagSpan<TTag>>.Builder tagSpans = ImmutableArray.CreateBuilder<ITagSpan<TTag>>();
internal AsynchronousTaggerContext(
TState state,
IEnumerable<DocumentSnapshotSpan> spansToTag,
SnapshotPoint? caretPosition,
TextChangeRange? textChangeRange,
CancellationToken cancellationToken)
{
this.State = state;
this.SpansToTag = spansToTag;
this.CaretPosition = caretPosition;
this.TextChangeRange = textChangeRange;
this.CancellationToken = cancellationToken;
this.spansTagged = spansToTag;
}
public void AddTag(ITagSpan<TTag> tag)
{
tagSpans.Add(tag);
}
/// <summary>
/// Used to allow taggers to indicate what spans were actually tagged. This is useful
/// when the tagger decides to tag a different span than the entire file. If a sub-span
/// of a document is tagged then the tagger infrastructure will keep previously computed
/// tags from before and after the sub-span and merge them with the newly produced tags.
/// </summary>
public void SetSpansTagged(IEnumerable<DocumentSnapshotSpan> spansTagged)
{
this.spansTagged = spansTagged;
}
}
}
| apache-2.0 | C# |
56c6d9dbf5ffe835d2d2a53acd6926f078ad4705 | Simplify MediaLibraryPicker.Summary.cshtml | openbizgit/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,MpDzik/Orchard,spraiin/Orchard,salarvand/orchard,dozoft/Orchard,li0803/Orchard,oxwanawxo/Orchard,AndreVolksdorf/Orchard,Lombiq/Orchard,m2cms/Orchard,OrchardCMS/Orchard-Harvest-Website,sebastienros/msc,SzymonSel/Orchard,emretiryaki/Orchard,alejandroaldana/Orchard,dcinzona/Orchard,Ermesx/Orchard,hannan-azam/Orchard,sebastienros/msc,Sylapse/Orchard.HttpAuthSample,enspiral-dev-academy/Orchard,ehe888/Orchard,SouleDesigns/SouleDesigns.Orchard,TaiAivaras/Orchard,DonnotRain/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jimasp/Orchard,xkproject/Orchard,emretiryaki/Orchard,angelapper/Orchard,SeyDutch/Airbrush,Lombiq/Orchard,MetSystem/Orchard,SouleDesigns/SouleDesigns.Orchard,abhishekluv/Orchard,escofieldnaxos/Orchard,SzymonSel/Orchard,yersans/Orchard,omidnasri/Orchard,NIKASoftwareDevs/Orchard,dcinzona/Orchard-Harvest-Website,SeyDutch/Airbrush,Serlead/Orchard,qt1/orchard4ibn,JRKelso/Orchard,bigfont/orchard-cms-modules-and-themes,TalaveraTechnologySolutions/Orchard,marcoaoteixeira/Orchard,OrchardCMS/Orchard,m2cms/Orchard,dburriss/Orchard,smartnet-developers/Orchard,xkproject/Orchard,luchaoshuai/Orchard,Cphusion/Orchard,vairam-svs/Orchard,Morgma/valleyviewknolls,dburriss/Orchard,arminkarimi/Orchard,patricmutwiri/Orchard,TalaveraTechnologySolutions/Orchard,armanforghani/Orchard,xiaobudian/Orchard,hannan-azam/Orchard,vairam-svs/Orchard,yonglehou/Orchard,fassetar/Orchard,jersiovic/Orchard,TalaveraTechnologySolutions/Orchard,armanforghani/Orchard,salarvand/orchard,SeyDutch/Airbrush,hbulzy/Orchard,omidnasri/Orchard,austinsc/Orchard,jtkech/Orchard,OrchardCMS/Orchard-Harvest-Website,Serlead/Orchard,Praggie/Orchard,m2cms/Orchard,vard0/orchard.tan,bigfont/orchard-continuous-integration-demo,huoxudong125/Orchard,Fogolan/OrchardForWork,MpDzik/Orchard,JRKelso/Orchard,luchaoshuai/Orchard,LaserSrl/Orchard,sfmskywalker/Orchard,abhishekluv/Orchard,infofromca/Orchard,openbizgit/Orchard,AndreVolksdorf/Orchard,xiaobudian/Orchard,andyshao/Orchard,salarvand/orchard,jagraz/Orchard,oxwanawxo/Orchard,ehe888/Orchard,hhland/Orchard,geertdoornbos/Orchard,Morgma/valleyviewknolls,Lombiq/Orchard,mvarblow/Orchard,MpDzik/Orchard,Anton-Am/Orchard,sfmskywalker/Orchard,IDeliverable/Orchard,yonglehou/Orchard,TalaveraTechnologySolutions/Orchard,TaiAivaras/Orchard,Dolphinsimon/Orchard,gcsuk/Orchard,stormleoxia/Orchard,infofromca/Orchard,xkproject/Orchard,omidnasri/Orchard,ehe888/Orchard,ehe888/Orchard,SeyDutch/Airbrush,dozoft/Orchard,vard0/orchard.tan,austinsc/Orchard,MetSystem/Orchard,alejandroaldana/Orchard,kouweizhong/Orchard,salarvand/orchard,cooclsee/Orchard,andyshao/Orchard,jchenga/Orchard,qt1/orchard4ibn,li0803/Orchard,omidnasri/Orchard,hannan-azam/Orchard,Morgma/valleyviewknolls,AdvantageCS/Orchard,yersans/Orchard,Sylapse/Orchard.HttpAuthSample,Sylapse/Orchard.HttpAuthSample,escofieldnaxos/Orchard,jtkech/Orchard,dburriss/Orchard,johnnyqian/Orchard,neTp9c/Orchard,patricmutwiri/Orchard,yersans/Orchard,phillipsj/Orchard,Anton-Am/Orchard,Praggie/Orchard,sfmskywalker/Orchard,tobydodds/folklife,Ermesx/Orchard,johnnyqian/Orchard,KeithRaven/Orchard,OrchardCMS/Orchard-Harvest-Website,escofieldnaxos/Orchard,kouweizhong/Orchard,jagraz/Orchard,andyshao/Orchard,enspiral-dev-academy/Orchard,dcinzona/Orchard,kgacova/Orchard,armanforghani/Orchard,jagraz/Orchard,rtpHarry/Orchard,dcinzona/Orchard-Harvest-Website,NIKASoftwareDevs/Orchard,andyshao/Orchard,Ermesx/Orchard,Codinlab/Orchard,OrchardCMS/Orchard,qt1/orchard4ibn,Fogolan/OrchardForWork,AdvantageCS/Orchard,qt1/Orchard,smartnet-developers/Orchard,cooclsee/Orchard,jersiovic/Orchard,jaraco/orchard,grapto/Orchard.CloudBust,johnnyqian/Orchard,marcoaoteixeira/Orchard,JRKelso/Orchard,li0803/Orchard,johnnyqian/Orchard,Dolphinsimon/Orchard,MetSystem/Orchard,OrchardCMS/Orchard,TalaveraTechnologySolutions/Orchard,yersans/Orchard,dburriss/Orchard,phillipsj/Orchard,SouleDesigns/SouleDesigns.Orchard,bedegaming-aleksej/Orchard,dcinzona/Orchard,KeithRaven/Orchard,RoyalVeterinaryCollege/Orchard,LaserSrl/Orchard,AdvantageCS/Orchard,MetSystem/Orchard,Codinlab/Orchard,spraiin/Orchard,alejandroaldana/Orchard,smartnet-developers/Orchard,RoyalVeterinaryCollege/Orchard,sebastienros/msc,patricmutwiri/Orchard,rtpHarry/Orchard,alejandroaldana/Orchard,enspiral-dev-academy/Orchard,bigfont/orchard-continuous-integration-demo,LaserSrl/Orchard,huoxudong125/Orchard,arminkarimi/Orchard,oxwanawxo/Orchard,huoxudong125/Orchard,hannan-azam/Orchard,brownjordaninternational/OrchardCMS,Lombiq/Orchard,tobydodds/folklife,bedegaming-aleksej/Orchard,yonglehou/Orchard,SouleDesigns/SouleDesigns.Orchard,gcsuk/Orchard,Morgma/valleyviewknolls,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Ermesx/Orchard,li0803/Orchard,mgrowan/Orchard,AndreVolksdorf/Orchard,jagraz/Orchard,dcinzona/Orchard,NIKASoftwareDevs/Orchard,KeithRaven/Orchard,hbulzy/Orchard,planetClaire/Orchard-LETS,angelapper/Orchard,arminkarimi/Orchard,OrchardCMS/Orchard-Harvest-Website,jagraz/Orchard,Serlead/Orchard,hhland/Orchard,geertdoornbos/Orchard,li0803/Orchard,austinsc/Orchard,tobydodds/folklife,mvarblow/Orchard,cooclsee/Orchard,fassetar/Orchard,aaronamm/Orchard,huoxudong125/Orchard,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-continuous-integration-demo,SzymonSel/Orchard,enspiral-dev-academy/Orchard,MpDzik/Orchard,OrchardCMS/Orchard-Harvest-Website,jchenga/Orchard,Serlead/Orchard,escofieldnaxos/Orchard,Fogolan/OrchardForWork,Inner89/Orchard,phillipsj/Orchard,huoxudong125/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,SzymonSel/Orchard,aaronamm/Orchard,mgrowan/Orchard,jerryshi2007/Orchard,yersans/Orchard,armanforghani/Orchard,jtkech/Orchard,yonglehou/Orchard,luchaoshuai/Orchard,qt1/orchard4ibn,OrchardCMS/Orchard,TalaveraTechnologySolutions/Orchard,harmony7/Orchard,geertdoornbos/Orchard,RoyalVeterinaryCollege/Orchard,AdvantageCS/Orchard,emretiryaki/Orchard,Praggie/Orchard,bigfont/orchard-cms-modules-and-themes,jimasp/Orchard,NIKASoftwareDevs/Orchard,luchaoshuai/Orchard,vard0/orchard.tan,kouweizhong/Orchard,emretiryaki/Orchard,dcinzona/Orchard-Harvest-Website,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,xiaobudian/Orchard,andyshao/Orchard,geertdoornbos/Orchard,DonnotRain/Orchard,harmony7/Orchard,oxwanawxo/Orchard,rtpHarry/Orchard,infofromca/Orchard,JRKelso/Orchard,NIKASoftwareDevs/Orchard,kgacova/Orchard,TaiAivaras/Orchard,Inner89/Orchard,smartnet-developers/Orchard,sfmskywalker/Orchard,arminkarimi/Orchard,sfmskywalker/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,infofromca/Orchard,aaronamm/Orchard,TaiAivaras/Orchard,AndreVolksdorf/Orchard,fassetar/Orchard,kouweizhong/Orchard,vard0/orchard.tan,kgacova/Orchard,abhishekluv/Orchard,aaronamm/Orchard,jersiovic/Orchard,neTp9c/Orchard,patricmutwiri/Orchard,DonnotRain/Orchard,OrchardCMS/Orchard-Harvest-Website,fassetar/Orchard,jerryshi2007/Orchard,Codinlab/Orchard,infofromca/Orchard,tobydodds/folklife,omidnasri/Orchard,Morgma/valleyviewknolls,grapto/Orchard.CloudBust,harmony7/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,salarvand/Portal,openbizgit/Orchard,Inner89/Orchard,abhishekluv/Orchard,bigfont/orchard-continuous-integration-demo,MetSystem/Orchard,AdvantageCS/Orchard,fortunearterial/Orchard,sfmskywalker/Orchard,oxwanawxo/Orchard,jchenga/Orchard,marcoaoteixeira/Orchard,kgacova/Orchard,SzymonSel/Orchard,hannan-azam/Orchard,abhishekluv/Orchard,salarvand/Portal,sebastienros/msc,Cphusion/Orchard,jchenga/Orchard,escofieldnaxos/Orchard,vard0/orchard.tan,alejandroaldana/Orchard,stormleoxia/Orchard,Inner89/Orchard,stormleoxia/Orchard,KeithRaven/Orchard,DonnotRain/Orchard,gcsuk/Orchard,IDeliverable/Orchard,bedegaming-aleksej/Orchard,hhland/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,SouleDesigns/SouleDesigns.Orchard,jimasp/Orchard,armanforghani/Orchard,angelapper/Orchard,gcsuk/Orchard,sfmskywalker/Orchard,jerryshi2007/Orchard,jerryshi2007/Orchard,marcoaoteixeira/Orchard,fassetar/Orchard,stormleoxia/Orchard,hbulzy/Orchard,jimasp/Orchard,yonglehou/Orchard,mvarblow/Orchard,Serlead/Orchard,sebastienros/msc,dcinzona/Orchard-Harvest-Website,omidnasri/Orchard,fortunearterial/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,qt1/Orchard,jimasp/Orchard,grapto/Orchard.CloudBust,AndreVolksdorf/Orchard,cooclsee/Orchard,dozoft/Orchard,phillipsj/Orchard,angelapper/Orchard,jtkech/Orchard,qt1/orchard4ibn,neTp9c/Orchard,qt1/orchard4ibn,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,luchaoshuai/Orchard,TalaveraTechnologySolutions/Orchard,jaraco/orchard,jersiovic/Orchard,jtkech/Orchard,rtpHarry/Orchard,dozoft/Orchard,mvarblow/Orchard,fortunearterial/Orchard,Anton-Am/Orchard,kgacova/Orchard,Ermesx/Orchard,vairam-svs/Orchard,SeyDutch/Airbrush,abhishekluv/Orchard,TalaveraTechnologySolutions/Orchard,xiaobudian/Orchard,Anton-Am/Orchard,KeithRaven/Orchard,LaserSrl/Orchard,hhland/Orchard,Dolphinsimon/Orchard,Lombiq/Orchard,vairam-svs/Orchard,vard0/orchard.tan,smartnet-developers/Orchard,jerryshi2007/Orchard,openbizgit/Orchard,ehe888/Orchard,fortunearterial/Orchard,grapto/Orchard.CloudBust,Fogolan/OrchardForWork,dcinzona/Orchard-Harvest-Website,austinsc/Orchard,TaiAivaras/Orchard,MpDzik/Orchard,Codinlab/Orchard,omidnasri/Orchard,brownjordaninternational/OrchardCMS,enspiral-dev-academy/Orchard,emretiryaki/Orchard,fortunearterial/Orchard,Dolphinsimon/Orchard,dcinzona/Orchard,RoyalVeterinaryCollege/Orchard,OrchardCMS/Orchard,gcsuk/Orchard,qt1/Orchard,neTp9c/Orchard,qt1/Orchard,hbulzy/Orchard,vairam-svs/Orchard,phillipsj/Orchard,jaraco/orchard,IDeliverable/Orchard,JRKelso/Orchard,planetClaire/Orchard-LETS,bigfont/orchard-cms-modules-and-themes,tobydodds/folklife,geertdoornbos/Orchard,omidnasri/Orchard,grapto/Orchard.CloudBust,tobydodds/folklife,angelapper/Orchard,spraiin/Orchard,IDeliverable/Orchard,mgrowan/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,xkproject/Orchard,brownjordaninternational/OrchardCMS,jchenga/Orchard,hhland/Orchard,dcinzona/Orchard-Harvest-Website,m2cms/Orchard,mgrowan/Orchard,patricmutwiri/Orchard,Inner89/Orchard,mvarblow/Orchard,sfmskywalker/Orchard,salarvand/orchard,dmitry-urenev/extended-orchard-cms-v10.1,arminkarimi/Orchard,bigfont/orchard-cms-modules-and-themes,m2cms/Orchard,DonnotRain/Orchard,openbizgit/Orchard,salarvand/Portal,LaserSrl/Orchard,Cphusion/Orchard,Dolphinsimon/Orchard,Sylapse/Orchard.HttpAuthSample,qt1/Orchard,stormleoxia/Orchard,hbulzy/Orchard,Sylapse/Orchard.HttpAuthSample,xkproject/Orchard,dozoft/Orchard,Praggie/Orchard,omidnasri/Orchard,MpDzik/Orchard,marcoaoteixeira/Orchard,Codinlab/Orchard,Cphusion/Orchard,Fogolan/OrchardForWork,cooclsee/Orchard,austinsc/Orchard,brownjordaninternational/OrchardCMS,johnnyqian/Orchard,kouweizhong/Orchard,planetClaire/Orchard-LETS,bedegaming-aleksej/Orchard,jaraco/orchard,jersiovic/Orchard,dburriss/Orchard,RoyalVeterinaryCollege/Orchard,planetClaire/Orchard-LETS,spraiin/Orchard,harmony7/Orchard,Cphusion/Orchard,salarvand/Portal,aaronamm/Orchard,brownjordaninternational/OrchardCMS,salarvand/Portal,spraiin/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Praggie/Orchard,xiaobudian/Orchard,rtpHarry/Orchard,bedegaming-aleksej/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,mgrowan/Orchard,neTp9c/Orchard,Anton-Am/Orchard,planetClaire/Orchard-LETS,harmony7/Orchard,IDeliverable/Orchard,grapto/Orchard.CloudBust | src/Orchard.Web/Modules/Orchard.MediaLibrary/Views/Fields/MediaLibraryPicker.Summary.cshtml | src/Orchard.Web/Modules/Orchard.MediaLibrary/Views/Fields/MediaLibraryPicker.Summary.cshtml | @using Orchard.Core.Contents
@using Orchard.MediaLibrary.Fields
@using Orchard.Utility.Extensions;
@{
var field = (MediaLibraryPickerField) Model.ContentField;
string name = field.DisplayName;
var mediaParts = field.MediaParts;
}
@if (mediaParts.Any()) {
<span class="name">@name:</span>
<p class="media-@name.HtmlClassify()">
@foreach (var contentItem in mediaParts) {
@Display(BuildDisplay(contentItem, "Thumbnail"))
}
</p>
} | @using Orchard.Core.Contents
@using Orchard.MediaLibrary.Fields
@using Orchard.Utility.Extensions;
@{
var field = (MediaLibraryPickerField) Model.ContentField;
string name = field.DisplayName;
var mediaParts = field.MediaParts;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
}
@if (mediaParts.Any()) {
<span class="name">@name:</span>
<p class="media-@name.HtmlClassify()">
@foreach (var contentItem in mediaParts) {
if (Authorizer.Authorize(Permissions.EditContent, contentItem)) {
<a href="@Url.ItemEditUrl(contentItem, new {returnUrl})">
@Display(BuildDisplay(contentItem, "Thumbnail"))
</a>
}
else {
@Display(BuildDisplay(contentItem, "Thumbnail"))
}
}
</p>
} | bsd-3-clause | C# |
803c1839ed7e5eb3d74eede461e06d51324f8d1a | Comment the necessity to create an external file before running SqlAdapter_Tests | Sitecore/Sitecore-Instance-Manager | src/SIM.Foundation.SqlAdapter.IntegrationTests/Adapters/SqlAdapter_Tests.cs | src/SIM.Foundation.SqlAdapter.IntegrationTests/Adapters/SqlAdapter_Tests.cs | namespace SIM.Adapters
{
using System;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SIM.IO.Real;
using SIM.Services;
[TestClass]
public class SqlAdapter_Tests
{
//These tests require the "C:\Sitecore\etc\sim\env\default\SqlServer.txt" file to be present.
//This file contains one line which is a connection string to the SQL server.
//If such file is not present, it should be created by the build task before running integration tests.
private const string DefaultEnvSqlPath = @"C:\Sitecore\etc\sim\env\default\SqlServer.txt";
[NotNull]
private SqlAdapter Adapter { get; } = new SqlAdapter(new SqlConnectionString(File.ReadAllText(DefaultEnvSqlPath)));
[TestMethod]
public void DeleteDatabase_MissingDatabase()
{
Adapter.DeleteDatabase(GetRandomDatabaseName());
}
[TestMethod]
public void GetDatabaseFilePath_MissingDatabase()
{
var databaseName = GetRandomDatabaseName();
try
{
Adapter.GetDatabaseFilePath(databaseName);
}
catch (DatabaseDoesNotExistException ex)
{
Assert.AreEqual(databaseName, ex.DatabaseName);
Assert.AreEqual($"Failed to perform an operation with SqlServer. The requested '{databaseName}' database does not exist", ex.Message);
return;
}
Assert.Fail();
}
[TestMethod]
[DeploymentItem("Adapters\\SqlAdapter_Database.dacpac")]
public void Deploy_Check_Delete_Check()
{
var fileSystem = new RealFileSystem();
var databaseName = GetRandomDatabaseName();
var dacpac = fileSystem.ParseFile("SqlAdapter_Database.dacpac");
Assert.AreEqual(true, dacpac.Exists);
int count;
try
{
Adapter.DeployDatabase(databaseName, dacpac);
Assert.AreEqual(true, Adapter.DatabaseExists(databaseName));
Assert.AreEqual(true, !string.IsNullOrEmpty(Adapter.GetDatabaseFilePath(databaseName)));
var databases = Adapter.GetDatabases();
Assert.AreEqual(true, databases.Contains(databaseName));
count = databases.Count;
Assert.AreEqual(true, count >= 1);
}
finally
{
Adapter.DeleteDatabase(databaseName);
}
Assert.AreEqual(false, Adapter.DatabaseExists(databaseName));
var newCount = Adapter.GetDatabases().Count;
Assert.AreEqual(count - 1, newCount);
}
[NotNull]
private static string GetRandomDatabaseName()
{
return Guid.NewGuid().ToString("N");
}
}
}
| namespace SIM.Adapters
{
using System;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SIM.IO.Real;
using SIM.Services;
[TestClass]
public class SqlAdapter_Tests
{
private const string DefaultEnvSqlPath = @"C:\Sitecore\etc\sim2\env\default\SqlServer.txt";
[NotNull]
private SqlAdapter Adapter { get; } = new SqlAdapter(new SqlConnectionString(File.ReadAllText(DefaultEnvSqlPath)));
[TestMethod]
public void DeleteDatabase_MissingDatabase()
{
Adapter.DeleteDatabase(GetRandomDatabaseName());
}
[TestMethod]
public void GetDatabaseFilePath_MissingDatabase()
{
var databaseName = GetRandomDatabaseName();
try
{
Adapter.GetDatabaseFilePath(databaseName);
}
catch (DatabaseDoesNotExistException ex)
{
Assert.AreEqual(databaseName, ex.DatabaseName);
Assert.AreEqual($"Failed to perform an operation with SqlServer. The requested '{databaseName}' database does not exist", ex.Message);
return;
}
Assert.Fail();
}
[TestMethod]
[DeploymentItem("Adapters\\SqlAdapter_Database.dacpac")]
public void Deploy_Check_Delete_Check()
{
var fileSystem = new RealFileSystem();
var databaseName = GetRandomDatabaseName();
var dacpac = fileSystem.ParseFile("SqlAdapter_Database.dacpac");
Assert.AreEqual(true, dacpac.Exists);
int count;
try
{
Adapter.DeployDatabase(databaseName, dacpac);
Assert.AreEqual(true, Adapter.DatabaseExists(databaseName));
Assert.AreEqual(true, !string.IsNullOrEmpty(Adapter.GetDatabaseFilePath(databaseName)));
var databases = Adapter.GetDatabases();
Assert.AreEqual(true, databases.Contains(databaseName));
count = databases.Count;
Assert.AreEqual(true, count >= 1);
}
finally
{
Adapter.DeleteDatabase(databaseName);
}
Assert.AreEqual(false, Adapter.DatabaseExists(databaseName));
var newCount = Adapter.GetDatabases().Count;
Assert.AreEqual(count - 1, newCount);
}
[NotNull]
private static string GetRandomDatabaseName()
{
return Guid.NewGuid().ToString("N");
}
}
}
| mit | C# |
678b74ef29ad712b5b1b30ebece1afbec63dc374 | add the parent reference in the node | MCSN-project2014/APproject,MCSN-project2014/APproject | APproject/AST/Node.cs | APproject/AST/Node.cs | using System.Collections.Generic;
using System;
namespace APproject
{
public enum Statement {If,While,Return,Ass,Dec,AssDec,Print,Read,Async,
plus,mul,minus,div,g,geq,l,leq,eq};
public class Node
{
private Node parent;
private List<Node> children;
public Statement stmn;
//public Operation op;
public Obj term;
private void init(){
this.term = null;
this.parent = null;
this.children = new List<Node> ();
}
public Node (Statement stmn)
{
init ();
this.stmn = stmn;
}
public Node (Obj term){
init ();
this.term = term;
}
public void addChildren (Node node){
node.parent = this;
children.Add (node);
}
public List<Node> getChildren(){
return new List<Node>(children);
}
}
}
| using System.Collections.Generic;
using System;
namespace APproject
{
public enum Statement {If,While,Return,Ass,Dec,AssDec,Print,Read,Async,
plus,mul,minus,div,g,geq,l,leq,eq};
public class Node
{
private List<Node> children;
public Statement stmn;
//public Operation op;
public Obj term;
private void init(){
term = null;
children = new List<Node> ();
}
public Node (Statement stmn)
{
init ();
this.stmn = stmn;
}
public Node (Obj term){
init ();
this.term = term;
}
public void addChildren (Node node){
children.Add (node);
}
public List<Node> getChildren(){
return new List<Node>(children);
}
}
}
| mit | C# |
1fb14b1bc85f2a1c9e1c39e7afaea7df2284513b | Update NDemo.cs | demigor/nreact | NReact.Demo.Wpf/Components/NDemo.cs | NReact.Demo.Wpf/Components/NDemo.cs | using System;
using System.Threading;
#if NETFX_CORE
using Windows.UI.Popups;
using Windows.UI.Xaml;
#else
using System.Windows;
#endif
namespace NReact
{
public partial class NDemo : NComponent
{
public const int RefreshDelay = 10;
public override object GetDefaultProps()
{
return new { FontSize = 12.0 };
}
Timer _timer;
public override void ComponentDidMount()
{
_timer = new Timer(TickSize, null, 0, RefreshDelay);
}
public override void ComponentWillUnmount()
{
_timer.Dispose();
}
void TickSize(object state)
{
var fs = Props.FontSize + 0.5;
if (fs > 50) fs = 10.0;
SetProps(new { FontSize = fs });
}
void ClickMe(object sender, RoutedEventArgs args)
{
#if NETFX_CORE
new MessageDialog("Click").ShowAsync();
#else
MessageBox.Show("Click");
#endif
}
}
}
| using System;
using System.Threading;
#if NETFX_CORE
using Windows.UI.Popups;
using Windows.UI.Xaml;
#else
using System.Windows;
#endif
namespace NReact
{
public partial class NDemo : NComponent
{
public const int RefreshDelay = 10;
public override object GetDefaultProps()
{
return new { FontSize = 12D }.AsDynamic();
}
Timer _timer;
public override void ComponentDidMount()
{
_timer = new Timer(TickSize, null, 0, RefreshDelay);
}
public override void ComponentWillUnmount()
{
_timer.Dispose();
}
void TickSize(object state)
{
var fs = Props.FontSize + 0.5;
if (fs > 50) fs = 10d;
SetProps(new { FontSize = fs });
}
void ClickMe(object sender, RoutedEventArgs args)
{
#if NETFX_CORE
new MessageDialog("Click").ShowAsync();
#else
MessageBox.Show("Click");
#endif
}
}
}
| mit | C# |
049df92fedbb6feab99d2b6cc24f71d7567ddb0e | Add .NET Core Unit Test templates to WellKnownProjectTemplates... | VSadov/roslyn,bkoelman/roslyn,ErikSchierboom/roslyn,robinsedlaczek/roslyn,mmitche/roslyn,mmitche/roslyn,reaction1989/roslyn,bartdesmet/roslyn,TyOverby/roslyn,MattWindsor91/roslyn,OmarTawfik/roslyn,khyperia/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,jeffanders/roslyn,cston/roslyn,MichalStrehovsky/roslyn,heejaechang/roslyn,zooba/roslyn,jamesqo/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,nguerrera/roslyn,dpoeschl/roslyn,Hosch250/roslyn,agocke/roslyn,aelij/roslyn,Giftednewt/roslyn,amcasey/roslyn,abock/roslyn,dotnet/roslyn,stephentoub/roslyn,stephentoub/roslyn,agocke/roslyn,brettfo/roslyn,physhi/roslyn,jamesqo/roslyn,bkoelman/roslyn,tannergooding/roslyn,tmeschter/roslyn,CaptainHayashi/roslyn,tmat/roslyn,genlu/roslyn,AnthonyDGreen/roslyn,VSadov/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,jkotas/roslyn,tannergooding/roslyn,genlu/roslyn,MichalStrehovsky/roslyn,amcasey/roslyn,mattscheffer/roslyn,KevinRansom/roslyn,akrisiun/roslyn,eriawan/roslyn,drognanar/roslyn,TyOverby/roslyn,cston/roslyn,brettfo/roslyn,jamesqo/roslyn,srivatsn/roslyn,khyperia/roslyn,paulvanbrenk/roslyn,diryboy/roslyn,mavasani/roslyn,kelltrick/roslyn,bartdesmet/roslyn,zooba/roslyn,jeffanders/roslyn,srivatsn/roslyn,mavasani/roslyn,nguerrera/roslyn,swaroop-sridhar/roslyn,amcasey/roslyn,MattWindsor91/roslyn,diryboy/roslyn,agocke/roslyn,reaction1989/roslyn,srivatsn/roslyn,abock/roslyn,yeaicc/roslyn,DustinCampbell/roslyn,aelij/roslyn,MattWindsor91/roslyn,Hosch250/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,AlekseyTs/roslyn,jcouv/roslyn,tmeschter/roslyn,mmitche/roslyn,AmadeusW/roslyn,jkotas/roslyn,OmarTawfik/roslyn,tvand7093/roslyn,drognanar/roslyn,jeffanders/roslyn,KevinRansom/roslyn,MichalStrehovsky/roslyn,reaction1989/roslyn,CaptainHayashi/roslyn,genlu/roslyn,ErikSchierboom/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,lorcanmooney/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,mattscheffer/roslyn,tmeschter/roslyn,bkoelman/roslyn,yeaicc/roslyn,CaptainHayashi/roslyn,lorcanmooney/roslyn,CyrusNajmabadi/roslyn,mattwar/roslyn,cston/roslyn,Giftednewt/roslyn,Giftednewt/roslyn,swaroop-sridhar/roslyn,orthoxerox/roslyn,akrisiun/roslyn,davkean/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,DustinCampbell/roslyn,jmarolf/roslyn,heejaechang/roslyn,diryboy/roslyn,weltkante/roslyn,OmarTawfik/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,aelij/roslyn,orthoxerox/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,tvand7093/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,pdelvo/roslyn,AlekseyTs/roslyn,xasx/roslyn,abock/roslyn,mattwar/roslyn,panopticoncentral/roslyn,mavasani/roslyn,paulvanbrenk/roslyn,DustinCampbell/roslyn,gafter/roslyn,tvand7093/roslyn,physhi/roslyn,mattscheffer/roslyn,eriawan/roslyn,dotnet/roslyn,kelltrick/roslyn,davkean/roslyn,drognanar/roslyn,robinsedlaczek/roslyn,ErikSchierboom/roslyn,davkean/roslyn,dotnet/roslyn,mattwar/roslyn,AnthonyDGreen/roslyn,jcouv/roslyn,tmat/roslyn,akrisiun/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,MattWindsor91/roslyn,pdelvo/roslyn,gafter/roslyn,orthoxerox/roslyn,paulvanbrenk/roslyn,xasx/roslyn,jcouv/roslyn,xasx/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,heejaechang/roslyn,sharwell/roslyn,gafter/roslyn,wvdd007/roslyn,VSadov/roslyn,yeaicc/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,mgoertz-msft/roslyn,dpoeschl/roslyn,eriawan/roslyn,jmarolf/roslyn,AmadeusW/roslyn,Hosch250/roslyn,TyOverby/roslyn,jkotas/roslyn,weltkante/roslyn,swaroop-sridhar/roslyn,kelltrick/roslyn,robinsedlaczek/roslyn,pdelvo/roslyn,weltkante/roslyn,lorcanmooney/roslyn,zooba/roslyn,sharwell/roslyn,AnthonyDGreen/roslyn,dpoeschl/roslyn,khyperia/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,KirillOsenkov/roslyn | src/VisualStudio/IntegrationTest/TestUtilities/WellKnownProjectTemplates.cs | src/VisualStudio/IntegrationTest/TestUtilities/WellKnownProjectTemplates.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.VisualStudio.IntegrationTest.Utilities
{
public static class WellKnownProjectTemplates
{
public const string ClassLibrary = nameof(ClassLibrary);
public const string ConsoleApplication = nameof(ConsoleApplication);
public const string Website = nameof(Website);
public const string WinFormsApplication = nameof(WinFormsApplication);
public const string WpfApplication = nameof(WpfApplication);
public const string WebApplication = nameof(WebApplication);
public const string CSharpNetCoreClassLibrary = "Microsoft.CSharp.NETCore.ClassLibrary";
public const string VisualBasicNetCoreClassLibrary = "Microsoft.VisualBasic.NETCore.ClassLibrary";
public const string CSharpNetCoreConsoleApplication = "Microsoft.CSharp.NETCore.ConsoleApplication";
public const string VisualBasicNetCoreConsoleApplication = "Microsoft.VisualBasic.NETCore.ConsoleApplication";
public const string CSharpNetCoreUnitTest = "Microsoft.CSharp.NETCore.UnitTest";
public const string CSharpNetCoreXUnitTest = "Microsoft.CSharp.NETCore.XUnitTest";
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.VisualStudio.IntegrationTest.Utilities
{
public static class WellKnownProjectTemplates
{
public const string ClassLibrary = nameof(ClassLibrary);
public const string ConsoleApplication = nameof(ConsoleApplication);
public const string Website = nameof(Website);
public const string WinFormsApplication = nameof(WinFormsApplication);
public const string WpfApplication = nameof(WpfApplication);
public const string WebApplication = nameof(WebApplication);
public const string CSharpNetCoreClassLibrary = "Microsoft.CSharp.NETCore.ClassLibrary";
public const string VisualBasicNetCoreClassLibrary = "Microsoft.VisualBasic.NETCore.ClassLibrary";
public const string CSharpNetCoreConsoleApplication = "Microsoft.CSharp.NETCore.ConsoleApplication";
public const string VisualBasicNetCoreConsoleApplication = "Microsoft.VisualBasic.NETCore.ConsoleApplication";
}
}
| mit | C# |
b406be4e32e33b88271b9fa29df0afe740b170d0 | Add a quick little demo of using a function from the shared class library to ConsoleApp1 | PhilboBaggins/ci-experiments-dotnetcore,PhilboBaggins/ci-experiments-dotnetcore | ConsoleApp1/Program.cs | ConsoleApp1/Program.cs | using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// Quick little demo of using a function from the shared class library
int x = ClassLibrary1.Class1.ReturnFive();
System.Diagnostics.Debug.Assert(x == 5);
Console.WriteLine("Hello World!");
}
}
}
| using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int x = ClassLibrary1.Class1.ReturnFive();
Console.WriteLine("Hello World!");
}
}
}
| unlicense | C# |
04146d6102623fe72e2031fb78d4c665a3729c7c | make ErrorCode property's setter private. | knocte/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper,mattgray/SevenDigital.Api.Wrapper,raoulmillais/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,actionshrimp/SevenDigital.Api.Wrapper,danhaller/SevenDigital.Api.Wrapper,gregsochanik/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper,bettiolo/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,AnthonySteele/SevenDigital.Api.Wrapper | src/SevenDigital.Api.Wrapper/Exceptions/ApiErrorException.cs | src/SevenDigital.Api.Wrapper/Exceptions/ApiErrorException.cs | using System;
using System.Runtime.Serialization;
using SevenDigital.Api.Schema;
using SevenDigital.Api.Wrapper.Utility.Http;
namespace SevenDigital.Api.Wrapper.Exceptions
{
public abstract class ApiErrorException : ApiException
{
public int ErrorCode { get; private set; }
protected ApiErrorException()
{
}
protected ApiErrorException(string message, Response response, Error error)
: base(message, response)
{
ErrorCode = error.Code;
}
protected ApiErrorException(string message, Exception innerException)
: base(message, innerException)
{
}
protected ApiErrorException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
} | using System;
using System.Runtime.Serialization;
using SevenDigital.Api.Schema;
using SevenDigital.Api.Wrapper.Utility.Http;
namespace SevenDigital.Api.Wrapper.Exceptions
{
public abstract class ApiErrorException : ApiException
{
public int ErrorCode { get; set; }
protected ApiErrorException()
{
}
protected ApiErrorException(string message, Response response, Error error)
: base(message, response)
{
ErrorCode = error.Code;
}
protected ApiErrorException(string message, Exception innerException)
: base(message, innerException)
{
}
protected ApiErrorException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
} | mit | C# |
7ebb46ef0ced34d9e5d777693144d305f975d837 | Remove useless comment | tgstation/tgstation-server,tgstation/tgstation-server-tools,Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server | src/Tgstation.Server.Host/Components/IDreamDaemonExecutor.cs | src/Tgstation.Server.Host/Components/IDreamDaemonExecutor.cs | using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Host.Components
{
/// <summary>
/// For creating <see cref="IDreamDaemonSession"/>s
/// </summary>
interface IDreamDaemonExecutor
{
/// <summary>
/// Run a dream daemon instance
/// </summary>
/// <param name="launchParameters">The <see cref="DreamDaemonLaunchParameters"/></param>
/// <param name="onSuccessfulStartup">The <see cref="TaskCompletionSource{TResult}"/> that is completed when dream daemon starts without crashing</param>
/// <param name="dreamDaemonPath">The path to the dreamdaemon executable</param>
/// <param name="dmbProvider">The <see cref="IDmbProvider"/> for the .dmb to run</param>
/// <param name="parameters">The value of the -params command line option</param>
/// <param name="useSecondaryPort">If the <see cref="DreamDaemonLaunchParameters.SecondaryPort"/> field of <paramref name="launchParameters"/> should be used</param>
/// <returns>A new <see cref="IDreamDaemonSession"/></returns>
IDreamDaemonSession RunDreamDaemon(DreamDaemonLaunchParameters launchParameters, string dreamDaemonPath, IDmbProvider dmbProvider, string parameters, bool useSecondaryPort, bool useSecondaryDirectory);
/// <summary>
/// Attach to a running instance of DreamDaemon
/// </summary>
/// <param name="processId">The <see cref="IDreamDaemonSession.ProcessId"/></param>
/// <returns>A new <see cref="IDreamDaemonSession"/></returns>
IDreamDaemonSession AttachToDreamDaemon(int processId);
}
}
| using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Host.Components
{
/// <summary>
/// For creating <see cref="IDreamDaemonSession"/>s
/// </summary>
interface IDreamDaemonExecutor
{
/// <summary>
/// Run a dream daemon instance
/// </summary>
/// <param name="launchParameters">The <see cref="DreamDaemonLaunchParameters"/></param>
/// <param name="onSuccessfulStartup">The <see cref="TaskCompletionSource{TResult}"/> that is completed when dream daemon starts without crashing</param>
/// <param name="dreamDaemonPath">The path to the dreamdaemon executable</param>
/// <param name="dmbProvider">The <see cref="IDmbProvider"/> for the .dmb to run</param>
/// <param name="parameters">The value of the -params command line option</param>
/// <param name="useSecondaryPort">If the <see cref="DreamDaemonLaunchParameters.SecondaryPort"/> field of <paramref name="launchParameters"/> should be used</param>
/// <param name="useSecondaryDirectory">If the <see cref="IDmbProvider.SecondaryDirectory"/> field of <paramref name="dmbProvider"/> should be used</param>
/// <returns>A new <see cref="IDreamDaemonSession"/></returns>
IDreamDaemonSession RunDreamDaemon(DreamDaemonLaunchParameters launchParameters, string dreamDaemonPath, IDmbProvider dmbProvider, string parameters, bool useSecondaryPort, bool useSecondaryDirectory);
/// <summary>
/// Attach to a running instance of DreamDaemon
/// </summary>
/// <param name="processId">The <see cref="IDreamDaemonSession.ProcessId"/></param>
/// <returns>A new <see cref="IDreamDaemonSession"/></returns>
IDreamDaemonSession AttachToDreamDaemon(int processId);
}
}
| agpl-3.0 | C# |
4757bda5f153689faca9be8037ff72bbb84e0b2e | Add link to org chart | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Views/Units/List.cshtml | Battery-Commander.Web/Views/Units/List.cshtml | @model IEnumerable<Unit>
<div class="page-header">
<h1>Units @Html.ActionLink("Add New", "New", "Units", null, new { @class = "btn btn-default" })</h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Name)</th>
<th>@Html.DisplayNameFor(_ => _.FirstOrDefault().UIC)</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var unit in Model)
{
<tr>
<td>@Html.DisplayFor(s => unit)</td>
<td>@Html.DisplayFor(s => unit.UIC)</td>
<td>
@Html.ActionLink("Edit", "Edit", new { unit.Id })
@Html.ActionLink("Soldiers", "Index", "Soldiers", new { unit = unit.Id })
@Html.ActionLink("Org Chart", "Details", new { unit.Id })
</td>
</tr>
}
</tbody>
</table>
| @model IEnumerable<Unit>
<div class="page-header">
<h1>Units @Html.ActionLink("Add New", "New", "Units", null, new { @class = "btn btn-default" })</h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>@Html.DisplayNameFor(_ => _.FirstOrDefault().Name)</th>
<th>@Html.DisplayNameFor(_ => _.FirstOrDefault().UIC)</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var unit in Model)
{
<tr>
<td>@Html.DisplayFor(s => unit)</td>
<td>@Html.DisplayFor(s => unit.UIC)</td>
<td>
@Html.ActionLink("Edit", "Edit", new { unit.Id })
@Html.ActionLink("Soldiers", "Index", "Soldiers", new { unit = unit.Id })
</td>
</tr>
}
</tbody>
</table>
| mit | C# |
573597ec38c7a5a27eafed1a546edb52ac3da592 | bump version | Fody/Obsolete | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Obsolete")]
[assembly: AssemblyProduct("Obsolete")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
| using System.Reflection;
[assembly: AssemblyTitle("Obsolete")]
[assembly: AssemblyProduct("Obsolete")]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
| mit | C# |
db840d36b052720052669d4c51c5e3f4125d6eb1 | Allow settings to be passed as well | anthonylangsworth/Meraki | src/Meraki/MerakiClient.cs | src/Meraki/MerakiClient.cs | using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
namespace Meraki {
public partial class MerakiClient {
private readonly HttpClient _client;
private readonly UrlFormatProvider _formatter = new UrlFormatProvider();
public MerakiClient(IOptions<MerakiClientSettings> options)
: this(options.Value) {
}
public MerakiClient(MerakiClientSettings settings) {
_client = new HttpClient(new HttpClientHandler()) {
BaseAddress = new Uri(settings.Address)
};
_client.DefaultRequestHeaders.Add("X-Cisco-Meraki-API-Key", settings.Key);
_client.DefaultRequestHeaders.Add("Accept-Type", "application/json");
}
private string Url(FormattableString formattable) => formattable.ToString(_formatter);
public Task<HttpResponseMessage> SendAsync(HttpMethod method, string uri) => SendAsync(new HttpRequestMessage(method, uri));
internal Task<HttpResponseMessage> SendAsync(HttpRequestMessage request) => _client.SendAsync(request);
internal async Task<T> GetAsync<T>(string uri) {
var response = await _client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri));
var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(content);
}
public async Task<string> GetAsync(string uri) {
var response = await _client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri));
var content = await response.Content.ReadAsStringAsync();
return content;
}
}
} | using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
namespace Meraki {
public partial class MerakiClient {
private readonly HttpClient _client;
private readonly UrlFormatProvider _formatter = new UrlFormatProvider();
public MerakiClient(IOptions<MerakiClientSettings> options) {
_client = new HttpClient(new HttpClientHandler()) {
BaseAddress = new Uri(options.Value.Address)
};
_client.DefaultRequestHeaders.Add("X-Cisco-Meraki-API-Key", options.Value.Key);
_client.DefaultRequestHeaders.Add("Accept-Type", "application/json");
}
private string Url(FormattableString formattable) => formattable.ToString(_formatter);
public Task<HttpResponseMessage> SendAsync(HttpMethod method, string uri) {
return SendAsync(new HttpRequestMessage(method, uri));
}
internal Task<HttpResponseMessage> SendAsync(HttpRequestMessage request) {
return _client.SendAsync(request);
}
internal async Task<T> GetAsync<T>(string uri) {
var response = await _client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri));
var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(content);
}
public async Task<string> GetAsync(string uri) {
var response = await _client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri));
var content = await response.Content.ReadAsStringAsync();
return content;
}
}
} | mit | C# |
557324bc06051250305cd6c0d50816ee91540c1a | Create exec engine on load and pass context to script | RockyTV/Duality.IronPython | CorePlugin/ScriptExecutor.cs | CorePlugin/ScriptExecutor.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Duality;
using RockyTV.Duality.Plugins.IronPython.Resources;
using IronPython.Hosting;
using IronPython.Runtime;
using IronPython.Compiler;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using Duality.Editor;
namespace RockyTV.Duality.Plugins.IronPython
{
[EditorHintCategory(Properties.ResNames.CategoryScripts)]
[EditorHintImage(Properties.ResNames.IconScriptGo)]
public class ScriptExecutor : Component, ICmpInitializable, ICmpUpdatable
{
public ContentRef<PythonScript> Script { get; set; }
[DontSerialize]
private PythonExecutionEngine _engine;
protected PythonExecutionEngine Engine
{
get { return _engine; }
}
protected virtual float Delta
{
get { return Time.MsPFMult * Time.TimeMult; }
}
public void OnInit(InitContext context)
{
if (!Script.IsAvailable) return;
if (context == InitContext.Loaded)
{
_engine = new PythonExecutionEngine(Script.Res.Content);
_engine.SetVariable("gameObject", GameObj);
}
if (_engine.HasMethod("start"))
_engine.CallMethod("start", context);
}
public void OnUpdate()
{
if (_engine.HasMethod("update"))
_engine.CallMethod("update", Delta);
}
public void OnShutdown(ShutdownContext context)
{
if (context == ShutdownContext.Deactivate)
{
GameObj.DisposeLater();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Duality;
using RockyTV.Duality.Plugins.IronPython.Resources;
using IronPython.Hosting;
using IronPython.Runtime;
using IronPython.Compiler;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
using Duality.Editor;
namespace RockyTV.Duality.Plugins.IronPython
{
[EditorHintCategory(Properties.ResNames.CategoryScripts)]
[EditorHintImage(Properties.ResNames.IconScriptGo)]
public class ScriptExecutor : Component, ICmpInitializable, ICmpUpdatable
{
public ContentRef<PythonScript> Script { get; set; }
[DontSerialize]
private PythonExecutionEngine _engine;
protected PythonExecutionEngine Engine
{
get { return _engine; }
}
protected virtual float Delta
{
get { return Time.MsPFMult * Time.TimeMult; }
}
public void OnInit(InitContext context)
{
if (!Script.IsAvailable) return;
_engine = new PythonExecutionEngine(Script.Res.Content);
_engine.SetVariable("gameObject", GameObj);
if (_engine.HasMethod("start"))
_engine.CallMethod("start");
}
public void OnUpdate()
{
if (_engine.HasMethod("update"))
_engine.CallMethod("update", Delta);
}
public void OnShutdown(ShutdownContext context)
{
if (context == ShutdownContext.Deactivate)
{
GameObj.DisposeLater();
}
}
}
}
| mit | C# |
fa68929ad3b080a69d5a3db86baec64d34a82e2c | Introduce OnCompleted | citizenmatt/ndc-london-2013 | rx/rx/Program.cs | rx/rx/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace rx
{
class Program
{
static void Main(string[] args)
{
var subject = new Subject<string>();
using (subject.Subscribe(result => Console.WriteLine(result)))
{
var wc = new WebClient();
var task = wc.DownloadStringTaskAsync("http://www.google.com/robots.txt");
task.ContinueWith(t =>
{
subject.OnNext(t.Result);
subject.OnCompleted();
});
// Wait for the async call
Console.ReadLine();
}
}
}
public class Subject<T>
{
private readonly IList<Action<T>> observers = new List<Action<T>>();
public IDisposable Subscribe(Action<T> observer)
{
observers.Add(observer);
return new Disposable(() => observers.Remove(observer));
}
public void OnNext(T result)
{
foreach (var observer in observers)
{
observer(result);
}
}
public void OnCompleted()
{
foreach (var observer in observers)
{
observer.OnCompleted();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace rx
{
class Program
{
static void Main(string[] args)
{
var subject = new Subject<string>();
using (subject.Subscribe(result => Console.WriteLine(result)))
{
var wc = new WebClient();
var task = wc.DownloadStringTaskAsync("http://www.google.com/robots.txt");
task.ContinueWith(t => subject.OnNext(t.Result));
// Wait for the async call
Console.ReadLine();
}
}
}
public class Subject<T>
{
private readonly IList<Action<T>> observers = new List<Action<T>>();
public IDisposable Subscribe(Action<T> observer)
{
observers.Add(observer);
return new Disposable(() => observers.Remove(observer));
}
public void OnNext(T result)
{
foreach (var observer in observers)
{
observer(result);
}
}
}
}
| mit | C# |
c86f4793888f0383e612f73b52291f01d5572454 | make the test pass. | fffej/codekatas,fffej/codekatas,fffej/codekatas | MineField/MineSweeperTest.cs | MineField/MineSweeperTest.cs | using NUnit.Framework;
using FluentAssertions;
namespace Fatvat.Katas.MineSweeper
{
[TestFixture]
public class MineSweeperTest
{
[Test]
public void TestMineFieldExists()
{
new MineField();
}
}
public class MineField
{
}
}
| using NUnit.Framework;
using FluentAssertions;
namespace Fatvat.Katas.MineSweeper
{
[TestFixture]
public class MineSweeperTest
{
[Test]
public void TestMineFieldExists()
{
new MineField();
}
}
}
| mit | C# |
47a1c241013ba3b360be2ccac463d4f722d255de | Add string ReplaceAt extension | Mpstark/articulate,BrunoBrux/ArticulateDVS | Articulate/Extensions.cs | Articulate/Extensions.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reactive;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Articulate
{
static class Extensions
{
// http://social.msdn.microsoft.com/Forums/en-US/36bf6ecb-70ea-4be3-aa35-b9a9cbc9a078/observable-from-any-property-in-a-inotifypropertychanged-class?forum=rx
public static IObservable<T> ToObservable<T>(this DependencyObject dependencyObject, DependencyProperty property)
{
return Observable.Create<T>(o =>
{
var des = DependencyPropertyDescriptor.FromProperty(property, dependencyObject.GetType());
var eh = new EventHandler((s, e) => o.OnNext((T)des.GetValue(dependencyObject)));
des.AddValueChanged(dependencyObject, eh);
return () => des.RemoveValueChanged(dependencyObject, eh);
});
}
// http://stackoverflow.com/questions/9367119/replacing-a-char-at-a-given-index-in-string
public static string ReplaceAt(this string input, int index, char newChar)
{
if (input == null)
{
throw new ArgumentNullException("input");
}
char[] chars = input.ToCharArray();
chars[index] = newChar;
return new string(chars);
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reactive;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Articulate
{
static class Extensions
{
// http://social.msdn.microsoft.com/Forums/en-US/36bf6ecb-70ea-4be3-aa35-b9a9cbc9a078/observable-from-any-property-in-a-inotifypropertychanged-class?forum=rx
public static IObservable<T> ToObservable<T>(this DependencyObject dependencyObject, DependencyProperty property)
{
return Observable.Create<T>(o =>
{
var des = DependencyPropertyDescriptor.FromProperty(property, dependencyObject.GetType());
var eh = new EventHandler((s, e) => o.OnNext((T)des.GetValue(dependencyObject)));
des.AddValueChanged(dependencyObject, eh);
return () => des.RemoveValueChanged(dependencyObject, eh);
});
}
}
}
| mit | C# |
098e57f9e808770642de81548c5db9661dabaa1d | Add remove card | LLucile/Institfighter | Assets/Scripts/GameUI.cs | Assets/Scripts/GameUI.cs | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GameUI : MonoBehaviour {
public GameObject[] PlayerUI;
public Image[] playersHealth;
public Text[] playersScore;
public UICard[] templates;
public RectTransform[] p1cards;
public RectTransform[] p2cards;
public static GameUI Instance = null;
void Awake() {
if (GameUI.Instance == null){
Instance = this;
}
else if (Instance != this){
Destroy (gameObject);
}
DontDestroyOnLoad(GameUI.Instance);
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void SetHealth(int player, float amount){
playersScore[player].text = amount+"";
playersHealth[player].fillAmount = Mathf.Abs(amount);
}
public void CreateCard(int player, int number, Card card){
RectTransform parent;
if (player == 1) {
parent = p2cards [number];
} else {
parent = p1cards [number];
}
UICard instance = Instantiate (templates [player]).GetComponent<UICard>();
instance.transform.SetParent (parent, false);
instance.Setup (card);
}
public void RemoveCard (int player, int number){
UICard card = GetCard (player, number);
if (card != null)
Destroy (card.gameObject);
}
public void SelectCard(int player, int number, bool selected){
UICard card = GetCard (player, number);
if (selected) {
card.Select();
} else {
card.Unselect();
}
}
UICard GetCard(int player, int number){
RectTransform parent;
if (player == 1) {
parent = p2cards [number];
} else {
parent = p1cards [number];
}
return parent.GetComponentInChildren<UICard> ();
}
}
| using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GameUI : MonoBehaviour {
public GameObject[] PlayerUI;
public Image[] playersHealth;
public Text[] playersScore;
public UICard[] templates;
public RectTransform[] p1cards;
public RectTransform[] p2cards;
public static GameUI Instance = null;
void Awake() {
if (GameUI.Instance == null){
Instance = this;
}
else if (Instance != this){
Destroy (gameObject);
}
DontDestroyOnLoad(GameUI.Instance);
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void SetHealth(int player, float amount){
playersScore[player].text = amount+"";
playersHealth[player].fillAmount = Mathf.Abs(amount);
}
public void CreateCard(int player, int number, Card card){
RectTransform parent;
if (player == 1) {
parent = p2cards [number];
} else {
parent = p1cards [number];
}
UICard instance = Instantiate (templates [player]).GetComponent<UICard>();
instance.transform.SetParent (parent, false);
instance.Setup (card);
}
public void SelectCard(int player, int number, bool selected){
UICard card = GetCard (player, number);
if (selected) {
card.Select();
} else {
card.Unselect();
}
}
UICard GetCard(int player, int number){
RectTransform parent;
if (player == 1) {
parent = p2cards [number];
} else {
parent = p1cards [number];
}
return parent.GetComponentInChildren<UICard> ();
}
}
| mit | C# |
1a0b88b81f7eb174d3a4447e8fa6ad61e859491d | Convert tabs to spaces in Player.cs | jmeas/simple-tower | Assets/Scripts/Player.cs | Assets/Scripts/Player.cs | public class Player : UnityEngine.MonoBehaviour {
public UnityEngine.Rigidbody rb;
UnityEngine.Vector3 startPosition = new UnityEngine.Vector3(0f, 17f, 0f);
UnityEngine.Vector3 stationary = new UnityEngine.Vector3(0, 0, 0);
void Start() {
rb = this.GetComponent<UnityEngine.Rigidbody>();
StartCoroutine(CheckOutOfBounds());
}
public System.Collections.IEnumerator CheckOutOfBounds() {
// This checks the boundaries always. Eventually, we'll want to turn this off
// under certain conditions, like when the player doesn't have control over
// the player's movement.
while(true) {
if (this.transform.position.y < -6) {
// Reset the player's velocity and their position
rb.velocity = stationary;
this.transform.position = startPosition;
}
// The player bounds are pretty loosely defined, so it's fine to check on
// them a little less frequently.
yield return new UnityEngine.WaitForSeconds(0.1f);
}
}
}
| public class Player : UnityEngine.MonoBehaviour {
public UnityEngine.Rigidbody rb;
UnityEngine.Vector3 startPosition = new UnityEngine.Vector3(0f, 17f, 0f);
UnityEngine.Vector3 stationary = new UnityEngine.Vector3(0, 0, 0);
void Start() {
rb = this.GetComponent<UnityEngine.Rigidbody>();
StartCoroutine(CheckOutOfBounds());
}
public System.Collections.IEnumerator CheckOutOfBounds() {
// This checks the boundaries always. Eventually, we'll want to turn this off
// under certain conditions, like when the player doesn't have control over
// the player's movement.
while(true) {
if (this.transform.position.y < -6) {
// Reset the player's velocity and their position
rb.velocity = stationary;
this.transform.position = startPosition;
}
// The player bounds are pretty loosely defined, so it's fine to check on
// them a little less frequently.
yield return new UnityEngine.WaitForSeconds(0.1f);
}
}
}
| mit | C# |
50eea10645d40b630f0e403c32434b9427491ad3 | Add better exception check in StringUtilsTest | Lc5/CurrencyRates,Lc5/CurrencyRates,Lc5/CurrencyRates | CurrencyRatesTests/CurrencyRates/Extension/StringUtilsTest.cs | CurrencyRatesTests/CurrencyRates/Extension/StringUtilsTest.cs | using NUnit.Framework;
namespace CurrencyRates.Extension
{
[TestFixture]
class StringUtilsTest
{
[TestCaseSource("TruncateTestCases")]
public void TestTruncate(string value, int maxLength, string truncated)
{
Assert.AreEqual(truncated, value.Truncate(maxLength));
}
static object[] TruncateTestCases =
{
new object[] {"", 1, ""},
new object[] {"Example", 4, "E..."},
new object[] {"Example", 6, "Exa..."},
new object[] {"Example", 7, "Example"},
new object[] {"Example", 8, "Example"}
};
[Test]
public void TestTruncateThrowsException()
{
var exception = Assert.Throws<System.ArgumentOutOfRangeException>(
() => "Example".Truncate(3)
);
Assert.AreEqual("maxLength", exception.ParamName);
StringAssert.Contains("maxLength must be at least 4", exception.Message);
}
}
}
| using NUnit.Framework;
namespace CurrencyRates.Extension
{
[TestFixture]
class StringUtilsTest
{
[TestCaseSource("TruncateTestCases")]
public void TestTruncate(string value, int maxLength, string truncated)
{
Assert.AreEqual(truncated, value.Truncate(maxLength));
}
static object[] TruncateTestCases =
{
new object[] {"", 1, ""},
new object[] {"Example", 4, "E..."},
new object[] {"Example", 6, "Exa..."},
new object[] {"Example", 7, "Example"},
new object[] {"Example", 8, "Example"}
};
[Test]
public void TestTruncateThrowsException()
{
Assert.Throws<System.ArgumentOutOfRangeException>(
() => "Example".Truncate(3)
);
}
}
}
| mit | C# |
0daa579b02fbd1bd73d8db89860e64354072c1cd | Build 1.3.1 | xxMUROxx/Mairegger.Printing | Mairegger.Printing/Properties/AssemblyInfo.cs | Mairegger.Printing/Properties/AssemblyInfo.cs | // Copyright 2016 Michael Mairegger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Mairegger.Printing")]
[assembly: AssemblyDescription("Printing library for WPF")]
[assembly: AssemblyProduct("Mairegger.Printing")]
[assembly: AssemblyCopyright("Copyright 2016-2018 Michael Mairegger")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: Guid("0a7f0fd0-f7f4-415e-8494-e1ca351ef82f")]
[assembly: AssemblyVersion("1.3.1")]
[assembly: AssemblyFileVersion("1.3.1")]
[assembly: InternalsVisibleTo("Mairegger.Printing.Tests")] | // Copyright 2016 Michael Mairegger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.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("Mairegger.Printing")]
[assembly: AssemblyDescription("Printing library for WPF")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mairegger.Printing")]
[assembly: AssemblyCopyright("Copyright 2015 Michael Mairegger")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0a7f0fd0-f7f4-415e-8494-e1ca351ef82f")]
// 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.3.0")]
[assembly: AssemblyFileVersion("1.3.0")]
[assembly: InternalsVisibleTo("Mairegger.Printing.Tests")] | apache-2.0 | C# |
051a9e249a835ceb9a8a2a23b38c0c0c4eb846f1 | fix word view model | drussilla/LearnWordsFast,drussilla/LearnWordsFast | src/LearnWordsFast/ViewModels/WordController/WordViewModel.cs | src/LearnWordsFast/ViewModels/WordController/WordViewModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using LearnWordsFast.DAL.Models;
namespace LearnWordsFast.ViewModels.WordController
{
public class WordViewModel
{
public WordViewModel()
{
}
public WordViewModel(Word word)
{
Original = word.Original;
Language = word.Language.Id;
Translation = new TranslationViewModel(word.Translation);
Context = word.Context;
if (word.AdditionalTranslations != null && word.AdditionalTranslations.Count > 0)
{
AdditionalTranslations = word.AdditionalTranslations.Select(x => new TranslationViewModel(x)).ToList();
}
}
public string Original { get; set; }
public Guid Language { get; set; }
public TranslationViewModel Translation { get; set; }
public string Context { get; set; }
public List<TranslationViewModel> AdditionalTranslations { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using LearnWordsFast.DAL.Models;
namespace LearnWordsFast.ViewModels.WordController
{
public class WordViewModel
{
public WordViewModel(Word word)
{
Original = word.Original;
Language = word.Language.Id;
Translation = new TranslationViewModel(word.Translation);
Context = word.Context;
if (word.AdditionalTranslations != null && word.AdditionalTranslations.Count > 0)
{
AdditionalTranslations = word.AdditionalTranslations.Select(x => new TranslationViewModel(x)).ToList();
}
}
public string Original { get; set; }
public Guid Language { get; set; }
public TranslationViewModel Translation { get; set; }
public string Context { get; set; }
public List<TranslationViewModel> AdditionalTranslations { get; set; }
}
} | mit | C# |
73a4ab32a431ab2c76a018ee7eab035d1ea37e4d | Fix authorization problem | asanchezr/hets,bcgov/hets,asanchezr/hets,swcurran/hets,swcurran/hets,bcgov/hets,bcgov/hets,bcgov/hets,asanchezr/hets,swcurran/hets,swcurran/hets,swcurran/hets,asanchezr/hets | Server/src/HETSAPI/Authorization/ClaimsPrincipalExtensions.cs | Server/src/HETSAPI/Authorization/ClaimsPrincipalExtensions.cs | using System;
using HETSAPI.Models;
using System.Security.Claims;
namespace HETSAPI.Authorization
{
/// <summary>
/// Calaims Principal Extension
/// </summary>
public static class ClaimsPrincipalExtensions
{
/// <summary>
/// Check if the user has permission to execute the method
/// </summary>
/// <param name="user"></param>
/// <param name="permissions"></param>
/// <returns></returns>
public static bool HasPermissions(this ClaimsPrincipal user, params string[] permissions)
{
if (!user.HasClaim(c => c.Type == User.PermissionClaim))
return false;
bool hasRequiredPermissions = false;
if (!user.HasClaim(c => c.Type == User.PermissionClaim))
return false;
if (user.HasClaim(c => c.Type == User.PermissionClaim))
{
bool hasPermissions = true;
foreach (string permission in permissions)
{
if (!user.HasClaim(User.PermissionClaim, permission))
{
hasPermissions = false;
break;
}
}
hasRequiredPermissions = hasPermissions;
}
return hasRequiredPermissions;
}
/// <summary>
/// Check if the user is a member if the group
/// </summary>
/// <param name="user"></param>
/// <param name="group"></param>
/// <returns></returns>
public static bool IsInGroup(this ClaimsPrincipal user, string group)
{
return user.HasClaim(c => c.Type == ClaimTypes.GroupSid && c.Value.Equals(group, StringComparison.OrdinalIgnoreCase));
}
}
}
| using System;
using System.Linq;
using HETSAPI.Models;
using System.Security.Claims;
namespace HETSAPI.Authorization
{
/// <summary>
/// Calaims Principal Extension
/// </summary>
public static class ClaimsPrincipalExtensions
{
/// <summary>
/// Check if the user has permission to execute the method
/// </summary>
/// <param name="user"></param>
/// <param name="permissions"></param>
/// <returns></returns>
public static bool HasPermissions(this ClaimsPrincipal user, params string[] permissions)
{
if (!user.HasClaim(c => c.Type == User.PermissionClaim))
return false;
return permissions.Any(permission => !user.HasClaim(User.PermissionClaim, permission));
}
/// <summary>
/// Check if the user is a member if the group
/// </summary>
/// <param name="user"></param>
/// <param name="group"></param>
/// <returns></returns>
public static bool IsInGroup(this ClaimsPrincipal user, string group)
{
return user.HasClaim(c => c.Type == ClaimTypes.GroupSid && c.Value.Equals(group, StringComparison.OrdinalIgnoreCase));
}
}
}
| apache-2.0 | C# |
2597236c7f8ec3eef04b3bc58770fb1f4a141e03 | Remove unused function | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs | WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs | using Avalonia.Threading;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Gui.Tabs.WalletManager.GenerateWallets;
using WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets;
using WalletWasabi.Gui.Tabs.WalletManager.LoadWallets;
using WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Hwi.Models;
using WalletWasabi.Logging;
namespace WalletWasabi.Gui.Tabs.WalletManager
{
[Export]
[Shared]
public class WalletManagerViewModel : WasabiDocumentTabViewModel
{
private ObservableCollection<CategoryViewModel> _categories;
private CategoryViewModel _selectedCategory;
private ViewModelBase _currentView;
private LoadWalletViewModel LoadWalletViewModelDesktop { get; }
public WalletManagerViewModel() : base("Wallet Manager")
{
LoadWalletViewModelDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop);
Categories = new ObservableCollection<CategoryViewModel>
{
new GenerateWalletViewModel(this),
new RecoverWalletViewModel(this),
LoadWalletViewModelDesktop,
new LoadWalletViewModel(this, LoadWalletType.Password),
new ConnectHardwareWalletViewModel(this)
};
SelectedCategory = Categories.FirstOrDefault();
this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category =>
{
category?.OnCategorySelected();
CurrentView = category;
});
}
public ObservableCollection<CategoryViewModel> Categories
{
get => _categories;
set => this.RaiseAndSetIfChanged(ref _categories, value);
}
public CategoryViewModel SelectedCategory
{
get => _selectedCategory;
set => this.RaiseAndSetIfChanged(ref _selectedCategory, value);
}
public void SelectGenerateWallet()
{
SelectedCategory = Categories.First(x => x is GenerateWalletViewModel);
}
public void SelectRecoverWallet()
{
SelectedCategory = Categories.First(x => x is RecoverWalletViewModel);
}
public void SelectLoadWallet()
{
SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Desktop);
}
public void SelectTestPassword()
{
SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Password);
}
public ViewModelBase CurrentView
{
get => _currentView;
set => this.RaiseAndSetIfChanged(ref _currentView, value);
}
}
}
| using Avalonia.Threading;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Gui.Tabs.WalletManager.GenerateWallets;
using WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets;
using WalletWasabi.Gui.Tabs.WalletManager.LoadWallets;
using WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Hwi.Models;
using WalletWasabi.Logging;
namespace WalletWasabi.Gui.Tabs.WalletManager
{
[Export]
[Shared]
public class WalletManagerViewModel : WasabiDocumentTabViewModel
{
private ObservableCollection<CategoryViewModel> _categories;
private CategoryViewModel _selectedCategory;
private ViewModelBase _currentView;
private LoadWalletViewModel LoadWalletViewModelDesktop { get; }
public WalletManagerViewModel() : base("Wallet Manager")
{
LoadWalletViewModelDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop);
Categories = new ObservableCollection<CategoryViewModel>
{
new GenerateWalletViewModel(this),
new RecoverWalletViewModel(this),
LoadWalletViewModelDesktop,
new LoadWalletViewModel(this, LoadWalletType.Password),
new ConnectHardwareWalletViewModel(this)
};
SelectedCategory = Categories.FirstOrDefault();
this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category =>
{
category?.OnCategorySelected();
CurrentView = category;
});
}
public ObservableCollection<CategoryViewModel> Categories
{
get => _categories;
set => this.RaiseAndSetIfChanged(ref _categories, value);
}
public CategoryViewModel SelectedCategory
{
get => _selectedCategory;
set => this.RaiseAndSetIfChanged(ref _selectedCategory, value);
}
public void SelectGenerateWallet()
{
SelectedCategory = Categories.First(x => x is GenerateWalletViewModel);
}
public void SelectRecoverWallet()
{
SelectedCategory = Categories.First(x => x is RecoverWalletViewModel);
}
public void SelectLoadWallet()
{
SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Desktop);
}
public void SelectTestPassword()
{
SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Password);
}
public void SelectHardwareWallet()
{
SelectedCategory = Categories.First(x => x is LoadWalletViewModel model && model.LoadWalletType == LoadWalletType.Hardware);
}
public ViewModelBase CurrentView
{
get => _currentView;
set => this.RaiseAndSetIfChanged(ref _currentView, value);
}
}
}
| mit | C# |
c0a67ba4e26d7c58916ae05575e74bae40e1f30b | Change assembly version of TransferInterface | ProgTrade/nUpdate,ProgTrade/nUpdate | nUpdate.Administration.TransferInterface/Properties/AssemblyInfo.cs | nUpdate.Administration.TransferInterface/Properties/AssemblyInfo.cs | // Author: Dominic Beger (Trade/ProgTrade) 2016
using System.Reflection;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("nUpdate.Administration.TransferInterface")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("nUpdate.Administration.TransferInterface")]
[assembly: AssemblyCopyright("Copyright © Dominic Beger (Trade/ProgTrade) 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(true)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("b1bcd259-1a3f-4e09-9f81-ad77e2874ed7")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyInformationalVersion("v3.0.0.0 Beta 4")]
[assembly: AssemblyFileVersion("4.0.0.0")] | // Author: Dominic Beger (Trade/ProgTrade) 2016
using System.Reflection;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("nUpdate.Administration.TransferInterface")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("nUpdate.Administration.TransferInterface")]
[assembly: AssemblyCopyright("Copyright © Dominic Beger (Trade/ProgTrade) 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(true)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("b1bcd259-1a3f-4e09-9f81-ad77e2874ed7")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("v3.0.0.0 Beta 4")]
[assembly: AssemblyFileVersion("3.0.0.0")] | mit | C# |
ad1cdc80ed734a67e7690c9c32a4f99f569c2e59 | Add smoke test to Status controller | SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers | src/SFA.DAS.EmployerUsers.Api/Controllers/StatusController.cs | src/SFA.DAS.EmployerUsers.Api/Controllers/StatusController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using SFA.DAS.EmployerUsers.Api.Orchestrators;
namespace SFA.DAS.EmployerUsers.Api.Controllers
{
[RoutePrefix("api/status")]
public class StatusController : ApiController
{
private readonly UserOrchestrator _orchestrator;
public StatusController(UserOrchestrator orchestrator)
{
_orchestrator = orchestrator;
}
[Route("")]
public async Task <IHttpActionResult> Index()
{
try
{
// Do some Infrastructre work here to smoke out any issues.
var users = await _orchestrator.UsersIndex(1, 1);
return Ok();
}
catch (Exception e)
{
return InternalServerError(e);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace SFA.DAS.EmployerUsers.Api.Controllers
{
[RoutePrefix("api/status")]
public class StatusController : ApiController
{
[Route("")]
public IHttpActionResult Index()
{
// Do some Infrastructre work here to smoke out any issues.
return Ok();
}
}
}
| mit | C# |
a8d4cf77af064679de14a82f7c72089a4861aa76 | Address PR feedback | elijah6/corefx,twsouthwick/corefx,Petermarcu/corefx,lggomez/corefx,stephenmichaelf/corefx,nbarbettini/corefx,BrennanConroy/corefx,MaggieTsang/corefx,iamjasonp/corefx,iamjasonp/corefx,rjxby/corefx,billwert/corefx,elijah6/corefx,Priya91/corefx-1,gkhanna79/corefx,stone-li/corefx,krytarowski/corefx,tstringer/corefx,ericstj/corefx,ravimeda/corefx,wtgodbe/corefx,ericstj/corefx,axelheer/corefx,seanshpark/corefx,elijah6/corefx,mmitche/corefx,jcme/corefx,axelheer/corefx,jlin177/corefx,krytarowski/corefx,manu-silicon/corefx,cydhaselton/corefx,elijah6/corefx,axelheer/corefx,dhoehna/corefx,mazong1123/corefx,rjxby/corefx,ravimeda/corefx,rubo/corefx,alexperovich/corefx,gkhanna79/corefx,tstringer/corefx,nchikanov/corefx,weltkante/corefx,rubo/corefx,billwert/corefx,cartermp/corefx,twsouthwick/corefx,alexperovich/corefx,JosephTremoulet/corefx,tstringer/corefx,gkhanna79/corefx,zhenlan/corefx,ellismg/corefx,dhoehna/corefx,pallavit/corefx,manu-silicon/corefx,rahku/corefx,dhoehna/corefx,rubo/corefx,Petermarcu/corefx,DnlHarvey/corefx,Chrisboh/corefx,lggomez/corefx,seanshpark/corefx,fgreinacher/corefx,dotnet-bot/corefx,kkurni/corefx,iamjasonp/corefx,zhenlan/corefx,krk/corefx,pallavit/corefx,richlander/corefx,cydhaselton/corefx,the-dwyer/corefx,Petermarcu/corefx,YoupHulsebos/corefx,the-dwyer/corefx,benjamin-bader/corefx,the-dwyer/corefx,alphonsekurian/corefx,Chrisboh/corefx,zhenlan/corefx,SGuyGe/corefx,BrennanConroy/corefx,adamralph/corefx,elijah6/corefx,pallavit/corefx,jlin177/corefx,ViktorHofer/corefx,jhendrixMSFT/corefx,krytarowski/corefx,DnlHarvey/corefx,MaggieTsang/corefx,wtgodbe/corefx,SGuyGe/corefx,manu-silicon/corefx,gkhanna79/corefx,Chrisboh/corefx,kkurni/corefx,elijah6/corefx,shmao/corefx,lggomez/corefx,ptoonen/corefx,Jiayili1/corefx,billwert/corefx,Petermarcu/corefx,ViktorHofer/corefx,tstringer/corefx,ellismg/corefx,zhenlan/corefx,rjxby/corefx,MaggieTsang/corefx,SGuyGe/corefx,JosephTremoulet/corefx,nbarbettini/corefx,tijoytom/corefx,dotnet-bot/corefx,benjamin-bader/corefx,wtgodbe/corefx,alexperovich/corefx,twsouthwick/corefx,jhendrixMSFT/corefx,krk/corefx,fgreinacher/corefx,Petermarcu/corefx,shimingsg/corefx,iamjasonp/corefx,zhenlan/corefx,shmao/corefx,Chrisboh/corefx,zhenlan/corefx,dotnet-bot/corefx,mmitche/corefx,adamralph/corefx,DnlHarvey/corefx,shimingsg/corefx,pallavit/corefx,Petermarcu/corefx,mmitche/corefx,krk/corefx,alexperovich/corefx,rjxby/corefx,Priya91/corefx-1,Jiayili1/corefx,axelheer/corefx,the-dwyer/corefx,ravimeda/corefx,wtgodbe/corefx,shimingsg/corefx,khdang/corefx,ptoonen/corefx,yizhang82/corefx,shmao/corefx,pallavit/corefx,ViktorHofer/corefx,billwert/corefx,pallavit/corefx,seanshpark/corefx,twsouthwick/corefx,JosephTremoulet/corefx,parjong/corefx,mmitche/corefx,stone-li/corefx,billwert/corefx,shahid-pk/corefx,adamralph/corefx,JosephTremoulet/corefx,ravimeda/corefx,tijoytom/corefx,Petermarcu/corefx,benjamin-bader/corefx,alphonsekurian/corefx,DnlHarvey/corefx,kkurni/corefx,yizhang82/corefx,mmitche/corefx,shahid-pk/corefx,elijah6/corefx,tijoytom/corefx,krytarowski/corefx,alphonsekurian/corefx,jhendrixMSFT/corefx,iamjasonp/corefx,lggomez/corefx,shimingsg/corefx,JosephTremoulet/corefx,zhenlan/corefx,MaggieTsang/corefx,weltkante/corefx,manu-silicon/corefx,DnlHarvey/corefx,rjxby/corefx,shmao/corefx,twsouthwick/corefx,weltkante/corefx,nbarbettini/corefx,krytarowski/corefx,marksmeltzer/corefx,lggomez/corefx,gkhanna79/corefx,Priya91/corefx-1,mazong1123/corefx,dhoehna/corefx,parjong/corefx,nbarbettini/corefx,ericstj/corefx,shahid-pk/corefx,nbarbettini/corefx,nchikanov/corefx,stephenmichaelf/corefx,mmitche/corefx,ravimeda/corefx,Ermiar/corefx,rahku/corefx,fgreinacher/corefx,cydhaselton/corefx,dsplaisted/corefx,jcme/corefx,cydhaselton/corefx,Chrisboh/corefx,stephenmichaelf/corefx,rahku/corefx,weltkante/corefx,parjong/corefx,richlander/corefx,richlander/corefx,cydhaselton/corefx,Jiayili1/corefx,Ermiar/corefx,jcme/corefx,khdang/corefx,nchikanov/corefx,jlin177/corefx,jlin177/corefx,shahid-pk/corefx,shahid-pk/corefx,Priya91/corefx-1,jcme/corefx,iamjasonp/corefx,rubo/corefx,ellismg/corefx,parjong/corefx,tijoytom/corefx,twsouthwick/corefx,ptoonen/corefx,wtgodbe/corefx,cydhaselton/corefx,Ermiar/corefx,cartermp/corefx,YoupHulsebos/corefx,jhendrixMSFT/corefx,dotnet-bot/corefx,ViktorHofer/corefx,krk/corefx,cartermp/corefx,nchikanov/corefx,kkurni/corefx,jcme/corefx,shmao/corefx,nbarbettini/corefx,Priya91/corefx-1,manu-silicon/corefx,ptoonen/corefx,jhendrixMSFT/corefx,twsouthwick/corefx,tstringer/corefx,ellismg/corefx,shimingsg/corefx,benjamin-bader/corefx,rahku/corefx,nchikanov/corefx,YoupHulsebos/corefx,wtgodbe/corefx,YoupHulsebos/corefx,dotnet-bot/corefx,fgreinacher/corefx,parjong/corefx,YoupHulsebos/corefx,Jiayili1/corefx,ptoonen/corefx,the-dwyer/corefx,Jiayili1/corefx,mazong1123/corefx,kkurni/corefx,ericstj/corefx,ellismg/corefx,alexperovich/corefx,weltkante/corefx,mazong1123/corefx,Jiayili1/corefx,dsplaisted/corefx,SGuyGe/corefx,yizhang82/corefx,nbarbettini/corefx,alphonsekurian/corefx,YoupHulsebos/corefx,ViktorHofer/corefx,rahku/corefx,seanshpark/corefx,MaggieTsang/corefx,axelheer/corefx,yizhang82/corefx,stephenmichaelf/corefx,axelheer/corefx,dhoehna/corefx,richlander/corefx,Ermiar/corefx,dotnet-bot/corefx,the-dwyer/corefx,nchikanov/corefx,Ermiar/corefx,gkhanna79/corefx,rahku/corefx,tijoytom/corefx,rahku/corefx,yizhang82/corefx,manu-silicon/corefx,shmao/corefx,billwert/corefx,Priya91/corefx-1,cartermp/corefx,tijoytom/corefx,mazong1123/corefx,seanshpark/corefx,cartermp/corefx,alphonsekurian/corefx,alexperovich/corefx,billwert/corefx,tijoytom/corefx,khdang/corefx,marksmeltzer/corefx,nchikanov/corefx,dhoehna/corefx,krytarowski/corefx,rubo/corefx,mmitche/corefx,alphonsekurian/corefx,stone-li/corefx,JosephTremoulet/corefx,krk/corefx,alexperovich/corefx,Ermiar/corefx,weltkante/corefx,stone-li/corefx,JosephTremoulet/corefx,benjamin-bader/corefx,stone-li/corefx,marksmeltzer/corefx,marksmeltzer/corefx,lggomez/corefx,ericstj/corefx,the-dwyer/corefx,iamjasonp/corefx,kkurni/corefx,ptoonen/corefx,krytarowski/corefx,cydhaselton/corefx,SGuyGe/corefx,BrennanConroy/corefx,jcme/corefx,dotnet-bot/corefx,ViktorHofer/corefx,tstringer/corefx,SGuyGe/corefx,ericstj/corefx,manu-silicon/corefx,ravimeda/corefx,wtgodbe/corefx,marksmeltzer/corefx,marksmeltzer/corefx,MaggieTsang/corefx,rjxby/corefx,khdang/corefx,mazong1123/corefx,YoupHulsebos/corefx,Ermiar/corefx,seanshpark/corefx,ravimeda/corefx,richlander/corefx,parjong/corefx,dsplaisted/corefx,Jiayili1/corefx,DnlHarvey/corefx,richlander/corefx,marksmeltzer/corefx,stone-li/corefx,ptoonen/corefx,alphonsekurian/corefx,stephenmichaelf/corefx,dhoehna/corefx,ericstj/corefx,mazong1123/corefx,DnlHarvey/corefx,yizhang82/corefx,shmao/corefx,ViktorHofer/corefx,ellismg/corefx,shahid-pk/corefx,jlin177/corefx,seanshpark/corefx,jlin177/corefx,krk/corefx,stephenmichaelf/corefx,shimingsg/corefx,MaggieTsang/corefx,jlin177/corefx,richlander/corefx,gkhanna79/corefx,parjong/corefx,lggomez/corefx,weltkante/corefx,jhendrixMSFT/corefx,cartermp/corefx,rjxby/corefx,shimingsg/corefx,khdang/corefx,Chrisboh/corefx,benjamin-bader/corefx,yizhang82/corefx,stephenmichaelf/corefx,jhendrixMSFT/corefx,khdang/corefx,krk/corefx,stone-li/corefx | src/System.Globalization/tests/TextInfo/TextInfoIsReadOnly.cs | src/System.Globalization/tests/TextInfo/TextInfoIsReadOnly.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class TextInfoIsReadOnly
{
public static IEnumerable<object[]> IsReadOnly_TestData()
{
yield return new object[] { CultureInfo.ReadOnly(new CultureInfo("en-US")).TextInfo, true };
yield return new object[] { CultureInfo.InvariantCulture.TextInfo, true };
yield return new object[] { new CultureInfo("").TextInfo, false };
yield return new object[] { new CultureInfo("en-US").TextInfo, false };
yield return new object[] { new CultureInfo("fr-FR").TextInfo, false };
}
[Theory]
[MemberData(nameof(IsReadOnly_TestData))]
public void IsReadOnly(TextInfo textInfo, bool expected)
{
Assert.Equal(expected, textInfo.IsReadOnly);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class TextInfoIsReadOnly
{
public static IEnumerable<object[]> IsReadOnly_TestData()
{
yield return new object[] { CultureInfo.InvariantCulture.TextInfo, true };
yield return new object[] { new CultureInfo("").TextInfo, false };
yield return new object[] { new CultureInfo("en-US").TextInfo, false };
yield return new object[] { new CultureInfo("fr-FR").TextInfo, false };
}
[Theory]
[MemberData(nameof(IsReadOnly_TestData))]
public void IsReadOnly(TextInfo textInfo, bool expected)
{
Assert.Equal(expected, textInfo.IsReadOnly);
}
}
}
| mit | C# |
010f6258705e86c47ad208c519362daa80e6c346 | use derived component in OsuMarkdownFencedCodeBlock | smoogipooo/osu,ppy/osu,peppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,peppy/osu,smoogipoo/osu | osu.Game/Graphics/Containers/Markdown/OsuMarkdownFencedCodeBlock.cs | osu.Game/Graphics/Containers/Markdown/OsuMarkdownFencedCodeBlock.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownFencedCodeBlock : MarkdownFencedCodeBlock
{
// TODO : change to monospace font for this component
public OsuMarkdownFencedCodeBlock(FencedCodeBlock fencedCodeBlock)
: base(fencedCodeBlock)
{
}
protected override Drawable CreateBackground() => new CodeBlockBackground();
public override MarkdownTextFlowContainer CreateTextFlow() => new CodeBlockTextFlowContainer();
private class CodeBlockBackground : Box
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
RelativeSizeAxes = Axes.Both;
Colour = colourProvider.Background6;
}
}
private class CodeBlockTextFlowContainer : OsuMarkdownTextFlowContainer
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Colour = colourProvider.Light1;
Margin = new MarginPadding(10);
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownFencedCodeBlock : MarkdownFencedCodeBlock
{
private Box background;
private MarkdownTextFlowContainer textFlow;
public OsuMarkdownFencedCodeBlock(FencedCodeBlock fencedCodeBlock)
: base(fencedCodeBlock)
{
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
// TODO : Change to monospace font to match with osu-web
background.Colour = colourProvider.Background6;
textFlow.Colour = colourProvider.Light1;
}
protected override Drawable CreateBackground()
{
return background = new Box
{
RelativeSizeAxes = Axes.Both,
};
}
public override MarkdownTextFlowContainer CreateTextFlow()
{
return textFlow = base.CreateTextFlow();
}
}
}
| mit | C# |
5c6e9d6c22544059e50014dfbad30da16369fc79 | add todo | shchy/FluentHub | FluentHub/ModelConverter/ProxyModelConverter.cs | FluentHub/ModelConverter/ProxyModelConverter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FluentHub.ModelConverter
{
// todo ラッパーは型変換はクラスを分ける
public abstract class WrapperModelConverter<P,T> : IModelConverter<P>
where T : P
{
private IModelConverter<T> real;
public WrapperModelConverter()
{
this.real = MakeConverter();
}
protected abstract IModelConverter<T> MakeConverter();
public bool CanBytesToModel(IEnumerable<byte> bytes)
{
return this.real.CanBytesToModel(bytes);
}
public bool CanModelToBytes(object model)
{
var isT = model is T;
if (isT ==false)
{
return false;
}
return this.real.CanModelToBytes(model);
}
public byte[] ToBytes(P model)
{
return this.real.ToBytes((T)model);
}
public Tuple<P, int> ToModel(IEnumerable<byte> bytes)
{
var result = this.real.ToModel(bytes);
return
Tuple.Create((P)result.Item1, result.Item2);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FluentHub.ModelConverter
{
public abstract class WrapperModelConverter<P,T> : IModelConverter<P>
where T : P
{
private IModelConverter<T> real;
public WrapperModelConverter()
{
this.real = MakeConverter();
}
protected abstract IModelConverter<T> MakeConverter();
public bool CanBytesToModel(IEnumerable<byte> bytes)
{
return this.real.CanBytesToModel(bytes);
}
public bool CanModelToBytes(object model)
{
var isT = model is T;
if (isT ==false)
{
return false;
}
return this.real.CanModelToBytes(model);
}
public byte[] ToBytes(P model)
{
return this.real.ToBytes((T)model);
}
public Tuple<P, int> ToModel(IEnumerable<byte> bytes)
{
var result = this.real.ToModel(bytes);
return
Tuple.Create((P)result.Item1, result.Item2);
}
}
}
| mit | C# |
a9737d09a7b8da42135b672169bfd24462d03618 | Break build to test TeamCity. | alexmullans/Siftables-Emulator | Siftables/MainWindow.xaml.cs | Siftables/MainWindow.xaml.cs | namespace Siftables
{
public partial class MainWindowView
{
public MainWindowView()
{
InitializeComponent();
DoSomething();
}
}
}
| namespace Siftables
{
public partial class MainWindowView
{
public MainWindowView()
{
InitializeComponent();
}
}
}
| bsd-2-clause | C# |
0f3a3d1ba67dbee1ca8c3bbef61714b0ad66e637 | Fix spelling error in summary comment. | fixie/fixie | src/Fixie/Discovery.cs | src/Fixie/Discovery.cs | namespace Fixie
{
using Internal;
using Internal.Expressions;
/// <summary>
/// Subclass Discovery to customize test discovery rules.
///
/// The default discovery rules are applied to a test assembly whenever the test
/// assembly includes no such subclass.
///
/// By default,
///
/// <para>A class is a test class if its name ends with "Tests".</para>
///
/// <para>All public methods in a test class are test methods.</para>
/// </summary>
public class Discovery
{
public Discovery()
{
Config = new Configuration();
Classes = new ClassExpression(Config);
Methods = new MethodExpression(Config);
Parameters = new ParameterSourceExpression(Config);
}
/// <summary>
/// The current state describing the discovery rules. This state can be manipulated through
/// the other properties on Discovery.
/// </summary>
internal Configuration Config { get; }
/// <summary>
/// Defines the set of conditions that describe which classes are test classes.
/// </summary>
public ClassExpression Classes { get; }
/// <summary>
/// Defines the set of conditions that describe which test class methods are test methods,
/// and what order to run them in.
/// </summary>
public MethodExpression Methods { get; }
/// <summary>
/// Defines the set of parameter sources, which provide inputs to parameterized test methods.
/// </summary>
public ParameterSourceExpression Parameters { get; }
}
} | namespace Fixie
{
using Internal;
using Internal.Expressions;
/// <summary>
/// Subclass Discovery to customize test discovery rules.
///
/// The default discovery rules are applied to a test assembly whenever the test
/// assembly includes no such subclass.
///
/// By defualt,
///
/// <para>A class is a test class if its name ends with "Tests".</para>
///
/// <para>All public methods in a test class are test methods.</para>
/// </summary>
public class Discovery
{
public Discovery()
{
Config = new Configuration();
Classes = new ClassExpression(Config);
Methods = new MethodExpression(Config);
Parameters = new ParameterSourceExpression(Config);
}
/// <summary>
/// The current state describing the discovery rules. This state can be manipulated through
/// the other properties on Discovery.
/// </summary>
internal Configuration Config { get; }
/// <summary>
/// Defines the set of conditions that describe which classes are test classes.
/// </summary>
public ClassExpression Classes { get; }
/// <summary>
/// Defines the set of conditions that describe which test class methods are test methods,
/// and what order to run them in.
/// </summary>
public MethodExpression Methods { get; }
/// <summary>
/// Defines the set of parameter sources, which provide inputs to parameterized test methods.
/// </summary>
public ParameterSourceExpression Parameters { get; }
}
} | mit | C# |
d8b692d4eba9f6029d6b434aac7e75b6d14ac7d8 | Handle preference inside UnicodeString. | naoey/osu-framework,default0/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,naoey/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,RedNesto/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,paparony03/osu-framework,default0/osu-framework,Nabile-Rahmani/osu-framework | osu.Framework/Localization/LocaleEngine.cs | osu.Framework/Localization/LocaleEngine.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using System;
using System.Collections.Generic;
namespace osu.Framework.Localization
{
public class LocalisationEngine
{
private Bindable<bool> preferUnicode;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config)
{
preferUnicode = config.GetBindable<bool>(FrameworkConfig.ShowUnicode);
preferUnicode.ValueChanged += updateUnicodeStrings;
}
private List<WeakReference<UnicodeBindableString>> unicodeBindings = new List<WeakReference<UnicodeBindableString>>();
protected void AddWeakReference(UnicodeBindableString unicodeBindable) => unicodeBindings.Add(new WeakReference<UnicodeBindableString>(unicodeBindable));
public UnicodeBindableString GetUnicodePreference(string unicode, string nonUnicode)
{
var bindable = new UnicodeBindableString(unicode, nonUnicode)
{
PreferUnicode = preferUnicode.Value
};
AddWeakReference(bindable);
return bindable;
}
private void updateUnicodeStrings(bool newValue)
{
foreach (var w in unicodeBindings.ToArray())
{
UnicodeBindableString b;
if (w.TryGetTarget(out b))
b.PreferUnicode = newValue;
else
unicodeBindings.Remove(w);
}
}
public class UnicodeBindableString : Bindable<string>
{
public readonly string Unicode;
public readonly string NonUnicode;
public UnicodeBindableString(string unicode, string nonUnicode) : base(nonUnicode)
{
Unicode = unicode;
NonUnicode = nonUnicode;
}
public bool PreferUnicode
{
get { return Value == Unicode; }
set { Value = value ? Unicode : NonUnicode; }
}
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using System;
using System.Collections.Generic;
namespace osu.Framework.Localization
{
public class LocalisationEngine
{
private Bindable<bool> preferUnicode;
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config)
{
preferUnicode = config.GetBindable<bool>(FrameworkConfig.ShowUnicode);
preferUnicode.ValueChanged += updateUnicodeStrings;
}
private List<WeakReference<UnicodeBindableString>> unicodeBindings = new List<WeakReference<UnicodeBindableString>>();
protected void AddWeakReference(UnicodeBindableString unicodeBindable) => unicodeBindings.Add(new WeakReference<UnicodeBindableString>(unicodeBindable));
public UnicodeBindableString GetUnicodePreference(string unicode, string nonUnicode)
{
var bindable = new UnicodeBindableString(getUnicodePreference(unicode, nonUnicode));
AddWeakReference(bindable);
return bindable;
}
private string getUnicodePreference(string unicode, string nonUnicode) => preferUnicode ? unicode : nonUnicode;
private void updateUnicodeStrings(bool newValue)
{
foreach (var w in unicodeBindings.ToArray())
{
UnicodeBindableString b;
if (w.TryGetTarget(out b))
b.Value = getUnicodePreference(b.Unicode, b.NonUnicode);
else
unicodeBindings.Remove(w);
}
}
public class UnicodeBindableString : Bindable<string>
{
public string Unicode;
public string NonUnicode;
public UnicodeBindableString(string s) : base(s)
{
}
}
}
}
| mit | C# |
653cb42efd228356015cd19545aa6f9abdf1bd4e | Add test. | cston/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,MichalStrehovsky/roslyn,tmat/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,physhi/roslyn,stephentoub/roslyn,gafter/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,brettfo/roslyn,AlekseyTs/roslyn,sharwell/roslyn,genlu/roslyn,weltkante/roslyn,mavasani/roslyn,aelij/roslyn,DustinCampbell/roslyn,brettfo/roslyn,gafter/roslyn,davkean/roslyn,bartdesmet/roslyn,eriawan/roslyn,xasx/roslyn,KevinRansom/roslyn,cston/roslyn,aelij/roslyn,dpoeschl/roslyn,MichalStrehovsky/roslyn,CyrusNajmabadi/roslyn,nguerrera/roslyn,swaroop-sridhar/roslyn,VSadov/roslyn,dotnet/roslyn,tmat/roslyn,AmadeusW/roslyn,ErikSchierboom/roslyn,tmeschter/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,dpoeschl/roslyn,genlu/roslyn,agocke/roslyn,AlekseyTs/roslyn,dpoeschl/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,nguerrera/roslyn,physhi/roslyn,brettfo/roslyn,sharwell/roslyn,jmarolf/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,eriawan/roslyn,jcouv/roslyn,mgoertz-msft/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,VSadov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,wvdd007/roslyn,diryboy/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,xasx/roslyn,aelij/roslyn,jcouv/roslyn,diryboy/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmeschter/roslyn,heejaechang/roslyn,swaroop-sridhar/roslyn,agocke/roslyn,diryboy/roslyn,MichalStrehovsky/roslyn,abock/roslyn,jasonmalinowski/roslyn,cston/roslyn,genlu/roslyn,heejaechang/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,mavasani/roslyn,bartdesmet/roslyn,reaction1989/roslyn,tannergooding/roslyn,stephentoub/roslyn,tmeschter/roslyn,VSadov/roslyn,jcouv/roslyn,abock/roslyn,davkean/roslyn,nguerrera/roslyn,KirillOsenkov/roslyn,swaroop-sridhar/roslyn,agocke/roslyn,davkean/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,tmat/roslyn,heejaechang/roslyn,gafter/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,DustinCampbell/roslyn,mgoertz-msft/roslyn,physhi/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,abock/roslyn,xasx/roslyn | src/EditorFeatures/CSharpTest/ConvertAnonymousTypeToTuple/ConvertAnonymousTypeToTupleTests.cs | src/EditorFeatures/CSharpTest/ConvertAnonymousTypeToTuple/ConvertAnonymousTypeToTupleTests.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToTuple;
using Microsoft.CodeAnalysis.CSharp.ConvertForEachToFor;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertAnonymousTypeToTuple
{
public partial class ConvertAnonymousTypeToTupleTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer(), new CSharpConvertAnonymousTypeToTupleCodeFixProvider());
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertAnonymousTypeToTuple)]
public async Task ConvertSingleAnonymousType()
{
var text = @"
class Test
{
void Method()
{
var t1 = [||]new { a = 1, b = 2 };
}
}
";
var expected = @"
class Test
{
void Method()
{
var t1 = (a: 1, b: 2);
}
}
";
await TestInRegularAndScriptAsync(text, expected);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertAnonymousTypeToTuple)]
public async Task ConvertSingleAnonymousTypeWithInferredName()
{
var text = @"
class Test
{
void Method(int b)
{
var t1 = [||]new { a = 1, b };
}
}
";
var expected = @"
class Test
{
void Method(int b)
{
var t1 = (a: 1, b);
}
}
";
await TestInRegularAndScriptAsync(text, expected);
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToTuple;
using Microsoft.CodeAnalysis.CSharp.ConvertForEachToFor;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ConvertAnonymousTypeToTuple
{
public partial class ConvertAnonymousTypeToTupleTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer(), new CSharpConvertAnonymousTypeToTupleCodeFixProvider());
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertAnonymousTypeToTuple)]
public async Task ConvertSingleAnonymousType()
{
var text = @"
class Test
{
void Method()
{
var t1 = [||]new { a = 1, b = 2 };
}
}
";
var expected = @"
class Test
{
void Method()
{
var t1 = (a: 1, b: 2);
}
}
";
await TestInRegularAndScriptAsync(text, expected);
}
}
}
| mit | C# |
82c097129b15a2cfb7c5a900939d35b05f0efae1 | Set the compiler to LLVM | markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation | packages/C/dev/XCodeBuilder/CObjectFile.cs | packages/C/dev/XCodeBuilder/CObjectFile.cs | // <copyright file="CObjectFile.cs" company="Mark Final">
// Opus package
// </copyright>
// <summary>C package</summary>
// <author>Mark Final</author>
namespace XCodeBuilder
{
public sealed partial class XCodeBuilder
{
public object Build(C.ObjectFile moduleToBuild, out bool success)
{
var node = moduleToBuild.OwningNode;
var moduleName = node.ModuleName;
var target = node.Target;
var baseTarget = (Opus.Core.BaseTarget)target;
Opus.Core.Log.MessageAll("ObjectFile {0}", moduleName);
var sourceFile = moduleToBuild.SourceFile.AbsolutePath;
var fileRef = new PBXFileReference(moduleName, sourceFile, this.RootUri);
fileRef.IsSourceCode = true;
this.Project.FileReferences.Add(fileRef);
var buildConfiguration = this.Project.BuildConfigurations.Get(baseTarget.ConfigurationName('='), moduleName);
// TODO: what to do when there are multiple configurations
if (target.HasPlatform(Opus.Core.EPlatform.OSX64))
{
buildConfiguration.Options["ARCHS"] = "\"$(ARCHS_STANDARD_64_BIT)\"";
}
else
{
buildConfiguration.Options["ARCHS"] = "\"$(ARCHS_STANDARD_32_BIT)\"";
}
buildConfiguration.Options["ONLY_ACTIVE_ARCH"] = "YES";
buildConfiguration.Options["MACOSX_DEPLOYMENT_TARGET"] = "10.8";
buildConfiguration.Options["SDKROOT"] = "macosx";
if (target.HasToolsetType(typeof(LLVMGcc.Toolset)))
{
buildConfiguration.Options["GCC_VERSION"] = "com.apple.compilers.llvmgcc42";
}
else
{
// clang GCC_VERSION = com.apple.compilers.llvm.clang.1_0
throw new Opus.Core.Exception("Cannot identify toolchain {0}", target.ToolsetName('='));
}
var data = new PBXBuildFile(moduleName);
data.FileReference = fileRef;
this.Project.BuildFiles.Add(data);
var sourcesBuildPhase = this.Project.SourceBuildPhases.Get("Sources", moduleName);
sourcesBuildPhase.Files.Add(data);
data.BuildPhase = sourcesBuildPhase;
success = true;
return data;
}
}
}
| // <copyright file="CObjectFile.cs" company="Mark Final">
// Opus package
// </copyright>
// <summary>C package</summary>
// <author>Mark Final</author>
namespace XCodeBuilder
{
public sealed partial class XCodeBuilder
{
public object Build(C.ObjectFile moduleToBuild, out bool success)
{
var node = moduleToBuild.OwningNode;
var moduleName = node.ModuleName;
var target = node.Target;
var baseTarget = (Opus.Core.BaseTarget)target;
Opus.Core.Log.MessageAll("ObjectFile {0}", moduleName);
var sourceFile = moduleToBuild.SourceFile.AbsolutePath;
var fileRef = new PBXFileReference(moduleName, sourceFile, this.RootUri);
fileRef.IsSourceCode = true;
this.Project.FileReferences.Add(fileRef);
var buildConfiguration = this.Project.BuildConfigurations.Get(baseTarget.ConfigurationName('='), moduleName);
// TODO: what to do when there are multiple configurations
if (target.HasPlatform(Opus.Core.EPlatform.OSX64))
{
buildConfiguration.Options["ARCHS"] = "\"$(ARCHS_STANDARD_64_BIT)\"";
}
else
{
buildConfiguration.Options["ARCHS"] = "\"$(ARCHS_STANDARD_32_BIT)\"";
}
buildConfiguration.Options["ONLY_ACTIVE_ARCH"] = "YES";
buildConfiguration.Options["MACOSX_DEPLOYMENT_TARGET"] = "10.8";
buildConfiguration.Options["SDKROOT"] = "macosx";
var data = new PBXBuildFile(moduleName);
data.FileReference = fileRef;
this.Project.BuildFiles.Add(data);
var sourcesBuildPhase = this.Project.SourceBuildPhases.Get("Sources", moduleName);
sourcesBuildPhase.Files.Add(data);
data.BuildPhase = sourcesBuildPhase;
success = true;
return data;
}
}
}
| bsd-3-clause | C# |
91096b5659f13a647851487b433c388e3d1df1e6 | Bump v1.0.18 | karronoli/tiny-sato | TinySato/Properties/AssemblyInfo.cs | TinySato/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.18.*")]
[assembly: AssemblyFileVersion("1.0.18")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.17.22647")]
[assembly: AssemblyFileVersion("1.0.17")]
| apache-2.0 | C# |
988b41a76c1e1ec6ff32d4621510321b14b5a77d | Hide dialogue when complete | jbrowneuk/vestige | Vestige.Engine/Core/SpeechSystem.cs | Vestige.Engine/Core/SpeechSystem.cs | using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Vestige.Engine.Core
{
internal class SpeechSystem
{
private const int visualAreaHeight = 240;
private string[] messages;
private int currentMessageIndex;
private string displayText;
private TimeSpan timeSinceLetter;
private bool isShown;
internal SpeechSystem()
{
messages = new string[] { "Message 1", "Message 2", "Message 3" };
currentMessageIndex = 0;
displayText = CalculateFormattedText(messages[currentMessageIndex]);
timeSinceLetter = TimeSpan.Zero;
isShown = true;
}
internal Texture2D BaseArea { get; set; }
internal SpriteFont MainFont { get; set; }
internal Rectangle Viewport { get; set; }
internal void AdvanceText()
{
if (currentMessageIndex < messages.Length - 1)
{
currentMessageIndex += 1;
displayText = CalculateFormattedText(messages[currentMessageIndex]);
}
else
{
isShown = false;
}
}
internal void Draw(SpriteBatch spriteBatch)
{
if (!isShown)
{
return;
}
Rectangle drawableArea = new Rectangle(0, Viewport.Bottom - visualAreaHeight, Viewport.Width, visualAreaHeight);
spriteBatch.Draw(BaseArea, drawableArea, Color.Black);
spriteBatch.DrawString(MainFont, displayText, new Vector2(drawableArea.Left, drawableArea.Top), Color.White);
}
private string CalculateFormattedText(string rawText)
{
// todo - calc drawable area, control widths of strings based upon SpriteFont.MeasureString
return rawText;
}
}
}
| using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Vestige.Engine.Core
{
internal class SpeechSystem
{
private const int visualAreaHeight = 240;
private string[] messages;
private int currentMessageIndex;
private string displayText;
private TimeSpan timeSinceLetter;
internal SpeechSystem()
{
messages = new string[] { "Message 1", "Message 2", "Message 3" };
currentMessageIndex = 0;
displayText = CalculateFormattedText(messages[currentMessageIndex]);
timeSinceLetter = TimeSpan.Zero;
}
internal Texture2D BaseArea { get; set; }
internal SpriteFont MainFont { get; set; }
internal Rectangle Viewport { get; set; }
internal void AdvanceText()
{
if (currentMessageIndex < messages.Length - 1)
{
currentMessageIndex += 1;
displayText = CalculateFormattedText(messages[currentMessageIndex]);
}
else
{
// TODO: end conversation
currentMessageIndex = 0;
displayText = CalculateFormattedText(messages[currentMessageIndex]);
}
}
internal void Draw(SpriteBatch spriteBatch)
{
Rectangle drawableArea = new Rectangle(0, Viewport.Bottom - visualAreaHeight, Viewport.Width, visualAreaHeight);
spriteBatch.Draw(BaseArea, drawableArea, Color.Black);
spriteBatch.DrawString(MainFont, displayText, new Vector2(drawableArea.Left, drawableArea.Top), Color.White);
}
private string CalculateFormattedText(string rawText)
{
// todo - calc drawable area, control widths of strings based upon SpriteFont.MeasureString
return rawText;
}
}
}
| mit | C# |
d5b5b1659741e1a57e8602b4448ede5d2ceb3a3b | Bump next version to 3.0.1 | waltdestler/SharpDX,dazerdude/SharpDX,waltdestler/SharpDX,dazerdude/SharpDX,dazerdude/SharpDX,RobyDX/SharpDX,mrvux/SharpDX,mrvux/SharpDX,dazerdude/SharpDX,waltdestler/SharpDX,andrewst/SharpDX,sharpdx/SharpDX,waltdestler/SharpDX,mrvux/SharpDX,sharpdx/SharpDX,andrewst/SharpDX,sharpdx/SharpDX,RobyDX/SharpDX,RobyDX/SharpDX,andrewst/SharpDX,RobyDX/SharpDX | Source/SharedAssemblyInfo.cs | Source/SharedAssemblyInfo.cs | // Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("3.0.1")]
[assembly:AssemblyFileVersion("3.0.1")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
#if STORE_APP
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when public and interface: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when struct: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.*: INotifyPropertyChanged heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: forced rename", Exclude = false)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: enum values pruning", Exclude = false)]
[assembly: Obfuscation(Feature = "legacy xml serialization heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "ignore InternalsVisibleToAttribute", Exclude = false)]
#endif | // Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2013 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("3.0.0")]
[assembly:AssemblyFileVersion("3.0.0")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
#if STORE_APP
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when public and interface: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when struct: renaming", Exclude = false, ApplyToMembers = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.*: INotifyPropertyChanged heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: forced rename", Exclude = false)]
[assembly: Obfuscation(Feature = "Apply to type SharpDX.* when enum: enum values pruning", Exclude = false)]
[assembly: Obfuscation(Feature = "legacy xml serialization heuristics", Exclude = true)]
[assembly: Obfuscation(Feature = "ignore InternalsVisibleToAttribute", Exclude = false)]
#endif | mit | C# |
79618d11a1574ab79400200a2eea6710a1536ddb | simplify TestExportJoinableTaskContext | tannergooding/roslyn,jcouv/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,genlu/roslyn,gafter/roslyn,genlu/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,OmarTawfik/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,xasx/roslyn,jmarolf/roslyn,reaction1989/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,tmat/roslyn,stephentoub/roslyn,VSadov/roslyn,davkean/roslyn,reaction1989/roslyn,tmeschter/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,xasx/roslyn,weltkante/roslyn,bartdesmet/roslyn,diryboy/roslyn,swaroop-sridhar/roslyn,dpoeschl/roslyn,wvdd007/roslyn,physhi/roslyn,ErikSchierboom/roslyn,swaroop-sridhar/roslyn,CyrusNajmabadi/roslyn,paulvanbrenk/roslyn,abock/roslyn,mgoertz-msft/roslyn,DustinCampbell/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,Hosch250/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,diryboy/roslyn,jamesqo/roslyn,brettfo/roslyn,jcouv/roslyn,jamesqo/roslyn,tmat/roslyn,agocke/roslyn,dpoeschl/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,bkoelman/roslyn,heejaechang/roslyn,eriawan/roslyn,cston/roslyn,aelij/roslyn,Hosch250/roslyn,agocke/roslyn,physhi/roslyn,wvdd007/roslyn,AmadeusW/roslyn,paulvanbrenk/roslyn,DustinCampbell/roslyn,abock/roslyn,tmeschter/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,Hosch250/roslyn,dpoeschl/roslyn,DustinCampbell/roslyn,weltkante/roslyn,bkoelman/roslyn,cston/roslyn,KevinRansom/roslyn,mavasani/roslyn,eriawan/roslyn,dotnet/roslyn,sharwell/roslyn,jcouv/roslyn,nguerrera/roslyn,KevinRansom/roslyn,MichalStrehovsky/roslyn,xasx/roslyn,jamesqo/roslyn,dotnet/roslyn,OmarTawfik/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,sharwell/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,jmarolf/roslyn,davkean/roslyn,OmarTawfik/roslyn,genlu/roslyn,bkoelman/roslyn,heejaechang/roslyn,bartdesmet/roslyn,dotnet/roslyn,tmeschter/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,sharwell/roslyn,wvdd007/roslyn,gafter/roslyn,ErikSchierboom/roslyn,agocke/roslyn,heejaechang/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,aelij/roslyn,VSadov/roslyn,jmarolf/roslyn,mavasani/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmat/roslyn,nguerrera/roslyn,swaroop-sridhar/roslyn,MichalStrehovsky/roslyn,gafter/roslyn,abock/roslyn,AmadeusW/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,paulvanbrenk/roslyn,MichalStrehovsky/roslyn,reaction1989/roslyn,physhi/roslyn,davkean/roslyn,eriawan/roslyn,brettfo/roslyn,VSadov/roslyn,cston/roslyn | src/EditorFeatures/TestUtilities/TestExportJoinableTaskContext.cs | src/EditorFeatures/TestUtilities/TestExportJoinableTaskContext.cs | using System;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.VisualStudio.Threading;
namespace Microsoft.CodeAnalysis.Editor.UnitTests
{
// Starting with 15.3 the editor took a dependency on JoinableTaskContext
// in Text.Logic and Intellisense layers as an editor host provided service.
[PartCreationPolicy(CreationPolicy.NonShared)] // JTC is "main thread" affinitized so should not be shared
internal class TestExportJoinableTaskContext : ForegroundThreadAffinitizedObject
{
[ThreadStatic]
private static JoinableTaskContext s_joinableTaskContext;
[Export]
private JoinableTaskContext _joinableTaskContext = s_joinableTaskContext ?? (s_joinableTaskContext = new JoinableTaskContext());
}
}
| using System.Collections.Concurrent;
using System.ComponentModel.Composition;
using System.Threading;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.VisualStudio.Threading;
namespace Microsoft.CodeAnalysis.Editor.UnitTests
{
// Starting with 15.3 the editor took a dependency on JoinableTaskContext
// in Text.Logic and Intellisense layers as an editor host provided service.
[PartCreationPolicy(CreationPolicy.NonShared)] // JTC is "main thread" affinitized so should not be shared
internal class TestExportJoinableTaskContext : ForegroundThreadAffinitizedObject
{
private static readonly ConcurrentDictionary<Thread, JoinableTaskContext> s_jtcPerThread = new ConcurrentDictionary<Thread, JoinableTaskContext>();
[Export]
private JoinableTaskContext _joinableTaskContext = s_jtcPerThread.GetOrAdd(ForegroundThreadAffinitizedObject.CurrentForegroundThreadData.Thread,
(thread) => new JoinableTaskContext(mainThread: thread));
}
}
| mit | C# |
c0c54b5ea4d33def209f25dcfcaa2e9e389e405c | Increment version | R-Smith/vmPing | vmPing/Properties/AssemblyInfo.cs | vmPing/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("vmPing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("vmPing")]
[assembly: AssemblyCopyright("Copyright © 2021 Ryan Smith")]
[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("1.3.15.0")]
[assembly: AssemblyFileVersion("1.3.15.0")]
| 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("vmPing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("vmPing")]
[assembly: AssemblyCopyright("Copyright © 2021 Ryan Smith")]
[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("1.3.14.0")]
[assembly: AssemblyFileVersion("1.3.14.0")]
| mit | C# |
931f4da0879d1152b0d5dccc19c7def0dad2d0be | Reorder source types enums. | GetTabster/Tabster.Core | Types/TablatureSourceType.cs | Types/TablatureSourceType.cs | namespace Tabster.Core.Types
{
public enum TablatureSourceType
{
UserCreated,
FileImport,
Download
}
} | namespace Tabster.Core.Types
{
public enum TablatureSourceType
{
Download,
FileImport,
UserCreated
}
} | apache-2.0 | C# |
cb2604f1c7f02d02fe155e1df4836518ca5aa4ba | Update FilterData.cs | phnx47/MicroOrm.Dapper.Repositories | src/MicroOrm.Dapper.Repositories/SqlGenerator/Filters/FilterData.cs | src/MicroOrm.Dapper.Repositories/SqlGenerator/Filters/FilterData.cs | namespace MicroOrm.Dapper.Repositories.SqlGenerator.Filters
{
/// <summary>
/// The filter data class; This should have some more things...
/// </summary>
public class FilterData
{
/// <summary>
/// The query order settings
/// </summary>
public OrderInfo OrderInfo { get; set; }
/// <summary>
/// The query limits settings
/// </summary>
public LimitInfo LimitInfo { get; set; }
/// <sumary>
/// Specify if the query is ordered
/// </sumary>
public bool Ordered { get; set; }
}
}
| namespace MicroOrm.Dapper.Repositories.SqlGenerator.Filters
{
/// <summary>
/// The filter data class; This should have some more things...
/// </summary>
public class FilterData
{
//todo: create select filter
/// <summary>
/// The query order settings
/// </summary>
public OrderInfo OrderInfo { get; set; }
/// <summary>
/// The query limits settings
/// </summary>
public LimitInfo LimitInfo { get; set; }
/// <sumary>
/// Specify if the query is ordered
/// </sumary>
public bool Ordered { get; set; }
}
}
| mit | C# |
fbb6ade478cd24ba7668d4ebcc800911649a2360 | transform name specified in attribute too (thanks Ryan Farley) | mwereda/RestSharp,paulcbetts/RestSharp,dgreenbean/RestSharp,mcintyre321/RestSharp-.NET-2.0-Fork,uQr/RestSharp,huoxudong125/RestSharp,jiangzm/RestSharp,RestSharp-resurrected/RestSharp,eamonwoortman/RestSharp.Unity,jmartin84/RestSharp,rucila/RestSharp,dmgandini/RestSharp,fmmendo/RestSharp,mcintyre321/RestSharp-.NET-2.0-Fork,KraigM/RestSharp,wparad/RestSharp,cnascimento/RestSharp,felipegtx/RestSharp,devinrader/RestSharpRTExperimental,PKRoma/RestSharp,who/RestSharp,dyh333/RestSharp,jmartin84/RestSharp,amccarter/RestSharp,lydonchandra/RestSharp,mattleibow/RestSharp,benfo/RestSharp,devinrader/RestSharpRTExperimental,Haacked/RestSharp,chengxiaole/RestSharp,restsharp/RestSharp,IsCoolEntertainment/unity-restsharp,kouweizhong/RestSharp,wparad/RestSharp,paulcbetts/RestSharp,Haacked/RestSharp,rivy/RestSharp,SaltyDH/RestSharp,mattwalden/RestSharp,periface/RestSharp,haithemaraissia/RestSharp,IsCoolEntertainment/unity-restsharp | RestSharp/Serializers/SerializeAsAttribute.cs | RestSharp/Serializers/SerializeAsAttribute.cs | #region License
// Copyright 2010 John Sheehan
//
// 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 RestSharp.Extensions;
namespace RestSharp.Serializers
{
/// <summary>
/// Allows control how class and property names and values are serialized by XmlSerializer
/// Currently not supported with the JsonSerializer
/// When specified at the property level the class-level specification is overridden
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class SerializeAsAttribute : Attribute
{
public SerializeAsAttribute() {
NameStyle = NameStyle.AsIs;
Index = int.MaxValue;
}
/// <summary>
/// The name to use for the serialized element
/// </summary>
public string Name { get; set; }
/// <summary>
/// Sets the value to be serialized as an Attribute instead of an Element
/// </summary>
public bool Attribute { get; set; }
/// <summary>
/// Transforms the casing of the name based on the selected value.
/// </summary>
public NameStyle NameStyle { get; set; }
/// <summary>
/// The order to serialize the element. Default is int.MaxValue.
/// </summary>
public int Index { get; set; }
/// <summary>
/// Called by the attribute when NameStyle is speficied
/// </summary>
/// <param name="input">The string to transform</param>
/// <returns>String</returns>
public string TransformName(string input) {
var name = Name ?? input;
switch (NameStyle) {
case NameStyle.CamelCase:
return name.ToCamelCase();
case NameStyle.PascalCase:
return name.ToPascalCase();
case NameStyle.LowerCase:
return name.ToLower();
}
return input;
}
}
/// <summary>
/// Options for transforming casing of element names
/// </summary>
public enum NameStyle
{
AsIs,
CamelCase,
LowerCase,
PascalCase
}
}
| #region License
// Copyright 2010 John Sheehan
//
// 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 RestSharp.Extensions;
namespace RestSharp.Serializers
{
/// <summary>
/// Allows control how class and property names and values are serialized by XmlSerializer
/// Currently not supported with the JsonSerializer
/// When specified at the property level the class-level specification is overridden
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class SerializeAsAttribute : Attribute
{
public SerializeAsAttribute() {
NameStyle = NameStyle.AsIs;
Index = int.MaxValue;
}
/// <summary>
/// The name to use for the serialized element
/// </summary>
public string Name { get; set; }
/// <summary>
/// Sets the value to be serialized as an Attribute instead of an Element
/// </summary>
public bool Attribute { get; set; }
/// <summary>
/// Transforms the casing of the name based on the selected value.
/// </summary>
public NameStyle NameStyle { get; set; }
/// <summary>
/// The order to serialize the element. Default is int.MaxValue.
/// </summary>
public int Index { get; set; }
/// <summary>
/// Called by the attribute when NameStyle is speficied
/// </summary>
/// <param name="input">The string to transform</param>
/// <returns>String</returns>
public string TransformName(string input) {
switch (NameStyle) {
case NameStyle.CamelCase:
return input.ToCamelCase();
case NameStyle.PascalCase:
return input.ToPascalCase();
case NameStyle.LowerCase:
return input.ToLower();
}
return input;
}
}
/// <summary>
/// Options for transforming casing of element names
/// </summary>
public enum NameStyle
{
AsIs,
CamelCase,
LowerCase,
PascalCase
}
}
| apache-2.0 | C# |
701a8faaba9c5139513bd39e42b2f84ae36c270b | Use stable version of JQueryMobile. | intellifactory/websharper.jquerymobile,intellifactory/websharper.jquerymobile | if-ws-jquerymobile/Resources.cs | if-ws-jquerymobile/Resources.cs | using System.Web.UI;
using IntelliFactory.WebSharper;
namespace IntelliFactory.WebSharper.JQuery.Mobile.Resources
{
[IntelliFactory.WebSharper.Core.Attributes.Require(typeof(IntelliFactory.WebSharper.JQuery.Resources.JQuery))]
public class JQueryMobile : IntelliFactory.WebSharper.Core.Resources.BaseResource
{
public JQueryMobile() : base("http://code.jquery.com/mobile/1.1.1",
"/jquery.mobile-1.1.1.min.js",
"/jquery.mobile-1.1.1.min.css") {}
}
}
| using System.Web.UI;
using IntelliFactory.WebSharper;
namespace IntelliFactory.WebSharper.JQuery.Mobile.Resources
{
[IntelliFactory.WebSharper.Core.Attributes.Require(typeof(IntelliFactory.WebSharper.JQuery.Resources.JQuery))]
public class JQueryMobile : IntelliFactory.WebSharper.Core.Resources.BaseResource
{
public JQueryMobile() : base("http://code.jquery.com/mobile/1.2.0-alpha.1",
"/jquery.mobile-1.2.0-alpha.1.min.js",
"/jquery.mobile-1.2.0-alpha.1.min.css") {}
}
}
| apache-2.0 | C# |
543f3ef081600f21486973e9de2a2d7ab9316a04 | Rename extension method | YeastFx/Yeast | src/Yeast.WebApi/Security/Extensions/ServiceCollectionExtensions.cs | src/Yeast.WebApi/Security/Extensions/ServiceCollectionExtensions.cs | using Microsoft.Extensions.DependencyInjection;
using System;
namespace Yeast.WebApi.Security
{
/// <summary>
/// Contains extension methods to <see cref="IServiceCollection"/>.
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// Adds <see cref="JwtIssuer"/> to the service collection.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> reference.</param>
/// <param name="configureOptions">The <see cref="JwtIssuerOptions"/> configuration action.</param>
/// <returns>The <see cref="IServiceCollection"/> reference.</returns>
public static IServiceCollection AddJwtIssuer(this IServiceCollection services, Action<JwtIssuerOptions> configureOptions)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}
services.Configure(configureOptions);
services.AddTransient<JwtIssuer>();
return services;
}
}
}
| using Microsoft.Extensions.DependencyInjection;
using System;
namespace Yeast.WebApi.Security
{
/// <summary>
/// Contains extension methods to <see cref="IServiceCollection"/>.
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// Adds <see cref="JwtIssuer"/> to the service collection.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> reference.</param>
/// <param name="configureOptions">The <see cref="JwtIssuerOptions"/> configuration action.</param>
/// <returns>The <see cref="IServiceCollection"/> reference.</returns>
public static IServiceCollection AddJwtAuthentication(this IServiceCollection services, Action<JwtIssuerOptions> configureOptions)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (configureOptions == null)
{
throw new ArgumentNullException(nameof(configureOptions));
}
services.Configure(configureOptions);
services.AddTransient<JwtIssuer>();
return services;
}
}
}
| mit | C# |
ef2ef8c01c6827ba15270ffc2c613a3d9c8e886d | allow third party network support in NetworkJsonConverter | thepunctuatedhorizon/BrickCoinAlpha.0.0.1,NicolasDorier/NBitcoin,stratisproject/NStratis,dangershony/NStratis,MetacoSA/NBitcoin,MetacoSA/NBitcoin,lontivero/NBitcoin | NBitcoin/JsonConverters/NetworkJsonConverter.cs | NBitcoin/JsonConverters/NetworkJsonConverter.cs | #if !NOJSONNET
using NBitcoin;
using Newtonsoft.Json;
using System;
using System.Reflection;
namespace NBitcoin.JsonConverters
{
#if !NOJSONNET
public
#else
internal
#endif
class NetworkJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(Network).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
var network = (string)reader.Value;
if (network == null)
return null;
if (network.Equals("MainNet", StringComparison.OrdinalIgnoreCase) || network.Equals("main", StringComparison.OrdinalIgnoreCase))
return Network.Main;
if (network.Equals("TestNet", StringComparison.OrdinalIgnoreCase) || network.Equals("test", StringComparison.OrdinalIgnoreCase))
return Network.TestNet;
if(network.Equals("RegTest", StringComparison.OrdinalIgnoreCase) || network.Equals("reg", StringComparison.OrdinalIgnoreCase))
return Network.RegTest;
var net = Network.GetNetwork(network);
if(net != null)
return net;
throw new JsonObjectException("Unknown network (valid values : main, test, reg)", reader);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var net = (Network)value;
String str = null;
if (net == Network.Main)
str = "MainNet";
if (net == Network.TestNet)
str = "TestNet";
if(net == Network.RegTest)
str = "RegTest";
if (str != null)
writer.WriteValue(str);
}
}
}
#endif | #if !NOJSONNET
using NBitcoin;
using Newtonsoft.Json;
using System;
using System.Reflection;
namespace NBitcoin.JsonConverters
{
#if !NOJSONNET
public
#else
internal
#endif
class NetworkJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(Network).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
return null;
var network = (string)reader.Value;
if (network == null)
return null;
if (network.Equals("MainNet", StringComparison.OrdinalIgnoreCase) || network.Equals("main", StringComparison.OrdinalIgnoreCase))
return Network.Main;
if (network.Equals("TestNet", StringComparison.OrdinalIgnoreCase) || network.Equals("test", StringComparison.OrdinalIgnoreCase))
return Network.TestNet;
if(network.Equals("RegTest", StringComparison.OrdinalIgnoreCase) || network.Equals("reg", StringComparison.OrdinalIgnoreCase))
return Network.RegTest;
throw new JsonObjectException("Unknown network (valid values : main, test, reg)", reader);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var net = (Network)value;
String str = null;
if (net == Network.Main)
str = "MainNet";
if (net == Network.TestNet)
str = "TestNet";
if(net == Network.RegTest)
str = "RegTest";
if (str != null)
writer.WriteValue(str);
}
}
}
#endif | mit | C# |
51990d9f80d9de5167fea61b072ea902bbf4dc7f | Rename test method | appharbor/appharbor-cli | src/AppHarbor.Tests/Commands/RemoveConfigCommandTest.cs | src/AppHarbor.Tests/Commands/RemoveConfigCommandTest.cs | using AppHarbor.Commands;
using Moq;
using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests.Commands
{
public class RemoveConfigCommandTest
{
[Theory, AutoCommandData]
public void ShouldThrowIfNoArguments(RemoveConfigCommand command)
{
Assert.Throws<CommandException>(() => command.Execute(new string[0]));
}
[Theory]
[InlineAutoCommandData("foo")]
[InlineAutoCommandData("foo bar baz")]
public void ShouldRemoveConfigurationVariables(string arguments,
[Frozen]Mock<IApplicationConfiguration> applicationConfiguration,
[Frozen]Mock<IAppHarborClient> client,
RemoveConfigCommand command, string applicationId)
{
applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationId);
var keysToDelete = arguments.Split();
command.Execute(keysToDelete);
foreach (var key in keysToDelete)
{
client.Verify(x => x.RemoveConfigurationVariable(applicationId, key));
}
}
}
}
| using AppHarbor.Commands;
using Moq;
using Ploeh.AutoFixture.Xunit;
using Xunit;
using Xunit.Extensions;
namespace AppHarbor.Tests.Commands
{
public class RemoveConfigCommandTest
{
[Theory, AutoCommandData]
public void ShouldThrowIfNoArguments(RemoveConfigCommand command)
{
Assert.Throws<CommandException>(() => command.Execute(new string[0]));
}
[Theory]
[InlineAutoCommandData("foo")]
[InlineAutoCommandData("foo bar baz")]
public void ShouldAddConfigurationVariables(string arguments,
[Frozen]Mock<IApplicationConfiguration> applicationConfiguration,
[Frozen]Mock<IAppHarborClient> client,
RemoveConfigCommand command, string applicationId)
{
applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationId);
var keysToDelete = arguments.Split();
command.Execute(keysToDelete);
foreach (var key in keysToDelete)
{
client.Verify(x => x.RemoveConfigurationVariable(applicationId, key));
}
}
}
}
| mit | C# |
b047039f7914be22d2733827842e83cf2905eeaa | refactor base resolver | wangkanai/Detection | src/Detection.Core/src/BaseResolver.cs | src/Detection.Core/src/BaseResolver.cs | // Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Http;
namespace Wangkanai.Detection
{
public class BaseResolver : IResolver
{
/// <summary>
/// Get user agnet of the request client
/// </summary>
public IUserAgent UserAgent => _service.UserAgent;
/// <summary>
/// Get HttpContext of the application service
/// </summary>
protected HttpContext Context => _service.Context;
protected readonly IUserAgentService _service;
public BaseResolver(IUserAgentService service)
=> _service = service ?? throw new BaseResolverArgumentNullException(nameof(service));
protected string GetUserAgent()
{
if (Context == null || !Context.Request.Headers["User-Agent"].Any())
return "";
return new UserAgent(Context.Request.Headers["User-Agent"].FirstOrDefault())
.ToString()
.ToLowerInvariant();
}
}
}
| // Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNetCore.Http;
namespace Wangkanai.Detection
{
public class BaseResolver : IResolver
{
/// <summary>
/// Get user agnet of the request client
/// </summary>
public IUserAgent UserAgent => _service.UserAgent;
/// <summary>
/// Get HttpContext of the application service
/// </summary>
protected HttpContext Context => _service.Context;
protected readonly IUserAgentService _service;
public BaseResolver(
IUserAgentService service)
{
if (service == null)
throw new BaseResolverArgumentNullException(nameof(service));
_service = service;
}
protected string GetUserAgent()
{
if (Context == null || !Context.Request.Headers["User-Agent"].Any())
return "";
return new UserAgent(Context.Request.Headers["User-Agent"].FirstOrDefault())
.ToString()
.ToLowerInvariant();
}
}
}
| apache-2.0 | C# |
252e49aebde076e8ace4a3630a33a8b68a865d9e | upgrade version to 1.4.6 | Aaron-Liu/ecommon,tangxuehua/ecommon | src/ECommon/Properties/AssemblyInfo.cs | src/ECommon/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ECommon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECommon")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b3edf459-8725-465e-a484-410b9a68df1f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.6")]
[assembly: AssemblyFileVersion("1.4.6")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ECommon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECommon")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b3edf459-8725-465e-a484-410b9a68df1f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.5")]
[assembly: AssemblyFileVersion("1.4.5")]
| mit | C# |
5fe16c81d3eec06fdd6fa4599e851e351add84fc | Revert "Fix NH-2840" - line endings screwed (*sigh) | nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,ManufacturingIntelligence/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core | src/NHibernate/Param/QueryTakeParameterSpecification.cs | src/NHibernate/Param/QueryTakeParameterSpecification.cs | using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using NHibernate.Engine;
using NHibernate.SqlCommand;
using NHibernate.Type;
namespace NHibernate.Param
{
/// <summary>
/// Autogenerated parameter for <see cref="IQuery.SetMaxResults"/>.
/// </summary>
public class QueryTakeParameterSpecification : IParameterSpecification
{
// NOTE: don't use this for HQL take clause
private readonly string[] idTrack;
private readonly string limitParametersNameForThisQuery = "<nhtake" + Guid.NewGuid().ToString("N"); // NH_note: to avoid conflicts using MultiQuery/Future
private readonly IType type = NHibernateUtil.Int32;
public QueryTakeParameterSpecification()
{
idTrack = new[] { limitParametersNameForThisQuery };
}
#region IParameterSpecification Members
public void Bind(IDbCommand command, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session)
{
Bind(command, sqlQueryParametersList, 0, sqlQueryParametersList, queryParameters, session);
}
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session)
{
// The QueryTakeParameterSpecification is unique so we can use multiSqlQueryParametersList
var effectiveParameterLocations = multiSqlQueryParametersList.GetEffectiveParameterLocations(limitParametersNameForThisQuery).ToArray();
if (effectiveParameterLocations.Any())
{
// if the dialect does not support variable limits the parameter may was removed
int value = queryParameters.RowSelection.MaxRows;
int position = effectiveParameterLocations.Single();
type.NullSafeSet(command, value, position, session);
}
}
public IType ExpectedType
{
get { return type; }
set { throw new InvalidOperationException(); }
}
public string RenderDisplayInfo()
{
return "query-take";
}
public IEnumerable<string> GetIdsForBackTrack(IMapping sessionFactory)
{
return idTrack;
}
#endregion
public override bool Equals(object obj)
{
return Equals(obj as QueryTakeParameterSpecification);
}
public bool Equals(QueryTakeParameterSpecification other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return Equals(other.limitParametersNameForThisQuery, limitParametersNameForThisQuery);
}
public override int GetHashCode()
{
return limitParametersNameForThisQuery.GetHashCode();
}
}
} | using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using NHibernate.Engine;
using NHibernate.SqlCommand;
using NHibernate.Type;
namespace NHibernate.Param
{
/// <summary>
/// Autogenerated parameter for <see cref="IQuery.SetMaxResults"/>.
/// </summary>
public class QueryTakeParameterSpecification : IParameterSpecification
{
// NOTE: don't use this for HQL take clause
private readonly string[] idTrack;
private readonly string limitParametersNameForThisQuery = "<nhtake" + Guid.NewGuid().ToString("N"); // NH_note: to avoid conflicts using MultiQuery/Future
private readonly IType type = NHibernateUtil.Int32;
public QueryTakeParameterSpecification()
{
idTrack = new[] { limitParametersNameForThisQuery };
}
#region IParameterSpecification Members
public void Bind(IDbCommand command, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session)
{
Bind(command, sqlQueryParametersList, 0, sqlQueryParametersList, queryParameters, session);
}
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session)
{
// The QueryTakeParameterSpecification is unique so we can use multiSqlQueryParametersList
var effectiveParameterLocations = multiSqlQueryParametersList.GetEffectiveParameterLocations(limitParametersNameForThisQuery).ToArray();
if (effectiveParameterLocations.Any())
{
// if the dialect does not support variable limits the parameter may was removed
int value = Loader.Loader.GetLimitUsingDialect(queryParameters.RowSelection, session.Factory.Dialect) ?? queryParameters.RowSelection.MaxRows;
int position = effectiveParameterLocations.Single();
type.NullSafeSet(command, value, position, session);
}
}
public IType ExpectedType
{
get { return type; }
set { throw new InvalidOperationException(); }
}
public string RenderDisplayInfo()
{
return "query-take";
}
public IEnumerable<string> GetIdsForBackTrack(IMapping sessionFactory)
{
return idTrack;
}
#endregion
public override bool Equals(object obj)
{
return Equals(obj as QueryTakeParameterSpecification);
}
public bool Equals(QueryTakeParameterSpecification other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return Equals(other.limitParametersNameForThisQuery, limitParametersNameForThisQuery);
}
public override int GetHashCode()
{
return limitParametersNameForThisQuery.GetHashCode();
}
}
} | lgpl-2.1 | C# |
95b170db080c281f812cd92e93a587463246d8fc | Switch SparkMessage.Errors to use generic collection | RichLogan/CiscoSpark-UnityProject,RichLogan/CiscoSpark-UnityProject | SparkUnity/Assets/Cisco/Spark/SparkMessage.cs | SparkUnity/Assets/Cisco/Spark/SparkMessage.cs | using System;
using System.Collections.Generic;
namespace Cisco.Spark {
public class SparkMessage {
public string Message;
public IEnumerable<SparkError> Errors;
public string TrackingId;
public SparkMessage (Dictionary<string, object> data) {
Message = (string) data ["message"];
Errors = new List<SparkError> ();
object errors;
if (data.TryGetValue ("errors", out errors)) {
var listOfErrors = errors as List<object>;
var errorList = new List<SparkError> ();
foreach (var error in listOfErrors) {
errorList.Add (new SparkError(error as Dictionary<string, object>));
}
Errors = errorList;
}
TrackingId = (string) data ["trackingId"];
}
}
} | using System;
using System.Collections;
using System.Collections.Generic;
namespace Cisco.Spark {
public class SparkMessage {
public string Message;
public IEnumerable Errors;
public string TrackingId;
public SparkMessage (Dictionary<string, object> data) {
Message = (string) data ["message"];
Errors = new List<SparkError> ();
object errors;
if (data.TryGetValue ("errors", out errors)) {
var listOfErrors = errors as List<object>;
var errorList = new List<SparkError> ();
foreach (var error in listOfErrors) {
errorList.Add (new SparkError(error as Dictionary<string, object>));
}
Errors = errorList;
}
TrackingId = (string) data ["trackingId"];
}
}
} | apache-2.0 | C# |
561c9f2cc3243cb6a036af745f272c9948673e54 | Handle item expiration | GearedToWar/NuGet2,jmezach/NuGet2,jholovacs/NuGet,antiufo/NuGet2,RichiCoder1/nuget-chocolatey,ctaggart/nuget,rikoe/nuget,oliver-feng/nuget,antiufo/NuGet2,kumavis/NuGet,oliver-feng/nuget,dolkensp/node.net,RichiCoder1/nuget-chocolatey,alluran/node.net,alluran/node.net,pratikkagda/nuget,atheken/nuget,pratikkagda/nuget,jholovacs/NuGet,oliver-feng/nuget,OneGet/nuget,RichiCoder1/nuget-chocolatey,xoofx/NuGet,indsoft/NuGet2,GearedToWar/NuGet2,antiufo/NuGet2,pratikkagda/nuget,rikoe/nuget,OneGet/nuget,antiufo/NuGet2,mrward/nuget,zskullz/nuget,pratikkagda/nuget,indsoft/NuGet2,oliver-feng/nuget,anurse/NuGet,jholovacs/NuGet,alluran/node.net,themotleyfool/NuGet,rikoe/nuget,chocolatey/nuget-chocolatey,mono/nuget,mrward/NuGet.V2,jmezach/NuGet2,xoofx/NuGet,mono/nuget,rikoe/nuget,OneGet/nuget,zskullz/nuget,chocolatey/nuget-chocolatey,chester89/nugetApi,mrward/nuget,indsoft/NuGet2,xoofx/NuGet,chocolatey/nuget-chocolatey,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,anurse/NuGet,mono/nuget,RichiCoder1/nuget-chocolatey,RichiCoder1/nuget-chocolatey,kumavis/NuGet,dolkensp/node.net,jholovacs/NuGet,indsoft/NuGet2,ctaggart/nuget,jmezach/NuGet2,GearedToWar/NuGet2,chocolatey/nuget-chocolatey,jholovacs/NuGet,xoofx/NuGet,antiufo/NuGet2,chester89/nugetApi,mrward/NuGet.V2,OneGet/nuget,alluran/node.net,chocolatey/nuget-chocolatey,chocolatey/nuget-chocolatey,themotleyfool/NuGet,jmezach/NuGet2,GearedToWar/NuGet2,zskullz/nuget,jholovacs/NuGet,mrward/nuget,jmezach/NuGet2,themotleyfool/NuGet,mrward/nuget,akrisiun/NuGet,indsoft/NuGet2,oliver-feng/nuget,akrisiun/NuGet,mrward/nuget,mrward/NuGet.V2,pratikkagda/nuget,GearedToWar/NuGet2,mrward/NuGet.V2,ctaggart/nuget,indsoft/NuGet2,mono/nuget,atheken/nuget,GearedToWar/NuGet2,xero-github/Nuget,zskullz/nuget,ctaggart/nuget,mrward/NuGet.V2,dolkensp/node.net,mrward/nuget,jmezach/NuGet2,pratikkagda/nuget,mrward/NuGet.V2,antiufo/NuGet2,xoofx/NuGet,dolkensp/node.net,xoofx/NuGet | src/Core/Utility/MemoryCache.cs | src/Core/Utility/MemoryCache.cs | using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using System.Threading;
namespace NuGet {
internal sealed class MemoryCache {
private MemoryCache() {
}
internal static MemoryCache Default {
get {
return InternalMemoryCache.Instance;
}
}
private ConcurrentDictionary<string, CacheItem> _cache = new ConcurrentDictionary<string, CacheItem>();
internal int Count { get { return _cache.Count; } }
internal T GetOrAdd<T>(string cacheKey, Func<T> factory, TimeSpan slidingExpiration) where T : class {
CacheItem result;
if (!_cache.TryGetValue(cacheKey, out result)) {
result = new CacheItem(this, cacheKey, factory(), slidingExpiration);
_cache[cacheKey] = result;
}
return (T)result.Item;
}
internal void Remove(string cacheKey) {
CacheItem item;
_cache.TryRemove(cacheKey, out item);
}
private class CacheItem {
public CacheItem(MemoryCache owner, string cacheKey, object item, TimeSpan expiry) {
_item = item;
Task.Factory.StartNew(() => {
Thread.Sleep(expiry);
owner.Remove(cacheKey);
});
}
private object _item;
public object Item {
get {
return _item;
}
}
}
private class InternalMemoryCache {
static InternalMemoryCache() {
}
internal static MemoryCache Instance = new MemoryCache();
}
}
}
| using System;
using System.Collections.Concurrent;
namespace NuGet {
internal sealed class MemoryCache {
private MemoryCache() {
}
internal static MemoryCache Default {
get
{
return InternalMemoryCache.Instance;
}
}
private ConcurrentDictionary<string, CacheItem> _cache = new ConcurrentDictionary<string, CacheItem>();
internal T GetOrAdd<T>(string cacheKey, Func<T> factory, TimeSpan slidingExpiration) where T : class {
CacheItem result;
if (!_cache.TryGetValue(cacheKey, out result) || result.Expiry < DateTime.Now) {
result = new CacheItem { Item = factory(), Expiry = DateTime.Now.Add(slidingExpiration) };
_cache[cacheKey] = result;
}
return (T)result.Item;
}
internal void Remove(string cacheKey) {
CacheItem item;
_cache.TryRemove(cacheKey, out item);
}
private class CacheItem {
public object Item { get; set; }
public DateTime Expiry { get; set; }
}
private class InternalMemoryCache {
static InternalMemoryCache() {
}
internal static MemoryCache Instance = new MemoryCache();
}
}
}
| apache-2.0 | C# |
d9268d4ba217272a7f18699d5fdc788321b973ee | Update Bootstrapper comments | SonarSource/sonar-msbuild-runner,SonarSource-VisualStudio/sonar-scanner-msbuild,SonarSource-DotNet/sonar-msbuild-runner,SonarSource-VisualStudio/sonar-msbuild-runner,dbolkensteyn/sonar-msbuild-runner,duncanpMS/sonar-msbuild-runner,HSAR/sonar-msbuild-runner,SonarSource-VisualStudio/sonar-scanner-msbuild,SonarSource-VisualStudio/sonar-scanner-msbuild,jango2015/sonar-msbuild-runner,duncanpMS/sonar-msbuild-runner,duncanpMS/sonar-msbuild-runner,SonarSource-VisualStudio/sonar-msbuild-runner,jabbera/sonar-msbuild-runner | SonarQube.Bootstrapper/IBootstrapperSettings.cs | SonarQube.Bootstrapper/IBootstrapperSettings.cs | //-----------------------------------------------------------------------
// <copyright file="IBootstrapperSettings.cs" company="SonarSource SA and Microsoft Corporation">
// Copyright (c) SonarSource SA and Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// </copyright>
//-----------------------------------------------------------------------
using System;
namespace SonarQube.Bootstrapper
{
/// <summary>
/// Returns the settings required by the bootstrapper
/// </summary>
public interface IBootstrapperSettings
{
string SonarQubeUrl { get; }
/// <summary>
/// Temporary analysis directory, usually .sonarqube
/// </summary>
string TempDirectory { get; }
/// <summary>
/// Directory into which the downloaded files should be placed, usually .sonarqube\bin
/// </summary>
string DownloadDirectory { get; }
/// <summary>
/// Full path to the pre-processor to be executed
/// </summary>
string PreProcessorFilePath { get; }
/// <summary>
/// Full path to the post-processor to be executed
/// </summary>
string PostProcessorFilePath { get; }
/// <summary>
/// Full path to the xml file containing the logical bootstrapper API versions supported by the pre/post-processors
/// </summary>
string SupportedBootstrapperVersionsFilePath { get; }
/// <summary>
/// Logical version of the bootstrapper
/// </summary>
Version BootstrapperVersion { get; }
/// <summary>
/// Timeout for the pre-processor execution.
/// </summary>
/// <remarks>Use -1 for infinite timeout</remarks>
int PreProcessorTimeoutInMs { get; }
/// <summary>
/// Timeout for the post-processor execution
/// </summary>
/// <remarks>Use -1 for infinite timeout</remarks>
int PostProcessorTimeoutInMs { get; }
}
}
| //-----------------------------------------------------------------------
// <copyright file="IBootstrapperSettings.cs" company="SonarSource SA and Microsoft Corporation">
// Copyright (c) SonarSource SA and Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// </copyright>
//-----------------------------------------------------------------------
using System;
namespace SonarQube.Bootstrapper
{
/// <summary>
/// Returns the settings required by the bootstrapper
/// </summary>
public interface IBootstrapperSettings
{
string SonarQubeUrl { get; }
/// <summary>
/// Temporary analysis directory, usually .sonarqube
/// </summary>
string TempDirectory { get; }
/// <summary>
/// Directory into which the downloaded files should be placed, usually .sonarqube\bin
/// </summary>
string DownloadDirectory { get; }
/// <summary>
/// Full path to the pre-processor to be executed
/// </summary>
string PreProcessorFilePath { get; }
/// <summary>
/// Full path to the post-processor to be executed
/// </summary>
string PostProcessorFilePath { get; }
/// <summary>
/// Full path to the xml file containing the logical bootstrapper API versions supported by the pre/post-processors
/// </summary>
string SupportedBootstrapperVersionsFilePath { get; }
/// <summary>
/// Logical version of the bootstrapper
/// </summary>
Version BootstrapperVersion { get; }
/// <summary>
/// Timeout for the pre-processor execution
/// </summary>
int PreProcessorTimeoutInMs { get; }
/// <summary>
/// Timeout for the post-processor execution
/// </summary>
int PostProcessorTimeoutInMs { get; }
}
}
| mit | C# |
753b66498c91a9f63f0986a59e6dcab69bbef0fa | use Assert.Equal instead of throw clause. | jwChung/Experimentalism,jwChung/Experimentalism | test/Experiment.AutoFixtureUnitTest/AutoFixtureAdapterTest.cs | test/Experiment.AutoFixtureUnitTest/AutoFixtureAdapterTest.cs | using System;
using Xunit;
namespace Jwc.Experiment
{
public class AutoFixtureAdapterTest
{
[Fact]
public void SutIsTestFixture()
{
var sut = new AutoFixtureAdapter(new FakeSpecimenContext());
Assert.IsAssignableFrom<ITestFixture>(sut);
}
[Fact]
public void SpecimenContextIsCorrect()
{
var expected = new FakeSpecimenContext();
var sut = new AutoFixtureAdapter(expected);
var actual = sut.SpecimenContext;
Assert.Equal(expected, actual);
}
[Fact]
public void InitializeWithNullContextThrows()
{
Assert.Throws<ArgumentNullException>(() => new AutoFixtureAdapter(null));
}
[Fact]
public void CreateReturnsCorrectSpecimen()
{
var context = new FakeSpecimenContext();
var request = new object();
var expected = new object();
context.OnResolve = r =>
{
Assert.Equal(request, r);
return expected;
};
var sut = new AutoFixtureAdapter(context);
var actual = sut.Create(request);
Assert.Equal(expected, actual);
}
}
} | using System;
using Xunit;
namespace Jwc.Experiment
{
public class AutoFixtureAdapterTest
{
[Fact]
public void SutIsTestFixture()
{
var sut = new AutoFixtureAdapter(new FakeSpecimenContext());
Assert.IsAssignableFrom<ITestFixture>(sut);
}
[Fact]
public void SpecimenContextIsCorrect()
{
var expected = new FakeSpecimenContext();
var sut = new AutoFixtureAdapter(expected);
var actual = sut.SpecimenContext;
Assert.Equal(expected, actual);
}
[Fact]
public void InitializeWithNullContextThrows()
{
Assert.Throws<ArgumentNullException>(() => new AutoFixtureAdapter(null));
}
[Fact]
public void CreateReturnsCorrectSpecimen()
{
var context = new FakeSpecimenContext();
var request = new object();
var expected = new object();
context.OnResolve = r =>
{
if (r == request)
return expected;
throw new NotSupportedException();
};
var sut = new AutoFixtureAdapter(context);
var actual = sut.Create(request);
Assert.Equal(expected, actual);
}
}
} | mit | C# |
76da3ab6745db057d9001e54f0a608c0a61e40c3 | Introduce RemoveLevel in LevelManager | InPvP/MiNET,Vladik46/MiNET,uniaspiex/MiNET,yungtechboy1/MiNET,MiPE-JP/RaNET | src/MiNET/MiNET/LevelManager.cs | src/MiNET/MiNET/LevelManager.cs | using System;
using System.Collections.Generic;
using System.Linq;
using MiNET.Worlds;
namespace MiNET
{
public class LevelManager
{
public List<Level> Levels { get; set; }
public LevelManager()
{
Levels = new List<Level>();
}
public virtual Level GetLevel(Player player, string name)
{
Level level = Levels.FirstOrDefault(l => l.LevelId.Equals(name, StringComparison.InvariantCultureIgnoreCase));
if (level == null)
{
level = new Level(name);
level.Initialize();
Levels.Add(level);
}
return level;
}
public void RemoveLevel(Level level)
{
if(Levels.Contains(level))
{
Levels.Remove(level);
}
level.Close();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using MiNET.Worlds;
namespace MiNET
{
public class LevelManager
{
public List<Level> Levels { get; set; }
public LevelManager()
{
Levels = new List<Level>();
}
public virtual Level GetLevel(Player player, string name)
{
Level level = Levels.FirstOrDefault(l => l.LevelId.Equals(name, StringComparison.InvariantCultureIgnoreCase));
if (level == null)
{
level = new Level(name);
level.Initialize();
Levels.Add(level);
}
return level;
}
}
} | mpl-2.0 | C# |
8851ff4582c7ff329502c9d4ef6991750cc74973 | Bump version to 0.12.0 | whampson/bft-spec,whampson/cascara | Src/WHampson.Cascara/Properties/AssemblyInfo.cs | Src/WHampson.Cascara/Properties/AssemblyInfo.cs | #region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WHampson.Cascara")]
[assembly: AssemblyProduct("WHampson.Cascara")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")]
[assembly: AssemblyFileVersion("0.12.0.0")]
[assembly: AssemblyVersion("0.12.0.0")]
[assembly: AssemblyInformationalVersion("0.12")]
| #region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WHampson.Cascara")]
[assembly: AssemblyProduct("WHampson.Cascara")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")]
[assembly: AssemblyFileVersion("0.11.0")]
[assembly: AssemblyVersion("0.11.0.0")]
[assembly: AssemblyInformationalVersion("0.11")]
| mit | C# |
b805b0d505c09945786acb260866ec12fbe55a6c | Fix typo in unit test name | MarcinHoppe/LangtonsAnts | Test/MarcinHoppe.LangtonsAnts.Tests/AntTests.cs | Test/MarcinHoppe.LangtonsAnts.Tests/AntTests.cs | using System;
using Moq;
using Xunit;
namespace MarcinHoppe.LangtonsAnts.Tests
{
public class AntTests
{
[Fact]
public void AntTurnsRightOnWhiteSquare()
{
// Arrange
var ant = AntAt(10, 7);
var board = Mock.Of<Board>(b => b.ColorAt(PositionAt(10, 7)) == Colors.White);
// Act
ant.MoveOn(board);
// Assert
Assert.Equal(PositionAt(10, 8), ant.Position);
}
[Fact]
public void AntTurnsLeftOnBlackSquare()
{
// Arrange
var ant = AntAt(10, 7);
var board = Mock.Of<Board>(b => b.ColorAt(PositionAt(10, 7)) == Colors.Black);
// Act
ant.MoveOn(board);
// Assert
Assert.Equal(PositionAt(10, 6), ant.Position);
}
private Ant AntAt(int row, int column)
{
return new Ant()
{
Position = new Position { Row = row, Column = column }
};
}
private Position PositionAt(int row, int column)
{
return new Position
{
Row = row, Column = column
};
}
}
}
| using System;
using Moq;
using Xunit;
namespace MarcinHoppe.LangtonsAnts.Tests
{
public class AntTests
{
[Fact]
public void AntTurnsRightOnWhiteSquare()
{
// Arrange
var ant = AntAt(10, 7);
var board = Mock.Of<Board>(b => b.ColorAt(PositionAt(10, 7)) == Colors.White);
// Act
ant.MoveOn(board);
// Assert
Assert.Equal(PositionAt(10, 8), ant.Position);
}
[Fact]
public void AndTurnsLeftOnBlackSquare()
{
// Arrange
var ant = AntAt(10, 7);
var board = Mock.Of<Board>(b => b.ColorAt(PositionAt(10, 7)) == Colors.Black);
// Act
ant.MoveOn(board);
// Assert
Assert.Equal(PositionAt(10, 6), ant.Position);
}
private Ant AntAt(int row, int column)
{
return new Ant()
{
Position = new Position { Row = row, Column = column }
};
}
private Position PositionAt(int row, int column)
{
return new Position
{
Row = row, Column = column
};
}
}
}
| mit | C# |
3116760deae98aa595dc9e0212356fd849149c0e | remove empty spaces | andrewconnell/aci-orchardcms,andrewconnell/aci-orchardcms,andrewconnell/aci-orchardcms,andrewconnell/aci-orchardcms | Themes/AndrewConnell-v1.0/Views/Document.cshtml | Themes/AndrewConnell-v1.0/Views/Document.cshtml | @using Orchard.Mvc.Html;
@using Orchard.UI.Resources;
@{
Script.Include("html5.js").UseCondition("lt IE 9").AtHead();
string title = Convert.ToString(Model.Title);
string siteName = "Andrew Connell";
string openGraphLogo = string.Format("http://www.andrewconnell.com{0}", Url.Content(Html.ThemePath(WorkContext.CurrentTheme, "/Images/logo-openGraph.png")));
string openGraphTitle = "AC's Blog";
if (!string.IsNullOrEmpty(title)) {
openGraphTitle = string.Format("{0}: {1}", openGraphTitle, title);
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@Html.Title(title, siteName)</title>
<meta property="og:site_name" content="@siteName" />
<meta property="og:title" content="@openGraphTitle" />
<meta property="og:image" content="@openGraphLogo" />
<meta property="og:url" content="@Request.Url.AbsoluteUri" />
<meta property="og:type" content="website" />
<!-- jquery -->
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<!-- /jquery -->
<!-- bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- /bootstrap -->
@Display(Model.Head)
<link rel="alternate" type="application/rss+xml" title="Andrew Connell's Blog'" href="http://feeds.andrewconnell.com/AndrewConnell" />
<script type="text/javascript" src="@Url.Content(Html.ThemePath(WorkContext.CurrentTheme, "/Scripts/jquery.main.min.js"))"></script>
<!-- shareasale affiliate code for pluralsight -->
<!-- 8D81DB7B-5333-41DC-8A79-8EAF72456112 -->
</head>
<body>
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>
@{
var timezone = WorkContext.CurrentTimeZone;
var timestamp = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timezone);
}<!-- page generated at @(timestamp.ToShortDateString()) @(timestamp.ToLongTimeString()) -->
| @using Orchard.Mvc.Html;
@using Orchard.UI.Resources;
@{
Script.Include("html5.js").UseCondition("lt IE 9").AtHead();
string title = Convert.ToString(Model.Title);
string siteName = "Andrew Connell";
string openGraphLogo = string.Format("http://www.andrewconnell.com{0}", Url.Content(Html.ThemePath(WorkContext.CurrentTheme, "/Images/logo-openGraph.png")));
string openGraphTitle = "AC's Blog";
if (!string.IsNullOrEmpty(title)) {
openGraphTitle = string.Format("{0}: {1}", openGraphTitle, title);
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@Html.Title(title, siteName)</title>
<meta property="og:site_name" content="@siteName" />
<meta property="og:title" content="@openGraphTitle" />
<meta property="og:image" content="@openGraphLogo" />
<meta property="og:url" content="@Request.Url.AbsoluteUri" />
<meta property="og:type" content="website" />
<!-- jquery -->
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<!-- /jquery -->
<!-- bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- /bootstrap -->
@Display(Model.Head)
<link rel="alternate" type="application/rss+xml" title="Andrew Connell's Blog'" href="http://feeds.andrewconnell.com/AndrewConnell" />
<script type="text/javascript" src="@Url.Content(Html.ThemePath(WorkContext.CurrentTheme, "/Scripts/jquery.main.min.js"))"></script>
<!-- shareasale affiliate code for pluralsight -->
<!-- 8D81DB7B-5333-41DC-8A79-8EAF72456112 -->
</head>
<body>
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>
@{
var timezone = WorkContext.CurrentTimeZone;
var timestamp = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timezone);
}<!-- page generated at @(timestamp.ToShortDateString()) @(timestamp.ToLongTimeString()) -->
| bsd-3-clause | C# |
b966fb3dd3d862664de28e0db8b473225d6ac35e | fix taghelper name | leastprivilege/ndcoslo2016,leastprivilege/ndcoslo2016,leastprivilege/ndcoslo2016 | IdentityServerStart/src/IdentityServerStart/UI/_ViewImports.cshtml | IdentityServerStart/src/IdentityServerStart/UI/_ViewImports.cshtml | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, IdentityServerStart
| @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, IdentityServer
| apache-2.0 | C# |
45d66ff70285830bb533eada0add8a6c2999cb57 | Change version to 2.3.1. | shintadono/dockpanelsuite,modulexcite/O2_Fork_dockpanelsuite,dockpanelsuite/dockpanelsuite,elnomade/dockpanelsuite,compborg/dockpanelsuite,ArsenShnurkov/dockpanelsuite,15070217668/dockpanelsuite,transistor1/dockpanelsuite,joelbyren/dockpanelsuite,thijse/dockpanelsuite,RadarNyan/dockpanelsuite,jorik041/dockpanelsuite,rohitlodha/dockpanelsuite,angelapper/dockpanelsuite,xo-energy/dockpanelsuite,15070217668/dockpanelsuite,Romout/dockpanelsuite | WinFormsUI/Properties/AssemblyInfo.cs | WinFormsUI/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
[assembly: AssemblyTitle("DockPanel Suite for .Net 2.0")]
[assembly: AssemblyDescription(".Net Docking Library for Windows Forms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weifen Luo")]
[assembly: AssemblyProduct("DockPanel Suite")]
[assembly: AssemblyCopyright("Copyright © Weifen Luo 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")]
[assembly: AssemblyVersion("2.3.1.*")]
[assembly: AssemblyFileVersion("2.3.1.0")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")] | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
[assembly: AssemblyTitle("DockPanel Suite for .Net 2.0")]
[assembly: AssemblyDescription(".Net Docking Library for Windows Forms")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weifen Luo")]
[assembly: AssemblyProduct("DockPanel Suite")]
[assembly: AssemblyCopyright("Copyright © Weifen Luo 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
[assembly: ComVisible(false)]
[assembly: Guid("9d690ef9-ce19-4c69-874c-e24d8eb36aff")]
[assembly: AssemblyVersion("2.3.*")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "WeifenLuo.WinFormsUI.Docking", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Weifen")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Luo")]
[module: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", Scope = "resource", Target = "WeifenLuo.WinFormsUI.Docking.Strings.resources", MessageId = "Dockable")] | mit | C# |
c15fc6a13efbca0d66e5a8d18812ac70d03f28a1 | Set Default Language (#243) | FormsCommunityToolkit/FormsCommunityToolkit | XamarinCommunityToolkitSample/AssemblyInfo.cs | XamarinCommunityToolkitSample/AssemblyInfo.cs | using System.Resources;
using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
[assembly: NeutralResourcesLanguage("en")]
| using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)] | mit | C# |
45232902e029268c7f7fd96df4ad6d8e8bd9d686 | Disable parallel execution for tests | vadimzozulya/FakeHttpContext | src/FakeHttpContext.Tests/Properties/AssemblyInfo.cs | src/FakeHttpContext.Tests/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
// 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("FakeHttpContext.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FakeHttpContext.Tests")]
[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("bdcb2164-56db-4f8c-8e7d-58c36a7408ca")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.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("FakeHttpContext.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FakeHttpContext.Tests")]
[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("bdcb2164-56db-4f8c-8e7d-58c36a7408ca")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
0bbaddd489be805147ec5a5e63c1a25b4ceff1e8 | Remove unused extension method | jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,dotnet/roslyn,bartdesmet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn | src/Features/Core/Portable/DocumentSpanExtensions.cs | src/Features/Core/Portable/DocumentSpanExtensions.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Navigation;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis
{
internal static class DocumentSpanExtensions
{
private static (Workspace workspace, IDocumentNavigationService service) GetNavigationParts(DocumentSpan documentSpan)
{
var solution = documentSpan.Document.Project.Solution;
var workspace = solution.Workspace;
var service = workspace.Services.GetRequiredService<IDocumentNavigationService>();
return (workspace, service);
}
public static Task<INavigableLocation?> GetNavigableLocationAsync(this DocumentSpan documentSpan, CancellationToken cancellationToken)
{
var (workspace, service) = GetNavigationParts(documentSpan);
return service.GetLocationForSpanAsync(workspace, documentSpan.Document.Id, documentSpan.SourceSpan, allowInvalidSpan: false, cancellationToken);
}
public static async Task<bool> IsHiddenAsync(
this DocumentSpan documentSpan, CancellationToken cancellationToken)
{
var document = documentSpan.Document;
if (document.SupportsSyntaxTree)
{
var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
return tree.IsHiddenPosition(documentSpan.SourceSpan.Start, cancellationToken);
}
return false;
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Navigation;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis
{
internal static class DocumentSpanExtensions
{
public static Task<bool> CanNavigateToAsync(this DocumentSpan documentSpan, CancellationToken cancellationToken)
{
var workspace = documentSpan.Document.Project.Solution.Workspace;
var service = workspace.Services.GetRequiredService<IDocumentNavigationService>();
return service.CanNavigateToSpanAsync(workspace, documentSpan.Document.Id, documentSpan.SourceSpan, cancellationToken);
}
private static (Workspace workspace, IDocumentNavigationService service) GetNavigationParts(DocumentSpan documentSpan)
{
var solution = documentSpan.Document.Project.Solution;
var workspace = solution.Workspace;
var service = workspace.Services.GetRequiredService<IDocumentNavigationService>();
return (workspace, service);
}
public static Task<INavigableLocation?> GetNavigableLocationAsync(this DocumentSpan documentSpan, CancellationToken cancellationToken)
{
var (workspace, service) = GetNavigationParts(documentSpan);
return service.GetLocationForSpanAsync(workspace, documentSpan.Document.Id, documentSpan.SourceSpan, allowInvalidSpan: false, cancellationToken);
}
public static async Task<bool> IsHiddenAsync(
this DocumentSpan documentSpan, CancellationToken cancellationToken)
{
var document = documentSpan.Document;
if (document.SupportsSyntaxTree)
{
var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
return tree.IsHiddenPosition(documentSpan.SourceSpan.Start, cancellationToken);
}
return false;
}
}
}
| mit | C# |
35c90d12f6a70d504051012143274ab54121166c | Convert RssFeedResult to async (#741) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.WebCore/Infrastructure/RssFeedResult.cs | src/Firehose.WebCore/Infrastructure/RssFeedResult.cs | using Microsoft.AspNetCore.Mvc;
using System.ServiceModel.Syndication;
using System.Xml;
namespace Firehose.Web.Infrastructure
{
public class RssFeedResult : ActionResult
{
private readonly SyndicationFeed _feed;
public RssFeedResult(SyndicationFeed feed)
{
_feed = feed;
}
public async override Task ExecuteResultAsync(ActionContext context)
{
context.HttpContext.Response.ContentType = "application/rss+xml";
var rssFormatter = new Rss20FeedFormatter(_feed);
using (var writer = XmlWriter.Create(context.HttpContext.Response.Body))
{
rssFormatter.WriteTo(writer);
await writer.FlushAsync();
}
}
}
}
| using Microsoft.AspNetCore.Mvc;
using System.ServiceModel.Syndication;
using System.Xml;
namespace Firehose.Web.Infrastructure
{
public class RssFeedResult : ActionResult
{
private readonly SyndicationFeed _feed;
public RssFeedResult(SyndicationFeed feed)
{
_feed = feed;
}
public override void ExecuteResult(ActionContext context)
{
context.HttpContext.Response.ContentType = "application/rss+xml";
var rssFormatter = new Rss20FeedFormatter(_feed);
using (var writer = XmlWriter.Create(context.HttpContext.Response.Body))
{
rssFormatter.WriteTo(writer);
}
}
}
}
| mit | C# |
8a2a4d98758427e6f6608baa31d352c9ae82a664 | set version to 0.1 | SimonJonas/SqlServerValidationToolkit | SqlServerValidationToolkit.Configurator/Properties/AssemblyInfo.cs | SqlServerValidationToolkit.Configurator/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("SqlServerValidationToolkit.Configurator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SqlServerValidationToolkit.Configurator")]
[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)]
//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.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| 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("SqlServerValidationToolkit.Configurator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SqlServerValidationToolkit.Configurator")]
[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)]
//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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
e4a27ef30ca585876d5f1e885bcc2d81f251b95e | change partition | LykkeCity/bitcoinservice,LykkeCity/bitcoinservice | src/AzureRepositories/Assets/AssetSettingRepository.cs | src/AzureRepositories/Assets/AssetSettingRepository.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using AzureStorage;
using Core.Repositories.Assets;
using Microsoft.WindowsAzure.Storage.Table;
namespace AzureRepositories.Assets
{
public class AssetSettingEntity : BaseEntity, IAssetSetting
{
public static string GeneratePartitionKey()
{
return "Asset";
}
public string Asset => RowKey;
public string HotWallet { get; set; }
public decimal CashinCoef { get; set; }
public decimal Dust { get; set; }
public int MaxOutputsCountInTx { get; set; }
public decimal MinBalance { get; set; }
public decimal OutputSize { get; set; }
public int MinOutputsCount { get; set; }
public int MaxOutputsCount { get; set; }
}
public class AssetSettingRepository : IAssetSettingRepository
{
private readonly INoSQLTableStorage<AssetSettingEntity> _table;
public AssetSettingRepository(INoSQLTableStorage<AssetSettingEntity> table)
{
_table = table;
}
public async Task<IEnumerable<IAssetSetting>> GetAssetSettings()
{
return await _table.GetDataAsync(AssetSettingEntity.GeneratePartitionKey());
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using AzureStorage;
using Core.Repositories.Assets;
using Microsoft.WindowsAzure.Storage.Table;
namespace AzureRepositories.Assets
{
public class AssetSettingEntity : BaseEntity, IAssetSetting
{
public static string GeneratePartitionKey()
{
return "BitcoinAsset";
}
public string Asset => RowKey;
public string HotWallet { get; set; }
public decimal CashinCoef { get; set; }
public decimal Dust { get; set; }
public int MaxOutputsCountInTx { get; set; }
public decimal MinBalance { get; set; }
public decimal OutputSize { get; set; }
public int MinOutputsCount { get; set; }
public int MaxOutputsCount { get; set; }
}
public class AssetSettingRepository : IAssetSettingRepository
{
private readonly INoSQLTableStorage<AssetSettingEntity> _table;
public AssetSettingRepository(INoSQLTableStorage<AssetSettingEntity> table)
{
_table = table;
}
public async Task<IEnumerable<IAssetSetting>> GetAssetSettings()
{
return await _table.GetDataAsync(AssetSettingEntity.GeneratePartitionKey());
}
}
}
| mit | C# |
9db52fac7a27e67967f90e438a586e40d8caaec7 | Update EmailTokenProvider.cs | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Identity/Extensions.Core/src/EmailTokenProvider.cs | src/Identity/Extensions.Core/src/EmailTokenProvider.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Identity
{
/// <summary>
/// TokenProvider that generates tokens from the user's security stamp and notifies a user via email.
/// </summary>
/// <typeparam name="TUser">The type used to represent a user.</typeparam>
public class EmailTokenProvider<TUser> : TotpSecurityStampBasedTokenProvider<TUser>
where TUser : class
{
/// <summary>
/// Checks if a two-factor authentication token can be generated for the specified <paramref name="user"/>.
/// </summary>
/// <param name="manager">The <see cref="UserManager{TUser}"/> to retrieve the <paramref name="user"/> from.</param>
/// <param name="user">The <typeparamref name="TUser"/> to check for the possibility of generating a two-factor authentication token.</param>
/// <returns>True if the user has an email address set, otherwise false.</returns>
public override async Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<TUser> manager, TUser user)
{
var email = await manager.GetEmailAsync(user);
return !string.IsNullOrWhiteSpace(email) && await manager.IsEmailConfirmedAsync(user);
}
/// <summary>
/// Returns the a value for the user used as entropy in the generated token.
/// </summary>
/// <param name="purpose">The purpose of the two-factor authentication token.</param>
/// <param name="manager">The <see cref="UserManager{TUser}"/> to retrieve the <paramref name="user"/> from.</param>
/// <param name="user">The <typeparamref name="TUser"/> to check for the possibility of generating a two-factor authentication token.</param>
/// <returns>A string suitable for use as entropy in token generation.</returns>
public override async Task<string> GetUserModifierAsync(string purpose, UserManager<TUser> manager,
TUser user)
{
var email = await manager.GetEmailAsync(user);
return $"Email:{purpose}:{email}";
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Identity
{
/// <summary>
/// TokenProvider that generates tokens from the user's security stamp and notifies a user via email.
/// </summary>
/// <typeparam name="TUser">The type used to represent a user.</typeparam>
public class EmailTokenProvider<TUser> : TotpSecurityStampBasedTokenProvider<TUser>
where TUser : class
{
/// <summary>
/// Checks if a two-factor authentication token can be generated for the specified <paramref name="user"/>.
/// </summary>
/// <param name="manager">The <see cref="UserManager{TUser}"/> to retrieve the <paramref name="user"/> from.</param>
/// <param name="user">The <typeparamref name="TUser"/> to check for the possibility of generating a two-factor authentication token.</param>
/// <returns>True if the user has an email address set, otherwise false.</returns>
public override async Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<TUser> manager, TUser user)
{
var email = await manager.GetEmailAsync(user);
return !string.IsNullOrWhiteSpace(email) && await manager.IsEmailConfirmedAsync(user);
}
/// <summary>
/// Returns the a value for the user used as entropy in the generated token.
/// </summary>
/// <param name="purpose">The purpose of the two-factor authentication token.</param>
/// <param name="manager">The <see cref="UserManager{TUser}"/> to retrieve the <paramref name="user"/> from.</param>
/// <param name="user">The <typeparamref name="TUser"/> to check for the possibility of generating a two-factor authentication token.</param>
/// <returns>A string suitable for use as entropy in token generation.</returns>
public override async Task<string> GetUserModifierAsync(string purpose, UserManager<TUser> manager,
TUser user)
{
var email = await manager.GetEmailAsync(user);
return $"{Email}:{purpose}:{email}";
}
}
}
| apache-2.0 | C# |
72c8e2b48a78bcd8a725a09dde186ae469fd6e89 | include ⏬ in the link for ird files | RPCS3/discord-bot | CompatBot/Utils/ResultFormatters/IrdSearchResultFormattercs.cs | CompatBot/Utils/ResultFormatters/IrdSearchResultFormattercs.cs | using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;
namespace CompatBot.Utils.ResultFormatters
{
public static class IrdSearchResultFormattercs
{
public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
{
var result = new DiscordEmbedBuilder
{
//Title = "IRD Library Search Result",
Color = Config.Colors.DownloadLinks,
};
if (searchResult.Data.Count == 0)
{
result.Color = Config.Colors.LogResultFailed;
result.Description = "No matches were found";
return result;
}
foreach (var item in searchResult.Data)
{
var parts = item.Filename?.Split('-');
if (parts == null)
parts = new string[] {null, null};
else if (parts.Length == 1)
parts = new[] {null, item.Filename};
result.AddField(
$"[{parts?[0]} v{item.GameVersion}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
$"[⏬ `{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)}) [ℹ Info]({IrdClient.GetInfoLink(item.Filename)})"
);
}
return result;
}
}
}
| using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;
namespace CompatBot.Utils.ResultFormatters
{
public static class IrdSearchResultFormattercs
{
public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
{
var result = new DiscordEmbedBuilder
{
//Title = "IRD Library Search Result",
Color = Config.Colors.DownloadLinks,
};
if (searchResult.Data.Count == 0)
{
result.Color = Config.Colors.LogResultFailed;
result.Description = "No matches were found";
return result;
}
foreach (var item in searchResult.Data)
{
var parts = item.Filename?.Split('-');
if (parts == null)
parts = new string[] {null, null};
else if (parts.Length == 1)
parts = new[] {null, item.Filename};
result.AddField(
$"[{parts?[0]} v{item.GameVersion}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
$"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)}) ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
);
}
return result;
}
}
}
| lgpl-2.1 | C# |
db1458eb778e5c40fcc5f74a22c513a60a901734 | Rename UseLegacyLocationArea to HideCity | seekasia-oss/jobstreet-ad-posting-api-client | src/SEEK.AdPostingApi.Client/Models/LocationOptions.cs | src/SEEK.AdPostingApi.Client/Models/LocationOptions.cs | namespace SEEK.AdPostingApi.Client.Models
{
public enum LocationOptions
{
HideCity = 1
}
} | namespace SEEK.AdPostingApi.Client.Models
{
public enum LocationOptions
{
UseLegacyLocationArea = 1
}
} | mit | C# |
ad421dfd26400237cf00efb1fa71ce994efc557c | Use the working directory as the installation folder for the InstallCommand. | mdavid/nuget,mdavid/nuget | src/CommandLine/Commands/InstallCommand.cs | src/CommandLine/Commands/InstallCommand.cs | using System;
using System.ComponentModel.Composition;
using System.IO;
using NuGet.Common;
namespace NuGet.Commands {
[Command(typeof(NuGetResources), "install", "InstallCommandDescription", AltName = "i",
MinArgs = 1, MaxArgs = 1,
UsageSummaryResourceName = "InstallCommandUsageSummary", UsageDescriptionResourceName = "InstallCommandUsageDescription")]
public class InstallCommand : Command {
private const string _defaultFeedUrl = ListCommand._defaultFeedUrl;
[Option(typeof(NuGetResources), "InstallCommandSourceDescription", AltName = "s")]
public string Source { get; set; }
[Option(typeof(NuGetResources), "InstallCommandVersionDescription", AltName = "v")]
public string Version { get; set; }
public IPackageRepositoryFactory RepositoryFactory { get; private set; }
[ImportingConstructor]
public InstallCommand(IPackageRepositoryFactory packageRepositoryFactory) {
if (packageRepositoryFactory == null) {
throw new ArgumentNullException("packageRepositoryFactory");
}
RepositoryFactory = packageRepositoryFactory;
}
public override void ExecuteCommand() {
var feedUrl = _defaultFeedUrl;
if (!String.IsNullOrEmpty(Source)) {
feedUrl = Source;
}
IPackageRepository packageRepository = RepositoryFactory.CreateRepository(new PackageSource(feedUrl));
var packageManager = new PackageManager(packageRepository, Directory.GetCurrentDirectory());
packageManager.Logger = new Logger { Console = Console };
string packageId = Arguments[0];
Version version = Version != null ? new Version(Version) : null;
packageManager.InstallPackage(packageId, version);
}
private class Logger : ILogger {
public IConsole Console { get; set; }
public void Log(MessageLevel level, string message, params object[] args) {
Console.WriteLine(message, args);
}
}
}
}
| using System;
using System.ComponentModel.Composition;
using NuGet.Common;
namespace NuGet.Commands {
[Command(typeof(NuGetResources), "install", "InstallCommandDescription", AltName = "i",
MinArgs = 1, MaxArgs = 1,
UsageSummaryResourceName = "InstallCommandUsageSummary", UsageDescriptionResourceName = "InstallCommandUsageDescription")]
public class InstallCommand : Command {
private const string _defaultFeedUrl = ListCommand._defaultFeedUrl;
[Option(typeof(NuGetResources), "InstallCommandSourceDescription", AltName = "s")]
public string Source { get; set; }
[Option(typeof(NuGetResources), "InstallCommandVersionDescription", AltName = "v")]
public string Version { get; set; }
public IPackageRepositoryFactory RepositoryFactory { get; private set; }
[ImportingConstructor]
public InstallCommand(IPackageRepositoryFactory packageRepositoryFactory) {
if (packageRepositoryFactory == null) {
throw new ArgumentNullException("packageRepositoryFactory");
}
RepositoryFactory = packageRepositoryFactory;
}
public override void ExecuteCommand() {
var feedUrl = _defaultFeedUrl;
if (!String.IsNullOrEmpty(Source)) {
feedUrl = Source;
}
IPackageRepository packageRepository = RepositoryFactory.CreateRepository(new PackageSource(feedUrl));
var packageManager = new PackageManager(packageRepository, "packages");
packageManager.Logger = new Logger { Console = Console };
string packageId = Arguments[0];
Version version = Version != null ? new Version(Version) : null;
packageManager.InstallPackage(packageId, version);
}
private class Logger : ILogger {
public IConsole Console { get; set; }
public void Log(MessageLevel level, string message, params object[] args) {
Console.WriteLine(message, args);
}
}
}
}
| apache-2.0 | C# |
5776676e664545f03e36398aa7ed6420509d3302 | Allow synchronous IO | mchaloupka/EVI-SampleServer,mchaloupka/DotNetR2RMLEndpoint,mchaloupka/EVI-SampleServer,mchaloupka/DotNetR2RMLEndpoint | src/Slp.Evi.Endpoint/Startup.cs | src/Slp.Evi.Endpoint/Startup.cs | using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Slp.Evi.Endpoint.Sparql;
namespace Slp.Evi.Endpoint
{
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.AddControllers();
services.AddSingleton<IStorageWrapper, StorageWrapper>();
services.Configure<StorageConfiguration>(Configuration.GetSection("Storage"));
services.Configure<KestrelServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
services.Configure<IISServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
| using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Slp.Evi.Endpoint.Sparql;
namespace Slp.Evi.Endpoint
{
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.AddControllers();
services.AddSingleton<IStorageWrapper, StorageWrapper>();
services.Configure<StorageConfiguration>(Configuration.GetSection("Storage"));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.