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 |
|---|---|---|---|---|---|---|---|---|
5ef10adb860f63673feaf138b0f2dd283fa39133
|
Enable FileSystemWatcher test to actually validate internal buffer size changes
|
CloudLens/corefx,marksmeltzer/corefx,stone-li/corefx,kyulee1/corefx,PatrickMcDonald/corefx,zmaruo/corefx,alphonsekurian/corefx,popolan1986/corefx,krk/corefx,EverlessDrop41/corefx,seanshpark/corefx,seanshpark/corefx,parjong/corefx,oceanho/corefx,rahku/corefx,seanshpark/corefx,twsouthwick/corefx,andyhebear/corefx,alexandrnikitin/corefx,elijah6/corefx,krytarowski/corefx,PatrickMcDonald/corefx,PatrickMcDonald/corefx,the-dwyer/corefx,the-dwyer/corefx,gregg-miskelly/corefx,zhenlan/corefx,ellismg/corefx,manu-silicon/corefx,kkurni/corefx,destinyclown/corefx,the-dwyer/corefx,tstringer/corefx,vrassouli/corefx,MaggieTsang/corefx,iamjasonp/corefx,richlander/corefx,krk/corefx,nchikanov/corefx,zhangwenquan/corefx,parjong/corefx,andyhebear/corefx,scott156/corefx,Alcaro/corefx,brett25/corefx,Petermarcu/corefx,fernando-rodriguez/corefx,zhenlan/corefx,Petermarcu/corefx,gabrielPeart/corefx,anjumrizwi/corefx,marksmeltzer/corefx,matthubin/corefx,adamralph/corefx,mmitche/corefx,jcme/corefx,stone-li/corefx,uhaciogullari/corefx,stephenmichaelf/corefx,ptoonen/corefx,popolan1986/corefx,xuweixuwei/corefx,benpye/corefx,parjong/corefx,mafiya69/corefx,mmitche/corefx,mellinoe/corefx,khdang/corefx,Winsto/corefx,pallavit/corefx,DnlHarvey/corefx,oceanho/corefx,mokchhya/corefx,scott156/corefx,parjong/corefx,alexperovich/corefx,tijoytom/corefx,akivafr123/corefx,CloudLens/corefx,stormleoxia/corefx,vidhya-bv/corefx-sorting,jcme/corefx,MaggieTsang/corefx,misterzik/corefx,jlin177/corefx,huanjie/corefx,khdang/corefx,brett25/corefx,lggomez/corefx,destinyclown/corefx,claudelee/corefx,mafiya69/corefx,misterzik/corefx,weltkante/corefx,mokchhya/corefx,chenkennt/corefx,bpschoch/corefx,kyulee1/corefx,brett25/corefx,mazong1123/corefx,benjamin-bader/corefx,mmitche/corefx,shimingsg/corefx,Petermarcu/corefx,jeremymeng/corefx,manu-silicon/corefx,cydhaselton/corefx,jcme/corefx,benpye/corefx,jcme/corefx,Yanjing123/corefx,Jiayili1/corefx,rjxby/corefx,vidhya-bv/corefx-sorting,ravimeda/corefx,dhoehna/corefx,twsouthwick/corefx,alexperovich/corefx,tijoytom/corefx,zhangwenquan/corefx,DnlHarvey/corefx,KrisLee/corefx,ptoonen/corefx,shmao/corefx,nbarbettini/corefx,stephenmichaelf/corefx,shmao/corefx,vidhya-bv/corefx-sorting,rubo/corefx,alexperovich/corefx,PatrickMcDonald/corefx,rahku/corefx,vidhya-bv/corefx-sorting,lggomez/corefx,Yanjing123/corefx,krytarowski/corefx,arronei/corefx,gkhanna79/corefx,khdang/corefx,kkurni/corefx,mokchhya/corefx,Alcaro/corefx,billwert/corefx,parjong/corefx,Jiayili1/corefx,twsouthwick/corefx,bitcrazed/corefx,stormleoxia/corefx,jmhardison/corefx,jcme/corefx,dtrebbien/corefx,shahid-pk/corefx,shmao/corefx,thiagodin/corefx,shiftkey-tester/corefx,stephenmichaelf/corefx,vrassouli/corefx,twsouthwick/corefx,uhaciogullari/corefx,pallavit/corefx,mafiya69/corefx,Ermiar/corefx,krytarowski/corefx,Frank125/corefx,larsbj1988/corefx,Frank125/corefx,huanjie/corefx,erpframework/corefx,690486439/corefx,matthubin/corefx,shahid-pk/corefx,dhoehna/corefx,MaggieTsang/corefx,cartermp/corefx,DnlHarvey/corefx,ellismg/corefx,axelheer/corefx,YoupHulsebos/corefx,Jiayili1/corefx,dtrebbien/corefx,benpye/corefx,josguil/corefx,fffej/corefx,lggomez/corefx,weltkante/corefx,krk/corefx,YoupHulsebos/corefx,janhenke/corefx,yizhang82/corefx,dotnet-bot/corefx,janhenke/corefx,zhangwenquan/corefx,shana/corefx,akivafr123/corefx,weltkante/corefx,matthubin/corefx,BrennanConroy/corefx,rubo/corefx,nbarbettini/corefx,Ermiar/corefx,khdang/corefx,rajansingh10/corefx,lydonchandra/corefx,akivafr123/corefx,JosephTremoulet/corefx,ravimeda/corefx,cartermp/corefx,heXelium/corefx,scott156/corefx,comdiv/corefx,thiagodin/corefx,cartermp/corefx,uhaciogullari/corefx,gabrielPeart/corefx,krytarowski/corefx,ptoonen/corefx,krytarowski/corefx,richlander/corefx,stone-li/corefx,cartermp/corefx,SGuyGe/corefx,manu-silicon/corefx,rubo/corefx,iamjasonp/corefx,MaggieTsang/corefx,shahid-pk/corefx,jcme/corefx,shimingsg/corefx,pgavlin/corefx,n1ghtmare/corefx,alexandrnikitin/corefx,nchikanov/corefx,PatrickMcDonald/corefx,bitcrazed/corefx,benjamin-bader/corefx,dotnet-bot/corefx,dhoehna/corefx,bitcrazed/corefx,gkhanna79/corefx,viniciustaveira/corefx,wtgodbe/corefx,fgreinacher/corefx,stone-li/corefx,dtrebbien/corefx,chenkennt/corefx,Jiayili1/corefx,mokchhya/corefx,benjamin-bader/corefx,Chrisboh/corefx,tstringer/corefx,YoupHulsebos/corefx,pallavit/corefx,lggomez/corefx,benjamin-bader/corefx,stephenmichaelf/corefx,Alcaro/corefx,iamjasonp/corefx,cnbin/corefx,krk/corefx,bitcrazed/corefx,SGuyGe/corefx,shimingsg/corefx,nchikanov/corefx,khdang/corefx,mazong1123/corefx,Priya91/corefx-1,zmaruo/corefx,nbarbettini/corefx,zhenlan/corefx,rubo/corefx,CherryCxldn/corefx,alphonsekurian/corefx,yizhang82/corefx,nchikanov/corefx,dotnet-bot/corefx,vs-team/corefx,wtgodbe/corefx,axelheer/corefx,chaitrakeshav/corefx,VPashkov/corefx,janhenke/corefx,VPashkov/corefx,tijoytom/corefx,billwert/corefx,chenxizhang/corefx,anjumrizwi/corefx,Frank125/corefx,dtrebbien/corefx,ravimeda/corefx,rajansingh10/corefx,billwert/corefx,josguil/corefx,DnlHarvey/corefx,rjxby/corefx,vidhya-bv/corefx-sorting,vs-team/corefx,dsplaisted/corefx,stone-li/corefx,dkorolev/corefx,wtgodbe/corefx,comdiv/corefx,marksmeltzer/corefx,zmaruo/corefx,larsbj1988/corefx,stephenmichaelf/corefx,jeremymeng/corefx,manu-silicon/corefx,uhaciogullari/corefx,n1ghtmare/corefx,nchikanov/corefx,bpschoch/corefx,viniciustaveira/corefx,alexperovich/corefx,richlander/corefx,DnlHarvey/corefx,gkhanna79/corefx,rahku/corefx,dkorolev/corefx,ravimeda/corefx,iamjasonp/corefx,richlander/corefx,nchikanov/corefx,kyulee1/corefx,vijaykota/corefx,axelheer/corefx,xuweixuwei/corefx,Jiayili1/corefx,jlin177/corefx,nelsonsar/corefx,mellinoe/corefx,mazong1123/corefx,huanjie/corefx,nchikanov/corefx,dkorolev/corefx,bpschoch/corefx,billwert/corefx,n1ghtmare/corefx,zhenlan/corefx,lydonchandra/corefx,YoupHulsebos/corefx,lydonchandra/corefx,stormleoxia/corefx,mellinoe/corefx,vijaykota/corefx,erpframework/corefx,bitcrazed/corefx,shiftkey-tester/corefx,the-dwyer/corefx,tstringer/corefx,SGuyGe/corefx,rjxby/corefx,lydonchandra/corefx,Petermarcu/corefx,billwert/corefx,billwert/corefx,MaggieTsang/corefx,shrutigarg/corefx,yizhang82/corefx,690486439/corefx,billwert/corefx,shrutigarg/corefx,dsplaisted/corefx,n1ghtmare/corefx,dhoehna/corefx,dkorolev/corefx,mafiya69/corefx,elijah6/corefx,alexandrnikitin/corefx,shmao/corefx,s0ne0me/corefx,krytarowski/corefx,CloudLens/corefx,Priya91/corefx-1,zhangwenquan/corefx,kkurni/corefx,heXelium/corefx,arronei/corefx,parjong/corefx,shimingsg/corefx,krytarowski/corefx,Chrisboh/corefx,krk/corefx,nelsonsar/corefx,mmitche/corefx,nbarbettini/corefx,kkurni/corefx,ravimeda/corefx,ellismg/corefx,nbarbettini/corefx,Priya91/corefx-1,mmitche/corefx,Yanjing123/corefx,vs-team/corefx,mellinoe/corefx,ViktorHofer/corefx,alphonsekurian/corefx,richlander/corefx,pallavit/corefx,DnlHarvey/corefx,Winsto/corefx,josguil/corefx,iamjasonp/corefx,jlin177/corefx,adamralph/corefx,jeremymeng/corefx,690486439/corefx,scott156/corefx,weltkante/corefx,benjamin-bader/corefx,gkhanna79/corefx,tijoytom/corefx,690486439/corefx,KrisLee/corefx,ellismg/corefx,fffej/corefx,larsbj1988/corefx,shahid-pk/corefx,Chrisboh/corefx,lggomez/corefx,tstringer/corefx,nelsonsar/corefx,ViktorHofer/corefx,JosephTremoulet/corefx,anjumrizwi/corefx,chenxizhang/corefx,cydhaselton/corefx,mmitche/corefx,SGuyGe/corefx,rajansingh10/corefx,oceanho/corefx,cydhaselton/corefx,krk/corefx,gkhanna79/corefx,fgreinacher/corefx,thiagodin/corefx,VPashkov/corefx,rahku/corefx,MaggieTsang/corefx,nbarbettini/corefx,khdang/corefx,zhenlan/corefx,josguil/corefx,Ermiar/corefx,BrennanConroy/corefx,wtgodbe/corefx,shahid-pk/corefx,KrisLee/corefx,vijaykota/corefx,shrutigarg/corefx,ViktorHofer/corefx,akivafr123/corefx,lggomez/corefx,wtgodbe/corefx,fffej/corefx,ravimeda/corefx,JosephTremoulet/corefx,jeremymeng/corefx,kyulee1/corefx,larsbj1988/corefx,elijah6/corefx,claudelee/corefx,janhenke/corefx,axelheer/corefx,cnbin/corefx,SGuyGe/corefx,yizhang82/corefx,EverlessDrop41/corefx,weltkante/corefx,alphonsekurian/corefx,tstringer/corefx,fffej/corefx,cnbin/corefx,yizhang82/corefx,heXelium/corefx,fernando-rodriguez/corefx,ellismg/corefx,popolan1986/corefx,alphonsekurian/corefx,seanshpark/corefx,KrisLee/corefx,fgreinacher/corefx,seanshpark/corefx,mokchhya/corefx,brett25/corefx,shana/corefx,ellismg/corefx,pallavit/corefx,kkurni/corefx,Winsto/corefx,wtgodbe/corefx,690486439/corefx,shrutigarg/corefx,shmao/corefx,VPashkov/corefx,cydhaselton/corefx,ptoonen/corefx,wtgodbe/corefx,JosephTremoulet/corefx,jlin177/corefx,ViktorHofer/corefx,ericstj/corefx,spoiledsport/corefx,Yanjing123/corefx,jlin177/corefx,jhendrixMSFT/corefx,viniciustaveira/corefx,mellinoe/corefx,Frank125/corefx,jmhardison/corefx,Petermarcu/corefx,mazong1123/corefx,shmao/corefx,pallavit/corefx,shiftkey-tester/corefx,marksmeltzer/corefx,stephenmichaelf/corefx,SGuyGe/corefx,jmhardison/corefx,matthubin/corefx,krk/corefx,shimingsg/corefx,mazong1123/corefx,rahku/corefx,parjong/corefx,lggomez/corefx,nbarbettini/corefx,alexperovich/corefx,jhendrixMSFT/corefx,elijah6/corefx,shiftkey-tester/corefx,CloudLens/corefx,dotnet-bot/corefx,BrennanConroy/corefx,Petermarcu/corefx,xuweixuwei/corefx,vrassouli/corefx,janhenke/corefx,rjxby/corefx,dotnet-bot/corefx,fgreinacher/corefx,axelheer/corefx,fernando-rodriguez/corefx,nelsonsar/corefx,andyhebear/corefx,chenkennt/corefx,benpye/corefx,seanshpark/corefx,huanjie/corefx,arronei/corefx,richlander/corefx,pgavlin/corefx,s0ne0me/corefx,chaitrakeshav/corefx,richlander/corefx,stone-li/corefx,Priya91/corefx-1,gabrielPeart/corefx,mafiya69/corefx,yizhang82/corefx,alphonsekurian/corefx,dhoehna/corefx,comdiv/corefx,twsouthwick/corefx,mazong1123/corefx,cydhaselton/corefx,andyhebear/corefx,iamjasonp/corefx,adamralph/corefx,claudelee/corefx,stone-li/corefx,shimingsg/corefx,shana/corefx,cnbin/corefx,rajansingh10/corefx,heXelium/corefx,kkurni/corefx,YoupHulsebos/corefx,dhoehna/corefx,stephenmichaelf/corefx,jhendrixMSFT/corefx,jhendrixMSFT/corefx,mokchhya/corefx,spoiledsport/corefx,iamjasonp/corefx,stormleoxia/corefx,chenxizhang/corefx,cydhaselton/corefx,Petermarcu/corefx,pgavlin/corefx,s0ne0me/corefx,ptoonen/corefx,rahku/corefx,manu-silicon/corefx,cydhaselton/corefx,gregg-miskelly/corefx,rubo/corefx,ViktorHofer/corefx,elijah6/corefx,jhendrixMSFT/corefx,alexperovich/corefx,manu-silicon/corefx,the-dwyer/corefx,ericstj/corefx,gabrielPeart/corefx,viniciustaveira/corefx,pgavlin/corefx,comdiv/corefx,MaggieTsang/corefx,jhendrixMSFT/corefx,chaitrakeshav/corefx,JosephTremoulet/corefx,shahid-pk/corefx,ptoonen/corefx,Jiayili1/corefx,manu-silicon/corefx,benpye/corefx,tstringer/corefx,oceanho/corefx,tijoytom/corefx,benpye/corefx,YoupHulsebos/corefx,ericstj/corefx,elijah6/corefx,seanshpark/corefx,jmhardison/corefx,cartermp/corefx,destinyclown/corefx,chaitrakeshav/corefx,erpframework/corefx,josguil/corefx,weltkante/corefx,n1ghtmare/corefx,weltkante/corefx,CherryCxldn/corefx,dotnet-bot/corefx,mazong1123/corefx,Chrisboh/corefx,marksmeltzer/corefx,Chrisboh/corefx,mellinoe/corefx,alexperovich/corefx,rjxby/corefx,gregg-miskelly/corefx,alexandrnikitin/corefx,mmitche/corefx,CherryCxldn/corefx,rahku/corefx,erpframework/corefx,ericstj/corefx,ericstj/corefx,janhenke/corefx,marksmeltzer/corefx,dhoehna/corefx,marksmeltzer/corefx,twsouthwick/corefx,dotnet-bot/corefx,EverlessDrop41/corefx,jeremymeng/corefx,ravimeda/corefx,benjamin-bader/corefx,ericstj/corefx,thiagodin/corefx,DnlHarvey/corefx,s0ne0me/corefx,ericstj/corefx,josguil/corefx,akivafr123/corefx,Chrisboh/corefx,the-dwyer/corefx,bpschoch/corefx,Ermiar/corefx,jlin177/corefx,CherryCxldn/corefx,shmao/corefx,ViktorHofer/corefx,spoiledsport/corefx,shimingsg/corefx,elijah6/corefx,vrassouli/corefx,jlin177/corefx,Ermiar/corefx,axelheer/corefx,JosephTremoulet/corefx,zhenlan/corefx,Priya91/corefx-1,tijoytom/corefx,gkhanna79/corefx,rjxby/corefx,cartermp/corefx,gregg-miskelly/corefx,misterzik/corefx,ViktorHofer/corefx,dsplaisted/corefx,vs-team/corefx,jhendrixMSFT/corefx,yizhang82/corefx,Ermiar/corefx,alphonsekurian/corefx,anjumrizwi/corefx,shana/corefx,JosephTremoulet/corefx,ptoonen/corefx,twsouthwick/corefx,YoupHulsebos/corefx,mafiya69/corefx,alexandrnikitin/corefx,gkhanna79/corefx,Ermiar/corefx,zhenlan/corefx,zmaruo/corefx,Jiayili1/corefx,rjxby/corefx,Alcaro/corefx,Priya91/corefx-1,claudelee/corefx,Yanjing123/corefx,tijoytom/corefx,the-dwyer/corefx
|
src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.InternalBufferSize.cs
|
src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.InternalBufferSize.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Threading;
using Xunit;
public partial class FileSystemWatcher_4000_Tests
{
[Fact]
public static void FileSystemWatcher_InternalBufferSize_File()
{
using (var file = Utility.CreateTestFile())
using (var watcher = new FileSystemWatcher("."))
{
watcher.Filter = Path.GetFileName(file.Path);
ManualResetEvent unblockHandler = new ManualResetEvent(false);
watcher.Changed += (o, e) =>
{
// block the handling thread
unblockHandler.WaitOne();
};
AutoResetEvent eventOccured = new AutoResetEvent(false);
watcher.Error += (o, e) =>
{
eventOccured.Set();
};
watcher.EnableRaisingEvents = true;
// See note in FileSystemWatcher_Error_File
int originalInternalBufferOperationCapacity = watcher.InternalBufferSize / (16 + 2 * (file.Path.Length + 1));
for (int i = 1; i < originalInternalBufferOperationCapacity * 2; i++)
{
File.SetLastWriteTime(file.Path, DateTime.Now + TimeSpan.FromSeconds(i));
}
unblockHandler.Set();
Utility.ExpectEvent(eventOccured, "error");
// Update InternalBufferSize to accomadate the data
watcher.InternalBufferSize = watcher.InternalBufferSize * 2;
unblockHandler.Reset();
// Send the same number of events.
for (int i = 1; i < originalInternalBufferOperationCapacity * 2; i++)
{
File.SetLastWriteTime(file.Path, DateTime.Now + TimeSpan.FromSeconds(i));
}
unblockHandler.Set();
// This time we should not see an error
Utility.ExpectNoEvent(eventOccured, "error");
}
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Threading;
using Xunit;
public partial class FileSystemWatcher_4000_Tests
{
[Fact]
public static void FileSystemWatcher_InternalBufferSize_File()
{
using (var file = Utility.CreateTestFile())
using (var watcher = new FileSystemWatcher("."))
{
watcher.Filter = Path.GetFileName(file.Path);
ManualResetEvent unblockHandler = new ManualResetEvent(false);
watcher.Changed += (o, e) =>
{
// block the handling thread
unblockHandler.WaitOne();
};
AutoResetEvent eventOccured = new AutoResetEvent(false);
watcher.Error += (o, e) =>
{
eventOccured.Set();
};
watcher.EnableRaisingEvents = true;
// See note in FileSystemWatcher_Error_File
int originalInternalBufferOperationCapacity = watcher.InternalBufferSize / (16 + 2 * (file.Path.Length + 1));
for (int i = 1; i < originalInternalBufferOperationCapacity * 2; i++)
{
File.SetLastWriteTime(file.Path, DateTime.Now + TimeSpan.FromSeconds(i));
}
unblockHandler.Set();
Utility.ExpectEvent(eventOccured, "error");
// Update InternalBufferSize to accomadate the data
watcher.InternalBufferSize = watcher.InternalBufferSize * 2;
unblockHandler.Reset();
// Send the same number of events.
for (int i = 1; i < originalInternalBufferOperationCapacity * 2; i++)
{
File.SetLastWriteTime(file.Path, DateTime.Now + TimeSpan.FromSeconds(i));
}
// This time we should not see an error
Utility.ExpectNoEvent(eventOccured, "error");
}
}
}
|
mit
|
C#
|
e604c18d9299f111d5305b696b7babf5e9368cd8
|
Resolve compiler warnings from BenchmarkDotNet upgrade
|
AArnott/Nerdbank.FullDuplexStream
|
src/Nerdbank.Streams.Benchmark/BenchmarkConfig.cs
|
src/Nerdbank.Streams.Benchmark/BenchmarkConfig.cs
|
// Copyright (c) Andrew Arnott. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Nerdbank.Streams.Benchmark
{
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
internal class BenchmarkConfig : ManualConfig
{
public BenchmarkConfig()
{
this.Add(DefaultConfig.Instance.AddDiagnoser(MemoryDiagnoser.Default));
}
}
}
|
// Copyright (c) Andrew Arnott. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Nerdbank.Streams.Benchmark
{
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
internal class BenchmarkConfig : ManualConfig
{
public BenchmarkConfig()
{
this.Add(DefaultConfig.Instance.With(MemoryDiagnoser.Default));
}
}
}
|
mit
|
C#
|
6f42b16095756ba461982ddb693ad98817dad41a
|
Add comment
|
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
|
VisualStudioProjects/ArrayDataGraphic/ArrayDataGraphic/CSharpFiles/DataArray.cs
|
VisualStudioProjects/ArrayDataGraphic/ArrayDataGraphic/CSharpFiles/DataArray.cs
|
/********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* DataArray.cs *
* 本檔案建立繪圖資料佇列單元物件 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArrayDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class DataArray // DataArray class, DataArray類別
{ // DataArray class start, 開始DataArray類別
} // DataArray class end, 結束DataArray類別
} // namespace end, 結束命名空間
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArrayDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class DataArray
{
}
} // namespace end, 結束命名空間
|
apache-2.0
|
C#
|
15c3f50628228a04453e930c52da89058ae620a2
|
Implement PlayerPrefs for mission storage
|
00christian00/unity3d-levelup,00christian00/unity3d-levelup,vedi/unity3d-levelup,00christian00/unity3d-levelup,vedi/unity3d-levelup,00christian00/unity3d-levelup,vedi/unity3d-levelup,00christian00/unity3d-levelup,vedi/unity3d-levelup,vedi/unity3d-levelup
|
Soomla/Assets/Plugins/Soomla/Levelup/data/MissionStorage.cs
|
Soomla/Assets/Plugins/Soomla/Levelup/data/MissionStorage.cs
|
/// Copyright (C) 2012-2014 Soomla Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
using UnityEngine;
using System;
namespace Soomla.Levelup
{
public class MissionStorage
{
protected const string TAG = "SOOMLA MissionStorage"; // used for Log error messages
static MissionStorage _instance = null;
static MissionStorage instance {
get {
if(_instance == null) {
#if UNITY_ANDROID && !UNITY_EDITOR
_instance = new MissionStorageAndroid();
#elif UNITY_IOS && !UNITY_EDITOR
_instance = new MissionStorageIOS();
#else
_instance = new MissionStorage();
#endif
}
return _instance;
}
}
public static void SetCompleted(Mission mission, bool completed) {
instance._setCompleted (mission, completed, true);
}
public static void SetCompleted(Mission mission, bool completed, bool notify) {
instance._setCompleted(mission, completed, notify);
}
public static bool IsCompleted(Mission mission) {
return instance._isCompleted(mission);
}
protected void _setCompleted(Mission mission, bool completed, bool notify) {
string key = keyMissionCompleted (mission.MissionId);
if (completed) {
PlayerPrefs.SetString(key, "yes");
if (notify) {
LevelUpEvents.OnMissionCompleted(mission);
}
} else {
PlayerPrefs.DeleteKey(key);
if (notify) {
LevelUpEvents.OnMissionCompletionRevoked(mission);
}
}
}
protected bool _isCompleted(Mission mission) {
string key = keyMissionCompleted (mission.MissionId);
string val = PlayerPrefs.GetString (key);
return val != null;
}
private static string keyMissions(string missionId, string postfix) {
return LevelUp.DB_KEY_PREFIX + "missions." + missionId + "." + postfix;
}
private static string keyMissionCompleted(string missionId) {
return keyMissions(missionId, "completed");
}
}
}
|
/// Copyright (C) 2012-2014 Soomla Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
using UnityEngine;
using System;
namespace Soomla.Levelup
{
public class MissionStorage
{
protected const string TAG = "SOOMLA MissionStorage"; // used for Log error messages
static MissionStorage _instance = null;
static MissionStorage instance {
get {
if(_instance == null) {
#if UNITY_ANDROID && !UNITY_EDITOR
_instance = new MissionStorageAndroid();
#elif UNITY_IOS && !UNITY_EDITOR
_instance = new MissionStorageIOS();
#else
_instance = new MissionStorage();
#endif
}
return _instance;
}
}
public static void SetCompleted(Mission mission, bool completed) {
instance._setCompleted (mission, completed, true);
}
public static void SetCompleted(Mission mission, bool completed, bool notify) {
instance._setCompleted(mission, completed, notify);
}
public static bool IsCompleted(Mission mission) {
return instance._isCompleted(mission);
}
virtual protected void _setCompleted(Mission mission, bool open, bool notify) {
// TODO: WIE
}
virtual protected bool _isCompleted(Mission mission) {
// TODO: WIE
return false;
}
}
}
|
apache-2.0
|
C#
|
17e243b7be8b433710abf80c800e9c711110b3b1
|
Update Source/Libraries/openXDA.Configuration/DataPusherSection.cs
|
GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA,GridProtectionAlliance/openXDA
|
Source/Libraries/openXDA.Configuration/DataPusherSection.cs
|
Source/Libraries/openXDA.Configuration/DataPusherSection.cs
|
//******************************************************************************************************
// DataPusherSection.cs - Gbtc
//
// Copyright © 2021, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
// file except in compliance with the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 02/08/2021 - Stephen C. Wills
// Generated original version of source code.
//
//******************************************************************************************************
using System;
using System.ComponentModel;
using System.Configuration;
using GSF.Configuration;
namespace openXDA.Configuration
{
public class DataPusherSection
{
public const string CategoryName = "DataPusher";
[Setting]
[DefaultValue("systemSettings")]
public string ConnectionString { get; set; }
}
}
|
//******************************************************************************************************
// FilePrunerSection.cs - Gbtc
//
// Copyright © 2021, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
// file except in compliance with the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 02/08/2021 - Stephen C. Wills
// Generated original version of source code.
//
//******************************************************************************************************
using System;
using System.ComponentModel;
using System.Configuration;
using GSF.Configuration;
namespace openXDA.Configuration
{
public class DataPusherSection
{
public const string CategoryName = "DataPusher";
[Setting]
[DefaultValue("systemSettings")]
public string ConnectionString { get; set; }
}
}
|
mit
|
C#
|
146ac92a63b4228cb0d345c636aa58b4e5b9dcf8
|
Rename refactoring.
|
gimlichael/CuemonCore,gimlichael/Cuemon,gimlichael/Cuemon
|
src/Cuemon.Extensions.AspNetCore.Authentication/ApplicationBuilderExtensions.cs
|
src/Cuemon.Extensions.AspNetCore.Authentication/ApplicationBuilderExtensions.cs
|
using System;
using Cuemon.AspNetCore.Authentication.Basic;
using Cuemon.AspNetCore.Authentication.Digest;
using Cuemon.AspNetCore.Authentication.Hmac;
using Cuemon.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
namespace Cuemon.Extensions.AspNetCore.Authentication
{
/// <summary>
/// Extension methods for the <see cref="IApplicationBuilder"/> interface.
/// </summary>
public static class ApplicationBuilderExtensions
{
/// <summary>
/// Adds a HTTP Basic Authentication scheme to the <see cref="IApplicationBuilder"/> request execution pipeline.
/// </summary>
/// <param name="builder">The type that provides the mechanisms to configure an application’s request pipeline.</param>
/// <param name="setup">The HTTP <see cref="BasicAuthenticationOptions"/> middleware which may be configured.</param>
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
public static IApplicationBuilder UseBasicAuthentication(this IApplicationBuilder builder, Action<BasicAuthenticationOptions> setup = null)
{
return MiddlewareBuilderFactory.UseConfigurableMiddleware<BasicAuthenticationMiddleware, BasicAuthenticationOptions>(builder, setup);
}
/// <summary>
/// Adds a HTTP Digest Authentication scheme to the <see cref="IApplicationBuilder"/> request execution pipeline.
/// </summary>
/// <param name="builder">The type that provides the mechanisms to configure an application’s request pipeline.</param>
/// <param name="setup">The HTTP <see cref="DigestAuthenticationMiddleware"/> middleware which may be configured.</param>
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
public static IApplicationBuilder UseDigestAccessAuthentication(this IApplicationBuilder builder, Action<DigestAuthenticationOptions> setup = null)
{
return MiddlewareBuilderFactory.UseConfigurableMiddleware<DigestAuthenticationMiddleware, DigestAuthenticationOptions>(builder, setup);
}
/// <summary>
/// Adds a HTTP HMAC Authentication scheme to the <see cref="IApplicationBuilder"/> request execution pipeline.
/// </summary>
/// <param name="builder">The type that provides the mechanisms to configure an application’s request pipeline.</param>
/// <param name="setup">The HTTP <see cref="HmacAuthenticationOptions"/> middleware which may be configured.</param>
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
public static IApplicationBuilder UseHmacAuthentication(this IApplicationBuilder builder, Action<HmacAuthenticationOptions> setup = null)
{
return MiddlewareBuilderFactory.UseConfigurableMiddleware<HmacAuthenticationMiddleware, HmacAuthenticationOptions>(builder, setup);
}
}
}
|
using System;
using Cuemon.AspNetCore.Authentication;
using Cuemon.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
namespace Cuemon.Extensions.AspNetCore.Authentication
{
/// <summary>
/// Extension methods for the <see cref="IApplicationBuilder"/> interface.
/// </summary>
public static class ApplicationBuilderExtensions
{
/// <summary>
/// Adds a HTTP Basic Authentication scheme to the <see cref="IApplicationBuilder"/> request execution pipeline.
/// </summary>
/// <param name="builder">The type that provides the mechanisms to configure an application’s request pipeline.</param>
/// <param name="setup">The HTTP <see cref="BasicAuthenticationOptions"/> middleware which may be configured.</param>
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
public static IApplicationBuilder UseBasicAuthentication(this IApplicationBuilder builder, Action<BasicAuthenticationOptions> setup = null)
{
return MiddlewareBuilderFactory.UseConfigurableMiddleware<BasicAuthenticationMiddleware, BasicAuthenticationOptions>(builder, setup);
}
/// <summary>
/// Adds a HTTP Digest Authentication scheme to the <see cref="IApplicationBuilder"/> request execution pipeline.
/// </summary>
/// <param name="builder">The type that provides the mechanisms to configure an application’s request pipeline.</param>
/// <param name="setup">The HTTP <see cref="DigestAccessAuthenticationMiddleware"/> middleware which may be configured.</param>
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
public static IApplicationBuilder UseDigestAccessAuthentication(this IApplicationBuilder builder, Action<DigestAccessAuthenticationOptions> setup = null)
{
return MiddlewareBuilderFactory.UseConfigurableMiddleware<DigestAccessAuthenticationMiddleware, DigestAccessAuthenticationOptions>(builder, setup);
}
/// <summary>
/// Adds a HTTP HMAC Authentication scheme to the <see cref="IApplicationBuilder"/> request execution pipeline.
/// </summary>
/// <param name="builder">The type that provides the mechanisms to configure an application’s request pipeline.</param>
/// <param name="setup">The HTTP <see cref="HmacAuthenticationOptions"/> middleware which may be configured.</param>
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
public static IApplicationBuilder UseHmacAuthentication(this IApplicationBuilder builder, Action<HmacAuthenticationOptions> setup = null)
{
return MiddlewareBuilderFactory.UseConfigurableMiddleware<HmacAuthenticationMiddleware, HmacAuthenticationOptions>(builder, setup);
}
}
}
|
mit
|
C#
|
5373c3066ffc070476c1402b7032aa3e8f3846c6
|
Use `OsuAnimatedButton` as base for `ControlItemClose`
|
peppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu
|
osu.Game/Overlays/Chat/ChannelControl/ControlItemClose.cs
|
osu.Game/Overlays/Chat/ChannelControl/ControlItemClose.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Overlays.Chat.ChannelControl
{
public class ControlItemClose : OsuAnimatedButton
{
[BackgroundDependencyLoader]
private void load(OsuColour osuColour)
{
Alpha = 0f;
Size = new Vector2(20);
Add(new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.75f),
Icon = FontAwesome.Solid.TimesCircle,
RelativeSizeAxes = Axes.Both,
Colour = osuColour.Red1,
});
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osuTK;
namespace osu.Game.Overlays.Chat.ChannelControl
{
public class ControlItemClose : OsuClickableContainer
{
private readonly SpriteIcon icon;
[Resolved]
private OsuColour osuColour { get; set; } = null!;
public ControlItemClose()
{
Alpha = 0f;
Size = new Vector2(20);
Child = icon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.75f),
Icon = FontAwesome.Solid.TimesCircle,
RelativeSizeAxes = Axes.Both,
};
}
protected override bool OnMouseDown(MouseDownEvent e)
{
icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
return base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseUpEvent e)
{
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
base.OnMouseUp(e);
}
protected override bool OnHover(HoverEvent e)
{
icon.FadeColour(osuColour.Red1, 200, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
icon.FadeColour(Colour4.White, 200, Easing.OutQuint);
base.OnHoverLost(e);
}
}
}
|
mit
|
C#
|
af62e04123ef3c3e5975038ba17f804553424993
|
Use HostConstants in the extensions.
|
shiftkey/SignalR,shiftkey/SignalR
|
SignalR/Abstractions/HostContextExtensions.cs
|
SignalR/Abstractions/HostContextExtensions.cs
|
namespace SignalR.Abstractions
{
public static class HostContextExtensions
{
public static T GetValue<T>(this HostContext context, string key)
{
object value;
if (context.Items.TryGetValue(key, out value))
{
return (T)value;
}
return default(T);
}
public static bool IsDebuggingEnabled(this HostContext context)
{
return context.GetValue<bool>(HostConstants.DebugMode);
}
public static bool SupportsWebSockets(this HostContext context)
{
return context.GetValue<bool>(HostConstants.SupportsWebSockets);
}
}
}
|
namespace SignalR.Abstractions
{
public static class HostContextExtensions
{
public static T GetValue<T>(this HostContext context, string key)
{
object value;
if (context.Items.TryGetValue(key, out value))
{
return (T)value;
}
return default(T);
}
public static bool IsDebuggingEnabled(this HostContext context)
{
return context.GetValue<bool>("debugMode");
}
public static bool SupportsWebSockets(this HostContext context)
{
return context.GetValue<bool>("supportsWebSockets");
}
}
}
|
mit
|
C#
|
dce301019512040585e0f8e8a29107a60c63be7f
|
Fix error in build
|
nunit/nunit-console,nunit/nunit-console,nunit/nunit-console
|
src/direct-runner/TestEventListener.cs
|
src/direct-runner/TestEventListener.cs
|
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.IO;
using NUnit.Framework.Api;
namespace NUnit.DirectRunner
{
class TestEventListener : MarshalByRefObject, ITestListener
{
CommandLineOptions options;
TextWriter outWriter;
int level = 0;
string prefix = "";
public TestEventListener(CommandLineOptions options, TextWriter outWriter)
{
this.options = options;
this.outWriter = outWriter;
}
#region ITestListener Members
public void TestStarted(ITest test)
{
level++;
prefix = new string('>', level);
if(options.Labels)
outWriter.WriteLine("{0} {1}", prefix, test.Name);
}
public void TestFinished(ITestResult result)
{
level--;
prefix = new string('>', level);
}
public void TestOutput(TestOutput testOutput)
{
outWriter.Write(testOutput.Text);
}
#endregion
}
}
|
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.IO;
using NUnit.Framework.Api;
namespace NUnit.AdhocTestRunner
{
class TestEventListener : MarshalByRefObject, ITestListener
{
CommandLineOptions options;
TextWriter outWriter;
int level = 0;
string prefix = "";
public TestEventListener(CommandLineOptions options, TextWriter outWriter)
{
this.options = options;
this.outWriter = outWriter;
}
#region ITestListener Members
public void TestStarted(ITest test)
{
level++;
prefix = new string('>', level);
if(options.Labels)
outWriter.WriteLine("{0} {1}", prefix, test.Name);
}
public void TestFinished(ITestResult result)
{
level--;
prefix = new string('>', level);
}
public void TestOutput(TestOutput testOutput)
{
outWriter.Write(testOutput.Text);
}
#endregion
}
}
|
mit
|
C#
|
a9430c1d3bf2129e4543dd8f66178994451deedd
|
Update Version
|
takuya-takeuchi/RedArmory
|
source/RedArmory/AssemblyProperty.cs
|
source/RedArmory/AssemblyProperty.cs
|
namespace Ouranos.RedArmory
{
internal static class AssemblyProperty
{
/// <summary>
/// アセンブリ マニフェストに含める、製品名に関するカスタム属性を定義します。
/// </summary>
public const string Product = "Red Armory";
/// <summary>
/// RedArmory.exe の説明を指定します。
/// </summary>
public const string Title = "Red Armory";
/// <summary>
/// アセンブリ マニフェストに含める、会社名に関するカスタム属性を定義します。
/// </summary>
public const string Company = "";
/// <summary>
/// アセンブリ マニフェストに含める、著作権に関するカスタム属性を表します。
/// </summary>
public const string Copyright = "Copyright © Takuya Takeuchi All Rights Reserved.";
/// <summary>
/// アセンブリ マニフェストに含める、ファイル バージョンを定義します。
/// </summary>
public const string FileVersion = "1.8.0.2";
/// <summary>
/// アセンブリ マニフェストに含める、アセンブリ バージョンを定義します。
/// </summary>
public const string Version = "1.8.0.2";
}
}
|
namespace Ouranos.RedArmory
{
internal static class AssemblyProperty
{
/// <summary>
/// アセンブリ マニフェストに含める、製品名に関するカスタム属性を定義します。
/// </summary>
public const string Product = "Red Armory";
/// <summary>
/// RedArmory.exe の説明を指定します。
/// </summary>
public const string Title = "Red Armory";
/// <summary>
/// アセンブリ マニフェストに含める、会社名に関するカスタム属性を定義します。
/// </summary>
public const string Company = "";
/// <summary>
/// アセンブリ マニフェストに含める、著作権に関するカスタム属性を表します。
/// </summary>
public const string Copyright = "Copyright © Takuya Takeuchi All Rights Reserved.";
/// <summary>
/// アセンブリ マニフェストに含める、ファイル バージョンを定義します。
/// </summary>
public const string FileVersion = "1.8.0.1";
/// <summary>
/// アセンブリ マニフェストに含める、アセンブリ バージョンを定義します。
/// </summary>
public const string Version = "1.8.0.1";
}
}
|
mit
|
C#
|
c0adb8b02924d2d9c79aad4531cd62fce81809ef
|
Update feed uri, blog platform transition
|
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
|
src/Firehose.Web/Authors/JoshKing.cs
|
src/Firehose.Web/Authors/JoshKing.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JoshKing : IAmACommunityMember
{
public string FirstName => "Josh";
public string LastName => "King";
public string ShortBioOrTagLine => "Geek, Father, Walking Helpdesk";
public string StateOrRegion => "Hawke's Bay, NZ";
public string EmailAddress => "joshua@king.geek.nz";
public string TwitterHandle => "WindosNZ";
public string GitHubHandle => "Windos";
public string GravatarHash => "fafdbc410c9adf8c4d2235d37470859a";
public GeoPosition Position => new GeoPosition(-39.4928, 176.9120);
public Uri WebSite => new Uri("https://king.geek.nz/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://king.geek.nz/tag/powershell/rss/"); } }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class JoshKing : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Josh";
public string LastName => "King";
public string ShortBioOrTagLine => "Geek, Father, Walking Helpdesk";
public string StateOrRegion => "Hawke's Bay, NZ";
public string EmailAddress => "joshua@king.geek.nz";
public string TwitterHandle => "WindosNZ";
public string GitHubHandle => "Windos";
public string GravatarHash => "fafdbc410c9adf8c4d2235d37470859a";
public GeoPosition Position => new GeoPosition(-39.4928, 176.9120);
public Uri WebSite => new Uri("https://king.geek.nz/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://king.geek.nz/feed.xml"); } }
public bool Filter(SyndicationItem item)
{
return item.Categories.Where(i => i.Name.Equals("powershell", StringComparison.OrdinalIgnoreCase)).Any();
}
}
}
|
mit
|
C#
|
57dec365e41cec0f9104dd2d13e134c66a59832b
|
Allow escaped percentage
|
feliwir/openSage,feliwir/openSage
|
src/OpenSage.Core/StringConverter.cs
|
src/OpenSage.Core/StringConverter.cs
|
namespace OpenSage.Core
{
/// <summary>
/// Convert a printf formatted string to a C# formatted string
/// </summary>
public class StringConverter
{
//TODO: implement this properly
public static string FromPrintf(string printf)
{
string result = "";
int index = 0;
int state = 0;
foreach (var c in printf)
{
if (state == 0)
{
if (c == '%')
{
state = 1;
}
else
{
result += c;
}
}
else if (state == 1)
{
if (c == 'f' || c == 'i')
{
result += "{" + index + "}";
index++;
state = 0;
}
// Percentage was escaped
if(c == '%')
{
result += c;
state = 0;
}
}
}
return result;
}
}
}
|
namespace OpenSage.Core
{
/// <summary>
/// Convert a printf formatted string to a C# formatted string
/// </summary>
public class StringConverter
{
//TODO: implement this properly
public static string FromPrintf(string printf)
{
string result = "";
int index = 0;
int state = 0;
foreach (var c in printf)
{
if (state == 0)
{
if (c == '%')
{
state = 1;
}
else
{
result += c;
}
}
else if (state == 1)
{
if (c == 'f' || c == 'i')
{
result += "{" + index + "}";
index++;
state = 0;
}
}
}
return result;
}
}
}
|
mit
|
C#
|
8bbc4ae93807db5cd1ec1a49c62cfb28cdc60e8d
|
add TODO
|
StefanoFiumara/Harry-Potter-Unity
|
Assets/Scripts/HarryPotterUnity/Cards/Transfiguration/Items/PhilosophersStone.cs
|
Assets/Scripts/HarryPotterUnity/Cards/Transfiguration/Items/PhilosophersStone.cs
|
using System.Collections.Generic;
using System.Linq;
using HarryPotterUnity.Enums;
namespace HarryPotterUnity.Cards.Transfiguration.Items
{
public class PhilosophersStone : BaseItem
{
public override bool CanPerformInPlayAction()
{
return Player.CanUseActions(2) && Player.IsLocalPlayer;
}
//TODO: Test This
public override void OnInPlayAction(List<BaseCard> targets = null)
{
var allCards = Player.Discard.GetHealableCards();
var lessons = allCards.Where(c => c.Type == Type.Lesson);
var other = allCards.Where(c => c.Type != Type.Lesson);
Player.InPlay.AddAll(lessons);
Player.Deck.AddAll(other);
Player.Deck.Shuffle();
Player.UseActions(2);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using HarryPotterUnity.Enums;
namespace HarryPotterUnity.Cards.Transfiguration.Items
{
public class PhilosophersStone : BaseItem
{
public override bool CanPerformInPlayAction()
{
return Player.CanUseActions(2) && Player.IsLocalPlayer;
}
public override void OnInPlayAction(List<BaseCard> targets = null)
{
var allCards = Player.Discard.GetHealableCards();
var lessons = allCards.Where(c => c.Type == Type.Lesson);
var other = allCards.Where(c => c.Type != Type.Lesson);
Player.InPlay.AddAll(lessons);
Player.Deck.AddAll(other);
Player.Deck.Shuffle();
Player.UseActions(2);
}
}
}
|
mit
|
C#
|
ab3b70f1aa708dde92f97ba5410aa70bfc873130
|
fix log file on linux
|
TravisTX/TfsSlackFactory
|
src/TfsSlackFactory/Program.cs
|
src/TfsSlackFactory/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Sinks.RollingFile;
namespace TfsSlackFactory
{
public class Program
{
public static void Main(string[] args)
{
Serilog.Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.RollingFile(Path.Combine("logs", "log-{Date}.txt"))
.WriteTo.ColoredConsole()
.CreateLogger();
Serilog.Log.Information("Starting TfsSlackFactory");
var hostingApplication = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
hostingApplication.Run();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Sinks.RollingFile;
namespace TfsSlackFactory
{
public class Program
{
public static void Main(string[] args)
{
Serilog.Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.RollingFile(@"logs\log-{Date}.txt")
.WriteTo.ColoredConsole()
.CreateLogger();
Serilog.Log.Information("Starting TfsSlackFactory");
var hostingApplication = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
hostingApplication.Run();
}
}
}
|
mit
|
C#
|
07c40e45fc82e459a93a37af1c3ffcf0c73e35de
|
Refactor `UITestFixture`
|
atata-framework/atata-webdriverextras,atata-framework/atata-webdriverextras
|
test/Atata.WebDriverExtras.Tests/UITestFixture.cs
|
test/Atata.WebDriverExtras.Tests/UITestFixture.cs
|
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace Atata.WebDriverExtras.Tests
{
[TestFixture]
public abstract class UITestFixture
{
public const string BaseUrl = "http://localhost:57440/";
protected IWebDriver Driver { get; private set; }
[SetUp]
public virtual void SetUp()
{
Driver = new ChromeDriver();
}
[TearDown]
public void TearDown()
{
Driver?.Close();
Driver?.Dispose();
}
protected IWebDriver GoTo(string relativeUrl)
{
Driver.Navigate().GoToUrl(BaseUrl + relativeUrl);
return Driver;
}
}
}
|
using NUnit.Framework;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
namespace Atata.WebDriverExtras.Tests
{
[TestFixture]
public abstract class UITestFixture
{
public const string BaseUrl = "http://localhost:57440/";
protected RemoteWebDriver Driver { get; private set; }
[SetUp]
public virtual void SetUp()
{
Driver = new ChromeDriver();
}
[TearDown]
public void TearDown()
{
Driver?.Close();
Driver?.Dispose();
}
protected RemoteWebDriver GoTo(string relativeUrl)
{
Driver.Navigate().GoToUrl(BaseUrl + relativeUrl);
return Driver;
}
}
}
|
apache-2.0
|
C#
|
8430e0fa86cb4c19ae1061729bac2e4a15411b62
|
Switch the LIcenseDialog to be optionally WebView2
|
gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop
|
src/BloomExe/Registration/LicenseDialog.cs
|
src/BloomExe/Registration/LicenseDialog.cs
|
using System;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using SIL.IO;
namespace Bloom.Registration
{
public partial class LicenseDialog : Form
{
private Browser _licenseBrowser;
/// <summary>
/// Initialize a new instance of the <see cref="Bloom.Registration.LicenseDialog"/> class.
/// </summary>
/// <param name="licenseMdFile">filename of the license in HTML format</param>
/// <param name="prolog">prolog to the license (optional, already localized)</param>
/// <remarks>
/// The HTML file content should be suitable for inserting inside a body element.
/// (I.e., it should not contain html, head, or body elements.)
/// </remarks>
public LicenseDialog(string licenseHtmlFile, string prolog = null)
{
InitializeComponent();
Text = string.Format(Text, Assembly.GetExecutingAssembly().GetName().Version);
// If there's no prolog, normalize the variable to an empty string.
// If there is a prolog, add a horizontal rule separating the prolog from the license.
if (String.IsNullOrWhiteSpace(prolog))
prolog = String.Empty;
else
prolog = String.Format("<p>{0}</p>{1}<hr>{1}", prolog, Environment.NewLine);
_licenseBrowser = BrowserMaker.MakeBrowser();
_licenseBrowser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
_licenseBrowser.Location = new Point(12, 12);
_licenseBrowser.Name = "licenseBrowser";
_licenseBrowser.Size = new Size(_acceptButton.Right - 12, _acceptButton.Top - 24);
Controls.Add(_licenseBrowser);
var locale = CultureInfo.CurrentUICulture.Name;
string licenseFilePath = BloomFileLocator.GetBrowserFile(false, licenseHtmlFile);
var localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".htm";
if (RobustFile.Exists(localizedLicenseFilePath))
licenseFilePath = localizedLicenseFilePath;
else
{
var index = locale.IndexOf('-');
if (index > 0)
{
locale = locale.Substring(0, index);
localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".htm";
if (RobustFile.Exists(localizedLicenseFilePath))
licenseFilePath = localizedLicenseFilePath;
}
}
var contents = prolog + RobustFile.ReadAllText(licenseFilePath, Encoding.UTF8);
var html = string.Format("<html><head><head/><body style=\"font-family:sans-serif\">{0}</body></html>", contents);
_licenseBrowser.NavigateRawHtml(html);
_licenseBrowser.Visible = true;
}
}
}
|
using System;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using SIL.IO;
namespace Bloom.Registration
{
public partial class LicenseDialog : Form
{
private GeckoFxBrowser _licenseBrowser;
/// <summary>
/// Initialize a new instance of the <see cref="Bloom.Registration.LicenseDialog"/> class.
/// </summary>
/// <param name="licenseMdFile">filename of the license in HTML format</param>
/// <param name="prolog">prolog to the license (optional, already localized)</param>
/// <remarks>
/// The HTML file content should be suitable for inserting inside a body element.
/// (I.e., it should not contain html, head, or body elements.)
/// </remarks>
public LicenseDialog(string licenseHtmlFile, string prolog = null)
{
InitializeComponent();
Text = string.Format(Text, Assembly.GetExecutingAssembly().GetName().Version);
// If there's no prolog, normalize the variable to an empty string.
// If there is a prolog, add a horizontal rule separating the prolog from the license.
if (String.IsNullOrWhiteSpace(prolog))
prolog = String.Empty;
else
prolog = String.Format("<p>{0}</p>{1}<hr>{1}", prolog, Environment.NewLine);
_licenseBrowser = new GeckoFxBrowser();
_licenseBrowser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
_licenseBrowser.Location = new Point(12, 12);
_licenseBrowser.Name = "licenseBrowser";
_licenseBrowser.Size = new Size(_acceptButton.Right - 12, _acceptButton.Top - 24);
Controls.Add(_licenseBrowser);
var locale = CultureInfo.CurrentUICulture.Name;
string licenseFilePath = BloomFileLocator.GetBrowserFile(false, licenseHtmlFile);
var localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".htm";
if (RobustFile.Exists(localizedLicenseFilePath))
licenseFilePath = localizedLicenseFilePath;
else
{
var index = locale.IndexOf('-');
if (index > 0)
{
locale = locale.Substring(0, index);
localizedLicenseFilePath = licenseFilePath.Substring(0, licenseFilePath.Length - 3) + "-" + locale + ".htm";
if (RobustFile.Exists(localizedLicenseFilePath))
licenseFilePath = localizedLicenseFilePath;
}
}
var contents = prolog + RobustFile.ReadAllText(licenseFilePath, Encoding.UTF8);
var html = string.Format("<html><head><head/><body style=\"font-family:sans-serif\">{0}</body></html>", contents);
_licenseBrowser.NavigateRawHtml(html);
_licenseBrowser.Visible = true;
}
}
}
|
mit
|
C#
|
b6bc268cb2ba55af7ffc61489a45b31e675e5ced
|
Allow inline <script> tags and don't wrap them in another script tag - allows syntax highlighting and intellisense on AddInlineScript: Bundles.AddInlineScript(@<script type="text/javascript"> var i = 1;</script>);
|
BluewireTechnologies/cassette,andrewdavey/cassette,damiensawyer/cassette,honestegg/cassette,damiensawyer/cassette,honestegg/cassette,andrewdavey/cassette,andrewdavey/cassette,honestegg/cassette,damiensawyer/cassette,BluewireTechnologies/cassette
|
src/Cassette/Scripts/InlineScriptBundle.cs
|
src/Cassette/Scripts/InlineScriptBundle.cs
|
using System;
using System.Text.RegularExpressions;
using Cassette.Configuration;
namespace Cassette.Scripts
{
internal class InlineScriptBundle : ScriptBundle
{
readonly string scriptContent;
public InlineScriptBundle(string scriptContent)
{
this.scriptContent = scriptContent;
}
protected override void ProcessCore(CassetteSettings settings)
{
}
static readonly Regex DetectScriptRegex = new Regex(@"\A \s* <script \b",
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
/// <summary>
/// Handle cases of the content already wrapped in a <script> tag.
/// </summary>
/// <returns></returns>
protected string GetScriptContent()
{
var isContentScriptTag = scriptContent != null &&
DetectScriptRegex.IsMatch(scriptContent, 0);
var htmlAttributes = HtmlAttributes.CombinedAttributes; // should start with a space
if (isContentScriptTag)
{
return DetectScriptRegex.Replace(scriptContent,
m => m.Value + htmlAttributes, 1, 0); // don't need a space after the attributes - the regex is checking for "\b"
}
return String.Format(
HtmlConstants.InlineScriptHtml,
htmlAttributes,
Environment.NewLine,
scriptContent
);
}
internal override string Render()
{
var content = GetScriptContent();
var conditionalRenderer = new ConditionalRenderer();
return conditionalRenderer.Render(Condition, html => html.Append(content));
}
}
}
|
using System;
using Cassette.Configuration;
namespace Cassette.Scripts
{
class InlineScriptBundle : ScriptBundle
{
readonly string scriptContent;
public InlineScriptBundle(string scriptContent)
{
this.scriptContent = scriptContent;
}
protected override void ProcessCore(CassetteSettings settings)
{
}
internal override string Render()
{
var content = string.Format(
HtmlConstants.InlineScriptHtml,
HtmlAttributes.CombinedAttributes,
Environment.NewLine,
scriptContent
);
var conditionalRenderer = new ConditionalRenderer();
return conditionalRenderer.Render(Condition, html => html.Append(content));
}
}
}
|
mit
|
C#
|
a050412a043b714062e903bae39be3fd7b8cca95
|
Add helptext
|
unosquare/sshdeploy
|
Unosquare.Labs.SshDeploy/Options/CliOptions.cs
|
Unosquare.Labs.SshDeploy/Options/CliOptions.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Unosquare.Swan.Attributes;
namespace Unosquare.Labs.SshDeploy.Options
{
public class CliOptions
{
[VerbOption("push", HelpText = "Transfers the files and folders from a source path in the local machine to a target path in the remote machine")]
public PushVerbOptions PushVerbOptions { get; set; }
[VerbOption("monitor", HelpText = "Monitors a folder for a deployment and automatically transfers the files over the target.")]
public MonitorVerbOptions MonitorVerbOptions { get; set; }
[VerbOption("run", HelpText = "Runs the specified command on the target machine")]
public RunVerbOptions RunVerbOptions { get; set; }
[VerbOption("shell", HelpText = "Opens an interactive mode shell")]
public ShellVerbOptions ShellVerbOptions { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Unosquare.Swan.Attributes;
namespace Unosquare.Labs.SshDeploy.Options
{
public class CliOptions
{
[VerbOption("push")]
public PushVerbOptions PushVerbOptions { get; set; }
[VerbOption("monitor")]
public MonitorVerbOptions MonitorVerbOptions { get; set; }
[VerbOption("run")]
public RunVerbOptions RunVerbOptions { get; set; }
[VerbOption("shell")]
public ShellVerbOptions ShellVerbOptions { get; set; }
}
}
|
mit
|
C#
|
c616e25c1c3e5d61651a9a6f3bfcb715c072fe64
|
Check for forum notifications more often.
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
src/MitternachtBot/Common/TimeConstants.cs
|
src/MitternachtBot/Common/TimeConstants.cs
|
namespace Mitternacht.Common {
public class TimeConstants {
public const int WaitForForum = 500;
public const int TeamUpdate = 3 * 60 * 1000;
public const int Birthday = 60 * 1000;
public const int ForumNotification = 30 * 1000;
}
}
|
namespace Mitternacht.Common {
public class TimeConstants {
public const int WaitForForum = 500;
public const int TeamUpdate = 3 * 60 * 1000;
public const int Birthday = 60 * 1000;
public const int ForumNotification = 1 * 60 * 1000;
}
}
|
mit
|
C#
|
ea8f6fe514d9ae63f76cefd752f6f3ef066b7ace
|
Update doc
|
jasonmalinowski/roslyn,bartdesmet/roslyn,dotnet/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mavasani/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,bartdesmet/roslyn,bartdesmet/roslyn
|
src/Workspaces/Core/Portable/Remote/PinnedSolutionInfo.cs
|
src/Workspaces/Core/Portable/Remote/PinnedSolutionInfo.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.Runtime.Serialization;
namespace Microsoft.CodeAnalysis.Remote
{
/// <summary>
/// Information related to pinned solution
/// </summary>
[DataContract]
internal sealed class PinnedSolutionInfo
{
/// <summary>
/// Checksum for the pinned solution. Ensures that OOP synchronization requests can unique identify which
/// in-flight solution-snapshots they correspond to.
/// </summary>
[DataMember(Order = 0)]
public readonly Checksum SolutionChecksum;
/// <summary>
/// This indicates whether this scope is for primary branch or not (not forked solution)
///
/// Features like OOP will use this flag to see whether caching information related to this solution
/// can benefit other requests or not
/// </summary>
[DataMember(Order = 1)]
public readonly bool FromPrimaryBranch;
/// <summary>
/// This indicates a Solution.WorkspaceVersion of this solution. remote host engine uses this version
/// to decide whether caching this solution will benefit other requests or not
/// </summary>
[DataMember(Order = 2)]
public readonly int WorkspaceVersion;
public PinnedSolutionInfo(
Checksum solutionChecksum,
bool fromPrimaryBranch,
int workspaceVersion)
{
SolutionChecksum = solutionChecksum;
FromPrimaryBranch = fromPrimaryBranch;
WorkspaceVersion = workspaceVersion;
}
}
}
|
// 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.Runtime.Serialization;
namespace Microsoft.CodeAnalysis.Remote
{
/// <summary>
/// Information related to pinned solution
/// </summary>
[DataContract]
internal sealed class PinnedSolutionInfo
{
/// <summary>
/// Unique ID for this pinned solution
///
/// This later used to find matching solution between VS and remote host
/// </summary>
[DataMember(Order = 0)]
public readonly Checksum SolutionChecksum;
/// <summary>
/// This indicates whether this scope is for primary branch or not (not forked solution)
///
/// Features like OOP will use this flag to see whether caching information related to this solution
/// can benefit other requests or not
/// </summary>
[DataMember(Order = 1)]
public readonly bool FromPrimaryBranch;
/// <summary>
/// This indicates a Solution.WorkspaceVersion of this solution. remote host engine uses this version
/// to decide whether caching this solution will benefit other requests or not
/// </summary>
[DataMember(Order = 2)]
public readonly int WorkspaceVersion;
public PinnedSolutionInfo(
Checksum solutionChecksum,
bool fromPrimaryBranch,
int workspaceVersion)
{
SolutionChecksum = solutionChecksum;
FromPrimaryBranch = fromPrimaryBranch;
WorkspaceVersion = workspaceVersion;
}
}
}
|
mit
|
C#
|
2b8170a1f1f5ab8ddd708189edaf2feacd93d273
|
Fix NPM warnings as errors (#550)
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/Tools/Npm/NpmTasks.cs
|
source/Nuke.Common/Tools/Npm/NpmTasks.cs
|
// Copyright 2020 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using Nuke.Common.Tooling;
namespace Nuke.Common.Tools.Npm
{
public static partial class NpmTasks
{
public static void CustomLogger(OutputType type, string output)
{
switch (type)
{
case OutputType.Std:
Logger.Normal(output);
break;
case OutputType.Err:
{
if (output.StartsWith("npmWARN") || output.StartsWith("npm WARN"))
Logger.Warn(output);
else
Logger.Error(output);
break;
}
}
}
}
}
|
// Copyright 2020 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using Nuke.Common.Tooling;
namespace Nuke.Common.Tools.Npm
{
public static partial class NpmTasks
{
public static void CustomLogger(OutputType type, string output)
{
switch (type)
{
case OutputType.Std:
Logger.Normal(output);
break;
case OutputType.Err:
{
if (output.StartsWith("npmWARN"))
Logger.Warn(output);
else
Logger.Error(output);
break;
}
}
}
}
}
|
mit
|
C#
|
d7ce1efdd09c3390a906f846f54c7516b036272c
|
Update the test runner to use the new parser interface.
|
SonyaSa/CppSharp,xistoso/CppSharp,zillemarco/CppSharp,mohtamohit/CppSharp,ktopouzi/CppSharp,inordertotest/CppSharp,imazen/CppSharp,txdv/CppSharp,Samana/CppSharp,mohtamohit/CppSharp,inordertotest/CppSharp,xistoso/CppSharp,genuinelucifer/CppSharp,KonajuGames/CppSharp,ddobrev/CppSharp,mohtamohit/CppSharp,mydogisbox/CppSharp,ktopouzi/CppSharp,txdv/CppSharp,genuinelucifer/CppSharp,zillemarco/CppSharp,mono/CppSharp,KonajuGames/CppSharp,genuinelucifer/CppSharp,txdv/CppSharp,ktopouzi/CppSharp,Samana/CppSharp,u255436/CppSharp,imazen/CppSharp,ddobrev/CppSharp,nalkaro/CppSharp,zillemarco/CppSharp,txdv/CppSharp,genuinelucifer/CppSharp,ddobrev/CppSharp,imazen/CppSharp,Samana/CppSharp,zillemarco/CppSharp,mydogisbox/CppSharp,genuinelucifer/CppSharp,zillemarco/CppSharp,u255436/CppSharp,KonajuGames/CppSharp,nalkaro/CppSharp,nalkaro/CppSharp,ktopouzi/CppSharp,ktopouzi/CppSharp,KonajuGames/CppSharp,mono/CppSharp,xistoso/CppSharp,mono/CppSharp,Samana/CppSharp,txdv/CppSharp,KonajuGames/CppSharp,mydogisbox/CppSharp,u255436/CppSharp,ddobrev/CppSharp,inordertotest/CppSharp,SonyaSa/CppSharp,nalkaro/CppSharp,mohtamohit/CppSharp,SonyaSa/CppSharp,xistoso/CppSharp,mono/CppSharp,mydogisbox/CppSharp,inordertotest/CppSharp,ddobrev/CppSharp,u255436/CppSharp,xistoso/CppSharp,mono/CppSharp,mono/CppSharp,u255436/CppSharp,SonyaSa/CppSharp,imazen/CppSharp,inordertotest/CppSharp,SonyaSa/CppSharp,nalkaro/CppSharp,mohtamohit/CppSharp,Samana/CppSharp,mydogisbox/CppSharp,imazen/CppSharp
|
src/Generator.Tests/HeaderTestFixture.cs
|
src/Generator.Tests/HeaderTestFixture.cs
|
using System;
using System.IO;
using Cxxi;
using Cxxi.Types;
namespace Generator.Tests
{
public class HeaderTestFixture
{
protected Library library;
protected TypeMapDatabase database;
private const string TestsDirectory = @"..\..\..\tests\Native";
protected void ParseLibrary(string file)
{
ParseLibrary(TestsDirectory, file);
}
protected void ParseLibrary(string dir, string file)
{
database = new TypeMapDatabase();
database.SetupTypeMaps();
var options = new DriverOptions();
var path = Path.Combine(Directory.GetCurrentDirectory(), dir);
options.IncludeDirs.Add(path);
var parser = new Parser(options);
var result = parser.ParseHeader(file);
if (result.Kind != ParserResultKind.Success)
throw new Exception("Could not parse file: " + file);
library = result.Library;
foreach (var diag in result.Diagnostics)
Console.WriteLine(diag.Message);
}
}
}
|
using System;
using System.IO;
using Cxxi;
using Cxxi.Types;
namespace Generator.Tests
{
public class HeaderTestFixture
{
protected Library library;
protected TypeMapDatabase database;
private const string TestsDirectory = @"..\..\..\tests\Native";
protected void ParseLibrary(string file)
{
ParseLibrary(TestsDirectory, file);
}
protected void ParseLibrary(string dir, string file)
{
database = new TypeMapDatabase();
database.SetupTypeMaps();
var options = new DriverOptions();
var path = Path.Combine(Directory.GetCurrentDirectory(), dir);
options.IncludeDirs.Add(path);
var parser = new Parser(options);
var result = parser.ParseHeader(file);
if (!result.Success)
throw new Exception("Could not parse file: " + file);
library = result.Library;
foreach (var diag in result.Diagnostics)
Console.WriteLine(diag.Message);
}
}
}
|
mit
|
C#
|
69d65f6c95715934ff295780c05fe846d22052b7
|
Revert unwanted change.
|
AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia
|
samples/ControlCatalog.Android/Resources/Resource.Designer.cs
|
samples/ControlCatalog.Android/Resources/Resource.Designer.cs
|
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::Android.Runtime.ResourceDesignerAttribute("ControlCatalog.Android.Resource", IsApplication=true)]
namespace ControlCatalog.Android
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.1.99.62")]
public partial class Resource
{
static Resource()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
public static void UpdateIdValues()
{
}
public partial class Attribute
{
static Attribute()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Attribute()
{
}
}
public partial class Color
{
// aapt resource value: 0x7F010000
public const int splash_background = 2130771968;
static Color()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Color()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7F020000
public const int Icon = 2130837504;
// aapt resource value: 0x7F020001
public const int splash_screen = 2130837505;
static Drawable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Drawable()
{
}
}
public partial class Style
{
// aapt resource value: 0x7F030000
public const int MyTheme = 2130903040;
// aapt resource value: 0x7F030001
public const int MyTheme_NoActionBar = 2130903041;
// aapt resource value: 0x7F030002
public const int MyTheme_Splash = 2130903042;
static Style()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Style()
{
}
}
}
}
#pragma warning restore 1591
|
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::Android.Runtime.ResourceDesignerAttribute("ControlCatalog.Android.Resource", IsApplication=true)]
namespace ControlCatalog.Android
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
public partial class Resource
{
static Resource()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
public static void UpdateIdValues()
{
}
public partial class Attribute
{
static Attribute()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Attribute()
{
}
}
public partial class Color
{
// aapt resource value: 0x7F010000
public const int splash_background = 2130771968;
static Color()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Color()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7F020000
public const int Icon = 2130837504;
// aapt resource value: 0x7F020001
public const int splash_screen = 2130837505;
static Drawable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Drawable()
{
}
}
public partial class Style
{
// aapt resource value: 0x7F030000
public const int MyTheme = 2130903040;
// aapt resource value: 0x7F030001
public const int MyTheme_NoActionBar = 2130903041;
// aapt resource value: 0x7F030002
public const int MyTheme_Splash = 2130903042;
static Style()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Style()
{
}
}
}
}
#pragma warning restore 1591
|
mit
|
C#
|
28e001fe319065c857467d3523ca2732d6fbe2c8
|
Add xml documentation to the CellStatus class to pass all default StyleCop rules.
|
HQC-Team-Minesweeper-5/Minesweeper
|
src/Minesweeper/Core/Field/CellStatus.cs
|
src/Minesweeper/Core/Field/CellStatus.cs
|
//-----------------------------------------------------------------------
// <copyright file="CellStatus.cs" company="Team Minesweeper 5">
// No copyright here. You can use whatever you want!
// </copyright>
// <summary>This enumeration lists the different states of the cells in the minesweeper board.</summary>
//-----------------------------------------------------------------------
namespace Minesweeper.Core.Field
{
/// <summary>
/// List the different states of each cell on the playing field.
/// </summary>
public enum CellStatus
{
/// <summary>
/// The cell has not been opened yet.
/// </summary>
Closed,
/// <summary>
/// The cell has already been opened.
/// </summary>
Opened,
/// <summary>
/// The cell has been flagged as a mine.
/// </summary>
Flagged
}
}
|
namespace Minesweeper.Core.Field
{
public enum CellStatus
{
Closed,
Opened,
Flagged
}
}
|
mit
|
C#
|
59f151ff0a5a67175d54bb120f2239846c5a929b
|
Create in range method validator
|
rmterra/NesZord
|
src/NesZord.Core/Memory/MemoryAddress.cs
|
src/NesZord.Core/Memory/MemoryAddress.cs
|
using NesZord.Core.Extensions;
using System;
namespace NesZord.Core.Memory
{
public class MemoryAddress : IComparable<int>, IComparable<MemoryAddress>
{
public MemoryAddress(byte page, byte offset)
{
this.Page = page;
this.Offset = offset;
}
public byte Offset { get; private set; }
public byte Page { get; private set; }
public int FullAddress
{
get { return (this.Page << 8) + this.Offset; }
}
public bool In(MemoryAddress address1, MemoryAddress address2)
{
if (address1 == null) { throw new ArgumentNullException(nameof(address1)); }
if (address2 == null) { throw new ArgumentNullException(nameof(address2)); }
return this >= address1 && this <= address2;
}
public MemoryAddress NextAddress()
=> this.Sum(0x0001);
public MemoryAddress Sum(byte value)
=> FromInt32(this.FullAddress + value);
public MemoryAddress And(MemoryAddress other)
{
if (other == null) { throw new ArgumentNullException(nameof(other)); }
return FromInt32(this.FullAddress & other.FullAddress);
}
public MemoryAddress Or(MemoryAddress other)
{
if (other == null) { throw new ArgumentNullException(nameof(other)); }
return FromInt32(this.FullAddress | other.FullAddress);
}
private static MemoryAddress FromInt32(int value)
=> new MemoryAddress(value.GetPage(), value.GetOffset());
public int CompareTo(MemoryAddress other)
{
if (other == null) { throw new ArgumentNullException(nameof(other)); }
return this.CompareTo(other.FullAddress);
}
public int CompareTo(int other)
{
if (this.FullAddress == other) { return 0; }
else if (this.FullAddress > other) { return 1; }
else { return -1; }
}
public static bool operator <(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) < 0;
public static bool operator <=(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) <= 0;
public static bool operator >(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) > 0;
public static bool operator >=(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) >= 0;
}
}
|
using NesZord.Core.Extensions;
using System;
namespace NesZord.Core.Memory
{
public class MemoryAddress : IComparable<int>, IComparable<MemoryAddress>
{
public MemoryAddress(byte page, byte offset)
{
this.Page = page;
this.Offset = offset;
}
public byte Offset { get; private set; }
public byte Page { get; private set; }
public int FullAddress
{
get { return (this.Page << 8) + this.Offset; }
}
internal MemoryAddress NextAddress()
=> this.Sum(0x0001);
public MemoryAddress Sum(byte value)
=> FromInt32(this.FullAddress + value);
public MemoryAddress And(MemoryAddress other)
{
if (other == null) { throw new ArgumentNullException(nameof(other)); }
return FromInt32(this.FullAddress & other.FullAddress);
}
public MemoryAddress Or(MemoryAddress other)
{
if (other == null) { throw new ArgumentNullException(nameof(other)); }
return FromInt32(this.FullAddress | other.FullAddress);
}
private static MemoryAddress FromInt32(int value)
=> new MemoryAddress(value.GetPage(), value.GetOffset());
public int CompareTo(MemoryAddress other)
{
if (other == null) { throw new ArgumentNullException(nameof(other)); }
return this.CompareTo(other.FullAddress);
}
public int CompareTo(int other)
{
if (this.FullAddress == other) { return 0; }
else if (this.FullAddress > other) { return 1; }
else { return -1; }
}
public static bool operator <(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) < 0;
public static bool operator <=(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) <= 0;
public static bool operator >(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) > 0;
public static bool operator >=(MemoryAddress address1, MemoryAddress address2)
=> address1.CompareTo(address2) >= 0;
}
}
|
apache-2.0
|
C#
|
cc5b85a33aee1ae47ffb733a5a783fae8197e899
|
Implement non-generic ParserWriter
|
smbecker/Eto.Parse,picoe/Eto.Parse,ArsenShnurkov/Eto.Parse,picoe/Eto.Parse,smbecker/Eto.Parse,ArsenShnurkov/Eto.Parse
|
Eto.Parse/ParserWriter.cs
|
Eto.Parse/ParserWriter.cs
|
using System;
using Eto.Parse.Parsers;
using System.Collections.Generic;
using System.IO;
namespace Eto.Parse
{
public interface IParserWriter
{
string WriteParser(ParserWriterArgs args, Parser parser);
}
public class ParserWriter : ParserWriter<ParserWriterArgs>
{
public ParserWriter(IDictionary<Type, IParserWriterHandler<ParserWriterArgs>> writers)
: base(writers)
{
}
public ParserWriter()
{
}
}
public class ParserWriter<T_Args> : IParserWriter
where T_Args: ParserWriterArgs
{
public IDictionary<Type, IParserWriterHandler<T_Args>> Writers { get; private set; }
public ParserWriter(IDictionary<Type, IParserWriterHandler<T_Args>> writers)
{
Writers = writers;
}
public ParserWriter()
{
Writers = new Dictionary<Type, IParserWriterHandler<T_Args>>();
}
public virtual string WriteParser(T_Args args, Parser parser)
{
var type = parser.GetType();
while (type != null)
{
IParserWriterHandler<T_Args> handler;
if (Writers.TryGetValue(type, out handler))
{
return handler.Write(args, parser);
break;
}
type = type.BaseType;
}
return null;
}
string IParserWriter.WriteParser(ParserWriterArgs args, Parser parser)
{
return WriteParser((T_Args)args, parser);
}
}
}
|
using System;
using Eto.Parse.Parsers;
using System.Collections.Generic;
using System.IO;
namespace Eto.Parse
{
public interface IParserWriter
{
string WriteParser(ParserWriterArgs args, Parser parser);
}
public class ParserWriter<T_Args> : IParserWriter
where T_Args: ParserWriterArgs
{
public IDictionary<Type, IParserWriterHandler<T_Args>> Writers { get; private set; }
public ParserWriter(IDictionary<Type, IParserWriterHandler<T_Args>> writers)
{
Writers = writers;
}
public ParserWriter()
{
Writers = new Dictionary<Type, IParserWriterHandler<T_Args>>();
}
public virtual string WriteParser(T_Args args, Parser parser)
{
var type = parser.GetType();
while (type != null)
{
IParserWriterHandler<T_Args> handler;
if (Writers.TryGetValue(type, out handler))
{
return handler.Write(args, parser);
break;
}
type = type.BaseType;
}
return null;
}
string IParserWriter.WriteParser(ParserWriterArgs args, Parser parser)
{
return WriteParser((T_Args)args, parser);
}
}
}
|
mit
|
C#
|
4841cce08f04dfff25c168936d6c6f2cc0bdc783
|
test commit
|
exKAZUu/XMutator
|
XMutator/Program.cs
|
XMutator/Program.cs
|
using System;
using Mono.Options;
using Paraiba.Linq;
namespace XMutator {
internal class Program {
private static void Main(string[] args) {
var csv = false;
var help = false;
var p = new OptionSet {
{ "c|csv", v => csv = v != null },
{ "h|?|help", v => help = v != null },
};
var dirPaths = p.Parse(args);
if (!dirPaths.IsEmpty() && !help) {
foreach (var filePath in dirPaths) {
// Measure mutation scores
var generatedMutatns = 10;
var killedMutants = 3;
var percentage = killedMutants * 100 / generatedMutatns;
if (csv) {
Console.WriteLine(killedMutants + "," + generatedMutatns + "," + percentage);
} else {
Console.WriteLine(filePath + ": " + killedMutants + " / " + generatedMutatns
+ ": " + percentage + "%");
}
}
} else {
p.WriteOptionDescriptions(Console.Out);
}
}
}
}
|
using System;
using Mono.Options;
using Paraiba.Linq;
namespace XMutator {
internal class Program {
private static void Main(string[] args) {
var csv = false;
var help = false;
var p = new OptionSet {
{ "c|csv", v => csv = v != null },
{ "h|?|help", v => help = v != null },
};
var filePaths = p.Parse(args);
if (!filePaths.IsEmpty() && !help) {
foreach (var filePath in filePaths) {
// Measure mutation scores
var generatedMutatns = 10;
var killedMutants = 3;
var percentage = killedMutants * 100 / generatedMutatns;
if (csv) {
Console.WriteLine(killedMutants + "," + generatedMutatns + "," + percentage);
} else {
Console.WriteLine(filePath + ": " + killedMutants + " / " + generatedMutatns
+ ": " + percentage + "%");
}
}
} else {
p.WriteOptionDescriptions(Console.Out);
}
}
}
}
|
apache-2.0
|
C#
|
ed758350014aa501617829b8e95c4a533059ba5c
|
fix tests build
|
bards/Epic.NET,bards/Epic.NET,Shamar/Epic.NET,Shamar/Epic.NET
|
Code/UnitTests/Epic.Query.Object.UnitTests/SearchableQA.cs
|
Code/UnitTests/Epic.Query.Object.UnitTests/SearchableQA.cs
|
//
// SearchableQA.cs
//
// Author:
// Giacomo Tesio <giacomo@tesio.it>
//
// Copyright (c) 2010-2012 Giacomo Tesio
//
// This file is part of Epic.NET.
//
// Epic.NET 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.
//
// Epic.NET 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 NUnit.Framework;
using System;
namespace Epic.Query.Object.UnitTests
{
[TestFixture]
public class SearchableQA
{
[Test]
public void Count_withoutAQuery_throwsArgumentNullException()
{
// assert:
Assert.Throws<ArgumentNullException>(delegate {
Searchable.Count<string>(null);
});
}
}
}
|
//
// SearchableQA.cs
//
// Author:
// Giacomo Tesio <giacomo@tesio.it>
//
// Copyright (c) 2010-2012 Giacomo Tesio
//
// This file is part of Epic.NET.
//
// Epic.NET 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.
//
// Epic.NET 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 NUnit.Framework;
using System;
namespace Epic.Query.Object.UnitTests
{
[TestFixture]
public class SearchableQA
{
[Test]
public void Count_withoutAQuery_throwsArgumentNullException()
{
// assert:
Assert.Throws<ArgumentNullException>(delegate {
Searchable.Count<string, int>(null);
});
}
}
}
|
agpl-3.0
|
C#
|
47c3258861e645f2429ec135629ce537e8f68b2d
|
Update Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs
|
space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs
|
Content.Server/GameObjects/EntitySystems/RoundEndSystem.cs
|
using System;
using System.Threading;
using Content.Server.Interfaces.GameTicking;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Timer = Robust.Shared.Timers.Timer;
namespace Content.Server.GameObjects.EntitySystems
{
public class RoundEndSystem : EntitySystem
{
#pragma warning disable 649
[Dependency] private IGameTicker _gameTicker;
[Dependency] private IGameTiming _gameTiming;
#pragma warning restore 649
private CancellationTokenSource _roundEndCancellationTokenSource = new CancellationTokenSource();
public bool IsRoundEndCountdownStarted { get; private set; }
public int RoundEndCountdownTime { get; set; } = 240000;
public TimeSpan? ExpectedCountdownEnd = null;
public delegate void RoundEndCountdownStarted();
public event RoundEndCountdownStarted OnRoundEndCountdownStarted;
public delegate void RoundEndCountdownCancelled();
public event RoundEndCountdownCancelled OnRoundEndCountdownCancelled;
public delegate void RoundEndCountdownFinished();
public event RoundEndCountdownFinished OnRoundEndCountdownFinished;
public void RequestRoundEnd()
{
if (IsRoundEndCountdownStarted)
return;
IsRoundEndCountdownStarted = true;
ExpectedCountdownEnd = _gameTiming.CurTime + TimeSpan.FromMilliseconds(RoundEndCountdownTime);
Timer.Spawn(RoundEndCountdownTime, EndRound, _roundEndCancellationTokenSource.Token);
OnRoundEndCountdownStarted?.Invoke();
}
public void CancelRoundEndCountdown()
{
if (!IsRoundEndCountdownStarted)
return;
IsRoundEndCountdownStarted = false;
_roundEndCancellationTokenSource.Cancel();
_roundEndCancellationTokenSource = new CancellationTokenSource();
ExpectedCountdownEnd = null;
OnRoundEndCountdownCancelled?.Invoke();
}
private void EndRound()
{
OnRoundEndCountdownFinished?.Invoke();
_gameTicker.EndRound();
}
}
}
|
using System;
using System.Threading;
using Content.Server.Interfaces.GameTicking;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Timer = Robust.Shared.Timers.Timer;
namespace Content.Server.GameObjects.EntitySystems
{
public class RoundEndSystem : EntitySystem
{
#pragma warning disable 649
[Dependency] private IGameTicker _gameTicker;
[Dependency] private IGameTiming _gameTiming;
#pragma warning restore 649
private CancellationTokenSource _roundEndCancellationTokenSource = new CancellationTokenSource();
public bool IsRoundEndCountdownStarted { get; private set; }
public int RoundEndCountdownTime { get; set; } = 240000;
public TimeSpan? ExpectedCountdownEnd = null;
public delegate void RoundEndCountdownStarted();
public event RoundEndCountdownStarted OnRoundEndCountdownStarted;
public delegate void RoundEndCountdownCancelled();
public event RoundEndCountdownCancelled OnRoundEndCountdownCancelled;
public delegate void RoundEndCountdownFinished();
public event RoundEndCountdownFinished OnRoundEndCountdownFinished;
public void RequestRoundEnd()
{
if (IsRoundEndCountdownStarted)
return;
IsRoundEndCountdownStarted = true;
ExpectedCountdownEnd = _gameTiming.CurTime.Add(new TimeSpan(0,0,0,0,RoundEndCountdownTime));
Timer.Spawn(RoundEndCountdownTime, EndRound, _roundEndCancellationTokenSource.Token);
OnRoundEndCountdownStarted?.Invoke();
}
public void CancelRoundEndCountdown()
{
if (!IsRoundEndCountdownStarted)
return;
IsRoundEndCountdownStarted = false;
_roundEndCancellationTokenSource.Cancel();
_roundEndCancellationTokenSource = new CancellationTokenSource();
ExpectedCountdownEnd = null;
OnRoundEndCountdownCancelled?.Invoke();
}
private void EndRound()
{
OnRoundEndCountdownFinished?.Invoke();
_gameTicker.EndRound();
}
}
}
|
mit
|
C#
|
35da9ad72806b9e72bf1ffb92e4e870562faba3f
|
Fix comment
|
Lombiq/Orchard-Training-Demo-Module,Lombiq/Orchard-Training-Demo-Module,Lombiq/Orchard-Training-Demo-Module
|
Drivers/ManagePersonsPermissionCheckerTaskDisplayDriver.cs
|
Drivers/ManagePersonsPermissionCheckerTaskDisplayDriver.cs
|
using Lombiq.TrainingDemo.Activities;
using Lombiq.TrainingDemo.ViewModels;
using OrchardCore.Workflows.Display;
using OrchardCore.Workflows.Models;
namespace Lombiq.TrainingDemo.Drivers;
// ActivityDisplayDriver is specifically for implementing Workflow Activity Tasks.
// Don't forget to register this class with the service provider (see: Startup.cs).
public class ManagePersonsPermissionCheckerTaskDisplayDriver :
ActivityDisplayDriver<ManagePersonsPermissionCheckerTask, ManagePersonsPermissionCheckerTaskViewModel>
{
protected override void EditActivity(
ManagePersonsPermissionCheckerTask activity,
ManagePersonsPermissionCheckerTaskViewModel model) => model.UserName = activity.UserName.Expression;
protected override void UpdateActivity(
ManagePersonsPermissionCheckerTaskViewModel model,
ManagePersonsPermissionCheckerTask activity) => activity.UserName = new WorkflowExpression<string>(model.UserName);
}
|
using Lombiq.TrainingDemo.Activities;
using Lombiq.TrainingDemo.ViewModels;
using OrchardCore.Workflows.Display;
using OrchardCore.Workflows.Models;
namespace Lombiq.TrainingDemo.Drivers;
// ActivityDisplayDrivers are specifically for implementing Workflow Activity Tasks.
// Don't forget to register this class with the service provider (see: Startup.cs).
public class ManagePersonsPermissionCheckerTaskDisplayDriver :
ActivityDisplayDriver<ManagePersonsPermissionCheckerTask, ManagePersonsPermissionCheckerTaskViewModel>
{
protected override void EditActivity(
ManagePersonsPermissionCheckerTask activity,
ManagePersonsPermissionCheckerTaskViewModel model) => model.UserName = activity.UserName.Expression;
protected override void UpdateActivity(
ManagePersonsPermissionCheckerTaskViewModel model,
ManagePersonsPermissionCheckerTask activity) => activity.UserName = new WorkflowExpression<string>(model.UserName);
}
|
bsd-3-clause
|
C#
|
c986fd936a79bff311fc62977a9ec29bf493e172
|
Fix LogTime for OpenGroupViewModel.
|
ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton
|
src/CK.Glouton.Model/Logs/OpenGroupViewModel.cs
|
src/CK.Glouton.Model/Logs/OpenGroupViewModel.cs
|
using CK.Glouton.Model.Lucene;
using Lucene.Net.Documents;
namespace CK.Glouton.Model.Logs
{
public class OpenGroupViewModel : ILogViewModel
{
public ELogType LogType => ELogType.OpenGroup;
public string LogLevel { get; set; }
public string LogTime { get; set; }
public string Text { get; set; }
public string SourceFileName { get; set; }
public IExceptionViewModel Exception { get; set; }
public static OpenGroupViewModel Get( ILuceneSearcher luceneSearcher, Document document )
{
return new OpenGroupViewModel
{
LogLevel = document.Get( LogField.LOG_LEVEL ),
LogTime = DateTools.StringToDate( document.Get( LogField.LOG_TIME ) ).ToString( "dd/MM/yyyy HH:mm:ss.fff" ),
Text = document.Get( LogField.TEXT ),
SourceFileName = document.Get( LogField.SOURCE_FILE_NAME ),
Exception = ExceptionViewModel.Get( luceneSearcher, document )
};
}
}
}
|
using CK.Glouton.Model.Lucene;
using Lucene.Net.Documents;
namespace CK.Glouton.Model.Logs
{
public class OpenGroupViewModel : ILogViewModel
{
public ELogType LogType => ELogType.OpenGroup;
public string LogLevel { get; set; }
public string LogTime { get; set; }
public string Text { get; set; }
public string SourceFileName { get; set; }
public IExceptionViewModel Exception { get; set; }
public static OpenGroupViewModel Get( ILuceneSearcher luceneSearcher, Document document )
{
return new OpenGroupViewModel
{
LogLevel = document.Get( LogField.LOG_LEVEL ),
LogTime = document.Get( LogField.LOG_TIME ),
Text = document.Get( LogField.TEXT ),
SourceFileName = document.Get( LogField.SOURCE_FILE_NAME ),
Exception = ExceptionViewModel.Get( luceneSearcher, document )
};
}
}
}
|
mit
|
C#
|
5e5864586f1ec2610865de24ff989c27e07a2532
|
Add missing unit tests for Range equality.
|
DavidLievrouw/FindRandomNumber
|
src/FindRandomNumber.Tests/Common/RangeTests.cs
|
src/FindRandomNumber.Tests/Common/RangeTests.cs
|
using System;
using NUnit.Framework;
namespace FindRandomNumber.Common {
[TestFixture]
public class RangeTests {
[TestFixture]
public class Construction : RangeTests {
[Test]
public void GivenMaximumLessThanMinimum_Throws() {
Assert.Throws<ArgumentOutOfRangeException>(() => new Range(100, 99));
}
[Test]
public void GivenMaximumEqualToMinimum_DoesNotThrow() {
var actual = new Range(100, 100);
Assert.That(actual.Minimum, Is.EqualTo(100));
Assert.That(actual.Maximum, Is.EqualTo(100));
}
[Test]
public void GivenMaximumGreaterThanMinimum_DoesNotThrow() {
var actual = new Range(100, 200);
Assert.That(actual.Minimum, Is.EqualTo(100));
Assert.That(actual.Maximum, Is.EqualTo(200));
}
}
[TestFixture]
public class Equality : RangeTests {
[Test]
public void EmptyInstances_AreEqual() {
var obj1 = new Range();
var obj2 = new Range();
Assert.That(obj1.Equals(obj2));
Assert.That(obj1.GetHashCode(), Is.EqualTo(obj2.GetHashCode()));
Assert.That(obj1 == obj2);
}
[Test]
public void ObjectsWithEqualValues_AreEqual() {
var obj1 = new Range(321, 456);
var obj2 = new Range(321, 456);
Assert.That(obj1.Equals(obj2));
Assert.That(obj1 == obj2);
Assert.That(obj1.GetHashCode(), Is.EqualTo(obj2.GetHashCode()));
}
[Test]
public void ObjectsWithDifferentValues_AreNotEqual() {
var obj1 = new Range(1, 123);
var obj2 = new Range(1, 124);
var obj3 = new Range(0, 123);
Assert.That(!obj1.Equals(obj2));
Assert.That(obj1 != obj2);
Assert.That(!obj2.Equals(obj3));
Assert.That(obj2 != obj3);
Assert.That(!obj1.Equals(obj3));
Assert.That(obj1 != obj3);
}
}
}
}
|
using System;
using NUnit.Framework;
namespace FindRandomNumber.Common {
[TestFixture]
public class RangeTests {
[TestFixture]
public class Construction : RangeTests {
[Test]
public void GivenMaximumLessThanMinimum_Throws() {
Assert.Throws<ArgumentOutOfRangeException>(() => new Range(100, 99));
}
[Test]
public void GivenMaximumEqualToMinimum_DoesNotThrow() {
var actual = new Range(100, 100);
Assert.That(actual.Minimum, Is.EqualTo(100));
Assert.That(actual.Maximum, Is.EqualTo(100));
}
[Test]
public void GivenMaximumGreaterThanMinimum_DoesNotThrow() {
var actual = new Range(100, 200);
Assert.That(actual.Minimum, Is.EqualTo(100));
Assert.That(actual.Maximum, Is.EqualTo(200));
}
}
}
}
|
mit
|
C#
|
1e5c27c1446305a781f17761fca2cbbb6dd7e044
|
make indentaion relative. Add bottom margin to split results from each other.
|
leotsarev/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net
|
Joinrpg/Views/Shared/DisplayTemplates/ISearchResult.cshtml
|
Joinrpg/Views/Shared/DisplayTemplates/ISearchResult.cshtml
|
@using System.Text.RegularExpressions
@using Joinrpg.Markdown
@using JoinRpg.Web.Helpers
@using JoinRpg.Web.Models
@model TargetedSearchResultViewModel
<style type="text/css">
<!--
.searchResultDetails {
margin-left: 2em;
margin-bottom: 1.5em;
}
-->
</style>
<div>
<h4>
@{
var gameObjectLinkViewModel = Model.SearchResult.AsObjectLink();
}
@Html.DisplayFor(model => gameObjectLinkViewModel)
</h4>
<p class="searchResultDetails">
@{
string descriptionToShow = Model.SearchResult.Description.ToPlainText();
const int maxLengthToShow = 200;
descriptionToShow = StringFormatHelper.TruncateString(descriptionToShow, Model.SearchTarget, maxLengthToShow);
descriptionToShow = Regex.Replace(
descriptionToShow,
Model.SearchTarget,
"<b><u>" + Model.SearchTarget + "</u></b>", RegexOptions.IgnoreCase);
}
@Html.Raw(descriptionToShow)
</p>
</div>
|
@using System.Text.RegularExpressions
@using Joinrpg.Markdown
@using JoinRpg.Web.Helpers
@using JoinRpg.Web.Models
@model TargetedSearchResultViewModel
<style type="text/css">
<!--
.searchResultDetails {
margin-left: 20px;
}
-->
</style>
<div>
<h4>
@{
var gameObjectLinkViewModel = Model.SearchResult.AsObjectLink();
}
@Html.DisplayFor(model => gameObjectLinkViewModel)
</h4>
<p class="searchResultDetails" >
@{
string descriptionToShow = (Model.SearchResult.Description.ToPlainText() ?? "");
const int maxLengthToShow = 200;
descriptionToShow = StringFormatHelper.TruncateString(descriptionToShow, Model.SearchTarget, maxLengthToShow);
descriptionToShow = Regex.Replace(
descriptionToShow,
Model.SearchTarget,
"<b><u>" + Model.SearchTarget + "</u></b>", RegexOptions.IgnoreCase);
}
@Html.Raw(descriptionToShow)
</p>
</div>
|
mit
|
C#
|
aec9ea986b9c4b4f6dcd4683fd237bfde81b31e0
|
Comment the security check so it's obvious what its for.
|
projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery,projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,skbkontur/NuGetGallery,JetBrains/ReSharperGallery,JetBrains/ReSharperGallery,grenade/NuGetGallery_download-count-patch,JetBrains/ReSharperGallery,skbkontur/NuGetGallery,mtian/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,ScottShingler/NuGetGallery
|
src/NuGetGallery/Controllers/PagesController.cs
|
src/NuGetGallery/Controllers/PagesController.cs
|
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace NuGetGallery
{
public partial class PagesController : Controller
{
public IContentService ContentService { get; protected set; }
protected PagesController() { }
public PagesController(IContentService contentService)
{
ContentService = contentService;
}
// This will let you add 'static' cshtml pages to the site under View/Pages or Branding/Views/Pages
public virtual ActionResult Page(string pageName)
{
// Prevent traversal attacks and serving non-pages by disallowing ., /, %, and more!
if (pageName == null || pageName.Any(c => !Char.IsLetterOrDigit(c)))
{
return HttpNotFound();
}
return View(pageName);
}
public virtual ActionResult Contact()
{
return View();
}
public virtual async Task<ActionResult> Home()
{
if (ContentService != null)
{
ViewBag.Content = await ContentService.GetContentItemAsync(
Constants.ContentNames.Home,
TimeSpan.FromMinutes(1));
}
return View();
}
public virtual async Task<ActionResult> Terms()
{
if (ContentService != null)
{
ViewBag.Content = await ContentService.GetContentItemAsync(
Constants.ContentNames.TermsOfUse,
TimeSpan.FromDays(1));
}
return View();
}
public virtual async Task<ActionResult> Privacy()
{
if (ContentService != null)
{
ViewBag.Content = await ContentService.GetContentItemAsync(
Constants.ContentNames.PrivacyPolicy,
TimeSpan.FromDays(1));
}
return View();
}
}
}
|
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace NuGetGallery
{
public partial class PagesController : Controller
{
public IContentService ContentService { get; protected set; }
protected PagesController() { }
public PagesController(IContentService contentService)
{
ContentService = contentService;
}
// This will let you add 'static' cshtml pages to the site under View/Pages or Branding/Views/Pages
public virtual ActionResult Page(string pageName)
{
if (pageName == null || pageName.Any(c => !Char.IsLetterOrDigit(c)))
{
return HttpNotFound();
}
return View(pageName);
}
public virtual ActionResult Contact()
{
return View();
}
public virtual async Task<ActionResult> Home()
{
if (ContentService != null)
{
ViewBag.Content = await ContentService.GetContentItemAsync(
Constants.ContentNames.Home,
TimeSpan.FromMinutes(1));
}
return View();
}
public virtual async Task<ActionResult> Terms()
{
if (ContentService != null)
{
ViewBag.Content = await ContentService.GetContentItemAsync(
Constants.ContentNames.TermsOfUse,
TimeSpan.FromDays(1));
}
return View();
}
public virtual async Task<ActionResult> Privacy()
{
if (ContentService != null)
{
ViewBag.Content = await ContentService.GetContentItemAsync(
Constants.ContentNames.PrivacyPolicy,
TimeSpan.FromDays(1));
}
return View();
}
}
}
|
apache-2.0
|
C#
|
f0b51bae1efbdf87472c4e68491d52d4545858e5
|
Split a really long WriteLine into a Write & WriteLine.
|
NewEvolution/Cheers
|
Cheers/Cheers/Program.cs
|
Cheers/Cheers/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cheers
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello there! What's your name?");
string name = Console.ReadLine();
foreach (char letter in name.ToLower())
{
if (Char.IsLetter(letter))
{
string aOrAn = "a... ";
foreach (char nonvoiced in "halfnorsemix")
{
if (letter == nonvoiced)
{
aOrAn = "an... ";
}
}
Console.WriteLine("Give me " + aOrAn + letter);
}
}
Console.WriteLine(name.ToUpper() + "'s just GRAND!");
Console.WriteLine("Hey, " + name + ", what’s your birthday ? (MM/DD)");
string birthday = Console.ReadLine();
DateTime convertedBirthday = Convert.ToDateTime(birthday);
DateTime today = DateTime.Today;
if (convertedBirthday.Equals(today))
{
Console.WriteLine("Happy Birthday!!");
}
else
{
if (convertedBirthday < today)
{
convertedBirthday = convertedBirthday.AddYears(1);
}
Console.Write("Awesome! Your birthday is in " + convertedBirthday.Subtract(today).Days);
Console.WriteLine(" days! Happy Birthday in advance!");
}
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cheers
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello there! What's your name?");
string name = Console.ReadLine();
foreach (char letter in name.ToLower())
{
if (Char.IsLetter(letter))
{
string aOrAn = "a... ";
foreach (char nonvoiced in "halfnorsemix")
{
if (letter == nonvoiced)
{
aOrAn = "an... ";
}
}
Console.WriteLine("Give me " + aOrAn + letter);
}
}
Console.WriteLine(name.ToUpper() + "'s just GRAND!");
Console.WriteLine("Hey, " + name + ", what’s your birthday ? (MM/DD)");
string birthday = Console.ReadLine();
DateTime convertedBirthday = Convert.ToDateTime(birthday);
DateTime today = DateTime.Today;
if (convertedBirthday.Equals(today))
{
Console.WriteLine("Happy Birthday!!");
}
else
{
if (convertedBirthday < today)
{
convertedBirthday = convertedBirthday.AddYears(1);
}
Console.WriteLine("Awesome! Your birthday is in " + convertedBirthday.Subtract(today).Days + " days! Happy Birthday in advance!");
}
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
|
mit
|
C#
|
4c3701885bf019e8066c0fd01a078a473aa8d1de
|
Improve documentation around HandlerMappings
|
Workshop2/noobot,noobot/noobot
|
src/Noobot.Core/MessagingPipeline/Middleware/HandlerMapping.cs
|
src/Noobot.Core/MessagingPipeline/Middleware/HandlerMapping.cs
|
using System;
using System.Collections.Generic;
using Noobot.Core.MessagingPipeline.Middleware.ValidHandles;
using Noobot.Core.MessagingPipeline.Request;
using Noobot.Core.MessagingPipeline.Response;
namespace Noobot.Core.MessagingPipeline.Middleware
{
public class HandlerMapping
{
/// <summary>
/// Valid handles to match on for incomming text, e.g. match exactly on "Hello"
/// </summary>
public IValidHandle[] ValidHandles { get; set; } = new IValidHandle[0];
/// <summary>
/// Description of what this handle does. This appears in the "help" function.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The function that is evaluated on a matched handle
/// </summary>
public Func<IncomingMessage, IValidHandle, IEnumerable<ResponseMessage>> EvaluatorFunc { get; set; }
/// <summary>
/// Defaults to "False". If set to True then the pipeline isn't interupted if a match occurs here. This is good for logging.
/// </summary>
public bool ShouldContinueProcessing { get; set; }
/// <summary>
/// Defaults to "True". If set to false then any message is considered, even if it isn't targeted at the bot. e.g. @noobot or a private channel
/// </summary>
public bool MessageShouldTargetBot { get; set; } = true;
/// <summary>
/// Defaults to "True". Set to false to hide these commands in the help command.
/// </summary>
public bool VisibleInHelp { get; set; } = true;
}
}
|
using System;
using System.Collections.Generic;
using Noobot.Core.MessagingPipeline.Middleware.ValidHandles;
using Noobot.Core.MessagingPipeline.Request;
using Noobot.Core.MessagingPipeline.Response;
namespace Noobot.Core.MessagingPipeline.Middleware
{
public class HandlerMapping
{
public HandlerMapping()
{
ValidHandles = new IValidHandle[0];
MessageShouldTargetBot = true;
VisibleInHelp = true;
}
/// <summary>
/// The various handles of different types
/// </summary>
public IValidHandle[] ValidHandles { get; set; }
/// <summary>
/// Description of what this handle does. This appears in the "help" function.
/// </summary>
public string Description { get; set; }
/// <summary>
/// This is what code is run when a handle has been matched.
/// </summary>
public Func<IncomingMessage, IValidHandle, IEnumerable<ResponseMessage>> EvaluatorFunc { get; set; }
/// <summary>
/// Defaults to "False". If set to True then the pipeline isn't interupted if a match occurs here. This is good for logging.
/// </summary>
public bool ShouldContinueProcessing { get; set; }
/// <summary>
/// Defaults to "True". If set to false then any message is considered, even if it isn't targeted at the bot. e.g. @noobot or a private channel
/// </summary>
public bool MessageShouldTargetBot { get; set; }
/// <summary>
/// Defaults to "True". Set to false to hide these commands in the help command.
/// </summary>
public bool VisibleInHelp { get; set; }
}
}
|
mit
|
C#
|
8f7f9979082d48786472beb9500f294e048ae944
|
Fix header
|
conekta/conekta-xamarin
|
ConektaSDK/Connection.cs
|
ConektaSDK/Connection.cs
|
using System;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using System.Net.Http.Headers;
namespace ConektaSDK {
public class Connection {
public string Platform { get; set; }
public Connection (string platform) {
Platform = platform;
}
public async Task<string> request(string Content, string EndPoint) {
if(string.IsNullOrEmpty(EndPoint))
throw new ArgumentException("endPoint empty");
if(string.IsNullOrEmpty(Conekta.ApiVersion))
Conekta.ApiVersion = "0.3.0";
HttpClient client = new HttpClient ();
HttpRequestMessage requestMessage = new HttpRequestMessage (HttpMethod.Post, Conekta.BaseUri + EndPoint);
requestMessage.Headers.Authorization = new AuthenticationHeaderValue ("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:", Conekta.PublicKey))));
requestMessage.Headers.Add ("Accept", "application/vnd.conekta-v" + Conekta.ApiVersion + "+json");
if(Platform == "Android")
requestMessage.Headers.Add ("Conekta-Client-User-Agent", @"{""agent"": ""Conekta Android SDK""}");
else if(Platform == "iOS")
requestMessage.Headers.Add ("Conekta-Client-User-Agent", @"{""agent"": ""Conekta iOS SDK""}");
requestMessage.Content = new StringContent (Content, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.SendAsync (requestMessage); //.ConfigureAwait(false);
string responseString = await response.Content.ReadAsStringAsync();
return responseString;
}
}
}
|
using System;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using System.Net.Http.Headers;
namespace ConektaSDK {
public class Connection {
public string Platform { get; set; }
public Connection (string platform) {
Platform = platform;
}
public async Task<string> request(string Content, string EndPoint) {
if(string.IsNullOrEmpty(EndPoint))
throw new ArgumentException("endPoint empty");
if(string.IsNullOrEmpty(Conekta.ApiVersion))
Conekta.ApiVersion = "0.3.0";
HttpClient client = new HttpClient ();
HttpRequestMessage requestMessage = new HttpRequestMessage (HttpMethod.Post, Conekta.BaseUri + EndPoint);
requestMessage.Headers.Authorization = new AuthenticationHeaderValue ("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:", Conekta.PublicKey))));
requestMessage.Headers.Add ("Acept", "application/vnd.conekta-v" + Conekta.ApiVersion + "+json");
if(Platform == "Android")
requestMessage.Headers.Add ("Conekta-Client-User-Agent", @"{""agent"": ""Conekta Android SDK""}");
else if(Platform == "iOS")
requestMessage.Headers.Add ("Conekta-Client-User-Agent", @"{""agent"": ""Conekta iOS SDK""}");
requestMessage.Content = new StringContent (Content, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.SendAsync (requestMessage); //.ConfigureAwait(false);
string responseString = await response.Content.ReadAsStringAsync();
return responseString;
}
}
}
|
mit
|
C#
|
86720b6d35a58fe459ec5efd546b36f47975d6d9
|
remove Beta 1 note
|
ProfessionalCSharp/ProfessionalCSharp7,ProfessionalCSharp/ProfessionalCSharp7,ProfessionalCSharp/ProfessionalCSharp7,ProfessionalCSharp/ProfessionalCSharp7
|
API/BooksODataService/BooksODataService/Startup.cs
|
API/BooksODataService/BooksODataService/Startup.cs
|
using BooksODataService.Models;
using BooksODataService.Services;
using Microsoft.AspNet.OData.Builder;
using Microsoft.AspNet.OData.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OData.Edm;
namespace BooksODataService
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddTransient<CreateBooksService>();
services.AddDbContext<BooksContext>(options =>
{
options.UseSqlServer(Configuration.GetConnectionString("BooksConnection"));
});
services.AddOData();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, CreateBooksService sampleBooks)
{
sampleBooks.CreateDatabase();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc(routeBuilder =>
{
routeBuilder.Select().Expand().Filter().OrderBy().MaxTop(100).Count();
routeBuilder.MapODataServiceRoute("ODataRoute", "odata", GetEdmModel());
});
}
private IEdmModel GetEdmModel()
{
var builder = new ODataConventionModelBuilder();
builder.EntitySet<Book>("Books");
builder.EntitySet<BookChapter>("Chapters");
return builder.GetEdmModel();
}
}
}
|
using BooksODataService.Models;
using BooksODataService.Services;
using Microsoft.AspNet.OData.Builder;
using Microsoft.AspNet.OData.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OData.Edm;
// OData Beta 1 docu http://odata.github.io/WebApi/#14-01-netcore-beta1
namespace BooksODataService
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddTransient<CreateBooksService>();
services.AddDbContext<BooksContext>(options =>
{
options.UseSqlServer(Configuration.GetConnectionString("BooksConnection"));
});
services.AddOData();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, CreateBooksService sampleBooks)
{
sampleBooks.CreateDatabase();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc(routeBuilder =>
{
routeBuilder.Select().Expand().Filter().OrderBy().MaxTop(100).Count();
routeBuilder.MapODataServiceRoute("ODataRoute", "odata", GetEdmModel());
});
}
private IEdmModel GetEdmModel()
{
var builder = new ODataConventionModelBuilder();
builder.EntitySet<Book>("Books");
builder.EntitySet<BookChapter>("Chapters");
return builder.GetEdmModel();
}
}
}
|
mit
|
C#
|
9e9ea1d14adfb8f58371ca0d30beb33b44ce2992
|
Add spaces.
|
scott-fleischman/algorithms-csharp
|
src/Algorithms.Collections/SquareMatrix.cs
|
src/Algorithms.Collections/SquareMatrix.cs
|
using System;
namespace Algorithms.Collections
{
public static class SquareMatrix
{
public static T[,] Multiply<T>(T[,] A, T[,] B, Func<T, T, T> add, Func<T, T, T> multiply)
{
ValidateAreEqualSquare(A, B);
int length = A.GetLength(0);
var C = new T[length, length];
for (int i = 0; i < length; i++)
{
for (int j = 0; j < length; j++)
{
C[i, j] = default(T);
for (int k = 0; k < length; k++)
C[i, j] = add(C[i, j], multiply(A[i, k], B[k, j]));
}
}
return C;
}
public static T[,] Add<T>(T[,] left, T[,] right, Func<T, T, T> add)
{
ValidateAreEqualSquare(left, right);
int length = left.GetLength(0);
var result = new T[length, length];
for (int row = 0; row < left.GetLength(0); row++)
{
for (int column = 0; column < left.GetLength(1); column++)
result[row, column] = add(left[row, column], right[row, column]);
}
return result;
}
private static void ValidateAreEqualSquare<T>(T[,] A, T[,] B)
{
if (!IsSquare(A))
throw new ArgumentException("A must be square", "A");
if (!IsSquare(B))
throw new ArgumentException("B must be square", "B");
int aSize = A.GetLength(0);
int bSize = B.GetLength(0);
if (aSize != bSize)
throw new ArgumentException("A and B must be the same size", "A");
}
private static bool IsSquare<T>(T[,] array)
{
int rowLength = array.GetLength(0);
int columnLength = array.GetLength(1);
return rowLength == columnLength;
}
}
}
|
using System;
namespace Algorithms.Collections
{
public static class SquareMatrix
{
public static T[,] Multiply<T>(T[,] A, T[,] B, Func<T, T, T> add, Func<T, T, T> multiply)
{
ValidateAreEqualSquare(A, B);
int length = A.GetLength(0);
var C = new T[length,length];
for (int i = 0; i < length; i++)
{
for (int j = 0; j < length; j++)
{
C[i, j] = default(T);
for (int k = 0; k < length; k++)
C[i, j] = add(C[i, j], multiply(A[i, k], B[k, j]));
}
}
return C;
}
public static T[,] Add<T>(T[,] left, T[,] right, Func<T, T, T> add)
{
ValidateAreEqualSquare(left, right);
int length = left.GetLength(0);
var result = new T[length,length];
for (int row = 0; row < left.GetLength(0); row++)
{
for (int column = 0; column < left.GetLength(1); column++)
result[row, column] = add(left[row, column], right[row, column]);
}
return result;
}
private static void ValidateAreEqualSquare<T>(T[,] A, T[,] B)
{
if (!IsSquare(A))
throw new ArgumentException("A must be square", "A");
if (!IsSquare(B))
throw new ArgumentException("B must be square", "B");
int aSize = A.GetLength(0);
int bSize = B.GetLength(0);
if (aSize != bSize)
throw new ArgumentException("A and B must be the same size", "A");
}
private static bool IsSquare<T>(T[,] array)
{
int rowLength = array.GetLength(0);
int columnLength = array.GetLength(1);
return rowLength == columnLength;
}
}
}
|
mit
|
C#
|
759cf7d52e07aee26c1502ea37d774eebc408976
|
Update IContentItemSystemAttributes.cs
|
Kentico/Deliver-.NET-SDK,Kentico/delivery-sdk-net
|
Kentico.Kontent.Delivery.Abstractions/ContentItems/IContentItemSystemAttributes.cs
|
Kentico.Kontent.Delivery.Abstractions/ContentItems/IContentItemSystemAttributes.cs
|
using System.Collections.Generic;
namespace Kentico.Kontent.Delivery.Abstractions
{
/// <summary>
/// Represents system attributes of a content item.
/// </summary>
public interface IContentItemSystemAttributes : ISystemAttributes
{
/// <summary>
/// Gets the language of the content item.
/// </summary>
string Language { get; }
/// <summary>
/// Gets a list of codenames of sitemap items to which the content item is assigned.
/// </summary>
IList<string> SitemapLocation { get; }
/// <summary>
/// Gets the codename of the content type, for example "article".
/// </summary>
string Type { get; }
/// <summary>
/// Gets the codename of the content collection to which the content item belongs.
/// </summary>
public string Collection { get; }
/// <summary>
/// Gets the codename of the workflow step which the content item is assigned to .
/// </summary>
public string WorkflowStep { get; }
}
}
|
using System.Collections.Generic;
namespace Kentico.Kontent.Delivery.Abstractions
{
/// <summary>
/// Represents system attributes of a content item.
/// </summary>
public interface IContentItemSystemAttributes : ISystemAttributes
{
/// <summary>
/// Gets the language of the content item.
/// </summary>
string Language { get; }
/// <summary>
/// Gets a list of codenames of sitemap items to which the content item is assigned.
/// </summary>
IList<string> SitemapLocation { get; }
/// <summary>
/// Gets the codename of the content type, for example "article".
/// </summary>
string Type { get; }
/// <summary>
/// Gets the codename of the content collection to which the content item belongs
/// </summary>
public string Collection { get; }
/// <summary>
/// Gets the codename of the workflow step to which item is assigned to
/// </summary>
public string WorkflowStep { get; }
}
}
|
mit
|
C#
|
f35deea9ae970a79c0084bcc2730a281531cecb5
|
Change Postgres docker container version from "latest" to "10.6"
|
eposgmbh/Epos.Foundation
|
src/Epos.TestUtilities/Docker/DockerContainer.Postgres.cs
|
src/Epos.TestUtilities/Docker/DockerContainer.Postgres.cs
|
namespace Epos.TestUtilities.Docker
{
public partial class DockerContainer
{
/// <summary> Represents a Postgres Docker container (with admin/admin auth). </summary>
public static class Postgres
{
/// <summary> Starts a Postgres Docker container. </summary>
/// <returns>Docker container</returns>
public static DockerContainer Start() {
int thePort = GetFreeTcpHostPort();
var theContainer = StartAndWaitForReadynessLogPhrase(
new DockerContainerOptions
{
Name = "PostgresTestContainer",
ImageName = "postgres:10.6",
ReadynessLogPhrase = "ready to accept connections",
Ports = { (thePort, 5432) },
EnvironmentVariables = {
("POSTGRES_USER", "admin"),
("POSTGRES_PASSWORD", "admin")
}
}
);
theContainer.ConnectionString =
$"Server=localhost;Port={thePort};Database=test;User ID=admin;Password=admin";
return theContainer;
}
}
}
}
|
namespace Epos.TestUtilities.Docker
{
public partial class DockerContainer
{
/// <summary> Represents a Postgres Docker container (with admin/admin auth). </summary>
public static class Postgres
{
/// <summary> Starts a Postgres Docker container. </summary>
/// <returns>Docker container</returns>
public static DockerContainer Start() {
int thePort = GetFreeTcpHostPort();
var theContainer = StartAndWaitForReadynessLogPhrase(
new DockerContainerOptions
{
Name = "PostgresTestContainer",
ImageName = "postgres:latest",
ReadynessLogPhrase = "ready to accept connections",
Ports = { (thePort, 5432) },
EnvironmentVariables = {
("POSTGRES_USER", "admin"),
("POSTGRES_PASSWORD", "admin")
}
}
);
theContainer.ConnectionString =
$"Server=localhost;Port={thePort};Database=test;User ID=admin;Password=admin";
return theContainer;
}
}
}
}
|
mit
|
C#
|
debe5b9ee28db4cbfaa63d2df153d343a840d393
|
Add support for second instruction
|
Curdflappers/UltimateTicTacToe
|
Assets/Resources/Scripts/instructions/InstructionController.cs
|
Assets/Resources/Scripts/instructions/InstructionController.cs
|
using UnityEngine;
using UnityEngine.UI;
public class InstructionController : GameController
{
Instruction[] instructions;
int instructionIndex;
Instruction currentInstruction;
Text infoText;
int index; // for miscellaneous cycles
private void Start()
{
DisableAllButtons();
InitializeInstructions();
instructionIndex = 0;
currentInstruction = instructions[instructionIndex];
infoText = GameObject.Find("Info Text").GetComponent<Text>();
infoText.text = currentInstruction.Info;
}
void DisableAllButtons()
{
Button[] buttons = GetComponentsInChildren<Button>();
foreach(Button button in buttons)
{
button.enabled = false;
}
}
void InitializeInstructions()
{
instructions = new Instruction[12];
instructions[0] = new Instruction(
Game,
"Ultimate Tic-Tac-Toe is a game with 81 spots",
PreviewRandom,
delegate () { },
delegate () { },
delegate () { },
delegate () { }
);
instructions[1] = new Instruction(
Game,
"On nine local boards",
PreviewCycle,
delegate () { },
delegate () { },
delegate () { },
delegate () { }
);
}
private void Update()
{
currentInstruction.Act();
}
/// <summary>
/// Change game to preview a random spot based on previewTime
/// Or decrement timer
/// To be called continuously as an instruction action
/// </summary>
void PreviewRandom()
{
if(previewTimer <= 0)
{
Game.Preview(
Random.Range(0, 3),
Random.Range(0, 3),
Random.Range(0, 3),
Random.Range(0, 3)
);
previewTimer = previewTime;
}
else
{
previewTimer -= Time.deltaTime;
}
}
/// <summary>
/// Preview each relative spot of each board in order
/// Top-left spot of top-left board, top-mid spot of top-mid board, etc.
/// To be called as instruction action
/// </summary>
void PreviewCycle()
{
index %= 9;
int row, col;
row = index / 3;
col = index % 3;
Game.Preview(row, col, row, col);
if(previewTimer <= 0)
{
index++;
previewTimer = previewTime;
}
else
{
previewTimer -= Time.deltaTime;
}
}
}
|
using UnityEngine;
using UnityEngine.UI;
public class InstructionController : GameController
{
Instruction[] instructions;
int index;
Instruction currentInstruction;
Text infoText;
private void Start()
{
DisableAllButtons();
InitializeInstructions();
index = 0;
currentInstruction = instructions[index];
infoText = GameObject.Find("Info Text").GetComponent<Text>();
infoText.text = currentInstruction.Info;
}
void DisableAllButtons()
{
Button[] buttons = GetComponentsInChildren<Button>();
foreach(Button button in buttons)
{
button.enabled = false;
}
}
void InitializeInstructions()
{
instructions = new Instruction[12];
instructions[0] = new Instruction(
Game,
"Ultimate Tic-Tac-Toe is a game with 81 spots",
PreviewRandom,
delegate () { },
delegate () { },
delegate () { },
delegate () { }
);
}
private void Update()
{
currentInstruction.Act();
}
/// <summary>
/// Change game to preview a random spot based on previewTime
/// Or decrement timer
/// To be called continuously as an instruction action
/// </summary>
void PreviewRandom()
{
if(previewTimer <= 0)
{
Game.Preview(
Random.Range(0, 3),
Random.Range(0, 3),
Random.Range(0, 3),
Random.Range(0, 3)
);
previewTimer = previewTime;
}
else
{
previewTimer -= Time.deltaTime;
}
}
}
|
mit
|
C#
|
e4b5f95e14162a207a65643ce0d6706fc77fac4b
|
fix whitespace
|
nerai/CMenu
|
src/ConsoleMenu/Properties/AssemblyInfo.cs
|
src/ConsoleMenu/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 ("ConsoleMenu")]
[assembly: AssemblyDescription ("Console menus are easy to build, complex menus are supported, and using them is simple and quick")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Sebastian Heuchler")]
[assembly: AssemblyProduct ("ConsoleMenu")]
[assembly: AssemblyCopyright ("Copyright © 2015-18 Sebastian Heuchler")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible (false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid ("24ec1c30-cf90-41d3-9763-2da3951aa6b2")]
// 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: AssemblyFileVersion ("0.0.0.0")]
[assembly: AssemblyVersion ("0.9.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle ("ConsoleMenu")]
[assembly: AssemblyDescription ("Console menus are easy to build, complex menus are supported, and using them is simple and quick")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Sebastian Heuchler")]
[assembly: AssemblyProduct ("ConsoleMenu")]
[assembly: AssemblyCopyright ("Copyright © 2015-18 Sebastian Heuchler")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible (false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid ("24ec1c30-cf90-41d3-9763-2da3951aa6b2")]
// 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: AssemblyFileVersion ("0.0.0.0")]
[assembly: AssemblyVersion ("0.9.0")]
|
mit
|
C#
|
8edbf7c424cbc5658cf0766cf61fc4eac148a557
|
Fix Now messages sent from a server without clients are recycled
|
jbruening/lidgren-network-gen3,RainsSoft/lidgren-network-gen3,lidgren/lidgren-network-gen3,forestrf/lidgren-network-gen3
|
Lidgren.Network/NetServer.cs
|
Lidgren.Network/NetServer.cs
|
using System;
using System.Collections.Generic;
namespace Lidgren.Network
{
/// <summary>
/// Specialized version of NetPeer used for "server" peers
/// </summary>
public class NetServer : NetPeer
{
/// <summary>
/// NetServer constructor
/// </summary>
public NetServer(NetPeerConfiguration config)
: base(config)
{
config.AcceptIncomingConnections = true;
}
/// <summary>
/// Send a message to all connections
/// </summary>
/// <param name="msg">The message to send</param>
/// <param name="method">How to deliver the message</param>
public void SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method)
{
var all = this.Connections;
if (all.Count <= 0) {
if (msg.m_isSent == false)
Recycle(msg);
return;
}
SendMessage(msg, all, method, 0);
}
/// <summary>
/// Send a message to all connections except one
/// </summary>
/// <param name="msg">The message to send</param>
/// <param name="method">How to deliver the message</param>
/// <param name="except">Don't send to this particular connection</param>
/// <param name="sequenceChannel">Which sequence channel to use for the message</param>
public void SendToAll(NetOutgoingMessage msg, NetConnection except, NetDeliveryMethod method, int sequenceChannel)
{
var all = this.Connections;
if (all.Count <= 0) {
if (msg.m_isSent == false)
Recycle(msg);
return;
}
if (except == null)
{
SendMessage(msg, all, method, sequenceChannel);
return;
}
List<NetConnection> recipients = new List<NetConnection>(all.Count - 1);
foreach (var conn in all)
if (conn != except)
recipients.Add(conn);
if (recipients.Count > 0)
SendMessage(msg, recipients, method, sequenceChannel);
}
/// <summary>
/// Returns a string that represents this object
/// </summary>
public override string ToString()
{
return "[NetServer " + ConnectionsCount + " connections]";
}
}
}
|
using System;
using System.Collections.Generic;
namespace Lidgren.Network
{
/// <summary>
/// Specialized version of NetPeer used for "server" peers
/// </summary>
public class NetServer : NetPeer
{
/// <summary>
/// NetServer constructor
/// </summary>
public NetServer(NetPeerConfiguration config)
: base(config)
{
config.AcceptIncomingConnections = true;
}
/// <summary>
/// Send a message to all connections
/// </summary>
/// <param name="msg">The message to send</param>
/// <param name="method">How to deliver the message</param>
public void SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method)
{
var all = this.Connections;
if (all.Count <= 0)
return;
SendMessage(msg, all, method, 0);
}
/// <summary>
/// Send a message to all connections except one
/// </summary>
/// <param name="msg">The message to send</param>
/// <param name="method">How to deliver the message</param>
/// <param name="except">Don't send to this particular connection</param>
/// <param name="sequenceChannel">Which sequence channel to use for the message</param>
public void SendToAll(NetOutgoingMessage msg, NetConnection except, NetDeliveryMethod method, int sequenceChannel)
{
var all = this.Connections;
if (all.Count <= 0)
return;
if (except == null)
{
SendMessage(msg, all, method, sequenceChannel);
return;
}
List<NetConnection> recipients = new List<NetConnection>(all.Count - 1);
foreach (var conn in all)
if (conn != except)
recipients.Add(conn);
if (recipients.Count > 0)
SendMessage(msg, recipients, method, sequenceChannel);
}
/// <summary>
/// Returns a string that represents this object
/// </summary>
public override string ToString()
{
return "[NetServer " + ConnectionsCount + " connections]";
}
}
}
|
mit
|
C#
|
b95f468d30c0338ea328e2b158c0fdeb19bd87d6
|
Update MichaelRidland.cs
|
MabroukENG/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin
|
src/Firehose.Web/Authors/MichaelRidland.cs
|
src/Firehose.Web/Authors/MichaelRidland.cs
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MichaelRidland : IAmAXamarinMVP
{
public string FirstName => "Michael";
public string LastName => "Ridland";
public string StateOrRegion => "Sydney, Australia";
public string EmailAddress => "michael@xam-consulting.com";
public string ShortBioOrTagLine => "";
public Uri WebSite => new Uri("http://www.michaelridland.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.michaelridland.com/feed/"); }
}
public string TwitterHandle => "rid00z";
public string GravatarHash => "";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(-33.8688200, 151.2092960);
}
}
|
using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MichaelRidland : IAmAXamarinMVP
{
public string FirstName => "Michael";
public string LastName => "Ridland";
public string StateOrRegion => "Sydney, Australia";
public string EmailAddress => "michael@xam-consulting.com";
public string ShortBioOrTagLine => "director of an Xamarin consultancy";
public Uri WebSite => new Uri("http://www.michaelridland.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.michaelridland.com/feed/"); }
}
public string TwitterHandle => "rid00z";
public string GravatarHash => "";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(-33.8688200, 151.2092960);
}
}
|
mit
|
C#
|
7140c4d8987e456bb82710d85982d0955bcaae18
|
Fix infinite object recursion
|
JDawes-ScottLogic/voting-application,JDawes-ScottLogic/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,tpkelly/voting-application,Generic-Voting-Application/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,stevenhillcox/voting-application,Generic-Voting-Application/voting-application,tpkelly/voting-application
|
VotingApplication/VotingApplication.Web.Api/Global.asax.cs
|
VotingApplication/VotingApplication.Web.Api/Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
namespace VotingApplication.Web.Api
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
// Fix the infinite recursion of Session.OptionSet.Options[0].OptionSets[0].Options[0].[...]
// by not populating the Option.OptionSets after already encountering Session.OptionSet
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace VotingApplication.Web.Api
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
apache-2.0
|
C#
|
5163d0b66135d620005f3117dbe1928e64a25c5d
|
Use DoubleTappedEvent event
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Behaviors/CommandOnDoubleClickBehavior.cs
|
WalletWasabi.Gui/Behaviors/CommandOnDoubleClickBehavior.cs
|
using Avalonia.Controls;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Behaviors
{
public class CommandOnDoubleClickBehavior : CommandBasedBehavior<Control>
{
private CompositeDisposable Disposables { get; set; }
protected override void OnAttached()
{
Disposables = new CompositeDisposable();
base.OnAttached();
Disposables.Add(AssociatedObject.AddHandler(Control.DoubleTappedEvent, (sender, e) =>
{
e.Handled = ExecuteCommand();
}));
}
protected override void OnDetaching()
{
base.OnDetaching();
Disposables?.Dispose();
}
}
}
|
using Avalonia.Controls;
using System.Reactive.Disposables;
namespace WalletWasabi.Gui.Behaviors
{
public class CommandOnDoubleClickBehavior : CommandBasedBehavior<Control>
{
private CompositeDisposable Disposables { get; set; }
protected override void OnAttached()
{
Disposables = new CompositeDisposable();
base.OnAttached();
Disposables.Add(AssociatedObject.AddHandler(Control.PointerPressedEvent, (sender, e) =>
{
if (e.ClickCount == 2)
{
e.Handled = ExecuteCommand();
}
}));
}
protected override void OnDetaching()
{
base.OnDetaching();
Disposables?.Dispose();
}
}
}
|
mit
|
C#
|
a2d881d0a0cb89474b9eb6e61b6b0b9798b9a52c
|
Use already created client
|
UKParliData/bptweets
|
src/UKParliData.BPTweets/Program.cs
|
src/UKParliData.BPTweets/Program.cs
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UKParliData.BPTweets
{
public class Program
{
static void Main(string[] args)
{
var client = new TwitterClient();
if (args.Contains("/a", StringComparer.OrdinalIgnoreCase))
{
client.Authorise().Wait();
}
else
{
new Program(
new BPReader(ConfigurationManager.AppSettings["BPFeedUrl"]),
new TweetLog("log.txt"),
client
).Run();
}
}
private IBPReader reader;
private ITweetLog log;
private ITwitterClient client;
public Program(IBPReader reader, ITweetLog log, ITwitterClient client)
{
this.reader = reader;
this.log = log;
this.client = client;
}
public void Run()
{
var tweetedIDs = this.log.GetTweetedIDs();
foreach (var bp in reader.ReadAll().Where(x => !tweetedIDs.Contains(x.Identifier)).OrderBy(x => x.Date))
{
string tweet = String.Format("New {0}: {1} {2} http://www.parliament.uk/briefing-papers/{3}",
bp.Type,
bp.Identifier,
bp.Title,
bp.Identifier.Replace("/", "-").Replace(" ", "-")
);
client.Tweet(tweet);
log.LogTweetedID(bp.Identifier);
Console.WriteLine(tweet);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UKParliData.BPTweets
{
public class Program
{
static void Main(string[] args)
{
var client = new TwitterClient();
if (args.Contains("/a", StringComparer.OrdinalIgnoreCase))
{
client.Authorise().Wait();
}
else
{
new Program(
new BPReader(ConfigurationManager.AppSettings["BPFeedUrl"]),
new TweetLog("log.txt"),
new TwitterClient()
).Run();
}
}
private IBPReader reader;
private ITweetLog log;
private ITwitterClient client;
public Program(IBPReader reader, ITweetLog log, ITwitterClient client)
{
this.reader = reader;
this.log = log;
this.client = client;
}
public void Run()
{
var tweetedIDs = this.log.GetTweetedIDs();
foreach (var bp in reader.ReadAll().Where(x => !tweetedIDs.Contains(x.Identifier)).OrderBy(x => x.Date))
{
string tweet = String.Format("New {0}: {1} {2} http://www.parliament.uk/briefing-papers/{3}",
bp.Type,
bp.Identifier,
bp.Title,
bp.Identifier.Replace("/", "-").Replace(" ", "-")
);
client.Tweet(tweet);
log.LogTweetedID(bp.Identifier);
Console.WriteLine(tweet);
}
}
}
}
|
mit
|
C#
|
9f30a4cff04ba42e0cda222445fe2c9239d787d1
|
update #build2018
|
dncuug/dot-net.in.ua,dncuug/dot-net.in.ua,dncuug/dot-net.in.ua
|
src/WebSite/Views/Content/Build2018.cshtml
|
src/WebSite/Views/Content/Build2018.cshtml
|
@{
Layout = "_GeneralLayout";
}
<h1>@ViewData["Title"]</h1>
<div class="row">
<div class="col-md-6">
<h2>#video</h2>
<iframe
width="100%"
height="315"
src="https://www.youtube.com/embed/rd0Rd8w3FZ0"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen>
</iframe>
<h2>About conference</h2>
<div style="text-align: justify;">
Microsoft Build (often stylised as //build/) is an annual conference event held by Microsoft, aimed towards
software engineers and web developers using Windows, Windows Phone, Microsoft Azure and other Microsoft
technologies.<br />
The 2018 Build conference is being held at the Washington State Convention Center in Downtown Seattle,
Washington May 7 to May 9, 2018. The price has increased $300 to $2495 for the 2018 conference.<br />
</div>
<div style="font-size: 0.8em">Source: <a href="https://en.wikipedia.org/wiki/Build_(developer_conference)#2018">Wikipedia</a></div>
</div>
<div class="col-md-6">
<a class="twitter-timeline"
href="https://twitter.com/hashtag/build2018"
data-height="600"
data-widget-id="993551050207612928">#build2018 Tweets</a>
<script>
!function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + "://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");
</script>
</div>
</div>
|
@{
Layout = "_GeneralLayout";
}
<h1>@ViewData["Title"]</h1>
<div class="row">
<div class="col-md-6">
<h2>#video</h2>
<iframe width="100%" height="315" src="https://www.youtube.com/embed/rd0Rd8w3FZ0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div class="col-md-6">
<a class="twitter-timeline"
href="https://twitter.com/hashtag/build2018"
data-height="600"
data-widget-id="993551050207612928">#build2018 Tweets</a>
<script>
!function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + "://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");
</script>
</div>
</div>
|
mit
|
C#
|
2e767a529253a6c99ec3d1c6a2dc50b07da21689
|
Fix incorrect acronym
|
NeoAdonis/osu,peppy/osu,UselessToucan/osu,smoogipooo/osu,naoey/osu,smoogipoo/osu,NeoAdonis/osu,EVAST9919/osu,2yangk23/osu,ZLima12/osu,ppy/osu,peppy/osu,johnneijzen/osu,naoey/osu,DrabWeb/osu,naoey/osu,UselessToucan/osu,smoogipoo/osu,DrabWeb/osu,EVAST9919/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,DrabWeb/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,ZLima12/osu,peppy/osu
|
osu.Game/Rulesets/Mods/IMod.cs
|
osu.Game/Rulesets/Mods/IMod.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Rulesets.Mods
{
public interface IMod
{
/// <summary>
/// The shortened name of this mod.
/// </summary>
[JsonProperty("acronym")]
string Acronym { get; }
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.Rulesets.Mods
{
public interface IMod
{
/// <summary>
/// The shortened name of this mod.
/// </summary>
[JsonProperty]
string Acronym { get; }
}
}
|
mit
|
C#
|
b003e22a6963ae884e547a6a4ee5a2edc241caf5
|
use simple syntax
|
the-ress/HarshPoint,NaseUkolyCZ/HarshPoint,HarshPoint/HarshPoint
|
HarshPoint/Provisioning/HarshProvisionerContext.cs
|
HarshPoint/Provisioning/HarshProvisionerContext.cs
|
using Microsoft.SharePoint.Client;
namespace HarshPoint.Provisioning
{
public sealed class HarshProvisionerContext
: Implementation.HarshProvisionerContextBase<HarshProvisionerContext>
{
public HarshProvisionerContext(ClientContext clientContext)
{
if (clientContext == null)
{
throw Error.ArgumentNull(nameof(clientContext));
}
ClientContext = clientContext;
}
public ClientContext ClientContext
{
get;
private set;
}
public Site Site => ClientContext?.Site;
public Web Web => ClientContext?.Web;
}
}
|
using Microsoft.SharePoint.Client;
namespace HarshPoint.Provisioning
{
public sealed class HarshProvisionerContext
: Implementation.HarshProvisionerContextBase<HarshProvisionerContext>
{
public HarshProvisionerContext(ClientContext clientContext)
{
if (clientContext == null)
{
throw Error.ArgumentNull(nameof(clientContext));
}
ClientContext = clientContext;
}
public ClientContext ClientContext
{
get;
private set;
}
public Site Site
{
get { return ClientContext?.Site; }
}
public Web Web
{
get { return ClientContext?.Web; }
}
}
}
|
bsd-2-clause
|
C#
|
bf4b91cd0e07ad45cc84054c64e55de0ef8f633a
|
Add ProjectTypeKey property on Project entity
|
dapplo/Dapplo.Jira
|
src/Dapplo.Jira/Entities/Project.cs
|
src/Dapplo.Jira/Entities/Project.cs
|
// Dapplo - building blocks for .NET applications
// Copyright (C) 2017-2019 Dapplo
//
// For more information see: http://dapplo.net/
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
//
// This file is part of Dapplo.Jira
//
// Dapplo.Jira is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Dapplo.Jira is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have a copy of the GNU Lesser General Public License
// along with Dapplo.Jira. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Dapplo.Jira.Entities
{
/// <summary>
/// Project information (retrieved via /project/id)
/// See: https://docs.atlassian.com/jira/REST/latest/#api/2/project
/// </summary>
[JsonObject]
public class Project : ProjectDigest
{
/// <summary>
/// AssigneeType describes how the assignment of tickets works, if this says project-lead every ticket will be assigned
/// to the person which that role.
/// </summary>
[JsonProperty("assigneeType")]
public string AssigneeType { get; set; }
/// <summary>
/// Url to browse the tickets with
/// </summary>
[JsonProperty("url")]
public Uri BrowseUrl { get; set; }
/// <summary>
/// Components for this project, this is only a "digest" retrieve the component details for more information.
/// </summary>
[JsonProperty("components")]
public IList<ComponentDigest> Components { get; set; }
/// <summary>
/// The description of the project
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// TODO: Uncertain what this is, please comment!
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }
/// <summary>
/// Possible issue types for this project
/// </summary>
[JsonProperty("issueTypes")]
public IList<IssueType> IssueTypes { get; set; }
/// <summary>
/// Urls to the possible roles for this project
/// </summary>
[JsonProperty("roles")]
public IDictionary<string, Uri> Roles { get; set; }
/// <summary>
/// Possible versions for this project
/// </summary>
[JsonProperty("versions")]
public IList<Version> Versions { get; set; }
/// <summary>
/// The project type e.g. software, service_desk, business
/// </summary>
[JsonProperty("projectTypeKey")]
public string ProjectTypeKey { get; set; }
}
}
|
// Dapplo - building blocks for .NET applications
// Copyright (C) 2017-2019 Dapplo
//
// For more information see: http://dapplo.net/
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
//
// This file is part of Dapplo.Jira
//
// Dapplo.Jira is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Dapplo.Jira is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have a copy of the GNU Lesser General Public License
// along with Dapplo.Jira. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Dapplo.Jira.Entities
{
/// <summary>
/// Project information (retrieved via /project/id)
/// See: https://docs.atlassian.com/jira/REST/latest/#api/2/project
/// </summary>
[JsonObject]
public class Project : ProjectDigest
{
/// <summary>
/// AssigneeType describes how the assignment of tickets works, if this says project-lead every ticket will be assigned
/// to the person which that role.
/// </summary>
[JsonProperty("assigneeType")]
public string AssigneeType { get; set; }
/// <summary>
/// Url to browse the tickets with
/// </summary>
[JsonProperty("url")]
public Uri BrowseUrl { get; set; }
/// <summary>
/// Components for this project, this is only a "digest" retrieve the component details for more information.
/// </summary>
[JsonProperty("components")]
public IList<ComponentDigest> Components { get; set; }
/// <summary>
/// The description of the project
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// TODO: Uncertain what this is, please comment!
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }
/// <summary>
/// Possible issue types for this project
/// </summary>
[JsonProperty("issueTypes")]
public IList<IssueType> IssueTypes { get; set; }
/// <summary>
/// Urls to the possible roles for this project
/// </summary>
[JsonProperty("roles")]
public IDictionary<string, Uri> Roles { get; set; }
/// <summary>
/// Possible versions for this project
/// </summary>
[JsonProperty("versions")]
public IList<Version> Versions { get; set; }
}
}
|
mit
|
C#
|
646f3d77c93ddd67d1e537f0334a65961aaeea79
|
update Pages
|
jackeiw/NFTW,jackeiw/NFTW
|
src/Web/Web/Views/Home/Index.cshtml
|
src/Web/Web/Views/Home/Index.cshtml
|
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<div>Hello World!</div>
|
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
|
mit
|
C#
|
ce1044e406c0d20d23465b3b9ffbb1f8697bbb85
|
Hide comment form if user not signed in.
|
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
|
src/CompetitionPlatform/Views/Project/CommentsPartial.cshtml
|
src/CompetitionPlatform/Views/Project/CommentsPartial.cshtml
|
@using System.Threading.Tasks
@using CompetitionPlatform.Helpers
@model CompetitionPlatform.Models.ProjectViewModels.ProjectCommentPartialViewModel
<form asp-controller="ProjectDetails" asp-action="AddComment" enctype="multipart/form-data">
@if (ClaimsHelper.GetUser(User.Identity).Email != null)
{
<div class="form-group">
@Html.Hidden("projectId", Model.ProjectId)
<input asp-for="@Model.ProjectId" type="hidden" />
<textarea asp-for="@Model.Comment" rows="5" class="form-control" placeholder="Enter your comment here..."></textarea>
</div>
<input type="submit" value="Post Comment" class="btn btn-primary pull-right" />
}
</form>
<div class="project-details-comments">
@foreach (var comment in Model.Comments)
{
<div class="container">
<div class="row">
<div class="project-comments-avatar inline">
<img src="~/images/avatar.svg"
alt="@Model.FullName"
asp-append-version="true" />
</div>
<p class="project-comment-author bold-text inline">
@comment.FullName
@if (Model.UserId == comment.UserId)
{
<span class="label label-primary">CREATOR</span>
}
</p>
<small class="inline text-muted">@comment.LastModified.ToString("hh:mm tt MMMM dd, yyyy")</small>
</div>
<div class="project-comment col-md-9">
<p class="project-comment-text">@comment.Comment</p>
</div>
</div>
}
</div>
|
@model CompetitionPlatform.Models.ProjectViewModels.ProjectCommentPartialViewModel
<form asp-controller="ProjectDetails" asp-action="AddComment" enctype="multipart/form-data">
<div class="form-group">
@Html.Hidden("projectId", Model.ProjectId)
<input asp-for="@Model.ProjectId" type="hidden" />
<textarea asp-for="@Model.Comment" rows="5" class="form-control" placeholder="Enter your comment here..."></textarea>
</div>
<input type="submit" value="Post Comment" class="btn btn-primary pull-right" />
</form>
<div class="project-details-comments">
@foreach (var comment in Model.Comments)
{
<div class="container">
<div class="row">
<div class="project-comments-avatar inline">
<img src="~/images/avatar.svg"
alt="@Model.FullName"
asp-append-version="true" />
</div>
<p class="project-comment-author bold-text inline">
@comment.FullName
@if (Model.UserId == comment.UserId)
{
<span class="label label-primary">CREATOR</span>
}
</p>
<small class="inline text-muted">@comment.LastModified.ToString("hh:mm tt MMMM dd, yyyy")</small>
</div>
<div class="project-comment col-md-9">
<p class="project-comment-text">@comment.Comment</p>
</div>
</div>
}
</div>
|
mit
|
C#
|
466951290f4e12134cc59f49b23c5af5979893d8
|
Clean up
|
alvivar/Hasten
|
TeaTime/Tools/Easef.cs
|
TeaTime/Tools/Easef.cs
|
// Easing functions <3
// 2016/06/18 01:17 AM
using UnityEngine;
public static class Easef
{
public static float Smoothstep(float t)
{
return t * t * (3f - 2f * t);
}
public static float Smootherstep(float t)
{
return t * t * t * (t * (6f * t - 15f) + 10f);
}
public static float Exponential(float t)
{
return t * t;
}
public static float EaseOut(float t)
{
return Mathf.Sin(t * Mathf.PI * 0.5f);
}
public static float EaseIn(float t)
{
return 1f - Mathf.Cos(t * Mathf.PI * 0.5f);
}
}
|
// Easing functions <3
// @matnesis
// 2016/06/18 01:17 AM
using UnityEngine;
public static class Easef
{
public static float Smoothstep(float t)
{
return t * t * (3f - 2f * t);
}
public static float Smootherstep(float t)
{
return t * t * t * (t * (6f * t - 15f) + 10f);
}
public static float Exponential(float t)
{
return t * t;
}
public static float EaseOut(float t)
{
return Mathf.Sin(t * Mathf.PI * 0.5f);
}
public static float EaseIn(float t)
{
return 1f - Mathf.Cos(t * Mathf.PI * 0.5f);
}
}
|
mit
|
C#
|
5214d9fa9196f1f22108a7329436593fdc776f32
|
comment handler settings method.
|
KevinJump/uSync,KevinJump/uSync,KevinJump/uSync
|
uSync.BackOffice/Configuration/uSyncHandlerSetSettings.cs
|
uSync.BackOffice/Configuration/uSyncHandlerSetSettings.cs
|
using System;
using System.Collections.Generic;
namespace uSync.BackOffice.Configuration
{
public class uSyncHandlerSetSettings
{
public bool Enabled { get; set; } = true;
public string[] HandlerGroups { get; set; } = Array.Empty<string>();
public string[] DisabledHandlers { get; set; } = Array.Empty<string>();
/// <summary>
/// default settings for all handlers
/// </summary>
public HandlerSettings HandlerDefaults { get; set; } = new HandlerSettings();
/// <summary>
/// settings for named handlers
/// </summary>
public IDictionary<string, HandlerSettings> Handlers { get; set; } = new Dictionary<string, HandlerSettings>();
}
public static class HandlerSetSettingsExtensions
{
/// <summary>
/// Get the handler settings for the named handler - (will load defaults if no speicifc handler settings are found)
/// </summary>
public static HandlerSettings GetHandlerSettings(this uSyncHandlerSetSettings handlerSet, string alias)
{
if (handlerSet.Handlers.ContainsKey(alias))
return handlerSet.Handlers[alias].Clone();
return handlerSet.HandlerDefaults.Clone();
}
}
}
|
using System;
using System.Collections.Generic;
namespace uSync.BackOffice.Configuration
{
public class uSyncHandlerSetSettings
{
public bool Enabled { get; set; } = true;
public string[] HandlerGroups { get; set; } = Array.Empty<string>();
public string[] DisabledHandlers { get; set; } = Array.Empty<string>();
/// <summary>
/// default settings for all handlers
/// </summary>
public HandlerSettings HandlerDefaults { get; set; } = new HandlerSettings();
/// <summary>
/// settings for named handlers
/// </summary>
public IDictionary<string, HandlerSettings> Handlers { get; set; } = new Dictionary<string, HandlerSettings>();
}
public static class HandlerSetSettingsExtensions
{
public static HandlerSettings GetHandlerSettings(this uSyncHandlerSetSettings handlerSet, string alias)
{
if (handlerSet.Handlers.ContainsKey(alias))
return handlerSet.Handlers[alias].Clone();
return handlerSet.HandlerDefaults.Clone();
}
}
}
|
mpl-2.0
|
C#
|
9fa3a96a1bcb9a3d0cb58f820741096761da7c51
|
Rename the test class and method
|
versionone/VersionOne.Integration.Bugzilla,versionone/VersionOne.Integration.Bugzilla,versionone/VersionOne.Integration.Bugzilla
|
VersionOne.Bugzilla.BugzillaAPI.Testss/BugTests.cs
|
VersionOne.Bugzilla.BugzillaAPI.Testss/BugTests.cs
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace VersionOne.Bugzilla.BugzillaAPI.Testss
{
[TestClass()]
public class Given_A_Bug
{
private IBug _bug;
private string _expectedReassignToPayload;
[TestInitialize()]
public void SetContext()
{
_bug = new Bug();
_expectedReassignToPayload = "{\r\n \"assigned_to\": \"denise@denise.com\",\r\n \"status\": \"CONFIRMED\",\r\n \"token\": \"terry.densmore@versionone.com\"\r\n}";
}
[TestMethod]
public void it_should_give_appropriate_reassignto_payloads()
{
var integrationUser = "terry.densmore@versionone.com";
_bug.AssignedTo = "denise@denise.com";
Assert.IsTrue(_expectedReassignToPayload == _bug.GetReassignBugPayload(integrationUser));
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace VersionOne.Bugzilla.BugzillaAPI.Testss
{
[TestClass()]
public class given_a_Bug
{
private IBug _bug;
private string _expectedReassignToPayload;
[TestInitialize()]
public void SetContext()
{
_bug = new Bug();
_expectedReassignToPayload = "{\r\n \"assigned_to\": \"denise@denise.com\",\r\n \"status\": \"CONFIRMED\",\r\n \"token\": \"terry.densmore@versionone.com\"\r\n}";
}
[TestMethod]
public void it_should_give_appropriate_reassigneto_payloads()
{
var integrationUser = "terry.densmore@versionone.com";
_bug.AssignedTo = "denise@denise.com";
Assert.IsTrue(_expectedReassignToPayload == _bug.GetReassignBugPayload(integrationUser));
}
}
}
|
bsd-3-clause
|
C#
|
0692bc90f88ac27f5ddc7c60e14749ff761b7b6e
|
adjust assembly info
|
boyko-ant/ASP.NET-CORS
|
BoykoAnt.CORS/BoykoAnt.CORS.Module/Properties/AssemblyInfo.cs
|
BoykoAnt.CORS/BoykoAnt.CORS.Module/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BoykoAnt.CORS.Module")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BoykoAnt.CORS.Module")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3bf504ae-e372-4461-aec5-58c327b32839")]
// 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: NeutralResourcesLanguageAttribute("en")]
|
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("BoykoAnt.CORS.Module")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BoykoAnt.CORS.Module")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3bf504ae-e372-4461-aec5-58c327b32839")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
9c165a42293b61f07624855d5d5a3938a17870a0
|
secure file password handling. Closes #12
|
0xFireball/PenguinUpload,0xFireball/PenguinUpload,0xFireball/PenguinUpload,0xFireball/PenguinUpload
|
PenguinUpload/src/PenguinUpload/DataModels/Files/PublicFile.cs
|
PenguinUpload/src/PenguinUpload/DataModels/Files/PublicFile.cs
|
using Newtonsoft.Json;
using PenguinUpload.DataModels.Auth;
using PenguinUpload.Services.Authentication;
using System;
using System.Collections;
namespace PenguinUpload.DataModels.Files
{
public class PublicFile
{
[JsonProperty("fileId")]
public string Identifier { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("uploadDate")]
public DateTime UploadedDate { get; set; } = DateTime.Now;
[JsonProperty("hrSize")]
public string HumanReadableSize { get; set; }
[JsonIgnore]
public ItemCrypto Crypto { get; set; }
[JsonProperty("locked")]
public bool IsPasswordProtected => Crypto != null;
public bool CheckPassword(string pass)
{
var cryptoHelper = new AuthCryptoHelper(Crypto.Conf);
var inputPass = cryptoHelper.CalculateUserPasswordHash(pass, Crypto.Salt);
return StructuralComparisons.StructuralEqualityComparer.Equals(inputPass, Crypto.Key);
}
}
}
|
using Newtonsoft.Json;
using PenguinUpload.DataModels.Auth;
using PenguinUpload.Services.Authentication;
using System;
namespace PenguinUpload.DataModels.Files
{
public class PublicFile
{
[JsonProperty("fileId")]
public string Identifier { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("uploadDate")]
public DateTime UploadedDate { get; set; } = DateTime.Now;
[JsonProperty("hrSize")]
public string HumanReadableSize { get; set; }
[JsonIgnore]
public ItemCrypto Crypto { get; set; }
[JsonProperty("locked")]
public bool IsPasswordProtected => Crypto != null;
public bool CheckPassword(string pass)
{
var cryptoHelper = new AuthCryptoHelper(Crypto.Conf);
}
}
}
|
apache-2.0
|
C#
|
720652340654ebbfc3099cc520e410f390e8909e
|
exclude test clas from code coverage
|
Olorin71/RetreatCode,Olorin71/RetreatCode
|
c#/TexasHoldEmSolution/TexasHoldEmTest/BestPossibleHandTest.cs
|
c#/TexasHoldEmSolution/TexasHoldEmTest/BestPossibleHandTest.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TexasHoldEm;
using TexasHoldEm.Interfaces;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace TexasHoldEmTest
{
[TestClass]
[ExcludeFromCodeCoverage]
public class BestPossibleHandTest
{
private BestPossibleHand best;
[TestInitialize]
public void Initialize()
{
best = new BestPossibleHand(HandName.Pair, new List<ICard> { TestData.DiamondKing, TestData.ClubKing },
new List<CardValue> { CardValue.Ace, CardValue.Eight, CardValue.Three });
}
[TestMethod]
public void StringContainsHandName()
{
Assert.IsTrue(best.ToString().Contains("Pair"));
}
[TestMethod]
public void StringContainsBestHandCards()
{
Assert.IsTrue(best.ToString().Contains("King of Diamonds"));
Assert.IsTrue(best.ToString().Contains("King of Clubs"));
}
[TestMethod]
public void StringContainsKickersCardValues()
{
Assert.IsTrue(best.ToString().Contains("Ace"));
Assert.IsTrue(best.ToString().Contains("Eight"));
Assert.IsTrue(best.ToString().Contains("Three"));
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TexasHoldEm;
using TexasHoldEm.Interfaces;
using System.Collections.Generic;
namespace TexasHoldEmTest
{
[TestClass]
public class BestPossibleHandTest
{
private BestPossibleHand best;
[TestInitialize]
public void Initialize()
{
best = new BestPossibleHand(HandName.Pair, new List<ICard> { TestData.DiamondKing, TestData.ClubKing },
new List<CardValue> { CardValue.Ace, CardValue.Eight, CardValue.Three });
}
[TestMethod]
public void StringContainsHandName()
{
Assert.IsTrue(best.ToString().Contains("Pair"));
}
[TestMethod]
public void StringContainsBestHandCards()
{
Assert.IsTrue(best.ToString().Contains("King of Diamonds"));
Assert.IsTrue(best.ToString().Contains("King of Clubs"));
}
[TestMethod]
public void StringContainsKickersCardValues()
{
Assert.IsTrue(best.ToString().Contains("Ace"));
Assert.IsTrue(best.ToString().Contains("Eight"));
Assert.IsTrue(best.ToString().Contains("Three"));
}
}
}
|
mit
|
C#
|
17d48c82f6f4d8ed22981b2ed4e749012709db55
|
Use switch statement instead of an array
|
ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,peppy/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs
|
osu.Game.Rulesets.Catch/Skinning/Legacy/LegacyFruitPiece.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Rulesets.Catch.Objects.Drawables;
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
{
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
protected override void LoadComplete()
{
base.LoadComplete();
var fruit = (DrawableFruit)DrawableHitObject;
if (fruit != null)
VisualRepresentation.BindTo(fruit.VisualRepresentation);
VisualRepresentation.BindValueChanged(visual => setTexture(visual.NewValue), true);
}
private void setTexture(FruitVisualRepresentation visualRepresentation)
{
switch (visualRepresentation)
{
case FruitVisualRepresentation.Pear:
SetTexture(Skin.GetTexture("fruit-pear"), Skin.GetTexture("fruit-pear-overlay"));
break;
case FruitVisualRepresentation.Grape:
SetTexture(Skin.GetTexture("fruit-grapes"), Skin.GetTexture("fruit-grapes-overlay"));
break;
case FruitVisualRepresentation.Pineapple:
SetTexture(Skin.GetTexture("fruit-apple"), Skin.GetTexture("fruit-apple-overlay"));
break;
case FruitVisualRepresentation.Raspberry:
SetTexture(Skin.GetTexture("fruit-orange"), Skin.GetTexture("fruit-orange-overlay"));
break;
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets.Catch.Objects.Drawables;
namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
internal class LegacyFruitPiece : LegacyCatchHitObjectPiece
{
public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();
private readonly string[] lookupNames =
{
"fruit-pear", "fruit-grapes", "fruit-apple", "fruit-orange"
};
protected override void LoadComplete()
{
base.LoadComplete();
var fruit = (DrawableFruit)DrawableHitObject;
if (fruit != null)
VisualRepresentation.BindTo(fruit.VisualRepresentation);
VisualRepresentation.BindValueChanged(visual => setTexture(visual.NewValue), true);
}
private void setTexture(FruitVisualRepresentation visualRepresentation)
{
Texture texture = Skin.GetTexture(lookupNames[(int)visualRepresentation]);
Texture overlayTexture = Skin.GetTexture(lookupNames[(int)visualRepresentation] + "-overlay");
SetTexture(texture, overlayTexture);
}
}
}
|
mit
|
C#
|
07e8e7943a3feff8332b4b396a8691de105eb767
|
bump version
|
Fody/Virtuosity
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Virtuosity")]
[assembly: AssemblyProduct("Virtuosity")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.13.0.0")]
[assembly: AssemblyFileVersion("1.13.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Virtuosity")]
[assembly: AssemblyProduct("Virtuosity")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.12.0.0")]
[assembly: AssemblyFileVersion("1.12.0.0")]
|
mit
|
C#
|
284705cbb731a7a8d635bcc1e35e0cd17fa21823
|
Bump version to 2.4.5
|
RazorGenerator/RazorGenerator,RazorGenerator/RazorGenerator
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System;
using System.Reflection;
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyProduct("RazorGenerator")]
[assembly: AssemblyCompany("RazorGenerator contributors")]
[assembly: AssemblyInformationalVersion("2.4.5")]
|
using System;
using System.Reflection;
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyProduct("RazorGenerator")]
[assembly: AssemblyCompany("RazorGenerator contributors")]
[assembly: AssemblyInformationalVersion("2.4.4")]
|
apache-2.0
|
C#
|
6e1d32dc6ddc7f8a037c898974b84f218972ff20
|
Update tests
|
peppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,ppy/osu
|
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
|
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Osu.Difficulty;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
[TestCase(6.8043847243906566d, 206, "diffcalc-test")]
[TestCase(1.449091582269485d, 45, "zero-length-sliders")]
public void Test(double expectedStarRating, int expectedMaxCombo, string name)
=> base.Test(expectedStarRating, expectedMaxCombo, name);
[TestCase(9.0768518847360937d, 206, "diffcalc-test")]
[TestCase(1.7555890739194639d, 45, "zero-length-sliders")]
public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime());
[TestCase(6.8043847243906566d, 239, "diffcalc-test")]
[TestCase(1.449091582269485d, 54, "zero-length-sliders")]
public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name)
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic());
protected override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset().RulesetInfo, beatmap);
protected override Ruleset CreateRuleset() => new OsuRuleset();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Osu.Difficulty;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
[TestCase(6.6972307565739273d, 206, "diffcalc-test")]
[TestCase(1.4484754139145539d, 45, "zero-length-sliders")]
public void Test(double expectedStarRating, int expectedMaxCombo, string name)
=> base.Test(expectedStarRating, expectedMaxCombo, name);
[TestCase(8.9382559208689809d, 206, "diffcalc-test")]
[TestCase(1.7548875851757628d, 45, "zero-length-sliders")]
public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime());
[TestCase(6.6972307218715166d, 239, "diffcalc-test")]
[TestCase(1.4484754139145537d, 54, "zero-length-sliders")]
public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name)
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic());
protected override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset().RulesetInfo, beatmap);
protected override Ruleset CreateRuleset() => new OsuRuleset();
}
}
|
mit
|
C#
|
4523020e65a773b15eab677b388c580ba04896bb
|
fix bug (regression)
|
mjedrzejek/nunit,nunit/nunit,mjedrzejek/nunit,nunit/nunit
|
src/NUnitFramework/framework/Internal/Commands/ConstructFixturePerTestCaseCommand.cs
|
src/NUnitFramework/framework/Internal/Commands/ConstructFixturePerTestCaseCommand.cs
|
// ***********************************************************************
// Copyright (c) 2017 Charlie Poole, Rob Prouse
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Interfaces;
namespace NUnit.Framework.Internal.Commands
{
/// <summary>
/// ConstructFixtureCommand constructs the user test object if necessary.
/// </summary>
public class ConstructFixturePerTestCaseCommand : BeforeTestCommand
{
/// <summary>
/// Constructs a fixture per test case
/// </summary>
/// <param name="innerCommand">The inner command to which the command applies</param>
public ConstructFixturePerTestCaseCommand(TestCommand innerCommand)
: base(innerCommand)
{
TestSuite testSuite = null;
TestFixture testFixture = null;
ITest currentTest = Test;
while (currentTest != null && (testSuite == null || testFixture == null))
{
testSuite = testSuite ?? currentTest as TestSuite;
testFixture = testFixture ?? currentTest as TestFixture;
currentTest = currentTest.Parent;
}
Guard.ArgumentValid(testSuite is TestSuite, "ConstructFixturePerTestCaseCommand must reference a TestSuite", nameof(innerCommand));
BeforeTest = (context) =>
{
ITypeInfo typeInfo = Test.TypeInfo;
if (typeInfo != null && !typeInfo.IsStaticClass)
{
context.TestObject = typeInfo.Construct(testSuite.Arguments);
Test.Fixture = context.TestObject;
}
};
}
}
}
|
// ***********************************************************************
// Copyright (c) 2017 Charlie Poole, Rob Prouse
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Interfaces;
namespace NUnit.Framework.Internal.Commands
{
/// <summary>
/// ConstructFixtureCommand constructs the user test object if necessary.
/// </summary>
public class ConstructFixturePerTestCaseCommand : BeforeTestCommand
{
/// <summary>
/// Constructs a fixture per test case
/// </summary>
/// <param name="innerCommand">The inner command to which the command applies</param>
public ConstructFixturePerTestCaseCommand(TestCommand innerCommand)
: base(innerCommand)
{
TestSuite testSuite = null;
TestFixture testFixture = null;
ITest currentTest = Test;
while (currentTest != null && (testSuite == null || testFixture == null))
{
testSuite = testSuite ?? currentTest as TestSuite;
testFixture = testFixture ?? currentTest as TestFixture;
currentTest = currentTest.Parent;
}
Guard.ArgumentValid(testSuite is TestSuite, "ConstructFixturePerTestCaseCommand must reference a TestSuite", nameof(innerCommand));
BeforeTest = (context) =>
{
ITypeInfo typeInfo = Test.TypeInfo;
if (context.TestObject == null && typeInfo != null && !typeInfo.IsStaticClass)
{
context.TestObject = typeInfo.Construct(testSuite.Arguments);
Test.Fixture = context.TestObject;
}
};
}
}
}
|
mit
|
C#
|
067e9e216eeca45f0157eeb8865cae8b325816f4
|
fix type mistake
|
JohnTheGr8/YifySharp
|
src/YifySharp/Models/UserDetails.cs
|
src/YifySharp/Models/UserDetails.cs
|
using System;
namespace YifySharp.Models
{
public class UserDetails
{
/// <summary>
/// User identification number
/// </summary>
public int Id { get; set; }
/// <summary>
/// User's username
/// </summary>
public string Username { get; set; }
/// <summary>
/// User's group name
/// </summary>
public string Group { get; set; }
/// <summary>
/// Link to user's page in yts.re
/// </summary>
public string Url { get; set; }
/// <summary>
/// User's description text
/// </summary>
public string AboutText { get; set; }
/// <summary>
/// Link to small-sized avatar of user
/// </summary>
public string SmallAvatarImage { get; set; }
/// <summary>
/// Link to medium-sized avatar of user
/// </summary>
public string MediumAvatarImage { get; set; }
/// <summary>
/// The date the user registered
/// </summary>
public DateTime DateJoined { get; set; }
/// <summary>
/// The date the user registered, in epoch format
/// </summary>
public int DateJoinedUnix { get; set; }
/// <summary>
/// The date the user was last seen online
/// </summary>
public DateTime DateLastSeen { get; set; }
/// <summary>
/// The date the user was last seen online, in epoch format
/// </summary>
public int DateLastSeenUnix { get; set; }
}
}
|
using System;
namespace YifySharp.Models
{
public class UserDetails
{
/// <summary>
/// User identification number
/// </summary>
public int Id { get; set; }
/// <summary>
/// User's username
/// </summary>
public string Username { get; set; }
/// <summary>
/// User's group name
/// </summary>
public string Group { get; set; }
/// <summary>
/// Link to user's page in yts.re
/// </summary>
public string Url { get; set; }
/// <summary>
/// User's description text
/// </summary>
public string AboutText { get; set; }
/// <summary>
/// Link to small-sized avatar of user
/// </summary>
public string SmallAvatarImage { get; set; }
/// <summary>
/// Link to medium-sized avatar of user
/// </summary>
public string MediumAvatarImage { get; set; }
/// <summary>
/// The date the user registered
/// </summary>
public string DateJoined { get; set; }
/// <summary>
/// The date the user registered, in epoch format
/// </summary>
public int DateJoinedUnix { get; set; }
/// <summary>
/// The date the user was last seen online
/// </summary>
public DateTime DateLastSeen { get; set; }
/// <summary>
/// The date the user was last seen online, in epoch format
/// </summary>
public int DateLastSeenUnix { get; set; }
}
}
|
mit
|
C#
|
0d60fe7cfc5829a4434756baa0c9fd86ed3eaf8e
|
Change Error class to internal
|
pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet
|
src/TelemetryChannels/ServerTelemetryChannel/Shared/Implementation/BackendResponse.cs
|
src/TelemetryChannels/ServerTelemetryChannel/Shared/Implementation/BackendResponse.cs
|
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
using System.Runtime.Serialization;
[DataContract]
internal class BackendResponse
{
[DataMember(Name = "itemsReceived")]
public int ItemsReceived { get; set; }
[DataMember(Name = "itemsAccepted")]
public int ItemsAccepted { get; set; }
[DataMember(Name = "errors")]
public Error[] Errors { get; set; }
[DataContract]
internal class Error
{
[DataMember(Name = "index")]
public int Index { get; set; }
[DataMember(Name = "statusCode")]
public int StatusCode { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
}
}
}
|
namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
using System.Runtime.Serialization;
[DataContract]
internal class BackendResponse
{
[DataMember(Name = "itemsReceived")]
public int ItemsReceived { get; set; }
[DataMember(Name = "itemsAccepted")]
public int ItemsAccepted { get; set; }
[DataMember(Name = "errors")]
public Error[] Errors { get; set; }
[DataContract]
public class Error
{
[DataMember(Name = "index")]
public int Index { get; set; }
[DataMember(Name = "statusCode")]
public int StatusCode { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
}
}
}
|
mit
|
C#
|
7c400036f364a1ecc5b04e0e4f7aeded067e11b1
|
adjust test code.
|
Codeer-Software/Friendly.Windows,Codeer-Software/Friendly.Windows,Codeer-Software/Friendly.Windows
|
Project/UnitTest/Test.cs
|
Project/UnitTest/Test.cs
|
using System;
using System.Diagnostics;
using System.Windows.Forms;
using Codeer.Friendly.Dynamic;
using Codeer.Friendly.Windows;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class Test
{
[TestMethod]
public void Check()
{
}
}
}
|
using System;
using System.Diagnostics;
using System.Windows.Forms;
using Codeer.Friendly.Dynamic;
using Codeer.Friendly.Windows;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class Test
{
[TestMethod]
public void Check()
{
using (var app = new WindowsAppFriend(Process.GetProcessesByName("Hoge.R01.Start")[0]))
{
}
}
}
}
|
apache-2.0
|
C#
|
5ff3de7e50fe33ebb9d2735a1cf30268d1abb492
|
add table init to bootstrap
|
colbylwilliams/XWeather,colbylwilliams/XWeather
|
XWeather/Shared/Bootstrap.cs
|
XWeather/Shared/Bootstrap.cs
|
using System.Threading.Tasks;
using Microsoft.Azure.Mobile;
using Microsoft.Azure.Mobile.Crashes;
using ModernHttpClient;
using Plugin.VersionTracking;
using ServiceStack;
using SettingsStudio;
using NomadCode.Azure;
using XWeather.Constants;
using XWeather.Domain;
#if __IOS__
using PclExportClient = ServiceStack.IosPclExportClient;
#elif __ANDROID__
using PclExportClient = ServiceStack.AndroidPclExportClient;
#endif
namespace XWeather.Shared
{
public static class Bootstrap
{
public static void Run ()
{
CrossVersionTracking.Current.Track ();
Crashes.GetErrorAttachment = (report) => ErrorAttachment.AttachmentWithText (CrossVersionTracking.Current.ToString ());
if (!string.IsNullOrEmpty (PrivateKeys.MobileCenter.AppSecret))
MobileCenter.Start (PrivateKeys.MobileCenter.AppSecret,
typeof (Microsoft.Azure.Mobile.Analytics.Analytics),
typeof (Microsoft.Azure.Mobile.Crashes.Crashes));
Settings.AzureStoreEnabled = !string.IsNullOrEmpty (PrivateKeys.MobileCenter.ServiceUrl);
PclExportClient.Configure ();
JsonHttpClient.GlobalHttpMessageHandlerFactory = () => new NativeMessageHandler ();
Settings.RegisterDefaultSettings ();
#if __ANDROID__
Settings.VersionNumber = CrossVersionTracking.Current.CurrentVersion;
Settings.BuildNumber = CrossVersionTracking.Current.CurrentBuild;
Settings.RandomBackgrounds |= CrossVersionTracking.Current.IsFirstLaunchEver;
#endif
}
public static async Task InitializeDataStore ()
{
if (Settings.AzureStoreEnabled)
{
AzureClient.Shared.RegisterTable<WuAcLocation> ();
await AzureClient.Shared.InitializeAzync (PrivateKeys.MobileCenter.ServiceUrl);
}
}
}
}
|
using Microsoft.Azure.Mobile;
using Microsoft.Azure.Mobile.Crashes;
using ModernHttpClient;
using Plugin.VersionTracking;
using ServiceStack;
using SettingsStudio;
using XWeather.Constants;
#if __IOS__
using PclExportClient = ServiceStack.IosPclExportClient;
#elif __ANDROID__
using PclExportClient = ServiceStack.AndroidPclExportClient;
#endif
namespace XWeather.Shared
{
public static class Bootstrap
{
public static void Run ()
{
CrossVersionTracking.Current.Track ();
Crashes.GetErrorAttachment = (report) => ErrorAttachment.AttachmentWithText (CrossVersionTracking.Current.ToString ());
if (!string.IsNullOrEmpty (PrivateKeys.MobileCenter.AppSecret))
MobileCenter.Start (PrivateKeys.MobileCenter.AppSecret,
typeof (Microsoft.Azure.Mobile.Analytics.Analytics),
typeof (Microsoft.Azure.Mobile.Crashes.Crashes));
PclExportClient.Configure ();
JsonHttpClient.GlobalHttpMessageHandlerFactory = () => new NativeMessageHandler ();
Settings.RegisterDefaultSettings ();
#if __ANDROID__
Settings.VersionNumber = CrossVersionTracking.Current.CurrentVersion;
Settings.BuildNumber = CrossVersionTracking.Current.CurrentBuild;
#endif
}
}
}
|
mit
|
C#
|
217e72b9a269874e4fa73eb0e6ebf7ce346411df
|
Allow line breaks
|
DragonSpark/Framework,DragonSpark/Framework,DragonSpark/Framework,DragonSpark/Framework
|
DragonSpark.Application/Components/Validation/Expressions/StandardCharactersPattern.cs
|
DragonSpark.Application/Components/Validation/Expressions/StandardCharactersPattern.cs
|
namespace DragonSpark.Application.Components.Validation.Expressions;
public sealed class StandardCharactersPattern : Expression
{
public static StandardCharactersPattern Default { get; } = new StandardCharactersPattern();
StandardCharactersPattern() : base(@"([a-zA-Z0-9- _.;'"":!+*&%$#^@=[\]()~`<>\\/,?{}\|]|\n|\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])") {}
}
|
namespace DragonSpark.Application.Components.Validation.Expressions;
public sealed class StandardCharactersPattern : Expression
{
public static StandardCharactersPattern Default { get; } = new StandardCharactersPattern();
StandardCharactersPattern() : base(@"([a-zA-Z0-9- _.;'"":!+*&%$#^@=[\]()~`<>\\/,?{}\|]|\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])") {}
}
|
mit
|
C#
|
a63f4e8ef01d7cc97109e5e5c4226c4528fedb75
|
Fix cast
|
VictorTomaili/Randomizer
|
Randomizer/Randomizer.cs
|
Randomizer/Randomizer.cs
|
using System.Linq;
namespace System.Collections.Generic
{
public class Randomizer<TItem> : IEnumerable<TItem>
{
#region Implementation of IEnumerable
public TItem[] Items { get; set; }
public Randomizer(IEnumerable<TItem> items)
{
Items = items.ToArray();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public IEnumerator<TItem> GetEnumerator()
{
return new RandomItemEnumerator<TItem>(Items);
}
#endregion
}
}
|
namespace System.Collections.Generic
{
public class Randomizer<TItem> : IEnumerable<TItem>
{
#region Implementation of IEnumerable
public TItem[] Items { get; set; }
public Randomizer(IEnumerable items)
{
Items = items as TItem[];
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public IEnumerator<TItem> GetEnumerator()
{
return new RandomItemEnumerator<TItem>(Items);
}
#endregion
}
}
|
mit
|
C#
|
50dc40c06a71b01b98952298cfce984cd3463faf
|
Fix Guid not mapped correctly to IdGraphyType when AutoGenerating Object Graph (#918)
|
graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet,joemcbride/graphql-dotnet,graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet
|
src/GraphQL/Utilities/GraphTypeTypeRegistry.cs
|
src/GraphQL/Utilities/GraphTypeTypeRegistry.cs
|
using System;
using System.Collections.Generic;
using GraphQL.Types;
namespace GraphQL.Utilities
{
public static class GraphTypeTypeRegistry
{
static readonly Dictionary<Type, Type> _entries;
static GraphTypeTypeRegistry()
{
_entries = new Dictionary<Type, Type>
{
[typeof(int)] = typeof(IntGraphType),
[typeof(long)] = typeof(IntGraphType),
[typeof(double)] = typeof(FloatGraphType),
[typeof(float)] = typeof(FloatGraphType),
[typeof(decimal)] = typeof(DecimalGraphType),
[typeof(string)] = typeof(StringGraphType),
[typeof(bool)] = typeof(BooleanGraphType),
[typeof(DateTime)] = typeof(DateGraphType),
[typeof(DateTimeOffset)] = typeof(DateTimeOffsetGraphType),
[typeof(TimeSpan)] = typeof(TimeSpanSecondsGraphType),
[typeof(Guid)] = typeof(IdGraphType)
};
}
public static void Register<T, TGraph>() where TGraph : GraphType
{
Register(typeof(T), typeof(TGraph));
}
public static void Register(Type clrType, Type graphType)
{
_entries[clrType] = graphType;
}
public static Type Get<TClr>()
{
return Get(typeof(TClr));
}
public static Type Get(Type clrType)
{
if (_entries.TryGetValue(clrType, out var graphType))
{
return graphType;
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using GraphQL.Types;
namespace GraphQL.Utilities
{
public static class GraphTypeTypeRegistry
{
static readonly Dictionary<Type, Type> _entries;
static GraphTypeTypeRegistry()
{
_entries = new Dictionary<Type, Type>
{
[typeof(int)] = typeof(IntGraphType),
[typeof(long)] = typeof(IntGraphType),
[typeof(double)] = typeof(FloatGraphType),
[typeof(float)] = typeof(FloatGraphType),
[typeof(decimal)] = typeof(DecimalGraphType),
[typeof(string)] = typeof(StringGraphType),
[typeof(bool)] = typeof(BooleanGraphType),
[typeof(DateTime)] = typeof(DateGraphType),
[typeof(DateTimeOffset)] = typeof(DateTimeOffsetGraphType),
[typeof(TimeSpan)] = typeof(TimeSpanSecondsGraphType)
};
}
public static void Register<T, TGraph>() where TGraph : GraphType
{
Register(typeof(T), typeof(TGraph));
}
public static void Register(Type clrType, Type graphType)
{
_entries[clrType] = graphType;
}
public static Type Get<TClr>()
{
return Get(typeof(TClr));
}
public static Type Get(Type clrType)
{
if (_entries.TryGetValue(clrType, out var graphType))
{
return graphType;
}
return null;
}
}
}
|
mit
|
C#
|
a2c77352ac3eede16a8cf85e81245ed66e074c44
|
Change version to 1.1
|
marska/habitrpg-api-dotnet-client
|
src/HabitRPG.Client/Properties/AssemblyInfo.cs
|
src/HabitRPG.Client/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("HabitRPG.Client")]
[assembly: AssemblyDescription("Simple HabitRPG API Client Library.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mariusz Skarupiński")]
[assembly: AssemblyProduct("HabitRPG.Client")]
[assembly: AssemblyCopyright("Copyright © Mariusz Skarupiński 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("08640ace-5a58-4b8b-a279-56a73f5f5a05")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
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("HabitRPG.Client")]
[assembly: AssemblyDescription("Simple HabitRPG API Client Library.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mariusz Skarupiński")]
[assembly: AssemblyProduct("HabitRPG.Client")]
[assembly: AssemblyCopyright("Copyright © Mariusz Skarupiński 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("08640ace-5a58-4b8b-a279-56a73f5f5a05")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.1.*")]
|
apache-2.0
|
C#
|
d5334787d23f7a4dfc6b05756317f4b325aee2cf
|
change IRealServiceProvider to IServiceProvider
|
AspectCore/Lite,AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/AspectCore-Framework
|
src/AspectCore.Extensions.DependencyInjection/ActivatorUtilitieInterceptorActivator.cs
|
src/AspectCore.Extensions.DependencyInjection/ActivatorUtilitieInterceptorActivator.cs
|
using System;
using AspectCore.Abstractions;
using AspectCore.Core;
using Microsoft.Extensions.DependencyInjection;
namespace AspectCore.Extensions.DependencyInjection
{
internal sealed class ActivatorUtilitieInterceptorActivator : ITypedInterceptorActivator
{
private readonly IServiceProvider _serviceProvider;
public ActivatorUtilitieInterceptorActivator(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public IInterceptor CreateInstance(Type interceptorType, object[] args)
{
return (IInterceptor)ActivatorUtilities.CreateInstance(_serviceProvider, interceptorType, args);
}
}
}
|
using System;
using AspectCore.Abstractions;
using AspectCore.Core;
using Microsoft.Extensions.DependencyInjection;
namespace AspectCore.Extensions.DependencyInjection
{
internal sealed class ActivatorUtilitieInterceptorActivator : ITypedInterceptorActivator
{
private readonly IRealServiceProvider _serviceProvider;
public ActivatorUtilitieInterceptorActivator(IRealServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public IInterceptor CreateInstance(Type interceptorType, object[] args)
{
return (IInterceptor)ActivatorUtilities.CreateInstance(_serviceProvider, interceptorType, args);
}
}
}
|
mit
|
C#
|
6134c3b147b19f105d8f6d5eaa37dd03c61ee47c
|
change should method method call to use generics to define return object
|
takenet/lime-csharp
|
src/Lime.Protocol.UnitTests/Serialization/TypeUtilTests.cs
|
src/Lime.Protocol.UnitTests/Serialization/TypeUtilTests.cs
|
using System.Globalization;
using Lime.Protocol.Serialization;
using NUnit.Framework;
using Shouldly;
namespace Lime.Protocol.UnitTests.Serialization
{
[TestFixture]
public class TypeUtilTests
{
[Test]
public void GetGenericFormatterParseFunc_DoubleInvariantCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFunc<double>();
var result = parseFunc("100.000", CultureInfo.InvariantCulture);
// Assert
result.ShouldBe(100);
}
[Test]
public void GetGenericFormatterParseFunc_DoubleSpecificCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFunc<double>();
var result = parseFunc("100.000", CultureInfo.GetCultureInfo("pt-BR"));
// Assert
result.ShouldBe(100_000);
}
[Test]
public void GetFormatterParseFunc_DoubleInvariantCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFuncForType(typeof(double));
var result = parseFunc("100.000", CultureInfo.InvariantCulture);
// Assert
result.ShouldBe(100);
}
[Test]
public void GetFormatterParseFunc_DoubleSpecificCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFuncForType(typeof(double));
var result = parseFunc("100.000", CultureInfo.GetCultureInfo("pt-BR"));
// Assert
result.ShouldBe(100_000);
}
[Test]
public void GetStringValue_EmptyStringToEmptyArray_ReturnEmptyArray()
{
object result = null;
//Act
TypeUtilEx.TryParseString(string.Empty, typeof(string[]), out result, CultureInfo.InvariantCulture);
//Assert
var output = result.ShouldBeOfType<string[]>();
output.ShouldBeEmpty();
}
}
}
|
using System.Globalization;
using Lime.Protocol.Serialization;
using NUnit.Framework;
using Shouldly;
namespace Lime.Protocol.UnitTests.Serialization
{
[TestFixture]
public class TypeUtilTests
{
[Test]
public void GetGenericFormatterParseFunc_DoubleInvariantCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFunc<double>();
var result = parseFunc("100.000", CultureInfo.InvariantCulture);
// Assert
result.ShouldBe(100);
}
[Test]
public void GetGenericFormatterParseFunc_DoubleSpecificCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFunc<double>();
var result = parseFunc("100.000", CultureInfo.GetCultureInfo("pt-BR"));
// Assert
result.ShouldBe(100_000);
}
[Test]
public void GetFormatterParseFunc_DoubleInvariantCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFuncForType(typeof(double));
var result = parseFunc("100.000", CultureInfo.InvariantCulture);
// Assert
result.ShouldBe(100);
}
[Test]
public void GetFormatterParseFunc_DoubleSpecificCulture_ReturnValidParser()
{
// Act
var parseFunc = TypeUtilEx.GetFormattedParseFuncForType(typeof(double));
var result = parseFunc("100.000", CultureInfo.GetCultureInfo("pt-BR"));
// Assert
result.ShouldBe(100_000);
}
[Test]
public void GetStringValue_EmptyStringToEmptyArray_ReturnEmptyArray()
{
object result = null;
//Act
TypeUtilEx.TryParseString("", typeof(string[]), out result, CultureInfo.InvariantCulture);
result.ShouldBeOfType(typeof(string[]));
((string[])result).Length.ShouldBe(0);
}
}
}
|
apache-2.0
|
C#
|
6a294ef8ddca3a8066b8b8dcb766198fef9e33c4
|
make encoding private
|
lvermeulen/Nanophone
|
src/Nanophone.RegistryHost.InMemoryRegistry/Base64Codec.cs
|
src/Nanophone.RegistryHost.InMemoryRegistry/Base64Codec.cs
|
using System;
using System.Text;
namespace Nanophone.RegistryHost.InMemoryRegistry
{
public class Base64Codec
{
private readonly Encoding _encoding;
public Base64Codec(Encoding encoding)
{
_encoding = encoding;
}
public Base64Codec()
: this(Encoding.UTF8)
{ }
public string Encode(string s)
{
var bytes = _encoding.GetBytes(s);
return Convert.ToBase64String(bytes);
}
public byte[] EncodeToBytes(string s)
{
return _encoding.GetBytes(Encode(s));
}
public string Decode(string s)
{
var bytes = Convert.FromBase64String(s);
return _encoding.GetString(bytes);
}
public string DecodeFromBytes(byte[] bytes)
{
return Decode(_encoding.GetString(bytes));
}
}
}
|
using System;
using System.Text;
namespace Nanophone.RegistryHost.InMemoryRegistry
{
public class Base64Codec
{
public Encoding Encoding { get; set; }
public Base64Codec()
{
Encoding = Encoding.UTF8;
}
public string Encode(string s)
{
var bytes = Encoding.GetBytes(s);
return Convert.ToBase64String(bytes);
}
public byte[] EncodeToBytes(string s)
{
return Encoding.GetBytes(Encode(s));
}
public string Decode(string s)
{
var bytes = Convert.FromBase64String(s);
return Encoding.GetString(bytes);
}
public string DecodeFromBytes(byte[] bytes)
{
return Decode(Encoding.GetString(bytes));
}
}
}
|
mit
|
C#
|
c3a522f5cbde587bf0573665661e2378799c36a2
|
Improve error message on EmptyConstraint
|
appel1/nunit,JustinRChou/nunit,mikkelbu/nunit,mikkelbu/nunit,mjedrzejek/nunit,nunit/nunit,OmicronPersei/nunit,JustinRChou/nunit,nunit/nunit,mjedrzejek/nunit,OmicronPersei/nunit,appel1/nunit
|
src/NUnitFramework/framework/Constraints/EmptyConstraint.cs
|
src/NUnitFramework/framework/Constraints/EmptyConstraint.cs
|
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole, Rob Prouse
//
// 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;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// EmptyConstraint tests a whether a string or collection is empty,
/// postponing the decision about which test is applied until the
/// type of the actual argument is known.
/// </summary>
public class EmptyConstraint : Constraint
{
private Constraint realConstraint;
/// <summary>
/// The Description of what this constraint tests, for
/// use in messages and in the ConstraintResult.
/// </summary>
public override string Description
{
get { return realConstraint == null ? "<empty>" : realConstraint.Description; }
}
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public override ConstraintResult ApplyTo<TActual>(TActual actual)
{
// NOTE: actual is string will fail for a null typed as string
Type actualType = typeof(TActual);
if (actualType == typeof(string))
realConstraint = new EmptyStringConstraint();
else if (actual == null)
throw new System.ArgumentException($"The actual value of type - {actualType} must be a string or a non-null IEnumerable or DirectoryInfo", nameof(actual));
else if (actual is System.IO.DirectoryInfo)
realConstraint = new EmptyDirectoryConstraint();
else
realConstraint = new EmptyCollectionConstraint();
return realConstraint.ApplyTo(actual);
}
}
}
|
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole, Rob Prouse
//
// 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;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// EmptyConstraint tests a whether a string or collection is empty,
/// postponing the decision about which test is applied until the
/// type of the actual argument is known.
/// </summary>
public class EmptyConstraint : Constraint
{
private Constraint realConstraint;
/// <summary>
/// The Description of what this constraint tests, for
/// use in messages and in the ConstraintResult.
/// </summary>
public override string Description
{
get { return realConstraint == null ? "<empty>" : realConstraint.Description; }
}
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public override ConstraintResult ApplyTo<TActual>(TActual actual)
{
// NOTE: actual is string will fail for a null typed as string
Type actualType = typeof(TActual);
if (typeof(TActual) == typeof(string))
realConstraint = new EmptyStringConstraint();
else if (actual == null)
throw new System.ArgumentException($"The actual value of type - {actualType} must be a string or a non-null IEnumerable or DirectoryInfo", nameof(actual));
else if (actual is System.IO.DirectoryInfo)
realConstraint = new EmptyDirectoryConstraint();
else
realConstraint = new EmptyCollectionConstraint();
return realConstraint.ApplyTo(actual);
}
}
}
|
mit
|
C#
|
e33ab018f81d8b81fb56041cbe4791e011e83367
|
Update SolidColorBrushImpl.cs
|
SuperJMN/Avalonia,susloparovdenis/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,punker76/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,jkoritzinsky/Perspex,jazzay/Perspex,jkoritzinsky/Avalonia,ncarrillo/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,tshcherban/Perspex,kekekeks/Perspex,SuperJMN/Avalonia,bbqchickenrobot/Perspex,susloparovdenis/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,OronDF343/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,kekekeks/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,OronDF343/Avalonia,wieslawsoltes/Perspex,danwalmsley/Perspex,akrisiun/Perspex,susloparovdenis/Perspex,jkoritzinsky/Avalonia,grokys/Perspex,susloparovdenis/Perspex,SuperJMN/Avalonia,MrDaedra/Avalonia,SuperJMN/Avalonia,DavidKarlas/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,MrDaedra/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,wieslawsoltes/Perspex
|
src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs
|
src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs
|
// -----------------------------------------------------------------------
// <copyright file="SolidColorBrushImpl.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{
public class SolidColorBrushImpl : BrushImpl
{
public SolidColorBrushImpl(Perspex.Media.SolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target)
{
this.PlatformBrush = new SharpDX.Direct2D1.SolidColorBrush(
target,
brush?.Color.ToDirect2D() ?? new SharpDX.Color4(),
new SharpDX.Direct2D1.BrushProperties
{
Opacity = brush != null ? (float)brush.Opacity : 1.0f,
Transform = target.Transform
}
);
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="SolidColorBrushImpl.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{
public class SolidColorBrushImpl : BrushImpl
{
public SolidColorBrushImpl(Perspex.Media.SolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target)
{
this.PlatformBrush = new SharpDX.Direct2D1.SolidColorBrush(target, brush?.Color.ToDirect2D() ?? new SharpDX.Color4(), new SharpDX.Direct2D1.BrushProperties { Opacity = brush != null ? (float)brush.Opacity : 1.0f, Transform = target.Transform });
}
}
}
|
mit
|
C#
|
2821227448fb442bccda5e8b2351eb36cab32855
|
Add additional xml doc and untabify
|
yoder/CefSharp,ITGlobal/CefSharp,Livit/CefSharp,joshvera/CefSharp,jamespearce2006/CefSharp,zhangjingpu/CefSharp,jamespearce2006/CefSharp,battewr/CefSharp,yoder/CefSharp,NumbersInternational/CefSharp,NumbersInternational/CefSharp,jamespearce2006/CefSharp,Haraguroicha/CefSharp,illfang/CefSharp,rlmcneary2/CefSharp,dga711/CefSharp,joshvera/CefSharp,gregmartinhtc/CefSharp,Livit/CefSharp,Livit/CefSharp,Haraguroicha/CefSharp,battewr/CefSharp,Haraguroicha/CefSharp,rlmcneary2/CefSharp,illfang/CefSharp,ruisebastiao/CefSharp,yoder/CefSharp,twxstar/CefSharp,AJDev77/CefSharp,AJDev77/CefSharp,battewr/CefSharp,ruisebastiao/CefSharp,battewr/CefSharp,VioletLife/CefSharp,illfang/CefSharp,dga711/CefSharp,zhangjingpu/CefSharp,ITGlobal/CefSharp,joshvera/CefSharp,haozhouxu/CefSharp,wangzheng888520/CefSharp,joshvera/CefSharp,AJDev77/CefSharp,rlmcneary2/CefSharp,rlmcneary2/CefSharp,haozhouxu/CefSharp,ruisebastiao/CefSharp,Livit/CefSharp,NumbersInternational/CefSharp,zhangjingpu/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,NumbersInternational/CefSharp,dga711/CefSharp,jamespearce2006/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,haozhouxu/CefSharp,ITGlobal/CefSharp,twxstar/CefSharp,ruisebastiao/CefSharp,VioletLife/CefSharp,twxstar/CefSharp,wangzheng888520/CefSharp,yoder/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,twxstar/CefSharp,illfang/CefSharp,zhangjingpu/CefSharp,gregmartinhtc/CefSharp,AJDev77/CefSharp,VioletLife/CefSharp,windygu/CefSharp,haozhouxu/CefSharp,wangzheng888520/CefSharp,ITGlobal/CefSharp,VioletLife/CefSharp,windygu/CefSharp,windygu/CefSharp
|
CefSharp/ILifeSpanHandler.cs
|
CefSharp/ILifeSpanHandler.cs
|
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
namespace CefSharp
{
public interface ILifeSpanHandler
{
/// <summary>
/// Called before a popup window is created.
/// </summary>
/// <param name="browser">The IWebBrowser control this request is for.</param>
/// <param name="frame">The HTML frame that launched this popup.</param>
/// <param name="targetUrl">The URL of the popup content. (This may be empty/null)</param>
/// <param name="x">x coord</param>
/// <param name="y">y coord</param>
/// <param name="width">width</param>
/// <param name="height">height</param>
/// <param name="noJavascriptAccess">value indicates whether the new browser window should be scriptable
/// and in the same process as the source browser.</param>
/// <returns>To cancel creation of the popup window return true otherwise return false.</returns>
/// <remarks>
/// CEF documentation:
///
/// Called on the IO thread before a new popup window is created. The |browser|
/// and |frame| parameters represent the source of the popup request. The
/// |target_url| and |target_frame_name| values may be empty if none were
/// specified with the request. The |popupFeatures| structure contains
/// information about the requested popup window. To allow creation of the
/// popup window optionally modify |windowInfo|, |client|, |settings| and
/// |no_javascript_access| and return false. To cancel creation of the popup
/// window return true. The |client| and |settings| values will default to the
/// source browser's values. The |no_javascript_access| value indicates whether
/// the new browser window should be scriptable and in the same process as the
/// source browser.
/// </remarks>
bool OnBeforePopup(IWebBrowser browser, IFrame frame, string targetUrl, ref int x, ref int y, ref int width, ref int height, ref bool noJavascriptAccess);
/// <summary>
/// Called before a CefBrowser window (either the main browser for IWebBrowser,
/// or one of its children)
/// </summary>
/// <param name="browser"></param>
void OnBeforeClose(IWebBrowser browser);
}
}
|
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
namespace CefSharp
{
public interface ILifeSpanHandler
{
/// <summary>
/// Called before a popup window is created.
/// </summary>
/// <param name="browser">The IWebBrowser control this request is for.</param>
/// <param name="frame">The HTML frame that launched this popup.</param>
/// <param name="targetUrl">The URL of the popup content. (This may be empty/null)</param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="noJavascriptAccess"></param>
/// <returns></returns>
/// <remarks>
/// CEF documentation:
///
/// Called on the IO thread before a new popup window is created. The |browser|
/// and |frame| parameters represent the source of the popup request. The
/// |target_url| and |target_frame_name| values may be empty if none were
/// specified with the request. The |popupFeatures| structure contains
/// information about the requested popup window. To allow creation of the
/// popup window optionally modify |windowInfo|, |client|, |settings| and
/// |no_javascript_access| and return false. To cancel creation of the popup
/// window return true. The |client| and |settings| values will default to the
/// source browser's values. The |no_javascript_access| value indicates whether
/// the new browser window should be scriptable and in the same process as the
/// source browser.
/// </remarks>
bool OnBeforePopup(IWebBrowser browser, IFrame frame, string targetUrl, ref int x, ref int y, ref int width, ref int height, ref bool noJavascriptAccess);
/// <summary>
/// Called before a CefBrowser window (either the main browser for IWebBrowser,
/// or one of its children)
/// </summary>
/// <param name="browser"></param>
void OnBeforeClose(IWebBrowser browser);
}
}
|
bsd-3-clause
|
C#
|
9ff20a69c512060bc8102c438edeafaf1356585d
|
Fix Code analysis issues
|
jkonecki/T4MVC,T4MVC/T4MVC,T4MVC/T4MVC,scott-xu/T4MVC,M1chaelTran/T4MVC,jkonecki/T4MVC,payini/T4MVC,scott-xu/T4MVC,M1chaelTran/T4MVC,payini/T4MVC
|
T4MVCHostMvcApp/Controllers/SomeAsyncController.cs
|
T4MVCHostMvcApp/Controllers/SomeAsyncController.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Web.Mvc;
using T4MVCHostMvcApp.Misc;
namespace T4MVCHostMvcApp.Controllers
{
[HandleError]
public partial class SomeAsyncController : AsyncController
{
public virtual ActionResult SomeAction()
{
return new EmptyResult();
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public void GetSomethingAsync()
{
}
// This async completion method is ignored by T4MVC, as it can't make use of it meaningfully
public virtual JsonResult GetSomethingCompleted(string clientDocuments)
{
return new JsonResult();
}
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed"), SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic"), SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "id")]
public void ActionWithDefaultsAsync(long? id = null)
{
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic"), SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "result")]
public ActionResult ActionWithDefaultsCompleted(object result)
{
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Web.Mvc;
using T4MVCHostMvcApp.Misc;
namespace T4MVCHostMvcApp.Controllers
{
[HandleError]
public partial class SomeAsyncController : AsyncController
{
public virtual ActionResult SomeAction()
{
return new EmptyResult();
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
public void GetSomethingAsync()
{
}
// This async completion method is ignored by T4MVC, as it can't make use of it meaningfully
public virtual JsonResult GetSomethingCompleted(string clientDocuments)
{
return new JsonResult();
}
public void ActionWithDefaultsAsync(long? id = null)
{
}
public ActionResult ActionWithDefaultsCompleted(object result)
{
return null;
}
}
}
|
apache-2.0
|
C#
|
fb98f8a18e8a42426fdd2cad4c12bf21c1204175
|
Change into properties for easier debugging.
|
mcneel/RhinoCycles
|
RenderEngine.Settings.cs
|
RenderEngine.Settings.cs
|
/**
Copyright 2014-2017 Robert McNeel and Associates
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 RhinoCyclesCore.Core;
using System;
using System.Drawing;
namespace RhinoCyclesCore
{
partial class RenderEngine
{
/// <summary>
/// Get or set the resolution for rendering.
/// </summary>
public Size RenderDimension { get; set; }
public enum IntegratorSetting
{
Seed,
DiffuseSamples,
GlossySamples,
TransmissionSamples,
MaxBounce,
MaxDiffuseBounce,
MaxGlossyBounce,
MaxTransmissionBounce,
MaxVolumeBounce,
TransparentMaxBounce,
}
public event EventHandler CurrentViewportSettingsRequested;
protected void TriggerCurrentViewportSettingsRequested()
{
CurrentViewportSettingsRequested?.Invoke(this, EventArgs.Empty);
}
private uint _oldIntegratorHash = 0;
public ccl.Device RenderDevice { get; set; }
public void ViewportSettingsChangedHandler(object sender, ViewportSettingsChangedArgs e)
{
if(e.Settings.AllowSelectedDeviceOverride)
{
RenderDevice = ccl.Device.DeviceFromString(e.Settings.SelectedDeviceStr);
}
else
{
RenderDevice = ccl.Device.DeviceFromString(RcCore.It.EngineSettings.SelectedDeviceStr);
}
if (Session != null && Session.Scene != null)
{
var hash = e.Settings.IntegratorHash;
if (hash != _oldIntegratorHash)
{
var integrator = Session.Scene.Integrator;
integrator.Seed = e.Settings.Seed;
integrator.DiffuseSamples = e.Settings.DiffuseSamples;
integrator.GlossySamples = e.Settings.GlossySamples;
integrator.MaxBounce = e.Settings.MaxBounce;
integrator.MaxDiffuseBounce = e.Settings.MaxDiffuseBounce;
integrator.MaxGlossyBounce = e.Settings.MaxGlossyBounce;
integrator.MaxTransmissionBounce = e.Settings.MaxTransmissionBounce;
integrator.MaxVolumeBounce = e.Settings.MaxVolumeBounce;
integrator.TagForUpdate();
_needReset = true;
_oldIntegratorHash = hash;
}
Session.SetSamples(e.Settings.Samples);
_throttle = e.Settings.ThrottleMs;
_samples = e.Settings.Samples;
}
}
protected int _throttle { get; set; } = 10;
protected int _samples { get; set; } = 1;
protected bool _needReset;
}
}
|
/**
Copyright 2014-2017 Robert McNeel and Associates
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 RhinoCyclesCore.Core;
using System;
using System.Drawing;
namespace RhinoCyclesCore
{
partial class RenderEngine
{
/// <summary>
/// Get or set the resolution for rendering.
/// </summary>
public Size RenderDimension { get; set; }
public enum IntegratorSetting
{
Seed,
DiffuseSamples,
GlossySamples,
TransmissionSamples,
MaxBounce,
MaxDiffuseBounce,
MaxGlossyBounce,
MaxTransmissionBounce,
MaxVolumeBounce,
TransparentMaxBounce,
}
public event EventHandler CurrentViewportSettingsRequested;
protected void TriggerCurrentViewportSettingsRequested()
{
CurrentViewportSettingsRequested?.Invoke(this, EventArgs.Empty);
}
private uint _oldIntegratorHash = 0;
public ccl.Device RenderDevice { get; set; }
public void ViewportSettingsChangedHandler(object sender, ViewportSettingsChangedArgs e)
{
if(e.Settings.AllowSelectedDeviceOverride)
{
RenderDevice = ccl.Device.DeviceFromString(e.Settings.SelectedDeviceStr);
}
else
{
RenderDevice = ccl.Device.DeviceFromString(RcCore.It.EngineSettings.SelectedDeviceStr);
}
if (Session != null && Session.Scene != null)
{
var hash = e.Settings.IntegratorHash;
if (hash != _oldIntegratorHash)
{
var integrator = Session.Scene.Integrator;
integrator.Seed = e.Settings.Seed;
integrator.DiffuseSamples = e.Settings.DiffuseSamples;
integrator.GlossySamples = e.Settings.GlossySamples;
integrator.MaxBounce = e.Settings.MaxBounce;
integrator.MaxDiffuseBounce = e.Settings.MaxDiffuseBounce;
integrator.MaxGlossyBounce = e.Settings.MaxGlossyBounce;
integrator.MaxTransmissionBounce = e.Settings.MaxTransmissionBounce;
integrator.MaxVolumeBounce = e.Settings.MaxVolumeBounce;
integrator.TagForUpdate();
_needReset = true;
_oldIntegratorHash = hash;
}
Session.SetSamples(e.Settings.Samples);
_throttle = e.Settings.ThrottleMs;
_samples = e.Settings.Samples;
}
}
protected int _throttle = 10;
protected int _samples = 1;
protected bool _needReset;
}
}
|
apache-2.0
|
C#
|
4f2d30b961402d355a12b6a49bc63e35f2fd79b8
|
Update CalculatingFormulas.cs
|
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,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_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
|
Examples/CSharp/Formulas/CalculatingFormulas.cs
|
Examples/CSharp/Formulas/CalculatingFormulas.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Formulas
{
public class CalculatingFormulas
{
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 sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Adding a value to "A1" cell
worksheet.Cells["A1"].PutValue(1);
//Adding a value to "A2" cell
worksheet.Cells["A2"].PutValue(2);
//Adding a value to "A3" cell
worksheet.Cells["A3"].PutValue(3);
//Adding a SUM formula to "A4" cell
worksheet.Cells["A4"].Formula = "=SUM(A1:A3)";
//Calculating the results of formulas
workbook.CalculateFormula();
//Get the calculated value of the cell
string value = worksheet.Cells["A4"].Value.ToString();
//Saving the Excel file
workbook.Save(dataDir + "output.out.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Formulas
{
public class CalculatingFormulas
{
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 sheetIndex = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Adding a value to "A1" cell
worksheet.Cells["A1"].PutValue(1);
//Adding a value to "A2" cell
worksheet.Cells["A2"].PutValue(2);
//Adding a value to "A3" cell
worksheet.Cells["A3"].PutValue(3);
//Adding a SUM formula to "A4" cell
worksheet.Cells["A4"].Formula = "=SUM(A1:A3)";
//Calculating the results of formulas
workbook.CalculateFormula();
//Get the calculated value of the cell
string value = worksheet.Cells["A4"].Value.ToString();
//Saving the Excel file
workbook.Save(dataDir + "output.out.xls");
}
}
}
|
mit
|
C#
|
060b4fa5266a9cd1e334111d968036141e379cd8
|
Fix failing multiplayer player test
|
smoogipooo/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu
|
osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs
|
osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerPlayer.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.OnlinePlay.Multiplayer;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneMultiplayerPlayer : MultiplayerTestScene
{
private MultiplayerPlayer player;
[SetUpSteps]
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("set beatmap", () =>
{
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
});
AddStep("initialise gameplay", () =>
{
Stack.Push(player = new MultiplayerPlayer(Client.APIRoom, Client.CurrentMatchPlayingItem.Value, Client.Room?.Users.ToArray()));
});
AddUntilStep("wait for player to be current", () => player.IsCurrentScreen() && player.IsLoaded);
AddStep("start gameplay", () => ((IMultiplayerClient)Client).MatchStarted());
}
[Test]
public void TestGameplay()
{
AddUntilStep("wait for gameplay start", () => player.LocalUserPlaying.Value);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.OnlinePlay.Multiplayer;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneMultiplayerPlayer : MultiplayerTestScene
{
private MultiplayerPlayer player;
[SetUpSteps]
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("set beatmap", () =>
{
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
});
AddStep("initialise gameplay", () =>
{
Stack.Push(player = new MultiplayerPlayer(Client.APIRoom, Client.CurrentMatchPlayingItem.Value, Client.Room?.Users.ToArray()));
});
}
[Test]
public void TestGameplay()
{
AddUntilStep("wait for gameplay start", () => player.LocalUserPlaying.Value);
}
}
}
|
mit
|
C#
|
8b67da6207a492309c0e34ba330410d8eea47eb9
|
Add IsNullToVisibility converter
|
SaberSnail/GoldenAnvil.Utility
|
GoldenAnvil.Utility.Windows/CommonConverters.cs
|
GoldenAnvil.Utility.Windows/CommonConverters.cs
|
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace GoldenAnvil.Utility.Windows
{
public static class CommonConverters
{
public static readonly IValueConverter BooleanNot = new BooleanNotConverter();
public static readonly IValueConverter BooleanToVisibility = new BooleanToVisibilityConverter();
public static readonly IValueConverter IsEqual = new IsEqualConverter();
public static readonly IValueConverter IsEqualToVisibility = new IsEqualToVisibilityConverter();
public static readonly IValueConverter IsNullToVisibility = new IsNullToVisibilityConverter();
private sealed class BooleanNotConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(bool)))
throw new InvalidOperationException(@"The target must be assignable from a boolean.");
return !((bool) value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class BooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(Visibility)))
throw new InvalidOperationException(@"The target must be assignable from a Visibility.");
return (bool) value ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class IsEqualConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(bool)))
throw new InvalidOperationException(@"The target must be assignable from a boolean.");
return object.Equals(value, parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class IsEqualToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(Visibility)))
throw new InvalidOperationException(@"The target must be assignable from a Visibility.");
return object.Equals(value, parameter) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class IsNullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(Visibility)))
throw new InvalidOperationException(@"The target must be assignable from a Visibility.");
return value is null ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
}
|
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace GoldenAnvil.Utility.Windows
{
public static class CommonConverters
{
public static readonly IValueConverter BooleanNot = new BooleanNotConverter();
public static readonly IValueConverter BooleanToVisibility = new BooleanToVisibilityConverter();
public static readonly IValueConverter IsEqual = new IsEqualConverter();
public static readonly IValueConverter IsEqualToVisibility = new IsEqualToVisibilityConverter();
private sealed class BooleanNotConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(bool)))
throw new InvalidOperationException(@"The target must be assignable from a boolean.");
return !((bool) value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class BooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(Visibility)))
throw new InvalidOperationException(@"The target must be assignable from a Visibility.");
return (bool) value ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class IsEqualConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(bool)))
throw new InvalidOperationException(@"The target must be assignable from a boolean.");
return object.Equals(value, parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
private sealed class IsEqualToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!targetType.IsAssignableFrom(typeof(Visibility)))
throw new InvalidOperationException(@"The target must be assignable from a Visibility.");
return object.Equals(value, parameter) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
}
|
mit
|
C#
|
d8d0bbfeb9e0ee27e2603d51c29b64fa1755d814
|
Implement repo method for changing user password.
|
enarod/enarod-web-api,enarod/enarod-web-api,enarod/enarod-web-api
|
Infopulse.EDemocracy.Web/Auth/AuthRepository.cs
|
Infopulse.EDemocracy.Web/Auth/AuthRepository.cs
|
using Infopulse.EDemocracy.Common.Extensions;
using Infopulse.EDemocracy.Web.Auth;
using Infopulse.EDemocracy.Web.Auth.Models;
using Infopulse.EDemocracy.Web.Models;
using Microsoft.AspNet.Identity;
using System;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using Infopulse.EDemocracy.Model.Enum;
namespace Infopulse.EDemocracy.Data.Repositories
{
public class AuthRepository : IDisposable
{
private AuthContext authContext;
private ApplicationUserManager applicationUserManager;
public AuthRepository()
{
authContext = new AuthContext();
applicationUserManager = new ApplicationUserManager(new ApplicationUserStore(authContext));
}
public async Task<IdentityResult> RegisterUser(UserModel userModel)
{
try
{
var user = new ApplicationUser
{
UserName = userModel.UserEmail,
Email = userModel.UserEmail,
EmailConfirmed = false
};
var result = await applicationUserManager.CreateAsync(user, userModel.Password);
return result;
}
catch (Exception exc)
{
throw exc.GetMostInnerException();
}
}
public async Task<IdentityResult> ChangePassword(int userID, string currentPassword, string newPassword)
{
try
{
var result = await applicationUserManager.ChangePasswordAsync(userID, currentPassword, newPassword);
return result;
}
catch (Exception exc)
{
throw exc.GetMostInnerException();
}
}
public async Task<ApplicationUser> FindUser(string userName, string password)
{
var user = await applicationUserManager.FindAsync(userName, password);
return user;
}
public void AssignRole(string userEmail, params Role[] roles)
{
var user = authContext.Users
.Include(u => u.Roles)
.SingleOrDefault(u => u.Email == userEmail);
if(user == null) throw new Exception($"User [{userEmail}] not found.");
var userRoleIds = user.Roles.Select(ur => ur.RoleId).ToList();
foreach (var role in roles.Where(r => !userRoleIds.Contains((int)r)))
{
user.Roles.Add(new ApplicationUserRole() { UserId = user.Id, RoleId = (int)role });
}
authContext.SaveChanges();
}
public void RemoveRole(string userEmail, params Role[] roles)
{
var user = authContext.Users
.Include(u => u.Roles)
.SingleOrDefault(u => u.Email == userEmail);
if (user == null) throw new Exception($"User [{userEmail}] not found.");
var userRoleIds = user.Roles.Select(ur => ur.RoleId).ToList();
foreach (var roleToDelete in roles.Where(r => userRoleIds.Contains((int)r)).Select(role => user.Roles.SingleOrDefault(ur => ur.RoleId == (int)role)))
{
user.Roles.Remove(roleToDelete);
}
authContext.SaveChanges();
}
public void Dispose()
{
authContext.Dispose();
applicationUserManager.Dispose();
}
}
}
|
using Infopulse.EDemocracy.Common.Extensions;
using Infopulse.EDemocracy.Web.Auth;
using Infopulse.EDemocracy.Web.Auth.Models;
using Infopulse.EDemocracy.Web.Models;
using Microsoft.AspNet.Identity;
using System;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using Infopulse.EDemocracy.Model.Enum;
namespace Infopulse.EDemocracy.Data.Repositories
{
public class AuthRepository : IDisposable
{
private AuthContext authContext;
private ApplicationUserManager applicationUserManager;
public AuthRepository()
{
authContext = new AuthContext();
applicationUserManager = new ApplicationUserManager(new ApplicationUserStore(authContext));
}
public async Task<IdentityResult> RegisterUser(UserModel userModel)
{
try
{
var user = new ApplicationUser
{
UserName = userModel.UserEmail,
Email = userModel.UserEmail,
EmailConfirmed = false
};
var result = await applicationUserManager.CreateAsync(user, userModel.Password);
return result;
}
catch (Exception exc)
{
throw exc.GetMostInnerException();
}
}
public async Task<ApplicationUser> FindUser(string userName, string password)
{
var user = await applicationUserManager.FindAsync(userName, password);
return user;
}
public void AssignRole(string userEmail, params Role[] roles)
{
var user = authContext.Users
.Include(u => u.Roles)
.SingleOrDefault(u => u.Email == userEmail);
if(user == null) throw new Exception($"User [{userEmail}] not found.");
var userRoleIds = user.Roles.Select(ur => ur.RoleId).ToList();
foreach (var role in roles.Where(r => !userRoleIds.Contains((int)r)))
{
user.Roles.Add(new ApplicationUserRole() { UserId = user.Id, RoleId = (int)role });
}
authContext.SaveChanges();
}
public void RemoveRole(string userEmail, params Role[] roles)
{
var user = authContext.Users
.Include(u => u.Roles)
.SingleOrDefault(u => u.Email == userEmail);
if (user == null) throw new Exception($"User [{userEmail}] not found.");
var userRoleIds = user.Roles.Select(ur => ur.RoleId).ToList();
foreach (var roleToDelete in roles.Where(r => userRoleIds.Contains((int)r)).Select(role => user.Roles.SingleOrDefault(ur => ur.RoleId == (int)role)))
{
user.Roles.Remove(roleToDelete);
}
authContext.SaveChanges();
}
public void Dispose()
{
authContext.Dispose();
applicationUserManager.Dispose();
}
}
}
|
cc0-1.0
|
C#
|
f83a6c49ba7ea17c34de5020b928959036f18c94
|
Remove IEnableLogger
|
ApplETS/ETSMobile-WindowsPlatforms,ApplETS/ETSMobile-WindowsPlatforms
|
Ets.Mobile/Ets.Mobile.ViewModel/Pages/Main/MainViewModel.cs
|
Ets.Mobile/Ets.Mobile.ViewModel/Pages/Main/MainViewModel.cs
|
using System;
using System.Runtime.Serialization;
using Ets.Mobile.ViewModel.Bases;
using Ets.Mobile.ViewModel.Contracts.Main;
using ReactiveUI;
using Splat;
namespace Ets.Mobile.ViewModel.Pages.Main
{
[DataContract]
public partial class MainViewModel : ViewModelBase, IMainViewModel, IDisposable
{
#region IDisposable
public void Dispose()
{
GC.SuppressFinalize(this);
}
#endregion
public MainViewModel(IScreen screen)
: base(screen, "Home")
{
OnViewModelCreation();
}
protected sealed override void OnViewModelCreation()
{
InitializeToday();
InitializeGrade();
}
}
}
|
using System;
using System.Runtime.Serialization;
using Ets.Mobile.ViewModel.Bases;
using Ets.Mobile.ViewModel.Contracts.Main;
using ReactiveUI;
using Splat;
namespace Ets.Mobile.ViewModel.Pages.Main
{
[DataContract]
public partial class MainViewModel : ViewModelBase, IMainViewModel, IEnableLogger, IDisposable
{
#region IDisposable
public void Dispose()
{
GC.SuppressFinalize(this);
}
#endregion
public MainViewModel(IScreen screen)
: base(screen, "Home")
{
OnViewModelCreation();
}
protected sealed override void OnViewModelCreation()
{
InitializeToday();
InitializeGrade();
}
}
}
|
apache-2.0
|
C#
|
703dcb1b4d524126fe5d81d24787e94f99ea9cd4
|
Fix NullReference
|
erebuswolf/LockstepFramework,yanyiyun/LockstepFramework,SnpM/Lockstep-Framework
|
Core/Simulation/Grid/Influence/LSInfluencer.cs
|
Core/Simulation/Grid/Influence/LSInfluencer.cs
|
using System;
using UnityEngine;
using System.Collections.Generic;
namespace Lockstep
{
public class LSInfluencer
{
#region Static Helpers
static LSAgent tempAgent;
static GridNode tempNode;
#endregion
#region Collection Helper
[NonSerialized]
public int bucketIndex = -1;
#endregion
#region ScanNode Helper
public int NodeTicket;
#endregion
public GridNode LocatedNode { get; private set;}
public LSBody Body { get; private set; }
public LSAgent Agent { get; private set; }
public void Setup (LSAgent agent)
{
Agent = agent;
Body = agent.Body;
}
public void Initialize ()
{
LocatedNode = GridManager.GetNode (Body._position.x, Body._position.y);
LocatedNode.Add (this);
}
public void Simulate ()
{
if (Body.PositionChangedBuffer) {
tempNode = GridManager.GetNode (Body._position.x, Body._position.y);
if (tempNode.IsNull())
return;
if (System.Object.ReferenceEquals (tempNode, LocatedNode) == false) {
LocatedNode.Remove (this);
tempNode.Add (this);
LocatedNode = tempNode;
}
}
}
public void Deactivate ()
{
LocatedNode.Remove (this);
LocatedNode = null;
}
const PlatformType AllPlatforms = (PlatformType)~0;
const AllegianceType AllAllegiance = (AllegianceType)~0;
}
public enum PlatformType
{
Air = 1 << 1,
Ground = 1 << 2
}
}
|
using System;
using UnityEngine;
using System.Collections.Generic;
namespace Lockstep
{
public class LSInfluencer
{
#region Static Helpers
static LSAgent tempAgent;
static GridNode tempNode;
#endregion
#region Collection Helper
[NonSerialized]
public int bucketIndex = -1;
#endregion
#region ScanNode Helper
public int NodeTicket;
#endregion
public GridNode LocatedNode { get; private set;}
public LSBody Body { get; private set; }
public LSAgent Agent { get; private set; }
public void Setup (LSAgent agent)
{
Agent = agent;
Body = agent.Body;
}
public void Initialize ()
{
LocatedNode = GridManager.GetNode (Body._position.x, Body._position.y);
LocatedNode.Add (this);
}
public void Simulate ()
{
if (Body.PositionChangedBuffer) {
tempNode = GridManager.GetNode (Body._position.x, Body._position.y);
if (System.Object.ReferenceEquals (tempNode, LocatedNode) == false) {
LocatedNode.Remove (this);
tempNode.Add (this);
LocatedNode = tempNode;
}
}
}
public void Deactivate ()
{
LocatedNode.Remove (this);
LocatedNode = null;
}
const PlatformType AllPlatforms = (PlatformType)~0;
const AllegianceType AllAllegiance = (AllegianceType)~0;
}
public enum PlatformType
{
Air = 1 << 1,
Ground = 1 << 2
}
}
|
mit
|
C#
|
df2fc0e4e9ae9555dc2247184d212e98dd6e768f
|
Update ExchangeRatesContext.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Framework.Core/Finance/ForeignExchange/EntityFrameworkCore/ExchangeRatesContext.cs
|
TIKSN.Framework.Core/Finance/ForeignExchange/EntityFrameworkCore/ExchangeRatesContext.cs
|
using Microsoft.EntityFrameworkCore;
namespace TIKSN.Finance.ForeignExchange.Data.EntityFrameworkCore
{
public class ExchangeRatesContext : DbContext
{
public ExchangeRatesContext(DbContextOptions<ExchangeRatesContext> dbContextOptions) : base(dbContextOptions)
{
}
public virtual DbSet<ExchangeRateEntity> ExchangeRates { get; set; }
public virtual DbSet<ForeignExchangeEntity> ForeignExchanges { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ExchangeRateEntity>(entity =>
{
entity.ToTable("ExchangeRates");
entity.Property(e => e.ID).HasColumnName("ID");
entity.Property(e => e.AsOn)
.IsRequired()
.HasColumnType("DATETIME");
entity.Property(e => e.BaseCurrencyCode)
.IsRequired()
.HasColumnType("STRING (3, 3)");
entity.Property(e => e.CounterCurrencyCode)
.IsRequired()
.HasColumnType("STRING (3, 3)");
entity.Property(e => e.ForeignExchangeID).HasColumnName("ForeignExchangeID");
entity.Property(e => e.Rate)
.IsRequired()
.HasColumnType("DECIMAL");
entity.HasOne(d => d.ForeignExchange)
.WithMany(p => p.ExchangeRates)
.HasForeignKey(d => d.ForeignExchangeID);
});
modelBuilder.Entity<ForeignExchangeEntity>(entity =>
{
entity.ToTable("ForeignExchanges");
entity.Property(e => e.ID).HasColumnName("ID");
entity.Property(e => e.CountryCode)
.IsRequired()
.HasColumnType("STRING (2, 3)");
});
}
}
}
|
using Microsoft.EntityFrameworkCore;
namespace TIKSN.Finance.ForeignExchange.Data.EntityFrameworkCore
{
public class ExchangeRatesContext : DbContext
{
public virtual DbSet<ExchangeRateEntity> ExchangeRates { get; set; }
public virtual DbSet<ForeignExchangeEntity> ForeignExchanges { get; set; }
public ExchangeRatesContext(DbContextOptions<ExchangeRatesContext> dbContextOptions) : base(dbContextOptions)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ExchangeRateEntity>(entity =>
{
entity.ToTable("ExchangeRates");
entity.Property(e => e.ID).HasColumnName("ID");
entity.Property(e => e.AsOn)
.IsRequired()
.HasColumnType("DATETIME");
entity.Property(e => e.BaseCurrencyCode)
.IsRequired()
.HasColumnType("STRING (3, 3)");
entity.Property(e => e.CounterCurrencyCode)
.IsRequired()
.HasColumnType("STRING (3, 3)");
entity.Property(e => e.ForeignExchangeID).HasColumnName("ForeignExchangeID");
entity.Property(e => e.Rate)
.IsRequired()
.HasColumnType("DECIMAL");
entity.HasOne(d => d.ForeignExchange)
.WithMany(p => p.ExchangeRates)
.HasForeignKey(d => d.ForeignExchangeID);
});
modelBuilder.Entity<ForeignExchangeEntity>(entity =>
{
entity.ToTable("ForeignExchanges");
entity.Property(e => e.ID).HasColumnName("ID");
entity.Property(e => e.CountryCode)
.IsRequired()
.HasColumnType("STRING (2, 3)");
});
}
}
}
|
mit
|
C#
|
5b456a94a59cccb7cf00bb078442c4a83a0b64d7
|
check for null against classification target
|
jdermody/brightwire
|
BrightWire.Source/TabularData/Analysis/FrequencyCollector.cs
|
BrightWire.Source/TabularData/Analysis/FrequencyCollector.cs
|
using System.Collections.Generic;
using System.Linq;
namespace BrightWire.TabularData.Analysis
{
/// <summary>
/// A collector that collects the frequency from a single column of a data table
/// </summary>
class FrequencyCollector : IRowProcessor, IFrequencyColumnInfo, IDataTableColumnFrequency
{
readonly Dictionary<string, ulong> _valueCount = new Dictionary<string, ulong>();
public FrequencyCollector(int index)
{
ColumnIndex = index;
}
public int ColumnIndex { get; }
public int? NumDistinct => _valueCount.Count;
public IEnumerable<object> DistinctValues => _valueCount.Select(kv => kv.Key);
public IEnumerable<KeyValuePair<string, ulong>> Frequency => _valueCount;
public ulong Total { get; set; } = 0;
public ColumnInfoType Type => ColumnInfoType.Frequency;
public bool Process(IRow row)
{
var val = row.GetField<string>(ColumnIndex)?.Trim();
if (val != null) {
if (_valueCount.TryGetValue(val, out ulong count))
_valueCount[val] = count + 1;
else
_valueCount.Add(val, 1);
}
++Total;
return true;
}
public IReadOnlyList<(string Category, ulong Count)> CategoricalFrequency => _valueCount.Select(kv => (kv.Key, kv.Value)).ToList();
public IReadOnlyList<(double Start, double End, ulong Count)> ContinuousFrequency => null;
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace BrightWire.TabularData.Analysis
{
/// <summary>
/// A collector that collects the frequency from a single column of a data table
/// </summary>
class FrequencyCollector : IRowProcessor, IFrequencyColumnInfo, IDataTableColumnFrequency
{
readonly Dictionary<string, ulong> _valueCount = new Dictionary<string, ulong>();
public FrequencyCollector(int index)
{
ColumnIndex = index;
}
public int ColumnIndex { get; }
public int? NumDistinct => _valueCount.Count;
public IEnumerable<object> DistinctValues => _valueCount.Select(kv => kv.Key);
public IEnumerable<KeyValuePair<string, ulong>> Frequency => _valueCount;
public ulong Total { get; set; } = 0;
public ColumnInfoType Type => ColumnInfoType.Frequency;
public bool Process(IRow row)
{
var val = row.GetField<string>(ColumnIndex);
if (_valueCount.TryGetValue(val, out ulong count))
_valueCount[val] = count + 1;
else
_valueCount.Add(val, 1);
++Total;
return true;
}
public IReadOnlyList<(string Category, ulong Count)> CategoricalFrequency => _valueCount.Select(kv => (kv.Key, kv.Value)).ToList();
public IReadOnlyList<(double Start, double End, ulong Count)> ContinuousFrequency => null;
}
}
|
mit
|
C#
|
e040d87f250ee5bd8823a5f86c69eb02c463dd77
|
Reorder routes
|
vasilvalkov/LanguageSchool,vasilvalkov/LanguageSchool,vasilvalkov/LanguageSchool
|
LanguageSchoolApp/LanguageSchoolApp/App_Start/RouteConfig.cs
|
LanguageSchoolApp/LanguageSchoolApp/App_Start/RouteConfig.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace LanguageSchoolApp
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.LowercaseUrls = true;
routes.MapRoute(
name: "AllCourses",
url: "Courses/AllCourses",
defaults: new { controller = "Courses", action = "AllCourses", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Courses",
url: "Courses/{id}",
defaults: new { controller = "Courses", action = "ById", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "home", action = "index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "404-PageNotFound",
url: "{*url}",
defaults: new { controller = "Home", action = "PageNotFound" }
);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace LanguageSchoolApp
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.LowercaseUrls = true;
routes.MapRoute(
name: "AllCourses",
url: "Courses/AllCourses",
defaults: new { controller = "Courses", action = "AllCourses", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Courses",
url: "Courses/{id}",
defaults: new { controller = "Courses", action = "ById", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "404-PageNotFound",
url: "{*url}",
defaults: new { controller = "Home", action = "PageNotFound" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "home", action = "index", id = UrlParameter.Optional }
);
}
}
}
|
mit
|
C#
|
504f6658bb49c8a39e742d40183c263fecc04afd
|
Remove unused attribute
|
mstrother/BmpListener
|
BmpListener/Bmp/BmpHeader.cs
|
BmpListener/Bmp/BmpHeader.cs
|
using Newtonsoft.Json;
namespace BmpListener.Bmp
{
public class BmpHeader
{
public BmpHeader(byte[] data)
{
ParseBytes(data);
}
public byte Version { get; private set; }
[JsonIgnore]
public uint Length { get; private set; }
public MessageType Type { get; private set; }
public void ParseBytes(byte[] data)
{
Version = data[0];
//if (Version != 3)
//{
// throw new Exception("invalid BMP version");
//}
Length = data.ToUInt32(1);
Type = (MessageType) data[5];
}
}
}
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace BmpListener.Bmp
{
public class BmpHeader
{
public BmpHeader(byte[] data)
{
ParseBytes(data);
}
public byte Version { get; private set; }
[JsonIgnore]
public uint Length { get; private set; }
[JsonConverter(typeof(StringEnumConverter))]
public MessageType Type { get; private set; }
public void ParseBytes(byte[] data)
{
Version = data[0];
//if (Version != 3)
//{
// throw new Exception("invalid BMP version");
//}
Length = data.ToUInt32(1);
Type = (MessageType) data[5];
}
}
}
|
mit
|
C#
|
4612c3021165ca56b78a3baf9f7ccb8367b8bdda
|
Fix GatewayRateLimiter not waiting long enough
|
BundledSticksInkorperated/Discore
|
src/Discore/WebSocket/Net/GatewayRateLimiter.cs
|
src/Discore/WebSocket/Net/GatewayRateLimiter.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Discore.WebSocket.Net
{
class GatewayRateLimiter
{
public int ResetTimeSeconds => resetTime.Seconds;
readonly TimeSpan resetTime;
readonly int maxInvokes;
DateTime resetAt;
int invokesLeft;
public GatewayRateLimiter(int resetTimeSeconds, int maxInvokes)
{
this.maxInvokes = maxInvokes;
resetTime = TimeSpan.FromSeconds(resetTimeSeconds);
invokesLeft = maxInvokes;
}
/// <summary>
/// Counts for one invocation of whatever this rate limiter represents.
/// Will block the current thread until the specified time passes if there has been too many invocations.
/// </summary>
/// <exception cref="OperationCanceledException"></exception>
public async Task Invoke(CancellationToken? cancellationToken = null)
{
DateTime now = DateTime.Now;
if (now >= resetAt)
invokesLeft = maxInvokes;
if (invokesLeft > 0)
{
if (invokesLeft == maxInvokes)
resetAt = DateTime.Now + resetTime;
invokesLeft--;
}
else
{
CancellationToken ct = cancellationToken ?? CancellationToken.None;
int waitTimeMs = (int)Math.Ceiling((resetAt - now).TotalMilliseconds);
if (waitTimeMs > 0)
await Task.Delay(waitTimeMs, ct).ConfigureAwait(false);
invokesLeft = maxInvokes - 1;
}
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Discore.WebSocket.Net
{
class GatewayRateLimiter
{
public int ResetTimeSeconds => resetTime.Seconds;
readonly TimeSpan resetTime;
readonly int maxInvokes;
DateTime resetAt;
int invokesLeft;
public GatewayRateLimiter(int resetTimeSeconds, int maxInvokes)
{
this.maxInvokes = maxInvokes;
resetTime = TimeSpan.FromSeconds(resetTimeSeconds);
Reset();
}
void Reset()
{
resetAt = DateTime.Now + resetTime;
invokesLeft = maxInvokes;
}
/// <summary>
/// Counts for one invocation of whatever this rate limiter represents.
/// Will block the current thread until the specified time passes if there has been too many invocations.
/// </summary>
/// <exception cref="OperationCanceledException"></exception>
public async Task Invoke(CancellationToken? cancellationToken = null)
{
if (invokesLeft > 0)
invokesLeft--;
else
{
CancellationToken ct = cancellationToken ?? CancellationToken.None;
int waitTimeMs = (int)Math.Ceiling((resetAt - DateTime.Now).TotalMilliseconds);
if (waitTimeMs > 0)
await Task.Delay(waitTimeMs, ct).ConfigureAwait(false);
Reset();
invokesLeft--;
}
}
}
}
|
mit
|
C#
|
4a97cafa417ac4e7aedd445f3ca8943331861310
|
Set instance name correctly for tests.
|
lukeryannetnz/quartznet-dynamodb,lukeryannetnz/quartznet-dynamodb
|
src/QuartzNET-DynamoDB.Tests/Integration/DynamoClientFactory.cs
|
src/QuartzNET-DynamoDB.Tests/Integration/DynamoClientFactory.cs
|
using System;
using Amazon.DynamoDBv2;
namespace Quartz.DynamoDB.Tests
{
public class DynamoClientFactory
{
private static JobStore _store;
private static string InstanceName = Guid.NewGuid().ToString();
public static DynamoDB.JobStore CreateTestJobStore()
{
_store = new JobStore();
_store.InstanceName = InstanceName;
return _store;
}
public static AmazonDynamoDBClient BootStrapDynamo()
{
var client = DynamoDbClientFactory.Create();
DynamoConfiguration.InstanceName = InstanceName;
new DynamoBootstrapper().BootStrap(client);
return client;
}
public static void CleanUpDynamo()
{
using (var client = DynamoDbClientFactory.Create())
{
DynamoConfiguration.InstanceName = InstanceName;
foreach (var table in DynamoConfiguration.AllTableNames)
{
client.DeleteTable(table);
}
}
}
}
}
|
using System;
using Amazon.DynamoDBv2;
namespace Quartz.DynamoDB.Tests
{
public class DynamoClientFactory
{
private static JobStore _store;
private static string InstanceName;
public static DynamoDB.JobStore CreateTestJobStore()
{
_store = new JobStore();
InstanceName = Guid.NewGuid().ToString();
_store.InstanceName = InstanceName;
return _store;
}
public static AmazonDynamoDBClient BootStrapDynamo()
{
var client = DynamoDbClientFactory.Create();
DynamoConfiguration.InstanceName = InstanceName;
new DynamoBootstrapper().BootStrap(client);
return client;
}
public static void CleanUpDynamo()
{
using (var client = DynamoDbClientFactory.Create())
{
DynamoConfiguration.InstanceName = InstanceName;
foreach (var table in DynamoConfiguration.AllTableNames)
{
client.DeleteTable(table);
}
}
}
}
}
|
apache-2.0
|
C#
|
3c5ac417d01c3292868a4ae5f3be637c9094e545
|
Fix the registration of IConfiguration<>
|
quartz-software/kephas,quartz-software/kephas
|
src/Kephas.Core/Configuration/IConfiguration.cs
|
src/Kephas.Core/Configuration/IConfiguration.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IConfiguration.cs" company="Quartz Software SRL">
// Copyright (c) Quartz Software SRL. All rights reserved.
// </copyright>
// <summary>
// Declares the IConfiguration interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Configuration
{
using Kephas.Dynamic;
using Kephas.Services;
/// <summary>
/// Shared service contract for getting.
/// </summary>
/// <typeparam name="TSettings">Type of the settings.</typeparam>
[SharedAppServiceContract(AsOpenGeneric = true)]
public interface IConfiguration<out TSettings> : IExpando
{
/// <summary>
/// Gets the settings associated to this configuration.
/// </summary>
/// <value>
/// The settings.
/// </value>
TSettings Settings { get; }
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IConfiguration.cs" company="Quartz Software SRL">
// Copyright (c) Quartz Software SRL. All rights reserved.
// </copyright>
// <summary>
// Declares the IConfiguration interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Configuration
{
using Kephas.Dynamic;
using Kephas.Services;
/// <summary>
/// Shared service contract for getting.
/// </summary>
/// <typeparam name="TSettings">Type of the settings.</typeparam>
[SharedAppServiceContract]
public interface IConfiguration<out TSettings> : IExpando
{
/// <summary>
/// Gets the settings associated to this configuration.
/// </summary>
/// <value>
/// The settings.
/// </value>
TSettings Settings { get; }
}
}
|
mit
|
C#
|
6c16aa2725ed577552652d62e1cd366dac513552
|
switch to evaluate == first
|
yoder/CefSharp,gregmartinhtc/CefSharp,illfang/CefSharp,NumbersInternational/CefSharp,VioletLife/CefSharp,VioletLife/CefSharp,battewr/CefSharp,NumbersInternational/CefSharp,twxstar/CefSharp,AJDev77/CefSharp,twxstar/CefSharp,jamespearce2006/CefSharp,VioletLife/CefSharp,rlmcneary2/CefSharp,yoder/CefSharp,zhangjingpu/CefSharp,jamespearce2006/CefSharp,twxstar/CefSharp,zhangjingpu/CefSharp,Livit/CefSharp,dga711/CefSharp,illfang/CefSharp,Haraguroicha/CefSharp,ITGlobal/CefSharp,gregmartinhtc/CefSharp,wangzheng888520/CefSharp,yoder/CefSharp,AJDev77/CefSharp,zhangjingpu/CefSharp,ITGlobal/CefSharp,jamespearce2006/CefSharp,windygu/CefSharp,Livit/CefSharp,ruisebastiao/CefSharp,battewr/CefSharp,ITGlobal/CefSharp,haozhouxu/CefSharp,battewr/CefSharp,illfang/CefSharp,ruisebastiao/CefSharp,gregmartinhtc/CefSharp,battewr/CefSharp,Haraguroicha/CefSharp,joshvera/CefSharp,joshvera/CefSharp,illfang/CefSharp,twxstar/CefSharp,haozhouxu/CefSharp,dga711/CefSharp,VioletLife/CefSharp,Livit/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,haozhouxu/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,zhangjingpu/CefSharp,dga711/CefSharp,ruisebastiao/CefSharp,joshvera/CefSharp,rlmcneary2/CefSharp,AJDev77/CefSharp,rlmcneary2/CefSharp,NumbersInternational/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,rlmcneary2/CefSharp,ITGlobal/CefSharp,joshvera/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,Haraguroicha/CefSharp,yoder/CefSharp,AJDev77/CefSharp,wangzheng888520/CefSharp,windygu/CefSharp,windygu/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,NumbersInternational/CefSharp,haozhouxu/CefSharp,dga711/CefSharp
|
CefSharp.Wpf/Rendering/InteropBitmapInfo.cs
|
CefSharp.Wpf/Rendering/InteropBitmapInfo.cs
|
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace CefSharp.Wpf.Rendering
{
public class InteropBitmapInfo : WpfBitmapInfo
{
private static readonly PixelFormat PixelFormat = PixelFormats.Bgra32;
public InteropBitmap Bitmap { get; private set; }
public InteropBitmapInfo()
{
BytesPerPixel = PixelFormat.BitsPerPixel / 8;
}
public override bool CreateNewBitmap
{
get { return Bitmap == null; }
}
public override void ClearBitmap()
{
Bitmap = null;
}
public override void Invalidate()
{
if (Bitmap != null)
{
Bitmap.Invalidate();
}
}
public override BitmapSource CreateBitmap()
{
var stride = Width * BytesPerPixel;
if (FileMappingHandle == IntPtr.Zero)
{
ClearBitmap();
}
else
{
Bitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(FileMappingHandle, Width, Height, PixelFormat, stride, 0);
}
return Bitmap;
}
}
}
|
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace CefSharp.Wpf.Rendering
{
public class InteropBitmapInfo : WpfBitmapInfo
{
private static readonly PixelFormat PixelFormat = PixelFormats.Bgra32;
public InteropBitmap Bitmap { get; private set; }
public InteropBitmapInfo()
{
BytesPerPixel = PixelFormat.BitsPerPixel / 8;
}
public override bool CreateNewBitmap
{
get { return Bitmap == null; }
}
public override void ClearBitmap()
{
Bitmap = null;
}
public override void Invalidate()
{
if (Bitmap != null)
{
Bitmap.Invalidate();
}
}
public override BitmapSource CreateBitmap()
{
var stride = Width * BytesPerPixel;
if (FileMappingHandle != IntPtr.Zero)
{
Bitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(FileMappingHandle, Width, Height, PixelFormat, stride, 0);
}
else
{
ClearBitmap();
}
return Bitmap;
}
}
}
|
bsd-3-clause
|
C#
|
2b12663ffcec569cb67c1f4bf53b39c2ba324fb2
|
Remove one remaining reference to OsuTKWindow in xmldoc
|
ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework
|
osu.Framework/Graphics/Containers/SafeAreaDefiningContainer.cs
|
osu.Framework/Graphics/Containers/SafeAreaDefiningContainer.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Platform;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A <see cref="Container"/> that is automatically cached and provides a <see cref="BindableSafeArea"/> representing
/// the desired safe area margins. Should be used in conjunction with child <see cref="SafeAreaContainer"/>s.
/// The root of the scenegraph contains an instance of this container, with <see cref="BindableSafeArea"/> automatically bound
/// to the host <see cref="IWindow"/>'s <see cref="IWindow.SafeAreaPadding"/>.
/// </summary>
[Cached(typeof(ISafeArea))]
public class SafeAreaDefiningContainer : Container<Drawable>, ISafeArea
{
private readonly bool usesCustomBinding;
private readonly BindableSafeArea safeArea = new BindableSafeArea();
/// <summary>
/// Initialises a <see cref="SafeAreaDefiningContainer"/> by optionally providing a custom <see cref="BindableSafeArea"/>.
/// If no such binding is provided, the container will default to <see cref="OsuTKWindow.SafeAreaPadding"/>.
/// </summary>
/// <param name="safeArea">The custom <see cref="BindableSafeArea"/> to bind to, if required.</param>
public SafeAreaDefiningContainer(BindableSafeArea safeArea = null)
{
if (safeArea != null)
{
usesCustomBinding = true;
this.safeArea.BindTo(safeArea);
}
}
[BackgroundDependencyLoader]
private void load(GameHost host)
{
if (!usesCustomBinding && host.Window != null)
safeArea.BindTo(host.Window.SafeAreaPadding);
}
#region ISafeArea Implementation
RectangleF ISafeArea.AvailableNonSafeSpace => DrawRectangle;
Quad ISafeArea.ExpandRectangleToSpaceOfOtherDrawable(IDrawable other) => ToSpaceOfOtherDrawable(DrawRectangle, other);
BindableSafeArea ISafeArea.SafeAreaPadding => safeArea;
#endregion
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Platform;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A <see cref="Container"/> that is automatically cached and provides a <see cref="BindableSafeArea"/> representing
/// the desired safe area margins. Should be used in conjunction with child <see cref="SafeAreaContainer"/>s.
/// The root of the scenegraph contains an instance of this container, with <see cref="BindableSafeArea"/> automatically bound
/// to the host <see cref="OsuTKWindow"/>'s <see cref="OsuTKWindow.SafeAreaPadding"/>.
/// </summary>
[Cached(typeof(ISafeArea))]
public class SafeAreaDefiningContainer : Container<Drawable>, ISafeArea
{
private readonly bool usesCustomBinding;
private readonly BindableSafeArea safeArea = new BindableSafeArea();
/// <summary>
/// Initialises a <see cref="SafeAreaDefiningContainer"/> by optionally providing a custom <see cref="BindableSafeArea"/>.
/// If no such binding is provided, the container will default to <see cref="OsuTKWindow.SafeAreaPadding"/>.
/// </summary>
/// <param name="safeArea">The custom <see cref="BindableSafeArea"/> to bind to, if required.</param>
public SafeAreaDefiningContainer(BindableSafeArea safeArea = null)
{
if (safeArea != null)
{
usesCustomBinding = true;
this.safeArea.BindTo(safeArea);
}
}
[BackgroundDependencyLoader]
private void load(GameHost host)
{
if (!usesCustomBinding && host.Window != null)
safeArea.BindTo(host.Window.SafeAreaPadding);
}
#region ISafeArea Implementation
RectangleF ISafeArea.AvailableNonSafeSpace => DrawRectangle;
Quad ISafeArea.ExpandRectangleToSpaceOfOtherDrawable(IDrawable other) => ToSpaceOfOtherDrawable(DrawRectangle, other);
BindableSafeArea ISafeArea.SafeAreaPadding => safeArea;
#endregion
}
}
|
mit
|
C#
|
d823c77a63e315207bbe7f282ef07ef3eeb8bf1f
|
Implement swell tick application
|
NeoAdonis/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs
|
osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableSwellTick : DrawableTaikoHitObject<SwellTick>
{
public override bool DisplayResult => false;
public DrawableSwellTick()
: this(null)
{
}
public DrawableSwellTick([CanBeNull] SwellTick hitObject)
: base(hitObject)
{
}
protected override void UpdateInitialTransforms() => this.FadeOut();
public void TriggerResult(bool hit)
{
HitObject.StartTime = Time.Current;
ApplyResult(r => r.Type = hit ? r.Judgement.MaxResult : r.Judgement.MinResult);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
}
public override bool OnPressed(TaikoAction action) => false;
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
_ => new TickPiece());
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public class DrawableSwellTick : DrawableTaikoHitObject<SwellTick>
{
public override bool DisplayResult => false;
public DrawableSwellTick(SwellTick hitObject)
: base(hitObject)
{
}
protected override void UpdateInitialTransforms() => this.FadeOut();
public void TriggerResult(bool hit)
{
HitObject.StartTime = Time.Current;
ApplyResult(r => r.Type = hit ? r.Judgement.MaxResult : r.Judgement.MinResult);
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
}
public override bool OnPressed(TaikoAction action) => false;
protected override SkinnableDrawable CreateMainPiece() => new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.DrumRollTick),
_ => new TickPiece());
}
}
|
mit
|
C#
|
8a4a0484cf964441c7fd4167fc7a68012127f277
|
Fix HelixToolkit.Wpf.SharpDX.Tests
|
JeremyAnsel/helix-toolkit,holance/helix-toolkit,helix-toolkit/helix-toolkit,smischke/helix-toolkit,Iluvatar82/helix-toolkit,jotschgl/helix-toolkit,CobraCalle/helix-toolkit,chrkon/helix-toolkit
|
Source/HelixToolkit.Wpf.SharpDX.Tests/Controls/CanvasMock.cs
|
Source/HelixToolkit.Wpf.SharpDX.Tests/Controls/CanvasMock.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CanvasMock.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using SharpDX;
using SharpDX.Direct3D11;
namespace HelixToolkit.Wpf.SharpDX.Tests.Controls
{
class CanvasMock : IRenderHost
{
public CanvasMock()
{
RenderTechniquesManager = new DefaultRenderTechniquesManager();
RenderTechnique = RenderTechniquesManager.RenderTechniques[DefaultRenderTechniqueNames.Phong];
EffectsManager = new DefaultEffectsManager(RenderTechniquesManager);
Device = EffectsManager.Device;
}
public Device Device { get; private set; }
public Color4 ClearColor { get; private set; }
public bool IsShadowMapEnabled { get; private set; }
public bool IsMSAAEnabled { get; private set; }
public IRenderer Renderable { get; set; }
public RenderTechnique RenderTechnique { get; private set; }
public double ActualHeight { get; private set; }
public double ActualWidth { get; private set; }
public IEffectsManager EffectsManager { get; set; }
public IRenderTechniquesManager RenderTechniquesManager { get; set; }
public void SetDefaultRenderTargets()
{
throw new NotImplementedException();
}
public void SetDefaultColorTargets(DepthStencilView dsv)
{
}
public event EventHandler<SharpDX.Utilities.RelayExceptionEventArgs> ExceptionOccurred;
public void InvalidateRender()
{
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CanvasMock.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using SharpDX;
using SharpDX.Direct3D11;
namespace HelixToolkit.Wpf.SharpDX.Tests.Controls
{
class CanvasMock : IRenderHost
{
public CanvasMock()
{
RenderTechniquesManager = new DefaultRenderTechniquesManager();
RenderTechnique = RenderTechniquesManager.RenderTechniques[DefaultRenderTechniqueNames.Phong];
EffectsManager = new DefaultEffectsManager(RenderTechniquesManager);
Device = EffectsManager.Device;
}
public Device Device { get; private set; }
public Color4 ClearColor { get; private set; }
public bool IsShadowMapEnabled { get; private set; }
public bool IsMSAAEnabled { get; private set; }
public IRenderer Renderable { get; set; }
public RenderTechnique RenderTechnique { get; private set; }
public double ActualHeight { get; private set; }
public double ActualWidth { get; private set; }
public IEffectsManager EffectsManager { get; set; }
public IRenderTechniquesManager RenderTechniquesManager { get; set; }
public void SetDefaultRenderTargets()
{
throw new NotImplementedException();
}
public void SetDefaultColorTargets(DepthStencilView dsv)
{
throw new NotImplementedException();
}
public bool SupportDeferredRender { get; set; }
public event EventHandler<SharpDX.Utilities.RelayExceptionEventArgs> ExceptionOccurred;
public void InvalidateRender()
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
1b9375b7c6e36c371eaf88e00a847696df97e881
|
Update Global.asax.cs
|
ellern/champs-room,ellern/champs-room
|
src/Global.asax.cs
|
src/Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace ChampsRoom
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
THIS WON*T BUILD
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace ChampsRoom
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
throw new Exception("Testing CI");
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
|
mit
|
C#
|
acf6cd1d0af1c4f848b033af7220e5a2c7a8ad64
|
Remove the namespace
|
rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials,rabbitmq/rabbitmq-tutorials
|
dotnet/RPCClient/RPCClient.cs
|
dotnet/RPCClient/RPCClient.cs
|
using System;
using System.Collections.Concurrent;
using System.Text;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
public class RpcClient
{
private readonly IConnection connection;
private readonly IModel channel;
private readonly string replyQueueName;
private readonly EventingBasicConsumer consumer;
private readonly BlockingCollection<string> respQueue = new BlockingCollection<string>();
private readonly IBasicProperties props;
public RpcClient()
{
var factory = new ConnectionFactory() { HostName = "localhost" };
connection = factory.CreateConnection();
channel = connection.CreateModel();
replyQueueName = channel.QueueDeclare().QueueName;
consumer = new EventingBasicConsumer(channel);
props = channel.CreateBasicProperties();
var correlationId = Guid.NewGuid().ToString();
props.CorrelationId = correlationId;
props.ReplyTo = replyQueueName;
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var response = Encoding.UTF8.GetString(body);
if (ea.BasicProperties.CorrelationId == correlationId)
{
respQueue.Add(response);
}
};
}
public string Call(string message)
{
var messageBytes = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(
exchange: "",
routingKey: "rpc_queue",
basicProperties: props,
body: messageBytes);
channel.BasicConsume(
consumer: consumer,
queue: replyQueueName,
autoAck: true);
return respQueue.Take(); ;
}
public void Close()
{
connection.Close();
}
}
|
using System;
using System.Collections.Concurrent;
using System.Text;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace RpcClient
{
public class RpcClient
{
private readonly IConnection connection;
private readonly IModel channel;
private readonly string replyQueueName;
private readonly EventingBasicConsumer consumer;
private readonly BlockingCollection<string> respQueue = new BlockingCollection<string>();
private readonly IBasicProperties props;
public RpcClient()
{
var factory = new ConnectionFactory() { HostName = "localhost" };
connection = factory.CreateConnection();
channel = connection.CreateModel();
replyQueueName = channel.QueueDeclare().QueueName;
consumer = new EventingBasicConsumer(channel);
props = channel.CreateBasicProperties();
var correlationId = Guid.NewGuid().ToString();
props.CorrelationId = correlationId;
props.ReplyTo = replyQueueName;
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var response = Encoding.UTF8.GetString(body);
if (ea.BasicProperties.CorrelationId == correlationId)
{
respQueue.Add(response);
}
};
}
public string Call(string message)
{
var messageBytes = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(
exchange: "",
routingKey: "rpc_queue",
basicProperties: props,
body: messageBytes);
channel.BasicConsume(
consumer: consumer,
queue: replyQueueName,
autoAck: true);
return respQueue.Take(); ;
}
public void Close()
{
connection.Close();
}
}
public class Rpc
{
public static void Main()
{
var rpcClient = new RpcClient();
Console.WriteLine(" [x] Requesting fib(30)");
var response = rpcClient.Call("30");
Console.WriteLine(" [.] Got '{0}'", response);
rpcClient.Close();
}
}
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.