commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 1
4.87k
| subject
stringlengths 15
778
| message
stringlengths 15
8.75k
| lang
stringclasses 266
values | license
stringclasses 13
values | repos
stringlengths 5
127k
|
|---|---|---|---|---|---|---|---|---|---|
2256b348fb5a58a215a2a661c8a9185a43f5f947
|
CarFuel/Controllers/CarsController.cs
|
CarFuel/Controllers/CarsController.cs
|
using CarFuel.DataAccess;
using CarFuel.Models;
using CarFuel.Services;
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CarFuel.Controllers
{
public class CarsController : Controller
{
private ICarDb db;
private CarService carService;
public CarsController()
{
db = new CarDb();
carService = new CarService(db);
}
[Authorize]
public ActionResult Index()
{
var userId = new Guid(User.Identity.GetUserId());
IEnumerable<Car> cars = carService.GetCarsByMember(userId);
return View(cars);
}
[Authorize]
public ActionResult Create()
{
return View();
}
[HttpPost]
[Authorize]
public ActionResult Create(Car item)
{
var userId = new Guid(User.Identity.GetUserId());
try
{
carService.AddCar(item, userId);
}
catch (OverQuotaException ex)
{
TempData["error"] = ex.Message;
}
return RedirectToAction("Index");
}
public ActionResult Details(Guid id)
{
var userId = new Guid(User.Identity.GetUserId());
var c = carService.GetCarsByMember(userId).SingleOrDefault(x => x.Id == id);
return View(c);
}
}
}
|
using CarFuel.DataAccess;
using CarFuel.Models;
using CarFuel.Services;
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
namespace CarFuel.Controllers
{
public class CarsController : Controller
{
private ICarDb db;
private CarService carService;
public CarsController()
{
db = new CarDb();
carService = new CarService(db);
}
[Authorize]
public ActionResult Index()
{
var userId = new Guid(User.Identity.GetUserId());
IEnumerable<Car> cars = carService.GetCarsByMember(userId);
return View(cars);
}
[Authorize]
public ActionResult Create()
{
return View();
}
[HttpPost]
[Authorize]
public ActionResult Create(Car item)
{
var userId = new Guid(User.Identity.GetUserId());
try
{
carService.AddCar(item, userId);
}
catch (OverQuotaException ex)
{
TempData["error"] = ex.Message;
}
return RedirectToAction("Index");
}
public ActionResult Details(Guid? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var userId = new Guid(User.Identity.GetUserId());
var c = carService.GetCarsByMember(userId).SingleOrDefault(x => x.Id == id);
return View(c);
}
}
}
|
Handle null id for Cars/Details action
|
Handle null id for Cars/Details action
If users don't supply id value in the URL,
instead of displaying YSOD, we are now return BadRequest.
|
C#
|
mit
|
ajaree/tdd-carfuel,ajaree/tdd-carfuel,ajaree/tdd-carfuel
|
801c46ea042f96b729a28c133b35de5c72e83095
|
src/Orchard.Web/Modules/Orchard.Users/DataMigrations/UsersDataMigration.cs
|
src/Orchard.Web/Modules/Orchard.Users/DataMigrations/UsersDataMigration.cs
|
using Orchard.Data.Migration;
namespace Orchard.Users.DataMigrations {
public class UsersDataMigration : DataMigrationImpl {
public int Create() {
//CREATE TABLE Orchard_Users_UserRecord (Id INTEGER not null, UserName TEXT, Email TEXT, NormalizedUserName TEXT, Password TEXT, PasswordFormat TEXT, PasswordSalt TEXT, primary key (Id));
SchemaBuilder.CreateTable("UserRecord", table => table
.ContentPartRecord()
.Column<string>("UserName")
.Column<string>("Email")
.Column<string>("NormalizedUserName")
.Column<string>("Password")
.Column<string>("PasswordFormat")
.Column<string>("PasswordSalt")
);
return 0010;
}
}
}
|
using Orchard.Data.Migration;
namespace Orchard.Users.DataMigrations {
public class UsersDataMigration : DataMigrationImpl {
public int Create() {
//CREATE TABLE Orchard_Users_UserRecord (Id INTEGER not null, UserName TEXT, Email TEXT, NormalizedUserName TEXT, Password TEXT, PasswordFormat TEXT, PasswordSalt TEXT, primary key (Id));
SchemaBuilder.CreateTable("UserRecord", table => table
.ContentPartRecord()
.Column<string>("UserName")
.Column<string>("Email")
.Column<string>("NormalizedUserName")
.Column<string>("Password")
.Column<string>("PasswordFormat")
.Column<string>("HashAlgorithm")
.Column<string>("PasswordSalt")
);
return 0010;
}
}
}
|
Fix data migration code for UserRecord
|
Fix data migration code for UserRecord
Issue came from last merge from Default...
--HG--
branch : dev
|
C#
|
bsd-3-clause
|
jersiovic/Orchard,planetClaire/Orchard-LETS,qt1/orchard4ibn,KeithRaven/Orchard,grapto/Orchard.CloudBust,DonnotRain/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,qt1/orchard4ibn,planetClaire/Orchard-LETS,SzymonSel/Orchard,hbulzy/Orchard,m2cms/Orchard,SouleDesigns/SouleDesigns.Orchard,jchenga/Orchard,JRKelso/Orchard,fortunearterial/Orchard,stormleoxia/Orchard,vairam-svs/Orchard,TaiAivaras/Orchard,spraiin/Orchard,salarvand/Portal,jaraco/orchard,SzymonSel/Orchard,xkproject/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Sylapse/Orchard.HttpAuthSample,aaronamm/Orchard,yersans/Orchard,bigfont/orchard-continuous-integration-demo,armanforghani/Orchard,Anton-Am/Orchard,TalaveraTechnologySolutions/Orchard,ehe888/Orchard,jerryshi2007/Orchard,Anton-Am/Orchard,Codinlab/Orchard,jagraz/Orchard,vairam-svs/Orchard,hannan-azam/Orchard,OrchardCMS/Orchard,rtpHarry/Orchard,SouleDesigns/SouleDesigns.Orchard,kouweizhong/Orchard,IDeliverable/Orchard,salarvand/orchard,dcinzona/Orchard,qt1/orchard4ibn,geertdoornbos/Orchard,LaserSrl/Orchard,enspiral-dev-academy/Orchard,Praggie/Orchard,aaronamm/Orchard,bigfont/orchard-cms-modules-and-themes,emretiryaki/Orchard,arminkarimi/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,OrchardCMS/Orchard-Harvest-Website,geertdoornbos/Orchard,TaiAivaras/Orchard,harmony7/Orchard,rtpHarry/Orchard,vairam-svs/Orchard,Cphusion/Orchard,cooclsee/Orchard,enspiral-dev-academy/Orchard,grapto/Orchard.CloudBust,emretiryaki/Orchard,gcsuk/Orchard,MpDzik/Orchard,MetSystem/Orchard,omidnasri/Orchard,KeithRaven/Orchard,smartnet-developers/Orchard,ehe888/Orchard,Lombiq/Orchard,LaserSrl/Orchard,asabbott/chicagodevnet-website,hbulzy/Orchard,qt1/Orchard,AEdmunds/beautiful-springtime,brownjordaninternational/OrchardCMS,OrchardCMS/Orchard-Harvest-Website,IDeliverable/Orchard,SzymonSel/Orchard,yersans/Orchard,xiaobudian/Orchard,AEdmunds/beautiful-springtime,infofromca/Orchard,NIKASoftwareDevs/Orchard,spraiin/Orchard,SzymonSel/Orchard,TalaveraTechnologySolutions/Orchard,RoyalVeterinaryCollege/Orchard,escofieldnaxos/Orchard,fortunearterial/Orchard,vard0/orchard.tan,Lombiq/Orchard,qt1/orchard4ibn,OrchardCMS/Orchard-Harvest-Website,tobydodds/folklife,OrchardCMS/Orchard-Harvest-Website,mgrowan/Orchard,angelapper/Orchard,austinsc/Orchard,yersans/Orchard,sfmskywalker/Orchard,MpDzik/Orchard,huoxudong125/Orchard,IDeliverable/Orchard,sfmskywalker/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,qt1/Orchard,TaiAivaras/Orchard,jerryshi2007/Orchard,dcinzona/Orchard,AndreVolksdorf/Orchard,dozoft/Orchard,cryogen/orchard,alejandroaldana/Orchard,TalaveraTechnologySolutions/Orchard,DonnotRain/Orchard,MetSystem/Orchard,cooclsee/Orchard,oxwanawxo/Orchard,caoxk/orchard,armanforghani/Orchard,vard0/orchard.tan,andyshao/Orchard,Dolphinsimon/Orchard,bigfont/orchard-cms-modules-and-themes,jtkech/Orchard,Ermesx/Orchard,yonglehou/Orchard,grapto/Orchard.CloudBust,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jimasp/Orchard,grapto/Orchard.CloudBust,infofromca/Orchard,sebastienros/msc,dcinzona/Orchard-Harvest-Website,andyshao/Orchard,ericschultz/outercurve-orchard,Serlead/Orchard,cryogen/orchard,jtkech/Orchard,enspiral-dev-academy/Orchard,dcinzona/Orchard-Harvest-Website,hhland/Orchard,andyshao/Orchard,Lombiq/Orchard,TalaveraTechnologySolutions/Orchard,rtpHarry/Orchard,omidnasri/Orchard,jagraz/Orchard,bedegaming-aleksej/Orchard,escofieldnaxos/Orchard,KeithRaven/Orchard,angelapper/Orchard,dozoft/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,ericschultz/outercurve-orchard,JRKelso/Orchard,luchaoshuai/Orchard,AndreVolksdorf/Orchard,cooclsee/Orchard,yonglehou/Orchard,Inner89/Orchard,johnnyqian/Orchard,marcoaoteixeira/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,jtkech/Orchard,sfmskywalker/Orchard,MetSystem/Orchard,SeyDutch/Airbrush,hannan-azam/Orchard,AdvantageCS/Orchard,brownjordaninternational/OrchardCMS,spraiin/Orchard,Morgma/valleyviewknolls,jagraz/Orchard,smartnet-developers/Orchard,jersiovic/Orchard,NIKASoftwareDevs/Orchard,harmony7/Orchard,Anton-Am/Orchard,ehe888/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dburriss/Orchard,ehe888/Orchard,hannan-azam/Orchard,TalaveraTechnologySolutions/Orchard,RoyalVeterinaryCollege/Orchard,Praggie/Orchard,salarvand/orchard,kgacova/Orchard,neTp9c/Orchard,stormleoxia/Orchard,brownjordaninternational/OrchardCMS,Cphusion/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,DonnotRain/Orchard,OrchardCMS/Orchard-Harvest-Website,jtkech/Orchard,oxwanawxo/Orchard,Fogolan/OrchardForWork,tobydodds/folklife,fassetar/Orchard,angelapper/Orchard,li0803/Orchard,li0803/Orchard,emretiryaki/Orchard,TaiAivaras/Orchard,ericschultz/outercurve-orchard,emretiryaki/Orchard,jersiovic/Orchard,Inner89/Orchard,vard0/orchard.tan,LaserSrl/Orchard,qt1/Orchard,MetSystem/Orchard,vard0/orchard.tan,harmony7/Orchard,hbulzy/Orchard,Lombiq/Orchard,hhland/Orchard,Dolphinsimon/Orchard,abhishekluv/Orchard,salarvand/orchard,Cphusion/Orchard,OrchardCMS/Orchard,AEdmunds/beautiful-springtime,jimasp/Orchard,hhland/Orchard,dburriss/Orchard,mvarblow/Orchard,asabbott/chicagodevnet-website,gcsuk/Orchard,fassetar/Orchard,fortunearterial/Orchard,sfmskywalker/Orchard,Cphusion/Orchard,marcoaoteixeira/Orchard,neTp9c/Orchard,DonnotRain/Orchard,armanforghani/Orchard,smartnet-developers/Orchard,openbizgit/Orchard,Anton-Am/Orchard,bedegaming-aleksej/Orchard,Ermesx/Orchard,dcinzona/Orchard-Harvest-Website,Dolphinsimon/Orchard,sfmskywalker/Orchard,spraiin/Orchard,Inner89/Orchard,bigfont/orchard-cms-modules-and-themes,Cphusion/Orchard,Ermesx/Orchard,TalaveraTechnologySolutions/Orchard,jimasp/Orchard,omidnasri/Orchard,yersans/Orchard,AdvantageCS/Orchard,escofieldnaxos/Orchard,Serlead/Orchard,li0803/Orchard,JRKelso/Orchard,xkproject/Orchard,Codinlab/Orchard,SeyDutch/Airbrush,stormleoxia/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,TalaveraTechnologySolutions/Orchard,phillipsj/Orchard,jagraz/Orchard,bedegaming-aleksej/Orchard,jersiovic/Orchard,dcinzona/Orchard,MpDzik/Orchard,Praggie/Orchard,phillipsj/Orchard,kgacova/Orchard,geertdoornbos/Orchard,aaronamm/Orchard,alejandroaldana/Orchard,grapto/Orchard.CloudBust,hannan-azam/Orchard,rtpHarry/Orchard,dburriss/Orchard,austinsc/Orchard,jimasp/Orchard,jaraco/orchard,hannan-azam/Orchard,angelapper/Orchard,johnnyqian/Orchard,marcoaoteixeira/Orchard,OrchardCMS/Orchard,Dolphinsimon/Orchard,RoyalVeterinaryCollege/Orchard,tobydodds/folklife,phillipsj/Orchard,dburriss/Orchard,kgacova/Orchard,patricmutwiri/Orchard,OrchardCMS/Orchard,mvarblow/Orchard,sebastienros/msc,dcinzona/Orchard,Praggie/Orchard,planetClaire/Orchard-LETS,yersans/Orchard,mvarblow/Orchard,li0803/Orchard,patricmutwiri/Orchard,hhland/Orchard,neTp9c/Orchard,MpDzik/Orchard,vard0/orchard.tan,stormleoxia/Orchard,JRKelso/Orchard,AdvantageCS/Orchard,arminkarimi/Orchard,patricmutwiri/Orchard,Serlead/Orchard,geertdoornbos/Orchard,patricmutwiri/Orchard,Anton-Am/Orchard,asabbott/chicagodevnet-website,abhishekluv/Orchard,dozoft/Orchard,emretiryaki/Orchard,vairam-svs/Orchard,SouleDesigns/SouleDesigns.Orchard,salarvand/orchard,Ermesx/Orchard,SeyDutch/Airbrush,luchaoshuai/Orchard,kouweizhong/Orchard,marcoaoteixeira/Orchard,aaronamm/Orchard,fortunearterial/Orchard,NIKASoftwareDevs/Orchard,RoyalVeterinaryCollege/Orchard,SzymonSel/Orchard,omidnasri/Orchard,OrchardCMS/Orchard,arminkarimi/Orchard,Inner89/Orchard,huoxudong125/Orchard,andyshao/Orchard,grapto/Orchard.CloudBust,dcinzona/Orchard,escofieldnaxos/Orchard,KeithRaven/Orchard,sfmskywalker/Orchard,AndreVolksdorf/Orchard,asabbott/chicagodevnet-website,infofromca/Orchard,andyshao/Orchard,harmony7/Orchard,yonglehou/Orchard,dcinzona/Orchard-Harvest-Website,cooclsee/Orchard,patricmutwiri/Orchard,oxwanawxo/Orchard,salarvand/orchard,dozoft/Orchard,caoxk/orchard,brownjordaninternational/OrchardCMS,mgrowan/Orchard,TaiAivaras/Orchard,openbizgit/Orchard,Serlead/Orchard,JRKelso/Orchard,Serlead/Orchard,m2cms/Orchard,vairam-svs/Orchard,Fogolan/OrchardForWork,dmitry-urenev/extended-orchard-cms-v10.1,abhishekluv/Orchard,yonglehou/Orchard,kouweizhong/Orchard,Sylapse/Orchard.HttpAuthSample,huoxudong125/Orchard,Codinlab/Orchard,infofromca/Orchard,dozoft/Orchard,hbulzy/Orchard,Morgma/valleyviewknolls,omidnasri/Orchard,AndreVolksdorf/Orchard,mvarblow/Orchard,arminkarimi/Orchard,fassetar/Orchard,salarvand/Portal,openbizgit/Orchard,qt1/Orchard,tobydodds/folklife,mgrowan/Orchard,stormleoxia/Orchard,openbizgit/Orchard,xkproject/Orchard,kgacova/Orchard,qt1/orchard4ibn,dmitry-urenev/extended-orchard-cms-v10.1,jimasp/Orchard,luchaoshuai/Orchard,Fogolan/OrchardForWork,qt1/orchard4ibn,oxwanawxo/Orchard,tobydodds/folklife,austinsc/Orchard,Fogolan/OrchardForWork,SeyDutch/Airbrush,dmitry-urenev/extended-orchard-cms-v10.1,kgacova/Orchard,xiaobudian/Orchard,bigfont/orchard-continuous-integration-demo,infofromca/Orchard,jerryshi2007/Orchard,MpDzik/Orchard,IDeliverable/Orchard,dburriss/Orchard,angelapper/Orchard,MetSystem/Orchard,escofieldnaxos/Orchard,kouweizhong/Orchard,Morgma/valleyviewknolls,jtkech/Orchard,jchenga/Orchard,caoxk/orchard,ehe888/Orchard,phillipsj/Orchard,abhishekluv/Orchard,bigfont/orchard-continuous-integration-demo,salarvand/Portal,qt1/Orchard,salarvand/Portal,austinsc/Orchard,jaraco/orchard,sfmskywalker/Orchard,johnnyqian/Orchard,austinsc/Orchard,mgrowan/Orchard,bigfont/orchard-cms-modules-and-themes,planetClaire/Orchard-LETS,AdvantageCS/Orchard,caoxk/orchard,neTp9c/Orchard,neTp9c/Orchard,abhishekluv/Orchard,mvarblow/Orchard,luchaoshuai/Orchard,Sylapse/Orchard.HttpAuthSample,SouleDesigns/SouleDesigns.Orchard,omidnasri/Orchard,jerryshi2007/Orchard,m2cms/Orchard,omidnasri/Orchard,jersiovic/Orchard,luchaoshuai/Orchard,kouweizhong/Orchard,bigfont/orchard-continuous-integration-demo,NIKASoftwareDevs/Orchard,enspiral-dev-academy/Orchard,xiaobudian/Orchard,li0803/Orchard,jchenga/Orchard,cooclsee/Orchard,openbizgit/Orchard,smartnet-developers/Orchard,sfmskywalker/Orchard,AdvantageCS/Orchard,hbulzy/Orchard,huoxudong125/Orchard,mgrowan/Orchard,m2cms/Orchard,sebastienros/msc,jagraz/Orchard,harmony7/Orchard,cryogen/orchard,Fogolan/OrchardForWork,yonglehou/Orchard,LaserSrl/Orchard,xiaobudian/Orchard,johnnyqian/Orchard,johnnyqian/Orchard,SeyDutch/Airbrush,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,Ermesx/Orchard,gcsuk/Orchard,jchenga/Orchard,abhishekluv/Orchard,sebastienros/msc,sebastienros/msc,tobydodds/folklife,cryogen/orchard,Morgma/valleyviewknolls,m2cms/Orchard,omidnasri/Orchard,aaronamm/Orchard,fortunearterial/Orchard,fassetar/Orchard,brownjordaninternational/OrchardCMS,bedegaming-aleksej/Orchard,MpDzik/Orchard,hhland/Orchard,jchenga/Orchard,Praggie/Orchard,gcsuk/Orchard,bigfont/orchard-cms-modules-and-themes,ericschultz/outercurve-orchard,Lombiq/Orchard,fassetar/Orchard,huoxudong125/Orchard,jerryshi2007/Orchard,geertdoornbos/Orchard,jaraco/orchard,KeithRaven/Orchard,planetClaire/Orchard-LETS,armanforghani/Orchard,xkproject/Orchard,alejandroaldana/Orchard,xiaobudian/Orchard,AEdmunds/beautiful-springtime,dcinzona/Orchard-Harvest-Website,smartnet-developers/Orchard,Sylapse/Orchard.HttpAuthSample,omidnasri/Orchard,OrchardCMS/Orchard-Harvest-Website,arminkarimi/Orchard,DonnotRain/Orchard,Dolphinsimon/Orchard,xkproject/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,LaserSrl/Orchard,Inner89/Orchard,enspiral-dev-academy/Orchard,NIKASoftwareDevs/Orchard,rtpHarry/Orchard,oxwanawxo/Orchard,phillipsj/Orchard,gcsuk/Orchard,Codinlab/Orchard,armanforghani/Orchard,vard0/orchard.tan,Codinlab/Orchard,IDeliverable/Orchard,spraiin/Orchard,alejandroaldana/Orchard,dcinzona/Orchard-Harvest-Website,salarvand/Portal,AndreVolksdorf/Orchard,RoyalVeterinaryCollege/Orchard,Morgma/valleyviewknolls,marcoaoteixeira/Orchard,alejandroaldana/Orchard,Sylapse/Orchard.HttpAuthSample,TalaveraTechnologySolutions/Orchard,bedegaming-aleksej/Orchard
|
1b8d034f53363ff2cf392df4689e7f24426a8e49
|
CITS/Models/MathProblemModel.cs
|
CITS/Models/MathProblemModel.cs
|
using System;
namespace CITS.Models
{
public class MathProblemModel : ProblemModel
{
public MathProblemModel(string Problem, string Solution):base(Problem,Solution){}
public override Boolean IsSolutionCorrect(String candidateSolution)
{
return Solution.Equals(candidateSolution.Trim());
}
}
}
|
using System;
using System.Collections.Generic;
namespace CITS.Models
{
public class MathProblemModel : ProblemModel
{
public MathProblemModel(string problem, string solution, List<String> listOfHints):base(problem,solution, listOfHints){}
public override Boolean IsSolutionCorrect(String candidateSolution)
{
return Solution.Equals(candidateSolution.Trim());
}
}
}
|
Support list of hints per problem
|
Support list of hints per problem
|
C#
|
mit
|
Kakarot/CITS
|
e76a61e1378d8726c76fd72f4af1abd850ef8674
|
src/TypeCatalogParser/Main.cs
|
src/TypeCatalogParser/Main.cs
|
using System;
using System.IO;
using System.Linq;
using NuGet.Frameworks;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Graph;
using Microsoft.Extensions.DependencyModel.Resolution;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
// The TypeCatalogGen project takes this as input
var outputPath = "../TypeCatalogGen/powershell.inc";
// Get a context for our top level project
var context = ProjectContext.Create("../Microsoft.PowerShell.CoreConsoleHost", NuGetFramework.Parse("netcoreapp1.0"));
System.IO.File.WriteAllLines(outputPath,
// Get the target for the current runtime
from t in context.LockFile.Targets where t.RuntimeIdentifier == Constants.RuntimeIdentifier
// Get the packages (not projects)
from x in t.Libraries where x.Type == "package"
// Get the real reference assemblies
from y in x.CompileTimeAssemblies where y.Path.EndsWith(".dll")
// Construct the path to the assemblies
select $"{context.PackagesDirectory}/{x.Name}/{x.Version}/{y.Path};");
Console.WriteLine($"List of reference assemblies written to {outputPath}");
}
}
}
|
using System;
using System.IO;
using System.Linq;
using NuGet.Frameworks;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Graph;
using Microsoft.Extensions.DependencyModel.Resolution;
namespace TypeCatalogParser
{
public class Program
{
public static void Main(string[] args)
{
// The TypeCatalogGen project takes this as input
var outputPath = "../TypeCatalogGen/powershell.inc";
// Get a context for our top level project
var context = ProjectContext.Create("../powershell", NuGetFramework.Parse("netcoreapp1.0"));
System.IO.File.WriteAllLines(outputPath,
// Get the target for the current runtime
from t in context.LockFile.Targets where t.RuntimeIdentifier == Constants.RuntimeIdentifier
// Get the packages (not projects)
from x in t.Libraries where x.Type == "package"
// Get the real reference assemblies
from y in x.CompileTimeAssemblies where y.Path.EndsWith(".dll")
// Construct the path to the assemblies
select $"{context.PackagesDirectory}/{x.Name}/{x.Version}/{y.Path};");
Console.WriteLine($"List of reference assemblies written to {outputPath}");
}
}
}
|
Update TypeCatalogParser for CoreConsoleHost removal
|
Update TypeCatalogParser for CoreConsoleHost removal
|
C#
|
mit
|
kmosher/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,bmanikm/PowerShell,jsoref/PowerShell,JamesWTruher/PowerShell-1,kmosher/PowerShell,JamesWTruher/PowerShell-1,PaulHigin/PowerShell,TravisEz13/PowerShell,TravisEz13/PowerShell,kmosher/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,PaulHigin/PowerShell,KarolKaczmarek/PowerShell,jsoref/PowerShell,TravisEz13/PowerShell,bmanikm/PowerShell,bingbing8/PowerShell,PaulHigin/PowerShell,kmosher/PowerShell,KarolKaczmarek/PowerShell,daxian-dbw/PowerShell,jsoref/PowerShell,JamesWTruher/PowerShell-1,KarolKaczmarek/PowerShell,bingbing8/PowerShell,bingbing8/PowerShell,jsoref/PowerShell,daxian-dbw/PowerShell,daxian-dbw/PowerShell,daxian-dbw/PowerShell,kmosher/PowerShell,TravisEz13/PowerShell,bmanikm/PowerShell,jsoref/PowerShell,bingbing8/PowerShell,JamesWTruher/PowerShell-1,bingbing8/PowerShell,PaulHigin/PowerShell
|
4985332ee2298709b782025c221628f8b663288a
|
Assets/General/Scripts/DisableMouse.cs
|
Assets/General/Scripts/DisableMouse.cs
|
using UnityEngine;
using UnityEngine.EventSystems;
class DisableMouse : MonoBehaviour
{
// private stuff we don't want the editor to see
private GameObject m_lastSelectedGameObject;
// this is called by unity before start
void Awake()
{
m_lastSelectedGameObject = new GameObject();
}
// this is called by unity every frame
void Update()
{
// check if we have an active ui
if ( EventSystem.current != null )
{
// check if we have a currently selected game object
if ( EventSystem.current.currentSelectedGameObject == null )
{
// nope - the mouse may have stolen it - give it back to the last selected game object
EventSystem.current.SetSelectedGameObject( m_lastSelectedGameObject );
}
else if ( EventSystem.current.currentSelectedGameObject != m_lastSelectedGameObject )
{
// we changed our selection - remember it
m_lastSelectedGameObject = EventSystem.current.currentSelectedGameObject;
}
}
}
}
|
using UnityEngine;
using UnityEngine.EventSystems;
class DisableMouse : MonoBehaviour
{
// private stuff we don't want the editor to see
private GameObject m_lastSelectedGameObject;
// this is called by unity before start
void Awake()
{
m_lastSelectedGameObject = new GameObject();
}
// this is called by unity every frame
void Update()
{
// check if we have an active ui
if ( false && ( EventSystem.current != null ) )
{
// check if we have a currently selected game object
if ( EventSystem.current.currentSelectedGameObject == null )
{
// nope - the mouse may have stolen it - give it back to the last selected game object
EventSystem.current.SetSelectedGameObject( m_lastSelectedGameObject );
}
else if ( EventSystem.current.currentSelectedGameObject != m_lastSelectedGameObject )
{
// we changed our selection - remember it
m_lastSelectedGameObject = EventSystem.current.currentSelectedGameObject;
}
}
}
}
|
Disable the disable mouse script for now
|
Disable the disable mouse script for now
|
C#
|
unlicense
|
mherbold/starflight,mherbold/starflight,mherbold/starflight
|
10114fb952c4ea5a486a04d839ffe50960f404e3
|
MyPersonalAccountsModel/Controller/IInventoryController.cs
|
MyPersonalAccountsModel/Controller/IInventoryController.cs
|
using com.techphernalia.MyPersonalAccounts.Model.Inventory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace com.techphernalia.MyPersonalAccounts.Model.Controller
{
public interface IInventoryController
{
#region Stock Unit
List<StockUnit> GetAllStockUnits();
StockUnit GetStockUnitFromId(int unitId);
int AddStockUnit(StockUnit stockUnit);
bool UpdateStockUnit(StockUnit stockUnit);
bool DeleteStockUnit(int unitId);
#endregion
#region Stock Group
List<StockGroup> GetAllStockGroups();
List<StockGroup> GetStockGroupsForGroup(int stockGroupId);
StockGroup GetStockGroupFromId(int stockGroupId);
int AddStockGroup(StockItem stockItem);
bool UpdateStockGroup(StockItem stockItem);
bool DeleteStockGroup(int stockGroupId);
#endregion
#region Stock Item
List<StockItem> GetAllStockItems();
List<StockItem> GetStockItemsForGroup(int stockGroupId);
StockItem GetStockItemFromId(int stockItemId);
int AddStockItem(StockGroup stockGroup);
bool UpdateStockItem(StockGroup stockGroup);
bool DeleteStockItemI(int stockItemId);
#endregion
}
}
|
using com.techphernalia.MyPersonalAccounts.Model.Inventory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace com.techphernalia.MyPersonalAccounts.Model.Controller
{
public interface IInventoryController
{
#region Stock Unit
List<StockUnit> GetAllStockUnits();
StockUnit GetStockUnitFromId(int unitId);
int AddStockUnit(StockUnit stockUnit);
void UpdateStockUnit(StockUnit stockUnit);
void DeleteStockUnit(int unitId);
#endregion
#region Stock Group
List<StockGroup> GetAllStockGroups();
List<StockGroup> GetStockGroupsForGroup(int stockGroupId);
StockGroup GetStockGroupFromId(int stockGroupId);
int AddStockGroup(StockItem stockItem);
bool UpdateStockGroup(StockItem stockItem);
bool DeleteStockGroup(int stockGroupId);
#endregion
#region Stock Item
List<StockItem> GetAllStockItems();
List<StockItem> GetStockItemsForGroup(int stockGroupId);
StockItem GetStockItemFromId(int stockItemId);
int AddStockItem(StockGroup stockGroup);
bool UpdateStockItem(StockGroup stockGroup);
bool DeleteStockItemI(int stockItemId);
#endregion
}
}
|
Update interface for return type
|
Update interface for return type
|
C#
|
mit
|
techphernalia/MyPersonalAccounts
|
ce8c30fd845ad27adb795a797f07378787a5bf93
|
Source/Lib/TraktApiSharp/Objects/Get/Shows/Episodes/TraktEpisodeIds.cs
|
Source/Lib/TraktApiSharp/Objects/Get/Shows/Episodes/TraktEpisodeIds.cs
|
namespace TraktApiSharp.Objects.Get.Shows.Episodes
{
using Basic;
public class TraktEpisodeIds : TraktIds
{
}
}
|
namespace TraktApiSharp.Objects.Get.Shows.Episodes
{
using Basic;
/// <summary>A collection of ids for various web services, including the Trakt id, for a Trakt episode.</summary>
public class TraktEpisodeIds : TraktIds
{
}
}
|
Add documentation for episode ids.
|
Add documentation for episode ids.
|
C#
|
mit
|
henrikfroehling/TraktApiSharp
|
60368346e6f1b6345b90acaf89887a2833789513
|
src/GeekLearning.Domain.AspnetCore/DomainExceptionFilter.cs
|
src/GeekLearning.Domain.AspnetCore/DomainExceptionFilter.cs
|
namespace GeekLearning.Domain.AspnetCore
{
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
public class DomainExceptionFilter : IActionFilter
{
private ILoggerFactory loggerFactory;
private IOptions<DomainOptions> options;
public DomainExceptionFilter(ILoggerFactory loggerFactory, IOptions<DomainOptions> domainOptions)
{
this.loggerFactory = loggerFactory;
this.options = domainOptions;
}
public void OnActionExecuted(ActionExecutedContext context)
{
if (context.Exception != null)
{
var domainException = context.Exception as DomainException;
var logger = this.loggerFactory.CreateLogger<DomainExceptionFilter>();
if (domainException == null)
{
logger.LogError(new EventId(1, "Unknown error"), context.Exception.Message, context.Exception);
domainException = new Explanations.Unknown().AsException(context.Exception);
}
context.Result = new MaybeResult<object>(domainException.Explanation);
context.ExceptionHandled = true;
}
}
public void OnActionExecuting(ActionExecutingContext context)
{
}
}
}
|
namespace GeekLearning.Domain.AspnetCore
{
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
public class DomainExceptionFilter : IActionFilter
{
private ILoggerFactory loggerFactory;
private IOptions<DomainOptions> options;
public DomainExceptionFilter(ILoggerFactory loggerFactory, IOptions<DomainOptions> domainOptions)
{
this.loggerFactory = loggerFactory;
this.options = domainOptions;
}
public void OnActionExecuted(ActionExecutedContext context)
{
if (context.Exception != null)
{
var domainException = context.Exception as DomainException;
var logger = this.loggerFactory.CreateLogger<DomainExceptionFilter>();
if (domainException == null)
{
logger.LogError(new EventId(1, "Unknown error"), context.Exception, context.Exception.Message);
domainException = new Explanations.Unknown().AsException(context.Exception);
}
context.Result = new MaybeResult<object>(domainException.Explanation);
context.ExceptionHandled = true;
}
}
public void OnActionExecuting(ActionExecutingContext context)
{
}
}
}
|
Fix DomainException LogError parameter order
|
Fix DomainException LogError parameter order
|
C#
|
mit
|
geeklearningio/gl-dotnet-domain
|
d3eb24e70a2861cbfbe3f5d3759bf67f1cb23628
|
osu.Game/Rulesets/Scoring/Score.cs
|
osu.Game/Rulesets/Scoring/Score.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;
namespace osu.Game.Rulesets.Scoring
{
public class Score
{
public ScoreRank Rank { get; set; }
public double TotalScore { get; set; }
public double Accuracy { get; set; }
public double Health { get; set; } = 1;
public double? PP { get; set; }
public int MaxCombo { get; set; }
public int Combo { get; set; }
public RulesetInfo Ruleset { get; set; }
public Mod[] Mods { get; set; } = { };
public User User;
public Replay Replay;
public BeatmapInfo Beatmap;
public long OnlineScoreID;
public DateTimeOffset Date;
public Dictionary<HitResult, object> Statistics = new Dictionary<HitResult, object>();
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;
namespace osu.Game.Rulesets.Scoring
{
public class Score
{
public ScoreRank Rank { get; set; }
public double TotalScore { get; set; }
public double Accuracy { get; set; }
public double Health { get; set; } = 1;
public double? PP { get; set; }
public int MaxCombo { get; set; }
public int Combo { get; set; }
public RulesetInfo Ruleset { get; set; }
public Mod[] Mods { get; set; } = { };
public User User;
[JsonIgnore]
public Replay Replay;
public BeatmapInfo Beatmap;
public long OnlineScoreID;
public DateTimeOffset Date;
public Dictionary<HitResult, object> Statistics = new Dictionary<HitResult, object>();
}
}
|
Fix score retrieval no longer working
|
Fix score retrieval no longer working
|
C#
|
mit
|
UselessToucan/osu,2yangk23/osu,peppy/osu,ZLima12/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,johnneijzen/osu,2yangk23/osu,naoey/osu,DrabWeb/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,johnneijzen/osu,smoogipooo/osu,NeoAdonis/osu,DrabWeb/osu,NeoAdonis/osu,smoogipoo/osu,naoey/osu,DrabWeb/osu,EVAST9919/osu,naoey/osu,UselessToucan/osu,ZLima12/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu-new
|
e70a14b83093d3c85e6b6d0c04fe9a78691f149d
|
twoinone-windows-test/TwoinoneTest.cs
|
twoinone-windows-test/TwoinoneTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace xwalk
{
class TwoinoneTest
{
static void Main(string[] args)
{
Emulator emulator = new Emulator();
TabletMonitor monitor = new TabletMonitor(emulator);
monitor.TabletModeDelegate = onTabletModeChanged;
monitor.start();
Console.WriteLine("Main: " + monitor.IsTablet);
bool isTabletEmulated = monitor.IsTablet;
// Fudge mainloop
int tick = 0;
while (true) {
Thread.Sleep(500);
Console.Write(".");
tick++;
if (tick % 10 == 0)
{
Console.WriteLine("");
isTabletEmulated = !isTabletEmulated;
emulator.IsTablet = isTabletEmulated;
}
}
}
private static void onTabletModeChanged(bool isTablet)
{
Console.WriteLine("onTabletModeChanged: " + isTablet);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace xwalk
{
class TwoinoneTest
{
static void Main(string[] args)
{
if (args.Length > 0 && args[0] == "emulator")
{
runEmulator();
}
else
{
run();
}
}
static void run()
{
Emulator emulator = new Emulator();
TabletMonitor monitor = new TabletMonitor(emulator);
monitor.TabletModeDelegate = onTabletModeChanged;
monitor.start();
Console.WriteLine("Main: " + monitor.IsTablet);
// Fudge mainloop
int tick = 0;
while (true)
{
Thread.Sleep(500);
Console.Write(".");
tick++;
if (tick % 10 == 0)
{
Console.WriteLine("");
Console.WriteLine("Tablet mode " + monitor.IsTablet);
}
}
}
static void runEmulator()
{
Emulator emulator = new Emulator();
TabletMonitor monitor = new TabletMonitor(emulator);
monitor.TabletModeDelegate = onTabletModeChanged;
monitor.start();
Console.WriteLine("Main: " + monitor.IsTablet);
bool isTabletEmulated = monitor.IsTablet;
// Fudge mainloop
int tick = 0;
while (true)
{
Thread.Sleep(500);
Console.Write(".");
tick++;
if (tick % 10 == 0)
{
Console.WriteLine("");
isTabletEmulated = !isTabletEmulated;
emulator.IsTablet = isTabletEmulated;
}
}
}
private static void onTabletModeChanged(bool isTablet)
{
Console.WriteLine("onTabletModeChanged: " + isTablet);
}
}
}
|
Enable testing in emulated or actual device mode
|
Enable testing in emulated or actual device mode
|
C#
|
bsd-3-clause
|
crosswalk-project/crosswalk-extensions-twoinone,crosswalk-project/crosswalk-extensions-twoinone,crosswalk-project/crosswalk-extensions-twoinone
|
cafd5d06b4d795234d155dd4148b8b460739eea5
|
Lbookshelf/Utils/ChangeThumbnailBehavior.cs
|
Lbookshelf/Utils/ChangeThumbnailBehavior.cs
|
using Lbookshelf.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interactivity;
namespace Lbookshelf.Utils
{
public class ChangeThumbnailBehavior : Behavior<FrameworkElement>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.MouseLeftButtonUp += ShowChooseThumbnailDialog;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.MouseLeftButtonUp -= ShowChooseThumbnailDialog;
}
private void ShowChooseThumbnailDialog(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
DialogService.ShowOpenFileDialog(
fileName =>
{
// Note that when editing a book, we are actually
// editing a clone of the original book.
// The changes can be safely discarded if the user
// cancel the edit. So feel free to change the
// value of Thumbnail. The BookManager is responsible
// for copying the new thumbnail.
var book = (Book)AssociatedObject.DataContext;
book.Thumbnail = fileName;
}, "Image files|*.jpg", ".jpg");
}
}
}
|
using Lbookshelf.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interactivity;
namespace Lbookshelf.Utils
{
public class ChangeThumbnailBehavior : Behavior<FrameworkElement>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.MouseLeftButtonUp += ShowChooseThumbnailDialog;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.MouseLeftButtonUp -= ShowChooseThumbnailDialog;
}
private void ShowChooseThumbnailDialog(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
DialogService.ShowOpenFileDialog(
fileName =>
{
// Note that when editing a book, we are actually
// editing a clone of the original book.
// The changes can be safely discarded if the user
// cancel the edit. So feel free to change the
// value of Thumbnail. The BookManager is responsible
// for copying the new thumbnail.
var book = (Book)AssociatedObject.DataContext;
book.Thumbnail = fileName;
}, "Image files|*.jpg;*.png", ".jpg");
}
}
}
|
Enable the user to choose PNG file as thumbnail.
|
Enable the user to choose PNG file as thumbnail.
|
C#
|
mit
|
allenlooplee/Lbookshelf
|
2d829dc3539b86d5ee1c7e2116bf45bdea3318ca
|
Samples/Toolkit/Desktop/MiniCube/Program.cs
|
Samples/Toolkit/Desktop/MiniCube/Program.cs
|
// Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
//
// 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 MiniCube
{
/// <summary>
/// Simple MiniCube application using SharpDX.Toolkit.
/// </summary>
class Program
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
#if NETFX_CORE
[MTAThread]
#else
[STAThread]
#endif
static void Main()
{
using (var program = new SphereGame())
program.Run();
}
}
}
|
// Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
//
// 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 MiniCube
{
/// <summary>
/// Simple MiniCube application using SharpDX.Toolkit.
/// </summary>
class Program
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
#if NETFX_CORE
[MTAThread]
#else
[STAThread]
#endif
static void Main()
{
using (var program = new MiniCubeGame())
program.Run();
}
}
}
|
Fix compilation error in sample
|
[Build] Fix compilation error in sample
|
C#
|
mit
|
VirusFree/SharpDX,fmarrabal/SharpDX,sharpdx/SharpDX,davidlee80/SharpDX-1,andrewst/SharpDX,mrvux/SharpDX,manu-silicon/SharpDX,davidlee80/SharpDX-1,shoelzer/SharpDX,PavelBrokhman/SharpDX,TigerKO/SharpDX,fmarrabal/SharpDX,weltkante/SharpDX,fmarrabal/SharpDX,VirusFree/SharpDX,RobyDX/SharpDX,shoelzer/SharpDX,PavelBrokhman/SharpDX,RobyDX/SharpDX,sharpdx/SharpDX,wyrover/SharpDX,fmarrabal/SharpDX,weltkante/SharpDX,waltdestler/SharpDX,weltkante/SharpDX,wyrover/SharpDX,manu-silicon/SharpDX,TigerKO/SharpDX,TechPriest/SharpDX,shoelzer/SharpDX,PavelBrokhman/SharpDX,TigerKO/SharpDX,manu-silicon/SharpDX,wyrover/SharpDX,davidlee80/SharpDX-1,waltdestler/SharpDX,TechPriest/SharpDX,RobyDX/SharpDX,shoelzer/SharpDX,Ixonos-USA/SharpDX,Ixonos-USA/SharpDX,jwollen/SharpDX,TigerKO/SharpDX,waltdestler/SharpDX,TechPriest/SharpDX,jwollen/SharpDX,mrvux/SharpDX,sharpdx/SharpDX,andrewst/SharpDX,PavelBrokhman/SharpDX,dazerdude/SharpDX,weltkante/SharpDX,andrewst/SharpDX,VirusFree/SharpDX,davidlee80/SharpDX-1,mrvux/SharpDX,dazerdude/SharpDX,dazerdude/SharpDX,Ixonos-USA/SharpDX,manu-silicon/SharpDX,jwollen/SharpDX,VirusFree/SharpDX,dazerdude/SharpDX,TechPriest/SharpDX,waltdestler/SharpDX,Ixonos-USA/SharpDX,RobyDX/SharpDX,wyrover/SharpDX,jwollen/SharpDX,shoelzer/SharpDX
|
4c52edd1e6532f0283cfe1bbc44792d1f7831043
|
NBi.Core/Analysis/Metadata/Property.cs
|
NBi.Core/Analysis/Metadata/Property.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NBi.Core.Analysis.Metadata
{
public class Property : IField
{
public string UniqueName { get; private set; }
public string Caption { get; set; }
public Property(string uniqueName, string caption)
{
UniqueName = uniqueName;
Caption = caption;
}
public Property Clone()
{
return new Property(UniqueName, Caption);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NBi.Core.Analysis.Metadata
{
public class Property : IField
{
public string UniqueName { get; private set; }
public string Caption { get; set; }
public Property(string uniqueName, string caption)
{
UniqueName = uniqueName;
Caption = caption;
}
public Property Clone()
{
return new Property(UniqueName, Caption);
}
public override string ToString()
{
return Caption.ToString();
}
}
}
|
Add method ToString to override default display and replace by Caption
|
Add method ToString to override default display and replace by Caption
|
C#
|
apache-2.0
|
Seddryck/NBi,Seddryck/NBi
|
45924abd66fefb31e55d79592271ce0c708288d8
|
tests/nxtlibtester/Program.cs
|
tests/nxtlibtester/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NXTLib;
using System.IO;
namespace nxtlibtester
{
class Program
{
static void Main(string[] args)
{
try
{
string filename = "version.ric"; //filename on disk (locally)
string filenameonbrick = "version.ric"; //filename on remote NXT
//Prepare Connection
Console.WriteLine("File Upload Test\r\n");
Console.WriteLine("Connecting to brick...");
Brick brick = new Brick(Brick.LinkType.USB, null); //Brick = top layer of code, contains the sensors and motors
if (!brick.Connect()) { throw new Exception(brick.LastError); }
Protocol protocol = brick.ProtocolLink; //Protocol = underlying layer of code, contains NXT communications
//Test Connection
if (!brick.IsConnected) { throw new Exception("Not connected to NXT!"); }
//Upload File
Console.WriteLine("Uploading file...");
if (!brick.UploadFile(filename, filenameonbrick)) { throw new Exception(brick.LastError); }
Console.WriteLine("Success!");
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
return;
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
return;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NXTLib;
using System.IO;
namespace nxtlibtester
{
class Program
{
static void Main(string[] args)
{
try
{
string filename = "../../version.ric"; //filename on disk (locally)
string filenameonbrick = "version.ric"; //filename on remote NXT
//Prepare Connection
Console.WriteLine("File Upload Test\r\n");
Console.WriteLine("Connecting to brick...");
Brick brick = new Brick(Brick.LinkType.USB, null); //Brick = top layer of code, contains the sensors and motors
if (!brick.Connect()) { throw new Exception(brick.LastError); }
Protocol protocol = brick.ProtocolLink; //Protocol = underlying layer of code, contains NXT communications
//Test Connection
if (!brick.IsConnected) { throw new Exception("Not connected to NXT!"); }
//Upload File
Console.WriteLine("Uploading file...");
if (!brick.UploadFile(filename, filenameonbrick)) { throw new Exception(brick.LastError); }
Console.WriteLine("Success!");
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
return;
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
return;
}
}
}
}
|
Add test files to tree
|
Add test files to tree
|
C#
|
mit
|
smo-key/NXTLib,smo-key/NXTLib
|
8954e14ad293d410593611fcbe29c9dabd25c4a2
|
Test/CoreSDK.Test/Net40/Extensibility/Implementation/Platform/PlatformReferencesTests.cs
|
Test/CoreSDK.Test/Net40/Extensibility/Implementation/Platform/PlatformReferencesTests.cs
|
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform
{
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Assert = Xunit.Assert;
[TestClass]
public class PlatformReferencesTests
{
[TestMethod]
public void NoSystemWebReferences()
{
// Validate Platform assembly.
foreach (var assembly in typeof(DebugOutput).Assembly.GetReferencedAssemblies())
{
Assert.True(!assembly.FullName.Contains("System.Web"));
}
// Validate Core assembly
foreach (var assembly in typeof(EventTelemetry).Assembly.GetReferencedAssemblies())
{
Assert.True(!assembly.FullName.Contains("System.Web"));
}
}
}
}
|
namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform
{
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Assert = Xunit.Assert;
[TestClass]
public class PlatformReferencesTests
{
[TestMethod]
public void NoSystemWebReferences()
{
// Validate Platform assembly
foreach (var assembly in typeof(DebugOutput).Assembly.GetReferencedAssemblies())
{
Assert.True(!assembly.FullName.Contains("System.Web"));
}
// Validate Core assembly
foreach (var assembly in typeof(EventTelemetry).Assembly.GetReferencedAssemblies())
{
Assert.True(!assembly.FullName.Contains("System.Web"));
}
}
}
}
|
Revert "Dummy commit to test PR. No real changes"
|
Revert "Dummy commit to test PR. No real changes"
This reverts commit 3fcee5225bbf877fb13cdbf87987bfada486cd76.
|
C#
|
mit
|
pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet
|
8a856105f0522681b77d8f55592ea6bd7f90fa4e
|
src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
|
src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Remoting.Messaging;
using System.Security;
namespace System.Diagnostics
{
public partial class Activity
{
/// <summary>
/// Returns the current operation (Activity) for the current thread. This flows
/// across async calls.
/// </summary>
public static Activity Current
{
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
[System.Security.SecuritySafeCriticalAttribute]
#endif
get
{
return (Activity)CallContext.LogicalGetData(FieldKey);
}
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
[System.Security.SecuritySafeCriticalAttribute]
#endif
private set
{
CallContext.LogicalSetData(FieldKey, value);
}
}
#region private
private partial class KeyValueListNode
{
}
private static readonly string FieldKey = $"{typeof(Activity).FullName}";
#endregion
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Remoting.Messaging;
using System.Security;
namespace System.Diagnostics
{
// this code is specific to .NET 4.5 and uses CallContext to store Activity.Current which requires Activity to be Serializable.
[Serializable] // DO NOT remove
public partial class Activity
{
/// <summary>
/// Returns the current operation (Activity) for the current thread. This flows
/// across async calls.
/// </summary>
public static Activity Current
{
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
[System.Security.SecuritySafeCriticalAttribute]
#endif
get
{
return (Activity)CallContext.LogicalGetData(FieldKey);
}
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
[System.Security.SecuritySafeCriticalAttribute]
#endif
private set
{
CallContext.LogicalSetData(FieldKey, value);
}
}
#region private
[Serializable] // DO NOT remove
private partial class KeyValueListNode
{
}
private static readonly string FieldKey = $"{typeof(Activity).FullName}";
#endregion
}
}
|
Mark Activity and it's properties as Serializable
|
Mark Activity and it's properties as Serializable
|
C#
|
mit
|
richlander/corefx,jlin177/corefx,yizhang82/corefx,ViktorHofer/corefx,axelheer/corefx,wtgodbe/corefx,the-dwyer/corefx,billwert/corefx,krytarowski/corefx,parjong/corefx,zhenlan/corefx,cydhaselton/corefx,alexperovich/corefx,MaggieTsang/corefx,the-dwyer/corefx,mmitche/corefx,ptoonen/corefx,fgreinacher/corefx,Ermiar/corefx,twsouthwick/corefx,jlin177/corefx,twsouthwick/corefx,parjong/corefx,DnlHarvey/corefx,tijoytom/corefx,MaggieTsang/corefx,alexperovich/corefx,DnlHarvey/corefx,ptoonen/corefx,billwert/corefx,seanshpark/corefx,shimingsg/corefx,tijoytom/corefx,twsouthwick/corefx,ptoonen/corefx,nchikanov/corefx,mmitche/corefx,rubo/corefx,krk/corefx,twsouthwick/corefx,ericstj/corefx,tijoytom/corefx,Jiayili1/corefx,fgreinacher/corefx,shimingsg/corefx,Jiayili1/corefx,zhenlan/corefx,stone-li/corefx,krk/corefx,gkhanna79/corefx,krytarowski/corefx,alexperovich/corefx,richlander/corefx,mmitche/corefx,axelheer/corefx,krk/corefx,shimingsg/corefx,ptoonen/corefx,stone-li/corefx,twsouthwick/corefx,mazong1123/corefx,rubo/corefx,the-dwyer/corefx,zhenlan/corefx,dotnet-bot/corefx,JosephTremoulet/corefx,JosephTremoulet/corefx,Ermiar/corefx,ravimeda/corefx,dotnet-bot/corefx,axelheer/corefx,nbarbettini/corefx,axelheer/corefx,nchikanov/corefx,ptoonen/corefx,stone-li/corefx,gkhanna79/corefx,dotnet-bot/corefx,yizhang82/corefx,stone-li/corefx,JosephTremoulet/corefx,jlin177/corefx,ViktorHofer/corefx,shimingsg/corefx,tijoytom/corefx,the-dwyer/corefx,zhenlan/corefx,Jiayili1/corefx,nchikanov/corefx,gkhanna79/corefx,stone-li/corefx,twsouthwick/corefx,dotnet-bot/corefx,parjong/corefx,JosephTremoulet/corefx,rubo/corefx,seanshpark/corefx,ravimeda/corefx,ViktorHofer/corefx,gkhanna79/corefx,richlander/corefx,seanshpark/corefx,richlander/corefx,nbarbettini/corefx,Jiayili1/corefx,shimingsg/corefx,MaggieTsang/corefx,the-dwyer/corefx,cydhaselton/corefx,seanshpark/corefx,stone-li/corefx,parjong/corefx,BrennanConroy/corefx,ravimeda/corefx,MaggieTsang/corefx,zhenlan/corefx,gkhanna79/corefx,mazong1123/corefx,billwert/corefx,JosephTremoulet/corefx,nbarbettini/corefx,richlander/corefx,nbarbettini/corefx,krytarowski/corefx,richlander/corefx,gkhanna79/corefx,Ermiar/corefx,mmitche/corefx,nchikanov/corefx,zhenlan/corefx,shimingsg/corefx,dotnet-bot/corefx,wtgodbe/corefx,Ermiar/corefx,DnlHarvey/corefx,ravimeda/corefx,ericstj/corefx,fgreinacher/corefx,nchikanov/corefx,mazong1123/corefx,jlin177/corefx,JosephTremoulet/corefx,yizhang82/corefx,zhenlan/corefx,yizhang82/corefx,DnlHarvey/corefx,seanshpark/corefx,ravimeda/corefx,nchikanov/corefx,billwert/corefx,alexperovich/corefx,jlin177/corefx,krk/corefx,mmitche/corefx,billwert/corefx,Ermiar/corefx,the-dwyer/corefx,ravimeda/corefx,krytarowski/corefx,seanshpark/corefx,tijoytom/corefx,MaggieTsang/corefx,parjong/corefx,MaggieTsang/corefx,nbarbettini/corefx,ericstj/corefx,billwert/corefx,krk/corefx,cydhaselton/corefx,ViktorHofer/corefx,ericstj/corefx,ravimeda/corefx,twsouthwick/corefx,mmitche/corefx,krytarowski/corefx,yizhang82/corefx,rubo/corefx,Ermiar/corefx,Ermiar/corefx,DnlHarvey/corefx,krytarowski/corefx,ericstj/corefx,fgreinacher/corefx,ptoonen/corefx,wtgodbe/corefx,tijoytom/corefx,DnlHarvey/corefx,seanshpark/corefx,Jiayili1/corefx,dotnet-bot/corefx,alexperovich/corefx,ericstj/corefx,rubo/corefx,DnlHarvey/corefx,wtgodbe/corefx,krk/corefx,nchikanov/corefx,ViktorHofer/corefx,parjong/corefx,alexperovich/corefx,Jiayili1/corefx,yizhang82/corefx,axelheer/corefx,tijoytom/corefx,jlin177/corefx,wtgodbe/corefx,cydhaselton/corefx,ViktorHofer/corefx,dotnet-bot/corefx,gkhanna79/corefx,BrennanConroy/corefx,parjong/corefx,mazong1123/corefx,MaggieTsang/corefx,wtgodbe/corefx,nbarbettini/corefx,alexperovich/corefx,stone-li/corefx,krk/corefx,krytarowski/corefx,mmitche/corefx,JosephTremoulet/corefx,wtgodbe/corefx,cydhaselton/corefx,mazong1123/corefx,mazong1123/corefx,Jiayili1/corefx,the-dwyer/corefx,nbarbettini/corefx,mazong1123/corefx,ptoonen/corefx,billwert/corefx,shimingsg/corefx,richlander/corefx,ericstj/corefx,axelheer/corefx,jlin177/corefx,cydhaselton/corefx,yizhang82/corefx,cydhaselton/corefx,BrennanConroy/corefx,ViktorHofer/corefx
|
2f927783ad6590452c65960111cb09919fe2c0e5
|
src/Microsoft.Language.Xml.Tests/TestApi.cs
|
src/Microsoft.Language.Xml.Tests/TestApi.cs
|
using System.Linq;
using Xunit;
namespace Microsoft.Language.Xml.Tests
{
public class TestApi
{
[Fact]
public void TestAttributeValue()
{
var root = Parser.ParseText("<e a=\"\"/>");
var attributeValue = root.Attributes.First().Value;
Assert.Equal("", attributeValue);
}
[Fact]
public void TestContent()
{
var root = Parser.ParseText("<e>Content</e>");
var value = root.Value;
Assert.Equal("Content", value);
}
}
}
|
using System.Linq;
using Xunit;
namespace Microsoft.Language.Xml.Tests
{
public class TestApi
{
[Fact]
public void TestAttributeValue()
{
var root = Parser.ParseText("<e a=\"\"/>");
var attributeValue = root.Attributes.First().Value;
Assert.Equal("", attributeValue);
}
[Fact]
public void TestContent()
{
var root = Parser.ParseText("<e>Content</e>");
var value = root.Value;
Assert.Equal("Content", value);
}
[Fact]
public void TestRootLevel()
{
var root = Parser.ParseText("<Root></Root>");
Assert.Equal("Root", root.Name);
}
[Fact(Skip = "https://github.com/KirillOsenkov/XmlParser/issues/8")]
public void TestRootLevelTrivia()
{
var root = Parser.ParseText("<!-- C --><Root></Root>");
Assert.Equal("Root", root.Name);
}
[Fact]
public void TestRootLevelTriviaWithDeclaration()
{
var root = Parser.ParseText("<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- C --><Root></Root>");
Assert.Equal("Root", root.Name);
}
}
}
|
Add some tests for a bug.
|
Add some tests for a bug.
|
C#
|
apache-2.0
|
KirillOsenkov/XmlParser
|
4474c8be125d6236046733da43d63ffcd92fcb14
|
src/SharedAssemblyInfo.cs
|
src/SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("Andrew Davey")]
[assembly: AssemblyProduct("Cassette")]
[assembly: AssemblyCopyright("Copyright © 2011 Andrew Davey")]
// NOTE: When changing this version, also update Cassette.MSBuild\Cassette.targets to match.
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyVersion("2.0.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
using System.Reflection;
[assembly: AssemblyCompany("Andrew Davey")]
[assembly: AssemblyProduct("Cassette")]
[assembly: AssemblyCopyright("Copyright © 2011 Andrew Davey")]
[assembly: AssemblyInformationalVersion("2.0.0-beta1")]
[assembly: AssemblyVersion("2.0.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
Set nuget package version to 2.0.0-beta1
|
Set nuget package version to 2.0.0-beta1
|
C#
|
mit
|
andrewdavey/cassette,damiensawyer/cassette,honestegg/cassette,andrewdavey/cassette,andrewdavey/cassette,honestegg/cassette,BluewireTechnologies/cassette,BluewireTechnologies/cassette,honestegg/cassette,damiensawyer/cassette,damiensawyer/cassette
|
f0b215c0b562906d2eee66554c3b91c8e5a3238c
|
src/HtmlMinificationMiddleware/HtmlMinificationMiddleware.cs
|
src/HtmlMinificationMiddleware/HtmlMinificationMiddleware.cs
|
namespace DotnetThoughts.AspNet
{
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using System.IO;
using System.Threading.Tasks;
using System.Text;
using System.Text.RegularExpressions;
public class HtmlMinificationMiddleware
{
private RequestDelegate _next;
public HtmlMinificationMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
var stream = context.Response.Body;
using (var buffer = new MemoryStream())
{
context.Response.Body = buffer;
await _next(context);
var isHtml = context.Response.ContentType?.ToLower().Contains("text/html");
buffer.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(buffer))
{
string responseBody = await reader.ReadToEndAsync();
if (context.Response.StatusCode == 200 && isHtml.GetValueOrDefault())
{
responseBody = Regex.Replace(responseBody, @">\s+<", "><", RegexOptions.Compiled);
}
using (var memoryStream = new MemoryStream())
{
var bytes = Encoding.UTF8.GetBytes(responseBody);
memoryStream.Write(bytes, 0, bytes.Length);
memoryStream.Seek(0, SeekOrigin.Begin);
await memoryStream.CopyToAsync(stream, bytes.Length);
}
}
}
}
}
}
|
namespace DotnetThoughts.AspNet
{
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using System.IO;
using System.Threading.Tasks;
using System.Text;
using System.Text.RegularExpressions;
public class HtmlMinificationMiddleware
{
private RequestDelegate _next;
public HtmlMinificationMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
var stream = context.Response.Body;
using (var buffer = new MemoryStream())
{
context.Response.Body = buffer;
await _next(context);
var isHtml = context.Response.ContentType?.ToLower().Contains("text/html");
buffer.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(buffer))
{
string responseBody = await reader.ReadToEndAsync();
if (context.Response.StatusCode == 200 && isHtml.GetValueOrDefault())
{
responseBody = Regex.Replace(responseBody, @">\s+<", "><", RegexOptions.Compiled);
responseBody = Regex.Replace(responseBody, @"<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->", "", RegexOptions.Compiled);
}
using (var memoryStream = new MemoryStream())
{
var bytes = Encoding.UTF8.GetBytes(responseBody);
memoryStream.Write(bytes, 0, bytes.Length);
memoryStream.Seek(0, SeekOrigin.Begin);
await memoryStream.CopyToAsync(stream, bytes.Length);
}
}
}
}
}
}
|
Support added for HTML comment removal
|
Support added for HTML comment removal
|
C#
|
mit
|
anuraj/HtmlMinificationMiddleware
|
b13aba07a1968f6d6273327766fd41b135c33668
|
LogicalShift.Reason/Clause.cs
|
LogicalShift.Reason/Clause.cs
|
using LogicalShift.Reason.Api;
using LogicalShift.Reason.Clauses;
using System;
using System.Linq;
namespace LogicalShift.Reason
{
/// <summary>
/// Methods for creating an altering clauses
/// </summary>
public static class Clause
{
/// <summary>
/// Creates a new negative Horn clause
/// </summary>
public static IClause If(params ILiteral[] literals)
{
if (literals == null) throw new ArgumentNullException("literals");
if (literals.Any(literal => literal == null)) throw new ArgumentException("Null literals are not allowed", "literals");
return new NegativeClause(literals);
}
/// <summary>
/// Adds a positive literal to a negative Horn clause
/// </summary>
public static IClause Then(this IClause negativeHornClause, ILiteral then)
{
if (negativeHornClause == null) throw new ArgumentNullException("negativeHornClause");
if (negativeHornClause.Implies != null) throw new ArgumentException("Clause already has an implication", "negativeHornClause");
if (then == null) throw new ArgumentNullException("then");
return new PositiveClause(negativeHornClause, then);
}
/// <summary>
/// Returns a clause indicating that a literal is unconditionally true
/// </summary>
public static IClause Always(ILiteral always)
{
return If(Literal.True()).Then(always);
}
}
}
|
using LogicalShift.Reason.Api;
using LogicalShift.Reason.Clauses;
using System;
using System.Linq;
namespace LogicalShift.Reason
{
/// <summary>
/// Methods for creating an altering clauses
/// </summary>
public static class Clause
{
/// <summary>
/// Creates a new negative Horn clause
/// </summary>
public static IClause If(params ILiteral[] literals)
{
if (literals == null) throw new ArgumentNullException("literals");
if (literals.Any(literal => literal == null)) throw new ArgumentException("Null literals are not allowed", "literals");
return new NegativeClause(literals);
}
/// <summary>
/// Adds a positive literal to a negative Horn clause
/// </summary>
public static IClause Then(this IClause negativeHornClause, ILiteral then)
{
if (negativeHornClause == null) throw new ArgumentNullException("negativeHornClause");
if (negativeHornClause.Implies != null) throw new ArgumentException("Clause already has an implication", "negativeHornClause");
if (then == null) throw new ArgumentNullException("then");
return new PositiveClause(negativeHornClause, then);
}
/// <summary>
/// Returns a clause indicating that a literal is unconditionally true
/// </summary>
public static IClause Always(ILiteral always)
{
return If().Then(always);
}
}
}
|
Change Always(x) so that it doesn't depend on the 'true' literal
|
Change Always(x) so that it doesn't depend on the 'true' literal
|
C#
|
apache-2.0
|
Logicalshift/Reason
|
7760912ffcb638e36c025e465ef9b299912fab59
|
osu.Framework/Statistics/GlobalStatistic.cs
|
osu.Framework/Statistics/GlobalStatistic.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
namespace osu.Framework.Statistics
{
public class GlobalStatistic<T> : IGlobalStatistic
{
public string Group { get; }
public string Name { get; }
public IBindable<string> DisplayValue => displayValue;
private readonly Bindable<string> displayValue = new Bindable<string>();
public Bindable<T> Bindable { get; } = new Bindable<T>();
public T Value
{
get => Bindable.Value;
set => Bindable.Value = value;
}
public GlobalStatistic(string group, string name)
{
Group = group;
Name = name;
Bindable.ValueChanged += val => displayValue.Value = val.NewValue.ToString();
}
public virtual void Clear() => Bindable.SetDefault();
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
namespace osu.Framework.Statistics
{
public class GlobalStatistic<T> : IGlobalStatistic
{
public string Group { get; }
public string Name { get; }
public IBindable<string> DisplayValue => displayValue;
private readonly Bindable<string> displayValue = new Bindable<string>();
public Bindable<T> Bindable { get; } = new Bindable<T>();
public T Value
{
get => Bindable.Value;
set => Bindable.Value = value;
}
public GlobalStatistic(string group, string name)
{
Group = group;
Name = name;
Bindable.BindValueChanged(val => displayValue.Value = val.NewValue.ToString(), true);
}
public virtual void Clear() => Bindable.SetDefault();
}
}
|
Fix initial value not propagating
|
Fix initial value not propagating
|
C#
|
mit
|
peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
|
172a9644b79f6f7c4883d0dd383a70209e7f2449
|
dotnet/src/Selenium.WebDriverBackedSelenium/Internal/SeleniumEmulation/Open.cs
|
dotnet/src/Selenium.WebDriverBackedSelenium/Internal/SeleniumEmulation/Open.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using OpenQA.Selenium;
using Selenium.Internal.SeleniumEmulation;
namespace Selenium.Internal.SeleniumEmulation
{
/// <summary>
/// Defines the command for the open keyword.
/// </summary>
internal class Open : SeleneseCommand
{
private Uri baseUrl;
/// <summary>
/// Initializes a new instance of the <see cref="Open"/> class.
/// </summary>
/// <param name="baseUrl">The base URL to open with the command.</param>
public Open(Uri baseUrl)
{
this.baseUrl = baseUrl;
}
/// <summary>
/// Handles the command.
/// </summary>
/// <param name="driver">The driver used to execute the command.</param>
/// <param name="locator">The first parameter to the command.</param>
/// <param name="value">The second parameter to the command.</param>
/// <returns>The result of the command.</returns>
protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value)
{
string urlToOpen = this.ConstructUrl(locator);
driver.Url = urlToOpen;
return null;
}
private string ConstructUrl(string path)
{
string urlToOpen = path.Contains("://") ?
path :
this.baseUrl.ToString() + (!path.StartsWith("/", StringComparison.Ordinal) ? "/" : string.Empty) + path;
return urlToOpen;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using OpenQA.Selenium;
using Selenium.Internal.SeleniumEmulation;
namespace Selenium.Internal.SeleniumEmulation
{
/// <summary>
/// Defines the command for the open keyword.
/// </summary>
internal class Open : SeleneseCommand
{
private Uri baseUrl;
/// <summary>
/// Initializes a new instance of the <see cref="Open"/> class.
/// </summary>
/// <param name="baseUrl">The base URL to open with the command.</param>
public Open(Uri baseUrl)
{
this.baseUrl = baseUrl;
}
/// <summary>
/// Handles the command.
/// </summary>
/// <param name="driver">The driver used to execute the command.</param>
/// <param name="locator">The first parameter to the command.</param>
/// <param name="value">The second parameter to the command.</param>
/// <returns>The result of the command.</returns>
protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value)
{
string urlToOpen = this.ConstructUrl(locator);
driver.Url = urlToOpen;
return null;
}
private string ConstructUrl(string path)
{
string urlToOpen = path.Contains("://") ?
path :
this.baseUrl.ToString().TrimEnd('/') + (!path.StartsWith("/", StringComparison.Ordinal) ? "/" : string.Empty) + path;
return urlToOpen;
}
}
}
|
Remove trailing slashes from baseUrl in .NET to prevent double slashes in URL
|
Remove trailing slashes from baseUrl in .NET to prevent double slashes in URL
This change is in the .NET WebDriverBackedSelenium API. Fixes issue #4506.
Signed-off-by Jim Evans <james.h.evans.jr@gmail.com>
|
C#
|
apache-2.0
|
joshmgrant/selenium,amikey/selenium,yukaReal/selenium,mestihudson/selenium,clavery/selenium,lukeis/selenium,lukeis/selenium,krosenvold/selenium,MeetMe/selenium,SeleniumHQ/selenium,telefonicaid/selenium,xsyntrex/selenium,gregerrag/selenium,alexec/selenium,asashour/selenium,gurayinan/selenium,sebady/selenium,houchj/selenium,stupidnetizen/selenium,GorK-ChO/selenium,onedox/selenium,jabbrwcky/selenium,freynaud/selenium,alb-i986/selenium,MCGallaspy/selenium,livioc/selenium,Sravyaksr/selenium,jerome-jacob/selenium,bartolkaruza/selenium,SeleniumHQ/selenium,sri85/selenium,i17c/selenium,jsakamoto/selenium,gotcha/selenium,oddui/selenium,5hawnknight/selenium,Jarob22/selenium,freynaud/selenium,mojwang/selenium,skurochkin/selenium,denis-vilyuzhanin/selenium-fastview,freynaud/selenium,manuelpirez/selenium,sag-enorman/selenium,stupidnetizen/selenium,houchj/selenium,manuelpirez/selenium,rplevka/selenium,aluedeke/chromedriver,rrussell39/selenium,AutomatedTester/selenium,tkurnosova/selenium,carsonmcdonald/selenium,tarlabs/selenium,GorK-ChO/selenium,skurochkin/selenium,rrussell39/selenium,alb-i986/selenium,onedox/selenium,TikhomirovSergey/selenium,minhthuanit/selenium,markodolancic/selenium,knorrium/selenium,compstak/selenium,slongwang/selenium,gemini-testing/selenium,dkentw/selenium,jsakamoto/selenium,dandv/selenium,joshmgrant/selenium,dandv/selenium,freynaud/selenium,valfirst/selenium,DrMarcII/selenium,jsarenik/jajomojo-selenium,gabrielsimas/selenium,carlosroh/selenium,joshmgrant/selenium,chrsmithdemos/selenium,SouWilliams/selenium,Ardesco/selenium,onedox/selenium,5hawnknight/selenium,isaksky/selenium,DrMarcII/selenium,sankha93/selenium,houchj/selenium,knorrium/selenium,mestihudson/selenium,dandv/selenium,soundcloud/selenium,misttechnologies/selenium,clavery/selenium,meksh/selenium,tkurnosova/selenium,quoideneuf/selenium,jabbrwcky/selenium,blueyed/selenium,asolntsev/selenium,isaksky/selenium,arunsingh/selenium,krosenvold/selenium,joshbruning/selenium,juangj/selenium,sri85/selenium,titusfortner/selenium,blackboarddd/selenium,lilredindy/selenium,jsakamoto/selenium,davehunt/selenium,GorK-ChO/selenium,BlackSmith/selenium,pulkitsinghal/selenium,skurochkin/selenium,dbo/selenium,uchida/selenium,misttechnologies/selenium,asashour/selenium,lukeis/selenium,gregerrag/selenium,kalyanjvn1/selenium,alb-i986/selenium,lmtierney/selenium,joshmgrant/selenium,sevaseva/selenium,minhthuanit/selenium,denis-vilyuzhanin/selenium-fastview,denis-vilyuzhanin/selenium-fastview,amikey/selenium,houchj/selenium,tbeadle/selenium,dkentw/selenium,sebady/selenium,krosenvold/selenium,blueyed/selenium,jsarenik/jajomojo-selenium,aluedeke/chromedriver,p0deje/selenium,skurochkin/selenium,valfirst/selenium,DrMarcII/selenium,yukaReal/selenium,DrMarcII/selenium,lukeis/selenium,HtmlUnit/selenium,SevInf/IEDriver,p0deje/selenium,jabbrwcky/selenium,sankha93/selenium,wambat/selenium,lmtierney/selenium,Ardesco/selenium,minhthuanit/selenium,jknguyen/josephknguyen-selenium,sankha93/selenium,blueyed/selenium,davehunt/selenium,soundcloud/selenium,rovner/selenium,blueyed/selenium,denis-vilyuzhanin/selenium-fastview,alb-i986/selenium,tarlabs/selenium,uchida/selenium,krmahadevan/selenium,rplevka/selenium,titusfortner/selenium,telefonicaid/selenium,lmtierney/selenium,dcjohnson1989/selenium,joshbruning/selenium,s2oBCN/selenium,aluedeke/chromedriver,temyers/selenium,clavery/selenium,chrisblock/selenium,rovner/selenium,twalpole/selenium,bmannix/selenium,customcommander/selenium,sankha93/selenium,RamaraoDonta/ramarao-clone,AutomatedTester/selenium,bmannix/selenium,carlosroh/selenium,amar-sharma/selenium,twalpole/selenium,juangj/selenium,TheBlackTuxCorp/selenium,dcjohnson1989/selenium,misttechnologies/selenium,customcommander/selenium,joshbruning/selenium,o-schneider/selenium,gregerrag/selenium,sri85/selenium,Appdynamics/selenium,lrowe/selenium,soundcloud/selenium,quoideneuf/selenium,manuelpirez/selenium,chrisblock/selenium,carlosroh/selenium,GorK-ChO/selenium,SeleniumHQ/selenium,SevInf/IEDriver,SevInf/IEDriver,sebady/selenium,pulkitsinghal/selenium,tbeadle/selenium,Jarob22/selenium,xmhubj/selenium,joshbruning/selenium,compstak/selenium,tbeadle/selenium,p0deje/selenium,bmannix/selenium,MCGallaspy/selenium,aluedeke/chromedriver,telefonicaid/selenium,slongwang/selenium,mach6/selenium,krosenvold/selenium,titusfortner/selenium,lrowe/selenium,AutomatedTester/selenium,SevInf/IEDriver,thanhpete/selenium,GorK-ChO/selenium,minhthuanit/selenium,gemini-testing/selenium,telefonicaid/selenium,tarlabs/selenium,MCGallaspy/selenium,alexec/selenium,xsyntrex/selenium,Tom-Trumper/selenium,TheBlackTuxCorp/selenium,dcjohnson1989/selenium,BlackSmith/selenium,juangj/selenium,lilredindy/selenium,Ardesco/selenium,AutomatedTester/selenium,chrisblock/selenium,jknguyen/josephknguyen-selenium,customcommander/selenium,knorrium/selenium,denis-vilyuzhanin/selenium-fastview,SouWilliams/selenium,minhthuanit/selenium,joshmgrant/selenium,MCGallaspy/selenium,SouWilliams/selenium,Sravyaksr/selenium,mestihudson/selenium,misttechnologies/selenium,meksh/selenium,yukaReal/selenium,dcjohnson1989/selenium,mach6/selenium,livioc/selenium,eric-stanley/selenium,doungni/selenium,mojwang/selenium,sri85/selenium,krmahadevan/selenium,temyers/selenium,amikey/selenium,dbo/selenium,5hawnknight/selenium,actmd/selenium,tkurnosova/selenium,gotcha/selenium,HtmlUnit/selenium,alb-i986/selenium,pulkitsinghal/selenium,gregerrag/selenium,TheBlackTuxCorp/selenium,tarlabs/selenium,twalpole/selenium,mojwang/selenium,skurochkin/selenium,alb-i986/selenium,o-schneider/selenium,isaksky/selenium,rovner/selenium,amikey/selenium,pulkitsinghal/selenium,lmtierney/selenium,Herst/selenium,lrowe/selenium,knorrium/selenium,sebady/selenium,joshbruning/selenium,Dude-X/selenium,i17c/selenium,quoideneuf/selenium,dibagga/selenium,dibagga/selenium,livioc/selenium,skurochkin/selenium,soundcloud/selenium,RamaraoDonta/ramarao-clone,MeetMe/selenium,quoideneuf/selenium,rovner/selenium,SeleniumHQ/selenium,gabrielsimas/selenium,TikhomirovSergey/selenium,rplevka/selenium,xsyntrex/selenium,Jarob22/selenium,TheBlackTuxCorp/selenium,oddui/selenium,TikhomirovSergey/selenium,soundcloud/selenium,dkentw/selenium,uchida/selenium,zenefits/selenium,isaksky/selenium,amikey/selenium,TikhomirovSergey/selenium,isaksky/selenium,i17c/selenium,sevaseva/selenium,sri85/selenium,DrMarcII/selenium,slongwang/selenium,asashour/selenium,rrussell39/selenium,gorlemik/selenium,xsyntrex/selenium,uchida/selenium,TikhomirovSergey/selenium,Appdynamics/selenium,anshumanchatterji/selenium,blueyed/selenium,minhthuanit/selenium,anshumanchatterji/selenium,dbo/selenium,Herst/selenium,gregerrag/selenium,sri85/selenium,compstak/selenium,compstak/selenium,jsarenik/jajomojo-selenium,alexec/selenium,quoideneuf/selenium,GorK-ChO/selenium,p0deje/selenium,lrowe/selenium,lrowe/selenium,manuelpirez/selenium,mach6/selenium,krosenvold/selenium,blueyed/selenium,doungni/selenium,gabrielsimas/selenium,MeetMe/selenium,davehunt/selenium,carsonmcdonald/selenium,juangj/selenium,customcommander/selenium,sevaseva/selenium,bartolkaruza/selenium,arunsingh/selenium,RamaraoDonta/ramarao-clone,chrisblock/selenium,bartolkaruza/selenium,arunsingh/selenium,stupidnetizen/selenium,dibagga/selenium,joshbruning/selenium,mojwang/selenium,tkurnosova/selenium,HtmlUnit/selenium,JosephCastro/selenium,manuelpirez/selenium,carsonmcdonald/selenium,telefonicaid/selenium,chrisblock/selenium,jerome-jacob/selenium,minhthuanit/selenium,Appdynamics/selenium,davehunt/selenium,SeleniumHQ/selenium,onedox/selenium,Dude-X/selenium,joshuaduffy/selenium,telefonicaid/selenium,tkurnosova/selenium,clavery/selenium,sebady/selenium,JosephCastro/selenium,eric-stanley/selenium,sankha93/selenium,jabbrwcky/selenium,skurochkin/selenium,p0deje/selenium,Tom-Trumper/selenium,zenefits/selenium,s2oBCN/selenium,sri85/selenium,bartolkaruza/selenium,RamaraoDonta/ramarao-clone,bartolkaruza/selenium,gabrielsimas/selenium,DrMarcII/selenium,SeleniumHQ/selenium,Dude-X/selenium,markodolancic/selenium,freynaud/selenium,soundcloud/selenium,SeleniumHQ/selenium,Appdynamics/selenium,anshumanchatterji/selenium,yukaReal/selenium,gregerrag/selenium,kalyanjvn1/selenium,sri85/selenium,uchida/selenium,stupidnetizen/selenium,blueyed/selenium,TikhomirovSergey/selenium,bmannix/selenium,pulkitsinghal/selenium,bmannix/selenium,doungni/selenium,vveliev/selenium,markodolancic/selenium,bartolkaruza/selenium,xmhubj/selenium,blackboarddd/selenium,knorrium/selenium,HtmlUnit/selenium,o-schneider/selenium,carsonmcdonald/selenium,blueyed/selenium,gotcha/selenium,sebady/selenium,orange-tv-blagnac/selenium,5hawnknight/selenium,gemini-testing/selenium,meksh/selenium,joshmgrant/selenium,tarlabs/selenium,Appdynamics/selenium,xmhubj/selenium,gotcha/selenium,sebady/selenium,mojwang/selenium,vveliev/selenium,titusfortner/selenium,p0deje/selenium,amar-sharma/selenium,asolntsev/selenium,bayandin/selenium,slongwang/selenium,dandv/selenium,Tom-Trumper/selenium,quoideneuf/selenium,HtmlUnit/selenium,dbo/selenium,compstak/selenium,meksh/selenium,Herst/selenium,krmahadevan/selenium,actmd/selenium,chrsmithdemos/selenium,chrsmithdemos/selenium,o-schneider/selenium,aluedeke/chromedriver,bayandin/selenium,carsonmcdonald/selenium,gemini-testing/selenium,doungni/selenium,asolntsev/selenium,alexec/selenium,MeetMe/selenium,carlosroh/selenium,Appdynamics/selenium,krosenvold/selenium,orange-tv-blagnac/selenium,tarlabs/selenium,jsakamoto/selenium,p0deje/selenium,sankha93/selenium,markodolancic/selenium,5hawnknight/selenium,valfirst/selenium,rrussell39/selenium,dimacus/selenium,krmahadevan/selenium,actmd/selenium,zenefits/selenium,isaksky/selenium,jerome-jacob/selenium,Dude-X/selenium,Jarob22/selenium,carlosroh/selenium,asashour/selenium,jsarenik/jajomojo-selenium,telefonicaid/selenium,joshuaduffy/selenium,TikhomirovSergey/selenium,bmannix/selenium,eric-stanley/selenium,alb-i986/selenium,asolntsev/selenium,HtmlUnit/selenium,yukaReal/selenium,twalpole/selenium,SouWilliams/selenium,sevaseva/selenium,dbo/selenium,dimacus/selenium,pulkitsinghal/selenium,knorrium/selenium,aluedeke/chromedriver,livioc/selenium,gorlemik/selenium,krmahadevan/selenium,rplevka/selenium,sevaseva/selenium,orange-tv-blagnac/selenium,HtmlUnit/selenium,amar-sharma/selenium,jsakamoto/selenium,compstak/selenium,skurochkin/selenium,sag-enorman/selenium,MCGallaspy/selenium,RamaraoDonta/ramarao-clone,dibagga/selenium,asashour/selenium,i17c/selenium,joshbruning/selenium,titusfortner/selenium,tarlabs/selenium,5hawnknight/selenium,temyers/selenium,rovner/selenium,lilredindy/selenium,orange-tv-blagnac/selenium,Sravyaksr/selenium,joshbruning/selenium,sag-enorman/selenium,asashour/selenium,rovner/selenium,misttechnologies/selenium,chrsmithdemos/selenium,joshuaduffy/selenium,gabrielsimas/selenium,doungni/selenium,5hawnknight/selenium,lmtierney/selenium,TheBlackTuxCorp/selenium,bmannix/selenium,Dude-X/selenium,joshuaduffy/selenium,blackboarddd/selenium,JosephCastro/selenium,quoideneuf/selenium,petruc/selenium,mestihudson/selenium,jerome-jacob/selenium,bayandin/selenium,HtmlUnit/selenium,temyers/selenium,amar-sharma/selenium,sebady/selenium,lrowe/selenium,Jarob22/selenium,Sravyaksr/selenium,xmhubj/selenium,s2oBCN/selenium,juangj/selenium,gotcha/selenium,asolntsev/selenium,doungni/selenium,Herst/selenium,rplevka/selenium,gemini-testing/selenium,kalyanjvn1/selenium,tbeadle/selenium,amar-sharma/selenium,rovner/selenium,sag-enorman/selenium,aluedeke/chromedriver,alexec/selenium,RamaraoDonta/ramarao-clone,amar-sharma/selenium,joshuaduffy/selenium,gregerrag/selenium,clavery/selenium,vveliev/selenium,orange-tv-blagnac/selenium,chrisblock/selenium,s2oBCN/selenium,thanhpete/selenium,krosenvold/selenium,Dude-X/selenium,titusfortner/selenium,knorrium/selenium,twalpole/selenium,xsyntrex/selenium,sevaseva/selenium,joshmgrant/selenium,temyers/selenium,anshumanchatterji/selenium,tkurnosova/selenium,markodolancic/selenium,stupidnetizen/selenium,misttechnologies/selenium,sag-enorman/selenium,tarlabs/selenium,SevInf/IEDriver,markodolancic/selenium,tkurnosova/selenium,chrsmithdemos/selenium,zenefits/selenium,thanhpete/selenium,lrowe/selenium,chrisblock/selenium,dbo/selenium,SouWilliams/selenium,compstak/selenium,rovner/selenium,Herst/selenium,JosephCastro/selenium,arunsingh/selenium,dbo/selenium,wambat/selenium,actmd/selenium,rrussell39/selenium,SeleniumHQ/selenium,quoideneuf/selenium,dimacus/selenium,oddui/selenium,customcommander/selenium,thanhpete/selenium,Tom-Trumper/selenium,zenefits/selenium,DrMarcII/selenium,alexec/selenium,MeetMe/selenium,valfirst/selenium,Jarob22/selenium,alb-i986/selenium,AutomatedTester/selenium,Appdynamics/selenium,sag-enorman/selenium,SeleniumHQ/selenium,sankha93/selenium,jabbrwcky/selenium,Ardesco/selenium,jknguyen/josephknguyen-selenium,joshmgrant/selenium,davehunt/selenium,dandv/selenium,s2oBCN/selenium,compstak/selenium,manuelpirez/selenium,SevInf/IEDriver,jsarenik/jajomojo-selenium,lukeis/selenium,RamaraoDonta/ramarao-clone,carlosroh/selenium,juangj/selenium,jabbrwcky/selenium,AutomatedTester/selenium,petruc/selenium,jsakamoto/selenium,onedox/selenium,actmd/selenium,rplevka/selenium,petruc/selenium,krmahadevan/selenium,asashour/selenium,petruc/selenium,Tom-Trumper/selenium,lilredindy/selenium,jerome-jacob/selenium,mach6/selenium,valfirst/selenium,MeetMe/selenium,manuelpirez/selenium,dcjohnson1989/selenium,xmhubj/selenium,Tom-Trumper/selenium,Appdynamics/selenium,denis-vilyuzhanin/selenium-fastview,doungni/selenium,s2oBCN/selenium,eric-stanley/selenium,kalyanjvn1/selenium,tarlabs/selenium,temyers/selenium,jsarenik/jajomojo-selenium,dbo/selenium,arunsingh/selenium,customcommander/selenium,HtmlUnit/selenium,gorlemik/selenium,jknguyen/josephknguyen-selenium,customcommander/selenium,MCGallaspy/selenium,lukeis/selenium,wambat/selenium,mojwang/selenium,denis-vilyuzhanin/selenium-fastview,vveliev/selenium,dimacus/selenium,gurayinan/selenium,jabbrwcky/selenium,gorlemik/selenium,jsakamoto/selenium,houchj/selenium,twalpole/selenium,jsakamoto/selenium,krmahadevan/selenium,i17c/selenium,zenefits/selenium,rplevka/selenium,blackboarddd/selenium,dimacus/selenium,jsarenik/jajomojo-selenium,dibagga/selenium,BlackSmith/selenium,twalpole/selenium,GorK-ChO/selenium,lmtierney/selenium,tkurnosova/selenium,o-schneider/selenium,dbo/selenium,orange-tv-blagnac/selenium,davehunt/selenium,Herst/selenium,s2oBCN/selenium,blackboarddd/selenium,markodolancic/selenium,gabrielsimas/selenium,kalyanjvn1/selenium,lrowe/selenium,MeetMe/selenium,bartolkaruza/selenium,manuelpirez/selenium,vveliev/selenium,sankha93/selenium,wambat/selenium,dkentw/selenium,5hawnknight/selenium,gabrielsimas/selenium,carsonmcdonald/selenium,valfirst/selenium,wambat/selenium,joshmgrant/selenium,chrsmithdemos/selenium,Dude-X/selenium,jknguyen/josephknguyen-selenium,isaksky/selenium,alexec/selenium,asolntsev/selenium,soundcloud/selenium,carsonmcdonald/selenium,joshbruning/selenium,stupidnetizen/selenium,stupidnetizen/selenium,o-schneider/selenium,oddui/selenium,carlosroh/selenium,arunsingh/selenium,wambat/selenium,amikey/selenium,gurayinan/selenium,oddui/selenium,joshuaduffy/selenium,kalyanjvn1/selenium,MeetMe/selenium,TikhomirovSergey/selenium,jsarenik/jajomojo-selenium,xsyntrex/selenium,lrowe/selenium,tbeadle/selenium,wambat/selenium,sag-enorman/selenium,o-schneider/selenium,GorK-ChO/selenium,denis-vilyuzhanin/selenium-fastview,mach6/selenium,chrsmithdemos/selenium,bayandin/selenium,dcjohnson1989/selenium,lukeis/selenium,xmhubj/selenium,jerome-jacob/selenium,BlackSmith/selenium,gemini-testing/selenium,blackboarddd/selenium,meksh/selenium,Jarob22/selenium,slongwang/selenium,yukaReal/selenium,vveliev/selenium,chrisblock/selenium,chrsmithdemos/selenium,gorlemik/selenium,gorlemik/selenium,yukaReal/selenium,minhthuanit/selenium,meksh/selenium,SouWilliams/selenium,dandv/selenium,clavery/selenium,JosephCastro/selenium,kalyanjvn1/selenium,dkentw/selenium,bayandin/selenium,eric-stanley/selenium,xsyntrex/selenium,amar-sharma/selenium,GorK-ChO/selenium,s2oBCN/selenium,Ardesco/selenium,dcjohnson1989/selenium,valfirst/selenium,petruc/selenium,o-schneider/selenium,aluedeke/chromedriver,petruc/selenium,JosephCastro/selenium,i17c/selenium,SouWilliams/selenium,mestihudson/selenium,asashour/selenium,davehunt/selenium,rrussell39/selenium,Sravyaksr/selenium,doungni/selenium,AutomatedTester/selenium,chrsmithdemos/selenium,oddui/selenium,HtmlUnit/selenium,carsonmcdonald/selenium,customcommander/selenium,titusfortner/selenium,oddui/selenium,yukaReal/selenium,uchida/selenium,orange-tv-blagnac/selenium,davehunt/selenium,gurayinan/selenium,titusfortner/selenium,onedox/selenium,livioc/selenium,rrussell39/selenium,jsarenik/jajomojo-selenium,carlosroh/selenium,soundcloud/selenium,stupidnetizen/selenium,denis-vilyuzhanin/selenium-fastview,gregerrag/selenium,onedox/selenium,BlackSmith/selenium,meksh/selenium,jknguyen/josephknguyen-selenium,orange-tv-blagnac/selenium,RamaraoDonta/ramarao-clone,amar-sharma/selenium,jabbrwcky/selenium,vveliev/selenium,eric-stanley/selenium,carsonmcdonald/selenium,xsyntrex/selenium,stupidnetizen/selenium,gurayinan/selenium,livioc/selenium,dibagga/selenium,quoideneuf/selenium,thanhpete/selenium,lmtierney/selenium,orange-tv-blagnac/selenium,mach6/selenium,misttechnologies/selenium,p0deje/selenium,gotcha/selenium,tbeadle/selenium,valfirst/selenium,SevInf/IEDriver,clavery/selenium,AutomatedTester/selenium,houchj/selenium,gurayinan/selenium,SevInf/IEDriver,BlackSmith/selenium,petruc/selenium,BlackSmith/selenium,krmahadevan/selenium,houchj/selenium,mojwang/selenium,5hawnknight/selenium,mestihudson/selenium,slongwang/selenium,thanhpete/selenium,MeetMe/selenium,anshumanchatterji/selenium,doungni/selenium,s2oBCN/selenium,bmannix/selenium,krosenvold/selenium,telefonicaid/selenium,sag-enorman/selenium,wambat/selenium,TheBlackTuxCorp/selenium,TheBlackTuxCorp/selenium,gotcha/selenium,temyers/selenium,uchida/selenium,knorrium/selenium,JosephCastro/selenium,freynaud/selenium,o-schneider/selenium,Tom-Trumper/selenium,zenefits/selenium,actmd/selenium,Herst/selenium,AutomatedTester/selenium,gemini-testing/selenium,thanhpete/selenium,xmhubj/selenium,jknguyen/josephknguyen-selenium,asolntsev/selenium,gorlemik/selenium,Ardesco/selenium,telefonicaid/selenium,mestihudson/selenium,dibagga/selenium,Dude-X/selenium,mestihudson/selenium,Dude-X/selenium,pulkitsinghal/selenium,i17c/selenium,thanhpete/selenium,Sravyaksr/selenium,SouWilliams/selenium,rrussell39/selenium,gemini-testing/selenium,dkentw/selenium,gregerrag/selenium,TikhomirovSergey/selenium,kalyanjvn1/selenium,pulkitsinghal/selenium,livioc/selenium,mach6/selenium,SeleniumHQ/selenium,dkentw/selenium,titusfortner/selenium,livioc/selenium,manuelpirez/selenium,bartolkaruza/selenium,arunsingh/selenium,juangj/selenium,asolntsev/selenium,gurayinan/selenium,houchj/selenium,onedox/selenium,actmd/selenium,xmhubj/selenium,xsyntrex/selenium,joshuaduffy/selenium,actmd/selenium,gorlemik/selenium,sri85/selenium,slongwang/selenium,anshumanchatterji/selenium,lilredindy/selenium,clavery/selenium,sankha93/selenium,krosenvold/selenium,minhthuanit/selenium,dcjohnson1989/selenium,kalyanjvn1/selenium,livioc/selenium,valfirst/selenium,jabbrwcky/selenium,meksh/selenium,zenefits/selenium,anshumanchatterji/selenium,BlackSmith/selenium,meksh/selenium,rovner/selenium,mojwang/selenium,JosephCastro/selenium,markodolancic/selenium,lilredindy/selenium,davehunt/selenium,sebady/selenium,temyers/selenium,houchj/selenium,titusfortner/selenium,lilredindy/selenium,amikey/selenium,JosephCastro/selenium,petruc/selenium,Sravyaksr/selenium,BlackSmith/selenium,twalpole/selenium,dimacus/selenium,compstak/selenium,joshuaduffy/selenium,Jarob22/selenium,mach6/selenium,isaksky/selenium,freynaud/selenium,freynaud/selenium,gabrielsimas/selenium,uchida/selenium,anshumanchatterji/selenium,bmannix/selenium,customcommander/selenium,gurayinan/selenium,joshmgrant/selenium,eric-stanley/selenium,oddui/selenium,dandv/selenium,jknguyen/josephknguyen-selenium,arunsingh/selenium,dandv/selenium,joshmgrant/selenium,jerome-jacob/selenium,amar-sharma/selenium,TheBlackTuxCorp/selenium,onedox/selenium,i17c/selenium,rrussell39/selenium,jsakamoto/selenium,amikey/selenium,valfirst/selenium,pulkitsinghal/selenium,xmhubj/selenium,juangj/selenium,blueyed/selenium,juangj/selenium,Tom-Trumper/selenium,jknguyen/josephknguyen-selenium,wambat/selenium,SeleniumHQ/selenium,Ardesco/selenium,petruc/selenium,twalpole/selenium,Ardesco/selenium,eric-stanley/selenium,gabrielsimas/selenium,lilredindy/selenium,bartolkaruza/selenium,Tom-Trumper/selenium,dimacus/selenium,MCGallaspy/selenium,vveliev/selenium,blackboarddd/selenium,lukeis/selenium,dandv/selenium,slongwang/selenium,dibagga/selenium,jerome-jacob/selenium,tbeadle/selenium,Sravyaksr/selenium,bayandin/selenium,gotcha/selenium,lmtierney/selenium,DrMarcII/selenium,zenefits/selenium,actmd/selenium,dibagga/selenium,lmtierney/selenium,mojwang/selenium,Jarob22/selenium,dkentw/selenium,dimacus/selenium,Sravyaksr/selenium,krmahadevan/selenium,alb-i986/selenium,bayandin/selenium,uchida/selenium,DrMarcII/selenium,titusfortner/selenium,chrisblock/selenium,SevInf/IEDriver,tbeadle/selenium,sag-enorman/selenium,Herst/selenium,vveliev/selenium,amikey/selenium,misttechnologies/selenium,bayandin/selenium,aluedeke/chromedriver,MCGallaspy/selenium,MCGallaspy/selenium,lilredindy/selenium,RamaraoDonta/ramarao-clone,dcjohnson1989/selenium,sevaseva/selenium,rplevka/selenium,knorrium/selenium,gotcha/selenium,clavery/selenium,misttechnologies/selenium,joshuaduffy/selenium,slongwang/selenium,gemini-testing/selenium,gorlemik/selenium,asashour/selenium,gurayinan/selenium,Appdynamics/selenium,oddui/selenium,arunsingh/selenium,sevaseva/selenium,Herst/selenium,mestihudson/selenium,markodolancic/selenium,jerome-jacob/selenium,isaksky/selenium,i17c/selenium,blackboarddd/selenium,freynaud/selenium,bayandin/selenium,SouWilliams/selenium,dimacus/selenium,p0deje/selenium,dkentw/selenium,valfirst/selenium,skurochkin/selenium,yukaReal/selenium,lukeis/selenium,tkurnosova/selenium,eric-stanley/selenium,carlosroh/selenium,thanhpete/selenium,Ardesco/selenium,TheBlackTuxCorp/selenium,rplevka/selenium,tbeadle/selenium,soundcloud/selenium,temyers/selenium,mach6/selenium,alexec/selenium,alexec/selenium,sevaseva/selenium,anshumanchatterji/selenium,blackboarddd/selenium,asolntsev/selenium
|
e519b6f8890ecd08a207427081cbefd27b306e24
|
aspnet/4-auth/Controllers/SessionController.cs
|
aspnet/4-auth/Controllers/SessionController.cs
|
// Copyright(c) 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
using System.Web;
using System.Web.Mvc;
using Microsoft.Owin.Security;
namespace GoogleCloudSamples.Controllers
{
// [START login]
public class SessionController : Controller
{
// GET: Session/Login
public ActionResult Login()
{
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/" },
"Google"
);
return new HttpUnauthorizedResult();
}
// ...
// [END login]
// [START logout]
// GET: Session/Logout
public ActionResult Logout()
{
Request.GetOwinContext().Authentication.SignOut();
return Redirect("/");
}
// [END logout]
}
}
|
// Copyright(c) 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
using System.Web;
using System.Web.Mvc;
using Microsoft.Owin.Security;
namespace GoogleCloudSamples.Controllers
{
// [START login]
public class SessionController : Controller
{
public ActionResult Login()
{
// Redirect to the Google OAuth 2.0 user consent screen
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/" },
"Google"
);
return new HttpUnauthorizedResult();
}
// ...
// [END login]
// [START logout]
public ActionResult Logout()
{
Request.GetOwinContext().Authentication.SignOut();
return Redirect("/");
}
// [END logout]
}
}
|
Add comment to Auth Login action describing redirect
|
Add comment to Auth Login action describing redirect
|
C#
|
apache-2.0
|
GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet
|
380c6e4c6f0a4740b541a449efdc7993a1bdae74
|
SpotifyAPI/Web/Util.cs
|
SpotifyAPI/Web/Util.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace SpotifyAPI.Web
{
public static class Util
{
public static string GetStringAttribute<T>(this T en, String separator) where T : struct, IConvertible
{
Enum e = (Enum)(object)en;
IEnumerable<StringAttribute> attributes =
Enum.GetValues(typeof(T))
.Cast<T>()
.Where(v => e.HasFlag((Enum)(object)v))
.Select(v => typeof(T).GetField(v.ToString(CultureInfo.InvariantCulture)))
.Select(f => f.GetCustomAttributes(typeof(StringAttribute), false)[0])
.Cast<StringAttribute>();
List<String> list = new List<String>();
attributes.ToList().ForEach(element => list.Add(element.Text));
return string.Join(" ", list);
}
}
public sealed class StringAttribute : Attribute
{
public String Text { get; set; }
public StringAttribute(String text)
{
Text = text;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace SpotifyAPI.Web
{
public static class Util
{
public static string GetStringAttribute<T>(this T en, String separator) where T : struct, IConvertible
{
Enum e = (Enum)(object)en;
IEnumerable<StringAttribute> attributes =
Enum.GetValues(typeof(T))
.Cast<T>()
.Where(v => e.HasFlag((Enum)(object)v))
.Select(v => typeof(T).GetField(v.ToString(CultureInfo.InvariantCulture)))
.Select(f => f.GetCustomAttributes(typeof(StringAttribute), false)[0])
.Cast<StringAttribute>();
List<String> list = new List<String>();
attributes.ToList().ForEach(element => list.Add(element.Text));
return string.Join(separator, list);
}
}
public sealed class StringAttribute : Attribute
{
public String Text { get; set; }
public StringAttribute(String text)
{
Text = text;
}
}
}
|
Use separator when joining string attributes
|
Use separator when joining string attributes
|
C#
|
mit
|
JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET,JohnnyCrazy/SpotifyAPI-NET
|
4c77aed687a819e67844c9bb8e6ff6cb362e350b
|
HermaFx.SettingsAdapter/SettingsAttribute.cs
|
HermaFx.SettingsAdapter/SettingsAttribute.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HermaFx.Settings
{
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)]
public sealed class SettingsAttribute : Attribute
{
public const string DEFAULT_PREFIX_SEPARATOR = ":";
/// <summary>
/// Gets or sets the key prefix.
/// </summary>
/// <value>
/// The key prefix.
/// </value>
public string KeyPrefix { get; }
/// <summary>
/// Gets or sets the prefix separator.
/// </summary>
/// <value>
/// The prefix separator.
/// </value>
public string PrefixSeparator { get; set; }
public SettingsAttribute()
{
PrefixSeparator = DEFAULT_PREFIX_SEPARATOR;
}
public SettingsAttribute(string keyPrefix)
: this()
{
KeyPrefix = keyPrefix;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;
namespace HermaFx.Settings
{
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)]
public sealed class SettingsAttribute : Attribute, IPropertyDescriptorInitializer
{
public const string DEFAULT_PREFIX_SEPARATOR = ":";
/// <summary>
/// Gets or sets the key prefix.
/// </summary>
/// <value>
/// The key prefix.
/// </value>
public string KeyPrefix { get; }
/// <summary>
/// Gets or sets the prefix separator.
/// </summary>
/// <value>
/// The prefix separator.
/// </value>
public string PrefixSeparator { get; set; }
public SettingsAttribute()
{
PrefixSeparator = DEFAULT_PREFIX_SEPARATOR;
}
public SettingsAttribute(string keyPrefix)
: this()
{
KeyPrefix = keyPrefix;
}
#region IPropertyDescriptorInitializer
public int ExecutionOrder => DictionaryBehaviorAttribute.LastExecutionOrder;
public void Initialize(PropertyDescriptor propertyDescriptor, object[] behaviors)
{
propertyDescriptor.Fetch = true;
}
public IDictionaryBehavior Copy()
{
return this;
}
#endregion
}
}
|
Implement IPropertyDescriptorInitializer to validate properties on initializing
|
Implement IPropertyDescriptorInitializer to validate properties on initializing
|
C#
|
mit
|
evicertia/HermaFx,evicertia/HermaFx,evicertia/HermaFx
|
3d6dcba826f4e151db2a570f782f18bc33c8eaa0
|
LeetCode/remove_duplicates_sorted_array_2.cs
|
LeetCode/remove_duplicates_sorted_array_2.cs
|
using System;
static class Program {
static int RemoveDupes(this int[] a) {
int write = 1;
int read = 0;
bool same = false;
int count = 0;
for (int i = 1; i < a.Length; i++) {
read = i;
if (same && a[read] == a[write]) {
count++;
continue;
}
same = a[read] == a[write];
a[write++] = a[read];
}
return a.Length - count;
}
static void Main() {
int[] a = new int[] {1, 1, 1, 2, 2, 3, 3, 3};
int c = RemoveDupes(a);
for (int i = 0; i < c; i++) {
Console.Write("{0} ", a[i]);
}
Console.WriteLine();
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
static class Program {
static int RemoveDupes(this int[] a) {
int write = 1;
int read = 0;
bool same = false;
int count = 0;
for (int i = 1; i < a.Length; i++) {
read = i;
if (same && a[read] == a[write]) {
count++;
continue;
}
same = a[read] == a[write];
a[write++] = a[read];
}
return a.Length - count;
}
static int[] RemoveDupes2(this int[] v) {
return v.Aggregate(new List<int>(),
(a, b) => {
if (a.Count(x => x == b) < 2) {
a.Add(b);
}
return a;
}).ToArray();
}
static void Main() {
int[] a = new int[] {1, 1, 1, 2, 2, 3, 3, 3};
int c = RemoveDupes(a);
for (int i = 0; i < c; i++) {
Console.Write("{0} ", a[i]);
}
Console.WriteLine();
foreach (int x in RemoveDupes2(a)) {
Console.Write("{0} ", x);
}
Console.WriteLine();
}
}
|
Remove duplicates from sorted array II - Linq
|
Remove duplicates from sorted array II - Linq
|
C#
|
mit
|
Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews
|
eb70ae788c9e037edca47f767265621d2af5b80e
|
osu.Game/Modes/ScoreProcesssor.cs
|
osu.Game/Modes/ScoreProcesssor.cs
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Configuration;
using osu.Game.Modes.Objects.Drawables;
namespace osu.Game.Modes
{
public class ScoreProcessor
{
public virtual Score GetScore() => new Score();
public BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };
public BindableInt Combo = new BindableInt();
public List<JudgementInfo> Judgements = new List<JudgementInfo>();
public virtual void AddJudgement(JudgementInfo judgement)
{
Judgements.Add(judgement);
UpdateCalculations();
judgement.ComboAtHit = (ulong)Combo.Value;
}
/// <summary>
/// Update any values that potentially need post-processing on a judgement change.
/// </summary>
protected virtual void UpdateCalculations()
{
}
}
}
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Configuration;
using osu.Game.Modes.Objects.Drawables;
namespace osu.Game.Modes
{
public class ScoreProcessor
{
public virtual Score GetScore() => new Score();
public BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };
public BindableInt Combo = new BindableInt();
public BindableInt MaximumCombo = new BindableInt();
public List<JudgementInfo> Judgements = new List<JudgementInfo>();
public virtual void AddJudgement(JudgementInfo judgement)
{
Judgements.Add(judgement);
UpdateCalculations();
judgement.ComboAtHit = (ulong)Combo.Value;
if (Combo.Value > MaximumCombo.Value)
MaximumCombo.Value = Combo.Value;
}
/// <summary>
/// Update any values that potentially need post-processing on a judgement change.
/// </summary>
protected virtual void UpdateCalculations()
{
}
}
}
|
Store max combo in ScoreProcessor.
|
Store max combo in ScoreProcessor.
|
C#
|
mit
|
UselessToucan/osu,2yangk23/osu,peppy/osu,NeoAdonis/osu,Frontear/osuKyzer,ppy/osu,ppy/osu,nyaamara/osu,theguii/osu,Nabile-Rahmani/osu,peppy/osu,Drezi126/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,DrabWeb/osu,naoey/osu,smoogipoo/osu,johnneijzen/osu,johnneijzen/osu,2yangk23/osu,osu-RP/osu-RP,EVAST9919/osu,naoey/osu,RedNesto/osu,naoey/osu,DrabWeb/osu,EVAST9919/osu,NeoAdonis/osu,UselessToucan/osu,Damnae/osu,NotKyon/lolisu,peppy/osu,smoogipooo/osu,DrabWeb/osu,ZLima12/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,tacchinotacchi/osu,smoogipoo/osu,default0/osu
|
b5ef7dc953441261cd893f3fa2cf8f3f228a2473
|
src/Pfim.Benchmarks/TargaBenchmark.cs
|
src/Pfim.Benchmarks/TargaBenchmark.cs
|
using System.IO;
using BenchmarkDotNet.Attributes;
using FreeImageAPI;
using ImageMagick;
using DS = DevILSharp;
namespace Pfim.Benchmarks
{
public class TargaBenchmark
{
[Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga")]
public string Payload { get; set; }
private byte[] data;
[GlobalSetup]
public void SetupData()
{
data = File.ReadAllBytes(Payload);
DS.Bootstrap.Init();
}
[Benchmark]
public IImage Pfim() => Targa.Create(new MemoryStream(data));
[Benchmark]
public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data));
[Benchmark]
public int ImageMagick()
{
var settings = new MagickReadSettings {Format = MagickFormat.Tga};
using (var image = new MagickImage(new MemoryStream(data), settings))
{
return image.Width;
}
}
[Benchmark]
public int DevILSharp()
{
using (var image = DS.Image.Load(data, DS.ImageType.Tga))
{
return image.Width;
}
}
[Benchmark]
public int TargaImage()
{
using (var image = new Paloma.TargaImage(new MemoryStream(data)))
{
return image.Stride;
}
}
}
}
|
using System.IO;
using BenchmarkDotNet.Attributes;
using FreeImageAPI;
using ImageMagick;
using DS = DevILSharp;
namespace Pfim.Benchmarks
{
public class TargaBenchmark
{
[Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga", "rgb24_top_left")]
public string Payload { get; set; }
private byte[] data;
[GlobalSetup]
public void SetupData()
{
data = File.ReadAllBytes(Payload);
DS.Bootstrap.Init();
}
[Benchmark]
public IImage Pfim() => Targa.Create(new MemoryStream(data));
[Benchmark]
public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data));
[Benchmark]
public int ImageMagick()
{
var settings = new MagickReadSettings {Format = MagickFormat.Tga};
using (var image = new MagickImage(new MemoryStream(data), settings))
{
return image.Width;
}
}
[Benchmark]
public int DevILSharp()
{
using (var image = DS.Image.Load(data, DS.ImageType.Tga))
{
return image.Width;
}
}
[Benchmark]
public int TargaImage()
{
using (var image = new Paloma.TargaImage(new MemoryStream(data)))
{
return image.Stride;
}
}
}
}
|
Include top left encoded targa in benchmark
|
Include top left encoded targa in benchmark
|
C#
|
mit
|
nickbabcock/Pfim,nickbabcock/Pfim
|
cc8cf7191a3cdff5d586120ac3fcb5f51323d60c
|
Options.cs
|
Options.cs
|
using MetroOverhaul.Detours;
using MetroOverhaul.OptionsFramework.Attibutes;
namespace MetroOverhaul
{
[Options("MetroOverhaul")]
public class Options
{
private const string UNSUBPREP = "Unsubscribe Prep";
private const string STYLES = "Additional styles";
private const string GENERAL = "General settings";
public Options()
{
improvedPassengerTrainAi = true;
improvedMetroTrainAi = true;
metroUi = true;
ghostMode = false;
}
[Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)]
public bool metroUi { set; get; }
[Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)]
public bool depotsNotRequiredMode { set; get; }
[Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))]
public bool improvedPassengerTrainAi { set; get; }
[Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))]
public bool improvedMetroTrainAi { set; get; }
[Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)]
public bool ghostMode { set; get; }
}
}
|
using MetroOverhaul.Detours;
using MetroOverhaul.OptionsFramework.Attibutes;
namespace MetroOverhaul
{
[Options("MetroOverhaul")]
public class Options
{
private const string UNSUBPREP = "Unsubscribe Prep";
private const string GENERAL = "General settings";
public Options()
{
improvedPassengerTrainAi = true;
improvedMetroTrainAi = true;
metroUi = true;
ghostMode = false;
depotsNotRequiredMode = false;
}
[Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)]
public bool metroUi { set; get; }
[Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)]
public bool depotsNotRequiredMode { set; get; }
[Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))]
public bool improvedPassengerTrainAi { set; get; }
[Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))]
public bool improvedMetroTrainAi { set; get; }
[Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)]
public bool ghostMode { set; get; }
}
}
|
Set default value for no depot mode.
|
Set default value for no depot mode.
|
C#
|
mit
|
earalov/Skylines-ElevatedTrainStationTrack
|
65f0de9224389ffd8982f13c9da58c5068eb2526
|
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/AddProspectDto.cs
|
PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/AddProspectDto.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
public class AddProspectDto
{
public string CompanyName { get; set; }
public string LocatorId
{
get
{
var id = Convert.ToString(((CompanyName.GetHashCode() ^ DateTime.UtcNow.Ticks.GetHashCode())
& 0xffffff) | 0x1000000, 16).Substring(1);
return id;
}
}
public long MainPhoneCountryKey { get; set; }
public string MainPhoneNumber { get; set; }
public Guid ContactGuid { get; set; }
public Guid AddressGuid { get; set; }
public Guid MainPhoneGuid { get; set; }
}
}
|
using System;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
public class AddProspectDto
{
public string CompanyName { get; set; }
public string LocatorId { get; set; }
public long MainPhoneCountryKey { get; set; }
public string MainPhoneNumber { get; set; }
public Guid ContactGuid { get; set; }
public Guid AddressGuid { get; set; }
public Guid MainPhoneGuid { get; set; }
}
}
|
Remove LocatorId generation code from DTO since the locator id will be generated by a SQL CLR function
|
Remove LocatorId generation code from DTO since the locator id will be generated by a SQL CLR function
|
C#
|
mit
|
Paymentsense/Dapper.SimpleSave
|
71d56ec80f9c59e9d250b99addd6171355410f9a
|
src/dotnet-make/CommandLine.cs
|
src/dotnet-make/CommandLine.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using NDesk.Options;
namespace make
{
public class CommandLine
{
public string Program { get; set; }
public string OutputFile { get; set; }
public string InputFile { get; set; }
public string[] Arguments { get; set; }
private CommandLine()
{
}
public static CommandLine Parse(string[] args)
{
var commandLine = new CommandLine();
var options = new OptionSet
{
{ "p|program=", v => commandLine.Program = v },
{ "o|out=", v => commandLine.OutputFile = v },
};
try
{
var remaining = options.Parse(args);
commandLine.ParseRemainingArguments(remaining);
}
catch (OptionException e)
{
Console.Error.WriteLine(e.Message);
}
return commandLine;
}
private void ParseRemainingArguments(List<string> remaining)
{
var input = "";
var options = new List<string>();
foreach (var arg in remaining)
{
if (arg.StartsWith("/") || arg.StartsWith("-"))
options.Add(arg);
else if (File.Exists(arg))
input = arg;
else
options.Add(arg);
}
InputFile = input;
Arguments = options.ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NDesk.Options;
namespace make
{
public class CommandLine
{
public string Program { get; set; }
public string OutputFile { get; set; }
public string InputFile { get; set; }
public string[] Arguments { get; set; }
private CommandLine()
{
}
public static CommandLine Parse(string[] args)
{
var commandLine = new CommandLine();
var options = new OptionSet
{
{ "p|program=", v => commandLine.Program = v },
{ "o|out=", v => commandLine.OutputFile = v },
};
try
{
var remaining = options.Parse(args);
commandLine.ParseRemainingArguments(remaining);
}
catch (OptionException e)
{
Console.Error.WriteLine(e.Message);
}
return commandLine;
}
private void ParseRemainingArguments(List<string> remaining)
{
var input = "";
var options = new List<string>();
var arguments = remaining.AsEnumerable();
if (Program == null)
{
Program = remaining.FirstOrDefault(a => !a.StartsWith("/") && !a.StartsWith("/"));
if (Program == null)
{
Console.Error.WriteLine("Wrong argument count. Please, use the -t switch to specify a valid program name.");
Environment.Exit(1);
}
arguments = remaining.Skip(1);
}
foreach (var arg in arguments)
{
if (arg.StartsWith("/") || arg.StartsWith("-"))
options.Add(arg);
else if (File.Exists(arg))
input = arg;
else
options.Add(arg);
}
InputFile = input;
Arguments = options.ToArray();
}
}
}
|
Fix - The -t command-line switch is optional. Use first argument if omitted.
|
Fix - The -t command-line switch is optional. Use first argument if omitted.
|
C#
|
apache-2.0
|
springcomp/dotnet-make
|
259d39c6adf5bb51dc1835c992af62e2e3dac427
|
osu.Game/Screens/Edit/Editor.cs
|
osu.Game/Screens/Edit/Editor.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Backgrounds;
namespace osu.Game.Screens.Edit
{
internal class Editor : ScreenWhiteBox
{
//private WorkingBeatmap beatmap;
public Editor(WorkingBeatmap workingBeatmap)
{
//beatmap = workingBeatmap;
}
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500));
}
protected override bool OnExiting(Screen next)
{
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
return base.OnExiting(next);
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Backgrounds;
namespace osu.Game.Screens.Edit
{
internal class Editor : ScreenWhiteBox
{
private WorkingBeatmap beatmap;
public Editor(WorkingBeatmap workingBeatmap)
{
beatmap = workingBeatmap;
}
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500));
beatmap.Track?.Stop();
}
protected override bool OnExiting(Screen next)
{
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
beatmap.Track?.Start();
return base.OnExiting(next);
}
}
}
|
Stop playing the track in editor to avoid unused member warning
|
Stop playing the track in editor
to avoid unused member warning
|
C#
|
mit
|
smoogipoo/osu,NeoAdonis/osu,2yangk23/osu,peppy/osu-new,nyaamara/osu,johnneijzen/osu,peppy/osu,peppy/osu,DrabWeb/osu,Damnae/osu,naoey/osu,Drezi126/osu,EVAST9919/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,RedNesto/osu,DrabWeb/osu,naoey/osu,NeoAdonis/osu,tacchinotacchi/osu,EVAST9919/osu,ZLima12/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,Nabile-Rahmani/osu,osu-RP/osu-RP,peppy/osu,ppy/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,Frontear/osuKyzer
|
ce850fab3d0006797e9b3e36fabc91c13433bff7
|
Framework/Interface/IDownloader.cs
|
Framework/Interface/IDownloader.cs
|
using System.Collections.Generic;
using TirkxDownloader.Models;
namespace TirkxDownloader.Framework.Interface
{
public delegate void DownloadCompleteHandler(GeneralDownloadItem downloadInfo);
/// <summary>
/// Implementation that implement this interface should implement PropertyChanged Event for data-binding
/// </summary>
public interface IDownloader
{
bool IsDownloading { get; }
long MaximumBytesPerSecond { get; set; }
int MaxDownloadingItems { get; set; }
string DownloaderErrorMessage { get; set; }
int DownloadingItems { get; set; }
void DownloadItem(IDownloadItem item);
void DownloadItems(IEnumerable<IDownloadItem> items);
void StopDownloadItem(IDownloadItem item);
void StopDownloadItems(IEnumerable<IDownloadItem> items);
}
}
|
using System.Collections.Generic;
using TirkxDownloader.Models;
namespace TirkxDownloader.Framework.Interface
{
public delegate void DownloadCompleteHandler(GeneralDownloadItem downloadInfo);
/// <summary>
/// Implementation that implement this interface should implement PropertyChanged Event for data-binding
/// </summary>
public interface IDownloader
{
bool IsDownloading { get; }
long MaximumBytesPerSecond { get; }
byte MaxDownloadingItems { get; }
string DownloaderErrorMessage { get; set; }
int DownloadingItems { get; set; }
void DownloadItem(IDownloadItem item);
void DownloadItems(IEnumerable<IDownloadItem> items);
void StopDownloadItem(IDownloadItem item);
void StopDownloadItems(IEnumerable<IDownloadItem> items);
}
}
|
Change date type of MaxDownloadingItems to byte and change to get only
|
Change date type of MaxDownloadingItems to byte and change to get only
|
C#
|
mit
|
witoong623/TirkxDownloader,witoong623/TirkxDownloader
|
2342a50841bcfc8a3d6c0a363b5410a0f9d539e3
|
src/QueueGettingStarted/Program.cs
|
src/QueueGettingStarted/Program.cs
|
using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
using Microsoft.Extensions.Configuration;
namespace QueueGettingStarted
{
public class Program
{
public static void Main(string[] args)
{
// configuration
var builder = new ConfigurationBuilder()
.AddJsonFile("./appsettings.json")
.AddUserSecrets()
.AddEnvironmentVariables();
Configuration = builder.Build();
// options
ConfigurationBinder.Bind(Configuration.GetSection("Azure:Storage"), Options);
Console.WriteLine("Queue encryption sample");
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("");
CloudQueueClient client = storageAccount.CreateCloudQueueClient();
if(client != null){
Console.WriteLine("Client created");
} else {
Console.WriteLine("Error creating client");
}
Console.ReadKey();
}
static IConfiguration Configuration { get; set; }
static AzureStorageOptions Options {get; set; } = new AzureStorageOptions();
}
class AzureStorageOptions {
public string ConnectionString { get; set; }
}
}
|
using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
using Microsoft.Extensions.Configuration;
namespace QueueGettingStarted
{
public class Program
{
public static void Main(string[] args)
{
// configuration
var builder = new ConfigurationBuilder()
.AddJsonFile("./appsettings.json")
.AddUserSecrets()
.AddEnvironmentVariables();
Configuration = builder.Build();
// options
ConfigurationBinder.Bind(Configuration.GetSection("Azure:Storage"), Options);
Console.WriteLine("Queue encryption sample");
Console.WriteLine($"Configuration for ConnectionString: {Options.ConnectionString}");
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Options.ConnectionString);
CloudQueueClient client = storageAccount.CreateCloudQueueClient();
if (client != null)
{
Console.WriteLine("Client created");
}
else
{
Console.WriteLine("Error creating client");
}
Console.ReadKey();
}
static IConfiguration Configuration { get; set; }
static AzureStorageOptions Options { get; set; } = new AzureStorageOptions();
}
class AzureStorageOptions
{
public string ConnectionString { get; set; }
}
}
|
Read connection string from configuration
|
Read connection string from configuration
|
C#
|
mit
|
peterblazejewicz/azure-aspnet5-examples,peterblazejewicz/azure-aspnet5-examples
|
67ed010fcedea2151648a60166a6c9bc010c31d5
|
Portal.CMS.Web/Global.asax.cs
|
Portal.CMS.Web/Global.asax.cs
|
using LogBook.Services;
using LogBook.Services.Models;
using Portal.CMS.Web.Architecture.ViewEngines;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Razor;
using System.Web.Routing;
using System.Web.WebPages;
namespace Portal.CMS.Web
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
ViewEngines.Engines.Add(new CSSViewEngine());
RazorCodeLanguage.Languages.Add("cscss", new CSharpRazorCodeLanguage());
WebPageHttpHandler.RegisterExtension("cscss");
MvcHandler.DisableMvcResponseHeader = true;
}
protected void Application_Error()
{
var logHandler = new LogHandler();
var exception = Server.GetLastError();
logHandler.WriteLog(LogType.Error, "PortalCMS", exception, "An Exception has occured while Running PortalCMS", string.Empty);
if (System.Configuration.ConfigurationManager.AppSettings["CustomErrorPage"] == "true")
{
Response.Redirect("~/Home/Error");
}
}
}
}
|
using LogBook.Services;
using LogBook.Services.Models;
using Portal.CMS.Web.Architecture.Helpers;
using Portal.CMS.Web.Architecture.ViewEngines;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Razor;
using System.Web.Routing;
using System.Web.WebPages;
namespace Portal.CMS.Web
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
ViewEngines.Engines.Add(new CSSViewEngine());
RazorCodeLanguage.Languages.Add("cscss", new CSharpRazorCodeLanguage());
WebPageHttpHandler.RegisterExtension("cscss");
MvcHandler.DisableMvcResponseHeader = true;
}
protected void Application_Error()
{
var logHandler = new LogHandler();
var exception = Server.GetLastError();
var userAccount = UserHelper.UserId;
logHandler.WriteLog(LogType.Error, "PortalCMS", exception, "An Exception has occured while Running PortalCMS", userAccount.ToString());
if (System.Configuration.ConfigurationManager.AppSettings["CustomErrorPage"] == "true")
{
Response.Redirect("~/Home/Error");
}
}
}
}
|
Add UserName to LogEntries When Authenticated
|
Add UserName to LogEntries When Authenticated
|
C#
|
mit
|
tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS
|
1d256f3b5168776d693d6f1f45b0b04ac143cc44
|
SnappyMap/IO/SectionConfig.cs
|
SnappyMap/IO/SectionConfig.cs
|
namespace SnappyMap.IO
{
using System;
using System.Collections.Generic;
using System.Linq;
using SnappyMap.Data;
[Serializable]
public struct SectionMapping
{
public SectionMapping(SectionType type, params string[] sections)
: this()
{
this.Type = type;
this.Sections = sections.ToList();
}
public SectionType Type { get; set; }
public List<string> Sections { get; set; }
}
[Serializable]
public class SectionConfig
{
public SectionConfig()
{
this.SectionMappings = new List<SectionMapping>();
}
public int SeaLevel { get; set; }
public List<SectionMapping> SectionMappings { get; private set; }
}
}
|
namespace SnappyMap.IO
{
using System;
using System.Collections.Generic;
using System.Linq;
using SnappyMap.Data;
[Serializable]
public struct SectionMapping
{
public SectionMapping(SectionType type, params string[] sections)
: this()
{
this.Type = type;
this.Sections = sections.ToList();
}
public SectionType Type { get; set; }
public List<string> Sections { get; set; }
}
[Serializable]
public class SectionConfig
{
public SectionConfig()
{
this.SectionMappings = new List<SectionMapping>();
}
public int SeaLevel { get; set; }
public List<SectionMapping> SectionMappings { get; set; }
}
}
|
Fix potential crash in old .NET versions
|
Fix potential crash in old .NET versions
Apparently in older .NET the XML deserializer
doesn't like it when the type to be deserialized
has properties with private setters.
https://stackoverflow.com/questions/891449/xmlserializer-and-collection-property-with-private-setter
https://www.fmork.net/software/writing/2010/Readonly-collection-properties-and-XmlSerializer.htm
https://stackoverflow.com/questions/23809092/unable-to-generate-a-temporary-class-result-1-cs0200
|
C#
|
mit
|
MHeasell/SnappyMap,MHeasell/SnappyMap
|
8f8211fd184707186ca60e43ed7b95460cb687f6
|
elbgb.gameboy/Timer.cs
|
elbgb.gameboy/Timer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace elbgb.gameboy
{
class Timer
{
public static class Registers
{
public const ushort DIV = 0xFF04;
public const ushort TIMA = 0xFF05;
public const ushort TMA = 0xFF06;
public const ushort TAC = 0xFF07;
}
private GameBoy _gb;
private ulong _lastUpdate;
private ushort _div;
public Timer(GameBoy gameBoy)
{
_gb = gameBoy;
}
public byte ReadByte(ushort address)
{
switch (address)
{
case Registers.DIV: return (byte)(_div >> 8);
default:
throw new NotImplementedException();
}
}
public void WriteByte(ushort address, byte value)
{
switch (address)
{
// a write always clears the upper 8 bits of DIV, regardless of value
case Registers.DIV: _div &= 0x00FF; break;
default:
throw new NotImplementedException();
}
}
public void Update()
{
ulong cyclesToUpdate = _gb.Timestamp - _lastUpdate;
_lastUpdate = _gb.Timestamp;
// update divider
_div += (ushort)cyclesToUpdate;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace elbgb.gameboy
{
class Timer
{
public static class Registers
{
public const ushort DIV = 0xFF04;
public const ushort TIMA = 0xFF05;
public const ushort TMA = 0xFF06;
public const ushort TAC = 0xFF07;
}
private GameBoy _gb;
private ulong _lastUpdate;
private ushort _div;
public Timer(GameBoy gameBoy)
{
_gb = gameBoy;
}
public byte ReadByte(ushort address)
{
switch (address)
{
case Registers.DIV: return (byte)(_div >> 8);
default:
throw new NotImplementedException();
}
}
public void WriteByte(ushort address, byte value)
{
switch (address)
{
// a write always clears the upper 8 bits of DIV, regardless of value
case Registers.DIV: _div &= 0x00FF; break;
default:
throw new NotImplementedException();
}
}
public void Update()
{
ulong cyclesToUpdate = _gb.Timestamp - _lastUpdate;
_lastUpdate = _gb.Timestamp;
UpdateDivider(cyclesToUpdate);
}
private void UpdateDivider(ulong cyclesToUpdate)
{
_div += (ushort)cyclesToUpdate;
}
}
}
|
Split out divider update in timer
|
Split out divider update in timer
|
C#
|
mit
|
eightlittlebits/elbgb
|
1366a1135a518db8c3199150545ef1d0f20a475d
|
src/MeDaUmFilme.Consulta/Movie.cs
|
src/MeDaUmFilme.Consulta/Movie.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MeDaUmFilme
{
public class Movie
{
public string Title { get; set; }
public string Year { get; set; }
}
public class OmdbResult
{
public List<Movie> Search { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MeDaUmFilme
{
public class Movie
{
public string Title { get; set; }
public string Year { get; set; }
public string Poster { get; set; }
public string Type { get; set; }
}
public class OmdbResult
{
public List<Movie> Search { get; set; }
}
}
|
Add image link to movie
|
Add image link to movie
|
C#
|
mit
|
DevChampsBR/MeDaUmFilme
|
24d4deab9a3335bb58cb82f780a9b37cffcabd9c
|
src/MitternachtBot/Services/DbService.cs
|
src/MitternachtBot/Services/DbService.cs
|
using Microsoft.EntityFrameworkCore;
using Mitternacht.Services.Database;
namespace Mitternacht.Services
{
public class DbService
{
private readonly DbContextOptions _options;
public DbService(IBotCredentials creds)
{
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlite(creds.DbConnectionString);
_options = optionsBuilder.Options;
//switch (_creds.Db.Type.ToUpperInvariant())
//{
// case "SQLITE":
// dbType = typeof(NadekoSqliteContext);
// break;
// //case "SQLSERVER":
// // dbType = typeof(NadekoSqlServerContext);
// // break;
// default:
// break;
//}
}
public NadekoContext GetDbContext()
{
var context = new NadekoContext(_options);
context.Database.SetCommandTimeout(60);
context.Database.Migrate();
context.EnsureSeedData();
//set important sqlite stuffs
var conn = context.Database.GetDbConnection();
conn.Open();
context.Database.ExecuteSqlRaw("PRAGMA journal_mode=WAL");
using (var com = conn.CreateCommand())
{
com.CommandText = "PRAGMA journal_mode=WAL; PRAGMA synchronous=OFF";
com.ExecuteNonQuery();
}
return context;
}
public IUnitOfWork UnitOfWork =>
new UnitOfWork(GetDbContext());
}
}
|
using Microsoft.EntityFrameworkCore;
using Mitternacht.Services.Database;
namespace Mitternacht.Services {
public class DbService {
private readonly DbContextOptions _options;
public DbService(IBotCredentials creds) {
var optionsBuilder = new DbContextOptionsBuilder();
optionsBuilder.UseSqlite(creds.DbConnectionString);
_options = optionsBuilder.Options;
}
public NadekoContext GetDbContext() {
var context = new NadekoContext(_options);
context.Database.SetCommandTimeout(60);
context.Database.Migrate();
context.EnsureSeedData();
//set important sqlite stuffs
var conn = context.Database.GetDbConnection();
conn.Open();
context.Database.ExecuteSqlRaw("PRAGMA journal_mode=WAL");
using(var com = conn.CreateCommand()) {
com.CommandText = "PRAGMA journal_mode=WAL; PRAGMA synchronous=OFF";
com.ExecuteNonQuery();
}
return context;
}
public IUnitOfWork UnitOfWork =>
new UnitOfWork(GetDbContext());
}
}
|
Format file, remove outcommented code.
|
Format file, remove outcommented code.
|
C#
|
mit
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
9b50902452f06dc9a4623e2d736a8c4cb916955c
|
src/Loggers/MassTransit.Log4NetIntegration/Logging/Log4NetLogger.cs
|
src/Loggers/MassTransit.Log4NetIntegration/Logging/Log4NetLogger.cs
|
// Copyright 2007-2011 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.Log4NetIntegration.Logging
{
using System.IO;
using MassTransit.Logging;
using log4net;
using log4net.Config;
public class Log4NetLogger :
ILogger
{
public MassTransit.Logging.ILog Get(string name)
{
return new Log4NetLog(LogManager.GetLogger(name));
}
public static void Use()
{
Logger.UseLogger(new Log4NetLogger());
}
public static void Use(string file)
{
Logger.UseLogger(new Log4NetLogger());
var configFile = new FileInfo(file);
XmlConfigurator.Configure(configFile);
}
}
}
|
// Copyright 2007-2011 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.Log4NetIntegration.Logging
{
using System;
using System.IO;
using MassTransit.Logging;
using log4net;
using log4net.Config;
public class Log4NetLogger :
ILogger
{
public MassTransit.Logging.ILog Get(string name)
{
return new Log4NetLog(LogManager.GetLogger(name));
}
public static void Use()
{
Logger.UseLogger(new Log4NetLogger());
}
public static void Use(string file)
{
Logger.UseLogger(new Log4NetLogger());
file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, file);
var configFile = new FileInfo(file);
XmlConfigurator.Configure(configFile);
}
}
}
|
Fix Log4Net path for loading config file
|
Fix Log4Net path for loading config file
The Log4Net config file should be picked up from the base directory of
the current app domain so that when running as a windows service MT will
load the log4net config file from the app directory and not a Windows
system folder
Former-commit-id: 0d8ad7b1ff7239c974641b8c44bd82fe1d4e148b
|
C#
|
apache-2.0
|
jacobpovar/MassTransit,jacobpovar/MassTransit,MassTransit/MassTransit,phatboyg/MassTransit,phatboyg/MassTransit,MassTransit/MassTransit,SanSYS/MassTransit,SanSYS/MassTransit
|
0b5067d74e5c290bdc73785a304fa7acc4fcde9c
|
src/Libraries/Web/Html/TokenList.cs
|
src/Libraries/Web/Html/TokenList.cs
|
// TokenList.cs
// Script#/Libraries/Web
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Runtime.CompilerServices;
namespace System.Html {
[IgnoreNamespace]
[Imported]
public class TokenList {
internal TokenList() {
}
[IntrinsicProperty]
[ScriptName("length")]
public int Count {
get {
return 0;
}
}
[IntrinsicProperty]
public string this[int index] {
get {
return null;
}
}
public bool Contains(string token) {
return false;
}
public void Add(string token) {
}
public void Remove(string token) {
}
public bool Toggle(string token) {
return false;
}
public override string ToString() {
return null;
}
}
}
|
// TokenList.cs
// Script#/Libraries/Web
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Runtime.CompilerServices;
namespace System.Html {
[IgnoreNamespace]
[Imported]
public sealed class TokenList {
private TokenList() {
}
[IntrinsicProperty]
[ScriptName("length")]
public int Count {
get {
return 0;
}
}
[IntrinsicProperty]
public string this[int index] {
get {
return null;
}
}
public bool Contains(string token) {
return false;
}
public void Add(string token) {
}
public void Remove(string token) {
}
public bool Toggle(string token) {
return false;
}
public override string ToString() {
return null;
}
}
}
|
Update access modifiers for metadata class
|
Update access modifiers for metadata class
|
C#
|
apache-2.0
|
nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,x335/scriptsharp
|
38afc53bad96157459e66ee0920b8120e6bf375d
|
osu.Game/Tests/VisualTestRunner.cs
|
osu.Game/Tests/VisualTestRunner.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using osu.Framework;
using osu.Framework.Platform;
namespace osu.Game.Tests
{
public static class VisualTestRunner
{
[STAThread]
public static int Main(string[] args)
{
using (DesktopGameHost host = Host.GetSuitableDesktopHost(@"osu", new HostOptions { BindIPC = true, }))
{
host.Run(new OsuTestBrowser());
return 0;
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using osu.Framework;
using osu.Framework.Platform;
namespace osu.Game.Tests
{
public static class VisualTestRunner
{
[STAThread]
public static int Main(string[] args)
{
using (DesktopGameHost host = Host.GetSuitableDesktopHost(@"osu-development", new HostOptions { BindIPC = true, }))
{
host.Run(new OsuTestBrowser());
return 0;
}
}
}
}
|
Update interactive visual test runs to use development directory
|
Update interactive visual test runs to use development directory
|
C#
|
mit
|
ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu,ppy/osu
|
c2f21218b4e2d7d5e158d20c54376ba4009b472b
|
DiffPlex/Properties/AssemblyInfo.cs
|
DiffPlex/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("DiffPlex")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("DiffPlex")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.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("DiffPlex")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("DiffPlex")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Assembly version should consist of just major and minor versions.
// We omit revision and build numbers so that folks who compile against
// 1.2.0 can also run against 1.2.1 without a recompile or a binding redirect.
[assembly: AssemblyVersion("1.2.0.0")]
// File version can include the revision and build numbers so
// file properties can reveal the true version of this build.
[assembly: AssemblyFileVersion("1.2.1.0")]
|
Update file version of DLL to match NuGet package.
|
Update file version of DLL to match NuGet package.
Also remove the random component of the assembly version for easier runtime binding of clients.
|
C#
|
apache-2.0
|
mmanela/diffplex,mmanela/diffplex,mmanela/diffplex,mmanela/diffplex
|
e8c142353c28b60c1f00fa699eabeef607b64666
|
Plugins/Wox.Plugin.WebSearch/WebSearch.cs
|
Plugins/Wox.Plugin.WebSearch/WebSearch.cs
|
using System.IO;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Wox.Plugin.WebSearch
{
public class WebSearch
{
public const string DefaultIcon = "web_search.png";
public string Title { get; set; }
public string ActionKeyword { get; set; }
[NotNull]
private string _icon = DefaultIcon;
[NotNull]
public string Icon
{
get { return _icon; }
set
{
_icon = value;
IconPath = Path.Combine(WebSearchPlugin.PluginDirectory, WebSearchPlugin.ImageDirectory, value);
}
}
/// <summary>
/// All icon should be put under Images directory
/// </summary>
[NotNull]
[JsonIgnore]
internal string IconPath { get; private set; }
public string Url { get; set; }
public bool Enabled { get; set; }
}
}
|
using System.IO;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Wox.Plugin.WebSearch
{
public class WebSearch
{
public const string DefaultIcon = "web_search.png";
public string Title { get; set; }
public string ActionKeyword { get; set; }
[NotNull]
private string _icon = DefaultIcon;
[NotNull]
public string Icon
{
get { return _icon; }
set
{
_icon = value;
IconPath = Path.Combine(WebSearchPlugin.PluginDirectory, WebSearchPlugin.ImageDirectory, value);
}
}
/// <summary>
/// All icon should be put under Images directory
/// </summary>
[NotNull]
[JsonIgnore]
internal string IconPath { get; private set; } = Path.Combine
(
WebSearchPlugin.PluginDirectory, WebSearchPlugin.ImageDirectory, DefaultIcon
);
public string Url { get; set; }
public bool Enabled { get; set; }
}
}
|
Fix default icon path when add new web search
|
Fix default icon path when add new web search
|
C#
|
mit
|
qianlifeng/Wox,Wox-launcher/Wox,lances101/Wox,Wox-launcher/Wox,lances101/Wox,qianlifeng/Wox,qianlifeng/Wox
|
6c691952231b9f76b08d7786c539e641c09dcb62
|
MultiMiner.Blockchain/ApiContext.cs
|
MultiMiner.Blockchain/ApiContext.cs
|
using MultiMiner.Blockchain.Data;
using MultiMiner.ExchangeApi;
using MultiMiner.ExchangeApi.Data;
using MultiMiner.Utility.Net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
namespace MultiMiner.Blockchain
{
public class ApiContext : IApiContext
{
public IEnumerable<ExchangeInformation> GetExchangeInformation()
{
WebClient webClient = new ApiWebClient();
webClient.Encoding = Encoding.UTF8;
string response = webClient.DownloadString(new Uri(GetApiUrl()));
Dictionary<string, TickerEntry> tickerEntries = JsonConvert.DeserializeObject<Dictionary<string, TickerEntry>>(response);
List<ExchangeInformation> results = new List<ExchangeInformation>();
foreach (KeyValuePair<string, TickerEntry> keyValuePair in tickerEntries)
{
results.Add(new ExchangeInformation()
{
SourceCurrency = "BTC",
TargetCurrency = keyValuePair.Key,
TargetSymbol = keyValuePair.Value.Symbol,
ExchangeRate = keyValuePair.Value.Last
});
}
return results;
}
public string GetInfoUrl()
{
return "https://blockchain.info";
}
public string GetApiUrl()
{
//use HTTP as HTTPS is down at times and returns:
//The request was aborted: Could not create SSL/TLS secure channel.
return "http://blockchain.info/ticker";
}
public string GetApiName()
{
return "Blockchain";
}
}
}
|
using MultiMiner.Blockchain.Data;
using MultiMiner.ExchangeApi;
using MultiMiner.ExchangeApi.Data;
using MultiMiner.Utility.Net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
namespace MultiMiner.Blockchain
{
public class ApiContext : IApiContext
{
public IEnumerable<ExchangeInformation> GetExchangeInformation()
{
ApiWebClient webClient = new ApiWebClient();
webClient.Encoding = Encoding.UTF8;
string response = webClient.DownloadFlakyString(new Uri(GetApiUrl()));
Dictionary<string, TickerEntry> tickerEntries = JsonConvert.DeserializeObject<Dictionary<string, TickerEntry>>(response);
List<ExchangeInformation> results = new List<ExchangeInformation>();
foreach (KeyValuePair<string, TickerEntry> keyValuePair in tickerEntries)
{
results.Add(new ExchangeInformation()
{
SourceCurrency = "BTC",
TargetCurrency = keyValuePair.Key,
TargetSymbol = keyValuePair.Value.Symbol,
ExchangeRate = keyValuePair.Value.Last
});
}
return results;
}
public string GetInfoUrl()
{
return "https://blockchain.info";
}
public string GetApiUrl()
{
//use HTTP as HTTPS is down at times and returns:
//The request was aborted: Could not create SSL/TLS secure channel.
return "https://blockchain.info/ticker";
}
public string GetApiName()
{
return "Blockchain";
}
}
}
|
Introduce a retry machanism with the Blockchain API
|
Introduce a retry machanism with the Blockchain API
|
C#
|
mit
|
IWBWbiz/MultiMiner,nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner
|
30b8ebfb9c4e70ac1ea3806a2d66bb8f04ee6e88
|
src/NodaTime/Annotations/ReadWriteForEfficiencyAttribute.cs
|
src/NodaTime/Annotations/ReadWriteForEfficiencyAttribute.cs
|
// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Annotations
{
/// <summary>
/// Indicates that a value-type field which would otherwise by <c>readonly</c>
/// is read/write so that invoking members on the field avoids taking a copy of
/// the field value.
/// </summary>
/// <remarks>
/// See http://msmvps.com/blogs/jon_skeet/archive/2014/07/16/micro-optimization-the-surprising-inefficiency-of-readonly-fields.aspx
/// for details of why we're doing this at all.
/// </remarks>
[AttributeUsage(AttributeTargets.Field)]
internal sealed class ReadWriteForEfficiencyAttribute : Attribute
{
}
}
|
// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
namespace NodaTime.Annotations
{
/// <summary>
/// Indicates that a value-type field which would otherwise by <c>readonly</c>
/// is read/write so that invoking members on the field avoids taking a copy of
/// the field value.
/// </summary>
/// <remarks>
/// See http://noda-time.blogspot.com/2014/07/micro-optimization-surprising.html
/// for details of why we're doing this at all.
/// </remarks>
[AttributeUsage(AttributeTargets.Field)]
internal sealed class ReadWriteForEfficiencyAttribute : Attribute
{
}
}
|
Fix the URL to point at the Noda Time blog because msmvps.com 503.
|
Fix the URL to point at the Noda Time blog because msmvps.com 503.
|
C#
|
apache-2.0
|
zaccharles/nodatime,zaccharles/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,zaccharles/nodatime,zaccharles/nodatime,zaccharles/nodatime,zaccharles/nodatime,jskeet/nodatime,nodatime/nodatime,nodatime/nodatime,malcolmr/nodatime,malcolmr/nodatime,malcolmr/nodatime,jskeet/nodatime
|
f1d241ba934c7bd6f0a00122759b402005666b63
|
Training.CSharpWorkshop.Tests/ProgramTests.cs
|
Training.CSharpWorkshop.Tests/ProgramTests.cs
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Training.CSharpWorkshop.Tests
{
[TestClass]
public class ProgramTests
{
[Ignore]
[TestMethod]
public void IgnoreTest()
{
Assert.Fail();
}
[TestMethod()]
public void GetRoleMessageForAdminTest()
{
// Arrange
var userName = "Andrew";
var expected = "Role: Admin.";
// Act
var actual = Program.GetRoleMessage(userName);
// Assert
Assert.AreEqual(expected, actual);
}
}
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Training.CSharpWorkshop.Tests
{
[TestClass]
public class ProgramTests
{
[Ignore]
[TestMethod]
public void IgnoreTest()
{
Assert.Fail();
}
[TestMethod()]
public void GetRoleMessageForAdminTest()
{
// Arrange
var userName = "Andrew";
var expected = "Role: Admin.";
// Act
var actual = Program.GetRoleMessage(userName);
// Assert
Assert.AreEqual(expected, actual);
}
[TestMethod()]
public void GetRoleMessageForGuestTest()
{
// Arrange
var userName = "Dave";
var expected = "Role: Guest.";
// Act
var actual = Program.GetRoleMessage(userName);
// Assert
Assert.AreEqual(expected, actual);
}
}
}
|
Update Console Program with a Condition - Add unit test for Guest role
|
Update Console Program with a Condition - Add unit test for Guest role
|
C#
|
mit
|
penblade/Training.CSharpWorkshop
|
5e19719bd8e5ed9103a8e929a2bc48fd70396b2c
|
src/TramlineFive/TramlineFive/Converters/TimingConverter.cs
|
src/TramlineFive/TramlineFive/Converters/TimingConverter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;
namespace TramlineFive.Converters
{
public class TimingConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
string[] timings = (string[])value;
StringBuilder builder = new StringBuilder();
foreach (string singleTiming in timings)
{
TimeSpan timing;
if (TimeSpan.TryParse((string)singleTiming, out timing))
{
TimeSpan timeLeft = timing - DateTime.Now.TimeOfDay;
builder.AppendFormat("{0} ({1} мин), ", singleTiming, timeLeft.Minutes < 0 ? 0 : timeLeft.Minutes);
}
}
builder.Remove(builder.Length - 2, 2);
return builder.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;
namespace TramlineFive.Converters
{
public class TimingConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
string[] timings = (string[])value;
StringBuilder builder = new StringBuilder();
foreach (string singleTiming in timings)
{
TimeSpan timing;
if (TimeSpan.TryParse((string)singleTiming, out timing))
{
int timeLeft = (int)(timing - DateTime.Now.TimeOfDay).TotalMinutes;
builder.AppendFormat("{0} ({1} мин), ", singleTiming, timeLeft < 0 ? 0 : timeLeft);
}
}
builder.Remove(builder.Length - 2, 2);
return builder.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
|
Fix showing only minutes of the hour insteal of total minutes in virtual table.
|
Fix showing only minutes of the hour insteal of total minutes in virtual table.
|
C#
|
apache-2.0
|
betrakiss/Tramline-5,betrakiss/Tramline-5
|
3b2c10495606a26b9d51d1e4fd2c18d3a26b08d6
|
src/Hangfire.Mongo/Migration/Steps/Version11/00_UseObjectIdForJob.cs
|
src/Hangfire.Mongo/Migration/Steps/Version11/00_UseObjectIdForJob.cs
|
using System.Linq;
using MongoDB.Bson;
using MongoDB.Driver;
namespace Hangfire.Mongo.Migration.Steps.Version11
{
/// <summary>
/// Create signal capped collection
/// </summary>
internal class UseObjectIdForJob : IMongoMigrationStep
{
public MongoSchema TargetSchema => MongoSchema.Version11;
public long Sequence => 0;
public bool Execute(IMongoDatabase database, MongoStorageOptions storageOptions, IMongoMigrationBag migrationBag)
{
var jobsCollection = database.GetCollection<BsonDocument>(storageOptions.Prefix + ".job");
SetFieldAsObjectId(jobsCollection, "_id");
var jobQueueCollection = database.GetCollection<BsonDocument>(storageOptions.Prefix + ".jobQueue");
SetFieldAsObjectId(jobQueueCollection, "JobId");
return true;
}
private static void SetFieldAsObjectId(IMongoCollection<BsonDocument> collection, string fieldName)
{
var documents = collection.Find(new BsonDocument()).ToList();
if(!documents.Any()) return;
foreach (var doc in documents)
{
var jobIdString = doc[fieldName].ToString();
doc[fieldName] = ObjectId.Parse(jobIdString);
}
collection.DeleteMany(new BsonDocument());
collection.InsertMany(documents);
}
}
}
|
using System.Linq;
using MongoDB.Bson;
using MongoDB.Driver;
namespace Hangfire.Mongo.Migration.Steps.Version11
{
/// <summary>
/// Create signal capped collection
/// </summary>
internal class UseObjectIdForJob : IMongoMigrationStep
{
public MongoSchema TargetSchema => MongoSchema.Version11;
public long Sequence => 0;
public bool Execute(IMongoDatabase database, MongoStorageOptions storageOptions, IMongoMigrationBag migrationBag)
{
var jobsCollection = database.GetCollection<BsonDocument>(storageOptions.Prefix + ".job");
SetFieldAsObjectId(jobsCollection, "_id");
var jobQueueCollection = database.GetCollection<BsonDocument>(storageOptions.Prefix + ".jobQueue");
SetFieldAsObjectId(jobQueueCollection, "JobId");
return true;
}
private static void SetFieldAsObjectId(IMongoCollection<BsonDocument> collection, string fieldName)
{
var filter = Builders<BsonDocument>.Filter.Exists(fieldName);
var documents = collection.Find(filter).ToList();
if (!documents.Any()) return;
foreach (var doc in documents)
{
var jobIdString = doc[fieldName].ToString();
doc[fieldName] = ObjectId.Parse(jobIdString);
}
collection.DeleteMany(new BsonDocument());
collection.InsertMany(documents);
}
}
}
|
Fix broken migration for v11
|
Fix broken migration for v11
|
C#
|
mit
|
sergeyzwezdin/Hangfire.Mongo,sergeyzwezdin/Hangfire.Mongo,sergun/Hangfire.Mongo,sergeyzwezdin/Hangfire.Mongo,sergun/Hangfire.Mongo
|
d1e98d0f91e23cf687b793c161381eda7533cffe
|
sample/Program.cs
|
sample/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hjson;
namespace HjsonSample
{
class Program
{
static void Main(string[] args)
{
var data=HjsonValue.Load("test.hjson").Qo();
Console.WriteLine(data.Qs("hello"));
Console.WriteLine("Saving as json...");
HjsonValue.Save(data, "test.json");
Console.WriteLine("Saving as hjson...");
HjsonValue.Save(data, "test2.hjson");
// edit (preserve whitespace and comments)
var wdata=(WscJsonObject)HjsonValue.LoadWsc(new StreamReader("test.hjson")).Qo();
// edit like you normally would
wdata["hugo"]="value";
// optionally set order and comments:
wdata.Order.Insert(2, "hugo");
wdata.Comments["hugo"]="just another test";
var sw=new StringWriter();
HjsonValue.SaveWsc(wdata, sw);
Console.WriteLine(sw.ToString());
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hjson;
namespace HjsonSample
{
class Program
{
static void Main(string[] args)
{
var data=HjsonValue.Load("test.hjson").Qo();
Console.WriteLine(data.Qs("hello"));
Console.WriteLine("Saving as json...");
HjsonValue.Save(data, "test.json");
Console.WriteLine("Saving as hjson...");
HjsonValue.Save(data, "test2.hjson");
// edit (preserve whitespace and comments)
var wdata=(WscJsonObject)HjsonValue.Load(new StreamReader("test.hjson"), preserveComments:true).Qo();
// edit like you normally would
wdata["hugo"]="value";
// optionally set order and comments:
wdata.Order.Insert(2, "hugo");
wdata.Comments["hugo"]="just another test";
var sw=new StringWriter();
HjsonValue.Save(wdata, sw, new HjsonOptions() { KeepWsc = true });
Console.WriteLine(sw.ToString());
}
}
}
|
Update sample to use Save() and Load()
|
Update sample to use Save() and Load()
SaveWsc() no longer existed at all, and LoadWsc() was marked obsolete
|
C#
|
mit
|
laktak/hjson-cs,hjson/hjson-cs,hjson/hjson-cs
|
0c2fe142885f0bc6992aaf419a20f47ade190400
|
SolidworksAddinFramework/DisposableExtensions.cs
|
SolidworksAddinFramework/DisposableExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
using System.Text;
namespace SolidworksAddinFramework
{
public static class DisposableExtensions
{
public static IDisposable ToCompositeDisposable(this IEnumerable<IDisposable> d)
{
return new CompositeDisposable(d);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Reactive.Disposables;
using System.Text;
namespace SolidworksAddinFramework
{
public static class DisposableExtensions
{
public static IDisposable ToCompositeDisposable(this IEnumerable<IDisposable> d)
{
return new CompositeDisposable(d);
}
public static void DisposeWith(this IDisposable disposable, CompositeDisposable container)
{
container.Add(disposable);
}
}
}
|
Add extension method to add a disposable to a composite disposable
|
Add extension method to add a disposable to a composite disposable
|
C#
|
mit
|
Weingartner/SolidworksAddinFramework
|
b455a4963a5eb9d679f3380b7b38770411c38ffa
|
Perspex.Themes.Default/MenuStyle.cs
|
Perspex.Themes.Default/MenuStyle.cs
|
// -----------------------------------------------------------------------
// <copyright file="MenuStyle.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Themes.Default
{
using Perspex.Controls;
using Perspex.Controls.Presenters;
using Perspex.Styling;
using System.Linq;
public class MenuStyle : Styles
{
public MenuStyle()
{
this.AddRange(new[]
{
new Style(x => x.OfType<Menu>())
{
Setters = new[]
{
new Setter(Menu.TemplateProperty, ControlTemplate.Create<Menu>(this.Template)),
},
},
});
}
private Control Template(Menu control)
{
return new Border
{
[~Border.BackgroundProperty] = control[~Menu.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~Menu.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~Menu.BorderThicknessProperty],
[~Border.PaddingProperty] = control[~Menu.PaddingProperty],
Content = new ItemsPresenter
{
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~Menu.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~Menu.ItemsPanelProperty],
}
};
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="MenuStyle.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Themes.Default
{
using System.Linq;
using Perspex.Controls;
using Perspex.Controls.Presenters;
using Perspex.Input;
using Perspex.Styling;
public class MenuStyle : Styles
{
public MenuStyle()
{
this.AddRange(new[]
{
new Style(x => x.OfType<Menu>())
{
Setters = new[]
{
new Setter(Menu.TemplateProperty, ControlTemplate.Create<Menu>(this.Template)),
},
},
});
}
private Control Template(Menu control)
{
return new Border
{
[~Border.BackgroundProperty] = control[~Menu.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~Menu.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~Menu.BorderThicknessProperty],
[~Border.PaddingProperty] = control[~Menu.PaddingProperty],
Content = new ItemsPresenter
{
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~Menu.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~Menu.ItemsPanelProperty],
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Continue,
}
};
}
}
}
|
Use TabNavigation.Continue for top-level menu.
|
Use TabNavigation.Continue for top-level menu.
|
C#
|
mit
|
wieslawsoltes/Perspex,jkoritzinsky/Avalonia,grokys/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,susloparovdenis/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,Perspex/Perspex,OronDF343/Avalonia,susloparovdenis/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,bbqchickenrobot/Perspex,jkoritzinsky/Perspex,MrDaedra/Avalonia,DavidKarlas/Perspex,AvaloniaUI/Avalonia,susloparovdenis/Perspex,grokys/Perspex,OronDF343/Avalonia,AvaloniaUI/Avalonia,sagamors/Perspex,AvaloniaUI/Avalonia,ncarrillo/Perspex,wieslawsoltes/Perspex,akrisiun/Perspex,SuperJMN/Avalonia,kekekeks/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jazzay/Perspex,punker76/Perspex,AvaloniaUI/Avalonia,danwalmsley/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,tshcherban/Perspex,kekekeks/Perspex,susloparovdenis/Avalonia,MrDaedra/Avalonia,wieslawsoltes/Perspex
|
178c2b1966cb8910ffc3f8c0fa8507c9094c36cd
|
lib/Bugsnag.Common/BugsnagClient.cs
|
lib/Bugsnag.Common/BugsnagClient.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Bugsnag.Common
{
public class BugsnagClient : IClient
{
static Uri _uri = new Uri("http://notify.bugsnag.com");
static Uri _sslUri = new Uri("https://notify.bugsnag.com");
static JsonSerializerSettings _settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
static HttpClient _HttpClient { get; } = new HttpClient();
public void Send(INotice notice) => Send(notice, true);
public void Send(INotice notice, bool useSSL)
{
var _ = SendAsync(notice, useSSL).Result;
}
public Task<HttpResponseMessage> SendAsync(INotice notice) => SendAsync(notice, true);
public Task<HttpResponseMessage> SendAsync(INotice notice, bool useSSL)
{
var uri = useSSL ? _sslUri : _uri;
var json = JsonConvert.SerializeObject(notice, _settings);
var content = new StringContent(json, Encoding.UTF8, "application/json");
return _HttpClient.PostAsync(uri, content);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Bugsnag.Common
{
public class BugsnagClient : IClient
{
static Uri _uri = new Uri("http://notify.bugsnag.com");
static Uri _sslUri = new Uri("https://notify.bugsnag.com");
static JsonSerializerSettings _settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
static HttpClient _HttpClient { get; } = new HttpClient();
public void Send(INotice notice) => Send(notice, true);
public void Send(INotice notice, bool useSSL) => SendAsync(notice, useSSL).Wait();
public Task<HttpResponseMessage> SendAsync(INotice notice) => SendAsync(notice, true);
public Task<HttpResponseMessage> SendAsync(INotice notice, bool useSSL)
{
var uri = useSSL ? _sslUri : _uri;
var json = JsonConvert.SerializeObject(notice, _settings);
var content = new StringContent(json, Encoding.UTF8, "application/json");
return _HttpClient.PostAsync(uri, content);
}
}
}
|
Use Wait() instead of Result in void overload
|
Use Wait() instead of Result in void overload
|
C#
|
mit
|
awseward/Bugsnag.NET,awseward/Bugsnag.NET
|
16930ad4698363cd3ab447d89e465d294814ca3e
|
src/MiniProfiler.AspNetCore.Mvc/MvcExtensions.cs
|
src/MiniProfiler.AspNetCore.Mvc/MvcExtensions.cs
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System.Linq;
namespace StackExchange.Profiling.Mvc
{
/// <summary>
/// Extension methods for configuring MiniProfiler for MVC
/// </summary>
public static class MvcExtensions
{
/// <summary>
/// Adds MiniProfiler timings for actions and views
/// </summary>
/// <param name="services">The services collection to configure</param>
public static IServiceCollection AddMiniProfiler(this IServiceCollection services) =>
services.AddTransient<IConfigureOptions<MvcOptions>, MiniPofilerSetup>()
.AddTransient<IConfigureOptions<MvcViewOptions>, MiniPofilerSetup>();
}
internal class MiniPofilerSetup : IConfigureOptions<MvcViewOptions>, IConfigureOptions<MvcOptions>
{
public void Configure(MvcViewOptions options)
{
var copy = options.ViewEngines.ToList();
options.ViewEngines.Clear();
foreach (var item in copy)
{
options.ViewEngines.Add(new ProfilingViewEngine(item));
}
}
public void Configure(MvcOptions options)
{
options.Filters.Add(new ProfilingActionFilter());
}
}
}
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System.Linq;
namespace StackExchange.Profiling.Mvc
{
/// <summary>
/// Extension methods for configuring MiniProfiler for MVC
/// </summary>
public static class MvcExtensions
{
/// <summary>
/// Adds MiniProfiler timings for actions and views
/// </summary>
/// <param name="services">The services collection to configure</param>
public static IServiceCollection AddMiniProfiler(this IServiceCollection services) =>
services.AddTransient<IConfigureOptions<MvcOptions>, MiniPofilerSetup>()
.AddTransient<IConfigureOptions<MvcViewOptions>, MiniPofilerSetup>();
}
internal class MiniPofilerSetup : IConfigureOptions<MvcViewOptions>, IConfigureOptions<MvcOptions>
{
public void Configure(MvcViewOptions options)
{
for (var i = 0; i < options.ViewEngines.Count; i++)
{
options.ViewEngines[i] = new ProfilingViewEngine(options.ViewEngines[i]);
}
}
public void Configure(MvcOptions options)
{
options.Filters.Add(new ProfilingActionFilter());
}
}
}
|
Simplify view engine wrapping for MVC Core
|
Simplify view engine wrapping for MVC Core
|
C#
|
mit
|
MiniProfiler/dotnet,MiniProfiler/dotnet
|
aa0bc7af6f4138ab41893a9c638c9f147b353837
|
src/Host/Client/Test/RStringExtensionsTest.cs
|
src/Host/Client/Test/RStringExtensionsTest.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;
namespace Microsoft.R.Host.Client.Test {
[ExcludeFromCodeCoverage]
public class RStringExtensionsTest {
[Test]
[Category.Variable.Explorer]
public void ConvertCharacterCodesTest() {
string target = "<U+4E2D><U+570B><U+8A9E>";
target.ConvertCharacterCodes().Should().Be("中國語");
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;
namespace Microsoft.R.Host.Client.Test {
[ExcludeFromCodeCoverage]
public class RStringExtensionsTest {
[Test]
[Category.Variable.Explorer]
public void ConvertCharacterCodesTest() {
string target = "<U+4E2D><U+570B><U+8A9E>";
target.ConvertCharacterCodes().Should().Be("中國語");
}
[CompositeTest]
[InlineData("\t\n", "\"\\t\\n\"")]
[InlineData("\\t\n", "\"\\\\t\\n\"")]
[InlineData("\n", "\"\\n\"")]
[InlineData("\\n", "\"\\\\n\"")]
public void EscapeCharacterTest(string source, string expectedLiteral) {
string actualLiteral = source.ToRStringLiteral();
actualLiteral.Should().Be(expectedLiteral);
string actualSource = actualLiteral.FromRStringLiteral();
actualSource.Should().Be(source);
}
}
}
|
Add some tests for string extension.
|
Add some tests for string extension.
|
C#
|
mit
|
AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS
|
a088494af55829fce7c76e88198402737ac9cb76
|
src/Pickles/Pickles/StrikeMarkdownProvider.cs
|
src/Pickles/Pickles/StrikeMarkdownProvider.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StrikeMarkdownProvider.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 Strike;
using Strike.Jint;
namespace PicklesDoc.Pickles
{
public class StrikeMarkdownProvider : IMarkdownProvider
{
private readonly Markdownify markdownify;
public StrikeMarkdownProvider()
{
this.markdownify = new Markdownify(
new Options { Xhtml = true },
new RenderMethods());
}
public string Transform(string text)
{
return this.markdownify.Transform(text);
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StrikeMarkdownProvider.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 Strike;
using Strike.Jint;
namespace PicklesDoc.Pickles
{
public class StrikeMarkdownProvider : IMarkdownProvider
{
private readonly Markdownify markdownify;
public StrikeMarkdownProvider()
{
this.markdownify = new Markdownify(
new Options { Xhtml = true },
new RenderMethods());
}
public string Transform(string text)
{
return this.markdownify.Transform(text).Replace(" ", string.Empty);
}
}
}
|
Add handling for non breaking spaces
|
Add handling for non breaking spaces
|
C#
|
apache-2.0
|
magicmonty/pickles,picklesdoc/pickles,dirkrombauts/pickles,ludwigjossieaux/pickles,dirkrombauts/pickles,picklesdoc/pickles,ludwigjossieaux/pickles,ludwigjossieaux/pickles,magicmonty/pickles,dirkrombauts/pickles,magicmonty/pickles,magicmonty/pickles,picklesdoc/pickles,dirkrombauts/pickles,picklesdoc/pickles
|
23ed8f563c9c7317524a15d2fc206c7aa01ae88c
|
src/MonoTorrent/MonoTorrent.Client/EventArgs/TrackerRequestEventArgs.cs
|
src/MonoTorrent/MonoTorrent.Client/EventArgs/TrackerRequestEventArgs.cs
|
using System;
using System.Collections.Generic;
using MonoTorrent.BEncoding;
namespace MonoTorrent.Client.Tracker
{
public abstract class TrackerResponseEventArgs : EventArgs
{
private bool successful;
private Tracker tracker;
/// <summary>
/// True if the request completed successfully
/// </summary>
public bool Successful
{
get { return successful; }
set { successful = value; }
}
/// <summary>
/// The tracker which the request was sent to
/// </summary>
public Tracker Tracker
{
get { return tracker; }
protected set { tracker = value; }
}
protected TrackerResponseEventArgs(Tracker tracker, bool successful)
{
if (tracker == null)
throw new ArgumentNullException("tracker");
this.tracker = tracker;
}
}
}
|
using System;
using System.Collections.Generic;
using MonoTorrent.BEncoding;
namespace MonoTorrent.Client.Tracker
{
public abstract class TrackerResponseEventArgs : EventArgs
{
private bool successful;
private Tracker tracker;
/// <summary>
/// True if the request completed successfully
/// </summary>
public bool Successful
{
get { return successful; }
set { successful = value; }
}
/// <summary>
/// The tracker which the request was sent to
/// </summary>
public Tracker Tracker
{
get { return tracker; }
protected set { tracker = value; }
}
protected TrackerResponseEventArgs(Tracker tracker, bool successful)
{
if (tracker == null)
throw new ArgumentNullException("tracker");
this.successful = successful;
this.tracker = tracker;
}
}
}
|
Fix bug spotted with Gendarme. Assign the value of 'successful'.
|
Fix bug spotted with Gendarme. Assign the value of 'successful'.
svn path=/trunk/bitsharp/; revision=108325
|
C#
|
mit
|
dipeshc/BTDeploy
|
fc13bd82f50cd985be42f933886cc6a235a44602
|
MethodFlow.cs
|
MethodFlow.cs
|
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace ILGeneratorExtensions
{
public static class MethodFlow
{
public static void JumpTo(this ILGenerator generator, MethodInfo method) => generator.Emit(OpCodes.Jmp, method);
public static void Call(this ILGenerator generator, MethodInfo method) => generator.Emit(OpCodes.Call, method);
public static void CallVirtual(this ILGenerator generator, MethodInfo method) => generator.Emit(OpCodes.Callvirt, method);
public static void TailCall(this ILGenerator generator, MethodInfo method)
{
generator.Emit(OpCodes.Tailcall);
generator.Emit(OpCodes.Call, method);
}
public static void TailCallVirtual(this ILGenerator generator, MethodInfo method)
{
generator.Emit(OpCodes.Tailcall);
generator.Emit(OpCodes.Callvirt, method);
}
public static void ConstrainedCallVirtual<T>(this ILGenerator generator, MethodInfo method)
{
generator.ConstrainedCallVirtual(typeof (T), method);
}
public static void ConstrainedCallVirtual(this ILGenerator generator, Type constrainedType, MethodInfo method)
{
generator.Emit(OpCodes.Constrained, constrainedType);
generator.Emit(OpCodes.Callvirt, method);
}
public static void Return(this ILGenerator generator) => generator.Emit(OpCodes.Ret);
}
}
|
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace ILGeneratorExtensions
{
public static class MethodFlow
{
public static void JumpTo(this ILGenerator generator, MethodInfo method) => generator.Emit(OpCodes.Jmp, method);
public static void Call(this ILGenerator generator, MethodInfo method) => generator.Emit(OpCodes.Call, method);
public static void CallVirtual(this ILGenerator generator, MethodInfo method) => generator.Emit(OpCodes.Callvirt, method);
public static void TailCall(this ILGenerator generator, MethodInfo method)
{
generator.Emit(OpCodes.Tailcall);
generator.Emit(OpCodes.Call, method);
}
public static void TailCallVirtual(this ILGenerator generator, MethodInfo method)
{
generator.Emit(OpCodes.Tailcall);
generator.Emit(OpCodes.Callvirt, method);
}
public static void ConstrainedCall<T>(this ILGenerator generator, MethodInfo method)
{
generator.ConstrainedCall(typeof (T), method);
}
public static void ConstrainedCall(this ILGenerator generator, Type constrainedType, MethodInfo method)
{
generator.Emit(OpCodes.Constrained, constrainedType);
generator.Emit(OpCodes.Callvirt, method);
}
public static void ConstrainedTailCall<T>(this ILGenerator generator, MethodInfo method)
{
generator.ConstrainedTailCall(typeof(T), method);
}
public static void ConstrainedTailCall(this ILGenerator generator, Type constrainedType, MethodInfo method)
{
generator.Emit(OpCodes.Constrained, constrainedType);
generator.Emit(OpCodes.Tailcall);
generator.Emit(OpCodes.Callvirt, method);
}
public static void Return(this ILGenerator generator) => generator.Emit(OpCodes.Ret);
}
}
|
Add constrained and tail call methods, and remove virtual from method names, as constrained implies virtual
|
Add constrained and tail call methods, and remove virtual from method names, as constrained implies virtual
|
C#
|
apache-2.0
|
matwilko/ILGenerator.Extensions
|
a4cf005b36f0c72e535d189377d4555a5483991a
|
AudioSourceController/AudioSourceController.cs
|
AudioSourceController/AudioSourceController.cs
|
using UnityEngine;
using Animator = ATP.AnimationPathTools.AnimatorComponent.Animator;
namespace ATP.AnimationPathTools.AudioSourceControllerComponent {
/// <summary>
/// Allows controlling <c>AudioSource</c> component from inspector
/// and with keyboard shortcuts.
/// </summary>
// todo add menu option to create component
public sealed class AudioSourceController : MonoBehaviour {
[SerializeField]
private AudioSource audioSource;
[SerializeField]
private Animator animator;
/// <summary>
/// Reference to audio source component.
/// </summary>
public AudioSource AudioSource {
get { return audioSource; }
set { audioSource = value; }
}
/// <summary>
/// Reference to animator component.
/// </summary>
public Animator Animator {
get { return animator; }
set { animator = value; }
}
private void Reset() {
AudioSource = GetComponent<AudioSource>();
Animator = GetComponent<Animator>();
}
private void Update() {
HandleSpaceShortcut();
}
/// <summary>
/// Handle space shortcut.
/// </summary>
private void HandleSpaceShortcut() {
// If space pressed..
if (Input.GetKeyDown(KeyCode.Space)) {
// Pause
if (AudioSource.isPlaying) {
AudioSource.Pause();
}
// Play
else {
AudioSource.Play();
}
}
}
}
}
|
using UnityEngine;
using Animator = ATP.AnimationPathTools.AnimatorComponent.Animator;
namespace ATP.AnimationPathTools.AudioSourceControllerComponent {
/// <summary>
/// Allows controlling <c>AudioSource</c> component from inspector
/// and with keyboard shortcuts.
/// </summary>
// todo add menu option to create component
public sealed class AudioSourceController : MonoBehaviour {
[SerializeField]
private AudioSource audioSource;
[SerializeField]
private Animator animator;
/// <summary>
/// Reference to audio source component.
/// </summary>
public AudioSource AudioSource {
get { return audioSource; }
set { audioSource = value; }
}
/// <summary>
/// Reference to animator component.
/// </summary>
public Animator Animator {
get { return animator; }
set { animator = value; }
}
private void Reset() {
AudioSource = GetComponent<AudioSource>();
Animator = GetComponent<Animator>();
}
private void Update() {
HandleSpaceShortcut();
}
/// <summary>
/// Handle space shortcut.
/// </summary>
private void HandleSpaceShortcut() {
// Disable shortcut while animator awaits animation start.
if (Animator.IsInvoking("StartAnimation")) return;
// If space pressed..
if (Input.GetKeyDown(KeyCode.Space)) {
// Pause
if (AudioSource.isPlaying) {
AudioSource.Pause();
}
// Play
else {
AudioSource.Play();
}
}
}
}
}
|
Disable space shortcut in audio controller
|
Disable space shortcut in audio controller
|
C#
|
mit
|
bartlomiejwolk/AnimationPathAnimator
|
a5f3031e42df57512dafce980740aa9471e8011e
|
Cake.DocumentDb/Factories/ClientFactory.cs
|
Cake.DocumentDb/Factories/ClientFactory.cs
|
using System;
using Cake.Core;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Client.TransientFaultHandling;
using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;
namespace Cake.DocumentDb.Factories
{
public class ClientFactory
{
private readonly ConnectionSettings settings;
private readonly ICakeContext context;
public ClientFactory(ConnectionSettings settings, ICakeContext context)
{
this.settings = settings;
this.context = context;
}
public IReliableReadWriteDocumentClient GetClient()
{
return new DocumentClient(
new Uri(settings.Endpoint),
settings.Key,
new ConnectionPolicy
{
ConnectionMode = ConnectionMode.Gateway,
ConnectionProtocol = Protocol.Https
}).AsReliable(new FixedInterval(
15,
TimeSpan.FromSeconds(200)));
}
}
}
|
using System;
using Cake.Core;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Client.TransientFaultHandling;
using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;
namespace Cake.DocumentDb.Factories
{
public class ClientFactory
{
private readonly ConnectionSettings settings;
private readonly ICakeContext context;
public ClientFactory(ConnectionSettings settings, ICakeContext context)
{
this.settings = settings;
this.context = context;
}
public IReliableReadWriteDocumentClient GetClient()
{
return new DocumentClient(
new Uri(settings.Endpoint),
settings.Key,
new ConnectionPolicy
{
ConnectionMode = ConnectionMode.Gateway,
ConnectionProtocol = Protocol.Https
})
.AsReliable(
new FixedInterval(
15,
TimeSpan.FromSeconds(200)));
}
// https://github.com/Azure/azure-cosmos-dotnet-v2/blob/master/samples/documentdb-benchmark/Program.cs
public IDocumentClient GetClientOptimistedForWrite()
{
return new DocumentClient(
new Uri(settings.Endpoint),
settings.Key,
new ConnectionPolicy
{
ConnectionMode = ConnectionMode.Direct,
ConnectionProtocol = Protocol.Tcp,
RequestTimeout = new TimeSpan(1, 0, 0),
MaxConnectionLimit = 1000,
RetryOptions = new RetryOptions
{
MaxRetryAttemptsOnThrottledRequests = 10,
MaxRetryWaitTimeInSeconds = 60
}
});
}
}
}
|
Add method to create client optimised for write
|
Add method to create client optimised for write
|
C#
|
mit
|
BudSystemLimited/Cake.DocumentDb
|
a96cdd46e14b1dece13127da2c7188aa0847dcfe
|
MainWindow.xaml.cs
|
MainWindow.xaml.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace anime_downloader {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
String animeFolder;
public MainWindow() {
InitializeComponent();
animeFolder = @"D:\Output\anime downloader";
}
private void button_folder_Click(object sender, RoutedEventArgs e) {
Process.Start(animeFolder);
}
private void button_playlist_Click(object sender, RoutedEventArgs e) {
string[] folders = Directory.GetDirectories(animeFolder)
.Where(s => !s.EndsWith("torrents") && !s.EndsWith("Grace") && !s.EndsWith("Watched"))
.ToArray();
using (StreamWriter file = new StreamWriter(path: animeFolder + @"\playlist.m3u",
append: false)) {
foreach(String folder in folders)
file.WriteLine(String.Join("\n", Directory.GetFiles(folder)));
}
// MessageBox.Show(String.Join(", ", folders));
// System.Windows.MessageBox.Show(String.Join(", ", ));
// Directory.GetDirectories(animeFolder);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace anime_downloader {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
String animeFolder;
public MainWindow() {
InitializeComponent();
animeFolder = @"D:\Output\anime downloader";
}
private void button_folder_Click(object sender, RoutedEventArgs e) {
Process.Start(animeFolder);
}
private void button_playlist_Click(object sender, RoutedEventArgs e) {
string[] videos = Directory.GetDirectories(animeFolder)
.Where(s => !s.EndsWith("torrents") && !s.EndsWith("Grace") && !s.EndsWith("Watched"))
.SelectMany(f => Directory.GetFiles(f))
.ToArray();
using (StreamWriter file = new StreamWriter(path: animeFolder + @"\playlist.m3u",
append: false)) {
foreach(String video in videos)
file.WriteLine(video);
}
}
}
}
|
Make LINQ in playlist function fancier (because why not)
|
Make LINQ in playlist function fancier (because why not)
|
C#
|
apache-2.0
|
dukemiller/anime-downloader
|
d78becbeb6b5d8711540a77fd7788b3d54b10b26
|
Shell/Source/Tralus.Shell.WorkflowService/Properties/AssemblyInfo.cs
|
Shell/Source/Tralus.Shell.WorkflowService/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("Tralus.Shell.WorkflowService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Tralus.Shell.WorkflowService")]
[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)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("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("Tralus.Shell.WorkflowService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Tralus.Shell.WorkflowService")]
[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)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Set AssemblyVersion and AssemblyFileVersion to 1.0.0.0
|
Set AssemblyVersion and AssemblyFileVersion to 1.0.0.0
|
C#
|
apache-2.0
|
mehrandvd/Tralus,mehrandvd/Tralus
|
c0664c69bbe49a0d03fa066b53cefb75b46edcd2
|
src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/DerivedSymbol.cs
|
src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/DerivedSymbol.cs
|
using Microsoft.TemplateEngine.Abstractions;
using Newtonsoft.Json.Linq;
namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects
{
public class DerivedSymbol : BaseValueSymbol
{
public const string TypeName = "derived";
public string ValueTransform { get; set; }
public string ValueSource { get; set; }
public static ISymbolModel FromJObject(JObject jObject, IParameterSymbolLocalizationModel localization, string defaultOverride)
{
DerivedSymbol symbol = FromJObject<DerivedSymbol>(jObject, localization, defaultOverride);
symbol.ValueTransform = jObject.ToString(nameof(ValueTransform));
symbol.ValueSource = jObject.ToString(nameof(ValueSource));
return symbol;
}
}
}
|
using Microsoft.TemplateEngine.Abstractions;
using Newtonsoft.Json.Linq;
namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects
{
public class DerivedSymbol : BaseValueSymbol
{
internal const string TypeName = "derived";
public string ValueTransform { get; set; }
public string ValueSource { get; set; }
public static ISymbolModel FromJObject(JObject jObject, IParameterSymbolLocalizationModel localization, string defaultOverride)
{
DerivedSymbol symbol = FromJObject<DerivedSymbol>(jObject, localization, defaultOverride);
symbol.ValueTransform = jObject.ToString(nameof(ValueTransform));
symbol.ValueSource = jObject.ToString(nameof(ValueSource));
return symbol;
}
}
}
|
Change derived symbols type name to an internal const
|
Change derived symbols type name to an internal const
|
C#
|
mit
|
seancpeters/templating,seancpeters/templating,mlorbetske/templating,seancpeters/templating,mlorbetske/templating,seancpeters/templating
|
a5dea65254f36349302b8d77965b2fe1eab597d3
|
Build/targets.cake
|
Build/targets.cake
|
Task("DevBuild")
.IsDependentOn("Build")
.IsDependentOn("Octopus-Packaging")
.IsDependentOn("Octopus-Deployment");
Task("PrBuild")
.IsDependentOn("Build")
.IsDependentOn("Test-NUnit");
Task("KpiBuild")
.IsDependentOn("Build")
.IsDependentOn("Test-NUnit")
.IsDependentOn("Octopus-Packaging")
.IsDependentOn("Octopus-Deployment");
|
Task("DevBuild")
.IsDependentOn("Build")
.IsDependentOn("Octopus-Packaging")
.IsDependentOn("Octopus-Deployment");
Task("KpiBuild")
.IsDependentOn("Build")
.IsDependentOn("Test-NUnit")
.IsDependentOn("Upload-Coverage-Report")
.IsDependentOn("Octopus-Packaging")
.IsDependentOn("Octopus-Deployment");
|
Add uploading of coverage reports to Coveralls
|
Add uploading of coverage reports to Coveralls
|
C#
|
mit
|
AccelerateX-org/WiQuiz,AccelerateX-org/WiQuiz
|
4881f1c7b0057f171f0d630b48428f6327f0d5da
|
src/EntryPoint/CommandAttribute.cs
|
src/EntryPoint/CommandAttribute.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EntryPoint {
/// <summary>
/// Used to mark a method as a Command, in a CliCommands class
/// </summary>
[AttributeUsage(
AttributeTargets.Method,
AllowMultiple = false,
Inherited = true)]
public class CommandAttribute : Attribute {
/// <summary>
/// Marks a Method as a Command
/// </summary>
/// <param name="Name">The case in-sensitive name for the command, which is invoked to activate it</param>
public CommandAttribute(string Name) {
if (Name == null || Name.Length == 0) {
throw new ArgumentException(
"You must give a Command a name");
}
this.Name = Name;
}
/// <summary>
/// The case in-sensitive name for the command
/// </summary>
internal string Name { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EntryPoint {
/// <summary>
/// Used to mark a method as a Command, in a CliCommands class
/// </summary>
[AttributeUsage(
AttributeTargets.Method,
AllowMultiple = false,
Inherited = true)]
public class CommandAttribute : Attribute {
/// <summary>
/// Marks a Method as a Command
/// </summary>
/// <param name="Name">The case in-sensitive name for the command, which is invoked to activate it</param>
public CommandAttribute(string Name) {
if (Name == null || Name.Length == 0) {
throw new ArgumentException(
$"A {nameof(CommandAttribute)} was not given a name");
}
this.Name = Name;
}
/// <summary>
/// The case in-sensitive name for the command
/// </summary>
internal string Name { get; set; }
}
}
|
Clarify error throw when Command has no name string provided
|
Clarify error throw when Command has no name string provided
|
C#
|
mit
|
Nick-Lucas/EntryPoint,Nick-Lucas/EntryPoint,Nick-Lucas/EntryPoint
|
63ec061188fd18bd8187ae6c6d6399b13875151b
|
AIMPDotNet/CustomAssemblyResolver.cs
|
AIMPDotNet/CustomAssemblyResolver.cs
|
using System;
using System.IO;
using System.Reflection;
namespace AIMP.SDK
{
internal static class CustomAssemblyResolver
{
private static string curPath;
private static bool isInited;
/// <summary>
/// Initializes the specified path.
/// </summary>
/// <param name="path">The path.</param>
public static void Initialize(string path)
{
curPath = path +"\\";
if (!isInited)
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve;
isInited = true;
}
}
/// <summary>
/// Deinitializes this instance.
/// </summary>
public static void Deinitialize()
{
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainAssemblyResolve;
isInited = false;
}
private static Assembly CurrentDomainAssemblyResolve(object sender, ResolveEventArgs args)
{
string projectDir = Path.GetDirectoryName(curPath);
string shortAssemblyName = args.Name.Substring(0, args.Name.IndexOf(','));
string fileName = Path.Combine(projectDir, shortAssemblyName + ".dll");
if (File.Exists(fileName))
{
Assembly result = Assembly.LoadFrom(fileName);
return result;
}
return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null;
}
}
}
|
using System;
using System.IO;
using System.Linq;
using System.Reflection;
namespace AIMP.SDK
{
internal static class CustomAssemblyResolver
{
private static string curPath;
private static bool isInited;
/// <summary>
/// Initializes the specified path.
/// </summary>
/// <param name="path">The path.</param>
public static void Initialize(string path)
{
curPath = path +"\\";
if (!isInited)
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve;
isInited = true;
}
}
/// <summary>
/// Deinitializes this instance.
/// </summary>
public static void Deinitialize()
{
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomainAssemblyResolve;
isInited = false;
}
private static Assembly CurrentDomainAssemblyResolve(object sender, ResolveEventArgs args)
{
string projectDir = Path.GetDirectoryName(curPath);
string shortAssemblyName = args.Name.Substring(0, args.Name.IndexOf(','));
string fileName = Path.Combine(projectDir, shortAssemblyName + ".dll");
if (File.Exists(fileName))
{
Assembly result = Assembly.LoadFrom(fileName);
return result;
}
var assemblyPath = Directory.EnumerateFiles(projectDir, shortAssemblyName + ".dll", SearchOption.AllDirectories).FirstOrDefault();
if (assemblyPath != null)
{
return Assembly.LoadFrom(assemblyPath);
}
return Assembly.GetExecutingAssembly().FullName == args.Name ? Assembly.GetExecutingAssembly() : null;
}
}
}
|
Fix assembly load for plugins
|
Fix assembly load for plugins
|
C#
|
apache-2.0
|
martin211/aimp_dotnet,martin211/aimp_dotnet,martin211/aimp_dotnet,martin211/aimp_dotnet,martin211/aimp_dotnet
|
05e7020dfc35f49c8fe8e8c7bc6a476f3d82a440
|
speech/api/QuickStart/QuickStart.cs
|
speech/api/QuickStart/QuickStart.cs
|
/*
* Copyright (c) 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
// [START speech_quickstart]
using Google.Cloud.Speech.V1Beta1;
// [END speech_quickstart]
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
// [START speech_quickstart]
var speech = SpeechClient.Create();
var response = speech.SyncRecognize(new RecognitionConfig()
{
Encoding = RecognitionConfig.Types.AudioEncoding.Linear16,
SampleRate = 16000,
}, RecognitionAudio.FromFile("audio.raw"));
foreach (var result in response.Results)
{
foreach (var alternative in result.Alternatives)
{
Console.WriteLine(alternative.Transcript);
}
}
// [END speech_quickstart]
}
}
}
|
/*
* Copyright (c) 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
// [START speech_quickstart]
using Google.Cloud.Speech.V1Beta1;
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
var speech = SpeechClient.Create();
var response = speech.SyncRecognize(new RecognitionConfig()
{
Encoding = RecognitionConfig.Types.AudioEncoding.Linear16,
SampleRate = 16000,
}, RecognitionAudio.FromFile("audio.raw"));
foreach (var result in response.Results)
{
foreach (var alternative in result.Alternatives)
{
Console.WriteLine(alternative.Transcript);
}
}
}
}
}
// [END speech_quickstart]
|
Move the speech_quickstart doc tag so that users can copy and paste all the code.
|
Move the speech_quickstart doc tag so that users can copy and paste all the code.
|
C#
|
apache-2.0
|
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples
|
b5446d82ee0037c6b0281a88a52a614d9ccc5806
|
src/Schema/Playlists/Response/PlaylistLocation.cs
|
src/Schema/Playlists/Response/PlaylistLocation.cs
|
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace SevenDigital.Api.Schema.Playlists.Response
{
[Serializable]
public class PlaylistLocation : UserBasedUpdatableItem
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlElement("name")]
public string Name { get; set; }
[XmlArray("links")]
[XmlArrayItem("link")]
public List<Link> Links { get; set; }
[XmlElement("trackCount")]
public int TrackCount { get; set; }
[XmlElement("visibility")]
public PlaylistVisibilityType Visibility { get; set; }
[XmlElement("status")]
public PlaylistStatusType Status { get; set; }
public override string ToString()
{
return string.Format("{0}: {1}", Id, Name);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace SevenDigital.Api.Schema.Playlists.Response
{
[Serializable]
public class PlaylistLocation : UserBasedUpdatableItem
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlElement("name")]
public string Name { get; set; }
[XmlArray("links")]
[XmlArrayItem("link")]
public List<Link> Links { get; set; }
[XmlElement("trackCount")]
public int TrackCount { get; set; }
[XmlElement("visibility")]
public PlaylistVisibilityType Visibility { get; set; }
[XmlElement("status")]
public PlaylistStatusType Status { get; set; }
[XmlElement("tags")]
public List<Tag> Tags { get; set; }
public override string ToString()
{
return string.Format("{0}: {1}", Id, Name);
}
}
}
|
Add tags to playlist location
|
Add tags to playlist location
|
C#
|
mit
|
scooper91/SevenDigital.Api.Schema,7digital/SevenDigital.Api.Schema
|
e0f7be4627377c548bb3ee6c38a547ee9820b350
|
Source/Web/App_Start/BundleConfig.cs
|
Source/Web/App_Start/BundleConfig.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BundleConfig.cs" company="KriaSoft LLC">
// Copyright © 2013 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace App.Web
{
using System.Web.Optimization;
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/js/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/js/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/js/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/js/bootstrap").Include("~/Scripts/bootstrap/*"));
bundles.Add(new ScriptBundle("~/js/site").Include(
"~/Scripts/Site.js"));
bundles.Add(new StyleBundle("~/css/bootstrap").Include("~/Styles/bootstrap.css"));
bundles.Add(new StyleBundle("~/css/site").Include("~/Styles/Site.css"));
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BundleConfig.cs" company="KriaSoft LLC">
// Copyright © 2013 Konstantin Tarkus, KriaSoft LLC. See LICENSE.txt
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace App.Web
{
using System.Web.Optimization;
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/js/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/js/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/js/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/js/bootstrap").Include("~/Scripts/bootstrap/*.js"));
bundles.Add(new ScriptBundle("~/js/site").Include(
"~/Scripts/Site.js"));
bundles.Add(new StyleBundle("~/css/bootstrap").Include("~/Styles/bootstrap.css"));
bundles.Add(new StyleBundle("~/css/site").Include("~/Styles/Site.css"));
}
}
}
|
Fix wildcard path in bootstrap js bundle
|
Fix wildcard path in bootstrap js bundle
|
C#
|
apache-2.0
|
kriasoft/site-sdk,kriasoft/site-sdk,kriasoft/site-sdk,kriasoft/site-sdk
|
9ca7039d8816f3a1adbf6250a68ba8e090c6cad4
|
src/Elasticsearch.Net/Serialization/Formatters/DynamicBodyFormatter.cs
|
src/Elasticsearch.Net/Serialization/Formatters/DynamicBodyFormatter.cs
|
using System.Collections.Generic;
namespace Elasticsearch.Net
{
internal class DynamicBodyFormatter : IJsonFormatter<DynamicBody>
{
private static readonly DictionaryFormatter<string, object> DictionaryFormatter =
new DictionaryFormatter<string, object>();
public void Serialize(ref JsonWriter writer, DynamicBody value, IJsonFormatterResolver formatterResolver)
{
if (value == null)
{
writer.WriteNull();
return;
}
writer.WriteBeginObject();
var formatter = formatterResolver.GetFormatter<object>();
foreach (var kv in (IDictionary<string, object>)value)
{
writer.WritePropertyName(kv.Key);
formatter.Serialize(ref writer, kv.Value, formatterResolver);
}
writer.WriteEndObject();
}
public DynamicBody Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
{
var dictionary = DictionaryFormatter.Deserialize(ref reader, formatterResolver);
return DynamicBody.Create(dictionary);
}
}
}
|
using System.Collections.Generic;
namespace Elasticsearch.Net
{
internal class DynamicBodyFormatter : IJsonFormatter<DynamicBody>
{
private static readonly DictionaryFormatter<string, object> DictionaryFormatter =
new DictionaryFormatter<string, object>();
public void Serialize(ref JsonWriter writer, DynamicBody value, IJsonFormatterResolver formatterResolver)
{
if (value == null)
{
writer.WriteNull();
return;
}
writer.WriteBeginObject();
var formatter = formatterResolver.GetFormatter<object>();
var count = 0;
foreach (var kv in (IDictionary<string, object>)value)
{
if (count > 0)
writer.WriteValueSeparator();
writer.WritePropertyName(kv.Key);
formatter.Serialize(ref writer, kv.Value, formatterResolver);
count++;
}
writer.WriteEndObject();
}
public DynamicBody Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
{
var dictionary = DictionaryFormatter.Deserialize(ref reader, formatterResolver);
return DynamicBody.Create(dictionary);
}
}
}
|
Write value separators when serializing dynamic body
|
Write value separators when serializing dynamic body
|
C#
|
apache-2.0
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
bec991195051aada945755959ac3b284df3678cb
|
Harmony/Internal/PatchTools.cs
|
Harmony/Internal/PatchTools.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Harmony
{
internal static class PatchTools
{
static readonly Dictionary<object, object> objectReferences = new Dictionary<object, object>();
internal static void RememberObject(object key, object value)
{
objectReferences[key] = value;
}
internal static MethodInfo GetPatchMethod<T>(Type patchType, string name)
{
var attributeType = typeof(T).FullName;
var method = patchType.GetMethods(AccessTools.all)
.FirstOrDefault(m => m.GetCustomAttributes(true).Any(a => a.GetType().FullName == attributeType));
if (method == null)
method = AccessTools.Method(patchType, name);
return method;
}
[UpgradeToLatestVersion(1)]
internal static void GetPatches(Type patchType, out MethodInfo prefix, out MethodInfo postfix, out MethodInfo transpiler)
{
prefix = GetPatchMethod<HarmonyPrefix>(patchType, "Prefix");
postfix = GetPatchMethod<HarmonyPostfix>(patchType, "Postfix");
transpiler = GetPatchMethod<HarmonyTranspiler>(patchType, "Transpiler");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Harmony
{
internal static class PatchTools
{
static readonly Dictionary<object, object> objectReferences = new Dictionary<object, object>();
internal static void RememberObject(object key, object value)
{
objectReferences[key] = value;
}
internal static MethodInfo GetPatchMethod<T>(Type patchType, string name)
{
var attributeType = typeof(T).FullName;
var method = patchType.GetMethods(AccessTools.all)
.FirstOrDefault(m => m.GetCustomAttributes(true).Any(a => a.GetType().FullName == attributeType));
if (method == null)
{
// not-found is common and normal case, don't use AccessTools which will generate not-found warnings
method = patchType.GetMethod(name, AccessTools.all);
}
return method;
}
[UpgradeToLatestVersion(1)]
internal static void GetPatches(Type patchType, out MethodInfo prefix, out MethodInfo postfix, out MethodInfo transpiler)
{
prefix = GetPatchMethod<HarmonyPrefix>(patchType, "Prefix");
postfix = GetPatchMethod<HarmonyPostfix>(patchType, "Postfix");
transpiler = GetPatchMethod<HarmonyTranspiler>(patchType, "Transpiler");
}
}
}
|
Reduce unnecessary logging of missing optional methods
|
Reduce unnecessary logging of missing optional methods
|
C#
|
mit
|
pardeike/Harmony
|
72e941de6362c90f6c63f4f6fd5cf635eb7f3eb6
|
src/Stranne.VasttrafikNET/Models/TokenModel.cs
|
src/Stranne.VasttrafikNET/Models/TokenModel.cs
|
using System;
using Newtonsoft.Json;
namespace Stranne.VasttrafikNET.Models
{
internal class Token
{
private DateTimeOffset _createDate = DateTimeOffset.Now;
[JsonProperty("Expires_In")]
public int ExpiresIn { get; set; }
[JsonProperty("Access_Token")]
public string AccessToken { get; set; }
public bool IsValid() => _createDate.AddSeconds(ExpiresIn) < DateTimeOffset.Now;
}
}
|
using System;
using Newtonsoft.Json;
namespace Stranne.VasttrafikNET.Models
{
internal class Token
{
private DateTimeOffset _createDate = DateTimeOffset.Now;
[JsonProperty("Expires_In")]
public int ExpiresIn { get; set; }
[JsonProperty("Access_Token")]
public string AccessToken { get; set; }
public bool IsValid() => _createDate.AddSeconds(ExpiresIn) > DateTimeOffset.Now;
}
}
|
Fix bug with logic for if the token is valid
|
Fix bug with logic for if the token is valid
|
C#
|
mit
|
stranne/Vasttrafik.NET,stranne/Vasttrafik.NET
|
cc1a79e6110d8448ba869fc845af10da8c1b17b4
|
awesome-bot/Giphy/RandomEndPoint.cs
|
awesome-bot/Giphy/RandomEndPoint.cs
|
namespace awesome_bot.Giphy
{
public static partial class GiphyEndPoints
{
public class RandomEndPoint
{
private const string RandomPath = "/v1/gifs/random";
public string Build(string searchText, Rating rating = null)
=> string.Join(string.Empty, Root, RandomPath, "?",
$"api_key={ApiKey}&tag={searchText}&rating={rating ?? Rating.G}");
}
}
}
|
namespace awesome_bot.Giphy
{
public static partial class GiphyEndPoints
{
public class RandomEndPoint
{
private const string RandomPath = "/v1/gifs/random";
public string Build(string searchText, Rating rating = null)
=> string.Join(string.Empty, Root, RandomPath, "?",
$"api_key={ApiKey}&tag={searchText}&rating={rating ?? Rating.PG13}");
}
}
}
|
Raise rating of gif search
|
Raise rating of gif search
|
C#
|
mit
|
glconti/awesome-bot,glconti/awesome-bot
|
00fe661df6c17be0d6e3db1aff7ff04d940766ab
|
SourceCodes/03_Services/ReCaptcha.Wrapper.Mvc/Parameters/ResourceParameters.cs
|
SourceCodes/03_Services/ReCaptcha.Wrapper.Mvc/Parameters/ResourceParameters.cs
|
namespace Aliencube.ReCaptcha.Wrapper.Mvc.Parameters
{
/// <summary>
/// This represents the parameters entity to render api.js.
/// </summary>
/// <remarks>More details: https://developers.google.com/recaptcha/docs/display#js_param</remarks>
public partial class ResourceParameters
{
/// <summary>
/// Gets or sets the callback method name on load.
/// </summary>
public string OnLoad { get; set; }
/// <summary>
/// Gets or sets the render option.
/// </summary>
public WidgetRenderType Render { get; set; }
/// <summary>
/// Gets or sets the language code to display reCaptcha control.
/// </summary>
public WidgetLanguageCode LanguageCode { get; set; }
}
}
|
using Newtonsoft.Json;
namespace Aliencube.ReCaptcha.Wrapper.Mvc.Parameters
{
/// <summary>
/// This represents the parameters entity to render api.js.
/// </summary>
/// <remarks>More details: https://developers.google.com/recaptcha/docs/display#js_param</remarks>
public partial class ResourceParameters
{
/// <summary>
/// Gets or sets the callback method name on load.
/// </summary>
[JsonProperty(PropertyName = "onload")]
public string OnLoad { get; set; }
/// <summary>
/// Gets or sets the render option.
/// </summary>
[JsonProperty(PropertyName = "render")]
public WidgetRenderType Render { get; set; }
/// <summary>
/// Gets or sets the language code to display reCaptcha control.
/// </summary>
[JsonProperty(PropertyName = "hl")]
public WidgetLanguageCode LanguageCode { get; set; }
}
}
|
Add JsonProperty attribute on each property
|
Add JsonProperty attribute on each property
|
C#
|
mit
|
aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET
|
d746649249f2fbf439ba4a8cd11846b67a34c396
|
DesktopWidgets/Helpers/ImageHelper.cs
|
DesktopWidgets/Helpers/ImageHelper.cs
|
using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
namespace DesktopWidgets.Helpers
{
public static class ImageHelper
{
public static readonly List<string> SupportedExtensions = new List<string>
{
".bmp",
".gif",
".ico",
".jpg",
".jpeg",
".png",
".tiff"
};
public static bool IsSupported(string extension)
{
return SupportedExtensions.Contains(extension.ToLower());
}
public static BitmapImage LoadBitmapImageFromPath(string path)
{
var bmi = new BitmapImage();
bmi.BeginInit();
bmi.CacheOption = BitmapCacheOption.OnLoad;
bmi.UriSource = new Uri(path, UriKind.RelativeOrAbsolute);
bmi.EndInit();
bmi.Freeze();
return bmi;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
namespace DesktopWidgets.Helpers
{
public static class ImageHelper
{
// https://msdn.microsoft.com/en-us/library/ee719654(v=VS.85).aspx#wpfc_codecs.
public static readonly List<string> SupportedExtensions = new List<string>
{
".bmp",
".gif",
".ico",
".jpg",
".jpeg",
".png",
".tiff",
".wmp",
".dds"
};
public static bool IsSupported(string extension)
{
return SupportedExtensions.Contains(extension.ToLower());
}
public static BitmapImage LoadBitmapImageFromPath(string path)
{
var bmi = new BitmapImage();
bmi.BeginInit();
bmi.CacheOption = BitmapCacheOption.OnLoad;
bmi.UriSource = new Uri(path, UriKind.RelativeOrAbsolute);
bmi.EndInit();
bmi.Freeze();
return bmi;
}
}
}
|
Add more supported image extensions
|
Add more supported image extensions
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
172b78548a4339a5b55f1f25e6932ce80e549c06
|
Assets/Scripts/Helper/PhysicsHelper2D.cs
|
Assets/Scripts/Helper/PhysicsHelper2D.cs
|
using UnityEngine;
using System.Collections;
public class PhysicsHelper2D
{
/// <summary>
/// Ignores collision for every single GameObject with a particular tag
/// </summary>
/// <param name="object1"></param>
/// <param name="tag"></param>
/// <param name="ignore"></param>
public static void ignoreCollisionWithTag(GameObject object1, string tag, bool ignore)
{
Collider2D[] colliders = object1.GetComponents<Collider2D>();
GameObject[] taggedObjects = GameObject.FindGameObjectsWithTag(tag);
foreach (GameObject taggedObject in taggedObjects)
{
for (int i = 0; i < colliders.Length; i++)
{
Physics2D.IgnoreCollision(colliders[i], taggedObject.GetComponent<Collider2D>(), ignore);
}
}
}
/// <summary>
/// performs Physics2D.raycast and also Debug.DrawLine with the same vector
/// </summary>
public static bool visibleRaycast(Vector2 origin, Vector2 direction, float distance = float.PositiveInfinity, Color? color = null)
{
Debug.DrawLine(origin, origin + (direction.resize(distance)), color ?? Color.white);
return Physics2D.Raycast(origin, direction, distance);
}
}
|
using UnityEngine;
using System.Collections;
public class PhysicsHelper2D
{
/// <summary>
/// Ignores collision for every single GameObject with a particular tag
/// </summary>
/// <param name="object1"></param>
/// <param name="tag"></param>
/// <param name="ignore"></param>
public static void ignoreCollisionWithTag(GameObject object1, string tag, bool ignore)
{
Collider2D[] colliders = object1.GetComponents<Collider2D>();
GameObject[] taggedObjects = GameObject.FindGameObjectsWithTag(tag);
foreach (GameObject taggedObject in taggedObjects)
{
for (int i = 0; i < colliders.Length; i++)
{
Physics2D.IgnoreCollision(colliders[i], taggedObject.GetComponent<Collider2D>(), ignore);
}
}
}
/// <summary>
/// performs Physics2D.raycast and also Debug.DrawLine with the same vector
/// </summary>
public static RaycastHit2D visibleRaycast(Vector2 origin, Vector2 direction,
float distance = float.PositiveInfinity, int layerMask = Physics2D.DefaultRaycastLayers,
float minDepth = -Mathf.Infinity, float maxDepth = Mathf.Infinity,
Color? color = null)
{
Debug.DrawLine(origin, origin + (direction.resize(distance)), color ?? Color.white);
return Physics2D.Raycast(origin, direction, distance, layerMask, minDepth, maxDepth);
}
}
|
Include all parameters in visibleRaycast
|
Include all parameters in visibleRaycast
|
C#
|
mit
|
NitorInc/NitoriWare,uulltt/NitoriWare,plrusek/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
|
567887b566db78aa56030e894c857be7ecc8d081
|
CSharp/SimpleOrderRouting.Tests/HarnessTests.cs
|
CSharp/SimpleOrderRouting.Tests/HarnessTests.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HarnessTests.cs" company="LunchBox corp">
// Copyright 2014 The Lunch-Box mob:
// Ozgur DEVELIOGLU (@Zgurrr)
// Cyrille DUPUYDAUBY (@Cyrdup)
// Tomasz JASKULA (@tjaskula)
// Mendel MONTEIRO-BECKERMAN (@MendelMonteiro)
// Thomas PIERRAIN (@tpierrain)
//
// 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>
// --------------------------------------------------------------------------------------------------------------------
namespace SimpleOrderRouting.Tests
{
using NFluent;
using SimpleOrderRouting.Journey1;
using Xunit;
public class HarnessTests
{
[Fact]
public void ShouldReturnALatency()
{
var runner = new SorTestHarness();
runner.Run();
Check.That<double>(runner.AverageLatency).IsPositive();
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="HarnessTests.cs" company="LunchBox corp">
// Copyright 2014 The Lunch-Box mob:
// Ozgur DEVELIOGLU (@Zgurrr)
// Cyrille DUPUYDAUBY (@Cyrdup)
// Tomasz JASKULA (@tjaskula)
// Mendel MONTEIRO-BECKERMAN (@MendelMonteiro)
// Thomas PIERRAIN (@tpierrain)
//
// 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>
// --------------------------------------------------------------------------------------------------------------------
namespace SimpleOrderRouting.Tests
{
using NFluent;
using SimpleOrderRouting.Journey1;
using Xunit;
public class HarnessTests
{
//[Fact]
public void ShouldReturnALatency()
{
var runner = new SorTestHarness();
runner.Run();
Check.That<double>(runner.AverageLatency).IsPositive();
}
}
}
|
Comment test harness unit test with lame check
|
Comment test harness unit test with lame check
|
C#
|
apache-2.0
|
Lunch-box/SimpleOrderRouting
|
20224a169a576dd505a214589a59ec89e7cb5bbe
|
Kudu.Core/Deployment/DeploymentConfiguration.cs
|
Kudu.Core/Deployment/DeploymentConfiguration.cs
|
using System;
using System.IO;
using Kudu.Core.Infrastructure;
namespace Kudu.Core.Deployment
{
public class DeploymentConfiguration
{
internal const string DeployConfigFile = ".deployment";
private readonly IniFile _iniFile;
private readonly string _path;
public DeploymentConfiguration(string path)
{
_path = path;
_iniFile = new IniFile(Path.Combine(path, DeployConfigFile));
}
public string ProjectPath
{
get
{
string projectPath = _iniFile.GetSectionValue("config", "project");
if (String.IsNullOrEmpty(projectPath))
{
return null;
}
return Path.Combine(_path, projectPath.TrimStart('/', '\\'));
}
}
}
}
|
using System;
using System.IO;
using Kudu.Core.Infrastructure;
namespace Kudu.Core.Deployment
{
public class DeploymentConfiguration
{
internal const string DeployConfigFile = ".deployment";
private readonly IniFile _iniFile;
private readonly string _path;
public DeploymentConfiguration(string path)
{
_path = path;
_iniFile = new IniFile(Path.Combine(path, DeployConfigFile));
}
public string ProjectPath
{
get
{
string projectPath = _iniFile.GetSectionValue("config", "project");
if (String.IsNullOrEmpty(projectPath))
{
return null;
}
return Path.GetFullPath(Path.Combine(_path, projectPath.TrimStart('/', '\\')));
}
}
}
}
|
Resolve full for specified .deployment project file.
|
Resolve full for specified .deployment project file.
|
C#
|
apache-2.0
|
juoni/kudu,dev-enthusiast/kudu,EricSten-MSFT/kudu,badescuga/kudu,shanselman/kudu,sitereactor/kudu,chrisrpatterson/kudu,uQr/kudu,sitereactor/kudu,dev-enthusiast/kudu,YOTOV-LIMITED/kudu,projectkudu/kudu,oliver-feng/kudu,kali786516/kudu,badescuga/kudu,kali786516/kudu,juvchan/kudu,duncansmart/kudu,duncansmart/kudu,projectkudu/kudu,juvchan/kudu,barnyp/kudu,juoni/kudu,EricSten-MSFT/kudu,chrisrpatterson/kudu,duncansmart/kudu,puneet-gupta/kudu,puneet-gupta/kudu,juvchan/kudu,uQr/kudu,barnyp/kudu,chrisrpatterson/kudu,shibayan/kudu,shibayan/kudu,duncansmart/kudu,oliver-feng/kudu,projectkudu/kudu,kali786516/kudu,uQr/kudu,badescuga/kudu,EricSten-MSFT/kudu,puneet-gupta/kudu,shibayan/kudu,shrimpy/kudu,EricSten-MSFT/kudu,dev-enthusiast/kudu,barnyp/kudu,shrimpy/kudu,shibayan/kudu,MavenRain/kudu,YOTOV-LIMITED/kudu,shrimpy/kudu,kenegozi/kudu,oliver-feng/kudu,sitereactor/kudu,sitereactor/kudu,kenegozi/kudu,EricSten-MSFT/kudu,sitereactor/kudu,uQr/kudu,dev-enthusiast/kudu,projectkudu/kudu,MavenRain/kudu,puneet-gupta/kudu,bbauya/kudu,MavenRain/kudu,shrimpy/kudu,WeAreMammoth/kudu-obsolete,barnyp/kudu,kali786516/kudu,mauricionr/kudu,mauricionr/kudu,bbauya/kudu,mauricionr/kudu,kenegozi/kudu,kenegozi/kudu,juoni/kudu,YOTOV-LIMITED/kudu,oliver-feng/kudu,YOTOV-LIMITED/kudu,mauricionr/kudu,shanselman/kudu,WeAreMammoth/kudu-obsolete,shibayan/kudu,juoni/kudu,projectkudu/kudu,WeAreMammoth/kudu-obsolete,juvchan/kudu,badescuga/kudu,juvchan/kudu,badescuga/kudu,puneet-gupta/kudu,bbauya/kudu,chrisrpatterson/kudu,MavenRain/kudu,shanselman/kudu,bbauya/kudu
|
a2d1cf344d925fd16a99e0558b38d93a94255fef
|
JabbR/Middleware/FixCookieHandler.cs
|
JabbR/Middleware/FixCookieHandler.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Owin;
namespace JabbR.Middleware
{
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataHandler;
using AppFunc = Func<IDictionary<string, object>, Task>;
public class FixCookieHandler
{
private readonly AppFunc _next;
private readonly TicketDataHandler _ticketHandler;
public FixCookieHandler(AppFunc next, TicketDataHandler ticketHandler)
{
_ticketHandler = ticketHandler;
_next = next;
}
public Task Invoke(IDictionary<string, object> env)
{
var request = new OwinRequest(env);
var cookies = request.GetCookies();
string cookieValue;
if (cookies != null && cookies.TryGetValue("jabbr.id", out cookieValue))
{
AuthenticationTicket ticket = _ticketHandler.Unprotect(cookieValue);
}
return _next(env);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataHandler;
namespace JabbR.Middleware
{
using AppFunc = Func<IDictionary<string, object>, Task>;
public class FixCookieHandler
{
private readonly AppFunc _next;
private readonly TicketDataHandler _ticketHandler;
public FixCookieHandler(AppFunc next, TicketDataHandler ticketHandler)
{
_ticketHandler = ticketHandler;
_next = next;
}
public Task Invoke(IDictionary<string, object> env)
{
var request = new OwinRequest(env);
var cookies = request.GetCookies();
string cookieValue;
if (cookies != null && cookies.TryGetValue("jabbr.id", out cookieValue))
{
AuthenticationTicket ticket = _ticketHandler.Unprotect(cookieValue);
if (ticket.Extra == null)
{
// The forms auth module has a bug where it null refs on a null Extra
var headers = request.Get<IDictionary<string, string[]>>(Owin.Types.OwinConstants.RequestHeaders);
var cookieBuilder = new StringBuilder();
foreach (var cookie in cookies)
{
// Skip the jabbr.id cookie
if (cookie.Key == "jabbr.id")
{
continue;
}
if (cookieBuilder.Length > 0)
{
cookieBuilder.Append(";");
}
cookieBuilder.Append(cookie.Key)
.Append("=")
.Append(Uri.EscapeDataString(cookie.Value));
}
headers["Cookie"] = new[] { cookieBuilder.ToString() };
}
}
return _next(env);
}
}
}
|
Work around bug in FormsAuthMiddleware
|
Work around bug in FormsAuthMiddleware
|
C#
|
mit
|
borisyankov/JabbR,SonOfSam/JabbR,borisyankov/JabbR,lukehoban/JabbR,M-Zuber/JabbR,fuzeman/vox,yadyn/JabbR,e10/JabbR,timgranstrom/JabbR,18098924759/JabbR,meebey/JabbR,JabbR/JabbR,lukehoban/JabbR,mzdv/JabbR,LookLikeAPro/JabbR,meebey/JabbR,lukehoban/JabbR,yadyn/JabbR,CrankyTRex/JabbRMirror,SonOfSam/JabbR,yadyn/JabbR,e10/JabbR,mzdv/JabbR,M-Zuber/JabbR,meebey/JabbR,CrankyTRex/JabbRMirror,fuzeman/vox,timgranstrom/JabbR,ajayanandgit/JabbR,JabbR/JabbR,ajayanandgit/JabbR,borisyankov/JabbR,CrankyTRex/JabbRMirror,18098924759/JabbR,LookLikeAPro/JabbR,LookLikeAPro/JabbR,fuzeman/vox
|
595a12be23a293be2ecec7612d35ac1cfbbd9ddb
|
TestDiagnosticsUnitTests/NoNewGuidAnalyzerTests.cs
|
TestDiagnosticsUnitTests/NoNewGuidAnalyzerTests.cs
|
using BlackFox.Roslyn.TestDiagnostics.NoNewGuid;
using BlackFox.Roslyn.TestDiagnostics.NoStringEmpty;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NFluent;
using TestDiagnosticsUnitTests.Helpers.DiagnosticTestHelpers;
namespace TestDiagnosticsUnitTests
{
[TestClass]
public class NoNewGuidAnalyzerTests
{
[TestMethod]
public void No_diagnostic_on_guid_empty()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = Guid.Empty;");
Check.That(diagnostics).IsEmpty();
}
[TestMethod]
public void Diagnostic_new_call()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = new Guid();");
Check.That(diagnostics).HasSize(1);
}
[TestMethod]
public void Diagnostic_on_namespace_qualified_call()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = new System.Guid();");
Check.That(diagnostics).HasSize(1);
}
[TestMethod]
public void Diagnostic_on_fully_qualified_call()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = new global::System.Guid();");
Check.That(diagnostics).HasSize(1);
}
}
}
|
using BlackFox.Roslyn.TestDiagnostics.NoNewGuid;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NFluent;
using TestDiagnosticsUnitTests.Helpers.DiagnosticTestHelpers;
namespace TestDiagnosticsUnitTests
{
[TestClass]
public class NoNewGuidAnalyzerTests
{
[TestMethod]
public void No_diagnostic_on_guid_empty()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = Guid.Empty;");
Check.That(diagnostics).IsEmpty();
}
[TestMethod]
public void Diagnostic_new_call()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = new Guid();");
Check.That(diagnostics).HasSize(1);
}
[TestMethod]
public void Diagnostic_on_namespace_qualified_call()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = new System.Guid();");
Check.That(diagnostics).HasSize(1);
}
[TestMethod]
public void Diagnostic_on_fully_qualified_call()
{
var analyzer = new NoNewGuidAnalyzer();
var diagnostics = GetDiagnosticsInSimpleCode(analyzer, "var x = new global::System.Guid();");
Check.That(diagnostics).HasSize(1);
}
}
}
|
Remove an useless namespace usage
|
Remove an useless namespace usage
|
C#
|
bsd-2-clause
|
vbfox/KitsuneRoslyn
|
d0e57e69880e3e1f56b0815608b3714022d004bd
|
src/FeatureSwitcher.DebugConsole/Behaviours/DebugConsoleBehaviour.cs
|
src/FeatureSwitcher.DebugConsole/Behaviours/DebugConsoleBehaviour.cs
|
using System.Web;
namespace FeatureSwitcher.DebugConsole.Behaviours
{
public class DebugConsoleBehaviour
{
private readonly bool _isForced = false;
private DebugConsoleBehaviour(bool isForced)
{
this._isForced = isForced;
}
internal static FeatureSwitcher.Feature.Behavior AlwaysEnabled => new DebugConsoleBehaviour(true).Behaviour;
public static FeatureSwitcher.Feature.Behavior IsEnabled => new DebugConsoleBehaviour(false).Behaviour;
private bool? Behaviour(Feature.Name name)
{
if (HttpContext.Current == null)
return null;
if (name == null || string.IsNullOrWhiteSpace(name.Value))
return null;
if (HttpContext.Current.IsDebuggingEnabled || this._isForced)
{
var cookie = HttpContext.Current.Request.Cookies[name.Value];
if (cookie == null)
return null;
return cookie.Value == "true";
}
return null;
}
}
}
|
using System.Web;
namespace FeatureSwitcher.DebugConsole.Behaviours
{
public class DebugConsoleBehaviour
{
private readonly bool _isForced = false;
private DebugConsoleBehaviour(bool isForced)
{
this._isForced = isForced;
}
internal static FeatureSwitcher.Feature.Behavior AlwaysEnabled => new DebugConsoleBehaviour(true).Behaviour;
public static FeatureSwitcher.Feature.Behavior IsEnabled => new DebugConsoleBehaviour(false).Behaviour;
private bool? Behaviour(Feature.Name name)
{
if (HttpContext.Current == null)
return null;
if (name == null || string.IsNullOrWhiteSpace(name.Value))
return null;
if (HttpContext.Current.IsDebuggingEnabled || this._isForced)
{
if (HttpContext.Current.Request == null)
return null;
var cookie = HttpContext.Current.Request.Cookies[name.Value];
if (cookie == null)
return null;
return cookie.Value == "true";
}
return null;
}
}
}
|
Add null check for request.
|
Add null check for request.
|
C#
|
apache-2.0
|
queueit/FeatureSwitcher.DebugConsole,queueit/FeatureSwitcher.DebugConsole,queueit/FeatureSwitcher.DebugConsole,queueit/FeatureSwitcher.DebugConsole
|
ca7a5d21a7d0025dfdcc2c0d37b22f8c10c1772b
|
src/NodaTime.Test/SystemClockTest.cs
|
src/NodaTime.Test/SystemClockTest.cs
|
// Copyright 2011 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using NUnit.Framework;
namespace NodaTime.Test
{
public class SystemClockTest
{
[Test]
public void InstanceNow()
{
long frameworkNowTicks = NodaConstants.BclEpoch.PlusTicks(DateTime.UtcNow.Ticks).ToUnixTimeTicks();
long nodaTicks = SystemClock.Instance.GetCurrentInstant().ToUnixTimeTicks();
Assert.Less(Math.Abs(nodaTicks - frameworkNowTicks), Duration.FromSeconds(1).BclCompatibleTicks);
}
[Test]
public void Sanity()
{
// Previously all the conversions missed the SystemConversions.DateTimeEpochTicks,
// so they were self-consistent but not consistent with sanity.
Instant minimumExpected = Instant.FromUtc(2011, 8, 1, 0, 0);
Instant maximumExpected = Instant.FromUtc(2020, 1, 1, 0, 0);
Instant now = SystemClock.Instance.GetCurrentInstant();
Assert.Less(minimumExpected.ToUnixTimeTicks(), now.ToUnixTimeTicks());
Assert.Less(now.ToUnixTimeTicks(), maximumExpected.ToUnixTimeTicks());
}
}
}
|
// Copyright 2011 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using NUnit.Framework;
namespace NodaTime.Test
{
public class SystemClockTest
{
[Test]
public void InstanceNow()
{
long frameworkNowTicks = NodaConstants.BclEpoch.PlusTicks(DateTime.UtcNow.Ticks).ToUnixTimeTicks();
long nodaTicks = SystemClock.Instance.GetCurrentInstant().ToUnixTimeTicks();
Assert.Less(Math.Abs(nodaTicks - frameworkNowTicks), Duration.FromSeconds(1).BclCompatibleTicks);
}
[Test]
public void Sanity()
{
// Previously all the conversions missed the SystemConversions.DateTimeEpochTicks,
// so they were self-consistent but not consistent with sanity.
Instant minimumExpected = Instant.FromUtc(2019, 8, 1, 0, 0);
Instant maximumExpected = Instant.FromUtc(2025, 1, 1, 0, 0);
Instant now = SystemClock.Instance.GetCurrentInstant();
Assert.Less(minimumExpected.ToUnixTimeTicks(), now.ToUnixTimeTicks());
Assert.Less(now.ToUnixTimeTicks(), maximumExpected.ToUnixTimeTicks());
}
}
}
|
Update SystemClock test to account for time passing.
|
Update SystemClock test to account for time passing.
|
C#
|
apache-2.0
|
nodatime/nodatime,malcolmr/nodatime,malcolmr/nodatime,nodatime/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,BenJenkinson/nodatime
|
820f49d2bcd56b3c5a7c62a1e517bfa0d94555d7
|
SsrsDeploy/Factory/ServiceFactory.cs
|
SsrsDeploy/Factory/ServiceFactory.cs
|
using SsrsDeploy;
using SsrsDeploy.ReportingService;
using SsrsDeploy.Execution;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SsrDeploy.Factory
{
class ServiceFactory
{
private readonly ReportingService2010 rs;
public ServiceFactory(Options options)
{
this.rs = GetReportingService(options);
}
protected virtual ReportingService2010 GetReportingService(Options options)
{
var rs = new ReportingService2010();
rs.Url = GetUrl(options);
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
return rs;
}
public ReportService GetReportService()
{
return new ReportService(rs);
}
public FolderService GetFolderService()
{
return new FolderService(rs);
}
public DataSourceService GetDataSourceService()
{
return new DataSourceService(rs);
}
public static string GetUrl(Options options)
{
var baseUrl = options.Url;
var builder = new UriBuilder(baseUrl);
if (string.IsNullOrEmpty(builder.Scheme))
builder.Scheme = Uri.UriSchemeHttp;
if (builder.Scheme != Uri.UriSchemeHttp && builder.Scheme != Uri.UriSchemeHttps)
throw new ArgumentException();
if (!builder.Path.EndsWith("/ReportService2010.asmx"))
builder.Path += (builder.Path.EndsWith("/") ? "" : "/") + "ReportService2010.asmx";
if (builder.Path.Equals("/ReportService2010.asmx"))
builder.Path = "/ReportServer" + builder.Path;
if (builder.Uri.IsDefaultPort)
return builder.Uri.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped);
return builder.ToString();
}
}
}
|
using SsrsDeploy;
using SsrsDeploy.ReportingService;
using SsrsDeploy.Execution;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SsrsDeploy.Factory
{
class ServiceFactory
{
private readonly ReportingService2010 rs;
public ServiceFactory(Options options)
{
this.rs = GetReportingService(options);
}
protected virtual ReportingService2010 GetReportingService(Options options)
{
var rs = new ReportingService2010();
var urlBuilder = new UrlBuilder();
urlBuilder.Setup(options);
urlBuilder.Build();
rs.Url = urlBuilder.GetUrl();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
return rs;
}
public ReportService GetReportService()
{
return new ReportService(rs);
}
public FolderService GetFolderService()
{
return new FolderService(rs);
}
public DataSourceService GetDataSourceService()
{
return new DataSourceService(rs);
}
}
}
|
Make usage of UrlBuilder and fix namespace
|
Make usage of UrlBuilder and fix namespace
|
C#
|
apache-2.0
|
Seddryck/RsPackage
|
07aeabbe1db531c13dfdd6d491ac09377abd3940
|
Verdeler/ConcurrencyLimiter.cs
|
Verdeler/ConcurrencyLimiter.cs
|
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace Verdeler
{
internal class ConcurrencyLimiter<TSubject>
{
private readonly Func<TSubject, object> _subjectReductionMap;
private readonly int _concurrencyLimit;
private readonly ConcurrentDictionary<object, SemaphoreSlim> _semaphores
= new ConcurrentDictionary<object, SemaphoreSlim>();
public ConcurrencyLimiter(Func<TSubject, object> subjectReductionMap, int concurrencyLimit)
{
if (concurrencyLimit <= 0)
{
throw new ArgumentException(@"Concurrency limit must be greater than 0.", nameof(concurrencyLimit));
}
_subjectReductionMap = subjectReductionMap;
_concurrencyLimit = concurrencyLimit;
}
public async Task WaitFor(TSubject subject)
{
var semaphore = GetSemaphoreForReducedSubject(subject);
await semaphore.WaitAsync().ConfigureAwait(false);
}
public void Release(TSubject subject)
{
var semaphore = GetSemaphoreForReducedSubject(subject);
semaphore.Release();
}
private SemaphoreSlim GetSemaphoreForReducedSubject(TSubject subject)
{
var reducedSubject = _subjectReductionMap.Invoke(subject);
var semaphore = _semaphores.GetOrAdd(reducedSubject, new SemaphoreSlim(_concurrencyLimit));
return semaphore;
}
}
}
|
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace Verdeler
{
internal class ConcurrencyLimiter<TSubject>
{
private readonly Func<TSubject, object> _subjectReductionMap;
private readonly int _concurrencyLimit;
private readonly ConcurrentDictionary<object, SemaphoreSlim> _semaphores
= new ConcurrentDictionary<object, SemaphoreSlim>();
public ConcurrencyLimiter(Func<TSubject, object> subjectReductionMap, int concurrencyLimit)
{
if (concurrencyLimit <= 0)
{
throw new ArgumentException(@"Concurrency limit must be greater than 0.", nameof(concurrencyLimit));
}
_subjectReductionMap = subjectReductionMap;
_concurrencyLimit = concurrencyLimit;
}
public async Task WaitFor(TSubject subject)
{
var semaphore = GetSemaphoreForReducedSubject(subject);
if (semaphore == null)
{
await Task.FromResult(0);
}
else
{
await semaphore.WaitAsync().ConfigureAwait(false);
}
}
public void Release(TSubject subject)
{
var semaphore = GetSemaphoreForReducedSubject(subject);
semaphore?.Release();
}
private SemaphoreSlim GetSemaphoreForReducedSubject(TSubject subject)
{
var reducedSubject = _subjectReductionMap.Invoke(subject);
if (reducedSubject == null)
{
return null;
}
var semaphore = _semaphores.GetOrAdd(reducedSubject, new SemaphoreSlim(_concurrencyLimit));
return semaphore;
}
}
}
|
Allow for grouping to null
|
Allow for grouping to null
|
C#
|
mit
|
justinjstark/Delivered,justinjstark/Verdeler
|
b5e52a9c5e66c17b3914bc32b134ff28ee2a5afa
|
src/Bibliotheca.Server.Depository.FileSystem.Core/DataTransferObjects/ProjectDto.cs
|
src/Bibliotheca.Server.Depository.FileSystem.Core/DataTransferObjects/ProjectDto.cs
|
using System.Collections.Generic;
namespace Bibliotheca.Server.Depository.FileSystem.Core.DataTransferObjects
{
public class ProjectDto
{
public ProjectDto()
{
Tags = new List<string>();
VisibleBranches = new List<string>();
EditLinks = new List<EditLinkDto>();
}
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string DefaultBranch { get; set; }
public List<string> VisibleBranches { get; set; }
public List<string> Tags { get; private set; }
public string Group { get; set; }
public string ProjectSite { get; set; }
public List<ContactPersonDto> ContactPeople { get; set; }
public List<EditLinkDto> EditLinks { get; set; }
}
}
|
using System.Collections.Generic;
namespace Bibliotheca.Server.Depository.FileSystem.Core.DataTransferObjects
{
public class ProjectDto
{
public ProjectDto()
{
Tags = new List<string>();
VisibleBranches = new List<string>();
EditLinks = new List<EditLinkDto>();
}
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string DefaultBranch { get; set; }
public List<string> VisibleBranches { get; set; }
public List<string> Tags { get; private set; }
public string Group { get; set; }
public string ProjectSite { get; set; }
public List<ContactPersonDto> ContactPeople { get; set; }
public List<EditLinkDto> EditLinks { get; set; }
public string AccessToken { get; set; }
}
}
|
Add access token to project.
|
Add access token to project.
|
C#
|
mit
|
mczachurski/Bibliotheca.Server.Depository.FileSystem
|
442fb84fe9353b5a6d9040dcfe47987df0c970b5
|
CorePlugin/Resources/PythonScript.cs
|
CorePlugin/Resources/PythonScript.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Duality;
using Duality.Editor;
namespace RockyTV.Duality.Plugins.IronPython.Resources
{
[EditorHintCategory(Properties.ResNames.CategoryScripts)]
[EditorHintImage(Properties.ResNames.IconScript)]
public class PythonScript : Resource
{
protected string _content;
public string Content { get { return _content; } }
public void UpdateContent(string content)
{
_content = content;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Duality;
using Duality.Editor;
namespace RockyTV.Duality.Plugins.IronPython.Resources
{
[EditorHintCategory(Properties.ResNames.CategoryScripts)]
[EditorHintImage(Properties.ResNames.IconScript)]
public class PythonScript : Resource
{
protected string _content;
public string Content { get { return _content; } }
public PythonScript()
{
var sb = new StringBuilder();
sb.AppendLine("# You can access the parent GameObject by calling `gameObject`.");
sb.AppendLine("# To use Duality objects, you must first import them.");
sb.AppendLine("# Example:");
sb.AppendLine(@"#\tfrom Duality import Vector2");
sb.AppendLine();
sb.AppendLine("class PyModule: ");
sb.AppendLine(" def __init__(self):");
sb.AppendLine(" pass");
sb.AppendLine();
sb.AppendLine("# The `start` function is called whenever a component is initializing.");
sb.AppendLine(" def start(self):");
sb.AppendLine(" pass");
sb.AppendLine();
sb.AppendLine("# The `update` function is called whenever an update happens, and includes a delta.");
sb.AppendLine(" def update(self, delta):");
sb.AppendLine(" pass");
sb.AppendLine();
_content = sb.ToString();
}
public void UpdateContent(string content)
{
_content = content;
}
}
}
|
Add sample script when a script is created
|
Add sample script when a script is created
|
C#
|
mit
|
RockyTV/Duality.IronPython
|
c4f166084133f129d1f0195473836943db4dff5f
|
osu.Game/Tests/FlakyTestAttribute.cs
|
osu.Game/Tests/FlakyTestAttribute.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using NUnit.Framework;
namespace osu.Game.Tests
{
/// <summary>
/// An attribute to mark any flaky tests.
/// Will add a retry count unless environment variable `FAIL_FLAKY_TESTS` is set to `1`.
/// </summary>
public class FlakyTestAttribute : RetryAttribute
{
public FlakyTestAttribute()
: this(10)
{
}
public FlakyTestAttribute(int tryCount)
: base(Environment.GetEnvironmentVariable("FAIL_FLAKY_TESTS") == "1" ? 0 : tryCount)
{
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using NUnit.Framework;
namespace osu.Game.Tests
{
/// <summary>
/// An attribute to mark any flaky tests.
/// Will add a retry count unless environment variable `FAIL_FLAKY_TESTS` is set to `1`.
/// </summary>
public class FlakyTestAttribute : RetryAttribute
{
public FlakyTestAttribute()
: this(10)
{
}
public FlakyTestAttribute(int tryCount)
: base(Environment.GetEnvironmentVariable("OSU_TESTS_FAIL_FLAKY") == "1" ? 0 : tryCount)
{
}
}
}
|
Rename ENVVAR in line with previous one (`OSU_TESTS_NO_TIMEOUT`)
|
Rename ENVVAR in line with previous one (`OSU_TESTS_NO_TIMEOUT`)
|
C#
|
mit
|
peppy/osu,ppy/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu
|
4452879a4d2b95c6a95fcf236b6f91ab486ead1d
|
Assets/FungusExample/Scripts/SpritesRoom.cs
|
Assets/FungusExample/Scripts/SpritesRoom.cs
|
using UnityEngine;
using System.Collections;
using Fungus;
public class SpritesRoom : Room
{
public Room menuRoom;
public Animator blueAlienAnim;
public SpriteController blueAlienSprite;
void OnEnter()
{
Say("Pink Alien says to Blue Alien...");
Say("...'Show me your funky moves!'");
SetAnimatorTrigger(blueAlienAnim, "StartBlueWalk");
Say("Blue Alien starts to dance.");
Say("Tap on Blue Alien to stop him dancing.");
}
// This method is called from the Button component on the BlueAlien object
void StopDancing()
{
SetAnimatorTrigger(blueAlienAnim, "Stop");
Say("Nice moves there Blue Alien!");
Say("Uh oh, you look like you're turning a little green after all that dancing!");
SetAnimatorTrigger(blueAlienAnim, "StartGreenWalk");
Say("Never mind, you'll feel better soon!");
}
void OnAnimationEvent(string eventName)
{
if (eventName == "GreenAnimationFinished")
{
SetAnimatorTrigger(blueAlienAnim, "Stop");
Say("Well done Blue Alien! Time to say goodbye!");
FadeSprite(blueAlienSprite, 0, 1f);
Wait(1f);
Say("Heh. That Blue Alien - what a guy!");
MoveToRoom(menuRoom);
}
}
}
|
using UnityEngine;
using System.Collections;
using Fungus;
public class SpritesRoom : Room
{
public Room menuRoom;
public Animator blueAlienAnim;
public SpriteController blueAlienSprite;
void OnEnter()
{
ShowSprite(blueAlienSprite);
Say("Pink Alien says to Blue Alien...");
Say("...'Show me your funky moves!'");
SetAnimatorTrigger(blueAlienAnim, "StartBlueWalk");
Say("Blue Alien starts to dance.");
Say("Tap on Blue Alien to stop him dancing.");
}
// This method is called from the Button component on the BlueAlien object
void StopDancing()
{
SetAnimatorTrigger(blueAlienAnim, "Stop");
Say("Nice moves there Blue Alien!");
Say("Uh oh, you look like you're turning a little green after all that dancing!");
SetAnimatorTrigger(blueAlienAnim, "StartGreenWalk");
Say("Never mind, you'll feel better soon!");
}
void OnAnimationEvent(string eventName)
{
if (eventName == "GreenAnimationFinished")
{
SetAnimatorTrigger(blueAlienAnim, "Stop");
Say("Well done Blue Alien! Time to say goodbye!");
FadeSprite(blueAlienSprite, 0, 1f);
Wait(1f);
Say("Heh. That Blue Alien - what a guy!");
MoveToRoom(menuRoom);
}
}
}
|
Make sure blue alien is visible next time you visit Sprites Room.
|
Make sure blue alien is visible next time you visit Sprites Room.
|
C#
|
mit
|
inarizushi/Fungus,tapiralec/Fungus,Nilihum/fungus,FungusGames/Fungus,lealeelu/Fungus,kdoore/Fungus,RonanPearce/Fungus,snozbot/fungus
|
c3bb88542124f1038470f3845c8660c95059fcd9
|
osu.Framework/Graphics/Batches/TriangleBatch.cs
|
osu.Framework/Graphics/Batches/TriangleBatch.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.Graphics.OpenGL.Buffers;
using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.OpenGL.Vertices;
using osuTK.Graphics.ES30;
namespace osu.Framework.Graphics.Batches
{
/// <summary>
/// A batch to be used when drawing triangles with <see cref="TextureGLSingle.DrawTriangle"/>.
/// </summary>
public class TriangleBatch<T> : VertexBatch<T>
where T : struct, IEquatable<T>, IVertex
{
public TriangleBatch(int size, int maxBuffers)
: base(size, maxBuffers)
{
}
protected override VertexBuffer<T> CreateVertexBuffer() => new QuadVertexBuffer<T>(Size, BufferUsageHint.DynamicDraw);
}
}
|
// 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.Graphics.OpenGL.Buffers;
using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.OpenGL.Vertices;
using osuTK.Graphics.ES30;
namespace osu.Framework.Graphics.Batches
{
/// <summary>
/// A batch to be used when drawing triangles with <see cref="TextureGLSingle.DrawTriangle"/>.
/// </summary>
public class TriangleBatch<T> : VertexBatch<T>
where T : struct, IEquatable<T>, IVertex
{
public TriangleBatch(int size, int maxBuffers)
: base(size, maxBuffers)
{
}
//We can re-use the QuadVertexBuffer as both Triangles and Quads have four Vertices and six indices.
protected override VertexBuffer<T> CreateVertexBuffer() => new QuadVertexBuffer<T>(Size, BufferUsageHint.DynamicDraw);
}
}
|
Add a comment explaining why we're using QuadVertexBuffer
|
Add a comment explaining why we're using QuadVertexBuffer
|
C#
|
mit
|
smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework
|
25f7d71bc5ff4d4911f67f4cea887a6682584b9e
|
CoreComponents/AssemblyInfo/AssemblyInfo.cs
|
CoreComponents/AssemblyInfo/AssemblyInfo.cs
|
/*
AssemblyInfo.cs
This file is part of Morgan's CLR Advanced Runtime (MCART)
Author(s):
César Andrés Morgan <xds_xps_ivx@hotmail.com>
Copyright (c) 2011 - 2018 César Andrés Morgan
Morgan's CLR Advanced Runtime (MCART) is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Morgan's CLR Advanced Runtime (MCART) 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 General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Reflection;
[assembly: AssemblyCompany("TheXDS! non-Corp.")]
[assembly: AssemblyProduct("Morgan's CLR Advanced Runtime")]
[assembly: AssemblyCopyright("Copyright © 2011-2018 César Andrés Morgan")]
[assembly: AssemblyVersion("0.8.3.4")]
#if CLSCompliance
[assembly: System.CLSCompliant(true)]
#endif
|
/*
AssemblyInfo.cs
This file is part of Morgan's CLR Advanced Runtime (MCART)
Author(s):
César Andrés Morgan <xds_xps_ivx@hotmail.com>
Copyright (c) 2011 - 2018 César Andrés Morgan
Morgan's CLR Advanced Runtime (MCART) is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Morgan's CLR Advanced Runtime (MCART) 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 General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Reflection;
[assembly: AssemblyCompany("TheXDS! non-Corp.")]
[assembly: AssemblyProduct("Morgan's CLR Advanced Runtime")]
[assembly: AssemblyCopyright("Copyright © 2011-2018 César Andrés Morgan")]
[assembly: AssemblyVersion("0.8.4.0")]
#if CLSCompliance
[assembly: System.CLSCompliant(true)]
#endif
|
Bump número de versión a 0.8.4.0
|
Bump número de versión a 0.8.4.0
|
C#
|
mit
|
TheXDS/MCART
|
bdd00c555dca23b179ae38cc85c00e91fbac6252
|
osu.Framework/Timing/IFrameBasedClock.cs
|
osu.Framework/Timing/IFrameBasedClock.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.
namespace osu.Framework.Timing
{
/// <summary>
/// A clock which will only update its current time when a frame proces is triggered.
/// Useful for keeping a consistent time state across an individual update.
/// </summary>
public interface IFrameBasedClock : IClock
{
/// <summary>
/// Elapsed time since last frame in milliseconds.
/// </summary>
double ElapsedFrameTime { get; }
/// <summary>
/// A moving average representation of the frames per second of this clock.
/// Do not use this for any timing purposes (use <see cref="ElapsedFrameTime"/> instead).
/// </summary>
double FramesPerSecond { get; }
FrameTimeInfo TimeInfo { get; }
/// <summary>
/// Processes one frame. Generally should be run once per update loop.
/// </summary>
void ProcessFrame();
}
}
|
// 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.
namespace osu.Framework.Timing
{
/// <summary>
/// A clock which will only update its current time when a frame process is triggered.
/// Useful for keeping a consistent time state across an individual update.
/// </summary>
public interface IFrameBasedClock : IClock
{
/// <summary>
/// Elapsed time since last frame in milliseconds.
/// </summary>
double ElapsedFrameTime { get; }
/// <summary>
/// A moving average representation of the frames per second of this clock.
/// Do not use this for any timing purposes (use <see cref="ElapsedFrameTime"/> instead).
/// </summary>
double FramesPerSecond { get; }
FrameTimeInfo TimeInfo { get; }
/// <summary>
/// Processes one frame. Generally should be run once per update loop.
/// </summary>
void ProcessFrame();
}
}
|
Correct misspelled word in the interface summary
|
Correct misspelled word in the interface summary
|
C#
|
mit
|
ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework
|
e21aeeaf7d6ff44fafda62d71d2ed0ccbb3e9efd
|
Assets/Scripts/ComponentPool.cs
|
Assets/Scripts/ComponentPool.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ComponentPool<T> where T : MonoBehaviour
{
private Func<T> _instantiateAction;
private Action<T> _getComponentAction;
private Action<T> _returnComponentAction;
private Stack<T> _pooledObjects;
private int _lastInstantiatedAmount;
public ComponentPool(int initialPoolSize, Func<T> instantiateFunction, Action<T> getComponentAction = null, Action<T> returnComponentAction = null)
{
this._instantiateAction = instantiateFunction;
this._getComponentAction = getComponentAction;
this._returnComponentAction = returnComponentAction;
this._pooledObjects = new Stack<T>();
InstantiateComponentsIntoPool(initialPoolSize);
}
public T Get()
{
if (_pooledObjects.Count == 0)
InstantiateComponentsIntoPool((_lastInstantiatedAmount * 2) + 1);
T component = _pooledObjects.Pop();
if (_getComponentAction != null)
_getComponentAction(component);
return _pooledObjects.Pop();
}
public void Return(T component)
{
_pooledObjects.Push(component);
if (_returnComponentAction != null)
_returnComponentAction(component);
}
private void InstantiateComponentsIntoPool(int nComponents)
{
for (int i = 0; i < nComponents; i++)
{
var pooledObject = _instantiateAction();
_pooledObjects.Push(pooledObject);
}
_lastInstantiatedAmount = _pooledObjects.Count;
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ComponentPool<T> where T : MonoBehaviour
{
private Func<T> _instantiateAction;
private Action<T> _getComponentAction;
private Action<T> _returnComponentAction;
private Stack<T> _pooledObjects;
private int _lastInstantiatedAmount;
public ComponentPool(int initialPoolSize, Func<T> instantiateFunction, Action<T> getComponentAction = null, Action<T> returnComponentAction = null)
{
this._instantiateAction = instantiateFunction;
this._getComponentAction = getComponentAction;
this._returnComponentAction = returnComponentAction;
this._pooledObjects = new Stack<T>();
InstantiateComponentsIntoPool(initialPoolSize);
}
public T Get()
{
if (_pooledObjects.Count == 0)
InstantiateComponentsIntoPool((_lastInstantiatedAmount * 2) + 1);
T component = _pooledObjects.Pop();
if (_getComponentAction != null)
_getComponentAction(component);
return component;
}
public void Return(T component)
{
_pooledObjects.Push(component);
if (_returnComponentAction != null)
_returnComponentAction(component);
}
private void InstantiateComponentsIntoPool(int nComponents)
{
for (int i = 0; i < nComponents; i++)
{
var pooledObject = _instantiateAction();
_pooledObjects.Push(pooledObject);
}
_lastInstantiatedAmount = _pooledObjects.Count;
}
}
|
Fix major bug with component pool
|
Fix major bug with component pool
|
C#
|
mit
|
lupidan/Tetris
|
bfebc36b5f8570a8ae78e7c06c7d32f50f30ba12
|
src/Daterpillar.Core/IndexColumn.cs
|
src/Daterpillar.Core/IndexColumn.cs
|
using System.Xml.Serialization;
namespace Gigobyte.Daterpillar
{
/// <summary>
/// Represents a database indexed column.
/// </summary>
public struct IndexColumn
{
/// <summary>
/// Gets or sets the column's name.
/// </summary>
/// <value>The name.</value>
[XmlText]
public string Name { get; set; }
/// <summary>
/// Gets or sets the column's order.
/// </summary>
/// <value>The order.</value>
[XmlAttribute("order")]
public SortOrder Order { get; set; }
}
}
|
using System.Xml.Serialization;
namespace Gigobyte.Daterpillar
{
/// <summary>
/// Represents a database indexed column.
/// </summary>
public struct IndexColumn
{
/// <summary>
/// Initializes a new instance of the <see cref="IndexColumn"/> struct.
/// </summary>
/// <param name="name">The name.</param>
public IndexColumn(string name) : this(name, SortOrder.ASC)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IndexColumn"/> struct.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="order">The order.</param>
public IndexColumn(string name, SortOrder order)
{
Name = name;
Order = order;
}
/// <summary>
/// Gets or sets the column's name.
/// </summary>
/// <value>The name.</value>
[XmlText]
public string Name { get; set; }
/// <summary>
/// Gets or sets the column's order.
/// </summary>
/// <value>The order.</value>
[XmlAttribute("order")]
public SortOrder Order { get; set; }
}
}
|
Add new contructors to Index.cs
|
Add new contructors to Index.cs
|
C#
|
mit
|
Ackara/Daterpillar
|
4078c6720ee6cc125c610e4080116800b98f9179
|
CodeHub/Views/IssueDetailView.xaml.cs
|
CodeHub/Views/IssueDetailView.xaml.cs
|
using CodeHub.Helpers;
using CodeHub.ViewModels;
using Octokit;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace CodeHub.Views
{
public sealed partial class IssueDetailView : Windows.UI.Xaml.Controls.Page
{
public IssueDetailViewmodel ViewModel;
public IssueDetailView()
{
this.InitializeComponent();
ViewModel = new IssueDetailViewmodel();
this.DataContext = ViewModel;
NavigationCacheMode = NavigationCacheMode.Required;
}
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
commentsListView.SelectedIndex = -1;
if (e.NavigationMode != NavigationMode.Back)
{
await ViewModel.Load((e.Parameter as Tuple<string,string, Issue>));
}
}
}
}
|
using CodeHub.Helpers;
using CodeHub.ViewModels;
using Octokit;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace CodeHub.Views
{
public sealed partial class IssueDetailView : Windows.UI.Xaml.Controls.Page
{
public IssueDetailViewmodel ViewModel;
public IssueDetailView()
{
this.InitializeComponent();
ViewModel = new IssueDetailViewmodel();
this.DataContext = ViewModel;
NavigationCacheMode = NavigationCacheMode.Required;
}
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
commentsListView.SelectedIndex = -1;
if (e.NavigationMode != NavigationMode.Back)
{
if (ViewModel.Comments != null)
{
ViewModel.Comments.Clear();
}
await ViewModel.Load((e.Parameter as Tuple<string,string, Issue>));
}
}
}
}
|
Clear comments list on navigation
|
Clear comments list on navigation
|
C#
|
mit
|
aalok05/CodeHub,PoLaKoSz/CodeHub
|
ebce3fd3c7d408541b39b2fa37df45d82d057a08
|
osu.Game/Skinning/SkinnableTargetWrapper.cs
|
osu.Game/Skinning/SkinnableTargetWrapper.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 Newtonsoft.Json;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Skinning
{
/// <summary>
/// A container which is serialised and can encapsulate multiple skinnable elements into a single return type (for consumption via <see cref="ISkin.GetDrawableComponent"/>.
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
/// </summary>
[Serializable]
public class SkinnableTargetWrapper : Container, ISkinnableDrawable
{
public bool IsEditable => false;
private readonly Action<Container> applyDefaults;
/// <summary>
/// Construct a wrapper with defaults that should be applied once.
/// </summary>
/// <param name="applyDefaults">A function to apply the default layout.</param>
public SkinnableTargetWrapper(Action<Container> applyDefaults)
: this()
{
this.applyDefaults = applyDefaults;
}
[JsonConstructor]
public SkinnableTargetWrapper()
{
RelativeSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
base.LoadComplete();
// schedule is required to allow children to run their LoadComplete and take on their correct sizes.
Schedule(() => applyDefaults?.Invoke(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 Newtonsoft.Json;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Skinning
{
/// <summary>
/// A container which is serialised and can encapsulate multiple skinnable elements into a single return type (for consumption via <see cref="ISkin.GetDrawableComponent"/>.
/// Will also optionally apply default cross-element layout dependencies when initialised from a non-deserialised source.
/// </summary>
[Serializable]
public class SkinnableTargetWrapper : Container, ISkinnableDrawable
{
public bool IsEditable => false;
private readonly Action<Container> applyDefaults;
/// <summary>
/// Construct a wrapper with defaults that should be applied once.
/// </summary>
/// <param name="applyDefaults">A function to apply the default layout.</param>
public SkinnableTargetWrapper(Action<Container> applyDefaults)
: this()
{
this.applyDefaults = applyDefaults;
}
[JsonConstructor]
public SkinnableTargetWrapper()
{
RelativeSizeAxes = Axes.Both;
}
protected override void LoadComplete()
{
base.LoadComplete();
// schedule is required to allow children to run their LoadComplete and take on their correct sizes.
ScheduleAfterChildren(() => applyDefaults?.Invoke(this));
}
}
}
|
Use `ScheduleAfterChildren` to better match comment
|
Use `ScheduleAfterChildren` to better match comment
|
C#
|
mit
|
peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,UselessToucan/osu
|
8e13f2b8061be32a9a8c8f61e0cd5a1edc492dd8
|
src/ProjectEuler/Puzzles/Puzzle005.cs
|
src/ProjectEuler/Puzzles/Puzzle005.cs
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
using System.Linq;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=5</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle005 : Puzzle
{
/// <inheritdoc />
public override string Question => "What is the smallest positive number that is evenly divisible by all of the numbers from 1 to the specified value?";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified maximum number is invalid.");
return -1;
}
var divisors = Enumerable.Range(1, max).ToList();
for (int i = 1; i < int.MaxValue; i++)
{
if (divisors.All((p) => i % p == 0))
{
Answer = i;
break;
}
}
return 0;
}
}
}
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
using System.Linq;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=5</c>. This class cannot be inherited.
/// </summary>
internal sealed class Puzzle005 : Puzzle
{
/// <inheritdoc />
public override string Question => "What is the smallest positive number that is evenly divisible by all of the numbers from 1 to the specified value?";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
int max;
if (!TryParseInt32(args[0], out max) || max < 2)
{
Console.Error.WriteLine("The specified maximum number is invalid.");
return -1;
}
var divisors = Enumerable.Range(1, max).ToList();
for (int n = max; ; n++)
{
if (divisors.All((p) => n % p == 0))
{
Answer = n;
break;
}
}
return 0;
}
}
}
|
Improve performance of puzzle 5
|
Improve performance of puzzle 5
Improve the performance of puzzle 5 (slightly) by starting the search at
the maximum divisor value, rather than at one.
|
C#
|
apache-2.0
|
martincostello/project-euler
|
591f200da9c3aea49ba31f933376cbebd136604c
|
AngleSharp/Properties/AssemblyInfo.cs
|
AngleSharp/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AngleSharp")]
[assembly: AssemblyDescription("AngleSharp is the ultimate angle brackets parser library. It parses HTML5, MathML, SVG, XML and CSS to construct a DOM based on the official W3C specification.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AngleVisions")]
[assembly: AssemblyProduct("AngleSharp")]
[assembly: AssemblyCopyright("Copyright © Florian Rappl et al. 2013-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: InternalsVisibleToAttribute("AngleSharp.Core.Tests")]
[assembly: AssemblyVersion("0.8.6.*")]
[assembly: AssemblyFileVersion("0.8.6")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("AngleSharp")]
[assembly: AssemblyDescription("AngleSharp is the ultimate angle brackets parser library. It parses HTML5, MathML, SVG, XML and CSS to construct a DOM based on the official W3C specification.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AngleVisions")]
[assembly: AssemblyProduct("AngleSharp")]
[assembly: AssemblyCopyright("Copyright © Florian Rappl et al. 2013-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: InternalsVisibleToAttribute("AngleSharp.Core.Tests")]
[assembly: AssemblyVersion("0.8.7.*")]
[assembly: AssemblyFileVersion("0.8.7")]
|
Change version number to 0.8.7
|
Change version number to 0.8.7
|
C#
|
mit
|
AngleSharp/AngleSharp,AngleSharp/AngleSharp,zedr0n/AngleSharp.Local,FlorianRappl/AngleSharp,Livven/AngleSharp,zedr0n/AngleSharp.Local,zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,FlorianRappl/AngleSharp,Livven/AngleSharp
|
f0cc402b4be566925bf80694ba4e84cf947185e4
|
Mvc.Mailer/LinkedResourceProvider.cs
|
Mvc.Mailer/LinkedResourceProvider.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Net.Mime;
namespace Mvc.Mailer {
/// <summary>
/// This class is a utility class for instantiating LinkedResource objects
/// </summary>
public class LinkedResourceProvider : ILinkedResourceProvider {
public virtual List<LinkedResource> GetAll(Dictionary<string, string> resources) {
return resources
.Select(resource => Get(resource.Key, resource.Value))
.ToList();
}
public virtual LinkedResource Get(string contentId, string filePath) {
return new LinkedResource(filePath, GetContentType(filePath)) { ContentId = contentId };
}
public virtual ContentType GetContentType(string fileName) {
// Tyler: Possible null reference
var ext = System.IO.Path.GetExtension(fileName).ToLower();
var regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (regKey != null && regKey.GetValue("Content Type") != null) {
return new ContentType(regKey.GetValue("Content Type").ToString());
}
return null;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Net.Mime;
namespace Mvc.Mailer {
/// <summary>
/// This class is a utility class for instantiating LinkedResource objects
/// </summary>
public class LinkedResourceProvider : ILinkedResourceProvider {
public virtual List<LinkedResource> GetAll(Dictionary<string, string> resources) {
return resources
.Select(resource => Get(resource.Key, resource.Value))
.ToList();
}
public virtual LinkedResource Get(string contentId, string filePath) {
return new LinkedResource(filePath, GetContentType(filePath)) { ContentId = contentId };
}
public virtual ContentType GetContentType(string fileName) {
var ext = System.IO.Path.GetExtension(fileName).ToLower();
var regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (regKey != null && regKey.GetValue("Content Type") != null) {
return new ContentType(regKey.GetValue("Content Type").ToString());
}
return null;
}
}
}
|
Remove comment, null check unnecessary.
|
Remove comment, null check unnecessary.
|
C#
|
mit
|
AshWilliams/MvcMailer,smsohan/MvcMailer,AshWilliams/MvcMailer,smilecn02/MvcMailer,smilecn02/MvcMailer,smsohan/MvcMailer,zanfar/MvcMailer,zanfar/MvcMailer
|
38e63149c40bbed80d969b57a8f64eb5c745141c
|
Assets/MRTK/Providers/WindowsMixedReality/Shared/Editor/WindowsMixedRealityConfigurationChecker.cs
|
Assets/MRTK/Providers/WindowsMixedReality/Shared/Editor/WindowsMixedRealityConfigurationChecker.cs
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
using System.IO;
using UnityEditor;
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality
{
/// <summary>
/// Class to perform checks for configuration checks for the Windows Mixed Reality provider.
/// </summary>
[InitializeOnLoad]
static class WindowsMixedRealityConfigurationChecker
{
private const string FileName = "Microsoft.Windows.MixedReality.DotNetWinRT.dll";
private static readonly string[] definitions = { "DOTNETWINRT_PRESENT" };
static WindowsMixedRealityConfigurationChecker()
{
ReconcileDotNetWinRTDefine();
}
/// <summary>
/// Ensures that the appropriate symbolic constant is defined based on the presence of the DotNetWinRT binary.
/// </summary>
private static void ReconcileDotNetWinRTDefine()
{
FileInfo[] files = FileUtilities.FindFilesInAssets(FileName);
if (files.Length > 0)
{
ScriptUtilities.AppendScriptingDefinitions(BuildTargetGroup.WSA, definitions);
}
else
{
ScriptUtilities.RemoveScriptingDefinitions(BuildTargetGroup.WSA, definitions);
}
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
using System.IO;
using UnityEditor;
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality
{
/// <summary>
/// Class to perform checks for configuration checks for the Windows Mixed Reality provider.
/// </summary>
static class WindowsMixedRealityConfigurationChecker
{
private const string FileName = "Microsoft.Windows.MixedReality.DotNetWinRT.dll";
private static readonly string[] definitions = { "DOTNETWINRT_PRESENT" };
/// <summary>
/// Ensures that the appropriate symbolic constant is defined based on the presence of the DotNetWinRT binary.
/// </summary>
[MenuItem("Mixed Reality Toolkit/Utilities/Windows Mixed Reality/Check Configuration")]
private static void ReconcileDotNetWinRTDefine()
{
FileInfo[] files = FileUtilities.FindFilesInAssets(FileName);
if (files.Length > 0)
{
ScriptUtilities.AppendScriptingDefinitions(BuildTargetGroup.WSA, definitions);
}
else
{
ScriptUtilities.RemoveScriptingDefinitions(BuildTargetGroup.WSA, definitions);
}
}
}
}
|
Replace InitOnLoad with MRTK > Utils > WMR > Check Config
|
Replace InitOnLoad with MRTK > Utils > WMR > Check Config
|
C#
|
mit
|
DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
958eef2316133d4f318291b4c49195fe63b864b1
|
osu.Framework.Tests/VisualTestGame.cs
|
osu.Framework.Tests/VisualTestGame.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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Platform;
using osu.Framework.Testing;
namespace osu.Framework.Tests
{
internal class VisualTestGame : Game
{
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new TestBrowser(),
new CursorContainer(),
};
}
public override void SetHost(GameHost host)
{
base.SetHost(host);
host.Window.CursorState |= CursorState.Hidden;
}
}
}
|
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Framework.Testing;
namespace osu.Framework.Tests
{
internal class VisualTestGame : Game
{
[BackgroundDependencyLoader]
private void load()
{
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(@"osu.Framework.Tests.exe"), "Resources"));
Children = new Drawable[]
{
new TestBrowser(),
new CursorContainer(),
};
}
public override void SetHost(GameHost host)
{
base.SetHost(host);
host.Window.CursorState |= CursorState.Hidden;
}
}
}
|
Add the tests executable as a resource store
|
Add the tests executable as a resource store
|
C#
|
mit
|
ppy/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,default0/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,Tom94/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,default0/osu-framework,Tom94/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.