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
deb167086212faa8d6c51fe911bcd54c1cc85c73
Use `Array.Empty` instead of constructed list
NeoAdonis/osu,NeoAdonis/osu,ppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu,peppy/osu
osu.Game/Database/EmptyRealmSet.cs
osu.Game/Database/EmptyRealmSet.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using Realms; using Realms.Schema; #nullable enable namespace osu.Game.Database { public class EmptyRealmSet<T> : IRealmCollection<T> { private IList<T> emptySet => Array.Empty<T>(); public IEnumerator<T> GetEnumerator() => emptySet.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => emptySet.GetEnumerator(); public int Count => emptySet.Count; public T this[int index] => emptySet[index]; public int IndexOf(object item) => emptySet.IndexOf((T)item); public bool Contains(object item) => emptySet.Contains((T)item); public event NotifyCollectionChangedEventHandler? CollectionChanged { add => throw new NotImplementedException(); remove => throw new NotImplementedException(); } public event PropertyChangedEventHandler? PropertyChanged { add => throw new NotImplementedException(); remove => throw new NotImplementedException(); } public IRealmCollection<T> Freeze() => throw new NotImplementedException(); public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback) => throw new NotImplementedException(); public bool IsValid => throw new NotImplementedException(); public Realm Realm => throw new NotImplementedException(); public ObjectSchema ObjectSchema => throw new NotImplementedException(); public bool IsFrozen => throw new NotImplementedException(); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using Realms; using Realms.Schema; #nullable enable namespace osu.Game.Database { public class EmptyRealmSet<T> : IRealmCollection<T> { private static List<T> emptySet => new List<T>(); public IEnumerator<T> GetEnumerator() { return emptySet.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)emptySet).GetEnumerator(); } public int Count => emptySet.Count; public T this[int index] => emptySet[index]; public event NotifyCollectionChangedEventHandler? CollectionChanged { add => throw new NotImplementedException(); remove => throw new NotImplementedException(); } public event PropertyChangedEventHandler? PropertyChanged { add => throw new NotImplementedException(); remove => throw new NotImplementedException(); } public int IndexOf(object item) { return emptySet.IndexOf((T)item); } public bool Contains(object item) { return emptySet.Contains((T)item); } public IRealmCollection<T> Freeze() { throw new NotImplementedException(); } public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback) { throw new NotImplementedException(); } public bool IsValid => throw new NotImplementedException(); public Realm Realm => throw new NotImplementedException(); public ObjectSchema ObjectSchema => throw new NotImplementedException(); public bool IsFrozen => throw new NotImplementedException(); } }
mit
C#
2e38b77fa923c747bed25557aade6dd584f3166e
Change name of TwitterWebApplication.
dimitardanailov/TwitterBackupBackendAndAngularjs,dimitardanailov/TwitterBackupBackendAndAngularjs,dimitardanailov/TwitterBackupBackendAndAngularjs
TwitterWebApplication/Controllers/TwitterFavouriteListController.cs
TwitterWebApplication/Controllers/TwitterFavouriteListController.cs
using System.Web.Http; using System.Security.Claims; using System.Collections.Generic; using TwitterApplicationLibrary; using TweetSharp; using TwitterWebApplicationDBContexts; namespace TwitterWebApplication.Controllers { [Authorize] public class TwitterFavouriteListController : ApiController { private ApplicationDbContext db = new ApplicationDbContext(); protected override void Dispose(bool disposing) { if (disposing) { this.db.Dispose(); } base.Dispose(disposing); } public IEnumerable<TwitterStatus> GetTweets() { var identity = (ClaimsIdentity) User.Identity; IEnumerable<Claim> claims = identity.Claims; ApplicationTwitterService service = ApplicationTwitterService.InitializeServiceConnection(claims); var tweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions()); return tweets; } } }
using System.Web.Http; using System.Security.Claims; using System.Collections.Generic; using TwitterApplicationLibrary; using TweetSharp; using TwitterWebApplicationDBContexts; namespace TwitterWebApplication.Controllers { [Authorize] public class TwitterFavouriteListController : ApiController { private ApplicationDbContext db = new ApplicationDbContext(); protected override void Dispose(bool disposing) { if (disposing) { this.db.Dispose(); } base.Dispose(disposing); } public IEnumerable<TwitterStatus> GetTwitters() { var identity = (ClaimsIdentity) User.Identity; IEnumerable<Claim> claims = identity.Claims; ApplicationTwitterService service = ApplicationTwitterService.InitializeServiceConnection(claims); var tweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions()); return tweets; } } }
mit
C#
db57826e503866d0a81d3f479e03bcd65f251e70
Add missing "using".
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Tor/TorMonitor.cs
WalletWasabi/Tor/TorMonitor.cs
using System; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using WalletWasabi.Bases; using WalletWasabi.Logging; using WalletWasabi.Tor.Http; using WalletWasabi.Tor.Socks5.Exceptions; using WalletWasabi.Tor.Socks5.Models.Fields.OctetFields; namespace WalletWasabi.Tor { /// <summary> /// Monitors Tor process. /// </summary> public class TorMonitor : PeriodicRunner { public static readonly TimeSpan CheckIfRunningAfterTorMisbehavedFor = TimeSpan.FromSeconds(7); /// <summary> /// Creates a new instance of the object. /// </summary> public TorMonitor(TimeSpan period, Uri fallBackTestRequestUri, EndPoint torSocks5EndPoint, TorProcessManager torProcessManager) : base(period) { FallBackTestRequestUri = fallBackTestRequestUri; TorSocks5EndPoint = torSocks5EndPoint; TorProcessManager = torProcessManager; } public static bool RequestFallbackAddressUsage { get; private set; } = false; private Uri FallBackTestRequestUri { get; } private EndPoint TorSocks5EndPoint { get; } private TorProcessManager TorProcessManager { get; } /// <inheritdoc/> protected override async Task ActionAsync(CancellationToken token) { if (TorHttpClient.TorDoesntWorkSince is { }) // If Tor misbehaves. { TimeSpan torMisbehavedFor = DateTimeOffset.UtcNow - TorHttpClient.TorDoesntWorkSince ?? TimeSpan.Zero; if (torMisbehavedFor > CheckIfRunningAfterTorMisbehavedFor) { if (TorHttpClient.LatestTorException is TorConnectCommandFailedException torEx) { if (torEx.RepField == RepField.HostUnreachable) { Uri baseUri = new Uri($"{FallBackTestRequestUri.Scheme}://{FallBackTestRequestUri.DnsSafeHost}"); using (var client = new TorHttpClient(baseUri, TorSocks5EndPoint)) { using var message = new HttpRequestMessage(HttpMethod.Get, FallBackTestRequestUri); await client.SendAsync(message, token).ConfigureAwait(false); } // Check if it changed in the meantime... if (TorHttpClient.LatestTorException is TorConnectCommandFailedException torEx2 && torEx2.RepField == RepField.HostUnreachable) { // Fallback here... RequestFallbackAddressUsage = true; } } } else { Logger.LogInfo($"Tor did not work properly for {(int)torMisbehavedFor.TotalSeconds} seconds. Maybe it crashed. Attempting to start it..."); // Try starting Tor, if it does not work it'll be another issue. bool started = await TorProcessManager.StartAsync(ensureRunning: true).ConfigureAwait(false); Logger.LogInfo($"Tor re-starting attempt {(started ? "succeeded." : "FAILED. Will try again later.")}"); } } } } } }
using System; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using WalletWasabi.Bases; using WalletWasabi.Logging; using WalletWasabi.Tor.Http; using WalletWasabi.Tor.Socks5.Exceptions; using WalletWasabi.Tor.Socks5.Models.Fields.OctetFields; namespace WalletWasabi.Tor { /// <summary> /// Monitors Tor process. /// </summary> public class TorMonitor : PeriodicRunner { public static readonly TimeSpan CheckIfRunningAfterTorMisbehavedFor = TimeSpan.FromSeconds(7); /// <summary> /// Creates a new instance of the object. /// </summary> public TorMonitor(TimeSpan period, Uri fallBackTestRequestUri, EndPoint torSocks5EndPoint, TorProcessManager torProcessManager) : base(period) { FallBackTestRequestUri = fallBackTestRequestUri; TorSocks5EndPoint = torSocks5EndPoint; TorProcessManager = torProcessManager; } public static bool RequestFallbackAddressUsage { get; private set; } = false; private Uri FallBackTestRequestUri { get; } private EndPoint TorSocks5EndPoint { get; } private TorProcessManager TorProcessManager { get; } /// <inheritdoc/> protected override async Task ActionAsync(CancellationToken token) { if (TorHttpClient.TorDoesntWorkSince is { }) // If Tor misbehaves. { TimeSpan torMisbehavedFor = DateTimeOffset.UtcNow - TorHttpClient.TorDoesntWorkSince ?? TimeSpan.Zero; if (torMisbehavedFor > CheckIfRunningAfterTorMisbehavedFor) { if (TorHttpClient.LatestTorException is TorConnectCommandFailedException torEx) { if (torEx.RepField == RepField.HostUnreachable) { Uri baseUri = new Uri($"{FallBackTestRequestUri.Scheme}://{FallBackTestRequestUri.DnsSafeHost}"); using (var client = new TorHttpClient(baseUri, TorSocks5EndPoint)) { var message = new HttpRequestMessage(HttpMethod.Get, FallBackTestRequestUri); await client.SendAsync(message, token).ConfigureAwait(false); } // Check if it changed in the meantime... if (TorHttpClient.LatestTorException is TorConnectCommandFailedException torEx2 && torEx2.RepField == RepField.HostUnreachable) { // Fallback here... RequestFallbackAddressUsage = true; } } } else { Logger.LogInfo($"Tor did not work properly for {(int)torMisbehavedFor.TotalSeconds} seconds. Maybe it crashed. Attempting to start it..."); // Try starting Tor, if it does not work it'll be another issue. bool started = await TorProcessManager.StartAsync(ensureRunning: true).ConfigureAwait(false); Logger.LogInfo($"Tor re-starting attempt {(started ? "succeeded." : "FAILED. Will try again later.")}"); } } } } } }
mit
C#
dded3c60ddcf4034f821797b7052c290e90e6c11
update get service feature.
dreign/ComBoost,dreign/ComBoost
Wodsoft.ComBoost/Data/Entity/EntityDescriptorContext.cs
Wodsoft.ComBoost/Data/Entity/EntityDescriptorContext.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace System.Data.Entity { /// <summary> /// Entity descriptor context. /// </summary> public class EntityDescriptorContext : ITypeDescriptorContext { private IEntityContextBuilder _Builder; /// <summary> /// Initialize entity descriptor context. /// </summary> /// <param name="builder">Entity context builder.</param> public EntityDescriptorContext(IEntityContextBuilder builder) { if (builder == null) throw new ArgumentNullException("builder"); _Builder = builder; } /// <summary> /// Get the container. /// </summary> public IContainer Container { get { return null; } } /// <summary> /// Get the entity context builder. /// </summary> public object Instance { get { return _Builder; } } /// <summary> /// Call when context changed. /// </summary> public void OnComponentChanged() { } /// <summary> /// Call when context changing. /// </summary> /// <returns></returns> public bool OnComponentChanging() { return false; } /// <summary> /// Get the property descriptor. /// </summary> public PropertyDescriptor PropertyDescriptor { get { return null; } } /// <summary> /// Get entity context. /// </summary> /// <param name="serviceType">Type of entity.</param> /// <returns>Return IEntityQueryable of entity.</returns> public object GetService(Type serviceType) { if (serviceType.IsGenericType) { Type definition = serviceType.GetGenericTypeDefinition(); if (definition == typeof(IEntityQueryable<>)) return _Builder.GetContext(serviceType.GetGenericArguments()[0]); else return null; } else { if (typeof(IEntity).IsAssignableFrom(serviceType)) return _Builder.GetContext(serviceType); else return null; } } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace System.Data.Entity { /// <summary> /// Entity descriptor context. /// </summary> public class EntityDescriptorContext : ITypeDescriptorContext { private IEntityContextBuilder _Builder; /// <summary> /// Initialize entity descriptor context. /// </summary> /// <param name="builder">Entity context builder.</param> public EntityDescriptorContext(IEntityContextBuilder builder) { if (builder == null) throw new ArgumentNullException("builder"); _Builder = builder; } /// <summary> /// Get the container. /// </summary> public IContainer Container { get { return null; } } /// <summary> /// Get the entity context builder. /// </summary> public object Instance { get { return _Builder; } } /// <summary> /// Call when context changed. /// </summary> public void OnComponentChanged() { } /// <summary> /// Call when context changing. /// </summary> /// <returns></returns> public bool OnComponentChanging() { return false; } /// <summary> /// Get the property descriptor. /// </summary> public PropertyDescriptor PropertyDescriptor { get { return null; } } /// <summary> /// Get entity context. /// </summary> /// <param name="serviceType">Type of entity.</param> /// <returns>Return IEntityQueryable of entity.</returns> public object GetService(Type serviceType) { return _Builder.GetContext(serviceType); } } }
mit
C#
ac0db67b0b8a11b0342bf77c74b7373590ad2782
Fix from PR 164 (Credit: perfiction)
aloisdeniel/Microcharts
Sources/Microcharts.Uwp/ChartView.cs
Sources/Microcharts.Uwp/ChartView.cs
// Copyright (c) Aloïs DENIEL. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. namespace Microcharts.Uwp { using SkiaSharp; using SkiaSharp.Views.UWP; using Windows.UI.Xaml; public class ChartView : SKXamlCanvas { #region Constructors public ChartView() { this.PaintSurface += OnPaintCanvas; } #endregion #region Static fields public static readonly DependencyProperty ChartProperty = DependencyProperty.Register(nameof(Chart), typeof(Chart), typeof(ChartView), new PropertyMetadata(null, new PropertyChangedCallback(OnLabelChanged))); #endregion #region Fields private InvalidatedWeakEventHandler<ChartView> handler; private Chart chart; #endregion #region Properties public Chart Chart { get { return (Chart)GetValue(ChartProperty); } set { SetValue(ChartProperty, value); } } #endregion #region Methods private static void OnChartChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var view = d as ChartView; if (view.chart != null) { view.handler.Dispose(); view.handler = null; } view.chart = e.NewValue as Chart; view.Invalidate(); if (view.chart != null) { view.handler = view.chart.ObserveInvalidate(view, (v) => v.Invalidate()); } } private void OnPaintCanvas(object sender, SKPaintSurfaceEventArgs e) { if (this.chart != null) { this.chart.Draw(e.Surface.Canvas, e.Info.Width, e.Info.Height); } else { e.Surface.Canvas.Clear(SKColors.Transparent); } } #endregion } }
// Copyright (c) Aloïs DENIEL. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. namespace Microcharts.Uwp { using SkiaSharp; using SkiaSharp.Views.UWP; using Windows.UI.Xaml; public class ChartView : SKXamlCanvas { #region Constructors public ChartView() { this.PaintSurface += OnPaintCanvas; } #endregion #region Static fields public static readonly DependencyProperty ChartProperty = DependencyProperty.Register(nameof(Chart), typeof(ChartView), typeof(Chart), new PropertyMetadata(null, new PropertyChangedCallback(OnChartChanged))); #endregion #region Fields private InvalidatedWeakEventHandler<ChartView> handler; private Chart chart; #endregion #region Properties public Chart Chart { get { return (Chart)GetValue(ChartProperty); } set { SetValue(ChartProperty, value); } } #endregion #region Methods private static void OnChartChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var view = d as ChartView; if (view.chart != null) { view.handler.Dispose(); view.handler = null; } view.chart = e.NewValue as Chart; view.Invalidate(); if (view.chart != null) { view.handler = view.chart.ObserveInvalidate(view, (v) => v.Invalidate()); } } private void OnPaintCanvas(object sender, SKPaintSurfaceEventArgs e) { if (this.chart != null) { this.chart.Draw(e.Surface.Canvas, e.Info.Width, e.Info.Height); } else { e.Surface.Canvas.Clear(SKColors.Transparent); } } #endregion } }
mit
C#
e929e29789e2075484c998e52b17ac7e571eb963
Fix System.Reflection.Context test to run on Desktop
tijoytom/corefx,tijoytom/corefx,fgreinacher/corefx,Jiayili1/corefx,cydhaselton/corefx,ViktorHofer/corefx,mazong1123/corefx,nchikanov/corefx,seanshpark/corefx,stephenmichaelf/corefx,marksmeltzer/corefx,mmitche/corefx,richlander/corefx,lggomez/corefx,the-dwyer/corefx,jlin177/corefx,lggomez/corefx,Ermiar/corefx,yizhang82/corefx,krytarowski/corefx,krytarowski/corefx,mmitche/corefx,shimingsg/corefx,elijah6/corefx,wtgodbe/corefx,elijah6/corefx,alexperovich/corefx,Petermarcu/corefx,elijah6/corefx,ptoonen/corefx,nchikanov/corefx,marksmeltzer/corefx,rahku/corefx,billwert/corefx,DnlHarvey/corefx,krk/corefx,Petermarcu/corefx,ptoonen/corefx,marksmeltzer/corefx,Petermarcu/corefx,yizhang82/corefx,DnlHarvey/corefx,marksmeltzer/corefx,dotnet-bot/corefx,mmitche/corefx,gkhanna79/corefx,stone-li/corefx,jlin177/corefx,YoupHulsebos/corefx,krk/corefx,dotnet-bot/corefx,nbarbettini/corefx,parjong/corefx,the-dwyer/corefx,ericstj/corefx,lggomez/corefx,jlin177/corefx,krytarowski/corefx,ericstj/corefx,jlin177/corefx,dotnet-bot/corefx,mazong1123/corefx,Petermarcu/corefx,twsouthwick/corefx,parjong/corefx,stephenmichaelf/corefx,rubo/corefx,DnlHarvey/corefx,ptoonen/corefx,krk/corefx,mazong1123/corefx,stephenmichaelf/corefx,MaggieTsang/corefx,DnlHarvey/corefx,alexperovich/corefx,Jiayili1/corefx,lggomez/corefx,MaggieTsang/corefx,marksmeltzer/corefx,mazong1123/corefx,nchikanov/corefx,JosephTremoulet/corefx,ptoonen/corefx,gkhanna79/corefx,alexperovich/corefx,richlander/corefx,zhenlan/corefx,rubo/corefx,rjxby/corefx,rjxby/corefx,ericstj/corefx,nbarbettini/corefx,alexperovich/corefx,cydhaselton/corefx,shimingsg/corefx,axelheer/corefx,stephenmichaelf/corefx,ericstj/corefx,mmitche/corefx,dotnet-bot/corefx,krk/corefx,MaggieTsang/corefx,ravimeda/corefx,elijah6/corefx,yizhang82/corefx,Petermarcu/corefx,elijah6/corefx,ViktorHofer/corefx,zhenlan/corefx,krytarowski/corefx,twsouthwick/corefx,jlin177/corefx,ViktorHofer/corefx,YoupHulsebos/corefx,JosephTremoulet/corefx,Ermiar/corefx,rahku/corefx,twsouthwick/corefx,rubo/corefx,cydhaselton/corefx,rjxby/corefx,cydhaselton/corefx,axelheer/corefx,rjxby/corefx,nbarbettini/corefx,parjong/corefx,jlin177/corefx,the-dwyer/corefx,ptoonen/corefx,dotnet-bot/corefx,seanshpark/corefx,gkhanna79/corefx,Jiayili1/corefx,rjxby/corefx,dhoehna/corefx,Ermiar/corefx,wtgodbe/corefx,ViktorHofer/corefx,ViktorHofer/corefx,Jiayili1/corefx,rubo/corefx,billwert/corefx,weltkante/corefx,rahku/corefx,ViktorHofer/corefx,JosephTremoulet/corefx,axelheer/corefx,seanshpark/corefx,twsouthwick/corefx,stephenmichaelf/corefx,ravimeda/corefx,seanshpark/corefx,stephenmichaelf/corefx,stone-li/corefx,nchikanov/corefx,stone-li/corefx,JosephTremoulet/corefx,tijoytom/corefx,mmitche/corefx,nchikanov/corefx,richlander/corefx,weltkante/corefx,ravimeda/corefx,Ermiar/corefx,fgreinacher/corefx,billwert/corefx,seanshpark/corefx,dotnet-bot/corefx,rahku/corefx,YoupHulsebos/corefx,alexperovich/corefx,YoupHulsebos/corefx,billwert/corefx,billwert/corefx,BrennanConroy/corefx,Petermarcu/corefx,shimingsg/corefx,jlin177/corefx,parjong/corefx,rahku/corefx,zhenlan/corefx,JosephTremoulet/corefx,tijoytom/corefx,DnlHarvey/corefx,weltkante/corefx,ravimeda/corefx,gkhanna79/corefx,mazong1123/corefx,MaggieTsang/corefx,rubo/corefx,ViktorHofer/corefx,stone-li/corefx,krytarowski/corefx,dhoehna/corefx,MaggieTsang/corefx,elijah6/corefx,lggomez/corefx,the-dwyer/corefx,yizhang82/corefx,wtgodbe/corefx,parjong/corefx,DnlHarvey/corefx,weltkante/corefx,axelheer/corefx,nbarbettini/corefx,MaggieTsang/corefx,tijoytom/corefx,nbarbettini/corefx,nchikanov/corefx,cydhaselton/corefx,richlander/corefx,mazong1123/corefx,ericstj/corefx,YoupHulsebos/corefx,zhenlan/corefx,stephenmichaelf/corefx,ravimeda/corefx,rjxby/corefx,cydhaselton/corefx,gkhanna79/corefx,BrennanConroy/corefx,ptoonen/corefx,DnlHarvey/corefx,dotnet-bot/corefx,Petermarcu/corefx,marksmeltzer/corefx,ericstj/corefx,seanshpark/corefx,parjong/corefx,stone-li/corefx,shimingsg/corefx,the-dwyer/corefx,ravimeda/corefx,lggomez/corefx,JosephTremoulet/corefx,yizhang82/corefx,krk/corefx,parjong/corefx,richlander/corefx,weltkante/corefx,mmitche/corefx,yizhang82/corefx,fgreinacher/corefx,dhoehna/corefx,shimingsg/corefx,alexperovich/corefx,elijah6/corefx,nbarbettini/corefx,zhenlan/corefx,weltkante/corefx,mmitche/corefx,gkhanna79/corefx,alexperovich/corefx,stone-li/corefx,rjxby/corefx,marksmeltzer/corefx,dhoehna/corefx,richlander/corefx,rahku/corefx,seanshpark/corefx,tijoytom/corefx,krk/corefx,axelheer/corefx,axelheer/corefx,lggomez/corefx,gkhanna79/corefx,dhoehna/corefx,Jiayili1/corefx,nchikanov/corefx,Ermiar/corefx,Jiayili1/corefx,twsouthwick/corefx,krk/corefx,billwert/corefx,ptoonen/corefx,nbarbettini/corefx,Ermiar/corefx,tijoytom/corefx,richlander/corefx,weltkante/corefx,krytarowski/corefx,wtgodbe/corefx,the-dwyer/corefx,cydhaselton/corefx,dhoehna/corefx,zhenlan/corefx,twsouthwick/corefx,wtgodbe/corefx,ericstj/corefx,BrennanConroy/corefx,rahku/corefx,wtgodbe/corefx,JosephTremoulet/corefx,fgreinacher/corefx,shimingsg/corefx,krytarowski/corefx,MaggieTsang/corefx,dhoehna/corefx,ravimeda/corefx,YoupHulsebos/corefx,Jiayili1/corefx,shimingsg/corefx,yizhang82/corefx,billwert/corefx,the-dwyer/corefx,YoupHulsebos/corefx,twsouthwick/corefx,mazong1123/corefx,wtgodbe/corefx,stone-li/corefx,Ermiar/corefx,zhenlan/corefx
src/System.Reflection.Context/tests/CustomReflectionContextTests.cs
src/System.Reflection.Context/tests/CustomReflectionContextTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Xunit; namespace System.Reflection.Context { public class CustomReflectionContextTests { [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void InstantiateContext_Throws() { Assert.Throws<PlatformNotSupportedException>(() => new DerivedContext()); } private class DerivedContext : CustomReflectionContext { } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Xunit; namespace System.Reflection.Context { public class CustomReflectionContextTests { [Fact] public void InstantiateContext_Throws() { Assert.Throws<PlatformNotSupportedException>(() => new DerivedContext()); } private class DerivedContext : CustomReflectionContext { } } }
mit
C#
e34b17f7ef9f93140e6b3eec223cf5254a380c42
Update Region.cs
nikola02333/WebKurs,nikola02333/WebKurs,nikola02333/WebKurs
BookingApp/BookingApp/Models/Region.cs
BookingApp/BookingApp/Models/Region.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace BookingApp.Models { public class Region { public int RegionId { get; set; } public string name { get; set; } public List<Place> l_Place { get; set; } // public int CountryId { get; set; } public Country Country { get; set; } public Region() { } ~Region() { } }//end Region }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace BookingApp.Models { public class Region { public int RegionId { get; set; } private string name { get; set; } public List<Place> l_Place { get; set; } // public int CountryId { get; set; } public Country Country { get; set; } public Region() { } ~Region() { } }//end Region }
mit
C#
fa3aa0114dbb73592978ae28e93b240cfaf5beb2
Bump version #
rpaquay/mtsuite
src/shared/VersionNumber.cs
src/shared/VersionNumber.cs
// Copyright 2015 Renaud Paquay All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace mtsuite.shared { public static class VersionNumber { public const string Product = "0.9.1"; public const string File = Product + ".0"; } }
// Copyright 2015 Renaud Paquay All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace mtsuite.shared { public static class VersionNumber { public const string Product = "0.9.0"; public const string File = Product + ".0"; } }
apache-2.0
C#
91c327a90f14b151ff3a62710559ab3f96153aa5
use ModDisplay
UselessToucan/osu,NeoAdonis/osu,ZLima12/osu,2yangk23/osu,peppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,ppy/osu,peppy/osu,EVAST9919/osu,UselessToucan/osu,johnneijzen/osu,johnneijzen/osu,NeoAdonis/osu,EVAST9919/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,ZLima12/osu,smoogipooo/osu
osu.Game/Screens/Select/FooterButtonMods.cs
osu.Game/Screens/Select/FooterButtonMods.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.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Screens.Play.HUD; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using System.Collections.Generic; using osuTK; using osu.Framework.Input.Events; namespace osu.Game.Screens.Select { public class FooterButtonMods : FooterButton { private readonly FooterModDisplay modDisplay; public FooterButtonMods(Bindable<IEnumerable<Mod>> mods) { Add(new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Child = modDisplay = new FooterModDisplay { DisplayUnrankedText = false, Scale = new Vector2(0.8f) }, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Left = 70 } }); if (mods != null) modDisplay.Current = mods; } private class FooterModDisplay : ModDisplay { public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false; } } }
// 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.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using System.Collections.Generic; using osuTK; namespace osu.Game.Screens.Select { public class FooterButtonMods : FooterButton { private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(); private readonly FillFlowContainer<ModIcon> modIcons; public FooterButtonMods(Bindable<IEnumerable<Mod>> mods) { Add(modIcons = new FillFlowContainer<ModIcon> { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Left = 80, Right = 20 } }); if (mods != null) { selectedMods.BindTo(mods); selectedMods.ValueChanged += updateModIcons; } } private void updateModIcons(ValueChangedEvent<IEnumerable<Mod>> mods) { modIcons.Clear(); foreach (Mod mod in mods.NewValue) { modIcons.Add(new ModIcon(mod) { Scale = new Vector2(0.4f) }); } } } }
mit
C#
166f0c7b86977b437edf724025157180720cd729
Fix chair perspective (#8964)
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.Client/Buckle/BuckleComponent.cs
Content.Client/Buckle/BuckleComponent.cs
using Content.Shared.ActionBlocker; using Content.Shared.Buckle.Components; using Content.Shared.Vehicle.Components; using Robust.Client.GameObjects; namespace Content.Client.Buckle { [RegisterComponent] [ComponentReference(typeof(SharedBuckleComponent))] public sealed class BuckleComponent : SharedBuckleComponent { [Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IEntitySystemManager _sysMan = default!; private bool _buckled; private int? _originalDrawDepth; public override bool Buckled => _buckled; public override bool TryBuckle(EntityUid user, EntityUid to) { // TODO: Prediction return false; } public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { if (curState is not BuckleComponentState buckle) { return; } _buckled = buckle.Buckled; LastEntityBuckledTo = buckle.LastEntityBuckledTo; DontCollide = buckle.DontCollide; _sysMan.GetEntitySystem<ActionBlockerSystem>().UpdateCanMove(Owner); if (!_entMan.TryGetComponent(Owner, out SpriteComponent? ownerSprite)) { return; } if (LastEntityBuckledTo != null && _entMan.HasComponent<VehicleComponent>(LastEntityBuckledTo)) { return; } if (_buckled && buckle.DrawDepth.HasValue) { _originalDrawDepth ??= ownerSprite.DrawDepth; ownerSprite.DrawDepth = buckle.DrawDepth.Value; return; } if (_originalDrawDepth.HasValue && !buckle.DrawDepth.HasValue) { ownerSprite.DrawDepth = _originalDrawDepth.Value; _originalDrawDepth = null; } } } }
using Content.Shared.ActionBlocker; using Content.Shared.Buckle.Components; using Content.Shared.Vehicle.Components; using Robust.Client.GameObjects; namespace Content.Client.Buckle { [RegisterComponent] [ComponentReference(typeof(SharedBuckleComponent))] public sealed class BuckleComponent : SharedBuckleComponent { [Dependency] private readonly IEntityManager _entMan = default!; [Dependency] private readonly IEntitySystemManager _sysMan = default!; private bool _buckled; private int? _originalDrawDepth; public override bool Buckled => _buckled; public override bool TryBuckle(EntityUid user, EntityUid to) { // TODO: Prediction return false; } public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { if (curState is not BuckleComponentState buckle) { return; } _buckled = buckle.Buckled; LastEntityBuckledTo = buckle.LastEntityBuckledTo; DontCollide = buckle.DontCollide; _sysMan.GetEntitySystem<ActionBlockerSystem>().UpdateCanMove(Owner); if (!_entMan.TryGetComponent(Owner, out SpriteComponent? ownerSprite)) { return; } if (!_entMan.TryGetComponent(Owner, out RiderComponent? rider)) { return; } if (_buckled && buckle.DrawDepth.HasValue) { _originalDrawDepth ??= ownerSprite.DrawDepth; ownerSprite.DrawDepth = buckle.DrawDepth.Value; return; } if (_originalDrawDepth.HasValue && !buckle.DrawDepth.HasValue) { ownerSprite.DrawDepth = _originalDrawDepth.Value; _originalDrawDepth = null; } } } }
mit
C#
efb146e8640bd94fa87db8600ce0d64eafc889ad
Make PoEItemCategory implement IReadOnlyList<PoEItemList>
jcmoyer/Yeena
Yeena/PathOfExile/PoEItemCategory.cs
Yeena/PathOfExile/PoEItemCategory.cs
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections; using System.Collections.Generic; using Newtonsoft.Json; namespace Yeena.PathOfExile { /// <summary> /// A category of items is a read-only list of ItemLists, mapping to a level 1 /// item group, i.e. Weapon is a category of Claw, Bow, Dagger, etc... /// </summary> [JsonObject] class PoEItemCategory : IReadOnlyList<PoEItemList> { [JsonProperty("name")] private readonly string _name; [JsonProperty("items")] private readonly List<PoEItemList> _items; public PoEItemCategory(string name, IEnumerable<PoEItemList> items) { _name = name; _items = new List<PoEItemList>(items); } public IEnumerator<PoEItemList> GetEnumerator() { return _items.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public int Count { get { return _items.Count; } } public PoEItemList this[int index] { get { return _items[index]; } } public override string ToString() { return _name; } } }
// Copyright 2013 J.C. Moyer // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System.Collections; using System.Collections.Generic; using Newtonsoft.Json; namespace Yeena.PathOfExile { /// <summary> /// A category of items is a read-only list of ItemLists, mapping to a level 1 /// item group, i.e. Weapon is a category of Claw, Bow, Dagger, etc... /// </summary> [JsonObject] class PoEItemCategory : IEnumerable<PoEItemList> { [JsonProperty("name")] private readonly string _name; [JsonProperty("items")] private readonly List<PoEItemList> _items; public PoEItemCategory(string name, IEnumerable<PoEItemList> items) { _name = name; _items = new List<PoEItemList>(items); } public IEnumerator<PoEItemList> GetEnumerator() { return _items.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public override string ToString() { return _name; } } }
apache-2.0
C#
3f62d9cec67a4ddb2038605211633104f42d67c4
Add support for LF record separator
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
src/Arkivverket.Arkade/Core/Addml/Definitions/Separator.cs
src/Arkivverket.Arkade/Core/Addml/Definitions/Separator.cs
using System; using System.Collections.Generic; using Arkivverket.Arkade.Util; namespace Arkivverket.Arkade.Core.Addml.Definitions { public class Separator { private static readonly Dictionary<string, string> SpecialSeparators = new Dictionary<string, string> { {"CRLF", "\r\n"}, {"LF", "\n"} }; public static readonly Separator CRLF = new Separator("CRLF"); private readonly string _name; private readonly string _separator; public Separator(string separator) { Assert.AssertNotNullOrEmpty("separator", separator); _name = separator; _separator = Convert(separator); } public string Get() { return _separator; } public override string ToString() { return _name; } protected bool Equals(Separator other) { return string.Equals(_name, other._name); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; return Equals((Separator) obj); } public override int GetHashCode() { return _name?.GetHashCode() ?? 0; } private string Convert(string s) { return SpecialSeparators.ContainsKey(s) ? SpecialSeparators[s] : s; } internal int GetLength() { return _separator.Length; } } }
using System; using System.Collections.Generic; using Arkivverket.Arkade.Util; namespace Arkivverket.Arkade.Core.Addml.Definitions { public class Separator { private static readonly Dictionary<string, string> SpecialSeparators = new Dictionary<string, string> { {"CRLF", "\r\n"} }; public static readonly Separator CRLF = new Separator("CRLF"); private readonly string _name; private readonly string _separator; public Separator(string separator) { Assert.AssertNotNullOrEmpty("separator", separator); _name = separator; _separator = Convert(separator); } public string Get() { return _separator; } public override string ToString() { return _name; } protected bool Equals(Separator other) { return string.Equals(_name, other._name); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; return Equals((Separator) obj); } public override int GetHashCode() { return _name?.GetHashCode() ?? 0; } private string Convert(string s) { return SpecialSeparators.ContainsKey(s) ? SpecialSeparators[s] : s; } internal int GetLength() { return _separator.Length; } } }
agpl-3.0
C#
fb6dff24a078c9d2c3fcb6d51b873ed6fe5b5549
fix whitespace in ExceptionUtilsTests
tc-dev/tc-dev.Core
tests/tc-dev.Core.Common.UnitTests/Utilities/ExceptionUtilsTests.cs
tests/tc-dev.Core.Common.UnitTests/Utilities/ExceptionUtilsTests.cs
using System; using NUnit.Framework; using tc_dev.Core.Common.Utilities; namespace tc_dev.Core.Common.UnitTests.Utilities { [TestFixture] public class ExceptionUtilsTests { [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NullClass_ThrowsException(string paramName, string message) { string nullThing = null; Assert.Throws<ArgumentNullException>(() => nullThing.ThrowIfNull(paramName, message)); } [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NotNullClass_DoesNotThrowException(string paramName, string message) { string notNullThing = "imNotNull"; Assert.DoesNotThrow(() => notNullThing.ThrowIfNull(paramName, message)); } [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NullStruct_ThrowsException(string paramName, string message) { Nullable<int> nullThing = null; Assert.Throws<ArgumentNullException>(() => nullThing.ThrowIfNull(paramName, message)); } [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NotNullStruct_DoesNotThrowException(string paramName, string message) { Nullable<int> notNullThing = 42; Assert.DoesNotThrow(() => notNullThing.ThrowIfNull(paramName, message)); } } }
using System; using NUnit.Framework; using tc_dev.Core.Common.Utilities; namespace tc_dev.Core.Common.UnitTests.Utilities { [TestFixture] public class ExceptionUtilsTests { [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NullClass_ThrowsException(string paramName, string message) { string nullThing = null; Assert.Throws<ArgumentNullException>(() => nullThing.ThrowIfNull(paramName, message)); } [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NotNullClass_DoesNotThrowException(string paramName, string message) { string notNullThing = "imNotNull"; Assert.DoesNotThrow(() => notNullThing.ThrowIfNull(paramName, message)); } [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NullStruct_ThrowsException(string paramName, string message) { Nullable<int> nullThing = null; Assert.Throws<ArgumentNullException>(() => nullThing.ThrowIfNull(paramName, message)); } [TestCase(null, null)] [TestCase("paramName", "message")] public void ThrowIfNull_NotNullStruct_DoesNotThrowException(string paramName, string message) { Nullable<int> notNullThing = 42; Assert.DoesNotThrow(() => notNullThing.ThrowIfNull(paramName, message)); } } }
mit
C#
dfe3003152ed69421f3743d3ea0d487df7a547c0
Send the current song index as nullable
punker76/Espera,flagbug/Espera
Espera/Espera.Services/MobileHelper.cs
Espera/Espera.Services/MobileHelper.cs
using Espera.Core; using Espera.Core.Management; using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Linq; using System.Threading.Tasks; namespace Espera.Services { public static class MobileHelper { public static async Task<byte[]> CompressContentAsync(byte[] content) { using (var targetStream = new MemoryStream()) { using (var stream = new GZipStream(targetStream, CompressionMode.Compress)) { await stream.WriteAsync(content, 0, content.Length); } return targetStream.ToArray(); } } public static JObject SerializePlaylist(Playlist playlist) { return JObject.FromObject(new { name = playlist.Name, current = playlist.CurrentSongIndex.Value, songs = playlist.Select(x => new { artist = x.Song.Artist, title = x.Song.Title, source = x.Song is LocalSong ? "local" : "youtube", guid = x.Guid }) }); } public static JObject SerializeSongs(IEnumerable<LocalSong> songs) { return JObject.FromObject(new { songs = songs .Select(s => new { album = s.Album, artist = s.Artist, duration = s.Duration.TotalSeconds, genre = s.Genre, title = s.Title, guid = s.Guid }) }); } } }
using Espera.Core; using Espera.Core.Management; using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Linq; using System.Threading.Tasks; namespace Espera.Services { public static class MobileHelper { public static async Task<byte[]> CompressContentAsync(byte[] content) { using (var targetStream = new MemoryStream()) { using (var stream = new GZipStream(targetStream, CompressionMode.Compress)) { await stream.WriteAsync(content, 0, content.Length); } return targetStream.ToArray(); } } public static JObject SerializePlaylist(Playlist playlist) { return JObject.FromObject(new { name = playlist.Name, current = playlist.CurrentSongIndex.Value.ToString(), songs = playlist.Select(x => new { artist = x.Song.Artist, title = x.Song.Title, source = x.Song is LocalSong ? "local" : "youtube", guid = x.Guid }) }); } public static JObject SerializeSongs(IEnumerable<LocalSong> songs) { return JObject.FromObject(new { songs = songs .Select(s => new { album = s.Album, artist = s.Artist, duration = s.Duration.TotalSeconds, genre = s.Genre, title = s.Title, guid = s.Guid }) }); } } }
mit
C#
e9ef15d08ff451b1ce258cd25cf83ae72ef79e66
Add Interface to JsonSchemaAbstractAttribute, #909
RSuter/NJsonSchema,NJsonSchema/NJsonSchema
src/NJsonSchema/Annotations/JsonSchemaAbstractAttribute.cs
src/NJsonSchema/Annotations/JsonSchemaAbstractAttribute.cs
//----------------------------------------------------------------------- // <copyright file="JsonSchemaDateAttribute.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, [email protected]</author> //----------------------------------------------------------------------- using System; namespace NJsonSchema.Annotations { /// <summary>Annotation to merge all inherited properties into this class/schema.</summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] public class JsonSchemaAbstractAttribute : Attribute { /// <summary>Initializes a new instance of the <see cref="JsonSchemaAbstractAttribute"/> class.</summary> public JsonSchemaAbstractAttribute() { IsAbstract = true; } /// <summary>Initializes a new instance of the <see cref="JsonSchemaAbstractAttribute"/> class.</summary> /// <param name="isAbstract">The explicit flag to override the global setting (i.e. disable the generation for a type).</param> public JsonSchemaAbstractAttribute(bool isAbstract) { IsAbstract = isAbstract; } /// <summary>Gets or sets a value indicating whether to set the x-abstract property for given type.</summary> public bool IsAbstract { get; } } }
//----------------------------------------------------------------------- // <copyright file="JsonSchemaDateAttribute.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, [email protected]</author> //----------------------------------------------------------------------- using System; namespace NJsonSchema.Annotations { /// <summary>Annotation to merge all inherited properties into this class/schema.</summary> [AttributeUsage(AttributeTargets.Class)] public class JsonSchemaAbstractAttribute : Attribute { /// <summary>Initializes a new instance of the <see cref="JsonSchemaAbstractAttribute"/> class.</summary> public JsonSchemaAbstractAttribute() { IsAbstract = true; } /// <summary>Initializes a new instance of the <see cref="JsonSchemaAbstractAttribute"/> class.</summary> /// <param name="isAbstract">The explicit flag to override the global setting (i.e. disable the generation for a type).</param> public JsonSchemaAbstractAttribute(bool isAbstract) { IsAbstract = isAbstract; } /// <summary>Gets or sets a value indicating whether to set the x-abstract property for given type.</summary> public bool IsAbstract { get; } } }
mit
C#
71765a2a5e8f2e50097e2e6f84a5ec1c3cd8cc49
Make concat add to the eof array
chartjunk/SubMapper
src/SubMapper/EnumerableMapping/Adders/ArrayConcatAdder.cs
src/SubMapper/EnumerableMapping/Adders/ArrayConcatAdder.cs
using SubMapper.EnumerableMapping; using System; using System.Collections.Generic; using System.Linq; namespace SubMapper.EnumerableMapping.Adders { public static partial class PartialEnumerableMappingExtensions { public static PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem> WithArrayConcatAdder<TSubA, TSubB, TSubJ, TSubIItem>( this PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem> source) where TSubJ : new() where TSubIItem : new() { source.WithAdder((bc, b) => (bc ?? new TSubIItem[] { }).Concat(new[] { b }).ToArray()); return source; } } }
using SubMapper.EnumerableMapping; using System; using System.Collections.Generic; using System.Linq; namespace SubMapper.EnumerableMapping.Adders { public static partial class PartialEnumerableMappingExtensions { public static PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem> WithArrayConcatAdder<TSubA, TSubB, TSubJ, TSubIItem>( this PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem> source) where TSubJ : new() where TSubIItem : new() { source.WithAdder((bc, b) => new[] { b }.Concat(bc ?? new TSubIItem[] { }).ToArray()); return source; } } }
apache-2.0
C#
a005f4328f8e66af3d8e8bb65f5bf90a9033c1b9
Fix Open/Close index test for ES 1.2.2
geofeedia/elasticsearch-net,joehmchan/elasticsearch-net,jonyadamit/elasticsearch-net,azubanov/elasticsearch-net,DavidSSL/elasticsearch-net,tkirill/elasticsearch-net,KodrAus/elasticsearch-net,junlapong/elasticsearch-net,TheFireCookie/elasticsearch-net,robertlyson/elasticsearch-net,RossLieberman/NEST,joehmchan/elasticsearch-net,jonyadamit/elasticsearch-net,LeoYao/elasticsearch-net,starckgates/elasticsearch-net,DavidSSL/elasticsearch-net,DavidSSL/elasticsearch-net,mac2000/elasticsearch-net,cstlaurent/elasticsearch-net,starckgates/elasticsearch-net,faisal00813/elasticsearch-net,jonyadamit/elasticsearch-net,adam-mccoy/elasticsearch-net,faisal00813/elasticsearch-net,SeanKilleen/elasticsearch-net,ststeiger/elasticsearch-net,elastic/elasticsearch-net,UdiBen/elasticsearch-net,junlapong/elasticsearch-net,abibell/elasticsearch-net,Grastveit/NEST,abibell/elasticsearch-net,RossLieberman/NEST,faisal00813/elasticsearch-net,UdiBen/elasticsearch-net,tkirill/elasticsearch-net,tkirill/elasticsearch-net,LeoYao/elasticsearch-net,wawrzyn/elasticsearch-net,SeanKilleen/elasticsearch-net,geofeedia/elasticsearch-net,starckgates/elasticsearch-net,ststeiger/elasticsearch-net,Grastveit/NEST,KodrAus/elasticsearch-net,robrich/elasticsearch-net,TheFireCookie/elasticsearch-net,UdiBen/elasticsearch-net,abibell/elasticsearch-net,amyzheng424/elasticsearch-net,geofeedia/elasticsearch-net,elastic/elasticsearch-net,Grastveit/NEST,joehmchan/elasticsearch-net,RossLieberman/NEST,mac2000/elasticsearch-net,gayancc/elasticsearch-net,KodrAus/elasticsearch-net,robrich/elasticsearch-net,wawrzyn/elasticsearch-net,CSGOpenSource/elasticsearch-net,SeanKilleen/elasticsearch-net,adam-mccoy/elasticsearch-net,junlapong/elasticsearch-net,cstlaurent/elasticsearch-net,robertlyson/elasticsearch-net,mac2000/elasticsearch-net,gayancc/elasticsearch-net,CSGOpenSource/elasticsearch-net,amyzheng424/elasticsearch-net,TheFireCookie/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,ststeiger/elasticsearch-net,robertlyson/elasticsearch-net,cstlaurent/elasticsearch-net,robrich/elasticsearch-net,azubanov/elasticsearch-net,amyzheng424/elasticsearch-net,gayancc/elasticsearch-net,wawrzyn/elasticsearch-net,azubanov/elasticsearch-net,LeoYao/elasticsearch-net
src/Tests/Nest.Tests.Integration/Indices/OpenCloseTests.cs
src/Tests/Nest.Tests.Integration/Indices/OpenCloseTests.cs
using Elasticsearch.Net; using FluentAssertions; using Nest.Tests.MockData.Domain; using NUnit.Framework; namespace Nest.Tests.Integration.Indices { [TestFixture] public class OpenCloseTests : IntegrationTests { [Test] public void CloseAndOpenIndex() { var r = this._client.CloseIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); r = this._client.OpenIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); } [Test] public void CloseAndOpenIndexTyped() { var r = this._client.CloseIndex<ElasticsearchProject>(); Assert.True(r.Acknowledged); Assert.True(r.IsValid); r = this._client.OpenIndex<ElasticsearchProject>(); Assert.True(r.Acknowledged); Assert.True(r.IsValid); } [Test] public void CloseAndSearchAndOpenIndex() { var r = this._client.CloseIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); var results = this._client.Search<ElasticsearchProject>(s => s .MatchAll() ); Assert.False(results.IsValid); Assert.IsNotNull(results.ConnectionStatus); var statusCode = results.ConnectionStatus.HttpStatusCode; Assert.AreEqual(statusCode, 403); var error = results.ServerError; error.Should().NotBeNull(); error.ExceptionType.Should().BeOneOf("ClusterBlockException", "IndexClosedException"); error.Error.Should().Contain("closed"); r = this._client.OpenIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); } } }
using Elasticsearch.Net; using FluentAssertions; using Nest.Tests.MockData.Domain; using NUnit.Framework; namespace Nest.Tests.Integration.Indices { [TestFixture] public class OpenCloseTests : IntegrationTests { [Test] public void CloseAndOpenIndex() { var r = this._client.CloseIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); r = this._client.OpenIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); } [Test] public void CloseAndOpenIndexTyped() { var r = this._client.CloseIndex<ElasticsearchProject>(); Assert.True(r.Acknowledged); Assert.True(r.IsValid); r = this._client.OpenIndex<ElasticsearchProject>(); Assert.True(r.Acknowledged); Assert.True(r.IsValid); } [Test] public void CloseAndSearchAndOpenIndex() { var r = this._client.CloseIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); var results = this._client.Search<ElasticsearchProject>(s => s .MatchAll() ); Assert.False(results.IsValid); Assert.IsNotNull(results.ConnectionStatus); var statusCode = results.ConnectionStatus.HttpStatusCode; Assert.AreEqual(statusCode, 403); var error = results.ServerError; error.Should().NotBeNull(); error.ExceptionType.Should().Be("ClusterBlockException"); error.Error.Should().Contain("index closed"); r = this._client.OpenIndex(ElasticsearchConfiguration.DefaultIndex); Assert.True(r.Acknowledged); Assert.True(r.IsValid); } } }
apache-2.0
C#
48d2c65f3bd0a0be885d974bfef09c29b019c219
Add public user id loading.
mfilippov/vimeo-dot-net
src/VimeoDotNet.Tests/Settings/SettingsLoader.cs
src/VimeoDotNet.Tests/Settings/SettingsLoader.cs
using System; using System.IO; using Newtonsoft.Json; namespace VimeoDotNet.Tests.Settings { internal static class SettingsLoader { private const string SettingsFile = "vimeoSettings.json"; public static VimeoApiTestSettings LoadSettings() { var fromEnv = GetSettingsFromEnvVars(); if (fromEnv.UserId != 0) return fromEnv; if (!File.Exists(SettingsFile)) { // File was not found so create a new one with blanks SaveSettings(new VimeoApiTestSettings()); throw new Exception(string.Format( "The file {0} was not found. A file was created, please fill in the information", SettingsFile)); } var json = File.ReadAllText(SettingsFile); return JsonConvert.DeserializeObject<VimeoApiTestSettings>(json); } private static VimeoApiTestSettings GetSettingsFromEnvVars() { long.TryParse(Environment.GetEnvironmentVariable("UserId"), out var userId); long.TryParse(Environment.GetEnvironmentVariable("AlbumId"), out var albumId); long.TryParse(Environment.GetEnvironmentVariable("ChannelId"), out var channelId); long.TryParse(Environment.GetEnvironmentVariable("VideoId"), out var videoId); long.TryParse(Environment.GetEnvironmentVariable("TextTrackId"), out var textTrackId); long.TryParse(Environment.GetEnvironmentVariable("PublicUserId"), out var publicUserId); return new VimeoApiTestSettings { ClientId = Environment.GetEnvironmentVariable("ClientId"), ClientSecret = Environment.GetEnvironmentVariable("ClientSecret"), AccessToken = Environment.GetEnvironmentVariable("AccessToken"), UserId = userId, AlbumId = albumId, ChannelId = channelId, VideoId = videoId, TextTrackId = textTrackId, PublicUserId = publicUserId }; } private static void SaveSettings(VimeoApiTestSettings settings) { var json = JsonConvert.SerializeObject(settings, Formatting.Indented); File.WriteAllText(SettingsFile, json); } } }
using System; using System.IO; using Newtonsoft.Json; namespace VimeoDotNet.Tests.Settings { internal static class SettingsLoader { private const string SettingsFile = "vimeoSettings.json"; public static VimeoApiTestSettings LoadSettings() { var fromEnv = GetSettingsFromEnvVars(); if (fromEnv.UserId != 0) return fromEnv; if (!File.Exists(SettingsFile)) { // File was not found so create a new one with blanks SaveSettings(new VimeoApiTestSettings()); throw new Exception(string.Format( "The file {0} was not found. A file was created, please fill in the information", SettingsFile)); } var json = File.ReadAllText(SettingsFile); return JsonConvert.DeserializeObject<VimeoApiTestSettings>(json); } private static VimeoApiTestSettings GetSettingsFromEnvVars() { long.TryParse(Environment.GetEnvironmentVariable("UserId"), out var userId); long.TryParse(Environment.GetEnvironmentVariable("AlbumId"), out var albumId); long.TryParse(Environment.GetEnvironmentVariable("ChannelId"), out var channelId); long.TryParse(Environment.GetEnvironmentVariable("VideoId"), out var videoId); long.TryParse(Environment.GetEnvironmentVariable("TextTrackId"), out var textTrackId); return new VimeoApiTestSettings { ClientId = Environment.GetEnvironmentVariable("ClientId"), ClientSecret = Environment.GetEnvironmentVariable("ClientSecret"), AccessToken = Environment.GetEnvironmentVariable("AccessToken"), UserId = userId, AlbumId = albumId, ChannelId = channelId, VideoId = videoId, TextTrackId = textTrackId }; } private static void SaveSettings(VimeoApiTestSettings settings) { var json = JsonConvert.SerializeObject(settings, Formatting.Indented); File.WriteAllText(SettingsFile, json); } } }
mit
C#
74072bdd310387fcdb45b3ad2f3a7b55c7ef8745
バージョンを1.0.9.1にアップ
Koichi-Kobayashi/AipoReminder,Koichi-Kobayashi/AipoReminder,Koichi-Kobayashi/AipoReminder
AipoReminder/Properties/AssemblyInfo.cs
AipoReminder/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Aipoリマインダー")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Aipoリマインダー")] [assembly: AssemblyCopyright("Copyright © 2009-2010 k.kobayashi")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("0babe3d5-c7f4-47b1-94b8-62d80228083b")] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // Major Version // Minor Version // Build Number // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] // AssemblyVersionが変わると設定ファイルのパスが変わってしまうのでこのままで固定 [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.9.1")] // log4net [assembly: log4net.Config.XmlConfigurator(Watch = true)]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("Aipoリマインダー")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Aipoリマインダー")] [assembly: AssemblyCopyright("Copyright © 2009-2010 k.kobayashi")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("0babe3d5-c7f4-47b1-94b8-62d80228083b")] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // Major Version // Minor Version // Build Number // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] // AssemblyVersionが変わると設定ファイルのパスが変わってしまうのでこのままで固定 [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.9.0")] // log4net [assembly: log4net.Config.XmlConfigurator(Watch = true)]
apache-2.0
C#
126ebca4d9125c13c8eca8a2204e05bda8770532
Update ZoneInfoCompiler help very slightly.
zaccharles/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,zaccharles/nodatime,malcolmr/nodatime,zaccharles/nodatime,zaccharles/nodatime,zaccharles/nodatime,malcolmr/nodatime,jskeet/nodatime,zaccharles/nodatime,jskeet/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,nodatime/nodatime,nodatime/nodatime
src/ZoneInfoCompiler/Tzdb/TzdbCompilerOptions.cs
src/ZoneInfoCompiler/Tzdb/TzdbCompilerOptions.cs
#region Copyright and license information // Copyright 2001-2009 Stephen Colebourne // Copyright 2009-2012 Jon Skeet // // 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 CommandLine; using CommandLine.Text; namespace NodaTime.ZoneInfoCompiler.Tzdb { /// <summary> /// Defines the command line options that are valid. /// </summary> public class TzdbCompilerOptions { private static readonly HeadingInfo HeadingInfo = new HeadingInfo(AssemblyInfo.Product, AssemblyInfo.Version); [Option("o", "output", Required = true, HelpText = "The name of the output file.")] public string OutputFileName { get; set; } [Option("s", "source", Required = true, HelpText = "Source directory containing the TZDB input files.")] public string SourceDirectoryName { get; set; } [Option("w", "windows", Required = true, HelpText = "Windows to TZDB time zone mapping file (e.g. windowsZones.xml)")] public string WindowsMappingFile { get; set; } [Option("t", "type", HelpText = "The type of the output file { ResX, Resource }. Defaults to Resx.")] public ResourceOutputType OutputType { get; set; } public TzdbCompilerOptions() { OutputFileName = ""; SourceDirectoryName = ""; WindowsMappingFile = ""; OutputType = ResourceOutputType.ResX; } [HelpOption(HelpText = "Display this help screen.")] public string GetUsage() { var help = new HelpText(HeadingInfo); help.AdditionalNewLineAfterOption = true; help.Copyright = new CopyrightInfo("Jon Skeet", 2009, 2012); help.AddPreOptionsLine("Usage: ZoneInfoCompiler -s <tzdb directory> -w <windowsZone.xml file> -o <output file> [-t ResX/Resource]"); help.AddOptions(this); return help; } } }
#region Copyright and license information // Copyright 2001-2009 Stephen Colebourne // Copyright 2009-2012 Jon Skeet // // 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 CommandLine; using CommandLine.Text; namespace NodaTime.ZoneInfoCompiler.Tzdb { /// <summary> /// Defines the command line options that are valid. /// </summary> public class TzdbCompilerOptions { private static readonly HeadingInfo HeadingInfo = new HeadingInfo(AssemblyInfo.Product, AssemblyInfo.Version); [Option("o", "output", Required = true, HelpText = "The name of the output file.")] public string OutputFileName { get; set; } [Option("s", "source", Required = true, HelpText = "Source directory containing the TZDB input files.")] public string SourceDirectoryName { get; set; } [Option("w", "windows", Required = true, HelpText = "Windows to TZDB time zone mapping file (windowsZones.xml")] public string WindowsMappingFile { get; set; } [Option("t", "type", HelpText = "The type of the output file { ResX, Resource }. Defaults to Resx.")] public ResourceOutputType OutputType { get; set; } public TzdbCompilerOptions() { OutputFileName = ""; SourceDirectoryName = ""; WindowsMappingFile = ""; OutputType = ResourceOutputType.ResX; } [HelpOption(HelpText = "Display this help screen.")] public string GetUsage() { var help = new HelpText(HeadingInfo); help.AdditionalNewLineAfterOption = true; help.Copyright = new CopyrightInfo("Jon Skeet", 2009, 2012); help.AddPreOptionsLine("Usage: ZoneInfoCompiler -s <tzdb directory> -w <windowsZone.xml file> -o <output file> [-t ResX/Resource]"); help.AddOptions(this); return help; } } }
apache-2.0
C#
0809770483c754cc374703dc3f59555cbb40d782
Use the new factory for Typesetting context
verybadcat/CSharpMath
CSharpMath.Ios/IosMath/IosMathLabels.cs
CSharpMath.Ios/IosMath/IosMathLabels.cs
using CSharpMath.Apple; namespace CSharpMath.Ios { static class IosMathLabels { public static AppleLatexView LatexView(string latex) { var typesettingContext = AppleTypesetters.CreateLatinMath(); var view = new AppleLatexView(typesettingContext); view.SetLatex(latex); return view; } } }
using CSharpMath.Apple; namespace CSharpMath.Ios { static class IosMathLabels { public static AppleLatexView LatexView(string latex) { var typesettingContext = AppleTypesetters.CreateTypesettingContext() var view = new AppleLatexView(); view.SetLatex(latex); return view; } } }
mit
C#
8391c88c554043ce9d9855dbbcdbc14a747f5097
update version
jefking/King.Mapper
King.Mapper/Properties/AssemblyInfo.cs
King.Mapper/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("King.Mapper")] [assembly: AssemblyDescription("King Object Mapper")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("King.Mapper")] [assembly: AssemblyCopyright("Copyright © Jef King 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("98617c1d-b53c-4e62-bac4-17d6001219bb")] [assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.1.0")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("King.Mapper")] [assembly: AssemblyDescription("King Object Mapper")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("King.Mapper")] [assembly: AssemblyCopyright("Copyright © Jef King 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("98617c1d-b53c-4e62-bac4-17d6001219bb")] [assembly: AssemblyVersion("1.0.0.5")] [assembly: AssemblyFileVersion("1.0.0.5")]
mit
C#
d95b8d85b61490636565363188efe4d3c641678e
Revert "Minor"
Teleopti/Stardust
Node/NodeTest.JobHandlers/TestJobCode.cs
Node/NodeTest.JobHandlers/TestJobCode.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Stardust.Node.ReturnObjects; namespace NodeTest.JobHandlers { public class TestJobCode { public void DoTheThing(TestJobParams message, CancellationTokenSource cancellationTokenSource, Action<string> progress, ref IEnumerable<object> returnObjects) { // ----------------------------------------------------------- // Start execution. // ----------------------------------------------------------- var jobProgress = new TestJobProgress { Text = $"Starting job: {message.Name}" }; progress(jobProgress.Text); jobProgress = new TestJobProgress { Text = $"Will execute for : {message.Duration} seconds." }; progress(jobProgress.Text); var stopwatch = new Stopwatch(); stopwatch.Start(); var progressCounter = 0; while (stopwatch.Elapsed <= TimeSpan.FromSeconds(message.Duration)) { progressCounter++; if (cancellationTokenSource.IsCancellationRequested) { cancellationTokenSource.Token.ThrowIfCancellationRequested(); } jobProgress = new TestJobProgress { Text = $"Progress loop number :{progressCounter}" }; progress(jobProgress.Text); Thread.Sleep(TimeSpan.FromSeconds(1)); } // ----------------------------------------------------------- // Finished execution. // ----------------------------------------------------------- jobProgress = new TestJobProgress { Text = $"Finished job: {message.Name}" }; progress(jobProgress.Text); var objects = new List<object>(); if(message.ExitApplication) objects.Add(new ExitApplication { ExitCode = 0 }); returnObjects = objects; } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Stardust.Node.ReturnObjects; namespace NodeTest.JobHandlers { public class TestJobCode { public void DoTheThing(TestJobParams message, CancellationTokenSource cancellationTokenSource, Action<string> progress, ref IEnumerable<object> returnObjects) { // ----------------------------------------------------------- // Start execution. // ----------------------------------------------------------- var jobProgress = new TestJobProgress { Text = $"Starting job: {message.Name}" }; progress(jobProgress.Text); jobProgress = new TestJobProgress { Text = $"Will execute for : {message.Duration} seconds." }; progress(jobProgress.Text); var stopwatch = new Stopwatch(); stopwatch.Start(); var progressCounter = 0; var duration = TimeSpan.FromSeconds(message.Duration); while (stopwatch.Elapsed <= duration) { progressCounter++; if (cancellationTokenSource.IsCancellationRequested) { cancellationTokenSource.Token.ThrowIfCancellationRequested(); } jobProgress = new TestJobProgress { Text = $"Progress loop number :{progressCounter}" }; progress(jobProgress.Text); Thread.Sleep(TimeSpan.FromSeconds(1)); } // ----------------------------------------------------------- // Finished execution. // ----------------------------------------------------------- jobProgress = new TestJobProgress { Text = $"Finished job: {message.Name}" }; progress(jobProgress.Text); var objects = new List<object>(); if(message.ExitApplication) objects.Add(new ExitApplication { ExitCode = 0 }); returnObjects = objects; } } }
mit
C#
f893c9b75766913648bbff4570c3c6b2f6c8e2b0
Remove unused imports
MHeasell/Mappy,MHeasell/Mappy
Mappy/Models/ISelectionCommandModel.cs
Mappy/Models/ISelectionCommandModel.cs
namespace Mappy.Models { public interface ISelectionCommandModel { void SelectAtPoint(int x, int y); void ClearSelection(); void DeleteSelection(); void TranslateSelection(int x, int y); void FlushTranslation(); void DragDropFeature(string name, int x, int y); void DragDropTile(int id, int x, int y); void DragDropStartPosition(int index, int x, int y); } }
namespace Mappy.Models { using System; using System.Collections.Generic; using System.Linq; using System.Text; public interface ISelectionCommandModel { void SelectAtPoint(int x, int y); void ClearSelection(); void DeleteSelection(); void TranslateSelection(int x, int y); void FlushTranslation(); void DragDropFeature(string name, int x, int y); void DragDropTile(int id, int x, int y); void DragDropStartPosition(int index, int x, int y); } }
mit
C#
4c09f423283e779f564ad7b7ac0d6ad2347d18bf
Update DeletingBlankRows.cs
aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/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,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Articles/DeleteBlankRowsColumns/DeletingBlankRows.cs
Examples/CSharp/Articles/DeleteBlankRowsColumns/DeletingBlankRows.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.DeleteBlankRowsColumns { public class DeletingBlankRows { public static void Main() { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a new Workbook. //Open an existing excel file. Workbook wb = new Workbook(dataDir+ "SampleInput.xlsx"); //Create a Worksheets object with reference to //the sheets of the Workbook. WorksheetCollection sheets = wb.Worksheets; //Get first Worksheet from WorksheetCollection Worksheet sheet = sheets[0]; //Delete the Blank Rows from the worksheet sheet.Cells.DeleteBlankRows(); //Save the excel file. wb.Save(dataDir+ "mybook.out.xlsx"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.DeleteBlankRowsColumns { public class DeletingBlankRows { public static void Main() { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a new Workbook. //Open an existing excel file. Workbook wb = new Workbook(dataDir+ "SampleInput.xlsx"); //Create a Worksheets object with reference to //the sheets of the Workbook. WorksheetCollection sheets = wb.Worksheets; //Get first Worksheet from WorksheetCollection Worksheet sheet = sheets[0]; //Delete the Blank Rows from the worksheet sheet.Cells.DeleteBlankRows(); //Save the excel file. wb.Save(dataDir+ "mybook.out.xlsx"); } } }
mit
C#
bb98a0d3fcb2b645b70042b1eb5458be6ef714f5
Update string consts
drasticactions/Pureisuteshon-App,drasticactions/PlayStation-App,drasticactions/Pureisuteshon-App,drasticactions/PlayStation-App
PSX-Gui/Tools/Debug/StringConstants.cs
PSX-Gui/Tools/Debug/StringConstants.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PlayStation_Gui.Tools.Debug { public class StringConstants { public const string UserDatabase = "UserDatabase"; public const string StampDatabase = "StampDatabase"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PlayStation_Gui.Tools.Debug { public class StringConstants { public const string UserDatabase = "UserDatabase"; } }
mit
C#
94ba2b3d3e7e2a1859ae4ce9d5b8199f553c193e
Fix syntax error in Splunk SDK for C# template class.
splunk/splunk-extension-visualstudio
SplunkSDKCSharpProjectTemplate/Class1.cs
SplunkSDKCSharpProjectTemplate/Class1.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Text; using Splunk.Client; // This is a template for new users of the Splunk SDK for Java. // The code below connects to a Splunk instance, runs a search, // and prints out the results in a crude form. namespace $safeprojectname$ { public class Class1 { static void Main(string[] args) { using (var service = new Service(Scheme.Https, "localhost", 8089)) { Run(service).Wait(); } } static async Task Run(Service service) { //// Login await service.LoginAsync("admin", "changeme"); var query = "search index=_internal | head 5"; var args = new JobArgs { // For a full list of options, see: // // http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#POST_search.2Fjobs EarliestTime = "now-1w", LatestTime = "now" }; using (SearchResultStream resultStream = await service.SearchOneshotAsync(query, args)) { foreach (SearchResult result in resultStream) { Console.WriteLine(result); } } } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Text; using Splunk.Client; // This is a template for new users of the Splunk SDK for Java. // The code below connects to a Splunk instance, runs a search, // and prints out the results in a crude form. namespace $safeprojectname$ { public class Class1 { static void Main(string[] args) { using (var service = new Service(Scheme.Https, "localhost", 8089)) { Run(service).Wait(); } } static async Task Run(Service service) { //// Login await service.LoginAsync("admin", "changeme"); using (SearchResultStream resultStream = await service.SearchOneshotAsync( "search index=_internal | head 5", new JobArgs { // For a full list of options, see: // // http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#POST_search.2Fjobs EarliestTime = "now-1w", LatestTime = "now" })) { foreach (SearchResult result in resultStream) { Console.WriteLine(result); } } } } } }
apache-2.0
C#
d62f69bf01cc798450c42b02ecffd69a70cc5315
Remove AllowPartiallyTrustedCallersAttribute (APTCA)
malcolmr/nodatime,nodatime/nodatime,malcolmr/nodatime,nodatime/nodatime,BenJenkinson/nodatime,jskeet/nodatime,malcolmr/nodatime,jskeet/nodatime,BenJenkinson/nodatime,malcolmr/nodatime
src/NodaTime/AssemblyInfo.cs
src/NodaTime/AssemblyInfo.cs
// Copyright 2009 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using System; using System.Resources; using System.Runtime.CompilerServices; [assembly: CLSCompliant(true)] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("NodaTime.Benchmarks" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.Test" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.NzdPrinter" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.TzdbCompiler" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.TzdbCompiler.Test" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.Benchmarks" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] namespace NodaTime.Properties { /// <summary> /// Just a static class to house the public key, which allows us to avoid repeating it all over the place. /// </summary> internal static class AssemblyInfo { internal const string PublicKeySuffix = ",PublicKey=0024000004800000940000000602000000240000525341310004000001000100d335797ef2bff7" + "4db7c046f874523c553f88d3f8e0c2ba769820c54f0e64a11b47198b544c74abb487f8d3b64669" + "08ae2ac6fced4738e46a75e5661d5ac03fb29c7e26b13a220400cb9df95134e85716203f83b96f" + "ab661135c39b10f33e1c467a6750d8af331c602351b09a7bf5dd3a8943712d676481c5054c8031" + "84f77ed5"; } }
// Copyright 2009 The Noda Time Authors. All rights reserved. // Use of this source code is governed by the Apache License 2.0, // as found in the LICENSE.txt file. using System; using System.Resources; using System.Runtime.CompilerServices; // TODO: Check whether this is still a good idea [assembly: System.Security.AllowPartiallyTrustedCallers] [assembly: CLSCompliant(true)] [assembly: NeutralResourcesLanguage("en")] [assembly: InternalsVisibleTo("NodaTime.Benchmarks" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.Test" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.NzdPrinter" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.TzdbCompiler" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.TzdbCompiler.Test" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] [assembly: InternalsVisibleTo("NodaTime.Benchmarks" + NodaTime.Properties.AssemblyInfo.PublicKeySuffix)] namespace NodaTime.Properties { /// <summary> /// Just a static class to house the public key, which allows us to avoid repeating it all over the place. /// </summary> internal static class AssemblyInfo { internal const string PublicKeySuffix = ",PublicKey=0024000004800000940000000602000000240000525341310004000001000100d335797ef2bff7" + "4db7c046f874523c553f88d3f8e0c2ba769820c54f0e64a11b47198b544c74abb487f8d3b64669" + "08ae2ac6fced4738e46a75e5661d5ac03fb29c7e26b13a220400cb9df95134e85716203f83b96f" + "ab661135c39b10f33e1c467a6750d8af331c602351b09a7bf5dd3a8943712d676481c5054c8031" + "84f77ed5"; } }
apache-2.0
C#
caff4c9b17a242e642df4b9beee887eb69c5c422
Add `SCardShare.Undefined`
Archie-Yang/PcscDotNet
src/PcscDotNet/SCardShare.cs
src/PcscDotNet/SCardShare.cs
namespace PcscDotNet { /// <summary> /// Indicates whether other applications may form connections to the card. /// </summary> public enum SCardShare { /// <summary> /// This application demands direct control of the reader, so it is not available to other applications. /// </summary> Direct = 3, /// <summary> /// This application is not willing to share this card with other applications. /// </summary> Exclusive = 1, /// <summary> /// This application is willing to share this card with other applications. /// </summary> Shared = 2, /// <summary> /// Share mode is undefined, can not be used to connect to card/reader. /// </summary> Undefined = 0 } }
namespace PcscDotNet { /// <summary> /// Indicates whether other applications may form connections to the card. /// </summary> public enum SCardShare { /// <summary> /// This application demands direct control of the reader, so it is not available to other applications. /// </summary> Direct = 3, /// <summary> /// This application is not willing to share this card with other applications. /// </summary> Exclusive = 1, /// <summary> /// This application is willing to share this card with other applications. /// </summary> Shared = 2 } }
mit
C#
8411b604b1b929b35943450fac950611f0b99270
change encoding for deserializing responses to UTF-8
solomobro/Instagram,solomobro/Instagram,solomobro/Instagram
src/Solomobro.Instagram.Tests/Serialization/UsersEndpointTests.cs
src/Solomobro.Instagram.Tests/Serialization/UsersEndpointTests.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; using Solomobro.Instagram.Models; namespace Solomobro.Instagram.Tests.Serialization { [TestFixture] class UsersEndpointTests { private static readonly JsonSerializer Serializer = new JsonSerializer(); [Test] public void CanDeserializeGetUser() { const string response = "{\"meta\":{\"code\":200},\"data\":{\"username\":\"solomobro\",\"bio\":\"This is a developer test account for an Instagram .NET SDK\",\"website\":\"https://github.com/solomobro/Instagram\",\"profile_picture\":\"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-19/s150x150/11917846_398932440308986_1930181477_a.jpg\",\"full_name\":\"So Lo Mo, Bro!\",\"counts\":{\"media\":2,\"followed_by\":3,\"follows\":1},\"id\":\"12345678\"}}"; using (var s = new MemoryStream(Encoding.UTF8.GetBytes(response))) { var resp = Serializer.Deserialize<Response<User>>(s); Assert.That(resp, Is.Not.Null); } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; using Solomobro.Instagram.Models; namespace Solomobro.Instagram.Tests.Serialization { [TestFixture] class UsersEndpointTests { private static readonly JsonSerializer Serializer = new JsonSerializer(); [Test] public void CanDeserializeGetUser() { const string response = "{\"meta\":{\"code\":200},\"data\":{\"username\":\"solomobro\",\"bio\":\"This is a developer test account for an Instagram .NET SDK\",\"website\":\"https://github.com/solomobro/Instagram\",\"profile_picture\":\"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-19/s150x150/11917846_398932440308986_1930181477_a.jpg\",\"full_name\":\"So Lo Mo, Bro!\",\"counts\":{\"media\":2,\"followed_by\":3,\"follows\":1},\"id\":\"12345678\"}}"; using (var s = new MemoryStream(Encoding.ASCII.GetBytes(response))) { var resp = Serializer.Deserialize<Response<User>>(s); Assert.That(resp, Is.Not.Null); } } } }
apache-2.0
C#
3bf78e5320c57583d4d26f8cd62fe2631868c080
test commit
Barsonax/Pathfindax
Source/Code/Pathfindax.Duality/Components/PathfindaxTestComponent.cs
Source/Code/Pathfindax.Duality/Components/PathfindaxTestComponent.cs
using System; using Duality; using Duality.Drawing; using Duality.Editor; using Pathfindax.PathfindEngine; using Pathfindax.Primitives; namespace Pathfindax.Duality.Components { /// <summary> /// Spams path requests as a example /// </summary> public class PathfindaxTestComponent : Component, ICmpUpdatable, ICmpRenderer { public PositionF[] Path { get; private set; } [EditorHintFlags(MemberFlags.Invisible)] public float BoundRadius { get; } [EditorHintFlags(MemberFlags.Visible)] private PathfinderProxy PathfinderProxy { get; set; } private readonly Random _randomGenerator = new Random(); void ICmpUpdatable.OnUpdate() { var start = new PositionF(_randomGenerator.Next(0, 484), _randomGenerator.Next(0, 484)); var end = new PositionF(_randomGenerator.Next(0, 484), _randomGenerator.Next(0, 484)); var request = new PathRequest(PathSolved, start, end, 1); PathfinderProxy.RequestPath(request); } private void PathSolved(CompletedPath completedPath) { Path = completedPath.Path; } bool ICmpRenderer.IsVisible(IDrawDevice device) { return (device.VisibilityMask & VisibilityFlag.AllGroups) != VisibilityFlag.None && (device.VisibilityMask & VisibilityFlag.ScreenOverlay) == VisibilityFlag.None; } void ICmpRenderer.Draw(IDrawDevice device) { if (Path != null) { var canvas = new Canvas(device); canvas.State.ColorTint = ColorRgba.Red; foreach (var position in Path) { canvas.FillCircle(position.X, position.Y, 10f); } } } } }
using System; using Duality; using Duality.Drawing; using Duality.Editor; using Pathfindax.PathfindEngine; using Pathfindax.Primitives; namespace Pathfindax.Duality.Components { public class PathfindaxTestComponent : Component, ICmpUpdatable, ICmpRenderer { public PositionF[] Path { get; private set; } [EditorHintFlags(MemberFlags.Invisible)] public float BoundRadius { get; } [EditorHintFlags(MemberFlags.Visible)] private PathfinderProxy PathfinderProxy { get; set; } private readonly Random _randomGenerator = new Random(); void ICmpUpdatable.OnUpdate() { var start = new PositionF(_randomGenerator.Next(0, 484), _randomGenerator.Next(0, 484)); var end = new PositionF(_randomGenerator.Next(0, 484), _randomGenerator.Next(0, 484)); var request = new PathRequest(PathSolved, start, end, 1); PathfinderProxy.RequestPath(request); } private void PathSolved(CompletedPath completedPath) { Path = completedPath.Path; } bool ICmpRenderer.IsVisible(IDrawDevice device) { return (device.VisibilityMask & VisibilityFlag.AllGroups) != VisibilityFlag.None && (device.VisibilityMask & VisibilityFlag.ScreenOverlay) == VisibilityFlag.None; } void ICmpRenderer.Draw(IDrawDevice device) { if (Path != null) { var canvas = new Canvas(device); canvas.State.ColorTint = ColorRgba.Red; foreach (var position in Path) { canvas.FillCircle(position.X, position.Y, 10f); } } } } }
agpl-3.0
C#
8054737bd85ebd102d92aa322cfe53552a3f8a75
add IsDefinition on IGenericParameterProvider
SiliconStudio/Mono.Cecil,xen2/cecil,kzu/cecil,fnajera-rac-de/cecil,mono/cecil,cgourlay/cecil,ttRevan/cecil,jbevain/cecil,joj/cecil,sailro/cecil,gluck/cecil,saynomoo/cecil,furesoft/cecil
Mono.Cecil/IGenericParameterProvider.cs
Mono.Cecil/IGenericParameterProvider.cs
// // IGenericParameterProvider.cs // // Author: // Jb Evain ([email protected]) // // Copyright (c) 2008 - 2010 Jb Evain // // 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 Mono.Collections.Generic; namespace Mono.Cecil { public interface IGenericParameterProvider : IMetadataTokenProvider { bool HasGenericParameters { get; } bool IsDefinition { get; } Collection<GenericParameter> GenericParameters { get; } GenericParameterType GenericParameterType { get; } } public enum GenericParameterType { Type, Method } interface IGenericContext { bool IsDefinition { get; } IGenericParameterProvider Type { get; } IGenericParameterProvider Method { get; } } static partial class Mixin { public static bool GetHasGenericParameters ( this IGenericParameterProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.HasGenericParameters (provider)) : false; } public static Collection<GenericParameter> GetGenericParameters ( this IGenericParameterProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadGenericParameters (provider)) : new Collection<GenericParameter> (); } } }
// // IGenericParameterProvider.cs // // Author: // Jb Evain ([email protected]) // // Copyright (c) 2008 - 2010 Jb Evain // // 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 Mono.Collections.Generic; namespace Mono.Cecil { public interface IGenericParameterProvider : IMetadataTokenProvider { bool HasGenericParameters { get; } Collection<GenericParameter> GenericParameters { get; } GenericParameterType GenericParameterType { get; } } public enum GenericParameterType { Type, Method } interface IGenericContext { bool IsDefinition { get; } IGenericParameterProvider Type { get; } IGenericParameterProvider Method { get; } } static partial class Mixin { public static bool GetHasGenericParameters ( this IGenericParameterProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.HasGenericParameters (provider)) : false; } public static Collection<GenericParameter> GetGenericParameters ( this IGenericParameterProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadGenericParameters (provider)) : new Collection<GenericParameter> (); } } }
mit
C#
c49e9acc1be5c1c3b0a7ec02f1bd3c299e96894c
change IngestResult numeric types to decimal
precog/precog_dotnet_client
PrecogClient/Client/Dto/IngestResult.cs
PrecogClient/Client/Dto/IngestResult.cs
using System; namespace Precog.Client.Dto { public class IngestResult { public bool Completed { get; private set; } public decimal Total { get; set;} public decimal Ingested { get; set;} public decimal Failed { get; set;} public decimal Skipped { get; set;} public string[] Errors { get; set;} public IngestResult(bool completed= true) { this.Completed = completed; } } }
using System; namespace Precog.Client.Dto { public class IngestResult { public bool Completed { get; private set; } public float Total { get; set;} public float Ingested { get; set;} public float Failed { get; set;} public float Skipped { get; set;} public string[] Errors { get; set;} public IngestResult(bool completed= true) { this.Completed = completed; } } }
mit
C#
db323619361794854628725d51b4dcf617804d99
Fix MoveNotOnMapException
EntelectChallenge/2015-SpaceInvaders-TestHarness,EntelectChallenge/2015-SpaceInvaders-TestHarness
SpaceInvaders/Factories/AlienFactory.cs
SpaceInvaders/Factories/AlienFactory.cs
using System.Collections.Generic; using SpaceInvaders.Core; using SpaceInvaders.Entities; using SpaceInvaders.Exceptions; namespace SpaceInvaders.Factories { public static class AlienFactory { static bool IsOutOfXBounds(this Map map, int x) { // cater for walls return x < 1 || x >= map.Width - 1; } public static List<Alien> Build(int playerNumber, int waveSize, int startX, int deltaX) { var map = Match.GetInstance().Map; var deltaY = playerNumber == 1 ? -1 : 1; var middleHeightOfMap = map.Height / 2; // make sure aliens dont go out of map while (map.IsOutOfXBounds(startX + 3 * deltaX * (waveSize - 1))) { startX -= 3 * deltaX; } // Spawn var wave = new List<Alien>(); var alienY = middleHeightOfMap + deltaY; var alienX = startX; Alien alien = null; for (var i = 0; i < waveSize; i++) { try { alien = new Alien(playerNumber) { X = alienX, Y = alienY }; alien.DeltaX = deltaX; map.AddEntity(alien); wave.Add(alien); } catch (CollisionException ex) { ex.Entity.Destroy(); if (ex.Entity.GetType() == typeof(Missile)) { ((Missile)ex.Entity).ScoreKill(alien); } } alienX += 3 * deltaX; } return wave; } } }
using System.Collections.Generic; using SpaceInvaders.Core; using SpaceInvaders.Entities; using SpaceInvaders.Exceptions; namespace SpaceInvaders.Factories { public static class AlienFactory { public static List<Alien> Build(int playerNumber, int waveSize, int startX, int deltaX) { var map = Match.GetInstance().Map; var deltaY = playerNumber == 1 ? -1 : 1; var middleHeightOfMap = map.Height/2; // Spawn var wave = new List<Alien>(); var alienY = middleHeightOfMap + deltaY; var alienX = startX; Alien alien = null; for (var i = 0; i < waveSize; i++) { try { alien = new Alien(playerNumber) {X = alienX, Y = alienY}; alien.DeltaX = deltaX; map.AddEntity(alien); wave.Add(alien); } catch (CollisionException ex) { ex.Entity.Destroy(); if (ex.Entity.GetType() == typeof (Missile)) { ((Missile) ex.Entity).ScoreKill(alien); } } alienX += 3*deltaX; } return wave; } } }
mit
C#
80ab67e741cf4f6b2e156675076c0cf632425f6d
Add constructor with DbContextOptions parameter to ApplicationDbContext
GeorgDangl/WebDocu,GeorgDangl/WebDocu,GeorgDangl/WebDocu
src/Dangl.WebDocumentation/Models/ApplicationDbContext.cs
src/Dangl.WebDocumentation/Models/ApplicationDbContext.cs
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; namespace Dangl.WebDocumentation.Models { public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet<DocumentationProject> DocumentationProjects { get; set; } public DbSet<UserProjectAccess> UserProjects { get; set; } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); // Make the Name unique so it can be used as a single identifier for a project ( -> Urls may contain the project name instead of the Guid) builder.Entity<DocumentationProject>() .HasIndex(Entity => Entity.Name) .IsUnique(); // Make the ApiKey unique so it can be used as a single identifier for a project builder.Entity<DocumentationProject>() .HasIndex(Entity => Entity.ApiKey) .IsUnique(); // Composite key for UserProject Access builder.Entity<UserProjectAccess>() .HasKey(Entity => new {Entity.ProjectId, Entity.UserId}); builder.Entity<UserProjectAccess>() .HasOne(Entity => Entity.Project) .WithMany(Project => Project.UserAccess) .OnDelete(DeleteBehavior.Cascade); } } }
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; namespace Dangl.WebDocumentation.Models { public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public DbSet<DocumentationProject> DocumentationProjects { get; set; } public DbSet<UserProjectAccess> UserProjects { get; set; } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); // Make the Name unique so it can be used as a single identifier for a project ( -> Urls may contain the project name instead of the Guid) builder.Entity<DocumentationProject>() .HasIndex(Entity => Entity.Name) .IsUnique(); // Make the ApiKey unique so it can be used as a single identifier for a project builder.Entity<DocumentationProject>() .HasIndex(Entity => Entity.ApiKey) .IsUnique(); // Composite key for UserProject Access builder.Entity<UserProjectAccess>() .HasKey(Entity => new {Entity.ProjectId, Entity.UserId}); builder.Entity<UserProjectAccess>() .HasOne(Entity => Entity.Project) .WithMany(Project => Project.UserAccess) .OnDelete(DeleteBehavior.Cascade); } } }
mit
C#
0096b33b84a3778bbbc0046b2ecb7e95d1963c3e
Fix build error
exceptionless/Foundatio.Repositories
src/Foundatio.Repositories.Elasticsearch/Queries/Query.cs
src/Foundatio.Repositories.Elasticsearch/Queries/Query.cs
using System; using System.Collections.Generic; using Foundatio.Repositories.Elasticsearch.Queries.Builders; using Foundatio.Repositories.Models; using Foundatio.Repositories.Queries; using Nest; using IDateRangeQuery = Foundatio.Repositories.Elasticsearch.Queries.Builders.IDateRangeQuery; namespace Foundatio.Repositories.Elasticsearch.Queries { public class Query : ISystemFilterQuery, IIdentityQuery, ICachableQuery, IDateRangeQuery, IFieldConditionsQuery, IPagableQuery, ISearchQuery, IAggregationQuery, IFieldIncludesQuery, ISortableQuery, IParentQuery, IChildQuery, ISoftDeletesQuery { public ISet<string> Ids { get; } = new HashSet<string>(); public ISet<string> ExcludedIds { get; } = new HashSet<string>(); public string CacheKey { get; set; } public TimeSpan? ExpiresIn { get; set; } public DateTime? ExpiresAt { get; set; } public ICollection<Builders.DateRange> DateRanges { get; } = new List<Builders.DateRange>(); public ICollection<FieldCondition> FieldConditions { get; } = new List<FieldCondition>(); public IRepositoryQuery SystemFilter { get; set; } public string Filter { get; set; } public string Criteria { get; set; } public SearchOperator DefaultCriteriaOperator { get; set; } public ICollection<Field> FieldIncludes { get; } = new List<Field>(); public ICollection<Field> FieldExcludes { get; } = new List<Field>(); public ICollection<IFieldSort> SortFields { get; } = new List<IFieldSort>(); public string Sort { get; set; } public bool SortByScore { get; set; } public string Aggregations { get; set; } public IRepositoryQuery ParentQuery { get; set; } public ITypeQuery ChildQuery { get; set; } public SoftDeleteQueryMode? SoftDeleteMode { get; set; } public IPagingOptions Options { get; set; } } }
using System; using System.Collections.Generic; using Foundatio.Repositories.Elasticsearch.Queries.Builders; using Foundatio.Repositories.Models; using Foundatio.Repositories.Queries; using Nest; using IDateRangeQuery = Foundatio.Repositories.Elasticsearch.Queries.Builders.IDateRangeQuery; namespace Foundatio.Repositories.Elasticsearch.Queries { public class Query : ISystemFilterQuery, IIdentityQuery, ICachableQuery, IDateRangeQuery, IFieldConditionsQuery, IPagableQuery, ISearchQuery, IAggregationQuery, IFieldIncludesQuery, ISortableQuery, IParentQuery, IChildQuery, ISoftDeletesQuery { public ISet<string> Ids { get; } = new HashSet<string>(); public ISet<string> ExcludedIds { get; } = new HashSet<string>(); public string CacheKey { get; set; } public TimeSpan? ExpiresIn { get; set; } public DateTime? ExpiresAt { get; set; } public ICollection<DateRange> DateRanges { get; } = new List<DateRange>(); public ICollection<FieldCondition> FieldConditions { get; } = new List<FieldCondition>(); public IRepositoryQuery SystemFilter { get; set; } public string Filter { get; set; } public string Criteria { get; set; } public SearchOperator DefaultCriteriaOperator { get; set; } public ICollection<Field> FieldIncludes { get; } = new List<Field>(); public ICollection<Field> FieldExcludes { get; } = new List<Field>(); public ICollection<IFieldSort> SortFields { get; } = new List<IFieldSort>(); public string Sort { get; set; } public bool SortByScore { get; set; } public string Aggregations { get; set; } public IRepositoryQuery ParentQuery { get; set; } public ITypeQuery ChildQuery { get; set; } public SoftDeleteQueryMode? SoftDeleteMode { get; set; } public IPagingOptions Options { get; set; } } }
apache-2.0
C#
0504fbd23e7fd9794f239dbeac5cc6f96dbd565d
Clear notification on change in textbox text
dukemiller/twitch-tv-viewer
twitch-tv-viewer/ViewModels/Components/MessageDisplayViewModel.cs
twitch-tv-viewer/ViewModels/Components/MessageDisplayViewModel.cs
using GalaSoft.MvvmLight; namespace twitch_tv_viewer.ViewModels.Components { internal class MessageDisplayViewModel : ViewModelBase { private string _message; public string Message { get { return _message; } set { _message = value; RaisePropertyChanged(); MessengerInstance.Send(new NotificationMessage()); } } } }
using GalaSoft.MvvmLight; namespace twitch_tv_viewer.ViewModels.Components { internal class MessageDisplayViewModel : ViewModelBase { private string _message; public string Message { get { return _message; } set { _message = value; RaisePropertyChanged(); } } } }
mit
C#
8096173ad535c17ad977d3887320f207b43fa943
Make ReportRun.SucceededAt nullable (#1824)
stripe/stripe-dotnet
src/Stripe.net/Entities/Reporting/ReportRuns/ReportRun.cs
src/Stripe.net/Entities/Reporting/ReportRuns/ReportRun.cs
namespace Stripe.Reporting { using System; using System.Collections.Generic; using Newtonsoft.Json; using Stripe.Infrastructure; public class ReportRun : StripeEntity<ReportRun>, IHasId, IHasObject { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("object")] public string Object { get; set; } [JsonProperty("created")] [JsonConverter(typeof(DateTimeConverter))] public DateTime Created { get; set; } [JsonProperty("error")] public string Error { get; set; } [JsonProperty("livemode")] public bool Livemode { get; set; } [JsonProperty("parameters")] public Parameters Parameters { get; set; } [JsonProperty("report_type")] public string ReportType { get; set; } [JsonProperty("result")] public File Result { get; set; } [JsonProperty("status")] public string Status { get; set; } [JsonProperty("succeeded_at")] [JsonConverter(typeof(DateTimeConverter))] public DateTime? SucceededAt { get; set; } } }
namespace Stripe.Reporting { using System; using System.Collections.Generic; using Newtonsoft.Json; using Stripe.Infrastructure; public class ReportRun : StripeEntity<ReportRun>, IHasId, IHasObject { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("object")] public string Object { get; set; } [JsonProperty("created")] [JsonConverter(typeof(DateTimeConverter))] public DateTime Created { get; set; } [JsonProperty("error")] public string Error { get; set; } [JsonProperty("livemode")] public bool Livemode { get; set; } [JsonProperty("parameters")] public Parameters Parameters { get; set; } [JsonProperty("report_type")] public string ReportType { get; set; } [JsonProperty("result")] public File Result { get; set; } [JsonProperty("status")] public string Status { get; set; } [JsonProperty("succeeded_at")] [JsonConverter(typeof(DateTimeConverter))] public DateTime SucceededAt { get; set; } } }
apache-2.0
C#
b55c3dcce8ba8eb026bfb67e621b5f468b134363
Update AzureNotificationHubs.cs
jorisbrauns/Cordova-Azure-Notificationhubs,jorisbrauns/Cordova-Azure-Notificationhubs,jorisbrauns/Cordova-Azure-Notificationhubs
src/windows/AzureNotificationHubs/AzureNotificationHubs.cs
src/windows/AzureNotificationHubs/AzureNotificationHubs.cs
using System; using Windows.Networking.PushNotifications; using Microsoft.WindowsAzure.Messaging; using Windows.Foundation; using System.Threading.Tasks; namespace AzureNotificationHubs { public sealed class AzureNotificationHubs { private static TaskCompletionSource<string> completionSource = new TaskCompletionSource<string>(); // Public api entrypoint public static IAsyncOperation<string> register(string hubname, string connectionString) { return RegisterNotificationHubs(hubname, connectionString).AsAsyncOperation(); } private static async Task<string> RegisterNotificationHubs(string hubname, string connectionString) { completionSource = new TaskCompletionSource<string>(); RegisterHub(hubname, connectionString); return await completionSource.Task; } private static async void RegisterHub(string hubname, string connectionString) { var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var hub = new NotificationHub(hubname, connectionString); var result = await hub.RegisterNativeAsync(channel.Uri); // Displays the registration ID so you know it was successful if (result.RegistrationId != null) { completionSource.SetResult(result.RegistrationId); } else { completionSource.SetResult("RegistrationId is null"); } } } }
using System; using Windows.Networking.PushNotifications; using Microsoft.WindowsAzure.Messaging; using Windows.Foundation; using System.Threading.Tasks; namespace AzureNotificationHubs { public sealed class AzureNotificationHubs { private static TaskCompletionSource<string> completionSource = new TaskCompletionSource<string>(); public static IAsyncOperation<string> register(string hubname, string connectionString) { return RegisterNotificationHub(hubname, connectionString).AsAsyncOperation(); } private static async Task<string> RegisterNotificationHub(string hubname, string connectionString) { completionSource = new TaskCompletionSource<string>(); RegisterHub(hubname, connectionString); return await completionSource.Task; } private static async void RegisterHub(string hubname, string connectionString) { var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var hub = new NotificationHub(hubname, connectionString); var result = await hub.RegisterNativeAsync(channel.Uri); // Displays the registration ID so you know it was successful if (result.RegistrationId != null) { completionSource.SetResult(result.RegistrationId); } else { completionSource.SetResult("RegistrationId is null"); } } } }
mit
C#
a419c9bd9a6d8f0b3f0125fb6ae2ab639dc2a5ac
Add extra code.
sgetaz/Cosmos,trivalik/Cosmos,MyvarHD/Cosmos,kant2002/Cosmos-1,fanoI/Cosmos,zarlo/Cosmos,zdimension/Cosmos,MyvarHD/Cosmos,Cyber4/Cosmos,fanoI/Cosmos,CosmosOS/Cosmos,sgetaz/Cosmos,zarlo/Cosmos,MyvarHD/Cosmos,MetSystem/Cosmos,sgetaz/Cosmos,trivalik/Cosmos,Cyber4/Cosmos,MetSystem/Cosmos,zdimension/Cosmos,Cyber4/Cosmos,jp2masa/Cosmos,sgetaz/Cosmos,CosmosOS/Cosmos,zhangwenquan/Cosmos,CosmosOS/Cosmos,zdimension/Cosmos,tgiphil/Cosmos,zhangwenquan/Cosmos,Cyber4/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,jp2masa/Cosmos,zhangwenquan/Cosmos,zdimension/Cosmos,kant2002/Cosmos-1,kant2002/Cosmos-1,zdimension/Cosmos,MetSystem/Cosmos,CosmosOS/Cosmos,fanoI/Cosmos,jp2masa/Cosmos,kant2002/Cosmos-1,zarlo/Cosmos,zhangwenquan/Cosmos,zhangwenquan/Cosmos,tgiphil/Cosmos,MetSystem/Cosmos,sgetaz/Cosmos,trivalik/Cosmos,Cyber4/Cosmos,MyvarHD/Cosmos,MetSystem/Cosmos,MyvarHD/Cosmos
Users/Sentinel/SentinelKernel/Kernel.cs
Users/Sentinel/SentinelKernel/Kernel.cs
using System; using System.Collections.Generic; using System.Text; using System.IO; using SentinelKernel.System.FileSystem.VFS; using Sys = Cosmos.System; namespace SentinelKernel { public class Kernel : Sys.Kernel { private VFSBase myVFS; protected override void BeforeRun() { Console.WriteLine("Cosmos booted successfully."); myVFS = new SentinelVFS(); VFSManager.RegisterVFS(myVFS); } protected override void Run() { Console.WriteLine("Run"); bool xTest = Directory.Exists("0:\\test"); Console.WriteLine("After test"); if (xTest) { Console.WriteLine("Folder exists!"); } else { Console.WriteLine("Folder does not exist!"); } Stop(); } } }
using System; using System.Collections.Generic; using System.Text; using System.IO; using SentinelKernel.System.FileSystem.VFS; using Sys = Cosmos.System; namespace SentinelKernel { public class Kernel : Sys.Kernel { private VFSBase myVFS; protected override void BeforeRun() { Console.WriteLine("Cosmos booted successfully."); myVFS = new SentinelVFS(); VFSManager.RegisterVFS(myVFS); } protected override void Run() { bool xTest = Directory.Exists("0:\\test"); Stop(); } } }
bsd-3-clause
C#
7478f816d7da0a581cf63d9885e59f1fc35f5af0
Fix failing integration test
AnthonySteele/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,gregsochanik/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,danhaller/SevenDigital.Api.Wrapper
src/SevenDigital.Api.Wrapper.Integration.Tests/EndpointTests/StatusTests.cs
src/SevenDigital.Api.Wrapper.Integration.Tests/EndpointTests/StatusTests.cs
using System; using System.Xml.Serialization; using NUnit.Framework; using SevenDigital.Api.Schema; namespace SevenDigital.Api.Wrapper.Integration.Tests.EndpointTests { [XmlRoot("response")] public class RawStatusResponse { [XmlElement("serviceStatus")] public Status ServiceStatus { get; set; } } [TestFixture] public class StatusTests { [Test] public async void Can_hit_endpoint() { var status = await Api<Status>.Create.Please(); Assert.That(status, Is.Not.Null); Assert.That(status.ServerTime.Day, Is.EqualTo(DateTime.Now.Day)); } [Test] public async void TestStatusResponseAs() { var statusResponse = await Api<Status>.Create.ResponseAs<RawStatusResponse>(); Assert.That(statusResponse, Is.Not.Null); Assert.That(statusResponse.ServiceStatus, Is.Not.Null); Assert.That(statusResponse.ServiceStatus.ServerTime.Day, Is.EqualTo(DateTime.Now.Day)); } } }
using System; using System.Xml.Serialization; using NUnit.Framework; using SevenDigital.Api.Schema; namespace SevenDigital.Api.Wrapper.Integration.Tests.EndpointTests { [XmlRoot("response")] public class RawStatusResponse { public Status Status { get; set; } } [TestFixture] public class StatusTests { [Test] public async void Can_hit_endpoint() { var status = await Api<Status>.Create.Please(); Assert.That(status, Is.Not.Null); Assert.That(status.ServerTime.Day, Is.EqualTo(DateTime.Now.Day)); } [Test] public async void TestStatusResponseAs() { var statusResponse = await Api<Status>.Create.ResponseAs<RawStatusResponse>(); Assert.That(statusResponse, Is.Not.Null); Assert.That(statusResponse.Status, Is.Not.Null); Assert.That(statusResponse.Status.ServerTime.Day, Is.EqualTo(DateTime.Now.Day)); } } }
mit
C#
1598ee92dddbd5463671f7c2cbc3359822411ba1
Fix report name
danielwertheim/mynatsclient,danielwertheim/mynatsclient
src/SampleModel/TimedInfo.cs
src/SampleModel/TimedInfo.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace SampleModel { public static class TimedInfo { public static void Report(string who, List<double> timings, int batchSize, int bodySize) { using (var file = File.CreateText($@"D:\Temp\rep-{who}-{DateTime.Now.ToString("yyyy-MM-dd-hhmmss")}.txt")) { Action<string> output = s => { Console.WriteLine(s); file.WriteLine(s); }; output("===== RESULT ====="); output("BatchSize: " + batchSize); output("BodySize: " + bodySize); var average = timings.Average(); var averagePerMess = average/batchSize; var averagePerByte = averagePerMess/bodySize; var averagePerMb = averagePerByte*1000000; timings.ForEach(t => output($"{t}ms")); output($"Avg ms per batch\t{average}"); output($"Avg ms per mess\t{averagePerMess}"); output($"Avg ms per byte\t{averagePerByte}"); output($"Avg ms per mb\t{averagePerMb}"); timings.Sort(); var avgExcLowHigh = timings.Skip(1).Take(timings.Count - 1).Average(); var avgExcLowHighPerMess = avgExcLowHigh/batchSize; var avgExcLowHighPerByte = avgExcLowHighPerMess/bodySize; var avgExcLowHighPerMb = avgExcLowHighPerByte*1000000; output($"Avg ms per batch (excluding lowest & highest)\t{avgExcLowHigh}"); output($"Avg ms per mess (excluding lowest & highest)\t{avgExcLowHighPerMess}"); output($"Avg ms per byte (excluding lowest & highest)\t{avgExcLowHighPerByte}"); output($"Avg ms per mb (excluding lowest & highest)\t{avgExcLowHighPerMb}"); file.Flush(); } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace SampleModel { public static class TimedInfo { public static void Report(string who, List<double> timings, int batchSize, int bodySize) { using (var file = File.CreateText($@"D:\Temp\rep-{who}-{DateTime.Now.ToString("yyyy-MM-dd-hhmm")}.txt")) { Action<string> output = s => { Console.WriteLine(s); file.WriteLine(s); }; output("===== RESULT ====="); output("BatchSize: " + batchSize); output("BodySize: " + bodySize); var average = timings.Average(); var averagePerMess = average/batchSize; var averagePerByte = averagePerMess/bodySize; var averagePerMb = averagePerByte*1000000; timings.ForEach(t => output($"{t}ms")); output($"Avg ms per batch\t{average}"); output($"Avg ms per mess\t{averagePerMess}"); output($"Avg ms per byte\t{averagePerByte}"); output($"Avg ms per mb\t{averagePerMb}"); timings.Sort(); var avgExcLowHigh = timings.Skip(1).Take(timings.Count - 1).Average(); var avgExcLowHighPerMess = avgExcLowHigh/batchSize; var avgExcLowHighPerByte = avgExcLowHighPerMess/bodySize; var avgExcLowHighPerMb = avgExcLowHighPerByte*1000000; output($"Avg ms per batch (excluding lowest & highest)\t{avgExcLowHigh}"); output($"Avg ms per mess (excluding lowest & highest)\t{avgExcLowHighPerMess}"); output($"Avg ms per byte (excluding lowest & highest)\t{avgExcLowHighPerByte}"); output($"Avg ms per mb (excluding lowest & highest)\t{avgExcLowHighPerMb}"); file.Flush(); } } } }
mit
C#
c2809add4c3a227c04509ffb8fc721c9e8d5bf76
Correct default serialization strategy to `Default`
jacobdufault/fullserializer,lazlo-bonin/fullserializer,jagt/fullserializer,jagt/fullserializer,karlgluck/fullserializer,Ksubaka/fullserializer,shadowmint/fullserializer,jagt/fullserializer,jacobdufault/fullserializer,Ksubaka/fullserializer,shadowmint/fullserializer,shadowmint/fullserializer,darress/fullserializer,jacobdufault/fullserializer,nuverian/fullserializer,zodsoft/fullserializer,Ksubaka/fullserializer,caiguihou/myprj_02
Source/fsConfig.cs
Source/fsConfig.cs
using System; using UnityEngine; namespace FullSerializer { /// <summary> /// Enables some top-level customization of Full Serializer. /// </summary> public static class fsConfig { /// <summary> /// The attributes that will force a field or property to be serialized. /// </summary> public static Type[] SerializeAttributes = new[] { typeof(SerializeField), typeof(fsPropertyAttribute) }; /// <summary> /// The attributes that will force a field or property to *not* be serialized. /// </summary> public static Type[] IgnoreSerializeAttributes = new[] { typeof(NonSerializedAttribute), typeof(fsIgnoreAttribute) }; /// <summary> /// The default member serialization. /// </summary> public static fsMemberSerialization DefaultMemberSerialization { get { return _defaultMemberSerialization; } set { _defaultMemberSerialization = value; fsMetaType.ClearCache(); } } private static fsMemberSerialization _defaultMemberSerialization = fsMemberSerialization.Default; } }
using System; using UnityEngine; namespace FullSerializer { /// <summary> /// Enables some top-level customization of Full Serializer. /// </summary> public static class fsConfig { /// <summary> /// The attributes that will force a field or property to be serialized. /// </summary> public static Type[] SerializeAttributes = new[] { typeof(SerializeField), typeof(fsPropertyAttribute) }; /// <summary> /// The attributes that will force a field or property to *not* be serialized. /// </summary> public static Type[] IgnoreSerializeAttributes = new[] { typeof(NonSerializedAttribute), typeof(fsIgnoreAttribute) }; /// <summary> /// The default member serialization. /// </summary> public static fsMemberSerialization DefaultMemberSerialization { get { return _defaultMemberSerialization; } set { _defaultMemberSerialization = value; fsMetaType.ClearCache(); } } private static fsMemberSerialization _defaultMemberSerialization = fsMemberSerialization.OptOut; } }
mit
C#
766d5f18ca335b2ef33bc1ab189f146e9152e0f0
排除与makai分支的不同特性。
herix001/ElectronicObserver,CNA-Bld/ElectronicObserver,tsanie/ElectronicObserver,Arathi/ElectronicObserver,kanonmelodis/ElectronicObserver
ElectronicObserver/Properties/AssemblyInfo.cs
ElectronicObserver/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle( "ElectronicObserver" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "ElectronicObserver" )] [assembly: AssemblyCopyright( "Copyright © 2014 Andante" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible( false )] // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid( "bee10a07-cace-44fe-8a74-53ae44d224c2" )] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // Major Version // Minor Version // Build Number // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.2.0")] [assembly: AssemblyFileVersion("1.4.2.0")] [assembly: AssemblyInformationalVersion("1.4.2.0.net40")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle( "ElectronicObserver" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "ElectronicObserver" )] [assembly: AssemblyCopyright( "Copyright © 2014 Andante" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible( false )] // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid( "bee10a07-cace-44fe-8a74-53ae44d224c2" )] // アセンブリのバージョン情報は、以下の 4 つの値で構成されています: // // Major Version // Minor Version // Build Number // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0.0.net40")]
mit
C#
f0a4137ee89c0ec35000d16d58f62c1bbd459c66
Fix agreement view
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Web/Views/EmployerAgreement/View.cshtml
src/SFA.DAS.EAS.Web/Views/EmployerAgreement/View.cshtml
@using SFA.DAS.EAS.Domain @using SFA.DAS.EAS.Domain.Models.EmployerAgreement @using SFA.DAS.EAS.Web; @using SFA.DAS.EAS.Web.Extensions @model OrchestratorResponse<SFA.DAS.EAS.Web.ViewModels.EmployerAgreementViewModel> @{ViewBag.Title = "Employer agreement";} <div class="grid-row"> <div class="column-two-thirds"> <h1 class="heading-xlarge">Employer agreement</h1> <h2 class="heading-large">@Model.Data.EmployerAgreement.LegalEntityName</h2> <h3>@Model.Data.EmployerAgreement.LegalEntityAddress</h3> <p>@Html.Raw(Model.Data.EmployerAgreement.TemplatePartialViewName)</p> </div> </div> @section breadcrumb { <div class="breadcrumbs"> <ol role="navigation"> <li><a href="@Url.Action("Index", "EmployerTeam")">Home</a></li> <li><a href="@Url.Action("Index", "EmployerAgreement")">Your organisations and agreements</a></li> <li>Employer agreement</li> </ol> </div> }
@using SFA.DAS.EAS.Domain @using SFA.DAS.EAS.Domain.Models.EmployerAgreement @using SFA.DAS.EAS.Web; @using SFA.DAS.EAS.Web.Extensions @model OrchestratorResponse<SFA.DAS.EAS.Web.ViewModels.EmployerAgreementViewModel> @{ViewBag.Title = "Employer agreement";} <div class="grid-row"> <div class="column-two-thirds"> <h1 class="heading-xlarge">Employer agreement</h1> <h2 class="heading-large">@Model.Data.EmployerAgreement.LegalEntityName</h2> <h3>@Model.Data.EmployerAgreement.LegalEntityAddress</h3> <p>@Html.Raw(Model.Data.EmployerAgreement.TemplateText)</p> </div> </div> @section breadcrumb { <div class="breadcrumbs"> <ol role="navigation"> <li><a href="@Url.Action("Index", "EmployerTeam")">Home</a></li> <li><a href="@Url.Action("Index", "EmployerAgreement")">Your organisations and agreements</a></li> <li>Employer agreement</li> </ol> </div> }
mit
C#
7d92d12db6d8bf2adb6f08b794c9adfac1df5066
add cmd arg key on param
ufcpp/UnityTools
CopyDllsAfterBuildLocalTools/CopyDllsAfterBuildLocalTools/Program.cs
CopyDllsAfterBuildLocalTools/CopyDllsAfterBuildLocalTools/Program.cs
using Cocona; using System; using System.IO; namespace CopyDllsAfterBuild { partial class Program { private static readonly ILogger logger = Logger.Instance; static void Main(string[] args) => CoconaLiteApp.Run<Program>(args); /// <summary> /// Run CopyDlls operation. /// </summary> /// <param name="projectDir">--project-dir. Project Root directory. Should be $(ProjectDir)</param> /// <param name="targetDir">--target-dir. Project Build output directory. Should be $(TargetDir)</param> /// <param name="settingFile">--setting-file. JSON file to specify settings. Make sure file is UTF8.</param> public void Run(string projectDir, string targetDir, string settingFile = "CopySettings.json") { try { var trimedProjectDir = projectDir.TrimStart('"').TrimEnd('"'); var trimedTargetdir = targetDir.TrimStart('"').TrimEnd('"'); var build = new PostBuild(trimedProjectDir); var settings = build.GetSettings(settingFile); var excludes = build.GetExcludes(settings.Excludes!, settings.ExcludeFolders!); var dllPath = Path.Combine(trimedProjectDir, settings.Destination!); build.CopyDlls(trimedTargetdir, dllPath, settings.Pattern, excludes); } catch (Exception ex) { logger.LogCritical($"{ex.Message} {ex.GetType().FullName} {ex.StackTrace}"); logger.LogInformation("Set COPYDLLS_LOGLEVEL=Debug or Trace to see more detail logs."); throw; } } } }
using Cocona; using System; using System.IO; namespace CopyDllsAfterBuild { partial class Program { private static readonly ILogger logger = Logger.Instance; static void Main(string[] args) => CoconaLiteApp.Run<Program>(args); /// <summary> /// Run CopyDlls operation. /// </summary> /// <param name="projectDir">Project Root directory. Should be $(ProjectDir)</param> /// <param name="targetDir">Project Build output directory. Should be $(TargetDir)</param> /// <param name="settingFile">JSON file to specify settings. Make sure file is UTF8.</param> public void Run(string projectDir, string targetDir, string settingFile = "CopySettings.json") { try { var trimedProjectDir = projectDir.TrimStart('"').TrimEnd('"'); var trimedTargetdir = targetDir.TrimStart('"').TrimEnd('"'); var build = new PostBuild(trimedProjectDir); var settings = build.GetSettings(settingFile); var excludes = build.GetExcludes(settings.Excludes!, settings.ExcludeFolders!); var dllPath = Path.Combine(trimedProjectDir, settings.Destination!); build.CopyDlls(trimedTargetdir, dllPath, settings.Pattern, excludes); } catch (Exception ex) { logger.LogCritical($"{ex.Message} {ex.GetType().FullName} {ex.StackTrace}"); logger.LogInformation("Set COPYDLLS_LOGLEVEL=Debug or Trace to see more detail logs."); throw; } } } }
mit
C#
963ff6c4cc1ffc0cb3748e6bb688470e3bba9d54
Improve argument exception message of scrobble post.
henrikfroehling/TraktApiSharp
Source/Lib/TraktApiSharp/Objects/Post/Scrobbles/TraktScrobblePost.cs
Source/Lib/TraktApiSharp/Objects/Post/Scrobbles/TraktScrobblePost.cs
namespace TraktApiSharp.Objects.Post.Scrobbles { using Newtonsoft.Json; using System; public abstract class TraktScrobblePost : IValidatable { [JsonProperty(PropertyName = "progress")] public float Progress { get; set; } [JsonProperty(PropertyName = "app_version")] public string AppVersion { get; set; } [JsonProperty(PropertyName = "app_date")] public string AppDate { get; set; } public void Validate() { if (Progress.CompareTo(0.0f) < 0 || Progress.CompareTo(100.0f) > 0) throw new ArgumentException("progress value not valid - value must be between 0 and 100"); } } }
namespace TraktApiSharp.Objects.Post.Scrobbles { using Newtonsoft.Json; using System; public abstract class TraktScrobblePost : IValidatable { [JsonProperty(PropertyName = "progress")] public float Progress { get; set; } [JsonProperty(PropertyName = "app_version")] public string AppVersion { get; set; } [JsonProperty(PropertyName = "app_date")] public string AppDate { get; set; } public void Validate() { if (Progress.CompareTo(0.0f) < 0) throw new ArgumentException("progress value not valid"); if (Progress.CompareTo(100.0f) > 0) throw new ArgumentException("progress value not valid"); } } }
mit
C#
bc7efa579898c3294d64ffb778bde93a2ea9a390
Update SaveInExcel2007xlsbFormat.cs
aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_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,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
Examples/CSharp/Files/Handling/SaveInExcel2007xlsbFormat.cs
Examples/CSharp/Files/Handling/SaveInExcel2007xlsbFormat.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Files.Handling { public class SaveInExcel2007xlsbFormat { 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); //Creating a Workbook object Workbook workbook = new Workbook(); //Save in Excel2007 xlsb format workbook.Save(dataDir + "book1.out.xlsb", SaveFormat.Xlsb); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Files.Handling { public class SaveInExcel2007xlsbFormat { public static void Main(string[] args) { //Save in Excel2007 xlsb format workbook.Save(dataDir + "book1.out.xlsb", SaveFormat.Xlsb); //ExEnd:1 } } }
mit
C#
a1a04a934b85f822980d10abe68896b079daf7ca
Update AssemblyInfo.cs
ms-iot/onedrive-connector,mwmckee/onedrive-connector
OnedriveRESTWrapper/OnedriveRESTWrapper/Properties/AssemblyInfo.cs
OnedriveRESTWrapper/OnedriveRESTWrapper/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("OneDriveConnector")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("OneDriveConnector")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 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")] [assembly: ComVisible(false)]
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("OnedriveRESTWrapper")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("OnedriveRESTWrapper")] [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 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")] [assembly: ComVisible(false)]
mit
C#
b29814ddcd383a93b877cbe0b457358f26d0c8d6
Update TestDbAsyncEnumerable.cs
dlidstrom/MinaGlosor,dlidstrom/MinaGlosor,dlidstrom/MinaGlosor
MinaGlosor.Test/Api/Infrastructure/TestDbAsyncEnumerable.cs
MinaGlosor.Test/Api/Infrastructure/TestDbAsyncEnumerable.cs
using System.Collections.Generic; using System.Data.Entity.Infrastructure; using System.Linq; using System.Linq.Expressions; namespace MinaGlosor.Test.Api.Infrastructure { internal class TestDbAsyncEnumerable<T> : EnumerableQuery<T>, IDbAsyncEnumerable<T>, IQueryable<T> { public TestDbAsyncEnumerable(IEnumerable<T> enumerable) : base(enumerable) { } public TestDbAsyncEnumerable(Expression expression) : base(expression) { } public IQueryProvider Provider { get { return new TestDbAsyncQueryProvider<T>(this); } } public IDbAsyncEnumerator<T> GetAsyncEnumerator() { return new TestDbAsyncEnumerator<T>(this.AsEnumerable().GetEnumerator()); } IDbAsyncEnumerator IDbAsyncEnumerable.GetAsyncEnumerator() { return GetAsyncEnumerator(); } } }
using System.Collections.Generic; using System.Data.Entity.Infrastructure; using System.Linq; using System.Linq.Expressions; namespace MinaGlosor.Test.Api.Infrastructure { internal class TestDbAsyncEnumerable<T> : EnumerableQuery<T>, IDbAsyncEnumerable<T> { public TestDbAsyncEnumerable(IEnumerable<T> enumerable) : base(enumerable) { } public TestDbAsyncEnumerable(Expression expression) : base(expression) { } public IQueryProvider Provider { get { return new TestDbAsyncQueryProvider<T>(this); } } public IDbAsyncEnumerator<T> GetAsyncEnumerator() { return new TestDbAsyncEnumerator<T>(this.AsEnumerable().GetEnumerator()); } IDbAsyncEnumerator IDbAsyncEnumerable.GetAsyncEnumerator() { return GetAsyncEnumerator(); } } }
mit
C#
e3d61e658ad186119c683cad5f64e06614712f55
Use default values in telemetry records if not available. (#2303)
Microsoft/vsts-agent,Microsoft/vsts-agent,Microsoft/vsts-agent,Microsoft/vsts-agent
src/Agent.Plugins/PipelineArtifact/Telemetry/PipelineTelemetryRecord.cs
src/Agent.Plugins/PipelineArtifact/Telemetry/PipelineTelemetryRecord.cs
using System; using Agent.Sdk; using Microsoft.TeamFoundation.DistributedTask.WebApi; using Microsoft.VisualStudio.Services.Content.Common.Telemetry; using Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry; using Microsoft.VisualStudio.Services.Common; namespace Agent.Plugins.PipelineArtifact.Telemetry { /// <summary> /// Generic telemetry record for use with Pipeline events. /// </summary> public abstract class PipelineTelemetryRecord : BlobStoreTelemetryRecord { public Guid PlanId { get; private set; } public Guid JobId { get; private set; } public Guid TaskInstanceId { get; private set; } public PipelineTelemetryRecord(TelemetryInformationLevel level, Uri baseAddress, string eventNamePrefix, string eventNameSuffix, AgentTaskPluginExecutionContext context, uint attemptNumber = 1) : base(level, baseAddress, eventNamePrefix, eventNameSuffix, attemptNumber) { PlanId = new Guid(context.Variables.GetValueOrDefault(WellKnownDistributedTaskVariables.PlanId)?.Value ?? Guid.Empty.ToString()); JobId = new Guid(context.Variables.GetValueOrDefault(WellKnownDistributedTaskVariables.JobId)?.Value ?? Guid.Empty.ToString()); TaskInstanceId = new Guid(context.Variables.GetValueOrDefault(WellKnownDistributedTaskVariables.TaskInstanceId)?.Value ?? Guid.Empty.ToString()); } } }
using System; using Agent.Sdk; using Microsoft.TeamFoundation.DistributedTask.WebApi; using Microsoft.VisualStudio.Services.Content.Common.Telemetry; using Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry; namespace Agent.Plugins.PipelineArtifact.Telemetry { /// <summary> /// Generic telemetry record for use with Pipeline events. /// </summary> public abstract class PipelineTelemetryRecord : BlobStoreTelemetryRecord { public Guid PlanId { get; private set; } public Guid JobId { get; private set; } public Guid TaskInstanceId { get; private set; } public PipelineTelemetryRecord(TelemetryInformationLevel level, Uri baseAddress, string eventNamePrefix, string eventNameSuffix, AgentTaskPluginExecutionContext context, uint attemptNumber = 1) : base(level, baseAddress, eventNamePrefix, eventNameSuffix, attemptNumber) { PlanId = Guid.Parse(context.Variables[WellKnownDistributedTaskVariables.PlanId].Value); JobId = Guid.Parse(context.Variables[WellKnownDistributedTaskVariables.JobId].Value); TaskInstanceId = Guid.Parse(context.Variables[WellKnownDistributedTaskVariables.TaskInstanceId].Value); } } }
mit
C#
4dad6823e381d0ca5a7512817af8cd10f2b8c97f
fix wrap with clause split
trenoncourt/AutoQueryable
src/AutoQueryable/Core/Clauses/ClauseHandlers/DefaultWrapWithClauseHandler.cs
src/AutoQueryable/Core/Clauses/ClauseHandlers/DefaultWrapWithClauseHandler.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using AutoQueryable.Core.Models; namespace AutoQueryable.Core.Clauses.ClauseHandlers { public class DefaultWrapWithClauseHandler : IWrapWithClauseHandler { public IEnumerable<string> Handle(string wrapWithQueryStringPart, Type type = default, IAutoQueryableProfile profile = null) { return wrapWithQueryStringPart.Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries).Select(s => s.ToLowerInvariant()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using AutoQueryable.Core.Models; namespace AutoQueryable.Core.Clauses.ClauseHandlers { public class DefaultWrapWithClauseHandler : IWrapWithClauseHandler { public IEnumerable<string> Handle(string wrapWithQueryStringPart, Type type = default, IAutoQueryableProfile profile = null) { return wrapWithQueryStringPart.Split(',').Select(s => s.ToLowerInvariant()); } } }
mit
C#
c4ff7f30dd537005c787c65c11c378b249cb769b
Update src/EditorFeatures/Core/EditorConfigSettings/Extensions/SolutionExtensions.cs
jasonmalinowski/roslyn,sharwell/roslyn,bartdesmet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,sharwell/roslyn,wvdd007/roslyn,dotnet/roslyn,wvdd007/roslyn,KevinRansom/roslyn,mavasani/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,weltkante/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,physhi/roslyn,eriawan/roslyn,AmadeusW/roslyn,eriawan/roslyn,KevinRansom/roslyn,physhi/roslyn,weltkante/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,eriawan/roslyn,physhi/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn
src/EditorFeatures/Core/EditorConfigSettings/Extensions/SolutionExtensions.cs
src/EditorFeatures/Core/EditorConfigSettings/Extensions/SolutionExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.IO; using System.Linq; using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Extensions { internal static class SolutionExtensions { public static ImmutableArray<Project> GetProjectsForPath(this Solution solution, string givenPath) { var givenFolder = new DirectoryInfo(Path.GetDirectoryName(givenPath)); var solutionFolder = new DirectoryInfo(solution.FilePath).Parent; if (givenFolder.FullName == solutionFolder.FullName) { return solution.Projects.ToImmutableArray(); } var builder = ArrayBuilder<Project>.GetInstance(); foreach (var (projectDirectoryPath, project) in solution.Projects.Select(p => (new DirectoryInfo(p.FilePath).Parent, p))) { if (ContainsPath(givenFolder, projectDirectoryPath)) { builder.Add(project); } } return builder.ToImmutableAndFree(); static bool ContainsPath(DirectoryInfo givenPath, DirectoryInfo projectPath) { if (projectPath.FullName == givenPath.FullName) { return true; } while (projectPath.Parent is not null) { if (projectPath.Parent.FullName == givenPath.FullName) { return true; } projectPath = projectPath.Parent; } return false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.IO; using System.Linq; using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Extensions { internal static class SolutionExtensions { public static ImmutableArray<Project> GetProjectsForPath(this Solution solution, string givenPath) { var givenFolder = new DirectoryInfo(givenPath).Parent; var solutionFolder = new DirectoryInfo(solution.FilePath).Parent; if (givenFolder.FullName == solutionFolder.FullName) { return solution.Projects.ToImmutableArray(); } var builder = ArrayBuilder<Project>.GetInstance(); foreach (var (projectDirectoryPath, project) in solution.Projects.Select(p => (new DirectoryInfo(p.FilePath).Parent, p))) { if (ContainsPath(givenFolder, projectDirectoryPath)) { builder.Add(project); } } return builder.ToImmutableAndFree(); static bool ContainsPath(DirectoryInfo givenPath, DirectoryInfo projectPath) { if (projectPath.FullName == givenPath.FullName) { return true; } while (projectPath.Parent is not null) { if (projectPath.Parent.FullName == givenPath.FullName) { return true; } projectPath = projectPath.Parent; } return false; } } } }
mit
C#
7d7b3336b8d3a9e389c1221cce9059a8b864f95b
Make PrintPreviewPage a class
DotNetKit/DotNetKit.Wpf.Printing
DotNetKit.Wpf.Printing.Demo/Printing/PrintPreviewPage.cs
DotNetKit.Wpf.Printing.Demo/Printing/PrintPreviewPage.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace DotNetKit.Wpf.Printing.Demo.Printing { public sealed class PrintPreviewPage { public object Content { get; } public Size PageSize { get; } public PrintPreviewPage(object content, Size pageSize) { Content = content; PageSize = pageSize; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace DotNetKit.Wpf.Printing.Demo.Printing { public struct PrintPreviewPage { public object Content { get; } public Size PageSize { get; } public PrintPreviewPage(object content, Size pageSize) { Content = content; PageSize = pageSize; } } }
mit
C#
a13522deaca0ca9bdbf6531c59207f253be1e230
Update ObjectPostAndDelete.cs
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Test/NakedObjects.Rest.Test.EndToEnd/ObjectPostAndDelete.cs
Test/NakedObjects.Rest.Test.EndToEnd/ObjectPostAndDelete.cs
// Copyright © Naked Objects Group Ltd ( http://www.nakedobjects.net). // All Rights Reserved. This code released under the terms of the // Microsoft Public License (MS-PL) ( http://opensource.org/licenses/ms-pl.html) using Microsoft.VisualStudio.TestTools.UnitTesting; namespace RestfulObjects.Test.EndToEnd { [TestClass] public class ObjectPostAndDelete { #region Helpers private const string objectsUrl = @"http://nakedobjectsrotest.azurewebsites.net/objects/"; #endregion [TestMethod] public void AttemptPost() { Helpers.TestResponse(objectsUrl + @"RestfulObjects.Test.Data.MostSimple/1", null, JsonRep.Empty(), Methods.Post, Codes.MethodNotValid); } [TestMethod] public void AttemptDelete() { Helpers.TestResponse(objectsUrl + @"RestfulObjects.Test.Data.MostSimple/1", null, null, Methods.Delete, Codes.MethodNotValid); } } }
// Copyright © Naked Objects Group Ltd ( http://www.nakedobjects.net). // All Rights Reserved. This code released under the terms of the // Microsoft Public License (MS-PL) ( http://opensource.org/licenses/ms-pl.html) using Microsoft.VisualStudio.TestTools.UnitTesting; namespace RestfulObjects.Test.EndToEnd { [TestClass] public class ObjectPostAndDelete { #region Helpers private const string objectsUrl = @"http://nakedobjectsrotest.azurewebsites.net/objects/"; #endregion [TestMethod] [Ignore] // if not protopersistent this is now a valid method public void AttemptPost() { Helpers.TestResponse(objectsUrl + @"RestfulObjects.Test.Data.MostSimple/1", null, JsonRep.Empty(), Methods.Post, Codes.MethodNotValid); } [TestMethod] public void AttemptDelete() { Helpers.TestResponse(objectsUrl + @"RestfulObjects.Test.Data.MostSimple/1", null, null, Methods.Delete, Codes.MethodNotValid); } } }
apache-2.0
C#
0c64d81da903e62f5607d532e42adb2767ac3a35
Add default request header to Payments API httpClient to look for version 2. Since removing the SecureHttpClient from PaymentEventsApiClient this header was lost. This only matters for data locks as that is the only controller action split by api version at present
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
src/SFA.DAS.CommitmentPayments.WebJob/DependencyResolution/PaymentsRegistry.cs
src/SFA.DAS.CommitmentPayments.WebJob/DependencyResolution/PaymentsRegistry.cs
using System.Net.Http; using SFA.DAS.CommitmentPayments.WebJob.Configuration; using SFA.DAS.Http; using SFA.DAS.Http.TokenGenerators; using SFA.DAS.NLog.Logger.Web.MessageHandlers; using SFA.DAS.Provider.Events.Api.Client; using SFA.DAS.Provider.Events.Api.Client.Configuration; using StructureMap; namespace SFA.DAS.CommitmentPayments.WebJob.DependencyResolution { internal class PaymentsRegistry : Registry { public PaymentsRegistry() { For<PaymentEventsApi>().Use(c => c.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi); For<IPaymentsEventsApiConfiguration>().Use(c => c.GetInstance<PaymentEventsApi>()); For<IPaymentsEventsApiClient>().Use<PaymentsEventsApiClient>().Ctor<HttpClient>().Is(c => CreateClient(c)); } private HttpClient CreateClient(IContext context) { var config = context.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi; HttpClient httpClient = new HttpClientBuilder() .WithBearerAuthorisationHeader(new AzureActiveDirectoryBearerTokenGenerator(config)) .WithHandler(new RequestIdMessageRequestHandler()) .WithHandler(new SessionIdMessageRequestHandler()) .WithDefaultHeaders() .Build(); httpClient.DefaultRequestHeaders.Add("api-version", "2"); return httpClient; } } }
using System.Net.Http; using SFA.DAS.CommitmentPayments.WebJob.Configuration; using SFA.DAS.Http; using SFA.DAS.Http.TokenGenerators; using SFA.DAS.NLog.Logger.Web.MessageHandlers; using SFA.DAS.Provider.Events.Api.Client; using SFA.DAS.Provider.Events.Api.Client.Configuration; using StructureMap; namespace SFA.DAS.CommitmentPayments.WebJob.DependencyResolution { internal class PaymentsRegistry : Registry { public PaymentsRegistry() { For<PaymentEventsApi>().Use(c => c.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi); For<IPaymentsEventsApiConfiguration>().Use(c => c.GetInstance<PaymentEventsApi>()); For<IPaymentsEventsApiClient>().Use<PaymentsEventsApiClient>().Ctor<HttpClient>().Is(c => CreateClient(c)); } private HttpClient CreateClient(IContext context) { var config = context.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi; HttpClient httpClient = new HttpClientBuilder() .WithBearerAuthorisationHeader(new AzureActiveDirectoryBearerTokenGenerator(config)) .WithHandler(new RequestIdMessageRequestHandler()) .WithHandler(new SessionIdMessageRequestHandler()) .WithDefaultHeaders() .Build(); return httpClient; } } }
mit
C#
43e68480eb922e7e9b099abbc79342239f81b56b
tidy up formatting
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Portal/Application/Services/Commitments/ICommitmentsService.cs
src/SFA.DAS.EAS.Portal/Application/Services/Commitments/ICommitmentsService.cs
using System.Threading; using System.Threading.Tasks; using SFA.DAS.Commitments.Api.Types.Commitment; namespace SFA.DAS.EAS.Portal.Application.Services.Commitments { public interface ICommitmentsService { Task<CommitmentView> GetProviderCommitment( long providerId, long commitmentId, CancellationToken cancellationToken = default); } }
using System.Threading; using System.Threading.Tasks; using SFA.DAS.Commitments.Api.Types.Commitment; namespace SFA.DAS.EAS.Portal.Application.Services.Commitments { public interface ICommitmentsService { Task<CommitmentView> GetProviderCommitment(long providerId, long commitmentId, CancellationToken cancellationToken = default); } }
mit
C#
ea95640eb7ee0dfcd07400d089e1c90be5667519
Remove leftover using
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Tests/UnitTests/Crypto/StringCipherTests.cs
WalletWasabi.Tests/UnitTests/Crypto/StringCipherTests.cs
using NBitcoin; using System; using System.Security.Cryptography; using System.Text; using WalletWasabi.Crypto; using WalletWasabi.Logging; using WalletWasabi.Tests.XunitConfiguration; using Xunit; namespace WalletWasabi.Tests.UnitTests.Crypto { public class StringCipherTests { [Fact] public void CipherTests() { var toEncrypt = "hello"; var password = "password"; var encypted = StringCipher.Encrypt(toEncrypt, password); Assert.NotEqual(toEncrypt, encypted); var decrypted = StringCipher.Decrypt(encypted, password); Assert.Equal(toEncrypt, decrypted); var builder = new StringBuilder(); for (int i = 0; i < 1000000; i++) // check 10MB { builder.Append("0123456789"); } toEncrypt = builder.ToString(); encypted = StringCipher.Encrypt(toEncrypt, password); Assert.NotEqual(toEncrypt, encypted); decrypted = StringCipher.Decrypt(encypted, password); Assert.Equal(toEncrypt, decrypted); toEncrypt = "foo@éóüö"; password = ""; encypted = StringCipher.Encrypt(toEncrypt, password); Assert.NotEqual(toEncrypt, encypted); decrypted = StringCipher.Decrypt(encypted, password); Assert.Equal(toEncrypt, decrypted); Logger.TurnOff(); Assert.Throws<CryptographicException>(() => StringCipher.Decrypt(encypted, "wrongpassword")); Logger.TurnOn(); } [Fact] public void AuthenticateMessageTest() { var count = 0; var errorCount = 0; while (count < 3) { var password = "password"; var plainText = "juan carlos"; var encypted = StringCipher.Encrypt(plainText, password); try { // This must fail because the password is wrong var t = StringCipher.Decrypt(encypted, "WRONG-PASSWORD"); errorCount++; } catch (CryptographicException ex) { Assert.StartsWith("Message Authentication failed", ex.Message); } count++; } var rate = errorCount / (double)count; Assert.True(rate < 0.000001 && rate > -0.000001); } } }
using NBitcoin; using System; using System.Security.Cryptography; using System.Text; using WalletWasabi.Crypto; using WalletWasabi.Logging; using WalletWasabi.Tests.XunitConfiguration; using Xunit; using static WalletWasabi.Crypto.SchnorrBlinding; namespace WalletWasabi.Tests.UnitTests.Crypto { public class StringCipherTests { [Fact] public void CipherTests() { var toEncrypt = "hello"; var password = "password"; var encypted = StringCipher.Encrypt(toEncrypt, password); Assert.NotEqual(toEncrypt, encypted); var decrypted = StringCipher.Decrypt(encypted, password); Assert.Equal(toEncrypt, decrypted); var builder = new StringBuilder(); for (int i = 0; i < 1000000; i++) // check 10MB { builder.Append("0123456789"); } toEncrypt = builder.ToString(); encypted = StringCipher.Encrypt(toEncrypt, password); Assert.NotEqual(toEncrypt, encypted); decrypted = StringCipher.Decrypt(encypted, password); Assert.Equal(toEncrypt, decrypted); toEncrypt = "foo@éóüö"; password = ""; encypted = StringCipher.Encrypt(toEncrypt, password); Assert.NotEqual(toEncrypt, encypted); decrypted = StringCipher.Decrypt(encypted, password); Assert.Equal(toEncrypt, decrypted); Logger.TurnOff(); Assert.Throws<CryptographicException>(() => StringCipher.Decrypt(encypted, "wrongpassword")); Logger.TurnOn(); } [Fact] public void AuthenticateMessageTest() { var count = 0; var errorCount = 0; while (count < 3) { var password = "password"; var plainText = "juan carlos"; var encypted = StringCipher.Encrypt(plainText, password); try { // This must fail because the password is wrong var t = StringCipher.Decrypt(encypted, "WRONG-PASSWORD"); errorCount++; } catch (CryptographicException ex) { Assert.StartsWith("Message Authentication failed", ex.Message); } count++; } var rate = errorCount / (double)count; Assert.True(rate < 0.000001 && rate > -0.000001); } } }
mit
C#
eb7778807fc93c75b1527953251c9d00ed3d43c4
Rename value to statusText for clarity
unlimitedbacon/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,mmoening/MatterControl,jlewin/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl
PartPreviewWindow/View3D/SliceProgressReporter.cs
PartPreviewWindow/View3D/SliceProgressReporter.cs
/* Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System; using System.Diagnostics; using MatterHackers.GCodeVisualizer; using MatterHackers.Agg; namespace MatterHackers.MatterControl.PartPreviewWindow { public class SliceProgressReporter : IProgress<ProgressStatus> { private double currentValue = 0; private double destValue = 10; private IProgress<ProgressStatus> parentProgress; private PrinterConfig printer; private Stopwatch timer = Stopwatch.StartNew(); public SliceProgressReporter(IProgress<ProgressStatus> progressStatus, PrinterConfig printer) { this.parentProgress = progressStatus; this.printer = printer; } public void Report(ProgressStatus progressStatus) { string statusText = progressStatus.Status; if (GCodeFile.GetFirstNumberAfter("", statusText, ref currentValue) && GCodeFile.GetFirstNumberAfter("/", statusText, ref destValue)) { if (destValue == 0) { destValue = 1; } timer.Restart(); progressStatus.Status = progressStatus.Status.TrimEnd('.'); progressStatus.Progress0To1 = currentValue / destValue; } else { printer.Connection.TerminalLog.WriteLine(statusText); } parentProgress.Report(progressStatus); } } }
/* Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System; using System.Diagnostics; using MatterHackers.GCodeVisualizer; using MatterHackers.Agg; namespace MatterHackers.MatterControl.PartPreviewWindow { public class SliceProgressReporter : IProgress<ProgressStatus> { private double currentValue = 0; private double destValue = 10; private IProgress<ProgressStatus> parentProgress; private PrinterConfig printer; private Stopwatch timer = Stopwatch.StartNew(); public SliceProgressReporter(IProgress<ProgressStatus> progressStatus, PrinterConfig printer) { this.parentProgress = progressStatus; this.printer = printer; } public void Report(ProgressStatus progressStatus) { string value = progressStatus.Status; if (GCodeFile.GetFirstNumberAfter("", value, ref currentValue) && GCodeFile.GetFirstNumberAfter("/", value, ref destValue)) { if (destValue == 0) { destValue = 1; } timer.Restart(); progressStatus.Status = progressStatus.Status.TrimEnd('.'); progressStatus.Progress0To1 = currentValue / destValue; } else { printer.Connection.TerminalLog.WriteLine(value); } parentProgress.Report(progressStatus); } } }
bsd-2-clause
C#
999f05941f2ebe1cb9e2c1171d11aab8be0d4640
Make to correct work IsMissing property for numeric types.
daniellor/My-FyiReporting,maratoss/My-FyiReporting,majorsilence/My-FyiReporting,majorsilence/My-FyiReporting,majorsilence/My-FyiReporting,chripf/My-FyiReporting,daniellor/My-FyiReporting,daniellor/My-FyiReporting,daniellor/My-FyiReporting,chripf/My-FyiReporting,majorsilence/My-FyiReporting,daniellor/My-FyiReporting,maratoss/My-FyiReporting,chripf/My-FyiReporting,maratoss/My-FyiReporting,daniellor/My-FyiReporting,chripf/My-FyiReporting,maratoss/My-FyiReporting,daniellor/My-FyiReporting,chripf/My-FyiReporting,majorsilence/My-FyiReporting,maratoss/My-FyiReporting,chripf/My-FyiReporting,majorsilence/My-FyiReporting,majorsilence/My-FyiReporting,maratoss/My-FyiReporting,maratoss/My-FyiReporting,chripf/My-FyiReporting
RdlEngine/Functions/FunctionFieldIsMissing.cs
RdlEngine/Functions/FunctionFieldIsMissing.cs
/* ==================================================================== Copyright (C) 2004-2008 fyiReporting Software, LLC Copyright (C) 2011 Peter Gill <[email protected]> This file is part of the fyiReporting RDL project. 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. For additional information, email [email protected] or visit the website www.fyiReporting.com. */ using System; using System.Collections; using System.IO; using System.Reflection; using fyiReporting.RDL; namespace fyiReporting.RDL { /// <summary> /// IsMissing attribute /// </summary> [Serializable] internal class FunctionFieldIsMissing : FunctionField { /// <summary> /// Determine if value of Field is available /// </summary> public FunctionFieldIsMissing(Field fld) : base(fld) { } public FunctionFieldIsMissing(string method) : base(method) { } public override TypeCode GetTypeCode() { return TypeCode.Boolean; } public override bool IsConstant() { return false; } public override IExpr ConstantOptimization() { return this; // not a constant } // public override object Evaluate(Report rpt, Row row) { return EvaluateBoolean(rpt, row); } public override double EvaluateDouble(Report rpt, Row row) { return EvaluateBoolean(rpt, row)? 1: 0; } public override decimal EvaluateDecimal(Report rpt, Row row) { return EvaluateBoolean(rpt, row)? 1m: 0m; } public override string EvaluateString(Report rpt, Row row) { return EvaluateBoolean(rpt, row)? "True": "False"; } public override DateTime EvaluateDateTime(Report rpt, Row row) { return DateTime.MinValue; } public override bool EvaluateBoolean(Report rpt, Row row) { object o = base.Evaluate(rpt, row); if(o is double) return double.IsNaN((double)o) ? true : false; else return o == null? true: false; } } }
/* ==================================================================== Copyright (C) 2004-2008 fyiReporting Software, LLC Copyright (C) 2011 Peter Gill <[email protected]> This file is part of the fyiReporting RDL project. 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. For additional information, email [email protected] or visit the website www.fyiReporting.com. */ using System; using System.Collections; using System.IO; using System.Reflection; using fyiReporting.RDL; namespace fyiReporting.RDL { /// <summary> /// IsMissing attribute /// </summary> [Serializable] internal class FunctionFieldIsMissing : FunctionField { /// <summary> /// Determine if value of Field is available /// </summary> public FunctionFieldIsMissing(Field fld) : base(fld) { } public FunctionFieldIsMissing(string method) : base(method) { } public override TypeCode GetTypeCode() { return TypeCode.Boolean; } public override bool IsConstant() { return false; } public override IExpr ConstantOptimization() { return this; // not a constant } // public override object Evaluate(Report rpt, Row row) { return EvaluateBoolean(rpt, row); } public override double EvaluateDouble(Report rpt, Row row) { return EvaluateBoolean(rpt, row)? 1: 0; } public override decimal EvaluateDecimal(Report rpt, Row row) { return EvaluateBoolean(rpt, row)? 1m: 0m; } public override string EvaluateString(Report rpt, Row row) { return EvaluateBoolean(rpt, row)? "True": "False"; } public override DateTime EvaluateDateTime(Report rpt, Row row) { return DateTime.MinValue; } public override bool EvaluateBoolean(Report rpt, Row row) { object o = base.Evaluate(rpt, row); return o == null? true: false; } } }
apache-2.0
C#
19690da501581e7b892c76c8c3d31893aa40921a
Add extra tests and missing TestClass attribute.
dlemstra/Magick.NET,dlemstra/Magick.NET
tests/Magick.NET.SystemDrawing.Tests/IMagickImageFactoryExtensionsTests/TheCreateMethod.cs
tests/Magick.NET.SystemDrawing.Tests/IMagickImageFactoryExtensionsTests/TheCreateMethod.cs
// Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/> // // Licensed under the ImageMagick License (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // // https://www.imagemagick.org/script/license.php // // Unless required by applicable law or agreed to in writing, software distributed under the // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // either express or implied. See the License for the specific language governing permissions // and limitations under the License. using System; using System.Drawing; using ImageMagick; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Magick.NET.SystemDrawing.Tests { public partial class MagickImageFactoryTests { [TestClass] public partial class TheCreateMethod { [TestMethod] public void ShouldThrowExceptionWhenBitmapIsNull() { var factory = new MagickImageFactory(); ExceptionAssert.Throws<ArgumentNullException>("bitmap", () => factory.Create((Bitmap)null)); } [TestMethod] public void ShouldCreateImageFromBitmap() { using (var bitmap = new Bitmap(Files.SnakewarePNG)) { var factory = new MagickImageFactory(); using (var image = factory.Create(bitmap)) { Assert.AreEqual(286, image.Width); Assert.AreEqual(67, image.Height); Assert.AreEqual(MagickFormat.Png, image.Format); } } } } } }
// Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/> // // Licensed under the ImageMagick License (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // // https://www.imagemagick.org/script/license.php // // Unless required by applicable law or agreed to in writing, software distributed under the // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // either express or implied. See the License for the specific language governing permissions // and limitations under the License. using System.Drawing; using ImageMagick; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Magick.NET.SystemDrawing.Tests { public partial class MagickImageFactoryTests { public partial class TheCreateMethod { [TestMethod] public void ShouldCreateImageFromBitmap() { using (var bitmap = new Bitmap(Files.SnakewarePNG)) { var factory = new MagickImageFactory(); using (var image = factory.Create(bitmap)) { Assert.AreEqual(286, image.Width); Assert.AreEqual(67, image.Height); Assert.AreEqual(MagickFormat.Png, image.Format); } } } } } }
apache-2.0
C#
7a52baf18f881baf10a330f7927210bd0e83be3f
Fix #2054 - make TagHelperResolutionResult internal
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs
src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.CodeAnalysis.Razor { internal sealed class TagHelperResolutionResult { internal static readonly TagHelperResolutionResult Empty = new TagHelperResolutionResult(Array.Empty<TagHelperDescriptor>(), Array.Empty<RazorDiagnostic>()); public TagHelperResolutionResult(IReadOnlyList<TagHelperDescriptor> descriptors, IReadOnlyList<RazorDiagnostic> diagnostics) { Descriptors = descriptors; Diagnostics = diagnostics; } public IReadOnlyList<TagHelperDescriptor> Descriptors { get; } public IReadOnlyList<RazorDiagnostic> Diagnostics { get; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.CodeAnalysis.Razor { public sealed class TagHelperResolutionResult { internal static TagHelperResolutionResult Empty = new TagHelperResolutionResult(Array.Empty<TagHelperDescriptor>(), Array.Empty<RazorDiagnostic>()); public TagHelperResolutionResult(IReadOnlyList<TagHelperDescriptor> descriptors, IReadOnlyList<RazorDiagnostic> diagnostics) { Descriptors = descriptors; Diagnostics = diagnostics; } public IReadOnlyList<TagHelperDescriptor> Descriptors { get; } public IReadOnlyList<RazorDiagnostic> Diagnostics { get; } } }
apache-2.0
C#
0ba29fec6993cc1892d639a67a2c81c390954d89
Make comment say that 0x001 is RTLD_LOCAL + RTLD_LAZY
peppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework
osu.Framework/Platform/Linux/Native/Library.cs
osu.Framework/Platform/Linux/Native/Library.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Runtime.InteropServices; namespace osu.Framework.Platform.Linux.Native { public static class Library { [DllImport("libdl.so", EntryPoint = "dlopen")] private static extern IntPtr dlopen(string filename, int flags); public static void LoadLazyLocal(string filename) { dlopen(filename, 0x001); // RTLD_LOCAL + RTLD_LAZY } public static void LoadNowLocal(string filename) { dlopen(filename, 0x002); // RTLD_LOCAL + RTLD_NOW } public static void LoadLazyGlobal(string filename) { dlopen(filename, 0x101); // RTLD_GLOBAL + RTLD_LAZY } public static void LoadNowGlobal(string filename) { dlopen(filename, 0x102); // RTLD_GLOBAL + RTLD_NOW } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Runtime.InteropServices; namespace osu.Framework.Platform.Linux.Native { public static class Library { [DllImport("libdl.so", EntryPoint = "dlopen")] private static extern IntPtr dlopen(string filename, int flags); public static void LoadLazyLocal(string filename) { dlopen(filename, 0x001); // RTLD_LOCAL + RTLD_NOW } public static void LoadNowLocal(string filename) { dlopen(filename, 0x002); // RTLD_LOCAL + RTLD_NOW } public static void LoadLazyGlobal(string filename) { dlopen(filename, 0x101); // RTLD_GLOBAL + RTLD_LAZY } public static void LoadNowGlobal(string filename) { dlopen(filename, 0x102); // RTLD_GLOBAL + RTLD_NOW } } }
mit
C#
11f7d8e8a691221d84d9751332743f466bf64322
Improve Linux.Native.Library.Load documentation. Add space after if.
smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework
osu.Framework/Platform/Linux/Native/Library.cs
osu.Framework/Platform/Linux/Native/Library.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.IO; using System.Runtime.InteropServices; namespace osu.Framework.Platform.Linux.Native { public static class Library { [DllImport("libdl.so", EntryPoint = "dlopen")] private static extern IntPtr dlopen(string library, LoadFlags flags); /// <summary> /// Loads a library with flags to use with dlopen. Uses <see cref="LoadFlags"/> for the flags /// /// Uses NATIVE_DLL_SEARCH_DIRECTORIES and then ld.so for library paths /// </summary> /// <param name="flags">See 'man dlopen' for more information.</param> /// <param name="library">Full name of the library</param> public static void Load(string library, LoadFlags flags) { var paths = (string)AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES"); foreach (var path in paths.Split(':')) { if (dlopen(Path.Combine(path, library), flags) != IntPtr.Zero) break; } } [Flags] public enum LoadFlags { RTLD_LAZY = 0x00001, RTLD_NOW = 0x00002, RTLD_BINDING_MASK = 0x00003, RTLD_NOLOAD = 0x00004, RTLD_DEEPBIND = 0x00008, RTLD_GLOBAL = 0x00100, RTLD_LOCAL = 0x00000, RTLD_NODELETE = 0x01000 } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.IO; using System.Runtime.InteropServices; namespace osu.Framework.Platform.Linux.Native { public static class Library { [DllImport("libdl.so", EntryPoint = "dlopen")] private static extern IntPtr dlopen(string library, LoadFlags flags); /// <summary> /// Loads a library with an enum of flags to use with dlopen. Uses <see cref="LoadFlags"/> for the flags /// </summary> /// <param name="flags">See 'man dlopen' for more information.</param> /// <param name="library">Uses ld.so and NATIVE_DLL_SEARCH_DIRECTORIES for locations</param> public static void Load(string library, LoadFlags flags) { var paths = (string)AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES"); foreach (var path in paths.Split(':')) { if(dlopen(Path.Combine(path, library), flags) != IntPtr.Zero) break; } } [Flags] public enum LoadFlags { RTLD_LAZY = 0x00001, RTLD_NOW = 0x00002, RTLD_BINDING_MASK = 0x00003, RTLD_NOLOAD = 0x00004, RTLD_DEEPBIND = 0x00008, RTLD_GLOBAL = 0x00100, RTLD_LOCAL = 0x00000, RTLD_NODELETE = 0x01000 } } }
mit
C#
2fc6d68fbbfc66e8b8480d9f1eda7ed5486282c8
Add products to Controllers
NadalinVini/Interdisciplinar.net,NadalinVini/Interdisciplinar.net
TestC/TestC/Controllers/ProductsController.cs
TestC/TestC/Controllers/ProductsController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace TestC.Controllers { public class ProductsController : Controller { private static IList<Product> products = new List<Product>() { new Product() { ProductId = 1, Name = "Gtx 1080", Type = "Placa de video", Brand = "Nvidea", Price = 1200}, new Product() { ProductId = 2, Name = "H110", Type = "Placa mãe", Brand = "Asus", Price = 500}, new Product() { ProductId = 3, Name = "RazzerPad", Type = "MousePad", Brand = "Razzer", Price = 70}, new Product() { ProductId = 4, Name = "i5 7k", Type = "Processador", Brand = "Intel", Price = 800}, new Product() { ProductId = 5, Name = "Fonte 500W", Type = "Fonte", Brand = "Corsair", Price = 300}, }; // GET: Product public ActionResult Index() { return View(new List<Product>()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace TestC.Controllers { public class ProductsController : Controller { // GET: Product public ActionResult Index() { return View(new List<Product>()); } } }
apache-2.0
C#
9b3570a008567f922c4e261c13a601f1c034c4bb
Make IAmbientLightSensor public
treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk
NET/Libraries/Treehopper.Libraries/Sensors/Optical/IAmbientLightSensor.cs
NET/Libraries/Treehopper.Libraries/Sensors/Optical/IAmbientLightSensor.cs
using System; using System.Collections.Generic; using System.Text; namespace Treehopper.Libraries.Sensors.Optical { /// <summary> /// Ambient light sensor interface /// </summary> public interface IAmbientLightSensor : IPollable { /// <summary> /// Gets the ambient light sensor reading, in lux /// </summary> double Lux { get; } } }
using System; using System.Collections.Generic; using System.Text; namespace Treehopper.Libraries.Sensors.Optical { /// <summary> /// Ambient light sensor interface /// </summary> interface IAmbientLightSensor : IPollable { /// <summary> /// Gets the ambient light sensor reading, in lux /// </summary> double Lux { get; } } }
mit
C#
89fa6869af21401c9df0cb1d582e597fe9ea71be
Remove dead code
liemqv/EventFlow,AntoineGa/EventFlow,rasmus/EventFlow
Source/EventFlow/Configuration/Bootstraps/DefinitionServicesInitilizer.cs
Source/EventFlow/Configuration/Bootstraps/DefinitionServicesInitilizer.cs
// The MIT License (MIT) // // Copyright (c) 2015 Rasmus Mikkelsen // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System.Threading; using System.Threading.Tasks; using EventFlow.Commands; using EventFlow.EventStores; using EventFlow.Jobs; namespace EventFlow.Configuration.Bootstraps { public class DefinitionServicesInitilizer : IBootstrap { private readonly ICommandDefinitionService _commandDefinitionService; private readonly IEventDefinitionService _eventDefinitionService; private readonly IJobDefinitionService _jobDefinitionService; private readonly ILoadedVersionedTypes _loadedVersionedTypes; public DefinitionServicesInitilizer( ILoadedVersionedTypes loadedVersionedTypes, IEventDefinitionService eventDefinitionService, ICommandDefinitionService commandDefinitionService, IJobDefinitionService jobDefinitionService) { _loadedVersionedTypes = loadedVersionedTypes; _eventDefinitionService = eventDefinitionService; _commandDefinitionService = commandDefinitionService; _jobDefinitionService = jobDefinitionService; } public Task InitializeAsync(CancellationToken cancellationToken) { _commandDefinitionService.LoadCommands(_loadedVersionedTypes.Commands); _eventDefinitionService.LoadEvents(_loadedVersionedTypes.Events); _jobDefinitionService.LoadJobs(_loadedVersionedTypes.Jobs); return Task.FromResult(0); } } }
// The MIT License (MIT) // // Copyright (c) 2015 Rasmus Mikkelsen // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System.Threading; using System.Threading.Tasks; using EventFlow.Commands; using EventFlow.EventStores; using EventFlow.Jobs; namespace EventFlow.Configuration.Bootstraps { public class DefinitionServicesInitilizer : IBootstrap { private readonly ICommandDefinitionService _commandDefinitionService; private readonly IEventDefinitionService _eventDefinitionService; private readonly IJobDefinitionService _jobDefinitionService; private readonly IModuleRegistration _moduleRegistration; private readonly ILoadedVersionedTypes _loadedVersionedTypes; public DefinitionServicesInitilizer( IModuleRegistration moduleRegistration, ILoadedVersionedTypes loadedVersionedTypes, IEventDefinitionService eventDefinitionService, ICommandDefinitionService commandDefinitionService, IJobDefinitionService jobDefinitionService) { _moduleRegistration = moduleRegistration; _loadedVersionedTypes = loadedVersionedTypes; _eventDefinitionService = eventDefinitionService; _commandDefinitionService = commandDefinitionService; _jobDefinitionService = jobDefinitionService; } public Task InitializeAsync(CancellationToken cancellationToken) { _commandDefinitionService.LoadCommands(_loadedVersionedTypes.Commands); _eventDefinitionService.LoadEvents(_loadedVersionedTypes.Events); _jobDefinitionService.LoadJobs(_loadedVersionedTypes.Jobs); return Task.FromResult(0); } } }
mit
C#
8ae3d0e26ba1f5a70a3001b8782bd4749f24ddc9
Bump version to 3.0.0
Coding-Enthusiast/Watch-Only-Bitcoin-Wallet
WatchOnlyBitcoinWallet/Properties/AssemblyInfo.cs
WatchOnlyBitcoinWallet/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("WatchOnlyBitcoinWallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Coding Enthusiast Coders")] [assembly: AssemblyProduct("WatchOnlyBitcoinWallet")] [assembly: AssemblyCopyright("Copyright © C.E. 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.0.0.*")] [assembly: AssemblyFileVersion("3.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("WatchOnlyBitcoinWallet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Coding Enthusiast Coders")] [assembly: AssemblyProduct("WatchOnlyBitcoinWallet")] [assembly: AssemblyCopyright("Copyright © C.E. 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.4.0.*")] [assembly: AssemblyFileVersion("2.4.0.0")]
mit
C#
a3b95c3ccbdfdca117a13e2d0f5c81ad0643f055
Correct AuditLog<TId> classMapping
peopleware/net-ppwcode-vernacular-nhibernate
src/PPWCode.Vernacular.NHibernate.I/MappingByCode/AuditLogMapping.cs
src/PPWCode.Vernacular.NHibernate.I/MappingByCode/AuditLogMapping.cs
// Copyright 2014 by PeopleWare n.v.. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using NHibernate; using PPWCode.Vernacular.Persistence.II; namespace PPWCode.Vernacular.NHibernate.I.MappingByCode { public abstract class AuditLogMapping<T, TId> : PersistentObjectMapper<T, TId> where T : AuditLog<TId> where TId : IEquatable<TId> { protected AuditLogMapping() { Property(x => x.EntryType, m => m.NotNullable(true)); Property(x => x.EntityName, m => m.NotNullable(true)); Property(x => x.EntityId, m => m.NotNullable(true)); Property(x => x.PropertyName, m => m.NotNullable(true)); Property(x => x.OldValue, m => m.Type(NHibernateUtil.StringClob)); Property(x => x.NewValue, m => m.Type(NHibernateUtil.StringClob)); Property(x => x.CreatedAt, m => m.NotNullable(true)); Property(x => x.CreatedBy, m => m.NotNullable(true)); } } }
// Copyright 2014 by PeopleWare n.v.. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using PPWCode.Vernacular.Persistence.II; namespace PPWCode.Vernacular.NHibernate.I.MappingByCode { public abstract class AuditLogMapping<TId> : PersistentObjectMapper<AuditLog<TId>, TId> where TId : IEquatable<TId> { protected AuditLogMapping() { Property(x => x.EntryType); Property(x => x.EntityName); Property(x => x.EntityId); Property(x => x.PropertyName); Property(x => x.OldValue); Property(x => x.NewValue); Property(x => x.CreatedAt); Property(x => x.CreatedBy); } } }
apache-2.0
C#
382aefba54c32d0f321e2b979e6322b96461ab1a
Update SettingFontSize.cs
asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET
Examples/CSharp/Formatting/DealingWithFontSettings/SettingFontSize.cs
Examples/CSharp/Formatting/DealingWithFontSettings/SettingFontSize.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Formatting.DealingWithFontSettings { public class SettingFontSize { 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); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Adding a new worksheet to the Excel object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Accessing the "A1" cell from the worksheet Aspose.Cells.Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Hello Aspose!"); //Obtaining the style of the cell Style style = cell.GetStyle(); //Setting the font size to 14 style.Font.Size = 14; //Applying the style to the cell cell.SetStyle(style); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls", SaveFormat.Excel97To2003); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Formatting.DealingWithFontSettings { public class SettingFontSize { 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); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Adding a new worksheet to the Excel object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Accessing the "A1" cell from the worksheet Aspose.Cells.Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Hello Aspose!"); //Obtaining the style of the cell Style style = cell.GetStyle(); //Setting the font size to 14 style.Font.Size = 14; //Applying the style to the cell cell.SetStyle(style); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls", SaveFormat.Excel97To2003); } } }
mit
C#
253d112ac379f59aab213d7f3291c12f424f02b6
Fix typo for HMAC key states
googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/gcloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet
apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/HmacKeyStates.cs
apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/HmacKeyStates.cs
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using Google.Apis.Storage.v1.Data; using System; using System.Collections.Generic; using System.Text; namespace Google.Cloud.Storage.V1 { /// <summary> /// String constants for the names of the storage classes, as used in <see cref="HmacKeyMetadata.State" />. /// </summary> public static class HmacKeyStates { /// <summary> /// The key is active, and can be used for signing. It cannot be deleted in this state. /// </summary> public const string Active = "ACTIVE"; /// <summary> /// The key is inactive, and can be used for signing. It can be deleted. /// </summary> public const string Inactive = "INACTIVE"; /// <summary> /// The key has been deleted. /// </summary> public const string Deleted = "DELETED"; } }
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using Google.Apis.Storage.v1.Data; using System; using System.Collections.Generic; using System.Text; namespace Google.Cloud.Storage.V1 { /// <summary> /// String constants for the names of the storage classes, as used in <see cref="HmacKeyMetadata.State" />. /// </summary> public static class HmacKeyStates { /// <summary> /// The key is active, and can be used for signing. It cannot be deleted in this state. /// </summary> public const string Active = "ACTIVE"; /// <summary> /// The key is inactive, and can be used for signing. It can be deleted. /// </summary> public const string Inactive = "INACTIVE"; /// <summary> /// The key has been deleted. /// </summary> public const string Deleted = "DELETE"; } }
apache-2.0
C#
a710848d100b37555567ae16bb13161d1fa17dc3
Redefine `PROPVARIANT`
stakx/stakx.WIC.Interop,stakx/stakx.WIC
stakx.WIC.Interop/Structures/PROPVARIANT.cs
stakx.WIC.Interop/Structures/PROPVARIANT.cs
using System; using System.Runtime.InteropServices; namespace stakx.WIC.Interop { [StructLayout(LayoutKind.Sequential, Pack = 8)] public struct PROPVARIANT { public VARTYPE Type; public PROPVARIANT_Value Value; } [StructLayout(LayoutKind.Explicit)] public struct PROPVARIANT_Value { [FieldOffset(0)] public sbyte I1; [FieldOffset(0)] public byte UI1; [FieldOffset(0)] public short I2; [FieldOffset(0)] public ushort UI2; [FieldOffset(0)] public int I4; [FieldOffset(0)] public uint UI4; [FieldOffset(0)] public long I8; [FieldOffset(0)] public uint UI8; [FieldOffset(0)] public PROPVARIANT_SplitI8 SplitI8; [FieldOffset(0)] public PROPVARIANT_SplitUI8 SplitUI8; [FieldOffset(0)] public float R4; [FieldOffset(0)] public double R8; [FieldOffset(0)] public IntPtr Ptr; [FieldOffset(0)] public PROPVARIANT_Vector Vector; } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct PROPVARIANT_SplitI8 { public int A; public int B; } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct PROPVARIANT_SplitUI8 { public uint A; public uint B; } [StructLayout(LayoutKind.Sequential)] public struct PROPVARIANT_Vector { public int Length; public IntPtr Ptr; } }
using System; using System.Runtime.InteropServices; namespace stakx.WIC.Interop { [StructLayout(LayoutKind.Explicit)] public struct PROPVARIANT { [FieldOffset(0)] public VARTYPE vt; [FieldOffset(8)] public byte bVal; [FieldOffset(8)] public short iVal; [FieldOffset(8)] public int lVal; [FieldOffset(8)] public long hVal; [FieldOffset(8)] public float fltVal; [FieldOffset(8)] public double dblVal; [FieldOffset(8)] public IntPtr puuid; // Guid* [FieldOffset(8)] public IntPtr punkVal; [FieldOffset(8)] public IntPtr pwszVal; // char* [FieldOffset(8)] public PROPARRAY ca; #warning `PROPVARIANT` is incomplete. } [StructLayout(LayoutKind.Sequential)] public struct PROPARRAY { public int cElems; public IntPtr pElems; } }
mit
C#
7fcde71654c514f786f77ebe96c6c443c38e327a
fix milliseconds
ProfessionalCSharp/ProfessionalCSharp7,ProfessionalCSharp/ProfessionalCSharp7,ProfessionalCSharp/ProfessionalCSharp7,ProfessionalCSharp/ProfessionalCSharp7
CSharp8/SwitchStateSample/SwitchStateSample/LightStatus.cs
CSharp8/SwitchStateSample/SwitchStateSample/LightStatus.cs
namespace SwitchStateSample { public readonly struct LightStatus { public LightStatus(LightState current, LightState previous, int milliSeconds, int blinkCount) => (Current, Previous, Milliseconds, FlashCount) = (current, previous, milliSeconds, blinkCount); public LightStatus(LightState current, LightState previous, int milliSeconds) : this(current, previous, milliSeconds, 0) { } public LightStatus(LightState current, LightState previous) : this(current, previous, 3) { } public LightState Current { get; } public LightState Previous { get; } public int FlashCount { get; } public int Milliseconds { get; } } }
namespace SwitchStateSample { public readonly struct LightStatus { public LightStatus(LightState current, LightState previous, int seconds, int blinkCount) => (Current, Previous, Milliseconds, FlashCount) = (current, previous, seconds, blinkCount); public LightStatus(LightState current, LightState previous, int seconds) : this(current, previous, seconds, 0) { } public LightStatus(LightState current, LightState previous) : this(current, previous, 3) { } public LightState Current { get; } public LightState Previous { get; } public int FlashCount { get; } public int Milliseconds { get; } } }
mit
C#
b660138b6b69192bab80d2e965621ed9b6df23dd
Update ShowPointerPositionBehavior.cs
XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors,XamlBehaviors/XamlBehaviors
src/Avalonia.Xaml.Interactions/Core/ShowPointerPositionBehavior.cs
src/Avalonia.Xaml.Interactions/Core/ShowPointerPositionBehavior.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using Avalonia; using Avalonia.Controls; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Core { /// <summary> /// A behavior that that displays cursor position on PointerMoved event for the AssociatedObject using TargetTextBlock.Text property. /// </summary> public sealed class ShowPointerPositionBehavior : Behavior<Control> { /// <summary> /// Identifies the <seealso cref="TargetTextBlockProperty"/> avalonia property. /// </summary> public static readonly AvaloniaProperty TargetTextBlockProperty = AvaloniaProperty.Register<ShowPointerPositionBehavior, TextBlock>(nameof(TargetTextBlock)); /// <summary> /// Gets or sets the target TextBlock object in which this behavior displays cursor position on PointerMoved event. /// </summary> public TextBlock TargetTextBlock { get { return (TextBlock)this.GetValue(TargetTextBlockProperty); } set { this.SetValue(TargetTextBlockProperty, value); } } /// <summary> /// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>. /// </summary> protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.PointerMoved += AssociatedObject_PointerMoved; } /// <summary> /// Called when the behavior is being detached from its <see cref="Behavior.AssociatedObject"/>. /// </summary> protected override void OnDetaching() { base.OnDetaching(); this.AssociatedObject.PointerMoved -= AssociatedObject_PointerMoved; } private void AssociatedObject_PointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { if (TargetTextBlock != null) { TargetTextBlock.Text = e.GetPosition(this.AssociatedObject).ToString(); } } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using Avalonia; using Avalonia.Controls; using Avalonia.Xaml.Interactivity; namespace Avalonia.Xaml.Interactions.Core { public sealed class ShowPointerPositionBehavior : Behavior<Control> { public static readonly AvaloniaProperty TargetTextBlockProperty = AvaloniaProperty.Register<ShowPointerPositionBehavior, TextBlock>(nameof(TargetTextBlock)); public TextBlock TargetTextBlock { get { return (TextBlock)this.GetValue(TargetTextBlockProperty); } set { this.SetValue(TargetTextBlockProperty, value); } } private void AssociatedObject_PointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { if (TargetTextBlock != null) { TargetTextBlock.Text = e.GetPosition(this.AssociatedObject).ToString(); } } protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.PointerMoved += AssociatedObject_PointerMoved; } protected override void OnDetaching() { base.OnDetaching(); this.AssociatedObject.PointerMoved -= AssociatedObject_PointerMoved; } } }
mit
C#
6ebb9ca491de385423e7c1d36cfa66482fda484a
Fix error when unserializing json object
5andr0/PogoLocationFeeder,genius394/PogoLocationFeeder,5andr0/PogoLocationFeeder
PogoLocationFeeder/Helper/JsonSerializerSettingsFactory.cs
PogoLocationFeeder/Helper/JsonSerializerSettingsFactory.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace PogoLocationFeeder.Helper { public class JsonSerializerSettingsCultureInvariant : JsonSerializerSettings { public JsonSerializerSettingsCultureInvariant() { Culture = CultureInfo.InvariantCulture; Converters = new List<JsonConverter> { new DoubleConverter()}; } } public class DoubleConverter : JsonConverter { public override bool CanConvert(Type objectType) { return (objectType == typeof(double) || objectType == typeof(double?)); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JToken token = JToken.Load(reader); if (token.Type == JTokenType.Float || token.Type == JTokenType.Integer) { return token.ToObject<double>(); } if (token.Type == JTokenType.String) { var match = Regex.Match(token.ToString(), @"(1?\-?\d+\.?\d*)"); if (match.Success) { return Double.Parse(match.Groups[1].Value, System.Globalization.CultureInfo.InvariantCulture); } return Double.Parse(token.ToString(), System.Globalization.CultureInfo.InvariantCulture); } if (token.Type == JTokenType.Null && objectType == typeof(double?)) { return null; } throw new JsonSerializationException("Unexpected token type: " + token.Type.ToString()); } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotImplementedException(); } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace PogoLocationFeeder.Helper { public class JsonSerializerSettingsCultureInvariant : JsonSerializerSettings { public JsonSerializerSettingsCultureInvariant() { Culture = CultureInfo.InvariantCulture; } } }
agpl-3.0
C#
77a2df173d5707878144aa547f87898ed6a63546
Make build with CSLA 4. bugid: 748
ronnymgm/csla-light,rockfordlhotka/csla,BrettJaner/csla,jonnybee/csla,BrettJaner/csla,rockfordlhotka/csla,JasonBock/csla,BrettJaner/csla,JasonBock/csla,jonnybee/csla,JasonBock/csla,ronnymgm/csla-light,ronnymgm/csla-light,jonnybee/csla,MarimerLLC/csla,rockfordlhotka/csla,MarimerLLC/csla,MarimerLLC/csla
Samples/CslaNet/cs/Permissions/Permissions/Window1.xaml.cs
Samples/CslaNet/cs/Permissions/Permissions/Window1.xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace TestApp { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { CustomIdentity identity = null; try { var username = "Guest"; // Admin, Guest, Mary, Bob identity = Csla.DataPortal.Fetch<CustomIdentity>( new Csla.Security.UsernameCriteria(username, "")); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Login error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } var principal = new CustomPrincipal(identity); Csla.ApplicationContext.User = principal; UserTextBlock.Text = Csla.ApplicationContext.User.Identity.Name; try { var cust = CustomerEdit.GetCustomer(123); var dp = Resources["Customer"] as Csla.Xaml.CslaDataProvider; dp.ObjectInstance = cust; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } //if (User.HasPermission("Customer.City.Read")) // CityPanel.Visibility = Visibility.Visible; //else // CityPanel.Visibility = Visibility.Collapsed; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace TestApp { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { CustomIdentity identity = null; try { identity = Csla.DataPortal.Fetch<CustomIdentity>( new Csla.Security.UsernameCriteria("Admin", "")); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Login error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } var principal = new CustomPrincipal(identity); Csla.ApplicationContext.User = principal; UserTextBlock.Text = Csla.ApplicationContext.User.Identity.Name; try { var cust = CustomerEdit.GetCustomer(123); var dp = Resources["Customer"] as Csla.Xaml.CslaDataProvider; dp.ObjectInstance = cust; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } //if (User.HasPermission("Customer.City.Read")) // CityPanel.Visibility = Visibility.Visible; //else // CityPanel.Visibility = Visibility.Collapsed; } } }
mit
C#
1c708f581b1e3f09fd1a17d6953d44aabbe6d003
Improve EntityLogMessageFactory
aluxnimm/outlookcaldavsynchronizer
CalDavSynchronizer/Implementation/Common/EntityLogMessageFactory.cs
CalDavSynchronizer/Implementation/Common/EntityLogMessageFactory.cs
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System.Linq; using CalDavSynchronizer.Implementation.ComWrappers; using CalDavSynchronizer.Implementation.DistributionLists.Sogo; using CalDavSynchronizer.Implementation.GoogleContacts; using DDay.iCal; using GenSync.Logging; using Google.Apis.Tasks.v1.Data; using Thought.vCards; namespace CalDavSynchronizer.Implementation.Common { class EntityLogMessageFactory : IEntityLogMessageFactory<IAppointmentItemWrapper, IICalendar>, IEntityLogMessageFactory<ITaskItemWrapper, IICalendar>, IEntityLogMessageFactory<IContactItemWrapper, vCard>, IEntityLogMessageFactory<ITaskItemWrapper, Task>, IEntityLogMessageFactory<IContactItemWrapper, GoogleContactWrapper>, IEntityLogMessageFactory<IDistListItemWrapper, DistributionList>, IEntityLogMessageFactory<IDistListItemWrapper, vCard> { public static readonly EntityLogMessageFactory Instance = new EntityLogMessageFactory(); private EntityLogMessageFactory() { } public string ACreateOrNull(IAppointmentItemWrapper entity) { return entity.Inner.Subject; } public string ACreateOrNull(ITaskItemWrapper entity) { return entity.Inner.Subject; } public string BCreateOrNull(Task entity) { return entity.Title; } public string BCreateOrNull(IICalendar entity) { return entity.Calendar.Events.FirstOrDefault()?.Summary ?? entity.Calendar.Todos.FirstOrDefault()?.Summary; } public string ACreateOrNull(IContactItemWrapper entity) { return entity.Inner.FullName; } public string BCreateOrNull(GoogleContactWrapper entity) { return entity.Contact.Name.FullName; } public string BCreateOrNull(vCard entity) { return entity.FormattedName; } public string ACreateOrNull(IDistListItemWrapper entity) { return entity.Inner.DLName; } public string BCreateOrNull(DistributionList entity) { return entity.Name; } } }
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System.Linq; using CalDavSynchronizer.Implementation.ComWrappers; using CalDavSynchronizer.Implementation.DistributionLists.Sogo; using CalDavSynchronizer.Implementation.GoogleContacts; using DDay.iCal; using GenSync.Logging; using Google.Apis.Tasks.v1.Data; using Thought.vCards; namespace CalDavSynchronizer.Implementation.Common { class EntityLogMessageFactory : IEntityLogMessageFactory<IAppointmentItemWrapper, IICalendar>, IEntityLogMessageFactory<ITaskItemWrapper, IICalendar>, IEntityLogMessageFactory<IContactItemWrapper, vCard>, IEntityLogMessageFactory<ITaskItemWrapper, Task>, IEntityLogMessageFactory<IContactItemWrapper, GoogleContactWrapper>, IEntityLogMessageFactory<IDistListItemWrapper, DistributionList>, IEntityLogMessageFactory<IDistListItemWrapper, vCard> { public static readonly EntityLogMessageFactory Instance = new EntityLogMessageFactory(); private EntityLogMessageFactory() { } public string ACreateOrNull(IAppointmentItemWrapper entity) { return entity.Inner?.Subject; } public string ACreateOrNull(ITaskItemWrapper entity) { return entity.Inner.Subject; } public string BCreateOrNull(Task entity) { return entity.Title; } public string BCreateOrNull(IICalendar entity) { return entity.Calendar?.Events.FirstOrDefault()?.Summary; } public string ACreateOrNull(IContactItemWrapper entity) { return entity.Inner?.FullName; } public string BCreateOrNull(GoogleContactWrapper entity) { return entity.Contact.Name.FullName; } public string BCreateOrNull(vCard entity) { return entity.FormattedName; } public string ACreateOrNull(IDistListItemWrapper entity) { return entity.Inner.DLName; } public string BCreateOrNull(DistributionList entity) { return entity.Name; } } }
agpl-3.0
C#
aac044abd3e309e894cfe0747533462a92ee9380
rename namespace.
Cologler/jasily.cologler
Jasily.Desktop/Windows/Interactivity/Behaviors/NonSelectBehavior.cs
Jasily.Desktop/Windows/Interactivity/Behaviors/NonSelectBehavior.cs
using System.Windows.Controls.Primitives; using System.Windows.Interactivity; namespace Jasily.Windows.Interactivity.Behaviors { public class NonSelectBehavior : Behavior<Selector> { #region Overrides of Behavior /// <summary> /// 在行为附加到 AssociatedObject 后调用。 /// </summary> /// <remarks> /// 替代它以便将功能挂钩到 AssociatedObject。 /// </remarks> protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.SelectionChanged += this.AssociatedObject_SelectionChanged; } private void AssociatedObject_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (this.AssociatedObject.SelectedItem != null) this.AssociatedObject.SelectedItem = null; } /// <summary> /// 在行为与其 AssociatedObject 分离时(但在它实际发生之前)调用。 /// </summary> /// <remarks> /// 替代它以便将功能从 AssociatedObject 中解除挂钩。 /// </remarks> protected override void OnDetaching() { this.AssociatedObject.SelectionChanged -= this.AssociatedObject_SelectionChanged; base.OnDetaching(); } #endregion } }
using System.Windows.Controls.Primitives; using System.Windows.Interactivity; namespace Jasily.Desktop.Windows.Interactivity.Behaviors { public class NonSelectBehavior : Behavior<Selector> { #region Overrides of Behavior /// <summary> /// 在行为附加到 AssociatedObject 后调用。 /// </summary> /// <remarks> /// 替代它以便将功能挂钩到 AssociatedObject。 /// </remarks> protected override void OnAttached() { base.OnAttached(); this.AssociatedObject.SelectionChanged += this.AssociatedObject_SelectionChanged; } private void AssociatedObject_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if (this.AssociatedObject.SelectedItem != null) this.AssociatedObject.SelectedItem = null; } /// <summary> /// 在行为与其 AssociatedObject 分离时(但在它实际发生之前)调用。 /// </summary> /// <remarks> /// 替代它以便将功能从 AssociatedObject 中解除挂钩。 /// </remarks> protected override void OnDetaching() { this.AssociatedObject.SelectionChanged -= this.AssociatedObject_SelectionChanged; base.OnDetaching(); } #endregion } }
mit
C#
abb93ab72d52be1b7bb4856a7516d6981544c6e8
Update ProtectRowWorksheet.cs
asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET
Examples/CSharp/Worksheets/Security/Protecting/ProtectRowWorksheet.cs
Examples/CSharp/Worksheets/Security/Protecting/ProtectRowWorksheet.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Security.Protecting { public class ProtectRowWorksheet { 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 new workbook. Workbook wb = new Workbook(); // Create a worksheet object and obtain the first sheet. Worksheet sheet = wb.Worksheets[0]; // Define the style object. Style style; // Define the styleflag object. StyleFlag flag; // Loop through all the columns in the worksheet and unlock them. for (int i = 0; i <= 255; i++) { style = sheet.Cells.Columns[(byte)i].Style; style.IsLocked = false; flag = new StyleFlag(); flag.Locked = true; sheet.Cells.Columns[(byte)i].ApplyStyle(style, flag); } // Get the first row style. style = sheet.Cells.Rows[0].Style; // Lock it. style.IsLocked = true; // Instantiate the flag. flag = new StyleFlag(); // Set the lock setting. flag.Locked = true; // Apply the style to the first row. sheet.Cells.ApplyRowStyle(0, style, flag); // Protect the sheet. sheet.Protect(ProtectionType.All); // Save the excel file. wb.Save(dataDir + "output.out.xls", SaveFormat.Excel97To2003); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Worksheets.Security.Protecting { public class ProtectRowWorksheet { 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 new workbook. Workbook wb = new Workbook(); // Create a worksheet object and obtain the first sheet. Worksheet sheet = wb.Worksheets[0]; // Define the style object. Style style; // Define the styleflag object. StyleFlag flag; // Loop through all the columns in the worksheet and unlock them. for (int i = 0; i <= 255; i++) { style = sheet.Cells.Columns[(byte)i].Style; style.IsLocked = false; flag = new StyleFlag(); flag.Locked = true; sheet.Cells.Columns[(byte)i].ApplyStyle(style, flag); } // Get the first row style. style = sheet.Cells.Rows[0].Style; // Lock it. style.IsLocked = true; // Instantiate the flag. flag = new StyleFlag(); // Set the lock setting. flag.Locked = true; // Apply the style to the first row. sheet.Cells.ApplyRowStyle(0, style, flag); // Protect the sheet. sheet.Protect(ProtectionType.All); // Save the excel file. wb.Save(dataDir + "output.out.xls", SaveFormat.Excel97To2003); } } }
mit
C#
8c93fe155955a8d547fc75529d11b315d6d663c2
Add explenation for suppression
KodeFoxx/Numaris
Examples/Kf.Numaris.Examples.ConsoleApplication/GlobalSuppressions.cs
Examples/Kf.Numaris.Examples.ConsoleApplication/GlobalSuppressions.cs
using System.Diagnostics.CodeAnalysis; // Suppress this warning because it is used by "scenario" type of string parameters in theory test methods [assembly: SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]
// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. using System.Diagnostics.CodeAnalysis; [assembly: SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]
mit
C#
e582d9d5a8720928e03a792a9b92dc91fbd54baf
Remove unused using statements
ppy/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu
osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osuTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components { public class SpinnerPiece : BlueprintPiece<Spinner> { private readonly Circle circle; private readonly Circle ring; public SpinnerPiece() { Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; Size = new Vector2(1); InternalChildren = new Drawable[] { circle = new Circle { RelativeSizeAxes = Axes.Both, Alpha = 0.5f, }, ring = new Circle { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(OsuHitObject.OBJECT_RADIUS), }, }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { Colour = colours.Yellow; } public override void UpdateFrom(Spinner hitObject) { base.UpdateFrom(hitObject); ring.Scale = new Vector2(hitObject.Scale); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Skinning.Default; using osuTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components { public class SpinnerPiece : BlueprintPiece<Spinner> { private readonly Circle circle; private readonly Circle ring; public SpinnerPiece() { Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; Size = new Vector2(1); InternalChildren = new Drawable[] { circle = new Circle { RelativeSizeAxes = Axes.Both, Alpha = 0.5f, }, ring = new Circle { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(OsuHitObject.OBJECT_RADIUS), }, }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { Colour = colours.Yellow; } public override void UpdateFrom(Spinner hitObject) { base.UpdateFrom(hitObject); ring.Scale = new Vector2(hitObject.Scale); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos); } }
mit
C#
8527cd1dc979b31df5a3c9ee6610de14f591833b
Update ZoomHelper.cs
PanAndZoom/PanAndZoom,wieslawsoltes/PanAndZoom,wieslawsoltes/MatrixPanAndZoomDemo,PanAndZoom/PanAndZoom,wieslawsoltes/PanAndZoom
src/Avalonia.Controls.PanAndZoom/ZoomHelper.cs
src/Avalonia.Controls.PanAndZoom/ZoomHelper.cs
using System; using static System.Math; namespace Avalonia.Controls.PanAndZoom { /// <summary> /// Zoom helper methods. /// </summary> public static class ZoomHelper { /// <summary> /// Calculate scrollable properties. /// </summary> /// <param name="bounds">The view bounds.</param> /// <param name="matrix">The transform matrix.</param> /// <param name="extent">The extent of the scrollable content.</param> /// <param name="viewport">The size of the viewport.</param> /// <param name="offset">The current scroll offset.</param> public static void CalculateScrollable(Rect bounds, Matrix matrix, out Size extent, out Size viewport, out Vector offset) { var transformed = bounds.TransformToAABB(matrix); var width = transformed.Size.Width; var height = transformed.Size.Height; var x = matrix.M31; var y = matrix.M32; extent = new Size( width + Math.Abs(x), height + Math.Abs(y)); viewport = bounds.Size; var offsetX = x < 0 ? Abs(x) : 0; var offsetY = y < 0 ? Abs(y) : 0; offset = new Vector(offsetX, offsetY); } } }
using System; namespace Avalonia.Controls.PanAndZoom { /// <summary> /// Zoom helper methods. /// </summary> public static class ZoomHelper { /// <summary> /// Calculate scrollable properties. /// </summary> /// <param name="bounds">The view bounds.</param> /// <param name="matrix">The transform matrix.</param> /// <param name="extent">The extent of the scrollable content.</param> /// <param name="viewport">The size of the viewport.</param> /// <param name="offset">The current scroll offset.</param> public static void CalculateScrollable(Rect bounds, Matrix matrix, out Size extent, out Size viewport, out Vector offset) { var transformed = bounds.TransformToAABB(matrix); var width = transformed.Size.Width; var height = transformed.Size.Height; var x = transformed.Position.X; var y = transformed.Position.Y; extent = new Size(width + Math.Abs(x), height + Math.Abs(y)); var offsetX = x < 0 ? extent.Width + x : 0; var offsetY = y < 0 ? extent.Height + y : 0; offset = new Vector(offsetX, offsetY); viewport = bounds.Size; } } }
mit
C#
051f80be9012b24b34e7c46f06ad44e8867069c5
Fix docs typo
grokys/Perspex,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,grokys/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia
src/Avalonia.Diagnostics/DevToolsExtensions.cs
src/Avalonia.Diagnostics/DevToolsExtensions.cs
using Avalonia.Controls; using Avalonia.Diagnostics; using Avalonia.Input; namespace Avalonia { /// <summary> /// Extension methods for attaching DevTools.. /// </summary> public static class DevToolsExtensions { /// <summary> /// Attaches DevTools to a window, to be opened with the F12 key. /// </summary> /// <param name="root">The window to attach DevTools to.</param> public static void AttachDevTools(this TopLevel root) { DevTools.Attach(root, new DevToolsOptions()); } /// <summary> /// Attaches DevTools to a window, to be opened with the specified key gesture. /// </summary> /// <param name="root">The window to attach DevTools to.</param> /// <param name="gesture">The key gesture to open DevTools.</param> public static void AttachDevTools(this TopLevel root, KeyGesture gesture) { DevTools.Attach(root, gesture); } /// <summary> /// Attaches DevTools to a window, to be opened with the specified options. /// </summary> /// <param name="root">The window to attach DevTools to.</param> /// <param name="options">Additional settings of DevTools.</param> public static void AttachDevTools(this TopLevel root, DevToolsOptions options) { DevTools.Attach(root, options); } } }
using Avalonia.Controls; using Avalonia.Diagnostics; using Avalonia.Input; namespace Avalonia { /// <summary> /// Extension methods for attaching DevTools.. /// </summary> public static class DevToolsExtensions { /// <summary> /// Attaches DevTools to a window, to be opened with the F12 key. /// </summary> /// <param name="root">The window to attach DevTools to.</param> public static void AttachDevTools(this TopLevel root) { DevTools.Attach(root, new DevToolsOptions()); } /// <summary> /// Attaches DevTools to a window, to be opened with the specified key gesture. /// </summary> /// <param name="root">The window to attach DevTools to.</param> /// <param name="gesture">The key gesture to open DevTools.</param> public static void AttachDevTools(this TopLevel root, KeyGesture gesture) { DevTools.Attach(root, gesture); } /// <summary> /// Attaches DevTools to a window, to be opened with the specified options. /// </summary> /// <param name="root">The window to attach DevTools to.</param> /// <param name="options">additional settint of DevTools</param> public static void AttachDevTools(this TopLevel root, DevToolsOptions options) { DevTools.Attach(root, options); } } }
mit
C#
23cb3deb4ce4ed5ccbdfdaca7b283205ee3a9621
Update ISelection.cs
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
src/Draw2D/ViewModels/Tools/Core/ISelection.cs
src/Draw2D/ViewModels/Tools/Core/ISelection.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Draw2D.ViewModels.Tools { public interface ISelection : IDirty { void Cut(IToolContext context); void Copy(IToolContext context); void Paste(IToolContext context); void Delete(IToolContext context); void CreateGroup(IToolContext context); void CreateReference(IToolContext context); void CreatePath(IToolContext context); void AlignLeft(IToolContext context); void AlignCentered(IToolContext context); void AlignTop(IToolContext context); void AlignCenter(IToolContext context); void AlignBottom(IToolContext context); void ArangeBringToFront(IToolContext context); void ArangeBringForward(IToolContext context); void ArangeSendBackward(IToolContext context); void ArangeSendToBack(IToolContext context); void ArangeReverse(IToolContext context); void Break(IToolContext context); void SelectAll(IToolContext context); void DeselectAll(IToolContext context); void Connect(IToolContext context, IPointShape point); void Disconnect(IToolContext context, IPointShape point); void Disconnect(IToolContext context, IBaseShape shape); } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Draw2D.ViewModels.Tools { public interface ISelection : IDirty { void Cut(IToolContext context); void Copy(IToolContext context); void Paste(IToolContext context); void Delete(IToolContext context); void CreateGroup(IToolContext context); void CreateReference(IToolContext context); void CreatePath(IToolContext context); void Break(IToolContext context); void SelectAll(IToolContext context); void DeselectAll(IToolContext context); void Connect(IToolContext context, IPointShape point); void Disconnect(IToolContext context, IPointShape point); void Disconnect(IToolContext context, IBaseShape shape); } }
mit
C#
553bf26425325ca13347874ba5ae5d4dfe595aa4
Make AudioObject poolable.
dimixar/audio-controller-unity
AudioController/Assets/Source/AudioObject.cs
AudioController/Assets/Source/AudioObject.cs
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(AudioSource))] public class AudioObject : MonoBehaviour, IPoolable { public System.Action<AudioObject> OnFinishedPlaying; #region private fields private string _id; private AudioClip _clip; private AudioSource _source; private Coroutine _playingRoutine; private bool _isFree = true; #endregion #region Public methods and properties public string clipName { get { return _clip != null ? _clip.name : "NONE"; } } public void Setup(string id, AudioClip clip) { _id = id; _clip = clip; } public void Play() { if (_source == null) _source = GetComponent<AudioSource>(); _source.clip = _clip; _source.Play(); _isFree = false; _playingRoutine = StartCoroutine(PlayingRoutine()); } public void Stop() { if (_playingRoutine == null) return; _source.Stop(); } [ContextMenu("Test Play")] private void TestPlay() { Play(); } #endregion private IEnumerator PlayingRoutine() { Debug.Log("Playing Started"); while (true) { Debug.Log("Checking if it's playing."); yield return new WaitForSeconds(0.05f); if (!_source.isPlaying) { Debug.Log("AudioSource Finished Playing"); break; } } Debug.Log("Not playing anymore"); if (OnFinishedPlaying != null) { OnFinishedPlaying(this); } _source.clip = null; _playingRoutine = null; _isFree = true; } #region IPoolable methods public bool IsFree() { return _isFree; } #endregion }
using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(AudioSource))] public class AudioObject : MonoBehaviour { public System.Action<AudioObject> OnFinishedPlaying; #region private fields private string _id; private AudioClip _clip; private AudioSource _source; private Coroutine _playingRoutine; private bool _isFree = true; #endregion #region Public methods and properties public string clipName { get { return _clip != null ? _clip.name : "NONE"; } } public bool isFree { get { return _isFree; } } public void Setup(string id, AudioClip clip) { _id = id; _clip = clip; } public void Play() { if (_source == null) _source = GetComponent<AudioSource>(); _source.clip = _clip; _source.Play(); _isFree = false; _playingRoutine = StartCoroutine(PlayingRoutine()); } public void Stop() { if (_playingRoutine == null) return; _source.Stop(); } [ContextMenu("Test Play")] private void TestPlay() { Play(); } #endregion private IEnumerator PlayingRoutine() { Debug.Log("Playing Started"); while (true) { Debug.Log("Checking if it's playing."); yield return new WaitForSeconds(0.05f); if (!_source.isPlaying) { Debug.Log("AudioSource Finished Playing"); break; } } Debug.Log("Not playing anymore"); if (OnFinishedPlaying != null) { OnFinishedPlaying(this); } _source.clip = null; _playingRoutine = null; _isFree = true; } }
mit
C#
ad88839b1434e351bfd1b768c5d39e1a831a58d1
Exclude never used method
evincarofautumn/referencesource,stormleoxia/referencesource,mono/referencesource,ludovic-henry/referencesource,directhex/referencesource,esdrubal/referencesource
mscorlib/system/runtime/compilerservices/TypeForwardedToAttribute.cs
mscorlib/system/runtime/compilerservices/TypeForwardedToAttribute.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Reflection; namespace System.Runtime.CompilerServices { using System; [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)] public sealed class TypeForwardedToAttribute : Attribute { private Type _destination; public TypeForwardedToAttribute(Type destination) { _destination = destination; } public Type Destination { get { return _destination; } } #if false [System.Security.SecurityCritical] internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly) { Type[] types = null; RuntimeAssembly.GetForwardedTypes(assembly.GetNativeHandle(), JitHelpers.GetObjectHandleOnStack(ref types)); TypeForwardedToAttribute[] attributes = new TypeForwardedToAttribute[types.Length]; for (int i = 0; i < types.Length; ++i) attributes[i] = new TypeForwardedToAttribute(types[i]); return attributes; } #endif } }
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Reflection; namespace System.Runtime.CompilerServices { using System; [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)] public sealed class TypeForwardedToAttribute : Attribute { private Type _destination; public TypeForwardedToAttribute(Type destination) { _destination = destination; } public Type Destination { get { return _destination; } } [System.Security.SecurityCritical] internal static TypeForwardedToAttribute[] GetCustomAttribute(RuntimeAssembly assembly) { Type[] types = null; RuntimeAssembly.GetForwardedTypes(assembly.GetNativeHandle(), JitHelpers.GetObjectHandleOnStack(ref types)); TypeForwardedToAttribute[] attributes = new TypeForwardedToAttribute[types.Length]; for (int i = 0; i < types.Length; ++i) attributes[i] = new TypeForwardedToAttribute(types[i]); return attributes; } } }
mit
C#
c9118304249614cff634599d28aa4125b26aca5b
Fix tests
JetBrains/teamcity-runas-plugin,JetBrains/teamcity-runas-plugin,JetBrains/teamcity-runas,JetBrains/teamcity-runas,JetBrains/teamcity-runas,JetBrains/teamcity-runas
runAs-tool-win32/JetBrains.runAs.IntegrationTests/Dsl/TestContext.cs
runAs-tool-win32/JetBrains.runAs.IntegrationTests/Dsl/TestContext.cs
namespace JetBrains.runAs.IntegrationTests.Dsl { using System; using System.IO; internal class TestContext { public TestContext() { SandboxPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(new Uri(GetType().Assembly.CodeBase).LocalPath), GetSandboxName())); CurrentDirectory = SandboxPath; CommandLineSetup = new CommandLineSetup { WorkingDirectory = SandboxPath }; RunAsEnvironment.Prepare(SandboxPath, CommandLineSetup); } public string SandboxPath { get; private set; } public string CurrentDirectory { get; set; } public CommandLineSetup CommandLineSetup { get; } public TestSession TestSession { get; set; } public override string ToString() { return $"cd \"{SandboxPath}\""; } private static string GetSandboxName() { return NUnit.Framework.TestContext.CurrentContext.Test.Name? .Replace("(", "_") .Replace(",System.String[]", string.Empty) .Replace("\"", string.Empty) .Replace("\\", string.Empty) .Replace(",null", string.Empty) .Replace(",", "_") .Replace(")", string.Empty) ?? string.Empty; } } }
namespace JetBrains.runAs.IntegrationTests.Dsl { using System; using System.IO; internal class TestContext { public TestContext() { SandboxPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetSandboxName())); CurrentDirectory = SandboxPath; CommandLineSetup = new CommandLineSetup { WorkingDirectory = SandboxPath }; RunAsEnvironment.Prepare(SandboxPath, CommandLineSetup); } public string SandboxPath { get; private set; } public string CurrentDirectory { get; set; } public CommandLineSetup CommandLineSetup { get; } public TestSession TestSession { get; set; } public override string ToString() { return $"cd \"{SandboxPath}\""; } private static string GetSandboxName() { return NUnit.Framework.TestContext.CurrentContext.Test.Name? .Replace("(", "_") .Replace(",System.String[]", string.Empty) .Replace("\"", string.Empty) .Replace("\\", string.Empty) .Replace(",null", string.Empty) .Replace(",", "_") .Replace(")", string.Empty) ?? string.Empty; } } }
apache-2.0
C#
7b40a3107461c1cfed9c8678f95be0633002d385
Set LobbyJoin "one" field to default 1
HelloKitty/Booma.Proxy
src/Booma.Packet.Game/Block/Payloads/Server/BlockLobbyJoinEventPayload.cs
src/Booma.Packet.Game/Block/Payloads/Server/BlockLobbyJoinEventPayload.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma { /// <summary> /// Packet sent to the client telling it to join a lobby. /// </summary> [WireDataContract] [GameServerPacketPayload(GameNetworkOperationCode.LOBBY_JOIN_TYPE)] public sealed partial class BlockLobbyJoinEventPayload : PSOBBGamePacketPayloadServer { //TODO: We can't currently handle this packet. It does something odd the serializer can't handle /// <summary> /// The ID granted to the client that is joining the lobby. /// 0x08 /// </summary> [WireMember(1)] public byte ClientId { get; internal set; } //TODO: What is this? /// <summary> /// 0x09 /// </summary> [WireMember(2)] public byte LeaderId { get; internal set; } //Why is this in some of the packets? /// <summary> /// 0x0A /// </summary> [WireMember(3)] internal byte One { get; set; } = 1; //Why is this sent? Shouldn't we be in the same lobby? /// <summary> /// The number of the lobby being joined. /// 0x0B /// </summary> [WireMember(4)] public byte LobbyNumber { get; internal set; } //Once again, why is this sent? Shouldn't we know what block we're in? /// <summary> /// The number of the block. /// 0x0C /// </summary> [WireMember(5)] public short BlockNumber { get; internal set; } //TODO: What is this for? /// <summary> /// 0x0E /// </summary> [WireMember(6)] public short EventId { get; internal set; } //Sylverant lists this as padding. [WireMember(7)] internal int Padding { get; set; } //TODO: There is more to the packet here: https://github.com/Sylverant/ship_server/blob/b3bffc84b558821ca2002775ab2c3af5c6dde528/src/packets.h#L517 [ReadToEnd] [WireMember(10)] public CharacterJoinData[] LobbyCharacterData { get; internal set; } public BlockLobbyJoinEventPayload(byte clientId, byte leaderId, byte lobbyNumber, short blockNumber, short eventId, CharacterJoinData[] lobbyCharacterData) : this() { ClientId = clientId; LeaderId = leaderId; LobbyNumber = lobbyNumber; BlockNumber = blockNumber; EventId = eventId; LobbyCharacterData = lobbyCharacterData ?? throw new ArgumentNullException(nameof(lobbyCharacterData)); } public BlockLobbyJoinEventPayload() : base(GameNetworkOperationCode.LOBBY_JOIN_TYPE) { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma { /// <summary> /// Packet sent to the client telling it to join a lobby. /// </summary> [WireDataContract] [GameServerPacketPayload(GameNetworkOperationCode.LOBBY_JOIN_TYPE)] public sealed partial class BlockLobbyJoinEventPayload : PSOBBGamePacketPayloadServer { //TODO: We can't currently handle this packet. It does something odd the serializer can't handle /// <summary> /// The ID granted to the client that is joining the lobby. /// 0x08 /// </summary> [WireMember(1)] public byte ClientId { get; internal set; } //TODO: What is this? /// <summary> /// 0x09 /// </summary> [WireMember(2)] public byte LeaderId { get; internal set; } //Why is this in some of the packets? /// <summary> /// 0x0A /// </summary> [WireMember(3)] internal byte One { get; set; } //Why is this sent? Shouldn't we be in the same lobby? /// <summary> /// The number of the lobby being joined. /// 0x0B /// </summary> [WireMember(4)] public byte LobbyNumber { get; internal set; } //Once again, why is this sent? Shouldn't we know what block we're in? /// <summary> /// The number of the block. /// 0x0C /// </summary> [WireMember(5)] public short BlockNumber { get; internal set; } //TODO: What is this for? /// <summary> /// 0x0E /// </summary> [WireMember(6)] public short EventId { get; internal set; } //Sylverant lists this as padding. [WireMember(7)] internal int Padding { get; set; } //TODO: There is more to the packet here: https://github.com/Sylverant/ship_server/blob/b3bffc84b558821ca2002775ab2c3af5c6dde528/src/packets.h#L517 [ReadToEnd] [WireMember(10)] public CharacterJoinData[] LobbyCharacterData { get; internal set; } public BlockLobbyJoinEventPayload(byte clientId, byte leaderId, byte lobbyNumber, short blockNumber, short eventId, CharacterJoinData[] lobbyCharacterData) : this() { ClientId = clientId; LeaderId = leaderId; LobbyNumber = lobbyNumber; BlockNumber = blockNumber; EventId = eventId; LobbyCharacterData = lobbyCharacterData ?? throw new ArgumentNullException(nameof(lobbyCharacterData)); } public BlockLobbyJoinEventPayload() : base(GameNetworkOperationCode.LOBBY_JOIN_TYPE) { } } }
agpl-3.0
C#
d9bf408bf65d3ab95c92493ef3ae17dbb1cce921
Fix #437 (wrong order or parameters in doc comments)
baks/code-cracker,GuilhermeSa/code-cracker,modulexcite/code-cracker,adraut/code-cracker,robsonalves/code-cracker,kindermannhubert/code-cracker,carloscds/code-cracker,jwooley/code-cracker,AlbertoMonteiro/code-cracker,eriawan/code-cracker,code-cracker/code-cracker,thorgeirk11/code-cracker,code-cracker/code-cracker,ElemarJR/code-cracker,andrecarlucci/code-cracker,jhancock93/code-cracker,thomaslevesque/code-cracker,dlsteuer/code-cracker,giggio/code-cracker,caioadz/code-cracker,akamud/code-cracker,carloscds/code-cracker,dmgandini/code-cracker
src/CSharp/CodeCracker/Maintainability/XmlDocumentationCodeFixProvider.cs
src/CSharp/CodeCracker/Maintainability/XmlDocumentationCodeFixProvider.cs
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Syntax; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace CodeCracker.CSharp.Maintainability { public abstract class XmlDocumentationCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DiagnosticId.XmlDocumentation.ToDiagnosticId()); public abstract SyntaxNode FixParameters(MethodDeclarationSyntax method, SyntaxNode root); protected async Task<Document> FixParametersAsync(Document document, Diagnostic diagnostic, CancellationToken c) { var root = await document.GetSyntaxRootAsync(c).ConfigureAwait(false); var documentationNode = root.FindToken(diagnostic.Location.SourceSpan.Start).Parent.AncestorsAndSelf().OfType<MethodDeclarationSyntax>().First(); var newRoot = FixParameters(documentationNode, root); var newDocument = document.WithSyntaxRoot(newRoot); return newDocument; } protected static IEnumerable<Tuple<ParameterSyntax, Tuple<XmlElementSyntax, XmlNameAttributeSyntax>>> GetMethodParametersWithDocParameters(MethodDeclarationSyntax method, DocumentationCommentTriviaSyntax documentationNode) { var methodParameters = method.ParameterList.Parameters; var xElementsWitAttrs = documentationNode.Content.OfType<XmlElementSyntax>() .Where(xEle => xEle.StartTag.Name.LocalName.ValueText == "param") .SelectMany(xEle => xEle.StartTag.Attributes, (xEle, attr) => new Tuple<XmlElementSyntax, XmlNameAttributeSyntax>(xEle, (XmlNameAttributeSyntax)attr)); var keys = methodParameters.Select(parameter => parameter.Identifier.ValueText) .Union(xElementsWitAttrs.Select(x => x.Item2.Identifier.Identifier.ValueText)) .ToImmutableList(); return (from key in keys let Parameter = methodParameters.FirstOrDefault(p => p.Identifier.ValueText == key) let DocParameter = xElementsWitAttrs.FirstOrDefault(p => p.Item2.Identifier.Identifier.ValueText == key) select new Tuple<ParameterSyntax, Tuple<XmlElementSyntax, XmlNameAttributeSyntax>>(Parameter, DocParameter)); } } }
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Syntax; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace CodeCracker.CSharp.Maintainability { public abstract class XmlDocumentationCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DiagnosticId.XmlDocumentation.ToDiagnosticId()); public abstract SyntaxNode FixParameters(MethodDeclarationSyntax method, SyntaxNode root); protected async Task<Document> FixParametersAsync(Document document, Diagnostic diagnostic, CancellationToken c) { var root = await document.GetSyntaxRootAsync(c).ConfigureAwait(false); var documentationNode = root.FindToken(diagnostic.Location.SourceSpan.Start).Parent.AncestorsAndSelf().OfType<MethodDeclarationSyntax>().First(); var newRoot = FixParameters(documentationNode, root); var newDocument = document.WithSyntaxRoot(newRoot); return newDocument; } protected static IEnumerable<Tuple<ParameterSyntax, Tuple<XmlElementSyntax, XmlNameAttributeSyntax>>> GetMethodParametersWithDocParameters(MethodDeclarationSyntax method, DocumentationCommentTriviaSyntax documentationNode) { var methodParameters = method.ParameterList.Parameters; var xElementsWitAttrs = documentationNode.Content.OfType<XmlElementSyntax>() .Where(xEle => xEle.StartTag.Name.LocalName.ValueText == "param") .SelectMany(xEle => xEle.StartTag.Attributes, (xEle, attr) => new Tuple<XmlElementSyntax, XmlNameAttributeSyntax>(xEle, (XmlNameAttributeSyntax)attr)); var keys = methodParameters.Select(parameter => parameter.Identifier.ValueText) .Union(xElementsWitAttrs.Select(x => x.Item2.Identifier.Identifier.ValueText)) .ToImmutableHashSet(); return (from key in keys let Parameter = methodParameters.FirstOrDefault(p => p.Identifier.ValueText == key) let DocParameter = xElementsWitAttrs.FirstOrDefault(p => p.Item2.Identifier.Identifier.ValueText == key) select new Tuple<ParameterSyntax, Tuple<XmlElementSyntax, XmlNameAttributeSyntax>>(Parameter, DocParameter)); } } }
apache-2.0
C#
385486a2b5ba9da0ce09f6a7216148c907cb9340
simplify ConditionalValue
aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,luchaoshuai/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate
src/Abp/Data/ConditionalValue.cs
src/Abp/Data/ConditionalValue.cs
namespace Abp.Data { /// Reference from https://github.com/microsoft/service-fabric/blob/c326b801c6c709f36684700edfe7bb88ceec9d7f/src/prod/src/managed/Microsoft.ServiceFabric.Data.Interfaces/ConditionalResult.cs /// <summary> /// Result class that may or may not return a value. /// </summary> /// <typeparam name="TValue">The type of the value returned by this <cref name="ConditionalValue{TValue}"/>.</typeparam> public struct ConditionalValue<TValue> { /// <summary> /// Initializes a new instance of the <cref name="ConditionalValue{TValue}"/> class with the given value. /// </summary> /// <param name="hasValue">Indicates whether the value is valid.</param> /// <param name="value">The value.</param> public ConditionalValue(bool hasValue, TValue value) { HasValue = hasValue; Value = value; } /// <summary> /// Gets a value indicating whether the current <cref name="ConditionalValue{TValue}"/> object has a valid value of its underlying type. /// </summary> /// <returns><languageKeyword>true</languageKeyword>: Value is valid, <languageKeyword>false</languageKeyword> otherwise.</returns> public bool HasValue { get; } /// <summary> /// Gets the value of the current <cref name="ConditionalValue{TValue}"/> object if it has been assigned a valid underlying value. /// </summary> /// <returns>The value of the object. If HasValue is <languageKeyword>false</languageKeyword>, returns the default value for type of the TValue parameter.</returns> public TValue Value { get; } } }
namespace Abp.Data { /// Reference from https://github.com/microsoft/service-fabric/blob/c326b801c6c709f36684700edfe7bb88ceec9d7f/src/prod/src/managed/Microsoft.ServiceFabric.Data.Interfaces/ConditionalResult.cs /// <summary> /// Result class that may or may not return a value. /// </summary> /// <typeparam name="TValue">The type of the value returned by this <cref name="ConditionalValue{TValue}"/>.</typeparam> public struct ConditionalValue<TValue> { /// <summary> /// Is there a value. /// </summary> private readonly bool hasValue; /// <summary> /// The value. /// </summary> private readonly TValue value; /// <summary> /// Initializes a new instance of the <cref name="ConditionalValue{TValue}"/> class with the given value. /// </summary> /// <param name="hasValue">Indicates whether the value is valid.</param> /// <param name="value">The value.</param> public ConditionalValue(bool hasValue, TValue value) { this.hasValue = hasValue; this.value = value; } /// <summary> /// Gets a value indicating whether the current <cref name="ConditionalValue{TValue}"/> object has a valid value of its underlying type. /// </summary> /// <returns><languageKeyword>true</languageKeyword>: Value is valid, <languageKeyword>false</languageKeyword> otherwise.</returns> public bool HasValue { get { return this.hasValue; } } /// <summary> /// Gets the value of the current <cref name="ConditionalValue{TValue}"/> object if it has been assigned a valid underlying value. /// </summary> /// <returns>The value of the object. If HasValue is <languageKeyword>false</languageKeyword>, returns the default value for type of the TValue parameter.</returns> public TValue Value { get { return this.value; } } } }
mit
C#
6ca16a7fba23ce3551729bbad1a521591a1d481e
Remove BatchResult.ResponseTime
carbon/Amazon
src/Amazon.DynamoDb/BatchResult.cs
src/Amazon.DynamoDb/BatchResult.cs
namespace Amazon.DynamoDb; public sealed class BatchResult { public int BatchCount { get; set; } public int ItemCount { get; set; } public int ErrorCount { get; set; } public int RequestCount { get; set; } }
namespace Amazon.DynamoDb; public sealed class BatchResult { public TimeSpan ResponseTime { get; set; } public int BatchCount { get; set; } public int ItemCount { get; set; } public int ErrorCount { get; set; } public int RequestCount { get; set; } }
mit
C#
3e63f3c21fa4f27988a1cb4f3a4d57f2bf852412
Split tests.
JohanLarsson/Gu.Roslyn.Asserts
Gu.Roslyn.Asserts.Tests/SolutionFileTests.cs
Gu.Roslyn.Asserts.Tests/SolutionFileTests.cs
namespace Gu.Roslyn.Asserts.Tests { using NUnit.Framework; public class SolutionFileTests { [Test] public void TryFind() { Assert.AreEqual(true, SolutionFile.TryFind("Gu.Roslyn.Asserts.sln", out var sln)); Assert.AreEqual("Gu.Roslyn.Asserts.sln", sln.Name); sln = SolutionFile.Find("Gu.Roslyn.Asserts.sln"); Assert.AreEqual("Gu.Roslyn.Asserts.sln", sln.Name); } [Test] public void Find() { var sln = SolutionFile.Find("Gu.Roslyn.Asserts.sln"); Assert.AreEqual("Gu.Roslyn.Asserts.sln", sln.Name); } } }
namespace Gu.Roslyn.Asserts.Tests { using NUnit.Framework; public class SolutionFileTests { [Test] public void FindSolutionFile() { Assert.AreEqual(true, SolutionFile.TryFind("Gu.Roslyn.Asserts.sln", out var sln)); Assert.AreEqual("Gu.Roslyn.Asserts.sln", sln.Name); sln = SolutionFile.Find("Gu.Roslyn.Asserts.sln"); Assert.AreEqual("Gu.Roslyn.Asserts.sln", sln.Name); } } }
mit
C#
d6a514c749f50eb6a55e9773c642c88344f2f8e7
Fix Configuration.cs to be UTF-8
leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net
JoinRpg.Dal.Impl/Migrations/Configuration.cs
JoinRpg.Dal.Impl/Migrations/Configuration.cs
using System; using System.Data.Entity.Migrations; using JetBrains.Annotations; using JoinRpg.DataModel; namespace JoinRpg.Dal.Impl.Migrations { [UsedImplicitly] internal sealed class Configuration : DbMigrationsConfiguration<MyDbContext> { public Configuration() { AutomaticMigrationsEnabled = true; } protected override void Seed(MyDbContext context) { context.UserSet.AddOrUpdate(userinfo => userinfo.UserId, new User { BornName = "Leonid", SurName = "Tsarev", UserName = "[email protected]", Email = "[email protected]", PasswordHash = "AMDQvWY72kqME9N6ZQRnQuo/Vd94C5iBN5ni8lj3ELLIzR7d0brqq5xBt69CQxmjdA==", UserId = 1 }); context.ProjectsSet.AddOrUpdate(project => project.ProjectId, new Project() { ProjectId = 1, Active = true, CreatorUserId = 1, ProjectName = "TestActive", CreatedDate = new DateTime(1970, 1, 1), }); context.Set<ProjectAcl>().AddOrUpdate(pa => pa.ProjectAclId, new ProjectAcl() { ProjectAclId = 1, UserId = 1, CanChangeFields = true, ProjectId = 1 }); context.Set<CharacterGroup>().AddOrUpdate(cg => cg.CharacterGroupId, new CharacterGroup() { CharacterGroupId = 1, ProjectId = 1, IsRoot = true, CharacterGroupName = "Все персонажи на игре", IsActive = true }); } } }
using System; using System.Data.Entity.Migrations; using JetBrains.Annotations; using JoinRpg.DataModel; namespace JoinRpg.Dal.Impl.Migrations { [UsedImplicitly] internal sealed class Configuration : DbMigrationsConfiguration<MyDbContext> { public Configuration() { AutomaticMigrationsEnabled = true; } protected override void Seed(MyDbContext context) { context.UserSet.AddOrUpdate(userinfo => userinfo.UserId, new User { BornName = "Leonid", SurName = "Tsarev", UserName = "[email protected]", Email = "[email protected]", PasswordHash = "AMDQvWY72kqME9N6ZQRnQuo/Vd94C5iBN5ni8lj3ELLIzR7d0brqq5xBt69CQxmjdA==", UserId = 1 }); context.ProjectsSet.AddOrUpdate(project => project.ProjectId, new Project() { ProjectId = 1, Active = true, CreatorUserId = 1, ProjectName = "TestActive", CreatedDate = new DateTime(1970, 1, 1), }); context.Set<ProjectAcl>().AddOrUpdate(pa => pa.ProjectAclId, new ProjectAcl() { ProjectAclId = 1, UserId = 1, CanChangeFields = true, ProjectId = 1 }); context.Set<CharacterGroup>().AddOrUpdate(cg => cg.CharacterGroupId, new CharacterGroup() { CharacterGroupId = 1, ProjectId = 1, IsRoot = true, CharacterGroupName = " ", IsActive = true }); } } }
mit
C#
73439dc1f82c372aecbb1b7ea00cc8854a50cb63
update version to 7.1.33.0
agileharbor/channelAdvisorAccess
src/Global/GlobalAssemblyInfo.cs
src/Global/GlobalAssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "ChannelAdvisorAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "ChannelAdvisor webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( false ) ] // 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "7.1.33.0" ) ]
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "ChannelAdvisorAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "ChannelAdvisor webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( false ) ] // 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "7.1.32.0" ) ]
bsd-3-clause
C#
3e2314f27842ebb1b25ee3bb0adbd7fa3551ca96
Correct check direction. (#1737)
stephentoub/corefxlab,ericstj/corefxlab,tarekgh/corefxlab,whoisj/corefxlab,dotnet/corefxlab,whoisj/corefxlab,benaadams/corefxlab,VSadov/corefxlab,ericstj/corefxlab,dotnet/corefxlab,ericstj/corefxlab,ericstj/corefxlab,VSadov/corefxlab,joshfree/corefxlab,ericstj/corefxlab,VSadov/corefxlab,stephentoub/corefxlab,joshfree/corefxlab,VSadov/corefxlab,stephentoub/corefxlab,adamsitnik/corefxlab,stephentoub/corefxlab,stephentoub/corefxlab,benaadams/corefxlab,adamsitnik/corefxlab,stephentoub/corefxlab,KrzysztofCwalina/corefxlab,tarekgh/corefxlab,ahsonkhan/corefxlab,VSadov/corefxlab,VSadov/corefxlab,ahsonkhan/corefxlab,KrzysztofCwalina/corefxlab,ericstj/corefxlab
src/System.Collections.Sequences/System/Collections/Sequences/Position.cs
src/System.Collections.Sequences/System/Collections/Sequences/Position.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.Runtime.CompilerServices; namespace System.Collections.Sequences { public struct Position : IEquatable<Position> { public object ObjectPosition; public int IntegerPosition; public int Tag; public static readonly Position First = new Position(); public static readonly Position AfterLast = new Position() { IntegerPosition = int.MaxValue - 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator==(Position left, Position right) { return left.Equals(right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator!=(Position left, Position right) { return !left.Equals(right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(Position other) { return IntegerPosition == other.IntegerPosition && ObjectPosition == other.ObjectPosition; } public override int GetHashCode() { return ObjectPosition == null ? IntegerPosition.GetHashCode() : ObjectPosition.GetHashCode(); } public override bool Equals(object obj) { if(obj is Position) return base.Equals((Position)obj); return false; } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Runtime.CompilerServices; namespace System.Collections.Sequences { public struct Position : IEquatable<Position> { public object ObjectPosition; public int IntegerPosition; public int Tag; public static readonly Position First = new Position(); public static readonly Position AfterLast = new Position() { IntegerPosition = int.MaxValue - 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator==(Position left, Position right) { return left.Equals(right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator!=(Position left, Position right) { return left.Equals(right); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(Position other) { return IntegerPosition == other.IntegerPosition && ObjectPosition == other.ObjectPosition; } public override int GetHashCode() { return ObjectPosition == null ? IntegerPosition.GetHashCode() : ObjectPosition.GetHashCode(); } public override bool Equals(object obj) { if(obj is Position) return base.Equals((Position)obj); return false; } } }
mit
C#
73e3b47131c5ed5169456826c245099397ee6068
use async main in Agent
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Agent/Program.cs
src/FilterLists.Agent/Program.cs
using System; using System.IO; using System.Threading.Tasks; using FilterLists.Services.DependencyInjection.Extensions; using FilterLists.Services.Snapshot; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace FilterLists.Agent { public static class Program { private const int BatchSize = 1; private const string AppInsightsKeyConfig = "ApplicationInsights:InstrumentationKey"; private static IConfigurationRoot configRoot; private static ServiceProvider serviceProvider; private static SnapshotService snapshotService; private static Logger logger; public static async Task Main() { BuildConfigRoot(); BuildServiceProvider(); snapshotService = serviceProvider.GetService<SnapshotService>(); using (logger = new Logger(configRoot[AppInsightsKeyConfig])) { await CaptureSnapshots(BatchSize); } } private static void BuildConfigRoot() => configRoot = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", false) .Build(); private static void BuildServiceProvider() { var serviceCollection = new ServiceCollection(); serviceCollection.AddFilterListsAgentServices(configRoot); serviceProvider = serviceCollection.BuildServiceProvider(); } private static async Task CaptureSnapshots(int batchSize) { logger.Log("Capturing FilterList snapshots..."); await TryCaptureAsync(batchSize); logger.Log("Snapshots captured."); } private static async Task TryCaptureAsync(int batchSize) { try { await snapshotService.CaptureAsync(batchSize); } catch (Exception e) { logger.Log(e); } } } }
using System; using System.IO; using System.Threading.Tasks; using FilterLists.Services.DependencyInjection.Extensions; using FilterLists.Services.Snapshot; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace FilterLists.Agent { public static class Program { private const int BatchSize = 1; private const string AppInsightsKeyConfig = "ApplicationInsights:InstrumentationKey"; private static IConfigurationRoot configRoot; private static ServiceProvider serviceProvider; private static SnapshotService snapshotService; private static Logger logger; public static void Main() { BuildConfigRoot(); BuildServiceProvider(); snapshotService = serviceProvider.GetService<SnapshotService>(); using (logger = new Logger(configRoot[AppInsightsKeyConfig])) { CaptureSnapshots(BatchSize); } } private static void BuildConfigRoot() => configRoot = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", false) .Build(); private static void BuildServiceProvider() { var serviceCollection = new ServiceCollection(); serviceCollection.AddFilterListsAgentServices(configRoot); serviceProvider = serviceCollection.BuildServiceProvider(); } private static void CaptureSnapshots(int batchSize) { logger.Log("Capturing FilterList snapshots..."); TryCaptureAsync(batchSize).Wait(); logger.Log("Snapshots captured."); } private static async Task TryCaptureAsync(int batchSize) { try { await snapshotService.CaptureAsync(batchSize); } catch (Exception e) { logger.Log(e); } } } }
mit
C#
a1b867450e58385609f7a18e977f69453b9d8254
build 0.0.6
rachmann/qboAccess,rachmann/qboAccess,rachmann/qboAccess
src/Global/GlobalAssemblyInfo.cs
src/Global/GlobalAssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "QuickBooksOnlineAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "QuickBooksOnline webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( false ) ] // 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "0.0.6.0" ) ]
using System; using System.Reflection; using System.Runtime.InteropServices; [ assembly : ComVisible( false ) ] [ assembly : AssemblyProduct( "QuickBooksOnlineAccess" ) ] [ assembly : AssemblyCompany( "Agile Harbor, LLC" ) ] [ assembly : AssemblyCopyright( "Copyright (C) 2014 Agile Harbor, LLC" ) ] [ assembly : AssemblyDescription( "QuickBooksOnline webservices API wrapper." ) ] [ assembly : AssemblyTrademark( "" ) ] [ assembly : AssemblyCulture( "" ) ] [ assembly : CLSCompliant( false ) ] // 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.*")] // Keep in track with CA API version [ assembly : AssemblyVersion( "0.0.5.0" ) ]
bsd-3-clause
C#
3a04d7ed5bb61a6ebbd03740a80c5995a42a1493
fix possible false-positive in unit-test
nibblesoft/SubDBSharp
src/Helpers/CsvResponseParser.cs
src/Helpers/CsvResponseParser.cs
using System.Collections.Generic; namespace SubDBSharp.Helpers { public class CsvResponseParser : IResponseParser { public IReadOnlyList<Language> ParseGetAvailablesLanguages(string response) { var readonlyList = new List<Language>(); foreach (var isoTwoLetter in response.Split(',')) { if (string.IsNullOrWhiteSpace(isoTwoLetter)) { continue; } var lang = new Language(isoTwoLetter); readonlyList.Add(lang); } return readonlyList; } public IReadOnlyList<Language> ParseSearchSubtitle(string response, bool getVersions) { var listLanguages = new List<Language>(); foreach (var token in response.Split(',')) { // Tokens are available only if getVersion == true string[] tokens = token.Split(':'); Language lang = null; if (getVersions) { lang = new Language(tokens[0], int.Parse(tokens[1])); } else { lang = new Language(tokens[0]); } if (lang != null) { listLanguages.Add(lang); } } return listLanguages; } } }
using System.Collections.Generic; namespace SubDBSharp.Helpers { public class CsvResponseParser : IResponseParser { public IReadOnlyList<Language> ParseGetAvailablesLanguages(string response) { var readonlyList = new List<Language>(); foreach (var isoTwoLetter in response.Split(',')) { var lang = new Language(isoTwoLetter); readonlyList.Add(lang); } return readonlyList; } public IReadOnlyList<Language> ParseSearchSubtitle(string response, bool getVersions) { var listLanguages = new List<Language>(); foreach (var token in response.Split(',')) { // Tokens are available only if getVersion == true string[] tokens = token.Split(':'); Language lang = null; if (getVersions) { lang = new Language(tokens[0], int.Parse(tokens[1])); } else { lang = new Language(tokens[0]); } if (lang != null) { listLanguages.Add(lang); } } return listLanguages; } } }
mit
C#
c5085aea24ae4b08890baac8e894ce208d71af7e
Use Child, not InternalChild
johnneijzen/osu,peppy/osu,johnneijzen/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,2yangk23/osu,EVAST9919/osu,smoogipoo/osu,peppy/osu-new
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osuTK; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ReverseArrowPiece : BeatSyncedContainer { private readonly RepeatPoint repeatPoint; public ReverseArrowPiece(RepeatPoint repeatPoint) { this.repeatPoint = repeatPoint; Divisor = 2; MinimumBeatLength = 200; Anchor = Anchor.Centre; Origin = Anchor.Centre; Blending = BlendingParameters.Additive; Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(0.35f) }, confineMode: ConfineMode.NoScaling) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { if (Clock.CurrentTime < repeatPoint.StartTime) Child.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Audio.Track; using osu.Framework.Graphics; using osuTK; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ReverseArrowPiece : BeatSyncedContainer { private readonly RepeatPoint repeatPoint; public ReverseArrowPiece(RepeatPoint repeatPoint) { this.repeatPoint = repeatPoint; Divisor = 2; MinimumBeatLength = 200; Anchor = Anchor.Centre; Origin = Anchor.Centre; Blending = BlendingParameters.Additive; Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); InternalChild = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(0.35f) }, confineMode: ConfineMode.NoScaling) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { if (Clock.CurrentTime < repeatPoint.StartTime) InternalChild.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); } } }
mit
C#
245fdbb62e91cb0df9414cc68a171e29aa95c0e7
fix build
Eskat0n/NArms
src/NArms.TrenchGun/Benchmark.cs
src/NArms.TrenchGun/Benchmark.cs
namespace NArms.TrenchGun { using System; public class Benchmark { private Benchmark(int passesCount, Action<PassInfo> action) { PassesCount = passesCount; Action = action; } public static Benchmark Create(int passesCount, Action action) { Action<PassInfo> step = info => action(); return Create(passesCount, step); } public static Benchmark Create(int passesCount, Action<int> action) { Action<PassInfo> step = info => action(info.Index); return Create(passesCount, step); } public static Benchmark Create(int passesCount, Action<PassInfo> action) { return new Benchmark(passesCount, action); } public static Benchmark Create<TSuite>(TSuite suite) where TSuite : class, IBenchmarkSuite { throw new NotImplementedException(); } public int PassesCount { get; private set; } public Action<PassInfo> Action { get; private set; } public BenchmarkResults LastResults { get; private set; } public BenchmarkResults Run() { var results = new BenchmarkResults(); for (var i = 1; i <= PassesCount; i++) { var passInfo = new PassInfo(i); var startTime = DateTime.Now; Action(passInfo); var elapsed = startTime - DateTime.Now; results.AddPass(i, elapsed); } return LastResults = results; } } }
namespace NArms.TrenchGun { using System; public class Benchmark { private Benchmark(int passesCount, Action<PassInfo> action) { PassesCount = passesCount; Action = action; } public static Benchmark Create(int passesCount, Action action) { Action<PassInfo> step = info => action(); return Create(passesCount, step); } public static Benchmark Create(int passesCount, Action<int> action) { Action<PassInfo> step = info => action(info.Index); return Create(passesCount, step); } public static Benchmark Create(int passesCount, Action<PassInfo> action) { return new Benchmark(passesCount, action); } public static Benchmark Create<TSuite>(TSuite suite) where TSuite : class, IBenchmarkSuite { return new Benchmark(); } public int PassesCount { get; private set; } public Action<PassInfo> Action { get; private set; } public BenchmarkResults LastResults { get; private set; } public BenchmarkResults Run() { var results = new BenchmarkResults(); for (var i = 1; i <= PassesCount; i++) { var passInfo = new PassInfo(i); var startTime = DateTime.Now; Action(passInfo); var elapsed = startTime - DateTime.Now; results.AddPass(i, elapsed); } return LastResults = results; } } }
mit
C#