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 |
|---|---|---|---|---|---|---|---|---|
bb19658aef139129c6c285b48f252c6d467f4998
|
add flag to prevent VS test runner using excessive parallelism with integration tests
|
gdziadkiewicz/octokit.net,takumikub/octokit.net,gabrielweyer/octokit.net,dlsteuer/octokit.net,thedillonb/octokit.net,hitesh97/octokit.net,TattsGroup/octokit.net,SmithAndr/octokit.net,cH40z-Lord/octokit.net,shana/octokit.net,rlugojr/octokit.net,naveensrinivasan/octokit.net,shiftkey/octokit.net,SamTheDev/octokit.net,nsrnnnnn/octokit.net,shana/octokit.net,bslliw/octokit.net,hahmed/octokit.net,TattsGroup/octokit.net,octokit-net-test-org/octokit.net,Red-Folder/octokit.net,dampir/octokit.net,dampir/octokit.net,octokit/octokit.net,Sarmad93/octokit.net,brramos/octokit.net,fffej/octokit.net,devkhan/octokit.net,khellang/octokit.net,ChrisMissal/octokit.net,octokit/octokit.net,hahmed/octokit.net,eriawan/octokit.net,chunkychode/octokit.net,editor-tools/octokit.net,SLdragon1989/octokit.net,shiftkey/octokit.net,fake-organization/octokit.net,shiftkey-tester/octokit.net,darrelmiller/octokit.net,octokit-net-test/octokit.net,gabrielweyer/octokit.net,Sarmad93/octokit.net,rlugojr/octokit.net,ivandrofly/octokit.net,eriawan/octokit.net,devkhan/octokit.net,M-Zuber/octokit.net,kdolan/octokit.net,editor-tools/octokit.net,mminns/octokit.net,SmithAndr/octokit.net,nsnnnnrn/octokit.net,thedillonb/octokit.net,khellang/octokit.net,M-Zuber/octokit.net,magoswiat/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,daukantas/octokit.net,ivandrofly/octokit.net,SamTheDev/octokit.net,adamralph/octokit.net,alfhenrik/octokit.net,alfhenrik/octokit.net,chunkychode/octokit.net,mminns/octokit.net,geek0r/octokit.net,gdziadkiewicz/octokit.net,kolbasov/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,michaKFromParis/octokit.net,octokit-net-test-org/octokit.net,forki/octokit.net,shiftkey-tester/octokit.net
|
Octokit.Tests.Integration/Properties/AssemblyInfo.cs
|
Octokit.Tests.Integration/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using Xunit;
// 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("Octokit.Tests.Integration")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Octokit.Tests.Integration")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("b2f38691-5807-43db-a427-0548c1c4aa92")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// Prevent the default behaviour of running each test class in parallel for now.
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Octokit.Tests.Integration")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Octokit.Tests.Integration")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("b2f38691-5807-43db-a427-0548c1c4aa92")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
0e8caaa3de94ebad081c4e79f0cb41615e032ddc
|
Convert seconds to actual minutes (works up to an hour...)
|
DragonEyes7/ConcoursUBI17,DragonEyes7/ConcoursUBI17
|
Proto/Assets/Scripts/Leaderboard/LeaderboardEntry.cs
|
Proto/Assets/Scripts/Leaderboard/LeaderboardEntry.cs
|
using UnityEngine;
using UnityEngine.UI;
public class LeaderboardEntry : MonoBehaviour
{
[SerializeField] private Text _name;
[SerializeField] private Text _time;
[SerializeField] private Text _penality;
public void SetInfo(Score score)
{
_name.text = score.Name;
var time = score.Time;
_time.text = string.Format("{0}:{1:00}", time / 60, time % 60);
_penality.text = score.Penality.ToString();
}
}
|
using UnityEngine;
using UnityEngine.UI;
public class LeaderboardEntry : MonoBehaviour
{
[SerializeField] private Text _name;
[SerializeField] private Text _time;
[SerializeField] private Text _penality;
public void SetInfo(Score score)
{
_name.text = score.Name;
_time.text = score.Time.ToString();
_penality.text = score.Penality.ToString();
}
}
|
mit
|
C#
|
b5cf93417ce1e989b55ce314e406d09c8ff3723b
|
Revert "Something new from Peter"
|
JPegasus/Testing
|
TestingApplication/TestingApplication/TestProgram.cs
|
TestingApplication/TestingApplication/TestProgram.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestingApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World\nPress any key to close...");
Console.WriteLine("Added some text");
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestingApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World\nPress any key to close...");
Console.WriteLine("Added some text");
Console.WriteLine("Something new from Peter");
Console.ReadKey();
}
}
}
|
mit
|
C#
|
76ac3c9c1a9adb3be976eb874bbcc60b1cacc168
|
Add ToQueryString extension
|
zapadi/redmine-net-api
|
src/redmine-net-api/Extensions/NameValueCollectionExtensions.cs
|
src/redmine-net-api/Extensions/NameValueCollectionExtensions.cs
|
/*
Copyright 2011 - 2017 Adrian Popescu
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.Collections.Specialized;
using System.Text;
namespace Redmine.Net.Api.Extensions
{
/// <summary>
///
/// </summary>
public static class NameValueCollectionExtensions
{
/// <summary>
/// Gets the parameter value.
/// </summary>
/// <param name="parameters">The parameters.</param>
/// <param name="parameterName">Name of the parameter.</param>
/// <returns></returns>
public static string GetParameterValue(this NameValueCollection parameters, string parameterName)
{
if (parameters == null)
{
return null;
}
var value = parameters.Get(parameterName);
return value.IsNullOrWhiteSpace() ? null : value;
}
/// <summary>
/// Gets the parameter value.
/// </summary>
/// <param name="parameters">The parameters.</param>
/// <param name="parameterName">Name of the parameter.</param>
/// <returns></returns>
public static string GetValue(this NameValueCollection parameters, string parameterName)
{
if (parameters == null)
{
return null;
}
var value = parameters.Get(parameterName);
return value.IsNullOrWhiteSpace() ? null : value;
}
/// <summary>
///
/// </summary>
/// <param name="requestParameters"></param>
/// <returns></returns>
public static string ToQueryString(this NameValueCollection requestParameters)
{
if (requestParameters == null || requestParameters.Count == 0)
{
return null;
}
var stringBuilder = new StringBuilder();
for (var index = 0; index < requestParameters.Count; ++index)
{
stringBuilder.AppendFormat("{0}={1}&",requestParameters.AllKeys[index],requestParameters[index]);
}
stringBuilder.Length -= 1;
stringBuilder.Insert(0, "?");
return stringBuilder.ToString();
}
}
}
|
/*
Copyright 2011 - 2017 Adrian Popescu
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.Collections.Specialized;
namespace Redmine.Net.Api.Extensions
{
/// <summary>
///
/// </summary>
public static class NameValueCollectionExtensions
{
/// <summary>
/// Gets the parameter value.
/// </summary>
/// <param name="parameters">The parameters.</param>
/// <param name="parameterName">Name of the parameter.</param>
/// <returns></returns>
public static string GetParameterValue(this NameValueCollection parameters, string parameterName)
{
if (parameters == null)
{
return null;
}
var value = parameters.Get(parameterName);
return value.IsNullOrWhiteSpace() ? null : value;
}
}
}
|
apache-2.0
|
C#
|
e56c8988078c11494f13419be79ff68bb162096c
|
Add support for listing invoice items via invoice and pending
|
stripe/stripe-dotnet,richardlawley/stripe.net
|
src/Stripe.net/Services/InvoiceItems/InvoiceItemListOptions.cs
|
src/Stripe.net/Services/InvoiceItems/InvoiceItemListOptions.cs
|
namespace Stripe
{
using Newtonsoft.Json;
public class InvoiceItemListOptions : ListOptionsWithCreated
{
[JsonProperty("customer")]
public string CustomerId { get; set; }
[JsonProperty("invoice")]
public string InvoiceId { get; set; }
[JsonProperty("pending")]
public bool? Pending { get; set; }
}
}
|
namespace Stripe
{
using Newtonsoft.Json;
public class InvoiceItemListOptions : ListOptionsWithCreated
{
[JsonProperty("customer")]
public string CustomerId { get; set; }
}
}
|
apache-2.0
|
C#
|
1d6849c578418bc6d9255b38011af8a9531239d5
|
Return null in IsValue for PropertyValueLevel.Inter and Object
|
hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,leekelleher/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,abjerner/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,umbraco/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS
|
src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs
|
src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs
|
using System;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors
{
/// <summary>
/// Provides a default overridable implementation for <see cref="IPropertyValueConverter"/> that does nothing.
/// </summary>
public abstract class PropertyValueConverterBase : IPropertyValueConverter
{
public virtual bool IsConverter(IPublishedPropertyType propertyType)
=> false;
public virtual bool? IsValue(object value, PropertyValueLevel level)
{
switch (level)
{
case PropertyValueLevel.Source:
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
case PropertyValueLevel.Inter:
return null;
case PropertyValueLevel.Object:
return null;
default:
throw new NotSupportedException($"Invalid level: {level}.");
}
}
public virtual bool HasValue(IPublishedProperty property, string culture, string segment)
{
// the default implementation uses the old magic null & string comparisons,
// other implementations may be more clever, and/or test the final converted object values
var value = property.GetSourceValue(culture, segment);
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
}
public virtual Type GetPropertyValueType(IPublishedPropertyType propertyType)
=> typeof (object);
public virtual PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
=> PropertyCacheLevel.Snapshot;
public virtual object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview)
=> source;
public virtual object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
=> inter;
public virtual object ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
=> inter?.ToString() ?? string.Empty;
}
}
|
using System;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Core.PropertyEditors
{
/// <summary>
/// Provides a default overridable implementation for <see cref="IPropertyValueConverter"/> that does nothing.
/// </summary>
public abstract class PropertyValueConverterBase : IPropertyValueConverter
{
public virtual bool IsConverter(IPublishedPropertyType propertyType)
=> false;
public virtual bool? IsValue(object value, PropertyValueLevel level)
{
switch (level)
{
case PropertyValueLevel.Source:
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
default:
throw new NotSupportedException($"Invalid level: {level}.");
}
}
public virtual bool HasValue(IPublishedProperty property, string culture, string segment)
{
// the default implementation uses the old magic null & string comparisons,
// other implementations may be more clever, and/or test the final converted object values
var value = property.GetSourceValue(culture, segment);
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
}
public virtual Type GetPropertyValueType(IPublishedPropertyType propertyType)
=> typeof (object);
public virtual PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
=> PropertyCacheLevel.Snapshot;
public virtual object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview)
=> source;
public virtual object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
=> inter;
public virtual object ConvertIntermediateToXPath(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview)
=> inter?.ToString() ?? string.Empty;
}
}
|
mit
|
C#
|
942d52afdeee442e7f561502bff753c4f041522a
|
bump version to 0.10.0
|
kalyanraman/WebApiContrib.IoC.CastleWindsor,WebApiContrib/WebApiContrib.IoC.CastleWindsor,WebApiContrib/WebApiContrib.IoC.CastleWindsor,modulexcite/WebApiContrib.IoC.CastleWindsor
|
src/WebApiContrib.IoC.CastleWindsor/Properties/AssemblyInfo.cs
|
src/WebApiContrib.IoC.CastleWindsor/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("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyDescription("The WebApiContrib.IoC.CastleWindsor library provides dependency injection helpers for ASP.NET Web API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WebApiContrib")]
[assembly: AssemblyProduct("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyCopyright("Copyright © WebApiContrib 2012")]
[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("087a0a37-a64a-41bb-bce6-fb2e2aa1b6a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.10.0")]
[assembly: AssemblyFileVersion("0.10.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyDescription("The WebApiContrib.IoC.CastleWindsor library provides dependency injection helpers for ASP.NET Web API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WebApiContrib")]
[assembly: AssemblyProduct("WebApiContrib.IoC.CastleWindsor")]
[assembly: AssemblyCopyright("Copyright © WebApiContrib 2012")]
[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("087a0a37-a64a-41bb-bce6-fb2e2aa1b6a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.9.4")]
[assembly: AssemblyFileVersion("0.9.4")]
|
mit
|
C#
|
efa5475d56e702c1045a37fb64f0af9aa7ce7144
|
improve text of event time now
|
leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net
|
Joinrpg/Views/Shared/DisplayTemplates/EventTime.cshtml
|
Joinrpg/Views/Shared/DisplayTemplates/EventTime.cshtml
|
@model DateTime?
@{
if (Model == null)
{
return;
}
var val = (DateTime) Model;
var now = DateTime.UtcNow;
if (val > now)
{
@val.ToShortDateString()
return;
}
var span = now.Subtract(val);
if (span.Days > 180)
{
@val.ToShortDateString()
}
else if (span.Days > 7 && val.Year != now.Year)
{
@val.ToShortDateString()
}
else if (span.Days > 7)
{
@val.ToString("dd MMMM")
}
else if (span.Days > 1)
{
<text>@DisplayCount.OfX(span.Days, "день", "дня", "дней") назад @*(@val.ToString("dddd"))*@ </text>
}
else if (span.Days == 1)
{
<text>позавчера</text>
}
else if (span.Hours > 5 && val.Day != now.Day)
{
<text>вчера</text>
}
else if (span.Hours > 0)
{
@DisplayCount.OfX(span.Hours, "час", "часа", "часов")<text> назад</text>
}
else if (span.Minutes > 0)
{
@DisplayCount.OfX(span.Minutes, "минуту", "минуты", "минут")<text> назад</text>
}
else if (span.Seconds > 20)
{
<text>меньше минуты назад</text>
}
else
{
<text>только что</text>
}
}
|
@model DateTime?
@{
if (Model == null)
{
return;
}
var val = (DateTime) Model;
var now = DateTime.UtcNow;
if (val > now)
{
@val.ToShortDateString()
return;
}
var span = now.Subtract(val);
if (span.Days > 180)
{
@val.ToShortDateString()
}
else if (span.Days > 7 && val.Year != now.Year)
{
@val.ToShortDateString()
}
else if (span.Days > 7)
{
@val.ToString("dd MMMM")
}
else if (span.Days > 1)
{
<text>@DisplayCount.OfX(span.Days, "день", "дня", "дней") назад @*(@val.ToString("dddd"))*@ </text>
}
else if (span.Days == 1)
{
<text>позавчера</text>
}
else if (span.Hours > 5 && val.Day != now.Day)
{
<text>вчера</text>
}
else if (span.Hours > 0)
{
@DisplayCount.OfX(span.Hours, "час", "часа", "часов")<text> назад</text>
}
else if (span.Minutes > 0)
{
@DisplayCount.OfX(span.Minutes, "минуту", "минуты", "минут")<text> назад</text>
}
else if (span.Seconds > 20)
{
<text>меньше минуты назад</text>
}
else
{
<text>сейчас</text>
}
}
|
mit
|
C#
|
110cd3b196d5f71ea65e3908ea4e56effe074484
|
test commit
|
altimesh/hybridizer-basic-samples,altimesh/hybridizer-basic-samples
|
HybridizerBasicSamples/1.Simple/HelloWorld/HelloWorld/Program.cs
|
HybridizerBasicSamples/1.Simple/HelloWorld/HelloWorld/Program.cs
|
using Hybridizer.Runtime.CUDAImports;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
[EntryPoint("run")]
public static void Run(int N, double[] a, double[] b)
{
Parallel.For(0, N, i => { a[i] += b[i]; });
toto
}
static void Main(string[] args)
{
//Initialize a stopwatch
Stopwatch timer = new Stopwatch();
int N = 1024 * 1024 * 64;
double[] acuda = new double[N];
double[] adotnet = new double[N];
double[] b = new double[N];
Random rand = new Random();
//Initialize acuda et adotnet and b by some doubles randoms, acuda and adotnet have same numbers.
for(int i = 0; i < N; ++i)
{
acuda[i] = rand.NextDouble();
adotnet[i] = acuda[i];
b[i] = rand.NextDouble();
}
// create an instance of HybRunner object to wrap calls on GPU
HybRunner runner = HybRunner.Cuda("HelloWorld_CUDA.dll").SetDistrib(20,256);
// create a wrapper object to call GPU methods instead of C#
dynamic wrapped = runner.Wrap(new Program());
//Start the stopwatch
timer.Start();
// run the method on GPU
wrapped.Run(N, acuda, b);
//Stop the stopwatch
timer.Stop();
//Restart the stopwatch
timer.Restart();
// run the method on CPU
Run(N, adotnet, b);
//Stop the stopwatch
timer.Stop();
// verify the results
for (int k = 0; k < N; ++k)
{
if (acuda[k] != adotnet[k])
Console.Out.WriteLine("ERROR !");
}
Console.Out.WriteLine("DONE");
}
}
}
|
using Hybridizer.Runtime.CUDAImports;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
[EntryPoint("run")]
public static void Run(int N, double[] a, double[] b)
{
Parallel.For(0, N, i => { a[i] += b[i]; });
}
static void Main(string[] args)
{
//Initialize a stopwatch
Stopwatch timer = new Stopwatch();
int N = 1024 * 1024 * 64;
double[] acuda = new double[N];
double[] adotnet = new double[N];
double[] b = new double[N];
Random rand = new Random();
//Initialize acuda et adotnet and b by some doubles randoms, acuda and adotnet have same numbers.
for(int i = 0; i < N; ++i)
{
acuda[i] = rand.NextDouble();
adotnet[i] = acuda[i];
b[i] = rand.NextDouble();
}
// create an instance of HybRunner object to wrap calls on GPU
HybRunner runner = HybRunner.Cuda("HelloWorld_CUDA.dll").SetDistrib(20,256);
// create a wrapper object to call GPU methods instead of C#
dynamic wrapped = runner.Wrap(new Program());
//Start the stopwatch
timer.Start();
// run the method on GPU
wrapped.Run(N, acuda, b);
//Stop the stopwatch
timer.Stop();
//Restart the stopwatch
timer.Restart();
// run the method on CPU
Run(N, adotnet, b);
//Stop the stopwatch
timer.Stop();
// verify the results
for (int k = 0; k < N; ++k)
{
if (acuda[k] != adotnet[k])
Console.Out.WriteLine("ERROR !");
}
Console.Out.WriteLine("DONE");
}
}
}
|
mit
|
C#
|
d413a0e72f034df77674134daa525adf70e1e941
|
Add RelayStateChanged event type
|
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
|
src/SyncTrayzor/SyncThing/ApiClient/EventType.cs
|
src/SyncTrayzor/SyncThing/ApiClient/EventType.cs
|
using Newtonsoft.Json;
namespace SyncTrayzor.SyncThing.ApiClient
{
[JsonConverter(typeof(DefaultingStringEnumConverter))]
public enum EventType
{
Unknown,
Starting,
StartupComplete,
Ping,
DeviceDiscovered,
DeviceConnected,
DeviceDisconnected,
RemoteIndexUpdated,
LocalIndexUpdated,
ItemStarted,
ItemFinished,
// Not quite sure which it's going to be, so play it safe...
MetadataChanged,
ItemMetadataChanged,
StateChanged,
FolderRejected,
DeviceRejected,
ConfigSaved,
DownloadProgress,
FolderSummary,
FolderCompletion,
FolderErrors,
RelayStateChanged,
}
}
|
using Newtonsoft.Json;
namespace SyncTrayzor.SyncThing.ApiClient
{
[JsonConverter(typeof(DefaultingStringEnumConverter))]
public enum EventType
{
Unknown,
Starting,
StartupComplete,
Ping,
DeviceDiscovered,
DeviceConnected,
DeviceDisconnected,
RemoteIndexUpdated,
LocalIndexUpdated,
ItemStarted,
ItemFinished,
// Not quite sure which it's going to be, so play it safe...
MetadataChanged,
ItemMetadataChanged,
StateChanged,
FolderRejected,
DeviceRejected,
ConfigSaved,
DownloadProgress,
FolderSummary,
FolderCompletion,
FolderErrors,
}
}
|
mit
|
C#
|
ddce3dfa286a05fa2a0804b564d6b2970c46d16e
|
Fix build error.
|
helix-toolkit/helix-toolkit,holance/helix-toolkit,chrkon/helix-toolkit,JeremyAnsel/helix-toolkit
|
Source/HelixToolkit.Wpf.SharpDX.Shared/Controls/IRenderCanvas.cs
|
Source/HelixToolkit.Wpf.SharpDX.Shared/Controls/IRenderCanvas.cs
|
#if COREWPF
using HelixToolkit.SharpDX.Core;
using RelayExceptionEventArgs = HelixToolkit.SharpDX.Core.Utilities.RelayExceptionEventArgs;
#endif
namespace HelixToolkit.Wpf.SharpDX
{
namespace Controls
{
using System;
using Utilities;
/// <summary>
/// Canvas holds the RenderHost. Provide entry point or render surface for RenderHost to render to.
/// </summary>
public interface IRenderCanvas
{
/// <summary>
/// Gets the render host.
/// </summary>
/// <value>
/// The render host.
/// </value>
IRenderHost RenderHost { get; }
/// <summary>
/// Fired whenever an exception occurred on this object.
/// </summary>
event EventHandler<RelayExceptionEventArgs> ExceptionOccurred;
}
}
}
|
#if COREWPF
using HelixToolkit.SharpDX.Core;
#endif
namespace HelixToolkit.Wpf.SharpDX
{
namespace Controls
{
using System;
using Utilities;
/// <summary>
/// Canvas holds the RenderHost. Provide entry point or render surface for RenderHost to render to.
/// </summary>
public interface IRenderCanvas
{
/// <summary>
/// Gets the render host.
/// </summary>
/// <value>
/// The render host.
/// </value>
IRenderHost RenderHost { get; }
/// <summary>
/// Fired whenever an exception occurred on this object.
/// </summary>
event EventHandler<RelayExceptionEventArgs> ExceptionOccurred;
}
}
}
|
mit
|
C#
|
c0e1a8afd40eae94652701ce01f79acec5f8b615
|
Increase default timeout time to one minute
|
RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate
|
Tests/Boxed.Templates.Test/Framework/CancellationTokenFactory.cs
|
Tests/Boxed.Templates.Test/Framework/CancellationTokenFactory.cs
|
namespace Boxed.Templates.Test
{
using System;
using System.Threading;
public static class CancellationTokenFactory
{
public static CancellationToken GetCancellationToken(TimeSpan? timeout) =>
GetCancellationToken(timeout ?? TimeSpan.FromMinutes(1));
public static CancellationToken GetCancellationToken(TimeSpan timeout) =>
new CancellationTokenSource(timeout).Token;
}
}
|
namespace Boxed.Templates.Test
{
using System;
using System.Threading;
public static class CancellationTokenFactory
{
public static CancellationToken GetCancellationToken(TimeSpan? timeout) =>
GetCancellationToken(timeout ?? TimeSpan.FromSeconds(30));
public static CancellationToken GetCancellationToken(TimeSpan timeout) =>
new CancellationTokenSource(timeout).Token;
}
}
|
mit
|
C#
|
0972dedddfbcc2b9e1bdc9e900211db895f4a14d
|
Revert "Remove animator not initialized warning"
|
stlgamedev/gateway2dwest,IGDAStl/gateway2dwest,IGDAStl/gateway2dwest,IGDAStl/gateway2dwest,stlgamedev/gateway2dwest,stlgamedev/gateway2dwest
|
Assets/Scripts/PlayerMovement.cs
|
Assets/Scripts/PlayerMovement.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PlayerMovement : MonoBehaviour
{
public float movementSpeed = 2.0f;
public InputHelper inputHelper;
public int playerID = 0; //Setting foundation for multiple players
Animator animator;
Rigidbody2D rb;
// Use this for initialization
void Start ()
{
animator = GetComponent<Animator> (); //In unity, GetComponent is implicit to the object the script is attached, thus "this" is not needed
rb = GetComponent<Rigidbody2D> (); //Gets attached rigidbody2D component
}
// Update is called once per frame
void Update ()
{
Vector2 axis = inputHelper.axisRaw (); //Get's input from helper class. This allows for unit testing as well as changing input while inside of the game.
axis = EnsurePlayerNeverMovesFasterThanMaxSpeed (axis);
UpdateAnimationStates (axis);
rb.velocity = axis * movementSpeed;
}
private void UpdateAnimationStates (Vector2 axis)
{
if (Mathf.Abs (axis.x) > Mathf.Abs (axis.y)) {
SetAnimationParameters (axis.x, 0.0f);
//Sets up walking left/right animation
} else if (Mathf.Abs (axis.x) < Mathf.Abs (axis.y)) {
SetAnimationParameters (0.0f, axis.y);
//Sets up walking up/down animation
} else if (axis == Vector2.zero) {
//Checking if it's equal to zero will allow animations when sliding against walls to still work
SetAnimationParameters (0, 0);
//sets up idle animation
}
}
private void SetAnimationParameters (float x, float y)
{
animator.SetFloat ("HorizontalMovement", x);
animator.SetFloat ("VerticalMovement", y);
}
private Vector2 EnsurePlayerNeverMovesFasterThanMaxSpeed (Vector2 axis)
{
if (Mathf.Abs (axis.magnitude) >= 1) {
axis.Normalize ();
}
return axis;
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PlayerMovement : MonoBehaviour
{
public float movementSpeed = 2.0f;
public InputHelper inputHelper;
public int playerID = 0; //Setting foundation for multiple players
Animator animator;
Rigidbody2D rb;
// Use this for initialization
void Start ()
{
animator = GetComponent<Animator> (); //In unity, GetComponent is implicit to the object the script is attached, thus "this" is not needed
rb = GetComponent<Rigidbody2D> (); //Gets attached rigidbody2D component
}
// Update is called once per frame
void Update ()
{
Vector2 axis = inputHelper.axisRaw (); //Get's input from helper class. This allows for unit testing as well as changing input while inside of the game.
axis = EnsurePlayerNeverMovesFasterThanMaxSpeed (axis);
UpdateAnimationStates (axis);
rb.velocity = axis * movementSpeed;
}
private void UpdateAnimationStates (Vector2 axis)
{
if (Mathf.Abs (axis.x) > Mathf.Abs (axis.y)) {
SetAnimationParameters (axis.x, 0.0f);
//Sets up walking left/right animation
} else if (Mathf.Abs (axis.x) < Mathf.Abs (axis.y)) {
SetAnimationParameters (0.0f, axis.y);
//Sets up walking up/down animation
} else if (axis == Vector2.zero) {
//Checking if it's equal to zero will allow animations when sliding against walls to still work
SetAnimationParameters (0, 0);
//sets up idle animation
}
}
private void SetAnimationParameters (float x, float y)
{
if (!animator) {
animator.SetFloat ("HorizontalMovement", x);
animator.SetFloat ("VerticalMovement", y);
}
}
private Vector2 EnsurePlayerNeverMovesFasterThanMaxSpeed (Vector2 axis)
{
if (Mathf.Abs (axis.magnitude) >= 1) {
axis.Normalize ();
}
return axis;
}
}
|
apache-2.0
|
C#
|
48cda1c95b46d870d8ecf0c5c1335ba8f954a899
|
Set adminModeTriggerer back to 180 seconds
|
mikelovesrobots/daft-pong,mikelovesrobots/daft-pong
|
app/Assets/Scripts/AdminModeTriggerer.cs
|
app/Assets/Scripts/AdminModeTriggerer.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class AdminModeTriggerer : MonoBehaviour {
private const float WAIT_TIME = 180f;
public ActionBase AdminModeAction;
public void Initialize() {
StartCoroutine(WaitThenEnterAdminMode());
}
public IEnumerator WaitThenEnterAdminMode() {
yield return new WaitForSeconds(WAIT_TIME);
AdminModeAction.Act();
}
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class AdminModeTriggerer : MonoBehaviour {
private const float WAIT_TIME = 10f;
public ActionBase AdminModeAction;
public void Initialize() {
StartCoroutine(WaitThenEnterAdminMode());
}
public IEnumerator WaitThenEnterAdminMode() {
yield return new WaitForSeconds(WAIT_TIME);
AdminModeAction.Act();
}
}
|
mit
|
C#
|
eb2ff2e42790fe38da28f0bfdcb2677ea4b191e4
|
Remove empty line
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/Behaviors/FocusNextItemBehavior.cs
|
WalletWasabi.Fluent/Behaviors/FocusNextItemBehavior.cs
|
using Avalonia;
using Avalonia.Controls;
using Avalonia.LogicalTree;
using ReactiveUI;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace WalletWasabi.Fluent.Behaviors
{
internal class FocusNextItemBehavior : DisposingBehavior<Control>
{
public static readonly StyledProperty<bool> IsFocusedProperty =
AvaloniaProperty.Register<FocusNextItemBehavior, bool>(nameof(IsFocused), true);
public bool IsFocused
{
get => GetValue(IsFocusedProperty);
set => SetValue(IsFocusedProperty, value);
}
protected override void OnAttached(CompositeDisposable disposables)
{
this.WhenAnyValue(x => x.IsFocused)
.Where(x => x == false)
.Subscribe(
_ =>
{
var parentControl = AssociatedObject.FindLogicalAncestorOfType<ItemsControl>();
if (parentControl is { })
{
foreach (var item in parentControl.GetLogicalChildren())
{
var nextToFocus = item.FindLogicalDescendantOfType<TextBox>();
if (nextToFocus.IsEnabled)
{
nextToFocus.Focus();
return;
}
}
parentControl.Focus();
}
})
.DisposeWith(disposables);
}
}
}
|
using Avalonia;
using Avalonia.Controls;
using Avalonia.LogicalTree;
using ReactiveUI;
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
namespace WalletWasabi.Fluent.Behaviors
{
internal class FocusNextItemBehavior : DisposingBehavior<Control>
{
public static readonly StyledProperty<bool> IsFocusedProperty =
AvaloniaProperty.Register<FocusNextItemBehavior, bool>(nameof(IsFocused), true);
public bool IsFocused
{
get => GetValue(IsFocusedProperty);
set => SetValue(IsFocusedProperty, value);
}
protected override void OnAttached(CompositeDisposable disposables)
{
this.WhenAnyValue(x => x.IsFocused)
.Where(x => x == false)
.Subscribe(
_ =>
{
var parentControl = AssociatedObject.FindLogicalAncestorOfType<ItemsControl>();
if (parentControl is { })
{
foreach (var item in parentControl.GetLogicalChildren())
{
var nextToFocus = item.FindLogicalDescendantOfType<TextBox>();
if (nextToFocus.IsEnabled)
{
nextToFocus.Focus();
return;
}
}
parentControl.Focus();
}
})
.DisposeWith(disposables);
}
}
}
|
mit
|
C#
|
edbb62f58144f6b0b45022e330eefc09e40e88d5
|
Fix error with JournalShipyardSell.cs
|
mwerle/EDDiscovery,jthorpe4/EDDiscovery,jgoode/EDDiscovery,jgoode/EDDiscovery,mwerle/EDDiscovery
|
EDDiscovery/EliteDangerous/JournalEvents/JournalShipyardSell.cs
|
EDDiscovery/EliteDangerous/JournalEvents/JournalShipyardSell.cs
|
/*
* Copyright © 2016 EDDiscovery development team
*
* 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.
*
* EDDiscovery is not affiliated with Frontier Developments plc.
*/
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EDDiscovery.EliteDangerous.JournalEvents
{
[JournalEntryType(JournalTypeEnum.ShipyardSell)]
public class JournalShipyardSell : JournalEntry, ILedgerJournalEntry
{
//When Written: when selling a ship stored in the shipyard
//Parameters:
//• ShipType: type of ship being sold
//• SellShipID
//• ShipPrice: sale price
//• System: (if ship is in another system) name of system
public JournalShipyardSell(JObject evt ) : base(evt, JournalTypeEnum.ShipyardSell)
{
ShipType = JournalEntry.GetBetterShipName(JSONHelper.GetStringDef(evt["ShipType"]));
SellShipId = JSONHelper.GetInt(evt["SellShipID"]);
ShipPrice = JSONHelper.GetLong(evt["ShipPrice"]);
System = JSONHelper.GetStringDef(evt["System"]);
}
public string ShipType { get; set; }
public int SellShipId { get; set; }
public long ShipPrice { get; set; }
public string System { get; set; }
public override string DefaultRemoveItems()
{
return base.DefaultRemoveItems() + ";SellShipID";
}
public static System.Drawing.Bitmap Icon { get { return EDDiscovery.Properties.Resources.shipyardsell; } }
public void Ledger(EDDiscovery2.DB.MaterialCommoditiesLedger mcl, DB.SQLiteConnectionUser conn)
{
mcl.AddEvent(Id, EventTimeUTC, EventTypeID, ShipType, ShipPrice);
}
}
}
|
/*
* Copyright © 2016 EDDiscovery development team
*
* 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.
*
* EDDiscovery is not affiliated with Frontier Developments plc.
*/
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EDDiscovery.EliteDangerous.JournalEvents
{
public class JournalShipyardSell : JournalEntry, ILedgerJournalEntry
{
//When Written: when selling a ship stored in the shipyard
//Parameters:
//• ShipType: type of ship being sold
//• SellShipID
//• ShipPrice: sale price
//• System: (if ship is in another system) name of system
[JournalEntryType(JournalTypeEnum.ShipyardSell)]
public JournalShipyardSell(JObject evt ) : base(evt, JournalTypeEnum.ShipyardSell)
{
ShipType = JournalEntry.GetBetterShipName(JSONHelper.GetStringDef(evt["ShipType"]));
SellShipId = JSONHelper.GetInt(evt["SellShipID"]);
ShipPrice = JSONHelper.GetLong(evt["ShipPrice"]);
System = JSONHelper.GetStringDef(evt["System"]);
}
public string ShipType { get; set; }
public int SellShipId { get; set; }
public long ShipPrice { get; set; }
public string System { get; set; }
public override string DefaultRemoveItems()
{
return base.DefaultRemoveItems() + ";SellShipID";
}
public static System.Drawing.Bitmap Icon { get { return EDDiscovery.Properties.Resources.shipyardsell; } }
public void Ledger(EDDiscovery2.DB.MaterialCommoditiesLedger mcl, DB.SQLiteConnectionUser conn)
{
mcl.AddEvent(Id, EventTimeUTC, EventTypeID, ShipType, ShipPrice);
}
}
}
|
apache-2.0
|
C#
|
bdb74aa76ca215cb6352400a0b4756b850734903
|
Refactor tests.
|
JohanLarsson/Gu.Wpf.UiAutomation
|
Gu.Wpf.UiAutomation.UnitTests/Extensions/EnumeranbleExtTests.cs
|
Gu.Wpf.UiAutomation.UnitTests/Extensions/EnumeranbleExtTests.cs
|
namespace Gu.Wpf.UiAutomation.UnitTests.Extensions
{
using System;
using System.Linq;
using NUnit.Framework;
[TestFixture]
public class EnumeranbleExtTests
{
[TestCase("", false, 0)]
[TestCase("1, 2", false, 0)]
[TestCase("1", true, 1)]
public void TryGetSingle(string text, bool expected, int match)
{
var ints = text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(int.Parse)
.ToArray();
Assert.AreEqual(expected, ints.TryGetSingle(out var result));
Assert.AreEqual(match, result);
}
[TestCase("", false, 0)]
[TestCase("2, 2, 3", false, 0)]
[TestCase("1, 1", false, 0)]
[TestCase("1, 1, 3", false, 0)]
[TestCase("1, 2, 2", true, 1)]
[TestCase("1, 2", true, 1)]
[TestCase("1", true, 1)]
public void TryGetSingleWithSelector(string text, bool expected, int match)
{
var ints = text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(int.Parse)
.ToArray();
Assert.AreEqual(expected, ints.TryGetSingle(x => x == 1, out var result));
Assert.AreEqual(match, result);
}
}
}
|
namespace Gu.Wpf.UiAutomation.UnitTests.Extensions
{
using NUnit.Framework;
[TestFixture]
public class EnumeranbleExtTests
{
[TestCase(new int[0], false, 0)]
[TestCase(new[] { 1, 2 }, false, 0)]
[TestCase(new[] { 1 }, true, 1)]
public void TryGetSingle(int[] ints, bool expected, int match)
{
Assert.AreEqual(expected, ints.TryGetSingle(out var result));
Assert.AreEqual(match, result);
}
[TestCase(new int[0], false, 0)]
[TestCase(new[] { 2, 2, 3 }, false, 0)]
[TestCase(new[] { 1, 1 }, false, 0)]
[TestCase(new[] { 1, 1, 3 }, false, 0)]
[TestCase(new[] { 1, 2, 2 }, true, 1)]
[TestCase(new[] { 1, 2 }, true, 1)]
[TestCase(new[] { 1 }, true, 1)]
public void TryGetSingleWithSelector(int[] ints, bool expected, int match)
{
Assert.AreEqual(expected, ints.TryGetSingle(x => x == 1, out var result));
Assert.AreEqual(match, result);
}
}
}
|
mit
|
C#
|
b8043ac4fb3730d854408677f57448a540d67b9d
|
Update operations
|
lury-lang/lury-ir
|
LuryIR/Compiling/IR/Operation.cs
|
LuryIR/Compiling/IR/Operation.cs
|
//
// Operation.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tomona Nanase
//
// 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 Lury.Compiling.IR
{
public enum Operation
{
Nop,
Load,
Store,
Inc,
Dec,
Pos,
Neg,
Bnot,
Pow,
Mul,
Div,
Idiv,
Mod,
Add,
Sub,
Con,
Shl,
Shr,
And,
Xor,
Or,
Lt,
Gt,
Ltq,
Gtq,
Eq,
Neq,
Is,
Isn,
Lnot,
Land,
Lor,
Ret,
Yield,
Throw,
Call,
Eval,
Jmp,
Jmpt,
Jmpf,
Jmpn,
Catch,
Ovlok,
Func,
Class,
Annot,
}
}
|
//
// Operation.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tomona Nanase
//
// 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 Lury.Compiling.IR
{
public enum Operation
{
Nop,
Inc,
Dec,
Pos,
Neg,
Bnot,
Pow,
Mul,
Div,
Idiv,
Rem,
Add,
Sub,
Con,
Shl,
Shr,
And,
Xor,
Or,
Lt,
Gt,
Ltq,
Gtq,
Eq,
Neq,
Is,
Isn,
Lnot,
Land,
Lor,
Ret,
Yield,
Throw,
Call,
Eval,
Jmp,
Jmpt,
Jmpf,
Jmpn,
Catch,
Ovlok,
Func,
Class,
Intfc,
Annot,
}
}
|
mit
|
C#
|
194f086f42b7c9e16964833cf5249a33046e3e72
|
add stupid lock for download
|
alkozko/MyStem.Sharp
|
MyStem.Sharp/MyStemDownloader.cs
|
MyStem.Sharp/MyStemDownloader.cs
|
using System;
using System.IO;
using System.IO.Compression;
using System.Net;
namespace MyStem.Sharp
{
public class MyStemDownloader
{
private readonly Uri _url;
private readonly string _baseFolder;
private static readonly object Lockobj = new object();
public MyStemDownloader(string url = @"http://download.cdn.yandex.net/mystem/mystem-3.0-win7-64bit.zip")
{
_url = new Uri(url, UriKind.Absolute);
_baseFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
}
public string GetLocalPath()
{
lock (Lockobj)
{
var directory = Path.Combine(_baseFolder, "mystem");
if (Directory.Exists(directory) == false)
Directory.CreateDirectory(directory);
var myStemExePath = Path.Combine(directory, "mystem.exe");
if (File.Exists(myStemExePath))
return myStemExePath;
var myStemZipPath = Path.Combine(directory, "mystem.zip");
using (var webClient = new WebClient())
{
webClient.DownloadFile(_url, myStemZipPath);
ZipFile.ExtractToDirectory(myStemZipPath, directory);
File.Delete(myStemZipPath);
}
return "";
}
}
}
}
|
using System;
using System.IO;
using System.IO.Compression;
using System.Net;
namespace MyStem.Sharp
{
public class MyStemDownloader
{
private readonly Uri _url;
private readonly string _baseFolder;
public MyStemDownloader(string url = @"http://download.cdn.yandex.net/mystem/mystem-3.0-win7-64bit.zip")
{
_url = new Uri(url, UriKind.Absolute);
_baseFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
}
public string GetLocalPath()
{
var directory = Path.Combine(_baseFolder, "mystem");
if (Directory.Exists(directory) == false)
Directory.CreateDirectory(directory);
var myStemExePath = Path.Combine(directory, "mystem.exe");
if (File.Exists(myStemExePath))
return myStemExePath;
var myStemZipPath = Path.Combine(directory, "mystem.zip");
using (var webClient = new WebClient())
{
webClient.DownloadFile(_url, myStemZipPath);
ZipFile.ExtractToDirectory(myStemZipPath, directory);
File.Delete(myStemZipPath);
}
return myStemExePath;
}
}
}
|
mit
|
C#
|
783d94b5e5ef2d1d7c1e53ac08ad708ac7cfcf31
|
Increment recordCount in thread-safe in ScanParallel example.
|
YuvalItzchakov/aerospike-client-csharp
|
AerospikeDemo/ScanParallel.cs
|
AerospikeDemo/ScanParallel.cs
|
/*
* Copyright 2012-2015 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
using System;
using System.Threading;
using Aerospike.Client;
namespace Aerospike.Demo
{
public class ScanParallel : SyncExample
{
private int recordCount = 0;
public ScanParallel(Console console) : base(console)
{
}
/// <summary>
/// Scan all nodes in parallel and read all records in a set.
/// </summary>
public override void RunExample(AerospikeClient client, Arguments args)
{
console.Info("Scan parallel: namespace=" + args.ns + " set=" + args.set);
recordCount = 0;
DateTime begin = DateTime.Now;
ScanPolicy policy = new ScanPolicy();
client.ScanAll(policy, args.ns, args.set, ScanCallback);
DateTime end = DateTime.Now;
double seconds = end.Subtract(begin).TotalSeconds;
console.Info("Total records returned: " + recordCount);
console.Info("Elapsed time: " + seconds + " seconds");
double performance = Math.Round((double)recordCount / seconds);
console.Info("Records/second: " + performance);
}
public void ScanCallback(Key key, Record record)
{
int count = Interlocked.Increment(ref recordCount);
if ((count % 10000) == 0)
{
console.Info("Records " + count);
}
}
}
}
|
/*
* Copyright 2012-2014 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
using System;
using Aerospike.Client;
namespace Aerospike.Demo
{
public class ScanParallel : SyncExample
{
private int recordCount = 0;
public ScanParallel(Console console) : base(console)
{
}
/// <summary>
/// Scan all nodes in parallel and read all records in a set.
/// </summary>
public override void RunExample(AerospikeClient client, Arguments args)
{
console.Info("Scan parallel: namespace=" + args.ns + " set=" + args.set);
recordCount = 0;
DateTime begin = DateTime.Now;
ScanPolicy policy = new ScanPolicy();
client.ScanAll(policy, args.ns, args.set, ScanCallback);
DateTime end = DateTime.Now;
double seconds = end.Subtract(begin).TotalSeconds;
console.Info("Total records returned: " + recordCount);
console.Info("Elapsed time: " + seconds + " seconds");
double performance = Math.Round((double)recordCount / seconds);
console.Info("Records/second: " + performance);
}
public void ScanCallback(Key key, Record record)
{
recordCount++;
if ((recordCount % 10000) == 0)
{
console.Info("Records " + recordCount);
}
}
}
}
|
apache-2.0
|
C#
|
e7c181a86989fe948f269786d1c24e744208ba3f
|
Update CameraEffectControlScript.cs
|
krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,krille90/unitystation,fomalsd/unitystation
|
UnityProject/Assets/Scripts/Camera/CameraEffectControlScript.cs
|
UnityProject/Assets/Scripts/Camera/CameraEffectControlScript.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace CameraEffects
{
public class CameraEffectControlScript : MonoBehaviour
{
public DrunkCamera drunkCamera;
public GlitchEffect glitchEffect;
public NightVisionCamera nightVisionCamera;
public HologramCamera hologramCamera;
public void ToggleDrunkEffectState()
{
drunkCamera.enabled = !drunkCamera.enabled;
}
public void ToggleGlitchEffectState()
{
glitchEffect.enabled = !glitchEffect.enabled;
}
public void ToggleNightVisionEffectState()
{
nightVisionCamera.enabled = !nightVisionCamera.enabled;
}
public void ToggleHologramEffectState()
{
hologramCamera.enabled = !hologramCamera.enabled;
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace CameraEffects
{
public class CameraEffectControlScript : MonoBehaviour
{
public DrunkCamera drunkCamera;
public GlitchEffect glitchEffect;
public NightVisionCamera nightVisionCamera;
public void ToggleDrunkEffectState()
{
drunkCamera.enabled = !drunkCamera.enabled;
}
public void ToggleGlitchEffectState()
{
glitchEffect.enabled = !glitchEffect.enabled;
}
public void ToggleNightVisionEffectState()
{
nightVisionCamera.enabled = !nightVisionCamera.enabled;
}
}
}
|
agpl-3.0
|
C#
|
78a38bd6deb3bb886dc91b27ee9b2adaaed3229f
|
fix culture
|
klinkby/klinkby.checksum
|
Properties/CommonAssemblyInfo.cs
|
Properties/CommonAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Mads Klinkby")]
[assembly: AssemblyProduct("Klinkby")]
[assembly: AssemblyCopyright("Copyright © Mads Breusch Klinkby 2011-2015")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
|
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("Mads Klinkby")]
[assembly: AssemblyProduct("Klinkby")]
[assembly: AssemblyCopyright("Copyright © Mads Breusch Klinkby 2011-2014")]
[assembly: AssemblyCulture("en-US")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
|
mit
|
C#
|
b1d55dbd8769d68517bccf135f6757670e2fc76e
|
Update Program.cs
|
NMSLanX/Natasha
|
samples/Core20/Program.cs
|
samples/Core20/Program.cs
|
using Microsoft.CodeAnalysis;
using Natasha;
using Natasha.CSharp;
using System;
namespace Core20
{
class Program
{
static void Main(string[] args)
{
string text = @"namespace HelloWorld
{
public class Test
{
public Test(){
Name=""111"";
}
public string Name;
public int Age{get;set;}
}
}";
//根据脚本创建动态类
AssemblyCSharpBuilder oop = new AssemblyCSharpBuilder("test");
oop.Add(text);
Type type = oop.GetTypeFromShortName("Test");
Console.WriteLine(type.Name);
var action = NDelegate.RandomDomain().Action("");
var a = action.Method;
Console.WriteLine(action.Method.Module.Assembly);
Console.ReadKey();
}
}
}
|
using Natasha;
using Natasha.CSharp;
using System;
namespace Core20
{
class Program
{
static void Main(string[] args)
{
string text = @"namespace HelloWorld
{
public class Test
{
public Test(){
Name=""111"";
}
public string Name;
public int Age{get;set;}
}
}";
//根据脚本创建动态类
AssemblyCSharpBuilder oop = new AssemblyCSharpBuilder("test");
oop.Add(text);
Type type = oop.GetTypeFromShortName("Test");
Console.WriteLine(type.Name);
var action = NDelegate.RandomDomain().Action("");
var a = action.Method;
Console.WriteLine(action.Method.Module.Assembly);
Console.ReadKey();
}
}
}
|
mpl-2.0
|
C#
|
9bdd473c6cc470b6de9e27bb09b0c4accbd3bdde
|
Add test data for Dewey table to DbInitializer.
|
Programazing/Open-School-Library,Programazing/Open-School-Library
|
src/Open-School-Library/Data/DbInitializer.cs
|
src/Open-School-Library/Data/DbInitializer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Open_School_Library.Models.DatabaseModels;
namespace Open_School_Library.Data
{
public class DbInitializer
{
public static void Initialize(LibraryContext context)
{
context.Database.EnsureCreated();
//Look for Students
if(context.Genres.Any())
{
return; //DB has been seeded
}
var genres = new Genre[]
{
new Genre { Name="Horror" },
new Genre { Name="Romance" }
};
foreach (Genre s in genres)
{
context.Genres.Add(s);
}
context.SaveChanges();
var deweys = new Dewey[]
{
new Dewey { Name="Computer Science, Information & General Works", Number=000 },
new Dewey { Name="Philosophy & Psychology", Number=100 },
new Dewey { Name="Religion", Number=200 }
};
foreach (Dewey s in deweys)
{
context.Deweys.Add(s);
}
context.SaveChanges();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
using Open_School_Library.Models.DatabaseModels;
namespace Open_School_Library.Data
{
public class DbInitializer
{
public static void Initialize(LibraryContext context)
{
context.Database.EnsureCreated();
//Look for Students
if(context.Genres.Any())
{
return; //DB has been seeded
}
var genres = new Genre[]
{
new Genre { Name="Horror" },
new Genre { Name="Romance" }
};
foreach (Genre s in genres)
{
context.Genres.Add(s);
}
context.SaveChanges();
}
}
}
|
mit
|
C#
|
dd8ec6df0cbb10e24932a67610fc8e35f7f95681
|
Update version number
|
BrianLima/UWPHook
|
UWPHook/Properties/AssemblyInfo.cs
|
UWPHook/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UWPHook")]
[assembly: AssemblyDescription("Add your UWP games and apps to Steam!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Briano")]
[assembly: AssemblyProduct("UWPHook")]
[assembly: AssemblyCopyright("Copyright Brian Lima © 2020")]
[assembly: AssemblyTrademark("Briano")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.0.0")]
[assembly: AssemblyFileVersion("2.6.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UWPHook")]
[assembly: AssemblyDescription("Add your UWP games and apps to Steam!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Briano")]
[assembly: AssemblyProduct("UWPHook")]
[assembly: AssemblyCopyright("Copyright Brian Lima © 2016")]
[assembly: AssemblyTrademark("Briano")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]
|
mit
|
C#
|
dbb4ebacef027f27a8c96271249d08ce5ed32e5e
|
Update version number.
|
Damnae/storybrew
|
editor/Properties/AssemblyInfo.cs
|
editor/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.23.*")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.22.*")]
|
mit
|
C#
|
191f2c2884893961c126b03f40975cfd74a97440
|
Update version number.
|
Damnae/storybrew
|
editor/Properties/AssemblyInfo.cs
|
editor/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.87.*")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.86.*")]
|
mit
|
C#
|
7cec913127e149d8fa915b0ee1eadfa2aba510e7
|
Replace tab indentation with spaces.
|
WebApiContrib/WebApiContrib.IoC.StructureMap,bingnz/WebApiContrib.IoC.StructureMap,jcalder/WebApiContrib.IoC.StructureMap
|
src/WebApiContrib.IoC.StructureMap/StructureMapResolver.cs
|
src/WebApiContrib.IoC.StructureMap/StructureMapResolver.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http.Controllers;
using System.Web.Http.Dependencies;
using System.Web.Http.Dispatcher;
using StructureMap;
using System.Net.Http;
namespace WebApiContrib.IoC.StructureMap
{
public class StructureMapDependencyScope : IDependencyScope
{
private IContainer container;
public StructureMapDependencyScope(IContainer container)
{
if (container == null)
throw new ArgumentNullException("container");
this.container = container;
}
public object GetService(Type serviceType)
{
if (container == null)
throw new ObjectDisposedException("this", "This scope has already been disposed.");
return container.TryGetInstance(serviceType);
}
public IEnumerable<object> GetServices(Type serviceType)
{
if (container == null)
throw new ObjectDisposedException("this", "This scope has already been disposed.");
return container.GetAllInstances(serviceType).Cast<object>();
}
public void Dispose()
{
container.Dispose();
container = null;
}
}
public class StructureMapResolver : StructureMapDependencyScope, IDependencyResolver, IHttpControllerActivator
{
private readonly IContainer container;
public StructureMapResolver(IContainer container)
: base(container)
{
if (container == null)
throw new ArgumentNullException("container");
this.container = container;
this.container.Inject(typeof(IHttpControllerActivator), this);
}
public IDependencyScope BeginScope()
{
return new StructureMapDependencyScope(container.GetNestedContainer());
}
public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
{
return (IHttpController) container.GetInstance(controllerType);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http.Controllers;
using System.Web.Http.Dependencies;
using System.Web.Http.Dispatcher;
using StructureMap;
using System.Net.Http;
namespace WebApiContrib.IoC.StructureMap
{
public class StructureMapDependencyScope : IDependencyScope
{
private IContainer container;
public StructureMapDependencyScope(IContainer container)
{
if (container == null)
throw new ArgumentNullException("container");
this.container = container;
}
public object GetService(Type serviceType)
{
if (container == null)
throw new ObjectDisposedException("this", "This scope has already been disposed.");
return container.TryGetInstance(serviceType);
}
public IEnumerable<object> GetServices(Type serviceType)
{
if (container == null)
throw new ObjectDisposedException("this", "This scope has already been disposed.");
return container.GetAllInstances(serviceType).Cast<object>();
}
public void Dispose()
{
container.Dispose();
container = null;
}
}
public class StructureMapResolver : StructureMapDependencyScope, IDependencyResolver, IHttpControllerActivator
{
private readonly IContainer container;
public StructureMapResolver(IContainer container)
: base(container)
{
if (container == null)
throw new ArgumentNullException("container");
this.container = container;
this.container.Inject(typeof(IHttpControllerActivator), this);
}
public IDependencyScope BeginScope()
{
return new StructureMapDependencyScope(container.GetNestedContainer());
}
public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
{
return (IHttpController) container.GetInstance(controllerType);
}
}
}
|
mit
|
C#
|
b91f5864f59e9e14f0c2a2c729853ae3573ffa64
|
Fix command prefix
|
Chris-Johnston/CSSBot
|
CSSBot/GlobalConfiguration.cs
|
CSSBot/GlobalConfiguration.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace CSSBot
{
/// <summary>
/// This class should be used for containing Configuration classes
/// or classes that depend on the configuration and that should
/// be re-used
/// Also used for storing constants (CommandPrefix)
/// </summary>
public class GlobalConfiguration
{
// we shouldn't need to be changing this often, if at all
public const char CommandPrefix = '?';
// the path to the configuration file
private string m_ConfigFilePath = null;
// our configuration data, loaded from xml file
private Configuration m_Data;
public Configuration Data
{
get { return m_Data; }
}
/// <summary>
/// Constructor for GlobalConfiguration class
/// </summary>
/// <param name="path"></param>
public GlobalConfiguration(string path)
{
// set the path
SetConfigurationFilePath(path);
// load from it
LoadConfiguration();
}
/// <summary>
/// Sets the Configuration File Path
/// </summary>
/// <param name="path"></param>
private void SetConfigurationFilePath(string path)
{
if(string.IsNullOrWhiteSpace(path))
{
throw new ArgumentException("The path supplied was null or whitespace!");
}
m_ConfigFilePath = path;
}
/// <summary>
/// Unused constructor
/// </summary>
private GlobalConfiguration() { }
/// <summary>
/// Loads (or Reloads) the Configuration file
/// </summary>
/// <param name="path"></param>
public void LoadConfiguration()
{
if (string.IsNullOrWhiteSpace(m_ConfigFilePath))
{
throw new Exception("The configuration file path has not been set!");
}
XmlSerializer ser = new XmlSerializer(typeof(Configuration));
using (FileStream fs = new FileStream(m_ConfigFilePath, FileMode.Open))
{
m_Data = (Configuration)ser.Deserialize(fs);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace CSSBot
{
/// <summary>
/// This class should be used for containing Configuration classes
/// or classes that depend on the configuration and that should
/// be re-used
/// Also used for storing constants (CommandPrefix)
/// </summary>
public class GlobalConfiguration
{
// we shouldn't need to be changing this often, if at all
public const char CommandPrefix = '.';
// the path to the configuration file
private string m_ConfigFilePath = null;
// our configuration data, loaded from xml file
private Configuration m_Data;
public Configuration Data
{
get { return m_Data; }
}
/// <summary>
/// Constructor for GlobalConfiguration class
/// </summary>
/// <param name="path"></param>
public GlobalConfiguration(string path)
{
// set the path
SetConfigurationFilePath(path);
// load from it
LoadConfiguration();
}
/// <summary>
/// Sets the Configuration File Path
/// </summary>
/// <param name="path"></param>
private void SetConfigurationFilePath(string path)
{
if(string.IsNullOrWhiteSpace(path))
{
throw new ArgumentException("The path supplied was null or whitespace!");
}
m_ConfigFilePath = path;
}
/// <summary>
/// Unused constructor
/// </summary>
private GlobalConfiguration() { }
/// <summary>
/// Loads (or Reloads) the Configuration file
/// </summary>
/// <param name="path"></param>
public void LoadConfiguration()
{
if (string.IsNullOrWhiteSpace(m_ConfigFilePath))
{
throw new Exception("The configuration file path has not been set!");
}
XmlSerializer ser = new XmlSerializer(typeof(Configuration));
using (FileStream fs = new FileStream(m_ConfigFilePath, FileMode.Open))
{
m_Data = (Configuration)ser.Deserialize(fs);
}
}
}
}
|
mit
|
C#
|
41a3df8e7ee6c711b894df0f49d7d8a815209208
|
Refactor `StopwatchAsserter` of Atata.IntegrationTests project
|
atata-framework/atata,atata-framework/atata
|
test/Atata.IntegrationTests/StopwatchAsserter.cs
|
test/Atata.IntegrationTests/StopwatchAsserter.cs
|
using System.Diagnostics;
namespace Atata.IntegrationTests;
public sealed class StopwatchAsserter : IDisposable
{
private readonly TimeSpan _expectedTime;
private readonly TimeSpan _upperToleranceTime;
private readonly Stopwatch _watch;
public StopwatchAsserter(TimeSpan expectedTime, TimeSpan upperToleranceTime)
{
_expectedTime = expectedTime;
_upperToleranceTime = upperToleranceTime;
_watch = Stopwatch.StartNew();
}
public static StopwatchAsserter WithinSeconds(double seconds, double upperToleranceSeconds = 1.5) =>
new(TimeSpan.FromSeconds(seconds), TimeSpan.FromSeconds(upperToleranceSeconds));
public void Dispose()
{
_watch.Stop();
Assert.That(_watch.Elapsed, Is.InRange(_expectedTime, _expectedTime + _upperToleranceTime));
}
}
|
using System;
using System.Diagnostics;
using NUnit.Framework;
namespace Atata.IntegrationTests
{
public sealed class StopwatchAsserter : IDisposable
{
private readonly TimeSpan _expectedTime;
private readonly TimeSpan _upperToleranceTime;
private readonly Stopwatch _watch;
public StopwatchAsserter(TimeSpan expectedTime, TimeSpan upperToleranceTime)
{
_expectedTime = expectedTime;
_upperToleranceTime = upperToleranceTime;
_watch = Stopwatch.StartNew();
}
public static StopwatchAsserter WithinSeconds(double seconds, double upperToleranceSeconds = 1.5)
{
return new StopwatchAsserter(TimeSpan.FromSeconds(seconds), TimeSpan.FromSeconds(upperToleranceSeconds));
}
public void Dispose()
{
_watch.Stop();
Assert.That(_watch.Elapsed, Is.InRange(_expectedTime, _expectedTime + _upperToleranceTime));
}
}
}
|
apache-2.0
|
C#
|
e11d3b0ca108b171a2a71d19afefc8eeb6f9a7ed
|
Save ip after recording, check ip on index, version 1.0
|
erooijak/athousandcounts,erooijak/athousandcounts,erooijak/athousandcounts
|
AThousandCounts/Views/Count/_Count.cshtml
|
AThousandCounts/Views/Count/_Count.cshtml
|
<div class="span7">
<div id="button" class="tile quadro triple-vertical bg-lightPink bg-active-lightBlue" style="padding:10px; text-align: center;">
Your number is... <br /><br />
<span class="COUNT">@(Model)!!!</span><br /><br />
Click this pink square to record a three second video of you saying
<strong>@Model</strong> in your language of choice.<br /><br />
If you don't like your number please hit refresh.<br /><br />
Make yourself comfortable and get ready to join A Thousand Counts.<br /><br />
3, 2, 1, COUNT!
</div>
</div>
|
<div class="span7">
<div id="button" class="tile quadro triple-vertical bg-lightPink bg-active-lightBlue" style="padding:10px; text-align: center;">
Your number is... <br /><br />
<span class="COUNT">@(Model)!!!</span><br /><br />
Click this pink square to record a three second video of you saying
<strong>@Model</strong> in your language of choice.<br /><br />
Make yourself comfortable and get ready to join A Thousand Counts.<br /><br />
3, 2, 1, COUNT!
</div>
</div>
|
mit
|
C#
|
e694bc895c79d5e3da8e0e6c1cde8e0614306177
|
Fix invalid logics
|
insthync/unity-utilities
|
Assets/UnityUtilities/Scripts/Misc/PhysicsIgnoreByLayers.cs
|
Assets/UnityUtilities/Scripts/Misc/PhysicsIgnoreByLayers.cs
|
using UnityEngine;
public class PhysicsIgnoreByLayers : MonoBehaviour
{
[System.Serializable]
public struct LayerPair
{
public string layer1;
public string layer2;
}
public LayerPair[] layerPairs;
void Awake()
{
for (int i = 0; i < layerPairs.Length; ++i)
{
LayerPair layerPair = layerPairs[i];
Physics.IgnoreLayerCollision(LayerMask.NameToLayer(layerPair.layer1), LayerMask.NameToLayer(layerPair.layer2), true);
}
}
}
|
using UnityEngine;
public class PhysicsIgnoreByLayers : MonoBehaviour
{
[System.Serializable]
public struct LayerPair
{
public string layer1;
public string layer2;
}
public LayerPair[] layerPairs;
void Awake()
{
for (int i = 0; i < layerPairs.Length; ++i)
{
LayerPair layerPair = layerPairs[i];
Physics.IgnoreLayerCollision(LayerMask.GetMask(layerPair.layer1), LayerMask.GetMask(layerPair.layer2), true);
}
}
}
|
mit
|
C#
|
e02e795c5ab114e88af075376330a841e4ff3b04
|
Add EntityProcessingSystem utility constructor
|
isurakka/ecs
|
ECS/EntityProcessingSystem.cs
|
ECS/EntityProcessingSystem.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ECS
{
public abstract class EntityProcessingSystem : EntitySystem
{
public EntityProcessingSystem(Aspect aspect)
: base(aspect)
{
}
public EntityProcessingSystem(params Type[] types)
: this(Aspect.All(types))
{
}
protected sealed override void ProcessEntities(IEnumerable<Entity> entities, float deltaTime)
{
foreach (var item in entities)
{
Process(item, deltaTime);
}
}
protected abstract void Process(Entity entity, float deltaTime);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ECS
{
public abstract class EntityProcessingSystem : EntitySystem
{
public EntityProcessingSystem(Aspect aspect)
: base(aspect)
{
}
protected sealed override void ProcessEntities(IEnumerable<Entity> entities, float deltaTime)
{
foreach (var item in entities)
{
Process(item, deltaTime);
}
}
protected abstract void Process(Entity entity, float deltaTime);
}
}
|
apache-2.0
|
C#
|
c22263418e47811a58a2e6acb4943ab9d5e8da62
|
Disable test that requires console to run
|
reubeno/NClap
|
NClap.Tests/ConsoleInput/BasicConsoleInputAndOutputTests.cs
|
NClap.Tests/ConsoleInput/BasicConsoleInputAndOutputTests.cs
|
using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NClap.ConsoleInput;
using NClap.Utilities;
namespace NClap.Tests.ConsoleInput
{
[TestClass]
public class BasicConsoleInputAndOutputTests
{
[TestMethod]
public void DefaultObjectIsSingleton()
{
BasicConsoleInputAndOutput.Default.Should().NotBeNull();
BasicConsoleInputAndOutput.Default.Should().BeSameAs(BasicConsoleInputAndOutput.Default);
}
[TestMethod]
[Ignore] // TODO: Disabled because it relies on having a console handy.
public void BasicProperties()
{
var con = BasicConsoleInputAndOutput.Default;
con.CursorSize.Should().BeGreaterOrEqualTo(0).And.BeLessOrEqualTo(100);
con.CursorLeft.Should().BeGreaterOrEqualTo(0);
con.CursorTop.Should().BeGreaterOrEqualTo(0);
con.BufferWidth.Should().BeGreaterOrEqualTo(0);
con.BufferHeight.Should().BeGreaterOrEqualTo(0);
con.Invoking(c => { var x = c.CursorVisible; }).ShouldNotThrow();
con.Invoking(c => { var x = c.TreatControlCAsInput; }).ShouldNotThrow();
con.Invoking(c => { var x = c.ForegroundColor; }).ShouldNotThrow();
con.Invoking(c => { var x = c.BackgroundColor; }).ShouldNotThrow();
}
[TestMethod]
public void Writing()
{
var con = BasicConsoleInputAndOutput.Default;
con.Write(new ColoredString("Sample string. ", ConsoleColor.White, ConsoleColor.Black));
con.Write("Sample string. ");
con.WriteLine("Sample string");
}
}
}
|
using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NClap.ConsoleInput;
using NClap.Utilities;
namespace NClap.Tests.ConsoleInput
{
[TestClass]
public class BasicConsoleInputAndOutputTests
{
[TestMethod]
public void DefaultObjectIsSingleton()
{
BasicConsoleInputAndOutput.Default.Should().NotBeNull();
BasicConsoleInputAndOutput.Default.Should().BeSameAs(BasicConsoleInputAndOutput.Default);
}
[TestMethod]
public void BasicProperties()
{
var con = BasicConsoleInputAndOutput.Default;
con.CursorSize.Should().BeGreaterOrEqualTo(0).And.BeLessOrEqualTo(100);
con.CursorLeft.Should().BeGreaterOrEqualTo(0);
con.CursorTop.Should().BeGreaterOrEqualTo(0);
con.BufferWidth.Should().BeGreaterOrEqualTo(0);
con.BufferHeight.Should().BeGreaterOrEqualTo(0);
con.Invoking(c => { var x = c.CursorVisible; }).ShouldNotThrow();
con.Invoking(c => { var x = c.TreatControlCAsInput; }).ShouldNotThrow();
con.Invoking(c => { var x = c.ForegroundColor; }).ShouldNotThrow();
con.Invoking(c => { var x = c.BackgroundColor; }).ShouldNotThrow();
}
[TestMethod]
public void Writing()
{
var con = BasicConsoleInputAndOutput.Default;
con.Write(new ColoredString("Sample string. ", ConsoleColor.White, ConsoleColor.Black));
con.Write("Sample string. ");
con.WriteLine("Sample string");
}
}
}
|
mit
|
C#
|
b9952588eff6d1af934226a1c8844421ec0e4d45
|
Fix tests for CI
|
mdileep/NFugue
|
tests/NFugue.Tests/Staccato/UnknownTokenTests.cs
|
tests/NFugue.Tests/Staccato/UnknownTokenTests.cs
|
using FluentAssertions;
using NFugue.Parsing;
using NFugue.Staccato;
using System;
using Xunit;
namespace Staccato.Tests
{
public class UnknownTokenTests : IDisposable
{
private readonly StaccatoParser parser = new StaccatoParser();
[Fact]
public void Should_ignore_unknown_token_by_default()
{
parser.Parse("UNKNOWN");
}
[Fact]
public void Should_throw_exception_if_flag_set()
{
parser.ThrowsExceptionOnUnknownToken = true;
Action action = () => parser.Parse("UNKNOWN");
action.ShouldThrow<ParserException>();
}
}
}
|
using FluentAssertions;
using NFugue.Parsing;
using NFugue.Playing;
using System;
using Xunit;
namespace Staccato.Tests
{
public class UnknownTokenTests : IDisposable
{
private readonly Player player = new Player();
[Fact]
public void Should_ignore_unknown_token_by_default()
{
player.Play("UKNOWN");
}
[Fact]
public void Should_throw_exception_if_flag_set()
{
player.Parser.ThrowsExceptionOnUnknownToken = true;
Action action = () => player.Play("UNKNOWN");
action.ShouldThrow<ParserException>();
}
public void Dispose()
{
player.Dispose();
}
}
}
|
apache-2.0
|
C#
|
ddd68d54622218d090aa85668954ad553306b200
|
add docs
|
justcoding121/Windows-User-Action-Hook,titanium007/EventHook,titanium007/Windows-User-Action-Hook
|
EventHook/EventHookFactory.cs
|
EventHook/EventHookFactory.cs
|
using System;
using EventHook.Helpers;
namespace EventHook
{
/// <summary>
/// A factory class core to the management of various watchers
/// that all shares the same synchronization objects.
/// Use this class to get instances of differant watchers.
/// This factory instance should be disposed only after all watchers it have been unsubscribed.
/// </summary>
public class EventHookFactory : IDisposable
{
private readonly SyncFactory syncFactory = new SyncFactory();
public void Dispose()
{
syncFactory.Dispose();
}
/// <summary>
/// Get an instance of application watcher.
/// </summary>
/// <returns></returns>
public ApplicationWatcher GetApplicationWatcher()
{
return new ApplicationWatcher(syncFactory);
}
/// <summary>
/// Get an instance of keystroke watcher.
/// </summary>
/// <returns></returns>
public KeyboardWatcher GetKeyboardWatcher()
{
return new KeyboardWatcher(syncFactory);
}
/// <summary>
/// Get an instance of mouse watcher.
/// </summary>
/// <returns></returns>
public MouseWatcher GetMouseWatcher()
{
return new MouseWatcher(syncFactory);
}
/// <summary>
/// Get an instance of clipboard watcher.
/// </summary>
/// <returns></returns>
public ClipboardWatcher GetClipboardWatcher()
{
return new ClipboardWatcher(syncFactory);
}
/// <summary>
/// Get an instance of print watcher.
/// </summary>
/// <returns></returns>
public PrintWatcher GetPrintWatcher()
{
return new PrintWatcher(syncFactory);
}
}
}
|
using System;
using EventHook.Helpers;
namespace EventHook
{
public class EventHookFactory : IDisposable
{
private readonly SyncFactory syncFactory = new SyncFactory();
public void Dispose()
{
syncFactory.Dispose();
}
public ApplicationWatcher GetApplicationWatcher()
{
return new ApplicationWatcher(syncFactory);
}
public KeyboardWatcher GetKeyboardWatcher()
{
return new KeyboardWatcher(syncFactory);
}
public MouseWatcher GetMouseWatcher()
{
return new MouseWatcher(syncFactory);
}
public ClipboardWatcher GetClipboardWatcher()
{
return new ClipboardWatcher(syncFactory);
}
public PrintWatcher GetPrintWatcher()
{
return new PrintWatcher(syncFactory);
}
}
}
|
mit
|
C#
|
f44843b6fc2e2c62f70da2dc49d64c7bb98e0e6d
|
Update MainPageViewModel.cs
|
softlion/XamarinFormsGesture
|
Demo/DemoApp/DemoApp/MainPageViewModel.cs
|
Demo/DemoApp/DemoApp/MainPageViewModel.cs
|
using System;
using System.Windows.Input;
using Vapolia.Lib.Ui;
using Xamarin.Forms;
namespace DemoApp
{
public class MainPageViewModel : BindableObject
{
private readonly INavigation navigation;
private Point pan, pinch;
private double rotation, scale;
public Point Pan { get => pan; set { pan = value; OnPropertyChanged(); } }
public Point Pinch { get => pinch; set { pinch = value; OnPropertyChanged(); } }
public double Rotation { get => rotation; set { rotation = value; OnPropertyChanged(); } }
public double Scale { get => scale; set { scale = value; OnPropertyChanged(); } }
public MainPageViewModel(INavigation navigation)
{
this.navigation = navigation;
}
public ICommand PanPointCommand => new Command<PanEventArgs>(args =>
{
var point = args.Point;
Pan = point;
});
public ICommand PinchCommand => new Command<PinchEventArgs>(args =>
{
Pinch = args.Center;
Rotation = args.RotationDegrees;
Scale = args.Scale;
});
public ICommand OpenVapoliaCommand => new Command(async () =>
{
await navigation.PushAsync(new ContentPage {
Title = "Web",
Content = new Grid {
BackgroundColor = Color.Yellow,
Children = { new WebView { Source = new UrlWebViewSource { Url = "https://vapolia.fr" }, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill} }}});
});
public ICommand OpenVapoliaPointCommand => new Command<Point>(point =>
{
Pan = point;
OpenVapoliaCommand.Execute(null);
});
}
}
|
using System;
using System.Windows.Input;
using Vapolia.Lib.Ui;
using Xamarin.Forms;
namespace DemoApp
{
public class MainPageViewModel : BindableObject
{
private readonly INavigation navigation;
private Point pan, pinch;
private double rotation, scale;
public Point Pan { get => pan; set { pan = value; OnPropertyChanged(); } }
public Point Pinch { get => pinch; set { pinch = value; OnPropertyChanged(); } }
public double Rotation { get => rotation; set { rotation = value; OnPropertyChanged(); } }
public double Scale { get => scale; set { scale = value; OnPropertyChanged(); } }
public MainPageViewModel(INavigation navigation)
{
this.navigation = navigation;
}
public ICommand PanPointCommand => new Command<(Point Point,GestureStatus Status)>(args =>
{
var point = args.Point;
Pan = point;
});
public ICommand PinchCommand => new Command<PinchEventArgs>(args =>
{
Pinch = args.Center;
Rotation = args.RotationDegrees;
Scale = args.Scale;
});
public ICommand OpenVapoliaCommand => new Command(async () =>
{
await navigation.PushAsync(new ContentPage {
Title = "Web",
Content = new Grid {
BackgroundColor = Color.Yellow,
Children = { new WebView { Source = new UrlWebViewSource { Url = "https://vapolia.fr" }, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill} }}});
});
public ICommand OpenVapoliaPointCommand => new Command<Point>(point =>
{
Pan = point;
OpenVapoliaCommand.Execute(null);
});
}
}
|
apache-2.0
|
C#
|
8ce16747d94bab06d3bb955ea2cbf244dab2c291
|
change root to standard
|
ramzzzay/GalleryMVC_With_Auth,ramzzzay/GalleryMVC_With_Auth,ramzzzay/GalleryMVC_With_Auth
|
GalleryMVC_With_Auth/Resources/Defines.cs
|
GalleryMVC_With_Auth/Resources/Defines.cs
|
namespace GalleryMVC_With_Auth.Resources
{
public static class Defines
{
public const string DbConnName = "DBcon";
public const string NPasswd = "Новый пароль";
public const string ConfNewPasswd = "Подтвердите новый пароль";
public const string CurPasswd = "Текущий(старый) пароль";
public const string Passwd = "Пароль";
public const string PhNumb = "Телефонный номер";
public const string Code = "Код";
public const string Email = "Электронная почта";
public const string RemBrws = "Запомнить этот браузер?";
public const string RemMe = "Запомнить меня?";
public const int PassMinLength = 6;
public const string ErrView = "Error";
public const string LockOutView = "Lockout";
public const string SendCodeView = "SendCode";
public const string RolesName = "Name";
public const string IndexView = "Index";
public const string HomeControllerName = "Home";
public const string AccountControllName = "Account";
public const string ResetPasswdConfView = "ResetPasswordConfirmation";
public const string ConfEmailView = "ConfirmEmail";
public const string ForgotPasswdConfView = "ForgotPasswordConfirmation";
public const string ExtLoginCallbackView = "ExternalLoginCallback";
public const string ExtLogiConfView = "ExternalLoginConfirmation";
public const string ManageControllerName = "Manage";
public const string LoginView = "Login";
public const string LoginPath = "/Account/Login";
public const string ExtLoginFailView = "ExternalLoginFailure";
public const string ManageLoginsView = "ManageLogins";
public const string VerifPhoneNumbView = "VerifyPhoneNumber";
public const string LinkLoginCallbackView = "LinkLoginCallback";
public const int Painting = 3;
public const int Watercolor = 5;
public const int Gouache = 6;
public const int Graphics = 1;
public const int Batik = 2;
public const int Pastel = 4;
}
}
|
namespace GalleryMVC_With_Auth.Resources
{
public static class Defines
{
public const string DbConnName = "DBcon";
public const string NPasswd = "Новый пароль";
public const string ConfNewPasswd = "Подтвердите новый пароль";
public const string CurPasswd = "Текущий(старый) пароль";
public const string Passwd = "Пароль";
public const string PhNumb = "Телефонный номер";
public const string Code = "Код";
public const string Email = "Электронная почта";
public const string RemBrws = "Запомнить этот браузер?";
public const string RemMe = "Запомнить меня?";
public const int PassMinLength = 6;
public const string ErrView = "Error";
public const string LockOutView = "Lockout";
public const string SendCodeView = "SendCode";
public const string RolesName = "Name";
public const string IndexView = "Tests";
public const string HomeControllerName = "Home";
public const string AccountControllName = "Account";
public const string ResetPasswdConfView = "ResetPasswordConfirmation";
public const string ConfEmailView = "ConfirmEmail";
public const string ForgotPasswdConfView = "ForgotPasswordConfirmation";
public const string ExtLoginCallbackView = "ExternalLoginCallback";
public const string ExtLogiConfView = "ExternalLoginConfirmation";
public const string ManageControllerName = "Manage";
public const string LoginView = "Login";
public const string LoginPath = "/Account/Login";
public const string ExtLoginFailView = "ExternalLoginFailure";
public const string ManageLoginsView = "ManageLogins";
public const string VerifPhoneNumbView = "VerifyPhoneNumber";
public const string LinkLoginCallbackView = "LinkLoginCallback";
public const int Painting = 3;
public const int Watercolor = 5;
public const int Gouache = 6;
public const int Graphics = 1;
public const int Batik = 2;
public const int Pastel = 4;
}
}
|
apache-2.0
|
C#
|
8717177630c21de81b6bc253682b22c33f989844
|
check for internet connection
|
PoLaKoSz/CodeHub,aalok05/CodeHub
|
CodeHub/ViewModels/CommitsViewmodel.cs
|
CodeHub/ViewModels/CommitsViewmodel.cs
|
using CodeHub.Helpers;
using CodeHub.Services;
using GalaSoft.MvvmLight.Ioc;
using Octokit;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
namespace CodeHub.ViewModels
{
public class CommitsViewmodel : AppViewmodel
{
public ObservableCollection<GitHubCommit> _Commits;
public ObservableCollection<GitHubCommit> Commits
{
get
{
return _Commits;
}
set
{
Set(() => Commits, ref _Commits, value);
}
}
public async Task Load(object param)
{
if (GlobalHelper.IsInternet())
{
isLoading = true;
Commits = new ObservableCollection<GitHubCommit>();
if (param as Tuple<long, IReadOnlyList<Commit>> != null)
{
var tuple = param as Tuple<long, IReadOnlyList<Commit>>;
foreach (var commit in tuple.Item2)
{
var githubCommit = await CommitService.GetCommit(tuple.Item1, commit.Sha);
Commits.Add(githubCommit);
}
}
isLoading = false;
}
}
public void CommitList_ItemClick(object sender, ItemClickEventArgs e)
{
SimpleIoc.Default.GetInstance<IAsyncNavigationService>().NavigateAsync(typeof(CommitDetailView), e.ClickedItem as GitHubCommit);
}
}
}
|
using CodeHub.Services;
using GalaSoft.MvvmLight.Ioc;
using Octokit;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
namespace CodeHub.ViewModels
{
public class CommitsViewmodel : AppViewmodel
{
public ObservableCollection<GitHubCommit> _Commits;
public ObservableCollection<GitHubCommit> Commits
{
get
{
return _Commits;
}
set
{
Set(() => Commits, ref _Commits, value);
}
}
public async Task Load(object param)
{
isLoading = true;
Commits = new ObservableCollection<GitHubCommit>();
if (param as Tuple<long, IReadOnlyList<Commit>> != null)
{
var tuple = param as Tuple<long, IReadOnlyList<Commit>>;
foreach (var commit in tuple.Item2)
{
var githubCommit = await CommitService.GetCommit(tuple.Item1, commit.Sha);
Commits.Add(githubCommit);
}
}
isLoading = false;
}
public void CommitList_ItemClick(object sender, ItemClickEventArgs e)
{
SimpleIoc.Default.GetInstance<IAsyncNavigationService>().NavigateAsync(typeof(CommitDetailView), e.ClickedItem as GitHubCommit);
}
}
}
|
mit
|
C#
|
649cc2168210027b07c63f76da3116fa387221ed
|
change version to 0.5
|
dimaaan/NOpt
|
NOpt/Properties/AssemblyInfo.cs
|
NOpt/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("NOpt")]
[assembly: AssemblyDescription("Command line arguments parser")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NOpt")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("NOpt")]
[assembly: AssemblyDescription("Command line arguments parser")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NOpt")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
mit
|
C#
|
ac3fc1f55e0e1c91577124b6e199742bc0744255
|
Update MailtrapSender.cs
|
anthonyvscode/FluentEmail,anthonyvscode/FluentEmail,lukencode/FluentEmail,lukencode/FluentEmail
|
FluentEmail.Mailtrap/MailtrapSender.cs
|
FluentEmail.Mailtrap/MailtrapSender.cs
|
using System.Net;
using System.Net.Mail;
using System.Threading;
using System.Threading.Tasks;
using FluentEmail.Core;
using FluentEmail.Core.Interfaces;
using FluentEmail.Core.Models;
using FluentEmail.Smtp;
namespace FluentEmail.Mailtrap
{
public class MailtrapSender : ISender
{
private readonly SmtpClient _smtpClient;
public MailtrapSender(string host, int port, string userName, string password)
{
_smtpClient = new SmtpClient(host, port)
{
Credentials = new NetworkCredential(userName, password),
EnableSsl = true
};
}
public SendResponse Send(IFluentEmail email, CancellationToken? token = null)
{
var smtpSender = new SmtpSender(_smtpClient);
return smtpSender.Send(email, token);
}
public async Task<SendResponse> SendAsync(IFluentEmail email, CancellationToken? token = null)
{
var smtpSender = new SmtpSender(_smtpClient);
return await smtpSender.SendAsync(email, token);
}
}
}
|
using System;
using System.Net;
using System.Net.Http;
using System.Net.Mail;
using System.Threading;
using System.Threading.Tasks;
using FluentEmail.Core;
using FluentEmail.Core.Interfaces;
using FluentEmail.Core.Models;
using FluentEmail.Smtp;
namespace FluentEmail.Mailtrap
{
public class MailtrapSender : ISender
{
private readonly SmtpClient _smtpClient;
public MailtrapSender(string host, int port, string userName, string password)
{
_smtpClient = new SmtpClient(host, port)
{
Credentials = new NetworkCredential(userName, password),
EnableSsl = true
};
}
public SendResponse Send(IFluentEmail email, CancellationToken? token = null)
{
var smtpSender = new SmtpSender(_smtpClient);
return smtpSender.Send(email, token);
}
public async Task<SendResponse> SendAsync(IFluentEmail email, CancellationToken? token = null)
{
var smtpSender = new SmtpSender(_smtpClient);
return await smtpSender.SendAsync(email, token);
}
}
}
|
mit
|
C#
|
e7ef719a30ae2bfaedf0897209b5958a2e8c7b53
|
Update for cli build
|
WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework
|
Framework.Cli/Command/CommandDeploy.cs
|
Framework.Cli/Command/CommandDeploy.cs
|
namespace Framework.Cli.Command
{
using Framework.Cli.Config;
using System;
using System.IO;
public class CommandDeploy : CommandBase
{
public CommandDeploy(AppCli appCli)
: base(appCli, "deploy", "Deploy app to Azure git")
{
}
protected internal override void Execute()
{
ConfigCli configCli = ConfigCli.Load();
string azureGitUrl = configCli.AzureGitUrl; // For example: "https://MyUsername:MyPassword@my22.scm.azurewebsites.net:443/my22.git"
string folderName = UtilFramework.FolderName + "Application.Server/";
string folderNamePublish = UtilFramework.FolderName + "Application.Server/bin/Debug/netcoreapp2.1/publish/";
UtilCli.Start(folderNamePublish, "git", "init");
UtilCli.Start(folderNamePublish, "git", "config user.email \"deploy@deploy.deploy\""); // Prevent: Error "Please tell me who you are". See also: http://www.thecreativedev.com/solution-github-please-tell-me-who-you-are-error/
UtilCli.Start(folderNamePublish, "git", "config user.name \"Deploy\"");
UtilCli.Start(folderNamePublish, "git", "remote add azure " + azureGitUrl);
UtilCli.Start(folderNamePublish, "git", "fetch --all", isRedirectStdErr: true); // Another possibility is argument "-q" to do not write to stderr.
UtilCli.Start(folderNamePublish, "git", "config core.autocrlf false"); // Prevent "LF will be replaced by CRLF" error in stderr.
UtilCli.Start(folderNamePublish, "git", "add ."); // Can throw "LF will be replaced by CRLF".
UtilCli.Start(folderNamePublish, "git", "commit -m Deploy");
UtilCli.Start(folderNamePublish, "git", "push azure master -f", isRedirectStdErr: true); // Do not write to stderr. Can be tested with "dotnet run -- deploy [AzureGitUrl] 2>Error.txt"
}
}
}
|
namespace Framework.Cli.Command
{
using Framework.Cli.Config;
using System;
using System.IO;
public class CommandDeploy : CommandBase
{
public CommandDeploy(AppCli appCli)
: base(appCli, "deploy", "Deploy app to Azure git")
{
}
protected internal override void Execute()
{
ConfigCli configCli = ConfigCli.Load();
string azureGitUrl = configCli.AzureGitUrl; // For example: "https://MyUsername:MyPassword@my22.scm.azurewebsites.net:443/my22.git"
string folderName = UtilFramework.FolderName + "Application.Server/";
string folderNamePublish = UtilFramework.FolderName + "Application.Server/bin/Debug/netcoreapp2.0/publish/";
UtilCli.Start(folderNamePublish, "git", "init");
UtilCli.Start(folderNamePublish, "git", "config user.email \"deploy@deploy.deploy\""); // Prevent: Error "Please tell me who you are". See also: http://www.thecreativedev.com/solution-github-please-tell-me-who-you-are-error/
UtilCli.Start(folderNamePublish, "git", "config user.name \"Deploy\"");
UtilCli.Start(folderNamePublish, "git", "remote add azure " + azureGitUrl);
UtilCli.Start(folderNamePublish, "git", "fetch --all", isRedirectStdErr: true); // Another possibility is argument "-q" to do not write to stderr.
UtilCli.Start(folderNamePublish, "git", "config core.autocrlf false"); // Prevent "LF will be replaced by CRLF" error in stderr.
UtilCli.Start(folderNamePublish, "git", "add ."); // Can throw "LF will be replaced by CRLF".
UtilCli.Start(folderNamePublish, "git", "commit -m Deploy");
UtilCli.Start(folderNamePublish, "git", "push azure master -f", isRedirectStdErr: true); // Do not write to stderr. Can be tested with "dotnet run -- deploy [AzureGitUrl] 2>Error.txt"
}
}
}
|
mit
|
C#
|
a2b859f778bf76c1e36134adaf24b66d8012587a
|
Make RuntimeSchema throw instead of asserting
|
jdubrule/bond,sapek/bond,gencer/bond,gencer/bond,jdubrule/bond,tstein/bond,gencer/bond,Microsoft/bond,sapek/bond,jdubrule/bond,chwarr/bond,tstein/bond,tstein/bond,jdubrule/bond,Microsoft/bond,jdubrule/bond,sapek/bond,Microsoft/bond,Microsoft/bond,gencer/bond,sapek/bond,tstein/bond,chwarr/bond,sapek/bond,Microsoft/bond,chwarr/bond,sapek/bond,chwarr/bond,Microsoft/bond,jdubrule/bond,gencer/bond,chwarr/bond,tstein/bond,tstein/bond,chwarr/bond
|
cs/src/core/RuntimeSchema.cs
|
cs/src/core/RuntimeSchema.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Bond
{
using System;
using System.Diagnostics;
public struct RuntimeSchema
{
readonly SchemaDef schemaDef;
readonly TypeDef typeDef;
public static readonly RuntimeSchema Empty = new RuntimeSchema();
public SchemaDef SchemaDef { get { return schemaDef; } }
public TypeDef TypeDef { get { return typeDef; } }
public StructDef StructDef { get { return schemaDef.structs[typeDef.struct_def]; } }
public bool HasValue { get { return schemaDef != null && typeDef != null; } }
public bool IsStruct { get { return HasValue && typeDef.id == BondDataType.BT_STRUCT; } }
public bool IsBonded { get { return HasValue && typeDef.bonded_type; } }
public bool IsBlob { get { return HasValue && typeDef.id == BondDataType.BT_LIST && typeDef.element.id == BondDataType.BT_INT8; } }
public bool IsContainer { get { return HasValue && typeDef.element != null; } }
public bool IsMap { get { return HasValue && typeDef.key != null; } }
public bool HasBase { get { return IsStruct && StructDef.base_def != null; } }
public RuntimeSchema(SchemaDef schema)
: this(schema, schema.root)
{}
RuntimeSchema(SchemaDef schema, TypeDef type)
{
schemaDef = schema;
typeDef = type;
}
public RuntimeSchema GetBaseSchema()
{
if (!IsStruct)
{
throw new InvalidOperationException("cannot get a base of a non-struct " + nameof(RuntimeSchema));
}
return new RuntimeSchema(schemaDef, StructDef.base_def);
}
public RuntimeSchema GetElementSchema()
{
if (!HasValue)
{
throw new InvalidOperationException("cannot get an element of an empty " + nameof(RuntimeSchema));
}
return new RuntimeSchema(schemaDef, typeDef.element);
}
public RuntimeSchema GetKeySchema()
{
if (!HasValue)
{
throw new InvalidOperationException("cannot get a key of an empty " + nameof(RuntimeSchema));
}
return new RuntimeSchema(schemaDef, typeDef.key);
}
public RuntimeSchema GetFieldSchema(FieldDef field)
{
if (!HasValue)
{
throw new InvalidOperationException("cannot get a field of an empty " + nameof(RuntimeSchema));
}
return new RuntimeSchema(schemaDef, field.type);
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Bond
{
using System.Diagnostics;
public struct RuntimeSchema
{
readonly SchemaDef schemaDef;
readonly TypeDef typeDef;
public static readonly RuntimeSchema Empty = new RuntimeSchema();
public SchemaDef SchemaDef { get { return schemaDef; } }
public TypeDef TypeDef { get { return typeDef; } }
public StructDef StructDef { get { return schemaDef.structs[typeDef.struct_def]; } }
public bool HasValue { get { return schemaDef != null && typeDef != null; } }
public bool IsStruct { get { return HasValue && typeDef.id == BondDataType.BT_STRUCT; } }
public bool IsBonded { get { return HasValue && typeDef.bonded_type; } }
public bool IsBlob { get { return HasValue && typeDef.id == BondDataType.BT_LIST && typeDef.element.id == BondDataType.BT_INT8; } }
public bool IsContainer { get { return HasValue && typeDef.element != null; } }
public bool IsMap { get { return HasValue && typeDef.key != null; } }
public bool HasBase { get { return IsStruct && StructDef.base_def != null; } }
public RuntimeSchema(SchemaDef schema)
: this(schema, schema.root)
{}
RuntimeSchema(SchemaDef schema, TypeDef type)
{
schemaDef = schema;
typeDef = type;
}
public RuntimeSchema GetBaseSchema()
{
Debug.Assert(IsStruct);
return new RuntimeSchema(schemaDef, StructDef.base_def);
}
public RuntimeSchema GetElementSchema()
{
Debug.Assert(HasValue);
return new RuntimeSchema(schemaDef, typeDef.element);
}
public RuntimeSchema GetKeySchema()
{
Debug.Assert(HasValue);
return new RuntimeSchema(schemaDef, typeDef.key);
}
public RuntimeSchema GetFieldSchema(FieldDef field)
{
Debug.Assert(HasValue);
return new RuntimeSchema(schemaDef, field.type);
}
}
}
|
mit
|
C#
|
7f605b2ac8b48e451df090b649416b349e6a2623
|
comment for "Side"
|
bpfz/SharprWowApi
|
SharprWowApi/Models/Guild/GuildRoot.cs
|
SharprWowApi/Models/Guild/GuildRoot.cs
|
using System;
using System.Collections.Generic;
namespace SharprWowApi.Models.Guild
{
public class GuildRoot
{
public long LastModified { get; set; }
public string Name { get; set; }
public string Realm { get; set; }
public string Battlegroup { get; set; }
public int Level { get; set; }
/// <summary>
/// Gets or sets faction side (0, 1, 2)
/// </summary>
public int Side { get; set; }
public int AchievementPoints { get; set; }
public GuildAchievements Achievements { get; set; }
public IEnumerable<GuildMember> Members { get; set; }
public GuildEmblem Emblem { get; set; }
public IEnumerable<GuildNews> News { get; set; }
public IEnumerable<GuildChallenge> Challenge { get; set; }
public WoWFaction Faction
{
get
{
return (WoWFaction)Enum.Parse(typeof(WoWFaction), Enum.GetName(typeof(WoWFaction), this.Side));
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace SharprWowApi.Models.Guild
{
public class GuildRoot
{
public long LastModified { get; set; }
public string Name { get; set; }
public string Realm { get; set; }
public string Battlegroup { get; set; }
public int Level { get; set; }
public int Side { get; set; }
public int AchievementPoints { get; set; }
public GuildAchievements Achievements { get; set; }
public IEnumerable<GuildMember> Members { get; set; }
public GuildEmblem Emblem { get; set; }
public IEnumerable<GuildNews> News { get; set; }
public IEnumerable<GuildChallenge> Challenge { get; set; }
public WoWFaction Faction
{
get
{
return (WoWFaction)Enum.Parse(typeof(WoWFaction), Enum.GetName(typeof(WoWFaction), this.Side));
}
}
}
}
|
unlicense
|
C#
|
f7ec1dca8bb6487c4577ef8d534f677efffa23fb
|
Fix new object was added into collection instead of the one we made just above.
|
fanCDA/ProjectCDA-WPF
|
ProjectCDA/Data/DataSource.cs
|
ProjectCDA/Data/DataSource.cs
|
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace ProjectCDA.Data
{
public class DataSource : INotifyPropertyChanged
{
private ObservableCollection<TwoPages> _Schedule;
public DataSource()
{
AddSomeDummyData();
}
public ObservableCollection<TwoPages> Schedule
{
get
{
return _Schedule;
}
set
{
if (value != _Schedule)
{
_Schedule = value;
PropertyChanged(this, new PropertyChangedEventArgs("Schedule"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged = delegate { };
private void AddSomeDummyData()
{
ObservableCollection<TwoPages> TmpSchedule = new ObservableCollection<TwoPages>();
for(int i=0; i<20; i++)
{
TwoPages pages = new TwoPages();
pages.ID = i.ToString();
pages.RightPage = i % 5 != 3;
TmpSchedule.Add(pages);
}
Schedule = TmpSchedule;
}
}
}
|
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace ProjectCDA.Data
{
public class DataSource : INotifyPropertyChanged
{
private ObservableCollection<TwoPages> _Schedule;
public DataSource()
{
AddSomeDummyData();
}
public ObservableCollection<TwoPages> Schedule
{
get
{
return _Schedule;
}
set
{
if (value != _Schedule)
{
_Schedule = value;
PropertyChanged(this, new PropertyChangedEventArgs("Schedule"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged = delegate { };
private void AddSomeDummyData()
{
ObservableCollection<TwoPages> TmpSchedule = new ObservableCollection<TwoPages>();
for(int i=0; i<20; i++)
{
TwoPages pages = new TwoPages();
pages.ID = i.ToString();
pages.RightPage = i % 5 != 3;
TmpSchedule.Add(new TwoPages());
}
Schedule = TmpSchedule;
}
}
}
|
mit
|
C#
|
49f3049f88df5e3e4704679cdb2242ed873d236b
|
Reformat ILargeFiles
|
coryrwest/B2.NET
|
src/ILargeFiles.cs
|
src/ILargeFiles.cs
|
using B2Net.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace B2Net {
public interface ILargeFiles {
Task<B2CancelledFile> CancelLargeFile(string fileId, CancellationToken cancelToken = default(CancellationToken));
Task<B2File> FinishLargeFile(string fileId, string[] partSHA1Array, CancellationToken cancelToken = default(CancellationToken));
Task<B2UploadPartUrl> GetUploadPartUrl(string fileId, CancellationToken cancelToken = default(CancellationToken));
Task<B2IncompleteLargeFiles> ListIncompleteFiles(string bucketId, string startFileId = "", string maxFileCount = "", CancellationToken cancelToken = default(CancellationToken));
Task<B2LargeFileParts> ListPartsForIncompleteFile(string fileId, int startPartNumber, int maxPartCount, CancellationToken cancelToken = default(CancellationToken));
Task<B2File> StartLargeFile(string fileName, string contentType = "", string bucketId = "", Dictionary<string, string> fileInfo = null, CancellationToken cancelToken = default(CancellationToken));
Task<B2UploadPart> UploadPart(byte[] fileData, int partNumber, B2UploadPartUrl uploadPartUrl, CancellationToken cancelToken = default(CancellationToken));
}
}
|
using B2Net.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace B2Net
{
public interface ILargeFiles
{
Task<B2CancelledFile> CancelLargeFile(string fileId, CancellationToken cancelToken = default(CancellationToken));
Task<B2File> FinishLargeFile(string fileId, string[] partSHA1Array, CancellationToken cancelToken = default(CancellationToken));
Task<B2UploadPartUrl> GetUploadPartUrl(string fileId, CancellationToken cancelToken = default(CancellationToken));
Task<B2IncompleteLargeFiles> ListIncompleteFiles(string bucketId, string startFileId = "", string maxFileCount = "", CancellationToken cancelToken = default(CancellationToken));
Task<B2LargeFileParts> ListPartsForIncompleteFile(string fileId, int startPartNumber, int maxPartCount, CancellationToken cancelToken = default(CancellationToken));
Task<B2File> StartLargeFile(string fileName, string contentType = "", string bucketId = "", Dictionary<string, string> fileInfo = null, CancellationToken cancelToken = default(CancellationToken));
Task<B2UploadPart> UploadPart(byte[] fileData, int partNumber, B2UploadPartUrl uploadPartUrl, CancellationToken cancelToken = default(CancellationToken));
}
}
|
mit
|
C#
|
23fda18077f2fee242c7d056863eb8d96f007384
|
increase version to 1.0 because it's ready. no changes.
|
gregsdennis/ThingFilter
|
ThingFilter/Properties/AssemblyInfo.cs
|
ThingFilter/Properties/AssemblyInfo.cs
|
using System.Resources;
using System.Reflection;
// 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("Filter.Portable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Filter.Portable")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
|
using System.Resources;
using System.Reflection;
// 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("Filter.Portable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Filter.Portable")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0")]
[assembly: AssemblyFileVersion("0.2.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
|
mit
|
C#
|
f0623b30d4b4873959bac0d62c91fea7b369561e
|
Enable suggestions for types in reference assemblies by default
|
gafter/roslyn,davkean/roslyn,reaction1989/roslyn,sharwell/roslyn,tannergooding/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,sharwell/roslyn,heejaechang/roslyn,swaroop-sridhar/roslyn,physhi/roslyn,tannergooding/roslyn,heejaechang/roslyn,genlu/roslyn,agocke/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,heejaechang/roslyn,eriawan/roslyn,gafter/roslyn,mgoertz-msft/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,nguerrera/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,stephentoub/roslyn,davkean/roslyn,jmarolf/roslyn,dotnet/roslyn,weltkante/roslyn,abock/roslyn,eriawan/roslyn,brettfo/roslyn,diryboy/roslyn,bartdesmet/roslyn,mavasani/roslyn,abock/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,eriawan/roslyn,jmarolf/roslyn,abock/roslyn,stephentoub/roslyn,MichalStrehovsky/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,tmat/roslyn,wvdd007/roslyn,swaroop-sridhar/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,MichalStrehovsky/roslyn,nguerrera/roslyn,dotnet/roslyn,brettfo/roslyn,MichalStrehovsky/roslyn,ErikSchierboom/roslyn,physhi/roslyn,sharwell/roslyn,davkean/roslyn,mavasani/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,reaction1989/roslyn,mavasani/roslyn,genlu/roslyn,tannergooding/roslyn,physhi/roslyn,weltkante/roslyn,tmat/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,reaction1989/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,diryboy/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,aelij/roslyn,agocke/roslyn,aelij/roslyn,agocke/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,panopticoncentral/roslyn,genlu/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,AlekseyTs/roslyn
|
src/Workspaces/Core/Portable/SymbolSearch/SymbolSearchOptions.cs
|
src/Workspaces/Core/Portable/SymbolSearch/SymbolSearchOptions.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.SymbolSearch
{
internal static class SymbolSearchOptions
{
private const string LocalRegistryPath = @"Roslyn\Features\SymbolSearch\";
public static readonly Option<bool> Enabled = new Option<bool>(
nameof(SymbolSearchOptions), nameof(Enabled), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(Enabled)));
public static PerLanguageOption<bool> SuggestForTypesInReferenceAssemblies =
new PerLanguageOption<bool>(nameof(SymbolSearchOptions), nameof(SuggestForTypesInReferenceAssemblies), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.SuggestForTypesInReferenceAssemblies"));
public static PerLanguageOption<bool> SuggestForTypesInNuGetPackages =
new PerLanguageOption<bool>(nameof(SymbolSearchOptions), nameof(SuggestForTypesInNuGetPackages), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.SuggestForTypesInNuGetPackages"));
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.SymbolSearch
{
internal static class SymbolSearchOptions
{
private const string LocalRegistryPath = @"Roslyn\Features\SymbolSearch\";
public static readonly Option<bool> Enabled = new Option<bool>(
nameof(SymbolSearchOptions), nameof(Enabled), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(Enabled)));
public static PerLanguageOption<bool> SuggestForTypesInReferenceAssemblies =
new PerLanguageOption<bool>(nameof(SymbolSearchOptions), nameof(SuggestForTypesInReferenceAssemblies), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.SuggestForTypesInReferenceAssemblies"));
public static PerLanguageOption<bool> SuggestForTypesInNuGetPackages =
new PerLanguageOption<bool>(nameof(SymbolSearchOptions), nameof(SuggestForTypesInNuGetPackages), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.SuggestForTypesInNuGetPackages"));
}
}
|
mit
|
C#
|
e97734332e0fc2d94b7642498cc879c3d0fd8219
|
Bump version...again...because I'm not good with nuget
|
Deadpikle/NetSparkle,Deadpikle/NetSparkle
|
AssemblyInfo.cs
|
AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetSparkle")]
[assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetSparkle")]
[assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("279448fc-5103-475e-b209-68f3268df7b5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.11.2")]
[assembly: AssemblyFileVersion("0.11.2")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetSparkle")]
[assembly: AssemblyDescription("NetSparkle is an auto update framework for .NET developers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetSparkle")]
[assembly: AssemblyCopyright("Portions Copyright © Dirk Eisenberg 2010, Deadpikle 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("279448fc-5103-475e-b209-68f3268df7b5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.11.1")]
[assembly: AssemblyFileVersion("0.11.1")]
|
mit
|
C#
|
93e3b03833f07b97b3fb8bb271fea7d0bb6d2398
|
remove discus from drafts
|
boyarincev/boyarincev.net,boyarincev/boyarincev.net
|
Snow/themes/snowbyte/_layouts/post.cshtml
|
Snow/themes/snowbyte/_layouts/post.cshtml
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Snow.ViewModels.PostViewModel>
@using System.Collections.Generic
@using Snow.Enums
@{
Layout = "default.cshtml";
}
<div class="post">
<h1>@Model.Title</h1>
<div class="meta">
<p class="posted">@Model.PostDate.ToString("dd MMM yyyy")</p>
<ul class="categories">
@foreach(var category in Model.Categories) {
<li><a href="/category/@category.Url" title="@category">@category.Name</a></li>
}
</ul>
</div>
<!--div class="addthis_toolbox addthis_default_style" style="float:right;">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_button_linkedin_counter"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div-->
</div>
@Html.RenderSeries()
@Html.Raw(Model.PostContent)
@if (Model.Published == Published.True)
{
@Html.RenderDisqusComments("boyarincev")
}
@*<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-****"></script>*@
</div>
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Snow.ViewModels.PostViewModel>
@using System.Collections.Generic
@{
Layout = "default.cshtml";
}
<div class="post">
<h1>@Model.Title</h1>
<div class="meta">
<p class="posted">@Model.PostDate.ToString("dd MMM yyyy")</p>
<ul class="categories">
@foreach(var category in Model.Categories) {
<li><a href="/category/@category.Url" title="@category">@category.Name</a></li>
}
</ul>
</div>
<!--div class="addthis_toolbox addthis_default_style" style="float:right;">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_button_linkedin_counter"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div-->
</div>
@Html.RenderSeries()
@Html.Raw(Model.PostContent)
@if (Model.Published == Published.True)
{
@Html.RenderDisqusComments("boyarincev")
}
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-****"></script>
</div>
|
mit
|
C#
|
dfec4ccd1f1e61fb20a4c1a48d3a713794e659cc
|
Revert "Add test for resolving nested types with namespaces"
|
furesoft/cecil,mono/cecil,kzu/cecil,joj/cecil,gluck/cecil,cgourlay/cecil,jbevain/cecil,sailro/cecil,fnajera-rac-de/cecil,ttRevan/cecil,xen2/cecil,saynomoo/cecil,SiliconStudio/Mono.Cecil
|
Test/Mono.Cecil.Tests/NestedTypesTests.cs
|
Test/Mono.Cecil.Tests/NestedTypesTests.cs
|
using System;
using Mono.Cecil;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class NestedTypesTests : BaseTestFixture {
[Test]
public void NestedTypes ()
{
TestCSharp ("NestedTypes.cs", module => {
var foo = module.GetType ("Foo");
Assert.AreEqual ("Foo", foo.Name);
Assert.AreEqual ("Foo", foo.FullName);
Assert.AreEqual (module, foo.Module);
Assert.AreEqual (1, foo.NestedTypes.Count);
var bar = foo.NestedTypes [0];
Assert.AreEqual ("Bar", bar.Name);
Assert.AreEqual ("Foo/Bar", bar.FullName);
Assert.AreEqual (module, bar.Module);
Assert.AreEqual (1, bar.NestedTypes.Count);
var baz = bar.NestedTypes [0];
Assert.AreEqual ("Baz", baz.Name);
Assert.AreEqual ("Foo/Bar/Baz", baz.FullName);
Assert.AreEqual (module, baz.Module);
});
}
[Test]
public void DirectNestedType ()
{
TestCSharp ("NestedTypes.cs", module => {
var bingo = module.GetType ("Bingo");
var get_fuel = bingo.GetMethod ("GetFuel");
Assert.AreEqual ("Bingo/Fuel", get_fuel.ReturnType.FullName);
});
}
[Test]
public void NestedTypeWithOwnNamespace ()
{
TestModule ("bug-185.dll", module => {
var foo = module.GetType ("Foo");
var foo_child = foo.NestedTypes [0];
Assert.AreEqual ("<IFoo<System.Byte[]>", foo_child.Namespace);
Assert.AreEqual ("Do>d__0", foo_child.Name);
Assert.AreEqual ("Foo/<IFoo<System.Byte[]>.Do>d__0", foo_child.FullName);
});
}
}
}
|
using System;
using Mono.Cecil;
using NUnit.Framework;
namespace Mono.Cecil.Tests {
[TestFixture]
public class NestedTypesTests : BaseTestFixture {
[Test]
public void NestedTypes ()
{
TestCSharp ("NestedTypes.cs", module => {
var foo = module.GetType ("Foo");
Assert.AreEqual ("Foo", foo.Name);
Assert.AreEqual ("Foo", foo.FullName);
Assert.AreEqual (module, foo.Module);
Assert.AreEqual (1, foo.NestedTypes.Count);
var bar = foo.NestedTypes [0];
Assert.AreEqual ("Bar", bar.Name);
Assert.AreEqual ("Foo/Bar", bar.FullName);
Assert.AreEqual (module, bar.Module);
Assert.AreEqual (1, bar.NestedTypes.Count);
var baz = bar.NestedTypes [0];
Assert.AreEqual ("Baz", baz.Name);
Assert.AreEqual ("Foo/Bar/Baz", baz.FullName);
Assert.AreEqual (module, baz.Module);
});
}
[Test]
public void DirectNestedType ()
{
TestCSharp ("NestedTypes.cs", module => {
var bingo = module.GetType ("Bingo");
var get_fuel = bingo.GetMethod ("GetFuel");
Assert.AreEqual ("Bingo/Fuel", get_fuel.ReturnType.FullName);
});
}
[Test]
public void NestedTypeWithOwnNamespace ()
{
TestModule ("bug-185.dll", module => {
var foo = module.GetType ("Foo");
var foo_child = foo.NestedTypes [0];
Assert.AreEqual ("<IFoo<System.Byte[]>", foo_child.Namespace);
Assert.AreEqual ("Do>d__0", foo_child.Name);
Assert.AreEqual ("Foo/<IFoo<System.Byte[]>.Do>d__0", foo_child.FullName);
var foo_def = foo_child.Resolve ();
Assert.IsNotNull (foo_def);
Assert.AreEqual (foo_child.FullName, foo_def.FullName);
});
}
}
}
|
mit
|
C#
|
10dfedd73cb5f3c8d0868a645737bcafdbfb3417
|
fix tests
|
Topicomb/Forum,Topicomb/Forum
|
test/Topicomb.Forum.FunctionalTests/MiddlewaresTests.cs
|
test/Topicomb.Forum.FunctionalTests/MiddlewaresTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.TestHost;
using Topicomb.Forum.Models;
using Xunit;
namespace Topicomb.Forum.FunctionalTests
{
public class MiddlewaresTests : TestHost
{
[Fact]
public async Task Localization_JS_Test()
{
var result = await client.GetStringAsync("/assets/shared/localization.js");
Assert.NotEmpty(result);
Assert.True(result.IndexOf("__dictionary =") >= 0);
Assert.True(result.IndexOf("__replaceAll") >= 0);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.Framework.Caching.Memory;
using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.TestHost;
using Topicomb.Forum.Models;
using Xunit;
namespace Topicomb.Forum.FunctionalTests
{
public class MiddlewaresTests : TestHost
{
[Fact]
public async Task Localization_JS_Test()
{
var result = await client.GetStringAsync("/shared/localization.js");
Assert.NotEmpty(result);
Assert.True(result.IndexOf("__dictionary =") >= 0);
Assert.True(result.IndexOf("__replaceAll") >= 0);
}
}
}
|
apache-2.0
|
C#
|
c2ddce2e289f1f06648e600d4a180efbea951a8b
|
Add at CompositeAnnouncer Error(Exception exception) implementation
|
spaccabit/fluentmigrator,spaccabit/fluentmigrator
|
src/FluentMigrator.Runner/Announcers/CompositeAnnouncer.cs
|
src/FluentMigrator.Runner/Announcers/CompositeAnnouncer.cs
|
#region License
// Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Generic;
namespace FluentMigrator.Runner.Announcers
{
public class CompositeAnnouncer : IAnnouncer
{
private readonly IEnumerable<IAnnouncer> announcers;
public CompositeAnnouncer(params IAnnouncer[] announcers)
{
this.announcers = announcers ?? new IAnnouncer[] {};
}
public void Heading(string message)
{
Each(a => a.Heading(message));
}
public void Say(string message)
{
Each(a => a.Say(message));
}
public void Emphasize(string message)
{
Each(a => a.Emphasize(message));
}
public void Sql(string sql)
{
Each(a => a.Sql(sql));
}
public void ElapsedTime(TimeSpan timeSpan)
{
Each(a => a.ElapsedTime(timeSpan));
}
public void Error(string message)
{
Each(a => a.Error(message));
}
public void Error(Exception exception)
{
while (exception != null)
{
Error(exception.Message);
exception = exception.InnerException;
}
}
public void Write(string message, bool escaped)
{
Each(a => a.Write(message, escaped));
}
private void Each(Action<IAnnouncer> action)
{
foreach (var announcer in announcers)
action(announcer);
}
}
}
|
#region License
// Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Generic;
namespace FluentMigrator.Runner.Announcers
{
public class CompositeAnnouncer : IAnnouncer
{
private readonly IEnumerable<IAnnouncer> announcers;
public CompositeAnnouncer(params IAnnouncer[] announcers)
{
this.announcers = announcers ?? new IAnnouncer[] {};
}
public void Heading(string message)
{
Each(a => a.Heading(message));
}
public void Say(string message)
{
Each(a => a.Say(message));
}
public void Emphasize(string message)
{
Each(a => a.Emphasize(message));
}
public void Sql(string sql)
{
Each(a => a.Sql(sql));
}
public void ElapsedTime(TimeSpan timeSpan)
{
Each(a => a.ElapsedTime(timeSpan));
}
public void Error(string message)
{
Each(a => a.Error(message));
}
public void Write(string message, bool escaped)
{
Each(a => a.Write(message, escaped));
}
private void Each(Action<IAnnouncer> action)
{
foreach (var announcer in announcers)
action(announcer);
}
}
}
|
apache-2.0
|
C#
|
0cbaa0a50cbe121f9aea99c6a8ac4b0989bf56f5
|
Update to correct property (#11253)
|
stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2
|
src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
|
src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
|
@inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager
@inject OrchardCore.ContentManagement.Metadata.IContentDefinitionManager ContentDefinitionManager
@{
var contentDefinitions = ContentDefinitionManager.ListTypeDefinitions();
//Set Model (Current Shape) as Child content of Outer Frame, Later this Model is used to render other shapes
dynamic contentCardFrame = await New.ContentCard_Frame();
var contentItem = Model.ContentItem;
Model.ContentTypeValue = contentItem.ContentType;
//AJAX will not have CollectionShape.
var updater = Model.CollectionShape?.Updater ?? Model.Updater;
if (contentDefinitions.Any(c => c.Name == contentItem.ContentType))
{
if (Model.BuildEditor == true)
{
//Assign prefix
if (String.IsNullOrEmpty(Model.PrefixValue))
{
Model.PrefixValue = Guid.NewGuid().ToString("n");
}
//Build Editor for Content Item
// AJAX request is new request and will not have CollectionShape.
var isNew = Model.CollectionShape == null ? true : false;
dynamic contentItemEditor = await ContentItemDisplayManager.BuildEditorAsync(contentItem, updater, isNew, "", Model.PrefixValue);
//We don't show Actions and Side bar the parent editor has its own buttons.
contentItemEditor.Actions = null;
contentItemEditor.Sidebar = null;
//Move Content Footer to Card Footer, if any
Model.Footer = contentItemEditor.Footer;
contentItemEditor.Footer = null;
Model.ContentEditor = contentItemEditor;
//Change Shape type to Editor, this shape will be rendered from within Other Frame
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "ContentCard_Editor";
contentCardFrame.ChildContent = Model;
contentCardFrame.ColumnSize = Model.ColumnSize;
}
else
{
//Just Create Preview
dynamic contentDisplay = await ContentItemDisplayManager.BuildDisplayAsync(contentItem, updater, Model.DisplayType ?? "Detail");
Model.ContentPreview = contentDisplay;
//Hide the Delete
Model.CanDelete = false;
//Change Shape type to Preview, this shape will be rendered from within Other Frame
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "ContentCard_Preview";
contentCardFrame.ChildContent = Model;
}
//Display Outer Frame
@await DisplayAsync(contentCardFrame)
}
}
|
@inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager
@inject OrchardCore.ContentManagement.Metadata.IContentDefinitionManager ContentDefinitionManager
@{
var contentDefinitions = ContentDefinitionManager.ListTypeDefinitions();
//Set Model (Current Shape) as Child content of Outer Frame, Later this Model is used to render other shapes
dynamic contentCardFrame = await New.ContentCard_Frame();
var contentItem = Model.ContentItem;
Model.ContentTypeValue = contentItem.ContentType;
//AJAX will not have CollectionShape.
var updater = Model.CollectionShape?.Updater ?? Model.Updater;
if (contentDefinitions.Any(c => c.Name == contentItem.ContentType))
{
if (Model.BuildEditor == true)
{
//Assign prefix
if (String.IsNullOrEmpty(Model.PrefixValue))
{
Model.PrefixValue = Guid.NewGuid().ToString("n");
}
//Build Editor for Content Item
// AJAX request is new request and will not have CollectionShape.
var isNew = Model.CollectionShape == null ? true : false;
dynamic contentItemEditor = await ContentItemDisplayManager.BuildEditorAsync(contentItem, updater, isNew, "", Model.PrefixValue);
//We don't show Actions and Side bar the parent editor has its own buttons.
contentItemEditor.Actions = null;
contentItemEditor.Sidebar = null;
//Move Content Footer to Card Footer, if any
Model.Footer = contentItemEditor.Footer;
contentItemEditor.Footer = null;
Model.ContentEditor = contentItemEditor;
//Change Shape type to Editor, this shape will be rendered from within Other Frame
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "ContentCard_Editor";
contentCardFrame.ChildContent = Model;
contentCardFrame.ColumnSize = Model.ColumnSize;
}
else
{
//Just Create Preview
dynamic contentDisplay = await ContentItemDisplayManager.BuildDisplayAsync(contentItem, updater, Model.DisplayType ?? "Detail");
Model.ChildContent = contentDisplay;
//Hide the Delete
Model.CanDelete = false;
//Change Shape type to Preview, this shape will be rendered from within Other Frame
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "ContentCard_Preview";
contentCardFrame.ContentPreview = Model;
}
//Display Outer Frame
@await DisplayAsync(contentCardFrame)
}
}
|
bsd-3-clause
|
C#
|
c6d393e5855dd65d7a23a2af004c176afc7017a0
|
add support for unchanged billing_cycle_anchor
|
shirley-truong-volusion/stripe.net,Raganhar/stripe.net,AvengingSyndrome/stripe.net,AvengingSyndrome/stripe.net,haithemaraissia/stripe.net,craigmckeachie/stripe.net,stripe/stripe-dotnet,haithemaraissia/stripe.net,matthewcorven/stripe.net,matthewcorven/stripe.net,duckwaffle/stripe.net,chickenham/stripe.net,chickenham/stripe.net,richardlawley/stripe.net,shirley-truong-volusion/stripe.net,Raganhar/stripe.net,brentdavid2008/stripe.net,craigmckeachie/stripe.net
|
src/Stripe/Services/Subscriptions/StripeSubscriptionCreateOptions.cs
|
src/Stripe/Services/Subscriptions/StripeSubscriptionCreateOptions.cs
|
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using Stripe.Infrastructure;
namespace Stripe
{
public class StripeSubscriptionCreateOptions
{
[JsonProperty("plan")]
public string PlanId { get; set; }
[JsonProperty("coupon")]
public string CouponId { get; set; }
public DateTime? TrialEnd { get; set; }
public bool EndTrialNow { get; set; }
[JsonProperty("trial_end")]
internal string TrialEndInternal
{
get
{
if (EndTrialNow)
return "now";
else if (TrialEnd.HasValue)
return EpochTime.ConvertDateTimeToEpoch(TrialEnd.Value).ToString();
else
return null;
}
}
[JsonProperty("card")]
public StripeCreditCardOptions Card { get; set; }
[JsonProperty("quantity")]
public int? Quantity { get; set; }
[JsonProperty("application_fee_percent")]
public decimal? ApplicationFeePercent { get; set; }
[JsonProperty("tax_percent")]
public decimal? TaxPercent { get; set; }
public DateTime? BillingCycleAnchor { get; set; }
public bool BillingCycleAnchorNow { get; set; }
public bool BillingCycleAnchorUnchanged { get; set; }
[JsonProperty("billing_cycle_anchor")]
internal string BillingCycleAnchorInternal
{
get
{
if (BillingCycleAnchorNow)
return "now";
else if (BillingCycleAnchorUnchanged)
return "unchanged";
else if (BillingCycleAnchor.HasValue)
return EpochTime.ConvertDateTimeToEpoch(BillingCycleAnchor.Value).ToString();
else
return null;
}
}
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using Stripe.Infrastructure;
namespace Stripe
{
public class StripeSubscriptionCreateOptions
{
[JsonProperty("plan")]
public string PlanId { get; set; }
[JsonProperty("coupon")]
public string CouponId { get; set; }
public DateTime? TrialEnd { get; set; }
public bool EndTrialNow { get; set; }
[JsonProperty("trial_end")]
internal string TrialEndInternal
{
get
{
if (EndTrialNow)
return "now";
else if (TrialEnd.HasValue)
return EpochTime.ConvertDateTimeToEpoch(TrialEnd.Value).ToString();
else
return null;
}
}
[JsonProperty("card")]
public StripeCreditCardOptions Card { get; set; }
[JsonProperty("quantity")]
public int? Quantity { get; set; }
[JsonProperty("application_fee_percent")]
public decimal? ApplicationFeePercent { get; set; }
[JsonProperty("tax_percent")]
public decimal? TaxPercent { get; set; }
public DateTime? BillingCycleAnchor { get; set; }
public bool BillingCycleAnchorNow { get; set; }
[JsonProperty("billing_cycle_anchor")]
internal string BillingCycleAnchorInternal
{
get
{
if (BillingCycleAnchorNow)
return "now";
else if (BillingCycleAnchor.HasValue)
return EpochTime.ConvertDateTimeToEpoch(BillingCycleAnchor.Value).ToString();
else
return null;
}
}
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
|
apache-2.0
|
C#
|
3134b4d58ac655450c4868679785d12a86e9d18e
|
Disable test BeginSend_AsyncOperationCompletes_Success
|
SGuyGe/corefx,vidhya-bv/corefx-sorting,dsplaisted/corefx,axelheer/corefx,jhendrixMSFT/corefx,manu-silicon/corefx,dhoehna/corefx,shmao/corefx,YoupHulsebos/corefx,josguil/corefx,shahid-pk/corefx,adamralph/corefx,parjong/corefx,janhenke/corefx,krytarowski/corefx,JosephTremoulet/corefx,josguil/corefx,Jiayili1/corefx,josguil/corefx,lggomez/corefx,kkurni/corefx,kkurni/corefx,shimingsg/corefx,cartermp/corefx,mazong1123/corefx,iamjasonp/corefx,mmitche/corefx,alexandrnikitin/corefx,khdang/corefx,mokchhya/corefx,lggomez/corefx,Petermarcu/corefx,axelheer/corefx,Yanjing123/corefx,axelheer/corefx,JosephTremoulet/corefx,MaggieTsang/corefx,Priya91/corefx-1,nchikanov/corefx,dotnet-bot/corefx,gkhanna79/corefx,cydhaselton/corefx,YoupHulsebos/corefx,ravimeda/corefx,kkurni/corefx,ericstj/corefx,krk/corefx,tijoytom/corefx,pallavit/corefx,shmao/corefx,nbarbettini/corefx,the-dwyer/corefx,akivafr123/corefx,tijoytom/corefx,jeremymeng/corefx,elijah6/corefx,Priya91/corefx-1,YoupHulsebos/corefx,stephenmichaelf/corefx,akivafr123/corefx,Ermiar/corefx,wtgodbe/corefx,the-dwyer/corefx,ViktorHofer/corefx,yizhang82/corefx,rjxby/corefx,jlin177/corefx,seanshpark/corefx,ptoonen/corefx,axelheer/corefx,MaggieTsang/corefx,gkhanna79/corefx,nchikanov/corefx,krk/corefx,690486439/corefx,yizhang82/corefx,MaggieTsang/corefx,mazong1123/corefx,mmitche/corefx,ravimeda/corefx,krytarowski/corefx,zhenlan/corefx,690486439/corefx,alphonsekurian/corefx,mafiya69/corefx,jcme/corefx,stephenmichaelf/corefx,benpye/corefx,dotnet-bot/corefx,Yanjing123/corefx,jhendrixMSFT/corefx,ericstj/corefx,jcme/corefx,jlin177/corefx,yizhang82/corefx,Jiayili1/corefx,Jiayili1/corefx,MaggieTsang/corefx,krk/corefx,adamralph/corefx,shahid-pk/corefx,mmitche/corefx,Petermarcu/corefx,Petermarcu/corefx,Petermarcu/corefx,axelheer/corefx,bitcrazed/corefx,pallavit/corefx,manu-silicon/corefx,the-dwyer/corefx,benpye/corefx,rjxby/corefx,tijoytom/corefx,tstringer/corefx,parjong/corefx,shimingsg/corefx,akivafr123/corefx,fgreinacher/corefx,elijah6/corefx,twsouthwick/corefx,bitcrazed/corefx,ellismg/corefx,twsouthwick/corefx,weltkante/corefx,mokchhya/corefx,iamjasonp/corefx,parjong/corefx,mellinoe/corefx,jlin177/corefx,ravimeda/corefx,janhenke/corefx,lggomez/corefx,twsouthwick/corefx,benpye/corefx,manu-silicon/corefx,mokchhya/corefx,DnlHarvey/corefx,richlander/corefx,yizhang82/corefx,manu-silicon/corefx,mellinoe/corefx,ptoonen/corefx,dsplaisted/corefx,stone-li/corefx,mmitche/corefx,pallavit/corefx,marksmeltzer/corefx,wtgodbe/corefx,MaggieTsang/corefx,dhoehna/corefx,gkhanna79/corefx,richlander/corefx,rahku/corefx,marksmeltzer/corefx,weltkante/corefx,Ermiar/corefx,lggomez/corefx,DnlHarvey/corefx,Priya91/corefx-1,fgreinacher/corefx,stone-li/corefx,billwert/corefx,DnlHarvey/corefx,SGuyGe/corefx,stone-li/corefx,jeremymeng/corefx,cydhaselton/corefx,rjxby/corefx,akivafr123/corefx,alexperovich/corefx,rahku/corefx,lggomez/corefx,Petermarcu/corefx,ellismg/corefx,marksmeltzer/corefx,nchikanov/corefx,mafiya69/corefx,krk/corefx,twsouthwick/corefx,stone-li/corefx,cartermp/corefx,bitcrazed/corefx,benpye/corefx,jcme/corefx,stone-li/corefx,n1ghtmare/corefx,dhoehna/corefx,stone-li/corefx,axelheer/corefx,marksmeltzer/corefx,benjamin-bader/corefx,pallavit/corefx,krytarowski/corefx,mokchhya/corefx,dhoehna/corefx,cartermp/corefx,JosephTremoulet/corefx,ViktorHofer/corefx,stone-li/corefx,tijoytom/corefx,Chrisboh/corefx,jhendrixMSFT/corefx,Ermiar/corefx,dhoehna/corefx,bitcrazed/corefx,parjong/corefx,benjamin-bader/corefx,billwert/corefx,fgreinacher/corefx,YoupHulsebos/corefx,jcme/corefx,ptoonen/corefx,manu-silicon/corefx,gkhanna79/corefx,krk/corefx,jlin177/corefx,janhenke/corefx,jhendrixMSFT/corefx,Ermiar/corefx,Petermarcu/corefx,jlin177/corefx,rubo/corefx,the-dwyer/corefx,jhendrixMSFT/corefx,mellinoe/corefx,SGuyGe/corefx,shmao/corefx,Petermarcu/corefx,YoupHulsebos/corefx,ellismg/corefx,yizhang82/corefx,mafiya69/corefx,ptoonen/corefx,benjamin-bader/corefx,JosephTremoulet/corefx,nbarbettini/corefx,alexandrnikitin/corefx,marksmeltzer/corefx,weltkante/corefx,Ermiar/corefx,wtgodbe/corefx,ericstj/corefx,nbarbettini/corefx,mellinoe/corefx,marksmeltzer/corefx,seanshpark/corefx,dotnet-bot/corefx,benjamin-bader/corefx,wtgodbe/corefx,alexperovich/corefx,richlander/corefx,marksmeltzer/corefx,rjxby/corefx,weltkante/corefx,vidhya-bv/corefx-sorting,rubo/corefx,jeremymeng/corefx,n1ghtmare/corefx,YoupHulsebos/corefx,rahku/corefx,zhenlan/corefx,BrennanConroy/corefx,pallavit/corefx,bitcrazed/corefx,Chrisboh/corefx,JosephTremoulet/corefx,khdang/corefx,ellismg/corefx,SGuyGe/corefx,ViktorHofer/corefx,rahku/corefx,rjxby/corefx,alphonsekurian/corefx,nchikanov/corefx,benpye/corefx,shmao/corefx,zhenlan/corefx,the-dwyer/corefx,tijoytom/corefx,mazong1123/corefx,seanshpark/corefx,mokchhya/corefx,alexandrnikitin/corefx,Ermiar/corefx,dotnet-bot/corefx,mmitche/corefx,ptoonen/corefx,690486439/corefx,pallavit/corefx,dhoehna/corefx,Priya91/corefx-1,Jiayili1/corefx,jeremymeng/corefx,nchikanov/corefx,seanshpark/corefx,jlin177/corefx,nbarbettini/corefx,tstringer/corefx,tstringer/corefx,shahid-pk/corefx,richlander/corefx,Chrisboh/corefx,JosephTremoulet/corefx,wtgodbe/corefx,twsouthwick/corefx,dotnet-bot/corefx,richlander/corefx,Chrisboh/corefx,Priya91/corefx-1,krk/corefx,iamjasonp/corefx,shmao/corefx,josguil/corefx,ViktorHofer/corefx,rahku/corefx,tstringer/corefx,billwert/corefx,twsouthwick/corefx,khdang/corefx,cydhaselton/corefx,DnlHarvey/corefx,MaggieTsang/corefx,cydhaselton/corefx,shmao/corefx,stephenmichaelf/corefx,shimingsg/corefx,jcme/corefx,elijah6/corefx,zhenlan/corefx,kkurni/corefx,janhenke/corefx,benpye/corefx,dotnet-bot/corefx,josguil/corefx,cydhaselton/corefx,tstringer/corefx,nbarbettini/corefx,mazong1123/corefx,mafiya69/corefx,elijah6/corefx,lggomez/corefx,shahid-pk/corefx,mellinoe/corefx,shimingsg/corefx,ravimeda/corefx,stephenmichaelf/corefx,seanshpark/corefx,shimingsg/corefx,Chrisboh/corefx,shimingsg/corefx,alphonsekurian/corefx,Ermiar/corefx,jeremymeng/corefx,ericstj/corefx,tstringer/corefx,alphonsekurian/corefx,janhenke/corefx,alexperovich/corefx,jhendrixMSFT/corefx,richlander/corefx,ellismg/corefx,ericstj/corefx,richlander/corefx,manu-silicon/corefx,dhoehna/corefx,shahid-pk/corefx,twsouthwick/corefx,wtgodbe/corefx,janhenke/corefx,weltkante/corefx,ptoonen/corefx,fgreinacher/corefx,seanshpark/corefx,billwert/corefx,ViktorHofer/corefx,parjong/corefx,vidhya-bv/corefx-sorting,ericstj/corefx,690486439/corefx,ravimeda/corefx,iamjasonp/corefx,SGuyGe/corefx,alexandrnikitin/corefx,rahku/corefx,lggomez/corefx,khdang/corefx,mazong1123/corefx,ptoonen/corefx,alexandrnikitin/corefx,iamjasonp/corefx,adamralph/corefx,rubo/corefx,jlin177/corefx,nbarbettini/corefx,stephenmichaelf/corefx,BrennanConroy/corefx,dsplaisted/corefx,jcme/corefx,krk/corefx,Yanjing123/corefx,nbarbettini/corefx,elijah6/corefx,rahku/corefx,ViktorHofer/corefx,the-dwyer/corefx,DnlHarvey/corefx,ellismg/corefx,690486439/corefx,BrennanConroy/corefx,nchikanov/corefx,mafiya69/corefx,parjong/corefx,billwert/corefx,mmitche/corefx,khdang/corefx,benjamin-bader/corefx,tijoytom/corefx,jhendrixMSFT/corefx,cydhaselton/corefx,wtgodbe/corefx,ravimeda/corefx,shmao/corefx,Yanjing123/corefx,weltkante/corefx,gkhanna79/corefx,iamjasonp/corefx,alexperovich/corefx,rubo/corefx,krytarowski/corefx,the-dwyer/corefx,tijoytom/corefx,billwert/corefx,vidhya-bv/corefx-sorting,elijah6/corefx,JosephTremoulet/corefx,n1ghtmare/corefx,shimingsg/corefx,Chrisboh/corefx,seanshpark/corefx,alphonsekurian/corefx,Priya91/corefx-1,alexperovich/corefx,krytarowski/corefx,mazong1123/corefx,n1ghtmare/corefx,rjxby/corefx,mazong1123/corefx,krytarowski/corefx,alphonsekurian/corefx,josguil/corefx,vidhya-bv/corefx-sorting,ericstj/corefx,Jiayili1/corefx,parjong/corefx,nchikanov/corefx,n1ghtmare/corefx,akivafr123/corefx,mafiya69/corefx,MaggieTsang/corefx,alexperovich/corefx,stephenmichaelf/corefx,manu-silicon/corefx,alphonsekurian/corefx,SGuyGe/corefx,kkurni/corefx,gkhanna79/corefx,gkhanna79/corefx,elijah6/corefx,khdang/corefx,ViktorHofer/corefx,dotnet-bot/corefx,rubo/corefx,Yanjing123/corefx,benjamin-bader/corefx,YoupHulsebos/corefx,cydhaselton/corefx,cartermp/corefx,shahid-pk/corefx,zhenlan/corefx,DnlHarvey/corefx,cartermp/corefx,mmitche/corefx,zhenlan/corefx,ravimeda/corefx,DnlHarvey/corefx,yizhang82/corefx,Jiayili1/corefx,iamjasonp/corefx,alexperovich/corefx,yizhang82/corefx,stephenmichaelf/corefx,krytarowski/corefx,Jiayili1/corefx,mellinoe/corefx,billwert/corefx,kkurni/corefx,weltkante/corefx,zhenlan/corefx,cartermp/corefx,rjxby/corefx,mokchhya/corefx
|
src/System.Net.Sockets.Legacy/tests/FunctionalTests/UdpClientTest.cs
|
src/System.Net.Sockets.Legacy/tests/FunctionalTests/UdpClientTest.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Net.Test.Common;
using System.Threading;
using Xunit;
namespace System.Net.Sockets.Tests
{
public class UdpClientTest
{
// Port 8 is unassigned as per https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
private const int UnusedPort = 8;
private ManualResetEvent _waitHandle = new ManualResetEvent(false);
[Fact]
public void BeginSend_NegativeBytes_Throws()
{
UdpClient udpClient = new UdpClient(AddressFamily.InterNetwork);
byte[] sendBytes = new byte[1];
IPEndPoint remoteServer = new IPEndPoint(IPAddress.Loopback, UnusedPort);
Assert.Throws<ArgumentOutOfRangeException>("bytes", () =>
{
udpClient.BeginSend(sendBytes, -1, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
});
}
[Fact]
public void BeginSend_BytesMoreThanArrayLength_Throws()
{
UdpClient udpClient = new UdpClient(AddressFamily.InterNetwork);
byte[] sendBytes = new byte[1];
IPEndPoint remoteServer = new IPEndPoint(IPAddress.Loopback, UnusedPort);
Assert.Throws<ArgumentOutOfRangeException>("bytes", () =>
{
udpClient.BeginSend(sendBytes, sendBytes.Length + 1, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
});
}
[ActiveIssue(4363)]
[Fact]
public void BeginSend_AsyncOperationCompletes_Success()
{
UdpClient udpClient = new UdpClient();
byte[] sendBytes = new byte[1];
IPEndPoint remoteServer = new IPEndPoint(IPAddress.Loopback, UnusedPort);
_waitHandle.Reset();
udpClient.BeginSend(sendBytes, sendBytes.Length, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
Assert.True(_waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
}
private void AsyncCompleted(IAsyncResult ar)
{
UdpClient udpService = (UdpClient)ar.AsyncState;
udpService.EndSend(ar);
_waitHandle.Set();
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Net.Test.Common;
using System.Threading;
using Xunit;
namespace System.Net.Sockets.Tests
{
public class UdpClientTest
{
// Port 8 is unassigned as per https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
private const int UnusedPort = 8;
private ManualResetEvent _waitHandle = new ManualResetEvent(false);
[Fact]
public void BeginSend_NegativeBytes_Throws()
{
UdpClient udpClient = new UdpClient(AddressFamily.InterNetwork);
byte[] sendBytes = new byte[1];
IPEndPoint remoteServer = new IPEndPoint(IPAddress.Loopback, UnusedPort);
Assert.Throws<ArgumentOutOfRangeException>("bytes", () =>
{
udpClient.BeginSend(sendBytes, -1, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
});
}
[Fact]
public void BeginSend_BytesMoreThanArrayLength_Throws()
{
UdpClient udpClient = new UdpClient(AddressFamily.InterNetwork);
byte[] sendBytes = new byte[1];
IPEndPoint remoteServer = new IPEndPoint(IPAddress.Loopback, UnusedPort);
Assert.Throws<ArgumentOutOfRangeException>("bytes", () =>
{
udpClient.BeginSend(sendBytes, sendBytes.Length + 1, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
});
}
[Fact]
public void BeginSend_AsyncOperationCompletes_Success()
{
UdpClient udpClient = new UdpClient();
byte[] sendBytes = new byte[1];
IPEndPoint remoteServer = new IPEndPoint(IPAddress.Loopback, UnusedPort);
_waitHandle.Reset();
udpClient.BeginSend(sendBytes, sendBytes.Length, remoteServer, new AsyncCallback(AsyncCompleted), udpClient);
Assert.True(_waitHandle.WaitOne(Configuration.PassingTestTimeout), "Timed out while waiting for connection");
}
private void AsyncCompleted(IAsyncResult ar)
{
UdpClient udpService = (UdpClient)ar.AsyncState;
udpService.EndSend(ar);
_waitHandle.Set();
}
}
}
|
mit
|
C#
|
d610d564edec73b12d91d019ad1daddccc26e686
|
Fix warning in build script
|
thomaslevesque/Linq.Extras
|
build.cake
|
build.cake
|
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var version = Argument<string>("version", null);
var projectName = "Linq.Extras";
var solutionFile = $"./{projectName}.sln";
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(context =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(context =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory($"./{projectName}/bin/{configuration}");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
MSBuild(solutionFile,
settings => settings.SetConfiguration(configuration));
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3(new[] { $"{projectName}.Tests/bin/{configuration}/{projectName}.Tests.dll" });
});
Task("Pack")
.IsDependentOn("Test")
.Does(() =>
{
string outDir = $"{projectName}/bin/{configuration}";
string nupkgDir = $"{outDir}/nupkg";
var targets = new[] { $"dotnet", $"portable-net45+win8+wpa81+wp8" };
var files = new[] { $"{projectName}.dll", $"{projectName}.xml" };
CreateDirectory(nupkgDir);
foreach (var target in targets)
{
string targetDir = $"{nupkgDir}/lib/{target}";
CreateDirectory(targetDir);
foreach (var file in files)
{
CopyFileToDirectory($"{outDir}/{file}", targetDir);
}
}
var packSettings = new NuGetPackSettings
{
BasePath = nupkgDir,
OutputDirectory = outDir
};
NuGetPack($"{projectName}/{projectName}.nuspec", packSettings);
});
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Test");
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);
|
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var version = Argument<string>("version", null);
var projectName = "Linq.Extras";
var solutionFile = $"./{projectName}.sln";
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(() =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(() =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory($"./{projectName}/bin/{configuration}");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
MSBuild(solutionFile,
settings => settings.SetConfiguration(configuration));
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3(new[] { $"{projectName}.Tests/bin/{configuration}/{projectName}.Tests.dll" });
});
Task("Pack")
.IsDependentOn("Test")
.Does(() =>
{
string outDir = $"{projectName}/bin/{configuration}";
string nupkgDir = $"{outDir}/nupkg";
var targets = new[] { $"dotnet", $"portable-net45+win8+wpa81+wp8" };
var files = new[] { $"{projectName}.dll", $"{projectName}.xml" };
CreateDirectory(nupkgDir);
foreach (var target in targets)
{
string targetDir = $"{nupkgDir}/lib/{target}";
CreateDirectory(targetDir);
foreach (var file in files)
{
CopyFileToDirectory($"{outDir}/{file}", targetDir);
}
}
var packSettings = new NuGetPackSettings
{
BasePath = nupkgDir,
OutputDirectory = outDir
};
NuGetPack($"{projectName}/{projectName}.nuspec", packSettings);
});
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Test");
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);
|
apache-2.0
|
C#
|
b71fadc10182a087411221752b4a88326513bd1d
|
Add autofocus to AccessCode entry so invalid entry will force focus onto the input field
|
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
|
src/SFA.DAS.EmployerUsers.Web/Views/Account/Confirm.cshtml
|
src/SFA.DAS.EmployerUsers.Web/Views/Account/Confirm.cshtml
|
@model SFA.DAS.EmployerUsers.Web.Models.AccessCodeViewModel
@{
var invalidAttributes = Model.Valid ? "aria-invalid=\"true\" aria-labeledby=\"invalidMessage\"" : "";
}
<h1 class="heading-large">Register</h1>
@if (!Model.Valid)
{
<div id="invalidMessage" class="error" style="margin-bottom: 10px;">
<p class="error-message">
Invalid Code
</p>
</div>
}
<form method="post">
<fieldset>
<legend class="visuallyhidden">Access code for user registration</legend>
<div class="form-group">
<label class="form-label" for="AccessCode">Access Code</label>
<input @invalidAttributes autofocus="autofocus" aria-required="true" class="form-control" id="AccessCode" name="AccessCode">
</div>
</fieldset>
<button type="submit" class="button">Activate Account</button>
</form>
|
@model SFA.DAS.EmployerUsers.Web.Models.AccessCodeViewModel
<h1 class="heading-large">Register</h1>
@if (!Model.Valid)
{
<div class="error" style="margin-bottom: 10px;">
<p class="error-message">
Invalid Code
</p>
</div>
}
<form method="post">
<fieldset>
<legend class="visuallyhidden">Access code for user registration</legend>
<div class="form-group">
<label class="form-label" for="AccessCode">Access Code</label>
<input class="form-control" id="AccessCode" name="AccessCode">
</div>
</fieldset>
<button type="submit" class="button">Activate Account</button>
</form>
|
mit
|
C#
|
4c7c1b738481fc5ff0609e6d7bf3fa2f3a3d715d
|
Update WebViewJSRuntime.cs (#40943)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Components/WebView/WebView/src/Services/WebViewJSRuntime.cs
|
src/Components/WebView/WebView/src/Services/WebViewJSRuntime.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text.Json;
using Microsoft.JSInterop;
using Microsoft.JSInterop.Infrastructure;
namespace Microsoft.AspNetCore.Components.WebView.Services;
internal class WebViewJSRuntime : JSRuntime
{
private IpcSender _ipcSender;
public ElementReferenceContext ElementReferenceContext { get; }
public WebViewJSRuntime()
{
ElementReferenceContext = new WebElementReferenceContext(this);
JsonSerializerOptions.Converters.Add(
new ElementReferenceJsonConverter(
new WebElementReferenceContext(this)));
}
public void AttachToWebView(IpcSender ipcSender)
{
_ipcSender = ipcSender;
}
public JsonSerializerOptions ReadJsonSerializerOptions() => JsonSerializerOptions;
protected override void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
{
if (_ipcSender is null)
{
throw new InvalidOperationException("Cannot invoke JavaScript outside of a WebView context.");
}
_ipcSender.BeginInvokeJS(taskId, identifier, argsJson, resultType, targetInstanceId);
}
protected override void EndInvokeDotNet(DotNetInvocationInfo invocationInfo, in DotNetInvocationResult invocationResult)
{
var resultJsonOrErrorMessage = invocationResult.Success
? invocationResult.ResultJson
: invocationResult.Exception.ToString();
_ipcSender.EndInvokeDotNet(invocationInfo.CallId, invocationResult.Success, resultJsonOrErrorMessage);
}
protected override void SendByteArray(int id, byte[] data)
{
_ipcSender.SendByteArray(id, data);
}
protected override Task<Stream> ReadJSDataAsStreamAsync(IJSStreamReference jsStreamReference, long totalLength, CancellationToken cancellationToken = default)
=> Task.FromResult<Stream>(PullFromJSDataStream.CreateJSDataStream(this, jsStreamReference, totalLength, cancellationToken));
protected override Task TransmitStreamAsync(long streamId, DotNetStreamReference dotNetStreamReference)
{
return TransmitDataStreamToJS.TransmitStreamAsync(this, streamId, dotNetStreamReference);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text.Json;
using Microsoft.JSInterop;
using Microsoft.JSInterop.Infrastructure;
namespace Microsoft.AspNetCore.Components.WebView.Services;
internal class WebViewJSRuntime : JSRuntime
{
private IpcSender _ipcSender;
public ElementReferenceContext ElementReferenceContext { get; }
public WebViewJSRuntime()
{
ElementReferenceContext = new WebElementReferenceContext(this);
JsonSerializerOptions.Converters.Add(
new ElementReferenceJsonConverter(
new WebElementReferenceContext(this)));
}
public void AttachToWebView(IpcSender ipcSender)
{
_ipcSender = ipcSender;
}
public JsonSerializerOptions ReadJsonSerializerOptions() => JsonSerializerOptions;
protected override void BeginInvokeJS(long taskId, string identifier, string argsJson, JSCallResultType resultType, long targetInstanceId)
{
_ipcSender.BeginInvokeJS(taskId, identifier, argsJson, resultType, targetInstanceId);
}
protected override void EndInvokeDotNet(DotNetInvocationInfo invocationInfo, in DotNetInvocationResult invocationResult)
{
var resultJsonOrErrorMessage = invocationResult.Success
? invocationResult.ResultJson
: invocationResult.Exception.ToString();
_ipcSender.EndInvokeDotNet(invocationInfo.CallId, invocationResult.Success, resultJsonOrErrorMessage);
}
protected override void SendByteArray(int id, byte[] data)
{
_ipcSender.SendByteArray(id, data);
}
protected override Task<Stream> ReadJSDataAsStreamAsync(IJSStreamReference jsStreamReference, long totalLength, CancellationToken cancellationToken = default)
=> Task.FromResult<Stream>(PullFromJSDataStream.CreateJSDataStream(this, jsStreamReference, totalLength, cancellationToken));
protected override Task TransmitStreamAsync(long streamId, DotNetStreamReference dotNetStreamReference)
{
return TransmitDataStreamToJS.TransmitStreamAsync(this, streamId, dotNetStreamReference);
}
}
|
apache-2.0
|
C#
|
b724bfd2526195b5deb9c297b763c609e473c857
|
Fix flattening aggregator
|
NRules/NRules,prashanthr/NRules
|
src/NRules/NRules.RuleModel/Aggregators/FlatteningAggregator.cs
|
src/NRules/NRules.RuleModel/Aggregators/FlatteningAggregator.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace NRules.RuleModel.Aggregators
{
/// <summary>
/// Aggregator that projects each matching fact into a collection and creates a new fact for each element in that collection.
/// </summary>
/// <typeparam name="TSource">Type of source element.</typeparam>
/// <typeparam name="TResult">Type of result element.</typeparam>
internal class FlatteningAggregator<TSource, TResult> : IAggregator
{
private readonly Func<TSource, IEnumerable<TResult>> _selector;
private readonly Dictionary<TSource, IList<TResult>> _sourceToList = new Dictionary<TSource, IList<TResult>>();
public FlatteningAggregator(Func<TSource, IEnumerable<TResult>> selector)
{
_selector = selector;
}
public IEnumerable<AggregationResult> Initial()
{
return AggregationResult.Empty;
}
public IEnumerable<AggregationResult> Add(object fact)
{
var source = (TSource) fact;
var value = _selector(source);
var list = value.ToList();
_sourceToList[source] = list;
return list.Select(x => AggregationResult.Added(x)).ToArray();
}
public IEnumerable<AggregationResult> Modify(object fact)
{
var source = (TSource)fact;
var value = _selector(source);
var list = value.ToList();
var oldList = _sourceToList[source];
_sourceToList[source] = list;
return oldList.Select(x => AggregationResult.Removed(x)).Union(
list.Select(x => AggregationResult.Added(x))).ToArray();
}
public IEnumerable<AggregationResult> Remove(object fact)
{
var source = (TSource)fact;
var oldList = _sourceToList[source];
_sourceToList.Remove(source);
return oldList.Select(x => AggregationResult.Removed(x)).ToArray();
}
public IEnumerable<object> Aggregates { get { return _sourceToList.Values.SelectMany(x => x).Cast<object>(); } }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace NRules.RuleModel.Aggregators
{
/// <summary>
/// Aggregator that projects each matching fact into a collection and creates a new fact for each element in that collection.
/// </summary>
/// <typeparam name="TSource">Type of source element.</typeparam>
/// <typeparam name="TResult">Type of result element.</typeparam>
internal class FlatteningAggregator<TSource, TResult> : IAggregator
{
private readonly Func<TSource, IEnumerable<TResult>> _selector;
private readonly Dictionary<TSource, object> _sourceToValue = new Dictionary<TSource, object>();
private readonly Dictionary<TSource, IList<TResult>> _sourceToList = new Dictionary<TSource, IList<TResult>>();
public FlatteningAggregator(Func<TSource, IEnumerable<TResult>> selector)
{
_selector = selector;
}
public IEnumerable<AggregationResult> Initial()
{
return AggregationResult.Empty;
}
public IEnumerable<AggregationResult> Add(object fact)
{
var source = (TSource) fact;
var value = _selector(source);
var list = value.ToList();
_sourceToValue[source] = value;
_sourceToList[source] = list;
return list.Select(x => AggregationResult.Added(x)).ToArray();
}
public IEnumerable<AggregationResult> Modify(object fact)
{
var source = (TSource)fact;
var value = _selector(source);
var list = value.ToList();
var oldList = _sourceToList[source];
return oldList.Select(x => AggregationResult.Removed(x)).Union(
list.Select(x => AggregationResult.Added(x))).ToArray();
}
public IEnumerable<AggregationResult> Remove(object fact)
{
var source = (TSource)fact;
var oldList = _sourceToList[source];
_sourceToValue.Remove(source);
_sourceToList.Remove(source);
return oldList.Select(x => AggregationResult.Removed(x)).ToArray();
}
public IEnumerable<object> Aggregates { get { return _sourceToList.Values.SelectMany(x => x).Cast<object>(); } }
}
}
|
mit
|
C#
|
28b839caa3a2160546520cf4fa16a805e2cdd28c
|
Add unit test for annual calendar
|
lukeryannetnz/quartznet-dynamodb,lukeryannetnz/quartznet-dynamodb
|
src/QuartzNET-DynamoDB.Tests/Unit/CalendarSerialisationTests.cs
|
src/QuartzNET-DynamoDB.Tests/Unit/CalendarSerialisationTests.cs
|
using System;
using Quartz.Impl.Calendar;
using Xunit;
namespace Quartz.DynamoDB.Tests
{
/// <summary>
/// Tests the DynamoCalendar serialisation for all quartz derived calendar types.
/// </summary>
public class CalendarSerialisationTests
{
/// <summary>
/// Tests that the description property of the base calendar type serialises and deserialises correctly.
/// </summary>
/// <returns>The calendar description.</returns>
[Fact]
[Trait("Category", "Unit")]
public void BaseCalendarDescription()
{
BaseCalendar cal = new BaseCalendar() { Description = "Hi mum" };
var sut = new DynamoCalendar("test", cal);
var serialised = sut.ToDynamo();
var deserialised = new DynamoCalendar(serialised);
Assert.Equal(sut.Description, deserialised.Description);
}
/// <summary>
/// Tests that the excluded days property of the annual calendar serialises and deserialises correctly.
/// </summary>
[Fact]
[Trait("Category", "Unit")]
public void AnnualDaysExcluded()
{
var importantDate = new DateTime(2015, 04, 02);
AnnualCalendar cal = new AnnualCalendar();
cal.SetDayExcluded(DateTime.Today, true);
cal.SetDayExcluded(importantDate, true);
var sut = new DynamoCalendar("test", cal);
var serialised = sut.ToDynamo();
var deserialised = new DynamoCalendar(serialised);
Assert.True(((AnnualCalendar)deserialised.Calendar).IsDayExcluded(DateTime.Today));
Assert.True(((AnnualCalendar)deserialised.Calendar).IsDayExcluded(importantDate));
}
}
}
|
using System;
using Quartz.Impl.Calendar;
using Xunit;
namespace Quartz.DynamoDB.Tests
{
/// <summary>
/// Tests the DynamoCalendar serialisation for all quartz derived calendar types.
/// </summary>
public class CalendarSerialisationTests
{
/// <summary>
/// Tests that the description property of the base calendar type serialises and deserialises correctly.
/// </summary>
/// <returns>The calendar description.</returns>
[Fact]
[Trait("Category", "Unit")]
public void BaseCalendarDescription()
{
BaseCalendar cal = new BaseCalendar() { Description = "Hi mum" };
var sut = new DynamoCalendar("test", cal);
var serialised = sut.ToDynamo();
var deserialised = new DynamoCalendar(serialised);
Assert.Equal(sut.Description, deserialised.Description);
}
/// <summary>
/// Tests that the excluded days property of the annual calendar serialises and deserialises correctly.
/// </summary>
[Fact]
[Trait("Category", "Unit")]
public void Annual()
{
var importantDate = new DateTime(2015, 04, 02);
AnnualCalendar cal = new AnnualCalendar();
cal.SetDayExcluded(DateTime.Today, true);
cal.SetDayExcluded(importantDate, true);
var sut = new DynamoCalendar("test", cal);
var serialised = sut.ToDynamo();
var deserialised = new DynamoCalendar(serialised);
Assert.True(((AnnualCalendar)deserialised.Calendar).IsDayExcluded(DateTime.Today));
Assert.True(((AnnualCalendar)deserialised.Calendar).IsDayExcluded(importantDate));
}
}
}
|
apache-2.0
|
C#
|
f15eaf8bcac6271b87d74b72d30ce5f7869e615e
|
Make ResponseContentType setter public
|
ZocDoc/ServiceStack,timba/NServiceKit,nataren/NServiceKit,ZocDoc/ServiceStack,NServiceKit/NServiceKit,ZocDoc/ServiceStack,nataren/NServiceKit,MindTouch/NServiceKit,ZocDoc/ServiceStack,NServiceKit/NServiceKit,NServiceKit/NServiceKit,timba/NServiceKit,nataren/NServiceKit,NServiceKit/NServiceKit,MindTouch/NServiceKit,timba/NServiceKit,nataren/NServiceKit,timba/NServiceKit,MindTouch/NServiceKit,MindTouch/NServiceKit
|
src/ServiceStack.ServiceInterface/Testing/MockRequestContext.cs
|
src/ServiceStack.ServiceInterface/Testing/MockRequestContext.cs
|
using System;
using System.Collections.Generic;
using System.Net;
using Funq;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;
namespace ServiceStack.ServiceInterface.Testing
{
public class MockRequestContext : IRequestContext
{
public MockRequestContext()
{
this.Cookies = new Dictionary<string, Cookie>();
this.Files = new IFile[0];
this.Container = new Container();
var httpReq = new MockHttpRequest { Container = this.Container };
httpReq.AddSessionCookies();
this.Container.Register<IHttpRequest>(httpReq);
var httpRes = new MockHttpResponse();
this.Container.Register<IHttpResponse>(httpRes);
httpReq.Container = this.Container;
}
public T Get<T>() where T : class
{
return Container.TryResolve<T>();
}
public string IpAddress { get; private set; }
public string GetHeader(string headerName)
{
return Get<IHttpRequest>().Headers[headerName];
}
public Container Container { get; private set; }
public IDictionary<string, Cookie> Cookies { get; private set; }
public EndpointAttributes EndpointAttributes { get; private set; }
public IRequestAttributes RequestAttributes { get; private set; }
public string ContentType { get; private set; }
public string ResponseContentType { get; set; }
public string CompressionType { get; private set; }
public string AbsoluteUri { get; private set; }
public string PathInfo { get; private set; }
public IFile[] Files { get; private set; }
public AuthUserSession RemoveSession()
{
var httpReq = this.Get<IHttpRequest>();
httpReq.RemoveSession();
return httpReq.GetSession() as AuthUserSession;
}
public AuthUserSession ReloadSession()
{
var httpReq = this.Get<IHttpRequest>();
return httpReq.GetSession() as AuthUserSession;
}
public void Dispose()
{
}
public IAppHost CreateAppHost()
{
return new TestAppHost(this.Container);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Net;
using Funq;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;
namespace ServiceStack.ServiceInterface.Testing
{
public class MockRequestContext : IRequestContext
{
public MockRequestContext()
{
this.Cookies = new Dictionary<string, Cookie>();
this.Files = new IFile[0];
this.Container = new Container();
var httpReq = new MockHttpRequest { Container = this.Container };
httpReq.AddSessionCookies();
this.Container.Register<IHttpRequest>(httpReq);
var httpRes = new MockHttpResponse();
this.Container.Register<IHttpResponse>(httpRes);
httpReq.Container = this.Container;
}
public T Get<T>() where T : class
{
return Container.TryResolve<T>();
}
public string IpAddress { get; private set; }
public string GetHeader(string headerName)
{
return Get<IHttpRequest>().Headers[headerName];
}
public Container Container { get; private set; }
public IDictionary<string, Cookie> Cookies { get; private set; }
public EndpointAttributes EndpointAttributes { get; private set; }
public IRequestAttributes RequestAttributes { get; private set; }
public string ContentType { get; private set; }
public string ResponseContentType { get; private set; }
public string CompressionType { get; private set; }
public string AbsoluteUri { get; private set; }
public string PathInfo { get; private set; }
public IFile[] Files { get; private set; }
public AuthUserSession RemoveSession()
{
var httpReq = this.Get<IHttpRequest>();
httpReq.RemoveSession();
return httpReq.GetSession() as AuthUserSession;
}
public AuthUserSession ReloadSession()
{
var httpReq = this.Get<IHttpRequest>();
return httpReq.GetSession() as AuthUserSession;
}
public void Dispose()
{
}
public IAppHost CreateAppHost()
{
return new TestAppHost(this.Container);
}
}
}
|
bsd-3-clause
|
C#
|
34b40904118cdf71f28dab33d776690cbf6779fe
|
Add test that checks if a path only consisting of an enumerable accessor works ("[0]")
|
Domysee/Pather.CSharp
|
test/Pather.CSharp.UnitTests/ResolverTests.cs
|
test/Pather.CSharp.UnitTests/ResolverTests.cs
|
using FluentAssertions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Pather.CSharp.UnitTests
{
public class ResolverTests
{
public ResolverTests()
{
}
[Fact]
public void SinglePropertyResolution_CorrectSetup_Success()
{
var value = "1";
var r = new Resolver();
var o = new { Property = value };
var path = "Property";
var result = r.Resolve(o, path);
result.Should().Be(value);
}
[Fact]
public void MultiplePropertyResolution_CorrectSetup_Success()
{
var value = "1";
var r = new Resolver();
var o = new { Property1 = new { Property2 = value } };
var path = "Property1.Property2";
var result = r.Resolve(o, path);
result.Should().Be(value);
}
[Fact]
public void ArrayIndexResolutionWithProperty_CorrectSetup_Success()
{
var r = new Resolver();
var array = new[] { "1", "2" };
var o = new { Array = array };
var path = "Array[0]";
var result = r.Resolve(o, path);
result.Should().Be("1");
}
[Fact]
public void ArrayIndexResolution_CorrectSetup_Success()
{
var r = new Resolver();
var array = new[] { "1", "2" };
var path = "[0]";
var result = r.Resolve(array, path);
result.Should().Be("1");
}
[Fact]
public void SinglePropertyResolution_NoPathElementTypeForPath_FailWithNoApplicablePathElementType()
{
var value = "1";
var r = new Resolver();
var o = new { Property = value };
var path = "Property^%#";
r.Invoking(re => re.Resolve(o, path)).ShouldThrow<InvalidOperationException>();
}
}
}
|
using FluentAssertions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Pather.CSharp.UnitTests
{
public class ResolverTests
{
public ResolverTests()
{
}
[Fact]
public void SinglePropertyResolution_CorrectSetup_Success()
{
var value = "1";
var r = new Resolver();
var o = new { Property = value };
var path = "Property";
var result = r.Resolve(o, path);
result.Should().Be(value);
}
[Fact]
public void MultiplePropertyResolution_CorrectSetup_Success()
{
var value = "1";
var r = new Resolver();
var o = new { Property1 = new { Property2 = value } };
var path = "Property1.Property2";
var result = r.Resolve(o, path);
result.Should().Be(value);
}
[Fact]
public void ArrayIndexResolution_CorrectSetup_Success()
{
var r = new Resolver();
var array = new[] { "1", "2" };
var o = new { Array = array };
var path = "Array[0]";
var result = r.Resolve(o, path);
result.Should().Be("1");
}
[Fact]
public void SinglePropertyResolution_NoPathElementTypeForPath_FailWithNoApplicablePathElementType()
{
var value = "1";
var r = new Resolver();
var o = new { Property = value };
var path = "Property^%#";
r.Invoking(re => re.Resolve(o, path)).ShouldThrow<InvalidOperationException>();
}
}
}
|
mit
|
C#
|
aa79758db5250ff63b7b398260649aabefa62fb1
|
Remove unnecessary float literal
|
NeoAdonis/osu,naoey/osu,2yangk23/osu,EVAST9919/osu,johnneijzen/osu,DrabWeb/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,ZLima12/osu,naoey/osu,UselessToucan/osu,DrabWeb/osu,ppy/osu,peppy/osu-new,naoey/osu,EVAST9919/osu,ZLima12/osu,peppy/osu,ppy/osu,peppy/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,DrabWeb/osu
|
osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs
|
osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Judgements
{
public class CatchJudgement : Judgement
{
public override HitResult MaxResult => HitResult.Perfect;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 300;
}
}
/// <summary>
/// Retrieves the numeric health increase of a <see cref="HitResult"/>.
/// </summary>
/// <param name="result">The <see cref="HitResult"/> to find the numeric health increase for.</param>
/// <returns>The numeric health increase of <paramref name="result"/>.</returns>
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 10.2;
}
}
/// <summary>
/// Whether fruit on the platter should explode or drop.
/// Note that this is only checked if the owning object is also <see cref="IHasComboInformation.LastInCombo" />
/// </summary>
public virtual bool ShouldExplodeFor(JudgementResult result) => result.IsHit;
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Judgements
{
public class CatchJudgement : Judgement
{
public override HitResult MaxResult => HitResult.Perfect;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 300;
}
}
/// <summary>
/// Retrieves the numeric health increase of a <see cref="HitResult"/>.
/// </summary>
/// <param name="result">The <see cref="HitResult"/> to find the numeric health increase for.</param>
/// <returns>The numeric health increase of <paramref name="result"/>.</returns>
protected override double HealthIncreaseFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Perfect:
return 10.2f;
}
}
/// <summary>
/// Whether fruit on the platter should explode or drop.
/// Note that this is only checked if the owning object is also <see cref="IHasComboInformation.LastInCombo" />
/// </summary>
public virtual bool ShouldExplodeFor(JudgementResult result) => result.IsHit;
}
}
|
mit
|
C#
|
028909353c8dc5b027a05ae5fb995ee278db9ede
|
Revert one more change
|
ppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,peppy/osu,peppy/osu-new,UselessToucan/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu
|
osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs
|
osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.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.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.UI.Scrolling
{
/// <summary>
/// A type of <see cref="Playfield"/> specialized towards scrolling <see cref="DrawableHitObject"/>s.
/// </summary>
public abstract class ScrollingPlayfield : Playfield
{
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer;
[Resolved]
protected IScrollingInfo ScrollingInfo { get; private set; }
[BackgroundDependencyLoader]
private void load()
{
Direction.BindTo(ScrollingInfo.Direction);
}
/// <summary>
/// Given a position in screen space, return the time within this column.
/// </summary>
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) => HitObjectContainer.TimeAtScreenSpacePosition(screenSpacePosition);
/// <summary>
/// Given a time, return the screen space position within this column.
/// </summary>
public virtual Vector2 ScreenSpacePositionAtTime(double time) => HitObjectContainer.ScreenSpacePositionAtTime(time);
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
}
}
|
// 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.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.UI.Scrolling
{
/// <summary>
/// A type of <see cref="Playfield"/> specialized towards scrolling <see cref="DrawableHitObject"/>s.
/// </summary>
public abstract class ScrollingPlayfield : Playfield
{
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer;
[Resolved]
protected IScrollingInfo ScrollingInfo { get; private set; }
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
Direction.BindTo(ScrollingInfo.Direction);
}
/// <summary>
/// Given a position in screen space, return the time within this column.
/// </summary>
public virtual double TimeAtScreenSpacePosition(Vector2 screenSpacePosition) => HitObjectContainer.TimeAtScreenSpacePosition(screenSpacePosition);
/// <summary>
/// Given a time, return the screen space position within this column.
/// </summary>
public virtual Vector2 ScreenSpacePositionAtTime(double time) => HitObjectContainer.ScreenSpacePositionAtTime(time);
protected sealed override HitObjectContainer CreateHitObjectContainer() => new ScrollingHitObjectContainer();
}
}
|
mit
|
C#
|
715a5ca943b9d8fbd0dfb9499afd2d40f051132c
|
Bump version
|
damianh/LimitsMiddleware,damianh/LimitsMiddleware,tugberkugurlu/Owin.Limits
|
src/SharedAssemblyInfo.cs
|
src/SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Damian Hickey")]
[assembly: AssemblyProduct("Owin.Limits")]
[assembly: AssemblyCopyright("Copyright © Damian Hickey 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
|
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Damian Hickey")]
[assembly: AssemblyProduct("Owin.Limits")]
[assembly: AssemblyCopyright("Copyright © Damian Hickey 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
841c9e4f92d20f4a7b4aa11b5f1f13e9ab2bf1cb
|
refactor diffindo.cs
|
StefanoFiumara/Harry-Potter-Unity
|
Assets/Scripts/Cards/Spells/Transfigurations/Diffindo.cs
|
Assets/Scripts/Cards/Spells/Transfigurations/Diffindo.cs
|
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class Diffindo : GenericSpell {
//private List<GenericCard> SelectedCards;
public override void OnPlayAction()
{
//Move ALL invalid colliders to ignoreraycast layer
_Player.DisableAllCards();
_Player._OppositePlayer.DisableAllCards();
//place valid cards in valid layer
foreach(var card in _Player._OppositePlayer._InPlay.Cards) {
card.Enable();
card.gameObject.layer = Helper.VALID_CHOICE_LAYER;
}
var SelectedCards = new List<GenericCard>();
StartCoroutine(WaitForPlayerInput(SelectedCards));
}
public override bool MeetsAdditionalPlayRequirements()
{
return _Player._OppositePlayer._InPlay.Cards.Count > 0;
}
public override void AfterInputAction(List<GenericCard> selectedCards)
{
if (selectedCards.Count == 1)
{
selectedCards[0].Enable();
_Player._OppositePlayer._InPlay.Remove(selectedCards[0]);
_Player._OppositePlayer._Discard.Add(selectedCards[0], 0.1f);
_Player.EnableAllCards();
_Player._OppositePlayer.EnableAllCards();
}
else
{
throw new Exception("More than one input sent to Diffindo, this should never happen!");
}
}
}
|
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
public class Diffindo : GenericSpell {
//private List<GenericCard> SelectedCards;
public override void OnPlayAction()
{
//Move ALL invalid colliders to ignoreraycast layer
_Player.DisableAllCards();
_Player._OppositePlayer.DisableAllCards();
//place valid cards in valid layer
foreach(var card in _Player._OppositePlayer._InPlay.Cards) {
card.Enable();
card.gameObject.layer = Helper.VALID_CHOICE_LAYER;
}
var SelectedCards = new List<GenericCard>();
StartCoroutine(WaitForPlayerInput(SelectedCards));
}
public override bool MeetsAdditionalPlayRequirements()
{
return _Player._OppositePlayer._InPlay.Cards.Count > 0;
}
public override void AfterInputAction(List<GenericCard> selectedCards)
{
if (selectedCards.Count == 1)
{
selectedCards[0].Enable();
_Player._OppositePlayer._InPlay.Remove(selectedCards[0]);
_Player._OppositePlayer._Discard.Add(selectedCards[0], 0.1f);
//reset the layer for all the cards
_Player._Deck.gameObject.layer = 0;
_Player._OppositePlayer._Deck.gameObject.layer = 0;
Helper.EnableCards(_Player._Hand.Cards);
Helper.EnableCards(_Player._InPlay.Cards);
Helper.EnableCards(_Player._OppositePlayer._Hand.Cards);
Helper.EnableCards(_Player._OppositePlayer._InPlay.Cards);
}
else
{
throw new Exception("More than one input sent to Diffindo, this should never happen!");
}
}
}
|
mit
|
C#
|
876bca410bb3c7972995445ad8d36513cf49734c
|
update info
|
chinaboard/PureCat
|
PureCat/Message/Spi/Internals/StatusUpdateTask.cs
|
PureCat/Message/Spi/Internals/StatusUpdateTask.cs
|
using PureCat.Message.Spi.Heartbeat;
using PureCat.Message.Spi.Heartbeat.Extend;
using PureCat.Util;
using System.Text;
using System.Threading;
namespace PureCat.Message.Spi.Internals
{
public class StatusUpdateTask
{
internal readonly NodeStatusInfo _nodeInfo = null;
public StatusUpdateTask(IMessageStatistics statistics)
{
try
{
_nodeInfo = new NodeStatusInfo(statistics);
_nodeInfo.HeartbeatExtensions.Add(new CpuInfo());
_nodeInfo.HeartbeatExtensions.Add(new NetworkIO());
_nodeInfo.HeartbeatExtensions.Add(new DiskIO());
_nodeInfo.Refresh();
_nodeInfo.HaveAcessRight = true;
}
catch
{
}
}
public void Run(object o)
{
while (true)
{
if (!_nodeInfo.HaveAcessRight)
break;
if (!PureCatClient.IsInitialized())
{
Thread.Sleep(5000);
continue;
}
PureCatClient.DoTransaction("System", "Status", () =>
{
_nodeInfo.Refresh();
PureCatClient.GetProducer().LogHeartbeat("Heartbeat", AppEnv.IP, PureCatConstants.SUCCESS, XmlHelper.XmlSerialize(_nodeInfo, Encoding.UTF8));
PureCatClient.GetProducer().LogEvent("System", $"PureCat.Version : {PureCatClient.Version}", PureCatConstants.SUCCESS, PureCatClient.Version);
});
Thread.Sleep(60000);
}
}
}
}
|
using PureCat.Message.Spi.Heartbeat;
using PureCat.Message.Spi.Heartbeat.Extend;
using PureCat.Util;
using System.Text;
using System.Threading;
namespace PureCat.Message.Spi.Internals
{
public class StatusUpdateTask
{
internal readonly NodeStatusInfo _nodeInfo = null;
public StatusUpdateTask(IMessageStatistics statistics)
{
try
{
_nodeInfo = new NodeStatusInfo(statistics);
_nodeInfo.HeartbeatExtensions.Add(new CpuInfo());
_nodeInfo.HeartbeatExtensions.Add(new NetworkIO());
_nodeInfo.HeartbeatExtensions.Add(new DiskIO());
_nodeInfo.Refresh();
_nodeInfo.HaveAcessRight = true;
}
catch
{
}
}
public void Run(object o)
{
while (true)
{
if (!_nodeInfo.HaveAcessRight)
break;
if (!PureCatClient.IsInitialized())
{
Thread.Sleep(5000);
continue;
}
PureCatClient.DoTransaction("System", "Status", () =>
{
_nodeInfo.Refresh();
PureCatClient.GetProducer().LogHeartbeat("Heartbeat", AppEnv.IP, PureCatConstants.SUCCESS, XmlHelper.XmlSerialize(_nodeInfo, Encoding.UTF8));
PureCatClient.GetProducer().LogEvent("System", $"Cat.Version : {PureCatClient.Version}", PureCatConstants.SUCCESS, PureCatClient.Version);
});
Thread.Sleep(60000);
}
}
}
}
|
mit
|
C#
|
52220024638f64dd43f9af2a19dd5744dc124800
|
Add missing header
|
rasmus/EventFlow
|
Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs
|
Source/EventFlow.Tests/UnitTests/ReadStores/TestAsyncReadModel.cs
|
// The MIT License (MIT)
//
// Copyright (c) 2015-2019 Rasmus Mikkelsen
// Copyright (c) 2015-2019 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Threading;
using System.Threading.Tasks;
using EventFlow.Aggregates;
using EventFlow.ReadStores;
using EventFlow.TestHelpers.Aggregates;
using EventFlow.TestHelpers.Aggregates.Events;
namespace EventFlow.Tests.UnitTests.ReadStores
{
public class TestAsyncReadModel : IReadModel, IAmAsyncReadModelFor<ThingyAggregate, ThingyId, ThingyPingEvent>
{
public Task ApplyAsync(
IReadModelContext context,
IDomainEvent<ThingyAggregate, ThingyId, ThingyPingEvent> domainEvent,
CancellationToken cancellationToken )
{
return Task.Delay( 0, cancellationToken );
}
}
}
|
using System.Threading;
using System.Threading.Tasks;
using EventFlow.Aggregates;
using EventFlow.ReadStores;
using EventFlow.TestHelpers.Aggregates;
using EventFlow.TestHelpers.Aggregates.Events;
namespace EventFlow.Tests.UnitTests.ReadStores
{
public class TestAsyncReadModel : IReadModel, IAmAsyncReadModelFor<ThingyAggregate, ThingyId, ThingyPingEvent>
{
public Task ApplyAsync(
IReadModelContext context,
IDomainEvent<ThingyAggregate, ThingyId, ThingyPingEvent> domainEvent,
CancellationToken cancellationToken )
{
return Task.Delay( 0, cancellationToken );
}
}
}
|
mit
|
C#
|
c2fbadfc01477901bff677263b899476dfe43af8
|
Change icon classes.
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/IconClasses.cs
|
source/Nuke.Common/IconClasses.cs
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.Tools.CoverallsNet;
using Nuke.Common.Tools.DocFx;
using Nuke.Common.Tools.DotCover;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.DupFinder;
using Nuke.Common.Tools.GitLink;
using Nuke.Common.Tools.GitReleaseManager;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.InspectCode;
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Tools.Npm;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Tools.Nunit;
using Nuke.Common.Tools.OpenCover;
using Nuke.Common.Tools.Paket;
using Nuke.Common.Tools.ReportGenerator;
using Nuke.Common.Tools.TestCloud;
using Nuke.Common.Tools.VsTest;
using Nuke.Common.Tools.Xunit;
using Nuke.Core.Execution;
[assembly: IconClass(typeof(CoverallsNetTasks), "pie-chart4")]
[assembly: IconClass(typeof(DefaultSettings), "equalizer")]
[assembly: IconClass(typeof(DocFxTasks), "books")]
[assembly: IconClass(typeof(DotCoverTasks), "shield2")]
[assembly: IconClass(typeof(DotNetTasks), "fire")]
[assembly: IconClass(typeof(DupFinderTasks), "code")]
[assembly: IconClass(typeof(GitLinkTasks), "link")]
[assembly: IconClass(typeof(GitReleaseManagerTasks), "books")]
[assembly: IconClass(typeof(GitRepository), "git")]
[assembly: IconClass(typeof(GitVersionTasks), "podium")]
[assembly: IconClass(typeof(InspectCodeTasks), "code")]
[assembly: IconClass(typeof(MSBuildTasks), "sword")]
[assembly: IconClass(typeof(NpmTasks), "box")]
[assembly: IconClass(typeof(NuGetTasks), "box")]
[assembly: IconClass(typeof(NunitTasks), "bug2")]
[assembly: IconClass(typeof(OpenCoverTasks), "shield2")]
[assembly: IconClass(typeof(PaketTasks), "box")]
[assembly: IconClass(typeof(ReportGeneratorTasks), "pie-chart4")]
[assembly: IconClass(typeof(SerializationTasks), "transmission2")]
[assembly: IconClass(typeof(TestCloudTasks), "bug2")]
[assembly: IconClass(typeof(TextTasks), "file-text3")]
[assembly: IconClass(typeof(VsTestTasks), "bug2")]
[assembly: IconClass(typeof(XmlTasks), "file-empty2")]
[assembly: IconClass(typeof(XunitTasks), "bug2")]
#if !NETCORE
[assembly: IconClass(typeof(FtpTasks), "sphere2")]
[assembly: IconClass(typeof(HttpTasks), "sphere2")]
#endif
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.Tools.CoverallsNet;
using Nuke.Common.Tools.DocFx;
using Nuke.Common.Tools.DotCover;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.DupFinder;
using Nuke.Common.Tools.GitLink;
using Nuke.Common.Tools.GitReleaseManager;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.InspectCode;
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Tools.Npm;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Tools.Nunit;
using Nuke.Common.Tools.OpenCover;
using Nuke.Common.Tools.Paket;
using Nuke.Common.Tools.ReportGenerator;
using Nuke.Common.Tools.TestCloud;
using Nuke.Common.Tools.VsTest;
using Nuke.Common.Tools.Xunit;
using Nuke.Core.Execution;
[assembly: IconClass(typeof(CoverallsNetTasks), "stats-growth")]
[assembly: IconClass(typeof(DefaultSettings), "equalizer")]
[assembly: IconClass(typeof(DocFxTasks), "books")]
[assembly: IconClass(typeof(DotCoverTasks), "shield2")]
[assembly: IconClass(typeof(DotNetTasks), "fire")]
[assembly: IconClass(typeof(DupFinderTasks), "code")]
[assembly: IconClass(typeof(GitLinkTasks), "link")]
[assembly: IconClass(typeof(GitReleaseManagerTasks), "tree7")]
[assembly: IconClass(typeof(GitRepository), "git")]
[assembly: IconClass(typeof(GitVersionTasks), "podium")]
[assembly: IconClass(typeof(InspectCodeTasks), "code")]
[assembly: IconClass(typeof(MSBuildTasks), "sword")]
[assembly: IconClass(typeof(NpmTasks), "box")]
[assembly: IconClass(typeof(NuGetTasks), "box")]
[assembly: IconClass(typeof(NunitTasks), "bug2")]
[assembly: IconClass(typeof(OpenCoverTasks), "shield2")]
[assembly: IconClass(typeof(PaketTasks), "box")]
[assembly: IconClass(typeof(ReportGeneratorTasks), "stats-growth")]
[assembly: IconClass(typeof(SerializationTasks), "transmission2")]
[assembly: IconClass(typeof(TestCloudTasks), "bug2")]
[assembly: IconClass(typeof(TextTasks), "file-text3")]
[assembly: IconClass(typeof(VsTestTasks), "bug2")]
[assembly: IconClass(typeof(XmlTasks), "file-empty2")]
[assembly: IconClass(typeof(XunitTasks), "bug2")]
#if !NETCORE
[assembly: IconClass(typeof(FtpTasks), "sphere2")]
[assembly: IconClass(typeof(HttpTasks), "sphere2")]
#endif
|
mit
|
C#
|
0565b1bac50b1ff2cf73ef7bf7b0e8ece5c519fc
|
remove legacy endpoint from tests
|
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
|
services/api/Tweek.ApiService.SmokeTests/ITweekApi.cs
|
services/api/Tweek.ApiService.SmokeTests/ITweekApi.cs
|
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using RestEase;
using FSharpUtils.Newtonsoft;
namespace Tweek.ApiService.SmokeTests
{
public interface ITweekApi
{
[Get("api/v1/keys/{keyPath}")]
Task<JToken> GetConfigurations([Path] string keyPath,[QueryMap] IEnumerable<KeyValuePair<string, string>> context);
Task AppendContext([Path] string identityType, [Path]string identityId, Dictionary<string, JsonValue> context);
Task RemoveFromContext([Path] string identityType, [Path]string identityId, string property);
[Get("/api/swagger.json")]
Task<JToken> GetSwagger();
[Options("")]
Task<HttpResponseMessage> GetCorsPreflightResponse(string origin, string method);
}
}
|
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using RestEase;
using FSharpUtils.Newtonsoft;
namespace Tweek.ApiService.SmokeTests
{
public interface ITweekApi
{
[Get("configurations/{keyPath}")]
Task<JToken> GetConfigurations([Path] string keyPath,[QueryMap] IEnumerable<KeyValuePair<string, string>> context);
Task AppendContext([Path] string identityType, [Path]string identityId, Dictionary<string, JsonValue> context);
Task RemoveFromContext([Path] string identityType, [Path]string identityId, string property);
[Get("/api/swagger.json")]
Task<JToken> GetSwagger();
[Options("")]
Task<HttpResponseMessage> GetCorsPreflightResponse(string origin, string method);
}
}
|
mit
|
C#
|
ea197b168a26c50e0384a94d55d13b7b3a4ec15c
|
add CachePath(forgotten
|
sassembla/Autoya,sassembla/Autoya,sassembla/Autoya
|
Assets/Editor/AssetGraph-1.4-release/UnityEngine.AssetGraph/EditorRuntimeSupport/AssetGraphBasePath.cs
|
Assets/Editor/AssetGraph-1.4-release/UnityEngine.AssetGraph/EditorRuntimeSupport/AssetGraphBasePath.cs
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.AssetGraph
{
#if UNITY_EDITOR
public class AssetGraphBasePath : ScriptableObject
{
private static string s_basePath;
public static string BasePath
{
get
{
if (string.IsNullOrEmpty(s_basePath))
{
var obj = ScriptableObject.CreateInstance<AssetGraphBasePath>();
MonoScript s = MonoScript.FromScriptableObject(obj);
var configGuiPath = AssetDatabase.GetAssetPath(s);
UnityEngine.Object.DestroyImmediate(obj);
var fileInfo = new FileInfo(configGuiPath);
var baseDir = fileInfo.Directory.Parent;
Assertions.Assert.AreEqual(ToolDirName, baseDir.Name);
string baseDirPath = baseDir.ToString().Replace('\\', '/');
int index = baseDirPath.LastIndexOf(ASSETS_PATH);
Assertions.Assert.IsTrue(index >= 0);
baseDirPath = baseDirPath.Substring(index);
s_basePath = baseDirPath;
}
return s_basePath;
}
}
public static void ResetBasePath()
{
s_basePath = string.Empty;
}
/// <summary>
/// Name of the base directory containing the asset graph tool files.
/// Customize this to match your project's setup if you need to change.
/// </summary>
/// <value>The name of the base directory.</value>
public static string ToolDirName { get { return "UnityEngine.AssetGraph"; } }
public const string ASSETS_PATH = "Assets/";
public static string CachePath { get { return System.IO.Path.Combine(BasePath, "Cache/"); } }
public static string SettingFilePath { get { return System.IO.Path.Combine(BasePath, "SettingFiles"); } }
public static string TemporalSettingFilePath { get { return System.IO.Path.Combine(CachePath, "TemporalSettingFiles"); } }
}
#endif
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngine.AssetGraph
{
#if UNITY_EDITOR
public class AssetGraphBasePath : ScriptableObject
{
private static string s_basePath;
public static string BasePath
{
get
{
if (string.IsNullOrEmpty(s_basePath))
{
var obj = ScriptableObject.CreateInstance<AssetGraphBasePath>();
MonoScript s = MonoScript.FromScriptableObject(obj);
var configGuiPath = AssetDatabase.GetAssetPath(s);
UnityEngine.Object.DestroyImmediate(obj);
var fileInfo = new FileInfo(configGuiPath);
var baseDir = fileInfo.Directory.Parent;
Assertions.Assert.AreEqual(ToolDirName, baseDir.Name);
string baseDirPath = baseDir.ToString().Replace('\\', '/');
int index = baseDirPath.LastIndexOf(ASSETS_PATH);
Assertions.Assert.IsTrue(index >= 0);
baseDirPath = baseDirPath.Substring(index);
s_basePath = baseDirPath;
}
return s_basePath;
}
}
public static void ResetBasePath()
{
s_basePath = string.Empty;
}
/// <summary>
/// Name of the base directory containing the asset graph tool files.
/// Customize this to match your project's setup if you need to change.
/// </summary>
/// <value>The name of the base directory.</value>
public static string ToolDirName { get { return "UnityEngine.AssetGraph"; } }
public const string ASSETS_PATH = "Assets/";
public static string SettingFilePath { get { return System.IO.Path.Combine(BasePath, "SettingFiles"); } }
public static string TemporalSettingFilePath { get { return System.IO.Path.Combine(CachePath, "TemporalSettingFiles"); } }
}
#endif
}
|
mit
|
C#
|
0f4f41e9d76217d6893c7950ebdfcb04f080dcaa
|
support for issue #1 has now been resolved.
|
fluentcassandra/fluentcassandra,fluentcassandra/fluentcassandra,fluentcassandra/fluentcassandra
|
FluentCassandra/Connection/FailoverConnectionProvider.cs
|
FluentCassandra/Connection/FailoverConnectionProvider.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
namespace FluentCassandra
{
public class FailoverConnectionProvider : ConnectionProvider
{
private int _currentIndex;
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
public FailoverConnectionProvider(ConnectionBuilder builder)
: base(builder)
{
if (builder.Timeout == 0)
throw new CassandraException("You must specify a timeout for the failover provider.");
Reset();
}
/// <summary>
/// The last error that occured.
/// </summary>
public Exception LastError
{
get;
private set;
}
/// <summary>
/// Reset the failover connection list.
/// </summary>
public void Reset()
{
_currentIndex = -1;
LastError = null;
}
/// <summary>
/// Gets if there are any more connections left to try.
/// </summary>
public bool HasNext
{
get { return _currentIndex < Builder.Servers.Count; }
}
public IConnection GetNextConnection()
{
_currentIndex++;
int maxServers = Builder.Servers.Count;
if (maxServers == 0)
throw new CassandraException("No connection could be made because no servers were defined.");
if (_currentIndex > (maxServers - 1))
return null;
var server = Builder.Servers[_currentIndex];
var conn = new Connection(server, Builder.Timeout);
return conn;
}
public override IConnection Open()
{
IConnection conn = null;
while (HasNext)
{
try
{
conn = GetNextConnection();
conn.Open();
break;
}
catch (SocketException exc)
{
LastError = exc;
}
}
if (conn == null)
throw new CassandraException("No connection could be made because all servers have failed.");
Reset();
return conn;
}
public override IConnection CreateNewConnection()
{
return GetNextConnection();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
namespace FluentCassandra
{
public class FailoverConnectionProvider : ConnectionProvider
{
private int _currentIndex;
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
public FailoverConnectionProvider(ConnectionBuilder builder)
: base(builder)
{
if (builder.Timeout == 0)
throw new CassandraException("You must specify a timeout for the failover provider.");
Reset();
}
public Exception LastError
{
get;
private set;
}
public void Reset()
{
_currentIndex = -1;
LastError = null;
}
public bool HasNext
{
get { return _currentIndex < Builder.Servers.Count; }
}
public IConnection GetNextConnection()
{
_currentIndex++;
int maxServers = Builder.Servers.Count;
if (maxServers == 0)
throw new CassandraException("No connection could be made because no servers were defined.");
if (_currentIndex > (maxServers - 1))
return null;
var server = Builder.Servers[_currentIndex];
var conn = new Connection(server, Builder.Timeout);
return conn;
}
public override IConnection Open()
{
IConnection conn = null;
while (HasNext)
{
try
{
conn = GetNextConnection();
conn.Open();
break;
}
catch (SocketException exc)
{
LastError = exc;
}
}
if (conn == null)
throw new CassandraException("No connection could be made because all servers have failed.");
Reset();
return conn;
}
public override IConnection CreateNewConnection()
{
return GetNextConnection();
}
}
}
|
apache-2.0
|
C#
|
08a7905e116dbb722fe910c1963c705bc3d41fe8
|
Use CloudFlare CF-Connecting-IP to access user ip address
|
bcjobs/infrastructure
|
Infra.Authentications.Identity/Services/Authenticator.cs
|
Infra.Authentications.Identity/Services/Authenticator.cs
|
using Infra.Authentications;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Security.Claims;
using System.Threading;
using Infra.Events;
namespace Infra.Authentications.Identity.Services
{
public class Authenticator : IAuthenticator
{
public Authenticator(IEnumerable<IAuthenticationObserver> monitors)
{
Monitors = monitors;
}
IEnumerable<IAuthenticationObserver> Monitors { get; }
public IPAddress ClientIP {
get
{
IPAddress address;
if (IPAddress.TryParse(HttpContext.Current.Request.Headers.GetValues("CF-Connecting-IP").FirstOrDefault(), out address))
return address;
return IPAddress.None;
}
}
public string ImpersonatorId
{
get
{
if (!IsAuthenticated)
return null;
return Identity.GetImpersonatorId();
}
}
public string UserId
{
get
{
if (!IsAuthenticated)
return null;
foreach (var monitor in Monitors)
monitor.Observe(this);
return Identity.Name;
}
}
ClaimsPrincipal Principal => Thread.CurrentPrincipal as ClaimsPrincipal;
ClaimsIdentity Identity => Principal?.Identity as ClaimsIdentity;
bool IsAuthenticated => Identity?.IsAuthenticated ?? false;
}
}
|
using Infra.Authentications;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Security.Claims;
using System.Threading;
using Infra.Events;
namespace Infra.Authentications.Identity.Services
{
public class Authenticator : IAuthenticator
{
public Authenticator(IEnumerable<IAuthenticationObserver> monitors)
{
Monitors = monitors;
}
IEnumerable<IAuthenticationObserver> Monitors { get; }
public IPAddress ClientIP {
get
{
IPAddress address;
if (IPAddress.TryParse(HttpContext.Current.Request.UserHostAddress, out address))
return address;
return IPAddress.None;
}
}
public string ImpersonatorId
{
get
{
if (!IsAuthenticated)
return null;
return Identity.GetImpersonatorId();
}
}
public string UserId
{
get
{
if (!IsAuthenticated)
return null;
foreach (var monitor in Monitors)
monitor.Observe(this);
return Identity.Name;
}
}
ClaimsPrincipal Principal => Thread.CurrentPrincipal as ClaimsPrincipal;
ClaimsIdentity Identity => Principal?.Identity as ClaimsIdentity;
bool IsAuthenticated => Identity?.IsAuthenticated ?? false;
}
}
|
mit
|
C#
|
91be8d2552ff10084750e17fa114b9f342643fdc
|
Make DateTimeOffsetConverter internal
|
carbon/Amazon
|
src/Amazon.DynamoDb/JsonConverters/DateTimeOffsetConverter.cs
|
src/Amazon.DynamoDb/JsonConverters/DateTimeOffsetConverter.cs
|
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Amazon.DynamoDb.JsonConverters
{
internal class DateTimeOffsetConverter : JsonConverter<DateTimeOffset>
{
public override DateTimeOffset Read(
ref Utf8JsonReader reader,
Type typeToConvert,
JsonSerializerOptions options)
{
double timestampSeconds = reader.GetDouble();
return DateTimeOffset.FromUnixTimeMilliseconds((long)(timestampSeconds * 1000d));
}
public override void Write(
Utf8JsonWriter writer,
DateTimeOffset dateTimeValue,
JsonSerializerOptions options)
{
writer.WriteNumberValue(dateTimeValue.ToUnixTimeSeconds());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Amazon.DynamoDb.JsonConverters
{
public class DateTimeOffsetConverter : JsonConverter<DateTimeOffset>
{
public override DateTimeOffset Read(
ref Utf8JsonReader reader,
Type typeToConvert,
JsonSerializerOptions options)
{
double timestampSeconds = reader.GetDouble();
return DateTimeOffset.FromUnixTimeMilliseconds((long)(timestampSeconds * 1000d));
}
public override void Write(
Utf8JsonWriter writer,
DateTimeOffset dateTimeValue,
JsonSerializerOptions options)
{
writer.WriteNumberValue(dateTimeValue.ToUnixTimeSeconds());
}
}
}
|
mit
|
C#
|
c891fa0d28310cade91b235277ef91627c4ea084
|
Add extension method for StatefulModel.MultipleDisposable.
|
Grabacr07/MetroTrilithon
|
source/MetroTrilithon/Lifetime/DisposableExtensions.cs
|
source/MetroTrilithon/Lifetime/DisposableExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using StatefulModel;
namespace MetroTrilithon.Lifetime
{
public static class DisposableExtensions
{
/// <summary>
/// <see cref="IDisposable"/> オブジェクトを、指定した <see cref="IDisposableHolder.CompositeDisposable"/> に追加します。
/// </summary>
public static T AddTo<T>(this T disposable, IDisposableHolder obj) where T : IDisposable
{
if (obj == null)
{
disposable.Dispose();
}
else
{
obj.CompositeDisposable.Add(disposable);
}
return disposable;
}
public static T AddTo<T>(this T disposable, MultipleDisposable obj) where T : IDisposable
{
if (obj == null)
{
disposable.Dispose();
}
else
{
obj.Add(disposable);
}
return disposable;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MetroTrilithon.Lifetime
{
public static class DisposableExtensions
{
/// <summary>
/// <see cref="IDisposable"/> オブジェクトを、指定した <see cref="IDisposableHolder.CompositeDisposable"/> に追加します。
/// </summary>
public static T AddTo<T>(this T disposable, IDisposableHolder obj) where T : IDisposable
{
if (obj == null)
{
disposable.Dispose();
return disposable;
}
obj.CompositeDisposable.Add(disposable);
return disposable;
}
}
}
|
mit
|
C#
|
c283cdaee5c407a8500c9d63810b92e76f100707
|
fix test
|
zpisgod/CIDemo,zpisgod/CIDemo
|
src/CIDemo.Tests/Controllers/HomeControllerTest.cs
|
src/CIDemo.Tests/Controllers/HomeControllerTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CIDemo;
using CIDemo.Controllers;
namespace CIDemo.Tests.Controllers
{
[TestClass]
public class HomeControllerTest
{
[TestMethod]
public void Index()
{
// Arrange
HomeController controller = new HomeController();
// Act
ContentResult result = controller.Index() as ContentResult;
// Assert
Assert.IsNotNull(result);
}
[TestMethod]
public void About()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.About() as ViewResult;
// Assert
Assert.AreEqual("Your application description page.", result.ViewBag.Message);
}
[TestMethod]
public void Contact()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Contact() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
[TestMethod]
public void GetConfig()
{
// Arrange
HomeController controller = new HomeController();
// Act
ContentResult result = controller.Test() as ContentResult;
// Assert
Assert.IsNotNull(result);
Assert.AreEqual("Test", result.Content);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CIDemo;
using CIDemo.Controllers;
namespace CIDemo.Tests.Controllers
{
[TestClass]
public class HomeControllerTest
{
[TestMethod]
public void Index()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Index() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
[TestMethod]
public void About()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.About() as ViewResult;
// Assert
Assert.AreEqual("Your application description page.", result.ViewBag.Message);
}
[TestMethod]
public void Contact()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Contact() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
[TestMethod]
public void GetConfig()
{
// Arrange
HomeController controller = new HomeController();
// Act
ContentResult result = controller.Test() as ContentResult;
// Assert
Assert.IsNotNull(result);
Assert.AreEqual("Test", result.Content);
}
}
}
|
mit
|
C#
|
2368943e38b45d978a2fcf3d4c70eadcf00b0afa
|
Update AppSettings.cs
|
Microsoft/HealthClinic.biz,Microsoft/HealthClinic.biz,Microsoft/HealthClinic.biz,Microsoft/HealthClinic.biz,Microsoft/HealthClinic.biz,Microsoft/HealthClinic.biz,Microsoft/HealthClinic.biz
|
src/MyHealth.Client.Core/AppSettings.cs
|
src/MyHealth.Client.Core/AppSettings.cs
|
using System;
namespace MyHealth.Client.Core
{
public static class AppSettings
{
public static string ServerlUrl = "http://YOUR_WEB.azurewebsites.net/";
public static string MobileAPIUrl = "https://YOUR_WEB_MOBILE.azurewebsites.net";
public static int DefaultPatientId = __YOURPATIENTID__;
public static int CurrentPatientId = __YOURPATIENTID__;
public static int DefaultTenantId = __YOURTENANTID__;
public static string DefaultAppointmentDescription = "Follow up in order to determine the effectiveness of treatment received";
public static int MinimumRoomNumber = 1;
public static int MaximumRoomNumber = 10;
public static string NonExistingFieldDefaultValue = "-";
// HockeyApp AppId
public static string HockeyAppiOSAppID = "YOUR_HOCKEY_APP_ID";
public static string iOSAppGroupIdentifier = "group.app.client.patients";
public static string iOSAppGroupDirectory = "messageDir";
public static bool OutlookIntegration = false;
public static SecuritySettings Security
{
get
{
if (OutlookIntegration)
return OutlookSettings;
else
return AADSettings;
}
}
static SecuritySettings AADSettings = new SecuritySettings()
{
ClientId = "YOUR_AAD_CLIENT_ID",
RedirectUri = new Uri("YOUR_AAD_REDIRECT_URI"),
Authority = "YOUR_AAD_AUTHORITY",
Scope = "https://graph.microsoft.com",
Domain = "YOUR_AAD_DOMAIN"
};
static SecuritySettings OutlookSettings = new SecuritySettings()
{
ClientId = "YOUR_OUTLOOK_CLIENT_ID",
RedirectUri = new Uri("YOUR_OUTLOOK_REDIRECT_URI"),
Authority = "YOUR_OUTLOOK_AUTHORITY",
Scope = "https://graph.microsoft.com/calendars.readwrite",
Domain = "YOUR_OUTLOOK_DOMAIN"
};
}
public class SecuritySettings
{
public string ClientId { get; set; }
public Uri RedirectUri { get; set; }
public string Authority { get; set; }
public string Scope { get; set; }
public string Domain { get; set; }
}
}
|
using System;
namespace MyHealth.Client.Core
{
public static class AppSettings
{
public static string ServerlUrl = "http://YOUR_WEB.azurewebsites.net/";
public static string MobileAPIUrl = "https://YOUR_WEB_MOBILE.azurewebsites.net";
public static int DefaultPatientId = __YOUR_PATIENT_ID__;
public static int CurrentPatientId = __YOUR_PATIENT_ID__;
public static int DefaultTenantId = __YOUR_TENANT_ID__;
public static string DefaultAppointmentDescription = "Follow up in order to determine the effectiveness of treatment received";
public static int MinimumRoomNumber = 1;
public static int MaximumRoomNumber = 10;
public static string NonExistingFieldDefaultValue = "-";
// HockeyApp AppId
public static string HockeyAppiOSAppID = "YOUR_HOCKEY_APP_ID";
public static string iOSAppGroupIdentifier = "group.app.client.patients";
public static string iOSAppGroupDirectory = "messageDir";
public static bool OutlookIntegration = false;
public static SecuritySettings Security
{
get
{
if (OutlookIntegration)
return OutlookSettings;
else
return AADSettings;
}
}
static SecuritySettings AADSettings = new SecuritySettings()
{
ClientId = "YOUR_AAD_CLIENT_ID",
RedirectUri = new Uri("YOUR_AAD_REDIRECT_URI"),
Authority = "YOUR_AAD_AUTHORITY",
Scope = "https://graph.microsoft.com",
Domain = "YOUR_AAD_DOMAIN"
};
static SecuritySettings OutlookSettings = new SecuritySettings()
{
ClientId = "YOUR_OUTLOOK_CLIENT_ID",
RedirectUri = new Uri("YOUR_OUTLOOK_REDIRECT_URI"),
Authority = "YOUR_OUTLOOK_AUTHORITY",
Scope = "https://graph.microsoft.com/calendars.readwrite",
Domain = "YOUR_OUTLOOK_DOMAIN"
};
}
public class SecuritySettings
{
public string ClientId { get; set; }
public Uri RedirectUri { get; set; }
public string Authority { get; set; }
public string Scope { get; set; }
public string Domain { get; set; }
}
}
|
mit
|
C#
|
e9fb1bf1b04e361e8606fa99bbdc2e291e3721ad
|
Update DatabasesTool.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D
|
src/Core2D/UI/Avalonia/Dock/Tools/DatabasesTool.cs
|
src/Core2D/UI/Avalonia/Dock/Tools/DatabasesTool.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using DMC = Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Tools
{
/// <summary>
/// Databases view.
/// </summary>
public class DatabasesTool : DMC.Tool
{
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using DMC=Dock.Model.Controls;
namespace Core2D.UI.Avalonia.Dock.Tools
{
/// <summary>
/// Databases view.
/// </summary>
public class DatabasesTool : DMC.Tool
{
}
}
|
mit
|
C#
|
edddb9dfbd148f1b551dd1d1a2ba62a5e7b08f6b
|
Fix ToString for Automata with more than one accepting state
|
nlowe/EECS4100,nlowe/EECS4100
|
src/AutomataConverter/Automata.cs
|
src/AutomataConverter/Automata.cs
|
using System.Collections.Generic;
using System.Linq;
namespace AutomataConverter
{
public abstract class Automata
{
public readonly int Cardinality;
public readonly string ValidTokens;
public readonly IEnumerable<int> AcceptingStates;
public readonly int StartState;
public readonly Dictionary<int, IEnumerable<Transition>> TransitionMap;
protected Automata(int cardinality, string tokens, IEnumerable<int> acceptingStates, int startState, Dictionary<int, IEnumerable<Transition>> transitionMap)
{
Cardinality = cardinality;
ValidTokens = tokens;
AcceptingStates = acceptingStates.ToList();
StartState = startState;
TransitionMap = new Dictionary<int, IEnumerable<Transition>>();
foreach(var t in transitionMap)
{
TransitionMap.Add(t.Key, t.Value.ToList());
}
}
public override string ToString()
{
var states = string.Join(" ", AcceptingStates);
var transitions = string.Join("\n", TransitionMap.SelectMany(t => t.Value));
return $@"
{Cardinality}
{ValidTokens}
{AcceptingStates.Count()} {states}
{StartState}
{transitions}
".Trim();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace AutomataConverter
{
public abstract class Automata
{
public readonly int Cardinality;
public readonly string ValidTokens;
public readonly IEnumerable<int> AcceptingStates;
public readonly int StartState;
public readonly Dictionary<int, IEnumerable<Transition>> TransitionMap;
protected Automata(int cardinality, string tokens, IEnumerable<int> acceptingStates, int startState, Dictionary<int, IEnumerable<Transition>> transitionMap)
{
Cardinality = cardinality;
ValidTokens = tokens;
AcceptingStates = acceptingStates.ToList();
StartState = startState;
TransitionMap = new Dictionary<int, IEnumerable<Transition>>();
foreach(var t in transitionMap)
{
TransitionMap.Add(t.Key, t.Value.ToList());
}
}
public override string ToString()
{
var states = string.Join("\n", AcceptingStates);
var transitions = string.Join("\n", TransitionMap.SelectMany(t => t.Value));
return $@"
{Cardinality}
{ValidTokens}
{AcceptingStates.Count()} {states}
{StartState}
{transitions}
".Trim();
}
}
}
|
mit
|
C#
|
214393cd8c1b4c6cfe00fba5a5ada6de3070ab16
|
Put `DelegateMethodILEmitter` in a namespace (#1257)
|
gregkalapos/corert,shrah/corert,sandreenko/corert,gregkalapos/corert,sandreenko/corert,yizhang82/corert,mjp41/corert,yizhang82/corert,sandreenko/corert,yizhang82/corert,sandreenko/corert,tijoytom/corert,gregkalapos/corert,mjp41/corert,mjp41/corert,shrah/corert,tijoytom/corert,gregkalapos/corert,yizhang82/corert,shrah/corert,botaberg/corert,krytarowski/corert,kyulee1/corert,kyulee1/corert,krytarowski/corert,botaberg/corert,krytarowski/corert,mjp41/corert,krytarowski/corert,kyulee1/corert,tijoytom/corert,tijoytom/corert,shrah/corert,kyulee1/corert,botaberg/corert,mjp41/corert,botaberg/corert
|
src/Common/src/TypeSystem/IL/Stubs/DelegateMethodILEmitter.cs
|
src/Common/src/TypeSystem/IL/Stubs/DelegateMethodILEmitter.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Internal.TypeSystem;
using Debug = System.Diagnostics.Debug;
namespace Internal.IL.Stubs
{
public static class DelegateMethodILEmitter
{
public static MethodIL EmitIL(MethodDesc method)
{
Debug.Assert(method.OwningType.IsDelegate);
Debug.Assert(method.IsRuntimeImplemented);
if (method.Name == "BeginInvoke" || method.Name == "EndInvoke")
{
// BeginInvoke and EndInvoke are not supported on .NET Core
ILEmitter emit = new ILEmitter();
ILCodeStream codeStream = emit.NewCodeStream();
MethodDesc notSupportedExceptionHelper = method.Context.GetHelperEntryPoint("ThrowHelpers", "ThrowPlatformNotSupportedException");
codeStream.EmitCallThrowHelper(emit, notSupportedExceptionHelper);
return emit.Link();
}
if (method.Name == ".ctor")
{
TypeSystemContext context = method.Context;
ILEmitter emit = new ILEmitter();
TypeDesc delegateType = context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType;
MethodDesc objectCtorMethod = context.GetWellKnownType(WellKnownType.Object).GetDefaultConstructor();
FieldDesc functionPointerField = delegateType.GetKnownField("m_functionPointer");
FieldDesc firstParameterField = delegateType.GetKnownField("m_firstParameter");
ILCodeStream codeStream = emit.NewCodeStream();
codeStream.EmitLdArg(0);
codeStream.Emit(ILOpcode.call, emit.NewToken(objectCtorMethod));
codeStream.EmitLdArg(0);
codeStream.EmitLdArg(1);
codeStream.Emit(ILOpcode.stfld, emit.NewToken(firstParameterField));
codeStream.EmitLdArg(0);
codeStream.EmitLdArg(2);
codeStream.Emit(ILOpcode.stfld, emit.NewToken(functionPointerField));
codeStream.Emit(ILOpcode.ret);
return emit.Link();
}
return null;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Internal.IL;
using Internal.IL.Stubs;
using Internal.TypeSystem;
using Debug = System.Diagnostics.Debug;
public static class DelegateMethodILEmitter
{
public static MethodIL EmitIL(MethodDesc method)
{
Debug.Assert(method.OwningType.IsDelegate);
Debug.Assert(method.IsRuntimeImplemented);
if (method.Name == "BeginInvoke" || method.Name == "EndInvoke")
{
// BeginInvoke and EndInvoke are not supported on .NET Core
ILEmitter emit = new ILEmitter();
ILCodeStream codeStream = emit.NewCodeStream();
MethodDesc notSupportedExceptionHelper = method.Context.GetHelperEntryPoint("ThrowHelpers", "ThrowPlatformNotSupportedException");
codeStream.EmitCallThrowHelper(emit, notSupportedExceptionHelper);
return emit.Link();
}
if (method.Name == ".ctor")
{
TypeSystemContext context = method.Context;
ILEmitter emit = new ILEmitter();
TypeDesc delegateType = context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType;
MethodDesc objectCtorMethod = context.GetWellKnownType(WellKnownType.Object).GetDefaultConstructor();
FieldDesc functionPointerField = delegateType.GetKnownField("m_functionPointer");
FieldDesc firstParameterField = delegateType.GetKnownField("m_firstParameter");
ILCodeStream codeStream = emit.NewCodeStream();
codeStream.EmitLdArg(0);
codeStream.Emit(ILOpcode.call, emit.NewToken(objectCtorMethod));
codeStream.EmitLdArg(0);
codeStream.EmitLdArg(1);
codeStream.Emit(ILOpcode.stfld, emit.NewToken(firstParameterField));
codeStream.EmitLdArg(0);
codeStream.EmitLdArg(2);
codeStream.Emit(ILOpcode.stfld, emit.NewToken(functionPointerField));
codeStream.Emit(ILOpcode.ret);
return emit.Link();
}
return null;
}
}
|
mit
|
C#
|
d036c11d957dc6b4c2dc49f7149886bbc28269c9
|
Fix a bug in the unit tests.
|
dipeshc/BTDeploy
|
src/MonoTorrent.Tests/Client/InitialSeedingModeTest.cs
|
src/MonoTorrent.Tests/Client/InitialSeedingModeTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonoTorrent.Client.Messages.FastPeer;
using MonoTorrent.Client.Messages.Standard;
using MonoTorrent.Common;
using NUnit.Framework;
namespace MonoTorrent.Client
{
[TestFixture]
public class InitialSeedingModeTest
{
InitialSeedingMode Mode {
get { return Rig.Manager.Mode as InitialSeedingMode; }
}
TestRig Rig {
get; set;
}
[SetUp]
public void Setup()
{
Rig = TestRig.CreateSingleFile(Piece.BlockSize * 20, Piece.BlockSize * 2);
Rig.Manager.Bitfield.Not ();
Rig.Manager.Mode = new InitialSeedingMode(Rig.Manager);
}
[TearDown]
public void Teardown()
{
Rig.Dispose();
}
[Test]
public void SwitchingModesSendsHaves()
{
Rig.Manager.Peers.ConnectedPeers.Add(Rig.CreatePeer(true, true));
Rig.Manager.Peers.ConnectedPeers.Add(Rig.CreatePeer(true, false));
var peer = Rig.CreatePeer(true);
peer.BitField.SetAll(true);
Mode.HandlePeerConnected(peer, Direction.Incoming);
Mode.Tick(0);
Assert.IsTrue(Rig.Manager.Peers.ConnectedPeers[0].Dequeue() is HaveAllMessage, "#1");
BitfieldMessage m = (BitfieldMessage) Rig.Manager.Peers.ConnectedPeers[1].Dequeue();
Assert.IsTrue(m.BitField.AllTrue, "#2");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonoTorrent.Client.Messages.FastPeer;
using MonoTorrent.Client.Messages.Standard;
using MonoTorrent.Common;
using NUnit.Framework;
namespace MonoTorrent.Client
{
[TestFixture]
public class InitialSeedingModeTest
{
InitialSeedingMode Mode {
get { return Rig.Manager.Mode as InitialSeedingMode; }
}
TestRig Rig {
get; set;
}
[SetUp]
public void Setup()
{
Rig = TestRig.CreateSingleFile(Piece.BlockSize * 20, Piece.BlockSize * 2);
Rig.Manager.Mode = new InitialSeedingMode(Rig.Manager);
}
[TearDown]
public void Teardown()
{
Rig.Dispose();
}
[Test]
public void SwitchingModesSendsHaves()
{
Rig.Manager.Peers.ConnectedPeers.Add(Rig.CreatePeer(true, true));
Rig.Manager.Peers.ConnectedPeers.Add(Rig.CreatePeer(true, false));
var peer = Rig.CreatePeer(true);
peer.BitField.SetAll(true);
Mode.HandlePeerConnected(peer, Direction.Incoming);
Mode.Tick(0);
Assert.IsTrue(Rig.Manager.Peers.ConnectedPeers[0].Dequeue() is HaveAllMessage, "#1");
BitfieldMessage m = (BitfieldMessage) Rig.Manager.Peers.ConnectedPeers[1].Dequeue();
Assert.IsTrue(m.BitField.AllTrue, "#2");
}
}
}
|
mit
|
C#
|
ecec47bb4e9c15fc2c32e2d2cff18abb95d97fa1
|
Remove obsolete code
|
MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS
|
src/Package/Impl/DataInspect/VariableGridWindowPane.cs
|
src/Package/Impl/DataInspect/VariableGridWindowPane.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.R.Package.Windows;
using static System.FormattableString;
namespace Microsoft.VisualStudio.R.Package.DataInspect {
[Guid("3F6855E6-E2DB-46F2-9820-EDC794FE8AFE")]
internal sealed class VariableGridWindowPane : RToolWindowPane {
private VariableGridHost _gridHost;
public VariableGridWindowPane() {
Caption = Resources.VariableGrid_Caption;
Content = _gridHost = new VariableGridHost();
BitmapImageMoniker = KnownMonikers.VariableProperty;
}
internal void SetEvaluation(EvaluationWrapper evaluation) {
if (!string.IsNullOrWhiteSpace(evaluation.Expression)) {
Caption = Invariant($"{Resources.VariableGrid_Caption}: {evaluation.Expression}");
}
_gridHost.SetEvaluation(evaluation);
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Package.Windows;
using Microsoft.VisualStudio.R.Packages.R;
using Microsoft.VisualStudio.Shell.Interop;
using static System.FormattableString;
namespace Microsoft.VisualStudio.R.Package.DataInspect {
[Guid("3F6855E6-E2DB-46F2-9820-EDC794FE8AFE")]
internal sealed class VariableGridWindowPane : RToolWindowPane {
private VariableGridHost _gridHost;
public VariableGridWindowPane() {
Caption = Resources.VariableGrid_Caption;
Content = _gridHost = new VariableGridHost();
BitmapImageMoniker = KnownMonikers.VariableProperty;
VsAppShell.Current.DispatchOnUIThread(() => ((IVsWindowFrame)Frame).SetGuidProperty((int)__VSFPROPID.VSFPROPID_CmdUIGuid, RGuidList.RCmdSetGuid));
}
internal void SetEvaluation(EvaluationWrapper evaluation) {
if (!string.IsNullOrWhiteSpace(evaluation.Expression)) {
Caption = Invariant($"{Resources.VariableGrid_Caption}: {evaluation.Expression}");
}
_gridHost.SetEvaluation(evaluation);
}
}
}
|
mit
|
C#
|
fb5cf21e28767b0ea5c3f0350452ce344c95f1c2
|
Revert "Demo commit"
|
bhoeijmakers/PnP,bhoeijmakers/PnP,bhoeijmakers/PnP
|
Components/Core.PeoplePicker/Core.PeoplePickerWeb/PeoplePickerUser.cs
|
Components/Core.PeoplePicker/Core.PeoplePickerWeb/PeoplePickerUser.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace Contoso.Core.PeoplePickerWeb
{
[DataContract]
public class PeoplePickerUser
{
[DataMember]
internal int LookupId;
[DataMember]
internal string Login;
[DataMember]
internal string Name;
[DataMember]
internal string Email;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace Contoso.Core.PeoplePickerWeb
{
[DataContract]
public class PeoplePickerUser
{
[DataMember]
internal int LookupId;
[DataMember]
internal string Login;
[DataMember]
internal string Name;
[DataMember]
internal string Email;
[DataMember]
internal string Test;
}
}
|
apache-2.0
|
C#
|
813cd0e809917898cb012d49db2c757ede575282
|
handle absent claims principal on deserialization
|
buybackoff/IdentityServer3.EntityFramework,faithword/IdentityServer3.EntityFramework,IdentityServer/IdentityServer3.EntityFramework
|
Source/Core.EntityFramework/Serialization/ClaimsPrincipalConverter.cs
|
Source/Core.EntityFramework/Serialization/ClaimsPrincipalConverter.cs
|
/*
* Copyright 2014 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Newtonsoft.Json;
using System;
using System.Linq;
using System.Security.Claims;
namespace IdentityServer3.EntityFramework.Serialization
{
public class ClaimsPrincipalLite
{
public string AuthenticationType { get; set; }
public ClaimLite[] Claims { get; set; }
}
public class ClaimLite
{
public string Type { get; set; }
public string Value { get; set; }
}
public class ClaimsPrincipalConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(ClaimsPrincipal) == objectType;
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var source = serializer.Deserialize<ClaimsPrincipalLite>(reader);
if (source == null) return null;
var claims = source.Claims.Select(x => new Claim(x.Type, x.Value));
var id = new ClaimsIdentity(claims, source.AuthenticationType);
var target = new ClaimsPrincipal(id);
return target;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var source = (ClaimsPrincipal)value;
var target = new ClaimsPrincipalLite
{
AuthenticationType = source.Identity.AuthenticationType,
Claims = source.Claims.Select(x => new ClaimLite { Type = x.Type, Value = x.Value }).ToArray()
};
serializer.Serialize(writer, target);
}
}
}
|
/*
* Copyright 2014 Dominick Baier, Brock Allen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Newtonsoft.Json;
using System;
using System.Linq;
using System.Security.Claims;
namespace IdentityServer3.EntityFramework.Serialization
{
public class ClaimsPrincipalLite
{
public string AuthenticationType { get; set; }
public ClaimLite[] Claims { get; set; }
}
public class ClaimLite
{
public string Type { get; set; }
public string Value { get; set; }
}
public class ClaimsPrincipalConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(ClaimsPrincipal) == objectType;
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var source = serializer.Deserialize<ClaimsPrincipalLite>(reader);
var claims = source.Claims.Select(x => new Claim(x.Type, x.Value));
var id = new ClaimsIdentity(claims, source.AuthenticationType);
var target = new ClaimsPrincipal(id);
return target;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var source = (ClaimsPrincipal)value;
var target = new ClaimsPrincipalLite
{
AuthenticationType = source.Identity.AuthenticationType,
Claims = source.Claims.Select(x => new ClaimLite { Type = x.Type, Value = x.Value }).ToArray()
};
serializer.Serialize(writer, target);
}
}
}
|
apache-2.0
|
C#
|
dd8ce08b9eb4bc4c68ce2d7ac8fe38693c0a7103
|
Update server side API for single multiple answer question
|
Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist
|
Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs
|
Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs
|
using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.Models.Question;
using Promact.Trappist.Repository.Questions;
using System;
namespace Promact.Trappist.Core.Controllers
{
[Route("api/question")]
public class QuestionsController : Controller
{
private readonly IQuestionRepository _questionsRepository;
public QuestionsController(IQuestionRepository questionsRepository)
{
_questionsRepository = questionsRepository;
}
[HttpGet]
/// <summary>
/// Gets all questions
/// </summary>
/// <returns>Questions list</returns>
public IActionResult GetQuestions()
{
var questions = _questionsRepository.GetAllQuestions();
return Json(questions);
}
[HttpPost]
/// <summary>
/// Add single multiple answer question into SingleMultipleAnswerQuestion model
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <returns></returns>
public IActionResult AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleAnswerQuestion);
return Ok();
}
/// <summary>
/// Add options of single multiple answer question to SingleMultipleAnswerQuestionOption model
/// </summary>
/// <param name="singleMultipleAnswerQuestionOption"></param>
/// <returns></returns>
public IActionResult AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_questionsRepository.AddSingleMultipleAnswerQuestionOption(singleMultipleAnswerQuestionOption);
return Ok();
}
}
}
|
using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.Models.Question;
using Promact.Trappist.Repository.Questions;
using System;
namespace Promact.Trappist.Core.Controllers
{
[Route("api/question")]
public class QuestionsController : Controller
{
private readonly IQuestionRepository _questionsRepository;
public QuestionsController(IQuestionRepository questionsRepository)
{
_questionsRepository = questionsRepository;
}
[HttpGet]
/// <summary>
/// Gets all questions
/// </summary>
/// <returns>Questions list</returns>
public IActionResult GetQuestions()
{
var questions = _questionsRepository.GetAllQuestions();
return Json(questions);
}
[HttpPost]
/// <summary>
///
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <returns></returns>
public IActionResult AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleAnswerQuestion);
return Ok();
}
/// <summary>
///
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <returns></returns>
public IActionResult AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_questionsRepository.AddSingleMultipleAnswerQuestionOption(singleMultipleAnswerQuestionOption);
return Ok();
}
}
}
|
mit
|
C#
|
56d67edf6fb0032f24cf22bda90eb2964fd91b30
|
Update MergeCellsInNamedRange.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/CSharp/Data/AddOn/NamedRanges/MergeCellsInNamedRange.cs
|
Examples/CSharp/Data/AddOn/NamedRanges/MergeCellsInNamedRange.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class MergeCellsInNamedRange
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate a new Workbook.
Workbook wb1 = new Workbook();
//Get the first worksheet in the workbook.
Worksheet worksheet1 = wb1.Worksheets[0];
//Create a range.
Range mrange = worksheet1.Cells.CreateRange("A18", "J18");
//Name the range.
mrange.Name = "Details";
//Merge the cells of the range.
mrange.Merge();
//Get the range.
Range range1 = wb1.Worksheets.GetRangeByName("Details");
//Add a style object to the collection.
int i = wb1.Styles.Add();
//Define a style object.
Style style = wb1.Styles[i];
//Set the alignment.
style.HorizontalAlignment = TextAlignmentType.Center;
//Create a StyleFlag object.
StyleFlag flag = new StyleFlag();
//Make the relative style attribute ON.
flag.HorizontalAlignment = true;
//Apply the style to the range.
range1.ApplyStyle(style, flag);
//Input data into range.
range1[0, 0].PutValue("Aspose");
//Save the excel file.
wb1.Save(dataDir + "mergingrange.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class MergeCellsInNamedRange
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiate a new Workbook.
Workbook wb1 = new Workbook();
//Get the first worksheet in the workbook.
Worksheet worksheet1 = wb1.Worksheets[0];
//Create a range.
Range mrange = worksheet1.Cells.CreateRange("A18", "J18");
//Name the range.
mrange.Name = "Details";
//Merge the cells of the range.
mrange.Merge();
//Get the range.
Range range1 = wb1.Worksheets.GetRangeByName("Details");
//Add a style object to the collection.
int i = wb1.Styles.Add();
//Define a style object.
Style style = wb1.Styles[i];
//Set the alignment.
style.HorizontalAlignment = TextAlignmentType.Center;
//Create a StyleFlag object.
StyleFlag flag = new StyleFlag();
//Make the relative style attribute ON.
flag.HorizontalAlignment = true;
//Apply the style to the range.
range1.ApplyStyle(style, flag);
//Input data into range.
range1[0, 0].PutValue("Aspose");
//Save the excel file.
wb1.Save(dataDir + "mergingrange.out.xls");
}
}
}
|
mit
|
C#
|
55e2128b6fa3ae379d522edd7e3d74dff48e7cc1
|
Add web driver extensions (#5)
|
javnov/axe-selenium-csharp
|
Globant.Selenium.Axe/Globant.Selenium.Axe/WebDriverExtensions.cs
|
Globant.Selenium.Axe/Globant.Selenium.Axe/WebDriverExtensions.cs
|
using OpenQA.Selenium;
using System;
namespace Globant.Selenium.Axe
{
public static class WebDriverExtensions
{
public static AxeResult Analyze(this IWebDriver webDriver)
{
if (webDriver == null)
throw new ArgumentNullException(nameof(webDriver));
AxeBuilder axeBuilder = new AxeBuilder(webDriver);
return axeBuilder.Analyze();
}
public static AxeResult Analyze(this IWebDriver webDriver, IWebElement context)
{
if (webDriver == null)
throw new ArgumentNullException(nameof(webDriver));
if (context == null)
throw new ArgumentNullException(nameof(context));
AxeBuilder axeBuilder = new AxeBuilder(webDriver);
return axeBuilder.Analyze(context);
}
}
}
|
namespace Globant.Selenium.Axe
{
public static class WebDriverExtensions
{
}
}
|
mit
|
C#
|
2842d645b814171f861b070f6d5197bd1ee9dcb3
|
Update ForeignExchangeEntity.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Finance/ForeignExchange/Data/ForeignExchangeEntity.cs
|
TIKSN.Core/Finance/ForeignExchange/Data/ForeignExchangeEntity.cs
|
using System.Collections.Generic;
using TIKSN.Data;
namespace TIKSN.Finance.ForeignExchange.Data
{
public class ForeignExchangeEntity : IEntity<int>
{
public ForeignExchangeEntity()
{
ExchangeRates = new HashSet<ExchangeRateEntity>();
}
public int ID { get; set; }
public int LongNameKey { get; set; }
public int ShortNameKey { get; set; }
public string CountryCode { get; set; }
public virtual ICollection<ExchangeRateEntity> ExchangeRates { get; set; }
}
}
|
using System.Collections.Generic;
using TIKSN.Data;
namespace TIKSN.Finance.ForeignExchange.Data
{
public class ForeignExchangeEntity : IEntity<int>
{
public ForeignExchangeEntity()
{
ExchangeRates = new HashSet<ExchangeRateEntity>();
}
public int ID { get; set; }
public int LongNameKey { get; set; }
public int ShortNameKey { get; set; }
public string CountryCode { get; set; }
public virtual ICollection<ExchangeRateEntity> ExchangeRates { get; set; }
}
}
|
mit
|
C#
|
9d7245892dfef52530f1644115d6b4e41e93c2f9
|
Update TestSerilogLoggingSetup.cs
|
tiksn/TIKSN-Framework
|
TIKSN.UnitTests.Shared/DependencyInjection/TestSerilogLoggingSetup.cs
|
TIKSN.UnitTests.Shared/DependencyInjection/TestSerilogLoggingSetup.cs
|
using Serilog;
using TIKSN.Analytics.Logging.Serilog;
using Xunit.Abstractions;
namespace TIKSN.DependencyInjection.Tests
{
public class TestSerilogLoggingSetup : SerilogLoggingSetupBase
{
private readonly ITestOutputHelper _testOutputHelper;
public TestSerilogLoggingSetup(ITestOutputHelper testOutputHelper) : base() => this._testOutputHelper = testOutputHelper;
protected override void SetupSerilog()
{
base.SetupSerilog();
_ = this._loggerConfiguration.WriteTo.TestOutput(this._testOutputHelper);
}
}
}
|
using Serilog;
using TIKSN.Analytics.Logging.Serilog;
using Xunit.Abstractions;
namespace TIKSN.DependencyInjection.Tests
{
public class TestSerilogLoggingSetup : SerilogLoggingSetupBase
{
private readonly ITestOutputHelper _testOutputHelper;
public TestSerilogLoggingSetup(ITestOutputHelper testOutputHelper) : base()
{
_testOutputHelper = testOutputHelper;
}
protected override void SetupSerilog()
{
base.SetupSerilog();
_loggerConfiguration.WriteTo.TestOutput(_testOutputHelper);
}
}
}
|
mit
|
C#
|
97dd15b1d37436f5bc40d422b41deac6d6646eff
|
Modify File userAuth/Droid/Resources/AltActivity.cs
|
ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate,ARCNanotech/userAuthenticate
|
userAuth/Droid/Resources/AltActivity.cs
|
userAuth/Droid/Resources/AltActivity.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace userAuth.Droid
{
[BroadcastReceiver (Label = "userAuth.Droid", Icon = "@drawable/icon", AltLauncher = true, EnvironmentChnages = envChanges.DisplaySize | envChanges.Orientation)]
public class AltActivity : global::userAuth.Assets.App.Droid.AssetsPlatformTask
{
public override void OnReceive(Context context, Intent intent)
{
object.onCLick(AsyncTask);
frameHasCAseElement(); const1 EventHandler; array; frame_count; }
public sealed enum FrameCallBackElement { method_array_instrument = EnvironmentVariableTarget(ConsoleKey(f5))()
{ meta:object(hasownproperty): static(in frame):
while ( EnvironmentVariableTarget.(instance ) {
for(DroidInitUI.Equals): meta::Object(Console) {
}
Toast.MakeText (context, "Received intent!", ToastLength.Short).Show ();
}
public override void onOperand
.phys() { const Intent(ConditionVariable| SharedElementCallback ) ( int
};
}
public class DroidInitUI : AsyncTask::meta
{
byte param, frame = Buffer.GetByte(BitConverter, array, int, index);
},
, from DroidInitUI.frame (Console array, bool )
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace userAuth.Droid
{
[BroadcastReceiver (Label = "userAuth.Droid", Icon = "@drawable/icon", AltLauncher = true, EnvironmentChnages = envChanges.DisplaySize | envChanges.Orientation)]
public class AltActivity : global::userAuth.Assets.App.Droid.AssetsPlatformTask
{
public override void OnReceive (Context context, Intent intent)
{
object.onCLick (AsyncTask);
frameHasCAseElement(const: frmae_count)
public sealed enum FrameCallBackElement ()
{ meta:object(hasownproperty): static(in frame):
while ( EnvironmentVariableTarget.(instance ) {
for(DroidInitUI.Equals): meta::Object(Console) {
}
Toast.MakeText (context, "Received intent!", ToastLength.Short).Show ();
}
public override void onOperand
.phys() { const Intent(ConditionVariable| SharedElementCallback ) ( int
};
}
public class DroidInitUI : AsyncTask::meta
{
byte param::init
}
}
|
mit
|
C#
|
f44489c59d4e4cf918a3f6171e366e1322dd29ee
|
Add check if a file supports animations
|
agens-no/iMessageStickerUnity
|
Assets/Stickers/Editor/StickerEditorUtility.cs
|
Assets/Stickers/Editor/StickerEditorUtility.cs
|
using System.Globalization;
namespace Agens.Stickers
{
public static class StickerEditorUtility
{
/// <summary>
/// Checks the file extension of a filename
/// </summary>
/// <param name="fileName">filename with extension or full path of a file</param>
/// <returns>True if the file type is supported for stickers</returns>
public static bool HasValidFileExtension(string fileName)
{
var s = fileName.ToLower(CultureInfo.InvariantCulture);
return s.EndsWith(".png") || s.EndsWith(".gif") || s.EndsWith(".jpg") || s.EndsWith(".jpeg");
}
/// <summary>
/// Creates a readable string in Bytes or KiloBytes of a file
/// 1 kB is 1000B in this case
/// </summary>
/// <param name="size">File size in byte</param>
/// <returns>File size with fitting units</returns>
public static string GetFileSizeString(long size)
{
if (size < 1000)
{
return size.ToString() + "B";
}
else
{
return (size / 1000L).ToString() + " kB";
}
}
/// <summary>
/// Checks if the filetype is an animated file or not.
/// Supported file checks: .gif
/// </summary>
/// <param name="filePath">Path to the file or filename</param>
/// <returns>True if the file type supports animations</returns>
public static bool IsAnimatedTexture(string filePath)
{
var s = filePath.ToLower(CultureInfo.InvariantCulture);
return s.EndsWith(".gif");
}
}
}
|
using System.Globalization;
namespace Agens.Stickers
{
public static class StickerEditorUtility
{
/// <summary>
/// Checks the file extension of a filename
/// </summary>
/// <param name="fileName">filename with extension or full path of a file</param>
/// <returns>True if the file type is supported for stickers</returns>
public static bool HasValidFileExtension(string fileName)
{
var s = fileName.ToLower(CultureInfo.InvariantCulture);
return s.EndsWith(".png") || s.EndsWith(".gif") || s.EndsWith(".jpg") || s.EndsWith(".jpeg");
}
/// <summary>
/// Creates a readable string in Bytes or KiloBytes of a file
/// 1 kB is 1000B in this case
/// </summary>
/// <param name="size">File size in byte</param>
/// <returns>File size with fitting units</returns>
public static string GetFileSizeString(long size)
{
if (size < 1000)
{
return size.ToString() + "B";
}
else
{
return (size / 1000L).ToString() + " kB";
}
}
}
}
|
mit
|
C#
|
2cdc133a2001487cbc944c537e2a6c7b9ca0f970
|
remove unnecessary debug log.
|
hecomi/uREPL
|
Assets/uREPL/Scripts/GuiParts/ComponentItem.cs
|
Assets/uREPL/Scripts/GuiParts/ComponentItem.cs
|
using UnityEngine;
using UnityEngine.UI;
namespace uREPL
{
public class ComponentItem : MonoBehaviour
{
[HideInInspector]
public Component component;
public Toggle toggle;
public GameObject checkbox;
public Text nameText;
public Transform fieldsView;
public GameObject noAvailableFieldText;
public string title
{
get { return nameText.text; }
set { nameText.text = value; }
}
public System.Type type
{
get { return component.GetType(); }
}
public bool hasEnabled
{
get { return component && type.GetProperty("enabled") != null; }
}
public void Add(GameObject field)
{
noAvailableFieldText.SetActive(false);
field.transform.SetParent(fieldsView);
}
void Start()
{
toggle.onValueChanged.AddListener(OnValueChanged);
}
void OnDestroy()
{
toggle.onValueChanged.RemoveListener(OnValueChanged);
}
void Update()
{
if (hasEnabled) {
toggle.isOn = (bool)type.GetProperty("enabled").GetValue(component, null);
checkbox.SetActive(true);
} else {
checkbox.SetActive(false);
}
}
void OnValueChanged(bool isOn)
{
if (hasEnabled) {
type.GetProperty("enabled").SetValue(component, isOn, null);
}
}
}
}
|
using UnityEngine;
using UnityEngine.UI;
namespace uREPL
{
public class ComponentItem : MonoBehaviour
{
[HideInInspector]
public Component component;
public Toggle toggle;
public GameObject checkbox;
public Text nameText;
public Transform fieldsView;
public GameObject noAvailableFieldText;
public string title
{
get { return nameText.text; }
set { nameText.text = value; }
}
public System.Type type
{
get { return component.GetType(); }
}
public bool hasEnabled
{
get { return component && type.GetProperty("enabled") != null; }
}
public void Add(GameObject field)
{
noAvailableFieldText.SetActive(false);
field.transform.SetParent(fieldsView);
}
void Start()
{
toggle.onValueChanged.AddListener(OnValueChanged);
}
void OnDestroy()
{
toggle.onValueChanged.RemoveListener(OnValueChanged);
}
void Update()
{
if (hasEnabled) {
toggle.isOn = (bool)type.GetProperty("enabled").GetValue(component, null);
checkbox.SetActive(true);
} else {
checkbox.SetActive(false);
}
Debug.Log(type.GetProperty("enabled"));
}
void OnValueChanged(bool isOn)
{
if (hasEnabled) {
type.GetProperty("enabled").SetValue(component, isOn, null);
}
}
}
}
|
mit
|
C#
|
918f277921e4d58a2021e51fd5bdfe74121ca2b8
|
Add Id to Item.
|
wangjun/windows-app,wangjun/windows-app
|
wallabag/wallabag.Shared/Models/Item.cs
|
wallabag/wallabag.Shared/Models/Item.cs
|
using System;
namespace wallabag.Models
{
public class Item
{
public string Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public Uri Url { get; set; }
public bool IsRead { get; set; }
public bool IsFavourite { get; set; }
}
}
|
using System;
using SQLite;
namespace wallabag.Models
{
[Table("Items")]
public class Item
{
public string Title { get; set; }
public string Content { get; set; }
public Uri Url { get; set; }
public bool IsRead { get; set; }
public bool IsFavourite { get; set; }
}
}
|
mit
|
C#
|
a39ab63b6d2e9d219e55aaec708d4b493a9be2b3
|
Fix catch block in Main
|
lou1306/CIV,lou1306/CIV
|
CIV/Program.cs
|
CIV/Program.cs
|
using System;
using System.Diagnostics;
using CIV.Formats;
using CIV.Common;
using static System.Console;
namespace CIV
{
[Flags]
enum ExitCodes : int
{
Success = 0,
FileNotFound = 1,
ParsingFailed = 2,
VerificationFailed = 4
}
class Program
{
static void Main(string[] args)
{
try
{
var project = new Caal().Load(args[0]);
VerifyAll(project);
}
catch (Exception ex)
{
ForegroundColor = ConsoleColor.Red;
WriteLine("An error has occurred:");
WriteLine(ex.Message);
ResetColor();
Environment.Exit((int)ExitCodes.FileNotFound);
}
}
static void VerifyAll(Caal project)
{
WriteLine("Loaded project {0}. Starting verification...", project.Name);
var sw = new Stopwatch();
sw.Start();
foreach (var kv in project.Formulae)
{
Write($"{kv.Value} |= {kv.Key}...");
Out.Flush();
var isSatisfied = kv.Key.Check(kv.Value);
ForegroundColor = isSatisfied ? ConsoleColor.Green : ConsoleColor.Red;
var result = isSatisfied ? "Success!" : "Failure";
Write($"\t{result}");
WriteLine();
ResetColor();
}
sw.Stop();
WriteLine($"Completed in {sw.Elapsed.TotalMilliseconds} ms.");
}
}
}
|
using System;
using System.Diagnostics;
using CIV.Formats;
using static System.Console;
namespace CIV
{
[Flags]
enum ExitCodes : int
{
Success = 0,
FileNotFound = 1,
ParsingFailed = 2,
VerificationFailed = 4
}
class Program
{
static void Main(string[] args)
{
try
{
var project = new Caal().Load(args[0]);
VerifyAll(project);
}
catch (System.IO.FileNotFoundException ex)
{
ForegroundColor = ConsoleColor.Red;
WriteLine(ex.Message);
ResetColor();
Environment.Exit((int)ExitCodes.FileNotFound);
}
}
static void VerifyAll(Caal project)
{
WriteLine("Loaded project {0}. Starting verification...", project.Name);
var sw = new Stopwatch();
sw.Start();
foreach (var kv in project.Formulae)
{
Write($"{kv.Value} |= {kv.Key}...");
Out.Flush();
var isSatisfied = kv.Key.Check(kv.Value);
ForegroundColor = isSatisfied ? ConsoleColor.Green : ConsoleColor.Red;
var result = isSatisfied ? "Success!" : "Failure";
Write($"\t{result}");
WriteLine();
ResetColor();
}
sw.Stop();
WriteLine($"Completed in {sw.Elapsed.TotalMilliseconds} ms.");
}
}
}
|
mit
|
C#
|
0be830173ef3aadff9bf7472a147b14e5cbafab6
|
Increase version.
|
DartVS/DartVS,modulexcite/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS
|
DanTup.DartAnalysis/Properties/AssemblyInfo.cs
|
DanTup.DartAnalysis/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyProduct("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyCompany("Danny Tuppeny")]
[assembly: AssemblyCopyright("Copyright Danny Tuppeny © 2014")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyInformationalVersion("0.1.9-alpha")]
[assembly: InternalsVisibleTo("DanTup.DartAnalysis.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyProduct("DartAnalysis.NET: A .NET wrapper around Google's Analysis Server for Dart.")]
[assembly: AssemblyCompany("Danny Tuppeny")]
[assembly: AssemblyCopyright("Copyright Danny Tuppeny © 2014")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyInformationalVersion("0.1.8-alpha")]
[assembly: InternalsVisibleTo("DanTup.DartAnalysis.Tests")]
|
mit
|
C#
|
9530bd5a48c8119e0042c38c83b311c4659d8155
|
Update BlogManager App Drawer With New Route
|
tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS
|
Portal.CMS.Web/Areas/Admin/Views/BlogManager/_AppDrawer.cshtml
|
Portal.CMS.Web/Areas/Admin/Views/BlogManager/_AppDrawer.cshtml
|
@model Portal.CMS.Web.Areas.Admin.ViewModels.BlogManager.AppDrawerViewModel
@{
Layout = "";
}
<div id="blog-manager-panel" class="panel-overlay animated fadeInRight">
<div class="panel-title">
<h4>Blog Manager</h4>
<div class="panel-action right" onclick="ClosePanels();"><span class="fa fa-remove"></span></div>
</div>
<div class="panel-inner">
<a href="@Url.Action("Create", "BlogManager", new { area = "Admin" })" class="btn primary launch-modal" data-title="New Blog Post" style="font-size: 15px;"><span class="fa fa-plus"></span>New</a>
<a href="@Url.Action("Index", "BlogManager", new { area = "Admin" })" class="btn" style="font-size: 15px;"><span class="fa fa-th-list"></span>Blog Manager</a>
<div class="tab-content" style="padding-top: 5px; padding-right: 5px; padding-left: 5px; border: 0; max-height: 74vh;">
@foreach (var post in Model.PostList)
{
<a class="col-xs-12" href="@Url.Action("Index", "Read", new { area = "Blog", id = @post.PostId })" style="padding-left: 0; padding-right: 0;">
<div class="box article-item float-container" style="@string.Format("background-image: url('{0}'); color: white;", post.BannerImageUrl())">
<div class="inner">
<div class="category-item"><span class="fa fa-tag"></span>@post.PostCategory.PostCategoryName</div>
<div title="Views" class="hidden-xs category-item"><span class="fa fa-users"></span>@post.PostViews.Count()</div>
<div title="Comments" class="hidden-xs category-item"><span class="fa fa-comment"></span>@post.PostComments.Count()</div>
<h3>@post.PostTitle</h3>
<p>@post.PostDescription</p>
</div>
<div class="overlay-medium"></div>
</div>
</a>
}
</div>
</div>
</div>
|
@model Portal.CMS.Web.Areas.Admin.ViewModels.BlogManager.AppDrawerViewModel
@{
Layout = "";
}
<div id="blog-manager-panel" class="panel-overlay animated fadeInRight">
<div class="panel-title">
<h4>Blog Manager</h4>
<div class="panel-action right" onclick="ClosePanels();"><span class="fa fa-remove"></span></div>
</div>
<div class="panel-inner">
<a href="@Url.Action("Create", "BlogManager", new { area = "Admin" })" class="btn primary launch-modal" data-title="New Blog Post" style="font-size: 15px;"><span class="fa fa-plus"></span>New</a>
<a href="@Url.Action("Index", "BlogManager", new { area = "Admin" })" class="btn" style="font-size: 15px;"><span class="fa fa-th-list"></span>Blog Manager</a>
<div class="tab-content" style="padding-top: 5px; padding-right: 5px; padding-left: 5px; border: 0; max-height: 74vh;">
@foreach (var post in Model.PostList)
{
<a class="col-xs-12" href="@Url.Action("Index", "Blog", new { area = "", id = @post.PostId })" style="padding-left: 0; padding-right: 0;">
<div class="box article-item float-container" style="@string.Format("background-image: url('{0}'); color: white;", post.BannerImageUrl())">
<div class="inner">
<div class="category-item"><span class="fa fa-tag"></span>@post.PostCategory.PostCategoryName</div>
<div title="Views" class="hidden-xs category-item"><span class="fa fa-users"></span>@post.PostViews.Count()</div>
<div title="Comments" class="hidden-xs category-item"><span class="fa fa-comment"></span>@post.PostComments.Count()</div>
<h3>@post.PostTitle</h3>
<p>@post.PostDescription</p>
</div>
<div class="overlay-medium"></div>
</div>
</a>
}
</div>
</div>
</div>
|
mit
|
C#
|
1f0a81d586bfb502da9a2e9c7eb34442349696b7
|
Refactor Detection Collection Extensions
|
wangkanai/Detection
|
src/DependencyInjection/DetectionCollectionExtensions.cs
|
src/DependencyInjection/DetectionCollectionExtensions.cs
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using Wangkanai.Detection.DependencyInjection.Options;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Contains extension method to <see cref="IServiceCollection" /> for configuring client services.
/// </summary>
public static class DetectionCollectionExtensions
{
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <param name="setAction">An <see cref="Action{DetectionOptions}"/> to configure the provided <see cref="DetectionOptions"/>.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services, Action<DetectionOptions> setAction)
=> services.Configure(setAction)
.AddDetection();
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services)
=> services.AddDetectionBuilder()
.AddRequiredPlatformServices()
.AddCoreServices()
.AddSessionServices()
.AddResponsiveService()
.AddMarkerService();
internal static IDetectionBuilder AddDetectionBuilder(this IServiceCollection services)
=> new DetectionBuilder(services);
}
}
|
// Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
using System;
using Wangkanai.Detection.DependencyInjection.Options;
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Contains extension method to <see cref="IServiceCollection" /> for configuring client services.
/// </summary>
public static class DetectionCollectionExtensions
{
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <param name="setAction">An <see cref="Action{DetectionOptions}"/> to configure the provided <see cref="DetectionOptions"/>.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services, Action<DetectionOptions> setAction)
{
services.Configure(setAction);
return services.AddDetection();
}
/// <summary>
/// Add Detection Service to the services container.
/// </summary>
/// <param name="services">The services available in the application.</param>
/// <returns>An <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IDetectionBuilder AddDetection(this IServiceCollection services)
{
var builder = services.AddDetectionBuilder();
builder.AddRequiredPlatformServices();
builder.AddCoreServices();
builder.AddSessionServices();
builder.AddResponsiveService();
builder.AddMarkerService();
return builder;
}
internal static IDetectionBuilder AddDetectionBuilder(this IServiceCollection services)
=> new DetectionBuilder(services);
}
}
|
apache-2.0
|
C#
|
3d3991f847158cc55678d1b432bcb4283244ec51
|
Remove unused delegate definition
|
weblinq/WebLinq,weblinq/WebLinq,atifaziz/WebLinq,atifaziz/WebLinq
|
src/Core/Collections/Map.cs
|
src/Core/Collections/Map.cs
|
#region Copyright (c) 2016 Atif Aziz. 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.
//
#endregion
namespace WebLinq.Collections
{
using System.Collections.Generic;
public sealed class Map<TKey, TValue> : MapBase<TKey, TValue>
{
public static Map<TKey, TValue> Empty = new Map<TKey, TValue>(null);
readonly Map<TKey, TValue> _link;
public Map(IEqualityComparer<TKey> comparer) :
base(comparer) {}
public Map(Map<TKey, TValue> link, TKey key, TValue value, IEqualityComparer<TKey> comparer) :
base(key, value, comparer ?? link?.Comparer) { _link = link; }
public Map<TKey, TValue> WithComparer(IEqualityComparer<TKey> comparer) =>
new Map<TKey, TValue>(_link, Key, Value, comparer);
public Map<TKey, TValue> Set(KeyValuePair<TKey, TValue> pair) =>
Set(pair.Key, pair.Value);
public Map<TKey, TValue> Set(TKey key, TValue value) =>
new Map<TKey, TValue>(this, key, value, null);
public Map<TKey, TValue> Remove(TKey key) =>
RemoveCore(Empty, key, (map, k, v) => map.Set(k, v));
public override bool IsEmpty => _link == null;
protected override IEnumerable<KeyValuePair<TKey, TValue>> Nodes =>
GetNodesCore(this, m => m._link);
}
}
|
#region Copyright (c) 2016 Atif Aziz. 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.
//
#endregion
namespace WebLinq.Collections
{
using System.Collections.Generic;
public delegate IDictionary<TKey, TValue> MapMaker<TKey, TValue>(IDictionary<TKey, TValue> dictionary);
public sealed class Map<TKey, TValue> : MapBase<TKey, TValue>
{
public static Map<TKey, TValue> Empty = new Map<TKey, TValue>(null);
readonly Map<TKey, TValue> _link;
public Map(IEqualityComparer<TKey> comparer) :
base(comparer) {}
public Map(Map<TKey, TValue> link, TKey key, TValue value, IEqualityComparer<TKey> comparer) :
base(key, value, comparer ?? link?.Comparer) { _link = link; }
public Map<TKey, TValue> WithComparer(IEqualityComparer<TKey> comparer) =>
new Map<TKey, TValue>(_link, Key, Value, comparer);
public Map<TKey, TValue> Set(KeyValuePair<TKey, TValue> pair) =>
Set(pair.Key, pair.Value);
public Map<TKey, TValue> Set(TKey key, TValue value) =>
new Map<TKey, TValue>(this, key, value, null);
public Map<TKey, TValue> Remove(TKey key) =>
RemoveCore(Empty, key, (map, k, v) => map.Set(k, v));
public override bool IsEmpty => _link == null;
protected override IEnumerable<KeyValuePair<TKey, TValue>> Nodes =>
GetNodesCore(this, m => m._link);
}
}
|
apache-2.0
|
C#
|
f8f4a486fd02b73aa602362e8ee2e1ad2361d17b
|
Change service extension return type
|
toddams/RazorLight,toddams/RazorLight
|
src/RazorLight/Extensions/ServiceCollectionExtensions.cs
|
src/RazorLight/Extensions/ServiceCollectionExtensions.cs
|
using System;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using RazorLight.Caching;
using RazorLight.Compilation;
using RazorLight.DependencyInjection;
using RazorLight.Generation;
using RazorLight.Razor;
namespace RazorLight.Extensions
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddRazorLight(this IServiceCollection services, Func<IRazorLightEngine> engineFactoryProvider)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (engineFactoryProvider == null)
{
throw new ArgumentNullException(nameof(engineFactoryProvider));
}
services.AddSingleton<PropertyInjector>();
services.TryAddSingleton<IEngineHandler>(p =>
throw new InvalidOperationException($"This exception can only occur if you inject {nameof(IEngineHandler)} directly using {nameof(ServiceCollectionExtensions)}.{nameof(AddRazorLight)}"));
services.TryAddSingleton<IRazorLightEngine>(p =>
{
var engine = engineFactoryProvider();
AddEngineRenderCallbacks(engine, p);
return engine;
});
return services;
}
public static RazorLightDependencyBuilder AddRazorLight(this IServiceCollection services)
{
services = services ?? throw new ArgumentNullException(nameof(services));
services.AddOptions().Configure<RazorLightOptions>((options) =>
{
options.OperatingAssembly = options.OperatingAssembly ?? Assembly.GetEntryAssembly();
});
services.TryAddSingleton<PropertyInjector>();
services.TryAddSingleton<ICachingProvider, MemoryCachingProvider>();
services.TryAddSingleton<RazorEngine>(DefaultRazorEngine.Instance);
services.TryAddSingleton<RazorSourceGenerator>();
services.TryAddSingleton<IRazorTemplateCompiler, RazorTemplateCompiler>();
services.TryAddSingleton<ITemplateFactoryProvider, TemplateFactoryProvider>();
services.TryAddSingleton<IMetadataReferenceManager, DefaultMetadataReferenceManager>();
services.TryAddSingleton<ICompilationService, RoslynCompilationService>();
services.TryAddSingleton<IEngineHandler, EngineHandler>();
services.TryAddSingleton<IRazorLightEngine, RazorLightEngine>();
RazorLightDependencyBuilder builder = new RazorLightDependencyBuilder(services);
return builder;
}
private static void AddEngineRenderCallbacks(IRazorLightEngine engine, IServiceProvider services)
{
var injector = services.GetRequiredService<PropertyInjector>();
engine.Options.PreRenderCallbacks.Add(template => injector.Inject(template));
}
}
}
|
using System;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using RazorLight.Caching;
using RazorLight.Compilation;
using RazorLight.DependencyInjection;
using RazorLight.Generation;
using RazorLight.Razor;
namespace RazorLight.Extensions
{
public static class ServiceCollectionExtensions
{
public static void AddRazorLight(this IServiceCollection services, Func<IRazorLightEngine> engineFactoryProvider)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
if (engineFactoryProvider == null)
{
throw new ArgumentNullException(nameof(engineFactoryProvider));
}
services.AddSingleton<PropertyInjector>();
services.TryAddSingleton<IEngineHandler>(p =>
throw new InvalidOperationException($"This exception can only occur if you inject {nameof(IEngineHandler)} directly using {nameof(ServiceCollectionExtensions)}.{nameof(AddRazorLight)}"));
services.TryAddSingleton<IRazorLightEngine>(p =>
{
var engine = engineFactoryProvider();
AddEngineRenderCallbacks(engine, p);
return engine;
});
}
public static RazorLightDependencyBuilder AddRazorLight(this IServiceCollection services)
{
services = services ?? throw new ArgumentNullException(nameof(services));
services.AddOptions().Configure<RazorLightOptions>((options) =>
{
options.OperatingAssembly = options.OperatingAssembly ?? Assembly.GetEntryAssembly();
});
services.TryAddSingleton<PropertyInjector>();
services.TryAddSingleton<ICachingProvider, MemoryCachingProvider>();
services.TryAddSingleton<RazorEngine>(DefaultRazorEngine.Instance);
services.TryAddSingleton<RazorSourceGenerator>();
services.TryAddSingleton<IRazorTemplateCompiler, RazorTemplateCompiler>();
services.TryAddSingleton<ITemplateFactoryProvider, TemplateFactoryProvider>();
services.TryAddSingleton<IMetadataReferenceManager, DefaultMetadataReferenceManager>();
services.TryAddSingleton<ICompilationService, RoslynCompilationService>();
services.TryAddSingleton<IEngineHandler, EngineHandler>();
services.TryAddSingleton<IRazorLightEngine, RazorLightEngine>();
RazorLightDependencyBuilder builder = new RazorLightDependencyBuilder(services);
return builder;
}
private static void AddEngineRenderCallbacks(IRazorLightEngine engine, IServiceProvider services)
{
var injector = services.GetRequiredService<PropertyInjector>();
engine.Options.PreRenderCallbacks.Add(template => injector.Inject(template));
}
}
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.