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 |
---|---|---|---|---|---|---|---|---|
84c6f9a068265cb8354f9c82bef8de14f7a8cd84 | Fix for the api_results FK collision. | HristoKolev/TrackTV,HristoKolev/TrackTV,HristoKolev/TrackTV,HristoKolev/TrackTV,HristoKolev/TrackTV | src/TrackTv.Updater/ApiResultRepository.cs | src/TrackTv.Updater/ApiResultRepository.cs | namespace TrackTv.Updater
{
using System;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using TrackTv.Data;
public class ApiResultRepository
{
public ApiResultRepository(IDbService dbService)
{
this.DbService = dbService;
}
private IDbService DbService { get; }
public Task SaveApiResult(object jsonObj, ApiChangeType type, int thetvdbid)
{
int apiResponseID = this.DbService.ApiResponses
.Where(poco =>
(type == ApiChangeType.Show && poco.ApiResponseShowThetvdbid == thetvdbid) ||
(type == ApiChangeType.Episode && poco.ApiResponseEpisodeThetvdbid == thetvdbid))
.Select(poco => poco.ApiResponseID)
.FirstOrDefault();
var result = new ApiResponsePoco
{
ApiResponseID = apiResponseID,
ApiResponseBody = JsonConvert.SerializeObject(jsonObj),
ApiResponseLastUpdated = DateTime.UtcNow,
};
switch (type)
{
case ApiChangeType.Show :
result.ApiResponseShowThetvdbid = thetvdbid;
break;
case ApiChangeType.Episode :
result.ApiResponseEpisodeThetvdbid = thetvdbid;
break;
default :
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
return this.DbService.Save(result);
}
}
} | namespace TrackTv.Updater
{
using System;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using TrackTv.Data;
public class ApiResultRepository
{
public ApiResultRepository(IDbService dbService)
{
this.DbService = dbService;
}
private IDbService DbService { get; }
public Task SaveApiResult(object jsonObj, ApiChangeType type, int thetvdbid)
{
int apiResponseID = this.DbService.ApiResponses
.Where(poco =>
poco.ApiResponseShowThetvdbid == thetvdbid || poco.ApiResponseEpisodeThetvdbid == thetvdbid)
.Select(poco => poco.ApiResponseID)
.FirstOrDefault();
var result = new ApiResponsePoco
{
ApiResponseID = apiResponseID,
ApiResponseBody = JsonConvert.SerializeObject(jsonObj),
ApiResponseLastUpdated = DateTime.UtcNow,
};
switch (type)
{
case ApiChangeType.Show :
result.ApiResponseShowThetvdbid = thetvdbid;
break;
case ApiChangeType.Episode :
result.ApiResponseEpisodeThetvdbid = thetvdbid;
break;
default :
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
return this.DbService.Save(result);
}
}
} | mit | C# |
0a1dc29bd2fb010d2a98e0415df239ad8c96f580 | Add documentation | sguertl/Flying_Pi,sguertl/Flying_Pi,sguertl/Flying_Pi,sguertl/Flying_Pi | Dronection/Android/WiFi/WiFiDronection/WiFiDronection/CurrentVisualizationData.cs | Dronection/Android/WiFi/WiFiDronection/WiFiDronection/CurrentVisualizationData.cs | using System.Collections.Generic;
namespace WiFiDronection
{
public class CurrentVisualizationData
{
// List of data points
private Dictionary<string,List<DataPoint>> mPoints;
public Dictionary<string, List<DataPoint>> Points
{
get { return mPoints; }
set { mPoints = value; }
}
// Altitude control points
private List<float> mAltControlTime;
public List<float> AltControlTime
{
get { return mAltControlTime; }
set { mAltControlTime = value; }
}
/// <summary>
/// Singleton pattern
/// </summary>
private static CurrentVisualizationData instance = null;
private static readonly object padlock = new object();
/// <summary>
/// Private constructor
/// </summary>
private CurrentVisualizationData() {
this.mPoints = new Dictionary<string, List<DataPoint>>();
this.AltControlTime = new List<float>();
}
/// <summary>
/// Returns the instance.
/// </summary>
/// <value>Instance of CurrentVisualizationData</value>
public static CurrentVisualizationData Instance
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new CurrentVisualizationData();
}
return instance;
}
}
}
}
} | using System.Collections.Generic;
namespace WiFiDronection
{
public class CurrentVisualisatonData
{
private Dictionary<string,List<DataPoint>> m_Points;
private List<float> m_HighContTime;
public List<float> HighContTime
{
get { return m_HighContTime; }
set { m_HighContTime = value; }
}
public Dictionary<string, List<DataPoint>> Points
{
get { return m_Points; }
set { m_Points = value; }
}
/// <summary>
/// Singleton
/// </summary>
private static CurrentVisualisatonData instance = null;
private static readonly object padlock = new object();
private CurrentVisualisatonData() {
this.m_Points = new Dictionary<string, List<DataPoint>>();
this.HighContTime = new List<float>();
}
public static CurrentVisualisatonData Instance
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new CurrentVisualisatonData();
}
return instance;
}
}
}
}
} | apache-2.0 | C# |
7fa937d860f45326561c91c7af43add064db4dfb | Fix implementation for calendar-all-requests. | henrikfroehling/TraktApiSharp | Source/Lib/TraktApiSharp/Requests/WithOAuth/Calendars/TraktCalendarUserRequest.cs | Source/Lib/TraktApiSharp/Requests/WithOAuth/Calendars/TraktCalendarUserRequest.cs | namespace TraktApiSharp.Requests.WithOAuth.Calendars
{
using Base.Get;
using Extensions;
using System;
using System.Collections.Generic;
internal abstract class TraktCalendarUserRequest<T> : TraktGetRequest<IEnumerable<T>, T>
{
internal TraktCalendarUserRequest(TraktClient client) : base(client) { }
internal DateTime? StartDate { get; set; }
internal int? Days { get; set; }
protected override IDictionary<string, object> GetUriPathParameters()
{
var uriParams = base.GetUriPathParameters();
if (StartDate.HasValue)
uriParams.Add("start_date", StartDate.Value.ToTraktDateString());
if (Days.HasValue)
{
uriParams.Add("days", Days.Value);
if (!StartDate.HasValue)
uriParams.Add("start_date", DateTime.UtcNow.ToTraktDateString());
}
return uriParams;
}
protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.Required;
protected override bool IsListResult => true;
}
}
| namespace TraktApiSharp.Requests.WithOAuth.Calendars
{
using Base.Get;
using Extensions;
using System;
using System.Collections.Generic;
internal abstract class TraktCalendarUserRequest<T> : TraktGetRequest<IEnumerable<T>, T>
{
internal TraktCalendarUserRequest(TraktClient client) : base(client) { }
internal DateTime? StartDate { get; set; }
internal int? Days { get; set; }
protected override IDictionary<string, object> GetUriPathParameters()
{
var uriParams = base.GetUriPathParameters();
if (StartDate.HasValue)
uriParams.Add("start_date", StartDate.Value.ToTraktDateString());
if (Days.HasValue)
uriParams.Add("days", Days.Value);
return uriParams;
}
protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.Required;
protected override bool IsListResult => true;
}
}
| mit | C# |
acb15ac103cd3feea7b4cccc7b9e00b9e76ce313 | add IFonts | LayoutFarm/PixelFarm | a_mini/projects/PixelFarm/PixelFarm.DrawingCanvas/3_Drawing_Fonts/ITextPrinter.cs | a_mini/projects/PixelFarm/PixelFarm.DrawingCanvas/3_Drawing_Fonts/ITextPrinter.cs | ////MIT, 2014-2017, WinterDev
namespace PixelFarm.Drawing
{
public interface IFonts
{
float MeasureWhitespace(RequestFont f);
Size MeasureString(char[] str, int startAt, int len, RequestFont font);
Size MeasureString(char[] str, int startAt, int len, RequestFont font,
float maxWidth, out int charFit,
out int charFitWidth);
void CalculateGlyphAdvancePos(char[] str, int startAt,
int len, RequestFont font, int[] glyphXAdvances);
void Dispose();
}
}
namespace PixelFarm.Drawing.Fonts
{
public interface ITextPrinter
{
void DrawString(string text, double x, double y);
void DrawString(char[] text, double x, double y);
void ChangeFont(RequestFont font);
void ChangeFontColor(Color fontColor);
}
} | ////MIT, 2014-2017, WinterDev
namespace PixelFarm.Drawing.Fonts
{
public interface ITextPrinter
{
void DrawString(string text, double x, double y);
void DrawString(char[] text, double x, double y);
void ChangeFont(RequestFont font);
void ChangeFontColor(Color fontColor);
}
} | bsd-2-clause | C# |
40a23b992159327b1d044bdd05b4feb13ff55a3e | Set cursor invisible in visual test game | paparony03/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,default0/osu-framework,paparony03/osu-framework,ppy/osu-framework,RedNesto/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,Nabile-Rahmani/osu-framework,Tom94/osu-framework,naoey/osu-framework,RedNesto/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework | osu.Framework.VisualTests/VisualTestGame.cs | osu.Framework.VisualTests/VisualTestGame.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Platform;
using osu.Framework.Screens.Testing;
namespace osu.Framework.VisualTests
{
internal class VisualTestGame : Game
{
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new TestBrowser(),
new CursorContainer(),
};
}
protected override void LoadComplete()
{
base.LoadComplete();
Host.Window.CursorState = CursorState.Hidden;
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Screens.Testing;
namespace osu.Framework.VisualTests
{
internal class VisualTestGame : Game
{
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new TestBrowser(),
new CursorContainer(),
};
}
}
}
| mit | C# |
3ff5a31def87f04ea8ceaac7a4fd351c742260a4 | Update tag helper usage from upstream breaking change | mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype | src/Glimpse.Web.Common/ScriptInjector.cs | src/Glimpse.Web.Common/ScriptInjector.cs | using System.Text;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.AspNet.Mvc.Rendering;
namespace Glimpse.Web.Common
{
[TargetElement("body")]
public class ScriptInjector : TagHelper
{
public override int Order => int.MaxValue;
public override void Process(TagHelperContext context, TagHelperOutput output)
{
var js = new StringBuilder();
js.AppendLine("var link = document.createElement('a');");
js.AppendLine("link.setAttribute('href', '/glimpseui/index.html');");
js.AppendLine("link.setAttribute('target', '_blank');");
js.AppendLine("link.text = 'Open Glimpse';");
js.AppendLine("document.body.appendChild(link);");
var tag = new TagBuilder("script")
{
InnerHtml = new HtmlString(js.ToString()),
};
output.PostContent.Append(tag);
}
}
}
| using System.Text;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.AspNet.Mvc.Rendering;
namespace Glimpse.Web.Common
{
[TargetElement("body")]
public class ScriptInjector : TagHelper
{
public override int Order => int.MaxValue;
public override void Process(TagHelperContext context, TagHelperOutput output)
{
var js = new StringBuilder();
js.AppendLine("var link = document.createElement('a');");
js.AppendLine("link.setAttribute('href', '/glimpseui/index.html');");
js.AppendLine("link.setAttribute('target', '_blank');");
js.AppendLine("link.text = 'Open Glimpse';");
js.AppendLine("document.body.appendChild(link);");
var tag = new TagBuilder("script")
{
InnerHtml = new HtmlString(js.ToString()),
};
output.PostContent.Append(tag.ToHtmlContent(TagRenderMode.Normal));
}
}
}
| mit | C# |
23f1d114c70fc62cd02d89e1b6ade9e2b00de154 | Bump version to 0.8.0 | hydna/Hydna.NET | src/Hydna.Net/Properties/AssemblyInfo.cs | src/Hydna.Net/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Hydna.Net")]
[assembly: AssemblyDescription (".NET bindings for Hydna")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Hydna AB")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("(c) Hydna AB 2013-2014")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("0.8.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("Hydna.Net")]
[assembly: AssemblyDescription (".NET bindings for Hydna")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Hydna AB")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("(c) Hydna AB 2013-2014")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("0.1.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| mit | C# |
f10823a3a14b40147c06633080e1663468859c2c | Change from optional parameter to overload | DbUp/DbUp | src/dbup-sqlserver/SqlConnectionManager.cs | src/dbup-sqlserver/SqlConnectionManager.cs | using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using DbUp.Engine.Transactions;
using DbUp.Support;
#if SUPPORTS_AZURE_AD
using Microsoft.Azure.Services.AppAuthentication;
#endif
namespace DbUp.SqlServer
{
/// <summary>
/// Manages Sql Database Connections
/// </summary>
public class SqlConnectionManager : DatabaseConnectionManager
{
/// <summary>
/// Manages Sql Database Connections
/// </summary>
/// <param name="connectionString"></param>
public SqlConnectionManager(string connectionString)
: this(connectionString, false)
{
}
/// <summary>
/// Manages Sql Database Connections
/// </summary>
/// <param name="connectionString"></param>
public SqlConnectionManager(string connectionString, bool useAzureSqlIntegratedSecurity)
: base(new DelegateConnectionFactory((log, dbManager) =>
{
var conn = new SqlConnection(connectionString);
#if SUPPORTS_AZURE_AD
if(useAzureSqlIntegratedSecurity)
conn.AccessToken = (new AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").GetAwaiter().GetResult();
#else
if(useAzureSqlIntegratedSecurity)
throw new Exception("You are targeting a framework that does not support Azure AppAuthentication. The minimum target frameworks are .NET Framework 4.6 and .NET Standard 2.0.");
#endif
if (dbManager.IsScriptOutputLogged)
conn.InfoMessage += (sender, e) => log.WriteInformation($"{{0}}{Environment.NewLine}", e.Message);
return conn;
}))
{
}
public override IEnumerable<string> SplitScriptIntoCommands(string scriptContents)
{
var commandSplitter = new SqlCommandSplitter();
var scriptStatements = commandSplitter.SplitScriptIntoCommands(scriptContents);
return scriptStatements;
}
}
}
| using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using DbUp.Engine.Transactions;
using DbUp.Support;
#if SUPPORTS_AZURE_AD
using Microsoft.Azure.Services.AppAuthentication;
#endif
namespace DbUp.SqlServer
{
/// <summary>
/// Manages Sql Database Connections
/// </summary>
public class SqlConnectionManager : DatabaseConnectionManager
{
/// <summary>
/// Manages Sql Database Connections
/// </summary>
/// <param name="connectionString"></param>
public SqlConnectionManager(string connectionString, bool useAzureSqlIntegratedSecurity = false)
: base(new DelegateConnectionFactory((log, dbManager) =>
{
var conn = new SqlConnection(connectionString);
#if SUPPORTS_AZURE_AD
if(useAzureSqlIntegratedSecurity)
conn.AccessToken = (new AzureServiceTokenProvider()).GetAccessTokenAsync("https://database.windows.net/").GetAwaiter().GetResult();
#else
if(useAzureSqlIntegratedSecurity)
throw new Exception("You are targeting a framework that does not support Azure AppAuthentication. The minimum target frameworks are .NET Framework 4.6 and .NET Standard 2.0.");
#endif
if (dbManager.IsScriptOutputLogged)
conn.InfoMessage += (sender, e) => log.WriteInformation($"{{0}}{Environment.NewLine}", e.Message);
return conn;
}))
{
}
public override IEnumerable<string> SplitScriptIntoCommands(string scriptContents)
{
var commandSplitter = new SqlCommandSplitter();
var scriptStatements = commandSplitter.SplitScriptIntoCommands(scriptContents);
return scriptStatements;
}
}
}
| mit | C# |
0b8b2627e09134cb50493afcb6e2f34687c7860f | Fix localization bug in credit card validator | roend83/FluentValidation,ruisebastiao/FluentValidation,olcayseker/FluentValidation,deluxetiky/FluentValidation,pacificIT/FluentValidation,IRlyDontKnow/FluentValidation,cecilphillip/FluentValidation,regisbsb/FluentValidation,robv8r/FluentValidation,glorylee/FluentValidation,GDoronin/FluentValidation,roend83/FluentValidation,mgmoody42/FluentValidation | src/FluentValidation/Validators/CreditCardValidator.cs | src/FluentValidation/Validators/CreditCardValidator.cs | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://fluentvalidation.codeplex.com
#endregion
namespace FluentValidation.Validators {
using System.Linq;
using Resources;
/// <summary>
/// Ensures that the property value is a valid credit card number.
/// </summary>
public class CreditCardValidator : PropertyValidator {
// This logic was taken from the CreditCardAttribute in the ASP.NET MVC3 source.
public CreditCardValidator() : base(() => Messages.CreditCardError) {
}
protected override bool IsValid(PropertyValidatorContext context) {
var value = context.PropertyValue as string;
if (value == null) {
return true;
}
value = value.Replace("-", "");
int checksum = 0;
bool evenDigit = false;
// http://www.beachnet.com/~hstiles/cardtype.html
foreach (char digit in value.Reverse()) {
if (!char.IsDigit(digit)) {
return false;
}
int digitValue = (digit - '0') * (evenDigit ? 2 : 1);
evenDigit = !evenDigit;
while (digitValue > 0) {
checksum += digitValue % 10;
digitValue /= 10;
}
}
return (checksum % 10) == 0;
}
}
} | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://fluentvalidation.codeplex.com
#endregion
namespace FluentValidation.Validators {
using System.Linq;
using Resources;
/// <summary>
/// Ensures that the property value is a valid credit card number.
/// </summary>
public class CreditCardValidator : PropertyValidator {
// This logic was taken from the CreditCardAttribute in the ASP.NET MVC3 source.
public CreditCardValidator() : base(Messages.CreditCardError) {
}
protected override bool IsValid(PropertyValidatorContext context) {
var value = context.PropertyValue as string;
if (value == null) {
return true;
}
value = value.Replace("-", "");
int checksum = 0;
bool evenDigit = false;
// http://www.beachnet.com/~hstiles/cardtype.html
foreach (char digit in value.Reverse()) {
if (!char.IsDigit(digit)) {
return false;
}
int digitValue = (digit - '0') * (evenDigit ? 2 : 1);
evenDigit = !evenDigit;
while (digitValue > 0) {
checksum += digitValue % 10;
digitValue /= 10;
}
}
return (checksum % 10) == 0;
}
}
} | apache-2.0 | C# |
4a62eda3bd1a085c38f156c9cdc2a90e58616cde | Make OwinRequestScopeContext.Current setter internal. | DavidLievrouw/OwinRequestScopeContext | src/OwinRequestScopeContext/OwinRequestScopeContext.cs | src/OwinRequestScopeContext/OwinRequestScopeContext.cs | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Remoting.Messaging;
namespace DavidLievrouw.OwinRequestScopeContext {
public class OwinRequestScopeContext : IOwinRequestScopeContext {
const string CallContextKey = "dl.owin.rscopectx";
readonly List<IDisposable> _disposables;
internal OwinRequestScopeContext(IDictionary<string, object> owinEnvironment) {
OwinEnvironment = new ReadOnlyDictionary<string, object>(owinEnvironment);
Items = new ConcurrentDictionary<string, object>();
_disposables = new List<IDisposable>();
}
public static IOwinRequestScopeContext Current {
get => (IOwinRequestScopeContext) CallContext.LogicalGetData(CallContextKey);
internal set => CallContext.LogicalSetData(CallContextKey, value);
}
internal IEnumerable<IDisposable> Disposables => _disposables;
public IReadOnlyDictionary<string, object> OwinEnvironment { get; }
public IDictionary<string, object> Items { get; }
public void RegisterForDisposal(IDisposable disposable) {
if (disposable == null) throw new ArgumentNullException(paramName: nameof(disposable));
_disposables.Add(disposable);
}
public void Dispose() {
var disposalExceptions = new List<Exception>();
Disposables.ForEach(disposable => {
try {
disposable.Dispose();
}
catch (Exception ex) {
disposalExceptions.Add(ex);
}
});
CallContext.FreeNamedDataSlot(CallContextKey);
if (disposalExceptions.Any()) {
throw new AggregateException("One or more exception occurred while disposing items that were registered for disposal.", disposalExceptions);
}
}
}
} | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Remoting.Messaging;
namespace DavidLievrouw.OwinRequestScopeContext {
public class OwinRequestScopeContext : IOwinRequestScopeContext {
const string CallContextKey = "dl.owin.rscopectx";
readonly List<IDisposable> _disposables;
internal OwinRequestScopeContext(IDictionary<string, object> owinEnvironment) {
OwinEnvironment = new ReadOnlyDictionary<string, object>(owinEnvironment);
Items = new ConcurrentDictionary<string, object>();
_disposables = new List<IDisposable>();
}
public static IOwinRequestScopeContext Current {
get => (IOwinRequestScopeContext) CallContext.LogicalGetData(CallContextKey);
set => CallContext.LogicalSetData(CallContextKey, value);
}
internal IEnumerable<IDisposable> Disposables => _disposables;
public IReadOnlyDictionary<string, object> OwinEnvironment { get; }
public IDictionary<string, object> Items { get; }
public void RegisterForDisposal(IDisposable disposable) {
if (disposable == null) throw new ArgumentNullException(paramName: nameof(disposable));
_disposables.Add(disposable);
}
public void Dispose() {
var disposalExceptions = new List<Exception>();
Disposables.ForEach(disposable => {
try {
disposable.Dispose();
}
catch (Exception ex) {
disposalExceptions.Add(ex);
}
});
CallContext.FreeNamedDataSlot(CallContextKey);
if (disposalExceptions.Any()) {
throw new AggregateException("One or more exception occurred while disposing items that were registered for disposal.", disposalExceptions);
}
}
}
} | mit | C# |
7d1f2bb4ea785d97571f423ea75b04b82eaad7b0 | Add obsolete flag Fixes #394 | jamesmontemagno/InAppBillingPlugin | src/Plugin.InAppBilling/Shared/PurchaseState.shared.cs | src/Plugin.InAppBilling/Shared/PurchaseState.shared.cs | using System;
namespace Plugin.InAppBilling
{
/// <summary>
/// Gets the current status of the purchase
/// </summary>
public enum PurchaseState
{
/// <summary>
/// Purchased and in good standing
/// </summary>
Purchased = 0,
/// <summary>
/// Purchase was canceled
/// </summary>
Canceled = 1,
/// <summary>
/// Purchase was refunded
/// </summary>
Refunded = 2,
/// <summary>
/// In the process of being processed
/// </summary>
Purchasing,
/// <summary>
/// Transaction has failed
/// </summary>
Failed,
/// <summary>
/// Was restored.
/// </summary>
Restored,
/// <summary>
/// In queue, pending external action
/// </summary>
Deferred,
/// <summary>
/// In free trial
/// </summary>
FreeTrial,
/// <summary>
/// Pending Purchase
/// </summary>
PaymentPending,
/// <summary>
///
/// </summary>
[Obsolete("Please use PaymentPending")]
Pending,
/// <summary>
/// Purchase state unknown
/// </summary>
Unknown
}
}
| namespace Plugin.InAppBilling
{
/// <summary>
/// Gets the current status of the purchase
/// </summary>
public enum PurchaseState
{
/// <summary>
/// Purchased and in good standing
/// </summary>
Purchased = 0,
/// <summary>
/// Purchase was canceled
/// </summary>
Canceled = 1,
/// <summary>
/// Purchase was refunded
/// </summary>
Refunded = 2,
/// <summary>
/// In the process of being processed
/// </summary>
Purchasing,
/// <summary>
/// Transaction has failed
/// </summary>
Failed,
/// <summary>
/// Was restored.
/// </summary>
Restored,
/// <summary>
/// In queue, pending external action
/// </summary>
Deferred,
/// <summary>
/// In free trial
/// </summary>
FreeTrial,
/// <summary>
/// Pending Purchase
/// </summary>
PaymentPending,
/// <summary>
///
/// </summary>
Pending,
/// <summary>
/// Purchase state unknown
/// </summary>
Unknown
}
}
| mit | C# |
5dd8fb4fd9be5622650025b15406ccd2e0e35b10 | replace path chars in zipfile | flubu-core/flubu.core,flubu-core/flubu.core,flubu-core/flubu.core,flubu-core/flubu.core | FlubuCore/Tasks/Packaging/UnzipTask.cs | FlubuCore/Tasks/Packaging/UnzipTask.cs | using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using FlubuCore.Context;
namespace FlubuCore.Tasks.Packaging
{
public class UnzipTask : TaskBase<int>
{
private readonly string _fileName;
private readonly string _destination;
public UnzipTask(string zipFile, string destinationFolder)
{
_fileName = zipFile;
_destination = destinationFolder;
}
protected override int DoExecute(ITaskContextInternal context)
{
OSPlatform os = context.Properties.GetOSPlatform();
context.LogInfo($"Extract {_fileName} to {_destination}");
if (!Directory.Exists(_destination))
Directory.CreateDirectory(_destination);
using (Stream zip = File.OpenRead(_fileName))
using (ZipArchive archive = new ZipArchive(zip, ZipArchiveMode.Read))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
string zipFile = entry.FullName;
if (os != OSPlatform.Windows)
zipFile = zipFile.Replace('\\', Path.DirectorySeparatorChar);
string file = Path.Combine(_destination, zipFile);
context.LogInfo($"Extract {file}");
entry.ExtractToFile(file, true);
}
}
return 0;
}
}
}
| using System.IO;
using System.IO.Compression;
using FlubuCore.Context;
namespace FlubuCore.Tasks.Packaging
{
public class UnzipTask : TaskBase<int>
{
private readonly string _fileName;
private readonly string _destination;
public UnzipTask(string zipFile, string destinationFolder)
{
_fileName = zipFile;
_destination = destinationFolder;
}
protected override int DoExecute(ITaskContextInternal context)
{
context.LogInfo($"Extract {_fileName} to {_destination}");
if (!Directory.Exists(_destination))
Directory.CreateDirectory(_destination);
using (Stream zip = File.OpenRead(_fileName))
using (ZipArchive archive = new ZipArchive(zip, ZipArchiveMode.Read))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
string file = Path.Combine(_destination, entry.FullName);
context.LogInfo($"Extract {entry.FullName} -> {file}");
entry.ExtractToFile(file, true);
}
}
return 0;
}
}
}
| bsd-2-clause | C# |
0f74ff4f932a9aa4f2dc6da3ef6915d3a4e2921f | Update AssemblyInfo.cs | maliming/Abp.GeneralTree | GeneralTree/Properties/AssemblyInfo.cs | GeneralTree/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("Abp.GeneralTree")]
[assembly: AssemblyDescription("Abp.GeneralTree")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("maliming")]
[assembly: AssemblyProduct("Abp.GeneralTree")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("beebd82e-9e7c-427d-959a-019ec7545c29")]
// 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.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Abp.GeneralTree")]
[assembly: AssemblyDescription("Abp.GeneralTree")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("maliming")]
[assembly: AssemblyProduct("Abp.GeneralTree")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("beebd82e-9e7c-427d-959a-019ec7545c29")]
// 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.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")] | mit | C# |
05227f66d0640b42b1172c8cc583b7ac5c2dfcb1 | Fix MessageReplayerInitializerTests | Abc-Arbitrage/Zebus | src/Abc.Zebus.Persistence.Tests/Initialization/MessageReplayerInitializerTests.cs | src/Abc.Zebus.Persistence.Tests/Initialization/MessageReplayerInitializerTests.cs | using System.Threading.Tasks;
using Abc.Zebus.Persistence.Initialization;
using Abc.Zebus.Testing.Extensions;
using Abc.Zebus.Util;
using Moq;
using NUnit.Framework;
namespace Abc.Zebus.Persistence.Tests.Initialization
{
[TestFixture]
public class MessageReplayerInitializerTests
{
private MessageReplayerInitializer _initializer;
private Mock<IMessageReplayerRepository> _messageReplayerRepositoryMock;
[SetUp]
public void Setup()
{
var configurationMock = new Mock<IPersistenceConfiguration>();
configurationMock.SetupGet(conf => conf.SafetyPhaseDuration).Returns(30.Seconds());
_messageReplayerRepositoryMock = new Mock<IMessageReplayerRepository>();
_initializer = new MessageReplayerInitializer(configurationMock.Object, _messageReplayerRepositoryMock.Object);
}
[Test]
public void should_deactivate_replay_creation()
{
_initializer.BeforeStop();
_messageReplayerRepositoryMock.Verify(x => x.DeactivateMessageReplayers());
}
[Test]
public void should_wait_for_replayers()
{
var hasActiveMessageReplayers = true;
_messageReplayerRepositoryMock.Setup(x => x.HasActiveMessageReplayers()).Returns(() => hasActiveMessageReplayers);
var task = Task.Run(() => _initializer.BeforeStop());
task.Wait(300.Milliseconds()).ShouldBeFalse();
hasActiveMessageReplayers = false;
task.Wait(2.Seconds()).ShouldBeTrue();
}
}
}
| using System.Threading.Tasks;
using Abc.Zebus.Persistence.Initialization;
using Abc.Zebus.Testing.Extensions;
using Abc.Zebus.Util;
using Moq;
using NUnit.Framework;
namespace Abc.Zebus.Persistence.Tests.Initialization
{
[TestFixture]
public class MessageReplayerInitializerTests
{
private MessageReplayerInitializer _initializer;
private Mock<IMessageReplayerRepository> _messageReplayerRepositoryMock;
[SetUp]
public void Setup()
{
var configurationMock = new Mock<IPersistenceConfiguration>();
configurationMock.SetupGet(conf => conf.SafetyPhaseDuration).Returns(30.Seconds());
_messageReplayerRepositoryMock = new Mock<IMessageReplayerRepository>();
_initializer = new MessageReplayerInitializer(configurationMock.Object, _messageReplayerRepositoryMock.Object);
}
[Test]
public void should_deactivate_replay_creation()
{
_initializer.BeforeStop();
_messageReplayerRepositoryMock.Verify(x => x.DeactivateMessageReplayers());
}
[Test]
public void should_wait_for_replayers()
{
var hasActiveMessageReplayers = true;
_messageReplayerRepositoryMock.Setup(x => x.HasActiveMessageReplayers()).Returns(() => hasActiveMessageReplayers);
var task = Task.Run(() => _initializer.BeforeStop());
task.Wait(300.Milliseconds()).ShouldBeFalse();
hasActiveMessageReplayers = false;
task.Wait(300.Milliseconds()).ShouldBeTrue();
}
}
}
| mit | C# |
a4d8b40a4ebafe3bbb42a76bbd3498226c19b192 | Update version | Weingartner/XUnitRemote | XUnitRemote/Properties/AssemblyInfo.cs | XUnitRemote/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("XUnitRemote")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weingartner")]
[assembly: AssemblyProduct("XUnitRemote")]
[assembly: AssemblyCopyright("Copyright © Weingartner Machinenbau Gmbh 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("21248cf4-3629-4cfa-8632-9e4468a0526e")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XUnitRemote")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weingartner")]
[assembly: AssemblyProduct("XUnitRemote")]
[assembly: AssemblyCopyright("Copyright © Weingartner Machinenbau Gmbh 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("21248cf4-3629-4cfa-8632-9e4468a0526e")]
// 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.15")]
[assembly: AssemblyFileVersion("1.0.0.15")]
| mit | C# |
f410843f7e2fbb8fe5203f0c0e402a6521249beb | clean up | ezaurum/dapper | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// 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("Dapper Repository")]
[assembly: AssemblyDescription("Dapper auto generated repository extension")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ezaurum")]
[assembly: AssemblyProduct("dapper extention")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c3a998b9-1a09-4589-9e91-481383acb2ec")]
// 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.1.19")]
[assembly: AssemblyFileVersion("0.0.1.19")]
[assembly: NeutralResourcesLanguageAttribute("ko-KR")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// 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("Dapper Repository")]
[assembly: AssemblyDescription("Dapper auto generated repository extension")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ezaurum")]
[assembly: AssemblyProduct("dapper extention")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c3a998b9-1a09-4589-9e91-481383acb2ec")]
// 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.1.19")]
[assembly: AssemblyFileVersion("0.0.1.19")]
[assembly: NeutralResourcesLanguageAttribute("ko-KR")]
| mit | C# |
083af09be1a8bb50c2ad09b8a93f0b848e5ef833 | Change version number | muojp/ptfluentapi-portable | Properties/AssemblyInfo.cs | 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("PivotalTracker.FluentAPI")]
[assembly: AssemblyDescription("Pivotal Tracker FluentAPI is C# API that uses the Fluent pattern to connect to the PivotalTracker REST API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PlasmaSoft")]
[assembly: AssemblyProduct("PivotalTracker.FluentAPI")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[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("cfbd3a2e-c895-4bc4-a8f4-8d9e660859fa")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PivotalTracker.FluentAPI")]
[assembly: AssemblyDescription("Pivotal Tracker FluentAPI is C# API that uses the Fluent pattern to connect to the PivotalTracker REST API.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PlasmaSoft")]
[assembly: AssemblyProduct("PivotalTracker.FluentAPI")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[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("cfbd3a2e-c895-4bc4-a8f4-8d9e660859fa")]
// 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# |
1d4900bfe9c392aca0ee8c72a7c572040ec2124a | add field to S_FIELD_POINT_INFO | Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns | TCC.Core/Parsing/Messages/S_FIELD_POINT_INFO.cs | TCC.Core/Parsing/Messages/S_FIELD_POINT_INFO.cs | using TCC.TeraCommon.Game.Messages;
using TCC.TeraCommon.Game.Services;
namespace TCC.Parsing.Messages
{
public class S_FIELD_POINT_INFO : ParsedMessage
{
public uint Points { get; }
public uint MaxPoints { get; set; }
public int Claimed { get; set; }
public S_FIELD_POINT_INFO(TeraMessageReader reader) : base(reader)
{
Points = reader.ReadUInt32();
MaxPoints = reader.ReadUInt32();
Claimed = reader.ReadInt32() + 1;
}
}
}
| using TCC.TeraCommon.Game.Messages;
using TCC.TeraCommon.Game.Services;
namespace TCC.Parsing.Messages
{
public class S_FIELD_POINT_INFO : ParsedMessage
{
public uint Points { get; }
public uint MaxPoints { get; set; }
public S_FIELD_POINT_INFO(TeraMessageReader reader) : base(reader)
{
Points = reader.ReadUInt32();
MaxPoints = reader.ReadUInt32();
}
}
}
| mit | C# |
8ea85ee8bb83ba3d6acb2543285db945eca4a944 | set version to 0.1.1 | tmds/Tmds.MDns | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | //Copyright (C) 2013 Tom Deseyn
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//Lesser General Public License for more details.
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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("Tmds.MDns")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tmds.MDns")]
[assembly: AssemblyCopyright("Copyright © Tom Deseyn")]
[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("125fe033-caac-497e-ac9d-a66d1e4e9cee")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
| //Copyright (C) 2013 Tom Deseyn
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//Lesser General Public License for more details.
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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("Tmds.MDns")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tmds.MDns")]
[assembly: AssemblyCopyright("Copyright © Tom Deseyn")]
[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("125fe033-caac-497e-ac9d-a66d1e4e9cee")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| lgpl-2.1 | C# |
a1202a720722c19f86c6b93ba0171376de809ccc | Apply license terms uniformly | Weswit/Lightstreamer-example-StockList-client-silverlight,Lightstreamer/Lightstreamer-example-StockList-client-silverlight,Lightstreamer/Lightstreamer-example-StockList-client-silverlight,Weswit/Lightstreamer-example-StockList-client-silverlight | Properties/AssemblyInfo.cs | 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("SilverlightDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SilverlightDemo")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("47afa584-e86e-4df1-8021-33c44b3a24be")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| #region License
/*
* Copyright 2013 Weswit Srl
*
* 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 License
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("SilverlightDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SilverlightDemo")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("47afa584-e86e-4df1-8021-33c44b3a24be")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
3d9411aa5add9ad8e55e50315c0a558e44790fb0 | Correct version and copyright. | EliotVU/Unreal-Library | Properties/AssemblyInfo.cs | 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( "UELib" )]
[assembly: AssemblyDescription( "UELib provides methods for deserializing and decompiling Unreal package files." )]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "UELib" )]
[assembly: AssemblyCopyright( "© 2012 Eliot van Uytfanghe. All rights reserved." )]
[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( "0eb1c54e-8955-4c8d-98d3-16285f114f16" )]
// 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.9.0" )]
[assembly: AssemblyFileVersion( "1.0.9.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( "UELib" )]
[assembly: AssemblyDescription( "UELib provides methods for deserializing and decompiling Unreal package files." )]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "UELib" )]
[assembly: AssemblyCopyright( "Copyright 2010 - 2012 Eliot van Uytfanghe." )]
[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( "0eb1c54e-8955-4c8d-98d3-16285f114f16" )]
// 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.9.0" )]
[assembly: AssemblyFileVersion( "1.0.9.0" )]
| mit | C# |
cacfb5128058f4c7ef330c48cac1f05792d34c06 | fix flipped if clause | bradwestness/SecretSanta,bradwestness/SecretSanta | SecretSanta/Views/Home/Dashboard.cshtml | SecretSanta/Views/Home/Dashboard.cshtml | @model DashboardModel
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<div class="row">
<div class="col-lg-6">
<h1>Welcome to Secret Santa, @Model?.DisplayName!</h1>
@if (Model?.PickedAccountId is null)
{
<p>Looks like you haven't picked your recipient yet.</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Pick", "Home")">Pick Your Recipient »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
else
{
<p>You picked @Model?.PickedAccountDisplayName!</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Details", "Wishlist", new { id = Model?.PickedAccountId })">View @Model?.PickedAccountDisplayName's Wish List »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
</div>
<div class="col-lg-6">
<img class="img-responsive" src="@Url.Content("~/images/santa.png")" alt="Santa" />
</div>
</div>
</div> | @model DashboardModel
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<div class="row">
<div class="col-lg-6">
<h1>Welcome to Secret Santa, @Model?.DisplayName!</h1>
@if (Model?.PickedAccountId is not null)
{
<p>Looks like you haven't picked your recipient yet.</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Pick", "Home")">Pick Your Recipient »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
else
{
<p>You picked @Model?.PickedAccountDisplayName!</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Details", "Wishlist", new { id = Model?.PickedAccountId })">View @Model?.PickedAccountDisplayName's Wish List »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
</div>
<div class="col-lg-6">
<img class="img-responsive" src="@Url.Content("~/images/santa.png")" alt="Santa" />
</div>
</div>
</div> | apache-2.0 | C# |
516318e24956a5540f0a5c3ff7b214b95ca46935 | Update WholeNumberDataValidation.cs | asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET | Examples/CSharp/Data/Processing/FilteringAndValidation/WholeNumberDataValidation.cs | Examples/CSharp/Data/Processing/FilteringAndValidation/WholeNumberDataValidation.cs | using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.Processing.FilteringAndValidation
{
public class WholeNumberDataValidation
{
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);
// Create a workbook object.
Workbook workbook = new Workbook();
// Create a worksheet and get the first worksheet.
Worksheet ExcelWorkSheet = workbook.Worksheets[0];
//Accessing the Validations collection of the worksheet
ValidationCollection validations = workbook.Worksheets[0].Validations;
//Creating a Validation object
Validation validation = validations[validations.Add()];
//Setting the validation type to whole number
validation.Type = ValidationType.WholeNumber;
//Setting the operator for validation to Between
validation.Operator = OperatorType.Between;
//Setting the minimum value for the validation
validation.Formula1 = "10";
//Setting the maximum value for the validation
validation.Formula2 = "1000";
//Applying the validation to a range of cells from A1 to B2 using the
//CellArea structure
CellArea area;
area.StartRow = 0;
area.EndRow = 1;
area.StartColumn = 0;
area.EndColumn = 1;
//Adding the cell area to Validation
validation.AreaList.Add(area);
// Save the workbook.
workbook.Save(dataDir + "output.out.xls");
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.Processing.FilteringAndValidation
{
public class WholeNumberDataValidation
{
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);
// Create a workbook object.
Workbook workbook = new Workbook();
// Create a worksheet and get the first worksheet.
Worksheet ExcelWorkSheet = workbook.Worksheets[0];
//Accessing the Validations collection of the worksheet
ValidationCollection validations = workbook.Worksheets[0].Validations;
//Creating a Validation object
Validation validation = validations[validations.Add()];
//Setting the validation type to whole number
validation.Type = ValidationType.WholeNumber;
//Setting the operator for validation to Between
validation.Operator = OperatorType.Between;
//Setting the minimum value for the validation
validation.Formula1 = "10";
//Setting the maximum value for the validation
validation.Formula2 = "1000";
//Applying the validation to a range of cells from A1 to B2 using the
//CellArea structure
CellArea area;
area.StartRow = 0;
area.EndRow = 1;
area.StartColumn = 0;
area.EndColumn = 1;
//Adding the cell area to Validation
validation.AreaList.Add(area);
// Save the workbook.
workbook.Save(dataDir + "output.out.xls");
}
}
} | mit | C# |
18dbdb27ba64e05b9009a59b7a9cda385081bde8 | Make Necronomicon's commands cancellable | samfun123/KtaneTwitchPlays | TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Misc/NecronomiconComponentSolver.cs | TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Misc/NecronomiconComponentSolver.cs | using System;
using System.Collections;
using UnityEngine;
public class NecronomiconComponentSolver : ComponentSolver
{
public NecronomiconComponentSolver(TwitchModule module) :
base(module)
{
_component = Module.BombComponent.GetComponent(ComponentType);
selectables = Module.BombComponent.GetComponent<KMSelectable>().Children;
ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Cycle all the pages using !{0} cycle. Submit a specific page using !{0} page 3.");
}
protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
{
inputCommand = inputCommand.ToLowerInvariant().Trim();
string[] split = inputCommand.Split(new[] { ' ', ',', ';' }, System.StringSplitOptions.RemoveEmptyEntries);
if (split.Length == 1 && split[0].EqualsAny("cycle", "c", "pages"))
{
yield return null;
yield return DoInteractionClick(selectables[0]);
int pagesTurned = 0;
for (int i = 0; i < 8; i++)
{
yield return new WaitUntil(() => !_component.GetValue<bool>("animating"));
yield return new WaitForSecondsWithCancel(2.25f, false, this);
if (CoroutineCanceller.ShouldCancel)
break;
pagesTurned = i;
yield return DoInteractionClick(selectables[1]);
}
for (int i = pagesTurned; i < 8; i++)
{
yield return new WaitUntil(() => !_component.GetValue<bool>("animating"));
yield return DoInteractionClick(selectables[1]);
}
}
else if (split.Length == 2 && split[0].EqualsAny("page", "p") && int.TryParse(split[1], out int pageNumber) && pageNumber.InRange(1, 8))
{
yield return null;
yield return DoInteractionClick(selectables[0]);
int pagesTurned = 0;
for (int i = 1; i < pageNumber; i++)
{
yield return new WaitUntil(() => !_component.GetValue<bool>("animating"));
if (CoroutineCanceller.ShouldCancel)
break;
pagesTurned = i;
yield return DoInteractionClick(selectables[1]);
}
for (int i = pagesTurned; i < 8; i++)
{
yield return new WaitUntil(() => !_component.GetValue<bool>("animating"));
yield return DoInteractionClick(selectables[1]);
}
yield return "solve";
yield return "strike";
}
}
protected override IEnumerator ForcedSolveIEnumerator()
{
yield return null;
yield return RespondToCommandInternal("page " + _component.GetValue<int>("correctPage"));
}
static NecronomiconComponentSolver()
{
ComponentType = ReflectionHelper.FindType("necronomiconScript");
}
private static readonly Type ComponentType;
private readonly object _component;
private readonly KMSelectable[] selectables;
}
| using System;
using System.Collections;
using UnityEngine;
public class NecronomiconComponentSolver : ComponentSolver
{
public NecronomiconComponentSolver(TwitchModule module) :
base(module)
{
_component = Module.BombComponent.GetComponent(ComponentType);
selectables = Module.BombComponent.GetComponent<KMSelectable>().Children;
ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Cycle all the pages using !{0} cycle. Submit a specific page using !{0} page 3.");
}
protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
{
inputCommand = inputCommand.ToLowerInvariant().Trim();
string[] split = inputCommand.Split(new[] { ' ', ',', ';' }, System.StringSplitOptions.RemoveEmptyEntries);
if (split.Length == 1 && split[0].EqualsAny("cycle", "c", "pages"))
{
yield return null;
yield return DoInteractionClick(selectables[0]);
for (int i = 0; i < 8; i++)
{
yield return new WaitUntil(() => !_component.GetValue<bool>("animating"));
yield return new WaitForSeconds(2.25f);
yield return DoInteractionClick(selectables[1]);
}
}
else if (split.Length == 2 && split[0].EqualsAny("page", "p") && int.TryParse(split[1], out int pageNumber) && pageNumber.InRange(1, 8))
{
yield return null;
yield return DoInteractionClick(selectables[0]);
for (int i = 1; i < pageNumber; i++)
{
yield return new WaitUntil(() => !_component.GetValue<bool>("animating"));
yield return DoInteractionClick(selectables[1]);
}
yield return "solve";
yield return "strike";
}
}
protected override IEnumerator ForcedSolveIEnumerator()
{
yield return null;
yield return RespondToCommandInternal("page " + _component.GetValue<int>("correctPage"));
}
static NecronomiconComponentSolver()
{
ComponentType = ReflectionHelper.FindType("necronomiconScript");
}
private static readonly Type ComponentType;
private readonly object _component;
private readonly KMSelectable[] selectables;
}
| mit | C# |
36cc85bd020227547fa7c274c43f64756b33c473 | Bump to 3.0.0 | clement911/ShopifySharp,nozzlegear/ShopifySharp,addsb/ShopifySharp | ShopifySharp/Properties/AssemblyInfo.cs | ShopifySharp/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("ShopifySharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShopifySharp")]
[assembly: AssemblyCopyright("Copyright © Nozzlegear Software 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("833ec12b-956d-427b-a598-2f12b84589ef")]
// 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("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ShopifySharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShopifySharp")]
[assembly: AssemblyCopyright("Copyright © Nozzlegear Software 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("833ec12b-956d-427b-a598-2f12b84589ef")]
// 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.4.0.0")]
[assembly: AssemblyFileVersion("2.4.0.0")]
| mit | C# |
c7b4b7da7d5f51346ca4f7c840fb82b9967d4db8 | Add API comments for address | mattgwagner/CertiPay.Payroll.Common | CertiPay.Payroll.Common/Address.cs | CertiPay.Payroll.Common/Address.cs | using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CertiPay.Payroll.Common
{
/// <summary>
/// Represents a basic address format for the United States
/// </summary>
[ComplexType]
public class Address
{
// Warning: This is marked as a complex type, and used in several projects, so any changes will trickle down into EF changes...
/// <summary>
/// The first line of the address
/// </summary>
[StringLength(75)]
public String Address1 { get; set; }
/// <summary>
/// The second line of the address
/// </summary>
[StringLength(75)]
public String Address2 { get; set; }
/// <summary>
/// The third line of the address
/// </summary>
[StringLength(75)]
public String Address3 { get; set; }
/// <summary>
/// The city the address is located in
/// </summary>
[StringLength(50)]
public String City { get; set; }
/// <summary>
/// The state the address is located in
/// </summary>
public StateOrProvince State { get; set; }
/// <summary>
/// The postal "zip" code for the address, could include the additional four digits
/// </summary>
[DataType(DataType.PostalCode)]
[StringLength(15)]
[Display(Name = "Postal Code")]
public String PostalCode { get; set; }
public Address()
{
this.State = StateOrProvince.FL;
}
}
} | using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CertiPay.Payroll.Common
{
[ComplexType]
public class Address
{
// Warning: This is marked as a complex type, and used in several projects, so any changes will trickle down into EF changes...
[StringLength(75)]
public String Address1 { get; set; }
[StringLength(75)]
public String Address2 { get; set; }
[StringLength(75)]
public String Address3 { get; set; }
[StringLength(50)]
public String City { get; set; }
public StateOrProvince State { get; set; }
[DataType(DataType.PostalCode)]
[StringLength(15)]
[Display(Name = "Postal Code")]
public String PostalCode { get; set; }
// TODO: international fields
public Address()
{
this.State = StateOrProvince.FL;
}
}
} | mit | C# |
5fe0ff8332b4ecfe0f8eaa8d689ff195dfc4dbf1 | Update Program.cs #9 | tvert/GitTest1 | ConsoleApp1/ConsoleApp1/Program.cs | ConsoleApp1/ConsoleApp1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// Code amended in GitHub
// Code amended #2 in GitHub
// Code amended #3 in GitHub
// Code amended #VS.4 in VS
// Code amemded #9 in GitHub
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
// Code amended in GitHub
// Code amended #2 in GitHub
// Code amended #3 in GitHub
// Code amended #VS.4 in VS
}
}
}
| mit | C# |
dc371c1979e5d3df409da4e4fae229d52944ae72 | Include CheckBoxList in ValueListPreValueMigrator | dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,hfloyd/Umbraco-CMS,NikRimington/Umbraco-CMS,arknu/Umbraco-CMS,madsoulswe/Umbraco-CMS,abjerner/Umbraco-CMS,NikRimington/Umbraco-CMS,arknu/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,madsoulswe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,mattbrailsford/Umbraco-CMS,rasmuseeg/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,NikRimington/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,bjarnef/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,abryukhov/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS | src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/ValueListPreValueMigrator.cs | src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/ValueListPreValueMigrator.cs | using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes
{
class ValueListPreValueMigrator : IPreValueMigrator
{
private readonly string[] _editors =
{
"Umbraco.RadioButtonList",
"Umbraco.CheckBoxList",
"Umbraco.DropDown",
"Umbraco.DropdownlistPublishingKeys",
"Umbraco.DropDownMultiple",
"Umbraco.DropdownlistMultiplePublishKeys"
};
public bool CanMigrate(string editorAlias)
=> _editors.Contains(editorAlias);
public virtual string GetNewAlias(string editorAlias)
=> null;
public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary<string, PreValueDto> preValues)
{
var config = new ValueListConfiguration();
foreach (var preValue in preValues.Values)
config.Items.Add(new ValueListConfiguration.ValueListItem { Id = preValue.Id, Value = preValue.Value });
return config;
}
}
}
| using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes
{
class ValueListPreValueMigrator : IPreValueMigrator
{
private readonly string[] _editors =
{
"Umbraco.RadioButtonList",
"Umbraco.DropDown",
"Umbraco.DropdownlistPublishingKeys",
"Umbraco.DropDownMultiple",
"Umbraco.DropdownlistMultiplePublishKeys"
};
public bool CanMigrate(string editorAlias)
=> _editors.Contains(editorAlias);
public virtual string GetNewAlias(string editorAlias)
=> null;
public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary<string, PreValueDto> preValues)
{
var config = new ValueListConfiguration();
foreach (var preValue in preValues.Values)
config.Items.Add(new ValueListConfiguration.ValueListItem { Id = preValue.Id, Value = preValue.Value });
return config;
}
}
}
| mit | C# |
9358a0e4793b9e2c528017355ae7bb0c82e1275a | Add warning about no edit/delete | mattgwagner/alert-roster | alert-roster.web/Views/Home/New.cshtml | alert-roster.web/Views/Home/New.cshtml | @model alert_roster.web.Models.Message
@{
ViewBag.Title = "Post New Message";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true)
<div class="alert alert-info">
Please limit messages to < 160 characters. Note that, due to notifications being sent,
editing or deleting a post is currently unavailable.
</div>
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Content, new { rows = "3", cols = "80" })
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Post" class="btn btn-default" />
</div>
</div>
</div>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
}
| @model alert_roster.web.Models.Message
@{
ViewBag.Title = "Post New Message";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm("New", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true)
<div class="alert alert-info">
Please limit messages to < 160 characters.
</div>
<div class="form-group">
@Html.LabelFor(model => model.Content, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Content, new { rows = "3", cols = "80" })
@Html.ValidationMessageFor(model => model.Content)
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Post" class="btn btn-default" />
</div>
</div>
</div>
<div>
@Html.ActionLink("Back to List", "Index")
</div>
}
| mit | C# |
602bd3d89a8a732ad0abcc39bbfce494db95b6b7 | Optimize FutureProof to not load when the version is up to date | Yonom/BotBits | BotBits/Packages/Login/Client/FutureProofLoginClient.cs | BotBits/Packages/Login/Client/FutureProofLoginClient.cs | using System.Threading.Tasks;
using EE.FutureProof;
using JetBrains.Annotations;
using PlayerIOClient;
namespace BotBits
{
public class FutureProofLoginClient : LoginClient
{
private const int CurrentVersion = 218;
public FutureProofLoginClient([NotNull] ConnectionManager connectionManager, [NotNull] Client client) : base(connectionManager, client)
{
}
protected override Task Attach(ConnectionManager connectionManager, Connection connection, ConnectionArgs args, int? version)
{
var versionLoader = version.HasValue
? TaskHelper.FromResult(version.Value)
: LoginUtils.GetVersionAsync(this.Client);
return versionLoader.Then(v =>
{
if (v.Result == CurrentVersion)
{
base.Attach(connectionManager, connection, args, v.Result);
}
else
{
this.FutureProofAttach(connectionManager, connection, args, v.Result);
}
});
}
// This line is separated into a function to prevent uncessarily loading FutureProof into memory.
private void FutureProofAttach(ConnectionManager connectionManager, Connection connection, ConnectionArgs args, int version)
{
connectionManager.AttachConnection(connection.FutureProof(CurrentVersion, version), args);
}
}
}
| using System.Threading.Tasks;
using EE.FutureProof;
using JetBrains.Annotations;
using PlayerIOClient;
namespace BotBits
{
public class FutureProofLoginClient : LoginClient
{
private const int CurrentVersion = 218;
public FutureProofLoginClient([NotNull] ConnectionManager connectionManager, [NotNull] Client client) : base(connectionManager, client)
{
}
protected override Task Attach(ConnectionManager connectionManager, Connection connection, ConnectionArgs args, int? version)
{
var versionLoader = version.HasValue
? TaskHelper.FromResult(version.Value)
: LoginUtils.GetVersionAsync(this.Client);
return versionLoader.Then(v =>
{
connectionManager.AttachConnection(connection.FutureProof(CurrentVersion, v.Result), args);
});
}
}
}
| mit | C# |
70d7231238f4b1a69f38136d479f6b794aa27417 | Fix not pasting stats with no boss name available. | Gl0/CasualMeter | CasualMeter.Common/Formatters/DamageTrackerFormatter.cs | CasualMeter.Common/Formatters/DamageTrackerFormatter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CasualMeter.Common.Helpers;
using Tera.DamageMeter;
namespace CasualMeter.Common.Formatters
{
public class DamageTrackerFormatter : Formatter
{
public DamageTrackerFormatter(DamageTracker damageTracker, FormatHelpers formatHelpers)
{
var placeHolders = new List<KeyValuePair<string, object>>();
placeHolders.Add(new KeyValuePair<string, object>("Boss", damageTracker.Name??string.Empty));
placeHolders.Add(new KeyValuePair<string, object>("Time", formatHelpers.FormatTimeSpan(damageTracker.Duration)));
Placeholders = placeHolders.ToDictionary(x => x.Key, y => y.Value);
FormatProvider = formatHelpers.CultureInfo;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CasualMeter.Common.Helpers;
using Tera.DamageMeter;
namespace CasualMeter.Common.Formatters
{
public class DamageTrackerFormatter : Formatter
{
public DamageTrackerFormatter(DamageTracker damageTracker, FormatHelpers formatHelpers)
{
var placeHolders = new List<KeyValuePair<string, object>>();
placeHolders.Add(new KeyValuePair<string, object>("Boss", damageTracker.Name));
placeHolders.Add(new KeyValuePair<string, object>("Time", formatHelpers.FormatTimeSpan(damageTracker.Duration)));
Placeholders = placeHolders.ToDictionary(x => x.Key, y => y.Value);
FormatProvider = formatHelpers.CultureInfo;
}
}
}
| mit | C# |
54ffb405ea34cb2152545520834416ece49f3238 | Set Read timeout | mbenford/dreamcheeky-big-red-button-dotnet | DreamCheeky.BigRedButton/Device.cs | DreamCheeky.BigRedButton/Device.cs | using System;
using System.Linq;
using HidLibrary;
namespace DreamCheeky
{
class Device : IDisposable
{
private readonly byte[] statusCommand = { 0, 0, 0, 0, 0, 0, 0, 0, 2 };
private readonly int vendorId = 0x1D34;
private readonly int productId = 0x000D;
private readonly HidDevice device;
public Device()
{
device = HidDevices.Enumerate(vendorId, productId).FirstOrDefault();
if (device == null)
throw new InvalidOperationException("Device not found");
}
public void Open()
{
device.OpenDevice();
}
public void Close()
{
device.CloseDevice();
}
public DeviceStatus GetStatus()
{
if (!device.Write(statusCommand, 100))
{
return DeviceStatus.Errored;
}
HidDeviceData data = device.Read(100);
if (data.Status != HidDeviceData.ReadStatus.Success)
{
return DeviceStatus.Errored;
}
return (DeviceStatus)data.Data[1];
}
public void Dispose()
{
Close();
}
}
}
| using System;
using System.Linq;
using HidLibrary;
namespace DreamCheeky
{
class Device : IDisposable
{
private readonly byte[] statusCommand = { 0, 0, 0, 0, 0, 0, 0, 0, 2 };
private readonly int vendorId = 0x1D34;
private readonly int productId = 0x000D;
private readonly HidDevice device;
public Device()
{
device = HidDevices.Enumerate(vendorId, productId).FirstOrDefault();
if (device == null)
throw new InvalidOperationException("Device not found");
}
public void Open()
{
device.OpenDevice();
}
public void Close()
{
device.CloseDevice();
}
public DeviceStatus GetStatus()
{
if (!device.Write(statusCommand, 100))
{
return DeviceStatus.Errored;
}
HidDeviceData data = device.Read();
if (data.Status != HidDeviceData.ReadStatus.Success)
{
return DeviceStatus.Errored;
}
return (DeviceStatus)data.Data[1];
}
public void Dispose()
{
Close();
}
}
}
| mit | C# |
5e1b4251b2e517c3318d09bd79a1b2b3745f0512 | Update ExtensionMethods.cs | unruledboy/SharpDups | Infrastructure/ExtensionMethods.cs | Infrastructure/ExtensionMethods.cs | using System;
using System.Collections.Generic;
namespace Xnlab.SharpDups.Infrastructure
{
public static class ExtensionMethods
{
public static IEnumerable<IEnumerable<T>> Section<T>(this IEnumerable<T> source, int length)
{
if (length <= 0)
throw new ArgumentOutOfRangeException("length");
var section = new List<T>(length);
foreach (var item in source)
{
section.Add(item);
if (section.Count == length)
{
yield return section.AsReadOnly();
section = new List<T>(length);
}
}
if (section.Count > 0)
yield return section.AsReadOnly();
}
}
}
| using System;
using System.Collections.Generic;
namespace Xnlab.SharpDups.Infrastructure
{
public static class ExtensionMethods
{
public static IEnumerable<IEnumerable<T>> Section<T>(this IEnumerable<T> source, int length)
{
if (length <= 0)
throw new ArgumentOutOfRangeException("length");
var section = new List<T>(length);
foreach (var item in source)
{
section.Add(item);
if (section.Count == length)
{
yield return section.AsReadOnly();
section = new List<T>(length);
}
}
if (section.Count > 0)
yield return section.AsReadOnly();
}
}
}
| apache-2.0 | C# |
16877fe4c998977642496ee3bd605148f1098fea | remove return url bits from the social login, it doesn't work yet | AAPT/jean0226case1322,JabbR/JabbR,JabbR/JabbR,lukehoban/JabbR,M-Zuber/JabbR,AAPT/jean0226case1322,SonOfSam/JabbR,mzdv/JabbR,timgranstrom/JabbR,SonOfSam/JabbR,borisyankov/JabbR,lukehoban/JabbR,18098924759/JabbR,CrankyTRex/JabbRMirror,huanglitest/JabbRTest2,LookLikeAPro/JabbR,huanglitest/JabbRTest2,yadyn/JabbR,huanglitest/JabbRTest2,meebey/JabbR,M-Zuber/JabbR,yadyn/JabbR,LookLikeAPro/JabbR,18098924759/JabbR,e10/JabbR,e10/JabbR,borisyankov/JabbR,timgranstrom/JabbR,fuzeman/vox,ajayanandgit/JabbR,borisyankov/JabbR,yadyn/JabbR,CrankyTRex/JabbRMirror,meebey/JabbR,meebey/JabbR,LookLikeAPro/JabbR,lukehoban/JabbR,ajayanandgit/JabbR,CrankyTRex/JabbRMirror,mzdv/JabbR,fuzeman/vox,fuzeman/vox | JabbR/Views/Account/_social.cshtml | JabbR/Views/Account/_social.cshtml | @using System;
@using System.Linq;
@using JabbR;
@using JabbR.Infrastructure;
@using JabbR.Models;
@using JabbR.ViewModels;
@using Nancy;
@using Nancy.Helpers;
@model SocialLoginViewModel
<div class="control-group">
<div class="controls">
<form action="@Url.Content("~/account/unlink")" method="POST">
@foreach (var provider in Model.ConfiguredProviders)
{
<ul class="inline">
@if (!Model.IsAlreadyLinked(provider))
{
<li><a class="btn btn-provider" href="@Url.Content("~/authentication/redirect/" + provider.ToLower())"><i class="[email protected]()-logo"></i> @provider</a></li>
}
else
{
<li><div class="provider"><i class="[email protected]()-logo"></i> @provider</div><button type="submit" class="btn-unlink" name="provider" value="@provider.ToLower()" title="unlink identity provider"><i class="icon-unlink"></i></button></li>
}
</ul>
}
@Html.AntiForgeryToken()
</form>
</div>
</div>
| @using System;
@using System.Linq;
@using JabbR;
@using JabbR.Infrastructure;
@using JabbR.Models;
@using JabbR.ViewModels;
@using Nancy;
@using Nancy.Helpers;
@model SocialLoginViewModel
@{
var returnUrl = HttpUtility.UrlEncode(Html.RenderContext.Context.Request.Path);
}
<div class="control-group">
<div class="controls">
<form action="@Url.Content("~/account/unlink")" method="POST">
@foreach (var provider in Model.ConfiguredProviders)
{
<ul class="inline">
@if (!Model.IsAlreadyLinked(provider))
{
<li><a class="btn btn-provider" href="@Url.Content("~/authentication/redirect/" + provider.ToLower() + "?returnUrl=" + returnUrl)"><i class="[email protected]()-logo"></i> @provider</a></li>
}
else
{
<li><div class="provider"><i class="[email protected]()-logo"></i> @provider</div><button type="submit" class="btn-unlink" name="provider" value="@provider.ToLower()" title="unlink identity provider"><i class="icon-unlink"></i></button></li>
}
</ul>
}
@Html.AntiForgeryToken()
</form>
</div>
</div>
| mit | C# |
ae386154fa754d3f2d86c58203c1cd9493afc2b4 | Fix wrong setting check for !retry | CaitSith2/KtaneTwitchPlays,samfun123/KtaneTwitchPlays | TwitchPlaysAssembly/Src/Commanders/PostGameCommander.cs | TwitchPlaysAssembly/Src/Commanders/PostGameCommander.cs | using System.Collections;
using UnityEngine;
public class PostGameCommander : ICommandResponder
{
#region Constructors
public PostGameCommander(ResultPage resultsPage)
{
ResultsPage = resultsPage;
}
#endregion
#region Interface Implementation
public IEnumerator RespondToCommand(string userNickName, string message, ICommandResponseNotifier responseNotifier)
{
Selectable button = null;
message = message.ToLowerInvariant();
if (message.EqualsAny("!continue","!back"))
{
button = ContinueButton;
}
else if (message.Equals("!retry"))
{
if (!TwitchPlaySettings.data.EnableRetryButton)
{
IRCConnection.Instance.SendMessage(TwitchPlaySettings.data.RetryInactive);
}
button = TwitchPlaySettings.data.EnableRetryButton ? RetryButton : ContinueButton;
}
if (button == null)
{
yield break;
}
// Press the button twice, in case the first is too early and skips the message instead
for (int i = 0; i < 2; i++)
{
DoInteractionStart(button);
yield return new WaitForSeconds(0.1f);
DoInteractionEnd(button);
}
}
#endregion
#region Public Fields
public Selectable ContinueButton
{
get { return ResultsPage.ContinueButton; }
}
public Selectable RetryButton
{
get { return ResultsPage.RetryButton; }
}
#endregion
#region Private Methods
private void DoInteractionStart(Selectable selectable)
{
selectable.HandleInteract();
}
private void DoInteractionEnd(Selectable selectable)
{
selectable.OnInteractEnded();
selectable.SetHighlight(false);
}
#endregion
#region Private Readonly Fields
private readonly ResultPage ResultsPage = null;
#endregion
}
| using System.Collections;
using UnityEngine;
public class PostGameCommander : ICommandResponder
{
#region Constructors
public PostGameCommander(ResultPage resultsPage)
{
ResultsPage = resultsPage;
}
#endregion
#region Interface Implementation
public IEnumerator RespondToCommand(string userNickName, string message, ICommandResponseNotifier responseNotifier)
{
Selectable button = null;
message = message.ToLowerInvariant();
if (message.EqualsAny("!continue","!back"))
{
button = ContinueButton;
}
else if (message.Equals("!retry"))
{
if (!TwitchPlaySettings.data.EnableRetryButton)
{
IRCConnection.Instance.SendMessage(TwitchPlaySettings.data.RetryInactive);
}
button = TwitchPlaySettings.data.EnableRewardMultipleStrikes ? RetryButton : ContinueButton;
}
if (button == null)
{
yield break;
}
// Press the button twice, in case the first is too early and skips the message instead
for (int i = 0; i < 2; i++)
{
DoInteractionStart(button);
yield return new WaitForSeconds(0.1f);
DoInteractionEnd(button);
}
}
#endregion
#region Public Fields
public Selectable ContinueButton
{
get { return ResultsPage.ContinueButton; }
}
public Selectable RetryButton
{
get { return ResultsPage.RetryButton; }
}
#endregion
#region Private Methods
private void DoInteractionStart(Selectable selectable)
{
selectable.HandleInteract();
}
private void DoInteractionEnd(Selectable selectable)
{
selectable.OnInteractEnded();
selectable.SetHighlight(false);
}
#endregion
#region Private Readonly Fields
private readonly ResultPage ResultsPage = null;
#endregion
}
| mit | C# |
d22e1567661e17b1b835baf124d53f5cbfd9e49f | Update nuget package version | lfreneda/SimpleAmazonSQS | src/SimpleAmazonSQS/Properties/AssemblyInfo.cs | src/SimpleAmazonSQS/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("SimpleAmazonSQS")]
[assembly: AssemblyDescription("A higher-level interface for Amazon SQS in .NET, which basically queue n dequeue guid's")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimpleAmazonSQS")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7742c06d-f0f2-43e5-af50-be7869f32e60")]
// 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.4.0")]
[assembly: AssemblyFileVersion("1.4.0")]
[assembly: InternalsVisibleTo("SimpleAmazonSQS.Tests")]
| 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("SimpleAmazonSQS")]
[assembly: AssemblyDescription("A higher-level interface for Amazon SQS in .NET, which basically queue n dequeue guid's")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimpleAmazonSQS")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7742c06d-f0f2-43e5-af50-be7869f32e60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.1")]
[assembly: AssemblyFileVersion("1.3.1")]
[assembly: InternalsVisibleTo("SimpleAmazonSQS.Tests")]
| mit | C# |
932de1f6eb9600cc2758cf510a2a41503301b135 | tidy up | SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice | src/SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests/Validation/ApprenticeshipCreateOrEdit/ApprenticeshipValidationTestBase.cs | src/SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests/Validation/ApprenticeshipCreateOrEdit/ApprenticeshipValidationTestBase.cs | using System;
using Moq;
using NUnit.Framework;
using SFA.DAS.ProviderApprenticeshipsService.Domain.Interfaces;
using SFA.DAS.ProviderApprenticeshipsService.Infrastructure.Services;
using SFA.DAS.ProviderApprenticeshipsService.Web.Models;
using SFA.DAS.ProviderApprenticeshipsService.Web.Validation;
using SFA.DAS.ProviderApprenticeshipsService.Web.Validation.Text;
using SFA.DAS.Learners.Validators;
namespace SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests.Validation.ApprenticeshipCreateOrEdit
{
public abstract class ApprenticeshipValidationTestBase
{
protected readonly Mock<ICurrentDateTime> CurrentDateTime = new Mock<ICurrentDateTime>();
protected Mock<IUlnValidator> MockUlnValidator = new Mock<IUlnValidator>();
protected ApprenticeshipViewModelValidator Validator;
protected ApprenticeshipViewModel ValidModel;
[SetUp]
public void BaseSetup()
{
CurrentDateTime.Setup(x => x.Now).Returns(DateTime.Now.AddMonths(6));
Validator = new ApprenticeshipViewModelValidator(
new WebApprenticeshipValidationText(new AcademicYearDateProvider(CurrentDateTime.Object)),
CurrentDateTime.Object,
new AcademicYearDateProvider(CurrentDateTime.Object),
MockUlnValidator.Object);
ValidModel = new ApprenticeshipViewModel { ULN = "1001234567", FirstName = "TestFirstName", LastName = "TestLastName" };
}
}
}
| using System;
using Moq;
using NUnit.Framework;
using SFA.DAS.ProviderApprenticeshipsService.Domain.Interfaces;
using SFA.DAS.ProviderApprenticeshipsService.Infrastructure.Services;
using SFA.DAS.ProviderApprenticeshipsService.Web.Models;
using SFA.DAS.ProviderApprenticeshipsService.Web.Validation;
using SFA.DAS.ProviderApprenticeshipsService.Web.Validation.Text;
using SFA.DAS.Learners.Validators;
namespace SFA.DAS.ProviderApprenticeshipsService.Web.UnitTests.Validation.ApprenticeshipCreateOrEdit
{
public abstract class ApprenticeshipValidationTestBase
{
protected readonly Mock<ICurrentDateTime> CurrentDateTime = new Mock<ICurrentDateTime>();
protected Mock<IUlnValidator> MockUlnValidator = new Mock<IUlnValidator>();
protected ApprenticeshipViewModelValidator Validator;
protected ApprenticeshipViewModel ValidModel;
[SetUp]
public void BaseSetup()
{
CurrentDateTime.Setup(x => x.Now).Returns(DateTime.Now.AddMonths(6));
Validator = new ApprenticeshipViewModelValidator(
//todo: mock the interface
new WebApprenticeshipValidationText(new AcademicYearDateProvider(CurrentDateTime.Object)),
CurrentDateTime.Object,
new AcademicYearDateProvider(CurrentDateTime.Object),
MockUlnValidator.Object);
ValidModel = new ApprenticeshipViewModel { ULN = "1001234567", FirstName = "TestFirstName", LastName = "TestLastName" };
}
}
}
| mit | C# |
da61584ee8352aedc0ab6051a9f8595ce2369724 | Update canvas to use IWpfWidget | directhex/xwt,antmicro/xwt,iainx/xwt,mminns/xwt,hamekoz/xwt,residuum/xwt,mono/xwt,cra0zy/xwt,hwthomas/xwt,TheBrainTech/xwt,sevoku/xwt,lytico/xwt,mminns/xwt,steffenWi/xwt,akrisiun/xwt | Xwt.WPF/Xwt.WPFBackend/ExCanvas.cs | Xwt.WPF/Xwt.WPFBackend/ExCanvas.cs | //
// ExCanvas.cs
//
// Author:
// Eric Maupin <[email protected]>
//
// Copyright (c) 2012 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Windows.Media;
using WpfCanvas = System.Windows.Controls.Canvas;
namespace Xwt.WPFBackend
{
internal class ExCanvas
: WpfCanvas, IWpfWidget
{
public event EventHandler Render;
protected override void OnRender (System.Windows.Media.DrawingContext dc)
{
var render = Render;
if (render != null)
render (this, EventArgs.Empty);
base.OnRender (dc);
}
public WidgetBackend Backend
{
get;
set;
}
protected override System.Windows.Size MeasureOverride (System.Windows.Size constraint)
{
var s = base.MeasureOverride (constraint);
return Backend.MeasureOverride (constraint, s);
}
}
} | //
// ExCanvas.cs
//
// Author:
// Eric Maupin <[email protected]>
//
// Copyright (c) 2012 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Windows.Media;
using WpfCanvas = System.Windows.Controls.Canvas;
namespace Xwt.WPFBackend
{
internal class ExCanvas
: WpfCanvas
{
public event EventHandler Render;
protected override void OnRender (System.Windows.Media.DrawingContext dc)
{
var render = Render;
if (render != null)
render (this, EventArgs.Empty);
base.OnRender (dc);
}
}
} | mit | C# |
3306cc25a8f8ffc23ce2bee33d077173f4d03041 | Add Point.RotateAround | SaberSnail/GoldenAnvil.Utility | GoldenAnvil.Utility.Windows/PointUtility.cs | GoldenAnvil.Utility.Windows/PointUtility.cs | using System;
using System.Windows;
namespace GoldenAnvil.Utility.Windows
{
public static class PointUtility
{
public static Point WithOffset(this Point point, Point that)
{
return new Point(point.X + that.X, point.Y + that.Y);
}
public static double DistanceTo(this Point point, Point target)
{
var dx = point.X - target.X;
var dy = point.Y - target.Y;
return Math.Sqrt((dx * dx) + (dy * dy));
}
public static Vector VectorTo(this Point point, Point target)
{
return new Vector(target.X - point.X, target.Y - point.Y);
}
public static Point RotateAround(this Point point, Point center, double angleInRadians)
{
var cosA = Math.Cos(angleInRadians);
var sinA = Math.Sin(angleInRadians);
var x = point.X - center.X;
var y = point.Y - center.Y;
x = x * cosA - y * sinA;
y = x * sinA + y * cosA;
return new Point(x + center.X, y + center.Y);
}
}
}
| using System;
using System.Windows;
namespace GoldenAnvil.Utility.Windows
{
public static class PointUtility
{
public static Point WithOffset(this Point point, Point that)
{
return new Point(point.X + that.X, point.Y + that.Y);
}
public static double DistanceTo(this Point point, Point target)
{
var dx = point.X - target.X;
var dy = point.Y - target.Y;
return Math.Sqrt((dx * dx) + (dy * dy));
}
public static Vector VectorTo(this Point point, Point target)
{
return new Vector(target.X - point.X, target.Y - point.Y);
}
}
}
| mit | C# |
c69d7c185ecee08b912198ece5ab85e02283907b | use IsNull | the-ress/HarshPoint,NaseUkolyCZ/HarshPoint,HarshPoint/HarshPoint | HarshPoint/Provisioning/HarshContentType.cs | HarshPoint/Provisioning/HarshContentType.cs | using Microsoft.SharePoint.Client;
using System;
using System.Threading.Tasks;
namespace HarshPoint.Provisioning
{
public class HarshContentType : HarshProvisioner
{
public String Description
{
get;
set;
}
public String Group
{
get;
set;
}
public HarshContentTypeId Id
{
get;
set;
}
public String Name
{
get;
set;
}
public IResolveSingle<ContentType> ParentContentType
{
get;
set;
}
protected override async Task InitializeAsync()
{
await base.InitializeAsync();
ContentType = await ResolveAsync(ContentTypeResolver);
}
protected override async Task OnProvisioningAsync()
{
if (ContentType.IsNull())
{
ContentType = Web.ContentTypes.Add(new ContentTypeCreationInformation()
{
Description = Description,
Group = Group,
Id = Id?.ToString(),
ParentContentType = await ParentContentType?.ResolveSingleAsync(Context),
Name = Name,
});
await ClientContext.ExecuteQueryAsync();
}
await base.OnProvisioningAsync();
}
protected override HarshProvisionerContext CreateChildrenContext()
{
if (!ContentType.IsNull())
{
return Context.PushState(ContentType);
}
return base.CreateChildrenContext();
}
private ContentType ContentType
{
get;
set;
}
private IResolveSingle<ContentType> ContentTypeResolver
=> Resolve.ContentTypeById(Id);
}
}
| using Microsoft.SharePoint.Client;
using System;
using System.Threading.Tasks;
namespace HarshPoint.Provisioning
{
public class HarshContentType : HarshProvisioner
{
public String Description
{
get;
set;
}
public String Group
{
get;
set;
}
public HarshContentTypeId Id
{
get;
set;
}
public String Name
{
get;
set;
}
public IResolveSingle<ContentType> ParentContentType
{
get;
set;
}
protected override async Task InitializeAsync()
{
await base.InitializeAsync();
ContentType = await ResolveAsync(ContentTypeResolver);
}
protected override async Task OnProvisioningAsync()
{
if (ContentType.IsNull())
{
ContentType = Web.ContentTypes.Add(new ContentTypeCreationInformation()
{
Description = Description,
Group = Group,
Id = Id?.ToString(),
ParentContentType = await ParentContentType?.ResolveSingleAsync(Context),
Name = Name,
});
await ClientContext.ExecuteQueryAsync();
}
await base.OnProvisioningAsync();
}
protected override HarshProvisionerContext CreateChildrenContext()
{
if (ContentType != null)
{
return Context.PushState(ContentType);
}
return base.CreateChildrenContext();
}
private ContentType ContentType
{
get;
set;
}
private IResolveSingle<ContentType> ContentTypeResolver
=> Resolve.ContentTypeById(Id);
}
}
| bsd-2-clause | C# |
074de6dd793d90061997f2ac8f9f0c8e1fdacdb8 | Update to 2.0.0 | GMJS/gmjs_ocs_dpt | IPOCS_Programmer/Properties/AssemblyInfo.cs | IPOCS_Programmer/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("IPOCS_Programmer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IPOCS_Programmer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//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.0.0.0")]
[assembly: AssemblyFileVersion("2.0.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("IPOCS_Programmer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IPOCS_Programmer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| mit | C# |
d808201e8fb33c3cc7c81b5730baec4446d9a3e3 | Fix use of `ContinueHandlerBase` (has `Base` suffix now) | PowerShell/PowerShellEditorServices | src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebuggerActionHandlers.cs | src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebuggerActionHandlers.cs | //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.PowerShell.EditorServices.Services;
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
using OmniSharp.Extensions.JsonRpc;
namespace Microsoft.PowerShell.EditorServices.Handlers
{
// TODO: Inherit from ABCs instead of satisfying interfaces.
internal class DebuggerActionHandlers : IContinueHandler, INextHandler, IPauseHandler, IStepInHandler, IStepOutHandler
{
private readonly ILogger _logger;
private readonly DebugService _debugService;
public DebuggerActionHandlers(
ILoggerFactory loggerFactory,
DebugService debugService)
{
_logger = loggerFactory.CreateLogger<ContinueHandlerBase>();
_debugService = debugService;
}
public Task<ContinueResponse> Handle(ContinueArguments request, CancellationToken cancellationToken)
{
_debugService.Continue();
return Task.FromResult(new ContinueResponse());
}
public Task<NextResponse> Handle(NextArguments request, CancellationToken cancellationToken)
{
_debugService.StepOver();
return Task.FromResult(new NextResponse());
}
public Task<PauseResponse> Handle(PauseArguments request, CancellationToken cancellationToken)
{
try
{
_debugService.Break();
return Task.FromResult(new PauseResponse());
}
catch(NotSupportedException e)
{
throw new RpcErrorException(0, e.Message);
}
}
public Task<StepInResponse> Handle(StepInArguments request, CancellationToken cancellationToken)
{
_debugService.StepIn();
return Task.FromResult(new StepInResponse());
}
public Task<StepOutResponse> Handle(StepOutArguments request, CancellationToken cancellationToken)
{
_debugService.StepOut();
return Task.FromResult(new StepOutResponse());
}
}
}
| //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.PowerShell.EditorServices.Services;
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
using OmniSharp.Extensions.JsonRpc;
namespace Microsoft.PowerShell.EditorServices.Handlers
{
internal class DebuggerActionHandlers : IContinueHandler, INextHandler, IPauseHandler, IStepInHandler, IStepOutHandler
{
private readonly ILogger _logger;
private readonly DebugService _debugService;
public DebuggerActionHandlers(
ILoggerFactory loggerFactory,
DebugService debugService)
{
_logger = loggerFactory.CreateLogger<ContinueHandler>();
_debugService = debugService;
}
public Task<ContinueResponse> Handle(ContinueArguments request, CancellationToken cancellationToken)
{
_debugService.Continue();
return Task.FromResult(new ContinueResponse());
}
public Task<NextResponse> Handle(NextArguments request, CancellationToken cancellationToken)
{
_debugService.StepOver();
return Task.FromResult(new NextResponse());
}
public Task<PauseResponse> Handle(PauseArguments request, CancellationToken cancellationToken)
{
try
{
_debugService.Break();
return Task.FromResult(new PauseResponse());
}
catch(NotSupportedException e)
{
throw new RpcErrorException(0, e.Message);
}
}
public Task<StepInResponse> Handle(StepInArguments request, CancellationToken cancellationToken)
{
_debugService.StepIn();
return Task.FromResult(new StepInResponse());
}
public Task<StepOutResponse> Handle(StepOutArguments request, CancellationToken cancellationToken)
{
_debugService.StepOut();
return Task.FromResult(new StepOutResponse());
}
}
}
| mit | C# |
ad5a0a3f62e517f6842b0465f7d31b661e232c4b | Add ColorX.ToArgb extension method. | eylvisaker/AgateLib | AgateLib.UnitTests/Display/ColorXTests.cs | AgateLib.UnitTests/Display/ColorXTests.cs | using AgateLib.Display;
using FluentAssertions;
using Microsoft.Xna.Framework;
using Xunit;
namespace AgateLib.Tests.Display
{
public class ColorXTests
{
[Fact]
public void ToArgb()
{
var clr = new Color(0x12, 0x34, 0x56, 078);
clr.ToArgb().Should().Be("12345678");
}
}
}
| using AgateLib.Display;
using FluentAssertions;
using Microsoft.Xna.Framework;
using Xunit;
namespace AgateLib.Tests.Display
{
public class ColorXTests
{
[Fact]
public void ToArgb()
{
var clr = new Color(0x12, 0x34, 0x56, 0x78);
clr.ToArgb().Should().Be("78123456");
}
}
}
| mit | C# |
27abb6e0100a0d6486e01feebbd47a1a4a10e26b | add feature proposal | amiralles/contest,amiralles/contest | src/Contest.Bugs/DuplicateSetups.cs | src/Contest.Bugs/DuplicateSetups.cs | using _ = System.Action<Contest.Core.Runner>;
using static System.Console;
/*
class feature_proposal {
// runs only once before any test within the containing class.
_ before_any = test => { ; };
// runs only once per class upon fixture completion.
_ after_all = test => {; };
}
*/
class fixure_wide_setup_teardown {
_ before_each = test => { WriteLine(">>>> fixture setup"); };
_ after_each = test => { WriteLine(">>>> fixture teardown"); };
_ foo = assert => assert.Pass();
_ bar = assert => assert.Pass();
}
class case_specific_setup_teardown {
_ before_foo = test => { WriteLine(">>>> foo setup"); };
_ after_foo = test => { WriteLine(">>>> foo teardown"); };
_ foo = assert => assert.Pass();
_ baz = assert => assert.Pass();
_ bazzinga = assert => assert.Pass();
}
| using _ = System.Action<Contest.Core.Runner>;
using static System.Console;
class fixure_wide_setup_teardown {
_ before_each = test => { WriteLine(">>>> fixture setup"); };
_ after_each = test => { WriteLine(">>>> fixture teardown"); };
_ foo = assert => assert.Pass();
_ bar = assert => assert.Pass();
}
class case_specific_setup_teardown {
_ before_foo = test => { WriteLine(">>>> foo setup"); };
_ after_foo = test => { WriteLine(">>>> foo teardown"); };
_ foo = assert => assert.Pass();
_ baz = assert => assert.Pass();
_ bazzinga = assert => assert.Pass();
}
| mit | C# |
8f25b0acc398af1d138d676c0dabfa016d36e61b | Update confusing GitVersionVerbosity docs | cake-build/cake,mholo65/cake,devlead/cake,mholo65/cake,devlead/cake,patriksvensson/cake,gep13/cake,cake-build/cake,patriksvensson/cake,gep13/cake | src/Cake.Common/Tools/GitVersion/GitVersionVerbosity.cs | src/Cake.Common/Tools/GitVersion/GitVersionVerbosity.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.
namespace Cake.Common.Tools.GitVersion
{
/// <summary>
/// The GitVersion verbosity.
/// </summary>
public enum GitVersionVerbosity
{
/// <summary>
/// No messages will be logged.
/// </summary>
None,
/// <summary>
/// Log error messages.
/// </summary>
Error,
/// <summary>
/// Log error and warning messages.
/// </summary>
Warn,
/// <summary>
/// Log error, warning and info messages.
/// </summary>
Info,
/// <summary>
/// Log error, warning, info and debug messages (log all).
/// </summary>
Debug
}
}
| // 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.
namespace Cake.Common.Tools.GitVersion
{
/// <summary>
/// The GitVersion verbosity.
/// </summary>
public enum GitVersionVerbosity
{
/// <summary>
/// No messages will be logged.
/// </summary>
None,
/// <summary>
/// Only log error messages.
/// </summary>
Error,
/// <summary>
/// Only log wanring messages.
/// </summary>
Warn,
/// <summary>
/// Only log info messages.
/// </summary>
Info,
/// <summary>
/// Only log debug messages.
/// </summary>
Debug
}
} | mit | C# |
1d831467b5238b19c16541c4ac839dc7593ee7cd | fix position bouton jouer | dethi/troma | src/Arrow/Arrow/Menu/MenuStart.cs | src/Arrow/Arrow/Menu/MenuStart.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Arrow
{
class MenuStart : Menu
{
public bool GameStart { get; private set; }
private Rectangle rectangle;
Texture2D fond;
private Button boutonJouer;
public MenuStart(Game game)
: base(game)
{
rectangle = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height);
}
public override void Initialize()
{
GameStart = false;
fond = game.Content.Load<Texture2D>("Textures/debarquement");
Delegate jouerDelegate = new Delegate(Jouer);
boutonJouer = (new Button(game, (game.GraphicsDevice.Viewport.Width / 2) - 125, (game.GraphicsDevice.Viewport.Height / 2) - 50 - 100, 250, 100,
"boutonJouerOff", "boutonJouer", jouerDelegate, 1));
boutonJouer.Initialize();
base.Initialize();
}
public override void Update(GameTime gameTime)
{
if (DisplayMenu)
boutonJouer.Update(gameTime);
base.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
if (DisplayMenu)
{
this.spriteBatch.Begin();
this.spriteBatch.Draw(fond, rectangle, Color.White * 1f);
this.spriteBatch.End();
boutonJouer.Draw(gameTime);
}
}
public void Jouer()
{
GameStart = true;
DisplayMenu = !DisplayMenu;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Arrow
{
class MenuStart : Menu
{
public bool GameStart { get; private set; }
private Rectangle rectangle;
Texture2D fond;
private Button boutonJouer;
public MenuStart(Game game)
: base(game)
{
rectangle = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height);
}
public override void Initialize()
{
GameStart = false;
fond = game.Content.Load<Texture2D>("Textures/debarquement");
Delegate jouerDelegate = new Delegate(Jouer);
boutonJouer = (new Button(game, (game.GraphicsDevice.Viewport.Width / 2) - 125, (game.GraphicsDevice.Viewport.Height / 2) - 50 - 70, 250, 100,
"boutonJouerOff", "boutonJouer", jouerDelegate, 1));
boutonJouer.Initialize();
base.Initialize();
}
public override void Update(GameTime gameTime)
{
if (DisplayMenu)
boutonJouer.Update(gameTime);
base.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
if (DisplayMenu)
{
this.spriteBatch.Begin();
this.spriteBatch.Draw(fond, rectangle, Color.White * 1f);
this.spriteBatch.End();
boutonJouer.Draw(gameTime);
}
}
public void Jouer()
{
GameStart = true;
DisplayMenu = !DisplayMenu;
}
}
}
| mit | C# |
44e059061365ad21fb624792bdaa8e33f9722bc0 | Throw exception on unsupported exception | mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard | src/Okanshi.Dashboard/GetMetrics.cs | src/Okanshi.Dashboard/GetMetrics.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Okanshi.Dashboard.Models;
namespace Okanshi.Dashboard
{
public interface IGetMetrics
{
IEnumerable<Metric> Execute(string instanceName);
}
public class GetMetrics : IGetMetrics
{
private readonly IStorage _storage;
public GetMetrics(IStorage storage)
{
_storage = storage;
}
public IEnumerable<Metric> Execute(string instanceName)
{
var webClient = new WebClient();
var response = webClient.DownloadString(_storage.GetAll().Single(x => x.Name.Equals(instanceName, StringComparison.OrdinalIgnoreCase)).Url);
var jObject = JObject.Parse(response);
JToken versionToken;
jObject.TryGetValue("version", out versionToken);
var version = "0";
if (versionToken != null && versionToken.HasValues)
{
version = versionToken.Value<string>();
}
if (version.Equals("0", StringComparison.OrdinalIgnoreCase))
{
var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, dynamic>>(response);
return deserializeObject
.Select(x => new Metric
{
Name = x.Key,
Measurements = x.Value.measurements.ToObject<IEnumerable<Measurement>>(),
WindowSize = x.Value.windowSize.ToObject<float>()
});
}
throw new InvalidOperationException("Not supported version");
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Okanshi.Dashboard.Models;
namespace Okanshi.Dashboard
{
public interface IGetMetrics
{
IEnumerable<Metric> Execute(string instanceName);
}
public class GetMetrics : IGetMetrics
{
private readonly IStorage _storage;
public GetMetrics(IStorage storage)
{
_storage = storage;
}
public IEnumerable<Metric> Execute(string instanceName)
{
var webClient = new WebClient();
var response = webClient.DownloadString(_storage.GetAll().Single(x => x.Name.Equals(instanceName, StringComparison.OrdinalIgnoreCase)).Url);
var jObject = JObject.Parse(response);
JToken versionToken;
jObject.TryGetValue("version", out versionToken);
var version = "0";
if (versionToken != null && versionToken.HasValues)
{
version = versionToken.Value<string>();
}
if (version.Equals("0", StringComparison.OrdinalIgnoreCase))
{
var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, dynamic>>(response);
return deserializeObject
.Select(x => new Metric
{
Name = x.Key,
Measurements = x.Value.measurements.ToObject<IEnumerable<Measurement>>(),
WindowSize = x.Value.windowSize.ToObject<float>()
});
}
return Enumerable.Empty<Metric>();
}
}
} | mit | C# |
f4c089d2920c518d9d8159b6e3b4814d3a3fb4b8 | add more tests | martinlindhe/Punku | PunkuTests/Extensions/StringExtensions.cs | PunkuTests/Extensions/StringExtensions.cs | using System;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Extensions")]
public class Extensions_String
{
[Test]
public void Repeat01 ()
{
Assert.AreEqual ("hej".Repeat (2), "hejhej");
}
[Test]
public void Repeat02 ()
{
Assert.AreEqual ("häj".Repeat (2), "häjhäj");
}
[Test]
public void Count01 ()
{
Assert.AreEqual ("haj".Count ('a'), 1);
}
[Test]
public void Count02 ()
{
Assert.AreEqual ("haaj".Count ('a'), 2);
}
[Test]
public void Count03 ()
{
Assert.AreEqual ("häj".Count ('a'), 0);
}
[Test]
public void Count04 ()
{
Assert.AreEqual ("haj".Count ('ä'), 0);
}
[Test]
public void NumbersOnly01 ()
{
Assert.AreEqual ("123".IsNumbersOnly (), true);
}
[Test]
public void NumbersOnly02 ()
{
Assert.AreEqual ("".IsNumbersOnly (), false);
}
[Test]
public void NumbersOnly03 ()
{
Assert.AreEqual ("12a".IsNumbersOnly (), false);
}
[Test]
public void NumbersOnly04 ()
{
Assert.AreEqual ("1 ".IsNumbersOnly (), false);
}
[Test]
public void NumbersOnly05 ()
{
Assert.AreEqual (" 1".IsNumbersOnly (), false);
}
[Test]
public void Alphanumeric01 ()
{
Assert.AreEqual ("".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric02 ()
{
Assert.AreEqual (" ".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric03 ()
{
Assert.AreEqual ("1abcEEs".IsAlphanumeric (), true);
}
[Test]
public void Alphanumeric04 ()
{
Assert.AreEqual ("ab-".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric05 ()
{
Assert.AreEqual ("'".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric06 ()
{
Assert.AreEqual ("ab'".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric07 ()
{
Assert.AreEqual ("abå".IsAlphanumeric (), false);
}
[Test]
public void NumbersOnly06 ()
{
Assert.AreEqual ("1".IsNumbersOnly (), true);
}
[Test]
public void Palindrome01 ()
{
Assert.AreEqual ("".IsPalindrome (), false);
}
[Test]
public void Palindrome02 ()
{
Assert.AreEqual (" ".IsPalindrome (), false);
}
[Test]
public void Palindrome03 ()
{
Assert.AreEqual ("racecar".IsPalindrome (), true);
}
[Test]
public void Palindrome04 ()
{
Assert.AreEqual ("hello".IsPalindrome (), false);
}
} | using System;
using NUnit.Framework;
using Punku;
[TestFixture]
[Category ("Extensions")]
public class Extensions_String
{
[Test]
public void Repeat01 ()
{
Assert.AreEqual ("hej".Repeat (2), "hejhej");
}
[Test]
public void Repeat02 ()
{
Assert.AreEqual ("häj".Repeat (2), "häjhäj");
}
[Test]
public void Count01 ()
{
Assert.AreEqual ("haj".Count ('a'), 1);
}
[Test]
public void Count02 ()
{
Assert.AreEqual ("haaj".Count ('a'), 2);
}
[Test]
public void Count03 ()
{
Assert.AreEqual ("häj".Count ('a'), 0);
}
[Test]
public void Count04 ()
{
Assert.AreEqual ("haj".Count ('ä'), 0);
}
[Test]
public void NumbersOnly01 ()
{
Assert.AreEqual ("123".IsNumbersOnly (), true);
}
[Test]
public void NumbersOnly02 ()
{
Assert.AreEqual ("".IsNumbersOnly (), false);
}
[Test]
public void NumbersOnly03 ()
{
Assert.AreEqual ("12a".IsNumbersOnly (), false);
}
[Test]
public void NumbersOnly04 ()
{
Assert.AreEqual ("1 ".IsNumbersOnly (), false);
}
[Test]
public void NumbersOnly05 ()
{
Assert.AreEqual (" 1".IsNumbersOnly (), false);
}
[Test]
public void Alphanumeric01 ()
{
Assert.AreEqual ("".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric02 ()
{
Assert.AreEqual (" ".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric03 ()
{
Assert.AreEqual ("1abcEEs".IsAlphanumeric (), true);
}
[Test]
public void Alphanumeric04 ()
{
Assert.AreEqual ("ab-".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric05 ()
{
Assert.AreEqual ("'".IsAlphanumeric (), false);
}
[Test]
public void Alphanumeric06 ()
{
Assert.AreEqual ("ab'".IsAlphanumeric (), false);
}
[Test]
public void NumbersOnly06 ()
{
Assert.AreEqual ("1".IsNumbersOnly (), true);
}
[Test]
public void Palindrome01 ()
{
Assert.AreEqual ("".IsPalindrome (), false);
}
[Test]
public void Palindrome02 ()
{
Assert.AreEqual ("racecar".IsPalindrome (), true);
}
[Test]
public void Palindrome03 ()
{
Assert.AreEqual ("hello".IsPalindrome (), false);
}
} | mit | C# |
6d35dce2182f2662bb73f1bd15bbecb733f78d7c | Update Ignored attribute on Person in Android playground | Shaddix/realm-dotnet,realm/realm-dotnet,realm/realm-dotnet,realm/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet | Tests/Playground.XamarinAndroid/Person.cs | Tests/Playground.XamarinAndroid/Person.cs | /* Copyright 2015 Realm Inc - All Rights Reserved
* Proprietary and Confidential
*/
using System;
using RealmNet;
namespace Playground.XamarinAndroid
{
public class Person : RealmObject
{
// Automatically implemented (overridden) properties
public string FirstName { get; set; }
public string LastName { get; set; }
// Ignored property
[Ignored]
public bool IsOnline { get; set; }
// Composite property
[Ignored]
public string FullName
{
get { return FirstName + " " + LastName; }
set
{
var parts = value.Split(' ');
FirstName = parts[0];
LastName = parts[parts.Length - 1];
}
}
public string Email { get; set; }
// // Re-mapped property
// [MapTo("Email")]
// private string Email_ { get; set; }
//
// // Wrapped version of previous property
// [Ignore]
// public string Email
// {
// get { return Email_; }
// set {
// if (!value.Contains("@")) throw new Exception("Invalid email address");
// Email_ = value;
// }
// }
public bool IsInteresting { get; set; }
}
}
| /* Copyright 2015 Realm Inc - All Rights Reserved
* Proprietary and Confidential
*/
using System;
using RealmNet;
namespace Playground.XamarinAndroid
{
public class Person : RealmObject
{
// Automatically implemented (overridden) properties
public string FirstName { get; set; }
public string LastName { get; set; }
// Ignored property
[Ignore]
public bool IsOnline { get; set; }
// Composite property
[Ignore]
public string FullName
{
get { return FirstName + " " + LastName; }
set
{
var parts = value.Split(' ');
FirstName = parts[0];
LastName = parts[parts.Length - 1];
}
}
public string Email { get; set; }
// // Re-mapped property
// [MapTo("Email")]
// private string Email_ { get; set; }
//
// // Wrapped version of previous property
// [Ignore]
// public string Email
// {
// get { return Email_; }
// set {
// if (!value.Contains("@")) throw new Exception("Invalid email address");
// Email_ = value;
// }
// }
public bool IsInteresting { get; set; }
}
}
| apache-2.0 | C# |
e1910eb3c45d7e17a27e92cc7549b9b6f508277c | Remove specifying working directory by hand | cmr/VisualRust,vadimcn/VisualRust,Stitchous/VisualRust,xilec/VisualRust,Boddlnagg/VisualRust,Muraad/VisualRust,Muraad/VisualRust,vosen/VisualRust,drewet/VisualRust,tempbottle/VisualRust,PistonDevelopers/VisualRust,tempbottle/VisualRust,vosen/VisualRust,dlsteuer/VisualRust,PistonDevelopers/VisualRust,yacoder/VisualRust,Connorcpu/VisualRust,cmr/VisualRust,drewet/VisualRust,xilec/VisualRust,vadimcn/VisualRust,Vbif/VisualRust,Vbif/VisualRust,Stitchous/VisualRust,dlsteuer/VisualRust,yacoder/VisualRust,Connorcpu/VisualRust,Boddlnagg/VisualRust | VisualRust.Project/DefaultRustLauncher.cs | VisualRust.Project/DefaultRustLauncher.cs | using System;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio;
using Microsoft.VisualStudioTools;
using Microsoft.VisualStudioTools.Project;
namespace VisualRust.Project
{
/// <summary>
/// Simple realization of project launcher for executable file
/// TODO need realize for library
/// </summary>
sealed class DefaultRustLauncher : IProjectLauncher
{
private readonly RustProjectNode _project;
public DefaultRustLauncher(RustProjectNode project)
{
Utilities.ArgumentNotNull("project", project);
_project = project;
}
public int LaunchProject(bool debug)
{
var startupFilePath = GetProjectStartupFile();
return LaunchFile(startupFilePath, debug);
}
private string GetProjectStartupFile()
{
var startupFilePath = Path.Combine(_project.GetProjectProperty("TargetDir"), _project.GetProjectProperty("TargetFileName"));
//var startupFilePath = _project.GetStartupFile();
if (string.IsNullOrEmpty(startupFilePath))
{
throw new ApplicationException("Startup file is not defined in project");
}
return startupFilePath;
}
public int LaunchFile(string file, bool debug)
{
StartWithoutDebugger(file);
return VSConstants.S_OK;
}
private void StartWithoutDebugger(string startupFile)
{
var processStartInfo = CreateProcessStartInfoNoDebug(startupFile);
Process.Start(processStartInfo);
}
private ProcessStartInfo CreateProcessStartInfoNoDebug(string startupFile)
{
// TODO add command line arguments
var commandLineArgs = string.Empty;
var startInfo = new ProcessStartInfo(startupFile, commandLineArgs);
startInfo.UseShellExecute = false;
return startInfo;
}
}
} | using System;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio;
using Microsoft.VisualStudioTools;
using Microsoft.VisualStudioTools.Project;
namespace VisualRust.Project
{
/// <summary>
/// Simple realization of project launcher for executable file
/// TODO need realize for library
/// </summary>
sealed class DefaultRustLauncher : IProjectLauncher
{
private readonly RustProjectNode _project;
public DefaultRustLauncher(RustProjectNode project)
{
Utilities.ArgumentNotNull("project", project);
_project = project;
}
public int LaunchProject(bool debug)
{
var startupFilePath = GetProjectStartupFile();
return LaunchFile(startupFilePath, debug);
}
private string GetProjectStartupFile()
{
var startupFilePath = Path.Combine(_project.GetProjectProperty("TargetDir"), _project.GetProjectProperty("TargetFileName"));
//var startupFilePath = _project.GetStartupFile();
if (string.IsNullOrEmpty(startupFilePath))
{
throw new ApplicationException("Startup file is not defined in project");
}
return startupFilePath;
}
public int LaunchFile(string file, bool debug)
{
StartWithoutDebugger(file);
return VSConstants.S_OK;
}
private void StartWithoutDebugger(string startupFile)
{
var processStartInfo = CreateProcessStartInfoNoDebug(startupFile);
Process.Start(processStartInfo);
}
private ProcessStartInfo CreateProcessStartInfoNoDebug(string startupFile)
{
// TODO add command line arguments
var commandLineArgs = string.Empty;
var startInfo = new ProcessStartInfo(startupFile, commandLineArgs);
startInfo.UseShellExecute = false;
startInfo.WorkingDirectory = _project.GetWorkingDirectory();
return startInfo;
}
}
} | mit | C# |
18b9a7fc9d05920547b1770da88f18cb4b572e57 | Add tests to Common\Infrastructure\tests for TestProperties | imcarolwang/wcf,hongdai/wcf,khdang/wcf,mconnew/wcf,iamjasonp/wcf,StephenBonikowsky/wcf,hongdai/wcf,ericstj/wcf,shmao/wcf,imcarolwang/wcf,zhenlan/wcf,zhenlan/wcf,imcarolwang/wcf,mconnew/wcf,dotnet/wcf,dotnet/wcf,dotnet/wcf,ericstj/wcf,StephenBonikowsky/wcf,iamjasonp/wcf,KKhurin/wcf,shmao/wcf,ElJerry/wcf,KKhurin/wcf,MattGal/wcf,MattGal/wcf,ElJerry/wcf,mconnew/wcf,khdang/wcf | src/System.Private.ServiceModel/tests/Common/Infrastructure/tests/TestPropertiesTest.cs | src/System.Private.ServiceModel/tests/Common/Infrastructure/tests/TestPropertiesTest.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Infrastructure.Common;
using Xunit;
public static class TestPropertiesTest
{
[Fact]
public static void TestProperties_Property_Names_Are_Initialized()
{
// Test property names are auto-generated.
// This test will fail to compile if these names are not generated.
// It is not necessary to test all the known properties, just to
// test that property name code generation occurred.
Assert.NotNull(TestProperties.BridgeResourceFolder_PropertyName);
Assert.NotNull(TestProperties.BridgeHost_PropertyName);
Assert.NotNull(TestProperties.BridgePort_PropertyName);
Assert.NotNull(TestProperties.UseFiddlerUrl_PropertyName);
Assert.NotNull(TestProperties.NegotiateTestDomain_PropertyName);
Assert.NotNull(TestProperties.NegotiateTestUserName_PropertyName);
Assert.NotNull(TestProperties.NegotiateTestPassword_PropertyName);
}
[Fact]
public static void TestProperties_PropertyNames_Property_Returns_List()
{
IEnumerable<string> propertyNames = TestProperties.PropertyNames;
Assert.NotNull(propertyNames);
Assert.True(propertyNames.Any());
}
[Fact]
public static void TestProperties_All_Properties_Have_Values()
{
IEnumerable<string> propertyNames = TestProperties.PropertyNames;
foreach(var name in propertyNames)
{
string value = TestProperties.GetProperty(name);
Assert.True(value != null, String.Format("Property '{0}' should not be null.", name));
}
}
[Fact]
public static void TestProperties_Throw_ArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() => TestProperties.GetProperty(null));
}
[Fact]
public static void TestProperties_Throw_KeyNotFoundException()
{
Assert.Throws<KeyNotFoundException>(() => TestProperties.GetProperty("NotAProperty"));
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Infrastructure.Common;
using Xunit;
public static class TestPropertiesTest
{
[Fact]
public static void TestProperties_Property_Names_Are_Initialized()
{
// Test property names are auto-generated.
// This test will fail to compile if these names are not generated.
// It is not necessary to test all the known properties, just to
// test that property name code generation occurred.
Assert.NotNull(TestProperties.BridgeResourceFolder_PropertyName);
Assert.NotNull(TestProperties.BridgeHost_PropertyName);
Assert.NotNull(TestProperties.BridgePort_PropertyName);
Assert.NotNull(TestProperties.UseFiddlerUrl_PropertyName);
}
[Fact]
public static void TestProperties_PropertyNames_Property_Returns_List()
{
IEnumerable<string> propertyNames = TestProperties.PropertyNames;
Assert.NotNull(propertyNames);
Assert.True(propertyNames.Any());
}
[Fact]
public static void TestProperties_All_Properties_Have_Values()
{
IEnumerable<string> propertyNames = TestProperties.PropertyNames;
foreach(var name in propertyNames)
{
string value = TestProperties.GetProperty(name);
Assert.True(value != null, String.Format("Property '{0}' should not be null.", name));
}
}
[Fact]
public static void TestProperties_Throw_ArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() => TestProperties.GetProperty(null));
}
[Fact]
public static void TestProperties_Throw_KeyNotFoundException()
{
Assert.Throws<KeyNotFoundException>(() => TestProperties.GetProperty("NotAProperty"));
}
}
| mit | C# |
e0fb9a48f36a28b454b2ddc518b0cdc665596fe5 | Fix parsing of mono-service's own arguments by ignoring them during command line arguments parsing. | pruiz/Topshelf.Linux,NoesisLabs/Topshelf.Linux | Topshelf.Linux/MonoHelper.cs | Topshelf.Linux/MonoHelper.cs | #region license
// Copyright 2013 - Pablo Ruiz Garcia <pablo.ruiz at 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;
using System.Linq;
using System.Runtime.InteropServices;
namespace Topshelf.Runtime.Linux
{
internal static class MonoHelper
{
[DllImport("libc")]
private static extern uint getuid();
public static bool RunningAsRoot
{
// TODO: Use Mono.Unix instead (it's safer)
get { return getuid() == 0; }
}
public static bool RunningOnMono
{
get
{
Type t = Type.GetType("Mono.Runtime");
if (t != null)
return true;
return false;
}
}
public static bool RunninOnUnix
{
get
{
int p = (int)Environment.OSVersion.Platform;
return ((p == 4) || (p == 6) || (p == 128));
}
}
public static bool RunninOnLinux
{
get
{
int p = (int)Environment.OSVersion.Platform;
return ((p == 4) || (p == 128));
}
}
public static string GetUnparsedCommandLine()
{
var args = new Stack<string>((Environment.GetCommandLineArgs() ?? new string[]{ }).Reverse());
string commandLine = Environment.CommandLine;
string exeName = args.Peek();
// If we are not being run under mono-service, just return.
// NOTE: mono-service.exe passes itself as first arg.
if (exeName == null || !exeName.EndsWith("mono-service.exe"))
{
return commandLine;
}
// strip mono-service.exe + arguments from cmdline.
commandLine = commandLine.Substring(exeName.Length).TrimStart();
do
{
args.Pop();
} while (args.Count > 0 && args.Peek().StartsWith("-"));
exeName = args.Peek();
// Now strip real program's executable name from cmdline.
// Let's try first with a quoted executable..
var qExeName = "\"" + exeName + "\"";
if (commandLine.IndexOf(qExeName) > 0)
{
commandLine = commandLine.Substring(commandLine.IndexOf(qExeName) + qExeName.Length);
}
else
{
commandLine = commandLine.Substring(commandLine.IndexOf(exeName) + exeName.Length);
}
return (commandLine ?? "").Trim();
}
}
}
| #region license
// Copyright 2013 - Pablo Ruiz Garcia <pablo.ruiz at 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.Linq;
using System.Runtime.InteropServices;
namespace Topshelf.Runtime.Linux
{
internal static class MonoHelper
{
[DllImport("libc")]
private static extern uint getuid();
public static bool RunningAsRoot
{
// TODO: Use Mono.Unix instead (it's safer)
get { return getuid() == 0; }
}
public static bool RunningOnMono
{
get
{
Type t = Type.GetType("Mono.Runtime");
if (t != null)
return true;
return false;
}
}
public static bool RunninOnUnix
{
get
{
int p = (int)Environment.OSVersion.Platform;
return ((p == 4) || (p == 6) || (p == 128));
}
}
public static bool RunninOnLinux
{
get
{
int p = (int)Environment.OSVersion.Platform;
return ((p == 4) || (p == 128));
}
}
public static string GetUnparsedCommandLine()
{
var args = Environment.GetCommandLineArgs();
string commandLine = Environment.CommandLine;
string str2 = args.First<string>();
// mono-service.exe passes itself as first arg.
if (str2 != null && str2.EndsWith("mono-service.exe"))
{
commandLine = commandLine.Substring(str2.Length).TrimStart();
str2 = args.ElementAt(1);
}
if (commandLine == str2)
{
return "";
}
if (commandLine.Substring(0, str2.Length) == str2)
{
return commandLine.Substring(str2.Length);
}
string str3 = "\"" + str2 + "\"";
if (commandLine.Substring(0, str3.Length) == str3)
{
return commandLine.Substring(str3.Length);
}
return commandLine;
}
}
}
| apache-2.0 | C# |
c09f97e8cece43b47b2e1a31e5f6c951091d21cf | Update src/TestStack.Seleno.Tests/PageObjects/Actions/Controls/When_updating_TextBox_value.cs | dennisroche/TestStack.Seleno,dennisroche/TestStack.Seleno,random82/TestStack.Seleno,bendetat/TestStack.Seleno,random82/TestStack.Seleno,TestStack/TestStack.Seleno,bendetat/TestStack.Seleno,TestStack/TestStack.Seleno | src/TestStack.Seleno.Tests/PageObjects/Actions/Controls/When_updating_TextBox_value.cs | src/TestStack.Seleno.Tests/PageObjects/Actions/Controls/When_updating_TextBox_value.cs | using System;
using System.Globalization;
using NSubstitute;
using TestStack.Seleno.PageObjects.Controls;
namespace TestStack.Seleno.Tests.PageObjects.Actions.Controls
{
class When_updating_TextBox_value : HtmlControlSpecificationFor<TextBox>
{
private static readonly DateTime _the03rdOfJanuary2012At21h21 = new DateTime(2012, 01, 03, 21, 21, 00);
private readonly string _expectedScriptToBeExecuted =
string.Format("$('#Modified').val('{0}')",_the03rdOfJanuary2012At21h21.ToString(CultureInfo.CurrentCulture));
public When_updating_TextBox_value() : base(x => x.Modified) { }
public void When_updating_the_TextBox_value()
{
SUT.ReplaceInputValueWith(_the03rdOfJanuary2012At21h21);
}
public void Then_script_executor_should_execute_relevant_script_to_replace_the_value()
{
ScriptExecutor
.Received()
.ExecuteScript(_expectedScriptToBeExecuted);
}
}
}
| using System;
using NSubstitute;
using TestStack.Seleno.PageObjects.Controls;
namespace TestStack.Seleno.Tests.PageObjects.Actions.Controls
{
class When_updating_TextBox_value : HtmlControlSpecificationFor<TextBox>
{
private static readonly DateTime _the03rdOfJanuary2012At21h21 = new DateTime(2012, 01, 03, 21, 21, 00);
private readonly string _expectedScriptToBeExecuted =
string.Format("$('#Modified').val('{0}')",_the03rdOfJanuary2012At21h21.ToString(CultureInfo.CurrentCulture));
public When_updating_TextBox_value() : base(x => x.Modified) { }
public void When_updating_the_TextBox_value()
{
SUT.ReplaceInputValueWith(_the03rdOfJanuary2012At21h21);
}
public void Then_script_executor_should_execute_relevant_script_to_replace_the_value()
{
ScriptExecutor
.Received()
.ExecuteScript(_expectedScriptToBeExecuted);
}
}
}
| mit | C# |
e59e93941eb77e6e9a8de9bc7e1fe32d2fe6ffaa | use normalized point to display correct lat/lon | AkshayHarshe/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,Tyshark9/arcgis-runtime-samples-dotnet,sharifulgeo/arcgis-runtime-samples-dotnet,Esri/arcgis-runtime-samples-dotnet,Arc3D/arcgis-runtime-samples-dotnet | src/Phone/ArcGISRuntimeSDKDotNet_PhoneSamples/Samples/Geometry/ProjectCoordinate.xaml.cs | src/Phone/ArcGISRuntimeSDKDotNet_PhoneSamples/Samples/Geometry/ProjectCoordinate.xaml.cs | using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Layers;
using System;
using System.Threading.Tasks;
using Windows.UI.Popups;
using Windows.UI.Xaml;
namespace ArcGISRuntimeSDKDotNet_PhoneSamples.Samples
{
/// <summary>
/// Sample shows how to project a coordinate from the current map projection (in this case Web Mercator) to a different projection.
/// </summary>
/// <title>Project</title>
/// <category>Geometry</category>
public partial class ProjectCoordinate : Windows.UI.Xaml.Controls.Page
{
private GraphicsOverlay _graphicsOverlay;
/// <summary>Construct Project sample control</summary>
public ProjectCoordinate()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
// Start map interaction
private async void MyMapView_SpatialReferenceChanged(object sender, EventArgs e)
{
try
{
MyMapView.SpatialReferenceChanged -= MyMapView_SpatialReferenceChanged;
await AcceptPointsAsync();
}
catch (Exception ex)
{
var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
}
}
// Accept user map clicks and add points to the graphics layer with the selected symbol
// - collected point is in the coordinate system of the current map
private async Task AcceptPointsAsync()
{
while (MyMapView.Extent != null)
{
var point = await MyMapView.Editor.RequestPointAsync();
_graphicsOverlay.Graphics.Clear();
_graphicsOverlay.Graphics.Add(new Graphic(point));
// Take account of WrapAround
var normalizedPt = GeometryEngine.NormalizeCentralMeridian(point) as MapPoint;
// Convert from web mercator to WGS84
var projectedPoint = GeometryEngine.Project(normalizedPt, SpatialReferences.Wgs84);
gridXY.Visibility = gridLatLon.Visibility = Visibility.Visible;
gridXY.DataContext = point;
gridLatLon.DataContext = projectedPoint;
}
}
}
}
| using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Layers;
using System;
using System.Threading.Tasks;
using Windows.UI.Popups;
using Windows.UI.Xaml;
namespace ArcGISRuntimeSDKDotNet_PhoneSamples.Samples
{
/// <summary>
/// Sample shows how to project a coordinate from the current map projection (in this case Web Mercator) to a different projection.
/// </summary>
/// <title>Project</title>
/// <category>Geometry</category>
public partial class ProjectCoordinate : Windows.UI.Xaml.Controls.Page
{
private GraphicsOverlay _graphicsOverlay;
/// <summary>Construct Project sample control</summary>
public ProjectCoordinate()
{
InitializeComponent();
_graphicsOverlay = MyMapView.GraphicsOverlays["graphicsOverlay"];
MyMapView.SpatialReferenceChanged += MyMapView_SpatialReferenceChanged;
}
// Start map interaction
private async void MyMapView_SpatialReferenceChanged(object sender, EventArgs e)
{
try
{
MyMapView.SpatialReferenceChanged -= MyMapView_SpatialReferenceChanged;
await AcceptPointsAsync();
}
catch (Exception ex)
{
var _x = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
}
}
// Accept user map clicks and add points to the graphics layer with the selected symbol
// - collected point is in the coordinate system of the current map
private async Task AcceptPointsAsync()
{
while (MyMapView.Extent != null)
{
var point = await MyMapView.Editor.RequestPointAsync();
_graphicsOverlay.Graphics.Clear();
_graphicsOverlay.Graphics.Add(new Graphic(point));
// Take account of WrapAround
var normalizedPt = GeometryEngine.NormalizeCentralMeridian(point) as MapPoint;
// Convert from web mercator to WGS84
var projectedPoint = GeometryEngine.Project(point, SpatialReferences.Wgs84);
gridXY.Visibility = gridLatLon.Visibility = Visibility.Visible;
gridXY.DataContext = point;
gridLatLon.DataContext = projectedPoint;
}
}
}
}
| apache-2.0 | C# |
70e6d2194009336b976cd612ec4168604433c1c3 | Improve tests for RequestTracingMiddleware | alexanderkozlenko/oads,alexanderkozlenko/oads | src/WebTools.MicrosoftOffice.AddinHost.IntegrationTests/RequestTracingMiddlewareTests.cs | src/WebTools.MicrosoftOffice.AddinHost.IntegrationTests/RequestTracingMiddlewareTests.cs | using System.Diagnostics;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using WebTools.MicrosoftOffice.AddinHost.Middleware;
namespace WebTools.MicrosoftOffice.AddinHost.IntegrationTests
{
[TestClass]
public sealed class RequestTracingMiddlewareTests
{
[TestMethod]
public async Task TraceHttpRequestMessage()
{
var loggerMock = new Mock<Serilog.ILogger>(MockBehavior.Strict);
loggerMock
.Setup(o => o.Write(It.IsAny<Serilog.Events.LogEventLevel>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>()))
.Callback<Serilog.Events.LogEventLevel, string, int, string>((l, _, pv0, pv1) => Trace.WriteLine($"Level: '{l}', Value #0: '{pv0}', Value #1: '{pv1}'"));
var builder = new WebHostBuilder()
.ConfigureServices(sc => sc
.AddSingleton(loggerMock.Object)
.AddSingleton<RequestTracingMiddleware, RequestTracingMiddleware>())
.Configure(ab => ab
.UseMiddleware<RequestTracingMiddleware>());
using var server = new TestServer(builder);
using var client = server.CreateClient();
using var request = new HttpRequestMessage(HttpMethod.Get, server.BaseAddress);
using var response = await client.SendAsync(request);
loggerMock
.Verify(o => o.Write(It.IsAny<Serilog.Events.LogEventLevel>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>()), Times.Exactly(1));
}
}
}
| using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using WebTools.MicrosoftOffice.AddinHost.Middleware;
namespace WebTools.MicrosoftOffice.AddinHost.IntegrationTests
{
[TestClass]
public sealed class RequestTracingMiddlewareTests
{
[TestMethod]
public async Task Trace()
{
var loggerMock = new Mock<Serilog.ILogger>(MockBehavior.Strict);
loggerMock.Setup(o => o.Write(It.IsAny<Serilog.Events.LogEventLevel>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>()));
var builder = new WebHostBuilder()
.ConfigureServices(sc => sc
.AddSingleton(loggerMock.Object)
.AddSingleton<RequestTracingMiddleware, RequestTracingMiddleware>())
.Configure(ab => ab
.UseMiddleware<RequestTracingMiddleware>());
using var server = new TestServer(builder);
using var client = server.CreateClient();
using var request = new HttpRequestMessage(HttpMethod.Get, server.BaseAddress);
using var response = await client.SendAsync(request);
loggerMock.Verify(o => o.Write(It.IsAny<Serilog.Events.LogEventLevel>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>()), Times.Exactly(1));
}
}
}
| mit | C# |
0bda43d026e56fb6399dc301579f5664455d95af | Change names | fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Objects/Research/Artifacts/Effects/TelepaticArtifactEffect.cs | UnityProject/Assets/Scripts/Objects/Research/Artifacts/Effects/TelepaticArtifactEffect.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// This artifact sends telepatic messages
/// </summary>
public class TelepaticArtifactEffect : ArtifactEffect
{
[Tooltip("How far artifact sends telepatic message")]
public int auraRadius = 10;
public string[] Messages;
public string[] DrasticMessages;
public override void DoEffectTouch(HandApply touchSource)
{
base.DoEffectTouch(touchSource);
Indocrinate(touchSource.Performer);
}
public override void DoEffectAura()
{
base.DoEffectAura();
IndocrinateMessageArea();
}
public override void DoEffectPulse(GameObject pulseSource)
{
base.DoEffectPulse(pulseSource);
IndocrinateMessageArea();
}
private void IndocrinateMessageArea()
{
var objCenter = gameObject.AssumedWorldPosServer().RoundToInt();
var hitMask = LayerMask.GetMask("Players");
var playerColliders = Physics2D.OverlapCircleAll(new Vector2(objCenter.x, objCenter.y), auraRadius, hitMask);
foreach (var playerColl in playerColliders)
{
playerColl.TryGetComponent<PlayerScript>(out var player);
if (player == null || player.IsDeadOrGhost)
{
Indocrinate(player.gameObject);
}
}
}
private void Indocrinate(GameObject target)
{
if (Random.value > 0.2f)
Chat.AddWarningMsgFromServer(target, Messages.PickRandom());
else
Chat.AddWarningMsgFromServer(target, DrasticMessages.PickRandom());
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// This artifact sends telepatic messages
/// </summary>
public class TelepaticArtifactEffect : ArtifactEffect
{
[Tooltip("How far artifact sends telepatic message")]
public int auraRadius = 10;
public string[] Messages;
public string[] DrasticMessages;
public override void DoEffectTouch(HandApply touchSource)
{
base.DoEffectTouch(touchSource);
Indocrinate(touchSource.Performer);
}
public override void DoEffectAura()
{
base.DoEffectAura();
IndocrinateMessageArea();
}
public override void DoEffectPulse(GameObject pulseSource)
{
base.DoEffectPulse(pulseSource);
IndocrinateMessageArea();
}
private void IndocrinateMessageArea()
{
var objCenter = gameObject.AssumedWorldPosServer().RoundToInt();
var hitMask = LayerMask.GetMask("Players");
var colliders = Physics2D.OverlapCircleAll(new Vector2(objCenter.x, objCenter.y), auraRadius, hitMask);
foreach (var connected in colliders)
{
connected.TryGetComponent<PlayerScript>(out var player);
if (player == null || player.IsDeadOrGhost)
{
Indocrinate(player.gameObject);
}
}
}
private void Indocrinate(GameObject target)
{
if (Random.value > 0.2f)
Chat.AddWarningMsgFromServer(target, Messages.PickRandom());
else
Chat.AddWarningMsgFromServer(target, DrasticMessages.PickRandom());
}
}
| agpl-3.0 | C# |
26ad79b393408aec589e90c229507d1188f7679a | Embed these tests classes in the test that needs them. | darrencauthon/AutoMoq,darrencauthon/AutoMoq,darrencauthon/AutoMoq | src/AutoMoq.Tests/CallingCreateTwice.cs | src/AutoMoq.Tests/CallingCreateTwice.cs | using Microsoft.Practices.Unity;
using Moq;
using NUnit.Framework;
namespace AutoMoq.Tests
{
[TestFixture]
public class CallingCreateTwice
{
[Test]
public void can_create_parent_object_when_setInstance_is_called_on_child()
{
var autoMoq = new AutoMoqer();
// the second line works... seems to be an issue calling Create twice?
var child = autoMoq.Create<Child>();
//var child = new Mock<IChild>().Object;
autoMoq.SetInstance<IChild>(child);
var parent = autoMoq.Create<Parent>();
Assert.IsNotNull(parent);
}
[Test]
public void creating_the_child_twice()
{
var autoMoq = new AutoMoqer();
autoMoq.Create<Child>();
autoMoq.Create<Child>();
}
[Test]
public void resolving_the_same_type_twice_with_unity()
{
var container = new UnityContainer();
var grandChild = new Mock<IGrandChild>().Object;
container.RegisterInstance(grandChild);
container.Resolve<Child>();
container.Resolve<Child>();
}
[Test]
public void creating_the_child_once()
{
var autoMoq = new AutoMoqer();
autoMoq.Create<Child>();
}
public interface IParent
{
}
public interface IChild
{
}
public interface IGrandChild
{
}
public class Parent : IParent
{
private readonly IChild _child;
private readonly IGrandChild _grandChild;
public Parent(IChild child, IGrandChild grandChild)
{
_child = child;
_grandChild = grandChild;
}
}
public class Child : IChild
{
private readonly IGrandChild _grandChild;
public Child(IGrandChild grandChild)
{
_grandChild = grandChild;
}
}
public class GrandChild : IGrandChild
{
}
}
} | using Microsoft.Practices.Unity;
using Moq;
using NUnit.Framework;
namespace AutoMoq.Tests
{
[TestFixture]
public class CallingCreateTwice
{
[Test]
public void can_create_parent_object_when_setInstance_is_called_on_child()
{
var autoMoq = new AutoMoqer();
// the second line works... seems to be an issue calling Create twice?
var child = autoMoq.Create<Child>();
//var child = new Mock<IChild>().Object;
autoMoq.SetInstance<IChild>(child);
var parent = autoMoq.Create<Parent>();
Assert.IsNotNull(parent);
}
[Test]
public void creating_the_child_twice()
{
var autoMoq = new AutoMoqer();
autoMoq.Create<Child>();
autoMoq.Create<Child>();
}
[Test]
public void resolving_the_same_type_twice_with_unity()
{
var container = new UnityContainer();
var grandChild = new Mock<IGrandChild>().Object;
container.RegisterInstance(grandChild);
container.Resolve<Child>();
container.Resolve<Child>();
}
[Test]
public void creating_the_child_once()
{
var autoMoq = new AutoMoqer();
autoMoq.Create<Child>();
}
}
public interface IParent
{
}
public interface IChild
{
}
public interface IGrandChild
{
}
public class Parent : IParent
{
private readonly IChild _child;
private readonly IGrandChild _grandChild;
public Parent(IChild child, IGrandChild grandChild)
{
_child = child;
_grandChild = grandChild;
}
}
public class Child : IChild
{
private readonly IGrandChild _grandChild;
public Child(IGrandChild grandChild)
{
_grandChild = grandChild;
}
}
public class GrandChild : IGrandChild
{
}
} | mit | C# |
2dd1c9bfd10e716dd5ea63147a335c457e861f29 | Update Startup.cs | filipw/Strathweb.TypedRouting.AspNetCore | sample/Demo/Startup.cs | sample/Demo/Startup.cs | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Strathweb.TypedRouting.AspNetCore;
using Demo.Controllers;
namespace Demo
{
public class Startup
{
public Startup(IHostingEnvironment env)
{}
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<TimerFilter>();
services.AddSingleton<AnnotationFilter>();
services.AddMvc(opt =>
{
opt.Get("api/items", c => c.Action<ItemsController>(x => x.Get())).WithFilters(new AnnotationFilter());
opt.Get("api/items/{id}", c => c.Action<ItemsController>(x => x.Get(Param<int>.Any))).WithName("GetItemById").WithFilter<AnnotationFilter>();
opt.Post("api/items", c => c.Action<ItemsController>(x => x.Post(Param<Item>.Any)));
opt.Put("api/items/{id}", c => c.Action<ItemsController>(x => x.Put(Param<int>.Any, Param<Item>.Any)));
opt.Delete("api/items/{id}", c => c.Action<ItemsController>(x => x.Delete(Param<int>.Any)));
opt.Get("api/other", c => c.Action<OtherController>(x => x.Action1())).
WithConstraints(new MandatoryHeaderConstraint("CustomHeader"));
opt.Get("api/other/{id:int}", c => c.Action<OtherController>(x => x.Action2(Param<int>.Any)));
}).EnableTypedRouting();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddDebug();
app.UseMvc();
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Strathweb.TypedRouting.AspNetCore;
using Demo.Controllers;
namespace Demo
{
public class Startup
{
public Startup(IHostingEnvironment env)
{}
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<TimerFilter>();
services.AddSingleton<AnnotationFilter>();
services.AddMvc(opt =>
{
//opt.EnableTypedRouting();
opt.Get("api/items", c => c.Action<ItemsController>(x => x.Get())).WithFilters(new AnnotationFilter());
opt.Get("api/items/{id}", c => c.Action<ItemsController>(x => x.Get(Param<int>.Any))).WithName("GetItemById").WithFilter<AnnotationFilter>();
opt.Post("api/items", c => c.Action<ItemsController>(x => x.Post(Param<Item>.Any)));
opt.Put("api/items/{id}", c => c.Action<ItemsController>(x => x.Put(Param<int>.Any, Param<Item>.Any)));
opt.Delete("api/items/{id}", c => c.Action<ItemsController>(x => x.Delete(Param<int>.Any)));
opt.Get("api/other", c => c.Action<OtherController>(x => x.Action1())).
WithConstraints(new MandatoryHeaderConstraint("CustomHeader"));
opt.Get("api/other/{id:int}", c => c.Action<OtherController>(x => x.Action2(Param<int>.Any)));
}).EnableTypedRouting();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddDebug();
app.UseMvc();
}
}
}
| mit | C# |
d388aa58c8b8e15d9d0c3eb0a018fcf13670ad9f | Remove caching from QueryStringValueProviderFactory Fixes #2258 | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/QueryStringValueProviderFactory.cs | src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/QueryStringValueProviderFactory.cs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Globalization;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
/// <summary>
/// A <see cref="IValueProviderFactory"/> that creates <see cref="IValueProvider"/> instances that
/// read values from the request query-string.
/// </summary>
public class QueryStringValueProviderFactory : IValueProviderFactory
{
/// <inheritdoc />
public IValueProvider GetValueProvider([NotNull] ValueProviderFactoryContext context)
{
return new ReadableStringCollectionValueProvider(
BindingSource.Query,
context.HttpContext.Request.Query,
CultureInfo.InvariantCulture);
}
}
}
| // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Globalization;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
public class QueryStringValueProviderFactory : IValueProviderFactory
{
private static readonly object _cacheKey = new object();
public IValueProvider GetValueProvider([NotNull] ValueProviderFactoryContext context)
{
// Process the query collection once-per request.
var storage = context.HttpContext.Items;
object value;
IValueProvider provider;
if (!storage.TryGetValue(_cacheKey, out value))
{
var queryCollection = context.HttpContext.Request.Query;
provider = new ReadableStringCollectionValueProvider(
BindingSource.Query,
queryCollection,
CultureInfo.InvariantCulture);
storage[_cacheKey] = provider;
}
else
{
provider = (ReadableStringCollectionValueProvider)value;
}
return provider;
}
}
}
| apache-2.0 | C# |
e8bc8981c262d1d3ff3e946a653d1e4e8c764715 | Fix encoding problem | k94ll13nn3/Strinken | src/Strinken/Properties/AssemblyInfo.cs | src/Strinken/Properties/AssemblyInfo.cs | // <auto-generated/>
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Strinken.Tests")]
[assembly: AssemblyCompany("k94ll13nn3")]
[assembly: AssemblyCopyright("Copyright © k94ll13nn3")]
[assembly: AssemblyProduct("Strinken")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
| // <auto-generated/>
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Strinken.Tests")]
[assembly: AssemblyCompany("k94ll13nn3")]
[assembly: AssemblyCopyright("Copyright k94ll13nn3")]
[assembly: AssemblyProduct("Strinken")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
| mit | C# |
e25d046758222234049323a9adda045683916fde | Fix assembly info. | e-rik/XRoadLib,e-rik/XRoadLib,janno-p/XRoadLib | src/XRoadLib/Properties/AssemblyInfo.cs | src/XRoadLib/Properties/AssemblyInfo.cs | // <auto-generated/>
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitleAttribute("XRoadLib")]
[assembly: AssemblyProductAttribute("XRoadLib")]
[assembly: AssemblyDescriptionAttribute("A .NET library for implementing service interfaces of X-Road providers using Code-First Development approach.")]
[assembly: AssemblyVersionAttribute("1.0.0")]
[assembly: AssemblyFileVersionAttribute("1.0.0")]
[assembly: InternalsVisibleToAttribute("XRoadLib.Tests")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "1.0.0";
}
}
| | mit | C# |
ffdedad0f23e90b40af110ac8fbe6cfb068cce24 | Add DeleteTrigger test | InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET | IntegrationEngine.Tests/Scheduler/EngineSchedulerTest.cs | IntegrationEngine.Tests/Scheduler/EngineSchedulerTest.cs | using IntegrationEngine.Scheduler;
using Moq;
using NUnit.Framework;
using Quartz;
using System;
using System.Collections.Generic;
namespace IntegrationEngine.Tests.Scheduler
{
public class EngineSchedulerTest
{
[Test]
public void ShouldDeleteTrigger()
{
var jobType = typeof(IntegrationJobFixture);
var subject = new EngineScheduler() {
IntegrationJobTypes = new List<Type>() { jobType }
};
var trigger = new CronTrigger() {
Id = "one",
JobType = jobType.FullName
};
var scheduler = new Mock<IScheduler>();
scheduler.Setup(x => x.UnscheduleJob(It.Is<TriggerKey>(y => y.Name == trigger.Id &&
y.Group == trigger.JobType))).Returns(true);
subject.Scheduler = scheduler.Object;
var result = subject.DeleteTrigger(trigger);
Assert.That(result, Is.True);
}
}
}
| using IntegrationEngine.Scheduler;
using NUnit.Framework;
using Quartz.Impl;
using System;
using System.Collections.Generic;
namespace IntegrationEngine.Tests.Scheduler
{
public class EngineSchedulerTest
{
[Test]
public void ShouldDeleteTrigger()
{
var jobType = typeof(IntegrationJobFixture);
var subject = new EngineScheduler() {
IntegrationJobTypes = new List<Type>() { jobType }
};
var trigger = new CronTrigger() {
JobType = jobType.FullName
};
subject.DeleteTrigger(trigger);
}
}
}
| mit | C# |
a3cc06bd5c21b5edd184db0c63546877c4c20529 | Add remote commands | martijn00/XamarinMediaManager,mike-rowley/XamarinMediaManager,martijn00/XamarinMediaManager,mike-rowley/XamarinMediaManager | MediaManager/Platforms/Ios/MediaManagerImplementation.cs | MediaManager/Platforms/Ios/MediaManagerImplementation.cs | using MediaPlayer;
using UIKit;
namespace MediaManager
{
[Foundation.Preserve(AllMembers = true)]
public class MediaManagerImplementation : AppleMediaManagerBase<MediaManager.Platforms.Ios.Media.MediaPlayer>
{
public MediaManagerImplementation()
{
UIApplication.SharedApplication.BeginReceivingRemoteControlEvents();
var commandCenter = MPRemoteCommandCenter.Shared;
commandCenter.TogglePlayPauseCommand.Enabled = true;
commandCenter.TogglePlayPauseCommand.AddTarget(TogglePlayPauseCommand);
}
private MPRemoteCommandHandlerStatus TogglePlayPauseCommand(MPRemoteCommandEvent arg)
{
this.PlayPause();
return MPRemoteCommandHandlerStatus.Success;
}
}
}
| namespace MediaManager
{
[Foundation.Preserve(AllMembers = true)]
public class MediaManagerImplementation : AppleMediaManagerBase<MediaManager.Platforms.Ios.Media.MediaPlayer>
{
public MediaManagerImplementation()
{
}
}
}
| mit | C# |
8b3a5665e9831e6ba05739ab88d3b45409f4f4a0 | add [required] on ViewModel | hatelove/MyMvcHomework,hatelove/MyMvcHomework,hatelove/MyMvcHomework | MyMoney/MyMoney/Models/ViewModels/AccountingViewModel.cs | MyMoney/MyMoney/Models/ViewModels/AccountingViewModel.cs | using MyMoney.Models.Enums;
using System;
using System.ComponentModel.DataAnnotations;
namespace MyMoney.Models.ViewModels
{
public class AccountingViewModel
{
[Display(Name = "金額")]
[DisplayFormat(DataFormatString = "{0:N0}")]
[Required]
public int Amount { get; set; }
[Display(Name = "日期")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}")]
[Required]
public DateTime Date { get; set; }
[Display(Name = "備註")]
[Required]
public string Remark { get; set; }
[Display(Name = "類別")]
[Required]
public AccountingType Type { get; set; }
}
} | using MyMoney.Models.Enums;
using System;
using System.ComponentModel.DataAnnotations;
namespace MyMoney.Models.ViewModels
{
public class AccountingViewModel
{
[Display(Name = "金額")]
[DisplayFormat(DataFormatString = "{0:N0}")]
public int Amount { get; set; }
[Display(Name = "日期")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}")]
public DateTime Date { get; set; }
[Display(Name = "備註")]
public string Remark { get; set; }
[Display(Name = "類別")]
public AccountingType Type { get; set; }
}
} | mit | C# |
22e6e4186f51d070351360ecc6de1458c13bce95 | Update XML doc comment | jorik041/dnlib,modulexcite/dnlib,ZixiangBoy/dnlib,0xd4d/dnlib,ilkerhalil/dnlib,picrap/dnlib,yck1509/dnlib,kiootic/dnlib,Arthur2e5/dnlib | src/DotNet/Writer/IChunk.cs | src/DotNet/Writer/IChunk.cs | using System.IO;
using dot10.IO;
using dot10.PE;
namespace dot10.DotNet.Writer {
/// <summary>
/// Data that gets written to the file
/// </summary>
public interface IChunk {
/// <summary>
/// Gets the file offset. This is valid only after <see cref="SetOffset"/> has been called.
/// </summary>
FileOffset FileOffset { get; }
/// <summary>
/// Gets the RVA. This is valid only after <see cref="SetOffset"/> has been called.
/// </summary>
RVA RVA { get; }
/// <summary>
/// Called when the file offset and RVA are known
/// </summary>
/// <param name="offset">File offset of this chunk</param>
/// <param name="rva">RVA of this chunk</param>
void SetOffset(FileOffset offset, RVA rva);
/// <summary>
/// Gets the length of this chunk. Must only be called after <see cref="SetOffset"/>
/// has been called.
/// </summary>
/// <returns>Length of this chunk</returns>
uint GetLength();
/// <summary>
/// Writes all data to <paramref name="writer"/> at its current location. It's only
/// called after <see cref="SetOffset"/> and <see cref="GetLength"/> have been called.
/// You cannot assume that <paramref name="writer"/>'s file position is the same as this
/// chunk's file position.
/// </summary>
/// <param name="writer">Destination</param>
void WriteTo(BinaryWriter writer);
}
partial class Extensions {
/// <summary>
/// Writes all data to <paramref name="writer"/> and verifies that all bytes were written
/// </summary>
/// <param name="chunk">this</param>
/// <param name="writer">Destination</param>
/// <exception cref="IOException">Not all bytes were written</exception>
public static void VerifyWriteTo(this IChunk chunk, BinaryWriter writer) {
long pos = writer.BaseStream.Position;
chunk.WriteTo(writer);
if (writer.BaseStream.Position - pos != chunk.GetLength())
throw new IOException("Did not write all bytes");
}
}
}
| using System.IO;
using dot10.IO;
using dot10.PE;
namespace dot10.DotNet.Writer {
/// <summary>
/// Data that gets written to the file
/// </summary>
public interface IChunk {
/// <summary>
/// Gets the file offset. This is valid only after <see cref="SetOffset"/> has been called.
/// </summary>
FileOffset FileOffset { get; }
/// <summary>
/// Gets the RVA. This is valid only after <see cref="SetOffset"/> has been called.
/// </summary>
RVA RVA { get; }
/// <summary>
/// Called when the file offset and RVA is known
/// </summary>
/// <param name="offset">File offset of this chunk</param>
/// <param name="rva">RVA of this chunk</param>
void SetOffset(FileOffset offset, RVA rva);
/// <summary>
/// Gets the length of this chunk. Must only be called after <see cref="SetOffset"/>
/// has been called.
/// </summary>
/// <returns>Length of this chunk</returns>
uint GetLength();
/// <summary>
/// Writes all data to <paramref name="writer"/> at its current location. It's only
/// called after <see cref="SetOffset"/> and <see cref="GetLength"/> have been called.
/// You cannot assume that <paramref name="writer"/>'s file position is the same as this
/// chunk's file position.
/// </summary>
/// <param name="writer">Destination</param>
void WriteTo(BinaryWriter writer);
}
partial class Extensions {
/// <summary>
/// Writes all data to <paramref name="writer"/> and verifies that all bytes were written
/// </summary>
/// <param name="chunk">this</param>
/// <param name="writer">Destination</param>
/// <exception cref="IOException">Not all bytes were written</exception>
public static void VerifyWriteTo(this IChunk chunk, BinaryWriter writer) {
long pos = writer.BaseStream.Position;
chunk.WriteTo(writer);
if (writer.BaseStream.Position - pos != chunk.GetLength())
throw new IOException("Did not write all bytes");
}
}
}
| mit | C# |
4213dde00547a60ad82fbe587e5ff7b2d45cad7d | Update comment for ClearMessages request | BrianMcBrayer/BasicAzureStorageSDK,tarwn/BasicAzureStorageSDK | Basic.Azure.Storage/Communications/QueueService/MessageOperations/ClearMessageRequest.cs | Basic.Azure.Storage/Communications/QueueService/MessageOperations/ClearMessageRequest.cs | using Basic.Azure.Storage.Communications.Core;
using Basic.Azure.Storage.Communications.Core.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Basic.Azure.Storage.Communications.QueueService.MessageOperations
{
/// <summary>
/// Clears the specified queue
/// http://msdn.microsoft.com/en-us/library/azure/dd179454.aspx
/// </summary>
public class ClearMessageRequest : RequestBase<EmptyResponsePayload>
{
private string _queueName;
public ClearMessageRequest(StorageAccountSettings settings, string queueName)
: base(settings)
{
//TODO: add Guard statements against invalid values, short circuit so we don't have the latency roundtrip to the server
_queueName = queueName;
}
protected override string HttpMethod { get { return "DELETE"; } }
protected override StorageServiceType ServiceType { get { return StorageServiceType.QueueService; } }
protected override RequestUriBuilder GetUriBase()
{
var builder = new RequestUriBuilder(Settings.QueueEndpoint);
builder.AddSegment(_queueName);
builder.AddSegment("messages");
return builder;
}
}
}
| using Basic.Azure.Storage.Communications.Core;
using Basic.Azure.Storage.Communications.Core.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Basic.Azure.Storage.Communications.QueueService.MessageOperations
{
/// <summary>
/// Deletes the specified queue item from the queue
/// http://msdn.microsoft.com/en-us/library/azure/dd179347.aspx
/// </summary>
public class ClearMessageRequest : RequestBase<EmptyResponsePayload>
{
private string _queueName;
public ClearMessageRequest(StorageAccountSettings settings, string queueName)
: base(settings)
{
//TODO: add Guard statements against invalid values, short circuit so we don't have the latency roundtrip to the server
_queueName = queueName;
}
protected override string HttpMethod { get { return "DELETE"; } }
protected override StorageServiceType ServiceType { get { return StorageServiceType.QueueService; } }
protected override RequestUriBuilder GetUriBase()
{
var builder = new RequestUriBuilder(Settings.QueueEndpoint);
builder.AddSegment(_queueName);
builder.AddSegment("messages");
return builder;
}
}
}
| bsd-3-clause | C# |
b99f6cdbc168f9a1fc2fa4bbf0252116510a1238 | allow long urls on admin | bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core | src/Admin/Program.cs | src/Admin/Program.cs | using Bit.Core.Utilities;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Serilog.Events;
namespace Bit.Admin
{
public class Program
{
public static void Main(string[] args)
{
WebHost
.CreateDefaultBuilder(args)
.ConfigureKestrel(o =>
{
o.Limits.MaxRequestLineSize = 20_000;
})
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(e.Properties.ContainsKey("RequestPath") &&
!string.IsNullOrWhiteSpace(e.Properties["RequestPath"]?.ToString()) &&
(context.Contains(".Server.Kestrel") || context.Contains(".Core.IISHttpServer")))
{
return false;
}
return e.Level >= LogEventLevel.Error;
}))
.Build()
.Run();
}
}
}
| using Bit.Core.Utilities;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Serilog.Events;
namespace Bit.Admin
{
public class Program
{
public static void Main(string[] args)
{
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(e.Properties.ContainsKey("RequestPath") &&
!string.IsNullOrWhiteSpace(e.Properties["RequestPath"]?.ToString()) &&
(context.Contains(".Server.Kestrel") || context.Contains(".Core.IISHttpServer")))
{
return false;
}
return e.Level >= LogEventLevel.Error;
}))
.Build()
.Run();
}
}
}
| agpl-3.0 | C# |
9750fdab4dacfcb10fbae8dea824d708aa471efb | cover ensure | aritters/Ritter,arsouza/Aritter,arsouza/Aritter | tests/Infra.Crosscutting.Tests/Ensuring/Ensure_That.cs | tests/Infra.Crosscutting.Tests/Ensuring/Ensure_That.cs | using System;
using FluentAssertions;
using Xunit;
namespace Ritter.Infra.Crosscutting.Tests.Ensuring
{
public class Ensure_That
{
[Fact]
public void ThrowExceptionGivenFalse()
{
Action act = () => Ensure.That(false);
act.Should().Throw<Exception>().And.Message.Should().Be("");
}
[Fact]
public void ThrowExceptionGivenFalseAndNotEmptyMessage()
{
Action act = () => Ensure.That(false, "Test");
act.Should().Throw<Exception>().And.Message.Should().Be("Test");
}
[Fact]
public void EnsureGivenTrue()
{
Action act = () => Ensure.That(true);
act.Should().NotThrow<Exception>();
}
[Fact]
public void EnsureGivenTrueAndNotEmptyMessage()
{
Action act = () => Ensure.That(true, "Test");
act.Should().NotThrow<Exception>();
}
[Fact]
public void ThrowExceptionGivenFalsePredicate()
{
Action act = () => Ensure.That(() => false);
act.Should().Throw<Exception>().And.Message.Should().Be("");
}
[Fact]
public void ThrowExceptionGivenFalsePredicateAndNotEmptyMessage()
{
Action act = () => Ensure.That(() => false, "Test");
act.Should().Throw<Exception>().And.Message.Should().Be("Test");
}
[Fact]
public void ThrowApplicationExceptionGivenFalsePredicate()
{
Action act = () => Ensure.That<ApplicationException>(() => false);
act.Should().Throw<ApplicationException>().And.Message.Should().Be("");
}
[Fact]
public void ThrowApplicationExceptionGivenFalsePredicateAndNotEmptyMessage()
{
Action act = () => Ensure.That<ApplicationException>(() => false, "Test");
act.Should().Throw<ApplicationException>().And.Message.Should().Be("Test");
}
[Fact]
public void EnsureGivenTruePredicate()
{
Action act = () => Ensure.That(() => true);
act.Should().NotThrow<Exception>();
}
[Fact]
public void EnsureGivenTruePredicateAndNotEmptyMessage()
{
Action act = () => Ensure.That(() => true, "Test");
act.Should().NotThrow<Exception>();
}
}
}
| using System;
using FluentAssertions;
using Xunit;
namespace Ritter.Infra.Crosscutting.Tests.Ensuring
{
public class Ensure_That
{
[Fact]
public void ThrowExceptionGivenFalse()
{
Action act = () => Ensure.That(false);
act.Should().Throw<Exception>().And.Message.Should().Be("");
}
[Fact]
public void ThrowExceptionGivenFalseAndNotEmptyMessage()
{
Action act = () => Ensure.That(false, "Test");
act.Should().Throw<Exception>().And.Message.Should().Be("Test");
}
[Fact]
public void EnsureGivenTrue()
{
Action act = () => Ensure.That(true);
act.Should().NotThrow<Exception>();
}
[Fact]
public void EnsureGivenTrueAndNotEmptyMessage()
{
Action act = () => Ensure.That(true, "Test");
act.Should().NotThrow<Exception>();
}
[Fact]
public void ThrowExceptionGivenFalsePredicate()
{
Action act = () => Ensure.That(() => false);
act.Should().Throw<Exception>().And.Message.Should().Be("");
}
[Fact]
public void ThrowExceptionGivenFalsePredicateAndNotEmptyMessage()
{
Action act = () => Ensure.That(() => false, "Test");
act.Should().Throw<Exception>().And.Message.Should().Be("Test");
}
[Fact]
public void EnsureGivenTruePredicate()
{
Action act = () => Ensure.That(() => true);
act.Should().NotThrow<Exception>();
}
[Fact]
public void EnsureGivenTruePredicateAndNotEmptyMessage()
{
Action act = () => Ensure.That(() => true, "Test");
act.Should().NotThrow<Exception>();
}
}
}
| mit | C# |
4342789dd4b6eba8f79fd038942f7605d0197525 | Fix interval node interface | DMagic1/KSP_Contract_Window | Source/ContractsWindow.Unity/Interfaces/IIntervalNode.cs | Source/ContractsWindow.Unity/Interfaces/IIntervalNode.cs | using System;
using System.Collections.Generic;
namespace ContractsWindow.Unity.Interfaces
{
public interface IIntervalNode
{
bool IsReached { get; }
int Intervals { get; }
int NodeInterval { get; }
string NodeTitle { get; }
string NodeValue(int i);
string RewardText(int i);
}
}
| using System;
using System.Collections.Generic;
namespace ContractsWindow.Unity.Interfaces
{
public interface IIntervalNode
{
string NodeTitle { get; }
string NodeValue { get; }
string NodeOrder { get; }
string RewardText { get; }
}
}
| mit | C# |
1a3679b8b938c2a976538c345cb29e3fcbda7d7c | Fix exception handling on .NET Native. | dermeister0/TimesheetParser,dermeister0/TimesheetParser | Source/TimesheetParser.Win10/Services/PasswordService.cs | Source/TimesheetParser.Win10/Services/PasswordService.cs | using System;
using System.Linq;
using Windows.Security.Credentials;
using TimesheetParser.Business.Services;
namespace TimesheetParser.Win10.Services
{
internal class PasswordService : IPasswordService
{
private readonly string pluginName;
private readonly PasswordVault vault = new PasswordVault();
public PasswordService(string pluginName)
{
this.pluginName = pluginName;
}
public string Login { get; set; }
public string Password { get; set; }
public void LoadCredential()
{
try
{
var credential = vault.FindAllByResource(GetResource()).FirstOrDefault();
if (credential != null)
{
Login = credential.UserName;
Password = credential.Password;
}
}
catch (Exception)
{
// No passwords are saved for this resource.
}
}
public void SaveCredential()
{
vault.Add(new PasswordCredential(GetResource(), Login, Password));
}
public void DeleteCredential()
{
vault.Remove(vault.Retrieve(GetResource(), Login));
}
private string GetResource()
{
return $"TimesheetParser/{pluginName}";
}
}
} | using System;
using System.Linq;
using System.Runtime.InteropServices;
using Windows.Security.Credentials;
using TimesheetParser.Business.Services;
namespace TimesheetParser.Win10.Services
{
internal class PasswordService : IPasswordService
{
private readonly string pluginName;
private readonly PasswordVault vault = new PasswordVault();
public PasswordService(string pluginName)
{
this.pluginName = pluginName;
}
public string Login { get; set; }
public string Password { get; set; }
public void LoadCredential()
{
try
{
var credential = vault.FindAllByResource(GetResource()).FirstOrDefault();
if (credential != null)
{
Login = credential.UserName;
Password = credential.Password;
}
}
catch (COMException)
{
// No passwords are saved for this resource.
}
}
public void SaveCredential()
{
vault.Add(new PasswordCredential(GetResource(), Login, Password));
}
public void DeleteCredential()
{
vault.Remove(vault.Retrieve(GetResource(), Login));
}
private string GetResource()
{
return $"TimesheetParser/{pluginName}";
}
}
} | mit | C# |
51d17ce1be8908001c2f0d5997d09b3d1cbdf386 | Fix silly whitespace. | patridge/XamarinForms-Tabs-Demo | SwitchingTabbedPageDemo/SwitchingTabbedPageDemo/Page2.cs | SwitchingTabbedPageDemo/SwitchingTabbedPageDemo/Page2.cs | using Xamarin.Forms;
namespace SwitchingTabbedPageDemo {
public class Page2 : ContentPage {
public Page2() {
var label = new Label { Text = "Hello ContentPage 2" };
Device.OnPlatform(
iOS: () => {
var parentTabbedPage = this.ParentTabbedPage() as MainTabbedPage;
if (parentTabbedPage != null) {
// HACK: get content out from under status bar if a navigation bar isn't doing that for us already.
Padding = new Thickness(Padding.Left, Padding.Top + 25f, Padding.Right, Padding.Bottom);
}
}
);
var button = new Button() {
Text = "Switch to Tab 1; add a Page 2 there",
};
button.Clicked += async (sender, e) => {
var tabbedPage = this.ParentTabbedPage() as MainTabbedPage;
var partPage = new Page2() { Title = "Added page 2" };
await tabbedPage.SwitchToTab1(partPage, resetToRootFirst: false);
};
Content = new StackLayout {
Children = {
button,
label,
}
};
}
}
}
| using Xamarin.Forms;
namespace SwitchingTabbedPageDemo {
public class Page2 : ContentPage {
public Page2() {
var label = new Label { Text = "Hello ContentPage 2" };
Device.OnPlatform(
iOS: () => {
var parentTabbedPage = this.ParentTabbedPage() as MainTabbedPage;
if (parentTabbedPage != null) {
// HACK: get content out from under status bar if a navigation bar isn't doing that for us already.
Padding = new Thickness(Padding.Left, Padding.Top + 25f, Padding.Right, Padding.Bottom);
}
}
);
var button = new Button() {
Text = "Switch to Tab 1; add a Page 2 there",
};
button.Clicked += async (sender, e) => {
var tabbedPage = this.ParentTabbedPage() as MainTabbedPage;
var partPage = new Page2() { Title = "Added page 2" };
await tabbedPage.SwitchToTab1(partPage, resetToRootFirst: false);
};
Content = new StackLayout {
Children = {
button,
label,
}
};
}
}
}
| mit | C# |
7ca2a7904d4d56f68589f58ab0f0c1343ad021c4 | Undo c: reference in sample app | AzureAD/azure-activedirectory-library-for-dotnet | devApps/AdalDesktopTestApp/FileCache.cs | devApps/AdalDesktopTestApp/FileCache.cs | using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace AdalDesktopTestApp
{
internal class FileCache : TokenCache
{
public string CacheFilePath;
private static readonly object FileLock = new object();
// Initializes the cache against a local file.
// If the file is already present, it loads its content in the ADAL cache
public FileCache(string filePath = @".\TokenCache.dat")
{
CacheFilePath = filePath;
AfterAccess = AfterAccessNotification;
BeforeAccess = BeforeAccessNotification;
lock (FileLock)
{
DeserializeMsalV3(File.Exists(CacheFilePath) ? File.ReadAllBytes(CacheFilePath) : null);
}
}
// Empties the persistent store.
public override void Clear()
{
base.Clear();
File.Delete(CacheFilePath);
}
// Triggered right before ADAL needs to access the cache.
// Reload the cache from the persistent store in case it changed since the last access.
void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
lock (FileLock)
{
DeserializeMsalV3(File.Exists(CacheFilePath) ? File.ReadAllBytes(CacheFilePath) : null);
}
}
// Triggered right after ADAL accessed the cache.
void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if the access operation resulted in a cache update
if (HasStateChanged)
{
lock (FileLock)
{
// reflect changes in the persistent store
File.WriteAllBytes(CacheFilePath, SerializeMsalV3());
// once the write operation took place, restore the HasStateChanged bit to false
HasStateChanged = false;
}
}
}
}
}
| using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace AdalDesktopTestApp
{
internal class FileCache : TokenCache
{
public string CacheFilePath;
private static readonly object FileLock = new object();
// Initializes the cache against a local file.
// If the file is already present, it loads its content in the ADAL cache
public FileCache(string filePath = @"c:\temp\TokenCache2.json")
{
CacheFilePath = filePath;
AfterAccess = AfterAccessNotification;
BeforeAccess = BeforeAccessNotification;
lock (FileLock)
{
DeserializeMsalV3(File.Exists(CacheFilePath) ? File.ReadAllBytes(CacheFilePath) : null);
}
}
// Empties the persistent store.
public override void Clear()
{
base.Clear();
File.Delete(CacheFilePath);
}
// Triggered right before ADAL needs to access the cache.
// Reload the cache from the persistent store in case it changed since the last access.
void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
lock (FileLock)
{
DeserializeMsalV3(File.Exists(CacheFilePath) ? File.ReadAllBytes(CacheFilePath) : null);
}
}
// Triggered right after ADAL accessed the cache.
void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if the access operation resulted in a cache update
if (HasStateChanged)
{
lock (FileLock)
{
// reflect changes in the persistent store
File.WriteAllBytes(CacheFilePath, SerializeMsalV3());
// once the write operation took place, restore the HasStateChanged bit to false
HasStateChanged = false;
}
}
}
}
}
| mit | C# |
1d0e00ab01780d508a536f10bc805d1b57a1fda2 | Update Program.cs | relianz/s2i-aspnet-example,relianz/s2i-aspnet-example,relianz/s2i-aspnet-example | app/Program.cs | app/Program.cs |
using System.IO; // Directory.
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace WebApplication
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddEnvironmentVariables("")
.Build();
var url = config["ASPNETCORE_URLS"] ?? "http://*:8080";
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls(url)
.Build();
host.Run();
}
}
}
| // using System.Linq;
// using System.Threading.Tasks;
// using System;
using System.IO;
// using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace WebApplication
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddEnvironmentVariables("")
.Build();
var url = config["ASPNETCORE_URLS"] ?? "http://*:8080";
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls(url)
.Build();
host.Run();
}
}
}
| apache-2.0 | C# |
adfc0937cb4d369a37e6d3c10b6fddcbf610b9b5 | comment added on github.com | merrillorg/history,merrillorg/history | Meiot.Library/Class1.cs | Meiot.Library/Class1.cs | using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Meiot.Library
{
public class Class1
{
private readonly DataSet someDataSet;
public Class1()
{
//Adding this comment on github.com
someDataSet = new DataSet();
}
}
}
| using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Meiot.Library
{
public class Class1
{
private readonly DataSet someDataSet;
public Class1()
{
someDataSet = new DataSet();
}
}
}
| mit | C# |
445401d3d1d58a7082742426c33e8c467ec68d6b | Update Program.cs | gregyjames/OctaneDownloader | OctaneTester/Program.cs | OctaneTester/Program.cs | using System;
using System.IO;
using System.Threading;
using OctaneDownloadEngine;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace OctaneDownloadEngine
{
internal static class Program
{
private static void Main()
{
var xmlDoc = new XmlDocument();
xmlDoc.Load("files.xml");
var files = xmlDoc.SelectNodes("//files/file");
foreach (XmlNode fileNode in files)
{
var url = fileNode.Attributes["input"].Value;
try
{
var ODE = new OctaneEngine();
Console.Clear();
ODE.DownloadFile(url, 4).GetAwaiter().GetResult();
Thread.Sleep(1000);
}
catch
{
var filename = Path.GetFileName(new Uri(url).LocalPath);
Console.WriteLine("Download error on " + filename);
}
}
}
}
}
| using OctaneDownloadEngine;
namespace OctaneDownloadEngine
{
internal static class Program
{
private static void Main()
{
const string url = "https://az764295.vo.msecnd.net/stable/d5e9aa0227e057a60c82568bf31c04730dc15dcd/VSCodeUserSetup-x64-1.47.0.exe";
OctaneEngine.DownloadFile(url, 4).GetAwaiter().GetResult();
}
}
} | mit | C# |
0ff9a4142015d5d53dc3a21b373bf834f8bfbbc5 | update db context | army-of-two/when-its-done,army-of-two/when-its-done,army-of-two/when-its-done | WhenItsDone/Lib/WhenItsDone.Data/WhenItsDoneDbContext.cs | WhenItsDone/Lib/WhenItsDone.Data/WhenItsDoneDbContext.cs | using System.Data.Entity;
using WhenItsDone.Data.Contracts;
using WhenItsDone.Data.Factories;
using WhenItsDone.Models;
namespace WhenItsDone.Data
{
public class WhenItsDoneDbContext : DbContext, IWhenItsDoneDbContext
{
private IStatefulFactory statefulFactory;
public WhenItsDoneDbContext(IStatefulFactory statefulFactory)
: base("DefaultConnection")
{
this.statefulFactory = statefulFactory;
}
public virtual IDbSet<Address> Addresses { get; set; }
public virtual IDbSet<Client> Clients { get; set; }
public virtual IDbSet<ClientReview> ClientReviews { get; set; }
public virtual IDbSet<ContactInformation> ContactInformations { get; set; }
public virtual IDbSet<Dish> Dishes { get; set; }
public virtual IDbSet<Food> Foods { get; set; }
public virtual IDbSet<Ingredient> Ingredients { get; set; }
public virtual IDbSet<Job> Jobs { get; set; }
public virtual IDbSet<Mineral> Minerals { get; set; }
public virtual IDbSet<NutritionFacts> NutritionFacts { get; set; }
public virtual IDbSet<Payment> Payments { get; set; }
public virtual IDbSet<PhotoItem> PhotoItems { get; set; }
public virtual IDbSet<ReceivedPayment> ReceivedPayments { get; set; }
public virtual IDbSet<Recipe> Recipes { get; set; }
public virtual IDbSet<VideoItem> VideoItems { get; set; }
public virtual IDbSet<Vitamin> Vitamins { get; set; }
public virtual IDbSet<Worker> Workers { get; set; }
public virtual IDbSet<VitalStatistics> VitalStatistics { get; set; }
public virtual IDbSet<WorkerReview> WorkerReviews { get; set; }
public IStateful<TEntity> GetStateful<TEntity>(TEntity entity) where TEntity : class
{
return this.statefulFactory.GetStateful(base.Entry<TEntity>(entity));
}
}
}
| using System.Data.Entity;
using WhenItsDone.Data.Contracts;
using WhenItsDone.Data.Factories;
using WhenItsDone.Models;
namespace WhenItsDone.Data
{
public class WhenItsDoneDbContext : DbContext, IWhenItsDoneDbContext
{
private IStatefulFactory statefulFactory;
public WhenItsDoneDbContext(IStatefulFactory statefulFactory)
: base("DefaultConnection")
{
this.statefulFactory = statefulFactory;
}
public virtual IDbSet<Address> Addresses { get; set; }
public virtual IDbSet<Client> Clients { get; set; }
public virtual IDbSet<ClientReview> ClientReviews { get; set; }
public virtual IDbSet<ContactInformation> ContactInformations { get; set; }
public virtual IDbSet<Job> Jobs { get; set; }
public virtual IDbSet<Payment> Payments { get; set; }
public virtual IDbSet<PhotoItem> PhotoItems { get; set; }
public virtual IDbSet<ReceivedPayment> ReceivedPayments { get; set; }
public virtual IDbSet<VideoItem> VideoItems { get; set; }
public virtual IDbSet<Worker> Workers { get; set; }
public virtual IDbSet<VitalStatistics> VitalStatistics { get; set; }
public virtual IDbSet<WorkerReview> WorkerReviews { get; set; }
public IStateful<TEntity> GetStateful<TEntity>(TEntity entity) where TEntity : class
{
return this.statefulFactory.GetStateful(base.Entry<TEntity>(entity));
}
}
}
| mit | C# |
727d32c404bbead0fe35d81bf9c525405b045b27 | use AppendOptional in Examples | acple/ParsecSharp | ParsecSharp.Examples/ReversePolishCalculator.cs | ParsecSharp.Examples/ReversePolishCalculator.cs | using System;
using static ParsecSharp.Parser;
using static ParsecSharp.Text;
namespace ParsecSharp.Examples
{
// 逆ポーランド記法の式をパーサで計算してみるネタ
public static class ReversePolishCalculator
{
// 整数または小数にマッチし、double にして返す
private static readonly Parser<char, double> Number =
Optional(OneOf("-+"), '+')
.Append(Many1(DecDigit()))
.AppendOptional(Char('.').Append(Many1(DecDigit())))
.ToDouble();
// 四則演算子にマッチし、二項演算関数にマップ
private static readonly Parser<char, Func<double, double, double>> Op =
Choice(
Char('+').Map(_ => (Func<double, double, double>)((x, y) => x + y)),
Char('-').Map(_ => (Func<double, double, double>)((x, y) => x - y)),
Char('*').Map(_ => (Func<double, double, double>)((x, y) => x * y)),
Char('/').Map(_ => (Func<double, double, double>)((x, y) => x / y)));
// 式を表す再帰実行パーサ
// 左再帰の定義: expr = expr expr op / num
// 左再帰の除去: expr = num *( expr op )
private static readonly Parser<char, double> Expr =
Number
.Chain(x =>
from y in Expr
from func in Op
select func(x, y))
.Between(Spaces());
public static Parser<char, double> Parser { get; } = Expr.End();
public static Result<char, double> Parse(string source)
=> Parser.Parse(source);
}
}
| using System;
using static ParsecSharp.Parser;
using static ParsecSharp.Text;
namespace ParsecSharp.Examples
{
// 逆ポーランド記法の式をパーサで計算してみるネタ
public static class ReversePolishCalculator
{
// 整数または小数にマッチし、double にして返す
private static readonly Parser<char, double> Number =
Optional(OneOf("-+"), '+')
.Append(Many1(DecDigit()))
.Append(Optional(Char('.').Append(Many1(DecDigit())), ".0"))
.ToDouble();
// 四則演算子にマッチし、二項演算関数にマップ
private static readonly Parser<char, Func<double, double, double>> Op =
Choice(
Char('+').Map(_ => (Func<double, double, double>)((x, y) => x + y)),
Char('-').Map(_ => (Func<double, double, double>)((x, y) => x - y)),
Char('*').Map(_ => (Func<double, double, double>)((x, y) => x * y)),
Char('/').Map(_ => (Func<double, double, double>)((x, y) => x / y)));
// 式を表す再帰実行パーサ
// 左再帰の定義: expr = expr expr op / num
// 左再帰の除去: expr = num *( expr op )
private static readonly Parser<char, double> Expr =
Number
.Chain(x =>
from y in Expr
from func in Op
select func(x, y))
.Between(Spaces());
public static Parser<char, double> Parser { get; } = Expr.End();
public static Result<char, double> Parse(string source)
=> Parser.Parse(source);
}
}
| mit | C# |
1de84e1c9806beb54eaae23b415cc2279c8a38be | Change description to include mention of video | smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,peppy/osu-new,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu | osu.Game/Screens/Edit/Setup/DesignSection.cs | osu.Game/Screens/Edit/Setup/DesignSection.cs | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup
{
internal class DesignSection : SetupSection
{
private LabelledSwitchButton widescreenSupport;
private LabelledSwitchButton epilepsyWarning;
private LabelledSwitchButton letterboxDuringBreaks;
public override LocalisableString Title => "Design";
[BackgroundDependencyLoader]
private void load()
{
Children = new[]
{
widescreenSupport = new LabelledSwitchButton
{
Label = "Widescreen support",
Current = { Value = Beatmap.BeatmapInfo.WidescreenStoryboard }
},
epilepsyWarning = new LabelledSwitchButton
{
Label = "Epilepsy warning",
Description = "Recommended if the storyboard or video contain scenes with rapidly flashing colours.",
Current = { Value = Beatmap.BeatmapInfo.EpilepsyWarning }
},
letterboxDuringBreaks = new LabelledSwitchButton
{
Label = "Letterbox during breaks",
Current = { Value = Beatmap.BeatmapInfo.LetterboxInBreaks }
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
widescreenSupport.Current.BindValueChanged(_ => updateBeatmap());
epilepsyWarning.Current.BindValueChanged(_ => updateBeatmap());
letterboxDuringBreaks.Current.BindValueChanged(_ => updateBeatmap());
}
private void updateBeatmap()
{
Beatmap.BeatmapInfo.WidescreenStoryboard = widescreenSupport.Current.Value;
Beatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning.Current.Value;
Beatmap.BeatmapInfo.LetterboxInBreaks = letterboxDuringBreaks.Current.Value;
}
}
}
| // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup
{
internal class DesignSection : SetupSection
{
private LabelledSwitchButton widescreenSupport;
private LabelledSwitchButton epilepsyWarning;
private LabelledSwitchButton letterboxDuringBreaks;
public override LocalisableString Title => "Design";
[BackgroundDependencyLoader]
private void load()
{
Children = new[]
{
widescreenSupport = new LabelledSwitchButton
{
Label = "Widescreen support",
Current = { Value = Beatmap.BeatmapInfo.WidescreenStoryboard }
},
epilepsyWarning = new LabelledSwitchButton
{
Label = "Epilepsy warning",
Description = "Recommended if the storyboard contains scenes with rapidly flashing colours.",
Current = { Value = Beatmap.BeatmapInfo.EpilepsyWarning }
},
letterboxDuringBreaks = new LabelledSwitchButton
{
Label = "Letterbox during breaks",
Current = { Value = Beatmap.BeatmapInfo.LetterboxInBreaks }
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
widescreenSupport.Current.BindValueChanged(_ => updateBeatmap());
epilepsyWarning.Current.BindValueChanged(_ => updateBeatmap());
letterboxDuringBreaks.Current.BindValueChanged(_ => updateBeatmap());
}
private void updateBeatmap()
{
Beatmap.BeatmapInfo.WidescreenStoryboard = widescreenSupport.Current.Value;
Beatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning.Current.Value;
Beatmap.BeatmapInfo.LetterboxInBreaks = letterboxDuringBreaks.Current.Value;
}
}
}
| mit | C# |
aa19e8b21ae3680fa834b3e6164a05e42e14605f | バージョンを 0.3.1 に変更 | lury-lang/lury | src/Lury/Properties/AssemblyInfo.cs | src/Lury/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Lury")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lury")]
[assembly: AssemblyCopyright("Copyright © 2014-2016 Tomona Nanase")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("822c883f-0fd0-4ac8-926c-168469ec160d")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.1")]
[assembly: AssemblyFileVersion("0.3.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Lury")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lury")]
[assembly: AssemblyCopyright("Copyright © 2014-2016 Tomona Nanase")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("822c883f-0fd0-4ac8-926c-168469ec160d")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3")]
[assembly: AssemblyFileVersion("0.3")]
| mit | C# |
a6b95a4b9ad445eb52cea3155f87846e74644881 | use better null checks | ssg/HashDepot | src/Require.cs | src/Require.cs | // <copyright file="Require.cs" company="Sedat Kapanoglu">
// Copyright (c) 2015-2019 Sedat Kapanoglu
// MIT License (see LICENSE file for details)
// </copyright>
using System;
using System.Runtime.CompilerServices;
namespace HashDepot
{
/// <summary>
/// Helpers for argument validation.
/// </summary>
internal static class Require
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotNull<T>(T parameter, string name)
where T : class
{
if (name is null)
{
throw new ArgumentNullException(nameof(name), "Incorrectly passed a null value as name");
}
if (parameter is null)
{
throw new ArgumentNullException(name);
}
}
}
} | // <copyright file="Require.cs" company="Sedat Kapanoglu">
// Copyright (c) 2015-2019 Sedat Kapanoglu
// MIT License (see LICENSE file for details)
// </copyright>
using System;
using System.Runtime.CompilerServices;
namespace HashDepot
{
/// <summary>
/// Helpers for argument validation.
/// </summary>
internal static class Require
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotNull<T>(T parameter, string name)
where T : class
{
if (name == null)
{
throw new ArgumentNullException(nameof(name), "Incorrectly passed a null value as name");
}
if (parameter == null)
{
throw new ArgumentNullException(name);
}
}
}
} | mit | C# |
cb42cc0f2b9e3319aa94b19cfff54ae2d2fae6fe | add == and != operators to Position struct | Voxelgon/Voxelgon,Voxelgon/Voxelgon | Assets/Voxelgon/Math/Position.cs | Assets/Voxelgon/Math/Position.cs | using UnityEngine;
namespace Voxelgon {
public struct Position {
short x;
short y;
short z;
public Position(short x, short y, short z) {
this.x = x;
this.y = y;
this.z = z;
}
public Position(float x, float y, float z) {
this.x = (short) x;
this.y = (short) y;
this.z = (short) z;
}
public Position(Vector3 v) {
this.x = (short) v.x;
this.y = (short) v.y;
this.z = (short) v.z;
}
public static explicit operator Position(Vector3 v) {
return new Position(v);
}
public static explicit operator Vector3(Position pos) {
return new Vector3(pos.x, pos.y, pos.z);
}
public static bool operator ==(Position a, Position b) {
return (a.x == b.x && a.y == b.y && a.z == b.z);
}
public static bool operator !=(Position a, Position b) {
return (a.x != b.x || a.y != b.y || a.z != b.z);
}
}
} | using UnityEngine;
namespace Voxelgon {
public struct Position {
short x;
short y;
short z;
public Position(short x, short y, short z) {
this.x = x;
this.y = y;
this.z = z;
}
public Position(float x, float y, float z) {
this.x = (short) x;
this.y = (short) y;
this.z = (short) z;
}
public Position(Vector3 v) {
this.x = (short) v.x;
this.y = (short) v.y;
this.z = (short) v.z;
}
public static explicit operator Position(Vector3 v) {
return new Position(v);
}
public static explicit operator Vector3(Position pos) {
return new Vector3(pos.x, pos.y, pos.z);
}
}
} | apache-2.0 | C# |
1b2aed8a0718642a93928a45e4d83a4912a78791 | Change in content | abhi911kumar/portfolio,abhi911kumar/portfolio,abhi911kumar/portfolio | Portfolio/Portfolio/Views/Home/Pages/_HeaderPage.cshtml | Portfolio/Portfolio/Views/Home/Pages/_HeaderPage.cshtml | <header id="home">
<div id="logoContent" class="hidden-md hidden-sm hidden-xs">
<a href="#home" class="page-scroll"><img src="~/Resources/Images/portfolio/logoAbhishek.png" /></a>
</div>
<a class="page-scroll backhome hidden-md hidden-sm hidden-xs" href="#home"><i class="fa fa-times fa-2x"></i></a>
<div class="header-content">
@*<div class="col-lg-5 hidden-md hidden-sm hidden-xs hidden-print">
<img class="rotationYenYang" src="~/Resources/Images/portfolio/HeaderImages/yenYang.png" style="height:500px;" alt="Abhishek Mallick Image" />
</div>*@
<div class="col-lg-12 col-sm-12 col-xs-12">
<div class="header-content-inner">
<h1 id="homeHeading">Full-Stack Designer</h1>
<hr>
<p>Hello, I’m Abhishek Mallick. I Have @(DateTime.Now.Year - 2013) years of experience in Web and UX design. I have worked and working on a variety of projects, applications and solutions and with complexity both big and small.</p>
<a href="#contact" class="btn btn-default page-scroll">Contact Me</a>
@*<a href="#" class="btn btn-primary page-scroll">Download CV</a>*@
</div>
</div>
<div class="clearfix"></div>
</div>
</header>
<div class="clearfix"></div> | <header id="home">
<div id="logoContent" class="hidden-md hidden-sm hidden-xs">
<a href="#home" class="page-scroll"><img src="~/Resources/Images/portfolio/logoAbhishek.png" /></a>
</div>
<a class="page-scroll backhome hidden-md hidden-sm hidden-xs" href="#home"><i class="fa fa-times fa-2x"></i></a>
<div class="header-content">
@*<div class="col-lg-5 hidden-md hidden-sm hidden-xs hidden-print">
<img class="rotationYenYang" src="~/Resources/Images/portfolio/HeaderImages/yenYang.png" style="height:500px;" alt="Abhishek Mallick Image" />
</div>*@
<div class="col-lg-12 col-sm-12 col-xs-12">
<div class="header-content-inner">
<h1 id="homeHeading">Full Stack Designer</h1>
<hr>
<p>Hello, I’m Abhishek Mallick. I Have @(DateTime.Now.Year - 2013) years of experience in Web and UX design. I have worked and working on a variety of projects, applications and solutions and with complexity both big and small.</p>
<a href="#contact" class="btn btn-default page-scroll">Contact Me</a>
@*<a href="#" class="btn btn-primary page-scroll">Download CV</a>*@
</div>
</div>
<div class="clearfix"></div>
</div>
</header>
<div class="clearfix"></div> | mit | C# |
47ce003b5fac506c9f2487649f8f589221267e22 | Bump to v5.0.3 | danielwertheim/mycouch,danielwertheim/mycouch | buildconfig.cake | buildconfig.cake | public class BuildConfig
{
private const string Version = "5.0.3";
public readonly string SrcDir = "./source/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildVersion { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var branch = context.Argument("branch", string.Empty).ToLower();
var buildRevision = context.Argument("buildrevision", "0");
var isRelease = branch == "master";
return new BuildConfig
{
Target = context.Argument("target", "Default"),
SemVer = Version + (isRelease
? string.Empty
: "-pre" + buildRevision),
BuildVersion = Version + "." + buildRevision,
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
| public class BuildConfig
{
private const string Version = "5.0.2";
public readonly string SrcDir = "./source/";
public readonly string OutDir = "./build/";
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildVersion { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var branch = context.Argument("branch", string.Empty).ToLower();
var buildRevision = context.Argument("buildrevision", "0");
var isRelease = branch == "master";
return new BuildConfig
{
Target = context.Argument("target", "Default"),
SemVer = Version + (isRelease
? string.Empty
: "-pre" + buildRevision),
BuildVersion = Version + "." + buildRevision,
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}
| mit | C# |
879031a024a36bd1c5887cb52f7d48a994922f0d | Update "SQLiteManager" | DRFP/Personal-Library | _Build/PersonalLibrary/Library/SQLiteManager.cs | _Build/PersonalLibrary/Library/SQLiteManager.cs | using Library.Model;
using SQLite;
using System.Threading.Tasks;
using static Library.Configuration;
using static Library.Database;
namespace Library {
public class SQLiteManager {
private static SQLiteAsyncConnection connection;
static SQLiteManager() { connection = new SQLiteAsyncConnection(databaseName); }
public static async Task CreateDatabase() {
await connection.CreateTablesAsync<Book, Shelf>();
await connection.InsertAllAsync(Shelves());
}
}
} | using Library.Model;
using SQLite;
using System.Threading.Tasks;
using static Library.Configuration;
using static Library.Database;
namespace Library {
public class SQLiteManager {
private static SQLiteAsyncConnection connection;
static SQLiteManager() { connection = new SQLiteAsyncConnection(databaseName); }
public static async Task CreateDatabase() {
await connection.CreateTablesAsync<Book, Shelf>();
await connection.InsertAllAsync(Books());
await connection.InsertAllAsync(Shelves());
}
}
} | mit | C# |
3b680d80ab58043ec6a9ec45f1d0606769c45c9e | Resolve CA1012 warnings | tjb042/Establishment | Establishment/BaseEstablisher.cs | Establishment/BaseEstablisher.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Establishment {
public abstract class BaseEstablisher<TType> {
protected BaseEstablisher(TType value) {
Value = value;
ThrowExceptionOnFailure = true;
GenericType = typeof(TType);
DefaultComparer = EqualityComparer<TType>.Default;
}
public TType Value {
get;
protected set;
}
protected Type GenericType {
get;
private set;
}
protected IEqualityComparer<TType> DefaultComparer {
get;
private set;
}
public bool HasExceptions {
get;
protected set;
}
public Exception LastException {
get;
protected set;
}
public bool ThrowExceptionOnFailure {
get;
set;
}
protected virtual void HandleFailure(Exception ex) {
HasExceptions = true;
LastException = ex;
if (ThrowExceptionOnFailure) {
throw ex;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Establishment {
public abstract class BaseEstablisher<TType> {
public BaseEstablisher(TType value) {
Value = value;
ThrowExceptionOnFailure = true;
GenericType = typeof(TType);
DefaultComparer = EqualityComparer<TType>.Default;
}
public TType Value {
get;
protected set;
}
protected Type GenericType {
get;
private set;
}
protected IEqualityComparer<TType> DefaultComparer {
get;
private set;
}
public bool HasExceptions {
get;
protected set;
}
public Exception LastException {
get;
protected set;
}
public bool ThrowExceptionOnFailure {
get;
set;
}
protected virtual void HandleFailure(Exception ex) {
HasExceptions = true;
LastException = ex;
if (ThrowExceptionOnFailure) {
throw ex;
}
}
}
}
| mit | C# |
a8a2f2954faa9b33c1d1ecdc115cd18ccfef73e2 | Test cleanup | filipw/dotnet-script,filipw/dotnet-script | src/Dotnet.Script.Tests/ScriptExecutionTests.cs | src/Dotnet.Script.Tests/ScriptExecutionTests.cs | using System.IO;
using Xunit;
namespace Dotnet.Script.Tests
{
public class ScriptExecutionTests
{
[Fact]
public void ShouldExecuteHelloWorld()
{
var result = Execute(Path.Combine("HelloWorld", "HelloWorld.csx"));
Assert.Contains("Hello World", result);
}
[Fact]
public void ShouldExecuteScriptWithInlineNugetPackage()
{
var result = Execute(Path.Combine("InlineNugetPackage", "InlineNugetPackage.csx"));
Assert.Contains("AutoMapper.MapperConfiguration", result);
}
[Fact]
public void ShouldIncludeExceptionLineNumberAndFile()
{
var result = Execute(Path.Combine("Exception", "Error.csx"));
Assert.Contains("Error.csx:line 1", result);
}
[Fact]
public void ShouldHandlePackageWithNativeLibraries()
{
var result = Execute(Path.Combine("NativeLibrary", "NativeLibrary.csx"));
Assert.Contains("Connection successful", result);
}
private static string Execute(string fixture)
{
var result = ProcessHelper.RunAndCaptureOutput("dotnet", GetDotnetScriptArguments(Path.Combine("..", "..", "..", "TestFixtures", fixture)));
return result;
}
/// <summary>
/// Use this method if you need to debug
/// </summary>
private static int ExecuteInProcess(string fixture)
{
var pathToFixture = Path.Combine("..", "..", "..","TestFixtures", fixture);
return Program.Main(new []{ pathToFixture });
}
private static string[] GetDotnetScriptArguments(string fixture)
{
return new[] { "exec", Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "Dotnet.Script", "bin", "Debug", "netcoreapp1.1", "dotnet-script.dll"), fixture };
}
}
}
| using System.IO;
using Xunit;
namespace Dotnet.Script.Tests
{
public class ScriptExecutionTests
{
[Fact]
public void ShouldExecuteHelloWorld()
{
var result = Execute(Path.Combine("HelloWorld", "HelloWorld.csx"));
Assert.Contains("Hello World", result);
}
[Fact]
public void ShouldExecuteScriptWithInlineNugetPackage()
{
var result = Execute(Path.Combine("InlineNugetPackage", "InlineNugetPackage.csx"));
Assert.Contains("AutoMapper.MapperConfiguration", result);
}
[Fact]
public void ShouldIncludeExceptionLineNumberAndFile()
{
var result = Execute(Path.Combine("Exception", "Error.csx"));
Assert.Contains("Error.csx:line 1", result);
}
[Fact]
public void ShouldHandlePackageWithNativeLibraries()
{
ExecuteInProcess(Path.Combine("NativeLibrary", "NativeLibrary.csx"));
//var result = Execute(Path.Combine("NativeLibrary", "NativeLibrary.csx"));
//Assert.Contains("Connection successful", result);
}
private static string Execute(string fixture)
{
var result = ProcessHelper.RunAndCaptureOutput("dotnet", GetDotnetScriptArguments(Path.Combine("..", "..", "..", "TestFixtures", fixture)));
return result;
}
/// <summary>
/// Use this method if you need to debug
/// </summary>
private static int ExecuteInProcess(string fixture)
{
var pathToFixture = Path.Combine("..", "..", "..","TestFixtures", fixture);
return Program.Main(new []{ pathToFixture });
}
private static string[] GetDotnetScriptArguments(string fixture)
{
return new[] { "exec", Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "Dotnet.Script", "bin", "Debug", "netcoreapp1.1", "dotnet-script.dll"), fixture };
}
}
}
| mit | C# |
88540777f49a813439f9efad78563b8fb79265ef | Remove unused field. | santriseus/NLog.Targets.LogIO | src/NLog.Targets.LogIO/InternalNetworkTarget.cs | src/NLog.Targets.LogIO/InternalNetworkTarget.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NLog.Common;
using NLog.Layouts;
namespace NLog.Targets.LogIO
{
internal sealed class InternalNetworkTarget : NetworkTarget
{
public Layout Node { get; set; }
public Layout Stream { get; set; }
protected override byte[] GetBytesToWrite(LogEventInfo logEvent)
{
string message = "+log|" + Stream.Render(logEvent) + "|" + Node.Render(logEvent) + "|info|";
var header = Encoding.GetBytes(message);
var main = base.GetBytesToWrite(logEvent);
var result = new byte[header.Length + main.Length];
System.Buffer.BlockCopy(header, 0, result, 0, header.Length);
System.Buffer.BlockCopy(main, 0, result, header.Length, main.Length);
return result;
}
public void FlushAsync(AsyncContinuation asyncContinuation)
{
base.FlushAsync(asyncContinuation);
}
public void CloseTarget()
{
base.CloseTarget();
}
public void Write(AsyncLogEventInfo logEvent)
{
base.Write(logEvent);
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NLog.Common;
using NLog.Layouts;
namespace NLog.Targets.LogIO
{
internal sealed class InternalNetworkTarget : NetworkTarget
{
private string _node = null;
public Layout Node { get; set; }
public Layout Stream { get; set; }
protected override byte[] GetBytesToWrite(LogEventInfo logEvent)
{
string message = "+log|" + Stream.Render(logEvent) + "|" + Node.Render(logEvent) + "|info|";
var header = Encoding.GetBytes(message);
var main = base.GetBytesToWrite(logEvent);
var result = new byte[header.Length + main.Length];
System.Buffer.BlockCopy(header, 0, result, 0, header.Length);
System.Buffer.BlockCopy(main, 0, result, header.Length, main.Length);
return result;
}
public void FlushAsync(AsyncContinuation asyncContinuation)
{
base.FlushAsync(asyncContinuation);
}
public void CloseTarget()
{
base.CloseTarget();
}
public void Write(AsyncLogEventInfo logEvent)
{
base.Write(logEvent);
}
}
}
| mit | C# |
68a5969006ca4cbf4c4a960a046375f518158c16 | Fix .tga viewer | feliwir/openSage,feliwir/openSage | src/OpenSage.DataViewer/Framework/BmpUtility.cs | src/OpenSage.DataViewer/Framework/BmpUtility.cs | using System.IO;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
namespace OpenSage.DataViewer.Framework
{
internal static class BmpUtility
{
public static byte[] PrependBmpHeader(byte[] rgbaData, int width, int height)
{
var pixels = new Argb32[width * height];
var pixelIndex = 0;
for (var i = 0; i < rgbaData.Length; i += 4)
{
pixels[pixelIndex++] = new Argb32(
rgbaData[i + 0],
rgbaData[i + 1],
rgbaData[i + 2],
rgbaData[i + 3]);
}
using (var outputStream = new MemoryStream())
{
var image = Image.LoadPixelData(pixels, width, height);
image.SaveAsBmp(outputStream);
return outputStream.ToArray();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenSage.DataViewer.Framework
{
internal static class BmpUtility
{
public static byte[] PrependBmpHeader(byte[] rgbaData, int width, int height)
{
using (var stream = new MemoryStream(54 + rgbaData.Length))
using (var binaryWriter = new BinaryWriter(stream))
{
binaryWriter.Write((ushort) 0x4D42);
binaryWriter.Write((uint) stream.Length);
binaryWriter.Write((ushort) 0);
binaryWriter.Write((ushort) 0);
binaryWriter.Write((uint) 54);
binaryWriter.Write((uint) 40);
binaryWriter.Write((uint) width);
binaryWriter.Write((uint) height);
binaryWriter.Write((ushort) 1);
binaryWriter.Write((ushort) 32);
binaryWriter.Write((uint) 0);
binaryWriter.Write((uint) rgbaData.Length);
binaryWriter.Write((uint) 96);
binaryWriter.Write((uint) 96);
binaryWriter.Write((uint) 0);
binaryWriter.Write((uint) 0);
binaryWriter.Write(rgbaData);
return stream.ToArray();
}
}
}
}
| mit | C# |
b4eb72cbde3e744a53bd6285d11ef38c0382629e | Update TenantProvider | WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common | src/WeihanLi.Common/Services/ITenantProvider.cs | src/WeihanLi.Common/Services/ITenantProvider.cs | using System;
using WeihanLi.Common.Models;
using WeihanLi.Extensions;
namespace WeihanLi.Common.Services
{
public interface ITenantProvider
{
string GetTenantId();
TenantInfo GetTenantInfo();
}
public static class TenantIdProviderExtensions
{
public static T? GetTenantId<T>(this ITenantProvider tenantIdProvider, T? defaultValue = default)
{
return tenantIdProvider.GetTenantId().ToOrDefault(defaultValue);
}
public static bool TryGetTenantId<T>(this ITenantProvider tenantIdProvider, out T? value, T? defaultValue = default)
{
try
{
var tenantId = tenantIdProvider.GetTenantId();
if (!string.IsNullOrEmpty(tenantId))
{
value = tenantId.To<T>();
return true;
}
}
catch (Exception)
{
// ignored
}
value = defaultValue;
return false;
}
}
}
| using System;
using WeihanLi.Common.Models;
using WeihanLi.Extensions;
namespace WeihanLi.Common.Services
{
public interface ITenantProvider
{
string GetTenantId();
TenantInfo<TKey> GetTenantInfo<TKey>();
}
public static class TenantIdProviderExtensions
{
public static T? GetTenantId<T>(this ITenantProvider tenantIdProvider, T? defaultValue = default)
{
return tenantIdProvider.GetTenantId().ToOrDefault(defaultValue);
}
public static bool TryGetTenantId<T>(this ITenantProvider tenantIdProvider, out T? value, T? defaultValue = default)
{
try
{
var tenantId = tenantIdProvider.GetTenantId();
if (!string.IsNullOrEmpty(tenantId))
{
value = tenantId.To<T>();
return true;
}
}
catch (Exception)
{
// ignored
}
value = defaultValue;
return false;
}
}
}
| mit | C# |
cb9cf80e67e5cfe50dc2813aebe6e856b917fb82 | Fix a nullref exception in path comparisons | awaescher/RepoZ,awaescher/RepoZ | RepoZ.Api/Git/DefaultRepositoryInformationAggregator.cs | RepoZ.Api/Git/DefaultRepositoryInformationAggregator.cs | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RepoZ.Api.Git
{
public class DefaultRepositoryInformationAggregator : IRepositoryInformationAggregator
{
private ObservableCollection<RepositoryView> _dataSource = new ObservableCollection<RepositoryView>();
private StatusCompressor _compressor;
public DefaultRepositoryInformationAggregator(StatusCompressor compressor)
{
_compressor = compressor;
}
public void Add(Repository repository)
{
var view = new RepositoryView(repository);
_dataSource.Remove(view);
_dataSource.Add(view);
}
public void RemoveByPath(string path)
{
var viewsToRemove = _dataSource.Where(r => r.Path.Equals(path, StringComparison.OrdinalIgnoreCase)).ToArray();
for (int i = viewsToRemove.Length - 1; i >= 0; i--)
_dataSource.Remove(viewsToRemove[i]);
}
public string GetStatusByPath(string path)
{
if (string.IsNullOrEmpty(path))
return string.Empty;
var views = _dataSource.ToList(); // threading issues :(
if (!views.Any())
return string.Empty;
if (!path.EndsWith("\\", StringComparison.Ordinal))
path += "\\";
var viewsByPath = views.Where(r => r?.Path != null && path.StartsWith(r.Path, StringComparison.OrdinalIgnoreCase));
if (!viewsByPath.Any())
return string.Empty;
var view = viewsByPath.OrderByDescending(r => r.Path.Length).First();
string status = _compressor.Compress(view.Repository);
if (string.IsNullOrEmpty(status))
return view.CurrentBranch;
return view.CurrentBranch + " " + status;
}
public ObservableCollection<RepositoryView> Repositories => _dataSource;
}
}
| using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RepoZ.Api.Git
{
public class DefaultRepositoryInformationAggregator : IRepositoryInformationAggregator
{
private ObservableCollection<RepositoryView> _dataSource = new ObservableCollection<RepositoryView>();
private StatusCompressor _compressor;
public DefaultRepositoryInformationAggregator(StatusCompressor compressor)
{
_compressor = compressor;
}
public void Add(Repository repository)
{
var view = new RepositoryView(repository);
_dataSource.Remove(view);
_dataSource.Add(view);
}
public void RemoveByPath(string path)
{
var viewsToRemove = _dataSource.Where(r => r.Path.Equals(path, StringComparison.OrdinalIgnoreCase)).ToArray();
for (int i = viewsToRemove.Length - 1; i >= 0; i--)
_dataSource.Remove(viewsToRemove[i]);
}
public string GetStatusByPath(string path)
{
var views = _dataSource.ToList(); // threading issues :(
if (!views.Any())
return string.Empty;
if (!path.EndsWith("\\", StringComparison.Ordinal))
path += "\\";
var viewsByPath = views.Where(r => path.StartsWith(r.Path, StringComparison.OrdinalIgnoreCase));
if (!viewsByPath.Any())
return string.Empty;
var view = viewsByPath.OrderByDescending(r => r.Path.Length).First();
string status = _compressor.Compress(view.Repository);
if (string.IsNullOrEmpty(status))
return view.CurrentBranch;
return view.CurrentBranch + " " + status;
}
public ObservableCollection<RepositoryView> Repositories => _dataSource;
}
}
| mit | C# |
473bbfab0cdb22111a3386b4aceec882b102bec7 | Fix Uuid.Equals() method -- had been returning false for equal Guid values. | brendanjbaker/Bakery | src/Bakery.Uuid/Bakery/Uuid.cs | src/Bakery.Uuid/Bakery/Uuid.cs | namespace Bakery
{
using System;
using System.ComponentModel;
[TypeConverter(typeof(UuidTypeConverter))]
public struct Uuid
{
public static readonly Uuid Zero;
private readonly Guid guid;
static Uuid()
{
Zero = new Uuid(Guid.Empty);
}
public Uuid(Guid guid)
{
this.guid = guid;
}
public static implicit operator Guid(Uuid uuid)
{
return uuid.guid;
}
public static implicit operator Uuid(Guid guid)
{
return new Uuid(guid);
}
public static Boolean operator ==(Uuid alpha, Uuid omega)
{
return alpha.guid == omega.guid;
}
public static Boolean operator ==(Uuid alpha, Guid omega)
{
return alpha.guid == omega;
}
public static Boolean operator ==(Guid alpha, Uuid omega)
{
return alpha == omega.guid;
}
public static Boolean operator !=(Uuid alpha, Uuid omega)
{
return alpha.guid != omega.guid;
}
public static Boolean operator !=(Uuid alpha, Guid omega)
{
return alpha.guid != omega;
}
public static Boolean operator !=(Guid alpha, Uuid omega)
{
return alpha != omega.guid;
}
public static Boolean operator <(Uuid alpha, Uuid omega)
{
return alpha.guid.CompareTo(omega.guid) < 0;
}
public static Boolean operator >(Uuid alpha, Uuid omega)
{
return alpha.guid.CompareTo(omega.guid) > 0;
}
public static Uuid Parse(String @string)
{
return new Uuid(Guid.Parse(@string));
}
public override Boolean Equals(Object @object)
{
if (@object == null)
return false;
if (@object.GetType() == typeof(Guid))
@object = new Uuid((Guid)@object);
if (@object.GetType() != typeof(Uuid))
return false;
var uuid = (Uuid)@object;
return guid == uuid.guid;
}
public override Int32 GetHashCode()
{
return guid.GetHashCode();
}
public override String ToString()
{
return guid.ToString("N");
}
}
}
| namespace Bakery
{
using System;
using System.ComponentModel;
[TypeConverter(typeof(UuidTypeConverter))]
public struct Uuid
{
public static readonly Uuid Zero;
private readonly Guid guid;
static Uuid()
{
Zero = new Uuid(Guid.Empty);
}
public Uuid(Guid guid)
{
this.guid = guid;
}
public static implicit operator Guid(Uuid uuid)
{
return uuid.guid;
}
public static implicit operator Uuid(Guid guid)
{
return new Uuid(guid);
}
public static Boolean operator ==(Uuid alpha, Uuid omega)
{
return alpha.guid == omega.guid;
}
public static Boolean operator ==(Uuid alpha, Guid omega)
{
return alpha.guid == omega;
}
public static Boolean operator ==(Guid alpha, Uuid omega)
{
return alpha == omega.guid;
}
public static Boolean operator !=(Uuid alpha, Uuid omega)
{
return alpha.guid != omega.guid;
}
public static Boolean operator !=(Uuid alpha, Guid omega)
{
return alpha.guid != omega;
}
public static Boolean operator !=(Guid alpha, Uuid omega)
{
return alpha != omega.guid;
}
public static Boolean operator <(Uuid alpha, Uuid omega)
{
return alpha.guid.CompareTo(omega.guid) < 0;
}
public static Boolean operator >(Uuid alpha, Uuid omega)
{
return alpha.guid.CompareTo(omega.guid) > 0;
}
public static Uuid Parse(String @string)
{
return new Uuid(Guid.Parse(@string));
}
public override Boolean Equals(Object @object)
{
if (@object == null)
return false;
if (@object.GetType() != typeof(Uuid))
return false;
var uuid = (Uuid)@object;
return guid == uuid.guid;
}
public override Int32 GetHashCode()
{
return guid.GetHashCode();
}
public override String ToString()
{
return guid.ToString("N");
}
}
}
| mit | C# |
8724297d516f2494ce11db6fb1a4de64b1864507 | fix platform detection (#577) | prime31/Nez,prime31/Nez,prime31/Nez,ericmbernier/Nez | Nez.Portable/Input/InputUtils.cs | Nez.Portable/Input/InputUtils.cs | using System;
using Microsoft.Xna.Framework.Input;
namespace Nez
{
public static class InputUtils
{
public static bool IsMac;
public static bool IsWindows;
public static bool IsLinux;
static InputUtils()
{
IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
IsLinux = Environment.OSVersion.Platform == PlatformID.Unix;
IsMac = Environment.OSVersion.Platform == PlatformID.MacOSX;
}
public static bool IsShiftDown()
{
return Input.IsKeyDown(Keys.LeftShift) || Input.IsKeyDown(Keys.RightShift);
}
public static bool IsAltDown()
{
return Input.IsKeyDown(Keys.LeftAlt) || Input.IsKeyDown(Keys.RightAlt);
}
public static bool IsControlDown()
{
if (IsMac)
return Input.IsKeyDown(Keys.LeftWindows) || Input.IsKeyDown(Keys.RightWindows);
return Input.IsKeyDown(Keys.LeftControl) || Input.IsKeyDown(Keys.RightControl);
}
}
} | using Microsoft.Xna.Framework.Input;
namespace Nez
{
public static class InputUtils
{
public static bool IsMac;
public static bool IsWindows;
public static bool IsLinux;
static InputUtils()
{
IsMac = true;
}
public static bool IsShiftDown()
{
return Input.IsKeyDown(Keys.LeftShift) || Input.IsKeyDown(Keys.RightShift);
}
public static bool IsAltDown()
{
return Input.IsKeyDown(Keys.LeftAlt) || Input.IsKeyDown(Keys.RightAlt);
}
public static bool IsControlDown()
{
if (IsMac)
return Input.IsKeyDown(Keys.LeftWindows) || Input.IsKeyDown(Keys.RightWindows);
return Input.IsKeyDown(Keys.LeftControl) || Input.IsKeyDown(Keys.RightControl);
}
}
} | mit | C# |
336679631c05c984c63d18f18aa501d5ae7da682 | add assembly informations | maskott-inc/xAPI.NET | src/xAPI.Client/Properties/AssemblyInfo.cs | src/xAPI.Client/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("xAPI.NET Client")]
[assembly: AssemblyDescription("xAPI.NET is a free, open-source xAPI client for .NET.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Maskott")]
[assembly: AssemblyProduct("xAPI.Client")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("03d89b4c-aadf-44ff-8ab8-232349168d1c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("xAPI.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("xAPI.Client")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("03d89b4c-aadf-44ff-8ab8-232349168d1c")]
// 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# |
9c00e810980d66a391a7f275005fb92230fb8166 | Bump version to 1.1.0 | chausner/ArffTools | ArffTools/Properties/AssemblyInfo.cs | ArffTools/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("ArffTools")]
[assembly: AssemblyDescription("Library for reading and writing Weka attribute-relation file format (ARFF) files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Christoph Hausner")]
[assembly: AssemblyProduct("ArffTools")]
[assembly: AssemblyCopyright("Copyright © Christoph Hausner 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("1fc255c3-f50c-4531-ba56-fb2b3b8dfcb3")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: InternalsVisibleTo("ArffTools.Tests")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("ArffTools")]
[assembly: AssemblyDescription("Library for reading and writing Weka attribute-relation file format (ARFF) files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Christoph Hausner")]
[assembly: AssemblyProduct("ArffTools")]
[assembly: AssemblyCopyright("Copyright © Christoph Hausner 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("1fc255c3-f50c-4531-ba56-fb2b3b8dfcb3")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: InternalsVisibleTo("ArffTools.Tests")]
| mit | C# |
c99df62990002d1bfa14751508be3c63197371ce | Make scene asset / scene name deprecated | insthync/LiteNetLibManager,insthync/LiteNetLibManager | Scripts/Utils/LiteNetLibScene.cs | Scripts/Utils/LiteNetLibScene.cs | using UnityEngine;
namespace LiteNetLibManager
{
[System.Serializable]
public class LiteNetLibScene
{
[SerializeField]
private Object sceneAsset;
[SerializeField]
private string sceneName = string.Empty;
public string SceneName
{
get { return sceneName; }
set { sceneName = value; }
}
public static implicit operator string(LiteNetLibScene unityScene)
{
return unityScene.SceneName;
}
public bool IsSet()
{
return !string.IsNullOrEmpty(sceneName);
}
}
}
| using UnityEngine;
namespace LiteNetLibManager
{
[System.Serializable]
public class LiteNetLibScene
{
[SerializeField]
public Object sceneAsset;
[SerializeField]
public string sceneName = string.Empty;
public string SceneName
{
get { return sceneName; }
set { sceneName = value; }
}
public static implicit operator string(LiteNetLibScene unityScene)
{
return unityScene.SceneName;
}
public bool IsSet()
{
return !string.IsNullOrEmpty(sceneName);
}
}
}
| mit | C# |
d58d049518de970bb68415c3c6c6328da4388f87 | Remove redundant annotation | beratcarsi/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,yuzukwok/aspnetboilerplate,AlexGeller/aspnetboilerplate,690486439/aspnetboilerplate,berdankoca/aspnetboilerplate,lemestrez/aspnetboilerplate,ZhaoRd/aspnetboilerplate,s-takatsu/aspnetboilerplate,lvjunlei/aspnetboilerplate,virtualcca/aspnetboilerplate,lemestrez/aspnetboilerplate,carldai0106/aspnetboilerplate,4nonym0us/aspnetboilerplate,ryancyq/aspnetboilerplate,Tobyee/aspnetboilerplate,Nongzhsh/aspnetboilerplate,oceanho/aspnetboilerplate,690486439/aspnetboilerplate,s-takatsu/aspnetboilerplate,ShiningRush/aspnetboilerplate,verdentk/aspnetboilerplate,Nongzhsh/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,AlexGeller/aspnetboilerplate,oceanho/aspnetboilerplate,zclmoon/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,jaq316/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,fengyeju/aspnetboilerplate,carldai0106/aspnetboilerplate,berdankoca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,nineconsult/Kickoff2016Net,carldai0106/aspnetboilerplate,Tobyee/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,oceanho/aspnetboilerplate,yuzukwok/aspnetboilerplate,fengyeju/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ZhaoRd/aspnetboilerplate,SXTSOFT/aspnetboilerplate,fengyeju/aspnetboilerplate,SXTSOFT/aspnetboilerplate,andmattia/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,zquans/aspnetboilerplate,s-takatsu/aspnetboilerplate,ZhaoRd/aspnetboilerplate,ShiningRush/aspnetboilerplate,beratcarsi/aspnetboilerplate,virtualcca/aspnetboilerplate,jaq316/aspnetboilerplate,Tobyee/aspnetboilerplate,690486439/aspnetboilerplate,nineconsult/Kickoff2016Net,luchaoshuai/aspnetboilerplate,zquans/aspnetboilerplate,zclmoon/aspnetboilerplate,beratcarsi/aspnetboilerplate,verdentk/aspnetboilerplate,lemestrez/aspnetboilerplate,lvjunlei/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,jaq316/aspnetboilerplate,4nonym0us/aspnetboilerplate,berdankoca/aspnetboilerplate,zquans/aspnetboilerplate,verdentk/aspnetboilerplate,SXTSOFT/aspnetboilerplate,ilyhacker/aspnetboilerplate,lvjunlei/aspnetboilerplate,andmattia/aspnetboilerplate,luchaoshuai/aspnetboilerplate,AlexGeller/aspnetboilerplate,4nonym0us/aspnetboilerplate,ilyhacker/aspnetboilerplate,ShiningRush/aspnetboilerplate,yuzukwok/aspnetboilerplate | src/Abp/Domain/Uow/UnitOfWorkRegistrar.cs | src/Abp/Domain/Uow/UnitOfWorkRegistrar.cs | using System.Linq;
using System.Reflection;
using Abp.Dependency;
using Castle.Core;
using Castle.MicroKernel;
namespace Abp.Domain.Uow
{
/// <summary>
/// This class is used to register interceptor for needed classes for Unit Of Work mechanism.
/// </summary>
internal static class UnitOfWorkRegistrar
{
/// <summary>
/// Initializes the registerer.
/// </summary>
/// <param name="iocManager">IOC manager</param>
public static void Initialize(IIocManager iocManager)
{
iocManager.IocContainer.Kernel.ComponentRegistered += ComponentRegistered;
}
private static void ComponentRegistered(string key, IHandler handler)
{
if (UnitOfWorkHelper.IsConventionalUowClass(handler.ComponentModel.Implementation))
{
//Intercept all methods of all repositories.
handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
}
else if (handler.ComponentModel.Implementation.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any(UnitOfWorkHelper.HasUnitOfWorkAttribute))
{
//Intercept all methods of classes those have at least one method that has UnitOfWork attribute.
//TODO: Intecept only UnitOfWork methods, not other methods!
handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
}
}
}
} | using System.Linq;
using System.Reflection;
using Abp.Dependency;
using Castle.Core;
using Castle.MicroKernel;
namespace Abp.Domain.Uow
{
/// <summary>
/// This class is used to register interceptor for needed classes for Unit Of Work mechanism.
/// </summary>
internal static class UnitOfWorkRegistrar
{
/// <summary>
/// Initializes the registerer.
/// </summary>sssss
/// <param name="iocManager">IOC manager</param>
public static void Initialize(IIocManager iocManager)
{
iocManager.IocContainer.Kernel.ComponentRegistered += ComponentRegistered;
}
private static void ComponentRegistered(string key, IHandler handler)
{
if (UnitOfWorkHelper.IsConventionalUowClass(handler.ComponentModel.Implementation))
{
//Intercept all methods of all repositories.
handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
}
else if (handler.ComponentModel.Implementation.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any(UnitOfWorkHelper.HasUnitOfWorkAttribute))
{
//Intercept all methods of classes those have at least one method that has UnitOfWork attribute.
//TODO: Intecept only UnitOfWork methods, not other methods!
handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
}
}
}
} | mit | C# |
881c2a89f7594aefc9a6f865cc9a6c863a6c44d0 | Change iOS XF surface background color to black | florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho | Bindings/Forms/IosSurfaceRenderer.cs | Bindings/Forms/IosSurfaceRenderer.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using Urho.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;
[assembly: ExportRendererAttribute(typeof(UrhoSurface), typeof(IosSurfaceRenderer))]
namespace Urho.Forms
{
public class IosSurfaceRenderer : ViewRenderer<UrhoSurface, IosUrhoSurface>
{
protected override void OnElementChanged(ElementChangedEventArgs<UrhoSurface> e)
{
var surface = new IosUrhoSurface();
surface.BackgroundColor = UIColor.Black;
e.NewElement.UrhoApplicationLauncher = surface.Launcher;
SetNativeControl(surface);
}
}
public class IosUrhoSurface : UIView
{
static TaskCompletionSource<Application> applicationTaskSource;
static readonly SemaphoreSlim launcherSemaphore = new SemaphoreSlim(1);
static Urho.iOS.UrhoSurface surface;
internal async Task<Urho.Application> Launcher(Type type, ApplicationOptions options)
{
await launcherSemaphore.WaitAsync();
applicationTaskSource = new TaskCompletionSource<Application>();
Urho.Application.Started += UrhoApplicationStarted;
surface?.RemoveFromSuperview();
this.Add(surface = new Urho.iOS.UrhoSurface(this.Bounds));
Urho.Application.CreateInstance(type, options).Run();
return await applicationTaskSource.Task;
}
void UrhoApplicationStarted()
{
Urho.Application.Started -= UrhoApplicationStarted;
applicationTaskSource?.TrySetResult(Application.Current);
launcherSemaphore.Release();
}
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
using Urho.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;
[assembly: ExportRendererAttribute(typeof(UrhoSurface), typeof(IosSurfaceRenderer))]
namespace Urho.Forms
{
public class IosSurfaceRenderer : ViewRenderer<UrhoSurface, IosUrhoSurface>
{
protected override void OnElementChanged(ElementChangedEventArgs<UrhoSurface> e)
{
var surface = new IosUrhoSurface();
surface.BackgroundColor = UIColor.Red;
e.NewElement.UrhoApplicationLauncher = surface.Launcher;
SetNativeControl(surface);
}
}
public class IosUrhoSurface : UIView
{
static TaskCompletionSource<Application> applicationTaskSource;
static readonly SemaphoreSlim launcherSemaphore = new SemaphoreSlim(1);
static Urho.iOS.UrhoSurface surface;
internal async Task<Urho.Application> Launcher(Type type, ApplicationOptions options)
{
await launcherSemaphore.WaitAsync();
applicationTaskSource = new TaskCompletionSource<Application>();
Urho.Application.Started += UrhoApplicationStarted;
surface?.RemoveFromSuperview();
this.Add(surface = new Urho.iOS.UrhoSurface(this.Bounds));
Urho.Application.CreateInstance(type, options).Run();
return await applicationTaskSource.Task;
}
void UrhoApplicationStarted()
{
Urho.Application.Started -= UrhoApplicationStarted;
applicationTaskSource?.TrySetResult(Application.Current);
launcherSemaphore.Release();
}
}
}
| mit | C# |
590d7bba4ea3d931b2632ae8d2c8dc38a25e9554 | Update index.cshtml | reactiveui/website,reactiveui/website,reactiveui/website,reactiveui/website | input/contribute/maintainers/index.cshtml | input/contribute/maintainers/index.cshtml | Order: 100
---
@Html.Partial("_ChildPages")
https://opensource.com/life/16/5/growing-contributor-base-modern-open-source
https://medium.com/@@mikeal/community-imbalance-theory-c5f8688ae352
<script async class="speakerdeck-embed" data-slide="4" data-id="880cb5d4ec364909a1db5b5655aa9d37" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>
| Order: 100
---
@Html.Partial("_ChildPages")
https://medium.com/@@mikeal/community-imbalance-theory-c5f8688ae352
<script async class="speakerdeck-embed" data-slide="4" data-id="880cb5d4ec364909a1db5b5655aa9d37" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>
| mit | C# |
a8809e04f95bf7c68fb96d0e708ee99592865883 | Use the correct size for the symlink path buffer | AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,grokys/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex | src/Avalonia.FreeDesktop/NativeMethods.cs | src/Avalonia.FreeDesktop/NativeMethods.cs | using System.Buffers;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace Avalonia.FreeDesktop
{
internal static class NativeMethods
{
[DllImport("libc", SetLastError = true)]
private static extern long readlink([MarshalAs(UnmanagedType.LPArray)] byte[] filename,
[MarshalAs(UnmanagedType.LPArray)] byte[] buffer,
long len);
public static string ReadLink(string path)
{
var symlinkSize = Encoding.UTF8.GetByteCount(path);
var bufferSize = 4097; // PATH_MAX is (usually?) 4096, but we need to know if the result was truncated
var symlink = ArrayPool<byte>.Shared.Rent(symlinkSize + 1);
var buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
try
{
Encoding.UTF8.GetBytes(path, 0, path.Length, symlink, 0);
symlink[symlinkSize] = 0;
var size = readlink(symlink, buffer, bufferSize);
Debug.Assert(size < bufferSize); // if this fails, we need to increase the buffer size (dynamically?)
return Encoding.UTF8.GetString(buffer, 0, (int)size);
}
finally
{
ArrayPool<byte>.Shared.Return(symlink);
ArrayPool<byte>.Shared.Return(buffer);
}
}
}
}
| using System.Buffers;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace Avalonia.FreeDesktop
{
internal static class NativeMethods
{
[DllImport("libc", SetLastError = true)]
private static extern long readlink([MarshalAs(UnmanagedType.LPArray)] byte[] filename,
[MarshalAs(UnmanagedType.LPArray)] byte[] buffer,
long len);
public static string ReadLink(string path)
{
var symlinkMaxSize = Encoding.ASCII.GetMaxByteCount(path.Length);
var bufferSize = 4097; // PATH_MAX is (usually?) 4096, but we need to know if the result was truncated
var symlink = ArrayPool<byte>.Shared.Rent(symlinkMaxSize + 1);
var buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
try
{
var symlinkSize = Encoding.UTF8.GetBytes(path, 0, path.Length, symlink, 0);
symlink[symlinkSize] = 0;
var size = readlink(symlink, buffer, bufferSize);
Debug.Assert(size < bufferSize); // if this fails, we need to increase the buffer size (dynamically?)
return Encoding.UTF8.GetString(buffer, 0, (int)size);
}
finally
{
ArrayPool<byte>.Shared.Return(symlink);
ArrayPool<byte>.Shared.Return(buffer);
}
}
}
}
| mit | C# |
f7f0c0b55d0aea9b97042d6518d12b34f86ab5ca | Add InvalidSessionId | joshbooker/Force.com-Toolkit-for-NET,MediaFriendsInc2/Force.com-Toolkit-for-NET,Compassion/Force.com-Toolkit-for-NET,caltomare/Force.com-Toolkit-for-NET,aaronhoffman/Force.com-Toolkit-for-NET,shankararunachalam/Force.com-Toolkit-for-NET,joeferraro/Force.com-Toolkit-for-NET,developerforce/Force.com-Toolkit-for-NET,dcarroll/Force.com-Toolkit-for-NET,nmonasterio/Force.com-Toolkit-for-NET,wadewegner/Force.com-Toolkit-for-NET,developerforce/Force.com-Toolkit-for-NET | src/CommonLibrariesForNET/Models/Error.cs | src/CommonLibrariesForNET/Models/Error.cs | namespace Salesforce.Common.Models
{
public enum Error
{
Unknown,
InvalidClient,
UnsupportedGrantType,
InvalidGrant,
AuthenticationFailure,
InvalidPassword,
ClientIdentifierInvalid,
NotFound,
MalFormedQuery,
FieldCustomValidationException,
InvalidFieldForInsertUpdate,
InvalidClientId,
InvalidField,
RequiredFieldMissing,
StringTooLong,
EntityIsDeleted,
MalFormedId,
InvalidQueryFilterOperator,
InvalidSessionId
}
}
| namespace Salesforce.Common.Models
{
public enum Error
{
Unknown,
InvalidClient,
UnsupportedGrantType,
InvalidGrant,
AuthenticationFailure,
InvalidPassword,
ClientIdentifierInvalid,
NotFound,
MalFormedQuery,
FieldCustomValidationException,
InvalidFieldForInsertUpdate,
InvalidClientId,
InvalidField,
RequiredFieldMissing,
StringTooLong,
EntityIsDeleted,
MalFormedId,
InvalidQueryFilterOperator
}
}
| bsd-3-clause | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.