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 |
|---|---|---|---|---|---|---|---|---|
be4058a85184d5cd798ea6f887e9d22ca003a8a7
|
Use <see> in docs.
|
Faithlife/Parsing
|
src/Faithlife.Parsing/Parser.cs
|
src/Faithlife.Parsing/Parser.cs
|
namespace Faithlife.Parsing;
/// <summary>
/// Helper methods for creating and executing parsers.
/// </summary>
public static partial class Parser
{
/// <summary>
/// Creates a parser from a delegate.
/// </summary>
public static IParser<T> Create<T>(Func<TextPosition, IParseResult<T>> parse) => new SimpleParser<T>(parse);
/// <summary>
/// Attempts to parse the specified text.
/// </summary>
public static IParseResult<T> TryParse<T>(this IParser<T> parser, string text) => parser.TryParse(text, 0);
/// <summary>
/// Attempts to parse the specified text at the specified start index.
/// </summary>
public static IParseResult<T> TryParse<T>(this IParser<T> parser, string text, int startIndex) => parser.TryParse(new TextPosition(text, startIndex));
/// <summary>
/// Parses the specified text, throwing <see cref="ParseException" /> on failure.
/// </summary>
public static T Parse<T>(this IParser<T> parser, string text) => parser.Parse(text, 0);
/// <summary>
/// Parses the specified text at the specified start index, throwing <see cref="ParseException" /> on failure.
/// </summary>
public static T Parse<T>(this IParser<T> parser, string text, int startIndex) => parser.TryParse(text, startIndex).Value;
private sealed class SimpleParser<T> : IParser<T>
{
public SimpleParser(Func<TextPosition, IParseResult<T>> parse)
{
m_parse = parse;
}
public IParseResult<T> TryParse(TextPosition position) => m_parse(position);
private readonly Func<TextPosition, IParseResult<T>> m_parse;
}
}
|
namespace Faithlife.Parsing;
/// <summary>
/// Helper methods for creating and executing parsers.
/// </summary>
public static partial class Parser
{
/// <summary>
/// Creates a parser from a delegate.
/// </summary>
public static IParser<T> Create<T>(Func<TextPosition, IParseResult<T>> parse) => new SimpleParser<T>(parse);
/// <summary>
/// Attempts to parse the specified text.
/// </summary>
public static IParseResult<T> TryParse<T>(this IParser<T> parser, string text) => parser.TryParse(text, 0);
/// <summary>
/// Attempts to parse the specified text at the specified start index.
/// </summary>
public static IParseResult<T> TryParse<T>(this IParser<T> parser, string text, int startIndex) => parser.TryParse(new TextPosition(text, startIndex));
/// <summary>
/// Parses the specified text, throwing ParseException on failure.
/// </summary>
public static T Parse<T>(this IParser<T> parser, string text) => parser.Parse(text, 0);
/// <summary>
/// Parses the specified text at the specified start index, throwing ParseException on failure.
/// </summary>
public static T Parse<T>(this IParser<T> parser, string text, int startIndex) => parser.TryParse(text, startIndex).Value;
private sealed class SimpleParser<T> : IParser<T>
{
public SimpleParser(Func<TextPosition, IParseResult<T>> parse)
{
m_parse = parse;
}
public IParseResult<T> TryParse(TextPosition position) => m_parse(position);
private readonly Func<TextPosition, IParseResult<T>> m_parse;
}
}
|
mit
|
C#
|
7b4e5519a5d1d5faa3bad6d9ea91417a7f10c24a
|
Update JesseLiberty.cs (#745)
|
planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
|
src/Firehose.Web/Authors/JesseLiberty.cs
|
src/Firehose.Web/Authors/JesseLiberty.cs
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JesseLiberty : IAmACommunityMember
{
public string FirstName => "Jesse";
public string LastName => "Liberty";
public string ShortBioOrTagLine => "See http://jesseliberty.com";
public string StateOrRegion => "Massachusetts";
public string EmailAddress => "jesseliberty@gmail.com";
public string TwitterHandle => "jesseliberty";
public string GravatarHash => "78d5b6609fe5a80ce67e9f971833a6c3";
public string GitHubHandle => "JesseLiberty";
public GeoPosition Position => new GeoPosition(42.4703963,-71.4477468);
public Uri WebSite => new Uri("http://jesseliberty.me");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://feeds.feedburner.com/JesseLiberty-SilverlightGeek"); } }
public string FeedLanguageCode => "en";
}
}
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JesseLiberty : IAmACommunityMember
{
public string FirstName => "Jesse";
public string LastName => "Liberty";
public string ShortBioOrTagLine => "See http://jesseliberty.me";
public string StateOrRegion => "Massachusetts";
public string EmailAddress => "jesseliberty@gmail.com";
public string TwitterHandle => "jesseliberty";
public string GravatarHash => "78d5b6609fe5a80ce67e9f971833a6c3";
public string GitHubHandle => "JesseLiberty";
public GeoPosition Position => new GeoPosition(42.4703963,-71.4477468);
public Uri WebSite => new Uri("http://jesseliberty.me");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://feeds.feedburner.com/JesseLiberty-SilverlightGeek"); } }
public string FeedLanguageCode => "en";
}
}
|
mit
|
C#
|
427b99f37869130c1876be8f2fdede1eadb3f674
|
Update ThomasRayner.cs
|
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
|
src/Firehose.Web/Authors/ThomasRayner.cs
|
src/Firehose.Web/Authors/ThomasRayner.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ThomasRayner : IAmAMicrosoftMVP
{
public string FirstName => "Thomas";
public string LastName => "Rayner";
public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft";
public string StateOrRegion => "Canada";
public string EmailAddress => "thmsrynr@outlook.com";
public string TwitterHandle => "MrThomasRayner";
public string GitHubHandle => "ThmsRynr";
public string GravatarHash => "";
public GeoPosition Position => new GeoPosition(53.5443890, -113.4909270);
public Uri WebSite => new Uri("https://thomasrayner.ca");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ThomasRayner : IAmAMicrosoftMVP
{
public string FirstName => "Thomas";
public string LastName => "Rayner";
public string ShortBioOrTagLine => "Microsoft MVP - Cloud & Datacenter Management";
public string StateOrRegion => "Canada";
public string EmailAddress => "thmsrynr@outlook.com";
public string TwitterHandle => "MrThomasRayner";
public string GitHubHandle => "ThmsRynr";
public string GravatarHash => "";
public GeoPosition Position => new GeoPosition(53.5443890, -113.4909270);
public Uri WebSite => new Uri("https://workingsysadmin.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://workingsysadmin.com/feed/"); } }
}
}
|
mit
|
C#
|
7361751f70512e6d70de080efd0a0297247b386f
|
Update DependencyConfiguration.cs
|
wmkDev/CiSampleNetCore,wmkDev/CiSampleNetCore,wmkDev/CiSampleNetCore
|
src/CiSampleNetCore/99-Common/CiSampleNetCore.Dependency/DependencyConfiguration.cs
|
src/CiSampleNetCore/99-Common/CiSampleNetCore.Dependency/DependencyConfiguration.cs
|
using CiSampleNetCore.Contracts;
using CiSampleNetCore.Data.EfContext;
using CiSampleNetCore.Services;
using Microsoft.Extensions.DependencyInjection;
namespace CiSampleNetCore.Dependency
{
public static class DependencyConfiguration
{
public static void ConfigureServices(this IServiceCollection services)
{
//services.AddDbContext<DataContext>();
//services.AddDbContext<DataContext>(options => options.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=TestDb;Trusted_Connection=True;"));
services.AddTransient<IDataContext, DataContext>();
services.AddTransient<ITodoService, TodoService>();
}
}
}
|
using System.Configuration;
using CiSampleNetCore.Contracts;
using CiSampleNetCore.Data.EfContext;
using CiSampleNetCore.Services;
using Microsoft.Extensions.DependencyInjection;
namespace CiSampleNetCore.Dependency
{
public static class DependencyConfiguration
{
public static void ConfigureServices(this IServiceCollection services)
{
//services.AddDbContext<DataContext>();
//services.AddDbContext<DataContext>(options => options.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=TestDb;Trusted_Connection=True;"));
services.AddTransient<IDataContext, DataContext>();
services.AddTransient<ITodoService, TodoService>();
}
}
}
|
mit
|
C#
|
4deb126f76439100253a0e07d3c93e5cc9002b53
|
Add task wrapping result helper
|
OrleansContrib/Orleankka,OrleansContrib/Orleankka
|
Source/Orleankka/ActorMessage.cs
|
Source/Orleankka/ActorMessage.cs
|
using System;
using System.Threading.Tasks;
using Orleans;
namespace Orleankka
{
using Meta;
/// <summary>
/// Base message interface for strongly typed actor messages
/// </summary>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
public interface ActorMessage<TActor> : Message where TActor : IActorGrain, IGrainWithStringKey
{}
/// <summary>
/// Base message interface for strongly typed actor messages which return results (ie queries)
/// </summary>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
/// <typeparam name="TResult">The type of the returned result</typeparam>
public interface ActorMessage<TActor, TResult> : ActorMessage<TActor>, Message<TResult> where TActor : IActorGrain, IGrainWithStringKey
{}
/// <summary>
/// Extension methods for working with strongly typed actor messages
/// </summary>
public static class ActorMessageExtensions
{
[Obsolete("Please use Result method")]
public static TResult Response<TActor, TResult>(this ActorMessage<TActor, TResult> message, TResult result)
where TActor : IActorGrain, IGrainWithStringKey => result;
/// <summary>
/// Helper method to use when building responses for strongly typed messages which return results.
/// If the type of returned result is changed in message declaration this will help catching it at compile time.
/// </summary>
/// <example>
/// <para>
/// class Query : ActorMessage<MyActor,int>{}
/// </para>
/// <para>
/// int On(Query x) => x.Result(42);
/// </para>
/// </example>
/// <param name="message">The strongly typed message</param>
/// <param name="result">The result to return</param>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
/// <typeparam name="TResult">The type of the returned result</typeparam>
/// <returns>The value passed to <paramref name="result"/> argument</returns>
public static TResult Result<TActor, TResult>(this ActorMessage<TActor, TResult> message, TResult result)
where TActor : IActorGrain, IGrainWithStringKey => result;
/// <summary>
/// Helper method to use when building task responses for strongly typed messages which return results.
/// If the type of returned result is changed in message declaration this will help catching it at compile time.
/// </summary>
/// <example>
/// <para>
/// class Query : ActorMessage<MyActor,int>{}
/// </para>
/// <para>
/// Task<object> On(Query x) => x.TaskResult(42);
/// </para>
/// </example>
/// <param name="message">The strongly typed message</param>
/// <param name="result">The result to return</param>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
/// <typeparam name="TResult">The type of the returned result</typeparam>
/// <returns>The value passed to <paramref name="result"/> argument wrapped in Task<object></returns>
public static Task<object> TaskResult<TActor, TResult>(this ActorMessage<TActor, TResult> message, TResult result)
where TActor : IActorGrain, IGrainWithStringKey => Task.FromResult<object>(result);
}
}
|
using System;
using System.Threading.Tasks;
using Orleans;
namespace Orleankka
{
using Meta;
/// <summary>
/// Base message interface for strongly typed actor messages
/// </summary>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
public interface ActorMessage<TActor> : Message where TActor : IActorGrain, IGrainWithStringKey
{}
/// <summary>
/// Base message interface for strongly typed actor messages which return results (ie queries)
/// </summary>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
/// <typeparam name="TResult">The type of the returned result</typeparam>
public interface ActorMessage<TActor, TResult> : ActorMessage<TActor>, Message<TResult> where TActor : IActorGrain, IGrainWithStringKey
{}
/// <summary>
/// Extension methods for working with strongly typed actor messages
/// </summary>
public static class ActorMessageExtensions
{
[Obsolete("Please use Result method")]
public static TResult Response<TActor, TResult>(this ActorMessage<TActor, TResult> message, TResult result)
where TActor : IActorGrain, IGrainWithStringKey => result;
/// <summary>
/// Helper method to use when building responses for strongly typed messages which return results.
/// If the type of returned result is changed in message declaration this will help catching it at compile time.
/// </summary>
/// <example>
/// <para>
/// class Query : ActorMessage<MyActor,int>{}
/// </para>
/// <para>
/// int On(Query x) => x.Result(42);
/// </para>
/// </example>
/// <param name="message">The strongly typed message</param>
/// <param name="result">The result to return</param>
/// <typeparam name="TActor">The type of the actor to which this message belongs</typeparam>
/// <typeparam name="TResult">The type of the returned result</typeparam>
/// <returns>The value passed to <paramref name="result"/> argument</returns>
public static TResult Result<TActor, TResult>(this ActorMessage<TActor, TResult> message, TResult result)
where TActor : IActorGrain, IGrainWithStringKey => result;
}
}
|
apache-2.0
|
C#
|
5729551691199b9f2ccd43f0a85984115736e56b
|
Update TrippleSum.cs
|
stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity
|
TechnologiesFundamentals/ProgrammingFundamentals/ArraysAndLists-Excercises/04.TrippleSum/04.TrippleSum/TrippleSum.cs
|
TechnologiesFundamentals/ProgrammingFundamentals/ArraysAndLists-Excercises/04.TrippleSum/04.TrippleSum/TrippleSum.cs
|
using System;
using System.Linq;
public class TrippleSum
{
public static void Main(string[] args)
{
int[] array = Console.ReadLine()
.Split(' ')
.Select(int.Parse).
ToArray();
bool hasFoundSum = false;
for (int i = 0; i < array.Length; i++)
{
for (int j = i + 1; j < array.Length; j++)
{
int sum = array[i] + array[j];
if (array.Contains(sum))
{
Console.WriteLine($"{array[i]} + {array[j]} == {sum}");
hasFoundSum = true;
break;
}
}
}
if (!hasFoundSum)
{
Console.WriteLine("No");
}
}
}
|
using System;
using System.Linq;
public class TrippleSum
{
public static void Main(string[] args)
{
int[] array = Console.ReadLine()
.Split(' ')
.Select(int.Parse).
ToArray();
bool hasFoundSum = false;
for (int i = 0; i < array.Length; i++)
{
for (int j = i + 1; j < array.Length; j++)
{
int sum = array[i] + array[j];
if (array.Contains(sum))
{
Console.WriteLine($"{array[i]} + {array[j]} == {sum}");
hasFoundSum = true;
}
}
}
if (!hasFoundSum)
{
Console.WriteLine("No");
}
}
}
|
mit
|
C#
|
93075fd8c018885f8cbf628655b2b80d86bbeb24
|
Add connection
|
Orationi/Master
|
Orationi.Master/Services/OrationiMasterService.cs
|
Orationi.Master/Services/OrationiMasterService.cs
|
using System.IO;
using System.ServiceModel;
using Orationi.CommunicationCore.Interfaces;
using Orationi.CommunicationCore.Model;
using Orationi.Master.Interfaces;
namespace Orationi.Master.Services
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class OrationiMasterService : IOrationiMasterService
{
private readonly IOrationiEngine _orationiEngine;
public OrationiMasterService(IOrationiEngine engine)
{
_orationiEngine = engine;
}
/// <summary>
/// Accept incoming connections from slaves.
/// </summary>
public SlaveConfiguration Connect()
{
string sessionId = OperationContext.Current.SessionId;
IOrationiSlaveCallback callback = OperationContext.Current.GetCallbackChannel<IOrationiSlaveCallback>();
_orationiEngine.AddSlaveConnection(sessionId, callback);
return new SlaveConfiguration()
{
Modules = new ModuleVersionItem[0]
}; //_orationiEngine.GetSlaveConfiguration(sessionId);
}
/// <summary>
/// Receive ping from slave.
/// </summary>
public void Ping()
{
_orationiEngine.Ping(OperationContext.Current.SessionId);
}
/// <summary>
/// Disconnectio slave.
/// </summary>
public void Disconnect()
{
_orationiEngine.RemoveSlaveConnection(OperationContext.Current.SessionId);
}
/// <summary>
/// Get stream of module package.
/// </summary>
/// <param name="moduleId">Module identifier.</param>
/// <returns><c>Stream</c> of package or error.</returns>
public Stream GetModule(int moduleId)
{
return _orationiEngine.GetModule(moduleId, OperationContext.Current.SessionId);
}
/// <summary>
/// Push message to orationi engine.
/// </summary>
/// <param name="message">Pushed message.</param>
public void PushMessage(PushedMessage message)
{
_orationiEngine.PushMessage(OperationContext.Current.SessionId, message);
}
}
}
|
using System.IO;
using System.ServiceModel;
using Orationi.CommunicationCore.Interfaces;
using Orationi.CommunicationCore.Model;
using Orationi.Master.Interfaces;
namespace Orationi.Master.Services
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class OrationiMasterService : IOrationiMasterService
{
private readonly IOrationiEngine _orationiEngine;
public OrationiMasterService(IOrationiEngine engine)
{
_orationiEngine = engine;
}
/// <summary>
/// Accept incoming connections from slaves.
/// </summary>
public SlaveConfiguration Connect()
{
string sessionId = OperationContext.Current.SessionId;
IOrationiSlaveCallback callback = OperationContext.Current.GetCallbackChannel<IOrationiSlaveCallback>();
//_orationiEngine.AddSlaveConnection(sessionId, callback);
return new SlaveConfiguration()
{
Modules = new ModuleVersionItem[0]
}; //_orationiEngine.GetSlaveConfiguration(sessionId);
}
/// <summary>
/// Receive ping from slave.
/// </summary>
public void Ping()
{
_orationiEngine.Ping(OperationContext.Current.SessionId);
}
/// <summary>
/// Disconnectio slave.
/// </summary>
public void Disconnect()
{
_orationiEngine.RemoveSlaveConnection(OperationContext.Current.SessionId);
}
/// <summary>
/// Get stream of module package.
/// </summary>
/// <param name="moduleId">Module identifier.</param>
/// <returns><c>Stream</c> of package or error.</returns>
public Stream GetModule(int moduleId)
{
return _orationiEngine.GetModule(moduleId, OperationContext.Current.SessionId);
}
/// <summary>
/// Push message to orationi engine.
/// </summary>
/// <param name="message">Pushed message.</param>
public void PushMessage(PushedMessage message)
{
_orationiEngine.PushMessage(OperationContext.Current.SessionId, message);
}
}
}
|
mit
|
C#
|
da13cec154b0fc6be23aec8783614c668b8ca09e
|
Change RSA_OAEP to RSA-OAEP.
|
bgold09/azure-sdk-for-net,jamestao/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,xindzhan/azure-sdk-for-net,pinwang81/azure-sdk-for-net,atpham256/azure-sdk-for-net,ailn/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,vladca/azure-sdk-for-net,hyonholee/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,tpeplow/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,pattipaka/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,abhing/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,hyonholee/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,AuxMon/azure-sdk-for-net,relmer/azure-sdk-for-net,dasha91/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,nemanja88/azure-sdk-for-net,smithab/azure-sdk-for-net,xindzhan/azure-sdk-for-net,pomortaz/azure-sdk-for-net,AuxMon/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,Nilambari/azure-sdk-for-net,abhing/azure-sdk-for-net,marcoippel/azure-sdk-for-net,samtoubia/azure-sdk-for-net,atpham256/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,begoldsm/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,pilor/azure-sdk-for-net,shutchings/azure-sdk-for-net,amarzavery/azure-sdk-for-net,jtlibing/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,juvchan/azure-sdk-for-net,herveyw/azure-sdk-for-net,guiling/azure-sdk-for-net,pilor/azure-sdk-for-net,scottrille/azure-sdk-for-net,mihymel/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,makhdumi/azure-sdk-for-net,juvchan/azure-sdk-for-net,ogail/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,robertla/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,vladca/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,nacaspi/azure-sdk-for-net,mabsimms/azure-sdk-for-net,shutchings/azure-sdk-for-net,oburlacu/azure-sdk-for-net,naveedaz/azure-sdk-for-net,zaevans/azure-sdk-for-net,oaastest/azure-sdk-for-net,AzCiS/azure-sdk-for-net,lygasch/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,jamestao/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,herveyw/azure-sdk-for-net,kagamsft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,makhdumi/azure-sdk-for-net,namratab/azure-sdk-for-net,akromm/azure-sdk-for-net,zaevans/azure-sdk-for-net,r22016/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,kagamsft/azure-sdk-for-net,rohmano/azure-sdk-for-net,pattipaka/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,peshen/azure-sdk-for-net,mabsimms/azure-sdk-for-net,akromm/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,olydis/azure-sdk-for-net,guiling/azure-sdk-for-net,scottrille/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,pilor/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,jamestao/azure-sdk-for-net,hyonholee/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,zaevans/azure-sdk-for-net,r22016/azure-sdk-for-net,pankajsn/azure-sdk-for-net,oaastest/azure-sdk-for-net,enavro/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,gubookgu/azure-sdk-for-net,pinwang81/azure-sdk-for-net,olydis/azure-sdk-for-net,pattipaka/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,marcoippel/azure-sdk-for-net,markcowl/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ailn/azure-sdk-for-net,pomortaz/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,shipram/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,alextolp/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hovsepm/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,jtlibing/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,guiling/azure-sdk-for-net,herveyw/azure-sdk-for-net,djyou/azure-sdk-for-net,vladca/azure-sdk-for-net,begoldsm/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,begoldsm/azure-sdk-for-net,olydis/azure-sdk-for-net,samtoubia/azure-sdk-for-net,hyonholee/azure-sdk-for-net,relmer/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,samtoubia/azure-sdk-for-net,enavro/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,btasdoven/azure-sdk-for-net,naveedaz/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,namratab/azure-sdk-for-net,makhdumi/azure-sdk-for-net,xindzhan/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,dominiqa/azure-sdk-for-net,kagamsft/azure-sdk-for-net,djyou/azure-sdk-for-net,djyou/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,shuagarw/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,mabsimms/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,shipram/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,Nilambari/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,cwickham3/azure-sdk-for-net,AzCiS/azure-sdk-for-net,akromm/azure-sdk-for-net,dasha91/azure-sdk-for-net,ogail/azure-sdk-for-net,oburlacu/azure-sdk-for-net,mihymel/azure-sdk-for-net,dominiqa/azure-sdk-for-net,yoreddy/azure-sdk-for-net,nemanja88/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,mihymel/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,robertla/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,nathannfan/azure-sdk-for-net,smithab/azure-sdk-for-net,shipram/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,oburlacu/azure-sdk-for-net,nemanja88/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,stankovski/azure-sdk-for-net,robertla/azure-sdk-for-net,shuagarw/azure-sdk-for-net,rohmano/azure-sdk-for-net,abhing/azure-sdk-for-net,nathannfan/azure-sdk-for-net,naveedaz/azure-sdk-for-net,rohmano/azure-sdk-for-net,atpham256/azure-sdk-for-net,scottrille/azure-sdk-for-net,r22016/azure-sdk-for-net,dominiqa/azure-sdk-for-net,relmer/azure-sdk-for-net,tpeplow/azure-sdk-for-net,pinwang81/azure-sdk-for-net,ailn/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,amarzavery/azure-sdk-for-net,pankajsn/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,marcoippel/azure-sdk-for-net,dasha91/azure-sdk-for-net,bgold09/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,cwickham3/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,nacaspi/azure-sdk-for-net,bgold09/azure-sdk-for-net,lygasch/azure-sdk-for-net,btasdoven/azure-sdk-for-net,hyonholee/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jtlibing/azure-sdk-for-net,pankajsn/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,gubookgu/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,alextolp/azure-sdk-for-net,peshen/azure-sdk-for-net,yoreddy/azure-sdk-for-net,yoreddy/azure-sdk-for-net,peshen/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,amarzavery/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,oaastest/azure-sdk-for-net,enavro/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,stankovski/azure-sdk-for-net,samtoubia/azure-sdk-for-net,alextolp/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,hovsepm/azure-sdk-for-net,hovsepm/azure-sdk-for-net,shuagarw/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,AzCiS/azure-sdk-for-net,pomortaz/azure-sdk-for-net,shutchings/azure-sdk-for-net,nathannfan/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,lygasch/azure-sdk-for-net,juvchan/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,smithab/azure-sdk-for-net,gubookgu/azure-sdk-for-net,AuxMon/azure-sdk-for-net,tpeplow/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,Nilambari/azure-sdk-for-net,cwickham3/azure-sdk-for-net,jamestao/azure-sdk-for-net,ogail/azure-sdk-for-net,namratab/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net
|
src/KeyVault/Microsoft.Azure.KeyVault/WebKey/JsonWebKeyEncryptionAlgorithms.cs
|
src/KeyVault/Microsoft.Azure.KeyVault/WebKey/JsonWebKeyEncryptionAlgorithms.cs
|
//
// Copyright © Microsoft Corporation, All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.
namespace Microsoft.Azure.KeyVault.WebKey
{
/// <summary>
/// Supported JsonWebKey Algorithms
/// </summary>
public static class JsonWebKeyEncryptionAlgorithm
{
public const string RSAOAEP = "RSA-OAEP";
public const string RSA15 = "RSA1_5";
/// <summary>
/// All algorithms names. Use clone to avoid FxCop violation
/// </summary>
public static string[] AllAlgorithms
{
get { return (string[])_allAlgorithms.Clone(); }
}
private static readonly string[] _allAlgorithms = { RSA15, RSAOAEP };
}
}
|
//
// Copyright © Microsoft Corporation, All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.
namespace Microsoft.Azure.KeyVault.WebKey
{
/// <summary>
/// Supported JsonWebKey Algorithms
/// </summary>
public static class JsonWebKeyEncryptionAlgorithm
{
public const string RSAOAEP = "RSA_OAEP";
public const string RSA15 = "RSA1_5";
/// <summary>
/// All algorithms names. Use clone to avoid FxCop violation
/// </summary>
public static string[] AllAlgorithms
{
get { return (string[])_allAlgorithms.Clone(); }
}
private static readonly string[] _allAlgorithms = { RSA15, RSAOAEP };
}
}
|
apache-2.0
|
C#
|
a70512f5a2f8867c7b00f2a9f323a691bab73f94
|
Update LadderMove
|
bunashibu/kikan
|
Assets/Scripts/Movement/Behaviour/LadderMove.cs
|
Assets/Scripts/Movement/Behaviour/LadderMove.cs
|
using UnityEngine;
using System.Collections;
namespace Bunashibu.Kikan {
public class LadderMove {
public void FixedUpdate(Transform trans) {
if (_actFlag) {
trans.Translate(_direction * 0.04f);
_actFlag = false;
}
}
public void MoveUp() {
Move(Vector2.up);
}
public void MoveDown() {
Move(Vector2.down);
}
private void Move(Vector2 direction) {
_actFlag = true;
_direction = direction;
}
private bool _actFlag;
private Vector3 _direction;
}
}
|
using UnityEngine;
using System.Collections;
namespace Bunashibu.Kikan {
public class LadderMove {
public void FixedUpdate(Transform trans) {
if (_actFlag) {
trans.Translate(_inputVec * 0.04f);
_actFlag = false;
}
}
public void MoveUp() {
_actFlag = true;
_inputVec.y += 1;
if (_inputVec.y > 1)
_inputVec.y = 1;
}
public void MoveDown() {
_actFlag = true;
_inputVec.y -= 1;
if (_inputVec.y < -1)
_inputVec.y = -1;
}
private bool _actFlag;
private Vector3 _inputVec;
}
}
|
mit
|
C#
|
41913d5043a4872d0a6af3d43e6f119eb412a0b6
|
Add PropertyName to relationship to bring in line with attribute
|
joukevandermaas/saule,laurence79/saule,sergey-litvinov-work/saule,bjornharrtell/saule
|
Saule/ResourceRelationship.cs
|
Saule/ResourceRelationship.cs
|
namespace Saule
{
/// <summary>
/// Represents a related resource (to-one or to-many).
/// </summary>
public abstract class ResourceRelationship
{
/// <summary>
/// Initializes a new instance of the <see cref="ResourceRelationship"/> class.
/// </summary>
/// <param name="name">The name of the reference on the resource that defines the relationship.</param>
/// <param name="urlPath">
/// The url path of this relationship relative to the resource url that holds
/// the relationship.
/// </param>
/// <param name="kind">The kind of relationship.</param>
/// <param name="relationshipResource">The specification of the related resource.</param>
protected ResourceRelationship(
string name,
string urlPath,
RelationshipKind kind,
ApiResource relationshipResource)
{
Name = name.ToDashed();
PropertyName = name.ToPascalCase();
UrlPath = urlPath.ToDashed();
RelatedResource = relationshipResource;
Kind = kind;
}
/// <summary>
/// Gets the name of the relationship in dashed JSON API format.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the name of the relationship in PascalCase.
/// </summary>
public string PropertyName { get; }
/// <summary>
/// Gets the definition of the related resource
/// </summary>
public ApiResource RelatedResource { get; }
/// <summary>
/// Gets the pathspec of this relationship.
/// </summary>
public string UrlPath { get; }
/// <summary>
/// Gets the kind of relationship.
/// </summary>
public RelationshipKind Kind { get; }
}
}
|
namespace Saule
{
/// <summary>
/// Represents a related resource (to-one or to-many).
/// </summary>
public abstract class ResourceRelationship
{
/// <summary>
/// Initializes a new instance of the <see cref="ResourceRelationship"/> class.
/// </summary>
/// <param name="name">The name of the reference on the resource that defines the relationship.</param>
/// <param name="urlPath">
/// The url path of this relationship relative to the resource url that holds
/// the relationship.
/// </param>
/// <param name="kind">The kind of relationship.</param>
/// <param name="relationshipResource">The specification of the related resource.</param>
protected ResourceRelationship(
string name,
string urlPath,
RelationshipKind kind,
ApiResource relationshipResource)
{
Name = name.ToDashed();
UrlPath = urlPath.ToDashed();
RelatedResource = relationshipResource;
Kind = kind;
}
/// <summary>
/// Gets the name of this relationship.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the definition of the related resource
/// </summary>
public ApiResource RelatedResource { get; }
/// <summary>
/// Gets the pathspec of this relationship.
/// </summary>
public string UrlPath { get; }
/// <summary>
/// Gets the kind of relationship.
/// </summary>
public RelationshipKind Kind { get; }
}
}
|
mit
|
C#
|
033024b32f5a4499909fd9f18765fdba40a142f6
|
clear cookies each test run
|
OlegKleyman/AlphaDev,OlegKleyman/AlphaDev,OlegKleyman/AlphaDev
|
tests/integration/AlphaDev.Web.Tests.Integration/Features/WebFeatureFixture.cs
|
tests/integration/AlphaDev.Web.Tests.Integration/Features/WebFeatureFixture.cs
|
using System;
using AlphaDev.Web.Tests.Integration.Fixtures;
using LightBDD.XUnit2;
using Xunit;
using Xunit.Abstractions;
namespace AlphaDev.Web.Tests.Integration.Features
{
public class WebFeatureFixture : FeatureFixture, IClassFixture<DatabaseWebServerFixture>, IDisposable
{
protected const string FullDateFormatRegularExpression = @"\w+,\s\w+\s\d{2},\s\d{4}";
protected const string FullDateFormatString = "dddd, MMMM dd, yyyy";
private readonly WebServer _server;
protected WebFeatureFixture(ITestOutputHelper output, DatabaseWebServerFixture databaseWebServerFixture) :
base(output)
{
_server = databaseWebServerFixture.Server;
DatabasesFixture = databaseWebServerFixture.DatabasesFixture;
SiteTester = databaseWebServerFixture.SiteTester;
CommonSteps = new CommonSteps(SiteTester, DatabasesFixture);
SiteTester.Driver.Manage().Cookies.DeleteAllCookies();
}
protected DatabasesFixture DatabasesFixture { get; }
protected string Log => _server.Log;
public SiteTester SiteTester { get; }
public CommonSteps CommonSteps { get; }
public void Dispose()
{
DatabasesFixture.DatabaseManager.ResetDatabases();
_server.ClearLog();
}
}
}
|
using System;
using AlphaDev.Web.Tests.Integration.Fixtures;
using LightBDD.XUnit2;
using Xunit;
using Xunit.Abstractions;
namespace AlphaDev.Web.Tests.Integration.Features
{
public class WebFeatureFixture : FeatureFixture, IClassFixture<DatabaseWebServerFixture>, IDisposable
{
protected const string FullDateFormatRegularExpression = @"\w+,\s\w+\s\d{2},\s\d{4}";
protected const string FullDateFormatString = "dddd, MMMM dd, yyyy";
private readonly WebServer _server;
protected WebFeatureFixture(ITestOutputHelper output, DatabaseWebServerFixture databaseWebServerFixture) :
base(output)
{
_server = databaseWebServerFixture.Server;
DatabasesFixture = databaseWebServerFixture.DatabasesFixture;
SiteTester = databaseWebServerFixture.SiteTester;
CommonSteps = new CommonSteps(SiteTester, DatabasesFixture);
}
protected DatabasesFixture DatabasesFixture { get; }
protected string Log => _server.Log;
public SiteTester SiteTester { get; }
public CommonSteps CommonSteps { get; }
public void Dispose()
{
DatabasesFixture.DatabaseManager.ResetDatabases();
_server.ClearLog();
}
}
}
|
unlicense
|
C#
|
8d95acedeb361a7efd69072992af6b6ab1ccee59
|
Add some more comments
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
Android/Crashlytics/samples/CrashlyticsSample/CrashlyticsSample/MainActivity.cs
|
Android/Crashlytics/samples/CrashlyticsSample/CrashlyticsSample/MainActivity.cs
|
using Android.App;
using Android.Widget;
using Android.OS;
using Java.Lang;
using Android.Views;
using System;
// OPTIONAL: Don't need this for firebase console integration
//[assembly: MetaData("io.fabric.ApiKey", Value = "<FABRIC_API_KEY>")]
// IMPORTANT: You must also be sure to add a `com.crashlytics.android.build_id` value as a string resource:
// <resources>
// <string name="com.crashlytics.android.build_id">SOME-ID</string>
// </resources>
// IMPORTANT: You must add your google-services.json to your project as a 'GoogleServicesJson' build action
namespace CrashlyticsSample
{
[Activity(Label = "Crashlytics Sample", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Initiate Fabric
Fabric.Fabric.With(this, new Crashlytics.Crashlytics());
// Optional: Setup Xamarin / Mono Unhandled exception parsing / handling
Crashlytics.Crashlytics.HandleManagedExceptions();
SetContentView(Resource.Layout.Main);
var btnForceCrash = FindViewById<Button>(Resource.Id.btnCrashlytics);
var btnLogin = FindViewById<Button>(Resource.Id.btnFabric);
btnLogin.Click += (sender, args) =>
{
// TODO: Use the current user's information
// You can call any combination of these three methods
Crashlytics.Crashlytics.SetUserIdentifier("12345");
Crashlytics.Crashlytics.SetUserIdentifier("user@fabric.io");
Crashlytics.Crashlytics.SetUserName("Test User");
};
btnForceCrash.Click += (sender, args) =>
{
try
{
try
{
throw new ApplicationException("This is a nexted exception");
}
catch (System.Exception e1)
{
throw new InvalidCastException("Level 1", e1);
}
}
catch (System.Exception e2)
{
throw new InvalidCastException("Level 2", e2);
}
};
}
}
}
|
using Android.App;
using Android.Widget;
using Android.OS;
using Java.Lang;
using Android.Views;
using System;
[assembly: MetaData("io.fabric.ApiKey", Value ="<FABRIC_API_KEY>")]
namespace CrashlyticsSample
{
[Activity(Label = "Crashlytics Sample", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Fabric.Fabric.With(this, new Crashlytics.Crashlytics());
Crashlytics.Crashlytics.HandleManagedExceptions();
SetContentView(Resource.Layout.Main);
var btnForceCrash = FindViewById<Button>(Resource.Id.btnCrashlytics);
var btnLogin = FindViewById<Button>(Resource.Id.btnFabric);
btnLogin.Click += (sender, args) =>
{
// TODO: Use the current user's information
// You can call any combination of these three methods
Crashlytics.Crashlytics.SetUserIdentifier("12345");
Crashlytics.Crashlytics.SetUserIdentifier("user@fabric.io");
Crashlytics.Crashlytics.SetUserName("Test User");
};
btnForceCrash.Click += (sender, args) =>
{
try
{
try
{
throw new ApplicationException("This is a nexted exception");
}
catch (System.Exception e1)
{
throw new InvalidCastException("Level 1", e1);
}
}
catch (System.Exception e2)
{
throw new InvalidCastException("Level 2", e2);
}
};
}
}
}
|
mit
|
C#
|
1adc045aa05c743f47b51ab332e8dd8b5af57c1a
|
Update DeserializerException.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Serialization/DeserializerException.cs
|
TIKSN.Core/Serialization/DeserializerException.cs
|
using System;
using System.Runtime.Serialization;
namespace TIKSN.Serialization
{
[Serializable]
public class DeserializerException : Exception
{
public DeserializerException()
{
}
public DeserializerException(string message) : base(message)
{
}
public DeserializerException(string message, Exception inner) : base(message, inner)
{
}
protected DeserializerException(
SerializationInfo info,
StreamingContext context) : base(info, context)
{
}
}
}
|
using System;
namespace TIKSN.Serialization
{
[Serializable]
public class DeserializerException : Exception
{
public DeserializerException()
{
}
public DeserializerException(string message) : base(message)
{
}
public DeserializerException(string message, Exception inner) : base(message, inner)
{
}
protected DeserializerException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
}
|
mit
|
C#
|
c10e10c42a304c7b39863db7c4739f613d3a57ac
|
Document IOperationCodeable
|
HelloKitty/Booma.Proxy
|
src/Booma.Packet.Common/Message/IOperationCodeable.cs
|
src/Booma.Packet.Common/Message/IOperationCodeable.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Booma.Proxy;
namespace Booma
{
/// <summary>
/// Contract for types/objects that are operation-coded.
/// </summary>
/// <typeparam name="TOperationCodeType">The operation code type.</typeparam>
public interface IOperationCodeable<out TOperationCodeType>
where TOperationCodeType : Enum
{
/// <summary>
/// Operation code for the object.
/// </summary>
TOperationCodeType OperationCode { get; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Booma.Proxy;
namespace Booma
{
public interface IOperationCodeable<TOperationCodeType>
public interface IOperationCodeable<out TOperationCodeType>
where TOperationCodeType : Enum
{
TOperationCodeType OperationCode { get; }
}
}
|
agpl-3.0
|
C#
|
31a5f276b8b9e3ffb1884021c3bd127d1b5cf14c
|
Mark CountedForm as non-abstract with DEBUG
|
tgstation/tgstation-server,Cyberboss/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server-tools,tgstation/tgstation-server
|
TGControlPanel/CountedForm.cs
|
TGControlPanel/CountedForm.cs
|
using System.Windows.Forms;
namespace TGControlPanel
{
/// <summary>
/// Calls <see cref="Application.Exit()"/> when all <see cref="CountedForm"/>s are <see cref="Form.Close"/>d
/// </summary>
#if !DEBUG
abstract class CountedForm : Form
#else
class CountedForm : Form
#endif
{
/// <summary>
/// The current number of active <see cref="CountedForm"/>s
/// </summary>
static uint FormCount;
/// <summary>
/// Construct a <see cref="CountedForm"/>. Increments <see cref="FormCount"/>
/// </summary>
public CountedForm()
{
FormClosed += CountedForm_FormClosed;
++FormCount;
}
/// <summary>
/// Decrements <see cref="FormCount"/>. Calls <see cref="Application.Exit()"/> if it reaches 0
/// </summary>
/// <param name="sender">The sender of the event</param>
/// <param name="e">The <see cref="FormClosedEventArgs"/></param>
private void CountedForm_FormClosed(object sender, FormClosedEventArgs e)
{
if (--FormCount == 0)
Application.Exit();
}
}
}
|
using System.Windows.Forms;
namespace TGControlPanel
{
/// <summary>
/// Calls <see cref="Application.Exit()"/> when all <see cref="CountedForm"/>s are <see cref="Form.Close"/>d
/// </summary>
abstract class CountedForm : Form
{
/// <summary>
/// The current number of active <see cref="CountedForm"/>s
/// </summary>
static uint FormCount;
/// <summary>
/// Construct a <see cref="CountedForm"/>. Increments <see cref="FormCount"/>
/// </summary>
public CountedForm()
{
FormClosed += CountedForm_FormClosed;
++FormCount;
}
/// <summary>
/// Decrements <see cref="FormCount"/>. Calls <see cref="Application.Exit()"/> if it reaches 0
/// </summary>
/// <param name="sender">The sender of the event</param>
/// <param name="e">The <see cref="FormClosedEventArgs"/></param>
private void CountedForm_FormClosed(object sender, FormClosedEventArgs e)
{
if (--FormCount == 0)
Application.Exit();
}
}
}
|
agpl-3.0
|
C#
|
246e61ddb980c42e091b9f3ad611daa4ef77e2cb
|
change logging apikey
|
cssho/VSMarketplaceBadge,cssho/VSMarketplaceBadge
|
VSMarketplaceBadge/Utility.cs
|
VSMarketplaceBadge/Utility.cs
|
using Newtonsoft.Json;
using System;
using System.Configuration;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using VSMarketplaceBadge.Models;
namespace VSMarketplaceBadge
{
public static class Utility
{
private static readonly string apiKey = ConfigurationManager.AppSettings.Get("LOGGLY_KEY");
private static readonly HttpClient client = new HttpClient();
public static async Task SendMetrics(string itemName, BadgeType type)
{
var content = new StringContent(JsonConvert.SerializeObject(new { Item = itemName, Type = type.ToString() }), Encoding.UTF8, "application/json");
await client.PostAsync($"https://logs-01.loggly.com/inputs/{apiKey}/tag/http/", content);
}
public static void FireAndForget(this Task task)
{
task.ContinueWith(x =>
{
SendError(x.Exception).Wait();
}, TaskContinuationOptions.OnlyOnFaulted);
}
public static async Task SendError(Exception e)
{
var content = new StringContent(JsonConvert.SerializeObject(new { Exception = e.ToString(), Request = HttpContext.Current.Request.Url.PathAndQuery }), Encoding.UTF8, "application/json");
await client.PostAsync($"https://logs-01.loggly.com/inputs/{apiKey}/tag/http/", content);
}
}
}
|
using Newtonsoft.Json;
using System;
using System.Configuration;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using VSMarketplaceBadge.Models;
namespace VSMarketplaceBadge
{
public static class Utility
{
private static readonly string apiKey = ConfigurationManager.AppSettings.Get("LOGGLY_KEY");
private static readonly HttpClient client = new HttpClient();
public static async Task SendMetrics(string itemName, BadgeType type)
{
var content = new StringContent(JsonConvert.SerializeObject(new { Item = itemName, Type = type.ToString() }), Encoding.UTF8, "application/json");
await client.PostAsync($"https://logs-01.loggly.com/inputs/762645d2-2ee6-4a2d-be18-4b7be6373cb8/tag/http/", content);
}
public static void FireAndForget(this Task task)
{
task.ContinueWith(x =>
{
SendError(x.Exception).Wait();
}, TaskContinuationOptions.OnlyOnFaulted);
}
public static async Task SendError(Exception e)
{
var content = new StringContent(JsonConvert.SerializeObject(new { Exception = e.ToString() }), Encoding.UTF8, "application/json");
await client.PostAsync($"https://logs-01.loggly.com/inputs/762645d2-2ee6-4a2d-be18-4b7be6373cb8/tag/http/", content);
}
}
}
|
mit
|
C#
|
e44bb69908c272ffaa85ab57ddf1e68d16d31462
|
Add cluster_uuid to root of the cluster_state response (#3443)
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Nest/Cluster/ClusterState/ClusterStateResponse.cs
|
src/Nest/Cluster/ClusterState/ClusterStateResponse.cs
|
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Nest
{
public interface IClusterStateResponse : IResponse
{
[JsonProperty("cluster_name")]
string ClusterName { get; }
[JsonProperty("master_node")]
string MasterNode { get; }
[JsonProperty("state_uuid")]
string StateUUID { get; }
/// <summary>The Universally Unique Identifier for the cluster.</summary>
/// <remarks>While the cluster is still forming, it is possible for the `cluster_uuid` to be `_na_`.</remarks>
[JsonProperty("cluster_uuid")]
string ClusterUUID { get; }
[JsonProperty("version")]
long Version { get; }
[JsonProperty("nodes")]
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter<string, NodeState>))]
IReadOnlyDictionary<string, NodeState> Nodes { get; }
[JsonProperty("metadata")]
MetadataState Metadata { get; }
[JsonProperty("routing_table")]
RoutingTableState RoutingTable { get; }
[JsonProperty("routing_nodes")]
RoutingNodesState RoutingNodes { get; }
[JsonProperty("blocks")]
BlockState Blocks { get; }
}
public class ClusterStateResponse : ResponseBase, IClusterStateResponse
{
public string ClusterName { get; internal set; }
public string MasterNode { get; internal set; }
public string StateUUID { get; internal set; }
/// <inheritdoc cref="IClusterStateResponse.ClusterUUID"/>
public string ClusterUUID { get; internal set; }
public long Version { get; internal set; }
public IReadOnlyDictionary<string, NodeState> Nodes { get; internal set; } = EmptyReadOnly<string, NodeState>.Dictionary;
public MetadataState Metadata { get; internal set; }
public RoutingTableState RoutingTable { get; internal set; }
public RoutingNodesState RoutingNodes { get; internal set; }
public BlockState Blocks { get; internal set; }
}
}
|
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Nest
{
public interface IClusterStateResponse : IResponse
{
[JsonProperty("cluster_name")]
string ClusterName { get; }
[JsonProperty("master_node")]
string MasterNode { get; }
[JsonProperty("state_uuid")]
string StateUUID { get; }
[JsonProperty("version")]
long Version { get; }
[JsonProperty("nodes")]
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter<string, NodeState>))]
IReadOnlyDictionary<string, NodeState> Nodes { get; }
[JsonProperty("metadata")]
MetadataState Metadata { get; }
[JsonProperty("routing_table")]
RoutingTableState RoutingTable { get; }
[JsonProperty("routing_nodes")]
RoutingNodesState RoutingNodes { get; }
[JsonProperty("blocks")]
BlockState Blocks { get; }
}
public class ClusterStateResponse : ResponseBase, IClusterStateResponse
{
public string ClusterName { get; internal set; }
public string MasterNode { get; internal set; }
public string StateUUID { get; internal set; }
public long Version { get; internal set; }
public IReadOnlyDictionary<string, NodeState> Nodes { get; internal set; } = EmptyReadOnly<string, NodeState>.Dictionary;
public MetadataState Metadata { get; internal set; }
public RoutingTableState RoutingTable { get; internal set; }
public RoutingNodesState RoutingNodes { get; internal set; }
public BlockState Blocks { get; internal set; }
}
}
|
apache-2.0
|
C#
|
a7651c66e161a6600a82d972419a66a49ea61786
|
Make partial.
|
DimensionDataCBUSydney/jab
|
jab/jab/Test/ServiceTests.cs
|
jab/jab/Test/ServiceTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NSwag;
using Xunit;
namespace jab.Test
{
public partial class ServiceTests
{
const string testDefinition = "samples/example.json";
/// <summary>
/// Require HTTPS support.
/// </summary>
/// <param name="service"></param>
/// <param name="path"></param>
/// <param name="method"></param>
/// <param name="operation"></param>
[Theory, ParameterisedClassData(typeof(ApiServices), testDefinition)]
public void RequireHttps(
SwaggerService service
)
{
Assert.True(service.Schemes.Contains(SwaggerSchema.Https),
$"{service.BaseUrl} does not support HTTPS");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NSwag;
using Xunit;
namespace jab.Test
{
public class ServiceTests
{
const string testDefinition = "samples/example.json";
/// <summary>
/// Require HTTPS support.
/// </summary>
/// <param name="service"></param>
/// <param name="path"></param>
/// <param name="method"></param>
/// <param name="operation"></param>
[Theory, ParameterisedClassData(typeof(ApiServices), testDefinition)]
public void RequireHttps(
SwaggerService service
)
{
Assert.True(service.Schemes.Contains(SwaggerSchema.Https),
$"{service.BaseUrl} does not support HTTPS");
}
}
}
|
apache-2.0
|
C#
|
c6616f9c31e5e111244981eebc37dc48941d4567
|
Fix InsertHorizontalRule
|
asposewords/Aspose_Words_NET,asposewords/Aspose_Words_NET,aspose-words/Aspose.Words-for-.NET,aspose-words/Aspose.Words-for-.NET,aspose-words/Aspose.Words-for-.NET,asposewords/Aspose_Words_NET,aspose-words/Aspose.Words-for-.NET,asposewords/Aspose_Words_NET
|
Examples/CSharp/Programming-Documents/Document/DocumentBuilderInsertHorizontalRule.cs
|
Examples/CSharp/Programming-Documents/Document/DocumentBuilderInsertHorizontalRule.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aspose.Words.Examples.CSharp.Programming_Documents.Working_With_Document
{
class DocumentBuilderInsertHorizontalRule
{
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
// ExStart:DocumentBuilderInsertHorizontalRule
// Initialize document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Insert a horizontal rule shape into the document.");
builder.InsertHorizontalRule();
dataDir = dataDir + "DocumentBuilder.InsertHorizontalRule_out.doc";
doc.Save(dataDir);
// ExEnd:DocumentBuilderInsertHorizontalRule
Console.WriteLine("\nHorizontal rule is inserted into document successfully.\nFile saved at " + dataDir);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aspose.Words.Examples.CSharp.Programming_Documents.Working_With_Document
{
class DocumentBuilderInsertHorizontalRule
{
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
// ExStart:DocumentBuilderInsertHorizontalRule
// Initialize document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Insert a horizontal rule shape into the document.");
builder.InsertHorizontalRule();
dataDir = dataDir + "DocumentBuilder.InsertHorizontalRule_out.doc";
doc.Save(dataDir);
// ExEnd:DocumentBuilderInsertHorizontalRule
Console.WriteLine("\nBookmark using DocumentBuilder inserted successfully.\nFile saved at " + dataDir);
}
}
}
|
mit
|
C#
|
440f032c51fb4d09af574dab785032129176c476
|
Update state string to Header referer
|
davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,projectkudu/TryAppService,projectkudu/TryAppService,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,projectkudu/TryAppService,fashaikh/SimpleWAWS,fashaikh/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS
|
SimpleWAWS/Authentication/GoogleAuthProvider.cs
|
SimpleWAWS/Authentication/GoogleAuthProvider.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace SimpleWAWS.Authentication
{
public class GoogleAuthProvider : BaseOpenIdConnectAuthProvider
{
public override string GetLoginUrl(HttpContextBase context)
{
var culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();
var builder = new StringBuilder();
builder.Append("https://accounts.google.com/o/oauth2/auth");
builder.Append("?response_type=id_token");
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "https://{0}/Login", context.Request.Headers["HOST"])));
builder.AppendFormat("&client_id={0}", AuthSettings.GoogleAppId);
builder.AppendFormat("&scope={0}", "email");
if (context.IsFunctionsPortalRequest())
{
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "/{0}/{1}", context.Request.Headers["Referer"], context.Request.Url.Query) ));
}
else
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(context.IsAjaxRequest()? string.Format(CultureInfo.InvariantCulture, "/{0}{1}", culture, context.Request.Url.Query) : context.Request.Url.PathAndQuery));
return builder.ToString();
}
protected override string GetValidAudiance()
{
return AuthSettings.GoogleAppId;
}
public override string GetIssuerName(string altSecId)
{
return "Google";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace SimpleWAWS.Authentication
{
public class GoogleAuthProvider : BaseOpenIdConnectAuthProvider
{
public override string GetLoginUrl(HttpContextBase context)
{
var culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();
var builder = new StringBuilder();
builder.Append("https://accounts.google.com/o/oauth2/auth");
builder.Append("?response_type=id_token");
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "https://{0}/Login", context.Request.Headers["HOST"])));
builder.AppendFormat("&client_id={0}", AuthSettings.GoogleAppId);
builder.AppendFormat("&scope={0}", "email");
if (context.IsFunctionsPortalRequest())
{
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "/{0}/{1}", context.Request.Headers["Origin"], context.Request.Url.Query) ));
}
else
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(context.IsAjaxRequest()? string.Format(CultureInfo.InvariantCulture, "/{0}{1}", culture, context.Request.Url.Query) : context.Request.Url.PathAndQuery));
return builder.ToString();
}
protected override string GetValidAudiance()
{
return AuthSettings.GoogleAppId;
}
public override string GetIssuerName(string altSecId)
{
return "Google";
}
}
}
|
apache-2.0
|
C#
|
0b163d498de955ccefe08f9212a4934b3d5478b9
|
Bump version
|
cyotek/Cyotek.Windows.Forms.ImageBox
|
Cyotek.Windows.Forms.ImageBox/Properties/AssemblyInfo.cs
|
Cyotek.Windows.Forms.ImageBox/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// TODO: Next major version reset AssemblyVersion to ensure no strong name versioning nonsense
[assembly: AssemblyTitle("Cyotek ImageBox Control")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cyotek Ltd")]
[assembly: AssemblyProduct("Cyotek ImageBox Control")]
[assembly: AssemblyCopyright("Copyright © 2010-2021 Cyotek Ltd.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("d812a438-008c-47f9-926f-8415490cdda1")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0-beta.1")]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// TODO: Next major version reset AssemblyVersion to ensure no strong name versioning nonsense
[assembly: AssemblyTitle("Cyotek ImageBox Control")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cyotek Ltd")]
[assembly: AssemblyProduct("Cyotek ImageBox Control")]
[assembly: AssemblyCopyright("Copyright © 2010-2017 Cyotek Ltd.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("d812a438-008c-47f9-926f-8415490cdda1")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0-Alpha1")]
|
mit
|
C#
|
a22d1ac135852e956acad31e7dbe4f4aee2a0a91
|
Add Comments
|
yuanguozheng/XiyouMobileFoundation
|
XiyouMobileFoundation/ImageUtils/XYMImageUtils.cs
|
XiyouMobileFoundation/ImageUtils/XYMImageUtils.cs
|
/**
* Copyright (C) 2015 Xiyou Mobile Application Lab.
*
* XiyouMobileFoundation
*
* XYMImageUtils.cs
*
* Created by Yuan Guozheng on 2015-6-10.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
namespace XiyouMobileFoundation.ImageUtils
{
/// <summary>
/// 图片工具类
/// </summary>
public class XYMImageUtils
{
/// <summary>
/// byte[] 转图片
/// </summary>
/// <param name="bytesArray">需要转换的Byte数组</param>
/// <returns>Bitmap对象</returns>
public static Bitmap BytesToBitmap(byte[] bytesArray)
{
MemoryStream stream = null;
try
{
stream = new MemoryStream(bytesArray);
return new Bitmap((Image)new Bitmap(stream));
}
catch (ArgumentNullException ex)
{
throw ex;
}
catch (ArgumentException ex)
{
throw ex;
}
finally
{
stream.Close();
}
}
/// <summary>
/// 图片转byte[]
/// </summary>
/// <param name="bitmap">需要转换的Bitmap对象</param>
/// <returns>Byte数组</returns>
public static byte[] BitmapToBytes(Bitmap bitmap)
{
MemoryStream ms = null;
try
{
ms = new MemoryStream();
bitmap.Save(ms, bitmap.RawFormat);
byte[] byteImage = new Byte[ms.Length];
byteImage = ms.ToArray();
return byteImage;
}
catch (ArgumentNullException ex)
{
throw ex;
}
finally
{
ms.Close();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
namespace XiyouMobileFoundation.ImageUtils
{
public class XYMImageUtils
{
/// <summary>
/// byte[] 转图片
/// </summary>
/// <param name="bytesArray">需要转换的Byte数组</param>
/// <returns>Bitmap对象</returns>
public static Bitmap BytesToBitmap(byte[] bytesArray)
{
MemoryStream stream = null;
try
{
stream = new MemoryStream(bytesArray);
return new Bitmap((Image)new Bitmap(stream));
}
catch (ArgumentNullException ex)
{
throw ex;
}
catch (ArgumentException ex)
{
throw ex;
}
finally
{
stream.Close();
}
}
/// <summary>
/// 图片转byte[]
/// </summary>
/// <param name="bitmap">需要转换的Bitmap对象</param>
/// <returns>Byte数组</returns>
public static byte[] BitmapToBytes(Bitmap bitmap)
{
MemoryStream ms = null;
try
{
ms = new MemoryStream();
bitmap.Save(ms, bitmap.RawFormat);
byte[] byteImage = new Byte[ms.Length];
byteImage = ms.ToArray();
return byteImage;
}
catch (ArgumentNullException ex)
{
throw ex;
}
finally
{
ms.Close();
}
}
}
}
|
apache-2.0
|
C#
|
2c314526fd5430ee4fa6e9d45c40c969e1dd42bc
|
rename option in AssetService
|
vinhch/BizwebSharp
|
src/BizwebSharp/Services/Asset/AssetService.cs
|
src/BizwebSharp/Services/Asset/AssetService.cs
|
using System.Collections.Generic;
using System.Threading.Tasks;
using BizwebSharp.Entities;
using BizwebSharp.Infrastructure;
namespace BizwebSharp.Services
{
public class AssetService : BaseService
{
public AssetService(BizwebAuthorizationState authState) : base(authState)
{
}
public virtual async Task<IEnumerable<Asset>> ListAsync(long themeId, string fields = null)
{
return
await MakeRequest<List<Asset>>($"themes/{themeId}/assets.json", HttpMethod.GET, "assets", new {fields});
}
public virtual async Task<Asset> GetAsync(long themeId, string key, string fields = null)
{
var option = new Dictionary<string, object>
{
{"key", key },
{"theme_id", themeId }
};
if (!string.IsNullOrEmpty(fields))
{
option.Add("fields", fields);
}
return await MakeRequest<Asset>($"themes/{themeId}/assets.json", HttpMethod.GET, "asset", option);
}
public virtual async Task<Asset> CreateOrUpdateAsync(long themeId, Asset asset)
{
return await MakeRequest<Asset>($"themes/{themeId}/assets.json", HttpMethod.PUT, "asset", new {asset});
}
public virtual async Task DeleteAsync(long themeId, string key)
{
var option = new Dictionary<string, object>
{
{"key", key },
{"theme_id", themeId }
};
await MakeRequest($"themes/{themeId}/assets.json", HttpMethod.DELETE, payload: option);
}
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
using BizwebSharp.Entities;
using BizwebSharp.Infrastructure;
namespace BizwebSharp.Services
{
public class AssetService : BaseService
{
public AssetService(BizwebAuthorizationState authState) : base(authState)
{
}
public virtual async Task<IEnumerable<Asset>> ListAsync(long themeId, string fields = null)
{
return
await MakeRequest<List<Asset>>($"themes/{themeId}/assets.json", HttpMethod.GET, "assets", new {fields});
}
public virtual async Task<Asset> GetAsync(long themeId, string key, string fields = null)
{
var options = new Dictionary<string, object>
{
{"key", key },
{"theme_id", themeId }
};
if (!string.IsNullOrEmpty(fields))
{
options.Add("fields", fields);
}
return await MakeRequest<Asset>($"themes/{themeId}/assets.json", HttpMethod.GET, "asset", options);
}
public virtual async Task<Asset> CreateOrUpdateAsync(long themeId, Asset asset)
{
return await MakeRequest<Asset>($"themes/{themeId}/assets.json", HttpMethod.PUT, "asset", new {asset});
}
public virtual async Task DeleteAsync(long themeId, string key)
{
var options = new Dictionary<string, object>
{
{"key", key },
{"theme_id", themeId }
};
await MakeRequest($"themes/{themeId}/assets.json", HttpMethod.DELETE, payload: options);
}
}
}
|
mit
|
C#
|
5b88b9fb6ddc9b76d8ded3fb571434827fabcc2a
|
fix overzealous use of UseEnumValueNameForStringColumns
|
MaceWindu/linq2db,MaceWindu/linq2db,LinqToDB4iSeries/linq2db,LinqToDB4iSeries/linq2db,ronnyek/linq2db,linq2db/linq2db,linq2db/linq2db
|
Source/LinqToDB/Extensions/MappingExtensions.cs
|
Source/LinqToDB/Extensions/MappingExtensions.cs
|
using System;
namespace LinqToDB.Extensions
{
using Common;
using Mapping;
using SqlQuery;
static class MappingExtensions
{
public static SqlValue GetSqlValue(this MappingSchema mappingSchema, object value)
{
if (value == null)
throw new InvalidOperationException();
return GetSqlValue(mappingSchema, value.GetType(), value);
}
public static SqlValue GetSqlValue(this MappingSchema mappingSchema, Type systemType, object value)
{
var underlyingType = systemType.ToNullableUnderlying();
if (underlyingType.IsEnumEx() && mappingSchema.GetAttribute<Sql.EnumAttribute>(underlyingType) == null)
{
if (value != null || systemType == underlyingType)
{
var type = Converter.GetDefaultMappingFromEnumType(mappingSchema, systemType);
if (Configuration.UseEnumValueNameForStringColumns && type == typeof(string) && mappingSchema.GetMapValues(underlyingType) == null)
return new SqlValue(type, value.ToString());
return new SqlValue(type, Converter.ChangeType(value, type, mappingSchema));
}
}
if (systemType == typeof(object) && value != null)
systemType = value.GetType();
return new SqlValue(systemType, value);
}
}
}
|
using System;
namespace LinqToDB.Extensions
{
using Common;
using Mapping;
using SqlQuery;
static class MappingExtensions
{
public static SqlValue GetSqlValue(this MappingSchema mappingSchema, object value)
{
if (value == null)
throw new InvalidOperationException();
return GetSqlValue(mappingSchema, value.GetType(), value);
}
public static SqlValue GetSqlValue(this MappingSchema mappingSchema, Type systemType, object value)
{
var underlyingType = systemType.ToNullableUnderlying();
if (underlyingType.IsEnumEx() && mappingSchema.GetAttribute<Sql.EnumAttribute>(underlyingType) == null)
{
if (value != null || systemType == underlyingType)
{
var type = Converter.GetDefaultMappingFromEnumType(mappingSchema, systemType);
if (Configuration.UseEnumValueNameForStringColumns && type == typeof(string))
return new SqlValue(type, value.ToString());
return new SqlValue(type, Converter.ChangeType(value, type, mappingSchema));
}
}
if (systemType == typeof(object) && value != null)
systemType = value.GetType();
return new SqlValue(systemType, value);
}
}
}
|
mit
|
C#
|
69a6286da8bb2292c9af2ab1b0c2cf0105a7b45a
|
remove redundant code
|
bau-build/bau,modulexcite/bau,huoxudong125/bau,adamralph/bau,eatdrinksleepcode/bau,modulexcite/bau,modulexcite/bau,eatdrinksleepcode/bau,adamralph/bau,modulexcite/bau,adamralph/bau,bau-build/bau,huoxudong125/bau,bau-build/bau,aarondandy/bau,huoxudong125/bau,aarondandy/bau,aarondandy/bau,huoxudong125/bau,aarondandy/bau,adamralph/bau,bau-build/bau,eatdrinksleepcode/bau,eatdrinksleepcode/bau
|
src/Bau/BauTaskExtensions.cs
|
src/Bau/BauTaskExtensions.cs
|
// <copyright file="BauTaskExtensions.cs" company="Bau contributors">
// Copyright (c) Bau contributors. (baubuildch@gmail.com)
// </copyright>
namespace BauCore
{
public static class BauTaskExtensions
{
public static void LogFatal(this IBauTask task, string message)
{
Log.Fatal(task, message);
}
public static void LogError(this IBauTask task, string message)
{
Log.Error(task, message);
}
public static void LogWarn(this IBauTask task, string message)
{
Log.Warn(task, message);
}
public static void LogInfo(this IBauTask task, string message)
{
Log.Info(task, message);
}
public static void LogDebug(this IBauTask task, string message)
{
Log.Debug(task, message);
}
public static void LogTrace(this IBauTask task, string message)
{
Log.Trace(task, message);
}
}
}
|
// <copyright file="BauTaskExtensions.cs" company="Bau contributors">
// Copyright (c) Bau contributors. (baubuildch@gmail.com)
// </copyright>
namespace BauCore
{
using System;
public static class BauTaskExtensions
{
public static void LogFatal(this IBauTask task, string message)
{
Log.Fatal(task, message);
}
public static void LogError(this IBauTask task, string message)
{
Log.Error(task, message);
}
public static void LogWarn(this IBauTask task, string message)
{
Log.Warn(task, message);
}
public static void LogInfo(this IBauTask task, string message)
{
Log.Info(task, message);
}
public static void LogDebug(this IBauTask task, string message)
{
Log.Debug(task, message);
}
public static void LogTrace(this IBauTask task, string message)
{
Log.Trace(task, message);
}
}
}
|
mit
|
C#
|
729a48436cbe7339b7953c04fab93540bdccea64
|
change namespace
|
SimoPrG/TeamManticore
|
Core/TelerikBird.cs
|
Core/TelerikBird.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FlappyManticore
{
class TelerikBird
{
public char[][] array = new char[4][]; //this char array represents the bird.
string wingsTopStreight = @"\ /";
string wingsBottomStreight = @" \/ ";
string wingsTopFlap = @" ";
string wingsBottomFlap = @"/\/\";
string bodyTop = @" /\ ";
string bodyBottom = @" \/ ";
public int coordX { get; set; } // the X coordinate of the bird.
public int coordY { get; set; } // the Y coordinate of the bird.
bool isFlap { get; set; } // this bool is used to make the bird to flap.
public TelerikBird() //bird constructor
{
array[0] = wingsTopStreight.ToCharArray();
array[1] = wingsBottomStreight.ToCharArray();
array[2] = bodyTop.ToCharArray();
array[3] = bodyBottom.ToCharArray();
isFlap = true;
coordX = 2;
coordY = Console.WindowHeight / 2;
}
public void Flap() //this method uses isFlap and makes the instance to flap
{
if (isFlap)
{
array[0] = wingsTopFlap.ToCharArray();
array[1] = wingsBottomFlap.ToCharArray();
isFlap = false;
}
else
{
array[0] = wingsTopStreight.ToCharArray();
array[1] = wingsBottomStreight.ToCharArray();
isFlap = true;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core
{
class TelerikBird
{
public char[][] array = new char[4][]; //this char array represents the bird.
string wingsTopStreight = @"\ /";
string wingsBottomStreight = @" \/ ";
string wingsTopFlap = @" ";
string wingsBottomFlap = @"/\/\";
string bodyTop = @" /\ ";
string bodyBottom = @" \/ ";
public int coordX { get; set; } // the X coordinate of the bird.
public int coordY { get; set; } // the Y coordinate of the bird.
bool isFlap { get; set; } // this bool is used to make the bird to flap.
public TelerikBird() //bird constructor
{
array[0] = wingsTopStreight.ToCharArray();
array[1] = wingsBottomStreight.ToCharArray();
array[2] = bodyTop.ToCharArray();
array[3] = bodyBottom.ToCharArray();
isFlap = true;
coordX = 2;
coordY = Console.WindowHeight / 2;
}
public void Flap() //this method uses isFlap and makes the instance to flap
{
if (isFlap)
{
array[0] = wingsTopFlap.ToCharArray();
array[1] = wingsBottomFlap.ToCharArray();
isFlap = false;
}
else
{
array[0] = wingsTopStreight.ToCharArray();
array[1] = wingsBottomStreight.ToCharArray();
isFlap = true;
}
}
}
}
|
mit
|
C#
|
912305492ef177d840a979dad47de9f12c00278c
|
Simplify string tests in FetchRequestTests
|
HCanber/kafkaclient-net
|
src/KafkaClient.Tests/Api/FetchRequestTests.cs
|
src/KafkaClient.Tests/Api/FetchRequestTests.cs
|
using System;
using KafkaClient.Api;
using KafkaClient.Tests.TestHelpers;
using KafkaClient.Utils;
using Xunit;
using Xunit.Should;
namespace KafkaClient.Tests.Api
{
public class FetchRequestTests
{
[Fact]
public void Given_single_request_Then_Write_writes_correct()
{
var request = FetchRequest.CreateSingleRequest(topic: "test", partition: 42, offset: 4711, fetchSize: 100, clientId: "client", minBytes: 123, maxWait: 456, correlationId: 789);
var bytes = request.Write();
var expectedSize = 2 + 2 + 4 + (2 + 6) + //ApiKey + ApiVersion + CorrelationId + String_ClientId
4 + 4 + 4 + 4 + //ReplicaId + MaxWaitTime + MinBytes + ArraySize_Topics
(2 + 4) + 4 + 4 + 8 + 4; // String_Topic + ArraySize_Partitions + Partition + FetchOffset + MaxBytes
var expectedTotalMessageLength = expectedSize + 4;
bytes.ShouldHaveLength(expectedTotalMessageLength);
bytes.GetIntFromBigEndianBytes(0).ShouldBe(expectedSize); //Size
bytes.GetShortFromBigEndianBytes(4).ShouldBe<short>(1); //ApiKey=FetchRequest
bytes.GetShortFromBigEndianBytes(6).ShouldBe<short>(0); //ApiVersion
bytes.GetIntFromBigEndianBytes(8).ShouldBe(789); //CorrelationId
bytes.GetShortFromBigEndianBytes(12).ShouldBe<short>((short)"client".Length); //ClientId string length
bytes.ShouldBeString(14, "client"); //ClientId
bytes.GetIntFromBigEndianBytes(20).ShouldBe(-1); //ReplicaId=No node id
bytes.GetIntFromBigEndianBytes(24).ShouldBe(456); //MaxWaitTime
bytes.GetIntFromBigEndianBytes(28).ShouldBe(123); //MinBytes
bytes.GetIntFromBigEndianBytes(32).ShouldBe(1); //Array size for Topics
bytes.GetShortFromBigEndianBytes(36).ShouldBe<short>(4); //Topic string length "test"
bytes.ShouldBeString(38, "test"); //Topic
bytes.GetIntFromBigEndianBytes(42).ShouldBe(1); //Array size for Partitions
bytes.GetIntFromBigEndianBytes(46).ShouldBe(42); //Partition
bytes.GetLongFromBigEndianBytes(50).ShouldBe(4711); //Offset
bytes.GetIntFromBigEndianBytes(58).ShouldBe(100); //MaxBytes, FetchSize
}
}
}
|
using System;
using KafkaClient.Api;
using KafkaClient.Utils;
using Xunit;
using Xunit.Should;
namespace KafkaClient.Tests.Api
{
public class FetchRequestTests
{
[Fact]
public void Given_single_request_Then_Write_writes_correct()
{
var request = FetchRequest.CreateSingleRequest(topic: "test", partition: 42, offset: 4711, fetchSize: 100, clientId: "client", minBytes: 123, maxWait: 456, correlationId: 789);
var bytes = request.Write();
var expectedSize = 2 + 2 + 4 + (2 + 6) + //ApiKey + ApiVersion + CorrelationId + String_ClientId
4 + 4 + 4 + 4 + //ReplicaId + MaxWaitTime + MinBytes + ArraySize_Topics
(2 + 4) + 4 + 4 + 8 + 4; // String_Topic + ArraySize_Partitions + Partition + FetchOffset + MaxBytes
var expectedTotalMessageLength = expectedSize + 4;
bytes.ShouldHaveLength(expectedTotalMessageLength);
bytes.GetIntFromBigEndianBytes(0).ShouldBe(expectedSize); //Size
bytes.GetShortFromBigEndianBytes(4).ShouldBe<short>(1); //ApiKey=FetchRequest
bytes.GetShortFromBigEndianBytes(6).ShouldBe<short>(0); //ApiVersion
bytes.GetIntFromBigEndianBytes(8).ShouldBe(789); //CorrelationId
bytes.GetShortFromBigEndianBytes(12).ShouldBe<short>(6); //ClientId string length "client"
bytes[14].ShouldBe((byte)'c'); //ClientId
bytes[14].ShouldBe((byte)'c'); //ClientId
bytes[15].ShouldBe((byte)'l'); //ClientId
bytes[16].ShouldBe((byte)'i'); //ClientId
bytes[17].ShouldBe((byte)'e'); //ClientId
bytes[18].ShouldBe((byte)'n'); //ClientId
bytes[19].ShouldBe((byte)'t'); //ClientId
bytes.GetIntFromBigEndianBytes(20).ShouldBe(-1); //ReplicaId=No node id
bytes.GetIntFromBigEndianBytes(24).ShouldBe(456); //MaxWaitTime
bytes.GetIntFromBigEndianBytes(28).ShouldBe(123); //MinBytes
bytes.GetIntFromBigEndianBytes(32).ShouldBe(1); //Array size for Topics
bytes.GetShortFromBigEndianBytes(36).ShouldBe<short>(4); //Topic string length "test"
bytes[38].ShouldBe((byte)'t'); //Topic
bytes[39].ShouldBe((byte)'e'); //Topic
bytes[40].ShouldBe((byte)'s'); //Topic
bytes[41].ShouldBe((byte)'t'); //Topic
bytes.GetIntFromBigEndianBytes(42).ShouldBe(1); //Array size for Partitions
bytes.GetIntFromBigEndianBytes(46).ShouldBe(42); //Partition
bytes.GetLongFromBigEndianBytes(50).ShouldBe(4711); //Offset
bytes.GetIntFromBigEndianBytes(58).ShouldBe(100); //MaxBytes, FetchSize
}
}
}
|
mit
|
C#
|
e148c308d4a97d8bddafc908174429695b307bf7
|
Fix LanguageDepotProjectTest setup
|
sillsdev/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge
|
src/LfMerge.Tests/LanguageDepotProjectTests.cs
|
src/LfMerge.Tests/LanguageDepotProjectTests.cs
|
// Copyright (c) 2016 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Linq;
using System.Net.NetworkInformation;
using NUnit.Framework;
namespace LfMerge.Tests
{
[TestFixture]
public class LanguageDepotProjectTests
{
private TestEnvironment _env;
[TestFixtureSetUp]
public void FixtureSetup()
{
_env = new TestEnvironment();
var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
var uri = new Uri("mongodb://" + _env.Settings.MongoDbHostNameAndPort);
if (ipGlobalProperties.GetActiveTcpListeners().Count(t => t.Port == uri.Port) == 0)
{
Assert.Ignore("Ignoring tests because MongoDB doesn't seem to be running on {0}.",
_env.Settings.MongoDbHostNameAndPort);
}
}
[TestFixtureTearDown]
public void FixtureTearDown()
{
_env.Dispose();
}
[Test]
[Ignore("Currently we don't have the required fields in mongodb")]
public void ExistingProject()
{
// relies on a project being manually added to MongoDB with projectCode "proja"
// Setup
var sut = new LanguageDepotProject(_env.Settings, _env.Logger);
// Exercise
sut.Initialize("proja");
// Verify
Assert.That(sut.Identifier, Is.EqualTo("proja-langdepot"));
Assert.That(sut.Repository, Contains.Substring("public"));
}
[Test]
public void NonexistingProject()
{
// Setup
var sut = new LanguageDepotProject(_env.Settings, _env.Logger);
// Exercise/Verify
Assert.That(() => sut.Initialize("nonexisting"), Throws.ArgumentException);
}
}
}
|
// Copyright (c) 2016 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Linq;
using System.Net.NetworkInformation;
using NUnit.Framework;
namespace LfMerge.Tests
{
[TestFixture]
public class LanguageDepotProjectTests
{
private TestEnvironment _env;
[TestFixtureSetUp]
public void FixtureSetup()
{
_env = new TestEnvironment();
var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
var uri = new Uri("mongodb://" + _env.Settings.MongoDbHostNameAndPort);
if (ipGlobalProperties.GetActiveTcpListeners().Count(t => t.Port == uri.Port) == 0)
{
Assert.Ignore("Ignoring tests because MongoDB doesn't seem to be running on {0}.",
_env.Settings.MongoDbHostNameAndPort);
}
}
[TestFixtureTearDown]
public void FixtureTearDown()
{
_env.Dispose();
}
[Test]
[Ignore("Currently we don't have the required fields in mongodb")]
public void ExistingProject()
{
// relies on a project being manually added to MongoDB with projectCode "proja"
// Setup
var sut = new LanguageDepotProject(_env.Settings);
// Exercise
sut.Initialize("proja");
// Verify
Assert.That(sut.Identifier, Is.EqualTo("proja-langdepot"));
Assert.That(sut.Repository, Contains.Substring("public"));
}
[Test]
public void NonexistingProject()
{
// Setup
var sut = new LanguageDepotProject(_env.Settings);
// Exercise/Verify
Assert.That(() => sut.Initialize("nonexisting"), Throws.ArgumentException);
}
}
}
|
mit
|
C#
|
15dc12f80de05a67675bad8af9bf65ea8a5fb048
|
Format file.
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
src/MitternachtBot/Resources/CommandStrings.cs
|
src/MitternachtBot/Resources/CommandStrings.cs
|
using System;
using System.IO;
using System.Linq;
using Mitternacht.Common.Collections;
using NLog;
using YamlDotNet.Serialization;
namespace Mitternacht.Resources {
public class CommandStrings {
private static readonly Logger Log;
private const string CmdStringPath = @"./_strings/commandstrings.yml";
private static ConcurrentHashSet<CommandStringsModel> _commandStrings;
static CommandStrings() {
Log = LogManager.GetCurrentClassLogger();
LoadCommandStrings();
}
public static void LoadCommandStrings() {
try {
var yml = File.ReadAllText(CmdStringPath);
var deserializer = new Deserializer();
_commandStrings = deserializer.Deserialize<ConcurrentHashSet<CommandStringsModel>>(yml);
} catch(Exception e) {
Log.Error(e);
}
}
public static CommandStringsModel GetCommandStringModel(string name)
=> _commandStrings.FirstOrDefault(c => c.Name == name) ?? new CommandStringsModel { Name = name, Command = $"{name}_cmd" };
}
}
|
using System;
using System.IO;
using System.Linq;
using Mitternacht.Common.Collections;
using NLog;
using YamlDotNet.Serialization;
namespace Mitternacht.Resources {
public class CommandStrings
{
private static readonly Logger Log;
private const string CmdStringPath = @"./_strings/commandstrings.yml";
private static ConcurrentHashSet<CommandStringsModel> _commandStrings;
static CommandStrings() {
Log = LogManager.GetCurrentClassLogger();
LoadCommandStrings();
}
public static void LoadCommandStrings() {
try {
var yml = File.ReadAllText(CmdStringPath);
var deserializer = new Deserializer();
_commandStrings = deserializer.Deserialize<ConcurrentHashSet<CommandStringsModel>>(yml);
}
catch (Exception e) {
Log.Error(e);
}
}
public static CommandStringsModel GetCommandStringModel(string name)
=> _commandStrings.FirstOrDefault(c => c.Name == name) ?? new CommandStringsModel { Name = name, Command = name + "_cmd" };
}
}
|
mit
|
C#
|
e72b8c4bed4eaec229aab7336cdb2df19f00eb35
|
Update SweepGeneratorTests.cs
|
hannan-azam/Orchard,sfmskywalker/Orchard,JRKelso/Orchard,grapto/Orchard.CloudBust,SzymonSel/Orchard,gcsuk/Orchard,mvarblow/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,bedegaming-aleksej/Orchard,sfmskywalker/Orchard,SzymonSel/Orchard,omidnasri/Orchard,Praggie/Orchard,fassetar/Orchard,yersans/Orchard,li0803/Orchard,Codinlab/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,omidnasri/Orchard,Praggie/Orchard,ehe888/Orchard,geertdoornbos/Orchard,yersans/Orchard,jimasp/Orchard,OrchardCMS/Orchard,fassetar/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,mvarblow/Orchard,ehe888/Orchard,hbulzy/Orchard,Fogolan/OrchardForWork,Lombiq/Orchard,sfmskywalker/Orchard,yersans/Orchard,neTp9c/Orchard,jchenga/Orchard,Serlead/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Fogolan/OrchardForWork,jagraz/Orchard,omidnasri/Orchard,tobydodds/folklife,tobydodds/folklife,rtpHarry/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,AdvantageCS/Orchard,tobydodds/folklife,vairam-svs/Orchard,Lombiq/Orchard,geertdoornbos/Orchard,brownjordaninternational/OrchardCMS,dmitry-urenev/extended-orchard-cms-v10.1,Lombiq/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,xkproject/Orchard,tobydodds/folklife,jtkech/Orchard,yersans/Orchard,jimasp/Orchard,LaserSrl/Orchard,IDeliverable/Orchard,jchenga/Orchard,bedegaming-aleksej/Orchard,neTp9c/Orchard,ehe888/Orchard,rtpHarry/Orchard,johnnyqian/Orchard,bedegaming-aleksej/Orchard,Dolphinsimon/Orchard,Fogolan/OrchardForWork,li0803/Orchard,abhishekluv/Orchard,gcsuk/Orchard,JRKelso/Orchard,yersans/Orchard,vairam-svs/Orchard,xkproject/Orchard,armanforghani/Orchard,jersiovic/Orchard,brownjordaninternational/OrchardCMS,AdvantageCS/Orchard,vairam-svs/Orchard,bedegaming-aleksej/Orchard,fassetar/Orchard,phillipsj/Orchard,Serlead/Orchard,jimasp/Orchard,TalaveraTechnologySolutions/Orchard,neTp9c/Orchard,aaronamm/Orchard,geertdoornbos/Orchard,JRKelso/Orchard,grapto/Orchard.CloudBust,xkproject/Orchard,jchenga/Orchard,Lombiq/Orchard,SzymonSel/Orchard,grapto/Orchard.CloudBust,TalaveraTechnologySolutions/Orchard,jtkech/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,Praggie/Orchard,brownjordaninternational/OrchardCMS,SzymonSel/Orchard,phillipsj/Orchard,jersiovic/Orchard,hbulzy/Orchard,tobydodds/folklife,johnnyqian/Orchard,jersiovic/Orchard,OrchardCMS/Orchard,armanforghani/Orchard,jersiovic/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,phillipsj/Orchard,abhishekluv/Orchard,TalaveraTechnologySolutions/Orchard,LaserSrl/Orchard,rtpHarry/Orchard,jagraz/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,geertdoornbos/Orchard,johnnyqian/Orchard,Praggie/Orchard,jchenga/Orchard,omidnasri/Orchard,Serlead/Orchard,hannan-azam/Orchard,johnnyqian/Orchard,IDeliverable/Orchard,SouleDesigns/SouleDesigns.Orchard,jimasp/Orchard,AdvantageCS/Orchard,gcsuk/Orchard,jchenga/Orchard,phillipsj/Orchard,AdvantageCS/Orchard,aaronamm/Orchard,jimasp/Orchard,xkproject/Orchard,omidnasri/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,fassetar/Orchard,li0803/Orchard,grapto/Orchard.CloudBust,aaronamm/Orchard,mvarblow/Orchard,hbulzy/Orchard,jtkech/Orchard,Fogolan/OrchardForWork,Praggie/Orchard,tobydodds/folklife,grapto/Orchard.CloudBust,li0803/Orchard,sfmskywalker/Orchard,TalaveraTechnologySolutions/Orchard,SouleDesigns/SouleDesigns.Orchard,phillipsj/Orchard,omidnasri/Orchard,Dolphinsimon/Orchard,vairam-svs/Orchard,IDeliverable/Orchard,fassetar/Orchard,TalaveraTechnologySolutions/Orchard,ehe888/Orchard,ehe888/Orchard,mvarblow/Orchard,johnnyqian/Orchard,hannan-azam/Orchard,IDeliverable/Orchard,jersiovic/Orchard,abhishekluv/Orchard,AdvantageCS/Orchard,Codinlab/Orchard,TalaveraTechnologySolutions/Orchard,gcsuk/Orchard,sfmskywalker/Orchard,Serlead/Orchard,armanforghani/Orchard,aaronamm/Orchard,hannan-azam/Orchard,brownjordaninternational/OrchardCMS,neTp9c/Orchard,Fogolan/OrchardForWork,abhishekluv/Orchard,IDeliverable/Orchard,omidnasri/Orchard,jagraz/Orchard,JRKelso/Orchard,OrchardCMS/Orchard,armanforghani/Orchard,Codinlab/Orchard,jagraz/Orchard,TalaveraTechnologySolutions/Orchard,neTp9c/Orchard,rtpHarry/Orchard,Lombiq/Orchard,bedegaming-aleksej/Orchard,SouleDesigns/SouleDesigns.Orchard,jtkech/Orchard,hbulzy/Orchard,SzymonSel/Orchard,vairam-svs/Orchard,LaserSrl/Orchard,Dolphinsimon/Orchard,TalaveraTechnologySolutions/Orchard,sfmskywalker/Orchard,mvarblow/Orchard,li0803/Orchard,grapto/Orchard.CloudBust,geertdoornbos/Orchard,OrchardCMS/Orchard,jtkech/Orchard,rtpHarry/Orchard,abhishekluv/Orchard,gcsuk/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,Codinlab/Orchard,sfmskywalker/Orchard,Codinlab/Orchard,LaserSrl/Orchard,aaronamm/Orchard,hbulzy/Orchard,Serlead/Orchard,xkproject/Orchard,hannan-azam/Orchard,brownjordaninternational/OrchardCMS,OrchardCMS/Orchard,JRKelso/Orchard,abhishekluv/Orchard,SouleDesigns/SouleDesigns.Orchard,jagraz/Orchard,armanforghani/Orchard,LaserSrl/Orchard
|
src/Orchard.Tests/Tasks/SweepGeneratorTests.cs
|
src/Orchard.Tests/Tasks/SweepGeneratorTests.cs
|
using System;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.Environment;
using Orchard.Mvc;
using Orchard.Tasks;
using Orchard.Tests.Stubs;
using Orchard.Tests.Utility;
namespace Orchard.Tests.Tasks {
[TestFixture]
public class SweepGeneratorTests : ContainerTestBase {
protected override void Register(ContainerBuilder builder) {
builder.RegisterAutoMocking(MockBehavior.Loose);
builder.RegisterModule(new MvcModule());
builder.RegisterModule(new WorkContextModule());
builder.RegisterType<WorkContextAccessor>().As<IWorkContextAccessor>();
builder.RegisterType<SweepGenerator>();
}
protected override void Resolve(ILifetimeScope container) {
container.Mock<IHttpContextAccessor>()
.Setup(x => x.Current())
.Returns(() => null);
container.Mock<IWorkContextEvents>()
.Setup(x => x.Started());
}
[Test]
public void DoWorkShouldSendHeartbeatToTaskManager() {
var heartbeatSource = _container.Resolve<SweepGenerator>();
heartbeatSource.DoWork();
_container.Resolve<Mock<IBackgroundService>>()
.Verify(x => x.Sweep(), Times.Once());
}
[Test]
public void ActivatedEventShouldStartTimer() {
var heartbeatSource = _container.Resolve<SweepGenerator>();
heartbeatSource.Interval = TimeSpan.FromMilliseconds(25);
_container.Resolve<Mock<IBackgroundService>>()
.Verify(x => x.Sweep(), Times.Never());
heartbeatSource.Activate();
System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(80));
heartbeatSource.Terminate();
_container.Resolve<Mock<IBackgroundService>>()
.Verify(x => x.Sweep(), Times.AtLeastOnce());
}
}
}
|
using System;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.Environment;
using Orchard.Mvc;
using Orchard.Tasks;
using Orchard.Tests.Stubs;
using Orchard.Tests.Utility;
namespace Orchard.Tests.Tasks {
[TestFixture]
public class SweepGeneratorTests : ContainerTestBase {
protected override void Register(ContainerBuilder builder) {
builder.RegisterAutoMocking(MockBehavior.Loose);
builder.RegisterModule(new WorkContextModule());
builder.RegisterType<WorkContextAccessor>().As<IWorkContextAccessor>();
builder.RegisterType<SweepGenerator>();
}
protected override void Resolve(ILifetimeScope container) {
container.Mock<IHttpContextAccessor>()
.Setup(x => x.Current())
.Returns(() => null);
container.Mock<IWorkContextEvents>()
.Setup(x => x.Started());
}
[Test]
public void DoWorkShouldSendHeartbeatToTaskManager() {
var heartbeatSource = _container.Resolve<SweepGenerator>();
heartbeatSource.DoWork();
_container.Resolve<Mock<IBackgroundService>>()
.Verify(x => x.Sweep(), Times.Once());
}
[Test]
public void ActivatedEventShouldStartTimer() {
var heartbeatSource = _container.Resolve<SweepGenerator>();
heartbeatSource.Interval = TimeSpan.FromMilliseconds(25);
_container.Resolve<Mock<IBackgroundService>>()
.Verify(x => x.Sweep(), Times.Never());
heartbeatSource.Activate();
System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(80));
heartbeatSource.Terminate();
_container.Resolve<Mock<IBackgroundService>>()
.Verify(x => x.Sweep(), Times.AtLeastOnce());
}
}
}
|
bsd-3-clause
|
C#
|
5f9a522092b60691f07ca58dc6b96e54389e1d38
|
Apply stlye classes to the rejectec status tag
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/VacancyRejected.cshtml
|
src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/VacancyRejected.cshtml
|
@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel
<section class="dashboard-section">
<h2 class="section-heading heading-large">
Your apprenticeship advert
</h2>
<p>You have created a vacancy for your apprenticeship.</p>
<table class="responsive">
<tr>
<th scope="row" class="tw-35">
Title
</th>
<td class="tw-65">
@(Model?.Title)
</td>
</tr>
<tr>
<th scope="row">
Status
</th>
<td>
<strong class="govuk-tag govuk-tag--error">REJECTED</strong>
</td>
</tr>
</table>
<p>
<a href="@Model.ManageVacancyUrl" role="button" draggable="false" class="button">
Review your vacancy
</a>
</p>
</section>
|
@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel
<section class="dashboard-section">
<h2 class="section-heading heading-large">
Your apprenticeship advert
</h2>
<p>You have created a vacancy for your apprenticeship.</p>
<table class="responsive">
<tr>
<th scope="row" class="tw-35">
Title
</th>
<td class="tw-65">
@(Model?.Title)
</td>
</tr>
<tr>
<th scope="row">
Status
</th>
<td>
<span>REJECTED</span>
</td>
</tr>
</table>
<p>
<a href="@Model.ManageVacancyUrl" role="button" draggable="false" class="button">
Review your vacancy
</a>
</p>
</section>
|
mit
|
C#
|
27ffa489c8520c9bf590874df65469fb8e71c314
|
Bump version to .5 as .4 is branched (#653)
|
mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000
|
build/Packaging.cake
|
build/Packaging.cake
|
#!mono .cake/Cake/Cake.exe
var version = Argument("version", "0.5.0");
Task("Build-ObjC")
.Does(() =>
{
if (!IsRunningOnWindows ()) {
var exitCode = StartProcess("make", new ProcessSettings {
Arguments = new ProcessArgumentBuilder().Append ("-C").Append ("objcgen/").Append ("nuget-prep")
});
if (exitCode != 0)
throw new Exception ($"make nuget-prep in objcgen/ somehow failed: {exitCode}");
}
});
Task("Create-Package")
.IsDependentOn("Build-Binder")
.IsDependentOn("Download-Xamarin-Android")
.IsDependentOn("Build-ObjC")
.Does(() =>
{
var objcgenBuildDir = Directory("./objcgen/_build/");
var files = new []
{
new NuSpecContent { Source = objcgenBuildDir.ToString() + "/*", Target = "tools/" },
new NuSpecContent { Source = buildDir.ToString() + "/*.exe", Target = "tools/" },
new NuSpecContent { Source = buildDir.ToString() + "/*.dll", Target = "tools/" },
new NuSpecContent { Source = buildDir.ToString() + "/*.pdb", Target = "tools/" },
new NuSpecContent { Source = Directory("./external/jna").ToString() + "/**", Target = "external/jna" },
new NuSpecContent { Source = Directory("./external/Xamarin.Android").ToString() + "/**", Target = "external/Xamarin.Android" },
new NuSpecContent { Source = Directory("./support").ToString() + "/**", Target = "support/" },
};
var settings = new NuGetPackSettings
{
Verbosity = NuGetVerbosity.Detailed,
Version = version,
Files = files,
OutputDirectory = Directory("./build"),
NoPackageAnalysis = true
};
NuGetPack("./Embeddinator-4000.nuspec", settings);
});
Task("Publish-Package")
.Does(() =>
{
var apiKey = System.IO.File.ReadAllText ("./.cake/.nugetapikey");
var nupkg = "./build/Embeddinator-4000." + version + ".nupkg";
NuGetPush(nupkg, new NuGetPushSettings
{
Verbosity = NuGetVerbosity.Detailed,
Source = "https://www.nuget.org/api/v2/package",
ApiKey = apiKey
});
});
|
#!mono .cake/Cake/Cake.exe
var version = Argument("version", "0.4.0");
Task("Build-ObjC")
.Does(() =>
{
if (!IsRunningOnWindows ()) {
var exitCode = StartProcess("make", new ProcessSettings {
Arguments = new ProcessArgumentBuilder().Append ("-C").Append ("objcgen/").Append ("nuget-prep")
});
if (exitCode != 0)
throw new Exception ($"make nuget-prep in objcgen/ somehow failed: {exitCode}");
}
});
Task("Create-Package")
.IsDependentOn("Build-Binder")
.IsDependentOn("Download-Xamarin-Android")
.IsDependentOn("Build-ObjC")
.Does(() =>
{
var objcgenBuildDir = Directory("./objcgen/_build/");
var files = new []
{
new NuSpecContent { Source = objcgenBuildDir.ToString() + "/*", Target = "tools/" },
new NuSpecContent { Source = buildDir.ToString() + "/*.exe", Target = "tools/" },
new NuSpecContent { Source = buildDir.ToString() + "/*.dll", Target = "tools/" },
new NuSpecContent { Source = buildDir.ToString() + "/*.pdb", Target = "tools/" },
new NuSpecContent { Source = Directory("./external/jna").ToString() + "/**", Target = "external/jna" },
new NuSpecContent { Source = Directory("./external/Xamarin.Android").ToString() + "/**", Target = "external/Xamarin.Android" },
new NuSpecContent { Source = Directory("./support").ToString() + "/**", Target = "support/" },
};
var settings = new NuGetPackSettings
{
Verbosity = NuGetVerbosity.Detailed,
Version = version,
Files = files,
OutputDirectory = Directory("./build"),
NoPackageAnalysis = true
};
NuGetPack("./Embeddinator-4000.nuspec", settings);
});
Task("Publish-Package")
.Does(() =>
{
var apiKey = System.IO.File.ReadAllText ("./.cake/.nugetapikey");
var nupkg = "./build/Embeddinator-4000." + version + ".nupkg";
NuGetPush(nupkg, new NuGetPushSettings
{
Verbosity = NuGetVerbosity.Detailed,
Source = "https://www.nuget.org/api/v2/package",
ApiKey = apiKey
});
});
|
mit
|
C#
|
3cf09a97249dbfdd7d49a0bbcbab1230690fe1ce
|
comment addins for build.cake
|
Andrew-Brad/AB.Extensions
|
build.cake
|
build.cake
|
//#tool nuget:?package=Codecov
//#addin nuget:?package=Cake.Codecov
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor;
var packPath = Directory("./src/AB.Extensions");
var sourcePath = Directory("./src/AB.Extensions");
var testsPath = Directory("./test/AB.Extensions.Tests");
var buildArtifacts = Directory("./artifacts/packages");
var configuration = Argument<string>("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Build")
.IsDependentOn("Clean")
//.IsDependentOn("Version")
.IsDependentOn("Restore")
.Does(() => {
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration
// Runtime = IsRunningOnWindows() ? null : "unix-x64"
};
DotNetCoreBuild("./", settings);
});
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] { buildArtifacts });
});
//Task("Restore")
// .Does(() =>
// {
// DotNetCoreRestore("src");
// });
Task("Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
Sources = new [] { "https://api.nuget.org/v3/index.json" }
};
DotNetCoreRestore("./", settings);
DotNetCoreRestore(testsPath, settings);
});
Task("RunTests")
.IsDependentOn("Restore")
.IsDependentOn("Clean")
.Does( () =>
{
var settings = new DotNetCoreTestSettings { Configuration = configuration };
DotNetCoreTest("./test/AB.Extensions.Tests/AB.Extensions.Tests.csproj", settings);
});
//Task("UploadCodeCoverage")
//.IsDependentOn("RunTests")
//.Does( () =>
//{
// var settings = new CodecovSettings();
// settings.Dump = true; // more @ http://cakebuild.net/api/Cake.Codecov/CodecovSettings/
// settings.Verbose = true;
// settings.Files = new[] { "coverage.xml" };
// Codecov(settings);
//});
//{
// Upload a coverage report.
//Codecov("coverage.xml");
//});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("RunTests");
//.IsDependentOn("UploadCodeCoverage");
//.IsDependentOn("Pack");
RunTarget(target);
|
#tool nuget:?package=Codecov
#addin nuget:?package=Cake.Codecov
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor;
var packPath = Directory("./src/AB.Extensions");
var sourcePath = Directory("./src/AB.Extensions");
var testsPath = Directory("./test/AB.Extensions.Tests");
var buildArtifacts = Directory("./artifacts/packages");
var configuration = Argument<string>("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Build")
.IsDependentOn("Clean")
//.IsDependentOn("Version")
.IsDependentOn("Restore")
.Does(() => {
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration
// Runtime = IsRunningOnWindows() ? null : "unix-x64"
};
DotNetCoreBuild("./", settings);
});
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] { buildArtifacts });
});
//Task("Restore")
// .Does(() =>
// {
// DotNetCoreRestore("src");
// });
Task("Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
Sources = new [] { "https://api.nuget.org/v3/index.json" }
};
DotNetCoreRestore("./", settings);
DotNetCoreRestore(testsPath, settings);
});
Task("RunTests")
.IsDependentOn("Restore")
.IsDependentOn("Clean")
.Does( () =>
{
var settings = new DotNetCoreTestSettings { Configuration = configuration };
DotNetCoreTest("./test/AB.Extensions.Tests/AB.Extensions.Tests.csproj", settings);
});
//Task("UploadCodeCoverage")
//.IsDependentOn("RunTests")
//.Does( () =>
//{
// var settings = new CodecovSettings();
// settings.Dump = true; // more @ http://cakebuild.net/api/Cake.Codecov/CodecovSettings/
// settings.Verbose = true;
// settings.Files = new[] { "coverage.xml" };
// Codecov(settings);
//});
//{
// Upload a coverage report.
//Codecov("coverage.xml");
//});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("RunTests");
//.IsDependentOn("UploadCodeCoverage");
//.IsDependentOn("Pack");
RunTarget(target);
|
mit
|
C#
|
6286828866f28e76e2d1af74eb2b189a9c033fc5
|
update version
|
IdentityServer/IdentityServer4.Templates,IdentityServer/IdentityServer4.Templates,IdentityServer/IdentityServer4.Templates
|
build.cake
|
build.cake
|
var target = Argument("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var buildArtifacts = Directory("./artifacts/packages");
var packageVersion = "2.2.0";
///////////////////////////////////////////////////////////////////////////////
// Clean
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[]
{
buildArtifacts,
Directory("./feed/content/UI")
});
});
///////////////////////////////////////////////////////////////////////////////
// Copy
///////////////////////////////////////////////////////////////////////////////
Task("Copy")
.IsDependentOn("Clean")
.Does(() =>
{
CreateDirectory("./feed/content");
// copy the singel csproj templates
var files = GetFiles("./src/**/*.*");
CopyFiles(files, "./feed/content", true);
// copy the UI files
files = GetFiles("./ui/**/*.*");
CopyFiles(files, "./feed/content/ui", true);
});
///////////////////////////////////////////////////////////////////////////////
// Pack
///////////////////////////////////////////////////////////////////////////////
Task("Pack")
.IsDependentOn("Clean")
.IsDependentOn("Copy")
.Does(() =>
{
var settings = new NuGetPackSettings
{
Version = packageVersion,
OutputDirectory = buildArtifacts
};
if (AppVeyor.IsRunningOnAppVeyor)
{
settings.Version = packageVersion + "-b" + AppVeyor.Environment.Build.Number.ToString().PadLeft(4,'0');
}
NuGetPack("./feed/IdentityServer4.Templates.nuspec", settings);
});
Task("Default")
.IsDependentOn("Pack");
RunTarget(target);
|
var target = Argument("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var buildArtifacts = Directory("./artifacts/packages");
var packageVersion = "2.1.0";
///////////////////////////////////////////////////////////////////////////////
// Clean
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[]
{
buildArtifacts,
Directory("./feed/content/UI")
});
});
///////////////////////////////////////////////////////////////////////////////
// Copy
///////////////////////////////////////////////////////////////////////////////
Task("Copy")
.IsDependentOn("Clean")
.Does(() =>
{
CreateDirectory("./feed/content");
// copy the singel csproj templates
var files = GetFiles("./src/**/*.*");
CopyFiles(files, "./feed/content", true);
// copy the UI files
files = GetFiles("./ui/**/*.*");
CopyFiles(files, "./feed/content/ui", true);
});
///////////////////////////////////////////////////////////////////////////////
// Pack
///////////////////////////////////////////////////////////////////////////////
Task("Pack")
.IsDependentOn("Clean")
.IsDependentOn("Copy")
.Does(() =>
{
var settings = new NuGetPackSettings
{
Version = packageVersion,
OutputDirectory = buildArtifacts
};
if (AppVeyor.IsRunningOnAppVeyor)
{
settings.Version = packageVersion + "-b" + AppVeyor.Environment.Build.Number.ToString().PadLeft(4,'0');
}
NuGetPack("./feed/IdentityServer4.Templates.nuspec", settings);
});
Task("Default")
.IsDependentOn("Pack");
RunTarget(target);
|
apache-2.0
|
C#
|
cf877f85c74d1655b083556d579141d3d5b3a256
|
update build script to skip .net framework tests on non-Windows platforms
|
IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4
|
build.cake
|
build.cake
|
var target = Argument("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var packPath = Directory("./src/IdentityServer4");
var buildArtifacts = Directory("./artifacts/packages");
var isAppVeyor = AppVeyor.IsRunningOnAppVeyor;
var isWindows = IsRunningOnWindows();
///////////////////////////////////////////////////////////////////////////////
// Clean
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] { buildArtifacts });
});
///////////////////////////////////////////////////////////////////////////////
// Build
///////////////////////////////////////////////////////////////////////////////
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration
};
var projects = GetFiles("./src/**/*.csproj");
foreach(var project in projects)
{
DotNetCoreBuild(project.GetDirectory().FullPath, settings);
}
});
///////////////////////////////////////////////////////////////////////////////
// Test
///////////////////////////////////////////////////////////////////////////////
Task("Test")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = configuration
};
if (!isWindows)
{
Information("Not running on Windows - skipping tests for .NET Framework");
settings.Framework = "netcoreapp2.0";
}
var projects = GetFiles("./test/**/*.csproj");
foreach(var project in projects)
{
DotNetCoreTest(project.FullPath, settings);
}
});
///////////////////////////////////////////////////////////////////////////////
// Pack
///////////////////////////////////////////////////////////////////////////////
Task("Pack")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = buildArtifacts,
ArgumentCustomization = args => args.Append("--include-symbols")
};
// add build suffix for CI builds
if(isAppVeyor)
{
settings.VersionSuffix = "build" + AppVeyor.Environment.Build.Number.ToString().PadLeft(5,'0');
}
DotNetCorePack(packPath, settings);
});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Pack");
RunTarget(target);
|
var target = Argument("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var packPath = Directory("./src/IdentityServer4");
var buildArtifacts = Directory("./artifacts/packages");
var isAppVeyor = AppVeyor.IsRunningOnAppVeyor;
///////////////////////////////////////////////////////////////////////////////
// Clean
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] { buildArtifacts });
});
///////////////////////////////////////////////////////////////////////////////
// Build
///////////////////////////////////////////////////////////////////////////////
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
var settings = new DotNetCoreBuildSettings
{
Configuration = configuration
};
var projects = GetFiles("./**/*.csproj");
foreach(var project in projects)
{
DotNetCoreBuild(project.GetDirectory().FullPath, settings);
}
});
///////////////////////////////////////////////////////////////////////////////
// Test
///////////////////////////////////////////////////////////////////////////////
Task("Test")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = configuration
};
var projects = GetFiles("./test/**/*.csproj");
foreach(var project in projects)
{
DotNetCoreTest(project.FullPath, settings);
}
});
///////////////////////////////////////////////////////////////////////////////
// Pack
///////////////////////////////////////////////////////////////////////////////
Task("Pack")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = buildArtifacts,
ArgumentCustomization = args => args.Append("--include-symbols")
};
// add build suffix for CI builds
if(isAppVeyor)
{
settings.VersionSuffix = "build" + AppVeyor.Environment.Build.Number.ToString().PadLeft(5,'0');
}
DotNetCorePack(packPath, settings);
});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Pack");
RunTarget(target);
|
apache-2.0
|
C#
|
e91edab58062567c2d3853390fbfbb730efc0851
|
Set request object type for TraktPersonShowCreditsRequest.
|
henrikfroehling/TraktApiSharp
|
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/People/TraktPersonShowCreditsRequestTests.cs
|
Source/Tests/TraktApiSharp.Tests/Experimental/Requests/People/TraktPersonShowCreditsRequestTests.cs
|
namespace TraktApiSharp.Tests.Experimental.Requests.People
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TraktApiSharp.Experimental.Requests.People;
using TraktApiSharp.Objects.Get.People.Credits;
using TraktApiSharp.Requests;
[TestClass]
public class TraktPersonShowCreditsRequestTests
{
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestIsNotAbstract()
{
typeof(TraktPersonShowCreditsRequest).IsAbstract.Should().BeFalse();
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestIsSealed()
{
typeof(TraktPersonShowCreditsRequest).IsSealed.Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestIsSubclassOfATraktPersonCreditsRequest()
{
typeof(TraktPersonShowCreditsRequest).IsSubclassOf(typeof(ATraktPersonCreditsRequest<TraktPersonShowCredits>)).Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestHasAuthorizationNotRequired()
{
var request = new TraktPersonShowCreditsRequest(null);
request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.NotRequired);
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestHasValidUriTemplate()
{
var request = new TraktPersonShowCreditsRequest(null);
request.UriTemplate.Should().Be("people/{id}/shows{?extended}");
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestHasValidRequestObjectType()
{
var request = new TraktPersonShowCreditsRequest(null);
request.RequestObjectType.Should().Be(TraktRequestObjectType.People);
}
}
}
|
namespace TraktApiSharp.Tests.Experimental.Requests.People
{
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TraktApiSharp.Experimental.Requests.People;
using TraktApiSharp.Objects.Get.People.Credits;
using TraktApiSharp.Requests;
[TestClass]
public class TraktPersonShowCreditsRequestTests
{
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestIsNotAbstract()
{
typeof(TraktPersonShowCreditsRequest).IsAbstract.Should().BeFalse();
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestIsSealed()
{
typeof(TraktPersonShowCreditsRequest).IsSealed.Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestIsSubclassOfATraktPersonCreditsRequest()
{
typeof(TraktPersonShowCreditsRequest).IsSubclassOf(typeof(ATraktPersonCreditsRequest<TraktPersonShowCredits>)).Should().BeTrue();
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestHasAuthorizationNotRequired()
{
var request = new TraktPersonShowCreditsRequest(null);
request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.NotRequired);
}
[TestMethod, TestCategory("Requests"), TestCategory("People"), TestCategory("Credits"), TestCategory("Show")]
public void TestTraktPersonShowCreditsRequestHasValidUriTemplate()
{
var request = new TraktPersonShowCreditsRequest(null);
request.UriTemplate.Should().Be("people/{id}/shows{?extended}");
}
}
}
|
mit
|
C#
|
48deed4f230424e8db268f925a43c3bd6f1083d2
|
Fix AI Bug
|
shenchi/traffic_control_game
|
Assets/Scripts/CarAITestJustGo.cs
|
Assets/Scripts/CarAITestJustGo.cs
|
using UnityEngine;
using System.Collections;
/// <summary>
/// AI for debug, DO NOT use
/// </summary>
public class CarAITestJustGo : MonoBehaviour
{
public float speed;
public float gas_acceleration = 10.0f;
public float brake_acceleration = -20.0f;
private WayAgent agent;
//public float iniTime;
void Awake()
{
agent = GetComponent<WayAgent>();
//iniTime = Time.realtimeSinceStartup;
}
// Use this for initialization
void Start()
{
}
bool NeedStop()
{
// Check if there is a car in front of us
WayAgent agentInFront;
float distInFront;
bool stopForCar = false;
if (agent.VehicleInFront(out distInFront, out agentInFront))
{
stopForCar = (distInFront < 4);
}
// Check that if we are far enough from next point or the traffic light is green
return ((agent.GetCurrentTrafficLight() != TrafficLight.LightType.SteadyGreen) && agent.Distance < 3) || stopForCar;
}
void Gas()
{
if (speed <= 10.0f)
{
speed += gas_acceleration * Time.deltaTime;
}
}
void Brake()
{
if (speed > 0)
{
speed += brake_acceleration * Time.deltaTime;
}
else
{
speed = 0;
}
}
// Update is called once per frame
void Update()
{
if (NeedStop())
{
Brake();
}
else
{
Gas();
}
float dist = speed * Time.deltaTime;
agent.MoveForward(dist);
agent.AdjustToCurrentDirection();
}
}
|
using UnityEngine;
using System.Collections;
/// <summary>
/// AI for debug, DO NOT use
/// </summary>
public class CarAITestJustGo : MonoBehaviour
{
public float speed;
public float gas_acceleration = 10.0f;
public float brake_acceleration = -20.0f;
private WayAgent agent;
//public float iniTime;
void Awake()
{
agent = GetComponent<WayAgent>();
//iniTime = Time.realtimeSinceStartup;
}
// Use this for initialization
void Start()
{
}
bool NeedStop()
{
// Check if there is a car in front of us
WayAgent agentInFront;
float distInFront;
if (agent.VehicleInFront(out distInFront, out agentInFront))
{
return distInFront < 4;
}
// Check that if we are far enough from next point or the traffic light is green
return agent.Distance < 3 && (agent.GetCurrentTrafficLight() != TrafficLight.LightType.SteadyGreen);
}
void Gas()
{
if (speed <= 10.0f)
{
speed += gas_acceleration * Time.deltaTime;
}
}
void Brake()
{
if (speed > 0)
{
speed += brake_acceleration * Time.deltaTime;
}
else
{
speed = 0;
}
}
// Update is called once per frame
void Update()
{
if (NeedStop())
{
Brake();
}
else
{
Gas();
}
float dist = speed * Time.deltaTime;
agent.MoveForward(dist);
agent.AdjustToCurrentDirection();
}
}
|
mit
|
C#
|
d51bd402f02ecb3f38023090fa09d9dc3e095d54
|
fix code for unity 4.x
|
mr-kelly/slua,mr-kelly/slua,luzexi/slua-3rd-lib,pangweiwei/slua,jiangzhhhh/slua,yaukeywang/slua,haolly/slua_source_note,soulgame/slua,chiuan/slua,Roland0511/slua,Roland0511/slua,thing-nacho/slua,thing-nacho/slua,jiangzhhhh/slua,haolly/slua_source_note,chiuan/slua,yaukeywang/slua,Roland0511/slua,luzexi/slua-3rd,jiangzhhhh/slua,jiangzhhhh/slua,haolly/slua_source_note,thing-nacho/slua,mr-kelly/slua,jiangzhhhh/slua,chiuan/slua,mr-kelly/slua,yaukeywang/slua,soulgame/slua,luzexi/slua-3rd,chiuan/slua,pangweiwei/slua,luzexi/slua-3rd-lib,Roland0511/slua,luzexi/slua-3rd,thing-nacho/slua,haolly/slua_source_note,soulgame/slua,luzexi/slua-3rd-lib,Roland0511/slua,yaukeywang/slua,yaukeywang/slua,luzexi/slua-3rd-lib,haolly/slua_source_note,mr-kelly/slua,luzexi/slua-3rd,yaukeywang/slua,thing-nacho/slua,luzexi/slua-3rd,mr-kelly/slua,soulgame/slua,soulgame/slua,pangweiwei/slua,shrimpz/slua,chiuan/slua,soulgame/slua,jiangzhhhh/slua,shrimpz/slua,Roland0511/slua,luzexi/slua-3rd,luzexi/slua-3rd-lib,thing-nacho/slua,haolly/slua_source_note,pangweiwei/slua,luzexi/slua-3rd-lib,pangweiwei/slua,chiuan/slua
|
Assets/Slua/Editor/SLuaSetting.cs
|
Assets/Slua/Editor/SLuaSetting.cs
|
// The MIT License (MIT)
// Copyright 2015 Siney/Pangweiwei siney@yeah.net
//
// 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 UnityEngine;
using System.Collections;
using UnityEditor;
namespace SLua{
public enum EOL{
Native,
CRLF,
CR,
LF,
}
public class SLuaSetting : ScriptableObject {
public EOL eol = EOL.Native;
public bool exportExtensionMethod = true;
private static SLuaSetting _instance;
public static SLuaSetting Instance{
get{
if(_instance == null){
string path = "Assets/Slua/setting.asset";
#if UNITY_5
_instance = AssetDatabase.LoadAssetAtPath<SLuaSetting>(path);
#else
_instance = (SLuaSetting)AssetDatabase.LoadAssetAtPath(path,typeof(SLuaSetting));
#endif
if(_instance == null){
_instance = SLuaSetting.CreateInstance<SLuaSetting>();
AssetDatabase.CreateAsset(_instance,path);
}
}
return _instance;
}
}
[MenuItem("SLua/Setting")]
public static void Open(){
Selection.activeObject = Instance;
}
}
}
|
using UnityEngine;
using System.Collections;
using UnityEditor;
namespace SLua{
public enum EOL{
Native,
CRLF,
CR,
LF,
}
public class SLuaSetting : ScriptableObject {
public EOL eol = EOL.Native;
public bool exportExtensionMethod = true;
private static SLuaSetting _instance;
public static SLuaSetting Instance{
get{
if(_instance == null){
string path = "Assets/Slua/setting.asset";
_instance = AssetDatabase.LoadAssetAtPath<SLuaSetting>(path);
if(_instance == null){
_instance = SLuaSetting.CreateInstance<SLuaSetting>();
AssetDatabase.CreateAsset(_instance,path);
}
}
return _instance;
}
}
[MenuItem("SLua/Setting")]
public static void Open(){
Selection.activeObject = Instance;
}
}
}
|
mit
|
C#
|
aae121a2e31777b38dec471fcfc0fa6a22b4d08b
|
Document FlowDownwardForce API
|
drewnoakes/boing
|
Boing/Forces/FlowDownwardForce.cs
|
Boing/Forces/FlowDownwardForce.cs
|
#region License
// Copyright 2015-2017 Drew Noakes, Krzysztof Dul
//
// 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
namespace Boing
{
/// <summary>
/// A constant downwards force applied to all non-pinned points, akin to gravity.
/// </summary>
public sealed class FlowDownwardForce : IForce
{
/// <summary>
/// The magnitude of the downward force, in Newtons.
/// </summary>
public float Magnitude { get; set; }
/// <summary>
/// Initialises a new instance of <see cref="FlowDownwardForce"/>.
/// </summary>
/// <param name="magnitude">The magnitude of the downward force, in Newtons. The default value is 10.</param>
public FlowDownwardForce(float magnitude = 10.0f)
{
Magnitude = magnitude;
}
/// <inheritdoc />
void IForce.ApplyTo(Simulation simulation)
{
var force = new Vector2f(0, Magnitude);
foreach (var pointMass in simulation.PointMasses)
{
if (pointMass.IsPinned)
continue;
pointMass.ApplyForce(force);
}
}
}
}
|
#region License
// Copyright 2015-2017 Drew Noakes, Krzysztof Dul
//
// 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
namespace Boing
{
public sealed class FlowDownwardForce : IForce
{
/// <summary>
/// The magnitude of the downward force, in Newtons.
/// </summary>
public float Magnitude { get; set; }
/// <param name="magnitude">The magnitude of the downward force, in Newtons.</param>
public FlowDownwardForce(float magnitude = 10.0f)
{
Magnitude = magnitude;
}
/// <inheritdoc />
void IForce.ApplyTo(Simulation simulation)
{
var force = new Vector2f(0, Magnitude);
foreach (var pointMass in simulation.PointMasses)
{
if (pointMass.IsPinned)
continue;
pointMass.ApplyForce(force);
}
}
}
}
|
apache-2.0
|
C#
|
b472b0afafdb1b2211a5e2c1e07adbc4939caaa9
|
Update WeatherForecastController.cs (#11668)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/WeatherForecastController.cs
|
src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Server/Controllers/WeatherForecastController.cs
|
using BlazorHosted_CSharp.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace BlazorHosted_CSharp.Server.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
this.logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}
|
using BlazorHosted_CSharp.Shared;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BlazorHosted_CSharp.Server.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}
|
apache-2.0
|
C#
|
800f83f3adbe8783815d2a7cfcc5cfaa9d204acb
|
Make CSharpMath.Forms buildable again
|
verybadcat/CSharpMath
|
CSharpMath.Forms/MathKeyboardExtensions.cs
|
CSharpMath.Forms/MathKeyboardExtensions.cs
|
using SkiaSharp;
using SkiaSharp.Views.Forms;
namespace CSharpMath.Forms {
using Rendering.FrontEnd;
using SkiaSharp;
public static class MathKeyboardExtensions {
public static void BindDisplay(this MathKeyboard keyboard,
SKCanvasView view, MathPainter settings, SKColor caretColor,
CaretShape caretShape = CaretShape.IBeam, SKStrokeCap cap = SKStrokeCap.Butt) {
view.EnableTouchEvents = true;
view.Touch +=
(sender, e) => {
if (e.ActionType == SKTouchAction.Pressed)
keyboard.MoveCaretToPoint(new System.Drawing.PointF(e.Location.X, e.Location.Y));
};
keyboard.RedrawRequested += (_, __) => view.InvalidateSurface();
view.PaintSurface +=
(sender, e) => {
var c = e.Surface.Canvas;
c.Clear();
MathPainter.DrawDisplay(settings, keyboard.Display, c);
keyboard.DrawCaret(
new SkiaCanvas(c, cap, settings.AntiAlias), caretColor.FromNative(), caretShape);
};
}
}
}
|
using SkiaSharp;
using SkiaSharp.Views.Forms;
namespace CSharpMath.Forms {
using Rendering.FrontEnd;
using SkiaSharp;
public static class MathKeyboardExtensions {
public static void BindDisplay(this MathKeyboard keyboard,
SKCanvasView view, MathPainter settings, SKColor caretColor,
CaretShape caretShape = CaretShape.IBeam, SKStrokeCap cap = SKStrokeCap.Butt) {
view.EnableTouchEvents = true;
view.Touch +=
(sender, e) => {
if (e.ActionType == SKTouchAction.Pressed)
keyboard.MoveCaretToPoint(new System.Drawing.PointF(e.Location.X, e.Location.Y));
};
keyboard.RedrawRequested += (_, __) => view.InvalidateSurface();
view.PaintSurface +=
(sender, e) => {
var c = e.Surface.Canvas;
c.Clear();
MathPainter.DrawDisplay(settings, keyboard.Display, c);
keyboard.DrawCaret(
new SkiaCanvas(c, cap, AntiAlias.Enable), caretColor.FromNative(), caretShape);
};
}
}
}
|
mit
|
C#
|
aecfd529fb5e98969574c19d839688c9f5c3d16e
|
change the title of the main application
|
GiveCampUK/GiveCRM,GiveCampUK/GiveCRM
|
src/GiveCRM.Web/Views/Shared/_Layout.cshtml
|
src/GiveCRM.Web/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
</head>
<body>
<div class="page">
<div id="header">
<div id="title">
<h1>GiveCRM</h1>
</div>
<div id="logindisplay">
@Html.Partial("_LogOnPartial")
</div>
<div id="menucontainer">
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Campaigns", "Index", "Campaign")</li>
<li>@Html.ActionLink("Members", "Index", "Member")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
</ul>
</div>
</div>
<div id="main">
@RenderBody()
</div>
<div id="footer">
</div>
</div>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
</head>
<body>
<div class="page">
<div id="header">
<div id="title">
<h1>My MVC Application</h1>
</div>
<div id="logindisplay">
@Html.Partial("_LogOnPartial")
</div>
<div id="menucontainer">
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("Campaigns", "Index", "Campaign")</li>
<li>@Html.ActionLink("Members", "Index", "Member")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
</ul>
</div>
</div>
<div id="main">
@RenderBody()
</div>
<div id="footer">
</div>
</div>
</body>
</html>
|
mit
|
C#
|
f99907100bb119307ebd7f8fb009fbe99af7453e
|
Change tab bar selection color
|
xamarin/app-crm,qipengwu/app-crm,qipengwu/app-crm,jsauvexamarin/app-crm,xamarin/app-crm,xamarin-automation-service/app-crm,xamarin/app-crm,xamarin-automation-service/app-crm,jsauvexamarin/app-crm,qipengwu/app-crm,xamarin/app-crm,xamarin-automation-service/app-crm,jsauvexamarin/app-crm,qipengwu/app-crm,xamarin-automation-service/app-crm
|
src/MobileApp/XamarinCRM.iOS/AppDelegate.cs
|
src/MobileApp/XamarinCRM.iOS/AppDelegate.cs
|
//
// Copyright 2015 Xamarin Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Foundation;
using Syncfusion.SfChart.XForms.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Xamarin;
using XamarinCRM.Statics;
namespace XamarinCRM.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
new SfChartRenderer(); // This is necessary for initializing SyncFusion charts.
#if DEBUG
Xamarin.Calabash.Start();
#endif
// Azure Mobile Services initilization
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
// SQLite initialization
SQLitePCL.CurrentPlatform.Init();
// Xamarin.Forms initialization
Forms.Init();
// Xamarin.Forms.Maps initialization
FormsMaps.Init();
ImageCircle.Forms.Plugin.iOS.ImageCircleRenderer.Init ();
// Bootstrap the "core" Xamarin.Forms app
LoadApplication(new App());
// Apply OS-specific color theming
ConfigureApplicationTheming ();
return base.FinishedLaunching(app, options);
}
void ConfigureApplicationTheming ()
{
UINavigationBar.Appearance.TintColor = UIColor.White;
UINavigationBar.Appearance.BarTintColor = Palette._001.ToUIColor ();
UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.White };
UIBarButtonItem.Appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
UITabBar.Appearance.TintColor = UIColor.White;
UITabBar.Appearance.BarTintColor = UIColor.White;
UITabBar.Appearance.SelectedImageTintColor = Palette._003.ToUIColor ();
UITabBarItem.Appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = Palette._003.ToUIColor () }, UIControlState.Selected);
UIProgressView.Appearance.ProgressTintColor = Palette._003.ToUIColor ();
}
}
}
|
//
// Copyright 2015 Xamarin Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Foundation;
using Syncfusion.SfChart.XForms.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Xamarin;
using XamarinCRM.Statics;
namespace XamarinCRM.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
new SfChartRenderer(); // This is necessary for initializing SyncFusion charts.
#if DEBUG
Xamarin.Calabash.Start();
#endif
// Azure Mobile Services initilization
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
// SQLite initialization
SQLitePCL.CurrentPlatform.Init();
// Xamarin.Forms initialization
Forms.Init();
// Xamarin.Forms.Maps initialization
FormsMaps.Init();
ImageCircle.Forms.Plugin.iOS.ImageCircleRenderer.Init ();
// Bootstrap the "core" Xamarin.Forms app
LoadApplication(new App());
// Apply OS-specific color theming
ConfigureApplicationTheming ();
return base.FinishedLaunching(app, options);
}
void ConfigureApplicationTheming ()
{
UINavigationBar.Appearance.TintColor = UIColor.White;
UINavigationBar.Appearance.BarTintColor = Palette._001.ToUIColor ();
UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.White };
UIBarButtonItem.Appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
UIProgressView.Appearance.ProgressTintColor = Palette._003.ToUIColor ();
}
}
}
|
mit
|
C#
|
682b5fb056ae9ecc50dd863b6490f851d1508a70
|
Adjust health increase for drum roll tick to match new max result
|
peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,ppy/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs
|
osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Judgements
{
public class TaikoDrumRollTickJudgement : TaikoJudgement
{
public override HitResult MaxResult => HitResult.SmallTickHit;
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.SmallTickHit:
return 0.15;
default:
return 0;
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Judgements
{
public class TaikoDrumRollTickJudgement : TaikoJudgement
{
public override HitResult MaxResult => HitResult.SmallTickHit;
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
case HitResult.Great:
return 0.15;
default:
return 0;
}
}
}
}
|
mit
|
C#
|
c0d64bf409b1e7afb9868a8040459d7e1e30fa21
|
Use Gray instead of FromHex for grays
|
johnneijzen/osu,peppy/osu,naoey/osu,DrabWeb/osu,Drezi126/osu,ppy/osu,smoogipoo/osu,DrabWeb/osu,Nabile-Rahmani/osu,2yangk23/osu,johnneijzen/osu,naoey/osu,DrabWeb/osu,ZLima12/osu,smoogipooo/osu,2yangk23/osu,Frontear/osuKyzer,peppy/osu-new,smoogipoo/osu,naoey/osu,peppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,EVAST9919/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu
|
osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs
|
osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
{
public class TimelineButton : CompositeDrawable
{
public Action Action;
public readonly BindableBool Enabled = new BindableBool(true);
public FontAwesome Icon
{
get { return button.Icon; }
set { button.Icon = value; }
}
private readonly IconButton button;
public TimelineButton()
{
InternalChild = button = new IconButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
IconColour = OsuColour.Gray(0.35f),
IconHoverColour = Color4.White,
HoverColour = OsuColour.Gray(0.25f),
FlashColour = OsuColour.Gray(0.5f),
Action = () => Action?.Invoke()
};
button.Enabled.BindTo(Enabled);
Width = button.ButtonSize.X;
}
protected override void Update()
{
base.Update();
button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight);
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
{
public class TimelineButton : CompositeDrawable
{
public Action Action;
public readonly BindableBool Enabled = new BindableBool(true);
public FontAwesome Icon
{
get { return button.Icon; }
set { button.Icon = value; }
}
private readonly IconButton button;
public TimelineButton()
{
InternalChild = button = new IconButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
IconColour = OsuColour.FromHex("555"),
IconHoverColour = Color4.White,
HoverColour = OsuColour.FromHex("3A3A3A"),
FlashColour = OsuColour.FromHex("555"),
Action = () => Action?.Invoke()
};
button.Enabled.BindTo(Enabled);
Width = button.ButtonSize.X;
}
protected override void Update()
{
base.Update();
button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight);
}
}
}
|
mit
|
C#
|
780217820f75999964e3acff0aa014aa2be0f3f6
|
Remove unused import.
|
sshnet/SSH.NET,miniter/SSH.NET,Bloomcredit/SSH.NET
|
src/Renci.SshNet/Common/HostKeyEventArgs.cs
|
src/Renci.SshNet/Common/HostKeyEventArgs.cs
|
using System;
using Renci.SshNet.Security.Cryptography;
using Renci.SshNet.Security;
namespace Renci.SshNet.Common
{
/// <summary>
/// Provides data for the HostKeyReceived event.
/// </summary>
public class HostKeyEventArgs : EventArgs
{
/// <summary>
/// Gets or sets a value indicating whether host key can be trusted.
/// </summary>
/// <value>
/// <c>true</c> if host key can be trusted; otherwise, <c>false</c>.
/// </value>
public bool CanTrust { get; set; }
/// <summary>
/// Gets the host key.
/// </summary>
public byte[] HostKey { get; private set; }
/// <summary>
/// Gets the host key name.
/// </summary>
public string HostKeyName{ get; private set; }
/// <summary>
/// Gets the finger print.
/// </summary>
public byte[] FingerPrint { get; private set; }
/// <summary>
/// Gets the length of the key in bits.
/// </summary>
/// <value>
/// The length of the key in bits.
/// </value>
public int KeyLength { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="HostKeyEventArgs"/> class.
/// </summary>
/// <param name="host">The host.</param>
public HostKeyEventArgs(KeyHostAlgorithm host)
{
CanTrust = true; // Set default value
HostKey = host.Data;
HostKeyName = host.Name;
KeyLength = host.Key.KeyLength;
using (var md5 = HashAlgorithmFactory.CreateMD5())
{
FingerPrint = md5.ComputeHash(host.Data);
}
}
}
}
|
using System;
using System.Security.Cryptography;
using Renci.SshNet.Security.Cryptography;
using Renci.SshNet.Security;
namespace Renci.SshNet.Common
{
/// <summary>
/// Provides data for the HostKeyReceived event.
/// </summary>
public class HostKeyEventArgs : EventArgs
{
/// <summary>
/// Gets or sets a value indicating whether host key can be trusted.
/// </summary>
/// <value>
/// <c>true</c> if host key can be trusted; otherwise, <c>false</c>.
/// </value>
public bool CanTrust { get; set; }
/// <summary>
/// Gets the host key.
/// </summary>
public byte[] HostKey { get; private set; }
/// <summary>
/// Gets the host key name.
/// </summary>
public string HostKeyName{ get; private set; }
/// <summary>
/// Gets the finger print.
/// </summary>
public byte[] FingerPrint { get; private set; }
/// <summary>
/// Gets the length of the key in bits.
/// </summary>
/// <value>
/// The length of the key in bits.
/// </value>
public int KeyLength { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="HostKeyEventArgs"/> class.
/// </summary>
/// <param name="host">The host.</param>
public HostKeyEventArgs(KeyHostAlgorithm host)
{
CanTrust = true; // Set default value
HostKey = host.Data;
HostKeyName = host.Name;
KeyLength = host.Key.KeyLength;
using (var md5 = HashAlgorithmFactory.CreateMD5())
{
FingerPrint = md5.ComputeHash(host.Data);
}
}
}
}
|
mit
|
C#
|
23180e031550557eb412f4c2f1a43a2a2e2c2bda
|
increment version to 0.6.0
|
colored-console/colored-console,colored-console/colored-console
|
src/CommonAssemblyInfo.cs
|
src/CommonAssemblyInfo.cs
|
// <copyright file="CommonAssemblyInfo.cs" company="ColoredConsole contributors">
// Copyright (c) ColoredConsole contributors. (coloredconsole@gmail.com)
// </copyright>
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ColoredConsole contributors")]
[assembly: AssemblyCopyright("Copyright (c) ColoredConsole contributors. (coloredconsole@gmail.com)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("ColoredConsole")]
// NOTE (adamralph): the assembly versions are fixed at 0.0.0.0 - only NuGet package versions matter
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
// NOTE (adamralph): this is used for the NuGet package version
[assembly: AssemblyInformationalVersion("0.6.0")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
|
// <copyright file="CommonAssemblyInfo.cs" company="ColoredConsole contributors">
// Copyright (c) ColoredConsole contributors. (coloredconsole@gmail.com)
// </copyright>
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ColoredConsole contributors")]
[assembly: AssemblyCopyright("Copyright (c) ColoredConsole contributors. (coloredconsole@gmail.com)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyProduct("ColoredConsole")]
// NOTE (adamralph): the assembly versions are fixed at 0.0.0.0 - only NuGet package versions matter
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
// NOTE (adamralph): this is used for the NuGet package version
[assembly: AssemblyInformationalVersion("0.5.0")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
|
mit
|
C#
|
feb3265ea52e28e193822c585be5c9322c38c09b
|
Update font-awesome
|
martincostello/website,martincostello/website,martincostello/website,martincostello/website
|
src/Website/Pages/Shared/_StylesBody.cshtml
|
src/Website/Pages/Shared/_StylesBody.cshtml
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.2.0/flatly/bootstrap.min.css" integrity="sha512-SAOc0O+NBGM2HuPF20h4nse270bwZJi8X90t5k/ApuB9oasBYEyLJ7WtYcWZARWiSlKJpZch1+ip2mmhvlIvzQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="~/assets/css/site.css" asp-append-version="true" asp-inline="true" asp-minify-inlined="true" />
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.2.0/flatly/bootstrap.min.css" integrity="sha512-SAOc0O+NBGM2HuPF20h4nse270bwZJi8X90t5k/ApuB9oasBYEyLJ7WtYcWZARWiSlKJpZch1+ip2mmhvlIvzQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css" integrity="sha512-1sCRPdkRXhBV2PBLUdRb4tMg1w2YPf37qatUFeS7zlBy7jJI8Lf4VHwWfZZfpXtYSLy85pkm9GaYVYMfw5BC1A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="~/assets/css/site.css" asp-append-version="true" asp-inline="true" asp-minify-inlined="true" />
|
apache-2.0
|
C#
|
3cdfa5955eeb8d1a06c48392976230c869d0e64e
|
undo changes
|
mmanela/diffplex,mmanela/diffplex,mmanela/diffplex,mmanela/diffplex
|
DiffPlex.ConsoleRunner/Program.cs
|
DiffPlex.ConsoleRunner/Program.cs
|
using System;
using DiffPlex.DiffBuilder;
using DiffPlex.DiffBuilder.Model;
namespace DiffPlex.ConsoleRunner
{
internal static class Program
{
private static void Main()
{
var diffBuilder = new InlineDiffBuilder(new Differ());
var diff = diffBuilder.BuildDiffModel(OldText, NewText);
foreach (var line in diff.Lines)
{
switch (line.Type)
{
case ChangeType.Inserted:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("+ ");
break;
case ChangeType.Deleted:
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("- ");
break;
default:
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" ");
break;
}
Console.WriteLine(line.Text);
}
}
private const string OldText =
@"We the people
of the united states of america
establish justice
ensure domestic tranquility
provide for the common defence
secure the blessing of liberty
to ourselves and our posterity
";
private const string NewText =
@"We the people
in order to form a more perfect union
establish justice
ensure domestic tranquility
promote the general welfare and
secure the blessing of liberty
to ourselves and our posterity
do ordain and establish this constitution
for the United States of America
";
}
}
|
using System;
using DiffPlex.DiffBuilder;
using DiffPlex.DiffBuilder.Model;
namespace DiffPlex.ConsoleRunner
{
internal static class Program
{
private static void Main()
{
var diffBuilder = new InlineDiffBuilder(new Differ());
var diff = diffBuilder.BuildDiffModel(OldText, NewText);
foreach (var line in diff.Lines)
{
switch (line.Type)
{
case ChangeType.Inserted:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("+ ");
break;
case ChangeType.Deleted:
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("- ");
break;
default:
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" ");
break;
}
Console.WriteLine(line.Text);
}
}
internal const string OldText =
@"ABCDEFG hijklmn 01234567 _!# 98?
We the people
of the united states of america
establish justice
ensure domestic tranquility
provide for the common defence
secure the blessing of liberty
to ourselves and our posterity
=======
";
internal const string NewText =
@"ABCDEFG oooo 01234567 _!# 98?
We the people
of the united states of america
establish justice
ensure domestic tranquility
provide for the common defence
secure the blessing of liberty
to ourselves and our posterity
=======
";
// private const string OldText =
// @"We the people
//of the united states of america
//establish justice
//ensure domestic tranquility
//provide for the common defence
//secure the blessing of liberty
//to ourselves and our posterity
//";
// private const string NewText =
// @"We the people
//in order to form a more perfect union
//establish justice
//ensure domestic tranquility
//promote the general welfare and
//secure the blessing of liberty
//to ourselves and our posterity
//do ordain and establish this constitution
//for the United States of America
//";
}
}
|
apache-2.0
|
C#
|
5e5343b7d6b8da315849c8871e1a7987bd1254c9
|
Add RichTextLabel.Wrap for default RTF text formatting
|
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
|
Core/RichTextLabel.cs
|
Core/RichTextLabel.cs
|
using System;
using System.Windows.Forms;
namespace TweetDick.Core{
public partial class RichTextLabel : RichTextBox{
/// <summary>
/// Wraps the body of a RTF formatted string with default tags and formatting.
/// </summary>
public static string Wrap(string str){
string rtf = @"{\rtf1\ansi\ansicpg1250\deff0\deflang1029{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}";
rtf += @"{\*\generator Msftedit 4.20.69.1337;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang1036\f0\fs20 ";
rtf += str;
return rtf;
}
public RichTextLabel(){
InitializeComponent();
SetStyle(ControlStyles.Selectable,false);
SetStyle(ControlStyles.UserMouse,true);
SetStyle(ControlStyles.SupportsTransparentBackColor,true);
}
private void RichTextLabel_MouseEnter(object sender, EventArgs e){
Cursor = Cursors.Default;
}
protected override void WndProc(ref Message m){
if (m.Msg == 0x204 || m.Msg == 0x205){ // WM_RBUTTONDOWN, WM_RBUTTONUP
return;
}
base.WndProc(ref m);
}
}
}
|
using System;
using System.Windows.Forms;
namespace TweetDick.Core{
public partial class RichTextLabel : RichTextBox{
public RichTextLabel(){
InitializeComponent();
SetStyle(ControlStyles.Selectable,false);
SetStyle(ControlStyles.UserMouse,true);
SetStyle(ControlStyles.SupportsTransparentBackColor,true);
}
private void RichTextLabel_MouseEnter(object sender, EventArgs e){
Cursor = Cursors.Default;
}
protected override void WndProc(ref Message m){
if (m.Msg == 0x204 || m.Msg == 0x205){ // WM_RBUTTONDOWN, WM_RBUTTONUP
return;
}
base.WndProc(ref m);
}
}
}
|
mit
|
C#
|
e4ae82939f7a2b6a35a0fc717051065cbae45b02
|
Add missing [Table] attribute
|
DevExpress/DevExtreme.AspNet.Data,DevExpress/DevExtreme.AspNet.Data,AlekseyMartynov/DevExtreme.AspNet.Data,AlekseyMartynov/DevExtreme.AspNet.Data,DevExpress/DevExtreme.AspNet.Data,AlekseyMartynov/DevExtreme.AspNet.Data,DevExpress/DevExtreme.AspNet.Data,AlekseyMartynov/DevExtreme.AspNet.Data
|
net/DevExtreme.AspNet.Data.Tests.EFCore/Async.cs
|
net/DevExtreme.AspNet.Data.Tests.EFCore/Async.cs
|
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Threading.Tasks;
using Xunit;
namespace DevExtreme.AspNet.Data.Tests.EFCore {
public class Async {
[Table(nameof(Async) + "_" + nameof(DataItem))]
public class DataItem : AsyncTestHelper.IDataItem {
public int ID { get; set; }
public int Value { get; set; }
}
[Fact]
public async Task Scenario() {
await TestDbContext.ExecAsync(async context => {
var set = context.Set<DataItem>();
set.AddRange(AsyncTestHelper.CreateTestData(() => new DataItem()));
await context.SaveChangesAsync();
await AsyncTestHelper.RunAsync(set);
});
}
}
}
|
using System;
using System.Threading.Tasks;
using Xunit;
namespace DevExtreme.AspNet.Data.Tests.EFCore {
public class Async {
public class DataItem : AsyncTestHelper.IDataItem {
public int ID { get; set; }
public int Value { get; set; }
}
[Fact]
public async Task Scenario() {
await TestDbContext.ExecAsync(async context => {
var set = context.Set<DataItem>();
set.AddRange(AsyncTestHelper.CreateTestData(() => new DataItem()));
await context.SaveChangesAsync();
await AsyncTestHelper.RunAsync(set);
});
}
}
}
|
mit
|
C#
|
af15eaac394d604401e8a97410b7b9f6dd424521
|
tweak test app
|
emertechie/SyslogNet,nE0sIghT/SyslogNet,YallaDotNet/syslog
|
TesterApp/Program.cs
|
TesterApp/Program.cs
|
using System;
using System.IO;
using System.Net.Sockets;
using CommandLine;
using SyslogNet;
namespace TesterApp
{
public static class Program
{
public static void Main(string[] args)
{
var options = new Options();
if (new CommandLineParser().ParseArguments(args, options))
{
var syslogMessage = new SyslogMessage(
DateTimeOffset.Now,
Facility.UserLevelMessages,
Severity.Error,
//Facility.UserLevelMessages,
//Severity.Informational,
options.HostName ?? Environment.MachineName,
options.AppName,
options.ProcId,
options.MsgType,
options.Message);
var client = new UdpClient(options.SyslogServerHostname, options.SyslogServerPort);
try
{
using (var stream = new MemoryStream())
{
var serializer = new SyslogRfc3164MessageSerializer();
serializer.Serialize(syslogMessage, stream);
stream.Position = 0;
var datagramBytes = new byte[stream.Length];
stream.Read(datagramBytes, 0, (int)stream.Length);
client.Send(datagramBytes, (int)stream.Length);
}
}
finally
{
client.Close();
}
}
}
}
internal class Options
{
[Option("h", "hostName", Required = false, HelpText = "The host name. If not set, defaults to the NetBIOS name of the local machine")]
public string HostName { get; set; }
[Option("a", "appName", Required = false, HelpText = "The application name")]
public string AppName { get; set; }
[Option("p", "procId", Required = false, HelpText = "The process identifier")]
public string ProcId { get; set; }
[Option("t", "msgType", Required = false, HelpText = "The message type (called msgId in spec)")]
public string MsgType { get; set; }
[Option("m", "msg", Required = false, HelpText = "The message")]
public string Message { get; set; }
[Option("s", "syslogServer", Required = true, HelpText = "Host name of the syslog server")]
public string SyslogServerHostname { get; set; }
[Option("r", "syslogPort", Required = true, HelpText = "The syslog server port")]
public int SyslogServerPort { get; set; }
}
}
|
using System;
using System.IO;
using System.Net.Sockets;
using CommandLine;
using SyslogNet;
namespace TesterApp
{
public static class Program
{
public static void Main(string[] args)
{
var options = new Options();
if (new CommandLineParser().ParseArguments(args, options))
{
var syslogMessage = new SyslogMessage(
DateTimeOffset.Now,
Facility.UserLevelMessages,
Severity.Error,
//Facility.UserLevelMessages,
//Severity.Informational,
options.HostName ?? Environment.MachineName,
options.AppName,
options.ProcId,
options.MsgType,
options.Message);
var client = new UdpClient(options.SyslogServerHostname, options.SyslogServerPort);
try
{
using (var stream = new MemoryStream())
{
var serializer = new SyslogRfc5424MessageSerializer();
serializer.Serialize(syslogMessage, stream);
stream.Position = 0;
byte[] datagramBytes = stream.GetBuffer();
client.Send(datagramBytes, (int)stream.Length);
}
}
finally
{
client.Close();
}
}
}
}
internal class Options
{
[Option("h", "hostName", Required = false, HelpText = "The host name. If not set, defaults to the NetBIOS name of the local machine")]
public string HostName { get; set; }
[Option("a", "appName", Required = false, HelpText = "The application name")]
public string AppName { get; set; }
[Option("p", "procId", Required = false, HelpText = "The process identifier")]
public string ProcId { get; set; }
[Option("t", "msgType", Required = false, HelpText = "The message type (called msgId in spec)")]
public string MsgType { get; set; }
[Option("m", "msg", Required = false, HelpText = "The message")]
public string Message { get; set; }
[Option("s", "syslogServer", Required = true, HelpText = "Host name of the syslog server")]
public string SyslogServerHostname { get; set; }
[Option("r", "syslogPort", Required = true, HelpText = "The syslog server port")]
public int SyslogServerPort { get; set; }
}
}
|
mit
|
C#
|
0916f09284a74eb594219b118ee630238d9525cc
|
make users lowercase to avoid duplication
|
Codestellation/Galaxy,Codestellation/Galaxy,Codestellation/Galaxy
|
src/Galaxy/Domain/User.cs
|
src/Galaxy/Domain/User.cs
|
using Nejdb.Bson;
namespace Codestellation.Galaxy.Domain
{
public class User
{
private string _login;
public ObjectId Id { get; internal set; }
public string Login
{
get { return _login; }
set { _login = string.IsNullOrWhiteSpace(value) ? value : value.ToLowerInvariant(); }
}
public bool IsAdmin { get; set; }
public bool IsDomain { get; set; }
}
}
|
using Nejdb.Bson;
namespace Codestellation.Galaxy.Domain
{
public class User
{
public ObjectId Id { get; internal set; }
public string Login { get; set; }
public bool IsAdmin { get; set; }
public bool IsDomain { get; set; }
}
}
|
apache-2.0
|
C#
|
fe1db71bae7603dac653a0857356ba0e1ec90270
|
Add start log to commands
|
GAnatoliy/geochallenger,GAnatoliy/geochallenger
|
GeoChallenger.Commands/Program.cs
|
GeoChallenger.Commands/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using GeoChallenger.Commands.Commands;
using GeoChallenger.Commands.Config;
using NLog;
using NLog.Fluent;
namespace GeoChallenger.Commands
{
class Program
{
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
// NOTE: Only one command is supported at this moement.
static void Main(string[] args)
{
_log.Info("Start GeoChallenger.Commands");
try {
var mapperConfiguration = MapperConfig.CreateMapperConfiguration();
var container = DIConfig.RegisterDI(mapperConfiguration);
// All components have single instance scope.
using (var scope = container.BeginLifetimeScope()) {
var command = scope.Resolve<ReindexCommand>();
command.RunAsync().Wait();
}
} catch (Exception ex) {
_log.Error(ex, "Command is failed.");
}
_log.Info("End GeoChallenger.Commands");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using GeoChallenger.Commands.Commands;
using GeoChallenger.Commands.Config;
using NLog;
namespace GeoChallenger.Commands
{
class Program
{
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
// NOTE: Only one command is supported at this moement.
static void Main(string[] args)
{
try {
var mapperConfiguration = MapperConfig.CreateMapperConfiguration();
var container = DIConfig.RegisterDI(mapperConfiguration);
// All components have single instance scope.
using (var scope = container.BeginLifetimeScope()) {
var command = scope.Resolve<ReindexCommand>();
command.RunAsync().Wait();
}
} catch (Exception ex) {
_log.Error(ex, "Command is failed.");
}
}
}
}
|
mit
|
C#
|
7c640f05a017c5836614993a3ec517eefd97b65b
|
Update ForeignExchangeRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Finance/ForeignExchange/Data/LiteDB/ForeignExchangeRepository.cs
|
TIKSN.Core/Finance/ForeignExchange/Data/LiteDB/ForeignExchangeRepository.cs
|
using LiteDB;
using TIKSN.Data.LiteDB;
namespace TIKSN.Finance.ForeignExchange.Data.LiteDB
{
public class ForeignExchangeRepository : LiteDbRepository<ForeignExchangeEntity, int>, IForeignExchangeRepository
{
public ForeignExchangeRepository(ILiteDbDatabaseProvider databaseProvider) : base(databaseProvider,
"ForeignExchanges", x => new BsonValue(x))
{
}
}
}
|
using LiteDB;
using TIKSN.Data.LiteDB;
namespace TIKSN.Finance.ForeignExchange.Data.LiteDB
{
public class ForeignExchangeRepository : LiteDbRepository<ForeignExchangeEntity, int>, IForeignExchangeRepository
{
public ForeignExchangeRepository(ILiteDbDatabaseProvider databaseProvider) : base(databaseProvider, "ForeignExchanges", x => new BsonValue(x))
{
}
}
}
|
mit
|
C#
|
83739240ba5ca1ff68d14208cea783a93922b21c
|
Fix some error cases in SubRatingsConverter
|
InfiniteSoul/Azuria
|
Azuria/Api/v1/Converters/SubRatingsConverter.cs
|
Azuria/Api/v1/Converters/SubRatingsConverter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Azuria.UserInfo.Comment;
using Newtonsoft.Json;
namespace Azuria.Api.v1.Converters
{
internal class SubRatingsConverter : JsonConverter
{
#region Methods
/// <summary>
/// Determines whether this instance can convert the specified object type.
/// </summary>
/// <param name="objectType">Type of the object.</param>
/// <returns>
/// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.
/// </returns>
public override bool CanConvert(Type objectType)
{
return objectType == typeof(string);
}
/// <summary>Reads the JSON representation of the object.</summary>
/// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader" /> to read from.</param>
/// <param name="objectType">Type of the object.</param>
/// <param name="existingValue">The existing value of object being read.</param>
/// <param name="serializer">The calling serializer.</param>
/// <returns>The object value.</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
try
{
if (string.IsNullOrEmpty(reader.Value.ToString()) || reader.Value.ToString().Equals("[]"))
return new Dictionary<RatingCategory, int>();
return JsonConvert.DeserializeObject<Dictionary<string, int>>(reader.Value.ToString())
.ToDictionary(
keyValuePair => (RatingCategory) Enum.Parse(typeof(RatingCategory), keyValuePair.Key, true),
keyValuePair => keyValuePair.Value);
}
catch (Exception)
{
return new Dictionary<RatingCategory, int>();
}
}
/// <summary>Writes the JSON representation of the object.</summary>
/// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param>
/// <param name="value">The value.</param>
/// <param name="serializer">The calling serializer.</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Azuria.UserInfo.Comment;
using Newtonsoft.Json;
namespace Azuria.Api.v1.Converters
{
internal class SubRatingsConverter : JsonConverter
{
#region Methods
/// <summary>
/// Determines whether this instance can convert the specified object type.
/// </summary>
/// <param name="objectType">Type of the object.</param>
/// <returns>
/// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.
/// </returns>
public override bool CanConvert(Type objectType)
{
return objectType == typeof(string);
}
/// <summary>Reads the JSON representation of the object.</summary>
/// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader" /> to read from.</param>
/// <param name="objectType">Type of the object.</param>
/// <param name="existingValue">The existing value of object being read.</param>
/// <param name="serializer">The calling serializer.</param>
/// <returns>The object value.</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
try
{
return JsonConvert.DeserializeObject<Dictionary<string, int>>(reader.Value.ToString())
.ToDictionary(
keyValuePair => (RatingCategory) Enum.Parse(typeof(RatingCategory), keyValuePair.Key, true),
keyValuePair => keyValuePair.Value);
}
catch (Exception)
{
return new Dictionary<RatingCategory, int>();
}
}
/// <summary>Writes the JSON representation of the object.</summary>
/// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param>
/// <param name="value">The value.</param>
/// <param name="serializer">The calling serializer.</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
#endregion
}
}
|
mit
|
C#
|
3f7eb970e31c67a23e9939973eb4eecbcf9db5ca
|
set multiline rule
|
WTobor/BoardGamesNook,WTobor/BoardGamesNook,WTobor/BoardGamesNook,WTobor/BoardGamesNook
|
BoardGamesNook/Validators/GameTableValidator.cs
|
BoardGamesNook/Validators/GameTableValidator.cs
|
using BoardGamesNook.ViewModels.GameTable;
using FluentValidation;
namespace BoardGamesNook.Validators
{
public class GameTableValidator : AbstractValidator<GameTableViewModel>
{
public GameTableValidator()
{
RuleFor(gameTable => gameTable.City)
.MinimumLength(3).WithMessage("Miasto musi mieć minimum 3 znaki!")
.Matches("^[a-zA-Z\\s]+$").WithMessage("Miasto musi się składać z liter!");
}
}
}
|
using BoardGamesNook.ViewModels.GameTable;
using FluentValidation;
namespace BoardGamesNook.Validators
{
public class GameTableValidator : AbstractValidator<GameTableViewModel>
{
public GameTableValidator()
{
RuleFor(gameTable => gameTable.City).MinimumLength(3).WithMessage("Miasto musi mieć minimum 3 znaki!");
RuleFor(gameTable => gameTable.City).Matches("^[a-zA-Z\\s]+$")
.WithMessage("Miasto musi się składać z liter!");
}
}
}
|
mit
|
C#
|
1f692ec7dba0fb6eb5ff552ee0fb117e0a0087e3
|
fix - sort need a array of element with the same type.
|
jdevillard/JmesPath.Net
|
src/jmespath.net/Functions/SortFunction.cs
|
src/jmespath.net/Functions/SortFunction.cs
|
using System;
using System.Linq;
using System.Linq.Expressions;
using DevLab.JmesPath.Expressions;
using DevLab.JmesPath.Tokens;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using JmesPathFunction = DevLab.JmesPath.Interop.JmesPathFunction;
namespace DevLab.JmesPath.Functions
{
public class SortFunction : JmesPathFunction
{
public SortFunction()
: base("sort", 1)
{
}
public override bool Validate(params JmesPathArgument[] args)
{
var list = args[0].AsJToken();
if(list.Type != JTokenType.Array)
throw new Exception("invalid-type");
var arg = ((JArray) list);
if (arg.Count != 0)
{
var types = arg.Select(u => u.Type).Distinct();
if (types.Count() != 1)
throw new Exception("invalid-type");
}
return true;
}
public override JToken Execute(params JmesPathArgument[] args)
{
var list = (JArray)(args[0].AsJToken()).AsJEnumerable();
var ordered = list
.OrderBy(u => u.Value<String>())
.ToArray();
return new JArray(ordered.AsJEnumerable());
}
}
}
|
using System;
using System.Linq;
using System.Linq.Expressions;
using DevLab.JmesPath.Expressions;
using DevLab.JmesPath.Tokens;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using JmesPathFunction = DevLab.JmesPath.Interop.JmesPathFunction;
namespace DevLab.JmesPath.Functions
{
public class SortFunction : JmesPathFunction
{
public SortFunction()
: base("sort", 1)
{
}
public override bool Validate(params JmesPathArgument[] args)
{
var list = args[0].AsJToken();
if(list.Type != JTokenType.Array)
throw new Exception("invalid-type");
return true;
}
public override JToken Execute(params JmesPathArgument[] args)
{
var list = (JArray)(args[0].AsJToken()).AsJEnumerable();
var ordered = list.OrderBy(u => u.Value<String>()).ToArray();
return new JArray(ordered.AsJEnumerable());
}
}
}
|
apache-2.0
|
C#
|
d8e94e2496e515aed847f2703dc362bde4ac9130
|
Rename test
|
kei10in/KipSharp
|
KipTest/PrintSchemaReaderTests.cs
|
KipTest/PrintSchemaReaderTests.cs
|
using Kip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Xunit;
using psk = Kip.PrintSchemaKeywords;
using xsd = Kip.XmlSchema;
namespace KipTest
{
public class PrintSchemaReaderTests
{
[Fact]
public void ReadSimpleFeatureOptionStructure()
{
Assembly assembly = this.GetType().GetTypeInfo().Assembly;
var names = assembly.GetManifestResourceNames();
var stream = assembly.GetManifestResourceStream("KipTest.Data.SimpleFeatureOptionStructure.xml");
var reader = XmlReader.Create(stream);
var actual = PrintSchemaReader.Read(reader);
Assert.NotNull(actual);
Assert.True(0 < actual.Features().Count());
var f = actual.Feature(psk.JobCollateAllDocuments);
Assert.NotNull(f);
Assert.True(0 < f.Options().Count());
}
}
}
|
using Kip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Xunit;
using psk = Kip.PrintSchemaKeywords;
using xsd = Kip.XmlSchema;
namespace KipTest
{
public class PrintSchemaReaderTests
{
[Fact]
public void MyTestMethod()
{
Assembly assembly = this.GetType().GetTypeInfo().Assembly;
var names = assembly.GetManifestResourceNames();
var stream = assembly.GetManifestResourceStream("KipTest.Data.SimpleFeatureOptionStructure.xml");
var reader = XmlReader.Create(stream);
var actual = PrintSchemaReader.Read(reader);
Assert.NotNull(actual);
Assert.True(0 < actual.Features().Count());
var f = actual.Feature(psk.JobCollateAllDocuments);
Assert.NotNull(f);
Assert.True(0 < f.Options().Count());
}
}
}
|
mit
|
C#
|
45c761578ebf6a7d1ed0a32c50cb8d98b30a2bdb
|
Make it possible to specify schedulign queue name
|
jacobpovar/MassTransit,phatboyg/MassTransit,MassTransit/MassTransit,SanSYS/MassTransit,jacobpovar/MassTransit,SanSYS/MassTransit,phatboyg/MassTransit,MassTransit/MassTransit
|
src/MassTransit.QuartzIntegration/QuartzIntegrationExtensions.cs
|
src/MassTransit.QuartzIntegration/QuartzIntegrationExtensions.cs
|
// Copyright 2007-2016 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit
{
using System;
using GreenPipes;
using Quartz;
using Quartz.Impl;
using QuartzIntegration;
using QuartzIntegration.Configuration;
using Scheduling;
public static class QuartzIntegrationExtensions
{
public static void UseInMemoryScheduler(this IBusFactoryConfigurator configurator, string queueName = "quartz")
{
if (configurator == null)
throw new ArgumentNullException(nameof(configurator));
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
var scheduler = schedulerFactory.GetScheduler();
configurator.ReceiveEndpoint(queueName, e =>
{
var partitioner = configurator.CreatePartitioner(16);
e.Consumer(() => new ScheduleMessageConsumer(scheduler), x =>
x.Message<ScheduleMessage>(m => m.UsePartitioner(partitioner, p => p.Message.CorrelationId)));
e.Consumer(() => new CancelScheduledMessageConsumer(scheduler), x =>
x.Message<CancelScheduledMessage>(m => m.UsePartitioner(partitioner, p => p.Message.TokenId)));
configurator.UseMessageScheduler(e.InputAddress);
var specification = new SchedulerBusFactorySpecification(scheduler, e.InputAddress);
configurator.AddBusFactorySpecification(specification);
});
}
}
}
|
// Copyright 2007-2016 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit
{
using System;
using GreenPipes;
using Quartz;
using Quartz.Impl;
using QuartzIntegration;
using QuartzIntegration.Configuration;
using Scheduling;
public static class QuartzIntegrationExtensions
{
public static void UseInMemoryScheduler(this IBusFactoryConfigurator configurator)
{
if (configurator == null)
throw new ArgumentNullException(nameof(configurator));
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
var scheduler = schedulerFactory.GetScheduler();
configurator.ReceiveEndpoint("quartz", e =>
{
var partitioner = configurator.CreatePartitioner(16);
e.Consumer(() => new ScheduleMessageConsumer(scheduler), x =>
x.Message<ScheduleMessage>(m => m.UsePartitioner(partitioner, p => p.Message.CorrelationId)));
e.Consumer(() => new CancelScheduledMessageConsumer(scheduler), x =>
x.Message<CancelScheduledMessage>(m => m.UsePartitioner(partitioner, p => p.Message.TokenId)));
configurator.UseMessageScheduler(e.InputAddress);
var specification = new SchedulerBusFactorySpecification(scheduler, e.InputAddress);
configurator.AddBusFactorySpecification(specification);
});
}
}
}
|
apache-2.0
|
C#
|
123441ce7df65090e3051f51865e6d8557ce2e46
|
use native name of languages
|
stakira/OpenUtau,stakira/OpenUtau
|
OpenUtau/ViewModels/Converters.cs
|
OpenUtau/ViewModels/Converters.cs
|
using System;
using System.Globalization;
using System.Text;
using Avalonia.Data.Converters;
namespace OpenUtau.App.ViewModels {
public class CultureNameConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is CultureInfo cultureInfo) {
return cultureInfo.NativeName;
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
public class EncodingNameConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return ((Encoding)value).EncodingName;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}
|
using System;
using System.Globalization;
using System.Text;
using Avalonia.Data.Converters;
namespace OpenUtau.App.ViewModels {
public class CultureNameConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is CultureInfo cultureInfo) {
return cultureInfo.DisplayName;
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
public class EncodingNameConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return ((Encoding)value).EncodingName;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
6a824f5f7a8064076e8c2ea06d4f50449f75bc54
|
Add `current_period_*` filters when listing Invoices
|
richardlawley/stripe.net,stripe/stripe-dotnet
|
src/Stripe.net/Services/Subscriptions/SubscriptionListOptions.cs
|
src/Stripe.net/Services/Subscriptions/SubscriptionListOptions.cs
|
namespace Stripe
{
using System;
using Newtonsoft.Json;
public class SubscriptionListOptions : ListOptionsWithCreated
{
/// <summary>
/// The billing mode of the subscriptions to retrieve. One of <see cref="Billing" />.
/// </summary>
[JsonProperty("billing")]
public Billing? Billing { get; set; }
/// <summary>
/// A filter on the list based on the object current_period_end field.
/// </summary>
[JsonProperty("current_period_end")]
public DateTime? CurrentPeriodEnd { get; set; }
/// <summary>
/// A filter on the list based on the object current_period_end field.
/// </summary>
[JsonProperty("current_period_end")]
public DateRangeOptions CurrentPeriodEndRange { get; set; }
/// <summary>
/// A filter on the list based on the object current_period_start field.
/// </summary>
[JsonProperty("current_period_start")]
public DateTime? CurrentPeriodStart { get; set; }
/// <summary>
/// A filter on the list based on the object current_period_start field.
/// </summary>
[JsonProperty("current_period_start")]
public DateRangeOptions CurrentPeriodStartRange { get; set; }
/// <summary>
/// The ID of the customer whose subscriptions will be retrieved.
/// </summary>
[JsonProperty("customer")]
public string CustomerId { get; set; }
/// <summary>
/// The ID of the plan whose subscriptions will be retrieved.
/// </summary>
[JsonProperty("plan")]
public string PlanId { get; set; }
/// <summary>
/// The status of the subscriptions to retrieve. One of <see cref="SubscriptionStatuses"/> or <c>all</c>. Passing in a value of <c>canceled</c> will return all canceled subscriptions, including those belonging to deleted customers. Passing in a value of <c>all</c> will return subscriptions of all statuses.
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }
}
}
|
namespace Stripe
{
using Newtonsoft.Json;
public class SubscriptionListOptions : ListOptionsWithCreated
{
/// <summary>
/// The billing mode of the subscriptions to retrieve. One of <see cref="Billing" />.
/// </summary>
[JsonProperty("billing")]
public Billing? Billing { get; set; }
/// <summary>
/// The ID of the customer whose subscriptions will be retrieved.
/// </summary>
[JsonProperty("customer")]
public string CustomerId { get; set; }
/// <summary>
/// The ID of the plan whose subscriptions will be retrieved.
/// </summary>
[JsonProperty("plan")]
public string PlanId { get; set; }
/// <summary>
/// The status of the subscriptions to retrieve. One of <see cref="SubscriptionStatuses"/> or <c>all</c>. Passing in a value of <c>canceled</c> will return all canceled subscriptions, including those belonging to deleted customers. Passing in a value of <c>all</c> will return subscriptions of all statuses.
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }
}
}
|
apache-2.0
|
C#
|
4555ae03c6b9948f69efa7d7b0708e42549460d4
|
Reformat and simplify PerformanceLogAttribute
|
jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,googleapis/google-cloud-dotnet,evildour/google-cloud-dotnet,iantalarico/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,evildour/google-cloud-dotnet,jskeet/google-cloud-dotnet,iantalarico/google-cloud-dotnet,jskeet/gcloud-dotnet,iantalarico/google-cloud-dotnet,googleapis/google-cloud-dotnet,evildour/google-cloud-dotnet
|
apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.IntegrationTests/PerformanceLogAttribute.cs
|
apis/Google.Cloud.Spanner.Data/Google.Cloud.Spanner.Data.IntegrationTests/PerformanceLogAttribute.cs
|
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Cloud.Spanner.V1.Internal.Logging;
using System.Reflection;
using Xunit.Sdk;
namespace Google.Cloud.Spanner.Data.IntegrationTests
{
internal class PerformanceLogAttribute : BeforeAfterTestAttribute
{
public override void Before(MethodInfo methodUnderTest) =>
Logger.DefaultLogger.LogPerformanceData();
public override void After(MethodInfo methodUnderTest) =>
Logger.DefaultLogger.LogPerformanceData();
}
}
|
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Reflection;
using Google.Cloud.Spanner.V1.Internal.Logging;
using Xunit.Sdk;
namespace Google.Cloud.Spanner.Data.IntegrationTests {
internal class PerformanceLogAttribute : BeforeAfterTestAttribute
{
/// <inheritdoc />
public override void Before(MethodInfo methodUnderTest)
{
Logger.DefaultLogger.LogPerformanceData();
base.Before(methodUnderTest);
}
/// <inheritdoc />
public override void After(MethodInfo methodUnderTest)
{
Logger.DefaultLogger.LogPerformanceData();
base.After(methodUnderTest);
}
}
}
|
apache-2.0
|
C#
|
72c846db25d22ddf0de6a21fa5608c31c8a32715
|
fix test by removing BOM from read string
|
icarus-consulting/Yaapii.Atoms
|
tests/Yaapii.Atoms.Tests/IO/WriterToTest.cs
|
tests/Yaapii.Atoms.Tests/IO/WriterToTest.cs
|
// MIT License
//
// Copyright(c) 2017 ICARUS Consulting GmbH
//
// 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.IO;
using System.Text;
using Xunit;
using Yaapii.Atoms.IO;
using Yaapii.Atoms.Text;
namespace Yaapii.Atoms.Tests.IO
{
public sealed class WriterToTest
{
[Fact]
public void WritesContentToFile()
{
var dir = "artifacts/WriterToTest"; var file = "txt.txt";
var uri = new Uri(Path.GetFullPath(Path.Combine(dir, file)));
Directory.CreateDirectory(dir);
var content = "yada yada";
string s = "";
using (var ipt =
new TeeInput(
new InputOf(content),
new WriterAsOutput(
new WriterTo(uri))))
{
s = new TextOf(ipt).AsString();
}
Assert.True(
Encoding.UTF8.GetString(
new InputAsBytes(
new InputOf(uri)
).AsBytes()).Trim().CompareTo(s) == 0, //.Equals is needed because Streamwriter writes UTF8 _with_ BOM, which results in a different encoding.
"Can't copy Input to Output and return Input");
}
}
}
|
// MIT License
//
// Copyright(c) 2017 ICARUS Consulting GmbH
//
// 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.IO;
using System.Text;
using Xunit;
using Yaapii.Atoms.IO;
using Yaapii.Atoms.Text;
namespace Yaapii.Atoms.Tests.IO
{
public sealed class WriterToTest
{
[Fact]
public void WritesContentToFile()
{
var dir = "artifacts/WriterToTest"; var file = "txt.txt";
var uri = new Uri(Path.GetFullPath(Path.Combine(dir, file)));
Directory.CreateDirectory(dir);
var content = "yada yada";
string s = "";
using (var ipt =
new TeeInput(
new InputOf(content),
new WriterAsOutput(
new WriterTo(uri))))
{
s = new TextOf(ipt).AsString();
}
Assert.True(
Encoding.UTF8.GetString(
new InputAsBytes(
new InputOf(uri)
).AsBytes()).CompareTo(s) == 0, //.Equals is needed because Streamwriter writes UTF8 _with_ BOM, which results in a different encoding.
"Can't copy Input to Output and return Input");
}
}
}
|
mit
|
C#
|
0e02ef653e9472e53c319eecba2add0a697e611e
|
Update AssemblyVersion to 1.4.1
|
alexguirre/RAGENativeUI,alexguirre/RAGENativeUI
|
Source/Properties/AssemblyInfo.cs
|
Source/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("RAGENativeUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RAGENativeUI")]
[assembly: AssemblyCopyright("Copyright 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("f3e16ed9-dbf7-4e7b-b04b-9b24b11891d3")]
[assembly: AssemblyVersion("1.4.1.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("RAGENativeUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RAGENativeUI")]
[assembly: AssemblyCopyright("Copyright 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("f3e16ed9-dbf7-4e7b-b04b-9b24b11891d3")]
[assembly: AssemblyVersion("1.4.0.0")]
|
mit
|
C#
|
220fea0d59ad8a528395c38f49b9609c37263f8e
|
Fix ES tests #horror
|
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
|
InfinniPlatform.Core/Factories/GlobalContext.cs
|
InfinniPlatform.Core/Factories/GlobalContext.cs
|
using System;
using InfinniPlatform.Api.RestApi.Auth;
using InfinniPlatform.Sdk.ContextComponents;
using InfinniPlatform.Sdk.Contracts;
using InfinniPlatform.Sdk.IoC;
using InfinniPlatform.Transactions;
namespace InfinniPlatform.Factories
{
/// <summary>
/// Реализация контекста компонентов платформы
/// </summary>
public class GlobalContext : IGlobalContext, IComponentContainer
{
public GlobalContext(IContainerResolver containerResolver, ITenantProvider tenantProvider)
{
_containerResolver = containerResolver;
_tenantProvider = tenantProvider;
}
private readonly IContainerResolver _containerResolver;
[Obsolete("Use IoC")]
public T GetComponent<T>() where T : class
{
return _containerResolver.Resolve<T>();
}
private static ITenantProvider _tenantProvider;
[Obsolete("Use ITenantProvider")]
public static string GetTenantId(string indexName = null)
{
return _tenantProvider?.GetTenantId(indexName) ?? AuthorizationStorageExtensions.AnonymousUser;
}
}
}
|
using System;
using InfinniPlatform.Sdk.ContextComponents;
using InfinniPlatform.Sdk.Contracts;
using InfinniPlatform.Sdk.IoC;
using InfinniPlatform.Transactions;
namespace InfinniPlatform.Factories
{
/// <summary>
/// Реализация контекста компонентов платформы
/// </summary>
public class GlobalContext : IGlobalContext, IComponentContainer
{
public GlobalContext(IContainerResolver containerResolver, ITenantProvider tenantProvider)
{
_containerResolver = containerResolver;
_tenantProvider = tenantProvider;
}
private readonly IContainerResolver _containerResolver;
[Obsolete("Use IoC")]
public T GetComponent<T>() where T : class
{
return _containerResolver.Resolve<T>();
}
private static ITenantProvider _tenantProvider;
[Obsolete("Use ITenantProvider")]
public static string GetTenantId(string indexName = null)
{
return _tenantProvider?.GetTenantId(indexName);
}
}
}
|
agpl-3.0
|
C#
|
7e6176586db55b06d96f9f5c02976affd9ee8fcc
|
Rename Method
|
ishu3101/Wox.Plugin.IPAddress,zlphoenix/Wox.Plugin.IPAddress
|
Wox.Plugin.IPAddress/IPAddress.cs
|
Wox.Plugin.IPAddress/IPAddress.cs
|
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.NetworkInformation;
namespace Wox.Plugin.IPAddress
{
public class Program : IPlugin
{
public void Init(PluginInitContext context) { }
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
String hostname = Dns.GetHostName();
// Get the Local IP Address
String IP = Dns.GetHostByName(hostname).AddressList[0].ToString();
// Get the External IP Address
String externalip = new WebClient().DownloadString("http://ipecho.net/plain");
String icon = "ipaddress.png";
results.Add(Result(IP, "Local IP Address ", icon, Action(IP)));
results.Add(Result(externalip, "External IP Address ", icon, Action(externalip)));
return results;
}
// relative path to your plugin directory
private static Result Result(String title, String subtitle, String icon, Func<ActionContext, bool> action)
{
return new Result()
{
Title = title,
SubTitle = subtitle,
IcoPath = icon,
Action = action
};
}
// The Action method is called after the user selects the item
private static Func<ActionContext, bool> Action(String text)
{
return e =>
{
CopyToClipboard(text);
// return false to tell Wox don't hide query window, otherwise Wox will hide it automatically
return false;
};
}
public static void CopyToClipboard(String text)
{
Clipboard.SetText(text);
}
}
}
|
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.NetworkInformation;
namespace Wox.Plugin.IPAddress
{
public class Program : IPlugin
{
public void Init(PluginInitContext context) { }
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
String hostname = Dns.GetHostName();
// Get the Local IP Address
String IP = Dns.GetHostByName(hostname).AddressList[0].ToString();
// Get the External IP Address
String externalip = new WebClient().DownloadString("http://ipecho.net/plain");
String icon = "ipaddress.png";
results.Add(Item(IP, "Local IP Address ", icon, Action(IP)));
results.Add(Item(externalip, "External IP Address ", icon, Action(externalip)));
return results;
}
// relative path to your plugin directory
private static Result Item(String title, String subtitle, String icon, Func<ActionContext, bool> action)
{
return new Result()
{
Title = title,
SubTitle = subtitle,
IcoPath = icon,
Action = action
};
}
// The Action method is called after the user selects the item
private static Func<ActionContext, bool> Action(String text)
{
return e =>
{
CopyToClipboard(text);
// return false to tell Wox don't hide query window, otherwise Wox will hide it automatically
return false;
};
}
public static void CopyToClipboard(String text)
{
Clipboard.SetText(text);
}
}
}
|
mit
|
C#
|
8a8f01f8daed6777f43fa53974a60daf95f713db
|
Remove whitespace (leave the newline).
|
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/SecurityRequirementsOperationFilter.cs
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/SecurityRequirementsOperationFilter.cs
|
using System.Collections.Generic;
using System.Linq;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using Abp.Authorization;
namespace AbpCompanyName.AbpProjectName.Web.Host.Startup
{
public class SecurityRequirementsOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
var actionAttrs = context.ApiDescription.ActionAttributes();
if (actionAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
{
return;
}
var controllerAttrs = context.ApiDescription.ControllerAttributes();
var actionAbpAuthorizeAttrs = actionAttrs.OfType<AbpAuthorizeAttribute>();
if (!actionAbpAuthorizeAttrs.Any() && controllerAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
{
return;
}
var controllerAbpAuthorizeAttrs = controllerAttrs.OfType<AbpAuthorizeAttribute>();
if (controllerAbpAuthorizeAttrs.Any() || actionAbpAuthorizeAttrs.Any())
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
var permissions = controllerAbpAuthorizeAttrs.Union(actionAbpAuthorizeAttrs)
.SelectMany(p => p.Permissions)
.Distinct();
if (permissions.Any())
{
operation.Responses.Add("403", new Response { Description = "Forbidden" });
}
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
{
new Dictionary<string, IEnumerable<string>>
{
{ "bearerAuth", permissions }
}
};
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using Abp.Authorization;
namespace AbpCompanyName.AbpProjectName.Web.Host.Startup
{
public class SecurityRequirementsOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
var actionAttrs = context.ApiDescription.ActionAttributes();
if (actionAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
{
return;
}
var controllerAttrs = context.ApiDescription.ControllerAttributes();
var actionAbpAuthorizeAttrs = actionAttrs.OfType<AbpAuthorizeAttribute>();
if (!actionAbpAuthorizeAttrs.Any() && controllerAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
{
return;
}
var controllerAbpAuthorizeAttrs = controllerAttrs.OfType<AbpAuthorizeAttribute>();
if (controllerAbpAuthorizeAttrs.Any() || actionAbpAuthorizeAttrs.Any())
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
var permissions = controllerAbpAuthorizeAttrs.Union(actionAbpAuthorizeAttrs)
.SelectMany(p => p.Permissions)
.Distinct();
if (permissions.Any())
{
operation.Responses.Add("403", new Response { Description = "Forbidden" });
}
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
{
new Dictionary<string, IEnumerable<string>>
{
{ "bearerAuth", permissions }
}
};
}
}
}
}
|
mit
|
C#
|
2ed3df450993a94ff9ef582b649e763157aa007d
|
Set EnableDetailedErrors flag to true so that useful error messages can be obtained when the data hub functions fail.
|
GridProtectionAlliance/PQDashboard,GridProtectionAlliance/PQDashboard,GridProtectionAlliance/PQDashboard,GridProtectionAlliance/PQDashboard
|
src/PQDashboard/Startup.cs
|
src/PQDashboard/Startup.cs
|
//******************************************************************************************************
// Startup.cs - Gbtc
//
// Copyright © 2016, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 08/30/2016 - Billy Ernest
// Generated original version of source code.
//
//******************************************************************************************************
using GSF.Web.Model;
using GSF.Web.Security;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(PQDashboard.Startup))]
namespace PQDashboard
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
// Load security hub in application domain before establishing SignalR hub configuration
//GlobalHost.DependencyResolver.Register(typeof(SecurityHub), () => new SecurityHub(new DataContext("securityProvider", exceptionHandler: MvcApplication.LogException), MvcApplication.LogStatusMessage, MvcApplication.LogException));
HubConfiguration hubConfig = new HubConfiguration();
// Enabled detailed client errors
hubConfig.EnableDetailedErrors = true;
// Load ServiceHub SignalR class
app.MapSignalR(hubConfig);
}
}
}
|
//******************************************************************************************************
// Startup.cs - Gbtc
//
// Copyright © 2016, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 08/30/2016 - Billy Ernest
// Generated original version of source code.
//
//******************************************************************************************************
using GSF.Web.Model;
using GSF.Web.Security;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(PQDashboard.Startup))]
namespace PQDashboard
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
// Load security hub in application domain before establishing SignalR hub configuration
//GlobalHost.DependencyResolver.Register(typeof(SecurityHub), () => new SecurityHub(new DataContext("securityProvider", exceptionHandler: MvcApplication.LogException), MvcApplication.LogStatusMessage, MvcApplication.LogException));
HubConfiguration hubConfig = new HubConfiguration();
#if DEBUG
// Enabled detailed client errors
hubConfig.EnableDetailedErrors = true;
#endif
// Load ServiceHub SignalR class
app.MapSignalR(hubConfig);
}
}
}
|
bsd-3-clause
|
C#
|
487b8912c5354754812b65e69af0bb8be3fd5ae2
|
fix binary reader
|
justcoding121/Titanium-Web-Proxy,titanium007/Titanium-Web-Proxy,titanium007/Titanium
|
Titanium.HTTPProxyServer/Utility/CustomBinaryReader.cs
|
Titanium.HTTPProxyServer/Utility/CustomBinaryReader.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace Titanium.HTTPProxyServer
{
public class CustomBinaryReader : BinaryReader
{
public CustomBinaryReader(Stream stream, Encoding encoding)
: base(stream, encoding)
{
}
public string ReadLine()
{
char[] buf = new char[1];
StringBuilder _readBuffer = new StringBuilder();
try
{
var charsRead = 0;
char lastChar = new char();
while ((charsRead = base.Read(buf, 0, 1)) > 0)
{
if (lastChar == '\r' && buf[0] == '\n')
{
return _readBuffer.Remove(_readBuffer.Length - 1, 1).ToString();
}
else
if (buf[0] == '\0')
{
return _readBuffer.ToString();
}
else
_readBuffer.Append(buf[0]);
lastChar = buf[0];
}
return _readBuffer.ToString();
}
catch (IOException)
{ return _readBuffer.ToString(); }
catch (Exception e)
{ throw e; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace Titanium.HTTPProxyServer
{
public class CustomBinaryReader : BinaryReader
{
public CustomBinaryReader(Stream stream, Encoding encoding)
: base(stream, encoding)
{
}
public string ReadLine()
{
try
{
char[] buf = new char[1];
StringBuilder _readBuffer = new StringBuilder();
var charsRead = 0;
char lastChar = new char();
while ((charsRead = base.Read(buf, 0, 1)) > 0)
{
if (lastChar == '\r' && buf[0] == '\n')
{
return _readBuffer.Remove(_readBuffer.Length - 1, 1).ToString();
}
else
if (buf[0] == '\0')
{
return _readBuffer.ToString();
}
else
_readBuffer.Append(buf[0]);
lastChar = buf[0];
}
return _readBuffer.ToString();
}
catch { throw new EndOfStreamException(); }
}
}
}
|
mit
|
C#
|
9708b08439d2bf58482edefc3b0ef3dc82df70ec
|
Fix FundTransaction in case of insufficient funds
|
NTumbleBit/NTumbleBit,DanGould/NTumbleBit
|
NTumbleBit.TumblerServer/Services/RPCServices/RPCWalletService.cs
|
NTumbleBit.TumblerServer/Services/RPCServices/RPCWalletService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NBitcoin;
using NBitcoin.RPC;
using Newtonsoft.Json.Linq;
using NTumbleBit.PuzzlePromise;
using NBitcoin.DataEncoders;
#if !CLIENT
namespace NTumbleBit.TumblerServer.Services.RPCServices
#else
namespace NTumbleBit.Client.Tumbler.Services.RPCServices
#endif
{
public class RPCWalletService : IWalletService
{
public RPCWalletService(RPCClient rpc)
{
if(rpc == null)
throw new ArgumentNullException(nameof(rpc));
_RPCClient = rpc;
}
private readonly RPCClient _RPCClient;
public RPCClient RPCClient
{
get
{
return _RPCClient;
}
}
public IDestination GenerateAddress(string label)
{
var result = _RPCClient.SendCommand("getnewaddress", label ?? "");
return BitcoinAddress.Create(result.ResultString, _RPCClient.Network);
}
public Coin AsCoin(UnspentCoin c)
{
var coin = new Coin(c.OutPoint, new TxOut(c.Amount, c.ScriptPubKey));
if(c.RedeemScript != null)
coin = coin.ToScriptCoin(c.RedeemScript);
return coin;
}
public Transaction FundTransaction(TxOut txOut, FeeRate feeRate)
{
Transaction tx = new Transaction();
tx.Outputs.Add(txOut);
var changeAddress = BitcoinAddress.Create(_RPCClient.SendCommand("getrawchangeaddress").ResultString, _RPCClient.Network);
FundRawTransactionResponse response = null;
try
{
response = _RPCClient.FundRawTransaction(tx, new FundRawTransactionOptions()
{
ChangeAddress = changeAddress,
FeeRate = feeRate,
LockUnspents = true
});
}
catch(RPCException ex)
{
if(ex.Message.Equals("Insufficient funds", StringComparison.OrdinalIgnoreCase))
return null;
throw;
}
var result = _RPCClient.SendCommand("signrawtransaction", response.Transaction.ToHex());
return new Transaction(((JObject)result.Result)["hex"].Value<string>());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NBitcoin;
using NBitcoin.RPC;
using Newtonsoft.Json.Linq;
using NTumbleBit.PuzzlePromise;
using NBitcoin.DataEncoders;
#if !CLIENT
namespace NTumbleBit.TumblerServer.Services.RPCServices
#else
namespace NTumbleBit.Client.Tumbler.Services.RPCServices
#endif
{
public class RPCWalletService : IWalletService
{
public RPCWalletService(RPCClient rpc)
{
if(rpc == null)
throw new ArgumentNullException(nameof(rpc));
_RPCClient = rpc;
}
private readonly RPCClient _RPCClient;
public RPCClient RPCClient
{
get
{
return _RPCClient;
}
}
public IDestination GenerateAddress(string label)
{
var result = _RPCClient.SendCommand("getnewaddress", label ?? "");
return BitcoinAddress.Create(result.ResultString, _RPCClient.Network);
}
public Coin AsCoin(UnspentCoin c)
{
var coin = new Coin(c.OutPoint, new TxOut(c.Amount, c.ScriptPubKey));
if(c.RedeemScript != null)
coin = coin.ToScriptCoin(c.RedeemScript);
return coin;
}
public Transaction FundTransaction(TxOut txOut, FeeRate feeRate)
{
Transaction tx = new Transaction();
tx.Outputs.Add(txOut);
var changeAddress = BitcoinAddress.Create(_RPCClient.SendCommand("getrawchangeaddress").ResultString, _RPCClient.Network);
FundRawTransactionResponse response = null;
try
{
response = _RPCClient.FundRawTransaction(tx, new FundRawTransactionOptions()
{
ChangeAddress = changeAddress,
FeeRate = feeRate,
LockUnspents = true
});
}
catch(RPCException ex)
{
if(ex.RPCCodeMessage.Equals("Insufficient funds", StringComparison.OrdinalIgnoreCase))
return null;
throw;
}
var result = _RPCClient.SendCommand("signrawtransaction", response.Transaction.ToHex());
return new Transaction(((JObject)result.Result)["hex"].Value<string>());
}
}
}
|
mit
|
C#
|
4e571027602146c5fb94047a09e2072aec023488
|
reset const
|
MasayukiNagase/samples,sewong/samples,derekameer/samples,neilshipp/samples,jessekaplan/samples,jayhopeter/samples,parameshbabu/samples,jordanrh1/samples,Sumahitha/samples,jessekaplan/samples,jayhopeter/samples,HerrickSpencer/samples,zhuridartem/samples,ms-iot/samples,dotMorten/samples,tjaffri/msiot-samples,parameshbabu/samples,bfjelds/samples,sewong/samples,tjaffri/msiot-samples,zhuridartem/samples,tjaffri/msiot-samples,javiddhankwala/samples,ricl/samples,MagicBunny/samples,tjaffri/msiot-samples,zhuridartem/samples,ricl/samples,sewong/samples,DavidShoe/samples,sewong/samples,jessekaplan/samples,ms-iot/samples,jayhopeter/samples,DavidShoe/samples,DavidShoe/samples,rachitb777/samples,ms-iot/samples,jayhopeter/samples,ms-iot/samples,rachitb777/samples,jayhopeter/samples,parameshbabu/samples,dankuo/samples,MagicBunny/samples,neilshipp/samples,rachitb777/samples,MasayukiNagase/samples,zhuridartem/samples,jessekaplan/samples,Sumahitha/samples,parameshbabu/samples,dotMorten/samples,tjaffri/msiot-samples,dankuo/samples,neilshipp/samples,jordanrh1/samples,HerrickSpencer/samples,sewong/samples,dankuo/samples,jessekaplan/samples,tjaffri/msiot-samples,javiddhankwala/samples,Sumahitha/samples,paulmon/samples,ms-iot/samples,Sumahitha/samples,MasayukiNagase/samples,MasayukiNagase/samples,jordanrh1/samples,Sumahitha/samples,javiddhankwala/samples,jordanrh1/samples,ricl/samples,Sumahitha/samples,zhuridartem/samples,paulmon/samples,MasayukiNagase/samples,neilshipp/samples,HerrickSpencer/samples,zhuridartem/samples,paulmon/samples,MagicBunny/samples,zhuridartem/samples,bfjelds/samples,MicrosoftEdge/WebOnPi,DavidShoe/samples,jessekaplan/samples,paulmon/samples,javiddhankwala/samples,dotMorten/samples,ms-iot/samples,rachitb777/samples,bfjelds/samples,derekameer/samples,paulmon/samples,bfjelds/samples,tjaffri/msiot-samples,ms-iot/samples,dankuo/samples,MagicBunny/samples,parameshbabu/samples,jordanrh1/samples,jordanrh1/samples,MicrosoftEdge/WebOnPi,neilshipp/samples,sewong/samples,neilshipp/samples,tjaffri/msiot-samples,zhuridartem/samples,MagicBunny/samples,jayhopeter/samples,paulmon/samples,zhuridartem/samples,rachitb777/samples,derekameer/samples,MasayukiNagase/samples,Sumahitha/samples,MasayukiNagase/samples,ricl/samples,javiddhankwala/samples,dotMorten/samples,ms-iot/samples,jordanrh1/samples,parameshbabu/samples,HerrickSpencer/samples,paulmon/samples,javiddhankwala/samples,neilshipp/samples,zhuridartem/samples,paulmon/samples,jessekaplan/samples,parameshbabu/samples,jordanrh1/samples,javiddhankwala/samples,parameshbabu/samples,bfjelds/samples,jessekaplan/samples,neilshipp/samples,MasayukiNagase/samples,javiddhankwala/samples,jayhopeter/samples,paulmon/samples,jayhopeter/samples,HerrickSpencer/samples,jayhopeter/samples,dankuo/samples,javiddhankwala/samples,jayhopeter/samples,MasayukiNagase/samples,javiddhankwala/samples,tjaffri/msiot-samples,derekameer/samples,bfjelds/samples,derekameer/samples,ms-iot/samples,ricl/samples,sewong/samples,bfjelds/samples,parameshbabu/samples,dotMorten/samples,DavidShoe/samples,dotMorten/samples,tjaffri/msiot-samples,dotMorten/samples,sewong/samples,derekameer/samples,derekameer/samples,derekameer/samples,rachitb777/samples,jessekaplan/samples,jordanrh1/samples,rachitb777/samples,jessekaplan/samples,rachitb777/samples,derekameer/samples,parameshbabu/samples,ms-iot/samples,bfjelds/samples,sewong/samples,bfjelds/samples,derekameer/samples,MasayukiNagase/samples,Sumahitha/samples,dotMorten/samples,bfjelds/samples,sewong/samples,rachitb777/samples,rachitb777/samples,jordanrh1/samples,paulmon/samples
|
SpeechTranslator/ConstantParam.cs
|
SpeechTranslator/ConstantParam.cs
|
// Copyright (c) Microsoft. All rights reserved.
#define RPI1
namespace SpeechTranslator
{
class ConstantParam
{
public static readonly string DatamarketAccessUri = "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13";
//Access token expires every 10 minutes. Renew it every 9 minutes only.
public const int RefreshTokenDuration = 9;
//Token Property
public static string clientid = "YourAzureAccount";
public static string clientsecret = "YourAzureAccountClientSectet";
public static string ApiUri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?text=";
#if RPI1
// Stream Socket parameters
public static string SelfPort = "8082";
public static string ClientPort = "8083";
public static string ServerHostname = "speechtransrpi2";
#else
// Stream Socket parameterss
public static string SelfPort = "8083";
public static string ClientPort = "8082";
public static string ServerHostname = "speechtransrpi1";
#endif
}
}
|
// Copyright (c) Microsoft. All rights reserved.
#define RPI1
namespace SpeechTranslator
{
class ConstantParam
{
public static readonly string DatamarketAccessUri = "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13";
//Access token expires every 10 minutes. Renew it every 9 minutes only.
public const int RefreshTokenDuration = 9;
//Token Property
public static string clientid = "x";
public static string clientsecret = "x";
//public static string clientid = "YourAzureAccount";
//public static string clientsecret = "YourAzureAccountClientSectet";
public static string ApiUri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?text=";
#if RPI1
// Stream Socket parameters
public static string SelfPort = "8082";
public static string ClientPort = "8083";
public static string ServerHostname = "speechtransrpi2";
#else
// Stream Socket parameterss
public static string SelfPort = "8083";
public static string ClientPort = "8082";
public static string ServerHostname = "speechtransrpi1";
#endif
}
}
|
mit
|
C#
|
97b3b4556c051905dbcebba417c996262e9692fe
|
Fix merge.
|
harrison314/MassiveDynamicProxyGenerator,harrison314/MassiveDynamicProxyGenerator,harrison314/MassiveDynamicProxyGenerator
|
src/Test/MassiveDynamicProxyGenerator.Tests/TestInterfaces/IInterfaceWithDefaultMethod.cs
|
src/Test/MassiveDynamicProxyGenerator.Tests/TestInterfaces/IInterfaceWithDefaultMethod.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MassiveDynamicProxyGenerator.Tests.TestInterfaces
{
public interface IInterfaceWithDefaultMethod
{
int GetAize();
#if NETSTANDARD || NETCOREAPP
int GetSquare()
{
int size = this.GetSquare();
return size * size;
}
#endif
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MassiveDynamicProxyGenerator.Tests.TestInterfaces
{
public interface IInterfaceWithDefaultMethod
{
int GetAize();
#if NETSTANDARD || NETCOREAPP
int GetSquare()
{
int size = this.GetSquare();
return size * size;
}
}
}
|
mit
|
C#
|
1234cc372884b5932455d0ef13850d0151cac453
|
Use CORS for API.
|
marcuson/A2BBServer,marcuson/A2BBServer,marcuson/A2BBServer
|
A2BBAPI/Startup.cs
|
A2BBAPI/Startup.cs
|
using A2BBAPI.Data;
using A2BBCommon;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace A2BBAPI
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<A2BBApiDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("A2BBApiConnection")));
var authUserPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.RequireClaim("sub")
.Build();
services.AddMemoryCache();
services.AddMvc(options =>
{
options.Filters.Add(new AuthorizeFilter(authUserPolicy));
});
services.AddCors();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = Constants.IDENTITY_SERVER_ENDPOINT,
AuthenticationScheme = "Bearer",
AllowedScopes = { Constants.A2BB_API_RESOURCE_NAME },
RequireHttpsMetadata = false
});
app.UseMvc();
}
}
}
|
using A2BBAPI.Data;
using A2BBCommon;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace A2BBAPI
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<A2BBApiDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("A2BBApiConnection")));
var authUserPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.RequireClaim("sub")
.Build();
services.AddMemoryCache();
services.AddMvc(options =>
{
options.Filters.Add(new AuthorizeFilter(authUserPolicy));
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = Constants.IDENTITY_SERVER_ENDPOINT,
AuthenticationScheme = "Bearer",
AllowedScopes = { Constants.A2BB_API_RESOURCE_NAME },
RequireHttpsMetadata = false
});
app.UseMvc();
}
}
}
|
apache-2.0
|
C#
|
866ea4366bae2b9f19a50466e8166ed050d6d7f2
|
Fix manual KMS snippet (LocationName breaking change is expected)
|
googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/gcloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet
|
apis/Google.Cloud.Kms.V1/Google.Cloud.Kms.V1.Snippets/KeyManagementServiceClientSnippets.cs
|
apis/Google.Cloud.Kms.V1/Google.Cloud.Kms.V1.Snippets/KeyManagementServiceClientSnippets.cs
|
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Api.Gax.ResourceNames;
using Google.Cloud.ClientTesting;
using System;
using Xunit;
namespace Google.Cloud.Kms.V1.Snippets
{
[Collection(nameof(KeyManagementServiceFixture))]
[SnippetOutputCollector]
public class KeyManagementServiceClientSnippets
{
private readonly KeyManagementServiceFixture _fixture;
public KeyManagementServiceClientSnippets(KeyManagementServiceFixture fixture) =>
_fixture = fixture;
[Fact]
public void ListGlobalKeyRings()
{
string projectId = _fixture.ProjectId;
// Sample: ListGlobalKeyRings
KeyManagementServiceClient client = KeyManagementServiceClient.Create();
LocationName globalLocation = new LocationName(projectId, "global");
foreach (KeyRing keyRing in client.ListKeyRings(globalLocation))
{
Console.WriteLine(keyRing.Name);
}
// End sample
}
}
}
|
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Cloud.ClientTesting;
using System;
using Xunit;
namespace Google.Cloud.Kms.V1.Snippets
{
[Collection(nameof(KeyManagementServiceFixture))]
[SnippetOutputCollector]
public class KeyManagementServiceClientSnippets
{
private readonly KeyManagementServiceFixture _fixture;
public KeyManagementServiceClientSnippets(KeyManagementServiceFixture fixture) =>
_fixture = fixture;
[Fact]
public void ListGlobalKeyRings()
{
string projectId = _fixture.ProjectId;
// Sample: ListGlobalKeyRings
KeyManagementServiceClient client = KeyManagementServiceClient.Create();
LocationName globalLocation = new LocationName(projectId, "global");
foreach (KeyRing keyRing in client.ListKeyRings(globalLocation))
{
Console.WriteLine(keyRing.Name);
}
// End sample
}
}
}
|
apache-2.0
|
C#
|
630d21cc15e35e3e94aec0f099d8dadf0fd58a2f
|
Edit it
|
sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp
|
websocket-sharp/Server/IWebSocketSession.cs
|
websocket-sharp/Server/IWebSocketSession.cs
|
#region License
/*
* IWebSocketSession.cs
*
* The MIT License
*
* Copyright (c) 2013-2014 sta.blockhead
*
* 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;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server
{
/// <summary>
/// Exposes the access to the information in a WebSocket session.
/// </summary>
public interface IWebSocketSession
{
#region Properties
/// <summary>
/// Gets the information in the WebSocket handshake request.
/// </summary>
/// <value>
/// A <see cref="WebSocketContext"/> instance that provides the access to
/// the information in the handshake request.
/// </value>
WebSocketContext Context { get; }
/// <summary>
/// Gets the unique ID of the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the unique ID of the session.
/// </value>
string ID { get; }
/// <summary>
/// Gets the name of the WebSocket subprotocol used in the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the name of the subprotocol
/// if present.
/// </value>
string Protocol { get; }
/// <summary>
/// Gets the time that the session has started.
/// </summary>
/// <value>
/// A <see cref="DateTime"/> that represents the time that the session has started.
/// </value>
DateTime StartTime { get; }
/// <summary>
/// Gets the state of the <see cref="WebSocket"/> used in the session.
/// </summary>
/// <value>
/// One of the <see cref="WebSocketState"/> enum values, indicates the state of
/// the <see cref="WebSocket"/> used in the session.
/// </value>
WebSocketState State { get; }
#endregion
}
}
|
#region License
/*
* IWebSocketSession.cs
*
* The MIT License
*
* Copyright (c) 2013-2014 sta.blockhead
*
* 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;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server
{
/// <summary>
/// Exposes the access to the information in a WebSocket session.
/// </summary>
public interface IWebSocketSession
{
#region Properties
/// <summary>
/// Gets the information in the WebSocket handshake request.
/// </summary>
/// <value>
/// A <see cref="WebSocketContext"/> instance that provides the access to
/// the information in the handshake request.
/// </value>
WebSocketContext Context { get; }
/// <summary>
/// Gets the unique ID of the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the unique ID of the session.
/// </value>
string ID { get; }
/// <summary>
/// Gets the WebSocket subprotocol used in the session.
/// </summary>
/// <value>
/// A <see cref="string"/> that represents the subprotocol if any.
/// </value>
string Protocol { get; }
/// <summary>
/// Gets the time that the session has started.
/// </summary>
/// <value>
/// A <see cref="DateTime"/> that represents the time that the session has started.
/// </value>
DateTime StartTime { get; }
/// <summary>
/// Gets the state of the <see cref="WebSocket"/> used in the session.
/// </summary>
/// <value>
/// One of the <see cref="WebSocketState"/> enum values, indicates the state of
/// the <see cref="WebSocket"/> used in the session.
/// </value>
WebSocketState State { get; }
#endregion
}
}
|
mit
|
C#
|
56af9be4d29a3cb3b5199e657dbefb8726d5d915
|
Package updates is now fully implemented
|
rho24/Glimpse,codevlabs/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse,sorenhl/Glimpse,dudzon/Glimpse,SusanaL/Glimpse,SusanaL/Glimpse,Glimpse/Glimpse,SusanaL/Glimpse,flcdrg/Glimpse,flcdrg/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,rho24/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,sorenhl/Glimpse,Glimpse/Glimpse,Glimpse/Glimpse,codevlabs/Glimpse,gabrielweyer/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,dudzon/Glimpse,gabrielweyer/Glimpse,flcdrg/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse
|
source/Glimpse.Core/Framework/GlimpseMetadata.cs
|
source/Glimpse.Core/Framework/GlimpseMetadata.cs
|
using System.Collections.Generic;
namespace Glimpse.Core.Framework
{
public class GlimpseMetadata
{
public GlimpseMetadata()
{
Plugins = new Dictionary<string, PluginMetadata>();
Resources = new Dictionary<string, string>//TODO: once the resources below are implemented, this constructor should just instantiate variable.
{
{"paging", "NEED TO IMPLMENT RESOURCE Pager"},//TODO: Implement resource
{"tab", "NEED TO IMPLMENT RESOURCE test-popup.html"},//TODO: Implement resource
};
}
public string Version { get; set; }
public IDictionary<string,PluginMetadata> Plugins { get; set; }
public IDictionary<string,string> Resources { get; set; }
}
public class PluginMetadata
{
public string DocumentationUri { get; set; }
public bool HasMetadata { get { return !string.IsNullOrEmpty(DocumentationUri); } }
}
}
|
using System.Collections.Generic;
namespace Glimpse.Core.Framework
{
public class GlimpseMetadata
{
public GlimpseMetadata()
{
Plugins = new Dictionary<string, PluginMetadata>();
Resources = new Dictionary<string, string>//TODO: once the resources below are implemented, this constructor should just instantiate variable.
{
{"glimpse_packageUpdates", "//getGlimpse.com/{?packages*}"},
{"paging", "NEED TO IMPLMENT RESOURCE Pager"},//TODO: Implement resource
{"tab", "NEED TO IMPLMENT RESOURCE test-popup.html"},//TODO: Implement resource
};
}
public string Version { get; set; }
public IDictionary<string,PluginMetadata> Plugins { get; set; }
public IDictionary<string,string> Resources { get; set; }
}
public class PluginMetadata
{
public string DocumentationUri { get; set; }
public bool HasMetadata { get { return !string.IsNullOrEmpty(DocumentationUri); } }
}
}
|
apache-2.0
|
C#
|
239e50bb9e225b2921959d940199083631bfe77d
|
Fix test name.
|
damianh/LimitsMiddleware,damianh/LimitsMiddleware
|
src/LimitsMiddleware.Tests/MovingAverageTests.cs
|
src/LimitsMiddleware.Tests/MovingAverageTests.cs
|
namespace LimitsMiddleware
{
using System;
using FluentAssertions;
using Xunit;
public class MovingAverageTests
{
[Fact]
public void Should_calculate_average()
{
var movingAverage = new GlobalRateLimiter.MovingAverage(TimeSpan.FromSeconds(5));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(300, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1));
movingAverage.Average.Should().Be(180d);
}
[Fact]
public void Should_calculate_moving_average_within_window()
{
var movingAverage = new GlobalRateLimiter.MovingAverage(TimeSpan.FromSeconds(5));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1)); //should be discarded
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(300, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(150, TimeSpan.FromSeconds(1));
movingAverage.Average.Should().Be(190d);
}
}
}
|
namespace LimitsMiddleware
{
using System;
using FluentAssertions;
using Xunit;
public class MovingAverageTests
{
[Fact]
public void Should_calculate_average()
{
var movingAverage = new GlobalRateLimiter.MovingAverage(TimeSpan.FromSeconds(5));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(300, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1));
movingAverage.Average.Should().Be(180d);
}
[Fact]
public void Blah3()
{
var movingAverage = new GlobalRateLimiter.MovingAverage(TimeSpan.FromSeconds(5));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1)); //should be discarded
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(300, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(200, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(100, TimeSpan.FromSeconds(1));
movingAverage.AddInterval(150, TimeSpan.FromSeconds(1));
movingAverage.Average.Should().Be(190d);
}
}
}
|
mit
|
C#
|
131da05a6bef9923c81b0913e0b64fce73f57686
|
order updated date
|
agileharbor/openCartAccess
|
src/OpenCartAccess/Models/Order/OpenCartOrder.cs
|
src/OpenCartAccess/Models/Order/OpenCartOrder.cs
|
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace OpenCartAccess.Models.Order
{
[ DataContract ]
public sealed class OpenCartOrder
{
[ DataMember( Name = "order_id" ) ]
public int OrderId { get; set; }
[ DataMember( Name = "date_added" ) ]
public DateTime CreatedDate { get; set; }
[ DataMember( Name = "date_modified" ) ]
public DateTime UpdatedDate { get; set; }
[ DataMember( Name = "order_status_id" ) ]
public string StatusId { get; set; }
[ DataMember( Name = "total" ) ]
public decimal OrderTotal { get; set; }
[ DataMember( Name = "email" ) ]
public string Email { get; set; }
[ DataMember( Name = "telephone" ) ]
public string Phone { get; set; }
[ DataMember( Name = "payment_firstname" ) ]
public string PaymentFirstName { get; set; }
[ DataMember( Name = "payment_lastname" ) ]
public string PaymentLastName { get; set; }
[ DataMember( Name = "payment_company" ) ]
public string PaymentCompany { get; set; }
[ DataMember( Name = "shipping_address_1" ) ]
public string ShippingAddress1 { get; set; }
[ DataMember( Name = "shipping_address_2" ) ]
public string ShippingAddress2 { get; set; }
[ DataMember( Name = "shipping_postcode" ) ]
public string ShippingPostCode { get; set; }
[ DataMember( Name = "shipping_city" ) ]
public string ShippingCity { get; set; }
[ DataMember( Name = "shipping_country" ) ]
public string ShippingCountry { get; set; }
[ DataMember( Name = "shipping_zone" ) ]
public string ShippingZone { get; set; }
[ DataMember( Name = "shipping_method" ) ]
public string ShippingMethod { get; set; }
[ DataMember( Name = "products" ) ]
public IList< OpenCartOrderProduct > Products { get; set; }
}
public enum OpenCartOrderStatusEnum
{
MissingOrder,
Canceled,
CanceledReversal,
Chargeback,
Complete,
Denied,
Expired,
Failed,
Pending,
Processed,
Processing,
Refunded,
Reversed,
Shipped,
Voided
}
}
|
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace OpenCartAccess.Models.Order
{
[ DataContract ]
public class OpenCartOrder
{
[ DataMember( Name = "order_id" ) ]
public int OrderId { get; set; }
[ DataMember( Name = "date_added" ) ]
public DateTime CreatedDate { get; set; }
[ DataMember( Name = "order_status_id" ) ]
public string StatusId { get; set; }
[ DataMember( Name = "total" ) ]
public decimal OrderTotal { get; set; }
[ DataMember( Name = "email" ) ]
public string Email { get; set; }
[ DataMember( Name = "telephone" ) ]
public string Phone { get; set; }
[ DataMember( Name = "payment_firstname" ) ]
public string PaymentFirstName { get; set; }
[ DataMember( Name = "payment_lastname" ) ]
public string PaymentLastName { get; set; }
[ DataMember( Name = "payment_company" ) ]
public string PaymentCompany { get; set; }
[ DataMember( Name = "shipping_address_1" ) ]
public string ShippingAddress1 { get; set; }
[ DataMember( Name = "shipping_address_2" ) ]
public string ShippingAddress2 { get; set; }
[ DataMember( Name = "shipping_postcode" ) ]
public string ShippingPostCode { get; set; }
[ DataMember( Name = "shipping_city" ) ]
public string ShippingCity { get; set; }
[ DataMember( Name = "shipping_country" ) ]
public string ShippingCountry { get; set; }
[ DataMember( Name = "shipping_zone" ) ]
public string ShippingZone { get; set; }
[ DataMember( Name = "shipping_method" ) ]
public string ShippingMethod { get; set; }
[ DataMember( Name = "products" ) ]
public IList< OpenCartOrderProduct > Products { get; set; }
}
public enum OpenCartOrderStatusEnum
{
MissingOrder,
Canceled,
CanceledReversal,
Chargeback,
Complete,
Denied,
Expired,
Failed,
Pending,
Processed,
Processing,
Refunded,
Reversed,
Shipped,
Voided
}
}
|
bsd-3-clause
|
C#
|
41ce14906dfc38e9d9b4043bb254dcc4c80c296f
|
Undo change of this file.
|
tannergooding/roslyn,orthoxerox/roslyn,tvand7093/roslyn,dpoeschl/roslyn,mattscheffer/roslyn,orthoxerox/roslyn,wvdd007/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,VSadov/roslyn,kelltrick/roslyn,tmat/roslyn,dotnet/roslyn,AnthonyDGreen/roslyn,genlu/roslyn,bkoelman/roslyn,drognanar/roslyn,pdelvo/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,brettfo/roslyn,abock/roslyn,physhi/roslyn,DustinCampbell/roslyn,lorcanmooney/roslyn,stephentoub/roslyn,OmarTawfik/roslyn,bartdesmet/roslyn,CaptainHayashi/roslyn,kelltrick/roslyn,mmitche/roslyn,jamesqo/roslyn,KevinRansom/roslyn,OmarTawfik/roslyn,zooba/roslyn,diryboy/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,AlekseyTs/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jamesqo/roslyn,abock/roslyn,Hosch250/roslyn,tmat/roslyn,nguerrera/roslyn,brettfo/roslyn,lorcanmooney/roslyn,tmat/roslyn,VSadov/roslyn,jcouv/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,bkoelman/roslyn,reaction1989/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,yeaicc/roslyn,davkean/roslyn,jmarolf/roslyn,brettfo/roslyn,cston/roslyn,Giftednewt/roslyn,MattWindsor91/roslyn,mattwar/roslyn,CyrusNajmabadi/roslyn,MichalStrehovsky/roslyn,robinsedlaczek/roslyn,swaroop-sridhar/roslyn,physhi/roslyn,amcasey/roslyn,xasx/roslyn,aelij/roslyn,genlu/roslyn,yeaicc/roslyn,mattscheffer/roslyn,DustinCampbell/roslyn,ErikSchierboom/roslyn,jeffanders/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,MichalStrehovsky/roslyn,aelij/roslyn,jamesqo/roslyn,bbarry/roslyn,ErikSchierboom/roslyn,sharwell/roslyn,lorcanmooney/roslyn,CaptainHayashi/roslyn,jkotas/roslyn,Giftednewt/roslyn,AnthonyDGreen/roslyn,jcouv/roslyn,drognanar/roslyn,weltkante/roslyn,diryboy/roslyn,gafter/roslyn,agocke/roslyn,MichalStrehovsky/roslyn,mmitche/roslyn,mattwar/roslyn,jeffanders/roslyn,kelltrick/roslyn,panopticoncentral/roslyn,cston/roslyn,srivatsn/roslyn,mattwar/roslyn,agocke/roslyn,Giftednewt/roslyn,swaroop-sridhar/roslyn,mmitche/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,eriawan/roslyn,jkotas/roslyn,khyperia/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,physhi/roslyn,robinsedlaczek/roslyn,shyamnamboodiripad/roslyn,jcouv/roslyn,xasx/roslyn,srivatsn/roslyn,stephentoub/roslyn,KirillOsenkov/roslyn,yeaicc/roslyn,wvdd007/roslyn,davkean/roslyn,khyperia/roslyn,abock/roslyn,bbarry/roslyn,tmeschter/roslyn,shyamnamboodiripad/roslyn,CaptainHayashi/roslyn,akrisiun/roslyn,robinsedlaczek/roslyn,weltkante/roslyn,bbarry/roslyn,tvand7093/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,bkoelman/roslyn,zooba/roslyn,tannergooding/roslyn,heejaechang/roslyn,genlu/roslyn,bartdesmet/roslyn,reaction1989/roslyn,tannergooding/roslyn,jeffanders/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,amcasey/roslyn,jkotas/roslyn,tvand7093/roslyn,Hosch250/roslyn,TyOverby/roslyn,AmadeusW/roslyn,swaroop-sridhar/roslyn,mavasani/roslyn,mavasani/roslyn,nguerrera/roslyn,sharwell/roslyn,TyOverby/roslyn,jasonmalinowski/roslyn,akrisiun/roslyn,MattWindsor91/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,heejaechang/roslyn,cston/roslyn,pdelvo/roslyn,dpoeschl/roslyn,sharwell/roslyn,wvdd007/roslyn,paulvanbrenk/roslyn,MattWindsor91/roslyn,srivatsn/roslyn,gafter/roslyn,agocke/roslyn,OmarTawfik/roslyn,orthoxerox/roslyn,akrisiun/roslyn,nguerrera/roslyn,AlekseyTs/roslyn,TyOverby/roslyn,reaction1989/roslyn,mattscheffer/roslyn,khyperia/roslyn,eriawan/roslyn,Hosch250/roslyn,VSadov/roslyn,eriawan/roslyn,heejaechang/roslyn,zooba/roslyn,panopticoncentral/roslyn,tmeschter/roslyn,dpoeschl/roslyn,pdelvo/roslyn,amcasey/roslyn,MattWindsor91/roslyn,xasx/roslyn,weltkante/roslyn,paulvanbrenk/roslyn,dotnet/roslyn,drognanar/roslyn,tmeschter/roslyn,AmadeusW/roslyn,mavasani/roslyn,davkean/roslyn,AlekseyTs/roslyn,gafter/roslyn,AnthonyDGreen/roslyn,paulvanbrenk/roslyn,DustinCampbell/roslyn,jasonmalinowski/roslyn
|
src/EditorFeatures/Core/ContentTypeNames.cs
|
src/EditorFeatures/Core/ContentTypeNames.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.CodeAnalysis.Editor
{
internal static class ContentTypeNames
{
public const string CSharpContentType = "CSharp";
public const string CSharpSignatureHelpContentType = "CSharp Signature Help";
public const string RoslynContentType = "Roslyn Languages";
public const string VisualBasicContentType = "Basic";
public const string VisualBasicSignatureHelpContentType = "Basic Signature Help";
public const string XamlContentType = "XAML";
public const string JavaScriptContentTypeName = "JavaScript";
public const string TypeScriptContentTypeName = "TypeScript";
}
}
|
// 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.CodeAnalysis.Editor
{
internal static class ContentTypeNames
{
public const string CSharpContentType = "CSharp";
public const string CSharpSignatureHelpContentType = "CSharp Signature Help";
public const string RoslynContentType = "Roslyn Languages";
public const string VisualBasicContentType = "Basic";
public const string VisualBasicSignatureHelpContentType = "Basic Signature Help";
public const string XamlContentType = "XAML";
}
}
|
mit
|
C#
|
82b232ff4e1cf6bfc497f892874f01079f98aa9e
|
Add string store to Field.
|
beta-tank/TicTacToe,beta-tank/TicTacToe,beta-tank/TicTacToe
|
TicTacToe.Core/Field.cs
|
TicTacToe.Core/Field.cs
|
using System;
using System.Linq;
using TicTacToe.Core.Enums;
using static System.String;
namespace TicTacToe.Core
{
public class Field : IEntity
{
public int Id { get; set; }
public virtual Game Game { get; set; }
public string CellsString {
get { return Join(";", Cells.Select(n => (byte)n));}
set { Cells = value.Split(';').Select(n =>(PlayerCode) Convert.ToByte(n)).ToArray(); }
}
public PlayerCode[] Cells { get; set; }
public PlayerCode this[int index] {
get { return Cells[index]; }
set { Cells[index] = value; }
}
public Field()
{
Cells = new PlayerCode[9];
}
public bool Move(PlayerCode player, byte cell)
{
if (!IsPossibleMove(cell))
return false;
Cells[cell] = player;
return true;
}
private bool IsPossibleMove(byte cell)
{
return cell <= 8 && Cells[cell] == PlayerCode.None;
}
}
}
|
using TicTacToe.Core.Enums;
namespace TicTacToe.Core
{
public class Field : IEntity
{
public int Id { get; set; }
public virtual Game Game { get; set; }
public PlayerCode[] Cells { get; set; }
public PlayerCode this[int index] {
get { return Cells[index]; }
set { Cells[index] = value; }
}
public Field()
{
Cells = new PlayerCode[9];
}
public bool Move(PlayerCode player, byte cell)
{
if (!IsPossibleMove(cell))
return false;
Cells[cell] = player;
return true;
}
private bool IsPossibleMove(byte cell)
{
return cell <= 8 && Cells[cell] == PlayerCode.None;
}
}
}
|
mit
|
C#
|
2e3d0c9ba24c62e66292b8293cf3c9e58ae78d8a
|
add utility to query access scope
|
0xFireball/KQAnalytics3,0xFireball/KQAnalytics3,0xFireball/KQAnalytics3
|
KQAnalytics3/src/KQAnalytics3/Services/Authentication/ClientApiAccessValidator.cs
|
KQAnalytics3/src/KQAnalytics3/Services/Authentication/ClientApiAccessValidator.cs
|
using KQAnalytics3.Configuration.Access;
using System;
using System.Collections.Generic;
using System.Security.Claims;
namespace KQAnalytics3.Services.Authentication
{
public static class ClientApiAccessValidator
{
public static string AuthTypeKey => "authType";
public static string AccessScopeKey => "accessScope";
public static IEnumerable<Claim> GetAuthClaims(ApiAccessKey accessKey)
{
return new Claim[]
{
new Claim(AuthTypeKey, "stateless"),
new Claim(AccessScopeKey, accessKey.AccessScope.ToString())
};
}
public static ApiAccessScope GetAccessScope(Claim accessScopeClaim)
{
return (ApiAccessScope)Enum.Parse(typeof(ApiAccessScope), accessScopeClaim.Value);
}
}
}
|
using KQAnalytics3.Configuration.Access;
using System;
using System.Collections.Generic;
using System.Security.Claims;
namespace KQAnalytics3.Services.Authentication
{
public static class ClientApiAccessValidator
{
public static IEnumerable<Claim> GetAuthClaims(ApiAccessKey accessKey)
{
throw new NotImplementedException();
}
}
}
|
agpl-3.0
|
C#
|
bc4dfb79ed9325a3fd2757c465f00a3627ac5945
|
Set SupportedApiVersion = "2015-09-08"
|
matthewcorven/stripe.net,matthewcorven/stripe.net
|
src/Stripe/Infrastructure/StripeConfiguration.cs
|
src/Stripe/Infrastructure/StripeConfiguration.cs
|
using System;
using System.Configuration;
namespace Stripe
{
public static class StripeConfiguration
{
private static string _apiKey;
internal const string SupportedApiVersion = "2015-09-08";
static StripeConfiguration()
{
ApiVersion = SupportedApiVersion;
}
internal static string GetApiKey()
{
if (string.IsNullOrEmpty(_apiKey))
_apiKey = ConfigurationManager.AppSettings["StripeApiKey"];
return _apiKey;
}
public static void SetApiKey(string newApiKey)
{
_apiKey = newApiKey;
}
public static string ApiVersion { get; internal set; }
}
}
|
using System;
using System.Configuration;
namespace Stripe
{
public static class StripeConfiguration
{
private static string _apiKey;
internal const string SupportedApiVersion = "2015-03-24";
static StripeConfiguration()
{
ApiVersion = SupportedApiVersion;
}
internal static string GetApiKey()
{
if (string.IsNullOrEmpty(_apiKey))
_apiKey = ConfigurationManager.AppSettings["StripeApiKey"];
return _apiKey;
}
public static void SetApiKey(string newApiKey)
{
_apiKey = newApiKey;
}
public static string ApiVersion { get; internal set; }
}
}
|
apache-2.0
|
C#
|
3578bd1358e82e568fc2d448bcf8754f594e078a
|
Remove unused usings
|
gpduck/WDSiPXE,gpduck/WDSiPXE
|
WDSiPXE/Bootstrapper.cs
|
WDSiPXE/Bootstrapper.cs
|
using System;
using Nancy;
namespace WDSiPXE
{
public class Bootstrapper : DefaultNancyBootstrapper
{
private String _remoteInstallPath;
public Bootstrapper() : this("c:\\temp30\\wds")
{
}
public Bootstrapper(String remoteInstallPath)
{
_remoteInstallPath = remoteInstallPath;
}
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
{
container.Register<IDeviceRepository, WDSDeviceRepository>(new WDSDeviceRepository(_remoteInstallPath));
base.ApplicationStartup(container, pipelines);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
namespace WDSiPXE
{
public class Bootstrapper : DefaultNancyBootstrapper
{
private String _remoteInstallPath;
public Bootstrapper() : this("c:\\temp30\\wds")
{
}
public Bootstrapper(String remoteInstallPath)
{
_remoteInstallPath = remoteInstallPath;
}
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
{
container.Register<IDeviceRepository, WDSDeviceRepository>(new WDSDeviceRepository(_remoteInstallPath));
base.ApplicationStartup(container, pipelines);
}
}
}
|
apache-2.0
|
C#
|
c7033dd178d34a75446f19fe0cc85b0f697e67c0
|
Add XML comments to UrlAttribute
|
YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata
|
src/Atata/Attributes/UrlAttribute.cs
|
src/Atata/Attributes/UrlAttribute.cs
|
using System;
namespace Atata
{
/// <summary>
/// Specifies the URL to navigate to during initialization of page object.
/// Applies to page object types.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class UrlAttribute : Attribute
{
public UrlAttribute(string url)
{
Url = url;
}
/// <summary>
/// Gets the URL to navigate to.
/// </summary>
public string Url { get; private set; }
}
}
|
using System;
namespace Atata
{
[AttributeUsage(AttributeTargets.Class)]
public class UrlAttribute : Attribute
{
public UrlAttribute(string url)
{
Url = url;
}
public string Url { get; private set; }
}
}
|
apache-2.0
|
C#
|
22f4e4e968b3ab77007b1de7ad3fd1204d7a527e
|
Revert "Adding oncompletionasync to sandwich bot"
|
digibaraka/BotBuilder,xiangyan99/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,digibaraka/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,mmatkow/BotBuilder,xiangyan99/BotBuilder,dr-em/BotBuilder,jockorob/BotBuilder,jockorob/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder,mmatkow/BotBuilder,mmatkow/BotBuilder,navaei/BotBuilder,navaei/BotBuilder,digibaraka/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,navaei/BotBuilder,stevengum97/BotBuilder,stevengum97/BotBuilder,Clairety/ConnectMe,Clairety/ConnectMe,msft-shahins/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,yakumo/BotBuilder,Clairety/ConnectMe,digibaraka/BotBuilder,yakumo/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,dr-em/BotBuilder,jockorob/BotBuilder,Clairety/ConnectMe,jockorob/BotBuilder,navaei/BotBuilder
|
CSharp/Samples/SimpleSandwichBot/Sandwich.cs
|
CSharp/Samples/SimpleSandwichBot/Sandwich.cs
|
using Microsoft.Bot.Builder.FormFlow;
using System;
using System.Collections.Generic;
#pragma warning disable 649
// The SandwichOrder is the simple form you want to fill out. It must be serializable so the bot can be stateless.
// The order of fields defines the default order in which questions will be asked.
// Enumerations shows the legal options for each field in the SandwichOrder and the order is the order values will be presented
// in a conversation.
namespace Microsoft.Bot.Sample.SimpleSandwichBot
{
public enum SandwichOptions
{
BLT, BlackForestHam, BuffaloChicken, ChickenAndBaconRanchMelt, ColdCutCombo, MeatballMarinara,
OverRoastedChicken, RoastBeef, RotisserieStyleChicken, SpicyItalian, SteakAndCheese, SweetOnionTeriyaki, Tuna,
TurkeyBreast, Veggie
};
public enum LengthOptions { SixInch, FootLong };
public enum BreadOptions { NineGrainWheat, NineGrainHoneyOat, Italian, ItalianHerbsAndCheese, Flatbread };
public enum CheeseOptions { American, MontereyCheddar, Pepperjack };
public enum ToppingOptions
{
Avocado, BananaPeppers, Cucumbers, GreenBellPeppers, Jalapenos,
Lettuce, Olives, Pickles, RedOnion, Spinach, Tomatoes
};
public enum SauceOptions
{
ChipotleSouthwest, HoneyMustard, LightMayonnaise, RegularMayonnaise,
Mustard, Oil, Pepper, Ranch, SweetOnion, Vinegar
};
[Serializable]
class SandwichOrder
{
public SandwichOptions? Sandwich;
public LengthOptions? Length;
public BreadOptions? Bread;
public CheeseOptions? Cheese;
public List<ToppingOptions> Toppings;
public List<SauceOptions> Sauce;
public static IForm<SandwichOrder> BuildForm()
{
return new FormBuilder<SandwichOrder>()
.Message("Welcome to the simple sandwich order bot!")
.Build();
}
};
}
|
using Microsoft.Bot.Builder.FormFlow;
using System;
using System.Collections.Generic;
#pragma warning disable 649
// The SandwichOrder is the simple form you want to fill out. It must be serializable so the bot can be stateless.
// The order of fields defines the default order in which questions will be asked.
// Enumerations shows the legal options for each field in the SandwichOrder and the order is the order values will be presented
// in a conversation.
namespace Microsoft.Bot.Sample.SimpleSandwichBot
{
public enum SandwichOptions
{
BLT, BlackForestHam, BuffaloChicken, ChickenAndBaconRanchMelt, ColdCutCombo, MeatballMarinara,
OverRoastedChicken, RoastBeef, RotisserieStyleChicken, SpicyItalian, SteakAndCheese, SweetOnionTeriyaki, Tuna,
TurkeyBreast, Veggie
};
public enum LengthOptions { SixInch, FootLong };
public enum BreadOptions { NineGrainWheat, NineGrainHoneyOat, Italian, ItalianHerbsAndCheese, Flatbread };
public enum CheeseOptions { American, MontereyCheddar, Pepperjack };
public enum ToppingOptions
{
Avocado, BananaPeppers, Cucumbers, GreenBellPeppers, Jalapenos,
Lettuce, Olives, Pickles, RedOnion, Spinach, Tomatoes
};
public enum SauceOptions
{
ChipotleSouthwest, HoneyMustard, LightMayonnaise, RegularMayonnaise,
Mustard, Oil, Pepper, Ranch, SweetOnion, Vinegar
};
[Serializable]
class SandwichOrder
{
public SandwichOptions? Sandwich;
public LengthOptions? Length;
public BreadOptions? Bread;
public CheeseOptions? Cheese;
public List<ToppingOptions> Toppings;
public List<SauceOptions> Sauce;
public override string ToString()
{
return $"Your sandwich: {Newtonsoft.Json.JsonConvert.SerializeObject(this)}";
}
public static IForm<SandwichOrder> BuildForm()
{
return new FormBuilder<SandwichOrder>()
.Message("Welcome to the simple sandwich order bot!")
.OnCompletionAsync(async (context, res) =>
{
var reply = context.MakeMessage();
reply.Text = $"order compeleted: {res.ToString()}";
await context.PostAsync(reply);
context.Done(res);
})
.Build();
}
};
}
|
mit
|
C#
|
54fbe634704d8c1c3177f1fea926fb8c1678a009
|
Clean up usings.
|
justinjstark/Delivered,justinjstark/Verdeler
|
Distributor/Distributor.cs
|
Distributor/Distributor.cs
|
namespace Distributor
{
public class Distributor
{
public void Run()
{
var file = new DistributionFile { FileName = "File.txt" };
foreach (var deliveryService in DeliveryServices.Distributions)
{
deliveryService.DeliverFile(file);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Distributor
{
public class Distributor
{
public void Run()
{
var file = new DistributionFile { FileName = "File.txt" };
foreach (var deliveryService in DeliveryServices.Distributions)
{
deliveryService.DeliverFile(file);
}
}
}
}
|
mit
|
C#
|
47948d7b34c860e17d73579ac4ee6e91d69e3506
|
Set default for bindable in object initializer
|
peppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu
|
osu.Game/Screens/Edit/Verify/VisibilitySection.cs
|
osu.Game/Screens/Edit/Verify/VisibilitySection.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Screens.Edit.Verify
{
internal class VisibilitySection : EditorRoundedScreenSettingsSection
{
[Resolved]
private VerifyScreen verify { get; set; }
private readonly IssueType[] configurableIssueTypes =
{
IssueType.Warning,
IssueType.Error,
IssueType.Negligible
};
private BindableList<IssueType> hiddenIssueTypes;
protected override string Header => "Visibility";
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colours)
{
hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();
foreach (IssueType issueType in configurableIssueTypes)
{
var checkbox = new SettingsCheckbox
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
LabelText = issueType.ToString(),
Current = { Default = !hiddenIssueTypes.Contains(issueType) }
};
checkbox.Current.SetDefault();
checkbox.Current.BindValueChanged(state =>
{
if (!state.NewValue)
hiddenIssueTypes.Add(issueType);
else
hiddenIssueTypes.Remove(issueType);
});
Flow.Add(checkbox);
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Screens.Edit.Verify
{
internal class VisibilitySection : EditorRoundedScreenSettingsSection
{
[Resolved]
private VerifyScreen verify { get; set; }
private readonly IssueType[] configurableIssueTypes =
{
IssueType.Warning,
IssueType.Error,
IssueType.Negligible
};
private BindableList<IssueType> hiddenIssueTypes;
protected override string Header => "Visibility";
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colours)
{
hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();
foreach (IssueType issueType in configurableIssueTypes)
{
var checkbox = new SettingsCheckbox
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
LabelText = issueType.ToString()
};
checkbox.Current.Default = !hiddenIssueTypes.Contains(issueType);
checkbox.Current.SetDefault();
checkbox.Current.BindValueChanged(state =>
{
if (!state.NewValue)
hiddenIssueTypes.Add(issueType);
else
hiddenIssueTypes.Remove(issueType);
});
Flow.Add(checkbox);
}
}
}
}
|
mit
|
C#
|
9d701c0c241937afc1685b5faee16d85e7baaefa
|
update version for release
|
Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal
|
Master/Appleseed/Projects/PortableAreas/PageManagerTree/Properties/AssemblyInfo.cs
|
Master/Appleseed/Projects/PortableAreas/PageManagerTree/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("PageManagerTree")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : MVC Page Manager")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("PageManagerTree")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1bbaa317-aebe-425c-8db3-a1aee724365d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.131.463")]
[assembly: AssemblyFileVersion("1.4.131.463")]
|
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("PageManagerTree")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : MVC Page Manager")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("PageManagerTree")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1bbaa317-aebe-425c-8db3-a1aee724365d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.98.383")]
[assembly: AssemblyFileVersion("1.4.98.383")]
|
apache-2.0
|
C#
|
8dab3f1ed2b6b7e0516cc99b2c10cb3612419a11
|
Add tests with Lambda, ByRef and ByVal
|
mavasani/roslyn-analyzers,bkoelman/roslyn-analyzers,pakdev/roslyn-analyzers,jasonmalinowski/roslyn-analyzers,srivatsn/roslyn-analyzers,pakdev/roslyn-analyzers,genlu/roslyn-analyzers,qinxgit/roslyn-analyzers,dotnet/roslyn-analyzers,mavasani/roslyn-analyzers,Anniepoh/roslyn-analyzers,heejaechang/roslyn-analyzers,natidea/roslyn-analyzers,dotnet/roslyn-analyzers
|
src/Microsoft.Maintainability.Analyzers/UnitTests/RemoveUnusedLocalsTests.cs
|
src/Microsoft.Maintainability.Analyzers/UnitTests/RemoveUnusedLocalsTests.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;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.Maintainability.Analyzers.UnitTests
{
public class RemoveUnusedLocalsTests : DiagnosticAnalyzerTestBase
{
private const string CA1804RuleId = "CA1804";
private readonly string _CA1804RemoveUnusedLocalMessage = MicrosoftMaintainabilityAnalyzersResources.RemoveUnusedLocalsMessage;
protected override DiagnosticAnalyzer GetBasicDiagnosticAnalyzer()
{
return new BasicRemoveUnusedLocalsAnalyzer();
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
throw new NotImplementedException();
}
[Fact]
public void UnusedLocal_NoDiagnostics_VisualBasic()
{
VerifyBasic(@"
Public Class Tester
Dim aa As Integer
Public Sub Testing()
Dim b as Integer
Dim c as Integer
b += 1
c = 0
aa = c
End Sub
End Class");
}
[Fact]
public void UnusedLocal_NoDiagnostics_LocalsCalledInInvocationExpression_VisualBasic()
{
VerifyBasic(@"
Public Class Tester
Public Sub Testing()
Dim c as Integer
c = 0
System.Console.WriteLine(c)
End Sub
Public Sub TakeArg(arg As Integer)
End Sub
End Class");
}
[Fact]
public void UnusedLocal_VisualBasic()
{
VerifyBasic(@"
Public Class Tester
Public Sub Testing()
Dim c as Integer
c = 0
Dim lambda As Action = Sub()
Dim lambdaA = 0
lambdaA = 3
End Sub
Dim rateIt = 3
Dim debitIt = 4
Calculate(rateIt, debitIt)
End Sub
Sub Calculate(ByVal rate As Double, ByRef debt As Double)
debt = debt + (debt * rate / 100)
End Sub
End Class",
GetBasicResultAt(4, 13, CA1804RuleId, _CA1804RemoveUnusedLocalMessage),
GetBasicResultAt(6, 13, CA1804RuleId, _CA1804RemoveUnusedLocalMessage),
GetBasicResultAt(7, 40, CA1804RuleId, _CA1804RemoveUnusedLocalMessage));
}
}
}
|
// 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;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.UnitTests;
using Xunit;
namespace Microsoft.Maintainability.Analyzers.UnitTests
{
public class RemoveUnusedLocalsTests : DiagnosticAnalyzerTestBase
{
private const string CA1804RuleId = "CA1804";
private readonly string _CA1804RemoveUnusedLocalMessage = MicrosoftMaintainabilityAnalyzersResources.RemoveUnusedLocalsMessage;
protected override DiagnosticAnalyzer GetBasicDiagnosticAnalyzer()
{
return new BasicRemoveUnusedLocalsAnalyzer();
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
throw new NotImplementedException();
}
[Fact]
public void UnusedLocal_NoDiagnostics_VisualBasic()
{
VerifyBasic(@"
Public Class Tester
Dim aa As Integer
Public Sub Testing()
Dim b as Integer
Dim c as Integer
b += 1
c = 0
aa = c
End Sub
End Class");
}
[Fact]
public void UnusedLocal_NoDiagnostics_LocalsCalledInInvocationExpression_VisualBasic()
{
VerifyBasic(@"
Public Class Tester
Public Sub Testing()
Dim c as Integer
c = 0
System.Console.WriteLine(c)
End Sub
Public Sub TakeArg(arg As Integer)
End Sub
End Class");
}
[Fact]
public void UnusedLocal_VisualBasic()
{
VerifyBasic(@"
Public Class Tester
Public Sub Testing()
Dim c as Integer
c = 0
End Sub
End Class",
GetBasicResultAt(4, 13, CA1804RuleId, _CA1804RemoveUnusedLocalMessage));
}
}
}
|
mit
|
C#
|
5775743a297272cf58902f036f56c08dba07b517
|
Fix crash in UWP design mode
|
Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms
|
Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs
|
Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs
|
using System;
using System.ComponentModel;
using Windows.ApplicationModel;
#if WINDOWS_UWP
namespace Xamarin.Forms.Platform.UWP
#else
namespace Xamarin.Forms.Platform.WinRT
#endif
{
public abstract class WindowsBasePage : Windows.UI.Xaml.Controls.Page
{
public WindowsBasePage()
{
if (!DesignMode.DesignModeEnabled)
{
Windows.UI.Xaml.Application.Current.Suspending += OnApplicationSuspending;
Windows.UI.Xaml.Application.Current.Resuming += OnApplicationResuming;
}
}
protected Platform Platform { get; private set; }
protected abstract Platform CreatePlatform();
protected void LoadApplication(Application application)
{
if (application == null)
throw new ArgumentNullException("application");
Application.Current = application;
Platform = CreatePlatform();
Platform.SetPage(Application.Current.MainPage);
application.PropertyChanged += OnApplicationPropertyChanged;
Application.Current.SendStart();
}
void OnApplicationPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "MainPage")
Platform.SetPage(Application.Current.MainPage);
}
void OnApplicationResuming(object sender, object e)
{
Application.Current.SendResume();
}
async void OnApplicationSuspending(object sender, SuspendingEventArgs e)
{
SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral();
await Application.Current.SendSleepAsync();
deferral.Complete();
}
}
}
|
using System;
using System.ComponentModel;
using Windows.ApplicationModel;
#if WINDOWS_UWP
namespace Xamarin.Forms.Platform.UWP
#else
namespace Xamarin.Forms.Platform.WinRT
#endif
{
public abstract class WindowsBasePage : Windows.UI.Xaml.Controls.Page
{
public WindowsBasePage()
{
Windows.UI.Xaml.Application.Current.Suspending += OnApplicationSuspending;
Windows.UI.Xaml.Application.Current.Resuming += OnApplicationResuming;
}
protected Platform Platform { get; private set; }
protected abstract Platform CreatePlatform();
protected void LoadApplication(Application application)
{
if (application == null)
throw new ArgumentNullException("application");
Application.Current = application;
Platform = CreatePlatform();
Platform.SetPage(Application.Current.MainPage);
application.PropertyChanged += OnApplicationPropertyChanged;
Application.Current.SendStart();
}
void OnApplicationPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "MainPage")
Platform.SetPage(Application.Current.MainPage);
}
void OnApplicationResuming(object sender, object e)
{
Application.Current.SendResume();
}
async void OnApplicationSuspending(object sender, SuspendingEventArgs e)
{
SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral();
await Application.Current.SendSleepAsync();
deferral.Complete();
}
}
}
|
mit
|
C#
|
a98e98aba0cd7abc74912bf77066db70d0b0c14b
|
Build script update to fine-tune AppVeyor behaviour as per #10
|
agc93/Cake.VisualStudio,agc93/Cake.VisualStudio
|
build.cake
|
build.cake
|
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutionPath = File("./Cake.VisualStudio.sln");
var solution = ParseSolution(solutionPath);
var projects = solution.Projects;
var projectPaths = projects.Select(p => p.Path.GetDirectory());
var artifacts = "./dist/";
///////////////////////////////////////////////////////////////////////////////
// BUILD VARIABLES
///////////////////////////////////////////////////////////////////////////////
var buildSystem = BuildSystem;
var IsMainCakeVsRepo = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.AppVeyor.Environment.Repository.Branch);
var IsMainCakeVsBranch = StringComparer.OrdinalIgnoreCase.Equals("cake-build/cake-vs", buildSystem.AppVeyor.Environment.Repository.Name);
var IsBuildTagged = buildSystem.AppVeyor.Environment.Repository.Tag.IsTag
&& !string.IsNullOrWhiteSpace(buildSystem.AppVeyor.Environment.Repository.Tag.Name);
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in projectPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
Information("Cleaning common files...");
CleanDirectory(artifacts);
});
Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
Information("Restoring solution...");
NuGetRestore(solutionPath);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building solution...");
MSBuild(solutionPath, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.SetMSBuildPlatform(MSBuildPlatform.x86)
.WithProperty("TreatWarningsAsErrors","true")
.SetVerbosity(Verbosity.Quiet)
.WithTarget("Build")
.SetConfiguration(configuration));
});
Task("Post-Build")
.IsDependentOn("Build")
.Does(() =>
{
CopyFileToDirectory("./src/bin/" + configuration + "/Cake.VisualStudio.vsix", artifacts);
});
Task("Publish-Extension")
.IsDependentOn("Post-Build")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.WithCriteria(() => IsMainCakeVsRepo)
.Does(() =>
{
AppVeyor.UploadArtifact(artifacts + "Cake.VisualStudio.vsix");
});
Task("Default")
.IsDependentOn("Post-Build");
Task("AppVeyor")
.IsDependentOn("Publish-Extension");
RunTarget(target);
|
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutionPath = File("./Cake.VisualStudio.sln");
var solution = ParseSolution(solutionPath);
var projects = solution.Projects;
var projectPaths = projects.Select(p => p.Path.GetDirectory());
var artifacts = "./dist/";
var accountVar = "Marketplace_Account";
var tokenVar = "Marketplace_Token";
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in projectPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
Information("Cleaning common files...");
CleanDirectory(artifacts);
});
Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
Information("Restoring solution...");
NuGetRestore(solutionPath);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building solution...");
MSBuild(solutionPath, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.SetMSBuildPlatform(MSBuildPlatform.x86)
.WithProperty("TreatWarningsAsErrors","true")
.SetVerbosity(Verbosity.Quiet)
.WithTarget("Build")
.SetConfiguration(configuration));
});
Task("Post-Build")
.IsDependentOn("Build")
.Does(() =>
{
CopyFileToDirectory("./src/bin/" + configuration + "/Cake.VisualStudio.vsix", artifacts);
});
Task("Publish-Extension")
.IsDependentOn("Post-Build")
.WithCriteria(AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
AppVeyor.UploadArtifact(artifacts + "Cake.VisualStudio.vsix");
});
Task("Default")
.IsDependentOn("Post-Build");
Task("AppVeyor")
.IsDependentOn("Publish-Extension");
RunTarget(target);
|
mit
|
C#
|
17475e60b0a733344a60a619a3c4fc16f2d9b95d
|
Fix missed test scene update
|
NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,smoogipooo/osu,ppy/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu
|
osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs
|
osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Overlays;
using NUnit.Framework;
using osu.Game.Users;
using osu.Framework.Bindables;
using osu.Game.Overlays.Rankings;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsOverlay : OsuTestScene
{
protected override bool UseOnlineAPI => true;
[Cached(typeof(RankingsOverlay))]
private readonly RankingsOverlay rankingsOverlay;
private readonly Bindable<Country> countryBindable = new Bindable<Country>();
private readonly Bindable<RankingsScope> scope = new Bindable<RankingsScope>();
public TestSceneRankingsOverlay()
{
Add(rankingsOverlay = new TestRankingsOverlay
{
Country = { BindTarget = countryBindable },
Header = { Current = { BindTarget = scope } },
});
}
[Test]
public void TestShow()
{
AddStep("Show", rankingsOverlay.Show);
}
[Test]
public void TestFlagScopeDependency()
{
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is Null", () => countryBindable.Value == null);
AddStep("Set country", () => countryBindable.Value = us_country);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
}
[Test]
public void TestShowCountry()
{
AddStep("Show US", () => rankingsOverlay.ShowCountry(us_country));
}
[Test]
public void TestHide()
{
AddStep("Hide", rankingsOverlay.Hide);
}
private static readonly Country us_country = new Country
{
FlagName = "US",
FullName = "United States"
};
private class TestRankingsOverlay : RankingsOverlay
{
public new Bindable<Country> Country => base.Country;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Overlays;
using NUnit.Framework;
using osu.Game.Users;
using osu.Framework.Bindables;
using osu.Game.Overlays.Rankings;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsOverlay : OsuTestScene
{
protected override bool UseOnlineAPI => true;
[Cached(typeof(RankingsOverlay))]
private readonly RankingsOverlay rankingsOverlay;
private readonly Bindable<Country> countryBindable = new Bindable<Country>();
private readonly Bindable<RankingsScope> scope = new Bindable<RankingsScope>();
public TestSceneRankingsOverlay()
{
Add(rankingsOverlay = new TestRankingsOverlay
{
Country = { BindTarget = countryBindable },
Scope = { BindTarget = scope },
});
}
[Test]
public void TestShow()
{
AddStep("Show", rankingsOverlay.Show);
}
[Test]
public void TestFlagScopeDependency()
{
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is Null", () => countryBindable.Value == null);
AddStep("Set country", () => countryBindable.Value = us_country);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
}
[Test]
public void TestShowCountry()
{
AddStep("Show US", () => rankingsOverlay.ShowCountry(us_country));
}
[Test]
public void TestHide()
{
AddStep("Hide", rankingsOverlay.Hide);
}
private static readonly Country us_country = new Country
{
FlagName = "US",
FullName = "United States"
};
private class TestRankingsOverlay : RankingsOverlay
{
public new Bindable<Country> Country => base.Country;
public new Bindable<RankingsScope> Scope => base.Scope;
}
}
}
|
mit
|
C#
|
00c87bf0858f6ee8c46810f659f70080c62e3bf6
|
Fix information in AssemblyInfo.cs.
|
GunioRobot/sdb-cli,GunioRobot/sdb-cli
|
Mono.Debugger.Cli/Properties/AssemblyInfo.cs
|
Mono.Debugger.Cli/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Mono.Debugger.Cli")]
[assembly: AssemblyProduct("sdb-cli")]
[assembly: AssemblyDescription("Command line interface to Mono.Debugger.Soft")]
[assembly: AssemblyCompany("Xamarin")]
[assembly: AssemblyCopyright("Copyright © Alex Rønne Petersen 2011")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Mono.Debugger.Cli")]
[assembly: AssemblyProduct("Mono.Debugger.Cli")]
[assembly: AssemblyDescription("Command line interface to Mono.Debugger.Soft")]
[assembly: AssemblyCompany("Novell")]
[assembly: AssemblyCopyright("Copyright © Alex Rønne Petersen 2011")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
c7f8af2ab53467f8b8fa2a72eef280e486714054
|
Make renderAtPoint virtual
|
HelloKitty/317refactor
|
src/Rs317.Library/Animable.cs
|
src/Rs317.Library/Animable.cs
|
public class Animable : Cacheable
{
public VertexNormal[] vertexNormals;
public int modelHeight;
protected Animable()
{
modelHeight = 1000;
}
public virtual Model getRotatedModel()
{
return null;
}
public virtual void renderAtPoint(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2)
{
Model model = getRotatedModel();
if(model != null)
{
modelHeight = model.modelHeight;
model.renderAtPoint(i, j, k, l, i1, j1, k1, l1, i2);
}
}
}
|
public class Animable : Cacheable
{
public VertexNormal[] vertexNormals;
public int modelHeight;
protected Animable()
{
modelHeight = 1000;
}
public virtual Model getRotatedModel()
{
return null;
}
public void renderAtPoint(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2)
{
Model model = getRotatedModel();
if(model != null)
{
modelHeight = model.modelHeight;
model.renderAtPoint(i, j, k, l, i1, j1, k1, l1, i2);
}
}
}
|
mit
|
C#
|
8bbed828d8b507f2019c9e9906ec594a5db3ea60
|
Add underscore before "A11y" in setting name
|
roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon
|
R7.Epsilon.LayoutManager/Components/Const.cs
|
R7.Epsilon.LayoutManager/Components/Const.cs
|
//
// Const.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016 Roman M. Yagodin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace R7.Epsilon.LayoutManager.Components
{
public static class Const
{
public const int HOST_PORTAL_ID = -1;
public const string LAYOUT_TAB_SETTING_NAME_BASE = "r7_Epsilon_Layout";
public const string LAYOUT_TAB_SETTING_NAME = LAYOUT_TAB_SETTING_NAME_BASE;
public const string A11Y_LAYOUT_TAB_SETTING_NAME = LAYOUT_TAB_SETTING_NAME + "_A11y";
}
}
|
//
// Const.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016 Roman M. Yagodin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace R7.Epsilon.LayoutManager.Components
{
public static class Const
{
public const int HOST_PORTAL_ID = -1;
public const string LAYOUT_TAB_SETTING_NAME_BASE = "r7_Epsilon_Layout";
public const string LAYOUT_TAB_SETTING_NAME = LAYOUT_TAB_SETTING_NAME_BASE;
public const string A11Y_LAYOUT_TAB_SETTING_NAME = LAYOUT_TAB_SETTING_NAME + "A11y";
}
}
|
agpl-3.0
|
C#
|
c67a86158b83af2e67e9c1d62f057289ca14740d
|
Update WildSets
|
HearthSim/HearthDb
|
HearthDb/Helper.cs
|
HearthDb/Helper.cs
|
using HearthDb.Enums;
using System.Text.RegularExpressions;
namespace HearthDb
{
public static class Helper
{
public static Regex AtCounterRegex = new Regex(@"\|4\(([^,)]+),\s*([^,)]+)\)");
public static Regex ProgressRegex = new Regex(@"\(@\/\d+\)");
public static CardSet[] WildSets =
{
CardSet.BRM, CardSet.LOE, CardSet.TGT, CardSet.HOF,
CardSet.FP1, CardSet.PE1, CardSet.PROMO,
CardSet.KARA, CardSet.OG, CardSet.GANGS,
CardSet.UNGORO, CardSet.ICECROWN, CardSet.LOOTAPALOOZA,
CardSet.GILNEAS, CardSet.BOOMSDAY, CardSet.TROLL,
};
public static CardSet[] ClassicSets = { CardSet.VANILLA };
public static string[] SpellstoneStrings =
{
CardIds.Collectible.Druid.LesserJasperSpellstone,
CardIds.Collectible.Mage.LesserRubySpellstone,
CardIds.Collectible.Paladin.LesserPearlSpellstone,
CardIds.Collectible.Priest.LesserDiamondSpellstone,
CardIds.Collectible.Rogue.LesserOnyxSpellstone,
CardIds.Collectible.Shaman.LesserSapphireSpellstone,
CardIds.Collectible.Warlock.LesserAmethystSpellstone,
CardIds.NonCollectible.Neutral.TheDarkness_TheDarkness
};
}
}
|
using HearthDb.Enums;
using System.Text.RegularExpressions;
namespace HearthDb
{
public static class Helper
{
public static Regex AtCounterRegex = new Regex(@"\|4\(([^,)]+),\s*([^,)]+)\)");
public static Regex ProgressRegex = new Regex(@"\(@\/\d+\)");
public static CardSet[] WildSets =
{
CardSet.PROMO,
CardSet.HOF,
CardSet.NAXX,
CardSet.GVG,
CardSet.BRM,
CardSet.LOE,
CardSet.TGT,
CardSet.OG,
CardSet.KARA,
CardSet.GANGS
};
public static CardSet[] ClassicSets = { CardSet.VANILLA };
public static string[] SpellstoneStrings =
{
CardIds.Collectible.Druid.LesserJasperSpellstone,
CardIds.Collectible.Mage.LesserRubySpellstone,
CardIds.Collectible.Paladin.LesserPearlSpellstone,
CardIds.Collectible.Priest.LesserDiamondSpellstone,
CardIds.Collectible.Rogue.LesserOnyxSpellstone,
CardIds.Collectible.Shaman.LesserSapphireSpellstone,
CardIds.Collectible.Warlock.LesserAmethystSpellstone,
CardIds.NonCollectible.Neutral.TheDarkness_TheDarkness
};
}
}
|
mit
|
C#
|
777aa5012c1fdba127f7fbac41014eb5a10bba73
|
Allow parameters for get authorization uri
|
myquay/Chq.OAuth
|
Chq.OAuth/Client.cs
|
Chq.OAuth/Client.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Chq.OAuth.Credentials;
using System.Reflection;
namespace Chq.OAuth
{
public sealed class Client
{
private OAuthContext _context;
public OAuthContext Context
{
get { return _context; }
}
public TokenContainer RequestToken { get; set; }
public TokenContainer AccessToken { get; set; }
public Client(OAuthContext context)
{
_context = context;
}
public OAuthRequest MakeRequest(string method)
{
return new OAuthRequest(method, Context);
}
public Uri GetAuthorizationUri()
{
return GetAuthorizationUri(null);
}
public Uri GetAuthorizationUri(object parameters)
{
string queryString = String.Empty;
if (parameters != null)
{
Dictionary<string, string> queryParameters = new Dictionary<string, string>();
#if WINMD
foreach (var parameter in parameters.GetType().GetTypeInfo().DeclaredProperties)
{
if (queryParameters.ContainsKey(parameter.Name)) queryParameters.Remove(parameter.Name);
queryParameters.Add(parameter.Name, parameter.GetValue(parameters).ToString());
}
#else
foreach (var parameter in parameters.GetType().GetProperties())
{
if (queryParameters.ContainsKey(parameter.Name)) queryParameters.Remove(parameter.Name);
queryParameters.Add(parameter.Name, parameter.GetValue(parameters, null).ToString());
}
#endif
foreach (var parameter in queryParameters)
{
queryString = String.Format("{0}&{1}={2}", queryString, parameter.Key, Uri.EscapeDataString(parameter.Value));
}
}
return new Uri(Context.AuthorizationUri.ToString() + "?oauth_token=" + RequestToken.Token + queryString);
}
public void Reset()
{
RequestToken = null;
AccessToken = null;
}
public OAuthState State()
{
if (RequestToken == null) return OAuthState.RequestRequired;
else if (AccessToken == null) return OAuthState.TokenRequired;
else return OAuthState.Ready;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Chq.OAuth.Credentials;
namespace Chq.OAuth
{
public sealed class Client
{
private OAuthContext _context;
public OAuthContext Context
{
get { return _context; }
}
public TokenContainer RequestToken { get; set; }
public TokenContainer AccessToken { get; set; }
public Client(OAuthContext context)
{
_context = context;
}
public OAuthRequest MakeRequest(string method)
{
return new OAuthRequest(method, Context);
}
public Uri GetAuthorizationUri()
{
return new Uri(Context.AuthorizationUri.ToString() + "?oauth_token=" + RequestToken.Token);
}
public void Reset()
{
RequestToken = null;
AccessToken = null;
}
public OAuthState State()
{
if (RequestToken == null) return OAuthState.RequestRequired;
else if (AccessToken == null) return OAuthState.TokenRequired;
else return OAuthState.Ready;
}
}
}
|
mit
|
C#
|
0f25d60c202a4f63b467324c1ac496a64162b619
|
Add jqueryval to Create.cshtml
|
Team-Code-Ninjas/SpaceBlog,Team-Code-Ninjas/SpaceBlog,Team-Code-Ninjas/SpaceBlog
|
SpaceBlog/SpaceBlog/Views/Home/Create.cshtml
|
SpaceBlog/SpaceBlog/Views/Home/Create.cshtml
|
@{
ViewBag.Title = "Create";
}
<div class="container">
<h2>@ViewBag.Title</h2>
<div class="container body-content span=8 offset=2">
<form class="form-horizontal">
<fieldset>
<legend>New Post</legend>
<div class="form-group">
<label class="col-sm-4 control-label">Post Title</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="postTitle" placeholder="Post Title">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Author</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="postAuthor" placeholder="Author">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Content</label>
<div class="col-sm-6">
<textarea class="form-control" rows="5" id="postContent"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-4">
<input type="reset" class="btn btn-danger" onclick="location.href='#';" value="Cancel" />
<input type="reset" class="btn btn-primary" onclick="location.href='#';" value="Submit" />
</div>
</div>
</fieldset>
</form>
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
|
@{
ViewBag.Title = "Create";
}
<div class="container">
<h2>@ViewBag.Title</h2>
<div class="container body-content span=8 offset=2">
<form class="form-horizontal">
<fieldset>
<legend>New Post</legend>
<div class="form-group">
<label class="col-sm-4 control-label">Post Title</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="postTitle" placeholder="Post Title">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Author</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="postAuthor" placeholder="Author">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Content</label>
<div class="col-sm-6">
<textarea class="form-control" rows="5" id="postContent"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-4">
<input type="reset" class="btn btn-danger" onclick="location.href='#';" value="Cancel" />
<input type="reset" class="btn btn-primary" onclick="location.href='#';" value="Submit" />
</div>
</div>
</fieldset>
</form>
</div>
</div>
|
mit
|
C#
|
fbeaa20469d9b775e32a9ab2d2b5117c85e9ca0a
|
Refactor the Resolve method to use instances of IPathElement types
|
Domysee/Pather.CSharp
|
src/Pather.CSharp/Resolver.cs
|
src/Pather.CSharp/Resolver.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
using Pather.CSharp.PathElements;
namespace Pather.CSharp
{
public class Resolver
{
private IList<Type> pathElementTypes;
public Resolver()
{
pathElementTypes = new List<Type>();
pathElementTypes.Add(typeof(Property));
}
public object Resolve(object target, string path)
{
var pathElementStrings = path.Split('.');
var pathElements = pathElementStrings.Select(pe => createPathElement(pe));
var tempResult = target;
foreach(var pathElement in pathElements)
{
tempResult = pathElement.Apply(tempResult);
}
var result = tempResult;
return result;
}
private IPathElement createPathElement(string pathElement)
{
//get the first applicable path element type
var pathElementType = pathElementTypes.Where(t => isApplicable(t, pathElement)).FirstOrDefault();
if (pathElementType == null)
throw new InvalidOperationException($"There is no applicable path element type for {pathElement}");
var result = Activator.CreateInstance(pathElementType, pathElement); //each path element type must have a constructor that takes a string parameter
return result as IPathElement;
}
private bool isApplicable(Type t, string pathElement)
{
MethodInfo applicableMethod = t.GetMethod("IsApplicable", BindingFlags.Static | BindingFlags.Public);
if (applicableMethod == null)
throw new InvalidOperationException($"The type {t.Name} does not have a static method IsApplicable");
bool? applicable = applicableMethod.Invoke(null, new[] { pathElement }) as bool?;
if (applicable == null)
throw new InvalidOperationException($"IsApplicable of type {t.Name} does not return bool");
return applicable.Value;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
using Pather.CSharp.PathElements;
namespace Pather.CSharp
{
public class Resolver
{
private IList<Type> pathElementTypes;
public Resolver()
{
pathElementTypes = new List<Type>();
pathElementTypes.Add(typeof(Property));
}
public object Resolve(object target, string path)
{
var pathElements = path.Split('.');
var tempResult = target;
foreach(var pathElement in pathElements)
{
PropertyInfo p = tempResult.GetType().GetProperty(pathElement);
if (p == null)
throw new ArgumentException($"The property {pathElement} could not be found.");
tempResult = p.GetValue(tempResult);
}
var result = tempResult;
return result;
}
private object createPathElement(string pathElement)
{
//get the first applicable path element type
var pathElementType = pathElementTypes.Where(t => isApplicable(t, pathElement)).FirstOrDefault();
if (pathElementType == null)
throw new InvalidOperationException($"There is no applicable path element type for {pathElement}");
var result = Activator.CreateInstance(pathElementType, pathElement); //each path element type must have a constructor that takes a string parameter
return result;
}
private bool isApplicable(Type t, string pathElement)
{
MethodInfo applicableMethod = t.GetMethod("IsApplicable", BindingFlags.Static | BindingFlags.Public);
if (applicableMethod == null)
throw new InvalidOperationException($"The type {t.Name} does not have a static method IsApplicable");
bool? applicable = applicableMethod.Invoke(null, new[] { pathElement }) as bool?;
if (applicable == null)
throw new InvalidOperationException($"IsApplicable of type {t.Name} does not return bool");
return applicable.Value;
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.