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 |
---|---|---|---|---|---|---|---|---|
cd4c801778d9a369ee81aeba8ee48c850ea669d8
|
Update version to 1.2.1
|
Brightspace/valence-sdk-dotnet
|
lib/GlobalAssemblyInfo.cs
|
lib/GlobalAssemblyInfo.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( "D2L Extensibility Client-Side Library for .NET" )]
[assembly: AssemblyDescription( "D2L Extensibility Client-Side Library for .NET" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "D2L Corporation" )]
[assembly: AssemblyProduct( "D2L Extensibility Client-Side Library for .NET" )]
[assembly: AssemblyCopyright( "Copyright © Desire2Learn Inc. 2011-2015" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "e9185e8a-17f0-4ef2-b7c5-e92e8e7b7420" )]
// 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.2.1.0" )]
[assembly: AssemblyFileVersion( "1.2.1.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( "D2L Extensibility Client-Side Library for .NET" )]
[assembly: AssemblyDescription( "D2L Extensibility Client-Side Library for .NET" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "D2L Corporation" )]
[assembly: AssemblyProduct( "D2L Extensibility Client-Side Library for .NET" )]
[assembly: AssemblyCopyright( "Copyright © Desire2Learn Inc. 2011-2015" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "e9185e8a-17f0-4ef2-b7c5-e92e8e7b7420" )]
// 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.1.0" )]
[assembly: AssemblyFileVersion( "1.1.1.0" )]
|
apache-2.0
|
C#
|
a00b8e68391142b873f30ba60287bce22c1368f3
|
Add clipboard Image sample
|
antmicro/xwt,lytico/xwt,hamekoz/xwt,cra0zy/xwt,residuum/xwt,TheBrainTech/xwt,mono/xwt,akrisiun/xwt,hwthomas/xwt
|
TestApps/Samples/Samples/ClipboardSample.cs
|
TestApps/Samples/Samples/ClipboardSample.cs
|
//
// Clipboard.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2012 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt;
using Xwt.Drawing;
namespace Samples
{
public class ClipboardSample: VBox
{
public ClipboardSample ()
{
HBox box = new HBox ();
var source = new TextEntry ();
box.PackStart (source);
Button b = new Button ("Copy");
box.PackStart (b);
b.Clicked += delegate {
Clipboard.SetText (source.Text);
};
PackStart (box);
box = new HBox ();
var dest = new TextEntry ();
box.PackStart (dest);
b = new Button ("Paste");
box.PackStart (b);
b.Clicked += delegate {
dest.Text = Clipboard.GetText ();
};
PackStart (box);
PackStart (new HSeparator ());
box = new HBox ();
b = new Button ("Copy complex object");
box.PackStart (b);
int n = 0;
b.Clicked += delegate {
Clipboard.SetData (new ComplexObject () { Data = "Hello world " + (++n) });
};
PackStart (box);
box = new HBox ();
var destComplex = new TextEntry ();
box.PackStart (destComplex);
b = new Button ("Paste complex object");
box.PackStart (b);
b.Clicked += delegate {
ComplexObject ob = Clipboard.GetData<ComplexObject> ();
if (ob != null)
destComplex.Text = ob.Data;
else
destComplex.Text = "Data not found";
};
PackStart (box);
PackStart (new HSeparator ());
var destImage = new ImageView (Image.FromResource (GetType (), "cow.jpg"));
box = new HBox ();
b = new Button ("Copy Image");
box.PackStart (b);
b.Clicked += delegate {
Clipboard.SetData (TransferDataType.Image, destImage.Image);
};
b = new Button ("Paste Image");
box.PackStart (b);
b.Clicked += delegate {
Image img = Clipboard.GetImage ();
if (img != null)
destImage.Image = img;
};
PackStart (box);
box = new HBox ();
box.PackStart (destImage);
PackStart (box);
}
}
[Serializable]
class ComplexObject
{
public string Data;
}
}
|
//
// Clipboard.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2012 Xamarin Inc
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt;
namespace Samples
{
public class ClipboardSample: VBox
{
public ClipboardSample ()
{
HBox box = new HBox ();
var source = new TextEntry ();
box.PackStart (source);
Button b = new Button ("Copy");
box.PackStart (b);
b.Clicked += delegate {
Clipboard.SetText (source.Text);
};
PackStart (box);
box = new HBox ();
var dest = new TextEntry ();
box.PackStart (dest);
b = new Button ("Paste");
box.PackStart (b);
b.Clicked += delegate {
dest.Text = Clipboard.GetText ();
};
PackStart (box);
PackStart (new HSeparator ());
box = new HBox ();
b = new Button ("Copy complex object");
box.PackStart (b);
int n = 0;
b.Clicked += delegate {
Clipboard.SetData (new ComplexObject () { Data = "Hello world " + (++n) });
};
PackStart (box);
box = new HBox ();
var destComplex = new TextEntry ();
box.PackStart (destComplex);
b = new Button ("Paste complex object");
box.PackStart (b);
b.Clicked += delegate {
ComplexObject ob = Clipboard.GetData<ComplexObject> ();
if (ob != null)
destComplex.Text = ob.Data;
else
destComplex.Text = "Data not found";
};
PackStart (box);
}
}
[Serializable]
class ComplexObject
{
public string Data;
}
}
|
mit
|
C#
|
940367eba858d61cbeae80d650aca4023c69be75
|
Bump version to 1.0.0
|
HangfireIO/Hangfire.Dashboard.Authorization
|
Hangfire.Dashboard.Authorization/Properties/AssemblyInfo.cs
|
Hangfire.Dashboard.Authorization/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hangfire.Dashboard.Authorization")]
[assembly: AssemblyDescription("Some authorization filters for Hangfire's Dashboard.")]
[assembly: AssemblyProduct("Hangfire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
// 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("34dd541a-5bdb-402f-8ec0-9aac8e3331ae")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hangfire.Dashboard.Authorization")]
[assembly: AssemblyDescription("Some authorization filters for Hangfire's Dashboard.")]
[assembly: AssemblyProduct("Hangfire")]
[assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")]
// 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("34dd541a-5bdb-402f-8ec0-9aac8e3331ae")]
[assembly: AssemblyInformationalVersion("1.0.0-alpha1")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
3d96697b891ae09047b590db743071387b86cdb5
|
Rename ISymUnmanagedDocument.GetCheckSumAlgorithmId to GetChecksumAlgorithmId
|
natgla/roslyn,KiloBravoLima/roslyn,MihaMarkic/roslyn-prank,brettfo/roslyn,weltkante/roslyn,weltkante/roslyn,jrharmon/roslyn,antonssonj/roslyn,stjeong/roslyn,supriyantomaftuh/roslyn,magicbing/roslyn,vslsnap/roslyn,jgglg/roslyn,AmadeusW/roslyn,khellang/roslyn,tsdl2013/roslyn,jasonmalinowski/roslyn,MichalStrehovsky/roslyn,jonatassaraiva/roslyn,balajikris/roslyn,mavasani/roslyn,panopticoncentral/roslyn,TyOverby/roslyn,RipCurrent/roslyn,leppie/roslyn,HellBrick/roslyn,pdelvo/roslyn,heejaechang/roslyn,physhi/roslyn,jmarolf/roslyn,kelltrick/roslyn,droyad/roslyn,sharadagrawal/Roslyn,poizan42/roslyn,AArnott/roslyn,MatthieuMEZIL/roslyn,sharadagrawal/TestProject2,RipCurrent/roslyn,orthoxerox/roslyn,dsplaisted/roslyn,VShangxiao/roslyn,VPashkov/roslyn,AmadeusW/roslyn,natidea/roslyn,OmarTawfik/roslyn,lorcanmooney/roslyn,jkotas/roslyn,Giftednewt/roslyn,lisong521/roslyn,shyamnamboodiripad/roslyn,akoeplinger/roslyn,a-ctor/roslyn,davkean/roslyn,eriawan/roslyn,KirillOsenkov/roslyn,robinsedlaczek/roslyn,pjmagee/roslyn,cston/roslyn,stebet/roslyn,MavenRain/roslyn,amcasey/roslyn,wschae/roslyn,jcouv/roslyn,sharadagrawal/TestProject2,gafter/roslyn,tmeschter/roslyn,HellBrick/roslyn,kienct89/roslyn,JakeGinnivan/roslyn,xasx/roslyn,AlekseyTs/roslyn,genlu/roslyn,ericfe-ms/roslyn,basoundr/roslyn,Maxwe11/roslyn,jmarolf/roslyn,sharwell/roslyn,CaptainHayashi/roslyn,tvand7093/roslyn,agocke/roslyn,shyamnamboodiripad/roslyn,ilyes14/roslyn,devharis/roslyn,heejaechang/roslyn,jhendrixMSFT/roslyn,sharadagrawal/Roslyn,natidea/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,SeriaWei/roslyn,dotnet/roslyn,dotnet/roslyn,FICTURE7/roslyn,oberxon/roslyn,bartdesmet/roslyn,mseamari/Stuff,mattscheffer/roslyn,vcsjones/roslyn,moozzyk/roslyn,KamalRathnayake/roslyn,oberxon/roslyn,ManishJayaswal/roslyn,Maxwe11/roslyn,budcribar/roslyn,devharis/roslyn,jaredpar/roslyn,jcouv/roslyn,ManishJayaswal/roslyn,CaptainHayashi/roslyn,kuhlenh/roslyn,panopticoncentral/roslyn,KevinH-MS/roslyn,budcribar/roslyn,marksantos/roslyn,rgani/roslyn,akoeplinger/roslyn,VitalyTVA/roslyn,taylorjonl/roslyn,MavenRain/roslyn,tang7526/roslyn,kelltrick/roslyn,YOTOV-LIMITED/roslyn,mono/roslyn,mseamari/Stuff,xasx/roslyn,danielcweber/roslyn,dpoeschl/roslyn,ValentinRueda/roslyn,mattscheffer/roslyn,abock/roslyn,MihaMarkic/roslyn-prank,Hosch250/roslyn,grianggrai/roslyn,KevinH-MS/roslyn,aanshibudhiraja/Roslyn,paladique/roslyn,furesoft/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,cybernet14/roslyn,MattWindsor91/roslyn,antiufo/roslyn,natgla/roslyn,bartdesmet/roslyn,jhendrixMSFT/roslyn,dpen2000/roslyn,ericfe-ms/roslyn,doconnell565/roslyn,diryboy/roslyn,khellang/roslyn,lorcanmooney/roslyn,EricArndt/roslyn,wvdd007/roslyn,reaction1989/roslyn,pdelvo/roslyn,gafter/roslyn,JakeGinnivan/roslyn,MatthieuMEZIL/roslyn,aanshibudhiraja/Roslyn,evilc0des/roslyn,jbhensley/roslyn,supriyantomaftuh/roslyn,nguerrera/roslyn,bartdesmet/roslyn,pjmagee/roslyn,evilc0des/roslyn,kuhlenh/roslyn,TyOverby/roslyn,pjmagee/roslyn,zmaruo/roslyn,REALTOBIZ/roslyn,drognanar/roslyn,yjfxfjch/roslyn,Pvlerick/roslyn,kuhlenh/roslyn,jaredpar/roslyn,agocke/roslyn,garryforreg/roslyn,dsplaisted/roslyn,weltkante/roslyn,abock/roslyn,garryforreg/roslyn,AnthonyDGreen/roslyn,gafter/roslyn,dotnet/roslyn,KiloBravoLima/roslyn,magicbing/roslyn,VSadov/roslyn,budcribar/roslyn,tvand7093/roslyn,KirillOsenkov/roslyn,doconnell565/roslyn,panopticoncentral/roslyn,nagyistoce/roslyn,grianggrai/roslyn,EricArndt/roslyn,AlexisArce/roslyn,AlexisArce/roslyn,tmat/roslyn,VSadov/roslyn,nagyistoce/roslyn,Pvlerick/roslyn,mattwar/roslyn,abock/roslyn,krishnarajbb/roslyn,managed-commons/roslyn,MattWindsor91/roslyn,SeriaWei/roslyn,nagyistoce/roslyn,paladique/roslyn,Hosch250/roslyn,amcasey/roslyn,AmadeusW/roslyn,hanu412/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,aelij/roslyn,jeffanders/roslyn,jroggeman/roslyn,stjeong/roslyn,oocx/roslyn,antonssonj/roslyn,VShangxiao/roslyn,moozzyk/roslyn,a-ctor/roslyn,jbhensley/roslyn,ErikSchierboom/roslyn,russpowers/roslyn,khellang/roslyn,ManishJayaswal/roslyn,akoeplinger/roslyn,mattwar/roslyn,xoofx/roslyn,antonssonj/roslyn,1234-/roslyn,paulvanbrenk/roslyn,DanielRosenwasser/roslyn,tmat/roslyn,Pvlerick/roslyn,MichalStrehovsky/roslyn,wschae/roslyn,zmaruo/roslyn,magicbing/roslyn,yjfxfjch/roslyn,FICTURE7/roslyn,enginekit/roslyn,balajikris/roslyn,zooba/roslyn,vcsjones/roslyn,ErikSchierboom/roslyn,mattwar/roslyn,droyad/roslyn,orthoxerox/roslyn,krishnarajbb/roslyn,KamalRathnayake/roslyn,robinsedlaczek/roslyn,physhi/roslyn,thomaslevesque/roslyn,furesoft/roslyn,a-ctor/roslyn,dpoeschl/roslyn,YOTOV-LIMITED/roslyn,tvand7093/roslyn,shyamnamboodiripad/roslyn,mattscheffer/roslyn,bkoelman/roslyn,AlekseyTs/roslyn,jrharmon/roslyn,zooba/roslyn,jonatassaraiva/roslyn,yeaicc/roslyn,ahmedshuhel/roslyn,genlu/roslyn,swaroop-sridhar/roslyn,jramsay/roslyn,Maxwe11/roslyn,moozzyk/roslyn,jamesqo/roslyn,sharwell/roslyn,jeffanders/roslyn,chenxizhang/roslyn,Giten2004/roslyn,BugraC/roslyn,poizan42/roslyn,DanielRosenwasser/roslyn,chenxizhang/roslyn,MatthieuMEZIL/roslyn,reaction1989/roslyn,KashishArora/Roslyn,VShangxiao/roslyn,michalhosala/roslyn,mono/roslyn,rchande/roslyn,AnthonyDGreen/roslyn,v-codeel/roslyn,paulvanbrenk/roslyn,AArnott/roslyn,wvdd007/roslyn,SeriaWei/roslyn,nemec/roslyn,xoofx/roslyn,jamesqo/roslyn,wvdd007/roslyn,GuilhermeSa/roslyn,Inverness/roslyn,xoofx/roslyn,danielcweber/roslyn,mirhagk/roslyn,davkean/roslyn,basoundr/roslyn,GuilhermeSa/roslyn,1234-/roslyn,ljw1004/roslyn,jramsay/roslyn,jhendrixMSFT/roslyn,mseamari/Stuff,bkoelman/roslyn,ljw1004/roslyn,hanu412/roslyn,Shiney/roslyn,Giftednewt/roslyn,srivatsn/roslyn,yeaicc/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,mmitche/roslyn,ManishJayaswal/roslyn,poizan42/roslyn,ValentinRueda/roslyn,MavenRain/roslyn,jgglg/roslyn,3F/roslyn,mavasani/roslyn,natgla/roslyn,droyad/roslyn,1234-/roslyn,garryforreg/roslyn,Shiney/roslyn,ahmedshuhel/roslyn,nguerrera/roslyn,ahmedshuhel/roslyn,michalhosala/roslyn,khyperia/roslyn,paulvanbrenk/roslyn,mgoertz-msft/roslyn,stjeong/roslyn,tmat/roslyn,DanielRosenwasser/roslyn,rchande/roslyn,aanshibudhiraja/Roslyn,khyperia/roslyn,tannergooding/roslyn,DinoV/roslyn,HellBrick/roslyn,MichalStrehovsky/roslyn,DustinCampbell/roslyn,natidea/roslyn,oocx/roslyn,wschae/roslyn,OmniSharp/roslyn,davkean/roslyn,swaroop-sridhar/roslyn,leppie/roslyn,VPashkov/roslyn,enginekit/roslyn,oberxon/roslyn,cston/roslyn,russpowers/roslyn,mgoertz-msft/roslyn,Inverness/roslyn,3F/roslyn,rgani/roslyn,VitalyTVA/roslyn,stebet/roslyn,mirhagk/roslyn,cybernet14/roslyn,jcouv/roslyn,EricArndt/roslyn,marksantos/roslyn,stebet/roslyn,xasx/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,oocx/roslyn,tang7526/roslyn,thomaslevesque/roslyn,leppie/roslyn,dovzhikova/roslyn,stephentoub/roslyn,tang7526/roslyn,Shiney/roslyn,lisong521/roslyn,russpowers/roslyn,ilyes14/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,jbhensley/roslyn,mirhagk/roslyn,kelltrick/roslyn,Hosch250/roslyn,KiloBravoLima/roslyn,cybernet14/roslyn,huoxudong125/roslyn,yjfxfjch/roslyn,OmniSharp/roslyn,VPashkov/roslyn,dpen2000/roslyn,jroggeman/roslyn,diryboy/roslyn,REALTOBIZ/roslyn,vslsnap/roslyn,tannergooding/roslyn,krishnarajbb/roslyn,dovzhikova/roslyn,zooba/roslyn,furesoft/roslyn,jeremymeng/roslyn,jeffanders/roslyn,jrharmon/roslyn,KashishArora/Roslyn,mmitche/roslyn,ValentinRueda/roslyn,KevinRansom/roslyn,DustinCampbell/roslyn,nemec/roslyn,DustinCampbell/roslyn,jonatassaraiva/roslyn,bbarry/roslyn,danielcweber/roslyn,BugraC/roslyn,yeaicc/roslyn,jeremymeng/roslyn,kienct89/roslyn,v-codeel/roslyn,orthoxerox/roslyn,dpen2000/roslyn,akrisiun/roslyn,tmeschter/roslyn,jroggeman/roslyn,AlexisArce/roslyn,hanu412/roslyn,MattWindsor91/roslyn,jasonmalinowski/roslyn,jkotas/roslyn,tsdl2013/roslyn,vcsjones/roslyn,FICTURE7/roslyn,basoundr/roslyn,vslsnap/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,KevinRansom/roslyn,BugraC/roslyn,dsplaisted/roslyn,sharadagrawal/TestProject2,ljw1004/roslyn,drognanar/roslyn,balajikris/roslyn,srivatsn/roslyn,KevinH-MS/roslyn,devharis/roslyn,evilc0des/roslyn,JakeGinnivan/roslyn,eriawan/roslyn,RipCurrent/roslyn,khyperia/roslyn,reaction1989/roslyn,VSadov/roslyn,jgglg/roslyn,CaptainHayashi/roslyn,OmarTawfik/roslyn,drognanar/roslyn,mmitche/roslyn,pdelvo/roslyn,akrisiun/roslyn,jkotas/roslyn,tmeschter/roslyn,thomaslevesque/roslyn,sharadagrawal/Roslyn,antiufo/roslyn,OmniSharp/roslyn,taylorjonl/roslyn,doconnell565/roslyn,dpoeschl/roslyn,DinoV/roslyn,aelij/roslyn,michalhosala/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,REALTOBIZ/roslyn,paladique/roslyn,mgoertz-msft/roslyn,huoxudong125/roslyn,supriyantomaftuh/roslyn,jramsay/roslyn,KamalRathnayake/roslyn,jamesqo/roslyn,lisong521/roslyn,brettfo/roslyn,TyOverby/roslyn,mono/roslyn,tsdl2013/roslyn,nguerrera/roslyn,KevinRansom/roslyn,MihaMarkic/roslyn-prank,Giftednewt/roslyn,AnthonyDGreen/roslyn,rgani/roslyn,zmaruo/roslyn,3F/roslyn,enginekit/roslyn,kienct89/roslyn,Giten2004/roslyn,AArnott/roslyn,eriawan/roslyn,akrisiun/roslyn,dovzhikova/roslyn,mavasani/roslyn,stephentoub/roslyn,Giten2004/roslyn,huoxudong125/roslyn,bbarry/roslyn,ericfe-ms/roslyn,GuilhermeSa/roslyn,jaredpar/roslyn,bbarry/roslyn,v-codeel/roslyn,grianggrai/roslyn,agocke/roslyn,managed-commons/roslyn,KashishArora/Roslyn,AlekseyTs/roslyn,robinsedlaczek/roslyn,OmarTawfik/roslyn,jeremymeng/roslyn,amcasey/roslyn,YOTOV-LIMITED/roslyn,lorcanmooney/roslyn,antiufo/roslyn,Inverness/roslyn,physhi/roslyn,marksantos/roslyn,managed-commons/roslyn,aelij/roslyn,tannergooding/roslyn,ilyes14/roslyn,VitalyTVA/roslyn,nemec/roslyn,srivatsn/roslyn,swaroop-sridhar/roslyn,cston/roslyn,chenxizhang/roslyn,MattWindsor91/roslyn,heejaechang/roslyn,taylorjonl/roslyn,DinoV/roslyn,rchande/roslyn,bkoelman/roslyn
|
src/Dependencies/Microsoft.DiaSymReader/ISymUnmanagedDocument.cs
|
src/Dependencies/Microsoft.DiaSymReader/ISymUnmanagedDocument.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.DiaSymReader
{
[ComImport]
[ComVisible(false)]
[Guid("40DE4037-7C81-3E1E-B022-AE1ABFF2CA08")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISymUnmanagedDocument
{
[PreserveSig]
int GetURL(
int bufferLength,
out int count,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] char[] url);
[PreserveSig]
int GetDocumentType(ref Guid documentType);
[PreserveSig]
int GetLanguage(ref Guid language);
[PreserveSig]
int GetLanguageVendor(ref Guid vendor);
[PreserveSig]
int GetChecksumAlgorithmId(ref Guid algorithm);
[PreserveSig]
int GetChecksum(
int bufferLength,
out int count,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] checksum);
[PreserveSig]
int FindClosestLine(int line, out int closestLine);
[PreserveSig]
int HasEmbeddedSource(out bool value);
[PreserveSig]
int GetSourceLength(out int length);
[PreserveSig]
int GetSourceRange(
int startLine,
int startColumn,
int endLine,
int endColumn,
int bufferLength,
out int count,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] source);
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.DiaSymReader
{
[ComImport]
[ComVisible(false)]
[Guid("40DE4037-7C81-3E1E-B022-AE1ABFF2CA08")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ISymUnmanagedDocument
{
[PreserveSig]
int GetURL(
int bufferLength,
out int count,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] char[] url);
[PreserveSig]
int GetDocumentType(ref Guid documentType);
[PreserveSig]
int GetLanguage(ref Guid language);
[PreserveSig]
int GetLanguageVendor(ref Guid vendor);
[PreserveSig]
int GetCheckSumAlgorithmId(ref Guid algorithm);
[PreserveSig]
int GetChecksum(
int bufferLength,
out int count,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] checksum);
[PreserveSig]
int FindClosestLine(int line, out int closestLine);
[PreserveSig]
int HasEmbeddedSource(out bool value);
[PreserveSig]
int GetSourceLength(out int length);
[PreserveSig]
int GetSourceRange(
int startLine,
int startColumn,
int endLine,
int endColumn,
int bufferLength,
out int count,
[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[] source);
}
}
|
mit
|
C#
|
e3701ad2b03a503b19aba8efcfc931cbd1d67ef9
|
add form post html
|
siyo-wang/IdentityServer4,chrisowhite/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,chrisowhite/IdentityServer4,jbijlsma/IdentityServer4,jbijlsma/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,siyo-wang/IdentityServer4,IdentityServer/IdentityServer4,siyo-wang/IdentityServer4,MienDev/IdentityServer4,jbijlsma/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,jbijlsma/IdentityServer4
|
src/IdentityServer4/Endpoints/Results/AuthorizeFormPostResult.cs
|
src/IdentityServer4/Endpoints/Results/AuthorizeFormPostResult.cs
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.Threading.Tasks;
using IdentityServer4.Core.Models;
using IdentityServer4.Core.Extensions;
using IdentityServer4.Core.Hosting;
using Microsoft.AspNet.Http;
using System.Text;
namespace IdentityServer4.Core.Endpoints.Results
{
class AuthorizeFormPostResult : AuthorizeResult
{
const string _html = "<!DOCTYPE html><html><head><title>Submit this form</title><meta name='viewport' content='width=device-width, initial-scale=1.0' /></head><body><form method='post' action='{uri}'>{body}</form><script>(function(){document.forms[0].submit();})();</script></body></html>";
public AuthorizeFormPostResult(AuthorizeResponse response)
: base(response)
{
}
internal static string BuildFormBody(AuthorizeResponse response)
{
return response.ToNameValueCollection().ToFormPost();
}
public override async Task ExecuteAsync(IdentityServerContext context)
{
context.HttpContext.Response.ContentType = "text/html; charset=UTF-8";
context.HttpContext.Response.SetNoCache();
var html = _html;
html = html.Replace("{uri}", Response.RedirectUri);
html = html.Replace("{body}", BuildFormBody(Response));
await context.HttpContext.Response.WriteAsync(html, Encoding.UTF8);
}
}
}
|
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.Threading.Tasks;
using IdentityServer4.Core.Models;
using IdentityServer4.Core.Extensions;
using IdentityServer4.Core.Hosting;
using Microsoft.AspNet.Http;
namespace IdentityServer4.Core.Endpoints.Results
{
class AuthorizeFormPostResult : AuthorizeResult
{
public AuthorizeFormPostResult(AuthorizeResponse response)
: base(response)
{
}
internal static string BuildFormBody(AuthorizeResponse response)
{
return response.ToNameValueCollection().ToFormPost();
}
public override Task ExecuteAsync(IdentityServerContext context)
{
context.HttpContext.Response.SetNoCache();
// todo: render response <form>
return Task.FromResult(0);
}
}
}
|
apache-2.0
|
C#
|
1086a436ae08d2045b8e10207f3c07cb5b39c5a5
|
Update MonitorPipelineOperation.cs
|
grzesiek-galezowski/component-based-test-tool
|
ComponentBasedTestTool/Components/AzurePipelines/Operations/MonitorPipelineOperation.cs
|
ComponentBasedTestTool/Components/AzurePipelines/Operations/MonitorPipelineOperation.cs
|
using Core.Maybe;
using ExtensionPoints.ImplementedByComponents;
using ExtensionPoints.ImplementedByContext;
using System;
using Components.AzurePipelines.Client;
using Components.AzurePipelines.Client.Dto;
namespace Components.AzurePipelines.Operations;
public class MonitorPipelineOperation : IComponentOperation
{
private readonly IOperationsOutput _out;
private readonly AzurePipelinesComponentConfiguration _config;
private Maybe<IOperationParameter<string>> _idParam;
private Maybe<IOperationParameter<string>> _runIdParam;
public MonitorPipelineOperation(IOperationsOutput @out,
AzurePipelinesComponentConfiguration config)
{
_out = @out;
_config = config;
}
public async Task RunAsync(CancellationToken token)
{
var organization = _config.Organization.Value();
var project = _config.Project.Value();
var tokenLocation = _config.TokenLocation.Value();
var azurePipelinesWorkflows = new AzurePipelinesWorkflows(organization,
project,
tokenLocation);
await azurePipelinesWorkflows.MonitorBuild(
_out,
_idParam.Value().Value,
_runIdParam.Value().Value,
token);
}
public void InitializeParameters(IOperationParametersListBuilder parameters)
{
_idParam = parameters.Text("Pipeline Id", "1").Just(); //bug Add parameter type int
_runIdParam = parameters.Text("Run Id", "").Just(); //bug Add parameter type int
}
public void StoreParameters(IPersistentStorage destination)
{
//bug
}
}
|
using Core.Maybe;
using ExtensionPoints.ImplementedByComponents;
using ExtensionPoints.ImplementedByContext;
using System;
using Components.AzurePipelines.Client;
using Components.AzurePipelines.Client.Dto;
namespace Components.AzurePipelines.Operations;
public class MonitorPipelineOperation : IComponentOperation
{
private readonly IOperationsOutput _out;
private readonly AzurePipelinesComponentConfiguration _config;
private Maybe<IOperationParameter<string>> _idParam;
private Maybe<IOperationParameter<string>> _runIdParam;
public MonitorPipelineOperation(IOperationsOutput @out,
AzurePipelinesComponentConfiguration config)
{
_out = @out;
_config = config;
}
public async Task RunAsync(CancellationToken token)
{
var organization = _config.Organization.Value();
var project = _config.Project.Value();
var tokenLocation = _config.TokenLocation.Value();
var azurePipelinesWorkflows = new AzurePipelinesWorkflows(organization, project, tokenLocation);
await azurePipelinesWorkflows.MonitorBuild(
_out,
_idParam.Value().Value,
_runIdParam.Value().Value,
token);
}
public void InitializeParameters(IOperationParametersListBuilder parameters)
{
_idParam = parameters.Text("Pipeline Id", "1").Just(); //bug Add parameter type int
_runIdParam = parameters.Text("Run Id", "").Just(); //bug Add parameter type int
}
public void StoreParameters(IPersistentStorage destination)
{
//bug
}
}
|
mit
|
C#
|
a8f115c51fe6b529653c0bc0c0e28eb7eafa0afe
|
Use invariant culture.
|
VisualOn/dday.ical,VisualOn/dday.ical
|
DDay.iCal/Serialization/iCalendar/Serializers/DataTypes/GeographicLocationSerializer.cs
|
DDay.iCal/Serialization/iCalendar/Serializers/DataTypes/GeographicLocationSerializer.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
namespace DDay.iCal.Serialization.iCalendar
{
public class GeographicLocationSerializer :
EncodableDataTypeSerializer
{
public override Type TargetType
{
get { return typeof(GeographicLocation); }
}
public override string SerializeToString(object obj)
{
IGeographicLocation g = obj as IGeographicLocation;
if (g != null)
{
string value = g.Latitude.ToString("0.000000") + ";" + g.Longitude.ToString("0.000000");
return Encode(g, value);
}
return null;
}
public override object Deserialize(TextReader tr)
{
string value = tr.ReadToEnd();
IGeographicLocation g = CreateAndAssociate() as IGeographicLocation;
if (g != null)
{
// Decode the value, if necessary!
value = Decode(g, value);
string[] values = value.Split(';');
if (values.Length != 2)
return false;
double lat;
double lon;
double.TryParse(values[0], NumberStyles.Integer | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out lat);
double.TryParse(values[1], NumberStyles.Integer | NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out lon);
g.Latitude = lat;
g.Longitude = lon;
return g;
}
return null;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace DDay.iCal.Serialization.iCalendar
{
public class GeographicLocationSerializer :
EncodableDataTypeSerializer
{
public override Type TargetType
{
get { return typeof(GeographicLocation); }
}
public override string SerializeToString(object obj)
{
IGeographicLocation g = obj as IGeographicLocation;
if (g != null)
{
string value = g.Latitude.ToString("0.000000") + ";" + g.Longitude.ToString("0.000000");
return Encode(g, value);
}
return null;
}
public override object Deserialize(TextReader tr)
{
string value = tr.ReadToEnd();
IGeographicLocation g = CreateAndAssociate() as IGeographicLocation;
if (g != null)
{
// Decode the value, if necessary!
value = Decode(g, value);
string[] values = value.Split(';');
if (values.Length != 2)
return false;
double lat;
double lon;
double.TryParse(values[0], out lat);
double.TryParse(values[1], out lon);
g.Latitude = lat;
g.Longitude = lon;
return g;
}
return null;
}
}
}
|
bsd-3-clause
|
C#
|
5200059c50875fa43060f4e1e52fc0265c7526d3
|
Fix GlobalShortcut Register command.
|
xamarin/WebSharp,xamarin/WebSharp,xamarin/WebSharp,xamarin/WebSharp,xamarin/WebSharp,xamarin/WebSharp
|
electron-dotnet/src/websharpjs/WebSharp.js/dotnet/WebSharpJs.Electron/GlobalShortcut.cs
|
electron-dotnet/src/websharpjs/WebSharp.js/dotnet/WebSharpJs.Electron/GlobalShortcut.cs
|
using System;
using System.Threading.Tasks;
using WebSharpJs.NodeJS;
using WebSharpJs.Script;
namespace WebSharpJs.Electron
{
public class GlobalShortcut : EventEmitter
{
protected override string ScriptProxy => @"globalShortcut;";
protected override string Requires => @"const {globalShortcut} = require('electron');";
static GlobalShortcut proxy;
public static new async Task<GlobalShortcut> Create()
{
throw new NotSupportedException("Create() is not valid. Use Instance() to obtain a reference to GlobalShortcut.");
}
public static async Task<GlobalShortcut> Instance()
{
if (proxy == null)
{
proxy = new GlobalShortcut();
await proxy.Initialize();
}
return proxy;
}
protected GlobalShortcut() : base() { }
protected GlobalShortcut(object scriptObject) : base(scriptObject)
{ }
public GlobalShortcut(ScriptObjectProxy scriptObject) : base(scriptObject)
{ }
public static explicit operator GlobalShortcut(ScriptObjectProxy sop)
{
return new GlobalShortcut(sop);
}
public async Task Register(string accelerator, ScriptObjectCallback callback)
{
await Invoke<object>("register", accelerator, callback);
}
public async Task<bool> IsRegistered(string accelerator)
{
return await Invoke<bool>("isRegistered", accelerator);
}
public async Task UnRegister(string accelerator)
{
await Invoke<object>("unregister", accelerator);
}
public async Task UnRegisterAll()
{
await Invoke<object>("unregisterAll");
}
}
}
|
using System;
using System.Threading.Tasks;
using WebSharpJs.NodeJS;
using WebSharpJs.Script;
namespace WebSharpJs.Electron
{
public class GlobalShortcut : EventEmitter
{
protected override string ScriptProxy => @"globalShortcut;";
protected override string Requires => @"const {globalShortcut} = require('electron');";
static GlobalShortcut proxy;
public static async Task<GlobalShortcut> Instance()
{
if (proxy == null)
{
proxy = new GlobalShortcut();
await proxy.Initialize();
}
return proxy;
}
protected GlobalShortcut() : base() { }
protected GlobalShortcut(object scriptObject) : base(scriptObject)
{ }
public GlobalShortcut(ScriptObjectProxy scriptObject) : base(scriptObject)
{ }
public static explicit operator GlobalShortcut(ScriptObjectProxy sop)
{
return new GlobalShortcut(sop);
}
public async Task Register(string accelerator, ScriptObjectCallback callback)
{
await Invoke<object>("register", callback);
}
public async Task<bool> IsRegistered(string accelerator)
{
return await Invoke<bool>("isRegistered", accelerator);
}
public async Task UnRegister(string accelerator)
{
await Invoke<object>("unregister", accelerator);
}
public async Task UnRegisterAll()
{
await Invoke<object>("unregisterAll");
}
}
}
|
mit
|
C#
|
1dcd056e28d740c6ec015f2c546d3fec6f66cab7
|
Fix FieldsTest: should not search all types
|
wawrzyn/elasticsearch-net,robrich/elasticsearch-net,CSGOpenSource/elasticsearch-net,cstlaurent/elasticsearch-net,KodrAus/elasticsearch-net,SeanKilleen/elasticsearch-net,UdiBen/elasticsearch-net,SeanKilleen/elasticsearch-net,faisal00813/elasticsearch-net,mac2000/elasticsearch-net,joehmchan/elasticsearch-net,mac2000/elasticsearch-net,faisal00813/elasticsearch-net,wawrzyn/elasticsearch-net,DavidSSL/elasticsearch-net,geofeedia/elasticsearch-net,junlapong/elasticsearch-net,cstlaurent/elasticsearch-net,UdiBen/elasticsearch-net,SeanKilleen/elasticsearch-net,TheFireCookie/elasticsearch-net,gayancc/elasticsearch-net,KodrAus/elasticsearch-net,robrich/elasticsearch-net,jonyadamit/elasticsearch-net,cstlaurent/elasticsearch-net,geofeedia/elasticsearch-net,RossLieberman/NEST,robrich/elasticsearch-net,joehmchan/elasticsearch-net,ststeiger/elasticsearch-net,robertlyson/elasticsearch-net,tkirill/elasticsearch-net,jonyadamit/elasticsearch-net,robertlyson/elasticsearch-net,junlapong/elasticsearch-net,junlapong/elasticsearch-net,LeoYao/elasticsearch-net,tkirill/elasticsearch-net,adam-mccoy/elasticsearch-net,ststeiger/elasticsearch-net,RossLieberman/NEST,LeoYao/elasticsearch-net,wawrzyn/elasticsearch-net,azubanov/elasticsearch-net,starckgates/elasticsearch-net,robertlyson/elasticsearch-net,ststeiger/elasticsearch-net,DavidSSL/elasticsearch-net,elastic/elasticsearch-net,TheFireCookie/elasticsearch-net,mac2000/elasticsearch-net,CSGOpenSource/elasticsearch-net,abibell/elasticsearch-net,faisal00813/elasticsearch-net,CSGOpenSource/elasticsearch-net,gayancc/elasticsearch-net,elastic/elasticsearch-net,amyzheng424/elasticsearch-net,LeoYao/elasticsearch-net,joehmchan/elasticsearch-net,tkirill/elasticsearch-net,RossLieberman/NEST,jonyadamit/elasticsearch-net,adam-mccoy/elasticsearch-net,geofeedia/elasticsearch-net,TheFireCookie/elasticsearch-net,azubanov/elasticsearch-net,gayancc/elasticsearch-net,UdiBen/elasticsearch-net,starckgates/elasticsearch-net,amyzheng424/elasticsearch-net,abibell/elasticsearch-net,KodrAus/elasticsearch-net,azubanov/elasticsearch-net,adam-mccoy/elasticsearch-net,amyzheng424/elasticsearch-net,DavidSSL/elasticsearch-net,starckgates/elasticsearch-net,abibell/elasticsearch-net
|
src/Tests/Nest.Tests.Integration/Search/FieldTests/FieldsTest.cs
|
src/Tests/Nest.Tests.Integration/Search/FieldTests/FieldsTest.cs
|
using FluentAssertions;
namespace Nest.Tests.Integration.Search.FieldTests
{
using System.Collections.Generic;
using System.Linq;
using Elasticsearch.Net;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
[TestFixture]
public class FieldsTest : IntegrationTests
{
/// <summary>
/// Fields string param usage produces correct search string (ref: Nest.Tests.Unit.Search.SearchOptions.TestFieldsWithExclusionsByProperty)
/// Results fail to be correctly deserialized, resulting doc count is correct but docs are all null.
/// https://github.com/elasticsearch/elasticsearch-net/issues/606
/// </summary>
[Test]
public void Search_WithFieldsRemoved_ReturnsDocuments_ResultingArrayOfDocsShouldNotBeNull()
{
// Left in followers + contributors will cause a leaf node exception, so good test victims
var fields = typeof (ElasticsearchProject).GetProperties()
.Select(x => x.Name.ToCamelCase())
.Except(new List<string> {"followers", "contributors", "product", "nestedFollowers", "myGeoShape"}).ToList();
var queryResults = Client.Search<ElasticsearchProject>(s =>
s.Skip(0)
.Take(10)
.Fields(fields.ConvertAll(x => x.ToCamelCase()).ToArray())
);
Assert.True(queryResults.IsValid);
queryResults.Documents.Should().BeEmpty();
foreach (var doc in queryResults.FieldSelections)
{
// "content" is a string
var content = doc.FieldValues(p => p.Content).First();
content.Should().NotBeEmpty();
// intValues is a List<int>
// the string overload needs to be typed as int[]
// because elasticsearch will return special fields such as _routing, _parent
// as string not string[] return [] would make this unreachable
var intValues = doc.FieldValues<int[]>("intValues");
intValues.Should().NotBeEmpty().And.OnlyContain(i => i != 0);
//functionally equivalent, we need to flatten the expression with First()
//so that the returned type is int[] and not List<int>[];
intValues = doc.FieldValues(p => p.IntValues.First());
intValues.Should().NotBeEmpty().And.OnlyContain(i => i != 0);
}
}
}
}
|
using FluentAssertions;
namespace Nest.Tests.Integration.Search.FieldTests
{
using System.Collections.Generic;
using System.Linq;
using Elasticsearch.Net;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
[TestFixture]
public class FieldsTest : IntegrationTests
{
/// <summary>
/// Fields string param usage produces correct search string (ref: Nest.Tests.Unit.Search.SearchOptions.TestFieldsWithExclusionsByProperty)
/// Results fail to be correctly deserialized, resulting doc count is correct but docs are all null.
/// https://github.com/elasticsearch/elasticsearch-net/issues/606
/// </summary>
[Test]
public void Search_WithFieldsRemoved_ReturnsDocuments_ResultingArrayOfDocsShouldNotBeNull()
{
// Left in followers + contributors will cause a leaf node exception, so good test victims
var fields = typeof (ElasticsearchProject).GetProperties()
.Select(x => x.Name.ToCamelCase())
.Except(new List<string> {"followers", "contributors", "product", "nestedFollowers", "myGeoShape"}).ToList();
var queryResults = Client.Search<ElasticsearchProject>(s =>
s.Skip(0)
.Take(10)
.Fields(fields.ConvertAll(x => x.ToCamelCase()).ToArray())
.AllTypes());
Assert.True(queryResults.IsValid);
queryResults.Documents.Should().BeEmpty();
foreach (var doc in queryResults.FieldSelections)
{
// "content" is a string
var content = doc.FieldValues(p => p.Content).First();
content.Should().NotBeEmpty();
// intValues is a List<int>
// the string overload needs to be typed as int[]
// because elasticsearch will return special fields such as _routing, _parent
// as string not string[] return [] would make this unreachable
var intValues = doc.FieldValues<int[]>("intValues");
intValues.Should().NotBeEmpty().And.OnlyContain(i => i != 0);
//functionally equivalent, we need to flatten the expression with First()
//so that the returned type is int[] and not List<int>[];
intValues = doc.FieldValues(p => p.IntValues.First());
intValues.Should().NotBeEmpty().And.OnlyContain(i => i != 0);
}
}
}
}
|
apache-2.0
|
C#
|
942dd301814a9bd404cb3e51ee360eb52c7183ae
|
Use nested field mapping in nested query usage tests
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Tests/Tests/QueryDsl/Joining/Nested/NestedQueryUsageTests.cs
|
src/Tests/Tests/QueryDsl/Joining/Nested/NestedQueryUsageTests.cs
|
using System.Collections.Generic;
using System.Linq;
using Nest;
using Tests.Core.ManagedElasticsearch.Clusters;
using Tests.Domain;
using Tests.Framework.Integration;
using static Nest.Infer;
namespace Tests.QueryDsl.Joining.Nested
{
/**
* Nested query allows to query nested objects / docs (see {ref_current}/nested.html[nested mapping]).
* The query is executed against the nested objects / docs as if they were indexed as separate
* docs (they are, internally) and resulting in the root parent doc (or parent nested mapping).
*
* See the Elasticsearch documentation on {ref_current}/query-dsl-nested-query.html[nested query] for more details.
*/
public class NestedUsageTests : QueryDslUsageTestsBase
{
public NestedUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<INestedQuery>(a => a.Nested)
{
q => q.Query = null,
q => q.Query = ConditionlessQuery,
q => q.Path = null,
};
protected override QueryContainer QueryInitializer => new NestedQuery
{
Name = "named_query",
Boost = 1.1,
InnerHits = new InnerHits { Explain = true },
Path = Field<Project>(p => p.Tags),
Query = new TermsQuery
{
Field = Field<Project>(p => p.Tags.First().Name),
Terms = new[] { "lorem", "ipsum" }
},
IgnoreUnmapped = true
};
protected override object QueryJson => new
{
nested = new
{
_name = "named_query",
boost = 1.1,
query = new
{
terms = new Dictionary<string, object>
{
{ "tags.name", new[] { "lorem", "ipsum" } }
}
},
ignore_unmapped = true,
path = "tags",
inner_hits = new
{
explain = true
}
}
};
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
.Nested(c => c
.Name("named_query")
.Boost(1.1)
.InnerHits(i => i.Explain())
.Path(p => p.Tags)
.Query(nq => nq
.Terms(t => t
.Field(f => f.Tags.First().Name)
.Terms("lorem", "ipsum")
)
)
.IgnoreUnmapped()
);
}
}
|
using System.Collections.Generic;
using System.Linq;
using Nest;
using Tests.Core.ManagedElasticsearch.Clusters;
using Tests.Domain;
using Tests.Framework.Integration;
using static Nest.Infer;
namespace Tests.QueryDsl.Joining.Nested
{
/**
* Nested query allows to query nested objects / docs (see {ref_current}/nested.html[nested mapping]).
* The query is executed against the nested objects / docs as if they were indexed as separate
* docs (they are, internally) and resulting in the root parent doc (or parent nested mapping).
*
* See the Elasticsearch documentation on {ref_current}/query-dsl-nested-query.html[nested query] for more details.
*/
public class NestedUsageTests : QueryDslUsageTestsBase
{
public NestedUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<INestedQuery>(a => a.Nested)
{
q => q.Query = null,
q => q.Query = ConditionlessQuery,
q => q.Path = null,
};
protected override QueryContainer QueryInitializer => new NestedQuery
{
Name = "named_query",
Boost = 1.1,
InnerHits = new InnerHits { Explain = true },
Path = Field<Project>(p => p.CuratedTags),
Query = new TermsQuery
{
Field = Field<Project>(p => p.CuratedTags.First().Name),
Terms = new[] { "lorem", "ipsum" }
},
IgnoreUnmapped = true
};
protected override object QueryJson => new
{
nested = new
{
_name = "named_query",
boost = 1.1,
query = new
{
terms = new Dictionary<string, object>
{
{ "curatedTags.name", new[] { "lorem", "ipsum" } }
}
},
ignore_unmapped = true,
path = "curatedTags",
inner_hits = new
{
explain = true
}
}
};
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
.Nested(c => c
.Name("named_query")
.Boost(1.1)
.InnerHits(i => i.Explain())
.Path(p => p.CuratedTags)
.Query(nq => nq
.Terms(t => t
.Field(f => f.CuratedTags.First().Name)
.Terms("lorem", "ipsum")
)
)
.IgnoreUnmapped()
);
}
}
|
apache-2.0
|
C#
|
094320a11b926fdd1b34b70e0dff333a4baf5673
|
Upgrade the version
|
ronenbarak/Barak.VersionPatcher
|
src/Barak.VersionPatcher.Cmd/Properties/AssemblyInfo.cs
|
src/Barak.VersionPatcher.Cmd/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("Barak.VersionPatcher.Cmd")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Barak.VersionPatcher.Cmd")]
[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("671713bb-fb1c-43d7-9b8f-ff99e26c1dc8")]
// 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.3.0")]
[assembly: AssemblyFileVersion("1.0.3.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("Barak.VersionPatcher.Cmd")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Barak.VersionPatcher.Cmd")]
[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("671713bb-fb1c-43d7-9b8f-ff99e26c1dc8")]
// 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.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
|
apache-2.0
|
C#
|
fe7c7db80480c0cbf97e296f29721a5f062c6e54
|
Fix test.
|
JohanLarsson/Gu.Localization
|
Gu.Wpf.Localization/MarkupExtensions/CurrentCultureProxy.cs
|
Gu.Wpf.Localization/MarkupExtensions/CurrentCultureProxy.cs
|
namespace Gu.Wpf.Localization
{
using System.ComponentModel;
using System.Globalization;
using Gu.Localization;
internal class CurrentCultureProxy : INotifyPropertyChanged
{
internal static readonly CurrentCultureProxy Instance = new CurrentCultureProxy();
private CurrentCultureProxy()
{
Translator.CurrentCultureChanged += (_, __) => this.OnPropertyChanged(nameof(this.Value));
}
public event PropertyChangedEventHandler PropertyChanged;
public CultureInfo Value => Translator.CurrentCulture;
protected virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
namespace Gu.Wpf.Localization
{
using System.ComponentModel;
using System.Globalization;
using Gu.Localization;
internal class CurrentCultureProxy : INotifyPropertyChanged
{
internal static readonly CurrentCultureProxy Instance = new CurrentCultureProxy();
private CurrentCultureProxy()
{
Translator.CurrentCultureChanged += (_, __) => this.OnPropertyChanged(nameof(this.Value));
}
public event PropertyChangedEventHandler PropertyChanged;
internal CultureInfo Value => Translator.CurrentCulture;
protected virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
mit
|
C#
|
ad352f581a08df8b1c8153d5edd3775aa2383f10
|
Fix font scaling when two monitors are scaled differently (BL-10981)
|
gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop
|
src/BloomExe/Properties/AssemblyInfo.cs
|
src/BloomExe/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("Bloom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SIL")]
[assembly: AssemblyProduct("Bloom")]
[assembly: AssemblyCopyright("© SIL International 2012-2020")]
[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("0afa7c29-4107-47a8-88cc-c15cb769f35e")]
// 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:
// Note that an automated process updates these in the TeamCity build; these ones however are important
// for whether a local build satisfies BloomParseClient.GetIsThisVersionAllowedToUpload.
// [assembly: AssemblyVersion("0.9.999.0")]
[assembly: AssemblyVersion("5.2.000.0")]
[assembly: AssemblyFileVersion("5.2.000.0")]
[assembly: AssemblyInformationalVersion("5.2.000.0")]
[assembly: InternalsVisibleTo("BloomTests")]
[assembly: InternalsVisibleTo("BloomHarvester")]
[assembly: InternalsVisibleTo("BloomHarvesterTests")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
// Without explicitly disabling DPI awareness here, the subsequent
// loading of some System.Windows.Media components will cause the
// application to change from DPI "Unaware" to DPI "System Aware".
// The one place we know this happens currently is when loading font metadata.
// This causes problems when one monitor is set to different font scaling than another.
// Depending on how far the UI has gotten in setting up when the awareness status changes,
// it will either result in inconsistent font/icon sizing or the whole
// window will shrink down. See BL-10981.
[assembly: System.Windows.Media.DisableDpiAwareness]
|
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("Bloom")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SIL")]
[assembly: AssemblyProduct("Bloom")]
[assembly: AssemblyCopyright("© SIL International 2012-2020")]
[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("0afa7c29-4107-47a8-88cc-c15cb769f35e")]
// 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:
// Note that an automated process updates these in the TeamCity build; these ones however are important
// for whether a local build satisfies BloomParseClient.GetIsThisVersionAllowedToUpload.
// [assembly: AssemblyVersion("0.9.999.0")]
[assembly: AssemblyVersion("5.2.000.0")]
[assembly: AssemblyFileVersion("5.2.000.0")]
[assembly: AssemblyInformationalVersion("5.2.000.0")]
[assembly: InternalsVisibleTo("BloomTests")]
[assembly: InternalsVisibleTo("BloomHarvester")]
[assembly: InternalsVisibleTo("BloomHarvesterTests")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
mit
|
C#
|
e441eb42f884a2bec279e225dbc335e8da703a14
|
Add license header.
|
gatzka/SharpJet,gatzka/cs-jet,leistner/SharpJet
|
cs-jet/Properties/AssemblyInfo.cs
|
cs-jet/Properties/AssemblyInfo.cs
|
// <copyright file="AssemblyInfo.cs" company="Hottinger Baldwin Messtechnik GmbH">
//
// CS Jet, a library to communicate with Jet IPC.
//
// The MIT License (MIT)
//
// Copyright (C) Hottinger Baldwin Messtechnik GmbH
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// </copyright>
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("cs-jet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cs-jet")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3bbd7939-e260-4951-a120-82892c5f09db")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.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("cs-jet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cs-jet")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3bbd7939-e260-4951-a120-82892c5f09db")]
// 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#
|
de83c5ed4945891bd165ecd85b678f19f55f1e91
|
Fix broken test
|
jherby2k/AudioWorks
|
AudioWorks/tests/AudioWorks.Api.Tests/ExtensionInstallerTests.cs
|
AudioWorks/tests/AudioWorks.Api.Tests/ExtensionInstallerTests.cs
|
/* Copyright 2020 Jeremy Herbison
This file is part of AudioWorks.
AudioWorks 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.
AudioWorks 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 AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */
using System.IO;
using AudioWorks.Common;
using AudioWorks.TestUtilities;
using Xunit;
using Xunit.Abstractions;
namespace AudioWorks.Api.Tests
{
[Collection("Setup Tests")]
public sealed class ExtensionInstallerTests
{
public ExtensionInstallerTests(ITestOutputHelper outputHelper) =>
LoggerManager.AddSingletonProvider(() => new XunitLoggerProvider()).OutputHelper = outputHelper;
[Fact(DisplayName = "ExtensionInstaller's InstallAsync method installs the available extensions")]
public async void InstallAsyncInstallsExtensions()
{
var extensionRoot = new DirectoryInfo(ExtensionInstaller.ExtensionRoot);
if (!ExtensionInstaller.LoadComplete && extensionRoot.Exists)
extensionRoot.Delete(true);
await ExtensionInstaller.InstallAsync().ConfigureAwait(true);
extensionRoot.Refresh();
Assert.True(extensionRoot.Exists);
Assert.True(extensionRoot.GetDirectories().Length > 0);
Assert.All(extensionRoot.GetDirectories(), extensionDir =>
Assert.True(extensionDir.GetFiles().Length > 0));
}
[Fact(DisplayName = "ExtensionInstaller's InstallAsync method removes unpublished extensions")]
public async void InstallAsyncRemovesUnpublishedExtensions()
{
var extensionRoot = new DirectoryInfo(ExtensionInstaller.ExtensionRoot);
if (!extensionRoot.Exists)
extensionRoot.Create();
var fakeExtensionDir = extensionRoot.CreateSubdirectory("AudioWorks.Extensions.OldExtension.1.0.0");
using (File.Create(Path.Combine(fakeExtensionDir.FullName, "AudioWorks.Extensions.OldExtension.dll")))
{
}
await ExtensionInstaller.InstallAsync().ConfigureAwait(true);
fakeExtensionDir.Refresh();
Assert.False(fakeExtensionDir.Exists);
}
}
}
|
/* Copyright 2020 Jeremy Herbison
This file is part of AudioWorks.
AudioWorks 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.
AudioWorks 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 AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */
using System.IO;
using AudioWorks.Common;
using AudioWorks.TestUtilities;
using Xunit;
using Xunit.Abstractions;
namespace AudioWorks.Api.Tests
{
[Collection("Setup Tests")]
public sealed class ExtensionInstallerTests
{
public ExtensionInstallerTests(ITestOutputHelper outputHelper) =>
LoggerManager.AddSingletonProvider(() => new XunitLoggerProvider()).OutputHelper = outputHelper;
[Fact(DisplayName = "ExtensionInstaller's InstallAsync method installs the available extensions")]
public async void InstallAsyncInstallsExtensions()
{
var extensionRoot = new DirectoryInfo(ExtensionInstaller.ExtensionRoot);
if (!ExtensionInstaller.LoadComplete && extensionRoot.Exists)
extensionRoot.Delete(true);
await ExtensionInstaller.InstallAsync().ConfigureAwait(true);
extensionRoot.Refresh();
Assert.True(extensionRoot.Exists);
Assert.True(extensionRoot.GetDirectories().Length > 0);
Assert.All(extensionRoot.GetDirectories(), extensionDir =>
Assert.True(extensionDir.GetFiles().Length > 0));
}
[Fact(DisplayName = "ExtensionInstaller's InstallAsync method removes unpublished extensions")]
public async void InstallAsyncRemovesUnpublishedExtensions()
{
var extensionRoot = new DirectoryInfo(ExtensionInstaller.ExtensionRoot);
if (!extensionRoot.Exists)
extensionRoot.Create();
var fakeExtensionDir = extensionRoot.CreateSubdirectory("AudioWorks.Extensions.OldExtension.1.0.0");
await using (File.Create(Path.Combine(fakeExtensionDir.FullName, "AudioWorks.Extensions.OldExtension.dll")))
{
}
await ExtensionInstaller.InstallAsync().ConfigureAwait(true);
fakeExtensionDir.Refresh();
Assert.False(fakeExtensionDir.Exists);
}
}
}
|
agpl-3.0
|
C#
|
ba8894b725f347078cd550f430dbd593a9a64534
|
Make sure logging doesn't cause cross-thread access to the log-file
|
YellowLineParking/Ylp.GitDb
|
Ylp.GitDb.Core/ILogger.cs
|
Ylp.GitDb.Core/ILogger.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
namespace Ylp.GitDb.Core
{
public interface ILogger
{
Task Log(string message);
}
public class Logger : ILogger
{
public readonly string FileName;
static readonly object LockObj = new object();
public Logger(string fileName)
{
FileName = fileName;
}
public Task Log(string message)
{
lock(LockObj)
File.AppendAllText(FileName, $"{DateTime.Now.ToString("HH:mm:ss")}: {message}\n");
return Task.CompletedTask;
}
}
}
|
using System;
using System.IO;
using System.Threading.Tasks;
namespace Ylp.GitDb.Core
{
public interface ILogger
{
Task Log(string message);
}
public class Logger : ILogger
{
public readonly string FileName;
public Logger(string fileName)
{
FileName = fileName;
}
public Task Log(string message)
{
File.AppendAllText(FileName, $"{DateTime.Now.ToString("HH:mm:ss")}: {message}\n");
return Task.CompletedTask;
}
}
}
|
mit
|
C#
|
0b9b09fa1ebc4e8a911221e3ade68d89273af590
|
Revert the whitespace change of the auto generated file
|
pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet
|
src/Core/Managed/Shared/Extensibility/Implementation/External/ExceptionDetails_types.cs
|
src/Core/Managed/Shared/Extensibility/Implementation/External/ExceptionDetails_types.cs
|
//------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Tool : Bond Compiler 0.4.1.0
// File : ExceptionDetails_types.cs
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// <auto-generated />
//------------------------------------------------------------------------------
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.External
{
using System.Collections.Concurrent;
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.4.1.0")]
internal partial class ExceptionDetails
{
public int id { get; set; }
public int outerId { get; set; }
public string typeName { get; set; }
public string message { get; set; }
public bool hasFullStack { get; set; }
public string stack { get; set; }
public IList<StackFrame> parsedStack { get; set; }
public ExceptionDetails()
: this("AI.ExceptionDetails", "ExceptionDetails")
{}
protected ExceptionDetails(string fullName, string name)
{
typeName = "";
message = "";
hasFullStack = true;
stack = "";
parsedStack = new List<StackFrame>();
}
}
} // AI
|
//------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Tool : Bond Compiler 0.4.1.0
// File : ExceptionDetails_types.cs
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// <auto-generated />
//------------------------------------------------------------------------------
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.External
{
using System.Collections.Concurrent;
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.4.1.0")]
internal partial class ExceptionDetails
{
public int id { get; set; }
public int outerId { get; set; }
public string typeName { get; set; }
public string message { get; set; }
public bool hasFullStack { get; set; }
public string stack { get; set; }
public IList<StackFrame> parsedStack { get; set; }
public ExceptionDetails()
: this("AI.ExceptionDetails", "ExceptionDetails")
{ }
protected ExceptionDetails(string fullName, string name)
{
typeName = "";
message = "";
hasFullStack = true;
stack = "";
parsedStack = new List<StackFrame>();
}
}
} // AI
|
mit
|
C#
|
69292d88612fa328a47ad3ce207ad94cbf29b105
|
Support all objects for debugger display.
|
Qowaiv/Qowaiv
|
src/Qowaiv.UnitTests/TestTools/DebuggerDisplayAssert.cs
|
src/Qowaiv.UnitTests/TestTools/DebuggerDisplayAssert.cs
|
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Qowaiv.UnitTests.TestTools
{
public static class DebuggerDisplayAssert
{
public static void HasAttribute(Type type)
{
Assert.IsNotNull(type, "The supplied type should not be null.");
var act = (DebuggerDisplayAttribute)type.GetCustomAttributes(typeof(DebuggerDisplayAttribute), false).FirstOrDefault();
Assert.IsNotNull(act, "The type '{0}' has no DebuggerDisplay attribute.", type);
Assert.AreEqual("{DebuggerDisplay}", act.Value, "DebuggerDisplay attribute value is not '{DebuggerDisplay}'.");
}
public static void HasResult(object expected, object value)
{
Assert.IsNotNull(value, "The supplied value should not be null.");
var type = value.GetType();
var prop = type.GetProperty("DebuggerDisplay", BindingFlags.Instance | BindingFlags.NonPublic);
Assert.IsNotNull(prop, "The type '{0}' does not contain a non-public property DebuggerDisplay.", type);
var actual = prop.GetValue(value);
Assert.AreEqual(expected, actual);
}
}
}
|
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Qowaiv.UnitTests.TestTools
{
public static class DebuggerDisplayAssert
{
public static void HasAttribute(Type type)
{
Assert.IsNotNull(type, "The supplied type should not be null.");
var act = (DebuggerDisplayAttribute)type.GetCustomAttributes(typeof(DebuggerDisplayAttribute), false).FirstOrDefault();
Assert.IsNotNull(act, "The type '{0}' has no DebuggerDisplay attribute.", type);
Assert.AreEqual("{DebuggerDisplay}", act.Value, "DebuggerDisplay attribute value is not '{DebuggerDisplay}'.");
}
public static void HasResult(string expected, object value)
{
Assert.IsNotNull(value, "The supplied value should not be null.");
var type = value.GetType();
var prop = type.GetProperty("DebuggerDisplay", BindingFlags.Instance | BindingFlags.NonPublic);
Assert.IsNotNull(prop, "The type '{0}' does not contain a non-public property DebuggerDisplay.", type);
var actual = prop.GetValue(value);
Assert.AreEqual(expected, actual);
}
}
}
|
mit
|
C#
|
934e28b4667354845e7b137dfc965e3e14945b84
|
Fix log4net location.
|
aspnetboilerplate/module-zero-template,aspnetboilerplate/module-zero-template,aspnetboilerplate/module-zero-template
|
src/AbpCompanyName.AbpProjectName.WebMpa/Global.asax.cs
|
src/AbpCompanyName.AbpProjectName.WebMpa/Global.asax.cs
|
using System;
using Abp.Castle.Logging.Log4Net;
using Abp.Web;
using Castle.Facilities.Logging;
namespace AbpCompanyName.AbpProjectName.WebMpa
{
public class MvcApplication : AbpWebApplication<AbpProjectNameWebModule>
{
protected override void Application_Start(object sender, EventArgs e)
{
AbpBootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(
f => f.UseAbpLog4Net().WithConfig(Server.MapPath("log4net.config"))
);
base.Application_Start(sender, e);
}
}
}
|
using System;
using Abp.Castle.Logging.Log4Net;
using Abp.Web;
using Castle.Facilities.Logging;
namespace AbpCompanyName.AbpProjectName.WebMpa
{
public class MvcApplication : AbpWebApplication<AbpProjectNameWebModule>
{
protected override void Application_Start(object sender, EventArgs e)
{
AbpBootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(
f => f.UseAbpLog4Net().WithConfig("log4net.config")
);
base.Application_Start(sender, e);
}
}
}
|
mit
|
C#
|
5550c458f5a026b5d678a2d6d67b06bb9f9ddb05
|
fix Word/EmailTemplate casting
|
signumsoftware/extensions,AlejandroCano/extensions,signumsoftware/framework,signumsoftware/extensions,MehdyKarimpour/extensions,MehdyKarimpour/extensions,AlejandroCano/extensions,signumsoftware/framework
|
Signum.Entities.Extensions/Templating/TemplateApplicable.cs
|
Signum.Entities.Extensions/Templating/TemplateApplicable.cs
|
using Signum.Entities.Basics;
using Signum.Entities.Dynamic;
using Signum.Entities.Word;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Signum.Entities.Mailing;
namespace Signum.Entities.Templating
{
public class TemplateApplicableEval : EvalEmbedded<ITemplateApplicable>
{
protected override CompilationResult Compile()
{
var script = this.Script.Trim();
script = script.Contains(';') ? script : ("return " + script + ";");
var parentEntity = this.GetParentEntity();
var query = parentEntity is WordTemplateEntity wt ? wt.Query :
parentEntity is EmailTemplateEntity et ? et.Query :
throw new UnexpectedValueException(parentEntity);
var entityTypeName = (QueryEntity.GetEntityImplementations(query).Types.Only() ?? typeof(Entity)).Name;
return Compile(DynamicCode.GetAssemblies(),
DynamicCode.GetUsingNamespaces() +
@"
namespace Signum.Entities.Templating
{
class Evaluator : Signum.Entities.Templating.ITemplateApplicable
{
public bool ApplicableUntyped(Entity e)
{
return this.Applicable((" + entityTypeName + @")e);
}
bool Applicable(" + entityTypeName + @" e)
{
" + script + @"
}
}
}");
}
}
public interface ITemplateApplicable
{
bool ApplicableUntyped(Entity e);
}
}
|
using Signum.Entities.Basics;
using Signum.Entities.Dynamic;
using Signum.Entities.Word;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Entities.Templating
{
public class TemplateApplicableEval : EvalEmbedded<ITemplateApplicable>
{
protected override CompilationResult Compile()
{
var script = this.Script.Trim();
script = script.Contains(';') ? script : ("return " + script + ";");
var entityTypeName = (QueryEntity.GetEntityImplementations(((WordTemplateEntity)this.GetParentEntity()).Query).Types.Only() ?? typeof(Entity)).Name;
return Compile(DynamicCode.GetAssemblies(),
DynamicCode.GetUsingNamespaces() +
@"
namespace Signum.Entities.Templating
{
class Evaluator : Signum.Entities.Templating.ITemplateApplicable
{
public bool ApplicableUntyped(Entity e)
{
return this.Applicable((" + entityTypeName + @")e);
}
bool Applicable(" + entityTypeName + @" e)
{
" + script + @"
}
}
}");
}
}
public interface ITemplateApplicable
{
bool ApplicableUntyped(Entity e);
}
}
|
mit
|
C#
|
1754b68429a8e6738688329bcfbca39ef37ab051
|
Update GrainReferenceConverter.cs
|
OrleansContrib/orleans.serialization.json
|
Orleans.Serialization.Newtonsoft.Json/GrainReferenceConverter.cs
|
Orleans.Serialization.Newtonsoft.Json/GrainReferenceConverter.cs
|
#if NEWTONSOFT
namespace Orleans.Serialization.Newtonsoft.Json
#elif RAVENDB
namespace Orleans.Serialization.RavenDB.Json
#endif
{
using System;
using Runtime;
#if NEWTONSOFT
using global::Newtonsoft.Json;
#elif RAVENDB
using Raven.Imports.Newtonsoft.Json;
#endif
internal class GrainReferenceConverter : JsonConverter
{
public override bool CanRead
{
get { return true; }
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var reference = (GrainReference)value;
string key = reference.ToKeyString();
var info = new GrainReferenceInfo
{
Key = key,
Data = SerializationManager.SerializeToByteArray(value)
};
serializer.Serialize(writer, info);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var info = new GrainReferenceInfo();
serializer.Populate(reader, info);
return SerializationManager.Deserialize(objectType, new BinaryTokenStreamReader(info.Data));
}
public override bool CanConvert(Type objectType)
{
return typeof(IGrain).IsAssignableFrom(objectType);
}
}
}
|
#if NEWTONSOFT
namespace Orleans.Serialization.Newtonsoft.Json
#elif RAVENDB
namespace Orleans.Serialization.RavenDB.Json
#endif
{
using System;
using Runtime;
#if NEWTONSOFT
using global::Newtonsoft.Json;
#elif RAVENDB
using Raven.Imports.Newtonsoft.Json;
#endif
internal class GrainReferenceConverter : JsonConverter
{
public override bool CanRead
{
get { return true; }
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var reference = (GrainReference)value;
string key = reference.ToKeyString();
var info = new GrainReferenceInfo
{
Key = key,
Data = SerializationManager.SerializeToByteArray(value)
};
serializer.Serialize(writer, info);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (existingValue == null)
{
return null;
}
var info = new GrainReferenceInfo();
serializer.Populate(reader, info);
return SerializationManager.Deserialize(objectType, new BinaryTokenStreamReader(info.Data));
}
public override bool CanConvert(Type objectType)
{
return typeof(IGrain).IsAssignableFrom(objectType);
}
}
}
|
apache-2.0
|
C#
|
6d2a397d33f0f4822405ed3fe450dd3cc5122335
|
Update IAzureBlobStorageRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/AzureStorage/IAzureBlobStorageRepository.cs
|
TIKSN.Core/Data/AzureStorage/IAzureBlobStorageRepository.cs
|
namespace TIKSN.Data.AzureStorage
{
public interface IAzureBlobStorageRepository : IFileRepository
{
}
}
|
namespace TIKSN.Data.AzureStorage
{
public interface IAzureBlobStorageRepository : IFileRepository
{
}
}
|
mit
|
C#
|
c7894e9fb273cda5365239967314390f79e079a8
|
Test commit
|
optivem/immerest,optivem/optivem-commons-cs
|
src/Optivem.Commons.Parsing.Default/BaseNumberParser.cs
|
src/Optivem.Commons.Parsing.Default/BaseNumberParser.cs
|
using System;
using System.Globalization;
namespace Optivem.Commons.Parsing.Default
{
public abstract class BaseNumberParser<T> : BaseParser<T>
{
public BaseNumberParser(NumberStyles? numberStyles = null, IFormatProvider formatProvider = null)
{
NumberStyles = numberStyles;
FormatProvider = formatProvider;
}
public IFormatProvider FormatProvider { get; private set; }
public NumberStyles? NumberStyles { get; private set; }
protected override T ParseInner(string value)
{
if(NumberStyles != null && FormatProvider != null)
{
return ParseNumber(value, NumberStyles.Value, FormatProvider);
}
if(NumberStyles != null)
{
return ParseNumber(value, NumberStyles.Value);
}
if(FormatProvider != null)
{
return ParseNumber(value, FormatProvider);
}
return ParseNumber(value);
}
protected abstract T ParseNumber(string value);
protected abstract T ParseNumber(string value, IFormatProvider formatProvider);
protected abstract T ParseNumber(string value, NumberStyles numberStyles);
protected abstract T ParseNumber(string value, NumberStyles numberStyles, IFormatProvider formatProvider);
}
}
|
using System;
using System.Globalization;
namespace Optivem.Commons.Parsing.Default
{
public abstract class BaseNumberParser<T> : BaseParser<T>
{
public BaseNumberParser(NumberStyles? numberStyles = null, IFormatProvider formatProvider = null)
{
NumberStyles = numberStyles;
FormatProvider = formatProvider;
}
public2 IFormatProvider FormatProvider { get; private set; }
public NumberStyles? NumberStyles { get; private set; }
protected override T ParseInner(string value)
{
if(NumberStyles != null && FormatProvider != null)
{
return ParseNumber(value, NumberStyles.Value, FormatProvider);
}
if(NumberStyles != null)
{
return ParseNumber(value, NumberStyles.Value);
}
if(FormatProvider != null)
{
return ParseNumber(value, FormatProvider);
}
return ParseNumber(value);
}
protected abstract T ParseNumber(string value);
protected abstract T ParseNumber(string value, IFormatProvider formatProvider);
protected abstract T ParseNumber(string value, NumberStyles numberStyles);
protected abstract T ParseNumber(string value, NumberStyles numberStyles, IFormatProvider formatProvider);
}
}
|
apache-2.0
|
C#
|
10055508e9f9f9e51dbc46368ec10b1991123e1b
|
add properties
|
Appleseed/base,Appleseed/base
|
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/RootSolrObject.cs
|
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/RootSolrObject.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class RootSolrObject
{
public SolrResponse response { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Appleseed.Base.Alerts.Model
{
class RootSolrObject
{
}
}
|
apache-2.0
|
C#
|
f07cae787f16ea07ffd1bedd5e8e4346567bb3b5
|
Clean up test and reference original issue
|
DotNetAnalyzers/StyleCopAnalyzers
|
StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/LayoutRules/SA1514CSharp8UnitTests.cs
|
StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/LayoutRules/SA1514CSharp8UnitTests.cs
|
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace StyleCop.Analyzers.Test.CSharp8.LayoutRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.Test.CSharp7.LayoutRules;
using Xunit;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
StyleCop.Analyzers.LayoutRules.SA1514ElementDocumentationHeaderMustBePrecededByBlankLine,
StyleCop.Analyzers.LayoutRules.SA1514CodeFixProvider>;
public class SA1514CSharp8UnitTests : SA1514CSharp7UnitTests
{
[Fact]
[WorkItem(3067, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3067")]
public async Task TestValidPropertyDeclarationAsync()
{
var testCode = @"namespace TestNamespace
{
public class TestClass
{
/// <summary>
/// Gets or sets the value.
/// </summary>
public string SomeString { get; set; } = null!;
/// <summary>
/// Gets or sets the value.
/// </summary>
public string AnotherString { get; set; } = null!;
}
}
";
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
}
}
|
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace StyleCop.Analyzers.Test.CSharp8.LayoutRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.Test.CSharp7.LayoutRules;
using Xunit;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
StyleCop.Analyzers.LayoutRules.SA1514ElementDocumentationHeaderMustBePrecededByBlankLine,
StyleCop.Analyzers.LayoutRules.SA1514CodeFixProvider>;
public class SA1514CSharp8UnitTests : SA1514CSharp7UnitTests
{
/// <summary>
/// Verifies that method-like declarations with invalid documentation will produce the expected diagnostics.
/// </summary>
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
[Fact]
public async Task TestValidPropertyDeclarationAsync()
{
var testCode = @"namespace TestNamespace
{
public class TestClass
{
/// <summary>
/// Gets or sets the value.
/// </summary>
public string SomeString { get; set; } = null!;
/// <summary>
/// Gets or sets the value.
/// </summary>
public string AnotherString { get; set; } = null!;
}
}
";
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
}
}
|
mit
|
C#
|
b0399e4022c86c9663b6b9be9e7a82131f21fb5e
|
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 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)");
});
}
}
}
|
mit
|
C#
|
09e57d586b91c48e066e51d8570dc7dbfe89a487
|
Remove extra comment
|
nycdotnet/FizzBuzz
|
FizzBuzzConsole/Program.cs
|
FizzBuzzConsole/Program.cs
|
using System;
using FizzBuzzDotNet.Business;
namespace FizzBuzzDotNet
{
class Program
{
static void Main(string[] args)
{
var fb = new FizzBuzz(2000000000);
foreach (var item in fb.All())
{
Console.WriteLine(item);
};
Console.ReadKey();
}
}
}
|
using System;
using FizzBuzzDotNet.Business;
namespace FizzBuzzDotNet
{
class Program
{
static void Main(string[] args)
{
var fb = new FizzBuzz(2000000000);
foreach (var item in fb.All())
{
Console.WriteLine(item);
};
Console.ReadKey();
}
}
/*
* Automated test cases.
* Provide replacement rules. - extend to support any number of replacement rules. (number and word pairs)
* put on GitHub and email URL to Rayne
*
*/
}
|
mit
|
C#
|
021203814285ce16eaaf2fbfdd0e471e10a3de2b
|
Fix code examples in IModule interface
|
philipproplesch/KInspector,xpekatt/KInspector,anibalvelarde/KInspector,pnmcosta/KInspector,anibalvelarde/KInspector,KenticoBSoltis/KInspector,Kentico/KInspector,anibalvelarde/KInspector,KenticoBSoltis/KInspector,TheEskhaton/KInspector,petrsvihlik/KInspector,martbrow/KInspector,Kentico/KInspector,ChristopherJennings/KInspector,JosefDvorak/KInspector,ChristopherJennings/KInspector,martbrow/KInspector,petrsvihlik/KInspector,pnmcosta/KInspector,philipproplesch/KInspector,ChristopherJennings/KInspector,TheEskhaton/KInspector,ChristopherJennings/KInspector,Kentico/KInspector,TheEskhaton/KInspector,pnmcosta/KInspector,KenticoBSoltis/KInspector,martbrow/KInspector,xpekatt/KInspector,Kentico/KInspector,JosefDvorak/KInspector,philipproplesch/KInspector,xpekatt/KInspector,JosefDvorak/KInspector,petrsvihlik/KInspector
|
KInspector.Core/IModule.cs
|
KInspector.Core/IModule.cs
|
namespace KInspector.Core
{
/// <summary>
/// The interface to implement to add a functionality to this application.
/// Add DLL with implementation of this interface to the same folder as executing assembly to auto-load
/// all of them.
/// </summary>
public interface IModule
{
/// <summary>
/// Returns the metadata of the module.
/// </summary>
/// <example>
/// <code>
/// public ModuleMetadata GetModuleMetadata()
/// {
/// return new ModuleMetadata()
/// {
/// Name = "EventLog Information",
/// SupportedVersions = new[] { new Version("6.0"), new Version("7.0") },
/// Comment = "Checks event log for information like 404 pages and logged exceptions."
/// };
/// }
/// </code>
/// </example>
ModuleMetadata GetModuleMetadata();
/// <summary>
/// Returns the whole result set of the module.
/// </summary>
/// <example>
/// <code>
/// public ModuleResults GetResults(InstanceInfo instanceInfo, DatabaseService dbService)
/// {
/// var results = dbService.ExecuteAndGetDataSetFromFile("EventLogInfoModule.sql");
///
/// return new ModuleResults()
/// {
/// Result = results,
/// ResultComment = "Check event log for more details!"
/// };
/// }
/// </code>
/// </example>
ModuleResults GetResults(InstanceInfo instanceInfo, DatabaseService dbService);
}
}
|
namespace KInspector.Core
{
/// <summary>
/// The interface to implement to add a functionality to this application.
/// Add DLL with implementation of this interface to the same folder as executing assembly to auto-load
/// all of them.
/// </summary>
public interface IModule
{
/// <summary>
/// Returns the metadata of the module
/// </summary>
/// <example>
/// <![CDATA[
/// public ModuleMetadata GetModuleMetadata()
/// {
/// return new ModuleMetadata()
/// {
/// Name = "EventLog Information",
/// Versions = new List<string>() { "8.0", "8.1" },
/// Comment = "Checks event log for information like 404 pages and logged exceptions.",
/// ResultType = ModuleResultsType.Table
/// };
/// }
/// ]]>
/// </example>
ModuleMetadata GetModuleMetadata();
/// <summary>
/// Returns the whole result set of the module.
/// </summary>
/// <example>
/// <![CDATA[
/// public ModuleResults GetResults(InstanceInfo instanceInfo, DatabaseService dbService)
/// {
/// var dbService = new DatabaseService(config);
/// var results = dbService.ExecuteAndGetPrintsFromFile("EventLogInfoModule.sql");
///
/// return new ModuleResults()
/// {
/// Result = results,
/// ResultComment = "Check event log for more details!"
/// };
/// }
/// ]]>
/// </example>
ModuleResults GetResults(InstanceInfo instanceInfo, DatabaseService dbService);
}
}
|
mit
|
C#
|
ea8117d380508ee3b9dd0dbf31c1c441f3c3ff2e
|
Resolve IUserService lazily while activating the shell (#9249)
|
xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2
|
src/OrchardCore.Modules/OrchardCore.Users/Services/RecipeEnvironmentSuperUserProvider.cs
|
src/OrchardCore.Modules/OrchardCore.Users/Services/RecipeEnvironmentSuperUserProvider.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OrchardCore.Recipes.Services;
using OrchardCore.Settings;
namespace OrchardCore.Users.Services
{
public class RecipeEnvironmentSuperUserProvider : IRecipeEnvironmentProvider
{
private readonly ISiteService _siteService;
private readonly IServiceProvider _serviceProvider;
private IUserService _userService;
private readonly ILogger _logger;
public RecipeEnvironmentSuperUserProvider(
ISiteService siteService,
IServiceProvider serviceProvider,
ILogger<RecipeEnvironmentSuperUserProvider> logger)
{
_siteService = siteService;
_serviceProvider = serviceProvider;
_logger = logger;
}
public int Order => 0;
public async Task PopulateEnvironmentAsync(IDictionary<string, object> environment)
{
var siteSettings = await _siteService.GetSiteSettingsAsync();
if (!String.IsNullOrEmpty(siteSettings.SuperUser))
{
try
{
// 'IUserService' has many dependencies including options configurations code, particularly with 'OpenId',
// so, because this 'IRecipeEnvironmentProvider' may be injected by an `IDataMigration` even if there is no
// migration to do, 'IUserService' is lazily resolved, so that it is not injected on each shell activation.
_userService ??= _serviceProvider.GetRequiredService<IUserService>();
var superUser = await _userService.GetUserByUniqueIdAsync(siteSettings.SuperUser);
if (superUser != null)
{
environment["AdminUserId"] = siteSettings.SuperUser;
environment["AdminUsername"] = superUser.UserName;
}
}
catch
{
_logger.LogWarning("Could not lookup the admin user, user migrations may not have run yet.");
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using OrchardCore.Recipes.Services;
using OrchardCore.Settings;
namespace OrchardCore.Users.Services
{
public class RecipeEnvironmentSuperUserProvider : IRecipeEnvironmentProvider
{
private readonly ISiteService _siteService;
private readonly IUserService _userService;
private readonly ILogger _logger;
public RecipeEnvironmentSuperUserProvider(
ISiteService siteService,
IUserService userService,
ILogger<RecipeEnvironmentSuperUserProvider> logger)
{
_siteService = siteService;
_userService = userService;
_logger = logger;
}
public int Order => 0;
public async Task PopulateEnvironmentAsync(IDictionary<string, object> environment)
{
var siteSettings = await _siteService.GetSiteSettingsAsync();
if (!String.IsNullOrEmpty(siteSettings.SuperUser))
{
try
{
var superUser = await _userService.GetUserByUniqueIdAsync(siteSettings.SuperUser);
if (superUser != null)
{
environment["AdminUserId"] = siteSettings.SuperUser;
environment["AdminUsername"] = superUser.UserName;
}
}
catch
{
_logger.LogWarning("Could not lookup the admin user, user migrations may not have run yet.");
}
}
}
}
}
|
bsd-3-clause
|
C#
|
00e44d0e208c91a032003be0a0989b8c6bd03fb5
|
Add statistics result
|
Camille-Jeong/sowrender,agemor/sowrender,Camille-Jeong/sowrender,agemor/sowrender,Camille-Jeong/sowrender,Camille-Jeong/sowrender,agemor/sowrender,agemor/sowrender,Camille-Jeong/sowrender,agemor/sowrender
|
week2/aurender-tycoon/aurender-tycooon-camille/AurenderTycoonCamille/StatisticsResult.cs
|
week2/aurender-tycoon/aurender-tycooon-camille/AurenderTycoonCamille/StatisticsResult.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AurenderTycoonCamille
{
/**
* This class make statistics with history
*
* @date 2017/01/25
*/
class SalesStatistics
{
/* make statistics with transaction history */
void ExtractSalesStatistics(Dictionary<string, PurchaseData> history)
{
}
}
/**
* This class export statistics csv file
*
* @date 2017/01/25
*/
class ExportWithCsv
{
/* make statistics to csv file */
void MakeCsv()
{
}
/* export file */
void ExportCsv()
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AurenderTycoonCamille
{
class StatisticsResult
{
}
}
|
mit
|
C#
|
a4bf37b86c24969b4771cc40e73fcf143ed38168
|
Fix merge errors
|
smoogipooo/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,default0/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,default0/osu-framework,Tom94/osu-framework,ppy/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework
|
osu.Framework/Properties/AssemblyInfo.cs
|
osu.Framework/Properties/AssemblyInfo.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Runtime.CompilerServices;
using osu.Framework.Testing;
// We publish our internal attributes to other sub-projects of the framework.
// Note, that we omit visual tests as they are meant to test the framework
// behavior "in the wild".
[assembly: InternalsVisibleTo("osu.Framework.Tests")]
[assembly: InternalsVisibleTo(DynamicClassCompiler.DYNAMIC_ASSEMBLY_NAME)]
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Runtime.CompilerServices;
// We publish our internal attributes to other sub-projects of the framework.
// Note, that we omit visual tests as they are meant to test the framework
// behavior "in the wild".
[assembly: InternalsVisibleTo("osu.Framework.Tests")]
[assembly: InternalsVisibleTo(DynamicClassCompiler.DYNAMIC_ASSEMBLY_NAME)]
|
mit
|
C#
|
1fd110590bbba9702f8853efc525d7feadc371b7
|
Update to resolve Issue #16
|
HotcakesCommerce/core,HotcakesCommerce/core,HotcakesCommerce/core
|
Libraries/Hotcakes.Commerce/WebAppSettings.System.cs
|
Libraries/Hotcakes.Commerce/WebAppSettings.System.cs
|
#region License
// Distributed under the MIT License
// ============================================================
// Copyright (c) 2016 Hotcakes Commerce, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#endregion
using System;
using System.Reflection;
namespace Hotcakes.Commerce
{
public partial class WebAppSettings
{
public const string CookieNameSessionGuid = "HotcakesSessionGuid";
public const string CookieNameShoppingSessionGuid = "HotcakesShoppingSessionGuid";
public const string CookieNameLastProductsViewed = "HotcakesLastProductsViewed";
public const string CookieNameAffiliateId = "HotcakesCustomerIDReferrer";
public static Version AppVersion
{
get
{
var type = Type.GetType("Hotcakes.Modules.Core.HotcakesController, Hotcakes.Modules");
return Assembly.GetAssembly(type).GetName().Version;
}
}
public static string SKU
{
get { return string.Empty; }
}
public static string FriendlyAppVersion
{
get { return AppVersion.ToString(3); }
}
public static string FriendlySKU
{
get { return "Pro"; }
}
public static string CookieNameCartIdPaymentPending(long storeId)
{
return "hotcakes-cartid-pendingpayment-" + storeId;
}
public static string CookieNameCartId(long storeId)
{
return "hotcakes-cartid-" + storeId;
}
public static string CookieNameLastCategory(long storeId)
{
return "hotcakes-lastcategory-" + storeId;
}
}
}
|
#region License
// Distributed under the MIT License
// ============================================================
// Copyright (c) 2016 Hotcakes Commerce, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#endregion
using System;
using System.Reflection;
namespace Hotcakes.Commerce
{
public partial class WebAppSettings
{
public const string CookieNameSessionGuid = "HotcakesSessionGuid";
public const string CookieNameShoppingSessionGuid = "HotcakesShoppingSessionGuid";
public const string CookieNameLastProductsViewed = "HotcakesLastProductsViewed";
public const string CookieNameAffiliateId = "HotcakesCustomerIDReferrer";
public static Version AppVersion
{
get
{
var type = Type.GetType("Hotcakes.Modules.Core.HotcakesController, Hotcakes.Modules");
return Assembly.GetAssembly(type).GetName().Version;
}
}
public static string SKU
{
get { return "PRO"; }
}
public static string FriendlyAppVersion
{
get { return AppVersion.ToString(3); }
}
public static string FriendlySKU
{
get { return "Pro"; }
}
public static string CookieNameCartIdPaymentPending(long storeId)
{
return "hotcakes-cartid-pendingpayment-" + storeId;
}
public static string CookieNameCartId(long storeId)
{
return "hotcakes-cartid-" + storeId;
}
public static string CookieNameLastCategory(long storeId)
{
return "hotcakes-lastcategory-" + storeId;
}
}
}
|
mit
|
C#
|
2c339da50e228d205d11fd3e0c4953ed2523dacb
|
Add failing test for append called several times for string identity
|
ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten
|
src/DocumentDbTests/Bugs/Bug_673_multiple_version_assertions.cs
|
src/DocumentDbTests/Bugs/Bug_673_multiple_version_assertions.cs
|
using System;
using Marten.Events;
using Marten.Testing.Harness;
using Xunit;
namespace DocumentDbTests.Bugs
{
public class Bug_673_multiple_version_assertions: IntegrationContext
{
[Fact]
public void replaces_the_max_version_assertion()
{
var streamId = Guid.NewGuid();
using (var session = theStore.OpenSession())
{
session.Events.Append(streamId, new WhateverEvent(), new WhateverEvent());
session.SaveChanges();
}
using (var session = theStore.OpenSession())
{
var state = session.Events.FetchStreamState(streamId);
// ... do some stuff
var expectedVersion = state.Version + 1;
session.Events.Append(streamId, expectedVersion, new WhateverEvent());
// ... do some more stuff
expectedVersion += 1;
session.Events.Append(streamId, expectedVersion, new WhateverEvent());
session.SaveChanges();
}
}
[Fact]
public void replaces_the_max_version_assertion_for_string_identity()
{
UseStreamIdentity(StreamIdentity.AsString);
var streamId = Guid.NewGuid().ToString();
using (var session = theStore.OpenSession())
{
session.Events.Append(streamId, new WhateverEvent(), new WhateverEvent());
session.SaveChanges();
}
using (var session = theStore.OpenSession())
{
var state = session.Events.FetchStreamState(streamId);
// ... do some stuff
var expectedVersion = state.Version + 1;
session.Events.Append(streamId, expectedVersion, new WhateverEvent());
// ... do some more stuff
expectedVersion += 1;
session.Events.Append(streamId, expectedVersion, new WhateverEvent());
session.SaveChanges();
}
}
public Bug_673_multiple_version_assertions(DefaultStoreFixture fixture) : base(fixture)
{
}
}
public class WhateverEvent
{
}
}
|
using System;
using Marten.Testing.Harness;
using Xunit;
namespace DocumentDbTests.Bugs
{
public class Bug_673_multiple_version_assertions: IntegrationContext
{
[Fact]
public void replaces_the_max_version_assertion()
{
var streamId = Guid.NewGuid();
using (var session = theStore.OpenSession())
{
session.Events.Append(streamId, new WhateverEvent(), new WhateverEvent());
session.SaveChanges();
}
using (var session = theStore.OpenSession())
{
var state = session.Events.FetchStreamState(streamId);
// ... do some stuff
var expectedVersion = state.Version + 1;
session.Events.Append(streamId, expectedVersion, new WhateverEvent());
// ... do some more stuff
expectedVersion += 1;
session.Events.Append(streamId, expectedVersion, new WhateverEvent());
session.SaveChanges();
}
}
public Bug_673_multiple_version_assertions(DefaultStoreFixture fixture) : base(fixture)
{
}
}
public class WhateverEvent
{
}
}
|
mit
|
C#
|
90c3a86c031b387d45fae09c15996fd8e3092bd6
|
Remove unused using
|
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.Integration
{
/// <summary>
/// Test helper that manages unique dynamo table-prefixes and cleaning up tables after test runs.
/// </summary>
public class DynamoClientFactory
{
private readonly string _instanceName = Guid.NewGuid().ToString();
public DynamoDB.JobStore CreateTestJobStore()
{
var var = new DynamoDB.JobStore(new TestDynamoBootstrapper());
var.InstanceName = _instanceName;
return var;
}
public AmazonDynamoDBClient BootStrapDynamo()
{
var client = DynamoDbClientFactory.Create();
DynamoConfiguration.InstanceName = _instanceName;
new TestDynamoBootstrapper().BootStrap(client);
return client;
}
public void CleanUpDynamo()
{
using (var client = DynamoDbClientFactory.Create())
{
DynamoConfiguration.InstanceName = _instanceName;
foreach (var table in DynamoConfiguration.AllTableNames)
{
client.DeleteTable(table);
}
}
}
}
}
|
using System;
using System.Net;
using Amazon.DynamoDBv2;
namespace Quartz.DynamoDB.Tests.Integration
{
/// <summary>
/// Test helper that manages unique dynamo table-prefixes and cleaning up tables after test runs.
/// </summary>
public class DynamoClientFactory
{
private readonly string _instanceName = Guid.NewGuid().ToString();
public DynamoDB.JobStore CreateTestJobStore()
{
var var = new DynamoDB.JobStore(new TestDynamoBootstrapper());
var.InstanceName = _instanceName;
return var;
}
public AmazonDynamoDBClient BootStrapDynamo()
{
var client = DynamoDbClientFactory.Create();
DynamoConfiguration.InstanceName = _instanceName;
new TestDynamoBootstrapper().BootStrap(client);
return client;
}
public void CleanUpDynamo()
{
using (var client = DynamoDbClientFactory.Create())
{
DynamoConfiguration.InstanceName = _instanceName;
foreach (var table in DynamoConfiguration.AllTableNames)
{
client.DeleteTable(table);
}
}
}
}
}
|
apache-2.0
|
C#
|
bfec5cd1cd0982d6bc16036b530d95202972f4b6
|
introduce extension point for EntityFormatter initialization
|
BITechnologies/boo,rmboggs/boo,rmartinho/boo,BitPuffin/boo,bamboo/boo,KingJiangNet/boo,Unity-Technologies/boo,KidFashion/boo,bamboo/boo,bamboo/boo,rmboggs/boo,KidFashion/boo,KingJiangNet/boo,BitPuffin/boo,BitPuffin/boo,scottstephens/boo,KingJiangNet/boo,BillHally/boo,Unity-Technologies/boo,KingJiangNet/boo,rmartinho/boo,rmartinho/boo,boo-lang/boo,BitPuffin/boo,hmah/boo,bamboo/boo,hmah/boo,KingJiangNet/boo,boo-lang/boo,rmboggs/boo,scottstephens/boo,KidFashion/boo,BitPuffin/boo,rmboggs/boo,drslump/boo,drslump/boo,rmboggs/boo,wbardzinski/boo,KidFashion/boo,scottstephens/boo,BITechnologies/boo,drslump/boo,wbardzinski/boo,Unity-Technologies/boo,drslump/boo,BitPuffin/boo,KingJiangNet/boo,hmah/boo,wbardzinski/boo,KingJiangNet/boo,boo-lang/boo,scottstephens/boo,boo-lang/boo,BITechnologies/boo,BillHally/boo,wbardzinski/boo,BillHally/boo,rmboggs/boo,bamboo/boo,scottstephens/boo,BillHally/boo,BITechnologies/boo,boo-lang/boo,BitPuffin/boo,rmartinho/boo,BITechnologies/boo,boo-lang/boo,rmartinho/boo,KidFashion/boo,Unity-Technologies/boo,rmboggs/boo,boo-lang/boo,drslump/boo,boo-lang/boo,BillHally/boo,wbardzinski/boo,Unity-Technologies/boo,hmah/boo,Unity-Technologies/boo,BillHally/boo,wbardzinski/boo,KingJiangNet/boo,KidFashion/boo,drslump/boo,BitPuffin/boo,bamboo/boo,scottstephens/boo,wbardzinski/boo,hmah/boo,Unity-Technologies/boo,rmartinho/boo,hmah/boo,rmartinho/boo,hmah/boo,KidFashion/boo,scottstephens/boo,scottstephens/boo,hmah/boo,Unity-Technologies/boo,hmah/boo,BITechnologies/boo,BITechnologies/boo,bamboo/boo,rmboggs/boo,drslump/boo,BITechnologies/boo,wbardzinski/boo,rmartinho/boo,BillHally/boo
|
src/Boo.Lang.Compiler/Steps/InitializeTypeSystemServices.cs
|
src/Boo.Lang.Compiler/Steps/InitializeTypeSystemServices.cs
|
#region license
// Copyright (c) 2004, Rodrigo B. de Oliveira (rbo@acm.org)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Rodrigo B. de Oliveira nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using Boo.Lang.Compiler.TypeSystem;
using Boo.Lang.Compiler.TypeSystem.Generics;
using Boo.Lang.Compiler.TypeSystem.Services;
namespace Boo.Lang.Compiler.Steps
{
public class InitializeTypeSystemServices : AbstractCompilerStep
{
override public void Run()
{
Context.RegisterService<EntityFormatter>(CreateEntityFormatter());
Context.RegisterService<TypeSystemServices>(CreateTypeSystemServices());
Context.RegisterService<CallableResolutionService>(CreateCallableResolutionService());
Context.RegisterService<GenericsServices>(new GenericsServices());
Context.RegisterService<DowncastPermissions>(CreateDowncastPermissions());
}
protected virtual EntityFormatter CreateEntityFormatter()
{
return new EntityFormatter();
}
protected virtual DowncastPermissions CreateDowncastPermissions()
{
return new DowncastPermissions();
}
protected virtual CallableResolutionService CreateCallableResolutionService()
{
return new CallableResolutionService(Context);
}
protected virtual TypeSystemServices CreateTypeSystemServices()
{
return new TypeSystem.TypeSystemServices(Context);
}
}
}
|
#region license
// Copyright (c) 2004, Rodrigo B. de Oliveira (rbo@acm.org)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Rodrigo B. de Oliveira nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using Boo.Lang.Compiler.TypeSystem;
using Boo.Lang.Compiler.TypeSystem.Generics;
using Boo.Lang.Compiler.TypeSystem.Services;
namespace Boo.Lang.Compiler.Steps
{
public class InitializeTypeSystemServices : AbstractCompilerStep
{
override public void Run()
{
Context.RegisterService<TypeSystemServices>(CreateTypeSystemServices());
Context.RegisterService<CallableResolutionService>(CreateCallableResolutionService());
Context.RegisterService<GenericsServices>(new GenericsServices());
Context.RegisterService<DowncastPermissions>(CreateDowncastPermissions());
}
protected virtual DowncastPermissions CreateDowncastPermissions()
{
return new DowncastPermissions();
}
protected virtual CallableResolutionService CreateCallableResolutionService()
{
return new CallableResolutionService(Context);
}
protected virtual TypeSystemServices CreateTypeSystemServices()
{
return new TypeSystem.TypeSystemServices(Context);
}
}
}
|
bsd-3-clause
|
C#
|
2cce76d72e6099d7aba771e0193f9d46b8cde631
|
Fix refactoring provider to correctly handle positions near EOF
|
terrajobst/nquery-vnext
|
src/NQuery.Authoring/CodeActions/CodeRefactoringProvider.cs
|
src/NQuery.Authoring/CodeActions/CodeRefactoringProvider.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace NQuery.Authoring.CodeActions
{
public abstract class CodeRefactoringProvider<T> : ICodeRefactoringProvider
where T : SyntaxNode
{
public IEnumerable<ICodeAction> GetRefactorings(SemanticModel semanticModel, int position)
{
var syntaxTree = semanticModel.Compilation.SyntaxTree;
return from t in syntaxTree.Root.FindStartTokens(position)
from n in t.Parent.AncestorsAndSelf().OfType<T>()
from r in GetRefactorings(semanticModel, position, n)
select r;
}
protected abstract IEnumerable<ICodeAction> GetRefactorings(SemanticModel semanticModel, int position, T node);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace NQuery.Authoring.CodeActions
{
public abstract class CodeRefactoringProvider<T> : ICodeRefactoringProvider
where T : SyntaxNode
{
public IEnumerable<ICodeAction> GetRefactorings(SemanticModel semanticModel, int position)
{
var syntaxTree = semanticModel.Compilation.SyntaxTree;
var syntaxToken = syntaxTree.Root.FindToken(position);
var synaxNodes = syntaxToken.Parent.AncestorsAndSelf().OfType<T>();
return synaxNodes.SelectMany(n => GetRefactorings(semanticModel, position, n));
}
protected abstract IEnumerable<ICodeAction> GetRefactorings(SemanticModel semanticModel, int position, T node);
}
}
|
mit
|
C#
|
36830e48504489b14f4ec0eaf49a555cfe3634cc
|
remove c# 9
|
abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS
|
src/Umbraco.Web.BackOffice/Security/AutoLinkSignInResult.cs
|
src/Umbraco.Web.BackOffice/Security/AutoLinkSignInResult.cs
|
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Web.Common.Security
{
public class AutoLinkSignInResult : SignInResult
{
public static AutoLinkSignInResult FailedNotLinked = new AutoLinkSignInResult()
{
Succeeded = false
};
public static AutoLinkSignInResult FailedNoEmail = new AutoLinkSignInResult()
{
Succeeded = false
};
public static AutoLinkSignInResult FailedException(string error) => new(new[] { error })
{
Succeeded = false
};
public static AutoLinkSignInResult FailedCreatingUser(IReadOnlyCollection<string> errors) => new(errors)
{
Succeeded = false
};
public static AutoLinkSignInResult FailedLinkingUser(IReadOnlyCollection<string> errors) => new(errors)
{
Succeeded = false
};
public AutoLinkSignInResult(IReadOnlyCollection<string> errors)
{
Errors = errors ?? throw new ArgumentNullException(nameof(errors));
}
public AutoLinkSignInResult()
{
}
public IReadOnlyCollection<string> Errors { get; } = Array.Empty<string>();
}
}
|
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Web.Common.Security
{
public class AutoLinkSignInResult : SignInResult
{
public static AutoLinkSignInResult FailedNotLinked = new()
{
Succeeded = false
};
public static AutoLinkSignInResult FailedNoEmail = new()
{
Succeeded = false
};
public static AutoLinkSignInResult FailedException(string error) => new(new[] { error })
{
Succeeded = false
};
public static AutoLinkSignInResult FailedCreatingUser(IReadOnlyCollection<string> errors) => new(errors)
{
Succeeded = false
};
public static AutoLinkSignInResult FailedLinkingUser(IReadOnlyCollection<string> errors) => new(errors)
{
Succeeded = false
};
public AutoLinkSignInResult(IReadOnlyCollection<string> errors)
{
Errors = errors ?? throw new ArgumentNullException(nameof(errors));
}
public AutoLinkSignInResult()
{
}
public IReadOnlyCollection<string> Errors { get; } = Array.Empty<string>();
}
}
|
mit
|
C#
|
05911072d30f6f2456ea1b640850a7623b35d6e2
|
Test stability
|
AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS
|
src/Windows/Markdown/Editor/Test/Preview/BrowserViewTest.cs
|
src/Windows/Markdown/Editor/Test/Preview/BrowserViewTest.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Common.Core.IO;
using Microsoft.Common.Core.Test.Fakes.Shell;
using Microsoft.Markdown.Editor.Preview.Browser;
using Microsoft.UnitTests.Core.Threading;
using Microsoft.UnitTests.Core.XUnit;
using Microsoft.VisualStudio.Text;
using mshtml;
using NSubstitute;
namespace Microsoft.Markdown.Editor.Test.Preview {
[ExcludeFromCodeCoverage]
[Category.Md.Preview]
public sealed class BrowserViewTest {
private readonly BrowserView _browser;
public BrowserViewTest() {
var shell = TestCoreShell.CreateSubstitute();
shell.SetupSettingsSubstitute();
shell.SetupSessionSubstitute();
shell.ServiceManager.RemoveService(shell.ServiceManager.GetService<IFileSystem>());
shell.ServiceManager.AddService(new FileSystem());
_browser = new BrowserView("file", shell.Services);
}
[Test(ThreadType = ThreadType.UI)]
public void Update() {
const string interactive = "interactive";
var snapshot = Substitute.For<ITextSnapshot>();
snapshot.GetText().Returns("Text **bold** text");
_browser.UpdateBrowser(snapshot);
var htmlDocument = (HTMLDocument)_browser.Control.Document;
var ready = htmlDocument.readyState == interactive;
for (var i = 0; i < 20 && !ready; i++) {
ready = htmlDocument.readyState == interactive;
UIThreadHelper.Instance.DoEvents(100);
}
ready.Should().BeTrue();
var element = htmlDocument.getElementById("___markdown-content___");
var innerHtml = element.innerHTML.Trim();
innerHtml.Should().Be("<p id=\"pragma-line-0\">Text <strong>bold</strong> text</p>");
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Common.Core.IO;
using Microsoft.Common.Core.Test.Fakes.Shell;
using Microsoft.Markdown.Editor.Preview.Browser;
using Microsoft.UnitTests.Core.Threading;
using Microsoft.UnitTests.Core.XUnit;
using Microsoft.VisualStudio.Text;
using mshtml;
using NSubstitute;
namespace Microsoft.Markdown.Editor.Test.Preview {
[ExcludeFromCodeCoverage]
[Category.Md.Preview]
public sealed class BrowserViewTest {
private readonly BrowserView _browser;
public BrowserViewTest() {
var shell = TestCoreShell.CreateSubstitute();
shell.SetupSettingsSubstitute();
shell.SetupSessionSubstitute();
shell.ServiceManager.RemoveService(shell.ServiceManager.GetService<IFileSystem>());
shell.ServiceManager.AddService(new FileSystem());
_browser = new BrowserView("file", shell.Services);
}
[Test(ThreadType = ThreadType.UI)]
public void Update() {
var snapshot = Substitute.For<ITextSnapshot>();
snapshot.GetText().Returns("Text **bold** text");
_browser.UpdateBrowser(snapshot);
UIThreadHelper.Instance.DoEvents(1000);
var htmlDocument = (HTMLDocument)_browser.Control.Document;
var element = htmlDocument.getElementById("___markdown-content___");
var innerHtml = element.innerHTML.Trim();
innerHtml.Should().Be("<p>Text <strong>bold</strong> text</p>");
}
}
}
|
mit
|
C#
|
7cc750fa234a902462a0b66a5faf72d4a0fee0ad
|
Fix build for no span support
|
MetacoSA/NBitcoin,MetacoSA/NBitcoin
|
NBitcoin.Tests/AssertEx.cs
|
NBitcoin.Tests/AssertEx.cs
|
using NBitcoin.Crypto;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace NBitcoin.Tests
{
class AssertEx
{
[DebuggerHidden]
internal static void Error(string msg)
{
Assert.False(true, msg);
}
[DebuggerHidden]
internal static void Equal<T>(T actual, T expected)
{
Assert.Equal(expected, actual);
}
[DebuggerHidden]
internal static void CollectionEquals<T>(T[] actual, T[] expected)
{
if (actual.Length != expected.Length)
Assert.False(true, "Actual.Length(" + actual.Length + ") != Expected.Length(" + expected.Length + ")");
for (int i = 0; i < actual.Length; i++)
{
if (!Object.Equals(actual[i], expected[i]))
Assert.False(true, "Actual[" + i + "](" + actual[i] + ") != Expected[" + i + "](" + expected[i] + ")");
}
}
[DebuggerHidden]
internal static void StackEquals(ContextStack<byte[]> stack1, ContextStack<byte[]> stack2)
{
var hash1 = stack1.Select(o => Hashes.DoubleSHA256(o)).ToArray();
var hash2 = stack2.Select(o => Hashes.DoubleSHA256(o)).ToArray();
AssertEx.CollectionEquals(hash1, hash2);
}
#if HAS_SPAN
[DebuggerHidden]
internal static void EqualBytes(ReadOnlySpan<byte> expected, ReadOnlySpan<byte> actual)
{
var aa = DataEncoders.Encoders.Hex.EncodeData(expected);
var bb = DataEncoders.Encoders.Hex.EncodeData(actual);
Assert.Equal(aa, bb);
}
[DebuggerHidden]
internal static void EqualBytes(string expected, ReadOnlySpan<byte> actual)
{
var bb = DataEncoders.Encoders.Hex.EncodeData(actual);
Assert.Equal(expected.ToLowerInvariant(), bb);
}
[DebuggerHidden]
internal static void EqualBytes(ReadOnlySpan<byte> expected, string actual)
{
var aa = DataEncoders.Encoders.Hex.EncodeData(expected);
Assert.Equal(aa, actual.ToLowerInvariant());
}
#endif
}
}
|
using NBitcoin.Crypto;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace NBitcoin.Tests
{
class AssertEx
{
[DebuggerHidden]
internal static void Error(string msg)
{
Assert.False(true, msg);
}
[DebuggerHidden]
internal static void Equal<T>(T actual, T expected)
{
Assert.Equal(expected, actual);
}
[DebuggerHidden]
internal static void CollectionEquals<T>(T[] actual, T[] expected)
{
if (actual.Length != expected.Length)
Assert.False(true, "Actual.Length(" + actual.Length + ") != Expected.Length(" + expected.Length + ")");
for (int i = 0; i < actual.Length; i++)
{
if (!Object.Equals(actual[i], expected[i]))
Assert.False(true, "Actual[" + i + "](" + actual[i] + ") != Expected[" + i + "](" + expected[i] + ")");
}
}
[DebuggerHidden]
internal static void StackEquals(ContextStack<byte[]> stack1, ContextStack<byte[]> stack2)
{
var hash1 = stack1.Select(o => Hashes.DoubleSHA256(o)).ToArray();
var hash2 = stack2.Select(o => Hashes.DoubleSHA256(o)).ToArray();
AssertEx.CollectionEquals(hash1, hash2);
}
[DebuggerHidden]
internal static void EqualBytes(ReadOnlySpan<byte> expected, ReadOnlySpan<byte> actual)
{
var aa = DataEncoders.Encoders.Hex.EncodeData(expected);
var bb = DataEncoders.Encoders.Hex.EncodeData(actual);
Assert.Equal(aa, bb);
}
[DebuggerHidden]
internal static void EqualBytes(string expected, ReadOnlySpan<byte> actual)
{
var bb = DataEncoders.Encoders.Hex.EncodeData(actual);
Assert.Equal(expected.ToLowerInvariant(), bb);
}
[DebuggerHidden]
internal static void EqualBytes(ReadOnlySpan<byte> expected, string actual)
{
var aa = DataEncoders.Encoders.Hex.EncodeData(expected);
Assert.Equal(aa, actual.ToLowerInvariant());
}
}
}
|
mit
|
C#
|
fa348a338ec1f722ce44c3bfe3b5461b0cf5e4fb
|
Increase connect timeout for Functional Tests (#39559)
|
BrennanConroy/corefx,BrennanConroy/corefx,BrennanConroy/corefx
|
src/System.Data.SqlClient/tests/FunctionalTests/TestTdsServer.cs
|
src/System.Data.SqlClient/tests/FunctionalTests/TestTdsServer.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 Microsoft.SqlServer.TDS.EndPoint;
using Microsoft.SqlServer.TDS.Servers;
using System.Net;
using System.Runtime.CompilerServices;
namespace System.Data.SqlClient.Tests
{
internal class TestTdsServer : GenericTDSServer, IDisposable
{
private TDSServerEndPoint _endpoint = null;
private SqlConnectionStringBuilder connectionStringBuilder;
public TestTdsServer(TDSServerArguments args) : base(args) { }
public TestTdsServer(QueryEngine engine, TDSServerArguments args) : base(args)
{
this.Engine = engine;
}
public static TestTdsServer StartServerWithQueryEngine(QueryEngine engine, bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "")
{
TDSServerArguments args = new TDSServerArguments()
{
Log = enableLog ? Console.Out : null,
};
if (enableFedAuth)
{
args.FedAuthRequiredPreLoginOption = Microsoft.SqlServer.TDS.PreLogin.TdsPreLoginFedAuthRequiredOption.FedAuthRequired;
}
TestTdsServer server = engine == null ? new TestTdsServer(args) : new TestTdsServer(engine, args);
server._endpoint = new TDSServerEndPoint(server) { ServerEndPoint = new IPEndPoint(IPAddress.Any, 0) };
server._endpoint.EndpointName = methodName;
// The server EventLog should be enabled as it logs the exceptions.
server._endpoint.EventLog = Console.Out;
server._endpoint.Start();
int port = server._endpoint.ServerEndPoint.Port;
server.connectionStringBuilder = new SqlConnectionStringBuilder() { DataSource = "localhost," + port, ConnectTimeout = 30, Encrypt = false };
server.ConnectionString = server.connectionStringBuilder.ConnectionString;
return server;
}
public static TestTdsServer StartTestServer(bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "")
{
return StartServerWithQueryEngine(null, false, false, methodName);
}
public void Dispose() => _endpoint?.Stop();
public string ConnectionString { get; private set; }
}
}
|
// 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 Microsoft.SqlServer.TDS.EndPoint;
using Microsoft.SqlServer.TDS.Servers;
using System.Net;
using System.Runtime.CompilerServices;
namespace System.Data.SqlClient.Tests
{
internal class TestTdsServer : GenericTDSServer, IDisposable
{
private TDSServerEndPoint _endpoint = null;
private SqlConnectionStringBuilder connectionStringBuilder;
public TestTdsServer(TDSServerArguments args) : base(args) { }
public TestTdsServer(QueryEngine engine, TDSServerArguments args) : base(args)
{
this.Engine = engine;
}
public static TestTdsServer StartServerWithQueryEngine(QueryEngine engine, bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "")
{
TDSServerArguments args = new TDSServerArguments()
{
Log = enableLog ? Console.Out : null,
};
if (enableFedAuth)
{
args.FedAuthRequiredPreLoginOption = Microsoft.SqlServer.TDS.PreLogin.TdsPreLoginFedAuthRequiredOption.FedAuthRequired;
}
TestTdsServer server = engine == null ? new TestTdsServer(args) : new TestTdsServer(engine, args);
server._endpoint = new TDSServerEndPoint(server) { ServerEndPoint = new IPEndPoint(IPAddress.Any, 0) };
server._endpoint.EndpointName = methodName;
// The server EventLog should be enabled as it logs the exceptions.
server._endpoint.EventLog = Console.Out;
server._endpoint.Start();
int port = server._endpoint.ServerEndPoint.Port;
server.connectionStringBuilder = new SqlConnectionStringBuilder() { DataSource = "localhost," + port, ConnectTimeout = 5, Encrypt = false };
server.ConnectionString = server.connectionStringBuilder.ConnectionString;
return server;
}
public static TestTdsServer StartTestServer(bool enableFedAuth = false, bool enableLog = false, [CallerMemberName] string methodName = "")
{
return StartServerWithQueryEngine(null, false, false, methodName);
}
public void Dispose() => _endpoint?.Stop();
public string ConnectionString { get; private set; }
}
}
|
mit
|
C#
|
00a5df7ac58493edd61277d43c5fc3d9e65f9d85
|
Update TextString.cshtml (#9535)
|
JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,madsoulswe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,bjarnef/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,mattbrailsford/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS
|
src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml
|
src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml
|
@model dynamic
@using Umbraco.Web.Composing
@using Umbraco.Web.Templates
@if (Model.editor.config.markup != null)
{
string markup = Model.editor.config.markup.ToString();
markup = markup.Replace("#value#", Html.ReplaceLineBreaks((string)Model.value.ToString()).ToString());
if (Model.editor.config.style != null)
{
markup = markup.Replace("#style#", Model.editor.config.style.ToString());
}
<text>
@Html.Raw(markup)
</text>
}
else
{
<text>
<div style="@Model.editor.config.style">@Model.value</div>
</text>
}
|
@model dynamic
@using Umbraco.Web.Composing
@using Umbraco.Web.Templates
@if (Model.editor.config.markup != null)
{
string markup = Model.editor.config.markup.ToString();
markup = markup.Replace("#value#", Html.ReplaceLineBreaksForHtml(HttpUtility.HtmlEncode((string)Model.value.ToString())).ToString());
if (Model.editor.config.style != null)
{
markup = markup.Replace("#style#", Model.editor.config.style.ToString());
}
<text>
@Html.Raw(markup)
</text>
}
else
{
<text>
<div style="@Model.editor.config.style">@Model.value</div>
</text>
}
|
mit
|
C#
|
715776771a6904c64303bee298afe98adf03d3f5
|
Fix deserialization of RegEx enabled properties
|
kjac/Archetype,imulus/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype,tomfulton/Archetype,kgiszewski/Archetype,kipusoep/Archetype,imulus/Archetype,kipusoep/Archetype,tomfulton/Archetype,tomfulton/Archetype,kipusoep/Archetype,kjac/Archetype,Nicholas-Westby/Archetype,kjac/Archetype,imulus/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype
|
app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValueProperty.cs
|
app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValueProperty.cs
|
using System;
using Newtonsoft.Json;
namespace Archetype.Models
{
public class ArchetypePreValueProperty
{
[JsonProperty("alias")]
public string Alias { get; set; }
[JsonProperty("remove")]
public bool Remove { get; set; }
[JsonProperty("collapse")]
public bool Collapse { get; set; }
[JsonProperty("label")]
public string Label { get; set; }
[JsonProperty("helpText")]
public string HelpText { get; set; }
[JsonProperty("dataTypeGuid")]
public Guid DataTypeGuid { get; set; }
[JsonProperty("propertyEditorAlias")]
public string PropertyEditorAlias { get; set; }
[JsonProperty("value")]
public string Value { get; set; }
[JsonProperty("required")]
public bool Required { get; set; }
[JsonProperty("regEx")]
public string RegEx { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
namespace Archetype.Models
{
public class ArchetypePreValueProperty
{
[JsonProperty("alias")]
public string Alias { get; set; }
[JsonProperty("remove")]
public bool Remove { get; set; }
[JsonProperty("collapse")]
public bool Collapse { get; set; }
[JsonProperty("label")]
public string Label { get; set; }
[JsonProperty("helpText")]
public string HelpText { get; set; }
[JsonProperty("dataTypeGuid")]
public Guid DataTypeGuid { get; set; }
[JsonProperty("propertyEditorAlias")]
public string PropertyEditorAlias { get; set; }
[JsonProperty("value")]
public string Value { get; set; }
[JsonProperty("required")]
public bool Required { get; set; }
[JsonProperty("regEx")]
public bool RegEx { get; set; }
}
}
|
mit
|
C#
|
436b9b25f4ff9a41c16d7d177fe5d9a4d3d2a78a
|
Fix msbuild failure generating targets file
|
mhutch/MonoDevelop.AddinMaker,mhutch/MonoDevelop.AddinMaker
|
MonoDevelop.Addins.Tasks/GenerateDependencyAttributes.cs
|
MonoDevelop.Addins.Tasks/GenerateDependencyAttributes.cs
|
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace MonoDevelop.Addins.Tasks
{
public class GenerateDependencyAttributes : Task
{
[Required]
public string Language { get; set; }
[Required]
public string Filename { get; set; }
[Output]
public ITaskItem[] AddinReferences { get; set; }
public override bool Execute ()
{
var provider = CodeDomProvider.CreateProvider (Language);
if (provider == null) {
Log.LogError ("Could not create CodeDOM provider for language '{0}'", Language);
return false;
}
var ccu = new CodeCompileUnit ();
foreach (var addin in AddinReferences) {
//assembly:Mono.Addins.AddinDependency ("::%(Identity)", MonoDevelop.BuildInfo.Version)]
ccu.AssemblyCustomAttributes.Add (
new CodeAttributeDeclaration (
new CodeTypeReference ("Mono.Addins.AddinDependencyAttribute"),
new [] {
new CodeAttributeArgument (new CodePrimitiveExpression ("::" + addin.ItemSpec)),
new CodeAttributeArgument (new CodePrimitiveExpression (addin.GetMetadata ("Version")))
}
)
);
}
Directory.CreateDirectory (Path.GetDirectoryName (Filename));
using (var sw = new StreamWriter (Filename)) {
provider.GenerateCodeFromCompileUnit (ccu, sw, new CodeGeneratorOptions ());
}
return true;
}
}
}
|
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace MonoDevelop.Addins.Tasks
{
public class GenerateDependencyAttributes : Task
{
[Required]
public string Language { get; set; }
[Required]
public string Filename { get; set; }
[Output]
public ITaskItem[] AddinReferences { get; set; }
public override bool Execute ()
{
var provider = System.CodeDom.Compiler.CodeDomProvider.CreateProvider (Language);
if (provider == null) {
Log.LogError ("Could not create CodeDOM provider for language '{0}'", Language);
return false;
}
var ccu = new CodeCompileUnit ();
foreach (var addin in AddinReferences) {
//assembly:Mono.Addins.AddinDependency ("::%(Identity)", MonoDevelop.BuildInfo.Version)]
ccu.AssemblyCustomAttributes.Add (
new CodeAttributeDeclaration (
new CodeTypeReference ("Mono.Addins.AddinDependencyAttribute"),
new [] {
new CodeAttributeArgument (new CodePrimitiveExpression ("::" + addin.ItemSpec)),
new CodeAttributeArgument (new CodePrimitiveExpression (addin.GetMetadata ("Version")))
}
)
);
}
Directory.CreateDirectory (Path.GetDirectoryName (Filename));
using (var sw = new StreamWriter (Filename)) {
provider.GenerateCodeFromCompileUnit (ccu, sw, new CodeGeneratorOptions ());
}
return false;
}
}
}
|
mit
|
C#
|
3e05c00e1fbf689e94096c9aed4406db27bb5c0b
|
fix typo
|
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
|
NunitUpgrade/NunitUpgrade/MyBizLogic/CalculatorMethod.cs
|
NunitUpgrade/NunitUpgrade/MyBizLogic/CalculatorMethod.cs
|
namespace MyBizLogic
{
public enum CalculatorMethod
{
Basic = 0,
Extended = 1
}
}
|
namespace MyBizLogic
{
public enum CalculatorMethod
{
Baic = 0,
Extended = 1
}
}
|
apache-2.0
|
C#
|
8acdf2ec5c00a4851982b8e408782248adfa49e6
|
Bump version
|
Naxiz/TeleBotDotNet,LouisMT/TeleBotDotNet
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TeleBotDotNet")]
[assembly: AssemblyDescription("Telegram Bot API wrapper for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("U5R")]
[assembly: AssemblyProduct("TeleBotDotNet")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bdc2c81d-c3e9-40b1-8b21-69796411ad56")]
// 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("2015.10.18.1")]
[assembly: AssemblyFileVersion("2015.10.18.1")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TeleBotDotNet")]
[assembly: AssemblyDescription("Telegram Bot API wrapper for .NET")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("U5R")]
[assembly: AssemblyProduct("TeleBotDotNet")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bdc2c81d-c3e9-40b1-8b21-69796411ad56")]
// 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("2015.10.13.2")]
[assembly: AssemblyFileVersion("2015.10.13.2")]
|
mit
|
C#
|
745e33bdb3f7c44ec91f58e3b08ed1496da0d95d
|
Set version to 0.13.
|
xanotech/.net-XRepository
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("XRepository: ORM Through Repository Pattern")]
[assembly: AssemblyCompany("Xanotech LLC")]
[assembly: AssemblyCopyright("© 2017 Xanotech LLC")]
[assembly: AssemblyProduct("XRepository")]
[assembly: AssemblyFileVersion("0.13")]
[assembly: AssemblyVersion("0.13")]
|
using System.Reflection;
[assembly: AssemblyTitle("XRepository: ORM Through Repository Pattern")]
[assembly: AssemblyCompany("Xanotech LLC")]
[assembly: AssemblyCopyright("© 2016 Xanotech LLC")]
[assembly: AssemblyProduct("XRepository")]
[assembly: AssemblyFileVersion("0.12")]
[assembly: AssemblyVersion("0.12")]
|
mit
|
C#
|
e3753ae29fb88c1aec22896abf4bdcd54df6ded6
|
Make the easy mod's extra life count customizable
|
peppy/osu-new,smoogipoo/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu,ppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,UselessToucan/osu,smoogipooo/osu,johnneijzen/osu,EVAST9919/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,2yangk23/osu,smoogipoo/osu
|
osu.Game/Rulesets/Mods/ModEasy.cs
|
osu.Game/Rulesets/Mods/ModEasy.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;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToScoreProcessor
{
public override string Name => "Easy";
public override string Acronym => "EZ";
public override IconUsage Icon => OsuIcon.ModEasy;
public override ModType Type => ModType.DifficultyReduction;
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
[SettingSource("Extra Lives", "Number of extra lives")]
public Bindable<int> Retries { get; } = new BindableInt(2)
{
MinValue = 0,
MaxValue = 10
};
private int retries;
private BindableNumber<double> health;
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
retries = Retries.Value;
}
public bool AllowFail
{
get
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
}
}
public bool RestartOnFail => false;
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
health = scoreProcessor.Health.GetBoundCopy();
}
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
}
}
|
// 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;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToScoreProcessor
{
public override string Name => "Easy";
public override string Acronym => "EZ";
public override IconUsage Icon => OsuIcon.ModEasy;
public override ModType Type => ModType.DifficultyReduction;
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
private int retries = 2;
private BindableNumber<double> health;
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
}
public bool AllowFail
{
get
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
}
}
public bool RestartOnFail => false;
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
health = scoreProcessor.Health.GetBoundCopy();
}
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
}
}
|
mit
|
C#
|
6142f3b5dea190feb09d800baab9f0e1384d507d
|
Rename UShort to UShortField
|
laicasaane/VFW
|
Assets/Plugins/Editor/Vexe/GUIs/BaseGUI/Controls/UShorts.cs
|
Assets/Plugins/Editor/Vexe/GUIs/BaseGUI/Controls/UShorts.cs
|
using UnityEngine;
namespace Vexe.Editor.GUIs
{
public abstract partial class BaseGUI
{
public ushort UShortField(ushort value)
{
return UShortField(string.Empty, value);
}
public ushort UShortField(string label, ushort value)
{
return UShortField(label, value, null);
}
public ushort UShortField(string label, string tooltip, ushort value)
{
return UShortField(label, tooltip, value, null);
}
public ushort UShortField(string label, ushort value, Layout option)
{
return UShortField(label, string.Empty, value, option);
}
public ushort UShortField(string label, string tooltip, ushort value, Layout option)
{
return UShortField(GetContent(label, tooltip), value, option);
}
public abstract ushort UShortField(GUIContent content, ushort value, Layout option);
}
}
|
using UnityEngine;
namespace Vexe.Editor.GUIs
{
public abstract partial class BaseGUI
{
public ushort UShort(ushort value)
{
return UShort(string.Empty, value);
}
public ushort UShort(string label, ushort value)
{
return UShort(label, value, null);
}
public ushort UShort(string label, string tooltip, ushort value)
{
return UShort(label, tooltip, value, null);
}
public ushort UShort(string label, ushort value, Layout option)
{
return UShort(label, string.Empty, value, option);
}
public ushort UShort(string label, string tooltip, ushort value, Layout option)
{
return UShort(GetContent(label, tooltip), value, option);
}
public abstract ushort UShort(GUIContent content, ushort value, Layout option);
}
}
|
mit
|
C#
|
55fded58023f090ca5c9516e950130fffab9a157
|
support skinned mesh renderers in toggle model
|
virror/VRTK,nmccarty/htvr,thacio/SteamVR_Unity_Toolkit,mbbmbbmm/SteamVR_Unity_Toolkit,mattboy64/SteamVR_Unity_Toolkit,gpvigano/VRTK,jcrombez/SteamVR_Unity_Toolkit,Innoactive/IA-unity-VR-toolkit-VRTK,Fulby/VRTK,mimminito/SteamVR_Unity_Toolkit,adamjweaver/VRTK,bengolds/SteamVR_Unity_Toolkit,pargee/SteamVR_Unity_Toolkit,Frostlock/SteamVR_Unity_Toolkit,gomez-addams/SteamVR_Unity_Toolkit,phr00t/SteamVR_Unity_Toolkit,red-horizon/VRTK,gpvigano/SteamVR_Unity_Toolkit,thestonefox/VRTK,thestonefox/SteamVR_Unity_Toolkit,Blueteak/SteamVR_Unity_Toolkit,TMaloteaux/SteamVR_Unity_Toolkit
|
Assets/SteamVR_Unity_Toolkit/Scripts/SteamVR_ControllerActions.cs
|
Assets/SteamVR_Unity_Toolkit/Scripts/SteamVR_ControllerActions.cs
|
using UnityEngine;
using System.Collections;
public class SteamVR_ControllerActions : MonoBehaviour {
private bool controllerVisible = true;
private ushort hapticPulseStrength;
private int hapticPulseCountdown;
private uint controllerIndex;
private SteamVR_TrackedObject trackedController;
private SteamVR_Controller.Device device;
private ushort maxHapticVibration = 3999;
public bool IsControllerVisible()
{
return controllerVisible;
}
public void ToggleControllerModel(bool on)
{
foreach (MeshRenderer renderer in this.GetComponentsInChildren<MeshRenderer>())
{
renderer.enabled = on;
}
foreach (SkinnedMeshRenderer renderer in this.GetComponentsInChildren<SkinnedMeshRenderer>())
{
renderer.enabled = on;
}
controllerVisible = on;
}
public void TriggerHapticPulse(int duration, ushort strength)
{
hapticPulseCountdown = duration;
hapticPulseStrength = (strength <= maxHapticVibration ? strength : maxHapticVibration);
}
private void Awake()
{
trackedController = GetComponent<SteamVR_TrackedObject>();
}
private void Update()
{
controllerIndex = (uint)trackedController.index;
device = SteamVR_Controller.Input((int)controllerIndex);
if (hapticPulseCountdown > 0)
{
device.TriggerHapticPulse(hapticPulseStrength);
hapticPulseCountdown -= 1;
}
}
}
|
using UnityEngine;
using System.Collections;
public class SteamVR_ControllerActions : MonoBehaviour {
private bool controllerVisible = true;
private ushort hapticPulseStrength;
private int hapticPulseCountdown;
private uint controllerIndex;
private SteamVR_TrackedObject trackedController;
private SteamVR_Controller.Device device;
private ushort maxHapticVibration = 3999;
public bool IsControllerVisible()
{
return controllerVisible;
}
public void ToggleControllerModel(bool on)
{
foreach (MeshRenderer renderer in this.GetComponentsInChildren<MeshRenderer>())
{
renderer.enabled = on;
}
controllerVisible = on;
}
public void TriggerHapticPulse(int duration, ushort strength)
{
hapticPulseCountdown = duration;
hapticPulseStrength = (strength <= maxHapticVibration ? strength : maxHapticVibration);
}
private void Awake()
{
trackedController = GetComponent<SteamVR_TrackedObject>();
}
private void Update()
{
controllerIndex = (uint)trackedController.index;
device = SteamVR_Controller.Input((int)controllerIndex);
if (hapticPulseCountdown > 0)
{
device.TriggerHapticPulse(hapticPulseStrength);
hapticPulseCountdown -= 1;
}
}
}
|
mit
|
C#
|
872e4ae6610cf38d0182085f0fac797f88cec073
|
Update CopyChart.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
|
Examples/CSharp/Articles/CopyShapesBetweenWorksheets/CopyChart.cs
|
Examples/CSharp/Articles/CopyShapesBetweenWorksheets/CopyChart.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.CopyShapesBetweenWorksheets
{
public class CopyChart
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a workbook object
//Open the template file
Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx");
//Get the Chart from the "Chart" worksheet.
Aspose.Cells.Charts.Chart source = workbook.Worksheets["Sheet2"].Charts[0];
Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;
//Copy the Chart to the Result Worksheet
workbook.Worksheets["Sheet3"].Shapes.AddCopy(cshape, 20, 0, 2, 0);
//Save the Worksheet
workbook.Save(dataDir+ "Shapes.out.xlsx");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.CopyShapesBetweenWorksheets
{
public class CopyChart
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a workbook object
//Open the template file
Workbook workbook = new Workbook(dataDir+ "aspose-sample.xlsx");
//Get the Chart from the "Chart" worksheet.
Aspose.Cells.Charts.Chart source = workbook.Worksheets["Sheet2"].Charts[0];
Aspose.Cells.Drawing.ChartShape cshape = source.ChartObject;
//Copy the Chart to the Result Worksheet
workbook.Worksheets["Sheet3"].Shapes.AddCopy(cshape, 20, 0, 2, 0);
//Save the Worksheet
workbook.Save(dataDir+ "Shapes.out.xlsx");
}
}
}
|
mit
|
C#
|
4723edb47e80d029ccd4625a2effce23819fe433
|
add more default types to block
|
gigya/microdot
|
Gigya.Microdot.SharedLogic/Configurations/SerializationSecurity.cs
|
Gigya.Microdot.SharedLogic/Configurations/SerializationSecurity.cs
|
using Gigya.Microdot.Interfaces.Configuration;
namespace Gigya.Microdot.SharedLogic.Configurations
{
[ConfigurationRoot("Microdot.SerializationSecurity", RootStrategy.ReplaceClassNameWithPath)]
public class MicrodotSerializationSecurityConfig : IConfigObject
{
public string DeserializationForbiddenTypes = "System.Windows.Data.ObjectDataProvider,System.Diagnostics.Process,System.Configuration.Install.AssemblyInstaller,System.Activities.PresentationWorkflowDesigner,System.Windows.ResourceDictionary,System.Windows.Forms.BindingSource,Microsoft.Exchange.Management.SystemManager.WinForms.ExchangeSettingsProvider";
}
}
|
using Gigya.Microdot.Interfaces.Configuration;
namespace Gigya.Microdot.SharedLogic.Configurations
{
[ConfigurationRoot("Microdot.SerializationSecurity", RootStrategy.ReplaceClassNameWithPath)]
public class MicrodotSerializationSecurityConfig : IConfigObject
{
public string DeserializationForbiddenTypes = "System.Windows.Data.ObjectDataProvider,System.Diagnostics.Process";
}
}
|
apache-2.0
|
C#
|
d1c84b8b6ec6b01c7d2175aeaea270a121db1224
|
Fix en dashboard. Uso de la clase de configuracion.
|
jmirancid/TropicalNet.Topppro,jmirancid/TropicalNet.Topppro,jmirancid/TropicalNet.Topppro
|
Topppro.WebSite/Areas/Humanist/Controllers/DashboardController.cs
|
Topppro.WebSite/Areas/Humanist/Controllers/DashboardController.cs
|
using System.IO;
using System.Linq;
using System.Web.Helpers;
using System.Web.Mvc;
using Topppro.WebSite.Areas.Humanist.Models;
using Topppro.WebSite.Settings;
namespace Topppro.WebSite.Areas.Humanist.Controllers
{
[Authorize]
public class DashboardController : Controller
{
public ActionResult Index()
{
var key = typeof(DownloadSettings).Name;
var cached = WebCache.Get(key);
if (cached == null)
{
string dlc_path =
Server.MapPath(ToppproSettings.Download.Root);
DirectoryInfo dlc_folder = new DirectoryInfo(dlc_path);
if (!dlc_folder.Exists)
return null;
cached = dlc_folder.GetFiles()
.Select(f => new DLCModel()
{
Url = UrlHelper.GenerateContentUrl(Path.Combine(ToppproSettings.Download.Root, f.Name), HttpContext),
Name = Path.GetFileNameWithoutExtension(f.Name),
Color = "purple-stripe",
Icon = ""
});
WebCache.Set(key, cached);
}
return View(cached);
}
}
}
|
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web.Helpers;
using System.Web.Mvc;
using Topppro.WebSite.Areas.Humanist.Models;
namespace Topppro.WebSite.Areas.Humanist.Controllers
{
[Authorize]
public class DashboardController : Controller
{
private readonly static string _dlcFolderPath =
ConfigurationManager.AppSettings["RootDownloadsFolderPath"];
public ActionResult Index()
{
var key = "RootDownloadsFolderPath";
var cached = WebCache.Get(key);
if (cached == null)
{
string dlc_path =
Server.MapPath(_dlcFolderPath);
DirectoryInfo dlc_folder = new DirectoryInfo(dlc_path);
if (!dlc_folder.Exists)
return null;
cached = dlc_folder.GetFiles()
.Select(f => new DLCModel()
{
Url = UrlHelper.GenerateContentUrl(Path.Combine(_dlcFolderPath, f.Name), HttpContext),
Name = Path.GetFileNameWithoutExtension(f.Name),
Color = "purple-stripe",
Icon = ""
});
WebCache.Set(key, cached);
}
return View(cached);
}
}
}
|
mit
|
C#
|
0d6f6db8ae23c1aae144633244775861b22d8bf5
|
Improve TracRevisionLog textual !ChangeLog format (1/3): Refactoring log_changelog.cs to use the ClearSilver ''with'' command.
|
pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac
|
templates/log_changelog.cs
|
templates/log_changelog.cs
|
#
# ChangeLog for <?cs var:log.path ?>
#
# Generated by Trac <?cs var:trac.version ?>
# <?cs var:trac.time ?>
#
<?cs each:item = $log.items ?>
<?cs with:changeset = log.changes[item.rev] ?>
<?cs var:changeset.date ?> <?cs
var:changeset.author ?> [<?cs var:item.rev ?>]
<?cs each:file = $changeset.files ?>
* <?cs var:file ?>:<?cs
/each ?>
<?cs var:changeset.message ?>
<?cs /with ?>
<?cs /each ?>
|
#
# ChangeLog for <?cs var:log.path ?>
#
# Generated by Trac <?cs var:trac.version ?>
# <?cs var:trac.time ?>
#
<?cs each:item = $log.items ?>
<?cs var:log.changes[item.rev].date ?> <?cs
var:log.changes[item.rev].author ?> [<?cs var:item.rev ?>]
<?cs each:file = $log.changes[item.rev].files ?>
* <?cs var:file ?>:<?cs
/each ?>
<?cs var:log.changes[item.rev].message ?>
<?cs /each ?>
|
bsd-3-clause
|
C#
|
b1903a160331f156e9c08fa7035e50c8739cd7eb
|
Update MenuPage.xaml.cs
|
xamarinhq/app-evolve,xamarinhq/app-evolve
|
src/XamarinEvolve.Clients.UI/Pages/Android/MenuPage.xaml.cs
|
src/XamarinEvolve.Clients.UI/Pages/Android/MenuPage.xaml.cs
|
using Xamarin.Forms;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using System;
namespace XamarinEvolve.Clients.UI
{
public partial class MenuPage : ContentPage
{
RootPageAndroid root;
public MenuPage(RootPageAndroid root)
{
this.root = root;
InitializeComponent();
NavView.NavigationItemSelected += async (sender, e) =>
{
this.root.IsPresented = false;
await Task.Delay (225);
await this.root.NavigateAsync (e.Index);
};
}
}
}
|
using Xamarin.Forms;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using System;
namespace XamarinEvolve.Clients.UI
{
public partial class MenuPage : ContentPage
{
RootPageAndroid root;
public MenuPage(RootPageAndroid root)
{
this.root = root;
InitializeComponent();
NavView.NavigationItemSelected += (sender, e) =>
{
this.root.IsPresented = false;
Device.StartTimer(TimeSpan.FromMilliseconds(300), ()=>
{
Device.BeginInvokeOnMainThread(async () =>
{
await this.root.NavigateAsync(e.Index);
});
return false;
});
};
}
}
}
|
mit
|
C#
|
86a2c5c6ed647d516d3d0c29d82a98265142dce8
|
Add Description and Info to Options
|
Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,Generic-Voting-Application/voting-application,tpkelly/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application
|
VotingApplication/VotingApplication.Data/Model/Option.cs
|
VotingApplication/VotingApplication.Data/Model/Option.cs
|
using System;
using System.ComponentModel.DataAnnotations;
namespace VotingApplication.Data.Model
{
public class Option
{
public long Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Info { get; set; }
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
namespace VotingApplication.Data.Model
{
public class Option
{
public long Id { get; set; }
public string Name { get; set; }
}
}
|
apache-2.0
|
C#
|
590ffca3a5fe7efa303ee11e225fc12d643cf507
|
Update TestAssemblies.cs
|
Fody/Anotar
|
Common/TestAssemblies.cs
|
Common/TestAssemblies.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
public class TestAssemblies
{
static object weaverLock = new object();
static IDictionary<string, Tuple<Assembly, string, string>> assemblies = new Dictionary<string, Tuple<Assembly, string, string>>();
string assemblyToProcessName;
public TestAssemblies(string assemblyToProcessName)
{
this.assemblyToProcessName = assemblyToProcessName;
}
public Assembly GetAssembly(string target)
{
WeaveAssembly(target);
return assemblies[target].Item1;
}
public string GetBeforePath(string target)
{
WeaveAssembly(target);
return assemblies[target].Item2;
}
public string GetAfterPath(string target)
{
WeaveAssembly(target);
return assemblies[target].Item3;
}
private void WeaveAssembly(string target)
{
lock (weaverLock)
{
if (assemblies.ContainsKey(target) == false)
{
AppDomainAssemblyFinder.Attach();
var assemblyPathUri = new Uri(new Uri(typeof(TestAssemblies).Assembly.CodeBase), $"../../../../{assemblyToProcessName}/bin/Debug/{target}/{assemblyToProcessName}.dll");
var beforeAssemblyPath = Path.GetFullPath(assemblyPathUri.LocalPath);
#if (!DEBUG)
beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release");
#endif
var afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
assemblies[target] = Tuple.Create(Assembly.LoadFile(afterAssemblyPath), beforeAssemblyPath, afterAssemblyPath);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
public class TestAssemblies
{
static object weaverLock = new object();
static IDictionary<string, Tuple<Assembly, string, string>> assemblies = new Dictionary<string, Tuple<Assembly, string, string>>();
string assemblyToProcessName;
public TestAssemblies(string assemblyToProcessName)
{
this.assemblyToProcessName = assemblyToProcessName;
}
public Assembly GetAssembly(string target)
{
WeaveAssembly(target);
return assemblies[target].Item1;
}
public string GetBeforePath(string target)
{
WeaveAssembly(target);
return assemblies[target].Item2;
}
public string GetAfterPath(string target)
{
WeaveAssembly(target);
return assemblies[target].Item3;
}
private void WeaveAssembly(string target)
{
lock (weaverLock)
{
if (assemblies.ContainsKey(target) == false)
{
AppDomainAssemblyFinder.Attach();
var assemblyPathUri = new Uri(new Uri(typeof(TestAssemblies).GetTypeInfo().Assembly.CodeBase), $"../../../../{assemblyToProcessName}/bin/Debug/{target}/{assemblyToProcessName}.dll");
var beforeAssemblyPath = Path.GetFullPath(assemblyPathUri.LocalPath);
#if (!DEBUG)
beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release");
#endif
var afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
assemblies[target] = Tuple.Create(Assembly.LoadFile(afterAssemblyPath), beforeAssemblyPath, afterAssemblyPath);
}
}
}
}
|
mit
|
C#
|
bd44c85ce4de704f1630a8a4e54f3cdc9a9b3a8a
|
Make GitExecutor#Execute virtual
|
appharbor/appharbor-cli
|
src/AppHarbor/GitExecutor.cs
|
src/AppHarbor/GitExecutor.cs
|
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace AppHarbor
{
public class GitExecutor
{
private readonly FileInfo _gitExecutable;
public GitExecutor()
{
var programFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var gitExecutablePath = Path.Combine(programFilesPath, "Git", "bin", "git.exe");
_gitExecutable = new FileInfo(gitExecutablePath);
}
public virtual void Execute(string command, DirectoryInfo repositoryDirectory)
{
var processArguments = new StringBuilder();
processArguments.AppendFormat("/C ");
processArguments.AppendFormat("{0} ", _gitExecutable.Name);
processArguments.AppendFormat("{0} ", command);
processArguments.AppendFormat("--git-dir=\"{0}\" ", repositoryDirectory.FullName);
var process = new Process
{
StartInfo = new ProcessStartInfo("cmd.exe")
{
Arguments = processArguments.ToString(),
CreateNoWindow = true,
RedirectStandardError = true,
UseShellExecute = false,
WorkingDirectory = _gitExecutable.Directory.FullName,
},
};
using (process)
{
process.Start();
process.WaitForExit();
string error = process.StandardError.ReadToEnd();
if (!string.IsNullOrEmpty(error))
{
throw new InvalidOperationException(error);
}
}
}
}
}
|
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace AppHarbor
{
public class GitExecutor
{
private readonly FileInfo _gitExecutable;
public GitExecutor()
{
var programFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var gitExecutablePath = Path.Combine(programFilesPath, "Git", "bin", "git.exe");
_gitExecutable = new FileInfo(gitExecutablePath);
}
public void Execute(string command, DirectoryInfo repositoryDirectory)
{
var processArguments = new StringBuilder();
processArguments.AppendFormat("/C ");
processArguments.AppendFormat("{0} ", _gitExecutable.Name);
processArguments.AppendFormat("{0} ", command);
processArguments.AppendFormat("--git-dir=\"{0}\" ", repositoryDirectory.FullName);
var process = new Process
{
StartInfo = new ProcessStartInfo("cmd.exe")
{
Arguments = processArguments.ToString(),
CreateNoWindow = true,
RedirectStandardError = true,
UseShellExecute = false,
WorkingDirectory = _gitExecutable.Directory.FullName,
},
};
using (process)
{
process.Start();
process.WaitForExit();
string error = process.StandardError.ReadToEnd();
if (!string.IsNullOrEmpty(error))
{
throw new InvalidOperationException(error);
}
}
}
}
}
|
mit
|
C#
|
7dcf2c46a61ae461a86c33427fae9c45659cbca5
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.13.1")]
[assembly: AssemblyInformationalVersion("0.13.1")]
/*
* Version 0.13.1
*
* - [FIX] Fixes missing the Mono.Reflection.dll reference.
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.13.0")]
[assembly: AssemblyInformationalVersion("0.13.0")]
/*
* Version 0.13.0
*
* - [FIX] Changes constructor accessiblity of AccessibilityCollectingVisitor
* from private to protected.
*
* - [FIX] AccessibilityCollectingVisitor returns visitor itself instead of
* throwing NotSupprotedException, when Visit method is called with
* ReflectionElements which does not have any accessiblities.
*
* - [NEW] Adds RestrictingReferenceAssertion to verify referenced assemblies.
*
* [Fact]
* public void Demo()
* {
* var assertion = new RestrictingReferenceAssertion();
* assertion.Visit(typeof(IEnumerable<object>).Assembly.ToElement());
* }
*
* - [FIX] Splits the Jwc.Experiment.Idioms namespace to Jwc.Experiment and
* Jwc.Experiment.Idioms. (BREAKING-CHANGE)
*/
|
mit
|
C#
|
5cb9088b5d9224cf668650e9f42101f64c0cfe2c
|
increment patch version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.2.1")]
[assembly: AssemblyInformationalVersion("0.2.1")]
/*
* Version 0.2.1
*
* - fixes assembly signing.
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.2.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
/*
* Version 0.2.0
*
* - supports parameterized test with auto data.
*/
|
mit
|
C#
|
5ae1c92b39436eb5944333c98b9555f4aec190a7
|
Fix login view model inpc
|
nigel-sampson/talks,nigel-sampson/talks
|
ndc-sydney/NDC.Build.Core/ViewModels/LoginViewModel.cs
|
ndc-sydney/NDC.Build.Core/ViewModels/LoginViewModel.cs
|
using System;
using Caliburn.Micro;
using NDC.Build.Core.Services;
using PropertyChanged;
using static System.String;
namespace NDC.Build.Core.ViewModels
{
public class LoginViewModel : Screen
{
private readonly ICredentialsService credentials;
private readonly IAuthenticationService authentication;
private readonly IApplicationNavigationService navigation;
public LoginViewModel(ICredentialsService credentials, IAuthenticationService authentication, IApplicationNavigationService navigation)
{
this.credentials = credentials;
this.authentication = authentication;
this.navigation = navigation;
}
protected override async void OnInitialize()
{
var stored = await credentials.GetCredentialsAsync();
if (stored == Credentials.None)
return;
Account = stored.Account;
Token = stored.Token;
}
public string Account { get; set; }
public string Token { get; set; }
public string Message { get; private set; }
[DependsOn(nameof(Account), nameof(Token))]
public bool CanLogin => !IsNullOrEmpty(Account) && !IsNullOrEmpty(Token);
public async void Login()
{
var entered = new Credentials(Account, Token);
var authenticated = await authentication.AuthenticateCredentialsAsync(entered);
if (!authenticated)
{
Message = "Account / Token is incorrect";
}
else
{
await credentials.StoreAsync(entered);
navigation.ToProjects();
}
}
}
}
|
using System;
using Caliburn.Micro;
using NDC.Build.Core.Services;
using static System.String;
namespace NDC.Build.Core.ViewModels
{
public class LoginViewModel : Screen
{
private readonly ICredentialsService credentials;
private readonly IAuthenticationService authentication;
private readonly IApplicationNavigationService navigation;
public LoginViewModel(ICredentialsService credentials, IAuthenticationService authentication, IApplicationNavigationService navigation)
{
this.credentials = credentials;
this.authentication = authentication;
this.navigation = navigation;
}
protected override async void OnInitialize()
{
var stored = await credentials.GetCredentialsAsync();
if (stored == Credentials.None)
return;
Account = stored.Account;
Token = stored.Token;
}
public string Account { get; set; }
public string Token { get; set; }
public string Message { get; private set; }
public bool CanLogin => !IsNullOrEmpty(Account) && !IsNullOrEmpty(Token);
public async void Login()
{
var entered = new Credentials(Account, Token);
var authenticated = await authentication.AuthenticateCredentialsAsync(entered);
if (!authenticated)
{
Message = "Account / Token is incorrect";
}
else
{
await credentials.StoreAsync(entered);
navigation.ToProjects();
}
}
}
}
|
mit
|
C#
|
18789d068e300798616ef7f0ff132b9a3fb5de17
|
Make Kaguya stop moving once the minigame has ended
|
NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
|
Assets/Microgames/MoonSoccer/Scripts/MoonSoccerKaguyaMovement.cs
|
Assets/Microgames/MoonSoccer/Scripts/MoonSoccerKaguyaMovement.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoonSoccerKaguyaMovement : MonoBehaviour {
// The speed of her vertical movement
[Header("Movement Speed")]
[SerializeField]
private float moveSpeed = 1f;
// Minimum height the object can reach before changing direction
[Header("Minimum Height")]
[SerializeField]
private float minHeight = 1f;
// Maximum height the object can reach before changing direction
[Header("Maximum Height")]
[SerializeField]
private float maxHeight = 1f;
// The lenght between the leftmost and rightmost point the sprite can reach horizontally
[Header("X Movement Distance")]
[SerializeField]
private float xMovement = 1f;
// Bool to track the current movement direction
private bool downward = true;
// The total distance between the top and bottom boundaries of the vertical movement
private float moveDistance = 0f;
// The starting x value of the object transform
private float startX = 0f;
// Initialization
void Start () {
moveDistance = (minHeight * -1) + maxHeight;
startX = transform.position.x;
}
// Update Kaguya's position by moving her vertically according to moveSpeed. X value is updated based on the y position
void Update () {
if (MicrogameController.instance.getVictoryDetermined() != true) {
float x = transform.position.x;
float y = transform.position.y;
if (downward == true)
{
if (transform.position.y >= minHeight)
y = transform.position.y - moveSpeed * Time.deltaTime;
else
downward = false;
}
else
{
if (transform.position.y <= maxHeight)
y = transform.position.y + moveSpeed * Time.deltaTime;
else
downward = true;
}
x = -((y - minHeight) / moveDistance) * xMovement;
transform.position = new Vector2(startX + x, y);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoonSoccerKaguyaMovement : MonoBehaviour {
// The speed of her vertical movement
[Header("Movement Speed")]
[SerializeField]
private float moveSpeed = 1f;
// Minimum height the object can reach before changing direction
[Header("Minimum Height")]
[SerializeField]
private float minHeight = 1f;
// Maximum height the object can reach before changing direction
[Header("Maximum Height")]
[SerializeField]
private float maxHeight = 1f;
// The lenght between the leftmost and rightmost point the sprite can reach horizontally
[Header("X Movement Distance")]
[SerializeField]
private float xMovement = 1f;
// Bool to track the current movement direction
private bool downward = true;
// The total distance between the top and bottom boundaries of the vertical movement
private float moveDistance = 0f;
// The starting x value of the object transform
private float startX = 0f;
// Initialization
void Start () {
moveDistance = (minHeight * -1) + maxHeight;
startX = transform.position.x;
}
// Update Kaguya's position by moving her vertically according to moveSpeed. X value is updated based on the y position
void Update () {
float x = transform.position.x;
float y = transform.position.y;
if (downward == true)
{
if (transform.position.y >= minHeight)
y = transform.position.y - moveSpeed * Time.deltaTime;
else
downward = false;
}
else
{
if (transform.position.y <= maxHeight)
y = transform.position.y + moveSpeed * Time.deltaTime;
else
downward = true;
}
x = -((y - minHeight) / moveDistance) * xMovement;
transform.position = new Vector2(startX + x, y);
}
}
|
mit
|
C#
|
fa6bb66e3eeb56591498b7525dfe9fc271c8cf4a
|
Fix bug in the repeater step validation
|
riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy,riganti/dotvvm-samples-academy
|
src/DotvvmAcademy.Web/Course/030_repeater/20_repeater.dothtml.csx
|
src/DotvvmAcademy.Web/Course/030_repeater/20_repeater.dothtml.csx
|
#load "00_constants.csx"
using DotvvmAcademy.Validation.Dothtml.Unit;
using DotvvmAcademy.Validation.Unit;
public DothtmlUnit Unit { get; set; } = new DothtmlUnit();
Unit.GetDirective("/@viewModel")
.RequireTypeArgument(ViewModelName);
var repeater = Unit.GetControl("/html/body/dot:Repeater");
{
repeater.GetProperty("@DataSource")
.RequireBinding(ItemsProperty)
.GetControl("p/dot:Literal")
.GetProperty("@Text")
.RequireBinding("_this");
}
|
#load "00_constants.csx"
using DotvvmAcademy.Validation.Dothtml.Unit;
using DotvvmAcademy.Validation.Unit;
public DothtmlUnit Unit { get; set; } = new DothtmlUnit();
Unit.GetDirective("/@viewModel")
.RequireTypeArgument(ViewModelName);
var repeater = Unit.GetControl("/html/body/dot:Repeater");
{
repeater.GetProperty("@DataSource")
.RequireBinding(ItemsProperty);
repeater.GetControl("p/dot:Literal")
.GetProperty("@Text")
.RequireBinding("_this");
}
|
apache-2.0
|
C#
|
75a590a75e870ab26bd12d4f2deaa1b2b2b6fe83
|
Fix mistake in imgur tests
|
bcanseco/common-bot-library,bcanseco/common-bot-library
|
tests/CommonBotLibrary.Tests/Services/ImgurServiceTests.cs
|
tests/CommonBotLibrary.Tests/Services/ImgurServiceTests.cs
|
using System.Linq;
using System.Threading.Tasks;
using CommonBotLibrary.Exceptions;
using CommonBotLibrary.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommonBotLibrary.Tests.Services
{
[TestClass]
public class ImgurServiceTests
{
[TestMethod]
[ExpectedException(typeof(InvalidCredentialsException))]
public void Should_Fail_Without_Credentials()
{
Tokens.Imgur = null;
var service = new ImgurService();
}
[TestMethod]
[ExpectedException(typeof(InvalidCredentialsException))]
public void Should_Fail_With_Blank_Credentials()
{
var service = new ImgurService(string.Empty);
}
[TestMethod]
[ExpectedException(typeof(InvalidCredentialsException))]
public async Task Should_Fail_With_Invalid_Credentials()
{
var service = new ImgurService("?");
var results = await service.SearchAsync(null);
}
[TestMethod]
public async Task Should_Return_Empty_When_None_Found()
{
// Get valid Imgur token
await Tokens.LoadAsync("../../../../../tokens.json");
var service = new ImgurService();
var results = await service.SearchAsync("1@3$mNbVuNyBtVrC");
Assert.IsFalse(results.Any());
}
[TestMethod]
public async Task Should_Find_Images_With_Real_Query()
{
// Get valid Imgur token
await Tokens.LoadAsync("../../../../../tokens.json");
var service = new ImgurService();
var results = (await service.SearchAsync("dogs")).ToList();
Assert.IsTrue(results.Any());
Assert.IsNotNull(results.First().Title);
}
}
}
|
using System.Linq;
using System.Threading.Tasks;
using CommonBotLibrary.Exceptions;
using CommonBotLibrary.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommonBotLibrary.Tests.Services
{
[TestClass]
public class ImgurServiceTests
{
[TestMethod]
[ExpectedException(typeof(InvalidCredentialsException))]
public void Should_Fail_Without_Credentials()
{
Tokens.Imgur = null;
var service = new GoogleService();
}
[TestMethod]
[ExpectedException(typeof(InvalidCredentialsException))]
public void Should_Fail_With_Blank_Credentials()
{
var service = new ImgurService(string.Empty);
}
[TestMethod]
[ExpectedException(typeof(InvalidCredentialsException))]
public async Task Should_Fail_With_Invalid_Credentials()
{
var service = new ImgurService("?");
var results = await service.SearchAsync(null);
}
[TestMethod]
public async Task Should_Return_Empty_When_None_Found()
{
// Get valid Imgur token
await Tokens.LoadAsync("../../../../../tokens.json");
var service = new ImgurService();
var results = await service.SearchAsync("1@3$mNbVuNyBtVrC");
Assert.IsFalse(results.Any());
}
[TestMethod]
public async Task Should_Find_Images_With_Real_Query()
{
// Get valid Imgur token
await Tokens.LoadAsync("../../../../../tokens.json");
var service = new ImgurService();
var results = (await service.SearchAsync("dogs")).ToList();
Assert.IsTrue(results.Any());
Assert.IsNotNull(results.First().Title);
}
}
}
|
mit
|
C#
|
2398392bfc6c59f5163e8edb6ecf7488d3d567f7
|
Fix GetHashCode
|
jcdickinson/Chasm,jannesrsa/Chasm,k2workflow/Chasm
|
src/SourceCode.Chasm/Blob.cs
|
src/SourceCode.Chasm/Blob.cs
|
using SourceCode.Clay.Buffers;
using System;
namespace SourceCode.Chasm
{
public struct Blob : IEquatable<Blob>
{
#region Constants
public static Blob Empty { get; }
#endregion
#region Properties
public byte[] Data { get; }
#endregion
#region De/Constructors
public Blob(byte[] data)
{
Data = data;
}
public void Deconstruct(out byte[] data)
{
data = Data;
}
#endregion
#region IEquatable
public bool Equals(Blob other)
=> BufferComparer.Default.Equals(Data, other.Data); // Callee has null-handling logic
public override bool Equals(object obj)
=> obj is Blob blob
&& Equals(blob);
public override int GetHashCode()
=> (Data?.Length ?? 0).GetHashCode();
public static bool operator ==(Blob x, Blob y) => x.Equals(y);
public static bool operator !=(Blob x, Blob y) => !x.Equals(y);
#endregion
#region Operators
public override string ToString()
=> $"{nameof(Blob)}: {Data?.Length ?? 0}";
#endregion
}
}
|
using SourceCode.Clay.Buffers;
using System;
namespace SourceCode.Chasm
{
public struct Blob : IEquatable<Blob>
{
#region Constants
public static Blob Empty { get; }
#endregion
#region Properties
public byte[] Data { get; }
#endregion
#region De/Constructors
public Blob(byte[] data)
{
Data = data;
}
public void Deconstruct(out byte[] data)
{
data = Data;
}
#endregion
#region IEquatable
public bool Equals(Blob other)
=> BufferComparer.Default.Equals(Data, other.Data); // Has null-handling logic
public override bool Equals(object obj)
=> obj is Blob blob
&& Equals(blob);
public override int GetHashCode()
=> Data.Length.GetHashCode();
public static bool operator ==(Blob x, Blob y) => x.Equals(y);
public static bool operator !=(Blob x, Blob y) => !x.Equals(y);
#endregion
#region Operators
public override string ToString()
=> $"{nameof(Blob)}: {Data?.Length ?? 0}";
#endregion
}
}
|
mit
|
C#
|
5d8edb08e3e4957249682cb670ad0a288fecc693
|
Update TranslateExceptionAttribute.cs
|
mvpete/aspekt
|
Aspekt/TranslateExceptionAttribute.cs
|
Aspekt/TranslateExceptionAttribute.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aspekt
{
// Any method that is decorated with this attribute is to be wrapped in a try/catch
// where the catch block will catch, exceptionFrom type and wrap it with the exceptionTo
// this means that the ctor of the exceptionTo, must accept an exceptionFrom as a param.
[AttributeUsage(AttributeTargets.Method)]
public class TranslateExceptionAttribute : Aspect
{
Type exceptionTo_;
Type exceptionFrom_;
String message_;
public TranslateExceptionAttribute(Type exceptionFrom, Type exceptionTo, String val)
{
exceptionFrom_ = exceptionFrom;
exceptionTo_ = exceptionTo;
message_ = val;
}
public TranslateExceptionAttribute(Type exceptionFrom, Type exceptionTo)
{
exceptionTo_ = exceptionTo;
exceptionFrom_ = exceptionFrom;
}
public TranslateExceptionAttribute(String s)
{
}
public TranslateExceptionAttribute(int i)
{
}
public override void OnEntry(MethodArguments arg)
{
}
public override void OnExit(MethodArguments arg)
{
}
// what to do here
public override void OnException(Exception e)
{
//Console.WriteLine($"OnException - {e.Message}");
if (e.GetType() == exceptionFrom_)
{
// then we rethrow
var ctor = exceptionTo_.GetConstructor(new Type[] { exceptionFrom_ });
if (ctor == null)
{
throw e;
}
var e2 = Convert.ChangeType(ctor.Invoke(new object[] { Convert.ChangeType(e, exceptionFrom_) }), exceptionTo_);
throw (Exception)e2;
}
else
throw e;
}
public Type ExceptionTo { get { return exceptionTo_; } }
public Type ExceptionFrom { get { return exceptionFrom_; } }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aspekt
{
// Any method that is decorated with this attribute is to be wrapped in a try/catch
// where the catch block will catch, exceptionFrom type and wrap it with the exceptionTo
// this means that the ctor of the exceptionTo, must accept an exceptionFrom as a param.
[AttributeUsage(AttributeTargets.Method)]
public class TranslateExceptionAttribute : Aspect
{
Type exceptionTo_;
Type exceptionFrom_;
String message_;
public TranslateExceptionAttribute(Type exceptionFrom, Type exceptionTo, String val)
{
exceptionFrom_ = exceptionFrom;
exceptionTo_ = exceptionTo;
message_ = val;
}
public TranslateExceptionAttribute(Type exceptionFrom, Type exceptionTo)
{
exceptionTo_ = exceptionTo;
exceptionFrom_ = exceptionFrom;
}
public TranslateExceptionAttribute(String s)
{
}
public TranslateExceptionAttribute(int i)
{
}
public override void OnEntry(MethodArguments arg)
{
}
public override void OnExit(MethodArguments arg)
{
}
// what to do here
public override void OnException(Exception e)
{
//Console.WriteLine($"OnException - {e.Message}");
if (e.GetType() == exceptionFrom_)
{
// then we rethrow
var ctor = exceptionTo_.GetConstructor(new Type[] { exceptionFrom_ });
if (ctor == null)
{
throw e;
}
var e2 = Convert.ChangeType(ctor.Invoke(new object[] { Convert.ChangeType(e, exceptionFrom_) }), exceptionTo_);
throw (Exception)e2;
}
else
throw e;
}
public Type ExceptionTo { get { return exceptionTo_; } }
public Type ExceptionFrom { get { return exceptionFrom_; } }
}
[AttributeUsage(AttributeTargets.Method)]
public class DummyAttribute : System.Attribute
{
public enum Choice { Yes, No };
public DummyAttribute(object s, UInt16 i, float f, double d,char c, Choice ch, bool b)
{
}
public DummyAttribute()
{
}
public String Text { get; set; }
public Choice Pick { get; set; }
}
}
|
mit
|
C#
|
b8616e27a05f22ca16f767309a8b954e276222f4
|
Update attribute summary and example
|
madsbangh/EasyButtons
|
Assets/EasyButtons/ButtonAttribute.cs
|
Assets/EasyButtons/ButtonAttribute.cs
|
using System;
namespace EasyButtons
{
/// <summary>
/// Attribute to create a button in the inspector for calling the method it is attached to.
/// The method must be public and have no arguments.
/// </summary>
/// <example>
/// [<see cref="ButtonAttribute"/>]
/// public void MyMethod()
/// {
/// Debug.Log("Clicked!");
/// }
/// </example>
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public sealed class ButtonAttribute : Attribute { }
}
|
using System;
namespace EasyButtons
{
/// <summary>
/// Attribute to create a button in the inspector for calling the method it is attached to.
/// The method must have no arguments.
/// </summary>
/// <example>
/// [<see cref="ButtonAttribute"/>]
/// void MyMethod()
/// {
/// Debug.Log("Clicked!");
/// }
/// </example>
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public sealed class ButtonAttribute : Attribute { }
}
|
mit
|
C#
|
83078b2c8cfa481529b681e50fb29ece30f29187
|
Correct way to load first scene;
|
KonH/UDBase
|
Controllers/Scene/AsyncSceneLoader.cs
|
Controllers/Scene/AsyncSceneLoader.cs
|
using UnityEngine.SceneManagement;
using UDBase.Controllers.LogSystem;
using UDBase.Controllers.EventSystem;
using UDBase.Utils;
namespace UDBase.Controllers.SceneSystem {
public sealed class AsyncSceneLoader : IScene {
public ISceneInfo CurrentScene { get; private set; }
readonly ISceneInfo _loadingScene;
readonly ISceneInfo _firstScene;
AsyncLoadHelper _helper;
public AsyncSceneLoader(string loadingSceneName = null, string firstSceneName = null) {
_loadingScene = new SceneName(loadingSceneName);
_firstScene = new SceneName(firstSceneName);
}
public AsyncSceneLoader(ISceneInfo loadingScene = null, ISceneInfo firstScene = null) {
_loadingScene = loadingScene;
_firstScene = firstScene;
}
public void Init() {
_helper = UnityHelper.AddPersistant<AsyncLoadHelper>();
if( (_firstScene != null) && !string.IsNullOrEmpty(_firstScene.Name) ) {
LoadScene(_firstScene);
}
}
public void PostInit() {}
public void Reset() {}
public void LoadScene(ISceneInfo sceneInfo) {
var sceneName = sceneInfo.Name;
if( Scene.IsSceneNameValid(sceneName) ) {
TryLoadLoadingScene();
_helper.LoadScene(sceneName);
CurrentScene = sceneInfo;
Events.Fire(new Scene_Loaded(sceneInfo));
} else {
Log.ErrorFormat("Scene not found: \"{0}\" via {1}", LogTags.Scene, sceneName, sceneInfo);
}
}
public void ReloadScene() {
if( CurrentScene == null ) {
CurrentScene = new SceneName(SceneManager.GetActiveScene().name);
}
LoadScene(CurrentScene);
}
void TryLoadLoadingScene() {
var sceneName = GetLoadingSceneName();
if( !string.IsNullOrEmpty(sceneName) ) {
SceneManager.LoadScene(sceneName);
}
}
string GetLoadingSceneName() {
return (_loadingScene != null) ? _loadingScene.Name : "";
}
}
}
|
using UnityEngine.SceneManagement;
using UDBase.Controllers.LogSystem;
using UDBase.Controllers.EventSystem;
using UDBase.Utils;
namespace UDBase.Controllers.SceneSystem {
public sealed class AsyncSceneLoader : IScene {
public ISceneInfo CurrentScene { get; private set; }
readonly ISceneInfo _loadingScene;
readonly ISceneInfo _firstScene;
AsyncLoadHelper _helper;
public AsyncSceneLoader(string loadingSceneName = null, string firstSceneName = null) {
_loadingScene = new SceneName(loadingSceneName);
_firstScene = new SceneName(firstSceneName);
}
public AsyncSceneLoader(ISceneInfo loadingScene = null, ISceneInfo firstScene = null) {
_loadingScene = loadingScene;
_firstScene = firstScene;
}
public void Init() {
_helper = UnityHelper.AddPersistant<AsyncLoadHelper>();
if( _firstScene != null ) {
LoadScene(_firstScene);
}
}
public void PostInit() {}
public void Reset() {}
public void LoadScene(ISceneInfo sceneInfo) {
var sceneName = sceneInfo.Name;
if( Scene.IsSceneNameValid(sceneName) ) {
TryLoadLoadingScene();
_helper.LoadScene(sceneName);
CurrentScene = sceneInfo;
Events.Fire(new Scene_Loaded(sceneInfo));
} else {
Log.ErrorFormat("Scene not found: \"{0}\" via {1}", LogTags.Scene, sceneName, sceneInfo);
}
}
public void ReloadScene() {
if( CurrentScene == null ) {
CurrentScene = new SceneName(SceneManager.GetActiveScene().name);
}
LoadScene(CurrentScene);
}
void TryLoadLoadingScene() {
var sceneName = GetLoadingSceneName();
if( !string.IsNullOrEmpty(sceneName) ) {
SceneManager.LoadScene(sceneName);
}
}
string GetLoadingSceneName() {
return (_loadingScene != null) ? _loadingScene.Name : "";
}
}
}
|
mit
|
C#
|
53d2a5634e0321ff2571d548580d75ab494de483
|
Update ExceptionHelper.cs
|
media-tools/core,media-tools/core
|
Core/Core.Platform/ExceptionHelper.cs
|
Core/Core.Platform/ExceptionHelper.cs
|
using System;
namespace Core.Common
{
public static class ExceptionHelper
{
public static void Catch<T> (Action tryAction, Action<Exception> catchAction) where T : Exception
{
try {
tryAction ();
} catch (T ex) {
if (catchAction != null) {
catchAction (ex);
}
} catch (System.Reflection.TargetInvocationException _ex) {
Exception ex;
if (_ex.InnerException != null)
ex = _ex.InnerException;
else
ex = _ex;
if (catchAction != null) {
catchAction (ex);
}
}
}
}
}
|
using System;
namespace Core.Common
{
public static class ExceptionHelper
{
public static void Catch<T> (Action tryAction, Action<Exception> catchAction) where T : Exception
{
try {
tryAction ();
} catch (T _ex) {
Exception ex;
if (_ex is System.Reflection.TargetInvocationException && _ex.InnerException != null)
ex = _ex.InnerException;
else
ex = _ex;
if (catchAction != null) {
catchAction (ex);
}
}
}
}
}
|
mit
|
C#
|
c23ca6ead97f40e091019fe69c670466f3b76467
|
Reset Read/Write 837 samples.
|
EdiFabric/Sdk
|
Hipaa/Program.cs
|
Hipaa/Program.cs
|
namespace EdiFabric.Sdk.Hipaa
{
class Program
{
static void Main(string[] args)
{
ReadSamples.Run();
WriteSamples.Run();
//Read834Samples.Run();
Write834Samples.Run();
}
}
}
|
namespace EdiFabric.Sdk.Hipaa
{
class Program
{
static void Main(string[] args)
{
//ReadSamples.Run();
//WriteSamples.Run();
//Read834Samples.Run();
Write834Samples.Run();
}
}
}
|
agpl-3.0
|
C#
|
acb442c0b1c806242f7cb67bbf0d7aa362594150
|
Add very simple garbage collection of chunks.
|
LambdaSix/InfiniMap,LambdaSix/InfiniMap
|
InfiniMap/Map.cs
|
InfiniMap/Map.cs
|
using System;
using System.Collections.Generic;
namespace InfiniMap
{
public class Map
{
public IDictionary<Tuple<int, int>, Chunk> Chunks;
private int _chunkWidth;
private int _chunkHeight;
public Map(int chunkHeight, int chunkWidth)
{
_chunkHeight = chunkHeight;
_chunkWidth = chunkWidth;
Chunks = new Dictionary<Tuple<int, int>, Chunk>(64);
}
private IEnumerable<Tuple<int, int>> Distance(int startX, int startY, int range)
{
return Enumerable.Range(startX, range + 1).SelectMany(x => Enumerable.Range(startY, range + 1), Tuple.Create);
}
/// <summary>
/// Very simple garbage collection, frees all chunks within the given range.
/// </summary>
/// <remarks>
/// Frees up chunks in a square pattern. Given (0,0) and a range of 1, free:
/// 0,0,1,0
/// 0,1,1,1
/// </remarks>
/// <param name="curX">Chunk X to start from</param>
/// <param name="curY">Chunk Y to start from</param>
/// <param name="range">Square distance to free</param>
public void UnloadArea(int curX, int curY, int range)
{
// Clean out chunks further than (x,y) -> (x+range, y+range)
foreach (var pair in Distance(curX, curY, range))
{
Chunks.Remove(pair);
}
}
public Block this[int x, int y]
{
get
{
var xChunk = (int) Math.Floor(x/(float) _chunkHeight);
var yChunk = (int) Math.Floor(y/(float) _chunkWidth);
Chunk chunk;
var foundChunk = Chunks.TryGetValue(Tuple.Create(xChunk, yChunk), out chunk);
if (foundChunk)
{
return chunk[x, y];
}
var newChunk = new Chunk(_chunkHeight, _chunkWidth);
Chunks.Add(Tuple.Create(xChunk, yChunk), newChunk);
return newChunk[x, y];
}
set
{
// Block is a reference type, so we just discard a local pointer after
// alterting the object
var block = this[x, y];
block = value;
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace InfiniMap
{
public class Map
{
public IDictionary<Tuple<int, int>, Chunk> Chunks;
private int _chunkWidth;
private int _chunkHeight;
public Map(int chunkHeight, int chunkWidth)
{
_chunkHeight = chunkHeight;
_chunkWidth = chunkWidth;
Chunks = new Dictionary<Tuple<int, int>, Chunk>(64);
}
public Block this[int x, int y]
{
get
{
var xChunk = (int) Math.Floor(x/(float) _chunkHeight);
var yChunk = (int) Math.Floor(y/(float) _chunkWidth);
Chunk chunk;
var foundChunk = Chunks.TryGetValue(Tuple.Create(xChunk, yChunk), out chunk);
if (foundChunk)
{
return chunk[x, y];
}
var newChunk = new Chunk(_chunkHeight, _chunkWidth);
Chunks.Add(Tuple.Create(xChunk, yChunk), newChunk);
return newChunk[x, y];
}
set
{
// Block is a reference type, so we just discard a local pointer after
// alterting the object
var block = this[x, y];
block = value;
}
}
}
}
|
mit
|
C#
|
5f1136f38f610aa2e6516e6d35f1162dc6fd9496
|
Move database reference of center database to Jovice project
|
afisd/jovice,afisd/jovice
|
Jovice/Jovice.cs
|
Jovice/Jovice.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Aphysoft.Share;
namespace Center
{
public class Jovice
{
#region Database
private static Database jovice = null;
public static Database Database
{
get
{
if (jovice == null)
{
#if DEBUG
jovice = new Database(Aphysoft.Protected.Project.Database("JOVICE_DEBUG"), DatabaseType.SqlServer);
#else
jovice = new Database(Aphysoft.Protected.Project.Database("JOVICE_RELEASE"), DatabaseType.SqlServer);
#endif
}
return jovice;
}
}
private static Database center = null;
public static Database Center
{
get
{
if (center == null)
{
#if DEBUG
center = new Database(Aphysoft.Protected.Project.Database("CENTER_DEBUG"), DatabaseType.SqlServer);
#else
center = new Database(Aphysoft.Protected.Project.Database("CENTER_RELEASE"), DatabaseType.SqlServer);
#endif
}
return center;
}
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Aphysoft.Share;
namespace Center
{
public class Jovice
{
#region Database
private static Database jovice = null;
public static Database Database
{
get
{
if (jovice == null)
{
#if DEBUG
jovice = new Database(Aphysoft.Protected.Project.Database("JOVICE_DEBUG"), DatabaseType.SqlServer);
#else
jovice = new Database(Aphysoft.Protected.Project.Database("JVOICE_RELEASE"), DatabaseType.SqlServer);
#endif
}
return jovice;
}
}
#endregion
}
}
|
mit
|
C#
|
563d5c6d934d080e4d0787a3f585e28f1ec72e7f
|
Fix little logic error.
|
mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos
|
src/Manos/Manos/Timeout.cs
|
src/Manos/Manos/Timeout.cs
|
//
// Copyright (C) 2010 Jackson Harper (jackson@manosdemono.com)
//
// 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 Manos
{
/// <summary>
/// Provides a mechanism for things to happen periodically within a ManosApp.
/// Timeouts are gauranteed to happen at some moment on or after the TimeSpan specified has ellapsed.
///
/// Timeouts will never run before the specified TimeSpan has ellapsed.
///
/// Use the method <see cref="Manos.IO.IOLoop"/> "AddTimeout" method to register each Timeout.
/// </summary>
public class Timeout
{
internal TimeSpan begin;
internal TimeSpan span;
internal IRepeatBehavior repeat;
internal object data;
internal TimeoutCallback callback;
private bool stopped;
public Timeout (TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) : this (TimeSpan.Zero, span, repeat,data, callback)
{
}
public Timeout (TimeSpan begin, TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback)
{
this.begin = begin;
this.span = span;
this.repeat = repeat;
this.data = data;
this.callback = callback;
}
/// <summary>
/// Causes the action specified in the constructor to be executed. Infrastructure.
/// </summary>
/// <param name="app">
/// A <see cref="ManosApp"/>
/// </param>
public void Run (ManosApp app)
{
if (stopped)
return;
try {
callback (app, data);
} catch (Exception e) {
Console.Error.WriteLine ("Exception in timeout callback.");
Console.Error.WriteLine (e);
}
repeat.RepeatPerformed ();
}
/// <summary>
/// Stop the current timeout from further execution. Once a timeout is stopped it can not be restarted
/// </summary>
public void Stop ()
{
stopped = true;
}
/// <summary>
/// Inidicates that the IOLoop should retain this timeout, because it will be run again at some point in the future. Infrastructure.
/// </summary>
public bool ShouldContinueToRepeat ()
{
return !stopped && repeat.ShouldContinueToRepeat ();
}
}
}
|
//
// Copyright (C) 2010 Jackson Harper (jackson@manosdemono.com)
//
// 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 Manos
{
/// <summary>
/// Provides a mechanism for things to happen periodically within a ManosApp.
/// Timeouts are gauranteed to happen at some moment on or after the TimeSpan specified has ellapsed.
///
/// Timeouts will never run before the specified TimeSpan has ellapsed.
///
/// Use the method <see cref="Manos.IO.IOLoop"/> "AddTimeout" method to register each Timeout.
/// </summary>
public class Timeout
{
internal TimeSpan begin;
internal TimeSpan span;
internal IRepeatBehavior repeat;
internal object data;
internal TimeoutCallback callback;
private bool stopped;
public Timeout (TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback) : this (TimeSpan.Zero, span, repeat,data, callback)
{
}
public Timeout (TimeSpan begin, TimeSpan span, IRepeatBehavior repeat, object data, TimeoutCallback callback)
{
this.begin = begin;
this.span = span;
this.repeat = repeat;
this.data = data;
this.callback = callback;
}
/// <summary>
/// Causes the action specified in the constructor to be executed. Infrastructure.
/// </summary>
/// <param name="app">
/// A <see cref="ManosApp"/>
/// </param>
public void Run (ManosApp app)
{
if (stopped)
return;
try {
callback (app, data);
} catch (Exception e) {
Console.Error.WriteLine ("Exception in timeout callback.");
Console.Error.WriteLine (e);
}
repeat.RepeatPerformed ();
}
/// <summary>
/// Stop the current timeout from further execution. Once a timeout is stopped it can not be restarted
/// </summary>
public void Stop ()
{
stopped = true;
}
/// <summary>
/// Inidicates that the IOLoop should retain this timeout, because it will be run again at some point in the future. Infrastructure.
/// </summary>
public bool ShouldContinueToRepeat ()
{
return !stopped || repeat.ShouldContinueToRepeat ();
}
}
}
|
mit
|
C#
|
1e8357b8472d34147c4827b4c135a5413f2d5376
|
Fix rest/taskrouter/reservations/redirect csharp 5.x
|
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,teoreteetik/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
|
rest/taskrouter/reservations/redirect/example-1.5.x.cs
|
rest/taskrouter/reservations/redirect/example-1.5.x.cs
|
// Download the twilio-csharp library from
// https://www.twilio.com/docs/libraries/csharp#installation
using Newtonsoft.Json.Linq;
using System;
using Twilio;
using Twilio.Rest.Taskrouter.V1.Workspace.Task;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string taskSid = "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string reservationSid = "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
TwilioClient.Init(accountSid, authToken);
// Update a Reservation with a Redirect instruction
var reservation = ReservationResource.Fetch(workspaceSid, taskSid, reservationSid);
Console.WriteLine(reservation.ReservationStatus);
Console.WriteLine(reservation.WorkerName);
ReservationResource.Update(workspaceSid, taskSid, reservationSid,
instruction: "Redirect",
redirectCallSid: "CA123456789",
redirectUrl: new Uri("http://example.com/assignment_redirect"));
}
}
|
// Download the twilio-csharp library from
// https://www.twilio.com/docs/libraries/csharp#installation
using System;
using Twilio;
using Twilio.Rest.Taskrouter.V1.Workspace.Task;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
const string workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string taskSid = "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string reservationSid = "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
TwilioClient.Init(accountSid, authToken);
// Update a Reservation with a Redirect instruction
var reservation = ReservationResource.Fetch(workspaceSid, taskSid, reservationSid);
Console.WriteLine(reservation.ReservationStatus);
Console.WriteLine(reservation.WorkerName);
ReservationResource.Update(workspaceSid, taskSid, reservationSid,
instruction: "Redirect",
redirectCallSid: "CA123456789",
redirectUrl: new Uri("http://example.com/assignment_redirect"));
}
}
|
mit
|
C#
|
7497c74f8bc880f07f0cd3a50fd72179ae497eb9
|
Add more Documents related events.
|
LightPaper/Infrastructure
|
Events/Events.LightPaper.Documents.cs
|
Events/Events.LightPaper.Documents.cs
|
#region Using
using System.ComponentModel;
using LightPaper.Infrastructure.Contracts;
using Microsoft.Practices.Prism.PubSubEvents;
#endregion
namespace LightPaper.Infrastructure.Events
{
public class SelectedDocumentChangedEvent : PubSubEvent<SelectedDocumentChangedEvent.Payload>
{
#region Nested type: Payload
public class Payload
{
public Payload(IDocument oldSelection, IDocument newSelection)
{
OldSelection = oldSelection;
NewSelection = newSelection;
}
public IDocument OldSelection { get; private set; }
public IDocument NewSelection { get; private set; }
}
#endregion
}
public class SelectedDocumentWillChangeEvent : PubSubEvent<SelectedDocumentWillChangeEvent.Payload>
{
#region Nested type: Payload
public class Payload
{
public Payload(IDocument currentDocument, CurrentChangingEventArgs eventArgs)
{
CurrentDocument = currentDocument;
ChangingEventArgs = eventArgs;
}
public IDocument CurrentDocument { get; private set; }
public CurrentChangingEventArgs ChangingEventArgs { get; private set; }
}
#endregion
}
public class DocumentWillCloseEvent : PubSubEvent<IDocument>
{
}
public class DocumentClosedEvent : PubSubEvent<IDocument>
{
}
public class DocumentAddedToWorkingCollectionEvent : PubSubEvent<IDocument>
{
}
}
|
#region Using
using LightPaper.Infrastructure.Contracts;
using Microsoft.Practices.Prism.PubSubEvents;
#endregion
namespace LightPaper.Infrastructure.Events
{
public class SelectedDocumentChangedEvent : PubSubEvent<SelectedDocumentChangedEvent.Payload>
{
#region Nested type: Payload
public class Payload
{
public Payload(IDocument oldSelection, IDocument newSelection)
{
OldSelection = oldSelection;
NewSelection = newSelection;
}
public IDocument OldSelection { get; private set; }
public IDocument NewSelection { get; private set; }
}
#endregion
}
public class DocumentWillCloseEvent : PubSubEvent<IDocument>
{
}
public class DocumentClosedEvent : PubSubEvent<IDocument>
{
}
}
|
mit
|
C#
|
249d6b5c5885b32e9371041d179269dd2d44ff2c
|
remove logging function
|
smith-neil/DotNetCore
|
src/DotNetCore.Core/Utilities/ILogger.cs
|
src/DotNetCore.Core/Utilities/ILogger.cs
|
using System;
namespace DotNetCore.Core.Utilities
{
public interface ILogger
{
void Log(string message);
void Log(Exception exception);
}
}
|
using System;
namespace DotNetCore.Core.Utilities
{
public interface ILogger
{
void Log(string message);
void Log(Exception exception);
void Log(Exception exception, string message);
}
}
|
mit
|
C#
|
022f4f5aa00c012d204c58248cc109fc74590313
|
Update ArrowMarker.cs
|
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/ArrowMarker.cs
|
src/Core2D/Modules/Renderer/SkiaSharp/Nodes/Markers/ArrowMarker.cs
|
#nullable enable
using SkiaSharp;
namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers;
internal class ArrowMarker : MarkerBase
{
public SKPoint P11;
public SKPoint P21;
public SKPoint P12;
public SKPoint P22;
public override void Draw(object? dc)
{
if (dc is not SKCanvas canvas)
{
return;
}
if (ShapeViewModel is { } && ShapeViewModel.IsStroked)
{
canvas.DrawLine(P11, P21, Pen);
canvas.DrawLine(P12, P22, Pen);
}
}
}
|
#nullable enable
using SkiaSharp;
namespace Core2D.Modules.Renderer.SkiaSharp.Nodes.Markers;
internal class ArrowMarker : MarkerBase
{
public SKPoint P11;
public SKPoint P21;
public SKPoint P12;
public SKPoint P22;
public override void Draw(object? dc)
{
if (dc is not SKCanvas canvas)
{
return;
}
if (ShapeViewModel.IsStroked)
{
canvas.DrawLine(P11, P21, Pen);
canvas.DrawLine(P12, P22, Pen);
}
}
}
|
mit
|
C#
|
e9f254eb30933cfb5d61c884b5dd8c354abaff3d
|
Remove unused `using`
|
rexm/Handlebars.Net,rexm/Handlebars.Net
|
source/Handlebars.Extension.CompileFast/CompileFastExtensions.cs
|
source/Handlebars.Extension.CompileFast/CompileFastExtensions.cs
|
namespace HandlebarsDotNet.Extension.CompileFast
{
/// <summary>
///
/// </summary>
public static class CompileFastExtensions
{
/// <summary>
/// Changes <see cref="IExpressionCompiler"/> to the one using <c>FastExpressionCompiler</c>
/// </summary>
/// <param name="configuration"></param>
/// <returns></returns>
public static HandlebarsConfiguration UseCompileFast(this HandlebarsConfiguration configuration)
{
var compileTimeConfiguration = configuration.CompileTimeConfiguration;
compileTimeConfiguration.Features.Add(new FastCompilerFeatureFactory());
return configuration;
}
}
}
|
using System.Diagnostics;
namespace HandlebarsDotNet.Extension.CompileFast
{
/// <summary>
///
/// </summary>
public static class CompileFastExtensions
{
/// <summary>
/// Changes <see cref="IExpressionCompiler"/> to the one using <c>FastExpressionCompiler</c>
/// </summary>
/// <param name="configuration"></param>
/// <returns></returns>
public static HandlebarsConfiguration UseCompileFast(this HandlebarsConfiguration configuration)
{
var compileTimeConfiguration = configuration.CompileTimeConfiguration;
compileTimeConfiguration.Features.Add(new FastCompilerFeatureFactory());
return configuration;
}
}
}
|
mit
|
C#
|
c8c45af07a7da6029f13213c4f47fa17cb6b3fbb
|
Update DockerContainerIdComponentTests.cs
|
MatthewKing/DeviceId
|
test/DeviceId.Tests/Components/DockerContainerIdComponentTests.cs
|
test/DeviceId.Tests/Components/DockerContainerIdComponentTests.cs
|
using DeviceId.Linux.Components;
using FluentAssertions;
using Xunit;
namespace DeviceId.Tests.Components;
public class DockerContainerIdComponentTests
{
[InlineData("non-existing", null)]
[InlineData("", null)]
[InlineData(null, null)]
[InlineData("Linux_4.4.txt", "cde7c2bab394630a42d73dc610b9c57415dced996106665d427f6d0566594411")]
[InlineData("Linux_4.8-4.13.txt", "afe96d48db6d2c19585572f986fc310c92421a3dac28310e847566fb82166013")]
[InlineData("linux_nodocker.txt", null)]
[Theory]
public void TestGetValue(string file, string expected)
{
DockerContainerIdComponent component = new DockerContainerIdComponent(file);
var componentValue = component.GetValue();
componentValue.Should().Be(expected);
}
}
|
using DeviceId.Linux.Components;
using FluentAssertions;
using Xunit;
namespace DeviceId.Tests.Components;
public class DockerContainerIdComponentTests
{
[InlineData("non-existing", null)]
[InlineData("", null)]
[InlineData(null, null)]
[InlineData("Linux_4.4.txt", "cde7c2bab394630a42d73dc610b9c57415dced996106665d427f6d0566594411")]
[InlineData("Linux_4.8-4.13.txt", "afe96d48db6d2c19585572f986fc310c92421a3dac28310e847566fb82166013")]
[Theory]
public void TestGetValue(string file, string expected)
{
DockerContainerIdComponent component = new DockerContainerIdComponent(file);
var componentValue = component.GetValue();
componentValue.Should().Be(expected);
}
}
|
mit
|
C#
|
4b08f0ba6d252d0d69e16f134c50bc483cefdf4d
|
Fix ordering of enum
|
CumpsD/knx.net,CumpsD/knx.net,CumpsD/knx.net,CumpsD/knx.net
|
src/KNXLib/Enums/KnxGroupAddressStyle.cs
|
src/KNXLib/Enums/KnxGroupAddressStyle.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace KNXLib.Enums
{
public enum KnxGroupAddressStyle
{
/// <summary>
/// Group addresses in the style of 'MainGroup/MiddleGroup/SubGroup'
/// Main => [0-31]
/// Middle => [0-7]
/// Sub => [0-255]
/// Example GA: 4/1/25
/// </summary>
ThreeLevel,
/// <summary>
/// Group addresses in the style of 'MainGroup/SubGroup'
/// Main => [0-31]
/// Sub => [0-2047]
/// Example GA: 4/1025
/// </summary>
TwoLevel,
/// <summary>
/// Group addresses in the style of 'SubGroup'
/// Sub => [1-65535]
/// Example GA: 6541
///
/// Available starting with ETS4
/// </summary>
Free
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace KNXLib.Enums
{
public enum KnxGroupAddressStyle
{
/// <summary>
/// Group addresses in the style of 'MainGroup/SubGroup'
/// Main => [0-31]
/// Sub => [0-2047]
/// Example GA: 4/1025
/// </summary>
TwoLevel,
/// <summary>
/// Group addresses in the style of 'MainGroup/MiddleGroup/SubGroup'
/// Main => [0-31]
/// Middle => [0-7]
/// Sub => [0-255]
/// Example GA: 4/1/25
/// </summary>
ThreeLevel,
/// <summary>
/// Group addresses in the style of 'SubGroup'
/// Sub => [1-65535]
/// Example GA: 6541
///
/// Available starting with ETS4
/// </summary>
Free
}
}
|
mit
|
C#
|
71001b6601a1bf620b806b5aed7fd1b61c9d0f76
|
Refactor sim.exe API
|
dsolovay/Sitecore-Instance-Manager,sergeyshushlyapin/Sitecore-Instance-Manager,Sitecore/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager
|
src/SIM.Core/Common/CommandResultBase.cs
|
src/SIM.Core/Common/CommandResultBase.cs
|
namespace SIM.Core.Common
{
using System;
using Sitecore.Diagnostics.Base.Annotations;
public class CommandResult<TResult> : CommandResult
{
/// <summary>
/// Optional command output data.
/// </summary>
[CanBeNull]
public TResult Data { get; set; }
}
public abstract class CommandResult
{
/// <summary>
/// Command success indicator.
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Optional message from command execution for comments clarifying situation when Success = false.
/// </summary>
[CanBeNull]
public string Message { get; set; }
/// <summary>
/// Command pure execution time.
/// </summary>
public TimeSpan Elapsed { get; set; }
/// <summary>
/// Exception details in JSON-friendly format.
/// </summary>
[CanBeNull]
public CustomException Error { get; set; }
}
}
|
namespace SIM.Core.Common
{
using System;
using System.Collections.Generic;
using Sitecore.Diagnostics.Base.Annotations;
public class CommandResult<TResult> : CommandResult
{
public TResult Data { get; set; }
}
public abstract class CommandResult
{
public bool Success { get; set; }
[CanBeNull]
public string Message { get; set; }
public TimeSpan Elapsed { get; set; }
public CustomException Error { get; set; }
}
}
|
mit
|
C#
|
bba3db783855b0c9234e7cecbb6643a431040b37
|
Remove junk code
|
gyrosworkshop/Wukong,gyrosworkshop/Wukong
|
src/Wukong/Controllers/SongController.cs
|
src/Wukong/Controllers/SongController.cs
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using Wukong.Models;
using Wukong.Options;
using Wukong.Services;
namespace Wukong.Controllers
{
[Route("api/song")]
public class SongController : Controller
{
private readonly IProvider Provider;
public SongController(IProvider provider)
{
Provider = provider;
}
[HttpPost("search")]
public async Task<IActionResult> Search([FromBody] SearchSongRequest query)
{
var song = await Provider.Search(query);
return new ObjectResult(song);
}
}
}
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using Wukong.Models;
using Wukong.Options;
using Wukong.Services;
namespace Wukong.Controllers
{
[Route("api/song")]
public class SongController : Controller
{
private readonly IProvider Provider;
public SongController(IProvider provider)
{
Provider = provider;
}
[HttpPost("search")]
public async Task<IActionResult> Search([FromBody] SearchSongRequest query)
{
HttpContext.Authentication.SignInAsync()
var song = await Provider.Search(query);
return new ObjectResult(song);
}
}
}
|
mit
|
C#
|
ad246009c087805a1787c97da85ec3fdca136ac6
|
Split out into multiple test methods
|
EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework
|
osu.Framework.Tests/Bindables/BindableWithCurrentTest.cs
|
osu.Framework.Tests/Bindables/BindableWithCurrentTest.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 NUnit.Framework;
using osu.Framework.Bindables;
namespace osu.Framework.Tests.Bindables
{
[TestFixture]
public class BindableWithCurrentTest
{
[Test]
public void TestBindableWithCurrentReceivesBoundValue()
{
const string expected_value = "test";
var bindable = new Bindable<string>(expected_value);
var bindableWithCurrent = new BindableWithCurrent<string> { Current = bindable };
Assert.That(bindable.Value, Is.EqualTo(expected_value));
Assert.That(bindableWithCurrent.Value, Is.EqualTo(expected_value));
}
[Test]
public void TestBindableWithCurrentReceivesValueChanges()
{
const string expected_value = "test2";
var bindable = new Bindable<string>();
var bindableWithCurrent = new BindableWithCurrent<string> { Current = bindable };
bindable.Value = expected_value;
Assert.That(bindableWithCurrent.Value, Is.EqualTo(expected_value));
}
[Test]
public void TestChangeCurrentDoesNotUnbindOthers()
{
const string expected_value = "test2";
var bindable1 = new Bindable<string>();
var bindable2 = bindable1.GetBoundCopy();
var bindableWithCurrent = new BindableWithCurrent<string> { Current = bindable1 };
bindableWithCurrent.Current = new Bindable<string>();
bindable1.Value = expected_value;
Assert.That(bindable2.Value, Is.EqualTo(expected_value));
Assert.That(bindableWithCurrent.Value, Is.Not.EqualTo(expected_value));
}
[Test]
public void TestChangeCurrentBindsToNewBindable()
{
const string expected_value = "test3";
var bindable1 = new Bindable<string>();
var bindable2 = new Bindable<string>();
var bindableWithCurrent = new BindableWithCurrent<string> { Current = bindable1 };
bindableWithCurrent.Current = bindable2;
bindableWithCurrent.Value = "test3";
Assert.That(bindable1.Value, Is.Not.EqualTo(expected_value));
Assert.That(bindable2.Value, Is.EqualTo(expected_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 NUnit.Framework;
using osu.Framework.Bindables;
namespace osu.Framework.Tests.Bindables
{
[TestFixture]
public class BindableWithCurrentTest
{
[Test]
public void TestChangeCurrentDoesntUnbindOthers()
{
Bindable<string> bindable = new Bindable<string>("test");
Bindable<string> boundBindable = bindable.GetBoundCopy();
Assert.That(boundBindable.Value, Is.EqualTo(bindable.Value));
var bindableWithCurrent = new BindableWithCurrent<string> { Current = bindable };
Assert.That(boundBindable.Value, Is.EqualTo(bindable.Value));
Assert.That(bindableWithCurrent.Value, Is.EqualTo(bindable.Value));
bindable.Value = "test2";
Assert.That(bindable.Value, Is.EqualTo("test2"));
Assert.That(boundBindable.Value, Is.EqualTo(bindable.Value));
Assert.That(bindableWithCurrent.Value, Is.EqualTo(bindable.Value));
bindableWithCurrent.Current = new Bindable<string>();
bindable.Value = "test3";
Assert.That(bindable.Value, Is.EqualTo("test3"));
Assert.That(boundBindable.Value, Is.EqualTo(bindable.Value));
Assert.That(bindableWithCurrent.Value, Is.Not.EqualTo(bindable.Value));
}
}
}
|
mit
|
C#
|
fc519a6e137617d95425cfacb32be8cef23c26a9
|
Remove unnecessary local lost (already using a locking list)
|
EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
|
osu.Framework/Graphics/OpenGL/Textures/TextureGLAtlas.cs
|
osu.Framework/Graphics/OpenGL/Textures/TextureGLAtlas.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;
using System.Linq;
using osu.Framework.Lists;
using osuTK.Graphics.ES30;
namespace osu.Framework.Graphics.OpenGL.Textures
{
/// <summary>
/// A TextureGL which is acting as the backing for an atlas.
/// </summary>
internal class TextureGLAtlas : TextureGLSingle
{
/// <summary>
/// Contains all currently-active <see cref="TextureGLAtlas"/>es.
/// </summary>
private static readonly LockedWeakList<TextureGLAtlas> all_atlases = new LockedWeakList<TextureGLAtlas>();
/// <summary>
/// Invoked when a new <see cref="TextureGLAtlas"/> is created.
/// </summary>
/// <remarks>
/// Invocation from the draw or update thread cannot be assumed.
/// </remarks>
public static event Action<TextureGLAtlas> TextureCreated;
public TextureGLAtlas(int width, int height, bool manualMipmaps, All filteringMode = All.Linear)
: base(width, height, manualMipmaps, filteringMode)
{
all_atlases.Add(this);
TextureCreated?.Invoke(this);
}
/// <summary>
/// Retrieves all currently-active <see cref="TextureGLAtlas"/>es.
/// </summary>
public static TextureGLAtlas[] GetAllAtlases() => all_atlases.ToArray();
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
all_atlases.Remove(this);
}
}
}
|
// 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;
using System.Linq;
using osu.Framework.Lists;
using osuTK.Graphics.ES30;
namespace osu.Framework.Graphics.OpenGL.Textures
{
/// <summary>
/// A TextureGL which is acting as the backing for an atlas.
/// </summary>
internal class TextureGLAtlas : TextureGLSingle
{
/// <summary>
/// Contains all currently-active <see cref="TextureGLAtlas"/>es.
/// </summary>
private static readonly LockedWeakList<TextureGLAtlas> all_atlases = new LockedWeakList<TextureGLAtlas>();
/// <summary>
/// Invoked when a new <see cref="TextureGLAtlas"/> is created.
/// </summary>
/// <remarks>
/// Invocation from the draw or update thread cannot be assumed.
/// </remarks>
public static event Action<TextureGLAtlas> TextureCreated;
public TextureGLAtlas(int width, int height, bool manualMipmaps, All filteringMode = All.Linear)
: base(width, height, manualMipmaps, filteringMode)
{
lock (all_atlases)
all_atlases.Add(this);
TextureCreated?.Invoke(this);
}
/// <summary>
/// Retrieves all currently-active <see cref="TextureGLAtlas"/>es.
/// </summary>
public static TextureGLAtlas[] GetAllAtlases()
{
lock (all_atlases)
return all_atlases.ToArray();
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
lock (all_atlases)
all_atlases.Remove(this);
}
}
}
|
mit
|
C#
|
28e5b12bf143b3c0f1d8f5e6099a59b0329d9847
|
Verify container LoadFrom under real testing
|
phatboyg/MassTransit,jacobpovar/MassTransit,SanSYS/MassTransit,SanSYS/MassTransit,MassTransit/MassTransit,MassTransit/MassTransit,phatboyg/MassTransit,jacobpovar/MassTransit
|
src/Containers/MassTransit.Containers.Tests/AutofacRegistrationExtension_Specs.cs
|
src/Containers/MassTransit.Containers.Tests/AutofacRegistrationExtension_Specs.cs
|
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Containers.Tests
{
using System.Reflection;
using System.Threading.Tasks;
using Autofac;
using NUnit.Framework;
using Saga;
using Scenarios;
[TestFixture]
public class AutofacContainer_RegistrationExtension
{
[Test]
public void Registration_extension_method_for_consumers()
{
var builder = new ContainerBuilder();
builder.RegisterConsumers(Assembly.GetExecutingAssembly());
var container = builder.Build();
Assert.That(container.IsRegistered<TestConsumer>(), Is.True);
}
[Test]
public async Task Throw_them_under_the_bus()
{
var builder = new ContainerBuilder();
builder.RegisterConsumers(Assembly.GetExecutingAssembly());
builder.RegisterType<InMemorySagaRepository<SimpleSaga>>()
.As<ISagaRepository<SimpleSaga>>()
.SingleInstance();
var container = builder.Build();
var busControl = Bus.Factory.CreateUsingInMemory(x =>
{
x.ReceiveEndpoint("input_queue", e => e.LoadFrom(container));
});
var busHandle = busControl.Start();
await busHandle.Ready;
busHandle.Stop();
}
}
public class TestConsumer : IConsumer
{
}
}
|
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Containers.Tests
{
using System.Threading.Tasks;
using Autofac;
using AutofacIntegration;
using NUnit.Framework;
[TestFixture]
public class AutofacContainer_RegistrationExtension
{
[Test]
public void Registration_extension_method_for_consumers()
{
var builder = new ContainerBuilder();
builder.RegisterConsumers(System.Reflection.Assembly.GetExecutingAssembly());
var container = builder.Build();
Assert.That(container.IsRegistered<TestConsumer>(), Is.True);
}
}
public class TestConsumer : IConsumer
{ }
}
|
apache-2.0
|
C#
|
d38939c0a081a1188a55ca66101c63d488dffccf
|
Remove unused using
|
picklesdoc/pickles,magicmonty/pickles,ludwigjossieaux/pickles,magicmonty/pickles,dirkrombauts/pickles,picklesdoc/pickles,picklesdoc/pickles,ludwigjossieaux/pickles,picklesdoc/pickles,magicmonty/pickles,dirkrombauts/pickles,dirkrombauts/pickles,magicmonty/pickles,dirkrombauts/pickles,ludwigjossieaux/pickles
|
src/Pickles/Pickles.TestFrameworks/CucumberJson/CucumberJsonSingleResultLoader.cs
|
src/Pickles/Pickles.TestFrameworks/CucumberJson/CucumberJsonSingleResultLoader.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CucumberJsonSingleResultLoader.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.IO.Abstractions;
namespace PicklesDoc.Pickles.TestFrameworks.CucumberJson
{
public class CucumberJsonSingleResultLoader : ISingleResultLoader
{
public SingleTestRunBase Load(FileInfoBase fileInfo)
{
return new CucumberJsonSingleResults(fileInfo);
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CucumberJsonSingleResultLoader.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// 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.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using System.IO.Abstractions;
using PicklesDoc.Pickles.ObjectModel;
namespace PicklesDoc.Pickles.TestFrameworks.CucumberJson
{
public class CucumberJsonSingleResultLoader : ISingleResultLoader
{
public SingleTestRunBase Load(FileInfoBase fileInfo)
{
return new CucumberJsonSingleResults(fileInfo);
}
}
}
|
apache-2.0
|
C#
|
3ce1a9f0bbea63fda534f42281a048c7a8b94c7b
|
clean up
|
tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web,tugberkugurlu/tugberk-web
|
src/Tugberk.Web/Startup.cs
|
src/Tugberk.Web/Startup.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace Tugberk.Web
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace Tugberk.Web
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
|
agpl-3.0
|
C#
|
39c570014826fb6a4fde3b64c31a91fbe31b440a
|
Add docs to RouteValuesAddress (#695)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Microsoft.AspNetCore.Routing/RouteValuesAddress.cs
|
src/Microsoft.AspNetCore.Routing/RouteValuesAddress.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Routing
{
/// <summary>
/// An address of route name and values.
/// </summary>
public class RouteValuesAddress
{
/// <summary>
/// Gets or sets the route name.
/// </summary>
public string RouteName { get; set; }
/// <summary>
/// Gets or sets the route values that are explicitly specified.
/// </summary>
public RouteValueDictionary ExplicitValues { get; set; }
/// <summary>
/// Gets or sets ambient route values from the current HTTP request.
/// </summary>
public RouteValueDictionary AmbientValues { get; set; }
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Routing
{
public class RouteValuesAddress
{
public string RouteName { get; set; }
public RouteValueDictionary ExplicitValues { get; set; }
public RouteValueDictionary AmbientValues { get; set; }
}
}
|
apache-2.0
|
C#
|
7fd8be120a953f90ad01c88f759275fc79239a70
|
Add optional messages to AssertX methods.
|
eylvisaker/AgateLib
|
AgateLib/Quality/AssertX.cs
|
AgateLib/Quality/AssertX.cs
|
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib.Quality
{
/// <summary>
/// Extra methods useful for testing that aren't in the MSTest Assert class.
/// </summary>
public static class AssertX
{
/// <summary>
/// Verifies that the method throws any exception.
/// </summary>
/// <param name="expression">A delegate or lambda which should throw an exception.</param>
/// <param name="message">A message to be displayed if the expression fails to throw an exception.</param>
[DebuggerStepThrough]
public static void Throws(Action expression, string message = null)
{
try
{
expression();
}
catch (Exception)
{
return;
}
throw new AssertFailedException(message ?? "Expression did not throw any exception.");
}
/// <summary>
/// Verifies that the method throws an exception of the specified type,
/// or an exception type deriving from it.
/// </summary>
/// <typeparam name="T">The base type of the exception which should be thrown.</typeparam>
/// <param name="expression">A delegate or lambda which should throw an exception.</param>
/// <param name="message">A message to be displayed if the expression fails to throw an exception of the specified type.</param>
[DebuggerStepThrough]
public static void Throws<T>(Action expression, string message = null) where T : Exception
{
try
{
expression();
}
catch (T)
{
return;
}
throw new AssertFailedException(message ?? string.Format("Expression did not throw {0}", typeof(T).Name));
}
}
}
|
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is AgateLib.
//
// The Initial Developer of the Original Code is Erik Ylvisaker.
// Portions created by Erik Ylvisaker are Copyright (C) 2006-2014.
// All Rights Reserved.
//
// Contributor(s): Erik Ylvisaker
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgateLib.Quality
{
/// <summary>
/// Extra methods that aren't in the MSTest Assert class.
/// </summary>
public static class AssertX
{
/// <summary>
/// Verifies that the method throws any exception.
/// </summary>
/// <param name="expression"></param>
public static void Throws(Action expression)
{
try
{
expression();
}
catch (Exception)
{
return;
}
throw new AssertFailedException("Expression did not throw any exception.");
}
/// <summary>
/// Verifies that the method throws an exception of the specified type,
/// or an exception type deriving from it.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="expression"></param>
public static void Throws<T>(Action expression) where T:Exception
{
try
{
expression();
}
catch (T)
{
return;
}
throw new AssertFailedException("Expression did not throw " + typeof(T).Name);
}
}
}
|
mit
|
C#
|
f9871842b2c97856763ad3175fa99a5225407f68
|
Check Push test
|
HCB2-NPT/QuanLyNhaSach
|
QuanLyNhaSach/Adapters/BookAdapter.cs
|
QuanLyNhaSach/Adapters/BookAdapter.cs
|
using QuanLyNhaSach.Managers;
using QuanLyNhaSach.Objects;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QuanLyNhaSach.Adapters
{
class BookAdapter
{
public static ObservableCollection<Book> GetAllBook()
{
ObservableCollection<Book> result = null;
try
{
var reader = DataConnector.ExecuteQuery("select Sach.MaSach,TenSach,TenTheLoai,TenTacGia,SoLuongTon,DonGia,AnhBia,BiXoa"+
"from Sach,TacGia,TheLoai,ChiTietTheLoaiSach,ChiTietTacGiaSach"+
"where Sach.MaSach = ChiTietTheLoaiSach.MaSach and ChiTietTheLoaiSach.MaTheLoai = TheLoai.MaTheLoai and Sach.MaSach=ChiTietTacGiaSach.MaSach and ChiTietTacGiaSach.MaTacGia=TacGia.MaTacGia");
if (reader!=null)
{
result = new ObservableCollection<Book>();
Book b;
while (reader.Read())
{
b = new Book();
}
}
}
catch (Exception ex)
{
ErrorManager.Current.DataCantBeRead.Call(ex.Message);
}
return result;
}
}
}
|
using QuanLyNhaSach.Managers;
using QuanLyNhaSach.Objects;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QuanLyNhaSach.Adapters
{
class BookAdapter
{
public static ObservableCollection<Book> GetAllBook()
{
ObservableCollection<Book> result = null;
try
{
var reader = DataConnector.ExecuteQuery("select Sach.MaSach,TenSach,TenTheLoai,TenTacGia,SoLuongTon,DonGia,AnhBia,BiXoa"+
"from Sach,TacGia,TheLoai,ChiTietTheLoaiSach,ChiTietTacGiaSach"+
"where Sach.MaSach = ChiTietTheLoaiSach.MaSach and ChiTietTheLoaiSach.MaTheLoai = TheLoai.MaTheLoai and Sach.MaSach=ChiTietTacGiaSach.MaSach and ChiTietTacGiaSach.MaTacGia=TacGia.MaTacGia");
if (reader!=null)
{
result = new ObservableCollection<Book>();
Book b;
while (reader.Read())
{
}
}
}
catch (Exception ex)
{
ErrorManager.Current.DataCantBeRead.Call(ex.Message);
}
return result;
}
}
}
|
mit
|
C#
|
fe8a44691650fc8f03bf032cac8c334dc4602e30
|
Remove unnecessary comment
|
ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
|
osu.Framework.iOS/Graphics/Textures/IOSTextureLoaderStore.cs
|
osu.Framework.iOS/Graphics/Textures/IOSTextureLoaderStore.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;
using System.IO;
using System.Runtime.InteropServices;
using CoreGraphics;
using Foundation;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using SixLabors.ImageSharp;
using UIKit;
namespace osu.Framework.iOS.Graphics.Textures
{
public class IOSTextureLoaderStore : TextureLoaderStore
{
public IOSTextureLoaderStore(IResourceStore<byte[]> store)
: base(store)
{
}
protected override unsafe Image<TPixel> ImageFromStream<TPixel>(Stream stream)
{
using (var uiImage = UIImage.LoadFromData(NSData.FromStream(stream)))
{
int width = (int)uiImage.Size.Width;
int height = (int)uiImage.Size.Height;
IntPtr data = Marshal.AllocHGlobal(width * height * 4);
using (CGBitmapContext textureContext = new CGBitmapContext(data, width, height, 8, width * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
textureContext.DrawImage(new CGRect(0, 0, width, height), uiImage.CGImage);
var image = Image.LoadPixelData<TPixel>(
new ReadOnlySpan<byte>(data.ToPointer(), width * height * 4),
width, height);
Marshal.FreeHGlobal(data);
return image;
}
}
}
}
|
// 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;
using System.IO;
using System.Runtime.InteropServices;
using CoreGraphics;
using Foundation;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using SixLabors.ImageSharp;
using UIKit;
namespace osu.Framework.iOS.Graphics.Textures
{
public class IOSTextureLoaderStore : TextureLoaderStore
{
public IOSTextureLoaderStore(IResourceStore<byte[]> store)
: base(store)
{
}
protected override unsafe Image<TPixel> ImageFromStream<TPixel>(Stream stream)
{
using (var uiImage = UIImage.LoadFromData(NSData.FromStream(stream)))
{
int width = (int)uiImage.Size.Width;
int height = (int)uiImage.Size.Height;
IntPtr data = Marshal.AllocHGlobal(width * height * 4);
using (CGBitmapContext textureContext = new CGBitmapContext(data, width, height, 8, width * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast))
textureContext.DrawImage(new CGRect(0, 0, width, height), uiImage.CGImage);
// NOTE: this will probably only be correct for Rgba32, will need to look into other pixel formats
var image = Image.LoadPixelData<TPixel>(
new ReadOnlySpan<byte>(data.ToPointer(), width * height * 4),
width, height);
Marshal.FreeHGlobal(data);
return image;
}
}
}
}
|
mit
|
C#
|
f6d387353720ceecfc82032dacec6e1b13992047
|
remove rsvp from common includes and replace jquery ui with slim embedded version
|
WasimAhmad/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity
|
Serenity.Web/Common/CommonIncludes.cs
|
Serenity.Web/Common/CommonIncludes.cs
|
namespace Serenity.Web
{
public static class CommonIncludes
{
public static readonly string[] Scripts = new string[]
{
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui.js",
"~/Scripts/jquery-ui-i18n.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/jquery.blockUI.js",
"~/Scripts/jquery.cookie.js",
"~/Scripts/jquery.json.js",
"~/Scripts/jquery.autoNumeric.js",
"~/Scripts/jquery.colorbox.js",
"~/Scripts/jquery.dialogextendQ.js",
"~/Scripts/jquery.event.drag.js",
"~/Scripts/jquery.scrollintoview.js",
"~/Scripts/select2.js",
"~/Scripts/sortable.js",
"~/Scripts/toastr.js",
"~/Scripts/SlickGrid/slick.core.js",
"~/Scripts/SlickGrid/slick.grid.js",
"~/Scripts/SlickGrid/slick.groupitemmetadataprovider.js",
"~/Scripts/SlickGrid/Plugins/slick.autotooltips.js",
"~/Scripts/SlickGrid/Plugins/slick.headerbuttons.js",
"~/Scripts/bootstrap.js",
"~/Scripts/saltarelle/mscorlib.js",
"~/Scripts/serenity/Serenity.CoreLib.js",
"~/Scripts/serenity/Serenity.Script.UI.js"
};
public static readonly string[] Styles = new string[]
{
"~/Content/aristo/aristo.css",
"~/Content/bootstrap.css",
"~/Content/colorbox/jquery.colorbox.css",
"~/Content/slick.grid.css",
"~/Content/css/select2.css",
"~/Content/toastr.css",
"~/Content/serenity/serenity.css",
};
}
}
|
namespace Serenity.Web
{
public static class CommonIncludes
{
public static readonly string[] Scripts = new string[]
{
"~/Scripts/rsvp.js",
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery-ui-i18n.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/jquery.blockUI.js",
"~/Scripts/jquery.cookie.js",
"~/Scripts/jquery.json.js",
"~/Scripts/jquery.autoNumeric.js",
"~/Scripts/jquery.colorbox.js",
"~/Scripts/jquery.dialogextendQ.js",
"~/Scripts/jquery.event.drag.js",
"~/Scripts/jquery.scrollintoview.js",
"~/Scripts/select2.js",
"~/Scripts/sortable.js",
"~/Scripts/toastr.js",
"~/Scripts/SlickGrid/slick.core.js",
"~/Scripts/SlickGrid/slick.grid.js",
"~/Scripts/SlickGrid/slick.groupitemmetadataprovider.js",
"~/Scripts/SlickGrid/Plugins/slick.autotooltips.js",
"~/Scripts/SlickGrid/Plugins/slick.headerbuttons.js",
"~/Scripts/bootstrap.js",
"~/Scripts/saltarelle/mscorlib.js",
"~/Scripts/serenity/Serenity.CoreLib.js",
"~/Scripts/serenity/Serenity.Script.UI.js"
};
public static readonly string[] Styles = new string[]
{
"~/Content/aristo/aristo.css",
"~/Content/bootstrap.css",
"~/Content/colorbox/jquery.colorbox.css",
"~/Content/slick.grid.css",
"~/Content/css/select2.css",
"~/Content/toastr.css",
"~/Content/serenity/serenity.css",
};
}
}
|
mit
|
C#
|
d86ea58b4ec38148403d62acf2144765c216dc30
|
fix broken snippet
|
WojcikMike/docs.particular.net
|
Snippets/Snippets_4/Pipeline/NewStep/NewPipelineStep.cs
|
Snippets/Snippets_4/Pipeline/NewStep/NewPipelineStep.cs
|
namespace Snippets4.Pipeline.NewStep
{
using NServiceBus.Pipeline;
using NServiceBus.Pipeline.Contexts;
using NServiceBus.Unicast.Behaviors;
#region NewPipelineStep 4.5
class NewStepInPipeline : PipelineOverride
{
public override void Override(BehaviorList<HandlerInvocationContext> behaviorList)
{
behaviorList.InsertAfter<InvokeHandlersBehavior, SampleBehavior>();
}
//Classes inheriting from PipelineOverride are registered by convention. No need to explicitly register.
}
#endregion
}
|
namespace Snippets4.Pipeline.NewStep
{
using NServiceBus.Pipeline;
using NServiceBus.Pipeline.Contexts;
using NServiceBus.Unicast.Behaviors;
#region NewStepInPipeline 4.5
class NewStepInPipeline : PipelineOverride
{
public override void Override(BehaviorList<HandlerInvocationContext> behaviorList)
{
behaviorList.InsertAfter<InvokeHandlersBehavior, SampleBehavior>();
}
//Classes inheriting from PipelineOverride are registered by convention. No need to explicitly register.
}
#endregion
}
|
apache-2.0
|
C#
|
9392c45559211f3cc89ed543f54832f5b1f85866
|
Change name of test
|
jamesfoster/DeepEqual
|
src/DeepEqual.Test/Bug/ComparingTypesWithPublicFields.cs
|
src/DeepEqual.Test/Bug/ComparingTypesWithPublicFields.cs
|
namespace DeepEqual.Test.Bug
{
using DeepEqual.Syntax;
using Shouldly;
using Xunit;
public class ComparingTypesWithPublicFields
{
[Fact]
public static void Should_consider_public_fields_when_comparing_complex_objects()
{
var expected = new Data
{
Id = 1,
Name = "Joe"
};
var actual = new Data
{
Id = 2,
Name = "Joe"
};
actual.IsDeepEqual(expected).ShouldBe(false);
}
public class Data
{
public int Id;
public string Name { get; set; }
}
}
}
|
namespace DeepEqual.Test.Bug
{
using DeepEqual.Syntax;
using Shouldly;
using Xunit;
public class ComparingTypesWithPublicFields
{
[Fact]
public static void TestIgnoreByType()
{
var expected = new Data
{
Id = 1,
Name = "Joe"
};
var actual = new Data
{
Id = 2,
Name = "Joe"
};
actual.IsDeepEqual(expected).ShouldBe(false);
}
public class Data
{
public int Id;
public string Name { get; set; }
}
}
}
|
mit
|
C#
|
bd60bf5aa9b52c823750f5380e6f0289a74273ab
|
Update Stock.cs
|
IanMcT/StockMarketGame
|
SMG/SMG/Stock.cs
|
SMG/SMG/Stock.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SMG
{
class Stock
{
static Random r = new Random();
/// <summary>
/// Name of the Stock
/// </summary>
public string StockName;
/// <summary>
/// Description of the Stock
/// </summary>
public string StockDescription;
/// <summary>
/// The last four or so points for the Stock
/// </summary>
public List<double> StockHistory;
/// <summary>
/// scale of one to ten determining if its going to be low risk or high risk
/// </summary>
public double StockRisk;
/// <summary>
/// what percent payout the stock is going to have
/// </summary>
public double StockReturn;
public bool isStockUp()
{
if (StockHistory.Count >1 && this.StockHistory[StockHistory.Count - 1] > this.StockHistory[StockHistory.Count - 2])
{
return true;
}else{
return false;
}
}
public override string ToString()
{
string temp = this.StockName + " - " +
this.StockDescription;
foreach (double d in this.StockHistory)
{
temp += ", " + d.ToString("$0.00");
}
temp += " Return: " + this.StockReturn +
" Risk: " + this.StockRisk;
return temp;
}
/// <summary>
/// Creates the stock
/// </summary>
/// <param name="sn">name</param>
/// <param name="sd">description</param>
/// <param name="sh">History</param>
/// <param name="sri">Risk</param>
/// <param name="sre">Return</param>
public Stock(string sn, string sd, List<double> sh, double sri, double sre)
{
this.StockName = sn;
this.StockDescription = sd;
this.StockHistory = sh;
this.StockRisk = sri;
this.StockReturn = sre;
if (StockHistory.Count < 1)
{
for (int i = 0; i < 10; i++)
{
StockHistory.Add(r.NextDouble() * 1000);
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SMG
{
class Stock
{
/// <summary>
/// Name of the Stock
/// </summary>
public string StockName;
/// <summary>
/// Description of the Stock
/// </summary>
public string StockDescription;
/// <summary>
/// The last four or so points for the Stock
/// </summary>
public double StockHistory;
/// <summary>
/// scale of one to ten determining if its going to be low risk or high risk
/// </summary>
public double StockRisk;
/// <summary>
/// what percent payout the stock is going to have
/// </summary>
public double StockReturn;
public Stock(string sn, string sd, double sh, double sri, double sre)
{
this.StockName = sn;
this.StockDescription = sd;
this.StockHistory = sh;
this.StockRisk = sri;
this.StockReturn = sre;
}
}
}
|
apache-2.0
|
C#
|
2c57c724dc5b3b8b93ec90e23cca8d5f2367c7f1
|
Change sql procedure modified: BookShopDAL/OrderMainDAL.cs
|
lizhen325/Online-Shopping,lizhen325/Online-Shopping,lizhen325/Online-Shopping
|
BookShopDAL/OrderMainDAL.cs
|
BookShopDAL/OrderMainDAL.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Data;
using System.Data.SqlClient;
namespace BookShopDAL
{
public class OrderMainDAL
{
/// <summary>
/// execute procedure
/// </summary>
/// <param name="orderId"></param>
/// <param name="customerId"></param>
/// <returns></returns>
public int ExecProc(string orderId, int customerId)
{
SqlParameter[] ps = {
new SqlParameter("@OrderId",orderId),
new SqlParameter("@CustomerId",customerId)
};
int rowAffected;
SqlHelper.RunProcedure("InsertOrderss", ps, out rowAffected);
return rowAffected;
}
//alter proc InsertOrders
//@OrderId varchar(50),
//@CustomerId int
//as
//begin
// begin tran
// begin try
// declare @total decimal(6,2)
// select @total = sum(BookCount*BookUnitPrice)from CartInfo where CustomerId=@CustomerId
// insert into OrderMain (OrderId,CustomerId,OrderDate,Price)values(@OrderId,@CustomerId,GETDATE(),@total)
// insert into OrderDep (OrderId,BookId,BookCount)
// select @OrderId,BookId,BookCount from CartInfo where CustomerId=@CustomerId
// commit tran
// end try
// begin catch
// rollback tran
// end catch
//end
//exec InsertOrders '2016030422181735',35
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Data;
using System.Data.SqlClient;
namespace BookShopDAL
{
public class OrderMainDAL
{
/// <summary>
/// execute procedure
/// </summary>
/// <param name="orderId"></param>
/// <param name="customerId"></param>
/// <returns></returns>
public int ExecProc(string orderId, int customerId)
{
SqlParameter[] ps = {
new SqlParameter("@OrderId",orderId),
new SqlParameter("@CustomerId",customerId)
};
int rowAffected;
SqlHelper.RunProcedure("InsertOrders", ps, out rowAffected);
return rowAffected;
}
//create proc InsertOrders
//@OrderId varchar(50),
//@CustomerId int
//as
//begin
// begin tran
// begin try
// declare @total decimal(6,2)
// select @total = sum(BookCount*BookUnitPrice)from CartInfo where CustomerId=@CustomerId
// insert into OrderMain (OrderId,CustomerId,OrderDate,Price)values(@OrderId,@CustomerId,GETDATE(),@total)
// insert into OrderDep (OrderId,BookId,BookCount)
// select @OrderId,BookId,BookCount from CartInfo where CustomerId=@CustomerId
// commit tran
// end try
// begin catch
// rollback tran
// end catch
//end
//exec InsertOrders '2016030422181735',35
}
}
|
mit
|
C#
|
37a47c96accb8e66694eb6bbacbe2fa8d0202495
|
Move diff bar to the right of the line numbers (like in the GitSCC extension)
|
laurentkempe/GitDiffMargin,modulexcite/GitDiffMargin
|
GitDiffMargin/EditorDiffMarginFactory.cs
|
GitDiffMargin/EditorDiffMarginFactory.cs
|
#region using
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
#endregion
namespace GitDiffMargin
{
[Export(typeof (IWpfTextViewMarginProvider))]
[Name(EditorDiffMargin.MarginNameConst)]
[Order(After = PredefinedMarginNames.Spacer, Before = PredefinedMarginNames.Outlining)]
[MarginContainer(PredefinedMarginNames.LeftSelection)]
[ContentType("text")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal sealed class EditorDiffMarginFactory : DiffMarginFactoryBase
{
public override IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
var marginCore = TryGetMarginCore(textViewHost);
if (marginCore == null)
return null;
return new EditorDiffMargin(textViewHost.TextView, marginCore);
}
}
}
|
#region using
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
#endregion
namespace GitDiffMargin
{
[Export(typeof (IWpfTextViewMarginProvider))]
[Name(EditorDiffMargin.MarginNameConst)]
[Order(Before = PredefinedMarginNames.LineNumber)]
[MarginContainer(PredefinedMarginNames.LeftSelection)]
[ContentType("text")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal sealed class EditorDiffMarginFactory : DiffMarginFactoryBase
{
public override IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
var marginCore = TryGetMarginCore(textViewHost);
if (marginCore == null)
return null;
return new EditorDiffMargin(textViewHost.TextView, marginCore);
}
}
}
|
mit
|
C#
|
22b234186f8ff8eb42e36fb8e319c31b63f44799
|
Use an externally-provided SmtpClient in MailKitEmailClient.
|
brendanjbaker/Bakery
|
src/Bakery.Mail.MailKit/Bakery/Mail/MailKit/MailKitEmailClient.cs
|
src/Bakery.Mail.MailKit/Bakery/Mail/MailKit/MailKitEmailClient.cs
|
namespace Bakery.Mail.MailKit
{
using global::MailKit.Net.Smtp;
using global::MailKit.Security;
using System;
using System.Threading.Tasks;
public class MailKitEmailClient
: IEmailClient
{
private readonly IMimeMessageFactory mimeMessageFactory;
private readonly Func<SmtpClient> smtpClientFactory;
private readonly ISmtpConfiguration smtpConfiguration;
public MailKitEmailClient(
IMimeMessageFactory mimeMessageFactory,
Func<SmtpClient> smtpClientFactory,
ISmtpConfiguration smtpConfiguration)
{
if (mimeMessageFactory == null)
throw new ArgumentNullException(nameof(mimeMessageFactory));
if (smtpClientFactory == null)
throw new ArgumentNullException(nameof(smtpClientFactory));
if (smtpConfiguration == null)
throw new ArgumentNullException(nameof(smtpConfiguration));
this.mimeMessageFactory = mimeMessageFactory;
this.smtpClientFactory = smtpClientFactory;
this.smtpConfiguration = smtpConfiguration;
}
public async Task SendAsync(IEmail email)
{
if (email == null)
throw new ArgumentNullException(nameof(email));
var mimeMessage = mimeMessageFactory.Create(email);
using (var smtpClient = smtpClientFactory())
{
await smtpClient.ConnectAsync(
smtpConfiguration.Server,
smtpConfiguration.Port,
SecureSocketOptions.StartTls);
await smtpClient.AuthenticateAsync(
smtpConfiguration.Username,
smtpConfiguration.Password);
await smtpClient.SendAsync(mimeMessage);
await smtpClient.DisconnectAsync(true);
}
}
}
}
|
namespace Bakery.Mail.MailKit
{
using global::MailKit.Net.Smtp;
using global::MailKit.Security;
using System;
using System.Threading.Tasks;
public class MailKitEmailClient
: IEmailClient
{
private readonly IMimeMessageFactory mimeMessageFactory;
private readonly SmtpClient smtpClient;
private readonly ISmtpConfiguration smtpConfiguration;
public MailKitEmailClient(
IMimeMessageFactory mimeMessageFactory,
SmtpClient smtpClient,
ISmtpConfiguration smtpConfiguration)
{
if (mimeMessageFactory == null)
throw new ArgumentNullException(nameof(mimeMessageFactory));
if (smtpClient == null)
throw new ArgumentNullException(nameof(smtpClient));
if (smtpConfiguration == null)
throw new ArgumentNullException(nameof(smtpConfiguration));
this.mimeMessageFactory = mimeMessageFactory;
this.smtpClient = smtpClient;
this.smtpConfiguration = smtpConfiguration;
}
public async Task SendAsync(IEmail email)
{
if (email == null)
throw new ArgumentNullException(nameof(email));
var mimeMessage = mimeMessageFactory.Create(email);
await smtpClient.ConnectAsync(
smtpConfiguration.Server,
smtpConfiguration.Port,
SecureSocketOptions.StartTls);
await smtpClient.AuthenticateAsync(
smtpConfiguration.Username,
smtpConfiguration.Password);
await smtpClient.SendAsync(mimeMessage);
await smtpClient.DisconnectAsync(true);
}
}
}
|
mit
|
C#
|
c69031894a03639cc9dd5d97fbb56870d3b4256e
|
add comments
|
928PJY/docfx,superyyrrzz/docfx,hellosnow/docfx,hellosnow/docfx,dotnet/docfx,pascalberger/docfx,dotnet/docfx,DuncanmaMSFT/docfx,hellosnow/docfx,superyyrrzz/docfx,928PJY/docfx,LordZoltan/docfx,dotnet/docfx,sergey-vershinin/docfx,LordZoltan/docfx,superyyrrzz/docfx,LordZoltan/docfx,LordZoltan/docfx,pascalberger/docfx,pascalberger/docfx,928PJY/docfx,DuncanmaMSFT/docfx,sergey-vershinin/docfx,sergey-vershinin/docfx
|
src/Microsoft.DocAsCode.MarkdownLite/IMarkdownContext.cs
|
src/Microsoft.DocAsCode.MarkdownLite/IMarkdownContext.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.MarkdownLite
{
using System.Collections.Immutable;
/// <summary>
/// The context for markdown parser.
/// </summary>
public interface IMarkdownContext
{
/// <summary>
/// The rule set for current context.
/// </summary>
ImmutableList<IMarkdownRule> Rules { get; }
/// <summary>
/// The variables.
/// </summary>
ImmutableDictionary<string, object> Variables { get; }
/// <summary>
/// Create a new context with different variables.
/// </summary>
/// <param name="variables">The new variables.</param>
/// <returns>a new instance of <see cref="IMarkdownContext"/></returns>
IMarkdownContext CreateContext(ImmutableDictionary<string, object> variables);
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.MarkdownLite
{
using System.Collections.Immutable;
public interface IMarkdownContext
{
ImmutableList<IMarkdownRule> Rules { get; }
ImmutableDictionary<string, object> Variables { get; }
IMarkdownContext CreateContext(ImmutableDictionary<string, object> variables);
}
}
|
mit
|
C#
|
9e2279bdddfd8b5824cda2f92907cd205751e9e6
|
Remove random context cleanup console output
|
gphoto/libgphoto2.OLDMIGRATION,gphoto/libgphoto2.OLDMIGRATION,gphoto/libgphoto2.OLDMIGRATION,gphoto/libgphoto2.OLDMIGRATION
|
bindings/csharp/Context.cs
|
bindings/csharp/Context.cs
|
using System;
using System.Runtime.InteropServices;
namespace LibGPhoto2
{
public class Context : Object
{
[DllImport ("libgphoto2.so")]
internal static extern IntPtr gp_context_new ();
public Context ()
{
this.handle = new HandleRef (this, gp_context_new ());
}
[DllImport ("libgphoto2.so")]
internal static extern void gp_context_unref (HandleRef context);
protected override void Cleanup ()
{
gp_context_unref(handle);
}
}
}
|
using System;
using System.Runtime.InteropServices;
namespace LibGPhoto2
{
public class Context : Object
{
[DllImport ("libgphoto2.so")]
internal static extern IntPtr gp_context_new ();
public Context ()
{
this.handle = new HandleRef (this, gp_context_new ());
}
[DllImport ("libgphoto2.so")]
internal static extern void gp_context_unref (HandleRef context);
protected override void Cleanup ()
{
System.Console.WriteLine ("cleanup context");
gp_context_unref(handle);
}
}
}
|
lgpl-2.1
|
C#
|
cc9a800812d0d1bf32b5baa5bc77f8348bf8200f
|
Add support for `SupportAddress` on `Account` create and update
|
stripe/stripe-dotnet
|
src/Stripe.net/Services/Accounts/AccountBusinessProfileOptions.cs
|
src/Stripe.net/Services/Accounts/AccountBusinessProfileOptions.cs
|
namespace Stripe
{
using System;
using Newtonsoft.Json;
public class AccountBusinessProfileOptions : INestedOptions
{
/// <summary>
/// The merchant category code for the account. MCCs are used to classify businesses based
/// on the goods or services they provide.
/// </summary>
[JsonProperty("mcc")]
public string Mcc { get; set; }
/// <summary>
/// The customer-facing business name.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
[Obsolete("Use AccountSettingsBrandingOptions.PrimaryColor instead.")]
[JsonProperty("primary_color")]
public string PrimaryColor { get; set; }
/// <summary>
/// Internal-only description of the product sold by, or service provided by, the business.
/// Used by Stripe for risk and underwriting purposes.
/// </summary>
[JsonProperty("product_description")]
public string ProductDescription { get; set; }
/// <summary>
/// A publicly available mailing address for sending support issues to.
/// </summary>
[JsonProperty("support_address")]
public AddressOptions SupportAddress { get; set; }
/// <summary>
/// A publicly available email address for sending support issues to.
/// </summary>
[JsonProperty("support_email")]
public string SupportEmail { get; set; }
/// <summary>
/// A publicly available phone number to call with support issues.
/// </summary>
[JsonProperty("support_phone")]
public string SupportPhone { get; set; }
/// <summary>
/// A publicly available website for handling support issues.
/// </summary>
[JsonProperty("support_url")]
public string SupportUrl { get; set; }
/// <summary>
/// The business’s publicly available website.
/// </summary>
[JsonProperty("url")]
public string Url { get; set; }
}
}
|
namespace Stripe
{
using Newtonsoft.Json;
public class AccountBusinessProfileOptions : INestedOptions
{
[JsonProperty("mcc")]
public string Mcc { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("primary_color")]
public string PrimaryColor { get; set; }
[JsonProperty("product_description")]
public string ProductDescription { get; set; }
[JsonProperty("support_email")]
public string SupportEmail { get; set; }
[JsonProperty("support_phone")]
public string SupportPhone { get; set; }
[JsonProperty("support_url")]
public string SupportUrl { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
}
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.